Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(realtime): stop forbidding the model to reach the user's own world
Ruben Lütkedebbf9c2fa36
diff --git a/jarvis/realtime/session.py b/jarvis/realtime/session.pyindex 2ffe2a443b..12b5a6f9f4 100644--- a/jarvis/realtime/session.py+++ b/jarvis/realtime/session.py@@ -82,22 +82,32 @@ _DELEGATE_DECLARATION: dict[str, Any] = {}_DELEGATE_ROLE_DIRECTIVE = ("You have ONE action function: jarvis_action. It hands the user's spoken "- "request to the Jarvis action system, which can open apps and views, "- "change settings, control the computer, manage files and windows, and "- "start background research or coding missions. The Jarvis orchestrator "- "automatically handles every Wiki read or write, every question about the "- "user's private or personal memory, and every question about current "- "Jarvis settings, installed tools, MCPs, CLIs, integrations, connections, "- "capabilities, or system state. Do not answer or call a function for those "- "turns; wait for the trusted result that the orchestrator injects. For any "- "other request to act on the computer or Jarvis app, call jarvis_action. "- "Answer only general world knowledge and ordinary social chat yourself. Never "- "claim that an action or mission was started, completed, saved, opened, "- "or changed unless the latest successful jarvis_action result explicitly "- "supports that claim. A promise or intention is not a result. The function "- "returns spoken_reply: deliver that content to the user in your own voice, "- "in the conversation language, without reading JSON. If spoken_reply asks "- "a confirmation question, ask the user and call jarvis_action again with "+ "request to the Jarvis action system, which reads and writes the user's "+ "private Wiki memory, opens apps and views, changes settings, controls the "+ "computer, manages files and windows, starts background research or coding "+ "missions, and reports the current Jarvis settings, installed tools, MCPs, "+ "CLIs, integrations, connections, capabilities, and system state. "+ "CALL jarvis_action for EVERY turn that needs the user's own world: their "+ "Wiki or personal memory, their people, their projects, their files, their "+ "apps, their settings, their system state, or any action on their computer "+ "— including a vague, elliptical, or garbled follow-up that refers back to "+ "such a turn ('and what else is in there?', 'what does it say?'). You "+ "cannot see any of it yourself, so guessing is always wrong. Answer from "+ "your own knowledge only for general world knowledge and ordinary social "+ "chat. "+ "Never announce that you are going to look something up, check, read, "+ "fetch, open, save, enter, or do anything: either call jarvis_action in the "+ "same response, or do not say it at all. An announcement without a function "+ "call in the same response is a lie. Never claim that an action or mission "+ "was started, completed, saved, opened, or changed unless the latest "+ "successful jarvis_action result explicitly supports that claim. A promise "+ "or an intention is not a result. "+ "For some turns the Jarvis orchestrator takes over and injects a trusted "+ "result on its own; a separate instruction tells you when that is the case, "+ "and only then do you wait instead of calling. The function returns "+ "spoken_reply: deliver that content to the user in your own voice, in the "+ "conversation language, without reading JSON. If spoken_reply asks a "+ "confirmation question, ask the user and call jarvis_action again with ""their answer. Use end_call only when the user says goodbye.")_DELEGATE_REQUIRED_DIRECTIVE = (diff --git a/tests/unit/realtime/test_session.py b/tests/unit/realtime/test_session.pyindex 7df78eff84..088dd534c4 100644--- a/tests/unit/realtime/test_session.py+++ b/tests/unit/realtime/test_session.py@@ -1715,7 +1715,7 @@ async def test_delegate_mode_declares_single_action_function():assert _tool_names(provider.opened_with) == ["jarvis_action", "end_call"]assert "jarvis_action" in provider.opened_with.instructions- assert "private or personal memory" in provider.opened_with.instructions+ assert "Wiki or personal memory" in provider.opened_with.instructionsassert "MCPs" in provider.opened_with.instructions@@ -2146,6 +2146,63 @@ async def test_explicit_bridge_wins_over_delegate_mode():assert "jarvis_action" not in names+async def test_delegate_directive_orders_a_function_call_for_private_memory():+ """The model is the fallback whenever the deterministic gate misses."""+ provider = FakeProvider([RealtimeEvent(type="turn_complete")])+ sess = _session(provider, brain=FakeBrain())++ await sess.handle_control({"type": "audio_start", "sample_rate": 16_000})+ await sess.wait_finished()+ await sess.end(reason="test")++ instructions = provider.opened_with.instructions+ # It must never again be told to sit on its hands for those turns.+ assert "Do not answer or call a function for those turns" not in instructions+ assert "Wiki or personal memory" in instructions+ assert "garbled follow-up" in instructions+ assert "Never announce that you are going to" in instructions+++async def test_gate_miss_lets_the_model_reach_the_wiki_through_jarvis_action():+ """A vague follow-up the planner cannot classify must still reach the brain."""+ from jarvis.brain.turn_planner import plan_turn++ utterance = "Was steht da drin?" # i18n-allow: German speech-input fixture+ assert plan_turn(utterance).requires_orchestrator is False++ brain = FakeBrain(replies=("Your wiki holds pages about you and Lukas.",))+ provider = FakeProvider(+ [+ RealtimeEvent(+ type="input_transcript",+ text=utterance,+ is_final=True,+ ),+ RealtimeEvent(+ type="tool_call",+ call_id="c-1",+ tool_name="jarvis_action",+ tool_args={"request": "What is in my wiki?"},+ ),+ RealtimeEvent(type="turn_complete"),+ ]+ )+ sess = _session(provider, brain=brain)++ await sess.handle_control({"type": "audio_start", "sample_rate": 16_000})+ await sess.wait_finished()+ await asyncio.sleep(0.02)++ assert brain.calls[0][0] == utterance+ assert provider.session.tool_results[0][2] == {+ "success": True,+ "spoken_reply": "Your wiki holds pages about you and Lukas.",+ }+ await sess.end(reason="test")++@pytest.mark.asyncioasync def test_delegate_call_dispatches_raw_transcript_with_voice_confirm():brain = FakeBrain(replies=("Settings are open.",))