diff --git a/src/uipath/runtime/context.py b/src/uipath/runtime/context.py index 924548c..4a45850 100644 --- a/src/uipath/runtime/context.py +++ b/src/uipath/runtime/context.py @@ -55,7 +55,7 @@ class UiPathRuntimeContext(BaseModel): None, description="Conversation owner id for CAS (a real cloud user id or a synthetic user id)", ) - voice_mode: Literal["session"] | None = Field( + voice_mode: Literal["session", "maestro_flow"] | None = Field( None, description="Voice job type for CAS" ) mcp_server_id: str | None = None diff --git a/tests/test_context.py b/tests/test_context.py index d3ed4ae..d9c0d8c 100644 --- a/tests/test_context.py +++ b/tests/test_context.py @@ -3,6 +3,7 @@ from typing import Any import pytest +from pydantic import ValidationError from uipath.core.errors import ErrorCategory, UiPathFaultedTriggerError from uipath.runtime.context import UiPathRuntimeContext @@ -371,3 +372,29 @@ def test_explicit_execution_source_not_overwritten() -> None: ctx = UiPathRuntimeContext(command="run", execution_source="custom") assert ctx.execution_source == "custom" + + +@pytest.mark.parametrize("voice_mode", ["session", "maestro_flow"]) +def test_constructor_accepts_supported_voice_modes(voice_mode: str) -> None: + ctx = UiPathRuntimeContext(voice_mode=voice_mode) + + assert ctx.voice_mode == voice_mode + + +@pytest.mark.parametrize("voice_mode", ["session", "maestro_flow"]) +def test_from_config_accepts_supported_voice_modes( + voice_mode: str, tmp_path: Path +) -> None: + config_path = tmp_path / "uipath.json" + config_path.write_text( + json.dumps({"fpsProperties": {"voice.mode": voice_mode}}) + ) + + ctx = UiPathRuntimeContext.from_config(str(config_path)) + + assert ctx.voice_mode == voice_mode + + +def test_constructor_rejects_unknown_voice_mode() -> None: + with pytest.raises(ValidationError): + UiPathRuntimeContext(voice_mode="chat")