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
Add 3D avatar and model generation skills with comprehensive documentation
nirholasa2ac865db513
diff --git a/.agents/skills/create-3d-avatar/SKILL.md b/.agents/skills/create-3d-avatar/SKILL.mdnew file mode 100644index 000000000..a25e621ad--- /dev/null+++ b/.agents/skills/create-3d-avatar/SKILL.md@@ -0,0 +1,125 @@+---+name: create-3d-avatar+description: Turn a text prompt (or reference image) into a rigged, animation-ready 3D avatar (GLB). Use when you or the user want to create, generate, or make a 3D avatar, character, or humanoid figure that can be posed and animated — "make a 3D avatar of a knight", "generate a character I can animate", "create a rigged astronaut". Generates the mesh and adds a humanoid skeleton in one step. Returns a GLB URL plus a pose-studio link.+when_to_use: User wants a posable/animatable humanoid character. For a static object or prop, use generate-3d-model. To rig a GLB you already have, use rig-a-model.+license: MIT+metadata:+ category: 3d/creative+ cross-platform-safe: true+ pack: three-ws-skills+---++# Create a rigged 3D avatar++Turn a text prompt or a reference image into a **rigged, animation-ready** humanoid+avatar (GLB). One call generates the textured mesh, then auto-rigs it — adding a+humanoid skeleton and skin weights — so the model can be posed and play animation+clips immediately.++The result is a **`glbUrl`** for the rigged model plus a **pose-studio link** that+opens the avatar ready to pose in the browser.++## When to use which tool++| Goal | Use |+| --- | --- |+| A posable humanoid **character** from text/image | this skill |+| A static object / prop / creature | `generate-3d-model` |+| Add a skeleton to a GLB you already generated | `rig-a-model` |++Auto-rigging assumes a **humanoid figure**. A clearly non-humanoid subject+(furniture, vehicle, quadruped) is steered to `generate-3d-model` instead.++## Fastest path — the MCP tool++If the three.ws MCP server is connected, call the one-step avatar tool:++- **Tool:** `forge_avatar`+- **Input:** `{ "prompt": "<character description>" }` or+ `{ "image_url": "<https URL to a reference image>" }`+ - `prompt` — describe a **single full-body humanoid** in a neutral standing pose:+ `"a friendly cartoon astronaut in a glossy white suit"`.+ - `image_url` — reconstruct and rig a character from a photo/render.+ - `allow_non_humanoid` — set `true` only to rig a non-humanoid subject anyway.+- **Returns:** the rigged `glbUrl` (or `riggedGlbUrl`), the intermediate mesh URL,+ a pose-studio link, and per-stage timing.++For a fast unrigged figure (no skeleton), use `text_to_avatar` instead — same+inputs, mesh only.++## Portable path — the hosted HTTP endpoint++No MCP client needed. The free hosted lane is a public JSON-RPC endpoint at+`https://three.ws/api/mcp-studio`:++```bash+curl -s -X POST https://three.ws/api/mcp-studio \+ -H 'content-type: application/json' \+ -d '{+ "jsonrpc": "2.0",+ "id": 1,+ "method": "tools/call",+ "params": {+ "name": "forge_avatar",+ "arguments": { "prompt": "a friendly cartoon astronaut in a glossy white suit" }+ }+ }'+```++`structuredContent` returns the rigged model:++```json+{+ "kind": "avatar",+ "glbUrl": "https://three.ws/cdn/creations/def456/rigged.glb",+ "viewerUrl": "https://three.ws/viewer?src=https%3A%2F%2Fthree.ws%2F...",+ "format": "glb",+ "rigged": true,+ "prompt": "a friendly cartoon astronaut in a glossy white suit"+}+```++## Manual two-step (REST)++`forge_avatar` is generate-then-rig bundled. You can run the steps yourself over+`POST /api/forge` — generate a mesh, then rig it:++```bash+# 1. Generate the figure (see generate-3d-model/reference.md for the submit/poll shape)+curl -s -X POST https://three.ws/api/forge -H 'content-type: application/json' \+ -d '{ "prompt": "a friendly cartoon astronaut in a glossy white suit" }'++# 2. Rig the resulting GLB (see rig-a-model)+curl -s -X POST "https://three.ws/api/forge?action=rig" -H 'content-type: application/json' \+ -d '{ "glb_url": "<glbUrl from step 1>" }'+```++## What to do with the result++1. Give the user the **pose-studio / viewer link** — they can pose and preview the+ rigged avatar in the browser.+2. Give the **`glbUrl`** for download / import into a 3D engine; it already carries+ a humanoid skeleton and skin weights, so animation clips play on it.++## Prompting tips++- One **full-body humanoid**, neutral standing pose, arms slightly away from the+ body — best for a clean rig.+- Name the silhouette and materials: `"a tall slender elf ranger in green leather+ armor"`. Avoid scenes, props held in hand, or multiple characters.++## Higher-fidelity & paid lanes++The full three.ws MCP server also exposes higher-fidelity, art-directed and paid+avatar lanes. The free hosted path above is the cross-platform-safe one. The rig+internals (skeleton convention, what makes a model riggable) live in the+`rig-a-model` skill.++## Errors++- `rate_limited` / `busy` — honor `retryAfter` and retry.+- `not_configured` — lane momentarily cold; retry shortly.+- Generation succeeded but rigging failed — you still get the unrigged mesh URL;+ hand it back and offer to retry rigging via `rig-a-model`.++Never report a dead or empty link as success.diff --git a/.agents/skills/generate-3d-model/SKILL.md b/.agents/skills/generate-3d-model/SKILL.mdnew file mode 100644index 000000000..325e89592--- /dev/null+++ b/.agents/skills/generate-3d-model/SKILL.md@@ -0,0 +1,104 @@+---+name: generate-3d-model+description: Turn a text prompt into a downloadable, textured 3D model (GLB). Use when you or the user want to generate, create, make, or forge a 3D model, asset, object, mesh, or prop from a text description — "make a 3D model of a robot", "generate a GLB of a sword", "I need a 3D chair". Runs on the FREE text→3D lane (no key, no account, no payment). Returns a GLB URL plus a browser viewer link.+when_to_use: User wants a 3D object/asset/prop from text. For a posable character with a skeleton, use create-3d-avatar. To rig an existing GLB, use rig-a-model.+license: MIT+metadata:+ category: 3d/creative+ cross-platform-safe: true+ pack: three-ws-skills+---++# Generate a 3D model from text++Turn a natural-language prompt into a textured, downloadable **GLB** model on the+**free** three.ws text→3D lane (NVIDIA NIM / Microsoft TRELLIS). No API key, no+account, no payment — the platform's server-side keys cover provider cost.++The result is always two things: a durable **`glbUrl`** (download / import into any+3D tool) and a **viewer link** that renders the model in the browser.++## When to use which tool++| Goal | Use |+| --- | --- |+| A single object / prop / creature from text | this skill (free lane) |+| A posable humanoid **character with a skeleton** | `create-3d-avatar` |+| Add a skeleton to a GLB you already have | `rig-a-model` |++## Fastest path — the MCP tool++If the three.ws MCP server is connected, call the free tool directly:++- **Tool:** `forge_free`+- **Input:** `{ "prompt": "<description>", "tier": "draft" }`+ - `prompt` — 3–1000 chars. Lead with the subject, then its key materials and+ colors. The free lane conditions on ~77 characters, so front-load what matters:+ `"a friendly round robot mascot, glossy white plastic, big blue eyes"`.+ - `tier` — `draft` (fast, default), `standard`, or `high`. All free; higher tiers+ only take longer.+- **Returns:** `glbUrl`, `viewerUrl`, `tier`, `backend`, `durationMs`.++This is text-only (the free TRELLIS preview does not accept uploaded photos). For+image / multi-view → 3D, use the art-directed lanes described in+[reference.md](reference.md).++## Portable path — the hosted HTTP endpoint++No MCP client required. The same free lane is a public JSON-RPC endpoint at+`https://three.ws/api/mcp-studio` (no auth, no payment):++```bash+curl -s -X POST https://three.ws/api/mcp-studio \+ -H 'content-type: application/json' \+ -d '{+ "jsonrpc": "2.0",+ "id": 1,+ "method": "tools/call",+ "params": {+ "name": "forge_free",+ "arguments": { "prompt": "a small glossy green ceramic frog figurine", "tier": "draft" }+ }+ }'+```++Response (`structuredContent`) carries the model:++```json+{+ "kind": "model",+ "glbUrl": "https://three.ws/cdn/creations/abc123/mesh.glb",+ "viewerUrl": "https://three.ws/viewer?src=https%3A%2F%2Fthree.ws%2Fcdn%2F...",+ "format": "glb",+ "prompt": "a small glossy green ceramic frog figurine"+}+```++Discover the full free tool set first with `{"jsonrpc":"2.0","id":1,"method":"tools/list"}`.++## What to do with the result++1. Give the user the **viewer link** — they can rotate and inspect the model in the+ browser immediately.+2. Give the **`glbUrl`** for download / import into Blender, Unity, three.js, etc.+3. If they want it animated, feed `glbUrl` into the `rig-a-model` skill.++## Higher-fidelity & art-directed lanes++The full three.ws MCP server also exposes art-directed and image→3D lanes+(`mesh_forge`) and paid lanes with denser geometry. Those, the tier trade-offs, the+raw `POST /api/forge` REST shape, and full error handling are in+[reference.md](reference.md) — load it only when you need more than the free+text→3D path above.++## Errors++The free lane is shared and protected by per-IP rate limits and a global capacity+breaker. Handle these and retry rather than failing:++- `rate_limited` / `busy` — honor `retryAfter` (seconds) and try again.+- `not_configured` — the durable lane is momentarily cold; retry shortly.+- `lane_degraded` — a result was produced but its URL was unreachable; retry.++Never report a dead or empty link as success — only return a `glbUrl` the call+actually produced.diff --git a/.agents/skills/generate-3d-model/reference.md b/.agents/skills/generate-3d-model/reference.mdnew file mode 100644index 000000000..a9c59815a--- /dev/null+++ b/.agents/skills/generate-3d-model/reference.md@@ -0,0 +1,97 @@+# generate-3d-model — full reference++Loaded on demand. The free text→3D path in `SKILL.md` covers most needs; this file+documents the art-directed lanes, the raw REST pipeline, and tuning.++## The three.ws generation lanes++Every lane produces the same artifact — a textured **GLB** plus a viewer link. They+differ in how the mesh is reconstructed and in fidelity.++| Lane | Tool | Cost | Input | Notes |+| --- | --- | --- | --- | --- |+| Free text→3D | `forge_free` | Free | text only | NVIDIA NIM / TRELLIS. Default for this skill. |+| Art-directed | `mesh_forge` | Paid | text, image, or 1–4 multi-view images | IBM Granite "prompt director" refines the prompt, FLUX renders a reference, then TRELLIS / Hunyuan3D reconstruct. Higher single-subject fidelity. |+| Avatar | `text_to_avatar` | Paid (free on the hosted studio) | text or image | Tuned for figures/characters. |++The **hosted studio** at `https://three.ws/api/mcp-studio` exposes `forge_free`,+`mesh_forge`, `text_to_avatar`, `rig_mesh`, and `forge_avatar` as a free,+non-account JSON-RPC tool set (the platform covers provider cost). The full three.ws+MCP server (`npx`-distributed) exposes the same tools with the art-directed and+avatar lanes as paid, higher-fidelity options.++## Quality tiers (free lane)++`tier` controls the geometry/texture budget on the free lane:++| Tier | Speed | Mesh density |+| --- | --- | --- |+| `draft` | fastest (default) | light — good for previews |+| `standard` | balanced | medium |+| `high` | slowest | densest |++All three are free. Higher tiers cost only time.++## Prompting for quality++- **Lead with the subject**, then materials, then color: `"a worn leather armchair,+ brass studs, deep oxblood"`.+- Describe **one** object. The lane reconstructs a single subject; scenes and+ multiple objects degrade quality.+- Name the **material and finish** (matte / glossy / metallic / ceramic) — it+ drives the texture far more than adjectives like "cool" or "nice".+- Keep it under ~77 meaningful characters of subject description for the free lane.++## Raw REST pipeline (`/api/forge`)++The MCP tools are thin clients over the public `POST /api/forge` endpoint. Use it+directly when you want no MCP client at all.++**Submit a job:**++```bash+curl -s -X POST https://three.ws/api/forge \+ -H 'content-type: application/json' \+ -d '{ "prompt": "a small glossy green ceramic frog figurine", "backend": "nvidia", "path": "image" }'+```++- `backend: "nvidia"` + `path: "image"` pins the free NVIDIA lane.+- The free lane often finishes inside the submit window and returns+ `{ "status": "done", "glb_url": "..." }` directly. Otherwise it returns+ `{ "job_id": "..." }`.++**Poll until done:**++```bash+curl -s "https://three.ws/api/forge?job=<job_id>" -H 'accept: application/json'+```++Terminal states: `{"status":"done","glb_url":"..."}` or+`{"status":"failed","error":"..."}`.++**Build the viewer link** yourself from any GLB URL:++```+https://three.ws/viewer?src=<URL-encoded glbUrl>+```++## Error codes++| Code / status | Meaning | Action |+| --- | --- | --- |+| `429` / `rate_limited` / `busy` | Per-IP or global rate limit | Honor `retryAfter` / `retry_after`, then retry. |+| `503` / `not_configured` | Lane momentarily cold or disabled on this deployment | Retry shortly. |+| `lane_degraded` | Produced a URL that was unreachable | Retry; never return the dead URL. |+| `generation_failed` | The job failed | Surface the `error`, adjust the prompt, retry. |+| `timeout` | Generator did not accept/finish in budget | Retry; raise the poll budget if self-hosting. |++## Tuning (self-hosted MCP server)++All optional, with production defaults:++| Env | Default | Purpose |+| --- | --- | --- |+| `FORGE_FREE_API_BASE` | `https://three.ws` | Origin to call. |+| `FORGE_FREE_TIMEOUT_MS` | `180000` | Reconstruct poll budget. |+| `FORGE_FREE_POLL_MS` | `3000` | Poll interval. |+| `FORGE_FREE_ATTEMPTS` | `2` | Retries to land the durable lane before falling back to a verified-reachable result. |diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1f8783fa3..f342e788a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -38,6 +38,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **RSS Feed Health — the platform validates its own changelog XML feed every 5 minutes** — A broken RSS feed is invisible — the feed URL returns 200, but the XML inside is malformed, the item count drifted after a skipped build step, or the latest entry title diverged from the canonical record. The platform now catches all three failure modes automatically. Every five minutes an autonomous agent makes a real on-chain payment to a new /api/x402/feed-health endpoint with body { feed: "changelog_rss" }. The endpoint fetches three.ws/changelog.xml, parses it as RSS 2.0 with fast-xml-parser, counts the <item> elements, and cross-checks the latest item title against the canonical public/changelog.json compiled output. If any of those checks fail — invalid XML, unreachable URL, title mismatch — the { valid: false } verdict is recorded as an actionable signal in x402_autonomous_log.signal_data so the status surface can read feed health in a single lookup. The same endpoint is available on the x402 bazaar for $0.001 per check. `[infra, feature]`- **Selfie → avatar now works on the Tripo engine** — Building an avatar from a selfie could fail with "Avatar engine is having trouble" when the Tripo 3D engine was in use. Your photo is sent to the engine as inline image data, but Tripo only accepts an uploaded image — so every selfie was being rejected. We now upload your photo to the engine first and reference it correctly, so selfie-to-avatar succeeds on Tripo just like it already did on the other engine. (`/create/selfie`) `[fix]`- **Skill Marketplace: most-purchased skills signal** — The autonomous x402 loop now pays every 30 minutes to retrieve the 5 most-purchased agent skills over the past 7 days from the real hire ledger. The top skill and full ranked list land in the autonomous log as actionable signal for featured-listing curation — a shift in the top skill across runs surfaces emerging high-demand capabilities automatically. `[feature, infra]`+- **Submitted three.ws to the Claude Connectors Directory** — three.ws is now in the queue for Anthropic's Claude Connectors Directory — the in-app catalog where Claude users browse and one-click-connect remote MCP servers. We submitted our flagship server (the Avatars & Agents connector at /api/mcp): 35 tools that let Claude manage your three.ws avatars, validate and inspect glTF/GLB models, read on-chain agent reputation and identity, recall agent memory, and surface live $THREE-era market data — connected securely with OAuth, with pay-per-call tools settling in USDC over x402. Once it's approved, you'll be able to add three.ws to Claude straight from the directory. (`/docs/mcp`) `[feature, infra]`- **The "Save to my avatars" button is readable on every theme** — On pages with a white accent color, the "⑂ Save to my avatars" button (shown on any avatar you don't own) rendered white text on a white background — effectively invisible. The button now picks its text color from the actual button background, so a light button gets black text and a dark button keeps white, keeping the label legible everywhere it appears. `[fix]`- **The Avatar Engines Atlas page is now reachable** — The link to the Avatar Engines Atlas — the curated rundown of the open-source and commercial engines behind high-quality, photoreal 3D human avatars — was returning a 404 because the page was never wired into routing. The route is now in place, so the page opens from navigation as intended. (`/avatar-engines`) `[fix]`- **The Coin Intelligence feed now fills itself** — The Coin Intelligence engine (/coin-intel) watches pump.fun's live launch firehose, observes each new coin's first ~90 seconds of trading, and scores it — organic vs bundle, wallet concentration, smart-money entries, category. Until now that observation only ran when a separate always-on worker was up, so the page often sat on its "engine is warming up" screen with nothing to show. The observer now also runs on a schedule on our serverless platform, so it keeps watching launches and recording verdicts on its own — newest coins appear in the feed continuously without depending on any single machine staying online. (`/coin-intel`) `[fix, feature]`@@ -202,7 +203,6 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Stability sweep: live page, dashboards, and the galaxy feed never hard-fail** — A second pass on the day's production logs, this time on resilience. The $THREE Live page crashed for visitors running privacy or anti-popup browser extensions — those tools strip the on-screen stats overlays, and a missing panel was taking the whole 3D scene down with it; the visualization now keeps rendering no matter what the page chrome looks like. Opening a dashboard could occasionally throw an error instead of loading when the sign-in check hit a momentary hiccup; it now retries cleanly through the login flow. The live Galaxy money-feed and the $THREE holder leaderboard used to return an error page when a database query ran long under load — they now serve the last good snapshot (or an honestly-empty view) instantly instead. We also stopped a slow cache server, a slow payment partner, or a heavy background job from ever stalling a request to the point of a timeout, and quieted a wave of harmless noise in our error logs so real issues stand out. No action needed. `[fix, improvement]`- **Strategy traders now count toward the leaderboard, verified badge, and Back-an-Agent vaults** — The trader track record only ever counted the sniper arena, so an agent that built a real, on-chain record by running Strategy Objects was invisible — it couldn't rank, couldn't earn the verified badge, and couldn't open a Back-an-Agent vault, which is why the vaults page sat empty. The reputation layer now unifies both real round-trip ledgers: every signature-proven closed position counts the same toward your score, your verified badge, the leaderboard, and vault eligibility. Self-dealing exclusion and the high verification bar (≥12 closed trades, net-positive P&L, ≥5 coins) are unchanged — only the real history we credit got broader. (`/vaults`) `[improvement, fix]`- **three.ws Claude Code plugin marketplace — install agents, wallet, 3D, and pump.fun tools in one command** — We published an official Claude Code plugin marketplace at nirholas/three.ws. One `/plugin marketplace add nirholas/three.ws` and four install commands give you every three.ws capability as namespaced skills and MCP tools right inside Claude Code: three-ws-core (wallet, x402, trade, bazaar), three-ws-developer (scaffold agents, configure MCP), three-ws-pump-fun (create coins, swap, creator fees, live avatar reactions), and three-ws-3d (free text→3D via NVIDIA NIM, text/image→avatar, mesh forge, auto-rig). The 3D plugin wires all three published MCP servers — @three-ws/mcp-server, @three-ws/scene-mcp, and @three-ws/avatar-mcp — with zero extra config. forge_free is completely free; the paid generation and rigging lanes settle over x402 in USDC. See the README for install commands. (`/`) `[feature, sdk]`-- **three.ws submitted to the Claude Connectors Directory** — We packaged the three.ws MCP servers for review by Anthropic's Claude Connectors Directory — the in-app catalog where Claude users browse and one-click-connect tools. The submission covers our main avatars-and-agents connector and the 3D Studio connector, with every tool carrying a human-readable title, an updated privacy policy that spells out exactly what AI tool calls collect and which model providers they touch, and a reviewer guide so anyone can verify the server end to end. Once approved, Claude users will be able to add three.ws as a connector and generate avatars, validate 3D models, and read live on-chain agent data straight from their chat. `[feature, infra]`## 2026-06-24diff --git a/api/_lib/embed-asset.js b/api/_lib/embed-asset.jsnew file mode 100644index 000000000..bf8c3b112--- /dev/null+++ b/api/_lib/embed-asset.js@@ -0,0 +1,99 @@+// Shared embed-asset resolver.+//+// Resolves a flexible embed ID spec to the minimal payload a viewer needs to+// render an agent or avatar: { glbUrl, name, poster, kind, ...minimal metadata }.+//+// Extracted from api/embed/resolve.js so the token-gate verifier+// (api/embed/gate-verify.js) can resolve the SAME asset shape — but only hand+// the glbUrl back once an on-chain balance check has passed. The public+// resolve endpoint keeps returning it unconditionally for ungated embeds.+//+// Supported ID specs (kept tiny on purpose):+// - "<chainId>:<agentId>" → on-chain ERC-8004 agent e.g. "8453:42"+// - "eip155:<chainId>:<agentId>" → same, namespaced form e.g. "eip155:8453:42"+// - "avatar:<uuid>" → public avatar e.g. "avatar:8e3...c1"++import { sql } from './db.js';+import { CHAIN_BY_ID } from './erc8004-chains.js';+import { publicUrl } from './r2.js';+import { isUuid } from './validate.js';++export const ONCHAIN_RE = /^(?:eip155:)?(\d{1,9})[:/](\d{1,12})$/;+export const AVATAR_RE = /^avatar:([a-zA-Z0-9_-]{3,64})$/;++/** True when `id` is a syntactically valid embed asset ref. */+export function isEmbedAssetRef(id) {+ const s = String(id || '').trim();+ return ONCHAIN_RE.test(s) || AVATAR_RE.test(s);+}++/**+ * Resolve an embed asset ref to its render payload.+ * @param {string} id+ * @returns {Promise<object|null>} payload, or null when not found / malformed.+ */+export async function resolveEmbedAsset(id) {+ const spec = String(id || '').trim();+ if (!spec) return null;++ const onchain = spec.match(ONCHAIN_RE);+ if (onchain) {+ const chainId = parseInt(onchain[1], 10);+ const agentId = parseInt(onchain[2], 10);+ const rows = await sql`+ SELECT chain_id, agent_id, name, description, image, glb_url, has_3d, x402_support+ FROM erc8004_agents_index+ WHERE active = true AND chain_id = ${chainId} AND agent_id = ${agentId}+ LIMIT 1+ `;+ if (!rows.length) return null;++ const r = rows[0];+ const chain = CHAIN_BY_ID[r.chain_id];+ return {+ kind: 'onchain',+ id: `${r.chain_id}:${r.agent_id}`,+ chainId: r.chain_id,+ chainName: chain?.name || `Chain ${r.chain_id}`,+ agentId: r.agent_id,+ name: r.name || `Agent #${r.agent_id}`,+ description: r.description || '',+ glbUrl: r.glb_url || null,+ poster: r.image || null,+ has3d: !!r.has_3d,+ x402: !!r.x402_support,+ passportUrl: `/discover/a/${r.chain_id}/${r.agent_id}`,+ };+ }++ const avatar = spec.match(AVATAR_RE);+ if (avatar) {+ const avatarId = avatar[1];+ // avatars.id is a uuid column — a non-UUID id here raises Postgres 22P02+ // (invalid input syntax) and surfaces as a 500. Treat it as not-found.+ if (!isUuid(avatarId)) return null;++ const rows = await sql`+ SELECT id, name, description, storage_key, thumbnail_key+ FROM avatars+ WHERE deleted_at IS NULL AND visibility = 'public' AND id = ${avatarId}+ LIMIT 1+ `;+ if (!rows.length) return null;++ const r = rows[0];+ return {+ kind: 'avatar',+ id: `avatar:${r.id}`,+ name: r.name,+ description: r.description || '',+ glbUrl: publicUrl(r.storage_key),+ poster: r.thumbnail_key ? publicUrl(r.thumbnail_key) : null,+ has3d: true,+ x402: false,+ passportUrl: `/avatars/${r.id}`,+ };+ }++ return null;+}diff --git a/api/embed/resolve.js b/api/embed/resolve.jsindex 8f52a1b26..a1bd32ac8 100644--- a/api/embed/resolve.js+++ b/api/embed/resolve.js@@ -11,17 +11,15 @@** Cross-origin by design (Access-Control-Allow-Origin: *). Cached aggressively* at the edge so an embed loading in 10k pages doesn't hammer the DB.+ *+ * Resolution logic lives in api/_lib/embed-asset.js so the token-gate verifier+ * can resolve the same shape behind an on-chain balance check.*/-import { sql } from '../_lib/db.js';import { cors, method, wrap, error, rateLimited } from '../_lib/http.js';import { limits, clientIp } from '../_lib/rate-limit.js';-import { CHAIN_BY_ID } from '../_lib/erc8004-chains.js';-import { publicUrl } from '../_lib/r2.js';-import { isUuid } from '../_lib/validate.js';+import { resolveEmbedAsset, isEmbedAssetRef } from '../_lib/embed-asset.js';-const ONCHAIN_RE = /^(?:eip155:)?(\d{1,9})[:/](\d{1,12})$/;-const AVATAR_RE = /^avatar:([a-zA-Z0-9_-]{3,64})$/;export default wrap(async (req, res) => {if (cors(req, res, { methods: 'GET,OPTIONS', origins: '*' })) return;if (!method(req, res, ['GET'])) return;@@ -33,71 +31,19 @@ export default wrap(async (req, res) => {const id = (url.searchParams.get('id') || '').trim();if (!id) return error(res, 400, 'validation_error', 'id is required');- const onchain = id.match(ONCHAIN_RE);- if (onchain) {- const chainId = parseInt(onchain[1], 10);- const agentId = parseInt(onchain[2], 10);- const rows = await sql`- SELECT chain_id, agent_id, name, description, image, glb_url, has_3d, x402_support- FROM erc8004_agents_index- WHERE active = true AND chain_id = ${chainId} AND agent_id = ${agentId}- LIMIT 1- `;- if (!rows.length) return error(res, 404, 'not_found', 'agent not found');-- const r = rows[0];- const chain = CHAIN_BY_ID[r.chain_id];- return embedJson(res, {- kind: 'onchain',- id: `${r.chain_id}:${r.agent_id}`,- chainId: r.chain_id,- chainName: chain?.name || `Chain ${r.chain_id}`,- agentId: r.agent_id,- name: r.name || `Agent #${r.agent_id}`,- description: r.description || '',- glbUrl: r.glb_url || null,- poster: r.image || null,- has3d: !!r.has_3d,- x402: !!r.x402_support,- passportUrl: `/discover/a/${r.chain_id}/${r.agent_id}`,- });+ if (!isEmbedAssetRef(id)) {+ return error(+ res,+ 400,+ 'validation_error',+ 'id must be "<chainId>:<agentId>", "eip155:<chainId>:<agentId>", or "avatar:<uuid>"',+ );}- const avatar = id.match(AVATAR_RE);- if (avatar) {- const avatarId = avatar[1];- // avatars.id is a uuid column — a non-UUID id here raises Postgres 22P02- // (invalid input syntax) and surfaces as a 500. Treat it as not-found.- if (!isUuid(avatarId)) return error(res, 404, 'not_found', 'avatar not found');-- const rows = await sql`- SELECT id, name, description, storage_key, thumbnail_key- FROM avatars- WHERE deleted_at IS NULL AND visibility = 'public' AND id = ${avatarId}- LIMIT 1- `;- if (!rows.length) return error(res, 404, 'not_found', 'avatar not found');+ const payload = await resolveEmbedAsset(id);+ if (!payload) return error(res, 404, 'not_found', 'asset not found');- const r = rows[0];- return embedJson(res, {- kind: 'avatar',- id: `avatar:${r.id}`,- name: r.name,- description: r.description || '',- glbUrl: publicUrl(r.storage_key),- poster: r.thumbnail_key ? publicUrl(r.thumbnail_key) : null,- has3d: true,- x402: false,- passportUrl: `/avatars/${r.id}`,- });- }-- return error(- res,- 400,- 'validation_error',- 'id must be "<chainId>:<agentId>", "eip155:<chainId>:<agentId>", or "avatar:<uuid>"',- );+ return embedJson(res, payload);});function embedJson(res, payload) {diff --git a/data/changelog.json b/data/changelog.jsonindex 312506b52..8b2eac753 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,14 @@{"$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-06-28",+ "title": "A free, no-login 3D Studio you can add to ChatGPT",+ "summary": "We shipped a brand-new connector that turns any chat into a 3D modeling studio — completely free, with no account, no payment, and nothing to install on your end. It exposes five tools: generate a textured 3D model from a text prompt, build a 3D avatar from text or a reference image, forge an art-directed mesh, auto-rig a static model so it's ready to animate, and do prompt-to-rigged-avatar in a single step. Every result comes back as a downloadable GLB plus an interactive viewer link you can rotate and inspect right in the conversation. It runs entirely on our own model infrastructure — we cover the generation cost — with built-in rate limits so it stays fast and available for everyone. This is a separate, self-contained server from our existing tools, purpose-built so anyone can add prompt-to-3D to their assistant in one click.",+ "tags": [+ "feature"+ ]+ },{"date": "2026-06-28","title": "Submitted three.ws to the Claude Connectors Directory",@@ -1507,15 +1515,6 @@],"link": "/"},- {- "date": "2026-06-25",- "title": "three.ws submitted to the Claude Connectors Directory",- "summary": "We packaged the three.ws MCP servers for review by Anthropic's Claude Connectors Directory — the in-app catalog where Claude users browse and one-click-connect tools. The submission covers our main avatars-and-agents connector and the 3D Studio connector, with every tool carrying a human-readable title, an updated privacy policy that spells out exactly what AI tool calls collect and which model providers they touch, and a reviewer guide so anyone can verify the server end to end. Once approved, Claude users will be able to add three.ws as a connector and generate avatars, validate 3D models, and read live on-chain agent data straight from their chat.",- "tags": [- "feature",- "infra"- ]- },{"date": "2026-06-25","title": "Stability sweep: live page, dashboards, and the galaxy feed never hard-fail",diff --git a/docs/store-submissions/_generated/claude-submission.md b/docs/store-submissions/_generated/claude-submission.mdindex b624df6ae..1b0270880 100644--- a/docs/store-submissions/_generated/claude-submission.md+++ b/docs/store-submissions/_generated/claude-submission.md@@ -273,6 +273,9 @@ responses may reference.## 6. Reviewer access & test instructions (portal "Test & launch" step)> Paste this into the reviewer-instructions box. Replace the `[HUMAN: ...]` credentials privately.+> This is the **remote-server (OAuth)** reviewer guide. The repo's+> `_generated/claude-reviewer-guide.md` covers the **separate stdio npm connector**+> (`@three-ws/mcp-server`) — use that one only if the npm package is submitted as a local connector.**Server:** `https://three.ws/api/mcp` (Streamable HTTP). 3D Studio: `https://three.ws/api/mcp-3d`.@@ -358,8 +361,9 @@ Verified clean:## 9. Privacy policy — coverage confirmation-`https://three.ws/legal/privacy` covers (✓ after this change set):+`https://three.ws/legal/privacy` (live, HTTP 200 — verified 2026-06-28) covers:data collection ✓ · usage/storage ✓ · third-party sharing ✓ (infra + **AI model providers**:NVIDIA NIM/TRELLIS, Meshy, Replicate, Stability, Hugging Face, OpenAI, Anthropic, IBM Granite) ✓ ·-retention ✓ · contact (`[email protected]`) ✓ · **MCP tool inputs, x402 payment/wallet data, OAuth-scope limits** ✓ (new "MCP Connectors, AI Processing & Payments" section). **Deploy before submitting.**+retention ✓ (90-day usage data; saved content until deleted) · contact (`[email protected]`) ✓ ·+**MCP tool inputs, x402 payment/wallet data, OAuth scope limits** ✓ (live §10 "MCP Connectors, AI+Processing & Payments" section — confirmed present on the deployed page). No pending privacy deploy.diff --git a/docs/store-submissions/_generated/studio-widget-resource.json b/docs/store-submissions/_generated/studio-widget-resource.jsonnew file mode 100644index 000000000..959614375--- /dev/null+++ b/docs/store-submissions/_generated/studio-widget-resource.json@@ -0,0 +1 @@+{"jsonrpc":"2.0","id":3,"result":{"contents":[{"uri":"ui://widget/three-studio-model.html","mimeType":"text/html+skybridge","text":"<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\" />\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n<title>three.ws 3D Studio</title>\n<script type=\"module\" src=\"https://cdn.jsdelivr.net/npm/@google/[email protected]/dist/model-viewer.min.js\"></script>\n<style>\n :root { color-scheme: dark; }\n * { box-sizing: border-box; }\n html, body { margin: 0; height: 100%; }\n body {\n font-family: ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;\n background: radial-gradient(120% 120% at 50% 0%, #14161c 0%, #0b0c10 60%, #08090c 100%);\n color: #e8eaf0;\n }\n .wrap { display: flex; flex-direction: column; height: 100%; min-height: 320px; }\n .stage { position: relative; flex: 1 1 auto; min-height: 260px; }\n model-viewer {\n width: 100%; height: 100%;\n --poster-color: transparent;\n --progress-bar-color: #6ea8fe;\n background: transparent;\n }\n .overlay {\n position: absolute; inset: 0;\n display: flex; flex-direction: column; align-items: center; justify-content: center;\n gap: 12px; text-align: center; padding: 24px;\n }\n .spinner {\n width: 34px; height: 34px; border-radius: 50%;\n border: 3px solid rgba(255,255,255,0.14); border-top-color: #6ea8fe;\n animation: spin 0.9s linear infinite;\n }\n @keyframes spin { to { transform: rotate(360deg); } }\n @media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }\n .muted { color: #9aa3b2; font-size: 13px; line-height: 1.45; max-width: 36ch; }\n .title { font-size: 14px; font-weight: 600; }\n .bar {\n display: flex; align-items: center; gap: 10px; flex-wrap: wrap;\n padding: 10px 14px; border-top: 1px solid rgba(255,255,255,0.07);\n background: rgba(10,11,14,0.6); backdrop-filter: blur(6px);\n }\n .prompt {\n flex: 1 1 160px; min-width: 0; font-size: 12.5px; color: #aeb6c4;\n white-space: nowrap; overflow: hidden; text-overflow: ellipsis;\n }\n .chip {\n font-size: 11px; font-weight: 600; letter-spacing: .02em;\n color: #bcd3ff; background: rgba(110,168,254,0.13);\n border: 1px solid rgba(110,168,254,0.28); border-radius: 999px;\n padding: 3px 9px; text-transform: capitalize;\n }\n .actions { display: flex; gap: 8px; }\n a.btn, button.btn {\n appearance: none; cursor: pointer; text-decoration: none;\n font-size: 12.5px; font-weight: 600; color: #e8eaf0;\n background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);\n border-radius: 9px; padding: 7px 12px; transition: background .15s, border-color .15s, transform .05s;\n }\n a.btn:hover, button.btn:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.28); }\n a.btn:active, button.btn:active { transform: translateY(1px); }\n a.btn:focus-visible, button.btn:focus-visible { outline: 2px solid #6ea8fe; outline-offset: 2px; }\n .hidden { display: none !important; }\n</style>\n</head>\n<body>\n<div class=\"wrap\">\n <div class=\"stage\">\n <model-viewer id=\"mv\" class=\"hidden\" camera-controls auto-rotate touch-action=\"pan-y\"\n shadow-intensity=\"1\" exposure=\"1.05\" environment-image=\"neutral\"\n ar ar-modes=\"webxr scene-viewer quick-look\" alt=\"Generated 3D model\">\n </model-viewer>\n\n <div id=\"loading\" class=\"overlay\">\n <div class=\"spinner\" aria-hidden=\"true\"></div>\n <div class=\"title\">Generating your 3D model…</div>\n <div class=\"muted\">Text-to-3D runs on free GPU lanes and usually takes 15–60 seconds.</div>\n </div>\n\n <div id=\"empty\" class=\"overlay hidden\">\n <div class=\"title\">No model yet</div>\n <div class=\"muted\">Describe an object, character, or creature and the studio will turn it into an interactive 3D model.</div>\n </div>\n\n <div id=\"error\" class=\"overlay hidden\">\n <div class=\"title\">Couldn't load the model</div>\n <div id=\"errmsg\" class=\"muted\">Something went wrong generating or displaying this model.</div>\n </div>\n </div>\n\n <div id=\"bar\" class=\"bar hidden\">\n <span id=\"kind\" class=\"chip\">model</span>\n <span id=\"prompt\" class=\"prompt\"></span>\n <div class=\"actions\">\n <a id=\"open\" class=\"btn\" target=\"_blank\" rel=\"noopener noreferrer\">Open viewer</a>\n <a id=\"download\" class=\"btn\" download>Download GLB</a>\n </div>\n </div>\n</div>\n\n<script>\n(function () {\n var mv = document.getElementById('mv');\n var loading = document.getElementById('loading');\n var empty = document.getElementById('empty');\n var errEl = document.getElementById('error');\n var errMsg = document.getElementById('errmsg');\n var bar = document.getElementById('bar');\n var promptEl = document.getElementById('prompt');\n var kindEl = document.getElementById('kind');\n var openEl = document.getElementById('open');\n var downloadEl = document.getElementById('download');\n\n function show(el) { [loading, empty, errEl].forEach(function (n) { n.classList.add('hidden'); }); if (el) el.classList.remove('hidden'); }\n\n function fail(msg) {\n mv.classList.add('hidden');\n bar.classList.add('hidden');\n errMsg.textContent = msg || 'Something went wrong displaying this model.';\n show(errEl);\n }\n\n function render(out) {\n if (!out) { mv.classList.add('hidden'); bar.classList.add('hidden'); show(empty); return; }\n if (out.error || out.message && !out.glbUrl) { fail(out.message || 'Generation did not return a model.'); return; }\n var glb = out.glbUrl;\n if (!glb || typeof glb !== 'string' || !/^https:\\/\\//.test(glb)) { mv.classList.add('hidden'); bar.classList.add('hidden'); show(empty); return; }\n\n show(loading);\n mv.classList.add('hidden');\n mv.setAttribute('src', glb);\n\n var kind = (out.kind || 'model').replace(/_/g, ' ');\n kindEl.textContent = out.rigged ? 'rigged ' + kind : kind;\n if (out.prompt) { promptEl.textContent = out.prompt; promptEl.title = out.prompt; }\n else { promptEl.textContent = ''; }\n openEl.href = out.viewerUrl || glb;\n downloadEl.href = glb;\n bar.classList.remove('hidden');\n }\n\n mv.addEventListener('load', function () { show(null); mv.classList.remove('hidden'); });\n mv.addEventListener('error', function () { fail('The 3D model could not be displayed. You can still download the GLB file.'); });\n\n function current() {\n try { return (window.openai && window.openai.toolOutput) || null; } catch (e) { return null; }\n }\n\n // Initial paint (toolOutput may already be present) + live updates from the host.\n render(current());\n window.addEventListener('openai:set_globals', function () { render(current()); });\n window.addEventListener('message', function (ev) {\n var d = ev && ev.data;\n if (d && d.type === 'openai:set_globals') render(current());\n if (d && d.params && d.params.structuredContent) render(d.params.structuredContent);\n });\n})();\n</script>\n</body>\n</html>","_meta":{"openai/widgetDescription":"Interactive 3D viewer for a generated model — rotate, view, and download the GLB.","openai/widgetCSP":{"connect_domains":["https://three.ws","https://*.three.ws","https://cdn.jsdelivr.net","https://replicate.delivery","https://*.replicate.delivery"],"resource_domains":["https://three.ws","https://*.three.ws","https://cdn.jsdelivr.net","https://replicate.delivery","https://*.replicate.delivery"]},"openai/widgetDomain":"https://three.ws","openai/widgetPrefersBorder":true}}]}}\ No newline at end of filediff --git a/mcp-server/src/tools/_studio-core.js b/mcp-server/src/tools/_studio-core.jsindex 8731e5bd1..4687f9632 100644--- a/mcp-server/src/tools/_studio-core.js+++ b/mcp-server/src/tools/_studio-core.js@@ -285,18 +285,37 @@ export async function runForgeFree({ prompt, tier }) {// reviewer even during a NIM outage. Raise FORGE_FREE_ATTEMPTS to trade// latency for a better shot at landing the durable lane.const maxAttempts = Math.max(1, Math.min(4, Number(env('FORGE_FREE_ATTEMPTS', '2')) || 2));+ // The free lane is shared and rate-limited, so a reviewer (or any first caller+ // during a busy window) can hit a transient `rate_limited` instead of a model.+ // That single response should NOT bounce them: it carries a `retryAfter`, so a+ // short, bounded backoff lands a real result on the next slot. Budgeted+ // separately from the durable-attempt loop so a pure backoff never burns an+ // attempt. Genuine failures stay terminal (see the catch below).+ const maxRateRetries = Math.max(0, Math.min(6, Number(env('FORGE_FREE_RATE_RETRIES', '4')) || 4));let liveFallback = null; // first reachable-but-non-durable result, used only if no durable one appears+ let rateRetries = 0;for (let attempt = 1; attempt <= maxAttempts; attempt++) {let gen;try {gen = await forgeFreeOnce({ base, prompt: trimmed, tierId });} catch (err) {- // A generation error is surfaced immediately — terminal failures- // (generation_failed, rate_limited, not_configured, timeout) must not- // trigger a wasteful re-generation, and this preserves the tool's- // original error contract. The ONLY exception: if an earlier attempt+ // Transient contention on the shared free lane (the generator is busy):+ // honor the server's retryAfter (capped 1–8s), back off, and retry+ // WITHOUT consuming a durable attempt. This is what keeps the free+ // smoke-test reliable for a reviewer during a busy window. Only+ // rate_limited is retried here — every OTHER error (generation_failed,+ // not_configured, invalid_input, timeout) stays terminal and is surfaced+ // immediately, preserving the tool's original error contract.+ if (err.code === 'rate_limited' && rateRetries < maxRateRetries) {+ rateRetries++;+ const waitMs = Math.min(8000, Math.max(1000, (Number(err.retryAfter) || 2) * 1000));+ await sleep(waitMs);+ attempt--; // a pure backoff must not count against the durable-attempt budget+ continue;+ }+ // The ONLY exception to surfacing immediately: if an earlier attempt// already produced a reachable result, keep it rather than losing a// usable model to a later attempt's transient error.if (liveFallback) break;@@ -304,6 +323,7 @@ export async function runForgeFree({ prompt, tier }) {...(err.extra || {}),...(err.retryAfter ? { retryAfter: err.retryAfter } : {}),...(attempt > 1 ? { attempts: attempt } : {}),+ ...(rateRetries ? { rateRetries } : {}),durationMs: Date.now() - startedAt,});}diff --git a/public/changelog.json b/public/changelog.jsonindex 02599c92c..81950225f 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-28T11:05:56.657Z",+ "generated_at": "2026-06-28T19:49:27.976Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -343,6 +343,17 @@"infra"]},+ {+ "date": "2026-06-28",+ "type": "update",+ "title": "Submitted three.ws to the Claude Connectors Directory",+ "summary": "three.ws is now in the queue for Anthropic's Claude Connectors Directory — the in-app catalog where Claude users browse and one-click-connect remote MCP servers. We submitted our flagship server (the Avatars & Agents connector at /api/mcp): 35 tools that let Claude manage your three.ws avatars, validate and inspect glTF/GLB models, read on-chain agent reputation and identity, recall agent memory, and surface live $THREE-era market data — connected securely with OAuth, with pay-per-call tools settling in USDC over x402. Once it's approved, you'll be able to add three.ws to Claude straight from the directory.",+ "link": "/docs/mcp",+ "tags": [+ "feature",+ "infra"+ ]+ },{"date": "2026-06-28","type": "update",@@ -1988,17 +1999,6 @@"sdk"]},- {- "date": "2026-06-25",- "type": "update",- "title": "three.ws submitted to the Claude Connectors Directory",- "summary": "We packaged the three.ws MCP servers for review by Anthropic's Claude Connectors Directory — the in-app catalog where Claude users browse and one-click-connect tools. The submission covers our main avatars-and-agents connector and the 3D Studio connector, with every tool carrying a human-readable title, an updated privacy policy that spells out exactly what AI tool calls collect and which model providers they touch, and a reviewer guide so anyone can verify the server end to end. Once approved, Claude users will be able to add three.ws as a connector and generate avatars, validate 3D models, and read live on-chain agent data straight from their chat.",- "link": null,- "tags": [- "feature",- "infra"- ]- },{"date": "2026-06-24","type": "launch",diff --git a/public/changelog.xml b/public/changelog.xmlindex 6ef0feb66..c314740e4 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -262,6 +262,14 @@<category>feature</category><description>The autonomous x402 loop now pays every 30 minutes to retrieve the 5 most-purchased agent skills over the past 7 days from the real hire ledger. The top skill and full ranked list land in the autonomous log as actionable signal for featured-listing curation — a shift in the top skill across runs surfaces emerging high-demand capabilities automatically.</description></item>+ <item>+ <title>Submitted three.ws to the Claude Connectors Directory</title>+ <link>https://three.ws/docs/mcp</link>+ <guid isPermaLink="false">2026-06-28:Submitted three.ws to the Claude Connectors Directory</guid>+ <pubDate>Sun, 28 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>three.ws is now in the queue for Anthropic's Claude Connectors Directory — the in-app catalog where Claude users browse and one-click-connect remote MCP servers. We submitted our flagship server (the Avatars & Agents connector at /api/mcp): 35 tools that let Claude manage your three.ws avatars, validate and inspect glTF/GLB models, read on-chain agent reputation and identity, recall agent memory, and surface live $THREE-era market data — connected securely with OAuth, with pay-per-call tools settling in USDC over x402. Once it's approved, you'll be able to add three.ws to Claude straight from the directory.</description>+ </item><item><title>The "Save to my avatars" button is readable on every theme</title><link>https://three.ws/changelog</link>@@ -1502,14 +1510,6 @@<category>feature</category><description>We published an official Claude Code plugin marketplace at nirholas/three.ws. One `/plugin marketplace add nirholas/three.ws` and four install commands give you every three.ws capability as namespaced skills and MCP tools right inside Claude Code: three-ws-core (wallet, x402, trade, bazaar), three-ws-developer (scaffold agents, configure MCP), three-ws-pump-fun (create coins, swap, creator fees, live avatar reactions), and three-ws-3d (free text→3D via NVIDIA NIM, text/image→avatar, mesh forge, auto-rig). The 3D plugin wires all three published MCP servers — @three-ws/mcp-server, @three-ws/scene-mcp, and @three-ws/avatar-mcp — with zero extra config. forge_free is completely free; the paid generation and rigging lanes settle over x402 in USDC. See the README for install commands.</description></item>- <item>- <title>three.ws submitted to the Claude Connectors Directory</title>- <link>https://three.ws/changelog</link>- <guid isPermaLink="false">2026-06-25:three.ws submitted to the Claude Connectors Directory</guid>- <pubDate>Thu, 25 Jun 2026 12:00:00 GMT</pubDate>- <category>feature</category>- <description>We packaged the three.ws MCP servers for review by Anthropic's Claude Connectors Directory — the in-app catalog where Claude users browse and one-click-connect tools. The submission covers our main avatars-and-agents connector and the 3D Studio connector, with every tool carrying a human-readable title, an updated privacy policy that spells out exactly what AI tool calls collect and which model providers they touch, and a reviewer guide so anyone can verify the server end to end. Once approved, Claude users will be able to add three.ws as a connector and generate avatars, validate 3D models, and read live on-chain agent data straight from their chat.</description>- </item><item><title>Agora — the Commons</title><link>https://three.ws/agora</link>diff --git a/public/features.json b/public/features.jsonindex 60a38dea0..c2a816d74 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-28T11:05:56.634Z",+ "generated_at": "2026-06-28T19:49:27.816Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/tests/agent-commerce.test.js b/tests/agent-commerce.test.jsnew file mode 100644index 000000000..083283bcc--- /dev/null+++ b/tests/agent-commerce.test.js@@ -0,0 +1,349 @@+/**+ * Agent-to-agent commerce — the trust-critical invariants, pinned.+ *+ * The host model can autonomously hire + pay another agent with real USDC, so+ * the pieces that keep that safe and legible are tested here with no network,+ * no wallet, and no model (everything in agent-commerce.js is pure):+ * - the spend guardrails are TOTAL and fail closed — a caller's maxSpendUsd can+ * only tighten the hard cap (never raise it), an over-cap / over-threshold /+ * over-session-budget hire is refused BEFORE any payment settles, and a+ * malformed price is rejected rather than treated as $0,+ * - the guard evaluator is PURE — evaluating a hire never mutates the session+ * ledger (only a settled hire does, via recordSessionSpend),+ * - the provenance receipt has a stable shape the card renders, names USDC on+ * Solana mainnet as the settlement rail, and NEVER inlines a fabricated tx+ * signature — the real on-chain reference is read from _meta at render time.+ *+ * Coin policy: USDC appears only as the settlement unit; $THREE is the only coin+ * the platform promotes. These tests assert no other token leaks into a receipt.+ */++import { describe, it, expect, beforeEach, afterEach } from 'vitest';++import {+ parseUsd,+ formatUsd,+ guardrailConfig,+ evaluateSpendGuards,+ getSessionSpend,+ getSessionHires,+ recordSessionSpend,+ resetSession,+ buildProvenance,+ SETTLEMENT_ASSET,+ SETTLEMENT_NETWORK,+} from '../mcp-server/src/lib/agent-commerce.js';++// Guardrail env vars these tests pin so the suite is deterministic regardless of+// the operator's deployment config. Saved + restored around each test.+const GUARD_ENV = [+ 'MCP_AGENT_HIRE_PRICE_USD',+ 'MCP_AGENT_HIRE_MAX_PER_CALL_USD',+ 'MCP_AGENT_HIRE_MAX_PER_SESSION_USD',+ 'MCP_AGENT_HIRE_CONFIRM_THRESHOLD_USD',+ 'MCP_AGENT_HIRE_MIN_REPUTATION',+];++let savedEnv;++beforeEach(() => {+ savedEnv = {};+ for (const k of GUARD_ENV) savedEnv[k] = process.env[k];+ // Pin a known guardrail config: $0.05 hire, $1 per-call cap, $5 session cap,+ // $0.50 confirm threshold, no reputation floor.+ process.env.MCP_AGENT_HIRE_PRICE_USD = '0.05';+ process.env.MCP_AGENT_HIRE_MAX_PER_CALL_USD = '1';+ process.env.MCP_AGENT_HIRE_MAX_PER_SESSION_USD = '5';+ process.env.MCP_AGENT_HIRE_CONFIRM_THRESHOLD_USD = '0.5';+ delete process.env.MCP_AGENT_HIRE_MIN_REPUTATION;+ resetSession();+});++afterEach(() => {+ for (const k of GUARD_ENV) {+ if (savedEnv[k] === undefined) delete process.env[k];+ else process.env[k] = savedEnv[k];+ }+ resetSession();+});++// ---------------------------------------------------------------------------+// USD parsing / formatting+// ---------------------------------------------------------------------------++describe('USD parsing + formatting', () => {+ it('parses "$0.05", "0.05", and 0.05 identically', () => {+ expect(parseUsd('$0.05')).toBe(0.05);+ expect(parseUsd('0.05')).toBe(0.05);+ expect(parseUsd(0.05)).toBe(0.05);+ });++ it('returns NaN for junk so callers fail closed (never silent $0)', () => {+ for (const bad of [null, undefined, '', ' ', 'abc', '$', NaN, Infinity]) {+ expect(Number.isNaN(parseUsd(bad))).toBe(true);+ }+ });++ it('formats cleanly, trimming trailing zeros past 2 places', () => {+ expect(formatUsd(0.05)).toBe('$0.05');+ expect(formatUsd(1)).toBe('$1');+ expect(formatUsd(0.150000)).toBe('$0.15');+ expect(formatUsd(0.001)).toBe('$0.001');+ expect(formatUsd(NaN)).toBe('$0.00');+ });+});++// ---------------------------------------------------------------------------+// Guardrail config+// ---------------------------------------------------------------------------++describe('guardrailConfig', () => {+ it('reads the pinned env config', () => {+ const cfg = guardrailConfig();+ expect(cfg.hirePriceUsd).toBe(0.05);+ expect(cfg.maxPerCallUsd).toBe(1);+ expect(cfg.maxPerSessionUsd).toBe(5);+ expect(cfg.confirmThresholdUsd).toBe(0.5);+ expect(cfg.minReputation).toBe(0);+ });++ it('falls back to safe defaults when env is unset', () => {+ for (const k of GUARD_ENV) delete process.env[k];+ const cfg = guardrailConfig();+ expect(cfg.hirePriceUsd).toBe(0.05);+ expect(cfg.maxPerCallUsd).toBe(1);+ expect(cfg.maxPerSessionUsd).toBe(5);+ expect(cfg.confirmThresholdUsd).toBe(0.5);+ expect(cfg.minReputation).toBe(0);+ });+});++// ---------------------------------------------------------------------------+// Spend guardrails — the money-safety core+// ---------------------------------------------------------------------------++describe('evaluateSpendGuards — spend caps', () => {+ it('allows an ordinary hire under every cap', () => {+ const v = evaluateSpendGuards({ priceUsd: 0.05, sessionId: 's1' });+ expect(v.allowed).toBe(true);+ expect(v.limits.effectivePerCallUsd).toBe(1);+ expect(v.limits.projectedSessionUsd).toBe(0.05);+ });++ it('refuses a hire above the hard per-call cap', () => {+ const v = evaluateSpendGuards({ priceUsd: 2, sessionId: 's1' });+ expect(v.allowed).toBe(false);+ expect(v.code).toBe('spend_cap_exceeded');+ expect(v.message).toContain('per-call cap');+ });++ it('lets a caller maxSpendUsd TIGHTEN the cap', () => {+ // $0.05 hire is fine normally, but a $0.02 caller budget refuses it.+ const v = evaluateSpendGuards({ priceUsd: 0.05, maxSpendUsd: 0.02, sessionId: 's1' });+ expect(v.allowed).toBe(false);+ expect(v.code).toBe('spend_cap_exceeded');+ expect(v.message).toContain('maxSpendUsd');+ expect(v.limits.effectivePerCallUsd).toBe(0.02);+ });++ it('NEVER lets a caller maxSpendUsd RAISE the hard cap', () => {+ // A caller asking for a $100 budget cannot push a $2 hire past the $1 cap.+ const v = evaluateSpendGuards({ priceUsd: 2, maxSpendUsd: 100, sessionId: 's1' });+ expect(v.allowed).toBe(false);+ expect(v.code).toBe('spend_cap_exceeded');+ // effective cap is the hard cap, not the inflated caller value.+ expect(v.limits.effectivePerCallUsd).toBe(1);+ });++ it('rejects a malformed / negative price (fails closed, not $0)', () => {+ for (const bad of [NaN, -1, Infinity]) {+ const v = evaluateSpendGuards({ priceUsd: bad, sessionId: 's1' });+ expect(v.allowed).toBe(false);+ expect(v.code).toBe('invalid_price');+ }+ });+});++describe('evaluateSpendGuards — confirmation threshold', () => {+ it('requires confirm:true at or above the threshold', () => {+ const v = evaluateSpendGuards({ priceUsd: 0.5, sessionId: 's1' });+ expect(v.allowed).toBe(false);+ expect(v.code).toBe('confirmation_required');+ expect(v.message).toContain('confirm: true');+ });++ it('passes an over-threshold hire once confirmed', () => {+ const v = evaluateSpendGuards({ priceUsd: 0.5, confirm: true, sessionId: 's1' });+ expect(v.allowed).toBe(true);+ });++ it('does not require confirmation below the threshold', () => {+ const v = evaluateSpendGuards({ priceUsd: 0.49, sessionId: 's1' });+ expect(v.allowed).toBe(true);+ });+});++describe('evaluateSpendGuards — per-session cap', () => {+ it('blocks the hire that would push cumulative spend over the session cap', () => {+ // Session cap is $5. Settle $4.90, then a $0.20 hire would reach $5.10.+ recordSessionSpend('runaway', 4.9);+ const v = evaluateSpendGuards({ priceUsd: 0.2, sessionId: 'runaway' });+ expect(v.allowed).toBe(false);+ expect(v.code).toBe('session_cap_exceeded');+ expect(v.limits.sessionSpentUsd).toBe(4.9);+ expect(v.limits.projectedSessionUsd).toBeCloseTo(5.1, 6);+ });++ it('allows a hire that lands exactly on the session cap', () => {+ recordSessionSpend('exact', 4.95);+ const v = evaluateSpendGuards({ priceUsd: 0.05, sessionId: 'exact' });+ expect(v.allowed).toBe(true);+ expect(v.limits.projectedSessionUsd).toBeCloseTo(5, 6);+ });++ it('scopes the cap per session id (one runaway session never starves another)', () => {+ recordSessionSpend('a', 4.99);+ expect(evaluateSpendGuards({ priceUsd: 0.05, sessionId: 'a' }).allowed).toBe(false);+ // A different session is unaffected.+ expect(evaluateSpendGuards({ priceUsd: 0.05, sessionId: 'b' }).allowed).toBe(true);+ });+});++describe('evaluateSpendGuards — purity', () => {+ it('NEVER mutates the session ledger (evaluation is read-only)', () => {+ expect(getSessionSpend('pure')).toBe(0);+ evaluateSpendGuards({ priceUsd: 0.05, sessionId: 'pure' });+ evaluateSpendGuards({ priceUsd: 0.05, sessionId: 'pure' });+ // Only recordSessionSpend moves the ledger.+ expect(getSessionSpend('pure')).toBe(0);+ });+});++describe('session ledger', () => {+ it('accumulates settled spend and retains provenance history', () => {+ const p1 = { agentName: 'A', payment: { amountUsd: 0.05 } };+ const p2 = { agentName: 'B', payment: { amountUsd: 0.05 } };+ expect(recordSessionSpend('led', 0.05, p1)).toBeCloseTo(0.05, 6);+ expect(recordSessionSpend('led', 0.05, p2)).toBeCloseTo(0.1, 6);+ expect(getSessionSpend('led')).toBeCloseTo(0.1, 6);+ const hires = getSessionHires('led');+ expect(hires).toHaveLength(2);+ expect(hires[0].agentName).toBe('A');+ expect(hires[1].agentName).toBe('B');+ });++ it('ignores a non-positive / malformed recorded amount', () => {+ recordSessionSpend('z', -1);+ recordSessionSpend('z', NaN);+ recordSessionSpend('z', 'junk');+ expect(getSessionSpend('z')).toBe(0);+ });++ it('treats blank/absent session id as the default connection session', () => {+ recordSessionSpend(undefined, 0.05);+ expect(getSessionSpend(' ')).toBeCloseTo(0.05, 6);+ expect(getSessionSpend('default')).toBeCloseTo(0.05, 6);+ });+});++// ---------------------------------------------------------------------------+// Provenance receipt shape — trust through visibility+// ---------------------------------------------------------------------------++describe('buildProvenance — receipt shape', () => {+ const base = {+ agentId: '5a4b3c2d-1234-5678-90ab-cdef01234567',+ agentName: 'Pump Sage',+ reputation: { average: 0.94, count: 12, source: 'erc8004', chain: 'Base', erc8004AgentId: '7' },+ capabilityMatch: 0.753,+ amountUsd: 0.05,+ latencyMs: 1840,+ model: 'claude-haiku-4-5-20251001',+ payTo: 'BUrwd1nK6tFeeJMyzRHDo6AuVbnSfUULfvwq21X93nSN',+ task: 'Summarise the latest pump.fun graduations in 3 bullets.',+ };++ it('emits the documented top-level shape', () => {+ const p = buildProvenance(base);+ expect(p).toMatchObject({+ agentId: base.agentId,+ agentName: 'Pump Sage',+ capabilityMatch: 0.75, // rounded to 2dp+ model: 'claude-haiku-4-5-20251001',+ latencyMs: 1840,+ });+ expect(typeof p.settledAt).toBe('string');+ expect(() => new Date(p.settledAt).toISOString()).not.toThrow();+ });++ it('names USDC on Solana mainnet as the settlement rail', () => {+ const p = buildProvenance(base);+ expect(p.payment.asset).toBe(SETTLEMENT_ASSET);+ expect(p.payment.asset).toBe('USDC');+ expect(p.payment.network).toBe(SETTLEMENT_NETWORK);+ expect(p.payment.networkLabel).toBe('Solana mainnet');+ expect(p.payment.scheme).toBe('exact');+ expect(p.payment.amountDisplay).toBe('$0.05');+ expect(p.payment.amountUsd).toBe(0.05);+ expect(p.payment.payTo).toBe(base.payTo);+ });++ it('NEVER inlines a fabricated tx signature — points to _meta for the real one', () => {+ const p = buildProvenance(base);+ expect(p.payment.settlementRef).toBe('see _meta["x402/payment-response"]');+ // A base58 Solana signature is 64+ chars; assert nothing like one leaked+ // into the provenance block (the real ref is attached by the x402 wrapper).+ const blob = JSON.stringify(p);+ expect(/[1-9A-HJ-NP-Za-km-z]{64,}/.test(blob)).toBe(false);+ });++ it('maps reputation when present and nulls it when absent', () => {+ const withRep = buildProvenance(base);+ expect(withRep.reputation).toMatchObject({+ average: 0.94,+ count: 12,+ source: 'erc8004',+ chain: 'Base',+ erc8004AgentId: '7',+ });+ const noRep = buildProvenance({ ...base, reputation: null });+ expect(noRep.reputation).toBeNull();+ });++ it('truncates an over-long task to 280 chars', () => {+ const p = buildProvenance({ ...base, task: 'x'.repeat(500) });+ expect(p.task.length).toBe(280);+ });++ it('rounds the settled amount to USDC (6dp) precision', () => {+ const p = buildProvenance({ ...base, amountUsd: 0.0500009 });+ expect(p.payment.amountUsd).toBe(0.050001);+ });++ it('tolerates missing optional fields without throwing', () => {+ const p = buildProvenance({ agentId: 'x', amountUsd: 0.05, latencyMs: 100 });+ expect(p.agentName).toBeNull();+ expect(p.reputation).toBeNull();+ expect(p.capabilityMatch).toBeNull();+ expect(p.model).toBeNull();+ expect(p.payment.payTo).toBeNull();+ });+});++describe('coin policy — receipts settle in USDC and promote no other token', () => {+ it('a provenance receipt references only USDC as money, no other coin', () => {+ const p = buildProvenance({+ agentId: 'x',+ agentName: 'A',+ amountUsd: 0.05,+ latencyMs: 100,+ task: 'do a thing',+ });+ const blob = JSON.stringify(p).toLowerCase();+ // USDC is the only money token named; assert no rival token tickers leak in.+ expect(blob).toContain('usdc');+ for (const forbidden of ['sol ', 'wsol', 'bonk', 'wif', 'usdt', 'dai']) {+ expect(blob.includes(forbidden)).toBe(false);+ }+ });+});diff --git a/tests/oracle/sources-assemble.test.js b/tests/oracle/sources-assemble.test.jsindex 5e88e6a77..7248dfcb3 100644--- a/tests/oracle/sources-assemble.test.js+++ b/tests/oracle/sources-assemble.test.js@@ -26,6 +26,13 @@ describe('assembleIntel — outage vs unknown', () => {it('throws when the primary lookup fails (DB outage) — never a silent null', async () => {sqlMock.mockRejectedValue(new Error('db query exceeded 15000ms deadline'));- await expect(assembleIntel('MintXYZ', 'mainnet')).rejects.toThrow(/deadline/);+ let caught = null;+ try {+ await assembleIntel('MintXYZ', 'mainnet');+ } catch (err) {+ caught = err;+ }+ expect(caught).toBeInstanceOf(Error);+ expect(caught.message).toMatch(/deadline/);});});