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
test(coin): pin the /api/coin/pool status mapping and the news 502, and retire the batch work order
nirholasc005a04a8cd4
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 5ccd0752c..f11f66aa4 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,11 +6,14 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr## 2026-08-10+- **A coin's exchange listings answer a bad page number instead of quietly ignoring it**: The exchange-listings table on a coin page reads its rows one page at a time. Asking for page 11 correctly said the page was out of range, but asking for page 0, a decimal, or a word silently served page 1 instead, so anything scripted against the endpoint got a page it never asked for and had no way to tell. It now applies one rule: leave the page off and you get the first one, otherwise it must be a whole number from 1 to 10 or you get a plain validation error saying so. The related-news rail on the same page also stops turning a publisher-feed outage into an anonymous internal error, and a coin's on-chain pool lookup no longer converts an upstream timeout into one. The coin market data reference now documents which paging limits are clamped and which are rejected. (`/coins`) `[fix, docs]`- **A cosmetic earnings outage now says so instead of showing you zero**: The creator earnings lookup used to answer a database outage with a clean set of zeroes, so a creator with real settled sales was told they had earned nothing and the dashboard rendered its "no cosmetic sales yet" empty state on top of it. An unreachable sales ledger is now reported as a temporary error the page can retry, while a creator who genuinely has no sales still reads back as real zeroes from the ledger. Two smaller fixes in the same family of endpoints: posting a split-config change under the wrong content type now returns an unsupported-media-type error naming the header instead of claiming the payload was malformed, and that endpoint no longer advertises credentialed cross-origin access it never used. (`/fits`) `[fix]`- **Agent pump.fun and directory endpoints answer bad input honestly**: Three fixes across the agent APIs. Calling a pump.fun action (portfolio, buy, sell, swap, launch, pay) with an id that is not a real agent id returned an anonymous internal error with a support reference; it now returns a plain not-found, matching every other agent endpoint. The pump.fun intel proxy checked whether the upstream feed was configured before it checked your request, so an unknown operation or a token lookup with no mint address could answer 200 with empty data on one deployment and a validation error on another; the request is now validated first, so the same call gets the same answer everywhere. A legacy single-skill price endpoint that no route could reach, and that skipped the cross-site protection its live replacement enforces, has been removed: setting one skill price still goes through the documented per-skill route. The public agent directory also logs a failed lookup now instead of quietly rendering as if nobody had published an agent. (`/agents`) `[fix]`- **Autopilot answers a bad request with a clear error instead of an internal failure**: The autopilot API (the proposal queue, the permission panel, and the signed activity feed) treated a few kinds of bad input as a server crash: an agent or proposal id that was not a real id, a negative page size, or a pagination cursor larger than the feed can hold all came back as an anonymous internal error with a support reference. Each of those now returns a plain 400 that names the offending field, and asking the proposal queue for an action it does not support says which actions exist instead of complaining about a missing proposal. Nothing about what autopilot can do changed: the ownership, permission and confirmation rules are untouched. (`/autopilot-activity`) `[fix]`- **Billing pages stop answering a mistyped link with a support reference**: Four paths through the billing API turned a bad request into an anonymous internal error. Opening a receipt, a withdrawal, or a saved payout wallet whose id in the URL was not a real id (a truncated copy-paste, a stale bookmark, a hand-edited link) returned a 500 with a support reference instead of simply saying the id was malformed. Paging your withdrawal history with a non-numeric page size did the same. All four now answer with a plain validation error naming the field, and the withdrawal list falls back to its normal page size instead of failing. Nothing about who can read what changed: every one of these endpoints still requires your session and still only ever returns your own billing records. (`/dashboard/billing`) `[fix]`+- **Coin Clash momentum now tracks a real price move, and the arena stops re-pricing every faction on every poll**: A faction's momentum bonus was documented as blending social activity with its coin's price move, but the market half never actually fired: the price signal was read and then dropped, so every army fought on social signals alone. Momentum now folds in a genuine move, measured against a baseline the platform samples and rolls forward once a day. The same change fixes what that cost: the arena used to price every faction from scratch on each 5-second poll, which meant hundreds of upstream price calls a minute for a number that barely moves. A faction is now priced at most once a minute for everyone, and a tap flush reads its own army's score instead of the whole round's table. (`/clash`) `[fix, improvement]`- **Older model names still work when you chat through the API**: The brain chat API keeps a small table that points retired model names at the model that replaced them, so a saved setting or an older script does not break the day a vendor deprecates a name. That table was never consulted: a request naming one of those older models was rejected as unknown before the table was ever read, including the exact name our own brain MCP tool tells clients to use. Those names now resolve to their current successor and answer normally, while a name that is genuinely not a model is still rejected right away. A malformed request is also reported as your bad input again rather than as a missing API key, so the error points at the thing you can actually fix. (`/brain`) `[fix]`+- **Posting a bounty on /go works again, and every bounty action is protected against cross-site requests**: Posting a bounty from the bounty board had stopped working: the page never sent the cross-site request token the server demands, so the Post Bounty button always failed. The board now sends that token on every action, and posting, submitting proof, liking a submission, running the AI judge, and confirming a winner all go through it, so another site can no longer make your browser close your bounty or accept a submission on your behalf. Four requests that used to come back as an anonymous internal error now answer plainly: resolving a bounty while signed out says sign in, a bounty link with a malformed id says not found, a malformed submission id says so, and a submission list asked for a nonsense page size returns the first page instead of failing. Confirming a winner now writes the winner, the rejected entries, and the closure together, so a failure part-way through can no longer leave a bounty with every entry rejected and no winner. The AI judge no longer echoes a raw error from its model provider into the page, and the account chip on the board shows your name instead of the word "account". (`/go`) `[fix, security]`- **Pricing rules are private to their seller, and clearing a scheduled window now sticks**: Three fixes to the agent pricing and earnings APIs. A seller's dynamic pricing rules (scheduled discounts, first-N-buyer deals, experiments they switched off) were readable by anyone who knew the agent id; listing them now requires being signed in as the agent's owner, the same rule that already applied to creating and deleting them. Clearing the start or end of a scheduled price window used to report success and quietly keep the old date, so a window you thought you reopened stayed shut; sending an empty date now really clears it. And asking the earnings summary, skill pricing, or X memory seeder about an id that is not a real agent id returned an anonymous internal error with a support reference instead of a plain not-found. (`/dashboard/creator`) `[fix, security]`- **Pump alerts sign every webhook and explain rejected edits properly**: Three fixes to the alert rules behind the pump dashboard. Any rule that sends to a webhook now always carries its own signing secret, so your receiver can verify a delivery really came from us: rules carried over from the old single-alert setup were missing that secret and were being delivered unsigned. When an edit is rejected, the message now names the field it is complaining about, the same way creating a rule always has, instead of a bare sentence you had to guess at. And editing a rule that was deleted in another tab now answers with a plain not-found instead of a server error. (`/pump-dashboard`) `[fix, security]`- **Revoking an API key with a malformed id now gives a clear error instead of a server fault**: Deleting an API key through the developer API used to hand whatever id it was given straight to the database, so an id that could never match a key came back as a generic "internal error, quote this reference to support" 500. It now answers a plain 400 saying the id must be a key identifier, and the database is never touched for input that cannot match. Real revokes, the ownership check that stops one account revoking another account's key, and the already-revoked case all behave exactly as before. (`/dashboard`) `[fix]`@@ -18,6 +21,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **The "Claim Your 3D Avatar" Blink names the avatar it points at, and refuses inputs it should never have accepted**: The shareable Solana Blink that claims a 3D avatar now looks the avatar up before it draws the card: it shows that avatar's real name, and returns a clear not-available error for one that is private, deleted, or does not exist, instead of advertising a claim nobody can complete. The card and its claim transaction now only accept "default" or a genuine avatar id, so an arbitrary string can no longer ride into the on-chain memo the wallet signs, and a wallet address that no key can ever sign for is rejected before a transaction is built rather than after. The live 3D portrait rendered into the card had a bigger hole: its background-colour setting was passed straight into the rendering page, so a crafted share link could run its own code inside our renderer. That input is now validated as a colour, the renderer escapes every value it embeds regardless of caller, and the portrait endpoint no longer starts a render for a request method it does not serve. A rendering failure now says which side failed, and a Solana node that will not answer comes back as a service-unavailable message rather than a hang. `[security, fix]`- **The agent trade demo stops before spending SOL it cannot deliver on**: Two fixes on the agent-to-agent trade surface. The live demo used to pay the Oracle agent real SOL and only then discover that no analysis model was reachable, so the buyer's money bought nothing; it now confirms a model can answer before any payment is signed, and stops with a clear message when none can. While it worked, the demo also announced the wrong model (it always said Claude Haiku, whichever model was really about to run) and now names the lane that actually produces the analysis. On the paid Oracle skill endpoint itself, a payment proof that is not a real Solana signature comes back immediately as an invalid-payment error instead of spending several seconds asking the chain about it. (`/agent-trade`) `[fix, improvement]`- **The agent-to-agent economy demo speaks again, and never pays for a service it could not deliver**: On the live agent economy page, Nova hires Oracle for a paid data service and Oracle answers with a real model response. That answer had gone silent: the endpoint fetched it over an internal HTTP call to an address that does not exist in production, so both agents stayed mute while the page still reported the trade as complete. The delivery now runs directly against the platform model chain, and it runs before the payment: if no model can produce the service, the request stops with a clear "try again in a moment" and not one lamport leaves Nova's wallet. A request naming a service that does not exist is now rejected outright instead of slipping through as an unnamed, unpriced one, and the daily on-chain spending ceiling is only spent when a payment actually fires, so an empty wallet can no longer exhaust the day's budget for everyone. (`/agent-economy`) `[fix]`+- **The AGI page can no longer show you the wrong mind**: Asking /agi to inspect a specific agent with a malformed ID used to quietly answer with a different agent entirely, so the decisions, track record, and mood on screen belonged to somebody else with nothing saying so. A bad ID is now a clear error. The flagship pointer is also checked before anything is published: if it names an agent that was made private or deleted, the page shows its designed awakening state instead of exposing a private ledger or inventing an identity for an agent that no longer exists. (`/agi`) `[fix, security]`- **The aixbt market feeds now say when the key, not you, is the problem**: When aixbt turned down this deployment's API key, the narrative intel, momentum projects, grounding and chat feeds all answered with a plain 'unauthorized' aimed at you. Nothing on those surfaces ever asked you to sign in, so the message read as a dead end nobody could act on. They now report the real cause, that the platform's aixbt key has expired or sits below the plan the read needs, and carry the same setup pointer the missing-key state shows, so the in-world aixbt panel and the intel SDK both render something an operator can fix. The intel and projects feeds also stop advertising a page size of 100 they were never able to return, and a chat turn that comes back empty now says so instead of handing you a blank answer marked successful. (`/docs/api-reference`) `[fix, improvement]`- **The CA to x402 tool now always hands you a three.ws payment address**: Paste a contract address into the CA to x402 tool and it generates a paid data service for that token, complete with copy-paste commands you run to pay for and call it. Those commands were built from the web address in your browser's request, which anyone could forge: a crafted link could have handed a visitor a set of "pay here" commands pointing at somebody else's server, and because the answer is cached at the edge, that swapped copy could then have been served on to other visitors. The generated endpoint and every snippet are now pinned to three.ws itself, so what you copy is always ours no matter how the page was reached. (`/ca2x402`) `[security, fix]`- **The chat plugin now tells you when your Agent ID is wrong**: In the SperaxOS and LobeChat plugin, a mistyped or deleted Agent ID used to come back as a cheerful confirmation while the avatar panel stayed empty, so the model told you it had bound an agent that does not exist. The plugin now checks the ID against your real agents before answering: a bad ID returns a clear error pointing you back to the dashboard to recopy it, and a good one comes back with the agent name so you can see at a glance which identity the panel is wearing. Stray spaces around a pasted ID are trimmed instead of breaking the binding. (`/docs/embedding`) `[fix]`diff --git a/docs/agi.md b/docs/agi.mdindex 8c6ef9416..c1af26209 100644--- a/docs/agi.md+++ b/docs/agi.md@@ -19,11 +19,11 @@ The second bet is accountability. Every decision it makes is logged with its rea**Which agent is the AGI** is resolved in priority order, never hardcoded to a fake:-1. `?agent=<uuid>` inspects any public agent through the AGI lens.-2. `AGI_AGENT_ID` env var names the platform's flagship, when set.+1. `?agent=<uuid>` inspects any public agent through the AGI lens. A value that is not a UUID is a `400`, never a silent fall-through to a different agent: asking about one mind and being answered about another is worse than an error.+2. `AGI_AGENT_ID` env var names the platform's flagship, when set. It is still checked against the database: if it points at an agent that is private or no longer exists, the API returns the awakening envelope rather than publishing that agent.3. Otherwise, a deterministic real fallback: the public agent with the strongest on-chain pump.fun track record (most closed positions, tie-broken by most recent activity). A platform with zero trading agents collapses to a designed "awakening" state rather than inventing one.-**The truth layers**, fetched in parallel, each degrading to null on its own failure rather than failing the page:+**The truth layers**, fetched in parallel. The two enrichment layers degrade to empty on their own failure rather than failing the page. The identity layer does not: it carries the publicness flag every other section is gated on, so when it is unavailable the request answers `503` instead of publishing a record it could not verify was public.- `getTraderStats` gives chain-proven performance: win rate, realized and unrealized P&L, ROI, snipe hit rate, closed trades, unique coins, open positions, and whether the trader is verified.- The Reasoning Ledger (`getReputationRecords`, `computeReputation`, `getDecisionsWithOutcomes`) gives the explainable reputation score and the recent decisions with their reconciled outcomes.@@ -68,7 +68,7 @@ An "awakening" envelope (no eligible trading agent yet) is still valid and fully- **Always real, never sampled.** The AGI is a designated real agent resolved from live data. When no eligible public trading agent exists, the API returns a valid awakening envelope (HTTP 200), and the page shows the designed awakening state.- **Autonomy is capped.** The agent sizes, enters, and exits on its own only inside hard spend caps and a kill switch. It cannot be talked past its safety policy, and the doctrine says so.- **Accountability is mechanical.** Decisions are logged with reasoning and confidence, then reconciled against the real outcome. Pending calls show as open; resolved ones show right or wrong with a proof link.-- **Graceful degradation.** Each truth layer degrades to null on failure rather than failing the page. An explicit `?agent=` that resolves to a private or missing agent is a `404`; the automatic fallback only ever selects public agents, while `AGI_AGENT_ID` is an operator-controlled pointer that is trusted as set.+- **Graceful degradation, but never at the cost of privacy.** The reputation and decision layers degrade to empty on failure rather than failing the page; the identity layer that carries the publicness flag answers `503` instead. An explicit `?agent=` that resolves to a private or missing agent is a `404`, and a malformed one is a `400`. The `AGI_AGENT_ID` and automatic paths only ever publish an agent that exists and is public: anything else renders the awakening state, so a stale operator pointer can never expose a private ledger or invent an identity.- **Reputation is regressed.** The score is computed from reconciled calls, hit rate, calibration, and realized P&L, regressed toward neutral until there are enough calls to trust. Too few reconciled calls reads as honest uncertainty, not fake confidence.- **Embodiment is enhancement, never a dependency.** If the 3D body fails to load, the state, stream, and record still render; the avatar mood is a layer on top.- **Not financial advice.** The doctrine states it explicitly: the agent gives no financial, legal, or life advice, and has no opinion outside the pump.fun order book.diff --git a/prompts/swarm-100/api-agi-01.md b/prompts/swarm-100/api-agi-01.mddeleted file mode 100644index 2558bc809..000000000--- a/prompts/swarm-100/api-agi-01.md+++ /dev/null@@ -1,101 +0,0 @@-# API audit: api/agi batch 01 (1 files)--How to run: paste this file's repo path into a fresh Claude Code chat in this-repository and say "run this work order". This file is fully self-contained:-it depends on no other prompt file anywhere. If neighboring files in-prompts/swarm-100/ are gone, that work is done; if present, ignore them.-Every claim below rots; step 0 re-measures, and what you measure wins.--## Operating clause (binding)--- Read CLAUDE.md first. Its rules override everything, including this file.-- Finish 100% in this session. Never end the turn with a question, an option- list, or an unexecuted plan. A judgment call goes in one line of the final- report; it never becomes a question that halts work.-- The only permitted stops are the CLAUDE.md stop-and-ask gates: spending real- funds or any irreversible on-chain write, git push or a production deploy,- committing content that references a crypto project other than $THREE, and- destroying unrecoverable data.-- No mocks, no fake data, no placeholder stubs, no unfinished-work markers, no- commented-out code. Real APIs and real integrations only.-- The em-dash and en-dash characters are banned in everything you write.-- Concurrent agents share this worktree: stage explicit paths only (never a- bare add-everything), and commit finished work promptly.-- Before committing, run: npm run check:rules -- --paths <files you touched>.- It must exit 0.--## Step 0: re-derive the current state--1. Confirm each file below still exists; deleted ones are done, skip them.-2. For each, decide routability: grep its path in vercel.json and read how- server/index.mjs maps filesystem handlers. Routed files get an endpoint- audit; internal modules get a code and test audit.-3. Start a local server for endpoint checks: node server/index.mjs with .env- loaded, on a free PORT if 3000 is busy.--## Task: audit these api files, then fix everything found--Files in this batch:--- api/agi/state.js--For every routed handler:--1. Exercise it with curl against the local server: the success path returns- real data with the correct status; malformed input returns a 4xx JSON- error, never a stack trace or an HTML error page; auth is enforced where- the code intends it; CORS matches neighboring handlers.-2. Hard-rule scan: no mock fallbacks, no fake-data arrays, no stubbed- responses, no unfinished markers. Errors are handled at the boundary and- internal code trusts itself.-3. Do not spend funds or sign anything on-chain while probing. Payment and- trading handlers get their validation and error paths exercised, never a- live settlement.--For every internal (non-routed) module:--4. Something must import it; if nothing does, delete it as dead code (verify- with a repo-wide grep first).-5. Its main path and one failure path must be covered in tests/; add the- missing test if not.--## Definition of done--- [ ] Every listed file has recorded evidence: a curl transcript for routed- handlers, a passing test or a deletion for internal modules.-- [ ] Zero hard-rule violations remain in these files.-- [ ] vitest run passes; npm run check:rules -- --paths <touched files>- exits 0.--## Never blocked--| Blocker | Resolution (act, do not ask) |-|---|---|-| Missing env var or credential | Check .env and .env.local, then the Cloud Run service env, then Secret Manager (the CLAUDE.md self-unblock playbook has the exact commands). If it truly exists nowhere, wire the code fully behind the env var, prove the wiring with a dry run, and name the single missing var in the report. |-| gcloud not on PATH | Run: export PATH="$HOME/google-cloud-sdk/bin:$PATH" |-| Dev server port 3000 busy | Another agent may be serving this repo; probe it and reuse if so. Otherwise start your own on a free port: npx vite --port 3101 |-| Playwright browser missing | npx playwright install chromium |-| A surface needs a signed-in user | Register a fresh account through the real /register flow against the real API and use it. Never mock the session. |-| A defect sits in code you did not touch | Fix it if it blocks a Definition of done line (root cause it, never mask it). Otherwise note it in the report and continue. |-| An unrelated test is red | Same rule. Never pipe npm test through tail; it masks exit codes. |--## Close out (required)--1. Verify every Definition of done line with the actual command output in- front of you. Never claim a line you did not verify.-2. Commit with explicit paths and a subject that describes the diff (house- style: type(scope): what changed and why a reader cares).-3. Delete this prompt file in that same commit:-- git rm prompts/swarm-100/api-agi-01.md-- The shrinking directory is this campaign's only progress ledger; there is- no progress log to update.-4. Final report: what step 0 measured, what changed (file list), evidence per- Definition of done line, and any one-line judgment calls. No trailing- questions, no unexecuted plans.--If a line genuinely cannot pass inside this session (an external party must-respond, or an owner-gated action is the final step), finish everything else,-leave this file in place, and state exactly which line remains and who owns-it. Never delete this file on a partial.diff --git a/prompts/swarm-100/api-coin-02.md b/prompts/swarm-100/api-coin-02.mddeleted file mode 100644index 67baed89c..000000000--- a/prompts/swarm-100/api-coin-02.md+++ /dev/null@@ -1,108 +0,0 @@-# API audit: api/coin batch 02 (8 files)--How to run: paste this file's repo path into a fresh Claude Code chat in this-repository and say "run this work order". This file is fully self-contained:-it depends on no other prompt file anywhere. If neighboring files in-prompts/swarm-100/ are gone, that work is done; if present, ignore them.-Every claim below rots; step 0 re-measures, and what you measure wins.--## Operating clause (binding)--- Read CLAUDE.md first. Its rules override everything, including this file.-- Finish 100% in this session. Never end the turn with a question, an option- list, or an unexecuted plan. A judgment call goes in one line of the final- report; it never becomes a question that halts work.-- The only permitted stops are the CLAUDE.md stop-and-ask gates: spending real- funds or any irreversible on-chain write, git push or a production deploy,- committing content that references a crypto project other than $THREE, and- destroying unrecoverable data.-- No mocks, no fake data, no placeholder stubs, no unfinished-work markers, no- commented-out code. Real APIs and real integrations only.-- The em-dash and en-dash characters are banned in everything you write.-- Concurrent agents share this worktree: stage explicit paths only (never a- bare add-everything), and commit finished work promptly.-- Before committing, run: npm run check:rules -- --paths <files you touched>.- It must exit 0.--## Step 0: re-derive the current state--1. Confirm each file below still exists; deleted ones are done, skip them.-2. For each, decide routability: grep its path in vercel.json and read how- server/index.mjs maps filesystem handlers. Routed files get an endpoint- audit; internal modules get a code and test audit.-3. Start a local server for endpoint checks: node server/index.mjs with .env- loaded, on a free PORT if 3000 is busy.--## Task: audit these api files, then fix everything found--Files in this batch:--- api/coin/liquidations.js-- api/coin/markets.js-- api/coin/news.js-- api/coin/ohlc.js-- api/coin/pool.js-- api/coin/rates.js-- api/coin/tickers.js-- api/coin/trending.js--For every routed handler:--1. Exercise it with curl against the local server: the success path returns- real data with the correct status; malformed input returns a 4xx JSON- error, never a stack trace or an HTML error page; auth is enforced where- the code intends it; CORS matches neighboring handlers.-2. Hard-rule scan: no mock fallbacks, no fake-data arrays, no stubbed- responses, no unfinished markers. Errors are handled at the boundary and- internal code trusts itself.-3. Do not spend funds or sign anything on-chain while probing. Payment and- trading handlers get their validation and error paths exercised, never a- live settlement.--For every internal (non-routed) module:--4. Something must import it; if nothing does, delete it as dead code (verify- with a repo-wide grep first).-5. Its main path and one failure path must be covered in tests/; add the- missing test if not.--## Definition of done--- [ ] Every listed file has recorded evidence: a curl transcript for routed- handlers, a passing test or a deletion for internal modules.-- [ ] Zero hard-rule violations remain in these files.-- [ ] vitest run passes; npm run check:rules -- --paths <touched files>- exits 0.--## Never blocked--| Blocker | Resolution (act, do not ask) |-|---|---|-| Missing env var or credential | Check .env and .env.local, then the Cloud Run service env, then Secret Manager (the CLAUDE.md self-unblock playbook has the exact commands). If it truly exists nowhere, wire the code fully behind the env var, prove the wiring with a dry run, and name the single missing var in the report. |-| gcloud not on PATH | Run: export PATH="$HOME/google-cloud-sdk/bin:$PATH" |-| Dev server port 3000 busy | Another agent may be serving this repo; probe it and reuse if so. Otherwise start your own on a free port: npx vite --port 3101 |-| Playwright browser missing | npx playwright install chromium |-| A surface needs a signed-in user | Register a fresh account through the real /register flow against the real API and use it. Never mock the session. |-| A defect sits in code you did not touch | Fix it if it blocks a Definition of done line (root cause it, never mask it). Otherwise note it in the report and continue. |-| An unrelated test is red | Same rule. Never pipe npm test through tail; it masks exit codes. |--## Close out (required)--1. Verify every Definition of done line with the actual command output in- front of you. Never claim a line you did not verify.-2. Commit with explicit paths and a subject that describes the diff (house- style: type(scope): what changed and why a reader cares).-3. Delete this prompt file in that same commit:-- git rm prompts/swarm-100/api-coin-02.md-- The shrinking directory is this campaign's only progress ledger; there is- no progress log to update.-4. Final report: what step 0 measured, what changed (file list), evidence per- Definition of done line, and any one-line judgment calls. No trailing- questions, no unexecuted plans.--If a line genuinely cannot pass inside this session (an external party must-respond, or an owner-gated action is the final step), finish everything else,-leave this file in place, and state exactly which line remains and who owns-it. Never delete this file on a partial.diff --git a/public/changelog.json b/public/changelog.jsonindex 963aa2bd0..2b74ca919 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,11 +1,22 @@{- "generated_at": "2026-08-10T17:27:55.180Z",+ "generated_at": "2026-08-10T17:35:13.219Z","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-08-10",+ "type": "update",+ "title": "A coin's exchange listings answer a bad page number instead of quietly ignoring it",+ "summary": "The exchange-listings table on a coin page reads its rows one page at a time. Asking for page 11 correctly said the page was out of range, but asking for page 0, a decimal, or a word silently served page 1 instead, so anything scripted against the endpoint got a page it never asked for and had no way to tell. It now applies one rule: leave the page off and you get the first one, otherwise it must be a whole number from 1 to 10 or you get a plain validation error saying so. The related-news rail on the same page also stops turning a publisher-feed outage into an anonymous internal error, and a coin's on-chain pool lookup no longer converts an upstream timeout into one. The coin market data reference now documents which paging limits are clamped and which are rejected.",+ "link": "/coins",+ "tags": [+ "fix",+ "docs"+ ]+ },{"date": "2026-08-10","type": "update",@@ -46,6 +57,17 @@"fix"]},+ {+ "date": "2026-08-10",+ "type": "update",+ "title": "Coin Clash momentum now tracks a real price move, and the arena stops re-pricing every faction on every poll",+ "summary": "A faction's momentum bonus was documented as blending social activity with its coin's price move, but the market half never actually fired: the price signal was read and then dropped, so every army fought on social signals alone. Momentum now folds in a genuine move, measured against a baseline the platform samples and rolls forward once a day. The same change fixes what that cost: the arena used to price every faction from scratch on each 5-second poll, which meant hundreds of upstream price calls a minute for a number that barely moves. A faction is now priced at most once a minute for everyone, and a tap flush reads its own army's score instead of the whole round's table.",+ "link": "/clash",+ "tags": [+ "fix",+ "improvement"+ ]+ },{"date": "2026-08-10","type": "update",@@ -56,6 +78,17 @@"fix"]},+ {+ "date": "2026-08-10",+ "type": "update",+ "title": "Posting a bounty on /go works again, and every bounty action is protected against cross-site requests",+ "summary": "Posting a bounty from the bounty board had stopped working: the page never sent the cross-site request token the server demands, so the Post Bounty button always failed. The board now sends that token on every action, and posting, submitting proof, liking a submission, running the AI judge, and confirming a winner all go through it, so another site can no longer make your browser close your bounty or accept a submission on your behalf. Four requests that used to come back as an anonymous internal error now answer plainly: resolving a bounty while signed out says sign in, a bounty link with a malformed id says not found, a malformed submission id says so, and a submission list asked for a nonsense page size returns the first page instead of failing. Confirming a winner now writes the winner, the rejected entries, and the closure together, so a failure part-way through can no longer leave a bounty with every entry rejected and no winner. The AI judge no longer echoes a raw error from its model provider into the page, and the account chip on the board shows your name instead of the word \"account\".",+ "link": "/go",+ "tags": [+ "fix",+ "security"+ ]+ },{"date": "2026-08-10","type": "update",@@ -130,6 +163,17 @@"fix"]},+ {+ "date": "2026-08-10",+ "type": "update",+ "title": "The AGI page can no longer show you the wrong mind",+ "summary": "Asking /agi to inspect a specific agent with a malformed ID used to quietly answer with a different agent entirely, so the decisions, track record, and mood on screen belonged to somebody else with nothing saying so. A bad ID is now a clear error. The flagship pointer is also checked before anything is published: if it names an agent that was made private or deleted, the page shows its designed awakening state instead of exposing a private ledger or inventing an identity for an agent that no longer exists.",+ "link": "/agi",+ "tags": [+ "fix",+ "security"+ ]+ },{"date": "2026-08-10","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 0e73089d6..0389d3429 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>A coin's exchange listings answer a bad page number instead of quietly ignoring it</title>+ <link>https://three.ws/coins</link>+ <guid isPermaLink="false">2026-08-10:A coin's exchange listings answer a bad page number instead of quietly ignoring it</guid>+ <pubDate>Mon, 10 Aug 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>The exchange-listings table on a coin page reads its rows one page at a time. Asking for page 11 correctly said the page was out of range, but asking for page 0, a decimal, or a word silently served page 1 instead, so anything scripted against the endpoint got a page it never asked for and had no way to tell. It now applies one rule: leave the page off and you get the first one, otherwise it must be a whole number from 1 to 10 or you get a plain validation error saying so. The related-news rail on the same page also stops turning a publisher-feed outage into an anonymous internal error, and a coin's on-chain pool lookup no longer converts an upstream timeout into one. The coin market data reference now documents which paging limits are clamped and which are rejected.</description>+ </item><item><title>A cosmetic earnings outage now says so instead of showing you zero</title><link>https://three.ws/fits</link>@@ -38,6 +46,14 @@<category>fix</category><description>Four paths through the billing API turned a bad request into an anonymous internal error. Opening a receipt, a withdrawal, or a saved payout wallet whose id in the URL was not a real id (a truncated copy-paste, a stale bookmark, a hand-edited link) returned a 500 with a support reference instead of simply saying the id was malformed. Paging your withdrawal history with a non-numeric page size did the same. All four now answer with a plain validation error naming the field, and the withdrawal list falls back to its normal page size instead of failing. Nothing about who can read what changed: every one of these endpoints still requires your session and still only ever returns your own billing records.</description></item>+ <item>+ <title>Coin Clash momentum now tracks a real price move, and the arena stops re-pricing every faction on every poll</title>+ <link>https://three.ws/clash</link>+ <guid isPermaLink="false">2026-08-10:Coin Clash momentum now tracks a real price move, and the arena stops re-pricing every faction on every poll</guid>+ <pubDate>Mon, 10 Aug 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>A faction's momentum bonus was documented as blending social activity with its coin's price move, but the market half never actually fired: the price signal was read and then dropped, so every army fought on social signals alone. Momentum now folds in a genuine move, measured against a baseline the platform samples and rolls forward once a day. The same change fixes what that cost: the arena used to price every faction from scratch on each 5-second poll, which meant hundreds of upstream price calls a minute for a number that barely moves. A faction is now priced at most once a minute for everyone, and a tap flush reads its own army's score instead of the whole round's table.</description>+ </item><item><title>Older model names still work when you chat through the API</title><link>https://three.ws/brain</link>@@ -46,6 +62,14 @@<category>fix</category><description>The brain chat API keeps a small table that points retired model names at the model that replaced them, so a saved setting or an older script does not break the day a vendor deprecates a name. That table was never consulted: a request naming one of those older models was rejected as unknown before the table was ever read, including the exact name our own brain MCP tool tells clients to use. Those names now resolve to their current successor and answer normally, while a name that is genuinely not a model is still rejected right away. A malformed request is also reported as your bad input again rather than as a missing API key, so the error points at the thing you can actually fix.</description></item>+ <item>+ <title>Posting a bounty on /go works again, and every bounty action is protected against cross-site requests</title>+ <link>https://three.ws/go</link>+ <guid isPermaLink="false">2026-08-10:Posting a bounty on /go works again, and every bounty action is protected against cross-site requests</guid>+ <pubDate>Mon, 10 Aug 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Posting a bounty from the bounty board had stopped working: the page never sent the cross-site request token the server demands, so the Post Bounty button always failed. The board now sends that token on every action, and posting, submitting proof, liking a submission, running the AI judge, and confirming a winner all go through it, so another site can no longer make your browser close your bounty or accept a submission on your behalf. Four requests that used to come back as an anonymous internal error now answer plainly: resolving a bounty while signed out says sign in, a bounty link with a malformed id says not found, a malformed submission id says so, and a submission list asked for a nonsense page size returns the first page instead of failing. Confirming a winner now writes the winner, the rejected entries, and the closure together, so a failure part-way through can no longer leave a bounty with every entry rejected and no winner. The AI judge no longer echoes a raw error from its model provider into the page, and the account chip on the board shows your name instead of the word "account".</description>+ </item><item><title>Pricing rules are private to their seller, and clearing a scheduled window now sticks</title><link>https://three.ws/dashboard/creator</link>@@ -102,6 +126,14 @@<category>fix</category><description>On the live agent economy page, Nova hires Oracle for a paid data service and Oracle answers with a real model response. That answer had gone silent: the endpoint fetched it over an internal HTTP call to an address that does not exist in production, so both agents stayed mute while the page still reported the trade as complete. The delivery now runs directly against the platform model chain, and it runs before the payment: if no model can produce the service, the request stops with a clear "try again in a moment" and not one lamport leaves Nova's wallet. A request naming a service that does not exist is now rejected outright instead of slipping through as an unnamed, unpriced one, and the daily on-chain spending ceiling is only spent when a payment actually fires, so an empty wallet can no longer exhaust the day's budget for everyone.</description></item>+ <item>+ <title>The AGI page can no longer show you the wrong mind</title>+ <link>https://three.ws/agi</link>+ <guid isPermaLink="false">2026-08-10:The AGI page can no longer show you the wrong mind</guid>+ <pubDate>Mon, 10 Aug 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Asking /agi to inspect a specific agent with a malformed ID used to quietly answer with a different agent entirely, so the decisions, track record, and mood on screen belonged to somebody else with nothing saying so. A bad ID is now a clear error. The flagship pointer is also checked before anything is published: if it names an agent that was made private or deleted, the page shows its designed awakening state instead of exposing a private ledger or inventing an identity for an agent that no longer exists.</description>+ </item><item><title>The aixbt market feeds now say when the key, not you, is the problem</title><link>https://three.ws/docs/api-reference</link>diff --git a/public/features.json b/public/features.jsonindex fad6d19b5..eb1bbf164 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-08-10T17:27:55.006Z",+ "generated_at": "2026-08-10T17:35:13.041Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/tests/api/coin-news-gate.test.js b/tests/api/coin-news-gate.test.jsindex 9d5b1652f..f9e558a56 100644--- a/tests/api/coin-news-gate.test.js+++ b/tests/api/coin-news-gate.test.js@@ -17,7 +17,12 @@ vi.mock('../../api/_lib/rate-limit.js', () => ({clientIp: () => '203.0.113.1',}));-const searchNews = vi.fn();+// Re-created per test rather than cleared between them. Clearing a vitest mock+// detaches the rejection tracking it attaches to a promise result, so the+// derived promise behind a `mockRejectedValue` lane surfaces as an unhandled+// rejection and fails the test even though the handler awaited and caught it.+// A fresh mock keeps an empty call history with the tracking intact.+let searchNews = vi.fn();vi.mock('../../api/_lib/news.js', () => ({ searchNews: (...a) => searchNews(...a) }));const news = (await import('../../api/coin/news.js')).default;@@ -48,7 +53,7 @@ async function call(query) {}describe('/api/coin/news outage gate', () => {- beforeEach(() => searchNews.mockReset());+ beforeEach(() => { searchNews = vi.fn(); });it('serves articles held from a stale-but-usable cache, even with zero ok sources', async () => {searchNews.mockResolvedValue({ articles: [article('One'), article('Two')], total: 2, sources_ok: 0, sources_total: 158 });diff --git a/tests/api/coin-pool-errors.test.js b/tests/api/coin-pool-errors.test.jsnew file mode 100644index 000000000..7bb8975c0--- /dev/null+++ b/tests/api/coin-pool-errors.test.js@@ -0,0 +1,136 @@+// /api/coin/pool: every upstream outcome maps to a status the client can act on.+//+// The /coin/:id page mounts the GeckoTerminal chart embed only when this route+// resolves a pool, and falls back to an "open on GeckoTerminal" link otherwise.+// That decision hangs entirely on the status, so the mapping is the contract:+// no indexed pool is a 404 (a real answer about a real token), a throttle is a+// 429 the client can retry, and anything else is a 502.+//+// The catch block also has to survive a rejection that carries no `status` at+// all. `AbortSignal.timeout` rejects with a DOMException, and a bare `throw`+// deeper in the stack can reject with a non-object; reading `.status` off those+// unguarded turned a routine upstream timeout into an unhandled 500.++import { describe, it, expect, vi, beforeEach } from 'vitest';++vi.mock('../../api/_lib/zauth.js', () => ({ instrument: () => {}, drain: async () => {} }));+vi.mock('../../api/_lib/sentry.js', () => ({ captureException: () => {} }));+vi.mock('../../api/_lib/alerts.js', () => ({ sendOpsAlert: () => {} }));+vi.mock('../../api/_lib/rate-limit.js', () => ({+ limits: { marketDataIp: async () => ({ success: true }) },+ clientIp: () => '203.0.113.1',+}));++// Re-created per test rather than cleared between them: clearing a vitest mock+// detaches the rejection tracking attached to its promise result, so a+// `mockRejectedValue` lane surfaces as an unhandled rejection even though the+// handler awaited and caught it.+let topPoolForToken = vi.fn();+vi.mock('../../api/_lib/market/ohlcv.js', () => ({+ topPoolForToken: (...a) => topPoolForToken(...a),+}));++const pool = (await import('../../api/coin/pool.js')).default;++// $THREE, the platform's own mint: a real, indexed Solana token.+const THREE_MINT = 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump';+const EVM_TOKEN = '0x1234567890abcdef1234567890abcdef12345678';++function makeRes() {+ return {+ statusCode: 200,+ _h: {},+ setHeader(k, v) { this._h[k.toLowerCase()] = v; },+ getHeader(k) { return this._h[k.toLowerCase()]; },+ end(body) { this._body = body; },+ };+}+async function call(query) {+ const res = makeRes();+ await pool({ url: `/api/coin/pool?${query}`, method: 'GET', headers: {} }, res);+ return { res, body: JSON.parse(res._body) };+}++describe('/api/coin/pool status mapping', () => {+ beforeEach(() => { topPoolForToken = vi.fn(); });++ it('resolves the most-liquid pool for a Solana mint', async () => {+ topPoolForToken.mockResolvedValue('5ByL7MZoLABYnwMPZKPKjf4MGkZ7FeBzrAnos19Pre2z');+ const { res, body } = await call(`address=${THREE_MINT}&network=solana`);+ expect(res.statusCode).toBe(200);+ expect(body).toEqual({+ network: 'solana',+ address: THREE_MINT,+ pool: '5ByL7MZoLABYnwMPZKPKjf4MGkZ7FeBzrAnos19Pre2z',+ });+ expect(res.getHeader('cache-control')).toMatch(/s-maxage=\d+/);+ });++ it('defaults to the home chain when no network is given', async () => {+ topPoolForToken.mockResolvedValue('pool123');+ const { res } = await call(`address=${THREE_MINT}`);+ expect(res.statusCode).toBe(200);+ expect(topPoolForToken).toHaveBeenCalledWith(THREE_MINT, 'solana');+ });++ it('accepts an EVM token on an EVM network', async () => {+ topPoolForToken.mockResolvedValue('0xpool');+ const { res } = await call(`address=${EVM_TOKEN}&network=base`);+ expect(res.statusCode).toBe(200);+ });++ it('rejects an unsupported network before any upstream call', async () => {+ const { res, body } = await call(`address=${THREE_MINT}&network=fakenet`);+ expect(res.statusCode).toBe(400);+ expect(body.error).toBe('bad_network');+ expect(topPoolForToken).not.toHaveBeenCalled();+ });++ it('rejects an EVM address submitted as a Solana mint', async () => {+ const { res, body } = await call(`address=${EVM_TOKEN}&network=solana`);+ expect(res.statusCode).toBe(400);+ expect(body.error).toBe('bad_address');+ expect(topPoolForToken).not.toHaveBeenCalled();+ });++ it('rejects a Solana mint submitted as an EVM address', async () => {+ const { res, body } = await call(`address=${THREE_MINT}&network=base`);+ expect(res.statusCode).toBe(400);+ expect(body.error).toBe('bad_address');+ expect(topPoolForToken).not.toHaveBeenCalled();+ });++ it('reports an unindexed token as 404, not an outage', async () => {+ const err = new Error('not found');+ err.status = 404;+ topPoolForToken.mockRejectedValue(err);+ const { res, body } = await call(`address=${THREE_MINT}&network=solana`);+ expect(res.statusCode).toBe(404);+ expect(body.error).toBe('no_pool');+ });++ it('passes a throttle through as 429 so the client can back off', async () => {+ const err = new Error('too many requests');+ err.status = 429;+ topPoolForToken.mockRejectedValue(err);+ const { res, body } = await call(`address=${THREE_MINT}&network=solana`);+ expect(res.statusCode).toBe(429);+ expect(body.error).toBe('rate_limited');+ });++ it('answers 502 for a timeout that carries no status', async () => {+ // AbortSignal.timeout rejects with a DOMException: an object with no+ // `.status`. Reading it unguarded used to throw inside the catch.+ topPoolForToken.mockRejectedValue(new DOMException('The operation was aborted.', 'TimeoutError'));+ const { res, body } = await call(`address=${THREE_MINT}&network=solana`);+ expect(res.statusCode).toBe(502);+ expect(body.error).toBe('upstream_error');+ });++ it('answers 502 for a non-object rejection instead of a 500', async () => {+ topPoolForToken.mockRejectedValue(undefined);+ const { res, body } = await call(`address=${THREE_MINT}&network=solana`);+ expect(res.statusCode).toBe(502);+ expect(body.error).toBe('upstream_error');+ });+});