Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
Distinguish auth vs health provider cooldowns; downgrade client telemetry noise
nirholas4e17c94e8a6e
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c1f4f1b5e..a708ab6b2 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,6 +12,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Agents can autonomously trade USDC-paired coins** — An agent's own wallet can now buy and sell USDC-paired coins on its own — not just SOL ones. Until now the autonomous lanes (an agent's buy/sell endpoints, scheduled buybacks, and creator-fee distributions) assumed every coin priced in SOL, so on a USDC coin they would have built a SOL trade the market refuses. Now the agent reads each coin's real pairing straight from the chain and trades in the matching currency: a USDC coin is bought and sold in USDC, with the agent's USDC account opened automatically and its balance checked up front so a trade fails clearly instead of reverting on-chain. Buybacks and fee distributions follow the same rule — they run in the coin's own currency, and if a coin's setup genuinely can't support a run, it's recorded with the reason rather than silently skipped. Every trade is now logged with the exact quote asset and amount, so prices and volumes stay correct for USDC and SOL coins alike. SOL coins behave exactly as before. (`/pump-dashboard`) `[feature]`- **Autonomous coin buybacks and creator-fee distributions now run on schedule** — Coins launched through three.ws with autopilot enabled now have their buybacks and creator-fee distributions executed automatically on an hourly schedule, instead of waiting for a manual trigger. A new balance watchdog checks every Solana signer the platform uses to pay on-chain fees and alerts the team the moment one runs low, so autopilot never silently stalls for lack of gas. No action needed from coin owners — it just works in the background. `[improvement, infra]`- **Buy and sell USDC-paired coins straight from the trade widget** — The in-world trade widget now speaks both currencies. Open Buy on a coin and the widget reads its real pairing from the chain: a SOL coin asks for SOL exactly as before, while a USDC-paired coin denominates the amount in USDC, shows your wallet's USDC balance, and prices and settles the trade in USDC. A new Sell tab lets you sell a coin you hold back to its quote asset — pick 25%, 50%, or Max of your balance, see the live payout, and sign once; for USDC coins the payout account is opened for you automatically in the same transaction. Every state is handled: not enough USDC offers a one-tap Add-funds flow, a moved price explains your slippage, and a cancelled signature is quietly acknowledged. The whole flow is your own wallet, signed in your browser, with a Solscan link the moment it lands. (`/play`) `[feature]`+- **Chat never stalls on a down AI model — instant, quiet failover** — If you pick a specific AI model for the agent (say Claude) and our key for that provider is temporarily unavailable, chat now hands you an answer instantly from a healthy free model instead of pausing on the dead provider. Previously the app re-tried the unavailable provider on the very first attempt of every single message — adding a little delay each time and filling our logs with repeat warnings. Now a provider with a key or billing problem is set aside for a few minutes after the first failure and skipped up front, even when it was the one you explicitly chose, so the next message goes straight to a model that works. Free-first, always a working fallback. (`/chat`) `[improvement]`- **Clearer launch & trade errors, and a graduated badge on coins** — When a token launch or an in-world trade can't go through, the app now tells you exactly why and what to do next — "Not enough SOL to cover the launch + network fees," "Price moved beyond your slippage limit," "You cancelled the signature in your wallet," or "Couldn't reach the Solana network" — instead of a single catch-all "Connection error." Coins also show their lifecycle at a glance: the trade panel carries a badge marking whether a coin is still on its bonding curve or has graduated to the PumpSwap AMM, so a graduated coin is unmistakable. Backed by new end-to-end browser tests that drive the full four-step launch flow and the buy/sell widget so this conversion path can't silently break. (`/pump-dashboard`) `[improvement]`- **Launchpad Studio: pick your avatar from your own agents and the gallery** — Building a launchpad in Launchpad Studio (three.ws/launchpad) no longer means hunting down a model URL by hand. The avatar picker now shows three sections: your own three.ws agents (when you're signed in), the platform avatar gallery with a Show more button to browse deeper, and a collapsed Or enter a URL field for power users who want to paste a custom .glb. Thumbnails load lazily, the selected avatar updates the live 3D preview instantly, and your choice is saved with the published page. (`/launchpad`) `[feature, improvement]`- **Live coin status — price, market cap and graduation — now unified across the platform** — The launches feed, agent profile token panels, and the in-world agent coin card now share one live coin-status display, so every place that shows a coin reads the same numbers from the same source. Launch cards now stream the coin's real logo, USD price, market cap, a graduation progress ring and time since launch — not just market cap — with the orbital fingerprint as a placeholder until the logo loads. Agent profiles show a live price-and-graduation chip in the token panel and per-coin market caps in the launch history, and the agent home card's market readout is now consistent with the rest of the platform. Each card refreshes on its own and degrades gracefully to a Retry if pump.fun is briefly unreachable. (`/launches`) `[improvement]`diff --git a/api/_lib/provider-health.js b/api/_lib/provider-health.jsindex e3fa15c1b..a8b4d17d8 100644--- a/api/_lib/provider-health.js+++ b/api/_lib/provider-health.js@@ -30,29 +30,43 @@ export const AUTH_COOLDOWN_SECONDS = 300;/*** Record that `provider` is unhealthy, so it is skipped for `seconds`. The* cache TTL is the cooldown — presence of the key means "in cooldown", and it- * expires on its own. Fire-and-forget friendly; never throws.+ * expires on its own. `reason` distinguishes a transient throttle ('health':+ * 429/5xx/network blip) from a deploy-wide auth/billing failure ('auth':+ * 401/403/402); selection uses it to decide whether an *explicit* request for+ * the provider may still bypass the cooldown. Fire-and-forget friendly; never+ * throws.*/-export async function markProviderCooldown(provider, seconds = DEFAULT_COOLDOWN_SECONDS) {+export async function markProviderCooldown(provider, seconds = DEFAULT_COOLDOWN_SECONDS, reason = 'health') {if (!provider) return;try {- await cacheSet(`${COOLDOWN_PREFIX}${provider}`, { until: Date.now() + seconds * 1000 }, seconds);+ await cacheSet(+ `${COOLDOWN_PREFIX}${provider}`,+ { until: Date.now() + seconds * 1000, reason },+ seconds,+ );} catch {// Cache unavailable — degrade silently to no-cooldown.}}/**- * Given a list of provider names, return the Set of those currently in a- * cooldown window. Reads are coalesced/memoized by the cache layer, so the- * handful of GETs collapse to roughly one cache round-trip. Never throws.+ * Given a list of provider names, return a Map of those currently in a cooldown+ * window to the reason they were cooled ('auth' for a 401/403/402 key/billing+ * failure, 'health' for a 429/5xx/network blip). `Map.has(name)` answers "is it+ * cooling?" — a drop-in replacement for the old Set — while `Map.get(name)`+ * lets the caller tell a dead key (never honour, even when explicitly asked for)+ * apart from a transient throttle (an explicit request may still go through).+ * Pre-`reason` cache entries default to 'health'. Reads are coalesced/memoized+ * by the cache layer, so the handful of GETs collapse to roughly one cache+ * round-trip. Never throws.*/export async function providersInCooldown(providers) {- const cooling = new Set();+ const cooling = new Map();await Promise.all(providers.map(async (name) => {try {const hit = await cacheGet(`${COOLDOWN_PREFIX}${name}`);- if (hit) cooling.add(name);+ if (hit) cooling.set(name, hit.reason === 'auth' ? 'auth' : 'health');} catch {// Treat an unreadable key as "not in cooldown".}diff --git a/api/chat.js b/api/chat.jsindex fb3ec643f..f54d5d427 100644--- a/api/chat.js+++ b/api/chat.js@@ -627,7 +627,7 @@ export default wrap(async (req, res) => {// 401), and fail over to the next provider.if (upstream.status === 401 || upstream.status === 403 || upstream.status === 402) {const text = await upstream.text().catch(() => '');- void markProviderCooldown(route.name, AUTH_COOLDOWN_SECONDS);+ void markProviderCooldown(route.name, AUTH_COOLDOWN_SECONDS, 'auth');let next = routeIdx + 1;while (next < fallbackRoutes.length && fallbackRoutes[next].name === route.name) next++;if (next < fallbackRoutes.length && Date.now() < deadline) {@@ -894,7 +894,7 @@ async function governActions(actions, userMessage) {// ── Provider selection ───────────────────────────────────────────────────────-function pickProvider(requested, model, userKeys = {}, cooldown = new Set()) {+function pickProvider(requested, model, userKeys = {}, cooldown = new Map()) {// Fall back in DEFAULT_PROVIDER_ORDER (free providers first), not the// PROVIDERS object order — and never silently fall into watsonx/orchestrate,// which are explicit-selection-only providers.@@ -902,16 +902,21 @@ function pickProvider(requested, model, userKeys = {}, cooldown = new Set()) {? [requested, ...DEFAULT_PROVIDER_ORDER.filter((p) => p !== requested)]: DEFAULT_PROVIDER_ORDER;- // Two passes: first skip providers in a health cooldown, then — only if that- // leaves nothing configured — ignore cooldowns so a request never 503s purely- // because every healthy provider happens to be cooling down. An explicitly- // requested provider is never cooldown-skipped (the caller asked for it).+ // Two passes: first skip providers in a cooldown, then — only if that leaves+ // nothing configured — ignore cooldowns so a request never 503s purely because+ // every healthy provider happens to be cooling down. An explicitly requested+ // provider bypasses a transient *health* cooldown (the caller asked for it, and+ // a 45s throttle clears on its own), but is still skipped on an *auth* cooldown:+ // a 401/403/402 key is broken deploy-wide, so honouring the request would+ // re-probe a dead key on attempt-0 of every call — wasted latency plus a warning+ // per request — when the failover to a healthy free provider is already certain.const resolve = (skipCooldown) => {for (const name of order) {const cfg = PROVIDERS[name];const apiKey = userKeys[name] || process.env[cfg.envKey];if (!apiKey) continue;- if (skipCooldown && name !== requested && cooldown.has(name)) continue;+ if (skipCooldown && cooldown.has(name) && (name !== requested || cooldown.get(name) === 'auth'))+ continue;// watsonx needs both a key and a project/space scope to serve a model;// Orchestrate needs both a key and its endpoint URL.if (name === 'watsonx' && !watsonxConfig().configured) continue;@@ -985,7 +990,7 @@ function eligibleAsFallback(modelId) {return meta.tools === true && !meta.moderationGated;}-function buildFallbackChain(primary, userKeys = {}, cooldown = new Set()) {+function buildFallbackChain(primary, userKeys = {}, cooldown = new Map()) {const chain = [primary];const seen = new Set([`${primary.name}:${primary.model}`]);diff --git a/api/client-errors.js b/api/client-errors.jsindex 8087a6565..4c6bb7494 100644--- a/api/client-errors.js+++ b/api/client-errors.js@@ -140,15 +140,21 @@ export default wrap(async (req, res) => {};for (const event of events) {- // One line per event keeps Vercel log search precise:- // filter on "[client-error]" then on message/page substrings.- console.error('[client-error]', JSON.stringify({ ...event, ...context }));-- // Resource 404s and CSP reports stay log-only — they group terribly as- // exceptions and extensions trigger CSP constantly. Real JS errors carry- // their original browser stack into Sentry and page the ops channel- // (sendOpsAlert dedups per message per hour).- if (event.type !== 'resource' && event.type !== 'csp') {+ // Resource load failures (a CDN blip, an offline mobile network, a+ // third-party embed like Cloudflare Turnstile being briefly unreachable)+ // and CSP reports (browser extensions trip these constantly) are client-side+ // telemetry, not server faults — nothing in our deploy is broken when they+ // fire. Log them at info so the error/warning dashboards stay actionable;+ // they remain searchable as "[client-error]" + type. Genuine JS faults keep+ // error severity. One line per event keeps Vercel log search precise.+ const telemetryOnly = event.type === 'resource' || event.type === 'csp';+ const line = JSON.stringify({ ...event, ...context });+ if (telemetryOnly) console.info('[client-error]', line);+ else console.error('[client-error]', line);++ // Real JS errors carry their original browser stack into Sentry and page the+ // ops channel (sendOpsAlert dedups per message per hour); telemetry does not.+ if (!telemetryOnly) {const synthetic = new Error(event.message);synthetic.name = event.name || `client.${event.type}`;if (event.stack) synthetic.stack = event.stack;diff --git a/api/marketplace/[action].js b/api/marketplace/[action].jsindex 3edc90760..fef0485e1 100644--- a/api/marketplace/[action].js+++ b/api/marketplace/[action].js@@ -827,7 +827,7 @@ async function handlePreview(req, res, id) {const authBilling = upstream.status === 401 || upstream.status === 403 || upstream.status === 402;const transient = upstream.status === 429 || upstream.status >= 500;const failable = transient || authBilling;- if (authBilling) void markProviderCooldown(route.name, AUTH_COOLDOWN_SECONDS);+ if (authBilling) void markProviderCooldown(route.name, AUTH_COOLDOWN_SECONDS, 'auth');else if (transient) void markProviderCooldown(route.name);const canFailOver = i + 1 < routes.length && failable;if (canFailOver) continue;diff --git a/data/changelog.json b/data/changelog.jsonindex b4401e8e7..507c3c46d 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,13 @@{"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-06-15",+ "title": "Chat never stalls on a down AI model — instant, quiet failover",+ "summary": "If you pick a specific AI model for the agent (say Claude) and our key for that provider is temporarily unavailable, chat now hands you an answer instantly from a healthy free model instead of pausing on the dead provider. Previously the app re-tried the unavailable provider on the very first attempt of every single message — adding a little delay each time and filling our logs with repeat warnings. Now a provider with a key or billing problem is set aside for a few minutes after the first failure and skipped up front, even when it was the one you explicitly chose, so the next message goes straight to a model that works. Free-first, always a working fallback.",+ "tags": ["improvement"],+ "link": "/chat"+ },{"date": "2026-06-15","title": "The Forge always returns a model — the default never dead-ends",diff --git a/public/changelog.json b/public/changelog.jsonindex 646b1e1f8..984e42217 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-15T06:33:09.480Z",+ "generated_at": "2026-06-15T06:50:46.471Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -68,6 +68,16 @@"feature"]},+ {+ "date": "2026-06-15",+ "type": "update",+ "title": "Chat never stalls on a down AI model — instant, quiet failover",+ "summary": "If you pick a specific AI model for the agent (say Claude) and our key for that provider is temporarily unavailable, chat now hands you an answer instantly from a healthy free model instead of pausing on the dead provider. Previously the app re-tried the unavailable provider on the very first attempt of every single message — adding a little delay each time and filling our logs with repeat warnings. Now a provider with a key or billing problem is set aside for a few minutes after the first failure and skipped up front, even when it was the one you explicitly chose, so the next message goes straight to a model that works. Free-first, always a working fallback.",+ "link": "/chat",+ "tags": [+ "improvement"+ ]+ },{"date": "2026-06-15","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 9523a5f45..ff9329d07 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -54,6 +54,14 @@<category>feature</category><description>The in-world trade widget now speaks both currencies. Open Buy on a coin and the widget reads its real pairing from the chain: a SOL coin asks for SOL exactly as before, while a USDC-paired coin denominates the amount in USDC, shows your wallet's USDC balance, and prices and settles the trade in USDC. A new Sell tab lets you sell a coin you hold back to its quote asset — pick 25%, 50%, or Max of your balance, see the live payout, and sign once; for USDC coins the payout account is opened for you automatically in the same transaction. Every state is handled: not enough USDC offers a one-tap Add-funds flow, a moved price explains your slippage, and a cancelled signature is quietly acknowledged. The whole flow is your own wallet, signed in your browser, with a Solscan link the moment it lands.</description></item>+ <item>+ <title>Chat never stalls on a down AI model — instant, quiet failover</title>+ <link>https://three.ws/chat</link>+ <guid isPermaLink="false">2026-06-15:Chat never stalls on a down AI model — instant, quiet failover</guid>+ <pubDate>Mon, 15 Jun 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>If you pick a specific AI model for the agent (say Claude) and our key for that provider is temporarily unavailable, chat now hands you an answer instantly from a healthy free model instead of pausing on the dead provider. Previously the app re-tried the unavailable provider on the very first attempt of every single message — adding a little delay each time and filling our logs with repeat warnings. Now a provider with a key or billing problem is set aside for a few minutes after the first failure and skipped up front, even when it was the one you explicitly chose, so the next message goes straight to a model that works. Free-first, always a working fallback.</description>+ </item><item><title>Clearer launch & trade errors, and a graduated badge on coins</title><link>https://three.ws/pump-dashboard</link>diff --git a/public/error-reporter.js b/public/error-reporter.jsindex 5b643a7d8..35998a82b 100644--- a/public/error-reporter.js+++ b/public/error-reporter.js@@ -195,6 +195,16 @@return true;}if (report.type === 'resource' && report.source) {+ // A cross-origin resource that fails to load is outside our control: the+ // Cloudflare Turnstile/CAPTCHA script Privy pulls from+ // challenges.cloudflare.com, a third-party embed, a wallet in-app webview+ // blocking an external host, or a user's network dropping a request to+ // someone else's CDN. We serve our own assets correctly but cannot fix a+ // third party's CDN or a user's blocker, so a cross-origin resource+ // failure is noise, not an actionable site fault. Every first-party asset+ // — including the /cdn proxy — is same-origin, so genuine 404s on our own+ // files (e.g. /three.svg) still report.+ if (isThirdPartyResource(report.source)) return true;// A <model-viewer> whose mesh fails to load (slow/aborted GLB fetch// under mobile memory or network pressure, a lost WebGL context) fires// a resource error but degrades to its poster on its own — the user@@ -221,6 +231,17 @@return strip(url) === strip(location.href);}+ // True when a resource URL points at a different origin than the page. Used to+ // drop cross-origin (third-party) resource-load failures we can't act on. An+ // unparseable URL is treated as third-party — it isn't one of our own assets.+ function isThirdPartyResource(url) {+ try {+ return new URL(url, location.href).origin !== location.origin;+ } catch {+ return true;+ }+ }+function enqueue(report) {if (totalAccepted >= MAX_EVENTS_PER_PAGE || shouldIgnore(report)) return;const signature = [report.type, report.message, report.source, report.line].join('|');diff --git a/public/features.json b/public/features.jsonindex 0a491fa2d..a92dcc69e 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-15T06:33:09.462Z",+ "generated_at": "2026-06-15T06:50:46.458Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/tests/api/client-errors.test.js b/tests/api/client-errors.test.jsindex ce6ea2a55..c923c74ae 100644--- a/tests/api/client-errors.test.js+++ b/tests/api/client-errors.test.js@@ -87,14 +87,17 @@ const errorEvent = (overrides = {}) => ({});let consoleError;+let consoleInfo;beforeEach(() => {state.rateLimited = false;captureException.mockClear();sendOpsAlert.mockClear();consoleError = vi.spyOn(console, 'error').mockImplementation(() => {});+ consoleInfo = vi.spyOn(console, 'info').mockImplementation(() => {});});afterEach(() => {consoleError.mockRestore();+ consoleInfo.mockRestore();});describe('api/client-errors', () => {@@ -200,6 +203,27 @@ describe('api/client-errors', () => {expect(sendOpsAlert.mock.calls[0][0]).toContain('client error on https://three.ws/play');});+ it('logs resource failures at info severity, never as errors', async () => {+ // A failed img/script (CDN blip, offline mobile network, third-party embed+ // unreachable) is client telemetry, not a server fault — it must not surface+ // in the error/warning dashboards. Still logged + searchable, just at info.+ const { status } = await invoke({+ body: {+ page: 'https://three.ws/login',+ events: [+ { type: 'resource', tag: 'img', message: 'failed to load img', source: 'https://three.ws/three.svg' },+ ],+ },+ });+ expect(status).toBe(202);+ const infoLine = consoleInfo.mock.calls.find(([tag]) => tag === '[client-error]');+ expect(infoLine).toBeDefined();+ expect(JSON.parse(infoLine[1]).source).toBe('https://three.ws/three.svg');+ expect(consoleError.mock.calls.some(([tag]) => tag === '[client-error]')).toBe(false);+ expect(captureException).not.toHaveBeenCalled();+ expect(sendOpsAlert).not.toHaveBeenCalled();+ });+it('ingests report-uri CSP reports (application/csp-report)', async () => {const { status, body } = await invoke({contentType: 'application/csp-report',@@ -215,13 +239,16 @@ describe('api/client-errors', () => {});expect(status).toBe(202);expect(body.received).toBe(1);+ // CSP reports are client telemetry, not server faults — logged at info, not+ // error, so the error/warning dashboards stay actionable.const logged = JSON.parse(- consoleError.mock.calls.find(([tag]) => tag === '[client-error]')[1],+ consoleInfo.mock.calls.find(([tag]) => tag === '[client-error]')[1],);expect(logged.type).toBe('csp');expect(logged.message).toBe('CSP violation: script-src');expect(logged.source).toBe('https://evil.example/x.js');- // CSP stays log-only: no Sentry, no ops page.+ // CSP stays log-only and below error severity: no error line, no Sentry, no ops page.+ expect(consoleError.mock.calls.some(([tag]) => tag === '[client-error]')).toBe(false);expect(captureException).not.toHaveBeenCalled();expect(sendOpsAlert).not.toHaveBeenCalled();});@@ -243,7 +270,7 @@ describe('api/client-errors', () => {expect(status).toBe(202);expect(body.received).toBe(1);const logged = JSON.parse(- consoleError.mock.calls.find(([tag]) => tag === '[client-error]')[1],+ consoleInfo.mock.calls.find(([tag]) => tag === '[client-error]')[1],);expect(logged.message).toBe('CSP violation: object-src');});diff --git a/tests/api/provider-health.test.js b/tests/api/provider-health.test.jsindex 1c44d8ab7..f568ec7e2 100644--- a/tests/api/provider-health.test.js+++ b/tests/api/provider-health.test.js@@ -40,4 +40,16 @@ describe('provider-health circuit breaker', () => {await expect(markProviderCooldown('')).resolves.toBeUndefined();await expect(markProviderCooldown(undefined)).resolves.toBeUndefined();});++ it('tags the cooldown reason so selection can tell a dead key from a throttle', async () => {+ // Default (transient throttle) reports 'health'; an explicit auth/billing+ // failure reports 'auth'. pickProvider() skips an *explicitly requested*+ // provider only when it is auth-cooled, so a deploy-wide-bad key is not+ // re-probed on attempt-0 of every request.+ await markProviderCooldown('groq', 30);+ await markProviderCooldown('anthropic', 30, 'auth');+ const cooling = await providersInCooldown(ALL);+ expect(cooling.get('groq')).toBe('health');+ expect(cooling.get('anthropic')).toBe('auth');+ });});