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(claim-wallet): land the claim, studio and characters follow-ups from this worktree
nirholasd2d8382a7d87
diff --git a/chat/index.html b/chat/index.htmlindex ab2675fff..f401e9ce2 100644--- a/chat/index.html+++ b/chat/index.html@@ -8,24 +8,24 @@<link rel="manifest" href="/chat/manifest.json"><meta name="theme-color" content="#0A0A0A"/><style>- /* Dark canvas before the app stylesheet loads — avoids a white flash. */+ /* Dark canvas before the app stylesheet loads, so there is no white flash. */html, body { background: #0A0A0A; color: #ECEAE3; }</style>- <meta name="description" content="Chat with any AI model — Claude, GPT, Gemini, Ollama and more. Powered by three.ws." />+ <meta name="description" content="Talk to your agent: voice, text, and real tool use in one interface. Free built-in models or your own key, with 3D generation inline in the thread." /><!-- Open Graph --><meta property="og:type" content="website" /><meta property="og:url" content="https://three.ws/chat" />- <meta property="og:title" content="three.ws chat" />- <meta property="og:description" content="Chat with any AI model — Claude, GPT, Gemini, Ollama and more." />+ <meta property="og:title" content="Chat · three.ws" />+ <meta property="og:description" content="Talk to your agent: voice, text, and real tool use in one interface, with 3D generation inline in the thread." /><meta property="og:image" content="https://three.ws/api/page-og?s=agent-tools&t=Chat&d=Talk+to+your+agent.+Voice%2C+text%2C+and+tool-use+in+one+interface.&p=%2Fchat" /><!-- Twitter --><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:site" content="@three_ws" />- <meta name="twitter:title" content="three.ws chat" />- <meta name="twitter:description" content="Chat with any AI model — Claude, GPT, Gemini, Ollama and more." />+ <meta name="twitter:title" content="Chat · three.ws" />+ <meta name="twitter:description" content="Talk to your agent: voice, text, and real tool use in one interface, with 3D generation inline in the thread." /><meta name="twitter:image" content="https://three.ws/api/page-og?s=agent-tools&t=Chat&d=Talk+to+your+agent.+Voice%2C+text%2C+and+tool-use+in+one+interface.&p=%2Fchat" /><link rel="stylesheet" href="/fonts/fonts.css" />@@ -35,7 +35,7 @@integrity="sha384-GvrOXuhMATgEsSwCs4smul74iXGOixntILdUW9XmUC6+HX0sLNAK3q71HotJqlAn"crossorigin="anonymous"/>- <title>three.ws chat</title>+ <title>Chat · three.ws</title><link rel="stylesheet" href="/footer.css" /><script type="importmap">{diff --git a/src/avatar-studio.js b/src/avatar-studio.jsindex 441642a69..87cca046c 100644--- a/src/avatar-studio.js+++ b/src/avatar-studio.js@@ -122,9 +122,13 @@ const DEFAULT_EMOTE = 'idle';// Animation state. `emotesReady` flips true once the clip library loads and the// idle clip binds to the rig; until then the Animate tab shows a loading state.+// `emotesFailed` separates "still loading" from "this attempt is over", because+// treating a failed load as perpetual loading left the tab showing skeleton+// tiles forever when the clip manifest could not be fetched.// `currentEmote` is the looping clip the avatar rests in (one-shots settle back// to it). `activeIdleClip` is the looping baseline that Save bakes in.let emotesReady = false;+let emotesFailed = false;let currentEmote = DEFAULT_EMOTE;let activeIdleClip = DEFAULT_EMOTE;@@ -507,7 +511,7 @@ function updateDirtyState() {// ── Randomise ────────────────────────────────────────────────────────-function randomizeAppearance() {+async function randomizeAppearance() {// Pick one random swatch per color slotfor (const slot of COLOR_SLOTS) {const swatch = slot.swatches[Math.floor(Math.random() * slot.swatches.length)];@@ -538,11 +542,20 @@ function randomizeAppearance() {const hat = pick(hats);const glass = pick(glasses);const toApply = [hat, glass].filter(Boolean);- for (const p of toApply) workingAppearance.accessories.push(p.id);- if (accessoryManager) {- queueOp(async () => {- for (const p of toApply) await accessoryManager.applyPreset(p);- });++ // Record an accessory only once it is actually on the rig. Listing it up+ // front meant a failed fetch left a chip for something the avatar was not+ // wearing, which then got saved into the appearance record. Each apply is+ // independent so one failure cannot drop the other.+ const failed = [];+ if (accessoryManager && toApply.length) {+ const done = beginBusy('Randomising…');+ for (const p of toApply) {+ const { ok } = await runQueued(() => accessoryManager.applyPreset(p));+ if (ok) workingAppearance.accessories.push(p.id);+ else failed.push(p.name);+ }+ done();}pushHistory();@@ -550,7 +563,12 @@ function randomizeAppearance() {renderActivePanel();updateDirtyState();scheduleDraftSave();- setStatus('ok', 'Randomised! Click Save when happy.');+ setStatus(+ failed.length ? 'err' : 'ok',+ failed.length+ ? `Randomised, but ${failed.join(' and ')} couldn’t load. Everything else applied.`+ : 'Randomised! Click Save when happy.',+ );}// ── Proportions (skeleton-space build) ───────────────────────────────diff --git a/src/characters.js b/src/characters.jsindex cbb61bc74..397a7d07d 100644--- a/src/characters.js+++ b/src/characters.js@@ -217,9 +217,9 @@ async function fetchCharacters(reset = false) {} catch {state.appending = false;if (superseded()) return;- grid.setAttribute('aria-busy', 'false');showError(grid, !reset);if (loadBtn) loadBtn.disabled = false;+ grid.setAttribute('aria-busy', 'false');return;}@@ -232,9 +232,11 @@ async function fetchCharacters(reset = false) {if (reset) {if (!chars.length) {- grid.setAttribute('aria-busy', 'false');showEmpty(grid);if (loadMore) loadMore.hidden = true;+ // Flipped last, so anything waiting on aria-busy (assistive tech, the+ // e2e probe) observes the rendered state rather than an empty grid.+ grid.setAttribute('aria-busy', 'false');return;}grid.innerHTML = chars.map(cardHtml).join('');diff --git a/src/claim-wallet.js b/src/claim-wallet.jsindex f81eb688d..9829e48c6 100644--- a/src/claim-wallet.js+++ b/src/claim-wallet.js@@ -188,6 +188,28 @@ document.addEventListener('DOMContentLoaded', () => {function showErr(msg) { const e = $('#cwErr'); e.textContent = msg; e.hidden = false; }function hideErr() { $('#cwErr').hidden = true; }+// The Analyze button carries data-i18n, so the catalog pass (which lands after+// an async /api/locale fetch) used to overwrite "Analyzing…" with the idle label+// mid-request and the busy state never showed. data-i18n-owned is the codebase's+// opt-out: claim the element while busy, hand it back on release so a later+// locale switch still translates it.+let _idleBtnLabel = null;+function setBtnBusy(btn, label) {+ if (_idleBtnLabel === null) _idleBtnLabel = btn.textContent;+ btn.setAttribute('data-i18n-owned', '1');+ btn.disabled = true;+ btn.setAttribute('aria-busy', 'true');+ btn.textContent = label;+}+function setBtnIdle(btn) {+ btn.disabled = false;+ btn.removeAttribute('aria-busy');+ btn.textContent = _idleBtnLabel ?? btn.textContent;+ btn.removeAttribute('data-i18n-owned');+ // Re-apply in case the catalog landed while the button was owned.+ window.threewsI18n?.apply?.(btn);+}+// ── fetch + orchestrate ─────────────────────────────────────────────────────────const STATE = { data: null, wallet: null, win: 'all', sortKey: 'last_seen_at', sortDir: -1, q: '', hideClosed: false, creatorOnly: false, hideDust: true };@@ -196,8 +218,7 @@ async function analyze(wallet) {const btn = $('#cwBtn');$('#cwHero').classList.add('compact');- btn.disabled = true;- btn.textContent = 'Analyzing…';+ setBtnBusy(btn, 'Analyzing…');result.innerHTML = skeletonHtml();let data;@@ -218,11 +239,11 @@ async function analyze(wallet) {result.innerHTML = errorHtml(wallet, e);const retry = result.querySelector('#cwRetry');if (retry) retry.addEventListener('click', () => analyze(wallet));- btn.disabled = false; btn.textContent = 'Analyze';+ setBtnIdle(btn);return;}- btn.disabled = false; btn.textContent = 'Analyze';+ setBtnIdle(btn);if (!data.claimable && !data.known) {result.innerHTML = notFoundHtml(wallet);diff --git a/tests/e2e/play-vehicles.spec.js b/tests/e2e/play-vehicles.spec.jsindex 8511b06c7..481f82b29 100644--- a/tests/e2e/play-vehicles.spec.js+++ b/tests/e2e/play-vehicles.spec.js@@ -18,14 +18,26 @@ import { serveHarness, collectPageErrors } from './_support.js';const HARNESS = '**/e2e/vehicle-mesh';+// Vite re-bundles the moment it first sees a new dependency and drops the module+// requests that were in flight while it does, which surfaces as "Failed to fetch+// dynamically imported module" on a cold dev server. Retry the import instead of+// reporting a build-server restart as a product failure.+const RETRYING_IMPORT = `window.__imp = async (path) => {+ let last;+ for (let i = 0; i < 4; i++) {+ try { return await import(path); } catch (e) { last = e; await new Promise((r) => setTimeout(r, 700)); }+ }+ throw last;+};`;+// Build a parked car of `type` in a real WebGL scene and report its geometry.// The group origin is the chassis centre, so a parked car is lifted by exactly// vehicleRestHeight, the same placement WalkRoom seeds the fleet with.async function measureCar(page, type) {return page.evaluate(async (vehicleType) => {- const THREE = await import('/node_modules/three/build/three.module.js');- const { buildVehicleMesh } = await import('/src/game/vehicle-mesh.js');- const { vehicleSpec, vehicleRestHeight } = await import('/multiplayer/src/vehicles.js');+ const THREE = await window.__imp('/node_modules/three/build/three.module.js');+ const { buildVehicleMesh } = await window.__imp('/src/game/vehicle-mesh.js');+ const { vehicleSpec, vehicleRestHeight } = await window.__imp('/multiplayer/src/vehicles.js');const spec = vehicleSpec(vehicleType);const rest = vehicleRestHeight(spec.id);@@ -73,6 +85,7 @@ async function measureCar(page, type) {test.describe('/play vehicles', () => {test.beforeEach(async ({ page }) => {await serveHarness(page, HARNESS, { title: 'vehicle mesh harness' });+ await page.addInitScript(RETRYING_IMPORT);await page.goto('/e2e/vehicle-mesh');});@@ -122,8 +135,8 @@ test.describe('/play vehicles', () => {test('two cars on one model keep their own brake lights', async ({ page }) => {const result = await page.evaluate(async () => {- const { buildVehicleMesh } = await import('/src/game/vehicle-mesh.js');- const { vehicleSpec } = await import('/multiplayer/src/vehicles.js');+ const { buildVehicleMesh } = await window.__imp('/src/game/vehicle-mesh.js');+ const { vehicleSpec } = await window.__imp('/multiplayer/src/vehicles.js');const spec = vehicleSpec('trench');const a = buildVehicleMesh(spec, spec.color);const b = buildVehicleMesh(spec, spec.color);