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(office): coding floor for the IDE's coding agents, reached by elevator
rubenluetke10-beepd930a8647d40
diff --git a/docs/agent-society/office-map.md b/docs/agent-society/office-map.mdindex e3adce5f29..c1caecd78b 100644--- a/docs/agent-society/office-map.md+++ b/docs/agent-society/office-map.md@@ -117,6 +117,57 @@ target runs WebGL.- **Pace**: the person walks at 2.0 m/s and sprints at 4.4 m/s (Shift).Working agents stay at their screen even when called.+## 5b. Coding floor (2026-09-29)++A second floor for the coding agents that run in the Agentic IDE's terminal+panes. It shares the office's engine, style and controls; only the people and+the floor plan differ.++- **Elevator**: the reception elevator is a checkpoint on both floors. Its+ panel offers "Up to the coding floor" in the agents office and "Down to the+ agents office" on the coding floor. The ride is a short door-like fade, and+ the person steps out at the elevator of the other floor. The floor survives+ a remount of the stage.+- **Floor plan** (`buildOfficeLayout(agents, { variant: "coding" })`): one+ department per IDE workspace; no lead office and no wardrobe (a quiet zone+ takes their place, built from existing furniture); reception with the+ elevator and the break room stay. The agents office layout is unchanged.+- **Gigi follows**: on the coding floor Jarvis (Gigi) flies in "follow" mode,+ hovering beside and behind the person's head with a smoothed lag and never+ inside a wall, including in the elevator. In the agents office Gigi keeps+ its lead-office behaviour.+- **Pane to character** (`codingFloor.ts`): every running coding-agent pane+ (Claude Code, Codex and the other agent CLIs; not plain shells, not archived+ panes) is one character. Its id is `pane:<workspace>:<history id or key>`,+ and its look (figure and palette) is random but stable, hashed from the+ pane's history id. Name comes from the pane's short title, department from+ its workspace.+- **States**: working, starting or pending → sits at its computer; asking →+ waits at its desk and waves; idle, done or exited → walks around and hangs+ out in the break room; an error keeps the agent at its desk. The exact+ mapping lives in `codingFloor.ts` and its tests.+- **Live monitors** (`TerminalMonitors.tsx`, `usePaneScreens.ts`,+ `terminalScreen.ts`): an agent seated at its desk shows its terminal live —+ dark background, monospace text, the last rows that fit, a cursor block and a+ title bar with its name and state dot. Screens come from the read-only+ `GET /api/agentic-ide/screens?pane=<workspace>:<key>` feed (at most eight+ panes per call; it never resizes, attaches to or writes into a terminal).+ Only seated agents near the camera are polled (six at most), on a jittered+ 1.2–2 s schedule that pauses while the stage is asleep, and a monitor+ redraws only when its screen changed. Idle or absent agents show a dim+ screensaver.+- **Open session**: clicking a monitor (or E at the agent → "Open session")+ dives the camera into the screen and then opens the Agentic IDE with that+ pane focused (`codingNavigate.ts`).+- **IDE side-panel tab**: the coding floor is also the "Office" tab of the+ Agentic IDE's side panel (`components/agentic/sidePanel/OfficeTab.tsx`),+ added from the panel's "+" menu or its closed-panel rail. It lazy-loads the+ stage in a compact layout on the coding floor, inside its own error boundary,+ so a failed scene stays inside the tab. Bringing the tab forward widens a+ narrow panel to 520 px once; the user can drag it back. There a monitor click+ focuses the pane in the grid right next to it, and the office's "open the+ ledger" action brings the Agents tab forward.+## 5c. Lead office as an executive suite (2026-09-29)The lead office is the one room that breaks the plain toy-office palette ondiff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsxindex 1b0993c4a8..0080995d99 100644--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.test.tsx@@ -1,5 +1,5 @@import { act, cleanup, fireEvent, render, screen } from "@testing-library/react";-import { afterEach, beforeEach, describe, expect, it } from "vitest";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { IdeSidePanelFrame } from "./IdeSidePanel";import { IdeSidePanelToggle } from "./IdeSidePanelToggle";import { useEventStore } from "@/store/events";@@ -7,6 +7,15 @@ import { useIdeProjectsStore } from "@/store/ideProjects";import { useIdeSidePanelStore } from "@/store/ideSidePanel";import { resetWorkspacePanesPoll, useWorkspacePanesStore } from "@/store/workspacePanes";+// The real stage is a WebGL scene; the tab only owes it the right props and a place to live.+vi.mock("@/components/society/office/OfficeStage", () => ({+ OfficeStage: ({ onOpenLedger, initialFloor, compact }: { onOpenLedger: () => void; initialFloor?: string; compact?: boolean }) => (+ <div data-testid="office-stage" data-floor={initialFloor} data-compact={String(Boolean(compact))}>+ <button type="button" onClick={onOpenLedger}>ledger</button>+ </div>+ ),+}));+function Harness() {return (<>@@ -112,4 +121,35 @@ describe("IdeSidePanel", () => {expect(useIdeSidePanelStore.getState()).toMatchObject({ open: true, active: "files" });expect(screen.queryByTestId("ide-side-panel-rail")).toBeNull();});++ it("adds the Office tab from + and shows the coding floor in a compact stage", async () => {+ act(() => useIdeSidePanelStore.setState({ open: true, tabs: ["agents"], active: "agents" }));+ render(<Harness />);+ fireEvent.click(screen.getByTestId("ide-side-panel-add"));+ const item = screen.getByTestId("ide-side-panel-add-office");+ expect(item.textContent).toContain("Office");+ expect(item.getAttribute("aria-checked")).toBe("false");+ fireEvent.click(item);+ expect(useIdeSidePanelStore.getState()).toMatchObject({ active: "office", tabs: ["agents", "office"] });+ expect(screen.getByTestId("ide-side-panel-tab-office").getAttribute("aria-selected")).toBe("true");+ expect(screen.getByTestId("ide-office-tab").className).toContain("h-full");+ const stage = await screen.findByTestId("office-stage");+ expect(stage.getAttribute("data-floor")).toBe("coding");+ expect(stage.getAttribute("data-compact")).toBe("true");+ });++ it("widens a narrow panel for the office and sends the ledger action to Agents", async () => {+ localStorage.setItem("jarvis.agenticIde.sidePanelWidth.v1", "300");+ act(() => useIdeSidePanelStore.setState({ open: true, tabs: ["office"], active: "office" }));+ render(<Harness />);+ expect(screen.getByTestId("ide-side-panel-host").style.width).toBe("520px");+ fireEvent.click(await screen.findByText("ledger"));+ expect(useIdeSidePanelStore.getState()).toMatchObject({ active: "agents", tabs: ["office", "agents"] });+ });++ it("lists Office on the closed panel's rail", () => {+ render(<Harness />);+ fireEvent.click(screen.getByTestId("ide-side-panel-rail-office"));+ expect(useIdeSidePanelStore.getState()).toMatchObject({ open: true, active: "office" });+ });});diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsxindex fc16259f08..077592bb5f 100644--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx@@ -16,6 +16,8 @@ const WIDTH_KEY = "jarvis.agenticIde.sidePanelWidth.v1";const DEFAULT_PX = 340;const MIN_PX = 260;const MAX_PX = 720;+/** The office map needs room to walk around in: its tab opens the panel at least this wide. */+const OFFICE_MIN_PX = 520;/** Terminal canvas kept visible while the panel is open. */const GRID_RESERVED_PX = 320;@@ -37,6 +39,7 @@ const HEADER_BTN =export function IdeSidePanelFrame({ children }: { children: ReactNode }) {const t = useT();const open = useIdeSidePanelStore((state) => state.open);+ const active = useIdeSidePanelStore((state) => state.active);// Ctrl+click on a path in any terminal opens it in the Explorer tab.useExplorerPathRouting();// A click on a pane in the grid counts as reviewing that agent.@@ -65,6 +68,15 @@ export function IdeSidePanelFrame({ children }: { children: ReactNode }) {// Keep a wider stored preference intact while the window is narrow.const width = Math.min(pane.size, max);+ // Bringing the office forward widens a narrow panel once; the user can drag+ // it back and it stays where they left it until the office is picked again.+ const officeInFront = open && active === "office";+ const paneRef = useRef(pane);+ paneRef.current = pane;+ useEffect(() => {+ if (officeInFront && paneRef.current.size < OFFICE_MIN_PX) paneRef.current.resize(OFFICE_MIN_PX);+ }, [officeInFront]);+return (<div ref={frame} className="flex h-full min-h-0 w-full"><div className="h-full min-h-0 min-w-0 flex-1">{children}</div>diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/OfficeTab.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/OfficeTab.tsxnew file mode 100644index 0000000000..929ed0bab9--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/OfficeTab.tsx@@ -0,0 +1,62 @@+import { Component, Suspense, lazy, type ErrorInfo, type ReactNode } from "react";+import { AlertTriangle, RotateCcw } from "lucide-react";+import { translate, useLocaleChunk } from "@/i18n";+import { useIdeSidePanelStore } from "@/store/ideSidePanel";++// The office is a WebGL scene with its own chunk: nothing of it loads until+// someone opens this tab.+const OfficeStage = lazy(() => import("@/components/society/office/OfficeStage").then((m) => ({ default: m.OfficeStage })));++/** Keeps a failed scene inside the tab instead of taking the IDE down with it. */+class OfficeTabBoundary extends Component<{ children: ReactNode }, { failed: boolean }> {+ state = { failed: false };++ static getDerivedStateFromError(): { failed: boolean } {+ return { failed: true };+ }++ componentDidCatch(error: unknown, info: ErrorInfo) {+ console.error("IDE office tab crashed", { error, componentStack: info.componentStack });+ }++ render() {+ if (!this.state.failed) return this.props.children;+ return (+ <div data-testid="ide-office-tab-failed" className="flex h-full min-h-0 flex-col items-center justify-center gap-3 p-6 text-center">+ <AlertTriangle className="h-5 w-5 text-destructive" aria-hidden />+ <p className="text-sm text-muted-foreground">{translate("ide_side_panel.office.failed")}</p>+ <button+ type="button"+ onClick={() => this.setState({ failed: false })}+ className="inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1 text-sm text-foreground hover:bg-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"+ >+ <RotateCcw className="h-3.5 w-3.5" aria-hidden />+ {translate("ide_side_panel.office.retry")}+ </button>+ </div>+ );+ }+}++/**+ * The coding floor of the agent office, inside the IDE's side panel.+ *+ * Every running coding-agent pane walks around here; a click on a monitor+ * focuses that pane in the grid next to it. The office's "open the ledger"+ * action has no ledger in the IDE, so it brings the Agents tab forward.+ */+export function OfficeTab() {+ const ready = useLocaleChunk("society");+ const openTab = useIdeSidePanelStore((state) => state.openTab);+ return (+ <div data-testid="ide-office-tab" className="h-full min-h-0 w-full">+ <OfficeTabBoundary>+ {ready && (+ <Suspense fallback={<div className="h-full w-full animate-pulse bg-secondary" aria-hidden />}>+ <OfficeStage initialFloor="coding" compact onOpenLedger={() => openTab("agents")} />+ </Suspense>+ )}+ </OfficeTabBoundary>+ </div>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/sidePanelTabs.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/sidePanelTabs.tsxindex d99c333d0a..8ce2c7893f 100644--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/sidePanelTabs.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/sidePanelTabs.tsx@@ -1,8 +1,10 @@import type { ReactNode } from "react";-import { Bot, FileDiff, FolderTree, type LucideIcon } from "lucide-react";+import { Bot, Building2, FileDiff, FolderTree, GitBranch, type LucideIcon } from "lucide-react";import type { SidePanelTabId } from "@/store/ideSidePanel";import { AgentsOverview } from "./AgentsOverview";import { ExplorerPanel } from "./explorer/ExplorerPanel";+import { GitOverviewTab } from "./git/GitOverviewTab";+import { OfficeTab } from "./OfficeTab";/** One function the side panel can show. */export interface SidePanelTabDef {@@ -39,6 +41,18 @@ export const SIDE_PANEL_TABS: readonly SidePanelTabDef[] = [icon: FolderTree,render: () => <ExplorerPanel view="files" />,},+ {+ id: "git",+ labelKey: "ide_side_panel.tabs.git",+ icon: GitBranch,+ render: () => <GitOverviewTab />,+ },+ {+ id: "office",+ labelKey: "ide_side_panel.tabs.office",+ icon: Building2,+ render: () => <OfficeTab />,+ },];export function sidePanelTab(id: SidePanelTabId): SidePanelTabDef | undefined {diff --git a/jarvis/ui/web/frontend/src/components/society/office/CheckpointMarker.tsx b/jarvis/ui/web/frontend/src/components/society/office/CheckpointMarker.tsxindex 365d611897..4d1e593a5d 100644--- a/jarvis/ui/web/frontend/src/components/society/office/CheckpointMarker.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/CheckpointMarker.tsx@@ -17,7 +17,7 @@ import { cachedCanvasTexture } from "./canvasMaterials";import type { Checkpoint } from "./officeLayout";import { CHECKPOINT_GOLD } from "./officePalette";-export type CheckpointIcon = "plus" | "list" | "team" | "shirt" | "star" | "coffee";+export type CheckpointIcon = "plus" | "list" | "team" | "shirt" | "star" | "coffee" | "updown";/** Stroke-only icons in a 24 × 24 box (round caps and joins). */export const CHECKPOINT_ICON_PATHS: Record<CheckpointIcon, string> = {@@ -27,6 +27,8 @@ export const CHECKPOINT_ICON_PATHS: Record<CheckpointIcon, string> = {shirt: "M8 3L3 6l2 4 2.5-1v12h9V9l2.5 1 2-4-5-3c-.5 1.5-2 2.5-4 2.5S8.5 4.5 8 3z",star: "M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z",coffee: "M4 9h12v5a5 5 0 0 1-5 5H9a5 5 0 0 1-5-5V9zM16 10h1.5a2.5 2.5 0 0 1 0 5H16M8 3.5c0 1 1 1 1 2M12 3.5c0 1 1 1 1 2",+ // The elevator: an up arrow beside a down arrow.+ updown: "M8 20V4M4 8l4-4 4 4M16 4v16M12 16l4 4 4-4",};const TOKEN_RADIUS = 0.36;diff --git a/jarvis/ui/web/frontend/src/components/society/office/GigiFlyer.tsx b/jarvis/ui/web/frontend/src/components/society/office/GigiFlyer.tsxindex 7d567939b1..d8d2c03ce2 100644--- a/jarvis/ui/web/frontend/src/components/society/office/GigiFlyer.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/GigiFlyer.tsx@@ -15,7 +15,7 @@ import {} from "three";import { CompanionModel } from "../companion/AgentFollower";import { defaultCompanion } from "../companion/appearance";-import { createGigiFlight, createGigiPose, stepGigiFlight, type GigiFlightMode } from "./gigiFlight";+import { createGigiFlight, createGigiPose, followAnchor, stepGigiFlight, type GigiFlightMode } from "./gigiFlight";/** Gigi's on-screen height in the office. */export const GIGI_OFFICE_SIZE_M = 0.5;@@ -95,13 +95,15 @@ function nextRandom(seed: { value: number }): number {return seed.value / 4294967296;}-export function GigiFlyer({ owner, mode, speaking, paused, reduced }: {- /** The walker's mover: ground position and facing (0 = +z). */+export function GigiFlyer({ owner, mode, speaking, paused, reduced, clear }: {+ /** The walker's mover (or, in "follow" mode, the person's character): ground position and facing (0 = +z). */owner: { current: { x: number; z: number; heading: number } };mode: GigiFlightMode;speaking: boolean;paused: boolean;reduced: boolean;+ /** Free airspace test; "follow" mode keeps Gigi out of walls with it. */+ clear?: (x: number, z: number) => boolean;}) {const root = useRef<Group>(null);const body = useRef<Group>(null);@@ -117,6 +119,7 @@ export function GigiFlyer({ owner, mode, speaking, paused, reduced }: {const last = useRef({ x: owner.current.x, z: owner.current.z });const emitDebt = useRef(0);const seed = useRef({ value: 0x9e3779b9 });+ const side = useRef<1 | -1>(1);const tint = useMemo(() => new Color(), []);const appearance = useMemo(() => ({ ...defaultCompanion("jarvis"), sizeM: GIGI_OFFICE_SIZE_M }), []);@@ -142,8 +145,14 @@ export function GigiFlyer({ owner, mode, speaking, paused, reduced }: {const travelled = Math.hypot(m.x - last.current.x, m.z - last.current.z);const moving = dt > 0 && travelled / dt > MOVING_SPEED && travelled < 4;last.current.x = m.x; last.current.z = m.z;+ let targetX = m.x, targetZ = m.z;+ if (mode === "follow") {+ const anchor = followAnchor(m.x, m.z, m.heading, side.current, clear);+ side.current = anchor.side;+ targetX = anchor.x; targetZ = anchor.z;+ }stepGigiFlight(flight.current, {- targetX: m.x, targetZ: m.z, moving, mode, speaking, t: clock.current, dt, heading: m.heading, reduced,+ targetX, targetZ, moving, mode, speaking, t: clock.current, dt, heading: m.heading, reduced, clear,}, pose);if (root.current) root.current.position.set(pose.x, pose.y, pose.z);diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeFullMap.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeFullMap.tsxindex 60e227e034..032dd8ed41 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeFullMap.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeFullMap.tsx@@ -110,6 +110,7 @@ function FullMapDialog({ onClose, layout, agents, selectedId }: Omit<OfficeFullMwardrobe: t("society.office.cp_wardrobe"),lead: t("society.office.cp_lead"),break: t("society.office.cp_break"),+ elevator: t("society.office.cp_elevator"),};const roomLabels: Record<RoomKind, string> = {lead: t("society.office.room_lead"),@@ -117,6 +118,8 @@ function FullMapDialog({ onClose, layout, agents, selectedId }: Omit<OfficeFullMwardrobe: t("society.office.room_wardrobe"),reception: t("society.office.room_reception"),break: t("society.office.room_break"),+ focus: t("society.office.room_focus"),+ server: t("society.office.room_server"),};const openSpace = t("society.office.open_space");const youLabel = t("society.office.minimap_you");diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeMinimap.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeMinimap.tsxindex b5914aecaf..da1eecf13b 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeMinimap.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeMinimap.tsx@@ -217,6 +217,7 @@ export function OfficeMinimap({ layout, agents, selectedId, onOpenMap }: OfficeMwardrobe: t("society.office.cp_wardrobe"),lead: t("society.office.cp_lead"),break: t("society.office.cp_break"),+ elevator: t("society.office.cp_elevator"),};const roomLabels: Record<RoomKind, string> = {lead: t("society.office.room_lead"),@@ -224,6 +225,8 @@ export function OfficeMinimap({ layout, agents, selectedId, onOpenMap }: OfficeMwardrobe: t("society.office.room_wardrobe"),reception: t("society.office.room_reception"),break: t("society.office.room_break"),+ focus: t("society.office.room_focus"),+ server: t("society.office.room_server"),};const youLabel = t("society.office.minimap_you");const openSpace = t("society.office.open_space");diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficePanels.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficePanels.tsxindex 2664550a1f..bb57ef5374 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficePanels.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficePanels.tsx@@ -1,7 +1,7 @@/**- * DOM panels for what the person selects in the office: an agent, or one of- * the checkpoints (reception, agent board, team room, wardrobe, lead office,- * break room). Every action here uses an existing app path — create dialog,+ * DOM panels for what the person selects in the office: an agent (or, on the+ * coding floor, an IDE session), or one of the checkpoints (reception, agent+ * board, team room, wardrobe, lead office, break room, elevator). Every action here uses an existing app path — create dialog,* agent card/chat, chat groups — the office adds no new backend contract.*/import { useEffect, useId, useRef, useState } from "react";@@ -10,7 +10,8 @@ import { useT } from "@/i18n";import { createSocietyChatGroup, useSocietyChatGroups } from "@/lib/societyChatGroups";import type { SocietyAgent } from "../data";import type { CheckpointKind, OfficeLayout, Point } from "./officeLayout";-import { player, useOfficeStore } from "./officeStore";+import { otherFloor, player, useOfficeStore, type OfficeFloor } from "./officeStore";+import type { PaneOccupant } from "./codingFloor";import { agentPositions } from "./walkerRegistry";import { AgentTalkPanel, CALL_MS } from "./AgentTalkPanel";import type { PlayerProfile } from "./playerProfile";@@ -60,6 +61,76 @@ export function AgentPanel({ agent, actions, onClose }: { agent: SocietyAgent; areturn <AgentTalkPanel agent={agent} actions={actions} onClose={onClose} />;}+/** How long ago an epoch-seconds moment was, in the viewer's words ("" when unknown). */+function sinceLabel(at: number | null, t: (key: string) => string): string {+ if (!at) return "";+ const seconds = Math.max(0, Date.now() / 1000 - at);+ if (seconds < 60) return t("society.office.since_now");+ if (seconds < 3600) return t("society.office.since_minutes").replace("{0}", String(Math.floor(seconds / 60)));+ if (seconds < 86400) return t("society.office.since_hours").replace("{0}", String(Math.floor(seconds / 3600)));+ return t("society.office.since_days").replace("{0}", String(Math.floor(seconds / 86400)));+}++/**+ * A coding session on the coding floor: what it is doing, where it lives and+ * what it was last asked. It has no chat or team — its home is the IDE pane.+ */+export function PaneAgentPanel({ occupant, onOpen, onClose }: { occupant: PaneOccupant; onOpen: () => void; onClose: () => void }) {+ const t = useT();+ const store = useOfficeStore();+ const { agent, pane } = occupant;+ const since = sinceLabel(pane.activity_since || null, t);+ const prompt = pane.last_prompt.trim();+ const recap = pane.recap.trim();+ const place = () => agentPositions.get(agent.agentId);+ return (+ <PanelShell title={agent.name} subtitle={pane.display_name || pane.agent} onClose={onClose}>+ <p className="office-panel-status" data-pane-state={occupant.stateKey}>+ <i className="office-dot" data-state={agent.state} data-dot={occupant.dot} aria-hidden />+ {t(`society.office.pane_state_${occupant.stateKey}`)}{since ? <span className="office-hint"> · {since}</span> : null}+ </p>+ <dl className="office-facts">+ <dt>{t("society.office.pane_workspace")}</dt>+ <dd title={pane.folder}>{agent.providerLabel}</dd>+ {recap && recap !== prompt && (<><dt>{t("society.office.pane_recap")}</dt><dd>{recap}</dd></>)}+ {prompt && (<><dt>{t("society.office.pane_prompt")}</dt><dd className="office-facts-quote">{prompt}</dd></>)}+ </dl>+ {!recap && !prompt && <p className="office-note-inline">{t("society.office.pane_unasked")}</p>}+ <div className="office-actions">+ <button type="button" className="office-action office-action-primary" onClick={onOpen}>{t("society.office.pane_open")}</button>+ <button type="button" className="office-action" onClick={() => { const p = place(); if (p) store.focusOn(p); }}>+ {t("society.office.action_focus")}+ </button>+ <button type="button" className="office-action" onClick={() => { const p = place(); if (p) store.requestWalk(p); }}>+ {t("society.office.action_walk")}+ </button>+ </div>+ </PanelShell>+ );+}++/** Counts of both floors shown in the elevator; `null` = not known yet. */+export interface ElevatorInfo { jarvis: number; coding: number | null; onRide: (to: OfficeFloor) => void }++function ElevatorPanel({ floor, info }: { floor: OfficeFloor; info: ElevatorInfo }) {+ const t = useT();+ const to = otherFloor(floor);+ const count = to === "coding" ? info.coding : info.jarvis;+ return (+ <>+ <p>{t(to === "coding" ? "society.office.elevator_up_body" : "society.office.elevator_down_body")}</p>+ {count !== null && (+ <p className="office-hint" role="status">+ {t(to === "coding" ? "society.office.elevator_up_count" : "society.office.elevator_down_count").replace("{0}", String(count))}+ </p>+ )}+ <button type="button" className="office-action office-action-primary" onClick={() => info.onRide(to)}>+ {t(to === "coding" ? "society.office.elevator_up" : "society.office.elevator_down")}+ </button>+ </>+ );+}+function CreatePanel({ actions }: { actions: OfficeActions }) {const t = useT();return (@@ -234,9 +305,10 @@ function BreakPanel({ agents, layout }: { agents: SocietyAgent[]; layout: Office);}-export function CheckpointPanel({ id, agents, layout, sample, profile, onProfile, actions, onClose }: {- id: CheckpointKind; agents: SocietyAgent[]; layout: OfficeLayout; sample: boolean;+export function CheckpointPanel({ id, floor = "agents", agents, layout, sample, profile, onProfile, actions, onClose, elevator }: {+ id: CheckpointKind; floor?: OfficeFloor; agents: SocietyAgent[]; layout: OfficeLayout; sample: boolean;profile: PlayerProfile; onProfile: (next: PlayerProfile) => void; actions: OfficeActions; onClose: () => void;+ elevator?: ElevatorInfo;}) {const t = useT();return (@@ -247,6 +319,7 @@ export function CheckpointPanel({ id, agents, layout, sample, profile, onProfile{id === "wardrobe" && <WardrobePanel profile={profile} onProfile={onProfile} agents={agents} sample={sample} />}{id === "lead" && <LeadPanel agents={agents} actions={actions} />}{id === "break" && <BreakPanel agents={agents} layout={layout} />}+ {id === "elevator" && elevator && <ElevatorPanel floor={floor} info={elevator} />}</PanelShell>);}diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeRooms.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeRooms.tsxindex 4d255f2511..58df99336a 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeRooms.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeRooms.tsx@@ -25,7 +25,7 @@ function lcg(seed: number): () => number {}/** Metres covered by one repeat of each floor pattern. */-const PATTERN_METRES: Record<RoomKind, number> = { lead: 2.6, team: 2, wardrobe: 2, reception: 2.4, break: 2 };+const PATTERN_METRES: Record<RoomKind, number> = { lead: 2.6, team: 2, wardrobe: 2, reception: 2.4, break: 2, focus: 2, server: 2 };function drawFloor(kind: RoomKind, ctx: CanvasRenderingContext2D, w: number, h: number): void {const { base, accents } = ROOM_FLOOR_COLOURS[kind];@@ -54,7 +54,7 @@ function drawFloor(kind: RoomKind, ctx: CanvasRenderingContext2D, w: number, h:}}ctx.putImageData(image, 0, 0);- } else if (kind === "team" || kind === "break") {+ } else if (kind === "team" || kind === "break" || kind === "focus") {// Carpet grain: fine speckles in the accent tones, plus a faint weave.for (let i = 0; i < 2600; i += 1) {ctx.fillStyle = accents[Math.floor(rand() * accents.length)];@@ -64,7 +64,7 @@ function drawFloor(kind: RoomKind, ctx: CanvasRenderingContext2D, w: number, h:for (let y = 0; y < h; y += 8) ctx.fillRect(0, y, w, 1);} else {// Tiles: wardrobe small square tiles, reception large stone slabs.- const tiles = kind === "wardrobe" ? 4 : 2;+ const tiles = kind === "wardrobe" || kind === "server" ? 4 : 2;const size = w / tiles;for (let ty = 0; ty < tiles; ty += 1) {for (let tx = 0; tx < tiles; tx += 1) {diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsxindex 14b23b95fb..e87cdefde3 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx@@ -3,7 +3,7 @@* railings around it, walled rooms in the north and south, one carpeted* department per provider family in between — and everybody in it.*/-import { useMemo } from "react";+import { useLayoutEffect, useMemo } from "react";import { Stars } from "@react-three/drei";import type { ThreeEvent } from "@react-three/fiber";import { CanvasTexture, Color, RepeatWrapping, SRGBColorSpace, type Texture } from "three";@@ -14,6 +14,10 @@ import { Railing, SignWall } from "./OfficeFurniture";import { DeskInstances } from "./DeskInstances";import { ExecutiveDesks, LeadOfficeLight } from "./LeadSuite";import { LiveMonitors } from "./LiveMonitors";+import { TerminalMonitors } from "./TerminalMonitors";+import type { PaneOccupant } from "./codingFloor";+import { GigiFlyer } from "./GigiFlyer";+import { useEventStore } from "@/store/events";import type { DeskChat } from "./useDeskChats";import { FurniturePiece, MeetingChairs } from "./OfficeProps";import { RoomFloors, RoomSign, RoomWalls } from "./OfficeRooms";@@ -23,14 +27,45 @@ import { OfficePlayer } from "./OfficePlayer";import { PlayerBubble } from "./OfficeBubbles";import { OfficeCameraRig } from "./OfficeCameraRig";import { allDesks, type CheckpointKind, type Department, type OfficeLayout, type Point } from "./officeLayout";-import type { NavGrid } from "./officeNav";+import { isWalkable, nearestWalkable, type NavGrid } from "./officeNav";import { DEPARTMENT_TINTS, OFFICE } from "./officePalette";-import { useOfficeStore, type Selection } from "./officeStore";+import { officeSession, player as playerBody, useOfficeStore, type OfficeFloor, type Selection } from "./officeStore";+import { arrivalPose } from "./officeFloors";const CHECKPOINT_ICON: Record<CheckpointKind, CheckpointIcon> = {- create: "plus", manage: "list", team: "team", wardrobe: "shirt", lead: "star", break: "coffee",+ create: "plus", manage: "list", team: "team", wardrobe: "shirt", lead: "star", break: "coffee", elevator: "updown",};+/** The person's character as a mover for Gigi to follow (the body object itself, mutated every frame). */+const PLAYER_OWNER = { current: playerBody };++/**+ * Places the character on a floor it just arrived at (elevator ride, or a+ * mount that asked for another floor). Runs as a layout effect, so it lands+ * before the player controller checks its spot; it repeats for every rebuilt+ * plan until the floor's roster has loaded, then the arrival is done.+ */+function FloorArrival({ floor, layout, grid, ready }: { floor: OfficeFloor; layout: OfficeLayout; grid: NavGrid; ready: boolean }) {+ useLayoutEffect(() => {+ const arrival = officeSession.arrival;+ if (!arrival || arrival.floor !== floor) return;+ const pose = arrivalPose(layout, arrival.at, officeSession.floors[floor]);+ const spot = isWalkable(grid, pose) ? pose : nearestWalkable(grid, pose) ?? layout.spawn;+ playerBody.x = spot.x; playerBody.z = spot.z; playerBody.heading = pose.heading;+ playerBody.path = []; playerBody.moving = false;+ officeSession.playerPlaced = true;+ if (ready) officeSession.arrival = null;+ }, [floor, layout, grid, ready]);+ return null;+}++/** On the coding floor Jarvis is nobody's desk mate: Gigi flies along with the person. */+function GigiCompanion({ grid, awake, reduced }: { grid: NavGrid; awake: boolean; reduced: boolean }) {+ const speaking = useEventStore((s) => s.voiceState === "speaking");+ const clear = useMemo(() => (x: number, z: number) => isWalkable(grid, { x, z }), [grid]);+ return <GigiFlyer owner={PLAYER_OWNER} mode="follow" speaking={speaking} paused={!awake} reduced={reduced} clear={clear} />;+}+/** Warm planks drawn once; repeated across the floor. */let plankTexture: Texture | null | undefined;function planks(): Texture | null {@@ -111,6 +146,11 @@ function DepartmentArea({ dept }: { dept: Department }) {}export interface OfficeSceneProps {+ floor: OfficeFloor;+ /** The coding floor's figures by agent id (their IDE panes); empty on the agents floor. */+ occupants: ReadonlyMap<string, PaneOccupant>;+ /** The floor's roster has loaded (ends a pending arrival). */+ ready: boolean;layout: OfficeLayout;grid: NavGrid;walkers: WalkerContext;@@ -126,7 +166,7 @@ export interface OfficeSceneProps {onOpenScreen: (agentId: string, screen: Point & { y: number }, facing: number) => void;}-export function OfficeScene({ layout, grid, walkers, agents, newcomers, awake, reduced, overview, player, selection, nearby, chats, onOpenScreen }: OfficeSceneProps) {+export function OfficeScene({ floor, occupants, ready, layout, grid, walkers, agents, newcomers, awake, reduced, overview, player, selection, nearby, chats, onOpenScreen }: OfficeSceneProps) {const t = useT();const desks = useMemo(() => allDesks(layout), [layout]);// Lead desks carry their own size and are built as executive desks, not bench instances.@@ -162,7 +202,9 @@ export function OfficeScene({ layout, grid, walkers, agents, newcomers, awake, r<DeskInstances desks={benchDesks} agents={agents} /><ExecutiveDesks desks={desks} agents={agents} />{leadRoom && <LeadOfficeLight room={leadRoom} />}- <LiveMonitors desks={desks} agents={agents} chats={chats} onOpen={onOpenScreen} />+ {floor === "coding"+ ? <TerminalMonitors desks={desks} occupants={occupants} awake={awake} onOpen={onOpenScreen} />+ : <LiveMonitors desks={desks} agents={agents} chats={chats} onOpen={onOpenScreen} />}{layout.furniture.map((item) => <FurniturePiece key={item.id} item={item} />)}{table && <MeetingChairs table={table} />}{layout.checkpoints.map((cp) => (@@ -170,10 +212,12 @@ export function OfficeScene({ layout, grid, walkers, agents, newcomers, awake, ractive={(nearby?.kind === "checkpoint" && nearby.id === cp.id) || (selection?.kind === "checkpoint" && selection.id === cp.id)}animate={awake && !reduced} onActivate={() => select({ kind: "checkpoint", id: cp.id })} />))}+ <FloorArrival floor={floor} layout={layout} grid={grid} ready={ready} /><OfficePlayer layout={layout} grid={grid} look={player.look} name={player.name} awake={awake} reduced={reduced} /><PlayerBubble height={OFFICE_FIGURE_HEIGHT_M + 0.49} /><OfficeAgents desks={desks} agents={agents} ctx={walkers} newcomers={newcomers} awake={awake} reduced={reduced} chats={chats}selectedId={selection?.kind === "agent" ? selection.id : null} onSelect={(id) => select({ kind: "agent", id })} />+ {floor === "coding" && <GigiCompanion grid={grid} awake={awake} reduced={reduced} />}<OfficeCameraRig layout={layout} overview={overview} /></>);diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsxindex 09672216c2..c14b9c9b98 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx@@ -2,7 +2,9 @@* Agents > Map: the office. The person walks their own character through the* floor (or zooms out and clicks), agents live their day according to their* real run state, and checkpoints turn rooms into actions: create, manage,- * team up, dress up, talk to the lead, call a coffee break.+ * team up, dress up, talk to the lead, call a coffee break. One elevator ride+ * up is the coding floor: a figure per IDE coding session, its terminal live+ * on the monitor, and Gigi flying along with the person.*/import { Component, Suspense, useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";import { useQueryClient } from "@tanstack/react-query";@@ -12,6 +14,7 @@ import { useCanvasAwake } from "@/hooks/useCanvasAwake";import { useWebglSurface } from "@/hooks/useWebglSurface";import { useWebglSupported } from "@/lib/graphDimension";import { useT } from "@/i18n";+import { useEventStore } from "@/store/events";import { useSocietyRoster, type SocietyAgent } from "../data";import { OfficeScene } from "./OfficeScene";import { allDesks, buildOfficeLayout, countStates, MAX_SEATED } from "./officeLayout";@@ -21,16 +24,20 @@ import { CAMERA_FOV } from "./officeCamera";import { ZOOM_SECONDS } from "./OfficeCameraRig";import { useDeskChats } from "./useDeskChats";import type { Point } from "./officeLayout";-import { player, useOfficeStore } from "./officeStore";-import { agentPositions, knownAgents, seatedAtDesk } from "./walkerRegistry";+import { otherFloor, player, switchFloor, useOfficeStore, type OfficeFloor } from "./officeStore";+import { agentPositions, seatedAtDesk } from "./walkerRegistry";+import { useCodingFloorOccupants, type PaneOccupant } from "./codingFloor";+import { openPaneSession } from "./codingNavigate";+import { knownOnFloor, noteArrivals } from "./officeFloors";import { loadProfile, playerLook, saveProfile, type PlayerProfile } from "./playerProfile";-import { AgentPanel, CheckpointPanel, type OfficeActions } from "./OfficePanels";+import { AgentPanel, CheckpointPanel, PaneAgentPanel, type OfficeActions } from "./OfficePanels";import type { WalkerContext } from "./OfficeAgents";import { ownsKeyboard } from "./OfficePlayer";import { ArcadeCabinet } from "./ArcadeCabinet";import "./office.css";import "./officeHud.css";import "./officeMinimap.css";+import "./officeFloors.css";import { OfficeMinimap } from "./OfficeMinimap";import { OfficeCompass } from "./OfficeCompass";import { OfficeFullMap } from "./OfficeFullMap";@@ -44,6 +51,12 @@ if (import.meta.env.DEV && typeof window !== "undefined") Object.assign(window,const REFRESH_MS = 5000;const REFRESH_JITTER_MS = 1500;+const EMPTY_OCCUPANTS: ReadonlyMap<string, PaneOccupant> = new Map();++/** Elevator doors: closing, the ride (held until the new floor has loaded, capped), opening. */+const DOORS_MS = 520;+const RIDE_MAX_MS = 1400;+class RenderBoundary extends Component<{ children: ReactNode; fallbackText: string }, { failed: boolean }> {state = { failed: false };static getDerivedStateFromError() { return { failed: true }; }@@ -54,10 +67,15 @@ class RenderBoundary extends Component<{ children: ReactNode; fallbackText: stri}export interface OfficeStageProps {- onOpenLedger: () => void;+ /** The agents list (the IDE tab passes its own sessions list). */+ onOpenLedger?: () => void;onSelectAgent?: (id: string | null) => void;onCreateAgent?: () => void;onOpenGroup?: (groupId: string) => void;+ /** The floor to show on mount; without it the office opens on the floor it was left on. */+ initialFloor?: OfficeFloor;+ /** A narrow host (the IDE side panel): smaller HUD, no minimap or compass. */+ compact?: boolean;}function useRosterRefresh(awake: boolean) {@@ -76,32 +94,35 @@ function useRosterRefresh(awake: boolean) {}, [awake, client]);}-/** Agents created while the office is open arrive by the elevator; everyone else is simply there. */-function useNewcomers(active: SocietyAgent[]): ReadonlySet<string> {- const [newcomers, setNewcomers] = useState<ReadonlySet<string>>(new Set());+/**+ * Agents created while the office is open arrive by the elevator; everyone+ * else is simply there. Each floor keeps its own memory, so riding up or down+ * never makes a whole floor "arrive".+ */+function useNewcomers(active: SocietyAgent[], floor: OfficeFloor): ReadonlySet<string> {+ const [newcomers, setNewcomers] = useState<{ floor: OfficeFloor; ids: ReadonlySet<string> }>({ floor, ids: new Set() });useEffect(() => {- if (active.length === 0) return;- if (knownAgents.size === 0) { active.forEach((a) => knownAgents.add(a.agentId)); return; }- // Forget agents that left, so the set never outgrows the roster.- const present = new Set(active.map((a) => a.agentId));- for (const id of [...knownAgents]) if (!present.has(id)) knownAgents.delete(id);- const fresh = active.filter((a) => !knownAgents.has(a.agentId)).map((a) => a.agentId);+ const fresh = noteArrivals(knownOnFloor(floor), active.map((a) => a.agentId));if (fresh.length === 0) return;- fresh.forEach((id) => knownAgents.add(id));- setNewcomers((prev) => new Set([...prev, ...fresh]));- }, [active]);- return newcomers;+ setNewcomers((prev) => ({ floor, ids: new Set([...(prev.floor === floor ? prev.ids : []), ...fresh]) }));+ }, [active, floor]);+ return newcomers.floor === floor ? newcomers.ids : EMPTY_IDS;}+const EMPTY_IDS: ReadonlySet<string> = new Set();-export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpenGroup }: OfficeStageProps) {+export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpenGroup, initialFloor, compact = false }: OfficeStageProps) {const t = useT();const hostRef = useRef<HTMLDivElement>(null);const awake = useCanvasAwake(hostRef);const reduced = useReducedMotion() ?? false;const { generation } = useWebglSurface(hostRef);const webgl = useWebglSupported();+ // A mount that names a floor opens there (e.g. the IDE tab on the coding floor).+ useState(() => { if (initialFloor) switchFloor(initialFloor, false); return null; });+ const floor = useOfficeStore((s) => s.floor);+ const coding = floor === "coding";const roster = useSocietyRoster();- useRosterRefresh(awake);+ useRosterRefresh(awake && !coding);const [overview, setOverview] = useState(0);const [mapOpen, setMapOpen] = useState(false);const [profile, setProfile] = useState<PlayerProfile>(loadProfile);@@ -110,13 +131,22 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpenconst follow = useOfficeStore((s) => s.follow);const select = useOfficeStore((s) => s.select);- const active = useMemo(() => (roster.data?.agents ?? []).filter((a) => a.lifecycle !== "archived"), [roster.data]);+ // The elevator panel tells how many are upstairs, so it wakes the coding roster too.+ const elevatorOpen = selection?.kind === "checkpoint" && selection.id === "elevator";+ const codingFloor = useCodingFloorOccupants(coding || elevatorOpen);+ const jarvisAgents = useMemo(() => (roster.data?.agents ?? []).filter((a) => a.lifecycle !== "archived"), [roster.data]);+ const codingAgents = useMemo(() => codingFloor.occupants.map((o) => o.agent), [codingFloor.occupants]);+ const active = coding ? codingAgents : jarvisAgents;+ const ready = coding ? codingFloor.loaded : !!roster.data;+ const occupants = useMemo(() => (coding ? codingFloor.byAgentId : EMPTY_OCCUPANTS), [coding, codingFloor.byAgentId]);+ const occupantsRef = useRef(occupants);+ occupantsRef.current = occupants;const agents = useMemo(() => new Map<string, SocietyAgent>(active.map((a) => [a.agentId, a])), [active]);- const newcomers = useNewcomers(active);+ const newcomers = useNewcomers(active, floor);// The floor plan depends on who works where, never on run state: a status// refresh changes monitors and behaviour without re-seating anyone.- const seatingKey = active.map((a) => `${a.agentId}|${a.tier}|${a.providerLabel}|${a.createdMs}`).join(",");- const layout = useMemo(() => buildOfficeLayout(active),+ const seatingKey = floor + ":" + active.map((a) => `${a.agentId}|${a.tier}|${a.providerLabel}|${a.createdMs}`).join(",");+ const layout = useMemo(() => buildOfficeLayout(active, { variant: floor }),// eslint-disable-next-line react-hooks/exhaustive-deps[seatingKey]);const grid = useMemo(() => buildNavGrid(layout), [layout]);@@ -135,28 +165,69 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen};}, [layout, grid, book]);+ // Coding sessions have no desk chat; their monitors poll the terminal instead.const sessions = useMemo(() => new Map(active.filter((a) => a.chatSessionId).map((a) => [a.agentId, a.chatSessionId as string])), [active]);- const chats = useDeskChats(sessions, awake);- // Clicking a monitor dives into it, then opens that agent's chat.+ const chats = useDeskChats(sessions, awake && !coding);+ // Opening someone: a coding agent opens its IDE pane; a Jarvis agent its chat+ // (a host without an agent view, like the IDE tab, goes to the Agents section).+ const openAgent = useCallback((agentId: string) => {+ const occupant = occupantsRef.current.get(agentId);+ if (occupant) { openPaneSession(occupant.pane); return; }+ if (onSelectAgent) onSelectAgent(agentId);+ else useEventStore.getState().setActiveSection("agents");+ }, [onSelectAgent]);+ // Clicking a monitor dives into it, then opens that agent's chat (or IDE session).const openTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);useEffect(() => () => clearTimeout(openTimer.current), []);const [diving, setDiving] = useState(false);const openScreen = useCallback((agentId: string, screen: Point & { y: number }, facing: number) => {select(null);clearTimeout(openTimer.current);- if (reduced) { onSelectAgent?.(agentId); return; }+ if (reduced) { openAgent(agentId); return; }useOfficeStore.getState().zoomInto([screen.x, screen.y, screen.z], facing);// The screen fills the view, then the real chat view fades in over it.setDiving(true);- openTimer.current = setTimeout(() => { onSelectAgent?.(agentId); setDiving(false); }, ZOOM_SECONDS * 1000 + 260);- }, [onSelectAgent, reduced, select]);+ openTimer.current = setTimeout(() => { openAgent(agentId); setDiving(false); }, ZOOM_SECONDS * 1000 + 260);+ }, [openAgent, reduced, select]);++ // The elevator: doors close, the floor switches behind them, doors open once+ // the new floor has loaded (capped). Reduced motion switches at once.+ const [ride, setRide] = useState<{ to: OfficeFloor; phase: "closing" | "riding" | "opening" } | null>(null);+ const rideTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);+ useEffect(() => () => clearTimeout(rideTimer.current), []);+ const takeElevator = useCallback((to: OfficeFloor) => {+ if (ride || to === useOfficeStore.getState().floor) return;+ if (reduced) { switchFloor(to, true); return; }+ useOfficeStore.getState().select(null);+ setRide({ to, phase: "closing" });+ rideTimer.current = setTimeout(() => {+ switchFloor(to, true);+ setRide({ to, phase: "riding" });+ rideTimer.current = setTimeout(() => setRide((r) => (r?.phase === "riding" ? { to, phase: "opening" } : r)), RIDE_MAX_MS);+ }, DOORS_MS);+ }, [reduced, ride]);+ useEffect(() => {+ if (ride?.phase === "riding" && floor === ride.to && ready) {+ clearTimeout(rideTimer.current);+ rideTimer.current = setTimeout(() => setRide({ to: ride.to, phase: "opening" }), 160);+ }+ if (ride?.phase === "opening") {+ clearTimeout(rideTimer.current);+ rideTimer.current = setTimeout(() => setRide(null), DOORS_MS);+ }+ }, [ride, floor, ready]);const counts = countStates(active);const updateProfile = useCallback((next: PlayerProfile) => { setProfile(next); saveProfile(next); }, []);+ // The coding floor's list is the IDE (or, in the IDE tab, its sessions list).+ const openList = useCallback(() => {+ if (coding && !compact) useEventStore.getState().setActiveSection("agentic-ide");+ else onOpenLedger?.();+ }, [coding, compact, onOpenLedger]);const actions = useMemo<OfficeActions>(() => ({- onOpenAgent: (id) => onSelectAgent?.(id),- onOpenLedger, onCreateAgent, onOpenGroup,- }), [onSelectAgent, onOpenLedger, onCreateAgent, onOpenGroup]);+ onOpenAgent: openAgent,+ onOpenLedger: openList, onCreateAgent, onOpenGroup,+ }), [openAgent, openList, onCreateAgent, onOpenGroup]);// Escape closes an open panel before it can leave the map.useEffect(() => {@@ -181,21 +252,24 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen// A panel for an agent that left the roster closes itself.useEffect(() => {- if (selection?.kind === "agent" && roster.data && !agents.has(selection.id)) select(null);- }, [selection, agents, roster.data, select]);+ if (selection?.kind === "agent" && ready && !agents.has(selection.id)) select(null);+ }, [selection, agents, ready, select]);const selectedAgent = selection?.kind === "agent" ? agents.get(selection.id) ?? null : null;+ const selectedPane = selectedAgent ? occupants.get(selectedAgent.agentId) ?? null : null;const nearbyLabel = nearby? nearby.kind === "agent"- ? t("society.office.prompt_agent").replace("{0}", agents.get(nearby.id)?.name ?? "")+ ? t(coding ? "society.office.prompt_pane" : "society.office.prompt_agent").replace("{0}", agents.get(nearby.id)?.name ?? ""): nearby.kind === "arcade"? t("society.office.arcade_prompt"): t(`society.office.cp_${nearby.id}_hint`): null;+ const titleKey = coding ? "society.office.coding_title" : "society.office.title";const playerName = profile.name.trim() || t("society.office.you");return (- <section className="office-stage" aria-label={t("society.office.title")} data-office-agents={active.length}>+ <section className={compact ? "office-stage office-stage-compact" : "office-stage"} aria-label={t(titleKey)}+ data-office-agents={active.length} data-office-floor={floor}><div ref={hostRef} className="office-viewport" tabIndex={0} role="application" aria-label={t("society.office.viewport")}>{webgl ? (<RenderBoundary key={generation} fallbackText={t("society.office.no_graphics")}>@@ -204,7 +278,7 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpengl={{ antialias: true, alpha: true, preserveDrawingBuffer: import.meta.env.DEV }}frameloop={!awake ? "never" : "always"}onPointerMissed={() => select(null)}>- <OfficeScene layout={layout} grid={grid} walkers={walkers} agents={agents} newcomers={newcomers}+ <OfficeScene floor={floor} occupants={occupants} ready={ready} layout={layout} grid={grid} walkers={walkers} agents={agents} newcomers={newcomers}awake={awake} reduced={reduced} overview={overview} player={{ look: playerLook(profile), name: playerName }}selection={selection} nearby={nearby} chats={chats} onOpenScreen={openScreen} /></Canvas>@@ -215,8 +289,8 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen<div className="office-hud office-hud-left" data-office-ui><div className="office-card office-title">- <strong>{t("society.office.title")}</strong>- <span>{t("society.office.subtitle").replace("{0}", String(active.length))}</span>+ <strong>{t(titleKey)}</strong>+ <span>{t(coding ? "society.office.coding_subtitle" : "society.office.subtitle").replace("{0}", String(active.length))}</span></div><div className="office-card office-counts" role="status" aria-live="polite"><span data-tone="working"><i aria-hidden />{t("society.office.count_working").replace("{0}", String(counts.working))}</span>@@ -224,7 +298,8 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen<span data-tone="idle"><i aria-hidden />{t("society.office.count_idle").replace("{0}", String(counts.idle))}</span>{counts.paused > 0 && <span data-tone="paused"><i aria-hidden />{t("society.office.count_paused").replace("{0}", String(counts.paused))}</span>}</div>- {roster.data?.sample && <p className="office-card office-note">{t("society.office.sample")}</p>}+ {!coding && roster.data?.sample && <p className="office-card office-note">{t("society.office.sample")}</p>}+ {coding && codingFloor.loaded && active.length === 0 && <p className="office-card office-note">{t("society.office.coding_empty")}</p>}{active.length > MAX_SEATED && <p className="office-card office-note">{t("society.office.overflow").replace("{0}", String(MAX_SEATED))}</p>}</div>@@ -232,18 +307,25 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen<button type="button" className="office-button" aria-pressed={follow} onClick={() => useOfficeStore.getState().setFollow(true)}>{t("society.office.me")}</button><button type="button" className="office-button" onClick={() => setOverview((v) => v + 1)}>{t("society.office.overview")}</button><button type="button" className="office-button" onClick={() => select({ kind: "checkpoint", id: "wardrobe" })}>{t("society.office.cp_wardrobe")}</button>- <button type="button" className="office-button" onClick={onOpenLedger}>{t("society.office.ledger")}</button>+ <button type="button" className="office-button" data-office-floor-switch disabled={!!ride}+ onClick={() => takeElevator(otherFloor(floor))}>{t(coding ? "society.office.floor_down" : "society.office.floor_up")}</button>+ {(!coding || !compact || onOpenLedger) && (+ <button type="button" className="office-button" onClick={openList}>+ {t(coding ? (compact ? "society.office.ledger_coding" : "society.office.open_ide") : "society.office.ledger")}+ </button>+ )}</div>{selection?.kind === "arcade" && <ArcadeCabinet onClose={() => select(null)} />}{selection && selection.kind !== "arcade" && (<div className="office-panel-slot">- {selection.kind === "agent" && selectedAgent && (- <AgentPanel agent={selectedAgent} actions={actions} onClose={() => select(null)} />- )}+ {selection.kind === "agent" && selectedAgent && (selectedPane+ ? <PaneAgentPanel occupant={selectedPane} onOpen={() => openPaneSession(selectedPane.pane)} onClose={() => select(null)} />+ : <AgentPanel agent={selectedAgent} actions={actions} onClose={() => select(null)} />)}{selection.kind === "checkpoint" && (- <CheckpointPanel id={selection.id} agents={active} layout={layout} sample={roster.data?.sample ?? false}- profile={profile} onProfile={updateProfile} actions={actions} onClose={() => select(null)} />+ <CheckpointPanel id={selection.id} floor={floor} agents={active} layout={layout} sample={!coding && (roster.data?.sample ?? false)}+ profile={profile} onProfile={updateProfile} actions={actions} onClose={() => select(null)}+ elevator={{ jarvis: jarvisAgents.length, coding: codingFloor.loaded ? codingFloor.occupants.length : null, onRide: takeElevator }} />)}</div>)}@@ -253,13 +335,20 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen<kbd>E</kbd>{nearbyLabel}</button>)}- <OfficeCompass layout={layout} agents={agents} selectedId={selection?.kind === "agent" ? selection.id : null} />+ {!compact && <OfficeCompass layout={layout} agents={agents} selectedId={selection?.kind === "agent" ? selection.id : null} />}{diving && <div className="office-dive-fade" aria-hidden />}- <OfficeMinimap layout={layout} agents={agents} selectedId={selection?.kind === "agent" ? selection.id : null}- onOpenMap={() => setMapOpen(true)} />+ {ride && (+ <div className="office-elevator" data-phase={ride.phase} role="status" aria-live="polite">+ <i className="office-elevator-door" data-side="left" aria-hidden />+ <i className="office-elevator-door" data-side="right" aria-hidden />+ <span className="office-elevator-sign">{t(ride.to === "coding" ? "society.office.riding_up" : "society.office.riding_down")}</span>+ </div>+ )}+ {!compact && <OfficeMinimap layout={layout} agents={agents} selectedId={selection?.kind === "agent" ? selection.id : null}+ onOpenMap={() => setMapOpen(true)} />}<OfficeFullMap open={mapOpen} onOpen={() => setMapOpen(true)} onClose={() => setMapOpen(false)}layout={layout} agents={agents} selectedId={selection?.kind === "agent" ? selection.id : null} />- <p className="office-hud office-help" data-office-ui>{t("society.office.help")}</p>+ {!compact && <p className="office-hud office-help" data-office-ui>{t("society.office.help")}</p>}</section>);}diff --git a/jarvis/ui/web/frontend/src/components/society/office/TerminalMonitors.tsx b/jarvis/ui/web/frontend/src/components/society/office/TerminalMonitors.tsxnew file mode 100644index 0000000000..7adbaabc0c--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/TerminalMonitors.tsx@@ -0,0 +1,113 @@+/**+ * Desk monitors on the coding floor: each shows its pane's terminal live+ * while the agent sits at the desk, a dim screensaver otherwise. A click on a+ * screen zooms the camera into it; the caller then opens that session.+ */+import { useEffect, useMemo, useRef, useState } from "react";+import { useFrame, type ThreeEvent } from "@react-three/fiber";+import { CanvasTexture, SRGBColorSpace } from "three";+import type { PaneScreen } from "@/lib/paneScreensApi";+import type { DeskSlot, Point } from "./officeLayout";+import type { PaneOccupant } from "./codingFloor";+import { drawTerminalScreen, paneDot, TERMINAL_H, TERMINAL_W } from "./terminalScreen";+import { MAX_SCREEN_TARGETS, usePaneScreens, type PaneScreenTarget } from "./usePaneScreens";+import { seatedAtDesk } from "./walkerRegistry";++/** Mirrors LiveMonitors: same place as the instanced screen, a hair in front of it. */+const SCREEN_Y = 1.18, SCREEN_Z = -0.2095, SCREEN_W = 0.66, SCREEN_H = 0.38;+/** How often the nearest-seated set is re-read, in seconds. */+const NEAR_CHECK_S = 0.4;++/** The nearest seated agents to the camera, at most `limit`, as a sorted id list. Pure. */+export function nearestSeated(candidates: { id: string; distance: number }[], limit = MAX_SCREEN_TARGETS): string[] {+ return [...candidates].sort((a, b) => a.distance - b.distance).slice(0, limit).map((c) => c.id).sort();+}++function Screen({ desk, occupant, screen, onOpen }: {+ desk: DeskSlot; occupant: PaneOccupant; screen: PaneScreen | undefined;+ onOpen: (agentId: string, screen: Point & { y: number }, facing: number) => void;+}) {+ const hovered = useRef(false);+ const agentId = occupant.agent.agentId;+ const [seated, setSeated] = useState(() => seatedAtDesk.has(agentId));+ const turn = desk.facing === "north" ? 0 : Math.PI;+ const surface = useMemo(() => {+ const canvas = typeof document !== "undefined" ? document.createElement("canvas") : null;+ const ctx = canvas?.getContext("2d") ?? null;+ if (!canvas || !ctx) return null;+ canvas.width = TERMINAL_W; canvas.height = TERMINAL_H;+ const texture = new CanvasTexture(canvas);+ texture.colorSpace = SRGBColorSpace;+ texture.anisotropy = 4;+ return { ctx, texture };+ }, []);+ useEffect(() => () => {+ surface?.texture.dispose();+ if (hovered.current) document.body.style.cursor = "";+ }, [surface]);+ const name = occupant.agent.name;+ const dot = paneDot(occupant.pane);+ const shown = seated ? screen : undefined;+ useEffect(() => {+ if (!surface) return;+ drawTerminalScreen(surface.ctx, { name, dot }, shown);+ surface.texture.needsUpdate = true;+ }, [surface, name, dot, shown]);+ // Seating is a per-frame module set; only its flips reach React.+ useFrame(() => {+ const now = seatedAtDesk.has(agentId);+ if (now !== seated) setSeated(now);+ });+ if (!surface) return null;+ // World position of the screen centre, for the zoom.+ const sx = desk.x + Math.sin(turn) * SCREEN_Z, sz = desk.z + Math.cos(turn) * SCREEN_Z;+ const click = (event: ThreeEvent<MouseEvent>) => {+ if (event.delta > 6) return;+ event.stopPropagation();+ onOpen(agentId, { x: sx, y: SCREEN_Y, z: sz }, turn);+ };+ return (+ <group position={[desk.x, 0, desk.z]} rotation={[0, turn, 0]}>+ <mesh position={[0, SCREEN_Y, SCREEN_Z]} onClick={click}+ onPointerOver={() => { hovered.current = true; document.body.style.cursor = "zoom-in"; }}+ onPointerOut={() => { hovered.current = false; document.body.style.cursor = ""; }}>+ <planeGeometry args={[SCREEN_W, SCREEN_H]} />+ <meshBasicMaterial map={surface.texture} toneMapped={false} />+ </mesh>+ </group>+ );+}++export function TerminalMonitors({ desks, occupants, awake, onOpen }: {+ desks: DeskSlot[]; occupants: ReadonlyMap<string, PaneOccupant>; awake: boolean;+ onOpen: (agentId: string, screen: Point & { y: number }, facing: number) => void;+}) {+ const [near, setNear] = useState<string[]>([]);+ const nextCheck = useRef(0);+ useFrame(({ camera, clock }) => {+ if (clock.elapsedTime < nextCheck.current) return;+ nextCheck.current = clock.elapsedTime + NEAR_CHECK_S;+ const candidates: { id: string; distance: number }[] = [];+ for (const desk of desks) {+ if (!desk.agentId || !occupants.has(desk.agentId) || !seatedAtDesk.has(desk.agentId)) continue;+ candidates.push({ id: desk.agentId, distance: Math.hypot(camera.position.x - desk.x, camera.position.y - SCREEN_Y, camera.position.z - desk.z) });+ }+ const next = nearestSeated(candidates);+ if (next.length !== near.length || next.some((id, i) => id !== near[i])) setNear(next);+ });+ const targets = useMemo<PaneScreenTarget[]>(() => near.flatMap((agentId) => {+ const pane = occupants.get(agentId)?.pane;+ return pane ? [{ agentId, workspaceId: pane.workspace_id, key: pane.key }] : [];+ }), [near, occupants]);+ const screens = usePaneScreens(targets, awake);+ return (+ <group>+ {desks.map((desk) => {+ const occupant = desk.agentId ? occupants.get(desk.agentId) : undefined;+ return occupant+ ? <Screen key={desk.id} desk={desk} occupant={occupant} screen={screens.get(occupant.agent.agentId)} onOpen={onOpen} />+ : null;+ })}+ </group>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/office/codingFloor.test.ts b/jarvis/ui/web/frontend/src/components/society/office/codingFloor.test.tsnew file mode 100644index 0000000000..e5ec656126--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/codingFloor.test.ts@@ -0,0 +1,166 @@+/**+ * The coding floor's roster: IDE panes projected into office figures — which+ * panes count, what they are called, where they stand, how they look, and+ * that a status change does not rebuild the figures that did not change.+ */+import { act, renderHook } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it } from "vitest";++import type { WorkspacePaneRow } from "@/lib/agenticIdeApi";+import { resetWorkspacePanesPoll, useWorkspacePanesStore } from "@/store/workspacePanes";++import {+ isPaneAgentId, paneAgentId, paneFigure, paneLabel, paneOccupants, paneRunState, useCodingFloorOccupants,+} from "./codingFloor";+import { allDesks, buildOfficeLayout } from "./officeLayout";+import { toyLookFor } from "./toyFigureModel";++function pane(name: string, workspaceId: string, overrides: Partial<WorkspacePaneRow> = {}): WorkspacePaneRow {+ return {+ workspace_id: workspaceId,+ workspace_name: workspaceId === "w1" ? "Personal Jarvis" : "Website",+ folder: "/home/dev/project",+ workspace_active: true,+ key: name,+ history_id: `${name}@${workspaceId}`,+ name,+ agent: "claude",+ display_name: "Claude Code",+ accepts_prompts: true,+ status: "live",+ exit_code: null,+ activity: "working",+ activity_since: 1000,+ worked: true,+ started_at: 100,+ last_output_at: 2,+ last_prompt: "Fix the router",+ last_prompt_at: 90,+ recap: "Refactor the router",+ has_resume: false,+ readable: true,+ account: null,+ account_label: null,+ archived: false,+ ...overrides,+ };+}++describe("coding floor roster", () => {+ it("names a pane's figure by workspace and lifetime id, never colliding with society ids", () => {+ const id = paneAgentId(pane("T1", "w1"));+ expect(id).toBe("pane:w1:T1@w1");+ expect(isPaneAgentId(id)).toBe(true);+ expect(isPaneAgentId("research-scout")).toBe(false);+ expect(paneAgentId({ workspace_id: "w1", history_id: "", key: "T3" })).toBe("pane:w1:T3");+ });++ it("keeps coding panes only, ordered by workspace, then start time, then call-sign", () => {+ const rows = [+ pane("T3", "w1", { started_at: 50 }),+ pane("sh", "w1", { agent: "shell", display_name: "Shell" }),+ pane("T1", "w2"),+ pane("T2", "w1", { archived: true }),+ pane("T10", "w1", { started_at: 100 }),+ pane("T9", "w1", { started_at: 100 }),+ ];+ expect(paneOccupants(rows).map((o) => `${o.pane.workspace_name}/${o.pane.name}`))+ .toEqual(["Personal Jarvis/T3", "Personal Jarvis/T9", "Personal Jarvis/T10", "Website/T1"]);+ });++ it("labels the plate with the CLI and call-sign, and keeps the recap as the title", () => {+ const [occupant] = paneOccupants([pane("T2", "w1", { display_name: "Gemini CLI", agent: "gemini" })]);+ expect(occupant.agent.name).toBe("Gemini · T2");+ expect(occupant.agent.title).toBe("Refactor the router");+ expect(paneLabel({ display_name: "", agent: "codex", name: "", key: "T4" })).toBe("Codex · T4");+ expect(occupant.agent.providerLabel).toBe("Personal Jarvis");+ expect(occupant.agent.tier).toBe("specialist");+ expect(occupant.agent.chatSessionId).toBeNull();+ expect(occupant.agent.createdMs).toBe(100_000);+ });++ it("gives same-named workspaces their own departments", () => {+ const occupants = paneOccupants([pane("T1", "a", { workspace_name: "App" }), pane("T1", "b", { workspace_name: "App" })]);+ expect(occupants.map((o) => o.agent.providerLabel)).toEqual(["App", "App 2"]);+ });++ it("maps the pane's state onto where its figure stands", () => {+ expect(paneRunState(pane("T1", "w1", { activity: "working" }))).toBe("working");+ expect(paneRunState(pane("T1", "w1", { activity: "starting" }))).toBe("working");+ expect(paneRunState(pane("T1", "w1", { status: "pending", activity: "" }))).toBe("working");+ expect(paneRunState(pane("T1", "w1", { activity: "asking" }))).toBe("waiting");+ // An errored pane stands at its desk too; the occupant keeps the real word.+ const [failed] = paneOccupants([pane("T1", "w1", { activity: "failed" })]);+ expect(failed.agent.state).toBe("waiting");+ expect(failed.dot).toBe("error");+ expect(failed.stateKey).toBe("failed");+ expect(paneRunState(pane("T1", "w1", { status: "error", activity: "" }))).toBe("waiting");+ expect(paneRunState(pane("T1", "w1", { activity: "waiting" }))).toBe("idle");+ expect(paneRunState(pane("T1", "w1", { status: "exited", activity: "exited" }))).toBe("idle");+ });++ it("dresses each pane randomly but stably", () => {+ expect(paneFigure("abc")).toEqual(paneFigure("abc"));+ const looks = Array.from({ length: 24 }, (_, i) => toyLookFor(paneFigure(`h${i}`), `pane:w:h${i}`));+ const distinct = (key: keyof (typeof looks)[number]) => new Set(looks.map((l) => l[key])).size;+ expect(distinct("skin")).toBeGreaterThan(2);+ expect(distinct("hair")).toBeGreaterThan(2);+ expect(distinct("hairStyle")).toBeGreaterThan(2);+ expect(distinct("shirt")).toBeGreaterThan(3);+ expect(distinct("pants")).toBeGreaterThan(1);+ expect(distinct("outfit")).toBeGreaterThan(2);+ });++ it("seats every occupant at a desk of its workspace's department on the coding floor", () => {+ const rows = [pane("T1", "w1"), pane("T2", "w1", { activity: "asking" }), pane("T1", "w2", { activity: "" })];+ const occupants = paneOccupants(rows);+ const layout = buildOfficeLayout(occupants.map((o) => o.agent), { variant: "coding" });+ const seated = new Map(allDesks(layout).filter((d) => d.agentId).map((d) => [d.agentId!, d.id]));+ expect(seated.size).toBe(3);+ for (const o of occupants) {+ const dept = layout.departments.find((d) => d.desks.some((desk) => desk.agentId === o.agent.agentId))!;+ expect(dept.label).toBe(o.agent.providerLabel);+ }+ });+});++describe("useCodingFloorOccupants", () => {+ beforeEach(() => {+ resetWorkspacePanesPoll();+ useWorkspacePanesStore.setState({ panes: [pane("T1", "w1"), pane("T2", "w1")], activeId: "w1", loaded: true, load: async () => {} });+ });+ afterEach(() => resetWorkspacePanesPoll());++ it("keeps unchanged occupants' identity when another pane changes state", () => {+ const { result } = renderHook(() => useCodingFloorOccupants(true));+ const before = result.current;+ expect(before.loaded).toBe(true);+ expect(before.occupants).toHaveLength(2);++ // A fresh poll with new row objects but the same content, output ticking: nothing changes.+ act(() => {+ useWorkspacePanesStore.setState({ panes: [pane("T1", "w1", { last_output_at: 9 }), pane("T2", "w1", { last_output_at: 9 })] });+ });+ expect(result.current).toBe(before);++ act(() => {+ useWorkspacePanesStore.setState({ panes: [pane("T1", "w1"), pane("T2", "w1", { activity: "asking" })] });+ });+ const after = result.current;+ expect(after).not.toBe(before);+ expect(after.occupants[0]).toBe(before.occupants[0]);+ expect(after.occupants[1]).not.toBe(before.occupants[1]);+ expect(after.occupants[1].agent.state).toBe("waiting");+ expect(after.byAgentId.get(paneAgentId(pane("T2", "w1")))).toBe(after.occupants[1]);+ });++ it("starts no poll while disabled", () => {+ let loads = 0;+ useWorkspacePanesStore.setState({ load: async () => { loads += 1; } });+ const { rerender, unmount } = renderHook(({ on }) => useCodingFloorOccupants(on), { initialProps: { on: false } });+ expect(loads).toBe(0);+ rerender({ on: true });+ expect(loads).toBe(1);+ unmount();+ });+});diff --git a/jarvis/ui/web/frontend/src/components/society/office/codingFloor.ts b/jarvis/ui/web/frontend/src/components/society/office/codingFloor.tsnew file mode 100644index 0000000000..791ef3a563--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/codingFloor.ts@@ -0,0 +1,226 @@+/**+ * The coding floor's roster: every coding-agent pane of the Agentic IDE as a+ * figure in the office, one floor above the society agents.+ *+ * A pane is not a society agent — it has no chat session, no budget and no+ * grants — but the office renders `SocietyAgent`s, so each pane is projected+ * into one here: its call-sign names it, its workspace is its department, its+ * run state picks where it stands, and a hash of the pane's lifetime id+ * (`history_id`) dresses it. The same pane always looks the same; two panes+ * almost never do.+ *+ * Pure except for `useCodingFloorOccupants`, which rides the shared,+ * reference-counted pane poll in `store/workspacePanes` — it adds no timer of+ * its own.+ */+import { useMemo, useRef } from "react";++import type { WorkspacePaneRow } from "@/lib/agenticIdeApi";+import { useWorkspacePanes, useWorkspacePanesStore } from "@/store/workspacePanes";+import { dotKindFor, stateKeyFor, type AgentDotKind, type AgentStateKey } from "@/components/agentic/sidePanel/agentStatus";++import type { AgentRunState, SocietyAgent } from "../data";+import { resolvePalette, type FigureRecipe } from "../figures/figureRecipe";+import { hashString, SKIN_TONES } from "./toyFigureModel";+import { randomLook } from "./wardrobe";++export interface PaneOccupant {+ agent: SocietyAgent;+ pane: WorkspacePaneRow;+ /** The IDE's own four-colour reading of the pane (the side panel's dot). */+ dot: AgentDotKind;+ /** The finer word behind the dot ("starting", "needs_input", "failed", …). */+ stateKey: AgentStateKey;+}++const PANE_ID_PREFIX = "pane:";++/** The office id of a pane's figure: stable for the pane's lifetime, even when its call-sign is reused. */+export function paneAgentId(pane: Pick<WorkspacePaneRow, "workspace_id" | "history_id" | "key">): string {+ return `${PANE_ID_PREFIX}${pane.workspace_id}:${pane.history_id || pane.key}`;+}++export function isPaneAgentId(id: string): boolean {+ return id.startsWith(PANE_ID_PREFIX);+}++/** Coding panes only: a shell is not an agent, and an archived pane is hidden from every list. */+export function isCodingPane(pane: WorkspacePaneRow): boolean {+ return !pane.archived && pane.agent !== "shell";+}++/**+ * The office run state of a pane.+ *+ * working / starting / pending → "working": it sits at its screen.+ * asking → "waiting": it stands at its desk and waves for the person.+ * error / failed → "waiting" as well. The office has no error pose, and the+ * two alternatives are both wrong: "idle" would send a broken session off to+ * the coffee bar as if nothing happened, "paused" would put it to sleep on the+ * couch. A failed session needs the person just like an asking one, so it+ * stands at its desk; `PaneOccupant.dot` / `stateKey` still say "error", so+ * the panel and name plate can show that word instead of "waiting".+ * idle / done / exited → "idle": it wanders.+ */+export function paneRunState(pane: WorkspacePaneRow, dot: AgentDotKind = dotKindFor(pane)): AgentRunState {+ if (dot === "working") return "working";+ if (dot === "idle") return "idle";+ return "waiting";+}++/** "Claude Code" → "Claude", "Gemini CLI" → "Gemini"; the agent id when the pane names no CLI. */+export function shortAgentName(pane: Pick<WorkspacePaneRow, "display_name" | "agent">): string {+ const first = pane.display_name.trim().split(/\s+/)[0] ?? "";+ if (first) return first;+ const agent = pane.agent.trim();+ return agent ? agent.charAt(0).toUpperCase() + agent.slice(1) : "Agent";+}++/** The name plate: the CLI and the pane's call-sign, "Claude · T2". */+export function paneLabel(pane: Pick<WorkspacePaneRow, "display_name" | "agent" | "name" | "key">): string {+ return `${shortAgentName(pane)} · ${pane.name || pane.key}`;+}++function workspaceLabel(pane: WorkspacePaneRow): string {+ const name = pane.workspace_name.trim();+ if (name) return name;+ const folder = pane.folder.replace(/[\\/]+$/, "").split(/[\\/]/).pop() ?? "";+ return folder || "Workspace";+}++const BASE_RECIPE: FigureRecipe = { contract: 1, archetype: "biped", base: "rogue", parts: {}, palette: {} };++/**+ * A random but stable look per pane: outfit, colourway, hair style and colour,+ * eyewear (the wardrobe's `randomLook`), plus a skin tone of its own — all from+ * the pane's `history_id`, so it survives a call-sign being reused.+ */+export function paneFigure(historyId: string): FigureRecipe {+ const seed = `coding:${historyId || "pane"}`;+ const look = randomLook(BASE_RECIPE, seed);+ const skin = SKIN_TONES[(Math.imul(hashString(seed) ^ 0x5151, 0x9e3779b1) >>> 0) % SKIN_TONES.length];+ return { ...look, palette: { ...look.palette, skin } };+}++function toAgent(pane: WorkspacePaneRow, department: string, dot: AgentDotKind): SocietyAgent {+ const figure = paneFigure(pane.history_id || `${pane.workspace_id}:${pane.key}`);+ const palette = resolvePalette(figure);+ return {+ agentId: paneAgentId(pane),+ name: paneLabel(pane),+ title: pane.recap || pane.last_prompt || pane.display_name || pane.agent,+ description: pane.last_prompt,+ tier: "specialist",+ provider: pane.agent,+ providerLabel: department,+ model: "",+ effort: "",+ accountId: pane.account ?? undefined,+ computerId: null,+ figure,+ palette: { primary: palette.primary, secondary: palette.secondary, accent: palette.accent },+ grantMode: "all",+ toolGrants: [],+ focus: [],+ denies: [],+ approvalRules: { requireApproval: [], alwaysAllow: [] },+ permissionCeiling: "ask",+ approvalMode: null,+ dailyBudgetUsd: 0,+ checkpoint: "idle",+ state: paneRunState(pane, dot),+ lifecycle: "active",+ createdMs: (pane.started_at ?? 0) * 1000,+ maxConcurrentRuns: 1,+ workspaceDir: pane.folder,+ wikiNamespace: "",+ chatSessionId: null,+ routines: [],+ stats: { runs: 0, totalCostUsd: 0, spentTodayUsd: 0, lastActiveMs: pane.last_prompt_at ? pane.last_prompt_at * 1000 : null },+ };+}++function byWorkspaceThenArrival(a: WorkspacePaneRow, b: WorkspacePaneRow): number {+ return workspaceLabel(a).localeCompare(workspaceLabel(b))+ || a.workspace_id.localeCompare(b.workspace_id)+ || (a.started_at ?? Infinity) - (b.started_at ?? Infinity)+ || a.name.localeCompare(b.name, undefined, { numeric: true })+ || a.history_id.localeCompare(b.history_id);+}++/**+ * The department label of every workspace. Two open workspaces with the same+ * name would otherwise share one department; the later one gets " 2", " 3".+ */+function departmentLabels(panes: readonly WorkspacePaneRow[]): Map<string, string> {+ const labels = new Map<string, string>();+ const used = new Map<string, number>();+ for (const pane of panes) {+ if (labels.has(pane.workspace_id)) continue;+ const base = workspaceLabel(pane);+ const n = (used.get(base) ?? 0) + 1;+ used.set(base, n);+ labels.set(pane.workspace_id, n === 1 ? base : `${base} ${n}`);+ }+ return labels;+}++/** Every coding pane as an office occupant, ordered by workspace, then start time, then call-sign. */+export function paneOccupants(panes: readonly WorkspacePaneRow[]): PaneOccupant[] {+ const coding = panes.filter(isCodingPane).sort(byWorkspaceThenArrival);+ const departments = departmentLabels(coding);+ return coding.map((pane) => {+ const dot = dotKindFor(pane);+ return { agent: toAgent(pane, departments.get(pane.workspace_id)!, dot), pane, dot, stateKey: stateKeyFor(pane, dot) };+ });+}++/**+ * What an occupant is built from. `last_output_at` ticks with every byte a+ * pane prints and changes nothing on the floor, so it is left out: a busy+ * terminal must not rebuild its figure four times a second.+ */+function occupantSignature(pane: WorkspacePaneRow, department: string): string {+ return `${department}|${JSON.stringify({ ...pane, last_output_at: null })}`;+}++export interface CodingFloorOccupants {+ occupants: PaneOccupant[];+ byAgentId: ReadonlyMap<string, PaneOccupant>;+ /** False until the pane list has answered once: an empty floor before that means "not yet". */+ loaded: boolean;+}++/**+ * The coding floor's roster, live. Subscribes to the shared pane poll only+ * while `enabled`; an occupant whose pane did not change keeps its object+ * identity across polls, and the list keeps its identity when nothing changed.+ */+export function useCodingFloorOccupants(enabled: boolean): CodingFloorOccupants {+ const panes = useWorkspacePanes(enabled);+ const loaded = useWorkspacePanesStore((s) => s.loaded);+ const cache = useRef<{ bySignature: Map<string, PaneOccupant>; result: CodingFloorOccupants | null }>({+ bySignature: new Map(), result: null,+ });+ return useMemo(() => {+ const fresh = paneOccupants(panes);+ const previous = cache.current;+ const bySignature = new Map<string, PaneOccupant>();+ const occupants = fresh.map((occupant) => {+ const signature = occupantSignature(occupant.pane, occupant.agent.providerLabel);+ const kept = previous.bySignature.get(signature) ?? occupant;+ bySignature.set(signature, kept);+ return kept;+ });+ const last = previous.result;+ const unchanged = last !== null && last.loaded === loaded && last.occupants.length === occupants.length+ && last.occupants.every((o, i) => o === occupants[i]);+ const result = unchanged ? last : {+ occupants,+ byAgentId: new Map(occupants.map((o) => [o.agent.agentId, o])),+ loaded,+ };+ cache.current = { bySignature, result };+ return result;+ }, [panes, loaded]);+}diff --git a/jarvis/ui/web/frontend/src/components/society/office/codingNavigate.test.ts b/jarvis/ui/web/frontend/src/components/society/office/codingNavigate.test.tsnew file mode 100644index 0000000000..173117f954--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/codingNavigate.test.ts@@ -0,0 +1,28 @@+import { afterEach, describe, expect, it } from "vitest";+import { useEventStore } from "@/store/events";+import { useIdeChatStore } from "@/store/ideChat";+import { openPaneSession } from "./codingNavigate";++describe("open a coding session from the office", () => {+ const initialSection = useEventStore.getState().activeSection;+ afterEach(() => {+ useEventStore.setState({ activeSection: initialSection });+ useIdeChatStore.setState({ paneRequest: null });+ });++ it("switches to the Agentic IDE and asks it to focus the pane", () => {+ useEventStore.setState({ activeSection: "visualization" });+ openPaneSession({ workspace_id: "ws-1", name: "T2" });+ expect(useEventStore.getState().activeSection).toBe("agentic-ide");+ expect(useIdeChatStore.getState().paneRequest).toMatchObject({ workspaceId: "ws-1", pane: "T2" });+ });++ it("stays in the IDE and issues a fresh request each time", () => {+ useEventStore.setState({ activeSection: "agentic-ide" });+ openPaneSession({ workspace_id: "ws-1", name: "T2" });+ const first = useIdeChatStore.getState().paneRequest!.nonce;+ openPaneSession({ workspace_id: "ws-1", name: "T2" });+ expect(useEventStore.getState().activeSection).toBe("agentic-ide");+ expect(useIdeChatStore.getState().paneRequest!.nonce).toBe(first + 1);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/society/office/codingNavigate.ts b/jarvis/ui/web/frontend/src/components/society/office/codingNavigate.tsnew file mode 100644index 0000000000..73981270b6--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/codingNavigate.ts@@ -0,0 +1,10 @@+/** Leave the coding floor for the real session: the Agentic IDE with that pane focused. */+import type { WorkspacePaneRow } from "@/lib/agenticIdeApi";+import { useEventStore } from "@/store/events";+import { useIdeChatStore } from "@/store/ideChat";++export function openPaneSession(pane: Pick<WorkspacePaneRow, "workspace_id" | "name">): void {+ const events = useEventStore.getState();+ if (events.activeSection !== "agentic-ide") events.setActiveSection("agentic-ide");+ useIdeChatStore.getState().requestPane(pane.workspace_id, pane.name);+}diff --git a/jarvis/ui/web/frontend/src/components/society/office/gigiFlight.test.ts b/jarvis/ui/web/frontend/src/components/society/office/gigiFlight.test.tsindex 19acf29d83..8f239fac80 100644--- a/jarvis/ui/web/frontend/src/components/society/office/gigiFlight.test.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/gigiFlight.test.ts@@ -1,10 +1,10 @@import { describe, expect, it } from "vitest";import {- createGigiFlight, createGigiPose, GIGI_HOVER_M, GIGI_MAX_LEAN, GIGI_MAX_Y, GIGI_MIN_Y, GIGI_SLEEP_HOVER_M,- stepGigiFlight, type GigiFlightMode,+ createGigiFlight, createGigiPose, followAnchor, GIGI_FOLLOW_BACK_M, GIGI_FOLLOW_HOVER_M, GIGI_FOLLOW_SIDE_M,+ GIGI_HOVER_M, GIGI_MAX_LEAN, GIGI_MAX_Y, GIGI_MIN_Y, GIGI_SLEEP_HOVER_M, stepGigiFlight, type GigiFlightMode,} from "./gigiFlight";-const MODES: GigiFlightMode[] = ["idle", "work", "talk", "wave", "sleep"];+const MODES: GigiFlightMode[] = ["idle", "work", "talk", "wave", "sleep", "follow"];const DT = 1 / 60;describe("gigi flight", () => {@@ -148,3 +148,69 @@ describe("gigi flight", () => {expect(run()).toEqual(run());});});++describe("gigi follow mode", () => {+ it("anchors behind and beside the walker, on the side it keeps to", () => {+ // Facing +z: behind is -z, the walker's right is -x.+ const right = followAnchor(0, 0, 0, 1);+ expect(right.z).toBeCloseTo(-GIGI_FOLLOW_BACK_M);+ expect(right.x).toBeCloseTo(-GIGI_FOLLOW_SIDE_M);+ expect(right.side).toBe(1);+ const left = followAnchor(0, 0, 0, -1);+ expect(left.x).toBeCloseTo(GIGI_FOLLOW_SIDE_M);+ // Facing +x: behind is -x.+ const east = followAnchor(2, 3, Math.PI / 2, 1);+ expect(east.x).toBeCloseTo(2 - GIGI_FOLLOW_BACK_M);+ });++ it("switches shoulders when its side is blocked, and falls back to right above the walker", () => {+ const noWest = (x: number) => x > -0.1;+ const flipped = followAnchor(0, 0, 0, 1, noWest);+ expect(flipped.side).toBe(-1);+ expect(flipped.x).toBeGreaterThan(0);+ const behindOnly = followAnchor(0, 0, 0, 1, (x) => Math.abs(x) < 0.1);+ expect(behindOnly.x).toBeCloseTo(0);+ expect(behindOnly.z).toBeLessThan(0);+ const boxedIn = followAnchor(1, 1, 0, 1, (x, z) => x === 1 && z === 1);+ expect(boxedIn).toEqual({ x: 1, z: 1, side: 1 });+ });++ it("rejects an anchor with a wall between it and the walker", () => {+ // A thin wall at x = -0.3: the anchor at x = -0.6 is clear, the midpoint is not.+ const wall = (x: number) => Math.abs(x + 0.3) > 0.05;+ const anchor = followAnchor(0, 0, 0, 1, wall);+ expect(anchor.side).toBe(-1);+ });++ it("trails a walking person smoothly at shoulder height and never settles inside a wall", () => {+ const state = createGigiFlight(0, 0);+ const pose = createGigiPose();+ const clear = (x: number) => x < 3;+ let side: 1 | -1 = 1;+ let previous = { x: 0, z: 0 };+ let heights = 0, n = 0;+ for (let t = 0; t < 12; t += DT) {+ // Walk east at 2 m/s towards a wall at x = 3, then stand still.+ const px = Math.min(2.8, t * 2), heading = Math.PI / 2;+ const anchor = followAnchor(px, 0, heading, side, clear);+ side = anchor.side;+ stepGigiFlight(state, { targetX: anchor.x, targetZ: anchor.z, moving: px < 2.8, mode: "follow", speaking: false, t, dt: DT, heading, clear }, pose);+ expect(clear(state.x)).toBe(true);+ // No teleports: one frame never moves Gigi more than a sprint would.+ expect(Math.hypot(state.x - previous.x, state.z - previous.z)).toBeLessThan(0.2);+ previous = { x: state.x, z: state.z };+ if (t > 8) { heights += pose.y; n++; }+ }+ expect(heights / n).toBeCloseTo(GIGI_FOLLOW_HOVER_M, 1);+ // Resting behind the walker, not on it.+ expect(Math.hypot(state.x - 2.8, state.z)).toBeGreaterThan(0.4);+ });++ it("snaps along when the person is placed elsewhere (an elevator ride)", () => {+ const state = createGigiFlight(0, 0);+ const anchor = followAnchor(40, 10, 0, 1);+ stepGigiFlight(state, { targetX: anchor.x, targetZ: anchor.z, moving: false, mode: "follow", speaking: false, t: 0, dt: DT });+ expect(state.x).toBeCloseTo(anchor.x);+ expect(state.z).toBeCloseTo(anchor.z);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/society/office/gigiFlight.ts b/jarvis/ui/web/frontend/src/components/society/office/gigiFlight.tsindex 01bda513ad..672f1783ec 100644--- a/jarvis/ui/web/frontend/src/components/society/office/gigiFlight.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/gigiFlight.ts@@ -1,13 +1,15 @@/*** Flight of Gigi, the lead agent's mascot, over the office floor. The lead is* not drawn as a figure: Gigi hovers at chest/head height of the toy figures- * and follows the walker's ground position (x, z).+ * and follows the walker's ground position (x, z). On the coding floor Gigi is+ * no walker at all: in "follow" mode it trails the person's own character,+ * hovering behind-beside its shoulder (`followAnchor`).** Pure and deterministic: the same state and inputs give the same pose. With* an `out` object a step allocates nothing, so it can run every frame.*/-export type GigiFlightMode = "idle" | "work" | "talk" | "wave" | "sleep";+export type GigiFlightMode = "idle" | "work" | "talk" | "wave" | "sleep" | "follow";export interface GigiFlightInput {/** The walker's ground position; Gigi hovers above it. */@@ -26,6 +28,8 @@ export interface GigiFlightInput {heading?: number;/** Reduced motion: static hover, no bob, drift, hops or spins. */reduced?: boolean;+ /** Is a point free airspace (not inside a wall or solid prop)? Gigi never settles where it is not. */+ clear?: (x: number, z: number) => boolean;}export interface GigiFlightPose {@@ -77,6 +81,13 @@ export const GIGI_MIN_Y = 0.6;export const GIGI_MAX_Y = 1.5;/** Maximum forward lean (~15°). */export const GIGI_MAX_LEAN = (15 * Math.PI) / 180;+/** Following the person: just above shoulder height of the 1.3 m figure. */+export const GIGI_FOLLOW_HOVER_M = 1.3;+/** The follow anchor sits this far behind and beside the person. */+export const GIGI_FOLLOW_BACK_M = 0.45;+export const GIGI_FOLLOW_SIDE_M = 0.6;+/** In follow mode Gigi trails the anchor by at most this much (a sprint stretches the spring). */+const FOLLOW_MAX_LAG_M = 1.1;const MAX_BANK = 0.35;/** Spring stiffness of horizontal follow; steady lag at walking pace is 2v/ω ≈ 0.4 m. */const FOLLOW_OMEGA = 6.5;@@ -153,23 +164,32 @@ export function stepGigiFlight(state: GigiFlightState, input: GigiFlightInput, ospringStep(state.z, state.vz, targetZ, FOLLOW_OMEGA, dt, scratch);state.z = scratch[0]; state.vz = scratch[1];const lag = Math.hypot(state.x - targetX, state.z - targetZ);- if (lag > MAX_LAG_M) {- const k = MAX_LAG_M / lag;+ const maxLag = mode === "follow" ? FOLLOW_MAX_LAG_M : MAX_LAG_M;+ if (lag > maxLag) {+ const k = maxLag / lag;state.x = targetX + (state.x - targetX) * k;state.z = targetZ + (state.z - targetZ) * k;}}+ // Never settle inside a wall: pull back along the lag towards the (clear) target.+ if (input.clear && !input.clear(state.x, state.z)) {+ for (const k of [0.5, 0.25, 0]) {+ const x = targetX + (state.x - targetX) * k, z = targetZ + (state.z - targetZ) * k;+ if (k === 0 || input.clear(x, z)) { state.x = x; state.z = z; break; }+ }+ }const speed = dt > 0 ? Math.hypot(state.x - px, state.z - pz) / dt : 0;// ---- Mode blends --------------------------------------------------------const blend = approach(3, dt);- state.idleBlend += ((!moving && mode === "idle" && !input.speaking ? 1 : 0) - state.idleBlend) * blend;+ const hovering = mode === "idle" || mode === "follow";+ state.idleBlend += ((!moving && hovering && !input.speaking ? 1 : 0) - state.idleBlend) * blend;state.workBlend += ((mode === "work" && !input.speaking ? 1 : 0) - state.workBlend) * blend;state.sleepBlend += ((mode === "sleep" && !input.speaking ? 1 : 0) - state.sleepBlend) * blend;state.happyBlend += ((happy ? 1 : 0) - state.happyBlend) * blend;// ---- Height -------------------------------------------------------------- const baseTarget = mode === "sleep" && !input.speaking ? GIGI_SLEEP_HOVER_M : GIGI_HOVER_M;+ const baseTarget = mode === "sleep" && !input.speaking ? GIGI_SLEEP_HOVER_M : mode === "follow" ? GIGI_FOLLOW_HOVER_M : GIGI_HOVER_M;if (reduced) { state.base = baseTarget; state.vBase = 0; }else if (dt > 0) {springStep(state.base, state.vBase, baseTarget, HEIGHT_OMEGA, dt, scratch);@@ -239,3 +259,29 @@ export function stepGigiFlight(state: GigiFlightState, input: GigiFlightInput, opose.speed = speed;return pose;}++export interface FollowAnchor { x: number; z: number; /** +1 or -1: which shoulder Gigi keeps to; carry it into the next call. */ side: 1 | -1 }++/**+ * Where Gigi hovers while following a walker at (x, z) facing `heading`+ * (0 = +z): behind and beside its shoulder, on the side it already keeps to+ * unless that side is blocked (then the other side, then straight behind,+ * then right above the walker). `clear` tests free airspace; a candidate+ * counts only when the midpoint to it is clear too, so no wall sits between.+ */+export function followAnchor(x: number, z: number, heading: number, side: 1 | -1, clear?: (x: number, z: number) => boolean): FollowAnchor {+ const fx = Math.sin(heading), fz = Math.cos(heading);+ // The walker's right hand (heading 0 faces +z, so its right is -x).+ const rx = -fz, rz = fx;+ const candidates: [number, number, 1 | -1][] = [+ [GIGI_FOLLOW_BACK_M, GIGI_FOLLOW_SIDE_M * side, side],+ [GIGI_FOLLOW_BACK_M, -GIGI_FOLLOW_SIDE_M * side, side === 1 ? -1 : 1],+ [GIGI_FOLLOW_BACK_M + 0.2, 0, side],+ [0.25, 0, side],+ ];+ for (const [back, lateral, keep] of candidates) {+ const ax = x - fx * back + rx * lateral, az = z - fz * back + rz * lateral;+ if (!clear || (clear(ax, az) && clear((x + ax) / 2, (z + az) / 2))) return { x: ax, z: az, side: keep };+ }+ return { x, z, side };+}diff --git a/jarvis/ui/web/frontend/src/components/society/office/minimap.ts b/jarvis/ui/web/frontend/src/components/society/office/minimap.tsindex 8dd8d9be93..4f0d3da8f7 100644--- a/jarvis/ui/web/frontend/src/components/society/office/minimap.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/minimap.ts@@ -322,8 +322,8 @@ export const STATE_RING: Record<MinimapAgentState, string> = {};/** Checkpoint icon per checkpoint kind; the same pictures as the 3D tokens (CheckpointMarker). */-export const CHECKPOINT_ICON_KEYS: Record<CheckpointKind, "plus" | "list" | "team" | "shirt" | "star" | "coffee"> = {- create: "plus", manage: "list", team: "team", wardrobe: "shirt", lead: "star", break: "coffee",+export const CHECKPOINT_ICON_KEYS: Record<CheckpointKind, "plus" | "list" | "team" | "shirt" | "star" | "coffee" | "elevator"> = {+ create: "plus", manage: "list", team: "team", wardrobe: "shirt", lead: "star", break: "coffee", elevator: "elevator",};/** Stroke-only icons in a 24 × 24 box; kept in sync with CheckpointMarker's paths. */@@ -334,6 +334,7 @@ const ICON_PATHS: Record<(typeof CHECKPOINT_ICON_KEYS)[CheckpointKind], string>shirt: "M8 3L3 6l2 4 2.5-1v12h9V9l2.5 1 2-4-5-3c-.5 1.5-2 2.5-4 2.5S8.5 4.5 8 3z",star: "M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z",coffee: "M4 9h12v5a5 5 0 0 1-5 5H9a5 5 0 0 1-5-5V9zM16 10h1.5a2.5 2.5 0 0 1 0 5H16M8 3.5c0 1 1 1 1 2M12 3.5c0 1 1 1 1 2",+ elevator: "M5 3h14v18H5zM9 10l3-3 3 3M9 14l3 3 3-3",};// ------------------------------------------------------------------ drawingdiff --git a/jarvis/ui/web/frontend/src/components/society/office/officeFloors.css b/jarvis/ui/web/frontend/src/components/society/office/officeFloors.cssnew file mode 100644index 0000000000..e775dfe9c7--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/officeFloors.css@@ -0,0 +1,37 @@+/* Floors, the elevator ride and the compact (IDE side panel) HUD. Theme tokens only: light and dark mode both work. */++/* The elevator: two doors slide shut over the scene, the floor switches behind them, they slide open. */+.office-elevator { position:absolute; inset:0; z-index:62; pointer-events:none; overflow:hidden; display:flex; align-items:center; justify-content:center; }+.office-elevator-door { position:absolute; top:0; bottom:0; width:50%; background:linear-gradient(90deg, hsl(var(--secondary)), hsl(var(--muted))); box-shadow:inset 0 0 0 1px hsl(var(--border)); transition:transform 480ms cubic-bezier(.6,0,.3,1); }+.office-elevator-door[data-side="left"] { left:0; transform:translateX(-100%); }+.office-elevator-door[data-side="right"] { right:0; transform:translateX(100%); }+.office-elevator[data-phase="closing"] .office-elevator-door,+.office-elevator[data-phase="riding"] .office-elevator-door { transform:translateX(0); }+/* A fresh mount starts open, so closing animates from open; opening animates back out. */+.office-elevator[data-phase="closing"] .office-elevator-door { animation:office-door-close 480ms cubic-bezier(.6,0,.3,1); }+@keyframes office-door-close { from { transform:translateX(var(--office-door-from, 0)); } }+.office-elevator[data-phase="closing"] .office-elevator-door[data-side="left"] { --office-door-from:-100%; }+.office-elevator[data-phase="closing"] .office-elevator-door[data-side="right"] { --office-door-from:100%; }+.office-elevator-sign { position:relative; padding:6px 14px; border-radius:999px; border:1px solid hsl(var(--border)); background:hsl(var(--popover)); color:hsl(var(--popover-foreground)); font-size:13px; font-weight:600; opacity:0; transition:opacity 200ms ease; }+.office-elevator[data-phase="riding"] .office-elevator-sign { opacity:1; }+@media (prefers-reduced-motion: reduce) {+ .office-elevator-door { transition:none; animation:none !important; }+ .office-elevator-sign { transition:none; }+}++/* A coding session's facts in its panel. */+.office-facts { display:grid; grid-template-columns:auto 1fr; gap:3px 10px; margin:0; }+.office-facts dt { color:hsl(var(--muted-foreground)); font-size:11px; }+.office-facts dd { margin:0; min-width:0; overflow-wrap:anywhere; }+.office-facts-quote { display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical; overflow:hidden; font-style:italic; }+.office-dot[data-dot="error"] { background:hsl(var(--destructive)); }++/* Compact: the office inside a narrow side panel. No minimap or compass; cards and buttons shrink. */+.office-stage-compact .office-hud-left { left:8px; top:8px; gap:5px; max-width:calc(100% - 16px); }+.office-stage-compact .office-title { padding:5px 9px; font-size:12px; }+.office-stage-compact .office-counts { gap:8px; padding:4px 9px; font-size:11px; flex-wrap:wrap; }+.office-stage-compact .office-hud-right { right:8px; top:auto; bottom:8px; flex-direction:row; flex-wrap:wrap; justify-content:flex-end; max-width:calc(100% - 16px); }+.office-stage-compact .office-button { padding:4px 8px; font-size:11px; }+.office-stage-compact .office-panel-slot { top:auto; bottom:48px; right:8px; width:calc(100% - 16px); max-height:62%; }+.office-stage-compact .office-prompt { bottom:48px; max-width:calc(100% - 16px); font-size:12px; }+.office-stage-compact .office-note { font-size:11px; }diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeFloors.test.ts b/jarvis/ui/web/frontend/src/components/society/office/officeFloors.test.tsnew file mode 100644index 0000000000..7931b31f77--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/officeFloors.test.ts@@ -0,0 +1,93 @@+import { afterEach, describe, expect, it } from "vitest";+import { buildOfficeLayout, type OfficeAgentInput } from "./officeLayout";+import { buildNavGrid, isWalkable } from "./officeNav";+import { arrivalPose, knownOnFloor, noteArrivals } from "./officeFloors";+import { officeSession, otherFloor, player, switchFloor, useOfficeStore } from "./officeStore";++const AGENTS: OfficeAgentInput[] = [+ { agentId: "a1", name: "One", tier: "specialist", providerLabel: "Codex", state: "working", createdMs: 1 },+ { agentId: "a2", name: "Two", tier: "specialist", providerLabel: "Claude", state: "idle", createdMs: 2 },+];++function resetBuilding() {+ useOfficeStore.setState({ floor: "agents", selection: null, nearby: null, summons: {}, walkTo: null, teamDraft: [] });+ officeSession.playerPlaced = false;+ officeSession.floors = {};+ officeSession.arrival = null;+ Object.assign(player, { x: 0, z: 0, heading: Math.PI, path: [], moving: false });+}++afterEach(resetBuilding);++describe("floors", () => {+ it("names the other floor", () => {+ expect(otherFloor("agents")).toBe("coding");+ expect(otherFloor("coding")).toBe("agents");+ });++ it("steps out of the elevator onto walkable floor, facing away from the doors, on both floors", () => {+ for (const variant of ["agents", "coding"] as const) {+ const layout = buildOfficeLayout(AGENTS, { variant });+ const stop = layout.checkpoints.find((cp) => cp.id === "elevator");+ expect(stop, variant).toBeDefined();+ const pose = arrivalPose(layout, "elevator");+ expect(pose.x).toBeCloseTo(stop!.x);+ expect(pose.z).toBeCloseTo(stop!.z);+ expect(isWalkable(buildNavGrid(layout), pose)).toBe(true);+ const doors = layout.furniture.find((f) => f.kind === "elevator")!;+ // One step along the heading leads away from the doors.+ const ahead = { x: pose.x + Math.sin(pose.heading), z: pose.z + Math.cos(pose.heading) };+ expect(Math.hypot(ahead.x - doors.x, ahead.z - doors.z)).toBeGreaterThan(Math.hypot(pose.x - doors.x, pose.z - doors.z));+ }+ });++ it("returns to the remembered spot, and falls back to the spawn without an elevator", () => {+ const layout = buildOfficeLayout(AGENTS);+ expect(arrivalPose(layout, "remembered", { x: 1, z: 2, heading: 0.5 })).toEqual({ x: 1, z: 2, heading: 0.5 });+ const bare = { ...layout, checkpoints: layout.checkpoints.filter((cp) => cp.id !== "elevator") };+ expect(arrivalPose(bare, "elevator")).toEqual({ x: layout.spawn.x, z: layout.spawn.z, heading: Math.PI });+ });++ it("keeps newcomers per floor: the first sight of a floor knows everyone", () => {+ const known = new Set<string>();+ expect(noteArrivals(known, ["p1", "p2"])).toEqual([]);+ expect(noteArrivals(known, ["p1", "p2", "p3"])).toEqual(["p3"]);+ // p1 left and is forgotten; coming back later it arrives again.+ expect(noteArrivals(known, ["p2", "p3"])).toEqual([]);+ expect(noteArrivals(known, ["p1", "p2", "p3"])).toEqual(["p1"]);+ expect(knownOnFloor("agents")).not.toBe(knownOnFloor("coding"));+ });++ it("switching floors forgets the old floor's panels and calls, and remembers where the character stood", () => {+ const store = useOfficeStore.getState();+ store.select({ kind: "agent", id: "a1" });+ store.setNearby({ kind: "checkpoint", id: "elevator" });+ store.summon(["a1"], { x: 0, z: 0 }, 10_000);+ store.requestWalk({ x: 3, z: 3 });+ officeSession.playerPlaced = true;+ Object.assign(player, { x: 4, z: -2, heading: 1, path: [{ x: 5, z: 5 }], moving: true });++ switchFloor("coding", true);+ const after = useOfficeStore.getState();+ expect(after.floor).toBe("coding");+ expect(after.selection).toBeNull();+ expect(after.nearby).toBeNull();+ expect(after.summons).toEqual({});+ expect(after.walkTo).toBeNull();+ expect(player.path).toEqual([]);+ expect(officeSession.floors.agents).toEqual({ x: 4, z: -2, heading: 1 });+ expect(officeSession.arrival).toEqual({ floor: "coding", at: "elevator" });+ });++ it("a mount that asks for a floor returns to the spot remembered there; the elevator always arrives at the doors", () => {+ officeSession.playerPlaced = true;+ officeSession.floors.coding = { x: 7, z: 7, heading: 0 };+ switchFloor("coding", false);+ expect(officeSession.arrival).toEqual({ floor: "coding", at: "remembered" });+ switchFloor("agents", true);+ expect(officeSession.arrival).toEqual({ floor: "agents", at: "elevator" });+ // Asking for the floor already on screen changes nothing.+ switchFloor("agents", false);+ expect(officeSession.arrival).toEqual({ floor: "agents", at: "elevator" });+ });+});diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeFloors.ts b/jarvis/ui/web/frontend/src/components/society/office/officeFloors.tsnew file mode 100644index 0000000000..098f4814ed--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/officeFloors.ts@@ -0,0 +1,47 @@+/**+ * The building has two floors joined by an elevator: the Jarvis agents office+ * and, one ride up, the coding floor with a figure per IDE coding session.+ * Pure helpers for what differs per floor; the stage wires them.+ */+import type { OfficeLayout } from "./officeLayout";+import type { OfficeFloor } from "./officeStore";+import { knownAgents } from "./walkerRegistry";++export interface FloorPose { x: number; z: number; heading: number }++/**+ * Where the character steps out on arrival: at the elevator checkpoint,+ * facing away from the doors — or where it last stood on that floor.+ * Falls back to the spawn point when the plan has no elevator.+ */+export function arrivalPose(layout: OfficeLayout, at: "elevator" | "remembered", remembered?: FloorPose): FloorPose {+ if (at === "remembered" && remembered) return remembered;+ const cp = layout.checkpoints.find((c) => c.id === "elevator");+ if (!cp) return { x: layout.spawn.x, z: layout.spawn.z, heading: Math.PI };+ const doors = layout.furniture.find((f) => f.kind === "elevator");+ const heading = doors && Math.hypot(cp.x - doors.x, cp.z - doors.z) > 1e-3+ ? Math.atan2(cp.x - doors.x, cp.z - doors.z)+ : Math.PI;+ return { x: cp.x, z: cp.z, heading };+}++/** Agent ids each floor has already seen; a newcomer on that floor arrives by the elevator. */+const codingKnown = new Set<string>();+export function knownOnFloor(floor: OfficeFloor): Set<string> {+ return floor === "agents" ? knownAgents : codingKnown;+}++/**+ * Newcomers among `ids` on a floor, updating what the floor knows. The first+ * sight of a floor knows everyone (nobody "arrives" just because you came up);+ * ids that left are forgotten so the set never outgrows the roster.+ */+export function noteArrivals(known: Set<string>, ids: readonly string[]): string[] {+ if (ids.length === 0) return [];+ if (known.size === 0) { ids.forEach((id) => known.add(id)); return []; }+ const present = new Set(ids);+ for (const id of [...known]) if (!present.has(id)) known.delete(id);+ const fresh = ids.filter((id) => !known.has(id));+ fresh.forEach((id) => known.add(id));+ return fresh;+}diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.test.ts b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.test.tsindex 3b6446262d..ac345e7850 100644--- a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.test.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.test.ts@@ -68,13 +68,67 @@ describe("office layout", () => {}});- it("keeps every checkpoint centre clear of solid furniture", () => {- const layout = buildOfficeLayout(Array.from({ length: 12 }, (_, i) => agent(`a${i}`, i % 2 ? "Codex" : "Gemini")));- const solid = layout.furniture.filter((f) => FURNITURE_SIZE[f.kind].solid).map(footprint);- for (const cp of layout.checkpoints) {- const inside = solid.some((o) => cp.x >= o.minX && cp.x <= o.maxX && cp.z >= o.minZ && cp.z <= o.maxZ);- expect(inside, cp.id).toBe(false);- }+ for (const variant of ["agents", "coding"] as const) {+ it(`keeps every checkpoint centre clear of solid furniture (${variant})`, () => {+ const layout = buildOfficeLayout(Array.from({ length: 12 }, (_, i) => agent(`a${i}`, i % 2 ? "Codex" : "Gemini")), { variant });+ const solid = layout.furniture.filter((f) => FURNITURE_SIZE[f.kind].solid).map(footprint);+ for (const cp of layout.checkpoints) {+ const inside = solid.some((o) => cp.x >= o.minX && cp.x <= o.maxX && cp.z >= o.minZ && cp.z <= o.maxZ);+ expect(inside, cp.id).toBe(false);+ }+ });++ it(`puts the elevator checkpoint right in front of the elevator (${variant})`, () => {+ const layout = buildOfficeLayout([], { variant });+ const elevator = layout.furniture.find((f) => f.kind === "elevator")!;+ const stop = layout.checkpoints.find((c) => c.id === "elevator")!;+ expect(stop.room).toBe("reception");+ expect(stop.z).toBeCloseTo(elevator.z, 9);+ expect(stop.x).toBeGreaterThan(elevator.x);+ expect(Math.hypot(stop.x - elevator.x, stop.z - elevator.z)).toBeLessThan(1.5);+ expect(new Set(layout.checkpoints.map((c) => c.id)).size).toBe(layout.checkpoints.length);+ });++ it(`keeps room, furniture and spot ids unique and inside the floor (${variant})`, () => {+ const layout = buildOfficeLayout(Array.from({ length: 20 }, (_, i) => agent(`a${i}`, `P${i % 3}`)), { variant });+ for (const list of [layout.rooms, layout.furniture, layout.spots]) {+ expect(new Set(list.map((x) => x.id)).size).toBe(list.length);+ }+ for (const item of [...layout.furniture, ...layout.spots]) {+ const room = item.room === "floor" ? layout.floor : layout.rooms.find((r) => r.kind === item.room)!;+ expect(room, item.id).toBeDefined();+ expect(item.x, item.id).toBeGreaterThanOrEqual(room.minX);+ expect(item.x, item.id).toBeLessThanOrEqual(room.maxX);+ expect(item.z, item.id).toBeGreaterThanOrEqual(room.minZ);+ expect(item.z, item.id).toBeLessThanOrEqual(room.maxZ);+ }+ });+ }++ it("keeps the agents office as it was when no variant is named", () => {+ const roster = [agent("a1", "Codex"), agent("a2", "", { tier: "lead" })];+ const plain = buildOfficeLayout(roster);+ expect(plain).toEqual(buildOfficeLayout(roster, { variant: "agents" }));+ expect(plain.variant).toBe("agents");+ expect(plain.rooms.map((r) => r.kind)).toEqual(["lead", "team", "wardrobe", "reception", "break"]);+ expect(plain.checkpoints.map((c) => c.id)).toEqual(["create", "manage", "team", "wardrobe", "lead", "break", "elevator"]);+ });++ it("builds the coding floor: workspaces as departments, focus zone and server room, no lead desks", () => {+ const roster = [agent("p1", "Personal Jarvis"), agent("p2", "Website"), agent("p3", "Personal Jarvis")];+ const layout = buildOfficeLayout(roster, { variant: "coding" });+ expect(layout.variant).toBe("coding");+ expect(layout.rooms.map((r) => r.kind)).toEqual(["focus", "team", "server", "reception", "break"]);+ expect(layout.lead.desks).toEqual([]);+ expect(layout.checkpoints.map((c) => c.id)).toEqual(["elevator", "break"]);+ expect(layout.departments.map((d) => d.label)).toEqual(["Personal Jarvis", "Website", "", ""]);+ expect(layout.furniture.some((f) => f.room === "lead" || f.room === "wardrobe")).toBe(false);+ expect(layout.spots.some((s) => s.room === "focus")).toBe(true);+ expect(layout.spots.some((s) => s.room === "server")).toBe(true);+ // Same frame as the office below, so the elevator lands in the same place.+ const below = buildOfficeLayout(roster);+ expect(layout.spawn).toEqual(below.spawn);+ expect(layout.checkpoints.find((c) => c.id === "elevator")).toEqual(below.checkpoints.find((c) => c.id === "elevator"));});it("counts states", () => {diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.tsindex 105838bf80..50e58627bf 100644--- a/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/officeLayout.ts@@ -10,6 +10,12 @@* ┌──────────── north strip: Lead office · Team room · Wardrobe ───────────┐* │ departments (open office, 2 columns) │* └──── south strip: Reception + lobby (Agent board) · Break room ─────────┘+ *+ * The coding floor (variant "coding", one elevator ride up) keeps the same+ * frame: its departments are the Agentic IDE workspaces, and the north strip+ * holds a quiet focus zone · the team room · a server room instead of the lead+ * office and the wardrobe. It has no lead desks and only the elevator and+ * break-room checkpoints — nothing there creates or dresses society agents.*/import type { AgentRunState, AgentTier } from "../data";@@ -48,7 +54,11 @@ export interface Department extends Rect {tint: number;}-export type RoomKind = "lead" | "team" | "wardrobe" | "reception" | "break";+/** "focus" and "server" only exist on the coding floor, in place of the lead office and the wardrobe. */+export type RoomKind = "lead" | "team" | "wardrobe" | "reception" | "break" | "focus" | "server";++/** Which floor a layout draws: the society agents' office, or the coding agents' floor above it. */+export type OfficeVariant = "agents" | "coding";export interface Door { side: "north" | "south" | "east" | "west"; /** Centre of the gap along the wall. */ at: number; width: number }@@ -62,7 +72,8 @@ export interface Room extends Rect {export interface WallSegment { x1: number; z1: number; x2: number; z2: number; room: RoomKind }-export type CheckpointKind = "create" | "manage" | "team" | "wardrobe" | "lead" | "break";+/** "elevator" rides between the floors and stands in front of the lobby elevator on both of them. */+export type CheckpointKind = "create" | "manage" | "team" | "wardrobe" | "lead" | "break" | "elevator";/** A place the person can walk to (or click from afar) to act. */export interface Checkpoint extends Point { id: CheckpointKind; room: RoomKind; /** Walk-in radius in metres. */ radius: number }@@ -72,7 +83,8 @@ export type FurnitureKind =| "coffeeBar" | "waterCooler" | "couch" | "coffeeTable" | "arcade" | "beanbag"| "bookshelf" | "plant" | "rug" | "elevator"// Lead office: the executive suite.- | "leadWall" | "executiveRug" | "guestChair" | "chesterfield" | "loungeTable" | "executiveBar" | "globe" | "floorLamp";+ | "leadWall" | "executiveRug" | "guestChair" | "chesterfield" | "loungeTable" | "executiveBar" | "globe" | "floorLamp"+ | "dogBed";/*** Footprint (x-extent × z-extent before rotation) and height of each piece.@@ -105,6 +117,7 @@ export const FURNITURE_SIZE: Record<FurnitureKind, { w: number; d: number; h: nu// The tilted meridian ring reaches further east-west than the stand.globe: { w: 0.92, d: 0.72, h: 1.2, solid: true },floorLamp: { w: 0.46, d: 0.46, h: 1.8, solid: true },+ dogBed: { w: 0.9, d: 0.72, h: 0.45, solid: true },};export interface Furniture extends Point {@@ -124,8 +137,9 @@ export type SpotPose = "sit" | "stand" | "sleep";export interface Spot extends Point { id: string; kind: SpotKind; pose: SpotPose; facing: number; room: RoomKind | "floor" }export interface OfficeLayout {+ variant: OfficeVariant;departments: Department[];- /** Lead desks live in the lead office. */+ /** Lead desks live in the lead office; the coding floor has none (its rect is the focus zone). */lead: Rect & { desks: DeskSlot[] };rooms: Room[];walls: WallSegment[];@@ -251,6 +265,15 @@ export function deskRect(desk: Pick<DeskSlot, "x" | "z" | "size">): Rect {return { minX: desk.x - w / 2, maxX: desk.x + w / 2, minZ: desk.z - d / 2, maxZ: desk.z + d / 2 };}+/** Half the width of the executive chair; unlike bench chairs it is solid, so nobody walks through it. */+export const EXECUTIVE_CHAIR_HALF = 0.32;++/** The executive chair's footprint behind a lead desk (only desks with their own size have one). */+export function executiveChairRect(desk: Pick<DeskSlot, "x" | "z" | "facing">): Rect {+ const seat = seatOf(desk);+ return { minX: seat.x - EXECUTIVE_CHAIR_HALF, maxX: seat.x + EXECUTIVE_CHAIR_HALF, minZ: seat.z - EXECUTIVE_CHAIR_HALF, maxZ: seat.z + EXECUTIVE_CHAIR_HALF };+}+/** Axis-aligned footprint of a rotated piece (rotations are multiples of 90°). */export function footprint(item: Pick<Furniture, "x" | "z" | "kind" | "rotationY" | "size">): Rect {const base = item.size ?? FURNITURE_SIZE[item.kind];@@ -303,8 +326,15 @@ function wallRect(w: WallSegment): Rect {return { minX: Math.min(w.x1, w.x2) - t, maxX: Math.max(w.x1, w.x2) + t, minZ: Math.min(w.z1, w.z2) - t, maxZ: Math.max(w.z1, w.z2) + t };}+export interface OfficeLayoutOptions {+ /** "agents" (default) is the society office; "coding" the IDE sessions' floor, departments per workspace. */+ variant?: OfficeVariant;+}+/** Build the floor for a roster. Seating and the whole floor plan are stable for an unchanged roster. */-export function buildOfficeLayout(agents: readonly OfficeAgentInput[]): OfficeLayout {+export function buildOfficeLayout(agents: readonly OfficeAgentInput[], options: OfficeLayoutOptions = {}): OfficeLayout {+ const variant = options.variant ?? "agents";+ const coding = variant === "coding";const groups: { label: string; members: OfficeAgentInput[] }[] = groupDepartments(agents);if (groups.length === 1 && groups[0].members.length === 0) groups.length = 0;while (groups.length < MIN_DEPARTMENTS) groups.push({ label: "", members: [] });@@ -323,13 +353,16 @@ export function buildOfficeLayout(agents: readonly OfficeAgentInput[]): OfficeLaconst bottomZ = floorDepth / 2;// North strip: lead office · team room · wardrobe, each with a door facing the office.+ // The coding floor puts a focus zone and a server room on the same footprints.const leadW = 8.2, teamW = 8.4;const northMaxZ = topZ + NORTH_DEPTH;- const leadRoom: Room = { id: "lead", kind: "lead", walled: true, minX, maxX: minX + leadW, minZ: topZ, maxZ: northMaxZ,+ const westKind: RoomKind = coding ? "focus" : "lead";+ const eastKind: RoomKind = coding ? "server" : "wardrobe";+ const leadRoom: Room = { id: westKind, kind: westKind, walled: true, minX, maxX: minX + leadW, minZ: topZ, maxZ: northMaxZ,doors: [{ side: "south", at: minX + leadW / 2, width: 1.6 }] };const teamRoom: Room = { id: "team", kind: "team", walled: true, minX: leadRoom.maxX, maxX: leadRoom.maxX + teamW, minZ: topZ, maxZ: northMaxZ,doors: [{ side: "south", at: leadRoom.maxX + teamW / 2, width: 1.8 }] };- const wardrobeRoom: Room = { id: "wardrobe", kind: "wardrobe", walled: true, minX: teamRoom.maxX, maxX, minZ: topZ, maxZ: northMaxZ,+ const wardrobeRoom: Room = { id: eastKind, kind: eastKind, walled: true, minX: teamRoom.maxX, maxX, minZ: topZ, maxZ: northMaxZ,doors: [{ side: "south", at: (teamRoom.maxX + maxX) / 2, width: 1.5 }] };// Departments between the strips.@@ -362,12 +395,12 @@ export function buildOfficeLayout(agents: readonly OfficeAgentInput[]): OfficeLa// The lead's executive desk faces south, towards the door and the office. A// second lead gets a partner desk to its east; there is never an empty one.- const leadAgents = agents.filter((a) => a.tier === "lead").sort(byArrival).slice(0, 2);+ const leadAgents = coding ? [] : agents.filter((a) => a.tier === "lead").sort(byArrival).slice(0, 2);const lx0 = leadRoom.minX, lz0 = leadRoom.minZ;const leadDeskZ = lz0 + 2.6;const lead = {minX: leadRoom.minX, maxX: leadRoom.maxX, minZ: leadRoom.minZ, maxZ: leadRoom.maxZ,- desks: [+ desks: coding ? [] : [{ id: "lead:0", x: lx0 + leadW / 2, z: leadDeskZ, facing: "south", agentId: leadAgents[0]?.agentId ?? null, size: EXECUTIVE_DESK_SIZE },...(leadAgents[1] ? [{ id: "lead:1", x: lx0 + 6.75, z: leadDeskZ, facing: "south" as const, agentId: leadAgents[1].agentId, size: PARTNER_DESK_SIZE }] : []),] satisfies DeskSlot[],@@ -377,7 +410,7 @@ export function buildOfficeLayout(agents: readonly OfficeAgentInput[]): OfficeLaconst wcx = (wardrobeRoom.minX + wardrobeRoom.maxX) / 2;const bx0 = breakRoom.minX, bz0 = breakRoom.minZ;const rx0 = receptionRoom.minX;- const furniture: Furniture[] = [+ const leadFurniture: Furniture[] = coding ? [] : [// Lead office: a panelled feature wall with lit bookcases and the star emblem,// a rug under the executive desk, guest armchairs, the bar and a leather// lounge along the west wall (their fronts face the camera), a globe and a@@ -394,13 +427,43 @@ export function buildOfficeLayout(agents: readonly OfficeAgentInput[]): OfficeLa{ id: "lead-lamp-e", kind: "floorLamp", x: leadRoom.maxX - 0.34, z: lz0 + 2.9, rotationY: 0, room: "lead" },{ id: "lead-plant", kind: "plant", x: lx0 + 0.55, z: northMaxZ - 0.55, rotationY: 0, room: "lead" },{ id: "lead-plant-e", kind: "plant", x: leadRoom.maxX - 0.55, z: northMaxZ - 0.55, rotationY: 0, room: "lead" },+ // The office dog, asleep in its basket between the globe and the door.+ { id: "lead-dog", kind: "dogBed", x: leadRoom.maxX - 1.65, z: lz0 + 5.75, rotationY: 0, room: "lead" },+ ];+ // Coding floor, west: a quiet focus zone — a wall of shelves, a couch facing+ // them on a rug, a beanbag in each corner, palms beside the door.+ const focusFurniture: Furniture[] = coding ? [+ { id: "focus-shelf-w", kind: "bookshelf", x: lx0 + 1.6, z: lz0 + 0.35, rotationY: 0, room: "focus" },+ { id: "focus-shelf-c", kind: "bookshelf", x: lx0 + leadW / 2, z: lz0 + 0.35, rotationY: 0, room: "focus" },+ { id: "focus-shelf-e", kind: "bookshelf", x: lx0 + leadW - 1.6, z: lz0 + 0.35, rotationY: 0, room: "focus" },+ { id: "focus-rug", kind: "rug", x: lx0 + leadW / 2, z: lz0 + 3.6, rotationY: 0, room: "focus", size: { w: 4.8, d: 2.6 } },+ { id: "focus-couch", kind: "couch", x: lx0 + leadW / 2, z: lz0 + 4.4, rotationY: Math.PI, room: "focus" },+ { id: "focus-beanbag-w", kind: "beanbag", x: lx0 + 1.3, z: lz0 + 3.0, rotationY: 0, room: "focus" },+ { id: "focus-beanbag-e", kind: "beanbag", x: lx0 + leadW - 1.3, z: lz0 + 3.0, rotationY: 0, room: "focus" },+ { id: "focus-plant", kind: "plant", x: lx0 + 0.55, z: northMaxZ - 0.55, rotationY: 0, room: "focus" },+ { id: "focus-plant-e", kind: "plant", x: leadRoom.maxX - 0.55, z: northMaxZ - 0.55, rotationY: 0, room: "focus" },+ ] : [];+ const wx0 = wardrobeRoom.minX;+ const furniture: Furniture[] = [+ ...leadFurniture,+ ...focusFurniture,// Team room: one long table, a board on the north wall.{ id: "team-table", kind: "meetingTable", x: tcx, z: tcz + 0.4, rotationY: 0, room: "team" },{ id: "team-board", kind: "teamBoard", x: tcx, z: topZ + 0.25, rotationY: 0, room: "team" },{ id: "team-plant", kind: "plant", x: teamRoom.maxX - 0.6, z: northMaxZ - 0.6, rotationY: 0, room: "team" },- // Wardrobe: lockers and a mirror.- { id: "wardrobe-lockers", kind: "lockers", x: wcx - 0.2, z: topZ + 0.4, rotationY: 0, room: "wardrobe" },- { id: "wardrobe-mirror", kind: "mirror", x: wardrobeRoom.maxX - 0.25, z: tcz, rotationY: -Math.PI / 2, room: "wardrobe" },+ ...(coding ? [+ // Coding floor, east: a server room — a rack cabinet on the north wall and+ // console terminals along both side walls.+ { id: "server-rack", kind: "lockers", x: wcx, z: topZ + 0.4, rotationY: 0, room: "server" },+ { id: "server-console-e1", kind: "kiosk", x: wardrobeRoom.maxX - 0.35, z: topZ + 2.2, rotationY: -Math.PI / 2, room: "server" },+ { id: "server-console-e2", kind: "kiosk", x: wardrobeRoom.maxX - 0.35, z: topZ + 3.7, rotationY: -Math.PI / 2, room: "server" },+ { id: "server-console-w", kind: "kiosk", x: wx0 + 0.35, z: topZ + 2.2, rotationY: Math.PI / 2, room: "server" },+ { id: "server-plant", kind: "plant", x: wx0 + 0.55, z: northMaxZ - 0.55, rotationY: 0, room: "server" },+ ] satisfies Furniture[] : [+ // Wardrobe: lockers and a mirror.+ { id: "wardrobe-lockers", kind: "lockers", x: wcx - 0.2, z: topZ + 0.4, rotationY: 0, room: "wardrobe" },+ { id: "wardrobe-mirror", kind: "mirror", x: wardrobeRoom.maxX - 0.25, z: tcz, rotationY: -Math.PI / 2, room: "wardrobe" },+ ] satisfies Furniture[]),// Reception and lobby.{ id: "elevator", kind: "elevator", x: rx0 + 0.25, z: bottomZ - 2.6, rotationY: Math.PI / 2, room: "reception" },{ id: "reception-desk", kind: "receptionDesk", x: rx0 + 3.2, z: southMinZ + 2.6, rotationY: 0, room: "reception" },@@ -439,8 +502,21 @@ export function buildOfficeLayout(agents: readonly OfficeAgentInput[]): OfficeLa{ id: "beanbag-a", kind: "beanbag", pose: "sit", x: bx0 + 7.2, z: bz0 + 5.4, facing: Math.PI * 1.25, room: "break" },{ id: "beanbag-b", kind: "beanbag", pose: "sit", x: bx0 + 8.4, z: bz0 + 6.3, facing: Math.PI * 1.25, room: "break" },{ id: "shelf-break", kind: "shelf", pose: "stand", x: bx0 + 2.2, z: bz0 + 1.1, facing: Math.PI, room: "break" },- // In front of the feature wall's east bookcase.- { id: "shelf-lead", kind: "shelf", pose: "stand", x: leadRoom.maxX - 1.45, z: topZ + 1.05, facing: Math.PI, room: "lead" },+ ...(coding ? [+ // Focus zone: browsing the shelf wall, the couch facing it, a beanbag per corner.+ { id: "shelf-focus-w", kind: "shelf", pose: "stand", x: lx0 + 1.6, z: lz0 + 1.15, facing: Math.PI, room: "focus" },+ { id: "shelf-focus-e", kind: "shelf", pose: "stand", x: lx0 + leadW - 1.6, z: lz0 + 1.15, facing: Math.PI, room: "focus" },+ { id: "couch-focus-1", kind: "couch", pose: "sit", x: lx0 + leadW / 2 - 0.6, z: lz0 + 4.25, facing: Math.PI, room: "focus" },+ { id: "couch-focus-2", kind: "couch", pose: "sit", x: lx0 + leadW / 2 + 0.6, z: lz0 + 4.25, facing: Math.PI, room: "focus" },+ { id: "beanbag-focus-w", kind: "beanbag", pose: "sit", x: lx0 + 1.3, z: lz0 + 3.0, facing: Math.PI * 0.75, room: "focus" },+ { id: "beanbag-focus-e", kind: "beanbag", pose: "sit", x: lx0 + leadW - 1.3, z: lz0 + 3.0, facing: Math.PI * 1.25, room: "focus" },+ // Server room: a look at the consoles on either wall.+ { id: "console-e", kind: "board", pose: "stand", x: wardrobeRoom.maxX - 1.2, z: topZ + 2.2, facing: Math.PI / 2, room: "server" },+ { id: "console-w", kind: "board", pose: "stand", x: wx0 + 1.2, z: topZ + 2.2, facing: -Math.PI / 2, room: "server" },+ ] satisfies Spot[] : [+ // In front of the feature wall's east bookcase.+ { id: "shelf-lead", kind: "shelf", pose: "stand", x: leadRoom.maxX - 1.45, z: topZ + 1.05, facing: Math.PI, room: "lead" },+ ] satisfies Spot[]),{ id: "board", kind: "board", pose: "stand", x: tcx - 0.6, z: topZ + 1.2, facing: Math.PI, room: "team" },];// Meeting chairs: three per long side of the team table.@@ -462,13 +538,18 @@ export function buildOfficeLayout(agents: readonly OfficeAgentInput[]): OfficeLaconst reception = furniture.find((f) => f.id === "reception-desk")!;const kiosk = furniture.find((f) => f.id === "kiosk")!;- const checkpoints: Checkpoint[] = [+ const elevator = furniture.find((f) => f.id === "elevator")!;+ // The elevator's doors face east into the lobby; its checkpoint is the floor in front of them.+ const elevatorStop: Checkpoint = { id: "elevator", room: "reception", x: elevator.x + 0.95, z: elevator.z, radius: 1.0 };+ const breakStop: Checkpoint = { id: "break", room: "break", x: bx0 + 5.6, z: bz0 + 2.6, radius: 1.8 };+ const checkpoints: Checkpoint[] = coding ? [elevatorStop, breakStop] : [{ id: "create", room: "reception", x: reception.x, z: reception.z + 1.7, radius: 1.2 },{ id: "manage", room: "reception", x: kiosk.x, z: kiosk.z + 1.4, radius: 1.1 },{ id: "team", room: "team", x: tcx + 2.2, z: northMaxZ - 1.05, radius: 0.95 },{ id: "wardrobe", room: "wardrobe", x: wcx, z: tcz + 0.8, radius: 1.5 },{ id: "lead", room: "lead", x: minX + leadW / 2, z: northMaxZ - 1.5, radius: 1.3 },- { id: "break", room: "break", x: bx0 + 5.6, z: bz0 + 2.6, radius: 1.8 },+ breakStop,+ elevatorStop,];const walls = rooms.flatMap(wallsOf);@@ -476,6 +557,7 @@ export function buildOfficeLayout(agents: readonly OfficeAgentInput[]): OfficeLaconst obstacles: Rect[] = [...walls.map(wallRect),...desks.map(deskRect),+ ...lead.desks.filter((d) => d.size).map(executiveChairRect),// Department sign walls along each department's north edge....departments.map((d) => ({ minX: d.minX + 0.2, maxX: d.maxX - 0.2, minZ: d.minZ + 0.02, maxZ: d.minZ + 0.2 })),...furniture.filter((f) => FURNITURE_SIZE[f.kind].solid).map(footprint),@@ -487,7 +569,7 @@ export function buildOfficeLayout(agents: readonly OfficeAgentInput[]): OfficeLaconst floor = { minX: minX - EDGE + 0.35, maxX: maxX + EDGE - 0.35, minZ: topZ - EDGE + 0.35, maxZ: bottomZ + EDGE - 0.35 };return {- departments, lead, rooms, walls, furniture, spots, checkpoints, obstacles,+ variant, departments, lead, rooms, walls, furniture, spots, checkpoints, obstacles,spawn: { x: rx0 + 1.4, z: bottomZ - 2.6 },floor,bounds: { minX: minX - EDGE, maxX: maxX + EDGE, minZ: topZ - EDGE, maxZ: bottomZ + EDGE },diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeNav.test.ts b/jarvis/ui/web/frontend/src/components/society/office/officeNav.test.tsindex 99d8f57ab7..8e15e7da93 100644--- a/jarvis/ui/web/frontend/src/components/society/office/officeNav.test.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/officeNav.test.ts@@ -46,30 +46,36 @@ function assertClearPath(grid: NavGrid, from: Point, to: Point, path: Point[], n}describe("office navigation", () => {- for (const count of [0, 10, 40]) {- it(`reaches every seat, spot and checkpoint from the spawn (${count} agents)`, () => {- const layout = buildOfficeLayout(roster(count));+ for (const variant of ["agents", "coding"] as const) {+ for (const count of [0, 10, 40]) {+ it(`reaches every seat, spot and checkpoint from the spawn and the elevator (${variant}, ${count} agents)`, () => {+ const layout = buildOfficeLayout(roster(count), { variant });+ const grid = buildNavGrid(layout);+ const elevator = layout.checkpoints.find((c) => c.id === "elevator")!;+ for (const start of [layout.spawn, elevator]) {+ expect(isWalkable(grid, start)).toBe(true);+ for (const { name, p } of targetsOf(layout)) {+ const path = findPath(grid, start, p);+ if (!path) throw new Error(`${name} at ${p.x.toFixed(2)},${p.z.toFixed(2)} is unreachable`);+ if (path.length === 0) continue; // already standing on it+ assertClearPath(grid, start, p, path, name);+ }+ }+ });+ }++ it(`walks back from every target to the spawn, starting inside furniture if need be (${variant})`, () => {+ const layout = buildOfficeLayout(roster(10), { variant });const grid = buildNavGrid(layout);- expect(isWalkable(grid, layout.spawn)).toBe(true);for (const { name, p } of targetsOf(layout)) {- const path = findPath(grid, layout.spawn, p);- if (!path) throw new Error(`${name} at ${p.x.toFixed(2)},${p.z.toFixed(2)} is unreachable`);- assertClearPath(grid, layout.spawn, p, path, name);+ const path = findPath(grid, p, layout.spawn);+ expect(path, name).not.toBeNull();+ const tail = path!.at(-1)!;+ expect(tail).toEqual(layout.spawn);}});}- it("walks back from every target to the spawn, starting inside furniture if need be", () => {- const layout = buildOfficeLayout(roster(10));- const grid = buildNavGrid(layout);- for (const { name, p } of targetsOf(layout)) {- const path = findPath(grid, p, layout.spawn);- expect(path, name).not.toBeNull();- const tail = path!.at(-1)!;- expect(tail).toEqual(layout.spawn);- }- });-it("blocks obstacles and everything outside the floor", () => {const layout = buildOfficeLayout(roster(4));const grid = buildNavGrid(layout);diff --git a/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts b/jarvis/ui/web/frontend/src/components/society/office/officePalette.tsindex 5ada3efc26..1a2a28de01 100644--- a/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/officePalette.ts@@ -76,6 +76,9 @@ export const ROOM_FLOOR_COLOURS = {wardrobe: { base: "#ddd3ea", accents: ["#cfc3e0", "#e6ddf1"] },reception: { base: "#e7e2d9", accents: ["#ece8e0", "#e0dacf", "#e9e4dc"] },break: { base: "#d98b6e", accents: ["#e0967a", "#d08065", "#dc9074"] },+ // Coding floor: a calm sage carpet in the focus zone, cool raised-floor tiles in the server room.+ focus: { base: "#9fb08c", accents: ["#a9ba96", "#94a582", "#a3b491"] },+ server: { base: "#b9c0cb", accents: ["#c3cad4", "#aeb5c0"] },} as const;/** Checkpoint gold: floor ring, hexagon token and the label badge. */diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeStore.ts b/jarvis/ui/web/frontend/src/components/society/office/officeStore.tsindex 5afc2ed4e2..59205245ab 100644--- a/jarvis/ui/web/frontend/src/components/society/office/officeStore.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/officeStore.ts@@ -11,12 +11,29 @@ import type { CheckpointKind, Point } from "./officeLayout";/** `arcade` is a playable arcade cabinet, by furniture id. */export type Selection = { kind: "agent"; id: string } | { kind: "checkpoint"; id: CheckpointKind } | { kind: "arcade"; id: string };+/** The two floors of the building: the Jarvis agents office and, one elevator ride up, the coding agents. */+export type OfficeFloor = "agents" | "coding";++export const OFFICE_FLOORS: readonly OfficeFloor[] = ["agents", "coding"];++export function otherFloor(floor: OfficeFloor): OfficeFloor {+ return floor === "agents" ? "coding" : "agents";+}+export interface PlayerBody { x: number; z: number; heading: number; path: Point[]; moving: boolean }/** Agents walking over to a point for a while (called by the person, or a team gathering). */export interface Summon { target: Point; untilMs: number }interface OfficeState {+ /** The floor on screen; lives here so leaving the map and coming back keeps it. */+ floor: OfficeFloor;+ /**+ * Switch floors: forgets panels, the nearby target, calls and a pending walk+ * (they belong to the floor that was left). The character's position is the+ * job of `switchFloor` + the scene, because only the new floor plan knows the elevator.+ */+ setFloor: (floor: OfficeFloor) => void;selection: Selection | null;/** The closest thing the character can interact with (E), or null. */nearby: Selection | null;@@ -47,6 +64,10 @@ interface OfficeState {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: {}, walkTo: null, zoom: null, focus: null, teamDraft: [], follow: true,+ })),selection: null,nearby: null,follow: true,@@ -93,7 +114,29 @@ export const officeSession: {playerPlaced: boolean;camera: { position: [number, number, number]; target: [number, number, number] } | null;follow: boolean;-} = { playerPlaced: false, camera: null, follow: true };+ /** Where the character stood on each floor when it last left it. */+ floors: Partial<Record<OfficeFloor, { x: number; z: number; heading: number }>>;+ /**+ * A pending arrival: the next floor plan of `floor` places the character+ * (at the elevator after a ride, else where it last stood there).+ */+ arrival: { floor: OfficeFloor; at: "elevator" | "remembered" } | null;+} = { playerPlaced: false, camera: null, follow: true, floors: {}, arrival: null };++/**+ * Leave the current floor for `to`: remember where the character stands, then+ * switch. `ride` = the elevator (arrive at its doors); otherwise (a mount that+ * asks for another floor) the character returns to where it last stood there.+ */+export function switchFloor(to: OfficeFloor, ride: boolean): void {+ const store = useOfficeStore.getState();+ if (store.floor === to) return;+ if (officeSession.playerPlaced) officeSession.floors[store.floor] = { x: player.x, z: player.z, heading: player.heading };+ officeSession.arrival = { floor: to, at: ride || !officeSession.floors[to] ? "elevator" : "remembered" };+ player.path = [];+ player.moving = false;+ store.setFloor(to);+}/** The character's body, mutated by the player controller every frame. */export const player: PlayerBody = { x: 0, z: 0, heading: Math.PI, path: [], moving: false };diff --git a/jarvis/ui/web/frontend/src/components/society/office/terminalScreen.test.ts b/jarvis/ui/web/frontend/src/components/society/office/terminalScreen.test.tsnew file mode 100644index 0000000000..320d021a8a--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/terminalScreen.test.ts@@ -0,0 +1,99 @@+import { describe, expect, it } from "vitest";+import type { PaneScreen } from "@/lib/paneScreensApi";+import {+ drawTerminalScreen, paneDot, screenChanged, terminalLayout, truncateRow, visibleRows,+} from "./terminalScreen";++/** A 2D context that records what was drawn. */+function recordingContext() {+ const texts: { text: string; x: number; y: number; fill: string }[] = [];+ const rects: { x: number; y: number; w: number; h: number; fill: string }[] = [];+ const ctx = {+ fillStyle: "", font: "", textAlign: "start", textBaseline: "alphabetic",+ fillRect(x: number, y: number, w: number, h: number) { rects.push({ x, y, w, h, fill: String(this.fillStyle) }); },+ fillText(text: string, x: number, y: number) { texts.push({ text, x, y, fill: String(this.fillStyle) }); },+ beginPath() {}, arc() {}, fill() {},+ measureText(text: string) { return { width: text.length * 8 }; },+ };+ return { ctx: ctx as unknown as CanvasRenderingContext2D, texts, rects };+}++const screen = (over: Partial<PaneScreen> = {}): PaneScreen => ({+ workspace_id: "ws", key: "T1", name: "T1", cols: 80, rows: 30, lines: [], cursor: null, at: 1, ...over,+});++describe("terminal monitor layout", () => {+ it("shows the bottom block ending at the last non-empty row", () => {+ const lines = ["a", "b", "c", "d", "e", "", ""];+ expect(visibleRows(lines, 3, null)).toEqual({ rows: ["c", "d", "e"], first: 2 });+ expect(visibleRows(lines, 10, null)).toEqual({ rows: ["a", "b", "c", "d", "e"], first: 0 });+ });+ it("keeps a cursor row below the text in view", () => {+ expect(visibleRows(["a", "b", "", ""], 2, [3, 0])).toEqual({ rows: ["", ""], first: 2 });+ });+ it("draws nothing but the cursor row for an empty screen", () => {+ expect(visibleRows(["", " "], 5, null)).toEqual({ rows: [], first: 0 });+ });+ it("shrinks the font for wide terminals within bounds", () => {+ const narrow = terminalLayout(40), wide = terminalLayout(200);+ expect(narrow.font).toBeGreaterThan(wide.font);+ expect(wide.font).toBeGreaterThanOrEqual(9);+ expect(narrow.font).toBeLessThanOrEqual(15);+ expect(wide.fit).toBeGreaterThan(narrow.fit);+ });+ it("cuts long rows with an ellipsis", () => {+ expect(truncateRow("abcdef", 4)).toBe("abc…");+ expect(truncateRow("abc", 4)).toBe("abc");+ });+});++describe("terminal monitor state", () => {+ it("reads the title dot like the grid badge", () => {+ expect(paneDot({ status: "live", activity: "working" })).toBe("working");+ expect(paneDot({ status: "pending", activity: "" })).toBe("working");+ expect(paneDot({ status: "live", activity: "asking" })).toBe("asking");+ expect(paneDot({ status: "error", activity: "working" })).toBe("error");+ expect(paneDot({ status: "live", activity: "failed" })).toBe("error");+ expect(paneDot({ status: "live", activity: "waiting" })).toBe("idle");+ expect(paneDot({ status: "exited", activity: "exited" })).toBe("idle");+ });+ it("redraws only when the feed stamp or cursor moves", () => {+ const a = screen({ at: 1, cursor: [1, 2] });+ expect(screenChanged(undefined, a)).toBe(true);+ expect(screenChanged(a, undefined)).toBe(true);+ expect(screenChanged(undefined, undefined)).toBe(false);+ expect(screenChanged(a, { ...a, lines: ["new array, same stamp"] })).toBe(false);+ expect(screenChanged(a, { ...a, at: 2 })).toBe(true);+ expect(screenChanged(a, { ...a, cursor: [1, 3] })).toBe(true);+ expect(screenChanged(a, { ...a, cursor: null })).toBe(true);+ });+});++describe("terminal monitor drawing", () => {+ it("draws the title, the last rows and a cursor block", () => {+ const { ctx, texts, rects } = recordingContext();+ const lines = Array.from({ length: 40 }, (_, i) => `line ${i}`);+ drawTerminalScreen(ctx, { name: "Refactor auth", dot: "working" }, screen({ lines, cursor: [39, 7] }));+ expect(texts[0].text).toBe("Refactor auth");+ const body = texts.slice(1).map((t) => t.text);+ expect(body.at(-1)).toBe("line 39");+ expect(body).not.toContain("line 0");+ // Background, title bar, cursor block.+ expect(rects).toHaveLength(3);+ const cursor = rects[2];+ expect(cursor.y).toBeGreaterThan(texts.at(-2)!.y);+ });+ it("truncates rows wider than the monitor", () => {+ const { ctx, texts } = recordingContext();+ drawTerminalScreen(ctx, { name: "x", dot: "idle" }, screen({ cols: 240, lines: ["y".repeat(240)] }));+ expect(texts[1].text.endsWith("…")).toBe(true);+ expect(texts[1].text.length).toBe(terminalLayout(240).cols);+ });+ it("shows a dim screensaver when no screen has arrived", () => {+ const { ctx, texts, rects } = recordingContext();+ drawTerminalScreen(ctx, { name: "Quiet pane", dot: "idle" }, undefined);+ expect(rects).toHaveLength(1);+ expect(texts.map((t) => t.text)).toEqual(["Quiet pane", ">_"]);+ expect(ctx.textAlign).toBe("start");+ });+});diff --git a/jarvis/ui/web/frontend/src/components/society/office/terminalScreen.ts b/jarvis/ui/web/frontend/src/components/society/office/terminalScreen.tsnew file mode 100644index 0000000000..9e09844e4f--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/terminalScreen.ts@@ -0,0 +1,152 @@+/**+ * A coding agent's desk monitor, drawn like a real terminal on a 2D canvas.+ *+ * Pure drawing and layout: the caller owns the canvas and the texture. The+ * screen text arrives with ANSI already stripped server-side; TUIs keep their+ * composer at the bottom, so the monitor shows the bottom block that fits.+ */+import type { PaneScreen } from "@/lib/paneScreensApi";+import type { WorkspacePaneRow } from "@/lib/agenticIdeApi";++/** Canvas size in pixels; the aspect matches the 0.66 x 0.38 m screen plane. */+export const TERMINAL_W = 768, TERMINAL_H = 442;++const TITLE_H = 40;+const PAD = 10;+/** Font size bounds: a wide TUI shrinks the text, a narrow one never blows it up. */+const MIN_FONT = 9, MAX_FONT = 15;+/** Wider terminals than this are cut on the right rather than shrunk further. */+const MAX_FIT_COLS = 110;+const MONO = "ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace";+const SANS = "system-ui, -apple-system, 'Segoe UI', sans-serif";+/** A monospace glyph is about this wide per pixel of font size. */+const CHAR_RATIO = 0.6;+const LINE_RATIO = 1.25;++export type ScreenDot = "working" | "asking" | "idle" | "error";++const DOT_COLOUR: Record<ScreenDot, string> = {+ working: "#4ade80",+ asking: "#fbbf24",+ idle: "#94a3b8",+ error: "#f87171",+};++/** The title-bar dot for a pane, the same reading the grid's badge gives. */+export function paneDot(pane: Pick<WorkspacePaneRow, "status" | "activity">): ScreenDot {+ if (pane.status === "error" || pane.activity === "failed") return "error";+ if (pane.activity === "asking") return "asking";+ if (pane.status === "pending" || pane.activity === "working" || pane.activity === "starting") return "working";+ return "idle";+}++/** Does `next` need a redraw over `prev`? The feed stamps every change with `at`. */+export function screenChanged(prev: PaneScreen | undefined, next: PaneScreen | undefined): boolean {+ if (!prev || !next) return prev !== next;+ if (prev.at !== next.at) return true;+ const [a, b] = [prev.cursor, next.cursor];+ return (a?.[0] ?? -1) !== (b?.[0] ?? -1) || (a?.[1] ?? -1) !== (b?.[1] ?? -1);+}++export interface TerminalLayout {+ font: number;+ lineH: number;+ /** Columns that fit on one row. */+ cols: number;+ /** Rows that fit below the title bar. */+ fit: number;+}++/** Font and grid for a terminal `cols` wide on the monitor. Pure. */+export function terminalLayout(cols: number): TerminalLayout {+ const want = Math.max(20, Math.min(cols || 80, MAX_FIT_COLS));+ const font = Math.max(MIN_FONT, Math.min(MAX_FONT, Math.floor((TERMINAL_W - 2 * PAD) / (want * CHAR_RATIO))));+ const lineH = Math.round(font * LINE_RATIO);+ return {+ font,+ lineH,+ cols: Math.floor((TERMINAL_W - 2 * PAD) / (font * CHAR_RATIO)),+ fit: Math.floor((TERMINAL_H - TITLE_H - PAD) / lineH),+ };+}++/**+ * The block of rows to show: the last `fit` rows ending at the last+ * non-empty row (or the cursor row, if that is lower). `first` is the screen+ * row index of `rows[0]`, so the cursor can be placed. Pure.+ */+export function visibleRows(lines: readonly string[], fit: number, cursor: [number, number] | null): { rows: string[]; first: number } {+ let end = lines.length;+ while (end > 0 && !lines[end - 1].trim()) end -= 1;+ if (cursor && cursor[0] + 1 > end) end = cursor[0] + 1;+ const first = Math.max(0, end - Math.max(1, fit));+ const rows: string[] = [];+ for (let i = first; i < end; i += 1) rows.push(lines[i] ?? "");+ return { rows, first };+}++/** Cut a row to `cols` characters, marking the cut with an ellipsis. Pure. */+export function truncateRow(row: string, cols: number): string {+ return row.length > cols ? `${row.slice(0, Math.max(0, cols - 1))}…` : row;+}++function titleBar(ctx: CanvasRenderingContext2D, name: string, dot: ScreenDot): void {+ ctx.fillStyle = "#161b24";+ ctx.fillRect(0, 0, TERMINAL_W, TITLE_H);+ ctx.fillStyle = DOT_COLOUR[dot];+ ctx.beginPath(); ctx.arc(20, TITLE_H / 2, 7, 0, Math.PI * 2); ctx.fill();+ ctx.fillStyle = "#e5e7eb";+ ctx.font = `600 19px ${SANS}`;+ ctx.textBaseline = "middle";+ ctx.fillText(truncateRow(name, 52), 36, TITLE_H / 2 + 1);+ ctx.textBaseline = "alphabetic";+}++/** Draw the terminal screen of one pane, or its screensaver when `screen` is absent. */+export function drawTerminalScreen(+ ctx: CanvasRenderingContext2D,+ agent: { name: string; dot: ScreenDot },+ screen: PaneScreen | undefined,+): void {+ if (!screen) {+ drawScreensaver(ctx, agent);+ return;+ }+ ctx.fillStyle = "#0b0e14";+ ctx.fillRect(0, 0, TERMINAL_W, TERMINAL_H);+ titleBar(ctx, agent.name, agent.dot);+ const layout = terminalLayout(screen.cols);+ const { rows, first } = visibleRows(screen.lines, layout.fit, screen.cursor);+ ctx.font = `${layout.font}px ${MONO}`;+ ctx.textBaseline = "alphabetic";+ ctx.fillStyle = "#d1d5db";+ const top = TITLE_H + PAD / 2;+ const charW = layout.font * CHAR_RATIO;+ rows.forEach((row, i) => {+ if (row) ctx.fillText(truncateRow(row, layout.cols), PAD, top + (i + 1) * layout.lineH - layout.lineH * 0.22);+ });+ if (screen.cursor) {+ const [row, col] = screen.cursor;+ const at = row - first;+ if (at >= 0 && at < rows.length && col < layout.cols) {+ ctx.fillStyle = "rgba(229, 231, 235, 0.85)";+ ctx.fillRect(PAD + col * charW, top + at * layout.lineH + 1, Math.max(2, charW), layout.lineH - 2);+ }+ }+}++/** A dim face for a monitor whose agent is away or whose screen has not arrived. */+export function drawScreensaver(ctx: CanvasRenderingContext2D, agent: { name: string; dot: ScreenDot }): void {+ ctx.fillStyle = "#07090d";+ ctx.fillRect(0, 0, TERMINAL_W, TERMINAL_H);+ ctx.fillStyle = "rgba(148, 163, 184, 0.35)";+ ctx.font = `600 22px ${SANS}`;+ ctx.textAlign = "center";+ ctx.textBaseline = "middle";+ ctx.fillText(truncateRow(agent.name, 40), TERMINAL_W / 2, TERMINAL_H / 2 - 18);+ ctx.font = `28px ${MONO}`;+ ctx.fillStyle = agent.dot === "error" ? "rgba(248, 113, 113, 0.45)" : "rgba(148, 163, 184, 0.3)";+ ctx.fillText(">_", TERMINAL_W / 2, TERMINAL_H / 2 + 22);+ ctx.textAlign = "start";+ ctx.textBaseline = "alphabetic";+}diff --git a/jarvis/ui/web/frontend/src/components/society/office/usePaneScreens.test.ts b/jarvis/ui/web/frontend/src/components/society/office/usePaneScreens.test.tsnew file mode 100644index 0000000000..fe2d88c10f--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/usePaneScreens.test.ts@@ -0,0 +1,43 @@+import { describe, expect, it } from "vitest";+import type { PaneScreen } from "@/lib/paneScreensApi";+import { dueTargets, MAX_SCREEN_TARGETS, mergeScreens } from "./usePaneScreens";+import { nearestSeated } from "./TerminalMonitors";++const target = (n: number) => ({ agentId: `pane:ws:${n}`, workspaceId: "ws", key: `T${n}` });+const screen = (key: string, at: number): PaneScreen => ({+ workspace_id: "ws", key, name: key, cols: 80, rows: 24, lines: [key], cursor: null, at,+});++describe("terminal screen polling", () => {+ it("polls seated panes only, never more than the cap", () => {+ const targets = Array.from({ length: 9 }, (_, i) => target(i));+ const seated = new Set(targets.filter((_, i) => i !== 1).map((t) => t.agentId));+ const due = dueTargets(targets, seated);+ expect(due).toHaveLength(MAX_SCREEN_TARGETS);+ expect(due.map((t) => t.key)).not.toContain("T1");+ });++ it("maps screens back to agents and keeps the map when nothing changed", () => {+ const due = [target(1), target(2)];+ const targeted = new Set(due.map((t) => t.agentId));+ const first = mergeScreens(new Map(), [screen("T1", 1), screen("T9", 1)], due, targeted);+ expect([...first.keys()]).toEqual(["pane:ws:1"]);+ expect(mergeScreens(first, [screen("T1", 1)], due, targeted)).toBe(first);+ const moved = mergeScreens(first, [screen("T1", 2)], due, targeted);+ expect(moved).not.toBe(first);+ expect(moved.get("pane:ws:1")?.at).toBe(2);+ });++ it("drops screens of agents no longer targeted", () => {+ const due = [target(1)];+ const first = mergeScreens(new Map(), [screen("T1", 1)], due, new Set(["pane:ws:1"]));+ expect(mergeScreens(first, [], [], new Set()).size).toBe(0);+ });++ it("picks the nearest seated monitors, in a stable order", () => {+ const picked = nearestSeated([+ { id: "c", distance: 3 }, { id: "a", distance: 9 }, { id: "b", distance: 1 }, { id: "far", distance: 30 },+ ], 3);+ expect(picked).toEqual(["a", "b", "c"]);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/society/office/usePaneScreens.ts b/jarvis/ui/web/frontend/src/components/society/office/usePaneScreens.tsnew file mode 100644index 0000000000..e0e0546185--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/usePaneScreens.ts@@ -0,0 +1,86 @@+/**+ * Live terminal screens for the coding agents who sit at their desk right now.+ *+ * One batched request per tick for the seated targets only, jittered so+ * windows and panes never fire in lockstep (AP-33). Never gated on+ * `document.hidden`: the desktop WebView reports hidden while on screen.+ * A failed poll keeps the last good screens; the first failure of a streak is+ * logged, the rest stay quiet until a poll succeeds again.+ */+import { useEffect, useRef, useState } from "react";+import { fetchPaneScreens, type PaneScreen } from "@/lib/paneScreensApi";+import { screenChanged } from "./terminalScreen";+import { seatedAtDesk } from "./walkerRegistry";++const POLL_MIN_MS = 1200;+const POLL_JITTER_MS = 800;+/** Never more panes per request than this; the feed accepts up to 8. */+export const MAX_SCREEN_TARGETS = 6;++export interface PaneScreenTarget { agentId: string; workspaceId: string; key: string }++/** The targets due this tick: seated ones only, at most MAX_SCREEN_TARGETS. Pure. */+export function dueTargets(targets: readonly PaneScreenTarget[], seated: ReadonlySet<string>): PaneScreenTarget[] {+ return targets.filter((t) => seated.has(t.agentId)).slice(0, MAX_SCREEN_TARGETS);+}++/**+ * Fold fetched screens into the map by agent id. Returns `prev` itself when+ * nothing changed, so React skips the render; drops agents no longer targeted. Pure.+ */+export function mergeScreens(+ prev: ReadonlyMap<string, PaneScreen>,+ fetched: readonly PaneScreen[],+ due: readonly PaneScreenTarget[],+ targeted: ReadonlySet<string>,+): ReadonlyMap<string, PaneScreen> {+ const byPane = new Map(due.map((t) => [`${t.workspaceId}:${t.key}`, t.agentId]));+ let next: Map<string, PaneScreen> | null = null;+ for (const id of prev.keys()) {+ if (targeted.has(id)) continue;+ next ??= new Map(prev);+ next.delete(id);+ }+ for (const screen of fetched) {+ const agentId = byPane.get(`${screen.workspace_id}:${screen.key}`);+ if (!agentId || !screenChanged((next ?? prev).get(agentId), screen)) continue;+ next ??= new Map(prev);+ next.set(agentId, screen);+ }+ return next ?? prev;+}++export function usePaneScreens(targets: PaneScreenTarget[], awake: boolean): ReadonlyMap<string, PaneScreen> {+ const [screens, setScreens] = useState<ReadonlyMap<string, PaneScreen>>(new Map());+ const targetsRef = useRef(targets);+ targetsRef.current = targets;+ const active = awake && targets.length > 0;+ useEffect(() => {+ if (!active) return;+ let cancelled = false;+ let failing = false;+ let timer: ReturnType<typeof setTimeout>;+ const schedule = () => { timer = setTimeout(() => void tick(), POLL_MIN_MS + Math.random() * POLL_JITTER_MS); };+ const tick = async () => {+ const due = dueTargets(targetsRef.current, seatedAtDesk);+ if (due.length > 0) {+ try {+ const fetched = await fetchPaneScreens(due.map((t) => ({ workspaceId: t.workspaceId, key: t.key })));+ if (cancelled) return;+ failing = false;+ const targeted = new Set(targetsRef.current.map((t) => t.agentId));+ setScreens((prev) => mergeScreens(prev, fetched, due, targeted));+ } catch (error) {+ if (cancelled) return;+ // The monitors keep their last good frame; one log line per failure streak.+ if (!failing) console.warn("Terminal screen poll failed; keeping the last screens", error);+ failing = true;+ }+ }+ if (!cancelled) schedule();+ };+ timer = setTimeout(() => void tick(), Math.random() * POLL_JITTER_MS);+ return () => { cancelled = true; clearTimeout(timer); };+ }, [active]);+ return screens;+}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 6d2180ca21..08e7880df4 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -5808,7 +5808,12 @@"tabs": {"agents": "Agents","files": "Ordner",- "changes": "Änderungen"+ "changes": "Änderungen",+ "office": "Büro"+ },+ "office": {+ "failed": "Die Büro-Karte konnte nicht laden.",+ "retry": "Erneut versuchen"},"agents": {"aria": "Agents in diesem Workspace",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex 617bef4149..197e08fd59 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -5841,7 +5841,12 @@"tabs": {"agents": "Agents","files": "Folder",- "changes": "Changes"+ "changes": "Changes",+ "office": "Office"+ },+ "office": {+ "failed": "The office map could not load.",+ "retry": "Try again"},"agents": {"aria": "Agents in this workspace",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex 121020b895..264fe92457 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -5808,7 +5808,12 @@"tabs": {"agents": "Agentes","files": "Carpeta",- "changes": "Cambios"+ "changes": "Cambios",+ "office": "Oficina"+ },+ "office": {+ "failed": "No se pudo cargar el mapa de la oficina.",+ "retry": "Reintentar"},"agents": {"aria": "Agentes de este espacio de trabajo",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json b/jarvis/ui/web/frontend/src/i18n/locales/society/de.jsonindex 5368663047..d22b928ace 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json@@ -781,6 +781,41 @@"cp_lead_hint": "Mit deinem Chef-Agenten sprechen","cp_break": "Pausenraum","cp_break_hint": "Kaffeepause ausrufen",+ "cp_elevator": "Aufzug",+ "cp_elevator_hint": "Ins andere Stockwerk fahren",+ "coding_title": "Coding-Etage",+ "coding_subtitle": "Coding-Sessions auf der Etage: {0}",+ "coding_empty": "Kein Coding-Agent läuft. Starte einen in der IDE, dann bekommt er hier einen Schreibtisch.",+ "floor_up": "Hoch zur Coding-Etage",+ "floor_down": "Runter ins Agenten-Büro",+ "ledger_coding": "Session-Liste",+ "open_ide": "IDE öffnen",+ "riding_up": "Fahrt hoch zur Coding-Etage",+ "riding_down": "Fahrt runter ins Agenten-Büro",+ "prompt_pane": "Nach {0} sehen",+ "since_now": "gerade eben",+ "since_minutes": "seit {0} Min.",+ "since_hours": "seit {0} Std.",+ "since_days": "seit {0} T.",+ "pane_state_starting": "Startet",+ "pane_state_working": "Arbeitet",+ "pane_state_needs_input": "Wartet auf dich",+ "pane_state_failed": "Fehlgeschlagen",+ "pane_state_error": "Fehler",+ "pane_state_exited": "Beendet",+ "pane_state_done": "Fertig",+ "pane_state_idle": "Frei",+ "pane_workspace": "Workspace",+ "pane_recap": "Thema",+ "pane_prompt": "Letzter Prompt",+ "pane_unasked": "Noch nichts gefragt.",+ "pane_open": "Session öffnen",+ "elevator_up_body": "Die Coding-Agenten arbeiten ein Stockwerk höher: Jede laufende IDE-Session hat dort einen Schreibtisch, ihr Terminal live auf dem Monitor.",+ "elevator_down_body": "Die Jarvis-Agenten arbeiten ein Stockwerk tiefer.",+ "elevator_up_count": "Gerade oben: {0}",+ "elevator_down_count": "Gerade unten: {0}",+ "elevator_up": "Hoch zur Coding-Etage",+ "elevator_down": "Runter ins Agenten-Büro","arcade_prompt": "Am Automaten zocken","arcade_title": "Automat im Pausenraum","arcade_score": "Punkte",@@ -796,6 +831,8 @@"room_wardrobe": "Garderobe","room_reception": "Empfang","room_break": "Pausenraum",+ "room_focus": "Ruhezone",+ "room_server": "Serverraum","prompt_agent": "Mit {0} sprechen","prompt_checkpoint": "Benutzen: {0}","me": "Mir folgen",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json b/jarvis/ui/web/frontend/src/i18n/locales/society/en.jsonindex 0ff4fed5de..5c5fc23c15 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json@@ -781,6 +781,41 @@"cp_lead_hint": "Talk to your lead agent","cp_break": "Break room","cp_break_hint": "Call a coffee break",+ "cp_elevator": "Elevator",+ "cp_elevator_hint": "Ride to the other floor",+ "coding_title": "Coding floor",+ "coding_subtitle": "Coding sessions on the floor: {0}",+ "coding_empty": "No coding agent is running. Start one in the IDE and it takes a desk here.",+ "floor_up": "Up to the coding floor",+ "floor_down": "Down to the agents office",+ "ledger_coding": "Sessions list",+ "open_ide": "Open the IDE",+ "riding_up": "Going up to the coding floor",+ "riding_down": "Going down to the agents office",+ "prompt_pane": "Check on {0}",+ "since_now": "just now",+ "since_minutes": "for {0} min",+ "since_hours": "for {0} h",+ "since_days": "for {0} d",+ "pane_state_starting": "Starting",+ "pane_state_working": "Working",+ "pane_state_needs_input": "Waiting for you",+ "pane_state_failed": "Failed",+ "pane_state_error": "Error",+ "pane_state_exited": "Exited",+ "pane_state_done": "Done",+ "pane_state_idle": "Idle",+ "pane_workspace": "Workspace",+ "pane_recap": "Topic",+ "pane_prompt": "Last prompt",+ "pane_unasked": "Nothing asked yet.",+ "pane_open": "Open session",+ "elevator_up_body": "The coding agents work one floor up: every running IDE session has a desk there, its terminal live on the monitor.",+ "elevator_down_body": "The Jarvis agents work one floor down.",+ "elevator_up_count": "Upstairs right now: {0}",+ "elevator_down_count": "Downstairs right now: {0}",+ "elevator_up": "Up to the coding floor",+ "elevator_down": "Down to the agents office","arcade_prompt": "Play the arcade","arcade_title": "Break-room arcade","arcade_score": "Score",@@ -796,6 +831,8 @@"room_wardrobe": "Wardrobe","room_reception": "Reception","room_break": "Break room",+ "room_focus": "Focus zone",+ "room_server": "Server room","prompt_agent": "Talk to {0}","prompt_checkpoint": "Use: {0}","me": "Follow me",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json b/jarvis/ui/web/frontend/src/i18n/locales/society/es.jsonindex a29e432762..a5059565cd 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json@@ -781,6 +781,41 @@"cp_lead_hint": "Hablar con tu agente líder","cp_break": "Sala de descanso","cp_break_hint": "Hacer una pausa de café",+ "cp_elevator": "Ascensor",+ "cp_elevator_hint": "Subir o bajar de planta",+ "coding_title": "Planta de código",+ "coding_subtitle": "Sesiones de código en la planta: {0}",+ "coding_empty": "No hay ningún agente de código en marcha. Inicia uno en el IDE y ocupará un escritorio aquí.",+ "floor_up": "Subir a la planta de código",+ "floor_down": "Bajar a la oficina de agentes",+ "ledger_coding": "Lista de sesiones",+ "open_ide": "Abrir el IDE",+ "riding_up": "Subiendo a la planta de código",+ "riding_down": "Bajando a la oficina de agentes",+ "prompt_pane": "Ver a {0}",+ "since_now": "ahora mismo",+ "since_minutes": "desde hace {0} min",+ "since_hours": "desde hace {0} h",+ "since_days": "desde hace {0} d",+ "pane_state_starting": "Iniciando",+ "pane_state_working": "Trabajando",+ "pane_state_needs_input": "Te espera",+ "pane_state_failed": "Fallido",+ "pane_state_error": "Error",+ "pane_state_exited": "Terminado",+ "pane_state_done": "Listo",+ "pane_state_idle": "Libre",+ "pane_workspace": "Espacio de trabajo",+ "pane_recap": "Tema",+ "pane_prompt": "Último prompt",+ "pane_unasked": "Todavía no se le ha pedido nada.",+ "pane_open": "Abrir sesión",+ "elevator_up_body": "Los agentes de código trabajan una planta más arriba: cada sesión del IDE en marcha tiene allí un escritorio, con su terminal en directo en el monitor.",+ "elevator_down_body": "Los agentes de Jarvis trabajan una planta más abajo.",+ "elevator_up_count": "Arriba ahora mismo: {0}",+ "elevator_down_count": "Abajo ahora mismo: {0}",+ "elevator_up": "Subir a la planta de código",+ "elevator_down": "Bajar a la oficina de agentes","arcade_prompt": "Jugar a la máquina","arcade_title": "Máquina recreativa","arcade_score": "Puntos",@@ -796,6 +831,8 @@"room_wardrobe": "Vestuario","room_reception": "Recepción","room_break": "Sala de descanso",+ "room_focus": "Zona de concentración",+ "room_server": "Sala de servidores","prompt_agent": "Hablar con {0}","prompt_checkpoint": "Usar: {0}","me": "Seguirme",diff --git a/jarvis/ui/web/frontend/src/store/ideSidePanel.ts b/jarvis/ui/web/frontend/src/store/ideSidePanel.tsindex 17af141597..559eb19255 100644--- a/jarvis/ui/web/frontend/src/store/ideSidePanel.ts+++ b/jarvis/ui/web/frontend/src/store/ideSidePanel.ts@@ -11,9 +11,9 @@ import { create } from "zustand";*//** Every function the panel can show. A new one is a new id plus a registry entry. */-export type SidePanelTabId = "agents" | "changes" | "files";+export type SidePanelTabId = "agents" | "changes" | "files" | "git" | "office";-export const SIDE_PANEL_TAB_IDS: readonly SidePanelTabId[] = ["agents", "changes", "files"];+export const SIDE_PANEL_TAB_IDS: readonly SidePanelTabId[] = ["agents", "changes", "files", "git", "office"];const OPEN_KEY = "jarvis.agenticIde.sidePanelOpen";// v4: the panel starts with Agents alone and the other tabs are added fromdiff --git a/jarvis/ui/web/frontend/src/store/workspacePanes.ts b/jarvis/ui/web/frontend/src/store/workspacePanes.tsindex 7bb2bc111e..99ca79ba0a 100644--- a/jarvis/ui/web/frontend/src/store/workspacePanes.ts+++ b/jarvis/ui/web/frontend/src/store/workspacePanes.ts@@ -143,11 +143,14 @@ let onActivity: ((event: Event) => void) | null = null;/*** Subscribe this component to the pane list, sharing one poll with the others.*- * Returns the rows so a caller can use it as a plain hook.+ * Returns the rows so a caller can use it as a plain hook. `enabled = false`+ * holds no subscription (a hidden view must not keep the poll alive) and just+ * returns whatever the store last held.*/-export function useWorkspacePanes(): WorkspacePaneRow[] {+export function useWorkspacePanes(enabled = true): WorkspacePaneRow[] {const panes = useWorkspacePanesStore((s) => s.panes);useEffect(() => {+ if (!enabled) return undefined;watchers += 1;if (timer === null) {void useWorkspacePanesStore.getState().load();@@ -174,7 +177,7 @@ export function useWorkspacePanes(): WorkspacePaneRow[] {onActivity = null;}};- }, []);+ }, [enabled]);return panes;}