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: deploy-burn ledger, fact-checker shared LLM routing, ElevenLabs SDK migration

nirholas74cdccf26473
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e5ffbe6e7..7765f1a50 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,12 @@
Public feature history for [three.ws](https://three.ws), newest first. Feature dates are tracked from 2026-05-25 forward; earlier pages are omitted.
+## 2026-05-29
+
+- **Forever — etch a message into Bitcoin** (`/forever`) — Inscribe a message onto the Bitcoin blockchain. It stays there. Forever.
+- **x402 Arbitrage** (`/arbitrage`) — Cross-provider price disparities surfaced live from the merged x402 facilitator catalog. Find the cheapest endpoint for any capability.
+- **x402 Providers** (`/providers`) — Quantified operator profiles for the x402 paid API catalog. Service counts, price bands, dominant categories, and the underlying listings.
+
## 2026-05-27
- **Endpoint Shopper** (`/shopper`) — Describe a task and set a budget. An AI agent discovers relevant x402 endpoints via the Bazaar, chains them together, and synthesizes a final answer — paying per API call.
diff --git a/agents/fact-checker/src/llm-verdict.js b/agents/fact-checker/src/llm-verdict.js
index 5ea645be3..f3bba40cd 100644
--- a/agents/fact-checker/src/llm-verdict.js
+++ b/agents/fact-checker/src/llm-verdict.js
@@ -1,57 +1,22 @@
-// LLM helpers for the fact-checker using direct Anthropic API calls.
-// Model: claude-haiku-4-5-20251001 (cheap + fast for structured extraction).
+// LLM helpers for the fact-checker.
+//
+// Routes through the platform's shared provider policy (api/_lib/llm.js):
+// Groq and OpenRouter are the funded free defaults; Anthropic is used only when
+// the operator brings their own ANTHROPIC_API_KEY. Structured extraction below
+// only needs a fast, cheap model, which all three providers satisfy.
-const ANTHROPIC_MODEL = 'claude-haiku-4-5-20251001';
-const ANTHROPIC_API = 'https://api.anthropic.com/v1/messages';
-const TIMEOUT_MS = 30_000;
-
-function withTimeout(promise, ms) {
- return Promise.race([
- promise,
- new Promise((_, reject) =>
- setTimeout(() => reject(new Error(`LLM call timed out after ${ms}ms`)), ms),
- ),
- ]);
-}
+import { llmComplete } from '../../../api/_lib/llm.js';
-async function callAnthropic(prompt, maxTokens = 1024) {
- const apiKey = process.env.ANTHROPIC_API_KEY;
- if (!apiKey) {
- const err = new Error('ANTHROPIC_API_KEY is not configured');
- err.status = 503;
- err.code = 'llm_unavailable';
- throw err;
- }
-
- const res = await withTimeout(
- fetch(ANTHROPIC_API, {
- method: 'POST',
- headers: {
- 'content-type': 'application/json',
- 'x-api-key': apiKey,
- 'anthropic-version': '2023-06-01',
- },
- body: JSON.stringify({
- model: ANTHROPIC_MODEL,
- max_tokens: maxTokens,
- messages: [{ role: 'user', content: prompt }],
- }),
- }),
- TIMEOUT_MS,
- );
-
- if (!res.ok) {
- const body = await res.text().catch(() => '');
- const err = new Error(`Anthropic API HTTP ${res.status}: ${body.slice(0, 200)}`);
- err.status = 502;
- err.code = 'llm_error';
- throw err;
- }
+const TIMEOUT_MS = 30_000;
- const data = await res.json();
- const text = data?.content?.[0]?.text || '';
- const usage = data?.usage || {};
- return { text, inputTokens: usage.input_tokens || 0, outputTokens: usage.output_tokens || 0 };
+async function callLlm(prompt, maxTokens = 1024) {
+ const { text, usage } = await llmComplete({
+ user: prompt,
+ maxTokens,
+ anthropicKey: process.env.ANTHROPIC_API_KEY,
+ timeoutMs: TIMEOUT_MS,
+ });
+ return { text, inputTokens: usage?.input || 0, outputTokens: usage?.output || 0 };
}
/**
@@ -71,7 +36,7 @@ Rules:
Example output: ["query one", "query two", "query three"]`;
- const { text, inputTokens, outputTokens } = await callAnthropic(prompt, 256);
+ const { text, inputTokens, outputTokens } = await callLlm(prompt, 256);
let queries;
try {
@@ -134,7 +99,7 @@ No markdown, no explanation, just the JSON array.
Example (for 2 results): [{"excerpt":"The tower stands at 330m","stance":"supports"},{"excerpt":"Some unrelated content","stance":"neutral"}]`;
- const { text, inputTokens, outputTokens } = await callAnthropic(prompt, 1024);
+ const { text, inputTokens, outputTokens } = await callLlm(prompt, 1024);
let analyses;
try {
diff --git a/api/_lib/env.js b/api/_lib/env.js
index 97f529457..42219faab 100644
--- a/api/_lib/env.js
+++ b/api/_lib/env.js
@@ -424,13 +424,6 @@ export const env = {
return match ? match[1] : '';
},
- // Birdeye API key — used by pump/dashboard and three-token to read live
- // price / market / trade data. Optional: handlers degrade to an explicit
- // "data unavailable" response when it's absent rather than crashing.
- get BIRDEYE_API_KEY() {
- return opt('BIRDEYE_API_KEY', '');
- },
-
// Solana devnet RPC URL. Falls back to the public devnet endpoint.
get SOLANA_RPC_URL_DEVNET() {
return opt('SOLANA_RPC_URL_DEVNET', 'https://api.devnet.solana.com');
diff --git a/api/_lib/llm.js b/api/_lib/llm.js
index 2cfe8e35c..4dae25f7b 100644
--- a/api/_lib/llm.js
+++ b/api/_lib/llm.js
@@ -105,10 +105,14 @@ export function llmConfigured(opts = {}) {
// Run a single-shot system+user completion against the first available
// provider, falling over to the next on transport or non-2xx errors.
//
+// `timeoutMs` bounds each provider attempt (the next provider is tried if one
+// times out), so a hung upstream can't stall a serverless function or agent
+// tick indefinitely.
+//
// Returns { text, provider, model, usage:{input,output}, raw }.
// Throws LlmUnavailableError when no provider is configured, or the last
// upstream error (with .status = 502) when every provider failed.
-export async function llmComplete({ system, user, maxTokens = 1024, anthropicKey = null, anthropicModel = null }) {
+export async function llmComplete({ system, user, maxTokens = 1024, anthropicKey = null, anthropicModel = null, timeoutMs = 30_000 }) {
const chain = providerChain({ anthropicKey, anthropicModel });
if (!chain.length) throw new LlmUnavailableError();
@@ -120,6 +124,7 @@ export async function llmComplete({ system, user, maxTokens = 1024, anthropicKey
method: 'POST',
headers: p.headers,
body: JSON.stringify(p.buildBody(system, user, maxTokens)),
+ signal: AbortSignal.timeout(timeoutMs),
});
} catch (e) {
lastErr = Object.assign(new Error(`${p.name} unreachable: ${e.message}`), { status: 502, code: 'upstream_unreachable' });
diff --git a/api/pump/helius-stats.js b/api/pump/helius-stats.js
index 3b40bc9a0..e6f847a9f 100644
--- a/api/pump/helius-stats.js
+++ b/api/pump/helius-stats.js
@@ -31,7 +31,8 @@ async function getSolPrice() {
async function getHeliusInfo() {
const rpcUrl = process.env.SOLANA_RPC_URL || '';
- const isHelius = rpcUrl.includes('helius-rpc.com');
+ const apiKey = process.env.HELIUS_API_KEY || '';
+ const isHelius = !!apiKey || rpcUrl.includes('helius-rpc.com') || rpcUrl.includes('helius.dev');
if (!isHelius) return { enabled: false };
if (Date.now() - _heliusCache.at < 4_000 && _heliusCache.value) return _heliusCache.value;
try {
diff --git a/api/three-token/[action].js b/api/three-token/[action].js
index 738b5e5da..14e2cb8db 100644
--- a/api/three-token/[action].js
+++ b/api/three-token/[action].js
@@ -3,11 +3,12 @@
* -------------------------
* GET /api/three-token/stats — protocol-level metrics (public)
* GET /api/three-token/revenue-share — authenticated user's revenue share position
- * GET /api/three-token/burns — recent token burn events
+ * GET /api/three-token/burns — deploy-to-burn ledger (per-deploy burns)
* GET /api/three-token/activity — protocol activity feed
*
- * All token data sourced from Birdeye + Pump.fun via real on-chain queries.
- * Platform data sourced from the application database.
+ * Market data (price, market cap, supply, holders) is sourced from Birdeye.
+ * Protocol data (agents, revenue, deploy burns) is derived from the
+ * application database; deploy burns = deployed agents × AGENT_DEPLOY_BURN.
*/
import { sql } from '../_lib/db.js';
@@ -17,6 +18,12 @@ import { cors, error, json, method, wrap } from '../_lib/http.js';
const THREE_MINT = 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump';
const BIRDEYE_BASE = 'https://public-api.birdeye.so';
+// Protocol tokenomics (fixed parameters of the $THREE protocol).
+// AGENT_DEPLOY_BURN: $THREE permanently burned each time an agent is deployed.
+// REVENUE_SHARE_POOL_PCT: share of platform revenue distributed to holders.
+const AGENT_DEPLOY_BURN = 1000;
+const REVENUE_SHARE_POOL_PCT = 10;
+
const _cache = new Map();
async function cachedFetch(url, headers, ttlMs = 30_000) {
@@ -53,7 +60,7 @@ async function fetchTokenOverview(apiKey) {
async function fetchPlatformMetrics() {
const [agentCount, revenueData, paymentCount] = await Promise.all([
- sql`SELECT count(*)::int AS total FROM agent_identities WHERE deleted_at IS NULL`,
+ sql`SELECT count(*)::int AS total FROM agent_identities WHERE deleted_at IS NULL`.catch(() => [{ total: 0 }]),
sql`SELECT coalesce(sum(gross_amount), 0)::bigint AS total_gross, coalesce(sum(fee_amount), 0)::bigint AS total_fee FROM agent_revenue_events`.catch(() => [{ total_gross: 0, total_fee: 0 }]),
sql`SELECT count(*)::int AS total FROM agent_revenue_events`.catch(() => [{ total: 0 }]),
]);
@@ -65,14 +72,22 @@ async function fetchPlatformMetrics() {
};
}
+// Deploy-to-burn ledger: each agent deployment burns AGENT_DEPLOY_BURN $THREE.
+// We surface the most recent deployments as burn events and the lifetime total
+// so the burn figures are derived from real on-chain deployment records rather
+// than hardcoded or conflated with revenue.
async function fetchBurnEvents() {
- const rows = await sql`
- SELECT id, agent_id, gross_amount, skill, created_at
- FROM agent_revenue_events
- ORDER BY created_at DESC
- LIMIT 20
- `.catch(() => []);
- return rows;
+ const [recent, totalRow] = await Promise.all([
+ sql`
+ SELECT id, name, display_name, created_at
+ FROM agent_identities
+ WHERE deleted_at IS NULL
+ ORDER BY created_at DESC
+ LIMIT 20
+ `.catch(() => []),
+ sql`SELECT count(*)::int AS total FROM agent_identities WHERE deleted_at IS NULL`.catch(() => [{ total: 0 }]),
+ ]);
+ return { recent, totalAgents: totalRow[0]?.total ?? 0 };
}
async function fetchRecentActivity() {
@@ -131,8 +146,8 @@ export default wrap(async (req, res) => {
total_agents: platform.total_agents,
total_revenue_usd: platform.total_revenue_gross / 1_000_000,
total_payments: platform.total_payments,
- revenue_share_pool_pct: 10,
- agent_deploy_burn: 1000,
+ revenue_share_pool_pct: REVENUE_SHARE_POOL_PCT,
+ agent_deploy_burn: AGENT_DEPLOY_BURN,
},
});
}
@@ -147,9 +162,9 @@ export default wrap(async (req, res) => {
]);
const ov = tokenData.overview || {};
- const totalSupply = ov.supply ?? 1_000_000_000;
+ const totalSupply = ov.supply ?? null;
const totalRevenue = platform.total_revenue_gross / 1_000_000;
- const poolPct = 10;
+ const poolPct = REVENUE_SHARE_POOL_PCT;
const revenuePool = totalRevenue * (poolPct / 100);
return json(res, 200, {
@@ -160,21 +175,22 @@ export default wrap(async (req, res) => {
platform_revenue_usd: totalRevenue,
revenue_share_pool_pct: poolPct,
revenue_share_pool_usd: revenuePool,
- per_token_yield: totalSupply > 0 ? revenuePool / totalSupply : 0,
+ ...(totalSupply > 0 ? { per_token_yield: revenuePool / totalSupply } : {}),
});
}
if (action === 'burns') {
- const events = await fetchBurnEvents();
+ const { recent, totalAgents } = await fetchBurnEvents();
return json(res, 200, {
- burns: events.map((e) => ({
- id: e.id,
- gross_amount: e.gross_amount,
- skill: e.skill,
- created_at: e.created_at,
+ burns: recent.map((a) => ({
+ id: a.id,
+ agent_name: a.display_name || a.name || 'Agent',
+ amount: AGENT_DEPLOY_BURN,
+ reason: 'agent_deploy',
+ created_at: a.created_at,
})),
- total_burned: 0,
- burn_rate_per_agent: 1000,
+ total_burned: totalAgents * AGENT_DEPLOY_BURN,
+ burn_per_deploy: AGENT_DEPLOY_BURN,
});
}
diff --git a/api/tts/eleven-clone.js b/api/tts/eleven-clone.js
index 7918cd136..bc77739ad 100644
--- a/api/tts/eleven-clone.js
+++ b/api/tts/eleven-clone.js
@@ -6,18 +6,18 @@
* - name: string (voice label, 1..64 chars).
* - description: string (optional, ≤500 chars).
*
- * Forwards to the ElevenLabs SDK (`client.voices.add(…)`) using the
+ * Forwards to the ElevenLabs SDK (`client.voices.ivc.create(…)`) using the
* server-side ELEVENLABS_API_KEY. Returns `{ voice_id, name, status }`.
*
* Auth: same shape as /api/tts/eleven — a browser session OR a bearer token.
*
* Heads-up on quota: Instant Voice Cloning is a paid-tier ElevenLabs feature
- * (Starter+). The free tier returns 401 from voices.add with
+ * (Starter+). The free tier returns 401 from voices.ivc.create with
* `can_not_use_instant_voice_cloning`. We pass that error through as a 502
* with the upstream body included so the demo log surfaces it verbatim.
*/
-import { ElevenLabsClient } from 'elevenlabs';
+import { ElevenLabsClient } from '@elevenlabs/elevenlabs-js';
import { getSessionUser, authenticateBearer, extractBearer } from '../_lib/auth.js';
import { cors, method, wrap, error, json } from '../_lib/http.js';
import { env } from '../_lib/env.js';
@@ -94,7 +94,7 @@ export default wrap(async (req, res) => {
let result;
try {
- result = await client.voices.add({
+ result = await client.voices.ivc.create({
name,
description,
files: [audioFile],
@@ -105,7 +105,7 @@ export default wrap(async (req, res) => {
(err?.body && typeof err.body === 'object' ? JSON.stringify(err.body) : err?.body) ||
err?.message ||
'upstream error';
- console.error('[tts/eleven-clone] ElevenLabs voices.add failed', status, body);
+ console.error('[tts/eleven-clone] ElevenLabs voices.ivc.create failed', status, body);
// Pass the upstream body through so the demo surface can show the exact
// quota / verification message — IVC is a paid-tier feature.
return json(res, 502, {
diff --git a/package-lock.json b/package-lock.json
index e713dc899..c76e35c59 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -35,6 +35,7 @@
"@coinbase/x402": "^2.1.0",
"@coral-xyz/anchor": "^0.32.1",
"@dimforge/rapier3d-compat": "^0.19.3",
+ "@elevenlabs/elevenlabs-js": "^2.49.1",
"@ethereum-attestation-service/eas-sdk": "^0.29.1",
"@gltf-transform/core": "^4.3.0",
"@gltf-transform/extensions": "^4.3.0",
@@ -91,7 +92,6 @@
"colyseus": "^0.17.10",
"colyseus.js": "^0.16.22",
"dat.gui": "^0.7.9",
- "elevenlabs": "^1.59.0",
"ethers": "^6.16.0",
"express": "^4.22.1",
"fast-check": "^4.8.0",
@@ -140,7 +140,7 @@
"workbox-window": "^7.4.0"
},
"engines": {
- "node": "22.x"
+ "node": "24.x"
}
},
"agent-payments-sdk": {
@@ -6096,6 +6096,62 @@
"node": ">=6"
}
},
+ "node_modules/@elevenlabs/elevenlabs-js": {
+ "version": "2.49.1",
+ "resolved": "https://registry.npmjs.org/@elevenlabs/elevenlabs-js/-/elevenlabs-js-2.49.1.tgz",
+ "integrity": "sha512-ctwKJaF+ZU3auuuVQK/UBYz5Qev1pqDrnV+BktM+vRvtyt9s1vJvHydCODuj9/uObp8BST2+a5/zu1uShd+ryQ==",
+ "license": "MIT",
+ "dependencies": {
+ "command-exists": "^1.2.9",
+ "node-fetch": "^2.7.0",
+ "ws": "^8.18.3"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ }
+ },
+ "node_modules/@elevenlabs/elevenlabs-js/node_modules/node-fetch": {
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
+ "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
+ "license": "MIT",
+ "dependencies": {
+ "whatwg-url": "^5.0.0"
+ },
+ "engines": {
+ "node": "4.x || >=6.0.0"
+ },
+ "peerDependencies": {
+ "encoding": "^0.1.0"
+ },
+ "peerDependenciesMeta": {
+ "encoding": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@elevenlabs/elevenlabs-js/node_modules/tr46": {
+ "version": "0.0.3",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
+ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
+ "license": "MIT"
+ },
+ "node_modules/@elevenlabs/elevenlabs-js/node_modules/webidl-conversions": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
+ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
+ "license": "BSD-2-Clause"
+ },
+ "node_modules/@elevenlabs/elevenlabs-js/node_modules/whatwg-url": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
+ "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
+ "license": "MIT",
+ "dependencies": {
+ "tr46": "~0.0.3",
+ "webidl-conversions": "^3.0.0"
+ }
+ },
"node_modules/@emnapi/core": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
@@ -27615,66 +27671,6 @@
"integrity": "sha512-AbH9q9J455r/nLmdNZes0G0ZKcRX73FicwowalLs6ijwOmCJSRRrLX63lcAlzy9ux3dWK1w1+1nsBJEWN11hcQ==",
"license": "ISC"
},
- "node_modules/elevenlabs": {
- "version": "1.59.0",
- "resolved": "https://registry.npmjs.org/elevenlabs/-/elevenlabs-1.59.0.tgz",
- "integrity": "sha512-OVKOd+lxNya8h4Rn5fcjv00Asd+DGWfTT6opGrQ16sTI+1HwdLn/kYtjl8tRMhDXbNmksD/9SBRKjb9neiUuVg==",
- "deprecated": "This package has moved to @elevenlabs/elevenlabs-js",
- "license": "MIT",
- "dependencies": {
- "command-exists": "^1.2.9",
- "execa": "^5.1.1",
- "form-data": "^4.0.0",
- "form-data-encoder": "^4.0.2",
- "formdata-node": "^6.0.3",
- "node-fetch": "^2.7.0",
- "qs": "^6.13.1",
- "readable-stream": "^4.5.2",
- "url-join": "4.0.1"
- }
- },
- "node_modules/elevenlabs/node_modules/node-fetch": {
- "version": "2.7.0",
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
- "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
- "license": "MIT",
- "dependencies": {
- "whatwg-url": "^5.0.0"
- },
- "engines": {
- "node": "4.x || >=6.0.0"
- },
- "peerDependencies": {
- "encoding": "^0.1.0"
- },
- "peerDependenciesMeta": {
- "encoding": {
- "optional": true
- }
- }
- },
- "node_modules/elevenlabs/node_modules/tr46": {
- "version": "0.0.3",
- "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
- "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
- "license": "MIT"
- },
- "node_modules/elevenlabs/node_modules/webidl-conversions": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
- "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
- "license": "BSD-2-Clause"
- },
- "node_modules/elevenlabs/node_modules/whatwg-url": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
- "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
- "license": "MIT",
- "dependencies": {
- "tr46": "~0.0.3",
- "webidl-conversions": "^3.0.0"
- }
- },
"node_modules/elliptic": {
"version": "6.6.1",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.1.tgz",
@@ -29205,6 +29201,7 @@
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
"integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"cross-spawn": "^7.0.3",
@@ -29228,6 +29225,7 @@
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
"integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
+ "dev": true,
"license": "MIT",
"engines": {
"node": ">=10"
@@ -29240,6 +29238,7 @@
"version": "3.0.7",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
"integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
+ "dev": true,
"license": "ISC"
},
"node_modules/exit-x": {
@@ -30128,15 +30127,6 @@
"node": ">= 6"
}
},
- "node_modules/form-data-encoder": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-4.1.0.tgz",
- "integrity": "sha512-G6NsmEW15s0Uw9XnCg+33H3ViYRyiM0hMrMhhqQOR8NFc5GhYrI+6I3u7OTw7b91J2g8rtvMBZJDbcGb2YUniw==",
- "license": "MIT",
- "engines": {
- "node": ">= 18"
- }
- },
"node_modules/formatly": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/formatly/-/formatly-0.3.0.tgz",
@@ -30153,15 +30143,6 @@
"node": ">=18.3.0"
}
},
- "node_modules/formdata-node": {
- "version": "6.0.3",
- "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-6.0.3.tgz",
- "integrity": "sha512-8e1++BCiTzUno9v5IZ2J6bv4RU+3UKDmqWUQD0MIMVCd9AdhWkO1gw57oo1mNEX1dMq2EGI+FbWz4B92pscSQg==",
- "license": "MIT",
- "engines": {
- "node": ">= 18"
- }
- },
"node_modules/formdata-polyfill": {
"version": "4.0.10",
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
@@ -32689,6 +32670,7 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
"integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
+ "dev": true,
"license": "Apache-2.0",
"engines": {
"node": ">=10.17.0"
@@ -33773,6 +33755,7 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
+ "dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
@@ -37534,6 +37517,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
+ "dev": true,
"license": "MIT"
},
"node_modules/merge2": {
@@ -38597,6 +38581,7 @@
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
"integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
+ "dev": true,
"license": "MIT",
"dependencies": {
"path-key": "^3.0.0"
@@ -39888,15 +39873,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/process": {
- "version": "0.11.10",
- "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
- "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
- "license": "MIT",
- "engines": {
- "node": ">= 0.6.0"
- }
- },
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
@@ -40889,22 +40865,6 @@
"lodash": "^4.0.1"
}
},
- "node_modules/readable-stream": {
- "version": "4.7.0",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz",
- "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==",
- "license": "MIT",
- "dependencies": {
- "abort-controller": "^3.0.0",
- "buffer": "^6.0.3",
- "events": "^3.3.0",
- "process": "^0.11.10",
- "string_decoder": "^1.3.0"
- },
- "engines": {
- "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
- }
- },
"node_modules/readdirp": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.0.0.tgz",
@@ -43950,6 +43910,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
"integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
+ "dev": true,
"license": "MIT",
"engines": {
"node": ">=6"
@@ -45783,12 +45744,6 @@
"punycode": "^2.1.0"
}
},
- "node_modules/url-join": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz",
- "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==",
- "license": "MIT"
- },
"node_modules/use-isomorphic-layout-effect": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/use-isomorphic-layout-effect/-/use-isomorphic-layout-effect-1.2.1.tgz",
diff --git a/package.json b/package.json
index 69a932ec7..7b37f890a 100644
--- a/package.json
+++ b/package.json
@@ -117,6 +117,7 @@
"@coinbase/x402": "^2.1.0",
"@coral-xyz/anchor": "^0.32.1",
"@dimforge/rapier3d-compat": "^0.19.3",
+ "@elevenlabs/elevenlabs-js": "^2.49.1",
"@ethereum-attestation-service/eas-sdk": "^0.29.1",
"@gltf-transform/core": "^4.3.0",
"@gltf-transform/extensions": "^4.3.0",
@@ -173,7 +174,6 @@
"colyseus": "^0.17.10",
"colyseus.js": "^0.16.22",
"dat.gui": "^0.7.9",
- "elevenlabs": "^1.59.0",
"ethers": "^6.16.0",
"express": "^4.22.1",
"fast-check": "^4.8.0",
diff --git a/pages/home.html b/pages/home.html
index 6dc900c9a..58fe61c95 100644
--- a/pages/home.html
+++ b/pages/home.html
@@ -1060,9 +1060,8 @@
/* ── HERO CHAT INPUT ────────────────────────────────────── */
.hero-chat-bar {
- position: absolute; bottom: 72px; left: 50%;
- transform: translateX(-50%); z-index: 20;
width: min(380px, calc(100% - 40px));
+ margin-bottom: 6px;
}
.hero-chat-form {
display: flex; align-items: center; gap: 0;
@@ -1092,7 +1091,6 @@
.hero-chat-send:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }
.hero-chat-send svg { width: 14px; height: 14px; }
@media (max-width: 980px) {
- .hero-chat-bar { bottom: 20px; }
.hero-thought { top: 4%; }
}
@@ -1240,7 +1238,10 @@
color: var(--text-4);
}
.hero-chips-counter strong { color: var(--text-3); font-weight: 600; }
- @media (max-width: 980px) { .hero-chips-wrap { display: none; } }
+ @media (max-width: 980px) {
+ .hero-chips-label, .hero-chips { display: none; }
+ .hero-chips-wrap { padding: 20px; background: linear-gradient(0deg, rgba(5,5,5,0.7) 0%, transparent 100%); }
+ }
@media (prefers-reduced-motion: reduce) {
.hero-chips-label::before { animation: none !important; }
}
@@ -2356,19 +2357,19 @@
<div class="hero-thought-inner" id="hero-thought-text"></div>
<div class="hero-thought-tail"></div>
</div>
- <div class="hero-chat-bar" id="hero-chat-bar">
- <form class="hero-chat-form" id="hero-chat-form" autocomplete="off">
- <input class="hero-chat-input" id="hero-chat-input" type="text" placeholder="Ask the avatar anything..." aria-label="Chat with the avatar" />
- <button class="hero-chat-send" id="hero-chat-send" type="submit" aria-label="Send message">
- <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2L7 9"/><path d="M14 2L9.5 14L7 9L2 6.5L14 2Z"/></svg>
- </button>
- </form>
- </div>
<div class="stage-meta">
<span>nich</span>
<span>/api/avatars/bacff13e</span>
</div>
<div class="hero-chips-wrap" id="hero-chips-wrap">
+ <div class="hero-chat-bar" id="hero-chat-bar">
+ <form class="hero-chat-form" id="hero-chat-form" autocomplete="off">
+ <input class="hero-chat-input" id="hero-chat-input" type="text" placeholder="Ask the avatar anything..." aria-label="Chat with the avatar" />
+ <button class="hero-chat-send" id="hero-chat-send" type="submit" aria-label="Send message">
+ <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2L7 9"/><path d="M14 2L9.5 14L7 9L2 6.5L14 2Z"/></svg>
+ </button>
+ </form>
+ </div>
<div class="hero-chips-label">
<strong class="hero-chips-counter" id="hero-chips-counter"></strong>
</div>
diff --git a/public/features.json b/public/features.json
index 45aadb7ac..eb17a929f 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-05-29T09:12:05.698Z",
+ "generated_at": "2026-05-29T10:07:50.954Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
@@ -378,6 +378,24 @@
"indexable": true,
"tags": []
},
+ {
+ "path": "/arbitrage",
+ "title": "x402 Arbitrage",
+ "description": "Cross-provider price disparities surfaced live from the merged x402 facilitator catalog. Find the cheapest endpoint for any capability.",
+ "added": "2026-05-29",
+ "auth": null,
+ "indexable": true,
+ "tags": []
+ },
+ {
+ "path": "/providers",
+ "title": "x402 Providers",
+ "description": "Quantified operator profiles for the x402 paid API catalog. Service counts, price bands, dominant categories, and the underlying listings.",
+ "added": "2026-05-29",
+ "auth": null,
+ "indexable": true,
+ "tags": []
+ },
{
"path": "/gmgn",
"title": "GMGN Smart Money",
@@ -413,6 +431,15 @@
"auth": null,
"indexable": true,
"tags": []
+ },
+ {
+ "path": "/forever",
+ "title": "Forever — etch a message into Bitcoin",
+ "description": "Inscribe a message onto the Bitcoin blockchain. It stays there. Forever.",
+ "added": "2026-05-29",
+ "auth": null,
+ "indexable": true,
+ "tags": []
}
]
},
diff --git a/public/llms-full.txt b/public/llms-full.txt
index a1782f920..13328df5b 100644
--- a/public/llms-full.txt
+++ b/public/llms-full.txt
@@ -254,6 +254,18 @@ URL: https://three.ws/bazaar
Search and browse the x402 facilitator catalog. Filter by network, price, and extensions. Pay any service in one click.
+### x402 Arbitrage
+
+URL: https://three.ws/arbitrage
+
+Cross-provider price disparities surfaced live from the merged x402 facilitator catalog. Find the cheapest endpoint for any capability.
+
+### x402 Providers
+
+URL: https://three.ws/providers
+
+Quantified operator profiles for the x402 paid API catalog. Service counts, price bands, dominant categories, and the underlying listings.
+
### GMGN Smart Money
URL: https://three.ws/gmgn
@@ -278,6 +290,12 @@ URL: https://three.ws/shopper
Describe a task and set a budget. An AI agent discovers relevant x402 endpoints via the Bazaar, chains them together, and synthesizes a final answer — paying per API call.
+### Forever — etch a message into Bitcoin
+
+URL: https://three.ws/forever
+
+Inscribe a message onto the Bitcoin blockchain. It stays there. Forever.
+
## Agent Tools
Manage, talk to, and deploy individual agents.
diff --git a/public/llms.txt b/public/llms.txt
index 4d0d0892d..ed0e5d8a2 100644
--- a/public/llms.txt
+++ b/public/llms.txt
@@ -63,10 +63,13 @@ On-chain features: pay-per-call, token launches, vanity wallets.
- [ETH Vanity (CREATE2)](https://three.ws/eth-vanity): Grind a vanity smart-contract address using the ThreeWSFactory CREATE2 deployer on BSC.
- [Pump Visualizer](https://three.ws/pump-visualizer): 3D visualizer of trending pump.fun tokens — live market data rendered as an interactive scene.
- [x402 Bazaar](https://three.ws/bazaar): Search and browse the x402 facilitator catalog. Filter by network, price, and extensions. Pay any service in one click.
+- [x402 Arbitrage](https://three.ws/arbitrage): Cross-provider price disparities surfaced live from the merged x402 facilitator catalog. Find the cheapest endpoint for any capability.
+- [x402 Providers](https://three.ws/providers): Quantified operator profiles for the x402 paid API catalog. Service counts, price bands, dominant categories, and the underlying listings.
- [GMGN Smart Money](https://three.ws/gmgn): Live smart-money signals narrated by a 3D AI agent. Tracks which wallets are loading on Solana, Ethereum, Base, and BNB Chain in real time.
- [Fact Checker](https://three.ws/fact-checker): Pay $0.10 per claim. The agent searches across authoritative sources, pays per retrieval via x402, and returns a verdict with cited evidence and a signed attestation.
- [Unstoppable Agent](https://three.ws/unstoppable): Live dashboard for an autonomous agent that funds itself via x402 micropayments. Watch its balance, earnings, costs, and daily reflections in real time.
- [Endpoint Shopper](https://three.ws/shopper): Describe a task and set a budget. An AI agent discovers relevant x402 endpoints via the Bazaar, chains them together, and synthesizes a final answer — paying per API call.
+- [Forever — etch a message into Bitcoin](https://three.ws/forever): Inscribe a message onto the Bitcoin blockchain. It stays there. Forever.
## Agent Tools
diff --git a/public/sitemap/index.html b/public/sitemap/index.html
index d958e6726..70b722880 100644
--- a/public/sitemap/index.html
+++ b/public/sitemap/index.html
@@ -366,6 +366,20 @@
<span class="sm-desc">Search and browse the x402 facilitator catalog. Filter by network, price, and extensions. Pay any service in one click.</span>
</a>
</li>
+ <li>
+ <a href="/arbitrage">
+ <span class="sm-title">x402 Arbitrage</span>
+ <span class="sm-path">/arbitrage</span>
+ <span class="sm-desc">Cross-provider price disparities surfaced live from the merged x402 facilitator catalog. Find the cheapest endpoint for any capability.</span>
+ </a>
+ </li>
+ <li>
+ <a href="/providers">
+ <span class="sm-title">x402 Providers</span>
+ <span class="sm-path">/providers</span>
+ <span class="sm-desc">Quantified operator profiles for the x402 paid API catalog. Service counts, price bands, dominant categories, and the underlying listings.</span>
+ </a>
+ </li>
<li>
<a href="/gmgn">
<span class="sm-title">GMGN Smart Money</span>
@@ -394,6 +408,13 @@
<span class="sm-desc">Describe a task and set a budget. An AI agent discovers relevant x402 endpoints via the Bazaar, chains them together, and synthesizes a final answer — paying per API call.</span>
</a>
</li>
+ <li>
+ <a href="/forever">
+ <span class="sm-title">Forever — etch a message into Bitcoin</span>
+ <span class="sm-path">/forever</span>
+ <span class="sm-desc">Inscribe a message onto the Bitcoin blockchain. It stays there. Forever.</span>
+ </a>
+ </li>
</ul>
</section>
diff --git a/scripts/audit-page-index.mjs b/scripts/audit-page-index.mjs
index 47a1f5767..b92100a7c 100644
--- a/scripts/audit-page-index.mjs
+++ b/scripts/audit-page-index.mjs
@@ -48,12 +48,19 @@ const IGNORE = new Set([
'/demos', // internal demo index
'/x402', // authenticated x402 checkout, not a discovery page
'/cz', // internal alias
+ '/app-classic', // legacy build of /app, superseded by the current viewer
+ '/create/studio', // editor shell reached in-flow from /create, not a landing
+ '/next/index.html', // internal next-gen SPA shell
+ '/aws', // AWS Marketplace entitlement landing, reached via marketplace redirect
+ '/paywall', // transactional gate, reached in-flow when access is required
]);
// Whole prefixes that are internal/auth-gated/embed and never belong in the
// public discovery index.
const IGNORE_PREFIXES = [
'/dashboard/', // authenticated sub-pages
+ '/dashboard-classic/', // legacy authenticated dashboard, superseded by /dashboard
+ '/aws-marketplace/', // AWS Marketplace post-subscribe transactional pages
'/demo/', // demos
'/lobehub/', // partner embed iframes
];
diff --git a/scripts/bundle-api.mjs b/scripts/bundle-api.mjs
index 374804147..b88489bca 100644
--- a/scripts/bundle-api.mjs
+++ b/scripts/bundle-api.mjs
@@ -97,7 +97,7 @@ const EXTERNALS = [
'gltf-validator',
'jsdom',
'ethers',
- 'elevenlabs',
+ '@elevenlabs/elevenlabs-js',
'playwright',
'playwright-core',
'puppeteer',
diff --git a/scripts/mobile-audit.mjs b/scripts/mobile-audit.mjs
new file mode 100644
index 000000000..3e2e07516
--- /dev/null
+++ b/scripts/mobile-audit.mjs
@@ -0,0 +1,104 @@
+import { chromium } from 'playwright';
+
+const BASE = 'http://localhost:3000';
+const PAGES = process.argv.slice(2).length
+ ? process.argv.slice(2)
+ : ['/', '/discover', '/agents', '/pay', '/login', '/start', '/create'];
+
+const browser = await chromium.launch();
+const ctx = await browser.newContext({
+ viewport: { width: 390, height: 844 },
+ deviceScaleFactor: 3,
+ isMobile: true,
+ hasTouch: true,
+ userAgent:
+ 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1',
+});
+
+const report = {};
+for (const path of PAGES) {
+ const page = await ctx.newPage();
+ const consoleErrors = [];
+ page.on('console', (m) => {
+ if (m.type() === 'error') consoleErrors.push(m.text().slice(0, 200));
+ });
+ page.on('pageerror', (e) => consoleErrors.push('PAGEERROR: ' + e.message.slice(0, 200)));
+ try {
+ await page.goto(BASE + path, { waitUntil: 'networkidle', timeout: 20000 });
+ } catch (e) {
+ await page.goto(BASE + path, { waitUntil: 'domcontentloaded', timeout: 20000 }).catch(() => {});
+ }
+ await page.waitForTimeout(1200);
+
+ const data = await page.evaluate(() => {
+ const vw = window.innerWidth;
+ const docW = document.documentElement.scrollWidth;
+ // Elements that overflow horizontally past the viewport
+ const overflowers = [];
+ const all = document.querySelectorAll('body *');
+ for (const el of all) {
+ const r = el.getBoundingClientRect();
+ if (r.width === 0 || r.height === 0) continue;
+ const style = getComputedStyle(el);
+ if (style.position === 'fixed') continue;
+ if (r.right > vw + 1.5 || r.left < -1.5) {
+ // skip elements clipped by an ancestor (marquees / carousels / scrollers)
+ let clipped = false;
+ for (let p = el.parentElement; p && p !== document.body; p = p.parentElement) {
+ const ps = getComputedStyle(p);
+ const ox = ps.overflowX;
+ if (ox === 'hidden' || ox === 'clip' || ox === 'auto' || ox === 'scroll') {
+ clipped = true;
+ break;
+ }
+ }
+ if (clipped) continue;
+ overflowers.push({
+ tag: el.tagName.toLowerCase(),
+ cls: (el.className && typeof el.className === 'string' ? el.className : '').slice(0, 60),
+ id: el.id || '',
+ left: Math.round(r.left),
+ right: Math.round(r.right),
+ w: Math.round(r.width),
+ });
+ }
+ }
+ // Tap targets too small (interactive elements < 40px)
+ const smallTargets = [];
+ const interactive = document.querySelectorAll(
+ 'a[href], button, input, select, textarea, [role="button"], [onclick]'
+ );
+ for (const el of interactive) {
+ const r = el.getBoundingClientRect();
+ if (r.width === 0 || r.height === 0) continue;
+ const style = getComputedStyle(el);
+ if (style.display === 'none' || style.visibility === 'hidden') continue;
+ if (r.height < 32 || r.width < 24) {
+ smallTargets.push({
+ tag: el.tagName.toLowerCase(),
+ cls: (el.className && typeof el.className === 'string' ? el.className : '').slice(0, 50),
+ text: (el.textContent || '').trim().slice(0, 30),
+ w: Math.round(r.width),
+ h: Math.round(r.height),
+ });
+ }
+ }
+ // Text that may be too small
+ return {
+ vw,
+ docW,
+ hasHorizontalScroll: docW > vw + 1,
+ overflowCount: overflowers.length,
+ overflowers: overflowers.slice(0, 25),
+ smallTargetCount: smallTargets.length,
+ smallTargets: smallTargets.slice(0, 20),
+ title: document.title,
+ };
+ });
+ data.consoleErrors = consoleErrors.slice(0, 8);
+ report[path] = data;
+ await page.close();
+}
+
+await browser.close();
+console.log(JSON.stringify(report, null, 2));
diff --git a/src/agent-home-pumpfun.js b/src/agent-home-pumpfun.js
index f19f3bf1a..969df6e12 100644
--- a/src/agent-home-pumpfun.js
+++ b/src/agent-home-pumpfun.js
@@ -679,8 +679,14 @@ export function mountPumpFunCard({ panel, identity, skills, memory, protocol })
unsubProtocol = () => protocol.off?.(ACTION_TYPES.SKILL_DONE, handler);
}
+ let _refreshing = false;
refresh();
- refreshTimer = setInterval(() => state.mint && !state.tradeOpen && refresh(), REFRESH_MS);
+ refreshTimer = setInterval(() => {
+ if (state.mint && !state.tradeOpen && !_refreshing) {
+ _refreshing = true;
+ refresh().finally(() => { _refreshing = false; });
+ }
+ }, REFRESH_MS);
return {
destroy() {
diff --git a/src/agent-home.js b/src/agent-home.js
index 795adbf45..04ea301b4 100644
--- a/src/agent-home.js
+++ b/src/agent-home.js
@@ -495,7 +495,7 @@ export class AgentHome {
_renderMemoryBar() {
if (!this.identity.memory) return '';
const stats = this.identity.memory.stats;
- if (!stats.total) return '<span class="agent-mem-empty">no memories yet</span>';
+ if (!stats || !stats.total) return '<span class="agent-mem-empty">no memories yet</span>';
return (
Object.entries(stats)
@@ -567,6 +567,7 @@ export class AgentHome {
this._emotionInterval = setInterval(() => {
if (!this.avatar) return;
const state = this.avatar.emotionState;
+ if (!state) return;
const dominant = Object.entries(state).reduce(
(a, b) => (b[1] > a[1] ? b : a),
['neutral', 0],
diff --git a/src/home-act2-viewer.js b/src/home-act2-viewer.js
index 1d1bc52ed..21a490007 100644
--- a/src/home-act2-viewer.js
+++ b/src/home-act2-viewer.js
@@ -30,6 +30,14 @@ import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js';
const CROSSFADE = 0.35;
+/** Dispose a material and any texture maps it references. */
+function disposeMaterial(mat) {
+ for (const value of Object.values(mat)) {
+ if (value && value.isTexture) value.dispose();
+ }
+ mat.dispose?.();
+}
+
export class Act2Viewer {
constructor(canvas, { fov = 14 } = {}) {
this.canvas = canvas;
@@ -73,12 +81,13 @@ export class Act2Viewer {
this.onClipsReady = null;
this._resize();
- const ro = new ResizeObserver(() => this._resize());
- ro.observe(canvas);
+ this._ro = new ResizeObserver(() => this._resize());
+ this._ro.observe(canvas);
this._disposed = false;
+ this._raf = null;
this._tick = this._tick.bind(this);
- requestAnimationFrame(this._tick);
+ this._raf = requestAnimationFrame(this._tick);
}
_resize() {
@@ -101,14 +110,33 @@ export class Act2Viewer {
this.model.rotation.y = this._modelYaw;
}
this.renderer.render(this.scene, this.camera);
- requestAnimationFrame(this._tick);
+ this._raf = requestAnimationFrame(this._tick);
}
+ /**
+ * Tear down the renderer so leaving the home section frees the WebGL
+ * context instead of leaking a running raf loop + GPU buffers. Idempotent.
+ */
dispose() {
+ if (this._disposed) return;
this._disposed = true;
+ if (this._raf) cancelAnimationFrame(this._raf);
+ this._raf = null;
+ this._ro?.disconnect();
if (this.mixer) { this.mixer.stopAllAction(); this.mixer = null; }
if (this.model) { this.scene.remove(this.model); this.model = null; }
+ // Release GPU-side geometry/material/texture handles before the context.
+ this.scene?.traverse((obj) => {
+ obj.geometry?.dispose?.();
+ const mat = obj.material;
+ if (Array.isArray(mat)) mat.forEach(disposeMaterial);
+ else if (mat) disposeMaterial(mat);
+ });
+ this.scene?.environment?.dispose?.();
+ this.clips.clear();
+ this.currentAction = null;
this.renderer.dispose();
+ this.renderer.forceContextLoss?.();
}
async _loadManifest() {
diff --git a/src/home-v4-scroll.js b/src/home-v4-scroll.js
index 861903f84..811efd9eb 100644
--- a/src/home-v4-scroll.js
+++ b/src/home-v4-scroll.js
@@ -99,6 +99,7 @@ function observeViewerVisibility(canvas, viewer) {
if (!window.Act2Viewer) return;
viewer = new window.Act2Viewer(canvas, { fov: 14 });
observeViewerVisibility(canvas, viewer);
+ window.addEventListener('pagehide', () => viewer?.dispose(), { once: true });
viewer.onClipsReady = (clips) => {
buildChips(clips);
@@ -160,6 +161,7 @@ function observeViewerVisibility(canvas, viewer) {
if (!window.Act2Viewer) return;
const viewer = new window.Act2Viewer(canvas, { fov: 14 });
observeViewerVisibility(canvas, viewer);
+ window.addEventListener('pagehide', () => viewer?.dispose(), { once: true });
await viewer.loadModel('/avatars/cz.glb', { autoPlay: false });
const waveClip = viewer.listAvailableClips().find(c => /wave|waving/i.test(c.name));
if (waveClip) {
diff --git a/src/marketplace.js b/src/marketplace.js
index 657fdbf4d..6c7b4713e 100644
--- a/src/marketplace.js
+++ b/src/marketplace.js
@@ -427,6 +427,7 @@ async function loadList(reset = false) {
if (state.sort) url.searchParams.set('sort', state.sort);
if (state.cursor) url.searchParams.set('cursor', state.cursor);
const r = await fetch(url);
+ if (!r.ok) throw new Error(`HTTP ${r.status}`);
const j = await r.json();
// Real endpoint wraps as { data: { items, next_cursor } }; legacy mock returns a bare array.
const rawItems = Array.isArray(j) ? j : (j?.data?.items ?? []);
@@ -596,8 +597,10 @@ async function loadTheme() {
function renderTheme() {
const strip = $('market-theme-strip');
if (!strip || !state.theme) return;
- $('market-theme-title').textContent = state.theme.title;
- $('market-theme-blurb').textContent = state.theme.blurb || '';
+ const titleEl = $('market-theme-title');
+ const blurbEl = $('market-theme-blurb');
+ if (titleEl) titleEl.textContent = state.theme.title;
+ if (blurbEl) blurbEl.textContent = state.theme.blurb || '';
const cta = $('market-theme-cta');
if (state.theme.tag) {
cta.hidden = false;
@@ -1110,6 +1113,16 @@ function openAvatarModal(avatar) {
if (bar) bar.style.width = Math.round((e.detail?.totalProgress || 0) * 100) + '%';
});
mv.addEventListener('load', () => { progressEl.remove(); mv.style.opacity = '1'; }, { once: true });
+ const loadTimeout = setTimeout(() => {
+ const label = progressEl.querySelector('.modal-load-label');
+ if (label) label.textContent = 'Failed to load 3D — try refreshing.';
+ }, 15_000);
+ mv.addEventListener('error', () => {
+ clearTimeout(loadTimeout);
+ const label = progressEl.querySelector('.modal-load-label');
+ if (label) label.textContent = 'Failed to load 3D model.';
+ }, { once: true });
+ mv.addEventListener('load', () => clearTimeout(loadTimeout), { once: true });
$('avatar-modal-title').textContent = avatar.name || 'Untitled avatar';
$('avatar-modal-desc').textContent =
diff --git a/src/pump/dashboard.js b/src/pump/dashboard.js
index 67b080383..ee77e5b8b 100644
--- a/src/pump/dashboard.js
+++ b/src/pump/dashboard.js
@@ -11,24 +11,26 @@ async function main() {
try {
const resp = await fetch(`/api/pump/dashboard?agent_id=${agentId}`, { credentials: 'include' });
if (!resp.ok) {
- const err = await resp.json();
- throw new Error(err.error_description || 'Failed to load dashboard data.');
+ const err = await resp.json().catch(() => ({}));
+ throw new Error(err.error_description || `HTTP ${resp.status}`);
}
const data = await resp.json();
- document.getElementById('price-usd').textContent = `$${data.price?.value.toFixed(6) || 'N/A'}`;
- document.getElementById('market-cap').textContent = `$${(data.price?.marketCap || 'N/A')}`;
+ document.getElementById('price-usd').textContent =
+ data.price?.value != null ? `$${data.price.value.toFixed(6)}` : 'N/A';
+ document.getElementById('market-cap').textContent =
+ data.price?.marketCap != null ? `$${data.price.marketCap}` : 'N/A';
const historyEl = document.getElementById('trade-history');
- historyEl.innerHTML = data.history.map(tx => `
+ historyEl.innerHTML = (data.history || []).map(tx => `
<div class="trade-item">
- <span class="${tx.side.toLowerCase()}">${tx.side}</span>
- <span>${tx.amount.toFixed(2)}</span>
- <span>$${(tx.priceUsd * tx.amount).toFixed(2)}</span>
+ <span class="${(tx.side || '').toLowerCase()}">${tx.side || '?'}</span>
+ <span>${tx.amount != null ? Number(tx.amount).toFixed(2) : '0'}</span>
+ <span>$${(tx.priceUsd != null && tx.amount != null) ? (tx.priceUsd * tx.amount).toFixed(2) : '0'}</span>
<a href="https://solscan.io/tx/${tx.txHash}" target="_blank" rel="noopener">View</a>
</div>
- `).join('');
-
+ `).join('') || '<div class="trade-empty">No recent trades.</div>';
+
loadingEl.hidden = true;
dashboardEl.hidden = false;