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: Add BNB chain integration and MPP payment support

fudjia7aaf9e5d6f99
diff --git a/STRUCTURE.md b/STRUCTURE.md
index 8f90bbbcf..a2fd7fa9f 100644
--- a/STRUCTURE.md
+++ b/STRUCTURE.md
@@ -48,6 +48,7 @@ bottom.
| On-chain agent invocation | [contracts/agent-invocation/](contracts/agent-invocation) | In-repo | Anchor program: verifiable agent-to-agent skill invocation events. SDK: [agent-protocol-sdk/](agent-protocol-sdk) |
| Cross-chain SDKs | [sdk/](sdk), [solana-agent-sdk/](solana-agent-sdk), [agent-payments-sdk/](agent-payments-sdk), [agent-protocol-sdk/](agent-protocol-sdk) | Published | Cross-chain agent SDKs |
| MCP integration | [mcp-server/](mcp-server), [mcp-bridge/](mcp-bridge), [packages/*-mcp/](packages) | 32 npm servers + 6 hosted remote (38 total), all in the [MCP registry](https://registry.modelcontextprotocol.io/?q=io.github.nirholas) | Model Context Protocol surface — full server list in [docs/mcp.md](docs/mcp.md) |
+| Agent Skills pack | [.agents/skills/](.agents/skills) → manifest [.agents/skills/SKILLS.md](.agents/skills/SKILLS.md), [.agents/skills/skills-pack.json](.agents/skills/skills-pack.json) | In-repo; bundled in the `three-ws-core` [plugin](.claude-plugin/marketplace.json) | 40 portable `SKILL.md` folders (Agent Skills open standard) for any Claude surface — 3d/creative (cross-platform-safe), wallet/payments, intel/trading. Regenerate manifest: `node scripts/build-skills-pack.mjs`. Docs: [docs/agent-skills.md](docs/agent-skills.md) |
| SNS naming + pay-by-name | [api/sns.js](api/sns.js), [api/sns-subdomain.js](api/sns-subdomain.js), [api/threews/subdomain.js](api/threews/subdomain.js), [api/x402/pay-by-name.js](api/x402/pay-by-name.js), [src/solana/sns-subdomain.js](src/solana/sns-subdomain.js), [pages/threews-claim.html](pages/threews-claim.html) | In-repo | `*.threews.sol` subdomain mint, x402 payments addressed by name. Env: `THREEWS_SOL_PARENT_SECRET_BASE58` |
| Self-hosted x402 facilitator + ring economy | [api/x402-facilitator/[action].js](api/x402-facilitator/[action].js), [api/_lib/x402/self-facilitator.js](api/_lib/x402/self-facilitator.js), [api/x402/ring-settle.js](api/x402/ring-settle.js), [api/_lib/x402/pipelines/ring-rebalance.js](api/_lib/x402/pipelines/ring-rebalance.js), [api/x402-ring.js](api/x402-ring.js), [scripts/x402-ring-setup.mjs](scripts/x402-ring-setup.mjs) | In-repo (off by default) | Closed-loop agent-to-agent x402: platform wallets pay platform endpoints, settled in-house (no external facilitator). Fee-minimized, SOL-floor guarded, internal-labeled. Env: `X402_SELF_FACILITATOR_ENABLED`, `X402_FEE_PAYER_SECRET_BASE58`, `X402_TREASURY_SECRET_BASE58`. See [docs/x402-ring-economy.md](docs/x402-ring-economy.md) |
| Ring economy operator dashboard | [pages/admin/ring.html](pages/admin/ring.html) + [src/admin-ring.js](src/admin-ring.js) `→ /admin/ring`, backend [api/admin/ring-dashboard.js](api/admin/ring-dashboard.js) | In-repo (admin, noindex) | Live eyes on the closed-loop x402 ring: per-minute settlement pulse (green/amber/red heartbeat), loop diagram with live wallet balances + floors, streaming activity feed (agent attribution, Solscan links, skip/fail reasons), fee-burn vs daily budget, integrity (leak scan + reconciliation), per-endpoint coverage. One aggregate read model composes [/api/x402-ring](api/x402-ring.js); admin/Bearer-secret authed. Labels volume as internal dogfooding. See [docs/x402-ring-economy.md](docs/x402-ring-economy.md#watching-it--the-operator-dashboard) |
diff --git a/docs/start-here.md b/docs/start-here.md
index b9a919cf1..e40e9ade4 100644
--- a/docs/start-here.md
+++ b/docs/start-here.md
@@ -74,3 +74,4 @@ If you're here to create and share agents rather than write code, follow this pa
- **Your agent needs a face?** → [OKX.AI marketplace services](./okx-marketplace.md) — the Agent Identity Studio and the pay-per-call 3D services other agents buy from us; demo identities at [/agent-identities](/agent-identities)
- **Buying 3D asset work per call?** → [The 3D Asset Pipeline](./3d-pipeline.md) — pay a few cents in USDC to rig, remesh, make game-ready, stylize, or background-remove an asset; one call, one finished URL, no account or API key
- **Building UI?** → [ui-juice](./ui-juice.md) is the shared game-feel library (count-ups, sparklines, ring gauges, live dots, the "it shipped" ripple) every surface animates with
+- **Teaching another AI to use three.ws?** → [The Agent Skills pack](./agent-skills.md) — portable `SKILL.md` folders that give any Claude surface (Claude Code, the Claude apps, the Agent SDK) three.ws's 3D-creation, wallet, and x402-economy skills; the 3D subset is cross-platform-safe
diff --git a/prompts/bnb-chain/01-bnb-chains-lib.md b/prompts/bnb-chain/01-bnb-chains-lib.md
new file mode 100644
index 000000000..1915173cc
--- /dev/null
+++ b/prompts/bnb-chain/01-bnb-chains-lib.md
@@ -0,0 +1,31 @@
+# 01 — BNB chain constants + RPC failover lib
+
+Read `prompts/bnb-chain/00-CONTEXT.md` first, then `/workspaces/three.ws/CLAUDE.md`.
+**Prereqs: none.** This is the foundation every other prompt imports.
+
+## Why
+Every BNB prompt needs the same chain metadata, a resilient RPC client, and a way to prove
+the 0.45s block claim. Centralize it once so no prompt hand-rolls RPC URLs or hardcodes the
+hub addresses from 00-CONTEXT.
+
+## Build — `api/_lib/bnb/chains.js`
+Small, dependency-light module (viem preferred; it's installed). Export:
+- `BNB_CHAINS` — `{ bscMainnet: {id:56, rpcs:[...], explorer, greenfieldHubs:{crossChain,tokenHub,bucketHub,objectHub,groupHub,multiMessage}}, bscTestnet: {id:97, rpcs:[...], explorer}, }`. Copy the mainnet hub addresses **verbatim from 00-CONTEXT** (do not invent). Include ≥2 public RPC URLs per network for failover.
+- `getPublicClient(network)` — returns a viem public client with RPC failover: try each RPC in order, cache the first healthy one, re-probe on failure. Default network `bscTestnet`.
+- `probeBlockTime(network, sampleBlocks = 200)` — fetch `latest` and `latest - sampleBlocks`, return `{ avgBlockTimeMs, latestBlock, target: network==='bscMainnet' ? 450 : null, measuredAt }`. This is what the latency-proof surfaces (14–17) consume.
+- `isEvmAddress(s)` / `assertBscAddress(s)` helpers.
+
+## States / robustness
+All RPCs down → throw a typed `BnbRpcError` with the list of URLs tried (callers surface 503).
+Never hang: per-RPC timeout (default 5s). No secrets in this file — RPC URLs are public.
+
+## Tests (`tests/bnb-chains.test.js`)
+- `BNB_CHAINS.bscMainnet.greenfieldHubs.crossChain` equals the exact 00-CONTEXT address.
+- `isEvmAddress` accepts a checksummed 0x40-hex, rejects Solana base58 + junk.
+- `getPublicClient` failover: mock first RPC throwing → second used (inject a fake transport).
+- `probeBlockTime` shape asserted against a mocked block pair (numbers, not live) so the test is deterministic; ALSO include one `it.skip`-able live-RPC smoke test guarded by `process.env.BNB_LIVE_RPC` that asserts mainnet avg < 700ms.
+
+## Definition of done
+Inherit 00-CONTEXT DoD. Additionally:
+- [ ] Run `probeBlockTime('bscMainnet')` live once; paste the real `{avgBlockTimeMs, latestBlock}` into PROGRESS (this is our own proof the 0.45s claim holds today).
+- [ ] `docs/` not required yet (internal lib) — but add a one-line JSDoc header on each export.
diff --git a/prompts/bnb-chain/02-megafuel-client.md b/prompts/bnb-chain/02-megafuel-client.md
new file mode 100644
index 000000000..eee54dffc
--- /dev/null
+++ b/prompts/bnb-chain/02-megafuel-client.md
@@ -0,0 +1,36 @@
+# 02 — MegaFuel gasless-send client (with self-pay fallback)
+
+Read `prompts/bnb-chain/00-CONTEXT.md` first, then `/workspaces/three.ws/CLAUDE.md`.
+**Prereqs: 01** (`api/_lib/bnb/chains.js`). If missing, run prompt 01 first.
+
+## Why
+This is the crown-jewel capability: send a transaction from a plain private-key EOA that
+pays ZERO gas, sponsored at the block-building layer. No smart account, no delegation —
+impossible on Ethereum L1/Base. Wrap MegaFuel's API cleanly so every downstream prompt
+(03 registration, 15 world-moves) gets gasless sends for free, with an automatic self-pay
+fallback so nothing ever hard-fails.
+
+## Build — `api/_lib/bnb/megafuel.js`
+Use `megafuel-js-sdk` if it cleanly wraps the two RPC methods; otherwise call them directly
+via viem/fetch (document the choice). Endpoints in 00-CONTEXT (testnet default). Export:
+- `isSponsorable(network, txRequest)` → calls `pm_isSponsorable`; returns `{ sponsorable:boolean, sponsorInfo|null, reason }`. Never throws on a policy "no" — that's a normal answer.
+- `sendGasless(network, { account, tx })` → builds the tx with `gasPrice: 0`, checks `isSponsorable`; if yes, signs + submits via MegaFuel's `eth_sendRawTransaction`; returns `{ hash, mode:'sponsored', sponsor }`. **If not sponsorable OR MegaFuel errors/times out → automatically self-pay**: resubmit via the standard `getPublicClient` (prompt 01) with normal gas, return `{ hash, mode:'self-pay', reason }`. This dual path is mandatory (00-CONTEXT: outage → self-pay).
+- `sendGasless` accepts an injected signer (viem account) — never read a private key inside this file; caller passes it.
+
+## States
+Policy declines sponsorship → self-pay silently, surface `mode`. MegaFuel 5xx/timeout →
+self-pay. Self-pay also fails (no gas, revert) → typed error with the on-chain reason.
+Malformed tx → 400-style typed error before any network call.
+
+## Tests (`tests/bnb-megafuel.test.js`)
+- `isSponsorable` maps a mocked `{sponsorable:true}` and `{sponsorable:false,reason}` correctly.
+- `sendGasless` sponsored path: mock `pm_isSponsorable=true` + raw send → `mode:'sponsored'`.
+- **Fallback path** (the important one): mock `pm_isSponsorable=false` → asserts a self-pay submit happened and `mode:'self-pay'`. Also mock MegaFuel throwing → still self-pays.
+- No private key ever appears in the module (grep-style assertion in test or code review note).
+- Use a synthetic/testnet throwaway account; never a real third-party key.
+
+## Definition of done
+Inherit 00-CONTEXT DoD. Additionally:
+- [ ] Live probe `pm_isSponsorable` against the public testnet MegaFuel endpoint with a real sample tx; paste the raw JSON reply in PROGRESS (even a policy "no" is valid proof the wire works).
+- [ ] If a real sponsored send succeeds on testnet, paste the tx hash + BscScan link showing `gasPrice 0`. If sponsorship is gated behind a NodeReal account we lack, prove the self-pay path with a real testnet tx hash and record the exact policy-signup step in PROGRESS.
+- [ ] `.env.example`: add `NODEREAL_MEGAFUEL_KEY=` (commented, optional) — code must work without it.
diff --git a/prompts/bnb-chain/03-gasless-agent-registration.md b/prompts/bnb-chain/03-gasless-agent-registration.md
new file mode 100644
index 000000000..d8074b5ab
--- /dev/null
+++ b/prompts/bnb-chain/03-gasless-agent-registration.md
@@ -0,0 +1,42 @@
+# 03 — Gas-free ERC-8004 agent registration on BSC
+
+Read `prompts/bnb-chain/00-CONTEXT.md` first, then `/workspaces/three.ws/CLAUDE.md`.
+**Prereqs: 02** (`api/_lib/bnb/megafuel.js`), which needs 01. Run them first if missing.
+
+## Why
+ERC-8004 identity registry is ALREADY live on BSC(56) at our CREATE2 address
+(`contracts/DEPLOYMENTS.md`, `src/erc8004/abi.js`). Right now a new agent needs BNB for gas
+to register. Make **registration gasless** via MegaFuel — a brand-new empty wallet mints its
+agent identity from the first click. This is the single most demo-able "only on BNB Chain"
+flow: zero-balance wallet → on-chain identity, no faucet, no funding. (bnb-chain's own
+`bnbagent-sdk` does exactly this — we're matching it natively in our stack.)
+
+## Build — `api/bnb/register-agent.js` (server endpoint) + wire to existing identity UI
+- Free plain-handler endpoint (00-CONTEXT free pattern). `POST` body: `{ signedRegisterTx }`
+ OR `{ agentMeta, accountAddress }` depending on where signing happens — prefer the client
+ signs (never take a raw private key server-side), server relays via `sendGasless`.
+- Flow: accept the user's signed ERC-8004 `register` tx (gasPrice 0), call
+ `megafuel.sendGasless('bscTestnet', ...)`, return `{ hash, mode, agentId?, explorerUrl }`.
+ Reuse the ERC-8004 ABI from `src/erc8004/abi.js` — do NOT redefine it.
+- On sponsorship decline, self-pay path still completes (prompt 02 guarantees it) — surface
+ `mode` so the UI can say "sponsored" vs "you paid gas".
+- Wire a "Register on BNB (gasless)" affordance into the existing ERC-8004 identity surface
+ (find it: grep `erc8004` under `src/` and `pages/`; add the button where identity is
+ created, network-selectable to BSC testnet). Show the resulting agentId + BscScan link.
+
+## States
+Empty wallet, no BNB → sponsored path mints anyway (the whole point; prove it). Sponsorship
+unavailable → clear "you'll pay ~$0.001 gas" prompt, then self-pay. Already-registered
+address → surface existing agentId, don't double-mint. Tx revert → decode + show reason.
+
+## Tests (`tests/bnb-register-agent.test.js`)
+- Endpoint relays a signed tx through `sendGasless` (mocked) and returns the hash + mode.
+- Rejects a request missing the signed tx / address with 400.
+- Parses `agentId` from a mocked `Transfer`/`Registered` receipt log.
+- Uses synthetic addresses only.
+
+## Definition of done
+Inherit 00-CONTEXT DoD. Additionally:
+- [ ] REAL testnet proof: register an agent from a freshly-created wallet; paste the tx hash, the minted `agentId`, and the BscScan link. If sponsored, note `gasPrice 0` and that the wallet held 0 tBNB before the tx — that screenshot is the campaign's headline.
+- [ ] `docs/`: add a "Gasless agent registration on BNB" section to the ERC-8004 / identity doc (find the existing one under `docs/`), with the named use-case and a runnable example.
+- [ ] `data/changelog.json`: entry (tags `feature`, `sdk`) — "Register your agent identity on BNB Chain with zero gas".
diff --git a/prompts/bnb-chain/04-mpp-server-adapter.md b/prompts/bnb-chain/04-mpp-server-adapter.md
new file mode 100644
index 000000000..8fe943d87
--- /dev/null
+++ b/prompts/bnb-chain/04-mpp-server-adapter.md
@@ -0,0 +1,43 @@
+# 04 — Accept MPP payments on a pilot endpoint
+
+Read `prompts/bnb-chain/00-CONTEXT.md` first, then `/workspaces/three.ws/CLAUDE.md`.
+**Prereqs: 01** (`api/_lib/bnb/chains.js`). Run it first if missing.
+
+## Why
+`@bnb-chain/mpp` is BNB Chain's Machine Payments Protocol — their answer to x402, with 402
+flows over `permit2` / EIP-3009 / EIP-1559, spanning BSC + opBNB + the wider EVM (incl.
+Base). We already run an x402 catalog. Making ONE of our paid endpoints ALSO speak MPP means
+BNB-ecosystem agents (which reach for MPP, not x402) can pay us. First-mover: an
+x402↔MPP-bilingual endpoint is likely novel. Keep it surgical — one pilot endpoint, real.
+
+## Build
+- `api/_lib/bnb/mpp-server.js` — wrap `@bnb-chain/mpp` server (`chargeAsync` / `Mppx.create`
+ per its README: `mpp-sdk` supports `authorization`/`permit2`/`transaction`/`hash`
+ credentials with a replay store). Provide `mppChallenge(routeMeta)` and
+ `mppVerifyAndSettle(req)` helpers mirroring our x402 dance shape. Use a durable replay
+ store if one exists in our stack (grep for redis/kv usage); else the SDK's memory store with
+ a `// replace with durable store in prod` note is NOT allowed — wire the real KV we already
+ use, or document precisely which env var enables it.
+- Pick ONE existing paid endpoint as the pilot (recommend `api/x402/three-intel.js` — clean,
+ read-only). Add MPP as an ALTERNATE payment path: if the request carries an MPP
+ `PAYMENT`/402 credential header, settle via `mpp-server.js`; otherwise the existing x402
+ path is untouched. Do not break the x402 flow — additive only.
+- Advertise MPP support in the endpoint's response headers / discovery metadata so MPP
+ clients know they can pay here.
+
+## States
+No payment → return BOTH an x402 402 challenge and an MPP `402` challenge (content-negotiated
+or dual-header, per MPP spec). Bad MPP signature → MPP-spec error, not a generic 500. Replay
+→ rejected by the replay store. Settlement fails on-chain → typed error with reason.
+
+## Tests (`tests/bnb-mpp-server.test.js`)
+- `mppChallenge` emits a spec-shaped 402 for the pilot route.
+- A mocked valid `authorization` (EIP-3009) credential verifies + would-settle.
+- Replay: same credential twice → second rejected.
+- The existing x402 path on the pilot endpoint still passes its current tests (run them).
+
+## Definition of done
+Inherit 00-CONTEXT DoD. Additionally:
+- [ ] Real proof: drive the pilot endpoint with an MPP client (prompt 05's buyer, or the SDK's example client) on testnet; paste the 402 challenge JSON and a successful settlement receipt.
+- [ ] Docs handled in prompt 06 — but leave a `docs/bnb-payments.md` stub section header for the server side so 06 can fill it, OR note in PROGRESS that 06 owns it.
+- [ ] `data/changelog.json`: entry (tags `feature`, `sdk`) — "three.ws now accepts BNB Chain MPP payments".
diff --git a/prompts/bnb-chain/05-mpp-buyer-client.md b/prompts/bnb-chain/05-mpp-buyer-client.md
new file mode 100644
index 000000000..34e0090ef
--- /dev/null
+++ b/prompts/bnb-chain/05-mpp-buyer-client.md
@@ -0,0 +1,41 @@
+# 05 — MPP buyer client (our agents pay MPP endpoints)
+
+Read `prompts/bnb-chain/00-CONTEXT.md` first, then `/workspaces/three.ws/CLAUDE.md`.
+**Prereqs: 01** (`api/_lib/bnb/chains.js`). Run it first if missing.
+
+## Why
+The mirror of prompt 04. Our platform's agents should be able to PAY any MPP-protected
+endpoint in the BNB ecosystem, the same way they already pay x402 endpoints via
+`api/_lib/x402-buyer-fetch.js`. This unlocks the whole BNB agent economy as callable
+services for our agents. Model on the existing x402 buyer so the ergonomics match.
+
+## Build — `api/_lib/bnb/mpp-buyer.js`
+- Read `api/_lib/x402-buyer-fetch.js` first — match its interface shape (a fetch-like wrapper
+ that transparently handles the 402 → pay → retry loop).
+- Export `mppFetch(url, opts, { account, maxSpend })` using `@bnb-chain/mpp` client:
+ on a `402`, parse the MPP challenge, construct the appropriate credential
+ (`authorization` EIP-3009 or `permit2`, per what the challenge accepts), attach it, retry.
+ Enforce a **hard `maxSpend` cap** (atomic units) — never pay above it; return a typed
+ "over budget" error instead. Caller injects the signing account; never read keys here.
+- Support BSC testnet by default; parameterize network.
+
+## States
+Endpoint quotes above `maxSpend` → refuse, typed error, no payment sent. Challenge in an
+unsupported credential type → clear error naming what's supported. Settlement broadcast fails
+→ surface the on-chain reason, do not silently retry-forever (bounded retries).
+
+## Tests (`tests/bnb-mpp-buyer.test.js`)
+- Happy path: mock a server that 402s then 200s → `mppFetch` pays and returns the body.
+- `maxSpend` enforcement: challenge above cap → refused, zero payment attempted.
+- Unsupported credential type → typed error.
+- Uses a synthetic testnet account.
+
+## Definition of done
+Inherit 00-CONTEXT DoD. Additionally:
+- [ ] Real proof: point `mppFetch` at prompt 04's pilot endpoint (or the `@bnb-chain/mpp`
+ example server) on testnet; paste the full round-trip — 402 challenge, the credential
+ sent, and the 200 body with the settlement receipt.
+- [ ] Wire it where our agents already select a payment method (grep for
+ `x402-buyer-fetch` usages) so MPP endpoints become callable — at minimum expose it from
+ the same module surface agents already import, with a short JSDoc example.
+- [ ] Docs owned by prompt 06 (buyer side) — note readiness in PROGRESS.
diff --git a/prompts/bnb-chain/06-payments-bridge-docs.md b/prompts/bnb-chain/06-payments-bridge-docs.md
new file mode 100644
index 000000000..1875acfea
--- /dev/null
+++ b/prompts/bnb-chain/06-payments-bridge-docs.md
@@ -0,0 +1,34 @@
+# 06 — BNB payments docs + x402↔MPP bridge spec
+
+Read `prompts/bnb-chain/00-CONTEXT.md` first, then `/workspaces/three.ws/CLAUDE.md`.
+**Prereqs: 04 and 05** (server + buyer must exist to document them truthfully). If either is
+missing, run it first — do NOT document unbuilt behavior.
+
+## Why
+Track A ships two halves (we accept MPP; we pay MPP) plus gasless rails. A developer needs
+one page that explains the whole BNB payments story and one spec that pins the wire-level
+relationship between our x402 usage and MPP so future code has a contract to build against.
+
+## Build
+1. `docs/bnb-payments.md` — zero-context reader. Cover: (a) what MPP is and how it relates to
+ x402; (b) how to PAY our endpoints with MPP (buyer POV, runnable example against the pilot
+ endpoint from 04); (c) how OUR agents pay MPP endpoints via `mpp-buyer.js` (runnable
+ example); (d) gasless sends via MegaFuel (`megafuel.js`) with the self-pay fallback
+ explained honestly; (e) the honest caveats from 00-CONTEXT (MegaFuel is one operator,
+ BEP-414 Draft). Every code sample must actually run. Link it from `docs/start-here.md`.
+2. `specs/x402-mpp-bridge.md` — the load-bearing contract: which credential types map across
+ x402 and MPP, how a dual-protocol endpoint advertises both, the header precedence rules,
+ and the replay-store guarantees. This is a spec (contract), not a tutorial — precise, no
+ fluff. Reference the exact code paths in `api/_lib/bnb/mpp-server.js` and `mpp-buyer.js`.
+
+## States
+N/A (docs) — but every claim must be consistent with 00-CONTEXT's verified/refuted lists and
+with the actual code. If the code and a draft sentence disagree, the CODE wins; fix the doc.
+
+## Definition of done
+Inherit 00-CONTEXT DoD. Additionally:
+- [ ] Every `curl`/code sample in `docs/bnb-payments.md` executed once against testnet; paste one real run in PROGRESS.
+- [ ] `data/pages.json`: if `docs/bnb-payments.md` is served as a public route, register it.
+- [ ] `STRUCTURE.md`: add or update a row for the BNB payments surface.
+- [ ] `data/changelog.json`: entry (tag `docs`) — "BNB Chain payments guide (MPP + gasless)".
+- [ ] Links resolve to live paths; no "see the code" hand-waves.
diff --git a/prompts/bnb-chain/07-greenfield-read-client.md b/prompts/bnb-chain/07-greenfield-read-client.md
new file mode 100644
index 000000000..b91b42ea1
--- /dev/null
+++ b/prompts/bnb-chain/07-greenfield-read-client.md
@@ -0,0 +1,38 @@
+# 07 — Greenfield read client (SP + chain reads)
+
+Read `prompts/bnb-chain/00-CONTEXT.md` first, then `/workspaces/three.ws/CLAUDE.md`.
+**Prereqs: 01** (`api/_lib/bnb/chains.js`). Run it first if missing.
+
+## Why
+Track B (pay-to-unlock 3D vault) needs to read Greenfield: list buckets/objects, fetch object
+metadata, check permissions, and download bytes from a Storage Provider. Build the read layer
+first, in isolation, against Greenfield testnet — so upload (09) and unlock (11) compose it.
+
+## Build — `api/_lib/bnb/greenfield.js`
+- Use `@bnb-chain/greenfield-js-sdk` (open-source-first). Read Greenfield testnet
+ chain/SP/RPC endpoints from the SDK docs or `bnb-chain/greenfield-contracts` — never invent.
+- Export read-only helpers: `listObjects(bucket)`, `getObjectMeta(bucket, object)`,
+ `headBucket(bucket)`, `getObjectPermissions(bucket, object, principal)` (does this account
+ or group have read access?), and `downloadObject(bucket, object, { authForPrivate })` which
+ streams bytes from an SP. `authForPrivate` carries the signature/permission proof for
+ private objects (public objects need none).
+- All reads default to Greenfield testnet; parameterize network.
+
+## States
+Object doesn't exist → typed not-found. Private object, no permission → typed
+`forbidden` (this is the expected "locked" state the vault relies on — surface it cleanly,
+don't treat as an error). SP unreachable → try the next SP if the SDK exposes a list, else
+typed 503. Async-mirror lag → callers may see `pending`; expose it, don't mask.
+
+## Tests (`tests/bnb-greenfield-read.test.js`)
+- `getObjectMeta` shape asserted against a mocked SP response.
+- `getObjectPermissions` returns `false` for a principal not in the policy (mocked).
+- `downloadObject` on a forbidden private object → typed `forbidden`, not a throw-500.
+- No real third-party bucket names in fixtures — synthetic.
+
+## Definition of done
+Inherit 00-CONTEXT DoD. Additionally:
+- [ ] Real proof: against Greenfield testnet, read a public object's metadata you created (or
+ any public testnet object) and paste the real JSON. Prove the `forbidden` path by
+ reading a private object without permission and pasting the typed error.
+- [ ] Internal lib — JSDoc on each export; docs deferred to prompt 13.
diff --git a/prompts/bnb-chain/08-vault-crypto-format.md b/prompts/bnb-chain/08-vault-crypto-format.md
new file mode 100644
index 000000000..9707dffee
--- /dev/null
+++ b/prompts/bnb-chain/08-vault-crypto-format.md
@@ -0,0 +1,43 @@
+# 08 — Encrypted-GLB envelope + vault manifest spec
+
+Read `prompts/bnb-chain/00-CONTEXT.md` first, then `/workspaces/three.ws/CLAUDE.md`.
+**Prereqs: none.** Pure crypto + spec work; runs fully standalone.
+
+## Why
+The vault stores 3D models (GLB) so that even though bytes live on a public-ish Storage
+Provider, only a paying/authorized buyer can decrypt them. We need a portable encryption
+envelope + a manifest format, decided ONCE and specced, so the upload (09), contract (10),
+and unlock (11) prompts all agree. Keeping this backend-agnostic hedges the Greenfield
+platform-risk from 00-CONTEXT.
+
+## Build
+1. `api/_lib/bnb/vault-crypto.js` — real crypto, no hand-rolled primitives (CLAUDE.md: never
+ reinvent crypto). Use Node `crypto` (AES-256-GCM) + an established lib for key wrapping if
+ needed. Export:
+ - `encryptGlb(glbBytes) → { ciphertext, contentKey, iv, authTag, sha256OfPlaintext }` —
+ AES-256-GCM with a random per-object content key.
+ - `wrapKey(contentKey, recipientPubKey)` / `unwrapKey(wrapped, recipientPrivKey)` — so the
+ content key can be delivered to an authorized buyer without exposing it publicly (ECIES
+ over secp256k1 to match EVM keys — use a vetted lib, e.g. `eciesjs`, if present/addable).
+ - `decryptGlb({ ciphertext, contentKey, iv, authTag }) → glbBytes`, verifying the auth tag
+ and the plaintext sha256.
+2. `specs/vault-manifest.md` — the wire contract: the JSON manifest stored alongside each
+ vault object `{ version, glbObjectRef:{bucket,object}, encryption:{alg:'AES-256-GCM',iv,authTag}, sha256, priceAtomic, sellerAddress, contract:{address,chainId}, createdAt }`, the
+ key-delivery flow, and the exact byte layout of the envelope. This is a contract other
+ code depends on — precise, versioned.
+
+## States
+Tampered ciphertext / wrong key → GCM auth-tag failure surfaces as a typed decrypt error,
+never silent garbage. Wrong-size key → reject before use.
+
+## Tests (`tests/bnb-vault-crypto.test.js`)
+- Round-trip: `encryptGlb` → `decryptGlb` returns identical bytes; sha256 matches.
+- Tamper one ciphertext byte → decrypt throws typed auth error.
+- `wrapKey`/`unwrapKey` round-trips with a secp256k1 keypair; wrong key fails.
+- Use a tiny synthetic GLB fixture (a few bytes is fine).
+
+## Definition of done
+Inherit 00-CONTEXT DoD. Additionally:
+- [ ] Paste a real round-trip proof (encrypt→upload-agnostic→decrypt of a real small GLB) in PROGRESS with the sha256 matching.
+- [ ] `specs/vault-manifest.md` complete and referenced by name from prompts 09/10/11 expectations.
+- [ ] Dependency check: if you add `eciesjs` (or similar), pin `^` semver, justify in commit msg (CLAUDE.md open-source-first + pinning rule).
diff --git a/prompts/okx-ai/e2e-evidence/01-catalog-body.json b/prompts/okx-ai/e2e-evidence/01-catalog-body.json
new file mode 100644
index 000000000..484b8de19
--- /dev/null
+++ b/prompts/okx-ai/e2e-evidence/01-catalog-body.json
@@ -0,0 +1 @@
+{"provider":"three.ws 3D Studio","okxAgentId":2632,"chain":"eip155:196","services":[{"id":"identity-studio","name":"Agent Identity Studio","kind":"a2mcp","description":{"capability":"Creates a 3D identity for an AI agent from a text brief: a rigged, animation-ready GLB avatar plus posed studio renders — a square PFP sized for the OKX avatar slot and full-body shots.","input":"Call create_identity with agent_name and a brief (any language); optional style_hints and reference_image_url. Returns a job_id — poll identity_status free until the deliverables are ready."},"price_usd":"1.50","endpoint":"https://three.ws/api/okx/3d/identity-studio","tool":"create_identity","input_schema":{"type":"object","required":["agent_name","brief"],"additionalProperties":false,"properties":{"agent_name":{"type":"string","minLength":1,"maxLength":80,"description":"The agent’s display name. Rendered into the identity brief."},"brief":{"type":"string","minLength":3,"maxLength":4000,"description":"Personality / brand description in any language. Longer than 2000 characters is truncated (the response flags brief_truncated)."},"style_hints":{"type":"string","maxLength":500,"description":"Optional visual direction: palette, materials, era, mood."},"reference_image_url":{"type":"string","format":"uri","description":"Optional public image to guide the look. Validated before any charge — an unreachable URL fails the call without settling payment."}}}},{"id":"text-to-3d","name":"Text to 3D Model (GLB)","kind":"rest","description":{"capability":"Generates a textured, downloadable 3D model (GLB) from a text prompt on the fast draft lane. Returns the finished GLB URL inline or a job to poll for free. Paid only when the job is accepted.","input":"POST JSON with prompt (3-1000 chars) describing one object or character; optional aspect_ratio. Poll poll_url free until status is done."},"price_usd":"0.01","endpoint":"https://three.ws/api/okx/3d/text-to-3d","input_schema":{"type":"object","required":["prompt"],"additionalProperties":false,"properties":{"prompt":{"type":"string","minLength":3,"maxLength":1000},"aspect_ratio":{"type":"string","enum":["1:1","4:3","3:4","16:9","9:16"]}}}},{"id":"text-to-3d-pro","name":"Text to 3D Model (Pro)","kind":"rest","description":{"capability":"Art-directed text to 3D: an LLM art director refines the prompt, then a higher-quality lane generates the textured GLB — standard tier by default, high for maximum detail plus PBR textures.","input":"POST JSON with prompt (3-1000 chars); optional tier standard|high and aspect_ratio. Returns the GLB URL inline or job_id + poll_url; polling is free."},"price_usd":"0.30","endpoint":"https://three.ws/api/okx/3d/text-to-3d-pro","input_schema":{"type":"object","required":["prompt"],"additionalProperties":false,"properties":{"prompt":{"type":"string","minLength":3,"maxLength":1000},"tier":{"type":"string","enum":["standard","high"]},"aspect_ratio":{"type":"string","enum":["1:1","4:3","3:4","16:9","9:16"]}}}},{"id":"image-to-3d","name":"Image to 3D Model","kind":"rest","description":{"capability":"Reconstructs a textured 3D model (GLB) from one to four reference photos of a single object. Paid per call; the job is polled for free until done.","input":"POST JSON with image_urls: 1-4 public https photos of the same object; optional prompt hint. Returns the GLB URL or job_id + poll_url."},"price_usd":"0.30","endpoint":"https://three.ws/api/okx/3d/image-to-3d","input_schema":{"type":"object","required":["image_urls"],"additionalProperties":false,"properties":{"image_urls":{"type":"array","items":{"type":"string","format":"uri"},"minItems":1,"maxItems":4},"prompt":{"type":"string","maxLength":1000}}}},{"id":"rig","name":"Auto-Rig a GLB","kind":"rest","description":{"capability":"Auto-rigs a static humanoid GLB into an animation-ready model: adds a skeleton and skin weights so it can be posed and animated in any engine. Paid per call; job polling is free.","input":"POST JSON with glb_url: public https URL of the static GLB to rig. Humanoid models rig best. Returns job_id + poll_url; poll free until done."},"price_usd":"0.25","endpoint":"https://three.ws/api/okx/3d/rig","input_schema":{"type":"object","required":["glb_url"],"additionalProperties":false,"properties":{"glb_url":{"type":"string","format":"uri"}}}},{"id":"avatar","name":"Text to Rigged Avatar","kind":"rest","description":{"capability":"One call from text to an animation-ready character: generates the mesh, then auto-rigs a humanoid skeleton. Non-humanoid prompts are steered to plain mesh generation instead of a wasted rig pass.","input":"POST JSON with prompt describing a full-body character, or image_url reference; optional allow_non_humanoid. Returns the mesh GLB plus a rig job to poll free."},"price_usd":"0.50","endpoint":"https://three.ws/api/okx/3d/avatar","input_schema":{"type":"object","additionalProperties":false,"properties":{"prompt":{"type":"string","maxLength":1000},"image_url":{"type":"string","format":"uri"},"allow_non_humanoid":{"type":"boolean"}}}},{"id":"retarget","name":"Animation Retarget","kind":"rest","description":{"capability":"Retargets a curated animation clip (idle, walk, dance and more) onto any rigged humanoid GLB. Returns the clip keyed to the rig plus a bone-coverage report. Completes in-request.","input":"POST JSON with model_url (rigged GLB https URL) and animation (preset name); optional format glb|clip and speed 0.25-2.5."},"price_usd":"0.10","endpoint":"https://three.ws/api/okx/3d/retarget","input_schema":{"type":"object","required":["model_url","animation"],"additionalProperties":false,"properties":{"model_url":{"type":"string","format":"uri"},"animation":{"type":"string"},"format":{"type":"string","enum":["glb","clip"]},"speed":{"type":"number","minimum":0.25,"maximum":2.5}}}},{"id":"pose-seed","name":"Pose Seed","kind":"rest","description":{"capability":"Resolves a natural-language pose description to a deterministic pose seed and a full joint-rotation map for humanoid rigs. The same prompt always returns the same pose. Completes in-request.","input":"POST JSON with prompt (pose description, 1-500 chars). Returns the seed, per-joint rotations, and a preview link."},"price_usd":"0.02","endpoint":"https://three.ws/api/okx/3d/pose-seed","input_schema":{"type":"object","required":["prompt"],"additionalProperties":false,"properties":{"prompt":{"type":"string","minLength":1,"maxLength":500}}}},{"id":"fbx-export","name":"FBX Export (rig-preserving)","kind":"rest","description":{"capability":"Converts a GLB to FBX for Unity/Unreal — a rigged GLB keeps its skeleton, skin weights, and blendshapes. Also exports obj, stl, ply, usdz, and 3mf. Paid per call; job polling is free.","input":"POST JSON with model_url (GLB https URL); optional format (default fbx). Returns job_id + poll_url; poll free until done."},"price_usd":"0.10","endpoint":"https://three.ws/api/okx/3d/fbx-export","input_schema":{"type":"object","required":["model_url"],"additionalProperties":false,"properties":{"model_url":{"type":"string","format":"uri"},"format":{"type":"string","enum":["fbx","obj","stl","ply","usdz","3mf"]}}}},{"id":"catalog","name":"3D Studio Catalog (free)","kind":"rest","description":{"capability":"Free machine-readable index of every three.ws 3D Studio service on OKX.AI: names, descriptions, prices, endpoints, and input schemas — generated from the module the endpoints run on.","input":"GET with no parameters. No payment, no account."},"price_usd":"0","endpoint":"https://three.ws/api/okx/3d/catalog"},{"id":"health","name":"3D Studio Health (free)","kind":"rest","description":{"capability":"Free live health of the 3D studio lanes backing every paid service: generation, rigging, rendering, and storage — real subsystem probes, not a hardcoded OK.","input":"GET with no parameters. No payment, no account."},"price_usd":"0","endpoint":"https://three.ws/api/okx/3d/health"}],"docs":"https://three.ws/docs/okx-marketplace"}
\ No newline at end of file
diff --git a/prompts/okx-ai/e2e-evidence/01-health-body.json b/prompts/okx-ai/e2e-evidence/01-health-body.json
new file mode 100644
index 000000000..8b5c2898b
--- /dev/null
+++ b/prompts/okx-ai/e2e-evidence/01-health-body.json
@@ -0,0 +1 @@
+{"ok":true,"subsystems":[{"name":"generation","ok":true,"latency_ms":44,"status":400},{"name":"render","ok":true,"latency_ms":41,"poses":28},{"name":"storage","ok":true,"latency_ms":118},{"name":"retarget","ok":true,"latency_ms":45,"clips":103},{"name":"payment-rail","ok":true,"latency_ms":470,"settleable":true,"block":"64654141","token":"USD₮0","facilitator_configured":false}],"checkedAt":"2026-07-07T11:19:38.408Z"}
\ No newline at end of file
diff --git a/prompts/okx-ai/e2e-evidence/01-health-headers.txt b/prompts/okx-ai/e2e-evidence/01-health-headers.txt
new file mode 100644
index 000000000..2ddbdfd4a
--- /dev/null
+++ b/prompts/okx-ai/e2e-evidence/01-health-headers.txt
@@ -0,0 +1,22 @@
+HTTP/2 200
+access-control-allow-headers: authorization, content-type, mcp-session-id, mcp-protocol-version, x-payment, payment-signature, idempotency-key, x-irl-device, x-irl-fix, x-forge-client, x-forge-seed
+access-control-allow-methods: GET,HEAD,POST,DELETE,OPTIONS
+access-control-allow-origin: *
+access-control-expose-headers: PAYMENT-REQUIRED, x-payment-response, x-payment-network, x-payment-tx, link
+access-control-max-age: 86400
+age: 0
+cache-control: no-store
+content-security-policy: base-uri 'self'; object-src 'none'; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: https://cdn.jsdelivr.net https://cdnjs.cloudflare.com https://unpkg.com https://esm.sh https://ajax.googleapis.com https://s3.tradingview.com https://platform.twitter.com https://3d-agent.vercel.app https://three.ws; worker-src 'self' blob:; frame-ancestors 'self' https://ibm.com https://*.ibm.com https://*.seismic.com; report-uri /api/client-errors
+content-type: application/json; charset=utf-8
+date: Tue, 07 Jul 2026 11:19:37 GMT
+permissions-policy: accelerometer=(), autoplay=(self), bluetooth=(), camera=(), display-capture=(), encrypted-media=(self), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(self), serial=(), usb=(), xr-spatial-tracking=(self)
+referrer-policy: strict-origin-when-cross-origin
+server: Vercel
+strict-transport-security: max-age=63072000; includeSubDomains; preload
+x-content-type-options: nosniff
+x-frame-options: DENY
+x-vercel-cache: MISS
+x-vercel-id: sfo1::iad1::bl9zs-1783423176978-70e13691d2db
+content-length: 425
+
+{"ok":true,"subsystems":[{"name":"generation","ok":true,"latency_ms":199,"status":400},{"name":"render","ok":true,"latency_ms":187,"poses":28},{"name":"storage","ok":true,"latency_ms":270},{"name":"retarget","ok":true,"latency_ms":183,"clips":103},{"name":"payment-rail","ok":true,"latency_ms":701,"settleable":true,"block":"64654141","token":"USD₮0","facilitator_configured":false}],"checkedAt":"2026-07-07T11:19:37.764Z"}
\ No newline at end of file
diff --git a/prompts/okx-ai/e2e-evidence/01-x402-check.txt b/prompts/okx-ai/e2e-evidence/01-x402-check.txt
new file mode 100644
index 000000000..7b86cdc0e
--- /dev/null
+++ b/prompts/okx-ai/e2e-evidence/01-x402-check.txt
@@ -0,0 +1,6 @@
+--- text-to-3d ---
+valid: False | network: None | asset: None | amount: None | tokenResolveError: none
+--- avatar ---
+valid: False | network: None | asset: None | amount: None | tokenResolveError: none
+--- pose-seed ---
+valid: False | network: None | asset: None | amount: None | tokenResolveError: none
diff --git a/prompts/store-submissions/_generated/openai-actions.yaml b/prompts/store-submissions/_generated/openai-actions.yaml
index b058f4eb5..01b020be3 100644
--- a/prompts/store-submissions/_generated/openai-actions.yaml
+++ b/prompts/store-submissions/_generated/openai-actions.yaml
@@ -20,8 +20,14 @@ info:
contact:
name: three.ws
url: https://three.ws
+ license:
+ name: three.ws Terms of Service
+ url: https://three.ws/legal/tos.html
servers:
- url: https://three.ws
+# No authentication: the free text-to-3D lane needs no API key, account, or
+# wallet. An explicit empty root security requirement declares that plainly.
+security: []
paths:
/api/3d/studio:
post:
diff --git a/public/eth-vanity.html b/public/eth-vanity.html
index 829a7a601..5ce0b0a3c 100644
--- a/public/eth-vanity.html
+++ b/public/eth-vanity.html
@@ -29,7 +29,11 @@
}
main { flex: 1; max-width: 720px; width: 100%; margin: 0 auto; padding: 2.5rem 1rem 4rem; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; font-family: var(--font-display); letter-spacing: -0.02em; }
- p.lede { color: var(--muted); margin: 0 0 1.5rem; }
+ p.lede { color: var(--muted); margin: 0 0 1rem; }
+ .sibling-note { display: flex; gap: .5rem; align-items: flex-start; font-size: .78rem; color: var(--muted); background: #0a0a0a; border: 1px solid var(--border); border-radius: 8px; padding: .65rem .8rem; margin: 0 0 1.5rem; }
+ .sibling-note svg { flex: none; margin-top: 1px; color: #ffd54f; }
+ .sibling-note a { color: #ffd54f; text-decoration: none; }
+ .sibling-note a:hover { text-decoration: underline; }
label { display: block; font-size: .8rem; color: var(--muted); margin: 1rem 0 .25rem; }
.card { border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem 1.25rem; background: var(--card-bg); margin-bottom: 1rem; }
.card h2 { font-size: .95rem; margin: 0 0 .35rem; font-family: var(--font-display); letter-spacing: -0.01em; }
@@ -173,6 +177,14 @@
Runs entirely in your browser.
</p>
+ <div class="sibling-note">
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M12 2 4 5v6c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V5l-8-3Z" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/><path d="m9 12 2 2 4-4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>
+ <span>
+ This grinds a vanity <strong>smart-contract</strong> address — you search a salt, and the address is a deterministic function of your factory + init code. No private key is involved.
+ Want a vanity <strong>wallet</strong> you hold the key to? Use the <a href="/evm-wallet">EVM vanity wallet generator</a> — it grinds a real secp256k1 keypair in your browser.
+ </span>
+ </div>
+
<div class="card">
<h2>1. Factory + init code</h2>
<p class="desc">CREATE2 fixes the deployer address and the init code; only the salt is yours to choose.</p>