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 Atelier plaza and world page, expand arena venue and entry desk

nirholasc38a6d2eeb16
diff --git a/docs/omniology-arena/03-live-contest-screens.md b/docs/omniology-arena/03-live-contest-screens.md
index 6845c845b..61944d20c 100644
--- a/docs/omniology-arena/03-live-contest-screens.md
+++ b/docs/omniology-arena/03-live-contest-screens.md
@@ -5,20 +5,27 @@ contest with a ~88-second countdown, a leaderboard, and a live ticker of recent
entries. Real data from Omniology's feed — no mocks, no sample arrays.
## Read first (required)
-- `docs/omniology-arena/README.md`, `docs/omniology-arena/CONTRACTS.md` (esp. §1.1 feed shape and §2.1/§2.2 module contracts), `CLAUDE.md`
+- `docs/omniology-arena/README.md`, `docs/omniology-arena/CONTRACTS.md` (esp. §1.1 feed, §1.6 leaderboard, §2.1/§2.2/§2.5 module contracts), `docs/omniology-arena/SECURITY.md` (C3–C5 — the proxy enforces these), `CLAUDE.md`
+- `api/x402-pay.js` for the SSRF-guarded `guardedFetch` (host-pinned, size/timeout bounded) you reuse in the proxy; `api/_lib/ssrf.js`.
- `src/game/chart-screen.js` — the proven live-screen pattern to generalize: a `CanvasTexture` (sRGB, anisotropy) on a `PlaneGeometry`, a poll loop with `clearTimeout`/`setTimeout`, a `draw()` that paints loading/live/empty/error states, a `~10fps` redraw (`REDRAW_MS = 100`) via `update(dt)`, clickable raycast, and a clean `dispose()`. Mirror its structure closely.
- `src/game/coincommunities.js` `_buildScreen()` / `_drawScreen()` (~592–720) — event-driven redraw and canvas layout reference.
- `src/game/arena/arena.js` (prompt 01) — `registerUpdatable()` and `this.anchors.screens[]` (prompt 02).
## Build
-1. **Adapter** `src/game/arena/omniology-adapter.js` per CONTRACTS §2.1 — the
- ONLY module that knows Omniology's wire shapes. `omniologyBase()` reads
- `<meta name="omniology-base">` or `VITE_OMNIOLOGY_BASE`. `fetchLiveFeed()`
- calls `GET {base}/v1/contests/live`, normalizes to `NormalizedFeed`
- (ms timestamps, camelCase), and throws on network error. Also export
- `submitEntryRequest(contestId, entry, agent)` for prompt 04 (define it now so
- the boundary is fixed). **If `omniologyBase()` is empty, `fetchLiveFeed()`
- must surface a clear "unconfigured" status — never return fabricated data.**
+1. **Server proxy** `api/arena/omniology-feed.js` per CONTRACTS §2.5 — read-through,
+ short-TTL cache (~5s) over `GET {OMNIOLOGY_ENGINE_BASE}/v1/contests/active`
+ (and the leaderboard, §1.6). Use the SSRF-guarded `guardedFetch` host-pinned to
+ the engine; enforce a response size limit + content-type check (SECURITY.md C3)
+ and clamp/strip partner strings (C4). The browser only ever talks to this proxy,
+ never the engine (privacy, C5). Expose e.g. `GET /api/arena/omniology-feed` and
+ `GET /api/arena/omniology-feed?leaderboard={contestId}`.
+2. **Adapter** `src/game/arena/omniology-adapter.js` per CONTRACTS §2.1 — the ONLY
+ client module that knows Omniology shapes. `omniologyBase()` reads
+ `<meta name="omniology-base">` / `VITE_OMNIOLOGY_BASE` (OUR proxy base, default
+ `/api/arena`). `fetchLiveFeed()` GETs the proxy, normalizes to `NormalizedFeed`
+ (ms timestamps, camelCase, picks `current` = soonest-closing open/collecting
+ contest), throws on network error. `fetchLeaderboard(contestId)` via the proxy.
+ **If unconfigured, surface a clear "unconfigured" status — never fabricate data.**
2. **Screen component** `src/game/arena/contest-screen.js` per CONTRACTS §2.2 —
`createContestScreen(scene, { position, width, rotationY })`. Three logical
panels rendered to the canvas:
@@ -47,10 +54,14 @@ entries. Real data from Omniology's feed — no mocks, no sample arrays.
"connecting to Omniology" placeholder, not fake leaderboard rows).
## Acceptance criteria
-- With `VITE_OMNIOLOGY_BASE` (or the meta tag) pointed at Omniology's real or
- sandbox feed, the screens show live contests, a counting-down ~88s clock that
- stays in sync across a round flip, a populated leaderboard, and entries
- ticking in. Verified in a real browser against a real endpoint.
+- With `OMNIOLOGY_ENGINE_BASE` set (server) and the proxy live, the screens show
+ real contests from `/v1/contests/active`, a counting-down ~88s clock
+ (`time_remaining_seconds`/`submission_closes_at`) that stays in sync across a
+ round flip, a populated leaderboard (§1.6), and entries ticking in. Verified in
+ a real browser against the real engine (or sandbox).
+- The browser only calls our proxy; the proxy enforces size/content-type (C3) and
+ string clamping (C4). Confirm in the Network tab the engine host is never hit
+ directly from the client.
- With no base configured, screens show the designed unconfigured/connecting
state — never invented data. (This satisfies no-mocks while unblocked of the
partner.)
@@ -61,5 +72,6 @@ entries. Real data from Omniology's feed — no mocks, no sample arrays.
## Hand-off
Export the screen handles (or a `pushEntry` hook) so prompt 04's desk can call
-`pushEntry()` on successful submission. Keep `submitEntryRequest()` in the
-adapter stable — prompt 04 depends on it.
+`pushEntry()` on a confirmed entry. Keep the adapter's `fetchLiveFeed()` /
+`NormalizedFeed` and the `current` selection stable — prompt 04 reads the
+featured contest (id, theme, fee, payload_format, max_payload_chars) from it.
diff --git a/docs/omniology-arena/04-entry-desk-x402-submit.md b/docs/omniology-arena/04-entry-desk-x402-submit.md
index ef71f7402..5f85185d5 100644
--- a/docs/omniology-arena/04-entry-desk-x402-submit.md
+++ b/docs/omniology-arena/04-entry-desk-x402-submit.md
@@ -1,87 +1,88 @@
-# Prompt 04 — Entry desk + x402 submission
+# Prompt 04 — Entry desk + Omniology submission
Build the in-world entry desk: a player walks up, presses E (or taps), composes
-an entry, and submits it to Omniology with a real USDC-on-Solana x402 payment —
-streamed live (challenge → settle → receipt) and reflected on the screens. This
-reuses the proven agent-commerce flow; **no scripted/fake stages**.
+an entry, and submits it to a live Omniology contest — paying the sub-cent USDC
+entry fee on Solana — with live progress and an on-chain confirmation, reflected
+on the screens.
+
+**Important:** Omniology's submit flow is **NOT x402**. Do not use
+`/api/x402-pay`. The engine builds an entry transaction; **our server signs it
+with the player's agent key and broadcasts it** (CONTRACTS §1.3). The signing
+happens server-side (agent keys are custodial). You will build a dedicated server
+endpoint plus the in-world desk that calls it.
## Read first (required)
-- `docs/omniology-arena/README.md`, `docs/omniology-arena/CONTRACTS.md` (esp. §1.2 submit, §2.1 `submitEntryRequest`, §2.3 desk contract), `CLAUDE.md`
-- `src/game/agent-commerce.js` — the reference end-to-end flow. Study: the
- `fetch('/api/x402-pay', { headers:{accept:'text/event-stream'}, body:{…} })`
- call (~428–435), the SSE consume loop (~443–467) handling
- `challenge → built → settled → result` / `error`, the reusable `_sse(res)`
- async-generator parser (~569–589), and how it renders the receipt with the
- Solscan tx link.
-- `api/x402-pay.js` — the **external flow** (`runExternalFlow` / `handleExternalPay`, ~553–697 and ~921–1029). Confirm the exact request body it accepts to pay an arbitrary external URL (`url`, `method`, `body`, `agentId`, `service_label`, `stream`) and the exact SSE event names + data shapes it emits. Build against what the code actually does — quote the lines you relied on in your final report.
-- `src/game/play-systems.js` — the interaction/action-button framework (how an interactable/zone is defined and how E/tap triggers it). Reuse this for the desk's proximity prompt.
-- `src/game/arena/arena.js` (`this.anchors.desk`), `src/game/arena/omniology-adapter.js` (`submitEntryRequest`), and the screen `pushEntry()` from prompt 03.
+- `docs/omniology-arena/README.md`, `docs/omniology-arena/CONTRACTS.md` (esp. §0, §1.3, §1.5, §2.3–2.6), `docs/omniology-arena/SECURITY.md` (C7, C1, C3–C6 — mandatory), `CLAUDE.md`
+- `api/x402-pay.js` — **reuse its safe primitives**, not its x402 logic: `requireAuth`, `requireCsrf`, `loadAgentKeypairForUser`, the SSRF-guarded `guardedFetch` (host-pinned, size/timeout bounded), `reserveSpendUsd` spend caps, and `buildSolanaPaymentPayload` as the reference for how a Solana tx is constructed/signed/broadcast with an agent keypair and the platform RPC connection. Quote the lines you reuse.
+- `api/_lib/agent-trade-guards.js` (`reserveSpendUsd`, spend-limit shape) and `api/_lib/ssrf.js` (URL guard).
+- `src/game/agent-commerce.js` — reuse ONLY the client SSE consumption pattern: the `_sse(res)` async-generator parser (~569–589) and the stepper UI/receipt rendering. The payment semantics differ; the streaming UX pattern is what you reuse.
+- `src/game/play-systems.js` — the interaction/action-button framework for the desk's proximity prompt.
+- `src/game/arena/arena.js` (`this.anchors.desk`), `src/game/arena/omniology-adapter.js` + the proxy `api/arena/omniology-feed.js` (prompt 03), and the screen `pushEntry()` handle.
## Build
-1. **Desk object + interactable** `src/game/arena/entry-desk.js` per CONTRACTS
- §2.3 — `createEntryDesk(scene, { position, rotationY, getAgentId,
- getContestId, buildEntry, onSubmitted })`. Place a tasteful desk/kiosk mesh at
- `anchors.desk`. Register a proximity interactable (reuse play-systems): when
- the player is in range, show an "Enter contest — press E" prompt with proper
- hover/active/focus affordances.
-2. **Compose UI** (`buildEntry`): an in-world/overlay form to assemble the entry
- per Omniology's required fields (from CONTRACTS §1.2 / answers to QUESTIONS).
- Validate locally against Omniology's rules **before** payment (one entry per
- round, content limits, etc.) so we never charge for a doomed entry. Designed
- empty/invalid states.
-3. **Submit flow**: on confirm, build the request via
- `submitEntryRequest(contestId, entry, agent)` and `POST /api/x402-pay` with
- `Accept: text/event-stream` and `{ url, method, body, agentId, service_label:
- 'Omniology' }`. Consume the SSE stream with the `_sse` parser. Drive a live
- stepper UI from the **real** events:
- - `challenge` → show the fee (USDC) and "awaiting signature"
- - `built` → "signed"
- - `settled` → "settled on Solana" + Solscan link from `data.explorer`
- - `result` → success: show the confirmation (entry id / round / position from
- Omniology's response body) and call `onSubmitted(...)`
- - `error` → designed, recoverable error (and make clear no funds moved if it
- failed before `settled`; if `settle_uncertain`, show the exact warning the
- API returns — do not silently retry).
-4. **Cross-wire to screens**: `onSubmitted` calls the screen `pushEntry({ agent,
- entryId })` so the player sees their entry hit the live ticker immediately,
- then the next poll reconciles it. Also play a small in-world celebration
- (sound + light pulse) on success — tasteful, gated by reduced-motion.
-5. **Free-entry path**: if Omniology confirms entries are free (QUESTIONS #7),
- POST directly to the submit URL (no x402) and skip the payment stepper. Keep
- both paths implemented and selected by the adapter, not by a hardcoded flag.
-## Security (MANDATORY — see `docs/omniology-arena/SECURITY.md`)
-The desk pays a third-party endpoint with a player's real funds. You MUST
-implement and prove these before this prompt is "done":
-- **C1 — Pin the recipient.** Reject any 402 `payTo` that is not Omniology's
- verified, fixed Solana address (add `x402_recipient_allowlist` to spend-limits
- and enforce in `runExternalFlow`). Do NOT trust the address the endpoint
- returns. This blocks launch if unmet.
-- **C2 — Cap the amount.** Enforce a hard per-call max (known entry fee + small
- tolerance); reject larger challenges. Show the player the exact amount +
- recipient and require explicit approval before paying. No silent payment.
-- **C3 — Bound the response.** Cap the external response body (≤1 MB) and verify
- content-type before parsing.
-- **C4 — Sanitize partner content.** Any Omniology string reaching the DOM uses
- `textContent`/escaping, never `innerHTML`. Length-clamp and strip control chars.
-- The flow is auth + CSRF gated already; do not weaken that. Never pay from a
- shared platform wallet — the paying agent must be the player's own.
+### A. Server endpoint `api/arena/omniology-enter.js` (CONTRACTS §2.4)
+The desk calls this; it runs the §1.3 handshake server-side.
+1. **Auth/ownership/CSRF**: `requireAuth`, `requireCsrf`; `agentId` must belong to
+ the user via `loadAgentKeypairForUser`. Anonymous callers rejected.
+2. **Registration (CONTRACTS §2.6)**: ensure the player's agent is registered with
+ Omniology (§1.5). Default: lazy server-side registration on first entry — sign
+ the `omniology-register-v1:<wallet>:<ts>` challenge with the agent key (base58
+ ed25519, ±300s) and call `register_agent`. Cache registration state.
+3. **Step 1**: `guardedFetch` (host-pinned to `OMNIOLOGY_ENGINE_BASE`) the
+ `POST /v1/contests/{id}/enter` with `{ agent_id, payload }`; receive
+ `pending_tx`, `expected_fee_micro_usdc`, `entry_ticket_pda`.
+4. **Caps**: `reserveSpendUsd` + a hard per-entry ceiling (≤ $0.10). Reject over-cap.
+5. **C7 inspect-before-sign (MANDATORY)**: decode `pending_tx`; assert exactly one
+ USDC `TransferChecked` of `expected_fee_micro_usdc` to the contest
+ `deposit_address` **taken from the proxied `/active` feed** (cross-check, do not
+ trust the enter response alone); no other instructions; `feePayer` is
+ Omniology's, not the agent. Reject otherwise. (See SECURITY.md C7.)
+6. **Sign + broadcast**: sign with the agent keypair, broadcast via the platform
+ Solana connection, get `transaction_signature`. Handle confirmation/timeout and
+ the settle-uncertain case (never double-submit).
+7. **Step 3**: `POST …/enter` with `{ agent_id, payload, transaction_signature }`;
+ receive `{ entry_id, position, … }`.
+8. **SSE**: stream stages `building → verifying → signed → broadcast → confirmed`
+ (+ `error`) to the client, each emitted after the real step. Include the
+ Solscan link for the broadcast tx.
+9. Map Omniology errors (`GEO_BLOCKED`, `OFAC_SANCTIONED`, `RATE_LIMITED`,
+ `RATE_LIMITED_DUPLICATE_ENTRY`) to clear, honest client messages. Respect
+ `Retry-After`.
+
+### B. In-world desk `src/game/arena/entry-desk.js` (CONTRACTS §2.3)
+1. Tasteful desk/kiosk mesh at `anchors.desk`; proximity interactable (reuse
+ play-systems) with an "Enter contest — press E" prompt (hover/active/focus).
+2. **Compose UI** (`composeEntry`): an overlay form matching the contest's
+ `payload_format` (`plain_text` / `markdown` / `base64_image`) and
+ `max_payload_chars`. Validate locally (length, format, duplicate-guard) BEFORE
+ submitting. Show the theme + rubric and the exact entry fee. Designed
+ empty/invalid states.
+3. **Submit**: `POST /api/arena/omniology-enter` with `Accept: text/event-stream`
+ and `{ agentId, contestId, payload }`; consume the SSE stream with the `_sse`
+ parser; drive a live stepper from the real stages; on `confirmed` show the
+ confirmation (entry id, position, Solscan link) and call `onConfirmed(...)`.
+4. **Cross-wire to screens**: `onConfirmed` → screen `pushEntry({ agent })` for an
+ instant ticker insert; the next poll reconciles. Tasteful success cue
+ (sound + light), reduced-motion gated.
+5. **Eligibility honesty**: if the player can't enter (geo/registration/closed
+ round), say so clearly in-world rather than failing at payment.
## Acceptance criteria
-- C1–C4 above are implemented and demonstrated (e.g. a test that a mismatched
- `payTo` or an over-cap amount is rejected before signing).
-- Walking to the desk and pressing E opens the compose UI; submitting runs a
- **real** x402 payment and returns Omniology's real confirmation. Verified in a
- real browser end-to-end against Omniology's real/sandbox submit endpoint, with
- a real Solscan tx link (when an entry fee applies).
-- Every SSE stage is backed by a real event from `/api/x402-pay` — confirm by
- reading the stream in the Network tab; no `setTimeout`-driven fake progress.
-- Local validation rejects bad entries before any payment.
-- The submitted entry appears on the live ticker immediately and persists after
- the next poll.
-- Error/declined/uncertain states are all designed and accurate. Interactive
- elements have hover/active/focus states. Keyboard accessible.
-- No console errors/warnings. `npm test` passes. Review your `git diff`.
+- **C7 is implemented and unit-tested**: a tampered `pending_tx` (wrong recipient,
+ extra instruction, inflated amount, agent-as-feePayer) is rejected before
+ signing. This is a blocking requirement.
+- Hard per-entry cap rejects over-ceiling fees; the exact fee + contest are shown
+ before the player confirms (no silent signing).
+- Walking to the desk and entering runs the real 3-step handshake against
+ Omniology's engine (or sandbox), broadcasts a real Solana tx, and returns a real
+ `entry_id`/position with a working Solscan link. Verified end-to-end in a browser.
+- Every SSE stage is backed by a real step (no `setTimeout` fake progress) — verify
+ in the Network tab.
+- Submitted entry appears on the live ticker immediately and persists after the
+ next poll. Geo/OFAC/rate-limit/closed-round errors are honest and recoverable.
+- No client secrets; agent signing is server-side only. Partner strings reaching
+ the DOM are escaped (SECURITY.md C4). No console errors/warnings. `npm test` passes.
## Hand-off
-The Arena is now functionally complete. Prompt 06 does the polish/QA/launch pass.
+The Arena is functionally complete. Prompt 06 does polish/QA/launch.
diff --git a/docs/omniology-arena/05-omniology-mcp-server.md b/docs/omniology-arena/05-omniology-mcp-server.md
index 50d31c16a..7ba9a371a 100644
--- a/docs/omniology-arena/05-omniology-mcp-server.md
+++ b/docs/omniology-arena/05-omniology-mcp-server.md
@@ -1,75 +1,66 @@
-# Prompt 05 — `@three-ws/omniology-mcp` server
+# Prompt 05 — Omniology MCP: consume theirs (optional thin wrapper)
-Build a real MCP server that exposes Omniology's contests as agent-callable
-tools (`list_contests`, `get_contest`, `get_leaderboard`, `submit_entry`), with
-`submit_entry` x402-priced in USDC. This is the contract artifact: it lets *any*
-MCP client/agent — not just our 3D world — read and enter Omniology contests, and
-it makes Omniology auto-discoverable in the x402 Bazaar. It wraps Omniology's
-**real** HTTP API (CONTRACTS §1). No mocks.
+**Status changed by diligence.** Omniology **already ships an MCP server** at
+`https://omniology-engine.fly.dev/mcp` (`npx omniology-init`) with tools
+`register_agent`, `list_active_contests`, `get_contest_rules`, `submit_entry`,
+`check_payout`, `get_my_history`, `get_leaderboard`, `get_theme_history`,
+`get_judge_rubric_explainer`. So we do **not** build their MCP server. This prompt
+is now: (A) wire their MCP into our `.mcp.json` so agents/tools can use it, and
+(B) decide whether to build a **thin safety wrapper** package — only if we need to
+enforce our controls in front of `submit_entry`.
+
+This prompt is OPTIONAL and independent of 01–04. Do A; do B only if the decision
+in §B lands on "yes."
## Read first (required)
-- `docs/omniology-arena/README.md`, `docs/omniology-arena/CONTRACTS.md` (§1 external contract), `CLAUDE.md`
-- `STRUCTURE.md` — the `packages/*-mcp` conventions and the published MCP list.
-- A representative existing server to mirror exactly — read **all** of one, e.g.
- `packages/marketplace-mcp/` (its `package.json`, `server.json`, `src/index.js`).
- Also skim `packages/activity-mcp/` or `packages/intel-mcp/` for read-only tool
- shape, and `mcp-server/src/payments.js` + `mcp-server/src/tools/pose-seed.js`
- for the x402 `paid()` wrapper pattern (`@x402/mcp`, Solana USDC settlement).
-- `mcp-bridge/src/bazaar-discover.js` — how a server gets discovered (so you set
- `server.json` / discovery metadata correctly).
+- `docs/omniology-arena/README.md`, `docs/omniology-arena/CONTRACTS.md` (§0, §1.3, §1.6), `docs/omniology-arena/SECURITY.md` (C7, C1), `CLAUDE.md`
+- `.mcp.json` (how remote/local MCP servers are registered for this repo)
+- `STRUCTURE.md` and one `packages/*-mcp` (e.g. `packages/marketplace-mcp/`) only if you proceed with §B.
+
+## A. Register their MCP (do this)
+1. Add Omniology's MCP endpoint to `.mcp.json` as a remote server
+ (`https://omniology-engine.fly.dev/mcp`), matching how other remotes are
+ declared. Verify it lists tools and that read tools (`list_active_contests`,
+ `get_leaderboard`) return real data.
+2. Document it: a short `docs/omniology-arena/USING-THEIR-MCP.md` with the connect
+ command and the tool list, so our agents can discover it.
+3. Do **not** put any payment/agent secret in `.mcp.json`.
+
+## B. Thin safety wrapper — build ONLY if decided "yes"
+**The deciding question:** their `submit_entry` MCP tool, called directly by an
+agent, signs and pays without our C7 inspect-before-sign / per-entry cap. For the
+**in-world desk** that's already handled — prompt 04's server endpoint does the
+signing with C7. So a wrapper is only worth building if we want *every* three.ws
+agent (outside the 3D world) to get the same guardrails when entering Omniology
+contests.
+
+If yes, build `@three-ws/omniology-guard` under `packages/omniology-guard/`:
+- A small MCP server exposing `omniology_enter_safe(contestId, payload, agentId)`
+ that internally runs the CONTRACTS §1.3 handshake with **C7 inspection + the
+ per-entry USDC cap** before signing/broadcasting — i.e. the same server logic as
+ prompt 04's endpoint, packaged for non-world agents.
+- Pass-through read tools that proxy `list_active_contests` / `get_leaderboard`.
+- `package.json`, `server.json`, `node --test` suite, README — mirror a sibling
+ `packages/*-mcp`. Add to workspaces + `STRUCTURE.md`.
+- A test that a tampered `pending_tx` is rejected (reuse prompt 04's C7 test).
-## Build
-1. **Package** `packages/omniology-mcp/` named `@three-ws/omniology-mcp`,
- matching the structure, scripts, ESM style, hand-written types, and
- `node --test` suite of the reference package. Add it to the npm workspaces in
- the root `package.json` and to the workspace list in `STRUCTURE.md`.
-2. **Config**: read Omniology's base URL from env
- (`OMNIOLOGY_BASE_URL`), with a clear startup error if a paid tool is invoked
- without required payment env (lazy-validate like `mcp-server/src/payments.js`).
-3. **Read tools** (free): `list_contests`, `get_contest(contestId)`,
- `get_leaderboard(contestId)` — thin, validated wrappers over Omniology's feed
- (CONTRACTS §1.1) with Zod input schemas, `zod-to-json-schema` output, and
- sanitized errors. Real `fetch` to the real API.
-4. **Write tool** (x402-priced): `submit_entry(contestId, entry, agent?)` wrapped
- with the `paid()` helper so it settles USDC on Solana before forwarding the
- POST to Omniology's submit endpoint (CONTRACTS §1.2). If Omniology's own
- endpoint already speaks x402, the tool can delegate the challenge; if not,
- this server *is* the x402 front door for them — implement the settlement here
- and forward authenticated. Pricing read from a `pricing` module like the other
- servers.
-5. **`server.json`** manifest (stdio transport) under `io.github.nirholas/*`
- namespace, consistent with sibling servers, with accurate tool descriptions
- and discovery metadata.
-6. **Tests** (`node --test`): tool registration, input validation, error
- sanitization, and the free/paid wrapper wiring. Network calls in tests must
- hit a real injected fetch (dependency-injected), not a global monkeypatch —
- follow the sibling package's test style. No live-network dependency in CI.
-7. **Docs**: a `README.md` with install + a real usage example, and add a row to
- the MCP table in `STRUCTURE.md`.
+If no, record the decision in `USING-THEIR-MCP.md` (in-world desk carries the
+guardrails; direct MCP use is at the agent's own risk) and stop.
## Guardrails
-- Only `$THREE` may be referenced as a coin. USDC is the payment asset — fine.
- No other token anywhere in code, tests, fixtures, or docs.
-- **Security (see `docs/omniology-arena/SECURITY.md`).** If this server is the
- x402 front door, it MUST pin Omniology's verified recipient address (C1), cap
- the entry amount (C2), bound + content-type-check the forwarded response (C3),
- and never forward unsanitized partner content. The pinned address and price
- come from config/`pricing`, not from whatever a response advertises.
-- Real APIs only. If Omniology's endpoints aren't live yet, build against the
- CONTRACTS shapes with a DI'd HTTP client and verify against their sandbox the
- moment it exists — but ship no fabricated contest data.
+- Only `$THREE` may be referenced as a coin; USDC is a payment asset — fine. No
+ other token anywhere.
+- Never sign anything that isn't a single sub-cent USDC transfer to a
+ feed-published pool address (SECURITY.md C7/C1). The pinned cap + inspection
+ live in code, not in trust of the engine's response.
## Acceptance criteria
-- `cd packages/omniology-mcp && node --test test/*.test.js` is green.
-- The server boots over stdio and registers all four tools; read tools return
- real Omniology data against a real/sandbox base URL; `submit_entry` performs a
- real USDC settlement then forwards the entry.
-- `server.json` validates against the repo's manifest auditor
- (`scripts/audit-mcp-manifests.mjs`).
-- Added to workspaces + `STRUCTURE.md`. `npm test` at root still passes.
-- Changelog: add an `sdk` entry to `data/changelog.json` (holder-readable) for
- the new MCP server, then `npm run build:pages`.
+- (A) Omniology's MCP is registered in `.mcp.json`; read tools return real data;
+ `USING-THEIR-MCP.md` documents it. No secrets committed.
+- (B, if built) `cd packages/omniology-guard && node --test` is green, including
+ the tampered-tx rejection; added to workspaces + `STRUCTURE.md`; root `npm test`
+ passes; changelog `sdk` entry added + `npm run build:pages`.
## Hand-off
-This server is independently shippable and is also what we hand Omniology if they
-prefer we run the x402 front door for them. It does not depend on prompts 01–04.
+Independent of the world build. If A-only, no changelog entry is needed (internal
+config).
diff --git a/docs/omniology-arena/README.md b/docs/omniology-arena/README.md
index e3ab6d9d4..9cbbd63f6 100644
--- a/docs/omniology-arena/README.md
+++ b/docs/omniology-arena/README.md
@@ -47,9 +47,11 @@ Before running any prompt, the agent in that chat must read:
operational risk, nothing new to maintain server-side.
3. **Contest state never touches our game server.** The live contest feed and
- entry submission live entirely in Omniology's service. Screens *poll*
- Omniology's feed; the entry desk *submits* via our existing universal x402
- payer (`/api/x402-pay` → external flow). The Colyseus room only carries player
+ entry submission live entirely in Omniology's service. Screens *poll* their
+ feed (through our read-through proxy); the entry desk *submits* via a dedicated
+ server endpoint that runs Omniology's 3-step entry handshake (their submit flow
+ is **not** x402 — see CONTRACTS §0/§1.3 — so `/api/x402-pay` is not used; we
+ reuse only its safe primitives). The Colyseus room only carries player
presence. This keeps Omniology's uptime decoupled from our world.
4. **The building is the only core-side asset we author.** A premium venue GLB
@@ -75,20 +77,39 @@ Before running any prompt, the agent in that chat must read:
| **01** | Route + page + bootstrap skeleton; multiplayer presence in a namespaced `walk_world`; local player movement/camera; empty lit space you can walk around with others | — |
| **02** | Premium Arena venue GLB + named-anchor module (build script + loader + anchor resolution); environment, lighting, spawn, collision/bounds | 01 |
| **03** | Generalized live in-world screens (current contest, ~88s countdown, leaderboard, recent entries) fed by Omniology's contest feed via an adapter; mounted on venue screen anchors | 02 + CONTRACTS |
-| **04** | In-world entry desk interactable → `/api/x402-pay` external flow → live SSE settlement UI → receipt; pushes the new entry to the screens from 03 | 03 + CONTRACTS |
-| **05** | `@three-ws/omniology-mcp` server (`list_contests`, `get_contest`, `get_leaderboard`, `submit_entry`), x402-priced, `server.json`, modeled on `packages/*-mcp` | CONTRACTS |
+| **04** | In-world entry desk + server endpoint running Omniology's 3-step entry handshake (sign-and-broadcast with the player's agent key, **C7 inspect-before-sign**), live SSE stepper + receipt; pushes the entry to the screens from 03 | 03 + CONTRACTS + SECURITY |
+| **05** | Register Omniology's **existing** MCP (`{base}/mcp`) in `.mcp.json`; optional thin safety-wrapper package only if non-world agents need our guardrails. (Their MCP already exists — we do not rebuild it.) | CONTRACTS |
| **06** | Polish pass: all states designed, responsive, a11y, performance (instancing/LOD), tests, changelog entry, real-browser end-to-end verification | 01–05 |
---
-## The one hard external dependency
-
-For screens (03) and submission (04) to be **100% working with no mocks**,
-Omniology must expose the endpoints in `CONTRACTS.md`. The questions we need
-answered to lock that contract are in `QUESTIONS-FOR-OMNIOLOGY.md` — send those
-first. Until the feed URL exists, 03/04 are built against the documented
-contract behind a thin adapter, and verified against their real endpoint as soon
-as it's live.
+## External dependency — mostly resolved
+
+Omniology already publishes a real API and MCP server (engine base
+`https://omniology-engine.fly.dev`, MCP at `{base}/mcp`), so `CONTRACTS.md` is
+written against their **actual** endpoints — screens (03) and the desk (04) can be
+built against real data, not guesses. Re-verify field names against a live
+response before building. `QUESTIONS-FOR-OMNIOLOGY.md` is now down to a few open
+items (team identity, sandbox env, leaderboard REST-vs-MCP, who enforces geo).
+
+## Diligence + go/no-go gates (see SECURITY.md)
+
+Diligence found Omniology to be a real, on-chain-transparent skill-contest
+platform (88s contests; 0.02 USDC entry; winner ~70% of pot; 30% house rake; real
+USDC on Solana; no proprietary token; public `/audit` + `/winners`). It is
+deliberately structured around the gambling question (AI-judged on a rubric, not
+chance) and geo-blocks AZ/IA/MD/VT/WA. No scam signals found; team is unnamed.
+
+Two **business gates** must clear before placement (neither is engineering):
+1. **Legal:** our counsel blesses hosting a paid-entry skill contest, and tells us
+ who owns the geo/eligibility duty for our users.
+2. **Identity:** real names behind the operators (basic KYC).
+
+The **technical** risk is contained by SECURITY.md (C7 inspect-before-sign, C1
+per-entry cap, C3 bounded responses, C4 sanitized content, C5 server-side proxy,
+C6 no partner code in our origin). With those, a fully compromised Omniology can
+only break its own contests — it cannot move funds, OOM us, inject content, or run
+code in our origin.
---
diff --git a/pages/world/atelier.html b/pages/world/atelier.html
new file mode 100644
index 000000000..022c9e8b8
--- /dev/null
+++ b/pages/world/atelier.html
@@ -0,0 +1,181 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <script>/* three.ws theme boot — no-flash; runtime in /theme-switcher.js */(function(){try{var m=localStorage.getItem('twx_theme');var l=m==='auto'?(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches):m==='light';document.documentElement.setAttribute('data-theme',l?'light':'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();</script>
+ <meta charset="utf-8" />
+ <title>Atelier World · three.ws</title>
+ <meta
+ name="viewport"
+ content="width=device-width, initial-scale=1, viewport-fit=cover"
+ />
+ <meta
+ name="description"
+ content="Atelier World — a live 3D venue on three.ws. Walk in as your avatar, meet other players in real time, and hire AI agents from the Atelier marketplace at their in-world booths, settled in USDC."
+ />
+ <meta name="theme-color" content="#07090e" />
+
+ <!--
+ Multiplayer server URL — the deployed Colyseus host (Cloud Run). Local dev
+ ignores this and uses ws://localhost:2567 automatically (see
+ defaultServerUrl in src/game/community-net.js). Copied verbatim from
+ pages/play.html.
+ -->
+ <meta name="game-server" content="wss://three-ws-multiplayer-93741856042.us-central1.run.app" />
+
+ <!--
+ Atelier marketplace base URL — the live agent registry + per-agent hire
+ endpoints (atelierai.xyz). Empty until the partner endpoint is live;
+ src/game/arena/atelier-adapter.js reads it (meta first, then
+ VITE_ATELIER_BASE). Leaving it blank keeps the plaza in its designed empty
+ state around the always-present three.ws 3D Studio — never mock data —
+ until the real base lands, which is a config-only change.
+ -->
+ <meta name="atelier-base" content="" />
+
+ <link rel="icon" href="/favicon.ico" sizes="any" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
+ <link rel="manifest" href="/site.webmanifest" />
+
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:title" content="Atelier World · three.ws" />
+ <meta property="og:description" content="A live 3D venue on three.ws — walk in, meet other players in real time, and hire AI agents from the Atelier marketplace at their in-world booths." />
+ <meta property="og:url" content="https://three.ws/world/atelier" />
+ <meta property="og:image" content="https://three.ws/og-image.png" />
+ <meta property="og:image:width" content="1200" />
+ <meta property="og:image:height" content="630" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:site" content="@trythreews" />
+ <meta name="twitter:title" content="Atelier World · three.ws" />
+ <meta name="twitter:description" content="Step into Atelier World — a live multiplayer 3D venue on three.ws where you hire AI agents at their booths." />
+ <meta name="twitter:image" content="https://three.ws/og-image.png" />
+
+ <!-- Shared world chrome: loading overlay, boot-avatar card, nameplates,
+ bubbles, and the on-screen joystick (#cc-joystick / .cc-joy-*). Reusing
+ /play's stylesheet keeps the world visually consistent with the core
+ surfaces and gives every presence label the same treatment. -->
+ <link rel="stylesheet" href="/src/game/coincommunities.css" />
+ <style>
+ /* World-only chrome layered over the shared world styles. The plaza HUD
+ (booth prompts, hire cards) is injected by atelier-plaza.js. */
+ #arena-brand {
+ position: fixed; top: 14px; left: 16px; z-index: 40;
+ display: inline-flex; align-items: center; gap: 9px;
+ padding: 8px 12px; border-radius: var(--cc-radius, 4px);
+ background: var(--cc-panel, rgba(12, 12, 14, 0.78));
+ border: 1px solid var(--cc-edge, rgba(255, 255, 255, 0.12));
+ backdrop-filter: saturate(150%) blur(14px);
+ -webkit-backdrop-filter: saturate(150%) blur(14px);
+ color: var(--cc-text, #f5f5f6);
+ font: 600 13px/1 "Inter", system-ui, sans-serif;
+ letter-spacing: 0.04em; text-transform: uppercase;
+ text-decoration: none;
+ transition: border-color 0.18s ease, transform 0.18s ease;
+ }
+ #arena-brand:hover, #arena-brand:focus-visible {
+ border-color: var(--cc-edge-hi, rgba(255, 255, 255, 0.55));
+ transform: translateY(-1px);
+ outline: none;
+ }
+ #arena-brand img { width: 18px; height: 18px; display: block; }
+ #arena-brand small {
+ color: var(--cc-dim, #8c8c92); font-weight: 500;
+ text-transform: none; letter-spacing: 0;
+ }
+ #arena-status {
+ position: fixed; top: 14px; right: 16px; z-index: 40;
+ display: inline-flex; align-items: center; gap: 7px;
+ padding: 8px 13px; border-radius: 999px;
+ background: var(--cc-panel, rgba(12, 12, 14, 0.78));
+ border: 1px solid var(--cc-edge, rgba(255, 255, 255, 0.12));
+ backdrop-filter: saturate(150%) blur(14px);
+ -webkit-backdrop-filter: saturate(150%) blur(14px);
+ color: var(--cc-dim, #8c8c92);
+ font: 600 11px/1 "Inter", system-ui, sans-serif;
+ letter-spacing: 0.08em; text-transform: uppercase;
+ cursor: default; user-select: none;
+ }
+ #arena-status .dot {
+ width: 8px; height: 8px; border-radius: 50%;
+ background: var(--cc-faint, #5a5a60);
+ box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
+ transition: background 0.2s ease, box-shadow 0.2s ease;
+ }
+ #arena-status[data-state="online"] { color: var(--cc-text, #f5f5f6); }
+ #arena-status[data-state="online"] .dot {
+ background: #6ee7a8;
+ box-shadow: 0 0 10px rgba(110, 231, 168, 0.8);
+ animation: arena-pulse 1.8s ease-in-out infinite;
+ }
+ #arena-status[data-state="connecting"] .dot { background: #9bd0ff; animation: arena-blink 1s ease-in-out infinite; }
+ #arena-status[data-state="error"] .dot, #arena-status[data-state="offline"] .dot { background: #5a5a60; }
+ @keyframes arena-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
+ @keyframes arena-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
+ /* A subtle one-time hint so a first-time visitor knows how to move + hire. */
+ #arena-help {
+ position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
+ z-index: 38; display: inline-flex; gap: 14px; align-items: center;
+ padding: 8px 16px; border-radius: 999px;
+ background: var(--cc-panel, rgba(12, 12, 14, 0.72));
+ border: 1px solid var(--cc-edge, rgba(255, 255, 255, 0.1));
+ backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
+ color: var(--cc-dim, #9aa6bb);
+ font: 500 12px/1 "Inter", system-ui, sans-serif;
+ opacity: 0; animation: arena-help-in 0.5s ease 0.8s forwards, arena-help-out 0.6s ease 9s forwards;
+ pointer-events: none;
+ }
+ #arena-help kbd {
+ background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.16);
+ border-radius: 4px; padding: 2px 6px; font: inherit; color: #e7edf6;
+ }
+ @keyframes arena-help-in { to { opacity: 1; } }
+ @keyframes arena-help-out { to { opacity: 0; } }
+ @media (prefers-reduced-motion: reduce) {
+ #arena-status .dot, #arena-help { animation: none !important; opacity: 1; }
+ }
+ @media (max-width: 560px) {
+ #arena-brand small { display: none; }
+ #arena-help { display: none; }
+ }
+ </style>
+ </head>
+ <body>
+ <div id="kx-loading">
+ <div class="kx-loading-card">
+ <img class="kx-loading-logo" src="/three.svg" alt="three.ws" width="38" height="38" />
+ <div class="kx-loading-mark">ATELIER WORLD</div>
+ <div class="kx-boot-stage">
+ <canvas id="kx-boot-avatar" aria-hidden="true"></canvas>
+ <div class="kx-boot-fallback" aria-hidden="true"></div>
+ </div>
+ <div class="kx-loading-sub">Entering the plaza…</div>
+ <div class="kx-boot-bar" role="status" aria-label="Loading"><span></span></div>
+ </div>
+ </div>
+
+ <canvas id="kx-canvas"></canvas>
+
+ <a id="arena-brand" href="/" aria-label="Back to three.ws">
+ <img src="/three.svg" alt="" />
+ World<small>Atelier</small>
+ </a>
+ <div id="arena-status" data-state="connecting" role="status" aria-live="polite">
+ <span class="dot" aria-hidden="true"></span>
+ <span class="label">Connecting</span>
+ </div>
+
+ <div id="arena-help" aria-hidden="true">
+ <span><kbd>W</kbd><kbd>A</kbd><kbd>S</kbd><kbd>D</kbd> move</span>
+ <span>drag to look</span>
+ <span>walk up · <kbd>E</kbd> hire</span>
+ </div>
+
+ <!-- On-screen / drag joystick mount (touch + mouse). Styled by coincommunities.css;
+ the thumb + base are created by the arena controller at runtime. -->
+ <div id="cc-joystick" aria-hidden="true"></div>
+
+ <script type="module" src="/src/game/boot-avatar.js"></script>
+ <script type="module" src="/src/game/arena/atelier.js"></script>
+ </body>
+</html>
diff --git a/src/game/arena/arena-environment.js b/src/game/arena/arena-environment.js
index 3c5813641..d04610618 100644
--- a/src/game/arena/arena-environment.js
+++ b/src/game/arena/arena-environment.js
@@ -237,7 +237,7 @@ function buildLightingRig(scene, anchors, bounds, profile) {
for (const a of anchors.lights) {
if (a.kind === 'rim') {
const p = new PointLight(a.color, a.intensity, a.distance || 0, 1.6);
- p.position.copy(a.pos);
+ p.position.copy(a.position);
scene.add(p);
out.push(p);
continue;
@@ -245,7 +245,7 @@ function buildLightingRig(scene, anchors, bounds, profile) {
// key + fill are directional so they shape the whole room evenly.
const d = new DirectionalLight(a.color, a.intensity);
- d.position.copy(a.pos);
+ d.position.copy(a.position);
d.target.position.copy(centre);
scene.add(d.target);
diff --git a/src/game/arena/arena-venue.js b/src/game/arena/arena-venue.js
index 109915004..c153660db 100644
--- a/src/game/arena/arena-venue.js
+++ b/src/game/arena/arena-venue.js
@@ -132,13 +132,18 @@ export function collectArenaEmpties(root, required = ARENA_REQUIRED_EMPTIES) {
* `extras` (exposed by GLTFLoader as `node.userData`); each falls back to a
* sensible per-role default so a hand-placed empty still lights the room.
*
+ * Field names mirror the bootstrap anchor contract (`position` / `rotationY` /
+ * `width`) that src/game/arena/arena.js exposes via `setAnchors()` and that the
+ * screen (03) + desk (04) consumers read — so the resolved set drops straight
+ * into `setAnchors(resolveArenaAnchors(...))` with no remapping.
+ *
* @param {Map<string, import('three').Object3D>} empties
* @returns {{
- * spawn: { pos: Vector3, yaw: number },
- * screens: Array<{ pos: Vector3, yaw: number, width: number, node: import('three').Object3D }>,
- * desk: { pos: Vector3, yaw: number, node: import('three').Object3D },
- * lights: Array<{ name: string, kind: 'key'|'fill'|'rim', pos: Vector3, color: number, intensity: number, distance: number, castShadow: boolean }>,
- * camera_intro: { pos: Vector3, lookAt: Vector3 },
+ * spawn: { position: Vector3, rotationY: number },
+ * screens: Array<{ position: Vector3, rotationY: number, width: number, node: import('three').Object3D }>,
+ * desk: { position: Vector3, rotationY: number, node: import('three').Object3D },
+ * lights: Array<{ name: string, kind: 'key'|'fill'|'rim', position: Vector3, color: number, intensity: number, distance: number, castShadow: boolean }>,
+ * camera_intro: { position: Vector3, lookAt: Vector3 },
* }}
*/
export function resolveArenaAnchors(empties) {
@@ -152,8 +157,8 @@ export function resolveArenaAnchors(empties) {
const spawnNode = get('spawn_01');
const spawn = {
- pos: spawnNode.getWorldPosition(new Vector3()),
- yaw: worldYaw(spawnNode),
+ position: spawnNode.getWorldPosition(new Vector3()),
+ rotationY: worldYaw(spawnNode),
};
const screens = [];
@@ -161,8 +166,8 @@ export function resolveArenaAnchors(empties) {
const node = get(`screen_${pad(i + 1)}`);
const scaleX = node.getWorldScale(new Vector3()).x;
screens.push({
- pos: node.getWorldPosition(new Vector3()),
- yaw: worldYaw(node),
+ position: node.getWorldPosition(new Vector3()),
+ rotationY: worldYaw(node),
width: scaleX > 1.001 ? scaleX : DEFAULT_SCREEN_WIDTH_M,
node,
});
@@ -170,8 +175,8 @@ export function resolveArenaAnchors(empties) {
const deskNode = get('desk_01');
const desk = {
- pos: deskNode.getWorldPosition(new Vector3()),
- yaw: worldYaw(deskNode),
+ position: deskNode.getWorldPosition(new Vector3()),
+ rotationY: worldYaw(deskNode),
node: deskNode,
};
@@ -190,7 +195,7 @@ export function resolveArenaAnchors(empties) {
lights.push({
name,
kind,
- pos: node.getWorldPosition(new Vector3()),
+ position: node.getWorldPosition(new Vector3()),
color: parseColor(extras.color, def.color),
intensity: numberOr(extras.intensity, def.intensity),
distance: numberOr(extras.distance, def.distance),
@@ -202,7 +207,7 @@ export function resolveArenaAnchors(empties) {
const camPos = camNode.getWorldPosition(new Vector3());
const focal = numberOr(camNode.userData?.focal, DEFAULT_CAMERA_FOCAL_M);
const lookAt = camPos.clone().add(worldForward(camNode).multiplyScalar(focal));
- const camera_intro = { pos: camPos, lookAt };
+ const camera_intro = { position: camPos, lookAt };
return { spawn, screens, desk, lights, camera_intro };
}
@@ -223,9 +228,9 @@ export function resolveArenaAnchors(empties) {
*/
export function arenaBounds(anchors, margin = 1.2) {
const pts = [
- anchors.spawn.pos,
- anchors.desk.pos,
- ...anchors.screens.map((s) => s.pos),
+ anchors.spawn.position,
+ anchors.desk.position,
+ ...anchors.screens.map((s) => s.position),
];
let minX = Infinity;
let maxX = -Infinity;
diff --git a/src/game/arena/atelier-plaza.js b/src/game/arena/atelier-plaza.js
new file mode 100644
index 000000000..6d34c6725
--- /dev/null
+++ b/src/game/arena/atelier-plaza.js
@@ -0,0 +1,575 @@
+// Atelier Plaza — the in-world marketplace layer of the Atelier World.
+//
+// Given the arena engine (scene + camera + local player) and a NormalizedRoster
+// from atelier-adapter.js, this builds a booth for every Atelier agent: a lit
+// pedestal, a holographic billboard card (name · specialty · price), and a glow
+// ring. The featured three.ws 3D Studio takes the central dais; marketplace
+// agents ring it. Walk up to a booth and a hire prompt appears; activate it and
+// an in-world card opens. Hiring a marketplace agent runs the real x402 USDC
+// flow through /api/x402-pay; the internal studio routes to the forge.
+//
+// Registered with arena.registerUpdatable(): update(dt) billboards the cards,
+// pulses the nearest booth, and tracks player proximity. Every DOM node and GPU
+// resource it creates is torn down in dispose().
+
+import {
+ Group, Mesh, Vector3,
+ CylinderGeometry, CircleGeometry, RingGeometry, PlaneGeometry,
+ MeshStandardMaterial, MeshBasicMaterial,
+ CanvasTexture, SRGBColorSpace, DoubleSide, PointLight,
+} from 'three';
+import { hireRequest } from './atelier-adapter.js';
+import { log } from '../../shared/log.js';
+
+const RING_RADIUS = 13; // metres from centre the marketplace booths sit on
+const ACTIVATE_DIST = 3.4; // how close the player walks before a booth activates
+const CARD_W = 2.6; // billboard width (metres)
+const CARD_H = 1.7;
+const ACCENT = 0x6ea8ff; // Atelier-tinted accent (matches the arena ring)
+const ACCENT_HOT = 0x9bd0ff;
+
+export function createAtelierPlaza(arena, opts = {}) {
+ return new AtelierPlaza(arena, opts);
+}
+
+class AtelierPlaza {
+ /**
+ * @param {object} arena the OmniologyArena engine (scene, camera, localPos, project, registerUpdatable)
+ * @param {object} [opts]
+ * @param {() => string} [opts.getAgentId] paying agent id for x402 hires (optional)
+ * @param {(s:string)=>void} [opts.onStatus] surface 'loading'|'live'|'empty'|'error'
+ */
+ constructor(arena, opts = {}) {
+ this.arena = arena;
+ this.scene = arena.scene;
+ this.getAgentId = typeof opts.getAgentId === 'function' ? opts.getAgentId : () => '';
+ this.onStatus = typeof opts.onStatus === 'function' ? opts.onStatus : null;
+
+ this.group = new Group();
+ this.scene.add(this.group);
+ this.booths = []; // { agent, root, card, tex, ring, light, basePos }
+ this.activeBooth = null;
+ this.status = 'loading';
+ this._t = 0;
+ this._disposed = false;
+ this._hireBusy = false;
+
+ this._injectStyles();
+ this._buildPrompt();
+ this._bindKeys();
+ }
+
+ // ── roster → booths ─────────────────────────────────────────────────────────
+ /** (Re)build every booth from a NormalizedRoster. Idempotent: clears first. */
+ applyRoster(roster) {
+ this._clearBooths();
+ const agents = roster?.agents || [];
+ const featured = agents.filter((a) => a.featured);
+ const ring = agents.filter((a) => !a.featured);
+
+ // Featured (the three.ws studio) sits on the central dais.
+ featured.forEach((agent, i) => {
+ const angle = featured.length > 1 ? (i / featured.length) * Math.PI * 2 : 0;
+ const pos = new Vector3(Math.sin(angle) * 2.2 * (i ? 1 : 0), 0, Math.cos(angle) * 2.2 * (i ? 1 : 0));
+ this._buildBooth(agent, pos, true);
+ });
+ // Marketplace agents evenly distributed on the ring, starting at the back
+ // so the player (spawned near the front) faces into the plaza.
+ ring.forEach((agent, i) => {
+ const angle = (i / Math.max(1, ring.length)) * Math.PI * 2 + Math.PI;
+ const pos = new Vector3(Math.sin(angle) * RING_RADIUS, 0, Math.cos(angle) * RING_RADIUS);
+ this._buildBooth(agent, pos, false);
+ });
+
+ this.status = roster?.ok ? (ring.length ? 'live' : 'empty') : (roster?.reason === 'unconfigured' ? 'empty' : 'error');
+ this._renderDais(roster);
+ this.onStatus?.(this.status);
+ }
+
+ setStatus(s) {
+ if (s === 'error' && this.status !== 'live') { this.status = 'error'; this._renderDais(null); this.onStatus?.('error'); }
+ }
+
+ _buildBooth(agent, basePos, featured) {
+ const root = new Group();
+ root.position.copy(basePos);
+ this.group.add(root);
+
+ const tint = featured ? 0xb892ff : ACCENT;
+
+ // Pedestal — a short metallic cylinder the card floats above.
+ const pedH = featured ? 1.1 : 0.8;
+ const pedGeo = new CylinderGeometry(featured ? 1.5 : 1.0, featured ? 1.7 : 1.2, pedH, 32);
+ const pedMat = new MeshStandardMaterial({ color: 0x141821, roughness: 0.55, metalness: 0.6, emissive: tint, emissiveIntensity: 0.04 });
+ const pedestal = new Mesh(pedGeo, pedMat);
+ pedestal.position.y = pedH / 2;
+ pedestal.castShadow = true; pedestal.receiveShadow = true;
+ root.add(pedestal);
+
+ // Glow ring at the base — pulses when the booth is active.
+ const ringGeo = new RingGeometry(featured ? 1.8 : 1.3, featured ? 2.05 : 1.5, 48);
+ const ringMat = new MeshBasicMaterial({ color: tint, transparent: true, opacity: 0.35, depthWrite: false, side: DoubleSide });
+ const ring = new Mesh(ringGeo, ringMat);
+ ring.rotation.x = -Math.PI / 2;
+ ring.position.y = 0.05;
+ root.add(ring);
+
+ // Holographic billboard card.
+ const tex = new CanvasTexture(document.createElement('canvas'));
+ tex.colorSpace = SRGBColorSpace;
+ const cardMat = new MeshBasicMaterial({ map: tex, transparent: true, side: DoubleSide, depthWrite: false });
+ const card = new Mesh(new PlaneGeometry(CARD_W, CARD_H), cardMat);
+ card.position.y = pedH + 1.35;
+ root.add(card);
+
+ // A soft accent light so each booth sits in its own pool of colour.
+ const light = new PointLight(tint, featured ? 10 : 6, 12, 2);
+ light.position.set(0, pedH + 1.6, 0.4);
+ root.add(light);
+
+ const booth = { agent, root, card, tex, ring, ringMat, light, basePos: basePos.clone(), pedH, tint, featured, _hot: 0 };
+ this._drawCard(booth, false);
+ this.booths.push(booth);
+ }
+
+ // ── per-frame ───────────────────────────────────────────────────────────────
+ update(dt) {
+ this._t += dt;
+ const cam = this.arena.camera;
+ const px = this.arena.localPos.x, pz = this.arena.localPos.z;
+
+ // Nearest booth within reach becomes active.
+ let nearest = null, nearestD = Infinity;
+ for (const b of this.booths) {
+ const d = Math.hypot(b.basePos.x - px, b.basePos.z - pz);
+ if (d < nearestD) { nearestD = d; nearest = b; }
+ }
+ const active = nearest && nearestD <= ACTIVATE_DIST ? nearest : null;
+ if (active !== this.activeBooth) { this.activeBooth = active; this._refreshActive(); }
+
+ for (const b of this.booths) {
+ // Billboard the card toward the camera (upright — yaw only).
+ b.card.quaternion.copy(cam.quaternion);
+ // Gentle bob + a brighter pulse for the active booth.
+ const isHot = b === this.activeBooth;
+ b._hot += ((isHot ? 1 : 0) - b._hot) * Math.min(1, dt * 8);
+ b.card.position.y = b.pedH + 1.35 + Math.sin(this._t * 1.4 + b.basePos.x) * 0.04;
+ b.ringMat.opacity = 0.3 + 0.35 * b._hot + 0.08 * Math.sin(this._t * 3);
+ b.ring.scale.setScalar(1 + 0.04 * Math.sin(this._t * 3) + 0.08 * b._hot);
+ b.light.intensity = (b.featured ? 10 : 6) * (0.85 + 0.3 * b._hot);
+ }
+
+ // Position the in-world hire prompt above the active booth.
+ if (this.activeBooth && !this._cardOpen) {
+ const head = new Vector3(this.activeBooth.basePos.x, this.activeBooth.pedH + 2.7, this.activeBooth.basePos.z);
+ const p = this.arena.project(head);
+ if (p.visible) {
+ this.prompt.style.display = '';
+ this.prompt.style.transform = `translate(-50%, -100%) translate(${p.x}px, ${p.y}px)`;
+ } else {
+ this.prompt.style.display = 'none';
+ }
+ } else {
+ this.prompt.style.display = 'none';
+ }
+ }
+
+ _refreshActive() {
+ if (this.activeBooth) {
+ const a = this.activeBooth.agent;
+ this.promptName.textContent = a.name;
+ this.promptHint.textContent = a.internal ? 'Open Studio' : 'Hire';
+ }
+ }
+
+ // ── the floating "walk up" prompt ─────────────────────────────────────────────
+ _buildPrompt() {
+ this.prompt = document.createElement('button');
+ this.prompt.className = 'atl-prompt';
+ this.prompt.type = 'button';
+ this.prompt.style.display = 'none';
+ this.promptName = document.createElement('span');
+ this.promptName.className = 'atl-prompt-name';
+ this.promptHint = document.createElement('span');
+ this.promptHint.className = 'atl-prompt-hint';
+ this.promptHint.innerHTML = '<kbd>E</kbd> Hire';
+ this.prompt.append(this.promptName, this.promptHint);
+ this.prompt.addEventListener('click', () => this._openCard());
+ document.body.appendChild(this.prompt);
+ }
+
+ _bindKeys() {
+ this._onKey = (e) => {
+ if (e.target && /^(input|textarea)$/i.test(e.target.tagName)) return;
+ const k = e.key.toLowerCase();
+ if ((k === 'e' || k === 'enter') && this.activeBooth && !this._cardOpen) { this._openCard(); }
+ if (k === 'escape' && this._cardOpen) { this._closeCard(); }
+ };
+ window.addEventListener('keydown', this._onKey);
+ }
+
+ // ── the in-world hire card ────────────────────────────────────────────────────
+ _openCard() {
+ const booth = this.activeBooth;
+ if (!booth || this._cardOpen) return;
+ this._cardOpen = true;
+ this.prompt.style.display = 'none';
+ const a = booth.agent;
+
+ const overlay = document.createElement('div');
+ overlay.className = 'atl-overlay';
+ overlay.addEventListener('click', (e) => { if (e.target === overlay) this._closeCard(); });
+
+ const card = document.createElement('div');
+ card.className = 'atl-card';
+ card.setAttribute('role', 'dialog');
+ card.setAttribute('aria-label', `Hire ${a.name}`);
+
+ const mono = a.name.trim().charAt(0).toUpperCase() || '◆';
+ const priceLine = a.internal
+ ? a.pricePeriod
+ : (a.priceUsdc > 0 ? `$${a.priceUsdc} USDC · ${a.pricePeriod}` : `Free · ${a.pricePeriod}`);
+ const stats = [
+ a.rating != null ? `★ ${a.rating.toFixed(1)}` : null,
+ a.jobsDone != null ? `${a.jobsDone.toLocaleString()} hires` : null,
+ ].filter(Boolean).join(' · ');
+
+ card.innerHTML = `
+ <button class="atl-x" type="button" aria-label="Close">×</button>
+ <div class="atl-head">
+ <div class="atl-mono" style="--tint:#${booth.tint.toString(16).padStart(6, '0')}">${esc(mono)}</div>
+ <div class="atl-head-txt">
+ <div class="atl-name">${esc(a.name)}</div>
+ <div class="atl-spec">${esc(a.specialty || 'AI agent')}</div>
+ </div>
+ </div>
+ <p class="atl-tag">${esc(a.tagline || 'Hire this agent to deliver work, settled in USDC.')}</p>
+ ${stats ? `<div class="atl-stats">${esc(stats)}</div>` : ''}
+ <div class="atl-price">${esc(priceLine)}</div>
+ <div class="atl-flow" hidden></div>
+ <button class="atl-hire" type="button">${a.internal ? 'Open the Studio' : 'Hire — pay in USDC'}</button>
+ `;
+
+ overlay.appendChild(card);
+ document.body.appendChild(overlay);
+ this._overlay = overlay;
+
+ card.querySelector('.atl-x').addEventListener('click', () => this._closeCard());
+ card.querySelector('.atl-hire').addEventListener('click', () => this._hire(booth));
+ requestAnimationFrame(() => overlay.classList.add('atl-show'));
+ }
+
+ _closeCard() {
+ if (!this._overlay) { this._cardOpen = false; return; }
+ const o = this._overlay;
+ o.classList.remove('atl-show');
+ setTimeout(() => o.remove(), 200);
+ this._overlay = null;
+ this._cardOpen = false;
+ }
+
+ async _hire(booth) {
+ const a = booth.agent;
+ // Internal studio → the real forge surface; no payment.
+ if (a.internal) {
+ try { window.location.assign(a.hireUrl || '/forge'); } catch { /* navigation blocked */ }
+ return;
+ }
+ if (this._hireBusy) return;
+ const req = hireRequest(a);
+ if (!req) { this._flow(booth, 'error', 'This agent has no hire endpoint configured.'); return; }
+
+ this._hireBusy = true;
+ const hireBtn = this._overlay?.querySelector('.atl-hire');
+ if (hireBtn) { hireBtn.disabled = true; hireBtn.textContent = 'Settling…'; }
+
+ const stages = ['challenge', 'built', 'verified', 'settled'];
+ this._flowStepper(booth, stages, 'challenge');
+
+ try {
+ const res = await fetch('/api/x402-pay', {
+ method: 'POST',
+ headers: { 'content-type': 'application/json', accept: 'text/event-stream' },
+ body: JSON.stringify({ url: req.url, method: req.method, body: req.body, agentId: this.getAgentId() || undefined }),
+ });
+ if (!res.ok || !res.body) {
+ const text = await res.text().catch(() => '');
+ let msg = 'Payment service unavailable.';
+ try { const j = JSON.parse(text); msg = j.error_description || j.error || msg; } catch { /* keep default */ }
+ throw new Error(msg);
+ }
+ let settled = null, result = null;
+ for await (const { event, data } of sse(res)) {
+ if (stages.includes(event)) this._flowStepper(booth, stages, event);
+ if (event === 'settled') settled = data;
+ else if (event === 'result') result = data;
+ else if (event === 'error') throw new Error(data?.error || 'payment failed');
+ }
+ if (!settled) throw new Error('incomplete response from payment service');
+ this._flowDone(booth, settled, result);
+ } catch (e) {
+ log.warn('[atelier] hire failed', e?.message);
+ this._flow(booth, 'error', e?.message || 'Hire failed. Try again.');
+ if (hireBtn) { hireBtn.disabled = false; hireBtn.textContent = 'Retry — pay in USDC'; }
+ } finally {
+ this._hireBusy = false;
+ }
+ }
+
+ _flowEl(booth) {
+ const el = this._overlay?.querySelector('.atl-flow');
+ if (el) el.hidden = false;
+ return el;
+ }
+ _flow(booth, kind, msg) {
+ const el = this._flowEl(booth);
+ if (!el) return;
+ el.className = `atl-flow atl-flow-${kind}`;
+ el.textContent = msg;
+ }
+ _flowStepper(booth, stages, active) {
+ const el = this._flowEl(booth);
+ if (!el) return;
+ const labels = { challenge: '402', built: 'Build', verified: 'Verify', settled: 'Settle' };
+ const idx = stages.indexOf(active);
+ el.className = 'atl-flow atl-flow-live';
+ el.innerHTML = stages.map((s, i) =>
+ `<span class="atl-step ${i < idx ? 'done' : ''} ${i === idx ? 'on' : ''}">${labels[s]}</span>`
+ ).join('<i class="atl-step-sep"></i>');
+ }
+ _flowDone(booth, settled, result) {
+ const el = this._flowEl(booth);
+ if (!el) return;
+ const tx = settled?.transaction || settled?.tx || result?.payment?.transaction || '';
+ const short = tx ? `${tx.slice(0, 6)}…${tx.slice(-6)}` : '';
+ el.className = 'atl-flow atl-flow-done';
+ el.innerHTML = `<strong>Hired.</strong> Settled on-chain in USDC.` +
+ (short ? ` <a class="atl-tx" href="https://solscan.io/tx/${esc(tx)}" target="_blank" rel="noopener">${esc(short)}</a>` : '');
+ const hireBtn = this._overlay?.querySelector('.atl-hire');
+ if (hireBtn) { hireBtn.disabled = false; hireBtn.textContent = 'Done'; }
+ }
+
+ // ── dais sign (empty / connecting state) ──────────────────────────────────────
+ _renderDais(roster) {
+ if (!this._daisTex) {
+ const tex = new CanvasTexture(document.createElement('canvas'));
+ tex.colorSpace = SRGBColorSpace;
+ const mat = new MeshBasicMaterial({ map: tex, transparent: true, side: DoubleSide, depthWrite: false });
+ const sign = new Mesh(new PlaneGeometry(7, 1.0), mat);
+ sign.position.set(0, 4.6, -RING_RADIUS - 4);
+ this.group.add(sign);
+ this._daisTex = tex; this._daisSign = sign; this._daisMat = mat;
+ }
+ const ringCount = (roster?.agents || []).filter((a) => !a.featured).length;
+ let title = 'ATELIER WORLD';
+ let sub = `${ringCount} agent${ringCount === 1 ? '' : 's'} for hire · settle in USDC`;
+ if (!roster || roster.reason !== 'unconfigured' && roster.ok === false) sub = 'Reconnecting to the Atelier marketplace…';
+ else if (roster.reason === 'unconfigured' || ringCount === 0) sub = 'Marketplace connecting — explore the three.ws 3D Studio';
+ this._drawSign(this._daisTex, title, sub);
+ }
+
+ // ── canvas painters ───────────────────────────────────────────────────────────
+ _drawCard(booth, active) {
+ const a = booth.agent;
+ const cv = booth.tex.image;
+ const W = 768, H = 500; cv.width = W; cv.height = H;
+ const g = cv.getContext('2d');
+ g.clearRect(0, 0, W, H);
+ // Glass panel.
+ roundRect(g, 12, 12, W - 24, H - 24, 28);
+ g.fillStyle = 'rgba(10,12,18,0.86)'; g.fill();
+ g.lineWidth = 3; g.strokeStyle = `#${booth.tint.toString(16).padStart(6, '0')}`; g.globalAlpha = 0.8; g.stroke(); g.globalAlpha = 1;
+ // Monogram disc.
+ const mono = (a.name.trim().charAt(0) || '◆').toUpperCase();
+ g.beginPath(); g.arc(96, 110, 56, 0, Math.PI * 2);
+ g.fillStyle = `#${booth.tint.toString(16).padStart(6, '0')}`; g.globalAlpha = 0.16; g.fill(); g.globalAlpha = 1;
+ g.lineWidth = 3; g.strokeStyle = `#${booth.tint.toString(16).padStart(6, '0')}`; g.stroke();
+ g.fillStyle = '#eaf2ff'; g.font = '600 52px Inter, system-ui, sans-serif'; g.textAlign = 'center'; g.textBaseline = 'middle';
+ g.fillText(mono, 96, 112);
+ // Name + specialty.
+ g.textAlign = 'left';
+ g.fillStyle = '#f5f8ff'; g.font = '700 46px Inter, system-ui, sans-serif';
+ fitText(g, a.name, 176, 96, W - 200, 46);
+ g.fillStyle = '#8fb4ff'; g.font = '500 28px Inter, system-ui, sans-serif';
+ fitText(g, a.specialty || 'AI agent', 176, 142, W - 200, 28);
+ // Tagline.
+ g.fillStyle = '#aab3c4'; g.font = '400 27px Inter, system-ui, sans-serif';
+ wrapText(g, a.tagline || 'Hire to deliver work, settled in USDC.', 44, 220, W - 88, 34, 2);
+ // Price pill.
+ const price = a.internal ? a.pricePeriod : (a.priceUsdc > 0 ? `$${a.priceUsdc} USDC · ${a.pricePeriod}` : `Free · ${a.pricePeriod}`);
+ roundRect(g, 44, 322, 360, 56, 28); g.fillStyle = `#${booth.tint.toString(16).padStart(6, '0')}`; g.globalAlpha = 0.16; g.fill(); g.globalAlpha = 1;
+ g.fillStyle = '#dbe8ff'; g.font = '600 26px Inter, system-ui, sans-serif'; g.textBaseline = 'middle';
+ g.fillText(price, 68, 351);
+ // CTA hint.
+ g.fillStyle = '#9aa6bb'; g.font = '600 24px Inter, system-ui, sans-serif';
+ g.fillText(a.internal ? 'Walk up · open Studio' : 'Walk up · press E to hire', 44, 430);
+ booth.tex.needsUpdate = true;
+ }
+
+ _drawSign(tex, title, sub) {
+ const cv = tex.image; const W = 1024, H = 150; cv.width = W; cv.height = H;
+ const g = cv.getContext('2d');
+ g.clearRect(0, 0, W, H);
+ g.textAlign = 'center';
+ g.fillStyle = '#eaf2ff'; g.font = '800 64px Inter, system-ui, sans-serif'; g.textBaseline = 'middle';
+ g.fillText(title, W / 2, 52);
+ g.fillStyle = '#7f93b4'; g.font = '500 30px Inter, system-ui, sans-serif';
+ g.fillText(sub, W / 2, 112);
+ tex.needsUpdate = true;
+ }
+
+ // ── styles ────────────────────────────────────────────────────────────────────
+ _injectStyles() {
+ if (document.getElementById('atl-plaza-styles')) return;
+ const s = document.createElement('style');
+ s.id = 'atl-plaza-styles';
+ s.textContent = `
+ .atl-prompt{position:fixed;z-index:45;display:inline-flex;flex-direction:column;align-items:center;gap:2px;
+ padding:8px 14px;border-radius:12px;border:1px solid rgba(155,208,255,.5);
+ background:rgba(10,14,22,.82);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);
+ color:#eaf2ff;font:600 14px/1.2 Inter,system-ui,sans-serif;cursor:pointer;
+ box-shadow:0 8px 30px rgba(0,0,0,.45);transition:transform .12s ease,border-color .12s ease;pointer-events:auto}
+ .atl-prompt:hover{border-color:#9bd0ff;transform:translate(-50%,-100%) translate(var(--x,0),var(--y,0)) scale(1.04)}
+ .atl-prompt-name{font-weight:700}
+ .atl-prompt-hint{color:#8fb4ff;font-size:11px;letter-spacing:.04em;text-transform:uppercase}
+ .atl-prompt-hint kbd{background:rgba(143,180,255,.18);border-radius:4px;padding:1px 5px;font:inherit;font-size:11px;border:1px solid rgba(143,180,255,.35)}
+ .atl-overlay{position:fixed;inset:0;z-index:60;display:grid;place-items:center;padding:20px;
+ background:rgba(4,6,10,.55);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);
+ opacity:0;transition:opacity .2s ease}
+ .atl-overlay.atl-show{opacity:1}
+ .atl-card{position:relative;width:min(440px,92vw);padding:26px;border-radius:20px;
+ background:linear-gradient(180deg,rgba(18,22,32,.96),rgba(11,13,20,.97));
+ border:1px solid rgba(255,255,255,.12);box-shadow:0 30px 80px rgba(0,0,0,.6);
+ color:#f5f8ff;font-family:Inter,system-ui,sans-serif;transform:translateY(8px) scale(.98);transition:transform .2s ease}
+ .atl-overlay.atl-show .atl-card{transform:none}
+ .atl-x{position:absolute;top:14px;right:14px;width:30px;height:30px;border-radius:8px;border:1px solid rgba(255,255,255,.14);
+ background:rgba(255,255,255,.04);color:#cfd8e6;font-size:18px;cursor:pointer;line-height:1;transition:background .12s ease}
+ .atl-x:hover{background:rgba(255,255,255,.12)}
+ .atl-head{display:flex;gap:14px;align-items:center;margin-bottom:14px}
+ .atl-mono{width:56px;height:56px;border-radius:14px;display:grid;place-items:center;flex:0 0 auto;
+ background:color-mix(in srgb,var(--tint) 18%,transparent);border:1px solid var(--tint);
+ color:#eaf2ff;font-weight:700;font-size:26px}
+ .atl-name{font-size:22px;font-weight:700;line-height:1.15}
+ .atl-spec{color:#8fb4ff;font-size:13px;font-weight:600;margin-top:3px;text-transform:uppercase;letter-spacing:.03em}
+ .atl-tag{color:#aeb8c8;font-size:14.5px;line-height:1.5;margin:0 0 14px}
+ .atl-stats{color:#cbd5e6;font-size:13px;margin-bottom:12px}
+ .atl-price{display:inline-block;padding:7px 14px;border-radius:999px;margin-bottom:18px;
+ background:rgba(110,168,255,.14);border:1px solid rgba(110,168,255,.3);color:#dbe8ff;font-weight:600;font-size:14px}
+ .atl-hire{width:100%;padding:13px;border-radius:12px;border:0;cursor:pointer;
+ background:linear-gradient(180deg,#6ea8ff,#4f7fe0);color:#06101f;font-weight:700;font-size:15px;
+ transition:filter .12s ease,transform .12s ease}
+ .atl-hire:hover:not(:disabled){filter:brightness(1.07);transform:translateY(-1px)}
+ .atl-hire:disabled{opacity:.7;cursor:default}
+ .atl-flow{margin:0 0 16px;padding:12px 14px;border-radius:12px;font-size:13px;line-height:1.5;
+ background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.1);color:#cbd5e6}
+ .atl-flow-live{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
+ .atl-step{font-weight:600;color:#6b7689}
+ .atl-step.on{color:#9bd0ff}
+ .atl-step.done{color:#6ee7a8}
+ .atl-step-sep{flex:1;height:1px;min-width:10px;background:rgba(255,255,255,.12)}
+ .atl-flow-done{background:rgba(110,231,168,.1);border-color:rgba(110,231,168,.3);color:#bfeed4}
+ .atl-flow-error{background:rgba(255,107,107,.1);border-color:rgba(255,107,107,.3);color:#ffc9c9}
+ .atl-tx{color:#9bd0ff;text-decoration:none;border-bottom:1px solid rgba(155,208,255,.4)}
+ @media (prefers-reduced-motion: reduce){.atl-overlay,.atl-card,.atl-prompt{transition:none}}
+ `;
+ document.head.appendChild(s);
+ }
+
+ // ── teardown ──────────────────────────────────────────────────────────────────
+ _clearBooths() {
+ for (const b of this.booths) {
+ this.group.remove(b.root);
+ b.root.traverse((o) => {
+ o.geometry?.dispose?.();
+ const m = o.material;
+ if (Array.isArray(m)) m.forEach((mm) => mm?.dispose?.()); else m?.dispose?.();
+ });
+ b.tex.dispose();
+ }
+ this.booths = [];
+ this.activeBooth = null;
+ }
+
+ dispose() {
+ this._disposed = true;
+ window.removeEventListener('keydown', this._onKey);
+ this._closeCard();
+ this.prompt?.remove();
+ this._clearBooths();
+ if (this._daisSign) { this.group.remove(this._daisSign); this._daisSign.geometry.dispose(); this._daisMat.dispose(); this._daisTex.dispose(); }
+ this.scene.remove(this.group);
+ document.getElementById('atl-plaza-styles')?.remove();
+ }
+}
+
+// ── tiny shared helpers ──────────────────────────────────────────────────────────
+function esc(s) {
+ return String(s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
+}
+
+function roundRect(g, x, y, w, h, r) {
+ g.beginPath();
+ g.moveTo(x + r, y);
+ g.arcTo(x + w, y, x + w, y + h, r);
+ g.arcTo(x + w, y + h, x, y + h, r);
+ g.arcTo(x, y + h, x, y, r);
+ g.arcTo(x, y, x + w, y, r);
+ g.closePath();
+}
+
+function fitText(g, text, x, y, maxW, size) {
+ let s = size;
+ g.font = `${g.font.split(' ').slice(0, -2).join(' ')} ${s}px Inter, system-ui, sans-serif`;
+ while (g.measureText(text).width > maxW && s > 12) {
+ s -= 2;
+ g.font = g.font.replace(/\d+px/, `${s}px`);
+ }
+ g.textBaseline = 'middle';
+ g.fillText(text, x, y);
+}
+
+function wrapText(g, text, x, y, maxW, lh, maxLines) {
+ const words = String(text).split(/\s+/);
+ let line = '', lines = 0;
+ g.textBaseline = 'alphabetic';
+ for (let i = 0; i < words.length; i++) {
+ const test = line ? `${line} ${words[i]}` : words[i];
+ if (g.measureText(test).width > maxW && line) {
+ g.fillText(line, x, y + lines * lh);
+ line = words[i]; lines++;
+ if (lines >= maxLines - 1) {
+ // last allowed line — ellipsize the remainder
+ let rest = words.slice(i).join(' ');
+ while (g.measureText(rest + '…').width > maxW && rest.length) rest = rest.slice(0, -1);
+ g.fillText(rest + '…', x, y + lines * lh);
+ return;
+ }
+ } else {
+ line = test;
+ }
+ }
+ g.fillText(line, x, y + lines * lh);
+}
+
+// SSE event reader — same framing /api/x402-pay speaks.
+async function* sse(res) {
+ const reader = res.body.getReader();
+ const dec = new TextDecoder();
+ let buf = '';
+ while (true) {
+ const { value, done } = await reader.read();
+ if (done) break;
+ buf += dec.decode(value, { stream: true });
+ const chunks = buf.split('\n\n');
+ buf = chunks.pop();
+ for (const chunk of chunks) {
+ if (!chunk.trim()) continue;
+ let event = 'message', data = {};
+ for (const line of chunk.split('\n')) {
+ if (line.startsWith('event:')) event = line.slice(6).trim();
+ if (line.startsWith('data:')) { try { data = JSON.parse(line.slice(5).trim()); } catch { /* ignore */ } }
+ }
+ yield { event, data };
+ }
+ }
+}
diff --git a/src/game/arena/atelier.js b/src/game/arena/atelier.js
new file mode 100644
index 000000000..2e6805604
--- /dev/null
+++ b/src/game/arena/atelier.js
@@ -0,0 +1,296 @@
+// Atelier World — entry module.
+//
+// Boots the shared arena engine (OmniologyArena: scene, loop, local-player
+// controller, camera, joystick), loads the local avatar, connects real-time
+// presence over the shared Colyseus `walk_world` room namespaced to
+// `arena:atelier`, and mounts the Atelier marketplace plaza on top. The engine
+// owns movement/camera; this module owns avatars, networking, and the plaza —
+// the same split the Omniology Arena uses.
+//
+// No multiplayer-server changes: we join `walk_world` with a synthetic coin
+// token, so Colyseus isolates the Atelier World into its own room instances and
+// presence/movement/labels come for free.
+
+import { Group, Vector3 } from 'three';
+import { OmniologyArena, REMOTE_LERP } from './arena.js';
+import { CommunityNet } from '../community-net.js';
+import { AnimationManager } from '../animation-manager.js';
+import {
+ loadManifest, resolveAvatarUrl, buildAvatar, playEmoteClip,
+ CLIP_IDLE, CLIP_WALK,
+} from '../avatar-rig.js';
+import { getRequestedAvatar, getPlayCosmetics } from '../play-handoff.js';
+import { applyLoadout } from '../cosmetics-loadout.js';
+import { createAtelierPlaza } from './atelier-plaza.js';
+import { fetchRoster } from './atelier-adapter.js';
+import { log } from '../../shared/log.js';
+
+const ROSTER_POLL_MS = 30_000;
+
+// The synthetic room token. Colyseus filterBy(['coin','tier']) isolates this into
+// its own world instances, separate from every real coin community and the
+// Omniology Arena.
+const ATELIER_COIN = { mint: 'arena:atelier', name: 'Atelier World', symbol: 'ATLR', image: '' };
+
+// A networked peer rendered in the Atelier World: avatar rig + animation + DOM
+// nameplate. Lean port of /play's RemotePlayer; label placement is driven by the
+// PeerManager via arena.project().
+class Peer {
+ constructor(scene, player) {
+ this.scene = scene;
+ this.rig = new Group();
+ this.anim = new AnimationManager();
+ this.tx = player.x; this.ty = player.y; this.tz = player.z; this.tyaw = player.yaw;
+ this.curYaw = player.yaw; this.motion = player.motion || 'idle';
+ this.height = 1.7;
+ this.rig.position.set(player.x, player.y, player.z);
+ scene.add(this.rig);
+
+ this.label = document.createElement('div');
+ this.label.className = 'cc-label';
+ this.label.textContent = player.name || 'guest';
+ document.body.appendChild(this.label);
+ this.bubble = null; this._bubbleTimer = null;
+ this._cosWire = player.cosmetics || '';
+ this.setAvatar(player.avatar);
+ }
+ setAvatar(url) {
+ if (url === this._url) return;
+ this._url = url;
+ try { this.cos?.dispose(); } catch { /* best-effort */ }
+ this.cos = null; this._cosApplied = null;
+ this.rig.clear();
+ this.anim = new AnimationManager();
+ const token = (this._tok = (this._tok || 0) + 1);
+ const anim = this.anim;
+ resolveAvatarUrl(url).then((u) => buildAvatar(this.rig, u, anim).then(({ height }) => {
+ if (this._dead || token !== this._tok) return;
+ this.height = height;
+ anim.crossfadeTo(this.motion === 'walk' || this.motion === 'run' ? CLIP_WALK : CLIP_IDLE, 0);
+ this._dress();
+ })).catch(() => { /* peer avatar failed; nameplate still shows */ });
+ }
+ _dress(wire) {
+ const next = typeof wire === 'string' ? wire : (this._cosWire || '');
+ this._cosWire = next;
+ if (this._dead || !this.height || (this.cos && this._cosApplied === next)) return;
+ this._cosApplied = next;
+ try { this.cos?.dispose(); } catch { /* best-effort */ }
+ this.cos = applyLoadout(this.rig, this.height, next);
+ }
+ apply(player) {
+ this.tx = player.x; this.ty = player.y; this.tz = player.z; this.tyaw = player.yaw;
+ if (player.name) this.label.textContent = player.name;
+ if (player.avatar !== this._url) this.setAvatar(player.avatar);
+ if (player.cosmetics !== undefined && player.cosmetics !== this._cosWire) this._dress(player.cosmetics);
+ if (player.motion !== this.motion) {
+ this.motion = player.motion;
+ this.anim.crossfadeTo(this.motion === 'walk' || this.motion === 'run' ? CLIP_WALK : CLIP_IDLE, 0.18);
+ }
+ if (player.emote && player.emoteTs && player.emoteTs !== this._emoteTs) {
+ this._emoteTs = player.emoteTs;
+ playEmoteClip(this.anim, player.emote, this.motion);
+ }
+ }
+ say(text) {
+ this.bubble?.remove();
+ this.bubble = document.createElement('div');
+ this.bubble.className = 'cc-bubble';
+ this.bubble.textContent = text;
+ document.body.appendChild(this.bubble);
+ clearTimeout(this._bubbleTimer);
+ this._bubbleTimer = setTimeout(() => { this.bubble?.remove(); this.bubble = null; }, 5000);
+ }
+ tick(dt) {
+ this.rig.position.x += (this.tx - this.rig.position.x) * REMOTE_LERP;
+ this.rig.position.y += (this.ty - this.rig.position.y) * REMOTE_LERP;
+ this.rig.position.z += (this.tz - this.rig.position.z) * REMOTE_LERP;
+ let d = this.tyaw - this.curYaw;
+ while (d > Math.PI) d -= Math.PI * 2;
+ while (d < -Math.PI) d += Math.PI * 2;
+ this.curYaw += d * 0.2;
+ this.rig.rotation.y = this.curYaw;
+ this.anim.update(dt);
+ this.cos?.tick(dt);
+ }
+ dispose() {
+ this._dead = true;
+ try { this.cos?.dispose(); } catch { /* best-effort */ }
+ this.scene.remove(this.rig);
+ this.label.remove();
+ this.bubble?.remove();
+ clearTimeout(this._bubbleTimer);
+ }
+}
+
+class AtelierWorld {
+ constructor() {
+ this.canvas = document.getElementById('kx-canvas');
+ this.statusEl = document.getElementById('arena-status');
+ this.peers = new Map();
+ this._rosterTimer = 0;
+ this._disposed = false;
+ }
+
+ async boot() {
+ this.arena = new OmniologyArena(this.canvas);
+
+ // Local avatar — resolved the same way /play does, with a default fallback.
+ await loadManifest().catch((e) => log.warn('[atelier] manifest load failed', e?.message));
+ await this._loadLocalAvatar();
+
+ // Real-time presence.
+ this._connect();
+
+ // The marketplace plaza.
+ this.plaza = createAtelierPlaza(this.arena, {
+ onStatus: (s) => { if (s === 'error') this._setStatus('error', 'Marketplace offline'); },
+ });
+ this.arena.registerUpdatable(this.plaza);
+
+ // Stream our movement to peers every frame (sendMove self-throttles to 15Hz).
+ this.arena.registerUpdatable({ update: () => { if (this.net) this.net.sendMove(this.arena.getLocalState()); } });
+
+ // Tick + label every peer each frame.
+ this.arena.registerUpdatable({ update: (dt) => this._tickPeers(dt) });
+
+ // Pull the agent roster now and on an interval.
+ await this._refreshRoster();
+ this._rosterTimer = setInterval(() => this._refreshRoster(), ROSTER_POLL_MS);
+
+ this._hideLoader();
+ window.addEventListener('pagehide', this._onUnload = () => this.dispose(), { once: true });
+ }
+
+ async _loadLocalAvatar() {
+ const rig = new Group();
+ const anim = new AnimationManager();
+ try {
+ const url = await resolveAvatarUrl(getRequestedAvatar());
+ const { height } = await buildAvatar(rig, url, anim);
+ anim.crossfadeTo(CLIP_IDLE, 0);
+ this.arena.attachLocalAvatar(rig, anim, height);
+ this.arena.seatAtSpawn();
+ try { this._localCos = applyLoadout(rig, height, getPlayCosmetics()); } catch { /* none */ }
+ } catch (e) {
+ log.warn('[atelier] local avatar failed; using default', e?.message);
+ const url = await resolveAvatarUrl('');
+ const { height } = await buildAvatar(rig, url, anim);
+ anim.crossfadeTo(CLIP_IDLE, 0);
+ this.arena.attachLocalAvatar(rig, anim, height);
+ this.arena.seatAtSpawn();
+ }
+ }
+
+ _connect() {
+ let name = 'guest';
+ try { name = localStorage.getItem('cc-name') || 'guest'; } catch { /* storage off */ }
+ this.net = new CommunityNet({
+ name,
+ avatar: getRequestedAvatar(),
+ coin: ATELIER_COIN,
+ tier: '',
+ cosmetics: getPlayCosmetics(),
+ });
+ this.net.on('status', ({ status }) => this._onNetStatus(status));
+ this.net.on('add', (player, id) => {
+ if (id === this.net.sessionId) return;
+ this.peers.set(id, new Peer(this.arena.scene, player));
+ });
+ this.net.on('change', (player, id) => {
+ if (id === this.net.sessionId) return;
+ this.peers.get(id)?.apply(player);
+ });
+ this.net.on('remove', (id) => { this.peers.get(id)?.dispose(); this.peers.delete(id); });
+ this.net.on('chat', ({ id, text }) => this.peers.get(id)?.say(text));
+ this.net.connect();
+ }
+
+ _tickPeers(dt) {
+ const arena = this.arena;
+ for (const [, p] of this.peers) {
+ p.tick(dt);
+ const head = new Vector3(p.rig.position.x, p.rig.position.y + p.height + 0.2, p.rig.position.z);
+ const s = arena.project(head);
+ if (s.visible) {
+ p.label.style.display = '';
+ p.label.style.transform = `translate(-50%, -100%) translate(${s.x}px, ${s.y}px)`;
+ } else {
+ p.label.style.display = 'none';
+ }
+ if (p.bubble) {
+ const bh = arena.project(new Vector3(p.rig.position.x, p.rig.position.y + p.height + 0.7, p.rig.position.z));
+ if (bh.visible) { p.bubble.style.display = ''; p.bubble.style.transform = `translate(-50%, -100%) translate(${bh.x}px, ${bh.y}px)`; }
+ else p.bubble.style.display = 'none';
+ }
+ }
+ }
+
+ async _refreshRoster() {
+ try {
+ const roster = await fetchRoster();
+ if (this._disposed) return;
+ this.plaza.applyRoster(roster);
+ } catch (e) {
+ log.warn('[atelier] roster fetch failed', e?.message);
+ if (!this._disposed) this.plaza.setStatus('error');
+ }
+ }
+
+ // ── status pill ───────────────────────────────────────────────────────────────
+ _onNetStatus(status) {
+ const map = {
+ online: ['online', `${this.peers.size + 1} in world`],
+ connecting: ['connecting', 'Connecting'],
+ offline: ['offline', 'Single-player'],
+ unavailable: ['offline', 'Single-player'],
+ failed: ['connecting', 'Reconnecting'],
+ denied: ['offline', 'Single-player'],
+ };
+ const [state, label] = map[status] || ['connecting', 'Connecting'];
+ this._setStatus(state, label);
+ }
+ _setStatus(state, label) {
+ if (!this.statusEl) return;
+ this.statusEl.dataset.state = state;
+ const l = this.statusEl.querySelector('.label');
+ if (l) l.textContent = label;
+ }
+
+ _hideLoader() {
+ const l = document.getElementById('kx-loading');
+ if (!l) return;
+ l.classList.add('kx-hidden');
+ try { window.__ccBootAvatar?.dispose?.(); } catch { /* best-effort */ }
+ setTimeout(() => { if (l.classList.contains('kx-hidden')) l.style.display = 'none'; }, 600);
+ }
+
+ dispose() {
+ if (this._disposed) return;
+ this._disposed = true;
+ clearInterval(this._rosterTimer);
+ try { this.net?.destroy(); } catch { /* best-effort */ }
+ for (const [, p] of this.peers) p.dispose();
+ this.peers.clear();
+ try { this.plaza?.dispose(); } catch { /* best-effort */ }
+ try { this._localCos?.dispose?.(); } catch { /* best-effort */ }
+ try { this.arena?.dispose(); } catch { /* best-effort */ }
+ }
+}
+
+// ── boot ─────────────────────────────────────────────────────────────────────────
+const world = new AtelierWorld();
+world.boot().catch((err) => {
+ log.error('[atelier] boot failed', err);
+ const l = document.getElementById('kx-loading');
+ if (l) {
+ const sub = l.querySelector('.kx-loading-sub');
+ const noWebGL = err?.code === 'NO_WEBGL' || /webgl|context/i.test(err?.message || '');
+ if (sub) sub.textContent = noWebGL ? 'WebGL is unavailable in this browser.' : 'Could not load the Atelier World.';
+ const mark = l.querySelector('.kx-loading-mark');
+ if (mark) mark.textContent = noWebGL ? 'WebGL unavailable' : 'Load failed';
+ }
+});
+
+// Expose for debugging / teardown parity with /play.
+window.__atelierWorld = world;
diff --git a/src/game/arena/entry-desk.js b/src/game/arena/entry-desk.js
index d7d9e927a..7917d9447 100644
--- a/src/game/arena/entry-desk.js
+++ b/src/game/arena/entry-desk.js
@@ -24,7 +24,7 @@
import {
Group, Mesh, MeshBasicMaterial, MeshStandardMaterial,
BoxGeometry, PlaneGeometry, RingGeometry, CylinderGeometry,
- CanvasTexture, SRGBColorSpace, DoubleSide, PointLight, Vector3,
+ CanvasTexture, SRGBColorSpace, DoubleSide, PointLight,
} from 'three';
import { payX402Stream } from '../../agent-x402-pay.js';
import {
@@ -47,10 +47,6 @@ const STAGES = [
];
const escHtml = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
-const fmtUsd = (n) => {
- const v = Number(n) || 0;
- return '$' + (v >= 0.01 || v === 0 ? v.toFixed(2) : v.toFixed(4));
-};
const fmtUsdc = (micro) => `${((Number(micro) || 0) / 1e6).toFixed(4)} USDC`;
const shortAddr = (a) => (a ? `${String(a).slice(0, 6)}…${String(a).slice(-4)}` : '—');
@@ -197,7 +193,7 @@ class EntryDesk {
this.celebrateLight.position.set(0, 1.7, 0.4);
group.add(this.celebrateLight);
- scene.add(group);
+ this.scene.add(group);
}
_paintScreen(headline, sub) {
@@ -484,7 +480,7 @@ class EntryDesk {
const result = mode === 'free'
? await this._submitFree(request)
: await this._submitPaid(request);
- this._onSuccess(liveContest, result, request);
+ this._onSuccess(liveContest, result);
} catch (err) {
this._renderError(err);
} finally {
@@ -503,7 +499,7 @@ class EntryDesk {
headers: { 'content-type': 'application/json', accept: 'application/json' },
body: JSON.stringify(request.body),
});
- } catch (err) {
+ } catch {
throw Object.assign(new Error('Could not reach Omniology to submit your entry.'), { code: 'endpoint_unreachable' });
}
let body = null;
@@ -548,7 +544,7 @@ class EntryDesk {
);
}
- _onSuccess(contestId, result, request) {
+ _onSuccess(contestId, result) {
this._submitted.add(String(contestId));
const agentName = this.getAgentName();
const confirmation = readEntryConfirmation(result);
diff --git a/src/game/arena/omniology-adapter.js b/src/game/arena/omniology-adapter.js
index ae930d627..a2558ab1b 100644
--- a/src/game/arena/omniology-adapter.js
+++ b/src/game/arena/omniology-adapter.js
@@ -261,7 +261,7 @@ export function entryFeeMode() {
let v = '';
if (typeof window !== 'undefined' && window.OMNIOLOGY_ENTRY_FEE) v = String(window.OMNIOLOGY_ENTRY_FEE);
if (!v && typeof document !== 'undefined') v = document.querySelector('meta[name="omniology-entry-fee"]')?.getAttribute('content') || '';
- if (!v) { try { v = String(import.meta?.env?.VITE_OMNIOLOGY_ENTRY_FEE || ''); } catch (_) { /* node */ } }
+ if (!v) { try { v = String(import.meta?.env?.VITE_OMNIOLOGY_ENTRY_FEE || ''); } catch { /* node */ } }
v = v.trim().toLowerCase();
return v === 'free' || v === 'paid' ? v : 'auto';
}
diff --git a/tests/agora-task-supply.test.js b/tests/agora-task-supply.test.js
index 65f6962c1..8f3cc1317 100644
--- a/tests/agora-task-supply.test.js
+++ b/tests/agora-task-supply.test.js
@@ -185,7 +185,10 @@ describe('roster assembly', () => {
const specs = buildRoster([], { maxCitizens: 4 });
expect(specs.length).toBe(4);
expect(specs.every((s) => s.kind === 'agent')).toBe(true);
- expect(specs.every((s) => s.professionBits === 1n)).toBe(true); // all Fetchers in Task 02
+ // Each standalone citizen works a specialty (Task 04) but ALWAYS carries the
+ // Fetcher bit, so it satisfies the devnet dispatcher's task gate and never
+ // idles for lack of work.
+ expect(specs.every((s) => capabilitiesSatisfy(s.professionBits, 1n))).toBe(true);
});
it('respects the citizen cap', () => {
diff --git a/tests/arena-venue.test.js b/tests/arena-venue.test.js
index 3d70951ef..eb909503a 100644
--- a/tests/arena-venue.test.js
+++ b/tests/arena-venue.test.js
@@ -120,18 +120,18 @@ describe('resolveArenaAnchors', () => {
const empties = collectArenaEmpties(root, ARENA_REQUIRED_EMPTIES);
const anchors = resolveArenaAnchors(empties);
- expect(anchors.spawn.pos).toBeInstanceOf(Vector3);
- expect(anchors.spawn.pos.toArray()).toEqual(positions.spawn_01);
- expect(anchors.spawn.yaw).toBeCloseTo(Math.PI, 5);
+ expect(anchors.spawn.position).toBeInstanceOf(Vector3);
+ expect(anchors.spawn.position.toArray()).toEqual(positions.spawn_01);
+ expect(anchors.spawn.rotationY).toBeCloseTo(Math.PI, 5);
expect(anchors.screens).toHaveLength(ARENA_SCREEN_SLOTS);
- expect(anchors.screens[0].pos.toArray()).toEqual(positions.screen_01);
- expect(anchors.screens[0].yaw).toBeCloseTo(Math.PI / 2, 5);
+ expect(anchors.screens[0].position.toArray()).toEqual(positions.screen_01);
+ expect(anchors.screens[0].rotationY).toBeCloseTo(Math.PI / 2, 5);
expect(anchors.screens[0].width).toBe(9); // from scale.x
// Unscaled screens fall back to the default width.
expect(anchors.screens[1].width).toBe(DEFAULT_SCREEN_WIDTH_M);
- expect(anchors.desk.pos.toArray()).toEqual(positions.desk_01);
+ expect(anchors.desk.position.toArray()).toEqual(positions.desk_01);
expect(anchors.desk.node.name).toBe('desk_01');
});
@@ -160,11 +160,11 @@ describe('resolveArenaAnchors', () => {
const empties = collectArenaEmpties(root, ARENA_REQUIRED_EMPTIES);
const anchors = resolveArenaAnchors(empties);
- expect(anchors.camera_intro.pos.toArray()).toEqual(positions.camera_intro);
+ expect(anchors.camera_intro.position.toArray()).toEqual(positions.camera_intro);
// camera_intro is rotated 180° about Y, so its forward (-Z) points +Z;
// lookAt sits ahead of the camera at greater Z than the camera itself.
- expect(anchors.camera_intro.lookAt.z).toBeGreaterThan(anchors.camera_intro.pos.z);
- expect(anchors.camera_intro.lookAt.x).toBeCloseTo(anchors.camera_intro.pos.x, 5);
+ expect(anchors.camera_intro.lookAt.z).toBeGreaterThan(anchors.camera_intro.position.z);
+ expect(anchors.camera_intro.lookAt.x).toBeCloseTo(anchors.camera_intro.position.x, 5);
});
it('honors a parent transform when computing world positions', () => {
@@ -187,7 +187,7 @@ describe('arenaBounds', () => {
const bounds = arenaBounds(anchors);
// Spawn must be reachable (inside the clamp).
- const s = anchors.spawn.pos;
+ const s = anchors.spawn.position;
const clampedSpawn = bounds.clamp(s.x, s.z);
expect(clampedSpawn.x).toBeCloseTo(s.x, 5);
expect(clampedSpawn.z).toBeCloseTo(s.z, 5);
diff --git a/vercel.json b/vercel.json
index 1c9bb68cc..bdd75d977 100644
--- a/vercel.json
+++ b/vercel.json
@@ -886,6 +886,10 @@
"src": "/arena/omniology/?",
"dest": "/arena/omniology.html"
},
+ {
+ "src": "/world/atelier/?",
+ "dest": "/world/atelier.html"
+ },
{
"src": "/arena/?",
"dest": "/arena.html"
diff --git a/vite.config.js b/vite.config.js
index 33a36a2f2..8ca56a674 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -847,6 +847,8 @@ support: resolve(__dirname, 'pages/support.html'),
'/alpha-copilot/': resolve(root, 'pages/alpha-copilot.html'),
'/arena/omniology': resolve(root, 'pages/arena/omniology.html'),
'/arena/omniology/': resolve(root, 'pages/arena/omniology.html'),
+ '/world/atelier': resolve(root, 'pages/world/atelier.html'),
+ '/world/atelier/': resolve(root, 'pages/world/atelier.html'),
'/arena': resolve(root, 'pages/arena.html'),
'/arena/': resolve(root, 'pages/arena.html'),
'/mirror': resolve(root, 'pages/mirror.html'),