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
chore(probes): commit the CLS, model-viewer and marketplace measurement scripts
nirholas3cc57ae0528b
diff --git a/.cls-probe.mjs b/.cls-probe.mjsnew file mode 100644index 000000000..927dc63ca--- /dev/null+++ b/.cls-probe.mjs@@ -0,0 +1,30 @@+import { chromium } from 'playwright';+const url = process.argv[2];+const b = await chromium.launch({ args: ['--no-sandbox'] });+const p = await b.newPage({ viewport: { width: 1350, height: 940 } });+await p.addInitScript(() => {+ window.__shifts = [];+ new PerformanceObserver((l) => {+ for (const e of l.getEntries()) {+ if (e.hadRecentInput) continue;+ window.__shifts.push({+ value: e.value,+ t: Math.round(e.startTime),+ sources: (e.sources || []).map((s) => {+ const n = s.node;+ if (!n || !n.tagName) return '(detached)';+ return n.tagName.toLowerCase() + (n.id ? '#' + n.id : '') ++ (n.className && typeof n.className === 'string' ? '.' + n.className.trim().split(/\s+/).join('.') : '');+ }),+ });+ }+ }).observe({ type: 'layout-shift', buffered: true });+});+await p.goto(url, { waitUntil: 'load', timeout: 90000 });+await p.waitForTimeout(8000);+const shifts = await p.evaluate(() => window.__shifts);+const total = shifts.reduce((a, s) => a + s.value, 0);+console.log('URL', url, 'CLS', total.toFixed(4));+shifts.sort((a, b) => b.value - a.value).slice(0, 10)+ .forEach((s) => console.log(' ', s.value.toFixed(4), '@' + s.t + 'ms', s.sources.slice(0, 3).join(' | ').slice(0, 160)));+await b.close();diff --git a/.cls-probe2.mjs b/.cls-probe2.mjsnew file mode 100644index 000000000..65602b7c9--- /dev/null+++ b/.cls-probe2.mjs@@ -0,0 +1,29 @@+import { chromium } from 'playwright';+const b = await chromium.launch({ args: ['--no-sandbox'] });+const p = await b.newPage({ viewport: { width: 1350, height: 940 } });+await p.goto('https://three.ws/forge', { waitUntil: 'domcontentloaded', timeout: 90000 });+const snap = () => p.evaluate(() => {+ const ex = document.getElementById('examples');+ if (!ex) return null;+ const rail = ex.closest('.forge-rail') || document.body;+ const out = [];+ const walk = (el, depth) => {+ if (depth > 3) return;+ for (const c of el.children) {+ const r = c.getBoundingClientRect();+ out.push({ k: c.tagName.toLowerCase() + (c.id ? '#' + c.id : '.' + String(c.className).trim().split(/\s+/)[0]), h: Math.round(r.height), y: Math.round(r.top) });+ walk(c, depth + 1);+ }+ };+ walk(rail, 0);+ return out;+});+await p.waitForTimeout(1200); const a = await snap();+await p.waitForTimeout(7000); const c = await snap();+const am = new Map(a.map((x, i) => [x.k + '#' + i, x]));+const diffs = [];+c.forEach((x, i) => { const o = am.get(x.k + '#' + i); if (o && (o.h !== x.h)) diffs.push({ k: x.k, from: o.h, to: x.h, dy: x.h - o.h }); });+diffs.sort((x, y) => Math.abs(y.dy) - Math.abs(x.dy));+console.log('Height changes in the forge rail between 1.2s and 8.2s:');+diffs.slice(0, 15).forEach(d => console.log(' ', d.k, d.from + 'px ->' + d.to + 'px', '(' + (d.dy > 0 ? '+' : '') + d.dy + ')'));+await b.close();diff --git a/.cls-probe3.mjs b/.cls-probe3.mjsnew file mode 100644index 000000000..6c3cf5735--- /dev/null+++ b/.cls-probe3.mjs@@ -0,0 +1,23 @@+import { chromium } from 'playwright';+const b = await chromium.launch({ args: ['--no-sandbox'] });+const p = await b.newPage({ viewport: { width: 1350, height: 940 } });+await p.goto('https://three.ws/marketplace', { waitUntil: 'domcontentloaded', timeout: 90000 });+const snap = () => p.evaluate(() => {+ const out = [];+ document.querySelectorAll('body *').forEach((c) => {+ const r = c.getBoundingClientRect();+ if (!r.height && !r.width) return;+ const key = c.tagName.toLowerCase() + (c.id ? '#' + c.id : (c.className && typeof c.className === 'string' ? '.' + c.className.trim().split(/\s+/)[0] : ''));+ out.push({ key, h: Math.round(r.height), y: Math.round(r.top) });+ });+ return out;+});+await p.waitForTimeout(1200); const a = await snap();+await p.waitForTimeout(7000); const c = await snap();+const am = new Map(); a.forEach((x, i) => am.set(i, x));+const grew = [];+c.forEach((x, i) => { const o = am.get(i); if (o && o.key === x.key && o.h !== x.h) grew.push({ key: x.key, from: o.h, to: x.h, dy: x.h - o.h, y: o.y }); });+grew.sort((x, y) => Math.abs(y.dy) - Math.abs(x.dy));+console.log('Elements whose height changed between 1.2s and 8.2s (top 20):');+grew.slice(0, 20).forEach(d => console.log(' y=' + d.y, d.key, d.from + '->' + d.to, (d.dy > 0 ? '+' : '') + d.dy));+await b.close();diff --git a/.cls-probe4.mjs b/.cls-probe4.mjsnew file mode 100644index 000000000..1d3db98dd--- /dev/null+++ b/.cls-probe4.mjs@@ -0,0 +1,23 @@+import { chromium } from 'playwright';+const b = await chromium.launch({ args: ['--no-sandbox'] });+const p = await b.newPage({ viewport: { width: 1350, height: 940 } });+await p.goto('https://three.ws/forge', { waitUntil: 'domcontentloaded', timeout: 90000 });+const snap = () => p.evaluate(() => {+ const ex = document.getElementById('examples');+ const cs = getComputedStyle(ex);+ return {+ h: Math.round(ex.getBoundingClientRect().height),+ n: ex.children.length,+ font: cs.fontFamily,+ labels: [...ex.children].map(c => c.textContent.trim().slice(0, 34)),+ widths: [...ex.children].map(c => Math.round(c.getBoundingClientRect().width)),+ fontsReady: document.fonts.status,+ };+});+await p.waitForTimeout(1200); const a = await snap();+await p.waitForTimeout(7000); const c = await snap();+console.log('T=1.2s h=' + a.h, 'chips=' + a.n, 'fonts=' + a.fontsReady);+a.labels.forEach((l, i) => console.log(' ', String(a.widths[i]).padStart(4), l));+console.log('T=8.2s h=' + c.h, 'chips=' + c.n, 'fonts=' + c.fontsReady);+c.labels.forEach((l, i) => console.log(' ', String(c.widths[i]).padStart(4), l));+await b.close();diff --git a/.grow-probe.mjs b/.grow-probe.mjsnew file mode 100644index 000000000..5da1889b0--- /dev/null+++ b/.grow-probe.mjs@@ -0,0 +1,15 @@+import { chromium } from 'playwright';+const ids = process.argv.slice(3);+const b = await chromium.launch({ args: ['--no-sandbox'] });+const p = await b.newPage({ viewport: { width: 1350, height: 940 } });+await p.goto(process.argv[2], { waitUntil: 'domcontentloaded', timeout: 90000 });+const snap = () => p.evaluate((ids) => Object.fromEntries(ids.map((id) => {+ const el = document.getElementById(id);+ if (!el) return [id, 'missing'];+ const r = el.getBoundingClientRect();+ return [id, { h: Math.round(r.height), hidden: el.hidden, kids: el.children.length }];+})), ids);+await p.waitForTimeout(400); const t0 = await snap();+await p.waitForTimeout(9000); const t1 = await snap();+for (const id of ids) console.log(id.padEnd(24), JSON.stringify(t0[id]), '->', JSON.stringify(t1[id]));+await b.close();diff --git a/.grow2.mjs b/.grow2.mjsnew file mode 100644index 000000000..993139572--- /dev/null+++ b/.grow2.mjs@@ -0,0 +1,28 @@+import { chromium } from 'playwright';+const b = await chromium.launch({ args: ['--no-sandbox'] });+const p = await b.newPage({ viewport: { width: 1350, height: 940 } });+await p.goto('https://three.ws/marketplace', { waitUntil: 'domcontentloaded', timeout: 90000 });+// Everything that sits above #market-grid in document order, keyed by a stable path.+const snap = () => p.evaluate(() => {+ const grid = document.getElementById('market-grid');+ const out = {};+ const key = (el) => el.tagName.toLowerCase() + (el.id ? '#' + el.id : (typeof el.className === 'string' && el.className ? '.' + el.className.trim().split(/\s+/)[0] : ''));+ document.querySelectorAll('body > *, main > *, main > * > *').forEach((el) => {+ if (grid && (el.compareDocumentPosition(grid) & Node.DOCUMENT_POSITION_FOLLOWING) === 0) return;+ const r = el.getBoundingClientRect();+ out[key(el)] = Math.round(r.height);+ });+ out['@gridTop'] = grid ? Math.round(grid.getBoundingClientRect().top + scrollY) : -1;+ return out;+});+const times = [400, 1500, 3000, 6000, 9000];+const snaps = [];+let prev = 0;+for (const t of times) { await p.waitForTimeout(t - prev); prev = t; snaps.push(await snap()); }+const keys = [...new Set(snaps.flatMap(Object.keys))];+for (const k of keys) {+ const row = snaps.map(s => s[k] === undefined ? '-' : s[k]);+ if (new Set(row).size > 1) console.log(k.padEnd(34), row.join(' -> '));+}+console.log('\n(columns = ' + times.map(t => t + 'ms').join(', ') + ')');+await b.close();diff --git a/.mkt-prod.mjs b/.mkt-prod.mjsnew file mode 100644index 000000000..38ecec711--- /dev/null+++ b/.mkt-prod.mjs@@ -0,0 +1,11 @@+import { chromium } from 'playwright';+const b = await chromium.launch({ args: ['--no-sandbox'] });+const p = await b.newPage({ viewport: { width: 1350, height: 940 } });+await p.goto(process.argv[2] + '/marketplace', { waitUntil: 'load', timeout: 90000 });+await p.waitForTimeout(3000);+const st = await p.evaluate(() => [...document.querySelectorAll('.market-hero-slide')].map(s => {+ const mv = s.querySelector('model-viewer');+ return (mv?.getAttribute('src') ? 'src' : mv?.dataset.src ? 'deferred' : 'none');+}));+console.log(process.argv[2], 'hero slides:', JSON.stringify(st));+await b.close();diff --git a/.mkt-verify.mjs b/.mkt-verify.mjsnew file mode 100644index 000000000..d4a638e36--- /dev/null+++ b/.mkt-verify.mjs@@ -0,0 +1,28 @@+import { chromium } from 'playwright';+const base = process.argv[2];+const b = await chromium.launch({ args: ['--no-sandbox'] });+const p = await b.newPage({ viewport: { width: 1350, height: 940 } });+// Real marketplace data from production, local build under test.+for (const pat of ['**/api/marketplace/**', '**/api/avatars/**', '**/api/explore*']) {+ await p.route(pat, async (route) => {+ const u = new URL(route.request().url());+ try {+ const r = await fetch('https://three.ws' + u.pathname + u.search);+ route.fulfill({ status: r.status, contentType: r.headers.get('content-type') || 'application/json', body: await r.text() });+ } catch { route.abort(); }+ });+}+const glb = [];+p.on('request', (r) => { if (r.url().includes('.glb')) glb.push(r.url()); });+await p.goto(base + '/marketplace', { waitUntil: 'load', timeout: 90000 });+await p.waitForTimeout(3000);+const st = await p.evaluate(() => {+ const slides = [...document.querySelectorAll('.market-hero-slide')];+ return {+ heroSlides: slides.length,+ heroWithSrc: slides.filter(s => s.querySelector('model-viewer')?.getAttribute('src')).length,+ heroDeferred: slides.filter(s => s.querySelector('model-viewer')?.dataset.src).length,+ };+});+console.log(base, JSON.stringify(st), 'glbRequests=' + glb.length);+await b.close();diff --git a/.mkt-verify2.mjs b/.mkt-verify2.mjsnew file mode 100644index 000000000..8d8f05741--- /dev/null+++ b/.mkt-verify2.mjs@@ -0,0 +1,21 @@+import { chromium } from 'playwright';+const b = await chromium.launch({ args: ['--no-sandbox'] });+const p = await b.newPage({ viewport: { width: 1350, height: 940 } });+for (const pat of ['**/api/marketplace/**', '**/api/avatars/**', '**/api/explore*']) {+ await p.route(pat, async (route) => {+ const u = new URL(route.request().url());+ try { const r = await fetch('https://three.ws' + u.pathname + u.search);+ route.fulfill({ status: r.status, contentType: r.headers.get('content-type') || 'application/json', body: await r.text() });+ } catch { route.abort(); }+ });+}+await p.goto('http://127.0.0.1:8099/marketplace', { waitUntil: 'load', timeout: 90000 });+for (const t of [1500, 3000]) {+ await p.waitForTimeout(t === 1500 ? 1500 : 1500);+ const st = await p.evaluate(() => [...document.querySelectorAll('.market-hero-slide')].map(s => {+ const mv = s.querySelector('model-viewer');+ return { slot: s.dataset.slot, active: s.classList.contains('active'), src: !!mv?.getAttribute('src'), dataSrc: !!mv?.dataset.src, rotate: mv?.hasAttribute('auto-rotate') };+ }));+ console.log('t=' + t + 'ms', JSON.stringify(st));+}+await b.close();diff --git a/.mv-probe.mjs b/.mv-probe.mjsnew file mode 100644index 000000000..dc3843dff--- /dev/null+++ b/.mv-probe.mjs@@ -0,0 +1,20 @@+import { chromium } from 'playwright';+const url = process.argv[2];+const b = await chromium.launch({ args: ['--no-sandbox'] });+const p = await b.newPage({ viewport: { width: 1350, height: 940 } });+await p.goto(url, { waitUntil: 'load', timeout: 90000 });+await p.waitForTimeout(6000);+const r = await p.evaluate(() => {+ const mvs = [...document.querySelectorAll('model-viewer')];+ const vh = innerHeight;+ return {+ total: mvs.length,+ inViewport: mvs.filter(m => { const r = m.getBoundingClientRect(); return r.top < vh && r.bottom > 0; }).length,+ withSrc: mvs.filter(m => m.getAttribute('src')).length,+ withDataSrc: mvs.filter(m => m.dataset.src).length,+ canvases: document.querySelectorAll('canvas').length,+ domNodes: document.querySelectorAll('*').length,+ };+});+console.log(url, JSON.stringify(r, null, 1));+await b.close();diff --git a/.req-probe.mjs b/.req-probe.mjsnew file mode 100644index 000000000..2ff7621c1--- /dev/null+++ b/.req-probe.mjs@@ -0,0 +1,19 @@+import { chromium } from 'playwright';+const url = process.argv[2];+const watch = process.argv.slice(3);+const b = await chromium.launch({ args: ['--no-sandbox'] });+const p = await b.newPage({ viewport: { width: 1350, height: 940 } });+const reqs = [];+p.on('request', (r) => reqs.push(r.url()));+await p.goto(url, { waitUntil: 'load', timeout: 90000 });+await p.waitForTimeout(6000);+const atLoad = reqs.length;+console.log('--- at load+6s ---');+for (const w of watch) console.log(' ', reqs.some(u => u.includes(w)) ? 'LOADED ' : 'deferred', w);+console.log(' total requests:', atLoad);+await p.evaluate(() => window.scrollTo(0, document.body.scrollHeight));+await p.waitForTimeout(6000);+console.log('--- after scrolling to bottom ---');+for (const w of watch) console.log(' ', reqs.some(u => u.includes(w)) ? 'LOADED ' : 'MISSING ', w);+console.log(' total requests:', reqs.length);+await b.close();diff --git a/.req-probe2.mjs b/.req-probe2.mjsnew file mode 100644index 000000000..c8822aa03--- /dev/null+++ b/.req-probe2.mjs@@ -0,0 +1,27 @@+import { chromium } from 'playwright';+const url = process.argv[2];+const watch = process.argv.slice(3);+const b = await chromium.launch({ args: ['--no-sandbox'] });+const p = await b.newPage({ viewport: { width: 1350, height: 940 } });+const reqs = [];+p.on('request', (r) => reqs.push(r.url()));+await p.goto(url, { waitUntil: 'load', timeout: 90000 });+await p.waitForTimeout(5000);+const report = (label) => {+ console.log('---', label, '(requests:', reqs.length + ')');+ for (const w of watch) console.log(' ', reqs.some(u => u.includes(w)) ? 'LOADED ' : 'deferred', w);+};+report('at load+5s');+// Progressive scroll, the way a human reads the page.+for (let i = 0; i < 40; i++) {+ await p.evaluate(() => window.scrollBy(0, innerHeight * 0.9));+ await p.waitForTimeout(350);+}+await p.waitForTimeout(4000);+report('after progressive scroll to bottom');+const vis = await p.evaluate(() => {+ const g = (id) => { const e = document.getElementById(id); if (!e) return 'absent'; const r = e.getBoundingClientRect(); return { h: Math.round(r.height), hidden: e.hidden, display: getComputedStyle(e).display }; };+ return { dragon: g('dragon-canvas-wrap'), community: g('home-community-forge') };+});+console.log('section state:', JSON.stringify(vis));+await b.close();diff --git a/.req-probe3.mjs b/.req-probe3.mjsnew file mode 100644index 000000000..c54592939--- /dev/null+++ b/.req-probe3.mjs@@ -0,0 +1,33 @@+import { chromium } from 'playwright';+const b = await chromium.launch({ args: ['--no-sandbox'] });+const p = await b.newPage({ viewport: { width: 1350, height: 940 } });+// Serve the LOCAL build, but answer its data calls from production so the+// community strip has the same real feed the deployed page sees.+await p.route('**/api/forge-gallery*', async (route) => {+ const u = new URL(route.request().url());+ const r = await fetch('https://three.ws' + u.pathname + u.search);+ route.fulfill({ status: r.status, contentType: 'application/json', body: await r.text() });+});+const reqs = [];+p.on('request', (r) => reqs.push(r.url()));+const has = (w) => reqs.some(u => u.includes(w));+await p.goto('http://127.0.0.1:8099/', { waitUntil: 'load', timeout: 90000 });+await p.waitForTimeout(5000);+console.log('at load+5s: model-viewer.min.js =', has('model-viewer.min.js') ? 'LOADED' : 'deferred',+ '| GLB fetches =', reqs.filter(u => u.endsWith('.glb')).length);+const st = await p.evaluate(() => {+ const s = document.getElementById('home-community-forge');+ const t = document.getElementById('hcf-track');+ return { hidden: s?.hidden, cards: t?.children.length, posters: document.querySelectorAll('.hcf-poster').length, viewers: t?.querySelectorAll('model-viewer').length };+});+console.log('strip state at load:', JSON.stringify(st));+// Scroll the strip into view.+await p.evaluate(() => document.getElementById('home-community-forge')?.scrollIntoView());+await p.waitForTimeout(6000);+console.log('after scrolling to strip: model-viewer.min.js =', has('model-viewer.min.js') ? 'LOADED' : 'deferred');+const st2 = await p.evaluate(() => {+ const t = document.getElementById('hcf-track');+ return { cards: t?.children.length, posters: document.querySelectorAll('.hcf-poster').length, viewers: t?.querySelectorAll('model-viewer').length };+});+console.log('strip state after:', JSON.stringify(st2));+await b.close();diff --git a/.req-probe4.mjs b/.req-probe4.mjsnew file mode 100644index 000000000..ca34657c2--- /dev/null+++ b/.req-probe4.mjs@@ -0,0 +1,24 @@+import { chromium } from 'playwright';+const b = await chromium.launch({ args: ['--no-sandbox'] });+const p = await b.newPage({ viewport: { width: 1350, height: 940 } });+await p.route('**/api/forge-gallery*', async (route) => {+ const u = new URL(route.request().url());+ const r = await fetch('https://three.ws' + u.pathname + u.search);+ route.fulfill({ status: r.status, contentType: 'application/json', body: await r.text() });+});+p.on('console', (m) => { if (m.type() === 'error') console.log(' [console.error]', m.text().slice(0, 160)); });+p.on('pageerror', (e) => console.log(' [pageerror]', String(e).slice(0, 200)));+await p.goto('http://127.0.0.1:8099/', { waitUntil: 'load', timeout: 90000 });+await p.waitForTimeout(4000);+const info = await p.evaluate(() => {+ const s = document.getElementById('home-community-forge');+ const r = s.getBoundingClientRect();+ const chain = [];+ for (let e = s; e && e !== document.body; e = e.parentElement) {+ const cs = getComputedStyle(e);+ chain.push(e.tagName.toLowerCase() + (e.id ? '#' + e.id : '.' + String(e.className).trim().split(/\s+/)[0]) + ' display=' + cs.display + ' vis=' + cs.visibility + ' h=' + Math.round(e.getBoundingClientRect().height));+ }+ return { rect: { top: Math.round(r.top), h: Math.round(r.height) }, chain, liteClass: document.documentElement.className };+});+console.log(JSON.stringify(info, null, 1));+await b.close();diff --git a/.req-probe5.mjs b/.req-probe5.mjsnew file mode 100644index 000000000..334085d52--- /dev/null+++ b/.req-probe5.mjs@@ -0,0 +1,26 @@+import { chromium } from 'playwright';+const b = await chromium.launch({ args: ['--no-sandbox'] });+const p = await b.newPage({ viewport: { width: 1350, height: 940 } });+await p.route('**/api/forge-gallery*', async (route) => {+ const u = new URL(route.request().url());+ const r = await fetch('https://three.ws' + u.pathname + u.search);+ route.fulfill({ status: r.status, contentType: 'application/json', body: await r.text() });+});+const reqs = [];+p.on('request', (r) => reqs.push(r.url()));+await p.goto('http://127.0.0.1:8099/', { waitUntil: 'load', timeout: 90000 });+await p.waitForTimeout(4000);+await p.evaluate(() => {+ const s = document.getElementById('home-community-forge');+ window.scrollTo({ top: s.getBoundingClientRect().top + scrollY - 200, behavior: 'instant' });+});+await p.waitForTimeout(7000);+const st = await p.evaluate(() => {+ const s = document.getElementById('home-community-forge');+ const r = s.getBoundingClientRect();+ const t = document.getElementById('hcf-track');+ return { scrollY: Math.round(scrollY), sectionTop: Math.round(r.top), viewers: t.querySelectorAll('model-viewer').length, posters: document.querySelectorAll('.hcf-poster').length };+});+console.log('mv bundle requested:', reqs.some(u => u.includes('model-viewer.min.js')));+console.log(JSON.stringify(st));+await b.close();