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
chore: move crypto-optional to src/shared, remove ai-stream and avatar-os live demo, update create/forge/marketplace and token data
nirholas3a4130d41b52
diff --git a/docs/demo-routes.md b/docs/demo-routes.mdindex daae68bc3..85689dbf4 100644--- a/docs/demo-routes.md+++ b/docs/demo-routes.md@@ -28,11 +28,10 @@ See [Verification notes](#verification-notes-2026-06-08) at the end.| `/demo` | `pages/demo-economy.html` | Agent Economy demo — two AI agents pay each other on-chain. || `/demo/coin` | `public/demo/coin/index.html` | Lottery + reflection demo on a single Pump.fun coin (real-time holder feed, payout history). || `/demo/coin/<mint>` | `public/demo/coin/index.html` | Same page hydrated for a specific base58 mint address (32–44 chars). |-| `/demo/avatar-os/` | `public/demo/avatar-os/index.html` | OSS avatar pipeline hub linking to the four sub-pages below. |+| `/demo/avatar-os/` | `public/demo/avatar-os/index.html` | OSS avatar pipeline hub linking to the three sub-pages below. || `/demo/avatar-os/studio.html` | `public/demo/avatar-os/studio.html` | Avatar Studio (rebranded Character Studio fork) embed. || `/demo/avatar-os/selfie.html` | `public/demo/avatar-os/selfie.html` | Selfie-to-avatar flow. || `/demo/avatar-os/combined.html` | `public/demo/avatar-os/combined.html` | Studio + selfie shown side-by-side. |-| `/demo/avatar-os/live.html` | `public/demo/avatar-os/live.html` | Live capture / streaming variant. || `/demos/` | `public/demos/index.html` | Index of all lab demos. || `/demos/3d-home` | `public/demos/3d-home.html` | "Give your AI a body" homepage demo. || `/demos/avatar-sdk` | `public/demos/avatar-sdk.html` | `@three-ws/avatar` SDK walkthrough. |diff --git a/pages/create.html b/pages/create.htmlindex 7608dd541..c0fe82ca2 100644--- a/pages/create.html+++ b/pages/create.html@@ -928,7 +928,9 @@<div id="nav-container"></div></header><script src="/nav.js"></script>- <script type="module" src="/crypto-optional.js"></script>+ <!-- Bundled source module (src/shared/crypto-optional.js); self-mounts on+ the [data-crypto-optional] element below. -->+ <script type="module" src="/src/shared/crypto-optional.js"></script><main class="stage" id="main-content"><section class="create-hero">diff --git a/pages/forge.html b/pages/forge.htmlindex 86065fdbe..953194727 100644--- a/pages/forge.html+++ b/pages/forge.html@@ -1413,95 +1413,8 @@</div></div>- <!-- Optimize topology: triangle / quad / low-poly remesh -->- <div class="optimize" id="optimize" data-open="false">- <button- class="optimize-toggle"- type="button"- id="optimize-toggle"- aria-expanded="false"- aria-controls="optimize-body"- >- <span>Optimize topology — quad remesh & game-ready low-poly</span>- <svg- class="chev"- width="16"- height="16"- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- stroke-width="2"- stroke-linecap="round"- stroke-linejoin="round"- aria-hidden="true"- >- <polyline points="6 9 12 15 18 9" />- </svg>- </button>- <div class="optimize-body" id="optimize-body">- <div class="opt-field">- <span>Mode</span>- <div- class="seg"- id="opt-mode"- role="group"- aria-label="Remesh mode"- >- <button type="button" data-mode="triangle" aria-pressed="false">- Triangle- </button>- <button type="button" data-mode="quad" aria-pressed="true">- Quad retopo- </button>- <button type="button" data-mode="lowpoly" aria-pressed="false">- Low-poly- </button>- </div>- <p class="opt-mode-hint" id="opt-mode-hint"></p>- </div>-- <div class="opt-row">- <label class="opt-field">- <span id="opt-target-label">Target faces</span>- <select class="opt-select" id="opt-target"></select>- </label>- <label class="opt-field">- <span>Format</span>- <select class="opt-select" id="opt-format">- <option value="glb">GLB (textured)</option>- <option value="obj">OBJ (true quads)</option>- <option value="fbx">FBX</option>- <option value="stl">STL</option>- <option value="ply">PLY</option>- <option value="usdz">USDZ</option>- <option value="3mf">3MF</option>- </select>- </label>- <label class="opt-field" id="opt-texsize-field">- <span>Texture</span>- <select class="opt-select" id="opt-texsize">- <option value="512">512px</option>- <option value="1024" selected>1024px</option>- <option value="2048">2048px</option>- </select>- </label>- </div>-- <div class="opt-actions">- <button class="btn" type="button" id="opt-run">- <span id="opt-run-label">Optimize</span>- </button>- <span- class="opt-status"- id="opt-status"- role="status"- aria-live="polite"- ></span>- </div>-- <div class="opt-stats is-hidden" id="opt-stats"></div>- </div>- </div>+ <!-- Optimize topology panel (triangle / quad / low-poly remesh) is+ injected into this result panel by /src/forge-optimize.js. --><!-- Stylize — one-click geometric filters on the current model --><div class="stylize" id="stylize-panel" data-busy="false" hidden>diff --git a/public/ai-stream.css b/public/ai-stream.cssdeleted file mode 100644index d344146a1..000000000--- a/public/ai-stream.css+++ /dev/null@@ -1,113 +0,0 @@-:root {- --border: #1a1a1a;- --bg: #000000;- --panel: #111111;- --muted: #888888;-}-html, body {- margin: 0;- padding: 0;- width: 100vw;- height: 100vh;- overflow: hidden;- background: var(--bg);- color: #eee;- font-family: 'Inter', sans-serif;-}-.ai-stream-page {- display: flex;- flex-direction: column;- height: 100vh;-}-.ai-stream-header {- display: flex;- align-items: center;- padding: 10px 18px;- border-bottom: 1px solid var(--border);- background: rgba(10,10,15,0.8);- backdrop-filter: blur(8px);- z-index: 100;-}-.ai-stream-header h1 {- margin: 0;- font-size: 16px;- font-weight: 600;-}-.ai-stream-header h1 a {- color: #eee;- text-decoration: none;- display: flex;- align-items: center;- gap: 10px;-}-.ai-stream-header h1 img {- height: 20px;-}-.ai-stream-header .controls {- margin-left: auto;- display: flex;- align-items: center;- gap: 12px;-}-.ai-stream-header select, .ai-stream-header button {- background: #111111;- color: #eee;- border: 1px solid #2a2a2a;- border-radius: 6px;- padding: 6px 10px;- font-size: 13px;- cursor: pointer;-}-.ai-stream-header button.toggle[data-on="0"] { color: var(--muted); }-.ai-stream-header .status {- display: flex;- align-items: center;- gap: 6px;- font-size: 12px;- color: var(--muted);- margin-left: 16px;-}-.dot {- width: 8px;- height: 8px;- border-radius: 50%;- background: #555;-}-.dot.live { background: var(--success); }-.dot.connecting { background: #fbbf24; }-.dot.down { background: var(--danger); }--.ai-stream-main {- flex: 1;- display: grid;- grid-template-columns: 1fr 380px;- min-height: 0;-}-#stage {- position: relative;- background: radial-gradient(ellipse at center, var(--bg-1) 0%, var(--bg-0) 70%);-}-#agent {- width: 100%;- height: 100%;- border: 0;-}-#feed-container {- border-left: 1px solid var(--border);- background: var(--panel);- overflow-y: auto;- padding: 10px;-}-#feed {- display: flex;- flex-direction: column;- gap: 8px;-}-/* Event card styles from pumpfun.html can be reused here */-.evt {- border: 1px solid var(--bg-1);- background: #111111;- border-radius: 8px;- padding: 10px 12px;- font-size: 12px;-}diff --git a/public/ai-stream.html b/public/ai-stream.htmldeleted file mode 100644index 3bdb6a0e0..000000000--- a/public/ai-stream.html+++ /dev/null@@ -1,200 +0,0 @@-<!doctype html>-<html lang="en">-<head>- <meta charset="utf-8" />- <meta name="viewport" content="width=device-width,initial-scale=1" />- <title>AI Stream · three.ws</title>- <link rel="icon" href="/favicon.ico" />- <link rel="stylesheet" href="/style.css" />- <link rel="stylesheet" href="/ai-stream.css" />- <link rel="stylesheet" href="/fonts/fonts.css" />-</head>-<body class="ai-stream-page">- <header class="ai-stream-header">- <h1><a href="/"><img src="/three.svg" alt="three.ws" /> AI Stream</a></h1>- <div class="controls">- <button id="ctl-avatar-btn" type="button" aria-haspopup="dialog" aria-expanded="false" title="Choose avatar">- <span class="avatar-thumb" id="ctl-avatar-thumb" aria-hidden="true"></span>- <span class="avatar-name" id="ctl-avatar-label">Avatar</span>- <span class="avatar-caret" aria-hidden="true">▾</span>- </button>- <select id="ctl-mood" title="Avatar mood — biases reaction intensity">- <option value="chill">😎 Chill</option>- <option value="normal" selected>🙂 Normal</option>- <option value="hype">🤩 Hype</option>- </select>- <button id="ctl-narrate" class="toggle" type="button" data-on="1" title="Toggle agent narration">🔊</button>- </div>- <div class="status">- <span id="status-dot" class="dot connecting"></span><span id="status-label">connecting…</span>- </div>- </header>-- <main class="ai-stream-main">- <div id="stage">- <iframe id="agent" allow="autoplay" title="3D agent"></iframe>- </div>- <aside id="feed-container">- <div id="feed"></div>- </aside>- </main>-- <!-- Re-using the same modals and logic from pumpfun.html -->- <div class="pf-modal-backdrop" id="avatar-picker" data-open="false" role="dialog" aria-modal="true" aria-labelledby="avatar-picker-title">- <div class="pf-modal" role="document">- <div class="pf-modal-head">- <h2 id="avatar-picker-title">Choose an avatar</h2>- <span class="spacer"></span>- <button class="pf-modal-close" type="button" aria-label="Close" data-picker-close>×</button>- </div>- <div class="pf-tabs" role="tablist">- <button class="pf-tab" role="tab" type="button" data-tab="defaults" aria-selected="true">Defaults</button>- <button class="pf-tab" role="tab" type="button" data-tab="mine">My Agents</button>- <button class="pf-tab" role="tab" type="button" data-tab="community">Community</button>- </div>- <div class="pf-toolbar">- <input type="search" id="picker-search" placeholder="Search..." />- </div>- <div class="pf-content">- <div class="pf-body" id="picker-body"></div>- <aside class="pf-preview" aria-label="Avatar preview">- <div class="pf-preview-stage" id="picker-preview-stage"></div>- <div class="pf-preview-meta" id="picker-preview-meta"></div>- </aside>- </div>- </div>- </div>-- <script>- // This will be a simplified version of the script from pumpfun.html- // focusing on the core agent + feed functionality.- const $ = (id) => document.getElementById(id);- const url = new URL(location.href);-- // Global state- const params = {- narrate: url.searchParams.get('narrate') !== '0',- mood: url.searchParams.get('mood') || 'normal',- avatar: url.searchParams.get('avatar') || '/avatars/cz.glb',- };-- const iframe = $('agent');- const feedEl = $('feed');-- function setStatus(state, label) {- const dot = $('status-dot');- const lbl = $('status-label');- if(dot) dot.className = 'dot ' + state;- if(lbl) lbl.textContent = label;- }-- function mountAgent() {- const modelHash = '&model=' + encodeURIComponent(params.avatar);- const widgetId = 'wdgt_demo_pumpfun_stream';- iframe.src = `/widget#widget=${widgetId}&kiosk=true&type=pumpfun-feed${modelHash}&narrate=${params.narrate ? '1' : '0'}`;- }-- // Live mint feed via the same SSE endpoint pumpfun.html uses. Reconnects- // with exponential backoff so the page stays useful across cold starts- // or short network drops. Duplicate-mint suppression so the same mint- // doesn't echo when the upstream reissues.- let _es = null;- let _esClosed = false;- let _esBackoffMs = 1000;- const _seenMints = new Set();-- function connectFeed() {- if (_esClosed) return;- setStatus('connecting', 'connecting…');- if (_es) { try { _es.close(); } catch {} _es = null; }-- const endpoint = new URL('/api/agents/pumpfun-feed', location.href);- endpoint.searchParams.set('kind', 'mint');- _es = new EventSource(endpoint.href, { withCredentials: true });-- _es.addEventListener('open', () => {- _esBackoffMs = 1000;- setStatus('live', 'live');- });- const ingest = (evt) => {- let payload;- try { payload = JSON.parse(evt.data); } catch { return; }- if (!payload || typeof payload !== 'object') return;- if (payload.mint && _seenMints.has(payload.mint)) return;- if (payload.mint) _seenMints.add(payload.mint);-- const card = renderEvtCard(payload);- if (card) {- feedEl.insertBefore(card, feedEl.firstChild);- while (feedEl.children.length > 20) feedEl.removeChild(feedEl.lastChild);- }- narrateEvent(payload);- };- _es.addEventListener('mint', ingest);- _es.addEventListener('ping', () => {});- _es.onerror = () => {- if (_esClosed || !_es) return;- if (_es.readyState === EventSource.CLOSED) {- setStatus('down', 'offline');- setTimeout(connectFeed, _esBackoffMs);- _esBackoffMs = Math.min(_esBackoffMs * 1.5, 15000);- } else {- setStatus('connecting', 'reconnecting…');- }- };- }-- window.addEventListener('beforeunload', () => {- _esClosed = true;- if (_es) { try { _es.close(); } catch {} }- });-- function renderEvtCard(evt) {- const name = String(evt.name || 'Untitled');- const symbol = String(evt.symbol || '');- const description = String(evt.description || '').slice(0, 200);- const mc = Number(evt.market_cap_usd || 0);- const card = document.createElement('div');- card.className = 'evt';- card.innerHTML = `- <div class="evt-title">${escapeHtml(name)}${symbol ? ' ($' + escapeHtml(symbol) + ')' : ''}</div>- <div class="evt-desc">${escapeHtml(description)}</div>- <div class="evt-meta">MC: $${mc.toLocaleString()}</div>- `;- return card;- }-- function escapeHtml(s) {- return String(s).replace(/[&<>"']/g, (c) => ({- '&': '&', '<': '<', '>': '>', '"': '"', "'": ''',- })[c]);- }-- function narrateEvent(evt) {- if (!params.narrate) return;- const name = String(evt.name || 'a new token');- const initialBuy = Number(evt.initial_buy_sol || 0);- const mc = Number(evt.market_cap_usd || 0);- const text = `New token minted: ${name}! Initial buy of ${initialBuy} SOL. Market cap is now ${mc} dollars.`;- iframe.contentWindow?.postMessage({ type: 'say', payload: { text, mood: params.mood } }, '*');- }-- function init() {- mountAgent();- connectFeed();-- $('ctl-narrate').addEventListener('click', (e) => {- params.narrate = !params.narrate;- e.currentTarget.dataset.on = params.narrate ? '1' : '0';- });-- $('ctl-mood').addEventListener('change', (e) => {- params.mood = e.target.value;- });- }-- init();- </script>- <script src="/brand.js" defer></script>-</body>-</html>diff --git a/public/changelog.json b/public/changelog.jsonindex 31237922b..5a778599c 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-11T01:29:11.123Z",+ "generated_at": "2026-06-11T01:57:06.067Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",diff --git a/public/demo/avatar-os/live.html b/public/demo/avatar-os/live.htmldeleted file mode 100644index a5928da95..000000000--- a/public/demo/avatar-os/live.html+++ /dev/null@@ -1,137 +0,0 @@-<!doctype html>-<html lang="en">- <head>- <meta charset="utf-8" />- <title>Live · OSS Avatar Pipeline</title>- <meta name="viewport" content="width=device-width, initial-scale=1" />- <meta name="robots" content="noindex" />- <meta name="theme-color" content="#0a0a0a" />- <link rel="icon" href="/favicon.ico" />- <link rel="stylesheet" href="/demo/avatar-os/shared.css" />- </head>- <body>- <header class="os-header">- <div class="brand">- three.ws<span class="tag">avatar-os · live</span>- </div>- <nav>- <a href="/demo/avatar-os/">overview</a>- <a href="/demo/avatar-os/studio.html">studio</a>- <a href="/demo/avatar-os/selfie.html">selfie</a>- <a href="/demo/avatar-os/combined.html">combined</a>- <a href="/demo/avatar-os/live.html" class="active">live</a>- </nav>- </header>- <main class="os-main">- <div class="banner">- <strong>Webcam → MediaPipe → VRM.</strong> Face Landmarker streams 52 ARKit- blendshape coefficients + head pose into a @pixiv/three-vrm avatar with- spring-bone physics. No mocks, no server inference — everything runs in- the browser.- </div>-- <div class="os-grid">- <aside>- <div class="os-card">- <h2>1 · Avatar</h2>- <p>- Default loads a CharacterStudio Anata VRM from the M3-org public- mirror. Paste any VRM URL to swap. If a VRM exposes no- ARKit-style expressions or morphs, head rotation still drives.- </p>- <div class="btn-row">- <button id="btn-load-default" class="btn btn-primary">- Load default VRM- </button>- <button id="btn-load-glb" class="btn">Load /avatars/default.glb</button>- </div>- <div style="margin-top: 8px; display: flex; gap: 6px">- <input- id="vrm-url-input"- type="text"- placeholder="https://…/avatar.vrm"- style="- flex: 1;- padding: 8px 10px;- border-radius: 8px;- border: 1px solid var(--border-2);- background: var(--panel-2);- color: var(--text);- font-size: 12px;- font-family: ui-monospace, monospace;- "- />- <button id="btn-load-url" class="btn">Load URL</button>- </div>- <div class="status" id="vrm-status">no avatar loaded</div>- </div>-- <div class="os-card" style="margin-top: 16px">- <h2>2 · Webcam tracking</h2>- <p>- Start the front-facing camera. MediaPipe Face Landmarker (VIDEO- mode) emits blendshapes + a head transformation matrix at the- display's refresh rate.- </p>- <div class="btn-row">- <button id="btn-start-cam" class="btn btn-primary" disabled>- Start tracking- </button>- <button id="btn-stop-cam" class="btn" disabled>Stop</button>- </div>- <div class="status" id="track-status">load avatar first</div>- </div>-- <div class="os-card" style="margin-top: 16px">- <h2>3 · Physics</h2>- <p>- Spring-bone physics for hair / cloth are driven by- <code>vrm.springBoneManager.update(dt)</code> each frame. No- effect on avatars without spring-bone metadata.- </p>- <label- style="display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px"- >- <input type="checkbox" id="toggle-spring" checked />- <span>spring-bone update enabled</span>- </label>- <div class="status" id="spring-status">—</div>- </div>-- <div class="os-card" style="margin-top: 16px">- <h2>Diagnostics</h2>- <div class="status" id="diag-fps">fps —</div>- <div class="status" id="diag-blend">blendshapes —</div>- <div class="status" id="diag-head">head —</div>- </div>- </aside>-- <section>- <div class="viewer" id="viewer-host" style="min-height: 600px">- <div class="badge" id="viewer-badge">three.js · idle</div>- <div class="overlay" id="viewer-overlay">- Load an avatar, then click <span class="kbd">Start tracking</span>- </div>- </div>- <video- id="cam-video"- autoplay- playsinline- muted- style="- margin-top: 12px;- width: 240px;- max-height: 180px;- border-radius: 12px;- background: #000;- display: none;- border: 1px solid var(--border-2);- "- ></video>- </section>- </div>- </main>- <script type="module" src="/src/demo/os-live.js"></script>- <script src="/brand.js" defer></script>-</body>-</html>diff --git a/public/features.json b/public/features.jsonindex efb9a508d..54c5374b3 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-11T01:29:11.104Z",+ "generated_at": "2026-06-11T01:57:06.052Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/src/dashboard-next/pages/home.js b/src/dashboard-next/pages/home.jsindex 8b2db52c1..ac4dba7c5 100644--- a/src/dashboard-next/pages/home.js+++ b/src/dashboard-next/pages/home.js@@ -11,7 +11,7 @@ import {cryptoOptionalBannerHTML,cryptoOptionalTagHTML,injectStyles as injectCryptoOptionalStyles,-} from '/crypto-optional.js';+} from '../../shared/crypto-optional.js';const POLL_MS = 30_000;const DAYS_WINDOW = 7;diff --git a/src/marketplace.js b/src/marketplace.jsindex 7c43dd96f..76ae7267f 100644--- a/src/marketplace.js+++ b/src/marketplace.js@@ -5255,7 +5255,66 @@ function bindSubmit() {const errorEl = $('market-submit-error');form.addEventListener('submit', (e) => e.preventDefault());- $('sf-publish').addEventListener('click', async () => {+ // "Import from JSON" — reveal the paste area, then map LobeHub-compatible+ // agent JSON ({ config: { systemRole }, meta: { title, … } }) onto the form.+ const importToggle = $('market-import-toggle');+ const importArea = $('market-import-area');+ if (importToggle && importArea) {+ importToggle.setAttribute('aria-expanded', 'false');+ importToggle.setAttribute('aria-controls', 'market-import-area');+ importToggle.addEventListener('click', () => {+ const open = importArea.hidden;+ importArea.hidden = !open;+ importToggle.textContent = open ? 'Import from JSON ↑' : 'Import from JSON ↓';+ importToggle.setAttribute('aria-expanded', String(open));+ if (open) $('market-import-json')?.focus();+ });+ }+ $('market-import-apply')?.addEventListener('click', () => {+ errorEl.hidden = true;+ const raw = ($('market-import-json')?.value || '').trim();+ if (!raw) {+ errorEl.textContent = 'Paste agent JSON first.';+ errorEl.hidden = false;+ return;+ }+ let j;+ try {+ j = JSON.parse(raw);+ } catch {+ errorEl.textContent = 'Invalid JSON — check the pasted text and try again.';+ errorEl.hidden = false;+ return;+ }+ const meta = j.meta || {};+ const config = j.config || {};+ const name = meta.title || meta.name || '';+ const systemRole = config.systemRole || '';+ if (!name && !systemRole) {+ errorEl.textContent =+ 'JSON parsed, but no agent fields found — expected { "config": { "systemRole" }, "meta": { "title" } }.';+ errorEl.hidden = false;+ return;+ }+ if (name) $('sf-name').value = name;+ if (meta.description) $('sf-description').value = meta.description;+ if (systemRole) $('sf-prompt').value = systemRole;+ if (config.greeting) $('sf-greeting').value = config.greeting;+ if (Array.isArray(meta.tags)) $('sf-tags').value = meta.tags.join(', ');+ const categorySel = $('sf-category');+ const category = String(meta.category || '').toLowerCase();+ if (category && [...categorySel.options].some((o) => o.value === category)) {+ categorySel.value = category;+ }+ importArea.hidden = true;+ if (importToggle) {+ importToggle.textContent = 'Import from JSON ↓';+ importToggle.setAttribute('aria-expanded', 'false');+ }+ $('sf-name').focus();+ });++ const submitAgent = async (publish, btn) => {const body = {name: $('sf-name').value,description: $('sf-description').value,@@ -5263,9 +5322,12 @@ function bindSubmit() {greeting: $('sf-greeting').value,category: $('sf-category').value,tags: $('sf-tags').value.split(',').map(t => t.trim()).filter(Boolean),- publish: true,+ publish,};+ const idleLabel = btn.textContent;+ btn.disabled = true;+ btn.textContent = publish ? 'Publishing…' : 'Saving…';try {errorEl.hidden = true;const r = await fetch(`${API}/marketplace/agents`, {@@ -5311,13 +5373,29 @@ function bindSubmit() {}sfPriceRows.length = 0;- closeSubmitModal();- loadList(true);+ if (publish) {+ closeSubmitModal();+ loadList(true);+ } else {+ // Drafts don't appear in the public list — confirm in place so the+ // user knows the save landed, then close.+ btn.textContent = 'Draft saved ✓';+ setTimeout(() => {+ closeSubmitModal();+ btn.textContent = idleLabel;+ }, 900);+ }} catch (err) {errorEl.textContent = err.message;errorEl.hidden = false;+ } finally {+ btn.disabled = false;+ if (publish || errorEl.hidden === false) btn.textContent = idleLabel;}- });+ };++ $('sf-publish').addEventListener('click', (e) => submitAgent(true, e.currentTarget));+ $('sf-save-draft').addEventListener('click', (e) => submitAgent(false, e.currentTarget));}// ── Util ──────────────────────────────────────────────────────────────────diff --git a/src/pump/three-token-data.js b/src/pump/three-token-data.jsindex 20b6bc763..d07cc516f 100644--- a/src/pump/three-token-data.js+++ b/src/pump/three-token-data.js@@ -143,12 +143,28 @@ export function createThreeTokenData(opts = {}) {}async function loadRevenueShare() {+ // The endpoint is authed and guests are the common case on the public+ // token page. Resolve the (cached) session first and skip the request+ // entirely for guests — issuing it would log a guaranteed-401 network+ // error to every visitor's console. `me === undefined` means the session+ // lookup itself failed; fall through and let the request decide.+ let me;+ try {+ me = await getMe();+ } catch {+ me = undefined;+ }+ if (me === null) {+ patch('revenueShare', { status: 'ok', unauthenticated: true, error: null });+ return;+ }try {const data = await get('/api/three-token/revenue-share');patch('revenueShare', { status: 'ok', unauthenticated: false, error: null, ...data });} catch (err) {- // A 401 is not an error here — it just means the visitor is a guest. The- // pool-level numbers still come from /stats; only the per-user view is gated.+ // A 401 is not an error here — it just means the visitor is a guest+ // (e.g. the session expired between the cached lookup and this call).+ // Pool-level numbers still come from /stats; only the per-user view is gated.if (err instanceof ApiError && err.status === 401) {patch('revenueShare', { status: 'ok', unauthenticated: true, error: null });} else {diff --git a/src/pump/three-token-data.test.js b/src/pump/three-token-data.test.jsindex bd65510b5..06d32ccc8 100644--- a/src/pump/three-token-data.test.js+++ b/src/pump/three-token-data.test.js@@ -81,8 +81,22 @@ describe('createThreeTokenData — protocol/activity/burns', () => {});describe('createThreeTokenData — revenue share', () => {- it('treats a 401 as unauthenticated, not an error', async () => {+ it('skips the authed request for guests and marks unauthenticated', async () => {+ h.mockGetMe.mockResolvedValue(null); // explicit: no session+ const store = createThreeTokenData({ autoStart: false });+ await store.refresh();+ const s = store.getState();+ expect(s.revenueShare.status).toBe('ok');+ expect(s.revenueShare.unauthenticated).toBe(true);+ // Guests must not trigger the guaranteed-401 network call.+ expect(h.mockGet).not.toHaveBeenCalledWith('/api/three-token/revenue-share');+ store.destroy();+ });++ it('treats a 401 on a stale session as unauthenticated, not an error', async () => {+ h.mockGetMe.mockResolvedValue({ user_id: 'u1' }); // cached session looks live…h.mockGet.mockImplementation((path) => {+ // …but the server says it expired by the time the request lands.if (path === '/api/three-token/revenue-share') return Promise.reject(new h.ApiError(401, 'unauthorized', 'sign in'));return routeGet(path);});@@ -94,7 +108,19 @@ describe('createThreeTokenData — revenue share', () => {store.destroy();});+ it('still requests when the session lookup itself fails', async () => {+ h.mockGetMe.mockRejectedValue(new Error('me lookup down'));+ const store = createThreeTokenData({ autoStart: false });+ await store.refresh();+ const s = store.getState();+ expect(s.revenueShare.status).toBe('ok');+ expect(s.revenueShare.user_id).toBe('u1');+ expect(h.mockGet).toHaveBeenCalledWith('/api/three-token/revenue-share');+ store.destroy();+ });+it('surfaces a non-401 failure as an error', async () => {+ h.mockGetMe.mockResolvedValue({ user_id: 'u1' });h.mockGet.mockImplementation((path) => {if (path === '/api/three-token/revenue-share') return Promise.reject(new h.ApiError(500, 'server_error', 'down'));return routeGet(path);diff --git a/public/crypto-optional.js b/src/shared/crypto-optional.jssimilarity index 100%rename from public/crypto-optional.jsrename to src/shared/crypto-optional.jsdiff --git a/tests/branding-allowlist.json b/tests/branding-allowlist.jsonindex 45029a94f..0fdaba997 100644--- a/tests/branding-allowlist.json+++ b/tests/branding-allowlist.json@@ -304,11 +304,6 @@"file": "public/demo/avatar-os/studio.html","reason": "Internal research demo embedding the open-source @m3-org/characterstudio package."},- {- "pattern": "CharacterStudio",- "file": "public/demo/avatar-os/live.html",- "reason": "Internal research demo describing the default VRM source — references the upstream project name."- },{"pattern": "characterstudio","file": "*",diff --git a/vite.config.js b/vite.config.jsindex c64eb3d28..74db22463 100644--- a/vite.config.js+++ b/vite.config.js@@ -216,7 +216,6 @@ const appConfig = {'/studio/launch-panel.js','/studio/fees-panel.js','./fees-panel.js',- '/crypto-optional.js',/^@three-ws\/agent-payments(\/.*)?$/,],output: {@@ -935,7 +934,10 @@ const appConfig = {// /agents/:id → rich detail page (UUID expected, validated client-side)else if (!filePath && /^\/bounty\/[^/]+\/?$/.test(path))filePath = resolve(root, 'pages/bounty.html');- else if (!filePath && /^\/agents\/[^/]+\/?$/.test(path))+ // `[^/.]+` (no dot) mirrors vercel.json's `/agents/([^/.]+)` so+ // static assets like /agents/boot.js fall through to public/+ // instead of being served the agent-detail HTML shell.+ else if (!filePath && /^\/agents\/[^/.]+\/?$/.test(path))filePath = resolve(root, 'pages/agent-detail.html');else if (!filePath && /^\/agent\/[^/]+\/edit$/.test(path))filePath = resolve(root, 'pages/agent-edit.html');