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
// Regression guard: the homepage must never synthesise an R2 thumbnail URL.
//
// The forge/avatar APIs already answer honestly — /api/explore returns
// `image: null` and /api/marketplace returns `thumbnail_url: null` when an
// avatar has no stored thumbnail (see api/explore.js `thumbnailUrl()`, which
// also drops legacy absolute `_og.png` keys). The homepage used to paper over
// that null by guessing `https://<bucket>.r2.dev/thumb/<avatarId>.png`.
//
// That object was never written for ~79% of public avatars, so R2 answered 404
// with a `text/plain` body. Chrome's Opaque Response Blocking then refused the
// response for an <img> request and logged net::ERR_BLOCKED_BY_ORB — five per
// homepage load, every visitor. The `.pg-avatar-initial` / `.mktplace-item-initial`
// placeholders are the designed fallback; a guessed URL defeats them.
//
// These are filesystem assertions on the page source, so they run without a browser.
//
// "The homepage" is no longer one file: its render-blocking CSS and its two big
// script blocks were extracted into cacheable assets (public/home.css,
// src/home-live-agents.js, src/home-bento.js) so the browser can cache them
// across navigations. The guard has to cover the whole surface, so it reads the
// markup and every asset the markup loads as one concatenated source.
import { describe, it, expect, beforeAll } from 'vitest';
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
const root = resolve(__dirname, '..');
const read = (p) => readFileSync(resolve(root, p), 'utf8');
// Every file that makes up the homepage surface. Adding a new extracted asset
// to pages/home.html means adding it here too, or this guard stops covering it.
const HOME_SOURCES = [
'pages/home.html',
'public/home.css',
'src/home-live-agents.js',
'src/home-bento.js',
];
describe('homepage thumbnails — no fabricated R2 URLs (ORB regression)', () => {
let home;
beforeAll(() => {
home = HOME_SOURCES.map(read).join('\n');
});
it('loads every extracted homepage asset it guards', () => {
// If an asset is renamed and this list is not updated, the concatenated
// source silently loses coverage and every assertion below passes vacuously.
const markup = read('pages/home.html');
for (const src of HOME_SOURCES.slice(1)) {
const href = '/' + src.replace(/^public\//, '');
expect(markup).toContain(href);
}
});
it('never hardcodes an r2.dev thumb/ CDN base', () => {
// The bucket's public domain belongs in S3_PUBLIC_DOMAIN and is applied
// server-side by r2.js publicUrl(). A client-side copy can only ever guess.
expect(home).not.toMatch(/r2\.dev\/thumb/);
expect(home).not.toMatch(/THUMB_CDN/);
});
it('does not build a thumb/<id>.png key on the client', () => {
expect(home).not.toMatch(/['"`]\s*\+\s*id\s*\+\s*['"`]\.png/);
expect(home).not.toMatch(/thumb\/\$\{/);
});
it('reads the avatar picker thumbnail straight off the explore feed', () => {
// `image` is the field /api/explore emits; `thumbUrl` never existed on it.
expect(home).toMatch(/thumb:\s*item\.image\s*\|\|\s*null/);
expect(home).not.toMatch(/item\.thumbUrl/);
});
it('reads the marketplace thumbnail off the documented response shape', () => {
// /api/marketplace answers { data: { items: [{ id, name, thumbnail_url }] } }.
expect(home).toMatch(/body\.data\.items/);
expect(home).toMatch(/item\.thumbnail_url/);
// The pre-fix code read `data.agents || data.items || data`, which fell through
// to the envelope object and threw on .slice() — the strip silently rendered
// nothing behind its own .catch().
expect(home).not.toMatch(/data\.agents\s*\|\|\s*data\.items\s*\|\|\s*data/);
});
it('ships an initial-letter placeholder for thumbnail-less avatars', () => {
// Both strips must degrade to a designed placeholder, not a broken <img>.
expect(home).toMatch(/\.pg-avatar-initial\s*\{/);
expect(home).toMatch(/\.mktplace-item-initial\s*\{/);
});
});