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
import type { ITheme } from "@xterm/xterm";
/**
* Terminal colour schemes for the Agentic IDE.
*
* ## Why this file holds literal colours when nothing else may
*
* The design system forbids a literal colour anywhere in the product; every
* surface names a token. This module is its one sanctioned exception, for two
* reasons that cannot be designed away. xterm's `ITheme` takes resolved colour
* strings — it cannot read `hsl(var(--card))`, and the minimum-contrast maths
* below needs real numbers to compute a ratio from. And a pane's appearance is
* a SEPARATE setting from the app theme: a light pane inside a dark app is a
* supported combination, so a pane that read app tokens would paint its chrome
* for the wrong ground exactly when the two disagree.
*
* So the rule holds in a different shape: the 16 ANSI slots are the terminal's
* own palette (one of the few places hue legitimately survives), and everything
* else in this file — `PANE_CHROME`, `PANE_BRAND` — is the app's surface and
* ink ladder re-derived for each appearance. No value here is invented; each
* one names the step it stands for in its comment.
*
* Why a hand-built light palette instead of "same colours, white background":
* the 16 ANSI colours a coding agent emits were designed for dark terminals.
* Their bright variants (yellow, cyan, white) have almost no contrast on paper,
* and `brightBlack` — which agents use for hints, diffs, and dimmed prose —
* becomes invisible. So the light theme re-derives all 16 slots for a light
* ground: darker, more saturated hues, with the "bright" row kept genuinely
* distinguishable rather than lighter.
*
* On a dark pane the xterm canvas 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 light pane is opaque instead: glyphs rasterised onto a
* transparent canvas lose subpixel smoothing, and dark ink on paper drawn
* that way reads thin and grey.
* 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
*
* The 16 slots below only catch CLIs that speak classic ANSI. A modern coding
* agent draws most of its UI in 24-bit truecolor — exact RGB values chosen for
* the theme IT is configured for — and those bytes bypass this palette
* entirely. A CLI set to its dark theme paints near-white text into a light
* pane, and no slot remap can intercept that. `MINIMUM_CONTRAST_RATIO` is the
* floor under that hole: xterm nudges ANY foreground (truecolor included)
* toward black or white until it reaches the ratio against the background.
* For that computation to run against the pane's REAL ground, each theme's
* transparent `background` carries the shell's RGB at alpha 0 — invisible on
* screen, but the number the contrast maths reads.
*/
/**
* WCAG AA for body text, and the same default VS Code ships for its
* integrated terminal. High enough that dark-theme truecolor becomes readable
* on a light pane, low enough that a CLI's deliberate dim/bright hierarchy
* survives.
*/
export const MINIMUM_CONTRAST_RATIO = 4.5;
/** Warm-paper contrast palette for light mode. */
export const LIGHT_TERMINAL_THEME: ITheme = {
// Opaque, unlike the dark theme: a light pane draws with
// `allowTransparency` off so its glyphs get subpixel smoothing (see
// ./AgenticTerminal), and the paper here is the ground the reader sees.
background: "#fcfbf8",
foreground: "#18181c",
cursor: "#0a0a0a",
cursorAccent: "#fcfbf8",
selectionBackground: "#dedcd4",
selectionForeground: "#18181c",
// Cursor Light's terminal slots: the same semantic tones the app's light
// tokens use (life #007041, fault #BE1744, degraded #A46700, link #0064B0).
black: "#3a3a3a",
red: "#be1744",
green: "#007041",
yellow: "#8b5700",
blue: "#0064b0",
magenta: "#92156a",
cyan: "#176c74",
white: "#6b6b6b",
brightBlack: "#777777",
brightRed: "#ce405b",
brightGreen: "#00854c",
brightYellow: "#a46700",
brightBlue: "#2778c1",
brightMagenta: "#b0348a",
brightCyan: "#1f8a94",
brightWhite: "#1f1f1f",
};
/**
* Deep-slate contrast palette for dark mode.
*
* This is what most people see: the panes follow the app's theme, and the app
* defaults to dark (`hooks/useTheme`). The canvas stays clear; the translucent
* pane shell below it supplies the dark reading ground.
*/
export const DARK_TERMINAL_THEME: ITheme = {
// #12141a at alpha 0 — the deep-slate ground the backend also reports to the
// CLI (dodaios/agentic_ide/terminal_input.py), and the ground the
// minimum-contrast maths measures against.
background: "rgba(18, 20, 26, 0)",
foreground: "#f4f4f6",
cursor: "#ffffff",
cursorAccent: "#12141a",
selectionBackground: "#3a4252",
selectionForeground: "#ffffff",
// Cursor Dark Anysphere's terminal slots — the desaturated set the app's
// dark tokens are built from (life #3FA266, fault #E34671, signal #81A1C1,
// info #88C0D0). Brights are one step lighter, never neon.
black: "#2b2b2b",
red: "#fc6b83",
green: "#3fa266",
yellow: "#d2943e",
blue: "#81a1c1",
magenta: "#b48ead",
cyan: "#88c0d0",
white: "#dcdcdc",
brightBlack: "#8a8a8a",
brightRed: "#ff8fa3",
brightGreen: "#70b489",
brightYellow: "#f1b467",
brightBlue: "#a5bdd6",
brightMagenta: "#d4b3cc",
brightCyan: "#a8d6e1",
brightWhite: "#ffffff",
};
export type TerminalAppearance = "light" | "dark";
export function themeFor(appearance: TerminalAppearance): ITheme {
return appearance === "dark" ? DARK_TERMINAL_THEME : LIGHT_TERMINAL_THEME;
}
/** Where the reader's pane appearance is kept; no entry means "follow the app". */
export const TERMINAL_APPEARANCE_KEY = "jarvis.agenticIde.terminalAppearance";
/** The stored pane appearance, or null when there is none (or storage is blocked). */
export function storedTerminalAppearance(): TerminalAppearance | null {
try {
const raw = window.localStorage.getItem(TERMINAL_APPEARANCE_KEY);
return raw === "light" || raw === "dark" ? raw : null;
} catch {
// Private mode or disabled storage reads as "no preference", never as a failure.
return null;
}
}
/**
* How a workspace draws its panes.
*
* * `minimal` — the tiling-multiplexer look (herdr, tmux): square 1px frames,
* a slim square title row carrying the pane's controls, and the pane the
* reader works in outlined in the signal hue.
* * `classic` — rounded cards, each with a taller title bar.
*
* A reader's preference, kept in this window's storage like the appearance;
* `classic` stays one click away in Workspace options for anyone who wants
* the titles back.
*/
export type PaneStyle = "minimal" | "classic";
/** Where the reader's pane style is kept; no entry means the default. */
export const PANE_STYLE_KEY = "jarvis.agenticIde.paneStyle";
export const DEFAULT_PANE_STYLE: PaneStyle = "minimal";
/** The stored pane style, or the default when there is none (or storage is blocked). */
export function storedPaneStyle(): PaneStyle {
try {
const raw = window.localStorage.getItem(PANE_STYLE_KEY);
return raw === "minimal" || raw === "classic" ? raw : DEFAULT_PANE_STYLE;
} catch {
// Private mode or disabled storage reads as "no preference", never as a failure.
return DEFAULT_PANE_STYLE;
}
}
/** Remember the reader's pane style; losing it only costs a click next time. */
export function storePaneStyle(style: PaneStyle): void {
try {
window.localStorage.setItem(PANE_STYLE_KEY, style);
} catch {
// Blocked storage keeps the choice for this session only, which is fine.
}
}
/**
* The lifecycle a pane's frame reports, mirroring `PaneStatus` in
* ./AgenticTerminal.
*
* Declared here rather than imported so the colour module stays a leaf — the
* terminal already imports this file, and a second edge would be a cycle. The
* two unions are checked against each other structurally at every use site:
* indexing `edge` with a `PaneStatus` stops compiling the moment one of them
* grows a member the other does not have, which is the point.
*/
export type PaneEdgeState = "connecting" | "live" | "exited" | "error";
export interface PaneChrome {
/** The translucent ground the pane — header AND terminal — is drawn on. */
shell: string;
/** The pane's resting edge, and the rule under its header. */
border: string;
/**
* The pane's float step: a tooltip or menu that leaves the plane.
*
* Opaque, unlike `shell`. A card that can land on top of another pane's
* output must not be read THROUGH, and it is small enough that lift costs
* the room nothing (see the "lift scales inversely with area" rule).
*/
float: string;
/** The edge that says what this pane's agent is doing. */
edge: Record<PaneEdgeState, string>;
}
/**
* Chrome (pane frame) colours that go with each terminal theme.
*
* Every value below is one of the app's own surface-ladder steps, expressed as
* an alpha over the pane's ground, so on the app's flat ground they resolve to
* the tokens by name: `border` lands on `--border`, `edge.exited` a step below it,
* `PaneBrand.chip` on `--secondary`, `PaneBrand.accentSoft` on
* `--border-strong`. The table exists because a pane's appearance is a
* SEPARATE setting from the app theme — a light pane inside a dark app is a
* supported combination — so the pane resolves the ladder against its own
* ground rather than reading `hsl(var(--…))`, which would be the app's.
*
* ## Why the edge is a state and not a decoration
*
* A wall of twelve panes has one thing every reader is looking for: which of
* them still needs them. The activity pill answers that per pane, but a pill is
* something you READ — you have to land on the pane first. The edge is what the
* eye can sweep, so it carries exactly one distinction and carries it quietly:
*
* * `connecting` / `live` — the resting edge. The overwhelming majority of
* panes are here, and a workspace where everything is marked marks nothing.
* * `exited` — dimmer than resting. The agent is gone; the pane recedes rather
* than shouting, because a finished terminal is not a problem.
* * `error` — the fault hue, at an alpha that reads across a room without
* turning the pane into an alert box.
*
* The red used to be the matching terminal theme's own `red` slot. It is now
* the app's fault hue re-derived per appearance — the same `#E8574C` the dark
* theme paints `--destructive` with, and the darker `#C72E23` light mode uses —
* because "this pane failed" is one status across the whole product and must
* not change hue with a per-pane preference. Re-deriving it here rather than
* reading the token keeps the ground correct when the two settings disagree.
*/
/**
* Ink and accent for a pane's title bar, resolved against the PANE's own ground.
*
* Not read from `hsl(var(--…))`, for the same reason `NOTICE_TONE` exists in
* ./AgenticTerminal: terminal appearance is a separate setting from the app
* theme, and an app token lands on the wrong ground exactly when the two
* disagree.
*
* The values are the app's ink scale, not a second palette: `ink` is the body
* step, `inkMuted` the meta step, `inkFaint` the placeholder step, and `accent`
* is the fill — white on a dark pane, warm near-black on a light one. It used
* to be a signal-yellow "brand" accent in two voices; the brand hue was retired
* (Ink & Paper), and a title bar is chrome rather than a place to spend colour.
* Hue now survives on a pane only where it means something: the terminal's own
* 16 ANSI slots, the activity pill, and a failed edge.
*/
export interface PaneBrand {
/** The fill — the focused pane's call-sign plate, and the header hairline. */
accent: string;
/** Ink ON the filled plate. The pane's ground, so the plate reads as a hole. */
onAccent: string;
/** The pane's `--border-strong`: field rims and the hairline's fade. */
accentSoft: string;
/** Primary ink — the resting call-sign, the headline under the pointer. */
ink: string;
/** Secondary ink — the recap headline at rest, and the seat chip. */
inkMuted: string;
/** Placeholder and disabled ink only. Never information. */
inkFaint: string;
/** The pane's `--secondary`: the resting call-sign chip, and hover grounds. */
chip: string;
}
export const PANE_BRAND: Record<TerminalAppearance, PaneBrand> = {
light: {
accent: "#26251e",
onAccent: "#f7f7f4",
accentSoft: "rgba(38,37,30,0.32)",
ink: "#26251e",
inkMuted: "#4a4840",
inkFaint: "#6e6a60",
chip: "rgba(38,37,30,0.09)",
},
dark: {
accent: "#ffffff",
onAccent: "#121212",
accentSoft: "rgba(255,255,255,0.23)",
ink: "#f0f0f0",
inkMuted: "#a3a3a3",
inkFaint: "#7a7a7a",
chip: "rgba(255,255,255,0.14)",
},
};
/**
* The pane's ground made near-opaque, for a pane floated over a busy scene
* (the office map) where the translucent `shell` would let the world through.
*/
export const PANE_SOLID: Record<TerminalAppearance, string> = {
light: "rgba(252, 251, 248, 0.94)",
dark: "rgba(18, 18, 18, 0.92)",
};
export const PANE_CHROME: Record<TerminalAppearance, PaneChrome> = {
light: {
// Opaque to match the light terminal canvas, which must be opaque for
// crisp glyphs; a translucent shell would leave a seam round the text.
shell: "rgb(252, 251, 248)",
border: "rgba(38,37,30,0.2)",
float: "#ffffff",
edge: {
connecting: "rgba(38,37,30,0.2)",
live: "rgba(38,37,30,0.2)",
exited: "rgba(38,37,30,0.1)",
error: "rgba(190,23,68,0.45)",
},
},
dark: {
shell: "rgba(18, 18, 18, 0.58)",
border: "rgba(255,255,255,0.12)",
float: "#303030",
edge: {
connecting: "rgba(255,255,255,0.12)",
live: "rgba(255,255,255,0.12)",
exited: "rgba(255,255,255,0.06)",
error: "rgba(227,70,113,0.55)",
},
},
};
/** The frame of a pane drawn in the `minimal` style. */
export interface PaneTileChrome {
/** The resting edge per lifecycle, as in `PaneChrome.edge`. */
edge: Record<PaneEdgeState, string>;
/** The focused pane's edge. */
focus: string;
}
/**
* Frame colours for the `minimal` pane style.
*
* A multiplexer grid is separated by its lines alone — no radius, no
* elevation — so the resting edge is a full step brighter than
* the card style's hairline (herdr draws it in a mid grey). Otherwise every
* edge would dissolve into the ground and the grid would read as one
* block of text.
*
* The focused pane wears the app's signal hue (`--accent`: #3D8BFF dark,
* #096CDC light), the one colour the product spends on "this is where you
* are". It is the only standing accent in the workspace; a failed pane keeps
* the fault hue from `PANE_CHROME`, a little stronger to match the brighter
* resting line.
*/
export const PANE_TILE: Record<TerminalAppearance, PaneTileChrome> = {
light: {
edge: {
connecting: "rgba(38,37,30,0.36)",
live: "rgba(38,37,30,0.36)",
exited: "rgba(38,37,30,0.18)",
error: "rgba(190,23,68,0.65)",
},
focus: "#096cdc",
},
dark: {
edge: {
connecting: "rgba(255,255,255,0.26)",
live: "rgba(255,255,255,0.26)",
exited: "rgba(255,255,255,0.11)",
error: "rgba(227,70,113,0.75)",
},
focus: "#3d8bff",
},
};