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(wallpaper): favourite a wallpaper and find it again
rubenluetke10-beep0373c1b79e2d
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgentPicker.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgentPicker.tsxindex 2c2357d773..eea44542b1 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgentPicker.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgentPicker.tsx@@ -59,8 +59,16 @@ export function offersAgentChoice(agents?: SplitAgentChoice[]): boolean {return (agents ?? []).filter((a) => a.installed).length > 1;}-/** The menu's own footprint, used to decide whether it still fits below. */-const MENU_WIDTH_PX = 240;+/**+ * The menu's own footprint, used to decide whether it still fits below.+ *+ * Wide enough that the one-line description under each name survives instead of+ * being truncated mid-word: at 240px "Moonshot AI's terminal coding agent" was+ * cut to "…terminal coding ag…", which is a label that costs a line and answers+ * nothing. Keep in step with the `w-*` class on the menu below, which is what+ * governs while the menu still hangs inside its caller.+ */+const MENU_WIDTH_PX = 272;const MENU_GAP_PX = 4;/** Never hang closer than this to a window edge. */const VIEWPORT_MARGIN_PX = 8;@@ -190,7 +198,7 @@ export function AgentPickerMenu({// the backend registered, and that is six entries on a machine with// the usual set installed — more than fits under a button near the// top of a laptop screen.- "z-50 max-h-[70vh] w-60 overflow-y-auto rounded-lg border border-border bg-card p-1 shadow-xl scrollbar-jarvis",+ "z-50 max-h-[70vh] w-[17rem] overflow-y-auto rounded-lg border border-border bg-card p-1 shadow-xl scrollbar-jarvis","animate-in fade-in-0 zoom-in-95 duration-150",// The caller's anchoring classes describe a box INSIDE its own// element ("right-2 top-full"), which is the very thing a detached@@ -202,7 +210,12 @@ export function AgentPickerMenu({if (e.key === "Escape") onDismiss();}}>- <p className="px-2 py-1.5 text-[11px] uppercase tracking-wider text-muted-foreground">+ {/* The question, at label weight rather than as quiet muted ink: it is+ 11px in all-caps, which is the hardest text in the menu to read, and+ it is the one line that says what the click will do. The rule under+ it separates the question from the answers, so the first entry does+ not read as part of the heading. */}+ <p className="mb-1 border-b border-border/60 px-2 pb-1.5 pt-1 text-[11px] font-semibold uppercase tracking-wider text-foreground/70">{title}</p>{agents.map((agent) => (@@ -217,7 +230,14 @@ export function AgentPickerMenu({e.stopPropagation();onPick(agent.name);}}- className="flex w-full items-start justify-between gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent"+ /* An entry that is not installed is OFF, not unreadable. It used to+ drop to 40 % opacity, which on paper put its name and its own+ "not installed" reason below the contrast floor — the absence+ stopped explaining itself, which is the whole reason the entry is+ listed. State now reads from the ink COLOUR (muted rather than+ foreground) with only a slight dim on top, so it is plainly+ unavailable and still says why. */+ className="flex w-full items-start justify-between gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors hover:bg-primary/10 disabled:cursor-not-allowed disabled:text-muted-foreground disabled:opacity-80 disabled:hover:bg-transparent">{/* The mark, at list weight rather than as a framed tile: this is amenu of choices, and forty boxes down a column read as a grid@@ -244,7 +264,7 @@ export function AgentPickerMenu({)}</span>{!agent.installed && (- <span className="shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground">+ <span className="shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground">{agent.kind === "shell" ? "no shell here" : "not installed"}</span>)}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.tsxdeleted file mode 100644index 467d522d3f..0000000000--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.deck.test.tsx+++ /dev/null@@ -1,608 +0,0 @@-/**- * 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 { act } from "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 deckVoice = vi.hoisted(() => ({- state: "idle" as string,- transcription: "",- assistantName: "Ben",-}));-const pushToast = vi.fn();-vi.mock("@/store/events", () => ({- useEventStore: (selector: (s: Record<string, unknown>) => unknown) =>- selector({- pushToast,- voiceState: deckVoice.state,- transcription: deckVoice.transcription,- assistantName: deckVoice.assistantName,- }),-}));--vi.mock("@/lib/voiceApi", () => ({- requestVoiceCall: vi.fn(async () => ({ armed: true })),- requestVoiceHangup: vi.fn(async () => ({ stopped: true })),-}));--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 {- clearTerminalPreview,- publishTerminalPreview,-} from "./terminalPreview";-import * as api from "@/lib/agenticIdeApi";-import * as voiceApi from "@/lib/voiceApi";-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();- deckVoice.state = "idle";- deckVoice.transcription = "";- deckVoice.assistantName = "Ben";- for (const name of ["Mika", "Nova", "Aria", "Kai", "T1", "T2"]) {- clearTerminalPreview(name);- }-});--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(- /say the wake word/i,- );- expect(screen.getByTestId("deck-voice-action")).toBeTruthy();- });-- it("starts voice directly from the deck instead of opening another orb", async () => {- const openBubble = vi.fn();- renderGrid(FOUR, { voiceOpen: false, onToggleVoice: openBubble });- toDeck();-- fireEvent.click(screen.getByTestId("deck-orb"));-- await waitFor(() =>- expect(voiceApi.requestVoiceCall).toHaveBeenCalledTimes(1),- );- expect(openBubble).not.toHaveBeenCalled();- });-- it("shows live speech and lets the same control end the conversation", async () => {- deckVoice.state = "listening";- deckVoice.transcription = "hand the test failure to T2";- renderGrid();- toDeck();-- expect(screen.getByTestId("deck-orb-caption").textContent).toContain(- "hand the test failure to T2",- );- fireEvent.click(screen.getByTestId("deck-voice-action"));-- await waitFor(() =>- expect(voiceApi.requestVoiceHangup).toHaveBeenCalledTimes(1),- );- });-- 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("shows the real coding CLI on cards that otherwise only say T1", () => {- const session = sessionWith(["T1", "T2"]);- session.terminals[1] = {- ...session.terminals[1],- agent: "codex",- display_name: "Codex",- };- renderGrid(session);- toDeck();-- expect(screen.getByTestId("deck-card-agent-label-T1").textContent).toBe(- "Claude Code",- );- expect(screen.getByTestId("deck-card-agent-label-T2").textContent).toBe(- "Codex",- );- });-- it("gives the terminal cards about one third more room", () => {- renderGrid();- toDeck();-- expect(screen.getByTestId("deck-cards").className).toContain("max-w-6xl");- expect(screen.getByTestId("deck-card-Mika").className).toContain(- "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("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"),- );- });-- 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/deck/AgentCard.tsx b/jarvis/ui/web/frontend/src/components/agentic/deck/AgentCard.tsxdeleted file mode 100644index c77b69a466..0000000000--- a/jarvis/ui/web/frontend/src/components/agentic/deck/AgentCard.tsx+++ /dev/null@@ -1,221 +0,0 @@-/**- * 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: 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- *- * 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";-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";--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;- 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,- state,- expanded,- reporting = false,- onToggleExpand,- onToggleHold,-}: AgentCardProps) {- const held = state === "held";- const terminal = useTerminalPreview(name);- return (- <div- data-testid={`deck-card-${name}`}- data-state={state}- data-expanded={expanded ? "yes" : "no"}- className={cn(- "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",- )}- >- <div className="flex min-w-0 items-center gap-3">- <span- className={cn(- "relative flex h-12 w-12 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="md"- />- {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">- {/* The pane call-sign is useful, but it must never hide which coding- CLI is actually running here. Keeping both in the heading makes- a Claude Code pane stay recognisable as Claude Code even when- its default call-sign is only T1. */}- <span className="flex min-w-0 items-baseline gap-1.5 text-foreground">- <span className="truncate text-base font-semibold">{name}</span>- <span aria-hidden className="shrink-0 text-muted-foreground/60">- ·- </span>- <span- data-testid={`deck-card-agent-label-${name}`}- className="truncate text-sm font-medium text-muted-foreground"- title={agentLabel}- >- {agentLabel}- </span>- </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>-- <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-white/25",- "bg-zinc-950/90 shadow-inner backdrop-blur-sm",- )}- >- {terminal.length > 0 ? (- <div className="h-full overflow-hidden p-3 font-mono text-xs leading-[1.55] text-zinc-100">- {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-zinc-400">- Waiting for live terminal output...- </div>- )}- </div>-- <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.tsxdeleted file mode 100644index c425cb8a09..0000000000--- a/jarvis/ui/web/frontend/src/components/agentic/deck/DeckStage.tsx+++ /dev/null@@ -1,314 +0,0 @@-/**- * The Command Deck: the conversation is the subject, the terminals recede.- *- * 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- *- * 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 { AudioLines, Mic, MicOff, Plus } from "lucide-react";-import { useT } from "@/i18n";-import { cn } from "@/lib/utils";-import { useEventStore, type VoiceState } from "@/store/events";-import { VoiceOrb } from "../VoiceOrb";-import { useVoiceCall } from "../useVoiceCall";-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;- state: CardState;-}--export interface DeckStageProps {- agents: DeckAgent[];- 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;-}--const VOICE_STATUS_KEY: Record<VoiceState, string> = {- idle: "agentic_grid.voice_bubble.ready",- connecting: "voice_state.connecting",- listening: "agentic_grid.voice_bubble.listening",- thinking: "agentic_grid.voice_bubble.thinking",- speaking: "agentic_grid.voice_bubble.speaking",- paused: "agentic_grid.voice_bubble.paused",- error: "agentic_grid.voice_bubble.error",-};--function voiceDetail(- t: (key: string) => string,- state: VoiceState,- assistantName: string,-): string {- if (state === "idle") {- 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");- if (state === "thinking") return t("sidebar.realtime_working");- if (state === "error") return t("sidebar.realtime_error");- return t(VOICE_STATUS_KEY[state]);-}--function voiceHeadline(- t: (key: string) => string,- state: VoiceState,- assistantName: string,-): string {- if (state === "idle") {- return t("agentic_grid.voice_bubble.talk").replace("{0}", assistantName);- }- if (state === "connecting") return t("voice_state.warming_title");- if (state === "listening") return t("voice_state.ready_title");- if (state === "thinking") return t("sidebar.realtime_working");- if (state === "error") return t("sidebar.realtime_error");- return t(VOICE_STATUS_KEY[state]);-}--export function DeckStage({- agents,- expanded,- onToggleExpand,- onToggleHold,- onOpenTerminal,- reporting,- pending,- onAir,- sleeping,- onHear,- onDropReport,- onWake,-}: DeckStageProps) {- const t = useT();- const { active, busy, connecting, toggleCall, voiceState } = useVoiceCall();- const transcription = (- useEventStore((store) => store.transcription) ?? ""- ).trim();- const assistantName =- (useEventStore((store) => store.assistantName) ?? "").trim() ||- t("agentic_grid.voice_bubble.assistant_fallback");- const disabled = busy || connecting;- const status = t(VOICE_STATUS_KEY[voiceState]);- const headline = voiceHeadline(t, voiceState, assistantName);- const liveTranscript = active ? transcription : "";- const detail = liveTranscript || voiceDetail(t, voiceState, assistantName);-- 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.- */}- <section- data-testid="deck-voice-control"- data-state={voiceState}- aria-labelledby="deck-voice-title"- className={cn(- "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)]",- )}- >- <span- aria-hidden- 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 className="relative grid h-32 w-32 shrink-0 place-items-center sm:h-36 sm:w-36">- <button- type="button"- data-testid="deck-orb"- onClick={() => void toggleCall()}- disabled={disabled}- aria-pressed={active}- aria-label={- active- ? t("agentic_grid.voice_bubble.hang_up")- : t("agentic_grid.voice_bubble.talk").replace(- "{0}",- assistantName,- )- }- title={- active- ? t("agentic_grid.voice_bubble.hang_up_title")- : t("agentic_grid.voice_bubble.talk_title").replace(- "{0}",- assistantName,- )- }- className={cn(- "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",- )}- >- <VoiceOrb state={voiceState} size={116} />- </button>- </div>-- <div className="flex min-w-0 flex-1 flex-col items-center text-center sm:items-start sm:text-left">- <div className="mb-1.5 inline-flex items-center gap-2 rounded-full border border-border/60 bg-background/55 px-2.5 py-1">- <span- aria-hidden- data-state={voiceState}- className="agentic-voice-state-dot"- />- <span className="text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground">- {status}- </span>- </div>- <h2- id="deck-voice-title"- className="text-lg font-semibold tracking-tight text-foreground sm:text-xl"- >- {headline}- </h2>- <p- data-testid="deck-orb-caption"- aria-live="polite"- className={cn(- "mt-1 line-clamp-2 min-h-10 max-w-md text-sm leading-relaxed text-muted-foreground",- liveTranscript && "text-foreground/80",- )}- >- {detail}- </p>- <button- type="button"- data-testid="deck-voice-action"- onClick={() => void toggleCall()}- disabled={disabled}- aria-pressed={active}- className={cn(- "mt-2.5 inline-flex min-h-9 items-center gap-2 rounded-full border px-4 py-2 text-xs font-semibold",- "transition-[background-color,color,border-color,transform] hover:-translate-y-px active:translate-y-0",- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 disabled:cursor-wait disabled:opacity-60",- active- ? "border-destructive/30 bg-destructive/10 text-destructive hover:bg-destructive/15"- : "border-primary/30 bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",- )}- >- {active ? (- <MicOff className="h-3.5 w-3.5 shrink-0" />- ) : connecting ? (- <AudioLines className="h-3.5 w-3.5 shrink-0 animate-pulse motion-reduce:animate-none" />- ) : (- <Mic className="h-3.5 w-3.5 shrink-0" />- )}- {active- ? t("agentic_grid.voice_bubble.mic_stop")- : connecting- ? t("voice_state.connecting")- : t("agentic_grid.voice_bubble.mic_start").replace(- "{0}",- assistantName,- )}- </button>- </div>- </div>- </section>-- {/* 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-6xl grid-cols-1 gap-4 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}- 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.tsxdeleted file mode 100644index 843bb88d6d..0000000000--- a/jarvis/ui/web/frontend/src/components/agentic/deck/ReportLane.tsx+++ /dev/null@@ -1,154 +0,0 @@-/**- * 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.tsdeleted file mode 100644index 2e43c39d8c..0000000000--- a/jarvis/ui/web/frontend/src/components/agentic/deck/useDeckQueue.ts+++ /dev/null@@ -1,138 +0,0 @@-/**- * 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/components/agentic/terminalPreview.test.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalPreview.test.tsdeleted file mode 100644index 1e4108eda3..0000000000--- a/jarvis/ui/web/frontend/src/components/agentic/terminalPreview.test.ts+++ /dev/null@@ -1,77 +0,0 @@-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.tsdeleted file mode 100644index e2903e63a9..0000000000--- a/jarvis/ui/web/frontend/src/components/agentic/terminalPreview.ts+++ /dev/null@@ -1,152 +0,0 @@-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, "")- .trim();-}--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);-}diff --git a/jarvis/ui/web/frontend/src/index.css b/jarvis/ui/web/frontend/src/index.cssindex 893ea153b0..ef1b7881ed 100644--- a/jarvis/ui/web/frontend/src/index.css+++ b/jarvis/ui/web/frontend/src/index.css@@ -1027,25 +1027,53 @@}/* Radix portals and hand-built pickers render under <body>, outside the- section stage above. Keep those floating surfaces on the same clear glass- system so Light mode never reintroduces an opaque white sheet. */+ section stage above — so they inherit neither its glass ground nor its+ readability floor, and they hang over arbitrary content: another card, a+ wallpaper, or a terminal pane full of text.++ A floating layer is NOT chrome. The untinted-wallpaper decision applies+ to surfaces the artwork is the background OF (nav column, top bar); a+ menu, dialog or tooltip is a transient overlay whose whole purpose is to+ be read, and it covers what is under it on purpose. Light mode used to+ drop its ground entirely and rely on a blur alone — but a blur is not a+ contrast ground, so the agent picker over a terminal pane came out as a+ milky smear with its 11px descriptions dissolving into the text behind+ them (maintainer report 2026-08-11).++ These surfaces therefore carry their own near-opaque paper ground, a+ border firm enough to read as an edge, and no inherited halo (ink sits on+ paper here, so an outline would be pure noise). */:root:not(.dark):where([class~="bg-popover"], [class~="bg-popover/95"]),:root:not(.dark)- :where([role="dialog"], [role="menu"], [role="tooltip"]):where(+ :where(+ [role="dialog"],+ [role="menu"],+ [role="listbox"],+ [role="tooltip"]+ ):where([class~="bg-card"],[class~="bg-card/95"],[class~="bg-background"],[class~="bg-background/95"]) {- background-color: transparent;- -webkit-backdrop-filter: blur(16px) saturate(0.92);- backdrop-filter: blur(16px) saturate(0.92);+ /* Firmer than the stage's hairline: this edge separates the overlay from+ whatever it happens to hang over, not two cards on one ground. */+ --border: 40 12% 52%;+ background-color: hsl(var(--popover) / 0.97);+ -webkit-backdrop-filter: blur(16px) saturate(1.02);+ backdrop-filter: blur(16px) saturate(1.02);box-shadow:- inset 0 1px 0 rgb(255 255 255 / 0.42),- 0 18px 44px rgb(var(--scrim-rgb) / 0.14);+ inset 0 1px 0 rgb(255 255 255 / 0.6),+ 0 18px 44px rgb(var(--scrim-rgb) / 0.2);+ text-shadow: none;}+ /* Nested grounds INSIDE a dialog are flattened — the dialog above already+ supplies one, and stacking a second translucent fill on it only muddies+ it. The `:not()` chain protects the floating layer's own ground: a menu or+ a tooltip opened from within a dialog is a surface in front of it, not a+ panel inside it, and this selector outranks the rule above. */:root:not(.dark)[role="dialog"]:where(@@ -1070,6 +1098,8 @@[class~="bg-muted/30"],[class~="bg-muted/40"],[class~="bg-muted/50"]+ ):where(+ :not([role="menu"], [role="listbox"], [role="tooltip"], [role="dialog"])) {background-color: transparent;}diff --git a/jarvis/ui/web/frontend/src/store/wallpaper.ts b/jarvis/ui/web/frontend/src/store/wallpaper.tsindex 81b494cb5f..4d66dcdab2 100644--- a/jarvis/ui/web/frontend/src/store/wallpaper.ts+++ b/jarvis/ui/web/frontend/src/store/wallpaper.ts@@ -31,6 +31,17 @@ const THEME_KEYS: Record<Theme, string> = {* no pick of its own yet, so an existing profile keeps its picture. */const LEGACY_KEY = "jarvis.wallpaper.v1";+/**+ * The shortlist of wallpapers worth coming back to.+ *+ * Deliberately NOT split per theme the way the selection is: a favourite is a+ * property of the picture, not of the mode the app happens to be in. Splitting+ * it would force someone who loves a daylight scene to re-star it after every+ * toggle, and the theme filter in the grid already answers "which of my+ * favourites fit dark mode".+ */+const FAVORITES_KEY = "jarvis.wallpaper.favorites.v1";+/** Where a chosen wallpaper's full-size file is served from. */export function wallpaperFullUrl(id: string): string {return `/api/wallpapers/${encodeURIComponent(id)}/full`;@@ -59,17 +70,45 @@ function readSelections(): Record<Theme, string | null> {return { light: readStoredId("light"), dark: readStoredId("dark") };}+/**+ * The stored favourites, defensively.+ *+ * Anything that is not a list of non-empty strings is treated as "no+ * favourites": the value is hand-editable browser storage, and a malformed+ * entry must cost the grid a shortlist, never a mount.+ */+function readFavorites(): string[] {+ if (typeof window === "undefined") return [];+ try {+ const raw = window.localStorage.getItem(FAVORITES_KEY);+ if (!raw) return [];+ const parsed: unknown = JSON.parse(raw);+ if (!Array.isArray(parsed)) return [];+ const clean = parsed.filter(+ (entry): entry is string => typeof entry === "string" && entry.trim() !== "",+ );+ return [...new Set(clean)];+ } catch {+ return [];+ }+}+interface WallpaperStore {/** Each theme's chosen wallpaper id, or null for the bundled default. */selections: Record<Theme, string | null>;+ /** Favourited wallpaper ids, oldest first. Shared by both themes. */+ favorites: string[];/** Persist a choice for one theme. Pass null to go back to the default. */select: (id: string | null, theme: Theme) => void;+ /** Star or un-star one wallpaper. */+ toggleFavorite: (id: string) => void;/** Adopt choices made in another window. Does not write back. */adopt: () => void;}-export const useWallpaperStore = create<WallpaperStore>((set) => ({+export const useWallpaperStore = create<WallpaperStore>((set, get) => ({selections: readSelections(),+ favorites: readFavorites(),select: (id, theme) => {try {if (id) window.localStorage.setItem(THEME_KEYS[theme], id);@@ -83,7 +122,23 @@ export const useWallpaperStore = create<WallpaperStore>((set) => ({}set({ selections: readSelections() });},- adopt: () => set({ selections: readSelections() }),+ toggleFavorite: (id) => {+ if (!id) return;+ // Computed from the store rather than re-read from storage, so a rapid+ // double-click resolves against what this window last wrote.+ const current = get().favorites;+ const next = current.includes(id)+ ? current.filter((entry) => entry !== id)+ : [...current, id];+ try {+ if (next.length) window.localStorage.setItem(FAVORITES_KEY, JSON.stringify(next));+ else window.localStorage.removeItem(FAVORITES_KEY);+ } catch {+ /* the star still shows in this window, it just will not survive */+ }+ set({ favorites: next });+ },+ adopt: () => set({ selections: readSelections(), favorites: readFavorites() }),}));/**@@ -95,7 +150,12 @@ export const useWallpaperStore = create<WallpaperStore>((set) => ({*/export function installWallpaperSync(): () => void {if (typeof window === "undefined") return () => {};- const watched = new Set<string>([LEGACY_KEY, THEME_KEYS.light, THEME_KEYS.dark]);+ const watched = new Set<string>([+ LEGACY_KEY,+ THEME_KEYS.light,+ THEME_KEYS.dark,+ FAVORITES_KEY,+ ]);const onStorage = (event: StorageEvent) => {if (event.key !== null && !watched.has(event.key)) return;useWallpaperStore.getState().adopt();diff --git a/jarvis/ui/web/frontend/src/views/WallpaperView.test.tsx b/jarvis/ui/web/frontend/src/views/WallpaperView.test.tsxindex 5f640d2798..cd3d472cfe 100644--- a/jarvis/ui/web/frontend/src/views/WallpaperView.test.tsx+++ b/jarvis/ui/web/frontend/src/views/WallpaperView.test.tsx@@ -6,6 +6,7 @@ import {render,screen,waitFor,+ within,} from "@testing-library/react";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";@@ -78,7 +79,10 @@ function requestedSources(): string[] {beforeEach(() => {window.localStorage.clear();- useWallpaperStore.setState({ selections: { light: null, dark: null } });+ useWallpaperStore.setState({+ selections: { light: null, dark: null },+ favorites: [],+ });document.documentElement.classList.add("dark");});@@ -243,6 +247,130 @@ describe("WallpaperView", () => {expect(requestedSources()).toEqual(before);});+ it("stars a wallpaper from its tile and remembers it", async () => {+ renderView();++ await screen.findByAltText("Neon Crossing");+ fireEvent.click(+ screen.getByRole("button", { name: "Add Neon Crossing to favorites" }),+ );++ await waitFor(() => {+ expect(useWallpaperStore.getState().favorites).toEqual(["03-anime-neon-01"]);+ });+ expect(+ JSON.parse(window.localStorage.getItem("jarvis.wallpaper.favorites.v1") ?? "[]"),+ ).toEqual(["03-anime-neon-01"]);+ });++ it("un-stars a wallpaper and clears the storage slot when none are left", async () => {+ renderView();++ await screen.findByAltText("Neon Crossing");+ fireEvent.click(+ screen.getByRole("button", { name: "Add Neon Crossing to favorites" }),+ );+ fireEvent.click(+ await screen.findByRole("button", {+ name: "Remove Neon Crossing from favorites",+ }),+ );++ await waitFor(() => {+ expect(useWallpaperStore.getState().favorites).toEqual([]);+ });+ expect(window.localStorage.getItem("jarvis.wallpaper.favorites.v1")).toBeNull();+ });++ it("shows only the starred wallpapers under the Favorites filter", async () => {+ renderView();++ await screen.findByAltText("Morning Atrium");+ fireEvent.click(+ screen.getByRole("button", { name: "Add Morning Atrium to favorites" }),+ );+ fireEvent.click(screen.getByRole("button", { name: /Favorites/ }));++ await waitFor(() => {+ const tiles = [...document.querySelectorAll('[data-testid="wallpaper-grid"] img')];+ expect(tiles.map((tile) => tile.getAttribute("alt"))).toEqual([+ "Morning Atrium",+ ]);+ });+ });++ it("stars the bundled original like any other wallpaper", async () => {+ renderView();++ fireEvent.click(+ await screen.findByRole("button", { name: "Add The Original to favorites" }),+ );+ fireEvent.click(screen.getByRole("button", { name: /Favorites/ }));++ await waitFor(() => {+ const tiles = [...document.querySelectorAll('[data-testid="wallpaper-grid"] img')];+ expect(tiles.map((tile) => tile.getAttribute("alt"))).toEqual(["The Original"]);+ });+ });++ it("explains the empty Favorites filter instead of showing a bare no-match line", async () => {+ renderView();++ fireEvent.click(await screen.findByRole("button", { name: /Favorites/ }));++ expect(await screen.findByText(/No favorites yet/)).toBeTruthy();+ });++ it("ignores stored favorites the catalog no longer knows", async () => {+ // A library that was uninstalled leaves ids behind; they must not be+ // counted, and the filter must read as empty rather than as "1 starred".+ act(() => useWallpaperStore.setState({ favorites: ["99-vanished-01"] }));+ renderView();++ fireEvent.click(await screen.findByRole("button", { name: /Favorites/ }));++ expect(await screen.findByText(/No favorites yet/)).toBeTruthy();+ });++ it("keeps the preview open when its wallpaper is un-starred under the filter", async () => {+ renderView();++ await screen.findByAltText("Neon Crossing");+ fireEvent.click(+ screen.getByRole("button", { name: "Add Neon Crossing to favorites" }),+ );+ fireEvent.click(screen.getByRole("button", { name: /Favorites/ }));+ fireEvent.click(await screen.findByAltText("Neon Crossing"));+ const preview = await screen.findByTestId("wallpaper-preview");++ fireEvent.click(+ within(preview).getByRole("button", {+ name: "Remove Neon Crossing from favorites",+ }),+ );++ expect(screen.getByTestId("wallpaper-preview")).toBeTruthy();+ });++ it("stars a wallpaper from the preview", async () => {+ renderView();++ fireEvent.click(await screen.findByAltText("Flooded Observatory"));+ await screen.findByTestId("wallpaper-preview");+ const preview = screen.getByTestId("wallpaper-preview");+ fireEvent.click(+ within(preview).getByRole("button", {+ name: "Add Flooded Observatory to favorites",+ }),+ );++ await waitFor(() => {+ expect(useWallpaperStore.getState().favorites).toEqual([+ "01-cinematic-photoreal-01",+ ]);+ });+ });+it("still offers the original when the library is absent", async () => {renderView({ available: false, count: 0, styles: [], items: [] });diff --git a/jarvis/ui/web/frontend/src/views/WallpaperView.tsx b/jarvis/ui/web/frontend/src/views/WallpaperView.tsxindex ef2b0c37af..59d3557bf8 100644--- a/jarvis/ui/web/frontend/src/views/WallpaperView.tsx+++ b/jarvis/ui/web/frontend/src/views/WallpaperView.tsx@@ -3,6 +3,7 @@ import {Check,ChevronLeft,ChevronRight,+ Heart,Image as ImageIcon,Loader2,Moon,@@ -74,60 +75,136 @@ function SegmentButton({);}+/** The label the heart carries in both places it appears. */+function favoriteLabel(item: WallpaperEntry, favorite: boolean): string {+ return favorite+ ? `Remove ${item.title} from favorites`+ : `Add ${item.title} to favorites`;+}++/**+ * The heart, shared by the tile and the preview.+ *+ * A favourited wallpaper keeps its filled heart at all times; an unfavourited+ * one shows a hollow outline only while the tile is hovered or the button has+ * keyboard focus, so five hundred idle tiles are not five hundred pieces of+ * chrome competing with the artwork.+ */+function FavoriteButton({+ item,+ favorite,+ onToggle,+ // "overlay" sits on the artwork itself and needs its own contrast; "surface"+ // sits on app chrome and borrows the theme's tokens.+ tone = "overlay",+ className,+}: {+ item: WallpaperEntry;+ favorite: boolean;+ onToggle: () => void;+ tone?: "overlay" | "surface";+ className?: string;+}) {+ const idle =+ tone === "overlay"+ ? "border-white/25 bg-black/35 text-white/85 backdrop-blur-sm hover:bg-black/55 hover:text-white"+ : "border-border text-muted-foreground hover:bg-secondary/60 hover:text-foreground";+ return (+ <button+ type="button"+ onClick={onToggle}+ aria-pressed={favorite}+ aria-label={favoriteLabel(item, favorite)}+ title={favoriteLabel(item, favorite)}+ className={cn(+ "flex h-7 w-7 items-center justify-center rounded-full border transition-all",+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",+ favorite+ ? "border-transparent bg-rose-500/90 text-white shadow"+ : idle,+ className,+ )}+ >+ <Heart className={cn("h-3.5 w-3.5", favorite && "fill-current")} />+ </button>+ );+}+/*** One grid tile.** The image is the 480 px thumbnail and it is lazy: five hundred tiles must* cost only what is actually scrolled past. The full-size file is not touched* here at all — that download belongs to the preview.+ *+ * The frame is a plain element rather than the button it used to be: the heart+ * is a second, independent action on the same tile, and a button inside a+ * button is invalid markup that browsers resolve however they like.*/function WallpaperTile({item,active,+ favorite,onOpen,+ onToggleFavorite,}: {item: WallpaperEntry;active: boolean;+ favorite: boolean;onOpen: () => void;+ onToggleFavorite: () => void;}) {return (- <button- type="button"- onClick={onOpen}- title={`${item.title} — ${item.styleLabel}`}+ <divclassName={cn(- "group relative overflow-hidden rounded-lg border text-left transition-all",- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",+ "group relative overflow-hidden rounded-lg border transition-all",active? "border-primary ring-2 ring-primary/60": "border-border hover:border-primary/50",)}>- <img- src={thumbUrlFor(item)}- alt={item.title}- // The pinned original is the first thing on screen and the shell has- // already loaded it, so waiting for an intersection buys nothing.- loading={item.isDefault ? "eager" : "lazy"}- decoding="async"- width={480}- height={270}- className="aspect-video w-full bg-secondary/40 object-cover transition-transform duration-300 group-hover:scale-[1.03]"- />- <span className="pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/75 to-transparent px-2.5 pb-1.5 pt-6">- <span className="block truncate text-[11px] font-medium text-white">- {item.title}- </span>- <span className="block truncate text-[10px] text-white/65">- {item.styleLabel}+ <button+ type="button"+ onClick={onOpen}+ title={`${item.title} — ${item.styleLabel}`}+ className="block w-full text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary"+ >+ <img+ src={thumbUrlFor(item)}+ alt={item.title}+ // The pinned original is the first thing on screen and the shell has+ // already loaded it, so waiting for an intersection buys nothing.+ loading={item.isDefault ? "eager" : "lazy"}+ decoding="async"+ width={480}+ height={270}+ className="aspect-video w-full bg-secondary/40 object-cover transition-transform duration-300 group-hover:scale-[1.03]"+ />+ <span className="pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/75 to-transparent px-2.5 pb-1.5 pt-6">+ <span className="block truncate text-[11px] font-medium text-white">+ {item.title}+ </span>+ <span className="block truncate text-[10px] text-white/65">+ {item.styleLabel}+ </span></span>- </span>+ </button>+ <FavoriteButton+ item={item}+ favorite={favorite}+ onToggle={onToggleFavorite}+ className={cn(+ "absolute left-2 top-2",+ !favorite &&+ "opacity-0 group-hover:opacity-100 focus-visible:opacity-100",+ )}+ />{active && (- <span className="absolute right-2 top-2 flex h-6 w-6 items-center justify-center rounded-full bg-primary text-primary-foreground shadow">+ <span className="pointer-events-none absolute right-2 top-2 flex h-6 w-6 items-center justify-center rounded-full bg-primary text-primary-foreground shadow"><Check className="h-3.5 w-3.5" /></span>)}- </button>+ </div>);}@@ -143,13 +220,17 @@ function WallpaperTile({function WallpaperPreview({item,applied,+ favorite,onApply,+ onToggleFavorite,onClose,onStep,}: {item: WallpaperEntry;applied: boolean;+ favorite: boolean;onApply: () => void;+ onToggleFavorite: () => void;onClose: () => void;onStep: (delta: number) => void;}) {@@ -184,6 +265,12 @@ function WallpaperPreview({{item.styleLabel} · {item.theme === "dark" ? "Dark" : "Light"}</p></div>+ <FavoriteButton+ item={item}+ favorite={favorite}+ onToggle={onToggleFavorite}+ tone="surface"+ /><Buttonsize="sm"variant={applied ? "secondary" : "default"}@@ -254,22 +341,37 @@ export function WallpaperView() {// so the check mark always lands on what is actually on screen).const activeTheme = useThemeValue();const selectedId = useWallpaperStore((state) => state.selections[activeTheme]);+ const favorites = useWallpaperStore((state) => state.favorites);+ const toggleFavorite = useWallpaperStore((state) => state.toggleFavorite);const apply = useApplyWallpaper();const [theme, setTheme] = useState<ThemeFilter>("all");const [ordering, setOrdering] = useState<Ordering>("mixed");const [style, setStyle] = useState<string | null>(null);+ const [favoritesOnly, setFavoritesOnly] = useState(false);const [previewId, setPreviewId] = useState<string | null>(null);const items = data?.items ?? [];const styles = data?.styles ?? [];+ const favoriteIds = useMemo(() => new Set(favorites), [favorites]);+ // Counted against the catalog, not against the stored list: an id left over+ // from a library that is no longer installed must not inflate the badge.+ const favoriteCount = useMemo(+ () => items.filter((item) => favoriteIds.has(item.id)).length,+ [favoriteIds, items],+ );+const visible = useMemo(() => {const filtered = items.filter((item) =>(theme === "all" || item.theme === theme) &&- (style === null || item.style === style),+ (style === null || item.style === style) &&+ (!favoritesOnly || favoriteIds.has(item.id)),);+ // Favourites deliberately do NOT float to the top of the mixed grid: a+ // tile that jumps away the instant its heart is clicked loses the place+ // the reader was looking at. The Favorites filter is where they gather.return filtered.sort((left, right) => {// The bundled original outranks every ordering and every shuffle: it is// the first wallpaper this app ever had, and it stays the first tile.@@ -281,7 +383,7 @@ export function WallpaperView() {}return shuffleRank(left.id) - shuffleRank(right.id);});- }, [items, ordering, style, theme]);+ }, [favoriteIds, favoritesOnly, items, ordering, style, theme]);// "No choice stored" and "the original is chosen" are the same state, so the// pinned tile carries the check mark on a fresh profile.@@ -291,13 +393,25 @@ export function WallpaperView() {const previewIndex = previewId? visible.findIndex((item) => item.id === previewId): -1;- const previewItem = previewIndex >= 0 ? visible[previewIndex] : null;+ // Resolved against the whole catalog when the filter no longer contains it:+ // un-hearting a wallpaper while its preview is open under the Favorites+ // filter must not yank the picture out from under the reader.+ const previewItem =+ previewIndex >= 0+ ? visible[previewIndex]+ : (items.find((item) => item.id === previewId) ?? null);// Stepping wraps around, so the arrow keys never dead-end at either edge of// whatever the current filter happens to be showing.const step = useCallback((delta: number) => {- if (previewIndex < 0 || visible.length === 0) return;+ if (visible.length === 0) return;+ // A preview that has dropped out of the filter steps back into it rather+ // than dead-ending: the next arrow press resumes at the nearest edge.+ if (previewIndex < 0) {+ setPreviewId(visible[delta < 0 ? visible.length - 1 : 0].id);+ return;+ }const next = (previewIndex + delta + visible.length) % visible.length;setPreviewId(visible[next].id);},@@ -381,6 +495,23 @@ export function WallpaperView() {</SegmentButton></div>+ <div className="flex items-center gap-1 rounded-lg border border-border p-0.5">+ <SegmentButton+ active={favoritesOnly}+ onClick={() => setFavoritesOnly((on) => !on)}+ >+ <Heart+ className={cn("h-3 w-3", favoritesOnly && "fill-current")}+ />+ Favorites+ {favoriteCount > 0 && (+ <span className="text-[10px] tabular-nums opacity-70">+ {favoriteCount}+ </span>+ )}+ </SegmentButton>+ </div>+<span className="ml-auto text-xs text-muted-foreground">{visible.length} shown</span>@@ -411,13 +542,17 @@ export function WallpaperView() {key={item.id}item={item}active={isApplied(item)}+ favorite={favoriteIds.has(item.id)}onOpen={() => setPreviewId(item.id)}+ onToggleFavorite={() => toggleFavorite(item.id)}/>))}</div>{visible.length === 0 && (<p className="px-6 pb-6 text-xs text-muted-foreground">- No wallpaper matches this filter.+ {favoritesOnly && favoriteCount === 0+ ? "No favorites yet — click the heart on a wallpaper to keep it here."+ : "No wallpaper matches this filter."}</p>)}</ScrollArea>@@ -426,7 +561,9 @@ export function WallpaperView() {<WallpaperPreviewitem={previewItem}applied={isApplied(previewItem)}+ favorite={favoriteIds.has(previewItem.id)}onApply={() => apply(previewItem)}+ onToggleFavorite={() => toggleFavorite(previewItem.id)}onClose={() => setPreviewId(null)}onStep={step}/>