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): open a coding agent's terminal full-size, live monitors, lighter full view
rubenluetke10-beepeaa2113c3268
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.test.tsxindex 63900509db..84bc05bd43 100644--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.test.tsx@@ -19,6 +19,7 @@ vi.mock("./AgenticTerminal", () => ({ AgenticTerminal: (props: {vi.mock("@/hooks/useTheme", () => ({ useThemeValue: () => "dark" }));import { WorkspaceTerminalGrid } from "./WorkspaceTerminalGrid";import { useIdeSidePanelStore } from "@/store/ideSidePanel";+import { useIdeChatStore } from "@/store/ideChat";import { balancedLayout, previewDock } from "./workspaceDocking";class ResizeObserverStub { observe() {} disconnect() {} }@@ -220,6 +221,23 @@ it("drags the seam between two panes to resize them and saves the new sizes", as} finally { vi.useRealTimers(); }});+it("maximizes the pane the office asked for, once, and only in its own workspace", () => {+ act(() => useIdeChatStore.setState({ paneRequest: { workspaceId: "w2", pane: "T3", nonce: 7, maximize: true } }));+ const { unmount } = render(<WorkspaceTerminalGrid {...props} session={makeSession()} />);+ expect(screen.getAllByRole("separator").length).toBe(3);+ unmount();++ act(() => useIdeChatStore.setState({ paneRequest: { workspaceId: "w1", pane: "T3", nonce: 8, maximize: true } }));+ render(<WorkspaceTerminalGrid {...props} session={makeSession()} />);+ expect(screen.queryAllByRole("separator")).toHaveLength(0);+ const hidden = [...document.querySelectorAll<HTMLElement>("[data-session-id]")]+ .filter((node) => node.className.split(/\s+/).includes("hidden"))+ .map((node) => node.dataset.sessionId);+ expect(hidden).toEqual(["T1", "T2", "T4"]);+ expect(useIdeChatStore.getState().paneRequest).toMatchObject({ nonce: 8, maximize: false });+ act(() => useIdeChatStore.setState({ paneRequest: null }));+});+it("hides the seams while a pane is maximized", () => {render(<WorkspaceTerminalGrid {...props} session={makeSession()} />);expect(screen.getAllByRole("separator").length).toBe(3);diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.tsxindex d02f0bf0b2..e537277d20 100644--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceTerminalGrid.tsx@@ -8,6 +8,7 @@ import { forkTerminal, moveTerminal, placeTerminal, renameTerminal, type PaneMovimport { useComputerChoices } from "@/hooks/useComputers";import { useThemeValue } from "@/hooks/useTheme";import { useEventStore } from "@/store/events";+import { useIdeChatStore } from "@/store/ideChat";import { useIdeSidePanelStore } from "@/store/ideSidePanel";import { cn } from "@/lib/utils";import { PaneResizer } from "@/components/layout/PaneResizer";@@ -121,6 +122,17 @@ export function WorkspaceTerminalGrid({ session, onChanged, onAdd, onClose, onSeuseEffect(() => {if (maximized && !members.includes(maximized)) setMaximized(null);}, [maximized, members]);+ // "Show me that terminal" from the office: the pane fills the grid, live. A+ // request for another workspace waits for that workspace's own grid.+ const paneRequest = useIdeChatStore((state) => state.paneRequest);+ const settlePaneMaximize = useIdeChatStore((state) => state.settlePaneMaximize);+ useEffect(() => {+ if (!paneRequest?.maximize || paneRequest.workspaceId !== session.id) return;+ const terminal = session.terminals.find((entry) => entry.name === paneRequest.pane);+ if (!terminal) return;+ settlePaneMaximize(paneRequest.nonce);+ setMaximized(idOf(terminal));+ }, [paneRequest, session.id, session.terminals, settlePaneMaximize]);useEffect(() => { if (disabled) dragCleanup.current?.(); }, [disabled]);useEffect(() => {const node = frame.current;diff --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 0435795254..bf890a67a7 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@@ -157,6 +157,8 @@ describe("IdeSidePanel", () => {fireEvent.click(screen.getByTestId("ide-side-panel-maximize"));expect(useIdeSidePanelStore.getState().maximized).toBe(true);expect(screen.getByTestId("ide-side-panel-body").className).toContain("absolute inset-0");+ expect(screen.getByTestId("ide-side-panel-grid").className).toContain("invisible");+ expect(screen.getByTestId("grid")).toBeTruthy();expect(host.className).not.toContain("relative");expect(host.style.width).toBe("600px");expect(screen.queryByTestId("ide-side-panel-resizer")).toBeNull();@@ -164,6 +166,7 @@ describe("IdeSidePanel", () => {fireEvent.click(screen.getByTestId("ide-side-panel-maximize"));expect(screen.getByTestId("ide-side-panel-body").className).toBe("h-full");+ expect(screen.getByTestId("ide-side-panel-grid").className).not.toContain("invisible");expect(screen.getByTestId("office-stage")).toBe(stage);});diff --git a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsxindex 830afc60a3..72c4befdf6 100644--- a/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/sidePanel/IdeSidePanel.tsx@@ -80,7 +80,9 @@ export function IdeSidePanelFrame({ children }: { children: ReactNode }) {return (<div ref={frame} className="relative flex h-full min-h-0 w-full">- <div className="h-full min-h-0 min-w-0 flex-1">{children}</div>+ {/* Hidden, not removed, under a maximized panel: the glass theme's panel is+ see-through, and the live terminals keep their size and sockets. */}+ <div data-testid="ide-side-panel-grid" className={cn("h-full min-h-0 min-w-0 flex-1", maximized && "invisible")}>{children}</div>{/* Maximized, the host keeps its width in the row so the terminals behindit never resize, and stops being the positioning box: the panel thenanchors to the frame and covers the whole view. */}@@ -124,7 +126,7 @@ export function IdeSidePanelFrame({ children }: { children: ReactNode }) {</div>)}{/* Same element either way, so the live office scene is never remounted. */}- <div data-testid="ide-side-panel-body" className={maximized ? "absolute inset-0 z-30 bg-background" : "h-full"}>+ <div data-testid="ide-side-panel-body" className={maximized ? "absolute inset-0 z-30" : "h-full"}><IdeSidePanel /></div></>diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsxindex ff18cce6b3..05003deed2 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx@@ -28,6 +28,7 @@ import { otherFloor, player, switchFloor, useOfficeStore, type OfficeFloor } froimport { agentPositions, seatedAtDesk } from "./walkerRegistry";import { useCodingFloorOccupants, type PaneOccupant } from "./codingFloor";import { openPaneSession } from "./codingNavigate";+import { useDprBudget } from "./useDprBudget";import { knownOnFloor, noteArrivals } from "./officeFloors";import { loadProfile, playerLook, saveProfile, type PlayerProfile } from "./playerProfile";import { AgentPanel, CheckpointPanel, PaneAgentPanel, type OfficeActions } from "./OfficePanels";@@ -177,14 +178,15 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpenif (onSelectAgent) onSelectAgent(agentId);else useEventStore.getState().setActiveSection("agents");}, [onSelectAgent]);- // Clicking a monitor dives into it, then opens that agent's chat (or IDE session).+ // Clicking a chat monitor dives into it, then opens that agent's chat. A+ // terminal skips the dive: the live pane, maximized in the grid, is the close-up.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) { openAgent(agentId); return; }+ if (reduced || occupantsRef.current.has(agentId)) { 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);@@ -288,6 +290,9 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpenconst showHintBar = useOfficeSettings((s) => s.showHintBar);const receptionOpen = selection?.kind === "checkpoint" && selection.id === "create";+ // A full-view office draws no more pixels than a side-panel one would afford.+ const dpr = useDprBudget(hostRef);+return (<section className={compact ? "office-stage office-stage-compact" : "office-stage"} aria-label={t(titleKey)}data-office-agents={active.length} data-office-floor={floor}>@@ -295,7 +300,7 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen{webgl ? (<RenderBoundary key={generation} fallbackText={t("society.office.no_graphics")}><Suspense fallback={<div className="office-fallback" role="status">{t("society.office.loading")}</div>}>- <Canvas shadows="percentage" camera={{ fov: CAMERA_FOV, near: 0.2, far: 800, position: [30, 30, 30] }} dpr={[1, 1.75]}+ <Canvas shadows="percentage" camera={{ fov: CAMERA_FOV, near: 0.2, far: 800, position: [30, 30, 30] }} dpr={dpr}gl={{ antialias: true, alpha: true, preserveDrawingBuffer: import.meta.env.DEV }}frameloop={!awake ? "never" : "always"}onPointerMissed={() => select(null)}>diff --git a/jarvis/ui/web/frontend/src/components/society/office/TerminalMonitors.tsx b/jarvis/ui/web/frontend/src/components/society/office/TerminalMonitors.tsxindex 7adbaabc0c..bee6186b76 100644--- a/jarvis/ui/web/frontend/src/components/society/office/TerminalMonitors.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/TerminalMonitors.tsx@@ -1,7 +1,7 @@/*** 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.+ * screen opens that session, maximized in the IDE grid.*/import { useEffect, useMemo, useRef, useState } from "react";import { useFrame, type ThreeEvent } from "@react-three/fiber";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.tsindex 173117f954..472b9140ec 100644--- a/jarvis/ui/web/frontend/src/components/society/office/codingNavigate.test.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/codingNavigate.test.ts@@ -14,7 +14,7 @@ describe("open a coding session from the office", () => {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" });+ expect(useIdeChatStore.getState().paneRequest).toMatchObject({ workspaceId: "ws-1", pane: "T2", maximize: true });});it("stays in the IDE and issues a fresh request each time", () => {diff --git a/jarvis/ui/web/frontend/src/components/society/office/codingNavigate.ts b/jarvis/ui/web/frontend/src/components/society/office/codingNavigate.tsindex e31b9b5133..e416283dec 100644--- a/jarvis/ui/web/frontend/src/components/society/office/codingNavigate.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/codingNavigate.ts@@ -1,4 +1,4 @@-/** Leave the coding floor for the real session: the Agentic IDE with that pane focused. */+/** Leave the coding floor for the real session: the Agentic IDE with that pane maximized. */import type { WorkspacePaneRow } from "@/lib/agenticIdeApi";import { useEventStore } from "@/store/events";import { useIdeChatStore } from "@/store/ideChat";@@ -7,7 +7,8 @@ import { useIdeSidePanelStore } from "@/store/ideSidePanel";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);+ // The terminal opens full-size in the grid, live, the way the agent works in it.+ useIdeChatStore.getState().requestPane(pane.workspace_id, pane.name, { maximize: true });// A full-view office would hide the very pane it just focused.useIdeSidePanelStore.getState().setMaximized(false);}diff --git a/jarvis/ui/web/frontend/src/components/society/office/useDprBudget.test.ts b/jarvis/ui/web/frontend/src/components/society/office/useDprBudget.test.tsnew file mode 100644index 0000000000..45cedc558a--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/useDprBudget.test.ts@@ -0,0 +1,26 @@+import { describe, expect, it } from "vitest";+import { budgetDpr, MAX_DPR, PIXEL_BUDGET } from "./useDprBudget";++describe("office pixel budget", () => {+ it("gives a narrow side panel the full ratio the screen offers", () => {+ expect(budgetDpr(520, 1100, 1.5)).toBe(1.5);+ expect(budgetDpr(520, 1100, 3)).toBe(MAX_DPR);+ });++ it("holds a full-width 4K view near the budget instead of at the device ratio", () => {+ const dpr = budgetDpr(2100, 1350, 1.5);+ expect(dpr).toBe(1);+ expect(2100 * 1350 * dpr * dpr).toBeLessThan(1.5 * 1.5 * 2100 * 1350);+ });++ it("keeps a mid-size view inside the budget in quarter steps", () => {+ const dpr = budgetDpr(1400, 800, 2);+ expect(dpr * 4).toBe(Math.round(dpr * 4));+ expect(1400 * 800 * dpr * dpr).toBeLessThanOrEqual(PIXEL_BUDGET);+ });++ it("never drops below one and survives an unmeasured view", () => {+ expect(budgetDpr(5000, 3000, 2)).toBe(1);+ expect(budgetDpr(0, 0, 1.25)).toBe(1.25);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/society/office/useDprBudget.ts b/jarvis/ui/web/frontend/src/components/society/office/useDprBudget.tsnew file mode 100644index 0000000000..ef51226013--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/useDprBudget.ts@@ -0,0 +1,43 @@+/**+ * The office canvas's pixel ratio under a fixed pixel budget.+ *+ * Full resolution is cheap in the narrow side panel and ruinous when the same+ * scene fills a 4K window: shadows and MSAA are paid per pixel, so the frame+ * rate falls with the area. Holding the drawn pixel count near a budget keeps a+ * large view as smooth as a small one; a small view still gets the full ratio.+ */+import { useEffect, useState, type RefObject } from "react";++/** Physical pixels the scene is drawn at, at most (about 2.5 x 1.3 k). */+export const PIXEL_BUDGET = 3_200_000;+/** Never above this ratio, whatever the screen offers. */+export const MAX_DPR = 1.75;+/** Never below one CSS pixel per drawn pixel: below that text on the monitors blurs. */+const MIN_DPR = 1;++/** The ratio for a `width` x `height` CSS-pixel view on a `device`-ratio screen. Pure. */+export function budgetDpr(width: number, height: number, device: number): number {+ const top = Math.max(MIN_DPR, Math.min(MAX_DPR, device || 1));+ const area = width * height;+ if (area <= 0) return top;+ const fit = Math.sqrt(PIXEL_BUDGET / area);+ // Quarter steps: a window drag never reallocates the drawing buffer per frame.+ const stepped = Math.floor(fit * 4) / 4;+ return Math.max(MIN_DPR, Math.min(top, stepped));+}++export function useDprBudget(host: RefObject<HTMLElement | null>): number {+ const device = typeof window === "undefined" ? 1 : window.devicePixelRatio;+ const [dpr, setDpr] = useState(() => Math.min(MAX_DPR, Math.max(MIN_DPR, device)));+ useEffect(() => {+ const node = host.current;+ if (!node || typeof ResizeObserver === "undefined") return;+ const observer = new ResizeObserver(([entry]) => {+ const { width, height } = entry.contentRect;+ setDpr(budgetDpr(width, height, window.devicePixelRatio));+ });+ observer.observe(node);+ return () => observer.disconnect();+ }, [host]);+ return dpr;+}diff --git a/jarvis/ui/web/frontend/src/components/society/office/usePaneScreens.ts b/jarvis/ui/web/frontend/src/components/society/office/usePaneScreens.tsindex e0e0546185..56d1bb40c9 100644--- a/jarvis/ui/web/frontend/src/components/society/office/usePaneScreens.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/usePaneScreens.ts@@ -12,8 +12,10 @@ 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;+// The feed is an in-memory read of the pane's screen buffer and unchanged+// screens are never redrawn, so a near-live rate costs next to nothing.+const POLL_MIN_MS = 450;+const POLL_JITTER_MS = 250;/** Never more panes per request than this; the feed accepts up to 8. */export const MAX_SCREEN_TARGETS = 6;diff --git a/jarvis/ui/web/frontend/src/store/ideChat.ts b/jarvis/ui/web/frontend/src/store/ideChat.tsindex ff0fd194aa..c096810adf 100644--- a/jarvis/ui/web/frontend/src/store/ideChat.ts+++ b/jarvis/ui/web/frontend/src/store/ideChat.ts@@ -42,6 +42,11 @@ export interface PaneRequest {workspaceId: string;pane: string;nonce: number;+ /**+ * Also fill the grid with that pane (the office's "show me that terminal").+ * The grid clears it once it has obeyed, so a later remount never maximizes again.+ */+ maximize?: boolean;}/**@@ -120,7 +125,9 @@ interface IdeChatStore {setView: (next: WorkspaceView) => void;setWorkspace: (next: IdeWorkspace | null) => void;/** Bring a pane to the front, switching workspace first when it lives elsewhere. */- requestPane: (workspaceId: string, pane: string) => void;+ requestPane: (workspaceId: string, pane: string, options?: { maximize?: boolean }) => void;+ /** The grid maximized request `nonce`; drop its maximize flag. */+ settlePaneMaximize: (nonce: number) => void;setStagedPane: (pane: string | null) => void;setWorkspaces: (rows: IdeWorkspaceRow[]) => void;setAgents: (agents: SplitAgentChoice[]) => void;@@ -154,10 +161,21 @@ export const useIdeChatStore = create<IdeChatStore>((set) => ({},setWorkspace: (next) => set({ workspace: next }),- requestPane: (workspaceId, pane) =>+ requestPane: (workspaceId, pane, options) =>set((state) => ({- paneRequest: { workspaceId, pane, nonce: (state.paneRequest?.nonce ?? 0) + 1 },+ paneRequest: {+ workspaceId,+ pane,+ nonce: (state.paneRequest?.nonce ?? 0) + 1,+ ...(options?.maximize ? { maximize: true } : {}),+ },})),+ settlePaneMaximize: (nonce) =>+ set((state) =>+ state.paneRequest?.nonce === nonce && state.paneRequest.maximize+ ? { paneRequest: { ...state.paneRequest, maximize: false } }+ : state,+ ),setStagedPane: (pane) =>// Guarded: the grid publishes this from an effect that runs on every poll,// and an unconditional set would wake every subscriber each time.