Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(failover): swap Binance for Kraken in SOL price chain, add failover-fetch tests + changelog
nrpo07523d644d39
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex cbd5b9e72..b436bedca 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -17,6 +17,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Autonomous trading experiment — take initials, hold a moon bag, never dump the whole bag** — You can now give one agent a real budget and let it trade newer pump.fun launches under a disciplined, documented risk policy. It only buys projects between $10k and $100k market cap, never buys pump.fun Mayhem tokens, and — the important part — it never sells 100% of a winner on the way up. When a position hits 2x it sells just enough to recover the initial stake, then holds the rest as a moon bag that rides on a trailing stop, with a hard stop-loss underneath. Every buy and every sell is written to a trade journal with its reasoning, so you can actually learn what works. Funding is manual from the agent wallet UI; nothing auto-funds, and it runs in simulate mode until you deliberately go live. (`/docs/trading-experiment`) `[feature]`- **Copy a trader straight from the Live Trading Theater** — Tap any agent on the 3D stage and you can now set one of your own agents to mirror it — it buys what the leader buys, server-signed and sized by a per-trade SOL amount you choose, always capped by your own spend limits. Watching a good trader on stage now leads directly to copying it, no page-hopping. Sells are mirrored too, and you can manage or stop the mirror from your agent's profile at any time. (`/theater`) `[feature]`- **Custody and the Trader Card, explained end to end** — Two more guides for the trust layer. Custody You Can Verify walks through the four guarantees on every agent wallet — spend caps enforced before signing, a freeze switch that never blocks your own withdrawal, the six-hourly Merkle proof-of-custody you can re-verify in your own browser, and social recovery with a dead-man’s-switch inheritance flow. Claim Your Wallet explains how any Solana wallet’s pump.fun track record is computed from on-chain aggregates and how one gasless signature publishes it as your shareable Trader Card. (`/docs/custody`) `[docs]`+- **Every data feed now has free backups — one provider going down no longer takes a feature with it** — The platform already rotated across multiple Solana RPC providers when one failed; that same resilience now covers the rest of the data it fetches. SOL/USD pricing tries four independent free sources (CoinGecko, Jupiter, Kraken, Coinbase) instead of one. Token stats on agent pages and the /coin3d viewer roll from DexScreener to GeckoTerminal to Jupiter. The real-time wallet trade monitor rotates across three free Solana WebSocket endpoints. Map place labels fall back across three geocoders. And the swap terminal on launch pages now rides the same multi-provider RPC rotation as the rest of the site. If a source is down or rate-limiting, the next one answers within seconds — you should simply never notice. `[improvement, infra]`- **Every paid endpoint now settles — full x402 catalog coverage** — The x402 ring economy now exercises every paid endpoint on the platform, not just a handful. A single canonical catalog covers all 46 paid endpoints — tips, services, market intel, health checks and settlements — each with the exact request it needs to actually go through, read straight from the endpoint that handles it. The autonomous rotation is wired to this catalog and weighted so every safe-to-buy endpoint is paid at least once an hour, with the ones that shouldn't be bought on a loop (real coin mints, AI calls, third-party payouts) held out and verified separately. Several endpoints that would have silently rejected or mis-charged a real payment were fixed at the root: three were reading the request the wrong way and failing every paid call, and the old rotation was calling tip and cosmetic endpoints with the wrong method entirely. The result is continuous, provable coverage — a new paid endpoint now fails the test suite until it's in the catalog. `[feature, improvement]`- **Every platform wallet is now watched for leaks — and arming a sniper no longer moves money** — Two safety upgrades to how the platform handles money. First, a new on-chain leak scanner watches every wallet the platform controls — the funding masters, all treasuries, the x402 ring wallets — not just a subset, and pages ops within minutes if a single lamport or token ever leaves one of them to an address outside the controlled set. Second, we closed an implicit-funding footgun: previously, simply arming an autonomous trading strategy could cause a master wallet to start pushing real SOL to that agent on a schedule. Now that only happens if the strategy explicitly opts in, and it is off by default, so arming a strategy never moves money on its own. `[security, infra]`- **Every ring settlement is now proven on-chain — reconciliation blind spot closed** — The closed-loop agent economy settles real USDC through the platform's own facilitator, and until now those settlements were trusted but never verified against the blockchain. A new reconciler runs every 30 minutes and holds the ring to the same standard the funding wallet already meets: every recorded settlement and every treasury→payer sweep from the last 72 hours is checked to exist and succeed on-chain, a sample of each is parsed to prove the exact dollar amount and recipient match the books, and the two internal ledgers are cross-checked so a settlement with no matching spend record — the tell-tale sign of value leaking through our own facilitator — is caught. It also runs a silence alarm: if the ring is switched on but goes quiet for 30 minutes, operators are paged, closing the gap where 'it was working, then it wasn't' used to pass unnoticed. Any missing, failed, or mismatched settlement raises an immediate alert; every finding lands on the finance-integrity board, tagged so ring issues stand apart from the rest. `[security, infra]`diff --git a/api/_lib/sol-price.js b/api/_lib/sol-price.jsindex a321c2ae1..4b414c6a7 100644--- a/api/_lib/sol-price.js+++ b/api/_lib/sol-price.js@@ -37,9 +37,11 @@ const PROVIDERS = [},},{- name: 'binance',- url: 'https://api.binance.com/api/v3/ticker/price?symbol=SOLUSDT',- parse: async (r) => asPrice((await r.json())?.price),+ // Kraken, not Binance: Binance geo-blocks US datacenter IPs (Vercel),+ // returning an error body that would make it a permanent dead slot.+ name: 'kraken',+ url: 'https://api.kraken.com/0/public/Ticker?pair=SOLUSD',+ parse: async (r) => asPrice((await r.json())?.result?.SOLUSD?.c?.[0]),},{name: 'coinbase',diff --git a/data/changelog.json b/data/changelog.jsonindex cca297b9f..f909becd0 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,15 @@{"$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-07-03",+ "title": "Every data feed now has free backups — one provider going down no longer takes a feature with it",+ "summary": "The platform already rotated across multiple Solana RPC providers when one failed; that same resilience now covers the rest of the data it fetches. SOL/USD pricing tries four independent free sources (CoinGecko, Jupiter, Kraken, Coinbase) instead of one. Token stats on agent pages and the /coin3d viewer roll from DexScreener to GeckoTerminal to Jupiter. The real-time wallet trade monitor rotates across three free Solana WebSocket endpoints. Map place labels fall back across three geocoders. And the swap terminal on launch pages now rides the same multi-provider RPC rotation as the rest of the site. If a source is down or rate-limiting, the next one answers within seconds — you should simply never notice.",+ "tags": [+ "improvement",+ "infra"+ ]+ },{"date": "2026-07-03","title": "Live Trading Theater loads more gracefully — no more endless \"Assembling the cast\"",diff --git a/public/changelog.json b/public/changelog.jsonindex a22af5d10..559883ff4 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-03T19:08:43.914Z",+ "generated_at": "2026-07-03T23:56:32.955Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -117,6 +117,17 @@"docs"]},+ {+ "date": "2026-07-03",+ "type": "update",+ "title": "Every data feed now has free backups — one provider going down no longer takes a feature with it",+ "summary": "The platform already rotated across multiple Solana RPC providers when one failed; that same resilience now covers the rest of the data it fetches. SOL/USD pricing tries four independent free sources (CoinGecko, Jupiter, Kraken, Coinbase) instead of one. Token stats on agent pages and the /coin3d viewer roll from DexScreener to GeckoTerminal to Jupiter. The real-time wallet trade monitor rotates across three free Solana WebSocket endpoints. Map place labels fall back across three geocoders. And the swap terminal on launch pages now rides the same multi-provider RPC rotation as the rest of the site. If a source is down or rate-limiting, the next one answers within seconds — you should simply never notice.",+ "link": null,+ "tags": [+ "improvement",+ "infra"+ ]+ },{"date": "2026-07-03","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex dc23d3520..cfa4d8be0 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -94,6 +94,14 @@<category>docs</category><description>Two more guides for the trust layer. Custody You Can Verify walks through the four guarantees on every agent wallet — spend caps enforced before signing, a freeze switch that never blocks your own withdrawal, the six-hourly Merkle proof-of-custody you can re-verify in your own browser, and social recovery with a dead-man’s-switch inheritance flow. Claim Your Wallet explains how any Solana wallet’s pump.fun track record is computed from on-chain aggregates and how one gasless signature publishes it as your shareable Trader Card.</description></item>+ <item>+ <title>Every data feed now has free backups — one provider going down no longer takes a feature with it</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-07-03:Every data feed now has free backups — one provider going down no longer takes a feature with it</guid>+ <pubDate>Fri, 03 Jul 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>The platform already rotated across multiple Solana RPC providers when one failed; that same resilience now covers the rest of the data it fetches. SOL/USD pricing tries four independent free sources (CoinGecko, Jupiter, Kraken, Coinbase) instead of one. Token stats on agent pages and the /coin3d viewer roll from DexScreener to GeckoTerminal to Jupiter. The real-time wallet trade monitor rotates across three free Solana WebSocket endpoints. Map place labels fall back across three geocoders. And the swap terminal on launch pages now rides the same multi-provider RPC rotation as the rest of the site. If a source is down or rate-limiting, the next one answers within seconds — you should simply never notice.</description>+ </item><item><title>Every paid endpoint now settles — full x402 catalog coverage</title><link>https://three.ws/changelog</link>diff --git a/public/features.json b/public/features.jsonindex eeb99b524..3fca54700 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-03T19:08:43.880Z",+ "generated_at": "2026-07-03T23:56:32.654Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/src/shared/leaflet-loader.js b/src/shared/leaflet-loader.jsindex 59f0c121e..e485d0a70 100644--- a/src/shared/leaflet-loader.js+++ b/src/shared/leaflet-loader.js@@ -6,6 +6,8 @@// stack. Leaflet (JS + CSS) loads only when a map actually opens; the rest of the// app never pays for it.+import { fetchFirstOrNull } from './failover-fetch.js';+const LEAFLET_JS = 'https://esm.sh/[email protected]';const LEAFLET_CSS = 'https://unpkg.com/[email protected]/dist/leaflet.css';@@ -45,8 +47,6 @@ export function loadLeaflet() {// label. We memoize per ~11 m cell and never let a geocode failure block the// caller — a null label is a soft, designed state, never an error.-import { fetchFirstOrNull } from './failover-fetch.js';-const _reverseCache = new Map();// Reverse: coords → a short human place label (city/town/first display part).diff --git a/tests/failover-fetch.test.js b/tests/failover-fetch.test.jsnew file mode 100644index 000000000..c0ec2d1e3--- /dev/null+++ b/tests/failover-fetch.test.js@@ -0,0 +1,133 @@+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';+import { fetchFirst, fetchFirstOrNull } from '../src/shared/failover-fetch.js';++const json = (body, status = 200) =>+ new Response(JSON.stringify(body), { status, headers: { 'content-type': 'application/json' } });++// Unique provider names per test — the cooldown map is module-global, so+// reusing a name across tests would leak one test's penalty into the next.+let seq = 0;+const provider = (over = {}) => ({ name: `p${++seq}-${over.tag || 'x'}`, url: `https://p${seq}.test/`, ...over });++describe('fetchFirst — ordered multi-provider failover', () => {+ let origFetch;+ beforeEach(() => { origFetch = global.fetch; });+ afterEach(() => { global.fetch = origFetch; });++ it('returns the first provider that succeeds without touching the rest', async () => {+ const a = provider(), b = provider();+ global.fetch = vi.fn(async () => json({ v: 1 }));+ const out = await fetchFirst([a, b]);+ expect(out).toEqual({ value: { v: 1 }, source: a.name });+ expect(global.fetch).toHaveBeenCalledTimes(1);+ });++ it('rolls past a network error and an HTTP error to the next provider', async () => {+ const a = provider(), b = provider(), c = provider();+ global.fetch = vi.fn(async (url) => {+ if (url === a.url) throw new TypeError('network down');+ if (url === b.url) return json({}, 429);+ return json({ v: 'third' });+ });+ const out = await fetchFirst([a, b, c]);+ expect(out.source).toBe(c.name);+ expect(out.value).toEqual({ v: 'third' });+ });++ it('treats a parse returning null as a miss and moves on', async () => {+ const a = provider({ parse: async () => null });+ const b = provider();+ global.fetch = vi.fn(async () => json({ v: 2 }));+ const out = await fetchFirst([a, b]);+ expect(out.source).toBe(b.name);+ });++ it('throws when every provider fails', async () => {+ const a = provider(), b = provider();+ global.fetch = vi.fn(async () => json({}, 500));+ await expect(fetchFirst([a, b], { label: 'unit' })).rejects.toThrow(/unit: all 2 providers failed/);+ });++ it('skips a provider that errored recently (cooldown), but retries once it expires', async () => {+ const a = provider(), b = provider();+ global.fetch = vi.fn(async (url) => (url === a.url ? json({}, 500) : json({ v: 'b' })));+ // First call: a errors → cooled; b answers.+ expect((await fetchFirst([a, b], { cooldownMs: 50 })).source).toBe(b.name);+ // Second call inside the cooldown window: a must be skipped entirely.+ global.fetch.mockClear();+ global.fetch.mockImplementation(async () => json({ v: 'b2' }));+ const out = await fetchFirst([a, b], { cooldownMs: 50 });+ expect(out.source).toBe(b.name);+ expect(global.fetch).toHaveBeenCalledTimes(1);+ expect(global.fetch).toHaveBeenCalledWith(b.url, expect.anything());+ // After expiry, a is back in rotation.+ await new Promise((r) => setTimeout(r, 60));+ global.fetch.mockClear();+ global.fetch.mockImplementation(async () => json({ v: 'a again' }));+ expect((await fetchFirst([a, b])).source).toBe(a.name);+ });++ it('a miss (no_data) does NOT cool the provider down', async () => {+ const a = provider({ parse: async (r) => ((await r.json()).known ? { hit: true } : null) });+ const b = provider();+ global.fetch = vi.fn(async (url) => (url === a.url ? json({ known: false }) : json({ v: 'b' })));+ expect((await fetchFirst([a, b])).source).toBe(b.name);+ // Next query: a answers for a token it DOES know — it must still be tried first.+ global.fetch = vi.fn(async () => json({ known: true }));+ expect((await fetchFirst([a, b])).source).toBe(a.name);+ });++ it('probes cooled providers anyway when the whole chain is cooling', async () => {+ const a = provider();+ global.fetch = vi.fn(async () => json({}, 500));+ await expect(fetchFirst([a], { cooldownMs: 60_000 })).rejects.toThrow();+ // Sole provider is cooling — a cold chain still probes for recovery.+ global.fetch = vi.fn(async () => json({ v: 'recovered' }));+ expect((await fetchFirst([a])).value).toEqual({ v: 'recovered' });+ });++ it('aborts the whole chain without penalty when the caller signal fires', async () => {+ const ctrl = new AbortController();+ const a = provider({ init: { signal: ctrl.signal } });+ const b = provider({ init: { signal: ctrl.signal } });+ global.fetch = vi.fn((url, { signal }) => new Promise((_, reject) => {+ signal.addEventListener('abort', () => reject(new DOMException('aborted', 'AbortError')));+ }));+ const pending = fetchFirst([a, b]);+ ctrl.abort();+ await expect(pending).rejects.toThrow();+ expect(global.fetch).toHaveBeenCalledTimes(1); // never moved on to b+ // Neither provider was cooled by the abort.+ global.fetch = vi.fn(async () => json({ v: 'ok' }));+ expect((await fetchFirst([{ ...a, init: {} }, { ...b, init: {} }])).source).toBe(a.name);+ });++ it('times out a hung provider and falls through to the next', async () => {+ const a = provider(), b = provider();+ global.fetch = vi.fn((url, { signal }) => {+ if (url === a.url) {+ return new Promise((_, reject) => {+ signal.addEventListener('abort', () => reject(new DOMException('aborted', 'AbortError')));+ });+ }+ return Promise.resolve(json({ v: 'fast' }));+ });+ const out = await fetchFirst([a, b], { timeoutMs: 30 });+ expect(out.source).toBe(b.name);+ });+});++describe('fetchFirstOrNull — best-effort variant', () => {+ let origFetch;+ beforeEach(() => { origFetch = global.fetch; });+ afterEach(() => { global.fetch = origFetch; });++ it('resolves the value on success and the fallback on total failure', async () => {+ global.fetch = vi.fn(async () => json({ v: 9 }));+ expect(await fetchFirstOrNull([provider()])).toEqual({ v: 9 });+ global.fetch = vi.fn(async () => json({}, 500));+ expect(await fetchFirstOrNull([provider()])).toBeNull();+ global.fetch = vi.fn(async () => json({}, 500));+ expect(await fetchFirstOrNull([provider()], { fallback: [] })).toEqual([]);+ });+});