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): build the Command Deck surface
rubenluetke10-beep8b00dbdd4728
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.deck.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.deck.test.tsxnew file mode 100644index 0000000000..8a219a9755--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.deck.test.tsx@@ -0,0 +1,463 @@+/**+ * The Command Deck — a third way of reading the SAME panes.+ *+ * Its own file rather than another suite inside `AgenticGrid.test.tsx`: that+ * one is already three thousand lines about the grid, and the deck is the mode+ * that changes what the assistant DOES rather than only what the screen looks+ * like. What is pinned here is the part a redesign is most likely to break —+ * the terminals stay mounted and folded away, the room is what is on screen,+ * and every state a card can be in comes from the pane rather than from the+ * deck's own opinion.+ */+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++class ResizeObserverPolyfill {+ constructor(_callback: ResizeObserverCallback) {}+ observe() {}+ unobserve() {}+ disconnect() {}+}+if (typeof globalThis.ResizeObserver === "undefined") {+ globalThis.ResizeObserver = ResizeObserverPolyfill;+}++const pushToast = vi.fn();+vi.mock("@/store/events", () => ({+ useEventStore: (selector: (s: Record<string, unknown>) => unknown) =>+ selector({ pushToast, voiceState: "idle" }),+}));++vi.mock("@/hooks/useTheme", () => ({ useThemeValue: () => "dark" }));++const EMPTY_QUEUE = {+ sleeping: false,+ in_conversation: false,+ on_air: null,+ pending: [],+ reports: [],+};++vi.mock("@/lib/agenticIdeApi", () => ({+ addTerminal: vi.fn(),+ attachToTerminal: vi.fn(),+ closeTerminal: vi.fn(),+ closeTerminals: vi.fn(),+ composePrompt: vi.fn(),+ moveTerminal: vi.fn(),+ renameTerminal: vi.fn(),+ promptTerminal: vi.fn(),+ clearTerminalRecap: vi.fn(),+ refreshTerminalRecap: vi.fn(),+ setTerminalRecap: vi.fn(),+ saveTerminalFontSize: vi.fn(async () => undefined),+ setIdeActiveAccount: vi.fn(),+ continueInterrupted: vi.fn(),+ markPaneNotificationsRead: vi.fn(async () => 0),+ clearPaneNotifications: vi.fn(async () => undefined),+ syncAgenticIdeSurface: vi.fn(async () => undefined),+ fetchTerminalRecaps: vi.fn(async () => ({ workspace_id: "ide_test", terminals: [] })),+ fetchTerminalActivity: vi.fn(async () => ({ workspace_id: "ide_test", terminals: [] })),+ fetchInterrupted: vi.fn(async () => ({+ count: 0,+ continuable_count: 0,+ prompt: "continue",+ panes: [],+ })),+ fetchPaneNotifications: vi.fn(async () => ({+ enabled: true,+ unread: 0,+ notifications: [],+ })),+ fetchTerminalUiPreferences: vi.fn(async () => ({+ terminal_font_size: 13,+ stored: false,+ min: 10,+ max: 20,+ default: 13,+ })),+ // The deck's own two calls.+ fetchDeckQueue: vi.fn(async () => EMPTY_QUEUE),+ ackDeckReport: vi.fn(async () => EMPTY_QUEUE),+ setDeckHold: vi.fn(async (_name: string, held: boolean) => held),+}));++/** xterm needs a real canvas; the deck only ever asks whether it is mounted. */+vi.mock("./AgenticTerminal", () => ({+ AgenticTerminal: ({ name }: { name: string }) => <div data-testid={`pane-${name}`}>{name}</div>,+}));++/** The orb draws to a canvas jsdom does not have. */+vi.mock("./VoiceOrb", () => ({+ VoiceOrb: ({ state }: { state: string }) => <div data-testid="voice-orb" data-state={state} />,+}));++import { AgenticGrid } from "./AgenticGrid";+import * as api from "@/lib/agenticIdeApi";+import type { SessionState, TerminalState } from "@/lib/agenticIdeApi";++function pane(name: string, column: number, index: number): TerminalState {+ return {+ key: name.toLowerCase(),+ name,+ agent: "claude",+ display_name: "Claude Code",+ index,+ column,+ slot: 0,+ status: "live",+ exit_code: null,+ error: "",+ started_at: 0,+ last_output_at: 0,+ idle_seconds: 0,+ prompts_sent: 0,+ last_prompt: "",+ lines_captured: 0,+ };+}++function sessionWith(names: string[]): SessionState {+ return {+ id: "ide_test",+ folder: "/work/project",+ project: {+ path: "/work/project",+ name: "project",+ exists: true,+ is_repo: true,+ branch: "main",+ stacks: [],+ instruction_files: [],+ top_level_dirs: [],+ skills: [],+ subagents: [],+ commands: [],+ note: "",+ },+ created_at: 0,+ focus_mode: false,+ terminals: names.map((name, i) => pane(name, i, i)),+ };+}++const FOUR = sessionWith(["Mika", "Nova", "Aria", "Kai"]);++function renderGrid(session = FOUR, extra: Record<string, unknown> = {}) {+ const onSessionChanged = vi.fn();+ render(+ <AgenticGrid+ session={session}+ focusMode={false}+ onToggleFocus={vi.fn()}+ onClose={vi.fn()}+ onSessionChanged={onSessionChanged}+ {...extra}+ />,+ );+ return { onSessionChanged };+}++const toDeck = () => fireEvent.click(screen.getByTestId("agentic-view-mode-deck"));++beforeEach(() => {+ window.localStorage.clear();+});++afterEach(() => {+ cleanup();+ vi.clearAllMocks();+});++describe("the room", () => {+ it("puts the orb on the stage and folds every terminal away", () => {+ renderGrid();+ toDeck();++ expect(screen.getByTestId("deck-stage")).toBeTruthy();+ expect(screen.getByTestId("deck-orb")).toBeTruthy();+ for (const name of ["Mika", "Nova", "Aria", "Kai"]) {+ // Folded, never unmounted — the agent behind the pane lives on. This is+ // the iron rule of this whole section and the thing a new mode is most+ // likely to break.+ expect(screen.getByTestId(`pane-${name}`)).toBeTruthy();+ expect(screen.getByTestId(`pane-cell-${name}`).className).toContain("hidden");+ expect(screen.getByTestId(`deck-card-${name}`)).toBeTruthy();+ }+ });++ it("keeps the very same pane elements across grid, chat, deck and back", () => {+ renderGrid();+ const before = screen.getByTestId("pane-Nova");++ toDeck();+ expect(screen.getByTestId("pane-Nova")).toBe(before);+ fireEvent.click(screen.getByTestId("agentic-view-mode-toggle"));+ expect(screen.getByTestId("pane-Nova")).toBe(before);+ fireEvent.click(screen.getByTestId("agentic-view-mode-grid"));++ expect(screen.getByTestId("pane-Nova")).toBe(before);+ });++ it("says whether it is listening rather than looking the same either way", () => {+ // A voice-first surface that is identical whether or not the mic is live+ // is the single most uncomfortable thing it could be.+ renderGrid();+ toDeck();++ expect(screen.getByTestId("deck-orb-caption").textContent).toMatch(/tap the orb/i);+ });++ it("has no seams to drag — there is no layout to size here", () => {+ renderGrid();+ toDeck();++ expect(screen.queryAllByTestId(/^pane-seam-/)).toHaveLength(0);+ });++ it("leaves a plain terminal off the table", () => {+ // A shell is not a colleague you hand work to — it would RUN the sentence.+ const session = sessionWith(["Mika", "Sh"]);+ session.terminals[1] = {+ ...session.terminals[1],+ agent: "shell",+ display_name: "Plain Terminal",+ accepts_prompts: false,+ };+ renderGrid(session);+ toDeck();++ expect(screen.getByTestId("deck-card-Mika")).toBeTruthy();+ expect(screen.queryByTestId("deck-card-Sh")).toBeNull();+ });++ it("offers to open a terminal when the workspace is empty", () => {+ renderGrid(sessionWith([]));+ toDeck();++ expect(screen.getByTestId("deck-empty")).toBeTruthy();+ expect(screen.getByTestId("deck-open-terminal")).toBeTruthy();+ // ...and the grid's own version of that offer stays out of the way, or the+ // same question would be asked twice on one screen.+ expect(screen.queryByTestId("empty-workspace-new-terminal")).toBeNull();+ });+});++describe("unfolding a terminal", () => {+ it("shows one on demand, and gives it a way back", () => {+ renderGrid();+ toDeck();++ fireEvent.click(screen.getByTestId("deck-card-expand-Nova"));++ expect(screen.getByTestId("pane-cell-Nova").className).not.toContain("hidden");+ expect(screen.getByTestId("deck-fold-away")).toBeTruthy();+ // One at a time: two unfolded terminals is the grid, and the grid is one+ // button away.+ expect(screen.getByTestId("pane-cell-Mika").className).toContain("hidden");+ });++ it("folds it away again without touching the pane", () => {+ renderGrid();+ toDeck();+ const before = screen.getByTestId("pane-Nova");+ fireEvent.click(screen.getByTestId("deck-card-expand-Nova"));++ fireEvent.click(screen.getByTestId("deck-fold-away"));++ expect(screen.getByTestId("deck-stage")).toBeTruthy();+ expect(screen.getByTestId("pane-Nova")).toBe(before);+ });++ it("leaving the deck folds the open terminal away", () => {+ // Otherwise coming back would land on a workspace with one pane already+ // open, which is the deck quietly not being the deck.+ renderGrid();+ toDeck();+ fireEvent.click(screen.getByTestId("deck-card-expand-Nova"));++ fireEvent.click(screen.getByTestId("agentic-view-mode-grid"));+ toDeck();++ expect(screen.getByTestId("deck-stage")).toBeTruthy();+ expect(screen.queryByTestId("deck-fold-away")).toBeNull();+ });++ it("tells the backend which pane is on the stage", async () => {+ // "This terminal" has to resolve to what the user is actually looking at,+ // and in the deck that is the unfolded card.+ renderGrid();+ toDeck();++ fireEvent.click(screen.getByTestId("deck-card-expand-Aria"));++ await waitFor(() =>+ expect(api.syncAgenticIdeSurface).toHaveBeenLastCalledWith(+ expect.objectContaining({ view: "deck", terminal: "Aria" }),+ ),+ );+ });+});++describe("the cards", () => {+ it("read their state off the pane, not out of the deck's head", async () => {+ vi.mocked(api.fetchTerminalActivity).mockResolvedValue({+ workspace_id: "ide_test",+ terminals: [+ { name: "Mika", activity: "working", activity_since: 1, worked: true, status: "live" },+ { name: "Nova", activity: "asking", activity_since: 1, worked: true, status: "live" },+ { name: "Aria", activity: "waiting", activity_since: 1, worked: false, status: "live" },+ ],+ } as never);+ renderGrid();+ toDeck();++ await waitFor(() =>+ expect(screen.getByTestId("deck-card-Mika").getAttribute("data-state")).toBe("working"),+ );+ expect(screen.getByTestId("deck-card-Nova").getAttribute("data-state")).toBe("asking");+ expect(screen.getByTestId("deck-card-Aria").getAttribute("data-state")).toBe("waiting");+ });++ it("show what the agent is on, from its own recap", async () => {+ vi.mocked(api.fetchTerminalRecaps).mockResolvedValue({+ workspace_id: "ide_test",+ terminals: [+ {+ name: "Mika",+ recap: "Fixing the wake-path tests",+ recap_detail: "",+ activity: "working",+ activity_since: 1,+ worked: true,+ status: "live",+ },+ ],+ } as never);+ renderGrid();+ toDeck();++ await waitFor(() =>+ expect(screen.getByTestId("deck-card-task-Mika").textContent).toContain(+ "Fixing the wake-path tests",+ ),+ );+ });++ it("take a pane over and hand it back", async () => {+ renderGrid();+ toDeck();++ fireEvent.click(screen.getByTestId("deck-card-hold-Mika"));++ await waitFor(() => expect(api.setDeckHold).toHaveBeenCalledWith("Mika", true));+ });++ it("show a held pane as the user's, whatever it is doing", () => {+ // The hold is about who is DRIVING rather than about the agent's state,+ // and it is the one thing on the card the user set themselves.+ const session = sessionWith(["Mika"]);+ session.terminals[0] = { ...session.terminals[0], deck_hold: true };+ renderGrid(session);+ toDeck();++ expect(screen.getByTestId("deck-card-Mika").getAttribute("data-state")).toBe("held");+ });++ it("report a refused hold instead of showing it as taken", async () => {+ // A client that shows a pane as held while the server disagrees is the+ // worse of the two failures: the user stops watching a pane Jarvis is+ // still assigning work to.+ vi.mocked(api.setDeckHold).mockRejectedValue(new Error("No terminal called 'Mika'."));+ renderGrid();+ toDeck();++ fireEvent.click(screen.getByTestId("deck-card-hold-Mika"));++ await waitFor(() =>+ expect(pushToast).toHaveBeenCalledWith("error", "No terminal called 'Mika'."),+ );+ });+});++describe("the report lane", () => {+ const ONE_WAITING = {+ ...EMPTY_QUEUE,+ in_conversation: true,+ pending: [+ {+ id: "sr1",+ workspace_id: "ide_test",+ pane_key: "nova",+ pane: "Nova",+ agent: "claude",+ kind: "completed" as const,+ headline: "Finished and waiting at its prompt",+ detail: "",+ at: 0,+ state: "pending" as const,+ spoken: false,+ },+ ],+ };++ it("is on screen and says when it is empty", () => {+ renderGrid();+ toDeck();++ expect(screen.getByTestId("deck-report-lane")).toBeTruthy();+ expect(screen.getByTestId("deck-lane-empty")).toBeTruthy();+ });++ it("lists what is waiting, and the card carries the same news", async () => {+ vi.mocked(api.fetchDeckQueue).mockResolvedValue(ONE_WAITING);+ renderGrid();+ toDeck();++ await waitFor(() => expect(screen.getByTestId("deck-lane-hear-Nova")).toBeTruthy());+ expect(screen.getByTestId("deck-lane-count").textContent).toBe("1");+ expect(screen.getByTestId("deck-card-dot-Nova")).toBeTruthy();+ });++ it("hears one on request", async () => {+ vi.mocked(api.fetchDeckQueue).mockResolvedValue(ONE_WAITING);+ renderGrid();+ toDeck();+ const hear = await screen.findByTestId("deck-lane-hear-Nova");++ fireEvent.click(hear);++ await waitFor(() => expect(api.ackDeckReport).toHaveBeenCalledWith("sr1", "next"));+ });++ it("drops one the user has already seen", async () => {+ vi.mocked(api.fetchDeckQueue).mockResolvedValue(ONE_WAITING);+ renderGrid();+ toDeck();+ const drop = await screen.findByTestId("deck-lane-drop-Nova");++ fireEvent.click(drop);++ await waitFor(() => expect(api.ackDeckReport).toHaveBeenCalledWith("sr1", "drop"));+ });++ it("says it has gone quiet rather than looking broken", async () => {+ // An unanswered line settles the queue on purpose — repeating yourself at+ // somebody reading code is nagging. But a surface that silently stops+ // talking is indistinguishable from one that crashed, so it says which.+ vi.mocked(api.fetchDeckQueue).mockResolvedValue({ ...ONE_WAITING, sleeping: true });+ renderGrid();+ toDeck();++ const wake = await screen.findByTestId("deck-lane-wake");+ fireEvent.click(wake);++ await waitFor(() => expect(api.ackDeckReport).toHaveBeenCalledWith("sr1", "next"));+ });++ it("asks for nothing at all while the deck is not the view", () => {+ renderGrid();++ expect(api.fetchDeckQueue).not.toHaveBeenCalled();+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsxindex f18f31d60b..d17ee0e06b 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx@@ -95,6 +95,24 @@ vi.mock("@/lib/agenticIdeApi", () => ({default: 13,})),syncAgenticIdeSurface: vi.fn(async () => undefined),+ // The Command Deck's report lane. Polled only while the deck is the view on+ // screen, so the grid and chat suites never reach it — it answers "nothing+ // waiting" by default and the deck tests give it real rows.+ fetchDeckQueue: vi.fn(async () => ({+ sleeping: false,+ in_conversation: false,+ on_air: null,+ pending: [],+ reports: [],+ })),+ ackDeckReport: vi.fn(async () => ({+ sleeping: false,+ in_conversation: false,+ on_air: null,+ pending: [],+ reports: [],+ })),+ setDeckHold: vi.fn(async (_name: string, held: boolean) => held),}));// The grid follows the app theme for its terminal colours; these tests renderdiff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsxindex 3b59ff12b7..5fe549ec1d 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx@@ -68,6 +68,9 @@ import {} from "./paneLayout";import { loadStoredArrangement, saveStoredArrangement, usePaneWeights } from "./usePaneWeights";import { ContinueInterrupted } from "./ContinueInterrupted";+import { DeckStage, type DeckAgent } from "./deck/DeckStage";+import type { CardState } from "./deck/AgentCard";+import { useDeckQueue } from "./deck/useDeckQueue";import { NavRevealButton } from "@/components/layout/NavRevealButton";import { PaneNotifications } from "./PaneNotifications";import { isVoiceActive } from "./VoiceBubble";@@ -106,6 +109,7 @@ import {renameTerminal,saveTerminalFontSize,syncAgenticIdeSurface,+ setDeckHold,setTerminalRecap,promptTerminal,type ComposedPreview,@@ -419,6 +423,16 @@ const MAXIMIZED_BOX: React.CSSProperties = {inset: 0,};+/**+ * The strip above an unfolded terminal on the Command Deck.+ *+ * Small, and load-bearing: the deck's terminals are folded away by default, so+ * the one that is open needs a visible way back to the room. A pane covering+ * the whole surface with no exit is how a mode that is meant to feel calm+ * starts feeling like a trap.+ */+const DECK_HEADER_PX = 40;+/** True when a fraction is at an edge of the workspace, allowing for float drift. */function atEdge(value: number): boolean {return value <= 0.0001 || value >= 0.9999;@@ -820,17 +834,30 @@ export function AgenticGrid({* screen, not workspace state worth a round-trip.*/const [viewMode, setViewModeState] = useState<WorkspaceView>(() => storedViewMode() ?? "grid");+ /**+ * Which agent's terminal is unfolded on the deck, if any.+ *+ * The deck's default is that no terminal is on screen at all — that is what+ * makes it a different mode rather than a chat view with bigger cards. This+ * is the one exception the user asks for, and it is one at a time: two+ * unfolded terminals is the grid, and the grid is one button away.+ */+ const [deckExpanded, setDeckExpanded] = useState<string | null>(null);const setViewMode = useCallback((next: WorkspaceView) => {setViewModeState(next);rememberViewMode(next);- // Chat shows exactly one pane already; a leftover maximize from the grid- // would silently pin the stage to a pane the rail no longer highlights.- if (next === "chat") setMaximized(null);+ // Chat and the deck show one pane at most; a leftover maximize from the+ // grid would silently pin the stage to a pane neither of them highlights.+ if (next !== "grid") setMaximized(null);+ // Leaving the deck folds its terminal away. Coming back to a workspace+ // with one pane already open would be the deck quietly not being the deck.+ if (next !== "deck") setDeckExpanded(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";+ const deckView = viewMode === "deck";/** Which pane the chat stage shows. Kept apart from `target` (the pane the@@ -1079,6 +1106,86 @@ export function AgenticGrid({};};+ /*+ * The Command Deck's own two feeds: the report lane, and the cards.+ *+ * Both are derived rather than held. A card is exactly what the pane already+ * reports — its recap, its activity, its hold — read through the same+ * `activityOf` every other surface uses, so the deck cannot end up+ * describing a terminal differently from the grid beside it.+ */+ const deck = useDeckQueue(deckView && onScreen);+ /*+ * The orb's state, read straight from the store the voice pipeline feeds.+ *+ * Subscribed in this very large component only because the deck's orb is+ * ON it — the floating bubble keeps its own subscription for exactly the+ * opposite reason (see VoiceBubble: it exists so voice state does not+ * re-render every terminal). The cost is paid back by the selector being a+ * single string: it changes a handful of times per turn, not per frame.+ */+ const voiceState = (useEventStore((s) => s.voiceState) ?? "idle") as VoiceState;+ const deckAgents: DeckAgent[] = useMemo(() => {+ if (!deckView) return [];+ return session.terminals+ .filter(takesPrompts)+ .map((term) => {+ const { activity } = activityOf(term);+ const status = statusOf(term).status;+ // The order matters: a held pane says so whatever it is doing, because+ // the hold is about who is DRIVING rather than about the agent's+ // state — and it is the one thing the user set themselves.+ let state: CardState;+ if (term.deck_hold) state = "held";+ else if (status === "exited" || status === "error") state = "dead";+ else if (activity === "asking") state = "asking";+ else if (activity === "working") state = "working";+ else state = "waiting";+ return {+ name: term.name,+ agent: term.agent,+ agentLabel: term.display_name,+ // The polled recap first, the one the workspace state carried until+ // then — a card opens with a sentence rather than with a blank.+ task: recaps[term.name]?.recap ?? term.recap ?? "",+ state,+ };+ });+ // `recaps`/`liveActivity`/`sentAt` are read through activityOf, which is+ // re-created every render; listing them keeps the memo honest about what+ // it actually depends on.+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [deckView, session.terminals, recaps, liveActivity, statuses, sentAt]);++ const toggleDeckHold = useCallback(+ (name: string) => {+ const term = session.terminals.find((t) => t.name === name);+ if (!term) return;+ const next = !term.deck_hold;+ void setDeckHold(name, next)+ .then(() => {+ // Re-read rather than patching the pane locally: the hold changes+ // what the backend will DO with this pane, and a client that shows+ // it as held while the server disagrees is the worse of the two+ // failures — the user would stop watching a pane Jarvis still uses.+ onSessionChanged?.({+ ...session,+ terminals: session.terminals.map((t) =>+ t.name === name ? { ...t, deck_hold: next } : t,+ ),+ });+ })+ .catch((error: unknown) => {+ pushToast("error", error instanceof Error ? error.message : String(error));+ });+ },+ [onSessionChanged, pushToast, session],+ );++ const toggleDeckExpand = useCallback((name: string) => {+ setDeckExpanded((current) => (current === name ? null : name));+ }, []);+/** The three things a user may do about a pane's recap.*@@ -1551,7 +1658,7 @@ export function AgenticGrid({* and reports none — guessing among a dozen visible terminals would be less* honest than making the user name one.*/- const stagedPane = chatView ? chatSelected : null;+ const stagedPane = chatView ? chatSelected : deckView ? deckExpanded : null;useEffect(() => {void syncAgenticIdeSurface({workspaceId: session.id,@@ -2737,7 +2844,12 @@ export function AgenticGrid({{session.terminals.map((term, index) => {const box = layout.boxes[index];const isMaximized = maximized === term.name;- const onStage = chatView && chatSelected === term.name;+ // The one pane a single-pane view is showing. Both views stage one+ // and hide the rest — the difference is which pane and why, not what+ // happens to the others, which are hidden and NEVER unmounted.+ const onStage =+ (chatView && chatSelected === term.name) ||+ (deckView && deckExpanded === term.name);return (<divkey={term.key}@@ -2752,6 +2864,7 @@ export function AgenticGrid({// pointer, not ease after it — and off for the stage/maximize// style, which swaps to `inset` and cannot tween from here.!chatView &&+ !deckView &&!isMaximized &&!layoutBusy &&"transition-[left,top,width,height] duration-300 ease-out motion-reduce:transition-none",@@ -2768,13 +2881,29 @@ export function AgenticGrid({justMoved?.name === term.name &&!selectedTerminals.has(term.name) &&"ring-2 ring-primary/70 ring-offset-2 ring-offset-background",- chatView+ chatView || deckView? onStage- ? "rounded-xl border border-border shadow-lg"+ ? // On the deck the unfolded terminal sits ABOVE the room+ // it came from (`z-20` over the stage's own layer), so+ // the cards stay where they were and folding it away+ // puts the user back exactly where they left off.+ cn(+ "rounded-xl border border-border shadow-lg",+ deckView && "z-20",+ ): "hidden": maximized !== null && !isMaximized && "hidden",)}- style={chatView || isMaximized ? MAXIMIZED_BOX : paneBoxStyle(box)}+ style={+ isMaximized || chatView+ ? MAXIMIZED_BOX+ : deckView+ // Under the deck's own header strip, which carries the+ // way back — an unfolded terminal covering the whole+ // surface would have no visible exit.+ ? { ...MAXIMIZED_BOX, top: DECK_HEADER_PX }+ : paneBoxStyle(box)+ }><AgenticTerminalname={term.name}@@ -2929,6 +3058,7 @@ export function AgenticGrid({and, naturally, when there is only one pane.*/}{!chatView &&+ !deckView &&maximized === null &&!selectionMode &&arrange.held === null &&@@ -2952,7 +3082,10 @@ export function AgenticGrid({style={seamStyle(seam)}/>))}- {session.terminals.length === 0 && (+ {/* The deck says this itself, in its own words and with the orb still+ on screen — two "open a terminal" offers stacked on each other+ would be the same question asked twice. */}+ {session.terminals.length === 0 && !deckView && (<div className="absolute inset-0 flex flex-col items-center justify-center gap-3 text-sm text-muted-foreground"><span>Every terminal in this workspace is closed.</span>{/* `relative` so the picker hangs under the button rather than off@@ -2988,6 +3121,61 @@ export function AgenticGrid({</div>)}</div>++ {/*+ The Command Deck's room, drawn OVER the canvas rather than instead of+ it. The panes underneath stay mounted and hidden — unmounting one kills+ the coding agent behind it, which is the rule every mode in this file+ obeys — so switching modes is a restyle and nothing more.++ Folded open, the terminal takes the surface and this layer shrinks to+ the strip that carries the way back.+ */}+ {deckView && deckExpanded !== null && (+ <div+ data-testid="deck-open-pane-header"+ className="absolute inset-x-0 top-0 z-30 flex items-center gap-2 px-3"+ style={{ height: DECK_HEADER_PX }}+ >+ <button+ type="button"+ data-testid="deck-fold-away"+ onClick={() => setDeckExpanded(null)}+ className={cn(+ "inline-flex items-center gap-1.5 rounded-control px-2 py-1 text-xs",+ "text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",+ )}+ >+ <ChevronUp className="h-3.5 w-3.5 shrink-0" />+ Back to the deck+ </button>+ <span className="truncate text-xs text-muted-foreground">{deckExpanded}</span>+ </div>+ )}+ {deckView && deckExpanded === null && (+ <div className="absolute inset-0 z-10">+ <DeckStage+ agents={deckAgents}+ voiceState={voiceState}+ listening={voiceOpen && isVoiceActive(voiceState)}+ onToggleVoice={onToggleVoice}+ expanded={deckExpanded}+ onToggleExpand={toggleDeckExpand}+ onToggleHold={toggleDeckHold}+ onOpenTerminal={+ session.terminals.length === 0 ? () => openTerminal("empty") : undefined+ }+ reporting={deck.reporting}+ pending={deck.queue.pending}+ onAir={deck.queue.on_air}+ sleeping={deck.queue.sleeping}+ onHear={deck.hear}+ onDropReport={deck.drop}+ onWake={deck.wake}+ />+ </div>+ )}</div></div>diff --git a/jarvis/ui/web/frontend/src/components/agentic/deck/AgentCard.tsx b/jarvis/ui/web/frontend/src/components/agentic/deck/AgentCard.tsxnew file mode 100644index 0000000000..26727dbbe9--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/deck/AgentCard.tsx@@ -0,0 +1,185 @@+/**+ * One agent, as a person at the table rather than as a terminal.+ *+ * The Command Deck's whole premise is that you are not reading terminals — you+ * are running a team. So a card answers the three things you would ask about a+ * colleague and nothing else: who they are, what they are on, and whether they+ * need you. The terminal itself is one tap away and folded up until then,+ * because a wall of scrolling output is precisely what this mode exists to+ * stop being the subject of the screen.+ *+ * ## The ring+ *+ * State is carried by a ring around the mark rather than by a coloured label,+ * for the same reason the toolbar spends colour only on what is ON: eight+ * labelled cards read as a form to fill in, eight rings read as a room. The+ * four states are deliberately distinguishable without colour too (motion,+ * weight, a glyph), because "which of these needs me" must survive a+ * colour-blind user and a bad monitor.+ *+ * * **working** — a slow pulse. Something is happening and it is not urgent.+ * * **waiting** — still and warm. Done, and nobody is being asked for anything.+ * * **asking** — the one state that attracts the eye. Work has STOPPED here.+ * * **held** — dimmed, with the user's own mark. Jarvis is not using this one.+ *+ * Nothing on this card claims the work went well. "Finished" means the pane+ * went quiet — the same claim the bell and the spoken report make, worded the+ * same way on purpose.+ */+import { Hand, Loader2, MessageCircleQuestion, Terminal } from "lucide-react";+import { cn } from "@/lib/utils";+import { AgentMark } from "../AgentMark";++/** What a card is showing, resolved by the stage rather than by the card. */+export type CardState = "working" | "waiting" | "asking" | "held" | "dead";++export interface AgentCardProps {+ name: string;+ /** The CLI behind the pane, for its mark. */+ agent: string;+ /** That CLI's own name, for the mark's alt text. */+ agentLabel: string;+ /** What this agent is on, in one line — the pane's own recap. */+ task: string;+ state: CardState;+ /** Is this card's terminal unfolded right now? */+ expanded: boolean;+ /** Does this agent have news waiting in the lane? */+ reporting?: boolean;+ onToggleExpand: () => void;+ onToggleHold: () => void;+}++const RING: Record<CardState, string> = {+ // A pulse rather than a spinner: a spinner is a thing you wait in front of,+ // and the point of this mode is that you do not have to.+ working: "border-primary/70 shadow-[0_0_0_3px_hsl(var(--primary)/0.10)]",+ waiting: "border-border",+ // The only card that raises its voice, because it is the only one where work+ // has stopped and cannot restart without the user.+ asking: "border-amber-400/80 shadow-[0_0_0_3px_hsl(38_92%_50%/0.16)]",+ held: "border-border/50",+ dead: "border-destructive/50",+};++const LABEL: Record<CardState, string> = {+ working: "Working",+ waiting: "Finished and waiting",+ asking: "Needs your answer",+ held: "You have this one",+ dead: "Its agent stopped",+};++export function AgentCard({+ name,+ agent,+ agentLabel,+ task,+ state,+ expanded,+ reporting = false,+ onToggleExpand,+ onToggleHold,+}: AgentCardProps) {+ const held = state === "held";+ return (+ <div+ data-testid={`deck-card-${name}`}+ data-state={state}+ data-expanded={expanded ? "yes" : "no"}+ className={cn(+ "group relative flex min-w-0 flex-col gap-3 rounded-xl border bg-card/60 p-4",+ "transition-colors",+ RING[state],+ held && "opacity-70",+ )}+ >+ <div className="flex min-w-0 items-center gap-3">+ <span+ className={cn(+ "relative flex h-10 w-10 shrink-0 items-center justify-center rounded-full",+ "border bg-background/60",+ RING[state],+ // The pulse is the ring's, not the mark's: a breathing logo reads+ // as decoration, a breathing outline reads as a state.+ state === "working" && "animate-pulse motion-reduce:animate-none",+ )}+ >+ {/* Plain, not boxed: the ring around it is already the frame, and a+ tile inside a ring is two borders for one thing. */}+ <AgentMark agent={agent} label={agentLabel} variant="plain" size="sm" />+ {reporting && (+ <span+ data-testid={`deck-card-dot-${name}`}+ aria-hidden+ className="absolute -right-0.5 -top-0.5 h-2.5 w-2.5 rounded-full bg-primary"+ />+ )}+ </span>+ <span className="flex min-w-0 flex-col">+ <span className="truncate text-sm font-medium text-foreground">{name}</span>+ <span className="flex items-center gap-1.5 text-xs text-muted-foreground">+ {state === "working" && (+ <Loader2 className="h-3 w-3 shrink-0 animate-spin motion-reduce:animate-none" />+ )}+ {state === "asking" && (+ <MessageCircleQuestion className="h-3 w-3 shrink-0 text-amber-400" />+ )}+ {held && <Hand className="h-3 w-3 shrink-0" />}+ <span className="truncate">{LABEL[state]}</span>+ </span>+ </span>+ </div>++ {/*+ What they are on. Always rendered, even empty — a card that changes+ height when a recap arrives makes the whole table twitch every few+ seconds, which is the opposite of what a calm surface is for.+ */}+ <p+ data-testid={`deck-card-task-${name}`}+ className="line-clamp-2 min-h-[2.5rem] text-xs leading-relaxed text-muted-foreground"+ >+ {task}+ </p>++ <div className="flex items-center gap-2">+ <button+ type="button"+ data-testid={`deck-card-expand-${name}`}+ aria-pressed={expanded}+ onClick={onToggleExpand}+ className={cn(+ "inline-flex items-center gap-1.5 rounded-control px-2 py-1 text-xs",+ "text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",+ expanded && "bg-secondary text-foreground",+ )}+ >+ <Terminal className="h-3.5 w-3.5 shrink-0" />+ {expanded ? "Hide terminal" : "Show terminal"}+ </button>+ <button+ type="button"+ data-testid={`deck-card-hold-${name}`}+ aria-pressed={held}+ onClick={onToggleHold}+ title={+ held+ ? "Hand this agent back to Jarvis"+ : "Take this one yourself — Jarvis stops assigning to it and stops reporting it"+ }+ className={cn(+ "ml-auto inline-flex items-center gap-1.5 rounded-control px-2 py-1 text-xs",+ "text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",+ held && "bg-primary/15 text-primary hover:bg-primary/20 hover:text-primary",+ )}+ >+ <Hand className="h-3.5 w-3.5 shrink-0" />+ {held ? "Yours" : "I'll take it"}+ </button>+ </div>+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/deck/DeckStage.tsx b/jarvis/ui/web/frontend/src/components/agentic/deck/DeckStage.tsxnew file mode 100644index 0000000000..7a0f97218e--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/deck/DeckStage.tsx@@ -0,0 +1,182 @@+/**+ * The Command Deck: the conversation is the subject, the terminals recede.+ *+ * Grid and chat both put terminal output on screen and differ in how much. The+ * deck differs in KIND — the orb is centre stage, each agent is a card around+ * it, and the terminals are folded away until you ask for one. That is not a+ * styling choice: it is what the mode is for. You brief by voice, Jarvis runs+ * the floor, and the work comes back to you as a spoken report rather than as+ * something you have to notice.+ *+ * ## What this component does and does not own+ *+ * It draws the room. It does NOT own a single pane: the terminals stay mounted+ * in the grid's canvas underneath, and unfolding a card is the grid restyling+ * the pane it already has. Rendering a terminal here would remount it, and a+ * remounted pane is a dead coding agent — the iron rule of this whole section.+ *+ * The orb is the same `VoiceOrb` the floating bubble uses, at a size that makes+ * it the subject rather than an ornament. It is deliberately not a second voice+ * control: clicking it does what the bubble's orb does, through the same+ * handler, because two ways to start a conversation that behave differently is+ * the bug that costs a user their trust in both.+ *+ * ## Silence is a state, and it is drawn+ *+ * The deck opens quiet — the mic is not live until it is asked for — and it+ * says so. A voice-first surface that looks identical whether or not it is+ * listening is the single most uncomfortable thing it could be.+ */+import { Mic, Plus } from "lucide-react";+import { cn } from "@/lib/utils";+import { VoiceOrb } from "../VoiceOrb";+import type { VoiceState } from "@/store/events";+import type { DeckReport } from "@/lib/agenticIdeApi";+import { AgentCard, type CardState } from "./AgentCard";+import { ReportLane } from "./ReportLane";++export interface DeckAgent {+ name: string;+ agent: string;+ agentLabel: string;+ task: string;+ state: CardState;+}++export interface DeckStageProps {+ agents: DeckAgent[];+ voiceState: VoiceState;+ /** Is a conversation open right now? Drives the orb's caption, not the orb. */+ listening: boolean;+ onToggleVoice?: () => void;+ expanded: string | null;+ onToggleExpand: (name: string) => void;+ onToggleHold: (name: string) => void;+ onOpenTerminal?: () => void;+ /** Panes with news waiting, so their card can carry a dot. */+ reporting: ReadonlySet<string>;+ pending: DeckReport[];+ onAir: DeckReport | null;+ sleeping: boolean;+ onHear: (id: string) => void;+ onDropReport: (id: string) => void;+ onWake: () => void;+}++export function DeckStage({+ agents,+ voiceState,+ listening,+ onToggleVoice,+ expanded,+ onToggleExpand,+ onToggleHold,+ onOpenTerminal,+ reporting,+ pending,+ onAir,+ sleeping,+ onHear,+ onDropReport,+ onWake,+}: DeckStageProps) {+ return (+ <div+ data-testid="deck-stage"+ className="flex h-full min-h-0 w-full gap-4 overflow-hidden p-2"+ >+ <div className="flex min-h-0 min-w-0 flex-1 flex-col items-center gap-6 overflow-y-auto">+ {/*+ The orb, and the one sentence that says whether it is hearing you.+ Both are buttons onto the same handler the bubble uses — a second+ voice control with its own behaviour is two things to keep in step.+ */}+ <div className="flex shrink-0 flex-col items-center gap-3 pt-4">+ <button+ type="button"+ data-testid="deck-orb"+ onClick={onToggleVoice}+ disabled={!onToggleVoice}+ aria-pressed={listening}+ aria-label={listening ? "Hang up" : "Start talking to Jarvis"}+ className={cn(+ "rounded-full transition-transform",+ onToggleVoice+ ? "hover:scale-[1.02] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60"+ : "cursor-default",+ )}+ >+ <VoiceOrb state={voiceState} size={132} />+ </button>+ <p+ data-testid="deck-orb-caption"+ className="flex items-center gap-1.5 text-xs text-muted-foreground"+ >+ <Mic className={cn("h-3 w-3 shrink-0", listening && "text-primary")} />+ {listening+ ? "Listening — say what you want done."+ : "Tap the orb or say the wake word to hand out work."}+ </p>+ </div>++ {/* The room. One card per agent, laid out as a table rather than a list. */}+ {agents.length === 0 ? (+ <div+ data-testid="deck-empty"+ className="flex flex-col items-center gap-3 pt-6 text-center"+ >+ <p className="max-w-sm text-sm text-muted-foreground">+ No agents in this workspace yet. Open one and you can start handing+ out work by voice.+ </p>+ {onOpenTerminal && (+ <button+ type="button"+ data-testid="deck-open-terminal"+ onClick={onOpenTerminal}+ className={cn(+ "inline-flex items-center gap-1.5 rounded-control border border-border px-3 py-1.5",+ "text-xs text-muted-foreground transition-colors",+ "hover:bg-secondary hover:text-foreground",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",+ )}+ >+ <Plus className="h-3.5 w-3.5 shrink-0" />+ Open a terminal+ </button>+ )}+ </div>+ ) : (+ <div+ data-testid="deck-cards"+ className="grid w-full max-w-4xl grid-cols-1 gap-3 pb-4 sm:grid-cols-2 lg:grid-cols-3"+ >+ {agents.map((entry) => (+ <AgentCard+ key={entry.name}+ name={entry.name}+ agent={entry.agent}+ agentLabel={entry.agentLabel}+ task={entry.task}+ state={entry.state}+ expanded={expanded === entry.name}+ reporting={reporting.has(entry.name)}+ onToggleExpand={() => onToggleExpand(entry.name)}+ onToggleHold={() => onToggleHold(entry.name)}+ />+ ))}+ </div>+ )}+ </div>++ <ReportLane+ pending={pending}+ onAir={onAir}+ sleeping={sleeping}+ onHear={onHear}+ onDrop={onDropReport}+ onWake={onWake}+ />+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/deck/ReportLane.tsx b/jarvis/ui/web/frontend/src/components/agentic/deck/ReportLane.tsxnew file mode 100644index 0000000000..843bb88d6d--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/deck/ReportLane.tsx@@ -0,0 +1,154 @@+/**+ * The reports waiting to be heard, as a visible stack rather than as magic.+ *+ * The queue behind the Command Deck is a real mechanism with real rules — one+ * speaker, blockers first, a headline when several land together (see+ * `jarvis/agentic_ide/standup.py`). Left invisible it would read as Jarvis+ * being arbitrary about what it mentions and what it does not, which is the+ * fastest way to lose a user's trust in a surface that talks.+ *+ * So the lane is on screen: what is waiting, in the order it will be heard,+ * with the one on air lifted out of the stack. That way "three are done, which+ * one first?" has something to point at, and pressing a row is the same+ * instruction as saying its name.+ *+ * It also says when the deck has gone QUIET. An unanswered line settles the+ * queue on purpose — repeating yourself at somebody reading code is nagging,+ * not helpfulness — but a surface that silently stops talking is+ * indistinguishable from a broken one. The strip says which it is, and offers+ * the way back.+ */+import { BellOff, MessageCircleQuestion, Volume2 } from "lucide-react";+import { cn } from "@/lib/utils";+import type { DeckReport } from "@/lib/agenticIdeApi";++export interface ReportLaneProps {+ pending: DeckReport[];+ onAir: DeckReport | null;+ /** True once a line went unanswered and the deck stopped offering. */+ sleeping: boolean;+ onHear: (id: string) => void;+ onDrop: (id: string) => void;+ onWake: () => void;+}++export function ReportLane({+ pending,+ onAir,+ sleeping,+ onHear,+ onDrop,+ onWake,+}: ReportLaneProps) {+ const empty = pending.length === 0 && onAir === null;+ return (+ <aside+ data-testid="deck-report-lane"+ aria-label="Reports waiting"+ className="flex w-64 shrink-0 flex-col gap-2 border-l border-border pl-4"+ >+ <div className="flex items-center gap-2 text-xs uppercase tracking-[0.14em] text-muted-foreground">+ <span>Reports</span>+ {pending.length > 0 && (+ <span+ data-testid="deck-lane-count"+ className="rounded-full bg-primary/15 px-1.5 py-0.5 text-[10px] font-semibold text-primary"+ >+ {pending.length}+ </span>+ )}+ </div>++ {empty && (+ <p+ data-testid="deck-lane-empty"+ className="text-xs leading-relaxed text-muted-foreground"+ >+ Nothing waiting. You will hear about an agent when it stops.+ </p>+ )}++ {onAir && (+ <div+ data-testid="deck-lane-on-air"+ className="rounded-lg border border-primary/60 bg-primary/[0.06] p-3"+ >+ <span className="flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-primary">+ <Volume2 className="h-3 w-3 shrink-0" />+ Reporting+ </span>+ <p className="mt-1 truncate text-sm font-medium text-foreground">{onAir.pane}</p>+ <p className="mt-0.5 line-clamp-2 text-xs text-muted-foreground">+ {onAir.headline}+ </p>+ </div>+ )}++ <ul className="flex min-h-0 flex-col gap-1.5 overflow-y-auto">+ {pending.map((report) => (+ <li key={report.id}>+ <div+ className={cn(+ "group flex items-start gap-2 rounded-lg border border-border/70 p-2",+ "transition-colors hover:border-border",+ )}+ >+ <button+ type="button"+ data-testid={`deck-lane-hear-${report.pane}`}+ onClick={() => onHear(report.id)}+ title={`Hear ${report.pane}'s report`}+ className="flex min-w-0 flex-1 flex-col items-start text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60"+ >+ <span className="flex w-full min-w-0 items-center gap-1.5">+ {report.kind === "needs_input" && (+ <MessageCircleQuestion className="h-3 w-3 shrink-0 text-amber-400" />+ )}+ <span className="truncate text-xs font-medium text-foreground">+ {report.pane}+ </span>+ </span>+ <span className="line-clamp-2 text-[11px] leading-relaxed text-muted-foreground">+ {report.headline}+ </span>+ </button>+ <button+ type="button"+ data-testid={`deck-lane-drop-${report.pane}`}+ onClick={() => onDrop(report.id)}+ title="I have seen this one"+ className={cn(+ "shrink-0 rounded-control px-1.5 py-0.5 text-[10px] text-muted-foreground",+ "opacity-0 transition-opacity hover:bg-secondary hover:text-foreground",+ "group-hover:opacity-100 focus-visible:opacity-100",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",+ )}+ >+ Seen+ </button>+ </div>+ </li>+ ))}+ </ul>++ {sleeping && pending.length > 0 && (+ <button+ type="button"+ data-testid="deck-lane-wake"+ onClick={onWake}+ className={cn(+ "mt-auto flex items-start gap-2 rounded-lg border border-border/70 p-2 text-left",+ "text-[11px] leading-relaxed text-muted-foreground",+ "transition-colors hover:border-border hover:text-foreground",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",+ )}+ >+ <BellOff className="mt-0.5 h-3 w-3 shrink-0" />+ <span>+ Gone quiet so it does not nag. Press to hear the next one.+ </span>+ </button>+ )}+ </aside>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/deck/useDeckQueue.ts b/jarvis/ui/web/frontend/src/components/agentic/deck/useDeckQueue.tsnew file mode 100644index 0000000000..2e43c39d8c--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/deck/useDeckQueue.ts@@ -0,0 +1,138 @@+/**+ * The report lane's feed.+ *+ * A poll rather than a subscription for the same reason the pane recaps use+ * one: the lane is a glanceable list, the backend already recomputes it on its+ * own sweep, and a websocket for a handful of rows would be a second lifecycle+ * to get wrong for no gain the user could see.+ *+ * Two things it is careful about, both learned from the recap poll next door:+ * it does not run while nobody is looking, and it keeps object identity when a+ * tick changes nothing — a fresh-but-equal array every two seconds would+ * re-render the deck (and every card in it) thirty times a minute for nothing.+ */+import { useCallback, useEffect, useRef, useState } from "react";+import { useDocumentVisible } from "@/hooks/useDocumentVisible";+import { ackDeckReport, fetchDeckQueue, type DeckQueue, type DeckReport } from "@/lib/agenticIdeApi";++/**+ * How often the lane re-reads what is waiting.+ *+ * Matched to the backend's own sweep (2 s in `notifications.SWEEP_INTERVAL_S`):+ * polling faster cannot produce fresher answers, and polling slower would let+ * a report be SPOKEN before it appears in the lane it is supposed to be in.+ */+export const DECK_POLL_MS = 2000;++const EMPTY: DeckQueue = {+ sleeping: false,+ in_conversation: false,+ on_air: null,+ pending: [],+ reports: [],+};++/** Same-rows check, on the fields the lane actually draws. */+function sameQueue(a: DeckQueue, b: DeckQueue): boolean {+ if (a.sleeping !== b.sleeping || a.in_conversation !== b.in_conversation) return false;+ if ((a.on_air?.id ?? "") !== (b.on_air?.id ?? "")) return false;+ if (a.pending.length !== b.pending.length) return false;+ return a.pending.every((row, index) => {+ const other = b.pending[index];+ return (+ other !== undefined &&+ row.id === other.id &&+ row.kind === other.kind &&+ row.headline === other.headline+ );+ });+}++export interface DeckQueueHandle {+ queue: DeckQueue;+ /** Pane call-signs with news waiting, for the cards' dots. */+ reporting: ReadonlySet<string>;+ hear: (id: string) => void;+ drop: (id: string) => void;+ wake: () => void;+}++export function useDeckQueue(active: boolean): DeckQueueHandle {+ const [queue, setQueue] = useState<DeckQueue>(EMPTY);+ const visible = useDocumentVisible();+ const polling = active && visible;+ // Read by the actions so they can apply an answer straight away without+ // re-subscribing the poll to their own dependencies.+ const queueRef = useRef(queue);+ queueRef.current = queue;++ const apply = useCallback((next: DeckQueue) => {+ setQueue((current) => (sameQueue(current, next) ? current : next));+ }, []);++ useEffect(() => {+ if (!polling) return;+ let cancelled = false;+ let pulling = false;+ let warned = false;+ const pull = async () => {+ if (pulling) return;+ pulling = true;+ try {+ const answer = await fetchDeckQueue();+ if (!cancelled) apply(answer);+ warned = false;+ } catch (error) {+ // Keep the last lane rather than blanking it: the backend warming up,+ // or one failed request, is not a reason to tell the user their+ // reports are gone. Logged once until a read succeeds again.+ if (!warned) {+ console.warn("Command Deck: could not read the report lane:", error);+ warned = true;+ }+ } finally {+ pulling = false;+ }+ };+ void pull();+ const timer = window.setInterval(() => void pull(), DECK_POLL_MS);+ return () => {+ cancelled = true;+ window.clearInterval(timer);+ };+ }, [apply, polling]);++ // The lane empties itself when the deck is left, so coming back does not+ // show a stack that was answered in another view.+ useEffect(() => {+ if (!active) setQueue(EMPTY);+ }, [active]);++ const answer = useCallback(+ (id: string, action: "next" | "later" | "drop") => {+ void ackDeckReport(id, action)+ .then(apply)+ .catch((error) => {+ console.warn("Command Deck: could not answer a report:", error);+ });+ },+ [apply],+ );++ const hear = useCallback((id: string) => answer(id, "next"), [answer]);+ const drop = useCallback((id: string) => answer(id, "drop"), [answer]);+ /**+ * "Go on" with nothing named — the next report in line.+ *+ * The lane's own way out of the quiet state. Nothing happens when the queue+ * is empty, which is why the button that calls this is only drawn beside a+ * non-empty one.+ */+ const wake = useCallback(() => {+ const next: DeckReport | undefined = queueRef.current.pending[0];+ if (next) answer(next.id, "next");+ }, [answer]);++ const reporting = new Set(queue.pending.map((row) => row.pane));+ return { queue, reporting, hear, drop, wake };+}diff --git a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.tsindex 45ef7200cd..77cfb32465 100644--- a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts+++ b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts@@ -98,6 +98,15 @@ export interface TerminalState {* refuses everything sent to it.*/accepts_prompts?: boolean;+ /**+ * Has the user taken this pane over in the Command Deck?+ *+ * While true the deck neither assigns work to it nor reports it — the honest+ * limit on "Jarvis runs the floor", for a pane holding a question only the+ * user can settle. Absent on a backend that predates the deck, which reads+ * as "not held" rather than as an error.+ */+ deck_hold?: boolean;index: number;/** Grid column, left to right. Each column is its own stack of panes. */column: number;@@ -1208,6 +1217,88 @@ export async function setFocusMode(enabled: boolean): Promise<boolean> {return body.focus_mode;}+/**+ * One agent's news, waiting in the Command Deck's report lane.+ *+ * `headline` is the same clause the header bell shows, on purpose: the spoken+ * line, the card and the notification panel must not be able to disagree about+ * what happened. `kind` is a claim about the TERMINAL — "completed" means the+ * pane went quiet, never that the work is any good.+ */+export interface DeckReport {+ id: string;+ workspace_id: string;+ pane_key: string;+ pane: string;+ agent: string;+ kind: "completed" | "needs_input" | "exited" | "failed";+ headline: string;+ detail: string;+ at: number;+ state: "pending" | "on_air" | "reported" | "dropped";+ spoken: boolean;+}++export interface DeckQueue {+ /** True once a line went unanswered — the deck has stopped offering. */+ sleeping: boolean;+ in_conversation: boolean;+ on_air: DeckReport | null;+ pending: DeckReport[];+ reports: DeckReport[];+}++const EMPTY_QUEUE: DeckQueue = {+ sleeping: false,+ in_conversation: false,+ on_air: null,+ pending: [],+ reports: [],+};++export async function fetchDeckQueue(): Promise<DeckQueue> {+ const res = await fetch("/api/agentic-ide/deck/queue", { cache: "no-store" });+ if (!res.ok) throw new Error(await detail(res));+ return { ...EMPTY_QUEUE, ...((await res.json()) as Partial<DeckQueue>) };+}++/**+ * Answer one report: hear it now, put the lane to sleep, or drop it.+ *+ * The same route the spoken answer takes — "tell me about Nova" and pressing+ * Nova's card are one instruction, and a second path for the second one is a+ * second thing to keep in step.+ */+export async function ackDeckReport(+ id: string,+ action: "next" | "later" | "drop",+): Promise<DeckQueue> {+ const res = await fetch("/api/agentic-ide/deck/ack", {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ id, action }),+ });+ if (!res.ok) throw new Error(await detail(res));+ return { ...EMPTY_QUEUE, ...((await res.json()) as Partial<DeckQueue>) };+}++/**+ * "I'll take this one" — and handing it back.+ *+ * While held, the deck stops assigning work to the pane and stops reporting+ * it, and the pane's own editor is unlocked. Everything else about it is+ * unchanged: it keeps running, keeps its recap, keeps its place.+ */+export async function setDeckHold(name: string, held: boolean): Promise<boolean> {+ const res = await fetch(`/api/agentic-ide/deck/hold/${encodeURIComponent(name)}`, {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ held }),+ });+ if (!res.ok) throw new Error(await detail(res));+ return Boolean((await res.json()).deck_hold);+}+/*** Tell the backend which view is on screen, which pane it stages, and which* one owns the next prompt.