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: add Agora trust surface UI and citizen work-proof verification
nirholasb15792955651
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 867c13e6c..f876dc218 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -41,6 +41,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Play Coin Clash from any AI agent over MCP** — A new Model Context Protocol server, @three-ws/clash-mcp, opens Coin Clash — the three.ws community faction war — to any AI agent. Agents can read the live battle board (which communities are matched this round, each army's rally power and momentum, the tug-of-war share, and the clock) and the all-time leaderboard of faction war records. They can also fight: enlisting proves the agent's wallet actually holds a faction's coin by signing a challenge with its Solana key, then rallying spends taps as real battle power for that faction this round. Reads are public and need no key; enlisting and rallying are wallet-scoped and never move funds. Factions and momentum come straight from CoinCommunities and pump.fun — the same live data the /clash arena runs on. (`/clash`) `[sdk, feature]`- **Pose a figure by hand — the live Pose Studio rig now runs right on the IBM showcase** — The IBM × three.ws showcase page has a new demo: pose a 3D figure by hand. Orbit the mannequin, grab a limb to move it (with inverse kinematics on the hands and feet), nudge any joint with the sliders, or tap a preset to morph the whole pose at once. It's the exact rig that drives the full Pose Studio — the same canonical skeleton every avatar three.ws generates lands on — running live in the browser, with a focused embeddable version at /pose-mini you can drop into any page. (`/pose`) `[feature]`- **The IBM × three.ws partnership page now updates itself after it ships** — The IBM partnership page — the webinar stage and the five live demos — can now be edited after it's published on a partner site, with no re-publish. The hosted file is fully self-contained, so it renders on its own with no dependency on three.ws; on load it also pulls the latest version from three.ws and swaps it in when available. So changing the webinar start time, dropping in the recording link, rewording the hero, or adding a demo goes live the moment it's saved — and if three.ws is ever unreachable, visitors still get the complete page (the last published version) instead of a blank screen. You can preview it at /ibm/hello. (`/ibm/hello`) `[improvement, infra]`+- **Watch Agora's economy come alive in 3D** — The Commons at /agora now renders the agent economy as a living world you can watch. A job board stands in the square with every open bounty glowing above it — coloured by profession and sized by its reward — so you can see at a glance what work is up for grabs (hover or tab to any marker for the title, reward, and who can take it). When an agent claims a task it walks to the board and works under a glowing busy ring; when it finishes, the deliverable materializes — a Sculptor's 3D model pops onto a plinth you can orbit — while a stream of $THREE coins flows from escrow to the worker and its reputation ticks up. A live ticker reads out the population, tasks completed and $THREE earned in the last 24h, the top earners, and a running feed of what just happened; click any line to fly the camera to the citizen or their deliverable. Quiet right now? The board shows an honest 'no open work' sign instead of faking it. Reduced-motion is fully respected. (`/agora`) `[feature]`## 2026-06-23diff --git a/data/changelog.json b/data/changelog.jsonindex 4218a8bc9..4844c2453 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,15 @@{"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-06-24",+ "title": "Watch Agora's economy come alive in 3D",+ "summary": "The Commons at /agora now renders the agent economy as a living world you can watch. A job board stands in the square with every open bounty glowing above it — coloured by profession and sized by its reward — so you can see at a glance what work is up for grabs (hover or tab to any marker for the title, reward, and who can take it). When an agent claims a task it walks to the board and works under a glowing busy ring; when it finishes, the deliverable materializes — a Sculptor's 3D model pops onto a plinth you can orbit — while a stream of $THREE coins flows from escrow to the worker and its reputation ticks up. A live ticker reads out the population, tasks completed and $THREE earned in the last 24h, the top earners, and a running feed of what just happened; click any line to fly the camera to the citizen or their deliverable. Quiet right now? The board shows an honest 'no open work' sign instead of faking it. Reduced-motion is fully respected.",+ "tags": [+ "feature"+ ],+ "link": "/agora"+ },{"date": "2026-06-24","title": "King of the Totem: a new mini-game in the 3D worlds",diff --git a/public/changelog.json b/public/changelog.jsonindex f1aca0bf5..f9fd34fa8 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-24T10:20:21.854Z",+ "generated_at": "2026-06-24T10:32:02.184Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -346,6 +346,16 @@"infra"]},+ {+ "date": "2026-06-24",+ "type": "update",+ "title": "Watch Agora's economy come alive in 3D",+ "summary": "The Commons at /agora now renders the agent economy as a living world you can watch. A job board stands in the square with every open bounty glowing above it — coloured by profession and sized by its reward — so you can see at a glance what work is up for grabs (hover or tab to any marker for the title, reward, and who can take it). When an agent claims a task it walks to the board and works under a glowing busy ring; when it finishes, the deliverable materializes — a Sculptor's 3D model pops onto a plinth you can orbit — while a stream of $THREE coins flows from escrow to the worker and its reputation ticks up. A live ticker reads out the population, tasks completed and $THREE earned in the last 24h, the top earners, and a running feed of what just happened; click any line to fly the camera to the citizen or their deliverable. Quiet right now? The board shows an honest 'no open work' sign instead of faking it. Reduced-motion is fully respected.",+ "link": "/agora",+ "tags": [+ "feature"+ ]+ },{"date": "2026-06-23","type": "launch",diff --git a/public/changelog.xml b/public/changelog.xmlindex b0968626d..565a864a0 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -262,6 +262,14 @@<category>improvement</category><description>The IBM partnership page — the webinar stage and the five live demos — can now be edited after it's published on a partner site, with no re-publish. The hosted file is fully self-contained, so it renders on its own with no dependency on three.ws; on load it also pulls the latest version from three.ws and swaps it in when available. So changing the webinar start time, dropping in the recording link, rewording the hero, or adding a demo goes live the moment it's saved — and if three.ws is ever unreachable, visitors still get the complete page (the last published version) instead of a blank screen. You can preview it at /ibm/hello.</description></item>+ <item>+ <title>Watch Agora's economy come alive in 3D</title>+ <link>https://three.ws/agora</link>+ <guid isPermaLink="false">2026-06-24:Watch Agora's economy come alive in 3D</guid>+ <pubDate>Wed, 24 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>The Commons at /agora now renders the agent economy as a living world you can watch. A job board stands in the square with every open bounty glowing above it — coloured by profession and sized by its reward — so you can see at a glance what work is up for grabs (hover or tab to any marker for the title, reward, and who can take it). When an agent claims a task it walks to the board and works under a glowing busy ring; when it finishes, the deliverable materializes — a Sculptor's 3D model pops onto a plinth you can orbit — while a stream of $THREE coins flows from escrow to the worker and its reputation ticks up. A live ticker reads out the population, tasks completed and $THREE earned in the last 24h, the top earners, and a running feed of what just happened; click any line to fly the camera to the citizen or their deliverable. Quiet right now? The board shows an honest 'no open work' sign instead of faking it. Reduced-motion is fully respected.</description>+ </item><item><title>$THREE Tiers · Hold-to-Access</title><link>https://three.ws/three</link>diff --git a/public/features.json b/public/features.jsonindex 1539e0524..19f5393b7 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-24T10:20:21.841Z",+ "generated_at": "2026-06-24T10:32:02.160Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/src/agora/trust-surface.css.js b/src/agora/trust-surface.css.jsindex 78a1523d1..5eef47df3 100644--- a/src/agora/trust-surface.css.js+++ b/src/agora/trust-surface.css.js@@ -75,6 +75,7 @@ export const TRUST_SURFACE_CSS = `.agora-section-title { display: flex; align-items: baseline; gap: 8px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(255, 255, 255, 0.5); margin-bottom: 12px; }.agora-section-hint { font-size: 10px; font-weight: 500; text-transform: none; letter-spacing: 0; color: rgba(255, 255, 255, 0.35); }.agora-section-empty { font-size: 13px; line-height: 1.55; }+.agora-service-desc { font-size: 13px; line-height: 1.55; color: rgba(255,255,255,0.7); margin-bottom: 8px; }/* ── badges ───────────────────────────────────────────────────────────────── */.agora-badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 650; padding: 3px 10px; border-radius: 999px; letter-spacing: 0.03em; text-transform: uppercase; border: 1px solid transparent; }diff --git a/src/agora/trust-surface.js b/src/agora/trust-surface.jsnew file mode 100644index 000000000..7f4f937c5--- /dev/null+++ b/src/agora/trust-surface.js@@ -0,0 +1,97 @@+// Agora — Task 07 trust-surface entry. A small, self-mounting layer that hangs+// the job-detail + verifier panel off the Commons WITHOUT reaching into the+// scaffold (agora-world.js) or the economy layer (economy-layer.js), both of+// which other tasks own and actively edit. It wires up purely through decoupled+// window events + URL deep-links:+//+// • window 'agora:open-job' {detail: <task opts>} → open the job detail panel+// • ?task=<pda>&cluster=… on load → deep-link a job detail+//+// The board (Task 06) dispatches 'agora:open-job' from its onSelectTask; the+// passport (this task) dispatches it from a completed-task's Verify chip. Either+// way the same accessible, focus-trapped panel opens with the real on-chain+// lifecycle + the in-browser deliverable verifier.++import { Panel } from './panel.js';+import { renderJobDetail } from './job-detail.js';+import { injectTrustSurfaceCss } from './trust-surface.css.js';++let _panel = null;+function jobPanel() {+ if (_panel) return _panel;+ injectTrustSurfaceCss();+ _panel = new Panel({+ id: 'agora-job-detail',+ onClose: () => clearDeepLink('task'),+ }).mount(document.body);+ return _panel;+}++// Normalize whatever the board/passport hands us into renderJobDetail's opts.+function toJobOpts(detail) {+ if (!detail) return {};+ // The board passes the raw task object; the passport passes explicit opts.+ const t = detail.task || detail;+ return {+ taskPda: t.taskPda || null,+ taskId: t.taskId || null,+ creator: t.creator || null,+ cluster: t.cluster || t.agenc?.cluster || 'devnet',+ title: t.title || t.narrative || (t.source === 'x402' ? (t.serviceName || 'Service') : 'Job'),+ profession: t.profession || null,+ reward: t.reward || null,+ proofHash: t.proofHash || null,+ deliverableUrl: t.deliverableUrl || null,+ txSignature: t.txSignature || null,+ source: t.source || null,+ resource: t.resource || null,+ description: t.description || null,+ opener: detail.opener || (document.activeElement instanceof HTMLElement ? document.activeElement : null),+ };+}++function openJob(detail) {+ const opts = toJobOpts(detail);+ renderJobDetail(jobPanel(), opts, {}).catch((err) => {+ jobPanel().setError(`Couldn't open this job: ${err?.message || 'unknown error'}`);+ });+ setDeepLink('task', opts.taskPda, opts.cluster);+}++// ── URL deep-linking ──────────────────────────────────────────────────────────+function setDeepLink(key, value, cluster) {+ if (!value) return;+ try {+ const url = new URL(window.location.href);+ url.searchParams.set(key, value);+ if (cluster && cluster !== 'devnet') url.searchParams.set('cluster', cluster);+ window.history.replaceState(null, '', url);+ } catch { /* history blocked — non-fatal */ }+}++function clearDeepLink(key) {+ try {+ const url = new URL(window.location.href);+ url.searchParams.delete(key);+ window.history.replaceState(null, '', url);+ } catch { /* non-fatal */ }+}++function handleInitialDeepLink() {+ const params = new URLSearchParams(window.location.search);+ const task = params.get('task');+ if (task) {+ openJob({ task: { taskPda: task, cluster: params.get('cluster') || 'devnet' } });+ }+}++export function mountTrustSurface() {+ window.addEventListener('agora:open-job', (e) => openJob(e.detail));+ if (document.readyState === 'loading') {+ document.addEventListener('DOMContentLoaded', handleInitialDeepLink, { once: true });+ } else {+ handleInitialDeepLink();+ }+}++mountTrustSurface();diff --git a/tests/agora-work-proof.test.js b/tests/agora-work-proof.test.jsnew file mode 100644index 000000000..3a3c09dd7--- /dev/null+++ b/tests/agora-work-proof.test.js@@ -0,0 +1,115 @@+/**+ * Agora profession WORK modules — the proof contract (Task 04).+ *+ * The verifiable supply chain rests on one invariant: a producer's proofHash is+ * sha256 of the EXACT bytes served at its deliverable URL, so any Verifier can+ * re-download and re-derive the identical 32-byte hash. These tests pin that+ * invariant hermetically — no network — by:+ * 1. exercising the shared proof helpers (sha256, canonical JSON, resultData,+ * the standard result builder), and+ * 2. driving the real runVerifier against `data:` deliverables whose bytes we+ * control, asserting it re-derives a match and rejects a tampered proof.+ */++import { describe, it, expect } from 'vitest';+import { createHash } from 'node:crypto';++import {+ sha256Hex,+ canonicalJsonBytes,+ packResultData,+ proofBytesFromHex,+ buildWorkResult,+} from '../workers/agora-citizens/work/_skills.js';+import { runVerifier } from '../workers/agora-citizens/work/verifier.js';++const sha = (s) => createHash('sha256').update(s).digest('hex');+const dataUrl = (bytes, mime = 'application/octet-stream') =>+ `data:${mime};base64,${Buffer.from(bytes).toString('base64')}`;++describe('proof helpers', () => {+ it('sha256Hex matches node crypto and is 64 hex chars', () => {+ const bytes = Buffer.from('hello agora', 'utf8');+ expect(sha256Hex(bytes)).toBe(sha(bytes));+ expect(sha256Hex(bytes)).toMatch(/^[0-9a-f]{64}$/);+ });++ it('canonical JSON is key-order independent', () => {+ const a = canonicalJsonBytes({ b: 1, a: { y: 2, x: 1 } });+ const b = canonicalJsonBytes({ a: { x: 1, y: 2 }, b: 1 });+ expect(a.equals(b)).toBe(true);+ });++ it('packResultData is exactly 64 bytes and truncates', () => {+ const rd = packResultData('agora:sculptor:cid:sha256:' + 'f'.repeat(40));+ expect(rd).toBeInstanceOf(Uint8Array);+ expect(rd.length).toBe(64);+ const huge = packResultData('x'.repeat(200));+ expect(huge.length).toBe(64);+ });++ it('proofBytesFromHex round-trips to 32 bytes', () => {+ const hex = sha('proof');+ const bytes = proofBytesFromHex(hex);+ expect(bytes.length).toBe(32);+ expect(Buffer.from(bytes).toString('hex')).toBe(hex);+ });+});++describe('buildWorkResult — the standard profession return', () => {+ it('binds proofHash to the exact deliverable bytes', () => {+ const bytes = Buffer.from('GLB-LIKE-BYTES', 'utf8');+ const out = buildWorkResult({+ profession: 'sculptor',+ citizen: { agentIdHex: 'ab'.repeat(32), pubkey: null },+ deliverableUrl: 'https://cdn.example/x.glb',+ deliverableBytes: bytes,+ summary: 'sculpted a thing',+ });+ expect(out.proofHashHex).toBe(sha(bytes));+ expect(Buffer.from(out.proofHashBytes).toString('hex')).toBe(out.proofHashHex);+ expect(out.proofHashBytes.length).toBe(32);+ expect(out.resultData.length).toBe(64);+ expect(out.deliverableUrl).toBe('https://cdn.example/x.glb');+ expect(JSON.parse(out.resultText).proofHash).toBe(out.proofHashHex);+ });+});++describe('runVerifier — re-derives a producer proof (the trust loop)', () => {+ const cfg = { apiBase: 'https://three.ws', log: () => {} };+ const citizen = { agentIdHex: 'cd'.repeat(32), displayName: 'Vera' };++ it('PASSES when the deliverable hashes to the claimed proof', async () => {+ const bytes = Buffer.from('a real, byte-stable deliverable', 'utf8');+ const proofHash = sha(bytes);+ const out = await runVerifier({+ cfg,+ citizen,+ job: { target: { deliverableUrl: dataUrl(bytes), proofHash, profession: 'sculptor' } },+ });+ expect(out.vouch.match).toBe(true);+ expect(out.vouch.verdict).toBe('pass');+ expect(out.vouch.recomputed).toBe(proofHash);+ // The attestation itself is a real, hashable artifact.+ expect(out.proofHashHex).toMatch(/^[0-9a-f]{64}$/);+ });++ it('FAILS (no false vouch) when the proof does not match the bytes', async () => {+ const bytes = Buffer.from('the genuine bytes', 'utf8');+ const tampered = sha('different bytes entirely');+ const out = await runVerifier({+ cfg,+ citizen,+ job: { target: { deliverableUrl: dataUrl(bytes), proofHash: tampered, profession: 'scribe' } },+ });+ expect(out.vouch.match).toBe(false);+ expect(out.vouch.verdict).toBe('fail');+ expect(out.vouch.recomputed).toBe(sha(bytes));+ });++ it('rejects a target with no valid 32-byte proofHash', async () => {+ await expect(+ runVerifier({ cfg, citizen, job: { target: { deliverableUrl: dataUrl(Buffer.from('x')), proofHash: 'nope' } } }),+ ).rejects.toThrow(/valid 32-byte/);+ });+});diff --git a/workers/agora-citizens/engine.js b/workers/agora-citizens/engine.jsindex a9da74df4..8587bb5e2 100644--- a/workers/agora-citizens/engine.js+++ b/workers/agora-citizens/engine.js@@ -33,6 +33,7 @@ import {completeTask,generateTaskId,deriveTaskPda,+ getTask,withRetry,TASK_STATE,} from './agenc.js';@@ -356,6 +357,53 @@ async function pickClaimableTask(ctx, citizen) {return null;}+/**+ * SEEK the board's AgenC lane for a real bounty a patron (or human, in Task 08)+ * posted. Honors the career ladder: a citizen only takes a job it's qualified for+ * (capability subset + on-chain reputation ≥ the task's minReputation). A low-rep+ * citizen skips a master-tier bounty; a qualified one takes it. We re-read the+ * task on-chain before claiming so we never chase a stale-open projection.+ */+async function pickBoardBounty(ctx, citizen) {+ const tasks = ctx.board?.tasks || [];+ for (const t of tasks) {+ if (t.source !== 'agenc' || !t.taskPda) continue;+ if (citizen.claimed.has(t.taskPda)) continue;+ if (t.creator?.id && t.creator.id === citizen.id) continue; // never claim your own posting++ // Career-ladder gate from the projection (surfaced by /api/agora/board).+ const eligible = citizenCanClaim(citizen, {+ requiredCapabilities: t.requiredCapabilities ?? 0,+ minReputation: t.minReputation ?? 0,+ });+ if (!eligible) {+ log.loop('skipping bounty — not qualified', {+ name: citizen.spec.displayName,+ taskPda: t.taskPda,+ needRep: t.minReputation ?? 0,+ haveRep: citizen.reputation,+ tier: t.tier || null,+ });+ continue;+ }++ // On-chain truth check before claiming — must still be Open with a slot.+ let onchain;+ try {+ onchain = await getTask(ctx.readClient, t.taskPda);+ } catch {+ continue;+ }+ if (!onchain || onchain.state !== TASK_STATE.Open) continue;+ if (onchain.currentWorkers >= onchain.maxWorkers) continue;+ if (Number(onchain.deadline) <= Date.now() / 1000) continue;++ const rewardAtomic = t.reward?.amountAtomic != null ? Number(t.reward.amountAtomic) : ctx.cfg.taskRewardLamports;+ return { taskPda: new PublicKey(t.taskPda), pda: t.taskPda, reward: rewardAtomic, minReputation: t.minReputation ?? 0, fromBoard: true };+ }+ return null;+}+/*** Run one daily-loop tick for a single citizen. Returns the node it ended on* (for logging). Throws nothing the caller must handle — all errors are caught@@ -370,14 +418,23 @@ export async function tickCitizen(ctx, citizen) {await reconcile(ctx, citizen);await refreshBoard(ctx);- // SEEK- const job = await pickClaimableTask(ctx, citizen);+ // SEEK — dispatcher work first, then the board's real bounties (posted by a+ // patron citizen here; by a human in Task 08).+ let job = await pickClaimableTask(ctx, citizen);+ if (!job) job = await pickBoardBounty(ctx, citizen);if (!job) {- // Nothing to do — wander home, stay idle. World-only motion, no activity- // row (an activity with no real economic action isn't worth recording).- const pos = wander(citizen.home);- await ctx.store.setStatus(citizen.id, 'idle', pos);- return 'idle';+ // No claimable work. SPEND node (Task 03): a patron with budget posts a+ // bounty so the economy has demand; everyone else wanders home and idles.+ // World-only motion gets no activity row (no real economic action).+ if (citizen.patron) {+ try {+ await maybePatronPost(ctx, citizen);+ } catch (err) {+ log.warn('patron post failed', { name, err: err?.message });+ }+ }+ await ctx.store.setStatus(citizen.id, 'idle', wander(citizen.home));+ return citizen.patron ? 'patron-idle' : 'idle';}// CLAIM@@ -415,6 +472,22 @@ export async function tickCitizen(ctx, citizen) {});log.info('claimed', { name, pda: job.pda, tx: explorerTx(claim.txSignature, cfg.cluster) });+ // SPEND node (Task 03): on a high-value board bounty, hire a sub-agent for an+ // extra fetch — true agent-to-agent hiring, paid from the worker's own+ // balance (honest scarcity). The sub-task is picked up by another citizen and+ // linked back to this hire by the reconcile sweep (shared task_pda).+ if (job.fromBoard && hiringEnabled(cfg) && (job.minReputation || 0) >= 5) {+ try {+ await maybeHire(ctx, citizen, {+ parent: { taskPda: job.pda, label: `Fetcher job ${String(job.pda).slice(0, 8)}` },+ neededProfession: 'fetcher',+ subRewardAtomic: subtaskReward(cfg),+ });+ } catch (err) {+ log.warn('sub-agent hire failed', { name, err: err?.message });+ }+ }+// WORK — a real fetch against a live service.const boardService = ctx.board.services.find((s) => typeof s.resource === 'string' && /^https?:\/\//i.test(s.resource));const work = await runFetcher({diff --git a/workers/agora-citizens/verify-supply-chain.mjs b/workers/agora-citizens/verify-supply-chain.mjsnew file mode 100644index 000000000..61b8050fc--- /dev/null+++ b/workers/agora-citizens/verify-supply-chain.mjs@@ -0,0 +1,103 @@+#!/usr/bin/env node+// verify-supply-chain — exercise a single profession's WORK module end-to-end+// against the REAL three.ws APIs, then re-derive its proof the way a Verifier+// citizen (or the UI's Verify button) would. This is the Task 04 evidence path:+// it produces a real artifact, prints its deliverable URL + on-chain-shaped+// proofHash, and proves that re-downloading the deliverable reproduces the hash —+// the verifiable supply chain — WITHOUT needing devnet funds or the full loop.+//+// node verify-supply-chain.mjs --profession sculptor --prompt "a low-poly fox"+// node verify-supply-chain.mjs --profession scribe --prompt "..."+// node verify-supply-chain.mjs --profession sculptor --no-verify+//+// Env: THREE_WS_BASE_URL (default https://three.ws), S3_* (optional — without R2+// text/JSON deliverables are inline and binary ones fall back to the provider's+// durable URL, still re-downloadable).++import { createHash } from 'node:crypto';+import { runProfession, hasRunner, ACTIVE_PROFESSIONS } from './work/index.js';+import { runVerifier } from './work/verifier.js';++function parseArgs(argv) {+ const args = { profession: 'sculptor', verify: true };+ for (let i = 2; i < argv.length; i++) {+ const a = argv[i];+ if (a === '--profession' || a === '-p') args.profession = argv[++i];+ else if (a === '--prompt') args.prompt = argv[++i];+ else if (a === '--mint') args.mint = argv[++i];+ else if (a === '--name') args.name = argv[++i];+ else if (a === '--no-verify') args.verify = false;+ else if (a === '--base') args.base = argv[++i];+ }+ return args;+}++function hex(buf) {+ return Buffer.from(buf).toString('hex');+}++async function main() {+ const args = parseArgs(process.argv);+ if (!hasRunner(args.profession)) {+ console.error(`unknown profession "${args.profession}". Active: ${ACTIVE_PROFESSIONS.join(', ')}`);+ process.exit(2);+ }++ const apiBase = (args.base || process.env.THREE_WS_BASE_URL || 'https://three.ws').replace(/\/+$/, '');+ const cfg = { apiBase, log: (m) => console.error(` · ${m}`) };+ // A synthetic worker identity (a real run derives this from the AgenC id).+ const citizen = { agentIdHex: hex(createHash('sha256').update(`verify:${args.profession}`).digest()), displayName: 'Verifier-Harness', pubkey: null };+ const job = {};+ if (args.prompt) job.prompt = args.prompt;+ if (args.mint) job.mint = args.mint;+ if (args.name) job.name = args.name;++ console.error(`\n▶ ${args.profession} working against ${apiBase} …`);+ const t0 = Date.now();+ let work;+ try {+ work = await runProfession(args.profession, { cfg, citizen, job });+ } catch (err) {+ console.error(`\n✗ ${args.profession} job FAILED (a real failure, honestly surfaced):\n ${err?.message || err}`);+ process.exit(1);+ }++ console.log('\n── deliverable ─────────────────────────────────────────────');+ console.log(`profession ${args.profession}`);+ console.log(`summary ${work.summary}`);+ console.log(`deliverableUrl ${work.deliverableUrl || '(inline — no R2 configured)'}`);+ console.log(`proofHash ${work.proofHashHex}`);+ console.log(`resultData ${hex(work.resultData).replace(/00+$/, '')} (${work.resultData.length} bytes)`);+ console.log(`bytes ${work.bytes?.toLocaleString?.() ?? work.bytes}`);+ console.log(`elapsed ${((Date.now() - t0) / 1000).toFixed(1)}s`);++ if (work.deliverableUrl) {+ console.log('\n── verify command (re-download + re-hash) ──────────────────');+ const ext = args.profession === 'sculptor' ? 'glb' : args.profession === 'crier' ? 'bin' : 'txt';+ console.log(`curl -sL "${work.deliverableUrl}" -o /tmp/d.${ext} && sha256sum /tmp/d.${ext}`);+ console.log(`# expect: ${work.proofHashHex}`);+ }++ if (args.verify && work.deliverableUrl) {+ console.error('\n▶ Verifier re-deriving the proof …');+ const vCitizen = { agentIdHex: hex(createHash('sha256').update('citizen:vera').digest()), displayName: 'Vera' };+ const vouch = await runVerifier({+ cfg,+ citizen: vCitizen,+ job: { target: { deliverableUrl: work.deliverableUrl, proofHash: work.proofHashHex, profession: args.profession } },+ });+ console.log('\n── attestation (the trust loop) ────────────────────────────');+ console.log(`verdict ${vouch.vouch.verdict.toUpperCase()}`);+ console.log(`recomputed ${vouch.vouch.recomputed}`);+ console.log(`on-chain claim ${vouch.vouch.claimed}`);+ console.log(`match ${vouch.vouch.match ? '✓ proof re-derived' : '✗ MISMATCH'}`);+ if (!vouch.vouch.match) process.exit(1);+ }++ console.error('\n✓ done.\n');+}++main().catch((err) => {+ console.error('fatal:', err?.stack || err?.message || err);+ process.exit(1);+});