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
fix(agentic-ide): make command deck terminals readable
rubenluetke10-beepc837537168aa
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.tsxindex c739f3782e..467d522d3f 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.deck.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.deck.test.tsx@@ -9,7 +9,14 @@* 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 {+ cleanup,+ fireEvent,+ render,+ screen,+ waitFor,+} from "@testing-library/react";+import { act } from "react";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";class ResizeObserverPolyfill {@@ -71,8 +78,14 @@ vi.mock("@/lib/agenticIdeApi", () => ({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: [] })),+ 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,@@ -99,15 +112,23 @@ vi.mock("@/lib/agenticIdeApi", () => ({/** 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>,+ 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} />,+ VoiceOrb: ({ state }: { state: string }) => (+ <div data-testid="voice-orb" data-state={state} />+ ),}));import { AgenticGrid } from "./AgenticGrid";+import {+ clearTerminalPreview,+ publishTerminalPreview,+} from "./terminalPreview";import * as api from "@/lib/agenticIdeApi";import * as voiceApi from "@/lib/voiceApi";import type { SessionState, TerminalState } from "@/lib/agenticIdeApi";@@ -174,13 +195,17 @@ function renderGrid(session = FOUR, extra: Record<string, unknown> = {}) {return { onSessionChanged };}-const toDeck = () => fireEvent.click(screen.getByTestId("agentic-view-mode-deck"));+const toDeck = () =>+ fireEvent.click(screen.getByTestId("agentic-view-mode-deck"));beforeEach(() => {window.localStorage.clear();deckVoice.state = "idle";deckVoice.transcription = "";deckVoice.assistantName = "Ben";+ for (const name of ["Mika", "Nova", "Aria", "Kai", "T1", "T2"]) {+ clearTerminalPreview(name);+ }});afterEach(() => {@@ -200,7 +225,9 @@ describe("the room", () => {// 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(`pane-cell-${name}`).className).toContain(+ "hidden",+ );expect(screen.getByTestId(`deck-card-${name}`)).toBeTruthy();}});@@ -237,7 +264,9 @@ describe("the room", () => {fireEvent.click(screen.getByTestId("deck-orb"));- await waitFor(() => expect(voiceApi.requestVoiceCall).toHaveBeenCalledTimes(1));+ await waitFor(() =>+ expect(voiceApi.requestVoiceCall).toHaveBeenCalledTimes(1),+ );expect(openBubble).not.toHaveBeenCalled();});@@ -252,7 +281,9 @@ describe("the room", () => {);fireEvent.click(screen.getByTestId("deck-voice-action"));- await waitFor(() => expect(voiceApi.requestVoiceHangup).toHaveBeenCalledTimes(1));+ await waitFor(() =>+ expect(voiceApi.requestVoiceHangup).toHaveBeenCalledTimes(1),+ );});it("has no seams to drag — there is no layout to size here", () => {@@ -297,7 +328,9 @@ describe("unfolding a terminal", () => {fireEvent.click(screen.getByTestId("deck-card-expand-Nova"));- expect(screen.getByTestId("pane-cell-Nova").className).not.toContain("hidden");+ 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.@@ -371,51 +404,68 @@ describe("the cards", () => {expect(screen.getByTestId("deck-cards").className).toContain("max-w-6xl");expect(screen.getByTestId("deck-card-Mika").className).toContain(- "min-h-[13rem]",+ "min-h-[15rem]",);});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",},+ {+ 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-task-Mika").textContent).toContain(- "Fixing the wake-path tests",- ),+ 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("shows what is actually running in the terminal instead of its recap", async () => {+ renderGrid();+ toDeck();+ act(() => {+ publishTerminalPreview("Mika", [+ "$ npm run test",+ "23 tests passed",+ "Waiting for changes...",+ ]);+ });++ await waitFor(() =>+ expect(+ screen.getByTestId("deck-card-terminal-Mika").textContent,+ ).toContain("23 tests passed"),);});@@ -425,7 +475,9 @@ describe("the cards", () => {fireEvent.click(screen.getByTestId("deck-card-hold-Mika"));- await waitFor(() => expect(api.setDeckHold).toHaveBeenCalledWith("Mika", true));+ await waitFor(() =>+ expect(api.setDeckHold).toHaveBeenCalledWith("Mika", true),+ );});it("show a held pane as the user's, whatever it is doing", () => {@@ -436,21 +488,28 @@ describe("the cards", () => {renderGrid(session);toDeck();- expect(screen.getByTestId("deck-card-Mika").getAttribute("data-state")).toBe("held");+ 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'."));+ 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'."),+ expect(pushToast).toHaveBeenCalledWith(+ "error",+ "No terminal called 'Mika'.",+ ),);});});@@ -489,7 +548,9 @@ describe("the report lane", () => {renderGrid();toDeck();- await waitFor(() => expect(screen.getByTestId("deck-lane-hear-Nova")).toBeTruthy());+ 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();});@@ -502,7 +563,9 @@ describe("the report lane", () => {fireEvent.click(hear);- await waitFor(() => expect(api.ackDeckReport).toHaveBeenCalledWith("sr1", "next"));+ await waitFor(() =>+ expect(api.ackDeckReport).toHaveBeenCalledWith("sr1", "next"),+ );});it("drops one the user has already seen", async () => {@@ -513,21 +576,28 @@ describe("the report lane", () => {fireEvent.click(drop);- await waitFor(() => expect(api.ackDeckReport).toHaveBeenCalledWith("sr1", "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 });+ 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"));+ await waitFor(() =>+ expect(api.ackDeckReport).toHaveBeenCalledWith("sr1", "next"),+ );});it("asks for nothing at all while the deck is not the view", () => {diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsxindex b4866b99dd..c89ac283a4 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx@@ -1121,10 +1121,10 @@ 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.+ * Both are derived rather than held. A card takes its identity, activity and+ * hold from the pane, then mirrors the pane's parsed xterm screen directly.+ * `activityOf` remains the shared state resolver, so the deck cannot describe+ * a terminal differently from the grid beside it.*/const deck = useDeckQueue(deckView && onScreen);const deckAgents: DeckAgent[] = useMemo(() => {@@ -1147,9 +1147,6 @@ export function AgenticGrid({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,};});diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.offscreen.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.offscreen.test.tsxindex c738047e7b..930f9b1e2a 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.offscreen.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.offscreen.test.tsx@@ -80,7 +80,11 @@ vi.mock("@xterm/xterm", () => ({},}));-vi.mock("@xterm/addon-fit", () => ({ FitAddon: class { fit() {} } }));+vi.mock("@xterm/addon-fit", () => ({+ FitAddon: class {+ fit() {}+ },+}));vi.mock("@xterm/addon-web-links", () => ({ WebLinksAddon: class {} }));vi.mock("@xterm/addon-canvas", () => ({ CanvasAddon: class {} }));vi.mock("@xterm/addon-unicode11", () => ({ Unicode11Addon: class {} }));@@ -102,6 +106,10 @@ vi.mock("@/lib/agenticIdeApi", () => ({ attachToTerminal: vi.fn() }));import { AgenticTerminal } from "./AgenticTerminal";import { OFFSCREEN_MAX_HOLD_MS } from "./offscreenBuffer";+import {+ clearTerminalPreview,+ subscribeTerminalPreview,+} from "./terminalPreview";class ResizeObserverHarness implements ResizeObserver {constructor(_callback: ResizeObserverCallback) {}@@ -114,8 +122,10 @@ class IntersectionObserverHarness {constructor(private readonly callback: IntersectionObserverCallback) {harness.fire = (intersecting: boolean) => {this.callback(- harness.observed.map((target) => ({ target, isIntersecting: intersecting })) as- unknown as IntersectionObserverEntry[],+ harness.observed.map((target) => ({+ target,+ isIntersecting: intersecting,+ })) as unknown as IntersectionObserverEntry[],this as unknown as IntersectionObserver,);};@@ -156,6 +166,7 @@ describe("AgenticTerminal off-screen output", () => {});afterEach(() => {+ clearTerminalPreview("Dana");vi.restoreAllMocks();});@@ -180,6 +191,17 @@ describe("AgenticTerminal off-screen output", () => {expect(harness.writes).toEqual(["frame one frame two frame three"]);});+ it("keeps the same hidden xterm live while its deck card is watching", () => {+ const unsubscribe = subscribeTerminalPreview("Dana", () => undefined);+ mount();+ act(() => harness.fire?.(false));++ act(() => harness.handlers?.onOutput("live deck output"));++ expect(harness.writes).toContain("live deck output");+ unsubscribe();+ });+it("writes a flooded hidden pane out rather than losing its frame", () => {// The bytes that DREW the agent's interface sit at the FRONT of the// stream, and an Ink-based TUI never repaints it unprompted. A hidden pane@@ -289,8 +311,15 @@ describe("AgenticTerminal off-screen output", () => {// On screen by measurement — jsdom reports a zero box otherwise, which// would (correctly) read as "no area, still off screen".vi.spyOn(Element.prototype, "getBoundingClientRect").mockReturnValue({- top: 10, bottom: 400, left: 10, right: 400, width: 390, height: 390,- x: 10, y: 10, toJSON: () => ({}),+ top: 10,+ bottom: 400,+ left: 10,+ right: 400,+ width: 390,+ height: 390,+ x: 10,+ y: 10,+ toJSON: () => ({}),} as DOMRect);act(() => {@@ -310,8 +339,15 @@ describe("AgenticTerminal off-screen output", () => {act(() => harness.fire?.(false));vi.spyOn(Element.prototype, "getBoundingClientRect").mockReturnValue({- top: 10, bottom: 400, left: 10, right: 400, width: 390, height: 390,- x: 10, y: 10, toJSON: () => ({}),+ top: 10,+ bottom: 400,+ left: 10,+ right: 400,+ width: 390,+ height: 390,+ x: 10,+ y: 10,+ toJSON: () => ({}),} as DOMRect);act(() => harness.handlers?.onOutput("the prompt Jarvis just typed"));@@ -325,8 +361,15 @@ describe("AgenticTerminal off-screen output", () => {act(() => harness.fire?.(false));vi.spyOn(Element.prototype, "getBoundingClientRect").mockReturnValue({- top: 4000, bottom: 4400, left: 10, right: 400, width: 390, height: 390,- x: 10, y: 4000, toJSON: () => ({}),+ top: 4000,+ bottom: 4400,+ left: 10,+ right: 400,+ width: 390,+ height: 390,+ x: 10,+ y: 4000,+ toJSON: () => ({}),} as DOMRect);act(() => harness.handlers?.onOutput("nobody is looking at this"));diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsxindex 4e537433a7..61b9595d85 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx@@ -74,6 +74,13 @@ import {themeFor,type TerminalAppearance,} from "./terminalThemes";+import {+ clearTerminalPreview,+ publishTerminalPreview,+ readTerminalPreview,+ registerTerminalPreviewSource,+ terminalPreviewRequested,+} from "./terminalPreview";import {extractPaneDrop,extractPasteFiles,@@ -139,6 +146,9 @@ import { useT } from "@/i18n";*/const RECEIPT_MAX_AGE_MS = 30 * 60 * 1000;+/** React cards need fresh output, but not one render for every PTY frame. */+const TERMINAL_PREVIEW_REFRESH_MS = 160;+type PreservedTerminalViewport = {line: number;followsTail: boolean;@@ -796,6 +806,8 @@ export function AgenticTerminal({let parkedCheckedAt = 0;/** The pending deadline flush, if this pane is holding anything. */let holdTimer: number | undefined;+ /** The deck sees at most one parsed-screen snapshot per short frame. */+ let previewTimer: number | undefined;const cancelHoldTimer = () => {if (holdTimer === undefined) return;@@ -819,6 +831,30 @@ export function AgenticTerminal({afterFlush?.();};+ const publishPreview = () => {+ previewTimer = undefined;+ if (disposed || !terminalPreviewRequested(name)) return;+ publishTerminalPreview(name, readTerminalPreview(term));+ };++ const schedulePreview = () => {+ if (previewTimer !== undefined || !terminalPreviewRequested(name)) return;+ previewTimer = window.setTimeout(+ publishPreview,+ TERMINAL_PREVIEW_REFRESH_MS,+ );+ };++ /** Flush queued output, then snapshot after xterm has parsed every write. */+ const requestPreview = () => {+ if (disposed || !terminalPreviewRequested(name)) return;+ flushHeld(() => term.write("", schedulePreview));+ };+ const unregisterPreviewSource = registerTerminalPreviewSource(+ name,+ requestPreview,+ );+/** Make sure the held output has a flush coming, without moving one nearer. */const armHoldTimer = () => {if (holdTimer !== undefined) return;@@ -970,8 +1006,15 @@ export function AgenticTerminal({// at it. Cheap to call per chunk: React bails out on an unchanged value.setPainted(true);if (!paneVisible) recheckParked();- if (paneVisible) {- term.write(text, afterWrite);+ if (paneVisible || terminalPreviewRequested(name)) {+ // The card is a view onto THIS xterm buffer. A hidden pane therefore+ // keeps parsing while its deck card is visible, but it never opens a+ // second socket or mounts another agent-owning terminal component.+ if (!paneVisible) flushHeld();+ term.write(text, () => {+ schedulePreview();+ afterWrite?.();+ });return;}offscreen.push(text);@@ -1420,6 +1463,9 @@ export function AgenticTerminal({if (typeof document !== "undefined") {document.removeEventListener("visibilitychange", onDocumentVisible);}+ if (previewTimer !== undefined) window.clearTimeout(previewTimer);+ unregisterPreviewSource();+ clearTerminalPreview(name);ro.disconnect();io?.disconnect();disposeFontSync();diff --git a/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsx b/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsxindex d8b3ad3686..c425a94730 100644--- a/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/VoiceOrb.tsx@@ -127,10 +127,11 @@ const MOTIONS: Record<VoiceState, Motion> = {* at rest, every beat hit the `Math.min(1, …)` ceiling, and the result was a* pulse nobody could see.*/-const BASE_SCALE = 0.86;+// Kept identical to the spawned desktop renderer (`ui/orb/voice_orb.py`).+const BASE_SCALE = 0.75;/** How much of the remaining headroom a full-volume moment claims. */-const LEVEL_SWELL = 0.12;+const LEVEL_SWELL = 0.1;type Rgb = readonly [number, number, number];diff --git a/jarvis/ui/web/frontend/src/components/agentic/deck/AgentCard.tsx b/jarvis/ui/web/frontend/src/components/agentic/deck/AgentCard.tsxindex a9095ffa50..595e6272cc 100644--- a/jarvis/ui/web/frontend/src/components/agentic/deck/AgentCard.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/deck/AgentCard.tsx@@ -1,12 +1,12 @@/**- * One agent, as a person at the table rather than as a terminal.+ * One agent and a compact live view of its real 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.+ * colleague: who they are, what is actually happening in their terminal, and+ * whether they need you. The card mirrors the existing xterm buffer; it never+ * owns a socket or an agent. Expanding it therefore reveals the very same+ * terminal rather than creating a second session.** ## The ring*@@ -29,6 +29,7 @@import { Hand, Loader2, MessageCircleQuestion, Terminal } from "lucide-react";import { cn } from "@/lib/utils";import { AgentMark } from "../AgentMark";+import { useTerminalPreview } from "../terminalPreview";/** What a card is showing, resolved by the stage rather than by the card. */export type CardState = "working" | "waiting" | "asking" | "held" | "dead";@@ -39,8 +40,6 @@ export interface AgentCardProps {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;@@ -74,7 +73,6 @@ export function AgentCard({name,agent,agentLabel,- task,state,expanded,reporting = false,@@ -82,13 +80,14 @@ export function AgentCard({onToggleHold,}: AgentCardProps) {const held = state === "held";+ const terminal = useTerminalPreview(name);return (<divdata-testid={`deck-card-${name}`}data-state={state}data-expanded={expanded ? "yes" : "no"}className={cn(- "group relative flex min-h-[13rem] min-w-0 flex-col gap-4 rounded-xl border bg-card/60 p-5",+ "group relative flex min-h-[15rem] min-w-0 flex-col gap-4 rounded-xl border bg-card/60 p-5","transition-colors",RING[state],held && "opacity-70",@@ -107,7 +106,12 @@ export function AgentCard({>{/* Plain, not boxed: the ring around it is already the frame, and atile inside a ring is two borders for one thing. */}- <AgentMark agent={agent} label={agentLabel} variant="plain" size="md" />+ <AgentMark+ agent={agent}+ label={agentLabel}+ variant="plain"+ size="md"+ />{reporting && (<spandata-testid={`deck-card-dot-${name}`}@@ -147,17 +151,32 @@ export function AgentCard({</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-3 min-h-[3.75rem] text-sm leading-relaxed text-muted-foreground"+ <div+ data-testid={`deck-card-terminal-${name}`}+ aria-label={`Live terminal output for ${name}`}+ className={cn(+ "relative min-h-[9rem] flex-1 overflow-hidden rounded-xl border border-border/80",+ "bg-background/95 shadow-inner backdrop-blur-sm",+ )}>- {task}- </p>+ {terminal.length > 0 ? (+ <div className="h-full overflow-hidden p-3 font-mono text-xs leading-[1.55] text-foreground/90">+ {terminal.map((line, index) => (+ <div+ key={`${index}-${line}`}+ className="min-h-[1.55em] truncate whitespace-pre"+ title={line || undefined}+ >+ {line || "\u00a0"}+ </div>+ ))}+ </div>+ ) : (+ <div className="flex h-full min-h-[9rem] items-center justify-center px-3 text-center font-mono text-xs text-muted-foreground/70">+ Waiting for live terminal output...+ </div>+ )}+ </div><div className="flex items-center gap-2"><button@@ -189,7 +208,8 @@ export function AgentCard({"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",+ held &&+ "bg-primary/15 text-primary hover:bg-primary/20 hover:text-primary",)}><Hand className="h-3.5 w-3.5 shrink-0" />diff --git a/jarvis/ui/web/frontend/src/components/agentic/deck/DeckStage.tsx b/jarvis/ui/web/frontend/src/components/agentic/deck/DeckStage.tsxindex fade5e9023..c425cb8a09 100644--- a/jarvis/ui/web/frontend/src/components/agentic/deck/DeckStage.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/deck/DeckStage.tsx@@ -1,12 +1,9 @@/*** 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.+ * Grid and chat both put full terminals on screen. The deck keeps the orb at+ * centre stage and shows each terminal as a compact live viewport, so the user+ * can see what is really running without giving every pane the whole canvas.** ## What this component does and does not own*@@ -41,7 +38,6 @@ export interface DeckAgent {name: string;agent: string;agentLabel: string;- task: string;state: CardState;}@@ -77,7 +73,10 @@ function voiceDetail(assistantName: string,): string {if (state === "idle") {- return t("agentic_grid.voice_bubble.talk_title").replace("{0}", assistantName);+ return t("agentic_grid.voice_bubble.talk_title").replace(+ "{0}",+ assistantName,+ );}if (state === "connecting") return t("voice_state.warming_hint");if (state === "listening") return t("voice_state.ready_title");@@ -117,7 +116,9 @@ export function DeckStage({}: DeckStageProps) {const t = useT();const { active, busy, connecting, toggleCall, voiceState } = useVoiceCall();- const transcription = (useEventStore((store) => store.transcription) ?? "").trim();+ const transcription = (+ useEventStore((store) => store.transcription) ?? ""+ ).trim();const assistantName =(useEventStore((store) => store.assistantName) ?? "").trim() ||t("agentic_grid.voice_bubble.assistant_fallback");@@ -146,7 +147,8 @@ export function DeckStage({"relative isolate w-full max-w-2xl shrink-0 overflow-hidden rounded-[1.75rem] border","border-border/70 bg-card/80 px-4 py-3 shadow-[0_18px_55px_-30px_rgb(var(--scrim-rgb)/0.8)]","backdrop-blur-xl sm:px-6 sm:py-4",- active && "border-primary/35 shadow-[0_18px_60px_-28px_rgb(var(--accent-rgb)/0.5)]",+ active &&+ "border-primary/35 shadow-[0_18px_60px_-28px_rgb(var(--accent-rgb)/0.5)]",)}><span@@ -154,18 +156,7 @@ export function DeckStage({className="pointer-events-none absolute -right-16 -top-24 h-64 w-64 rounded-full bg-primary/10 blur-3xl"/><div className="relative flex flex-col items-center gap-3 sm:flex-row sm:gap-6">- <div- data-state={voiceState}- className="agentic-voice-orb-stage relative grid h-32 w-32 shrink-0 place-items-center sm:h-36 sm:w-36"- >- <span- aria-hidden- className="agentic-voice-orb-ring agentic-voice-orb-ring-a"- />- <span- aria-hidden- className="agentic-voice-orb-ring agentic-voice-orb-ring-b"- />+ <div className="relative grid h-32 w-32 shrink-0 place-items-center sm:h-36 sm:w-36"><buttontype="button"data-testid="deck-orb"@@ -175,7 +166,10 @@ export function DeckStage({aria-label={active? t("agentic_grid.voice_bubble.hang_up")- : t("agentic_grid.voice_bubble.talk").replace("{0}", assistantName)+ : t("agentic_grid.voice_bubble.talk").replace(+ "{0}",+ assistantName,+ )}title={active@@ -186,13 +180,10 @@ export function DeckStage({)}className={cn(- "relative z-10 rounded-full outline-none transition-[transform,filter,opacity] duration-500",+ "relative z-10 rounded-full outline-none transition-[transform,opacity] duration-500","drop-shadow-[0_12px_24px_rgba(0,0,0,0.32)]","hover:scale-[1.025] active:scale-[0.98] focus-visible:ring-2 focus-visible:ring-primary/60","motion-reduce:transform-none disabled:cursor-wait disabled:opacity-70",- active || connecting- ? "[filter:saturate(1)_brightness(1)]"- : "[filter:saturate(0.5)_brightness(0.82)] hover:[filter:saturate(0.78)_brightness(0.94)]",)}><VoiceOrb state={voiceState} size={116} />@@ -268,8 +259,8 @@ export function DeckStage({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.+ No agents in this workspace yet. Open one and you can start+ handing out work by voice.</p>{onOpenTerminal && (<button@@ -299,7 +290,6 @@ export function DeckStage({name={entry.name}agent={entry.agent}agentLabel={entry.agentLabel}- task={entry.task}state={entry.state}expanded={expanded === entry.name}reporting={reporting.has(entry.name)}diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalPreview.test.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalPreview.test.tsnew file mode 100644index 0000000000..3c1da2e4cf--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalPreview.test.ts@@ -0,0 +1,77 @@+import { describe, expect, it, vi } from "vitest";+import {+ clearTerminalPreview,+ publishTerminalPreview,+ readTerminalPreview,+ registerTerminalPreviewSource,+ subscribeTerminalPreview,+ terminalPreviewRequested,+} from "./terminalPreview";++describe("terminal preview", () => {+ it("reads the live xterm screen rather than raw terminal output", () => {+ const lines = ["old scrollback", "prompt", "", "tests passed", "", ""];+ const preview = readTerminalPreview(+ {+ rows: 5,+ buffer: {+ active: {+ type: "normal",+ baseY: 1,+ getLine: (line) => ({ translateToString: () => lines[line] ?? "" }),+ },+ },+ },+ 3,+ );++ expect(preview).toEqual(["prompt", "", "tests passed"]);+ });++ it("rejoins xterm wraps and removes visible escaped control debris", () => {+ const lines = [+ { text: "npm run bu", isWrapped: false },+ { text: "ild", isWrapped: true },+ { text: String.raw`Befud\ndling...`, isWrapped: false },+ { text: String.raw`\x1b[32mtests passed\x1b[0m`, isWrapped: false },+ ];+ const preview = readTerminalPreview(+ {+ rows: lines.length,+ buffer: {+ active: {+ type: "alternate",+ baseY: 0,+ getLine: (line) => ({+ isWrapped: lines[line]?.isWrapped,+ translateToString: () => lines[line]?.text ?? "",+ }),+ },+ },+ },+ 4,+ );++ expect(preview).toEqual(["npm run build", "Befuddling...", "tests passed"]);+ });++ it("asks the real terminal for a snapshot when a card starts watching", () => {+ const request = vi.fn();+ const notify = vi.fn();+ const stopSource = registerTerminalPreviewSource("T1", request);+ expect(terminalPreviewRequested("T1")).toBe(false);+ expect(request).not.toHaveBeenCalled();++ const unsubscribe = subscribeTerminalPreview("T1", notify);+ expect(terminalPreviewRequested("T1")).toBe(true);+ expect(request).toHaveBeenCalledOnce();++ publishTerminalPreview("T1", ["ready"]);+ expect(notify).toHaveBeenCalledOnce();++ unsubscribe();+ expect(terminalPreviewRequested("T1")).toBe(false);+ stopSource();+ clearTerminalPreview("T1");+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalPreview.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalPreview.tsnew file mode 100644index 0000000000..584dead6a5--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalPreview.ts@@ -0,0 +1,152 @@+import { useSyncExternalStore } from "react";++/** A small, read-only view of the live xterm screen used by the Command Deck. */+export type TerminalPreview = readonly string[];++type Listener = () => void;+type PreviewSource = () => void;++const EMPTY_PREVIEW: TerminalPreview = Object.freeze([] as string[]);+const previews = new Map<string, TerminalPreview>();+const listeners = new Map<string, Set<Listener>>();+const sources = new Map<string, Set<PreviewSource>>();++function samePreview(left: TerminalPreview, right: TerminalPreview): boolean {+ return (+ left.length === right.length &&+ left.every((line, index) => line === right[index])+ );+}++function previewFor(name: string): TerminalPreview {+ return previews.get(name) ?? EMPTY_PREVIEW;+}++/** Publish an already parsed xterm viewport without putting output in React state. */+export function publishTerminalPreview(+ name: string,+ lines: TerminalPreview,+): void {+ const next = Object.freeze([...lines]);+ if (samePreview(previewFor(name), next)) return;+ previews.set(name, next);+ listeners.get(name)?.forEach((notify) => notify());+}++/** Remove a pane's stale screen when its real terminal is destroyed. */+export function clearTerminalPreview(name: string): void {+ if (!previews.delete(name)) return;+ listeners.get(name)?.forEach((notify) => notify());+}++/** True only while a deck card is asking to see this pane. */+export function terminalPreviewRequested(name: string): boolean {+ return (listeners.get(name)?.size ?? 0) > 0;+}++/**+ * Register the live xterm as the source for a card.+ *+ * A newly opened deck requests an immediate snapshot, so it does not wait for+ * the agent's next byte before showing a terminal that has already drawn.+ */+export function registerTerminalPreviewSource(+ name: string,+ requestSnapshot: PreviewSource,+): () => void {+ const registered = sources.get(name) ?? new Set<PreviewSource>();+ registered.add(requestSnapshot);+ sources.set(name, registered);+ if (terminalPreviewRequested(name)) requestSnapshot();+ return () => {+ registered.delete(requestSnapshot);+ if (registered.size === 0) sources.delete(name);+ };+}++export function subscribeTerminalPreview(+ name: string,+ listener: Listener,+): () => void {+ const registered = listeners.get(name) ?? new Set<Listener>();+ registered.add(listener);+ listeners.set(name, registered);+ sources.get(name)?.forEach((requestSnapshot) => requestSnapshot());+ return () => {+ registered.delete(listener);+ if (registered.size === 0) listeners.delete(name);+ };+}++/** Subscribe one card to its real terminal's latest visible rows. */+export function useTerminalPreview(name: string): TerminalPreview {+ return useSyncExternalStore(+ (listener) => subscribeTerminalPreview(name, listener),+ () => previewFor(name),+ () => EMPTY_PREVIEW,+ );+}++interface BufferLineLike {+ /** True when this physical xterm row continues the previous logical line. */+ isWrapped?: boolean;+ translateToString(+ trimRight?: boolean,+ startColumn?: number,+ endColumn?: number,+ ): string;+}++/**+ * Remove transport-shaped debris from the glance view only.+ *+ * The full xterm remains byte-for-byte faithful. Compact cards, however, are+ * not useful when a CLI has printed escaped control tokens as visible text+ * (the reported `Befud\\ndling` / `component\\ns` fragments). Joining those+ * tokens repairs the intended word without teaching the terminal itself to+ * rewrite user output.+ */+function cleanPreviewRow(value: string): string {+ return value+ .replace(/\\(?:x1b|u001b)\[[0-?]*[ -/]*[@-~]/gi, "")+ .replace(/\\[rn]/g, "")+ .replace(/\\t/g, " ")+ .replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g, "")+ .trimEnd();+}++interface TerminalBufferLike {+ type: string;+ baseY: number;+ getLine?(line: number): BufferLineLike | undefined;+}++interface TerminalLike {+ rows: number;+ buffer: { active: TerminalBufferLike };+}++/** Read the live screen, after xterm has resolved ANSI cursor movement and redraws. */+export function readTerminalPreview(+ term: TerminalLike,+ maxRows = 7,+): TerminalPreview {+ const buffer = term.buffer.active;+ if (!buffer.getLine || maxRows <= 0) return EMPTY_PREVIEW;+ const screenStart = buffer.type === "normal" ? buffer.baseY : 0;+ const rows: string[] = [];+ for (let row = 0; row < term.rows; row += 1) {+ const line = buffer.getLine(screenStart + row);+ const text = cleanPreviewRow(line?.translateToString(true) ?? "");+ if (line?.isWrapped && rows.length > 0) {+ rows[rows.length - 1] += text;+ } else {+ rows.push(text);+ }+ }+ let lastContent = rows.length - 1;+ while (lastContent >= 0 && rows[lastContent].trim().length === 0)+ lastContent -= 1;+ if (lastContent < 0) return EMPTY_PREVIEW;+ return rows.slice(Math.max(0, lastContent - maxRows + 1), lastContent + 1);+}