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
feat(agora): render the fundable address on a failed post and verify deep links
nirholas765d0c12243c
diff --git a/src/agora/economy-layer.js b/src/agora/economy-layer.jsindex 3a42ad69a..41dc24cbc 100644--- a/src/agora/economy-layer.js+++ b/src/agora/economy-layer.js@@ -184,6 +184,15 @@ export function mountEconomyLayer(ctx) {jobBoard.update(dt);economyFx.update(dt);},+ // The OS-level reduced-motion toggle can flip mid-session; the scaffold+ // (agora-world.js) pushes the new value to the crowd and to here so the+ // board's bob, the coin flight, the plinth spin and the ticker's enter+ // animation all stop without a reload.+ setReducedMotion(on) {+ jobBoard.setReducedMotion(on);+ economyFx.setReducedMotion(on);+ ticker.setReducedMotion(on);+ },dispose() {for (const off of offs) off?.();feed.stop();diff --git a/src/agora/humans.css.js b/src/agora/humans.css.jsindex 5098e43a0..d07ac51d9 100644--- a/src/agora/humans.css.js+++ b/src/agora/humans.css.js@@ -119,6 +119,16 @@ const HUMANS_CSS = `.agora-h-status.is-ok { color: var(--h-ok); }.agora-h-link { color: var(--h-accent); }.agora-h-muted { color: var(--h-dim); }+/* Recoverable-failure state: the address to fund, right where the error lands. */+.agora-h-fund {+ display: flex; align-items: center; gap: 6px; flex-wrap: wrap;+ margin-top: 8px; color: var(--h-text);+}+.agora-h-addr {+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px;+ background: rgba(255,255,255,0.04); border: 1px solid var(--h-border); border-radius: 6px;+ padding: 3px 6px; overflow-wrap: anywhere; user-select: all;+}/* ── Toasts ──────────────────────────────────────────────────────────────── */#agora-humans-toasts {diff --git a/src/agora/job-detail.js b/src/agora/job-detail.jsindex b69cdb848..e2bd1a6d0 100644--- a/src/agora/job-detail.js+++ b/src/agora/job-detail.js@@ -134,7 +134,15 @@ function buildJob({ opts, task, lifecycle, state, cluster }, ctx) {// The worker who produced the deliverable (for the Verify → vouch bridge):// the actor on the completion event, falling back to the claim actor.const worker = completerFromLifecycle(lifecycle, opts, cluster);- const verifySection = buildVerifySection(opts, state, worker);+ // The caller (board / passport row) usually hands us the deliverable; a deep+ // link (/agora?task=<pda>) carries only the PDA, so fall back to the proof the+ // lifecycle itself reports. Without this, arriving by URL shows "no proofHash+ // recorded" for work that is in fact verifiable.+ const proof = {+ deliverableUrl: opts.deliverableUrl || lifecycle?.deliverableUrl || null,+ proofHash: opts.proofHash || lifecycle?.proofHash || null,+ };+ const verifySection = buildVerifySection({ ...opts, ...proof }, state, worker);return [meta, facts, timeline, verifySection];}diff --git a/src/agora/post-form.js b/src/agora/post-form.jsindex 8cf60922f..3e8d9a960 100644--- a/src/agora/post-form.js+++ b/src/agora/post-form.js@@ -104,7 +104,7 @@ export function buildPostForm({ onSubmit, cluster = 'devnet', hireTarget = null,form.reset();if (hireTarget?.profession) profSelect.value = hireTarget.profession;} catch (err) {- fail(status, err?.message || 'The bounty was not posted.');+ fail(status, err?.message || 'The bounty was not posted.', err);} finally {setBusy(false);}@@ -117,9 +117,27 @@ function field(label, control) {return h('label', { class: 'agora-h-field' }, [h('span', { class: 'agora-h-field-label' }, [label]), control]);}-function fail(status, msg) {+// An error is a designed state, not a red string. A dry wallet in particular is+// recoverable, so it renders the exact address to fund next to the message.+function fail(status, msg, err) {status.className = 'agora-h-status is-error';- status.textContent = msg;+ clear(status);+ status.appendChild(h('span', {}, [msg]));+ const addr = err?.code === 'insufficient_funds' ? err?.detail?.walletAddress : null;+ if (addr) {+ status.appendChild(h('div', { class: 'agora-h-fund' }, [+ h('span', { class: 'agora-h-muted' }, ['Fund this address: ']),+ h('code', { class: 'agora-h-addr', title: addr }, [addr]),+ h('button', {+ class: 'agora-btn agora-h-btn-sm', type: 'button',+ onclick: (e) => {+ navigator.clipboard?.writeText(addr)+ .then(() => { e.target.textContent = 'Copied'; })+ .catch(() => { e.target.textContent = 'Copy failed'; });+ },+ }, ['Copy']),+ ]));+ }}function ok(status, res) {diff --git a/src/agora/ticker.js b/src/agora/ticker.jsindex 15a106af8..550e42cae 100644--- a/src/agora/ticker.js+++ b/src/agora/ticker.js@@ -165,6 +165,12 @@ export class Ticker {}}+ // Live prefers-reduced-motion change: newly prepended lines stop sliding in.+ // Anything mid-transition is left to finish rather than snapped.+ setReducedMotion(on) {+ this.reducedMotion = !!on;+ }+dispose() {this._panel?.remove();this._shown.clear();diff --git a/tests/e2e/agora-trust-surface.spec.js b/tests/e2e/agora-trust-surface.spec.jsindex efe3ac324..d8cae0083 100644--- a/tests/e2e/agora-trust-surface.spec.js+++ b/tests/e2e/agora-trust-surface.spec.js@@ -158,6 +158,85 @@ test.describe('Agora trust surface (Task 07)', () => {expect(verdict).not.toContain('is-match');});+ // The DoD's "verify a REAL deliverable" leg. The test above proves the digest+ // math against bytes we control; this one proves the whole path against an+ // artifact the platform actually produced: a real forge GLB, resolved live from+ // /api/forge-gallery, fetched over the real CDN with real CORS, hashed+ // independently in Node, then re-hashed by the browser's own Web Crypto. It also+ // covers the one claim no synthetic fixture can: a verified GLB renders inline+ // from the exact bytes that matched.+ test('real forge deliverable: ✓ against an independently-computed hash, and the verified GLB renders inline', async ({ page, request }) => {+ // Resolve a real, recent forge GLB. Prefer a small one so the browser-side+ // fetch + hash + parse stays quick; the cap is honest, not a shortcut.+ const gallery = await request.get('/api/forge-gallery?limit=24');+ expect(gallery.ok(), 'the forge gallery API should answer').toBeTruthy();+ const creations = (await gallery.json())?.creations || [];+ const candidates = creations.map((c) => c.glb_url).filter((u) => typeof u === 'string' && u.endsWith('.glb'));++ let picked = null;+ for (const url of candidates.slice(0, 12)) {+ const head = await request.head(url).catch(() => null);+ if (!head || !head.ok()) continue;+ const size = Number(head.headers()['content-length'] || 0);+ if (size > 0 && size <= 4 * 1024 * 1024 && (!picked || size < picked.size)) picked = { url, size };+ }+ // No real deliverable reachable → say so and skip. Never assert a ✓ we+ // couldn't compute from real bytes.+ test.skip(!picked, 'no reachable forge GLB in the live gallery to verify against');++ // Independent digest: computed here in Node, never by the code under test.+ const dl = await request.get(picked.url);+ expect(dl.ok(), `deliverable should download: ${picked.url}`).toBeTruthy();+ const bytes = await dl.body();+ const { createHash } = await import('node:crypto');+ const expectedHash = createHash('sha256').update(bytes).digest('hex');+ expect(bytes.subarray(0, 4).toString('latin1'), 'deliverable should be a real GLB').toBe('glTF');++ await page.goto('/agora', { waitUntil: 'domcontentloaded' });+ await page.waitForFunction(() => document.querySelector('#agora-canvas') !== null, { timeout: 60_000 });++ const out = await page.evaluate(async ({ url, proof }) => {+ const { mountVerifier } = await import('/src/agora/verify.js');+ const settle = (el, sel, ms) => new Promise((r) => {+ const iv = setInterval(() => { if (el.querySelector(sel)) { clearInterval(iv); r(true); } }, 80);+ setTimeout(() => { clearInterval(iv); r(false); }, ms);+ });+ const res = {};++ // ✓ against the real on-chain-shaped proofHash.+ const ok = document.createElement('div');+ ok.style.cssText = 'width:360px;height:260px';+ document.body.appendChild(ok);+ mountVerifier(ok, { deliverableUrl: url, proofHash: proof });+ ok.querySelector('.agora-btn-primary').click();+ await settle(ok, '.agora-verdict', 60_000);+ res.verdict = ok.querySelector('.agora-verdict')?.className || '';+ res.computed = ok.querySelector('.agora-hash.is-ok')?.textContent || '';+ // The inline viewer is lazy-loaded (three + addons) and renders to a canvas.+ res.rendered = await settle(ok, '.agora-glb-viewer canvas', 60_000);+ res.renderFail = ok.querySelector('.agora-glb-fail')?.textContent || '';++ // ✗ when the on-chain proofHash doesn't describe these bytes.+ const bad = document.createElement('div');+ document.body.appendChild(bad);+ mountVerifier(bad, { deliverableUrl: url, proofHash: proof.slice(0, -1) + (proof.slice(-1) === '0' ? '1' : '0') });+ bad.querySelector('.agora-btn-primary').click();+ await settle(bad, '.agora-verdict', 60_000);+ res.badVerdict = bad.querySelector('.agora-verdict')?.className || '';+ res.badRendered = !!bad.querySelector('.agora-glb-viewer');+ return res;+ }, { url: picked.url, proof: expectedHash });++ // The browser arrived at the same digest on its own, from the real bytes.+ expect(out.computed).toBe(expectedHash);+ expect(out.verdict).toContain('is-match');+ // A verified GLB renders inline from those exact bytes.+ expect(out.rendered, `verified GLB should render inline (${out.renderFail || 'no canvas'})`).toBe(true);+ // A mismatch is honest: ✗, and no model is shown for bytes that didn't match.+ expect(out.badVerdict).toContain('is-mismatch');+ expect(out.badRendered, 'a mismatched deliverable must not render a model').toBe(false);+ });+test('handshake: browser-derived canonical id EQUALS the deployed bridge (/api/agenc/link)', async ({ page }) => {await page.goto('/agora', { waitUntil: 'domcontentloaded' });await page.waitForFunction(() => document.querySelector('#agora-canvas') !== null, { timeout: 60_000 });