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(dev): serve <agent-3d> from the published bundle when dist-lib is unbuilt
nirholas3bc6212fc0b4
diff --git a/tests/e2e/crews-hq.spec.js b/tests/e2e/crews-hq.spec.jsindex 28c6032cf..2d8a38e25 100644--- a/tests/e2e/crews-hq.spec.js+++ b/tests/e2e/crews-hq.spec.js@@ -15,7 +15,9 @@// figures already standing.//// The crew data is live, so every assertion is about structure and behaviour-// rather than a particular crew being present.+// rather than a particular crew being present. The one exception is the clean+// console check, which answers its two reads itself: an error printed because+// production was briefly unwell would fail it for a reason that is not the page.import { test, expect } from '@playwright/test';@@ -34,6 +36,20 @@ async function pollNow(page) {await page.waitForTimeout(2500);}+// One crew in the shape GET /api/crews/directory answers. Synthetic, so the+// clean-console check measures the page and not whatever production's crew+// service happens to be doing during the run.+const DIRECTORY_CREW = {+ tag: 'E2EQA',+ name: 'Synthetic QA Crew',+ createdAt: '2026-08-07T09:49:21.138Z',+ memberCount: 2,+ faces: [+ { id: 'e2e-face-1', name: 'QA One', username: 'qa-one', avatarUrl: null },+ { id: 'e2e-face-2', name: 'QA Two', username: 'qa-two', avatarUrl: null },+ ],+};+test('/crews serves a signed-out visitor the directory with a clean console', async ({ page }) => {const errors = [];page.on('console', (m) => {@@ -41,6 +57,10 @@ test('/crews serves a signed-out visitor the directory with a clean console', as// not forwarded; that is the harness, not the page.if (m.type() === 'error' && !/websocket/i.test(m.text())) errors.push(m.text());});+ // The two reads a signed-out first paint makes, answered at the network seam+ // the way production answers an anonymous visitor.+ await page.route('**/api/auth/me', (r) => r.fulfill({ json: { user: null } }));+ await page.route('**/api/crews/directory**', (r) => r.fulfill({ json: { data: { crews: [DIRECTORY_CREW] } } }));await page.goto('/crews', { waitUntil: 'domcontentloaded', timeout: 60_000 });await expect(page.locator('h1')).toHaveText('Crew HQ');@@ -49,6 +69,7 @@ test('/crews serves a signed-out visitor the directory with a clean console', asawait expect(page.locator('#cw-found-panel')).toBeHidden();await expect(page.locator('#cw-dir-panel')).toBeVisible();await page.waitForFunction(() => !/Loading crews/.test(document.getElementById('cw-dir').textContent));+ await expect(page.locator(`.cw-dir-card[href="/crews/${DIRECTORY_CREW.tag}"]`)).toContainText(DIRECTORY_CREW.name);expect(errors, `console errors on a public page: ${errors.join(' | ')}`).toEqual([]);});diff --git a/vite.config.js b/vite.config.jsindex 3032c479e..2bfbeb1f3 100644--- a/vite.config.js+++ b/vite.config.js@@ -1415,15 +1415,29 @@ const appConfig = {js: resolve(__dirname, 'dist-lib/agent-3d.js'),'umd.cjs': resolve(__dirname, 'dist-lib/agent-3d.umd.cjs'),};+ let warnedMissing = false;server.middlewares.use((req, res, next) => {const path = (req.url || '').split('?')[0];const m = /^\/agent-3d\/[^/]+\/agent-3d\.(js|umd\.cjs)$/.exec(path);if (!m) return next();const file = libFiles[m[1]];if (!file || !existsSync(file)) {- res.statusCode = 503;- res.setHeader('content-type', 'text/plain; charset=utf-8');- return res.end('agent-3d dev bundle missing — run `npm run build:lib`');+ // A fresh clone or worktree has no dist-lib/ until someone+ // runs `npm run build:lib`. Answering 503 here left every+ // page that embeds <agent-3d> without its figures (and a red+ // console error) in dev. Fall back to the URL the page+ // asked for in the first place: the published bundle, which+ // is served with open CORS for exactly this cross-origin use.+ if (!warnedMissing) {+ warnedMissing = true;+ server.config.logger.warn(+ '[dev-local-agent-3d] dist-lib/ not built; serving <agent-3d> from https://three.ws. Run `npm run build:lib` to load local element changes.',+ );+ }+ res.statusCode = 302;+ res.setHeader('location', `https://three.ws${path}`);+ res.setHeader('cache-control', 'no-store');+ return res.end();}res.setHeader('content-type', 'text/javascript; charset=utf-8');res.setHeader('cache-control', 'no-cache');