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(wallet): answer 204 for a wallet-less agent under ?miss=empty so the net-worth aura stops logging a 404 on every poll
nirholas8db17ef1c6b8
diff --git a/api/agents/solana-wallet.js b/api/agents/solana-wallet.jsindex 860ccb564..124f223a3 100644--- a/api/agents/solana-wallet.js+++ b/api/agents/solana-wallet.js@@ -987,9 +987,19 @@ async function handleHoldings(req, res, id) {const rl = await limits.walletRead(isOwner ? auth.userId : clientIp(req));if (!rl.success) return rateLimited(res, rl);- if (!address) return error(res, 404, 'not_found', 'agent has no solana wallet');-const url = new URL(req.url, 'http://x');+ if (!address) {+ // `?miss=empty` is for display surfaces that render a wallet-less agent as+ // a dormant baseline (the wallet aura, which re-reads on a timer). There an+ // unprovisioned wallet is an expected answer, so it gets a 204 instead of a+ // 404 the browser prints to the console on every poll.+ if (url.searchParams.get('miss') === 'empty') {+ res.statusCode = 204;+ return res.end();+ }+ return error(res, 404, 'not_found', 'agent has no solana wallet');+ }+const network = url.searchParams.get('network') === 'devnet' ? 'devnet' : 'mainnet';const conn = solanaConnection(network);const owner = new PublicKey(address);diff --git a/docs/agent-abilities/wallet/08-trade.md b/docs/agent-abilities/wallet/08-trade.mdindex 5d2f8b0a9..32cf9b5ff 100644--- a/docs/agent-abilities/wallet/08-trade.md+++ b/docs/agent-abilities/wallet/08-trade.md@@ -74,8 +74,8 @@ curl 'https://three.ws/api/agents/<agent-id>/solana/holdings?network=mainnet'- `POST /api/agents/:id/solana/trade (preview:true = live quote; without preview = server-signed execution)`- `GET /api/agents/:id/solana/trade-history (unified discretionary + sniper feed, owner-only)`-- `GET /api/agents/:id/solana/holdings (SOL balance + SPL token list, public read)`-- `GET /api/pump/coin?mint= (coin name/symbol/image/graduation metadata, best-effort)`+- `GET /api/agents/:id/solana/holdings (SOL balance + SPL token list, public read; 404 when the agent has no wallet, or 204 with ?miss=empty)`+- `GET /api/pump/coin?mint= (coin name/symbol/image/graduation metadata, best-effort; 404 for a coin pump.fun has not indexed, or 204 with ?miss=empty)`- `Jupiter Lite price API with CoinGecko fallback (client-side SOL/USD for the ≈$ readout, 60s cache)`## Relateddiff --git a/docs/agent-tokens.md b/docs/agent-tokens.mdindex 5a7ddd7b8..29eab13a9 100644--- a/docs/agent-tokens.md+++ b/docs/agent-tokens.md@@ -222,6 +222,16 @@ which answered:| pump.fun's indexer | `GET /api/pump/coin?mint=…` | Mainnet, once pump.fun has indexed the coin. Carries the logo and 24h volume. || The bonding curve itself | `GET /api/pump/curve?mint=…&network=…` | Every devnet coin, and any mainnet coin the indexer has not caught up to or cannot be reached for. Read straight off the cluster. |+The widget asks the indexer with `&miss=empty`. Without that flag, a mint+pump.fun has not indexed answers `404 coin_not_found`; with it, the same miss is+a bodiless `204` (cached for 60 seconds). The widget then reads the curve and+remembers the mint for the rest of the page session, so a launch page full of+fresh coins does not print a red 404 per card on every refresh. Use the flag+whenever your caller has its own fallback; leave it off when a miss is an error+you want to see. `GET /api/agents/:id/solana/holdings` takes the same flag for+an agent that has not provisioned a wallet yet: `404 not_found` by default,+`204` with `?miss=empty`, which is what the wallet aura uses on its polling read.+Two consequences worth knowing:- **A devnet coin is priced in SOL, not dollars, and badged `DEVNET`.** Devnetdiff --git a/src/shared/wallet-networth.js b/src/shared/wallet-networth.jsindex 4ea1e5926..0df5884fc 100644--- a/src/shared/wallet-networth.js+++ b/src/shared/wallet-networth.js@@ -154,12 +154,13 @@ export async function fetchWalletState(agent, opts = {}) {let holdings;try {const r = await fetch(- `/api/agents/${encodeURIComponent(agentId)}/solana/holdings?network=${network}`,+ `/api/agents/${encodeURIComponent(agentId)}/solana/holdings?network=${network}&miss=empty`,{ credentials: 'include' },);+ // 204 = wallet not provisioned yet → clean dormant baseline (not an error).+ if (r.status === 204) return empty;const body = await r.json().catch(() => ({}));if (!r.ok) {- // 404 = wallet not provisioned yet → clean dormant baseline (not an error).if (r.status === 404) return empty;return { ...empty, balanceError: body?.error?.code || 'holdings_error' };}diff --git a/tests/wallet-networth.test.js b/tests/wallet-networth.test.jsindex 73cf9fcc1..f3c10b176 100644--- a/tests/wallet-networth.test.js+++ b/tests/wallet-networth.test.js@@ -6,7 +6,7 @@// asset-mix palette, and that the same state always yields the same look (no// randomness, no time input). No network: every input is a plain state object.-import { describe, it, expect } from 'vitest';+import { describe, it, expect, vi, afterEach } from 'vitest';import {NETWORTH_TIERS,tierForUsd,@@ -15,6 +15,7 @@ import {walletGlowForUsd,formatNetWorth,THREE_MINT,+ fetchWalletState,} from '../src/shared/wallet-networth.js';const state = (usdTotal, mix = { sol: 1 }, extra = {}) => ({ usdTotal, mix, hasThree: false, ...extra });@@ -141,3 +142,21 @@ describe('THREE_MINT', () => {expect(THREE_MINT).toBe('FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump');});});++describe('fetchWalletState for a wallet-less agent', () => {+ afterEach(() => vi.unstubAllGlobals());++ // The aura re-reads on a timer, so the request opts into the 204 soft miss:+ // a 404 here would print a red console line on every poll for every agent+ // that has not provisioned a wallet yet.+ it('asks for the soft miss and renders a 204 as the clean dormant baseline', async () => {+ const fetchMock = vi.fn(async () => new Response(null, { status: 204 }));+ vi.stubGlobal('fetch', fetchMock);+ const out = await fetchWalletState('0f290230-48e0-4a39-9b32-3eb8d10a29a9');+ expect(fetchMock).toHaveBeenCalledTimes(1);+ expect(new URL(fetchMock.mock.calls[0][0], 'http://x').searchParams.get('miss')).toBe('empty');+ expect(out.usdTotal).toBe(0);+ expect(out.assets).toEqual([]);+ expect(out.balanceError).toBeNull();+ });+});