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
test(play): pin the holder-gate offline path and add a desktop audit harness
nirholas2ccc29093839
diff --git a/scripts/play-desktop-audit.mjs b/scripts/play-desktop-audit.mjsnew file mode 100644index 000000000..25b7e231c--- /dev/null+++ b/scripts/play-desktop-audit.mjs@@ -0,0 +1,73 @@+// Desktop audit pass for /play: console errors/warnings, failed requests,+// boot phase timeline, HUD presence, and an interaction sweep (open/close the+// main panels via their toolbar buttons), ending with a screenshot.+import { chromium } from 'playwright';++const TARGET = process.argv[2];+const RUN_MS = Number(process.argv[3] || 45000);+const browser = await chromium.launch({ args: ['--use-gl=swiftshader', '--enable-unsafe-swiftshader'] });+const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });+const t0 = Date.now();+const at = () => `+${((Date.now() - t0) / 1000).toFixed(1)}s`;++const issues = [];+page.on('console', (m) => {+ if (m.type() === 'error' || m.type() === 'warning') {+ const line = `[console.${m.type()}] ${m.text().slice(0, 300)}`;+ issues.push(line); console.log(at(), line);+ }+});+page.on('pageerror', (e) => { const l = `[pageerror] ${String(e).slice(0, 400)}`; issues.push(l); console.log(at(), l); });+page.on('requestfailed', (r) => {+ const l = `[reqfail] ${r.failure()?.errorText} ${r.url().slice(0, 140)}`;+ if (!/ERR_ABORTED/.test(l)) { issues.push(l); console.log(at(), l); }+});+page.on('response', (r) => { if (r.status() >= 400) { const l = `[http ${r.status()}] ${r.url().slice(0, 140)}`; issues.push(l); console.log(at(), l); } });++await page.goto(TARGET, { waitUntil: 'domcontentloaded', timeout: 60000 });+console.log(at(), 'domcontentloaded');++// Wait for the world (deep link skips lobby): loader hidden.+try {+ await page.waitForFunction(() => {+ const l = document.getElementById('kx-loading');+ return !l || l.classList.contains('kx-hidden');+ }, { timeout: 40000 });+ console.log(at(), 'loader cleared');+} catch { console.log(at(), 'LOADER NEVER CLEARED'); }++// Dismiss onboarding cards.+for (let i = 0; i < 5; i++) {+ await page.waitForTimeout(1800);+ const clicked = await page.evaluate(() => {+ const btn = [...document.querySelectorAll('button')]+ .find((b) => /^(continue|enter the world|got it|start|close|skip)$/i.test(b.textContent.trim()) && b.offsetParent);+ if (btn) { btn.click(); return btn.textContent.trim(); }+ return null;+ });+ if (clicked) console.log(at(), '[dismissed]', clicked);+}++// Inventory the visible HUD buttons, then click each one and see what happens.+const buttons = await page.evaluate(() =>+ [...document.querySelectorAll('button, [role="button"]')]+ .filter((b) => b.offsetParent)+ .map((b) => ({ label: (b.getAttribute('aria-label') || b.title || b.textContent || '').trim().slice(0, 40), cls: b.className.toString().slice(0, 60) }))+);+console.log(at(), 'visible buttons:', JSON.stringify(buttons.slice(0, 60)));++const state = await page.evaluate(() => ({+ phase: window.__CC__?.phase || null,+ canvas: !!document.getElementById('kx-canvas'),+ hud: !!document.querySelector('.cc-hud, [class*="hud"]'),+ toasts: [...document.querySelectorAll('[class*="toast"]')].map((n) => n.textContent.trim().slice(0, 80)),+}));+console.log(at(), 'state:', JSON.stringify(state));++await page.waitForTimeout(Math.max(0, RUN_MS - (Date.now() - t0)));+await page.screenshot({ path: process.env.SHOT || '/tmp/play-desktop.png' }).catch(() => {});+console.log('\n=== issue summary (' + issues.length + ') ===');+const counts = new Map();+for (const i of issues) counts.set(i.replace(/\d+/g, 'N'), (counts.get(i.replace(/\d+/g, 'N')) || 0) + 1);+for (const [k, c] of [...counts].sort((a, b) => b[1] - a[1])) console.log(' ', String(c).padStart(3), 'x', k);+await browser.close();diff --git a/tests/holder-gate-unavailable.test.js b/tests/holder-gate-unavailable.test.jsnew file mode 100644index 000000000..e219cc460--- /dev/null+++ b/tests/holder-gate-unavailable.test.js@@ -0,0 +1,58 @@+// Holder gate: the cc_unconfigured (503) path and the "enter the open world"+// action.+//+// Production returns 503 cc_unconfigured from POST /api/community/holder-pass+// whenever CC_API_KEY is not set on the deployment (api/_lib/coin-communities.js).+// The gate used to dump that upstream message ("CoinCommunities is not+// configured") into the generic error state, whose only actions (retry, switch+// wallet) can never succeed while the key is absent. These tests pin the+// designed handling: the gate routes the code to a dedicated 'unavailable'+// state, and the 'general' action continues the same entry into the open+// General world instead of bouncing the player back to the lobby.+//+// The game modules are WebGL-heavy and DOM-bound, so like crews-wiring.test.js+// this pins the wiring at source level rather than booting a renderer.+import { describe, it, expect } from 'vitest';+import { readFileSync } from 'node:fs';+import { resolve } from 'node:path';++const root = resolve(import.meta.dirname, '..');+const read = (p) => readFileSync(resolve(root, p), 'utf8');++describe('holder gate: cc_unconfigured routes to the unavailable state', () => {+ const game = read('src/game/coincommunities.js');++ it('maps the cc_unconfigured error code to the unavailable state', () => {+ expect(game).toContain("err?.code === 'cc_unconfigured'");+ expect(game).toContain("state = 'unavailable'");+ });++ it("resolves the 'general' action by closing the gate and returning the sentinel", () => {+ expect(game).toContain("if (action === 'general')");+ expect(game).toContain("return 'general'");+ });++ it('enter() downgrades the tier to general when the gate returns the sentinel', () => {+ expect(game).toContain("if (pass === 'general')");+ expect(game).toContain("tier = 'general'");+ // The downgrade needs a reassignable binding.+ expect(game).toContain("let tier = opts.tier === 'holders' ? 'holders' : 'general'");+ });+});++describe('holder gate UI: unavailable state and open-world actions', () => {+ const ui = read('src/game/coincommunities-ui.js');++ it("renders a dedicated 'unavailable' case", () => {+ expect(ui).toContain("case 'unavailable':");+ expect(ui).toContain('Holder check is offline');+ });++ it("leads with the open world via the 'general' action, not a bare cancel", () => {+ expect(ui).toContain("btn('Enter the open world', 'general', 'cc-gate-primary')");+ });++ it("the short state's open-world button fires 'general' too", () => {+ expect(ui).toContain("btn('Enter the open world instead', 'general', 'cc-gate-ghost')");+ });+});