Skip to content

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.

feat(agent-identities): serve the studio showcase from a live public feed

nirholas8e5c34b15ed3
diff --git a/api/agent-identities.js b/api/agent-identities.js
new file mode 100644
index 000000000..cffd54692
--- /dev/null
+++ b/api/agent-identities.js
@@ -0,0 +1,106 @@
+// GET /api/agent-identities: the Agent Identity Studio showcase feed.
+//
+// Serves the demo identities behind three.ws/agent-identities: real runs of the
+// production identity pipeline, recorded in data/agent-identities.json by
+// scripts/okx-identity-demo.mjs (never hand-written). The showcase page fetches
+// this at runtime instead of inlining the file at build time, so a fresh demo
+// run is live the moment the data lands, and so the price and endpoint the page
+// quotes come from the OKX catalog (api/_lib/okx-catalog.js), the single source
+// of truth for what the service actually costs.
+//
+// Public and unauthenticated: agents shopping the marketplace can read the same
+// feed to see what the studio produces before they pay for a run.
+
+import { readFile } from 'node:fs/promises';
+import path from 'node:path';
+import { cors, json, method, wrap, error } from './_lib/http.js';
+import { catalogEntry } from './_lib/okx-catalog.js';
+
+const SERVICE_ID = 'identity-studio';
+
+async function loadShowcase() {
+ const file = path.join(process.cwd(), 'data', 'agent-identities.json');
+ const parsed = JSON.parse(await readFile(file, 'utf8'));
+ return Array.isArray(parsed.identities) ? parsed.identities : [];
+}
+
+// One showcase row. `status` is what the page renders on: an entry whose
+// pipeline run has not completed yet is `pending` and carries no result, so the
+// client never has to guess from a missing field.
+function shape(identity) {
+ // A result without a PFP never made it past the render stage, so it is not a
+ // showable identity: treat it as pending rather than half-rendering it.
+ const r = identity.result?.pfp?.url ? identity.result : null;
+ const base = {
+ slug: identity.slug,
+ agentName: identity.agentName,
+ kind: identity.kind,
+ brief: identity.brief,
+ styleHints: identity.styleHints || null,
+ status: r ? 'ready' : 'pending',
+ };
+ if (!r) return base;
+ return {
+ ...base,
+ pfp: { url: r.pfp.url, previewUrl: r.pfp.preview_128_url || null, pose: r.pfp.pose || null },
+ fullBody: (r.fullBody || []).map((shot) => ({
+ url: shot.url,
+ pose: shot.pose,
+ width: shot.width,
+ height: shot.height,
+ })),
+ riggedGlbUrl: r.riggedGlbUrl,
+ viewerUrl: r.viewerUrl,
+ poseStudioUrl: r.poseStudioUrl,
+ backend: r.backend || null,
+ // scripts/okx-identity-demo.mjs only records rigVerification for a run whose
+ // GLB parsed with a real skin, so a joint count is the proof of rigging.
+ rigged: Number(r.rigVerification?.joints) > 0,
+ joints: r.rigVerification?.joints ?? null,
+ durationSeconds: r.durationSeconds ?? null,
+ completedAt: r.completedAt || null,
+ };
+}
+
+export default wrap(async (req, res) => {
+ if (cors(req, res, { methods: 'GET,OPTIONS', origins: '*' })) return;
+ if (!method(req, res, ['GET'])) return;
+
+ let identities;
+ try {
+ identities = await loadShowcase();
+ } catch (err) {
+ return error(
+ res,
+ 503,
+ 'showcase_unavailable',
+ `identity showcase data could not be read: ${err.message}`,
+ );
+ }
+
+ const entry = catalogEntry(SERVICE_ID);
+ const rows = identities.map(shape);
+
+ return json(
+ res,
+ 200,
+ {
+ service: entry
+ ? {
+ id: entry.id,
+ name: entry.name,
+ priceUsd: entry.priceUsd,
+ currency: 'USDC',
+ endpoint: entry.endpoint,
+ tool: entry.tool,
+ docs: 'https://three.ws/docs/okx-marketplace',
+ catalog: 'https://three.ws/api/okx/3d/catalog',
+ }
+ : null,
+ count: rows.length,
+ ready: rows.filter((r) => r.status === 'ready').length,
+ identities: rows,
+ },
+ { 'cache-control': 'public, s-maxage=600, stale-while-revalidate=86400' },
+ );
+});
diff --git a/docs/agent-identities.md b/docs/agent-identities.md
index 6bb2bfe75..7e3906ebd 100644
--- a/docs/agent-identities.md
+++ b/docs/agent-identities.md
@@ -126,15 +126,64 @@ When `status` is `"done"`, the same body carries a `deliverables` object with th
Two free companion endpoints round out the surface: `GET /api/okx/3d/catalog` is the machine-readable service index, and `GET /api/okx/3d/health` probes every subsystem a paid identity job passes through (generation, renderer, storage, the animation clip lane, and the payment rail) with real requests rather than a static `ok`. Both are documented in [OKX.AI Marketplace Services](./okx-marketplace.md#free-discovery-lane).
+### The showcase feed
+
+`GET /api/agent-identities` ([`api/agent-identities.js`](../api/agent-identities.js)) is a third free, public, unauthenticated endpoint: the finished work, so a buyer can see what $1.50 actually returns before spending it. It merges the demo runs in `data/agent-identities.json` with the live catalog row for `identity-studio`, so the price it quotes is the price the paid endpoint charges.
+
+```bash
+curl -s https://three.ws/api/agent-identities | jq '.service.priceUsd, .count, .identities[0].agentName'
+```
+
+```json
+{
+ "service": {
+ "id": "identity-studio",
+ "name": "Agent Identity Studio",
+ "priceUsd": "1.50",
+ "currency": "USDC",
+ "endpoint": "https://three.ws/api/okx/3d/identity-studio",
+ "tool": "create_identity",
+ "docs": "https://three.ws/docs/okx-marketplace",
+ "catalog": "https://three.ws/api/okx/3d/catalog"
+ },
+ "count": 4,
+ "ready": 4,
+ "identities": [
+ {
+ "slug": "ledgerlynx",
+ "agentName": "LedgerLynx",
+ "kind": "finance data agent",
+ "brief": "A meticulous on-chain accounting agent…",
+ "styleHints": "deep navy and silver palette…",
+ "status": "ready",
+ "pfp": { "url": "…/pfp-1024.png", "previewUrl": "…/pfp-128.png", "pose": "contrapposto" },
+ "fullBody": [{ "url": "…/fullbody-1-walk-step.png", "pose": "walk-step", "width": 1024, "height": 1280 }],
+ "riggedGlbUrl": "…glb",
+ "viewerUrl": "https://three.ws/viewer?src=…",
+ "poseStudioUrl": "https://three.ws/pose?src=…",
+ "backend": "trellis_selfhost",
+ "rigged": true,
+ "joints": 52,
+ "durationSeconds": 501,
+ "completedAt": "2026-07-09T23:45:26.807Z"
+ }
+ ]
+}
+```
+
+`status` is `ready` or `pending`: an entry whose pipeline run has not completed carries the brief but no deliverables, and the showcase page renders it as such rather than guessing from a missing field. Responses are cached at the edge for 10 minutes.
+
Prices, descriptions, and input schemas are not written twice: [`api/_lib/okx-catalog.js`](../api/_lib/okx-catalog.js) is the single source of truth that the tool definitions, the catalog endpoint, and the marketplace listing all read.
## The showcase page
[/agent-identities](https://three.ws/agent-identities) renders the demo identities in [`data/agent-identities.json`](../data/agent-identities.json). Every entry there is a **real run of the production pipeline**, the same module the endpoint executes, driven locally by [`scripts/okx-identity-demo.mjs`](../scripts/okx-identity-demo.mjs), which writes the results back into the JSON file. Nothing on that page is a mock or a hand-picked asset.
+The page reads that data over the network from `/api/agent-identities` (above) rather than inlining it at build time, which buys three things: a fresh demo run is live as soon as the data lands instead of at the next frontend build, the price chip in the hero comes from the catalog instead of page copy that can drift, and the grid has a real loading, error, and empty state to design for. While the feed is in flight the grid shows shimmering skeleton cards; a failed fetch renders an actionable panel with a working retry (the docs and catalog links stay reachable because they are static); an empty feed says so and points at the service instead of leaving a void.
+
The script does not take the pipeline's word for it either. It downloads the finished GLB, parses its JSON chunk, and asserts real rigging: at least one skin, at least 10 joints in total, and at least one mesh primitive carrying both `JOINTS_0` and `WEIGHTS_0`. A run that fails that check is recorded as failed rather than shipped as a success. The verified numbers (byte size, skins, joints, skinned primitives, glTF generator) are stored per identity alongside the wall-clock duration and completion timestamp.
-Each card ([`src/agent-identities.js`](../src/agent-identities.js)) shows the full-body hero shot with the PFP crop pinned over it, thumbnail buttons to switch poses (with `aria-pressed` tracking the active one), and a "View in 3D" action that lazy-loads `model-viewer` and swaps the still for the orbitable rigged GLB. The 3D runtime is only fetched when someone asks for it, never on page load. An entry without a completed run renders an honest "still in the studio" state instead of a broken card.
+Each card ([`src/agent-identities.js`](../src/agent-identities.js)) shows the full-body hero shot with the PFP crop pinned over it, thumbnail buttons to switch poses (with `aria-pressed` tracking the active one), a verified-rig line (joint count, pipeline duration, render count), and a "View in 3D" action that lazy-loads `model-viewer` and swaps the still for the orbitable rigged GLB. The 3D runtime is only fetched when someone asks for it, never on page load. "View in 3D" is a real toggle: it turns into "Back to renders" and restores the still, and switching poses closes the viewer too, so the button label and the stage can never disagree. The GLB is a large network fetch, so the viewer shows a spinner until `model-viewer` reports `load` and falls back to a link into the full viewer if it errors. An entry without a completed run renders an honest "still in the studio" state instead of a broken card, and a render whose object 404s is replaced by a labelled notice rather than a broken-image glyph.
To regenerate or add a demo identity, add the entry (slug, kind, agent name, brief, style hints) and run the script. It needs the object-storage credentials from your local env; generation, rigging, and rendering all run against the deployed surfaces.
diff --git a/pages/agent-identities.html b/pages/agent-identities.html
index 42c7611c4..681377430 100644
--- a/pages/agent-identities.html
+++ b/pages/agent-identities.html
@@ -27,6 +27,11 @@
max-width: 1160px;
margin: 0 auto;
padding: calc(var(--header-h, 64px) + var(--space-xl)) var(--space-lg) var(--space-2xl);
+ /* The body is a column flex container, so this main is a flex item with
+ min-width:auto: its min-content width (a couple of pixels over 320)
+ was widening the whole document and scrolling the page sideways on a
+ 320px screen. Nothing inside needs more than the viewport. */
+ min-width: 0;
}
.ai-hero {
max-width: 720px;
@@ -61,9 +66,14 @@
padding: 2px 10px;
margin-bottom: var(--space-sm);
}
+ .ai-price {
+ color: var(--accent);
+ }
.ai-grid {
display: grid;
- grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
+ /* min() keeps the track from forcing a 300px column (and a horizontally
+ scrolling page) inside a ~288px viewport at 320px wide. */
+ grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
gap: var(--space-lg);
}
.ai-card {
@@ -107,11 +117,64 @@
.ai-pending {
display: grid;
place-items: center;
+ align-content: center;
+ gap: var(--space-2xs);
color: var(--ink-dim);
font-size: var(--text-sm);
text-align: center;
padding: var(--space-lg);
}
+ .ai-pending strong {
+ color: var(--ink);
+ font-family: var(--font-display);
+ }
+ .ai-3d-status {
+ position: absolute;
+ left: var(--space-sm);
+ right: var(--space-sm);
+ bottom: var(--space-sm);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ gap: 0.6ch;
+ flex-wrap: wrap;
+ padding: 8px 10px;
+ border-radius: var(--radius-control);
+ border: 1px solid var(--stroke);
+ background: rgba(10, 12, 16, 0.82);
+ backdrop-filter: blur(6px);
+ color: var(--ink-dim);
+ font-size: var(--text-xs);
+ font-family: var(--font-mono);
+ text-align: center;
+ }
+ .ai-3d-status a {
+ color: var(--accent);
+ }
+ .ai-3d-error {
+ border-color: var(--danger, #ff6b6b);
+ }
+ .ai-spinner {
+ width: 12px;
+ height: 12px;
+ border-radius: 50%;
+ border: 2px solid var(--stroke-strong);
+ border-top-color: var(--accent);
+ animation: ai-spin 0.8s linear infinite;
+ }
+ @keyframes ai-spin {
+ to {
+ transform: rotate(360deg);
+ }
+ }
+ @media (prefers-reduced-motion: reduce) {
+ .ai-spinner {
+ animation-duration: 2.4s;
+ }
+ .ai-skel {
+ animation: none;
+ }
+ }
.ai-pfp {
position: absolute;
left: var(--space-sm);
@@ -212,12 +275,91 @@
border-color: var(--accent);
background: var(--surface-3);
}
+ .ai-meta {
+ font-family: var(--font-mono);
+ font-size: var(--text-2xs);
+ color: var(--ink-dim);
+ margin: 0;
+ }
+ .ai-skel {
+ background: linear-gradient(
+ 90deg,
+ var(--surface-2) 0%,
+ var(--surface-3) 50%,
+ var(--surface-2) 100%
+ );
+ background-size: 200% 100%;
+ animation: ai-shimmer 1.4s ease-in-out infinite;
+ border-radius: var(--radius-sm);
+ }
+ @keyframes ai-shimmer {
+ to {
+ background-position: -200% 0;
+ }
+ }
+ .ai-card-skeleton {
+ pointer-events: none;
+ }
+ .ai-card-skeleton:hover {
+ transform: none;
+ box-shadow: none;
+ }
+ .ai-skel-line {
+ display: block;
+ height: 0.75rem;
+ }
+ .ai-skel-kind {
+ width: 38%;
+ height: 0.6rem;
+ }
+ .ai-skel-name {
+ width: 62%;
+ height: 1.1rem;
+ }
+ .ai-skel-short {
+ width: 45%;
+ }
+ .ai-state {
+ grid-column: 1 / -1;
+ background: var(--surface-1);
+ border: 1px solid var(--stroke);
+ border-radius: var(--radius-card);
+ padding: var(--space-xl);
+ text-align: center;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: var(--space-sm);
+ }
+ .ai-state-title {
+ font-family: var(--font-display);
+ font-size: var(--text-lg);
+ margin: 0;
+ }
+ .ai-state-msg {
+ color: var(--ink-dim);
+ font-size: var(--text-sm);
+ line-height: var(--leading-normal);
+ max-width: 56ch;
+ margin: 0;
+ }
+ .ai-state-actions {
+ display: flex;
+ gap: var(--space-sm);
+ flex-wrap: wrap;
+ justify-content: center;
+ }
+ .ai-noscript {
+ grid-column: 1 / -1;
+ color: var(--ink-dim);
+ font-size: var(--text-sm);
+ }
.ai-how {
margin-top: var(--space-2xl);
border-top: 1px solid var(--hairline);
padding-top: var(--space-xl);
display: grid;
- grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
+ grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
gap: var(--space-lg);
}
.ai-how h2 {
@@ -272,7 +414,11 @@
<body>
<main class="ai-wrap">
<header class="ai-hero">
- <span class="ai-badge" data-i18n="agent_identities.a2mcp_service_1_50_per_identity_live">A2MCP service · $1.50 per identity · live on OKX.AI rails</span>
+ <span class="ai-badge">
+ <span data-i18n="agent_identities.a2mcp_service_live_on_okx_ai_rails">A2MCP service · live on OKX.AI rails</span>
+ <!-- Price comes from the OKX catalog at runtime, never from page copy. -->
+ <span class="ai-price" id="ai-service-price" hidden></span>
+ </span>
<h1 data-i18n="agent_identities.every_ai_agent_deserves_a_face">Every AI agent deserves a face.</h1>
<p data-i18n="agent_identities.the_agent_identity_studio_turns_a_brand">
The Agent Identity Studio turns a brand brief into a complete 3D identity: a rigged,
@@ -286,8 +432,20 @@
</div>
</header>
- <section class="ai-grid" id="identity-grid" aria-label="Demo agent identities">
- <!-- cards rendered by src/agent-identities.js -->
+ <section
+ class="ai-grid"
+ id="identity-grid"
+ aria-label="Demo agent identities"
+ aria-busy="true"
+ >
+ <!-- Cards render from /api/agent-identities via src/agent-identities.js. -->
+ <noscript>
+ <p class="ai-noscript">
+ The identity gallery renders in the browser. With JavaScript off, read the
+ <a href="/docs/okx-marketplace">service docs</a> or fetch the showcase feed at
+ <a href="/api/agent-identities">/api/agent-identities</a>.
+ </p>
+ </noscript>
</section>
<section class="ai-how">
diff --git a/src/agent-identities.js b/src/agent-identities.js
index 836684379..18af6fad3 100644
--- a/src/agent-identities.js
+++ b/src/agent-identities.js
@@ -1,14 +1,15 @@
-// /agent-identities — Agent Identity Studio showcase grid.
+// /agent-identities: Agent Identity Studio showcase grid.
//
-// Renders the demo identities from data/agent-identities.json (real pipeline
-// runs, written by scripts/okx-identity-demo.mjs). Each card: the full-body
-// hero shot with the PFP crop pinned on top, thumbnails to switch poses, and
-// a lazy "View in 3D" that swaps the image for a <model-viewer> of the rigged
-// GLB — heavy 3D loads only on request, never on page load.
-
-import data from '../data/agent-identities.json';
+// Data comes from /api/agent-identities at runtime: the demo identities are real
+// pipeline runs recorded in data/agent-identities.json, and the price + endpoint
+// chips come from the OKX catalog, so nothing on this page can drift from what
+// the service actually charges. Each card: the full-body hero shot with the PFP
+// crop pinned on top, thumbnails to switch poses, and a lazy "View in 3D" that
+// swaps the image for a <model-viewer> of the rigged GLB. Heavy 3D loads only
+// on request, never on page load.
const grid = document.getElementById('identity-grid');
+const priceChip = document.getElementById('ai-service-price');
let modelViewerLoaded = false;
function ensureModelViewer() {
@@ -31,91 +32,255 @@ function el(tag, attrs = {}, children = []) {
return node;
}
+function replaceGrid(...nodes) {
+ grid.replaceChildren(...nodes);
+}
+
+// A render that 404s (an expired object, a purged bucket) must not leave a
+// broken-image glyph in a 4:5 frame. Swap in a labelled placeholder instead.
+function onImageError(img, stage, label) {
+ img.remove();
+ if (stage.querySelector('.ai-pending')) return;
+ stage.appendChild(
+ el('div', { class: 'ai-pending' }, [
+ el('strong', { text: 'Render unavailable' }),
+ el('span', { text: `${label} is in the studio archive but its image did not load.` }),
+ ]),
+ );
+}
+
+function skeletonCard() {
+ return el('article', { class: 'ai-card ai-card-skeleton', 'aria-hidden': 'true' }, [
+ el('div', { class: 'ai-stage ai-skel' }),
+ el('div', { class: 'ai-body' }, [
+ el('span', { class: 'ai-skel ai-skel-line ai-skel-kind' }),
+ el('span', { class: 'ai-skel ai-skel-line ai-skel-name' }),
+ el('span', { class: 'ai-skel ai-skel-line' }),
+ el('span', { class: 'ai-skel ai-skel-line ai-skel-short' }),
+ ]),
+ ]);
+}
+
+function loadingState() {
+ replaceGrid(...Array.from({ length: 4 }, skeletonCard));
+ grid.setAttribute('aria-busy', 'true');
+}
+
+function panel({ title, message, actions = [] }) {
+ return el('div', { class: 'ai-state', role: 'status' }, [
+ el('h2', { class: 'ai-state-title', text: title }),
+ el('p', { class: 'ai-state-msg', text: message }),
+ ...(actions.length ? [el('div', { class: 'ai-state-actions' }, actions)] : []),
+ ]);
+}
+
+function emptyState() {
+ grid.removeAttribute('aria-busy');
+ replaceGrid(
+ panel({
+ title: 'No demo identities published yet',
+ message:
+ 'The studio is live, the showcase is not. Agents can call the service today: the catalog lists the price and the endpoint, and the docs walk through the paid MCP call end to end.',
+ actions: [
+ el('a', { class: 'btn btn-primary', href: '/docs/okx-marketplace', text: 'Read the service docs' }),
+ el('a', { class: 'btn', href: '/api/okx/3d/catalog', text: 'Service catalog (JSON)' }),
+ ],
+ }),
+ );
+}
+
+function errorState(message, retry) {
+ grid.removeAttribute('aria-busy');
+ replaceGrid(
+ panel({
+ title: 'Could not load the demo identities',
+ message: `${message} The studio itself is unaffected: the service catalog and docs are static and still reachable.`,
+ actions: [
+ el('button', { type: 'button', class: 'btn btn-primary', text: 'Try again', onclick: retry }),
+ el('a', { class: 'btn', href: '/docs/okx-marketplace', text: 'Read the service docs' }),
+ ],
+ }),
+ );
+}
+
+function pendingStage(agentName) {
+ return el('div', { class: 'ai-pending' }, [
+ el('strong', { text: 'Still in the studio' }),
+ el('span', { text: `${agentName} has no completed pipeline run yet. Check back soon.` }),
+ ]);
+}
+
+function metaLine(identity) {
+ const bits = [];
+ if (identity.rigged) bits.push(`rigged · ${identity.joints} joints`);
+ if (identity.durationSeconds) bits.push(`${Math.round(identity.durationSeconds / 60)} min to done`);
+ if (identity.fullBody?.length) bits.push(`${identity.fullBody.length + 1} renders`);
+ return bits.length ? el('p', { class: 'ai-meta', text: bits.join(' · ') }) : null;
+}
+
function card(identity) {
- const { agentName, kind, brief, result } = identity;
+ const { agentName, kind, brief, status } = identity;
const stage = el('div', { class: 'ai-stage' });
- if (!result) {
- // Every state designed: an entry without a completed run says so instead
- // of rendering a broken card.
- stage.appendChild(
- el('div', { class: 'ai-pending', text: `${agentName} is still in the studio — check back soon.` }),
- );
- }
-
const bodyChildren = [
el('span', { class: 'ai-kind', text: kind }),
el('h2', { class: 'ai-name', text: agentName }),
el('p', { class: 'ai-brief', text: brief }),
];
- if (result) {
- const hero = el('img', {
- src: result.fullBody[0]?.url || result.pfp.url,
- alt: `${agentName} — full-body 3D render`,
- loading: 'lazy',
+ if (status !== 'ready') {
+ stage.appendChild(pendingStage(agentName));
+ return el('article', { class: 'ai-card' }, [stage, el('div', { class: 'ai-body' }, bodyChildren)]);
+ }
+
+ const hero = el('img', {
+ src: identity.fullBody[0]?.url || identity.pfp.url,
+ alt: `${agentName}, full-body 3D render`,
+ loading: 'lazy',
+ decoding: 'async',
+ onerror: () => onImageError(hero, stage, agentName),
+ });
+ stage.appendChild(hero);
+
+ const pfpImg = el('img', {
+ src: identity.pfp.previewUrl || identity.pfp.url,
+ alt: `${agentName} profile picture crop`,
+ loading: 'lazy',
+ decoding: 'async',
+ onerror: () => pfpImg.closest('.ai-pfp')?.remove(),
+ });
+ stage.appendChild(el('div', { class: 'ai-pfp' }, [pfpImg]));
+
+ const view3d = el('button', {
+ type: 'button',
+ class: 'ai-3d-toggle',
+ 'aria-pressed': 'false',
+ text: 'View in 3D',
+ });
+
+ // One place that tears the viewer down, so every exit (the toggle, a pose
+ // click, a load failure) leaves the button and the hero in the same state.
+ function closeViewer() {
+ stage.querySelector('model-viewer')?.remove();
+ stage.querySelector('.ai-3d-status')?.remove();
+ hero.style.opacity = '1';
+ view3d.textContent = 'View in 3D';
+ view3d.setAttribute('aria-pressed', 'false');
+ }
+
+ function openViewer() {
+ ensureModelViewer();
+ const status = el('div', { class: 'ai-3d-status', role: 'status' }, [
+ el('span', { class: 'ai-spinner', 'aria-hidden': 'true' }),
+ el('span', { text: 'Loading the rigged avatar' }),
+ ]);
+ const viewer = el('model-viewer', {
+ src: identity.riggedGlbUrl,
+ 'camera-controls': '',
+ 'touch-action': 'pan-y',
+ 'shadow-intensity': '0.6',
+ exposure: '1.05',
+ alt: `${agentName}, rigged 3D avatar`,
+ onload: () => status.remove(),
+ onerror: () => {
+ closeViewer();
+ stage.appendChild(
+ el('div', { class: 'ai-3d-status ai-3d-error', role: 'status' }, [
+ el('span', { text: 'The 3D avatar failed to load.' }),
+ el('a', { href: identity.viewerUrl, target: '_blank', rel: 'noopener', text: 'Open it in the full viewer' }),
+ ]),
+ );
+ },
});
- stage.appendChild(hero);
- stage.appendChild(
- el('div', { class: 'ai-pfp' }, [
- el('img', { src: result.pfp.url, alt: `${agentName} profile picture crop`, loading: 'lazy' }),
- ]),
- );
+ hero.style.opacity = '0';
+ stage.appendChild(viewer);
+ stage.appendChild(status);
+ view3d.textContent = 'Back to renders';
+ view3d.setAttribute('aria-pressed', 'true');
+ }
+
+ view3d.addEventListener('click', () => {
+ if (stage.querySelector('model-viewer')) closeViewer();
+ else openViewer();
+ });
- const shots = el('div', { class: 'ai-shots', role: 'group', 'aria-label': `${agentName} poses` });
- for (const shot of result.fullBody) {
- const btn = el(
- 'button',
- {
- type: 'button',
- 'aria-label': `Show ${shot.pose} pose`,
- 'aria-pressed': shot === result.fullBody[0] ? 'true' : 'false',
- onclick: () => {
- hero.src = shot.url;
- const viewer = stage.querySelector('model-viewer');
- if (viewer) {
- viewer.remove();
- hero.style.opacity = '1';
- }
- shots.querySelectorAll('button').forEach((b) => b.setAttribute('aria-pressed', 'false'));
- btn.setAttribute('aria-pressed', 'true');
- },
+ const shots = el('div', { class: 'ai-shots', role: 'group', 'aria-label': `${agentName} poses` });
+ for (const shot of identity.fullBody) {
+ const btn = el(
+ 'button',
+ {
+ type: 'button',
+ 'aria-label': `Show ${shot.pose} pose`,
+ 'aria-pressed': shot === identity.fullBody[0] ? 'true' : 'false',
+ onclick: () => {
+ closeViewer();
+ hero.src = shot.url;
+ // The hero removes itself when a render 404s; a different pose is a
+ // fresh chance at a working image, so put it back and clear the notice.
+ if (!hero.isConnected) {
+ stage.querySelector('.ai-pending')?.remove();
+ stage.prepend(hero);
+ }
+ shots.querySelectorAll('button').forEach((b) => b.setAttribute('aria-pressed', 'false'));
+ btn.setAttribute('aria-pressed', 'true');
},
- [el('img', { src: shot.url, alt: '', loading: 'lazy' })],
- );
- shots.appendChild(btn);
- }
- bodyChildren.push(shots);
-
- const view3d = el('button', {
- type: 'button',
- text: 'View in 3D',
- onclick: () => {
- ensureModelViewer();
- if (stage.querySelector('model-viewer')) return;
- const viewer = el('model-viewer', {
- src: result.riggedGlbUrl,
- 'camera-controls': '',
- 'touch-action': 'pan-y',
- 'shadow-intensity': '0.6',
- exposure: '1.05',
- alt: `${agentName} rigged 3D avatar`,
- });
- hero.style.opacity = '0';
- stage.appendChild(viewer);
- view3d.textContent = 'Rotate · drag to orbit';
},
- });
- bodyChildren.push(
- el('div', { class: 'ai-actions' }, [
- view3d,
- el('a', { href: result.viewerUrl, target: '_blank', rel: 'noopener', text: 'Open in viewer' }),
- el('a', { href: result.poseStudioUrl, target: '_blank', rel: 'noopener', text: 'Pose studio' }),
- ]),
+ [
+ el('img', {
+ src: shot.url,
+ alt: '',
+ loading: 'lazy',
+ decoding: 'async',
+ onerror: (e) => e.target.closest('button')?.remove(),
+ }),
+ ],
);
+ shots.appendChild(btn);
}
+ if (shots.childElementCount) bodyChildren.push(shots);
+
+ const meta = metaLine(identity);
+ if (meta) bodyChildren.push(meta);
+
+ bodyChildren.push(
+ el('div', { class: 'ai-actions' }, [
+ view3d,
+ el('a', { href: identity.viewerUrl, target: '_blank', rel: 'noopener', text: 'Open in viewer' }),
+ el('a', { href: identity.poseStudioUrl, target: '_blank', rel: 'noopener', text: 'Pose studio' }),
+ ]),
+ );
return el('article', { class: 'ai-card' }, [stage, el('div', { class: 'ai-body' }, bodyChildren)]);
}
-for (const identity of data.identities) grid.appendChild(card(identity));
+function renderService(service) {
+ if (!priceChip || !service?.priceUsd) return;
+ priceChip.textContent = `· $${service.priceUsd} ${service.currency || 'USDC'} per identity`;
+ priceChip.hidden = false;
+}
+
+async function load() {
+ loadingState();
+ let payload;
+ try {
+ const res = await fetch('/api/agent-identities', { headers: { accept: 'application/json' } });
+ if (!res.ok) throw new Error(`the showcase feed answered HTTP ${res.status}.`);
+ payload = await res.json();
+ } catch (err) {
+ const reason = err.name === 'TypeError' ? 'The network request did not complete.' : err.message;
+ errorState(reason, load);
+ return;
+ }
+
+ renderService(payload.service);
+
+ const identities = Array.isArray(payload.identities) ? payload.identities : [];
+ if (!identities.length) {
+ emptyState();
+ return;
+ }
+ grid.removeAttribute('aria-busy');
+ replaceGrid(...identities.map(card));
+}
+
+load();