Skip to content

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.

build(deck): drop the rest strip's orphans and ship the bundle the board loads

Harald83fb3ffcac8e
diff --git a/jarvis/ui/web/frontend/src/components/deck/DeckRestStrip.tsx b/jarvis/ui/web/frontend/src/components/deck/DeckRestStrip.tsx
deleted file mode 100644
index 65f23ab2bb..0000000000
--- a/jarvis/ui/web/frontend/src/components/deck/DeckRestStrip.tsx
+++ /dev/null
@@ -1,268 +0,0 @@
-import { useEffect, useMemo, useState } from "react";
-import { useQuery } from "@tanstack/react-query";
-import { Camera, ChevronUp, FolderOpen, Gauge, MessagesSquare, Terminal, type LucideIcon } from "lucide-react";
-import { useEventStore, type SectionId } from "@/store/events";
-import { useDeckStore } from "@/store/deck";
-import { useCommandActivityStore } from "@/store/commandActivity";
-import { useRuns } from "@/hooks/useRuns";
-import { useOutputsList } from "@/hooks/useOutputs";
-import type { IdeState } from "@/lib/agenticIdeApi";
-import { boardAtRest } from "@/lib/deckRest";
-import { CAPTURE_AFTERGLOW_MS } from "@/components/deck/DeckSignalCards";
-import { HudFrameOverlay, useElementSize } from "@/components/deck/HudFrame";
-import { cn } from "@/lib/utils";
-import { useT } from "@/i18n";
-
-const fetchIdeState = async (): Promise<IdeState> =>
- (await import("@/lib/agenticIdeApi")).fetchIdeState();
-
-/**
- * The board's bottom row when nothing is happening — five instruments at
- * rest, on one strip.
- *
- * The rule that picks this form over the row of cards lives in
- * `lib/deckRest.ts`; this is what it looks like. Each segment prints the same
- * three things: what the instrument is, the FIGURE that says how big it is
- * (runs ever recorded, outputs on disk, panes in the workspace) and one dim
- * line of context — the last time it did something, the project it is
- * pointed at. A gauge reading zero still shows its dial; "No outputs yet."
- * showed neither dial nor needle and took a card-sized hole to do it.
- *
- * Every segment is the same jump into its section that the card's title was,
- * so nothing becomes unreachable by collapsing — and the chevron at the end
- * brings the full row straight back.
- *
- * Colours are theme tokens only: this reads the same on the light stage.
- */
-
-interface RestSegment {
- key: string;
- icon: LucideIcon;
- label: string;
- /** How big this instrument is — a count, or an em dash when there is none. */
- value: string;
- /** One dim line of context under the figure. */
- note: string;
- section?: SectionId;
-}
-
-function fmtClock(ms: number | null | undefined): string {
- if (!ms) return "";
- return new Date(ms).toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit" });
-}
-
-/** Output timestamps come from the backend in seconds. */
-function outputClock(seconds: number | null | undefined): string {
- return seconds ? fmtClock(seconds * 1000) : "";
-}
-
-const DASH = "—";
-
-/**
- * Reads the five instruments once, for both questions the board asks: is it
- * at rest, and what do the segments say. The queries are the very ones the
- * cards use, by the same keys, so this costs no extra request.
- */
-export function useDeckRest(enabled = true): { atRest: boolean; segments: RestSegment[] } {
- const t = useT();
- const outputs = useOutputsList();
- const runs = useRuns();
- const captures = useDeckStore((s) => s.captures);
- const capture = useDeckStore((s) => s.capture);
- const termLines = useDeckStore((s) => s.termLines);
- const shell = useCommandActivityStore((s) => s.entries);
- // Off until the board is actually up: nothing heavy — and nothing polling
- // every five seconds — belongs on the boot's critical path, and this is the
- // one request the cards were not already going to make.
- const ide = useQuery<IdeState>({
- queryKey: ["deck", "ide-state"],
- queryFn: fetchIdeState,
- refetchInterval: 5_000,
- retry: false,
- enabled,
- });
-
- const outputRows = outputs.data ?? [];
- const runRows = runs.data ?? [];
- const panes = ide.data?.session?.terminals ?? [];
- const shellRunning = shell.filter((e) => e.status === "running").length;
-
- // The capture card shows a picture only inside its afterglow; past that it
- // is a ledger, and a ledger is history like any other. Nothing re-renders
- // when an afterglow simply runs out, so the deadline gets its own wake-up:
- // one timeout per capture, and the row settles the moment the picture goes.
- const captureTs = capture?.ts ?? 0;
- const [afterglowOver, setAfterglowOver] = useState(false);
- useEffect(() => {
- if (!captureTs) return;
- const left = captureTs + CAPTURE_AFTERGLOW_MS - Date.now();
- if (left <= 0) {
- setAfterglowOver(true);
- return;
- }
- setAfterglowOver(false);
- const id = window.setTimeout(() => setAfterglowOver(true), left);
- return () => window.clearTimeout(id);
- }, [captureTs]);
- const captureShowing = captureTs > 0 && !afterglowOver;
-
- const atRest = boardAtRest({
- runningOutputs: outputRows.filter((o) => o.status === "running").length,
- liveRuns: runRows.filter((r) => r.ended_ms === null).length,
- shellRunning,
- termLines: termLines.length,
- idePanes: panes.length,
- captureShowing,
- });
-
- const outputData = outputs.data;
- const runData = runs.data;
- const wsData = ide.data?.workspaces;
- const shellCount = shell.length;
- const segments = useMemo<RestSegment[]>(() => {
- const outs = outputData ?? [];
- const rns = runData ?? [];
- const wss = wsData ?? [];
- const lastOutput = outs[0];
- const lastRun = rns[0];
- const activeWs = wss.find((w) => w.active) ?? wss[0];
- const lastAt = (clock: string) => t("deck.rest_last").replace("{0}", clock);
- return [
- {
- key: "outputs",
- icon: FolderOpen,
- label: t("deck.card_outputs"),
- value: outputData ? String(outs.length) : DASH,
- note: lastOutput
- ? [
- outputClock(lastOutput.completed_at ?? lastOutput.started_at),
- lastOutput.utterance || lastOutput.summary || lastOutput.slug,
- ]
- .filter(Boolean)
- .join(" · ")
- : t("deck.rest_none_yet"),
- section: "outputs",
- },
- {
- key: "runs",
- icon: Gauge,
- label: t("deck.card_runs"),
- value: runData ? String(rns.length) : DASH,
- note: lastRun ? lastAt(fmtClock(lastRun.started_ms)) : t("deck.rest_none_yet"),
- section: "run_inspector",
- },
- {
- key: "capture",
- icon: Camera,
- label: t("deck.card_shot"),
- value: captures.length > 0 ? String(captures.length) : DASH,
- note: captures[0] ? lastAt(fmtClock(captures[0].ts)) : t("deck.rest_none_yet"),
- },
- {
- key: "terminals",
- icon: Terminal,
- label: t("deck.card_terminals"),
- value: String(shellCount),
- note: t("deck.rest_idle"),
- section: "clis",
- },
- {
- key: "workspace",
- icon: MessagesSquare,
- label: t("deck.card_ide"),
- value: wss.length > 0 ? String(wss.length) : DASH,
- note: activeWs
- ? [activeWs.name, activeWs.branch ? `⎇ ${activeWs.branch}` : ""].filter(Boolean).join(" ")
- : t("deck.rest_no_workspace"),
- section: "agentic-ide",
- },
- ];
- }, [t, outputData, runData, wsData, captures, shellCount]);
-
- return { atRest, segments };
-}
-
-export function DeckRestStrip({
- segments,
- onExpand,
- className,
-}: {
- segments: RestSegment[];
- /** Bring the full row of cards back. */
- onExpand: () => void;
- className?: string;
-}) {
- const t = useT();
- const setActiveSection = useEventStore((s) => s.setActiveSection);
- const [ref, size] = useElementSize<HTMLElement>();
-
- return (
- <section ref={ref} className={cn("group/card relative flex items-stretch", className)}>
- {/* Chamfer: the deck's frame for a READOUT (HudFrame.tsx). The strip is
- five readings on one plate, not a stream and not a picture. */}
- <HudFrameOverlay variant="chamfer" w={size.w} h={size.h} />
-
- {/* Five across on the deck's own width; two or three up when the stage
- is narrow, so a reading is never squeezed to its first digit. */}
- <div className="relative grid min-w-0 flex-1 grid-cols-2 items-stretch sm:grid-cols-3 lg:grid-cols-5">
- {segments.map((seg) => {
- const Icon = seg.icon;
- const section = seg.section;
- // No status lamp here on purpose: five unlit dots in a row are
- // clutter, and "at rest" is the whole premise of the strip. The
- // icon carries which instrument this is.
- const body = (
- <>
- <Icon className="h-3 w-3 shrink-0 text-muted-foreground transition-colors group-hover/seg:text-primary" />
- <span className="flex min-w-0 flex-col gap-0.5 leading-none">
- <span className="truncate font-mono text-[9px] uppercase tracking-[0.2em] text-foreground/70 transition-colors group-hover/seg:text-primary">
- {seg.label}
- </span>
- <span className="flex min-w-0 items-baseline gap-1.5">
- <span className="shrink-0 font-mono text-[15px] tabular-nums leading-none text-foreground">
- {seg.value}
- </span>
- <span className="min-w-0 truncate font-mono text-[9.5px] text-muted-foreground">{seg.note}</span>
- </span>
- </span>
- </>
- );
- const shared =
- "group/seg flex min-w-0 items-center gap-1.5 border-l border-border/50 px-3 py-1.5 text-left first:border-l-0";
- return section ? (
- <button
- key={seg.key}
- type="button"
- onClick={() => setActiveSection(section)}
- title={t("deck.open_section")}
- className={cn(
- shared,
- "transition-colors hover:bg-primary/5",
- "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/60",
- )}
- >
- {body}
- </button>
- ) : (
- <div key={seg.key} className={shared}>
- {body}
- </div>
- );
- })}
- </div>
-
- <button
- type="button"
- onClick={onExpand}
- title={t("deck.rest_expand")}
- aria-label={t("deck.rest_expand")}
- className={cn(
- "relative flex w-8 shrink-0 items-center justify-center border-l border-border/50 text-muted-foreground",
- "transition-colors hover:text-primary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary/60",
- )}
- >
- <ChevronUp className="h-3.5 w-3.5" />
- </button>
- </section>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/lib/deckRest.test.ts b/jarvis/ui/web/frontend/src/lib/deckRest.test.ts
deleted file mode 100644
index 1720395559..0000000000
--- a/jarvis/ui/web/frontend/src/lib/deckRest.test.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { describe, expect, it } from "vitest";
-import { boardAtRest, type RestInputs } from "@/lib/deckRest";
-
-const QUIET: RestInputs = {
- runningOutputs: 0,
- liveRuns: 0,
- shellRunning: 0,
- termLines: 0,
- idePanes: 0,
- captureShowing: false,
-};
-
-describe("boardAtRest", () => {
- it("is at rest on a machine that was simply switched on", () => {
- expect(boardAtRest(QUIET)).toBe(true);
- });
-
- it("stays at rest with a full history behind it", () => {
- // The screen this was written for: 84 finished runs, a hundred old
- // outputs, nothing running. History is scale, not activity — the strip
- // prints those figures, so collapsing the row hides nothing.
- expect(boardAtRest({ ...QUIET, runningOutputs: 0, liveRuns: 0 })).toBe(true);
- });
-
- it.each<[keyof RestInputs, RestInputs[keyof RestInputs]]>([
- ["runningOutputs", 1],
- ["liveRuns", 1],
- ["shellRunning", 1],
- ["termLines", 1],
- ["idePanes", 1],
- ["captureShowing", true],
- ])("leaves rest as soon as %s says something is live", (key, value) => {
- expect(boardAtRest({ ...QUIET, [key]: value })).toBe(false);
- });
-});
diff --git a/jarvis/ui/web/frontend/src/lib/deckRest.ts b/jarvis/ui/web/frontend/src/lib/deckRest.ts
deleted file mode 100644
index 1a1291b7a9..0000000000
--- a/jarvis/ui/web/frontend/src/lib/deckRest.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * When the board is AT REST — and what that changes.
- *
- * The board's bottom row holds five operational instruments: outputs, runs,
- * the last capture, the terminals and the coding workspace. On a machine
- * that is simply switched on, four of them say "nothing yet" and the fifth
- * lists runs from yesterday. The maintainer's verdict on that screen
- * (2026-08-21): boring — a third of the stage spent on five boxes that
- * apologise for being empty.
- *
- * So the row has two forms. When something is genuinely HAPPENING it is the
- * row of cards it always was. When nothing is, it collapses to one strip of
- * readouts (`DeckRestStrip`) and gives its height to the log, the orb and
- * the wiki. The rule behind that switch is here, on its own, so it can be
- * read and tested without a DOM:
- *
- * at rest ⇔ nothing is running, streaming or on screen RIGHT NOW
- *
- * HISTORY IS NOT ACTIVITY. Eighty-four finished runs and a hundred old
- * outputs are the instrument's SCALE, not its needle — the strip prints
- * those figures, so nothing is hidden by collapsing. What keeps the cards
- * open is only ever live: a mission still running, a run with no end, a
- * shell command in flight, terminal output this session, an IDE pane, a
- * capture inside its afterglow.
- *
- * The person can always override it: the strip has an expand control that
- * brings the full row back (`MissionDeckView`).
- */
-export interface RestInputs {
- /** Missions still running — a finished one is history. */
- runningOutputs: number;
- /** Runs with no end timestamp. */
- liveRuns: number;
- /** Shell commands the brain has in flight. */
- shellRunning: number;
- /** Terminal lines this session — the card has a stream to show. */
- termLines: number;
- /** Panes in the agentic IDE, running or idle: a workspace IS open. */
- idePanes: number;
- /** A capture is on screen inside its afterglow. */
- captureShowing: boolean;
-}
-
-/**
- * True when none of the five instruments has anything live to show.
- *
- * Deliberately NOT "every card is empty": the runs card is never empty on a
- * used install, so an emptiness test would leave the row expanded forever on
- * exactly the screen this was written for.
- */
-export function boardAtRest(i: RestInputs): boolean {
- return (
- i.runningOutputs === 0 &&
- i.liveRuns === 0 &&
- i.shellRunning === 0 &&
- i.termLines === 0 &&
- i.idePanes === 0 &&
- !i.captureShowing
- );
-}
diff --git a/jarvis/ui/web/frontend/src/views/MissionDeckView.rest.test.tsx b/jarvis/ui/web/frontend/src/views/MissionDeckView.rest.test.tsx
deleted file mode 100644
index 06e53544c0..0000000000
--- a/jarvis/ui/web/frontend/src/views/MissionDeckView.rest.test.tsx
+++ /dev/null
@@ -1,152 +0,0 @@
-import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
-import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
-
-/**
- * The board's bottom row has two forms (`lib/deckRest.ts`, `DeckRestStrip`):
- * five cards while something is happening, one strip of readouts when nothing
- * is. This file is about the SWITCH between them — that the strip really
- * takes the three bottom slots' place, that the row above gets the height,
- * and that the chevron brings the cards back.
- *
- * The rule itself is unit-tested in `lib/deckRest.test.ts`; here it is stubbed
- * so a test can put the board in either state without a backend.
- */
-const rest = vi.hoisted(() => ({ atRest: true }));
-vi.mock("@/components/deck/DeckRestStrip", () => ({
- useDeckRest: () => ({ atRest: rest.atRest, segments: [] }),
- DeckRestStrip: ({ onExpand }: { onExpand: () => void }) => (
- <section data-testid="rest-strip">
- <button type="button" data-testid="rest-expand" onClick={onExpand}>
- expand
- </button>
- </section>
- ),
-}));
-
-vi.mock("@/components/layout/DockRail", () => ({ DockRail: () => <nav data-testid="dock" /> }));
-vi.mock("@/components/deck/DeckWiki", () => ({
- WikiCard: ({ className }: { className?: string }) => <section className={className}>wiki</section>,
- warmWikiScene: () => {},
-}));
-vi.mock("@/components/deck/DeckActivityCards", () => ({
- IdeGridCard: () => <section>ide</section>,
- OutputsCard: () => <section>outputs</section>,
- RunsCard: () => <section>runs</section>,
- TerminalsCard: () => <section>terminals</section>,
-}));
-vi.mock("@/components/deck/DeckSignalCards", () => ({
- ApiStatsCard: () => <section>api</section>,
- CaptureCard: () => <section>capture</section>,
- LiveCounter: () => <div>counter</div>,
-}));
-vi.mock("@/components/deck/DeckTurnCard", () => ({ TurnCard: () => <section>turn</section> }));
-vi.mock("@/components/deck/DeckLogCard", async () => {
- const actual = await vi.importActual<typeof import("@/components/deck/DeckLogCard")>(
- "@/components/deck/DeckLogCard",
- );
- return { ...actual, LogCard: () => <section>log</section> };
-});
-vi.mock("@/hooks/useWakeWord", () => ({
- useWakeWord: () => ({
- config: {
- phrase: "Hey Nova",
- engine: "openwakeword",
- custom_model_path: "",
- fuzzy_match_ratio: 0.8,
- language: "auto",
- engines: ["openwakeword"],
- instant_phrases: [],
- local_whisper_available: false,
- enabled: true,
- },
- loading: false,
- error: null,
- refetch: async () => {},
- saveWakeWord: async () => ({}),
- setWakeLanguage: async () => {},
- setWakeActivation: async () => ({}),
- }),
-}));
-vi.mock("@/lib/voiceApi", () => ({
- requestVoiceCall: async () => ({ armed: true }),
- requestVoiceHangup: async () => {},
-}));
-vi.mock("@/components/MascotGigi", () => ({
- MascotGigi: () => <div data-testid="mascot-gigi" />,
-}));
-vi.mock("@/components/layout/TopBar", () => ({
- TopBarActions: () => null,
-}));
-vi.mock("@/components/layout/CodingModeBadge", () => ({
- CodingModeBadge: () => null,
-}));
-vi.mock("@/hooks/useVoiceEngineDisplay", () => ({
- useVoiceEngineDisplay: () => ({
- tier: "pipeline",
- providerId: "openrouter",
- providerLabel: "OpenRouter",
- model: "",
- }),
-}));
-
-import { MissionDeckView } from "@/views/MissionDeckView";
-import { useDeckStore } from "@/store/deck";
-import { useEventStore } from "@/store/events";
-
-/** The board straight away — this file is not about the boot sequence. */
-function onTheBoard() {
- useEventStore.setState({
- connected: true,
- voiceReady: true,
- wsWarming: false,
- voiceState: "idle",
- brainProvider: "openrouter",
- brainModel: "",
- assistantName: "Nova",
- messages: [],
- thinkingSteps: [],
- chatThinking: false,
- activeSection: "chats",
- });
- useDeckStore.getState().openBoard();
-}
-
-const BOTTOM_SLOTS = ["deck-slot-left-bottom", "deck-slot-right-bottom"];
-
-describe("MissionDeckView — the bottom row at rest", { timeout: 15_000 }, () => {
- beforeEach(() => {
- useDeckStore.getState().resetDeck();
- onTheBoard();
- rest.atRest = true;
- });
- afterEach(() => cleanup());
-
- test("at rest the strip takes the whole bottom row, and the cards stand down", async () => {
- render(<MissionDeckView />);
- const board = await screen.findByTestId("deck-board");
- expect(screen.getByTestId("rest-strip")).toBeTruthy();
- for (const slot of BOTTOM_SLOTS) expect(screen.queryByTestId(slot)).toBeNull();
- // The strip's slot spans the board's three columns…
- expect(screen.getByTestId("deck-slot-centre-bottom").className).toContain("lg:col-span-3");
- // …and the row it sits in only takes the height it needs, so the log,
- // the orb and the wiki grow into what it gave up.
- expect(board.className).toContain("lg:grid-rows-[minmax(0,1fr)_auto]");
- });
-
- test("something happening brings the five cards back", async () => {
- rest.atRest = false;
- render(<MissionDeckView />);
- const board = await screen.findByTestId("deck-board");
- expect(screen.queryByTestId("rest-strip")).toBeNull();
- for (const slot of BOTTOM_SLOTS) expect(screen.getByTestId(slot)).toBeTruthy();
- expect(board.className).toContain("lg:grid-rows-[minmax(0,1fr)_minmax(0,0.6fr)]");
- });
-
- test("the chevron opens the full row while the board stays quiet", async () => {
- render(<MissionDeckView />);
- await screen.findByTestId("deck-board");
- fireEvent.click(screen.getByTestId("rest-expand"));
- await waitFor(() => expect(screen.getByTestId("deck-slot-left-bottom")).toBeTruthy());
- expect(screen.queryByTestId("rest-strip")).toBeNull();
- });
-});