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.

feat(office): Mission Control's desk monitors run Spend, Agents and the Agentic IDE live

rubenluetke10-beepfa52180461da
diff --git a/jarvis/ui/web/frontend/src/components/society/office/CommandOffice.tsx b/jarvis/ui/web/frontend/src/components/society/office/CommandOffice.tsx
index 929705bd90..d986321ccf 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/CommandOffice.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/CommandOffice.tsx
@@ -1,20 +1,21 @@
/**
* Mission Control, the coding floor's own office: a walnut slat wall with a
* live video wall, and a desk with three live monitors and an executive chair.
- * Working it (E in the room, or a click on any of its screens) opens the
- * Mission Control panel: start new coding agents, brief several at once.
+ * Working it (E in the room, or a click on the video wall or the desk) opens
+ * the Mission Control panel: start new coding agents, brief several at once.
*
- * Every screen is a live board of the floor, drawn from the same shared pane
- * poll the figures ride: the video wall shows each agent as a tile; the desk
- * shows the workspaces (left), the floor's counts and a "New agent" button
- * (centre) and the latest prompts (right).
+ * The video wall is a live board of the floor, drawn from the same shared pane
+ * poll the figures ride: each agent as a tile. The desk's three monitors run
+ * real app sections live (MissionScreens): Spend (left), the Agents view
+ * (centre) and the Agentic IDE (right). A click on one dives the camera into
+ * its glass and opens that section; from afar each shows a quiet title card.
*
* Pieces are built in local space centred on the origin, front facing +z, and
* stay inside their FURNITURE_SIZE box.
*/
-import { useEffect, useMemo, useRef, useState } from "react";
-import type { ThreeEvent } from "@react-three/fiber";
-import { CanvasTexture, CylinderGeometry, MeshBasicMaterial, MeshStandardMaterial, SRGBColorSpace } from "three";
+import { useEffect, useMemo, useRef, useState, type RefObject } from "react";
+import { useFrame, type ThreeEvent } from "@react-three/fiber";
+import { CanvasTexture, CylinderGeometry, MeshBasicMaterial, MeshStandardMaterial, Quaternion, SRGBColorSpace, Vector3, type Group } from "three";
import { useT } from "@/i18n";
import { useWorkspacePanesStore } from "@/store/workspacePanes";
import type { AgentRunState } from "../data";
@@ -22,7 +23,8 @@ import { Box, MAT, matte, Rounded } from "./OfficeFurniture";
import { paneOccupants } from "./codingFloor";
import { TaskChair } from "./OfficeChairs";
import { COMMAND_DESK, COMMAND_DESK_OFFSET, type Furniture, type FurnitureKind } from "./officeLayout";
-import { useOfficeStore } from "./officeStore";
+import { MissionLiveScreen } from "./MissionScreens";
+import { useOfficeStore, type MonitorSection } from "./officeStore";
// ---------------------------------------------------------------------------
// Live data
@@ -71,7 +73,9 @@ function useFloorData(): FloorData {
/** Everything the screens say, in the viewer's language. */
export interface ScreenLabels {
- title: string; agents: string; start: string; workspaces: string; activity: string; none: string;
+ title: string; agents: string; none: string;
+ /** The desk monitors' sections, named as the navigation names them. */
+ costs: string; agentsView: string; ide: string;
working: string; waiting: string; idle: string;
state: (key: string) => string;
since: (at: number | null) => string;
@@ -82,9 +86,9 @@ function useScreenLabels(): ScreenLabels {
return {
title: t("society.office.cp_mission"),
agents: t("society.office.mission_screen_agents"),
- start: t("society.office.mission_screen_start"),
- workspaces: t("society.office.mission_screen_workspaces"),
- activity: t("society.office.mission_screen_activity"),
+ costs: t("nav.costs"),
+ agentsView: t("nav.agents"),
+ ide: t("nav.agentic_ide"),
none: t("society.office.mission_screen_none"),
working: t("society.office.state_working"),
waiting: t("society.office.state_waiting"),
@@ -105,7 +109,7 @@ function useScreenLabels(): ScreenLabels {
// Drawing: one quiet dark UI, white type, colour only for state.
// ---------------------------------------------------------------------------
-const INK = "#f4f6f8", MUTED = "#8b929c", FAINT = "rgba(255,255,255,0.07)";
+const INK = "#f4f6f8", MUTED = "#8b929c";
const FONT = "Inter, system-ui, -apple-system, 'Segoe UI', sans-serif";
const STATE: Record<AgentRunState, string> = { working: "#4ade80", waiting: "#fbbf24", idle: "#8b929c", paused: "#8b929c" };
@@ -143,99 +147,14 @@ function heading(ctx: Ctx, text: string, x: number, y: number): void {
ctx.fillText(text, x, y);
}
-/** Centre monitor: the one big number, three state rows and the "New agent" button. */
-export function drawBoard(ctx: Ctx, w: number, h: number, data: FloorData, l: ScreenLabels): void {
- ground(ctx, w, h);
- const pad = 56, { counts } = data;
- heading(ctx, l.title, pad, pad + 26);
- dot(ctx, w - pad - 8, pad + 16, 8, STATE.working);
- ctx.fillStyle = INK;
- ctx.font = `700 200px ${FONT}`;
- ctx.fillText(String(counts.total), pad - 8, pad + 250);
- ctx.fillStyle = MUTED;
- ctx.font = `500 30px ${FONT}`;
- ctx.fillText(fit(ctx, l.agents, w * 0.5 - pad), pad, pad + 298);
- const x0 = w * 0.55;
- ([[l.working, counts.working, STATE.working], [l.waiting, counts.waiting, STATE.waiting], [l.idle, counts.idle, STATE.idle]] as const)
- .forEach(([label, n, colour], i) => {
- const y = pad + 90 + i * 78;
- ctx.fillStyle = FAINT;
- ctx.fillRect(x0, y - 50, w - pad - x0, 2);
- dot(ctx, x0 + 10, y - 12, 9, colour);
- ctx.fillStyle = INK;
- ctx.font = `500 32px ${FONT}`;
- ctx.fillText(fit(ctx, label, w - pad - x0 - 110), x0 + 36, y);
- ctx.textAlign = "right";
- ctx.font = `700 40px ${FONT}`;
- ctx.fillText(String(n), w - pad, y + 2);
- ctx.textAlign = "left";
- });
- const bw = 330, bh = 76, bx = pad, by = h - pad - bh;
- ctx.fillStyle = INK;
- ctx.beginPath(); ctx.roundRect(bx, by, bw, bh, 18); ctx.fill();
- ctx.strokeStyle = "#0b0d10";
- ctx.lineWidth = 5;
- ctx.lineCap = "round";
- const px = bx + 44, py = by + bh / 2;
- ctx.beginPath(); ctx.moveTo(px - 13, py); ctx.lineTo(px + 13, py); ctx.moveTo(px, py - 13); ctx.lineTo(px, py + 13); ctx.stroke();
- ctx.fillStyle = "#0b0d10";
- ctx.font = `600 32px ${FONT}`;
- ctx.fillText(fit(ctx, l.start, bw - 100), bx + 80, py + 11);
-}
-
-/** Left monitor: every workspace with how many of its agents work. */
-export function drawWorkspaces(ctx: Ctx, w: number, h: number, data: FloorData, l: ScreenLabels): void {
- ground(ctx, w, h);
- const pad = 56;
- heading(ctx, l.workspaces, pad, pad + 26);
- if (data.workspaces.length === 0) { ctx.fillStyle = MUTED; ctx.font = `500 32px ${FONT}`; ctx.fillText(l.none, pad, pad + 120); return; }
- const rows = data.workspaces.slice(0, 5), rowH = (h - pad * 2 - 60) / 5;
- rows.forEach((ws, i) => {
- const y = pad + 110 + i * rowH;
- ctx.fillStyle = INK;
- ctx.font = `600 34px ${FONT}`;
- ctx.fillText(fit(ctx, ws.name, w * 0.5), pad, y);
- ctx.textAlign = "right";
- ctx.fillStyle = MUTED;
- ctx.font = `500 30px ${FONT}`;
- ctx.fillText(`${ws.working} / ${ws.total}`, w - pad, y);
- ctx.textAlign = "left";
- const bx = pad, by = y + 18, bw = w - pad * 2;
- ctx.fillStyle = FAINT;
- ctx.beginPath(); ctx.roundRect(bx, by, bw, 10, 5); ctx.fill();
- if (ws.working > 0) {
- ctx.fillStyle = STATE.working;
- ctx.beginPath(); ctx.roundRect(bx, by, Math.max(10, (bw * ws.working) / ws.total), 10, 5); ctx.fill();
- }
- });
-}
-
-/** Right monitor: the latest prompts, newest first. */
-export function drawActivity(ctx: Ctx, w: number, h: number, data: FloorData, l: ScreenLabels): void {
+/** A desk monitor seen from afar: the section it runs, and one line of what it holds. */
+export function drawTitleCard(ctx: Ctx, w: number, h: number, title: string, detail: string): void {
ground(ctx, w, h);
const pad = 56;
- heading(ctx, l.activity, pad, pad + 26);
- const recent = data.agents.filter((a) => a.prompt).sort((a, b) => (b.promptAt ?? 0) - (a.promptAt ?? 0)).slice(0, 4);
- if (recent.length === 0) { ctx.fillStyle = MUTED; ctx.font = `500 32px ${FONT}`; ctx.fillText(l.none, pad, pad + 120); return; }
- const rowH = (h - pad * 2 - 50) / 4;
- recent.forEach((a, i) => {
- const y = pad + 100 + i * rowH;
- if (i > 0) { ctx.fillStyle = FAINT; ctx.fillRect(pad, y - 44, w - pad * 2, 2); }
- dot(ctx, pad + 8, y - 10, 8, STATE[a.state]);
- const age = l.since(a.promptAt);
- ctx.font = `500 26px ${FONT}`;
- const ageW = ctx.measureText(age).width;
- ctx.fillStyle = INK;
- ctx.font = `600 30px ${FONT}`;
- ctx.fillText(fit(ctx, a.name, w - pad * 2 - ageW - 60), pad + 30, y);
- ctx.textAlign = "right";
- ctx.fillStyle = MUTED;
- ctx.font = `500 26px ${FONT}`;
- ctx.fillText(age, w - pad, y);
- ctx.textAlign = "left";
- ctx.font = `400 26px ${FONT}`;
- ctx.fillText(fit(ctx, a.prompt.replace(/\s+/g, " "), w - pad * 2 - 30), pad + 30, y + 36);
- });
+ heading(ctx, detail, pad, pad + 26);
+ ctx.fillStyle = INK;
+ ctx.font = `700 96px ${FONT}`;
+ ctx.fillText(fit(ctx, title, w - pad * 2), pad, h - pad - 10);
}
/** The video wall: a header with the time, then one tile per agent on the floor. */
@@ -419,17 +338,75 @@ function ExecutiveChair() {
);
}
+/** Run the live sections within this camera distance of the desk, stop beyond the second (no flicker at the edge). */
+const LIVE_NEAR_M = 12;
+const LIVE_FAR_M = 15;
+
+/** Should the desk run its live sections, given the camera distance and whether it already does? Pure. */
+export function deskLive(distance: number, live: boolean): boolean {
+ return distance <= (live ? LIVE_FAR_M : LIVE_NEAR_M);
+}
+
+/** True while the camera is close enough to `anchor` to read the monitors. */
+function useNearCamera(anchor: RefObject<Group | null>): boolean {
+ const [near, setNear] = useState(false);
+ const nextCheck = useRef(0);
+ const at = useMemo(() => new Vector3(), []);
+ useFrame(({ camera, clock }) => {
+ if (!anchor.current || clock.elapsedTime < nextCheck.current) return;
+ nextCheck.current = clock.elapsedTime + 0.3;
+ anchor.current.getWorldPosition(at);
+ const next = deskLive(camera.position.distanceTo(at), near);
+ if (next !== near) setNear(next);
+ });
+ return near;
+}
+
+/** The glass sits this far in front of a monitor's centre (see Screen). */
+const GLASS_Z = 0.0145;
+
+/** A click on a desk monitor: dive into its glass, then open its section. */
+function useMonitorDive(section: MonitorSection) {
+ const hovered = useRef(false);
+ useEffect(() => () => { if (hovered.current) document.body.style.cursor = ""; }, []);
+ return {
+ onClick: (event: ThreeEvent<MouseEvent>) => {
+ if (event.delta > 6) return;
+ event.stopPropagation();
+ const monitor = event.eventObject;
+ const centre = monitor.getWorldPosition(new Vector3());
+ const normal = new Vector3(0, 0, 1).applyQuaternion(monitor.getWorldQuaternion(new Quaternion()));
+ const glass = centre.addScaledVector(normal, GLASS_Z);
+ useOfficeStore.getState().diveToSection(section, [glass.x, glass.y, glass.z], Math.atan2(normal.x, normal.z), [MONITOR.w, MONITOR.h]);
+ },
+ onPointerOver: (event: ThreeEvent<PointerEvent>) => { event.stopPropagation(); hovered.current = true; document.body.style.cursor = "zoom-in"; },
+ onPointerOut: (event: ThreeEvent<PointerEvent>) => { event.stopPropagation(); hovered.current = false; document.body.style.cursor = ""; },
+ };
+}
+
+function DeskMonitor({ section, title, detail, live, position, turn = 0 }: {
+ section: MonitorSection; title: string; detail: string; live: boolean; position: [number, number, number]; turn?: number;
+}) {
+ const card = useLiveScreen(MONITOR_CANVAS.w, MONITOR_CANVAS.h, `${title}|${detail}`, (ctx, w, h) => drawTitleCard(ctx, w, h, title, detail));
+ const dive = useMonitorDive(section);
+ return (
+ <group position={position} rotation={[0, turn, 0]} {...dive}>
+ <Screen w={MONITOR.w} h={MONITOR.h} material={card} />
+ {live && <MissionLiveScreen section={section} widthM={MONITOR.w} position={[0, 0, GLASS_Z + 0.002]} />}
+ </group>
+ );
+}
+
export function CommandDesk() {
const data = useFloorData();
const labels = useScreenLabels();
- const key = JSON.stringify([data, labels.title, labels.none]);
- const board = useLiveScreen(MONITOR_CANVAS.w, MONITOR_CANVAS.h, key, (ctx, w, h) => drawBoard(ctx, w, h, data, labels));
- const spaces = useLiveScreen(MONITOR_CANVAS.w, MONITOR_CANVAS.h, key, (ctx, w, h) => drawWorkspaces(ctx, w, h, data, labels));
- const activity = useLiveScreen(MONITOR_CANVAS.w, MONITOR_CANVAS.h, key, (ctx, w, h) => drawActivity(ctx, w, h, data, labels));
const open = useOpenMission();
+ const anchor = useRef<Group>(null);
+ const live = useNearCamera(anchor);
const { w, d } = COMMAND_DESK;
+ const agentCount = `${data.counts.total} ${labels.agents}`;
return (
- <group>
+ <group ref={anchor}>
<group {...open}>
{/* Oak top on black steel sled legs, a cable panel at the back and a thin light under the front edge. */}
<Rounded size={[w, 0.04, d]} radius={0.012} position={[0, 0.74, DESK_Z]} material={MAT.deskTop} />
@@ -444,15 +421,12 @@ export function CommandDesk() {
{/* One triple arm: a post at the back and a bar carrying the three monitors, the outer two turned in. */}
<Box size={[0.05, 0.38, 0.05]} position={[0, 0.94, DESK_Z - 0.32]} material={MAT.monitorArm} />
<Box size={[1.7, 0.035, 0.035]} position={[0, MONITOR.y - 0.02, DESK_Z - 0.3]} material={MAT.monitorArm} />
- <group position={[0, MONITOR.y, DESK_Z - 0.26]}>
- <Screen w={MONITOR.w} h={MONITOR.h} material={board} />
- </group>
- <group position={[-0.76, MONITOR.y, DESK_Z - 0.17]} rotation={[0, 0.38, 0]}>
- <Screen w={MONITOR.w} h={MONITOR.h} material={spaces} />
- </group>
- <group position={[0.76, MONITOR.y, DESK_Z - 0.17]} rotation={[0, -0.38, 0]}>
- <Screen w={MONITOR.w} h={MONITOR.h} material={activity} />
- </group>
+ <DeskMonitor section="agents" title={labels.agentsView} detail={labels.title} live={live}
+ position={[0, MONITOR.y, DESK_Z - 0.26]} />
+ <DeskMonitor section="costs" title={labels.costs} detail={labels.title} live={live}
+ position={[-0.76, MONITOR.y, DESK_Z - 0.17]} turn={0.38} />
+ <DeskMonitor section="agentic-ide" title={labels.ide} detail={agentCount} live={live}
+ position={[0.76, MONITOR.y, DESK_Z - 0.17]} turn={-0.38} />
{/* On the desk: keyboard, mouse, a mug. */}
<Rounded size={[0.46, 0.018, 0.15]} radius={0.006} position={[0, 0.769, DESK_Z + 0.18]} material={MAT.keyboard} />
<Rounded size={[0.06, 0.022, 0.1]} radius={0.01} position={[0.36, 0.771, DESK_Z + 0.18]} material={MAT.keyboard} />
diff --git a/jarvis/ui/web/frontend/src/components/society/office/MissionScreens.tsx b/jarvis/ui/web/frontend/src/components/society/office/MissionScreens.tsx
new file mode 100644
index 0000000000..871d4e2e0f
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/MissionScreens.tsx
@@ -0,0 +1,225 @@
+/**
+ * Mission Control's desk monitors run three REAL app sections, live, as they
+ * would run in the app: Spend (left), the Agents view (centre) and the Agentic
+ * IDE (right). Each is the section's own components laid out at a normal
+ * window size and drawn onto the screen plane with drei's <Html>.
+ *
+ * Display only: clicks fall through to the monitor underneath, which dives
+ * the camera into the glass and then opens that section.
+ *
+ * Two sections are reduced to what can run twice without side effects:
+ * - Agents: the real roster rail and one agent's real chat on its OWN chat
+ * store (never the lead's: its chat is the app's own voice chat, and a
+ * second panel on it would disconnect the app when the monitor unmounts).
+ * - Agentic IDE: the real terminals, read from the same read-only screen feed
+ * the desk monitors use. Mounting the real IDE would attach a second xterm
+ * to every PTY and resize the user's live terminals to monitor size.
+ */
+import { Suspense, lazy, useEffect, useMemo, useState, type CSSProperties, type ReactNode } from "react";
+import { Html } from "@react-three/drei";
+import { QueryClientProvider, useQueryClient } from "@tanstack/react-query";
+import { useT } from "@/i18n";
+import { useThemeValue } from "@/hooks/useTheme";
+import { createAgentChatStore } from "@/store/agentChat";
+import { useWorkspacePanesStore } from "@/store/workspacePanes";
+import { fetchPaneScreens, MAX_PANE_SCREENS, type PaneScreen } from "@/lib/paneScreensApi";
+import { PANE_BRAND, PANE_CHROME, PANE_SOLID, storedTerminalAppearance, themeFor } from "@/components/agentic/terminalThemes";
+import { AgentMark } from "@/components/agentic/AgentMark";
+import { RosterRail } from "@/components/society/roster/RosterRail";
+import { useSocietyRoster, type SocietyAgent } from "../data";
+import { useSocietyChatGroups } from "@/lib/societyChatGroups";
+import { paneLabel, paneOccupants, type PaneOccupant } from "./codingFloor";
+import { PaneScreenView } from "./PaneLiveScreen";
+import { screenChanged } from "./terminalScreen";
+import type { MonitorSection } from "./officeStore";
+import "./paneCommand.css";
+import "./missionScreens.css";
+
+const CostsView = lazy(() => import("@/views/CostsView").then((m) => ({ default: m.CostsView })));
+const AgentChatPanel = lazy(() => import("../chat/AgentChatPanel").then((m) => ({ default: m.AgentChatPanel })));
+
+/** The sections are laid out at this window size, then scaled onto the monitor. */
+export const MISSION_SCREEN_PX = { w: 1240, h: 723 } as const;
+
+/** One terminal poll for every tile at once, jittered (AP-33). */
+const POLL_MIN_MS = 900;
+const POLL_JITTER_MS = 300;
+/** The IDE monitor shows at most this many panes of the front workspace. */
+const MAX_TILES = 6;
+
+// ---------------------------------------------------------------------------
+// Agents
+// ---------------------------------------------------------------------------
+
+/** Whose chat the Agents monitor shows: a working agent first, never the lead. Pure. */
+export function pickShownAgent(agents: readonly SocietyAgent[]): SocietyAgent | null {
+ const chatty = agents.filter((a) => a.tier !== "lead" && a.chatSessionId);
+ return chatty.find((a) => a.state === "working") ?? chatty.find((a) => a.state === "waiting") ?? chatty[0] ?? null;
+}
+
+function AgentsScreen() {
+ const t = useT();
+ const roster = useSocietyRoster();
+ const agents = useMemo(() => roster.data?.agents ?? [], [roster.data]);
+ const sample = roster.data?.sample ?? true;
+ const groups = useSocietyChatGroups(!sample).data ?? [];
+ const shown = pickShownAgent(agents);
+ const shownId = shown?.agentId ?? null;
+ const store = useMemo(() => (shownId ? createAgentChatStore("society", `office-mission:${shownId}`) : null), [shownId]);
+ // Leaving the monitor closes its socket; the chat itself keeps running on the server.
+ useEffect(() => () => store?.getState().disconnect(), [store]);
+ return (
+ <div className="grid h-full min-h-0 grid-cols-[300px_minmax(0,1fr)] bg-card">
+ <RosterRail agents={agents} groups={groups} loading={roster.isLoading} sample={sample}
+ activeAgentId={shownId} onOpen={() => undefined} onCreate={() => undefined}
+ side="left" className="w-full border-0 jarvis-nav-surface" />
+ <section className="flex min-h-0 flex-col overflow-hidden rounded-tl-[12px] border-l border-border bg-background">
+ {shown && store ? (
+ <Suspense fallback={null}>
+ <AgentChatPanel key={shown.agentId} agent={shown} roster={agents} chatStore={store} />
+ </Suspense>
+ ) : (
+ <p className="m-auto text-sm text-muted-foreground">{t("society.office.mission_screen_none")}</p>
+ )}
+ </section>
+ </div>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Agentic IDE
+// ---------------------------------------------------------------------------
+
+/** The panes the IDE monitor shows: the front workspace's coding panes, in grid order. Pure. */
+export function idePanes(occupants: readonly PaneOccupant[]): { workspace: string; tiles: PaneOccupant[] } {
+ const front = occupants.find((o) => o.pane.workspace_active) ?? occupants[0];
+ if (!front) return { workspace: "", tiles: [] };
+ const tiles = occupants.filter((o) => o.pane.workspace_id === front.pane.workspace_id).slice(0, MAX_TILES);
+ return { workspace: front.pane.workspace_id, tiles };
+}
+
+/** Columns × rows for `n` tiles, the way the IDE grid splits a workspace. Pure. */
+export function ideGrid(n: number): { cols: number; rows: number } {
+ if (n <= 1) return { cols: 1, rows: 1 };
+ if (n === 2) return { cols: 2, rows: 1 };
+ if (n <= 4) return { cols: 2, rows: 2 };
+ return { cols: 3, rows: 2 };
+}
+
+function usePaneScreenBatch(panes: { workspaceId: string; key: string }[]): Map<string, PaneScreen> | null {
+ const [screens, setScreens] = useState<Map<string, PaneScreen> | null>(null);
+ const signature = panes.map((p) => `${p.workspaceId}:${p.key}`).join("|");
+ useEffect(() => {
+ const wanted = panes.slice(0, MAX_PANE_SCREENS);
+ let alive = true;
+ let failing = false;
+ let timer: ReturnType<typeof setTimeout>;
+ const tick = async () => {
+ try {
+ const next = await fetchPaneScreens(wanted);
+ if (!alive) return;
+ failing = false;
+ setScreens((prev) => {
+ const map = new Map(next.map((s) => [`${s.workspace_id}:${s.key}`, s]));
+ if (prev && map.size === prev.size && [...map].every(([k, s]) => !screenChanged(prev.get(k), s))) return prev;
+ return map;
+ });
+ } catch (err) {
+ // The last good screens stay up; only the first failure of a streak is worth a line.
+ if (!failing) console.warn("Mission Control: IDE screens unavailable", err);
+ failing = true;
+ }
+ if (alive) timer = setTimeout(() => void tick(), POLL_MIN_MS + Math.random() * POLL_JITTER_MS);
+ };
+ timer = setTimeout(() => void tick(), Math.random() * POLL_JITTER_MS);
+ return () => { alive = false; clearTimeout(timer); };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [signature]);
+ return screens;
+}
+
+function IdeScreen() {
+ const t = useT();
+ const panes = useWorkspacePanesStore((s) => s.panes);
+ const occupants = useMemo(() => paneOccupants(panes), [panes]);
+ const { workspace, tiles } = idePanes(occupants);
+ const workspaces = useMemo(() => {
+ const seen = new Map<string, string>();
+ for (const o of occupants) if (!seen.has(o.pane.workspace_id)) seen.set(o.pane.workspace_id, o.pane.workspace_name);
+ return [...seen];
+ }, [occupants]);
+ const screens = usePaneScreenBatch(tiles.map((o) => ({ workspaceId: o.pane.workspace_id, key: o.pane.key })));
+ const appTheme = useThemeValue();
+ // The IDE's pane appearance: the reader's stored choice, else the app's theme.
+ const appearance = storedTerminalAppearance() ?? appTheme;
+ const brand = PANE_BRAND[appearance], chrome = PANE_CHROME[appearance], ansi = themeFor(appearance);
+ const vars = {
+ "--pane-ink": brand.ink, "--pane-ink-muted": brand.inkMuted, "--pane-ink-faint": brand.inkFaint,
+ "--pane-chip": brand.chip, "--pane-rule": chrome.border, "--pane-edge": chrome.edge.live,
+ "--pane-ground": PANE_SOLID[appearance], "--pane-caret": ansi.cursor ?? brand.ink,
+ } as CSSProperties;
+ const { cols, rows } = ideGrid(tiles.length);
+ return (
+ <div className="office-ide-monitor" style={vars}>
+ <header className="office-ide-tabs">
+ {workspaces.map(([id, name]) => <span key={id} data-active={id === workspace || undefined}>{name}</span>)}
+ </header>
+ {tiles.length === 0 ? (
+ <p className="office-ide-empty">{t("society.office.mission_screen_none")}</p>
+ ) : (
+ <div className="office-ide-grid" style={{ gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))`, gridTemplateRows: `repeat(${rows}, minmax(0, 1fr))` }}>
+ {tiles.map((o) => {
+ const dot = o.dot === "working" ? ansi.green : o.dot === "waiting" ? ansi.yellow : o.dot === "error" ? ansi.red : brand.inkFaint;
+ const key = `${o.pane.workspace_id}:${o.pane.key}`;
+ const title = o.pane.recap.trim() || o.pane.last_prompt.trim() || paneLabel(o.pane);
+ return (
+ <article key={key} className="office-ide-tile">
+ <header className="office-pane-head">
+ <span className="office-pane-dot" style={{ background: dot }} />
+ <AgentMark agent={o.pane.agent} label={o.pane.display_name || o.pane.agent} variant="plain" size="sm"
+ className="!text-[color:var(--pane-ink)] [&>.bg-foreground]:!bg-[color:var(--pane-ink)]" />
+ <h2>{title}</h2>
+ <span className="office-pane-meta">{t(`society.office.pane_state_${o.stateKey}`)}</span>
+ </header>
+ <PaneScreenView screen={screens ? (screens.get(key) ?? null) : undefined} label={title}
+ loadingText={t("society.office.cmd_screen_loading")} emptyText={t("society.office.cmd_screen_empty")}
+ className="office-pane-screen office-ide-screen" />
+ </article>
+ );
+ })}
+ </div>
+ )}
+ </div>
+ );
+}
+
+// ---------------------------------------------------------------------------
+// The screen
+// ---------------------------------------------------------------------------
+
+const SECTIONS: Record<MonitorSection, () => ReactNode> = {
+ costs: () => <CostsView />,
+ agents: () => <AgentsScreen />,
+ "agentic-ide": () => <IdeScreen />,
+};
+
+/** `section`, live, on a monitor `widthM` metres wide whose glass sits at `position`. */
+export function MissionLiveScreen({ section, widthM, position }: {
+ section: MonitorSection; widthM: number; position: [number, number, number];
+}) {
+ // drei renders <Html> content in a separate React root: the app's data client
+ // must be handed over, or the sections' queries throw and the screen stays blank.
+ const client = useQueryClient();
+ // drei maps one CSS pixel to distanceFactor / 400 metres in transform mode.
+ const distanceFactor = (widthM * 400) / MISSION_SCREEN_PX.w;
+ return (
+ <Html transform occlude="blending" position={position} distanceFactor={distanceFactor} zIndexRange={[10, 0]}
+ style={{ width: MISSION_SCREEN_PX.w, height: MISSION_SCREEN_PX.h, pointerEvents: "none" }}>
+ <div className="office-mission-screen" data-office-ui>
+ <QueryClientProvider client={client}>
+ <Suspense fallback={null}>{SECTIONS[section]()}</Suspense>
+ </QueryClientProvider>
+ </div>
+ </Html>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeCameraRig.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeCameraRig.tsx
index 2019d7c52a..03e397e0b8 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeCameraRig.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeCameraRig.tsx
@@ -23,9 +23,9 @@ export const ZOOM_SECONDS = 1.15;
const SCREEN_W = 0.66, SCREEN_H = 0.38;
/** How far in front of a screen the camera must stand for the screen to fill the view. */
-export function screenFillDistance(fovDeg: number, aspect: number): number {
+export function screenFillDistance(fovDeg: number, aspect: number, width = SCREEN_W, height = SCREEN_H): number {
const v = Math.tan((fovDeg * Math.PI) / 360);
- return Math.max(SCREEN_H / 2 / v, SCREEN_W / 2 / (v * Math.max(0.2, aspect)));
+ return Math.max(height / 2 / v, width / 2 / (v * Math.max(0.2, aspect)));
}
export function OfficeCameraRig({ layout, overview }: { layout: OfficeLayout; overview: number }) {
@@ -119,7 +119,7 @@ export function OfficeCameraRig({ layout, overview }: { layout: OfficeLayout; ov
flight.current = null;
// End squarely in front of the screen, far enough back that it exactly fills the view.
const lens = camera as unknown as { fov: number; aspect: number };
- const reach = screenFillDistance(lens.fov ?? 35, lens.aspect ?? 1.6) * 1.02;
+ const reach = screenFillDistance(lens.fov ?? 35, lens.aspect ?? 1.6, ...(store.zoom.size ?? [SCREEN_W, SCREEN_H])) * 1.02;
const [tx, ty, tz] = store.zoom.target;
preDive.current = { position: camera.position.toArray() as [number, number, number], target: c.target.toArray() as [number, number, number] };
dive.current = { fromEye: camera.position.clone(),
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx
index d920bad52e..b7e3a7e981 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx
@@ -196,6 +196,24 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen
setDiving(true);
openTimer.current = setTimeout(() => { openAgent(agentId); setDiving(false); }, ZOOM_SECONDS * 1000 + 260);
}, [openAgent, reduced, select]);
+ // A Mission Control monitor was clicked: the camera dives into its glass,
+ // then the section it shows opens. The Agents view hosting this map switches
+ // to its list; any other host navigates to the Agents section.
+ const sectionDive = useOfficeStore((s) => s.sectionDive);
+ const lastSectionDive = useRef(sectionDive?.seq ?? 0);
+ useEffect(() => {
+ if (!sectionDive || sectionDive.seq === lastSectionDive.current) return;
+ lastSectionDive.current = sectionDive.seq;
+ const { section } = sectionDive;
+ const go = () => {
+ if (section === "agents" && !compact && onOpenLedger) onOpenLedger();
+ else useEventStore.getState().setActiveSection(section);
+ };
+ clearTimeout(openTimer.current);
+ if (reduced) { go(); return; }
+ setDiving(true);
+ openTimer.current = setTimeout(() => { go(); setDiving(false); }, ZOOM_SECONDS * 1000 + 260);
+ }, [sectionDive, compact, onOpenLedger, reduced]);
// The elevator: doors close, the floor switches behind them, doors open once
// the new floor has loaded (capped). Reduced motion switches at once.
diff --git a/jarvis/ui/web/frontend/src/components/society/office/PaneLiveScreen.tsx b/jarvis/ui/web/frontend/src/components/society/office/PaneLiveScreen.tsx
index 85b753bd85..50ecfc5e77 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/PaneLiveScreen.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/PaneLiveScreen.tsx
@@ -94,8 +94,20 @@ export function PaneLiveScreen({ workspaceId, paneKey, label, loadingText, empty
emptyText: string;
onOpen: () => void;
}) {
- const box = useRef<HTMLDivElement>(null);
const screen = useLiveScreen(workspaceId, paneKey);
+ return <PaneScreenView screen={screen} label={label} loadingText={loadingText} emptyText={emptyText} onOpen={onOpen} />;
+}
+
+/** One terminal screen, fitted to its box; `screen` undefined = still loading, null = unknown pane. */
+export function PaneScreenView({ screen, label, loadingText, emptyText, onOpen, className = "office-pane-screen" }: {
+ screen: PaneScreen | null | undefined;
+ label: string;
+ loadingText: string;
+ emptyText: string;
+ onOpen?: () => void;
+ className?: string;
+}) {
+ const box = useRef<HTMLDivElement>(null);
const { width, height } = useBoxSize(box);
const grid = liveGrid(screen?.cols ?? 80, width, height);
const view = screen ? visibleRows(screen.lines, grid.fit, screen.cursor) : null;
@@ -103,7 +115,7 @@ export function PaneLiveScreen({ workspaceId, paneKey, label, loadingText, empty
const empty = !view || view.rows.every((row) => !row.trim());
return (
- <div ref={box} className="office-pane-screen" role="img" aria-label={label} onDoubleClick={onOpen}>
+ <div ref={box} className={className} role="img" aria-label={label} onDoubleClick={onOpen}>
{empty ? (
<p className="office-pane-empty">{screen === undefined ? loadingText : emptyText}</p>
) : (
diff --git a/jarvis/ui/web/frontend/src/components/society/office/missionScreens.css b/jarvis/ui/web/frontend/src/components/society/office/missionScreens.css
new file mode 100644
index 0000000000..e0048b7b9f
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/missionScreens.css
@@ -0,0 +1,15 @@
+/* Mission Control's live desk monitors: real app sections drawn onto the glass.
+ The frame is the app's own ground; the IDE monitor takes its colours from the
+ --pane-* variables the component sets from the pane appearance tables. */
+.office-mission-screen { width:100%; height:100%; overflow:hidden; background:hsl(var(--background)); color:hsl(var(--foreground)); border-radius:6px; }
+.office-mission-screen > * { height:100%; }
+
+.office-ide-monitor { display:flex; flex-direction:column; height:100%; background:var(--pane-ground); color:var(--pane-ink); }
+.office-ide-tabs { display:flex; flex:none; align-items:center; gap:4px; height:38px; padding:0 10px; overflow:hidden; border-bottom:1px solid var(--pane-rule); }
+.office-ide-tabs span { flex:none; max-width:220px; padding:4px 10px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; border-radius:6px; font-size:13px; color:var(--pane-ink-muted); }
+.office-ide-tabs span[data-active] { background:var(--pane-chip); color:var(--pane-ink); }
+.office-ide-grid { display:grid; flex:1; min-height:0; gap:6px; padding:6px; }
+.office-ide-tile { display:flex; flex-direction:column; min-width:0; min-height:0; overflow:hidden; border:1px solid var(--pane-edge); border-radius:8px; }
+.office-ide-tile .office-pane-head h2 { flex:0 1 auto; min-width:0; margin:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; font-weight:500; }
+.office-ide-screen { flex:1 1 auto; min-height:0; margin:0 10px 6px; cursor:inherit; }
+.office-ide-empty { margin:auto; font-size:14px; color:var(--pane-ink-faint); }
diff --git a/jarvis/ui/web/frontend/src/components/society/office/missionScreens.test.ts b/jarvis/ui/web/frontend/src/components/society/office/missionScreens.test.ts
new file mode 100644
index 0000000000..7cae5563d8
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/missionScreens.test.ts
@@ -0,0 +1,57 @@
+import { describe, expect, it } from "vitest";
+import type { SocietyAgent } from "../data";
+import type { PaneOccupant } from "./codingFloor";
+import { deskLive } from "./CommandOffice";
+import { ideGrid, idePanes, pickShownAgent } from "./MissionScreens";
+import { screenFillDistance } from "./OfficeCameraRig";
+import { useOfficeStore } from "./officeStore";
+
+const agent = (agentId: string, extra: Partial<SocietyAgent> = {}): SocietyAgent =>
+ ({ agentId, tier: "specialist", state: "idle", chatSessionId: `chat-${agentId}`, ...extra } as SocietyAgent);
+
+const tile = (key: string, workspace: string, active = false): PaneOccupant =>
+ ({ pane: { key, workspace_id: workspace, workspace_active: active } } as PaneOccupant);
+
+describe("mission control desk monitors", () => {
+ it("shows a working agent's chat on the Agents monitor, never the lead's", () => {
+ const lead = agent("lead", { tier: "lead", state: "working" });
+ expect(pickShownAgent([lead, agent("a"), agent("b", { state: "working" })])?.agentId).toBe("b");
+ expect(pickShownAgent([lead, agent("a"), agent("w", { state: "waiting" })])?.agentId).toBe("w");
+ expect(pickShownAgent([lead, agent("nochat", { chatSessionId: null })])).toBeNull();
+ });
+
+ it("puts the front workspace's panes on the IDE monitor, in grid order", () => {
+ const panes = [tile("T1", "back"), tile("T1", "front", true), tile("T2", "front", true), tile("T2", "back")];
+ const shown = idePanes(panes);
+ expect(shown.workspace).toBe("front");
+ expect(shown.tiles.map((t) => t.pane.key)).toEqual(["T1", "T2"]);
+ // No front workspace: the first one stands in; no panes at all: nothing.
+ expect(idePanes([tile("T1", "only")]).workspace).toBe("only");
+ expect(idePanes([]).tiles).toEqual([]);
+ });
+
+ it("splits the IDE monitor like the IDE grid", () => {
+ expect(ideGrid(1)).toEqual({ cols: 1, rows: 1 });
+ expect(ideGrid(2)).toEqual({ cols: 2, rows: 1 });
+ expect(ideGrid(4)).toEqual({ cols: 2, rows: 2 });
+ expect(ideGrid(6)).toEqual({ cols: 3, rows: 2 });
+ });
+
+ it("runs the live sections only near the desk, with no flicker at the edge", () => {
+ expect(deskLive(8, false)).toBe(true);
+ expect(deskLive(13, false)).toBe(false);
+ expect(deskLive(13, true)).toBe(true);
+ expect(deskLive(16, true)).toBe(false);
+ });
+
+ it("dives into a larger monitor from further back, so it still fills the view", () => {
+ expect(screenFillDistance(35, 1.6, 0.72, 0.42)).toBeGreaterThan(screenFillDistance(35, 1.6));
+ });
+
+ it("a monitor click queues the dive and the section it opens", () => {
+ useOfficeStore.getState().diveToSection("costs", [1, 1.1, 2], 0.4, [0.72, 0.42]);
+ const { zoom, sectionDive } = useOfficeStore.getState();
+ expect(zoom).toMatchObject({ target: [1, 1.1, 2], facing: 0.4, size: [0.72, 0.42] });
+ expect(sectionDive?.section).toBe("costs");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeStore.ts b/jarvis/ui/web/frontend/src/components/society/office/officeStore.ts
index 85d45b649a..faf1f78b76 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/officeStore.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/officeStore.ts
@@ -57,9 +57,13 @@ interface OfficeState {
/** End the running meeting: its members go back to their day. */
endMeeting: () => void;
/** One-shot camera dive into a desk monitor (then the chat opens), consumed by the camera rig. */
- zoom: { target: [number, number, number]; facing: number; seq: number } | null;
- /** Dive into a monitor centred on `target`, whose screen faces yaw `facing`. */
- zoomInto: (target: [number, number, number], facing: number) => void;
+ zoom: { target: [number, number, number]; facing: number; size?: [number, number]; seq: number } | null;
+ /** Dive into a monitor centred on `target`, whose screen faces yaw `facing`; `size` is the screen in metres (default: a desk monitor). */
+ zoomInto: (target: [number, number, number], facing: number, size?: [number, number]) => void;
+ /** One-shot: a Mission Control monitor was clicked; the stage dives in, then opens this app section. */
+ sectionDive: { section: MonitorSection; seq: number } | null;
+ /** Dive into a Mission Control monitor, then open the app section it shows. */
+ diveToSection: (section: MonitorSection, target: [number, number, number], facing: number, size: [number, number]) => void;
/** Walk the character to this point (click-to-move / "walk there"), consumed by the player. */
walkTo: { point: Point; seq: number } | null;
/** Agents picked for a new team, carried from agent panels to the team room. */
@@ -75,12 +79,15 @@ interface OfficeState {
requestWalk: (point: Point) => void;
}
+/** The app sections Mission Control's desk monitors show live. */
+export type MonitorSection = "costs" | "agents" | "agentic-ide";
+
let seq = 0;
export const useOfficeStore = create<OfficeState>((set) => ({
floor: "agents",
setFloor: (floor) => set((s) => (s.floor === floor ? s : {
- floor, selection: null, nearby: null, summons: {}, meeting: null, walkTo: null, zoom: null, focus: null, teamDraft: [], follow: true,
+ floor, selection: null, nearby: null, summons: {}, meeting: null, walkTo: null, zoom: null, sectionDive: null, focus: null, teamDraft: [], follow: true,
})),
selection: null,
nearby: null,
@@ -102,7 +109,11 @@ export const useOfficeStore = create<OfficeState>((set) => ({
}),
walkTo: null,
zoom: null,
- zoomInto: (target, facing) => set({ zoom: { target, facing, seq: ++seq }, follow: false }),
+ zoomInto: (target, facing, size) => set({ zoom: { target, facing, size, seq: ++seq }, follow: false }),
+ sectionDive: null,
+ diveToSection: (section, target, facing, size) => set({
+ zoom: { target, facing, size, seq: ++seq }, sectionDive: { section, seq: ++seq }, follow: false, selection: null,
+ }),
teamDraft: [],
toggleDraft: (agentId) => set((s) => ({
teamDraft: s.teamDraft.includes(agentId) ? s.teamDraft.filter((id) => id !== agentId) : [...s.teamDraft, agentId],
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
index e4161db893..3e3b12b43f 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
@@ -940,10 +940,7 @@
"mission_task": "Erster Auftrag (optional)",
"mission_task_placeholder": "Woran soll er arbeiten? Leer lassen, um ihn nur zu öffnen.",
"mission_screen_agents": "Coding-Agents auf dieser Etage",
- "mission_screen_start": "Neuer Agent",
"room_command": "Mission Control",
- "mission_screen_workspaces": "Workspaces",
- "mission_screen_activity": "Letzte Aufträge",
"mission_screen_none": "Noch keine Coding-Agents",
"mission_new_title": "Agent starten",
"mission_fewer": "Ein Agent weniger",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
index ae6f7be6f3..6880dc1e0b 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
@@ -940,10 +940,7 @@
"mission_task": "First task (optional)",
"mission_task_placeholder": "What should it work on? Leave empty to just open it.",
"mission_screen_agents": "coding agents on this floor",
- "mission_screen_start": "New agent",
"room_command": "Mission Control",
- "mission_screen_workspaces": "Workspaces",
- "mission_screen_activity": "Latest prompts",
"mission_screen_none": "No coding agents yet",
"mission_new_title": "Start an agent",
"mission_fewer": "One agent fewer",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
index ed15f3a688..61f5057f48 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
@@ -940,10 +940,7 @@
"mission_task": "Primera tarea (opcional)",
"mission_task_placeholder": "¿En qué debe trabajar? Déjalo vacío para solo abrirlo.",
"mission_screen_agents": "agentes de código en esta planta",
- "mission_screen_start": "Nuevo agente",
"room_command": "Mission Control",
- "mission_screen_workspaces": "Espacios de trabajo",
- "mission_screen_activity": "Últimas instrucciones",
"mission_screen_none": "Aún no hay agentes de código",
"mission_new_title": "Iniciar un agente",
"mission_fewer": "Un agente menos",