Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(a11y): keep the nav readable during the theme probe and the terminal feed chip above AA
nirholase1d9f2fb9e58
diff --git a/data/changelog.json b/data/changelog.jsonindex a3898df3c..35af498a9 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -25443,13 +25443,13 @@},{"date": "2026-09-01",- "title": "Site header: readable navigation text from the first paint, on every page",- "summary": "On a cold load, the theme system's capability check could leave the header's navigation labels stuck on the light theme's grey over the dark bar for several seconds, well under the contrast people need to read them. The check now runs without triggering colour transitions, so Build, Discover, Learn, Search, Walk, Sign in and Console render in their intended colours the moment the header appears. The automated accessibility floor that caught it now measures pages once their entrance animations have finished, so it reports what a reader sees rather than a half-faded frame.",+ "title": "Readable header navigation from the first paint, and a readable feed status on the terminal",+ "summary": "On a cold load, the theme system's capability check could leave the header's navigation labels stuck on the light theme's grey over the dark bar for several seconds, well under the contrast people need to read them. The check now runs without triggering colour transitions, so Build, Discover, Learn, Search, Walk, Sign in and Console render in their intended colours the moment the header appears. On /terminal the \"Positions\" feed-status chip no longer fades its label along with its idle dot, so it stays readable against the bar. The automated accessibility floor that caught it now measures pages once their entrance animations have finished, so it reports what a reader sees rather than a half-faded frame.","tags": ["fix","improvement"],- "link": "/concierge"+ "link": "/terminal"},{"date": "2026-09-01",diff --git a/prompts/swarm-100/sweep-a11y.md b/prompts/swarm-100/sweep-a11y.mddeleted file mode 100644index 82d7595a4..000000000--- a/prompts/swarm-100/sweep-a11y.md+++ /dev/null@@ -1,86 +0,0 @@-# Sweep: Accessibility suite green and extended--How to run: paste this file's repo path into a fresh Claude Code chat in this-repository and say "run this work order". This file is fully self-contained:-it depends on no other prompt file anywhere. If neighboring files in-prompts/swarm-100/ are gone, that work is done; if present, ignore them.-Every claim below rots; step 0 re-measures, and what you measure wins.--## Operating clause (binding)--- Read CLAUDE.md first. Its rules override everything, including this file.-- Finish 100% in this session. Never end the turn with a question, an option- list, or an unexecuted plan. A judgment call goes in one line of the final- report; it never becomes a question that halts work.-- The only permitted stops are the CLAUDE.md stop-and-ask gates: spending real- funds or any irreversible on-chain write, git push or a production deploy,- committing content that references a crypto project other than $THREE, and- destroying unrecoverable data.-- No mocks, no fake data, no placeholder stubs, no unfinished-work markers, no- commented-out code. Real APIs and real integrations only.-- The em-dash and en-dash characters are banned in everything you write.-- Concurrent agents share this worktree: stage explicit paths only (never a- bare add-everything), and commit finished work promptly.-- Before committing, run: npm run check:rules -- --paths <files you touched>.- It must exit 0.--## Step 0: re-derive the current state--Run the sweep's own command first and work from its output, not from any-memory of what used to fail:-- npm run audit:a11y--Capture the full output to the session scratchpad; do not work from an-excerpt.--## Task--Run the existing a11y Playwright suite and fix every violation it finds. Then extend the spec to cover ten more high-traffic routes from data/pages.json (main and build sections first) and fix what the new coverage finds. Real fixes in markup and styles, never assertion downgrades.--Fix everything found in this sweep's scope. Findings that belong to a-different surface entirely (and would take this session off its one task) go-in the report as named follow-ups instead; everything in scope gets fixed-here, at root, with no masking.--## Definition of done--- [ ] The command above exits 0 (or, for measurement-style sweeps, the report- carries the measured numbers and every committed fix).-- [ ] Every fix is a root-cause fix; no check was weakened, skipped, or- quarantined to get to green.-- [ ] npm run check:rules -- --paths <touched files> exits 0; npm test passes- if code changed.--## Never blocked--| Blocker | Resolution (act, do not ask) |-|---|---|-| Missing env var or credential | Check .env and .env.local, then the Cloud Run service env, then Secret Manager (the CLAUDE.md self-unblock playbook has the exact commands). If it truly exists nowhere, wire the code fully behind the env var, prove the wiring with a dry run, and name the single missing var in the report. |-| gcloud not on PATH | Run: export PATH="$HOME/google-cloud-sdk/bin:$PATH" |-| Dev server port 3000 busy | Another agent may be serving this repo; probe it and reuse if so. Otherwise start your own on a free port: npx vite --port 3101 |-| Playwright browser missing | npx playwright install chromium |-| A surface needs a signed-in user | Register a fresh account through the real /register flow against the real API and use it. Never mock the session. |-| A defect sits in code you did not touch | Fix it if it blocks a Definition of done line (root cause it, never mask it). Otherwise note it in the report and continue. |-| An unrelated test is red | Same rule. Never pipe npm test through tail; it masks exit codes. |--## Close out (required)--1. Verify every Definition of done line with the actual command output in- front of you. Never claim a line you did not verify.-2. Commit with explicit paths and a subject that describes the diff (house- style: type(scope): what changed and why a reader cares).-3. Delete this prompt file in that same commit:-- git rm prompts/swarm-100/sweep-a11y.md-- The shrinking directory is this campaign's only progress ledger; there is- no progress log to update.-4. Final report: what step 0 measured, what changed (file list), evidence per- Definition of done line, and any one-line judgment calls. No trailing- questions, no unexecuted plans.--If a line genuinely cannot pass inside this session (an external party must-respond, or an owner-gated action is the final step), finish everything else,-leave this file in place, and state exactly which line remains and who owns-it. Never delete this file on a partial.diff --git a/public/theme-switcher.js b/public/theme-switcher.jsindex c4e3dd9a8..a0cf1de9b 100644--- a/public/theme-switcher.js+++ b/public/theme-switcher.js@@ -76,14 +76,59 @@// Does this page honour the light palette? Probe synchronously: flip the// attribute to 'light', read the body (forces a style recalc, NOT a paint),// then restore — all in one JS turn, so nothing flashes on screen.+ // The probe never paints, but the forced recalc is still a style change+ // event, so every element with a colour transition (the whole shared nav)+ // starts transitioning FROM the light palette when the attribute snaps+ // back. The sheet watch below re-probes on every DOM mutation, which+ // re-arms that transition before it can advance a frame, so on a cold load+ // the nav sat at the light theme's grey (#5a616f on a near-black bar, 3:1)+ // for as long as the page kept mutating: seconds, and a real WCAG AA+ // failure the a11y floor caught on /concierge. Suspending transitions for+ // the probe, and forcing one more recalc before lifting the suspension,+ // means neither flip is ever observed as a transition start. The+ // suspension sheet goes through adoptedStyleSheets where available so it+ // is not a DOM mutation the watch would react to; the <style> fallback is+ // tagged so the watch can ignore it.+ var PROBE_CSS = '*,*::before,*::after{transition:none!important}';+ var probeSheet = null;+ function isProbeNode(node) {+ return !!(node && node.nodeType === 1 && node.hasAttribute && node.hasAttribute('data-twx-theme-probe'));+ }+ function withTransitionsSuspended(fn) {+ var el = document.documentElement;+ var styleEl = null;+ if (document.adoptedStyleSheets && typeof CSSStyleSheet === 'function' && 'replaceSync' in CSSStyleSheet.prototype) {+ if (!probeSheet) {+ probeSheet = new CSSStyleSheet();+ probeSheet.replaceSync(PROBE_CSS);+ }+ document.adoptedStyleSheets = document.adoptedStyleSheets.concat([probeSheet]);+ } else {+ styleEl = document.createElement('style');+ styleEl.setAttribute('data-twx-theme-probe', '');+ styleEl.textContent = PROBE_CSS;+ (document.head || el).appendChild(styleEl);+ }+ try {+ return fn();+ } finally {+ void el.offsetWidth; // commit the restored theme while transitions are still off+ if (styleEl) styleEl.remove();+ else document.adoptedStyleSheets = document.adoptedStyleSheets.filter(function (sheet) { return sheet !== probeSheet; });+ }+ }+function pageSupportsLight() {if (islandCache !== null && islandSettled) return !islandCache;if (!document.body) return true; // can't tell yet — assume capablevar el = document.documentElement;var prev = el.getAttribute('data-theme');- el.setAttribute('data-theme', 'light');- var dark = bodyIsDark();- el.setAttribute('data-theme', prev || 'dark');+ var dark = withTransitionsSuspended(function () {+ el.setAttribute('data-theme', 'light');+ var result = bodyIsDark();+ el.setAttribute('data-theme', prev || 'dark');+ return result;+ });islandCache = dark; // true ⇒ island (light not supported)// Capable is final; not-capable only once the stylesheets are all in.islandSettled = !dark || document.readyState === 'complete';@@ -179,23 +224,54 @@islandSettled = true;setToggleVisible(islandCache === false);};+ // Every probe flips the theme attribute and reads a computed style, which+ // forces a style recalc of the whole document, twice. Reacting to any DOM+ // mutation made that a recalc storm on pages that render their content+ // with JS: /marketplace spent 8.7s of main-thread time in bodyIsDark()+ // alone before Lighthouse gave up on the page. Only a stylesheet can+ // change the verdict, so only a stylesheet node (a <link rel=stylesheet>+ // finishing its load, or a <style> element landing or leaving) re-probes,+ // and a burst of them costs one probe per frame.+ var probeQueued = false;var onSheet = function () {- if (reprobeCapability()) stopWatching();+ if (probeQueued || (!sheetWatch && islandSettled)) return;+ probeQueued = true;+ var run = function () {+ probeQueued = false;+ if (reprobeCapability()) stopWatching();+ };+ if (typeof requestAnimationFrame === 'function') requestAnimationFrame(run);+ else setTimeout(run, 16);+ };+ var isSheetNode = function (node) {+ if (!node || node.nodeType !== 1 || isProbeNode(node)) return false;+ if (node.tagName === 'STYLE') return true;+ return node.tagName === 'LINK' && node.rel === 'stylesheet';};var watchLink = function (node) {if (!node || node.tagName !== 'LINK' || node.rel !== 'stylesheet') return;node.addEventListener('load', onSheet);};- for (var i = 0; i < document.styleSheets.length; i++) onSheet();+ if (document.styleSheets.length) onSheet();var links = document.querySelectorAll('link[rel="stylesheet"]');for (var j = 0; j < links.length; j++) watchLink(links[j]);if (window.MutationObserver && islandCache !== false) {sheetWatch = new MutationObserver(function (records) {+ var relevant = false;for (var r = 0; r < records.length; r++) {var added = records[r].addedNodes;- for (var n = 0; n < added.length; n++) watchLink(added[n]);+ var removed = records[r].removedNodes;+ for (var n = 0; n < added.length; n++) {+ watchLink(added[n]);+ // A <link> re-probes from its load event, once its sheet+ // (and that sheet's @imports) can actually answer.+ if (added[n].tagName === 'STYLE' && isSheetNode(added[n])) relevant = true;+ }+ for (var m = 0; m < removed.length; m++) {+ if (isSheetNode(removed[m])) relevant = true;+ }}- onSheet();+ if (relevant) onSheet();});sheetWatch.observe(document.documentElement, { childList: true, subtree: true });}diff --git a/tests/e2e/a11y-top-pages.spec.js b/tests/e2e/a11y-top-pages.spec.jsindex 0f230fe1a..a8bee5b8d 100644--- a/tests/e2e/a11y-top-pages.spec.js+++ b/tests/e2e/a11y-top-pages.spec.js@@ -45,6 +45,28 @@ const auditPages = [...top30, ...extraPages];// Keep this list short and named — it is an exception ledger, not a bypass.const KNOWN_EXCEPTIONS = new Set([]);+// axe measures whatever frame it lands on. Feeds that stagger their rows in+// (src/ui-juice.js enterStagger: opacity 0 to 1 over --duration-base, up to+// 320ms of per-row delay, starting whenever the fetch resolves) can still be+// mid-fade at the 500ms mark, and axe blends a half-opaque row's ink into+// the background and reports the resting-state-correct text as a contrast+// failure: /agi flaked on rows 5 to 8 this way. Waiting for every FINITE+// animation and transition to finish measures the page a user actually+// reads. Infinite loops (pulses, shimmers, marquee floors) are skipped, and+// the whole wait is capped so a runaway effect can never stall the gate;+// the axe assertion itself is untouched.+async function settleFiniteAnimations(page, capMs = 5_000) {+ await page.evaluate(async (cap) => {+ const finite = document.getAnimations().filter((a) => {+ const timing = a.effect && typeof a.effect.getTiming === 'function' ? a.effect.getTiming() : null;+ return a.playState !== 'finished' && !!timing && Number.isFinite(timing.iterations);+ });+ if (finite.length === 0) return;+ const settled = Promise.all(finite.map((a) => a.finished.catch(() => undefined)));+ await Promise.race([settled, new Promise((resolve) => setTimeout(resolve, cap))]);+ }, capMs);+}+for (const { path } of auditPages) {test(`a11y floor: ${path}`, async ({ page }) => {if (KNOWN_EXCEPTIONS.has(path)) test.skip();@@ -58,6 +80,7 @@ for (const { path } of auditPages) {// deciding the verdict, and still leaves 120s for the axe pass itself.await page.goto(path, { waitUntil: 'domcontentloaded', timeout: 180_000 });await page.waitForTimeout(500); // let above-the-fold async content settle+ await settleFiniteAnimations(page);const results = await new AxeBuilder({ page }).withTags(['wcag2a', 'wcag2aa', 'wcag21aa'])diff --git a/tests/theme-switcher-capability.test.js b/tests/theme-switcher-capability.test.jsindex 653d0c506..6f4e5d620 100644--- a/tests/theme-switcher-capability.test.js+++ b/tests/theme-switcher-capability.test.js@@ -103,6 +103,44 @@ describe('theme switcher light-capability probe', () => {expect(document.documentElement.getAttribute('data-theme')).toBe('light');});+ it('suspends colour transitions for the whole probe and leaves nothing behind', () => {+ // The probe flips data-theme to light and back inside one JS turn. Without+ // a transition suspension the forced recalc arms a colour transition that+ // starts FROM the light palette on every element with a `transition:+ // color` (the shared nav), and the sheet watch re-arms it on each DOM+ // mutation, so the nav sat at the light grey over the dark bar (3:1) for+ // seconds on a cold load. jsdom has no adoptedStyleSheets, so this drives+ // the <style> fallback: the suspension must be in place at the moment the+ // body is read, and gone once the probe returns.+ let suspendedDuringRead = null;+ bodyBg = () => {+ suspendedDuringRead = document.querySelector('style[data-twx-theme-probe]') !== null;+ return 'rgb(255, 255, 255)';+ };+ boot();+ expect(window.threeTheme.supportsLight()).toBe(true);+ expect(suspendedDuringRead).toBe(true);+ expect(document.querySelector('style[data-twx-theme-probe]')).toBeNull();+ expect(document.documentElement.getAttribute('data-theme')).toBe('light');+ });++ it('does not let its own probe stylesheet re-trigger the sheet watch', async () => {+ // A dark island keeps a MutationObserver alive to re-probe when a sheet+ // lands. The probe's fallback <style> is itself a childList mutation; if+ // the watch reacted to it, every probe would schedule another probe and+ // the page would never stop re-probing.+ let probes = 0;+ bodyBg = () => {+ probes += 1;+ return 'rgb(0, 0, 0)';+ };+ boot();+ const afterBoot = probes;+ await new Promise((resolve) => setTimeout(resolve, 20));+ expect(probes).toBe(afterBoot);+ expect(document.documentElement.getAttribute('data-theme')).toBe('dark');+ });+it('still honours an explicit dark preference on a light-capable page', () => {localStorage.setItem('twx_theme', 'dark');bodyBg = () => 'rgb(255, 255, 255)';