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
fix(office): keep live desk screens behind the walls in front of them
rubenluetke10-beep76f4d6efb28e
diff --git a/jarvis/ui/web/frontend/src/components/society/office/MissionScreens.tsx b/jarvis/ui/web/frontend/src/components/society/office/MissionScreens.tsxindex 68973e89f7..12731ef128 100644--- a/jarvis/ui/web/frontend/src/components/society/office/MissionScreens.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/MissionScreens.tsx@@ -34,6 +34,7 @@ import { paneLabel, paneOccupants, type PaneOccupant } from "./codingFloor";import { PaneScreenView } from "./PaneLiveScreen";import { screenChanged } from "./terminalScreen";import type { MonitorSection } from "./officeStore";+import { useBlendingCanvasLayer } from "./blendingLayer";import "./paneCommand.css";import "./missionScreens.css";@@ -54,6 +55,8 @@ export function preloadMissionScreens(): void {/** The sections are laid out at this window size, then scaled onto the monitor. */export const MISSION_SCREEN_PX = { w: 1240, h: 723 } as const;+const SCREEN_Z_RANGE: [number, number] = [10, 0];+/** One terminal poll for every tile at once, jittered (AP-33). */const POLL_MIN_MS = 900;const POLL_JITTER_MS = 300;@@ -247,8 +250,10 @@ export function MissionLiveScreen({ section, widthM, position }: {const client = useQueryClient();// drei maps one CSS pixel to distanceFactor / 400 metres in transform mode.const distanceFactor = (widthM * 400) / MISSION_SCREEN_PX.w;+ // Another <Html> mounting later would drop the canvas under this screen (see blendingLayer).+ useBlendingCanvasLayer(SCREEN_Z_RANGE);return (- <Html transform occlude="blending" position={position} distanceFactor={distanceFactor} zIndexRange={[10, 0]}+ <Html transform occlude="blending" position={position} distanceFactor={distanceFactor} zIndexRange={SCREEN_Z_RANGE}style={{ width: MISSION_SCREEN_PX.w, height: MISSION_SCREEN_PX.h, pointerEvents: "none" }}><div className="office-mission-screen" data-office-ui><QueryClientProvider client={client}>diff --git a/jarvis/ui/web/frontend/src/components/society/office/RealChatScreen.tsx b/jarvis/ui/web/frontend/src/components/society/office/RealChatScreen.tsxindex 65b6205f52..8b35697624 100644--- a/jarvis/ui/web/frontend/src/components/society/office/RealChatScreen.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/RealChatScreen.tsx@@ -10,6 +10,7 @@ import { Html } from "@react-three/drei";import { QueryClientProvider, useQueryClient } from "@tanstack/react-query";import { createAgentChatStore } from "@/store/agentChat";import type { SocietyAgent } from "../data";+import { useBlendingCanvasLayer } from "./blendingLayer";const AgentChatPanel = lazy(() => import("../chat/AgentChatPanel").then((m) => ({ default: m.AgentChatPanel })));@@ -17,6 +18,7 @@ const AgentChatPanel = lazy(() => import("../chat/AgentChatPanel").then((m) => (export const REAL_CHAT_PX = { w: 880, h: 507 } as const;const SCREEN_W_M = 0.66;/** drei maps one CSS pixel to distanceFactor / 400 metres in transform mode. */+const SCREEN_Z_RANGE: [number, number] = [10, 0];const DISTANCE_FACTOR = (SCREEN_W_M * 400) / REAL_CHAT_PX.w;export function RealChatScreen({ agent, roster, position }: {@@ -28,8 +30,10 @@ export function RealChatScreen({ agent, roster, position }: {const store = useMemo(() => createAgentChatStore("society", `office-monitor:${agent.agentId}`), [agent.agentId]);// Leaving the monitor closes its socket; the chat itself keeps running on the server.useEffect(() => () => store.getState().disconnect(), [store]);+ // Another <Html> mounting later would drop the canvas under this screen (see blendingLayer).+ useBlendingCanvasLayer(SCREEN_Z_RANGE);return (- <Html transform occlude="blending" position={position} distanceFactor={DISTANCE_FACTOR} zIndexRange={[10, 0]}+ <Html transform occlude="blending" position={position} distanceFactor={DISTANCE_FACTOR} zIndexRange={SCREEN_Z_RANGE}style={{ width: REAL_CHAT_PX.w, height: REAL_CHAT_PX.h, pointerEvents: "none" }}><div className="office-real-chat" data-office-ui><QueryClientProvider client={client}>diff --git a/jarvis/ui/web/frontend/src/components/society/office/blendingLayer.test.ts b/jarvis/ui/web/frontend/src/components/society/office/blendingLayer.test.tsnew file mode 100644index 0000000000..137c5890e8--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/blendingLayer.test.ts@@ -0,0 +1,9 @@+import { describe, expect, it } from "vitest";+import { blendingCanvasZ } from "./blendingLayer";++describe("blendingCanvasZ", () => {+ it("matches the canvas z-index drei gives a blending <Html>", () => {+ expect(blendingCanvasZ([10, 0])).toBe("5");+ expect(blendingCanvasZ([7, 0])).toBe("3");+ });+});diff --git a/jarvis/ui/web/frontend/src/components/society/office/blendingLayer.ts b/jarvis/ui/web/frontend/src/components/society/office/blendingLayer.tsnew file mode 100644index 0000000000..e9708528a9--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/blendingLayer.ts@@ -0,0 +1,29 @@+/**+ * drei's <Html occlude="blending"> draws its page BEHIND the canvas: it lifts+ * the canvas above the HTML layer (z-index, absolute) and punches a clear hole+ * where the screen is, so anything in front of the screen still covers it.+ *+ * Every other <Html> (a name label, a hint) resets those canvas styles when it+ * mounts. A label that appears after a live screen therefore drops the canvas+ * back under the screen, and the screen shows through every wall in front of+ * it. While a blending screen is mounted, re-assert the lift each frame.+ */+import { useFrame, useThree } from "@react-three/fiber";++/** The canvas z-index drei gives a blending <Html> with this `zIndexRange`. Pure. */+export function blendingCanvasZ(zIndexRange: readonly [number, number]): string {+ return String(Math.floor(zIndexRange[0] / 2));+}++/** Keep the canvas above the blending screens' HTML layer while the caller is mounted. */+export function useBlendingCanvasLayer(zIndexRange: readonly [number, number]): void {+ const gl = useThree((s) => s.gl);+ const z = blendingCanvasZ(zIndexRange);+ useFrame(() => {+ const style = gl.domElement.style;+ if (style.zIndex === z) return;+ style.zIndex = z;+ style.position = "absolute";+ style.pointerEvents = "none";+ });+}