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
perf(office): fetch the terminal font when the office loads, so the first pane panel opens without waiting for it
rubenluetke10-beepafcdf9f1b46a
diff --git a/jarvis/ui/web/frontend/src/components/society/office/PaneCommandPanel.tsx b/jarvis/ui/web/frontend/src/components/society/office/PaneCommandPanel.tsxindex e8933200ea..a5140e467a 100644--- a/jarvis/ui/web/frontend/src/components/society/office/PaneCommandPanel.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/PaneCommandPanel.tsx@@ -31,6 +31,7 @@ import { useWorkspacePanesStore } from "@/store/workspacePanes";import { AgentMark } from "@/components/agentic/AgentMark";import { AgenticTerminal } from "@/components/agentic/AgenticTerminal";import { FONT_DEFAULT } from "@/components/agentic/paneFont";+import { warmTerminalFont } from "@/lib/terminalFont";import { BranchIcon } from "@/components/agentic/branchIcon";import { PANE_BRAND, PANE_CHROME, PANE_SOLID, storedTerminalAppearance, themeFor } from "@/components/agentic/terminalThemes";import type { PaneOccupant } from "./codingFloor";@@ -43,6 +44,11 @@ import {} from "./paneWindow";import "./paneCommand.css";+// This module loads with the office, well before a session is clicked: fetch+// the terminal's font now, so the first panel opens on a font that is already+// here instead of waiting for it (measured: ~0.4 s of the first open).+warmTerminalFont(FONT_DEFAULT);+/** A second press within this window confirms closing the session. */const CONFIRM_MS = 4000;/** How long a success line stays on the window; an error stays until the next action. */diff --git a/jarvis/ui/web/frontend/src/lib/terminalFont.test.ts b/jarvis/ui/web/frontend/src/lib/terminalFont.test.tsindex f421eccf46..3c8480c840 100644--- a/jarvis/ui/web/frontend/src/lib/terminalFont.test.ts+++ b/jarvis/ui/web/frontend/src/lib/terminalFont.test.ts@@ -18,6 +18,7 @@ import {alignTerminalCells,syncTerminalFont,terminalFontSettled,+ warmTerminalFont,whenTerminalFontReady,} from "./terminalFont";@@ -488,3 +489,22 @@ describe("whenTerminalFontReady", () => {expect(resolved).toBe(true);});});++describe("warmTerminalFont", () => {+ it("asks for every weight a pane draws with, ahead of any pane", () => {+ const load = vi.fn(() => Promise.resolve([]));+ const original = Object.getOwnPropertyDescriptor(document, "fonts");+ Object.defineProperty(document, "fonts", { configurable: true, value: { load } });+ try {+ warmTerminalFont(15);+ const specs = load.mock.calls.map((call) => String((call as unknown[])[0]));+ expect(specs).toEqual([+ expect.stringMatching(/^500 15px "JetBrains Mono"$/),+ expect.stringMatching(/^700 15px "JetBrains Mono"$/),+ ]);+ } finally {+ if (original) Object.defineProperty(document, "fonts", original);+ else delete (document as unknown as { fonts?: unknown }).fonts;+ }+ });+});diff --git a/jarvis/ui/web/frontend/src/lib/terminalFont.ts b/jarvis/ui/web/frontend/src/lib/terminalFont.tsindex f5b1cb5bde..f896f1038a 100644--- a/jarvis/ui/web/frontend/src/lib/terminalFont.ts+++ b/jarvis/ui/web/frontend/src/lib/terminalFont.ts@@ -307,6 +307,27 @@ export function whenTerminalFontReady(});}+/**+ * Start fetching the terminal's display faces before any pane exists.+ *+ * A face nothing has drawn with yet is only loaded once asked for, so the+ * first pane a screen opens pays for the fetch inside `whenTerminalFontReady`+ * — a few hundred milliseconds on a busy page, and all of it between the click+ * and the agent's screen. A surface that is about to offer panes (the office's+ * coding floor) calls this ahead of time. Fire-and-forget, never throws.+ */+export function warmTerminalFont(fontSize: number): void {+ const fonts = browserFonts();+ if (!fonts) return;+ for (const weight of WEIGHTS) {+ try {+ void fonts.load(`${weight} ${fontSize}px ${DISPLAY_FAMILY}`).catch(() => undefined);+ } catch {+ /* a family the engine refuses to parse — the pane's own bounded wait covers it */+ }+ }+}+function browserFonts(): FontFaceSet | null {if (typeof document === "undefined") return null;return document.fonts ?? null;