Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Give a Cloud's own sidebar a faint night sky at its top
milind-sonif98bf6feda2d
diff --git a/docs/verification/evidence/cloud-sidebar-night/advanced.jpg b/docs/verification/evidence/cloud-sidebar-night/advanced.jpgnew file mode 100644index 0000000000..05038e783bBinary files /dev/null and b/docs/verification/evidence/cloud-sidebar-night/advanced.jpg differdiff --git a/docs/verification/evidence/cloud-sidebar-night/rails.jpg b/docs/verification/evidence/cloud-sidebar-night/rails.jpgnew file mode 100644index 0000000000..7ac8ec8f63Binary files /dev/null and b/docs/verification/evidence/cloud-sidebar-night/rails.jpg differdiff --git a/docs/verification/evidence/cloud-sidebar-night/simple.jpg b/docs/verification/evidence/cloud-sidebar-night/simple.jpgnew file mode 100644index 0000000000..281fcbddfeBinary files /dev/null and b/docs/verification/evidence/cloud-sidebar-night/simple.jpg differdiff --git a/docs/verification/evidence/cloud-sidebar-night/window-daylight.jpg b/docs/verification/evidence/cloud-sidebar-night/window-daylight.jpgnew file mode 100644index 0000000000..67435df1d7Binary files /dev/null and b/docs/verification/evidence/cloud-sidebar-night/window-daylight.jpg differdiff --git a/docs/verification/evidence/cloud-sidebar-night/window-midnight.jpg b/docs/verification/evidence/cloud-sidebar-night/window-midnight.jpgnew file mode 100644index 0000000000..bd3d1b5236Binary files /dev/null and b/docs/verification/evidence/cloud-sidebar-night/window-midnight.jpg differdiff --git a/scripts/check-skin-contrast.mjs b/scripts/check-skin-contrast.mjsindex 969be58965..ba844e4499 100644--- a/scripts/check-skin-contrast.mjs+++ b/scripts/check-skin-contrast.mjs@@ -271,4 +271,39 @@ if (!night) {}}+// A Cloud's sidebar lays a wash of one night colour over its panel (src/styles.css [data-cloud-sky]::before): every ink+// must read on the panel with that wash at its strongest.+const washOf = (rule) => ({ token: /var\((--cloud-night-[\w-]+)\)\)/.exec(rule ?? "")?.[1], strength: Number(/opacity: ([\d.]+);/.exec(rule ?? "")?.[1]) });+const washLight = washOf(/\n\[data-cloud-sky\]::before \{([^}]*)\}/.exec(css)?.[1]);+const washDark = washOf(/@container style\(--code-color-scheme: dark\) \{\s*\[data-cloud-sky\]::before \{([^}]*)\}/.exec(css)?.[1]);+if (!night || !washLight.token || !washDark.token || !(washLight.strength > 0) || !(washDark.strength > 0)) {+ failed = true;+ console.log("✗ Cloud sidebar — cannot read the wash's strength or the night tokens");+} else {+ const hex = ({ r, g, b }) => `#${[r, g, b].map((v) => Math.round(v).toString(16).padStart(2, "0")).join("")}`;+ let washFailed = false;+ for (const [id, tokens] of skins) {+ const dark = tokens["--code-color-scheme"] === "dark";+ const pick = (token) => /^light-dark\(\s*([^,]+?)\s*,\s*([^)]+?)\s*\)$/.exec(night[token] ?? "")?.[dark ? 2 : 1];+ const panel = parseHex(tokens["--color-panel"] ?? "");+ const problems = [];+ const wash = dark ? washDark : washLight;+ const tint = parseHex(pick(wash.token) ?? "");+ if (!panel || !tint) problems.push(`cannot measure ${wash.token} over --color-panel`);+ else {+ const washed = hex(flatten({ ...tint, a: wash.strength }, panel));+ for (const fg of ["--color-ink", "--color-ink-secondary", "--color-ink-tertiary"]) {+ const ratio = contrast(tokens[fg] ?? "", washed);+ if (ratio === null || ratio < 4.5) problems.push(`${fg} on the panel under ${wash.token}: ${ratio?.toFixed(2) ?? "unmeasurable"}:1 (needs 4.5:1)`);+ }+ }+ if (problems.length) {+ failed = true;+ washFailed = true;+ for (const problem of problems) console.log(`✗ ${id} Cloud sidebar — ${problem}`);+ }+ }+ if (!washFailed) console.log(`✓ Cloud sidebar — every skin's inks read under the night wash (${washLight.token} at ${washLight.strength} light, ${washDark.token} at ${washDark.strength} dark)`);+}+process.exit(failed ? 1 : 0);diff --git a/src/components/Sidebar.simple-layout.test.ts b/src/components/Sidebar.simple-layout.test.tsindex e7904a35bb..9a37b308f3 100644--- a/src/components/Sidebar.simple-layout.test.ts+++ b/src/components/Sidebar.simple-layout.test.ts@@ -314,6 +314,22 @@ describe("Simple-mode sidebar layout", () => {expect(render().tree.some((node) => node.type === SimpleRailFooter)).toBe(false);});+ it("marks a Cloud's own sidebar for its night sky, Simple, Advanced or as a rail, and never a local one", () => {+ const sky = () => render().root.props["data-cloud-sky"];+ expect(sky(), "a local workspace").toBeUndefined();+ fixture.state = { ...fixture.state, config: { ...fixture.state.config, cloudHome: false } as AppState["config"] };+ expect(sky(), "a server that is no Cloud").toBeUndefined();+ fixture.state = { ...fixture.state, config: { ...fixture.state.config, cloudHome: true } as AppState["config"] };+ expect(sky()).toBe("simple");+ fixture.advanced = true;+ expect(sky()).toBe("advanced");+ setSidebarDensity("icons");+ expect(sky(), "Advanced collapsed to avatars").toBe("rail");+ fixture.advanced = false;+ expect(sky(), "Simple's rail").toBe("rail");+ expect(render(true).root.props["data-cloud-sky"], "held collapsed by a side panel").toBe("rail");+ });+it("New Bot makes a bot at once in both modes, Chief of Staff or not; Advanced keeps Create department and Templates", () => {fixture.state = { ...fixture.state, bots: [bot("atlas", { chiefOfStaff: true }), bot("bea")] };const openMenu = () => {diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsxindex 0cdc0772a6..7a0e830e3c 100644--- a/src/components/Sidebar.tsx+++ b/src/components/Sidebar.tsx@@ -1384,7 +1384,7 @@ export function Sidebar({ open, onClose, collapseToIcons = false }: {tabIndex={-1}aria-label={t("sidebar.aria")}data-native-view-overlay- data-sidebar+ data-sidebar data-cloud-sky={state.config?.cloudHome === true ? density === "icons" ? "rail" : advanced ? "advanced" : "simple" : undefined}onClick={(event) => {// The phone's list covers the whole screen: choosing the bot that is already open has to dismiss it too.if (phone && open && event.target instanceof Element && !(event.target instanceof HTMLInputElement) && event.target.closest("[data-sidebar-bot-row], [data-sidebar-hero]")) onClose();diff --git a/src/lib/cloud-sky.test.ts b/src/lib/cloud-sky.test.tsnew file mode 100644index 0000000000..c1903c8e77--- /dev/null+++ b/src/lib/cloud-sky.test.ts@@ -0,0 +1,63 @@+import { readFileSync } from "node:fs";+import { dirname, join } from "node:path";+import { fileURLToPath } from "node:url";+import { describe, expect, it } from "vitest";++const css = readFileSync(join(dirname(fileURLToPath(import.meta.url)), "../styles.css"), "utf8").replace(/\r\n/g, "\n");+/** The rule whose whole selector is `selector`, not one it ends a selector list of. */+const body = (selector: string) => {+ let start = css.indexOf(`\n${selector} {`);+ while (start > 0 && css[start - 1] === ",") start = css.indexOf(`\n${selector} {`, start + 1);+ expect(start, selector).toBeGreaterThanOrEqual(0);+ return css.slice(css.indexOf("{", start) + 1, css.indexOf("}", start));+};+const list = (rule: string, property: string) => (new RegExp(`${property}: ([^;]+);`).exec(rule)?.[1] ?? "").split(/,(?![^(]*\))/).map((part) => part.trim());++describe("a Cloud's own sidebar sky", () => {+ it("draws 5 to 7 small stars over the sidebar and fewer on the rail, each with its own place, one of them twinkling", () => {+ for (const [variant, least, most] of [["simple", 5, 7], ["advanced", 5, 7], ["rail", 3, 5]] as const) {+ const rule = body(`[data-cloud-sky="${variant}"]::after`);+ const stars = list(rule, "background-image"), places = list(rule, "background-position");+ expect(stars.length, variant).toBeGreaterThanOrEqual(least);+ expect(stars.length, variant).toBeLessThanOrEqual(most);+ expect(places, variant).toHaveLength(stars.length);+ expect(new Set(places).size, `${variant}: no two stars in one place`).toBe(places.length);+ expect(stars.filter((star) => star === "var(--twinkle)"), variant).toHaveLength(1);+ }+ });++ it("keeps every star tiny and faint", () => {+ const after = body("[data-cloud-sky]::after");+ for (const name of ["star", "faint", "bright", "twinkle"]) {+ const star = new RegExp(`--${name}: radial-gradient\\(circle ([\\d.]+)px, color-mix\\(in srgb, var\\(--cloud-sky-star\\) ([^,]+), transparent\\)`).exec(after);+ expect(star, name).not.toBeNull();+ expect(Number(star![1]), `${name} radius`).toBeLessThanOrEqual(1.5);+ if (name !== "twinkle") {+ expect(Number.parseFloat(star![2]!), `${name} strength`).toBeGreaterThanOrEqual(25);+ expect(Number.parseFloat(star![2]!), `${name} strength`).toBeLessThanOrEqual(45);+ }+ }+ });++ it("twinkles one star rarely and softly, and never under reduced motion, the system's or the app's", () => {+ const [, seconds] = /animation: cloud-sky-twinkle ([\d.]+)s/.exec(body("[data-cloud-sky]::after")) ?? [];+ expect(Number(seconds)).toBeGreaterThanOrEqual(20);+ expect(Number(seconds)).toBeLessThanOrEqual(40);+ expect(css).toMatch(/@media \(prefers-reduced-motion: reduce\) \{\s*\[data-cloud-sky\]::after \{ animation: none; \}/);+ expect(css).toContain(':root[data-reduced-motion="true"] [data-cloud-sky]::after { animation: none; }');+ });++ it("takes no pointer and holds no focus or words: both layers are empty pseudo-elements", () => {+ const layers = body("[data-cloud-sky]::before,\n[data-cloud-sky]::after");+ expect(layers).toContain('content: "";');+ expect(layers).toContain("pointer-events: none;");+ });++ it("is gone before the first bot: at most 120px tall, its wash fading to nothing", () => {+ for (const selector of ["[data-cloud-sky]::before,\n[data-cloud-sky]::after", '[data-cloud-sky="rail"]::before,\n[data-cloud-sky="rail"]::after']) {+ const [, height] = /height: (\d+)px;/.exec(body(selector)) ?? [];+ expect(Number(height), selector).toBeLessThanOrEqual(120);+ }+ expect(body("[data-cloud-sky]::before")).toMatch(/mask-image: linear-gradient\(to bottom, [^;]*transparent \d+%\);/);+ });+});diff --git a/src/styles.css b/src/styles.cssindex 15b8342695..70c3101e5b 100644--- a/src/styles.css+++ b/src/styles.css@@ -2878,7 +2878,7 @@ button:disabled.bg-danger {--cloud-night-from: light-dark(#2c3274, #0e1230);--cloud-night-mid: light-dark(#373b84, #151a45);--cloud-night-to: light-dark(#7a68ae, #252c69);- --cloud-night-glow: light-dark(#f2a9c23d, #6d5fd02e);+ --cloud-night-glow: light-dark(#f2a9c2, #6d5fd0);--cloud-night-ink: #ffffff;--cloud-night-ink-quiet: light-dark(#ffffffd6, #ffffffc4);--cloud-night-star: light-dark(#ffffff, #fff7dd);@@ -2894,7 +2894,7 @@ button:disabled.bg-danger {color-scheme: var(--code-color-scheme);color: var(--cloud-night-ink);background:- radial-gradient(55% 110% at 90% 115%, var(--cloud-night-glow), transparent 70%),+ radial-gradient(55% 110% at 90% 115%, color-mix(in srgb, var(--cloud-night-glow) 20%, transparent), transparent 70%),linear-gradient(100deg, var(--cloud-night-from) 0%, var(--cloud-night-mid) 55%, var(--cloud-night-to) 100%);box-shadow: inset 0 0 0 0.5px rgb(255 255 255 / 0.08);}@@ -2916,6 +2916,72 @@ button:disabled.bg-danger {100% { opacity: 0; transform: translate(120px, 36px); }}+/* A Cloud's own sidebar: a faint wash of the night card's sky behind the window controls, gone before the first bot,+ and a few small stars in the gaps between the controls (5 to 7, never under a label or a button). One twinkles,+ briefly, once every half a minute. Both layers are pseudo-elements, so they hold no focus and take no pointer;+ light-dark() reads the color-scheme each layer sets for itself, never the sidebar's own. */+@property --cloud-sky-twinkle {+ syntax: "<percentage>";+ inherits: false;+ initial-value: 32%;+}+[data-cloud-sky] {+ --cloud-sky-star: light-dark(#8e9cc6, var(--cloud-night-star));+ --cloud-sky-dot: radial-gradient(circle 1.2px, var(--cloud-sky-star), transparent);+}+[data-cloud-sky]::before,+[data-cloud-sky]::after {+ content: "";+ position: absolute;+ inset: 0 0 auto;+ height: 112px;+ pointer-events: none;+ color-scheme: var(--code-color-scheme);+}+[data-cloud-sky]::before {+ background: linear-gradient(100deg, color-mix(in srgb, var(--cloud-night-to) 70%, transparent), var(--cloud-night-to));+ opacity: 0.08;+ -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgb(0 0 0 / 0.5) 30%, rgb(0 0 0 / 0.12) 48%, transparent 58%);+ mask-image: linear-gradient(to bottom, #000 0%, rgb(0 0 0 / 0.5) 30%, rgb(0 0 0 / 0.12) 48%, transparent 58%);+}+@container style(--code-color-scheme: dark) {+ [data-cloud-sky]::before {+ background: linear-gradient(100deg, color-mix(in srgb, var(--cloud-night-glow) 70%, transparent), var(--cloud-night-glow));+ opacity: 0.13;+ }+}+[data-cloud-sky]::after {+ --star: radial-gradient(circle 1.1px, color-mix(in srgb, var(--cloud-sky-star) 38%, transparent), transparent);+ --faint: radial-gradient(circle 0.9px, color-mix(in srgb, var(--cloud-sky-star) 26%, transparent), transparent);+ --bright: radial-gradient(circle 1.3px, color-mix(in srgb, var(--cloud-sky-star) 45%, transparent), transparent);+ --twinkle: radial-gradient(circle 1.3px, color-mix(in srgb, var(--cloud-sky-star) var(--cloud-sky-twinkle), transparent), transparent);+ background-repeat: no-repeat;+ animation: cloud-sky-twinkle 31s ease-in-out infinite;+}+[data-cloud-sky="simple"]::after {+ background-image: var(--star), var(--bright), var(--faint), var(--star), var(--faint), var(--twinkle);+ background-position: 88px 9px, 134px 14px, 10px 52px, calc(100% - 54px) 6px, calc(100% - 20px) 58px, 118px 36px;+}+[data-cloud-sky="advanced"]::after {+ background-image: var(--star), var(--faint), var(--faint), var(--faint), var(--bright), var(--twinkle);+ background-position: 96px 4px, 168px 3px, calc(100% - 64px) 3px, 10px 39px, 136px 38px, 62px 38px;+}+[data-cloud-sky="rail"]::before,+[data-cloud-sky="rail"]::after { height: 88px; }+[data-cloud-sky="rail"]::after {+ background-image: var(--star), var(--faint), var(--faint), var(--twinkle);+ background-position: calc(100% - 14px) 14px, 8px 58px, calc(100% - 10px) 90px, calc(100% - 12px) 40px;+}+[data-cloud-sky]::after { background-size: 4px 4px; }+@keyframes cloud-sky-twinkle {+ 0%, 86%, 100% { --cloud-sky-twinkle: 32%; }+ 92% { --cloud-sky-twinkle: 72%; }+}+@media (prefers-reduced-motion: reduce) {+ [data-cloud-sky]::after { animation: none; }+}+:root[data-reduced-motion="true"] [data-cloud-sky]::after { animation: none; }+/* Trace waterfall: AI steps lavender, tools pale teal, errors red, each mixed into the skin's card so every skin keeps its contrast. */.trace-bar { border: 1px solid transparent; }.trace-bar-step {