Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(agentic-ide): the chat's pills change what a running pane runs on
rubenluetke10-beep7492937e0994
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.pyindex 3c51009815..05f582cdf1 100644--- a/jarvis/agentic_ide/session.py+++ b/jarvis/agentic_ide/session.py@@ -171,6 +171,14 @@ def is_runnable(agent: str) -> bool:return workspace_agents.get_agent(agent) is not None+#: The three picks a pane runs on, as the sentences about them name them.+_PICK_WORDS: dict[str, str] = {+ "model": "model",+ "effort": "reasoning effort",+ "permission_mode": "permission stance",+}++def accepts_prompts(agent: str) -> bool:"""May Jarvis type into this pane from the outside (prompt bar, voice, CLI)?@@ -925,10 +933,17 @@ class Terminal:# came back from a restart would quietly drop to the CLI's defaults while# its header still claimed the picks it was opened on. A running CLI owns# these three from the moment it starts — changing one here would be a- # label the process never sees, so nothing writes them after the spawn.+ # label the process never sees, so nothing writes them after the spawn+ # EXCEPT `Registry.apply_picks`, which writes one only after the CLI's own+ # command for it was typed into the pane and left the input line: then the+ # process has seen it, and the field says what the pane runs on now.model: str = ""effort: str = ""permission_mode: str = ""+ #: When `apply_picks` last changed each of the three (epoch seconds), so+ #: the timeline can tell a pick the chat just typed in from the older+ #: value the CLI's record still carries until its next reply.+ picked_at: dict[str, float] = field(default_factory=dict)status: Status = "pending"pty_id: str | None = None# The geometry the PTY ACTUALLY holds, as last handed to `setwinsize`.@@ -2364,9 +2379,7 @@ class Registry:# side by side draws the same picture with one full-height# seam welding its bands together, and a reopen is the moment# to hand it back its per-band seams (see `rows_outermost`).- session.layout = layout_tree.rows_outermost(- layout_tree.from_dict(space.layout)- )+ session.layout = layout_tree.rows_outermost(layout_tree.from_dict(space.layout))except ValueError as exc:logger.warning("Agentic IDE: the remembered layout of {} is unreadable, "@@ -2767,8 +2780,7 @@ class Registry:except Exception: # noqa: BLE001 — a probe that cannot read# the screen must not keep a slot; log, release.logger.debug(- "Agentic IDE: cold-start readiness check failed; "- "releasing the slot",+ "Agentic IDE: cold-start readiness check failed; releasing the slot",exc_info=True,)finally:@@ -4810,6 +4822,107 @@ class Registry:await announce_prompt(term)return term+ async def apply_picks(+ self,+ wanted: str,+ *,+ workspace_id: str | None = None,+ model: str | None = None,+ effort: str | None = None,+ permission_mode: str | None = None,+ ) -> dict[str, Any]:+ """Change what a RUNNING pane runs on, through the CLI's own commands.++ The chat stage's composer shows a pane's model, effort and permission+ pills, and a pick there used to do nothing but toast (maintainer+ report, 2026-08-27: "I switched effort to Max, it snapped back to+ Extra high, and a little error appeared"). A running process cannot be+ re-flagged, but every CLI that has a typed command for a pick takes it+ that way — Claude Code's ``/effort max`` — so this types exactly that+ command and presses Enter, the same keystroke path a prompt takes+ (``_write_and_confirm``), minus the receipt: a command is not a+ message and must not appear in the conversation as one.++ Returns, per pick asked for::++ {"applied": {"effort": "max"}, "declined": {"permission_mode": "..."}}++ A pick is applied once its command has left the input line (or was+ never seen to sit there — the pane took it or dropped it, and the+ field follows the optimistic reading the prompt path uses too). A+ pick the CLI has no command for, a value off its ladder, or a pane+ that would not submit the line is declined with the sentence that+ says why, so the composer can show it instead of guessing.++ Raises ``SessionError`` when the pane is unknown, not an agent, or not+ running — the same reasons a prompt cannot be typed.+ """+ found = (+ self._locate(wanted, workspace_id)+ if workspace_id is not None+ else self.find_terminal(wanted)+ )+ if found is None:+ raise self._unknown_terminal(wanted)+ owner, term = found+ if not accepts_prompts(term.agent):+ raise SessionError(+ f"{term.name} is a {agent_display(term.agent).lower()}, not a coding agent — "+ "there is no model, effort or permission stance to change."+ )+ if term.status != "live" or not term.pty_id:+ raise SessionError(+ f"{term.name} is not running right now (status: {term.status}) — "+ "nothing was changed."+ )+ asked = {+ "model": model,+ "effort": effort,+ "permission_mode": permission_mode,+ }+ display = agent_display(term.agent)+ applied: dict[str, str] = {}+ declined: dict[str, str] = {}+ offers = launch_picks.runtime_picks_for(term.agent).offers()+ for pick, value in asked.items():+ if value is None:+ continue+ if not offers.get(pick):+ declined[pick] = (+ f"{display} takes its {_PICK_WORDS[pick]} only when it starts — "+ "a new chat is where it changes."+ )+ continue+ line = launch_picks.runtime_command(term.agent, pick, value)+ if not line:+ declined[pick] = f"{display} does not offer {value!r} as a {_PICK_WORDS[pick]}."+ continue+ from . import fleet_actions++ ready = await fleet_actions.wait_for_prompt_ready(+ owner, [term.name], timeout_s=fleet_actions.READY_TIMEOUT_S+ )+ if term.name not in ready:+ declined[pick] = f"{term.name} is still starting — its input line never appeared."+ continue+ submitted = await self._write_and_confirm(term, line, self._manager(), False)+ if submitted is False:+ declined[pick] = f"{term.name} kept `{line}` in its input box instead of taking it."+ continue+ checked = line.rsplit(" ", 1)[-1]+ setattr(term, pick, checked)+ term.picked_at[pick] = time.time()+ applied[pick] = checked+ logger.info(+ "Agentic IDE picks -> {} ({}): {} = {} ({})",+ term.name,+ term.agent,+ pick,+ checked,+ "submitted" if submitted else "unconfirmed",+ )+ return {"terminal": term.name, "applied": applied, "declined": declined}+async def _write_and_confirm(self,term: Terminal,diff --git a/jarvis/ui/web/agentic_ide_routes.py b/jarvis/ui/web/agentic_ide_routes.pyindex 1c7474a901..11f1b4ab1c 100644--- a/jarvis/ui/web/agentic_ide_routes.py+++ b/jarvis/ui/web/agentic_ide_routes.py@@ -627,6 +627,14 @@ class PromptAttachment(BaseModel):)+class PicksRequest(BaseModel):+ """What a running pane should run on from now — any subset of the three."""++ model: str | None = Field(default=None, max_length=120)+ effort: str | None = Field(default=None, max_length=32)+ permission_mode: str | None = Field(default=None, max_length=32)++class PromptRequest(BaseModel):prompt: str = Field(max_length=MAX_PROMPT_CHARS,@@ -3165,6 +3173,12 @@ async def terminal_timeline(name: str, workspace: str | None = None) -> dict:"activity": reading.activity,}handle = term.resume+ from jarvis.workspace import launch_picks++ # Which of the three the CLI takes as a typed command while it runs+ # (`POST /terminals/{name}/picks`). The composer locks the pills it does+ # not, and says a new chat is where those change.+ base["runtime_picks"] = launch_picks.runtime_picks_for(term.agent).offers()# What the pane was OPENED on. The transcript is the better witness — it# reports what the CLI actually used — but it only speaks once a turn has# finished, and a CLI that records none of the three never speaks at all.@@ -3196,12 +3210,30 @@ async def terminal_timeline(name: str, workspace: str | None = None) -> dict:# What the pane runs on, by its own account — the composer's pills —# falling back to what it was opened on for whatever the CLI's record# leaves out (see ``empty`` above).- "model": read_result.model or term.model,- "effort": read_result.effort or term.effort,- "permission_mode": read_result.permission_mode or term.permission_mode,+ # ...except for a pick the pane took THROUGH the chat: `apply_picks`+ # wrote it once the CLI's command left the input line, and the record+ # only catches up with the next reply. Until the record has written+ # anything newer than that pick, the pane's own field is the newer+ # witness — which is what keeps a pill from flipping back for a poll+ # or two after a pick. A change typed in the terminal by hand is the+ # record's to report, as before.+ **_picks_now(term, read_result),}+def _picks_now(term: Any, read_result: Any) -> dict[str, str]:+ """The pane's model / effort / permission stance, by the newest witness."""+ events = read_result.events or []+ newest_ms = max((int(e.get("ts_ms") or 0) for e in events), default=0)+ out: dict[str, str] = {}+ for pick in ("model", "effort", "permission_mode"):+ recorded = getattr(read_result, pick, "") or ""+ own = getattr(term, pick, "") or ""+ picked_ms = term.picked_at.get(pick, 0.0) * 1000+ out[pick] = own if own and picked_ms > newest_ms else (recorded or own)+ return out++@router.post("/terminals/{name}/interrupt",summary="Interrupt what one terminal's agent is doing (Escape)",@@ -3226,6 +3258,45 @@ async def terminal_interrupt(name: str, workspace: str | None = None) -> dict:return {"terminal": term.name, "sent": "escape"}+ "/terminals/{name}/picks",+ summary="Change what one running terminal's agent runs on (model, effort, permissions)",+)+async def terminal_picks(name: str, req: PicksRequest, workspace: str | None = None) -> dict:+ """Type the CLI's own command for each pick into the pane — the chat stage's pills.++ A running process keeps the model, effort and permission stance it was+ launched with; what changes them is the CLI's own command line, and only+ for the picks the CLI has a command for (``jarvis.workspace.launch_picks+ .RuntimePicks``). The answer says which picks were taken and, for each+ that was not, why — the composer shows that sentence beside the pill+ instead of a pick that quietly did nothing.++ 409 when the pane is not running or NO pick could be taken; 200 with the+ per-pick verdicts otherwise.+ """+ registry = get_registry()+ if req.model is None and req.effort is None and req.permission_mode is None:+ raise HTTPException(status_code=422, detail="Nothing to change: no pick was given.")+ try:+ result = await registry.apply_picks(+ name,+ workspace_id=workspace,+ model=req.model,+ effort=req.effort,+ permission_mode=req.permission_mode,+ )+ except SessionError as exc:+ status = 404 if "no terminal" in str(exc).lower() else 409+ raise HTTPException(status_code=status, detail=str(exc)) from exc+ if not result["applied"]:+ raise HTTPException(+ status_code=409,+ detail=" ".join(result["declined"].values()) or "The pane took none of the picks.",+ )+ return result++@router.get("/voice-attachments",summary="List every file batch waiting for a spoken terminal prompt",diff --git a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsxindex 48c5951796..6d5c112e84 100644--- a/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx+++ b/jarvis/ui/web/frontend/src/components/agentchat/AgentComposer.tsx@@ -103,6 +103,11 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {const timeline = useAgentChat((s) => s.timeline);const busy = useAgentChat((s) => s.busy);const lastError = useAgentChat((s) => s.lastError);+ // The picks this chat cannot take, with the sentence that says why (a pane's+ // CLI chose its provider when it started; a pick it has no typed command+ // for waits for a new chat). A disabled pill that says so is the honest+ // control; one that swallows the click was the reported bug (2026-08-27).+ const locks = useAgentChat((s) => s.locks);const setDraft = useAgentChat((s) => s.setDraft);const setPlan = useAgentChat((s) => s.setPlan);const send = useAgentChat((s) => s.send);@@ -525,7 +530,8 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {fallbackLabel={catalogError ? t("agent_chat.catalog_unavailable") : t("agent_chat.pick_provider")}searchPlaceholder={t("agent_chat.search_providers")}icon={provider ? undefined : <Bot className="h-3.5 w-3.5" aria-hidden />}- disabled={!catalog}+ disabled={!catalog || Boolean(locks?.provider)}+ title={locks?.provider}/><PicktestId="composer-model"@@ -536,7 +542,8 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {fallbackLabel={draft.model || t("agent_chat.model_default")}searchPlaceholder={t("agent_chat.search_models")}icon={<Brain className="h-3.5 w-3.5" aria-hidden />}- disabled={!provider}+ disabled={!provider || Boolean(locks?.model)}+ title={locks?.model}className="max-w-[220px]"/>{provider && effortLevels.length > 1 && (@@ -548,6 +555,8 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {onChange={(v) => void setDraft({ effort: v })}fallbackLabel={effortLabel(draft.effort, t)}icon={<Gauge className="h-3.5 w-3.5" aria-hidden />}+ disabled={Boolean(locks?.effort)}+ title={locks?.effort}/>)}{provider && permissionModes.length > 0 && (@@ -561,7 +570,8 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {onChange={(v) => void setDraft({ permissionMode: v })}fallbackLabel={t("agent_chat.pick_permission")}icon={<ShieldCheck className="h-3.5 w-3.5" aria-hidden />}- title={permissionDescription}+ disabled={Boolean(locks?.permissionMode)}+ title={locks?.permissionMode ?? permissionDescription}className="max-w-[220px]"/></>@@ -573,9 +583,12 @@ export function AgentComposer({ autoFocus = false }: { autoFocus?: boolean }) {aria-checked={planOn}data-testid="composer-plan"onClick={() => void setPlan(!planOn)}- title={planOn ? t("agent_chat.plan_hint") : t("agent_chat.build_hint")}+ disabled={Boolean(locks?.permissionMode)}+ title={+ locks?.permissionMode ?? (planOn ? t("agent_chat.plan_hint") : t("agent_chat.build_hint"))+ }className={cn(- "inline-flex h-7 items-center gap-1.5 rounded-lg px-2 text-xs font-medium transition-colors",+ "inline-flex h-7 items-center gap-1.5 rounded-lg px-2 text-xs font-medium transition-colors disabled:opacity-50",planOn? "bg-primary/15 text-primary hover:bg-primary/20": "text-muted-foreground hover:bg-secondary hover:text-foreground",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 476a716dde..97ac44e048 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -5015,6 +5015,9 @@"reload": "Gespräch neu laden","not_taken": "{0} hat die Nachricht nicht angenommen: {1}","pick_in_terminal": "{0}: Das entscheidet das CLI im Fenster — ändere es im Terminal.",+ "lock_provider": "Dieser Chat läuft auf {0}. Ein anderer Coding-Agent wird in einem neuen Chat gewählt.",+ "lock_pick": "{0} übernimmt {1} nur beim Start — geändert wird das in einem neuen Chat.",+ "pick_not_taken": "{0} wurde nicht geändert: {1}","for_seconds": "seit {n} s","for_minutes": "seit {n} min","for_hours": "seit {n} h",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex a52bae9c86..e20c3c3ecb 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -5015,6 +5015,9 @@"reload": "Reload the conversation","not_taken": "{0} did not take the message: {1}","pick_in_terminal": "{0}: the CLI in the pane decides this — change it in the terminal.",+ "lock_provider": "This chat runs on {0}. A new chat is where another coding agent is picked.",+ "lock_pick": "{0} takes its {1} only when it starts — a new chat is where it changes.",+ "pick_not_taken": "{0} was not changed: {1}","for_seconds": "for {n}s","for_minutes": "for {n} min","for_hours": "for {n} h",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 28d5c6304a..b34b2a2c94 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -5015,6 +5015,9 @@"reload": "Recargar la conversación","not_taken": "{0} no aceptó el mensaje: {1}","pick_in_terminal": "{0}: lo decide la CLI del panel — cámbialo en el terminal.",+ "lock_provider": "Este chat corre en {0}. Otro agente de código se elige en un chat nuevo.",+ "lock_pick": "{0} toma {1} solo al arrancar — se cambia en un chat nuevo.",+ "pick_not_taken": "{0} no se cambió: {1}","for_seconds": "desde hace {n} s","for_minutes": "desde hace {n} min","for_hours": "desde hace {n} h",diff --git a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.tsindex dcd484f5bd..94b35d739c 100644--- a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts+++ b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts@@ -780,6 +780,48 @@ export interface TerminalTimelineResponse {model: string;effort: string;permission_mode: string;+ /**+ * Which of the three the CLI takes as a typed command while it runs+ * (`applyTerminalPicks`). Absent on a backend that predates the picks route.+ */+ runtime_picks?: RuntimePickOffers;+}++/** Per pick: can a RUNNING pane of this CLI take it (`/effort max`), or only a launch? */+export interface RuntimePickOffers {+ model: boolean;+ effort: boolean;+ permission_mode: boolean;+}++export type PaneRuntimePick = "model" | "effort" | "permission_mode";++/** What `POST /terminals/{name}/picks` answers: the picks taken, and why the rest were not. */+export interface PaneRuntimePicksResult {+ terminal: string;+ applied: Partial<Record<PaneRuntimePick, string>>;+ declined: Partial<Record<PaneRuntimePick, string>>;+}++/**+ * Change what a running pane's agent runs on — the chat stage's pills.+ *+ * Typed into the pane as the CLI's own command for each pick it has one for;+ * the answer says which were taken. Rejects (409) when none could be.+ */+export async function applyTerminalPicks(+ name: string,+ picks: Partial<Record<PaneRuntimePick, string>>,+ workspaceId?: string,+): Promise<PaneRuntimePicksResult> {+ const query = workspaceId ? `?workspace=${encodeURIComponent(workspaceId)}` : "";+ const res = await fetch(`/api/agentic-ide/terminals/${encodeURIComponent(name)}/picks${query}`, {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify(picks),+ });+ if (!res.ok) throw new Error(await detail(res));+ return (await res.json()) as PaneRuntimePicksResult;}export function fetchTerminalTimeline(diff --git a/jarvis/ui/web/frontend/src/store/agentChat.ts b/jarvis/ui/web/frontend/src/store/agentChat.tsindex ee366a4cf5..c6603e7cb2 100644--- a/jarvis/ui/web/frontend/src/store/agentChat.ts+++ b/jarvis/ui/web/frontend/src/store/agentChat.ts@@ -126,6 +126,15 @@ export interface AgentChatStore {draft: ComposerDraft;busy: boolean;lastError: string | null;+ /**+ * The picks this chat cannot take, each with the sentence that says why —+ * the composer disables that pill and shows the sentence on it. Absent (a+ * session the chat runs itself) means every pick is live. A pane's store+ * sets these: its CLI chose its provider the moment it started, and takes+ * the other three only where it has a typed command for them+ * (`store/paneChat`, `RuntimePickOffers`).+ */+ locks?: Partial<Record<"provider" | "model" | "effort" | "permissionMode", string>>;loadCatalog: () => Promise<void>;loadSessions: () => Promise<void>;diff --git a/jarvis/ui/web/frontend/src/store/paneChat.test.ts b/jarvis/ui/web/frontend/src/store/paneChat.test.tsindex d0685db658..938177e2c5 100644--- a/jarvis/ui/web/frontend/src/store/paneChat.test.ts+++ b/jarvis/ui/web/frontend/src/store/paneChat.test.ts@@ -29,6 +29,7 @@ vi.mock("@/lib/agenticIdeApi", async (importOriginal) => ({fetchTerminalTimeline: vi.fn(),promptTerminal: vi.fn(),interruptTerminal: vi.fn(),+ applyTerminalPicks: vi.fn(),}));const T0 = 1_787_800_000_000;@@ -82,6 +83,7 @@ function answer(overrides: Partial<TerminalTimelineResponse> = {}): TerminalTimemodel: "claude-opus-5",effort: "xhigh",permission_mode: "auto",+ runtime_picks: { model: true, effort: true, permission_mode: false },...overrides,};}@@ -108,6 +110,7 @@ beforeEach(() => {vi.mocked(api.fetchTerminalTimeline).mockReset();vi.mocked(api.promptTerminal).mockReset();vi.mocked(api.interruptTerminal).mockReset();+ vi.mocked(api.applyTerminalPicks).mockReset();useAgentSessionStore.setState({providerOptions: () => [CLAUDE_CLI],providerById: (id: string) => (id === CLAUDE_CLI.id ? CLAUDE_CLI : null),@@ -371,27 +374,87 @@ describe("createPaneChatStore", () => {expect(api.interruptTerminal).toHaveBeenCalledWith("T7", "ide_test");});- it("a model pick is typed in as the CLI's own command; the other picks say where to go", async () => {+ it("a pick the CLI takes while it runs goes to the pane and stays on the pill", async () => {vi.mocked(api.fetchTerminalTimeline).mockResolvedValue(answer());- vi.mocked(api.promptTerminal).mockResolvedValue({+ vi.mocked(api.applyTerminalPicks).mockImplementation(async (_name, picks) => ({terminal: "T7",- sent: "/model claude-sonnet-5",- composed_by: "raw",- files: [],- submitted: true,- });+ applied: { ...picks },+ declined: {},+ }));const store = makeStore();store.getState().start();await flush();+ await store.getState().setDraft({ effort: "max" });+ expect(api.applyTerminalPicks).toHaveBeenCalledWith("T7", { effort: "max" }, "ide_test");+ expect(store.getState().draft.effort).toBe("max");++ // The record still says "xhigh" until the CLI's next reply; the pill+ // keeps the pick rather than flipping back on the next poll.+ vi.mocked(api.fetchTerminalTimeline).mockResolvedValue(answer({ effort: "xhigh" }));+ store.getState().reload();+ await flush();+ expect(store.getState().draft.effort).toBe("max");++ // Once the record says something NEW, that is what the pill reads.+ vi.mocked(api.fetchTerminalTimeline).mockResolvedValue(answer({ effort: "high" }));+ store.getState().reload();+ await flush();+ expect(store.getState().draft.effort).toBe("high");+await store.getState().setDraft({ model: "claude-sonnet-5" });- expect(api.promptTerminal).toHaveBeenCalledWith("T7", "/model claude-sonnet-5", { compose: false });+ expect(api.applyTerminalPicks).toHaveBeenLastCalledWith(+ "T7",+ { model: "claude-sonnet-5" },+ "ide_test",+ );expect(store.getState().draft.model).toBe("claude-sonnet-5");+ store.getState().stop();+ });++ it("a pick the CLI only takes at launch is locked on the pill, and the provider always is", async () => {+ vi.mocked(api.fetchTerminalTimeline).mockResolvedValue(answer());+ const store = makeStore();+ store.getState().start();+ await flush();+ const locks = store.getState().locks ?? {};+ expect(locks.provider).toContain("Claude Code");+ expect(locks.permissionMode).toContain("only when it starts");+ expect(locks.effort).toBeUndefined();+ expect(locks.model).toBeUndefined();++ // A stale bundle's click on a locked pill is answered with the same sentence.await store.getState().setDraft({ permissionMode: "default" });+ expect(api.applyTerminalPicks).not.toHaveBeenCalled();expect(store.getState().draft.permissionMode).toBe("auto");- const toasts = useEventStore.getState().toasts;- expect(toasts.at(-1)?.message).toContain("change it in the terminal");+ expect(useEventStore.getState().toasts.at(-1)?.message).toContain("only when it starts");++ await store.getState().setDraft({ provider: "openai-codex" });+ expect(store.getState().draft.provider).toBe("claude-api");+ expect(useEventStore.getState().toasts.at(-1)?.message).toContain("This chat runs on Claude Code");+ store.getState().stop();+ });++ it("a pick the pane declines goes back on the pill, with the pane's reason", async () => {+ vi.mocked(api.fetchTerminalTimeline).mockResolvedValue(answer());+ vi.mocked(api.applyTerminalPicks).mockResolvedValue({+ terminal: "T7",+ applied: {},+ declined: { effort: "T7 kept `/effort max` in its input box instead of taking it." },+ });+ const store = makeStore();+ store.getState().start();+ await flush();++ await store.getState().setDraft({ effort: "max" });+ expect(store.getState().draft.effort).toBe("xhigh");+ expect(useEventStore.getState().toasts.at(-1)?.message).toContain("kept `/effort max`");++ vi.mocked(api.applyTerminalPicks).mockRejectedValue(new Error("T7 is not running right now"));+ await store.getState().setDraft({ effort: "low" });+ expect(store.getState().draft.effort).toBe("xhigh");+ expect(store.getState().lastError).toContain("not running");store.getState().stop();});diff --git a/jarvis/ui/web/frontend/src/store/paneChat.ts b/jarvis/ui/web/frontend/src/store/paneChat.tsindex 155d89615a..87a940c310 100644--- a/jarvis/ui/web/frontend/src/store/paneChat.ts+++ b/jarvis/ui/web/frontend/src/store/paneChat.ts@@ -8,10 +8,13 @@ import {type TimelineItem,} from "@/components/agentchat/reduce";import {+ applyTerminalPicks,fetchTerminalTimeline,interruptTerminal,promptTerminal,type PaneActivity,+ type PaneRuntimePick,+ type RuntimePickOffers,type TerminalTimelineResponse,} from "@/lib/agenticIdeApi";import type {@@ -196,6 +199,27 @@ export function echoEvents(];}+/** The three picks a pane runs on, as the draft names them. */+type PickKey = "model" | "effort" | "permissionMode";++/** The same three, as the picks route spells them beside the draft's names. */+const PICK_KEYS: readonly (readonly [PaneRuntimePick, PickKey])[] = [+ ["model", "model"],+ ["effort", "effort"],+ ["permission_mode", "permissionMode"],+];++/** The composer's own name for a pick, for the sentences about it. */+function pickWord(key: PickKey): string {+ return translate(+ key === "model"+ ? "agent_chat.pick_model"+ : key === "effort"+ ? "agent_chat.pick_effort"+ : "agent_chat.pick_permission",+ );+}+export interface PaneChatStoreOptions {terminal: string;workspaceId: string;@@ -258,7 +282,13 @@ export function createPaneChatStore(options: PaneChatStoreOptions) {let timer: number | null = null;let running = false;let signature = "";- const lastReported = { model: "" };+ /**+ * What the record last said each pick was, so a pick typed in HERE holds on+ * the pill until the record says something NEW — the CLI writes the change+ * down only with its next reply, and a poll in between would otherwise+ * flip the pill back to the old value for no reason.+ */+ const lastReported: Record<PickKey, string> = { model: "", effort: "", permissionMode: "" };let unsubscribe: (() => void) | null = null;const mirror = () => {@@ -322,14 +352,48 @@ export function createPaneChatStore(options: PaneChatStoreOptions) {return withProvider(echoed, pid);};+ /**+ * The sentence on each pill the pane cannot change, from what the backend+ * says its CLI takes while it runs. The provider is always the pane's: the+ * CLI chose it when it started, and a new chat is where another is picked+ * (maintainer, 2026-08-27). A backend from before the picks route answers+ * nothing here; then the model pick goes the way it always did on Claude+ * Code, and the other two say where they change.+ */+ const locksFor = (offers?: RuntimePickOffers): PaneChatState["locks"] => {+ const live = offers ?? {+ model: options.agent === "claude",+ effort: false,+ permission_mode: false,+ };+ const lock = (pick: string) =>+ translate("agentic_grid.pane_chat.lock_pick")+ .replace("{0}", options.displayName)+ .replace("{1}", pick);+ return {+ provider: translate("agentic_grid.pane_chat.lock_provider").replace(+ "{0}",+ options.displayName,+ ),+ ...(live.model ? {} : { model: lock(pickWord("model")) }),+ ...(live.effort ? {} : { effort: lock(pickWord("effort")) }),+ ...(live.permission_mode ? {} : { permissionMode: lock(pickWord("permissionMode")) }),+ };+ };+const apply = (res: TerminalTimelineResponse) => {const pid = providerId();- // A model picked here is typed into the pane and shows up in the record- // only with the CLI's next reply; until the record SAYS something new,- // the pill keeps the pick rather than flipping back for a poll or two.- const reportedBefore = lastReported.model;- lastReported.model = res.model;- const model = res.model !== reportedBefore ? res.model : get().draft.model || res.model;+ // A pick typed in here shows up in the record only with the CLI's next+ // reply; until the record SAYS something new, the pill keeps the pick+ // rather than flipping back for a poll or two.+ const hold = (key: PickKey, reported: string): string => {+ const before = lastReported[key];+ lastReported[key] = reported;+ return reported !== before ? reported : get().draft[key] || reported;+ };+ const model = hold("model", res.model);+ const effort = hold("effort", res.effort);+ const permissionMode = hold("permissionMode", res.permission_mode);const next: Partial<PaneChatState> = {pane: {...get().pane,@@ -344,17 +408,18 @@ export function createPaneChatStore(options: PaneChatStoreOptions) {...get().draft,provider: pid,model,- effort: res.effort,- permissionMode: res.permission_mode,- buildMode: res.permission_mode === "plan" ? get().draft.buildMode : res.permission_mode,+ effort,+ permissionMode,+ buildMode: permissionMode === "plan" ? get().draft.buildMode : permissionMode,},activeSession: session({provider: pid,model,- effort: res.effort,- permission_mode: res.permission_mode,+ effort,+ permission_mode: permissionMode,running: res.live,}),+ locks: locksFor(res.runtime_picks),};const sig = eventsSignature(res.events, res.live);if (sig !== signature) {@@ -411,6 +476,7 @@ export function createPaneChatStore(options: PaneChatStoreOptions) {};return {+ locks: locksFor(undefined),surface: "agent",...mirror(),sessions: [],@@ -468,47 +534,92 @@ export function createPaneChatStore(options: PaneChatStoreOptions) {providerById: (id) => agentStore.getState().providerById(id),setDraft: async (patch: Partial<ComposerDraft>) => {- // What the pane runs on is the CLI's to change. A model pick is typed- // in where the CLI takes it as a command; everything else says where- // to go rather than showing a pick the pane never received.- if (patch.provider !== undefined && patch.provider !== get().draft.provider) {- cannotPick(translate("agent_chat.pick_provider"));+ // What the pane runs on is the CLI's to change, and it changes it on+ // its own command line: every pick the CLI has a typed command for is+ // sent there (`POST /terminals/{name}/picks`), the pill takes the+ // pick at once, and a pick the pane would not take goes back with+ // the backend's sentence about why. A pick the CLI has no command for+ // is locked on the pill (`locks`) — the sentence there says where it+ // changes — so a click never lands here for it; a stale bundle's+ // click is answered with the same sentence. The provider is the+ // pane's own from the moment it started (maintainer, 2026-08-27).+ const draft = get().draft;+ const locks = get().locks ?? {};+ if (patch.provider !== undefined && patch.provider !== draft.provider) {+ if (locks.provider) toast("info", locks.provider);+ else cannotPick(translate("agent_chat.pick_provider"));return;}- if (patch.model !== undefined && patch.model !== get().draft.model) {- if (options.agent === "claude" && patch.model) {- try {- await promptTerminal(options.terminal, `/model ${patch.model}`, { compose: false });- set({ draft: { ...get().draft, model: patch.model } });- get().reload();- } catch (reason: unknown) {- set({ lastError: reason instanceof Error ? reason.message : String(reason) });- }- } else {- cannotPick(translate("agent_chat.pick_model"));+ // `cwd` is the workspace's folder; a pane does not move.+ const wanted: Partial<Record<PaneRuntimePick, string>> = {};+ for (const [wire, key] of PICK_KEYS) {+ const value = patch[key];+ if (value === undefined || value === draft[key]) continue;+ if (key === "effort") {+ // The composer snaps an off-ladder effort to the nearest level on+ // its own; that is bookkeeping, not a pick, and is not typed in.+ const ladder = get().providerById(draft.provider)?.effort_levels ?? [];+ if (draft.effort && !ladder.includes(draft.effort)) continue;}- return;+ const locked = locks[key];+ if (locked) {+ toast("info", locked);+ continue;+ }+ wanted[wire] = value;}- if (patch.effort !== undefined && patch.effort !== get().draft.effort) {- // The composer snaps an off-ladder effort to the nearest level on- // its own; that is bookkeeping, not a pick, and gets no toast.- const ladder = get().providerById(get().draft.provider)?.effort_levels ?? [];- if (get().draft.effort && ladder.includes(get().draft.effort)) {- cannotPick(translate("agent_chat.pick_effort"));+ if (!Object.keys(wanted).length) return;++ // The pill reads the pick the moment it is made, as the front page's+ // does; what the pane declines is put back below, with the reason.+ const before = { ...draft };+ const optimistic = { ...draft };+ for (const [wire, key] of PICK_KEYS) {+ const value = wanted[wire];+ if (value !== undefined) optimistic[key] = value;+ }+ if (wanted.permission_mode !== undefined && wanted.permission_mode !== "plan") {+ optimistic.buildMode = wanted.permission_mode;+ }+ set({ draft: optimistic, lastError: null });+ try {+ const result = await applyTerminalPicks(options.terminal, wanted, options.workspaceId);+ const settled = { ...get().draft };+ for (const [wire, key] of PICK_KEYS) {+ const why = result.declined[wire];+ if (!why) continue;+ settled[key] = before[key];+ if (key === "permissionMode") settled.buildMode = before.buildMode;+ toast(+ "warning",+ translate("agentic_grid.pane_chat.pick_not_taken")+ .replace("{0}", pickWord(key))+ .replace("{1}", why),+ );}- return;+ set({ draft: settled });+ // The record catches up with the CLI's next reply; read again now so+ // the timeline shows the command having gone in.+ get().reload();+ } catch (reason: unknown) {+ const back = { ...get().draft };+ for (const [wire, key] of PICK_KEYS) if (wanted[wire] !== undefined) back[key] = before[key];+ back.buildMode = before.buildMode;+ set({ draft: back, lastError: reason instanceof Error ? reason.message : String(reason) });}- if (- patch.permissionMode !== undefined &&- patch.permissionMode !== get().draft.permissionMode- ) {- cannotPick(translate("agent_chat.pick_permission"));+ },+ setPlan: async (on) => {+ const st = get();+ const locked = st.locks?.permissionMode;+ if (locked) {+ toast("info", locked);return;}- // `cwd` is the workspace's folder; a pane does not move.- },- setPlan: async () => {- cannotPick(translate("agent_chat.plan"));+ const back =+ st.draft.buildMode && st.draft.buildMode !== "plan"+ ? st.draft.buildMode+ : (st.providerById(st.draft.provider)?.default_permission_mode ?? "");+ await st.setDraft({ permissionMode: on ? "plan" : back });},newChat: () => undefined,openSession: () => undefined,diff --git a/jarvis/workspace/agents.py b/jarvis/workspace/agents.pyindex db3d6b1b25..8c52f253c2 100644--- a/jarvis/workspace/agents.py+++ b/jarvis/workspace/agents.py@@ -41,7 +41,7 @@ from jarvis.clis.prober import CliStatusProberfrom jarvis.clis.spec import AuthConfig, CliSpec, InstallMethods, RiskConfigfrom jarvis.terminal.shells import default_shellfrom jarvis.workspace.launch_picks import VALUE as picks_value-from jarvis.workspace.launch_picks import LaunchPicks, flag_modes+from jarvis.workspace.launch_picks import LaunchPicks, RuntimePicks, flag_modeslog = logging.getLogger(__name__)@@ -235,6 +235,11 @@ class WorkspaceAgent:#: nothing. Declaring it is what makes those three picks work for an entry —#: no layer above knows any CLI's flag spelling (AP-21).launch_picks: LaunchPicks | None = None+ #: How a RUNNING pane of this CLI takes the same picks — as its own typed+ #: commands (``/effort max``), one template per pick. ``None`` means the+ #: process owns them from the moment it starts: the chat's composer then+ #: locks those pills for a pane and says a new chat is where they change.+ runtime_picks: RuntimePicks | None = None# --- How it behaves once it is running ----------------------------------trust: TrustSpec | None = None@@ -629,6 +634,14 @@ _CLAUDE_PICKS = LaunchPicks(#: neither is what keeps a picker from listing choices the endpoint refuses._GLM_PICKS = LaunchPicks(provider="claude-api", permission_args=_CLAUDE_PICKS.permission_args)+#: What Claude Code takes while it runs, read off the installed binary+#: (2.1.247): ``/model <id>`` and ``/effort <level>`` are typed commands that+#: apply at once — its changelog names them among the commands that "run+#: immediately instead of queueing until the turn ends". The permission stance+#: is not a command: Shift+Tab cycles it, and a cycle cannot be aimed at a+#: mode, so it stays with the terminal.+_CLAUDE_RUNTIME = RuntimePicks(model=f"/model {picks_value}", effort=f"/effort {picks_value}")+_CODEX_PICKS = LaunchPicks(provider="openai-codex",model_args=("--model", picks_value),@@ -697,6 +710,7 @@ _AGENTS: dict[str, WorkspaceAgent] = {"claude","Claude Code",launch_picks=_CLAUDE_PICKS,+ runtime_picks=_CLAUDE_RUNTIME,binary="claude",npm_package="@anthropic-ai/claude-code",homepage="https://claude.com/claude-code",diff --git a/jarvis/workspace/launch_picks.py b/jarvis/workspace/launch_picks.pyindex 493127a56a..500eff19d5 100644--- a/jarvis/workspace/launch_picks.py+++ b/jarvis/workspace/launch_picks.py@@ -397,9 +397,81 @@ def offered(agent: str, live: Mapping[str, list[dict[str, Any]]] | None = None)}+@dataclass(frozen=True, slots=True)+class RuntimePicks:+ """The picks a RUNNING CLI takes as a typed command, in its own spelling.++ The launch flags above are spent the moment a pane opens; from then on the+ process owns its model, effort and permission stance, and the only way in+ is the CLI's own command line — ``/effort max`` typed into Claude Code and+ submitted, which its 2.1 builds apply at once rather than queueing until+ the turn ends (their changelog says so). Each field is a TEMPLATE like the+ launch ones, ``""`` where the CLI has no typed command for that pick:+ Codex opens a picker on ``/model`` and takes no argument, Claude Code's+ permission stance cycles on Shift+Tab, and a cycle is not a pick. An entry+ that declares nothing offers nothing at runtime, and the chat's composer+ then locks that pill and says where the pick is taken instead — never a+ control that swallows a click (maintainer report, 2026-08-27).+ """++ model: str = ""+ effort: str = ""+ permission_mode: str = ""++ def command(self, pick: str, value: str) -> str:+ """The line to type for ``pick`` = ``value``, or ``""`` when there is none."""+ template = getattr(self, pick, "")+ return template.replace(VALUE, value) if template and value else ""++ def offers(self) -> dict[str, bool]:+ """Which of the three picks this CLI takes while it runs."""+ return {+ "model": bool(self.model),+ "effort": bool(self.effort),+ "permission_mode": bool(self.permission_mode),+ }+++#: What an entry with no runtime declaration offers: nothing, said plainly.+_NO_RUNTIME_PICKS: Final[RuntimePicks] = RuntimePicks()+++def runtime_picks_for(agent: str) -> RuntimePicks:+ """What ``agent`` takes as a typed command once it runs; empty for none."""+ from jarvis.workspace import agents as workspace_agents++ spec = workspace_agents.get_agent(agent)+ picks = None if spec is None else spec.runtime_picks+ return picks if picks is not None else _NO_RUNTIME_PICKS+++def runtime_command(agent: str, pick: str, value: str) -> str:+ """The command that sets ``pick`` on a running ``agent`` — ``""`` when it has none.++ ``value`` is checked the way a launch value is: an effort level has to be+ on this entry's ladder and a model one it could be launched on. The string+ ends up on a PTY as keystrokes, which is exactly one place a stray line+ must not reach.+ """+ if pick == "effort":+ checked = normalize_effort(agent, value)+ elif pick == "model":+ checked = normalize_model(agent, value)+ elif pick == "permission_mode":+ checked = normalize_permission(agent, value)+ else:+ return ""+ if not checked:+ return ""+ return runtime_picks_for(agent).command(pick, checked)++__all__ = ["VALUE","LaunchPicks",+ "RuntimePicks",+ "runtime_command",+ "runtime_picks_for","default_effort","default_permission","effort_levels",diff --git a/tests/unit/agentic_ide/test_runtime_picks.py b/tests/unit/agentic_ide/test_runtime_picks.pynew file mode 100644index 0000000000..16d4d8270e--- /dev/null+++ b/tests/unit/agentic_ide/test_runtime_picks.py@@ -0,0 +1,161 @@+"""A running pane takes a pick through the CLI's own command, or says why not.++The chat stage's composer shows a pane's model, effort and permission pills;+a pick there is typed into the pane as the CLI's command for it (Claude+Code's ``/effort max``), the pane's own fields follow, and a pick the CLI+has no command for is declined with the sentence the composer shows.+"""++from __future__ import annotations++from pathlib import Path++import pytest+from fastapi import FastAPI+from fastapi.testclient import TestClient++from jarvis.agentic_ide import session as session_mod+from jarvis.agentic_ide.session import Registry, SessionError+from jarvis.workspace import launch_picks+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}",))+ reg = Registry(pty_manager=FakePtyManager())+ monkeypatch.setattr(session_mod, "get_registry", lambda: reg)+ from jarvis.ui.web import agentic_ide_routes++ monkeypatch.setattr(agentic_ide_routes, "get_registry", lambda: reg)+ return reg+++def client(registry: Registry) -> TestClient:+ from jarvis.ui.web.agentic_ide_routes import router++ app = FastAPI()+ app.include_router(router)+ return TestClient(app)+++async def _noop(_text: str) -> None:+ return None+++async def _noop_exit(_code: int) -> None:+ return None+++async def _live_pane(+ registry: Registry, folder: Path, monkeypatch: pytest.MonkeyPatch, agent: str = "claude"+) -> tuple[str, list[str]]:+ """A live pane whose keystroke path records every line typed into it."""+ await registry.start(str(folder), [{"agent": agent}])+ assert registry.session is not None+ term = registry.session.terminals[0]+ await registry.attach(term.name, 100, 30, _noop, _noop_exit)+ typed: list[str] = []++ async def accepted(_term: object, payload: str, *_rest: object) -> bool:+ typed.append(payload)+ return True++ monkeypatch.setattr(registry, "_write_and_confirm", accepted)+ return term.name, typed+++def test_claude_code_declares_the_commands_its_binary_takes_while_running() -> None:+ picks = launch_picks.runtime_picks_for("claude")+ assert picks.offers() == {"model": True, "effort": True, "permission_mode": False}+ assert launch_picks.runtime_command("claude", "effort", "max") == "/effort max"+ model = launch_picks.runtime_command("claude", "model", "claude-opus-5")+ assert model == "/model claude-opus-5"+ # No command for the stance: Shift+Tab cycles it, and a cycle is not a pick.+ assert launch_picks.runtime_command("claude", "permission_mode", "plan") == ""+ # A level off the ladder is folded like a launch value — a word the ladder+ # does not know lands on its floor — so the raw string never reaches the PTY.+ assert launch_picks.runtime_command("claude", "effort", "ultra") == "/effort max"+ assert launch_picks.runtime_command("claude", "effort", "rm -rf") == "/effort low"+ assert launch_picks.runtime_command("claude", "model", "rm -rf") == ""+++def test_an_entry_that_declares_nothing_offers_nothing_at_runtime() -> None:+ assert launch_picks.runtime_picks_for("codex").offers() == {+ "model": False,+ "effort": False,+ "permission_mode": False,+ }+ assert launch_picks.runtime_command("codex", "effort", "high") == ""+ assert launch_picks.runtime_picks_for("no-such-agent").offers()["effort"] is False+++async def test_a_pick_is_typed_as_the_command_and_the_pane_follows(+ registry: Registry, tmp_path: Path, monkeypatch: pytest.MonkeyPatch+) -> None:+ name, typed = await _live_pane(registry, tmp_path, monkeypatch)+ result = await registry.apply_picks(name, effort="max", permission_mode="plan")+ assert typed == ["/effort max"]+ assert result["applied"] == {"effort": "max"}+ assert "only when it starts" in result["declined"]["permission_mode"]+ term = registry.session.terminals[0] # type: ignore[union-attr]+ assert term.effort == "max"+ assert term.picked_at["effort"] > 0+ # A command is not a message: nothing lands in the prompt history.+ assert term.prompts_sent == 0+ assert term.prompt_records == []+++async def test_a_pane_that_keeps_the_command_in_its_box_declines_the_pick(+ registry: Registry, tmp_path: Path, monkeypatch: pytest.MonkeyPatch+) -> None:+ name, _typed = await _live_pane(registry, tmp_path, monkeypatch)++ async def refused(*_args: object) -> bool:+ return False++ monkeypatch.setattr(registry, "_write_and_confirm", refused)+ result = await registry.apply_picks(name, effort="low")+ assert result["applied"] == {}+ assert "kept `/effort low`" in result["declined"]["effort"]+ assert registry.session.terminals[0].effort == "" # type: ignore[union-attr]+++async def test_a_pane_that_is_not_running_raises(registry: Registry, tmp_path: Path) -> None:+ await registry.start(str(tmp_path), [{"agent": "claude"}])+ name = registry.session.terminals[0].name # type: ignore[union-attr]+ with pytest.raises(SessionError, match="not running"):+ await registry.apply_picks(name, effort="max")+++async def test_the_route_answers_per_pick_and_refuses_a_pick_that_cannot_be_taken(+ registry: Registry, client: TestClient, tmp_path: Path, monkeypatch: pytest.MonkeyPatch+) -> None:+ name, typed = await _live_pane(registry, tmp_path, monkeypatch)+ res = client.post(f"/api/agentic-ide/terminals/{name}/picks", json={"effort": "high"})+ assert res.status_code == 200, res.text+ assert res.json()["applied"] == {"effort": "high"}+ assert typed == ["/effort high"]++ res = client.post(f"/api/agentic-ide/terminals/{name}/picks", json={"permission_mode": "plan"})+ assert res.status_code == 409+ assert "only when it starts" in res.json()["detail"]++ res = client.post(f"/api/agentic-ide/terminals/{name}/picks", json={})+ assert res.status_code == 422++ res = client.post("/api/agentic-ide/terminals/Nobody/picks", json={"effort": "high"})+ assert res.status_code == 404++ # The timeline says which picks the CLI takes while it runs, and reports+ # the pick just taken until the record has written something newer.+ res = client.get(f"/api/agentic-ide/terminals/{name}/timeline")+ assert res.status_code == 200+ body = res.json()+ assert body["runtime_picks"] == {"model": True, "effort": True, "permission_mode": False}+ assert body["effort"] == "high"