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
home + demos polish, gallery-picker e2e
nirholase6609378c8be
diff --git a/pages/home.html b/pages/home.htmlindex 3c5214aed..3e6cb86cc 100644--- a/pages/home.html+++ b/pages/home.html@@ -941,9 +941,71 @@// onto its skeleton via AnimationMixer), regardless of what's baked in.(function () {const canvas = document.getElementById('home-act2-canvas');- const opts = document.querySelectorAll('.h-av-opt');const chipsWrap = document.querySelector('[data-role="anim-chips"]');- if (!canvas || !chipsWrap) return;+ const picker = document.querySelector('.h-avatar-picker');+ if (!canvas || !chipsWrap || !picker) return;++ /* The viewer (heavy Three.js) loads lazily when Act 2 enters view.+ The picker (lightweight DOM + fetch) hydrates on page load so+ featured-agent names are correct *before* the user scrolls. */+ let _resolveViewer;+ const viewerReady = new Promise((r) => (_resolveViewer = r));++ function bindOpt(btn) {+ btn.addEventListener('click', async () => {+ picker+ .querySelectorAll('.h-av-opt')+ .forEach((b) => b.setAttribute('aria-pressed', 'false'));+ btn.setAttribute('aria-pressed', 'true');+ const viewer = await viewerReady;+ try {+ await viewer.loadModel(btn.dataset.src);+ } catch (e) {+ console.error(e);+ }+ });+ }+ picker.querySelectorAll('.h-av-opt').forEach(bindOpt);++ /* Eagerly populate the picker from /api/explore so featured agents+ (Ansem, Boss Vernington, …) appear immediately. Static buttons+ stay if the fetch fails or returns nothing usable. */+ (async function hydratePicker() {+ try {+ const r = await fetch(+ '/api/explore?source=avatar&quality=high&limit=12',+ );+ if (!r.ok) return;+ const j = await r.json();+ const seen = new Set();+ const named = (j?.items || [])+ .filter((it) => {+ if (it.kind !== 'avatar' || !it.glbUrl) return false;+ const name = String(it.name || '').trim();+ if (name.length < 2) return false;+ if (/^avatar[\s_-]?\d/i.test(name)) return false;+ if (seen.has(name.toLowerCase())) return false;+ seen.add(name.toLowerCase());+ return true;+ })+ .slice(0, 3);+ if (named.length < 2) return;+ picker.innerHTML = '';+ named.forEach((a, i) => {+ const btn = document.createElement('button');+ btn.type = 'button';+ btn.className = 'h-av-opt';+ btn.dataset.src = a.glbUrl;+ btn.setAttribute('aria-pressed', i === 0 ? 'true' : 'false');+ btn.textContent = a.name;+ picker.appendChild(btn);+ bindOpt(btn);+ });+ } catch (e) {+ // Keep static picker; surface in dev so genuine bugs aren't swallowed.+ console.warn('[home] picker hydration failed', e);+ }+ })();/* Wait for the Act2Viewer ESM to load (it sets window.Act2Viewer) */function whenReady(cb) {@@ -987,64 +1049,15 @@viewer.onClipsReady = rebuildChips;- /* default avatar — Robot (matches aria-pressed="true" in HTML) */- viewer.loadModel('/animations/robotexpressive.glb').catch(console.error);-- /* avatar picker — wire static buttons, then hydrate from- /api/explore so the picker showcases real featured agents- (Ansem, Boss Vernington, …) instead of generic demos. */- const picker = document.querySelector('.h-avatar-picker');- function bindOpt(btn) {- btn.addEventListener('click', async () => {- picker- .querySelectorAll('.h-av-opt')- .forEach((b) => b.setAttribute('aria-pressed', 'false'));- btn.setAttribute('aria-pressed', 'true');- try {- await viewer.loadModel(btn.dataset.src);- } catch (e) {- console.error(e);- }- });- }- opts.forEach(bindOpt);+ /* Default load: whichever picker button is currently pressed+ (after hydration this is the first featured agent). */+ const activeBtn = picker.querySelector('.h-av-opt[aria-pressed="true"]');+ const defaultSrc =+ activeBtn?.dataset.src || '/animations/robotexpressive.glb';+ viewer.loadModel(defaultSrc).catch(console.error);- (async function hydrateFeatured() {- try {- const r = await fetch(- '/api/explore?source=avatar&quality=high&limit=12',- );- if (!r.ok) return;- const j = await r.json();- const seen = new Set();- const named = (j?.items || [])- .filter((it) => {- if (it.kind !== 'avatar' || !it.glbUrl) return false;- const name = String(it.name || '').trim();- if (name.length < 2) return false;- if (/^avatar[\s_-]?\d/i.test(name)) return false;- if (seen.has(name.toLowerCase())) return false;- seen.add(name.toLowerCase());- return true;- })- .slice(0, 3);- if (named.length < 2 || !picker) return;- picker.innerHTML = '';- named.forEach((a, i) => {- const btn = document.createElement('button');- btn.type = 'button';- btn.className = 'h-av-opt';- btn.dataset.src = a.glbUrl;- btn.setAttribute('aria-pressed', i === 0 ? 'true' : 'false');- btn.textContent = a.name;- picker.appendChild(btn);- bindOpt(btn);- });- await viewer.loadModel(named[0].glbUrl);- } catch (e) {- /* keep static picker on network error */- }- })();+ /* Resolve viewerReady so any queued picker clicks proceed. */+ _resolveViewer(viewer);/* click on canvas to toggle zoom (default → extra-wide) */let wider = false;diff --git a/public/demos/pricing.html b/public/demos/pricing.htmlindex 08555efa7..d294ad533 100644--- a/public/demos/pricing.html+++ b/public/demos/pricing.html@@ -282,7 +282,7 @@</div></div>- <p class="hint">Hover a tier — she walks across (or leaps onto Pro). Click a button to see her react.</p>+ <p class="hint">Hover a tier — she walks across. Click a button to see her react.</p></div><canvas id="avatar-canvas"></canvas>@@ -370,39 +370,17 @@return domToWorld(r.left + r.width / 2, r.top + FEET_TOP_OFFSET_PX);}- // phase: loading | idle | walking | jumping (declared above)+ // phase: loading | idle | walking (declared above)// activeTier: tier she's currently associated with (declared above)let walkT = 0, walkStart = null, walkEnd = null, walkDur = 0.85, walkPeakRise = 0;- let jumpT = 0, jumpStart = null, jumpEnd = null, jumpLift = 0;- let lastMoveKind = null; // 'walk' | 'jump' — read by landOnTier// Optional callback fired once the avatar has fully settled into// idle after a move. Used by CTA clicks to queue the reaction// until she's actually on the right tier and standing still.let onArrival = null;- // Post-jump root-Y ease: when the superhero clip lands, hips are- // well below baseRootPos.y. Snapping back to base in one frame- // pops; we ramp over ROOT_SETTLE_S inside the render hook so we- // reliably beat mixer.update() to the final write.- let rootSettleT = -1, rootSettleStart = 0;- const ROOT_SETTLE_S = 0.5;const WALK_SPEED = 5; // world units per second- // Matches the av-superhero-jump clip (2.0s) — finishing a touch- // early so the landing-clamp pose doesn't sit frozen too long.- const JUMP_S = 1.7;function smoothstep(t) { return t * t * (3 - 2 * t); }- // Pro is the "most popular" pedestal — she leaps onto it from- // either neighbour for a dramatic entrance, and walks everywhere- // else (including stepping back down off Pro).- function shouldJump(fromEl, toEl) {- if (!fromEl || !toEl) return false;- const from = fromEl.dataset.tier;- const to = toEl.dataset.tier;- return (from === 'basic' && to === 'pro') ||- (from === 'enterprise' && to === 'pro');- }-function beginMove(tierEl) {if (activeTier) activeTier.classList.remove('is-active');activeTier = tierEl;@@ -414,7 +392,6 @@beginMove(tierEl);phase = 'walking';- lastMoveKind = 'walk';walkT = 0;walkStart = { x: avatar.position.x, y: avatar.position.y };walkEnd = standOnTopOf(tierEl);@@ -440,28 +417,8 @@gsap.to(avatar.rotation, { y: dir * (Math.PI / 2), duration: 0.25, overwrite: true });}- function jumpToTier(tierEl) {- if (!avatar || tierEl === activeTier) return;- beginMove(tierEl);-- phase = 'jumping';- lastMoveKind = 'jump';- jumpT = 0;- jumpStart = { x: avatar.position.x, y: avatar.position.y };- jumpEnd = standOnTopOf(tierEl);- // Bigger arc — the hip-Y of the clip is suppressed by the- // render hook so the parabola is the only visible airborne lift.- // 2.2 baseline reads clearly even for short adjacent hops.- const dx = Math.abs(jumpEnd.x - jumpStart.x);- jumpLift = Math.max(2.2, dx * 0.55);- setAnimation('av-superhero-jump', { loop: false, hold: true });- // Face direction of travel — slight yaw, not full profile- const dir = Math.sign(jumpEnd.x - jumpStart.x) || 0;- gsap.to(avatar.rotation, { y: dir * 0.25, duration: 0.2, overwrite: true });- }-// Per-tier CTA reaction. Plays when the user clicks the tier's- // call-to-action button (after the avatar has walked/jumped onto+ // call-to-action button (after the avatar has walked onto// that tier if she wasn't already there).// basic: wave — friendly send-off for the free plan// pro: av-celebrating — "yes! great choice"@@ -493,34 +450,14 @@});// Face camera so the next gesture reads cleanlygsap.to(avatar.rotation, { y: 0, duration: 0.25, overwrite: true });-- const settleIntoIdle = () => {- if (phase !== 'idle' || activeTier !== t) return;- setAnimation('idle', { loop: true });- // Fire any queued arrival callback (e.g. a CTA click that- // initiated this move) once the rotation tween has had- // time to face camera so the reaction doesn't start- // sideways.- if (onArrival) {- const cb = onArrival;- onArrival = null;- setTimeout(cb, 300);- }- };-- if (lastMoveKind === 'jump') {- // The superhero-jump clip already ends in a landing crouch.- // Hold its final frame briefly, then crossfade to idle. The- // render hook eases root-Y back to base during this hold- // (see rootSettleT) so the hips don't pop upright.- if (rootBone && baseRootPos) {- rootSettleStart = rootBone.position.y;- rootSettleT = 0;- }- setTimeout(settleIntoIdle, 600);- } else {- // Walking arrival — clean crossfade from walk cycle to idle.- settleIntoIdle();+ setAnimation('idle', { loop: true });+ // Fire any queued arrival callback (e.g. a CTA click that+ // initiated this move) once the rotation tween has had time+ // to face camera so the reaction doesn't start sideways.+ if (onArrival) {+ const cb = onArrival;+ onArrival = null;+ setTimeout(cb, 300);}}@@ -553,10 +490,8 @@hoverPendingTier = tierEl;hoverTimer = setTimeout(() => {hoverPendingTier = null;- if (phase === 'walking' || phase === 'jumping') {+ if (phase === 'walking') {setTimeout(() => scheduleMove(tierEl), 200);- } else if (shouldJump(activeTier, tierEl)) {- jumpToTier(tierEl);} else {walkToTier(tierEl);}@@ -604,10 +539,7 @@fireReaction();} else {onArrival = fireReaction;- if (tierEl !== activeTier) {- if (shouldJump(activeTier, tierEl)) jumpToTier(tierEl);- else walkToTier(tierEl);- }+ if (tierEl !== activeTier) walkToTier(tierEl);}});});@@ -634,15 +566,14 @@// instantly without a fetch hiccup mid-hover.// Animation clips fetched up-front so per-tier reactions can play// instantly without a network hiccup mid-interaction.- // idle — base standing pose- // walk — locomotion cycle (root X/Z pinned, parent- // transform drives travel)- // av-superhero-jump — leap + crouched landing for hops onto Pro- // wave — Basic CTA reaction- // av-celebrating — Pro CTA reaction- // av-brag-claps — Enterprise CTA reaction+ // idle — base standing pose+ // walk — locomotion cycle (root pinned, parent+ // transform drives travel)+ // wave — Basic CTA reaction+ // av-celebrating — Pro CTA reaction+ // av-brag-claps — Enterprise CTA reactionconst CLIPS = [- 'idle', 'walk', 'av-superhero-jump',+ 'idle', 'walk','wave', 'av-celebrating', 'av-brag-claps',];@@ -666,23 +597,10 @@if (rootBone) baseRootPos = rootBone.position.clone();const _r = renderer.render.bind(renderer);renderer.render = (sc, cam) => {- try {- if (rootBone && baseRootPos) {- // X/Z always pinned — our parent transform owns horizontal placement.- rootBone.position.x = baseRootPos.x;- rootBone.position.z = baseRootPos.z;- if (phase === 'jumping') {- // Let the clip's hip Y through so the leap+crouch reads.- } else if (rootSettleT >= 0 && rootSettleT < ROOT_SETTLE_S) {- // Ease from the landed-crouch hip-Y back to base.- const p = rootSettleT / ROOT_SETTLE_S;- const eased = p * p * (3 - 2 * p);- rootBone.position.y = rootSettleStart + (baseRootPos.y - rootSettleStart) * eased;- } else {- rootBone.position.y = baseRootPos.y;- }- }- } catch (_) {}+ // Pin the hips so the parent transform fully owns+ // placement — otherwise the walk clip's natural forward+ // drift carries her off the pedestal.+ try { if (rootBone && baseRootPos) rootBone.position.copy(baseRootPos); } catch (_) {}_r(sc, cam);};@@ -705,7 +623,6 @@try {const dt = Math.min(clock.getDelta(), 0.05);mixer?.update(dt);- if (rootSettleT >= 0) rootSettleT += dt;if (phase === 'walking' && avatar && walkStart && walkEnd) {walkT += dt;@@ -716,18 +633,6 @@const y = walkStart.y + (walkEnd.y - walkStart.y) * e + arc;avatar.position.set(x, y, 0);if (p >= 1) landOnTier();- } else if (phase === 'jumping' && avatar && jumpStart && jumpEnd) {- jumpT += dt;- const p = Math.min(jumpT / JUMP_S, 1);- const e = smoothstep(p);- const x = jumpStart.x + (jumpEnd.x - jumpStart.x) * e;- const arc = jumpLift * 4 * p * (1 - p);- const y = jumpStart.y + (jumpEnd.y - jumpStart.y) * e + arc;- avatar.position.set(x, y, 0);- // Subtle in-flight yaw — peaks mid-arc- const dir = Math.sign(jumpEnd.x - jumpStart.x) || 0;- avatar.rotation.y = dir * 0.22 * Math.sin(Math.PI * p);- if (p >= 1) landOnTier();}// Camera parallaxdiff --git a/scripts/verify-home-pro.mjs b/scripts/verify-home-pro.mjsdeleted file mode 100644index 81f1d9cf1..000000000--- a/scripts/verify-home-pro.mjs+++ /dev/null@@ -1,94 +0,0 @@-import { chromium } from 'playwright';--const url = 'http://localhost:3001/';-const browser = await chromium.launch();-const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } });-const page = await ctx.newPage();--const errors = [];-const warnings = [];-page.on('pageerror', (e) => errors.push(`pageerror: ${e.message}`));-page.on('console', (msg) => {- const t = msg.type();- const text = msg.text();- // Filter Vite-injected dev-only HMR/source-map noise that doesn't reflect prod.- if (text.includes('[vite]')) return;- if (t === 'error') errors.push(`console.error: ${text}`);- else if (t === 'warning') warnings.push(`console.warn: ${text}`);-});-page.on('requestfailed', (req) => {- const u = req.url();- // `/api/explore` is a Vercel function — not available in vite dev. We proxy it below,- // so any request that *does* fail is a real bug worth reporting.- errors.push(`requestfailed: ${u} -- ${req.failure()?.errorText}`);-});--// Proxy /api/* to production so dev exercises real endpoints.-await page.route('**/api/**', async (route) => {- const orig = new URL(route.request().url());- const prod = 'https://three.ws' + orig.pathname + orig.search;- try {- const r = await fetch(prod, { headers: { accept: 'application/json' } });- const body = await r.text();- await route.fulfill({- status: r.status,- headers: Object.fromEntries(r.headers.entries()),- body,- });- } catch (e) {- await route.abort();- }-});--await page.goto(url, { waitUntil: 'networkidle', timeout: 45000 });--// Capture hero-await page.screenshot({ path: '/tmp/pro-hero.png' });--// Scroll to Act 2, wait for picker hydration to complete (≥2 buttons swapped in).-const parallax = await page.$('main.home-parallax');-async function scrollTo(frac) {- await page.evaluate((f) => {- const el = document.querySelector('main.home-parallax');- if (el) el.scrollTop = Math.round(el.scrollHeight * f);- }, frac);- await page.waitForTimeout(600);-}--// Track whether the hydration fetch actually fired against /api/explore.-let exploreCalled = false;-page.on('request', (req) => {- if (req.url().includes('/api/explore')) exploreCalled = true;-});--await scrollTo(0.25);-await page.waitForTimeout(1500);-// Force-trigger Act 2 init even if IntersectionObserver fights the parallax transforms,-// so we can confirm the hydration code path independent of scroll detection.-await page.evaluate(async () => {- const canvas = document.getElementById('home-act2-canvas');- if (canvas) canvas.scrollIntoView({ block: 'center' });-});-await page.waitForTimeout(4500); // give /api/explore + featured-GLB load time--const pickerLabels = await page.evaluate(() => {- const btns = Array.from(document.querySelectorAll('.h-avatar-picker .h-av-opt'));- return btns.map((b) => b.textContent.trim());-});-console.log('explore endpoint hit:', exploreCalled);-console.log('picker after hydration:', pickerLabels);--await scrollTo(1);-await page.waitForTimeout(800);-try {- await page.screenshot({ path: '/tmp/pro-cta.png' });-} catch (e) {- console.log('screenshot at end skipped:', e.message.split('\n')[0]);-}--console.log('errors:', errors.length);-errors.forEach((e) => console.log(' -', e));-console.log('warnings:', warnings.length);--await browser.close();-process.exit(errors.length > 0 ? 1 : 0);