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(agentic-ide): let Grok Build panes show the glass wallpaper
rubenluetke10-beep5a54940f376f
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsxindex 6f21b7eec4..efba07e49f 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx@@ -2082,6 +2082,49 @@ describe("terminal text size across a rebuild", () => {);});+ it("lets a TUI canvas fill fall through to the glass instead of covering it", () => {+ render(+ <AgenticTerminal+ name="Dana"+ displayName="Claude Code"+ appearance="dark"+ fontSize={13}+ />,+ );+ terminalHarness.write.mockClear();++ act(() => {+ terminalHarness.handlers.current?.onOutput?.(+ "\x1b[48;2;20;20;20m \x1b[0m" as never,+ );+ });++ // GrokNight paints #141414 on every empty cell. That RGB is the canvas+ // fill; xterm must see the default background so the wallpaper shows.+ // The rewrite is not keyed on the pane's product name.+ expect(terminalHarness.write).toHaveBeenCalledWith("\x1b[49m \x1b[0m");+ });++ it("clears GrokDay's light canvas the same way", () => {+ render(+ <AgenticTerminal+ name="Dana"+ displayName="Claude Code"+ appearance="light"+ fontSize={13}+ />,+ );+ terminalHarness.write.mockClear();++ act(() => {+ terminalHarness.handlers.current?.onOutput?.(+ "\x1b[48;2;238;238;238m \x1b[0m" as never,+ );+ });++ expect(terminalHarness.write).toHaveBeenCalledWith("\x1b[49m \x1b[0m");+ });+it("builds a replacement terminal at the size the user is looking at", () => {const view = render(<AgenticTerminal name="Dana" displayName="Claude Code" appearance="dark" fontSize={13} />,diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsxindex 0043f6ff13..34ac447d48 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx@@ -76,6 +76,7 @@ import {themeFor,type TerminalAppearance,} from "./terminalThemes";+import { clearTuiCanvasFill } from "./terminalGlass";import {extractPaneDrop,extractPasteFiles,@@ -979,7 +980,10 @@ export function AgenticTerminal({/** Hand bytes to xterm, keeping the count of what is still being parsed. */const writeToTerminal = (text: string, afterWrite?: () => void) => {parsing += 1;- term.write(text, () => {+ // A TUI that paints its theme ground on every cell would hide the+ // glass this pane sits on. Default-background those fills here, on+ // the way into xterm — see ./terminalGlass.+ term.write(clearTuiCanvasFill(text), () => {parsing = Math.max(0, parsing - 1);afterWrite?.();// The parser is between chunks — the one safe moment to reflow.diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalGlass.test.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalGlass.test.tsnew file mode 100644index 0000000000..5dfbcdfea6--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalGlass.test.ts@@ -0,0 +1,83 @@+import { describe, expect, it } from "vitest";+import { clearTuiCanvasFill, rewriteCanvasFillSgr } from "./terminalGlass";++describe("clearTuiCanvasFill", () => {+ it("turns GrokNight's canvas fill into the terminal default background", () => {+ expect(clearTuiCanvasFill("\x1b[48;2;20;20;20m \x1b[0m")).toBe(+ "\x1b[49m \x1b[0m",+ );+ });++ it("keeps a combined SGR's other attributes when the fill is the canvas", () => {+ expect(+ clearTuiCanvasFill("\x1b[0;48;2;20;20;20;38;2;225;225;225mhi"),+ ).toBe("\x1b[0;49;38;2;225;225;225mhi");+ });++ it("does not rewrite a foreground that happens to be the canvas RGB", () => {+ const text = "\x1b[38;2;20;20;20mdim\x1b[0m";+ expect(clearTuiCanvasFill(text)).toBe(text);+ });++ it("leaves a highlight / prompt-box background painted", () => {+ // GrokNight bg_light is #242424 — chrome, not the canvas.+ const text = "\x1b[48;2;36;36;36mselected\x1b[0m";+ expect(clearTuiCanvasFill(text)).toBe(text);+ });++ it("clears every bundled Grok theme's bg_base, and the pane's own ground", () => {+ const fills: [number, number, number][] = [+ [20, 20, 20],+ [238, 238, 238],+ [36, 40, 59],+ [35, 33, 54],+ [3, 3, 4],+ [18, 20, 26],+ [252, 251, 248],+ ];+ for (const [r, g, b] of fills) {+ expect(clearTuiCanvasFill(`\x1b[48;2;${r};${g};${b}m`)).toBe("\x1b[49m");+ }+ });++ it("understands the colon-form RGB background", () => {+ expect(clearTuiCanvasFill("\x1b[48:2::20:20:20m")).toBe("\x1b[49m");+ expect(clearTuiCanvasFill("\x1b[48:2:0:20:20:20m")).toBe("\x1b[49m");+ expect(clearTuiCanvasFill("\x1b[48:2:20:20:20m")).toBe("\x1b[49m");+ });++ it("leaves a chunk with no SGR background alone, including empty text", () => {+ expect(clearTuiCanvasFill("hello")).toBe("hello");+ expect(clearTuiCanvasFill("")).toBe("");+ expect(clearTuiCanvasFill("\x1b[31mred\x1b[0m")).toBe("\x1b[31mred\x1b[0m");+ });++ it("does not invent a match from a split CSI", () => {+ // The closing `m` is in the next read. Rewriting here would corrupt both.+ expect(clearTuiCanvasFill("\x1b[48;2;20;20;20")).toBe("\x1b[48;2;20;20;20");+ });++ it("rewrites a canvas fill that follows a truecolor foreground", () => {+ expect(+ clearTuiCanvasFill("\x1b[38;2;225;225;225;48;2;20;20;20m"),+ ).toBe("\x1b[38;2;225;225;225;49m");+ });++ it("does not treat a colour-channel 48 as a background setter", () => {+ // Indexed fg 48, then a stray 2 — not `48;2;r;g;b`.+ const text = "\x1b[38;5;48;2m";+ expect(clearTuiCanvasFill(text)).toBe(text);+ });++ it("leaves a colon-form highlight background painted", () => {+ const text = "\x1b[48:2:36:36:36m";+ expect(clearTuiCanvasFill(text)).toBe(text);+ });+});++describe("rewriteCanvasFillSgr", () => {+ it("is a no-op when 48 is not a background setter", () => {+ expect(rewriteCanvasFillSgr("1;4")).toBe("1;4");+ expect(rewriteCanvasFillSgr("38;2;20;20;20")).toBe("38;2;20;20;20");+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalGlass.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalGlass.tsnew file mode 100644index 0000000000..bacbee5591--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalGlass.ts@@ -0,0 +1,167 @@+/**+ * Let a full-screen TUI keep the pane's glass instead of painting over it.+ *+ * xterm is already clear (`allowTransparency` + a transparent theme+ * background in ./terminalThemes). Claude Code and a plain shell leave the+ * default background alone, so the wallpaper shows through the pane shell.+ * A ratatui TUI such as Grok Build paints every cell with its theme's+ * `bg_base` — a solid RGB, not the default — and that one colour is what+ * turns the pane into an opaque card.+ *+ * Those canvas fills are a known, small set: each bundled Grok theme's+ * `bg_base`, plus the RGB this pane reports over OSC 11 so a CLI that+ * paints "whatever the terminal said it was" still goes clear. Highlight,+ * diff, hover and prompt-box backgrounds are different RGBs and stay put.+ *+ * The rewrite is visual only. It runs on the bytes handed to xterm, not+ * on the PTY stream the recap or activity detectors read.+ */++import { themeFor, type TerminalAppearance } from "./terminalThemes";++/** Pack `r,g,b` into one integer for the membership set. */+function pack(r: number, g: number, b: number): number {+ return (r << 16) | (g << 8) | b;+}++function packedFromCssRgb(css: string | undefined): number | null {+ if (!css) return null;+ const match = css.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);+ if (!match) return null;+ return pack(Number(match[1]), Number(match[2]), Number(match[3]));+}++/**+ * Full-pane canvas fills. Sources:+ *+ * * Grok Build `bg_base` slots from xai-grok-pager-render themes+ * (GrokNight, GrokDay, TokyoNight Storm, Rose Pine Moon, Oscura Midnight).+ * * The RGB half of this pane's own transparent theme background — the+ * number OSC 11 answers with (`jarvis/agentic_ide/terminal_input.py`).+ */+const CANVAS_FILLS = new Set<number>([+ pack(20, 20, 20), // GrokNight+ pack(238, 238, 238), // GrokDay+ pack(36, 40, 59), // TokyoNight Storm+ pack(35, 33, 54), // Rose Pine Moon+ pack(3, 3, 4), // Oscura Midnight+]);++for (const appearance of ["dark", "light"] as TerminalAppearance[]) {+ const packed = packedFromCssRgb(themeFor(appearance).background);+ if (packed !== null) CANVAS_FILLS.add(packed);+}++const SGR = /\x1b\[([0-9;:]*)m/g;++function isCanvas(r: number, g: number, b: number): boolean {+ return (+ Number.isInteger(r) &&+ Number.isInteger(g) &&+ Number.isInteger(b) &&+ r >= 0 &&+ r <= 255 &&+ g >= 0 &&+ g <= 255 &&+ b >= 0 &&+ b <= 255 &&+ CANVAS_FILLS.has(pack(r, g, b))+ );+}++/**+ * True when `token` is a colon-form `48:2:…` RGB background whose colour+ * is a canvas fill. Returns the replacement `"49"` or null.+ */+function rewriteColonBackground(token: string): string | null {+ if (!token.startsWith("48:2:")) return null;+ const parts = token.slice(5).split(":");+ // `48:2:r:g:b` or `48:2:<space>:r:g:b` (empty / 0 colorspace).+ let r: string;+ let g: string;+ let b: string;+ if (parts.length === 3) {+ [r, g, b] = parts;+ } else if (parts.length === 4) {+ [, r, g, b] = parts;+ } else {+ return null;+ }+ return isCanvas(Number(r), Number(g), Number(b)) ? "49" : null;+}++/**+ * How many tokens after `38`/`48`/`58` belong to that colour. Zero means+ * the sequence is incomplete or not a colour we understand — leave it.+ */+function colourPayloadLength(tokens: string[], index: number): number {+ const kind = tokens[index + 1];+ if (kind === "2" && index + 4 < tokens.length) return 4;+ if (kind === "5" && index + 2 < tokens.length) return 2;+ return 0;+}++/**+ * Walk one SGR parameter list. `48;2;r;g;b` (and the colon form) that+ * names a canvas fill becomes `49` — default background. Foreground+ * `38;2;…` and underline `58;2;…` are consumed as colour payloads so a+ * channel value of `48` cannot be mistaken for a background setter.+ */+export function rewriteCanvasFillSgr(params: string): string {+ if (!params.includes("48")) return params;+ const tokens = params.split(";");+ const out: string[] = [];+ for (let i = 0; i < tokens.length; i += 1) {+ const token = tokens[i];+ const colon = rewriteColonBackground(token);+ if (colon !== null) {+ out.push(colon);+ continue;+ }+ if (token === "48") {+ const extra = colourPayloadLength(tokens, i);+ if (extra === 4) {+ const red = Number(tokens[i + 2]);+ const green = Number(tokens[i + 3]);+ const blue = Number(tokens[i + 4]);+ if (isCanvas(red, green, blue)) {+ out.push("49");+ i += extra;+ continue;+ }+ }+ out.push(token);+ if (extra > 0) {+ out.push(...tokens.slice(i + 1, i + 1 + extra));+ i += extra;+ }+ continue;+ }+ if (token === "38" || token === "58") {+ const extra = colourPayloadLength(tokens, i);+ out.push(token);+ if (extra > 0) {+ out.push(...tokens.slice(i + 1, i + 1 + extra));+ i += extra;+ }+ continue;+ }+ out.push(token);+ }+ return out.join(";");+}++/**+ * Replace canvas-fill cell backgrounds with the terminal default, so the+ * pane shell (and the wallpaper under it) shows through.+ *+ * Complete SGR sequences only — a CSI split across two PTY reads is left+ * for xterm, the same as every other escape this pane does not rewrite.+ */+export function clearTuiCanvasFill(text: string): string {+ if (!text.includes("\x1b[") || !text.includes("48")) return text;+ return text.replace(SGR, (full, params: string) => {+ const next = rewriteCanvasFillSgr(params);+ return next === params ? full : `\x1b[${next}m`;+ });+}diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalThemes.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalThemes.tsindex ab085ad38c..8704f6d56b 100644--- a/jarvis/ui/web/frontend/src/components/agentic/terminalThemes.ts+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalThemes.ts@@ -14,6 +14,10 @@ import type { ITheme } from "@xterm/xterm";* The xterm canvas itself stays transparent. The stable reading ground comes* from the translucent pane shell below it, so the desktop artwork remains* visible without stacking two dark fills into an effectively opaque panel.+ * A TUI that still paints its own `bg_base` on every cell (Grok Build's+ * fullscreen themes do) is cleared on the way into xterm — see+ * ./terminalGlass — so that fill becomes the same default background Claude+ * Code already leaves alone.** ## Why a palette alone cannot make every pane readable*