Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
test(brandPulse): check url() quoting with css-tree, not jsdom's capped style setter
review1239be01b779
diff --git a/package-lock.json b/package-lock.jsonindex 7b7bbc6d3..bb1619196 100644--- a/package-lock.json+++ b/package-lock.json@@ -32,6 +32,7 @@"devDependencies": {"@electron/rebuild": "^4.2.0","@tailwindcss/vite": "^4.3.3",+ "@types/css-tree": "^3.2.0","@types/node": "^26.6.3","@types/qrcode": "^1.5.6","@types/react": "^18.3.31",@@ -44,6 +45,7 @@"@xterm/addon-webgl": "0.18.0","@xterm/xterm": "^5.5.0","@xyflow/react": "^12.12.0",+ "css-tree": "^3.2.1","electron": "^42.11.9","electron-builder": "^26.17.0","electron-vite": "^5.0.0",@@ -2834,6 +2836,13 @@"assertion-error": "^2.0.1"}},+ "node_modules/@types/css-tree": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/@types/css-tree/-/css-tree-3.2.0.tgz",+ "integrity": "sha512-J5KXmk6BFIepOT7280FdFyNs4c5fh0Uee0otjKEvzchrRs38Ii9qminqc4ds0L19X8Zd/rT+brR9jkBthygjWw==",+ "dev": true,+ "license": "MIT"+ },"node_modules/@types/d3-color": {"version": "3.1.3","resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz",diff --git a/package.json b/package.jsonindex 9feb010de..d54f634f4 100644--- a/package.json+++ b/package.json@@ -194,6 +194,7 @@"devDependencies": {"@electron/rebuild": "^4.2.0","@tailwindcss/vite": "^4.3.3",+ "@types/css-tree": "^3.2.0","@types/node": "^26.6.3","@types/qrcode": "^1.5.6","@types/react": "^18.3.31",@@ -206,6 +207,7 @@"@xterm/addon-webgl": "0.18.0","@xterm/xterm": "^5.5.0","@xyflow/react": "^12.12.0",+ "css-tree": "^3.2.1","electron": "^42.11.9","electron-builder": "^26.17.0","electron-vite": "^5.0.0",diff --git a/src/renderer/lib/brandPulse.test.tsx b/src/renderer/lib/brandPulse.test.tsxindex 9bf2bede6..2df7ddfea 100644--- a/src/renderer/lib/brandPulse.test.tsx+++ b/src/renderer/lib/brandPulse.test.tsx@@ -1,6 +1,7 @@// @vitest-environment jsdomimport { act } from 'react'import { createRoot } from 'react-dom/client'+import * as csstree from 'css-tree'import { readFileSync } from 'node:fs'import { join } from 'node:path'import { describe, expect, it } from 'vitest'@@ -59,23 +60,37 @@ describe('brandPulseBackground', () => {// Measured, not assumed: with `url(${src})` the CSS parser rejected the declaration for ALL FOUR// marks (backgroundImage came back ''), because Vite inlines them as data URIs carrying literal// `'` and, for three of them, literal `(`/`)`. The notch strip would have shown an empty box.+ //+ // The grammar check runs on css-tree, the parser jsdom itself wraps, called directly. NOT+ // `el.style.backgroundImage = …`: since jsdom 30.1 (@asamuzakjp/css-color 7) the style setter+ // drops ANY value longer than 1024 characters, and codex's inlined mark is ~2.1 KB — so jsdom+ // rejects it for its length, a limit Chromium (where the notch HUD actually paints) does not have.+ const parsesAsBackgroundImage = (value: string): boolean => {+ let ok = true+ try {+ const ast = csstree.parse(value, { context: 'value', onParseError: () => { ok = false } })+ return ok && csstree.lexer.matchProperty('background-image', ast).matched !== null+ } catch {+ return false+ }+ }+it('survives a real CSS parser for every mark', () => {for (const agentId of ['claude', 'codex', 'gemini', 'opencode', 'antigravity'] as const) {const plan = brandPulsePlan(agentId, 13)const src = plan?.kind === 'asset' ? plan.src : ''- const el = document.createElement('span')- el.style.backgroundImage = brandPulseBackground(src)- expect(el.style.backgroundImage.length, agentId).toBeGreaterThan(0)+ expect(src, agentId).not.toBe('')+ expect(parsesAsBackgroundImage(brandPulseBackground(src)), agentId).toBe(true)}})it('is what the raw form is not — proof the quoting is the load-bearing part', () => {- const plan = brandPulsePlan('opencode', 13)- const src = plan?.kind === 'asset' ? plan.src : ''- expect(src).toMatch(/[()]/) // the inner parens that break an unquoted url()- const bare = document.createElement('span')- bare.style.backgroundImage = `url(${src})`- expect(bare.style.backgroundImage).toBe('')+ for (const agentId of ['claude', 'codex', 'gemini', 'opencode'] as const) {+ const plan = brandPulsePlan(agentId, 13)+ const src = plan?.kind === 'asset' ? plan.src : ''+ expect(src, agentId).toMatch(/['()]/) // the inner quotes/parens that break an unquoted url()+ expect(parsesAsBackgroundImage(`url(${src})`), agentId).toBe(false)+ }})})