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(extension): re-mount the walk avatar after a full page navigation
nirholas19e014d34c57
diff --git a/data/changelog.json b/data/changelog.jsonindex 3f95199a7..c301caa0a 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,33 @@{"$comment": "Curated changelog entries for three.ws, the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-08-13",+ "title": "Rate ceilings on stud listings and inscription status polls",+ "summary": "Two more endpoints joined the platform rate limiter. Listing or unlisting an agent on the stud market is now capped, so a scripted flood cannot churn the market ordering, and the anonymous Bitcoin inscription status poll is capped at a level that still lets a long inscription wait clear across a couple of open tabs. Both ceilings are deliberately non-critical: if the limiter's backing store is ever down, an owner can still unlist their agent and a paying user's status screen keeps working.",+ "tags": [+ "improvement",+ "security"+ ]+ },+ {+ "date": "2026-08-13",+ "title": "Launchpad paid pages now describe themselves correctly to paying agents",+ "summary": "When an agent reaches a paid Launchpad page (a pay-per-question concierge or a gated showroom unlock) without payment, the 402 challenge it receives now carries that page type's own bazaar discovery document: the exact field to send, the shape of the answer that comes back, and a worked example. Before, the challenge fell back to a generic entry that told crawlers to send a model-validation body, so an agent that indexed a concierge page from discovery would never send the one field it actually needs. An agent can now go from discovery to a settled paid call using nothing but the challenge itself.",+ "tags": [+ "improvement"+ ],+ "link": "/launchpad"+ },+ {+ "date": "2026-08-13",+ "title": "An API key can no longer be minted with zero scopes",+ "summary": "Sending an explicitly empty scope list to the key-minting endpoint used to succeed and issue a credential that could never pass a permission check: the key looked fine, then failed every call with nothing explaining why. The dashboard already refused an empty selection; the raw API now enforces the same rule for every other client and answers with a clear error instead of minting a dead key. Repeated scopes in one request are also deduplicated, so the grants shown on a key are listed once each.",+ "tags": [+ "fix"+ ],+ "link": "/docs/api-reference"+ },{"date": "2026-08-13","title": "Every tutorial page now names itself, its in-page links work, and the free-3D tutorials match the engine that actually runs",@@ -791,6 +818,80 @@],"link": "/docs/farcaster-memory-seeding"},+ {+ "date": "2026-08-11",+ "title": "The repository guards reference now covers every local guard",+ "summary": "With no CI on this repository, every protection runs locally, and the guards reference page now names each local guard, what it protects, and at which stage it runs. The page is itself guarded: an audit script checks it against the guard registry on every gate run, so the list and its stage column cannot quietly go stale.",+ "tags": [+ "docs"+ ],+ "link": "/docs/guards"+ },+ {+ "date": "2026-08-11",+ "title": "The notification tray no longer overlaps the header on narrow screens",+ "summary": "On narrow widths the notification tray could open on top of the page header, covering the navigation it hangs from. The tray now keeps below the header at every width, across every page that carries it.",+ "tags": [+ "fix"+ ],+ "link": "/notifications"+ },+ {+ "date": "2026-08-11",+ "title": "The AgenC SDK now exports the AgenCError its README promises",+ "summary": "The package README documents rejections as a typed AgenCError with a .code, but the SDK only exported the class under another name, so the documented catch never matched anything. The same class is now exported under both names as an alias, in the runtime and in the TypeScript definitions, and the test suite asserts a thrown error is an instance of each. Code written from the README now works as written.",+ "tags": [+ "sdk",+ "fix"+ ],+ "link": "/docs/agenc"+ },+ {+ "date": "2026-08-11",+ "title": "The per-counterparty spending cap now binds capability-authorized spends too",+ "summary": "A capability-authorized spend takes its own reserve path, and the per-counterparty ceiling was only checked on the ordinary one, so a spend authorized through a capability simply did not have that cap. The counterparty ceiling is now part of the same single check-and-reserve statement on both paths, and a rejection names which cap caught it, so an owner is no longer told to wait out a daily window they never hit when the real cause is a concentrated payee.",+ "tags": [+ "security"+ ],+ "link": "/docs/agent-wallet-api"+ },+ {+ "date": "2026-08-11",+ "title": "Disconnecting X now deletes the memories it seeded",+ "summary": "Unlinking your X account used to leave the distilled posts sitting on the agent, which made the consent screen a lie. Disconnect now revokes every seeding grant the link authorized, deletes the memories those grants produced, and reports both counts back. The Farcaster seeding client also loads its vendor SDK lazily, so the keyless hub lane starts even where that package is missing.",+ "tags": [+ "fix",+ "security"+ ],+ "link": "/docs/x-memory-seeding"+ },+ {+ "date": "2026-08-11",+ "title": "Forge stops promising a rig it cannot deliver",+ "summary": "When no rig worker is configured, the Forge still reported rerig as supported, so every rerig submit failed against a service with no rig endpoint and the reconstruction silently came back unrigged. Rerig support is now resolved from the rig worker's own address alone, so it is honestly unsupported when that worker is absent and the finalize step skips the rig chain cleanly. Rig failures also carry the worker's real error taxonomy, so the status endpoint can tell you what went wrong instead of an opaque id.",+ "tags": [+ "fix"+ ],+ "link": "/forge"+ },+ {+ "date": "2026-08-11",+ "title": "Add funds can now fund a SOL-spending wallet with SOL",+ "summary": "The Add funds overlay could only ever buy USDC, because the onramp link endpoint had the asset hardcoded. A wallet that pays in native SOL ended up funded with a token it cannot spend. The onramp now takes the asset (USDC or SOL, both settling on Solana), maps each to its own Coinbase Pay ticker and fallback buy page, and the overlay switches its copy, the asset it buys, and the balance it polls together, so a wallet can no longer be funded with the wrong asset.",+ "tags": [+ "feature"+ ],+ "link": "/wallet"+ },+ {+ "date": "2026-08-11",+ "title": "The status page shows the agent index's freshness as numbers, not prose",+ "summary": "The agent-index subsystem on the status page now publishes structured freshness metrics as pills beside its sentence: the median Solana indexing lag, how many Solana agents are indexed, the EVM indexing lag, and the total events indexed. A reader can now see at a glance how far behind the on-chain index is, instead of parsing a figure buried in the detail line.",+ "tags": [+ "improvement"+ ],+ "link": "/status"+ },{"date": "2026-08-11","title": "The standalone avatar viewer is now embeddable in one click, and never leaves you on a blank screen",@@ -3221,6 +3322,15 @@],"link": "/mcp-tools"},+ {+ "date": "2026-07-30",+ "title": "The docs world recovers from 3D failures instead of stranding you",+ "summary": "Three failure paths in the walkable documentation world are now recoverable. When the 3D scene failed to start, the fallback panel focused its retry button while the panel was still hidden, so the recovery action was unreachable without hunting for it; the panel now reveals first, then focuses. Both catch-all error handlers showed a bare fallback with no way back, even though the usual cause (a browser tab that has run out of WebGL contexts) is cleared by a reload; both now explain what happened and offer the reload. And a character whose idle animation failed to load was frozen in a T-pose forever; the player now only records a clip as current once it actually plays, and relaxes undriven arms so unmapped rigs rest naturally.",+ "tags": [+ "fix"+ ],+ "link": "/docs/docs-world"+ },{"date": "2026-07-30","title": "Your agent's gestures now work, and you can choose them",@@ -20769,6 +20879,23 @@"security"],"link": "/forge"+ },+ {+ "date": "2026-08-13",+ "title": "Screen caster: stopping your caster no longer posts a phantom error",+ "summary": "The self-hosted agent-screen-caster service (the one that gives your agent a live, watchable browser screen) used to push a scary \"Task error\" line into your agent's public activity log every time you stopped it with Ctrl-C, because the shutdown looked like a crash from the inside. Stopping the caster is now recognised as a clean shutdown and leaves the log untouched, so watchers only ever see real errors. The whole path was re-verified end to end against production: key minting from the dashboard flow, live JPEG frames on the watch stream, and the retry policy that keeps a long-running caster alive through rate limits and server blips.",+ "tags": [+ "fix"+ ]+ },+ {+ "date": "2026-08-13",+ "title": "The free inference-receipt verifier is now in the public x402 catalog",+ "summary": "/api/x402/inference-verify audits a metered-inference receipt from a paid llm-proxy call: it re-checks the issuer signature, the node's response signature, the prompt and response hashes against the raw text you supply, whether the settlement transaction actually confirmed on-chain, and whether the issuer is one of the platform's published signers. It is free and keyless, but it was missing from docs/x402-endpoints.md, so buyers and node operators had no way to find it. It now has a row in the free read surfaces table alongside the other verifier tools.",+ "tags": [+ "docs"+ ],+ "link": "/docs/x402-endpoints"}]}diff --git a/docs/x402-endpoints.md b/docs/x402-endpoints.mdindex ff871b30a..89e157655 100644--- a/docs/x402-endpoints.md+++ b/docs/x402-endpoints.md@@ -271,6 +271,7 @@ directory.| `/api/x402/echo` | free | httpbin for x402 — decodes your `X-PAYMENT` header (signatures redacted) and returns a local verify verdict without settling. See [x402 dev tools](x402-dev-tools.md). || `/api/x402/debug` | free | Diagnoses a failed 402 exchange (`{challenge, payment, response}`) into an ordered `{severity, field, problem, fix}` list. See [x402 dev tools](x402-dev-tools.md). || `/api/x402/verify-receipt` | free | Recomputes a paid response's SHA-256 attestation and confirms a settlement tx on-chain. See [x402 dev tools](x402-dev-tools.md). |+| `/api/x402/inference-verify` | free | Audits a metered-inference receipt from a paid `llm-proxy` call: per-check verdicts for the issuer signature, the node's response signature, prompt/response hash re-derivation from raw text, on-chain settlement confirmation, and whether the issuer matches the platform's published signers. See [Run an inference node](inference-node-operator.md). |## $THREE onlydiff --git a/extensions/walk-avatar/README.md b/extensions/walk-avatar/README.mdindex 08cee35a5..8e9bc81a3 100644--- a/extensions/walk-avatar/README.md+++ b/extensions/walk-avatar/README.md@@ -1,6 +1,6 @@-# three.ws Walk Avatar — Chrome Extension+# three.ws Walk Avatar (Chrome Extension)-Walk your three.ws avatar on any website you visit.+Walk your three.ws avatar on any website you visit, with optional page narration.## Install (development / load-unpacked)@@ -18,9 +18,10 @@ Walk your three.ws avatar on any website you visit.- Click the extension icon in the toolbar to open the popup- Sign in with your three.ws account to access your avatars- Select an avatar and toggle "Enable on this site"-- The avatar appears floating in the corner of the page-- Drag the handle at the top of the avatar container to reposition it-- Click × to close on a specific page without disabling the extension+- The avatar appears floating in the corner of the page and re-mounts automatically after full page loads on tabs where you enabled it+- Hover the avatar and drag the handle at the top to reposition it+- Click the speaker button to mute narration, or the close button to hide the avatar on that page without disabling the extension+- Open the options page (right-click the icon, then Options) for position, size, speed, theme, narration voice, and per-site allow/blocklists## Build for Web Store@@ -28,30 +29,46 @@ Walk your three.ws avatar on any website you visit.npm run build:extension:prod```-Outputs `dist/extension-<version>.zip` ready to upload to the Chrome Web Store.+Outputs a minified build plus `dist/extension-<version>.zip` (version stamped from the root `package.json`) ready to upload to the Chrome Web Store. The full submission checklist lives in [RELEASE.md](RELEASE.md).## Structure```extensions/walk-avatar/-├── manifest.json — Manifest V3 config-├── background.js — Service worker: state, auth, message relay-├── content.js — Content script: avatar iframe injection-├── popup.html/.js — Extension popup: avatar picker + toggle-├── options.html/.js — Settings page (opens from extension details)-└── icons/ — Generated from public/pwa-icon.svg+├── manifest.json Manifest V3 config+├── background.js Service worker: settings, auth capture, injection, tab re-mount+├── content.js Content script: avatar iframe mount, drag, toolbar+├── content-narrator.js Page-section narrator (TTS via three.ws)+├── vendor/readability.js Vendored Readability for article extraction+├── popup.html/.js/.css Extension popup: avatar picker + per-tab toggle+├── options.html/.js Full settings page+├── icons/ Generated by scripts/build-extension-icons.mjs+├── store-assets/ Chrome Web Store listing images+├── PERMISSIONS.md Per-permission justifications for store review+├── PRIVACY.md Privacy policy source (live at three.ws/extension/privacy)+├── TERMS.md Terms source (live at three.ws/extension/terms)+└── RELEASE.md Web Store release checklist```+The build is `scripts/build-extension.mjs` (esbuild): `background.js` bundles as an ESM service worker, everything else as self-contained IIFEs, and static files (manifest, HTML, CSS, icons, vendor) are copied alongside. Output lands in `dist/extension/`.+## Permissions-- `storage` — stores avatar selection and settings-- `activeTab` — reads current tab URL for site label display-- `scripting` — injects content.js into tabs when user enables the avatar-- `host_permissions: <all_urls>` — required to inject into any site the user visits+- `storage`: stores avatar selection, settings, and the session token+- `activeTab`: reads the current tab URL for the site label in the popup+- `tabs`: re-mounts the avatar after full page loads on enabled tabs, relays live setting changes, and opens sign-in/create pages+- `scripting`: injects the content scripts when the user enables the avatar+- `host_permissions: <all_urls>`: required to inject into any site the user chooses++Full store-review justifications: [PERMISSIONS.md](PERMISSIONS.md).## Privacy-User data stays on-device in `chrome.storage`. The only outbound requests are:-- `GET three.ws/api/avatars/*` — fetch avatar list and GLB URLs (requires sign-in for private avatars)-- `GET three.ws/api/tts/speak` — only when narration is explicitly enabled-- The avatar iframe itself connects to `three.ws` to render the 3D scene+User data stays on-device in `chrome.storage`. The only outbound requests, all to `three.ws`:++- `GET /api/avatars/mine`, `GET /api/avatars/featured`, `GET /api/avatars` and thumbnails: avatar lists for the pickers (sign-in required for private avatars)+- `GET /api/tts/voices`: the narration voice catalog shown in options+- `POST /api/tts/speak`: synthesizes narration audio, only when narration is explicitly enabled+- The avatar iframe itself loads `three.ws/walk-embed` to render the 3D scene++Policy source files: [PRIVACY.md](PRIVACY.md), [TERMS.md](TERMS.md).diff --git a/extensions/walk-avatar/background.js b/extensions/walk-avatar/background.jsindex 1d02aa322..b3aa917e9 100644--- a/extensions/walk-avatar/background.js+++ b/extensions/walk-avatar/background.js@@ -181,6 +181,36 @@ function broadcast(message) {});}+// ── Re-mount after full page loads ──────────────────────────────────────────+// The popup records per-tab enable state in chrome.storage.session+// (tab_enabled_<tabId>). A full navigation wipes the content scripts, so when+// an enabled tab finishes loading, re-inject and re-mount the avatar. The+// allow/blocklist is re-evaluated against the new URL, so navigating an+// enabled tab onto a filtered site keeps the avatar off it.+chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {+ if (changeInfo.status !== 'complete' || !tab.url) return;+ if (!/^https?:/i.test(tab.url)) return;+ if (tab.url.startsWith(THREEWS_ORIGIN + '/extension/auth-callback')) return;++ const key = `tab_enabled_${tabId}`;+ chrome.storage.session.get(key).then(async (stored) => {+ if (!stored[key]) return;+ const settings = await getSettings();+ if (!siteAllowed(tab.url, settings)) return;+ await injectContent(tabId);+ await chrome.tabs.sendMessage(tabId, {+ type: 'walk:mount',+ avatarId: settings.avatarId,+ }).catch(() => {});+ }).catch(() => {});+});++// Drop the per-tab enable flag once its tab is gone, so session storage never+// accumulates keys for closed tabs.+chrome.tabs.onRemoved.addListener((tabId) => {+ chrome.storage.session.remove(`tab_enabled_${tabId}`).catch(() => {});+});+// ── Auth callback capture ─────────────────────────────────────────────────────// The popup opens three.ws/login?next=/extension/auth-callback. After a// successful sign-in the site lands on /extension/auth-callback, which mints adiff --git a/extensions/walk-avatar/icons/icon-16.png b/extensions/walk-avatar/icons/icon-16.pngindex 850d28de1..6a1a68606 100644Binary files a/extensions/walk-avatar/icons/icon-16.png and b/extensions/walk-avatar/icons/icon-16.png differdiff --git a/extensions/walk-avatar/icons/icon-32.png b/extensions/walk-avatar/icons/icon-32.pngindex b5878dcd2..89d70f744 100644Binary files a/extensions/walk-avatar/icons/icon-32.png and b/extensions/walk-avatar/icons/icon-32.png differdiff --git a/extensions/walk-avatar/icons/icon-48.png b/extensions/walk-avatar/icons/icon-48.pngindex 3789be601..72e2317c9 100644Binary files a/extensions/walk-avatar/icons/icon-48.png and b/extensions/walk-avatar/icons/icon-48.png differdiff --git a/extensions/walk-avatar/manifest.json b/extensions/walk-avatar/manifest.jsonindex 2343f5837..342904b80 100644--- a/extensions/walk-avatar/manifest.json+++ b/extensions/walk-avatar/manifest.json@@ -3,7 +3,7 @@"name": "three.ws Walk Avatar","short_name": "Walk Avatar","version": "1.0.0",- "description": "Walk your three.ws avatar on any site and have it read pages aloud — a living 3D browsing companion.",+ "description": "Walk your three.ws avatar on any site and have it read pages aloud: a living 3D browsing companion.","homepage_url": "https://three.ws/extension","icons": {diff --git a/extensions/walk-avatar/options.js b/extensions/walk-avatar/options.jsindex 1aca239f9..159594000 100644--- a/extensions/walk-avatar/options.js+++ b/extensions/walk-avatar/options.js@@ -94,7 +94,7 @@ async function loadVoices() {for (const v of voices) {const opt = document.createElement('option');opt.value = v.id;- opt.textContent = v.name + (v.description ? ` — ${v.description}` : '');+ opt.textContent = v.name + (v.description ? ` · ${v.description}` : '');select.appendChild(opt);}select.value = state.settings.voice || data.default || voices[0].id;@@ -244,7 +244,7 @@ async function renderDiagnostics() {if (!state.session) {sessionEl.textContent = 'not signed in';sessionEl.className = 'diag-value offline';- accountEl.textContent = '—';+ accountEl.textContent = 'none';signOutBtn.classList.add('hidden');return;}diff --git a/extensions/walk-avatar/popup.js b/extensions/walk-avatar/popup.jsindex c98ce2371..750197101 100644--- a/extensions/walk-avatar/popup.js+++ b/extensions/walk-avatar/popup.js@@ -144,7 +144,7 @@ function renderEmpty(gridEl, tab) {function renderError(gridEl, errorEl, tab, message) {gridEl.innerHTML = '';errorEl.innerHTML = `- <span class="err-text">Couldn't load avatars — ${message}</span>+ <span class="err-text">Couldn't load avatars: ${message}</span><button class="retry-btn" id="retry-${tab}">Retry</button>`;errorEl.style.display = 'flex';errorEl.querySelector(`#retry-${tab}`)?.addEventListener('click', () => loadAvatars(tab));diff --git a/scripts/build-extension.mjs b/scripts/build-extension.mjsindex e099a1d1c..12c9a586f 100644--- a/scripts/build-extension.mjs+++ b/scripts/build-extension.mjs@@ -16,31 +16,26 @@ const isProd = process.argv.includes('--prod');rmSync(out, { recursive: true, force: true });mkdirSync(out, { recursive: true });mkdirSync(join(out, 'icons'), { recursive: true });-mkdirSync(join(out, 'styles'), { recursive: true });// Bundle JS files. background.js is an ESM service worker; everything else is a-// self-contained IIFE. Classic content scripts (content-narrator, content-pilot,-// content) are injected in order via chrome.scripting before content.js — each-// publishes a window global and is NOT imported by content.js, so esbuild must-// emit them separately or chrome.scripting.executeScript fails on a missing file.-// Optional entrypoints (those still being authored) are skipped with a warning-// rather than failing the whole build.+// self-contained IIFE. content-narrator.js is a classic content script injected+// via chrome.scripting before content.js: it publishes a window global and is+// NOT imported by content.js, so esbuild must emit the two separately or+// chrome.scripting.executeScript fails on a missing file.const ENTRYPOINTS = [{ file: 'background.js', format: 'esm', external: [] },{ file: 'content.js', format: 'iife', external: ['chrome'] },{ file: 'content-narrator.js', format: 'iife', external: ['chrome'] },- { file: 'content-pilot.js', format: 'iife', external: ['chrome'], optional: true },{ file: 'popup.js', format: 'iife', external: ['chrome'] },{ file: 'options.js', format: 'iife', external: ['chrome'] },];await Promise.all(- ENTRYPOINTS.filter((e) => {- if (existsSync(join(src, e.file))) return true;- if (e.optional) { console.warn(`⚠ skipping ${e.file} (not present yet)`); return false; }- throw new Error(`missing required extension entrypoint: ${e.file}`);- }).map((e) =>- build({+ ENTRYPOINTS.map((e) => {+ if (!existsSync(join(src, e.file))) {+ throw new Error(`missing required extension entrypoint: ${e.file}`);+ }+ return build({entryPoints: [join(src, e.file)],outfile: join(out, e.file),bundle: true,@@ -50,8 +45,8 @@ await Promise.all(sourcemap: !isProd,target: 'chrome109',external: e.external,- }),- ),+ });+ }),);// Copy static files@@ -69,9 +64,6 @@ for (const file of readdirSync(src)) {if (file.endsWith('.css')) cpSync(join(src, file), join(out, file));}-// Write injected CSS (empty placeholder — content.js injects styles programmatically)-writeFileSync(join(out, 'styles', 'inject.css'), '/* reserved for injected styles */\n');-// Bump version in manifest for prod buildsif (isProd) {const pkg = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));diff --git a/tests/extension-build.test.js b/tests/extension-build.test.jsnew file mode 100644index 000000000..285e834ef--- /dev/null+++ b/tests/extension-build.test.js@@ -0,0 +1,78 @@+// Core-path test for the walk-avatar Chrome extension build+// (scripts/build-extension.mjs). Runs the real build and verifies the packaged+// output is loadable: every file the manifest references exists, the content+// scripts bundled as classic IIFEs, and the injection chain background.js+// executes (vendor/readability.js, content-narrator.js, content.js) is present.+import { describe, it, expect, beforeAll } from 'vitest';+import { execFileSync } from 'node:child_process';+import { existsSync, readFileSync } from 'node:fs';+import { join, dirname } from 'node:path';+import { fileURLToPath } from 'node:url';++const root = join(dirname(fileURLToPath(import.meta.url)), '..');+const out = join(root, 'dist', 'extension');++describe('walk-avatar extension build', () => {+ beforeAll(() => {+ execFileSync('node', [join(root, 'scripts', 'build-extension.mjs')], {+ cwd: root,+ stdio: 'pipe',+ });+ });++ it('emits every entrypoint and static file', () => {+ for (const file of [+ 'manifest.json',+ 'background.js',+ 'content.js',+ 'content-narrator.js',+ 'popup.html',+ 'popup.js',+ 'popup.css',+ 'options.html',+ 'options.js',+ 'vendor/readability.js',+ ]) {+ expect(existsSync(join(out, file)), `${file} missing from dist/extension`).toBe(true);+ }+ });++ it('manifest is valid MV3 and every referenced file exists', () => {+ const manifest = JSON.parse(readFileSync(join(out, 'manifest.json'), 'utf8'));+ expect(manifest.manifest_version).toBe(3);+ expect(manifest.background.service_worker).toBe('background.js');++ const referenced = [+ manifest.background.service_worker,+ manifest.action.default_popup,+ manifest.options_page,+ ...Object.values(manifest.icons),+ ...Object.values(manifest.action.default_icon),+ ];+ for (const file of referenced) {+ expect(existsSync(join(out, file)), `manifest references missing file: ${file}`).toBe(true);+ }+ expect(manifest.permissions).toEqual(+ expect.arrayContaining(['storage', 'activeTab', 'scripting', 'tabs']),+ );+ });++ it('content scripts are classic bundles, not ES modules', () => {+ // chrome.scripting.executeScript({files}) injects classic scripts; a+ // stray top-level import/export would throw at injection time.+ for (const file of ['content.js', 'content-narrator.js', 'popup.js', 'options.js']) {+ const code = readFileSync(join(out, file), 'utf8');+ expect(/^\s*(import|export)\s/m.test(code), `${file} contains module syntax`).toBe(false);+ }+ });++ it('background.js keeps the injection chain the files actually shipped', () => {+ const bg = readFileSync(join(out, 'background.js'), 'utf8');+ const chain = bg.match(/files:\s*\[([^\]]+)\]/);+ expect(chain, 'background.js lost its chrome.scripting files list').toBeTruthy();+ for (const injected of chain[1].match(/'([^']+)'|"([^"]+)"/g) || []) {+ const file = injected.slice(1, -1);+ expect(existsSync(join(out, file)), `injected file not in bundle: ${file}`).toBe(true);+ }+ });+});