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(ide): the Agentic IDE's chat is the agent chat, in the workspace you opened
rubenluetke10-beepebb2d4f14a90
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.pyindex 02acb96f8c..91887124a3 100644--- a/jarvis/agentic_ide/session.py+++ b/jarvis/agentic_ide/session.py@@ -1362,9 +1362,14 @@ class Session:def contextual_terminal(self) -> Terminal | None:"""The one pane the visible surface puts in front of the user.- Chat view stages exactly one pane and can answer. The grid never- does — a dozen panes are visible there, and picking one of them would- be a guess dressed as a fact.+ Nothing does, today: the grid shows a dozen panes at once, and chat+ shows none — it is the agent chat, not a way of reading the terminals.+ Picking one anyway would be a guess dressed as a fact, so this answers+ None and the caller asks for a call-sign.++ The seam is kept rather than deleted because a surface that DOES stage+ one pane is a plausible third value of the enum, and it would report+ itself through exactly this field."""if self.surface_view != VIEW_CHAT:return None@@ -1373,7 +1378,15 @@ class Session:return self.find(self.surface_terminal)def stages_one_pane(self) -> bool:- """Does the visible view show a single pane, rather than the wall?"""+ """May the visible surface name ONE pane as the one being read?++ The grid never may. ``chat`` may, and today never does: the current+ bundle's chat surface is the agent chat and reports no terminal at all.+ The permission is kept rather than hard-coded away because the browser+ is the only layer that knows what is on screen, and a desktop window+ holding a bundle from before the switch is still entitled to be+ believed until it reloads itself.+ """return self.surface_view == VIEW_CHATdef prompt_target_terminal(self) -> Terminal | None:diff --git a/jarvis/agentic_ide/workspace_view.py b/jarvis/agentic_ide/workspace_view.pyindex d00ac8457d..029f4ee13f 100644--- a/jarvis/agentic_ide/workspace_view.py+++ b/jarvis/agentic_ide/workspace_view.py@@ -1,10 +1,11 @@-"""Which way the user is reading the open workspace right now.+"""Which surface the Agentic IDE is showing right now.-The Agentic IDE renders one set of panes two different ways, and the backend-has to know which one is on screen — not for looks, but because deictic-reference depends on it: "this terminal" is only answerable when exactly one-pane fills the screen. Chat view puts one there; the grid puts a dozen, and-guessing among them is less honest than asking for a call-sign.+The backend has to know, and not for looks: deictic reference depends on it.+"This terminal" is only answerable when exactly one pane fills the screen, and+neither surface does that any more — the grid puts a dozen panes up, and since+2026-08-24 ``chat`` is not a way of reading them at all but the agent chat in+the workspace's folder, with no terminal on screen. So the report is what tells+the voice path to ask for a call-sign instead of guessing.This module is layer 0 of the five-layer enum pattern(``docs/anti-drift-three-layer.md``). The value crosses from this package into@@ -23,17 +24,19 @@ from __future__ import annotations#: The wall of terminals — every pane visible at once, sized by dragged seams.VIEW_GRID = "grid"-#: One pane on a calm stage, the rest on a rail, read like a conversation.+#: The agent chat, running in this workspace's folder. No pane is on screen;+#: the terminals stay alive behind it (the browser covers them, never unmounts+#: them) and come back untouched when the grid does.VIEW_CHAT = "chat"-#: Every value the contract allows, in the order the toolbar offers them.+#: Every value the contract allows, in the order the switch offers them.WORKSPACE_VIEWS: tuple[str, ...] = (VIEW_GRID, VIEW_CHAT)#: What an unreadable or absent value falls back to.#:-#: The grid, deliberately: it is the view that promises the least. A surface-#: report that arrives garbled must not be able to switch a workspace into a-#: mode that answers "this terminal" with a pane the user is not looking at.+#: The grid, deliberately: it is the surface that promises the least. A report+#: that arrives garbled must not be able to put a workspace into a state that+#: answers "this terminal" with a pane the user is not looking at.VIEW_DEFAULT = VIEW_GRIDdiff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsxindex 438807c006..93a9e41b63 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx@@ -2753,13 +2753,16 @@ describe("renaming a pane", () => {});});-describe("chat view", () => {+describe("the surface the backend is told about", () => {/*- * The workspace read like a conversation: a rail of agents on the left, one- * pane on a centred stage, the prompt bar as the composer. What these tests- * pin is not the styling but the two contracts underneath it — switching- * modes must not remount a pane (a remount kills the coding agent), and- * every action the grid offers keeps working from the other mode.+ * The grid used to have a second reading mode of its own — one pane on a+ * stage, the rest in a rail. That is gone: the IDE's chat is the AGENT chat+ * now, a separate surface owned by `views/AgenticIdeView`, and this+ * component is the wall of terminals and nothing else.+ *+ * What survives is the report: the browser is the only layer that knows+ * which surface is in front of the user, and voice resolves "this terminal"+ * from it.*/const FOUR = sessionWith([["Mika", 0],@@ -2768,282 +2771,43 @@ describe("chat view", () => {["Kai", 3],]);- const cellClass = (name: string) =>- screen.getByTestId(`pane-cell-${name}`).className;-- /*- * The reading modes are three separate buttons, not one cycling control:- * past two states "click again" stops telling you where you land, and the- * third mode changes the assistant's behaviour rather than only the layout.- */- const toChat = () => fireEvent.click(screen.getByTestId("agentic-view-mode-toggle"));- const toGrid = () => fireEvent.click(screen.getByTestId("agentic-view-mode-grid"));-- const railOrder = () =>- screen- .getAllByTestId(/^chat-rail-item-/)- .map((item) => item.dataset.terminal);-- function placeRailItem(name: string, top: number) {- const item = screen.getByTestId(`chat-rail-item-${name}`);- item.getBoundingClientRect = () =>- ({- left: 0,- top,- width: 200,- height: 36,- right: 200,- bottom: top + 36,- x: 0,- y: top,- toJSON: () => ({}),- }) as DOMRect;- }-- it("starts in the grid, with the rail hidden", () => {- renderGrid(FOUR);- expect(screen.getByTestId("agentic-chat-rail").className).toContain("hidden");- for (const name of ["Mika", "Nova", "Aria", "Kai"]) {- expect(cellClass(name)).not.toContain("hidden");- }- });-- it("shows one pane on the stage and the rest in the rail", () => {- renderGrid(FOUR);- toChat();- expect(screen.getByTestId("agentic-chat-rail").className).not.toContain("hidden");- // Mika is the prompt target, so it takes the stage; the others hide.- expect(cellClass("Mika")).not.toContain("hidden");- for (const name of ["Nova", "Aria", "Kai"]) {- expect(cellClass(name)).toContain("hidden");- // Hidden, never unmounted — the agent behind the pane lives on.- expect(screen.getByTestId(`pane-${name}`)).toBeTruthy();- expect(screen.getByTestId(`chat-rail-${name}`)).toBeTruthy();- }- });-- it("uses the live task recap as the rail title, behind the agent's mark", async () => {- const mixed = sessionWith([- ["Mika", 0],- ["Nova", 1],- ]);- mixed.terminals[1] = {- ...mixed.terminals[1],- agent: "codex",- display_name: "Codex",- };- vi.mocked(api.fetchTerminalRecaps).mockResolvedValue({- workspace_id: "ide_test",- terminals: [- {- key: "nova",- name: "Nova",- status: "live",- recap: "Fix provider selection priority",- recap_detail: "Correct the fallback order used by the provider picker.",- },- ],- });-- renderGrid(mixed);- toChat();-- const title = await screen.findByTestId("chat-rail-title-Nova");- expect(title.textContent).toBe("Fix provider selection priority");- // The mark LEADS the row and the title follows it, the way a list of- // conversations reads: the title is the subject, the mark says which CLI- // is having it. The title sits inside its tooltip anchor, so the mark is- // the ANCHOR's previous sibling.- const mark = title.parentElement?.previousElementSibling;- expect(mark?.getAttribute("data-testid")).toBe("agent-mark-codex");- // `data-logo` rather than the <img>: a single-colour mark is drawn as a- // CSS mask so it follows the theme's ink, and jsdom does not model masks.- expect(mark?.getAttribute("data-logo")).toBe("/provider-logos/openai.svg");- });-- it("uses the last prompt as the title while a recap is not available", () => {- const session = sessionWith([["Mika", 0]]);- session.terminals[0].last_prompt = "Analyze transcription omissions";-- renderGrid(session);- toChat();-- expect(screen.getByTestId("chat-rail-title-Mika").textContent).toBe(- "Analyze transcription omissions",- );- });-- it("keeps the very same pane elements across every mode and back", () => {- // The iron rule of this component, and the one a new reading mode is most- // likely to break: element identity is the mounting guarantee. A remounted- // pane is a NEW element, and a new element means the WebSocket died with- // the old one — which kills the coding agent behind it.- renderGrid(FOUR);- const before = screen.getByTestId("pane-Nova");-- toChat();- expect(screen.getByTestId("pane-Nova")).toBe(before);- toGrid();-- expect(screen.getByTestId("pane-Nova")).toBe(before);- expect(screen.getByTestId("agentic-chat-rail").className).toContain("hidden");- expect(cellClass("Kai")).not.toContain("hidden");- });-- it("a rail click puts that pane on the stage", () => {- renderGrid(FOUR);- toChat();- fireEvent.click(screen.getByTestId("chat-rail-Aria"));- expect(cellClass("Aria")).not.toContain("hidden");- expect(cellClass("Mika")).toContain("hidden");- });-- it("activates an externally added pane on its first chat-stage render", () => {- const { rerender } = renderGrid(FOUR);- toChat();- paneActiveHistory.clear();-- rerender({- session: sessionWith([- ["Mika", 0],- ["Nova", 1],- ["Aria", 2],- ["Kai", 3],- ["Fresh", 4],- ]),- });-- // Connecting once while inactive gives the PTY the narrow hidden-grid- // geometry. The pane must own the full stage before its first effect runs.- expect(paneActiveHistory.get("Fresh")?.[0]).toBe(true);- expect(screen.getByTestId("pane-Fresh").getAttribute("data-active")).toBe(- "yes",- );- });-- it("swaps two rail positions by dragging without moving or remounting the panes", async () => {- renderGrid(FOUR);- const paneBefore = screen.getByTestId("pane-Mika");- toChat();- placeRailItem("Mika", 0);- placeRailItem("Nova", 36);- placeRailItem("Aria", 72);- placeRailItem("Kai", 108);-- fireEvent(- screen.getByTestId("chat-rail-Mika"),- new MouseEvent("pointerdown", {- bubbles: true,- clientX: 40,- clientY: 18,- button: 0,- }),- );- act(() => {- window.dispatchEvent(- new MouseEvent("pointermove", { clientX: 40, clientY: 90 }),- );- });-- expect(screen.getByTestId("chat-rail-arrange-ghost").textContent).toContain(- "Mika",- );- expect(screen.getByTestId("chat-rail-item-Aria").className).toContain(- "ring-primary/70",- );-- await act(async () => {- window.dispatchEvent(new MouseEvent("pointerup"));- });-- expect(railOrder()).toEqual(["Aria", "Nova", "Mika", "Kai"]);- expect(api.moveTerminal).not.toHaveBeenCalled();- expect(screen.getByTestId("pane-Mika")).toBe(paneBefore);- // Chromium follows a drag release with a compatibility click on the row- // below it. That click belongs to the drag and must not switch the stage.- fireEvent.click(screen.getByTestId("chat-rail-Aria"));- expect(cellClass("Mika")).not.toContain("hidden");- expect(cellClass("Aria")).toContain("hidden");- await waitFor(() =>- expect(- JSON.parse(- window.localStorage.getItem("jarvis.agenticIde.chatOrder.v1.ide_test") ??- "[]",- ),- ).toEqual(["aria@0", "nova@0", "mika@0", "kai@0"]),- );-- cleanup();- renderGrid(FOUR);- expect(railOrder()).toEqual(["Aria", "Nova", "Mika", "Kai"]);- });+ const CLI_CHOICES = [+ { name: "claude", displayName: "Claude Code", installed: true },+ { name: "codex", displayName: "Codex", installed: true },+ {+ name: "shell",+ displayName: "Plain Terminal",+ installed: false,+ kind: "shell",+ },+ ];- it("grounds deictic voice references in the pane visibly on stage", async () => {+ it("names no staged terminal — the grid shows all of them", async () => {renderGrid(FOUR);- await waitFor(() =>- expect(api.syncAgenticIdeSurface).toHaveBeenLastCalledWith({- workspaceId: "ide_test",- view: "grid",- onScreen: true,- terminal: null,- promptTarget: "Mika",- }),- );-- toChat();- fireEvent.click(screen.getByTestId("chat-rail-Aria"));await waitFor(() =>- expect(api.syncAgenticIdeSurface).toHaveBeenLastCalledWith({- workspaceId: "ide_test",- view: "chat",- onScreen: true,- terminal: "Aria",- promptTarget: "Aria",- }),- );-- toGrid();- await waitFor(() =>- expect(api.syncAgenticIdeSurface).toHaveBeenLastCalledWith({- workspaceId: "ide_test",- view: "grid",- onScreen: true,- terminal: null,- promptTarget: "Aria",- }),+ expect(api.syncAgenticIdeSurface).toHaveBeenLastCalledWith(+ expect.objectContaining({ view: "grid", onScreen: true, terminal: null }),+ ),);});- /*- * The view travels to the backend by NAME rather than as a boolean, so that- * a third mode added later reads correctly everywhere without re-deriving- * what "not chat" was supposed to mean. Pinned separately from the pane- * above because it is a separate claim.- */- it("tells the backend which mode is on screen", async () => {- renderGrid(FOUR);-- toChat();+ it("passes on the surface its owner says is showing", async () => {+ renderGrid(FOUR, { view: "chat" });await waitFor(() =>expect(api.syncAgenticIdeSurface).toHaveBeenLastCalledWith(- expect.objectContaining({ view: "chat", onScreen: true }),+ expect.objectContaining({ view: "chat" }),),);});- it("reports the grid while the section is off screen, whatever it shows", async () => {+ it("reports nothing on screen once the section is left", async () => {// A workspace nobody is looking at must not answer "this terminal". This// grid stays mounted behind another section, so "on screen" is the only// thing that can stop it — see the matching backend test.const { rerender } = renderGrid(FOUR);- toChat();- await waitFor(() =>- expect(api.syncAgenticIdeSurface).toHaveBeenLastCalledWith(- expect.objectContaining({ view: "chat" }),- ),- );+ await waitFor(() => expect(api.syncAgenticIdeSurface).toHaveBeenCalled());rerender({ onScreen: false });@@ -3054,148 +2818,7 @@ describe("chat view", () => {);});- it("remembers the chosen view for the next workspace", () => {- renderGrid(FOUR);- toChat();- cleanup();- renderGrid(FOUR);- expect(screen.getByTestId("agentic-chat-rail").className).not.toContain("hidden");- });-- it("maximize on the stage hands over to the grid, maximized", () => {- renderGrid(FOUR);- toChat();- fireEvent.click(screen.getByTestId("pane-maximize-Mika"));- expect(screen.getByTestId("agentic-chat-rail").className).toContain("hidden");- expect(screen.getByTestId("pane-Mika").getAttribute("data-maximized")).toBe("yes");- });-- it("the rail's plus opens a terminal at the end of the row", async () => {- renderGrid(FOUR);- toChat();- fireEvent.click(screen.getByTestId("chat-rail-new-terminal"));- await waitFor(() =>- expect(api.addTerminal).toHaveBeenCalledWith({- anchor: undefined,- direction: "right",- agent: undefined,- }),- );- });-- /*- * The rail's plus offers the same choice the grid's split buttons do.- *- * It used to open whatever CLI the backend listed first, so a workspace read- * in chat view could only ever grow more panes of that one agent — the one- * thing the grid had been asking about since the split menus landed.- */- const CLI_CHOICES = [- { name: "claude", displayName: "Claude Code", installed: true },- { name: "codex", displayName: "Codex", installed: true },- {- name: "shell",- displayName: "Plain Terminal",- installed: false,- kind: "shell",- },- ];-- it("the rail's plus asks which CLI when more than one is installed", async () => {- renderGrid(FOUR, { agents: CLI_CHOICES });- toChat();- fireEvent.click(screen.getByTestId("chat-rail-new-terminal"));-- // Uninstalled entries stay listed but disabled, so the absence is visible.- expect(- (screen.getByTestId("chat-rail-new-shell") as HTMLButtonElement).disabled,- ).toBe(true);-- fireEvent.click(screen.getByTestId("chat-rail-new-codex"));- await waitFor(() =>- expect(api.addTerminal).toHaveBeenCalledWith({- anchor: undefined,- direction: "right",- agent: "codex",- }),- );- // The menu closes with the pick — it was a question, and it was answered.- expect(screen.queryByTestId("chat-rail-agent-menu")).toBeNull();- });-- it("the rail's plus just opens one when a single CLI is installed", async () => {- // A menu with one entry is a click tax, not a choice.- renderGrid(FOUR, {- agents: [CLI_CHOICES[0], { ...CLI_CHOICES[1], installed: false }],- });- toChat();- fireEvent.click(screen.getByTestId("chat-rail-new-terminal"));- expect(screen.queryByTestId("chat-rail-agent-menu")).toBeNull();- await waitFor(() =>- expect(api.addTerminal).toHaveBeenCalledWith({- anchor: undefined,- direction: "right",- agent: undefined,- }),- );- });-- it("leaving chat view closes an open picker", () => {- renderGrid(FOUR, { agents: CLI_CHOICES });- toChat();- fireEvent.click(screen.getByTestId("chat-rail-new-terminal"));- expect(screen.getByTestId("chat-rail-agent-menu")).toBeTruthy();- toChat();- // The button that opened it just left the screen; it must not be waiting- // there on the way back.- expect(screen.queryByTestId("chat-rail-agent-menu")).toBeNull();- });-- /*- * Closing ONE terminal from the rail.- *- * Chat view shows a single pane and hides the other eleven — and with them- * the pane header that used to be the only per-terminal close. So the rail- * carries its own, and it goes through the same confirmation as the header:- * closing a pane kills whatever its agent was doing, and there is no undo.- */- it("closes one terminal from its row in the rail", async () => {- const survivors = sessionWith([- ["Mika", 0],- ["Nova", 1],- ["Kai", 3],- ]);- vi.mocked(api.closeTerminal).mockResolvedValue(survivors);- const { onSessionChanged } = renderGrid(FOUR);- toChat();-- fireEvent.click(screen.getByTestId("chat-rail-close-Aria"));- // Asked, never done on the spot — closing a pane kills a working agent.- expect(api.closeTerminal).not.toHaveBeenCalled();- expect(screen.getByText(/Close Aria\?/)).toBeTruthy();-- fireEvent.click(screen.getByTestId("confirm-close-terminal-confirm"));- await waitFor(() => expect(api.closeTerminal).toHaveBeenCalledWith("Aria"));- // The grid does not own the workspace; it reports the new one upwards.- await waitFor(() => expect(onSessionChanged).toHaveBeenCalledWith(survivors));- await waitFor(() =>- expect(screen.queryByTestId("confirm-close-terminal")).toBeNull(),- );- });-- it("keeps the rail's close out of selection mode", () => {- // That mode is here to close SEVERAL panes; a per-row close beside a- // checkbox is two answers to one question.- renderGrid(FOUR);- toChat();- expect(screen.getByTestId("chat-rail-close-Nova")).toBeTruthy();-- fireEvent.click(screen.getByTestId("terminal-selection-toggle"));-- expect(screen.queryByTestId("chat-rail-close-Nova")).toBeNull();- });-- it("an emptied workspace asks the same question", async () => {+ it("an emptied workspace asks which CLI to open", async () => {// The message shown when every pane is closed opens a terminal too, and it// is the only way back — so it offers the same list rather than guessing.renderGrid(sessionWith([]), { agents: CLI_CHOICES });@@ -3209,6 +2832,17 @@ describe("chat view", () => {}),);});++ it("keeps a way to another workspace where the rail's rows used to be", () => {+ const onNewSession = vi.fn();+ const onAddProject = vi.fn();+ renderGrid(sessionWith([]), { onNewSession, onAddProject });++ fireEvent.click(screen.getByTestId("empty-workspace-new-session"));+ expect(onNewSession).toHaveBeenCalled();+ fireEvent.click(screen.getByTestId("empty-workspace-add-project"));+ expect(onAddProject).toHaveBeenCalled();+ });});describe("terminal text size", () => {diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsxindex 3a735bc04d..d0931ae4a7 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx@@ -20,27 +20,21 @@ import {FileText,Files,FolderGit2,- FolderPlus,GripVertical,Image as ImageIcon,- LayoutGrid,ListChecks,Loader2,- MessagesSquare,Minus,MoveHorizontal,Moon,MoreHorizontal,Plus,Power,- Search,SlidersHorizontal,- SquarePen,Sun,Trash2,Type,X,- type LucideIcon,} from "lucide-react";import { cn } from "@/lib/utils";import { useT } from "@/i18n";@@ -48,10 +42,8 @@ import { useThemeValue } from "@/hooks/useTheme";import { useDocumentVisible } from "@/hooks/useDocumentVisible";import { useResizablePane } from "@/hooks/useResizablePane";import { PaneResizer } from "@/components/layout/PaneResizer";-import { QuickTooltip } from "@/components/ui/tooltip";import { useEventStore, type VoiceState } from "@/store/events";import { AgenticTerminal, type PaneStatus, type SplitDirection } from "./AgenticTerminal";-import { AgentMark } from "./AgentMark";import { PaneActivityPill } from "./PaneActivityPill";import { AgentPickerMenu, offersAgentChoice, type SplitAgentChoice } from "./AgentPicker";import type { TerminalAppearance } from "./terminalThemes";@@ -85,14 +77,8 @@ import { WorkspaceSettings } from "./WorkspaceSettings";import { WorkspaceExplorer } from "./WorkspaceExplorer";import { WorkspaceFileViewer } from "./WorkspaceFileViewer";import { usePaneFileDrag } from "./paneFileDrag";-import {- chatTerminalIdentity,- initialChatOrder,- orderChatTerminals,- reconcileChatOrder,- sameRows,- swapChatOrder,-} from "./chatState";+import { sameRows } from "./paneRows";+import type { WorkspaceView } from "./workspaceView";import {extractPaneDrop,extractPasteFiles,@@ -129,6 +115,16 @@ import {interface AgenticGridProps {session: SessionState;+ /**+ * Which surface the Agentic IDE is showing — owned by `AgenticIdeView`.+ *+ * The grid does not switch it and is not hidden by itself: in `chat` the+ * view above keeps this component MOUNTED and merely takes it off screen,+ * because unmounting a pane kills the coding agent behind it. The value is+ * here so the backend hears which surface the user is actually reading (see+ * `syncAgenticIdeSurface`).+ */+ view?: WorkspaceView;focusMode: boolean;onToggleFocus: (enabled: boolean) => void;onClose: () => void;@@ -283,34 +279,6 @@ const TOOLBAR_BTN =/** The same button, switched ON — the only yellow the toolbar spends. */const TOOLBAR_BTN_ON = "bg-primary/15 text-primary hover:bg-primary/20 hover:text-primary";-/**- * The reading-mode switch, one entry per view.- *- * A table rather than two hand-written buttons because the set is a contract- * (see `WorkspaceView`): a third mode should be one row here, and a mode with- * no row is a mode the user cannot reach — which is the failure this shape- * makes obvious instead of silent.- */-const VIEW_BUTTONS: ReadonlyArray<{- view: WorkspaceView;- testId: string;- icon: LucideIcon;- title: string;-}> = [- {- view: "grid",- testId: "agentic-view-mode-grid",- icon: LayoutGrid,- title: "Terminal grid — every pane on screen at once.",- },- {- view: "chat",- testId: "agentic-view-mode-toggle",- icon: MessagesSquare,- title: "Chat view — read one agent at a time, like a conversation.",- },-];-/*** The part of the hovered pane a drop would take, drawn as it will look.*@@ -542,70 +510,12 @@ function writePosition(node: HTMLElement, style: React.CSSProperties): void {*/const APPEARANCE_KEY = "jarvis.agenticIde.terminalAppearance";-/**- * The two ways of looking at one workspace.- *- * `grid` is the wall of terminals — every pane visible at once, sized by the- * dragged seams. `chat` is the same workspace read like a conversation: a rail- * of agents on the left, ONE terminal on a calm centred stage, and the prompt- * bar underneath as the composer.- *- * Talking to the assistant is not a mode: the floating voice orb is summoned- * from the toolbar and drawn over whichever of these two is on screen, so- * reaching for the microphone never costs the user the layout they chose.- *- * No mode owns the panes — switching is a pure restyle of the same mounted- * elements, because unmounting a pane kills the coding agent behind it (see- * the grid container's comment below). That rule is what makes a further mode- * cheap to add and is the one thing it must not break.- *- * Layer 4 of the enum contract; `jarvis/agentic_ide/workspace_view.py` is the- * source of truth and the backend asserts the two agree at import.- */-export type WorkspaceView = "grid" | "chat";--/** Every value, in the order the toolbar and the wizard offer them. */-export const WORKSPACE_VIEWS: readonly WorkspaceView[] = ["grid", "chat"];--function isWorkspaceView(raw: string): raw is WorkspaceView {- return (WORKSPACE_VIEWS as readonly string[]).includes(raw);-}--const VIEW_KEY = "jarvis.agenticIde.workspaceView";-const CHAT_ORDER_KEY_PREFIX = "jarvis.agenticIde.chatOrder.v1";--export function storedViewMode(): WorkspaceView | null {- return readStored(VIEW_KEY, (raw) => (isWorkspaceView(raw) ? raw : null));-}--/**- * Record which way the workspace should be read, ahead of the grid mounting.- *- * Exported for the workspace wizard: its last step asks grid-or-chat before- * anything opens, and the grid then simply reads the answer on mount — the- * same stored preference the toolbar toggle below keeps, so the wizard's- * choice and a later toggle can never disagree about where the answer lives.- */-export function rememberViewMode(next: WorkspaceView): void {- writeStored(VIEW_KEY, next);-}--function storedChatOrder(workspaceId: string): readonly string[] | null {- return readStored(`${CHAT_ORDER_KEY_PREFIX}.${workspaceId}`, (raw) => {- try {- const parsed: unknown = JSON.parse(raw);- return Array.isArray(parsed) && parsed.every((item) => typeof item === "string")- ? parsed- : null;- } catch {- return null;- }- });-}--function rememberChatOrder(workspaceId: string, identities: readonly string[]): void {- writeStored(`${CHAT_ORDER_KEY_PREFIX}.${workspaceId}`, JSON.stringify(identities));-}+export {+ WORKSPACE_VIEWS,+ rememberViewMode,+ storedViewMode,+ type WorkspaceView,+} from "./workspaceView";function readStored<T>(key: string, parse: (raw: string) => T | null): T | null {try {@@ -665,6 +575,7 @@ function storedAppearance(): TerminalAppearance | null {export function AgenticGrid({session,+ view = "grid",focusMode,onToggleFocus,onClose,@@ -872,29 +783,11 @@ export function AgenticGrid({* panes of that one agent while the grid's split buttons were asking properly* (maintainer report 2026-07-31).*/- const [picking, setPicking] = useState<"rail" | "empty" | null>(null);+ const [picking, setPicking] = useState<"empty" | null>(null);- /*- * Grid or chat — remembered per browser profile, like the appearance above:- * which way someone reads their agents is a display preference of this- * screen, not workspace state worth a round-trip.- */- const [viewMode, setViewModeState] = useState<WorkspaceView>(() => storedViewMode() ?? "grid");const [explorerOpen, setExplorerOpen] = useState(false);const [openedWorkspaceFile, setOpenedWorkspaceFile] = useState<string | null>(null);const openedWorkspaceFileTrigger = useRef<HTMLElement | null>(null);- const setViewMode = useCallback((next: WorkspaceView) => {- setViewModeState(next);- rememberViewMode(next);- // Chat shows one pane at most; a leftover maximize from the grid would- // silently pin the stage to a pane the chat rail does not highlight.- if (next !== "grid") setMaximized(null);- // An open CLI picker belongs to the button that opened it, and that button- // just left the screen — it must not be waiting there on the way back.- setPicking(null);- }, []);- const chatView = viewMode === "chat";-useEffect(() => {setOpenedWorkspaceFile(null);openedWorkspaceFileTrigger.current = null;@@ -910,29 +803,9 @@ export function AgenticGrid({setOpenedWorkspaceFile(path);}, []);- /*- * Which pane the chat stage shows. Kept apart from `target` (the pane the- * prompt bar types into) because the two answer different questions: a plain- * shell pane can be WATCHED on the stage but never prompted, and looking at- * it must not silently redirect the next instruction into a pane that- * refuses it. The effective selection is derived rather than repaired in- * effects, so a pane closed by another client simply falls back.- */- const [chatPane, setChatPane] = useState<string | null>(null);// Null until the first render has been seen: on mount every pane is "new",// and announcing a restored workspace's eight panes would be a light show.- // Kept beside the stage selection because a newly arrived pane must be- // selected during render, before its terminal's connection effect measures- // the otherwise-hidden grid cell.const knownPanes = useRef<Set<string> | null>(null);- const [chatOrder, setChatOrder] = useState<{- workspaceId: string;- keys: readonly string[];- }>(() => ({- workspaceId: session.id,- keys: storedChatOrder(session.id) ?? initialChatOrder(session.terminals),- }));- const chatRailRef = useRef<HTMLDivElement | null>(null);const [pendingClose, setPendingClose] = useState<string | null>(null);const [selectionMode, setSelectionMode] = useState(false);const [selectedTerminals, setSelectedTerminals] = useState<Set<string>>(() => new Set());@@ -1518,140 +1391,26 @@ export function AgenticGrid({const atLimit = session.terminals.length >= maxTerminals;- /*- * Chat is a conversation history, so its rail follows ARRIVAL order. The- * backend's terminal array follows grid coordinates and is deliberately- * re-sorted after every split or drag; rendering that array directly made a- * newly spawned Codex session appear in the middle of an existing chat.- */- const stableChatKeys = useMemo(- () =>- reconcileChatOrder(- chatOrder.workspaceId === session.id- ? chatOrder.keys- : (storedChatOrder(session.id) ?? initialChatOrder(session.terminals)),- session.terminals,- ),- [chatOrder, session.id, session.terminals],- );- const chatTerminals = useMemo(- () => orderChatTerminals(session.terminals, stableChatKeys),- [session.terminals, stableChatKeys],- );- /*- * The rail's own filter over those panes.- *- * Matched against what the row SHOWS — its headline, the prompt behind it,- * the CLI's name — rather than against the internal call-sign, because- * "T7" is not what anybody is looking for when they type into a search box.- * Purely local: no request fires, so it stays instant with a dozen panes.- */- const [railFilter, setRailFilter] = useState("");- const railTerminals = useMemo(() => {- const needle = railFilter.trim().toLowerCase();- if (!needle) return chatTerminals;- return chatTerminals.filter((term) =>- [term.recap, term.last_prompt, term.display_name, term.agent, term.name]- .filter(Boolean)- .some((field) => String(field).toLowerCase().includes(needle)),- );- }, [chatTerminals, railFilter]);-- /*- * The chat rail is a user's reading order, independent of the pane grid.- * Dropping one row on another exchanges only their stable lifetime keys: no- * terminal moves, remounts or reconnects, and the existing storage effect- * below makes the chosen order survive the next visit.- */- const suppressRailClickUntil = useRef(0);- const swapRailTerminals = useCallback(- (moved: string, targetName: string) => {- const movedTerminal = session.terminals.find((terminal) => terminal.name === moved);- const targetTerminal = session.terminals.find(- (terminal) => terminal.name === targetName,- );- if (!movedTerminal || !targetTerminal) return;- const next = swapChatOrder(- stableChatKeys,- chatTerminalIdentity(movedTerminal),- chatTerminalIdentity(targetTerminal),- );- if (next === stableChatKeys) return;- // Releasing over a row also produces a click in Chromium. Suppress that- // compatibility click so a reorder does not unexpectedly change stages.- suppressRailClickUntil.current = Date.now() + 250;- setChatOrder({ workspaceId: session.id, keys: next });- },- [session.id, session.terminals, stableChatKeys],- );- const railArrange = usePaneArrange(- useCallback(- (moved: string, targetName: string) => swapRailTerminals(moved, targetName),- [swapRailTerminals],- ),- );- const canReorderRail =- chatView && !selectionMode && !busy && !working && railTerminals.length > 1;-- useEffect(() => {- rememberChatOrder(session.id, stableChatKeys);- if (chatOrder.workspaceId === session.id && chatOrder.keys === stableChatKeys) {- return;- }- setChatOrder({ workspaceId: session.id, keys: stableChatKeys });- }, [chatOrder, session.id, stableChatKeys]);-- /*- * A pane can arrive through voice, the CLI, or another client. Effects run- * after child effects, which is too late to put that pane on the chat stage:- * its terminal would already have connected from a hidden, grid-sized cell- * and handed the PTY a tiny column count. Derive the arrival synchronously so- * the new terminal's first measurement is the full stage.- */- const knownBeforeRender = knownPanes.current;- const arrivingChatPane =- chatView && knownBeforeRender !== null- ? (session.terminals- .filter((term) => !knownBeforeRender.has(term.name))- .at(-1)?.name ?? null)- : null;-- /** The pane on the chat stage: the newest arrival, chosen pane, then fallback. */- const chatSelected = useMemo(() => {- const names = session.terminals.map((term) => term.name);- if (arrivingChatPane && names.includes(arrivingChatPane)) return arrivingChatPane;- if (chatPane && names.includes(chatPane)) return chatPane;- if (target && names.includes(target)) return target;- return names[0] ?? null;- }, [arrivingChatPane, chatPane, target, session.terminals]);-/** The browser is the only layer that knows what is actually on screen. Hand* that fact to the backend so voice and chat can resolve "this terminal"* from what the user sees.*- * `stagedPane` is the ONE pane the view puts in front of the user: chat's- * stage. Grid has no such pane and reports none — guessing among a dozen- * visible terminals would be less honest than making the user name one.+ * No pane is ever THE one on screen here: the grid shows all of them, and+ * guessing among a dozen visible terminals would be less honest than making+ * the user name one. The prompt target is the aim that does exist.*/- const stagedPane = chatView ? chatSelected : null;useEffect(() => {void syncAgenticIdeSurface({workspaceId: session.id,- view: viewMode,+ view,onScreen,- terminal: onScreen ? stagedPane : null,+ terminal: null,promptTarget: onScreen ? target || null : null,}).catch((error) => {console.warn("Agentic IDE: could not sync the visible terminal:", error);});- }, [onScreen, session.id, stagedPane, target, viewMode]);-- /** Rail click: show the pane, and aim the composer at it when it can listen. */- const selectChatPane = useCallback((name: string, promptable: boolean) => {- setChatPane(name);- if (promptable) setTarget(name);- }, []);+ }, [onScreen, session.id, target, view]);const split = async (anchor: string | null, direction: SplitDirection, agent?: string) => {setWorking(true);@@ -1672,10 +1431,6 @@ export function AgenticGrid({// stealing the target would silently redirect the next prompt into a pane// that refuses it.if (added && takesPrompts(added)) setTarget(added.name);- // The chat stage shows what was just opened — in the grid the new pane- // simply appears, but on a one-pane stage an unshown terminal would read- // as a split that did nothing.- if (added) setChatPane(added.name);} catch (e) {pushToast("error", (e as Error).message);} finally {@@ -1690,7 +1445,7 @@ export function AgenticGrid({* 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.*/- const openTerminal = (surface: "rail" | "empty") => {+ const openTerminal = (surface: "empty") => {if (offersChoice) setPicking((current) => (current === surface ? null : surface));else void split(null, "right");};@@ -1828,7 +1583,6 @@ export function AgenticGrid({const guardActive =onScreen &&documentVisible &&- !chatView &&maximized === null &&arrange.held === null &&!layoutBusy;@@ -1986,31 +1740,13 @@ export function AgenticGrid({const fresh = names.filter((name) => !known.has(name));if (fresh.length === 0) return;setJustOpened(new Set(fresh));- // On the chat stage, "seen appearing" means TAKING the stage: a pane- // opened by voice would otherwise exist only as a rail entry behind the- // one being read, which is the 2026-07-28 "terminals just don't load"- // report in new clothes.- let frame: number | undefined;- if (chatView) {- setChatPane(fresh[fresh.length - 1]);- // Chat rows are arrival-ordered, so the new session belongs at the rail's- // tail. Scrolling the hidden grid cell used to move the whole workspace- // and then snap the terminal again after its delayed fit.- frame = requestAnimationFrame(() => {- const rail = chatRailRef.current;- if (rail) rail.scrollTop = rail.scrollHeight;- });- }// In the grid there is nothing to scroll to: the workspace is one screenful// by rule, so a pane that just opened is already in view and the ring below// is the whole announcement. This used to call `scrollIntoView` on the// newest pane, which was the honest answer while a workspace could be wider// or taller than its window.const timer = window.setTimeout(() => setJustOpened(new Set()), 2600);- return () => {- if (frame !== undefined) cancelAnimationFrame(frame);- window.clearTimeout(timer);- };+ return () => window.clearTimeout(timer);}, [session.terminals]);/*@@ -2044,10 +1780,8 @@ export function AgenticGrid({pushToast("warning", t("agentic_grid.notifications.gone").replace("{0}", wanted));return;}- // The jump means "let me READ that pane". In the grid that is a maximize;- // on the chat stage it is the stage showing that pane.- if (chatView) setChatPane(wanted);- else setMaximized(wanted);+ // The jump means "let me READ that pane", which in the grid is a maximize.+ setMaximized(wanted);setJustOpened(new Set([wanted]));const timer = window.setTimeout(() => setJustOpened(new Set()), 2600);return () => window.clearTimeout(timer);@@ -2151,7 +1885,6 @@ export function AgenticGrid({*/const canArrange =!selectionMode &&- !chatView &&maximized === null &&!busy &&!working &&@@ -2385,38 +2118,6 @@ export function AgenticGrid({<Brain className="h-4 w-4 shrink-0" /></button>- {/* Grid or chat — how the same agents are read.-- Two buttons rather than one cycling through both states, because- the switch stays readable when a third mode is added: "click- again" stops telling you where you will land. They are ordinary- toolbar glyphs, not a segmented group in a box — the row's rule is- one button shape throughout, with colour reserved for what is ON.-- `agentic-view-mode-toggle` stays on the chat button: it is the one- this control used to be, and the tests that press it are about- chat view rather than about the switch. */}- {VIEW_BUTTONS.map(({ view, testId, icon: Icon, title }) => (- <button- key={view}- type="button"- data-testid={testId}- aria-pressed={viewMode === view}- onClick={() => {- setViewMode(view);- // A conversation surface with no input box is a screenshot, so- // chat view brings the composer with it.- if (view !== "grid" && composerCollapsed) {- resizeComposer(COMPOSER_DEFAULT_PX);- }- }}- title={title}- className={cn(TOOLBAR_BTN, viewMode === view && TOOLBAR_BTN_ON)}- >- <Icon className="h-4 w-4 shrink-0" />- </button>- ))}-{/* The current workspace's files, in the familiar editor-explorerposition. It is an independent panel rather than a fourth readingmode: opening it must not hide or remount a live terminal. */}@@ -2434,22 +2135,20 @@ export function AgenticGrid({<Files className="h-4 w-4 shrink-0" aria-hidden /></button>- {/* Even out the sizes. Beside the grid/chat toggle because both are- about the SHAPE of the workspace rather than what is in it, and- before the appearance controls because it changes the panes- themselves, not how their text is drawn.+ {/* Even out the sizes. Before the appearance controls because it+ changes the panes themselves, not how their text is drawn.- Off in chat view and while a pane is maximized: both hide the- boundaries this evens out, so the click would be a change nobody- can see — and a control whose effect is invisible reads as a dead- one. The tooltip says which of the reasons applies. */}+ Off while a pane is maximized: that hides the boundaries this evens+ out, so the click would be a change nobody can see — and a control+ whose effect is invisible reads as a dead one. The tooltip says+ which of the reasons applies. */}<buttontype="button"data-testid="agentic-even-panes"onClick={evenPanes}- disabled={chatView || maximized !== null || alreadyEven}+ disabled={maximized !== null || alreadyEven}title={- chatView || maximized !== null+ maximized !== null? t("agentic_grid.even.grid_only"): alreadyEven? t("agentic_grid.even.already")@@ -2626,288 +2325,8 @@ export function AgenticGrid({CSS, never removed, and the maximized one is told to fill the containerinstead of keeping its own rectangle.- Chat view is the same trick one step further: the rail on the left is- ALWAYS in the tree (hidden in grid mode), and switching modes only- flips class names — the scroller and every cell keep their place in- the element tree, so React re-parents nothing and no agent dies for a- change of clothes.*/}<div className="flex min-h-0 flex-1">- {/* ------------------------------------------------------ chat rail */}- <aside- data-testid="agentic-chat-rail"- className={cn(- /*- * 224 px, and the header is the same 44 px rule-under-a-label as- * the voice column opposite it. Chat view puts THREE vertical- * bands in front of the one pane being read — the app's own- * navigation, this list, and the voice column — so the two this- * view owns at least agree with each other about how a column- * begins.- */- "w-56 shrink-0 flex-col border-r border-border",- chatView ? "flex" : "hidden",- )}- >- {/*- The column's own head and name.-- Not "AGENTS" in small caps any more. This column lists the- conversations you are having, grouped by the folder they are in —- "Chat" is what that is.- */}- <div className="flex h-11 shrink-0 items-center gap-1 px-2">- <span className="flex-1 truncate px-1 text-sm font-semibold tracking-tight">- Chat- </span>- </div>-- <div className="px-2 pb-2">- <div className="relative flex items-center">- <Search className="pointer-events-none absolute left-2 h-3.5 w-3.5 text-muted-foreground/70" />- <input- value={railFilter}- onChange={(event) => setRailFilter(event.target.value)}- placeholder="Search"- aria-label="Search chats"- className="h-8 w-full rounded-md border border-transparent bg-foreground/[0.045] pl-7 pr-2 text-xs outline-none placeholder:text-muted-foreground/60 focus-visible:border-border focus-visible:bg-transparent"- />- </div>- </div>-- {/*- The three things a person arrives wanting to do, as rows with words- on them. They used to be one bare "+" in the header, which cannot- say which of the three it is.- */}- <div className="relative px-1.5 pb-1">- <RailAction- icon={SquarePen}- label="New chat"- testId="chat-rail-new-terminal"- disabled={atLimit || busy || working}- onClick={() => openTerminal("rail")}- />- {onNewSession && (- <RailAction- icon={Plus}- label="New session"- hint="A workspace with no project folder"- testId="chat-rail-new-session"- disabled={busy || working}- onClick={onNewSession}- />- )}- {onAddProject && (- <RailAction- icon={FolderPlus}- label="Add project"- testId="chat-rail-add-project"- disabled={busy || working}- onClick={onAddProject}- />- )}- {picking === "rail" && (- <AgentPickerMenu- title="Open a terminal — what?"- ariaLabel="What should run in the new terminal?"- agents={agents ?? []}- testId="chat-rail-agent-menu"- itemTestId={(agent) => `chat-rail-new-${agent}`}- className="left-2 top-full"- onDismiss={() => setPicking(null)}- onInstalled={() => onAgentsChanged?.()}- onPick={(agent) => {- setPicking(null);- void split(null, "right", agent);- }}- />- )}- </div>-- <div- ref={chatRailRef}- className="min-h-0 flex-1 overflow-y-auto scrollbar-jarvis px-1.5 pb-2"- >- <RailBand>Projects</RailBand>- {/*- The folder these panes are in, named and coloured like the- project it is. Every row under it belongs to it — which is the- whole reason this band exists: with two workspaces open, a flat- list of eleven conversations says nothing about which repository- any of them is touching.- */}- <div className="flex items-center gap-1.5 rounded-md px-2 py-1.5">- <span- className="h-1.5 w-1.5 shrink-0 rounded-full"- style={{ background: folderColor(project.path || project.name) }}- aria-hidden- />- <span className="min-w-0 flex-1 truncate text-xs font-medium">- {project.name}- </span>- </div>-- {railTerminals.map((term) => {- const state = statusOf(term);- const headline = recaps[term.name]?.recap ?? term.recap;- const title =- headline?.trim() ||- term.last_prompt?.trim() ||- `${term.display_name || term.name} session`;- const marked = selectedTerminals.has(term.name);- const active = chatSelected === term.name;- return (- /*- * The row and its close button are SIBLINGS, never nested: a- * button inside a button is invalid HTML, and browsers resolve- * it by dropping one of them — usually the one you wanted.- */- <div- key={term.key}- ref={railArrange.registerCell(term.name)}- data-testid={`chat-rail-item-${term.name}`}- data-terminal={term.name}- className={cn(- "group relative ml-3 mb-0.5 rounded-md transition-[opacity,box-shadow,background-color]",- railArrange.held === term.name && "opacity-50",- railArrange.hover?.target === term.name &&- "bg-primary/10 ring-2 ring-inset ring-primary/70",- )}- >- <button- type="button"- data-testid={`chat-rail-${term.name}`}- aria-label={`${title}, ${term.display_name || term.agent}`}- aria-pressed={selectionMode ? marked : active}- onPointerDown={- canReorderRail- ? (event) => railArrange.start(term.name, event)- : undefined- }- onClick={(event) => {- if (Date.now() < suppressRailClickUntil.current) {- event.preventDefault();- return;- }- // Selection mode borrows the rail: in chat view the grid's- // per-pane overlays are hidden with their panes, so the- // rail is where a multi-close is composed.- selectionMode- ? toggleTerminalSelection(term.name)- : selectChatPane(term.name, takesPrompts(term));- }}- /*- * Selection is a barely-there lift of the surface — no hue,- * no border, no fill. Eleven rows of tinted boxes turn a- * list into a heat map and leave the accent with nothing- * distinct to say when a row actually wants attention. The- * one exception is a MARKED row in selection mode, which is- * a deliberate armed state and should look like one.- */- className={cn(- "w-full rounded-md px-2 py-[5px] text-left transition-colors",- selectionMode && marked- ? "bg-primary/15"- : active && !selectionMode- ? "bg-foreground/[0.09]"- : "hover:bg-foreground/[0.055]",- canReorderRail &&- (railArrange.held === term.name- ? "cursor-grabbing"- : "cursor-grab"),- )}- style={{ touchAction: canReorderRail ? "none" : undefined }}- >- {/* The right padding is permanent, not applied on hover:- the close button appears where the badge would otherwise- be, and a status pill that jumps sideways under the- cursor is a row nobody can aim at. */}- <span className="flex items-center gap-1.5 pr-5">- {selectionMode && (- <Check- className={cn(- "h-3.5 w-3.5 shrink-0",- marked ? "text-primary" : "text-transparent",- )}- />- )}- <span className="flex min-w-0 flex-1 items-center gap-2">- {/* The mark leads, at the weight of the text beside it- — it says which CLI this is, it is not the subject- of the row. The title is. */}- <AgentMark- agent={term.agent}- label={term.display_name || term.agent}- size="sm"- variant="plain"- />- {/* The app's own bubble, not `title=`: the native- tooltip takes over a second to appear and is drawn- in the OS's grey box — a foreign artifact over a- rail whose whole point is the title. */}- <QuickTooltip- content={title}- side="right"- className="min-w-0 flex-1"- >- <span- data-testid={`chat-rail-title-${term.name}`}- className={cn(- "block truncate text-[12px]",- active ? "text-foreground" : "text-foreground/75",- )}- >- {title}- </span>- </QuickTooltip>- </span>- {/* Not "live". Every pane in this list is live, all day —- what the user is scanning for is which of them still- owes them something. See ./PaneActivityPill. */}- <PaneActivityPill- status={state.status}- detail={state.detail}- {...activityOf(term)}- />- </span>- </button>- {/*- Closing one terminal from the list itself.- Chat view hides every pane but the one on the stage, and with- it the header that used to be the only place a single- terminal could be closed — so the eleven panes you are NOT- looking at could only be closed by switching to the grid or- by composing a multi-select. This is the row's own button.-- Left out of selection mode on purpose: that mode is here to- close SEVERAL, and a per-row close beside a checkbox is two- answers to one question.- */}- {!selectionMode && (- <button- type="button"- data-testid={`chat-rail-close-${term.name}`}- disabled={busy || working}- onClick={() => setPendingClose(term.name)}- title={`Close ${term.name} and stop what is running in it`}- aria-label={`Close ${term.name}`}- className={cn(- "absolute right-1 top-1.5 flex h-5 w-5 items-center justify-center rounded",- "text-muted-foreground opacity-0 transition-opacity",- "hover:bg-destructive/20 hover:text-destructive",- "group-hover:opacity-100 group-focus-within:opacity-100",- "focus-visible:opacity-100 disabled:cursor-not-allowed",- )}- >- <X className="h-3.5 w-3.5" />- </button>- )}- </div>- );- })}- </div>- </aside><divref={gridRef}data-testid="agentic-grid"@@ -2927,7 +2346,7 @@ export function AgenticGrid({)}// Inline rather than a utility class so ONE number drives both the// rendered outer margin and the width the column count is computed from.- style={{ padding: chatView ? 12 : GRID_GAP_PX }}+ style={{ padding: GRID_GAP_PX }}>{/*The surface the fractions resolve against — always exactly the window.@@ -2947,9 +2366,6 @@ export function AgenticGrid({{session.terminals.map((term, index) => {const box = layout.boxes[index];const isMaximized = maximized === term.name;- // The one pane the single-pane view is showing. It stages one and- // hides the rest — the others are hidden and NEVER unmounted.- const onStage = chatView && chatSelected === term.name;return (<divkey={term.key}@@ -2963,8 +2379,7 @@ export function AgenticGrid({// imperatively (`paintDraggedLayout`) and must track the// pointer, not ease after it — and off for the stage/maximize// style, which swaps to `inset` and cannot tween from here.- !chatView &&- !isMaximized &&+ !isMaximized &&!layoutBusy &&"transition-[left,top,width,height] duration-300 ease-out motion-reduce:transition-none",/*@@ -2997,29 +2412,9 @@ export function AgenticGrid({justMoved?.name === term.name &&!selectedTerminals.has(term.name) &&"ring-2 ring-primary/70",- chatView- ? onStage- ? /*- * ONE edge per pane, in every view.- *- * This cell used to add `rounded-xl border border-border`- * of its own around a pane that already draws a rounded- * border in the TERMINAL's colours — two hairlines, at- * two different radii (12 px outside an 8 px corner), so- * every corner of the staged pane showed a sliver of app- * chrome curving around the pane's own. In grid view the- * same pane has a single edge, which is what made the- * switch to chat look like a different component rather- * than the same one enlarged.- *- * The lift stays: a staged pane genuinely IS raised above- * the rail beside it.- */- "shadow-lg"- : "hidden"- : maximized !== null && !isMaximized && "hidden",+ maximized !== null && !isMaximized && "hidden",)}- style={isMaximized || chatView ? MAXIMIZED_BOX : paneBoxStyle(box)}+ style={isMaximized ? MAXIMIZED_BOX : paneBoxStyle(box)}><AgenticTerminalname={term.name}@@ -3053,7 +2448,7 @@ export function AgenticGrid({fontSize={fontSize}geometryReady={gridMeasured}focused={target === term.name}- active={!chatView || onStage}+ activemaximized={isMaximized}layoutBusy={layoutBusy}splitDisabled={atLimit || busy || working}@@ -3063,17 +2458,9 @@ export function AgenticGrid({if (takesPrompts(term)) setTarget(term.name);}}onStatus={(status, detail) => setStatus(term.name, status, detail)}- onToggleMaximize={() => {- // On the chat stage the pane already fills the surface, so- // "maximize" honestly means "give me the full-width grid- // version of this pane".- if (chatView) {- setViewMode("grid");- setMaximized(term.name);- } else {- setMaximized((current) => (current === term.name ? null : term.name));- }- }}+ onToggleMaximize={() =>+ setMaximized((current) => (current === term.name ? null : term.name))+ }onSplit={(direction, agent) => void split(term.name, direction, agent)}onRename={(next) => renamePane(term, next)}onClose={() => setPendingClose(term.name)}@@ -3174,8 +2561,7 @@ export function AgenticGrid({panes are being selected or dragged (those gestures own the pointer),and, naturally, when there is only one pane.*/}- {!chatView &&- maximized === null &&+ {maximized === null &&!selectionMode &&arrange.held === null &&layout.seams.map((seam) => (@@ -3232,6 +2618,38 @@ export function AgenticGrid({/>)}</div>+ {/*+ The rail used to carry these two beside "New chat"; with the rail+ gone this is where they live. An emptied workspace is exactly the+ moment somebody wants a DIFFERENT one — quiet links rather than+ buttons, because opening a terminal here is still the answer.+ */}+ {(onNewSession || onAddProject) && (+ <div className="flex items-center gap-4 text-xs">+ {onNewSession && (+ <button+ type="button"+ data-testid="empty-workspace-new-session"+ disabled={busy || working}+ onClick={onNewSession}+ className="text-muted-foreground underline-offset-4 transition-colors hover:text-foreground hover:underline disabled:cursor-not-allowed disabled:opacity-50"+ >+ New session+ </button>+ )}+ {onAddProject && (+ <button+ type="button"+ data-testid="empty-workspace-add-project"+ disabled={busy || working}+ onClick={onAddProject}+ className="text-muted-foreground underline-offset-4 transition-colors hover:text-foreground hover:underline disabled:cursor-not-allowed disabled:opacity-50"+ >+ Add project+ </button>+ )}+ </div>+ )}</div>)}</div>@@ -3450,7 +2868,7 @@ export function AgenticGrid({key={term.key}type="button"data-testid={`prompt-target-${term.name}`}- onClick={() => (chatView ? selectChatPane(term.name, true) : setTarget(term.name))}+ onClick={() => setTarget(term.name)}aria-pressed={picked}className={cn("flex shrink-0 items-center gap-1.5 border-b-2 px-2.5 py-1.5 text-xs transition-colors",@@ -3543,24 +2961,6 @@ export function AgenticGrid({)}</div>)}- {railArrange.held !== null && railArrange.point !== null && (- <div- data-testid="chat-rail-arrange-ghost"- className="pointer-events-none fixed z-50 flex items-center gap-1.5 rounded-lg border border-primary/60 bg-card px-2.5 py-1.5 text-xs font-semibold shadow-xl"- style={{ left: railArrange.point.x + 14, top: railArrange.point.y + 14 }}- >- <GripVertical className="h-3.5 w-3.5 text-primary" />- {railArrange.held}- <span className="font-normal text-muted-foreground">- {railArrange.hover === null- ? t("agentic_grid.arrange.carrying")- : t("agentic_grid.arrange.swap").replace(- "{0}",- railArrange.hover.target,- )}- </span>- </div>- )}</div>);}@@ -4074,77 +3474,3 @@ function ConfirmClose({</div>);}--/**- * One of the rail's standing actions — a word, an icon, a whole row to hit.- *- * Rows rather than a toolbar of glyphs: these are the three things a person- * arrives wanting to do, and each has to be able to say which one it is- * without being hovered first.- */-function RailAction({- icon: Icon,- label,- hint,- onClick,- disabled,- testId,-}: {- icon: LucideIcon;- label: string;- hint?: string;- onClick: () => void;- disabled?: boolean;- testId?: string;-}) {- return (- <button- type="button"- data-testid={testId}- onClick={onClick}- disabled={disabled}- title={hint ?? label}- className={cn(- "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs font-medium",- "text-foreground/85 transition-colors hover:bg-foreground/[0.055]",- "disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent",- )}- >- <Icon className="h-3.5 w-3.5 shrink-0 text-muted-foreground" aria-hidden />- {label}- </button>- );-}--/** A section heading in the rail. Quiet enough to be scanned past. */-function RailBand({ children }: { children: React.ReactNode }) {- return (- <div className="px-2 pb-1 pt-3 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/60">- {children}- </div>- );-}--/**- * A stable colour for a folder, so the same project reads the same everywhere.- *- * Derived from the path rather than stored, which means it needs no setting and- * survives a lost store. The palette is fixed rather than a free hue rotation:- * arbitrary HSL produces colours that vanish against one of the two themes.- */-const FOLDER_COLORS = [- "#e7c46e",- "#7dd3fc",- "#a5b4fc",- "#86efac",- "#fca5a5",- "#f0abfc",- "#fdba74",- "#5eead4",-] as const;--function folderColor(key: string): string {- let sum = 0;- for (const char of key) sum = (sum + char.charCodeAt(0)) % 4096;- return FOLDER_COLORS[sum % FOLDER_COLORS.length];-}diff --git a/jarvis/ui/web/frontend/src/components/agentic/IdeChatSurface.tsx b/jarvis/ui/web/frontend/src/components/agentic/IdeChatSurface.tsxnew file mode 100644index 0000000000..c5372730ca--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/IdeChatSurface.tsx@@ -0,0 +1,58 @@+import { useEffect } from "react";++import { ChatStage } from "@/components/home/ChatStage";+import { useAgentChatStore } from "@/store/agentChat";+import type { IdeWorkspace } from "@/store/ideChat";++/**+ * The Agentic IDE's chat surface — the agent chat, in this workspace's folder.+ *+ * It IS the front page's chat: same `ChatStage`, same composer, same store, so+ * a conversation started here can be picked up there and neither has to be+ * kept in step with the other by hand. What this component adds is the one+ * thing the IDE knows and the front page does not — WHICH FOLDER you are+ * working in. The workspace you opened is the working directory of every chat+ * started on this surface, which is what "logged into your workspace" means in+ * practice: the agent runs there, on those files, under that folder's+ * credentials.+ *+ * A chat belonging to another folder is not silently re-pointed. Moving an+ * existing conversation to a new working directory mid-thread would change+ * what its own history refers to, so the surface opens a fresh chat instead+ * and leaves the old one in the sidebar where it was.+ *+ * This surface replaced the old "chat view", which read the terminal panes one+ * at a time behind a rail. That was a way of LOOKING at the grid; this is a+ * different thing to be doing (maintainer, 2026-08-24).+ */+export function IdeChatSurface({ workspace }: { workspace: IdeWorkspace }) {+ const folder = workspace.path;+ const activeSession = useAgentChatStore((s) => s.activeSession);+ const draftCwd = useAgentChatStore((s) => s.draft.cwd);+ const setDraft = useAgentChatStore((s) => s.setDraft);+ const newChat = useAgentChatStore((s) => s.newChat);++ useEffect(() => {+ if (!folder) return;+ // Order matters: dropping the open session FIRST means the cwd change is a+ // change to the draft for the next chat, not a PATCH that would move a+ // running conversation into a different folder.+ if (activeSession && activeSession.cwd !== folder) {+ newChat();+ void setDraft({ cwd: folder });+ return;+ }+ if (!activeSession && draftCwd !== folder) void setDraft({ cwd: folder });+ }, [folder, activeSession, draftCwd, newChat, setDraft]);++ return (+ <div+ className="flex h-full min-h-0 flex-col"+ data-testid="ide-chat-surface"+ data-workspace={workspace.id}+ data-folder={folder}+ >+ <ChatStage />+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/ViewSwitch.tsx b/jarvis/ui/web/frontend/src/components/agentic/ViewSwitch.tsxnew file mode 100644index 0000000000..9a902351a6--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/ViewSwitch.tsx@@ -0,0 +1,96 @@+import { LayoutGrid, MessageSquare } from "lucide-react";++import { cn } from "@/lib/utils";+import { useT } from "@/i18n";+import type { WorkspaceView } from "@/components/agentic/workspaceView";++/**+ * `Chat | Grid` — the Agentic IDE's one switch, at the top of the view.+ *+ * A segmented control in a pill rather than two toolbar glyphs, because the+ * two halves are no longer two ways of LOOKING at the same thing: since+ * 2026-08-24 they are two surfaces. Grid is the wall of terminals; Chat is the+ * agent chat, in this workspace's folder. A control that switches what the+ * page IS has to say so in words — an icon pair asks the user to remember+ * which glyph meant which surface.+ *+ * Chat sits first, matching the maintainer's sketch and the reading order of+ * the sidebar underneath it, which is chats in chat mode.+ */+export function ViewSwitch({+ view,+ onView,+ className,+}: {+ view: WorkspaceView;+ onView: (next: WorkspaceView) => void;+ className?: string;+}) {+ const t = useT();+ return (+ <div+ role="tablist"+ aria-label={t("agentic_grid.view_switch.hint")}+ data-testid="agentic-view-switch"+ className={cn(+ "flex shrink-0 items-center gap-0.5 rounded-full border border-border bg-secondary p-0.5",+ className,+ )}+ >+ <ViewTab+ active={view === "chat"}+ onClick={() => onView("chat")}+ icon={<MessageSquare aria-hidden className="h-3.5 w-3.5" />}+ label={t("agentic_grid.view_switch.chat")}+ title={t("agentic_grid.view_switch.chat_hint")}+ testId="agentic-view-mode-toggle"+ />+ <ViewTab+ active={view === "grid"}+ onClick={() => onView("grid")}+ icon={<LayoutGrid aria-hidden className="h-3.5 w-3.5" />}+ label={t("agentic_grid.view_switch.grid")}+ title={t("agentic_grid.view_switch.grid_hint")}+ testId="agentic-view-mode-grid"+ />+ </div>+ );+}++function ViewTab({+ active,+ onClick,+ icon,+ label,+ title,+ testId,+}: {+ active: boolean;+ onClick: () => void;+ icon: React.ReactNode;+ label: string;+ title: string;+ testId: string;+}) {+ return (+ <button+ type="button"+ role="tab"+ aria-selected={active}+ aria-pressed={active}+ data-testid={testId}+ onClick={onClick}+ title={title}+ className={cn(+ "flex items-center gap-1.5 rounded-full px-3 py-1 text-xs font-medium transition-colors",+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",+ active+ ? "bg-card text-foreground shadow-sm"+ : "text-muted-foreground hover:text-foreground",+ )}+ >+ {icon}+ {label}+ </button>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsxindex a4375ef299..e4c97f011c 100644--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceBar.tsx@@ -90,6 +90,15 @@ interface WorkspaceBarProps {* so the controls ride along in the space that was already there.*/actions?: React.ReactNode;+ /**+ * The `Chat | Grid` switch, pinned between the tabs and the controls.+ *+ * It lives in THIS row and nowhere else because it is the one control that+ * has to be reachable from both surfaces it switches between — put it in the+ * grid's own toolbar and pressing "Chat" would take the way back off screen+ * with it.+ */+ viewSwitch?: React.ReactNode;/*** Rendered INSIDE another bar rather than as its own — drops the frame (its* border and outer padding) so the host row draws exactly one line.@@ -109,6 +118,7 @@ export function WorkspaceBar({onDropFiles,busy = false,actions,+ viewSwitch,embedded = false,}: WorkspaceBarProps) {const t = useT();@@ -268,7 +278,7 @@ export function WorkspaceBar({// Nothing open, nothing to add to and no controls to carry: the wizard IS the// screen, and an empty bar above it would be furniture.- if (!hasTabs && !actions) return null;+ if (!hasTabs && !actions && !viewSwitch) return null;return (<div@@ -578,6 +588,15 @@ export function WorkspaceBar({</div>)}+ {viewSwitch && (+ <div+ data-testid="workspace-bar-view-switch"+ className="flex shrink-0 items-center"+ >+ {viewSwitch}+ </div>+ )}+{actions && (<divdata-testid="workspace-bar-actions"diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.test.tsxnew file mode 100644index 0000000000..36aad1100d--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.test.tsx@@ -0,0 +1,128 @@+import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++import { WorkspaceChats, groupByFolder } from "@/components/agentic/WorkspaceChats";+import { useAgentChatStore } from "@/store/agentChat";+import { useIdeChatStore } from "@/store/ideChat";+import type { AgentChatSession } from "@/lib/agentChatApi";++const HERE = "C:\\Users\\dev\\Personal Jarvis";+const THERE = "C:\\Users\\dev\\AiGrokAgents";++function chat(id: string, title: string, cwd: string, updated: number): AgentChatSession {+ return {+ session_id: id,+ title,+ provider: "claude-cli",+ model: "",+ effort: "",+ cwd,+ permission_mode: "acceptEdits",+ vendor_session: null,+ created_ms: updated - 100,+ updated_ms: updated,+ message_count: 2,+ preview: title,+ };+}++const SESSIONS = [+ chat("a", "Restore Command Deck", HERE, 9_000),+ chat("b", "Plan the marketing", HERE, 8_000),+ chat("c", "Find five leads", THERE, 7_000),+];++const openSession = vi.fn();+const removeSession = vi.fn();+const setDraft = vi.fn();+const newChat = vi.fn();++describe("the sidebar's chat face", () => {+ beforeEach(() => {+ vi.clearAllMocks();+ useIdeChatStore.setState({+ view: "chat",+ sidebarFace: "chats",+ workspace: { id: "w1", name: "Personal Jarvis", path: HERE },+ });+ useAgentChatStore.setState({+ sessions: SESSIONS,+ activeSessionId: "a",+ loadSessions: async () => {},+ openSession,+ removeSession: async (id: string) => {+ removeSession(id);+ },+ newChat,+ setDraft: async (patch) => {+ setDraft(patch);+ },+ });+ });++ afterEach(cleanup);++ it("puts the open workspace's folder first, its chats under it", () => {+ render(<WorkspaceChats />);++ const folders = screen+ .getAllByTestId("workspace-chats-folder")+ .map((node) => node.dataset.folder);+ expect(folders[0]).toBe(HERE);+ expect(folders).toContain(THERE);+ expect(screen.getByText("Restore Command Deck")).toBeTruthy();+ expect(screen.getByText("Find five leads")).toBeTruthy();+ });++ it("opens the chat that was clicked", () => {+ render(<WorkspaceChats />);++ fireEvent.click(screen.getByText("Plan the marketing"));++ expect(openSession).toHaveBeenCalledWith("b");+ });++ it("hands the navigation back through a button that says so", () => {+ render(<WorkspaceChats />);++ fireEvent.click(screen.getByTestId("workspace-chats-back"));++ expect(useIdeChatStore.getState().sidebarFace).toBe("sections");+ });++ it("starts a new chat in the folder it was asked from", () => {+ render(<WorkspaceChats />);++ fireEvent.click(screen.getByTestId(`workspace-chats-new-in-${THERE}`));++ expect(newChat).toHaveBeenCalled();+ expect(setDraft).toHaveBeenCalledWith({ cwd: THERE });+ });+});++describe("grouping chats by folder", () => {+ it("names each group after the folder's last segment, on either platform", () => {+ const groups = groupByFolder(SESSIONS, HERE);++ expect(groups[0].label).toBe("Personal Jarvis");+ expect(groups[1].label).toBe("AiGrokAgents");+ expect(groupByFolder([chat("x", "t", "/home/dev/site", 1)], "")[0].label).toBe("site");+ });++ it("shows the open workspace even before it has a single chat", () => {+ // The column has to say where a new chat would land. A folder that appears+ // only once it has history leaves a fresh workspace looking folderless.+ const groups = groupByFolder([chat("c", "elsewhere", THERE, 5)], HERE);++ expect(groups[0].folder).toBe(HERE);+ expect(groups[0].chats).toEqual([]);+ });++ it("orders the other folders by the chat touched last", () => {+ const older = chat("old", "older", "/a", 10);+ const newer = chat("new", "newer", "/b", 900);+ const groups = groupByFolder([older, newer], "");++ expect(groups.map((g) => g.folder)).toEqual(["/b", "/a"]);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsxnew file mode 100644index 0000000000..3937dd6b49--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx@@ -0,0 +1,311 @@+import { useEffect, useMemo, useState } from "react";+import { ChevronLeft, Folder, MessageSquare, Plus, Trash2 } from "lucide-react";++import { CONVERSATIONS_REFRESH_MS } from "@/hooks/useConversations";+import { useAgentChatStore } from "@/store/agentChat";+import { useIdeChatStore } from "@/store/ideChat";+import { folderLeaf } from "@/lib/folderPath";+import { folderColor } from "@/components/agentic/folderColor";+import { cn } from "@/lib/utils";+import { useT } from "@/i18n";++/** Chats shown per folder before "Show more" — enough to recognise the folder. */+const FOLDED = 5;++/**+ * The sidebar, wearing the Agentic IDE's chat face.+ *+ * While the IDE is in chat mode the app's own navigation steps aside and this+ * column takes over: the conversations you are having, grouped by the FOLDER+ * they are running in. That grouping is the whole point — with several+ * workspaces open, a flat list of eleven chats says nothing about which+ * repository any of them is touching. The folder you have open leads, under+ * its own band; everything else follows underneath.+ *+ * The way back is the first thing in the column, not a hidden gesture: a+ * sidebar that swallows the navigation with no visible exit is a trap, so the+ * "Sections" button sits at the top where a back button belongs.+ */+export function WorkspaceChats() {+ const t = useT();+ const workspace = useIdeChatStore((s) => s.workspace);+ const setSidebarFace = useIdeChatStore((s) => s.setSidebarFace);++ const sessions = useAgentChatStore((s) => s.sessions);+ const activeSessionId = useAgentChatStore((s) => s.activeSessionId);+ const loadSessions = useAgentChatStore((s) => s.loadSessions);+ const openSession = useAgentChatStore((s) => s.openSession);+ const removeSession = useAgentChatStore((s) => s.removeSession);+ const newChat = useAgentChatStore((s) => s.newChat);+ const setDraft = useAgentChatStore((s) => s.setDraft);++ useEffect(() => {+ void loadSessions();+ const id = window.setInterval(() => void loadSessions(), CONVERSATIONS_REFRESH_MS);+ return () => window.clearInterval(id);+ }, [loadSessions]);++ const groups = useMemo(+ () => groupByFolder(sessions, workspace?.path ?? ""),+ [sessions, workspace?.path],+ );+ // The open workspace's folder always sorts first (see `groupByFolder`), so+ // the leading group is "this workspace" — unless nothing is open, in which+ // case every group is just another folder.+ const openFolder = workspace?.path ?? "";+ const leads = openFolder !== "" && groups[0]?.folder === openFolder;+ const here = leads ? groups[0] : null;+ const elsewhere = leads ? groups.slice(1) : groups;++ /** A fresh chat in `folder` — the folder is the pick, the chat is empty. */+ const startChat = (folder: string) => {+ newChat();+ void setDraft({ cwd: folder });+ };++ return (+ <div className="flex min-h-0 flex-1 flex-col" data-testid="workspace-chats">+ <div className="shrink-0 space-y-1 px-2 pb-2 pt-2">+ <button+ type="button"+ data-testid="workspace-chats-back"+ onClick={() => setSidebarFace("sections")}+ className="flex w-full items-center gap-2 rounded-lg border border-border bg-card px-2.5 py-1.5 text-xs font-medium text-foreground transition-colors hover:border-primary/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"+ >+ <ChevronLeft aria-hidden className="h-3.5 w-3.5 text-muted-foreground" />+ {t("ide_chats.back_to_sections")}+ </button>+ <button+ type="button"+ data-testid="workspace-chats-new"+ onClick={() => startChat(workspace?.path ?? "")}+ className="flex w-full items-center gap-2 rounded-lg border border-border bg-card px-2.5 py-1.5 text-xs font-medium text-foreground transition-colors hover:border-primary/40 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"+ >+ <span className="flex h-4 w-4 items-center justify-center rounded bg-primary text-primary-foreground">+ <Plus aria-hidden className="h-3 w-3" />+ </span>+ {t("sidebar.new_chat")}+ </button>+ </div>++ <div className="min-h-0 flex-1 overflow-y-auto scrollbar-jarvis px-1 pb-3">+ {here && (+ <>+ <Band>{t("ide_chats.this_workspace")}</Band>+ <FolderGroup+ group={here}+ activeSessionId={activeSessionId}+ onOpen={openSession}+ onDelete={(id) => void removeSession(id)}+ onNewChat={() => startChat(here.folder)}+ />+ </>+ )}+ {elsewhere.length > 0 && (+ <>+ <Band>{t("ide_chats.other_folders")}</Band>+ {elsewhere.map((group) => (+ <FolderGroup+ key={group.folder || "~"}+ group={group}+ activeSessionId={activeSessionId}+ onOpen={openSession}+ onDelete={(id) => void removeSession(id)}+ onNewChat={() => startChat(group.folder)}+ />+ ))}+ </>+ )}+ {groups.length === 0 && (+ <p className="px-3 py-2 text-[11px] text-muted-foreground/70">+ {t("sidebar.no_chats")}+ </p>+ )}+ </div>+ </div>+ );+}++/** A quiet section heading — scanned past rather than read. */+function Band({ children }: { children: React.ReactNode }) {+ return (+ <div className="px-3 pb-1 pt-3 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/60">+ {children}+ </div>+ );+}++function FolderGroup({+ group,+ activeSessionId,+ onOpen,+ onDelete,+ onNewChat,+}: {+ group: FolderGroupData;+ activeSessionId: string | null;+ onOpen: (sessionId: string) => void;+ onDelete: (sessionId: string) => void;+ onNewChat: () => void;+}) {+ const t = useT();+ const [open, setOpen] = useState(false);+ const shown = open ? group.chats : group.chats.slice(0, FOLDED);+ const hidden = group.chats.length - shown.length;++ return (+ <section data-testid="workspace-chats-folder" data-folder={group.folder}>+ <div className="group/folder flex items-center gap-1.5 rounded-md px-2 py-1.5">+ <Folder+ aria-hidden+ className="h-3.5 w-3.5 shrink-0"+ style={{ color: folderColor(group.folder || group.label) }}+ />+ <span className="min-w-0 flex-1 truncate text-xs font-medium" title={group.folder}>+ {group.label}+ </span>+ <button+ type="button"+ onClick={onNewChat}+ title={t("ide_chats.new_chat_here")}+ aria-label={t("ide_chats.new_chat_here")}+ data-testid={`workspace-chats-new-in-${group.folder || "~"}`}+ className="flex h-5 w-5 shrink-0 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>+ </div>++ <ul className="space-y-px">+ {shown.map((chat) => (+ <ChatRow+ key={chat.session_id}+ id={chat.session_id}+ title={chat.title || chat.preview}+ active={chat.session_id === activeSessionId}+ onOpen={() => onOpen(chat.session_id)}+ onDelete={() => onDelete(chat.session_id)}+ />+ ))}+ </ul>++ {group.chats.length === 0 && (+ <p className="pl-8 pr-2 text-[11px] text-muted-foreground/50">+ {t("ide_chats.no_chats_here")}+ </p>+ )}+ {(hidden > 0 || open) && (+ <button+ type="button"+ onClick={() => setOpen((v) => !v)}+ aria-expanded={open}+ className="ml-8 rounded px-2 py-0.5 text-[11px] text-muted-foreground/70 transition-colors hover:text-foreground"+ >+ {open ? t("sidebar.show_less") : t("ide_chats.show_more")}+ </button>+ )}+ </section>+ );+}++function ChatRow({+ id,+ title,+ active,+ onOpen,+ onDelete,+}: {+ id: string;+ title: string;+ active: boolean;+ onOpen: () => void;+ onDelete: () => void;+}) {+ const t = useT();+ const label = title || t("chats_view.new_chat");+ return (+ <li className="group relative">+ <button+ type="button"+ onClick={onOpen}+ title={label}+ data-testid="workspace-chat-row"+ data-session={id}+ className={cn(+ "flex w-full items-center gap-2 rounded-lg py-1.5 pl-8 pr-2 text-left transition-colors",+ "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",+ active ? "bg-card text-foreground shadow-sm" : "hover:bg-background/60",+ )}+ >+ <MessageSquare+ aria-hidden+ className={cn("h-3.5 w-3.5 shrink-0", active ? "text-primary" : "text-muted-foreground")}+ />+ <span className="min-w-0 flex-1 truncate text-xs text-foreground">{label}</span>+ </button>+ <button+ type="button"+ onClick={(e) => {+ e.stopPropagation();+ onDelete();+ }}+ title={t("chats_view.delete")}+ aria-label={t("chats_view.delete")}+ className="absolute right-1 top-1/2 hidden -translate-y-1/2 rounded-md bg-card p-1 text-muted-foreground transition-colors hover:bg-destructive/15 hover:text-destructive group-hover:block"+ >+ <Trash2 className="h-3 w-3" />+ </button>+ </li>+ );+}++interface ChatLike {+ session_id: string;+ title: string;+ preview: string;+ cwd: string;+ updated_ms: number;+}++export interface FolderGroupData {+ /** Absolute path as the backend reported it; "" for the runner's default. */+ folder: string;+ /** What the folder is called — its last segment. */+ label: string;+ chats: ChatLike[];+}++/**+ * Chats grouped by the folder they run in, the open workspace first.+ *+ * The open workspace is ALWAYS the first group even with no chats in it yet:+ * the column has to say where a new chat would land, and a folder that appears+ * only once it has history would leave a fresh workspace looking like it+ * belongs to no folder at all. Everything else follows by recency, so the+ * folder someone touched last is the next one they see.+ *+ * Exported for the tests: the grouping is the contract this column keeps.+ */+export function groupByFolder(+ sessions: readonly ChatLike[],+ workspaceFolder: string,+): FolderGroupData[] {+ const byFolder = new Map<string, ChatLike[]>();+ if (workspaceFolder) byFolder.set(workspaceFolder, []);+ for (const session of sessions) {+ const key = session.cwd ?? "";+ const bucket = byFolder.get(key);+ if (bucket) bucket.push(session);+ else byFolder.set(key, [session]);+ }+ const groups = [...byFolder.entries()].map(([folder, chats]) => ({+ folder,+ label: folderLeaf(folder),+ chats: [...chats].sort((a, b) => b.updated_ms - a.updated_ms),+ }));+ return groups.sort((left, right) => {+ if (left.folder === workspaceFolder) return -1;+ if (right.folder === workspaceFolder) return 1;+ return (right.chats[0]?.updated_ms ?? 0) - (left.chats[0]?.updated_ms ?? 0);+ });+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/chatState.test.ts b/jarvis/ui/web/frontend/src/components/agentic/chatState.test.tsdeleted file mode 100644index 63e33ea0c4..0000000000--- a/jarvis/ui/web/frontend/src/components/agentic/chatState.test.ts+++ /dev/null@@ -1,134 +0,0 @@-import { describe, expect, it } from "vitest";-import type { TerminalRecap, TerminalState } from "@/lib/agenticIdeApi";-import {- chatTerminalIdentity,- initialChatOrder,- orderChatTerminals,- reconcileChatOrder,- sameRows,- swapChatOrder,-} from "./chatState";--function terminal(- key: string,- column: number,- historyId = `${key}-lifetime`,- startedAt = column + 1,-): TerminalState {- return {- key,- name: key.toUpperCase(),- agent: "codex",- display_name: "Codex",- index: column,- column,- slot: 0,- status: "live",- exit_code: null,- error: "",- started_at: startedAt,- history_id: historyId,- last_output_at: null,- idle_seconds: null,- prompts_sent: 0,- last_prompt: "",- lines_captured: 0,- };-}--function recap(name: string, activity = "waiting"): TerminalRecap {- return {- key: name.toLowerCase(),- name,- status: "live",- recap: "Waiting for work",- recap_detail: "The terminal is ready.",- activity: activity as TerminalRecap["activity"],- activity_since: 10,- worked: true,- };-}--describe("chat session ordering", () => {- it("appends a split pane even when the grid inserts it in the middle", () => {- const previous = ["t1-lifetime", "t2-lifetime", "t3-lifetime"];- const gridOrderAfterSplit = [- terminal("t1", 0),- terminal("t4", 1),- terminal("t2", 2),- terminal("t3", 3),- ];-- expect(reconcileChatOrder(previous, gridOrderAfterSplit)).toEqual([- "t1-lifetime",- "t2-lifetime",- "t3-lifetime",- "t4-lifetime",- ]);- });-- it("keeps surviving panes stable while removing closed panes", () => {- expect(- reconcileChatOrder(- ["t1-lifetime", "t2-lifetime", "t3-lifetime"],- [terminal("t3", 0), terminal("t1", 1)],- ),- ).toEqual(["t1-lifetime", "t3-lifetime"]);- });-- it("orders terminal objects independently of their grid coordinates", () => {- const terminals = [terminal("t1", 0), terminal("t3", 1), terminal("t2", 2)];- expect(- orderChatTerminals(terminals, ["t1-lifetime", "t2-lifetime", "t3-lifetime"]).map(- (item) => item.key,- ),- ).toEqual(["t1", "t2", "t3"]);- });-- it("sorts an unseen workspace by pane start time instead of grid position", () => {- const terminals = [- terminal("t3", 0, "third", 30),- terminal("t1", 1, "first", 10),- terminal("t2", 2, "second", 20),- ];-- expect(initialChatOrder(terminals)).toEqual(["first", "second", "third"]);- });-- it("treats a reused call-sign as a new pane lifetime", () => {- const replacement = terminal("t1", 0, "new-t1", 50);-- expect(reconcileChatOrder(["old-t1", "t2-lifetime"], [replacement, terminal("t2", 1)])).toEqual(- ["t2-lifetime", "new-t1"],- );- expect(chatTerminalIdentity(replacement)).toBe("new-t1");- });-- it("exchanges exactly the two sessions that were dragged together", () => {- expect(swapChatOrder(["first", "second", "third", "fourth"], "first", "third"))- .toEqual(["third", "second", "first", "fourth"]);- });-- it("keeps the existing order object when either dragged session is gone", () => {- const order = ["first", "second"];- expect(swapChatOrder(order, "first", "gone")).toBe(order);- expect(swapChatOrder(order, "first", "first")).toBe(order);- });-});--describe("recap poll equality", () => {- it("recognizes a repeated response", () => {- const current = { T1: recap("T1") };- expect(sameRows(current, { T1: { ...current.T1 } })).toBe(true);- });-- it("detects an activity transition", () => {- expect(sameRows({ T1: recap("T1") }, { T1: recap("T1", "working") })).toBe(false);- });-- it("detects a changed optional field even when both values are undefined", () => {- const before: Record<string, TerminalRecap> = { T1: { ...recap("T1"), note: undefined } };- const after: Record<string, TerminalRecap> = { T1: { ...recap("T1"), writer: undefined } };- expect(sameRows(before, after)).toBe(false);- });-});diff --git a/jarvis/ui/web/frontend/src/components/agentic/chatState.ts b/jarvis/ui/web/frontend/src/components/agentic/chatState.tsdeleted file mode 100644index 159008181c..0000000000--- a/jarvis/ui/web/frontend/src/components/agentic/chatState.ts+++ /dev/null@@ -1,101 +0,0 @@-import type { TerminalState } from "@/lib/agenticIdeApi";--/** One pane lifetime, independent of its reusable grid call-sign. */-export function chatTerminalIdentity(terminal: TerminalState): string {- return terminal.history_id ?? `${terminal.key}@${terminal.started_at ?? "pending"}`;-}--/** Best available arrival order when this browser has not seen the workspace. */-export function initialChatOrder(terminals: readonly TerminalState[]): readonly string[] {- return [...terminals]- .sort((left, right) => {- const leftStarted = left.started_at ?? Number.POSITIVE_INFINITY;- const rightStarted = right.started_at ?? Number.POSITIVE_INFINITY;- return leftStarted - rightStarted || left.index - right.index;- })- .map(chatTerminalIdentity);-}--/** Keep chat sessions in arrival order even when the grid is rearranged. */-export function reconcileChatOrder(- previous: readonly string[],- terminals: readonly TerminalState[],-): readonly string[] {- const current = terminals.map(chatTerminalIdentity);- const live = new Set(current);- const next = previous.filter((key) => live.has(key));- const known = new Set(next);- for (const key of current) {- if (!known.has(key)) {- next.push(key);- known.add(key);- }- }- return sameStrings(previous, next) ? previous : next;-}--/** Exchange two session positions without disturbing any rows between them. */-export function swapChatOrder(- previous: readonly string[],- first: string,- second: string,-): readonly string[] {- if (first === second) return previous;- const firstIndex = previous.indexOf(first);- const secondIndex = previous.indexOf(second);- if (firstIndex < 0 || secondIndex < 0) return previous;- const next = [...previous];- next[firstIndex] = second;- next[secondIndex] = first;- return next;-}--/** Put terminal objects into the stable order used by the chat rail. */-export function orderChatTerminals(- terminals: readonly TerminalState[],- identities: readonly string[],-): TerminalState[] {- const byIdentity = new Map(- terminals.map((terminal) => [chatTerminalIdentity(terminal), terminal]),- );- return identities.flatMap((identity) => {- const terminal = byIdentity.get(identity);- return terminal ? [terminal] : [];- });-}--/**- * Avoid repainting every terminal when a poll returns unchanged rows.- *- * Generic over the row type because two polls need it for the same reason:- * the recap poll (sentences, every 5s) and the activity poll (status words,- * every 1.5s) both replace a per-pane map on a timer inside a very large- * component, and a fresh-but-equal object every tick is a full re-render- * bought for nothing.- */-export function sameRows<T extends object>(- current: Readonly<Record<string, T>>,- next: Readonly<Record<string, T>>,-): boolean {- const currentNames = Object.keys(current);- const nextNames = Object.keys(next);- if (currentNames.length !== nextNames.length) return false;- return nextNames.every((name) => {- const before = current[name];- const after = next[name];- if (!before || !after) return false;- const beforeFields = Object.keys(before) as (keyof T)[];- const afterFields = Object.keys(after) as (keyof T)[];- if (- beforeFields.length !== afterFields.length ||- afterFields.some((field) => !Object.hasOwn(before, field))- ) {- return false;- }- return afterFields.every((field) => Object.is(before[field], after[field]));- });-}--function sameStrings(left: readonly string[], right: readonly string[]): boolean {- return left.length === right.length && left.every((value, index) => value === right[index]);-}diff --git a/jarvis/ui/web/frontend/src/components/agentic/folderColor.ts b/jarvis/ui/web/frontend/src/components/agentic/folderColor.tsnew file mode 100644index 0000000000..1de46f9d93--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/folderColor.ts@@ -0,0 +1,23 @@+/**+ * A stable colour for a folder, so the same project reads the same everywhere.+ *+ * Derived from the path rather than stored, which means it needs no setting and+ * survives a lost store. The palette is fixed rather than a free hue rotation:+ * arbitrary HSL produces colours that vanish against one of the two themes.+ */+const FOLDER_COLORS = [+ "#e7c46e",+ "#7dd3fc",+ "#a5b4fc",+ "#86efac",+ "#fca5a5",+ "#f0abfc",+ "#fdba74",+ "#5eead4",+] as const;++export function folderColor(key: string): string {+ let sum = 0;+ for (const char of key) sum = (sum + char.charCodeAt(0)) % 4096;+ return FOLDER_COLORS[sum % FOLDER_COLORS.length];+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/paneRows.test.ts b/jarvis/ui/web/frontend/src/components/agentic/paneRows.test.tsnew file mode 100644index 0000000000..517a9737f1--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/paneRows.test.ts@@ -0,0 +1,33 @@+import { describe, expect, it } from "vitest";+import type { TerminalRecap } from "@/lib/agenticIdeApi";+import { sameRows } from "./paneRows";++function recap(name: string, activity = "waiting"): TerminalRecap {+ return {+ key: name.toLowerCase(),+ name,+ status: "live",+ recap: "Waiting for work",+ recap_detail: "The terminal is ready.",+ activity: activity as TerminalRecap["activity"],+ activity_since: 10,+ worked: true,+ };+}++describe("recap poll equality", () => {+ it("recognizes a repeated response", () => {+ const current = { T1: recap("T1") };+ expect(sameRows(current, { T1: { ...current.T1 } })).toBe(true);+ });++ it("detects an activity transition", () => {+ expect(sameRows({ T1: recap("T1") }, { T1: recap("T1", "working") })).toBe(false);+ });++ it("detects a changed optional field even when both values are undefined", () => {+ const before: Record<string, TerminalRecap> = { T1: { ...recap("T1"), note: undefined } };+ const after: Record<string, TerminalRecap> = { T1: { ...recap("T1"), writer: undefined } };+ expect(sameRows(before, after)).toBe(false);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/paneRows.ts b/jarvis/ui/web/frontend/src/components/agentic/paneRows.tsnew file mode 100644index 0000000000..fec7e471b5--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/paneRows.ts@@ -0,0 +1,36 @@+/**+ * Avoid repainting every terminal when a poll returns unchanged rows.+ *+ * Generic over the row type because two polls need it for the same reason:+ * the recap poll (sentences, every 5s) and the activity poll (status words,+ * every 1.5s) both replace a per-pane map on a timer inside a very large+ * component, and a fresh-but-equal object every tick is a full re-render+ * bought for nothing.+ *+ * This module was `chatState.ts` while the Agentic IDE read its terminals as a+ * chat: it also held the rail's arrival order. That reading mode is gone — the+ * IDE's chat is the agent chat now — and what is left is this one helper, so+ * the file is named after what it actually does.+ */+export function sameRows<T extends object>(+ current: Readonly<Record<string, T>>,+ next: Readonly<Record<string, T>>,+): boolean {+ const currentNames = Object.keys(current);+ const nextNames = Object.keys(next);+ if (currentNames.length !== nextNames.length) return false;+ return nextNames.every((name) => {+ const before = current[name];+ const after = next[name];+ if (!before || !after) return false;+ const beforeFields = Object.keys(before) as (keyof T)[];+ const afterFields = Object.keys(after) as (keyof T)[];+ if (+ beforeFields.length !== afterFields.length ||+ afterFields.some((field) => !Object.hasOwn(before, field))+ ) {+ return false;+ }+ return afterFields.every((field) => Object.is(before[field], after[field]));+ });+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/workspaceView.ts b/jarvis/ui/web/frontend/src/components/agentic/workspaceView.tsnew file mode 100644index 0000000000..2c613bccaf--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/workspaceView.ts@@ -0,0 +1,59 @@+/**+ * How a workspace is read — grid or chat — and where that answer is kept.+ *+ * Its own module rather than a corner of `AgenticGrid.tsx`, because the answer+ * is no longer the grid's to give. Since 2026-08-24 the two modes are two+ * different SURFACES: `grid` is the terminal wall, `chat` is the agent chat+ * (the same one the front page runs) pointed at the workspace's folder. The+ * view that owns both — `views/AgenticIdeView` — holds the choice, the+ * workspace bar draws the switch, the sidebar changes face with it, and the+ * grid is only one of the things that reads it. A module every one of them can+ * import without pulling a 3000-line grid behind it.+ *+ * Layer 4 of the enum contract; `jarvis/agentic_ide/workspace_view.py` is the+ * source of truth and the backend asserts the two agree at import.+ */+export type WorkspaceView = "grid" | "chat";++/** Every value, in the order the switch and the wizard offer them. */+export const WORKSPACE_VIEWS: readonly WorkspaceView[] = ["grid", "chat"];++export function isWorkspaceView(raw: string): raw is WorkspaceView {+ return (WORKSPACE_VIEWS as readonly string[]).includes(raw);+}++const VIEW_KEY = "jarvis.agenticIde.workspaceView";++export function storedViewMode(): WorkspaceView | null {+ return readStored(VIEW_KEY, (raw) => (isWorkspaceView(raw) ? raw : null));+}++/**+ * Record which way the workspace should be read, ahead of anything mounting.+ *+ * Used by the workspace wizard (its last step asks grid-or-chat before a+ * workspace opens) and by the switch in the bar, so the two can never disagree+ * about where the answer lives.+ */+export function rememberViewMode(next: WorkspaceView): void {+ writeStored(VIEW_KEY, next);+}++function readStored<T>(key: string, parse: (raw: string) => T | null): T | null {+ try {+ const raw = window.localStorage.getItem(key);+ return raw === null ? null : parse(raw);+ } catch {+ // Private mode / storage disabled — fall back to the defaults rather than+ // taking the whole workspace down over a preference.+ return null;+ }+}++function writeStored(key: string, value: string): void {+ try {+ window.localStorage.setItem(key, value);+ } catch {+ /* nothing to do — the preference just will not survive this session */+ }+}diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsxindex 74e29eecb0..f21ec118e1 100644--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.test.tsx@@ -10,6 +10,7 @@ import {} from "@/components/layout/Sidebar";import { useEventStore } from "@/store/events";import { useHomeStore } from "@/store/home";+import { useIdeChatStore } from "@/store/ideChat";// The sidebar header avatar must mirror the chosen on-screen display style:// the ghost mascot ONLY when the user explicitly picked "mascot"; the slim bar@@ -753,3 +754,54 @@ describe("Sidebar collapse toggle", () => {expect(screen.queryByTestId("sidebar-collapse-toggle")).toBeNull();});});++describe("the Agentic IDE's chat face", () => {+ /*+ * Chat mode in the IDE borrows this column for the workspace's chats. What+ * these pin is that the takeover is BOUNDED: it only happens on that+ * section, and there is always a way back to the sections.+ */+ beforeEach(() => {+ useIdeChatStore.setState({+ view: "chat",+ sidebarFace: "chats",+ workspace: { id: "w1", name: "Personal Jarvis", path: "/work/jarvis" },+ });+ });++ afterEach(() => {+ useIdeChatStore.setState({ view: "grid", sidebarFace: "chats", workspace: null });+ });++ test("shows the workspace's chats instead of the sections", () => {+ useEventStore.setState({ activeSection: "agentic-ide" });++ renderSidebar(SIDEBAR_DEFAULT_WIDTH);++ expect(screen.getByTestId("workspace-chats")).toBeTruthy();+ expect(screen.queryByTestId("nav-row-settings")).toBeNull();+ });++ test("hands the sections back when the back button is pressed", () => {+ useEventStore.setState({ activeSection: "agentic-ide" });+ renderSidebar(SIDEBAR_DEFAULT_WIDTH);++ act(() => {+ screen.getByTestId("workspace-chats-back").click();+ });++ expect(screen.queryByTestId("workspace-chats")).toBeNull();+ expect(screen.getByTestId("nav-row-settings")).toBeTruthy();+ });++ test("leaves every other section its navigation", () => {+ // The IDE is in chat mode, but the user is reading another section:+ // taking the navigation away there would be a takeover nobody asked for.+ useEventStore.setState({ activeSection: "settings" });++ renderSidebar(SIDEBAR_DEFAULT_WIDTH);++ expect(screen.queryByTestId("workspace-chats")).toBeNull();+ expect(screen.getByTestId("nav-row-settings")).toBeTruthy();+ });+});diff --git a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsxindex 1c665c80d1..d1ff505b69 100644--- a/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx+++ b/jarvis/ui/web/frontend/src/components/layout/Sidebar.tsx@@ -27,6 +27,8 @@ import { RecentChats } from "@/components/home/RecentChats";import { useConversations } from "@/hooks/useConversations";import { useHomeStore } from "@/store/home";import { useAgentChatStore } from "@/store/agentChat";+import { useIdeChatStore } from "@/store/ideChat";+import { WorkspaceChats } from "@/components/agentic/WorkspaceChats";import { PRODUCT_NAME } from "@/lib/branding";import { useAppInstance } from "@/hooks/useAppInstance";@@ -36,6 +38,18 @@ import { useAppInstance } from "@/hooks/useAppInstance";const LOGO_RETRY_MAX = 5;const LOGO_RETRY_BASE_MS = 1500;+/**+ * The section ids the Agentic IDE answers to.+ *+ * Mirrors the nav row's own `matchIds` (see ./navGroups): the section has been+ * renamed twice and the older ids are still what some entry points set.+ */+const IDE_SECTIONS: readonly string[] = [+ "agentic-ide",+ "chat-workspace",+ "agentic-ide-classic",+];+const VOICE_STATE_STYLE: Record<string, { dot: string; pulse: boolean }> = {idle: { dot: "bg-muted-foreground/50", pulse: false },listening: { dot: "bg-emerald-400", pulse: true },@@ -114,16 +128,36 @@ export function Sidebar({// confused; the default app shows nothing here.const appInstance = useAppInstance();const devTag = appInstance?.isDev ? appInstance.name.toUpperCase() : null;- // "+ New" starts a conversation of the KIND you are looking at: on the chat- // surface an empty agent chat, on the voice stage a fresh voice run. Sending- // someone standing in Voice to the chat page is what the one button used to- // do, and it read as the button being broken.+ // "+ New" starts a new conversation of the KIND you are looking at: on the+ // chat surface an empty agent chat, on the voice stage a fresh voice run.+ // Sending someone standing in Voice to the chat page is what the one button+ // used to do, and it read as the button being broken.const { newChat, newVoiceRun } = useConversations();const newAgentChat = useAgentChatStore((s) => s.newChat);const setSurface = useHomeStore((s) => s.setSurface);// The front page's nav row names the face the switch picked (Voice / Chat),// see `presentNavItem`.const surface = useHomeStore((s) => s.surface);+ /*+ * The Agentic IDE in chat mode borrows this column for ITS chats.+ *+ * Chat mode is a surface, not a layout — the conversations you are having in+ * the workspace you opened, grouped by folder — and a chat surface with its+ * history two clicks away is a chat surface nobody uses. So while it is on,+ * the sections step aside and `WorkspaceChats` takes the column, with its own+ * button back (`sidebarFace`). Only while the IDE is the section on screen:+ * leaving it must give the navigation straight back.+ */+ const ideView = useIdeChatStore((s) => s.view);+ const ideSidebarFace = useIdeChatStore((s) => s.sidebarFace);+ const setIdeSidebarFace = useIdeChatStore((s) => s.setSidebarFace);+ // No open workspace means the IDE is showing its wizard, not a chat — and a+ // column of chats headed "This workspace" would be naming one that is not+ // there.+ const ideWorkspaceOpen = useIdeChatStore((s) => s.workspace !== null);+ const onIdeSection = IDE_SECTIONS.includes(active);+ const chatFace =+ onIdeSection && ideWorkspaceOpen && ideView === "chat" && ideSidebarFace === "chats";const resetTranscript = useHomeStore((s) => s.resetTranscript);// On the voice stage: clear the lane, drop the open voice thread and let the// backend forget the one it was seeded with. We stay on Voice and the mic@@ -346,11 +380,13 @@ export function Sidebar({</button>)}</div>- {!railed && (+ {!railed && !chatFace && (<>{/* The front page's one switch (maintainer sketch, 2026-08-23):Voice or Chat. The live transcript that used to sit here moved- onto the voice stage itself, where it has the room to be read. */}+ onto the voice stage itself, where it has the room to be read.+ Hidden while the IDE's chats own the column: two switches with+ "Chat" on both halves are two questions nobody asked. */}<SurfaceSwitch className="mt-3" /><buttontype="button"@@ -373,6 +409,8 @@ export function Sidebar({// API-Keys error pip, the plugin reconnect pip, the Skills → Plugins// shortcut) from its own sources, so nothing here has to be threaded in.<DockRail className="min-h-0 flex-1" />+ ) : chatFace ? (+ <WorkspaceChats />) : (<nav className="flex-1 overflow-y-auto scrollbar-jarvis p-2">{/* One list, not two: a voice session IS a run, and showing it as@@ -406,11 +444,17 @@ export function Sidebar({// A plugin problem sends the "Skills & Tools" row straight into// the Plugins tab (where the banner + jump button are), so one// click lands on the fix instead of the default Skills tab.- onClick={() =>+ onClick={() => {+ // Pressing the IDE row while its chat surface is already+ // open is the way BACK to the chats — otherwise the+ // "Sections" button would be a one-way door.+ if (IDE_SECTIONS.includes(item.id) && ideView === "chat") {+ setIdeSidebarFace("chats");+ }setActive(item.id === "skills" && pluginsNeedReconnect ? "plugins" : item.id,- )- }+ );+ }}/>);})}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 01e136efe1..681366f0f0 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -4415,7 +4415,22 @@"show_cli": "Anzeigen, was das CLI ausgibt"}},+ "ide_chats": {+ "back_to_sections": "Bereiche",+ "this_workspace": "Dieser Workspace",+ "other_folders": "Andere Ordner",+ "new_chat_here": "Neuer Chat in diesem Ordner",+ "no_chats_here": "Noch keine Chats in diesem Ordner",+ "show_more": "Mehr anzeigen"+ },"agentic_grid": {+ "view_switch": {+ "hint": "Diesen Workspace als Chat oder als Terminal-Raster anzeigen",+ "chat": "Chat",+ "grid": "Raster",+ "chat_hint": "Chat — sprich mit einem Agenten im Ordner dieses Workspaces.",+ "grid_hint": "Terminal-Raster — alle Bereiche gleichzeitig auf dem Bildschirm."+ },"toolbar": {"more_controls": "Weitere Arbeitsbereich-Steuerelemente","close_controls": "Arbeitsbereich-Steuerelemente schließen"@@ -5061,4 +5076,4 @@"read_only": "Eine gesprochene Unterhaltung. Sprich weiter, um sie fortzusetzen.","continue": "Per Sprache fortsetzen"}-}+}\ No newline at end of filediff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex d356720654..26359d5ee4 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -4415,7 +4415,22 @@"show_cli": "Show what the CLI displays"}},+ "ide_chats": {+ "back_to_sections": "Sections",+ "this_workspace": "This workspace",+ "other_folders": "Other folders",+ "new_chat_here": "New chat in this folder",+ "no_chats_here": "No chats in this folder yet",+ "show_more": "Show more"+ },"agentic_grid": {+ "view_switch": {+ "hint": "Show this workspace as a chat or as the terminal grid",+ "chat": "Chat",+ "grid": "Grid",+ "chat_hint": "Chat — talk to an agent in this workspace's folder.",+ "grid_hint": "Terminal grid — every pane on screen at once."+ },"toolbar": {"more_controls": "More workspace controls","close_controls": "Close workspace controls"@@ -5061,4 +5076,4 @@"read_only": "A spoken conversation. Continue it by talking.","continue": "Continue by voice"}-}+}\ No newline at end of filediff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 94cf0068a5..dd57445c5d 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -4415,7 +4415,22 @@"show_cli": "Mostrar lo que muestra la CLI"}},+ "ide_chats": {+ "back_to_sections": "Secciones",+ "this_workspace": "Este espacio de trabajo",+ "other_folders": "Otras carpetas",+ "new_chat_here": "Nuevo chat en esta carpeta",+ "no_chats_here": "Aún no hay chats en esta carpeta",+ "show_more": "Mostrar más"+ },"agentic_grid": {+ "view_switch": {+ "hint": "Mostrar este espacio de trabajo como chat o como cuadrícula de terminales",+ "chat": "Chat",+ "grid": "Cuadrícula",+ "chat_hint": "Chat: habla con un agente en la carpeta de este espacio de trabajo.",+ "grid_hint": "Cuadrícula de terminales: todos los paneles a la vez en pantalla."+ },"toolbar": {"more_controls": "Más controles del espacio de trabajo","close_controls": "Cerrar controles del espacio de trabajo"@@ -5061,4 +5076,4 @@"read_only": "Una conversación hablada. Continúala hablando.","continue": "Continuar por voz"}-}+}\ No newline at end of filediff --git a/jarvis/ui/web/frontend/src/lib/folderPath.ts b/jarvis/ui/web/frontend/src/lib/folderPath.tsnew file mode 100644index 0000000000..b7bf0a42e7--- /dev/null+++ b/jarvis/ui/web/frontend/src/lib/folderPath.ts@@ -0,0 +1,20 @@+/** Both path separators — this app's paths come from Windows, macOS and Linux. */+const SEPARATOR = /[\\/]/;+const TRAILING_SEPARATORS = /[\\/]+$/;++/**+ * The last segment of a folder path — what a person calls that folder.+ *+ * Platform-neutral by construction: both separators are split on, because the+ * path being shown came from whichever machine the backend is on, not from the+ * browser drawing it.+ *+ * "~" for an empty path: no folder chosen yet means the runner's own default,+ * and a blank chip says nothing at all.+ */+export function folderLeaf(path: string): string {+ if (!path) return "~";+ const trimmed = path.replace(TRAILING_SEPARATORS, "");+ const parts = trimmed.split(SEPARATOR);+ return parts[parts.length - 1] || trimmed;+}diff --git a/jarvis/ui/web/frontend/src/store/ideChat.ts b/jarvis/ui/web/frontend/src/store/ideChat.tsnew file mode 100644index 0000000000..e7a34b45e5--- /dev/null+++ b/jarvis/ui/web/frontend/src/store/ideChat.ts@@ -0,0 +1,65 @@+import { create } from "zustand";++import {+ rememberViewMode,+ storedViewMode,+ type WorkspaceView,+} from "@/components/agentic/workspaceView";++/**+ * Which face the Agentic IDE is wearing, for everyone who has to know.+ *+ * Three parts of the app read this and none of them can be reached from the+ * others by props: the IDE view itself (grid or chat surface), the workspace+ * bar's switch (inside the grid's header row), and the APP SIDEBAR — which is+ * mounted next to the whole page in `App.tsx` and swaps its section list for+ * the workspace's chats while chat mode is on. A store is the seam that+ * carries the answer across all three without threading it through the layout.+ *+ * `workspace` is the open one, republished by the IDE view on every switch.+ * The chat surface uses its PATH as the working directory of any chat started+ * there, which is what "you are in the workspace you opened" means in+ * practice: the agent runs in that folder, on that folder's files.+ */+export interface IdeWorkspace {+ id: string;+ name: string;+ /** Absolute path of the project folder; "" for a workspace with no folder. */+ path: string;+}++/**+ * The sidebar's two faces while chat mode is on.+ *+ * Chat mode takes the sidebar over for the workspace's conversations, and a+ * takeover with no way out is a trap — so "sections" is the face the back+ * button returns to, and the sections are all still there.+ */+export type IdeSidebarFace = "chats" | "sections";++interface IdeChatStore {+ view: WorkspaceView;+ workspace: IdeWorkspace | null;+ sidebarFace: IdeSidebarFace;++ setView: (next: WorkspaceView) => void;+ setWorkspace: (next: IdeWorkspace | null) => void;+ setSidebarFace: (next: IdeSidebarFace) => void;+}++export const useIdeChatStore = create<IdeChatStore>((set) => ({+ view: storedViewMode() ?? "grid",+ workspace: null,+ sidebarFace: "chats",++ setView: (next) => {+ rememberViewMode(next);+ // Entering chat always shows the chats: someone who just pressed "Chat"+ // asked for the conversations, and leaving the sidebar on the section+ // list they were reading a minute ago would hide what they came for.+ set(next === "chat" ? { view: next, sidebarFace: "chats" } : { view: next });+ },++ setWorkspace: (next) => set({ workspace: next }),+ setSidebarFace: (next) => set({ sidebarFace: next }),+}));diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsxindex a14d41a4c4..802d79a6d1 100644--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx@@ -42,13 +42,27 @@ const launcherEnglish = vi.hoisted<Record<string, string>>(() => ({}));vi.mock("@/i18n", () => ({useT: () => (key: string) => launcherEnglish[key] ?? key,+ // The chat surface's greeting fills a placeholder in its own string.+ fill: (text: string, values: Record<string, string>) =>+ Object.entries(values).reduce(+ (out, [name, value]) => out.replaceAll(`{${name}}`, value),+ text,+ ),}));// The workspace grid follows the app theme for its terminal colours; this test// renders the view outside the provider, so the hook is stubbed.+// The chat surface greets by name, and the name comes from a react-query+// read of the profile. This view is rendered bare here, with no provider —+// no name is a state the greeting already handles.+vi.mock("@/hooks/useUserName", () => ({ useUserName: () => null }));+vi.mock("@/hooks/useTheme", () => ({useTheme: () => ({ theme: "dark", setTheme: vi.fn(), toggle: vi.fn() }),useThemeValue: () => "dark",+ // The top bar's light/dark flip reads the provider through this one, and it+ // renders inside the bar this view carries.+ useOptionalTheme: () => ({ theme: "dark", setTheme: vi.fn(), toggle: vi.fn() }),}));const pushToast = vi.fn();@@ -136,6 +150,7 @@ import { AgenticIdeView } from "./AgenticIdeView";import { workspaceLaunchShortcut } from "@/components/agentic/WorkspaceLauncher";import * as api from "@/lib/agenticIdeApi";import { GRID_HORIZONTAL_PADDING_PX } from "@/components/agentic/layout";+import { useIdeChatStore } from "@/store/ideChat";const AGENTS: api.AgentsResponse = {terminal_available: true,@@ -299,9 +314,11 @@ beforeEach(() => {// and the remembered height is how a user who wants it open gets it.window.localStorage.setItem("jarvis.agenticIde.composerHeight.v2", "176");// The wizard's view step preselects the remembered reading mode, and the- // grid reads the same key on mount — a value left behind by one test must- // not decide how the next one's workspace opens.+ // open workspace reads the same answer — a value left behind by one test+ // must not decide how the next one's workspace opens. The store is a module+ // singleton, so the key alone is not enough: reset the live state too.window.localStorage.removeItem("jarvis.agenticIde.workspaceView");+ useIdeChatStore.setState({ view: "grid", workspace: null, sidebarFace: "chats" });vi.mocked(api.fetchIdeAgents).mockResolvedValue(AGENTS);vi.mocked(api.fetchIdeState).mockResolvedValue(EMPTY_STATE);vi.mocked(api.fetchFolders).mockResolvedValue({@@ -509,15 +526,14 @@ describe("Agentic IDE launcher", () => {);fireEvent.click(screen.getByRole("button", { name: /open workspace/i }));- // The grid reads the stored preference on mount, so the workspace comes up- // with the chat rail showing instead of the wall of terminals.- expect(await screen.findByTestId("pane-Mika")).toBeTruthy();+ // The workspace comes up on the CHAT surface — the agent chat in this+ // folder — while every terminal stays mounted behind it.+ expect(await screen.findByTestId("ide-chat-surface")).toBeTruthy();expect(window.localStorage.getItem("jarvis.agenticIde.workspaceView"),).toBe("chat");- const rail = screen.getByTestId("agentic-chat-rail");- expect(rail.className).toContain("flex");- expect(rail.className).not.toContain("hidden");+ expect(screen.getByTestId("pane-Mika")).toBeTruthy();+ expect(screen.getByTestId("agentic-grid-layer").className).toContain("opacity-0");});it("keeps every reading-mode miniature visible on the dark workspace", async () => {@@ -817,6 +833,54 @@ describe("Agentic IDE running workspace", () => {expect(screen.queryByTestId("workspace-launcher")).toBeNull();});+ it("switches between the chat and the grid from one control in the bar", async () => {+ vi.mocked(api.fetchIdeState).mockResolvedValue(+ stateWith(sessionWith(["Mika"])),+ );+ render(<AgenticIdeView />);+ await screen.findByTestId("pane-Mika");+ expect(screen.queryByTestId("ide-chat-surface")).toBeNull();++ fireEvent.click(screen.getByTestId("agentic-view-mode-toggle"));+ expect(await screen.findByTestId("ide-chat-surface")).toBeTruthy();+ // The switch has to be reachable from the surface it switched TO, or+ // pressing "Chat" would take the way back off screen with it.+ fireEvent.click(screen.getByTestId("agentic-view-mode-grid"));+ expect(screen.queryByTestId("ide-chat-surface")).toBeNull();+ });++ it("covers the panes for the chat instead of unmounting them", async () => {+ // The one rule this pair of surfaces must not break: every pane is a live+ // coding agent, and unmounting one kills it.+ vi.mocked(api.fetchIdeState).mockResolvedValue(+ stateWith(sessionWith(["Mika", "Nova"])),+ );+ render(<AgenticIdeView />);+ const mika = await screen.findByTestId("pane-Mika");++ fireEvent.click(screen.getByTestId("agentic-view-mode-toggle"));+ await screen.findByTestId("ide-chat-surface");+ expect(screen.getByTestId("pane-Mika")).toBe(mika);+ expect(screen.getByTestId("agentic-grid-layer").className).toContain("opacity-0");++ fireEvent.click(screen.getByTestId("agentic-view-mode-grid"));+ expect(screen.getByTestId("pane-Mika")).toBe(mika);+ expect(screen.getByTestId("agentic-grid-layer").className).not.toContain("opacity-0");+ });++ it("runs the chat in the folder of the workspace that is open", async () => {+ vi.mocked(api.fetchIdeState).mockResolvedValue(+ stateWith(sessionWith(["Mika"])),+ );+ render(<AgenticIdeView />);+ await screen.findByTestId("pane-Mika");++ fireEvent.click(screen.getByTestId("agentic-view-mode-toggle"));++ const surface = await screen.findByTestId("ide-chat-surface");+ expect(surface.dataset.folder).toBe("/work/project");+ });+it("toggles focus mode through the API, not just locally", async () => {vi.mocked(api.fetchIdeState).mockResolvedValue(stateWith(sessionWith(["Mika"])),diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsxindex 4d316137e6..ee705c0ac1 100644--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.tsx@@ -5,7 +5,14 @@** * no workspace open → a five-step wizard: folder, how many terminals, an* aggregate agent allocation, grid or chat view, then start,- * * workspace open → the terminal grid (see AgenticGrid).+ * * workspace open → one of TWO surfaces, picked by the switch in the bar:+ * the terminal grid (see AgenticGrid) or the agent chat in this workspace's+ * folder (see IdeChatSurface).+ *+ * The grid is never unmounted for the chat — it is covered. Every pane is a+ * live coding agent, and unmounting one kills it; a workspace that lost eleven+ * agents because somebody read a chat for a minute would be the worst bug this+ * view could have.** The wizard order is deliberate and matches how the decision actually gets* made: you know the folder first, the number of panes second, then which agent@@ -18,12 +25,15 @@import { useCallback, useEffect, useMemo, useRef, useState } from "react";import { Loader2 } from "lucide-react";import { useEventStore } from "@/store/events";+import { AgenticGrid } from "@/components/agentic/AgenticGrid";import {- AgenticGrid,- rememberViewMode,storedViewMode,type WorkspaceView,-} from "@/components/agentic/AgenticGrid";+} from "@/components/agentic/workspaceView";+import { ViewSwitch } from "@/components/agentic/ViewSwitch";+import { IdeChatSurface } from "@/components/agentic/IdeChatSurface";+import { useIdeChatStore } from "@/store/ideChat";+import { cn } from "@/lib/utils";import {VoiceBubble,storedVoiceBubbleOpen,@@ -168,6 +178,17 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {const [view, setView] = useState<WorkspaceView>(() => storedViewMode() ?? "grid",);+ /*+ * Which surface an OPEN workspace is showing — the store, not this state.+ *+ * The switch that changes it lives in the workspace bar and the sidebar+ * changes face with it, so the answer has to be readable from outside this+ * subtree. The wizard's `view` above is a different question ("how should the+ * one I am about to open start?") and stays local until `start` publishes it.+ */+ const ideView = useIdeChatStore((s) => s.view);+ const setIdeView = useIdeChatStore((s) => s.setView);+ const setIdeWorkspace = useIdeChatStore((s) => s.setWorkspace);// The registered subscriptions per CLI. Only ever used to OFFER a choice, so// a failed load costs the picker, never the wizard: with none loaded every// pane simply opens on the active account, exactly as before.@@ -552,9 +573,9 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {const start = async () => {if (!folder) return;setBusy(true);- // Recorded BEFORE the grid can mount: the grid reads the stored preference- // once, when it appears, so the wizard's answer has to be on disk by then.- rememberViewMode(view);+ // Recorded BEFORE the workspace can mount, so the surface it opens on is+ // the one the wizard was asked about. `setView` persists it too.+ setIdeView(view);try {// The open answers with the whole state — the new workspace AND the bar.// Re-fetching instead would be a race that can blank what was just opened.@@ -846,10 +867,27 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {* carries them even with nothing open, which is why it renders at all in that* case. Passing them here as well would put Restart on screen twice.*/+ /*+ * The open workspace, published for everyone outside this subtree: the+ * sidebar groups its chats by folder, and the chat surface runs in it.+ * Cleared when nothing is open so neither shows a folder that is not there.+ */+ const workspaceFolder = session?.folder ?? "";+ const workspaceName = session?.project.name ?? "";+ const workspaceId = session?.id ?? "";+ useEffect(() => {+ setIdeWorkspace(+ workspaceId+ ? { id: workspaceId, name: workspaceName, path: workspaceFolder }+ : null,+ );+ }, [workspaceId, workspaceName, workspaceFolder, setIdeWorkspace]);+const renderBar = (embedded: boolean) => (<WorkspaceBarembedded={embedded}actions={embedded ? undefined : <TopBarActions />}+ viewSwitch={<ViewSwitch view={ideView} onView={setIdeView} />}workspaces={barWorkspaces}activeId={session?.id ?? null}addingNew={addingNew}@@ -865,43 +903,80 @@ export function AgenticIdeView({ onScreen = true }: AgenticIdeViewProps) {// ------------------------------------------------------------ running modeif (session && !addingNew) {+ const onChat = ideView === "chat";return (<div className="flex h-full flex-col">- <div className="min-h-0 min-w-0 flex-1">+ {/*+ In chat mode the bar is its own row again: the grid it normally rides+ in is behind the chat, and a switch you cannot see is a switch you+ cannot switch back with.+ */}+ {onChat && renderBar(false)}+ <div className="relative min-h-0 min-w-0 flex-1">{/*Keyed by workspace, so switching tabs REPLACES the grid instead ofre-using it. That is deliberate: each pane's terminal is wired toone call-sign for its whole life, and re-using the component acrossworkspaces would leave xterm instances pointed at the panes of theworkspace that just left.++ COVERED for the chat, never hidden and never unmounted. `display:+ none` would measure every terminal at 0x0 and hand its agent a+ zero-column window; unmounting would kill the agent outright. At+ opacity 0 the panes keep their real geometry and simply are not+ looked at, so switching back is instant and nothing was disturbed.*/}- <AgenticGrid- key={session.id}- session={session}- workspaceBar={renderBar(true)}- appActions={<TopBarActions />}- onAddProject={() => void startAdding()}- onNewSession={() => void startSession()}- onJumpToWorkspace={(id, pane) => void jumpToPane(id, pane)}- jumpTo={jumpTo}- focusMode={focusMode}- onToggleFocus={(v) => void toggleFocus(v)}- onClose={() => void close()}- busy={busy}- maxTerminals={maxTerminals}- agents={splitChoices}- /* An install started from a split menu changes the one thing this- list answers, and the sweep behind it is cached — so the re-read- is explicit rather than waited for. */- onAgentsChanged={() => void reloadAgents()}- onSessionChanged={setSession}- accounts={ideAccounts}- onStateChanged={applyStateFromSettings}- onScreen={onScreen}- onPromptTargetChange={setPromptTarget}- voiceOpen={voiceOpen}- onToggleVoice={toggleVoiceBubble}- />+ <div+ className={cn(+ "absolute inset-0",+ onChat && "pointer-events-none opacity-0",+ )}+ aria-hidden={onChat}+ data-testid="agentic-grid-layer"+ >+ <AgenticGrid+ key={session.id}+ session={session}+ view={ideView}+ workspaceBar={onChat ? undefined : renderBar(true)}+ /* The app's own controls ride in whichever bar is visible;+ in chat that is the standalone one above, so the grid must+ not render a second, covered copy of them. */+ appActions={onChat ? undefined : <TopBarActions />}+ onAddProject={() => void startAdding()}+ onNewSession={() => void startSession()}+ onJumpToWorkspace={(id, pane) => void jumpToPane(id, pane)}+ jumpTo={jumpTo}+ focusMode={focusMode}+ onToggleFocus={(v) => void toggleFocus(v)}+ onClose={() => void close()}+ busy={busy}+ maxTerminals={maxTerminals}+ agents={splitChoices}+ /* An install started from a split menu changes the one thing this+ list answers, and the sweep behind it is cached — so the re-read+ is explicit rather than waited for. */+ onAgentsChanged={() => void reloadAgents()}+ onSessionChanged={setSession}+ accounts={ideAccounts}+ onStateChanged={applyStateFromSettings}+ onScreen={onScreen}+ onPromptTargetChange={setPromptTarget}+ voiceOpen={voiceOpen}+ onToggleVoice={toggleVoiceBubble}+ />+ </div>+ {onChat && (+ <div className="absolute inset-0 z-10 flex min-h-0 flex-col bg-background">+ <IdeChatSurface+ workspace={{+ id: session.id,+ name: session.project.name,+ path: session.folder,+ }}+ />+ </div>+ )}</div>{/*The floating voice bubble: talk to the assistant while the agents