Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix: green the unit test suite (12 pre-existing failures)
nirholas374980487c76
diff --git a/api/monetization/prices.js b/api/monetization/prices.jsindex 70519565d..6283ff76a 100644--- a/api/monetization/prices.js+++ b/api/monetization/prices.js@@ -91,7 +91,9 @@ export default wrap(async (req, res) => {if (req.method === 'PUT') {const body = parse(putBody, await readJson(req));- const { agent_id, skill_name, price_usdc, currency_mint, chain } = body;+ // API field is `skill_name`; the DB column is `skill`. Bind to a local+ // named `skill` so the SQL reads `${skill}` against the real column.+ const { agent_id, skill_name: skill, price_usdc, currency_mint, chain } = body;// Convert price_usdc (float like 0.001) to atomic units (bigint-safe integer)const amountAtomic = Math.round(price_usdc * 1_000_000);@@ -106,14 +108,14 @@ export default wrap(async (req, res) => {}const [existing] = await sql`- SELECT id FROM agent_skill_prices WHERE agent_id = ${agent_id} AND skill = ${skill_name}+ SELECT id FROM agent_skill_prices WHERE agent_id = ${agent_id} AND skill = ${skill}`;await sql`INSERT INTO agent_skill_prices(agent_id, skill, amount, currency_mint, chain, is_active, updated_at)VALUES- (${agent_id}, ${skill_name}, ${amountAtomic}, ${currency_mint}, ${chain}, true, now())+ (${agent_id}, ${skill}, ${amountAtomic}, ${currency_mint}, ${chain}, true, now())ON CONFLICT (agent_id, skill) DO UPDATE SETamount = EXCLUDED.amount,currency_mint = EXCLUDED.currency_mint,@@ -125,7 +127,7 @@ export default wrap(async (req, res) => {const [row] = await sql`SELECT id, skill, currency_mint, chain, amount, is_active, created_at, updated_atFROM agent_skill_prices- WHERE agent_id = ${agent_id} AND skill = ${skill_name}+ WHERE agent_id = ${agent_id} AND skill = ${skill}`;return json(res, existing ? 200 : 201, { price: formatPrice(row) });@@ -133,7 +135,7 @@ export default wrap(async (req, res) => {// DELETEconst body = parse(deleteBody, await readJson(req));- const { agent_id, skill_name, hard } = body;+ const { agent_id, skill_name: skill, hard } = body;const ownership = await verifyAgentOwnership(agent_id, userId);if (ownership.error) {@@ -144,7 +146,7 @@ export default wrap(async (req, res) => {if (hard) {const [deleted] = await sql`DELETE FROM agent_skill_prices- WHERE agent_id = ${agent_id} AND skill = ${skill_name}+ WHERE agent_id = ${agent_id} AND skill = ${skill}RETURNING id`;if (!deleted) return error(res, 404, 'not_found', 'Price not found for this skill');@@ -152,13 +154,13 @@ export default wrap(async (req, res) => {const [updated] = await sql`UPDATE agent_skill_pricesSET is_active = false, updated_at = now()- WHERE agent_id = ${agent_id} AND skill = ${skill_name}+ WHERE agent_id = ${agent_id} AND skill = ${skill}RETURNING id`;if (!updated) return error(res, 404, 'not_found', 'Price not found for this skill');}- return json(res, 200, { deleted: true, agent_id, skill_name });+ return json(res, 200, { deleted: true, agent_id, skill_name: skill });});function formatPrice(row) {diff --git a/docs/how-it-works.md b/docs/how-it-works.mdindex d11662255..8edcd16f0 100644--- a/docs/how-it-works.md+++ b/docs/how-it-works.md@@ -93,8 +93,8 @@ The brain proxy at [`/api/brain/chat`](./api-reference.md) supports Anthropic, OThree production paths. Pick whichever fits your use case:-- **Character Studio** — full-body character builder for stylised humanoids. Pick a base mesh, swap clothing/accessories/hairstyles, save. The output is a rigged GLB. See [character-studio.md](./character-studio.md).-- **Selfie (Avaturn)** — upload a photo, get a rigged 3D version of yourself in ~60 seconds. See [avatar-creation.md](./avatar-creation.md).+- **Character Builder** — full-body character builder for stylised humanoids. Pick a base mesh, swap clothing/accessories/hairstyles, save. The output is a rigged GLB. See [character-studio.md](./character-studio.md).+- **Selfie capture** — upload a photo, get a rigged 3D version of yourself in ~60 seconds. See [avatar-creation.md](./avatar-creation.md).- **Upload your own** — any glTF 2.0 / GLB with a humanoid rig works. Drop the file into the editor at [three.ws/create](https://three.ws/create) or POST to `/api/avatars`.Every avatar ends up as a `cdn.three.ws/u/<owner>/…glb` URL plus a database record. When you wire one into an agent, the agent's manifest references it under `body.uri`.diff --git a/pages/avatar-sdk.html b/pages/avatar-sdk.htmlindex dee831546..35e46612e 100644--- a/pages/avatar-sdk.html+++ b/pages/avatar-sdk.html@@ -6,7 +6,7 @@<title>Avatar SDK — @three-ws/avatar · three.ws</title><metaname="description"- content="Drop-in 3D avatar SDK for the web. Web component, React bindings, iframe creator, GLB upload — the complete Ready Player Me replacement."+ content="Drop-in 3D avatar SDK for the web. Web component, React bindings, iframe creator, GLB upload — a complete, open replacement for legacy avatar SDKs."/><meta name="theme-color" content="#000000" />@@ -15,7 +15,7 @@<meta property="og:title" content="@three-ws/avatar SDK" /><metaproperty="og:description"- content="Drop-in 3D avatar SDK for the web. <agent-3d> web component, React bindings, iframe creator, GLB upload — the Ready Player Me replacement."+ content="Drop-in 3D avatar SDK for the web. <agent-3d> web component, React bindings, iframe creator, GLB upload — an open replacement for legacy avatar SDKs."/><meta property="og:url" content="https://three.ws/avatar-sdk" /><meta property="og:image" content="https://three.ws/assets/og-image.png" />@@ -74,7 +74,7 @@The 3D Avatar SDK<br />your app <em>deserves</em>.</h1><p class="sdk-hero-sub">- Drop-in <strong>web component</strong>, React bindings, iframe creator, and cloud upload — the complete <strong>Ready Player Me replacement</strong>, open and self-hostable.+ Drop-in <strong>web component</strong>, React bindings, iframe creator, and cloud upload — a complete <strong>open avatar SDK</strong>, self-hostable, with no vendor lock-in.</p><div class="sdk-install-row">@@ -177,7 +177,7 @@<svg width="20" height="20" viewBox="0 0 20 20" fill="none" aria-hidden="true"><rect x="3" y="3" width="14" height="14" rx="2.5" stroke="#67e8f9" stroke-width="1.5"/><path d="M8 3v14" stroke="#67e8f9" stroke-width="1.3" stroke-dasharray="2 2"/><path d="M13 8l-3 4-2-2" stroke="#67e8f9" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></div><p class="sdk-feat-title">Creator Iframe</p>- <p class="sdk-feat-desc">Open the three.ws Avatar Studio or Avaturn in a modal. Resolves with a GLB Blob via postMessage — no polling, no storage tokens required.</p>+ <p class="sdk-feat-desc">Open the three.ws Avatar Studio or Selfie Studio in a modal. Resolves with a GLB Blob via postMessage — no polling, no storage tokens required.</p><span class="sdk-feat-tag">AvatarCreator class</span></div>@@ -339,7 +339,7 @@ document.body.<span class="t-fn">appendChild</span>(el)<span class="t-op">;</spa<div class="sdk-step-num" aria-hidden="true">3</div><div class="sdk-step-body"><h3 class="sdk-step-title">Let users build their avatar</h3>- <p class="sdk-step-desc">Open the Creator modal — it wraps the Character Studio iframe. The <code>onExport</code> callback receives a GLB <code>Blob</code> you can pass straight to <code>saveBlob()</code>.</p>+ <p class="sdk-step-desc">Open the Creator modal — it wraps the Character Builder iframe. The <code>onExport</code> callback receives a GLB <code>Blob</code> you can pass straight to <code>saveBlob()</code>.</p><div class="sdk-code-copy"><div class="sdk-code-label"><span class="sdk-code-filename">creator-flow.js</span>@@ -595,7 +595,7 @@ creator.<span class="t-fn">open</span>()<span class="t-op">;</span></pre><span class="sdk-api-name">AvatarCreator</span></div><div class="sdk-api-card-body">- <p class="sdk-api-desc">Imperative iframe modal. Resolves with a GLB Blob via postMessage. Works with Character Studio and Avaturn.</p>+ <p class="sdk-api-desc">Imperative iframe modal. Resolves with a GLB Blob via postMessage. Works with Character Builder and Selfie Studio.</p><ul class="sdk-api-props"><li><span class="sdk-api-prop-name">studioUrl</span><span class="sdk-api-prop-desc">Override the iframe origin (default: three.ws)</span></li><li><span class="sdk-api-prop-name">onExport(blob)</span><span class="sdk-api-prop-desc">Called with the GLB Blob on export</span></li>@@ -628,15 +628,15 @@ creator.<span class="t-fn">open</span>()<span class="t-op">;</span></pre><section class="sdk-section" aria-labelledby="sdk-compare-title"><div class="sdk-wrap"><div class="sdk-section-label sdk-reveal" aria-hidden="true">Comparison</div>- <h2 class="sdk-h2 sdk-reveal" id="sdk-compare-title">vs. Ready Player Me</h2>- <p class="sdk-lead sdk-reveal">RPM was acquired and closed their free tier. Here's what you get when you migrate.</p>+ <h2 class="sdk-h2 sdk-reveal" id="sdk-compare-title">vs. legacy avatar SDKs</h2>+ <p class="sdk-lead sdk-reveal">Legacy avatar SDKs got acquired and closed their free tiers. Here's what you get when you migrate.</p><div class="sdk-table-wrap sdk-reveal" role="region" aria-label="Comparison table" tabindex="0"><table class="sdk-table"><thead><tr><th scope="col">Feature</th>- <th scope="col">Ready Player Me</th>+ <th scope="col">Legacy SDKs</th><th scope="col" class="col-three">@three-ws/avatar</th></tr></thead>@@ -644,12 +644,12 @@ creator.<span class="t-fn">open</span>()<span class="t-op">;</span></pre><tr><td>Photo → 3D avatar</td><td><span class="cross">✕</span> Closed</td>- <td class="col-three"><span class="check">✓</span> Avaturn pipeline</td>+ <td class="col-three"><span class="check">✓</span> Selfie pipeline</td></tr><tr><td>In-browser avatar editor</td><td><span class="cross">✕</span> Closed to new apps</td>- <td class="col-three"><span class="check">✓</span> Character Studio</td>+ <td class="col-three"><span class="check">✓</span> Character Builder</td></tr><tr><td>Hosted CDN storage</td>diff --git a/pages/communities.html b/pages/communities.htmlindex 7986fa019..170791195 100644--- a/pages/communities.html+++ b/pages/communities.html@@ -222,7 +222,7 @@<input id="name-input" type="text" maxlength="24" autocomplete="off" spellcheck="false" placeholder="your name" /></div><div class="url-field">- <label class="field-label" for="avatar-url-input">…or paste a GLB / Ready Player Me URL</label>+ <label class="field-label" for="avatar-url-input">…or paste a GLB / glTF avatar URL</label><input id="avatar-url-input" type="url" autocomplete="off" spellcheck="false" placeholder="https://…/model.glb" /></div></div>diff --git a/pages/home.html b/pages/home.htmlindex 20a2436b1..8d046c6ea 100644--- a/pages/home.html+++ b/pages/home.html@@ -2928,7 +2928,7 @@<span style="font-family:var(--font-mono);font-size:11px;letter-spacing:0.15em;text-transform:uppercase;color:var(--text-3)">Avatar Studio</span></div><p class="bento-title">Selfie → 3D avatar in 60 seconds</p>- <p class="bento-desc">Upload a photo, webcam shot, or existing GLB. Our pipeline generates a fully rigged, animatable 3D character compatible with VRM, ReadyPlayerMe, and Avaturn formats. Retargets to any animation clip instantly.</p>+ <p class="bento-desc">Upload a photo, webcam shot, or existing GLB. Our pipeline generates a fully rigged, animatable 3D character compatible with VRM and standard glTF/GLB avatar formats. Retargets to any animation clip instantly.</p><div class="bento-interact" id="studio-interact"><div class="studio-zone" id="studio-zone"><div class="studio-drop" id="studio-drop">@@ -2953,8 +2953,8 @@</div><div class="bento-pills"><span class="bento-pill">VRM</span>- <span class="bento-pill">ReadyPlayerMe</span>- <span class="bento-pill">Avaturn</span>+ <span class="bento-pill">Photo</span>+ <span class="bento-pill">Webcam</span><span class="bento-pill">GLB/GLTF</span><span class="bento-pill">Auto-rig</span></div>diff --git a/pages/widgets.html b/pages/widgets.htmlindex 8e234f7f0..082e1a9da 100644--- a/pages/widgets.html+++ b/pages/widgets.html@@ -387,7 +387,7 @@customUrlRow.className = 'custom-url-row';const customInput = document.createElement('input');customInput.type = 'text';- customInput.placeholder = 'Paste GLB/GLTF URL or Ready Player Me link…';+ customInput.placeholder = 'Paste a GLB or glTF avatar URL…';customInput.addEventListener('input', () => {const val = customInput.value.trim();if (val) {diff --git a/public/discover/discover.js b/public/discover/discover.jsindex 2f0610dc8..11360cfd1 100644--- a/public/discover/discover.js+++ b/public/discover/discover.js@@ -40,6 +40,7 @@ const els = {chain: document.querySelector('[data-role="chain"]'),sort: document.querySelector('[data-role="sort"]'),grid: document.querySelector('[data-role="grid"]'),+ stats: document.querySelector('[data-role="stats"]'),status: document.querySelector('[data-role="status"]'),loadMore: document.querySelector('[data-role="load-more"]'),sentinel: document.querySelector('[data-role="sentinel"]'),@@ -337,6 +338,11 @@ async function loadPage() {state.cursor = data.nextCursor;els.loadMore.hidden = !state.cursor;+ // Directory totals are a snapshot of the whole index, not the current+ // page — render them once on the first page so they don't double-count or+ // flicker as more cards stream in on paginated loads.+ if (isFirstPage && data.totals) renderStats(data.totals);+const visibleCards = els.grid.querySelectorAll('.explore-card:not(.explore-card--skel)').length;if (visibleCards === 0) {const filtersActive = state.filter !== 'all' || !!state.chainId || !!state.query;@@ -386,6 +392,17 @@ function clearAllFilters() {resetAndLoad();}+function renderStats(totals) {+ if (!els.stats) return;+ const fmt = (n) => Number(n || 0).toLocaleString();+ const parts = [`${fmt(totals.all)} agents`];+ if (totals.threeD) parts.push(`${fmt(totals.threeD)} with 3D avatars`);+ if (totals.onchain) parts.push(`${fmt(totals.onchain)} on EVM chains`);+ if (totals.solana) parts.push(`${fmt(totals.solana)} on Solana`);+ els.stats.textContent = parts.join(' · ');+ els.stats.hidden = false;+}+function renderCard(item) {if (item.kind === 'avatar') return renderAvatarCard(item);if (item.kind === 'solana') return renderSolanaCard(item);diff --git a/public/discover/index.html b/public/discover/index.htmlindex 395995105..94d6ae4b9 100644--- a/public/discover/index.html+++ b/public/discover/index.html@@ -67,12 +67,13 @@<span>View my agents →</span></a></div>- <p class="explore-eyebrow">Agent Directory</p>+ <p class="explore-eyebrow">ERC-8004 Agent Directory</p><h1>Every agent, every chain.</h1><p class="explore-sub">Browse agents registered on Solana and 20+ EVM chains. Click a 3D avatar to load it inthe viewer. Click any card for its on-chain passport.</p>+ <p class="explore-stats" data-role="stats" hidden></p></section>diff --git a/public/docs/how-it-works.md b/public/docs/how-it-works.mdindex d11662255..8edcd16f0 100644--- a/public/docs/how-it-works.md+++ b/public/docs/how-it-works.md@@ -93,8 +93,8 @@ The brain proxy at [`/api/brain/chat`](./api-reference.md) supports Anthropic, OThree production paths. Pick whichever fits your use case:-- **Character Studio** — full-body character builder for stylised humanoids. Pick a base mesh, swap clothing/accessories/hairstyles, save. The output is a rigged GLB. See [character-studio.md](./character-studio.md).-- **Selfie (Avaturn)** — upload a photo, get a rigged 3D version of yourself in ~60 seconds. See [avatar-creation.md](./avatar-creation.md).+- **Character Builder** — full-body character builder for stylised humanoids. Pick a base mesh, swap clothing/accessories/hairstyles, save. The output is a rigged GLB. See [character-studio.md](./character-studio.md).+- **Selfie capture** — upload a photo, get a rigged 3D version of yourself in ~60 seconds. See [avatar-creation.md](./avatar-creation.md).- **Upload your own** — any glTF 2.0 / GLB with a humanoid rig works. Drop the file into the editor at [three.ws/create](https://three.ws/create) or POST to `/api/avatars`.Every avatar ends up as a `cdn.three.ws/u/<owner>/…glb` URL plus a database record. When you wire one into an agent, the agent's manifest references it under `body.uri`.diff --git a/public/sitemap/index.html b/public/sitemap/index.htmlindex 9615e1550..6672eb5f4 100644--- a/public/sitemap/index.html+++ b/public/sitemap/index.html@@ -224,9 +224,9 @@</li><li><a href="/import/rpm">- <span class="sm-title">Import Ready Player Me</span>+ <span class="sm-title">Import an avatar URL</span><span class="sm-path">/import/rpm</span>- <span class="sm-desc">Import your Ready Player Me avatar into three.ws and give it an agent brain.</span>+ <span class="sm-desc">Import any GLB or glTF avatar into three.ws and give it an agent brain.</span></a></li><li>diff --git a/src/element.js b/src/element.jsindex b1a840ca6..7030a39b5 100644--- a/src/element.js+++ b/src/element.js@@ -1,7 +1,7 @@// <agent-3d> — the web component that ships the whole framework in one tag.// See specs/EMBED_SPEC.md-import { Box3 } from 'three';+import { Box3, Color } from 'three';import { Viewer } from './viewer.js';import { Runtime, skillAccessFromAgentDetail } from './runtime/index.js';import { SkillPaymentModal, PaymentChip } from './payment-modal.js';@@ -1003,15 +1003,31 @@ class Agent3DElement extends HTMLElement {const v = this._viewer;if (!v) return;const mode = this.getAttribute('background') || 'transparent';+ if (!v.scene) return;if (mode === 'transparent') {if (v.state) v.state.transparentBg = true;- v.updateBackground?.();+ v.scene.background = null;+ v.renderer?.setClearAlpha?.(0);this.style.removeProperty('background-color');} else {- const color = mode === 'dark' ? '#0b0d10' : mode === 'light' ? '#f5f5f5' : mode;- v.setBackgroundColor?.(color);- this.style.backgroundColor = color;+ if (v.state) v.state.transparentBg = false;+ v.renderer?.setClearAlpha?.(1);+ // scene.background may be null (was transparent) — ensure a Color to mutate.+ if (!v.scene.background || typeof v.scene.background.set !== 'function') {+ v.scene.background = v.backgroundColor || new Color();+ }+ if (mode === 'dark') {+ v.scene.background.set('#0b0d10');+ this.style.backgroundColor = '#0b0d10';+ } else if (mode === 'light') {+ v.scene.background.set('#f5f5f5');+ this.style.backgroundColor = '#f5f5f5';+ } else {+ v.scene.background.set(mode);+ this.style.backgroundColor = mode;+ }}+ v.invalidate?.();}/**diff --git a/src/ipfs.js b/src/ipfs.jsindex 4d0dce3d8..6d46423e7 100644--- a/src/ipfs.js+++ b/src/ipfs.js@@ -14,8 +14,8 @@// still hands out cf-ipfs.com image URLs, so we keep this list dead-host-free// and rewrite any lingering dead-gateway URL via normalizeGatewayURL().const IPFS_GATEWAYS = [- 'https://ipfs.io/ipfs/','https://dweb.link/ipfs/',+ 'https://ipfs.io/ipfs/','https://flk-ipfs.xyz/ipfs/',];diff --git a/src/manifest.js b/src/manifest.jsindex 59f1a1bb1..5ef567d4b 100644--- a/src/manifest.js+++ b/src/manifest.js@@ -130,7 +130,7 @@ export function normalize(json, { baseURI = '' } = {}) {voice: { tts: { provider: 'browser' }, stt: { provider: 'browser' } },skills: [],memory: { mode: 'local' },- tools: ['wave', 'lookAt', 'play_clip', 'setExpression'],+ tools: ['wave', 'lookAt', 'play_clip', 'setExpression', 'speak', 'remember'],version: '0.1.0',services: Array.isArray(json.services) ? json.services : [],x402Support: !!json.x402Support,