Skip to content

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.

fix(audit): derive the authed sweep routes from the route table so consolidated pages stop being audited as empty redirects

nirholasd726e021efad
diff --git a/prompts/finish/swarm-100-sweep-console.md b/prompts/finish/swarm-100-sweep-console.md
index ae322a13b..2382510a2 100644
--- a/prompts/finish/swarm-100-sweep-console.md
+++ b/prompts/finish/swarm-100-sweep-console.md
@@ -57,6 +57,16 @@ sweep those reads are cross-origin and refused; on the origin the page is
actually served from they are same-origin. Do not "fix" it by making those
relative, which is what breaks the IBM-hosted copy.
+Four routes carried warnings rather than errors. Three are closed; the fourth is
+a production configuration gap that no page edit can close:
+
+| Route | Warning | Disposition |
+|---|---|---|
+| `/play/war` | Two assets "preloaded but not used" | **Fixed.** `src/play/war.js` returns early with "No battle to join" when the link carries no pairing, so a static `<link rel=preload>` in the head downloaded a manifest and an avatar the page never read. `pages/play/war.html` now injects the two preloads from the head only when `match`, `ticket` and `coin` are all present, which keeps the head start on the real path and emits nothing on the dead one. `/play/arena` keeps its static pair because it always loads both, which is why it never warned. |
+| `/create/selfie` | `gl_context.cc:1118] OpenGL error checking is disabled` | **Filtered.** MediaPipe's native logger, glog-formatted, written by the C++ library with no JS frame of ours in it and no verbosity control on the JS API. Added to `scripts/lib/console-noise.mjs` beside the other headless-GL driver lines. |
+| `/avatar-sdk` | `RGBELoader has been deprecated. Please use HDRLoader instead.` | **Intentional, documented.** `avatar-sdk/src/viewer.js` explains it: the SDK's peer range is `three >= 0.150.0`, `HDRLoader.js` does not exist before r180, and a bundler resolves the literal dynamic import statically, so renaming trades one cosmetic console line on new `three` for a hard "module not found" build failure for every consumer on older `three`. Revisit when the peer floor moves to `>= 0.180.0`. |
+| `/clash` | `clash: CoinCommunities unconfigured, polling stopped` | **Not a code defect: one missing credential.** `CC_API_KEY` is absent from `.env`, `.env.local` and the `three-ws-api` service (`node scripts/read-service-env.mjs '^CC_API_KEY$' --names` finds no match), and production's `/api/clash/state` answers `503 cc_unconfigured` for the same reason. The page is fully wired behind the var and degrades as designed: one request per page view, poll cancelled, the designed unavailable state on both tabs. The warning names a real operational gap and stays. Supplying `CC_API_KEY` is the fix, and it is the owner's. |
+
## Step 0: re-derive the current state
npm run audit:console
diff --git a/scripts/lib/audit-routes.mjs b/scripts/lib/audit-routes.mjs
index 192483c14..d4c300f10 100644
--- a/scripts/lib/audit-routes.mjs
+++ b/scripts/lib/audit-routes.mjs
@@ -61,29 +61,41 @@ export function manifestRoutes(opts) {
return manifestPages(opts).map((p) => p.path);
}
-// Authenticated routes the manifest omits: dashboard sub-pages and account
-// surfaces that are product, not marketing, so they never belonged in the
-// public page index. A sweep with a session replays these too.
-export const AUTHED_ROUTES = [
- '/dashboard',
- '/dashboard/actions',
- '/dashboard/sessions',
- '/dashboard/wallets',
- '/dashboard/settings',
- '/dashboard/memory',
- '/dashboard/strategy',
- '/dashboard/voice',
- '/dashboard/sns',
- '/dashboard/delegation',
- '/dashboard/embed-policy',
- '/dashboard/agent-pumpfun',
- '/dashboard/x402',
- '/dashboard/portfolio',
- '/profile',
- '/settings',
- '/my-agents',
- '/dashboard/developers',
-];
+// Authenticated surfaces the public manifest omits: dashboard sub-pages and
+// account routes that are product, not marketing, so they never belonged in
+// the public page index. A sweep with a session replays these too.
+//
+// The dashboard's own route table in vercel.json is the source of truth for
+// which of them exist, because a hand-kept copy goes stale silently. By
+// 2026-09-04 ten of the eighteen hardcoded entries had become 301 stubs
+// pointing at consolidated pages (the sweep was auditing empty redirects) and
+// twenty-one live dashboard pages had never been audited under a session at
+// all. Reading the table means a page added or consolidated there is picked
+// up by the next sweep with no second edit.
+const AUTHED_PREFIX = /^\/dashboard\//;
+
+// Account surfaces that live outside the dashboard route block.
+const STANDALONE_AUTHED_ROUTES = ['/profile', '/settings', '/my-agents'];
+
+/** Concrete (non-pattern, non-redirect) dashboard pages from the route table. */
+function dashboardRoutes() {
+ const config = JSON.parse(readFileSync(resolve(ROOT, 'vercel.json'), 'utf8'));
+ const out = [];
+ for (const route of config.routes || []) {
+ const src = route.src;
+ if (typeof src !== 'string' || !AUTHED_PREFIX.test(src)) continue;
+ // A redirect stub has no page of its own; its destination is audited instead.
+ if (route.status || route.headers?.Location || !route.dest) continue;
+ const path = src.replace(/\/\?$/, '').replace(/(.)\/$/, '$1');
+ // Capture groups and character classes are patterns, not addressable routes.
+ if (/[()[\]*+|^$\\?]/.test(path)) continue;
+ if (!isHtmlRoute(path)) continue;
+ out.push(path);
+ }
+ return out;
+}
+
+export const AUTHED_ROUTES = [...new Set([...dashboardRoutes(), ...STANDALONE_AUTHED_ROUTES])].sort();
/**
* Parameterised routes filled with real ids from the live API.
diff --git a/scripts/lib/console-noise.mjs b/scripts/lib/console-noise.mjs
index eed9080bf..93811e6d1 100644
--- a/scripts/lib/console-noise.mjs
+++ b/scripts/lib/console-noise.mjs
@@ -65,6 +65,11 @@ export const IGNORE_CONSOLE = [
// Emitted by the driver, never by our code, and absent on real GPUs.
/GL Driver Message/i,
/GPU stall due to ReadPixels/i,
+ // MediaPipe's native (WASM) logger narrating its own GL setup on /create/selfie
+ // and the other vision surfaces: glog-formatted lines the C++ library writes
+ // directly, with no JS frame of ours anywhere in them. The verbosity is not
+ // reachable from the JS API, so there is nothing on our side to turn down.
+ /\bgl_context\.cc:\d+\]/i,
// Content-Security-Policy noise from third-party embeds
/content security policy/i,
/Refused to (load|connect|execute|frame)/i,
diff --git a/scripts/page-audit.mjs b/scripts/page-audit.mjs
index 87be5714d..b627b6025 100644
--- a/scripts/page-audit.mjs
+++ b/scripts/page-audit.mjs
@@ -127,6 +127,15 @@ const LOCAL_ONLY_IGNORE = [
/esm\.sh/,
/ajax\.googleapis\.com/,
/\/node_modules\/vite\/dist\/client\/env\.mjs/,
+ // Vite's HMR client dials a websocket at the page's own host. On a plain
+ // laptop that connects; inside a Codespace the page is served over a
+ // forwarded https origin whose wss upgrade answers 404, so every locally
+ // audited page reports the same three errors (the handshake, Vite's own
+ // retry log, and the uncaught close) before a single line of page code
+ // runs. Hot reload is a dev-server feature that production does not ship,
+ // so its failure says nothing about the page.
+ /\[vite\] failed to connect to websocket/,
+ /WebSocket (connection to '[^']*' failed|closed without opened)/,
/Unexpected token .+, .<!doctype /,
/Expected a JavaScript-or-Wasm module script but the server responded with a MIME type of "text\/html"/,
];
diff --git a/tests/audit-routes.test.js b/tests/audit-routes.test.js
new file mode 100644
index 000000000..0e248c509
--- /dev/null
+++ b/tests/audit-routes.test.js
@@ -0,0 +1,67 @@
+// Unit tests for scripts/lib/audit-routes.mjs, the single route list every
+// browser sweep works from.
+//
+// AUTHED_ROUTES used to be a hand-kept array, and it went stale without any
+// signal: by 2026-09-04 ten of its eighteen entries had become 301 stubs
+// pointing at consolidated dashboard pages, so the authenticated sweep spent
+// a third of its budget auditing empty redirects while twenty-one live
+// dashboard pages were never audited under a session at all. It is now
+// derived from the vercel.json route table, and these tests hold that
+// derivation to the properties that made the drift invisible.
+
+import { describe, it, expect } from 'vitest';
+import { readFileSync } from 'node:fs';
+import { resolve, dirname } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+import { AUTHED_ROUTES, isHtmlRoute } from '../scripts/lib/audit-routes.mjs';
+
+const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
+const routeTable = JSON.parse(readFileSync(resolve(ROOT, 'vercel.json'), 'utf8')).routes;
+
+/** Route-table entries that answer a request with a Location redirect. */
+const redirectSources = new Set(
+ routeTable
+ .filter((r) => typeof r.src === 'string' && (r.status || r.headers?.Location))
+ .map((r) => r.src.replace(/\/\?$/, '')),
+);
+
+describe('AUTHED_ROUTES', () => {
+ it('is a non-empty, deduped, sorted list of absolute paths', () => {
+ expect(AUTHED_ROUTES.length).toBeGreaterThan(0);
+ expect(new Set(AUTHED_ROUTES).size).toBe(AUTHED_ROUTES.length);
+ expect([...AUTHED_ROUTES].sort()).toEqual(AUTHED_ROUTES);
+ for (const path of AUTHED_ROUTES) expect(path.startsWith('/')).toBe(true);
+ });
+
+ it('holds no redirect stub: a 301 has no DOM worth auditing', () => {
+ const stubs = AUTHED_ROUTES.filter((path) => redirectSources.has(path));
+ expect(stubs).toEqual([]);
+ });
+
+ it('holds no route pattern, only concrete addressable paths', () => {
+ for (const path of AUTHED_ROUTES) {
+ expect(path).not.toMatch(/[()[\]*+|^$\\?]/);
+ expect(path).not.toMatch(/\/$/);
+ }
+ });
+
+ it('holds only routes an HTML sweep can render', () => {
+ for (const path of AUTHED_ROUTES) expect(isHtmlRoute(path)).toBe(true);
+ });
+
+ it('covers every concrete dashboard page the route table serves', () => {
+ const served = routeTable
+ .filter((r) => typeof r.src === 'string' && r.dest && !r.status && !r.headers?.Location)
+ .map((r) => r.src.replace(/\/\?$/, ''))
+ .filter((src) => src.startsWith('/dashboard/') && !/[()[\]*+|^$\\?]/.test(src));
+ expect(served.length).toBeGreaterThan(0);
+ for (const path of served) expect(AUTHED_ROUTES).toContain(path);
+ });
+
+ it('carries the account surfaces that live outside the dashboard block', () => {
+ for (const path of ['/profile', '/settings', '/my-agents']) {
+ expect(AUTHED_ROUTES).toContain(path);
+ }
+ });
+});