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: enhance job detail error handling and add README for Agora professions
ni3a8bb4a609fe56
diff --git a/docs/agora.md b/docs/agora.mdindex 942de3782..715241069 100644--- a/docs/agora.md+++ b/docs/agora.md@@ -69,6 +69,14 @@ Bits are additive — a citizen can be a Sculptor **and** a Verifier. The registis open: add a bit here, give it a real backing skill, never hardcode a curatedlist. (Same discipline as the avatar rig mapping in CLAUDE.md.)+Each bit's WORK module lives in+[`workers/agora-citizens/work/`](../workers/agora-citizens/work/) (one+`run<Profession>` per file, dispatched by `work/index.js`); every module produces+a real artifact and a `proofHash = sha256(deliverable bytes)` a Verifier+re-derives. **Namekeeper** ships its **resolve** capability (a real `.sol`/ENS+lookup → a hashable record); **minting** `*.threews.sol` needs an authenticated,+staked signer and is deferred — omitted, not stubbed.+### The daily loop ("a day in the life")The heartbeat that makes the economy *alive* rather than a static board. Eachdiff --git a/src/agora/job-detail.js b/src/agora/job-detail.jsindex f9900edb0..c175d06c5 100644--- a/src/agora/job-detail.js+++ b/src/agora/job-detail.js@@ -71,14 +71,21 @@ export async function renderJobDetail(panel, opts = {}, ctx = {}) {cluster, lifecycle: true,}, { signal: ac.signal });} catch (err) {- panel.setError(`Couldn't load this job from the chain: ${err.message}`, () => renderJobDetail(panel, opts, ctx));+ if (ac.signal.aborted) return;+ // not_found is a real, designed state — the PDA is referenced but the+ // on-chain account is gone or on another cluster (the API 404s, which the+ // client surfaces as a thrown error). Everything else is a retryable error.+ if (/not.?found|404/i.test(err.message || '')) {+ panel.setHeader(opts.title || 'Job', opts.taskPda ? jobSubheader(opts.taskPda, cluster) : 'On-chain task');+ panel.setBody(buildNotFound(opts, cluster));+ } else {+ panel.setError(`Couldn't load this job from the chain: ${err.message}`, () => renderJobDetail(panel, opts, ctx));+ }return;}if (ac.signal.aborted) return;if (!data || data.ok === false) {- // not_found is a real, designed state — the PDA exists in the projection- // but the on-chain account is gone or on another cluster.panel.setBody(buildNotFound(opts, cluster));return;}diff --git a/workers/agora-citizens/work/README.md b/workers/agora-citizens/work/README.mdnew file mode 100644index 000000000..b1c6c259e--- /dev/null+++ b/workers/agora-citizens/work/README.md@@ -0,0 +1,92 @@+# Agora professions — the WORK modules++Each profession is an AgenC capability bit (the labor market's type system; see+[`docs/agora.md`](../../../docs/agora.md) and [`../roster.js`](../roster.js)),+backed by a **real** platform skill. A profession module turns a claimed task+into a **real artifact** plus a proof that binds it — the verifiable supply+chain. Nothing here is stubbed: a failed forge/brain/voice call throws and the+citizen reports a real task failure, never a fake success.++## The contract++Every module exports `run<Profession>({ cfg, citizen, job })` and returns the+exact shape [`fetcher.js`](./fetcher.js) established, so the engine submits the+proof on-chain and any Verifier can re-derive it:++```js+{+ result, // structured result object (worker, profession, summary, …)+ resultText, // JSON.stringify(result) — for logs+ proofHashHex, // sha256(deliverable bytes), 64-hex → agora_activity.proof_hash+ proofHashBytes, // 32-byte Uint8Array → completeAgenCTask({ proofHash })+ resultData, // ≤64-byte CID pointer → completeAgenCTask({ resultData })+ deliverableUrl, // public URL of the artifact → agora_activity.deliverable_url+ bytes, summary, // size + one-line story+}+```++**The invariant:** `proofHashHex === sha256(the exact bytes served at+deliverableUrl)`. Re-download the deliverable, sha256 it, and you reproduce the+on-chain proof. [`verifier.js`](./verifier.js) does exactly that and emits a+`vouch` the engine projects as a `vouched` activity.++| Bit | Module | Real skill | Deliverable | Proof |+|----:|--------|------------|-------------|-------|+| 0 | `fetcher` | x402 / HTTP service call | response fingerprint | sha256(canonical) |+| 1 | `sculptor` | text → rig-ready GLB (`@three-ws/forge`) | the `.glb` | sha256(GLB bytes) |+| 2 | `scribe` | research / write (`@three-ws/brain`) | the `.md` text | sha256(text) |+| 3 | `cartographer` | 3D scene / diorama (`@three-ws/scene`) | diorama plan JSON | sha256(canonical) |+| 4 | `crier` | TTS / voice (`@three-ws/voice`) | the audio clip | sha256(audio) |+| 5 | `appraiser` | token / market intel (`@three-ws/intel`) | appraisal JSON | sha256(canonical) |+| 6 | `verifier` | re-derive a proof + attest | the attestation JSON | sha256(canonical) |+| 7 | `namekeeper` | `.sol` / ENS resolve (`@three-ws/names`) | resolution JSON | sha256(canonical) |++[`index.js`](./index.js) is the registry: `runProfession(profession, ctx)`+dispatches to the right runner. Open by design — add a bit + a real skill + its+runner; never a hardcoded allowlist.++### Namekeeper scope+The Namekeeper ships the **resolve** capability (a real read → a real, hashable+record). Minting `*.threews.sol` needs an authenticated, staked signer and is+**deferred** to a later task — it is omitted, not stubbed.++## Storage+Deliverables are stored in R2 via [`api/_lib/r2.js`](../../../api/_lib/r2.js)+(`agora/deliverables/<profession>/<sha256>.<ext>`) and `deliverableUrl` is the+public CDN URL. Without R2 configured: binary deliverables fall back to the+provider's durable URL (forge's hosted GLB — still re-downloadable); text/JSON+deliverables degrade to inline (`deliverableUrl: null`) — the proof still binds+the exact bytes.++## How the engine calls it+[`../engine.js`](../engine.js) WORK step dispatches by the citizen's profession:++```js+const work = await runProfession(profession, { cfg, citizen, job });+// PROVE — profession-agnostic:+await completeTask(client, { taskPda, workerAgentId, proofHash: work.proofHashBytes, resultData: work.resultData });+// PROJECT — proof_hash + deliverable_url onto agora_activity; a Verifier's `work.vouch`+// becomes a `vouched` activity citing the verified task.+```++The devnet dispatcher currently posts generic work slots (Fetcher-gated); each+profession-diverse citizen holds the Fetcher bit so it claims a slot and fulfils+it with its **specialty** (real sculptor/scribe/… work + a real proof). A fully+profession-tagged dispatcher (per-task `requiredCapabilities` + an embedded+creative brief, and a Verifier target drawn from a recent completed deliverable)+is the natural next step — the runners are already profession-agnostic.++## Verify the supply chain (no devnet needed)++[`../verify-supply-chain.mjs`](../verify-supply-chain.mjs) exercises one+profession end-to-end against the real APIs, then re-derives its proof the way a+Verifier would:++```bash+node workers/agora-citizens/verify-supply-chain.mjs --profession sculptor --prompt "a low-poly fox"+# → prints the GLB deliverableUrl + proofHash, then re-downloads and PASSes+curl -sL "<deliverableUrl>" -o /tmp/d.glb && sha256sum /tmp/d.glb # == proofHash+```++Proof helpers + the Verifier trust loop are unit-tested in+[`tests/agora-work-proof.test.js`](../../../tests/agora-work-proof.test.js).