From 11833a62dc79dd2ea99ed9cb5991d696d88f8ceb Mon Sep 17 00:00:00 2001 From: radu-mocanu Date: Mon, 15 Dec 2025 12:26:11 +0200 Subject: [PATCH] fix: wrap output str primitive --- pyproject.toml | 2 +- src/uipath/runtime/result.py | 2 ++ tests/test_context.py | 13 +++++++++++++ uv.lock | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ffead37..ded68e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath-runtime" -version = "0.2.8" +version = "0.2.9" 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/result.py b/src/uipath/runtime/result.py index e46e768..9264e1a 100644 --- a/src/uipath/runtime/result.py +++ b/src/uipath/runtime/result.py @@ -37,6 +37,8 @@ def to_dict(self) -> dict[str, Any]: output_data = {} elif isinstance(self.output, BaseModel): output_data = self.output.model_dump() + elif isinstance(self.output, str): + output_data = {"output": self.output} else: output_data = self.output diff --git a/tests/test_context.py b/tests/test_context.py index 1b38e50..8cf0d0d 100644 --- a/tests/test_context.py +++ b/tests/test_context.py @@ -234,3 +234,16 @@ def test_from_config_loads_runtime_and_fps_properties(tmp_path: Path) -> None: assert ctx.message_id == "msg-ghi" assert ctx.mcp_server_id == "mcp-server-456" assert ctx.mcp_server_slug == "test-server-slug" + + +def test_string_output_wrapped_in_dict() -> None: + """Test that string output is wrapped in a dict with key 'output'.""" + result = UiPathRuntimeResult( + status=UiPathRuntimeStatus.SUCCESSFUL, + output="primitive str", + ) + + result_dict = result.to_dict() + + assert result_dict["output"] == {"output": "primitive str"} + assert result_dict["status"] == UiPathRuntimeStatus.SUCCESSFUL diff --git a/uv.lock b/uv.lock index 7365516..db55239 100644 --- a/uv.lock +++ b/uv.lock @@ -1005,7 +1005,7 @@ wheels = [ [[package]] name = "uipath-runtime" -version = "0.2.8" +version = "0.2.9" source = { editable = "." } dependencies = [ { name = "uipath-core" },