Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(agentic-ide): a new chat is an empty chat window that picks its own agent

rubenluetke10-beep19cf51a8bfaa
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgentPicker.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgentPicker.tsx
index 9298030c3a..22f3dba5bd 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgentPicker.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgentPicker.tsx
@@ -28,10 +28,34 @@
*/
import { useEffect, useState } from "react";
import { createPortal } from "react-dom";
+
+import type { CuratedModel, PermissionModeOption } from "@/lib/agentChatApi";
import { cn } from "@/lib/utils";
import { AgentInstallDialog } from "./AgentInstallDialog";
import { AgentMark } from "./AgentMark";
+/**
+ * What a NEW pane of one CLI may be opened on — its models, its effort ladder
+ * and the permission stances it can be launched into.
+ *
+ * The backend's answer (`jarvis/workspace/launch_picks.py`), carried in the
+ * agent chat's own catalog vocabulary so the IDE's chat composer can draw
+ * these with the picker it already has. Absent for an entry that takes no
+ * picks, and for a backend older than the field — both of which mean the same
+ * thing to a picker: nothing to choose, so nothing is shown.
+ */
+export interface AgentLaunchPicks {
+ models: CuratedModel[];
+ /** "" = the CLI's own default. */
+ defaultModel: string;
+ /** Ascending; empty when this CLI takes no effort pick. */
+ effortLevels: string[];
+ defaultEffort: string;
+ permissionModes: PermissionModeOption[];
+ /** "" = whatever stance the CLI itself opens in. */
+ defaultPermissionMode: string;
+}
+
/** A coding CLI an "open a terminal" action may start. */
export interface SplitAgentChoice {
/** Backend id — "claude", "codex", "shell". */
@@ -61,6 +85,14 @@ export interface SplitAgentChoice {
* fixes) and for a user-added CLI, whose command is theirs to run.
*/
installCommand?: string;
+ /**
+ * False for an entry that cannot be typed into (its interface is elsewhere).
+ * A menu that only OPENS a pane ignores this; a surface that opens a CHAT
+ * leaves such an entry out, because there would be nowhere to say anything.
+ */
+ acceptsPrompts?: boolean;
+ /** What a new pane of this CLI may run on; absent = nothing to pick. */
+ picks?: AgentLaunchPicks;
}
/**
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
index 63f844b246..6b94e3db79 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
@@ -36,7 +36,7 @@ import {
type LucideIcon,
} from "lucide-react";
import { cn } from "@/lib/utils";
-import { useT } from "@/i18n";
+import { fill, useT } from "@/i18n";
import { useThemeValue } from "@/hooks/useTheme";
import { useDocumentVisible } from "@/hooks/useDocumentVisible";
import { useResizablePane } from "@/hooks/useResizablePane";
@@ -76,6 +76,9 @@ import { WorkspaceSettings } from "./WorkspaceSettings";
import { WorkspaceExplorer } from "./WorkspaceExplorer";
import { WorkspaceFileViewer } from "./WorkspaceFileViewer";
import { PaneChat } from "./PaneChat";
+import { NewPaneChat } from "./NewPaneChat";
+import type { NewPaneRequest } from "@/store/newPaneChat";
+import type { ChatAttachment } from "@/lib/agentChatApi";
import { useIdeChatStore } from "@/store/ideChat";
import { PANE_ACTIVITY_EVENT, readPaneActivityChange } from "@/store/workspacePanes";
import type { WorkspaceView } from "@/components/agentic/workspaceView";
@@ -86,6 +89,8 @@ import {
closeTerminal,
closeTerminals,
moveTerminal,
+ promptTerminal,
+ waitForTerminalLive,
clearTerminalRecap,
fetchTerminalActivity,
fetchTerminalRecaps,
@@ -763,6 +768,27 @@ export function AgenticGrid({
* effects, so a pane closed by another client simply falls back.
*/
const [chatPane, setChatPane] = useState<string | null>(null);
+ /*
+ * The new chat, before it has an agent behind it.
+ *
+ * In chat mode "open a session" no longer means "pick a CLI from a menu and
+ * spawn it": it opens an EMPTY chat window whose composer chooses the coding
+ * agent, its model, its effort and its permission stance, and the first
+ * message is what starts the pane on those picks (maintainer report,
+ * 2026-08-27). The grid mode keeps its menu — there you are placing a
+ * terminal in a layout, not starting a conversation.
+ *
+ * `handover` is the sentence that opened a pane, carried to that pane's own
+ * chat so it is drawn from the first frame instead of after the CLI has
+ * written it down (see `PaneChat.firstMessage`).
+ */
+ const [drafting, setDrafting] = useState(false);
+ const [handover, setHandover] = useState<{
+ pane: string;
+ text: string;
+ attachments: ChatAttachment[];
+ atMs: number;
+ } | null>(null);
/*
* Which ONE pane is being read as its terminal instead of as its chat.
*
@@ -1426,6 +1452,23 @@ export function AgenticGrid({
*/
const stagedPane = chatView ? chatSelected : null;
const publishStagedPane = useIdeChatStore((s) => s.setStagedPane);
+ /*
+ * The session list asked for a new chat in THIS workspace.
+ *
+ * Read here rather than in the view because the draft lives on the stage,
+ * which is the grid's. A request naming another tab is left alone: the view
+ * switches to it first, and that workspace's own grid — this component,
+ * remounted — is the one that answers.
+ */
+ const newChatRequest = useIdeChatStore((s) => s.newChatRequest);
+ const lastNewChat = useRef(0);
+ useEffect(() => {
+ if (!newChatRequest || newChatRequest.workspaceId !== session.id) return;
+ if (newChatRequest.nonce === lastNewChat.current) return;
+ lastNewChat.current = newChatRequest.nonce;
+ setViewMode("chat");
+ setDrafting(true);
+ }, [newChatRequest, session.id, setViewMode]);
useEffect(() => {
// The app sidebar's session list marks the row being read from this.
publishStagedPane(stagedPane);
@@ -1478,12 +1521,84 @@ export function AgenticGrid({
* Open a terminal at the end of the row — asking WHAT first when the machine
* has more than one CLI installed. With a single one there is nothing to pick,
* so the click opens it straight away rather than showing a one-entry menu.
+ *
+ * In chat mode neither happens: a new chat is an empty chat window, and the
+ * CLI is chosen in its composer beside the model and the rest. Asking in a
+ * menu first and again in the composer afterwards would be the same question
+ * twice, in two places, with the menu's answer unchangeable.
*/
const openTerminal = (surface: "empty") => {
+ if (chatView) {
+ setDrafting(true);
+ return;
+ }
if (offersChoice) setPicking((current) => (current === surface ? null : surface));
else void split(null, "right");
};
+ /**
+ * A new chat's first message: open the pane on its picks, then say it.
+ *
+ * The order matters and is the whole feature. The picks go on the CLI's
+ * command line (`POST /terminals`), so they are what the process actually
+ * starts under — not a label applied to something already running. Only then
+ * is the sentence delivered, and only after the pane's process is really up:
+ * a prompt sent while it is still `pending` is refused outright.
+ *
+ * The stage moves to the pane as soon as it exists, carrying the sentence
+ * with it, so the person sees their own message under the agent they picked
+ * while the CLI is still starting.
+ */
+ const startChat = useCallback(
+ async (request: NewPaneRequest) => {
+ const known = new Set(session.terminals.map((term) => term.name));
+ const next = await addTerminal({
+ agent: request.agent,
+ model: request.model || undefined,
+ effort: request.effort || undefined,
+ permission_mode: request.permissionMode || undefined,
+ });
+ onSessionChanged?.(next);
+ const added = next.terminals.find((term) => !known.has(term.name));
+ if (!added) throw new Error(t("agentic_grid.new_chat.no_pane"));
+ setHandover({
+ pane: added.name,
+ text: request.text,
+ attachments: request.attachments,
+ atMs: Date.now(),
+ });
+ setChatPane(added.name);
+ setTarget(added.name);
+ setTerminalPane(null);
+ setDrafting(false);
+ // Deliberately not awaited by the composer's send: the draft is already
+ // gone and the pane's own chat is on screen drawing the sentence. What
+ // is left is delivery, and a failure there is reported where the
+ // conversation now is.
+ void (async () => {
+ try {
+ if (!(await waitForTerminalLive(added.name))) {
+ throw new Error(fill(t("agentic_grid.new_chat.never_started"), { pane: added.name }));
+ }
+ const result = await promptTerminal(added.name, request.text, { compose: false });
+ if (result.submitted === false) {
+ setHandover(null);
+ pushToast(
+ "warning",
+ fill(t("agentic_grid.new_chat.not_taken"), { pane: added.name }),
+ );
+ }
+ } catch (error) {
+ setHandover(null);
+ pushToast("error", error instanceof Error ? error.message : String(error));
+ }
+ })();
+ },
+ // Read at the moment of the send, like every other pane-opening path here.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [session.terminals, onSessionChanged, t],
+ );
+
/*
* A pane that MOVED has to be seen landing.
*
@@ -2592,6 +2707,27 @@ export function AgenticGrid({
worked={activityOf(stagedTerm).worked}
status={stagedTerm.status}
onShowTerminal={() => setTerminalPane(stagedTerm.name)}
+ // The sentence that OPENED this pane, when it came from a new
+ // chat: drawn from the first frame, because the pane exists
+ // because of it (see PaneChat.firstMessage).
+ firstMessage={handover?.pane === stagedTerm.name ? handover : undefined}
+ />
+ )}
+ {/*
+ The new chat: an empty chat window, no agent behind it yet.
+
+ Over the stage rather than beside it, because it IS the stage while
+ it is open — there is one conversation in front of the user at a
+ time, and a draft is one of them. It draws nothing of its own except
+ a header: the column, the empty page and the composer with its picks
+ are the same `ChatStage` every other chat here uses.
+ */}
+ {chatView && drafting && (
+ <NewPaneChat
+ folder={session.folder}
+ agents={agents ?? []}
+ onOpen={startChat}
+ onDismiss={() => setDrafting(false)}
/>
)}
{/*
diff --git a/jarvis/ui/web/frontend/src/components/agentic/NewPaneChat.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/NewPaneChat.test.tsx
new file mode 100644
index 0000000000..127d94539c
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentic/NewPaneChat.test.tsx
@@ -0,0 +1,131 @@
+/**
+ * The new chat: an empty chat window with no agent behind it yet.
+ *
+ * What the store decides is pinned in store/newPaneChat.test.ts; here it is
+ * the window around it — that it IS the front page's chat (the folder
+ * headline, the composer with its picks), that the coding CLIs are what the
+ * provider pick offers, and that opening it starts nothing until a message is
+ * sent. That last one is the whole point of the surface: the picks have to be
+ * choosable while nothing is running, because they go on the CLI's command
+ * line when it starts.
+ */
+import { cleanup, fireEvent, render, screen, within } from "@testing-library/react";
+import { afterEach, describe, expect, it, vi } from "vitest";
+
+import { NewPaneChat } from "@/components/agentic/NewPaneChat";
+import type { SplitAgentChoice } from "@/components/agentic/AgentPicker";
+import type { NewPaneRequest } from "@/store/newPaneChat";
+import { useEventStore } from "@/store/events";
+
+const CLAUDE: SplitAgentChoice = {
+ name: "claude",
+ displayName: "Claude Code",
+ installed: true,
+ kind: "cli",
+ picks: {
+ models: [
+ { id: "claude-opus-5", label: "Claude Opus 5" },
+ { id: "claude-sonnet-5", label: "Claude Sonnet 5" },
+ ],
+ defaultModel: "",
+ effortLevels: ["low", "medium", "high"],
+ defaultEffort: "high",
+ permissionModes: [
+ { id: "default", label: "Ask before acting", description: "Reads run freely." },
+ { id: "plan", label: "Plan", description: "Read and plan only." },
+ ],
+ defaultPermissionMode: "",
+ },
+};
+
+const CODEX: SplitAgentChoice = {
+ name: "codex",
+ displayName: "Codex",
+ installed: true,
+ kind: "cli",
+ picks: {
+ models: [{ id: "gpt-5.6-sol", label: "GPT-5.6 Sol" }],
+ defaultModel: "",
+ effortLevels: ["low", "medium", "high", "xhigh"],
+ defaultEffort: "medium",
+ permissionModes: [{ id: "auto", label: "Auto", description: "Edits run on their own." }],
+ defaultPermissionMode: "",
+ },
+};
+
+const SHELL: SplitAgentChoice = {
+ name: "shell",
+ displayName: "Plain Terminal",
+ installed: true,
+ kind: "shell",
+};
+
+function draw(overrides: Partial<React.ComponentProps<typeof NewPaneChat>> = {}) {
+ // The composer refuses to type while the app's socket is down, which in a
+ // test is simply "nobody connected it".
+ useEventStore.setState({ connected: true, wsWarming: false });
+ const onOpen = vi.fn(async (_request: NewPaneRequest) => undefined);
+ const onDismiss = vi.fn();
+ render(
+ <NewPaneChat
+ folder="C:/work/personal-jarvis"
+ agents={[CLAUDE, CODEX, SHELL]}
+ onOpen={onOpen}
+ onDismiss={onDismiss}
+ {...overrides}
+ />,
+ );
+ return { onOpen, onDismiss };
+}
+
+afterEach(cleanup);
+
+describe("the Agentic IDE's new chat", () => {
+ it("is an empty chat window on the workspace's folder", () => {
+ draw();
+ expect(screen.getByTestId("new-pane-chat")).toBeTruthy();
+ // The front page's own empty page, headlined by the folder the agent will
+ // work in — not a dialog of its own.
+ const stage = screen.getByTestId("chat-stage");
+ expect(stage.dataset.empty).toBe("true");
+ expect(screen.getByTestId("chat-folder-headline").textContent).toContain("personal-jarvis");
+ });
+
+ it("offers the coding CLIs, and not the plain terminal", () => {
+ draw();
+ fireEvent.click(screen.getByTestId("composer-provider"));
+ const menu = screen.getByRole("listbox");
+ expect(within(menu).getByText("Claude Code")).toBeTruthy();
+ expect(within(menu).getByText("Codex")).toBeTruthy();
+ // A shell has no conversation to have.
+ expect(within(menu).queryByText("Plain Terminal")).toBeNull();
+ });
+
+ it("opens nothing while the picks are being made", () => {
+ const { onOpen } = draw();
+ fireEvent.click(screen.getByTestId("composer-provider"));
+ fireEvent.click(screen.getByText("Codex"));
+ expect(onOpen).not.toHaveBeenCalled();
+ });
+
+ it("starts the pane on the picks when the first message is sent", async () => {
+ const { onOpen } = draw();
+ fireEvent.change(screen.getByRole("textbox"), {
+ target: { value: "read the router and tell me what it does" },
+ });
+ fireEvent.click(screen.getByTestId("composer-send"));
+ expect(onOpen).toHaveBeenCalledTimes(1);
+ expect(onOpen.mock.calls[0][0]).toMatchObject({
+ agent: "claude",
+ effort: "high",
+ text: "read the router and tell me what it does",
+ });
+ });
+
+ it("leaves without starting anything on Escape", () => {
+ const { onDismiss, onOpen } = draw();
+ fireEvent.keyDown(window, { key: "Escape" });
+ expect(onDismiss).toHaveBeenCalled();
+ expect(onOpen).not.toHaveBeenCalled();
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/NewPaneChat.tsx b/jarvis/ui/web/frontend/src/components/agentic/NewPaneChat.tsx
new file mode 100644
index 0000000000..59c2de30c5
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentic/NewPaneChat.tsx
@@ -0,0 +1,108 @@
+/**
+ * The Agentic IDE's new chat — an empty chat window with no agent behind it.
+ *
+ * Chat mode used to start a coding session the way the grid does: a menu asked
+ * WHICH CLI, a pane opened, and the conversation began on whatever that binary
+ * defaults to. From where the user sits that is the wrong order (maintainer
+ * report, 2026-08-27): a new chat should be an empty chat window, and the
+ * coding agent, its model, how hard it thinks and how often it asks should be
+ * chosen in the interface — in the composer's own picks, where every other
+ * chat in this app chooses them.
+ *
+ * So this is that window: the same `ChatStage` the front page and a running
+ * pane use, on a store that holds the picks instead of a conversation
+ * (`store/newPaneChat`). Its picker lists the coding CLIs the Agentic IDE has
+ * connected on this machine, each with its own models and ladders. Nothing is
+ * spawned while it is open — the first message is what opens the pane, WITH
+ * those picks on the CLI's command line, and from then on the pane's own chat
+ * takes over.
+ *
+ * The grid keeps its menu. There a pane is a pane: you are placing a terminal
+ * in a layout, not starting a conversation, and asking four questions before
+ * a split would be four questions too many.
+ */
+import { useEffect, useMemo } from "react";
+import { MessageSquarePlus } from "lucide-react";
+
+import { AgentChatStoreProvider } from "@/components/agentchat/AgentChatStoreContext";
+import type { SplitAgentChoice } from "@/components/agentic/AgentPicker";
+import { ChatStage } from "@/components/home/ChatStage";
+import {
+ createNewPaneChatStore,
+ type NewPaneChatStoreHook,
+ type NewPaneRequest,
+} from "@/store/newPaneChat";
+import { useT } from "@/i18n";
+
+export interface NewPaneChatProps {
+ /** The workspace folder the agent will work in. */
+ folder: string;
+ /** Every entry the backend registered, as the split menus receive them. */
+ agents: readonly SplitAgentChoice[];
+ /** Open the pane on these picks and deliver the first message. */
+ onOpen: (request: NewPaneRequest) => Promise<void>;
+ /** Leave the draft without starting anything. */
+ onDismiss: () => void;
+}
+
+export function NewPaneChat({ folder, agents, onOpen, onDismiss }: NewPaneChatProps) {
+ const t = useT();
+ // One store per draft. Keyed by folder in the caller, so opening a new chat
+ // in another workspace starts from that workspace's own picks rather than
+ // inheriting the last one's.
+ const store: NewPaneChatStoreHook = useMemo(
+ () => createNewPaneChatStore({ folder, agents, open: onOpen }),
+ // `agents` is rebuilt by the IDE's poll on every tick; rebuilding the store
+ // with it would throw away a half-typed sentence every few seconds. The
+ // list only changes when a CLI is installed, which is rare and worth a
+ // remount — so it is compared by what it says, not by identity.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [folder, agentsFingerprint(agents), onOpen],
+ );
+
+ // Escape leaves an empty draft, the way it closes any other overlay. A draft
+ // holds nothing but picks, so there is nothing to lose and nothing to
+ // confirm — and a window with no way out is a trap.
+ useEffect(() => {
+ const onKey = (event: KeyboardEvent) => {
+ if (event.key === "Escape") onDismiss();
+ };
+ window.addEventListener("keydown", onKey);
+ return () => window.removeEventListener("keydown", onKey);
+ }, [onDismiss]);
+
+ return (
+ <div
+ className="absolute inset-0 z-20 flex min-h-0 flex-col rounded-lg bg-background"
+ data-testid="new-pane-chat"
+ >
+ <header className="flex h-11 shrink-0 items-center gap-2 border-b border-border px-4">
+ <MessageSquarePlus className="h-4 w-4 shrink-0 text-primary" aria-hidden />
+ <span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">
+ {t("agentic_grid.new_chat.title")}
+ </span>
+ <button
+ type="button"
+ onClick={onDismiss}
+ data-testid="new-pane-chat-dismiss"
+ className="inline-flex h-8 items-center rounded-lg border border-border px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
+ >
+ {t("agentic_grid.new_chat.cancel")}
+ </button>
+ </header>
+
+ {/* The empty page every chat in this app opens on: the folder's name and
+ the composer in the middle, with the picks under the text box. */}
+ <AgentChatStoreProvider store={store}>
+ <ChatStage />
+ </AgentChatStoreProvider>
+ </div>
+ );
+}
+
+/** What the CLI list SAYS, so a poll that changes nothing remounts nothing. */
+function agentsFingerprint(agents: readonly SplitAgentChoice[]): string {
+ return agents
+ .map((agent) => `${agent.name}:${agent.installed ? 1 : 0}:${agent.picks?.models.length ?? 0}`)
+ .join("|");
+}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/PaneChat.tsx b/jarvis/ui/web/frontend/src/components/agentic/PaneChat.tsx
index a90fd6c9d4..636cb2a7d2 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/PaneChat.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/PaneChat.tsx
@@ -31,6 +31,7 @@ import { ChatStage } from "@/components/home/ChatStage";
import { useThemeValue } from "@/hooks/useTheme";
import { createPaneChatStore, type PaneChatStoreHook } from "@/store/paneChat";
import type { PaneActivity } from "@/lib/agenticIdeApi";
+import type { ChatAttachment } from "@/lib/agentChatApi";
import { fill, useT } from "@/i18n";
import { cn } from "@/lib/utils";
@@ -135,6 +136,14 @@ export interface PaneChatProps {
status?: string;
/** Back to the terminal itself — the question it is asking lives there. */
onShowTerminal: () => void;
+ /**
+ * The sentence this pane was opened WITH, when it came from a new chat.
+ *
+ * Drawn from the first frame rather than waited for: the pane was opened by
+ * the message, and a stage that showed nothing until the CLI had written it
+ * down would read as a message that went nowhere. See `PaneChatStoreOptions`.
+ */
+ firstMessage?: { text: string; attachments: ChatAttachment[]; atMs: number };
}
export function PaneChat({
@@ -153,6 +162,7 @@ export function PaneChat({
worked = false,
status = "live",
onShowTerminal,
+ firstMessage,
}: PaneChatProps) {
const t = useT();
// One store per staged pane. The stage is keyed by workspace and pane, so a
@@ -167,7 +177,12 @@ export function PaneChat({
agent,
displayName: agentLabel,
folder,
+ firstMessage,
}),
+ // The handover message belongs to THIS mount: it is seeded once and then
+ // settles from the record. Re-reading it would rebuild the store — and
+ // the conversation — every time the grid re-renders.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
[terminal, workspaceId, historyId, agent, agentLabel, folder],
);
useEffect(() => {
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.test.tsx
index 5fe4927bcc..8626b1231b 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.test.tsx
@@ -195,46 +195,30 @@ describe("the sidebar's chat face", () => {
expect(useIdeChatStore.getState().workspaceRequest).toMatchObject({ workspaceId: "w2" });
});
- it("opens a terminal straight away when only one CLI is installed", () => {
- render(<WorkspaceChats />);
- fireEvent.click(screen.getByTestId("workspace-chats-new-terminal-w2"));
- expect(screen.queryByTestId("workspace-chats-agent-menu-w2")).toBeNull();
- expect(useIdeChatStore.getState().terminalRequest).toMatchObject({
- workspaceId: "w2",
- agent: undefined,
- });
- });
-
- it("asks which CLI first when the machine offers more than one", () => {
+ /*
+ * One click, and no question before the chat exists.
+ *
+ * This button used to open a menu asking WHICH CLI, and that menu was the
+ * whole problem (maintainer report, 2026-08-27): it asked the smallest of
+ * the four questions a coding session actually has — agent, model, effort,
+ * permission stance — asked it first, alone, and left it unchangeable once
+ * the pane was running. A new chat is now an EMPTY chat window where all
+ * four are picked in the composer, so this button only has to open it.
+ */
+ it("opens an empty chat rather than asking which CLI", () => {
useIdeChatStore.setState({ agents: [CLAUDE, CODEX] });
render(<WorkspaceChats />);
fireEvent.click(screen.getByTestId("workspace-chats-new-terminal-w1"));
+ expect(useIdeChatStore.getState().newChatRequest).toMatchObject({ workspaceId: "w1" });
+ // Nothing is spawned by the click, and nothing is asked.
expect(useIdeChatStore.getState().terminalRequest).toBeNull();
- fireEvent.click(screen.getByTestId("workspace-chats-new-w1-codex"));
- expect(useIdeChatStore.getState().terminalRequest).toMatchObject({
- workspaceId: "w1",
- agent: "codex",
- });
+ expect(screen.queryByTestId("workspace-chats-agent-menu-w1")).toBeNull();
});
- /*
- * The menu must leave the column it was opened from.
- *
- * It used to hang INSIDE the list with a z-index of its own, which put the
- * picker's full-window dismiss layer on top of it: the entries were on
- * screen, every click on one hit that layer, and the menu closed without
- * opening anything. jsdom has no layout and so cannot see an overlap — what
- * it can check is the fact that rules it out, which is that the menu is
- * detached into a portal and owns its own stacking. The same detachment is
- * what keeps it from being clipped by the column's scroll box.
- */
- it("hangs the CLI menu outside the scrolling column", () => {
- useIdeChatStore.setState({ agents: [CLAUDE, CODEX] });
+ it("asks for the new chat in the workspace whose row was clicked", () => {
render(<WorkspaceChats />);
- fireEvent.click(screen.getByTestId("workspace-chats-new-terminal-w1"));
- const menu = screen.getByTestId("workspace-chats-agent-menu-w1");
- expect(menu.dataset.detached).toBe("true");
- expect(screen.getByTestId("workspace-chats").contains(menu)).toBe(false);
+ fireEvent.click(screen.getByTestId("workspace-chats-new-terminal-w2"));
+ expect(useIdeChatStore.getState().newChatRequest).toMatchObject({ workspaceId: "w2" });
});
it("opens the launcher for one more workspace, folder and all", () => {
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx
index 617ecc4cbe..ad6214711d 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx
@@ -9,11 +9,7 @@ import {
import { createPortal } from "react-dom";
import { Archive, Folder, FolderPlus, Plus, RotateCcw, Search, Trash2 } from "lucide-react";
-import {
- AgentPickerMenu,
- offersAgentChoice,
- type SplitAgentChoice,
-} from "@/components/agentic/AgentPicker";
+import type { SplitAgentChoice } from "@/components/agentic/AgentPicker";
import { AgentMark } from "@/components/agentic/AgentMark";
import { folderColor } from "@/components/agentic/folderColor";
import { PaneActivityPill } from "@/components/agentic/PaneActivityPill";
@@ -79,7 +75,7 @@ export function WorkspaceChats() {
const workspaces = useIdeChatStore((s) => s.workspaces);
const agents = useIdeChatStore((s) => s.agents);
const requestPane = useIdeChatStore((s) => s.requestPane);
- const requestTerminal = useIdeChatStore((s) => s.requestTerminal);
+ const requestNewChat = useIdeChatStore((s) => s.requestNewChat);
const requestWorkspace = useIdeChatStore((s) => s.requestWorkspace);
const requestSession = useIdeChatStore((s) => s.requestSession);
const requestAddWorkspace = useIdeChatStore((s) => s.requestAddWorkspace);
@@ -143,7 +139,7 @@ export function WorkspaceChats() {
agents={agents}
onOpenPane={(pane) => requestPane(workspace.id, pane)}
onOpenWorkspace={() => requestWorkspace(workspace.id)}
- onNewTerminal={(agent) => requestTerminal(workspace.id, agent)}
+ onNewChat={() => requestNewChat(workspace.id)}
onMenu={openMenu}
/>
);
@@ -228,7 +224,7 @@ function WorkspaceBand({
agents,
onOpenPane,
onOpenWorkspace,
- onNewTerminal,
+ onNewChat,
onMenu,
}: {
index: number;
@@ -239,32 +235,11 @@ function WorkspaceBand({
agents: SplitAgentChoice[];
onOpenPane: (pane: string) => void;
onOpenWorkspace: () => void;
- onNewTerminal: (agent?: string) => void;
+ onNewChat: () => void;
onMenu: (pane: WorkspacePaneRow, x: number, y: number) => void;
}) {
const t = useT();
- const [picking, setPicking] = useState(false);
- /*
- * The "+" the menu hangs off.
- *
- * Handing the picker an anchor is what detaches it into a portal, and this
- * surface needs that for two separate reasons. The list scrolls
- * (`overflow-y-auto`), so a menu drawn inside it is CLIPPED at the column's
- * edge — a workspace near the bottom would show a sliver of the first entry
- * and nothing else. And a menu placed inside its caller has to be given a
- * z-index by that caller, which is exactly how this menu became unclickable:
- * the class said `z-30`, tailwind-merge replaced the picker's own `z-50`
- * with it, and the picker's full-window dismiss layer (`z-40`) ended up ON
- * TOP of the list. Every click on a CLI hit that layer instead — the menu
- * closed and no terminal opened (maintainer report 2026-08-27). Detached,
- * the picker owns its own stacking and there is no number here to get wrong.
- */
- const plusRef = useRef<HTMLButtonElement | null>(null);
const label = workspace.name || folderLeaf(workspace.folder) || t("ide_chats.no_folder");
- const openTerminal = () => {
- if (offersAgentChoice(agents)) setPicking((current) => !current);
- else onNewTerminal();
- };
return (
<section
@@ -313,39 +288,26 @@ function WorkspaceBand({
/>
<span className="min-w-0 flex-1 truncate text-xs font-medium">{label}</span>
</button>
+ {/*
+ One click, no menu: a new chat here opens an EMPTY chat window and
+ the coding agent is chosen in its composer, beside the model, the
+ effort and the permission stance (maintainer report, 2026-08-27).
+ The menu that used to hang off this button asked the same question
+ in a worse place — first, alone, and unchangeable afterwards — so
+ it is gone from this surface. The grid's split menus keep it:
+ there a pane is a pane, and asking four questions before placing a
+ terminal would be four too many.
+ */}
<button
type="button"
- onClick={openTerminal}
- title={t("ide_chats.new_terminal")}
- aria-label={t("ide_chats.new_terminal")}
- aria-expanded={picking}
+ onClick={onNewChat}
+ title={t("ide_chats.new_chat")}
+ aria-label={t("ide_chats.new_chat")}
data-testid={`workspace-chats-new-terminal-${workspace.id}`}
- ref={plusRef}
- className={cn(
- "absolute right-1 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded text-muted-foreground transition-opacity hover:bg-background/60 hover:text-foreground focus-visible:opacity-100 group-hover/folder:opacity-100",
- // Stays lit while its own menu is open: the pointer leaves the row
- // to reach the list, and a button that faded out under it would
- // leave the menu hanging off nothing.
- picking ? "text-foreground opacity-100" : "opacity-0",
- )}
+ className="absolute right-1 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-background/60 hover:text-foreground focus-visible:opacity-100 group-hover/folder:opacity-100"
>
<Plus className="h-3 w-3" />
</button>
- {picking && (
- <AgentPickerMenu
- title={t("ide_chats.pick_cli_title")}
- ariaLabel={t("ide_chats.pick_cli_aria")}
- agents={agents}
- testId={`workspace-chats-agent-menu-${workspace.id}`}
- itemTestId={(agent) => `workspace-chats-new-${workspace.id}-${agent}`}
- anchorTo={plusRef.current}
- onDismiss={() => setPicking(false)}
- onPick={(agent) => {
- setPicking(false);
- onNewTerminal(agent);
- }}
- />
- )}
</div>
{panes.length === 0 && archived.length === 0 ? (
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.json
index f546227025..79dc1280e2 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json
@@ -4855,6 +4855,7 @@
"no_folder": "Kein Ordner",
"no_workspaces": "Kein Workspace ist geöffnet.",
"no_sessions": "Noch keine Coding-Sitzungen hier",
+ "new_chat": "Neuer Chat — Agent und Modell im Chat wählen",
"new_terminal": "Neues Terminal hier",
"pick_cli_title": "Terminal öffnen — womit?",
"new_session": "Neue Sitzung — ein Workspace ohne Projektordner",
@@ -4990,6 +4991,14 @@
"steps_many": "{0} Arbeitsschritte",
"grip_hint": "Klicken: Verlauf öffnen · Ziehen: scrollen"
},
+ "new_chat": {
+ "title": "Neuer Chat",
+ "cancel": "Abbrechen",
+ "pick_an_agent": "Wähle zuerst einen Coding-Agenten.",
+ "no_pane": "Der Workspace hat die neue Sitzung nicht gemeldet.",
+ "never_started": "{pane} ist nicht gestartet — es wurde nichts gesendet.",
+ "not_taken": "{pane} hat die Nachricht nicht übernommen; sie steht in der Eingabezeile."
+ },
"pane_chat": {
"open": "{0} als Chat lesen",
"show_terminal": "Terminal zeigen",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.json
index 2124387c63..1e200f2ff2 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json
@@ -4855,6 +4855,7 @@
"no_folder": "No folder",
"no_workspaces": "No workspace is open.",
"no_sessions": "No coding sessions here yet",
+ "new_chat": "New chat — pick the agent and its model in the chat",
"new_terminal": "New terminal here",
"pick_cli_title": "Open a terminal — what?",
"new_session": "New session — a workspace with no project folder",
@@ -4990,6 +4991,14 @@
"steps_many": "{0} tool steps",
"grip_hint": "Click: open history · drag: scroll"
},
+ "new_chat": {
+ "title": "New chat",
+ "cancel": "Cancel",
+ "pick_an_agent": "Pick a coding agent first.",
+ "no_pane": "The workspace did not report the new session.",
+ "never_started": "{pane} did not start — nothing was sent.",
+ "not_taken": "{pane} did not accept the message; it is waiting in its input line."
+ },
"pane_chat": {
"open": "Read {0} as a chat",
"show_terminal": "Show terminal",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.json
index 3a57292e20..15b4ec958a 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json
@@ -4855,6 +4855,7 @@
"no_folder": "Sin carpeta",
"no_workspaces": "No hay ningún workspace abierto.",
"no_sessions": "Aún no hay sesiones de código aquí",
+ "new_chat": "Nuevo chat — elegir el agente y su modelo en el chat",
"new_terminal": "Nuevo terminal aquí",
"pick_cli_title": "Abrir un terminal — ¿con qué?",
"new_session": "Nueva sesión — un workspace sin carpeta de proyecto",
@@ -4990,6 +4991,14 @@
"steps_many": "{0} pasos de herramienta",
"grip_hint": "Clic: abrir historial · arrastrar: desplazar"
},
+ "new_chat": {
+ "title": "Nuevo chat",
+ "cancel": "Cancelar",
+ "pick_an_agent": "Elige primero un agente de código.",
+ "no_pane": "El workspace no informó de la nueva sesión.",
+ "never_started": "{pane} no se inició — no se envió nada.",
+ "not_taken": "{pane} no aceptó el mensaje; está en su línea de entrada."
+ },
"pane_chat": {
"open": "Leer {0} como chat",
"show_terminal": "Mostrar terminal",
diff --git a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
index 05cdb8984e..ca436066bd 100644
--- a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
@@ -1273,6 +1273,40 @@ export async function addTerminal(payload: {
* drag that raced a voice-opened pane is quietly declined, and the returned
* state carries the authoritative tree either way.
*/
+/**
+ * Wait until a just-opened pane's process is actually running.
+ *
+ * Opening a pane and typing into it are two different moments: `POST
+ * /terminals` records the pane, and the PTY starts when a viewer attaches to
+ * it — so a prompt sent in the same breath is refused with "not running right
+ * now (status: pending)". The backend already waits for the CLI's INPUT LINE
+ * once the process exists (`fleet_actions.wait_for_prompt_ready`); this is the
+ * step before that one.
+ *
+ * Resolves true when the pane reports `live`, false when the wait runs out or
+ * the pane is gone — the caller says so rather than sending into the dark.
+ */
+export async function waitForTerminalLive(
+ name: string,
+ { timeoutMs = 20_000, pollMs = 250 }: { timeoutMs?: number; pollMs?: number } = {},
+): Promise<boolean> {
+ const deadline = Date.now() + timeoutMs;
+ for (;;) {
+ try {
+ const state = await fetchIdeState();
+ const term = state.session?.terminals.find((t) => t.name === name);
+ const status = term?.status;
+ if (status === "live") return true;
+ // Gone, exited or failed are settled answers: waiting cannot help.
+ if (status !== "pending") return false;
+ } catch {
+ // A failed poll is not an answer either way; try again until the clock runs out.
+ }
+ if (Date.now() >= deadline) return false;
+ await new Promise((resolve) => setTimeout(resolve, pollMs));
+ }
+}
+
export async function saveLayoutWeights(layout: LayoutNode): Promise<SessionState> {
const res = await fetch("/api/agentic-ide/layout/weights", {
method: "POST",
diff --git a/jarvis/ui/web/frontend/src/store/agentChat.ts b/jarvis/ui/web/frontend/src/store/agentChat.ts
index c63b58ac59..b10ea83bd9 100644
--- a/jarvis/ui/web/frontend/src/store/agentChat.ts
+++ b/jarvis/ui/web/frontend/src/store/agentChat.ts
@@ -85,6 +85,20 @@ export interface ProviderOption extends AgentChatProvider {
connected: boolean;
/** The sub-agent marked active on the Agents tab. */
active: boolean;
+ /**
+ * Draw this row with a CODING AGENT's mark rather than a provider-family
+ * logo, naming the workspace entry whose mark it is ("opencode", "kimi").
+ *
+ * The catalog's rows are brands the provider table knows; the Agentic IDE's
+ * rows are the CLIs installed on this machine, and several of them —
+ * OpenCode, Kimi, GLM — are marks only `AgentMark` carries. Without this the
+ * IDE's picker would fall back to a letter in a box, which is the one thing
+ * a logo must never be here. Absent for every catalog row, which keeps the
+ * front page's picker exactly as it was.
+ */
+ agentMark?: string;
+ /** A mark the entry brings itself — the file a user uploaded for their own CLI. */
+ logoUrl?: string;
}
export interface AgentChatStore {
diff --git a/jarvis/ui/web/frontend/src/store/ideChat.ts b/jarvis/ui/web/frontend/src/store/ideChat.ts
index 499f4abe3e..ff0fd194aa 100644
--- a/jarvis/ui/web/frontend/src/store/ideChat.ts
+++ b/jarvis/ui/web/frontend/src/store/ideChat.ts
@@ -84,6 +84,18 @@ interface IdeChatStore {
workspaceRequest: { workspaceId: string; nonce: number } | null;
/** The sidebar asking for a workspace with no project folder (a scratch session). */
sessionRequest: { nonce: number } | null;
+ /**
+ * The sidebar asking for a NEW CHAT in one workspace — an empty chat window
+ * rather than a spawned pane.
+ *
+ * The distinction chat mode is built on (maintainer report, 2026-08-27): a
+ * new conversation starts with nothing running, and the coding agent, its
+ * model, its effort and its permission stance are chosen in the composer
+ * before the first message opens the pane on them. `terminalRequest` stays
+ * what it always was — "open a pane of this CLI now" — and is what the grid
+ * mode's own menus keep using.
+ */
+ newChatRequest: { workspaceId: string; nonce: number } | null;
/**
* The sidebar asking to open ANOTHER workspace — folder and all.
*
@@ -114,6 +126,8 @@ interface IdeChatStore {
setAgents: (agents: SplitAgentChoice[]) => void;
/** Open a new terminal in `workspaceId`, running `agent` when one was picked. */
requestTerminal: (workspaceId: string, agent?: string) => void;
+ /** Open an empty chat in `workspaceId`; its first message starts the pane. */
+ requestNewChat: (workspaceId: string) => void;
/** Bring `workspaceId`'s tab to the front. */
requestWorkspace: (workspaceId: string) => void;
requestSession: () => void;
@@ -129,6 +143,7 @@ export const useIdeChatStore = create<IdeChatStore>((set) => ({
workspaces: [],
agents: [],
terminalRequest: null,
+ newChatRequest: null,
workspaceRequest: null,
sessionRequest: null,
addWorkspaceRequest: null,
@@ -158,6 +173,10 @@ export const useIdeChatStore = create<IdeChatStore>((set) => ({
nonce: (state.terminalRequest?.nonce ?? 0) + 1,
},
})),
+ requestNewChat: (workspaceId) =>
+ set((state) => ({
+ newChatRequest: { workspaceId, nonce: (state.newChatRequest?.nonce ?? 0) + 1 },
+ })),
requestWorkspace: (workspaceId) =>
set((state) => ({
workspaceRequest: { workspaceId, nonce: (state.workspaceRequest?.nonce ?? 0) + 1 },
diff --git a/jarvis/ui/web/frontend/src/store/newPaneChat.test.ts b/jarvis/ui/web/frontend/src/store/newPaneChat.test.ts
new file mode 100644
index 0000000000..4788e0b311
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/store/newPaneChat.test.ts
@@ -0,0 +1,207 @@
+import { describe, expect, it, vi } from "vitest";
+
+import type { SplitAgentChoice } from "@/components/agentic/AgentPicker";
+import {
+ chatStartableAgents,
+ createNewPaneChatStore,
+ firstStartableAgent,
+ seedDraft,
+ type NewPaneRequest,
+} from "@/store/newPaneChat";
+
+/**
+ * The new chat, before it has an agent behind it.
+ *
+ * The one thing worth pinning here is the ORDER: the picks are chosen while
+ * nothing is running, and the first message is what starts the pane on them.
+ * Get that backwards and the picker is decoration — a pill saying "Opus" over
+ * a process that was started on whatever the CLI defaults to, which is exactly
+ * the bug this replaced.
+ */
+
+const CLAUDE: SplitAgentChoice = {
+ name: "claude",
+ displayName: "Claude Code",
+ installed: true,
+ kind: "cli",
+ picks: {
+ models: [
+ { id: "claude-opus-5", label: "Claude Opus 5" },
+ { id: "claude-sonnet-5", label: "Claude Sonnet 5" },
+ ],
+ defaultModel: "",
+ effortLevels: ["low", "medium", "high"],
+ defaultEffort: "high",
+ permissionModes: [
+ { id: "default", label: "Ask before acting", description: "…" },
+ { id: "plan", label: "Plan", description: "…" },
+ ],
+ defaultPermissionMode: "",
+ },
+};
+
+const CODEX: SplitAgentChoice = {
+ name: "codex",
+ displayName: "Codex",
+ installed: true,
+ kind: "cli",
+ picks: {
+ models: [{ id: "gpt-5.6-sol", label: "GPT-5.6 Sol" }],
+ defaultModel: "",
+ effortLevels: ["low", "medium", "high", "xhigh"],
+ defaultEffort: "medium",
+ permissionModes: [{ id: "auto", label: "Auto", description: "…" }],
+ defaultPermissionMode: "",
+ },
+};
+
+const SHELL: SplitAgentChoice = {
+ name: "shell",
+ displayName: "Plain Terminal",
+ installed: true,
+ kind: "shell",
+};
+
+const HARNESS: SplitAgentChoice = {
+ name: "deepseek-harness",
+ displayName: "DeepSeek Harness",
+ installed: true,
+ kind: "cli",
+ acceptsPrompts: false,
+};
+
+const MISSING: SplitAgentChoice = {
+ name: "kimi",
+ displayName: "Kimi Code",
+ installed: false,
+ kind: "cli",
+};
+
+function store(agents: SplitAgentChoice[], open = vi.fn(async () => undefined)) {
+ return {
+ hook: createNewPaneChatStore({ folder: "C:/work/app", agents, open }),
+ open,
+ };
+}
+
+describe("the Agentic IDE's new chat", () => {
+ it("offers the coding CLIs this machine has, not the chat catalog's providers", () => {
+ const { hook } = store([CLAUDE, CODEX, MISSING]);
+ expect(hook.getState().providerOptions().map((p) => p.id)).toEqual([
+ "claude",
+ "codex",
+ "kimi",
+ ]);
+ });
+
+ it("leaves out anything there would be nothing to say to", () => {
+ // A shell is a prompt, not an agent; the Harness reads its own chat in a
+ // browser and never sees what is typed into its pane.
+ expect(chatStartableAgents([CLAUDE, SHELL, HARNESS]).map((a) => a.name)).toEqual(["claude"]);
+ });
+
+ it("keeps a CLI that is not installed, disabled, rather than hiding it", () => {
+ const { hook } = store([CLAUDE, MISSING]);
+ const kimi = hook.getState().providerById("kimi");
+ expect(kimi).not.toBeNull();
+ expect(kimi?.connected).toBe(false);
+ expect(kimi?.cli_installed).toBe(false);
+ });
+
+ it("draws each row with its own CLI mark, never a letter in a box", () => {
+ const { hook } = store([CLAUDE, MISSING]);
+ expect(hook.getState().providerOptions().map((p) => p.agentMark)).toEqual([
+ "claude",
+ "kimi",
+ ]);
+ });
+
+ it("opens on the first installed CLI and its defaults", () => {
+ const { hook } = store([MISSING, CLAUDE]);
+ expect(firstStartableAgent([MISSING, CLAUDE])?.name).toBe("claude");
+ expect(hook.getState().draft).toMatchObject({
+ provider: "claude",
+ effort: "high",
+ model: "",
+ permissionMode: "",
+ cwd: "C:/work/app",
+ });
+ });
+
+ it("re-seats the other picks when the CLI changes", async () => {
+ // A model, a ladder step and a stance belong to ONE CLI's vocabulary.
+ // Carrying Claude's "high" onto Codex would leave a pick Codex may not
+ // take, and the model would be one it would reject outright.
+ const { hook } = store([CLAUDE, CODEX]);
+ await hook.getState().setDraft({ model: "claude-opus-5" });
+ expect(hook.getState().draft.model).toBe("claude-opus-5");
+ await hook.getState().setDraft({ provider: "codex" });
+ expect(hook.getState().draft).toMatchObject({
+ provider: "codex",
+ model: "",
+ effort: "medium",
+ });
+ });
+
+ it("starts nothing until the first message", async () => {
+ const { hook, open } = store([CLAUDE, CODEX]);
+ await hook.getState().setDraft({ provider: "codex", model: "gpt-5.6-sol" });
+ await hook.getState().setDraft({ effort: "xhigh" });
+ expect(open).not.toHaveBeenCalled();
+ });
+
+ it("opens the pane ON the picks, with the message", async () => {
+ const open = vi.fn(async (_: NewPaneRequest) => undefined);
+ const { hook } = store([CLAUDE, CODEX], open);
+ await hook.getState().setDraft({ provider: "codex" });
+ await hook.getState().setDraft({ model: "gpt-5.6-sol", effort: "xhigh" });
+ await hook.getState().setDraft({ permissionMode: "auto" });
+ await hook.getState().send("refactor the parser", []);
+ expect(open).toHaveBeenCalledWith({
+ agent: "codex",
+ model: "gpt-5.6-sol",
+ effort: "xhigh",
+ permissionMode: "auto",
+ text: "refactor the parser",
+ attachments: [],
+ });
+ });
+
+ it("says so instead of opening nothing when no CLI is picked", async () => {
+ const open = vi.fn(async () => undefined);
+ const { hook } = store([], open);
+ await hook.getState().send("hello", []);
+ expect(open).not.toHaveBeenCalled();
+ expect(hook.getState().lastError).toBeTruthy();
+ });
+
+ it("keeps the draft when the pane could not be opened", async () => {
+ // The sentence is the person's; a failed spawn must not swallow it.
+ const open = vi.fn(async () => {
+ throw new Error("Claude Code is not on PATH.");
+ });
+ const { hook } = store([CLAUDE], open);
+ await hook.getState().send("hello", []);
+ expect(hook.getState().lastError).toBe("Claude Code is not on PATH.");
+ expect(hook.getState().draft.provider).toBe("claude");
+ expect(hook.getState().busy).toBe(false);
+ });
+
+ it("switches Plan on and back to the stance it came from", async () => {
+ const { hook } = store([CLAUDE]);
+ await hook.getState().setDraft({ permissionMode: "default", buildMode: "default" });
+ await hook.getState().setPlan(true);
+ expect(hook.getState().draft.permissionMode).toBe("plan");
+ await hook.getState().setPlan(false);
+ expect(hook.getState().draft.permissionMode).toBe("default");
+ });
+
+ it("seeds a CLI with no picks as 'whatever it defaults to'", () => {
+ expect(seedDraft(MISSING, "C:/work/app")).toMatchObject({
+ provider: "kimi",
+ model: "",
+ effort: "",
+ permissionMode: "",
+ });
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/store/newPaneChat.ts b/jarvis/ui/web/frontend/src/store/newPaneChat.ts
new file mode 100644
index 0000000000..82a485052e
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/store/newPaneChat.ts
@@ -0,0 +1,281 @@
+import { create } from "zustand";
+
+import { EMPTY_TIMELINE, type Timeline } from "@/components/agentchat/reduce";
+import type { AgentLaunchPicks, SplitAgentChoice } from "@/components/agentic/AgentPicker";
+import type { AgentChatCatalog, AgentChatProvider, AgentChatSession } from "@/lib/agentChatApi";
+import type { ChatAttachment } from "@/lib/agentChatApi";
+import { type AgentChatStore, type ComposerDraft, type ProviderOption } from "@/store/agentChat";
+import { useEventStore } from "@/store/events";
+import { translate } from "@/i18n";
+
+/**
+ * A chat that has no agent behind it YET — the Agentic IDE's new chat.
+ *
+ * Everywhere else in this app a chat surface is opened ON something: a pane
+ * that is already running, a session that already exists. Chat mode used to be
+ * the same, and that is what made starting one awkward — the CLI had to be
+ * chosen from a menu before there was anywhere to type, and the model, the
+ * effort and the permission stance could not be chosen at all, because by then
+ * the process was already running on the vendor's defaults (maintainer report,
+ * 2026-08-27: a new chat should be an EMPTY chat window where the coding agent
+ * and its model are picked in the interface).
+ *
+ * So this store is the chat before the agent: it wears the same
+ * `AgentChatStore` shape the stage and the composer read, its picker lists the
+ * coding CLIs the Agentic IDE has connected on this machine rather than the
+ * chat catalog's providers, and its picks are ordinary local state that
+ * nothing has to be asked about — because nothing is running to ask.
+ *
+ * `send` is where the chat becomes real: the pane is opened WITH those picks
+ * (`POST /terminals`, which puts them on the CLI's command line) and the first
+ * message goes into it. From that moment the pane's own store takes over and
+ * this one is dropped — a draft is a thing you use once.
+ */
+
+/** How one CLI's launch picks reach the composer, as a catalog row. */
+export function agentAsProvider(agent: SplitAgentChoice): ProviderOption {
+ const picks: AgentLaunchPicks = agent.picks ?? {
+ models: [],
+ defaultModel: "",
+ effortLevels: [],
+ defaultEffort: "",
+ permissionModes: [],
+ defaultPermissionMode: "",
+ };
+ const row: AgentChatProvider = {
+ id: agent.name,
+ label: agent.displayName,
+ // The mark is `AgentMark`'s, so the family is only ever a search word here.
+ family: agent.name,
+ // Every row in this list runs a vendor CLI in a terminal; saying so is what
+ // files them under "Coding CLIs" in the composer's own grouping.
+ runner: "cli",
+ models_source: "curated",
+ curated_models: picks.models,
+ default_model: picks.defaultModel,
+ keyless: false,
+ native_resume: false,
+ effort_levels: picks.effortLevels,
+ default_effort: picks.defaultEffort,
+ permission_modes: picks.permissionModes,
+ default_permission_mode: picks.defaultPermissionMode,
+ cli_installed: agent.installed,
+ // Nothing is running to complete against: a "/" here would open a list of
+ // commands belonging to a process that does not exist yet.
+ typeahead: [],
+ };
+ return {
+ ...row,
+ // "Connected" is simply "installed" for a CLI seat: a coding CLI spends a
+ // subscription login it manages itself, and this app has no key to check.
+ connected: agent.installed,
+ active: false,
+ agentMark: agent.name,
+ logoUrl: agent.logoUrl,
+ };
+}
+
+/**
+ * Which entries a NEW chat may be started on.
+ *
+ * Every coding CLI the Agentic IDE knows, installed or not — an entry that is
+ * missing stays listed and disabled with the composer's own "not installed"
+ * hint, so its absence is visible and explains itself. Two kinds are left out
+ * because there would be nothing to say to them: a plain terminal is a shell
+ * prompt rather than an agent, and an entry whose interface lives elsewhere
+ * (DeepSeek Harness puts its chat in the browser) never reads what is typed
+ * into its pane.
+ */
+export function chatStartableAgents(agents: readonly SplitAgentChoice[]): SplitAgentChoice[] {
+ return agents.filter(
+ (agent) => (agent.kind ?? "cli") === "cli" && (agent.acceptsPrompts ?? true),
+ );
+}
+
+/** The entry a fresh draft starts on: the first installed one, else the first. */
+export function firstStartableAgent(agents: readonly SplitAgentChoice[]): SplitAgentChoice | null {
+ const startable = chatStartableAgents(agents);
+ return startable.find((agent) => agent.installed) ?? startable[0] ?? null;
+}
+
+/** What `send` hands back to the surface that owns the workspace. */
+export interface NewPaneRequest {
+ agent: string;
+ model: string;
+ effort: string;
+ permissionMode: string;
+ text: string;
+ attachments: ChatAttachment[];
+}
+
+export interface NewPaneChatOptions {
+ /** The workspace folder — the empty page's headline and the pane's cwd. */
+ folder: string;
+ /** Every entry the backend registered, as the split menus receive them. */
+ agents: readonly SplitAgentChoice[];
+ /**
+ * Open the pane and deliver the first message.
+ *
+ * Owned by the grid rather than performed here: opening a pane rearranges a
+ * workspace, waits for the CLI's input line and moves the stage — all of
+ * which belong to the surface that draws them. A rejection leaves the draft
+ * exactly as it was, so the sentence someone typed is never lost to a failed
+ * spawn.
+ */
+ open: (request: NewPaneRequest) => Promise<void>;
+}
+
+export interface NewPaneChatState extends AgentChatStore {
+ /** Every CLI a chat may be started on, in the picker's order. */
+ startable: SplitAgentChoice[];
+}
+
+export type NewPaneChatStoreHook = ReturnType<typeof createNewPaneChatStore>;
+
+/** The picks a fresh draft opens with for one entry. */
+export function seedDraft(agent: SplitAgentChoice | null, folder: string): ComposerDraft {
+ const picks = agent?.picks;
+ const permission = picks?.defaultPermissionMode ?? "";
+ return {
+ provider: agent?.name ?? "",
+ model: picks?.defaultModel ?? "",
+ effort: picks?.defaultEffort ?? "",
+ permissionMode: permission,
+ // Where Plan switches back TO. A stance of "" means the CLI's own, which
+ // is the right thing to return to as well.
+ buildMode: permission === "plan" ? "" : permission,
+ cwd: folder,
+ };
+}
+
+export function createNewPaneChatStore(options: NewPaneChatOptions) {
+ const startable = chatStartableAgents(options.agents);
+ const rows: ProviderOption[] = startable.map(agentAsProvider);
+ const catalog: AgentChatCatalog = {
+ providers: rows,
+ default_cwd: options.folder,
+ shell: "",
+ };
+ const first = firstStartableAgent(options.agents);
+
+ const session = (draft: ComposerDraft): AgentChatSession => ({
+ // No id: nothing has been created, and handing out a made-up one would
+ // send the composer's file attach to a session the backend cannot find.
+ session_id: "",
+ title: startable.find((a) => a.name === draft.provider)?.displayName ?? "",
+ provider: draft.provider,
+ model: draft.model,
+ effort: draft.effort,
+ cwd: options.folder,
+ permission_mode: draft.permissionMode,
+ surface: "agent",
+ vendor_session: null,
+ created_ms: 0,
+ updated_ms: 0,
+ message_count: 0,
+ preview: "",
+ running: false,
+ });
+
+ return create<NewPaneChatState>((set, get) => {
+ const initial = seedDraft(first, options.folder);
+ return {
+ surface: "agent",
+ startable,
+ catalog,
+ connections: [],
+ catalogError: null,
+ backendOutdated: false,
+ liveModels: {},
+ health: {},
+ sessions: [],
+ activeSessionId: null,
+ activeSession: session(initial),
+ timeline: EMPTY_TIMELINE as Timeline,
+ socketState: "open",
+ draft: initial,
+ busy: false,
+ lastError: null,
+
+ // The list is handed in whole, from the poll the IDE already runs; there
+ // is no second catalog to fetch and nothing to wait for.
+ loadCatalog: async () => undefined,
+ loadSessions: async () => undefined,
+ loadModels: async () => undefined,
+ loadHealth: async () => undefined,
+ providerOptions: () => rows,
+ providerById: (id) => rows.find((row) => row.id === id) ?? null,
+
+ setDraft: async (patch: Partial<ComposerDraft>) => {
+ const current = get().draft;
+ let next: ComposerDraft = { ...current, ...patch };
+ // Changing the CLI re-seats the other three on the new one's defaults:
+ // a model, a ladder step and a stance belong to one CLI's vocabulary,
+ // and carrying them across would leave picks the next CLI cannot take.
+ if (patch.provider !== undefined && patch.provider !== current.provider) {
+ const agent = startable.find((a) => a.name === patch.provider) ?? null;
+ next = { ...seedDraft(agent, options.folder), ...stripPicks(patch) };
+ }
+ set({ draft: next, activeSession: session(next) });
+ },
+
+ setPlan: async (on: boolean) => {
+ const current = get().draft;
+ const next: ComposerDraft = on
+ ? { ...current, permissionMode: "plan", buildMode: current.buildMode }
+ : { ...current, permissionMode: current.buildMode };
+ set({ draft: next, activeSession: session(next) });
+ },
+
+ newChat: () => set({ draft: seedDraft(first, options.folder) }),
+ openSession: () => undefined,
+ removeSession: async () => undefined,
+
+ send: async (text: string, attachments: ChatAttachment[] = []) => {
+ const draft = get().draft;
+ if (get().busy) return;
+ if (!draft.provider) {
+ set({ lastError: translate("agentic_grid.new_chat.pick_an_agent") });
+ return;
+ }
+ set({ busy: true, lastError: null });
+ try {
+ await options.open({
+ agent: draft.provider,
+ model: draft.model,
+ effort: draft.effort,
+ permissionMode: draft.permissionMode,
+ text,
+ attachments,
+ });
+ } catch (reason: unknown) {
+ const message = reason instanceof Error ? reason.message : String(reason);
+ set({ lastError: message });
+ useEventStore.getState().pushToast("error", message);
+ } finally {
+ set({ busy: false });
+ }
+ },
+
+ // Nothing is running: there is no turn to stop, no approval to answer
+ // and no socket to close. Each answers rather than throwing, because the
+ // shared composer calls them without asking which surface it is on.
+ cancel: async () => undefined,
+ decide: async () => undefined,
+ ingest: () => undefined,
+ disconnect: () => undefined,
+ };
+ });
+}
+
+/** A provider change's patch, minus the fields the re-seat has just decided. */
+function stripPicks(patch: Partial<ComposerDraft>): Partial<ComposerDraft> {
+ const { provider, model, effort, permissionMode, buildMode } = patch;
+ return {
+ ...(provider !== undefined ? { provider } : {}),
+ ...(model !== undefined ? { model } : {}),
+ ...(effort !== undefined ? { effort } : {}),
+ ...(permissionMode !== undefined ? { permissionMode } : {}),
+ ...(buildMode !== undefined ? { buildMode } : {}),
+ };
+}
diff --git a/jarvis/ui/web/frontend/src/store/paneChat.ts b/jarvis/ui/web/frontend/src/store/paneChat.ts
index 08332d63d3..2c6cb0c6ab 100644
--- a/jarvis/ui/web/frontend/src/store/paneChat.ts
+++ b/jarvis/ui/web/frontend/src/store/paneChat.ts
@@ -206,6 +206,18 @@ export interface PaneChatStoreOptions {
displayName: string;
/** The workspace folder: the composer's folder chip and the empty page's headline. */
folder: string;
+ /**
+ * A message that was sent to this pane before its chat existed.
+ *
+ * The Agentic IDE's new chat opens the pane and delivers the first sentence
+ * itself (`components/agentic/NewPaneChat`), so by the time this store is
+ * built the message is on its way to a CLI that has not written it down yet.
+ * Seeding it as a pending echo is what keeps the handover from showing an
+ * empty conversation for the five seconds that takes — the same mechanism a
+ * message typed HERE uses, and it settles the same way, as soon as the
+ * record holds a user message.
+ */
+ firstMessage?: { text: string; attachments: ChatAttachment[]; atMs: number };
}
export interface PaneChatState extends AgentChatStore {
@@ -278,7 +290,18 @@ export function createPaneChatStore(options: PaneChatStoreOptions) {
/** The record as the last read returned it — what the timeline is rebuilt from. */
let lastEvents: AgentChatEvent[] = [];
/** Messages typed here that the record does not hold yet, oldest first. */
- let echoes: PendingEcho[] = [];
+ let echoes: PendingEcho[] = options.firstMessage
+ ? [
+ {
+ text: options.firstMessage.text,
+ attachments: options.firstMessage.attachments,
+ atMs: options.firstMessage.atMs,
+ // A pane this fresh has no record at all, so ANY user message in the
+ // first read is this one arriving.
+ lastUserTsBefore: 0,
+ },
+ ]
+ : [];
const store = create<PaneChatState>((set, get) => {
const providerId = () =>
@@ -396,7 +419,14 @@ export function createPaneChatStore(options: PaneChatStoreOptions) {
// the pane for the stage.
activeSessionId: null,
activeSession: session(),
- timeline: EMPTY_TIMELINE,
+ // A handover message is drawn from the first frame; without it the
+ // stage would open empty under a sentence the person just sent.
+ timeline: options.firstMessage
+ ? reduceEvents(
+ EMPTY_TIMELINE,
+ echoEvents(echoes[0], { provider: providerId(), model: "", effort: "" }),
+ )
+ : EMPTY_TIMELINE,
socketState: "open",
draft: {
provider: providerId(),
diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
index 4013f98a54..08d21b02e2 100644
--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx
@@ -177,6 +177,7 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
const terminalRequest = useIdeChatStore((s) => s.terminalRequest);
const workspaceRequest = useIdeChatStore((s) => s.workspaceRequest);
const sessionRequest = useIdeChatStore((s) => s.sessionRequest);
+ const newChatRequest = useIdeChatStore((s) => s.newChatRequest);
const addWorkspaceRequest = useIdeChatStore((s) => s.addWorkspaceRequest);
const publishWorkspaces = useIdeChatStore((s) => s.setWorkspaces);
const publishAgents = useIdeChatStore((s) => s.setAgents);
@@ -482,6 +483,20 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
kind: a.kind ?? "cli",
logoUrl: a.logo_url || undefined,
installCommand: a.install_command || undefined,
+ // Whether a chat can be STARTED here at all, and what it could run on.
+ // Both are the backend's answer (`jarvis/workspace/launch_picks.py`),
+ // carried through unchanged: the split menus ignore them, and the chat
+ // surface — which opens a conversation rather than just a pane — reads
+ // them to decide what to offer and what to pass back at spawn.
+ acceptsPrompts: a.accepts_prompts ?? true,
+ picks: {
+ models: a.models ?? [],
+ defaultModel: a.default_model ?? "",
+ effortLevels: a.effort_levels ?? [],
+ defaultEffort: a.default_effort ?? "",
+ permissionModes: a.permission_modes ?? [],
+ defaultPermissionMode: a.default_permission_mode ?? "",
+ },
// For a plain terminal the useful second line is WHICH shell opens; a
// CLI's name already says what it is, so it gets no line of its own.
description:
@@ -745,6 +760,18 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {
// `session` and `switchTo` are read at the moment of the ask, on purpose.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [terminalRequest]);
+ /*
+ * A new chat asked for in another workspace: bring that tab to the front and
+ * let its own grid open the draft. The grid is where the stage lives, so the
+ * request is answered there — this only makes sure the right one sees it.
+ */
+ const lastNewChatSwitch = useRef(0);
+ useEffect(() => {
+ if (!newChatRequest || newChatRequest.nonce === lastNewChatSwitch.current) return;
+ lastNewChatSwitch.current = newChatRequest.nonce;
+ if (newChatRequest.workspaceId !== session?.id) void switchTo(newChatRequest.workspaceId);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [newChatRequest]);
const lastWorkspaceRequest = useRef(0);
useEffect(() => {
if (!workspaceRequest || workspaceRequest.nonce === lastWorkspaceRequest.current) return;