Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(agentic-ide): preview the workspace itself, and name what it depends on
Ruben Lütke377724101cdc
diff --git a/jarvis/ui/web/frontend/src/components/agentic/TerminalCountStep.tsx b/jarvis/ui/web/frontend/src/components/agentic/TerminalCountStep.tsxindex 2d32cc1784..450c8f0a90 100644--- a/jarvis/ui/web/frontend/src/components/agentic/TerminalCountStep.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/TerminalCountStep.tsx@@ -77,10 +77,22 @@ const WORKSPACE_ASPECT = 1636 / 726;const STAGE_MIN_HEIGHT_PX = 160;const STAGE_MAX_HEIGHT_PX = 340;-/** Below this rendered width a pane has no room for its call-sign. */-const PANE_LABEL_MIN_PX = 54;-/** Below this it has no room for anything but a tinted rectangle. */-const PANE_CHROME_MIN_PX = 22;+/*+ * How much of itself a miniature pane has room to draw.+ *+ * BOTH axes, which the first version got wrong: it asked only about width, so+ * sixty terminals — laid out three across and twenty down — kept their title+ * bars at 16 px of height and rendered every call-sign as a squashed smear.+ * A pane that is wide and flat has no more room for a name than a narrow one.+ *+ * Dropping detail as the panes shrink is also the stage being honest: sixty+ * terminals really are sixty slivers, and showing them as plain rectangles says+ * so more clearly than sixty illegible labels.+ */+const PANE_LABEL_MIN_WIDTH_PX = 54;+const PANE_LABEL_MIN_HEIGHT_PX = 44;+const PANE_CHROME_MIN_WIDTH_PX = 22;+const PANE_CHROME_MIN_HEIGHT_PX = 22;interface TerminalCountStepProps {/** Terminals currently chosen. */@@ -188,11 +200,15 @@ function WorkspaceStage({const paneWidth = size.width > 0 ? size.width / safeColumns : 0;const paneHeight = size.height > 0 ? size.height / safeRows : 0;// Panes are laid out as a grid of equal cells, so one pane's detail level is- // every pane's — decided once rather than per tile.+ // every pane's — decided once rather than per tile. Before the first measure+ // both are 0; assume the roomy case so the stage never flashes as bare tiles.+ const unmeasured = paneWidth === 0 || paneHeight === 0;const detail: PaneDetail =- paneWidth === 0 || paneWidth >= PANE_LABEL_MIN_PX+ unmeasured ||+ (paneWidth >= PANE_LABEL_MIN_WIDTH_PX && paneHeight >= PANE_LABEL_MIN_HEIGHT_PX)? "full"- : paneWidth >= PANE_CHROME_MIN_PX+ : paneWidth >= PANE_CHROME_MIN_WIDTH_PX &&+ paneHeight >= PANE_CHROME_MIN_HEIGHT_PX? "chrome": "tile";@@ -275,11 +291,20 @@ function StagePane({return (<div+ /*+ * Dark, like the terminals it stands for — not a tile of brand colour.+ *+ * The first version filled every pane with the accent, and eight of them+ * read as a wall of yellow rather than as a workspace. Colour now marks+ * ONE thing: which pane the prompt bar will type into. That is also the+ * one piece of state the stage can honestly show, since a fresh workspace+ * really does open with the first pane selected.+ */className={cn("flex min-h-0 min-w-0 flex-col overflow-hidden rounded-md border transition-colors",focused- ? "border-primary/50 bg-primary/[0.09]"- : "border-primary/20 bg-primary/[0.04]",+ ? "border-primary/45 bg-primary/[0.05]"+ : "border-border/80 bg-background/70",)}>{detail !== "tile" && (@@ -287,21 +312,21 @@ function StagePane({className={cn("flex shrink-0 items-center gap-1.5 border-b px-1.5 py-1",focused- ? "border-primary/30 bg-primary/10"- : "border-primary/15 bg-primary/[0.05]",+ ? "border-primary/25 bg-primary/[0.07]"+ : "border-border/60 bg-muted/20",)}><spanclassName={cn("h-1.5 w-1.5 shrink-0 rounded-full",- focused ? "bg-primary" : "bg-primary/40",+ focused ? "bg-primary" : "bg-muted-foreground/50",)}/>{detail === "full" && (<spanclassName={cn("truncate font-mono text-[10px] leading-none",- focused ? "text-primary" : "text-primary/60",+ focused ? "text-primary" : "text-muted-foreground",)}>{name}@@ -321,7 +346,10 @@ function StagePane({at once actually look. Deterministic widths and delays, so thestage does not reshuffle itself on every keystroke.*/- className="h-1 shrink-0 animate-pulse rounded-full bg-primary/25 motion-reduce:animate-none"+ className={cn(+ "h-1 shrink-0 animate-pulse rounded-full motion-reduce:animate-none",+ focused ? "bg-primary/30" : "bg-muted-foreground/25",+ )}style={{width: `${[82, 58, 71, 45, 64][(index + line) % 5]}%`,animationDelay: `${((index * 3 + line) % 7) * 260}ms`,@@ -393,9 +421,26 @@ function Readout({);}-/** 1 636 rather than 1636 — a width is read, not computed with. */+/**+ * Digit grouping for a pixel width the user READS: 1\u202F636, not 1636.+ *+ * The separator is an explicit NARROW NO-BREAK SPACE escape rather than a+ * literal one, so it stays visible in the source and cannot be mistaken for+ * an ordinary space by the next person who greps for it — which is exactly+ * how it slipped past a test that searched for a plain space. It also keeps+ * the number from breaking across two lines mid-thousands.+ *+ * Grouped by hand rather than through `toLocaleString`, whose output depends+ * on the runtime's locale data: a number the user reads should not change+ * shape with the machine that rendered it.+ */+const THOUSANDS_SEPARATOR = "\u202F";+function formatPx(value: number): string {- return value.toLocaleString("en-US").replace(/,/g, " ");+ return String(Math.round(value)).replace(+ /\B(?=(\d{3})+(?!\d))/g,+ THOUSANDS_SEPARATOR,+ );}/**diff --git a/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts b/jarvis/ui/web/frontend/src/components/agentic/layout.test.tsindex c773b79f1d..a04498ec43 100644--- a/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts+++ b/jarvis/ui/web/frontend/src/components/agentic/layout.test.ts@@ -1,9 +1,13 @@import { describe, expect, it } from "vitest";import {MAX_PANES_PER_BAND,+ MIN_PANE_WIDTH_PX,+ bandCapacityFor,paneColumns,paneGrid,paneLines,+ widthForOneBand,+ wizardPanes,workspaceBandCapacityFor,} from "./layout";@@ -19,6 +23,71 @@ describe("workspaceBandCapacityFor", () => {});});+describe("the two width helpers say which width they take", () => {+ it("separates the grid's own content width from the outer width", () => {+ // The defect they exist to prevent: the running grid measures its CONTENT+ // box (padding already excluded) while the wizard measures an unpadded+ // element. Feeding both to one helper made the grid lay itself out 24 px+ // narrower than it is, so the preview and the workspace changed column+ // count at different window widths and the preview looked like a liar.+ expect(bandCapacityFor(1520)).toBe(4);+ expect(workspaceBandCapacityFor(1520 + 24)).toBe(4);+ // Same physical window, same answer — which is the whole point.+ expect(bandCapacityFor(1519)).toBe(3);+ expect(workspaceBandCapacityFor(1519 + 24)).toBe(3);+ });+});++describe("wizardPanes", () => {+ it("is the one row of columns the backend opens a workspace with", () => {+ // Mirrors agentic_ide/session.py, which sets column=index and slot=0 for a+ // wizard-opened workspace. The preview feeds these to the same `paneGrid`+ // the running workspace uses, so it cannot describe a layout the backend+ // would never build.+ expect(wizardPanes(3)).toEqual([+ { column: 0, slot: 0 },+ { column: 1, slot: 0 },+ { column: 2, slot: 0 },+ ]);+ });++ it("has no panes for an empty or nonsensical count", () => {+ expect(wizardPanes(0)).toEqual([]);+ expect(wizardPanes(-4)).toEqual([]);+ });++ it("lays out exactly like the workspace it stands for", () => {+ // 8 terminals in a window wide enough for 4 columns: 4 across, 2 down —+ // the arrangement reported as missing from the preview on 2026-07-26.+ const grid = paneGrid(wizardPanes(8), 4);+ expect(grid.columns).toBe(4);+ expect(paneLines(8, 4)).toBe(2);+ // The same 8 in a narrow window really are 2 across and 4 down. Both are+ // correct; the preview has to say which one it is showing.+ expect(paneGrid(wizardPanes(8), 2).columns).toBe(2);+ expect(paneLines(8, 2)).toBe(4);+ });+});++describe("widthForOneBand", () => {+ it("names the width at which a count stops wrapping", () => {+ // What the readout tells the user so a maximise cannot turn the preview+ // into a broken promise: eight panes need 8 × 380 px plus the grid padding.+ expect(widthForOneBand(8)).toBe(8 * MIN_PANE_WIDTH_PX + 24);+ // And it agrees with the helper the wizard measures through, rather than+ // being a second opinion about the same threshold.+ expect(workspaceBandCapacityFor(widthForOneBand(8) as number)).toBe(8);+ });++ it("has nothing to offer when there is no wrap to undo", () => {+ expect(widthForOneBand(1)).toBeNull();+ });++ it("has nothing to offer past the readable cap, where no width is enough", () => {+ expect(widthForOneBand(MAX_PANES_PER_BAND + 1)).toBeNull();+ });+});+describe("paneColumns", () => {it("keeps a small workspace on one line", () => {// What the grid actually does today for every one of these: one band,diff --git a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsxindex 865fa7633d..18c7b6270d 100644--- a/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx+++ b/jarvis/ui/web/frontend/src/views/AgenticIdeView.test.tsx@@ -1,4 +1,10 @@-import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";+import {+ cleanup,+ fireEvent,+ render,+ screen,+ waitFor,+} from "@testing-library/react";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";// jsdom ships no ResizeObserver, and the workspace grid measures itself with@@ -9,7 +15,8 @@ class ResizeObserverPolyfill {disconnect(): void {}}if (typeof globalThis.ResizeObserver === "undefined") {- globalThis.ResizeObserver = ResizeObserverPolyfill as unknown as typeof ResizeObserver;+ globalThis.ResizeObserver =+ ResizeObserverPolyfill as unknown as typeof ResizeObserver;}// Identity translator so rendered text equals the i18n key.@@ -59,6 +66,7 @@ vi.mock("@/lib/agenticIdeApi", () => ({forgetResumeOffer: vi.fn(),fetchWorkspaces: vi.fn(),activateWorkspace: vi.fn(),+ renameWorkspace: vi.fn(),closeWorkspace: vi.fn(),fetchNativePickerSupport: vi.fn(),openNativePicker: vi.fn(),@@ -117,7 +125,8 @@ function stateWith(session: api.SessionState): api.IdeState {name: session.project.name,branch: session.project.branch,terminals: session.terminals.length,- live_terminals: session.terminals.filter((t) => t.status === "live").length,+ live_terminals: session.terminals.filter((t) => t.status === "live")+ .length,focus_mode: session.focus_mode,created_at: session.created_at,last_active_at: session.created_at,@@ -131,45 +140,51 @@ function stateWith(session: api.SessionState): api.IdeState {const NO_OFFER: api.ResumeOffer = {available: false,- folder: "",- folder_name: "",- folder_exists: false,saved_at: 0,- session_id: "",+ workspace_count: 0,+ terminal_count: 0,resumable_count: 0,- terminals: [],+ workspaces: [],};const PREVIOUS_WORKSPACE: api.ResumeOffer = {available: true,- folder: "/work/project",- folder_name: "project",- folder_exists: true,saved_at: 1_753_473_600,- session_id: "ide_old",+ workspace_count: 1,+ terminal_count: 2,resumable_count: 1,- terminals: [+ workspaces: [{- key: "mika",- name: "Mika",- agent: "claude",- display_name: "Claude Code",- column: 0,- slot: 0,+ session_id: "ide_old",+ folder: "/work/project",+ folder_name: "project",+ folder_exists: true,available: true,- resumable: true,- prompts_sent: 2,- },- {- key: "nova",- name: "Nova",- agent: "claude",- display_name: "Claude Code",- column: 1,- slot: 0,- available: true,- resumable: false,- prompts_sent: 0,+ resumable_count: 1,+ terminals: [+ {+ key: "alex",+ name: "Alex",+ agent: "claude",+ display_name: "Claude Code",+ column: 0,+ slot: 0,+ available: true,+ resumable: true,+ prompts_sent: 2,+ },+ {+ key: "blake",+ name: "Blake",+ agent: "claude",+ display_name: "Claude Code",+ column: 1,+ slot: 0,+ available: true,+ resumable: false,+ prompts_sent: 0,+ },+ ],},],};@@ -222,7 +237,12 @@ beforeEach(() => {path: null,parent: null,entries: [- { name: "project", path: "/work/project", is_project: true, is_repo: true },+ {+ name: "project",+ path: "/work/project",+ is_project: true,+ is_repo: true,+ },],device_name: "Rubens MacBook",});@@ -254,7 +274,9 @@ describe("Agentic IDE wizard", () => {render(<AgenticIdeView />);await waitFor(() => expect(api.fetchIdeAgents).toHaveBeenCalled());- const next = screen.getByRole("button", { name: /next/i }) as HTMLButtonElement;+ const next = screen.getByRole("button", {+ name: /next/i,+ }) as HTMLButtonElement;expect(next.disabled).toBe(true);fireEvent.click(await screen.findByRole("button", { name: /project/i }));@@ -262,7 +284,9 @@ describe("Agentic IDE wizard", () => {});it("walks folder → count → agents → start and opens the workspace", async () => {- vi.mocked(api.startIdeSession).mockResolvedValue(stateWith(sessionWith(["Mika", "Nova"])));+ vi.mocked(api.startIdeSession).mockResolvedValue(+ stateWith(sessionWith(["Mika", "Nova"])),+ );render(<AgenticIdeView />);await waitFor(() => expect(api.fetchIdeAgents).toHaveBeenCalled());@@ -291,10 +315,11 @@ describe("Agentic IDE wizard", () => {});/**- * Drive the wizard to the count step with a workspace of ``width`` pixels,- * choose ``n`` through a preset or Custom Terminals, and return its dot grid.+ * Drive the wizard to the count step in a workspace of ``width`` pixels, set+ * the count to ``n``, and return the stage — the miniature of the workspace+ * that is about to open.*/- async function countTile(width: number, n: string): Promise<HTMLElement> {+ async function stageAt(width: number, n: string): Promise<HTMLElement> {const previous = globalThis.ResizeObserver;class WidthObserver {constructor(private readonly callback: ResizeObserverCallback) {}@@ -307,87 +332,151 @@ describe("Agentic IDE wizard", () => {unobserve(): void {}disconnect(): void {}}- globalThis.ResizeObserver = WidthObserver as unknown as typeof ResizeObserver;+ globalThis.ResizeObserver =+ WidthObserver as unknown as typeof ResizeObserver;try {render(<AgenticIdeView />);await waitFor(() => expect(api.fetchIdeAgents).toHaveBeenCalled());fireEvent.click(await screen.findByRole("button", { name: /project/i }));fireEvent.click(screen.getByRole("button", { name: /next/i }));- const preset = screen.queryByRole("button", { name: n });- if (preset) return preset.querySelector("div") as HTMLElement;-- fireEvent.click(screen.getByRole("button", { name: /custom terminals/i }));- fireEvent.change(screen.getByRole("spinbutton", { name: /custom terminal count/i }), {- target: { value: n },- });- return screen.getByTestId("custom-terminal-preview");+ fireEvent.change(+ screen.getByRole("spinbutton", { name: /number of terminals/i }),+ { target: { value: n } },+ );+ return screen.getByTestId("workspace-stage-grid");} finally {globalThis.ResizeObserver = previous;}}- /** The number of columns promised by a preview dot grid. */- const dotsOf = (grid: HTMLElement) => grid.style.gridTemplateColumns;+ /** Columns and bands the stage lays its panes out in. */+ const columnsOf = (stage: HTMLElement) => stage.style.gridTemplateColumns;+ const rowsOf = (stage: HTMLElement) => stage.style.gridTemplateRows;- it("keeps uncommon counts in Custom Terminals instead of fixed cards", async () => {- await countTile(2328, "10");+ /**+ * A pixel width the way the readout writes it.+ *+ * Widths are grouped with a NARROW NO-BREAK SPACE (U+202F) so a number+ * never breaks across two lines. Spelled as an escape rather than pasted:+ * the two characters are indistinguishable in an editor, and only one of+ * them matches.+ */+ const grouped = (digits: string) => digits.replace(/ /g, "\u202F");++ it("sets any count from one control instead of cards plus a custom row", async () => {+ // Two ways to set one number meant two competing "selected" states. The+ // track covers every value, and the common ones are notches on it.+ await stageAt(2328, "10");- expect(screen.queryByRole("button", { name: "10" })).toBeNull();- expect(screen.queryByRole("button", { name: "12" })).toBeNull();- expect(screen.getByRole("button", { name: /custom terminals/i })).toBeTruthy();expect(- (screen.getByRole("spinbutton", {- name: /custom terminal count/i,- }) as HTMLInputElement).value,+ (+ screen.getByRole("slider", {+ name: /number of terminals/i,+ }) as HTMLInputElement+ ).value,).toBe("10");+ expect(screen.getByTestId("terminal-count-value").textContent).toBe("10");+ expect(+ screen.queryByRole("button", { name: /custom terminals/i }),+ ).toBeNull();});- it("builds the requested number of custom terminal plans", async () => {+ it("builds the requested number of terminal plans", async () => {render(<AgenticIdeView />);await waitFor(() => expect(api.fetchIdeAgents).toHaveBeenCalled());fireEvent.click(await screen.findByRole("button", { name: /project/i }));fireEvent.click(screen.getByRole("button", { name: /next/i }));- fireEvent.click(screen.getByRole("button", { name: /custom terminals/i }));- fireEvent.change(screen.getByRole("spinbutton", { name: /custom terminal count/i }), {- target: { value: "10" },- });+ fireEvent.change(+ screen.getByRole("spinbutton", { name: /number of terminals/i }),+ { target: { value: "10" } },+ );fireEvent.click(screen.getByRole("button", { name: /next/i }));expect(screen.getByLabelText("Call-sign for terminal 10")).toBeTruthy();});- it("caps custom terminal counts at the backend limit", async () => {- await countTile(2328, "99");+ it("caps the count at the backend limit", async () => {+ await stageAt(2328, "99");expect(- (screen.getByRole("spinbutton", {- name: /custom terminal count/i,- }) as HTMLInputElement).value,+ (+ screen.getByRole("spinbutton", {+ name: /number of terminals/i,+ }) as HTMLInputElement+ ).value,).toBe("12");expect(- (screen.getByRole("button", { name: /use one more terminal/i }) as HTMLButtonElement)- .disabled,+ (+ screen.getByRole("button", {+ name: /use one more terminal/i,+ }) as HTMLButtonElement+ ).disabled,).toBe(true);});it("previews 12 terminals as 6 and 6 when the window is wide enough", async () => {// 2328 px of workspace minus the grid's padding fits six 380 px panes, so// the twelve wrap into two even bands — the arrangement the user asked for.- const tile = await countTile(2328, "12");- expect(dotsOf(tile)).toBe("repeat(6, minmax(0, 1fr))");+ const stage = await stageAt(2328, "12");+ expect(columnsOf(stage)).toBe("repeat(6, minmax(0, 1fr))");+ expect(rowsOf(stage)).toBe("repeat(2, minmax(0, 1fr))");});it("previews the narrower arrangement a narrow window will really produce", async () => {// The same twelve in a 1314 px workspace: only three panes stay readable// per line, so the grid makes 3 × 4. The preview promised 6 + 6 here once,// which is the drift this test exists to catch.- const tile = await countTile(1314, "12");- expect(dotsOf(tile)).toBe("repeat(3, minmax(0, 1fr))");+ const stage = await stageAt(1314, "12");+ expect(columnsOf(stage)).toBe("repeat(3, minmax(0, 1fr))");+ expect(rowsOf(stage)).toBe("repeat(4, minmax(0, 1fr))");});it("keeps a small workspace on one line at any usable width", async () => {- const tile = await countTile(1314, "3");- expect(dotsOf(tile)).toBe("repeat(3, minmax(0, 1fr))");+ const stage = await stageAt(1314, "3");+ expect(columnsOf(stage)).toBe("repeat(3, minmax(0, 1fr))");+ expect(rowsOf(stage)).toBe("repeat(1, minmax(0, 1fr))");+ });++ it("draws one pane per terminal and never more than the stage can hold", async () => {+ // The old dot preview sat in a fixed 40×40 px box with nothing bounding it,+ // so a high count in a narrow window grew a tall column of dots straight out+ // through the card, over the buttons above and below. The stage divides a+ // FIXED height between its rows instead, so no count can overflow it — the+ // panes get thinner, the box does not grow.+ const stage = await stageAt(800, "12");+ expect(stage.children.length).toBe(12);+ expect(columnsOf(stage)).toBe("repeat(2, minmax(0, 1fr))");+ expect(rowsOf(stage)).toBe("repeat(6, minmax(0, 1fr))");+ });++ it("names the window width its arrangement depends on", async () => {+ // The reported bug: the preview said "2 across, 4 down" in a 1050 px window+ // and the workspace opened 4 × 2 once maximised. Both are right — what was+ // missing is that the arrangement has a condition at all.+ await stageAt(1050, "8");++ const readout = screen.getByTestId("workspace-stage-readout");+ expect(readout.textContent).toContain("2 across");+ expect(readout.textContent).toContain("4 down");+ // 8 × 380 px + the grid's padding — the width at which they all fit on one+ // line, stated so a maximise cannot turn the preview into a broken promise.+ // `grouped` spells out the narrow no-break space the readout separates+ // thousands with: an invisible literal here reads as a plain space,+ // passes review, and fails the run.+ expect(readout.textContent).toContain(grouped("3 064"));+ // 1 056, not 1 050: the view rounds the measured width to 16 px steps so a+ // one-pixel drift cannot churn the layout, and the readout reports the width+ // the arrangement was actually decided from rather than a truer-looking one.+ expect(readout.textContent).toContain(grouped("1 056"));+ });++ it("says all side by side once the window really is wide enough", async () => {+ await stageAt(3200, "8");++ const readout = screen.getByTestId("workspace-stage-readout");+ expect(readout.textContent).toContain("8 across");+ expect(readout.textContent).toContain("1 down");+ expect(readout.textContent).toMatch(/wide enough/i);});it("says so plainly when the machine has no terminal backend", async () => {@@ -412,14 +501,18 @@ describe("Agentic IDE wizard", () => {describe("Agentic IDE running workspace", () => {it("renders the open session instead of the wizard", async () => {- vi.mocked(api.fetchIdeState).mockResolvedValue(stateWith(sessionWith(["Mika"])));+ vi.mocked(api.fetchIdeState).mockResolvedValue(+ stateWith(sessionWith(["Mika"])),+ );render(<AgenticIdeView />);expect(await screen.findByTestId("pane-Mika")).toBeTruthy();expect(screen.queryByRole("button", { name: /next/i })).toBeNull();});it("toggles focus mode through the API, not just locally", async () => {- vi.mocked(api.fetchIdeState).mockResolvedValue(stateWith(sessionWith(["Mika"])));+ vi.mocked(api.fetchIdeState).mockResolvedValue(+ stateWith(sessionWith(["Mika"])),+ );vi.mocked(api.setFocusMode).mockResolvedValue(true);render(<AgenticIdeView />);@@ -432,14 +525,18 @@ describe("Agentic IDE running workspace", () => {vi.mocked(api.setFocusMode).mockResolvedValue(!before);fireEvent.click(toggle);- await waitFor(() => expect(api.setFocusMode).toHaveBeenLastCalledWith(!before));+ await waitFor(() =>+ expect(api.setFocusMode).toHaveBeenLastCalledWith(!before),+ );await waitFor(() =>expect(toggle.getAttribute("aria-pressed")).toBe(String(!before)),);});it("sends a prompt to the selected terminal through the same endpoint voice uses", async () => {- vi.mocked(api.fetchIdeState).mockResolvedValue(stateWith(sessionWith(["Mika", "Nova"])));+ vi.mocked(api.fetchIdeState).mockResolvedValue(+ stateWith(sessionWith(["Mika", "Nova"])),+ );vi.mocked(api.promptTerminal).mockResolvedValue({terminal: "Mika",sent: "run the tests",@@ -460,7 +557,9 @@ describe("Agentic IDE running workspace", () => {});it("reports a refused prompt instead of pretending it landed", async () => {- vi.mocked(api.fetchIdeState).mockResolvedValue(stateWith(sessionWith(["Mika"])));+ vi.mocked(api.fetchIdeState).mockResolvedValue(+ stateWith(sessionWith(["Mika"])),+ );vi.mocked(api.promptTerminal).mockRejectedValue(new Error("Mika is not running right now"),);@@ -473,7 +572,10 @@ describe("Agentic IDE running workspace", () => {fireEvent.click(screen.getByRole("button", { name: /send/i }));await waitFor(() =>- expect(pushToast).toHaveBeenCalledWith("error", "Mika is not running right now"),+ expect(pushToast).toHaveBeenCalledWith(+ "error",+ "Mika is not running right now",+ ),);});it("shows panes that voice opened, without a reload", async () => {@@ -483,14 +585,18 @@ describe("Agentic IDE running workspace", () => {* the listener existed, the agents were running and the user saw the old grid* — the feature looked broken while working perfectly.*/- vi.mocked(api.fetchIdeState).mockResolvedValue(stateWith(sessionWith(["Mika", "Nova"])));+ vi.mocked(api.fetchIdeState).mockResolvedValue(+ stateWith(sessionWith(["Mika", "Nova"])),+ );render(<AgenticIdeView />);await screen.findByTestId("pane-Mika");expect(screen.queryByTestId("pane-Aria")).toBeNull();// Voice opened a third pane; the WebSocket layer turns the bus event into// this window event.- vi.mocked(api.fetchIdeState).mockResolvedValue(stateWith(sessionWith(["Mika", "Nova", "Aria"])));+ vi.mocked(api.fetchIdeState).mockResolvedValue(+ stateWith(sessionWith(["Mika", "Nova", "Aria"])),+ );window.dispatchEvent(new CustomEvent("jarvis:agentic-ide-changed", {detail: { names: ["Aria"], agent: "claude" },@@ -510,7 +616,7 @@ describe("AgenticIdeView — resuming the last workspace", () => {render(<AgenticIdeView />);await screen.findByTestId("resume-card");- expect(screen.getByTestId("resume-pane-mika")).toBeTruthy();+ expect(screen.getByTestId("resume-pane-alex")).toBeTruthy();// The wizard is still right there — the offer never blocks it.expect(screen.getByText("Folder")).toBeTruthy();});@@ -522,7 +628,9 @@ describe("AgenticIdeView — resuming the last workspace", () => {});it("does not offer a resume while a workspace is open", async () => {- vi.mocked(api.fetchIdeState).mockResolvedValue(stateWith(sessionWith(["Mika"])));+ vi.mocked(api.fetchIdeState).mockResolvedValue(+ stateWith(sessionWith(["Mika"])),+ );vi.mocked(api.fetchResumeOffer).mockResolvedValue(PREVIOUS_WORKSPACE);render(<AgenticIdeView />);@@ -533,9 +641,12 @@ describe("AgenticIdeView — resuming the last workspace", () => {it("reopens the workspace and reports what really came back", async () => {vi.mocked(api.fetchResumeOffer).mockResolvedValue(PREVIOUS_WORKSPACE);vi.mocked(api.resumeWorkspace).mockResolvedValue({- session: sessionWith(["Mika", "Nova"]),+ state: stateWith(sessionWith(["Mika", "Nova"])),+ workspace_count: 1,+ terminal_count: 2,resumable_count: 1,started_fresh: 1,+ skipped: [],});render(<AgenticIdeView />);@@ -609,7 +720,9 @@ describe("AgenticIdeView — the workspace bar", () => {expect(front.getAttribute("aria-selected")).toBe("true");// A background workspace says how many of its agents are still running —// that is what keeps "it runs until you close it" honest.- expect(screen.getByTestId("workspace-panes-ide_other").textContent).toBe("2/3");+ expect(screen.getByTestId("workspace-panes-ide_other").textContent).toBe(+ "2/3",+ );});it("stays hidden while nothing is open", async () => {@@ -627,7 +740,9 @@ describe("AgenticIdeView — the workspace bar", () => {fireEvent.click(await screen.findByTestId("workspace-tab-ide_other"));- await waitFor(() => expect(api.activateWorkspace).toHaveBeenCalledWith("ide_other"));+ await waitFor(() =>+ expect(api.activateWorkspace).toHaveBeenCalledWith("ide_other"),+ );await screen.findByTestId("pane-Kai");// Switching is not closing: nothing was ended.expect(api.endIdeSession).not.toHaveBeenCalled();@@ -647,7 +762,9 @@ describe("AgenticIdeView — the workspace bar", () => {fireEvent.click(await screen.findByTestId("workspace-add"));// null, not a close: the workspaces stay open with their agents running.- await waitFor(() => expect(api.activateWorkspace).toHaveBeenCalledWith(null));+ await waitFor(() =>+ expect(api.activateWorkspace).toHaveBeenCalledWith(null),+ );expect(api.closeWorkspace).not.toHaveBeenCalled();expect(api.endIdeSession).not.toHaveBeenCalled();// The wizard is showing, and the bar still lists both workspaces.@@ -667,18 +784,53 @@ describe("AgenticIdeView — the workspace bar", () => {expect(api.closeWorkspace).not.toHaveBeenCalled();fireEvent.click(screen.getByTestId("workspace-close-confirm-ide_other"));- await waitFor(() => expect(api.closeWorkspace).toHaveBeenCalledWith("ide_other"));+ await waitFor(() =>+ expect(api.closeWorkspace).toHaveBeenCalledWith("ide_other"),+ );await waitFor(() =>expect(screen.queryByTestId("workspace-tab-ide_other")).toBeNull(),);});+ it("renames a workspace from the pencil action", async () => {+ vi.mocked(api.fetchIdeState).mockResolvedValue(twoWorkspaces());+ const renamed = twoWorkspaces();+ renamed.workspaces = renamed.workspaces.map((workspace) =>+ workspace.id === "ide_other"+ ? { ...workspace, name: "Backend review" }+ : workspace,+ );+ vi.mocked(api.renameWorkspace).mockResolvedValue(renamed);+ render(<AgenticIdeView />);++ fireEvent.click(await screen.findByTestId("workspace-rename-ide_other"));+ const input = screen.getByTestId(+ "workspace-rename-input-ide_other",+ ) as HTMLInputElement;+ fireEvent.change(input, { target: { value: "Backend review" } });+ fireEvent.click(screen.getByTestId("workspace-rename-save-ide_other"));++ await waitFor(() =>+ expect(api.renameWorkspace).toHaveBeenCalledWith(+ "ide_other",+ "Backend review",+ ),+ );+ expect(await screen.findByText("Backend review")).toBeTruthy();+ expect(api.closeWorkspace).not.toHaveBeenCalled();+ });+it("refuses to add one past the cap", async () => {const full = twoWorkspaces();- vi.mocked(api.fetchIdeState).mockResolvedValue({ ...full, max_workspaces: 2 });+ vi.mocked(api.fetchIdeState).mockResolvedValue({+ ...full,+ max_workspaces: 2,+ });render(<AgenticIdeView />);- const add = (await screen.findByTestId("workspace-add")) as HTMLButtonElement;+ const add = (await screen.findByTestId(+ "workspace-add",+ )) as HTMLButtonElement;expect(add.disabled).toBe(true);});});