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(chat): the front page's chat runs on API keys, not vendor CLIs

rubenluetke10-beep43c5a2863e2c
diff --git a/docs/architecture-overview.md b/docs/architecture-overview.md
index fb807012a9..24d7127ed5 100644
--- a/docs/architecture-overview.md
+++ b/docs/architecture-overview.md
@@ -120,7 +120,7 @@ Ack-Brain (`jarvis/brain/ack_brain/`) emits a sub-second butler-style preamble b
**Persona / custom system prompt:** the live persona comes from `jarvis/brain/persona_loader.py`. `base_persona_prompt()` returns an editable override (`data/custom_system_prompt.md`, written atomically via the Settings UI / `settings_routes.py`) when present, else the packaged `JARVIS_PERSONA.md`. `load_effective_persona_prompt()` is what the brains call: the base **plus the active mode's character block**. Edits apply on the **next turn** (no restart); `invalidate_cache()` clears the in-process cache. Never hardcode the persona string elsewhere.
-### The typed chat: two surfaces, three runners (2026-08-25)
+### The typed chat: two surfaces, three runners (2026-08-26)
`jarvis/agent_chat/` serves two chats that look the same and mean different
things — every session carries a `surface` (`store.SURFACES`, mirrored in
@@ -128,9 +128,21 @@ Pydantic and TypeScript, parity-tested):
| Surface | What a typed turn is | Runner per seat | Permission ladder |
|---|---|---|---|
-| `"jarvis"` — the front page's Chat section | **Jarvis with a keyboard**: the same assistant the microphone talks to (soul, persona, profile, identity card, memory, wiki, skills, ALL tools through the risk tiers) on the model the composer picked for THIS chat | API-key / local rows → `runner_brain` (`BrainManager.generate` + a `TurnOverride`); subscription CLIs → `runner_cli` with the Jarvis identity | ONE ladder in Claude Code's words — `ask` / `accept-edits` / `bypass` + `plan` — folded onto each CLI's own spelling |
+| `"jarvis"` — the front page's Chat section | **Jarvis with a keyboard**: the same assistant the microphone talks to (soul, persona, profile, identity card, memory, wiki, skills, ALL tools through the risk tiers) on the model the composer picked for THIS chat | EVERY seat → `runner_brain` (`BrainManager.generate` + a `TurnOverride`). No CLI seats at all (`SurfaceKit.cli_seats = False`) | ONE ladder in Claude Code's words — `ask` / `accept-edits` / `bypass` + `plan` |
| `"agent"` — the Agentic IDE's chat mode | a plain coding-agent session in a folder | `runner_api` (tool loop) or a plain `runner_cli` | the vendor's own ladder |
+**Which providers a surface may be seated on** is `catalog.rows_for(surface)`,
+and it gates on the capability, never on a name (AP-21): a surface with CLI
+seats gets every row; one without gets only the rows a brain plugin drives
+(`runner_api.BRAIN_BY_PROVIDER`). The front page is the second case
+(maintainer, 2026-08-26) — one pipeline, one place the model is picked, one
+usage ledger, and a model change is a `TurnOverride` rather than a different
+vendor process. Its `claude-api` row therefore always resolves to the
+Anthropic endpoint, Claude Code installed or not. Chats seated on a CLI
+before the change move to the API row of the same brand once per database
+(`service._retire_cli_seats`, marked by SQLite's `user_version`), keeping
+their transcript and dropping only a model id the endpoint cannot take.
+
**The per-turn override contract (binding).** A chat's pick of provider /
model / effort NEVER moves the live brain: `BrainManager.generate(turn_override=…)`
carries it in a ContextVar (`jarvis/brain/turn_override.py`), read in exactly
@@ -159,9 +171,14 @@ handler) turns the stance into a decision: `ask` cards everything consequential,
gate itself; `plan` offers reading hands only. The blacklist is never reached
from here in any stance.
-**A CLI seat as Jarvis.** A subscription CLI keeps its own loop (that is what
-the subscription pays for; only the vendor's official binary spends it) but
-runs with Jarvis' head: `BrainManager.render_surface_prompt` renders the
+**A CLI seat as Jarvis** (built, currently unreachable). No surface seats a
+CLI as Jarvis any more — the front page dropped its CLI seats on 2026-08-26
+and the IDE's chat runs a plain coding agent — so `run_cli_turn(identity=…)`
+is False on every turn today. The machinery stays wired to the kit
+(`kit.brain_runner and kit.cli_seats`) rather than to a surface name, so a
+surface that wants both works without a rebuild. How it works, when reached:
+a subscription CLI keeps its own loop (that is what the subscription pays
+for; only the vendor's official binary spends it) but runs with Jarvis' head: `BrainManager.render_surface_prompt` renders the
voice turn's prompt layers read-only, `jarvis_harness.build_identity` adds the
chat's transcript on a fresh conversation and the surface addendum, and each
CLI takes it the way it can (Claude Code: `--append-system-prompt-file`; Codex
diff --git a/jarvis/agent_chat/__init__.py b/jarvis/agent_chat/__init__.py
index c3a49d8298..650adfbad3 100644
--- a/jarvis/agent_chat/__init__.py
+++ b/jarvis/agent_chat/__init__.py
@@ -5,12 +5,14 @@ One package, two surfaces (``store.SURFACES``):
* ``"jarvis"`` — the front page's chat. What you type is input to Jarvis:
the same assistant the microphone talks to, on the model the composer
picked for THIS chat (:mod:`.runner_brain` — ``BrainManager.generate``
- with a per-turn override; the live voice brain is never switched). A
- subscription CLI seat (Claude Code, Codex, …) runs as Jarvis through
- :mod:`.runner_cli` + :mod:`.jarvis_harness`, so the subscription pays.
- The folder chip is Jarvis' working folder (:mod:`.folder_tools`), and the
- one permission ladder — Ask / Auto-accept edits / Bypass, plus Plan —
- decides what asks through a clickable card (:mod:`.approval_bridge`).
+ with a per-turn override; the live voice brain is never switched). Every
+ seat here is a provider API behind a key — no vendor CLI runs this chat
+ (``surface_kits.SurfaceKit.cli_seats``, maintainer 2026-08-26), so one
+ pipeline answers, one place picks the model and one ledger counts the
+ cost. The folder chip is Jarvis' working folder (:mod:`.folder_tools`),
+ and the one permission ladder — Ask / Auto-accept edits / Bypass, plus
+ Plan — decides what asks through a clickable card
+ (:mod:`.approval_bridge`).
* ``"agent"`` — a plain coding-agent session in a folder, the Claude Code
shape, which the Agentic IDE's chat mode runs: a vendor CLI or the API tool
loop, with the vendor's own permission ladder.
@@ -20,7 +22,8 @@ The pieces:
* :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);
+ family, curated model lists for the CLI-backed providers) and which of
+ them each surface may be seated on (``rows_for``);
* :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
diff --git a/jarvis/agent_chat/catalog.py b/jarvis/agent_chat/catalog.py
index cbd6bc3ffd..8f5b92319a 100644
--- a/jarvis/agent_chat/catalog.py
+++ b/jarvis/agent_chat/catalog.py
@@ -29,14 +29,21 @@ Two kinds of runner sit behind the rows:
the Jarvis surface (the front page's chat), where the typed turn is
Jarvis rather than a coding agent.
-``claude-api`` is the one dual row: with a Claude subscription login the
-``claude`` CLI runs the session (Claude Code proper — tools, skills, the
-Max plan's included usage); with only an Anthropic API key the API runner
-does (the brain runner on the Jarvis surface). The route decides per request
-by probing; this module only carries the static shape.
+``claude-api`` is the one dual row: on a surface with CLI seats, a Claude
+subscription login makes the ``claude`` CLI run the session (Claude Code
+proper — tools, skills, the Max plan's included usage); otherwise the
+Anthropic API answers, through the API runner or the brain one. The route
+decides per request by probing; this module only carries the static shape.
+
+Not every row reaches every surface: a surface whose kit has no CLI seats
+(``SurfaceKit.cli_seats``, the front page's chat) is offered only the rows
+with a brain plugin behind them — :func:`rows_for` is the one place that
+narrowing happens, and it gates on the capability, never on a provider name
+(AP-21).
Presentation data only — nothing here decides behaviour (AP-21); the rows
exist so the picker can show a provider before a key is typed.
+
"""
from __future__ import annotations
@@ -252,3 +259,56 @@ def provider_row(provider_id: str) -> ProviderRow | None:
def known_provider_ids() -> tuple[str, ...]:
return tuple(row.id for row in PROVIDER_ROWS)
+
+
+def rows_for(surface: str) -> tuple[ProviderRow, ...]:
+ """The rows ``surface`` may pick from.
+
+ A surface with CLI seats sees all of them. One without (the front page's
+ chat) sees only the rows a brain plugin can drive — the providers whose
+ own API answers behind a key, so the turn runs through Jarvis' harness
+ and its model pick is one ``TurnOverride`` rather than a vendor process.
+ Decided by asking the runner whether it can drive the provider at all,
+ never from a list of names (AP-21).
+ """
+ from jarvis.agent_chat.surface_kits import kit_for
+
+ if kit_for(surface).cli_seats:
+ return PROVIDER_ROWS
+ from jarvis.agent_chat.runner_api import supports_api_runner
+
+ return tuple(row for row in PROVIDER_ROWS if supports_api_runner(row.id))
+
+
+def offers(surface: str, provider_id: str) -> bool:
+ """Whether ``provider_id`` is one of ``surface``'s rows."""
+ pid = (provider_id or "").strip().lower()
+ return any(row.id == pid for row in rows_for(surface))
+
+
+#: A CLI-only row and the API row of the same brand. A chat that was seated
+#: on a vendor CLI before the front page dropped its CLI seats moves across
+#: this map instead of being stranded on a provider its picker no longer
+#: lists — same brand, same key page, now the provider's own endpoint.
+API_TWIN: Final[dict[str, str]] = {
+ "openai-codex": "openai",
+ "antigravity": "gemini",
+ "grok-build": "grok",
+}
+
+
+def api_seat(provider: str, model: str) -> tuple[str, str]:
+ """Where a CLI-seated ``(provider, model)`` lands on an API-only surface.
+
+ The provider moves to its API twin; the model is kept only when the
+ provider's own catalog knows it. A CLI's model ids are the CLI's own —
+ ``opusplan``, ``best``, ``claude-opus-5[1m]``, ``gpt-5.6-sol`` as Codex
+ spells it — and sending one to the provider's endpoint is an error, not
+ a near miss. An unknown id therefore becomes ``""``: the provider's
+ default, which the picker shows as "Default" and the person can change
+ in one click.
+ """
+ pid = (provider or "").strip().lower()
+ seat = API_TWIN.get(pid, pid)
+ known = {m.id for m in CURATED_MODELS.get(seat, ())}
+ return seat, (model if model in known else "")
diff --git a/jarvis/agent_chat/jarvis_harness.py b/jarvis/agent_chat/jarvis_harness.py
index cf1a9da8fc..6d23827012 100644
--- a/jarvis/agent_chat/jarvis_harness.py
+++ b/jarvis/agent_chat/jarvis_harness.py
@@ -25,6 +25,12 @@ official binary ever spends the subscription (maintainer, 2026-08-25).
This surface is deliberately additive: a CLI that cannot mount MCP servers, an
app whose tool gateway is not up yet, or a brain that has not finished building
simply runs with less. Nothing here is allowed to make a turn fail.
+
+Currently unreachable, on purpose. No surface seats a CLI as Jarvis since the
+front page's chat went API-only (2026-08-26, ``SurfaceKit.cli_seats``), so
+``run_cli_turn(identity=…)`` is False on every turn today. The service asks the
+kit — ``brain_runner and cli_seats`` — rather than a surface name, so a surface
+that wants both picks this up without a change here. Keep it working.
"""
from __future__ import annotations
diff --git a/jarvis/agent_chat/runner_brain.py b/jarvis/agent_chat/runner_brain.py
index 450941fcaa..3163f5b032 100644
--- a/jarvis/agent_chat/runner_brain.py
+++ b/jarvis/agent_chat/runner_brain.py
@@ -1,11 +1,12 @@
"""The Jarvis surface's runner: Jarvis' own brain, driven by text.
-This is what the front page's chat runs on for an API-key or local seat. A
-typed turn is the same turn a spoken one is — ``BrainManager.generate`` with
-its router, its tools, its memory, its wiki and its safety tiers — with the
-keyboard in place of the microphone. Nothing here spawns a coding CLI or a
-second agent loop; there is one assistant in this app and this is how you
-type at it (maintainer, 2026-08-25).
+This is what the front page's chat runs on — every seat of it, since that
+surface gave up its CLI seats (2026-08-26): a provider API behind a key, or
+a server on this machine. A typed turn is the same turn a spoken one is —
+``BrainManager.generate`` with its router, its tools, its memory, its wiki
+and its safety tiers — with the keyboard in place of the microphone. Nothing
+here spawns a coding CLI or a second agent loop; there is one assistant in
+this app and this is how you type at it (maintainer, 2026-08-25).
What the composer's pick changes is which model Jarvis thinks with FOR THIS
CHAT, and how hard: provider, model and effort travel as a
diff --git a/jarvis/agent_chat/service.py b/jarvis/agent_chat/service.py
index dee39299d9..e2c53689fa 100644
--- a/jarvis/agent_chat/service.py
+++ b/jarvis/agent_chat/service.py
@@ -25,18 +25,23 @@ import shutil
import uuid
from collections.abc import Callable
from pathlib import Path
-from typing import Any
+from typing import Any, Final
from jarvis.agent_chat import attachments as chat_attachments
from jarvis.agent_chat.approval_bridge import ChatApprovalBridge
-from jarvis.agent_chat.catalog import provider_row
+from jarvis.agent_chat.catalog import PROVIDER_ROWS, api_seat, offers, provider_row
from jarvis.agent_chat.effort import normalize_effort
from jarvis.agent_chat.events import make_event
from jarvis.agent_chat.permissions import ladder_key, normalize_permission
from jarvis.agent_chat.runner_api import TurnHandle, run_api_turn, supports_api_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 DEFAULT_SURFACE, AgentChatSession, AgentChatStore
+from jarvis.agent_chat.store import (
+ DEFAULT_SURFACE,
+ SURFACES,
+ AgentChatSession,
+ AgentChatStore,
+)
from jarvis.agent_chat.surface_kits import kit_for
log = logging.getLogger(__name__)
@@ -66,15 +71,21 @@ def resolve_runner(provider: str, *, surface: str = "agent") -> str:
On the Jarvis surface the API path is Jarvis' own brain (``brain``): the
same set of providers, driven by ``BrainManager.generate`` instead of the
- coding agent's tool loop. The CLI seats keep their CLI runner there — a
- subscription only pays for the vendor's own loop — and run as Jarvis
- (see :mod:`jarvis.agent_chat.jarvis_harness`).
+ coding agent's tool loop. That surface has no CLI seats at all
+ (``SurfaceKit.cli_seats``, maintainer 2026-08-26), so a vendor CLI never
+ answers there — not even the dual Claude row, which runs on the Anthropic
+ API behind its key like every other seat.
"""
kit = kit_for(surface)
api_runner = "brain" if kit.brain_runner else "api"
row = provider_row(provider)
if row is None:
return api_runner if supports_api_runner(provider) else "unknown"
+ if not kit.cli_seats:
+ # No vendor process here: the provider's own API answers, or nothing
+ # does. ``rows_for`` keeps the picker to the same set, so "unknown"
+ # is only reachable through a stale session or a hand-made request.
+ return api_runner if supports_api_runner(row.id) else "unknown"
if row.id == "claude-api":
return "claude-cli" if _claude_cli_installed() else api_runner
if row.runner == "api":
@@ -82,6 +93,13 @@ def resolve_runner(provider: str, *, surface: str = "agent") -> str:
return row.runner
+#: ``AgentChatStore.data_version`` after the front page's chat gave up its
+#: CLI seats (2026-08-26) and its sessions moved to the API row of the same
+#: brand. Bump — and add a branch in ``_retire_cli_seats``' caller — only for
+#: another migration that rewrites what a person picked.
+_CLI_SEATS_RETIRED: Final[int] = 1
+
+
class _Running:
__slots__ = ("task", "cancel", "turn_id")
@@ -124,6 +142,45 @@ class AgentChatService:
# no word for "auto" and flipping to bypass would silence every later
# card, a mail send included.
self._always_allowed: dict[str, set[str]] = {}
+ self._retire_cli_seats()
+
+ def _retire_cli_seats(self) -> None:
+ """Move chats off a CLI seat their surface no longer offers.
+
+ The front page's chat runs on provider APIs only (``cli_seats``).
+ A session opened before that — a Codex or Antigravity seat, or a
+ Claude one carrying a Claude Code model id — would otherwise show a
+ provider its own picker does not list, or send the endpoint a model
+ name only the CLI understands. It moves to the API row of the same
+ brand instead (``catalog.api_seat``), keeping its title, its folder,
+ its permission mode and its whole transcript.
+
+ Once per database, not once per boot (``data_version``): it rewrites
+ a pick, and a pick made afterwards — a live model id the curated
+ list does not carry — must survive every later start untouched.
+ """
+ if self.store.data_version() >= _CLI_SEATS_RETIRED:
+ return
+ for surface in SURFACES:
+ if kit_for(surface).cli_seats:
+ continue
+ for row in PROVIDER_ROWS:
+ # Rows that were always an API seat have nothing to migrate.
+ if row.runner == "api":
+ continue
+ for session in self.store.sessions_on(surface, row.id):
+ provider, model = api_seat(session.provider, session.model)
+ if (provider, model) == (session.provider, session.model):
+ continue
+ self.store.reseat_session(session.session_id, provider=provider, model=model)
+ log.info(
+ "agent chat: %s left the %s CLI seat for %s %s",
+ session.session_id,
+ row.id,
+ provider,
+ f"({model})" if model else "(its default model)",
+ )
+ self.store.set_data_version(_CLI_SEATS_RETIRED)
# ------------------------------------------------------------ sessions
@@ -173,6 +230,11 @@ class AgentChatService:
row = provider_row(provider)
if row is None and not supports_api_runner(provider):
raise ValueError(f"Unknown agent-chat provider: {provider!r}")
+ if row is not None and not offers(surface, provider):
+ raise ValueError(
+ f"Provider {provider!r} is not offered on the {surface!r} chat. "
+ "That chat runs on a provider API behind a key, not on a vendor CLI."
+ )
ladder = ladder_key(surface, resolve_runner(provider, surface=surface))
permission_mode = normalize_permission(ladder, permission_mode)
eff = normalize_effort(provider, effort) if effort is not None else ""
@@ -248,6 +310,7 @@ class AgentChatService:
raise NoSuchSession(session_id)
if self.is_running(session_id):
raise SessionBusy(session_id)
+ kit = kit_for(session.surface)
text = text.strip()
attached = chat_attachments.to_analysis(attachments)
if not text and not attached:
@@ -327,7 +390,7 @@ class AgentChatService:
assistant_name=self._assistant_name(),
bus=bus,
surface=session.surface,
- stance=session.permission_mode if kit_for(session.surface).uses_stance else "",
+ stance=session.permission_mode if kit.uses_stance else "",
)
async def _body() -> None:
@@ -341,12 +404,20 @@ class AgentChatService:
always_allowed=self.always_allowed(session_id),
)
elif supports_cli_runner(runner):
+ # A CLI runs AS Jarvis — its own tools over MCP, its calls
+ # answered by the chat's approval card — only where the
+ # surface both is Jarvis and seats a CLI at all. The front
+ # page is the first and the second is now false there, so
+ # today this is every CLI turn running as a plain coding
+ # agent. Asked of the kit rather than the surface name, so
+ # a surface that combines the two keeps working.
+ as_jarvis = kit.brain_runner and kit.cli_seats
vendor = await run_cli_turn(
handle,
text,
runner,
- identity=(session.surface == "jarvis"),
- bridge=self._bridge_for(bus) if session.surface == "jarvis" else None,
+ identity=as_jarvis,
+ bridge=self._bridge_for(bus) if as_jarvis else None,
always_allowed=self.always_allowed(session_id),
)
if vendor and vendor != session.vendor_session:
diff --git a/jarvis/agent_chat/store.py b/jarvis/agent_chat/store.py
index df7f73d373..b99bb8a562 100644
--- a/jarvis/agent_chat/store.py
+++ b/jarvis/agent_chat/store.py
@@ -227,6 +227,49 @@ class AgentChatStore:
self._conn.commit()
return self.get_session(session_id)
+ def data_version(self) -> int:
+ """How many one-shot data migrations this file has already had.
+
+ Schema changes are idempotent (``_migrate`` adds missing columns);
+ a DATA migration is not — it rewrites what someone picked, so it has
+ to run exactly once. SQLite's own ``user_version`` is the marker.
+ """
+ with self._lock:
+ row = self._conn.execute("PRAGMA user_version").fetchone()
+ return int(row[0]) if row else 0
+
+ def set_data_version(self, version: int) -> None:
+ with self._lock:
+ # PRAGMA takes no bound parameter; the value is an int by signature.
+ self._conn.execute(f"PRAGMA user_version = {int(version)}")
+ self._conn.commit()
+
+ def sessions_on(self, surface: str, provider: str) -> list[AgentChatSession]:
+ """Every session of ``surface`` currently seated on ``provider``."""
+ with self._lock:
+ rows = self._conn.execute(
+ "SELECT * FROM agent_chat_sessions WHERE surface = ? AND provider = ?",
+ (surface, provider),
+ ).fetchall()
+ return [self._row_to_session(row) for row in rows]
+
+ def reseat_session(self, session_id: str, *, provider: str, model: str) -> None:
+ """Move a session onto another provider, leaving ``updated_ms`` alone.
+
+ For migrations, not for the composer: the chat list is ordered by
+ that timestamp, and re-seating everyone's history because the runner
+ behind a surface changed would shuffle it to the top for no reason
+ the person did. The vendor session id goes with it — it belongs to
+ the CLI conversation this session is leaving.
+ """
+ with self._lock:
+ self._conn.execute(
+ "UPDATE agent_chat_sessions SET provider = ?, model = ?, vendor_session = '' "
+ "WHERE session_id = ?",
+ (provider, model, session_id),
+ )
+ self._conn.commit()
+
def delete_session(self, session_id: str) -> bool:
with self._lock:
cur = self._conn.execute(
diff --git a/jarvis/agent_chat/surface_kits.py b/jarvis/agent_chat/surface_kits.py
index 2535c9fbde..7e7fd711a7 100644
--- a/jarvis/agent_chat/surface_kits.py
+++ b/jarvis/agent_chat/surface_kits.py
@@ -44,6 +44,11 @@ class SurfaceKit:
``brain_runner``
Whether an API provider is driven by Jarvis' own brain (``brain``)
instead of the coding agent's loop (``api``).
+ ``cli_seats``
+ Whether a vendor CLI may run a turn here. ``False`` means every seat
+ on this surface is an API endpoint behind a key: the picker lists
+ only providers with a brain plugin, and the CLI rows (Claude Code,
+ Codex, Antigravity, Grok Build) are not offered at all.
``ladder``
The permission ladder the composer shows, or ``None`` for the
runner's own ladder.
@@ -65,6 +70,7 @@ class SurfaceKit:
surface: str
brain_runner: bool = False
+ cli_seats: bool = True
ladder: str | None = None
uses_stance: bool = False
tools: ToolsBuilder | None = None
@@ -97,6 +103,12 @@ _KITS: Final[dict[str, SurfaceKit]] = {
"jarvis": SurfaceKit(
surface="jarvis",
brain_runner=True,
+ # No vendor CLI here (maintainer, 2026-08-26). What answers on the
+ # front page is Jarvis' own harness on a provider API behind a key —
+ # one pipeline, one place the model is picked, one usage ledger. A
+ # subscription CLI seat is a coding agent and belongs to the IDE's
+ # chat, where its own loop and its own tools are the point.
+ cli_seats=False,
ladder=_JARVIS_LADDER,
uses_stance=True,
# Not the home directory: this surface hands out the folder tools, and
diff --git a/jarvis/ui/web/agent_chat_routes.py b/jarvis/ui/web/agent_chat_routes.py
index accbb0de68..f1aac873a0 100644
--- a/jarvis/ui/web/agent_chat_routes.py
+++ b/jarvis/ui/web/agent_chat_routes.py
@@ -44,7 +44,7 @@ from fastapi import (
from pydantic import BaseModel, Field
from jarvis.agent_chat import attachments as chat_attachments
-from jarvis.agent_chat.catalog import CLAUDE_CODE_MODELS, PROVIDER_ROWS
+from jarvis.agent_chat.catalog import CLAUDE_CODE_MODELS, offers, rows_for
from jarvis.agent_chat.effort import normalize_effort
from jarvis.agent_chat.events import make_event
from jarvis.agent_chat.permissions import (
@@ -61,6 +61,7 @@ from jarvis.agent_chat.service import (
SessionBusy,
resolve_runner,
)
+from jarvis.agent_chat.surface_kits import kit_for
from jarvis.agent_chat.tools import shell_label
log = logging.getLogger(__name__)
@@ -217,11 +218,16 @@ async def get_catalog(request: Request, surface: SurfaceName = "agent") -> dict[
— the picker reads it from ``/api/jarvis-agent/status`` like the Agents
tab, so the two never disagree. On the Jarvis surface every row shows the
one Jarvis ladder (``permissions.JARVIS_LADDER``).
+
+ Which rows a surface gets is ``catalog.rows_for``: the front page's chat
+ has no CLI seats, so it is offered only the providers whose own API a
+ brain plugin drives — and no CLI is probed for its model list either.
"""
svc = _service(request)
rows: list[dict[str, Any]] = []
- live_models = await _live_cli_models()
- for row in PROVIDER_ROWS:
+ cli_seats = kit_for(surface).cli_seats
+ live_models = await _live_cli_models() if cli_seats else {}
+ for row in rows_for(surface):
d = row.to_dict()
runner = resolve_runner(row.id, surface=surface)
d["runner"] = runner
@@ -231,7 +237,8 @@ async def get_catalog(request: Request, surface: SurfaceName = "agent") -> dict[
if d["cli_installed"] and runner in live_models and live_models[runner]:
d["curated_models"] = live_models[runner]
# The dual row: Claude Code takes its own ids and aliases; with only
- # an API key the Anthropic catalog route lists the models live.
+ # an API key — and on a surface with no CLI seats, always — the
+ # Anthropic catalog route lists the models live.
if row.id == "claude-api":
if runner == "claude-cli":
d["curated_models"] = [m.to_dict() for m in CLAUDE_CODE_MODELS]
@@ -317,13 +324,20 @@ async def patch_session(
session_id: str, body: PatchSessionBody, request: Request
) -> dict[str, Any]:
svc = _service(request)
- if svc.store.get_session(session_id) is None:
+ existing = svc.store.get_session(session_id)
+ if existing is None:
raise HTTPException(status_code=404, detail="session not found")
fields: dict[str, Any] = {}
if body.title is not None:
fields["title"] = body.title.strip()[:120]
if body.provider is not None:
- fields["provider"] = body.provider.strip().lower()
+ picked = body.provider.strip().lower()
+ if not offers(existing.surface, picked):
+ raise HTTPException(
+ status_code=400,
+ detail=f"provider {picked!r} is not offered on the {existing.surface!r} chat",
+ )
+ fields["provider"] = picked
# A provider change resets the vendor conversation: the new CLI cannot
# resume the old one's id.
fields["vendor_session"] = ""
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
index eb64dae80c..4a153121d7 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx
@@ -20,7 +20,7 @@ import { useAgentChat, useAgentChatApi } from "@/components/agentchat/AgentChatS
import type { ProviderOption } from "@/store/agentChat";
import { useEventStore } from "@/store/events";
import { folderLeaf } from "@/lib/folderPath";
-import { pickAgentChatFolder } from "@/lib/agentChatApi";
+import { isApiRunner, pickAgentChatFolder } from "@/lib/agentChatApi";
import { runningTurn } from "@/components/agentchat/reduce";
import { permissionModeIcon } from "@/components/agentchat/permissionIcons";
import { useComposerDictation } from "@/components/agentchat/useComposerDictation";
@@ -43,7 +43,7 @@ import { cn } from "@/lib/utils";
*
* — then dictation and Send on the right. The picks are the backend's
* catalog for this surface, never a list typed here: the provider column is
- * every sub-agent the Agents tab knows (connected ones pickable, the rest
+ * what that surface may be seated on (connected ones pickable, the rest
* greyed with a "connect" hint), the model column is the provider's own list
* (live from its catalog route, or the curated list for a CLI), the effort
* ladder and the permission ladder are whatever the catalog delivers for
@@ -53,6 +53,13 @@ import { cn } from "@/lib/utils";
* Build | Plan is the permission ladder's `plan` entry drawn as a switch,
* shown only when the ladder has one.
*
+ * Which providers a surface offers is the backend's call, not a filter here
+ * (jarvis/agent_chat/catalog.py — `rows_for`): the front page's chat lists
+ * only providers whose own API Jarvis' harness drives, so a turn there is
+ * one `TurnOverride` on one endpoint behind one key (maintainer,
+ * 2026-08-26). The vendor CLIs stay where a vendor CLI is the point — the
+ * IDE's chat mode, a coding agent in a folder.
+ *
* The provider list is grouped the way the Agents tab groups its cards — by
* what stands behind a row, never by whether it is connected: a coding CLI
* signed in with a subscription, a provider's own API behind a key, or a
@@ -653,13 +660,18 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {
* no account. Decided from the catalog's own facts (runner, keyless) — the
* same split the Agents tab draws, so the two never disagree. Claude's dual
* row lands where its resolved runner says: the CLI group when Claude Code
- * answers, the API-key group when only an Anthropic key is saved.
+ * answers, the API-key group when the Anthropic endpoint does.
+ *
+ * `brain` counts as an API seat, not a CLI one: it is Jarvis' own harness
+ * calling that provider's endpoint with that provider's key, which is what
+ * every row on the front page's chat resolves to. Reading it as a CLI put
+ * the whole list under the wrong heading there.
*/
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";
+ return isApiRunner(p.runner) ? "api" : "cli";
}
/** One compact pick on the composer's bottom row — a pill-sized Combobox. */
diff --git a/jarvis/ui/web/frontend/src/lib/agentChatApi.ts b/jarvis/ui/web/frontend/src/lib/agentChatApi.ts
index 20f739b74c..201b7ba2c0 100644
--- a/jarvis/ui/web/frontend/src/lib/agentChatApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/agentChatApi.ts
@@ -86,6 +86,16 @@ export interface AgentChatEvent {
}
/** One row of `GET /api/jarvis-agent/status` — the Agents tab's truth about credentials. */
+/**
+ * Runners that call a provider's own HTTP endpoint: the coding-agent tool
+ * loop (`api`) and Jarvis' own harness (`brain`). Both need an API key for
+ * that provider; the vendor CLIs are the other case, where a subscription
+ * login is the credential and no key exists at all.
+ */
+export function isApiRunner(runner: string): boolean {
+ return runner === "api" || runner === "brain";
+}
+
export interface AgentConnectionRow {
jarvis: string;
label?: string;
diff --git a/jarvis/ui/web/frontend/src/store/agentChat.test.ts b/jarvis/ui/web/frontend/src/store/agentChat.test.ts
index 5c14501e6f..26757da377 100644
--- a/jarvis/ui/web/frontend/src/store/agentChat.test.ts
+++ b/jarvis/ui/web/frontend/src/store/agentChat.test.ts
@@ -1,6 +1,7 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { AgentChatSession } from "@/lib/agentChatApi";
+import { providerKind } from "@/components/agentchat/AgentComposer";
import { createAgentChatStore, draftKey } from "@/store/agentChat";
/**
@@ -135,6 +136,52 @@ describe("agent-chat store surfaces", () => {
vi.unstubAllGlobals();
});
+ it("counts a brain seat as connected only when an API KEY is saved", () => {
+ // The Agents tab calls a Claude Code login "connected" — right for a row
+ // a CLI runs. On the front page's chat the same row is the Anthropic
+ // endpoint, where that login buys nothing, so it must read as unconnected
+ // until a key is there.
+ const row = (runner: string, keyless = false) => ({
+ id: "claude-api",
+ label: "Anthropic Claude",
+ family: "claude",
+ runner,
+ models_source: "live" as const,
+ curated_models: [],
+ default_model: "",
+ keyless,
+ native_resume: true,
+ effort_levels: ["low", "high"],
+ default_effort: "high",
+ permission_modes: [{ id: "ask", label: "ask", description: "" }],
+ default_permission_mode: "ask",
+ cli_installed: null,
+ });
+ const seat = (runner: string, conn: Record<string, unknown>) => {
+ const store = createAgentChatStore("jarvis");
+ store.setState({
+ catalog: { providers: [row(runner)], default_cwd: "C:\work", shell: "pwsh" },
+ connections: [{ jarvis: "claude-api", is_active_brain: false, ...conn }],
+ } as never);
+ return store.getState().providerOptions()[0].connected;
+ };
+ const subscriptionOnly = { key_set: true, api_key_set: false, oauth_connected: true };
+ expect(seat("brain", subscriptionOnly)).toBe(false);
+ expect(seat("api", subscriptionOnly)).toBe(false);
+ // The CLI seat itself is exactly what that login is for.
+ expect(seat("claude-cli", subscriptionOnly)).toBe(true);
+ expect(seat("brain", { key_set: true, api_key_set: true })).toBe(true);
+ // A backend too old to report the finer field still answers as before.
+ expect(seat("brain", { key_set: true })).toBe(true);
+ });
+
+ it("groups a brain seat with the API keys, never with the CLIs", () => {
+ expect(providerKind({ runner: "brain", keyless: false })).toBe("api");
+ expect(providerKind({ runner: "api", keyless: false })).toBe("api");
+ expect(providerKind({ runner: "claude-cli", keyless: false })).toBe("cli");
+ expect(providerKind({ runner: "brain", keyless: true })).toBe("local");
+ });
+
it("names the front page's draft key as it always was, and gives the IDE its own", () => {
expect(draftKey("jarvis")).toBe("jarvis.agentChat.draft.v2");
expect(draftKey("agent")).toBe("jarvis.agentChat.draft.agent.v1");
diff --git a/jarvis/ui/web/frontend/src/store/agentChat.ts b/jarvis/ui/web/frontend/src/store/agentChat.ts
index 5e4a47f94f..e238db8808 100644
--- a/jarvis/ui/web/frontend/src/store/agentChat.ts
+++ b/jarvis/ui/web/frontend/src/store/agentChat.ts
@@ -9,6 +9,7 @@ import {
fetchAgentChatSessions,
fetchAgentConnections,
fetchProviderModels,
+ isApiRunner,
patchAgentChatSession,
resolveAgentChatApproval,
sendAgentChatMessage,
@@ -398,7 +399,16 @@ export function createAgentChatStore(surface: AgentChatSurface) {
if (!catalog) return [];
return catalog.providers.map((p) => {
const row = connectionFor(p, connections);
- const credentialed = p.keyless || Boolean(row?.key_set);
+ // An API seat needs an API KEY, not just any credential. The Agents
+ // tab counts a subscription login as connected — right for a row a
+ // CLI runs — but the brain runner calls the provider's endpoint,
+ // where a Claude Code login buys nothing. `key_set` stands in when
+ // an older backend does not report the finer field.
+ const credentialed = p.keyless
+ ? true
+ : isApiRunner(p.runner)
+ ? Boolean(row?.api_key_set ?? row?.key_set)
+ : Boolean(row?.key_set);
const installed = p.cli_installed === null ? true : p.cli_installed;
return {
...p,
diff --git a/tests/unit/agent_chat/test_agent_chat_core.py b/tests/unit/agent_chat/test_agent_chat_core.py
index 134bd8edb4..3a808caac7 100644
--- a/tests/unit/agent_chat/test_agent_chat_core.py
+++ b/tests/unit/agent_chat/test_agent_chat_core.py
@@ -477,18 +477,93 @@ def test_codex_reasoning_start_is_announced():
def test_resolve_runner_per_surface(monkeypatch):
- """The Jarvis surface runs API-key and local rows on the brain; CLI seats stay CLIs."""
+ """The Jarvis surface is API endpoints only; the agent surface keeps its CLIs."""
from jarvis.agent_chat import service as svc_mod
monkeypatch.setattr(svc_mod, "_claude_cli_installed", lambda: False)
assert svc_mod.resolve_runner("openai") == "api"
assert svc_mod.resolve_runner("openai", surface="jarvis") == "brain"
assert svc_mod.resolve_runner("ollama", surface="jarvis") == "brain"
- assert svc_mod.resolve_runner("openai-codex", surface="jarvis") == "codex-cli"
- assert svc_mod.resolve_runner("antigravity", surface="jarvis") == "agy-cli"
assert svc_mod.resolve_runner("claude-api") == "api"
assert svc_mod.resolve_runner("claude-api", surface="jarvis") == "brain"
+ # A CLI-only row has no API path, so the surface that dropped its CLI
+ # seats has no runner for it at all — and never offers it (see
+ # test_the_jarvis_surface_offers_api_seats_only).
+ assert svc_mod.resolve_runner("openai-codex", surface="jarvis") == "unknown"
+ assert svc_mod.resolve_runner("antigravity", surface="jarvis") == "unknown"
+ assert svc_mod.resolve_runner("openai-codex", surface="agent") == "codex-cli"
+ assert svc_mod.resolve_runner("antigravity", surface="agent") == "agy-cli"
monkeypatch.setattr(svc_mod, "_claude_cli_installed", lambda: True)
assert svc_mod.resolve_runner("claude-api") == "claude-cli"
- assert svc_mod.resolve_runner("claude-api", surface="jarvis") == "claude-cli"
+ # Even with Claude Code installed: the front page's chat runs the
+ # Anthropic endpoint, not the subscription seat (maintainer 2026-08-26).
+ assert svc_mod.resolve_runner("claude-api", surface="jarvis") == "brain"
assert svc_mod.resolve_runner("no-such-provider", surface="jarvis") == "unknown"
+
+
+def test_the_jarvis_surface_offers_api_seats_only():
+ """Every row the front page's chat lists has a brain plugin behind it."""
+ from jarvis.agent_chat.catalog import PROVIDER_ROWS, offers, rows_for
+ from jarvis.agent_chat.runner_api import supports_api_runner
+
+ jarvis_ids = [row.id for row in rows_for("jarvis")]
+ assert jarvis_ids and all(supports_api_runner(pid) for pid in jarvis_ids)
+ # The CLI-only rows are gone from it and still there for the IDE's chat.
+ for cli_row in ("openai-codex", "antigravity", "grok-build"):
+ assert not offers("jarvis", cli_row)
+ assert offers("agent", cli_row)
+ assert [row.id for row in rows_for("agent")] == [row.id for row in PROVIDER_ROWS]
+
+
+def test_a_cli_seat_cannot_be_created_or_patched_onto_the_jarvis_chat(tmp_path):
+ """The picker does not list them, and the routes refuse them either way."""
+ import pytest
+
+ from jarvis.agent_chat.service import AgentChatService
+ from jarvis.agent_chat.store import AgentChatStore
+
+ svc = AgentChatService(AgentChatStore(":memory:"), default_cwd=lambda: str(tmp_path))
+ with pytest.raises(ValueError, match="not offered"):
+ svc.create_session(provider="openai-codex", surface="jarvis")
+ # The same row is fine on the surface that has CLI seats.
+ assert svc.create_session(provider="openai-codex", surface="agent").provider == "openai-codex"
+
+
+def test_an_old_cli_seated_jarvis_chat_moves_to_its_api_twin(tmp_path):
+ """A chat from before the change keeps its history and gains a working seat."""
+ from jarvis.agent_chat.service import AgentChatService
+ from jarvis.agent_chat.store import AgentChatStore
+
+ store = AgentChatStore(":memory:")
+ # ``gpt-5.2`` is in Codex's own catalog and not in OpenAI's, so it goes.
+ codex = store.create_session(
+ provider="openai-codex", model="gpt-5.2", effort="high", cwd=".", surface="jarvis"
+ )
+ # One the API does know rides along rather than resetting for nothing.
+ shared = store.create_session(
+ provider="openai-codex", model="gpt-5.5", effort="high", cwd=".", surface="jarvis"
+ )
+ claude = store.create_session(
+ provider="claude-api", model="opusplan", effort="high", cwd=".", surface="jarvis"
+ )
+ kept = store.create_session(
+ provider="claude-api", model="claude-opus-5", effort="high", cwd=".", surface="agent"
+ )
+ before = store.get_session(codex.session_id).updated_ms
+
+ AgentChatService(store, default_cwd=lambda: str(tmp_path))
+
+ moved = store.get_session(codex.session_id)
+ assert (moved.provider, moved.model) == ("openai", "")
+ assert (store.get_session(shared.session_id).provider, store.get_session(shared.session_id).model) == (
+ "openai",
+ "gpt-5.5",
+ )
+ # The list order is by updated_ms; a migration must not reshuffle it.
+ assert moved.updated_ms == before
+ # Claude keeps its row and loses only the model id the API cannot take.
+ assert store.get_session(claude.session_id).provider == "claude-api"
+ assert store.get_session(claude.session_id).model == ""
+ # The IDE's chat is untouched.
+ assert store.get_session(kept.session_id).provider == "claude-api"
+ assert store.get_session(kept.session_id).model == "claude-opus-5"
diff --git a/tests/unit/agent_chat/test_agent_chat_service.py b/tests/unit/agent_chat/test_agent_chat_service.py
index 613cb24951..07d2576fea 100644
--- a/tests/unit/agent_chat/test_agent_chat_service.py
+++ b/tests/unit/agent_chat/test_agent_chat_service.py
@@ -207,6 +207,46 @@ def _app(tmp_path: Path) -> FastAPI:
return app
+def test_the_jarvis_catalog_is_api_seats_only(tmp_path: Path):
+ """What the front page's composer is handed: endpoints behind a key.
+
+ No CLI row, and the dual Claude row resolved to the brain runner with a
+ live model list — whether or not Claude Code is on this machine, which is
+ exactly what the previous behaviour turned on.
+ """
+ with TestClient(_app(tmp_path)) as client:
+ cat = client.get("/api/agent-chat/catalog?surface=jarvis").json()
+ rows = {p["id"]: p for p in cat["providers"]}
+ assert not ({"openai-codex", "antigravity", "grok-build"} & set(rows))
+ assert {"claude-api", "openai", "gemini", "ollama"} <= set(rows)
+ assert all(p["runner"] == "brain" for p in rows.values()), rows
+ assert rows["claude-api"]["models_source"] == "live"
+ # No row claims a CLI either way, so the picker greys nothing for a
+ # missing binary here.
+ assert all(p["cli_installed"] is None for p in rows.values())
+
+ # The IDE's chat is untouched: its CLI rows are still there.
+ agent_rows = {
+ p["id"]: p for p in client.get("/api/agent-chat/catalog?surface=agent").json()["providers"]
+ }
+ assert {"openai-codex", "antigravity", "grok-build"} <= set(agent_rows)
+
+ # And a CLI seat cannot be talked onto the front page by hand.
+ refused = client.post(
+ "/api/agent-chat/sessions", json={"provider": "openai-codex", "surface": "jarvis"}
+ )
+ assert refused.status_code == 400, refused.text
+ made = client.post(
+ "/api/agent-chat/sessions", json={"provider": "openai", "surface": "jarvis"}
+ )
+ assert made.status_code == 201, made.text
+ moved = client.patch(
+ f"/api/agent-chat/sessions/{made.json()['session_id']}",
+ json={"provider": "antigravity"},
+ )
+ assert moved.status_code == 400, moved.text
+
+
def test_routes_catalog_sessions_and_websocket_snapshot(tmp_path: Path, scripted):
ScriptedBrain.script = [[BrainDelta(content="hello from fake")]]
# One portal for the whole test: a bare TestClient opens a fresh event
@@ -274,3 +314,43 @@ def test_routes_answer_503_without_a_service(tmp_path: Path):
app.include_router(router)
client = TestClient(app)
assert client.get("/api/agent-chat/sessions").status_code == 503
+
+
+def test_the_jarvis_chat_starts_in_its_own_folder_not_the_whole_profile(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """The front page's chat brings a workspace; the IDE's keeps the fallback.
+
+ The Jarvis surface merges the folder tools into the turn, and the
+ read-only four (``Read``/``Ls``/``Glob``/``Grep``) are tier ``safe`` — they
+ run without an approval card. Defaulting that to the home directory made
+ the person's whole profile readable unprompted, and the composer showed its
+ leaf ("Administrator" on Windows) as if it were a setting somebody chose.
+ The IDE's chat is the opposite case: a coding agent is pointed at a
+ checkout, so it keeps the service fallback and its folder chip.
+ """
+ workspace = tmp_path / "chat-workspace"
+ home = tmp_path / "home"
+ monkeypatch.setattr("jarvis.core.paths.chat_workspace_dir", lambda: workspace)
+ svc = AgentChatService(AgentChatStore(tmp_path / "db.sqlite"), default_cwd=lambda: str(home))
+
+ assert svc.default_cwd("jarvis") == str(workspace)
+ # Created on first use: a CLI seat cannot start in a folder that is not there.
+ assert workspace.is_dir()
+ assert svc.default_cwd("agent") == str(home)
+
+ session = svc.create_session(provider="claude-api", surface="jarvis")
+ assert session.cwd == str(workspace)
+
+
+def test_an_uncreatable_workspace_falls_back_instead_of_failing_the_chat(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """A read-only install still gets a chat, just with the old wider folder."""
+ blocker = tmp_path / "not-a-directory"
+ blocker.write_text("", encoding="utf-8")
+ home = tmp_path / "home"
+ monkeypatch.setattr("jarvis.core.paths.chat_workspace_dir", lambda: blocker / "chat-workspace")
+ svc = AgentChatService(AgentChatStore(tmp_path / "db.sqlite"), default_cwd=lambda: str(home))
+
+ assert svc.default_cwd("jarvis") == str(home)