diff --git a/packages/uipath/pyproject.toml b/packages/uipath/pyproject.toml index 3990c8917..fb2709314 100644 --- a/packages/uipath/pyproject.toml +++ b/packages/uipath/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath" -version = "2.10.8" +version = "2.10.9" description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools." readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" diff --git a/packages/uipath/src/uipath/_cli/_chat/_bridge.py b/packages/uipath/src/uipath/_cli/_chat/_bridge.py index a454afa17..dadc7c93f 100644 --- a/packages/uipath/src/uipath/_cli/_chat/_bridge.py +++ b/packages/uipath/src/uipath/_cli/_chat/_bridge.py @@ -9,6 +9,8 @@ from urllib.parse import urlparse from uipath.core.chat import ( + UiPathConversationErrorEvent, + UiPathConversationErrorStartEvent, UiPathConversationEvent, UiPathConversationExchangeEndEvent, UiPathConversationExchangeEvent, @@ -246,6 +248,51 @@ async def emit_exchange_end_event(self) -> None: logger.error(f"Error sending conversation event to WebSocket: {e}") raise RuntimeError(f"Failed to send conversation event: {e}") from e + async def emit_exchange_error_event( + self, error_id: str, message: str, details: Any | None = None + ) -> None: + """Send an exchange error event to signal an error to the UI. + + Args: + error_id: Identifier for the error type + message: Human-readable error message + details: Optional additional error details + """ + if self._client is None: + raise RuntimeError("WebSocket client not connected. Call connect() first.") + + if not self._connected_event.is_set() and not self._websocket_disabled: + raise RuntimeError("WebSocket client not in connected state") + + try: + exchange_error_event = UiPathConversationEvent( + conversation_id=self.conversation_id, + exchange=UiPathConversationExchangeEvent( + exchange_id=self.exchange_id, + error=UiPathConversationErrorEvent( + error_id=error_id, + start=UiPathConversationErrorStartEvent( + message=message, details=details + ), + ), + ), + ) + + event_data = exchange_error_event.model_dump( + mode="json", exclude_none=True, by_alias=True + ) + + if self._websocket_disabled: + logger.info( + f"SocketIOChatBridge is in debug mode. Not sending event: {json.dumps(event_data)}" + ) + else: + await self._client.emit("ConversationEvent", event_data) + + except Exception as e: + logger.error(f"Error sending exchange error event to WebSocket: {e}") + raise RuntimeError(f"Failed to send exchange error event: {e}") from e + async def emit_interrupt_event(self, resume_trigger: UiPathResumeTrigger): if self._client and self._connected_event.is_set(): try: diff --git a/packages/uipath/uv.lock b/packages/uipath/uv.lock index a523694a2..442596804 100644 --- a/packages/uipath/uv.lock +++ b/packages/uipath/uv.lock @@ -2531,7 +2531,7 @@ wheels = [ [[package]] name = "uipath" -version = "2.10.8" +version = "2.10.9" source = { editable = "." } dependencies = [ { name = "applicationinsights" }, @@ -2652,7 +2652,7 @@ wheels = [ [[package]] name = "uipath-platform" -version = "0.0.15" +version = "0.0.16" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "httpx" }, @@ -2661,9 +2661,9 @@ dependencies = [ { name = "truststore" }, { name = "uipath-core" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/cc/f0/d027be9852b97cee590071c12a89ecfadfb86bb37fde2a8e5b03a56819fb/uipath_platform-0.0.15.tar.gz", hash = "sha256:d76ef6855afabbba426dbec8e2ce9450c153a883bafe14da32412b13608dde76", size = 263083, upload-time = "2026-03-05T16:08:08.345Z" } +sdist = { url = "https://files.pythonhosted.org/packages/96/18/363703de3a48f126cf6917e0865865410d65df8478d97ebda36f529d411c/uipath_platform-0.0.16.tar.gz", hash = "sha256:c1453ab9f521c7c40703108281fc078a71963cfec9d49f5583c5f3d12e75ddf4", size = 264210, upload-time = "2026-03-06T20:20:01.59Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/fc/50/dd0ea3ecc927bc48f0ae61b897025896d8412c95cf7a1295dc65f975b80d/uipath_platform-0.0.15-py3-none-any.whl", hash = "sha256:1ddffc5d4cbe341aeb25162c2fdc4147e60fc9be4b33fdbde116906a313273b5", size = 158700, upload-time = "2026-03-05T16:08:06.552Z" }, + { url = "https://files.pythonhosted.org/packages/cb/f3/5f8c1ddf11850e1ca448d42fce652f6d04d59c2bf34c6419f3f79ebbaa93/uipath_platform-0.0.16-py3-none-any.whl", hash = "sha256:3635595ad271a4ef15f11aff2d43112d76d78d89683af8ddfc10468881a88d44", size = 159102, upload-time = "2026-03-06T20:19:59.448Z" }, ] [[package]]