diff --git a/pyproject.toml b/pyproject.toml index 3a7cb2e..a7b626c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath-runtime" -version = "0.11.1" +version = "0.11.2" description = "Runtime abstractions and interfaces for building agents and automation scripts in the UiPath ecosystem" readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" diff --git a/src/uipath/runtime/context.py b/src/uipath/runtime/context.py index f76e8e9..c655a76 100644 --- a/src/uipath/runtime/context.py +++ b/src/uipath/runtime/context.py @@ -37,6 +37,10 @@ class UiPathRuntimeContext(BaseModel): ) exchange_id: str | None = Field(None, description="Exchange identifier for CAS") message_id: str | None = Field(None, description="Message identifier for CAS") + end_exchange: bool = Field( + True, + description="Whether to emit the exchange end event for CAS", + ) conversational_user_id: str | None = Field( None, description="Conversation owner id for CAS (a real cloud user id or a synthetic user id)", @@ -368,6 +372,7 @@ def from_config( "conversationalService.conversationId": "conversation_id", "conversationalService.exchangeId": "exchange_id", "conversationalService.messageId": "message_id", + "conversationalService.endExchange": "end_exchange", "conversationalService.conversationalUserId": "conversational_user_id", "mcpServer.id": "mcp_server_id", "mcpServer.slug": "mcp_server_slug", diff --git a/tests/test_context.py b/tests/test_context.py index af5d8de..d4868c7 100644 --- a/tests/test_context.py +++ b/tests/test_context.py @@ -243,6 +243,38 @@ def test_from_config_loads_runtime_and_fps_properties(tmp_path: Path) -> None: assert ctx.mcp_server_slug == "test-server-slug" +def test_from_config_maps_end_exchange_fps_property(tmp_path: Path) -> None: + """conversationalService.endExchange should map onto end_exchange.""" + cfg = { + "fpsProperties": { + "conversationalService.conversationId": "conv-123", + "conversationalService.exchangeId": "ex-456", + "conversationalService.endExchange": False, + } + } + config_path = tmp_path / "uipath.json" + config_path.write_text(json.dumps(cfg)) + + ctx = UiPathRuntimeContext.from_config(config_path=str(config_path)) + + assert ctx.end_exchange is False + + +def test_end_exchange_defaults_true_when_fps_property_absent(tmp_path: Path) -> None: + """end_exchange defaults to True (legacy behavior) when the fps key is missing.""" + cfg = { + "fpsProperties": { + "conversationalService.conversationId": "conv-123", + } + } + config_path = tmp_path / "uipath.json" + config_path.write_text(json.dumps(cfg)) + + ctx = UiPathRuntimeContext.from_config(config_path=str(config_path)) + + assert ctx.end_exchange is True + + def test_result_file_written_on_faulted_trigger_error(tmp_path: Path) -> None: runtime_dir = tmp_path / "runtime" ctx = UiPathRuntimeContext( diff --git a/uv.lock b/uv.lock index 4651d34..f05b1f2 100644 --- a/uv.lock +++ b/uv.lock @@ -3,7 +3,7 @@ revision = 3 requires-python = ">=3.11" [options] -exclude-newer = "2026-06-16T20:40:40.185404Z" +exclude-newer = "2026-06-17T19:38:11.87942Z" exclude-newer-span = "P2D" [options.exclude-newer-package] @@ -1012,7 +1012,7 @@ wheels = [ [[package]] name = "uipath-runtime" -version = "0.11.1" +version = "0.11.2" source = { editable = "." } dependencies = [ { name = "uipath-core" },