Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Add the Aurora skin: a dithered band of green light behind the chat
aivsomkarac50a3fb4cd1
diff --git a/electron/skin-overlay.cjs b/electron/skin-overlay.cjsindex 8e44935e1b..d31ef71aec 100644--- a/electron/skin-overlay.cjs+++ b/electron/skin-overlay.cjs@@ -14,6 +14,7 @@ const SKIN_CHROME = Object.freeze({meadow: Object.freeze({ color: "#ffffff", symbolColor: "#4d5a52" }),pop: Object.freeze({ color: "#fdf5ea", symbolColor: "#3a322d" }),halloween: Object.freeze({ color: "#110d16", symbolColor: "#c2b3cc" }),+ aurora: Object.freeze({ color: "#0b0c0b", symbolColor: "#b4bab4" }),});const DEFAULT_SKIN = "midnight";diff --git a/electron/skin-overlay.test.mjs b/electron/skin-overlay.test.mjsindex 59505bb209..d1be2cfdb5 100644--- a/electron/skin-overlay.test.mjs+++ b/electron/skin-overlay.test.mjs@@ -68,4 +68,9 @@ describe("skin overlay chrome", () => {expect(skinChrome("halloween")).toEqual({ color: "#110d16", symbolColor: "#c2b3cc" });expect(isKnownSkin("halloween")).toBe(true);});++ it("paints Aurora's near-black ground behind the caption buttons", () => {+ expect(skinChrome("aurora")).toEqual({ color: "#0b0c0b", symbolColor: "#b4bab4" });+ expect(skinIsLight("aurora")).toBe(false);+ });});diff --git a/scripts/testing/rail-preview.tsx b/scripts/testing/rail-preview.tsxindex 55afc49067..6001d46fc9 100644--- a/scripts/testing/rail-preview.tsx+++ b/scripts/testing/rail-preview.tsx@@ -224,7 +224,7 @@ if (params.has("railpage")) {// Windows' own title bar is drawn outside the page; this stands in for it, above the page.const bar = document.createElement("div");bar.setAttribute("aria-hidden", "true");- const dark = ["midnight", "foundry", "graphite", "dusk", "halloween"].includes(params.get("skin") ?? "midnight");+ const dark = ["midnight", "foundry", "graphite", "dusk", "halloween", "aurora"].includes(params.get("skin") ?? "midnight");bar.style.cssText = `position:fixed;inset:0 0 auto 0;height:31px;display:flex;align-items:center;z-index:100;font:12px "Segoe UI",sans-serif;padding-left:12px;${dark ? "background:#202020;color:#fff" : "background:#f3f3f3;color:#000"}`;bar.innerHTML = `<span style="flex:1">MausBot</span>${["\u2013", "\u2610", "\u2715"].map((glyph) => `<span style="width:46px;text-align:center">${glyph}</span>`).join("")}`;document.body.append(bar);diff --git a/scripts/verify-window-frame.ts b/scripts/verify-window-frame.tsindex 31766473a0..bf7832b0dd 100644--- a/scripts/verify-window-frame.ts+++ b/scripts/verify-window-frame.ts@@ -23,7 +23,7 @@ const argument = (name: string) => { const at = process.argv.indexOf(name); retuconst shots = argument("--shots") === null ? null : resolve(argument("--shots")!);const only = argument("--only") === null ? null : new Set(argument("--only")!.split(",").filter(Boolean));const WIDTH = 1280, HEIGHT = 800;-const ALL_SKINS = ["daylight", "midnight", "atelier", "foundry", "lagoon", "graphite", "linen", "dusk", "meadow", "pop", "halloween"];+const ALL_SKINS = ["daylight", "midnight", "atelier", "foundry", "lagoon", "graphite", "linen", "dusk", "meadow", "pop", "halloween", "aurora"];const SKINS = argument("--skins") === "all" ? ALL_SKINS : ["daylight", "midnight"];const LOOK: Record<string, string> = { daylight: "light", midnight: "dark" };const BAR = "[data-window-frame-bar]";diff --git a/src/lib/aurora-field.test.ts b/src/lib/aurora-field.test.tsnew file mode 100644index 0000000000..34d00d9ccc--- /dev/null+++ b/src/lib/aurora-field.test.ts@@ -0,0 +1,36 @@+import { describe, expect, it } from "vitest";+import { bandLight, paintAuroraField } from "./aurora-field";++const brightness = ([r, g, b]: readonly number[]) => r! + g! + b!;++function brightestRow(x: number, w: number, h: number): { y: number; light: number } {+ let best = { y: 0, light: 0 };+ for (let y = 0; y < h; y += 2) {+ const light = brightness(bandLight(x, y, w, h));+ if (light > best.light) best = { y, light };+ }+ return best;+}++describe("aurora field", () => {+ it("crosses the window as one bright band over a dark ground", () => {+ const band = brightestRow(900, 1874, 1162);+ expect(band.light).toBeGreaterThan(1.5);+ expect(brightness(bandLight(900, band.y + 400, 1874, 1162))).toBeLessThan(band.light / 4);+ expect(brightness(bandLight(200, 1120, 1874, 1162))).toBeLessThan(0.1);+ });++ it("falls from the top left to the lower right", () => {+ expect(brightestRow(1600, 1874, 1162).y).toBeGreaterThan(brightestRow(500, 1874, 1162).y);+ });++ it("keeps the band near the same place on a smaller screen", () => {+ const full = brightestRow(900, 1874, 1162);+ const half = brightestRow(450, 937, 581);+ expect(Math.abs(half.y / 581 - full.y / 1162)).toBeLessThan(0.05);+ });++ it("does nothing outside a page", () => {+ expect(() => paintAuroraField()).not.toThrow();+ });+});diff --git a/src/lib/aurora-field.ts b/src/lib/aurora-field.tsnew file mode 100644index 0000000000..63e6e09fb4--- /dev/null+++ b/src/lib/aurora-field.ts@@ -0,0 +1,114 @@+type Rgb = readonly [number, number, number];++const PITCH = 3;+const DOT = 2;+const LEVELS = 5;+const BAYER = [0, 8, 2, 10, 12, 4, 14, 6, 3, 11, 1, 9, 15, 7, 13, 5].map((v) => (v + 0.5) / 16);++const DEEP: Rgb = [0.02, 0.22, 0.12];+const GREEN: Rgb = [0.05, 0.55, 0.26];+const TEAL: Rgb = [0.1, 0.78, 0.62];+const CORE: Rgb = [0.92, 1, 0.8];+const LIME: Rgb = [0.8, 0.95, 0.25];+const VIOLET: Rgb = [0.55, 0.36, 1];+const PLUM: Rgb = [0.25, 0.1, 0.45];++/** The band's centre line as y/h = A + B·(x/w) + C·(x/w)², falling from the top left to the lower right. */+const CURVE = { a: -0.087, b: 1.157, c: -0.262 } as const;+const REFERENCE_HEIGHT = 1162;++function mix(from: Rgb, to: Rgb, t: number): Rgb {+ return [from[0] + (to[0] - from[0]) * t, from[1] + (to[1] - from[1]) * t, from[2] + (to[2] - from[2]) * t];+}++function scale(c: Rgb, k: number): Rgb {+ return [c[0] * k, c[1] * k, c[2] * k];+}++function seeded(seed: number): () => number {+ let a = seed;+ return () => {+ a = (a + 0x6d2b79f5) | 0;+ let t = Math.imul(a ^ (a >>> 15), 1 | a);+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;+ };+}++export function bandLight(x: number, y: number, w: number, h: number): Rgb {+ const u = x / w;+ const s = h / REFERENCE_HEIGHT;+ const centre = h * (CURVE.a + CURVE.b * u + CURVE.c * u * u);+ const slope = (h / w) * (CURVE.b + 2 * CURVE.c * u);+ const d = (y - centre) / Math.sqrt(1 + slope * slope) / s;+ const along = 0.7 + 0.3 * Math.exp(-(((x / s - 820) / 800) ** 2));+ const rays = 0.82 + 0.18 * Math.sin(d * 0.11 + Math.sin(x * 0.004) * 3) + 0.08 * Math.sin(d * 0.37 + x * 0.002);+ let light: Rgb;+ if (d < 0) {+ const t = Math.exp(d / 250);+ light = scale(mix(DEEP, mix(GREEN, TEAL, Math.exp(d / 80)), Math.min(1, t * 1.5)), t * 1.55);+ } else {+ const t = Math.exp(-d / 130);+ light = scale(mix(PLUM, mix(VIOLET, LIME, Math.exp(-d / 14)), Math.min(1, Math.exp(-d / 40) * 1.1 + t * 0.5)), t * 1.5);+ }+ return scale(mix(light, CORE, Math.exp(-((d / 24) ** 2)) * 0.85), along * rays);+}++export function drawAuroraField(ctx: CanvasRenderingContext2D, w: number, h: number): void {+ const random = seeded(7);+ ctx.fillStyle = "#080908";+ ctx.fillRect(0, 0, w, h);+ for (let y = 0, row = 0; y < h; y += PITCH, row++) {+ for (let x = 0, col = 0; x < w; x += PITCH, col++) {+ let [r, g, b] = bandLight(x, y, w, h);+ if (random() < 0.45) {+ const hue = random();+ const base = 0.05 + 0.09 * random();+ r += base * (hue < 0.33 ? 1.4 : 0.6);+ g += base * (hue > 0.33 && hue < 0.66 ? 1.3 : 0.7);+ b += base * (hue > 0.66 ? 1.2 : 0.7);+ }+ const threshold = BAYER[(row & 3) * 4 + (col & 3)]!;+ const level = (v: number) => Math.round((Math.floor(Math.min(1, Math.max(0, v)) * LEVELS + threshold) / LEVELS) * 255);+ const q = [level(r), level(g), level(b)];+ if (q[0]! + q[1]! + q[2]! < 6) continue;+ ctx.fillStyle = `rgb(${q[0]},${q[1]},${q[2]})`;+ ctx.fillRect(x, y, DOT, DOT);+ }+ }+ ctx.globalCompositeOperation = "lighter";+ ctx.filter = "blur(36px)";+ ctx.globalAlpha = 0.34;+ ctx.drawImage(ctx.canvas, 0, 0);+ ctx.filter = "none";+ ctx.globalAlpha = 1;+ ctx.globalCompositeOperation = "source-over";+ const fade = ctx.createLinearGradient(0, h * 0.55, 0, h);+ fade.addColorStop(0, "rgb(8 9 8 / 0)");+ fade.addColorStop(1, "rgb(8 9 8 / 0.55)");+ ctx.fillStyle = fade;+ ctx.fillRect(0, 0, w, h);+}++let painted = false;++// shortcut: drawn once at the first screen's size; on a larger display the ground shows past its edge. Redraw on a+// screen change if that is ever noticed.+export function paintAuroraField(): void {+ if (painted || typeof document === "undefined") return;+ const w = Math.ceil(Math.max(window.screen?.width ?? 0, window.innerWidth));+ const h = Math.ceil(Math.max(window.screen?.height ?? 0, window.innerHeight));+ const canvas = document.createElement("canvas");+ canvas.width = w;+ canvas.height = h;+ const ctx = canvas.getContext("2d");+ if (!ctx || !w || !h) return;+ painted = true;+ drawAuroraField(ctx, w, h);+ canvas.toBlob((blob) => {+ if (!blob) return;+ const root = document.documentElement.style;+ root.setProperty("--aurora-field", `url(${URL.createObjectURL(blob)})`);+ root.setProperty("--aurora-field-size", `${w}px ${h}px`);+ });+}diff --git a/src/lib/glass-surface.test.ts b/src/lib/glass-surface.test.tsindex 094f628a07..4753548735 100644--- a/src/lib/glass-surface.test.ts+++ b/src/lib/glass-surface.test.ts@@ -3,6 +3,7 @@ import { fileURLToPath } from "node:url";import { dirname, join } from "node:path";import { describe, expect, it } from "vitest";import { glassPopupTopInset } from "./glass-popup";+import { SKIN_IDS } from "./skins";const src = join(dirname(fileURLToPath(import.meta.url)), "..");const css = readFileSync(join(src, "styles.css"), "utf8");@@ -57,7 +58,7 @@ describe("glass surface", () => {it("lives outside every skin block, and every skin still defines the tokens it reads", () => {const blocks = skinBlocks();- expect(blocks).toHaveLength(11);+ expect(blocks).toHaveLength(SKIN_IDS.length);for (const block of blocks) {expect(block).not.toContain("glass");for (const token of ["--color-menu", "--color-card", "--color-ink"]) expect(block).toContain(`${token}:`);diff --git a/src/lib/skins.test.ts b/src/lib/skins.test.tsindex cfbd7af5fa..ac6818256b 100644--- a/src/lib/skins.test.ts+++ b/src/lib/skins.test.ts@@ -90,13 +90,20 @@ describe("skins", () => {expect(css).toMatch(/@scope \(\[data-skin="pop"\]:not\(\[data-skin-preview\]\)\) to \(\[data-skin\]\)/);});- it("adds Halloween last, dark, with its atmosphere kept off the picker miniature", () => {- expect(SKIN_IDS.at(-1)).toBe("halloween");+ it("adds Halloween after Pop, dark, with its atmosphere kept off the picker miniature", () => {+ expect(SKIN_IDS[10]).toBe("halloween");expect(SKINS.find((s) => s.id === "halloween")?.name).toBe("Halloween");expect(css).toMatch(/@scope \(\[data-skin="halloween"\]:not\(\[data-skin-preview\]\)\) to \(\[data-skin\]\)\s*\{\s*main\.bg-app\s*\{/);expect(css).toMatch(/@media \(prefers-reduced-motion: reduce\)\s*\{\s*\[data-skin="halloween"\] main\.bg-app::before/);});+ it("adds Aurora last, dark, with its light field kept off the picker miniature", () => {+ expect(SKIN_IDS.at(-1)).toBe("aurora");+ expect(SKINS.find((s) => s.id === "aurora")?.name).toBe("Aurora");+ expect(css).toMatch(/\[data-skin="aurora"\] \{[^}]*--code-color-scheme: dark;/);+ expect(css).toMatch(/@scope \(\[data-skin="aurora"\]:not\(\[data-skin-preview\]\)\) to \(\[data-skin\]\)\s*\{\s*main\.bg-app\s*\{/);+ });+it("describes each skin exactly once", () => {expect(SKINS.map((s) => s.id).sort()).toEqual([...SKIN_IDS].sort());for (const skin of SKINS) {diff --git a/src/lib/skins.ts b/src/lib/skins.tsindex 49e94702c2..28db2f0b3b 100644--- a/src/lib/skins.ts+++ b/src/lib/skins.ts@@ -1,3 +1,4 @@+import { paintAuroraField } from "./aurora-field";import { hasPriorRun } from "./prior-run";export const SKIN_IDS = [@@ -12,6 +13,7 @@ export const SKIN_IDS = ["meadow","pop","halloween",+ "aurora",] as const;export type SkinId = (typeof SKIN_IDS)[number];@@ -33,6 +35,7 @@ export const SKINS: readonly Skin[] = [{ id: "meadow", name: "Meadow", tagline: "Fresh white with a calm green. The MausBot look." },{ id: "pop", name: "Pop", tagline: "Cream paper, thick ink outlines, hard shadows. Chunky and cheerful." },{ id: "halloween", name: "Halloween", tagline: "Plum after dark, lit in pumpkin orange. Bats optional." },+ { id: "aurora", name: "Aurora", tagline: "Near-black, crossed by a band of green light. Glass on top." },];/** "system" follows the OS between the light and dark skins below; anything else pins one skin. */@@ -102,6 +105,7 @@ export function subscribeSkin(listener: () => void): () => void {function paintSkin(id: SkinId): void {document.documentElement.dataset.skin = id;+ if (id === "aurora") paintAuroraField();for (const listener of listeners) listener();// On Windows the caption buttons sit in a native overlay the main process paints, out of CSS's reach.try {diff --git a/src/locales/en.json b/src/locales/en.jsonindex 7f7e5fd9c6..1ea1cbaed8 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -8808,6 +8808,7 @@"skins.tagline.meadow": "Fresh white with a calm green. The MausBot look.","skins.tagline.pop": "Cream paper, thick ink outlines, hard shadows. Chunky and cheerful.","skins.tagline.halloween": "Plum after dark, lit in pumpkin orange. Bats optional.",+ "skins.tagline.aurora": "Near-black, crossed by a band of green light. Glass on top.","automations.calendar.cronMove": "Open this automation to change its repeating schedule.","automations.calendar.moveSeries": "Move every time it repeats?","automations.address.copyAddressFailed": "Couldn't copy the address",diff --git a/src/styles.css b/src/styles.cssindex 465967434c..ae1589497a 100644--- a/src/styles.css+++ b/src/styles.css@@ -1005,6 +1005,69 @@--identity-chrome: #B3BAC4;}+[data-skin="aurora"] {+ --code-color-scheme: dark;+ --color-app: #0b0c0b;+ --color-panel: #131413;+ --color-frame: var(--color-panel);+ --color-raised: #1d1f1d;+ --color-raised-hover: #272a27;+ --color-composer: #161816;+ --color-composer-ring: #2c302c;+ --color-card: #1a1c1a;+ --color-menu: #1a1c1a;+ --color-menu-hover: color-mix(in srgb, var(--color-raised) 70%, transparent);+ --color-menu-active: var(--color-raised);+ --color-inset: #151715;+ --color-control: #242724;+ --color-hairline: #343834;++ --color-ink: #f2f5f2;+ --color-ink-secondary: #f2f5f2a8;+ --color-ink-tertiary: #f2f5f291;++ --color-accent: #3ccf73;+ --color-accent-border: #5ad98a;+ --color-accent-text: #6ee69a;+ --color-focus: #5ad98a;+ --color-accent-ink: #04170b;+ --color-bubble-user: #18432c;+ --color-bubble-user-ink: #ecfff2;++ --color-success: #4ade80;+ --color-danger: #ff5f6d;+ --color-danger-ink: #2a0508;+ --color-success-ink: #052e16;+ --color-warning: #f5a524;+ --color-scrollbar: #343834;+ --color-maus-line: #f2f5f2;++ --color-edge: #f2f5f20f;++ --font-sans: "Geist Variable", -apple-system, BlinkMacSystemFont,+ "Segoe UI", system-ui, sans-serif;+ --radius-xs: 2px;+ --radius-sm: 4px;+ --radius-md: 6px;+ --radius-lg: 8px;+ --radius-xl: 12px;+ --radius-2xl: 14px;+ --radius-3xl: 16px;+ --radius-4xl: 18px;+ --identity-green: #009957;+ --identity-blue: #377FE6;+ --identity-red: #D94B52;+ --identity-orange: #E78531;+ --identity-purple: #8a65cd;+ --identity-cyan: #0EA5C6;+ --identity-pink: #D84F8B;+ --identity-yellow: #D8A729;+ --identity-teal: #01A492;+ --identity-coral: #E5634E;+ --identity-silver: #A8ADB4;+ --identity-chrome: #B3BAC4;+}+/* Every popover and menu in the menu tone, flat in Midnight and on a soft lift in Daylight. A popover's rim is itsborder, never a ring, so clearing box-shadow leaves the rim. */.popover-surface {@@ -2815,6 +2878,52 @@ html[data-cloud-intent-morph] [data-tour="composer"] { view-transition-name: clo}}+/* Fixed to the window, so the band runs on unbroken from one pane to the next. */+@scope ([data-skin="aurora"]:not([data-skin-preview])) to ([data-skin]) {+ main.bg-app {+ isolation: isolate;+ }+ main.bg-app::before {+ content: "";+ position: absolute;+ inset: 0;+ z-index: -1;+ pointer-events: none;+ background: var(--aurora-field, none) 0 0 / var(--aurora-field-size, cover) no-repeat fixed;+ image-rendering: pixelated;+ }+ main.bg-app :is(.bg-card, .bg-composer, .bg-bubble-user) {+ -webkit-backdrop-filter: blur(28px) saturate(150%);+ backdrop-filter: blur(28px) saturate(150%);+ }+ main.bg-app :is(.bg-card, .bg-composer) {+ background-color: color-mix(in srgb, var(--color-card) 62%, transparent);+ }+ main.bg-app .bg-bubble-user {+ background-color: color-mix(in srgb, var(--color-bubble-user) 78%, transparent);+ }+ main.bg-app .glass-bar[data-glass-fade]::before,+ main.bg-app [data-composer-backdrop] {+ background: color-mix(in srgb, var(--color-app) 35%, transparent);+ -webkit-backdrop-filter: blur(20px) saturate(140%);+ backdrop-filter: blur(20px) saturate(140%);+ }+ main.bg-app .glass-bar[data-glass-fade]::before {+ mask-image: linear-gradient(to bottom, black 40%, transparent);+ }+ main.bg-app [data-composer-backdrop] {+ mask-image: linear-gradient(to bottom, transparent, black 20px);+ }+}++@media (prefers-reduced-transparency: reduce) {+ [data-skin="aurora"] main.bg-app :is(.bg-card, .bg-composer, .bg-bubble-user) {+ background-color: revert-layer;+ -webkit-backdrop-filter: none;+ backdrop-filter: none;+ }+}+/* Disabled buttons.Upstream fades them with `disabled:opacity-40`. On a dark ground that holds:the button stays darker than the page and the white label survives. On a@@ -2965,7 +3074,7 @@ button:disabled.bg-danger {outline-offset: -1.5px;}:root,-:is([data-skin="midnight"], [data-skin="foundry"], [data-skin="graphite"], [data-skin="dusk"], [data-skin="halloween"]) {+:is([data-skin="midnight"], [data-skin="foundry"], [data-skin="graphite"], [data-skin="dusk"], [data-skin="halloween"], [data-skin="aurora"]) {--radius-menu: 12px;--menu-shadow: 0 0 #0000;}