Skip to content

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.

feat(agentic-ide): open more terminals by voice

Ruben Lütke2eeeaa80c58b
diff --git a/docs/commands-reference.md b/docs/commands-reference.md
index 2d58a12037..9fdc91ec3f 100644
--- a/docs/commands-reference.md
+++ b/docs/commands-reference.md
@@ -16,7 +16,7 @@ Commands marked **requires confirmation** never run on a bare voice request —
Switch the ACTIVE main brain (LLM) provider, e.g. from openai to claude-api. Reversible; validated against the provider catalog and stored credentials.
- **Endpoint:** `POST /api/brain/switch`
-- **Arguments:** `provider` (one of: claude-api, gemini, grok, nvidia, openai, openrouter; required); `persist` (boolean; optional)
+- **Arguments:** `provider` (one of: claude-api, gemini, grok, local-openai, nvidia, ollama, openai, openrouter; required); `persist` (boolean; optional)
- **Requires confirmation:** no
- **Desktop UI section:** `apikeys`
- **Voice example (EN):** "switch the brain provider to claude"
@@ -56,7 +56,7 @@ Switch which realtime voice engine (speech-to-speech) is active, e.g. openai-rea
Switch the dedicated Computer-Use planner provider (screen control), decoupled from the main brain.
- **Endpoint:** `POST /api/computer-use/switch`
-- **Arguments:** `provider` (one of: antigravity, claude-api, codex, gemini, grok, nvidia, openai, openrouter; required); `persist` (boolean; optional)
+- **Arguments:** `provider` (one of: antigravity, claude-api, codex, gemini, grok, local-openai, nvidia, ollama, openai, openrouter; required); `persist` (boolean; optional)
- **Requires confirmation:** no
- **Desktop UI section:** `apikeys`
- **Voice example (EN):** "switch the computer use provider to gemini"
@@ -66,7 +66,7 @@ Switch the dedicated Computer-Use planner provider (screen control), decoupled f
Switch the provider used for new missions (e.g. codex to openai). The next mission uses the new provider.
- **Endpoint:** `POST /api/jarvis-agent/switch`
-- **Arguments:** `provider` (one of: antigravity, claude-api, codex, gemini, grok, nvidia, openai, openrouter; required); `persist` (boolean; optional)
+- **Arguments:** `provider` (one of: antigravity, claude-api, codex, gemini, grok, local-openai, nvidia, ollama, openai, openrouter; required); `persist` (boolean; optional)
- **Requires confirmation:** no
- **Desktop UI section:** `agents`
- **Voice example (EN):** "switch the agent provider to openai"
@@ -86,7 +86,7 @@ List all configured providers and which ones are active.
Test connectivity and authentication for one provider.
- **Endpoint:** `POST /api/providers/{provider_id}/test`
-- **Arguments:** `provider_id` (one of: antigravity, cartesia, claude-api, codex, elevenlabs, gemini, gemini-flash-tts, gemini-live, grok, grok-voice, groq-api, inworld, nvidia, openai, openai-api, openai-realtime, openrouter, openrouter-stt, openrouter-tts; required)
+- **Arguments:** `provider_id` (one of: antigravity, cartesia, claude-api, codex, elevenlabs, gemini, gemini-flash-tts, gemini-live, grok, grok-voice, groq-api, inworld, local-openai, nvidia, ollama, openai, openai-api, openai-realtime, openrouter, openrouter-stt, openrouter-tts; required)
- **Requires confirmation:** no
- **Desktop UI section:** `apikeys`
- **Voice example (EN):** "test the openai provider"
@@ -241,3 +241,53 @@ Cancel a running or scheduled task by id.
- **Desktop UI section:** `tasks`
- **Voice example (EN):** "cancel the task"
+## `agentic-ide-status` — Agentic IDE status
+
+Report the open Agentic-IDE workspace: which folder, which coding agents run in which named terminals, and whether the focused coding mode is on.
+
+- **Endpoint:** `GET /api/agentic-ide/state`
+- **Arguments:** none
+- **Requires confirmation:** no
+- **Desktop UI section:** `agentic-ide`
+- **Voice example (EN):** "what is running in the agentic ide"
+
+## `agentic-ide-terminal-report` — Report on one Agentic-IDE terminal
+
+Read what the coding agent in a named terminal is doing — its status and its recent terminal output. Use this whenever the user asks about a terminal by name (e.g. 'what is Mika doing?').
+
+- **Endpoint:** `GET /api/agentic-ide/terminals/{name}/report`
+- **Arguments:** `name` (string; required); `lines` (integer; optional)
+- **Requires confirmation:** no
+- **Desktop UI section:** `agentic-ide`
+- **Voice example (EN):** "what is mika doing"
+
+## `agentic-ide-prompt` — Prompt an Agentic-IDE terminal
+
+Send an instruction to the coding agent in a named terminal. Use this whenever the user tells a terminal to do something ('tell Kai to ...', 'Mika soll ...', 'let Nova refactor ...') — that work belongs to that agent, never to a background worker. Pass the user's instruction as the prompt; with compose=true it is rewritten into a briefed task with the relevant files of this workspace attached. CHECK THE REPLY: it carries a 'submitted' flag. True means the agent accepted the prompt and started. False means the text is only sitting in that terminal's input box — say so plainly and name the terminal, never report it as done.
+
+- **Endpoint:** `POST /api/agentic-ide/terminals/{name}/prompt`
+- **Arguments:** `name` (string; required); `prompt` (string; required); `compose` (boolean; optional)
+- **Requires confirmation:** no
+- **Desktop UI section:** `agentic-ide`
+- **Voice example (EN):** "tell mika to run the tests"
+
+## `agentic-ide-spawn-terminals` — Open more Agentic-IDE terminals
+
+Open one or more additional coding terminals in the open workspace. Use this when the user asks for MORE TERMINALS / panes ('spawn five new Claude Code terminals', 'open two more Codex terminals') — that is a request for workspace panes, never for a background worker. Pass count, and agent only when the user named one ('claude' or 'codex'); omitted, the new panes run whatever the last pane runs. CHECK THE REPLY: 'capped' true means the workspace maximum cut the request short — say how many actually opened and name them, never report the full number as done.
+
+- **Endpoint:** `POST /api/agentic-ide/terminals/batch`
+- **Arguments:** `count` (integer; required); `agent` (one of: claude, codex; optional)
+- **Requires confirmation:** no
+- **Desktop UI section:** `agentic-ide`
+- **Voice example (EN):** "spawn five new claude code terminals"
+
+## `agentic-ide-focus` — Toggle Agentic-IDE focus mode
+
+Turn the focused coding mode on or off. While on, answers are given inside the open coding workspace; turning it off returns to normal behaviour without stopping any agent.
+
+- **Endpoint:** `PUT /api/agentic-ide/mode`
+- **Arguments:** `enabled` (boolean; required)
+- **Requires confirmation:** no
+- **Desktop UI section:** `agentic-ide`
+- **Voice example (EN):** "switch into coding mode"
+
diff --git a/jarvis/agentic_ide/intent.py b/jarvis/agentic_ide/intent.py
index 2e96f262c0..c4bd13c16b 100644
--- a/jarvis/agentic_ide/intent.py
+++ b/jarvis/agentic_ide/intent.py
@@ -260,18 +260,177 @@ def _looks_like_instruction(text: str) -> bool:
return bool(_INSTRUCTION_VERB_RE.search(text))
+# --------------------------------------------------------------------------- #
+# "Open N more terminals" #
+# --------------------------------------------------------------------------- #
+# A second, narrower request shape: the user asking for MORE PANES rather than
+# addressing an existing one ("spawne fünf neue Claude Code Terminals"). # i18n-allow: quoted spoken input
+#
+# Why it needs its own detector instead of a router tool: the sentence opens
+# with the very word the force-spawn heuristic reads as "dispatch a background
+# agent". Left to the router, the turn becomes an invisible mission worker — the
+# same class of failure ``detect`` above exists to fix, one layer up. So this is
+# deterministic too, and it deliberately claims the turn BEFORE the
+# vehicle-naming stand-down (see ``owns_turn``).
+#
+# The safety margin is one mandatory word: a TERMINAL NOUN. "Spawne fünf # i18n-allow: quoted spoken input
+# Terminals" is a workspace request; "spawne fünf Agenten" stays a background # i18n-allow: quoted spoken input
+# mission. A false positive here silently withholds a mission the user wanted,
+# which is invisible; a false negative just costs one clearer sentence.
+
+# Nouns that mean "a pane of the coding workspace". "Fenster"/"ventana"
+# (window) is deliberately NOT here: a spoken "open two windows" is at least as
+# likely to mean an application window, which is a Computer-Use request.
+_PANE_NOUN_RE = re.compile(
+ r"\b(?:terminals?|terminales|panes?|tabs?)\b",
+ re.IGNORECASE,
+)
+
+# Verbs that ask for something to be opened, plus the additive markers that
+# carry the same request without a verb ("noch drei Terminals").
+_OPEN_VERB_RE = re.compile(
+ r"\b(?:spawn\w*|[oö]ffn\w*|start\w*|mach\w*|erstell\w*|f[uü]g\w*|" # i18n-allow: German input vocabulary
+ r"gib|geb\w*|brauch\w*|will|h[aä]tte|" # i18n-allow: German input vocabulary
+ r"open\w*|create\w*|launch\w*|add|give|need|want|"
+ r"abr\w*|cre\w*|lanz\w*|a[nñ]ad\w*|agrega\w*|dame|necesito|quiero)\b",
+ re.IGNORECASE,
+)
+_ADDITIVE_RE = re.compile(
+ r"\b(?:noch|weitere\w*|zus[aä]tzlich\w*|mehr|another|more|extra|" # i18n-allow: German input vocabulary
+ r"otr[oa]s?|m[aá]s)\b",
+ re.IGNORECASE,
+)
+
+# An utterance that OPENS with a question word is asking about terminals, not
+# asking for them ("wie viele Terminals kann ich öffnen?"). A polite request # i18n-allow: quoted spoken input
+# that merely ends in a question mark ("kannst du 5 Terminals öffnen?") is NOT # i18n-allow: quoted spoken input
+# excluded — that is a real request, and the filler prefix above strips its
+# politeness for the composer anyway.
+_QUESTION_OPENER_RE = re.compile(
+ r"^(?:"
+ r"wie|was|wieso|warum|wo|wann|welche\w*|wieviel\w*|"
+ r"how|what|why|where|when|which|"
+ r"c[oó]mo|qu[eé]|cu[aá]nt\w*|por\s+qu[eé]|d[oó]nde|cu[aá]ndo"
+ r")\b",
+ re.IGNORECASE,
+)
+
+# Number words per locale. Capped at the workspace maximum: past it the count is
+# clamped anyway, so spelling out "twenty" buys nothing.
+_NUMBER_WORDS: dict[str, int] = {
+ # German — "ein/eine/einen" doubles as the article, which is exactly right # i18n-allow: names the German number words below
+ # here ("mach noch ein Terminal auf" = one). # i18n-allow: quoted spoken input
+ "ein": 1, "eine": 1, "einen": 1, "eins": 1, # i18n-allow: German number words (input vocabulary)
+ "zwei": 2, "drei": 3, "vier": 4, "fünf": 5, "funf": 5, "sechs": 6, # i18n-allow: German number words (input vocabulary)
+ "sieben": 7, "acht": 8, "neun": 9, "zehn": 10, "elf": 11, "zwölf": 12, # i18n-allow: German number words (input vocabulary)
+ "zwolf": 12,
+ # English
+ "a": 1, "an": 1, "one": 1, "two": 2, "three": 3, "four": 4, "five": 5,
+ "six": 6, "seven": 7, "eight": 8, "nine": 9, "ten": 10, "eleven": 11,
+ "twelve": 12,
+ # Spanish
+ "un": 1, "uno": 1, "una": 1, "dos": 2, "tres": 3, "cuatro": 4, "cinco": 5,
+ "seis": 6, "siete": 7, "ocho": 8, "nueve": 9, "diez": 10, "once": 11,
+ "doce": 12,
+}
+
+# Which coding agent, when the user names one. Bare "claude" counts — nobody
+# says a product name in full while talking. Everything else (including no
+# mention at all) leaves the choice to the registry, which inherits the last
+# pane's agent: "noch drei davon" is the common intent.
+_AGENT_RE = re.compile(r"\b(claude(?:\s+code)?|codex)\b", re.IGNORECASE)
+
+
+@dataclass(frozen=True, slots=True)
+class SpawnTerminalsRequest:
+ """A spoken request to open more panes in the coding workspace."""
+
+ count: int
+ """How many panes to open, already clamped to a sane range."""
+
+ agent: str | None
+ """``"claude"`` / ``"codex"``, or ``None`` to inherit the last pane's."""
+
+ utterance: str
+ """The original utterance, unmodified."""
+
+
+def _spoken_count(text: str) -> int:
+ """The requested number of panes: digits, a number word, or 1.
+
+ First hit wins. A count is optional — "open another terminal" is a perfectly
+ clear request for one — so this never fails, it defaults.
+ """
+ from .session import MAX_TERMINALS
+
+ digits = re.search(r"\b(\d{1,3})\b", text)
+ if digits is not None:
+ return max(1, min(int(digits.group(1)), MAX_TERMINALS))
+ for word in text.lower().split():
+ cleaned = "".join(ch for ch in word if ch.isalpha())
+ if cleaned in _NUMBER_WORDS:
+ return max(1, min(_NUMBER_WORDS[cleaned], MAX_TERMINALS))
+ return 1
+
+
+def detect_spawn(
+ user_text: str, *, names: list[str] | None = None
+) -> SpawnTerminalsRequest | None:
+ """A request to open more terminals, or ``None``.
+
+ ``names`` is the live call-signs (injectable for tests). They are needed for
+ one decision only: an utterance that ADDRESSES a pane is that pane's prompt,
+ even when it mentions terminals: telling a named pane to open a terminal is
+ work for THAT pane, not a request for another one. Addressing therefore wins,
+ and it is checked here so both callers inherit the same order.
+ """
+ text = (user_text or "").strip()
+ if len(text) < 6:
+ return None
+ if _PANE_NOUN_RE.search(text) is None:
+ return None
+ if _QUESTION_OPENER_RE.search(text) is not None:
+ return None
+ if _OPEN_VERB_RE.search(text) is None and _ADDITIVE_RE.search(text) is None:
+ return None
+ if detect(text, names=names) is not None:
+ return None
+
+ agent_match = _AGENT_RE.search(text)
+ agent: str | None = None
+ if agent_match is not None:
+ agent = "codex" if agent_match.group(1).lower().startswith("codex") else "claude"
+ return SpawnTerminalsRequest(
+ count=_spoken_count(text), agent=agent, utterance=text
+ )
+
+
def owns_turn(user_text: str, *, names: list[str] | None = None) -> bool:
"""True when the open workspace should handle this turn instead of a spawn.
- Used by the router's force-spawn guard. An utterance that explicitly names
- the spawn vehicle is NOT owned here — asking for a background agent while a
- workspace happens to be open is a real request, and stealing it would be the
- mirror image of the bug this module fixes.
+ Used by the router's force-spawn guard AND by ``spawn_gate`` — both already
+ call this before they look for the delegation marker, which is why the
+ precedence lives here and not in either of them: one answer, no drift.
+
+ Order:
+
+ 1. A request for MORE TERMINALS is the workspace's, even though it names the
+ spawn vehicle ("spawne … Terminals"). The mandatory pane noun is what
+ makes claiming it safe, and it holds with no workspace open too — the
+ feature then opens one, so a background mission would be just as wrong.
+ 2. Otherwise an utterance that explicitly names the spawn vehicle is NOT
+ owned here — asking for a background agent while a workspace happens to
+ be open is a real request, and stealing it would be the mirror image of
+ the bug this module fixes.
"""
from jarvis.brain.spawn_gate import names_spawn_vehicle
text = (user_text or "").strip()
- if not text or names_spawn_vehicle(text):
+ if not text:
+ return False
+ if detect_spawn(text, names=names) is not None:
+ return True
+ if names_spawn_vehicle(text):
return False
return detect(text, names=names) is not None
@@ -279,7 +438,9 @@ def owns_turn(user_text: str, *, names: list[str] | None = None) -> bool:
__all__ = [
"KIND_PROMPT",
"KIND_REPORT",
+ "SpawnTerminalsRequest",
"TerminalIntent",
"detect",
+ "detect_spawn",
"owns_turn",
]
diff --git a/jarvis/brain/manager.py b/jarvis/brain/manager.py
index 8a1a1c00b1..6e59880764 100644
--- a/jarvis/brain/manager.py
+++ b/jarvis/brain/manager.py
@@ -1110,6 +1110,52 @@ def _terminal_not_running_line(terminal: str, status: str, lang: str) -> str:
)
+def _recent_agent(recent: Any) -> str:
+ """The coding agent a remembered workspace mostly ran, defaulting to Claude.
+
+ Reopening a project the user last worked in with Codex should not silently
+ switch them to a different agent. ``agents`` is a name -> pane-count map, so
+ the majority answer is the one that matches what they saw last time.
+ """
+ counts = getattr(recent, "agents", None) or {}
+ if not counts:
+ return "claude"
+ return max(counts.items(), key=lambda kv: kv[1])[0]
+
+
+def _terminals_spawned_line(
+ names: list[str], *, requested: int, folder: str | None, lang: str
+) -> str:
+ """Spoken confirmation for "open N more terminals".
+
+ Always names the new panes: they are how the user addresses them in the very
+ next sentence ("Zara, mach mal ..."), and hearing three names after asking
+ for five is the fastest possible way to notice the workspace was full.
+
+ The names are joined with commas rather than a localized "and" — a list
+ separator needs no translation, and a per-language conjunction would be one
+ more thing to get wrong in a fourth locale.
+ """
+ from jarvis.voice.action_phrases import action_phrase
+
+ listed = ", ".join(names)
+ if folder is not None:
+ # A workspace had to be opened first; naming the folder is what makes the
+ # assumption auditable.
+ return action_phrase(
+ "ide_terminals_opened_workspace", lang, folder=folder, names=listed
+ )
+ if len(names) < requested:
+ return action_phrase(
+ "ide_terminals_spawned_capped", lang, count=len(names), names=listed
+ )
+ if len(names) == 1:
+ return action_phrase("ide_terminals_spawned_one", lang, names=listed)
+ return action_phrase(
+ "ide_terminals_spawned", lang, count=len(names), names=listed
+ )
+
+
# Conversational coaching: "help me [get better at a soft / cognitive /
# conversational skill]" — asking, thinking, phrasing, deciding, understanding,
# expressing, communicating. This is CONVERSATION (Jarvis answers inline and
@@ -5713,6 +5759,139 @@ class BrainManager:
)
return _prompt_sent_line(term.name, composed.files, out_lang)
+ async def _run_agentic_ide_spawn_fast_path(
+ self,
+ user_text: str,
+ *,
+ trace_id: UUID | None = None,
+ ) -> str | None:
+ """Open N more coding terminals when the user asks for them out loud.
+
+ "Spawn five more Claude Code terminals" is a workspace request, but it
+ opens with the word the force-spawn heuristic reads as "dispatch a
+ background agent" — so left to the router it becomes an invisible mission
+ worker instead of five panes. ``intent.detect_spawn`` claims the turn
+ (that precedence lives in ``intent.owns_turn``, which both routing gates
+ already consult) and this path carries it out.
+
+ Three things happen here that the REST route cannot do on its own:
+
+ 1. **A workspace is opened when none is running.** The folder is the most
+ recently used one, and it is NAMED in the reply — it is an assumption,
+ and the user has to be able to hear a wrong one.
+ 2. **The open UI is told.** Panes added from outside the workspace view
+ are invisible to it (it fetches its state once, on mount), so the new
+ pane list is published on the bus.
+ 3. **The view is brought forward.** This is also what STARTS the agents:
+ ``add_terminals`` creates the registry entries, and each agent's
+ pseudo-terminal spawns when its pane mounts.
+
+ Returns ``None`` on every turn that is not a terminal-spawn request, so
+ the normal path runs untouched.
+ """
+ try:
+ from jarvis.agentic_ide import intent as ide_intent
+ from jarvis.agentic_ide.session import (
+ MAX_TERMINALS,
+ SessionError,
+ get_registry,
+ terminals_added_event,
+ )
+ except Exception: # noqa: BLE001 - optional surface
+ return None
+
+ try:
+ request = ide_intent.detect_spawn(user_text)
+ except Exception: # noqa: BLE001 - detection must never break a turn
+ return None
+ if request is None:
+ return None
+
+ out_lang = resolve_output_language(
+ self._reply_language,
+ "unknown",
+ user_text,
+ default=DEFAULT_LOCALE,
+ conversation_language=self._conversation_language,
+ )
+ from jarvis.voice.action_phrases import action_phrase
+
+ registry = get_registry()
+ folder_label: str | None = None
+
+ try:
+ if registry.session is None:
+ # No workspace open: take the most recent one. Reading the
+ # recents file is IO, so it goes to a thread — this path runs
+ # inside a voice turn.
+ from jarvis.agentic_ide import recents
+
+ entries = await asyncio.to_thread(recents.load)
+ if not entries:
+ return action_phrase("ide_terminals_nowhere", out_lang)
+ recent = entries[0]
+ agent = request.agent or _recent_agent(recent)
+ session = await registry.start(
+ recent.path,
+ [{"agent": agent} for _ in range(request.count)],
+ )
+ created = list(session.terminals)
+ folder_label = recent.name
+ else:
+ created, _capped = await registry.add_terminals(
+ request.count, agent=request.agent
+ )
+ except SessionError as exc:
+ # A full workspace, a missing CLI, an unreadable folder: every one of
+ # these already carries a user-facing English sentence, and speaking
+ # it is more useful than a generic failure.
+ log.info("Agentic IDE spawn fast-path refused: %s", exc)
+ if "maximum" in str(exc).lower():
+ return action_phrase(
+ "ide_terminals_full", out_lang, max=MAX_TERMINALS
+ )
+ return str(exc)
+ except Exception: # noqa: BLE001 - never crash the turn over a pane
+ log.warning("Agentic IDE spawn fast-path failed", exc_info=True)
+ return None
+
+ if not created:
+ return action_phrase("ide_terminals_full", out_lang, max=MAX_TERMINALS)
+
+ session = registry.session
+ if session is not None and self._bus is not None:
+ try:
+ await self._bus.publish(
+ terminals_added_event(
+ session, created, source_layer="brain.agentic_ide_spawn"
+ )
+ )
+ # Bring the workspace forward so the panes are SEEN appearing —
+ # and so their agents boot, which only happens once a pane
+ # mounts. A no-op when the view is already active.
+ from jarvis.core.events import NavigateSidebar
+
+ await self._bus.publish(
+ NavigateSidebar(
+ section="agentic-ide",
+ source_layer="brain.agentic_ide_spawn",
+ trace_id=trace_id or uuid4(),
+ )
+ )
+ except Exception: # noqa: BLE001 - the panes exist either way
+ log.warning("Agentic IDE spawn: UI notification failed", exc_info=True)
+
+ names = [t.name for t in created]
+ log.info(
+ "Agentic IDE spawn fast-path: opened %d pane(s) %s%s",
+ len(names),
+ names,
+ f" in {folder_label}" if folder_label else "",
+ )
+ return _terminals_spawned_line(
+ names, requested=request.count, folder=folder_label, lang=out_lang
+ )
+
def _is_explicit_heavy_request(self, user_text: str) -> bool:
"""Return whether the user semantically requested a heavy worker."""
text = (user_text or "").strip()
@@ -8173,6 +8352,26 @@ class BrainManager:
)
return ide_reply
+ # Agentic-IDE pane spawn: "spawn five more Claude Code terminals" opens
+ # five panes instead of dispatching a background mission. Same reason to
+ # be deterministic and to sit ahead of force-spawn as the path above —
+ # the utterance NAMES the spawn vehicle, so nothing but a narrower
+ # deterministic rule can keep it in the workspace. Runs after the
+ # addressed-terminal path because ``detect_spawn`` stands down for an
+ # addressed pane ("sag Mika, sie soll ein Terminal öffnen" is Mika's
+ # work), which makes the two mutually exclusive by construction.
+ ide_spawn_reply = await self._run_agentic_ide_spawn_fast_path(
+ user_text, trace_id=turn_trace_id,
+ )
+ if ide_spawn_reply is not None:
+ await self._record_response_side_effects(
+ user_text=user_text,
+ response_text=ide_spawn_reply,
+ use_history=use_history,
+ trace_id=turn_trace_id,
+ )
+ return ide_spawn_reply
+
# Agent-C (capability-coupling): pre-generation capability gate.
# If the utterance looks like an action request but no registered
# capability covers it, return a deterministic "not supported" reply
diff --git a/jarvis/commands/registry.py b/jarvis/commands/registry.py
index 75559220af..1ce49ee8fc 100644
--- a/jarvis/commands/registry.py
+++ b/jarvis/commands/registry.py
@@ -707,6 +707,49 @@ def _build_registry() -> tuple[AppCommand, ...]:
"es": ("dile a mika que ejecute las pruebas",), # i18n-allow: input vocab
},
),
+ AppCommand(
+ id="agentic-ide-spawn-terminals",
+ title="Open more Agentic-IDE terminals",
+ description=(
+ "Open one or more additional coding terminals in the open "
+ "workspace. Use this when the user asks for MORE TERMINALS / "
+ "panes ('spawn five new Claude Code terminals', 'open two more "
+ "Codex terminals') — that is a request for workspace panes, "
+ "never for a background worker. Pass count, and agent only when "
+ "the user named one ('claude' or 'codex'); omitted, the new "
+ "panes run whatever the last pane runs. "
+ "CHECK THE REPLY: 'capped' true means the workspace maximum cut "
+ "the request short — say how many actually opened and name them, "
+ "never report the full number as done."
+ ),
+ method="POST",
+ path="/api/agentic-ide/terminals/batch",
+ params={
+ "type": "object",
+ "properties": {
+ "count": {
+ "type": "integer",
+ "default": 1,
+ "description": "How many terminals to open.",
+ },
+ "agent": {
+ "type": "string",
+ "enum": ["claude", "codex"],
+ "description": (
+ "Coding agent for the new panes; omit to inherit "
+ "the last pane's."
+ ),
+ },
+ },
+ "required": ["count"],
+ },
+ ui_section="agentic-ide",
+ voice_aliases={
+ "de": ("spawne fünf neue terminals",), # i18n-allow: input vocab
+ "en": ("spawn five new claude code terminals",),
+ "es": ("abre dos terminales de codex",), # i18n-allow: input vocab
+ },
+ ),
AppCommand(
id="agentic-ide-focus",
title="Toggle Agentic-IDE focus mode",
diff --git a/jarvis/core/events.py b/jarvis/core/events.py
index 72e39e6d7a..d60199a277 100644
--- a/jarvis/core/events.py
+++ b/jarvis/core/events.py
@@ -386,6 +386,28 @@ class NavigateSidebar(Event):
section: str = ""
+@dataclass(frozen=True, slots=True)
+class AgenticIdeTerminalsAdded(Event):
+ """Panes were added to the Agentic-IDE workspace from outside its view.
+
+ The workspace view loads its state once when it mounts, which is enough as
+ long as it is the only thing that can add a pane. Voice and the CLI can too
+ ("open five more Claude Code terminals"), and without this event those panes
+ exist in the registry while the open view keeps showing the old grid.
+
+ The frontend (``useWebSocket.ts``) turns it into a window event the workspace
+ view listens for and re-runs its own fetch — the same shape as
+ ``SecretConfigured``. ``names`` is carried so a client can tell the user what
+ appeared without a second request; ``folder`` identifies the workspace, since
+ a stale event from a session that has since been replaced must not be acted
+ on.
+ """
+ session_id: str = ""
+ names: tuple[str, ...] = ()
+ agent: str = ""
+ folder: str = ""
+
+
# ----------------------------------------------------------------------
# UI / Chat
# ----------------------------------------------------------------------
diff --git a/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts b/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts
index fec80785df..c2f6769c27 100644
--- a/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts
@@ -256,6 +256,17 @@ export function useWebSocket(): void {
window.dispatchEvent(new CustomEvent("jarvis:secret-configured", { detail: env.payload }));
}
+ if (env.event_name === "AgenticIdeTerminalsAdded") {
+ // Panes were opened by voice or the CLI. The workspace view loads its
+ // state once on mount, so without this it would keep showing the old
+ // grid while the agents are already running. Trigger only — the view
+ // re-runs its own fetch, which is the single source of truth for the
+ // layout.
+ window.dispatchEvent(
+ new CustomEvent("jarvis:agentic-ide-changed", { detail: env.payload }),
+ );
+ }
+
// Live interface-language switch (voice / Control API / another client):
// the whole app re-renders in the new language with no reload. push:false
// so receiving the broadcast does not echo a PUT back.
diff --git a/jarvis/voice/action_phrases.py b/jarvis/voice/action_phrases.py
index c54084b77c..602b5a98c1 100644
--- a/jarvis/voice/action_phrases.py
+++ b/jarvis/voice/action_phrases.py
@@ -326,6 +326,54 @@ _PHRASES: dict[str, dict[str, str]] = {
"en": "{terminal} is not running right now ({status}). I sent nothing.",
"es": "{terminal} no está en marcha ahora ({status}). No envié nada.",
},
+ # Opening more panes by voice ("spawn five more Claude Code terminals").
+ # The names are always read back: they are how the user addresses the new
+ # panes in the very next sentence, and hearing them is also the fastest way
+ # to notice that fewer opened than asked for.
+ "ide_terminals_spawned_one": {
+ "de": "{names} ist offen.", # i18n-allow
+ "en": "{names} is open.",
+ "es": "{names} está abierta.",
+ },
+ "ide_terminals_spawned": {
+ "de": "{count} neue Terminals: {names}.", # i18n-allow
+ "en": "{count} new terminals: {names}.",
+ "es": "{count} terminales nuevas: {names}.",
+ },
+ # Fewer than asked for, because the workspace cap cut the batch short. Named
+ # separately from the plain success so the shortfall is impossible to miss.
+ "ide_terminals_spawned_capped": {
+ "de": "Platz war nur für {count}: {names}.", # i18n-allow
+ "en": "There was only room for {count}: {names}.",
+ "es": "Solo había espacio para {count}: {names}.",
+ },
+ "ide_terminals_full": {
+ "de": "Der Workspace ist voll, {max} Terminals laufen schon.", # i18n-allow
+ "en": "The workspace is full, {max} terminals are already running.",
+ "es": "El espacio de trabajo está lleno, ya hay {max} terminales.",
+ },
+ # No workspace was open, so one was opened in the most recent folder. The
+ # folder is named on purpose: it is an assumption, and hearing it is how the
+ # user catches a wrong one before an agent starts working in it.
+ "ide_terminals_opened_workspace": {
+ "de": "Ich habe {folder} geöffnet: {names}.", # i18n-allow
+ "en": "I opened {folder}: {names}.",
+ "es": "Abrí {folder}: {names}.",
+ },
+ "ide_terminals_nowhere": {
+ "de": ( # i18n-allow
+ "Es ist kein Workspace offen und ich habe keinen letzten. " # i18n-allow
+ "Wähle einen Ordner in der Agentic IDE." # i18n-allow
+ ),
+ "en": (
+ "No workspace is open and there is no recent one. "
+ "Pick a folder in the Agentic IDE."
+ ),
+ "es": (
+ "No hay ningún espacio de trabajo abierto ni uno reciente. "
+ "Elige una carpeta en el IDE agéntico."
+ ),
+ },
}
diff --git a/scripts/ci/german-allowlist.txt b/scripts/ci/german-allowlist.txt
index 3dd0e0d2f3..98060fbd59 100644
--- a/scripts/ci/german-allowlist.txt
+++ b/scripts/ci/german-allowlist.txt
@@ -383,3 +383,14 @@ jarvis/speech/tts_eval/corpus.py
# 4, same shape as tts_eval/corpus.py above). The harness and tests that
# READ this file are NOT exempt and stay English-checked. ---
tests/fixtures/skill_routing/golden.yaml
+
+# --- Generated command reference: every German fragment in it is a quoted
+# SPOKEN EXAMPLE copied out of a Command-Registry description ("'Mika soll
+# ...'", "'sag Mika ...'"), i.e. the input vocabulary a voice command has to
+# match (reason 3). The file is written by
+# scripts/ci/gen_commands_reference.py, so an inline i18n-allow is
+# impossible: the next regeneration would drop it. Nobody hand-writes prose
+# here, so this is not a "narrow it later" exemption — the SOURCE
+# (jarvis/commands/registry.py) stays English-checked, which is where a real
+# German leak would have to be fixed. ---
+docs/commands-reference.md
diff --git a/tests/unit/agentic_ide/test_pane_batch.py b/tests/unit/agentic_ide/test_pane_batch.py
new file mode 100644
index 0000000000..06045a2803
--- /dev/null
+++ b/tests/unit/agentic_ide/test_pane_batch.py
@@ -0,0 +1,120 @@
+"""Opening several panes at once — the batch behind "open five more terminals".
+
+Deliberately layout-agnostic: placement is ``add_terminal``'s job and is pinned
+by its own tests. What matters here is the part a spoken request depends on —
+how many panes appear, which agent they run, and whether the caller is told the
+truth when the workspace cap cuts the request short. A batch that silently
+opened three of five would report success for work that did not happen.
+"""
+from __future__ import annotations
+
+from pathlib import Path
+
+import pytest
+
+from jarvis.agentic_ide import session as session_mod
+from jarvis.agentic_ide.session import (
+ MAX_TERMINALS,
+ Registry,
+ SessionError,
+ terminals_added_event,
+)
+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}",))
+ return Registry(pty_manager=FakePtyManager())
+
+
+async def _open(registry: Registry, folder: Path, count: int, agent: str = "claude"):
+ return await registry.start(
+ str(folder), [{"agent": agent} for _ in range(count)]
+ )
+
+
+def _names(registry: Registry) -> list[str]:
+ assert registry.session is not None
+ return [t.name for t in registry.session.terminals]
+
+
+async def test_a_batch_opens_every_requested_pane(
+ registry: Registry, tmp_path: Path
+) -> None:
+ await _open(registry, tmp_path, 2)
+ created, capped = await registry.add_terminals(3)
+ assert len(created) == 3
+ assert capped is False
+ assert len(_names(registry)) == 5
+ # Call-signs stay unique and come from the speakable pool, so the reply can
+ # name what appeared.
+ assert len(set(_names(registry))) == 5
+
+
+async def test_the_cap_truncates_and_says_so(
+ registry: Registry, tmp_path: Path
+) -> None:
+ """Nine panes open, five requested: three appear and ``capped`` is True.
+
+ This is the maintainer's live case (nine panes on screen). Silent truncation
+ is the failure mode — the flag is what lets the spoken reply be honest.
+ """
+ await _open(registry, tmp_path, MAX_TERMINALS - 3)
+ created, capped = await registry.add_terminals(5)
+ assert len(created) == 3
+ assert capped is True
+ assert len(_names(registry)) == MAX_TERMINALS
+
+
+async def test_a_full_workspace_refuses_instead_of_reporting_nothing(
+ registry: Registry, tmp_path: Path
+) -> None:
+ """With no room at all the caller gets an error it can read out loud."""
+ await _open(registry, tmp_path, MAX_TERMINALS)
+ with pytest.raises(SessionError, match="maximum"):
+ await registry.add_terminals(2)
+
+
+async def test_the_agent_is_inherited_unless_named(
+ registry: Registry, tmp_path: Path
+) -> None:
+ """"Two more" means two more OF THESE; naming an agent overrides that."""
+ await _open(registry, tmp_path, 1, agent="codex")
+ inherited, _ = await registry.add_terminals(2)
+ assert [t.agent for t in inherited] == ["codex", "codex"]
+
+ named, _ = await registry.add_terminals(2, agent="claude")
+ assert [t.agent for t in named] == ["claude", "claude"]
+
+
+async def test_an_unknown_agent_fails_loudly_with_nothing_opened(
+ registry: Registry, tmp_path: Path
+) -> None:
+ await _open(registry, tmp_path, 1)
+ with pytest.raises(SessionError):
+ await registry.add_terminals(3, agent="nope")
+ assert len(_names(registry)) == 1
+
+
+async def test_a_batch_without_a_session_is_an_error(registry: Registry) -> None:
+ with pytest.raises(SessionError, match="No Agentic-IDE session"):
+ await registry.add_terminals(2)
+
+
+async def test_the_bus_event_carries_what_the_clients_need(
+ registry: Registry, tmp_path: Path
+) -> None:
+ """One event per batch, naming every pane — not one event per pane.
+
+ The open workspace view refreshes on it, so a five-pane batch must not make
+ it refetch five times.
+ """
+ session = await _open(registry, tmp_path, 1)
+ created, _ = await registry.add_terminals(3)
+ event = terminals_added_event(session, created, source_layer="test")
+ assert event.session_id == session.id
+ assert event.names == tuple(t.name for t in created)
+ assert len(event.names) == 3
+ assert event.agent == "claude"
+ assert event.folder == session.folder
diff --git a/tests/unit/agentic_ide/test_spawn_intent.py b/tests/unit/agentic_ide/test_spawn_intent.py
new file mode 100644
index 0000000000..9dc2c08cec
--- /dev/null
+++ b/tests/unit/agentic_ide/test_spawn_intent.py
@@ -0,0 +1,131 @@
+"""Guards for the spoken "open N more terminals" detector.
+
+The feature this pins: asking out loud for five more Claude Code terminals
+opens five panes in the workspace. The hazard it pins: that same sentence starts with
+the word the router uses to recognise a BACKGROUND agent request, so without a
+narrow grammar the utterance dispatches an invisible mission worker instead —
+the 2026-07-25 defect class all over again, one layer up.
+
+Two properties pull against each other here on purpose:
+
+* a request that names TERMINALS belongs to the workspace, even though it also
+ names the spawn vehicle ("spawne"), and
+* a request that does NOT name terminals still reaches the background-agent
+ path, because "spawne einen Agenten" means exactly that.
+
+The discriminator is the terminal noun, and it is mandatory. Everything else
+(verb, count, agent) is optional or defaulted, so the detector can only ever
+claim a turn the user spelled out.
+"""
+from __future__ import annotations
+
+import pytest
+
+from jarvis.agentic_ide import intent
+from jarvis.agentic_ide.session import MAX_TERMINALS
+
+NAMES = ["Mika", "Nova", "Aria", "Kai"]
+
+
+ ("utterance", "count", "agent"),
+ [
+ # The maintainer's own phrasings (voice request 2026-07-25).
+ ("Spawne 5 neue Terminals", 5, None), # i18n-allow: spoken input under test
+ ("Spawne 5 neue Claude Code Terminals", 5, "claude"), # i18n-allow: spoken input under test
+ ("Spawne fünf neue Claude Code Terminals", 5, "claude"), # i18n-allow: spoken input under test
+ # Number words, all three locales.
+ ("Öffne drei Codex Terminals", 3, "codex"), # i18n-allow: spoken input under test
+ ("Open two Codex terminals", 2, "codex"),
+ ("Abre dos terminales de Codex", 2, "codex"),
+ ("Crea cuatro terminales", 4, None),
+ # Additive forms without a verb.
+ ("Noch drei Terminals bitte", 3, None), # i18n-allow: spoken input under test
+ ("Two more terminals", 2, None),
+ # No count at all means one.
+ ("Open another terminal", 1, None),
+ ("Mach noch ein Terminal auf", 1, None), # i18n-allow: spoken input under test
+ ("Gib mir ein Codex Terminal", 1, "codex"), # i18n-allow: spoken input under test
+ # "Claude" alone is enough — nobody says the product name in full.
+ ("Starte zwei Claude Terminals", 2, "claude"), # i18n-allow: spoken input under test
+ # Pane / window / tab are the same request.
+ ("Öffne zwei neue Panes", 2, None), # i18n-allow: spoken input under test
+ ("Open three more tabs", 3, None),
+ ],
+)
+def test_spoken_terminal_requests(utterance: str, count: int, agent: str | None) -> None:
+ found = intent.detect_spawn(utterance)
+ assert found is not None, utterance
+ assert found.count == count, utterance
+ assert found.agent == agent, utterance
+
+
+def test_a_number_above_the_cap_is_clamped_not_refused() -> None:
+ """Asking for 50 is a real request for "as many as fit", not an error.
+
+ The registry enforces the true cap against the panes already open; the
+ detector only keeps the number in a sane range so nothing downstream has to
+ defend against a spoken "spawne tausend Terminals".
+ """
+ found = intent.detect_spawn("Spawne 50 Terminals") # i18n-allow: spoken input under test
+ assert found is not None
+ assert found.count == MAX_TERMINALS
+
+
+ "utterance",
+ [
+ # No terminal noun: these are background-agent requests and must stay
+ # that way. This is the whole safety margin of the feature.
+ "Spawne einen Agenten", # i18n-allow: spoken input under test
+ "Spawn a subagent that reviews the wake path",
+ "Spawne 5 Claude Codes", # i18n-allow: spoken input under test
+ "Delegiere das an einen Subagenten", # i18n-allow: spoken input under test
+ # Questions are not commands.
+ "Wie viele Terminals kann ich öffnen?", # i18n-allow: spoken input under test
+ "How many terminals can I open?",
+ "Was macht Kai im Terminal?", # i18n-allow: spoken input under test
+ # Talk ABOUT terminals, no request to open one.
+ "Die Terminals sind zu klein", # i18n-allow: spoken input under test
+ "Das Terminal von Mika hängt", # i18n-allow: spoken input under test
+ # Too short to be anything.
+ "Terminal",
+ "",
+ ],
+)
+def test_non_requests_are_left_alone(utterance: str) -> None:
+ assert intent.detect_spawn(utterance) is None, utterance
+
+
+def test_workspace_owns_a_terminal_spawn_even_though_it_names_the_vehicle() -> None:
+ """The precedence both routing gates read.
+
+ ``owns_turn`` is what ``spawn_gate.llm_spawn_allowed`` and
+ ``BrainManager._should_force_spawn`` already call before they look for the
+ delegation marker, so returning True here is the entire fix — neither gate
+ needs its own copy of this rule, and the two cannot drift apart.
+ """
+ assert intent.owns_turn("Spawne 5 neue Terminals", names=NAMES) is True # i18n-allow: spoken input under test
+ assert intent.owns_turn("Open three more Claude Code terminals", names=NAMES) is True
+ # Without a workspace open (no call-signs) it STILL owns the turn: the
+ # feature opens a session in the recent folder, so a background mission
+ # would be just as wrong there.
+ assert intent.owns_turn("Spawne 5 neue Terminals", names=[]) is True # i18n-allow: spoken input under test
+ # And the unchanged half: naming the vehicle without naming terminals still
+ # belongs to the background-agent path.
+ assert intent.owns_turn("Spawne einen Agenten", names=NAMES) is False # i18n-allow: spoken input under test
+
+
+def test_an_addressed_terminal_still_wins_over_the_spawn_grammar() -> None:
+ """Telling a named pane to open a terminal is a prompt FOR that pane.
+
+ The sentence contains a terminal noun and an opener, so the spawn grammar
+ could claim it — but the user addressed a pane, and typing the instruction
+ into that pane is what they asked for. Addressing is therefore checked
+ first, and this test is what keeps that order.
+ """
+ utterance = "Sag Mika, sie soll ein Terminal öffnen" # i18n-allow: spoken input under test
+ found = intent.detect(utterance, names=NAMES)
+ assert found is not None
+ assert found.terminal == "Mika"
+ assert intent.detect_spawn(utterance, names=NAMES) is None
diff --git a/tests/unit/brain/test_agentic_ide_spawn_fast_path.py b/tests/unit/brain/test_agentic_ide_spawn_fast_path.py
new file mode 100644
index 0000000000..df85d41441
--- /dev/null
+++ b/tests/unit/brain/test_agentic_ide_spawn_fast_path.py
@@ -0,0 +1,280 @@
+"""The spoken "open five more terminals" path, end to end inside the brain.
+
+Why this is deterministic code and not a router tool: the utterance opens with
+the very word ("spawne" / "spawn") that the force-spawn heuristic reads as
+"dispatch a background agent". Left to the LLM, five requested panes become one
+invisible mission worker in a throwaway git worktree — the 2026-07-25 defect
+class, one layer up. These tests pin the three things that make the feature real:
+
+* the panes actually appear (and how many, when the workspace cap intervenes),
+* the reply names them, in the language of the turn, and never overstates,
+* the open UI is told, because the workspace view fetches its state once on
+ mount and would otherwise show a stale grid while the agents are running.
+"""
+from __future__ import annotations
+
+from pathlib import Path
+
+import pytest
+
+from jarvis.agentic_ide import recents, session as session_mod
+from jarvis.agentic_ide.session import MAX_TERMINALS, Registry
+from jarvis.brain.manager import BrainManager
+from jarvis.core.bus import EventBus
+from jarvis.core.config import JarvisConfig
+from tests.fakes.fake_pty_manager import FakePtyManager
+
+
+class FakeBus:
+ def __init__(self) -> None:
+ self.published: list[object] = []
+
+ async def publish(self, event: object) -> None:
+ self.published.append(event)
+
+ def subscribe(self, *_a: object, **_kw: object) -> None:
+ return None
+
+ def subscribe_all(self, *_a: object, **_kw: object) -> None:
+ return None
+
+
+def _event_names(bus: FakeBus) -> list[str]:
+ return [type(e).__name__ for e in bus.published]
+
+
+def registry(monkeypatch: pytest.MonkeyPatch) -> Registry:
+ """A real registry on a fake pseudo-terminal, wired in place of the global one."""
+ monkeypatch.setattr(session_mod, "agent_argv", lambda name: (f"/usr/bin/{name}",))
+ reg = Registry(pty_manager=FakePtyManager())
+ monkeypatch.setattr(session_mod, "get_registry", lambda: reg)
+ return reg
+
+
+def manager() -> tuple[BrainManager, FakeBus]:
+ cfg = JarvisConfig()
+ cfg.brain.primary = "fake"
+ bus = FakeBus()
+ mgr = BrainManager(config=cfg, bus=EventBus(), tools={})
+ mgr._bus = bus # type: ignore[assignment]
+ # A pinned reply language keeps the assertions about wording independent of
+ # the host's configured locale (AP-23: never test against the maintainer's
+ # own config).
+ mgr._reply_language = "en"
+ return mgr, bus
+
+
+async def _open(registry: Registry, folder: Path, count: int, agent: str = "claude"):
+ return await registry.start(
+ str(folder), [{"agent": agent} for _ in range(count)]
+ )
+
+
+# ------------------------------------------------------------------ happy path
+async def test_a_spoken_request_opens_panes_and_names_them(
+ manager: tuple[BrainManager, FakeBus], registry: Registry, tmp_path: Path
+) -> None:
+ mgr, bus = manager
+ await _open(registry, tmp_path, 2)
+
+ reply = await mgr._run_agentic_ide_spawn_fast_path("Spawn three more terminals")
+
+ assert reply is not None
+ assert registry.session is not None
+ assert len(registry.session.terminals) == 5
+ # The three NEW call-signs are spoken back: they are how the user addresses
+ # the panes in the next sentence.
+ new_names = [t.name for t in registry.session.terminals[2:]]
+ for name in new_names:
+ assert name in reply
+ assert "3" in reply
+
+ # Both notifications go out: the grid refresh AND bringing the view forward
+ # (which is what starts the agents — a pane's PTY spawns when it mounts).
+ assert _event_names(bus) == ["AgenticIdeTerminalsAdded", "NavigateSidebar"]
+ assert bus.published[0].names == tuple(new_names)
+ assert bus.published[1].section == "agentic-ide"
+
+
+async def test_a_named_agent_is_honoured_over_the_inherited_one(
+ manager: tuple[BrainManager, FakeBus], registry: Registry, tmp_path: Path
+) -> None:
+ mgr, _bus = manager
+ await _open(registry, tmp_path, 1, agent="codex")
+
+ await mgr._run_agentic_ide_spawn_fast_path("Open two Claude Code terminals")
+
+ assert registry.session is not None
+ assert [t.agent for t in registry.session.terminals] == ["codex", "claude", "claude"]
+
+
+async def test_without_a_named_agent_the_new_panes_inherit(
+ manager: tuple[BrainManager, FakeBus], registry: Registry, tmp_path: Path
+) -> None:
+ """"Two more terminals" in a Codex workspace means two more Codex panes."""
+ mgr, _bus = manager
+ await _open(registry, tmp_path, 1, agent="codex")
+
+ await mgr._run_agentic_ide_spawn_fast_path("Two more terminals please")
+
+ assert registry.session is not None
+ assert [t.agent for t in registry.session.terminals] == ["codex", "codex", "codex"]
+
+
+# ------------------------------------------------------------------ the limits
+async def test_a_capped_batch_says_how_many_actually_opened(
+ manager: tuple[BrainManager, FakeBus], registry: Registry, tmp_path: Path
+) -> None:
+ """The maintainer's live case: nine panes open, five requested, three appear."""
+ mgr, _bus = manager
+ await _open(registry, tmp_path, MAX_TERMINALS - 3)
+
+ reply = await mgr._run_agentic_ide_spawn_fast_path("Spawn five more terminals")
+
+ assert reply is not None
+ assert "only room for 3" in reply
+ assert registry.session is not None
+ assert len(registry.session.terminals) == MAX_TERMINALS
+
+
+async def test_a_full_workspace_says_so_instead_of_failing_silently(
+ manager: tuple[BrainManager, FakeBus], registry: Registry, tmp_path: Path
+) -> None:
+ mgr, bus = manager
+ await _open(registry, tmp_path, MAX_TERMINALS)
+
+ reply = await mgr._run_agentic_ide_spawn_fast_path("Open two more terminals")
+
+ assert reply is not None
+ assert "full" in reply.lower()
+ assert str(MAX_TERMINALS) in reply
+ assert bus.published == [] # nothing changed, so nothing is announced
+
+
+# ----------------------------------------------------------- no open workspace
+async def test_no_workspace_opens_the_most_recent_folder_and_names_it(
+ manager: tuple[BrainManager, FakeBus],
+ registry: Registry,
+ tmp_path: Path,
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """The folder is an ASSUMPTION, so the reply has to say which one it took."""
+ mgr, bus = manager
+ project = tmp_path / "my-project"
+ project.mkdir()
+ monkeypatch.setattr(
+ recents,
+ "load",
+ lambda **_kw: [
+ recents.RecentWorkspace(
+ path=str(project),
+ name="my-project",
+ terminals=2,
+ agents={"codex": 2},
+ last_used=1.0,
+ )
+ ],
+ )
+
+ reply = await mgr._run_agentic_ide_spawn_fast_path("Spawn two terminals")
+
+ assert reply is not None
+ assert "my-project" in reply
+ assert registry.session is not None
+ assert registry.session.folder == str(project)
+ # The remembered agent split is replayed rather than defaulting to Claude —
+ # reopening a Codex project must not silently switch the agent.
+ assert [t.agent for t in registry.session.terminals] == ["codex", "codex"]
+ assert _event_names(bus) == ["AgenticIdeTerminalsAdded", "NavigateSidebar"]
+
+
+async def test_no_workspace_and_no_recents_is_an_honest_refusal(
+ manager: tuple[BrainManager, FakeBus],
+ registry: Registry,
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ mgr, bus = manager
+ monkeypatch.setattr(recents, "load", lambda **_kw: [])
+
+ reply = await mgr._run_agentic_ide_spawn_fast_path("Spawn two terminals")
+
+ assert reply is not None
+ assert "no workspace" in reply.lower()
+ assert "Agentic IDE" in reply
+ assert registry.session is None
+ assert bus.published == []
+
+
+# ------------------------------------------------------------- standing aside
+ "utterance",
+ [
+ "Spawn a subagent that reviews the wake path",
+ "How many terminals can I open?",
+ "What is Mika doing?",
+ "Tell Mika to run the tests",
+ ],
+)
+async def test_turns_that_are_not_pane_requests_fall_through(
+ manager: tuple[BrainManager, FakeBus],
+ registry: Registry,
+ tmp_path: Path,
+ utterance: str,
+) -> None:
+ """``None`` means "not mine" — the normal routing path runs untouched."""
+ mgr, _bus = manager
+ await _open(registry, tmp_path, 2)
+
+ assert await mgr._run_agentic_ide_spawn_fast_path(utterance) is None
+ assert registry.session is not None
+ assert len(registry.session.terminals) == 2
+
+
+ ("pinned", "expected"),
+ [
+ ("de", "neue Terminals"), # i18n-allow: asserted German reply
+ ("en", "new terminals"),
+ ("es", "terminales nuevas"),
+ ],
+)
+async def test_the_reply_follows_the_pinned_language(
+ manager: tuple[BrainManager, FakeBus],
+ registry: Registry,
+ tmp_path: Path,
+ pinned: str,
+ expected: str,
+) -> None:
+ """Every supported locale gets a real sentence, resolved through ONE resolver.
+
+ The language pin is the DURABLE guarantee, so it is what is pinned here. A
+ detection-based assertion would be flaky for a reason worth writing down:
+ "spawne zwei neue Terminals" is four words of which three are loanwords
+ shared with English, so no detector can be relied on to call it German —
+ which is precisely why the pin exists.
+ """
+ mgr, _bus = manager
+ mgr._reply_language = pinned
+ await _open(registry, tmp_path, 1)
+
+ reply = await mgr._run_agentic_ide_spawn_fast_path("Spawn two more terminals")
+
+ assert reply is not None
+ assert expected in reply
+
+
+async def test_a_clearly_german_turn_is_answered_in_german_without_a_pin(
+ manager: tuple[BrainManager, FakeBus], registry: Registry, tmp_path: Path
+) -> None:
+ """With ``auto``, an unmistakably German sentence still lands in German."""
+ mgr, _bus = manager
+ mgr._reply_language = "auto"
+ await _open(registry, tmp_path, 1)
+
+ reply = await mgr._run_agentic_ide_spawn_fast_path(
+ "Öffne mir bitte noch zwei zusätzliche Terminals" # i18n-allow: spoken input under test
+ )
+ assert reply is not None
+ assert "neue Terminals" in reply # i18n-allow: asserted German reply
diff --git a/tests/unit/web/test_agentic_ide_batch_route.py b/tests/unit/web/test_agentic_ide_batch_route.py
new file mode 100644
index 0000000000..ab22ea995e
--- /dev/null
+++ b/tests/unit/web/test_agentic_ide_batch_route.py
@@ -0,0 +1,133 @@
+"""The batch endpoint behind "open five more terminals".
+
+Two things it must never do: report a full success when the workspace cap cut
+the request short, and leave connected clients staring at a stale grid. The
+second one is why the route publishes an event at all — the workspace view
+fetches its state once when it mounts, so panes it did not create itself are
+invisible to it until something tells it to look again.
+"""
+from __future__ import annotations
+
+from pathlib import Path
+from types import SimpleNamespace
+
+import pytest
+
+from jarvis.agentic_ide.session import SessionError
+from jarvis.ui.web import agentic_ide_routes as routes
+
+
+class FakeBus:
+ def __init__(self) -> None:
+ self.published: list[object] = []
+
+ async def publish(self, event: object) -> None:
+ self.published.append(event)
+
+
+def _request(bus: object | None) -> SimpleNamespace:
+ """The one thing the route needs from a Request: ``app.state.bus``."""
+ return SimpleNamespace(app=SimpleNamespace(state=SimpleNamespace(bus=bus)))
+
+
+def _terminal(name: str, agent: str = "claude") -> SimpleNamespace:
+ return SimpleNamespace(
+ name=name, agent=agent, to_dict=lambda: {"name": name, "agent": agent}
+ )
+
+
+class FakeRegistry:
+ """Registry stand-in: records the call, returns a scripted outcome."""
+
+ def __init__(self, created: list[object], capped: bool, folder: Path) -> None:
+ self._created = created
+ self._capped = capped
+ self.calls: list[tuple[int, str | None]] = []
+ self.session = SimpleNamespace(id="ide_test", folder=str(folder))
+
+ async def add_terminals(self, count: int, *, agent: str | None = None):
+ self.calls.append((count, agent))
+ return self._created, self._capped
+
+ def state(self) -> dict:
+ return {"active": True}
+
+
+async def test_a_batch_opens_the_panes_and_tells_the_clients(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ created = [_terminal("Juno"), _terminal("Milo")]
+ registry = FakeRegistry(created, capped=False, folder=tmp_path)
+ monkeypatch.setattr(routes, "get_registry", lambda: registry)
+ bus = FakeBus()
+
+ result = await routes.add_terminals(
+ _request(bus), routes.AddTerminalsRequest(count=2, agent="claude")
+ )
+
+ assert result["ok"] is True
+ assert result["requested"] == 2
+ assert result["capped"] is False
+ assert [t["name"] for t in result["terminals"]] == ["Juno", "Milo"]
+ assert registry.calls == [(2, "claude")]
+
+ # Exactly one event for the batch, naming every pane — five panes must not
+ # make the open view refetch five times.
+ assert len(bus.published) == 1
+ event = bus.published[0]
+ assert event.names == ("Juno", "Milo")
+ assert event.folder == str(tmp_path)
+
+
+async def test_the_cap_is_reported_not_hidden(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """Five asked for, one opened: ``capped`` is what keeps the reply honest."""
+ registry = FakeRegistry([_terminal("Zara")], capped=True, folder=tmp_path)
+ monkeypatch.setattr(routes, "get_registry", lambda: registry)
+
+ result = await routes.add_terminals(
+ _request(FakeBus()), routes.AddTerminalsRequest(count=5)
+ )
+
+ assert result["capped"] is True
+ assert result["requested"] == 5
+ assert len(result["terminals"]) == 1
+
+
+async def test_a_refusal_becomes_a_conflict_with_the_reason(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """A full workspace / missing CLI answers 409 carrying the sentence to say."""
+
+ class Refusing:
+ session = None
+
+ async def add_terminals(self, count: int, *, agent: str | None = None):
+ raise SessionError("This workspace already has the maximum of 12 terminals.")
+
+ def state(self) -> dict:
+ return {}
+
+ monkeypatch.setattr(routes, "get_registry", lambda: Refusing())
+
+ with pytest.raises(routes.HTTPException) as caught:
+ await routes.add_terminals(
+ _request(None), routes.AddTerminalsRequest(count=3)
+ )
+ assert caught.value.status_code == 409
+ assert "maximum" in caught.value.detail
+
+
+async def test_no_bus_still_opens_the_panes(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """Headless / test hosts have no bus attached; the work must happen anyway."""
+ registry = FakeRegistry([_terminal("Juno")], capped=False, folder=tmp_path)
+ monkeypatch.setattr(routes, "get_registry", lambda: registry)
+
+ result = await routes.add_terminals(
+ _request(None), routes.AddTerminalsRequest(count=1)
+ )
+ assert result["ok"] is True
+ assert len(result["terminals"]) == 1