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.

feat: CC server scripts, block-store redis test, agent-edit/dashboard/pages/features updates; remove debug scripts

nirholasd28d2a7e2249
diff --git a/multiplayer/deploy-cloudrun.sh b/multiplayer/deploy-cloudrun.sh
index 5b257e265..67fb88588 100755
--- a/multiplayer/deploy-cloudrun.sh
+++ b/multiplayer/deploy-cloudrun.sh
@@ -47,15 +47,34 @@ if [[ -z "${PROJECT}" || "${PROJECT}" == "(unset)" ]]; then
exit 1
fi
+# Durable build storage (Upstash Redis REST). This is SEPARATE from REDIS_URI
+# above: REDIS_URI is Colyseus's room-registry/presence Redis for horizontal
+# scaling; these two power block-store.js so each coin world's voxel build
+# survives a redeploy/restart. They must be set on THIS Cloud Run service — the
+# same vars on Vercel only reach the Vercel API functions, never this process.
+# Pass them through when present in the deploy shell (export them, or source an
+# env file, before running this script). For the token, Secret Manager via
+# --set-secrets is preferable to plaintext env in a hardened setup.
+UPSTASH_REDIS_REST_URL="${UPSTASH_REDIS_REST_URL:-}"
+UPSTASH_REDIS_REST_TOKEN="${UPSTASH_REDIS_REST_TOKEN:-}"
+
# Assemble env vars (@-delimited so values containing commas are safe). Redis +
# monitor creds are only passed when provided.
ENV_VARS="NODE_ENV=production@ALLOWED_ORIGINS=${ALLOWED_ORIGINS}"
[[ -n "${REDIS_URI}" ]] && ENV_VARS="${ENV_VARS}@REDIS_URI=${REDIS_URI}"
+[[ -n "${UPSTASH_REDIS_REST_URL}" ]] && ENV_VARS="${ENV_VARS}@UPSTASH_REDIS_REST_URL=${UPSTASH_REDIS_REST_URL}"
+[[ -n "${UPSTASH_REDIS_REST_TOKEN}" ]] && ENV_VARS="${ENV_VARS}@UPSTASH_REDIS_REST_TOKEN=${UPSTASH_REDIS_REST_TOKEN}"
[[ -n "${MONITOR_USER:-}" ]] && ENV_VARS="${ENV_VARS}@MONITOR_USER=${MONITOR_USER}"
[[ -n "${MONITOR_PASS:-}" ]] && ENV_VARS="${ENV_VARS}@MONITOR_PASS=${MONITOR_PASS}"
+# Warn loudly if durable build storage isn't configured — without it, every coin
+# world's build is memory-only and a redeploy wipes it.
+if [[ -z "${UPSTASH_REDIS_REST_URL}" || -z "${UPSTASH_REDIS_REST_TOKEN}" ]]; then
+ echo " ⚠ UPSTASH_REDIS_REST_URL/_TOKEN not set — builds will be MEMORY-ONLY (lost on redeploy)." >&2
+fi
+
echo "Deploying '${SERVICE}' to Cloud Run (project=${PROJECT}, region=${REGION})..."
-echo " cpu=${CPU} memory=${MEMORY} concurrency=${CONCURRENCY} instances=${MIN_INSTANCES}..${MAX_INSTANCES} redis=$([[ -n "${REDIS_URI}" ]] && echo on || echo off)"
+echo " cpu=${CPU} memory=${MEMORY} concurrency=${CONCURRENCY} instances=${MIN_INSTANCES}..${MAX_INSTANCES} redis=$([[ -n "${REDIS_URI}" ]] && echo on || echo off) builds=$([[ -n "${UPSTASH_REDIS_REST_URL}" && -n "${UPSTASH_REDIS_REST_TOKEN}" ]] && echo durable || echo memory-only)"
# Flags that matter for a long-lived Colyseus game server on Cloud Run:
# --no-cpu-throttling : keep CPU allocated between requests so the room
diff --git a/multiplayer/fly.toml b/multiplayer/fly.toml
index 3c47bd8e1..64a009078 100644
--- a/multiplayer/fly.toml
+++ b/multiplayer/fly.toml
@@ -2,6 +2,10 @@
#
# After `fly launch --no-deploy` reads this file once, run:
# fly secrets set ALLOWED_ORIGINS=https://three.ws,https://www.three.ws
+# # Durable voxel-build storage (block-store.js). Without these, each coin
+# # world's build is memory-only and a redeploy wipes it. Same Upstash creds
+# # as the Vercel API, but they must be set HERE too — the server runs apart.
+# fly secrets set UPSTASH_REDIS_REST_URL=... UPSTASH_REDIS_REST_TOKEN=...
# fly deploy
#
# To scale rooms across machines, bump `min_machines_running` and use
diff --git a/pages/agent-edit.html b/pages/agent-edit.html
index ca49e1e8d..d6a5a3254 100644
--- a/pages/agent-edit.html
+++ b/pages/agent-edit.html
@@ -1083,7 +1083,7 @@
<h2 class="outfit-title">Avatar</h2>
<a
class="btn-reset-all"
- href="/dashboard/#avatars"
+ href="/dashboard/avatars"
aria-label="Create or manage avatars in the dashboard"
>
Manage in dashboard ›
diff --git a/pages/agent-next.html b/pages/agent-next.html
index 63803aced..d5a8c005b 100644
--- a/pages/agent-next.html
+++ b/pages/agent-next.html
@@ -834,6 +834,9 @@
const chatMessages = document.getElementById('chat-messages');
const micBtn = document.getElementById('chat-mic');
let agentReady = false;
+ // True once ?id= resolves to a real avatar. Gates the <agent-3d> mount
+ // so an unresolvable id never boots a 404 manifest.
+ let avatarResolvedOk = false;
// ── Load avatar metadata ────────────────────────────────────
async function loadAvatar() {
@@ -841,6 +844,7 @@
const r = await resolveAvatar();
if (!r.ok) throw new Error('avatar not found');
const json = await r.json();
+ avatarResolvedOk = true;
hydrate(json.avatar || json.item || json);
} catch (e) {
console.error('Avatar load failed:', e);
@@ -882,8 +886,9 @@
setMeta('tw-desc', 'content', desc);
setMeta('tw-image', 'content', thumbUrl);
- // Mount the agent-3d component
- agent.setAttribute('src', avatarUrl);
+ // Mount the agent-3d component — only when ?id= resolved to a real
+ // avatar. Mounting an unresolvable id would boot a 404 manifest.
+ if (avatarResolvedOk) agent.setAttribute('src', avatarUrl);
// Update embed snippet — both the stored string and the visible <pre>
const snippet = `<script type="module" src="https://three.ws/agent-3d/latest/agent-3d.js"><\/script>\n<agent-3d src="${avatarUrl}"><\/agent-3d>`;
diff --git a/pages/pump-3d-agent.html b/pages/pump-3d-agent.html
index 344e4b629..d16866ecb 100644
--- a/pages/pump-3d-agent.html
+++ b/pages/pump-3d-agent.html
@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3D-Agent · PumpFun Live</title>
-<link rel="canonical" href="/pump-live">
+<link rel="canonical" href="https://three.ws/pump-live">
<meta http-equiv="refresh" content="0; url=/pump-live">
<script>location.replace('/pump-live');</script>
<link rel="stylesheet" href="/mobile.css" />
diff --git a/pages/pump-live.html b/pages/pump-live.html
index bba99d36f..bd5ca2947 100644
--- a/pages/pump-live.html
+++ b/pages/pump-live.html
@@ -6,7 +6,7 @@
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>�</text></svg>">
<title>3D-Agent · PumpFun Live</title>
<meta name="description" content="Real-time stream of new PumpFun token launches on Solana, presented by a 3D Agent.">
-<link rel="canonical" href="/pump-live">
+<link rel="canonical" href="https://three.ws/pump-live">
<script type="importmap">
{
"imports": {
diff --git a/pages/pump-visualizer.html b/pages/pump-visualizer.html
index 26b845178..f3bcf3c25 100644
--- a/pages/pump-visualizer.html
+++ b/pages/pump-visualizer.html
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3D-Agent · Pump.fun Visualizer</title>
<meta name="description" content="A real-time 3D visualization of trending tokens on Pump.fun. Each sphere is a live coin, sized by market cap.">
- <link rel="canonical" href="/pump-visualizer">
+ <link rel="canonical" href="https://three.ws/pump-visualizer">
<link rel="stylesheet" href="/style.css">
<link rel="stylesheet" href="/nav.css" />
<link rel="stylesheet" href="/mobile.css" />
diff --git a/pages/skills.html b/pages/skills.html
index a188eb736..e2a026847 100644
--- a/pages/skills.html
+++ b/pages/skills.html
@@ -6,7 +6,7 @@
<title>Skills · three.ws</title>
<meta name="description" content="Browse, discover, and install agent skills — tool packs, knowledge bases, and capabilities that make your AI agents smarter." />
<meta name="robots" content="noindex" />
- <link rel="canonical" href="/marketplace?tab=skills" />
+ <link rel="canonical" href="https://three.ws/marketplace?tab=skills" />
<script>
// Skills now live inside the marketplace. Forward any old /skills links
// (and their query) to the marketplace Skills tab, preserving search.
diff --git a/pages/three-live.html b/pages/three-live.html
index 83dec1f20..c433fd13b 100644
--- a/pages/three-live.html
+++ b/pages/three-live.html
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>$THREE Live · Protocol Pulse — three.ws</title>
<meta name="description" content="The $THREE protocol as a living 3D organism. Watch real on-chain trades pulse through it in real time — every transaction emits a burst, whales send shockwaves, with a live trade feed and protocol stats." />
- <link rel="canonical" href="/three-live" />
+ <link rel="canonical" href="https://three.ws/three-live" />
<link rel="stylesheet" href="/style.css" />
<link rel="stylesheet" href="/nav.css" />
<link rel="stylesheet" href="/mobile.css" />
diff --git a/public/features.json b/public/features.json
index 80cbdf91c..ee793c0f1 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-05-31T05:15:07.345Z",
+ "generated_at": "2026-05-31T05:30:27.522Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/public/my-agents/index.html b/public/my-agents/index.html
index cfd0d6380..0fd2e9d69 100644
--- a/public/my-agents/index.html
+++ b/public/my-agents/index.html
@@ -36,7 +36,7 @@
<div class="my-agents-head__text">
<h1 class="my-agents-title">My Agents</h1>
<p class="my-agents-subtitle">
- Every agent you own — three.ws agents and on-chain (ERC-8004) agents from
+ Every agent you own: three.ws agents and on-chain (ERC-8004) agents from
your linked wallets. New users get a starter agent automatically.
</p>
</div>
diff --git a/scripts/_studio-smoke.mjs b/scripts/_studio-smoke.mjs
deleted file mode 100644
index 0274793e9..000000000
--- a/scripts/_studio-smoke.mjs
+++ /dev/null
@@ -1,81 +0,0 @@
-// Temporary smoke test for /create/studio color customization.
-// Drives real Chromium against the dev server, asserts the color tab tints the
-// live mesh (pixel diff), checks keyboard tab nav, and captures console errors.
-// Run: node scripts/_studio-smoke.mjs ; deleted after verification.
-import { chromium } from 'playwright';
-
-const URL = process.env.STUDIO_URL || 'http://localhost:3000/create/studio';
-const fail = (m) => { console.error('FAIL:', m); process.exitCode = 1; };
-const ok = (m) => console.log('PASS:', m);
-
-const browser = await chromium.launch({
- args: ['--use-gl=angle', '--use-angle=swiftshader', '--enable-unsafe-swiftshader', '--ignore-gpu-blocklist'],
-});
-const page = await browser.newPage({ viewport: { width: 1280, height: 900 } });
-const errors = [];
-page.on('console', (msg) => { if (msg.type() === 'error') errors.push(msg.text()); });
-page.on('pageerror', (e) => errors.push('pageerror: ' + e.message));
-
-try {
- await page.goto(URL, { waitUntil: 'domcontentloaded', timeout: 30000 });
-
- // Avatar load: #as-loading is removed on success.
- try {
- await page.waitForSelector('#as-loading', { state: 'detached', timeout: 30000 });
- } catch {
- const txt = await page.locator('#as-loading').textContent().catch(() => '(gone)');
- const hasCanvas = await page.locator('#as-stage canvas').count();
- const webgl = await page.evaluate(() => {
- try { return !!document.createElement('canvas').getContext('webgl2'); } catch { return false; }
- });
- fail(`avatar not loaded. loadingText="${(txt || '').trim()}" canvas=${hasCanvas} webgl2=${webgl}`);
- console.log('console errors:\n ' + (errors.join('\n ') || '(none)'));
- throw new Error('avatar load timeout');
- }
- ok('avatar loaded (loading indicator gone)');
- await page.waitForSelector('#as-stage canvas', { timeout: 5000 });
- await page.waitForTimeout(1200); // settle idle animation + first frames
-
- // Color tab is the default active tab.
- const activeTab = await page.getAttribute('.as-tab.active', 'data-tab');
- if (activeTab === 'color') ok('Color tab active by default'); else fail(`default tab is "${activeTab}", expected "color"`);
-
- // Swatches render for skin/hair/outfit.
- const swatchCount = await page.locator('.as-swatch[data-slot]').count();
- if (swatchCount >= 20) ok(`${swatchCount} swatches rendered`); else fail(`only ${swatchCount} swatches`);
-
- // Apply a vivid outfit tint. The click runs applySlotColor across the live
- // three.js scene graph; a bad material lookup would throw → console error.
- const errBefore = errors.length;
- await page.click('.as-swatch[data-slot="outfit"][data-hex="#1f6b3a"]');
- await page.waitForTimeout(500);
- if (errors.length === errBefore) ok('outfit tint applied without runtime error');
- else fail('error during tint: ' + errors.slice(errBefore).join('; '));
-
- // Chip + selection state.
- const chip = await page.locator('.as-chip[data-color="outfit"]').count();
- if (chip === 1) ok('outfit color chip present'); else fail(`expected 1 outfit chip, got ${chip}`);
- const pressed = await page.locator('.as-swatch[data-slot="outfit"][data-hex="#1f6b3a"]')
- .first().getAttribute('aria-pressed', { timeout: 4000 });
- if (pressed === 'true') ok('selected swatch aria-pressed=true'); else fail(`aria-pressed=${pressed}`);
-
- // Keyboard tab nav: focus active tab, ArrowRight → Hats (roving tabindex).
- await page.focus('#as-tab-color');
- await page.keyboard.press('ArrowRight');
- await page.waitForTimeout(200);
- const afterArrow = await page.locator('.as-tab.active').getAttribute('data-tab', { timeout: 4000 });
- if (afterArrow === 'hat') ok('ArrowRight moves Color → Hats'); else fail(`ArrowRight landed on "${afterArrow}"`);
-
- // Reset clears the chip.
- await page.click('#as-reset');
- await page.waitForTimeout(700);
- const chipsAfterReset = await page.locator('.as-chip').count();
- if (chipsAfterReset === 0) ok('Reset clears chips'); else fail(`${chipsAfterReset} chips after reset`);
-
- if (errors.length === 0) ok('no console errors'); else fail(`console errors:\n ${errors.join('\n ')}`);
-} catch (e) {
- fail('exception: ' + e.message);
-} finally {
- await browser.close();
-}
-console.log(process.exitCode ? '\n=== SMOKE FAILED ===' : '\n=== SMOKE PASSED ===');
diff --git a/scripts/dev-cc-server.mjs b/scripts/dev-cc-server.mjs
new file mode 100644
index 000000000..bf1df4510
--- /dev/null
+++ b/scripts/dev-cc-server.mjs
@@ -0,0 +1,93 @@
+// Local function server for verifying the CoinCommunities-configured flow.
+//
+// Vite dev proxies /api/* straight to production, where CC_API_KEY is unset — so
+// the only way to exercise the *configured* worlds/Town experience locally is to
+// run the real api/community/* handlers here with a key set, and forward every
+// other /api/* path (avatars, etc.) on to production unchanged.
+//
+// CC_API_KEY=cc_... node scripts/dev-cc-server.mjs # listens on :3001
+// DEV_API_PROXY=http://localhost:3001 npm run dev # point Vite at it
+//
+// This runs the EXACT production handler code (api/community/worlds.js, …) — no
+// reimplementation, no mocks. It exists only for local verification.
+import { createServer } from 'node:http';
+import { resolve } from 'node:path';
+import { pathToFileURL } from 'node:url';
+import { existsSync, readFileSync } from 'node:fs';
+
+// Load .env (gitignored) so the real handlers see CC_API_KEY without it having
+// to be exported on the command line. Minimal parser — no dependency.
+const envFile = resolve(process.cwd(), '.env');
+if (existsSync(envFile)) {
+ for (const line of readFileSync(envFile, 'utf8').split('\n')) {
+ const m = /^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/.exec(line);
+ if (m && !(m[1] in process.env)) process.env[m[1]] = m[2].replace(/^["']|["']$/g, '');
+ }
+}
+
+const PORT = Number(process.env.CC_DEV_PORT) || 3001;
+const PROD = (process.env.DEV_API_UPSTREAM || 'https://three.ws').replace(/\/+$/, '');
+
+if (!process.env.CC_API_KEY) {
+ console.error('CC_API_KEY not set — start with CC_API_KEY=cc_... node scripts/dev-cc-server.mjs');
+ process.exit(2);
+}
+
+const handlerCache = new Map();
+async function loadHandler(pathname) {
+ // /api/community/worlds → api/community/worlds.js (supports sub-dirs: auth/url)
+ const rel = pathname.replace(/^\/api\//, '').replace(/\/+$/, '');
+ const file = resolve(process.cwd(), 'api', `${rel}.js`);
+ if (!existsSync(file)) return null;
+ if (!handlerCache.has(file)) {
+ const mod = await import(pathToFileURL(file).href);
+ handlerCache.set(file, mod.default);
+ }
+ return handlerCache.get(file);
+}
+
+async function proxyToProd(req, res) {
+ const target = `${PROD}${req.url}`;
+ const headers = { ...req.headers };
+ delete headers.host;
+ const init = { method: req.method, headers, redirect: 'manual' };
+ if (req.method !== 'GET' && req.method !== 'HEAD') {
+ const chunks = [];
+ for await (const c of req) chunks.push(c);
+ init.body = Buffer.concat(chunks);
+ }
+ const upstream = await fetch(target, init);
+ res.statusCode = upstream.status;
+ upstream.headers.forEach((v, k) => {
+ if (['content-encoding', 'content-length', 'transfer-encoding', 'connection'].includes(k)) return;
+ res.setHeader(k, v);
+ });
+ const buf = Buffer.from(await upstream.arrayBuffer());
+ res.end(buf);
+}
+
+const server = createServer(async (req, res) => {
+ try {
+ const pathname = new URL(req.url, 'http://x').pathname;
+ if (pathname.startsWith('/api/community/')) {
+ const handler = await loadHandler(pathname);
+ if (handler) {
+ await handler(req, res);
+ if (!res.writableEnded) res.end();
+ return;
+ }
+ }
+ await proxyToProd(req, res);
+ } catch (err) {
+ console.error('[dev-cc-server]', req.method, req.url, err);
+ if (!res.headersSent) {
+ res.statusCode = 502;
+ res.setHeader('content-type', 'application/json');
+ res.end(JSON.stringify({ error: 'dev_server_error', error_description: String(err?.message || err) }));
+ }
+ }
+});
+
+server.listen(PORT, () => {
+ console.log(`[dev-cc-server] :${PORT} — community/* handlers run locally (CC key set), other /api/* → ${PROD}`);
+});
diff --git a/scripts/verify-cc-key.mjs b/scripts/verify-cc-key.mjs
new file mode 100644
index 000000000..83f077067
--- /dev/null
+++ b/scripts/verify-cc-key.mjs
@@ -0,0 +1,39 @@
+// Validate a CoinCommunities API key against the live API using the exact code
+// path production uses (the @coin-communities/sdk node client + our cc() wiring).
+// Prints the real TopCommunities shape so we can confirm toWorldCard maps it.
+// CC_API_KEY=cc_... node scripts/verify-cc-key.mjs
+import { configureApi, api } from '@coin-communities/sdk/node';
+
+const key = process.env.CC_API_KEY || '';
+const baseUrl = (process.env.CC_BASE_URL || 'https://api.coin-communities.xyz').replace(/\/+$/, '');
+if (!key) { console.error('CC_API_KEY not set'); process.exit(2); }
+
+configureApi({ baseUrl, headers: { 'x-api-key': key } });
+
+const { data, error } = await api.getTopCommunities();
+if (error) {
+ console.error('API ERROR:', error.message || error);
+ process.exit(1);
+}
+const communities = data?.communities ?? [];
+console.log(`baseUrl: ${baseUrl}`);
+console.log(`top communities returned: ${communities.length}`);
+const c = communities[0];
+if (c) {
+ // Show the exact upstream field names our toWorldCard() reads.
+ console.log('first community (relevant fields):');
+ console.log(JSON.stringify({
+ tokenAddress: c.tokenAddress,
+ tokenSymbol: c.tokenSymbol,
+ tokenImageUrl: c.tokenImageUrl,
+ tokenHighResImageUrl: c.tokenHighResImageUrl,
+ chainId: c.chainId,
+ memberCount: c.memberCount,
+ postCount: c.postCount,
+ totalLikes: c.totalLikes,
+ latestPostAt: c.latestPostAt,
+ }, null, 2));
+ console.log('all keys on first community:', Object.keys(c).join(', '));
+}
+console.log(communities.length > 0 ? '\nKEY VALID — worlds available' : '\nKEY VALID — but zero communities returned');
+process.exit(0);
diff --git a/scripts/verify-worlds-live.mjs b/scripts/verify-worlds-live.mjs
new file mode 100644
index 000000000..dc1d0c648
--- /dev/null
+++ b/scripts/verify-worlds-live.mjs
@@ -0,0 +1,71 @@
+// Headless verification of the /worlds lobby in its CONFIGURED state — i.e. with
+// a real CoinCommunities key serving live worlds (via scripts/dev-cc-server.mjs
+// behind a dev server). Confirms the live worlds grid renders real cards, the
+// count + search work, a card enters its /walk world, and there are ZERO console
+// errors (no tolerated 503 this time — the key is live).
+// WORLDS_URL=http://localhost:3200/worlds node scripts/verify-worlds-live.mjs
+import { chromium } from 'playwright';
+
+const URL = process.env.WORLDS_URL || 'http://localhost:3200/worlds';
+const errors = [];
+const warnings = [];
+
+const browser = await chromium.launch();
+const page = await browser.newPage();
+page.on('console', (m) => {
+ const t = m.text();
+ if (m.type() === 'error') errors.push(t);
+ else if (m.type() === 'warning') warnings.push(t);
+});
+page.on('pageerror', (e) => errors.push(`pageerror: ${e.message}`));
+
+await page.goto(URL, { waitUntil: 'domcontentloaded', timeout: 30_000 });
+await page.waitForSelector('.wl-card:not(.wl-skel)', { timeout: 20_000 });
+await page.waitForTimeout(500);
+
+const checks = {};
+checks.worldCards = await page.locator('.wl-card:not(.wl-skel)').count();
+checks.countText = (await page.locator('#wl-worlds-count').textContent().catch(() => '')) || '';
+checks.firstSymbol = (await page.locator('.wl-card-sym').first().textContent().catch(() => '')) || '';
+checks.firstHasLiveBadge = (await page.locator('.wl-card .wl-card-live').count()) > 0;
+checks.firstHasStats = (await page.locator('.wl-card .wl-stat').first().count()) > 0;
+
+// Search filter narrows the grid.
+const firstSym = checks.firstSymbol.replace(/^\$/, '').slice(0, 3);
+await page.fill('#wl-search', firstSym);
+await page.waitForTimeout(400);
+checks.filteredCards = await page.locator('.wl-card:not(.wl-skel)').count();
+await page.fill('#wl-search', '');
+await page.waitForTimeout(300);
+
+// Clicking a world card enters its /walk world with the coin param.
+let entersWalk = false;
+let walkUrl = '';
+try {
+ await page.locator('.wl-card:not(.wl-skel)').first().click();
+ await page.waitForURL('**/walk?**', { timeout: 10_000 });
+ walkUrl = page.url();
+ entersWalk = /[?&]coin=[1-9A-HJ-NP-Za-km-z]{32,44}/.test(walkUrl);
+} catch { /* stays false */ }
+checks.entersWalk = entersWalk;
+checks.walkUrl = walkUrl;
+
+await browser.close();
+
+console.log('--- /worlds LIVE-state verification ---');
+console.log(JSON.stringify(checks, null, 2));
+console.log(`console errors: ${errors.length}`);
+errors.forEach((e) => console.log(' ✗', e));
+console.log(`console warnings: ${warnings.length}`);
+warnings.slice(0, 8).forEach((w) => console.log(' !', w));
+
+const pass =
+ checks.worldCards >= 1 &&
+ /\d+\s+world/.test(checks.countText) &&
+ checks.firstSymbol.length > 0 &&
+ checks.firstHasLiveBadge &&
+ checks.entersWalk &&
+ errors.length === 0;
+
+console.log(pass ? '\nPASS' : '\nFAIL');
+process.exit(pass ? 0 : 1);
diff --git a/src/agent-edit.js b/src/agent-edit.js
index c70437b2d..ef77fa323 100644
--- a/src/agent-edit.js
+++ b/src/agent-edit.js
@@ -34,11 +34,7 @@ let availableAvatars = null;
async function loadAgent() {
if (!agentId) {
- if (initAvatarId || initAvatarGlb) {
- await createAgentFromAvatar();
- } else {
- showError('No agent ID provided.');
- }
+ await createDraftAgent();
return;
}
try {
@@ -61,10 +57,11 @@ async function loadAgent() {
}
}
-async function createAgentFromAvatar() {
- showLoading('Creating agent…');
+async function createDraftAgent() {
+ const fromAvatar = !!(initAvatarId || initAvatarGlb);
+ showLoading(fromAvatar ? 'Creating agent…' : 'Creating a new agent…');
try {
- const name = initAvatarName ? `${initAvatarName} Agent` : 'My Agent';
+ const name = initAvatarName ? `${initAvatarName} Agent` : 'Untitled Agent';
const createRes = await apiFetch(`${API_BASE}/agents`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@@ -103,7 +100,13 @@ async function createAgentFromAvatar() {
`You are ${initAvatarName}, a 3D avatar agent. Be helpful and engaging.`;
}
render();
- showBanner(`Agent created from "${initAvatarName || 'avatar'}" — fill in the details below.`);
+ if (fromAvatar) {
+ showBanner(`Agent created from "${initAvatarName || 'avatar'}" — fill in the details below.`);
+ } else {
+ showBanner('Draft agent created — give it a name and description to get started.');
+ const nameField = $('f-name');
+ if (nameField) { nameField.focus(); nameField.select(); }
+ }
} catch (err) {
showError(err.message);
}
@@ -280,7 +283,11 @@ function renderLaunchTokenState() {
async function ensureAgent3DLib() {
if (customElements.get('agent-3d')) return true;
- const candidates = ['/agent-3d/latest/agent-3d.js', '/dist-lib/agent-3d.js'];
+ const candidates = [
+ 'https://three.ws/agent-3d/latest/agent-3d.js',
+ '/agent-3d/latest/agent-3d.js',
+ '/dist-lib/agent-3d.js',
+ ];
for (const url of candidates) {
try {
await import(/* @vite-ignore */ url);
@@ -296,6 +303,10 @@ async function ensureOutfitTab() {
if (outfitMounted) return;
outfitMounted = true;
+ // Show animation graph skeleton immediately so the section isn't a blank
+ // void while the library loads. It'll be repopulated by renderAnimationsPicker.
+ renderAnimGraphSkeleton();
+
await ensureAgent3DLib();
const preview = $('outfit-preview');
const a3d = document.createElement('agent-3d');
@@ -305,8 +316,7 @@ async function ensureOutfitTab() {
preview.innerHTML = '';
preview.appendChild(a3d);
- await renderAvatarList();
- await renderAnimationsPicker();
+ await Promise.all([renderAvatarList(), renderAnimationsPicker()]);
}
async function renderAvatarList() {
@@ -584,6 +594,23 @@ async function renderAnimationsPicker() {
renderAnimGraphPicker();
}
+function renderAnimGraphSkeleton() {
+ const rows = $('anim-graph-rows');
+ if (!rows) return;
+ rows.innerHTML = ANIM_STATES.map((state) => {
+ const def = ANIM_STATE_DEFAULT_CLIP[state];
+ return `
+ <div class="anim-graph-row" data-state="${state}">
+ <span class="anim-graph-row-label">${state}</span>
+ <select aria-label="Clip for ${state} state" disabled>
+ <option>— loading —</option>
+ </select>
+ <span class="anim-graph-row-meta">default: ${def}</span>
+ </div>
+ `;
+ }).join('');
+}
+
function renderAnimGraphPicker() {
const rows = $('anim-graph-rows');
const saveBtn = $('anim-graph-save');
diff --git a/src/dashboard-next/pages/agents.js b/src/dashboard-next/pages/agents.js
index b9fa2014b..6cf6607e4 100644
--- a/src/dashboard-next/pages/agents.js
+++ b/src/dashboard-next/pages/agents.js
@@ -176,8 +176,11 @@ function truncMid(s, head = 6, tail = 4) {
})();
async function safeGet(url) {
- try { return await get(url); }
- catch { return null; }
+ try {
+ return await get(url);
+ } catch {
+ return null;
+ }
}
// ── Render agent list ──────────────────────────────────────────────────────
@@ -274,27 +277,32 @@ function renderAgents(host, agents, avatars, root) {
}
// ── Deploy on-chain (Metaplex Core / ERC-8004) ─────────────────────────────
-// Reuses the <onchain-deploy-button> custom element, which drives the full
-// prep → sign → confirm pipeline from src/onchain/deploy.js and persists the
-// result through /api/agents/onchain/confirm. On success we patch the in-memory
-// agent with the confirmed record and re-render so the card flips to on-chain.
+// Reuses OnchainDeployButton, which drives the full prep → sign → confirm
+// pipeline from src/onchain/deploy.js and persists the result server-side via
+// /api/agents/onchain/confirm. The button mutates the agent object it's given
+// (sets agent.onchain) and renders its own success chip. We watch for that
+// mutation, then re-fetch the agents list so every card reflects persisted
+// state, matching how Delete refreshes the list after a server mutation.
async function openDeployOnchainModal(host, agent, avatars, allAgents) {
- await import('../../onchain/deploy-button.js');
+ const [{ OnchainDeployButton }] = await Promise.all([
+ import('../../onchain/deploy-button.js'),
+ import('../../erc8004/deploy-button.css'),
+ ]);
+
const overlay = makeOverlay();
overlay.innerHTML = `
<div role="dialog" aria-modal="true" aria-label="Deploy agent on-chain" style="
- width:min(440px,100%);
+ width:min(460px,100%);
background:linear-gradient(180deg,rgba(22,24,32,0.97),rgba(16,17,24,0.97));
border:1px solid var(--nxt-stroke-strong);border-radius:14px;padding:24px;
box-shadow:0 20px 60px rgba(0,0,0,0.6);
">
<div style="font-size:17px;font-weight:600;margin-bottom:6px">Deploy on-chain</div>
<div style="font-size:12.5px;color:var(--nxt-ink-dim);margin-bottom:18px">
- Mint a Metaplex Core asset for <strong style="color:var(--nxt-ink)">${esc(agent.name || agent.display_name || 'this agent')}</strong>. That asset becomes the agent's permanent on-chain identity. You'll sign one transaction in your Solana wallet (~0.003 SOL rent + network fees).
+ Register <strong style="color:var(--nxt-ink)">${esc(agent.name || agent.display_name || 'this agent')}</strong> on-chain. Pick a chain, then sign one transaction in your wallet. The asset becomes the agent's permanent on-chain identity.
</div>
<div data-slot="deploy-host" style="display:flex;justify-content:center;margin-bottom:18px"></div>
- <div data-slot="error" style="font-size:12.5px;color:var(--nxt-danger);min-height:18px;margin-bottom:12px"></div>
<div style="display:flex;gap:8px;justify-content:flex-end">
<button class="dn-btn ghost" data-action="cancel">Close</button>
</div>
@@ -302,40 +310,65 @@ async function openDeployOnchainModal(host, agent, avatars, allAgents) {
`;
document.body.appendChild(overlay);
- const errorEl = overlay.querySelector('[data-slot="error"]');
const deployHost = overlay.querySelector('[data-slot="deploy-host"]');
-
- const btnEl = document.createElement('onchain-deploy-button');
- btnEl.setAttribute('agent-id', agent.id);
- btnEl.setAttribute('chain', 'solana:mainnet');
- btnEl.setAttribute('label', 'Deploy on Solana →');
- btnEl.agent = {
+ // Pass a thin agent shape the deploy pipeline understands. The button writes
+ // `deployAgentObj.onchain` on success — that's our completion signal.
+ const deployAgentObj = {
id: agent.id,
name: agent.name || agent.display_name || 'Agent',
description: agent.description || agent.persona?.tagline || agent.tagline || '',
avatar_id: agent.avatar_id || null,
skills: Array.isArray(agent.skills) && agent.skills.length ? agent.skills : undefined,
+ onchain: agent.onchain || null,
};
- deployHost.appendChild(btnEl);
+ const deployBtn = new OnchainDeployButton({ agent: deployAgentObj, container: deployHost });
+ deployBtn.mount();
- btnEl.addEventListener('onchain:deployed', (e) => {
- const updated = e.detail?.agent || {};
+ let deployed = false;
+ const finish = async () => {
+ if (!deployed) return;
toast('Agent deployed on-chain');
- const idx = allAgents.findIndex((a) => a.id === agent.id);
- if (idx >= 0) allAgents[idx] = { ...allAgents[idx], ...updated };
- close();
- renderAgents(host, allAgents, avatars, null);
- });
- btnEl.addEventListener('onchain:error', (e) => {
- errorEl.textContent = e.detail?.error?.message || 'Deploy failed. Please try again.';
+ // Re-fetch so the card reflects the record persisted by the confirm endpoint.
+ const fresh = (await safeGet('/api/agents'))?.agents;
+ const next =
+ Array.isArray(fresh) && fresh.length
+ ? fresh
+ : allAgents.map((a) =>
+ a.id === agent.id ? { ...a, onchain: deployAgentObj.onchain } : a,
+ );
+ renderAgents(host, next, avatars, null);
+ };
+
+ const close = async () => {
+ deployBtn.unmount();
+ overlay.remove();
+ document.removeEventListener('keydown', onKey);
+ await finish();
+ };
+ function onKey(e) {
+ if (e.key === 'Escape') close();
+ }
+
+ // The button has no success event, so observe its internal success chip:
+ // it sets `deployAgentObj.onchain` and swaps in `.deploy-chip--success`.
+ const observer = new MutationObserver(() => {
+ if (deployAgentObj.onchain && deployHost.querySelector('.deploy-chip--success')) {
+ deployed = true;
+ }
});
+ observer.observe(deployHost, { childList: true, subtree: true });
- const close = () => overlay.remove();
- overlay.querySelector('[data-action="cancel"]').addEventListener('click', close);
- overlay.addEventListener('click', (e) => { if (e.target === overlay) close(); });
- document.addEventListener('keydown', function onKey(e) {
- if (e.key === 'Escape') { close(); document.removeEventListener('keydown', onKey); }
+ overlay.querySelector('[data-action="cancel"]').addEventListener('click', () => {
+ observer.disconnect();
+ close();
+ });
+ overlay.addEventListener('click', (e) => {
+ if (e.target === overlay) {
+ observer.disconnect();
+ close();
+ }
});
+ document.addEventListener('keydown', onKey);
}
// ── Deploy Pump.fun token ──────────────────────────────────────────────────
@@ -359,23 +392,26 @@ function openDeployPumpModal(agent, avatars) {
name: agent.name || agent.display_name || 'Agent',
description: agent.description || agent.persona?.tagline || agent.tagline || '',
avatar_id: agent.avatar_id || null,
- skills: Array.isArray(agent.skills) && agent.skills.length ? agent.skills : undefined,
+ skills:
+ Array.isArray(agent.skills) && agent.skills.length
+ ? agent.skills
+ : undefined,
}
: null,
});
}
const BRAIN_LABELS = {
- 'claude-sonnet-4-6': 'Claude Sonnet 4.6',
- 'claude-haiku-4-5-20251001': 'Claude Haiku 4.5',
- 'claude-opus-4-6': 'Claude Opus 4.6',
- 'claude-opus-4-7': 'Claude Opus 4.7',
- 'llama-3.3-70b-versatile': 'Llama 3.3 70B · Groq',
- 'llama-3.1-8b-instant': 'Llama 3.1 8B · Groq',
- 'meta-llama/llama-3.3-70b-instruct:free': 'Llama 3.3 70B · OpenRouter',
- 'meta-llama/llama-3.1-8b-instruct:free': 'Llama 3.1 8B · OpenRouter',
- 'openai/gpt-oss-120b:free': 'GPT-OSS 120B · OpenRouter',
- 'nousresearch/hermes-3-llama-3.1-405b:free': 'Hermes 3 405B · OpenRouter',
+ 'claude-sonnet-4-6': 'Claude Sonnet 4.6',
+ 'claude-haiku-4-5-20251001': 'Claude Haiku 4.5',
+ 'claude-opus-4-6': 'Claude Opus 4.6',
+ 'claude-opus-4-7': 'Claude Opus 4.7',
+ 'llama-3.3-70b-versatile': 'Llama 3.3 70B · Groq',
+ 'llama-3.1-8b-instant': 'Llama 3.1 8B · Groq',
+ 'meta-llama/llama-3.3-70b-instruct:free': 'Llama 3.3 70B · OpenRouter',
+ 'meta-llama/llama-3.1-8b-instruct:free': 'Llama 3.1 8B · OpenRouter',
+ 'openai/gpt-oss-120b:free': 'GPT-OSS 120B · OpenRouter',
+ 'nousresearch/hermes-3-llama-3.1-405b:free': 'Hermes 3 405B · OpenRouter',
};
function brainLabel(agent) {
@@ -401,9 +437,10 @@ function agentCard(a, avatars) {
background:linear-gradient(135deg,rgba(140,143,150,0.3),rgba(100,103,110,0.2));
display:grid;place-items:center;flex-shrink:0;border:1px solid var(--nxt-stroke);
">
- ${avatarThumb
- ? `<img src="${esc(avatarThumb)}" alt="${name}" style="width:100%;height:100%;object-fit:cover" loading="lazy" />`
- : `<svg width="28" height="28" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" style="color:var(--nxt-ink-dim)"><rect x="5" y="2" width="10" height="10" rx="2"/><circle cx="8" cy="6.5" r="1"/><circle cx="12" cy="6.5" r="1"/><path d="M8 9h4M3 14l2-2h10l2 2v3a1 1 0 01-1 1H4a1 1 0 01-1-1v-3z"/></svg>`
+ ${
+ avatarThumb
+ ? `<img src="${esc(avatarThumb)}" alt="${name}" style="width:100%;height:100%;object-fit:cover" loading="lazy" />`
+ : `<svg width="28" height="28" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" style="color:var(--nxt-ink-dim)"><rect x="5" y="2" width="10" height="10" rx="2"/><circle cx="8" cy="6.5" r="1"/><circle cx="12" cy="6.5" r="1"/><path d="M8 9h4M3 14l2-2h10l2 2v3a1 1 0 01-1 1H4a1 1 0 01-1-1v-3z"/></svg>`
}
</div>
@@ -440,12 +477,16 @@ function agentCard(a, avatars) {
</div>
</div>
- ${onchain || pumpMint ? `
+ ${
+ onchain || pumpMint
+ ? `
<div class="dn-agent-links">
${onchain ? `<a href="/onchain?agent=${encodeURIComponent(a.id)}" style="font-size:11.5px;color:var(--nxt-ink-dim)">ERC-8004 registry ↗</a>` : ''}
${pumpMint ? `<a href="https://pump.fun/coin/${encodeURIComponent(pumpMint)}" target="_blank" rel="noopener" style="font-size:11.5px;color:#a8adb5">View on Pump.fun ↗</a>` : ''}
</div>
- ` : ''}
+ `
+ : ''
+ }
</div>
`;
}
@@ -455,10 +496,12 @@ async function loadInlineReviewStats(host, agents) {
if (!published.length) return;
const results = await Promise.allSettled(
published.map((a) =>
- fetch(`/api/marketplace/agents/${encodeURIComponent(a.id)}/reviews`, { credentials: 'include' })
- .then((r) => r.ok ? r.json() : null)
- .then((j) => ({ id: a.id, summary: j?.data?.summary }))
- )
+ fetch(`/api/marketplace/agents/${encodeURIComponent(a.id)}/reviews`, {
+ credentials: 'include',
+ })
+ .then((r) => (r.ok ? r.json() : null))
+ .then((j) => ({ id: a.id, summary: j?.data?.summary })),
+ ),
);
for (const r of results) {
if (r.status !== 'fulfilled' || !r.value?.summary) continue;
@@ -470,7 +513,8 @@ async function loadInlineReviewStats(host, agents) {
if (count === 0) continue;
const badge = document.createElement('span');
badge.className = 'dn-tag';
- badge.style.cssText = 'font-size:11px;background:rgba(251,191,36,0.12);border-color:rgba(251,191,36,0.3);color:#fbbf24';
+ badge.style.cssText =
+ 'font-size:11px;background:rgba(251,191,36,0.12);border-color:rgba(251,191,36,0.3);color:#fbbf24';
badge.textContent = `★ ${avg.toFixed(1)} (${count})`;
badge.title = `${avg.toFixed(2)} avg from ${count} review${count === 1 ? '' : 's'}`;
const nameRow = card.querySelector('div > div:nth-child(2) > div:first-child');
@@ -480,7 +524,10 @@ async function loadInlineReviewStats(host, agents) {
function showReputationPanel(card, rep) {
const existing = card.querySelector('[data-reputation-panel]');
- if (existing) { existing.remove(); return; }
+ if (existing) {
+ existing.remove();
+ return;
+ }
const score = rep?.score ?? rep?.rating ?? null;
const count = rep?.reviews_count ?? rep?.count ?? 0;
const panel = document.createElement('div');
@@ -488,12 +535,13 @@ function showReputationPanel(card, rep) {
panel.style.cssText = 'margin-top:14px;padding-top:14px;border-top:1px solid var(--nxt-stroke)';
panel.innerHTML = `
<div style="font-size:12.5px;font-weight:600;color:var(--nxt-ink-fade);text-transform:uppercase;letter-spacing:0.05em;margin-bottom:10px">Reputation</div>
- ${score !== null
- ? `<div style="display:flex;align-items:baseline;gap:8px">
+ ${
+ score !== null
+ ? `<div style="display:flex;align-items:baseline;gap:8px">
<span style="font-size:32px;font-weight:700;color:var(--nxt-ink)">${Number(score).toFixed(1)}</span>
<span style="font-size:13px;color:var(--nxt-ink-dim)">/ 5.0 · ${count} review${count === 1 ? '' : 's'}</span>
</div>`
- : `<div style="color:var(--nxt-ink-dim);font-size:13px">No reviews yet.</div>`
+ : `<div style="color:var(--nxt-ink-dim);font-size:13px">No reviews yet.</div>`
}
${rep?.tags?.length ? `<div style="display:flex;gap:6px;flex-wrap:wrap;margin-top:10px">${rep.tags.map((t) => `<span class="dn-tag">${esc(t)}</span>`).join('')}</div>` : ''}
`;
@@ -586,14 +634,22 @@ function openCreateModal(host, agents, avatars) {
const close = () => overlay.remove();
overlay.querySelector('[data-action="cancel"]').addEventListener('click', close);
- overlay.addEventListener('click', (e) => { if (e.target === overlay) close(); });
+ overlay.addEventListener('click', (e) => {
+ if (e.target === overlay) close();
+ });
document.addEventListener('keydown', function onKey(e) {
- if (e.key === 'Escape') { close(); document.removeEventListener('keydown', onKey); }
+ if (e.key === 'Escape') {
+ close();
+ document.removeEventListener('keydown', onKey);
+ }
});
submitBtn.addEventListener('click', async () => {
const name = nameEl.value.trim();
- if (!name) { errorEl.textContent = 'Agent name is required.'; return; }
+ if (!name) {
+ errorEl.textContent = 'Agent name is required.';
+ return;
+ }
errorEl.textContent = '';
submitBtn.disabled = true;
submitBtn.textContent = 'Creating…';
@@ -717,14 +773,22 @@ function openEditModal(host, agent, avatars, allAgents) {
const close = () => overlay.remove();
overlay.querySelector('[data-action="cancel"]').addEventListener('click', close);
- overlay.addEventListener('click', (e) => { if (e.target === overlay) close(); });
+ overlay.addEventListener('click', (e) => {
+ if (e.target === overlay) close();
+ });
document.addEventListener('keydown', function onKey(e) {
- if (e.key === 'Escape') { close(); document.removeEventListener('keydown', onKey); }
+ if (e.key === 'Escape') {
+ close();
+ document.removeEventListener('keydown', onKey);
+ }
});
submitBtn.addEventListener('click', async () => {
const name = nameEl.value.trim();
- if (!name) { errorEl.textContent = 'Agent name is required.'; return; }
+ if (!name) {
+ errorEl.textContent = 'Agent name is required.';
+ return;
+ }
errorEl.textContent = '';
submitBtn.disabled = true;
submitBtn.textContent = 'Saving…';
@@ -754,7 +818,7 @@ function openPersonaModal(host, agent, allAgents, avatars) {
const persona = agent.persona || {};
const systemPrompt = persona.system_prompt || agent.system_prompt || '';
const tone = persona.tone || agent.tone || '';
- const traits = Array.isArray(persona.traits) ? persona.traits.join(', ') : (persona.traits || '');
+ const traits = Array.isArray(persona.traits) ? persona.traits.join(', ') : persona.traits || '';
overlay.innerHTML = `
<div role="dialog" aria-modal="true" aria-label="Agent persona" style="
@@ -833,17 +897,25 @@ function openPersonaModal(host, agent, allAgents, avatars) {
const close = () => overlay.remove();
overlay.querySelector('[data-action="cancel"]').addEventListener('click', close);
- overlay.addEventListener('click', (e) => { if (e.target === overlay) close(); });
+ overlay.addEventListener('click', (e) => {
+ if (e.target === overlay) close();
+ });
document.addEventListener('keydown', function onKey(e) {
- if (e.key === 'Escape') { close(); document.removeEventListener('keydown', onKey); }
+ if (e.key === 'Escape') {
+ close();
+ document.removeEventListener('keydown', onKey);
+ }
});
overlay.querySelector('[data-action="save-persona"]').addEventListener('click', async () => {
errorEl.textContent = '';
const systemPromptVal = overlay.querySelector('[data-slot="system-prompt"]').value.trim();
const toneVal = overlay.querySelector('[data-slot="tone"]').value.trim();
- const traitsVal = overlay.querySelector('[data-slot="traits"]').value
- .split(',').map((t) => t.trim()).filter(Boolean);
+ const traitsVal = overlay
+ .querySelector('[data-slot="traits"]')
+ .value.split(',')
+ .map((t) => t.trim())
+ .filter(Boolean);
const saveBtn = overlay.querySelector('[data-action="save-persona"]');
saveBtn.disabled = true;
@@ -871,8 +943,16 @@ function openPersonaModal(host, agent, allAgents, avatars) {
});
const aid = encodeURIComponent(agent.id);
- const SEED_LABELS = { 'seed-twitter': 'Seed from X', 'seed-github': 'Seed from GitHub', 'seed-farcaster': 'Seed from Farcaster' };
- const SOURCE_NAMES = { 'seed-twitter': 'X', 'seed-github': 'GitHub', 'seed-farcaster': 'Farcaster' };
+ const SEED_LABELS = {
+ 'seed-twitter': 'Seed from X',
+ 'seed-github': 'Seed from GitHub',
+ 'seed-farcaster': 'Seed from Farcaster',
+ };
+ const SOURCE_NAMES = {
+ 'seed-twitter': 'X',
+ 'seed-github': 'GitHub',
+ 'seed-farcaster': 'Farcaster',
+ };
const seedAction = async (action) => {
seedStatus.innerHTML = '';
@@ -886,8 +966,15 @@ function openPersonaModal(host, agent, allAgents, avatars) {
} else if (action === 'seed-github') {
endpoint = `/api/agents/${aid}/memory-seed`;
} else {
- const handle = overlay.querySelector('[data-slot="seed-farcaster"]').value.trim().replace(/^@/, '');
- if (!handle) { seedStatus.style.color = 'var(--nxt-danger)'; seedStatus.textContent = 'Enter a Farcaster username or FID first.'; return; }
+ const handle = overlay
+ .querySelector('[data-slot="seed-farcaster"]')
+ .value.trim()
+ .replace(/^@/, '');
+ if (!handle) {
+ seedStatus.style.color = 'var(--nxt-danger)';
+ seedStatus.textContent = 'Enter a Farcaster username or FID first.';
+ return;
+ }
endpoint = `/api/agents/${aid}/memory/seed/farcaster`;
body = /^\d+$/.test(handle) ? { fid: Number(handle) } : { fname: handle };
}
@@ -902,9 +989,10 @@ function openPersonaModal(host, agent, allAgents, avatars) {
const r = await post(endpoint, body);
const count = r?.seeded ?? 0;
seedStatus.style.color = 'var(--nxt-ink)';
- seedStatus.textContent = count > 0
- ? `Seeded ${count} ${count === 1 ? 'fact' : 'facts'} from ${SOURCE_NAMES[action]}.`
- : `No new facts found from ${SOURCE_NAMES[action]}.`;
+ seedStatus.textContent =
+ count > 0
+ ? `Seeded ${count} ${count === 1 ? 'fact' : 'facts'} from ${SOURCE_NAMES[action]}.`
+ : `No new facts found from ${SOURCE_NAMES[action]}.`;
} catch (err) {
seedStatus.style.color = 'var(--nxt-danger)';
// The X/GitHub endpoints require a connected account; guide the user there.
@@ -916,7 +1004,8 @@ function openPersonaModal(host, agent, allAgents, avatars) {
link.style.color = 'var(--nxt-accent, #6ea8fe)';
seedStatus.appendChild(link);
} else if (err?.status === 429) {
- seedStatus.textContent = err?.message || 'Seeding is rate-limited. Try again later.';
+ seedStatus.textContent =
+ err?.message || 'Seeding is rate-limited. Try again later.';
} else {
seedStatus.textContent = err?.message || err?.body?.error || 'Seeding failed.';
}
@@ -926,9 +1015,15 @@ function openPersonaModal(host, agent, allAgents, avatars) {
}
};
- overlay.querySelector('[data-action="seed-twitter"]').addEventListener('click', () => seedAction('seed-twitter'));
- overlay.querySelector('[data-action="seed-github"]').addEventListener('click', () => seedAction('seed-github'));
- overlay.querySelector('[data-action="seed-farcaster"]').addEventListener('click', () => seedAction('seed-farcaster'));
+ overlay
+ .querySelector('[data-action="seed-twitter"]')
+ .addEventListener('click', () => seedAction('seed-twitter'));
+ overlay
+ .querySelector('[data-action="seed-github"]')
+ .addEventListener('click', () => seedAction('seed-github'));
+ overlay
+ .querySelector('[data-action="seed-farcaster"]')
+ .addEventListener('click', () => seedAction('seed-farcaster'));
}
// ── Helpers ────────────────────────────────────────────────────────────────
diff --git a/tests/block-store-redis.test.js b/tests/block-store-redis.test.js
new file mode 100644
index 000000000..560d42502
--- /dev/null
+++ b/tests/block-store-redis.test.js
@@ -0,0 +1,105 @@
+// BlockStore — the Upstash Redis (durable) tier. Exercised against a mocked
+// @upstash/redis so the durability contract is proven without real credentials:
+// - durability is claimed only after a real PING succeeds,
+// - a build written by one process is reloaded by the next (cross-restart),
+// - an unreachable Redis degrades to memory-only without losing edits,
+// - a sustained write outage flips `durable` off so new rooms stop promising
+// persistence to builders.
+
+import { describe, it, expect, beforeEach, vi } from 'vitest';
+
+// Shared, hoisted so the (hoisted) vi.mock factory can close over it. Acts as the
+// "Redis server" — its contents survive a simulated process restart (a fresh
+// BlockStore), exactly like a real durable store.
+const redis = vi.hoisted(() => ({ store: new Map(), pingFails: false, setFails: 0 }));
+
+vi.mock('@upstash/redis', () => ({
+ Redis: class {
+ async ping() { if (redis.pingFails) throw new Error('unreachable'); return 'PONG'; }
+ async get(k) { return redis.store.has(k) ? redis.store.get(k) : null; }
+ async set(k, v) { if (redis.setFails > 0) { redis.setFails--; throw new Error('write failed'); } redis.store.set(k, v); return 'OK'; }
+ async del(k) { return redis.store.delete(k) ? 1 : 0; }
+ },
+}));
+
+// Spin up a fresh BlockStore (a "new process") that reads the mocked Redis.
+async function freshStore() {
+ vi.resetModules();
+ process.env.UPSTASH_REDIS_REST_URL = 'http://mock-upstash';
+ process.env.UPSTASH_REDIS_REST_TOKEN = 'mock-token';
+ const mod = await import('../multiplayer/src/block-store.js');
+ return mod.blockStore;
+}
+
+beforeEach(() => { redis.store.clear(); redis.pingFails = false; redis.setFails = 0; });
+
+describe('BlockStore (durable / Upstash)', () => {
+ it('claims durability only after a verifying PING succeeds', async () => {
+ const s = await freshStore();
+ await s.ready();
+ expect(s.durable).toBe(true);
+ });
+
+ it('persists a build across a simulated restart', async () => {
+ // Process A builds and flushes.
+ const a = await freshStore();
+ await a.ready();
+ const mapA = await a.load('Mint1111111111111111111111111111111111111111');
+ mapA.set('0,0,0', 3);
+ mapA.set('1,2,3', 9);
+ await a.flush('Mint1111111111111111111111111111111111111111');
+ expect(redis.store.size).toBe(1); // one JSON value for the coin
+
+ // Process B (fresh store, same Redis) rehydrates the build on first load.
+ const b = await freshStore();
+ await b.ready();
+ const mapB = await b.load('Mint1111111111111111111111111111111111111111');
+ expect(mapB.get('0,0,0')).toBe(3);
+ expect(mapB.get('1,2,3')).toBe(9);
+ expect(mapB.size).toBe(2);
+ });
+
+ it('clearing a world to empty deletes its durable key', async () => {
+ const a = await freshStore();
+ await a.ready();
+ const coin = 'Mint2222222222222222222222222222222222222222';
+ const map = await a.load(coin);
+ map.set('0,0,0', 1);
+ await a.flush(coin);
+ expect(redis.store.size).toBe(1);
+ map.clear();
+ await a.flush(coin);
+ expect(redis.store.size).toBe(0); // empty world → key removed, not left stale
+ });
+
+ it('degrades to memory-only when Redis is unreachable, without losing edits', async () => {
+ redis.pingFails = true;
+ const s = await freshStore();
+ await s.ready();
+ expect(s.durable).toBe(false);
+ // The in-memory tier still works — builds survive within the process.
+ const coin = 'Mint3333333333333333333333333333333333333333';
+ const map = await s.load(coin);
+ map.set('5,0,5', 7);
+ const again = await s.load(coin);
+ expect(again.get('5,0,5')).toBe(7);
+ });
+
+ it('flips durability off after sustained write failures', async () => {
+ const s = await freshStore();
+ await s.ready();
+ expect(s.durable).toBe(true);
+ const coin = 'Mint4444444444444444444444444444444444444444';
+ const map = await s.load(coin);
+ map.set('0,0,0', 2); // mutate the live map directly (no debounce timer)
+ redis.setFails = 3; // next three writes throw
+ await s.flush(coin);
+ await s.flush(coin);
+ await s.flush(coin);
+ expect(s.durable).toBe(false); // sustained outage → stop promising durability
+ // Recovery: once writes land again, durability is restored.
+ await s.flush(coin);
+ expect(s.durable).toBe(true);
+ expect(redis.store.size).toBe(1);
+ });
+});
diff --git a/vercel.json b/vercel.json
index 0202ea6cf..5d30b299e 100644
--- a/vercel.json
+++ b/vercel.json
@@ -185,10 +185,6 @@
"src": "/api/agents/([^/]+)/skills/price",
"dest": "/api/agent-skill-price.js?agentId=$1"
},
- {
- "src": "/api/agents/([^/]+)/unlocked-skills",
- "dest": "/api/agents/[id]/unlocked-skills?id=$1"
- },
{
"src": "/api/agents/([^/]+)/skill-access",
"dest": "/api/agents/[id]/skill-access?id=$1"
@@ -855,15 +851,11 @@
},
{
"src": "/avatar-studio",
- "dest": "/avatar-studio/index.html"
+ "dest": "/avatar-studio.html"
},
{
"src": "/avatar-studio/",
- "dest": "/avatar-studio/index.html"
- },
- {
- "src": "/avatar-studio/(.*)",
- "dest": "/avatar-studio/$1"
+ "dest": "/avatar-studio.html"
},
{
"src": "/demos",
@@ -1015,26 +1007,6 @@
"src": "/api/agents/([^/]+)/pumpfun/([^/]+)",
"dest": "/api/agents/pumpfun/[action]?id=$1&action=$2"
},
- {
- "src": "/api/avatars/([^/]+)/agents",
- "dest": "/api/avatars/[id]/agents?id=$1"
- },
- {
- "src": "/api/avatars/([^/]+)/coins",
- "dest": "/api/avatars/[id]/coins?id=$1"
- },
- {
- "src": "/api/avatars/([^/]+)/storage-mode",
- "dest": "/api/avatars/[id]/storage-mode?id=$1"
- },
- {
- "src": "/api/avatars/([^/]+)/pin-ipfs",
- "dest": "/api/avatars/[id]/pin-ipfs?id=$1"
- },
- {
- "src": "/api/avatars/([^/]+)/thumbnail",
- "dest": "/api/avatars/[id]/thumbnail?id=$1"
- },
{
"src": "/dashboard/storage",
"dest": "/dashboard-classic/storage.html"
@@ -1526,7 +1498,7 @@
"headers": {
"permissions-policy": "xr-spatial-tracking=*, camera=(self), microphone=(self)"
},
- "dest": "/pages/ar.html"
+ "dest": "/ar.html"
},
{
"src": "/avatars/([^/]+)",
@@ -2443,27 +2415,27 @@
},
{
"src": "/fact-checker",
- "dest": "/pages/fact-checker.html"
+ "dest": "/fact-checker.html"
},
{
"src": "/fact-checker/",
- "dest": "/pages/fact-checker.html"
+ "dest": "/fact-checker.html"
},
{
"src": "/unstoppable",
- "dest": "/pages/unstoppable.html"
+ "dest": "/unstoppable.html"
},
{
"src": "/unstoppable/",
- "dest": "/pages/unstoppable.html"
+ "dest": "/unstoppable.html"
},
{
"src": "/shopper",
- "dest": "/pages/shopper.html"
+ "dest": "/shopper.html"
},
{
"src": "/shopper/",
- "dest": "/pages/shopper.html"
+ "dest": "/shopper.html"
},
{
"src": "/paywall",
diff --git a/vite.config.js b/vite.config.js
index 0915914dd..17f23d335 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -224,6 +224,9 @@ const appConfig = {
'a-embed': resolve(__dirname, 'pages/a-embed.html'),
'a-edit': resolve(__dirname, 'pages/a-edit.html'),
'a-me': resolve(__dirname, 'pages/a-me.html'),
+ 'fact-checker': resolve(__dirname, 'pages/fact-checker.html'),
+ unstoppable: resolve(__dirname, 'pages/unstoppable.html'),
+ shopper: resolve(__dirname, 'pages/shopper.html'),
'pump-live': resolve(__dirname, 'pages/pump-live.html'),
'pump-dashboard': resolve(__dirname, 'pages/pump-dashboard.html'),
'pump-visualizer': resolve(__dirname, 'pages/pump-visualizer.html'),