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: ground chat references in visible terminal
Ruben Lütke62fb7f1bbeba
diff --git a/jarvis/agentic_ide/context.py b/jarvis/agentic_ide/context.pyindex c26e1b2f48..16f3aea519 100644--- a/jarvis/agentic_ide/context.py+++ b/jarvis/agentic_ide/context.py@@ -124,6 +124,15 @@ def focus_context_block(max_chars: int = _MAX_CHARS) -> str:parts: list[str] = [_HEADER, ""]parts.extend(session.profile.summary_lines())parts.append("")+ visible = session.contextual_terminal()+ if visible is not None:+ parts.append(+ f"Chat view is on screen with {visible.name} as the one visible terminal. "+ f"Deictic references such as 'this terminal', 'the terminal here', "+ f"or 'what is it doing?' mean {visible.name}, unless the user "+ "explicitly names another call-sign."+ )+ parts.append("")if session.terminals:tail_lines = (_LINES_PER_TERMINALdiff --git a/jarvis/agentic_ide/intent.py b/jarvis/agentic_ide/intent.pyindex a7009f508a..fd736688e3 100644--- a/jarvis/agentic_ide/intent.py+++ b/jarvis/agentic_ide/intent.py@@ -464,6 +464,32 @@ _BRIEFED_NAME_RE = re.compile(re.IGNORECASE,)+# A singular pane reference whose meaning comes from the UI rather than from a+# spoken call-sign. This is intentionally narrower than a bare "terminal": it+# requires a demonstrative/definite article or an on-screen word, and is only+# consulted when chat view reports one visible pane. Matching vocabulary, not+# prose, across every supported input locale.+_VISIBLE_TERMINAL_RE = re.compile(+ r"(?:"+ r"\b(?:this|that|the|current|visible|"+ r"dies(?:es|em|en)?|das|der|dem|den|aktuelle[nmrs]?|sichtbare[nmrs]?|"+ r"el|este|ese|actual|visible)\s+(?:terminal|pane|tab)\b"+ r"|"+ r"\b(?:terminal|pane|tab)\b[^.!?]{0,20}?"+ r"\b(?:here|on\s+screen|hier|im\s+bild|aqu[ií]|en\s+pantalla)\b"+ r")",+ re.IGNORECASE,+)++_VISIBLE_REPORT_RE = re.compile(+ r"\b(?:"+ r"what|how|status|progress|doing|done|stuck|"+ r"was|wie|status|fortschritt|macht|tut|l[aä]uft|los|fertig|h[aä]ngt|"+ r"qu[eé]|c[oó]mo|estado|progreso|haciendo|hecho|atascado"+ r")\b",+ re.IGNORECASE,+)+def _mentions(text: str, candidates: list[str], *, fuzzy: bool = True@@ -771,6 +797,56 @@ def detect(user_text: str, *, names: list[str] | None = None) -> TerminalIntentreturn found[0] if found else None+def detect_visible(+ user_text: str,+ *,+ terminal: str | None = None,+ names: list[str] | None = None,+) -> TerminalIntent | None:+ """Resolve "this terminal" to the one pane visibly filling chat view.++ Explicit call-signs always win. With no supplied ``terminal`` the active+ session is consulted, but only its ephemeral chat-stage context; grid view+ deliberately has no implicit target.+ """+ text = (user_text or "").strip()+ if len(text) < 3 or _VISIBLE_TERMINAL_RE.search(text) is None:+ return None+ candidates = _running_names() if names is None else list(names)+ if not candidates:+ return None+ # "Prompt T1, not this terminal" and every ordinary explicit address keep+ # the established resolver's answer, even while another pane is on stage.+ if detect_all(text, names=candidates):+ return None+ selected = terminal+ if selected is None:+ try:+ from .session import get_registry++ current = get_registry().session+ pane = current.contextual_terminal() if current is not None else None+ selected = pane.name if pane is not None else None+ except Exception: # noqa: BLE001 - optional UI context, never fatal+ return None+ if not selected or selected not in candidates:+ return None+ if _BRIEFING_VERB_RE.search(text):+ kind = KIND_PROMPT+ elif _VISIBLE_REPORT_RE.search(text):+ kind = KIND_REPORT+ elif _looks_like_instruction(text):+ kind = KIND_PROMPT+ else:+ return None+ return TerminalIntent(+ terminal=selected,+ kind=kind,+ instruction=text if kind == KIND_PROMPT else "",+ utterance=text,+ )++# Below this, stripping has eaten the task rather than the addressing — "schick# das an Kai" reduces to "das". The full utterance is then the honest input; the# composer reads both and can tell them apart.@@ -2327,7 +2403,12 @@ def owns_turn(user_text: str, *, names: list[str] | None = None) -> bool:return Trueif spawn_vehicle_outranks_workspace(text, names=names):return False- return detect(text, names=names) is not None+ if detect(text, names=names) is not None:+ return True+ # Only the process-wide form can honestly consult the active UI surface.+ # Injected candidate lists are used by pure detector tests and must not+ # acquire hidden global state.+ return names is None and detect_visible(text) is not None__all__ = [@@ -2339,6 +2420,7 @@ __all__ = ["TerminalIntent","detect","detect_all",+ "detect_visible","detect_close_fleet","detect_spawn","expects_several",diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.pyindex 8c8c90a92f..f254709d33 100644--- a/jarvis/agentic_ide/session.py+++ b/jarvis/agentic_ide/session.py@@ -1188,6 +1188,13 @@ class Session:# current session, and a restart should land the user back in normal mode# rather than silently keeping a narrowed assistant.focus_mode: bool = False+ # Ephemeral UI context for deictic voice/chat references. In chat view one+ # pane fills the stage, so "this terminal" has a concrete, visible meaning;+ # in the grid every pane is visible and no default is honest. This state is+ # reported by the mounted frontend and deliberately excluded from resume+ # snapshots: after a restart the UI reports what it actually shows again.+ surface_chat_visible: bool = False+ surface_terminal: str = ""# When this workspace was last brought to the front. Orders the "most# recently used" answer the resume snapshot and the UI both want, which is# NOT the order the workspaces were opened in.@@ -1228,6 +1235,12 @@ class Session:return Nonereturn next((t for t in self.terminals if t.name == matched), None)+ def contextual_terminal(self) -> Terminal | None:+ """The one pane visibly filling chat view, if there is exactly one."""+ if not self.surface_chat_visible or not self.surface_terminal:+ return None+ return self.find(self.surface_terminal)+def to_dict(self) -> dict[str, Any]:return {"id": self.id,@@ -2244,6 +2257,28 @@ class Registry:logger.info("Agentic IDE focus mode {}", "on" if enabled else "off")return session.focus_mode+ def set_surface_context(+ self,+ *,+ workspace_id: str,+ chat_view: bool,+ on_screen: bool,+ terminal: str | None,+ ) -> bool:+ """Record which single pane the active UI visibly puts on its stage.++ A stale grid can finish a request after the user changed workspace, so+ only the active workspace may write this context. Invalid or hidden+ selections clear the default rather than leaving a believable old one.+ """+ session = self.session+ if session is None or session.id != workspace_id:+ return False+ session.surface_chat_visible = bool(chat_view and on_screen)+ selected = session.find(terminal or "") if session.surface_chat_visible else None+ session.surface_terminal = selected.name if selected is not None else ""+ return True+# ------------------------------------------------------------------ ptydef _locate(self, key: str, workspace_id: str | None) -> tuple[Session, Terminal] | None:"""One pane and the workspace holding it, by call-sign.diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.pyindex 6e21dbda4d..b927aa8b1e 100644--- a/jarvis/brain/manager.py+++ b/jarvis/brain/manager.py@@ -5968,6 +5968,15 @@ class BrainManager:addressed = ide_intent.detect_all(user_text, names=candidates)+ if not addressed:+ current = session.contextual_terminal()+ visible = ide_intent.detect_visible(+ user_text,+ terminal=current.name if current is not None else None,+ names=candidates,+ )+ if visible is not None:+ addressed = [visible]except Exception: # noqa: BLE001 - detection must never break a turnreturn Nonediff --git a/jarvis/plugins/tool/app_command.py b/jarvis/plugins/tool/app_command.pyindex 6cdee408ea..dc86f54e3c 100644--- a/jarvis/plugins/tool/app_command.py+++ b/jarvis/plugins/tool/app_command.py@@ -156,6 +156,45 @@ def _summarize(title: str, data: Any) -> str:return f"{title} succeeded."+def _apply_visible_terminal_context(+ command_id: str, args: dict[str, Any], ctx: Any+) -> dict[str, Any]:+ """Correct a model's stale pane guess from the user's deictic wording.++ Realtime models can call registry tools directly, before the manager's+ deterministic Agentic-IDE path runs. The execution context still carries+ the exact user utterance, so "the terminal here" can be resolved from the+ UI's current chat stage even if prior conversation made the model pass T1.+ """+ expected_kind = {+ "agentic-ide-prompt": "prompt",+ "agentic-ide-terminal-report": "report",+ }.get(command_id)+ utterance = str(getattr(ctx, "user_utterance", "") or "")+ if expected_kind is None or not utterance:+ return args+ try:+ from jarvis.agentic_ide import intent as ide_intent+ from jarvis.agentic_ide.session import get_registry++ session = get_registry().session+ current = session.contextual_terminal() if session is not None else None+ if session is None or current is None:+ return args+ found = ide_intent.detect_visible(+ utterance,+ terminal=current.name,+ names=[term.name for term in session.terminals],+ )+ if found is None or found.kind != expected_kind:+ return args+ corrected = dict(args)+ corrected["name"] = current.name+ return corrected+ except Exception: # noqa: BLE001 - context is a correction, never a blocker+ return args++class _Runtime:"""Shared execution plumbing: resolve the live app + control key once."""@@ -221,6 +260,7 @@ class RegistryCommandTool:async def execute(self, args: dict[str, Any], ctx: Any) -> ToolResult:cmd = self._cmdcmd_args = _with_defaults(cmd.params, args or {})+ cmd_args = _apply_visible_terminal_context(cmd.id, cmd_args, ctx)problems = _validate_args(cmd.params, cmd_args)if problems:return ToolResult(diff --git a/jarvis/ui/web/agentic_ide_routes.py b/jarvis/ui/web/agentic_ide_routes.pyindex 4c0a1dc569..413369eb93 100644--- a/jarvis/ui/web/agentic_ide_routes.py+++ b/jarvis/ui/web/agentic_ide_routes.py@@ -288,6 +288,18 @@ class ModeRequest(BaseModel):)+class SurfaceContextRequest(BaseModel):+ """Which single terminal the Agentic-IDE UI visibly puts on stage."""++ workspace_id: str = Field(description="Workspace currently rendered by this view.")+ chat_view: bool = Field(description="True only while the one-pane chat view is selected.")+ on_screen: bool = Field(description="Whether the Agentic-IDE section is visible.")+ terminal: str | None = Field(+ default=None,+ description="Visible pane call-sign; null when no single pane is shown.",+ )++class TerminalTextSizeRequest(BaseModel):"""How large the text in the workspace's terminals should be, in pixels."""@@ -1735,6 +1747,23 @@ async def set_mode(request: Request, req: ModeRequest) -> dict:return {"ok": True, "focus_mode": enabled}[email protected]("/surface-context", summary="Report the visible Agentic-IDE terminal")+async def set_surface_context(req: SurfaceContextRequest) -> dict:+ """Keep deictic voice/chat references aligned with the visible chat pane.++ The state is ephemeral and active-workspace scoped. Grid view clears it,+ because several terminals are visible there and guessing one would be less+ honest than asking for a call-sign.+ """+ accepted = get_registry().set_surface_context(+ workspace_id=req.workspace_id,+ chat_view=req.chat_view,+ on_screen=req.on_screen,+ terminal=req.terminal,+ )+ return {"ok": True, "accepted": accepted}++@router.get("/ui-preferences", summary="Remembered workspace display preferences")async def get_ui_preferences() -> dict:"""How the workspace should look, as this machine last left it.diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsxindex 3a3dacbed0..52700acb94 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx@@ -86,6 +86,7 @@ vi.mock("@/lib/agenticIdeApi", () => ({max: 20,default: 13,})),+ syncAgenticIdeSurface: vi.fn(async () => undefined),}));// The grid follows the app theme for its terminal colours; these tests render@@ -2388,6 +2389,40 @@ describe("chat view", () => {expect(cellClass("Mika")).toContain("hidden");});+ it("grounds deictic voice references in the pane visibly on stage", async () => {+ renderGrid(FOUR);+ await waitFor(() =>+ expect(api.syncAgenticIdeSurface).toHaveBeenLastCalledWith({+ workspaceId: "ide_test",+ chatView: false,+ onScreen: true,+ terminal: null,+ }),+ );++ toChat();+ fireEvent.click(screen.getByTestId("chat-rail-Aria"));++ await waitFor(() =>+ expect(api.syncAgenticIdeSurface).toHaveBeenLastCalledWith({+ workspaceId: "ide_test",+ chatView: true,+ onScreen: true,+ terminal: "Aria",+ }),+ );++ toChat();+ await waitFor(() =>+ expect(api.syncAgenticIdeSurface).toHaveBeenLastCalledWith({+ workspaceId: "ide_test",+ chatView: false,+ onScreen: true,+ terminal: null,+ }),+ );+ });+it("remembers the chosen view for the next workspace", () => {renderGrid(FOUR);toChat();diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsxindex 1a2e53c484..3eae890aea 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx@@ -86,6 +86,7 @@ import {refreshTerminalRecap,renameTerminal,saveTerminalFontSize,+ syncAgenticIdeSurface,setTerminalRecap,promptTerminal,type ComposedPreview,@@ -1172,6 +1173,21 @@ export function AgenticGrid({return names[0] ?? null;}, [chatPane, target, session.terminals]);+ // The browser is the only layer that knows which pane fills the one-pane+ // chat stage. Hand that fact to the backend so voice and chat can resolve+ // "this terminal" from what the user actually sees. Grid view clears the+ // context rather than guessing among several visible panes.+ useEffect(() => {+ void syncAgenticIdeSurface({+ workspaceId: session.id,+ chatView,+ onScreen,+ terminal: chatView && onScreen ? chatSelected : null,+ }).catch((error) => {+ console.warn("Agentic IDE: could not sync the visible terminal:", error);+ });+ }, [chatSelected, chatView, onScreen, session.id]);+/** Rail click: show the pane, and aim the composer at it when it can listen. */const selectChatPane = useCallback((name: string, promptable: boolean) => {setChatPane(name);diff --git a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.tsindex 6baf563e3b..11da9f01dd 100644--- a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts+++ b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts@@ -1112,6 +1112,33 @@ export async function setFocusMode(enabled: boolean): Promise<boolean> {return body.focus_mode;}+/**+ * Tell the backend which single pane is visibly filling the chat stage.+ *+ * Ephemeral by design: this is grounding for "this terminal", not a display+ * preference. Grid view and hidden sections send no terminal because neither+ * has one honest implicit target.+ */+export async function syncAgenticIdeSurface(payload: {+ workspaceId: string;+ chatView: boolean;+ onScreen: boolean;+ terminal: string | null;+}): Promise<void> {+ const res = await fetch("/api/agentic-ide/surface-context", {+ method: "PUT",+ cache: "no-store",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({+ workspace_id: payload.workspaceId,+ chat_view: payload.chatView,+ on_screen: payload.onScreen,+ terminal: payload.terminal,+ }),+ });+ if (!res.ok) throw new Error(await detail(res));+}+/*** The workspace display preferences the backend remembers for this machine.*diff --git a/tests/unit/agentic_ide/test_context.py b/tests/unit/agentic_ide/test_context.pyindex 6f73be98b1..1e99db814b 100644--- a/tests/unit/agentic_ide/test_context.py+++ b/tests/unit/agentic_ide/test_context.py@@ -64,6 +64,27 @@ async def test_focus_mode_block_names_the_folder_and_terminals(assert "refactoring the router" in block+async def test_focus_context_names_the_one_terminal_visible_in_chat_view(+ wired: tuple[Registry, FakePtyManager], tmp_path: Path+) -> None:+ registry, _ = wired+ session = await registry.start(+ str(tmp_path), [{"agent": "claude"}, {"agent": "codex"}]+ )+ registry.set_focus_mode(True)+ assert registry.set_surface_context(+ workspace_id=session.id,+ chat_view=True,+ on_screen=True,+ terminal="T2",+ )++ block = focus_context_block()++ assert "one visible terminal" in block+ assert "mean T2" in block++async def test_block_is_capped(wired: tuple[Registry, FakePtyManager], tmp_path: Path) -> None:diff --git a/tests/unit/agentic_ide/test_intent.py b/tests/unit/agentic_ide/test_intent.pyindex f6bd79d4a4..bf92243121 100644--- a/tests/unit/agentic_ide/test_intent.py+++ b/tests/unit/agentic_ide/test_intent.py@@ -109,6 +109,45 @@ def test_unrelated_turns_are_left_alone(utterance: str) -> None:assert intent.owns_turn(utterance, names=NAMES) is False+def test_visible_chat_terminal_resolves_a_deictic_prompt() -> None:+ utterance = (+ "Kannst du bitte das Terminal prompten " # i18n-allow: spoken input+ "hier und prüfen, ob der neue Subscription-Pfad " # i18n-allow: spoken input+ "dieselben Funktionen hat?" # i18n-allow: spoken input+ )++ found = intent.detect_visible(utterance, terminal="T4", names=["T1", "T4"])++ assert found is not None+ assert found.terminal == "T4"+ assert found.kind == intent.KIND_PROMPT+++def test_visible_chat_terminal_resolves_a_deictic_report() -> None:+ found = intent.detect_visible(+ "Can you check what the terminal here is doing?",+ terminal="T4",+ names=["T1", "T4"],+ )++ assert found is not None+ assert found.terminal == "T4"+ assert found.kind == intent.KIND_REPORT+++def test_explicit_call_sign_beats_the_visible_chat_terminal() -> None:+ assert intent.detect_visible(+ "Prompt T1, not this terminal, to run the tests",+ terminal="T4",+ names=["T1", "T4"],+ ) is None+ explicit = intent.detect(+ "Prompt T1, not this terminal, to run the tests", names=["T1", "T4"]+ )+ assert explicit is not None+ assert explicit.terminal == "T1"++def test_no_open_workspace_means_no_claim() -> None:"""With no terminals running, nothing can be addressed."""assert intent.detect("Sag Alex, sie soll die Tests starten", names=[]) is None # i18n-allow: German speech input under testdiff --git a/tests/unit/agentic_ide/test_surface_context_route.py b/tests/unit/agentic_ide/test_surface_context_route.pynew file mode 100644index 0000000000..a59abf2e63--- /dev/null+++ b/tests/unit/agentic_ide/test_surface_context_route.py@@ -0,0 +1,91 @@+"""The one-pane chat stage is the grounding for "this terminal"."""+from __future__ import annotations++from pathlib import Path++import pytest+from fastapi import FastAPI+from fastapi.testclient import TestClient++from jarvis.agentic_ide import session as session_mod+from jarvis.agentic_ide.session import Registry+from jarvis.ui.web import agentic_ide_routes+from tests.fakes.fake_pty_manager import FakePtyManager+++def registry(monkeypatch: pytest.MonkeyPatch) -> Registry:+ monkeypatch.setattr(session_mod, "agent_argv", lambda name: (f"/usr/bin/{name}",))+ instance = Registry(pty_manager=FakePtyManager())+ monkeypatch.setattr(agentic_ide_routes, "get_registry", lambda: instance)+ return instance+++def client(registry: Registry) -> TestClient:+ app = FastAPI()+ app.include_router(agentic_ide_routes.router)+ return TestClient(app)+++async def test_chat_surface_records_the_visible_terminal(+ client: TestClient, registry: Registry, tmp_path: Path+) -> None:+ session = await registry.start(+ str(tmp_path), [{"agent": "claude"}, {"agent": "codex"}]+ )++ response = client.put(+ "/api/agentic-ide/surface-context",+ json={+ "workspace_id": session.id,+ "chat_view": True,+ "on_screen": True,+ "terminal": "T2",+ },+ )++ assert response.status_code == 200+ assert response.json()["accepted"] is True+ assert session.contextual_terminal() is session.find("T2")+++async def test_grid_or_hidden_view_clears_the_implicit_terminal(+ client: TestClient, registry: Registry, tmp_path: Path+) -> None:+ session = await registry.start(str(tmp_path), [{"agent": "claude"}])+ payload = {+ "workspace_id": session.id,+ "chat_view": True,+ "on_screen": True,+ "terminal": "T1",+ }+ client.put("/api/agentic-ide/surface-context", json=payload)+ payload["chat_view"] = False++ client.put("/api/agentic-ide/surface-context", json=payload)++ assert session.contextual_terminal() is None+++async def test_stale_workspace_cannot_replace_the_active_surface(+ client: TestClient, registry: Registry, tmp_path: Path+) -> None:+ first_dir, second_dir = tmp_path / "first", tmp_path / "second"+ first_dir.mkdir()+ second_dir.mkdir()+ first = await registry.start(str(first_dir), [{"agent": "claude"}])+ second = await registry.start(str(second_dir), [{"agent": "codex"}])++ response = client.put(+ "/api/agentic-ide/surface-context",+ json={+ "workspace_id": first.id,+ "chat_view": True,+ "on_screen": True,+ "terminal": "T1",+ },+ )++ assert response.json()["accepted"] is False+ assert second.contextual_terminal() is Nonediff --git a/tests/unit/brain/test_agentic_ide_handoff_silence.py b/tests/unit/brain/test_agentic_ide_handoff_silence.pyindex 078c55151c..a3e3665be8 100644--- a/tests/unit/brain/test_agentic_ide_handoff_silence.py+++ b/tests/unit/brain/test_agentic_ide_handoff_silence.py@@ -263,3 +263,30 @@ async def test_an_unaddressed_turn_announces_nothing(assert reply is Noneassert spy.events == []+++async def test_the_visible_chat_terminal_beats_a_stale_conversation_target(+ manager: BrainManager, registry: Registry, tmp_path: Path+) -> None:+ """The live 2026-08-02 T1 -> "this terminal" -> wrong-T1 regression."""+ await _open(registry, tmp_path, 4)+ assert registry.session is not None+ registry.set_surface_context(+ workspace_id=registry.session.id,+ chat_view=True,+ on_screen=True,+ terminal="T4",+ )++ utterance = (+ "Kannst du bitte das Terminal prompten " # i18n-allow: spoken input+ "hier und prüfen, ob der neue Subscription-Pfad " # i18n-allow: spoken input+ "dieselben Funktionen hat?" # i18n-allow: spoken input+ )+ reply = await manager._run_agentic_ide_fast_path(utterance)++ first = registry.session.find("T1")+ visible = registry.session.find("T4")+ assert first is not None and first.prompts_sent == 0+ assert visible is not None and visible.prompts_sent == 1+ assert reply is not None and "T4" in replydiff --git a/tests/unit/plugins/tool/test_app_command.py b/tests/unit/plugins/tool/test_app_command.pyindex ce39d24f16..44957dde3c 100644--- a/tests/unit/plugins/tool/test_app_command.py+++ b/tests/unit/plugins/tool/test_app_command.py@@ -9,6 +9,8 @@ router tool set". Each registry command is therefore its own tool."""from __future__ import annotations+from types import SimpleNamespace+import httpxfrom fastapi import FastAPI, HTTPException@@ -175,6 +177,67 @@ async def test_an_explicit_argument_still_beats_the_default() -> None:assert calls["terminal_prompt"]["compose"] is False+async def test_direct_realtime_tool_uses_the_terminal_visible_in_chat(+ monkeypatch,+) -> None:+ """A stale model argument cannot overrule the exact deictic utterance."""+ from jarvis.agentic_ide import session as session_mod++ t1 = SimpleNamespace(name="T1")+ t4 = SimpleNamespace(name="T4")+ session = SimpleNamespace(+ terminals=[t1, t4],+ contextual_terminal=lambda: t4,+ )+ monkeypatch.setattr(+ session_mod,+ "get_registry",+ lambda: SimpleNamespace(session=session),+ )+ calls: dict = {}+ context = SimpleNamespace(+ user_utterance=(+ "Kannst du bitte das Terminal prompten " # i18n-allow: spoken input+ "hier und den Subscription-Pfad prüfen?" # i18n-allow: spoken input+ )+ )++ result = await _tools(calls)["agentic-ide-prompt"].execute(+ {"name": "T1", "prompt": "Review the subscription path"}, context+ )++ assert result.success is True+ assert calls["terminal_prompt"]["name"] == "T4"+++async def test_direct_realtime_tool_keeps_an_explicit_terminal(+ monkeypatch,+) -> None:+ from jarvis.agentic_ide import session as session_mod++ t1 = SimpleNamespace(name="T1")+ t4 = SimpleNamespace(name="T4")+ session = SimpleNamespace(+ terminals=[t1, t4],+ contextual_terminal=lambda: t4,+ )+ monkeypatch.setattr(+ session_mod,+ "get_registry",+ lambda: SimpleNamespace(session=session),+ )+ calls: dict = {}+ context = SimpleNamespace(+ user_utterance="Prompt T1, not this terminal, to run the tests"+ )++ await _tools(calls)["agentic-ide-prompt"].execute(+ {"name": "T1", "prompt": "Run the tests"}, context+ )++ assert calls["terminal_prompt"]["name"] == "T1"++def test_every_registry_default_survives_into_the_payload() -> None:"""Whatever the registry promises the model is what the endpoint receives.