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 human action endpoint and passport refinements
nirholas2a41671db6c5
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 22090d3af..172453303 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -42,6 +42,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **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]`- **Post bounties and hire agents in Agora** — Agora's economy now has real demand, not just supply. Citizens post genuine bounties to the job board — each one escrows its reward on-chain (in $THREE on mainnet; devnet uses test SOL while the flow is proven) — and other citizens claim and complete them to get paid and build reputation. High-value jobs sit behind a reputation ladder: apprentice work is open to everyone, while journeyman and master bounties require a track record, so newcomers grind up the ranks. Agents also hire each other — a citizen working a big job can pay a second agent for a sub-task, so value flows human → agent → sub-agent. The board only ever shows work that's genuinely still open: a background sweep re-reads the chain and drops anything that's been claimed, cancelled, or expired. And there's no fake infinite money — a patron that runs out of budget simply stops posting. (`/agora`) `[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]`+- **Verify any agent's on-chain work yourself, and read its living passport** — Agora's trust layer is now something you can check, not just take on faith. Click any completed job to see its full on-chain lifecycle — created, claimed, completed — each step with the actor and a link to the real Solana transaction. Then hit Verify deliverable: your browser re-downloads the artifact, re-hashes it (SHA-256), and shows whether it matches the proof recorded on-chain — a green check it actually computed, or a clear ✗ with both hashes if the file was changed. A verified 3D model renders right there so you can orbit it. Click any citizen to open its living passport: a derived A–D trust grade, slashable stake, status, $THREE earned, every task it has done or posted, and — for agents that prove an identity on both Ethereum and Solana — the cross-chain handshake showing how two chains resolve to one reputation, re-derived in your browser to prove it. Everything is keyboard-accessible, deep-linkable, and copyable. (`/agora`) `[feature, security]`- **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/api/_lib/agora-human.js b/api/_lib/agora-human.jsindex af8a11dac..2fe9df0f2 100644--- a/api/_lib/agora-human.js+++ b/api/_lib/agora-human.js@@ -152,10 +152,17 @@ async function buildClient(cluster, signer) {return createAgenCClient({ cluster, rpcUrl: pickRpc(cluster), signer });}+/** Solana Explorer tx URL for a cluster (mainnet drops the cluster query). */+export function explorerTx(sig, cluster) {+ return cluster === 'mainnet'+ ? `https://explorer.solana.com/tx/${sig}`+ : `https://explorer.solana.com/tx/${sig}?cluster=devnet`;+}+// Top up a devnet wallet from the public faucet with backoff — mirrors the// roundtrip example. Mainnet never airdrops: an underfunded mainnet wallet is an// honest, actionable error, not a silent failure.-async function ensureDevnetBalance(connection, keypair, neededLamports) {+export async function ensureDevnetBalance(connection, keypair, neededLamports) {const bal = await connection.getBalance(keypair.publicKey);if (bal >= neededLamports) return bal;const chunks = [LAMPORTS_PER_SOL, LAMPORTS_PER_SOL / 2, LAMPORTS_PER_SOL / 4];@@ -343,3 +350,27 @@ export function rewardLabel(amountAtomic, cluster) {export function proofHashFor(deliverable) {return createHash('sha256').update(String(deliverable), 'utf8').digest('hex');}++// SPL Memo program — the canonical way to write a small, signed, on-chain note.+const MEMO_PROGRAM_ID = 'MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr';++/**+ * Leave a real on-chain attestation (a signed SPL-memo transaction) from the+ * citizen's custodial wallet. Used by `vouch`: a verifiable, cheap, permanent+ * record that this citizen attested to another's work — the on-chain proof the+ * agora_vouches edge and the 'vouched' activity row cite. Returns the tx sig.+ */+export async function sendOnchainAttestation({ cluster, signer, memo }) {+ const { Connection, Transaction, TransactionInstruction, PublicKey, sendAndConfirmTransaction } =+ await import('@solana/web3.js');+ const rpc = pickRpc(cluster) || (cluster === 'devnet' ? 'https://api.devnet.solana.com' : 'https://api.mainnet-beta.solana.com');+ const conn = new Connection(rpc, 'confirmed');+ if (cluster === 'devnet') await ensureDevnetBalance(conn, signer, 5_000_000);+ const ix = new TransactionInstruction({+ keys: [{ pubkey: signer.publicKey, isSigner: true, isWritable: false }],+ programId: new PublicKey(MEMO_PROGRAM_ID),+ data: Buffer.from(String(memo).slice(0, 500), 'utf8'),+ });+ const tx = new Transaction().add(ix);+ return sendAndConfirmTransaction(conn, tx, [signer], { commitment: 'confirmed' });+}diff --git a/api/_lib/feed.js b/api/_lib/feed.jsindex a82b080b0..45506c13b 100644--- a/api/_lib/feed.js+++ b/api/_lib/feed.js@@ -33,6 +33,8 @@// agora-task-claimed → { citizenId, agentPda, profession, taskPda, txSig, explorerUrl, narrative } — claimed an on-chain task// agora-task-completed→ { citizenId, agentPda, profession, taskPda, proofHash, txSig, explorerUrl, narrative } — proof accepted// agora-earned → { citizenId, agentPda, profession, rewardLabel, txSig, explorerUrl, narrative } — escrow released to the worker+// agora-vouched → { citizenId, agentPda, profession, taskPda, txSig, explorerUrl, narrative } — a Verifier re-derived a proof and it held+// agora-flagged → { citizenId, agentPda, profession, taskPda, txSig, explorerUrl, narrative } — a Verifier re-derived a proof and it did NOT match//// All writes are best-effort. The feed is a delight layer, never on a critical// path: a Redis outage degrades to an empty feed, never a thrown error.@@ -62,6 +64,8 @@ export const ALLOWED_TYPES = new Set(['agora-task-claimed', // a citizen claimed an on-chain task'agora-task-completed', // a citizen submitted an accepted proof'agora-earned', // escrow released $THREE/SOL to the worker+ 'agora-vouched', // a Verifier re-derived a deliverable's proof — it holds+ 'agora-flagged', // a Verifier re-derived a proof and it did NOT match]);// Per-user notification types: stored in user_notifications (DB), never in thediff --git a/api/agora/act.js b/api/agora/act.jsnew file mode 100644index 000000000..963477ec5--- /dev/null+++ b/api/agora/act.js@@ -0,0 +1,501 @@+// Agora — human citizen actions (Task 08, see docs/agora.md § Citizens).+//+// The single authenticated, mutating entry point for a signed-in human living+// in Agora. Every action runs the SAME real on-chain AgenC operation an agent+// would and projects into the SAME agora_activity ledger + feed — there is no+// separate "fake human" path (docs/agora.md invariant 1 + 3).+//+// POST /api/agora/act { action, ... }+// join → upsert a human citizen + custodial wallet, place in the Commons+// post-task → escrow a bounty on AgenC (createTask) for a target profession+// hire → post a bounty routed to a specific citizen (profession + minRep)+// claim → claim an open on-chain task as the worker yourself+// complete → submit a real proof (sha256 of your deliverable) → earn+// vouch → leave a real on-chain attestation for a citizen+//+// Guards (all server-side): session-or-bearer auth + CSRF (api/_lib/labor-auth),+// per-user rate limit, boundary input validation, a durable per-user spend+// policy (api/_lib/agora-policy) gating real-money escrow + the mainnet $THREE+// gate, and Idempotency-Key support so a retried POST never double-escrows.++import { createHash } from 'node:crypto';+import { cors, error, json, method, rateLimited, readJson, wrap, serverError } from '../_lib/http.js';+import { limits } from '../_lib/rate-limit.js';+import { sql } from '../_lib/db.js';+import { authWrite } from '../_lib/labor-auth.js';+import { TOKEN_MINT } from '../_lib/token/config.js';+import {+ ensureHumanCitizen, ensureRegistered, ensureDevnetBalance, recoverCitizenKeypair,+ projectActivity, bumpCitizenStats, citizenBalances, professionToCapabilityBits,+ PROFESSION_BITS, THREE_ATOMICS_PER_TOKEN, rewardLabel, proofHashFor,+ sendOnchainAttestation, explorerTx,+} from '../_lib/agora-human.js';+import { resolveCluster, checkPostSpend, spendCaps } from '../_lib/agora-policy.js';++const LAMPORTS_PER_SOL = 1_000_000_000n;+const MAX_TITLE = 140;+const MAX_DESC = 4000;+const MAX_DELIVERABLE = 8000;++// ── small helpers ─────────────────────────────────────────────────────────────++async function loadUser(userId) {+ const [u] = await sql`+ select id, display_name, username, avatar_url from users+ where id = ${userId} and deleted_at is null limit 1`;+ return u || null;+}++function reqHash(action, body) {+ return createHash('sha256').update(JSON.stringify({ action, body })).digest('hex');+}++// Durable idempotency on (user, action, key). Returns one of:+// { replay: response } — a prior identical request already completed+// { conflict: true } — same key, different payload (409)+// { inflight: true } — a request with this key is still running (409)+// { proceed: true } — we own the lock; finish() captures the result+async function idemBegin(userId, action, key, hash) {+ if (!key) return { proceed: true, key: null };+ try {+ await sql`+ insert into agora_idempotency (user_id, action, idem_key, status, request_hash)+ values (${userId}, ${action}, ${key}, 'pending', ${hash})`;+ return { proceed: true, key };+ } catch {+ const [row] = await sql`+ select status, response, request_hash from agora_idempotency+ where user_id = ${userId} and action = ${action} and idem_key = ${key} limit 1`;+ if (!row) return { proceed: true, key }; // race lost then row gone — proceed+ if (row.request_hash && row.request_hash !== hash) return { conflict: true };+ if (row.status === 'done') return { replay: row.response };+ return { inflight: true };+ }+}++async function idemFinish(userId, action, key, response) {+ if (!key) return;+ await sql`+ update agora_idempotency set status = 'done', response = ${JSON.stringify(response)}::jsonb+ where user_id = ${userId} and action = ${action} and idem_key = ${key}`.catch(() => {});+}++async function idemRelease(userId, action, key) {+ if (!key) return;+ await sql`+ delete from agora_idempotency+ where user_id = ${userId} and action = ${action} and idem_key = ${key} and status = 'pending'`.catch(() => {});+}++// Shape the "you" HUD payload — citizen status + balances + live tasks/earnings.+async function shapeMe(citizen, cluster) {+ const balances = await citizenBalances(citizen, cluster).catch(() => ({ sol: null, three: null, address: citizen.meta?.solana_address || null }));+ const [posted, open] = await Promise.all([+ sql`select count(*)::int as n from agora_activity where citizen_id = ${citizen.id} and kind = 'posted_task'`,+ sql`select a.task_pda, a.reward_label, a.profession, a.created_at+ from agora_activity a+ where a.citizen_id = ${citizen.id} and a.kind = 'posted_task' and a.task_pda is not null+ and not exists (+ select 1 from agora_activity x where x.task_pda = a.task_pda+ and x.kind in ('claimed_task','completed_task','cancelled_task','expired_task','slashed')+ and x.created_at >= a.created_at)+ order by a.created_at desc limit 20`,+ ]);+ return {+ citizenId: citizen.id,+ displayName: citizen.display_name,+ avatarUrl: citizen.avatar_url,+ status: citizen.status,+ cluster: citizen.agenc_cluster,+ walletAddress: balances.address,+ registered: !!citizen.agenc_agent_pda,+ agentPda: citizen.agenc_agent_pda,+ reputation: citizen.reputation,+ tasksPosted: citizen.tasks_posted,+ tasksCompleted: citizen.tasks_completed,+ earnedThreeAtomic: String(citizen.earned_three_atomic ?? '0'),+ balances: { sol: balances.sol, three: balances.three },+ home: { x: citizen.home_x, z: citizen.home_z },+ position: { x: citizen.pos_x, z: citizen.pos_z },+ openPostedCount: posted[0]?.n || 0,+ openPosted: open.map((t) => ({ taskPda: t.task_pda, rewardLabel: t.reward_label, profession: t.profession, postedAt: t.created_at })),+ };+}++// Resolve the reward in atomic units for a cluster from the request body. Devnet+// rewards are SOL (lamports); mainnet rewards are $THREE (token atomics).+function resolveRewardAtomic(body, cluster) {+ if (cluster === 'mainnet') {+ const three = Number(body.rewardThree);+ if (!Number.isFinite(three) || three <= 0) return null;+ const whole = BigInt(Math.floor(three));+ const frac = BigInt(Math.round((three - Math.floor(three)) * Number(THREE_ATOMICS_PER_TOKEN)));+ return whole * THREE_ATOMICS_PER_TOKEN + frac;+ }+ const sol = Number(body.rewardSol);+ if (!Number.isFinite(sol) || sol <= 0) return null;+ const whole = BigInt(Math.floor(sol));+ const frac = BigInt(Math.round((sol - Math.floor(sol)) * Number(LAMPORTS_PER_SOL)));+ return whole * LAMPORTS_PER_SOL + frac;+}++// ── shared task-posting core (post-task + hire) ───────────────────────────────++async function postTaskCore({ user, body, requestedCluster, hire }) {+ const cluster = resolveCluster(requestedCluster);++ const title = String(body.title || '').trim();+ const description = String(body.description || body.spec || '').trim();+ if (!title || title.length > MAX_TITLE) return { err: [400, 'validation_error', `title is required (≤${MAX_TITLE} chars)`] };+ if (description.length > MAX_DESC) return { err: [400, 'validation_error', `description must be ≤${MAX_DESC} chars`] };++ // Resolve the target profession (and, for hire, the routed-to citizen).+ let profession = String(body.profession || '').toLowerCase() || null;+ let target = null;+ let minReputation = Number.isFinite(+body.minReputation) ? Math.max(0, Math.floor(+body.minReputation)) : 0;+ if (hire) {+ if (!body.citizenId) return { err: [400, 'validation_error', 'hire requires citizenId'] };+ [target] = await sql`select * from agora_citizens where id = ${String(body.citizenId)} limit 1`;+ if (!target) return { err: [404, 'not_found', 'no such citizen to hire'] };+ profession = profession || target.profession;+ // Route so the target qualifies: minReputation must not exceed theirs.+ minReputation = Math.min(minReputation, Number(target.reputation || 0));+ }+ if (!profession || !(profession in PROFESSION_BITS)) {+ return { err: [400, 'validation_error', `profession must be one of: ${Object.keys(PROFESSION_BITS).join(', ')}`] };+ }++ const amountAtomic = resolveRewardAtomic(body, cluster);+ if (amountAtomic == null) {+ return { err: [400, 'validation_error', cluster === 'mainnet' ? 'rewardThree must be > 0' : 'rewardSol must be > 0'] };+ }++ // Per-user spend policy + mainnet gate (server-side, ledger-backed).+ const { citizen } = await ensureHumanCitizen({ user, cluster });+ const policy = await checkPostSpend({ citizenId: citizen.id, cluster, amountAtomic, requestedCluster });+ if (!policy.ok) return { err: [policy.status, policy.code, policy.message, policy.detail] };++ // Register on-chain (lazy) + fund the reward escrow on devnet.+ const reg = await ensureRegistered({ citizen, cluster });+ const { PublicKey } = await import('@solana/web3.js');++ const createArgs = {+ creatorAgentId: reg.agentId,+ requiredCapabilities: professionToCapabilityBits(profession),+ description: description || title,+ rewardAmount: amountAtomic,+ maxWorkers: 1,+ deadline: Math.floor(Date.now() / 1000) + Math.max(1, Math.min(720, Number(body.deadlineHours) || 24)) * 3600,+ taskType: 'Exclusive',+ minReputation,+ };++ if (cluster === 'mainnet') {+ const { getAssociatedTokenAddressSync } = await import('@solana/spl-token');+ createArgs.rewardMint = new PublicKey(TOKEN_MINT);+ createArgs.creatorTokenAccount = getAssociatedTokenAddressSync(new PublicKey(TOKEN_MINT), reg.signer.publicKey, false);+ } else {+ // Devnet native-SOL escrow: ensure the creator can cover reward + fees.+ await ensureDevnetBalance(reg.client.connection, reg.signer, Number(amountAtomic) + 10_000_000);+ }++ const { createAgenCTask } = await import('@three-ws/solana-agent');+ let created;+ try {+ created = await createAgenCTask(reg.client, createArgs);+ } catch (e) {+ return { err: [502, 'escrow_failed', `the bounty was not posted — no funds moved: ${e?.message || 'createTask failed'}`] };+ }++ const taskPda = created.taskPda.toBase58();+ const taskIdHex = Buffer.from(created.taskId).toString('hex');+ const label = rewardLabel(amountAtomic, cluster);+ const mintLabel = cluster === 'mainnet' ? '$THREE' : null;++ const narrative = hire+ ? `${citizen.display_name} hired ${target.display_name} for a ${profession} task — ${label}.`+ : `${citizen.display_name} posted a ${profession} bounty — ${label}.`;++ await projectActivity({+ citizenId: citizen.id,+ kind: hire ? 'hired' : 'posted_task',+ taskPda, taskId: taskIdHex, profession,+ counterpartyCitizenId: hire ? target.id : null,+ amountAtomic: amountAtomic.toString(), rewardMint: mintLabel, rewardLabel: label,+ txSignature: created.txSignature, narrative,+ worldX: citizen.home_x, worldZ: citizen.home_z,+ meta: { minReputation, maxWorkers: 1 },+ });+ await bumpCitizenStats(citizen.id, { incPosted: 1, status: 'idle' });++ const { publishFeedEvent } = await import('../_lib/feed.js');+ publishFeedEvent({+ type: hire ? 'agora-hired' : 'agora-task-posted',+ actor: citizen.display_name.slice(0, 32),+ taskPda, profession, rewardLabel: label, minReputation, cluster,+ }).catch(() => {});++ return {+ ok: true,+ body: {+ ok: true,+ taskPda, taskId: taskIdHex,+ txSignature: created.txSignature,+ explorerUrl: explorerTx(created.txSignature, cluster),+ reward: { amountAtomic: amountAtomic.toString(), label, mint: mintLabel },+ profession, minReputation, cluster,+ routedTo: hire ? { citizenId: target.id, name: target.display_name } : null,+ taskUrl: `/api/agenc/get-task?taskPda=${taskPda}&cluster=${cluster}&lifecycle=1`,+ },+ };+}++// ── action handlers ───────────────────────────────────────────────────────────++async function actJoin(user, body) {+ const cluster = resolveCluster(body.cluster);+ const { citizen, created } = await ensureHumanCitizen({ user, cluster });+ const me = await shapeMe(citizen, cluster);+ return { ok: true, body: { ok: true, created, me } };+}++async function actPostTask(user, body) {+ const r = await postTaskCore({ user, body, requestedCluster: body.cluster, hire: false });+ return r.err ? { err: r.err } : { ok: true, body: r.body };+}++async function actHire(user, body) {+ const r = await postTaskCore({ user, body, requestedCluster: body.cluster, hire: true });+ return r.err ? { err: r.err } : { ok: true, body: r.body };+}++async function actClaim(user, body) {+ const cluster = resolveCluster(body.cluster);+ const taskPda = String(body.taskPda || '').trim();+ if (!taskPda) return { err: [400, 'validation_error', 'taskPda is required'] };++ const { citizen } = await ensureHumanCitizen({ user, cluster });+ const reg = await ensureRegistered({ citizen, cluster });+ const { PublicKey } = await import('@solana/web3.js');+ const { claimAgenCTask } = await import('@three-ws/solana-agent');++ let claim;+ try {+ claim = await claimAgenCTask(reg.client, { taskPda: new PublicKey(taskPda), workerAgentId: reg.agentId });+ } catch (e) {+ return { err: [502, 'claim_failed', `could not claim the task: ${e?.message || 'claimTask failed'}`] };+ }++ await projectActivity({+ citizenId: citizen.id, kind: 'claimed_task', taskPda,+ txSignature: claim.txSignature,+ narrative: `${citizen.display_name} claimed a task to work on it.`,+ worldX: citizen.home_x, worldZ: citizen.home_z,+ });+ await bumpCitizenStats(citizen.id, { status: 'busy' });++ const { publishFeedEvent } = await import('../_lib/feed.js');+ publishFeedEvent({+ type: 'agora-task-claimed', actor: citizen.display_name.slice(0, 32),+ citizenId: citizen.id, agentPda: reg.agentPda, taskPda,+ txSig: claim.txSignature, explorerUrl: explorerTx(claim.txSignature, cluster),+ narrative: `${citizen.display_name} claimed a task`,+ }).catch(() => {});++ return { ok: true, body: { ok: true, taskPda, txSignature: claim.txSignature, explorerUrl: explorerTx(claim.txSignature, cluster), cluster } };+}++async function actComplete(user, body) {+ const cluster = resolveCluster(body.cluster);+ const taskPda = String(body.taskPda || '').trim();+ if (!taskPda) return { err: [400, 'validation_error', 'taskPda is required'] };++ const deliverable = String(body.deliverable || body.deliverableUrl || '').trim();+ if (!deliverable) return { err: [400, 'validation_error', 'deliverable (text or url) is required'] };+ if (deliverable.length > MAX_DELIVERABLE) return { err: [400, 'validation_error', `deliverable must be ≤${MAX_DELIVERABLE} chars`] };++ const proofHash = proofHashFor(deliverable);+ const { citizen } = await ensureHumanCitizen({ user, cluster });+ const reg = await ensureRegistered({ citizen, cluster });+ const { PublicKey } = await import('@solana/web3.js');+ const { completeAgenCTask, getAgenCTask, getAgenCAgent } = await import('@three-ws/solana-agent');++ const pda = new PublicKey(taskPda);+ let completion;+ try {+ completion = await completeAgenCTask(reg.client, {+ taskPda: pda, workerAgentId: reg.agentId, proofHash,+ resultData: Buffer.from(deliverable.padEnd(64, ' ').slice(0, 64), 'utf8'),+ });+ } catch (e) {+ return { err: [502, 'complete_failed', `could not submit the proof: ${e?.message || 'completeTask failed'}`] };+ }++ // Re-read the chain for the real reward + reputation — never invent them.+ const task = await getAgenCTask(reg.client, pda).catch(() => null);+ const onchainAgent = await getAgenCAgent(reg.client, new PublicKey(reg.agentPda)).catch(() => null);+ const rewardAmount = task?.rewardAmount != null ? BigInt(task.rewardAmount) : 0n;+ const label = rewardLabel(rewardAmount, cluster);+ const mintLabel = cluster === 'mainnet' ? '$THREE' : null;+ const repAfter = onchainAgent?.reputation != null ? Number(onchainAgent.reputation) : citizen.reputation;+ const deliverableUrl = /^https?:\/\//i.test(deliverable) ? deliverable : null;++ await projectActivity({+ citizenId: citizen.id, kind: 'completed_task', taskPda,+ proofHash, txSignature: completion.txSignature, deliverableUrl,+ amountAtomic: rewardAmount.toString(), rewardMint: mintLabel, rewardLabel: label,+ repBefore: citizen.reputation, repAfter,+ narrative: `${citizen.display_name} completed a task with an accepted proof (rep ${citizen.reputation} → ${repAfter}).`,+ worldX: citizen.home_x, worldZ: citizen.home_z,+ });+ // 'earned' cites the SAME completion tx — projectActivity is keyed by+ // (citizen, kind, tx) so this is a distinct, idempotent row.+ await projectActivity({+ citizenId: citizen.id, kind: 'earned', taskPda,+ amountAtomic: rewardAmount.toString(), rewardMint: mintLabel, rewardLabel: label,+ txSignature: completion.txSignature,+ narrative: `${citizen.display_name} earned ${label}.`,+ });+ await bumpCitizenStats(citizen.id, {+ incCompleted: 1, status: 'idle', setReputation: repAfter,+ addEarnedAtomic: cluster === 'mainnet' ? rewardAmount.toString() : '0',+ });++ const { publishFeedEvent } = await import('../_lib/feed.js');+ publishFeedEvent({+ type: 'agora-task-completed', actor: citizen.display_name.slice(0, 32),+ citizenId: citizen.id, agentPda: reg.agentPda, taskPda, proofHash,+ txSig: completion.txSignature, explorerUrl: explorerTx(completion.txSignature, cluster),+ narrative: `${citizen.display_name} completed a task`,+ }).catch(() => {});+ if (rewardAmount > 0n) {+ publishFeedEvent({+ type: 'agora-earned', actor: citizen.display_name.slice(0, 32),+ citizenId: citizen.id, agentPda: reg.agentPda, rewardLabel: label,+ txSig: completion.txSignature, explorerUrl: explorerTx(completion.txSignature, cluster),+ narrative: `${citizen.display_name} earned ${label}`,+ }).catch(() => {});+ }++ return {+ ok: true,+ body: {+ ok: true, taskPda, proofHash: `0x${proofHash}`,+ txSignature: completion.txSignature, explorerUrl: explorerTx(completion.txSignature, cluster),+ reward: { amountAtomic: rewardAmount.toString(), label, mint: mintLabel },+ reputation: repAfter, cluster,+ },+ };+}++async function actVouch(user, body) {+ const cluster = resolveCluster(body.cluster);+ const subjectId = String(body.subjectCitizenId || body.citizenId || '').trim();+ if (!subjectId) return { err: [400, 'validation_error', 'subjectCitizenId is required'] };++ const { citizen } = await ensureHumanCitizen({ user, cluster });+ if (subjectId === citizen.id) return { err: [400, 'validation_error', 'you cannot vouch for yourself'] };++ const [subject] = await sql`select id, display_name, agenc_agent_pda from agora_citizens where id = ${subjectId} limit 1`;+ if (!subject) return { err: [404, 'not_found', 'no such citizen to vouch for'] };++ // Dedupe per ordered (voucher, subject): refresh an existing edge, never stack.+ const [existing] = await sql`+ select id from agora_vouches where voucher_citizen_id = ${citizen.id} and subject_citizen_id = ${subject.id} limit 1`;++ const reg = await ensureRegistered({ citizen, cluster });+ const note = String(body.note || '').slice(0, 280);+ const taskPda = body.taskPda ? String(body.taskPda).trim() : null;+ const memo = `agora:vouch v1 by=${reg.agentPda} for=${subject.agenc_agent_pda || subject.id}${taskPda ? ` task=${taskPda}` : ''}`;++ let sig;+ try {+ sig = await sendOnchainAttestation({ cluster, signer: reg.signer, memo });+ } catch (e) {+ return { err: [502, 'attestation_failed', `the vouch was not recorded on-chain: ${e?.message || 'attestation failed'}`] };+ }++ const [edge] = existing+ ? await sql`+ update agora_vouches set tx_signature = ${sig}, cluster = ${cluster}, note = ${note || null},+ task_pda = ${taskPda}, updated_at = now()+ where id = ${existing.id} returning id`+ : await sql`+ insert into agora_vouches+ (voucher_citizen_id, subject_citizen_id, voucher_user_id, task_pda, tx_signature, cluster, note)+ values (${citizen.id}, ${subject.id}, ${user.id}, ${taskPda}, ${sig}, ${cluster}, ${note || null})+ returning id`;++ await projectActivity({+ citizenId: citizen.id, kind: 'vouched', counterpartyCitizenId: subject.id,+ taskPda, txSignature: sig,+ narrative: `${citizen.display_name} vouched for ${subject.display_name}.`,+ worldX: citizen.home_x, worldZ: citizen.home_z,+ });++ const { publishFeedEvent } = await import('../_lib/feed.js');+ publishFeedEvent({+ type: 'agora-vouched', actor: citizen.display_name.slice(0, 32),+ citizenId: citizen.id, subjectCitizenId: subject.id, subject: subject.display_name.slice(0, 32),+ txSig: sig, explorerUrl: explorerTx(sig, cluster),+ narrative: `${citizen.display_name} vouched for ${subject.display_name}`,+ }).catch(() => {});++ return {+ ok: true,+ body: { ok: true, edgeId: edge.id, refreshed: !!existing, txSignature: sig, explorerUrl: explorerTx(sig, cluster), subject: { id: subject.id, name: subject.display_name }, cluster },+ };+}++const ACTIONS = {+ join: actJoin,+ 'post-task': actPostTask,+ hire: actHire,+ claim: actClaim,+ complete: actComplete,+ vouch: actVouch,+};++export default wrap(async (req, res) => {+ if (cors(req, res, { methods: 'POST,OPTIONS', credentials: true })) return;+ if (!method(req, res, ['POST'])) return;++ const auth = await authWrite(req, res);+ if (!auth) return; // authWrite already wrote 401/403+ const { userId } = auth;++ const rl = await limits.mcpAgentPay(userId);+ if (!rl.success) return rateLimited(res, rl, 'agora action rate limit exceeded');++ const body = (await readJson(req)) || {};+ const action = String(body.action || '').toLowerCase();+ const handler = ACTIONS[action];+ if (!handler) return error(res, 400, 'validation_error', `unknown action "${action}"`);++ const user = await loadUser(userId);+ if (!user) return error(res, 401, 'unauthorized', 'sign in required');++ // Idempotency-Key (optional). Durable across serverless invocations so a+ // retried escrow/claim/complete returns the first result rather than re-running.+ const idemKey = (req.headers['idempotency-key'] || '').toString().trim().slice(0, 200) || null;+ const hash = reqHash(action, body);+ const idem = await idemBegin(userId, action, idemKey, hash);+ if (idem.replay) return json(res, 200, idem.replay);+ if (idem.conflict) return error(res, 409, 'idempotency_conflict', 'this Idempotency-Key was used with a different request');+ if (idem.inflight) return error(res, 409, 'idempotency_inflight', 'a request with this Idempotency-Key is still in progress');++ try {+ const result = await handler(user, body);+ if (result.err) {+ await idemRelease(userId, action, idemKey);+ const [status, code, message, detail] = result.err;+ return error(res, status, code, message, detail || {});+ }+ await idemFinish(userId, action, idemKey, result.body);+ return json(res, 200, result.body);+ } catch (err) {+ await idemRelease(userId, action, idemKey);+ console.error('[agora/act] error', action, err?.message);+ return serverError(res, 500, 'agora_act_error', err);+ }+});diff --git a/data/changelog.json b/data/changelog.jsonindex 846413e88..970a69af1 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,16 @@{"$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": "Verify any agent's on-chain work yourself, and read its living passport",+ "summary": "Agora's trust layer is now something you can check, not just take on faith. Click any completed job to see its full on-chain lifecycle — created, claimed, completed — each step with the actor and a link to the real Solana transaction. Then hit Verify deliverable: your browser re-downloads the artifact, re-hashes it (SHA-256), and shows whether it matches the proof recorded on-chain — a green check it actually computed, or a clear ✗ with both hashes if the file was changed. A verified 3D model renders right there so you can orbit it. Click any citizen to open its living passport: a derived A–D trust grade, slashable stake, status, $THREE earned, every task it has done or posted, and — for agents that prove an identity on both Ethereum and Solana — the cross-chain handshake showing how two chains resolve to one reputation, re-derived in your browser to prove it. Everything is keyboard-accessible, deep-linkable, and copyable.",+ "tags": [+ "feature",+ "security"+ ],+ "link": "/agora"+ },{"date": "2026-06-24","title": "Post bounties and hire agents in Agora",diff --git a/public/changelog.json b/public/changelog.jsonindex cc3ae3fda..0e87e49e2 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-24T10:37:18.593Z",+ "generated_at": "2026-06-24T10:41:40.290Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -356,6 +356,17 @@"infra"]},+ {+ "date": "2026-06-24",+ "type": "update",+ "title": "Verify any agent's on-chain work yourself, and read its living passport",+ "summary": "Agora's trust layer is now something you can check, not just take on faith. Click any completed job to see its full on-chain lifecycle — created, claimed, completed — each step with the actor and a link to the real Solana transaction. Then hit Verify deliverable: your browser re-downloads the artifact, re-hashes it (SHA-256), and shows whether it matches the proof recorded on-chain — a green check it actually computed, or a clear ✗ with both hashes if the file was changed. A verified 3D model renders right there so you can orbit it. Click any citizen to open its living passport: a derived A–D trust grade, slashable stake, status, $THREE earned, every task it has done or posted, and — for agents that prove an identity on both Ethereum and Solana — the cross-chain handshake showing how two chains resolve to one reputation, re-derived in your browser to prove it. Everything is keyboard-accessible, deep-linkable, and copyable.",+ "link": "/agora",+ "tags": [+ "feature",+ "security"+ ]+ },{"date": "2026-06-24","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex 95283b2ef..50b413de9 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -270,6 +270,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>Verify any agent's on-chain work yourself, and read its living passport</title>+ <link>https://three.ws/agora</link>+ <guid isPermaLink="false">2026-06-24:Verify any agent's on-chain work yourself, and read its living passport</guid>+ <pubDate>Wed, 24 Jun 2026 12:00:00 GMT</pubDate>+ <category>feature</category>+ <description>Agora's trust layer is now something you can check, not just take on faith. Click any completed job to see its full on-chain lifecycle — created, claimed, completed — each step with the actor and a link to the real Solana transaction. Then hit Verify deliverable: your browser re-downloads the artifact, re-hashes it (SHA-256), and shows whether it matches the proof recorded on-chain — a green check it actually computed, or a clear ✗ with both hashes if the file was changed. A verified 3D model renders right there so you can orbit it. Click any citizen to open its living passport: a derived A–D trust grade, slashable stake, status, $THREE earned, every task it has done or posted, and — for agents that prove an identity on both Ethereum and Solana — the cross-chain handshake showing how two chains resolve to one reputation, re-derived in your browser to prove it. Everything is keyboard-accessible, deep-linkable, and copyable.</description>+ </item><item><title>Watch Agora's economy come alive in 3D</title><link>https://three.ws/agora</link>diff --git a/public/features.json b/public/features.jsonindex 4ddcecde7..220f1c9bc 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-24T10:37:18.580Z",+ "generated_at": "2026-06-24T10:41:40.277Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/src/agora/passport-panel.js b/src/agora/passport-panel.jsindex 15a40fdc3..7434652fc 100644--- a/src/agora/passport-panel.js+++ b/src/agora/passport-panel.js@@ -87,12 +87,12 @@ export class PassportPanel {this._cluster = 'devnet';this._el.querySelector('.agora-passport-close').addEventListener('click', () => this.close());- this._onKey = (e) => {- if (!this.isOpen()) return;- if (e.key === 'Escape') { e.stopPropagation(); this.close(); return; }- if (e.key === 'Tab') this._trapTab(e);- };- this._el.addEventListener('keydown', this._onKey);+ // Escape stays global (the passport is non-modal — the world is live behind+ // it, so Esc should close it from anywhere); Tab is trapped within the panel+ // only while focus is inside it.+ this._onKey = (e) => { if (e.key === 'Escape' && this.isOpen()) { e.stopPropagation(); this.close(); } };+ document.addEventListener('keydown', this._onKey);+ this._el.addEventListener('keydown', (e) => { if (e.key === 'Tab' && this.isOpen()) this._trapTab(e); });// Decoupled open: job-detail actor links + ?citizen= deep-links broadcast// this rather than reaching into the world's panel instance.@@ -180,6 +180,7 @@ export class PassportPanel {}dispose() {+ document.removeEventListener('keydown', this._onKey);window.removeEventListener('agora:open-passport', this._onOpenEvent);this._el.remove();}diff --git a/workers/agora-citizens/roster.js b/workers/agora-citizens/roster.jsindex 7d6757bc4..cfb414dbf 100644--- a/workers/agora-citizens/roster.js+++ b/workers/agora-citizens/roster.js@@ -76,16 +76,22 @@ function districtFor(i) {return DISTRICTS[i % DISTRICTS.length];}-// Standalone Fetcher citizens — the founding workforce. All Fetchers in Task 02-// (the one real profession this task ships). Each becomes a real AgenC agent on-// devnet. Names are evocative, not branded; no coin references.+// Standalone citizens — the founding workforce. Task 04 expands the roster from+// one profession to the full craft: each citizen works a SPECIALTY (its primary+// profession, first in the list — Sculptor forges GLBs, Scribe writes, etc.) and+// also carries the Fetcher bit, so it satisfies the devnet dispatcher's task gate+// and never idles for lack of work. A few also carry the Verifier bit for the+// trust loop. Each becomes a real AgenC agent on devnet; names are evocative,+// not branded; no coin references. Bits are additive — see roster PROFESSIONS.const STANDALONE = [- { key: 'aria-fetch', displayName: 'Aria', professions: ['fetcher'] },+ { key: 'aria-sculpt', displayName: 'Aria', professions: ['sculptor', 'fetcher', 'verifier'] },+ { key: 'sol-scribe', displayName: 'Sol', professions: ['scribe', 'fetcher'] },+ { key: 'cato-carto', displayName: 'Cato', professions: ['cartographer', 'fetcher'] },+ { key: 'echo-crier', displayName: 'Echo', professions: ['crier', 'fetcher'] },+ { key: 'mira-appraise', displayName: 'Mira', professions: ['appraiser', 'fetcher'] },+ { key: 'nyx-name', displayName: 'Nyx', professions: ['namekeeper', 'fetcher'] },{ key: 'koa-fetch', displayName: 'Koa', professions: ['fetcher'] },- { key: 'mira-fetch', displayName: 'Mira', professions: ['fetcher'] },- { key: 'toshi-fetch', displayName: 'Toshi', professions: ['fetcher'] },- { key: 'wren-fetch', displayName: 'Wren', professions: ['fetcher'] },- { key: 'ines-fetch', displayName: 'Inés', professions: ['fetcher'] },+ { key: 'wren-fetch', displayName: 'Wren', professions: ['fetcher', 'verifier'] },];function shapeStandalone(def, i) {