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(economy): agent funding keeps an operating reserve on the shared wallet
nirholase74b118eb4cd
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 876d1690c..bdf922952 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,12 +6,15 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr## 2026-07-27+- **Every 3D service we sell to other agents now ships parameters and a worked example** — The service catalog three.ws publishes to the OKX.AI agent marketplace describes all eleven 3D services the same way: what it does, exactly what you provide numbered one by one, and a concrete example of a real request. Buying agents (and the humans reading over their shoulder) can now tell what a service takes before spending anything, and the free catalog endpoint serves the same text the marketplace listing shows. (`/docs/okx-marketplace`) `[improvement, docs]`- **Hats and shoes now sit where they belong** — Generated caps could come out with brims jutting past the face, and sneakers could hover away from the feet, because the forge sized those pieces by width alone: a deep-brimmed cap or a photographed pair of shoes standing close together gave the sizing step no useful signal. Caps are now scaled to fit the head on every dimension, and shoes are sized by foot length and placed onto each foot individually. Measured on a walking avatar, the worst-case gap between shoe and foot dropped from 34cm to 3cm, and cap overhang from 21cm to 8cm. Every piece in the catalog is now checked automatically: it must load, match its published fingerprint, and bind correctly onto four different avatar skeletons before it counts as good, with the pieces that failed the new bar replaced. A daily check also watches the live catalog for anything that breaks after the fact. `[improvement, fix]`- **The x402 payment lanes now stop when the treasury runs dry** — When the wallets funding the agent payment economy ran low, the tip seeder kept firing 60 payments a minute that could never settle, turning the public dance-tip endpoint into a wall of errors and burning network calls for nothing. It now reads both wallet balances once before each round and simply sits the round out when a payment cannot succeed, with the reason stated plainly in the response. When the payer holds enough for some but not all of a round, it now sends exactly the number it can afford instead of overshooting. An unreadable balance is treated as unknown rather than empty, so a momentary network hiccup can never stall the economy on its own. `[fix, infra]`+- **Trading agents can no longer earn a bigger bet while losing money** — The self-tuning loop judged each strategy on its average percentage return and win rate, which treat a tiny position and a large one as equal. A strategy could post a healthy-looking win rate while its biggest trades bled real SOL, and get rewarded with an even bigger position. The optimizer now shrinks a strategy whose average percentage is positive but whose actual profit is negative, since that pattern only occurs when the larger bets are the losing ones, and it refuses to scale any strategy up while it is down money. (`/blog/autonomous-trading-experiment`) `[improvement]`## 2026-07-26- **Wardrobe** (`/wardrobe`) — The open garment catalog for 3D avatars: browse every wearable, inspect it in 3D, and generate new pieces from a text prompt. Every piece binds to any humanoid avatar at runtime.+- **Agent funding can no longer starve the payments rail** — The wallet that funds trading agents is also the wallet that settles paid x402 API calls. A funding transfer used to be allowed to drain it to fee dust, which pushed it under the settlement floor and made every paid endpoint fail while the money sat idle in agent wallets. Funding now keeps an operating reserve behind, so topping up an agent can never take the payment rail down. `[fix, infra]`- **Agent minting recovers from wallet extension crashes** — Minting an agent on Solana could fail with an unexplained "An internal error has occurred" when the wallet extension's background process was wedged, before any transaction was built and with no SOL spent. The deploy flow now retries the wallet call once automatically, and if it still fails the error names the exact step (connecting, signing, or broadcasting) and tells you how to recover: unlock or restart the wallet extension and try again. (`/create-agent`) `[fix]`- **Agent trades land faster during congested launch windows** — The trade execution engine now broadcasts through its MEV-protected lane and the Jito bundle lane at the same time instead of waiting up to 12 seconds for a bundle verdict before falling back, and it raises its priority-fee bid much more steeply when a send does not land on the first try. Fewer sniper entries and exits should fail with exhausted retries during peak hours, and the ones that land should land sooner. (`/blog/autonomous-trading-experiment`) `[improvement]`- **Agents can now pay for things from their own wallets** — Every payment checkout on the platform (cosmetics, club entry, NPC services, asset remixes, billboard slots, bazaar services and more) now lists your agents as payment methods alongside Phantom and other browser wallets. If an agent holds USDC in its own wallet, picking it settles the payment server-side under that agent's spend limits, with no wallet popup and no browser extension required. Underfunded agents show their exact balance and stay disabled until topped up. (`/bazaar`) `[feature]`diff --git a/api/_lib/launcher-funding.js b/api/_lib/launcher-funding.jsindex 350b3bb60..09adbcf73 100644--- a/api/_lib/launcher-funding.js+++ b/api/_lib/launcher-funding.js@@ -29,6 +29,27 @@ const LAMPORTS_PER_SOL = 1_000_000_000;const MASTER_ENV = 'LAUNCHER_MASTER_SECRET_KEY_B64';const MASTER_FALLBACK_ENV = 'PUMP_X402_LAUNCHER_SECRET_KEY_B64';+// SOL the master must still hold AFTER any funding transfer.+//+// This wallet is not only the launcher/sniper funding root: the same keypair is+// the x402 ring payer (it resolves to one pubkey through both SignerSpecs, which+// is why treasury-topup reports it as "coin-launcher-master+x402-ring-payer").+// In self-pay mode the facilitator hard-rejects a settle when the PAYER is under+// SPONSOR_SOL_FLOOR (0.02 SOL), so a funding transfer that left only transfer+// fees behind silently killed the entire paid-endpoint rail. That is exactly how+// the ring died on 2026-07-25 and again on 2026-07-26: the sniper auto-funder+// pulled arm top-ups until the shared wallet fell ~100 lamports under the floor,+// and every x402 settle 502'd while 3+ SOL sat idle in agent wallets.+//+// The floor is deliberately well above 0.02 so a burst of settles between two+// funding runs can never cross it. Override per-environment if the roles are+// ever split onto separate keypairs.+const DEFAULT_MASTER_RESERVE_SOL = 0.05;+export function masterReserveSol() {+ const n = Number(process.env.LAUNCHER_MASTER_RESERVE_SOL);+ return Number.isFinite(n) && n >= 0 ? n : DEFAULT_MASTER_RESERVE_SOL;+}+/*** Load the master launch wallet keypair, or null when neither env is set.* @returns {Promise<import('@solana/web3.js').Keypair|null>}@@ -185,11 +206,16 @@ export async function fundAgentForLaunch({if (!master) return { ok: false, reason: 'master launch wallet not configured' };const conn = solanaConnection(network);- // Keep a fee buffer so the master never empties below the cost of the very- // transfer it is about to sign.+ // Keep a fee buffer AND the shared-wallet operating reserve, so the master+ // never empties below the cost of this transfer plus the SOL its other role+ // (x402 ring payer) needs to keep settling. See masterReserveSol().+ const reserve = masterReserveSol();const { sol: masterSol } = await getSolBalance(conn, master.publicKey);- if (masterSol < amount + 0.002) {- return { ok: false, reason: `master balance ${masterSol} SOL below ${amount} + fees` };+ if (masterSol < amount + 0.002 + reserve) {+ return {+ ok: false,+ reason: `master balance ${masterSol} SOL below ${amount} + fees + ${reserve} reserve`,+ };}const lamports = Math.round(amount * LAMPORTS_PER_SOL);diff --git a/data/changelog.json b/data/changelog.jsonindex bd3d08270..837b90a9d 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,25 @@{"$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-27",+ "title": "Trading agents can no longer earn a bigger bet while losing money",+ "summary": "The self-tuning loop judged each strategy on its average percentage return and win rate, which treat a tiny position and a large one as equal. A strategy could post a healthy-looking win rate while its biggest trades bled real SOL, and get rewarded with an even bigger position. The optimizer now shrinks a strategy whose average percentage is positive but whose actual profit is negative, since that pattern only occurs when the larger bets are the losing ones, and it refuses to scale any strategy up while it is down money.",+ "tags": [+ "improvement"+ ],+ "link": "/blog/autonomous-trading-experiment"+ },+ {+ "date": "2026-07-27",+ "title": "Every 3D service we sell to other agents now ships parameters and a worked example",+ "summary": "The service catalog three.ws publishes to the OKX.AI agent marketplace describes all eleven 3D services the same way: what it does, exactly what you provide numbered one by one, and a concrete example of a real request. Buying agents (and the humans reading over their shoulder) can now tell what a service takes before spending anything, and the free catalog endpoint serves the same text the marketplace listing shows.",+ "tags": [+ "improvement",+ "docs"+ ],+ "link": "/docs/okx-marketplace"+ },{"date": "2026-07-26","title": "The Worlds lobby stays live through market-data outages",@@ -16131,6 +16150,15 @@"fix","infra"]+ },+ {+ "date": "2026-07-26",+ "title": "Agent funding can no longer starve the payments rail",+ "summary": "The wallet that funds trading agents is also the wallet that settles paid x402 API calls. A funding transfer used to be allowed to drain it to fee dust, which pushed it under the settlement floor and made every paid endpoint fail while the money sat idle in agent wallets. Funding now keeps an operating reserve behind, so topping up an agent can never take the payment rail down.",+ "tags": [+ "fix",+ "infra"+ ]}]}diff --git a/public/changelog.json b/public/changelog.jsonindex 86e037b25..531da5787 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,11 +1,22 @@{- "generated_at": "2026-07-27T17:05:48.120Z",+ "generated_at": "2026-07-27T17:10:35.140Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws","url": "https://three.ws"},"entries": [+ {+ "date": "2026-07-27",+ "type": "update",+ "title": "Every 3D service we sell to other agents now ships parameters and a worked example",+ "summary": "The service catalog three.ws publishes to the OKX.AI agent marketplace describes all eleven 3D services the same way: what it does, exactly what you provide numbered one by one, and a concrete example of a real request. Buying agents (and the humans reading over their shoulder) can now tell what a service takes before spending anything, and the free catalog endpoint serves the same text the marketplace listing shows.",+ "link": "/docs/okx-marketplace",+ "tags": [+ "improvement",+ "docs"+ ]+ },{"date": "2026-07-27","type": "update",@@ -28,6 +39,16 @@"infra"]},+ {+ "date": "2026-07-27",+ "type": "update",+ "title": "Trading agents can no longer earn a bigger bet while losing money",+ "summary": "The self-tuning loop judged each strategy on its average percentage return and win rate, which treat a tiny position and a large one as equal. A strategy could post a healthy-looking win rate while its biggest trades bled real SOL, and get rewarded with an even bigger position. The optimizer now shrinks a strategy whose average percentage is positive but whose actual profit is negative, since that pattern only occurs when the larger bets are the losing ones, and it refuses to scale any strategy up while it is down money.",+ "link": "/blog/autonomous-trading-experiment",+ "tags": [+ "improvement"+ ]+ },{"date": "2026-07-26","type": "launch",@@ -38,6 +59,17 @@"launch"]},+ {+ "date": "2026-07-26",+ "type": "update",+ "title": "Agent funding can no longer starve the payments rail",+ "summary": "The wallet that funds trading agents is also the wallet that settles paid x402 API calls. A funding transfer used to be allowed to drain it to fee dust, which pushed it under the settlement floor and made every paid endpoint fail while the money sat idle in agent wallets. Funding now keeps an operating reserve behind, so topping up an agent can never take the payment rail down.",+ "link": null,+ "tags": [+ "fix",+ "infra"+ ]+ },{"date": "2026-07-26","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 989f6df5e..618cc8c91 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -6,6 +6,14 @@<atom:link href="https://three.ws/changelog.xml" rel="self" type="application/rss+xml"/><description>What's new on three.ws — features, improvements, and releases, newest first.</description><language>en</language>+ <item>+ <title>Every 3D service we sell to other agents now ships parameters and a worked example</title>+ <link>https://three.ws/docs/okx-marketplace</link>+ <guid isPermaLink="false">2026-07-27:Every 3D service we sell to other agents now ships parameters and a worked example</guid>+ <pubDate>Mon, 27 Jul 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>The service catalog three.ws publishes to the OKX.AI agent marketplace describes all eleven 3D services the same way: what it does, exactly what you provide numbered one by one, and a concrete example of a real request. Buying agents (and the humans reading over their shoulder) can now tell what a service takes before spending anything, and the free catalog endpoint serves the same text the marketplace listing shows.</description>+ </item><item><title>Hats and shoes now sit where they belong</title><link>https://three.ws/changelog</link>@@ -22,6 +30,14 @@<category>fix</category><description>When the wallets funding the agent payment economy ran low, the tip seeder kept firing 60 payments a minute that could never settle, turning the public dance-tip endpoint into a wall of errors and burning network calls for nothing. It now reads both wallet balances once before each round and simply sits the round out when a payment cannot succeed, with the reason stated plainly in the response. When the payer holds enough for some but not all of a round, it now sends exactly the number it can afford instead of overshooting. An unreadable balance is treated as unknown rather than empty, so a momentary network hiccup can never stall the economy on its own.</description></item>+ <item>+ <title>Trading agents can no longer earn a bigger bet while losing money</title>+ <link>https://three.ws/blog/autonomous-trading-experiment</link>+ <guid isPermaLink="false">2026-07-27:Trading agents can no longer earn a bigger bet while losing money</guid>+ <pubDate>Mon, 27 Jul 2026 12:00:00 GMT</pubDate>+ <category>improvement</category>+ <description>The self-tuning loop judged each strategy on its average percentage return and win rate, which treat a tiny position and a large one as equal. A strategy could post a healthy-looking win rate while its biggest trades bled real SOL, and get rewarded with an even bigger position. The optimizer now shrinks a strategy whose average percentage is positive but whose actual profit is negative, since that pattern only occurs when the larger bets are the losing ones, and it refuses to scale any strategy up while it is down money.</description>+ </item><item><title>Wardrobe</title><link>https://three.ws/wardrobe</link>@@ -30,6 +46,14 @@<category>launch</category><description>The open garment catalog for 3D avatars: browse every wearable, inspect it in 3D, and generate new pieces from a text prompt. Every piece binds to any humanoid avatar at runtime.</description></item>+ <item>+ <title>Agent funding can no longer starve the payments rail</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-07-26:Agent funding can no longer starve the payments rail</guid>+ <pubDate>Sun, 26 Jul 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>The wallet that funds trading agents is also the wallet that settles paid x402 API calls. A funding transfer used to be allowed to drain it to fee dust, which pushed it under the settlement floor and made every paid endpoint fail while the money sat idle in agent wallets. Funding now keeps an operating reserve behind, so topping up an agent can never take the payment rail down.</description>+ </item><item><title>Agent minting recovers from wallet extension crashes</title><link>https://three.ws/create-agent</link>diff --git a/tests/launcher-funding.test.js b/tests/launcher-funding.test.jsindex dd921287a..2b41ff250 100644--- a/tests/launcher-funding.test.js+++ b/tests/launcher-funding.test.js@@ -1,5 +1,5 @@import { describe, it, expect } from 'vitest';-import { fundAgentForLaunch, loadMasterSigner } from '../api/_lib/launcher-funding.js';+import { fundAgentForLaunch, loadMasterSigner, masterReserveSol } from '../api/_lib/launcher-funding.js';// These exercise the business-rule guards that fire BEFORE any chain/RPC call, so// they run without a wallet, RPC, or DB. They prove the caps actually refuse —@@ -56,3 +56,39 @@ describe('loadMasterSigner', () => {}});});++// The funding master is the SAME keypair as the x402 ring payer. A transfer that+// left only fee dust behind pushed that wallet under the facilitator's 0.02 SOL+// settle floor and took every paid endpoint down (2026-07-25 and 2026-07-26,+// with 3+ SOL idle in agent wallets at the time). The reserve is what keeps a+// funding run from cannibalising the payment rail.+describe('masterReserveSol — the shared-wallet operating floor', () => {+ const KEY = 'LAUNCHER_MASTER_RESERVE_SOL';+ const withEnv = (v, fn) => {+ const prev = process.env[KEY];+ if (v === undefined) delete process.env[KEY]; else process.env[KEY] = v;+ try { return fn(); } finally {+ if (prev === undefined) delete process.env[KEY]; else process.env[KEY] = prev;+ }+ };++ it('defaults comfortably above the 0.02 SOL x402 settle floor', () => {+ withEnv(undefined, () => {+ expect(masterReserveSol()).toBe(0.05);+ expect(masterReserveSol()).toBeGreaterThan(0.02);+ });+ });++ it('honors an environment override', () => {+ withEnv('0.15', () => expect(masterReserveSol()).toBe(0.15));+ });++ it('allows an explicit zero (roles split onto separate keypairs)', () => {+ withEnv('0', () => expect(masterReserveSol()).toBe(0));+ });++ it('ignores junk and negatives rather than disabling the floor', () => {+ withEnv('not-a-number', () => expect(masterReserveSol()).toBe(0.05));+ withEnv('-1', () => expect(masterReserveSol()).toBe(0.05));+ });+});