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(voice): hand coding tasks to agents without asking, and survive mistyped ids
rubenluetke10-beepabfe8d4461ba
diff --git a/jarvis/agentic_ide/orchestration.py b/jarvis/agentic_ide/orchestration.pyindex a2c163762b..f3ba570a73 100644--- a/jarvis/agentic_ide/orchestration.py+++ b/jarvis/agentic_ide/orchestration.py@@ -8,7 +8,11 @@ an approval. This layer never activates a workspace or composes a second prompt.from __future__ import annotationsimport asyncio+import hashlib+import reimport threading+import time+from collections.abc import Callable, Iterablefrom typing import Anyfrom uuid import UUID, uuid4@@ -23,6 +27,75 @@ def _matches(reference: str, *values: str) -> bool:return reference.strip().casefold() in {v.strip().casefold() for v in values if v}+# Words people wrap around a name when they speak it ("the Personal-Jarvis+# workspace", "mein Ordner Jarvis"). They never identify anything.+_FILLER = frozenset(+ {+ "the", "my", "a", "workspace", "workspaces", "project", "projects", "folder",+ "der", "die", "das", "mein", "meinem", "meinen", "projekt", "ordner",+ "arbeitsbereich",+ }+) # fmt: skip+# A resolve is remembered this long so a voice model never has to copy its+# 32-character request_id verbatim (live 2026-10-01: one dropped "0" failed+# four sends in a row).+_RESOLVE_TTL_S = 15 * 60+_NEAR_MISS = 3+_TARGET_KEYS = ("project_id", "workspace_id", "terminal_id")+++def _words(text: str) -> list[str]:+ return [w for w in re.sub(r"[\W_]+", " ", text.casefold()).split() if w not in _FILLER]+++def _score(reference: str, ids: Iterable[str], names: Iterable[str]) -> int:+ """3 = exact id/name, 2 = same words, 1 = one name's words contain the other's."""+ names = [n for n in names if n]+ if _matches(reference, *ids, *names):+ return 3+ wanted = _words(reference)+ if not wanted:+ return 0+ best = 0+ for name in names:+ words = _words(name)+ if not words:+ continue+ if words == wanted:+ return 2+ if set(wanted) <= set(words) or set(words) <= set(wanted):+ best = 1+ return best+++def _best(reference: str, items: list, key: Callable[[Any], tuple]) -> list:+ """The items matching ``reference`` at the strongest tier any item reaches."""+ scored = [(_score(reference, *key(item)), item) for item in items]+ top = max((score for score, _ in scored), default=0)+ return [item for score, item in scored if top and score == top]+++def _distance(a: str, b: str) -> int:+ """Levenshtein distance, enough to recognise a mis-copied id."""+ if abs(len(a) - len(b)) > _NEAR_MISS:+ return _NEAR_MISS + 1+ previous = list(range(len(b) + 1))+ for i, ca in enumerate(a, 1):+ current = [i]+ for j, cb in enumerate(b, 1):+ current.append(min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + (ca != cb)))+ previous = current+ return previous[-1]+++def _is_request_id(value: str) -> bool:+ try:+ UUID(value)+ except ValueError:+ return False+ return True++class WorkspaceOrchestrator:"""One graph for Live discovery, explicit resolution and scoped delivery."""@@ -35,6 +108,9 @@ class WorkspaceOrchestrator:self.registry = registryself.sessions = sessionsself.ledger = ledger+ # request_id -> (target IDs, issued at, prompt sent under it or "")+ self._issued: dict[str, tuple[dict[str, str], float, str]] = {}+ self._issued_lock = threading.Lock()def graph(self) -> dict[str, Any]:from jarvis.workspace.agents import pty_available@@ -72,26 +148,41 @@ class WorkspaceOrchestrator:project_ref = str(args.get("project") or "")workspace_ref = str(args.get("workspace") or "")agent_ref = str(args.get("agent") or "")+ project_found = Falseif project_ref:- projects = [p for p in projects if _matches(project_ref, p["id"], p["name"], p["path"])]- if len(projects) != 1:- return self._choice("project", projects)+ matched = _best(project_ref, projects, lambda p: ((p["id"], p["path"]), (p["name"],)))+ if len(matched) > 1:+ return self._choice("project", matched, graph)+ if not matched and not (workspace_ref or agent_ref):+ return self._choice("project", [], graph, unmatched=project_ref)+ # A misheard project name ("Jarvis-Works") must not hide a+ # workspace or agent reference that does identify the target.+ if matched:+ projects, project_found = matched, Truecandidates = [(p, w) for p in projects for w in p["workspaces"]]if workspace_ref:- matched = [(p, w) for p, w in candidates if _matches(workspace_ref, w["id"], w["name"])]+ matched = _best(+ workspace_ref, candidates, lambda pw: ((pw[1]["id"],), (pw[1]["name"],))+ )# People often call a project "the Personal Jarvis workspace".# Interpret that only when it identifies exactly one project.if not matched:- owners = [p for p in projects if _matches(workspace_ref, p["id"], p["name"])]+ owners = _best(workspace_ref, projects, lambda p: ((p["id"],), (p["name"],)))if len(owners) == 1:matched = [(p, w) for p, w in candidates if p["id"] == owners[0]["id"]]+ if not matched:+ return self._choice("workspace", [], graph, unmatched=workspace_ref)candidates = matched- elif not project_ref:- named_agents = [- (p, w)- for p, w in candidates- if agent_ref and any(_matches(agent_ref, a["id"], a["name"]) for a in w["agents"])- ]+ elif not project_found:+ named_agents = (+ [+ (p, w)+ for p, w in candidates+ if _best(agent_ref, w["agents"], lambda a: ((a["id"],), (a["name"],)))+ ]+ if agent_ref+ else []+ )candidates = named_agents or [(p, w) for p, w in candidates if w["id"] == graph["active_workspace_id"]]@@ -99,6 +190,7 @@ class WorkspaceOrchestrator:return self._choice("workspace",[{"project_id": p["id"], "project": p["name"], **w} for p, w in candidates],+ graph,)project, workspace = candidates[0]if workspace["status"] != "open":@@ -110,10 +202,10 @@ class WorkspaceOrchestrator:}agents = [a for a in workspace["agents"] if a["accepts_tasks"]]if agent_ref:- named = [a for a in agents if _matches(agent_ref, a["id"], a["name"])]+ named = _best(agent_ref, agents, lambda a: ((a["id"],), (a["name"],)))agents = named or [a for a in agents if _matches(agent_ref, a["agent"])]if len(agents) != 1:- return self._choice("agent", agents)+ return self._choice("agent", agents, graph, unmatched=agent_ref)else:# A task need not require manually selecting a tile. Stable grid# order is the tie-breaker among idle sessions; never interrupt one.@@ -134,13 +226,22 @@ class WorkspaceOrchestrator:"workspace_id": workspace["id"],}agent = agents[0]+ request_id = uuid4().hex+ target = {+ "project_id": project["id"],+ "workspace_id": workspace["id"],+ "terminal_id": agent["id"],+ }+ with self._issued_lock:+ now = time.monotonic()+ for stale in [k for k, (_, at, _) in self._issued.items() if now - at > _RESOLVE_TTL_S]:+ del self._issued[stale]+ self._issued[request_id] = (target, now, "")return {"status": "resolved",- "request_id": uuid4().hex,+ "request_id": request_id,"target": {- "project_id": project["id"],- "workspace_id": workspace["id"],- "terminal_id": agent["id"],+ **target,"project": project["name"],"workspace": workspace["name"],"agent": agent["name"],@@ -149,16 +250,95 @@ class WorkspaceOrchestrator:}@staticmethod- def _choice(kind: str, choices: list[dict]) -> dict[str, Any]:+ def _choice(+ kind: str, choices: list[dict], graph: dict[str, Any], *, unmatched: str = ""+ ) -> dict[str, Any]:+ if choices:+ return {+ "status": "needs_clarification",+ "kind": kind,+ "candidates": choices,+ "reason": "Reference is ambiguous.",+ }+ # Never answer "nothing" without the options: the model then tells the+ # user a workspace does not exist while it is open on screen.+ wanted = set(_words(unmatched))+ open_workspaces = sorted(+ (+ {+ "project_id": p["id"],+ "project": p["name"],+ "workspace_id": w["id"],+ "workspace": w["name"],+ "active": w["id"] == graph.get("active_workspace_id"),+ "agents": [a["name"] for a in w["agents"] if a["accepts_tasks"]],+ }+ for p in graph["projects"]+ for w in p["workspaces"]+ if w["status"] == "open"+ ),+ key=lambda c: (+ -len(wanted & set(_words(f"{c['project']} {c['workspace']} {c['agents']}"))),+ not c["active"],+ ),+ )+ lead = f"Nothing open matches '{unmatched}'. " if unmatched else "No matching target. "return {"status": "needs_clarification","kind": kind,- "candidates": choices,- "reason": "Reference is ambiguous."- if choices- else "No matching open target. Connect or restore the workspace first.",+ "candidates": open_workspaces,+ "reason": lead+ + (+ "These are the open workspaces, closest first; resolve again with the one "+ "the user meant."+ if open_workspaces+ else "No workspace is open; connect or restore one first."+ ),}+ def _reconcile(self, args: dict[str, Any], action: str) -> tuple[dict[str, str], str]:+ """Target IDs and request_id, repaired against this app's own resolves.++ A voice model retypes long hex IDs and drops characters. The resolve+ that minted them is the authority: an exact or near-miss request_id,+ else a resolve for (nearly) the same terminal — the one this prompt+ already went out under (a retry), or the newest unused one — supplies+ the target. Only IDs nothing here issued are taken as given. An empty+ request_id comes back when the call needs a fresh key: a resolve+ already spent on a different prompt must not swallow a new task.+ """+ given = {key: str(args.get(key) or "").strip() for key in _TARGET_KEYS}+ request_id = str(args.get("request_id") or "").strip()+ prompt = str(args.get("prompt") or "").strip()+ with self._issued_lock:+ issued = dict(self._issued)+ match = request_id if request_id in issued else ""+ if not match and request_id:+ near = [rid for rid in issued if _distance(request_id, rid) <= _NEAR_MISS]+ match = near[0] if len(near) == 1 else ""+ if not match and given["terminal_id"] and not _is_request_id(request_id):+ same_pane = [+ (at, rid, sent)+ for rid, (target, at, sent) in issued.items()+ if _distance(given["terminal_id"], target["terminal_id"]) <= _NEAR_MISS+ ]+ retry = [(at, rid) for at, rid, sent in same_pane if sent and sent == prompt]+ fresh = [(at, rid) for at, rid, sent in same_pane if not sent or action != "send"]+ if retry or fresh:+ match = max(retry or fresh)[1]+ if not match:+ return given, request_id+ target, _, sent = issued[match]+ if action == "send" and sent and sent != prompt:+ return dict(target), ""+ return dict(target), match++ def _mark_sent(self, request_id: str, prompt: str) -> None:+ with self._issued_lock:+ if request_id in self._issued:+ target, at, _ = self._issued[request_id]+ self._issued[request_id] = (target, at, prompt)+async def run(self, args: dict[str, Any], *, trace_id: str = "") -> dict[str, Any]:action = args.get("action")if action in {"inspect", "resolve"}:@@ -166,29 +346,22 @@ class WorkspaceOrchestrator:return graph if action == "inspect" else self.resolve(args, graph)if action not in {"send", "context"}:raise ValueError("Unknown workspace orchestration action.")- project_id, workspace_id, terminal_id = (- str(args.get(key) or "") for key in ("project_id", "workspace_id", "terminal_id")- )+ target, request_id = self._reconcile(args, action)+ project_id, workspace_id, terminal_id = (target[key] for key in _TARGET_KEYS)if not project_id or not workspace_id or not terminal_id.startswith("pane:"):raise ValueError("Resolve a target first; project_id, workspace_id and terminal_id are required.")- target = {- "project_id": project_id,- "workspace_id": workspace_id,- "terminal_id": terminal_id,- }- request_id = str(args.get("request_id") or "").strip()if action == "send":prompt = str(args.get("prompt") or "").strip()- if not prompt or not request_id or len(request_id) > 160:- raise ValueError(- "Sending requires a prompt and a stable request_id (at most 160 characters)."- )- try:- UUID(request_id)- except ValueError as exc:- raise ValueError("Use the unique request_id returned by resolve.") from exc+ if not prompt:+ raise ValueError("Sending requires a prompt.")+ if not _is_request_id(request_id):+ # Nothing usable to key on: derive a key so a retry of this+ # same task within ten minutes still cannot deliver twice.+ seed = f"{terminal_id}\n{prompt}\n{int(time.time() // 600)}"+ request_id = hashlib.sha256(seed.encode("utf-8")).hexdigest()[:32]+ self._mark_sent(request_id, prompt)previous = await asyncio.to_thread(self.ledger.claim,"workspace-orchestration",diff --git a/jarvis/brain/tool_gateway.py b/jarvis/brain/tool_gateway.pyindex 7319867ae7..f28c112f1d 100644--- a/jarvis/brain/tool_gateway.py+++ b/jarvis/brain/tool_gateway.py@@ -255,12 +255,12 @@ class BrainSupervisorToolGateway:config_snapshot=config_snapshot,)- async def cancel_pending(self, trace_id: UUID) -> bool:+ async def cancel_pending(self, trace_id: UUID, *, reason: str = "voice_vetoed") -> bool:executor = getattr(self._manager, "_tool_executor", None)cancel = getattr(executor, "cancel_pending", None)if not callable(cancel):return False- return bool(await cancel(trace_id))+ return bool(await cancel(trace_id, reason=reason))async def publish_guard_denied(self,diff --git a/jarvis/brain/workspace_tool.py b/jarvis/brain/workspace_tool.pyindex 3995244bc0..fb93829738 100644--- a/jarvis/brain/workspace_tool.py+++ b/jarvis/brain/workspace_tool.py@@ -7,14 +7,19 @@ from jarvis.core.protocols import ExecutionContext, ToolResult, WorkspaceOrchestclass WorkspaceOrchestrationTool:name = "workspace-orchestrate"- risk_tier = "ask"+ # Handing a task to the user's own coding agent is Jarvis's job, not an+ # outward act: it runs without a spoken "shall I send it?" and is logged+ # (live 2026-10-01: the user asked three times and was still asked back).+ risk_tier = "monitor"is_action_tool = Truedescription = ("Route coding tasks to Projects > Workspaces > coding agents. Inspect the current graph; ""resolve explicit project/workspace/agent references (names or IDs) before sending. ""With no named workspace resolve uses the visible workspace, and selects an idle agent "- "without requiring a focused terminal. Ask on needs_clarification; never guess. "- "Send with all three resolved IDs and request_id returned by resolve; reuse it for "+ "without requiring a focused terminal. On needs_clarification pick from the returned "+ "candidates when one clearly fits, else ask; never invent a target. "+ "Send right away with the resolved IDs and the request_id from resolve (the app "+ "remembers its resolves, so a slightly mistyped id still works); reuse it for ""retries. Explicit background targets never switch the visible workspace. ""Accepted means delivered, not completed; uncertain delivery must not be retried. ""After a proven pre-write refusal, resolve again for a fresh request_id "@@ -36,13 +41,13 @@ class WorkspaceOrchestrationTool:"workspace_id","terminal_id","prompt",- "request_id",)},+ # No pattern: a schema rejection would discard the whole call over+ # one mistyped character. The orchestrator repairs the id instead."request_id": {"type": "string",- "pattern": "^[a-fA-F0-9]{32}$",- "description": "Copy request_id from resolve; keep it unchanged on retries.",+ "description": "request_id from resolve; keep it unchanged on retries.",},"limit": {"type": "integer", "minimum": 1, "maximum": 100},},@@ -53,19 +58,7 @@ class WorkspaceOrchestrationTool:self.gateway = gatewaydef risk_tier_for_args(self, args: dict) -> str:- return "safe" if args.get("action") in {"inspect", "resolve", "context"} else "ask"-- def intent_confirms_args(self, args: dict, utterance: str) -> bool:- """True when the user's own words already ordered this hand-off.-- Consulted by ``ToolExecutor`` before it arms a confirmation: a send the- user asked for ("let an agent in the workspace fix it") runs at once- instead of a second "shall I start it?". A send the brain chose while- the user talked about something else still confirms.- """- from jarvis.safety.explicit_intent import utterance_requests_agent_work-- return args.get("action") == "send" and utterance_requests_agent_work(utterance)+ return "safe" if args.get("action") in {"inspect", "resolve", "context"} else "monitor"def describe_args(self, args: dict) -> dict:return {diff --git a/jarvis/core/protocols.py b/jarvis/core/protocols.pyindex cff49036ea..f51f4e6c0f 100644--- a/jarvis/core/protocols.py+++ b/jarvis/core/protocols.py@@ -489,7 +489,7 @@ class SupervisorToolGateway(Protocol):request: SupervisorToolRequest,) -> ToolResult: ...- async def cancel_pending(self, trace_id: UUID) -> bool: ...+ async def cancel_pending(self, trace_id: UUID, *, reason: str = "voice_vetoed") -> bool: ...async def publish_guard_denied(self,diff --git a/jarvis/live/tools.py b/jarvis/live/tools.pyindex 795934acc8..e271d7cf4d 100644--- a/jarvis/live/tools.py+++ b/jarvis/live/tools.py@@ -22,23 +22,25 @@ log = logging.getLogger(__name__)_CATALOG_BYTE_BUDGET = 24_000_DISCOVERY_PAGE_SIZE = 8_BUILTIN_TOOLS = frozenset({"discover_tools", "call_tool", "confirm_action", "end_call"})-# Whole-utterance approvals, keyed to the locale whose veto patterns must vet-# them. The session language cannot be used: "auto" resolves to English before-# anyone speaks, which rejected a German "Ja" and stranded the approval.-_AFFIRMATIONS = {- "yes": "en",- "yes please": "en",- "confirm": "en",- "confirmed": "en",- "do it": "en",- "ja": "de", # i18n-allow: spoken confirmation vocabulary- "ja bitte": "de", # i18n-allow: spoken confirmation vocabulary- "mach das": "de", # i18n-allow: spoken confirmation vocabulary- "bestätigen": "de", # i18n-allow: spoken confirmation vocabulary- "sí": "es",- "si": "es",- "confirmo": "es",-}+# An approval is a short answer made only of go-ahead words: "Ja, send ihn"+# approves (refused live 2026-10-01 by an exact-phrase list), while "yes,+# change the target" or "ja, aber warte" carry something else and do not.+_GO_AHEAD_WORDS = frozenset(+ {+ # English+ "yes", "yeah", "yep", "sure", "ok", "okay", "please", "confirm", "confirmed",+ "do", "it", "go", "ahead", "send", "run", "start", "that", "now",+ # German # i18n-allow: spoken confirmation vocabulary+ "ja", "jo", "jep", "klar", "gerne", "genau", "bitte", "bestätigen", # i18n-allow+ "bestätigt", "mach", "machs", "das", "es", "ihn", "sie", # i18n-allow+ "schick", "schicke", "schicks", # i18n-allow+ "sende", "senden", "los", "ab", "raus", "jetzt", "starte", "starten", # i18n-allow+ # Spanish+ "sí", "si", "claro", "vale", "dale", "confirmo", "hazlo", "envía", "envialo",+ "envíalo", "adelante",+ }+) # fmt: skip+_APPROVAL_LOCALES = ("de", "en", "es")_APPROVAL_NEXT_STEP = ("Ask the user to approve this action. After an explicit yes, call confirm_action ""directly (not through call_tool) with this approval_id. A yes is never a hang-up."@@ -120,7 +122,7 @@ class LiveTools:self.cancel_token.cancel("user_cancelled")self.accepting = Falseself.revision += 1- await self._cancel_confirmations()+ await self._cancel_confirmations("user_cancelled")def declarations(self, *, defer_catalog: bool = False) -> list[dict]:self._defer_catalog = defer_catalog@@ -296,18 +298,13 @@ class LiveTools:"next_offset": next_offset if next_offset < len(matches) else None,}if name == "confirm_action":- from jarvis.voice.echo_confirmation import classify_response-approval_id = str(args.get("approval_id", ""))+ if approval_id not in self._pending and len(self._pending) == 1:+ # One open question, so the yes can only mean it; a voice+ # model that mistypes the 36-character id must not void it.+ approval_id = next(iter(self._pending))pending = self._pending.get(approval_id)- locale = self._affirmation_locale()- if (- pending is None- or self.revision <= pending[3]- or locale is None- or len(self.user_text.split()) > 5- or classify_response(self.user_text, language=locale) != "confirm"- ):+ if pending is None or self.revision <= pending[3] or not self._user_approved():return {"success": False, "error": "This action has not been explicitly approved."}trace, _, _, _ = self._pending.pop(approval_id)from jarvis.core.model_selection import ModelSelection, use_operation_model@@ -332,7 +329,18 @@ class LiveTools:}import jsonschema # type: ignore[import-untyped]- jsonschema.validate(args, descriptor.input_schema)+ try:+ jsonschema.validate(args, descriptor.input_schema)+ except jsonschema.ValidationError as exc:+ # Nothing ran yet, so the model may fix the argument and retry. A+ # bare "execution failed" left it guessing four times in a row.+ field = "/".join(str(part) for part in exc.absolute_path) or "arguments"+ return {+ "success": False,+ "executed": False,+ "retryable": True,+ "error": f"Invalid {field}: {exc.message[:300]}. Correct it and call again.",+ }trace = uuid4()from jarvis.core.model_selection import ModelSelection, use_operation_model@@ -354,10 +362,10 @@ class LiveTools:result = await self.gateway.execute(canonical, args, self._request(trace))if result.error == VOICE_CONFIRM_SENTINEL:if operation_token.is_cancelled() or revision != self.revision:- await self.gateway.cancel_pending(trace)+ await self.gateway.cancel_pending(trace, reason="superseded")return {"success": False, "status": "superseded"}if not self.accepting:- await self.gateway.cancel_pending(trace)+ await self.gateway.cancel_pending(trace, reason="voice_session_closed")return {"success": False, "status": "voice_closed_before_confirmation"}approval_id = str(trace)self._pending[approval_id] = (trace, canonical, dict(args), self.revision)@@ -372,9 +380,23 @@ class LiveTools:}return self._result(result)- def _affirmation_locale(self) -> str | None:- """Locale of a whole-utterance approval in the latest user text, else None."""- return _AFFIRMATIONS.get(re.sub(r"[^\w\s]", "", self.user_text.casefold()).strip())+ def _user_approved(self) -> bool:+ """True when the latest user text is a short, unvetoed yes in any locale.++ The session language cannot pick the locale ("auto" resolves to English+ before anyone speaks), so every supported locale vets the answer: one+ must read it as a confirmation and none as a veto. Every word must be a+ go-ahead word, so an answer that adds a condition or a new instruction+ is not an approval of the old action.+ """+ from jarvis.voice.echo_confirmation import classify_response++ text = self.user_text+ words = re.sub(r"[^\w\s]", " ", text.casefold()).split()+ if not words or any(word not in _GO_AHEAD_WORDS for word in words):+ return False+ verdicts = {classify_response(text, language=locale) for locale in _APPROVAL_LOCALES}+ return "confirm" in verdicts and "veto" not in verdictsdef _request(self, trace: UUID) -> SupervisorToolRequest:return SupervisorToolRequest(@@ -411,10 +433,10 @@ class LiveTools:async def close(self) -> None:self.accepting = False- await self._cancel_confirmations()+ await self._cancel_confirmations("voice_session_closed")- async def _cancel_confirmations(self) -> None:+ async def _cancel_confirmations(self, reason: str) -> None:pending = tuple(self._pending.values())self._pending.clear()for trace, _, _, _ in pending:- await self.gateway.cancel_pending(trace)+ await self.gateway.cancel_pending(trace, reason=reason)diff --git a/jarvis/plugins/tool/app_action.py b/jarvis/plugins/tool/app_action.pyindex 78bce4b65b..fa2633258f 100644--- a/jarvis/plugins/tool/app_action.py+++ b/jarvis/plugins/tool/app_action.py@@ -15,6 +15,7 @@ from __future__ import annotationsimport jsonimport logging+import refrom typing import Anyfrom urllib.parse import quote@@ -32,6 +33,24 @@ def _catalog() -> dict[str, Any]:return live_catalog()+def _area_words(text: str) -> set[str]:+ return {w for w in re.split(r"[\W_]+", text.casefold()) if w and w not in {"and", "the"}}+++def _in_area(entries: list[Any], area: str) -> list[Any]:+ """Entries whose area slug shares a word with the ``area`` hint.++ The area is a hint, never a gate: models pass the human label ("IDE panes+ and workspaces") instead of the slug ("agentic-ide"), and an exact match+ then hid every action (live 2026-10-01). No overlap means no filter.+ """+ wanted = _area_words(area)+ if not wanted:+ return entries+ matched = [e for e in entries if wanted & _area_words(e.area)]+ return matched or entries++class FindAppActionTool:"""Search every action of the Jarvis app by keywords."""@@ -64,8 +83,7 @@ class FindAppActionTool:return ToolResult(success=False, output=None, error="The app's actions are not available here.")- area = str(args.get("area") or "").strip().lower()- entries = [e for e in catalog.values() if not area or e.area.lower() == area]+ entries = _in_area(list(catalog.values()), str(args.get("area") or ""))policy = load_policy()descriptors = [SupervisorToolDescriptor(diff --git a/jarvis/safety/explicit_intent.py b/jarvis/safety/explicit_intent.pyindex 4f5f60eed4..88f3d6c82b 100644--- a/jarvis/safety/explicit_intent.py+++ b/jarvis/safety/explicit_intent.py@@ -52,59 +52,3 @@ def utterance_confirms_destruction(utterance: str) -> bool:if not utterance or not utterance.strip():return Falsereturn bool(_PATTERN.search(utterance))---# Handing a task to a coding agent (live voice session 2026-10-01 18:11): the-# user said "beauftrag einen Agenten im Workspace, das smoother zu machen",-# Jarvis asked "soll ich ihn starten?", and on the next request ("da soll sich-# ein anderer Agent drum kümmern, im selben Workspace") asked again — the-# maintainer's verdict: "das hättest du einfach loslaufen lassen können". The-# words below only appear when the speaker addresses agent work themselves:-# the vehicle ("Agent", "worker"), a workspace target ("Terminal", "Session",-# "T2"), a coding CLI by name, or a hand-off verb. A send the brain decides on-# while the user talks about something else still confirms.-_AGENT_WORK_STEMS: tuple[str, ...] = (- # Shared by de/en/es: agent/Agenten/agente, delegier/delegate/delega.- "agent", "subagent", "deleg", "terminal", "workspace", "coding",- # German- "beauftrag", "sitzung", "arbeitsbereich",- # English- "worker", "spawn", "session", "pane", "claude code", "codex",- # Spanish- "sesión", "sesion", "espacio de trabajo",-)--_AGENT_WORK_PATTERN = re.compile(- r"\b(?:"- + "|".join(re.escape(stem) + r"\w*" for stem in _AGENT_WORK_STEMS)- # Agentic-IDE call signs ("T2", "t 4").- + r"|t\s?\d{1,2}\b"- + r")",- re.IGNORECASE,-)--# "nicht an den Agenten", "don't send it to the agent", "kein Terminal": a-# negation shortly before the target, inside the same clause, is a refusal,-# not an order. A comma or full stop ends its reach ("nicht so, lass das-# einen Agenten machen" still asks for an agent).-_NEGATION_BEFORE = re.compile(- r"\b(?:nicht|kein\w*|nie|no|not|don't|dont|never|nada|ningún|ninguna)"- r"(?:[^\w,.;!?]+\w+){0,4}[^\w,.;!?]*$",- re.IGNORECASE,-)---def utterance_requests_agent_work(utterance: str) -> bool:- """True when the utterance itself asks to hand work to a coding agent.-- Used by the workspace send hook: the user who just said "let an agent do- it" is not asked "shall I start it?" again. A target preceded by a- negation ("schick das nicht an den Agenten") does not count. Empty- utterances (API calls, missions) never confirm.- """- if not utterance or not utterance.strip():- return False- for match in _AGENT_WORK_PATTERN.finditer(utterance):- if not _NEGATION_BEFORE.search(utterance[: match.start()]):- return True- return Falsediff --git a/jarvis/safety/tool_executor.py b/jarvis/safety/tool_executor.pyindex 8b076752a9..30610aaf31 100644--- a/jarvis/safety/tool_executor.py+++ b/jarvis/safety/tool_executor.py@@ -595,9 +595,10 @@ class ToolExecutor:))return result- async def cancel_pending(self, trace_id: UUID) -> bool:+ async def cancel_pending(self, trace_id: UUID, *, reason: str = "voice_vetoed") -> bool:"""Drop the action stashed for ``trace_id`` ("nein"). Returns whether one- existed. Publishes ``ActionDenied`` for the audit trail."""+ existed. Publishes ``ActionDenied`` for the audit trail; ``reason`` says+ why, so a call that merely ended is not recorded as the user's veto."""pending = self._pending_voice.pop(trace_id, None)if pending is None:return False@@ -605,6 +606,6 @@ class ToolExecutor:await self._bus.publish(ActionDenied(trace_id=trace_id,tool_name=tool.name,- reason="voice_vetoed",+ reason=reason,))return Truediff --git a/tests/contract/test_gpt_live.py b/tests/contract/test_gpt_live.pyindex 81e94197d9..5d8773cb02 100644--- a/tests/contract/test_gpt_live.py+++ b/tests/contract/test_gpt_live.py@@ -34,7 +34,7 @@ class Gateway:self.calls.append((name, args, request))return ToolResult(True, {"verified": True})- async def cancel_pending(self, trace):+ async def cancel_pending(self, trace, *, reason="voice_vetoed"):return True@@ -255,6 +255,80 @@ async def test_veto_still_wins_over_a_listed_affirmation(ledger):assert not result["success"]+ "answer",+ [+ ". Ja, send ihn", # i18n-allow: live 2026-10-01 transcript+ "Ja. Ja, schick ihn los", # i18n-allow: spoken confirmation vocabulary+ "okay, do it",+ ],+)+async def test_a_short_spoken_go_ahead_approves(ledger, answer):+ gateway = _ApprovalGateway()+ runtime = LiveTools(gateway, ledger, "s", language="en", backend_model="")+ approval = await _pending_approval(runtime)+ runtime.user_text = answer+ result = await runtime.execute("ok", "confirm_action", {"approval_id": approval}, 1)+ assert result["success"]+ assert gateway.calls[-1][0] == "confirmed"+++ "answer",+ [+ "nein, nicht senden", # i18n-allow: spoken veto vocabulary+ "Ja, aber warte noch", # i18n-allow: spoken hedge vocabulary+ "yes but change the target",+ "Wieso nicht gepromptet hast", # i18n-allow: live 2026-10-01 transcript+ ],+)+async def test_a_hedge_veto_or_new_instruction_does_not_approve(ledger, answer):+ gateway = _ApprovalGateway()+ runtime = LiveTools(gateway, ledger, "s", language="en", backend_model="")+ approval = await _pending_approval(runtime)+ runtime.user_text = answer+ result = await runtime.execute("no", "confirm_action", {"approval_id": approval}, 1)+ assert not result["success"]+ assert gateway.calls[-1][0] != "confirmed"+++async def test_a_mistyped_approval_id_still_confirms_the_only_pending_action(ledger):+ gateway = _ApprovalGateway()+ runtime = LiveTools(gateway, ledger, "s", language="en", backend_model="")+ approval = await _pending_approval(runtime)+ runtime.user_text = "Ja"+ result = await runtime.execute("ok", "confirm_action", {"approval_id": approval[:-1]}, 1)+ assert result["success"]+++async def test_closing_the_call_is_not_recorded_as_a_veto(ledger):+ reasons = []++ class _Recording(_ApprovalGateway):+ async def cancel_pending(self, trace, *, reason="voice_vetoed"):+ reasons.append(reason)+ return True++ runtime = LiveTools(_Recording(), ledger, "s", language="en", backend_model="")+ await _pending_approval(runtime)+ await runtime.close()+ assert reasons == ["voice_session_closed"]+++async def test_a_schema_violation_tells_the_model_what_to_fix(ledger):+ runtime = LiveTools(Gateway(), ledger, "s", language="en", backend_model="")+ request = {"name": "write-file", "arguments_json": '{"text": 5}'}+ result = await runtime.execute("bad", "call_tool", request, 0)+ assert result["success"] is False+ assert result["executed"] is False and result["retryable"] is True+ assert "text" in result["error"]++@pytest.mark.asyncioasync def test_yes_to_a_pending_approval_does_not_hang_up(ledger):gateway = _ApprovalGateway()@@ -634,7 +708,7 @@ async def test_cancelled_work_stays_cancelled_when_a_new_request_arrives(ledger)assert not request.cancel_token.is_cancelled()return ToolResult(True, "New request completed")- async def cancel_pending(self, trace):+ async def cancel_pending(self, trace, *, reason="voice_vetoed"):self.cancelled.append(trace)return Truediff --git a/tests/contract/test_workspace_orchestration.py b/tests/contract/test_workspace_orchestration.pyindex b72ed25a00..517e55ac84 100644--- a/tests/contract/test_workspace_orchestration.py+++ b/tests/contract/test_workspace_orchestration.py@@ -243,9 +243,11 @@ async def test_live_roundtrip_uses_gateway_executor_and_durable_addressed_receipledger.close()-def test_send_requires_application_permission_and_reads_remain_safe(rig):+def test_send_runs_without_a_spoken_question_and_reads_remain_safe(rig):+ # Live 2026-10-01: a hand-off the user ordered three times was still met+ # with "shall I send it?". Sending to the user's own agent is logged only.tool = WorkspaceOrchestrationTool(rig[0])- assert tool.risk_tier_for_args({"action": "send"}) == "ask"+ assert tool.risk_tier_for_args({"action": "send"}) == "monitor"for action in ("inspect", "resolve", "context"):assert tool.risk_tier_for_args({"action": action}) == "safe"@@ -292,3 +294,65 @@ def test_confirmation_identifies_target_and_task(rig):"agent": "pane:3","task": "Fix Linux installer",}+++async def test_a_mistyped_request_id_still_delivers_exactly_once(rig):+ # Live 2026-10-01: the voice model dropped one "0" from the 32-character id.+ resolved = await rig[0].run({"action": "resolve"})+ rid = resolved["request_id"]+ garbled = rid[:20] + rid[21:]+ ids = {k: resolved["target"][k] for k in ("project_id", "workspace_id", "terminal_id")}+ first = await rig[0].run({"action": "send", **ids, "request_id": garbled, "prompt": "Task"})+ assert first["status"] == "accepted"+ retry = rid[:5] + rid[6:]+ again = await rig[0].run({"action": "send", **ids, "request_id": retry, "prompt": "Task"})+ assert again == first+ assert len(rig[2].calls) == 1+++async def test_send_without_request_id_uses_the_latest_resolve(rig):+ resolved = await rig[0].run({"action": "resolve"})+ ids = {k: resolved["target"][k] for k in ("project_id", "workspace_id", "terminal_id")}+ result = await rig[0].run({"action": "send", **ids, "prompt": "Task"})+ assert result["status"] == "accepted"+ assert (await rig[0].run({"action": "send", **ids, "prompt": "Task"}))["status"] == "accepted"+ assert len(rig[2].calls) == 1+ other = await rig[0].run({"action": "send", **ids, "prompt": "Another task"})+ assert other["status"] == "accepted"+ assert len(rig[2].calls) == 2+++async def test_garbled_target_ids_are_repaired_from_the_resolve(rig):+ resolved = await rig[0].run({"action": "resolve"})+ target = resolved["target"]+ result = await rig[0].run(+ {+ "action": "send",+ "project_id": target["project_id"][:-1],+ "workspace_id": target["workspace_id"][1:],+ "terminal_id": target["terminal_id"],+ "request_id": resolved["request_id"],+ "prompt": "Task",+ }+ )+ assert result["status"] == "accepted"+ assert rig[2].calls[0]["workspace_id"] == target["workspace_id"]+++async def test_context_ignores_a_broken_request_id(rig):+ resolved = await target(rig)+ result = await rig[0].run({"action": "context", **resolved, "request_id": "not-an-id"})+ assert result["status"] == "observed" or result.get("delivery") == "accepted"+++async def test_spoken_workspace_name_with_filler_words_resolves(rig):+ resolved = await target(rig, project="Jarvis-Works", workspace="Personal-Jarvis-Workspace")+ assert resolved["workspace"] == "Personal Jarvis"+++async def test_an_unmatched_reference_lists_every_open_workspace(rig):+ result = await rig[0].run({"action": "resolve", "workspace": "Something else entirely"})+ assert result["status"] == "needs_clarification"+ names = {c["workspace"] for c in result["candidates"]}+ assert names == {"Personal Jarvis", "Other project"}+ assert "Something else entirely" in result["reason"]diff --git a/tests/unit/app_actions/test_app_actions.py b/tests/unit/app_actions/test_app_actions.pyindex ccb510605c..e36febf619 100644--- a/tests/unit/app_actions/test_app_actions.py+++ b/tests/unit/app_actions/test_app_actions.py@@ -166,3 +166,12 @@ async def test_settings_routes_list_set_and_show_history(app: FastAPI) -> None:history.record(action_id, "ran", "x")rows = (await client.get("/api/app-actions/history")).json()["history"]assert rows[0]["action"] == action_id++[email protected]("area", ["IDE", "IDE panes and workspaces", "agentic-ide", "nonsense"])+async def test_area_is_a_hint_not_an_exact_slug(app: FastAPI, area: str) -> None:+ # Live 2026-10-01: the model passed the human label from the description+ # and an exact slug match hid every action.+ found = await FindAppActionTool().execute({"query": "rename pane", "area": area}, None)+ assert found.success+ assert found.output["actions"][0]["title"] == "Rename Pane"diff --git a/tests/unit/brain/test_tool_gateway.py b/tests/unit/brain/test_tool_gateway.pyindex 6718fd9d14..8457275223 100644--- a/tests/unit/brain/test_tool_gateway.py+++ b/tests/unit/brain/test_tool_gateway.py@@ -47,7 +47,7 @@ class _Executor:self.confirmed.append((trace_id, kwargs))return ToolResult(success=True, output="confirmed")- async def cancel_pending(self, trace_id: Any) -> bool:+ async def cancel_pending(self, trace_id: Any, *, reason: str = "voice_vetoed") -> bool:self.cancelled.append(trace_id)return Truediff --git a/tests/unit/safety/test_workspace_send_intent.py b/tests/unit/safety/test_workspace_send_intent.pydeleted file mode 100644index 7c497a6ea6..0000000000--- a/tests/unit/safety/test_workspace_send_intent.py+++ /dev/null@@ -1,133 +0,0 @@-"""A coding-agent hand-off the user asked for runs without a second question.--Live voice session 2026-10-01 18:11: the user asked Jarvis to hand the voice-bar-flicker to an agent in the workspace, Jarvis asked "soll ich ihn starten?",-then asked again for the follow-up agent the user requested by name — and the-user's "Ja, aber das hättest du einfach loslaufen lassen können" was read as a-veto, so the second agent never started. The workspace send now confirms only-when the user's own turn did not ask for agent work.-"""-from __future__ import annotations--from typing import Any-from uuid import UUID--import pytest--from jarvis.brain.workspace_tool import WorkspaceOrchestrationTool-from jarvis.core.bus import EventBus-from jarvis.core.config import SafetyConfig-from jarvis.safety.approval import ApprovalWorkflow-from jarvis.safety.explicit_intent import utterance_requests_agent_work-from jarvis.safety.risk_tier import RiskTierEvaluator-from jarvis.safety.tool_executor import VOICE_CONFIRM_SENTINEL, ToolExecutor--_SEND = {- "action": "send",- "project_id": "p",- "workspace_id": "w",- "terminal_id": "pane:1",- "request_id": "0" * 32,- "prompt": "Smooth out the voice bar indicators.",-}---class _Gateway:- def __init__(self) -> None:- self.calls: list[dict[str, Any]] = []-- async def run(self, args: dict[str, Any], *, trace_id: str) -> dict[str, Any]:- self.calls.append(dict(args))- return {"status": "live", "success": True}---class _Approval(ApprovalWorkflow):- async def wait(self, trace_id: UUID, timeout_s: float) -> tuple[bool, str]: # type: ignore[override]- raise AssertionError("a conversational turn never blocks on the UI approval")---def _executor() -> ToolExecutor:- bus = EventBus()- return ToolExecutor(- bus=bus,- evaluator=RiskTierEvaluator(SafetyConfig()),- approval=_Approval(bus),- )--- "utterance",- [- # The two requests from the live session, verbatim.- "Hmm, kannst du bitte mal nen Appshot machen und analysieren, da unten bei "- "diesen Indikatoren mit Jarvis spricht, ähm, geh einfach in Jarvis Workspace "- "rein ähm meinem Personal Jarvis Ordner. Und zwar siehst du das, dieses "- "Flackern. Ich möchte, dass du nen Agenten da beauftragst, dass es smoother "- "gemacht wird",- ". Und der soll dann bitte darauf schauen, dass ähm... Du, wenn man ähm wenn "- "man mit dir spricht, dass man dich zum Beispiel nicht wie beim vorigen "- "Beispiel, dass du dann erstmal fragst, ob das freigegeben werden muss. Das "- "kannst du automatisch machen. Da sollte ich nen anderer Agent drum kümmern, "- "im selben Workspace",- "Öffne ein neues Terminal mit einer Claude Code Session",- "Sag T2, er soll die Tests reparieren",- "Spawn a Codex agent that profiles the voice path",- "have the coding session fix the flicker",- "pídele al agente que revise el código",- "Nicht so, lass das einen Agenten machen",- ],-)-def test_agent_work_requests_are_recognized(utterance: str) -> None:- assert utterance_requests_agent_work(utterance) is True--- "utterance",- [- "",- " ",- "Erzähl mir einen Witz",- "Was steht heute in meinem Kalender?",- "Schick das nicht an den Agenten",- "Kein Terminal bitte, mach es selbst",- "don't send it to the agent",- "what's the weather in Berlin",- ],-)-def test_other_turns_are_not_agent_work(utterance: str) -> None:- assert utterance_requests_agent_work(utterance) is False---def test_hook_only_waives_the_send_action() -> None:- tool = WorkspaceOrchestrationTool(_Gateway())- assert tool.intent_confirms_args(_SEND, "lass das einen Agenten machen") is True- assert tool.intent_confirms_args(- {**_SEND, "action": "inspect"}, "lass das einen Agenten machen"- ) is False- assert tool.intent_confirms_args(_SEND, "erzähl mir einen Witz") is False---async def test_requested_hand_off_runs_without_confirmation() -> None:- gateway = _Gateway()- result = await _executor().execute(- WorkspaceOrchestrationTool(gateway),- dict(_SEND),- user_utterance="Beauftrag einen Agenten im Workspace, das zu glätten",- config_snapshot={"voice_confirm": True},- )- assert result.success is True- assert len(gateway.calls) == 1---async def test_unrequested_hand_off_still_confirms() -> None:- gateway = _Gateway()- result = await _executor().execute(- WorkspaceOrchestrationTool(gateway),- dict(_SEND),- user_utterance="Wie spät ist es?",- config_snapshot={"voice_confirm": True},- )- assert result.error == VOICE_CONFIRM_SENTINEL- assert gateway.calls == []