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
feat: implement throttled warnings for networth endpoint and add circuit-breaker tests for Helius quota handling
qbdzebec6fe61ad0
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex acead3325..de69eae3f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -31,6 +31,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **The Sniper dashboard now carries the full Money Studio — wallet, Trading Brain, pricing and earnings** — The Sniper Strategies dashboard used to stop at strategy config and live positions. Now every strategy card has a second tab — Money Studio — that opens the exact same control surface as your agent's Money tab in Agent Studio, without leaving the dashboard. Fund the agent's wallet (live SOL and USDC balances, deposit address, withdraw with a one-tap Max, real SPL holdings and on-chain activity), open the full Trading Brain to draw a snipe rule and either scan live launches for one-tap assisted snipes or arm it to run autonomously, backtest a rule over the last 30 days, set per-call prices on the agent's skills, and watch what other agents pay it — all per agent, all real. No more bouncing between Agent Studio and the dashboard to top up a wallet before arming. The original Money tab in Agent Studio is untouched. (`/dashboard/sniper`) `[feature, improvement]`- **The swarm members panel is now a live standings board** — A swarm is a competition between its members, and the members list now reads like one. Members are ranked by stake — #1, #2, #3 — with the lead member marked by a token accent, and each member's reputation shows as a vote-weight chip: the chip carries the reputation score with the exact share of the swarm's vote that score commands beneath it, so you can see your track record become voting power (computed the same way the consensus engine does). The moment the treasury fires a trade, the members who were on the winning side of that consensus pulse green — pulled straight from the real recorded vote breakdown, so you can see exactly who carried it. When someone contributes or exits, the share bars animate and the standings re-sort smoothly instead of snapping. Respects reduced-motion preferences. (`/swarms`) `[improvement]`- **The Trading Brain now tracks open snipes live and lets you sell on one tap** — The sniping panel in Agent Studio's Money tab no longer goes stale the moment it loads. Open positions now mark to live price on their own — each one shows its unrealized P&L (in SOL and percent) and refreshes every few seconds, so a snipe climbing or bleeding updates in front of you instead of waiting for a reload. When your agent is armed, new fills and exits appear on the same live tick. Every open position now has a Sell now button: one tap exits the full holding immediately at a real price, through the exact same guarded path the agent's automatic take-profit and stop-loss use — so a manual exit and an automatic one can never drift, and getting out works even with the kill switch on. The Guardrails card now shows real spend: how much SOL the agent has traded today against your daily budget, as a number and a progress bar that turns amber past 60% and red past 90% — so you can see the leash tightening before it stops you. Polling pauses when the tab is hidden to spare your rate limit, and resumes the moment you come back. (`/agent-studio`) `[improvement]`+- **Wallet balances ride out an exhausted RPC quota instead of hammering it** — Agent net-worth, portfolios, and the $THREE holder gate all read balances from our primary Solana data provider, with a public RPC as backup. When the primary provider's plan quota was used up, every balance read still tried it first, ate a doomed round-trip, and only then fell back — and logged the same warning on every single request. Now a quota or rate-limit response parks the primary provider for a few minutes and sends reads straight to the backup, so balances resolve faster during an outage and the duplicated warnings collapse to a single line. The repeated 'holding last state' warning on a wallet that keeps failing to read is likewise throttled. No behavior changes for holders — balances were always correct; this just makes them quicker and quieter under provider strain. `[fix, infra]`- **x402 payment-modal SDK now installs cleanly outside the monorepo** — The @three-ws/x402-payment-modal package shipped a server-side checkout adapter that quietly relied on @solana/web3.js, @solana/spl-token and express being present — they were never listed in the package, so installing it on its own and using the server piece failed with a missing-module error. Those are now declared as optional dependencies, so the browser modal stays as lightweight as ever while the server and React adapters pull in exactly what they need. The build also no longer assumes a monorepo folder layout. This is the first step in moving the x402 toolkit into its own repositories. `[fix, sdk]`## 2026-06-29diff --git a/api/agents/solana-wallet.js b/api/agents/solana-wallet.jsindex 599fce9f5..8dff17229 100644--- a/api/agents/solana-wallet.js+++ b/api/agents/solana-wallet.js@@ -1644,6 +1644,22 @@ async function reputationFor(id) {return { forkCount, tips, pnl };}+// Throttle the networth chain-read warning. The networth endpoint is polled+// (avatar presence "look" refresh), so one agent whose wallet read keeps failing+// — a stale/exhausted RPC, a wallet the upstream 404s — would otherwise emit one+// identical warning per poll (18+ for a single agent in one log window). Collapse+// repeats per agent to one line per minute; a persistent failure stays visible+// without flooding. The 502 hold-last-state response to the client is unchanged.+const _networthWarnedAt = new Map();+const NETWORTH_WARN_COOLDOWN_MS = 60_000;+function warnNetworthThrottled(agentId, msg) {+ const now = Date.now();+ if (now - (_networthWarnedAt.get(agentId) || 0) < NETWORTH_WARN_COOLDOWN_MS) return;+ if (_networthWarnedAt.size > 1000) _networthWarnedAt.clear(); // bound key cardinality+ _networthWarnedAt.set(agentId, now);+ console.warn(msg);+}+// GET /api/agents/:id/solana/networth — public read: the agent's net-worth "look"// (presence tier, aura, confidence, regalia marks) derived entirely from real// chain reads + real DB counts, plus the owner's reactivity preferences.diff --git a/data/changelog.json b/data/changelog.jsonindex 393415ad4..7d67f9afb 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,15 @@{"$comment": "Curated changelog entries for three.ws \u2014 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-30",+ "title": "Wallet balances ride out an exhausted RPC quota instead of hammering it",+ "summary": "Agent net-worth, portfolios, and the $THREE holder gate all read balances from our primary Solana data provider, with a public RPC as backup. When the primary provider's plan quota was used up, every balance read still tried it first, ate a doomed round-trip, and only then fell back — and logged the same warning on every single request. Now a quota or rate-limit response parks the primary provider for a few minutes and sends reads straight to the backup, so balances resolve faster during an outage and the duplicated warnings collapse to a single line. The repeated 'holding last state' warning on a wallet that keeps failing to read is likewise throttled. No behavior changes for holders — balances were always correct; this just makes them quicker and quieter under provider strain.",+ "tags": [+ "fix",+ "infra"+ ]+ },{"date": "2026-06-30","title": "Documented the full x402 paid-endpoint catalog and where endpoint revenue is recorded",diff --git a/public/changelog.json b/public/changelog.jsonindex 8ad8da3df..daf936e8c 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-30T21:48:14.424Z",+ "generated_at": "2026-06-30T22:32:33.298Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -264,6 +264,17 @@"improvement"]},+ {+ "date": "2026-06-30",+ "type": "update",+ "title": "Wallet balances ride out an exhausted RPC quota instead of hammering it",+ "summary": "Agent net-worth, portfolios, and the $THREE holder gate all read balances from our primary Solana data provider, with a public RPC as backup. When the primary provider's plan quota was used up, every balance read still tried it first, ate a doomed round-trip, and only then fell back — and logged the same warning on every single request. Now a quota or rate-limit response parks the primary provider for a few minutes and sends reads straight to the backup, so balances resolve faster during an outage and the duplicated warnings collapse to a single line. The repeated 'holding last state' warning on a wallet that keeps failing to read is likewise throttled. No behavior changes for holders — balances were always correct; this just makes them quicker and quieter under provider strain.",+ "link": null,+ "tags": [+ "fix",+ "infra"+ ]+ },{"date": "2026-06-30","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 935b35a3c..10c90075e 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -206,6 +206,14 @@<category>improvement</category><description>The sniping panel in Agent Studio's Money tab no longer goes stale the moment it loads. Open positions now mark to live price on their own — each one shows its unrealized P&L (in SOL and percent) and refreshes every few seconds, so a snipe climbing or bleeding updates in front of you instead of waiting for a reload. When your agent is armed, new fills and exits appear on the same live tick. Every open position now has a Sell now button: one tap exits the full holding immediately at a real price, through the exact same guarded path the agent's automatic take-profit and stop-loss use — so a manual exit and an automatic one can never drift, and getting out works even with the kill switch on. The Guardrails card now shows real spend: how much SOL the agent has traded today against your daily budget, as a number and a progress bar that turns amber past 60% and red past 90% — so you can see the leash tightening before it stops you. Polling pauses when the tab is hidden to spare your rate limit, and resumes the moment you come back.</description></item>+ <item>+ <title>Wallet balances ride out an exhausted RPC quota instead of hammering it</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-06-30:Wallet balances ride out an exhausted RPC quota instead of hammering it</guid>+ <pubDate>Tue, 30 Jun 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Agent net-worth, portfolios, and the $THREE holder gate all read balances from our primary Solana data provider, with a public RPC as backup. When the primary provider's plan quota was used up, every balance read still tried it first, ate a doomed round-trip, and only then fell back — and logged the same warning on every single request. Now a quota or rate-limit response parks the primary provider for a few minutes and sends reads straight to the backup, so balances resolve faster during an outage and the duplicated warnings collapse to a single line. The repeated 'holding last state' warning on a wallet that keeps failing to read is likewise throttled. No behavior changes for holders — balances were always correct; this just makes them quicker and quieter under provider strain.</description>+ </item><item><title>x402 payment-modal SDK now installs cleanly outside the monorepo</title><link>https://three.ws/changelog</link>diff --git a/public/features.json b/public/features.jsonindex 0b112c2a8..8b1e8b5d6 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-30T21:48:14.405Z",+ "generated_at": "2026-06-30T22:32:33.278Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/tests/api/balances-helius-circuit.test.js b/tests/api/balances-helius-circuit.test.jsnew file mode 100644index 000000000..414ee0872--- /dev/null+++ b/tests/api/balances-helius-circuit.test.js@@ -0,0 +1,89 @@+// Circuit-breaker tests for the Helius path in api/_lib/balances.js.+//+// When Helius reports an exhausted plan quota ("max usage reached" / JSON-RPC+// -32429 / HTTP 429) the balance reads must stop calling Helius for the cooldown+// window and serve from the public-RPC fallback instead — otherwise every+// portfolio / networth / holder-gate read burns a doomed Helius round-trip and+// emits a duplicate warning (the 70+-line flood seen in production logs). Fetch+// is fully mocked; no network.++import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';++let fetchCalls = [];+// URL-aware mock: routes by host so the multi-call fallback path (getBalance,+// getTokenAccountsByOwner, Jupiter prices) all resolve without a strict queue.+let heliusBehavior = 'quota'; // 'quota' | 'ok'+vi.stubGlobal('fetch', (url, opts) => {+ const u = String(url);+ fetchCalls.push(u);+ const ok = (status, body) => Promise.resolve({+ ok: status >= 200 && status < 300,+ status,+ json: async () => body,+ text: async () => (typeof body === 'string' ? body : JSON.stringify(body)),+ });+ if (u.includes('helius-rpc.com')) {+ if (heliusBehavior === 'quota') {+ return ok(429, { jsonrpc: '2.0', error: { code: -32429, message: 'max usage reached' } });+ }+ return ok(200, { result: { nativeBalance: { lamports: 0 }, items: [] } });+ }+ if (u.includes('lite-api.jup.ag')) return ok(200, {});+ if (u.includes('mainnet-beta.solana.com') || (opts && /getBalance|getTokenAccountsByOwner/.test(String(opts.body)))) {+ const body = opts ? String(opts.body) : '';+ if (body.includes('getTokenAccountsByOwner')) return ok(200, { result: { value: [] } });+ return ok(200, { result: { value: 0 } }); // getBalance+ }+ return ok(200, {});+});++import { getBalances, __resetBalancesBreaker } from '../../api/_lib/balances.js';+import { invalidateBalances } from '../../api/_lib/balances.js';++const ADDR_A = 'AaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAaAa';+const ADDR_B = 'BbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBbBb';++const heliusHits = () => fetchCalls.filter((u) => u.includes('helius-rpc.com')).length;++beforeEach(async () => {+ fetchCalls = [];+ heliusBehavior = 'quota';+ process.env.HELIUS_API_KEY = 'test-key';+ __resetBalancesBreaker();+ // Distinct addresses per case dodge the 60s balance cache; clear to be safe.+ await invalidateBalances({ chain: 'solana', address: ADDR_A });+ await invalidateBalances({ chain: 'solana', address: ADDR_B });+});++afterEach(() => {+ delete process.env.HELIUS_API_KEY;+});++describe('balances Helius circuit breaker', () => {+ it('trips on a Helius quota error and skips Helius on the next read', async () => {+ // First read: Helius DAS 429s, breaker trips, falls back to public RPC.+ const a = await getBalances({ chain: 'solana', address: ADDR_A });+ expect(a.chain).toBe('solana');+ expect(heliusHits()).toBeGreaterThan(0); // it tried Helius once++ // Second read (new address → no cache hit): breaker is open, so Helius is+ // not contacted again — straight to the public-RPC fallback.+ fetchCalls = [];+ const b = await getBalances({ chain: 'solana', address: ADDR_B });+ expect(b.chain).toBe('solana');+ expect(heliusHits()).toBe(0);+ });++ it('uses Helius normally when the quota is healthy', async () => {+ heliusBehavior = 'ok';+ const a = await getBalances({ chain: 'solana', address: ADDR_A });+ expect(a.chain).toBe('solana');+ expect(heliusHits()).toBeGreaterThan(0);++ // Still healthy → still using Helius (DAS) on the next distinct read.+ fetchCalls = [];+ const b = await getBalances({ chain: 'solana', address: ADDR_B });+ expect(b.chain).toBe('solana');+ expect(heliusHits()).toBeGreaterThan(0);+ });+});