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.

fix(chat): the picker offers both seats again, and the timeline shows the work

rubenluetke10-beepa2c423560b8c
diff --git a/jarvis/agent_chat/__init__.py b/jarvis/agent_chat/__init__.py
index 51a899a93a..637fe8b720 100644
--- a/jarvis/agent_chat/__init__.py
+++ b/jarvis/agent_chat/__init__.py
@@ -1,26 +1,47 @@
-"""Agent chat — the typed front-page chat as an agent session.
-
-The chat surface of the front page used to be a second mouth for the voice
-brain: typed text went down the same ``MessageSent`` path the microphone
-uses and the router brain answered. Since 2026-08-23 it is its own thing —
-a coding-agent session in the Claude Code shape, run on whichever
-*agent-tier* provider and model the person picks in the composer, with the
-reasoning effort dialled by hand:
-
-* :mod:`.effort` — which effort levels each provider family offers and how
- a picked level maps onto what a provider actually accepts;
-* :mod:`.catalog` — the provider rows the picker shows (labels, runner
- family, curated model lists for the CLI-backed providers);
-* :mod:`.tools` — the hands of the in-process agent (Read / Write / Edit /
- Ls / Glob / Grep / RunCommand) scoped to the session's working directory;
-* :mod:`.events` — the one event vocabulary both the store and the live
- stream speak;
+"""The chat surface — Jarvis with a keyboard.
+
+**This is not the Agentic IDE's chat.** The two look alike on purpose and mean
+different things; keeping them apart is the whole point of this package's
+existence, and mixing them up has cost two rebuilds already:
+
+* **The chat section** (this package, ``components/home/ChatStage``) is JARVIS.
+ You type instead of speaking, and the same assistant answers — the same
+ brain, tools, memory, wiki and confirmations the microphone reaches. It has
+ no working directory, writes no code on its own, and its history is your
+ conversations with Jarvis.
+* **The Agentic IDE's chat** (``jarvis/agentic_ide``,
+ ``components/agentic/IdeChatSurface``) is a CODING AGENT. It reads and drives
+ the terminal sessions running in the workspace folder you opened — one pane,
+ its conversation rendered as an exchange. Its subject is code and files.
+
+Same shape, different job: one is who you talk to, the other is what you have
+working for you.
+
+What runs a turn here, and who pays for it:
+
+* :mod:`.runner_brain` — an API-key row. Jarvis' own brain thinks with that
+ provider's model (``BrainManager.generate``), billed per token. The turn's
+ steps are mirrored into the timeline from the app's event bus, so you see
+ the tools it reached for and the sentence it wrote next to each one.
+* :mod:`.runner_cli` — a subscription row (Claude Max, ChatGPT, Antigravity,
+ Grok). The vendor CLI runs the loop — that is what the seat pays for — but
+ inside the Jarvis harness (:mod:`.jarvis_harness`): Jarvis' own tools over
+ MCP and a preamble telling it whose hands those are, so it acts as Jarvis
+ rather than as a coding assistant that happens to sit in this folder.
+
+The rest of the package:
+
+* :mod:`.catalog` — the provider rows the picker shows, and which runner each
+ one uses;
+* :mod:`.effort` — the reasoning-effort ladders, per provider and per model;
+* :mod:`.permissions` — the vendor permission ladders (CLI rows only: the
+ brain has none, Jarvis' own risk tiers gate its tools);
+* :mod:`.events` — the one event vocabulary the store and the live stream
+ both speak;
* :mod:`.store` — SQLite persistence for sessions and their event log;
-* :mod:`.runner_api` / :mod:`.runner_cli` — the two ways a turn runs: the
- provider's own chat API in a tool loop, or a vendor CLI (``claude``,
- ``codex``, ``agy``, ``grok``) driven non-interactively;
+* :mod:`.tools` — the in-process file/shell tools of the API runner;
* :mod:`.service` — sessions in flight, subscribers, cancel and approvals.
-The voice path is untouched: nothing here subscribes to the event bus, and
-nothing on the voice critical path imports this package (AP-9).
+The voice path is untouched: nothing here sits on it, and the step mirror is a
+read-only bus subscriber that never reaches the publisher (AP-9, AP-18).
"""
diff --git a/jarvis/agent_chat/catalog.py b/jarvis/agent_chat/catalog.py
index f37a065a21..985723292c 100644
--- a/jarvis/agent_chat/catalog.py
+++ b/jarvis/agent_chat/catalog.py
@@ -5,11 +5,21 @@ from the API-Keys page. Picking one makes it the live brain for the turn
(:mod:`jarvis.agent_chat.runner_brain`), so what the row names is the model
behind the assistant, not a different assistant.
-A subscription coding CLI (Codex, Antigravity, Grok Build) is deliberately
-NOT here. Those are agent loops with their own tools and no chat API; the
-brain cannot be switched to them at all (``SUBAGENT_ONLY_BRAIN_PROVIDERS``),
-and a coding session belongs in the Agentic IDE. ``claude-api`` stays because
-an Anthropic key IS a brain — the row is the API, not Claude Code.
+Two kinds of row, and the difference is who pays and who runs the loop:
+
+``brain``
+ An API key. Jarvis thinks with that provider's model — the router, the
+ tools, the memory, all of it (:mod:`runner_brain`). Billed per token.
+
+``claude-cli`` / ``codex-cli`` / ``agy-cli`` / ``grok-cli``
+ A SUBSCRIPTION seat (Claude Max, ChatGPT, Antigravity, Grok). The vendor
+ CLI runs the loop — that is what a subscription pays for — but inside the
+ Jarvis harness (:mod:`jarvis_harness`): it gets Jarvis' own tools over MCP
+ and a preamble telling it whose hands those are, so it acts as Jarvis and
+ not as a coding assistant that happens to sit in this folder.
+
+Both are offered because both are worth having: the subscription costs
+nothing per turn, the API keys reach models no CLI exposes.
Rows are shown whether or not a credential is saved: one without a key is
disabled with a "connect" hint that leads to the API-Keys page, so the person
@@ -32,9 +42,11 @@ from typing import Any, Final, Literal
from jarvis.agent_chat.effort import default_effort, effort_levels
from jarvis.brain.model_catalog import CURATED_MODELS
-#: One runner answers on this surface: Jarvis' brain. The string is what
-#: ``turn_started`` reports and what the permission/effort ladders key on.
-Runner = Literal["brain"]
+#: ``brain`` = Jarvis thinks with this provider's model (runner_brain).
+#: The ``*-cli`` runners are the subscription seats: a vendor CLI driven
+#: non-interactively INSIDE the Jarvis harness (runner_cli + jarvis_harness),
+#: so the model works with Jarvis' own tools and answers as Jarvis.
+Runner = Literal["brain", "claude-cli", "codex-cli", "agy-cli", "grok-cli"]
@dataclass(frozen=True, slots=True)
@@ -148,12 +160,47 @@ PROVIDER_ROWS: Final[tuple[ProviderRow, ...]] = (
id="claude-api",
label="Anthropic Claude",
family="claude",
- runner="brain",
+ runner="claude-cli",
models_source="curated",
curated_models=_curated("claude-api"),
default_model="",
native_resume=True,
),
+ ProviderRow(
+ id="openai-codex",
+ label="OpenAI Codex",
+ family="openai",
+ runner="codex-cli",
+ models_source="curated",
+ # Codex's OWN catalog, not the OpenAI API's: the route replaces this
+ # with the account's live list from ``models_cache.json``.
+ curated_models=CODEX_FALLBACK_MODELS,
+ default_model="",
+ native_resume=True,
+ ),
+ ProviderRow(
+ id="antigravity",
+ label="Antigravity",
+ family="antigravity",
+ runner="agy-cli",
+ models_source="curated",
+ # agy's OWN ids (not the Gemini API's): the route replaces this with
+ # the live ``agy models`` list when the binary answers.
+ curated_models=tuple(
+ CuratedModel(mid, label, efforts) for mid, label, efforts in _agy_fallback_models()
+ ),
+ default_model="",
+ native_resume=True,
+ ),
+ ProviderRow(
+ id="grok-build",
+ label="Grok Build",
+ family="xai",
+ runner="grok-cli",
+ models_source="curated",
+ curated_models=_curated("grok"),
+ default_model="",
+ ),
ProviderRow(id="openai", label="OpenAI", family="openai", runner="brain", models_source="live"),
ProviderRow(
id="gemini", label="Google Gemini", family="gemini", runner="brain", models_source="live"
diff --git a/jarvis/agent_chat/runner_api.py b/jarvis/agent_chat/runner_api.py
index e7eec55328..33e347cd5f 100644
--- a/jarvis/agent_chat/runner_api.py
+++ b/jarvis/agent_chat/runner_api.py
@@ -139,6 +139,11 @@ class TurnHandle:
cancel: asyncio.Event
history: list[dict[str, Any]] = field(default_factory=list)
assistant_name: str = "Jarvis"
+ #: The app's event bus, when there is one. The brain runner watches it for
+ #: the turn's own steps — the tools Jarvis reached for and why — so the
+ #: timeline shows the work instead of a spinner. ``None`` in tests and in
+ #: any build without a bus; the turn then simply has no step rows.
+ bus: Any | None = None
# ------------------------------------------------------------ history
diff --git a/jarvis/agent_chat/runner_brain.py b/jarvis/agent_chat/runner_brain.py
index fb5f1e5024..2b0704ee7c 100644
--- a/jarvis/agent_chat/runner_brain.py
+++ b/jarvis/agent_chat/runner_brain.py
@@ -93,6 +93,150 @@ async def apply_pick(brain: Any, provider: str, model: str) -> str:
return ""
+class _StepMirror:
+ """Turns the brain's bus events into the timeline's own step rows.
+
+ The brain does not report its work to the chat; it publishes it on the app
+ bus, which is where the voice lane and the classic chat column read it from
+ too (``jarvis/state/turn_trace.py`` keeps the same set for the archive).
+ This subscribes for the length of one turn and translates:
+
+ * ``ActionProposed`` -> a tool row, plus its ``rationale`` as the reasoning
+ text. That sentence is the model's OWN words for why it is about to
+ reach for the tool, and it is the honest source for a trace (maintainer,
+ 2026-08-23 — never a second, slower "explain yourself" call).
+ * ``ActionExecuted`` -> that row's result and how long it took. This is
+ Jarvis' real tool path (``jarvis/safety/tool_executor.py``);
+ ``ToolCallStarted`` / ``ToolCallCompleted`` are handled too because other
+ paths publish those instead.
+ * ``BrainTurnCompleted`` -> the receipt (tokens and cost) on the footer.
+
+ Rows are paired in order: a turn runs one tool at a time, so the oldest
+ open call is the one that just closed.
+
+ Read-only and defensive: a malformed event, or an emit that fails, must
+ never reach the brain (AP-18) — a missing row is a cosmetic loss, a raised
+ exception would cost the answer.
+ """
+
+ __slots__ = ("_emit", "_turn_id", "_bus", "_open", "usage", "_seen_text")
+
+ def __init__(self, emit: Any, turn_id: str, bus: Any | None) -> None:
+ self._emit = emit
+ self._turn_id = turn_id
+ self._bus = bus
+ self._open: list[str] = []
+ self.usage: dict[str, Any] = {}
+ self._seen_text: set[str] = set()
+
+ def start(self) -> None:
+ if self._bus is not None and hasattr(self._bus, "subscribe_all"):
+ self._bus.subscribe_all(self._on_event)
+
+ def stop(self) -> None:
+ if self._bus is not None and hasattr(self._bus, "unsubscribe_all"):
+ try:
+ self._bus.unsubscribe_all(self._on_event)
+ except Exception: # noqa: BLE001 — detaching must never raise
+ log.debug("brain runner: could not detach the step mirror", exc_info=True)
+
+ async def _on_event(self, event: Any) -> None:
+ try:
+ await self._translate(event)
+ except Exception: # noqa: BLE001 — AP-18: never leave a subscriber
+ log.debug("brain runner: step mirror skipped an event", exc_info=True)
+
+ async def _open_call(self, tool_name: str, args: Any) -> None:
+ call_id = uuid.uuid4().hex
+ self._open.append(call_id)
+ if isinstance(args, dict):
+ payload_in: Any = args
+ elif args:
+ payload_in = {"arguments": str(args)}
+ else:
+ payload_in = {}
+ await self._emit(
+ "tool_call",
+ {
+ "turn_id": self._turn_id,
+ "call_id": call_id,
+ "name": tool_name,
+ "input": payload_in,
+ },
+ )
+
+ async def _close_call(self, *, ok: bool, output: str, duration_ms: Any) -> None:
+ if not self._open:
+ # A result with no row of its own (another turn's, or a path that
+ # only reports the end) would draw a headless row; drop it.
+ return
+ call_id = self._open.pop(0)
+ await self._emit(
+ "tool_result",
+ {
+ "turn_id": self._turn_id,
+ "call_id": call_id,
+ "output": str(output)[:2000],
+ "is_error": not ok,
+ "duration_ms": int(duration_ms or 0),
+ },
+ )
+
+ async def _translate(self, event: Any) -> None:
+ name = type(event).__name__
+ if name == "ActionProposed":
+ text = (getattr(event, "rationale", "") or "").strip()
+ # The same rationale is published per proposal; show each once.
+ if text and text not in self._seen_text:
+ self._seen_text.add(text)
+ await self._emit("reasoning_delta", {"turn_id": self._turn_id, "text": text})
+ await self._open_call(
+ getattr(event, "tool_name", "") or "tool",
+ getattr(event, "args", None),
+ )
+ return
+ if name == "ActionExecuted":
+ await self._close_call(
+ ok=bool(getattr(event, "success", False)),
+ output=(
+ getattr(event, "error", None) or getattr(event, "output_preview", "") or ""
+ ),
+ duration_ms=getattr(event, "duration_ms", 0),
+ )
+ return
+ if name == "ActionDenied":
+ await self._close_call(
+ ok=False,
+ output=str(getattr(event, "reason", "") or "denied"),
+ duration_ms=0,
+ )
+ return
+ if name == "ToolCallStarted":
+ await self._open_call(
+ getattr(event, "tool_name", "") or "tool",
+ getattr(event, "args_preview", "") or "",
+ )
+ return
+ if name == "ToolCallCompleted":
+ await self._close_call(
+ ok=bool(getattr(event, "success", False)),
+ output=(
+ getattr(event, "error", None) or getattr(event, "output_preview", "") or ""
+ ),
+ duration_ms=getattr(event, "duration_ms", 0),
+ )
+ return
+ if name == "BrainTurnCompleted":
+ for key, attr in (
+ ("input_tokens", "tokens_in"),
+ ("output_tokens", "tokens_out"),
+ ("cost_usd", "cost_usd"),
+ ):
+ value = getattr(event, attr, None)
+ if isinstance(value, int | float) and value:
+ self.usage[key] = value
+
+
async def run_brain_turn(handle: TurnHandle, text: str) -> None:
"""Run one typed turn on Jarvis' brain, streaming it into the timeline."""
started = time.monotonic()
@@ -102,14 +246,17 @@ async def run_brain_turn(handle: TurnHandle, text: str) -> None:
async def emit(kind: str, payload: dict[str, Any]) -> None:
await handle.emit(make_event(kind, payload))
+ mirror = _StepMirror(emit, turn_id, getattr(handle, "bus", None))
+
async def finish(status: str, error: str | None = None) -> None:
+ mirror.stop()
await emit(
"turn_finished",
{
"turn_id": turn_id,
"status": status,
"duration_ms": int((time.monotonic() - started) * 1000),
- "usage": {},
+ "usage": dict(mirror.usage),
"error": error,
},
)
@@ -124,10 +271,11 @@ async def run_brain_turn(handle: TurnHandle, text: str) -> None:
pick_error = await apply_pick(brain, handle.session.provider, handle.session.model)
- # The "thinking" line the timeline shows until the first words arrive. The
- # brain streams its answer but not its reasoning, so the time IS the fact —
- # the same shape a vendor that redacts its thinking gets.
+ # The "thinking" line the timeline shows until the first words arrive, and
+ # the watcher that fills it: from here on, every tool Jarvis reaches for and
+ # every sentence it writes next to one lands in the timeline as it happens.
await emit("reasoning_started", {"turn_id": turn_id, "message_id": message_id})
+ mirror.start()
loop = asyncio.get_running_loop()
seen = ""
diff --git a/jarvis/agent_chat/service.py b/jarvis/agent_chat/service.py
index 85e7b82b2b..abb8141f5d 100644
--- a/jarvis/agent_chat/service.py
+++ b/jarvis/agent_chat/service.py
@@ -8,11 +8,17 @@ approval card. Cancel sets the turn's event and awaits the task; a runner
that is mid-tool or mid-stream ends at the next boundary (the API loop
between deltas, the CLI by killing the child).
-Every turn runs on :mod:`runner_brain` — Jarvis' own brain, with the picked
-provider and model applied to it. That is what this surface IS: the assistant,
-typed at instead of spoken to. The CLI and API runners stay in the package for
-the sub-agent paths that drive a vendor CLI; nothing on the chat surface
-reaches them any more (maintainer, 2026-08-24). The runner is recorded in
+The runner is picked per turn from the provider row, and either way the
+answer is JARVIS — the difference is only who runs the loop and who pays:
+
+* an API-key row runs :mod:`runner_brain`: Jarvis' own brain thinks with that
+ provider's model, billed per token;
+* a subscription row runs :mod:`runner_cli`: the vendor CLI drives the loop
+ (that is what a Claude Max / ChatGPT / Antigravity seat pays for) inside the
+ Jarvis harness, so it works with Jarvis' tools and answers as Jarvis.
+
+``claude-api`` is the dual row: Claude Code when the binary is on PATH, the
+brain on the Anthropic key otherwise. The choice is recorded in
``turn_started`` so the timeline can say what answered.
"""
@@ -20,6 +26,7 @@ from __future__ import annotations
import asyncio
import logging
+import shutil
import uuid
from collections.abc import Callable
from pathlib import Path
@@ -32,6 +39,7 @@ from jarvis.agent_chat.permissions import normalize_permission
from jarvis.agent_chat.runner_api import TurnHandle
from jarvis.agent_chat.runner_brain import RUNNER as BRAIN_RUNNER
from jarvis.agent_chat.runner_brain import run_brain_turn
+from jarvis.agent_chat.runner_cli import run_cli_turn, supports_cli_runner
from jarvis.agent_chat.store import AgentChatSession, AgentChatStore
log = logging.getLogger(__name__)
@@ -49,14 +57,21 @@ class NoSuchSession(KeyError):
def resolve_runner(provider: str) -> str:
- """Which runner answers for ``provider`` — on this surface, always the brain.
+ """Which runner answers for ``provider`` on this machine, right now.
- The pick names the MODEL Jarvis thinks with, not a different assistant, so
- there is one runner: :mod:`runner_brain`. A provider that cannot be a brain
- (a subscription coding CLI) is not offered by the catalog at all, and the
- runner reports it as the turn's error if one ever arrives.
+ ``claude-api`` is dual: Claude Code (the CLI) when it is installed — the
+ subscription path, no per-token cost — else Jarvis' brain on the Anthropic
+ key. Every other row names its runner outright, and an unknown provider
+ falls back to the brain, which reports honestly if it cannot answer.
"""
- return BRAIN_RUNNER
+ row = provider_row(provider)
+ if row is None:
+ return BRAIN_RUNNER
+ if row.id == "claude-api":
+ if shutil.which("claude") or shutil.which("claude.cmd") or shutil.which("claude.exe"):
+ return "claude-cli"
+ return BRAIN_RUNNER
+ return row.runner
class _Running:
@@ -75,8 +90,10 @@ class AgentChatService:
*,
assistant_name: Callable[[], str] | None = None,
default_cwd: Callable[[], str] | None = None,
+ bus: Any | None = None,
) -> None:
self.store = store
+ self._bus = bus
self._assistant_name = assistant_name or (lambda: "Jarvis")
self._default_cwd = default_cwd or (lambda: str(Path.home()))
self._running: dict[str, _Running] = {}
@@ -195,11 +212,17 @@ class AgentChatService:
cancel=cancel,
history=history,
assistant_name=self._assistant_name(),
+ bus=self._bus,
)
async def _body() -> None:
try:
- await run_brain_turn(handle, text)
+ if supports_cli_runner(runner):
+ vendor = await run_cli_turn(handle, text, runner)
+ if vendor and vendor != session.vendor_session:
+ self.store.update_session(session_id, vendor_session=vendor)
+ else:
+ await run_brain_turn(handle, text)
except asyncio.CancelledError:
await self._emit(
session_id,
diff --git a/jarvis/ui/web/agent_chat_routes.py b/jarvis/ui/web/agent_chat_routes.py
index 867dace75b..0768b0e1cc 100644
--- a/jarvis/ui/web/agent_chat_routes.py
+++ b/jarvis/ui/web/agent_chat_routes.py
@@ -192,7 +192,10 @@ async def get_catalog(request: Request) -> dict[str, Any]:
d = row.to_dict()
runner = resolve_runner(row.id)
d["runner"] = runner
- d["cli_installed"] = _cli_installed(runner) if runner != "api" else None
+ # ``None`` = "not a CLI question": an API-key row is connected by its
+ # key, and reporting False there greyed every brain out as "not
+ # installed" (live 2026-08-24).
+ d["cli_installed"] = _cli_installed(runner) if runner.endswith("-cli") else None
# A CLI that publishes its own model list (agy, Codex) overrides the
# curated fallback with what THIS account can actually pick.
if d["cli_installed"] and runner in live_models and live_models[runner]:
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
index 1b4da9fe68..333a6b83c9 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
@@ -61,6 +61,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
const connected = useEventStore((s) => s.connected);
const wsWarming = useEventStore((s) => s.wsWarming);
const setActiveSection = useEventStore((s) => s.setActiveSection);
+ const setApiKeysTab = useEventStore((s) => s.setApiKeysTab);
const pushToast = useEventStore((s) => s.pushToast);
const [restarting, setRestarting] = useState(false);
@@ -143,6 +144,14 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
}
}
+ // A subscription row is connected by LOGGING IN under Sub-agents; an
+ // API-key row by pasting a key under Brain. Sending everyone to the same
+ // page and letting them hunt is what made this link feel broken.
+ function openConnectPage(p: ProviderOption) {
+ setApiKeysTab(providerKind(p) === "cli" ? "subagents" : "brain");
+ setActiveSection("apikeys");
+ }
+
// ---- option lists -------------------------------------------------
// Only what the Agents tab has set up is offered (maintainer, 2026-08-23:
@@ -456,7 +465,7 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
</span>
<button
type="button"
- onClick={() => setActiveSection("apikeys")}
+ onClick={() => openConnectPage(provider)}
className="font-medium text-primary hover:underline"
>
{t("agent_chat.open_api_keys")}
@@ -484,7 +493,11 @@ export type ProviderKind = "cli" | "api" | "local";
export const PROVIDER_KINDS: readonly ProviderKind[] = ["cli", "api", "local"];
export function providerKind(p: { runner: string; keyless: boolean }): ProviderKind {
if (p.keyless) return "local";
- return p.runner === "api" ? "api" : "cli";
+ // "brain" = Jarvis thinks with this provider's model on an API key; anything
+ // else is a vendor CLI on a subscription seat. The runner used to be called
+ // "api" for the first kind, and grouping on that name put every brain under
+ // "Coding CLIs" the day it was renamed (live 2026-08-24).
+ return p.runner === "brain" ? "api" : "cli";
}
/** One compact pick on the composer's bottom row — a pill-sized Combobox. */
diff --git a/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx b/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx
index 241381c524..03a236bda5 100644
--- a/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/home/ChatStage.test.tsx
@@ -149,7 +149,7 @@ describe("ChatStage (agent chat)", () => {
id: "openai",
label: "OpenAI",
family: "openai",
- runner: "api",
+ runner: "brain",
models_source: "live" as const,
curated_models: [],
cli_installed: null,
diff --git a/jarvis/ui/web/frontend/src/store/events.ts b/jarvis/ui/web/frontend/src/store/events.ts
index ccd47fe2a0..4497ba5ade 100644
--- a/jarvis/ui/web/frontend/src/store/events.ts
+++ b/jarvis/ui/web/frontend/src/store/events.ts
@@ -502,6 +502,15 @@ interface EventStore {
setWarming: (warming: boolean) => void;
clearEvents: () => void;
setActiveSection: (s: SectionId) => void;
+ /**
+ * Which tab the API-Keys view should open on, set by whoever sends someone
+ * there. Null once that view has consumed it, so a later visit opens
+ * normally. Without this, "connect this provider" landed on whichever tab
+ * the view defaults to — Realtime, when the voice engine is realtime — and
+ * the key the person came to set was nowhere on screen (live 2026-08-24).
+ */
+ apiKeysTab: string | null;
+ setApiKeysTab: (tab: string | null) => void;
setDetachedViews: (views: SectionId[]) => void;
/**
* Route a visual into the Visualization section and go there.
@@ -585,6 +594,7 @@ export const useEventStore = create<EventStore>((set, get) => ({
voiceReady: false,
connected: false,
wsWarming: true,
+ apiKeysTab: null,
activeSection: initialSectionFromSearch(
typeof window === "undefined" ? "" : window.location.search,
),
@@ -632,6 +642,7 @@ export const useEventStore = create<EventStore>((set, get) => ({
setWarming: (warming) => set({ wsWarming: warming }),
clearEvents: () => set({ events: [] }),
setActiveSection: (s) => set({ activeSection: s }),
+ setApiKeysTab: (tab) => set({ apiKeysTab: tab }),
setDetachedViews: (views) => set({ detachedViews: views }),
requestVisual: (target = "latest") =>
diff --git a/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx b/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
index bddd75b8a1..aeccda59ab 100644
--- a/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
+++ b/jarvis/ui/web/frontend/src/views/ApiKeysView.tsx
@@ -1,6 +1,7 @@
import { useEffect, useRef, useState } from "react";
import { Bot, Brain, KeyRound, Mic, Phone, Radio, SlidersHorizontal, Terminal, Volume2, Wand2 } from "lucide-react";
import { ViewHeader } from "@/views/ChatsView";
+import { useEventStore } from "@/store/events";
import { JarvisAgentSection } from "@/components/JarvisAgentSection";
import { TelephonyPanel } from "@/views/TelephonyView";
import { WikiProviderCard } from "@/views/settings/WikiProviderCard";
@@ -62,8 +63,14 @@ const PIPELINE_TABS: CategoryKey[] = [
"jarvis-key",
"advanced",
];
+// "brain" is in BOTH sets on purpose. Realtime replaces the brain for the
+// SPOKEN turn only — the typed chat always runs the classic brain
+// (agent_chat/runner_brain.py), and so do tools and missions. Hiding the brain
+// key in realtime mode meant "connect this provider" from the chat composer
+// landed on a page where that key was not on screen at all (live 2026-08-24).
const REALTIME_TABS: CategoryKey[] = [
"realtime",
+ "brain",
"computer-use",
"subagents",
"jarvis-key",
@@ -108,7 +115,21 @@ export function ApiKeysView() {
// Reset the selected tab to the mode's first tab whenever the mode changes,
// so switching Pipeline→Realtime never leaves `active` pointing at a tab
// that no longer exists in the new mode (e.g. "tts").
+ // Somebody sent us here for a specific tab ("connect this provider"). That
+ // pick outranks both defaults below, and is consumed so a later visit opens
+ // normally. Declared FIRST so it wins the mount race with them.
+ const pendingTab = useEventStore((s) => s.apiKeysTab);
+ const setApiKeysTab = useEventStore((s) => s.setApiKeysTab);
+ const deepLinked = useRef(false);
+ useEffect(() => {
+ if (!pendingTab) return;
+ deepLinked.current = true;
+ setActive(pendingTab as CategoryKey);
+ setApiKeysTab(null);
+ }, [pendingTab, setApiKeysTab]);
+
useEffect(() => {
+ if (deepLinked.current) return;
setActive(engineMode === "realtime" ? "realtime" : "brain");
}, [engineMode]);
@@ -122,6 +143,12 @@ export function ApiKeysView() {
setEngineMode(liveMode === "realtime" ? "realtime" : "pipeline");
}, [liveMode, liveModeLoading]);
+ // A tab the person clicks themselves takes the wheel back from the link.
+ function pickTab(tab: CategoryKey) {
+ deepLinked.current = false;
+ setActive(tab);
+ }
+
const modeTabs = engineMode === "realtime" ? REALTIME_TABS : PIPELINE_TABS;
// A recommendation row navigates to the tab it talks about. This is VIEW
@@ -152,7 +179,7 @@ export function ApiKeysView() {
}
/>
- <CategoryTabs active={active} onSelect={setActive} health={health} tabs={modeTabs} />
+ <CategoryTabs active={active} onSelect={pickTab} health={health} tabs={modeTabs} />
<div
data-testid="api-keys-provider-scroll"
diff --git a/jarvis/ui/web/server.py b/jarvis/ui/web/server.py
index cee6920295..4e4ac2be34 100644
--- a/jarvis/ui/web/server.py
+++ b/jarvis/ui/web/server.py
@@ -3491,7 +3491,10 @@ class WebServer:
except Exception: # noqa: BLE001 — the name is cosmetic
return "Jarvis"
- return AgentChatService(store, assistant_name=_name)
+ # The bus lets the brain runner mirror the turn's own steps into the
+ # timeline — the tools Jarvis reached for and the sentence it wrote
+ # next to each one — instead of a bare spinner.
+ return AgentChatService(store, assistant_name=_name, bus=self.bus)
async def stop(self) -> None:
self._mic_level_sessions.clear()
diff --git a/tests/unit/agent_chat/test_agent_chat_core.py b/tests/unit/agent_chat/test_agent_chat_core.py
index 91e1cb1e8a..66295bcd07 100644
--- a/tests/unit/agent_chat/test_agent_chat_core.py
+++ b/tests/unit/agent_chat/test_agent_chat_core.py
@@ -55,24 +55,30 @@ def test_normalize_effort_folds_onto_the_nearest_offered_level(provider, picked,
assert effort.normalize_effort(provider, picked) == expected
-def test_every_row_is_a_brain_jarvis_can_actually_think_with():
- """The picker names the MODEL behind the assistant, so every row must be one.
+def test_every_row_names_a_runner_that_can_actually_answer():
+ """Two kinds of row, and neither may promise something it cannot do.
- A subscription coding CLI cannot be a brain (it is an agent loop with no
- chat API, and ``BrainManager.switch`` refuses it), so offering one here
- would be a pick that silently does nothing — the class of bug this whole
- surface was rebuilt to end.
+ An API-key row runs Jarvis' brain with that provider's model. A
+ subscription row runs the vendor CLI inside the Jarvis harness. What must
+ never happen is a row that would try to make a coding CLI the BRAIN —
+ ``BrainManager.switch`` refuses those, so the pick could only ever fail.
"""
from jarvis.brain.manager import SUBAGENT_ONLY_BRAIN_PROVIDERS
- ids = [row.id for row in PROVIDER_ROWS]
- assert ids, "the picker needs rows"
- offered = sorted(set(ids) & SUBAGENT_ONLY_BRAIN_PROVIDERS)
- assert not offered, f"a subagent-only provider is offered as a brain: {offered}"
- assert all(row.runner == "brain" for row in PROVIDER_ROWS)
+ assert PROVIDER_ROWS, "the picker needs rows"
+ for row in PROVIDER_ROWS:
+ assert row.runner in {"brain", "claude-cli", "codex-cli", "agy-cli", "grok-cli"}
+ if row.id in SUBAGENT_ONLY_BRAIN_PROVIDERS:
+ assert row.runner != "brain", f"{row.id} cannot be a brain"
+
+ # The subscription seats are offered — they cost nothing per turn.
+ ids = {row.id for row in PROVIDER_ROWS}
+ assert {"openai-codex", "antigravity", "grok-build"} <= ids
+ # …and so are the API keys, which reach models no CLI exposes.
+ assert {"openai", "gemini", "grok", "openrouter"} <= ids
claude = provider_row("claude-api")
- assert claude is not None, "an Anthropic key is a brain and stays offered"
+ assert claude is not None
d = claude.to_dict()
assert d["effort_levels"] == ["low", "medium", "high", "xhigh", "max"]
assert d["curated_models"], "a curated row needs its list"
diff --git a/tests/unit/agent_chat/test_agent_chat_ladders.py b/tests/unit/agent_chat/test_agent_chat_ladders.py
index a70dd703a1..ed15f16804 100644
--- a/tests/unit/agent_chat/test_agent_chat_ladders.py
+++ b/tests/unit/agent_chat/test_agent_chat_ladders.py
@@ -393,16 +393,16 @@ def test_read_codex_models_reads_the_account_cache(monkeypatch, tmp_path: Path):
assert CODEX_FALLBACK_MODELS[0].id == "gpt-5.6-sol"
-def test_the_coding_clis_are_not_offered_as_brains():
- """Codex / Antigravity / Grok Build left the picker with the runner swap.
-
- They are sub-agents: an agent loop on a subscription seat, with no chat API
- to think with. Their per-model effort ladders still live in effort.py for
- the sub-agent paths that DO drive them.
- """
- for cli in ("antigravity", "openai-codex", "grok-build"):
- assert provider_row(cli) is None, f"{cli} is offered as a brain"
- # The ladders themselves are untouched — the IDE and the missions read them.
+def test_the_coding_clis_keep_their_own_runner_and_ladders():
+ """A subscription row runs its CLI — never the brain — with its own dials."""
+ for cli, runner in (
+ ("antigravity", "agy-cli"),
+ ("openai-codex", "codex-cli"),
+ ("grok-build", "grok-cli"),
+ ):
+ row = provider_row(cli)
+ assert row is not None, f"{cli} is missing from the picker"
+ assert row.runner == runner
assert "low" in effort_levels("antigravity")
diff --git a/tests/unit/agent_chat/test_agent_chat_service.py b/tests/unit/agent_chat/test_agent_chat_service.py
index 1d597d5541..6b6451a398 100644
--- a/tests/unit/agent_chat/test_agent_chat_service.py
+++ b/tests/unit/agent_chat/test_agent_chat_service.py
@@ -127,21 +127,19 @@ def test_a_typed_turn_runs_on_the_brain_with_the_picked_model(tmp_path: Path, br
asyncio.run(scenario())
-def test_a_coding_subagent_cannot_answer_here_and_says_so(tmp_path: Path, brain: FakeBrain):
- """A sub-agent pick is refused with a sentence, not a silent wrong answer."""
+def test_the_brain_runner_refuses_a_coding_subagent_in_words(brain: FakeBrain):
+ """The last line of defence, if a sub-agent ever reaches the brain runner.
+
+ Those rows run their own CLI, so they never get here in practice — but a
+ stale session or a hand-made request must be told, not answered as
+ somebody else.
+ """
async def scenario() -> None:
- svc = AgentChatService(AgentChatStore(":memory:"))
- # The catalog no longer offers one, so build the session past it: what
- # is pinned here is the runner's own guard, the last line of defence.
- session = svc.create_session(provider="grok", cwd=str(tmp_path))
- svc.store.update_session(session.session_id, provider="antigravity")
- q = svc.subscribe(session.session_id)
- await svc.send(session.session_id, "hi")
- events = await _drain(q, "turn_finished")
- finished = events[-1]["payload"]
- assert finished["status"] == "done"
- assert "coding sub-agent" in (finished["error"] or "")
+ from jarvis.agent_chat.runner_brain import apply_pick
+
+ why = await apply_pick(brain, "antigravity", "")
+ assert "coding sub-agent" in why
assert brain.switched == [], "a sub-agent must never become the brain"
asyncio.run(scenario())
@@ -224,9 +222,15 @@ def test_routes_catalog_sessions_and_websocket_snapshot(tmp_path: Path, brain: F
def _exercise_routes(client: TestClient, tmp_path: Path) -> None:
cat = client.get("/api/agent-chat/catalog").json()
ids = [p["id"] for p in cat["providers"]]
- assert "claude-api" in ids and "openai" in ids
- # The subscription coding CLIs are not brains and are not offered.
- assert "openai-codex" not in ids and "antigravity" not in ids
+ # Both kinds are offered: the API keys and the subscription seats.
+ assert {"claude-api", "openai", "openai-codex", "antigravity"} <= set(ids)
+ codex = next(p for p in cat["providers"] if p["id"] == "openai-codex")
+ assert codex["runner"] == "codex-cli"
+ openai = next(p for p in cat["providers"] if p["id"] == "openai")
+ assert openai["runner"] == "brain"
+ # An API-key row is not a CLI question — reporting False there greyed every
+ # brain out as "not installed" (live 2026-08-24).
+ assert openai["cli_installed"] is None
claude = next(p for p in cat["providers"] if p["id"] == "claude-api")
assert claude["effort_levels"][-1] == "max"
assert cat["default_cwd"] == str(tmp_path)