Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
Roll back recent unreleased feature batch
udvk2249189a7d2f
diff --git a/.gitignore b/.gitignoreindex e7ad78fac..64ce92c5e 100644--- a/.gitignore+++ b/.gitignore@@ -282,4 +282,3 @@ pages/ibm/hello.htmlthree-ws-prod-log-export-2026-06-24T13-33-58.jsonthree-ws-prod-log-export-2026-06-25T07-22-45.jsonthree-ws-prod-log-export-2026-06-25T19-38-22.json-docs/omniology-arena/QUESTIONS-FOR-OMNIOLOGY.mddiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9ed242907..96d8cbd85 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,10 +10,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr## 2026-06-25-- **New MCP server: enter Omniology contests from any AI agent** — We shipped @three-ws/omniology-mcp — a Model Context Protocol server that opens Omniology's fast-paced AI-agent contests to any MCP client or agent, not just the 3D world. Three free tools read the live feed: list the running contest, pull a contest's details, and fetch its leaderboard. A fourth tool, submit_entry, lets an agent enter a contest and pays the entry fee in USDC on Solana automatically through the x402 payment protocol — and if the contest rejects the entry, the payment is cancelled so you're never charged for a submission that didn't land. Listing it this way also makes Omniology discoverable in the x402 Bazaar, so other agents can find and enter contests on their own. Install with npx @three-ws/omniology-mcp. `[sdk]`- **Production error sweep: tier page, image understanding, and on-chain indexing** — We pulled a full day of production logs and fixed what was actually failing. The $THREE tier page sometimes flashed a blank screen on a fast or cached load — a startup step ran a moment before it was ready; it now loads reliably every time. Image understanding (the vision service behind Forge upload checks, the fact checker, and gallery alt text) could hang until the request was force-killed with no answer; it now works through its models within a fixed time budget and always returns either a result or a clear error. Behind the scenes, delegation indexing and agent-reputation reads were leaning on public Ethereum RPC nodes that have since gone behind bot-walls or started refusing datacenter traffic, which meant on-chain permissions and ERC-8004 reputation kept failing to resolve; we replaced the entire fallback set with providers verified to answer reliably. We also fixed a crash in the guided feature tour when it launched before a page finished loading, and the fullscreen button in the scene editor on Safari and in-app browsers. No action needed. `[fix, infra]`-- **Pump dashboard now loads inside X/Twitter's in-app browser** — Opening the Pump trading desk from a link tapped inside X/Twitter (or a similar embedded mobile browser) showed a blank page. Those in-app browsers block local storage entirely, and the dashboard read its saved settings the instant it loaded — so the page crashed before it could draw anything. It now detects a blocked store and falls back to sensible defaults in memory, so the desk loads everywhere; your saved config still persists normally in a regular browser. No action needed. (`/pump-dashboard`) `[fix]`-- **Stability sweep: live page, dashboards, and the galaxy feed never hard-fail** — A second pass on the day's production logs, this time on resilience. The $THREE Live page crashed for visitors running privacy or anti-popup browser extensions — those tools strip the on-screen stats overlays, and a missing panel was taking the whole 3D scene down with it; the visualization now keeps rendering no matter what the page chrome looks like. Opening a dashboard could occasionally throw an error instead of loading when the sign-in check hit a momentary hiccup; it now retries cleanly through the login flow. The live Galaxy money-feed and the $THREE holder leaderboard used to return an error page when a database query ran long under load — they now serve the last good snapshot (or an honestly-empty view) instantly instead. We also stopped a slow cache server, a slow payment partner, or a heavy background job from ever stalling a request to the point of a timeout, and quieted a wave of harmless noise in our error logs so real issues stand out. No action needed. `[fix, improvement]`## 2026-06-24diff --git a/STRUCTURE.md b/STRUCTURE.mdindex 9b5586ff9..a5364d58b 100644--- a/STRUCTURE.md+++ b/STRUCTURE.md@@ -30,7 +30,7 @@ bottom.| On-chain skill licenses | [contracts/skill-license/](contracts/skill-license) `→ /api/skills/license-onchain` | In-repo | Anchor program: each purchased skill = a 1/1 SPL NFT + `SkillLicense` PDA, a trustless alternative to DB-backed access checks. Backend: [api/_lib/skill-license-onchain.js](api/_lib/skill-license-onchain.js) || 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, 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) |+| MCP integration | [mcp-server/](mcp-server), [mcp-bridge/](mcp-bridge), [packages/*-mcp/](packages) | 31 npm servers + 6 hosted remote, 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) || 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`. See [SNS_PARTNERSHIP_PROPOSAL.md](docs/internal/SNS_PARTNERSHIP_PROPOSAL.md) |## npm workspaces@@ -78,7 +78,6 @@ packages/kol-mcp/ → @three-ws/kol-mcp (MCP server — pepackages/clash-mcp/ → @three-ws/clash-mcp (MCP server — Coin Clash faction battles)packages/tutor-mcp/ → @three-ws/tutor-mcp (MCP server — itemized learning-session ledger)packages/loom-mcp/ → @three-ws/loom-mcp (MCP server — Loom 3D-creation gallery: browse, fetch, submit)-packages/omniology-mcp/ → @three-ws/omniology-mcp (MCP server — Omniology contests: list/get/leaderboard free, submit_entry x402 USDC)walk-sdk/ → @three-ws/walk (page walking companion + playground + avatar picker)```diff --git a/data/changelog.json b/data/changelog.jsonindex 03f1ca9fc..1c30a423d 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,23 +1,6 @@{"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [- {- "date": "2026-06-25",- "title": "New MCP server: enter Omniology contests from any AI agent",- "summary": "We shipped @three-ws/omniology-mcp — a Model Context Protocol server that opens Omniology's fast-paced AI-agent contests to any MCP client or agent, not just the 3D world. Three free tools read the live feed: list the running contest, pull a contest's details, and fetch its leaderboard. A fourth tool, submit_entry, lets an agent enter a contest and pays the entry fee in USDC on Solana automatically through the x402 payment protocol — and if the contest rejects the entry, the payment is cancelled so you're never charged for a submission that didn't land. Listing it this way also makes Omniology discoverable in the x402 Bazaar, so other agents can find and enter contests on their own. Install with npx @three-ws/omniology-mcp.",- "tags": [- "sdk"- ]- },- {- "date": "2026-06-25",- "title": "Pump dashboard now loads inside X/Twitter's in-app browser",- "summary": "Opening the Pump trading desk from a link tapped inside X/Twitter (or a similar embedded mobile browser) showed a blank page. Those in-app browsers block local storage entirely, and the dashboard read its saved settings the instant it loaded — so the page crashed before it could draw anything. It now detects a blocked store and falls back to sensible defaults in memory, so the desk loads everywhere; your saved config still persists normally in a regular browser. No action needed.",- "tags": [- "fix"- ],- "link": "/pump-dashboard"- },{"date": "2026-06-25","title": "Stability sweep: live page, dashboards, and the galaxy feed never hard-fail",diff --git a/docs/mcp.md b/docs/mcp.mdindex fc6efec3e..5848afa41 100644--- a/docs/mcp.md+++ b/docs/mcp.md@@ -58,7 +58,7 @@ There are two kinds. **Hosted remote servers** run over Streamable HTTP with not| pump.fun | `/api/pump-fun-mcp` | Free, read-only pump.fun + Solana token tools || IBM x402 | `/api/ibm-mcp` | Pay-per-use IBM Granite AI |-**Thirty-three install-and-run servers** on npm under the `@three-ws` scope — each runs over stdio with one command:+**Thirty-two install-and-run servers** on npm under the `@three-ws` scope — each runs over stdio with one command:```bash# 3D & avatars@@ -110,7 +110,6 @@ npx -y @three-ws/agora-mcp # join Agora's agent economy: browse the boarnpx -y @three-ws/clash-mcp # Coin Clash faction battlesnpx -y @three-ws/tutor-mcp # itemized learning-session ledgernpx -y @three-ws/loom-mcp # browse & contribute to the Loom 3D-creation gallery-npx -y @three-ws/omniology-mcp # read Omniology contests free; enter them paid in USDC via x402```Every one is also registered in the MCP registry under the `io.github.nirholas/*` namespace.diff --git a/docs/omniology-arena/01-scaffold-and-multiplayer.md b/docs/omniology-arena/01-scaffold-and-multiplayer.mddeleted file mode 100644index d9a66b01e..000000000--- a/docs/omniology-arena/01-scaffold-and-multiplayer.md+++ /dev/null@@ -1,39 +0,0 @@-# Prompt 01 — Arena scaffold + multiplayer presence--You are a senior engineer on three.ws. Build the foundational surface for the-**Omniology Arena**: a new standalone 3D world route where a player spawns into a-lit space, moves with keyboard/touch, and sees other real players present via the-existing Colyseus multiplayer server — with **zero changes to the multiplayer-server**. This is the skeleton that prompts 02–06 plug into.--## Read first (required)-- `docs/omniology-arena/README.md` and `docs/omniology-arena/CONTRACTS.md`-- `CLAUDE.md` (operating rules — non-negotiable: no mocks, no stubs, finish what you write, design every state)-- `pages/play.html` — the reference page (canvas `#kx-canvas`, loading `#kx-loading`, `<meta name="game-server">` ~line 24)-- `src/game/coincommunities.js` — reference world bootstrap. Study: `enter()`, the render loop `_loop()` (~2706–2745), local movement `_stepLocal()` (~2755–2800), camera `_updateCamera()` (~2848–2860), and `RemotePlayer` (~126–284). Constants: `MOVE_SPEED 4.2`, `RUN_SPEED 8.0`, `GRAVITY 15`, `JUMP_VELOCITY 5.5`, `REMOTE_LERP 0.18`, joystick deadzone `0.12`.-- `src/game/community-net.js` — the Colyseus client wrapper. Note `ROOM_NAME = 'walk_world'`, the `joinOrCreate('walk_world', { token, tier, name, avatar, … })` call, and the server-URL resolution order (`window.GAME_SERVER_URL` → localhost → `<meta name="game-server">` → `VITE_GAME_SERVER_URL`).-- `src/game/avatar-rig.js` — `buildAvatar(rig, url, anim)`, `resolveAvatarUrl()`, the animation manifest at `/animations/manifest.json`.-- `multiplayer/src/index.js` — confirm `gameServer.define('walk_world', WalkRoom).filterBy(['coin','tier'])`, and read `WalkRoom.onAuth` to confirm an **open** join (no holder/play gate) works when `tier:''` and `PLAY_GATE_MINT` is unset. Report what you find — if a global gate would block open access, surface it (do not work around it silently).--## Verify before you build-- Check whether `pages/arena.html`, `pages/play/arena.html`, and `src/play-arena.js` already exist and what they are (`vite.config.js` inputs ~468–479, `vercel.json` routes ~878–892). **Do not collide.** Build the new surface at route **`/arena/omniology`** (page `pages/arena/omniology.html`, vite input key `arena-omniology`, vercel route `/arena/omniology/?` → that html). If an existing arena page is clearly unused scaffolding, note it but do not delete without cause.--## Build-1. **Page** `pages/arena/omniology.html`: copy the structure of `pages/play.html` — a full-screen `<canvas>`, a designed loading overlay, and the `<meta name="game-server" content="…">` tag (same value as play.html). Add `<meta name="omniology-base" content="">` (empty for now; CONTRACTS §3). Module script → `/src/game/arena/omniology.js`.-2. **Wiring**: add the vite input (`vite.config.js`) and the vercel route (`vercel.json`). Match the surrounding formatting exactly.-3. **Bootstrap** `src/game/arena/arena.js`: an `OmniologyArena` class that owns `scene`, `renderer` (shadows on, `PCFShadowMap`), `camera`, a render loop, and a `registerUpdatable(obj)` registry whose members get `update(dt)` each frame (per CONTRACTS §2.4). Provide an `anchors` field initialized to sensible defaults now (a spawn point, a few forward screen positions, a desk position) — prompt 02 will overwrite these from the venue GLB. Expose `dispose()` with full teardown (geometry/material/texture disposal, listener removal) modeled on `coincommunities.js leave()`.-4. **Entry module** `src/game/arena/omniology.js`: read player name/avatar (reuse whatever `/play` uses to resolve the local avatar and the boot-avatar preview), instantiate `OmniologyArena`, and connect multiplayer via `CommunityNet` with `coin: { mint: 'arena:omniology', name: 'Omniology Arena', symbol: 'OMNI', image: '' }`, `tier: ''`. Render the local avatar and all remote players (reuse `RemotePlayer` or extract its logic — prefer reuse). Name labels, interpolation at `REMOTE_LERP`, and the 15Hz move send must work.-5. **Controls**: keyboard + on-screen joystick + drag-to-orbit camera, identical feel to `/play`. Mobile must work (touch joystick, touch drag). Reuse the `/play` input code rather than reinventing it.-6. **Environment placeholder**: a simple lit ground + sky/fog so the space reads as a real room (prompt 02 replaces it with the venue). Not a void.--## Acceptance criteria-- Visiting `/arena/omniology` (via `npm run dev`, port 3000) loads with a designed loading state, then a navigable lit space.-- Two browser tabs see each other move in real time, with name labels and smooth interpolation. Confirm in the Network/WS tab that it joined a `walk_world` instance keyed to `arena:omniology` (isolated from real coin worlds).-- No multiplayer-server file was modified. No console errors or warnings from your code.-- Local + remote avatars load and animate (idle/walk), no T-pose flash.-- `dispose()` fully tears down on navigation away (no leaked rAF, listeners, or GPU memory).-- `npm test` still passes. Review your own `git diff` before declaring done.--## Hand-off to prompt 02-Leave clear `anchors` defaults and a documented way for the venue loader to-replace them. Do not author the venue here.diff --git a/docs/omniology-arena/02-venue-and-anchors.md b/docs/omniology-arena/02-venue-and-anchors.mddeleted file mode 100644index 5bfae5151..000000000--- a/docs/omniology-arena/02-venue-and-anchors.md+++ /dev/null@@ -1,58 +0,0 @@-# Prompt 02 — Premium venue GLB + named anchors--Build the physical Omniology Arena: a premium, authored 3D venue with named-anchor points (spawn, screen mounts, entry-desk spot, lighting), loaded into the-bootstrap from prompt 01. Model the anchor contract on `/club`'s proven system.--## Read first (required)-- `docs/omniology-arena/README.md`, `docs/omniology-arena/CONTRACTS.md`, `CLAUDE.md`-- `src/club-venue.js` — the named-empty contract. Study `REQUIRED_VENUE_EMPTIES`, `collectVenueEmpties(root, required)` (throws if any missing — **no silent fallback**), and `resolveVenueAnchors(empties, slotCount)`. Note the **underscore naming convention** (`screen_01`, not `screen.01`) and *why* (GLTF `sanitizeNodeName` strips `[]:./`).-- `src/club.js` — how the club loads the venue GLB, runs `collectVenueEmpties`, applies anchors, sets up HDRI via `PMREMGenerator`, lighting rig, bloom/tone-mapping post pipeline, and per-mesh shadow opt-in. Reuse these patterns.-- `scripts/build-club-venue.mjs`, `scripts/build-club-hdri.mjs` — how club assets are generated procedurally with `@gltf-transform/core` and wired to `npm run build:club-venue` / `build:club-hdri`. Mirror this approach.-- `public/club/venue/LICENSES.md` — asset provenance discipline you must follow.-- `src/game/arena/arena.js` from prompt 01 — the `anchors` field you will populate.--## Build-1. **Anchor module** `src/game/arena/arena-venue.js`: export `ARENA_REQUIRED_EMPTIES`, `collectArenaEmpties(root)`, and `resolveArenaAnchors(empties)` returning a typed object:- ```- { spawn:{pos,yaw}, screens:[{pos,yaw,width}], desk:{pos,yaw}, lights:[…], camera_intro:{pos,lookAt} }- ```- Reuse `collectVenueEmpties` semantics (hard error listing missing anchors). Cover it with a test like `tests/club-venue-load.test.js` → `tests/arena-venue.test.js`.-2. **Venue GLB** at `public/arena/omniology/venue.glb`, generated by a new- `scripts/build-arena-venue.mjs` (procedural, like the club builder) OR a- designed GLB if you author one — either way it must contain every- `ARENA_REQUIRED_EMPTIES` anchor with underscore names. Required anchors at- minimum: `spawn_01`, `screen_01`…`screen_03` (the contest walls), `desk_01`- (entry desk), `light_key`, `light_fill`, `light_rim_01..0N`, `camera_intro`.- Add `npm run build:arena-venue` to `package.json` and document assets in a new- `public/arena/omniology/LICENSES.md`.-3. **HDRI / environment** `public/arena/omniology/hdri.hdr` via- `scripts/build-arena-hdri.mjs` (or reuse a suitable existing CC0 asset with- provenance). Apply via `PMREMGenerator` exactly like club.-4. **Mount in bootstrap**: in `OmniologyArena`, replace the prompt-01 placeholder- environment — load the venue GLB + HDRI in parallel (with a real progress- indicator feeding the loading overlay), run `collectArenaEmpties` +- `resolveArenaAnchors`, and overwrite `this.anchors`. Spawn the local player at- `spawn.pos/yaw`. Set up the lighting rig from the light anchors. Add a tasteful- post pipeline (bloom + ACES tone mapping + vignette) gated by a perf check.-5. **Collision / bounds**: define the walkable region (venue footprint) and clamp- the player to it (client-side clamp like `/play`'s `WORLD_BOUND`; reuse zone- helpers from `src/game/world-zones.js` if useful). Keep players inside the room.-6. **Performance**: instance/merge repeated structural meshes; one key light with- shadows, the rest cheap; respect a perf profile (mirror `src/club-perf.js`).- The venue must hold 60fps on a mid-tier laptop and run on mobile.--## Acceptance criteria-- `/arena/omniology` shows a premium, well-lit, screenshot-worthy room (not a gray- box). Spawn, lighting, and camera intro come from GLB anchors — confirm by moving- an anchor in the build script and seeing the runtime follow.-- Missing an anchor throws a clear authoring error (verified by the new test).-- `npm run build:arena-venue` (and the HDRI builder) are reproducible and the- outputs are committed with a `LICENSES.md`.-- Multiplayer from prompt 01 still works; players spawn at `spawn_01` and are bounded.-- No console errors/warnings. `npm test` passes (including the new anchor test).-- 60fps mid-tier; verified in a real browser.--## Hand-off-`this.anchors.screens[]` and `this.anchors.desk` are the mount points prompts 03-and 04 consume. Do not build screens or the desk here.diff --git a/docs/omniology-arena/03-live-contest-screens.md b/docs/omniology-arena/03-live-contest-screens.mddeleted file mode 100644index 61944d20c..000000000--- a/docs/omniology-arena/03-live-contest-screens.md+++ /dev/null@@ -1,77 +0,0 @@-# Prompt 03 — Live contest screens--Build the in-world screens that show Omniology's live contests: the current-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, §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. **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:- - **Now playing**: contest title, round number, prize (USDC), and a large- countdown to `closesMs` corrected by `serverNowMs` drift. Color shifts as- time runs low. When a round flips (round number changes), animate a brief- "NEW ROUND" sweep.- - **Leaderboard**: top entries with rank, agent, score, optional thumbnail.- - **Live ticker**: recent entries scrolling in; `pushEntry()` inserts- optimistically (used by the desk in prompt 04).- - A pulsing LIVE/OFFLINE status badge driven by `setStatus()`.-3. **Polling controller**: one poller (not one per screen) calls- `fetchLiveFeed()` on an interval tuned to the 88s cadence (e.g. every 5s, and- immediately re-poll right after a detected round close to catch the flip).- Pause polling on `document.hidden`; resume on focus. Feed each screen via- `applyFeed()`. On error, `setStatus('error')` with a designed retry/backoff.-4. **Mount**: in the arena bootstrap, create one `contest-screen` per- `this.anchors.screens[]` entry, add to scene, and `registerUpdatable()` each- so they redraw and advance the countdown every frame. (You may give the three- walls different roles — e.g. wall 1 now-playing, wall 2 leaderboard, wall 3- winners — via an option flag, but one component handles all.)-5. **States (all designed, per CLAUDE.md)**: loading (skeleton on the canvas),- live (data), empty (between rounds / no contest — tell the viewer what's- next, e.g. "Next round opens in…"), error (Omniology unreachable — calm,- non-alarming, auto-retrying), unconfigured (no base URL set — a tasteful- "connecting to Omniology" placeholder, not fake leaderboard rows).--## Acceptance criteria-- 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.)-- Network tab shows real GET polls; polling pauses when the tab is hidden.-- Multiple screens share one poller; no duplicate requests per screen.-- `dispose()` cleans canvas/texture/geometry and cancels timers.-- No console errors/warnings. `npm test` passes. 60fps maintained with screens live.--## Hand-off-Export the screen handles (or a `pushEntry` hook) so prompt 04's desk can call-`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.mddeleted file mode 100644index 5f85185d5..000000000--- a/docs/omniology-arena/04-entry-desk-x402-submit.md+++ /dev/null@@ -1,88 +0,0 @@-# 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 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. §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--### 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-- **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 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.mddeleted file mode 100644index 7ba9a371a..000000000--- a/docs/omniology-arena/05-omniology-mcp-server.md+++ /dev/null@@ -1,66 +0,0 @@-# Prompt 05 — Omniology MCP: consume theirs (optional thin wrapper)--**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` (§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).--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 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-- (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-Independent of the world build. If A-only, no changelog entry is needed (internal-config).diff --git a/docs/omniology-arena/06-polish-qa-launch.md b/docs/omniology-arena/06-polish-qa-launch.mddeleted file mode 100644index 0ba22e348..000000000--- a/docs/omniology-arena/06-polish-qa-launch.md+++ /dev/null@@ -1,65 +0,0 @@-# Prompt 06 — Polish, QA, and launch--The Omniology Arena is functionally built (prompts 01–05). This pass makes it-demo-perfect and durable: every state designed, responsive, accessible,-performant, tested, documented, and verified end-to-end in a real browser. The-goal is that it "just works 100%" with no follow-up babysitting.--## Read first (required)-- `docs/omniology-arena/README.md`, `CONTRACTS.md`, and prompts `01`–`05`-- `CLAUDE.md` — especially the **Definition of done** and **Self-review protocol** checklists. You are enforcing them here.-- The files produced by prompts 01–04 under `src/game/arena/`, the page- `pages/arena/omniology.html`, and the venue assets under `public/arena/omniology/`.-- `src/club-perf.js` (perf profiles) and the weaknesses noted in the build plan.--## Do-1. **State audit** — for the world, screens, and desk verify all of: loading,- empty, error, populated, overflow (very long agent names, 0 / 1 / many- leaderboard rows, 0 entries, a stalled round), unconfigured, and- network-failure-mid-submit. Fix any undesigned or ugly state. Skeleton- loaders, not spinners. No blank voids.-2. **Responsiveness** — verify at 320px, 768px, 1440px. Touch controls, the- compose UI, and the proximity prompt must all work on mobile. No fixed widths- that break.-3. **Accessibility** — keyboard navigation for the desk/compose UI, focus rings,- ARIA labels on interactive controls, sufficient contrast on canvas text,- `prefers-reduced-motion` honored across bloom/celebration/animations.-4. **Performance** — profile a populated room (multiple players + 3 live screens +- desk). Hold 60fps mid-tier and run on mobile. Apply the improvements the recon- flagged where they pay off: instance/merge structural and repeated meshes,- LOD or billboard distant remote avatars, share one poller across screens,- ensure polling/animation pause on `document.hidden`. Cap draw calls. No jank.-5. **Resilience** — Omniology feed down → screens degrade calmly and auto-recover.- Multiplayer server unreachable → the world still loads single-player with a- clear notice. Submit failure → no double-charge, accurate messaging. A round- flipping mid-submit is handled.-6. **Cross-links** — make the Arena reachable and navigable: add it where users- would look for it (the relevant directory/nav/launch surface), and ensure- leaving returns cleanly. A dead-end isn't done.-7. **Tests** — add/extend tests: the venue anchor test (02), adapter- normalization (03), and the desk's SSE event handling against the documented- `/api/x402-pay` event shapes (04). `npm test` green.-8. **Changelog** — add a holder-readable `feature` entry to `data/changelog.json`- for the Omniology Arena (plain language, no jargon; optional `link` to the- live path), then `npm run build:pages` to regenerate + validate.-9. **Final verification** — run `npm run dev`, walk the full journey in a real- browser: spawn → see another player → watch a live ~88s contest on screens →- walk to the desk → submit a real entry → see it confirm and hit the ticker.- Capture that there are **no console errors or warnings** and that the Network- tab shows real API calls succeeding. Run the repo's responsive-audit script if- present.--## Acceptance criteria (the bar)-- Every box in CLAUDE.md's **Definition of done** is true and you can say so- explicitly, per surface.-- The full end-to-end journey works in a real browser with real data, zero- console errors/warnings.-- 60fps mid-tier; mobile usable. All states designed. A11y verified.-- `npm test` passes; changelog entry added and `build:pages` is green.-- `git diff` reviewed line-by-line; every change justified. You would be proud to- demo this to a room of senior engineers and to Omniology.--## Do NOT-- Do not commit/push unless explicitly told. Do not modify the multiplayer server.-- Do not reference any coin other than `$THREE` (USDC payment asset is fine).-- Do not leave any TODO, stub, mock, sample array, or `setTimeout` fake progress.diff --git a/docs/omniology-arena/CONTRACTS.md b/docs/omniology-arena/CONTRACTS.mddeleted file mode 100644index 735c808f0..000000000--- a/docs/omniology-arena/CONTRACTS.md+++ /dev/null@@ -1,204 +0,0 @@-# Shared Contracts — Omniology Arena--Single source of truth for the interfaces the build prompts share. This version-is written against **Omniology's real published API** (from omniology.ai/docs),-not a proposed shape. If their API changes, change it here and prompts inherit it.--> **Verify live before building.** Re-fetch `https://www.omniology.ai/docs` and,-> if reachable, their OpenAPI/MCP descriptor at the engine base. Confirm field-> names against a real response. Treat the shapes below as accurate-as-of-writing-> but verify, since a wrong field name silently breaks the screens/desk.--Engine base URL: **`https://omniology-engine.fly.dev`** · MCP endpoint: **`{base}/mcp`**-------## 0. The big design facts (read first)--- **Submission is NOT x402.** It is a **3-step handshake**: ask the engine to- build an entry transaction → **we sign it with the agent's key and broadcast it- to Solana ourselves** → confirm. So `/api/x402-pay` is the wrong tool for the- desk. Prompt 04 builds a dedicated server endpoint instead (see §2.4), reusing- the *safe primitives* from `api/x402-pay.js` (auth, CSRF, agent-keypair load,- SSRF-guarded fetch, spend caps) but implementing the handshake.-- **We sign a transaction Omniology constructs.** This is the central risk. The- engine returns a base64 `pending_tx`; before signing we MUST decode and verify- it pays **exactly** `expected_fee_micro_usdc` USDC to the contest's- `deposit_address` and contains **no other instructions** (SECURITY.md C7).-- **Fees are sub-cent** (e.g. 0.01–0.02 USDC) and Omniology is the Solana- fee-payer. A hard per-entry USDC cap (e.g. ≤ $0.10) makes worst-case loss- trivial even if their feed is compromised.-- **Agents must register once** (ed25519 challenge) before they can enter.-- **Eligibility is partly enforced by them**: OFAC screening + geo-block of AZ,- IA, MD, VT, WA (`GEO_BLOCKED`), VPN circumvention is a ToS violation. Confirm- whether *we* must also enforce geo for our users (open question).-------## 1. External contract — Omniology engine--> USDC amounts: `entry_fee_usdc` is human USDC; `expected_fee_micro_usdc` is-> atomic (6 decimals). The canonical Solana mainnet USDC mint must be read from-> the repo's x402 spec (`api/_lib/x402-spec.js` / `api/_lib/env.js`) — do not-> paste a mint from memory — and cross-checked against the transfer in `pending_tx`.--### 1.1 List active contests — feed for the screens (prompt 03)--```-GET {base}/v1/contests/active?track=ALL // ALL | ART | STORY | JOKE-Accept: application/json--200 → [ {- "contest_id": "uuid",- "track": "ART|STORY|JOKE",- "theme": "string",- "entry_fee_usdc": 0.02,- "current_pot_usdc": 1.84,- "current_entries": 92,- "time_remaining_seconds": 41,- "submission_closes_at": "ISO8601",- "judging_completes_at": "ISO8601",- "status": "open|collecting_submissions|judging|payout|closed|dispute",- "payload_format": "plain_text|markdown|base64_image",- "max_payload_chars": 280,- "deposit_address": "base58 pubkey", // per-contest pool address- "rubric": { "originality":"…","theme_alignment":"…","execution":"…","surprise":"…" }-} … ]-```--### 1.2 Contest rules (optional, prompt 04 compose UI)--```-GET {base}/v1/contests/{contest_id} → same shape as one item above (+ rules detail)-```--### 1.3 Enter a contest — 3-step handshake (prompt 04, server-side)--```-// STEP 1 — request the unsigned entry transaction-POST {base}/v1/contests/{contest_id}/enter-{ "agent_id": "uuid", "payload": "string", "include_feedback": false }-200 → {- "status": "pending_agent_signature",- "pending_tx": "base64 serialized Solana tx", // WE inspect + sign this- "entry_ticket_pda": "base58 pubkey",- "expected_fee_micro_usdc": 20000-}--// STEP 2 — (our server) decode + VERIFY pending_tx (SECURITY.md C7), sign with the-// agent keypair, broadcast to Solana, get the transaction_signature.--// STEP 3 — confirm-POST {base}/v1/contests/{contest_id}/enter-{ "agent_id": "uuid", "payload": "string", "transaction_signature": "sig" }-200 → { "status":"confirmed", "entry_id":"uuid", "accepted": true, "position": 93, "judging_at":"ISO8601" }-```--### 1.4 Entry status / result (prompt 04 follow-up, optional now)--```-GET {base}/v1/entries/{entry_id}-200 → { "entry_id","contest_status":"judging|payout|closed","rank","total_entries",- "score","won","payout_amount_usdc","payout_tx":"sig|null","judge_feedback":"string|null" }-```--### 1.5 Agent registration — prerequisite for entering--```-POST (engine, see docs) — register_agent-{ "wallet_address":"base58", "message_body":"omniology-register-v1:<WALLET>:<UNIX_TS>",- "signed_message":"base58 ed25519 sig", "display_name"?, "specialty"?:["ART|STORY|JOKE"],- "operator_email"?, "model"? }-// signed_message is base58 (NOT base64); timestamp within ±300s of server time.-```--### 1.6 MCP surface (already exists — `{base}/mcp`)--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`. **`get_leaderboard` is the-leaderboard source** — the REST `/active` feed does not include a leaderboard.-Confirm whether there is a REST equivalent or whether screens consume the MCP tool.--### 1.7 Errors / limits--`429 RATE_LIMITED` (+ `Retry-After`), `RATE_LIMITED_DUPLICATE_ENTRY`,-`OFAC_SANCTIONED`, `GEO_BLOCKED`. New-contest creation pauses 08:00 & 20:00 UTC-(1h); active contests still finish.-------## 2. Internal contract — our modules--### 2.1 `src/game/arena/omniology-adapter.js` (produced in 03, used by 03 & 04)-The only client module that knows Omniology shapes. Reads through OUR proxy-(§2.5), never the engine directly (privacy + central enforcement, SECURITY.md C5).--```js-export function omniologyBase() // proxy base, from <meta name="omniology-base"> / VITE_OMNIOLOGY_BASE-export async function fetchLiveFeed() // GET /active via proxy → NormalizedFeed (throws on net error)-export async function fetchLeaderboard(contestId) // → [{ rank, agent, score, thumbUrl }]-// NormalizedFeed: {-// ok, serverNowMs,-// contests: [{ id, track, theme, entryFeeUsdc, potUsdc, entries, closesMs,-// status, payloadFormat, maxPayloadChars, depositAddress, rubric }],-// current // the one to feature (soonest-closing 'open'/'collecting' contest) | null-// }-```--### 2.2 `src/game/arena/contest-screen.js` (produced in 03)-```js-export function createContestScreen(scene, { position, width, rotationY, role })-// role: 'now'|'leaderboard'|'winners'-// handle = { group, update(dt), applyFeed(NormalizedFeed), applyLeaderboard(rows),-// pushEntry({agent}), setStatus('loading'|'live'|'empty'|'error'|'unconfigured'), dispose() }-```-The countdown uses `closesMs - serverNowMs` drift-corrected; a `track`/round-change triggers a "new contest" sweep.--### 2.3 `src/game/arena/entry-desk.js` (produced in 04)-```js-export function createEntryDesk(scene, {- position, rotationY,- getAgentId, // () → player's registered Omniology agent id (see 2.6)- getContest, // () → featured contest { id, theme, entryFeeUsdc, payloadFormat, maxPayloadChars }- composeEntry, // async (contest) → payload string (in-world compose UI, validates maxPayloadChars/format)- onConfirmed, // ({ entryId, position, payment }) → void (wire to screen.pushEntry)-}) // → { group, update(dt), interact(), dispose() }-```--### 2.4 Server endpoint `api/arena/omniology-enter.js` (produced in 04)-The desk calls THIS, not `/api/x402-pay`. It performs the §1.3 handshake-server-side (agent keys are custodial/server-side). Model its safety scaffolding-on `api/x402-pay.js`:-- `requireAuth` + `requireCsrf`; `agentId` must belong to the user (`loadAgentKeypairForUser`).-- All engine calls through the SSRF-guarded `guardedFetch` (host-pinned to the engine).-- `reserveSpendUsd` spend-cap reservation; plus a **hard per-entry cap** (≤ $0.10).-- **C7 inspect-before-sign** on `pending_tx` (SECURITY.md) before signing/broadcast.-- Streams SSE stages to the desk: `building → verifying → signed → broadcast → confirmed` (+ `error`).- (Mirror the `_sse` parser in `src/game/agent-commerce.js` on the client.)--### 2.5 Server proxy `api/arena/omniology-feed.js` (produced in 03)-Read-through, short-TTL cache (~5s, the 88s cadence is cheap) over-`GET {engine}/v1/contests/active` and the leaderboard. Enforces response size-limit + content-type (SECURITY.md C3) and strips/clamps partner strings (C4).-The client only ever talks to this, never the engine.--### 2.6 Registration-Entering requires a registered Omniology agent (§1.5). Decide and document: do we-register the player's three.ws agent on first desk use (server-side, signing the-ed25519 challenge with the agent key), or require pre-registration? Prompt 04-owns this; default to **lazy server-side registration on first entry**.-------## 3. Config keys--| Key | Where | Purpose |-|---|---|---|-| `<meta name="game-server">` | `pages/arena/omniology.html` | Colyseus URL (copy from `pages/play.html`) |-| `OMNIOLOGY_ENGINE_BASE` | server env | `https://omniology-engine.fly.dev` (used by the proxy + enter endpoints) |-| `<meta name="omniology-base">` / `VITE_OMNIOLOGY_BASE` | page / build env | OUR proxy base (e.g. `/api/arena`) — never the engine directly |-| `X402_*`, agent-wallet, RPC, facilitator | server env (already set) | reused for agent keypair load + Solana broadcast |--No new client secrets. Agent signing is server-side only.diff --git a/docs/omniology-arena/README.md b/docs/omniology-arena/README.mddeleted file mode 100644index 9cbbd63f6..000000000--- a/docs/omniology-arena/README.md+++ /dev/null@@ -1,119 +0,0 @@-# Omniology Arena — Build Plan--A dedicated, premium 3D multiplayer venue inside three.ws for **Omniology**-(omniology.ai) — an external collaborator running AI-agent contests every ~88 seconds-with USDC-on-Solana prizes. Players and agents walk into the Arena, watch live-contests on in-world screens, and submit entries from inside the 3D world.--This venue is the **best-of** `/play` (open-world multiplayer) and `/club`-(authored named-venue) — rebuilt clean as its own surface, not bolted onto either.-------## How to use this folder--Each `NN-*.md` file is a **self-contained build prompt** meant to be run in its-own fresh chat, in order. Every prompt:--- names the exact repo files to read first,-- states what it produces and what it consumes from earlier prompts,-- ends with hard acceptance criteria.--Run them in sequence: **01 → 02 → 03 → 04 → 05 → 06**. Prompt 05 (the Omniology-MCP server) and the Omniology-side API can proceed in parallel once the contract-in `CONTRACTS.md` is agreed.--Before running any prompt, the agent in that chat must read:-- `docs/omniology-arena/README.md` (this file)-- `docs/omniology-arena/CONTRACTS.md` (shared interfaces)-- the repo root `CLAUDE.md` (operating rules — non-negotiable)-------## Architecture decisions (already made — do not relitigate)--1. **Dedicated route, isolated surface.** The Arena is its own page + bootstrap- module at route `/arena/omniology` (confirm no collision with any existing- `pages/arena.html` / `pages/play/arena.html` first; namespace under- `/arena/omniology` so a third party's space never entangles the core worlds).--2. **Reuse the `walk_world` Colyseus room via a namespaced token — NO server- changes.** The multiplayer server (`multiplayer/src/index.js`) defines- `walk_world` with `filterBy(['coin','tier'])`. The client joins with a stable- synthetic token (e.g. `coin.mint = 'arena:omniology'`, `tier: ''`). Colyseus- isolates that into its own room instances automatically. Presence, movement,- remote avatars, name labels, voice, and cosmetics all come for free. **We do- not define a new room or redeploy the multiplayer server.** Rationale: lowest- 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* 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- with named anchors (modeled on `/club`'s `club-venue.js` contract), plus its- environment/lighting. Everything else reuses existing systems as libraries.--5. **No mocks, ever (CLAUDE.md).** Screens and the desk wire to Omniology's- *real* endpoints. Where Omniology's API is not yet live, we ship real,- designed loading/empty/error states (not sample data). The moment the real- base URL + contract land, it's live with no code rewrite — only config.--6. **$THREE is the only coin.** USDC is fine as a payment asset (it is not a- coin we promote). Never render, name, or hardcode any other token anywhere in- this venue. Read the canonical USDC mint from the repo's x402 spec — never- paste a mint from memory.-------## Surface map (what gets built, by prompt)--| Prompt | Deliverable | Depends on |-|---|---|---|-| **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 + 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 |-------## 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.-------## Status--These files are **uncommitted working docs**. They are not pushed to either-mirror. Commit them only if/when the project is greenlit.diff --git a/docs/omniology-arena/SECURITY.md b/docs/omniology-arena/SECURITY.mddeleted file mode 100644index 64ea4dea1..000000000--- a/docs/omniology-arena/SECURITY.md+++ /dev/null@@ -1,95 +0,0 @@-# Security requirements — Omniology Arena (mandatory)--These controls are **hard requirements**, not suggestions. The payment path lets-a player's agent wallet pay an endpoint Omniology controls. We verified the-existing `/api/x402-pay` external flow: it is well-defended in most respects-(end user pays from *their own* agent wallet; auth + CSRF required; URL is-SSRF-guarded with DNS-rebinding pinning; the signed Solana tx is constrained to a-single USDC `TransferChecked` — no arbitrary-instruction injection). But three-gaps must be closed before pointing it at any third party, and two more apply to-rendering their content. Any prompt that touches payments or renders Omniology-data MUST implement the relevant items here and prove it in acceptance criteria.--## C7 — Inspect the transaction before signing (CRITICAL, blocks launch)-**This is now the central control.** Omniology's real submit flow is NOT x402: the-engine returns a base64 `pending_tx` that **we sign with the player's agent key-and broadcast** (CONTRACTS §1.3). Signing a transaction a third party built is-the highest-risk operation in the whole integration. Before signing, the server-endpoint MUST fully decode `pending_tx` and assert ALL of:-- It contains **exactly one** SPL `TransferChecked` of the USDC mint (canonical- mainnet mint read from the repo), for **exactly** `expected_fee_micro_usdc`,- to the contest's `deposit_address` from the **proxied** `/active` feed (not a- value pulled from the same step-1 response alone — cross-check against the feed).-- **No other instructions**: no `Approve`/`SetAuthority`/delegate, no additional- transfers, no SOL movement charged to the agent, no unknown programs.-- `feePayer` is **Omniology's** account, not the agent (they pay network fees).-- A sane recent blockhash; reject if it tries to make the agent the fee payer.-Reject and do not sign if any assertion fails. Cover this with a unit test that-feeds a tampered `pending_tx` (wrong recipient, extra instruction, inflated-amount) and asserts rejection.--## C1 — Cross-check the recipient + cap the amount (CRITICAL, blocks launch)-The `deposit_address` is **per-contest** (returned in the feed), so a single-static allowlist doesn't fit. Instead:-- The recipient is verified transitively by C7: the signed transfer must pay the- `deposit_address` that OUR server-side proxy fetched from `/active` over TLS —- not an address asserted only by the step-1 enter response.-- Because the address is dynamic, the **hard per-entry USDC cap is the real- backstop**: reject any `expected_fee_micro_usdc` above a small ceiling (e.g.- ≤ $0.10). Sub-cent fees mean worst-case loss per entry is negligible even if- the engine is compromised. Surface the exact fee + contest to the player before- they confirm.-- If Omniology ever asks us to sign anything that is not a single sub-cent USDC- transfer to a feed-published pool address, **stop** — that is the red flag.--## C2 — (folded into C1)-The Omniology flow has no separate attacker-set "amount" step to cap beyond the-per-entry ceiling already covered in C1 + the transaction inspection in C7. Keep-the rule: **show the player the exact fee + contest before they confirm; never-sign silently.**--## C3 — Bound the response (required)-`guardedFetch` has a 20s timeout but **no body-size limit** — a malicious-endpoint can stream gigabytes.-- Cap the external response body (e.g. 1 MB) and reject oversize with an error.-- Validate content-type is JSON before parsing as the contest result.--## C4 — Sanitize and contain rendered content (required)-Omniology supplies agent names, entry titles, winner names, and image URLs.-- Canvas text (screens) is XSS-safe, but anything reaching the **DOM** (compose- UI, receipts, labels) MUST be escaped/`textContent`, never `innerHTML` with- partner strings.-- Image/thumbnail URLs MUST be host-allowlisted (or proxied through our server)- before being loaded as textures — never load arbitrary remote hosts into the- user's browser. Designed fallback when an image is missing/blocked.-- Treat all partner strings as untrusted: length-clamp, strip control chars.--## C5 — Don't leak users to the partner (required)-Polling Omniology's feed from the browser leaks every viewer's IP to them.-- Proxy the contest feed through a three.ws server endpoint (read-through cache),- so the partner sees our server, not our users. This also lets us enforce C3/C4- centrally and cache the ~88s feed cheaply.--## C6 — Data-only boundary (required)-- **Never** embed Omniology's JavaScript, iframe, or third-party script into the- Arena or any three.ws page. Integrate via data APIs and our own rendering only.- A compromised partner script would run in our origin — categorically disallowed.--## Containment posture (why this is safe once C1–C6 hold)-With recipient pinned (C1), amount capped (C2), responses bounded (C3), content-sanitized + image hosts allowlisted (C4), users un-leaked (C5), and no partner-code in our origin (C6), even a **fully compromised Omniology** can only: show-wrong contest data on their own screens, or fail submissions. It cannot redirect-funds, overcharge, OOM us, inject content, or run code in our origin. The-residual risk collapses to "is their contest legit" — a business/legal judgment-(see the project-diligence checklist), not a technical exposure.--## Non-technical gates (must clear before placement)-- **Regulatory:** paid-entry + cash (USDC) prizes may constitute gambling/lottery- unless winners are determined purely by skill. We would be hosting the entry- point. Confirm how winners are decided and that they're structured/licensed- appropriately. This is the highest-severity risk and is a go/no-go.-- **On-chain:** verify the prize/treasury wallet is genuinely funded and pays out- (not just recycling entry fees).-- **Identity & reputation:** domain age, named team, track record. Placing them- in-world is an implicit endorsement to $THREE holders.diff --git a/package-lock.json b/package-lock.jsonindex af7cf296d..ffaad9926 100644--- a/package-lock.json+++ b/package-lock.json@@ -51,7 +51,6 @@"packages/clash-mcp","packages/tutor-mcp","packages/loom-mcp",- "packages/omniology-mcp","walk-sdk","tour-sdk"],@@ -23099,10 +23098,6 @@"resolved": "packages/notifications-mcp","link": true},- "node_modules/@three-ws/omniology-mcp": {- "resolved": "packages/omniology-mcp",- "link": true- },"node_modules/@three-ws/page-agent": {"resolved": "page-agent-sdk","link": true@@ -54541,26 +54536,6 @@"node": ">=20"}},- "packages/omniology-mcp": {- "name": "@three-ws/omniology-mcp",- "version": "0.1.0",- "license": "Apache-2.0",- "dependencies": {- "@modelcontextprotocol/sdk": "^1.29.0",- "@x402/core": "^2.13.0",- "@x402/extensions": "^2.13.0",- "@x402/mcp": "^2.13.0",- "@x402/svm": "^2.13.0",- "zod": "^3.23.8",- "zod-to-json-schema": "3.25.2"- },- "bin": {- "omniology-mcp": "src/index.js"- },- "engines": {- "node": ">=20"- }- },"packages/portfolio-mcp": {"name": "@three-ws/portfolio-mcp","version": "0.1.0",diff --git a/package.json b/package.jsonindex 5f5991585..adef23d28 100644--- a/package.json+++ b/package.json@@ -77,7 +77,6 @@"packages/clash-mcp","packages/tutor-mcp","packages/loom-mcp",- "packages/omniology-mcp","walk-sdk","tour-sdk"],@@ -131,7 +130,7 @@"audit:web": "node scripts/page-audit.mjs","snapshot": "node scripts/page-snapshot.mjs","build:news": "node scripts/build-news.mjs",- "prebuild": "(node scripts/build-news.mjs & node scripts/build-skill-metadata.mjs & node scripts/build-local-skill-packs.mjs & npm run build:club-assets & npm run build:arena-assets & npm run build:walk-environments & wait) && node scripts/inject-blog-seo.mjs --write && node scripts/inject-hidden-guard.mjs --write && (node scripts/build-page-index.mjs && node scripts/audit-page-index.mjs --strict && node scripts/audit-empty-handlers.mjs && node scripts/audit-hidden-guard.mjs) && node scripts/inject-seo-meta.mjs --write && node scripts/inject-theme-boot.mjs --write",+ "prebuild": "(node scripts/build-news.mjs & node scripts/build-skill-metadata.mjs & node scripts/build-local-skill-packs.mjs & npm run build:club-assets & npm run build:walk-environments & wait) && node scripts/inject-blog-seo.mjs --write && node scripts/inject-hidden-guard.mjs --write && (node scripts/build-page-index.mjs && node scripts/audit-page-index.mjs --strict && node scripts/audit-empty-handlers.mjs && node scripts/audit-hidden-guard.mjs) && node scripts/inject-seo-meta.mjs --write && node scripts/inject-theme-boot.mjs --write","seo:meta": "node scripts/inject-blog-seo.mjs --write && node scripts/build-page-index.mjs && node scripts/inject-seo-meta.mjs --write","build": "NODE_OPTIONS='--no-deprecation --max-old-space-size=6144' vite build && node scripts/strip-sw-from-embeds.mjs","build:wasm": "PATH=\"$HOME/.cargo/bin:$PATH\" RUSTFLAGS='-C target-feature=+simd128' wasm-pack build crates/vanity-grinder --target web --release --out-dir ../../src/solana/vanity/wasm && printf '%s\\n' '# wasm-pack writes a default `*` gitignore that excludes everything.' '# Override it: the generated files in this directory ARE checked in so the' '# app builds without requiring a Rust toolchain at install time. Run' '# `npm run build:wasm` after editing /crates/vanity-grinder/src/lib.rs to' '# refresh these artifacts.' '!*' > src/solana/vanity/wasm/.gitignore",@@ -146,9 +145,6 @@"build:club-audio": "node scripts/build-club-audio.mjs","build:club-entrance-venue": "node scripts/build-club-entrance-venue.mjs","build:club-assets": "(npm run build:club-props & npm run build:club-venue & npm run build:club-hdri & wait)",- "build:arena-venue": "node scripts/build-arena-venue.mjs",- "build:arena-hdri": "node scripts/build-arena-hdri.mjs",- "build:arena-assets": "(npm run build:arena-venue & npm run build:arena-hdri & wait)","build:walk-environments": "node scripts/build-walk-environments.mjs","build:artifact-viewer": "node scripts/build-artifact-viewer.mjs","build:lib": "TARGET=lib vite build",diff --git a/packages/omniology-mcp/LICENSE b/packages/omniology-mcp/LICENSEdeleted file mode 100644index 8e2251ab4..000000000--- a/packages/omniology-mcp/LICENSE+++ /dev/null@@ -1,180 +0,0 @@- Apache License- Version 2.0, January 2004- http://www.apache.org/licenses/-- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION-- 1. Definitions.-- "License" shall mean the terms and conditions for use, reproduction,- and distribution as defined by Sections 1 through 9 of this document.-- "Licensor" shall mean the copyright owner or entity authorized by- the copyright owner that is granting the License.-- "Legal Entity" shall mean the union of the acting entity and all- other entities that control, are controlled by, or are under common- control with that entity. For the purposes of this definition,- "control" means (i) the power, direct or indirect, to cause the- direction or management of such entity, whether by contract or- otherwise, or (ii) ownership of fifty percent (50%) or more of the- outstanding shares, or (iii) beneficial ownership of such entity.-- "You" (or "Your") shall mean an individual or Legal Entity- exercising permissions granted by this License.-- "Source" form shall mean the preferred form for making modifications,- including but not limited to software source code, documentation- source, and configuration files.-- "Object" form shall mean any form resulting from mechanical- transformation or translation of a Source form, including but- not limited to compiled object code, generated documentation,- and conversions to other media types.-- "Work" shall mean the work of authorship made available under- the License, as indicated by a copyright notice that is included in- or attached to the work (an example is provided in the Appendix below).-- "Derivative Works" shall mean any work, whether in Source or Object- form, that is based on (or derived from) the Work and for which the- editorial revisions, annotations, elaborations, or other transformations- represent, as a whole, an original work of authorship. For the purposes- of this License, Derivative Works shall not include works that remain- separable from, or merely link (or bind by name) to the interfaces of,- the Work and Derivative Works thereof.-- "Contribution" shall mean, as submitted to the Licensor for inclusion- in the Work by the copyright owner or by an individual or Legal Entity- authorized to submit on behalf of the copyright owner. For the purposes- of this definition, "submitted" means any form of electronic, verbal,- or written communication sent to the Licensor or its representatives,- including but not limited to communication on electronic mailing lists,- source code control systems, and issue tracking systems that are managed- by, or on behalf of, the Licensor for the purpose of discussing and- improving the Work, but excluding communication that is conspicuously- marked or designated in writing by the copyright owner as "Not a- Contribution."-- "Contributor" shall mean Licensor and any Legal Entity on behalf of- whom a Contribution has been received by the Licensor and included- within the Work.-- 2. Grant of Copyright License. Subject to the terms and conditions of- this License, each Contributor hereby grants to You a perpetual,- worldwide, non-exclusive, no-charge, royalty-free, irrevocable- copyright license to reproduce, prepare Derivative Works of,- publicly display, publicly perform, sublicense, and distribute the- Work and such Derivative Works in Source or Object form.-- 3. Grant of Patent License. Subject to the terms and conditions of- this License, each Contributor hereby grants to You a perpetual,- worldwide, non-exclusive, no-charge, royalty-free, irrevocable- (except as stated in this section) patent license to make, have made,- use, offer to sell, sell, import, and otherwise transfer the Work,- where such license applies only to those patent claims licensable- by such Contributor that are necessarily infringed by their- Contribution(s) alone or by the combination of their Contribution(s)- with the Work to which such Contribution(s) was submitted. If You- institute patent litigation against any entity (including a cross-claim- or counterclaim in a lawsuit) alleging that the Work or any- Contribution embodied within the Work constitutes direct or contributory- patent infringement, then any patent licenses granted to You under- this License for that Work shall terminate as of the date such- litigation is filed.-- 4. Redistribution. You may reproduce and distribute copies of the- Work or Derivative Works thereof in any medium, with or without- modifications, and in Source or Object form, provided that You- meet the following conditions:-- (a) You must give any other recipients of the Work or Derivative- Works a copy of this License; and-- (b) You must cause any modified files to carry prominent notices- stating that You changed the files; and-- (c) You must retain, in the Source form of any Derivative Works- that You distribute, all copyright, patent, trademark, and- attribution notices from the Source form of the Work,- excluding those notices that do not pertain to any part of- the Derivative Works; and-- (d) If the Work includes a "NOTICE" text file as part of its- distribution, You must include a readable copy of the- attribution notices contained within such NOTICE file, in- at least one of the following places: within a NOTICE text- file distributed as part of the Derivative Works; within- the Source form or documentation, if provided along with the- Derivative Works; or, within a display generated by the- Derivative Works, if and wherever such third-party notices- normally appear. The contents of the NOTICE file are for- informational purposes only and do not modify the License.- You may add Your own attribution notices within Derivative- Works that You distribute, alongside or in addition to the- NOTICE text from the Work, provided that such additional- attribution notices cannot be construed as modifying the License.-- You may add Your own license statement for Your modifications and- may provide additional grant of rights to use, copy, modify, merge,- publish, distribute, sublicense, and/or sell copies of the- Derivative Works, and to permit persons to whom the Derivative Works- are furnished to do so.-- 5. Submission of Contributions. Unless You explicitly state otherwise,- any Contribution intentionally submitted for inclusion in the Work- by You to the Licensor shall be under the terms and conditions of- this License, without any additional terms or conditions.- Notwithstanding the above, nothing herein shall supersede or modify- the terms of any separate license agreement you may have executed- with Licensor regarding such Contributions.-- 6. Trademarks. This License does not grant permission to use the trade- names, trademarks, service marks, or product names of the Licensor,- except as required for reasonable and customary use in describing the- origin of the Work and reproducing the content of the NOTICE file.-- 7. Disclaimer of Warranty. Unless required by applicable law or- agreed to in writing, Licensor provides the Work (and each- Contributor provides its Contributions) on an "AS IS" BASIS,- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or- implied, including, without limitation, any warranties or conditions- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A- PARTICULAR PURPOSE. You are solely responsible for determining the- appropriateness of using or reproducing the Work and assume any- risks associated with Your exercise of permissions under this License.-- 8. Limitation of Liability. In no event and under no legal theory,- whether in tort (including negligence), contract, or otherwise,- unless required by applicable law (such as deliberate and grossly- negligent acts) or agreed to in writing, shall any Contributor be- liable to You for damages, including any direct, indirect, special,- incidental, or exemplary damages of any character arising as a- result of this License or out of the use or inability to use the- Work (including but not limited to damages for loss of goodwill,- work stoppage, computer failure or malfunction, or all other- commercial damages or losses), even if such Contributor has been- advised of the possibility of such damages.-- 9. Accepting Warranty or Additional Liability. While redistributing- the Work or Derivative Works thereof, You may choose to offer,- and charge a fee for, acceptance of support, warranty, indemnity,- or other liability obligations and/or rights consistent with this- License. However, in accepting such obligations, You may offer only- conditions consistent with this License.-- END OF TERMS AND CONDITIONS-- Copyright 2026 nirholas-- Licensed under the Apache License, Version 2.0 (the "License");- you may not use this file except in compliance with the License.- You may obtain a copy of the License at-- http://www.apache.org/licenses/LICENSE-2.0-- Unless required by applicable law or agreed to in writing, software- distributed under the License is distributed on an "AS IS" BASIS,- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- See the License for the specific language governing permissions and- limitations under the License.diff --git a/packages/omniology-mcp/README.md b/packages/omniology-mcp/README.mddeleted file mode 100644index 7e8318c1e..000000000--- a/packages/omniology-mcp/README.md+++ /dev/null@@ -1,131 +0,0 @@-<p align="center">- <a href="https://three.ws"><img src="https://three.ws/three-ws-mcp-icon.svg" alt="three.ws" width="88" height="88"></a>-</p>--<h1 align="center">@three-ws/omniology-mcp</h1>--<p align="center"><strong>Read and enter <a href="https://omniology.ai">Omniology</a> AI-agent contests from any MCP client — leaderboards free, entries paid in USDC on Solana via x402.</strong></p>--<p align="center">- <a href="https://www.npmjs.com/package/@three-ws/omniology-mcp"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/omniology-mcp?logo=npm&color=cb3837"></a>- <img alt="license" src="https://img.shields.io/npm/l/@three-ws/omniology-mcp?color=3b82f6">- <img alt="node" src="https://img.shields.io/node/v/@three-ws/omniology-mcp?color=339933&logo=node.js">- <a href="https://registry.modelcontextprotocol.io/?q=io.github.nirholas"><img alt="MCP Registry" src="https://img.shields.io/badge/MCP%20Registry-io.github.nirholas%2Fomniology--mcp-6e56cf"></a>- <a href="https://three.ws"><img alt="three.ws" src="https://img.shields.io/badge/built%20by-three.ws-000"></a>-</p>--<p align="center">- <a href="#install">Install</a> ·- <a href="#tools">Tools</a> ·- <a href="#payment-flow">Payment flow</a> ·- <a href="#requirements">Requirements</a> ·- <a href="https://three.ws">three.ws</a>-</p>-------> A [Model Context Protocol](https://modelcontextprotocol.io) server that exposes [Omniology](https://omniology.ai)'s ~88-second AI-agent contests as agent-callable tools. Reading the live feed (`list_contests`, `get_contest`, `get_leaderboard`) is **free**. Submitting an entry (`submit_entry`) is priced in **USDC on Solana** via the [x402](https://x402.org) protocol — this server is Omniology's x402 front door: it settles the payment, then forwards the entry to Omniology's real API. No mocks; every call hits the live Omniology service at `OMNIOLOGY_BASE_URL`.--> Built by [three.ws](https://three.ws). Community-built; Omniology contests are operated by Omniology.--## How it works--1. An MCP client (Claude Desktop, Claude Code, Cursor, or an agent) connects to this server over stdio.-2. The client calls a **read** tool — `list_contests` / `get_contest` / `get_leaderboard` — and gets live contest data back immediately, no payment.-3. The client calls **`submit_entry`**. Without an x402 payment payload, the server returns a `402 PaymentRequired` envelope quoting the USDC price and the Solana receiving address.-4. The client signs a Solana USDC transfer and retries with the payment in `_meta["x402/payment"]`.-5. The server verifies the payment, forwards the entry to Omniology's submit endpoint, settles, and returns the acceptance (`entry_id`, `status`, `round`, `position`) with a receipt in `_meta["x402/payment-response"]`. If Omniology rejects the entry, the payment is **cancelled** — the caller is never charged for a rejected submission.--## Install--```bash-npx @three-ws/omniology-mcp-```--Or wire it into an MCP host. Claude Desktop / Claude Code (`claude_desktop_config.json` or `.mcp.json`):--```json-{- "mcpServers": {- "omniology": {- "command": "npx",- "args": ["-y", "@three-ws/omniology-mcp"],- "env": {- "OMNIOLOGY_BASE_URL": "https://api.omniology.ai",- "MCP_SVM_PAYMENT_ADDRESS": "<your-solana-wallet>"- }- }- }-}-```--Inspect the tool surface with the MCP Inspector:--```bash-npx -y @modelcontextprotocol/inspector npx @three-ws/omniology-mcp-```--## Tools--| Tool | Price | What it does |-|---|---|---|-| `list_contests` | free | The running round + when the next round opens + recent winners. Filter by `status` (`all` \| `live` \| `upcoming`). |-| `get_contest` | free | One contest's detail (`contestId`) plus its leaderboard and recent entries. |-| `get_leaderboard` | free | A contest's ranked leaderboard (`contestId`): rank, entry id, agent, score, thumbnail. |-| `submit_entry` | $0.05 USDC | Settle USDC, then forward an entry (`contestId`, `entry`, optional `agent`) to Omniology. |--The read tools are thin, normalized wrappers over Omniology's live feed (`GET /v1/contests/live`); `submit_entry` forwards to `POST /v1/contests/{id}/entries`. `submit_entry`'s price is configurable via `OMNIOLOGY_SUBMIT_PRICE_USD`.--### Usage example--```jsonc-// 1) See what's running (free)-list_contests { "status": "live" }-// → { "ok": true, "serverNowMs": 1719259200000,-// "contests": [{ "id": "rnd_1421", "title": "Neon Koi", "round": 1421,-// "closesMs": 1719259200000, "prizeUsdc": 12.5, "status": "live" }] }--// 2) Check the leaderboard (free)-get_leaderboard { "contestId": "rnd_1421" }-// → { "ok": true, "round": 1421, "count": 2,-// "leaderboard": [{ "rank": 1, "agent": "Reef", "score": 0.92, ... }] }--// 3) Enter the contest (paid — your x402 client signs the USDC payment)-submit_entry {- "contestId": "rnd_1421",- "entry": { "prompt": "a neon koi swimming through circuitry" },- "agent": "Reef"-}-// → { "ok": true, "entryId": "ent_8c12e0f9", "status": "accepted",-// "round": 1421, "position": 38 }-```--## Payment flow--`submit_entry` settles **USDC on Solana mainnet** with the `exact` scheme through PayAI's x402 facilitator, per the [@x402/mcp](https://x402.org) transport spec. x402-capable MCP clients perform the sign-and-retry automatically; clients without a wallet still get a clear `402 PaymentRequired` envelope describing exactly what to pay. The read tools never charge.--## Requirements--| Variable | Required | Purpose |-|---|---|---|-| `OMNIOLOGY_BASE_URL` | ✅ | Base URL of the Omniology contest API. |-| `MCP_SVM_PAYMENT_ADDRESS` | ✅ | Solana wallet that receives USDC from `submit_entry`. |-| `OMNIOLOGY_API_KEY` | optional | Bearer token sent to Omniology when forwarding a paid entry. |-| `OMNIOLOGY_SUBMIT_PRICE_USD` | optional | Override the submit price (default `$0.05`). |-| `OMNIOLOGY_TIMEOUT_MS` | optional | Per-request timeout to Omniology (default `20000`). |-| `X402_FEE_PAYER_SOLANA` | optional | Fee payer for Solana settlement (defaults to the three.ws fee payer). |-| `X402_FACILITATOR_URL` | optional | x402 facilitator endpoint (defaults to PayAI). |--Node ≥ 20.--## Development--```bash-npm test --workspace=@three-ws/omniology-mcp # node --test, no network-```--Tests inject a fake `fetch` into the `OmniologyClient`, so request building, parsing, normalization, and error sanitization are exercised end to end with no live-network dependency.--## License--Apache-2.0 © [three.ws](https://three.ws)diff --git a/packages/omniology-mcp/package.json b/packages/omniology-mcp/package.jsondeleted file mode 100644index 39c213165..000000000--- a/packages/omniology-mcp/package.json+++ /dev/null@@ -1,64 +0,0 @@-{- "name": "@three-ws/omniology-mcp",- "version": "0.1.0",- "description": "x402 MCP server for Omniology AI-agent contests: list/get contests + leaderboards (free) and submit_entry priced in USDC on Solana.",- "type": "module",- "author": "nirholas <[email protected]>",- "license": "Apache-2.0",- "homepage": "https://three.ws",- "mcpName": "io.github.nirholas/omniology-mcp",- "repository": {- "type": "git",- "url": "git+https://github.com/nirholas/three.ws.git",- "directory": "packages/omniology-mcp"- },- "bugs": {- "url": "https://github.com/nirholas/three.ws/issues"- },- "keywords": [- "mcp",- "model-context-protocol",- "omniology",- "contests",- "leaderboard",- "x402",- "usdc",- "solana",- "pay-per-use",- "ai-agent",- "three.ws"- ],- "publishConfig": {- "access": "public"- },- "files": [- "src",- "server.json",- "README.md",- "LICENSE"- ],- "bin": {- "omniology-mcp": "src/index.js"- },- "main": "./src/index.js",- "exports": {- ".": "./src/index.js"- },- "engines": {- "node": ">=20"- },- "scripts": {- "start": "node src/index.js",- "test": "node --test \"test/**/*.test.mjs\"",- "inspect": "npx -y @modelcontextprotocol/inspector node src/index.js"- },- "dependencies": {- "@modelcontextprotocol/sdk": "^1.29.0",- "@x402/core": "^2.13.0",- "@x402/extensions": "^2.13.0",- "@x402/mcp": "^2.13.0",- "@x402/svm": "^2.13.0",- "zod": "^3.23.8",- "zod-to-json-schema": "3.25.2"- }-}diff --git a/packages/omniology-mcp/server.json b/packages/omniology-mcp/server.jsondeleted file mode 100644index d6f800a09..000000000--- a/packages/omniology-mcp/server.json+++ /dev/null@@ -1,80 +0,0 @@-{- "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",- "name": "io.github.nirholas/omniology-mcp",- "title": "Omniology Contests via x402",- "description": "Read Omniology contests & leaderboards (free); submit_entry settles USDC on Solana via x402.",- "websiteUrl": "https://three.ws",- "icons": [- {- "src": "https://three.ws/three-ws-mcp-icon.svg",- "mimeType": "image/svg+xml",- "sizes": [- "any"- ]- }- ],- "repository": {- "url": "https://github.com/nirholas/three.ws",- "source": "github",- "subfolder": "packages/omniology-mcp"- },- "version": "0.1.0",- "packages": [- {- "registryType": "npm",- "identifier": "@three-ws/omniology-mcp",- "version": "0.1.0",- "runtimeHint": "npx",- "transport": {- "type": "stdio"- },- "environmentVariables": [- {- "name": "OMNIOLOGY_BASE_URL",- "description": "Base URL of the Omniology contest API (serves /v1/contests/live and /v1/contests/{id}/entries). Required.",- "isRequired": true,- "isSecret": false,- "format": "string"- },- {- "name": "OMNIOLOGY_API_KEY",- "description": "Bearer token this server sends to Omniology when forwarding a paid entry submission. Optional — set when Omniology authenticates the front door.",- "isRequired": false,- "isSecret": true,- "format": "string"- },- {- "name": "OMNIOLOGY_SUBMIT_PRICE_USD",- "description": "Price charged for submit_entry, e.g. \"$0.05\". Defaults to $0.05 USDC.",- "isRequired": false,- "format": "string"- },- {- "name": "OMNIOLOGY_TIMEOUT_MS",- "description": "Per-request timeout in milliseconds for calls to the Omniology API. Defaults to 20000.",- "isRequired": false,- "format": "number"- },- {- "name": "MCP_SVM_PAYMENT_ADDRESS",- "description": "Solana wallet that receives USDC payments for submit_entry (server operator's receiving wallet). Required to accept x402 payments.",- "isRequired": true,- "isSecret": false,- "format": "string"- },- {- "name": "X402_FEE_PAYER_SOLANA",- "description": "Solana account that sponsors transaction fees for x402 payments. Defaults to the three.ws fee payer.",- "isRequired": false,- "format": "string"- },- {- "name": "X402_FACILITATOR_URL",- "description": "x402 facilitator endpoint for payment verification and settlement. Defaults to https://facilitator.payai.network.",- "isRequired": false,- "format": "string"- }- ]- }- ]-}diff --git a/packages/omniology-mcp/src/config.js b/packages/omniology-mcp/src/config.jsdeleted file mode 100644index 1ce7acbad..000000000--- a/packages/omniology-mcp/src/config.js+++ /dev/null@@ -1,51 +0,0 @@-// Centralized env for the Omniology MCP server.-//-// The read tools wrap Omniology's PUBLIC contest feed; submit_entry settles-// USDC on Solana (x402) and then forwards an authenticated POST to Omniology.-// The only knobs here are which Omniology deployment to talk to, an optional-// bearer token for the authenticated forward, and timeouts. The Solana payment-// env (MCP_SVM_PAYMENT_ADDRESS, X402_*) lives in payments.js.--export function env(key, fallback) {- const v = process.env[key];- return v !== undefined && String(v).trim() !== '' ? String(v).trim() : fallback;-}--// Base URL of the Omniology contest API (serves /v1/contests/live and-// /v1/contests/{id}/entries). No default — Omniology is an external service, so-// an unconfigured server fails clearly at startup rather than guessing a host.-export const OMNIOLOGY_BASE = env('OMNIOLOGY_BASE_URL', '').replace(/\/+$/, '');--// Optional bearer token sent to Omniology ONLY on the authenticated forward of-// a paid submit_entry. Never exposed to the MCP client.-export const OMNIOLOGY_API_KEY = env('OMNIOLOGY_API_KEY', '');--// Per-request timeout (ms) for calls to Omniology.-export const HTTP_TIMEOUT_MS = (() => {- const raw = env('OMNIOLOGY_TIMEOUT_MS');- if (raw === undefined) return 20000;- const n = Number(raw);- if (!Number.isFinite(n) || n <= 0) {- throw Object.assign(new Error(`OMNIOLOGY_TIMEOUT_MS must be a positive number (got "${raw}")`), {- code: 'bad_config',- });- }- return n;-})();--// Identifies this client to Omniology in request logs.-export const USER_AGENT = '@three-ws/omniology-mcp';--/**- * Assert OMNIOLOGY_BASE_URL is configured. Called once by the stdio entry point- * so a running server fails fast with a single clean line instead of only- * erroring on the first tool call. Not run during buildServer()/tests.- * @throws {Error} when OMNIOLOGY_BASE_URL is unset- */-export function assertBaseUrl() {- if (!OMNIOLOGY_BASE) {- throw new Error(- 'OMNIOLOGY_BASE_URL is not set — point it at the Omniology contest API (e.g. https://api.omniology.ai).',- );- }-}diff --git a/packages/omniology-mcp/src/index.js b/packages/omniology-mcp/src/index.jsdeleted file mode 100755index d8c0e40e5..000000000--- a/packages/omniology-mcp/src/index.js+++ /dev/null@@ -1,138 +0,0 @@-#!/usr/bin/env node-// @three-ws/omniology-mcp — stdio MCP server for Omniology AI-agent contests.-//-// The contract artifact: it lets ANY MCP client/agent read and enter Omniology-// contests, and it makes Omniology auto-discoverable in the x402 Bazaar. Three-// free read tools wrap Omniology's live contest feed; submit_entry is x402-priced-// in USDC on Solana — this server is the x402 front door for Omniology.-//-// • list_contests (free) — the running round + next open + recent winners-// • get_contest (free) — one contest's detail + leaderboard + entries-// • get_leaderboard (free) — a contest's ranked leaderboard-// • submit_entry (paid) — settle USDC, then forward the entry to Omniology-//-// Run standalone:-// OMNIOLOGY_BASE_URL=https://api.omniology.ai MCP_SVM_PAYMENT_ADDRESS=<wallet> \-// node packages/omniology-mcp/src/index.js-//-// Or wire into Claude Code / Cursor / any MCP host — see README.md.--import { realpathSync } from 'node:fs';-import { createRequire } from 'node:module';-import { pathToFileURL } from 'node:url';--import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';-import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';--import { assertBaseUrl } from './config.js';-import { assertPaymentEnv, getResourceServer, getLastFacilitatorInitError } from './payments.js';-import { OmniologyClient } from './omniology.js';-import { buildListContestsTool } from './tools/list-contests.js';-import { buildGetContestTool } from './tools/get-contest.js';-import { buildGetLeaderboardTool } from './tools/get-leaderboard.js';-import { buildSubmitEntryTool } from './tools/submit-entry.js';--// Single source of truth for the advertised version — package.json.-const require = createRequire(import.meta.url);-const SERVER_VERSION = require('../package.json').version;--const SERVER_INSTRUCTIONS =- 'Omniology contests over MCP. Three FREE read tools wrap the live contest feed: ' +- 'list_contests (running round + next open + recent winners), get_contest (one contest detail + ' +- 'leaderboard + entries), get_leaderboard (ranked leaderboard) — no payment, key, or wallet needed. ' +- 'submit_entry is PAID: it settles USDC on Solana via x402, then forwards your entry to Omniology. ' +- 'A submit_entry call without an x402 payment payload in _meta returns a PaymentRequired envelope ' +- '(v2 MCP transport spec); x402-capable clients sign and retry automatically. Read tools never charge.';--/**- * Build and return a fully-registered McpServer without connecting a transport.- * Safe to call from tests — registration touches no payment env and makes no- * network call. An OmniologyClient may be injected; otherwise the default- * (env-configured, global fetch) client is used.- *- * @param {OmniologyClient} [client]- * @returns {Promise<McpServer>}- */-export async function buildServer(client = new OmniologyClient()) {- const server = new McpServer(- { name: 'omniology-mcp', title: 'Omniology Contests via x402', version: SERVER_VERSION },- {- capabilities: { tools: { listChanged: false } },- instructions: SERVER_INSTRUCTIONS,- },- );-- const tools = await Promise.all([- buildListContestsTool(client),- buildGetContestTool(client),- buildGetLeaderboardTool(client),- buildSubmitEntryTool(client),- ]);-- for (const t of tools) {- server.registerTool(- t.name,- {- title: t.title,- description: t.description,- inputSchema: t.inputSchema,- annotations: t.annotations,- },- t.handler,- );- }-- return server;-}--async function main() {- // Fail fast and clearly on missing required env: the Omniology base URL- // (everything needs it) and the Solana payment address (submit_entry needs- // it to receive USDC). Each throws a single actionable line.- try {- assertBaseUrl();- assertPaymentEnv();- } catch (err) {- console.error(`[omniology-mcp] configuration error: ${err.message}`);- process.exit(1);- return;- }-- // Warm the shared x402 resource server so the first paid call doesn't pay the- // facilitator /supported fetch cost.- await getResourceServer();- const initErr = getLastFacilitatorInitError();- if (initErr) {- console.error(`[omniology-mcp] facilitator init warning: ${initErr.message}`);- }-- const server = await buildServer();- const transport = new StdioServerTransport();- await server.connect(transport);-- console.error(- `[omniology-mcp@${SERVER_VERSION}] ready — 3 free + 1 paid tool registered over stdio`,- );-}--// Connect stdio ONLY when this file is the process entry point. Launched through-// the npm bin (a symlink to this file), process.argv[1] is the symlink while-// import.meta.url is the resolved target, so compare both directly and via-// realpath — otherwise the server would never start under npx.-function isProcessEntryPoint() {- const argvPath = process.argv[1];- if (!argvPath) return false;- if (import.meta.url === pathToFileURL(argvPath).href) return true;- try {- return import.meta.url === pathToFileURL(realpathSync(argvPath)).href;- } catch {- return false;- }-}--if (isProcessEntryPoint()) {- main().catch((err) => {- console.error(`omniology-mcp: ${err?.message || err}`);- process.exit(1);- });-}diff --git a/packages/omniology-mcp/src/omniology.js b/packages/omniology-mcp/src/omniology.jsdeleted file mode 100644index fe51b6e0e..000000000--- a/packages/omniology-mcp/src/omniology.js+++ /dev/null@@ -1,220 +0,0 @@-// Real HTTP client for the Omniology contest API — the ONLY place that knows-// Omniology's wire shapes (CONTRACTS §1). Everything else consumes normalized-// objects, so swapping the real base URL is a one-config change.-//-// No mocks: every call is a live request to OMNIOLOGY_BASE. The `fetch`-// implementation is injectable (`fetchImpl`) so tests drive real request/parse-// logic against a deterministic fetch without monkeypatching globals.-//-// Endpoints (CONTRACTS §1):-// GET /v1/contests/live — the polled feed (current round +-// leaderboard + recent entries/winners)-// POST /v1/contests/{id}/entries — submit an entry (forwarded after the-// x402 USDC settlement done by this MCP)--import { OMNIOLOGY_BASE, OMNIOLOGY_API_KEY, HTTP_TIMEOUT_MS, USER_AGENT } from './config.js';--const DEFAULT_TIMEOUT_MS = 20000;--export class OmniologyError extends Error {- constructor(message, { code, status } = {}) {- super(message);- this.name = 'OmniologyError';- this.code = code || 'omniology_error';- if (status !== undefined) this.status = status;- }-}--// ---- normalization helpers --------------------------------------------------// Defensive coercion. Per CONTRACTS §1.1 unknown fields arrive as `null`-// (never omitted); we mirror that — a missing/garbage value becomes null rather-// than an invented default, so downstream renders designed empty states.--const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : null);-const str = (v) => (typeof v === 'string' && v.trim() !== '' ? v : null);-const secToMs = (v) => (typeof v === 'number' && Number.isFinite(v) ? Math.round(v * 1000) : null);-const arr = (v) => (Array.isArray(v) ? v : []);--function normalizeContest(c) {- if (!c || typeof c !== 'object') return null;- return {- id: str(c.id),- title: str(c.title),- round: num(c.round),- opensMs: secToMs(c.opened_unix),- closesMs: secToMs(c.closes_unix),- entriesCount: num(c.entries_count),- prizeUsdc: num(c.prize_usdc),- prizeAsset: str(c.prize_asset) || 'USDC',- };-}--function normalizeLeaderboard(list) {- return arr(list).map((r) => ({- rank: num(r?.rank),- entryId: str(r?.entry_id),- agent: str(r?.agent),- score: num(r?.score),- thumbUrl: str(r?.thumb_url),- }));-}--function normalizeRecentEntries(list) {- return arr(list).map((r) => ({- entryId: str(r?.entry_id),- agent: str(r?.agent),- submittedMs: secToMs(r?.submitted_unix),- }));-}--function normalizeRecentWinners(list) {- return arr(list).map((r) => ({- round: num(r?.round),- agent: str(r?.agent),- prizeUsdc: num(r?.prize_usdc),- tx: str(r?.tx),- }));-}--/**- * Normalize the raw /v1/contests/live body (CONTRACTS §1.1) into the camelCase,- * millisecond NormalizedFeed used across the arena (CONTRACTS §2.1).- */-export function normalizeFeed(raw) {- const body = raw && typeof raw === 'object' ? raw : {};- const next = body.next && typeof body.next === 'object' ? { opensMs: secToMs(body.next.opens_unix) } : null;- return {- ok: true,- serverNowMs: secToMs(body.now_unix),- current: normalizeContest(body.current),- next,- leaderboard: normalizeLeaderboard(body.leaderboard),- recentEntries: normalizeRecentEntries(body.recent_entries),- recentWinners: normalizeRecentWinners(body.recent_winners),- };-}--export class OmniologyClient {- /**- * @param {object} [opts]- * @param {string} [opts.baseUrl] — defaults to OMNIOLOGY_BASE- * @param {string} [opts.apiKey] — bearer for the authenticated forward- * @param {number} [opts.timeoutMs]- * @param {Function} [opts.fetchImpl] — injectable fetch (tests)- * @param {string} [opts.userAgent]- */- constructor({ baseUrl, apiKey, timeoutMs, fetchImpl, userAgent } = {}) {- this.baseUrl = String(baseUrl ?? OMNIOLOGY_BASE ?? '').replace(/\/+$/, '');- this.apiKey = apiKey ?? OMNIOLOGY_API_KEY ?? '';- this.timeoutMs = timeoutMs ?? HTTP_TIMEOUT_MS ?? DEFAULT_TIMEOUT_MS;- this.userAgent = userAgent || USER_AGENT;- this._fetch = fetchImpl || (globalThis.fetch ? globalThis.fetch.bind(globalThis) : null);- if (typeof this._fetch !== 'function') {- throw new OmniologyError('No fetch implementation available (Node ≥18 or inject fetchImpl).', {- code: 'no_fetch',- });- }- }-- _requireBase() {- if (!this.baseUrl) {- throw new OmniologyError(- 'OMNIOLOGY_BASE_URL is not set — point it at the Omniology contest API.',- { code: 'not_configured' },- );- }- return this.baseUrl;- }-- // Low-level request. Errors are sanitized: messages name the path + status- // only, never the bearer token, full URL with secrets, or upstream stack.- async _request(path, { method = 'GET', body, auth = false } = {}) {- const base = this._requireBase();- const controller = new AbortController();- const timer = setTimeout(() => controller.abort(), this.timeoutMs);-- let res;- try {- res = await this._fetch(`${base}${path}`, {- method,- headers: {- accept: 'application/json',- 'user-agent': this.userAgent,- ...(body !== undefined ? { 'content-type': 'application/json' } : {}),- ...(auth && this.apiKey ? { authorization: `Bearer ${this.apiKey}` } : {}),- },- body: body !== undefined ? JSON.stringify(body) : undefined,- signal: controller.signal,- });- } catch (err) {- clearTimeout(timer);- if (err?.name === 'AbortError') {- throw new OmniologyError(`Omniology ${path} timed out after ${this.timeoutMs}ms.`, {- code: 'timeout',- });- }- throw new OmniologyError(`Omniology ${path} request failed.`, { code: 'network_error' });- }- clearTimeout(timer);-- const text = await res.text();- let data;- try {- data = text ? JSON.parse(text) : {};- } catch {- data = null;- }-- if (!res.ok) {- // Surface a clean upstream message — prefer Omniology's own error- // string, fall back to the status. Never echo arbitrary HTML/raw body.- const upstream =- (data && typeof data === 'object' && (str(data.message) || str(data.error))) || null;- throw new OmniologyError(- upstream || `Omniology ${path} returned HTTP ${res.status}.`,- { code: 'upstream_error', status: res.status },- );- }- if (data === null) {- throw new OmniologyError(`Omniology ${path} returned a non-JSON response.`, {- code: 'bad_response',- });- }- return data;- }-- /**- * Fetch + normalize the live contest feed (CONTRACTS §1.1).- * @returns {Promise<object>} NormalizedFeed (CONTRACTS §2.1)- */- async fetchLiveFeed() {- const raw = await this._request('/v1/contests/live');- return normalizeFeed(raw);- }-- /**- * Forward a paid entry submission to Omniology (CONTRACTS §1.2). Called only- * AFTER this MCP has verified the x402 USDC payment, so the POST itself is a- * plain authenticated request — Omniology trusts this server as its x402- * front door. Returns Omniology's raw acceptance body- * `{ entry_id, status, round, position }`.- *- * @param {string} contestId- * @param {{ entry: object, agent?: string|null }} payload- */- async submitEntry(contestId, { entry, agent = null } = {}) {- const id = String(contestId ?? '').trim();- if (!id) throw new OmniologyError('submitEntry: contestId is required.', { code: 'bad_input' });- const data = await this._request(`/v1/contests/${encodeURIComponent(id)}/entries`, {- method: 'POST',- auth: true,- body: { entry, agent: agent ?? null },- });- return {- entryId: str(data.entry_id),- status: str(data.status) || 'accepted',- round: num(data.round),- position: num(data.position),- };- }-}diff --git a/packages/omniology-mcp/src/payments.js b/packages/omniology-mcp/src/payments.jsdeleted file mode 100644index abf6448e9..000000000--- a/packages/omniology-mcp/src/payments.js+++ /dev/null@@ -1,243 +0,0 @@-// x402 payment wiring for omniology-mcp — Solana USDC, exact scheme.-//-// Mirrors packages/ibm-x402-mcp/src/payments.js and mcp-server/src/payments.js.-// Builds a single shared x402ResourceServer per process that verifies + settles-// USDC on Solana mainnet via PayAI's facilitator. The one paid tool-// (submit_entry) wraps its handler in `paid(cfg, fn)`; the free read tools wrap-// theirs in `free(cfg, fn)` so every tool returns the same MCP CallToolResult-// envelope. This server is the x402 front door for Omniology: it settles the-// USDC payment here, then the tool forwards an authenticated entry to Omniology.-//-// Environment (server operator — NOT the end user):-// MCP_SVM_PAYMENT_ADDRESS — Solana wallet that receives USDC (required)-// X402_PAY_TO_SOLANA — fallback alias-// X402_PAY_TO — fallback alias-// X402_FEE_PAYER_SOLANA — transaction fee payer (optional, defaults to three.ws fee payer)-// X402_FACILITATOR_URL — PayAI facilitator URL (optional)-// X402_FACILITATOR_TOKEN — Bearer token for facilitator (optional)-// X402_ASSET_MINT_SOLANA — USDC mint override (optional)--import { HTTPFacilitatorClient, x402ResourceServer } from '@x402/core/server';-import { registerExactSvmScheme } from '@x402/svm/exact/server';-import { createPaymentWrapper, createToolResourceUrl } from '@x402/mcp';-import { declareDiscoveryExtension } from '@x402/extensions/bazaar';--// CAIP-2 id for Solana mainnet (mirrors api/_lib/x402-spec.js).-const NETWORK_SOLANA_MAINNET = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp';-// Canonical Solana mainnet USDC mint (read from repo, never pasted from memory).-const DEFAULT_SOLANA_USDC = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v';--const env = (key, fallback) => {- const v = process.env[key];- return v && v.trim() ? v.trim() : fallback;-};--function requireSvmPayTo() {- const addr = env('MCP_SVM_PAYMENT_ADDRESS') || env('X402_PAY_TO_SOLANA') || env('X402_PAY_TO');- if (!addr) {- throw new Error(- 'set MCP_SVM_PAYMENT_ADDRESS to your Solana wallet address to receive USDC payments.',- );- }- return addr;-}--/**- * Assert the receiving Solana payment address is configured. Called once by the- * stdio entry point so a running server fails fast with a single clean line.- * Does NOT run during buildServer()/tests — tool registration stays secret-free.- * @throws {Error} with a single actionable message when no pay-to is set- */-export function assertPaymentEnv() {- requireSvmPayTo();-}--function svmFeePayer() {- return env('X402_FEE_PAYER_SOLANA', '2wKupLR9q6wXYppw8Gr2NvWxKBUqm4PPJKkQfoxHDBg4');-}--function buildFacilitator() {- const url = env('X402_FACILITATOR_URL', 'https://facilitator.payai.network');- const token = env('X402_FACILITATOR_TOKEN');- return new HTTPFacilitatorClient({- url,- createAuthHeaders: token- ? async () => ({ headers: { Authorization: `Bearer ${token}` } })- : undefined,- });-}--let resourceServerPromise = null;-let lastInitError = null;--// Build a single shared x402ResourceServer, register the Solana `exact` scheme,-// and call .initialize() to fetch the facilitator's /supported. Memoized so-// concurrent tool calls don't race during startup.-export function getResourceServer() {- if (resourceServerPromise) return resourceServerPromise;- resourceServerPromise = (async () => {- const server = new x402ResourceServer([buildFacilitator()]);- registerExactSvmScheme(server, {});- try {- await server.initialize();- } catch (err) {- lastInitError = err;- console.error(`[omniology-mcp] facilitator initialize() failed: ${err.message}`);- }- return server;- })();- return resourceServerPromise;-}--export function getLastFacilitatorInitError() {- return lastInitError;-}--async function buildAccepts({ resourceServer, priceUsd, resourceUrl }) {- return resourceServer.buildPaymentRequirementsFromOptions(- [- {- scheme: 'exact',- network: NETWORK_SOLANA_MAINNET,- payTo: requireSvmPayTo(),- price: priceUsd,- maxTimeoutSeconds: 60,- extra: {- name: 'USDC',- decimals: 6,- asset: env('X402_ASSET_MINT_SOLANA', DEFAULT_SOLANA_USDC),- feePayer: svmFeePayer(),- },- },- ],- { resourceUrl },- );-}--/**- * Wrap a tool handler with Solana USDC x402 payment (exact scheme).- *- * Payment wiring is built LAZILY on first invocation — tool registration stays- * secret-free so buildServer() can enumerate tools without payment env. The- * wrapper is memoized so the first call pays the init cost once.- *- * @param {object} cfg- * @param {string} cfg.toolName- * @param {string} cfg.description- * @param {string} cfg.priceUsd — e.g. "$0.05"- * @param {object} cfg.inputSchema — JSON Schema for tool args- * @param {object} [cfg.example]- * @param {object} [cfg.outputExample]- * @param {Function} handler — async (args, context) → any- * @returns {Function} MCP tool callback- */-export function paid(cfg, handler) {- const { toolName, description, priceUsd, inputSchema, example, outputExample } = cfg;-- if (!toolName) throw new Error('paid(): toolName is required');- if (!description) throw new Error('paid(): description is required');- if (!priceUsd) throw new Error('paid(): priceUsd is required');- if (!inputSchema) throw new Error('paid(): inputSchema is required');-- let wrapperPromise = null;-- async function getWrapper() {- if (wrapperPromise) return wrapperPromise;- wrapperPromise = (async () => {- const resourceServer = await getResourceServer();- const resourceUrl = createToolResourceUrl(toolName);- const accepts = await buildAccepts({ resourceServer, priceUsd, resourceUrl });-- const bazaar = declareDiscoveryExtension({- toolName,- description,- transport: 'stdio',- inputSchema,- example,- output: outputExample ? { example: outputExample } : undefined,- });-- const wrap = createPaymentWrapper(resourceServer, {- accepts,- resource: { url: resourceUrl, description, mimeType: 'application/json' },- extensions: bazaar,- });-- return wrap(async (args, context) => {- const result = await handler(args, context);- return buildToolResult(result);- });- })();- return wrapperPromise;- }-- return async function paidToolCallback(args, context) {- const wrapped = await getWrapper();- return wrapped(args, context);- };-}--/**- * Wrap a tool handler as a FREE (no-payment) MCP tool callback — the read- * tools. Funnels the return value through the SAME envelope every paid tool- * uses (text mirror + structuredContent + isError on `ok:false`), so a free- * tool is indistinguishable from a paid one to the client EXCEPT it never emits- * a 402 PaymentRequired challenge and never touches payment env. Errors thrown- * by the handler are sanitized into a stable `{ ok:false, error, message }`.- *- * @param {object} cfg- * @param {string} cfg.toolName — used only in error messages- * @param {Function} handler — async (args, context) → any- * @returns {Function} MCP tool callback- */-export function free(cfg, handler) {- const { toolName } = cfg || {};- if (!toolName) throw new Error('free(): toolName is required');- if (typeof handler !== 'function') throw new Error('free(): handler must be a function');- return async function freeToolCallback(args, context) {- try {- const result = await handler(args, context);- return buildToolResult(result);- } catch (err) {- return buildToolResult(- toolError(err?.code || 'internal_error', err?.message || String(err), {- ...(err?.status ? { status: err.status } : {}),- }),- );- }- };-}--/**- * Build the MCP CallToolResult envelope from a handler's return value.- * - content[0].text — JSON (or raw string) blob; always present.- * - structuredContent — plain objects surfaced as structured tool output.- * - isError:true — set ONLY for the `{ ok:false }` toolError envelope, which- * also cancels the x402 payment so a caller is never charged for an error.- *- * @param {unknown} result- * @returns {{ content: Array<{type:'text',text:string}>, structuredContent?: object, isError?: true }}- */-export function buildToolResult(result) {- const text = typeof result === 'string' ? result : JSON.stringify(result);- const envelope = { content: [{ type: 'text', text }] };- const isPlainObject = result !== null && typeof result === 'object' && !Array.isArray(result);- if (isPlainObject) {- envelope.structuredContent = result;- if (result.ok === false) envelope.isError = true;- }- return envelope;-}--/**- * Standard tool error envelope. Every error path returns this shape so MCP- * clients branch on a stable `{ ok:false, error:<code>, message }` contract.- * @param {string} code- * @param {string} message- * @param {object} [extra]- */-export function toolError(code, message, extra) {- return { ok: false, error: code, message, ...(extra || {}) };-}--export { NETWORK_SOLANA_MAINNET };diff --git a/packages/omniology-mcp/src/pricing.js b/packages/omniology-mcp/src/pricing.jsdeleted file mode 100644index 854da090a..000000000--- a/packages/omniology-mcp/src/pricing.js+++ /dev/null@@ -1,23 +0,0 @@-// Single source of truth for what submit_entry costs.-//-// Like the sibling x402 MCP servers, the price lives in one module so the tool-// description, getting-started catalog, and the x402 `accepts` requirement can-// never drift. The default is a flat per-submission fee; operators override it-// with OMNIOLOGY_SUBMIT_PRICE_USD (e.g. "$0.10"). This is the MCP front-door-// fee — distinct from any contest entry fee Omniology settles on its own side.--import { env } from './config.js';--function normalizePrice(raw) {- const value = String(raw).trim();- if (!/^\$\d+(\.\d+)?$/.test(value)) {- throw Object.assign(- new Error(`OMNIOLOGY_SUBMIT_PRICE_USD must look like "$0.05" (got "${raw}")`),- { code: 'bad_config' },- );- }- return value;-}--// USDC price for one submit_entry call, settled `exact` on Solana mainnet.-export const SUBMIT_ENTRY_PRICE_USD = normalizePrice(env('OMNIOLOGY_SUBMIT_PRICE_USD', '$0.05'));diff --git a/packages/omniology-mcp/src/tools/_shared.js b/packages/omniology-mcp/src/tools/_shared.jsdeleted file mode 100644index 433653e83..000000000--- a/packages/omniology-mcp/src/tools/_shared.js+++ /dev/null@@ -1,34 +0,0 @@-import { z } from 'zod';-import { zodToJsonSchema } from 'zod-to-json-schema';--export { toolError } from '../payments.js';--// MCP ToolAnnotations for the free read tools. Each reads Omniology's live-// contest feed: nothing local is modified (readOnlyHint) and it reaches an-// external service (openWorldHint). The feed advances every ~88s, so identical-// input can return different output — not idempotent.-export const readAnnotations = Object.freeze({- readOnlyHint: true,- openWorldHint: true,- idempotentHint: false,-});--// MCP ToolAnnotations for submit_entry — a write to an external contest. It-// creates a new entry (not read-only), is not idempotent (each call is a fresh-// submission), and talks to a live service. Submitting is additive, not-// destructive, so destructiveHint stays false.-export const writeAnnotations = Object.freeze({- readOnlyHint: false,- openWorldHint: true,- idempotentHint: false,- destructiveHint: false,-});--export function jsonSchemaFromZod(shape) {- const schema = zodToJsonSchema(z.object(shape).strict(), {- $refStrategy: 'none',- target: 'jsonSchema7',- });- delete schema.$schema;- return schema;-}diff --git a/packages/omniology-mcp/src/tools/get-contest.js b/packages/omniology-mcp/src/tools/get-contest.jsdeleted file mode 100644index 1c39bebb3..000000000--- a/packages/omniology-mcp/src/tools/get-contest.js+++ /dev/null@@ -1,64 +0,0 @@-// `get_contest` — FREE read tool. Returns one contest's full detail (title,-// round, open/close times, entry count, prize) plus its current leaderboard and-// recent entries.-//-// Thin wrapper over Omniology's /v1/contests/live feed (CONTRACTS §1.1). The-// feed is a live window over the current/most-recent round, so a contestId that-// matches the running round resolves; any other id returns a clean-// `contest_not_found` rather than fabricated history.--import { z } from 'zod';--import { free, toolError } from '../payments.js';-import { jsonSchemaFromZod, readAnnotations } from './_shared.js';--const TOOL_NAME = 'get_contest';-const TOOL_DESCRIPTION =- 'Fetch one Omniology contest by id from the live feed: its title, round number, open/close times, ' +- 'entry count, USDC prize, current leaderboard, and recent entries. Read-only and free. The feed ' +- 'covers the running round, so an id from list_contests resolves; an unknown id returns ' +- 'contest_not_found.';--const inputZodShape = {- contestId: z- .string()- .min(1)- .max(200)- .describe('Contest id, as returned by list_contests (the running round\'s id).'),-};--const inputJsonSchema = jsonSchemaFromZod(inputZodShape);--export function buildGetContestTool(client) {- const handler = free({ toolName: TOOL_NAME }, async (args) => {- const contestId = String(args?.contestId ?? '').trim();- if (!contestId) {- return toolError('bad_input', 'contestId is required.');- }- const feed = await client.fetchLiveFeed();- if (!feed.current || feed.current.id !== contestId) {- return toolError(- 'contest_not_found',- `No live contest with id "${contestId}". Call list_contests for the current round.`,- { status: 404 },- );- }- return {- ok: true,- serverNowMs: feed.serverNowMs,- contest: { ...feed.current, status: 'live' },- leaderboard: feed.leaderboard,- recentEntries: feed.recentEntries,- };- });-- return {- name: TOOL_NAME,- title: 'Get an Omniology contest (free)',- description: TOOL_DESCRIPTION,- annotations: readAnnotations,- inputSchema: inputZodShape,- inputJsonSchema,- handler,- };-}diff --git a/packages/omniology-mcp/src/tools/get-leaderboard.js b/packages/omniology-mcp/src/tools/get-leaderboard.jsdeleted file mode 100644index 5ed522717..000000000--- a/packages/omniology-mcp/src/tools/get-leaderboard.js+++ /dev/null@@ -1,62 +0,0 @@-// `get_leaderboard` — FREE read tool. Returns the ranked leaderboard for a-// contest (rank, entry id, agent display name, score, thumbnail).-//-// Thin wrapper over Omniology's /v1/contests/live feed (CONTRACTS §1.1), whose-// `leaderboard` is for the current/most-recent round. A contestId matching the-// running round resolves; any other id returns `contest_not_found`.--import { z } from 'zod';--import { free, toolError } from '../payments.js';-import { jsonSchemaFromZod, readAnnotations } from './_shared.js';--const TOOL_NAME = 'get_leaderboard';-const TOOL_DESCRIPTION =- 'Fetch the ranked leaderboard for an Omniology contest: rank, entry id, agent display name, score, ' +- 'and thumbnail for each placed entry. Read-only and free. Covers the current/most-recent round; an ' +- 'unknown id returns contest_not_found.';--const inputZodShape = {- contestId: z- .string()- .min(1)- .max(200)- .describe('Contest id, as returned by list_contests (the running round\'s id).'),-};--const inputJsonSchema = jsonSchemaFromZod(inputZodShape);--export function buildGetLeaderboardTool(client) {- const handler = free({ toolName: TOOL_NAME }, async (args) => {- const contestId = String(args?.contestId ?? '').trim();- if (!contestId) {- return toolError('bad_input', 'contestId is required.');- }- const feed = await client.fetchLiveFeed();- if (!feed.current || feed.current.id !== contestId) {- return toolError(- 'contest_not_found',- `No live contest with id "${contestId}". Call list_contests for the current round.`,- { status: 404 },- );- }- return {- ok: true,- serverNowMs: feed.serverNowMs,- contestId,- round: feed.current.round,- count: feed.leaderboard.length,- leaderboard: feed.leaderboard,- };- });-- return {- name: TOOL_NAME,- title: 'Get an Omniology leaderboard (free)',- description: TOOL_DESCRIPTION,- annotations: readAnnotations,- inputSchema: inputZodShape,- inputJsonSchema,- handler,- };-}diff --git a/packages/omniology-mcp/src/tools/list-contests.js b/packages/omniology-mcp/src/tools/list-contests.jsdeleted file mode 100644index 653ea3068..000000000--- a/packages/omniology-mcp/src/tools/list-contests.js+++ /dev/null@@ -1,72 +0,0 @@-// `list_contests` — FREE read tool. Lists the contests the Omniology live feed-// currently exposes: the running round and (when known) the next round's open-// time, plus the last few winners for context.-//-// Thin wrapper over Omniology's /v1/contests/live feed (CONTRACTS §1.1). The-// feed is a live ~88s window, so the canonical "list" is the current round; the-// optional `status` filter narrows the projection without inventing data.--import { z } from 'zod';--import { free } from '../payments.js';-import { jsonSchemaFromZod, readAnnotations } from './_shared.js';--const TOOL_NAME = 'list_contests';-const TOOL_DESCRIPTION =- 'List Omniology AI-agent contests from the live feed: the currently running round (id, title, ' +- 'round number, open/close times, entry count, USDC prize) and, when known, when the next round ' +- 'opens, plus the most recent winners. Read-only and free — no payment, key, or wallet required. ' +- 'Filter with status: "all" (default), "live", or "upcoming".';--const inputZodShape = {- status: z- .enum(['all', 'live', 'upcoming'])- .optional()- .describe('Which contests to include: "all" (default), only the "live" round, or "upcoming".'),-};--const inputJsonSchema = jsonSchemaFromZod(inputZodShape);--export function buildListContestsTool(client) {- const handler = free({ toolName: TOOL_NAME }, async (args) => {- const status = args?.status || 'all';- const feed = await client.fetchLiveFeed();-- const contests = [];- if ((status === 'all' || status === 'live') && feed.current) {- contests.push({ ...feed.current, status: 'live' });- }- if ((status === 'all' || status === 'upcoming') && feed.next?.opensMs != null) {- // The feed only carries the next round's open time, not its identity.- contests.push({- id: null,- title: null,- round: feed.current?.round != null ? feed.current.round + 1 : null,- opensMs: feed.next.opensMs,- closesMs: null,- entriesCount: null,- prizeUsdc: null,- prizeAsset: 'USDC',- status: 'upcoming',- });- }-- return {- ok: true,- serverNowMs: feed.serverNowMs,- count: contests.length,- contests,- recentWinners: feed.recentWinners,- };- });-- return {- name: TOOL_NAME,- title: 'List Omniology contests (free)',- description: TOOL_DESCRIPTION,- annotations: readAnnotations,- inputSchema: inputZodShape,- inputJsonSchema,- handler,- };-}diff --git a/packages/omniology-mcp/src/tools/submit-entry.js b/packages/omniology-mcp/src/tools/submit-entry.jsdeleted file mode 100644index ad53775be..000000000--- a/packages/omniology-mcp/src/tools/submit-entry.js+++ /dev/null@@ -1,105 +0,0 @@-// `submit_entry` — PAID write tool. Settles USDC on Solana (x402, exact) and-// then forwards the entry to Omniology's submit endpoint (CONTRACTS §1.2).-//-// This server is the x402 FRONT DOOR for Omniology: the caller pays this MCP in-// USDC, the payment is verified by the shared x402 resource server, and only-// then does `submitEntryCore` POST the authenticated entry to Omniology. If the-// forward fails, the handler returns a toolError envelope (`ok:false`) which the-// payment wrapper treats as a failure and CANCELS the settlement — so a caller-// is never charged for an entry Omniology rejected.--import { z } from 'zod';--import { paid, toolError } from '../payments.js';-import { jsonSchemaFromZod, writeAnnotations } from './_shared.js';-import { SUBMIT_ENTRY_PRICE_USD } from '../pricing.js';-import { OmniologyError } from '../omniology.js';--const TOOL_NAME = 'submit_entry';-const TOOL_DESCRIPTION =- `Submit an entry to an Omniology contest. Paid: ${SUBMIT_ENTRY_PRICE_USD} USDC settled on Solana via ` +- 'x402 — the call returns a PaymentRequired challenge until a signed payment is supplied, then the ' +- 'verified entry is forwarded to Omniology and the acceptance (entry_id, status, round, position) is ' +- 'returned. `entry` is the partner-defined submission payload; `agent` is an optional display name.';--// `entry` is partner-defined (CONTRACTS §1.2) — accept any JSON object and pass-// it through untouched. We only require it to be a non-null object.-const inputZodShape = {- contestId: z- .string()- .min(1)- .max(200)- .describe('Id of the contest to enter (from list_contests).'),- entry: z- .record(z.any())- .describe('Partner-defined entry payload, forwarded verbatim to Omniology.'),- agent: z- .string()- .max(200)- .nullish()- .describe('Optional display name to attribute the entry to.'),-};--const inputJsonSchema = jsonSchemaFromZod(inputZodShape);--/**- * Forward a (already-paid) entry to Omniology and shape the result. Exported so- * the forward path is unit-testable with a DI'd client, independent of the x402- * payment wrapper.- *- * @param {import('../omniology.js').OmniologyClient} client- * @param {{ contestId: string, entry: object, agent?: string|null }} args- */-export async function submitEntryCore(client, args) {- const contestId = String(args?.contestId ?? '').trim();- if (!contestId) return toolError('bad_input', 'contestId is required.');- if (!args?.entry || typeof args.entry !== 'object' || Array.isArray(args.entry)) {- return toolError('bad_input', 'entry must be a JSON object.');- }- try {- const result = await client.submitEntry(contestId, {- entry: args.entry,- agent: args.agent ?? null,- });- return { ok: true, ...result };- } catch (err) {- if (err instanceof OmniologyError) {- return toolError(err.code, err.message, err.status ? { status: err.status } : undefined);- }- return toolError('internal_error', err?.message || String(err));- }-}--export function buildSubmitEntryTool(client) {- const handler = paid(- {- toolName: TOOL_NAME,- description: TOOL_DESCRIPTION,- priceUsd: SUBMIT_ENTRY_PRICE_USD,- inputSchema: inputJsonSchema,- example: {- contestId: 'rnd_1421',- entry: { prompt: 'a neon koi swimming through circuitry', model: 'three.ws/forge' },- agent: 'Reef',- },- outputExample: {- ok: true,- entryId: 'ent_8c12e0f9',- status: 'accepted',- round: 1421,- position: 38,- },- },- async (args) => submitEntryCore(client, args),- );-- return {- name: TOOL_NAME,- title: `Submit a contest entry (${SUBMIT_ENTRY_PRICE_USD})`,- description: TOOL_DESCRIPTION,- annotations: writeAnnotations,- inputSchema: inputZodShape,- inputJsonSchema,- handler,- };-}diff --git a/packages/omniology-mcp/test/registration.test.mjs b/packages/omniology-mcp/test/registration.test.mjsdeleted file mode 100644index ff4618aeb..000000000--- a/packages/omniology-mcp/test/registration.test.mjs+++ /dev/null@@ -1,122 +0,0 @@-// Tool-surface invariants for @three-ws/omniology-mcp.-//-// Building the tool catalog is secret-free by design: the paid wrapper is lazy-// (see src/payments.js), so the whole surface enumerates with no payment env-// and no Omniology base URL, and these tests never touch the network.-//-// Run: node --test packages/omniology-mcp/test/registration.test.mjs--import { test, before } from 'node:test';-import assert from 'node:assert/strict';-import { z } from 'zod';--import { buildServer } from '../src/index.js';-import { buildListContestsTool } from '../src/tools/list-contests.js';-import { buildGetContestTool } from '../src/tools/get-contest.js';-import { buildGetLeaderboardTool } from '../src/tools/get-leaderboard.js';-import { buildSubmitEntryTool } from '../src/tools/submit-entry.js';-import { SUBMIT_ENTRY_PRICE_USD } from '../src/pricing.js';-import { OmniologyClient } from '../src/omniology.js';--// Guarantee enumeration works with neither payment nor Omniology env set.-delete process.env.MCP_SVM_PAYMENT_ADDRESS;-delete process.env.X402_PAY_TO_SOLANA;-delete process.env.X402_PAY_TO;-delete process.env.OMNIOLOGY_BASE_URL;-delete process.env.OMNIOLOGY_API_KEY;--const READ_TOOLS = ['list_contests', 'get_contest', 'get_leaderboard'];-const ALL_TOOLS = [...READ_TOOLS, 'submit_entry'];--// A client whose fetch must never be called during registration — if it is, the-// test fails loudly instead of silently hitting the network.-const noFetch = () => {- throw new Error('registration must not perform network I/O');-};-const client = new OmniologyClient({ baseUrl: 'https://example.test', fetchImpl: noFetch });--let tools;--before(async () => {- tools = await Promise.all([- buildListContestsTool(client),- buildGetContestTool(client),- buildGetLeaderboardTool(client),- buildSubmitEntryTool(client),- ]);-});--test('exactly the four documented tools are built', () => {- const names = tools.map((t) => t.name).sort();- assert.deepEqual(names, [...ALL_TOOLS].sort());-});--test('tool names are unique', () => {- const names = tools.map((t) => t.name);- assert.equal(new Set(names).size, names.length);-});--test('every tool has a title, description, zod input shape, handler and annotations', () => {- for (const t of tools) {- assert.ok(typeof t.title === 'string' && t.title.length > 0, `${t.name} title`);- assert.ok(typeof t.description === 'string' && t.description.length > 0, `${t.name} description`);- assert.ok(t.inputSchema && typeof t.inputSchema === 'object', `${t.name} inputSchema`);- assert.ok(Object.keys(t.inputSchema).length > 0, `${t.name} inputSchema has no fields`);- assert.equal(typeof t.handler, 'function', `${t.name} handler`);- assert.ok(t.annotations, `${t.name} annotations`);- assert.equal(typeof t.annotations.readOnlyHint, 'boolean', `${t.name} readOnlyHint`);- assert.equal(typeof t.annotations.openWorldHint, 'boolean', `${t.name} openWorldHint`);- assert.equal(typeof t.annotations.idempotentHint, 'boolean', `${t.name} idempotentHint`);- }-});--test('read tools are read-only & open-world; submit_entry is a write', () => {- for (const t of tools) {- assert.equal(t.annotations.openWorldHint, true, `${t.name} talks to a live service`);- if (READ_TOOLS.includes(t.name)) {- assert.equal(t.annotations.readOnlyHint, true, `${t.name} must be read-only`);- assert.equal(t.annotations.destructiveHint, undefined, `${t.name} must omit destructiveHint`);- } else {- assert.equal(t.annotations.readOnlyHint, false, 'submit_entry mutates external state');- assert.equal(t.annotations.destructiveHint, false, 'submit_entry is additive, not destructive');- }- }-});--test('submit_entry states its exact USDC price in description and title', () => {- const submit = tools.find((t) => t.name === 'submit_entry');- assert.match(SUBMIT_ENTRY_PRICE_USD, /^\$\d/);- assert.ok(submit.description.includes(SUBMIT_ENTRY_PRICE_USD), 'description price');- assert.ok(submit.title.includes(SUBMIT_ENTRY_PRICE_USD), 'title price');-});--test('input schemas validate required fields', () => {- const get = tools.find((t) => t.name === 'get_contest');- const getSchema = z.object(get.inputSchema);- assert.equal(getSchema.safeParse({}).success, false, 'get_contest needs contestId');- assert.equal(getSchema.safeParse({ contestId: 'rnd_1' }).success, true);-- const submit = tools.find((t) => t.name === 'submit_entry');- const submitSchema = z.object(submit.inputSchema);- assert.equal(submitSchema.safeParse({ contestId: 'rnd_1' }).success, false, 'submit needs entry');- assert.equal(- submitSchema.safeParse({ contestId: 'rnd_1', entry: { prompt: 'x' } }).success,- true,- );- assert.equal(- submitSchema.safeParse({ contestId: 'rnd_1', entry: { prompt: 'x' }, agent: 'Reef' }).success,- true,- 'agent is optional',- );-});--test('buildServer registers every tool with its annotations, secret-free', async () => {- const server = await buildServer(client);- const registered = server._registeredTools;- assert.ok(registered, 'McpServer should expose its tool registry');- for (const t of tools) {- const entry = registered[t.name];- assert.ok(entry, `${t.name} not registered`);- assert.deepEqual(entry.annotations, t.annotations, `${t.name} annotations must survive`);- }-});diff --git a/packages/omniology-mcp/test/tools.test.mjs b/packages/omniology-mcp/test/tools.test.mjsdeleted file mode 100644index cc79bcf00..000000000--- a/packages/omniology-mcp/test/tools.test.mjs+++ /dev/null@@ -1,199 +0,0 @@-// Behavioral tests for the Omniology read + write tools.-//-// Network calls hit a REAL injected fetch (dependency-injected into the-// OmniologyClient), not a global monkeypatch — so the actual request building,-// response parsing, normalization, and error sanitization run end to end with-// no live-network dependency in CI. Fixtures are synthetic (Omniology contest-// shapes per CONTRACTS §1); the only token referenced is USDC as a payment-// asset.-//-// Run: node --test packages/omniology-mcp/test/tools.test.mjs--import { test } from 'node:test';-import assert from 'node:assert/strict';--import { OmniologyClient } from '../src/omniology.js';-import { buildListContestsTool } from '../src/tools/list-contests.js';-import { buildGetContestTool } from '../src/tools/get-contest.js';-import { buildGetLeaderboardTool } from '../src/tools/get-leaderboard.js';-import { submitEntryCore } from '../src/tools/submit-entry.js';--const BASE = 'https://sandbox.omniology.test';--// Minimal Response stand-in matching what OmniologyClient consumes.-function jsonResponse(body, { status = 200 } = {}) {- return {- ok: status >= 200 && status < 300,- status,- text: async () => (typeof body === 'string' ? body : JSON.stringify(body)),- };-}--// A recording fake fetch: returns the queued response and records the call.-function fakeFetch(responder) {- const calls = [];- const fn = async (url, init) => {- calls.push({ url, init });- return responder(url, init);- };- fn.calls = calls;- return fn;-}--const LIVE_FEED = {- now_unix: 1719259200,- current: {- id: 'rnd_1421',- title: 'Neon Koi',- round: 1421,- opened_unix: 1719259112,- closes_unix: 1719259200,- entries_count: 37,- prize_usdc: 12.5,- prize_asset: 'USDC',- },- next: { opens_unix: 1719259288 },- leaderboard: [- { rank: 1, entry_id: 'ent_a', agent: 'Reef', score: 0.92, thumb_url: 'https://cdn.test/a.png' },- { rank: 2, entry_id: 'ent_b', agent: 'Coral', score: 0.81, thumb_url: null },- ],- recent_entries: [{ entry_id: 'ent_c', agent: 'Tide', submitted_unix: 1719259190 }],- recent_winners: [{ round: 1420, agent: 'Marlin', prize_usdc: 11.0, tx: 'sig_xyz' }],-};--function clientReturning(responder) {- const fetchImpl = fakeFetch(responder);- const client = new OmniologyClient({ baseUrl: BASE, fetchImpl, apiKey: 'secret-token' });- return { client, fetchImpl };-}--test('list_contests normalizes the live feed (ms timestamps, camelCase)', async () => {- const { client, fetchImpl } = clientReturning(() => jsonResponse(LIVE_FEED));- const tool = buildListContestsTool(client);- const res = await tool.handler({});- const out = res.structuredContent;-- assert.equal(fetchImpl.calls[0].url, `${BASE}/v1/contests/live`);- assert.equal(out.ok, true);- assert.equal(out.serverNowMs, 1719259200000);- assert.equal(out.count, 2); // live + upcoming- const live = out.contests.find((c) => c.status === 'live');- assert.equal(live.id, 'rnd_1421');- assert.equal(live.closesMs, 1719259200000);- assert.equal(live.prizeUsdc, 12.5);- const upcoming = out.contests.find((c) => c.status === 'upcoming');- assert.equal(upcoming.round, 1422);- assert.equal(upcoming.opensMs, 1719259288000);- assert.equal(out.recentWinners[0].agent, 'Marlin');-});--test('list_contests status="live" returns only the running round', async () => {- const { client } = clientReturning(() => jsonResponse(LIVE_FEED));- const tool = buildListContestsTool(client);- const out = (await tool.handler({ status: 'live' })).structuredContent;- assert.equal(out.count, 1);- assert.equal(out.contests[0].status, 'live');-});--test('get_contest resolves the running round and exposes its leaderboard', async () => {- const { client } = clientReturning(() => jsonResponse(LIVE_FEED));- const tool = buildGetContestTool(client);- const out = (await tool.handler({ contestId: 'rnd_1421' })).structuredContent;- assert.equal(out.ok, true);- assert.equal(out.contest.title, 'Neon Koi');- assert.equal(out.leaderboard.length, 2);- assert.equal(out.recentEntries[0].agent, 'Tide');-});--test('get_contest returns a clean contest_not_found for an unknown id', async () => {- const { client } = clientReturning(() => jsonResponse(LIVE_FEED));- const tool = buildGetContestTool(client);- const res = await tool.handler({ contestId: 'rnd_does_not_exist' });- assert.equal(res.isError, true);- assert.equal(res.structuredContent.error, 'contest_not_found');- assert.equal(res.structuredContent.status, 404);-});--test('get_leaderboard returns ranked entries for the running round', async () => {- const { client } = clientReturning(() => jsonResponse(LIVE_FEED));- const tool = buildGetLeaderboardTool(client);- const out = (await tool.handler({ contestId: 'rnd_1421' })).structuredContent;- assert.equal(out.round, 1421);- assert.equal(out.count, 2);- assert.equal(out.leaderboard[0].rank, 1);- assert.equal(out.leaderboard[0].thumbUrl, 'https://cdn.test/a.png');- assert.equal(out.leaderboard[1].thumbUrl, null); // null preserved, never invented-});--test('upstream HTTP errors are sanitized into a stable envelope', async () => {- const { client } = clientReturning(() =>- jsonResponse({ error: 'feed temporarily unavailable' }, { status: 503 }),- );- const tool = buildListContestsTool(client);- const res = await tool.handler({});- assert.equal(res.isError, true);- assert.equal(res.structuredContent.error, 'upstream_error');- assert.equal(res.structuredContent.status, 503);- assert.match(res.structuredContent.message, /feed temporarily unavailable/);-});--test('network failures are sanitized and never leak internals', async () => {- const { client } = clientReturning(() => {- throw new Error('ECONNREFUSED 10.0.0.1:443 internal stack');- });- const tool = buildGetLeaderboardTool(client);- const res = await tool.handler({ contestId: 'rnd_1421' });- assert.equal(res.isError, true);- assert.equal(res.structuredContent.error, 'network_error');- assert.doesNotMatch(res.structuredContent.message, /ECONNREFUSED|10\.0\.0\.1|stack/);-});--test('an unconfigured base URL fails closed, not with fabricated data', async () => {- const client = new OmniologyClient({ baseUrl: '', fetchImpl: fakeFetch(() => jsonResponse(LIVE_FEED)) });- const tool = buildListContestsTool(client);- const res = await tool.handler({});- assert.equal(res.isError, true);- assert.equal(res.structuredContent.error, 'not_configured');-});--test('submit_entry forwards an authenticated POST and shapes the acceptance', async () => {- const { client, fetchImpl } = clientReturning(() =>- jsonResponse({ entry_id: 'ent_new', status: 'accepted', round: 1421, position: 38 }),- );- const out = await submitEntryCore(client, {- contestId: 'rnd_1421',- entry: { prompt: 'a neon koi' },- agent: 'Reef',- });- assert.equal(out.ok, true);- assert.equal(out.entryId, 'ent_new');- assert.equal(out.position, 38);-- const call = fetchImpl.calls[0];- assert.equal(call.url, `${BASE}/v1/contests/rnd_1421/entries`);- assert.equal(call.init.method, 'POST');- assert.equal(call.init.headers.authorization, 'Bearer secret-token');- assert.deepEqual(JSON.parse(call.init.body), {- entry: { prompt: 'a neon koi' },- agent: 'Reef',- });-});--test('submit_entry rejects a non-object entry before any network call', async () => {- const { client, fetchImpl } = clientReturning(() => jsonResponse({}));- const res = await submitEntryCore(client, { contestId: 'rnd_1421', entry: 'not-an-object' });- assert.equal(res.ok, false);- assert.equal(res.error, 'bad_input');- assert.equal(fetchImpl.calls.length, 0);-});--test('submit_entry surfaces an Omniology rejection as ok:false (cancels payment)', async () => {- const { client } = clientReturning(() =>- jsonResponse({ message: 'round already closed' }, { status: 409 }),- );- const res = await submitEntryCore(client, { contestId: 'rnd_1421', entry: { prompt: 'x' } });- assert.equal(res.ok, false);- assert.equal(res.error, 'upstream_error');- assert.equal(res.status, 409);- assert.match(res.message, /round already closed/);-});diff --git a/pages/arena/omniology.html b/pages/arena/omniology.htmldeleted file mode 100644index 620fd3f65..000000000--- a/pages/arena/omniology.html+++ /dev/null@@ -1,153 +0,0 @@-<!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>Omniology Arena · three.ws</title>- <meta- name="viewport"- content="width=device-width, initial-scale=1, viewport-fit=cover"- />- <meta- name="description"- content="The Omniology Arena — a live 3D venue on three.ws. Walk in as your avatar, meet other players in real time, and watch AI-agent contests unfold on the in-world screens."- />- <meta name="theme-color" content="#060607" />-- <!--- 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), so `npm run dev:walk-all`- still works out of the box. Copied verbatim from pages/play.html.- -->- <meta name="game-server" content="wss://three-ws-multiplayer-93741856042.us-central1.run.app" />-- <!--- Omniology service base URL — the live contest feed + entry-submission API- (CONTRACTS §3). Empty until the partner endpoint is live; prompts 03/04 read- it via src/game/arena/omniology-adapter.js (meta first, then VITE_OMNIOLOGY_BASE).- Leaving it blank keeps the screens/desk in their designed empty states — never- mock data — until the real base lands, which is a config-only change.- -->- <meta name="omniology-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="Omniology Arena · three.ws" />- <meta property="og:description" content="A live 3D venue on three.ws — walk in, meet other players in real time, and watch AI-agent contests on the in-world screens." />- <meta property="og:url" content="https://three.ws/arena/omniology" />- <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="Omniology Arena · three.ws" />- <meta name="twitter:description" content="Step into the Omniology Arena — a live multiplayer 3D venue on three.ws." />- <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 arena visually consistent with the core- worlds and gives every presence label the same treatment. -->- <link rel="stylesheet" href="/src/game/coincommunities.css" />- <style>- /* Arena-only chrome layered over the shared world styles. Kept tiny and- self-contained; the venue HUD (screens, entry desk) arrives in 02–04. */- #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;- 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[data-retry="1"] { cursor: pointer; }- #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: var(--cc-live, #fff);- box-shadow: 0 0 10px rgba(255, 255, 255, 0.85);- animation: arena-pulse 1.8s ease-in-out infinite;- }- #arena-status[data-state="connecting"] .dot { animation: arena-blink 1s ease-in-out infinite; }- @keyframes arena-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }- @keyframes arena-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }- @media (prefers-reduced-motion: reduce) {- #arena-status .dot { animation: none !important; }- }- @media (max-width: 560px) {- #arena-brand small { 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">OMNIOLOGY ARENA</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 arena…</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="" />- Arena<small>Omniology</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>-- <!-- 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/omniology.js"></script>-</body>-</html>diff --git a/pages/home.html b/pages/home.htmlindex 9d20fb923..fa01a3ea2 100644--- a/pages/home.html+++ b/pages/home.html@@ -4975,36 +4975,14 @@for (const [k, v] of Object.entries(AGENT_ATTRS)) el.setAttribute(k, v);return el;}- async function fetchAvatarGlb(id) {- const r = await fetch(`${location.origin}/api/avatars/${id}`);- if (!r.ok) throw new Error('HTTP ' + r.status);- const d = await r.json();- const glb = devProxyGlb(d.avatar?.model_url || d.avatar?.url);- if (!glb) throw new Error('no model url');- return glb;- }- // The curated hero avatar can disappear (deleted, or a fresh deploy whose- // DB row hasn't been seeded yet) — fall back to a real featured avatar so- // the stage is never just an error card.- async function resolveFeaturedGlb() {- const r = await fetch(`${location.origin}/api/avatars/featured?limit=12`);- if (!r.ok) throw new Error('HTTP ' + r.status);- const d = await r.json();- const list = Array.isArray(d.avatars) ? d.avatars : [];- for (const a of list) {- try { return await fetchAvatarGlb(a.id); } catch (_) { /* try next */ }- }- throw new Error('no featured avatar with a model');- }async function bootHeroAvatar() {const heroInner = document.getElementById('hero-stage-inner');try {- let glb;- try {- glb = await fetchAvatarGlb(AVATAR_ID);- } catch (_) {- glb = await resolveFeaturedGlb();- }+ const r = await fetch(`${location.origin}/api/avatars/${AVATAR_ID}`);+ if (!r.ok) throw new Error('HTTP ' + r.status);+ const d = await r.json();+ const glb = devProxyGlb(d.avatar?.model_url || d.avatar?.url);+ if (!glb) throw new Error('no model url');if (heroInner) {heroInner.innerHTML = '';const heroEl = spawnAgent(glb);diff --git a/pages/pump-dashboard.html b/pages/pump-dashboard.htmlindex 14c413fd2..9f7b0b616 100644--- a/pages/pump-dashboard.html+++ b/pages/pump-dashboard.html@@ -1764,61 +1764,6 @@} from '/src/wallet.js';import { emptyStateHTML } from '/src/shared/state-kit.js';- // Some embedded webviews — notably the in-app browsers X/Twitter- // and a few Android wrappers ship — expose `window.localStorage`- // as `null`, or throw on access in private mode. Reading it- // directly during module init crashed the whole page. Route every- // storage call through this shim: it probes the real store once,- // and silently degrades to an in-memory map when it's unavailable- // so the dashboard still loads (config just won't persist).- const safeStorage = (() => {- let store = null;- try {- store = window.localStorage;- const probe = '__twx_probe__';- store.setItem(probe, '1');- store.removeItem(probe);- } catch {- store = null;- }- const mem = new Map();- return {- getItem(key) {- if (store) {- try {- return store.getItem(key);- } catch {- /* fall through to in-memory */- }- }- return mem.has(key) ? mem.get(key) : null;- },- setItem(key, value) {- const v = String(value);- if (store) {- try {- store.setItem(key, v);- return;- } catch {- /* fall through to in-memory */- }- }- mem.set(key, v);- },- removeItem(key) {- if (store) {- try {- store.removeItem(key);- return;- } catch {- /* fall through to in-memory */- }- }- mem.delete(key);- },- };- })();-const PAGE_TITLES = {dashboard: 'Dashboard',feed: 'Live Feed',@@ -1835,16 +1780,16 @@};const state = {- apiUrl: safeStorage.getItem('pumpbot-api-url') || location.origin,- wsUrl: safeStorage.getItem('pumpbot-ws-url') || 'wss://pumpportal.fun/api/data',- apiKey: safeStorage.getItem('pumpbot-api-key') || '',+ apiUrl: localStorage.getItem('pumpbot-api-url') || location.origin,+ wsUrl: localStorage.getItem('pumpbot-ws-url') || 'wss://pumpportal.fun/api/data',+ apiKey: localStorage.getItem('pumpbot-api-key') || '',// Default to the same-origin proxy (/api/solana-rpc), which forwards// to a keyed Helius upstream server-side. The public RPC 403s// browser requests, so we also migrate anyone whose stored value is// that old broken default onto the proxy; genuine custom RPCs are// preserved untouched.rpcUrl: (() => {- const stored = safeStorage.getItem('pumpbot-rpc-url');+ const stored = localStorage.getItem('pumpbot-rpc-url');return stored && stored !== 'https://api.mainnet-beta.solana.com'? stored: '/api/solana-rpc';@@ -1857,7 +1802,7 @@activityCount: 0,feedPaused: false,alertRules: (() => {- const v = safeParseJson(safeStorage.getItem('pumpbot-alerts') || '[]', []);+ const v = safeParseJson(localStorage.getItem('pumpbot-alerts') || '[]', []);return Array.isArray(v) ? v : [];})(),// Deep-link target: /pump-dashboard?agent=<id> (e.g. straight from the@@ -3094,7 +3039,7 @@}const { rules } = await resp.json();state.alertRules = Array.isArray(rules) ? rules : [];- safeStorage.setItem('pumpbot-alerts', JSON.stringify(state.alertRules));+ localStorage.setItem('pumpbot-alerts', JSON.stringify(state.alertRules));setRuleFormSignedOut(false);renderRulesList(state.alertRules);populateAgentOptions();@@ -4211,10 +4156,10 @@state.wsUrl = $('pd-cfg-ws-url').value.trim() || 'wss://pumpportal.fun/api/data';state.apiKey = $('pd-cfg-api-key').value.trim();state.rpcUrl = $('pd-cfg-rpc-url').value.trim() || '/api/solana-rpc';- safeStorage.setItem('pumpbot-api-url', state.apiUrl);- safeStorage.setItem('pumpbot-ws-url', state.wsUrl);- safeStorage.setItem('pumpbot-api-key', state.apiKey);- safeStorage.setItem('pumpbot-rpc-url', state.rpcUrl);+ localStorage.setItem('pumpbot-api-url', state.apiUrl);+ localStorage.setItem('pumpbot-ws-url', state.wsUrl);+ localStorage.setItem('pumpbot-api-key', state.apiKey);+ localStorage.setItem('pumpbot-rpc-url', state.rpcUrl);$('pd-api-endpoint-display').textContent = state.apiUrl;connectApi();// A manual save is an explicit retry — reset the backoff so the newdiff --git a/pages/world/atelier.html b/pages/world/atelier.htmldeleted file mode 100644index 022c9e8b8..000000000--- a/pages/world/atelier.html+++ /dev/null@@ -1,181 +0,0 @@-<!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/public/arena/omniology/LICENSES.md b/public/arena/omniology/LICENSES.mddeleted file mode 100644index 66c563220..000000000--- a/public/arena/omniology/LICENSES.md+++ /dev/null@@ -1,55 +0,0 @@-# /arena/omniology asset provenance--Both files in this directory are synthesised at build time from procedural-geometry / sampled radiance functions — nothing traces back to a third-party-asset, so three.ws holds full copyright and dedicates them to the public-domain under **Creative Commons CC0 1.0 Universal**-(https://creativecommons.org/publicdomain/zero/1.0/). Use, modify, and-redistribute freely; attribution is appreciated but not required.--- [scripts/build-arena-venue.mjs](../../../scripts/build-arena-venue.mjs) →- `venue.glb` (authored via `@gltf-transform/core`)-- [scripts/build-arena-hdri.mjs](../../../scripts/build-arena-hdri.mjs) →- `hdri.hdr` (Radiance RGBE, no third-party samples)--| File | Source | License | Notes |-| ----------- | ------------------------------------------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| `venue.glb` | Authored — primitive geometry assembled via `@gltf-transform/core` | CC0 1.0 | Floor + glowing inlay ring, sealed walls + ceiling cove, three canted contest-screen bays, an entry desk. Every anchor in the `src/game/arena/arena-venue.js` contract is present (`spawn_01`, `screen_01..03`, `desk_01`, `light_*`, `camera_intro`). |-| `hdri.hdr` | Authored — radiance functions sampled into Radiance RGBE | CC0 1.0 | 128×64 equirectangular. Cool blue hemisphere + warm entry key glow + cyan/magenta/amber contest-wall band + ceiling cove sheen. Tuned for PBR reflections (`scene.environment`) only — the background stays the dark arena fog colour. |--## The named-anchor contract--The only thing the runtime depends on inside `venue.glb` is the set of named-empties enumerated in-[src/game/arena/arena-venue.js](../../../src/game/arena/arena-venue.js)-(`ARENA_REQUIRED_EMPTIES`). The loader runs `collectArenaEmpties()` which-throws a named error if any anchor is missing — there is no silent fallback.-Underscore names (`screen_01`, not `screen.01`) survive three.js's-`PropertyBinding.sanitizeNodeName`; mirror that convention in any replacement.--## Upgrading to artist-authored assets--Drop a richer `venue.glb` / `hdri.hdr` into this directory (e.g. a hand-modelled-GLB + a Polyhaven CC0 HDR) and the page picks it up on next load — provided the-GLB still exposes every `ARENA_REQUIRED_EMPTIES` anchor with underscore names.-Update this file with provenance for each replacement before committing:--```markdown-### `venue.glb`--- **Source**: https://example.com/asset-page-- **Author**: Studio name-- **License**: CC0 1.0 (or SPDX identifier)-- **Modifications**: named-empty injection, draco compression, ...-```--## Regenerating the procedural baseline--```sh-npm run build:arena-venue # → venue.glb-npm run build:arena-hdri # → hdri.hdr-npm run build:arena-assets # → both, in one shot-```--Output is deterministic — the same builder code produces byte-identical files —-so committed assets only change when a builder script changes.diff --git a/public/arena/omniology/hdri.hdr b/public/arena/omniology/hdri.hdrdeleted file mode 100644index 6929d309c..000000000--- a/public/arena/omniology/hdri.hdr+++ /dev/null@@ -1,7 +0,0 @@-#?RADIANCE-# Authored by three.ws build-arena-hdri (CC0 1.0)-FORMAT=32-bit_rle_rgbe-EXPOSURE=1.0---Y 64 +X 128-�Y9��X8���n���l��i��e�ܚk�כt�ҝ�̟��ơ������������������ˀ��Ӏ��ـ��ހ��ပ������݀��׀{�πs�ŀk���bw��Xl��Oa�����u��ay�Mb�u��~Rj�~c��}Hd�}Gc�}Gc�}Fc�}Fc�}Fc�}Fc�}Fc�}Fc�}Gc�}Gc�}Nk�}F\�~h��~FY�Xp�k��~��H[��Qf��Yp��ay��g���l�Ȁp�πs�Ԁt�׀t�׀s�Ԁp�πl�Ȁg���ay��Yp��Qf��H[��~��l��Xp�FY�h��~F\�~Nl�}Gc�}Gc�}Fc�}Fc�}Fc�}Fc�}Fc�}Fc�}Gc�}Gc�}Hd�}c��}Rj�~u��~Mb�ay�u�����Oa��Xl��bw��k���s�ŀ{�π��׀��݀������‚�ဟ�ހ��ـ��Ӏ��ˀ��������������ơ��̟��ҝ�כt�ܚk��e��i���l���n��X8��Y9��d?��c?��b>��_<��\:��X8���v�쯊�尖�ޱ��ײ��д��ɵĀö��������怫�뀦�퀟��쀒�耋� �ڀz�πq�Àg}��]r��Sf��HY��{��f�Qf�z��~Um�~e��}Hd�}Gc�}Gc�}Gc�}Fc�}Fc�}Fc�}Gc�}Gc�}Hc�}Hc�}Pl�}I^�~m��~I]�]u�q�����L_��Vk��^v��f��m�Ȁr�Ӏv�ڀy�߀{��{��y�߀v�ڀr�Ҁm�Ȁf���^v��Vk��L`�����q��]v�I]�m��~I_�~Qn�}Hd�}Hd�}Gc�}Gc�}Fc�}Fc�}Fc�}Gc�}Gc�}Gc�}Hd�}e��}Um�~z��~Qf�f�{��HY��Sf��]r��g}��q�Àz�π��ڀ��‒�耙�쀟��퀫�뀱�怷�����öɵĀд��ײ��ޱ��尖�쯊���v��X8��\:��_<��b>��c?��d?��pF��oE��mD��jC��g@��b>��aA��aF��aK��¡����¹���Ā��π��ڀ�����뀾�������������������쀉� �v�ˀl���bw��Vj��K]�����j��Ti�~��~Wp�~g��}Hd�}Hc�}Gc�}Gc�}Gc�}Gc�}Gc�}Hc�}Hc�}Ic�}Kd�}Tn�}La�~r��~M`�bz�w��FW��Pd��Zp��c{��k�ŀr�Ҁx�܀|���ꀀ�퀀����|��x�܀r�рk�Āc|��Zp��Qd��FX��x��b{�Ma�r��~Mb�~Tp�}Ke�}Je�}Hd�}Hc�}Gc�}Gc�}Gc�}Gc�}Gc�}Hc�}Hd�}g��}Wp�~~��~Ti�j�����K]��Vj��bw��l���v�ˀ����〒�쀚��������������������������ڀ��π��Ā�¹����¡��aK��aF��aA��b>��g@��jC��mD��oE��pF��}M��|L��zK��vI��rG��mD��kG��kL��jQ��jV��i\��ib���π��ڀ������������������]c��Ya������������뀆�߀{�рp�e{��Zm��N`�����m��Vl����~Yr�~h��}Id�}Hc�}Gc�}Gc�}Gc�}Gc�}Hc�}Ic�}Kc�}Md�}Oe�}Zp�}Qd�~y��~Rc�h~�~��JZ��Uh��_t��h���p�w�ۀ}�态�����������}��w�ـp�̀h���_u��Ui��J[����h��Re�z��~Rf�~[t�}Ph�}Mf�}Ke�}Id�}Hc�}Gc�}Gc�}Gc�}Gc�}Hc�}Id�}h��}Yr�~���~Vl�m�����N`��Zm��e{��p�{�р��߀��뀙�������Ya��]c����������������������ڀ��π�ib��i\��jV��jQ��kL��kG��mD��rG��vI��zK��|L��}M�ΊT�̉S�ȆR�ÃP��~M��xJ��vM��uQ��tV��s\��ra��qg��pl��or������������kk��gi��bg��]e��Yb��T_��������������րt�ƀh~��\p��Pb�����p��Xn����~[t�~i��}Id�}Hc�}Gc�}Gc�}Hb�}Hc�}Jc�}Ld�}Nd�}Rf�}Wg�}ds�}Yg�~���~Xg�o�����O^��Zk��dy��m�ǀv�ր}�䀂��������FW�����������������}��v�Ӏn�d{��Zn��O`�����p��Yj����~Zl�~f{�}Xm�}Sj�}Oh�}Lf�}Jd�}Hd�}Hc�}Gc�}Gc�}Hc�}Id�}i��}[t�~���~Xn�p�����Pb��\p��h~��t�ƀ�ր��䀔�������T_��Yb��]e��bg��gi��kk������������퀁or��pl��qg��ra��s\��tV��uQ��vM��xJ��~M�ÃP�ȆR�̉S�ΊT��[���Z�ۓY�ՏW�͊T�ăP���S��W��}\��{a��zf��xk��wq��uv��tz�����vq��qo��km��fj��ah��\e��Wa��������耂�ـv�ɀj���^r��Qc�����q��Zp����~\u�~j��}Id�}Hc�}Hc�}Hb�}Ic�}Jc�}Md�}Pe�}Uf�}\h�}dk�}vy�}dk�~IO�ak�y��IR��Ua��`o��k}��t�Ѐ|�ဃ����FX��HZ��I[��I\��H[�������������}�ڀu�ɀk���as��Ve�����{��bq����~fs�~x��}fu�}]p�}Vl�}Qh�}Mf�}Jd�}Id�}Hc�}Hc�}Hc�}Id�}j��}\u�~���~Zp�q�����Qc��^r��j���v�ɀ��ـ��耘���Wa��\e��ah��fj��km��qo��vq�������tz��uv��wq��xk��zf��{a��}\��W���S�ăP�͊T�ՏW�ۓY���Z��[���b��a��`��]�ߕZ�ՎV�̋X�ĉ\���a���f���j��o��}t��{y��x}��v��|t��ur��op��im��dj��^f��Yb��S^��������逄�ۀx�ʀk���_s��Rd�����r��Zp����~\u�~k��}Id�}Hc�}Hb�}Ib�}Jc�}Mc�}Qe�}Xg�}`i�}km�}yq�}���}vq�~TS�np����QV��^e��it��t�ʀ}�݀��퀌���HY��J\��L_��L`��La��L`��K^���������~�Ѐu���k{��_l��������pz����~y�~���}}��}nz�}br�}Ym�}Ri�}Nf�}Kd�}Ic�}Hc�}Hc�}Id�}k��}\u�~���~Zp�r�����Rd��_s��k���x�ʀ��ۀ��逛���S^��Yb��^f��dj��im��op��ur��|t���v���x}��{y��}t��o���j���f���a�ĉ\�̋X�ՎV�ߕZ��]��`��a���b��X4��W4��U3���d��`��\�ە^�Ғa�ɏe���j���n���s���w��{��}��z���w��yt��sr��ln��fk��`g��Zc��T^��������逄�ڀx�ʀl���_r��Rd�����r��Zp����~\u�~k��}Jc�}Ic�}Ib�}Jb�}Mc�}Rd�}Yg�}cj�}qn�}�t�}�{�}^G�~�z�~dY��v����][��kk��w{Ā��ڀ�����LY��N^��Ob��Pe��Qg��Qg��Qg��Pe��Na��������쀌�ـ��Āy���mv��_e�����������~���~Ĵ�}���}���}u}�}ft�}[n�}Si�}Nf�}Kd�}Ic�}Ic�}Jd�}k��}\u�~���~Zp�r�����Rd��_r��l���x�ʀ��ڀ��逝���T^��Zc��`g��fk��ln��sr��yt���w���z���}��{���w���s���n���j�ɏe�Ғa�ە^��\��`���d��U3��W4��X4��]8��\7��[6��X5���f��b��c�ߚf�Ֆj�ʒm���q���u���y���}������}���y��|v��us��no��gk��ag��[c��������瀄�x�Ȁk���^q��Qc�����q��Yo����~[t�~j��}Jc�}Jb�}Jb�}Mc�}Rd�}Yf�}ej�}uo�}�v�}T?�~fE�~~R�~]C�|`����_P��oa��}s����ڀ���NR��RZ��T`��Vf��Wk��Wn��Xp��Xq��Xp��Wn��Wk��Uf��������倘���������rr��ľ�����w����~�op~Ը�}���}���}x�}gu�}[m�}Rh�}Me�}Kd�}Jc�}Jc�}j��}[t�~���~Yo�q�����Qc��^q��k���x�Ȁ����瀝���[c��ag��gk��no��us��|v���y���}��������}���y���u���q�ʒm�Ֆj�ߚf��c��b���f��X5��[6��\7��]8��b:��b:��`9��]7��Z5��V3���g��j���m�Ԙp�Ȕs���w���z���}������~���z��w��ws��oo��hk��ag��Zb��������� �Ԁv�Āi}��]o��Pa�����o��Xm����~Zr�~j��}Jc�}Jb�}Lb�}Qc�}Xe�}di�}un�}�v�}X@�~nG�~�P�~�`�~yL��k�cG��vX���k���}ހ����XQ��\Z��^c��`j��`q��aw��a{��a}��a��a~��b|��bx��bs��`m��������܀�������������ε�������~��|~�rk~���}���}���}y�}fs�}Yl�}Qg�}Me�}Kc�}Kc�}j��}Zr�~���~Xm�o�����Pa��]o��i}��v�Ā��Ԁ��“����Zb��ag��hk��oo��ws��w���z���~��������}���z���w�Ȕs�Ԙp���m��j���g��V3��Z5��]7��`9��b:��b:��g=��f<��d;��a:��^8��Y5��W5���m��p�ܝr�Ϙu�x���z���}���������{���v��wr��on��hi��`e��������耍�܀��t���gz��[l��N^�����m��Vj����~Yp�~i��}Kb�}Lb�}Oc�}Vd�}ag�}rm�}�u�}X@�~qH�~�R�~�_�~v:��Y�g=��P���cÀ�x�^F��eQ��j[��ne��oo��px��o�Łn�Ɂn�ˁm�ʁn�ǁo���p���q���r���r��qw�������ҀIJ��������~��md�ح���m���~Òw~�wl~���}���}���}u|�}cq�}Wj�}Pf�}Ld�}Kc�}i��}Yp�~���~Vj�m�����N^��[l��gz��t�������܀��耦�����`e��hi��on��wr���v���{�����������}���z�x�Ϙu�ܝr��p���m��W5��Y5��^8��a:��d;��f<��g=��j?��i>��g=��e<��a9��\7��Y7���p��q��s�ԛu�Ǖx���z���|���~����z���u��wp��nl������������ꀖ�����Ԁ}�ƀp���dv��Xi��L[�����i��Sg�}��~Wm�~h��}Lb�}Nb�}Sc�}\f�}lj�}�r�}U>�~oG�~�R�~�`�~|:��G��i��G���\ŀ�r�kD��vP��~\���h���tʁ�Ձ��ށ��偁����~���偀�݁��ҁ��Ł�����������������ws���ƀἧ�ȡ����n��kT�ߣz�vQ�]Cʕw~�wk~���}���}���}ox�}^n�}Th�}Ne�}Lc�}h��}Wm�~}��~Sg�i�����L[��Xi��dv��p���}�ƀ��Ԁ������ꀰ���������nl��wp���u���z������~���|���z�Ǖx�ԛu��s��q���p��Y7��\7��a9��e<��g=��i>��j?��m@��l@��j?��g=��c;��_8��[8��X9���r��t�؝u�ʖw���x���z���{��~|��x}����������������逞�����ր��ˀx���l}��`q��Td�����{��e{�Pc�y��~Tj�~g��}Mb�}Pb�}Wd�}eg�}{n�}�x�}hD�~�O�~�^�~}9��F��X��?���TĀ�k�yB���O���\���jρ�xၣ�������PP��NV��L[��J`��Jb��Jd��Kd�������Ё������������������n��r]��Ę�ۤz���^��gE�ߗ^�wM�]Cƒu~�sh~ٷ�}���}��}gs�}Yj�}Qf�}Md�}g��}Tj�~y��~Pc�e{�{�����Td��`q��l}��x�����ˀ��ր������逺������������������x}��~|���{���z���x�ʖw�؝u��t���r��X9��[8��_8��c;��g=��j?��l@��m@��oA��nA��l?��i>��e<��`9��]9��Y9���r��s�ڝt�˖u���v���w���w��{x��vx�������������逵�䀦�݀��Հ��ˀ���s���gw��\k��P_�����u��`u�M^�t��~Rf�~f��}Na�}Sb�}]e�}oj�}�r�}]@�~~J�~�Y�~w7��D��U��6���K���c�?���M���\Ɂ�k��{��cF��cN��bV��_^��\e��Zl��Wq��Vt��Wv��Yw��\v��_s�����������м��˭����|���h��wU��dD��j���O��`7�ߕY�tK���~��p~�jd~¨�}���}rx�}_m�}Tg�}Od�}f��}Rf�~t��~M^�`v�u�����P_��\k��gw��s��������ˀ��Հ��݀�����������������vx��{x���w���w���v�˖u�ڝt��s���r��Y9��]9��`9��e<��i>��l?��nA��oA��oA��nA��l@��i>��e<��a9��]9��Z9���q��r�ڜr�ʔr���r���s��s��xs��rs�������������܀��׀��р��ɀ����y���m|��bq��We��������o��[o�IY�n��~Ob�~e~�}Oa�}Vb�}cf�}zl�}�w�}mE�~�R�~�d�~�?��P��3���A���Y瀈:���I���Yс�j��p>��uG��xQ��x[��ud��qn��mv��i~��f���e���e���h���l���q���v���������ځ�߾��Τ�캋�ۥt�ŏ`��yM��c<��Z��v@��\3�ӍT�jG�x~�yi~伾}���}~�}ep�}Wh�}Pd�}e��}Ob�~n��~IY�[o�o��������We��bq��m|��y���������ɀ��р��׀��܀���������倆rs��xs��s���s���r�ʔr�ڜr��r���q��Z9��]9��a9��e<��i>��l@��nA��oA��oA��nA��l@��i>��e<��a9��]8��Y8���p��o�ؚo�Ȓo���n���n��{n��tm��nm�����րǺӀ��π��ɀ��À����~���r~��gt��\i��R_�����{��h}�Vh����~i��~K^�~c{�}Q`�}Yb�}jg�}�o�}Z>�~~I�~�Y�~~8��H��]��<���MԀ�4���C���Tс�f��|=���G���R���]���hł�s�~Ղ�ڂz�܂v�ۂt�u�тx�ǂ}�����������������{���k��x\��mN��aA��k�ΏV��uC��]3�ݏI��n:���_�}M�]A��o~�ib~���}���}mt�}[j�}Rd�}d}�}K^�~i��~���~Vh�h}�{�����R_��\i��gt��r~��~���������À��ɀ��πǺӀ��ր���nm��tm��{n���n���n�Ȓo�ؚo��o���p��Y8��]8��a9��e<��i>��l@��nA��oA��n@��m@��k?��h=��d;��_8��[7��X7���m��l�Ԗk�Ďj���j��~i��wh��pg���̀��ˀѻȀ��ŀ����������������v��ku��`l��Vb��������s��at�Pa����~cz�~HY�~ax�}R`�}]b�}qh�}�r�}eA�~�N�~�a�~�>��Q��5���E���Y���;���Lȁ�_�:���E���P���\Ƃ�iՂ�u႞�나�������������삈�ႎ�҂����������������w���f��}V��pH��a;��_�ˈJ��l9��S*�ȀA��a4�ېT�jEٛu~�se~Ӱ�}���}tx�}^k�}Sd�}bz�}HZ�~cz�~���~Pa�at�s��������Vb��`l��ku��v��������������������ŀѻȀ��ˀ��̀�pg��wh��~i���j�Ďj�Ԗk��l���m��X7��[7��_8��d;��h=��k?��m@��n@��k?��j>��h=��e<��b:��]7��Y6���k��i�ޚh�Βg���f���d��yc��qb��ja�����ۻ��ǰ������������������z~��nu��cl��Yc��������{��j~�Zl�JZ�x��~]r�~DU�~`t�}S_�}`b�}vi�}�t�}nD�~�R�~s4��D��Y��;���M�2���B���T���5���@���L���Xʂ�f݂�s킶���XH��UO��QV��M[��J`��Id��If��������肧�Ղ������������ç����o���]��}N��m@��\3��Q��z>��^.��H��m9���[�vI��y~�}h~缹}���}z{�}bl�}Td�}`w�}EU�~]s�~x��~JZ�Zl�j~�{��������Yc��cl��nu��z~������������������ǰ��ۻ�������ja��qb��yc���d���f�Βg�ޚh��i���k��Y6��]7��b:��e<��h=��j>��k?��h=��g=��e<��b:��_8��Z6��V4���g��e�֔d�njb���`��{_��s]��l\��ɵ�弲�а������������������}}��qt��fl��\c�����������q��as�Sc����~o��~Vk�~���}]q�}T^�}bb�}{i�}�v�}vE�~�V�~}7��H��0���@���S쀙6���GŁ�[���9���E���Qł�_ۂ�m��d>��cF��`M��\U��W\��Sc��Ph��Nl��On��Qo������������ʷ�����Ե��ҧv�ʘc���S��vD��e7���V�φB��h2���M��x=��X0��M�\?��j~�ź}���}}�}dm�}Ud�}^t�}���}Wk�~o��~���~Sc�as�q�����������\c��fl��qt��}}������������������а��弲��ɵ��l\��s]��{_���`�njb�֔d��e���g��V4��Z6��_8��b:��e<��g=��h=��d;��c:��a9��^8��[6��W3���d��b�ܖ`�͎^���]��}[��uY��mW��eU�ァ�ذ��ã���������������{��tr��hj��������������v��gx�Yi�KZ�~��~f}�~Pc�~{��}[m�}T]�}ca�}~i�}�v�}|F�~�X�~�9��K��2���C���X���9���KЁ~0���;���H���Uς�c��r��jA��iI��eQ��aY��[a��Wg��Tm��Rq��St��Ut��Yt�������ׂ�վ��ʦ�ྏ�ްz�֠g�ȏV��}F��j9��X-�܍E��n4��T(��?��]1�ˆO�`@��k~�f]~���}�~�}em�}Uc�}\p�}{��}Pd�~f}�~~��~KZ�Yi�gx�v��������������hj��tr���{��������������ã��ذ��ァ��eU��mW��uY��}[���]�͎^�ܖ`��b���d��W3��[6��^8��a9��c:��d;��_8��^7��\6��Z5��V3���b��_�ޖ]�ю[�Y��~W��vU��nS��fQ�����ᰚ�ʣ���������������y��vp�����������������y��kz�]l�Q_����~r��~^r�~J\�~s��}Xi�}S[�}c`�}h�}�v�}~G�~�X�~�:��M��3���D���-���;���MՁ�1���<���I���Vӂ�e�k:��lB��kJ��gR��bZ��]b��Xi��Uo��Ss��Tu��Vv��[v�������ق�����Ψ����{�ۣh�͒V��G��m9��Z-��F��q5��W)�͂@��_2�щO�b@Ìk~�f]~���}�~�}el�}Tb�}Ym�}t��}K\�~^s�~r��~���~Q_�]l�kz�y�����������������vp���y��������������ʣ��ᰚ������fQ��nS��vU��~W�Y�ю[�ޖ]��_���b��V3��Z5��\6��^7��_8��Y5��Y4��W3���d���a��]�ޔZ�эX�ĆU��~S��vQ��nN��fL��_J�诐�Ѣ���������������w}�������������������{��my�`m�Ta����~|��~h~�~Ui�~EU�~l��}Uf�}RZ�}a^�}}f�}�t�}|F�~�W�~�9��L��3���D���Y���:���LӁ�0���;���H���Uт�c��r��kA��iI��fQ��aY��\`��Wg��Sm��Rq��Rt��Uu��Zt�������Ղ�ս��˥�⿎��y�١f�ːT��~E��k8��Y,���E��p4��V)�ˁ?��^2�ψN�a?��i~�e[~���}�|�}cj�}S`�}Vi�}m��}EU�~Ui�~h~�~|��~���~Ta�`m�my�{���������������������w}�������������Ѣ��诐��_J��fL��nN��vQ��~S�ĆU�эX�ޔZ��]���a���d��W3��Y4��Y5���c���b���`��^��[�ڑW�ϊT�ÄR��|O��uM��mK��fH��^F�����֡�������{��~w��tt�������ķ����������|��nw�bl�Va����~���~o��~^r�~N_�~~��}e}�}Rb�}OX�}^\�}yd�}�q�}xD�~�U�~�7��I��1���A���V�8���Iʁ�\���9���D���Qǂ�^ނ�l�f>��eE��aM��\U��W\��Sb��Oh��Nl��Nn��Qo�����������˂�˳���ض��֩s�Ϛ`�P��xB��g5��U*�։B��k2��R'��|=��[0�ǃL�]=��f~�IJ}���}}x�}ag�}Q^�}Re�}f�}��}N`�~^r�~o��~���~���~Va�bl�nw�|�����������ķ��������tt��~w���{����֡�������^F��fH��mK��uM��|O�ÄR�ϊT�ڑW��[��^���`���b���c��\��[��Y�ےW�ӍT�ɆP���N��zL��sI��lG��dD��]B���ڠ{�ēw���s��|o��rk�������Ʊ����������|�ot�bj�W`����~���~t��~dw�~Ug�~GW�~t��}_v�}N^�}MV�}ZY�}s`�}�m�}pA�~�P�~x4��E��[��=���P〓4���C���U灆4���?���J���W͂�d߂�q��ZG��UN��QU��LZ��I_��Hc��Hf������ェ�Ђ�û�����IJ��Ǩ|�Ɯi���Y��J��o=��_1��N��=��c/��I��s9��T-��zH��u~�~b~캬}���}wt�}\d�}N[�}Na�}_w�}t��}GW�~Ug�~dw�~t��~���~���~W`�bj�ot�|����������Ʊ��������rk��|o���s�ēw�ڠ{����]B��dD��lG��sI��zL���N�ɆP�ӍT�ےW��Y��[��\�ԍT�ҌT�ΉR�ɆP���M��{J��uH��oE��iC��bA��\>��x�s�Ƒo���k��zg��pc��;⼷Ȭ����������|z�np�bg����~���~���~w��~gz�~Yk�~L]�~���}j��}Xn�}JZ�}IS�}UV�}l]�}�h�}g=�~�K�~�`�~�?��S��7���H̀�/���<���Lρ�]���8���B���M���Yǂ�eՂ�q���~邘����������傅�ق��ʂ������������������n���^��O��qB��c6���X�؍G��r7��Y+�؉C��g5��S�nC�n~�t]~�}���}on�}W`�}JX�}K]�}Xp�}k��}���}L]�~Yk�~gz�~w��~���~���~���~bg�np�|z����������Ȭ�⼷�;�pc��zg���k�Ƒo�s��x��\>��bA��iC��oE��uH��{J���M�ɆP�ΉR�ҌT�ԍT���M��L��}K��yI��uG��pD��jA��e?��_=��Y;��q�ښl�Ǝh���c��w_��m[��Ȱ㷩ʧ����������|u�nl����~���~���~���~x��~iy�~\l�~O_�~���}t��}b{�}Rg�}FW�}FQ�}PS�}cY�}�c�}�r�}�E�~�W�~�8��J��1���?���R倐4���B���Qց�a���9���C���M���W���b���mɂ�xς|�҂u�ӂp�҂n�͂o�Ƃr���y����������������o���_��xQ��mD��b9���^�ےM��z>��b1��K��w<��Z/�˅L�a=ɍf~�hX~���}�|�}fh�}R\�}FU�}GY�}Ri�}b{�}t��}���}O_�~\l�~iy�~x��~���~���~���~���~nl�|u����������ʧ�㷩�Ȱ�m[��w_���c�Ǝh�ښl��q��Y;��_=��e?��jA��pD��uG��yI��}K��L���M��sF��rE��pD��mB��i@��e=��`;��[9���n��j�Օe�Êa��]��tY��jU��aQ�䲛ʢ��������{����~���~���~���~���~���~w��~iw�~]k�~Q`�~���}z��}i��}Yq�}La�}BS�}BN�}JP�}ZU�}u]�}�j�}q?�~�N�~�c�~�@��S��6���E���X�7���D���QЁ�`�s8��w@��yI��wR��r[��md��gl��at��^z��\��\���_���d���k��������ԁ�乁�נ��Lj���s��`�ЏO��zA��f4���S�ʂA��d4��S�qC�o~�{^~}���}yr�}]a�}LW�}���|CU�}Mb�}Yr�}i��}z��}���}Q`�~]k�~iw�~w��~���~���~���~���~���~���~�{�������ʢ�䲛�aQ��jU��tY��]�Êa�Օe��j���n��[9��`;��e=��i@��mB��pD��rE��sF��g?��f>��d=��a;��^9��Z7���j��g�ޘc�Ύ_���Z��zV��pR��gO����㬏ɝ������}�vw���~���~���~���~���~���~v~�~hs�~\h�~Q^�~���}}��}m��}_w�}Ri�}G[�}?P�}>L�}EM�}QQ�}gW�}�b�}�r�}�E�~�V�~�7��F��Z��9���Iƀ�Z�7���B���N���Zԁ�h��u��_B��\I��XP��SW��N]��Kb��Jf��Jh��������끬�ׁ��������ɸ��ͭ��̡o�œ^���N��sA��c5���W�͆E��j7���X�}H�^;Ȍd~�iV~Ƞ�}�~�}jh�}���|���|}��|?Q�}G\�}Ri�}_x�}m��}}��}���}Q^�~\h�~hs�~v~�~���~���~���~���~���~���~�vw��}���ɝ�㬏����gO��pR��zV���Z�Ύ_�ޘc��g���j��Z7��^9��a;��d=��f>��g?��[8��Z7��X6��V5���g��b�ߗ_�ҏ[�ĆX��~T��uP��lM��cI����ߦ�Ǘ~��x�}r�qm���~ּ�~���~���~���~���~sx�~fn�~[e�~Q\�~���}~��}p��}bz�}Vm�}Ka�}BV�}w��|u��|@J�}IM�}ZR�}uZ�}�f�}m<�~�J�~�\�~�:��I��\��:���H���W�z4���=���G���Q���\���gˁ�rӁ�~ف��܁z�ށu�܁s�ׁt�Ёx�Ł~�����������������v���f��}W��sJ��g>��Z4��V�ÁF��i9���[ƃJ�e>ݙh~�tY~属}���}yp�}���|���|���|v��|w��|BW�}Ka�}Vm�}bz�}p��}~��}���}Q\�~[e�~fn�~sx�~���~���~���~���~ּ�~���~�qm�}r��xǗ~ߦ�����cI��lM��uP��~T�ĆX�ҏ[�ߗ_��b���g��V5��X6��Z7��[8��c��b��`���^�ؒ[�W�ÄT��}Q��vN��nJ��fG��^C��ٟzt��n�xi�md�ſ~ӳ�~���~���~���~�}�~qr�~di�~Y`�~���}���}~��}p��}cz�}Xo�}Nd�}FZ�}>Q�}p��|o��|v��|BJ�}OM�}bS�}�\�}�j�}v?�~�L�~�^�~�:��H��[��8���C���Pɀ�^��l��p>��rF��pN��lW��g_��ag��\n��Yt��Wx��X{��Z|��_|�����������̀�ٴ��̝���s�לa�ĉQ��vD��c8��\��J�f>�j~�z[~���}���}�w�}���|���|���|w��|o��|q��|>R�}FZ�}Nd�}Xo�}cz�}p��}~��}���}���}Y`�~di�~qr�~�}�~���~���~���~ӳ�~�ſ~�md�xi��ntٟz��^C��fG��nJ��vN��}Q�ÄT�W�ؒ[���^��`��b��c�͊W�ˉV�LJU�S��~P��yM��sJ��mG��fD��`A���}�vіq��k�~f�r`�h\뼯~ϫ�~���~���~���~}v�~nl�~���}���}���}���}{��}o��}cx�}Yn�}Pe�}G\�}@T�}t��|k��|i��|n��|x��|EI�}SM�}iT�}�^�}�l�}z@�~�M�~�]�~�9��F��U�w3���<���F���Q���\ɀ�h׀�t„�뀖�����������������者�܀��������������������u���e���W��sJ��e?���jדX�yI�a=ߛh~�zZ~�aP~���}�|�}���|���|���|z��|o��|i��|k��|u��|@T�}H\�}Pe�}Yn�}cx�}o��}{��}���}���}���}���}nl�~}v�~���~���~���~ϫ�~뼯~�h\�r`�~f��kіq�v��}�`A��fD��mG��sJ��yM��~P�S�LJU�ˉV�͊W��wL��vK��tJ��qH��mF��hC��cA��^>���x�rٙmƍh��b�w]�lY�cT䳠~ʣ�~���~���~�z�~���}���}���}���}���}���}x��}l~�}bu�}Xl�}Pd�}H\�}BU�}w��|n��|f��|d��|g��|n��|z��|GH�}VM�}mT�}�]�}�k�}w>�~�J�~�X�~x5��@��L��Y��g�p;��tC��uK��tS��p\��kd��el��`t��]y��[~��\���^���c���i������������֭�Ȗ���ޥpʒ`�~R�kE��v~̐d~�uX~���}���}�}�}���|���|���||��|o��|h��|d��|f��|n��|x��|BU�}H\�}Pd�}Xl�}bu�}l~�}x��}���}���}���}���}���}���}�z�~���~���~ʣ�~䳠~�cT�lY�w]��bƍhٙm�r��x�^>��cA��hC��mF��qH��tJ��vK��wL��fB��eA��c@��a?��]=��Y;���q�mٗhɍd��_�yZ�oV�fR���~۩�~�~���~�~�ty~���}���}���}���}���}���}u��}ix�}_p�}Vh�}Oa�}H[�}BU�}y��|o��|g��|a��|_��|a��|f��|n��|{��|HG�}WL�}lR�}�[�}�g�}n;�~�E�~�Q�~�`�~u8��A��K��U��_��k��v�����������������������������������������~��n��a�tT�gI��~Ԛn~��`~�jS~簖}���}�z�}���|���|���|}��|o��|f��|b��|_��|a��|g��|o��|y��|BU�}H[�}Oa�}Vh�}_p�}ix�}u��}���}���}���}���}���}���}�ty~�~���~�~۩�~���~�fR�oV�yZ��_ɍdٗh�m��q�Y;��]=��a?��c@��eA��fB���r��q��o�m�jܘfБbĉ_��[�xW�pS�gO�_K讎~П�~���~��z~�xt~�mo~���}ɶ�}���}���}���}~��}qz�}fr�}\k�}Td�}M^�}GX�}AS�}x��|p��|h��|b��|]�|[|�|\|�|_}�|d~�|m��|z��|���|TJ�}gO�}W�}�a�}�m�}t?�~�I�~�T�~�_�~�l�~h=�lD�mK�lS�iZ�eb�`i�\o�Yt�Wx�X{�Z|�^{�cy����~���~���~�η~���~ܲ�~�~��q~�d~�nY~���}ɞ�}���}�s{}���|���|���||��|n��|e��|`�|\}�|[}�|]�|b��|h��|p��|x��|AS�}GX�}M^�}Td�}\k�}fr�}qz�}~��}���}���}���}ɶ�}���}�mo~�xt~��z~���~П�~讎~�_K�gO�pS�xW��[ĉ_Бbܘf�j�m��o��q��rӒbёa͎`Ȋ^��[��X�zU�tR�mO�fK�_H~١�~Ô|~��v~�|p~�qk~���}ۼ�}¬�}���}���}���}y|�}mt�}bl�}Ye�}Q_�}KZ�}EU�}��|w��|o��|h��|b��|]�|Yz�|Wx�|Xx�|Zx�|]y�|b{�|j}�|v��|���|OG�}^L�}qR�}�Z�}�e�}�q�}k@�~xG�~�O�~�X�~�a�~�j�~�t�~�~�~���~���~|��~x��~w��~w��~z��~��~���~���~���~���~���~��z~�{n~�qc~�̳}ⶣ}Š�}���}�x|}���|ú�|���|���|y��|l��|c�|]|�|Zz�|Xy�|Wy�|Yz�|]�|b��|h��|o��|w��|��|EU�}KZ�}Q_�}Ye�}bl�}mt�}y|�}���}���}���}¬�}ۼ�}���}�qk~�|p~��v~Ô|~١�~~�_H�fK�mO�tR�zU��X��[Ȋ^͎`ёaӒb�zT�yT�wR�tQ�pO�lL�gJ�aG���~���~ڠ}~ǔw~��r~�~l~�sg~�ic~���}а�}���}���}���}�~�}tu�}hm�}^f�}V`�}N[�}���|���||��|t��|m��|g��|a��|]~�|Yz�|Uv�|Tt�|Tt�|Ut�|Wu�|Zv�|_w�|fy�|q}�|��|���|SG�}aL�}pS�}�[�}�d�}�m�}�w�}\A�~_G�~aM�~`S�~^Y�~[^�~Wd�~Ti�~Rm�~Qp�~Qr�~Sr�~Vr�~Zp�~���}���}���}���}ǹ�}���}���}���}���}�w~}���|ɼ�|���|���|���|s��|h��|`|�|[x�|Wv�|Uu�|Tu�|Tu�|Uv�|Yz�|]~�|a��|g��|m��|t��||��|���|���|N[�}V`�}^f�}hm�}tu�}�~�}���}���}���}а�}���}�ic~�sg~�~l~��r~ǔw~ڠ}~���~���~�aG�gJ�lL�pO�tQ�wR�yT�zT�fH�eH�cG�aF�^D���~�~�{~Ӛv~Đr~��m~�}h~�sd~�j_~�ö}۴�}ĥ�}���}���}���}|w�}on�}dg�}Za�}���|���|���|���|x��|p��|j��|d��|`��|[|�|Xx�|Uu�|Rr�|Qq�|Qq�|Rq�|Sq�|Tq�|Wr�|[s�|au�|ix�|t{�|���|���|RG�}\L�}eQ�}oW�}w]�}}d�}�k�}�r�}�y�}���}|��}x��}u��}s��}q��}r��}t��}w��}{��}���}���}���}���}���}�}�}{u�}���|���|���|���|���|���|v��|k��|c{�|\w�|Xu�|Us�|Sr�|Rq�|Qq�|Qq�|Rr�|Uu�|Xx�|[|�|`��|d��|j��|p��|x��|���|���|���|���|Za�}dg�}on�}|w�}���}���}���}ĥ�}۴�}�ö}�j_~�sd~�}h~��m~Đr~Ӛv~�{~�~���~�^D�aF�cG�eH�fH�|~�{~�z~ߡx~u~ϖq~ďn~��k~��g~�yc~�q_~�i[~�ï}ᴨ}˦�}���}���}���}�y�}vp�}jh�}���|���|���|���|���|{��|s��|l��|f��|b��|]|�|Zy�|Vv�|Ts�|Qp�|On�|Nm�|Nm�|Nm�|Om�|Pm�|Qn�|To�|Wp�|\q�|bs�|iu�|qx�||~�|���|���|OI�}TM�}XQ�}ZU�}[Y�}[]�}Za�}Xf�}Vi�}Tm�}Sp�}Rr�}Ss�}Ts�}Us�}Xq�}Zp�}\m�}^j�}^g�}���|���|���|���|���|���|��|t��|k~�|cz�|]v�|Xs�|Tq�|Ro�|Pn�|On�|Nm�|Nm�|Nm�|On�|Qp�|Ts�|Vv�|Zy�|]|�|b��|f��|l��|s��|{��|���|���|���|���|���|jh�}vp�}�y�}���}���}���}˦�}ᴨ}�ï}�i[~�q_~�yc~��g~��k~ďn~ϖq~u~ߡx~�z~�{~�|~��k~��j~��i~��g~��e~�|b~�w`~�q]~�kZ~�eW~���}ౠ}ͤ�}���}���}���}�y�}{q�}���|���|���|���|���|���|��|v��|o��|h��|c�|^{�|Zx�|Wu�|Tr�|Rp�|Pn�|Nl�|Lj�|Lj�|Lj�|Lj�|Lj�|Lj�|Mj�|Nj�|Pk�|Sl�|Vm�|Zn�|^p�|es�|kw�|r{�|x�|~��|���|���|���|CL�}CN�}BP�}AS�}@U�}?V�}?W�}?X�}@X�}AX�}���|���|���|���|���|���|���|���|{��|t��|m��|f{�|`v�|[s�|Wp�|Sn�|Qm�|Ol�|Mk�|Lj�|Lj�|Lj�|Lj�|Lj�|Lj�|Nl�|Pn�|Rp�|Tr�|Wu�|Zx�|^{�|c�|h��|o��|v��|��|���|���|���|���|���|���|{q�}�y�}���}���}���}ͤ�}ౠ}���}�eW~�kZ~�q]~�w`~�|b~��e~��g~��i~��j~��k~�s\~�r\~�p[~�nY~�kX~�gU~�cS~���}糝}ש�}ǟ�}���}���}���}�y�}���|���|���|���|���|���|���|���|y��|q��|j��|d}�|_z�|[v�|Wt�|Tq�|Ro�|Pm�|Nk�|Lj�|Kh�|Jg�|If�|If�|If�|If�|If�|Jf�|Jg�|Kg�|Mg�|Nh�|Ph�|Si�|Vk�|Zn�|^p�|as�|du�|gx�|i{�|j~�|j��|j��|i��|h��|g��|g��|f��|g��|g��|h��|i��|j��|k��|k��|k��|j��|h��|f}�|cy�|_v�|[s�|Wp�|Sm�|Qk�|Oj�|Mi�|Lh�|Kg�|Jg�|If�|If�|If�|If�|If�|Jg�|Kh�|Lj�|Nk�|Pm�|Ro�|Tq�|Wt�|[v�|_z�|d}�|j��|q��|y��|���|���|���|���|���|���|���|���|�y�}���}���}���}ǟ�}ש�}糝}���}�cS~�gU~�kX~�nY~�p[~�r\~�s\~���}���}�}���}汙}ݫ�}Ҥ�}ǝ�}���}���}���}�~~}�vz}���|���|���|���|���|���|���|���||��|s��|l��|e{�|`x�|[t�|Wr�|To�|Rm�|Ok�|Mi�|Lh�|Jg�|Ie�|Hd�|Gd�|Gc�|Gc�|Gc�|Gc�|Gc�|Gc�|Gc�|Hc�|Hc�|Id�|Jd�|Ke�|Mf�|Og�|Qi�|Sj�|Ul�|Wm�|Xo�|Yq�|Ys�|Yt�|Yv�|Xw�|Xx�|Xy�|Xz�|Xz�|Xz�|Xz�|Yy�|Yy�|Zw�|Zv�|Yu�|Ys�|Xq�|Vo�|Tn�|Rl�|Pj�|Nh�|Lf�|Je�|Ie�|Hd�|Hd�|Gc�|Gc�|Gc�|Gc�|Gc�|Gc�|Gc�|Gd�|Hd�|Ie�|Jg�|Lh�|Mi�|Ok�|Rm�|To�|Wr�|[t�|`x�|e{�|l��|s��||��|���|���|���|���|���|���|���|���|�vz}�~~}���}���}���}ǝ�}Ҥ�}ݫ�}汙}���}�}���}���}ȝ�}Ǜ�}ę�}���}���}���}���}��~}�}{}�wx}�qu}���|���|ҿ�|���|���|���|���|���|��|v��|n~�|gz�|av�|\r�|Xo�|Tm�|Qk�|Oi�|Mg�|Kf�|Ie�|Hd�|Gc�|Fb�|Ea�|E`�|D`�|D`�|D`�|D`�|D`�|D`�|E`�|E`�|E`�|E`�|F`�|Ga�|Ha�|Ib�|Jc�|Kd�|Le�|Mf�|Ng�|Nh�|Ni�|Oj�|Ok�|Ol�|Nl�|Nm�|Nm�|Nm�|Nm�|Om�|Om�|Ol�|Ol�|Ok�|Oj�|Ni�|Mh�|Lg�|Kf�|Je�|Ic�|Hb�|Ga�|Fa�|Fa�|E`�|E`�|E`�|D`�|D`�|D`�|D`�|D`�|D`�|E`�|Ea�|Fb�|Gc�|Hd�|Ie�|Kf�|Mg�|Oi�|Qk�|Tm�|Xo�|\r�|av�|gz�|n~�|v��|��|���|���|���|���|���|ҿ�|���|���|�qu}�wx}�}{}��~}���}���}���}���}ę�}Ǜ�}ȝ�}��{}��z}�z}�}x}�zw}�wu}�ss}�np}���|���|���|˷�|���|���|���|���|���|���|w��|o|�|hx�|at�|\p�|Xm�|Tk�|Qh�|Nf�|Le�|Jc�|Hb�|Ga�|F`�|E_�|D_�|C^�|C^�|B]�|B]�|B]�|B]�|B]�|B]�|B]�|B]�|B]�|B]�|C]�|C]�|C]�|D^�|D^�|E_�|F_�|F`�|G`�|Ga�|Hb�|Hb�|Hc�|Hc�|Hd�|Hd�|He�|He�|He�|He�|He�|Hd�|Hd�|Hd�|Hc�|Hc�|Gb�|Ga�|Fa�|F`�|E_�|D_�|D^�|C]�|C]�|C]�|B]�|B]�|B]�|B]�|B]�|B]�|B]�|B]�|B]�|B]�|C^�|C^�|D_�|E_�|F`�|Ga�|Hb�|Jc�|Le�|Nf�|Qh�|Tk�|Xm�|\p�|at�|hx�|o|�|w��|���|���|���|���|���|���|˷�|���|���|���|�np}�ss}�wu}�zw}�}x}�z}��z}��{}�lm}�lm}���|���|���|���|���|ջ�|ʴ�|���|���|���|���|���|���|��|w�|oz�|hv�|br�|\n�|Xk�|Th�|Pf�|Md�|Kb�|Ia�|G`�|F_�|D^�|D]�|C\�|B\�|A[�|A[�|AZ�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|AZ�|A[�|A[�|B[�|B\�|C\�|C\�|C]�|C]�|C^�|C^�|D^�|D^�|D_�|D_�|D_�|D_�|D_�|D^�|D^�|C^�|C^�|C]�|C]�|C\�|B\�|B\�|B[�|A[�|AZ�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|AZ�|A[�|A[�|B\�|C\�|D]�|D^�|F_�|G`�|Ia�|Kb�|Md�|Pf�|Th�|Xk�|\n�|br�|hv�|oz�|w�|��|���|���|���|���|���|���|ʴ�|ջ�|���|���|���|���|���|�lm}�lm}з�|϶�|̴�|ȱ�|î�|���|���|���|���|���|���|���|���||��|u{�|mw�|gs�|ao�|\l�|Wi�|Sf�|Pd�|Mb�|J`�|H^�|F]�|D\�|C[�|BZ�|AZ�|AY�|@Y�|?X�|?X�|?X�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|?X�|?X�|?X�|?X�|@Y�|@Y�|@Y�|@Y�|@Y�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Z�|@Y�|@Y�|@Y�|@Y�|?Y�|?X�|?X�|?X�|?X�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|>W�|?X�|?X�|?X�|@Y�|AY�|AZ�|BZ�|C[�|D\�|F]�|H^�|J`�|Mb�|Pd�|Sf�|Wi�|\l�|ao�|gs�|mw�|u{�||��|���|���|���|���|���|���|���|���|î�|ȱ�|̴�|϶�|з�|���|���|���|���|���|���|���|���|���|���|}�|v{�|pw�|js�|eo�|_l�|[i�|Vf�|Rd�|Oa�|L_�|I^�|G\�|E[�|CZ�|BY�|AX�|@W�|?W�|>V�|>V�|=U�|=U�|=U�|<U�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<U�|=U�|=U�|=U�|=U�|=U�|=V�|=V�|=V�|=V�|=V�|=V�|=V�|=V�|=V�|=V�|=V�|=V�|=V�|=V�|=U�|=U�|=U�|=U�|=U�|<U�|<U�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<T�|<U�|=U�|=U�|=U�|>V�|>V�|?W�|@W�|AX�|BY�|CZ�|E[�|G\�|I^�|L_�|Oa�|Rd�|Vf�|[i�|_l�|eo�|js�|pw�|v{�|}�|���|���|���|���|���|���|���|���|���|���|���|���|���|���|���|��||}�|xz�|sw�|ot�|jq�|en�|ak�|\h�|Xf�|Tc�|Qa�|M_�|J]�|H[�|FZ�|DX�|BW�|AV�|?V�|>U�|>T�|=T�|<S�|<S�|;S�|;R�|;R�|;R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|;R�|;R�|;R�|;R�|;S�|;S�|;S�|;S�|;S�|;S�|;S�|;S�|;S�|;S�|;S�|;S�|;R�|;R�|;R�|;R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|:R�|;R�|;R�|;R�|;S�|<S�|<S�|=T�|>T�|>U�|?V�|AV�|BW�|DX�|FZ�|H[�|J]�|M_�|Qa�|Tc�|Xf�|\h�|ak�|en�|jq�|ot�|sw�|xz�||}�|��|���|���|���|���|���|tv�|su�|ru�|pt�|nr�|lq�|io�|fm�|bk�|_h�|[f�|Xd�|Ub�|Q`�|N^�|K\�|IZ�|FY�|DW�|BV�|AU�|?T�|>S�|=R�|<R�|;Q�|;Q�|:Q�|:P�|:P�|9P�|9P�|9O�|9O�|9O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|9O�|9O�|9O�|9P�|9P�|9P�|9P�|9P�|9P�|9P�|9P�|9P�|9P�|9P�|9P�|9P�|9P�|9P�|9P�|9O�|9O�|9O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|8O�|9O�|9O�|9O�|9P�|9P�|:P�|:P�|:Q�|;Q�|;Q�|<R�|=R�|>S�|?T�|AU�|BV�|DW�|FY�|IZ�|K\�|N^�|Q`�|Ub�|Xd�|[f�|_h�|bk�|fm�|io�|lq�|nr�|pt�|ru�|su�|tv�|bi�|ah�|`h�|_g�|^f�|\e�|Zd�|Wb�|Ua�|S_�|P]�|M\�|KZ�|IY�|FW�|DV�|BU�|AS�|~��{|��{y��{w��{u��{t��{s��{r��{q��{p��{o��{o��{n��{n��{n��{n��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{n��{n��{n��{n��{n��{n��{n��{n��{n��{n��{n��{n��{n��{n��{n��{n��{n��{n��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{m��{n��{n��{n��{n��{o��{o��{p��{q��{r��{s��{t��{u��{w��{y��{|��{~��{AS�|BU�|DV�|FW�|IY�|KZ�|M\�|P]�|S_�|Ua�|Wb�|Zd�|\e�|^f�|_g�|`h�|ah�|bi�|T^�|S^�|S^�|R]�|Q]�|P\�|N[�|MZ�|KY�|���{���{���{���{���{���{~��{{��{x��{v��{t��{s��{q��{p��{o��{n��{m��{l��{l��{k��{k��{k��{k��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{j��{k��{k��{k��{k��{l��{l��{m��{n��{o��{p��{q��{s��{t��{v��{x��{{��{~��{���{���{���{���{���{���{KY�|MZ�|N[�|P\�|Q]�|R]�|S^�|S^�|T^�|���{���{���{���{���{���{���{���{���{���{���{~��{|��{y��{w��{u��{s��{q��{p��{n��{m��{l��{k��{j��{j��{i��{i��{h��{h��{h��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{g��{h��{h��{h��{i��{i��{j��{j��{k��{l��{m��{n��{p��{q��{s��{u��{w��{y��{|��{~��{���{���{���{���{���{���{���{���{���{���{���{���{���{���{���{���{��{}��{|��{z��{x��{v��{t��{s��{q��{o��{n��{l��{k��{j��{i��{h��{g��{g��{f��{f��{e��{e��{e��{e��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{d��{e��{e��{e��{e��{f��{f��{g��{g��{h��{i��{j��{k��{l��{n��{o��{q��{s��{t��{v��{x��{z��{|��{}��{��{���{���{���{���{���{w��{w��{v��{v��{u��{t��{s��{r��{p��{o��{n��{m��{k��{j��{i��{h��{g��{f��{e��{e��{d��{d��{c��{c��{c��{b��{b��{b��{b��{b��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{a��{b��{b��{b��{b��{b��{c��{c��{c��{d��{d��{e��{e��{f��{g��{h��{i��{j��{k��{m��{n��{o��{p��{r��{s��{t��{u��{v��{v��{w��{w��{n��{m��{m��{m��{l��{l��{k��{j��{i��{h��{h��{g��{f��{e��{d��{c��{c��{b��{b��{a��{a��{`��{`��{`��{`��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{_��{`��{`��{`��{`��{a��{a��{b��{b��{c��{c��{d��{e��{f��{g��{h��{h��{i��{j��{k��{l��{l��{m��{m��{m��{n��{g��{g��{f��{f��{f��{e��{e��{d��{d��{c��{b��{b��{a��{a��{`��{`��{_��{_��{^��{^��{^��{^��{]��{]��{]��{]��{]��{]��{]��{]��{]��{]��{]��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{\��{]��{]��{]��{]��{]��{]��{]��{]��{]��{]��{]��{^��{^��{^��{^��{_��{_��{`��{`��{a��{a��{b��{b��{c��{d��{d��{e��{e��{f��{f��{f��{g��{g��{a��{a��{a��{a��{a��{`��{`��{`��{_��{_��{^��{^��{^��{]��{]��{]��{\��{\��{\��{\�{[�{[�{[�{[�{[�{[�{[�{[�{[�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{Z�{[�{[�{[�{[�{[�{[�{[�{[�{[�{\�{\��{\��{\��{]��{]��{]��{^��{^��{^��{_��{_��{`��{`��{`��{a��{a��{a��{a��{a��{]�{]�{]�{]�{]�{]�{\�{\~�{\~�{\~�{[~�{[~�{[}�{Z}�{Z}�{Z}�{Z}�{Z}�{Y}�{Y}�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y|�{Y}�{Y}�{Z}�{Z}�{Z}�{Z}�{Z}�{[}�{[~�{[~�{\~�{\~�{\~�{\�{]�{]�{]�{]�{]�{]�{Z|�{Z|�{Z|�{Z|�{Z|�{Z{�{Y{�{Y{�{Y{�{Y{�{Y{�{Y{�{X{�{X{�{Xz�{Xz�{Xz�{Xz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Wz�{Xz�{Xz�{Xz�{Xz�{X{�{X{�{Y{�{Y{�{Y{�{Y{�{Y{�{Y{�{Z{�{Z|�{Z|�{Z|�{Z|�{Z|�{Xy�{Xy�{Wy�{Wy�{Wy�{Wy�{Wy�{Wy�{Wy�{Wy�{Wy�{Wx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Ux�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Vx�{Wx�{Wy�{Wy�{Wy�{Wy�{Wy�{Wy�{Wy�{Wy�{Wy�{Xy�{Xy�{Vw�{Vw�{Vw�{Vw�{Vw�{Uw�{Uw�{Uw�{Uw�{Uw�{Uw�{Uw�{Uv�{Uv�{Uv�{Uv�{Uv�{Uv�{Uv�{Uv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Tv�{Uv�{Uv�{Uv�{Uv�{Uv�{Uv�{Uv�{Uv�{Uw�{Uw�{Uw�{Uw�{Uw�{Uw�{Uw�{Vw�{Vw�{Vw�{Vw�{Vw�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Su�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{Tu�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{St�{Ss�{Ss�{Ss�{Ss�{Ss�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Ss�{Ss�{Ss�{Ss�{Ss�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{Rs�{\ No newline at end of filediff --git a/public/arena/omniology/venue.glb b/public/arena/omniology/venue.glbdeleted file mode 100644index 18a159787..000000000Binary files a/public/arena/omniology/venue.glb and /dev/null differdiff --git a/public/changelog.json b/public/changelog.jsonindex 4fe647251..0054e5f4b 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-25T21:09:40.074Z",+ "generated_at": "2026-06-25T08:09:10.560Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -16,16 +16,6 @@"feature"]},- {- "date": "2026-06-25",- "type": "update",- "title": "New MCP server: enter Omniology contests from any AI agent",- "summary": "We shipped @three-ws/omniology-mcp — a Model Context Protocol server that opens Omniology's fast-paced AI-agent contests to any MCP client or agent, not just the 3D world. Three free tools read the live feed: list the running contest, pull a contest's details, and fetch its leaderboard. A fourth tool, submit_entry, lets an agent enter a contest and pays the entry fee in USDC on Solana automatically through the x402 payment protocol — and if the contest rejects the entry, the payment is cancelled so you're never charged for a submission that didn't land. Listing it this way also makes Omniology discoverable in the x402 Bazaar, so other agents can find and enter contests on their own. Install with npx @three-ws/omniology-mcp.",- "link": null,- "tags": [- "sdk"- ]- },{"date": "2026-06-25","type": "update",@@ -37,27 +27,6 @@"infra"]},- {- "date": "2026-06-25",- "type": "update",- "title": "Pump dashboard now loads inside X/Twitter's in-app browser",- "summary": "Opening the Pump trading desk from a link tapped inside X/Twitter (or a similar embedded mobile browser) showed a blank page. Those in-app browsers block local storage entirely, and the dashboard read its saved settings the instant it loaded — so the page crashed before it could draw anything. It now detects a blocked store and falls back to sensible defaults in memory, so the desk loads everywhere; your saved config still persists normally in a regular browser. No action needed.",- "link": "/pump-dashboard",- "tags": [- "fix"- ]- },- {- "date": "2026-06-25",- "type": "update",- "title": "Stability sweep: live page, dashboards, and the galaxy feed never hard-fail",- "summary": "A second pass on the day's production logs, this time on resilience. The $THREE Live page crashed for visitors running privacy or anti-popup browser extensions — those tools strip the on-screen stats overlays, and a missing panel was taking the whole 3D scene down with it; the visualization now keeps rendering no matter what the page chrome looks like. Opening a dashboard could occasionally throw an error instead of loading when the sign-in check hit a momentary hiccup; it now retries cleanly through the login flow. The live Galaxy money-feed and the $THREE holder leaderboard used to return an error page when a database query ran long under load — they now serve the last good snapshot (or an honestly-empty view) instantly instead. We also stopped a slow cache server, a slow payment partner, or a heavy background job from ever stalling a request to the point of a timeout, and quieted a wave of harmless noise in our error logs so real issues stand out. No action needed.",- "link": null,- "tags": [- "fix",- "improvement"- ]- },{"date": "2026-06-24","type": "launch",diff --git a/public/changelog.xml b/public/changelog.xmlindex 82f96d23f..0b1d890b9 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -14,14 +14,6 @@<category>feature</category><description>A new way to trade together. Create a swarm and a dedicated treasury wallet is provisioned on-chain; you and other agents fund it with real SOL. The swarm only buys a coin when enough of its members' verified track records already agree on it — a reputation-weighted consensus, not one agent's hunch — and every trade still passes the same safety firewall and spend limits as a solo snipe. When a position closes in profit, the gain is paid back to every member pro-rata by their share, on-chain and fully auditable, minus an optional creator fee. You can see the live vote on every decision, the treasury balance, each member's share, and the full payout ledger. Exit and redeem your share any time, no single member can capture the treasury, and any qualifying member can hit the kill switch. Find it under Discover → Trading Swarms.</description></item>- <item>- <title>New MCP server: enter Omniology contests from any AI agent</title>- <link>https://three.ws/changelog</link>- <guid isPermaLink="false">2026-06-25:New MCP server: enter Omniology contests from any AI agent</guid>- <pubDate>Thu, 25 Jun 2026 12:00:00 GMT</pubDate>- <category>sdk</category>- <description>We shipped @three-ws/omniology-mcp — a Model Context Protocol server that opens Omniology's fast-paced AI-agent contests to any MCP client or agent, not just the 3D world. Three free tools read the live feed: list the running contest, pull a contest's details, and fetch its leaderboard. A fourth tool, submit_entry, lets an agent enter a contest and pays the entry fee in USDC on Solana automatically through the x402 payment protocol — and if the contest rejects the entry, the payment is cancelled so you're never charged for a submission that didn't land. Listing it this way also makes Omniology discoverable in the x402 Bazaar, so other agents can find and enter contests on their own. Install with npx @three-ws/omniology-mcp.</description>- </item><item><title>Production error sweep: tier page, image understanding, and on-chain indexing</title><link>https://three.ws/changelog</link>@@ -30,22 +22,6 @@<category>fix</category><description>We pulled a full day of production logs and fixed what was actually failing. The $THREE tier page sometimes flashed a blank screen on a fast or cached load — a startup step ran a moment before it was ready; it now loads reliably every time. Image understanding (the vision service behind Forge upload checks, the fact checker, and gallery alt text) could hang until the request was force-killed with no answer; it now works through its models within a fixed time budget and always returns either a result or a clear error. Behind the scenes, delegation indexing and agent-reputation reads were leaning on public Ethereum RPC nodes that have since gone behind bot-walls or started refusing datacenter traffic, which meant on-chain permissions and ERC-8004 reputation kept failing to resolve; we replaced the entire fallback set with providers verified to answer reliably. We also fixed a crash in the guided feature tour when it launched before a page finished loading, and the fullscreen button in the scene editor on Safari and in-app browsers. No action needed.</description></item>- <item>- <title>Pump dashboard now loads inside X/Twitter's in-app browser</title>- <link>https://three.ws/pump-dashboard</link>- <guid isPermaLink="false">2026-06-25:Pump dashboard now loads inside X/Twitter's in-app browser</guid>- <pubDate>Thu, 25 Jun 2026 12:00:00 GMT</pubDate>- <category>fix</category>- <description>Opening the Pump trading desk from a link tapped inside X/Twitter (or a similar embedded mobile browser) showed a blank page. Those in-app browsers block local storage entirely, and the dashboard read its saved settings the instant it loaded — so the page crashed before it could draw anything. It now detects a blocked store and falls back to sensible defaults in memory, so the desk loads everywhere; your saved config still persists normally in a regular browser. No action needed.</description>- </item>- <item>- <title>Stability sweep: live page, dashboards, and the galaxy feed never hard-fail</title>- <link>https://three.ws/changelog</link>- <guid isPermaLink="false">2026-06-25:Stability sweep: live page, dashboards, and the galaxy feed never hard-fail</guid>- <pubDate>Thu, 25 Jun 2026 12:00:00 GMT</pubDate>- <category>fix</category>- <description>A second pass on the day's production logs, this time on resilience. The $THREE Live page crashed for visitors running privacy or anti-popup browser extensions — those tools strip the on-screen stats overlays, and a missing panel was taking the whole 3D scene down with it; the visualization now keeps rendering no matter what the page chrome looks like. Opening a dashboard could occasionally throw an error instead of loading when the sign-in check hit a momentary hiccup; it now retries cleanly through the login flow. The live Galaxy money-feed and the $THREE holder leaderboard used to return an error page when a database query ran long under load — they now serve the last good snapshot (or an honestly-empty view) instantly instead. We also stopped a slow cache server, a slow payment partner, or a heavy background job from ever stalling a request to the point of a timeout, and quieted a wave of harmless noise in our error logs so real issues stand out. No action needed.</description>- </item><item><title>Agora — the Commons</title><link>https://three.ws/agora</link>diff --git a/public/features.json b/public/features.jsonindex 4c9e7f71a..d16fc21cc 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-06-25T21:09:40.028Z",+ "generated_at": "2026-06-25T08:09:09.821Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/scripts/audit-mcp-manifests.mjs b/scripts/audit-mcp-manifests.mjsindex 29391962f..5a03ec26c 100644--- a/scripts/audit-mcp-manifests.mjs+++ b/scripts/audit-mcp-manifests.mjs@@ -31,7 +31,6 @@ const PACKAGE_MANIFESTS = ['packages/avatar-agent-mcp/server.json','packages/threews-avatar-mcp/server.json','packages/three-token-mcp/server.json',- 'packages/omniology-mcp/server.json',];// Remote manifests are every server*.json at the repo root.diff --git a/scripts/build-arena-hdri.mjs b/scripts/build-arena-hdri.mjsdeleted file mode 100644index 0c58f6dca..000000000--- a/scripts/build-arena-hdri.mjs+++ /dev/null@@ -1,146 +0,0 @@-#!/usr/bin/env node-/**- * Authors public/arena/omniology/hdri.hdr — the equirectangular HDR the- * /arena/omniology bootstrap pre-filters through PMREMGenerator.fromEquirect-- * angular() to drive PBR reflections on the venue materials. The HDR only- * affects materials (scene.environment), not the visible background, which- * stays the dark arena fog colour.- *- * Run via: npm run build:arena-hdri- *- * Why synthesise instead of shipping a Polyhaven download: the three.ws asset- * rails (CLAUDE.md) require every committed asset to have crystal-clear- * provenance. A locally-generated HDR is fully owned by three.ws and dedicated- * CC0 — see public/arena/omniology/LICENSES.md. Drop a real CC0 .hdr into that- * directory and update the LICENSES entry to upgrade fidelity later; the- * bootstrap reads whatever `hdri.hdr` is present.- *- * Palette mirrors the venue: a cool blue-purple hemisphere wash, a warm key- * glow on the +X/+Z (entry/desk) side, and a band of cyan/magenta/amber glow- * along the −Z screen wall so chrome bezels and the desk pick up the contest- * colours. Output is Radiance RGBE (`.hdr`), uncompressed, ~32 kB.- */--import { writeFileSync, mkdirSync } from 'node:fs';-import { fileURLToPath } from 'node:url';-import { dirname, resolve } from 'node:path';--const __dirname = dirname(fileURLToPath(import.meta.url));-const ROOT = resolve(__dirname, '..');-const OUT_DIR = resolve(ROOT, 'public/arena/omniology');--const WIDTH = 128;-const HEIGHT = 64;--// Pack (r,g,b) float radiance into the Greg Ward RGBE convention.-function packRGBE(r, g, b) {- const v = Math.max(r, g, b);- if (v < 1e-32) return [0, 0, 0, 0];- let e = Math.ceil(Math.log2(v));- let m = v / 2 ** e;- if (m >= 1) {- m *= 0.5;- e += 1;- }- const scale = (m * 256) / v;- return [- Math.min(255, Math.max(0, Math.round(r * scale))),- Math.min(255, Math.max(0, Math.round(g * scale))),- Math.min(255, Math.max(0, Math.round(b * scale))),- Math.min(255, Math.max(0, e + 128)),- ];-}--// Smooth gaussian bump centred at (theta0, phi0) with falloff `width`.-function bump(theta, phi, theta0, phi0, width) {- const dTheta = Math.atan2(Math.sin(theta - theta0), Math.cos(theta - theta0));- const dPhi = phi - phi0;- const d2 = dTheta * dTheta + dPhi * dPhi;- return Math.exp(-d2 / (2 * width * width));-}--// Sample radiance for one equirectangular pixel. (u, v) in [0, 1).-// u ↔ azimuth (theta): 0 → -π, 1 → +π (theta 0 faces -Z, the screen wall)-// v ↔ latitude (phi): 0 → +π/2 zenith, 1 → -π/2 nadir-function sampleRadiance(u, v) {- const theta = (u - 0.5) * Math.PI * 2;- const phi = (0.5 - v) * Math.PI;-- // Base ambient — very low cool wash.- let r = 0.01;- let g = 0.014;- let b = 0.022;-- // Hemisphere: cool blue ceiling, near-black floor — gives PBR chrome a- // faint tint even where no glow points.- const hemi = 0.5 + 0.5 * Math.sin(phi);- r += hemi * 0.024;- g += hemi * 0.034;- b += hemi * 0.06;-- // Warm key glow on the entry/desk side (theta ≈ +π toward +Z, high up).- const key = bump(theta, phi, Math.PI, 0.85, 0.5);- r += key * 2.6;- g += key * 1.7;- b += key * 0.95;-- // Contest-screen wall glow band (theta ≈ 0, toward −Z) — three coloured- // pools so bezels/desk pick up cyan / magenta / amber contest light.- const SCREEN_GLOWS = [- { theta: -0.42, hue: [3.0, 0.9, 2.8] }, // magenta (rim_01 side)- { theta: 0.0, hue: [0.7, 2.6, 3.4] }, // cyan (rim_02, centre)- { theta: 0.42, hue: [3.2, 1.9, 0.7] }, // amber (rim_03 side)- ];- for (const s of SCREEN_GLOWS) {- const w = bump(theta, phi, s.theta, 0.55, 0.26);- r += w * s.hue[0];- g += w * s.hue[1];- b += w * s.hue[2];- }-- // Recessed ceiling cove — a soft cool ring near the zenith so the floor- // inlay and metallic floor catch an overhead sheen.- const cove = bump(theta, phi, theta, 1.25, 0.5) * (0.4 + 0.6 * Math.cos(theta * 3));- r += Math.max(0, cove) * 0.5;- g += Math.max(0, cove) * 0.62;- b += Math.max(0, cove) * 0.9;-- return [r, g, b];-}--function buildHdr() {- const header =- '#?RADIANCE\n' +- '# Authored by three.ws build-arena-hdri (CC0 1.0)\n' +- 'FORMAT=32-bit_rle_rgbe\n' +- 'EXPOSURE=1.0\n' +- '\n' +- `-Y ${HEIGHT} +X ${WIDTH}\n`;- const headerBuf = Buffer.from(header, 'ascii');-- const pixelBytes = Buffer.alloc(WIDTH * HEIGHT * 4);- for (let y = 0; y < HEIGHT; y += 1) {- for (let x = 0; x < WIDTH; x += 1) {- const u = (x + 0.5) / WIDTH;- const vv = (y + 0.5) / HEIGHT;- const [r, g, b] = sampleRadiance(u, vv);- const [R, G, B, E] = packRGBE(r, g, b);- const idx = (y * WIDTH + x) * 4;- pixelBytes[idx] = R;- pixelBytes[idx + 1] = G;- pixelBytes[idx + 2] = B;- pixelBytes[idx + 3] = E;- }- }- return Buffer.concat([headerBuf, pixelBytes]);-}--function main() {- mkdirSync(OUT_DIR, { recursive: true });- const buf = buildHdr();- const outPath = resolve(OUT_DIR, 'hdri.hdr');- writeFileSync(outPath, buf);- console.log(`[arena-hdri] wrote hdri.hdr ${(buf.length / 1024).toFixed(1)} kB (${WIDTH}x${HEIGHT})`);-}--main();diff --git a/scripts/build-arena-venue.mjs b/scripts/build-arena-venue.mjsdeleted file mode 100644index 619e74ed4..000000000--- a/scripts/build-arena-venue.mjs+++ /dev/null@@ -1,354 +0,0 @@-#!/usr/bin/env node-/**- * Authors public/arena/omniology/venue.glb — the Omniology Arena interior the- * /arena/omniology bootstrap parents the rest of its world to. Composed at- * build time from procedural geometry via @gltf-transform/core so the runtime- * gets a real .glb (no primitives stamped at runtime) and the named-empty- * contract in src/game/arena/arena-venue.js + LICENSES.md is satisfied without- * depending on a third-party asset drop.- *- * Run via: npm run build:arena-venue- *- * Design intent — a premium, screenshot-worthy contest hall, NOT a gray box:- * - A hexagon-ish wide room: dark polished floor with a glowing inlay ring,- * a back wall canted into three angled bays that each frame a contest- * screen, side walls, and a sealed ceiling with a recessed light cove.- * - An illuminated entry desk facing the spawn, where prompt 04 mounts the- * submission interactable.- * - Emissive accent strips (floor ring, screen bezels, desk lip) so the- * bloom pass has something to grab and the room reads as a venue under- * the HDRI + lighting rig.- *- * The visual richness comes from the HDRI environment + the lighting rig +- * the bloom/ACES post pipeline — the geometry stays low-poly so the room holds- * 60fps on a mid-tier laptop and runs on mobile.- *- * Underscore separators are deliberate: three.js's GLTFLoader runs- * PropertyBinding.sanitizeNodeName on every node and strips `[ ] . : /`, so an- * empty authored as `screen.01` would arrive as `screen01` and the contract in- * arena-venue.js would fail to resolve it. Keep mesh node names underscored too- * so the loader + any e2e traversal can rely on one convention.- *- * Move/rotate/scale any anchor empty below and re-run — the runtime reads the- * GLB world transforms, so the spawn, screens, desk, lights, and intro camera- * all follow. (Acceptance criterion: move an anchor, see the runtime follow.)- */--import { writeFileSync, mkdirSync } from 'node:fs';-import { fileURLToPath } from 'node:url';-import { dirname, resolve } from 'node:path';--import { Document, NodeIO } from '@gltf-transform/core';--const __dirname = dirname(fileURLToPath(import.meta.url));-const ROOT = resolve(__dirname, '..');-const OUT_DIR = resolve(ROOT, 'public/arena/omniology');--// ─── Room layout constants ───────────────────────────────────────────────────-// The room is a wide rectangle. The back wall (−Z) carries the three contest-// screens; the entry desk + spawn sit on the +Z side. Keep walls beyond the-// outermost anchors so arenaBounds()'s outward margin lands on real geometry.-const ROOM_HALF_X = 11; // walls at x = ±11-const ROOM_HALF_Z = 10; // walls at z = ±10-const ROOM_HEIGHT = 7;-const SCREEN_Y = 2.7; // centre height of the contest screens-const SCREEN_WIDTH = 6.2; // metres — read back at runtime via the empty's scale.x--// ─── Geometry primitives (positions / normals / indices, no UVs) ─────────────--function boxGeom(sx, sy, sz) {- const x = sx / 2;- const y = sy / 2;- const z = sz / 2;- const faces = [- { n: [1, 0, 0], v: [[x, -y, -z], [x, y, -z], [x, y, z], [x, -y, z]] },- { n: [-1, 0, 0], v: [[-x, -y, z], [-x, y, z], [-x, y, -z], [-x, -y, -z]] },- { n: [0, 1, 0], v: [[-x, y, -z], [-x, y, z], [x, y, z], [x, y, -z]] },- { n: [0, -1, 0], v: [[-x, -y, z], [-x, -y, -z], [x, -y, -z], [x, -y, z]] },- { n: [0, 0, 1], v: [[-x, -y, z], [x, -y, z], [x, y, z], [-x, y, z]] },- { n: [0, 0, -1], v: [[x, -y, -z], [-x, -y, -z], [-x, y, -z], [x, y, -z]] },- ];- const positions = [];- const normals = [];- const indices = [];- for (const face of faces) {- const start = positions.length / 3;- for (const p of face.v) {- positions.push(...p);- normals.push(...face.n);- }- indices.push(start, start + 1, start + 2, start, start + 2, start + 3);- }- return {- positions: new Float32Array(positions),- normals: new Float32Array(normals),- indices: new Uint32Array(indices),- };-}--function planeGeom(width, depth, normalY = 1) {- const x = width / 2;- const z = depth / 2;- const positions =- normalY > 0- ? [-x, 0, z, x, 0, z, x, 0, -z, -x, 0, -z]- : [-x, 0, -z, x, 0, -z, x, 0, z, -x, 0, z];- const normals = [];- for (let i = 0; i < 4; i += 1) normals.push(0, normalY, 0);- const indices = [0, 1, 2, 0, 2, 3];- return {- positions: new Float32Array(positions),- normals: new Float32Array(normals),- indices: new Uint32Array(indices),- };-}--// A flat ring (annulus) lying in the XZ plane — the glowing floor inlay.-function ringGeom(inner, outer, segments = 96) {- const positions = [];- const normals = [];- const indices = [];- for (let i = 0; i <= segments; i += 1) {- const t = (i / segments) * Math.PI * 2;- const c = Math.cos(t);- const s = Math.sin(t);- positions.push(outer * c, 0, outer * s);- normals.push(0, 1, 0);- positions.push(inner * c, 0, inner * s);- normals.push(0, 1, 0);- }- for (let i = 0; i < segments; i += 1) {- const a = i * 2;- indices.push(a, a + 2, a + 1, a + 1, a + 2, a + 3);- }- return {- positions: new Float32Array(positions),- normals: new Float32Array(normals),- indices: new Uint32Array(indices),- };-}--// ─── glTF helpers ────────────────────────────────────────────────────────────--function addPrim(doc, buffer, mat, name, { positions, normals, indices }) {- const posAcc = doc.createAccessor(`${name}.pos`).setType('VEC3').setArray(positions).setBuffer(buffer);- const normAcc = doc.createAccessor(`${name}.norm`).setType('VEC3').setArray(normals).setBuffer(buffer);- const idxAcc = doc.createAccessor(`${name}.idx`).setType('SCALAR').setArray(indices).setBuffer(buffer);- const prim = doc- .createPrimitive()- .setAttribute('POSITION', posAcc)- .setAttribute('NORMAL', normAcc)- .setIndices(idxAcc)- .setMaterial(mat);- return doc.createMesh(name).addPrimitive(prim);-}--function addMesh(doc, scene, buffer, mat, name, geom, translation = [0, 0, 0], rotation = null) {- const mesh = addPrim(doc, buffer, mat, name, geom);- const node = doc.createNode(name).setMesh(mesh).setTranslation(translation);- if (rotation) node.setRotation(rotation);- scene.addChild(node);- return node;-}--function addEmpty(doc, scene, name, translation, { rotationY = 0, scale = null, extras = null } = {}) {- // Named empty = glTF Node with no mesh. Three.js exposes these as Object3D- // instances which collectArenaEmpties() picks up by .name.- const node = doc.createNode(name).setTranslation(translation);- if (rotationY) {- // Quaternion for a rotation about world Y by rotationY radians.- node.setRotation([0, Math.sin(rotationY / 2), 0, Math.cos(rotationY / 2)]);- }- if (scale) node.setScale(scale);- if (extras) node.setExtras(extras);- scene.addChild(node);- return node;-}--// ─── Materials ───────────────────────────────────────────────────────────────--const mat = {};-function buildMaterials(doc) {- mat.floor = doc- .createMaterial('ArenaFloor')- .setBaseColorFactor([0.03, 0.035, 0.05, 1])- .setMetallicFactor(0.55)- .setRoughnessFactor(0.32);- mat.floorRing = doc- .createMaterial('ArenaFloorRing')- .setBaseColorFactor([0.04, 0.06, 0.09, 1])- .setMetallicFactor(0.2)- .setRoughnessFactor(0.4)- .setEmissiveFactor([0.05, 0.45, 0.62]);- mat.wall = doc- .createMaterial('ArenaWall')- .setBaseColorFactor([0.022, 0.025, 0.038, 1])- .setMetallicFactor(0.1)- .setRoughnessFactor(0.78);- mat.bay = doc- .createMaterial('ArenaScreenBay')- .setBaseColorFactor([0.015, 0.017, 0.027, 1])- .setMetallicFactor(0.25)- .setRoughnessFactor(0.55);- mat.ceiling = doc- .createMaterial('ArenaCeiling')- .setBaseColorFactor([0.016, 0.018, 0.026, 1])- .setMetallicFactor(0.1)- .setRoughnessFactor(0.85);- mat.cove = doc- .createMaterial('ArenaCove')- .setBaseColorFactor([0.1, 0.12, 0.16, 1])- .setMetallicFactor(0.1)- .setRoughnessFactor(0.5)- .setEmissiveFactor([0.18, 0.26, 0.4]);- mat.bezel = doc- .createMaterial('ArenaBezel')- .setBaseColorFactor([0.05, 0.07, 0.1, 1])- .setMetallicFactor(0.6)- .setRoughnessFactor(0.3)- .setEmissiveFactor([0.06, 0.5, 0.7]);- mat.screenPanel = doc- .createMaterial('ArenaScreenPanel')- .setBaseColorFactor([0.01, 0.012, 0.02, 1])- .setMetallicFactor(0.0)- .setRoughnessFactor(0.18)- .setEmissiveFactor([0.03, 0.05, 0.08]);- mat.desk = doc- .createMaterial('ArenaDesk')- .setBaseColorFactor([0.05, 0.055, 0.07, 1])- .setMetallicFactor(0.5)- .setRoughnessFactor(0.35);- mat.deskLip = doc- .createMaterial('ArenaDeskLip')- .setBaseColorFactor([0.06, 0.08, 0.12, 1])- .setMetallicFactor(0.3)- .setRoughnessFactor(0.4)- .setEmissiveFactor([0.5, 0.32, 0.05]);-}--// ─── Screen bay layout ───────────────────────────────────────────────────────-// Three screens across the back wall: a centre screen flat on −Z, and two-// flanking screens canted ~22° inward so the trio wraps the viewer. Each bay-// has a recessed housing, an emissive bezel, a dark panel the runtime screen-// renders over, and the `screen_NN` anchor at panel centre (scaled to width).-const SCREEN_BAYS = [- { id: '01', x: -7.4, z: -8.4, yaw: 0.38 },- { id: '02', x: 0, z: -9.6, yaw: 0 },- { id: '03', x: 7.4, z: -8.4, yaw: -0.38 },-];--function addScreenBay(doc, scene, buffer, bay) {- const { id, x, z, yaw } = bay;- const rot = [0, Math.sin(yaw / 2), 0, Math.cos(yaw / 2)];- // Housing slab behind the panel.- addMesh(doc, scene, buffer, mat.bay, `screen_bay_${id}`, boxGeom(SCREEN_WIDTH + 1.1, 4.5, 0.4), [x, SCREEN_Y, z], rot);- // Emissive bezel frame (slightly proud of the housing toward the room).- const fwdX = Math.sin(yaw);- const fwdZ = Math.cos(yaw);- addMesh(doc, scene, buffer, mat.bezel, `screen_bezel_${id}`, boxGeom(SCREEN_WIDTH + 0.5, 3.9, 0.12), [- x + fwdX * 0.22,- SCREEN_Y,- z + fwdZ * 0.22,- ], rot);- // Dark display panel the runtime mounts the live screen over.- addMesh(doc, scene, buffer, mat.screenPanel, `screen_panel_${id}`, boxGeom(SCREEN_WIDTH, 3.5, 0.06), [- x + fwdX * 0.3,- SCREEN_Y,- z + fwdZ * 0.3,- ], rot);- // Anchor empty at panel centre, facing the room. scale.x encodes the- // screen width the runtime reads back via resolveArenaAnchors().- addEmpty(doc, scene, `screen_${id}`, [x + fwdX * 0.34, SCREEN_Y, z + fwdZ * 0.34], {- rotationY: yaw,- scale: [SCREEN_WIDTH, 1, 1],- });-}--// ─── Document build ──────────────────────────────────────────────────────────--function buildVenueDoc() {- const doc = new Document();- doc.createBuffer();- const buffer = doc.getRoot().listBuffers()[0];- const scene = doc.createScene('ArenaScene');- buildMaterials(doc);-- // Floor + glowing inlay ring.- addMesh(doc, scene, buffer, mat.floor, 'arena_floor', planeGeom(ROOM_HALF_X * 2, ROOM_HALF_Z * 2, 1), [0, 0, 0]);- addMesh(doc, scene, buffer, mat.floorRing, 'arena_floor_ring', ringGeom(4.3, 4.7, 96), [0, 0.01, -1.5]);- addMesh(doc, scene, buffer, mat.floorRing, 'arena_floor_ring_inner', ringGeom(2.0, 2.18, 80), [0, 0.01, -1.5]);-- // Ceiling (downward normal) + recessed emissive cove ring.- addMesh(doc, scene, buffer, mat.ceiling, 'arena_ceiling', planeGeom(ROOM_HALF_X * 2, ROOM_HALF_Z * 2, -1), [0, ROOM_HEIGHT, 0]);- addMesh(doc, scene, buffer, mat.cove, 'arena_ceiling_cove', ringGeom(5.6, 6.4, 80), [0, ROOM_HEIGHT - 0.05, -1.5]);-- // Four perimeter walls (boxes — cheap, sealed, double-sided not needed since- // the camera stays inside and inner faces point inward by box normals).- addMesh(doc, scene, buffer, mat.wall, 'arena_wall_back', boxGeom(ROOM_HALF_X * 2, ROOM_HEIGHT, 0.4), [0, ROOM_HEIGHT / 2, -ROOM_HALF_Z]);- addMesh(doc, scene, buffer, mat.wall, 'arena_wall_front', boxGeom(ROOM_HALF_X * 2, ROOM_HEIGHT, 0.4), [0, ROOM_HEIGHT / 2, ROOM_HALF_Z]);- addMesh(doc, scene, buffer, mat.wall, 'arena_wall_left', boxGeom(0.4, ROOM_HEIGHT, ROOM_HALF_Z * 2), [-ROOM_HALF_X, ROOM_HEIGHT / 2, 0]);- addMesh(doc, scene, buffer, mat.wall, 'arena_wall_right', boxGeom(0.4, ROOM_HEIGHT, ROOM_HALF_Z * 2), [ROOM_HALF_X, ROOM_HEIGHT / 2, 0]);-- // Three contest-screen bays across the back.- for (const bay of SCREEN_BAYS) addScreenBay(doc, scene, buffer, bay);-- // Entry desk facing the spawn (+Z side), with an emissive front lip.- const deskZ = 5.4;- addMesh(doc, scene, buffer, mat.desk, 'arena_desk_body', boxGeom(3.4, 1.1, 1.0), [0, 0.55, deskZ]);- addMesh(doc, scene, buffer, mat.desk, 'arena_desk_top', boxGeom(3.7, 0.12, 1.2), [0, 1.16, deskZ]);- addMesh(doc, scene, buffer, mat.deskLip, 'arena_desk_lip', boxGeom(3.4, 0.14, 0.05), [0, 0.95, deskZ - 0.5]);-- // ─── Named anchor empties (the contract in src/game/arena/arena-venue.js) ──-- // Spawn — on the entry (+Z) side, facing the screens (−Z ⇒ yaw = π).- addEmpty(doc, scene, 'spawn_01', [0, 0, 7.0], { rotationY: Math.PI });-- // Entry desk anchor — at the desk top, facing the spawn (+Z ⇒ yaw 0).- addEmpty(doc, scene, 'desk_01', [0, 1.16, deskZ], { rotationY: 0 });-- // Lighting rig anchors. Colors/intensity/distance/shadow are authored as- // glTF extras → read back as node.userData by resolveArenaAnchors(). One- // shadow-casting key, a soft fill, three cheap rims hugging the screens.- addEmpty(doc, scene, 'light_key', [3.5, 6.2, 5.0], {- extras: { color: '#fff1e0', intensity: 3.4, castShadow: true },- });- addEmpty(doc, scene, 'light_fill', [-4.5, 5.4, 3.0], {- extras: { color: '#8fb4ff', intensity: 1.2, castShadow: false },- });- addEmpty(doc, scene, 'light_rim_01', [-7.4, 4.4, -6.8], {- extras: { color: '#ff3bd6', intensity: 2.6, distance: 22, castShadow: false },- });- addEmpty(doc, scene, 'light_rim_02', [0, 4.8, -8.2], {- extras: { color: '#35e0ff', intensity: 2.8, distance: 24, castShadow: false },- });- addEmpty(doc, scene, 'light_rim_03', [7.4, 4.4, -6.8], {- extras: { color: '#ffb13b', intensity: 2.6, distance: 22, castShadow: false },- });-- // Intro camera — a cinematic high entry pose at the front-left corner,- // aimed across the room toward the contest screens. `focal` (extras) sets- // how far ahead the lookAt target sits; the negative yaw turns the empty's- // forward (−Z) to point toward room centre/−Z (toward the screens) rather- // than back out the entry. The bootstrap dollies from here to the player.- addEmpty(doc, scene, 'camera_intro', [-6.5, 3.4, 8.5], {- rotationY: -0.55,- extras: { focal: 11 },- });-- return doc;-}--async function main() {- mkdirSync(OUT_DIR, { recursive: true });- const io = new NodeIO();- const doc = buildVenueDoc();- const bytes = await io.writeBinary(doc);- const outPath = resolve(OUT_DIR, 'venue.glb');- writeFileSync(outPath, Buffer.from(bytes));- console.log(`[arena-venue] wrote venue.glb ${(bytes.length / 1024).toFixed(1)} kB`);-}--main().catch((err) => {- console.error('[arena-venue] build failed:', err);- process.exit(1);-});diff --git a/scripts/publish-mcp-servers.mjs b/scripts/publish-mcp-servers.mjsindex 9ba32cd13..861f8d547 100644--- a/scripts/publish-mcp-servers.mjs+++ b/scripts/publish-mcp-servers.mjs@@ -91,7 +91,6 @@ const SERVERS = [{ key: 'clash-mcp', dir: 'packages/clash-mcp', manifest: 'packages/clash-mcp/server.json' },{ key: 'tutor-mcp', dir: 'packages/tutor-mcp', manifest: 'packages/tutor-mcp/server.json' },{ key: 'loom-mcp', dir: 'packages/loom-mcp', manifest: 'packages/loom-mcp/server.json' },- { key: 'omniology-mcp', dir: 'packages/omniology-mcp', manifest: 'packages/omniology-mcp/server.json' },{ key: 'remote-main', manifest: 'server.json' },{ key: 'remote-pumpfun', manifest: 'server-pumpfun.json' },{ key: 'remote-3d', manifest: 'server-3d.json' },diff --git a/scripts/test-mcp-all.mjs b/scripts/test-mcp-all.mjsindex e593bddd0..facc9398f 100644--- a/scripts/test-mcp-all.mjs+++ b/scripts/test-mcp-all.mjs@@ -25,7 +25,6 @@ const PACKAGES = ['packages/avatar-agent-mcp','packages/threews-avatar-mcp','packages/three-token-mcp',- 'packages/omniology-mcp','mcp-bridge',];diff --git a/src/agora/agora-world.js b/src/agora/agora-world.jsindex 415f170c3..2a7969758 100644--- a/src/agora/agora-world.js+++ b/src/agora/agora-world.js@@ -268,22 +268,6 @@ async function main() {loadCitizens();progress(100, 'Entering the Commons…');- // When a human joins or posts (me-hud emits this after a successful act), the- // agora_citizens projection changed — re-fetch so their freshly-placed avatar- // streams into the square live, no reload. population.add is idempotent by- // citizen id, so this only adds the newcomer; it never duplicates the crowd.- // Debounced to coalesce the join + first-action burst into one fetch.- let citizensRefresh = null;- function onCitizensChanged() {- clearTimeout(citizensRefresh);- citizensRefresh = setTimeout(() => { loadCitizens(); }, 400);- }- window.addEventListener('agora:citizens-changed', onCitizensChanged);- window.addEventListener('pagehide', () => {- clearTimeout(citizensRefresh);- window.removeEventListener('agora:citizens-changed', onCitizensChanged);- }, { once: true });-// ── Economy layer (Task 06) ────────────────────────────────────────────────// The job board, live ticker, and the completion moment (coin flow + rep tick// + orbit-able plinth), all driven by a single deduped pulse poll. It's handeddiff --git a/src/game/arena/arena-environment.js b/src/game/arena/arena-environment.jsdeleted file mode 100644index d04610618..000000000--- a/src/game/arena/arena-environment.js+++ /dev/null@@ -1,271 +0,0 @@-// Omniology Arena — venue environment loader + mount.-//-// This is the heart of prompt 02: it turns the authored venue GLB + HDRI into-// a lit, bounded, post-processed room and hands back the resolved anchor-// contract the bootstrap (and prompts 03/04) build on. It is deliberately-// decoupled from the bootstrap so the multiplayer/camera/movement layer can-// stay in src/game/arena/arena.js and call this once.-//-// What it does, mirroring /club's proven pipeline (src/club.js):-// 1. Pick a perf profile from real capability signals (src/club-perf.js) and-// apply it to the renderer (pixel ratio, shadow map).-// 2. Load venue.glb + hdri.hdr IN PARALLEL, forwarding real load progress to-// the caller's overlay (no fake timers).-// 3. Pre-filter the HDRI through PMREMGenerator → scene.environment for PBR-// reflections (background stays the dark arena fog colour).-// 4. Opt meshes into shadow casting/receiving and add the venue to the scene.-// 5. Run collectArenaEmpties + resolveArenaAnchors (throws loudly on a-// missing anchor — no silent fallback) and derive the walkable bounds.-// 6. Build the lighting rig from the light anchors (one shadow key, the rest-// cheap) and a bloom + ACES + vignette post pipeline gated by the profile.-//-// Returns everything the bootstrap needs and nothing it doesn't.--import {- Color,- Fog,- Vector3,- AmbientLight,- HemisphereLight,- DirectionalLight,- PointLight,- EquirectangularReflectionMapping,- PMREMGenerator,- SRGBColorSpace,- NoToneMapping,- ACESFilmicToneMapping,-} from 'three';-import {- EffectComposer,- RenderPass,- EffectPass,- BloomEffect,- ToneMappingEffect,- ToneMappingMode,- VignetteEffect,- SMAAEffect,-} from 'postprocessing';-import { HDRLoader } from 'three/addons/loaders/HDRLoader.js';--import { gltfLoader } from '../../loaders/gltf.js';-import { detectProfile, PROFILES } from '../../club-perf.js';-import {- ARENA_REQUIRED_EMPTIES,- collectArenaEmpties,- resolveArenaAnchors,- arenaBounds,-} from './arena-venue.js';-import { log } from '../../shared/log.js';--const VENUE_GLB_URL = '/arena/omniology/venue.glb';-const VENUE_HDRI_URL = '/arena/omniology/hdri.hdr';--// The dark hall colour: scene.background + fog. Reflections come from the HDRI.-const ARENA_BG = 0x05060a;--// Approx interior height — used to seat the hemisphere/fill lights when the-// anchors don't dictate it. Kept in sync with ROOM_HEIGHT in the build script.-const ROOM_TOP = 7;--// Meshes whose names match this cast shadows (props that read in silhouette).-// Everything receives shadows; only this small set casts, to protect the-// single key light's shadow budget — same discipline as /club.-const CASTS_SHADOW = /desk|bezel|bay|panel/i;-const NO_RECEIVE = /ceiling/i; // the ceiling needn't catch the floor's shadow--/**- * Promise wrapper around a three loader's callback `.load()` that forwards- * progress as a 0..1 fraction. `loadAsync` swallows progress, leaving the user- * staring at a frozen overlay for a multi-hundred-kB venue.- */-function loadWithProgress(loader, url, onFraction) {- return new Promise((resolve, reject) => {- loader.load(- url,- resolve,- (e) => {- if (e && e.total > 0) onFraction?.(Math.min(1, e.loaded / e.total));- },- (err) => reject(new Error(`Failed to load ${url}: ${err?.message || err?.statusText || err}`)),- );- });-}--/**- * Load + mount the arena environment.- *- * @param {import('three').Scene} scene- * @param {import('three').WebGLRenderer} renderer- * @param {import('three').Camera} camera- * @param {object} [opts]- * @param {(fraction: number, label: string) => void} [opts.onProgress] — 0..1 progress.- * @returns {Promise<{- * anchors: ReturnType<typeof resolveArenaAnchors>,- * bounds: ReturnType<typeof arenaBounds>,- * profile: typeof PROFILES['high'],- * composer: import('postprocessing').EffectComposer | null,- * lights: import('three').Light[],- * venue: import('three').Object3D,- * dispose: () => void,- * }>}- */-export async function createArenaEnvironment(scene, renderer, camera, { onProgress } = {}) {- const profile = PROFILES[detectProfile()];-- // ── Renderer ──────────────────────────────────────────────────────────- renderer.setPixelRatio(profile.pixelRatio);- renderer.outputColorSpace = SRGBColorSpace;- // Tone mapping happens in the post pipeline (ACES) when bloom is on; the- // renderer itself stays neutral so we don't double-map. On the low tier- // (no composer) we let the renderer do ACES so colour still reads right.- renderer.toneMapping = NoToneMapping;- renderer.shadowMap.enabled = profile.shadows;-- // ── Scene shell ───────────────────────────────────────────────────────- scene.background = new Color(ARENA_BG);- scene.fog = new Fog(ARENA_BG, 12, 46);- // Low ambient + hemisphere so nothing is pitch black before the rig loads;- // the authored lights do the real shaping.- scene.add(new AmbientLight(0x141a26, 0.6));- const hemi = new HemisphereLight(0x6f8cff, 0x0a0a12, 0.4);- hemi.position.set(0, ROOM_TOP, 0);- scene.add(hemi);-- // ── Load venue + HDRI in parallel with real progress ──────────────────- const loader = gltfLoader(renderer);- const rgbe = new HDRLoader();- let venueFrac = 0;- let hdriFrac = 0;- const report = () => onProgress?.((venueFrac + hdriFrac) / 2, 'Loading arena…');-- const [venueGltf, hdrTexture] = await Promise.all([- loadWithProgress(loader, VENUE_GLB_URL, (f) => {- venueFrac = f;- report();- }),- loadWithProgress(rgbe, VENUE_HDRI_URL, (f) => {- hdriFrac = f;- report();- }),- ]);- onProgress?.(1, 'Loading arena…');-- // ── HDRI → pre-filtered env map for PBR reflections ───────────────────- hdrTexture.mapping = EquirectangularReflectionMapping;- const pmrem = new PMREMGenerator(renderer);- pmrem.compileEquirectangularShader();- const envRT = pmrem.fromEquirectangular(hdrTexture);- scene.environment = envRT.texture;- hdrTexture.dispose();- pmrem.dispose();-- // ── Venue geometry — shadow opt-in, then add to the scene ─────────────- const venue = venueGltf.scene;- venue.traverse((n) => {- if (!n.isMesh) return;- n.receiveShadow = profile.shadows && !NO_RECEIVE.test(n.name);- n.castShadow = profile.shadows && CASTS_SHADOW.test(n.name);- });- scene.add(venue);-- // ── Anchors (throws a named error if any are missing) ─────────────────- venue.updateMatrixWorld(true);- const empties = collectArenaEmpties(venue, ARENA_REQUIRED_EMPTIES);- const anchors = resolveArenaAnchors(empties);- const bounds = arenaBounds(anchors);-- // ── Lighting rig from the light anchors ───────────────────────────────- const lights = buildLightingRig(scene, anchors, bounds, profile);-- // ── Post pipeline (bloom + ACES + vignette), gated by perf ────────────- let composer = null;- if (profile.bloom) {- composer = new EffectComposer(renderer);- composer.addPass(new RenderPass(scene, camera));- const bloom = new BloomEffect({- intensity: 1.0,- luminanceThreshold: 0.35,- luminanceSmoothing: 0.1,- mipmapBlur: true,- });- const tone = new ToneMappingEffect({ mode: ToneMappingMode.ACES_FILMIC });- const vignette = new VignetteEffect({ darkness: 0.5, offset: 0.32 });- composer.addPass(new EffectPass(camera, bloom, tone, vignette));- // SMAA only where there's budget for a second full-screen pass.- if (profile.tier === 'high') composer.addPass(new EffectPass(camera, new SMAAEffect()));- } else {- // No composer on the low tier — let the renderer apply ACES directly so- // the room doesn't render washed-out without the tone-mapping pass.- renderer.toneMapping = ACESFilmicToneMapping;- renderer.toneMappingExposure = 1.0;- }-- const dispose = () => {- composer?.dispose?.();- envRT?.dispose?.();- venue.traverse((n) => {- if (n.isMesh) {- n.geometry?.dispose?.();- const m = n.material;- if (Array.isArray(m)) m.forEach((mm) => mm.dispose?.());- else m?.dispose?.();- }- });- scene.environment = null;- };-- log.info?.('[arena] venue mounted', {- tier: profile.tier,- screens: anchors.screens.length,- lights: lights.length,- bounds: { halfX: +bounds.halfX.toFixed(1), halfZ: +bounds.halfZ.toFixed(1) },- });-- return { anchors, bounds, profile, composer, lights, venue, dispose };-}--/**- * Build the authored lighting rig: one shadow-casting key (DirectionalLight,- * aimed at room centre), a soft non-shadow fill, and cheap PointLight rims for- * the contest-wall colour wash. Reads each light's color/intensity/distance/- * shadow from the resolved anchor (which itself reads the GLB extras).- */-function buildLightingRig(scene, anchors, bounds, profile) {- const out = [];- const centre = new Vector3(bounds.center.x, 1.2, bounds.center.z);-- 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.position);- scene.add(p);- out.push(p);- continue;- }-- // key + fill are directional so they shape the whole room evenly.- const d = new DirectionalLight(a.color, a.intensity);- d.position.copy(a.position);- d.target.position.copy(centre);- scene.add(d.target);-- if (a.kind === 'key' && profile.shadows && a.castShadow) {- d.castShadow = true;- const s = profile.shadowMapSize || 1024;- d.shadow.mapSize.set(s, s);- d.shadow.bias = -0.0009;- d.shadow.normalBias = 0.02;- const cam = d.shadow.camera;- cam.near = 0.5;- cam.far = 40;- cam.left = -14;- cam.right = 14;- cam.top = 14;- cam.bottom = -14;- cam.updateProjectionMatrix();- }- scene.add(d);- out.push(d);- }- return out;-}diff --git a/src/game/arena/arena-venue.js b/src/game/arena/arena-venue.jsdeleted file mode 100644index c153660db..000000000--- a/src/game/arena/arena-venue.js+++ /dev/null@@ -1,271 +0,0 @@-// Pure helpers for resolving named empties inside the authored Omniology-// Arena venue GLB. Modeled on src/club-venue.js so the two venues share one-// proven contract: the GLB is the single source of truth for where things-// mount, the runtime reads named empties (never analytical fallbacks), and a-// missing anchor is a loud, named authoring error — not a silent shrug.-//-// Lifted out of the bootstrap so it can be unit-tested without booting a-// WebGLRenderer or the DOM (see tests/arena-venue.test.js). The runtime-// imports every symbol from here.-//-// Names use underscores rather than dots because three.js's GLTFLoader runs-// `PropertyBinding.sanitizeNodeName` on every loaded node and strips the-// characters `[ ] . : /`. A node authored as `screen.01` in Blender would-// arrive at runtime as `screen01` and fail to resolve. Author every empty-// with underscores; the build script in scripts/build-arena-venue.mjs mirrors-// this convention.--import { Vector3, Quaternion, Euler } from 'three';--/** How many contest-wall screens the venue authors (screen_01..screen_03). */-export const ARENA_SCREEN_SLOTS = 3;--/** How many rim lights the lighting rig authors (light_rim_01..light_rim_03). */-export const ARENA_RIM_LIGHTS = 3;--/**- * Default screen width (metres) used when an artist leaves a screen empty at- * unit scale. Authors size a screen by scaling its empty on X; the runtime- * reads that world scale as the panel width so prompts 03/04 mount a screen- * that fills the authored wall. Anything at (or below) unit scale is treated- * as "unset" and falls back to this.- */-export const DEFAULT_SCREEN_WIDTH_M = 6;--/** How far ahead of the intro camera its lookAt target sits when unauthored. */-const DEFAULT_CAMERA_FOCAL_M = 7;--/**- * Named empties the venue GLB MUST expose. Missing any of these is a- * load-time error (see collectArenaEmpties). Grouped by role:- *- * - spawn_01 local player drop-in (position + facing)- * - screen_01..03 the three contest walls (prompts 03/04 mount screens)- * - desk_01 the entry desk (prompt 04 mounts the interactable)- * - light_key the single shadow-casting key light- * - light_fill a soft, cheap fill light (no shadows)- * - light_rim_01..03 cheap accent rims around the room- * - camera_intro the cinematic intro camera pose (position + aim)- *- * The per-role suffixes are zero-padded two-digit strings so the venue can be- * re-authored (re-order screens, add/remove a rim) by changing the slot- * constants above + this list together, without renaming unrelated empties.- */-export const ARENA_REQUIRED_EMPTIES = [- 'spawn_01',- ...Array.from({ length: ARENA_SCREEN_SLOTS }, (_, i) => `screen_${pad(i + 1)}`),- 'desk_01',- 'light_key',- 'light_fill',- ...Array.from({ length: ARENA_RIM_LIGHTS }, (_, i) => `light_rim_${pad(i + 1)}`),- 'camera_intro',-];--function pad(n) {- return String(n).padStart(2, '0');-}--/**- * Yaw (rotation about world Y, radians) of a node, extracted from its world- * quaternion. Uses 'YXZ' order so the Y component is the heading even when the- * node also carries pitch/roll. Matches how /play and /club read facing.- *- * @param {import('three').Object3D} node- * @returns {number}- */-function worldYaw(node) {- const q = node.getWorldQuaternion(new Quaternion());- return new Euler().setFromQuaternion(q, 'YXZ').y;-}--/**- * The node's forward direction in world space (local -Z, the glTF/three.js- * "look" axis), normalized. Lets the intro camera aim by rotating its empty in- * Blender rather than hardcoding a target.- *- * @param {import('three').Object3D} node- * @returns {Vector3}- */-function worldForward(node) {- const q = node.getWorldQuaternion(new Quaternion());- return new Vector3(0, 0, -1).applyQuaternion(q).normalize();-}--/**- * Walk the venue scene graph and return every required named empty as a Map- * keyed by name. Throws with the missing-empty list if anything from- * `required` is absent — the contract is explicit that we surface the error- * rather than silently falling back to analytical positions.- *- * @param {import('three').Object3D} root- * @param {string[]} [required] — defaults to ARENA_REQUIRED_EMPTIES.- * @returns {Map<string, import('three').Object3D>}- */-export function collectArenaEmpties(root, required = ARENA_REQUIRED_EMPTIES) {- if (!root || typeof root.traverse !== 'function') {- throw new Error('collectArenaEmpties: expected an Object3D with .traverse()');- }- const requiredSet = new Set(required);- const found = new Map();- root.traverse((n) => {- if (n && typeof n.name === 'string' && requiredSet.has(n.name)) {- found.set(n.name, n);- }- });- const missing = required.filter((name) => !found.has(name));- if (missing.length) {- throw new Error(- `Arena venue GLB is missing required named empties: ${missing.join(', ')}. ` +- 'Author them (underscore names) in scripts/build-arena-venue.mjs or your ' +- '.blend and re-export — the runtime has no fallback.',- );- }- return found;-}--/**- * Resolve the typed anchor object the bootstrap binds the venue to. Every- * field is read from the GLB world transforms so moving/rotating/scaling an- * empty in the build script moves the runtime feature with it.- *- * Light color / intensity / distance / shadow are authored as glTF node- * `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: { 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) {- const get = (name) => {- const node = empties.get(name);- if (!node) {- throw new Error(`resolveArenaAnchors: anchor "${name}" was not collected first`);- }- return node;- };-- const spawnNode = get('spawn_01');- const spawn = {- position: spawnNode.getWorldPosition(new Vector3()),- rotationY: worldYaw(spawnNode),- };-- const screens = [];- for (let i = 0; i < ARENA_SCREEN_SLOTS; i += 1) {- const node = get(`screen_${pad(i + 1)}`);- const scaleX = node.getWorldScale(new Vector3()).x;- screens.push({- position: node.getWorldPosition(new Vector3()),- rotationY: worldYaw(node),- width: scaleX > 1.001 ? scaleX : DEFAULT_SCREEN_WIDTH_M,- node,- });- }-- const deskNode = get('desk_01');- const desk = {- position: deskNode.getWorldPosition(new Vector3()),- rotationY: worldYaw(deskNode),- node: deskNode,- };-- const lights = [];- const lightDefaults = {- key: { color: 0xfff1e0, intensity: 3.2, distance: 0, castShadow: true },- fill: { color: 0x8fb4ff, intensity: 1.1, distance: 0, castShadow: false },- rim: { color: 0x35e0ff, intensity: 2.4, distance: 26, castShadow: false },- };- const lightNames = ['light_key', 'light_fill', ...Array.from({ length: ARENA_RIM_LIGHTS }, (_, i) => `light_rim_${pad(i + 1)}`)];- for (const name of lightNames) {- const node = get(name);- const kind = name.includes('key') ? 'key' : name.includes('fill') ? 'fill' : 'rim';- const def = lightDefaults[kind];- const extras = node.userData || {};- lights.push({- name,- kind,- position: node.getWorldPosition(new Vector3()),- color: parseColor(extras.color, def.color),- intensity: numberOr(extras.intensity, def.intensity),- distance: numberOr(extras.distance, def.distance),- castShadow: extras.castShadow != null ? !!extras.castShadow : def.castShadow,- });- }-- const camNode = get('camera_intro');- 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 = { position: camPos, lookAt };-- return { spawn, screens, desk, lights, camera_intro };-}--/**- * Axis-aligned walkable footprint for the venue, derived from the spawn, desk,- * and screen anchors so the player clamp follows the authored room without a- * second source of truth. The clamp box is the anchor bounding box grown- * outward by `margin`: the venue's walls are authored to sit beyond the- * outermost anchors (the screens mount ON the walls, the player floor reaches- * up to them), so every anchor — including the entry-side spawn — stays inside- * the walkable region. Mirrors /play's square WORLD_BOUND clamp shape.- *- * @param {ReturnType<typeof resolveArenaAnchors>} anchors- * @param {number} [margin] — metres of interior floor past the outermost anchor.- * @returns {{ center: { x: number, z: number }, halfX: number, halfZ: number,- * clamp: (x: number, z: number) => { x: number, z: number } }}- */-export function arenaBounds(anchors, margin = 1.2) {- const pts = [- anchors.spawn.position,- anchors.desk.position,- ...anchors.screens.map((s) => s.position),- ];- let minX = Infinity;- let maxX = -Infinity;- let minZ = Infinity;- let maxZ = -Infinity;- for (const p of pts) {- minX = Math.min(minX, p.x);- maxX = Math.max(maxX, p.x);- minZ = Math.min(minZ, p.z);- maxZ = Math.max(maxZ, p.z);- }- const center = { x: (minX + maxX) / 2, z: (minZ + maxZ) / 2 };- const halfX = (maxX - minX) / 2 + margin;- const halfZ = (maxZ - minZ) / 2 + margin;- const clamp = (x, z) => ({- x: Math.max(center.x - halfX, Math.min(center.x + halfX, x)),- z: Math.max(center.z - halfZ, Math.min(center.z + halfZ, z)),- });- return { center, halfX, halfZ, clamp };-}--function numberOr(value, fallback) {- const n = Number(value);- return Number.isFinite(n) ? n : fallback;-}--/**- * Accept a color as a hex number (0xrrggbb), a '#rrggbb' string, or fall back.- * Kept tiny so the module has no THREE.Color dependency for parsing extras.- */-function parseColor(value, fallback) {- if (typeof value === 'number' && Number.isFinite(value)) return value;- if (typeof value === 'string') {- const hex = value.trim().replace(/^#/, '');- if (/^[0-9a-fA-F]{6}$/.test(hex)) return parseInt(hex, 16);- }- return fallback;-}diff --git a/src/game/arena/arena.js b/src/game/arena/arena.jsdeleted file mode 100644index e203f4c77..000000000--- a/src/game/arena/arena.js+++ /dev/null@@ -1,547 +0,0 @@-// Omniology Arena — world bootstrap.-//-// `OmniologyArena` owns the renderer, scene, camera, render loop, the local-// player controller (keyboard / on-screen joystick / drag-to-orbit camera), a-// placeholder lit environment, and an `update(dt)` registry that later prompts-// hook into. It deliberately does NOT touch multiplayer, avatars, or the-// Omniology contest feed — the entry module (omniology.js) wires those on top,-// and prompts 02–04 mount the venue GLB, the live screens, and the entry desk-// through `anchors` + `registerUpdatable`.-//-// Movement, camera, and input feel are matched 1:1 to the /play scene-// (coincommunities.js) so the arena reads as the same engine: MOVE_SPEED,-// RUN_SPEED, GRAVITY, JUMP_VELOCITY, the camera basis, and the joystick deadzone-// are the same constants. Avatar loading/animation is reused from the shared-// avatar-rig library by the entry module, not reinvented here.--import {- Scene, WebGLRenderer, PerspectiveCamera, Group, Vector3, Vector2,- PCFShadowMap, SRGBColorSpace, ACESFilmicToneMapping,- Color, Fog,- HemisphereLight, DirectionalLight, AmbientLight, PointLight,- Mesh, MeshStandardMaterial, MeshBasicMaterial,- CircleGeometry, RingGeometry, GridHelper,-} from 'three';-import { log } from '../../shared/log.js';-import { CLIP_IDLE, CLIP_WALK } from '../avatar-rig.js';-import { createArenaEnvironment } from './arena-environment.js';--// Locomotion + camera tuning, identical to /play so the two worlds feel the same.-export const MOVE_SPEED = 4.2;-export const RUN_SPEED = 8.0; // hold Shift to sprint-export const RUN_TIMESCALE = 1.7; // speed the walk cycle up so a sprint reads as a run-export const JUMP_VELOCITY = 5.5; // m/s upward kick on Space-export const GRAVITY = 15; // m/s^2 pulling the jumper back down-export const REMOTE_LERP = 0.18; // peer interpolation factor (used by RemotePlayer)-const JOY_DEADZONE = 0.12; // swallow tiny stick grazes so the avatar doesn't drift--// The walkable disc. A touch inside the server's 60m clamp so a local prediction-// never outruns the authoritative bound and snaps back. Prompt 02 replaces the-// placeholder floor + this bound with the venue GLB's real collision geometry.-const ARENA_RADIUS = 26;--// Default mount points. Prompt 02 resolves the real ones from the venue GLB's-// named empties and calls `setAnchors()`. Everything downstream (spawn, screens,-// desk) reads from here, so swapping in the venue is a single call — no consumer-// edits. Coordinates are a sensible authored layout: spawn near the back, three-// screens across the front wall, an entry desk to the right.-function defaultAnchors() {- return {- spawn: { position: new Vector3(0, 0, 8), rotationY: Math.PI },- screens: [- { position: new Vector3(-9, 4.2, -15), width: 7.5, rotationY: 0.32 },- { position: new Vector3(0, 4.6, -16.5), width: 9, rotationY: 0 },- { position: new Vector3(9, 4.2, -15), width: 7.5, rotationY: -0.32 },- ],- desk: { position: new Vector3(12, 0, 2), rotationY: -Math.PI / 2 },- lights: [],- };-}--export class OmniologyArena {- /** @param {HTMLCanvasElement} canvas */- constructor(canvas) {- this.canvas = canvas;- this.anchors = defaultAnchors();-- // Members registered via registerUpdatable() — each gets update(dt) per frame.- // 03/04 register their screen + desk handles here so they animate without- // editing this loop. A Set so a handle can unregister itself on dispose.- this._updatables = new Set();-- // Local player controller state, mirrored from coincommunities.js.- this.keys = new Set();- this._joy = null;- this.camYaw = 0.6; this.camPitch = 0.5; this.camDist = 9;- const spawn = this.anchors.spawn;- this.localPos = new Vector3(spawn.position.x, 0, spawn.position.z);- this.localYaw = spawn.rotationY;- this.motion = 'idle';- this.vy = 0;- this.grounded = true;- this._dragging = false; this._lastPtr = null; this._downPtr = null;- this._last = performance.now();- this._raf = 0;- this._disposed = false;-- // The local avatar rig is attached by the entry module once its GLB loads.- this.localRig = null;- this.localAnim = null;- this.localHeight = 1.7;-- // Venue mount state (prompt 02). `bounds` clamps the player to the authored- // footprint once the GLB resolves; `composer` is the bloom/ACES/vignette- // pipeline; `_intro` runs the GLB camera_intro dolly. `ready` resolves once- // the venue is mounted (or degrades to the placeholder on failure) — the- // entry awaits it before mounting screens/desk so they read venue anchors.- this.composer = null;- this.bounds = null;- this.profile = null;- this._intro = null;- this._playerMoved = false;- this._lookTmp = new Vector3();-- // Stable bound handlers so dispose() can remove every listener it added.- this._onResize = this._onResize.bind(this);- this._onKeyDown = this._onKeyDown.bind(this);- this._onKeyUp = this._onKeyUp.bind(this);- this._onPointerDown = this._onPointerDown.bind(this);- this._onPointerUp = this._onPointerUp.bind(this);- this._onPointerMove = this._onPointerMove.bind(this);- this._onWheel = this._onWheel.bind(this);- this._loop = this._loop.bind(this);-- this._initRenderer();- this._initScene();- this._buildEnvironment();- this._bindInput();- this._initJoystick();-- this._raf = requestAnimationFrame(this._loop);-- // Load + mount the authored venue GLB (prompt 02). Non-blocking: the- // placeholder above renders immediately while the venue streams in.- this.ready = this._mountVenue();- }-- // ---------------------------------------------------------------- renderer- _initRenderer() {- let r;- try {- r = new WebGLRenderer({ canvas: this.canvas, antialias: true });- } catch (err) {- // Blocklisted GPUs / disabled hardware acceleration / some embedded- // browsers. Tag it so the boot guard can show a recovery message instead- // of a dead loader.- const e = new Error('WebGL unavailable: ' + (err?.message || err));- e.code = 'NO_WEBGL';- throw e;- }- r.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));- r.setSize(window.innerWidth, window.innerHeight);- r.shadowMap.enabled = true;- r.shadowMap.type = PCFShadowMap;- r.outputColorSpace = SRGBColorSpace;- r.toneMapping = ACESFilmicToneMapping;- r.toneMappingExposure = 1.05;- this.renderer = r;- window.addEventListener('resize', this._onResize);- }-- _initScene() {- const scene = new Scene();- this.scene = scene;- // Cool near-black backdrop with matched fog so the floor melts into the- // horizon instead of ending at a hard edge — reads as a room, not a void.- this._skyColor = new Color(0x07080c);- scene.background = this._skyColor;- scene.fog = new Fog(this._skyColor.getHex(), 34, 96);-- this.camera = new PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 2000);- this.camera.position.set(0, 6, 16);- }-- // Placeholder lit environment: a dark technical floor with a hairline grid, a- // glowing boundary ring, soft venue accent lights, and a cool key light that- // casts shadows. Prompt 02 replaces all of this with the venue GLB — every- // object here is tracked in `_envObjects` so disposal is total.- _buildEnvironment() {- this._envObjects = [];- const track = (obj) => { this._envObjects.push(obj); return obj; };-- // Lighting rig.- const hemi = new HemisphereLight(0x9fb4ff, 0x05060a, 0.55);- this.scene.add(track(hemi));- const ambient = new AmbientLight(0xffffff, 0.18);- this.scene.add(track(ambient));-- const key = new DirectionalLight(0xdfe8ff, 1.55);- key.position.set(14, 26, 12);- key.castShadow = true;- key.shadow.mapSize.set(2048, 2048);- key.shadow.camera.near = 1;- key.shadow.camera.far = 90;- key.shadow.camera.left = -ARENA_RADIUS - 6;- key.shadow.camera.right = ARENA_RADIUS + 6;- key.shadow.camera.top = ARENA_RADIUS + 6;- key.shadow.camera.bottom = -ARENA_RADIUS - 6;- key.shadow.bias = -0.0004;- this.scene.add(track(key));- this._keyLight = key;-- // Warm-ish accent fills near the front screen wall so the space has depth and- // the screens (mounted in 03) sit in a pool of light, not flat dark.- const accentDefs = [- { x: -9, z: -13, color: 0x6ea8ff },- { x: 9, z: -13, color: 0x8a7bff },- ];- for (const def of accentDefs) {- const p = new PointLight(def.color, 22, 40, 2);- p.position.set(def.x, 6, def.z);- this.scene.add(track(p));- }-- // Floor: a wide dark disc that receives shadow.- const floorGeo = new CircleGeometry(ARENA_RADIUS + 30, 64);- const floorMat = new MeshStandardMaterial({ color: 0x0c0e14, roughness: 0.92, metalness: 0.05 });- const floor = new Mesh(floorGeo, floorMat);- floor.rotation.x = -Math.PI / 2;- floor.receiveShadow = true;- this.scene.add(track(floor));-- // Inner venue platform — a slightly lighter, slightly raised stage disc so the- // walkable area reads as an authored room within the larger ground.- const stageGeo = new CircleGeometry(ARENA_RADIUS, 64);- const stageMat = new MeshStandardMaterial({ color: 0x12151d, roughness: 0.8, metalness: 0.1 });- const stage = new Mesh(stageGeo, stageMat);- stage.rotation.x = -Math.PI / 2;- stage.position.y = 0.02;- stage.receiveShadow = true;- this.scene.add(track(stage));-- // Hairline technical grid over the stage.- const grid = new GridHelper(ARENA_RADIUS * 2, ARENA_RADIUS * 2, 0x2a3142, 0x161a24);- grid.position.y = 0.03;- grid.material.transparent = true;- grid.material.opacity = 0.45;- this.scene.add(track(grid));- this._grid = grid;-- // Glowing boundary ring at the walkable edge.- const ringGeo = new RingGeometry(ARENA_RADIUS - 0.25, ARENA_RADIUS, 96);- const ringMat = new MeshBasicMaterial({ color: 0x6ea8ff, transparent: true, opacity: 0.5, depthWrite: false });- const ring = new Mesh(ringGeo, ringMat);- ring.rotation.x = -Math.PI / 2;- ring.position.y = 0.04;- this.scene.add(track(ring));- this._ring = ring;- }-- // ----------------------------------------------------------------- anchors- // Replace the authored placeholder anchors with the venue GLB's resolved set- // (prompt 02). Merges so a partial set still keeps sensible defaults, and- // re-seats the player at the new spawn if they haven't moved yet.- setAnchors(next) {- if (!next) return;- this.anchors = {- spawn: next.spawn || this.anchors.spawn,- screens: Array.isArray(next.screens) ? next.screens : this.anchors.screens,- desk: next.desk || this.anchors.desk,- lights: Array.isArray(next.lights) ? next.lights : this.anchors.lights,- };- return this.anchors;- }-- // Move the local player to the current spawn anchor (called once the avatar is- // attached, and re-usable by 02 after the venue resolves its real spawn).- seatAtSpawn() {- const s = this.anchors.spawn;- if (!s) return;- this.localPos.set(s.position.x, 0, s.position.z);- this.localYaw = s.rotationY || 0;- this.vy = 0; this.grounded = true; this.motion = 'idle';- if (this.localRig) { this.localRig.position.copy(this.localPos); this.localRig.rotation.y = this.localYaw; }- }-- // --------------------------------------------------------------- updatables- // Register an object with an update(dt) method to be ticked each frame. Returns- // an unregister function. 03/04 hook their screen + desk handles here.- registerUpdatable(obj) {- if (!obj || typeof obj.update !== 'function') {- throw new Error('OmniologyArena.registerUpdatable: object needs an update(dt) method');- }- this._updatables.add(obj);- return () => this._updatables.delete(obj);- }-- // ------------------------------------------------------------ local avatar- // The entry module loads the local avatar via the shared avatar-rig library- // and hands the rig + animation manager here; the loop then drives its- // position, yaw, and idle/walk crossfade. Passing null detaches it.- attachLocalAvatar(rig, anim, height) {- this.localRig = rig || null;- this.localAnim = anim || null;- this.localHeight = height || 1.7;- if (this.localRig) {- this.localRig.position.copy(this.localPos);- this.localRig.rotation.y = this.localYaw;- if (!this.localRig.parent) this.scene.add(this.localRig);- }- }-- // The authoritative local state to stream to peers (CommunityNet.sendMove).- getLocalState() {- return {- x: this.localPos.x, y: this.localPos.y, z: this.localPos.z,- yaw: this.localYaw, motion: this.motion,- };- }-- // Project a world point to CSS pixels for DOM overlays (nameplates, bubbles).- // Returns { x, y, visible }. Shared by RemotePlayer for label placement.- project(worldVec, into = null) {- const v = (into || new Vector3()).copy(worldVec).project(this.camera);- const w = this.renderer.domElement.clientWidth;- const h = this.renderer.domElement.clientHeight;- return {- x: (v.x * 0.5 + 0.5) * w,- y: (-v.y * 0.5 + 0.5) * h,- visible: v.z > -1 && v.z < 1,- };- }-- // --------------------------------------------------------------- input- _bindInput() {- window.addEventListener('keydown', this._onKeyDown);- window.addEventListener('keyup', this._onKeyUp);- this.canvas.addEventListener('pointerdown', this._onPointerDown);- window.addEventListener('pointerup', this._onPointerUp);- window.addEventListener('pointermove', this._onPointerMove);- this.canvas.addEventListener('wheel', this._onWheel, { passive: false });- }-- _onKeyDown(e) {- // Don't steal typing focus from any future HUD input.- const t = e.target;- if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;- if (e.code === 'Space') { e.preventDefault(); this._jump(); return; }- this.keys.add(e.key.toLowerCase());- }- _onKeyUp(e) { this.keys.delete(e.key.toLowerCase()); }-- _onPointerDown(e) {- this._dragging = true;- this._lastPtr = { x: e.clientX, y: e.clientY };- }- _onPointerUp() { this._dragging = false; }- _onPointerMove(e) {- if (!this._dragging || !this._lastPtr) return;- const dx = e.clientX - this._lastPtr.x, dy = e.clientY - this._lastPtr.y;- this._lastPtr = { x: e.clientX, y: e.clientY };- this.camYaw -= dx * 0.005;- this.camPitch = Math.max(0.1, Math.min(1.2, this.camPitch + dy * 0.004));- }- _onWheel(e) {- e.preventDefault();- this.camDist = Math.max(4, Math.min(20, this.camDist * (e.deltaY > 0 ? 1.1 : 0.9)));- }-- // Self-contained pointer-events joystick (touch + mouse-drag) — same contract- // and deadzone as /play, no external lib. Sums with WASD in _stepLocal.- _initJoystick() {- const zone = document.getElementById('cc-joystick');- if (!zone) return;- this._joyZone = zone;- const base = document.createElement('div');- base.className = 'cc-joy-base';- const thumb = document.createElement('div');- thumb.className = 'cc-joy-thumb';- base.appendChild(thumb);- zone.appendChild(base);- this._joyNodes = [base, thumb];-- const RADIUS = 48;- let activeId = null;- const setFromPointer = (clientX, clientY) => {- const r = base.getBoundingClientRect();- const cx = r.left + r.width / 2, cy = r.top + r.height / 2;- let dx = (clientX - cx) / RADIUS, dy = (clientY - cy) / RADIUS;- const m = Math.hypot(dx, dy);- if (m > 1) { dx /= m; dy /= m; }- thumb.style.transform = `translate(${dx * RADIUS}px, ${dy * RADIUS}px)`;- const mag = Math.min(1, m);- if (mag < JOY_DEADZONE) { this._joy = null; return; }- const k = (mag - JOY_DEADZONE) / (1 - JOY_DEADZONE) / mag;- this._joy = { x: dx * k, z: dy * k };- };- const release = () => {- activeId = null; this._joy = null;- thumb.style.transform = 'translate(0px, 0px)';- zone.classList.remove('cc-joy-active');- };- const onDown = (e) => {- activeId = e.pointerId;- zone.setPointerCapture(e.pointerId);- zone.classList.add('cc-joy-active');- setFromPointer(e.clientX, e.clientY);- e.preventDefault();- };- const onMove = (e) => { if (e.pointerId === activeId) { setFromPointer(e.clientX, e.clientY); e.preventDefault(); } };- const onUp = (e) => { if (e.pointerId === activeId) release(); };- zone.addEventListener('pointerdown', onDown);- zone.addEventListener('pointermove', onMove);- zone.addEventListener('pointerup', onUp);- zone.addEventListener('pointercancel', onUp);- zone.addEventListener('lostpointercapture', onUp);- // Kept for teardown.- this._joyHandlers = { onDown, onMove, onUp };- }-- _jump() {- if (!this.grounded) return;- this.vy = JUMP_VELOCITY;- this.grounded = false;- }-- // ---------------------------------------------------------------- loop- _loop() {- this._raf = requestAnimationFrame(this._loop);- const now = performance.now();- const dt = Math.min(0.05, (now - this._last) / 1000);- this._last = now;-- this._stepLocal(dt);- this.localAnim?.update(dt);- for (const u of this._updatables) {- try { u.update(dt); } catch (err) { log.warn('[arena] updatable threw:', err?.message); }- }- this._updateCamera();- this.renderer.render(this.scene, this.camera);- }-- _stepLocal(dt) {- // Vertical integration first so a jump arcs even while standing still.- if (!this.grounded) {- this.vy -= GRAVITY * dt;- this.localPos.y += this.vy * dt;- if (this.localPos.y <= 0) { this.localPos.y = 0; this.vy = 0; this.grounded = true; }- }-- // Movement intent from keys + joystick, mapped into the camera's basis so the- // controls read screen-relative (W goes away from the camera, D tracks right).- let ix = 0, iz = 0;- if (this.keys.has('w') || this.keys.has('arrowup')) iz -= 1;- if (this.keys.has('s') || this.keys.has('arrowdown')) iz += 1;- if (this.keys.has('a') || this.keys.has('arrowleft')) ix -= 1;- if (this.keys.has('d') || this.keys.has('arrowright')) ix += 1;- if (this._joy) { ix += this._joy.x; iz += this._joy.z; }- const running = this.keys.has('shift');- const mag = Math.hypot(ix, iz);- if (mag > 0.05) {- ix /= Math.max(1, mag); iz /= Math.max(1, mag);- const sin = Math.sin(this.camYaw), cos = Math.cos(this.camYaw);- const wx = ix * cos - iz * sin;- const wz = -ix * sin - iz * cos;- const speed = running ? RUN_SPEED : MOVE_SPEED;- this.localPos.x += wx * speed * dt;- this.localPos.z += wz * speed * dt;- const r = Math.hypot(this.localPos.x, this.localPos.z);- if (r > ARENA_RADIUS) { this.localPos.x *= ARENA_RADIUS / r; this.localPos.z *= ARENA_RADIUS / r; }- this.localYaw = Math.atan2(wx, wz);- const want = running ? 'run' : 'walk';- if (this.motion !== want) { this.motion = want; this.localAnim?.crossfadeTo(CLIP_WALK, 0.18); }- } else if (this.motion !== 'idle') {- this.motion = 'idle';- this.localAnim?.crossfadeTo(CLIP_IDLE, 0.2);- }- // Drive the walk cycle faster while sprinting so it reads as a run.- if (this.localAnim?.currentName === CLIP_WALK) {- this.localAnim.setSpeed(this.motion === 'run' ? RUN_TIMESCALE : 1);- }- if (this.localRig) { this.localRig.position.copy(this.localPos); this.localRig.rotation.y = this.localYaw; }- }-- _updateCamera() {- // Track the avatar on the ground plane only — ignore jump height so the- // camera stays planted while the character hops.- const tx = this.localPos.x, tz = this.localPos.z;- const cp = Math.cos(this.camPitch), sp = Math.sin(this.camPitch);- const ox = Math.sin(this.camYaw) * cp * this.camDist;- const oz = Math.cos(this.camYaw) * cp * this.camDist;- const oy = sp * this.camDist + 1.4;- this.camera.position.set(tx - ox, oy, tz - oz);- this.camera.lookAt(tx, 1.4, tz);- }-- _onResize() {- this.camera.aspect = window.innerWidth / window.innerHeight;- this.camera.updateProjectionMatrix();- this.renderer.setSize(window.innerWidth, window.innerHeight);- }-- // ---------------------------------------------------------------- teardown- // Full teardown modeled on coincommunities.js leave(): stop the loop, drop every- // listener, dispose all GPU resources (geometry/material/texture), and free the- // renderer so navigating away leaks nothing. The entry module disposes its own- // net + avatars first, then calls this.- dispose() {- if (this._disposed) return;- this._disposed = true;-- cancelAnimationFrame(this._raf);- this._raf = 0;-- window.removeEventListener('resize', this._onResize);- window.removeEventListener('keydown', this._onKeyDown);- window.removeEventListener('keyup', this._onKeyUp);- window.removeEventListener('pointerup', this._onPointerUp);- window.removeEventListener('pointermove', this._onPointerMove);- this.canvas.removeEventListener('pointerdown', this._onPointerDown);- this.canvas.removeEventListener('wheel', this._onWheel);-- // Joystick listeners + DOM.- if (this._joyZone && this._joyHandlers) {- const z = this._joyZone, h = this._joyHandlers;- z.removeEventListener('pointerdown', h.onDown);- z.removeEventListener('pointermove', h.onMove);- z.removeEventListener('pointerup', h.onUp);- z.removeEventListener('pointercancel', h.onUp);- z.removeEventListener('lostpointercapture', h.onUp);- }- for (const n of this._joyNodes || []) n.remove();- this._joyNodes = null; this._joyHandlers = null;-- this._updatables.clear();-- // Detach (but don't dispose) the local avatar — the entry module owns it.- if (this.localRig?.parent) this.localRig.parent.remove(this.localRig);- this.localRig = null; this.localAnim = null;-- // Dispose every GPU resource still in the scene graph.- const seenMat = new Set();- const disposeMaterial = (m) => {- if (!m || seenMat.has(m)) return;- seenMat.add(m);- for (const k of ['map', 'normalMap', 'roughnessMap', 'metalnessMap', 'emissiveMap', 'aoMap', 'alphaMap', 'envMap']) {- m[k]?.dispose?.();- }- m.dispose?.();- };- this.scene?.traverse((obj) => {- obj.geometry?.dispose?.();- const mat = obj.material;- if (Array.isArray(mat)) mat.forEach(disposeMaterial); else disposeMaterial(mat);- });- // GridHelper materials/geometry live outside the standard mesh fields above.- this._grid?.geometry?.dispose?.();- if (this._grid) { (Array.isArray(this._grid.material) ? this._grid.material : [this._grid.material]).forEach((m) => m?.dispose?.()); }- this.scene?.clear?.();- this._envObjects = null;-- this.renderer?.dispose?.();- this.renderer?.forceContextLoss?.();- this.renderer = null;- this.scene = null;- this.camera = null;- }-}diff --git a/src/game/arena/atelier-adapter.js b/src/game/arena/atelier-adapter.jsdeleted file mode 100644index e4436deac..000000000--- a/src/game/arena/atelier-adapter.js+++ /dev/null@@ -1,250 +0,0 @@-// Atelier adapter — the ONLY module that knows Atelier's marketplace wire shapes.-//-// Atelier (atelierai.xyz) is a "hire an AI agent" marketplace settling in USDC on-// Solana/Base, with x402 as its native agent-to-agent rail. three.ws registers-// into that economy as the 3D/avatar specialist; the Atelier World renders the-// marketplace as a walkable plaza where each agent is a booth you walk up to and-// hire. This adapter is the boundary: it reads the configured base URL, fetches-// the raw agent registry, and normalizes it into the camelCase shape the rest of-// the world consumes (atelier-plaza.js). Everything downstream speaks-// NormalizedRoster / NormalizedAgent only — so swapping the real base URL, or-// adapting to a wire-shape change, is a one-file edit here.-//-// No mocks, ever (CLAUDE.md): when no base URL is configured, fetchRoster()-// surfaces an explicit `unconfigured` status — it NEVER fabricates marketplace-// agents. The one always-present booth is the real three.ws 3D Studio (see-// STUDIO_AGENT), which is a live product surface, not sample data.--// ── config ───────────────────────────────────────────────────────────────────--/**- * Resolve Atelier's base URL (no trailing slash) from, in priority order:- * 1. window.ATELIER_BASE — runtime override (tests / embeds)- * 2. <meta name="atelier-base"> — baked into the world page- * 3. VITE_ATELIER_BASE — build-time env- * Returns '' when nothing is configured, which fetchRoster() treats as the- * designed "unconfigured" state rather than an error.- * @returns {string}- */-export function atelierBase() {- if (typeof window !== 'undefined' && window.ATELIER_BASE) {- return clean(window.ATELIER_BASE);- }- if (typeof document !== 'undefined') {- const v = document.querySelector('meta[name="atelier-base"]')?.getAttribute('content');- if (v && v.trim()) return clean(v);- }- try {- const env = import.meta?.env?.VITE_ATELIER_BASE;- if (env) return clean(String(env));- } catch { /* import.meta unavailable outside a bundler (e.g. node tests) */ }- return '';-}--function clean(url) {- return String(url).trim().replace(/\/+$/, '');-}--// ── the always-present three.ws booth ──────────────────────────────────────────--/**- * The three.ws 3D Studio — three.ws's own listing in the Atelier economy, the- * "make it 3D / make it move" specialist. Always rendered in the plaza (it's a- * real product surface: the forge), so the world is never empty and the strategy- * — three.ws registered as Atelier's 3D agent — is tangible the moment you walk- * in. `featured` floats it to the central dais; `internal` routes "hire" to the- * forge rather than the external x402 flow.- * @type {NormalizedAgent}- */-export const STUDIO_AGENT = Object.freeze({- id: 'threews-studio',- name: 'three.ws 3D Studio',- tagline: 'Turn any character into a rigged, animated 3D avatar.',- specialty: '3D · Avatars · Rigging',- avatarUrl: '',- priceUsdc: 0,- pricePeriod: 'free lane + paid tiers',- rating: null,- jobsDone: null,- hireUrl: '/forge',- featured: true,- internal: true,-});--// ── read: agent roster ──────────────────────────────────────────────────────────--/**- * GET {base}/v1/agents and normalize to NormalizedRoster.- *- * - Unconfigured (no base URL): resolves to a roster with `ok:false`,- * `reason:'unconfigured'`, and just the STUDIO_AGENT — never fabricated- * marketplace agents. The plaza renders its "connecting to Atelier" empty- * state around the studio dais.- * - Network / HTTP error: THROWS (the poller catches it and drives the designed,- * auto-retrying error state).- *- * @returns {Promise<NormalizedRoster>}- */-export async function fetchRoster() {- const base = atelierBase();- if (!base) return unconfiguredRoster();-- const res = await fetch(`${base}/v1/agents`, {- headers: { accept: 'application/json' },- });- if (!res.ok) throw new Error(`Atelier roster HTTP ${res.status}`);- const data = await res.json();- return normalizeRoster(data, base);-}--/**- * Normalize Atelier's wire roster (snake_case, unix seconds) into the world's- * internal shape (camelCase, ms). Exported so the adapter's contract is unit- * testable without a live endpoint. Tolerant of nulls: an unknown field becomes- * null/empty, never invented. The STUDIO_AGENT is always prepended.- *- * @param {object} data- * @param {string} [base] resolved base URL, used to absolutize relative hire paths- * @returns {NormalizedRoster}- */-export function normalizeRoster(data, base = '') {- const d = data || {};- const serverNowMs = secToMs(d.now_unix) ?? nowMs();- const agents = asArray(d.agents)- .map((a) => normalizeAgent(a, base))- .filter(Boolean);- return {- ok: true,- reason: null,- serverNowMs,- agents: [STUDIO_AGENT, ...agents],- };-}--/**- * Normalize a single wire agent. Returns null for an entry with no id (it can't- * be hired or addressed, so it's dropped rather than rendered as a dead booth).- * @param {object} a- * @param {string} [base]- * @returns {NormalizedAgent|null}- */-export function normalizeAgent(a, base = '') {- if (!a || a.id == null) return null;- const id = str(a.id);- const hire = str(a.hire_url);- return {- id,- name: str(a.name) || 'Untitled agent',- tagline: str(a.tagline) || '',- specialty: str(a.specialty) || '',- avatarUrl: httpsUrl(a.avatar_url),- priceUsdc: num(a.price_usdc) ?? 0,- pricePeriod: str(a.price_period) || 'per task',- rating: num(a.rating),- jobsDone: num(a.jobs_done),- // Absolutize a relative hire path against the base; keep an absolute https- // URL as-is; default to the canonical per-agent hire route.- hireUrl: hire- ? absolutize(hire, base)- : (base ? `${base}/v1/agents/${encodeURIComponent(id)}/hire` : ''),- featured: !!a.featured,- internal: false,- };-}--function unconfiguredRoster() {- return {- ok: false,- reason: 'unconfigured',- serverNowMs: nowMs(),- agents: [STUDIO_AGENT],- };-}--// ── write: hire an agent (consumed by the plaza's hire card) ────────────────────--/**- * Build the exact request the hire card hands to `POST /api/x402-pay` for the- * server-side x402 flow. The payer signs the 402 challenge → retries; this only- * describes the target request. The paying agentId is attached by the caller.- *- * Returns null for the internal studio agent (it routes to the forge, not x402)- * or any agent missing a hire URL, so the caller can branch cleanly.- *- * @param {NormalizedAgent} agent- * @param {object} [brief] optional buyer brief forwarded to Atelier- * @returns {{ url:string, method:'POST', body:{ brief:object } }|null}- */-export function hireRequest(agent, brief) {- if (!agent || agent.internal || !agent.hireUrl) return null;- return {- url: agent.hireUrl,- method: 'POST',- body: { brief: brief ?? {} },- };-}--// ── coercion helpers (defensive: the feed is external) ─────────────────────────--function nowMs() { return Date.now(); }--function num(v) {- if (v == null) return null;- const n = Number(v);- return Number.isFinite(n) ? n : null;-}--function str(v) {- return v == null ? '' : String(v);-}--function secToMs(v) {- const n = num(v);- return n == null ? null : Math.round(n * 1000);-}--function asArray(v) {- return Array.isArray(v) ? v : [];-}--// Only surface CORS-readable HTTPS avatar URLs; anything else (http, data:, junk)-// becomes '' so the booth renders its designed monogram fallback instead of a-// broken model/image.-function httpsUrl(v) {- const s = str(v).trim();- return /^https:\/\//i.test(s) ? s : '';-}--// Resolve a possibly-relative hire path against the base. An absolute https URL-// passes through; a '/path' joins onto the base; anything unpar+seable is dropped.-function absolutize(u, base) {- const s = str(u).trim();- if (/^https:\/\//i.test(s)) return s;- if (!base) return '';- if (s.startsWith('/')) return `${base}${s}`;- return `${base}/${s}`;-}--/**- * @typedef {object} NormalizedAgent- * @property {string} id- * @property {string} name- * @property {string} tagline- * @property {string} specialty- * @property {string} avatarUrl '' when none / not https- * @property {number} priceUsdc- * @property {string} pricePeriod- * @property {number|null} rating- * @property {number|null} jobsDone- * @property {string} hireUrl absolute https URL, or '' / internal route- * @property {boolean} featured floats to the central dais- * @property {boolean} internal routes hire to a three.ws surface, not x402- */--/**- * @typedef {object} NormalizedRoster- * @property {boolean} ok true on a real feed, false when unconfigured- * @property {string|null} reason 'unconfigured' when ok is false, else null- * @property {number} serverNowMs- * @property {NormalizedAgent[]} agents STUDIO_AGENT first, then marketplace agents- */diff --git a/src/game/arena/atelier-plaza.js b/src/game/arena/atelier-plaza.jsdeleted file mode 100644index 23844209e..000000000--- a/src/game/arena/atelier-plaza.js+++ /dev/null@@ -1,574 +0,0 @@-// 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, 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)--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);- 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('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(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(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(settled, result);- } catch (e) {- log.warn('[atelier] hire failed', e?.message);- this._flow('error', e?.message || 'Hire failed. Try again.');- if (hireBtn) { hireBtn.disabled = false; hireBtn.textContent = 'Retry — pay in USDC'; }- } finally {- this._hireBusy = false;- }- }-- _flowEl() {- const el = this._overlay?.querySelector('.atl-flow');- if (el) el.hidden = false;- return el;- }- _flow(kind, msg) {- const el = this._flowEl();- if (!el) return;- el.className = `atl-flow atl-flow-${kind}`;- el.textContent = msg;- }- _flowStepper(stages, active) {- const el = this._flowEl();- 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(settled, result) {- const el = this._flowEl();- 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) {- 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) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[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.jsdeleted file mode 100644index 2e6805604..000000000--- a/src/game/arena/atelier.js+++ /dev/null@@ -1,296 +0,0 @@-// 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/contest-screen.js b/src/game/arena/contest-screen.jsdeleted file mode 100644index 791f083ea..000000000--- a/src/game/arena/contest-screen.js+++ /dev/null@@ -1,611 +0,0 @@-// Contest Screen — a live in-world jumbotron for an Omniology contest.-//-// The Arena's walls carry physical LED screens that show Omniology's live-// contests: the current round with its ~88-second countdown, a leaderboard, the-// recent winners, and a live ticker of entries landing in real time. Each screen-// is an HTML canvas wrapped in a CanvasTexture on an unlit plane — a real object-// in the 3D world you can walk up to and click, not a DOM overlay. The canvas-// repaints in place (~10fps) as the countdown ticks and the feed updates.-//-// This generalizes src/game/chart-screen.js: same CanvasTexture-on-PlaneGeometry-// rig, same poll-driven state machine, same designed loading / live / empty /-// error states — adapted to contests. One component handles all three wall roles-// (now-playing, leaderboard, winners) via the `role` option; the dominant panel-// changes per role but every screen shares the header, LIVE badge, countdown, and-// ticker. Data is real, normalized by omniology-adapter.js — no mocks (CLAUDE.md).-//-// Contract: docs/omniology-arena/CONTRACTS.md §2.2.--import {- Group, Mesh, MeshBasicMaterial, MeshStandardMaterial,- PlaneGeometry, BoxGeometry,- CanvasTexture, SRGBColorSpace, DoubleSide,-} from 'three';--const CW = 1280, CH = 720; // 16:9 canvas backing the screen-const REDRAW_MS = 100; // ~10fps redraw — smooth ticker, cheap on the GPU-const TICKER_CAP = 24; // recent entries kept for the scrolling ticker-const SWEEP_S = 1.4; // "NEW ROUND" sweep duration when the round flips--// Restrained, premium palette — light-on-near-black to match the world UI, with a-// single directional accent that shifts as the countdown runs low.-const COL = {- bg0: '#08080b', bg1: '#101015',- panel: 'rgba(255,255,255,0.04)',- stroke: 'rgba(255,255,255,0.10)',- grid: 'rgba(255,255,255,0.06)',- text: '#f5f5f6', dim: '#9a9aa2', faint: '#5a5a62',- live: '#5fd08a', warn: '#f2c14e', danger: '#e06c75',- accent: '#7cc4ff',-};--// ── pure helpers (exported for unit tests — no canvas/DOM needed) ───────────────--/**- * Format a millisecond duration as a contest clock: M:SS, floored at 0:00.- * @param {number|null} ms- * @returns {string}- */-export function formatCountdown(ms) {- if (ms == null || !Number.isFinite(ms)) return '—:—';- const total = Math.max(0, Math.floor(ms / 1000));- const m = Math.floor(total / 60);- const s = total % 60;- return `${m}:${String(s).padStart(2, '0')}`;-}--/**- * Countdown accent: calm → amber → red as the round closes. Thresholds are tuned- * to the ~88s cadence (last 18s warn, last 8s danger).- * @param {number|null} remainingMs- * @returns {string}- */-export function countdownColor(remainingMs) {- if (remainingMs == null || !Number.isFinite(remainingMs)) return COL.dim;- if (remainingMs <= 8000) return COL.danger;- if (remainingMs <= 18000) return COL.warn;- return COL.live;-}--/**- * Merge incoming ticker entries (newest-first) ahead of the existing buffer,- * deduped by entryId, capped. Optimistic inserts (from the desk) and feed entries- * both flow through here so the ticker never double-counts a submission.- * @param {Array} existing current buffer (newest-first)- * @param {Array} incoming new entries to fold in- * @param {number} [cap]- * @returns {Array}- */-export function mergeTicker(existing, incoming, cap = TICKER_CAP) {- const out = [];- const seen = new Set();- for (const e of [...incoming, ...existing]) {- if (!e) continue;- const key = e.entryId || `${e.agent}:${e.submittedMs}`;- if (seen.has(key)) continue;- seen.add(key);- out.push(e);- }- out.sort((a, b) => (b.submittedMs || 0) - (a.submittedMs || 0));- return out.slice(0, cap);-}--function fmtUsdc(v) {- const n = Number(v);- if (!Number.isFinite(n) || n <= 0) return '—';- if (n >= 1000) return '$' + n.toLocaleString('en-US', { maximumFractionDigits: 0 });- return '$' + n.toFixed(n < 10 ? 2 : 1);-}--function fmtScore(v) {- const n = Number(v);- if (!Number.isFinite(n)) return '—';- return n <= 1 ? n.toFixed(3) : n.toFixed(1);-}--function relTime(ms, now) {- const s = Math.max(0, Math.round((now - ms) / 1000));- if (s < 4) return 'now';- if (s < 60) return s + 's';- const m = Math.round(s / 60);- return m < 60 ? m + 'm' : Math.round(m / 60) + 'h';-}--function ellipsize(ctx, text, maxW) {- if (ctx.measureText(text).width <= maxW) return text;- let t = text;- while (t.length > 1 && ctx.measureText(t + '…').width > maxW) t = t.slice(0, -1);- return t + '…';-}--function roundRect(ctx, x, y, w, h, r) {- const rr = Math.min(r, w / 2, h / 2);- ctx.beginPath();- ctx.moveTo(x + rr, y);- ctx.arcTo(x + w, y, x + w, y + h, rr);- ctx.arcTo(x + w, y + h, x, y + h, rr);- ctx.arcTo(x, y + h, x, y, rr);- ctx.arcTo(x, y, x + w, y, rr);- ctx.closePath();-}--function monogram(name) {- const s = String(name || '?').trim();- return (s[0] || '?').toUpperCase();-}--// ── factory ────────────────────────────────────────────────────────────────────--/**- * Build a live contest screen and add it to the scene.- * @param {THREE.Scene} scene- * @param {{position:[number,number,number]|{x,y,z}, width?:number, rotationY?:number, role?:'now'|'leaderboard'|'winners', frame?:boolean}} opts- * @returns {{group, mesh, role, update, applyFeed, pushEntry, setStatus, openExternal, dispose}}- */-export function createContestScreen(scene, opts = {}) {- const role = opts.role === 'leaderboard' || opts.role === 'winners' ? opts.role : 'now';- const width = opts.width || 12;- const height = (width * CH) / CW;- const rotationY = opts.rotationY || 0;- const pos = toXYZ(opts.position, [0, 0, 0]);-- const group = new Group();- group.position.set(pos[0], pos[1], pos[2]);- group.rotation.y = rotationY;-- // Optional bezel + posts so a free-standing screen reads as a real rig. When a- // venue wall already frames the panel (the common Arena case), pass frame:false- // to mount just the lit face flush to the wall.- if (opts.frame !== false) {- const bezel = new Mesh(- new BoxGeometry(width + 0.5, height + 0.5, 0.3),- new MeshStandardMaterial({ color: 0x050506, roughness: 0.4, metalness: 0.7 }),- );- bezel.position.set(0, 0, -0.18);- bezel.castShadow = true;- group.add(bezel);- }-- // Live face: canvas → CanvasTexture → unlit plane (glows like an LED wall).- const canvas = document.createElement('canvas');- canvas.width = CW; canvas.height = CH;- const ctx = canvas.getContext('2d');- const tex = new CanvasTexture(canvas);- tex.colorSpace = SRGBColorSpace;- tex.anisotropy = 4;- const panel = new Mesh(- new PlaneGeometry(width, height),- new MeshBasicMaterial({ map: tex, side: DoubleSide, toneMapped: false }),- );- panel.userData.contestScreen = true; // raycast tag- group.add(panel);-- scene.add(group);-- // ── live state ──────────────────────────────────────────────────────────────- let feed = null; // latest NormalizedFeed- let status = 'loading'; // loading | live | empty | error | unconfigured- let ticker = []; // newest-first entry buffer for the scroll- let thumbs = new Map(); // entryId → HTMLImageElement (lazy, CORS-safe)- let skewMs = 0; // serverNow - clientNow at last applyFeed (drift)- let closesMs = null; // current round close (server clock)- let lastRound = null; // for round-flip detection- let sweepT = 0; // remaining "NEW ROUND" sweep seconds- let t = 0; // elapsed seconds (pulse + ticker scroll)- let acc = 0; // redraw accumulator- let destroyed = false;-- function correctedNow() { return Date.now() + skewMs; }- function remainingMs() { return closesMs == null ? null : closesMs - correctedNow(); }-- // Lazily load a leaderboard thumbnail; the row renders its monogram until the- // image lands, and silently keeps the monogram if the load is blocked.- function ensureThumb(entryId, url) {- if (!url || thumbs.has(entryId)) return;- const im = new Image();- im.crossOrigin = 'anonymous';- im.referrerPolicy = 'no-referrer';- im.onload = () => { thumbs.set(entryId, im); };- im.onerror = () => { thumbs.set(entryId, null); };- thumbs.set(entryId, null); // reserve the slot so we don't re-request- im.src = url;- }-- // ── public surface ────────────────────────────────────────────────────────- function applyFeed(next) {- if (!next) return;- feed = next;- skewMs = Number(next.serverNowMs) - Date.now();-- if (next.ok === false) {- status = next.reason === 'unconfigured' ? 'unconfigured' : 'error';- closesMs = null;- return;- }-- const cur = next.current;- closesMs = cur ? cur.closesMs : null;-- // Round flip → trigger the "NEW ROUND" sweep (skip the very first feed).- if (cur && cur.round != null && lastRound != null && cur.round !== lastRound) {- sweepT = SWEEP_S;- ticker = []; // a fresh round starts its ticker clean- }- if (cur && cur.round != null) lastRound = cur.round;-- // Fold the feed's recent entries into the ticker (dedupe vs optimistic).- ticker = mergeTicker(ticker, next.recentEntries || [], TICKER_CAP);- for (const e of next.leaderboard || []) ensureThumb(e.entryId, e.thumbUrl);-- status = cur ? 'live' : 'empty';- }-- // Optimistic ticker insert, called by the entry desk (prompt 04) the instant a- // submission settles — so the submitter sees their entry before the next poll.- function pushEntry(entry) {- if (!entry) return;- const e = {- entryId: entry.entryId || `local:${Math.round(correctedNow())}`,- agent: entry.agent || 'you',- submittedMs: entry.submittedMs || correctedNow(),- optimistic: true,- };- ticker = mergeTicker(ticker, [e], TICKER_CAP);- }-- function setStatus(s) {- if (['loading', 'live', 'empty', 'error', 'unconfigured'].includes(s)) status = s;- }-- // ── rendering ───────────────────────────────────────────────────────────────- function paintBackground() {- const bg = ctx.createLinearGradient(0, 0, 0, CH);- bg.addColorStop(0, COL.bg1); bg.addColorStop(1, COL.bg0);- ctx.fillStyle = bg; ctx.fillRect(0, 0, CW, CH);- // subtle vignette frame- ctx.strokeStyle = COL.stroke; ctx.lineWidth = 2;- ctx.strokeRect(10, 10, CW - 20, CH - 20);- }-- function paintHeader() {- const padX = 44;- const cur = feed?.current;- ctx.textAlign = 'left'; ctx.textBaseline = 'alphabetic';-- // Role label + contest title.- const roleLabel = role === 'leaderboard' ? 'LEADERBOARD' : role === 'winners' ? 'PAST WINNERS' : 'NOW PLAYING';- ctx.fillStyle = COL.accent;- ctx.font = '800 18px Inter, system-ui, sans-serif';- ctx.fillText(roleLabel, padX, 44);-- ctx.fillStyle = COL.text;- ctx.font = '800 34px Inter, system-ui, sans-serif';- const title = cur ? cur.title : 'Omniology Arena';- ctx.fillText(ellipsize(ctx, title.toUpperCase(), 720), padX, 80);-- if (cur && cur.round != null) {- ctx.fillStyle = COL.dim;- ctx.font = '600 20px Inter, system-ui, sans-serif';- ctx.fillText(`ROUND ${cur.round}`, padX, 108);- }-- // LIVE / status badge (top-right), pulsing dot.- const pulse = 0.5 + 0.5 * Math.sin(t * 4);- const label = status === 'live' ? 'LIVE'- : status === 'error' ? 'RECONNECTING'- : status === 'unconfigured' ? 'CONNECTING'- : status === 'empty' ? 'STANDBY'- : '···';- ctx.font = '700 18px Inter, system-ui, sans-serif';- const badgeW = ctx.measureText(label).width + 64;- const bx = CW - padX - badgeW, by = 26, bh = 40;- roundRect(ctx, bx, by, badgeW, bh, 20);- ctx.fillStyle = COL.panel; ctx.fill();- ctx.strokeStyle = COL.stroke; ctx.lineWidth = 1; ctx.stroke();- ctx.beginPath();- ctx.arc(bx + 26, by + bh / 2, 6, 0, Math.PI * 2);- const dot = status === 'live' ? `rgba(95,208,138,${pulse})`- : status === 'error' ? COL.danger- : status === 'unconfigured' ? `rgba(124,196,255,${pulse})`- : COL.faint;- ctx.fillStyle = dot; ctx.fill();- ctx.fillStyle = COL.text;- ctx.fillText(label, bx + 44, by + 26);- }-- // Big countdown block, shared by the now-playing role and used compact in headers.- function paintCountdown(x, y, scale = 1) {- const rem = remainingMs();- const col = countdownColor(rem);- ctx.textAlign = 'left'; ctx.textBaseline = 'alphabetic';- ctx.fillStyle = COL.faint;- ctx.font = `700 ${Math.round(16 * scale)}px Inter, system-ui, sans-serif`;- ctx.fillText('CLOSES IN', x, y - Math.round(70 * scale));- ctx.fillStyle = col;- ctx.font = `800 ${Math.round(120 * scale)}px "SF Mono", ui-monospace, Menlo, monospace`;- const txt = formatCountdown(rem);- ctx.fillText(txt, x, y);- // thin progress arc-ish bar under the clock showing the ~88s drain- if (closesMs != null && feed?.current?.opensMs != null) {- const dur = Math.max(1, closesMs - feed.current.opensMs);- const frac = Math.max(0, Math.min(1, (rem ?? 0) / dur));- const w = ctx.measureText(txt).width;- const barY = y + Math.round(18 * scale), barH = Math.round(8 * scale);- roundRect(ctx, x, barY, w, barH, barH / 2); ctx.fillStyle = COL.grid; ctx.fill();- roundRect(ctx, x, barY, w * frac, barH, barH / 2); ctx.fillStyle = col; ctx.fill();- }- }-- function paintStatChip(x, y, w, label, value, accent) {- roundRect(ctx, x, y, w, 92, 14);- ctx.fillStyle = COL.panel; ctx.fill();- ctx.strokeStyle = COL.stroke; ctx.lineWidth = 1; ctx.stroke();- ctx.fillStyle = COL.faint; ctx.font = '700 15px Inter, system-ui, sans-serif';- ctx.fillText(label, x + 18, y + 30);- ctx.fillStyle = accent || COL.text; ctx.font = '800 40px Inter, system-ui, sans-serif';- ctx.fillText(value, x + 18, y + 74);- }-- function paintLeaderboardRows(x, y, w, rows, maxRows, compact) {- const rh = compact ? 52 : 64;- if (!rows.length) {- ctx.fillStyle = COL.dim; ctx.font = '600 22px Inter, system-ui, sans-serif';- ctx.fillText('No scored entries yet this round.', x, y + 40);- return;- }- rows.slice(0, maxRows).forEach((e, i) => {- const ry = y + i * rh;- // rank pill- ctx.fillStyle = i === 0 ? COL.warn : i === 1 ? COL.dim : i === 2 ? '#c98a5a' : COL.faint;- ctx.font = `800 ${compact ? 22 : 26}px Inter, system-ui, sans-serif`;- ctx.textAlign = 'right';- ctx.fillText(String(e.rank ?? i + 1), x + 34, ry + (compact ? 30 : 36));- ctx.textAlign = 'left';- // thumb / monogram- const av = compact ? 30 : 40, ax = x + 50, ay = ry + (compact ? 4 : 6);- ctx.save();- roundRect(ctx, ax, ay, av, av, 8); ctx.fillStyle = '#1a1a20'; ctx.fill(); ctx.clip();- const im = thumbs.get(e.entryId);- if (im) ctx.drawImage(im, ax, ay, av, av);- else {- ctx.fillStyle = COL.dim; ctx.font = `700 ${compact ? 16 : 20}px Inter, system-ui, sans-serif`;- ctx.textAlign = 'center'; ctx.textBaseline = 'middle';- ctx.fillText(monogram(e.agent), ax + av / 2, ay + av / 2);- ctx.textAlign = 'left'; ctx.textBaseline = 'alphabetic';- }- ctx.restore();- // agent + score- ctx.fillStyle = COL.text; ctx.font = `700 ${compact ? 22 : 26}px Inter, system-ui, sans-serif`;- const nameX = ax + av + 16;- ctx.fillText(ellipsize(ctx, e.agent, w - (nameX - x) - 120), nameX, ry + (compact ? 30 : 38));- ctx.fillStyle = COL.accent; ctx.font = `800 ${compact ? 22 : 26}px "SF Mono", ui-monospace, monospace`;- ctx.textAlign = 'right';- ctx.fillText(fmtScore(e.score), x + w, ry + (compact ? 30 : 38));- ctx.textAlign = 'left';- if (i < Math.min(rows.length, maxRows) - 1) {- ctx.strokeStyle = COL.grid; ctx.lineWidth = 1;- ctx.beginPath(); ctx.moveTo(x, ry + rh - 6); ctx.lineTo(x + w, ry + rh - 6); ctx.stroke();- }- });- }-- function paintWinnersRows(x, y, w) {- const rows = feed?.recentWinners || [];- if (!rows.length) {- ctx.fillStyle = COL.dim; ctx.font = '600 22px Inter, system-ui, sans-serif';- ctx.fillText('Winners appear here as rounds settle.', x, y + 40);- return;- }- const rh = 70;- rows.slice(0, 6).forEach((wn, i) => {- const ry = y + i * rh;- ctx.fillStyle = COL.faint; ctx.font = '700 16px Inter, system-ui, sans-serif';- ctx.fillText(`ROUND ${wn.round}`, x, ry + 24);- ctx.fillStyle = COL.text; ctx.font = '700 28px Inter, system-ui, sans-serif';- ctx.fillText(ellipsize(ctx, wn.agent, w - 220), x, ry + 54);- ctx.fillStyle = COL.live; ctx.font = '800 28px Inter, system-ui, sans-serif';- ctx.textAlign = 'right';- ctx.fillText(fmtUsdc(wn.prizeUsdc), x + w, ry + 44);- ctx.textAlign = 'left';- ctx.strokeStyle = COL.grid; ctx.lineWidth = 1;- ctx.beginPath(); ctx.moveTo(x, ry + rh - 8); ctx.lineTo(x + w, ry + rh - 8); ctx.stroke();- });- }-- function paintTicker() {- const tickY = CH - 32, bandTop = CH - 64;- ctx.fillStyle = 'rgba(0,0,0,0.4)'; ctx.fillRect(0, bandTop, CW, 64);- ctx.strokeStyle = COL.grid; ctx.lineWidth = 1;- ctx.beginPath(); ctx.moveTo(0, bandTop); ctx.lineTo(CW, bandTop); ctx.stroke();- // "ENTRIES" tag- const padX = 44;- ctx.fillStyle = COL.accent; ctx.font = '800 16px Inter, system-ui, sans-serif';- ctx.fillText('ENTRIES', padX, tickY + 6);- const startX = padX + 96;- ctx.save();- ctx.beginPath(); ctx.rect(startX, bandTop, CW - startX - 20, 64); ctx.clip();- const now = correctedNow();- if (ticker.length) {- ctx.font = '700 20px Inter, system-ui, sans-serif';- const seg = ticker.map((e) => ({- e,- txt: `${e.agent} · ${relTime(e.submittedMs, now)}`,- }));- const gap = 56;- const widths = seg.map((s) => ctx.measureText(s.txt).width + gap + (s.e.optimistic ? 20 : 0));- const total = widths.reduce((a, b) => a + b, 0) || 1;- const scroll = (t * 70) % total;- let x = startX - scroll;- for (let pass = 0; pass < 2; pass++) {- let xx = x + pass * total;- seg.forEach((s, i) => {- if (s.e.optimistic) {- ctx.fillStyle = COL.live;- ctx.beginPath(); ctx.arc(xx + 6, tickY - 6, 5, 0, Math.PI * 2); ctx.fill();- xx += 20;- }- const dotX = xx;- ctx.fillStyle = s.e.optimistic ? COL.live : COL.text;- ctx.fillText(s.e.agent, dotX, tickY);- const lead = ctx.measureText(s.e.agent).width;- ctx.fillStyle = COL.dim;- ctx.fillText(` · ${relTime(s.e.submittedMs, now)}`, dotX + lead, tickY);- xx += widths[i] - (s.e.optimistic ? 20 : 0);- });- }- } else {- ctx.fillStyle = COL.faint; ctx.font = '600 18px Inter, system-ui, sans-serif';- ctx.fillText('Awaiting entries…', startX, tickY);- }- ctx.restore();- }-- // Non-live states: skeleton (loading) and centered, calm messaging otherwise.- function paintState() {- const cx = CW / 2, midY = 300;- if (status === 'loading') {- // skeleton shimmer bars- const sh = 0.04 + 0.03 * (0.5 + 0.5 * Math.sin(t * 3));- ctx.fillStyle = `rgba(255,255,255,${sh})`;- for (let i = 0; i < 4; i++) {- roundRect(ctx, 44, 150 + i * 70, (CW - 88) * (i === 0 ? 0.5 : 0.9), 44, 10); ctx.fill();- }- ctx.fillStyle = COL.dim; ctx.font = '600 24px Inter, system-ui, sans-serif';- ctx.textAlign = 'center';- ctx.fillText('Loading live contest…', cx, CH - 120);- ctx.textAlign = 'left';- return;- }-- const dots = '.'.repeat(1 + (Math.floor(t * 2) % 3));- let head, sub;- if (status === 'unconfigured') {- head = 'Connecting to Omniology';- sub = 'Live contests will appear here once the feed is configured.';- } else if (status === 'error') {- head = `Reconnecting to Omniology${dots}`;- sub = 'The contest feed is briefly unreachable. Retrying automatically.';- } else {- // empty / between rounds- const next = feed?.next;- const nextRem = next?.opensMs != null ? next.opensMs - correctedNow() : null;- head = 'Between rounds';- sub = nextRem != null && nextRem > 0- ? `Next round opens in ${formatCountdown(nextRem)}`- : 'The next contest is about to begin.';- }-- // pulsing ring as a calm "alive" signal- const pulse = 0.5 + 0.5 * Math.sin(t * 3);- ctx.beginPath();- ctx.arc(cx, midY - 30, 26 + pulse * 4, 0, Math.PI * 2);- ctx.strokeStyle = status === 'error' ? `rgba(224,108,117,${0.3 + pulse * 0.4})`- : `rgba(124,196,255,${0.3 + pulse * 0.4})`;- ctx.lineWidth = 3; ctx.stroke();-- ctx.textAlign = 'center';- ctx.fillStyle = COL.text; ctx.font = '800 40px Inter, system-ui, sans-serif';- ctx.fillText(head, cx, midY + 50);- ctx.fillStyle = COL.dim; ctx.font = '500 24px Inter, system-ui, sans-serif';- ctx.fillText(sub, cx, midY + 100);- ctx.textAlign = 'left';- }-- function paintSweep() {- if (sweepT <= 0) return;- const p = 1 - sweepT / SWEEP_S; // 0 → 1 across the sweep- const x = -CW + p * 2 * CW; // band slides left→right- ctx.save();- const grad = ctx.createLinearGradient(x, 0, x + CW, 0);- grad.addColorStop(0, 'rgba(124,196,255,0)');- grad.addColorStop(0.5, 'rgba(124,196,255,0.18)');- grad.addColorStop(1, 'rgba(124,196,255,0)');- ctx.fillStyle = grad; ctx.fillRect(0, 0, CW, CH);- const a = Math.sin(p * Math.PI); // fade in/out- ctx.globalAlpha = a;- ctx.fillStyle = COL.accent; ctx.font = '900 64px Inter, system-ui, sans-serif';- ctx.textAlign = 'center'; ctx.textBaseline = 'middle';- ctx.fillText('NEW ROUND', CW / 2, CH / 2);- ctx.textAlign = 'left'; ctx.textBaseline = 'alphabetic';- ctx.restore();- }-- function draw() {- paintBackground();- paintHeader();-- // The winners panel keeps showing its list even between rounds (history- // persists); every other role shows the designed state screen whenever the- // feed isn't live (loading / empty / error / unconfigured).- const winnersHaveHistory = role === 'winners' && (feed?.recentWinners?.length || 0) > 0;- if (status !== 'live' && !winnersHaveHistory) {- paintState();- paintTicker();- paintSweep();- tex.needsUpdate = true;- return;- }-- const padX = 44, bodyTop = 150;- if (role === 'leaderboard') {- paintLeaderboardRows(padX, bodyTop, CW - padX * 2, feed?.leaderboard || [], 7, false);- } else if (role === 'winners') {- paintWinnersRows(padX, bodyTop, CW - padX * 2);- } else {- // now-playing: countdown + stat chips on the left, top-3 board on the right- paintCountdown(padX, 300, 1);- const chipW = (560 - 20) / 2;- paintStatChip(padX, 360, chipW, 'PRIZE POOL', fmtUsdc(feed?.current?.prizeUsdc), COL.live);- paintStatChip(padX + chipW + 20, 360, chipW, 'ENTRIES', String(feed?.current?.entriesCount ?? 0), COL.text);- // right column: live top 3- const rx = 700, rw = CW - rx - padX;- ctx.fillStyle = COL.faint; ctx.font = '700 16px Inter, system-ui, sans-serif';- ctx.fillText('TOP ENTRIES', rx, bodyTop - 12);- paintLeaderboardRows(rx, bodyTop + 6, rw, feed?.leaderboard || [], 4, true);- }-- paintTicker();- paintSweep();- tex.needsUpdate = true;- }-- // first paint- draw();-- return {- group,- mesh: panel,- role,- update(dt) {- if (destroyed) return;- t += dt;- if (sweepT > 0) sweepT = Math.max(0, sweepT - dt);- acc += dt;- if (acc >= REDRAW_MS / 1000) { acc = 0; draw(); }- },- applyFeed,- pushEntry,- setStatus,- openExternal() {- window.open('https://omniology.ai', '_blank', 'noopener,noreferrer');- },- dispose() {- destroyed = true;- thumbs.clear();- scene.remove(group);- group.traverse((n) => {- if (n.isMesh) {- n.geometry?.dispose?.();- const mats = Array.isArray(n.material) ? n.material : [n.material];- for (const m of mats) { m?.map?.dispose?.(); m?.dispose?.(); }- }- });- },- };-}--function toXYZ(p, fallback) {- if (Array.isArray(p)) return [p[0] ?? 0, p[1] ?? 0, p[2] ?? 0];- if (p && typeof p === 'object') return [p.x ?? 0, p.y ?? 0, p.z ?? 0];- return fallback;-}diff --git a/src/game/arena/contest-screens.js b/src/game/arena/contest-screens.jsdeleted file mode 100644index 7e9caa460..000000000--- a/src/game/arena/contest-screens.js+++ /dev/null@@ -1,209 +0,0 @@-// Contest Screens — the shared polling controller and arena mount helper.-//-// One poller serves every screen on the Arena's walls: it polls Omniology's live-// feed on an interval tuned to the ~88-second contest cadence, fans the same-// NormalizedFeed out to each screen's applyFeed(), and never issues a duplicate-// request per screen. It pauses while the tab is hidden (no point polling a feed-// nobody can see) and resumes — with an immediate catch-up poll — on focus. When-// it detects that the current round has just closed, it re-polls quickly to catch-// the flip to the next round so the countdown stays in sync across the boundary.-// On error it backs off, keeps retrying, and tells the screens to render their-// designed, auto-retrying error state.-//-// mountContestScreens() is the integration point the Arena bootstrap (prompt 01)-// calls: it creates one contest-screen per resolved venue anchor (prompt 02),-// registers each as an updatable so it redraws every frame, wires them to the-// single poller, and hands back a `pushEntry` so the entry desk (prompt 04) can-// optimistically push a settled submission to every screen.-//-// Contract: docs/omniology-arena/CONTRACTS.md §2.2, §2.4.--import { fetchLiveFeed } from './omniology-adapter.js';-import { createContestScreen } from './contest-screen.js';--const BASE_POLL_MS = 5000; // steady-state cadence (the ~88s round repolls ~17×)-const FLIP_POLL_MS = 1500; // fast repoll right after a detected round close-const ERROR_BASE_MS = 5000; // first backoff step on error-const ERROR_MAX_MS = 30000; // backoff ceiling-const FLIP_GRACE_MS = 4000; // how long after close we keep fast-polling for the flip--/**- * Create the single shared poller. Drives one in-flight request at a time and- * pushes each NormalizedFeed to onFeed; routes errors to onError. Visibility-aware.- *- * @param {{ onFeed:(feed)=>void, onError:(err)=>void, pollMs?:number,- * getNow?:()=>number, fetchFeed?:()=>Promise<any> }} opts- * @returns {{ start, stop, pollNow, dispose, isRunning }}- */-export function createContestPoller(opts = {}) {- const onFeed = typeof opts.onFeed === 'function' ? opts.onFeed : () => {};- const onError = typeof opts.onError === 'function' ? opts.onError : () => {};- const pollMs = opts.pollMs || BASE_POLL_MS;- const now = opts.getNow || (() => Date.now());- const doFetch = opts.fetchFeed || fetchLiveFeed;-- let timer = null;- let inFlight = false;- let destroyed = false;- let running = false;- let errorStreak = 0;- let skewMs = 0; // server - client drift, to time the round flip- let closesMs = null; // current round close on the server clock- let visHandler = null;-- function correctedNow() { return now() + skewMs; }-- function schedule(ms) {- clearTimeout(timer);- if (destroyed || !running) return;- timer = setTimeout(tick, ms);- }-- // Decide the delay until the next poll. Around a round close we poll fast to- // catch the flip; otherwise steady-state, unless we're backing off from errors.- function nextDelay() {- if (errorStreak > 0) return backoffDelay(errorStreak, ERROR_BASE_MS, ERROR_MAX_MS);- if (closesMs != null) {- const rem = closesMs - correctedNow();- if (rem <= FLIP_GRACE_MS) return FLIP_POLL_MS; // closing / just closed- }- return pollMs;- }-- async function tick() {- if (destroyed || !running) return;- if (isHidden()) return; // visibilitychange will resume us- if (inFlight) { schedule(pollMs); return; }- inFlight = true;- try {- const feed = await doFetch();- errorStreak = 0;- if (feed) {- skewMs = Number(feed.serverNowMs) - now();- closesMs = feed.current ? feed.current.closesMs : null;- onFeed(feed);- }- } catch (err) {- errorStreak += 1;- onError(err);- } finally {- inFlight = false;- schedule(nextDelay());- }- }-- function onVisibility() {- if (destroyed || !running) return;- if (isHidden()) {- clearTimeout(timer); // pause — no polling while nobody's watching- } else {- pollNow(); // resume with an immediate catch-up- }- }-- function pollNow() {- if (destroyed || !running) return;- clearTimeout(timer);- tick();- }-- function start() {- if (destroyed || running) return;- running = true;- if (typeof document !== 'undefined' && document.addEventListener) {- visHandler = onVisibility;- document.addEventListener('visibilitychange', visHandler);- }- pollNow();- }-- function stop() {- running = false;- clearTimeout(timer);- }-- function dispose() {- destroyed = true;- stop();- if (visHandler && typeof document !== 'undefined' && document.removeEventListener) {- document.removeEventListener('visibilitychange', visHandler);- }- visHandler = null;- }-- return {- start, stop, pollNow, dispose,- isRunning: () => running,- };-}--/**- * Exponential backoff with a ceiling. attempt is 1-based (first error → base).- * @param {number} attempt- * @param {number} [base]- * @param {number} [max]- * @returns {number}- */-export function backoffDelay(attempt, base = ERROR_BASE_MS, max = ERROR_MAX_MS) {- const ms = base * Math.pow(2, Math.max(0, attempt - 1));- return Math.min(max, ms);-}--function isHidden() {- return typeof document !== 'undefined' && document.hidden === true;-}--/**- * Mount one contest-screen per Arena venue anchor and wire them all to one poller.- * Called by the Arena bootstrap (prompt 01) once the venue anchors (prompt 02) are- * resolved. Each anchor in `arena.anchors.screens[]` is `{ position, rotationY?,- * width?, role? }`. By default the three walls take distinct roles (now-playing,- * leaderboard, winners); pass `opts.roles` to override.- *- * @param {{ scene:THREE.Scene, anchors:{screens:Array}, registerUpdatable:(o)=>void }} arena- * @param {{ roles?:string[], pollMs?:number, frame?:boolean }} [opts]- * @returns {{ screens, poller, pushEntry:(entry)=>void, dispose:()=>void }}- */-export function mountContestScreens(arena, opts = {}) {- const anchors = arena?.anchors?.screens || [];- const defaultRoles = opts.roles || ['now', 'leaderboard', 'winners'];-- const screens = anchors.map((a, i) => {- const screen = createContestScreen(arena.scene, {- position: a.position,- rotationY: a.rotationY ?? 0,- width: a.width,- role: a.role || defaultRoles[i % defaultRoles.length],- frame: opts.frame ?? a.frame,- });- screen.setStatus('loading');- if (typeof arena.registerUpdatable === 'function') arena.registerUpdatable(screen);- return screen;- });-- // Track the latest feed so the entry desk (prompt 04) can read the live contest- // id from the SAME poll the screens use — no second request to Omniology.- let latestFeed = null;-- const poller = createContestPoller({- pollMs: opts.pollMs,- onFeed: (feed) => { latestFeed = feed; for (const s of screens) s.applyFeed(feed); },- onError: () => { for (const s of screens) s.setStatus('error'); },- });- poller.start();-- return {- screens,- poller,- // Optimistic insert from the entry desk (prompt 04) — show the entry on- // every screen the instant a submission settles, before the next poll.- pushEntry: (entry) => { for (const s of screens) s.pushEntry(entry); },- // The live contest id (or null) from the latest poll — the desk's getContestId.- getContestId: () => (latestFeed && latestFeed.current ? latestFeed.current.id : null),- getCurrentFeed: () => latestFeed,- dispose: () => {- poller.dispose();- for (const s of screens) s.dispose();- },- };-}diff --git a/src/game/arena/entry-desk.js b/src/game/arena/entry-desk.jsdeleted file mode 100644index 218b5c3a0..000000000--- a/src/game/arena/entry-desk.js+++ /dev/null@@ -1,834 +0,0 @@-// Entry Desk — the in-world kiosk where a player submits a contest entry to-// Omniology with a real USDC-on-Solana x402 payment.-//-// Walk up to the desk (or tap it), press E, compose an entry, and confirm. The-// desk validates the entry locally FIRST (so a doomed entry is never charged),-// then hands { url, method, body } from the adapter's submitEntryRequest() to-// `POST /api/x402-pay` — the same server-side universal x402 payer the agent-// commerce flow uses (api/x402-pay.js → runExternalFlow). The payment lifecycle-// streams back as Server-Sent Events (challenge → built → settled → result) and-// drives a live stepper: every stage is a REAL event from the server, never a-// setTimeout fake. On success the new entry is pushed to the in-world screens-// (onSubmitted → screen.pushEntry) so it hits the ticker immediately.-//-// Two submission paths, selected by the adapter (entryFeeMode()), never a-// hardcoded flag here:-// - paid/auto: stream through /api/x402-pay (auto-probes; a free endpoint just-// resolves with free:true and moves no funds).-// - free: POST the submit URL directly, skipping the payment stepper.-//-// Contract: docs/omniology-arena/CONTRACTS.md §2.3. No mocks, no fake data: when-// Omniology is unconfigured the desk shows a designed "not live yet" state and-// charges nothing.--import {- Group, Mesh, MeshBasicMaterial, MeshStandardMaterial,- BoxGeometry, PlaneGeometry, RingGeometry, CylinderGeometry,- CanvasTexture, SRGBColorSpace, DoubleSide, PointLight,-} from 'three';-import { payX402Stream } from '../../agent-x402-pay.js';-import {- omniologyBase, submitEntryRequest, validateEntry, normalizeEntry,- ENTRY_FIELDS, entryFeeMode, readEntryConfirmation,-} from './omniology-adapter.js';-import { log } from '../../shared/log.js';--const INTERACT_RANGE = 4.5; // metres: how close to show the prompt / allow E-const SERVICE_LABEL = 'Omniology';-const CELEBRATE_MS_S = 1.1; // celebration light/accent decay window, in seconds--// The x402 lifecycle, keyed to the SSE events /api/x402-pay's external flow emits-// (challenge → built → settled → result). Mirrors the agent-commerce stepper.-const STAGES = [- { id: 'challenge', label: 'Fee' },- { id: 'built', label: 'Sign' },- { id: 'settled', label: 'Settle' },- { id: 'done', label: 'Confirmed' },-];--const escHtml = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));-const fmtUsdc = (micro) => `${((Number(micro) || 0) / 1e6).toFixed(4)} USDC`;-const shortAddr = (a) => (a ? `${String(a).slice(0, 6)}…${String(a).slice(-4)}` : '—');--// Small DOM factory (mirrors play-systems.el) so the compose UI stays-// dependency-free and is built from real nodes, never innerHTML of user input.-function el(tag, props = {}, kids = []) {- const n = document.createElement(tag);- for (const [k, v] of Object.entries(props)) {- if (k === 'class') n.className = v;- else if (k === 'text') n.textContent = v;- else if (k === 'html') n.innerHTML = v;- else if (k === 'hidden') n.hidden = !!v;- else if (k.startsWith('on') && typeof v === 'function') n.addEventListener(k.slice(2), v);- else if (v != null) n.setAttribute(k, v);- }- for (const c of [].concat(kids)) if (c) n.appendChild(c);- return n;-}--const prefersReducedMotion = () =>- typeof window !== 'undefined' && window.matchMedia- ? window.matchMedia('(prefers-reduced-motion: reduce)').matches- : false;--function toVec(position) {- if (!position) return { x: 0, y: 0, z: 0 };- if (Array.isArray(position)) return { x: position[0] || 0, y: position[1] || 0, z: position[2] || 0 };- if (position.isVector3) return { x: position.x, y: position.y, z: position.z };- return { x: position.x || 0, y: position.y || 0, z: position.z || 0 };-}--/**- * Build the entry desk and add it to the scene (CONTRACTS §2.3).- *- * @param {import('three').Scene} scene- * @param {object} opts- * @param {[number,number,number]|import('three').Vector3} opts.position desk anchor (anchors.desk.pos)- * @param {number} [opts.rotationY] desk facing (anchors.desk.yaw)- * @param {() => (string|null)} opts.getAgentId current player's paying agent id- * @param {() => (string|null)} opts.getContestId current contest id (from the adapter feed)- * @param {() => Promise<object|null>} [opts.buildEntry] opens the compose UI; resolves the entry, or null if cancelled. Defaults to the desk's built-in compose form.- * @param {(info:{entryId:string|null, agent:string|null, payment:object|null}) => void} [opts.onSubmitted] wired to screen.pushEntry- * @param {() => ({x:number,z:number})} [opts.getPlayer] local player pose, for proximity (optional)- * @param {() => (string|null)} [opts.getAgentName] paying agent's display name (optional)- * @param {{toast?:(msg:string,tone?:string)=>void}} [opts.ui] toast surface (optional)- * @returns {{ group:import('three').Group, update:(dt:number)=>void, interact:()=>void, dispose:()=>void }}- */-export function createEntryDesk(scene, opts = {}) {- const desk = new EntryDesk(scene, opts);- return {- group: desk.group,- update: (dt) => desk.update(dt),- interact: () => desk.interact(),- dispose: () => desk.dispose(),- };-}--class EntryDesk {- constructor(scene, opts) {- this.scene = scene;- this.pos = toVec(opts.position);- this.rotationY = Number(opts.rotationY) || 0;- this.getAgentId = typeof opts.getAgentId === 'function' ? opts.getAgentId : () => null;- this.getContestId = typeof opts.getContestId === 'function' ? opts.getContestId : () => null;- this.getAgentName = typeof opts.getAgentName === 'function' ? opts.getAgentName : () => null;- this.getPlayer = typeof opts.getPlayer === 'function' ? opts.getPlayer : null;- this.onSubmitted = typeof opts.onSubmitted === 'function' ? opts.onSubmitted : () => {};- this.buildEntry = typeof opts.buildEntry === 'function' ? opts.buildEntry : () => this._composeDefault();- this.ui = opts.ui || null;-- this.busy = false; // a submission flow is in flight- this.composeOpen = false; // the compose modal is open- this._near = !this.getPlayer; // no player accessor → always interactable (bootstrap gates E)- this._t = 0;- this._ringT = 0;- this._celebrateT = 0;- this._submitted = new Set(); // contestIds already entered this session (one entry per round)- this._amount = null;-- this._injectStyles();- this._buildMesh();- this._buildDom();- this._onKey = (e) => this._handleKey(e);- window.addEventListener('keydown', this._onKey);- }-- // ── world mesh ────────────────────────────────────────────────────────────- _buildMesh() {- const group = new Group();- group.position.set(this.pos.x, this.pos.y, this.pos.z);- group.rotation.y = this.rotationY;- this.group = group;-- const metal = new MeshStandardMaterial({ color: 0x16161a, roughness: 0.42, metalness: 0.72 });- const base = new Mesh(new BoxGeometry(1.7, 1.0, 0.72), metal);- base.position.y = 0.5;- base.castShadow = true; base.receiveShadow = true;- group.add(base);-- const top = new Mesh(new BoxGeometry(1.84, 0.09, 0.84), new MeshStandardMaterial({ color: 0x202028, roughness: 0.3, metalness: 0.8 }));- top.position.y = 1.05;- top.castShadow = true;- group.add(top);-- // Front accent strip — the surface that pulses on a successful submission.- this.accent = new Mesh(- new BoxGeometry(1.62, 0.06, 0.02),- new MeshBasicMaterial({ color: 0xffffff, transparent: true, opacity: 0.5 }),- );- this.accent.position.set(0, 0.78, 0.37);- group.add(this.accent);-- // Angled kiosk screen showing the call-to-action, painted on a canvas.- this._screenCanvas = document.createElement('canvas');- this._screenCanvas.width = 512; this._screenCanvas.height = 320;- this._screenTex = new CanvasTexture(this._screenCanvas);- this._screenTex.colorSpace = SRGBColorSpace;- const screen = new Mesh(- new PlaneGeometry(1.18, 0.74),- new MeshBasicMaterial({ map: this._screenTex, transparent: true, side: DoubleSide }),- );- screen.position.set(0, 1.5, 0.18);- screen.rotation.x = -0.32;- group.add(screen);- this._paintScreen('Enter the contest');-- // Riser holding the screen up off the counter.- const riser = new Mesh(new CylinderGeometry(0.05, 0.05, 0.5, 12), metal);- riser.position.set(0, 1.28, 0.05);- riser.rotation.x = -0.32;- group.add(riser);-- // Pulsing ground ring marks the desk as an interactable from across the room.- this.ring = new Mesh(- new RingGeometry(1.25, 1.55, 56),- new MeshBasicMaterial({ color: 0xffffff, transparent: true, opacity: 0.18, side: DoubleSide }),- );- this.ring.rotation.x = -Math.PI / 2;- this.ring.position.y = 0.03;- group.add(this.ring);-- // Real light for the celebration pulse (off until a submission lands).- this.celebrateLight = new PointLight(0xffffff, 0, 6, 2);- this.celebrateLight.position.set(0, 1.7, 0.4);- group.add(this.celebrateLight);-- this.scene.add(group);- }-- _paintScreen(headline, sub) {- // Skip redundant repaints — _syncActionButton calls this every frame while- // the player is near, but the texture only changes on a state change.- const key = `${headline} ${sub || ''}`;- if (key === this._screenKey) return;- this._screenKey = key;- const c = this._screenCanvas;- const x = c.getContext('2d');- x.clearRect(0, 0, c.width, c.height);- const g = x.createLinearGradient(0, 0, 0, c.height);- g.addColorStop(0, '#121216'); g.addColorStop(1, '#0a0a0c');- x.fillStyle = g; x.fillRect(0, 0, c.width, c.height);- x.strokeStyle = 'rgba(255,255,255,0.14)'; x.lineWidth = 3;- x.strokeRect(8, 8, c.width - 16, c.height - 16);- x.textAlign = 'center';- x.fillStyle = 'rgba(255,255,255,0.55)';- x.font = '700 26px Inter, system-ui, sans-serif';- x.fillText('OMNIOLOGY', c.width / 2, 78);- x.fillStyle = '#ffffff';- x.font = '800 44px Inter, system-ui, sans-serif';- x.fillText(headline, c.width / 2, 158);- x.fillStyle = 'rgba(255,255,255,0.62)';- x.font = '600 24px Inter, system-ui, sans-serif';- x.fillText(sub || 'Press E to submit your entry', c.width / 2, 232);- // Key cap.- x.fillStyle = '#ffffff';- const kw = 46, kh = 46, kx = c.width / 2 - kw / 2, ky = 256;- x.fillRect(kx, ky, kw, kh);- x.fillStyle = '#060607';- x.font = '800 26px Inter, system-ui, sans-serif';- x.fillText('E', c.width / 2, ky + 32);- this._screenTex.needsUpdate = true;- }-- // ── HUD DOM (prompt, compose modal, payment panel) ──────────────────────────- _buildDom() {- this.actionBtn = el('button', {- class: 'ed-action', type: 'button', hidden: true,- onclick: () => this.interact(),- }, [el('span', { class: 'ed-action-key', text: 'E' }), el('span', { class: 'ed-action-label', text: 'Enter contest' })]);-- this.modalRoot = el('div', { class: 'ed-modal', hidden: true, role: 'dialog', 'aria-modal': 'true', 'aria-label': 'Submit a contest entry' });- this.panel = el('div', { class: 'ed-panel', hidden: true, role: 'status', 'aria-live': 'polite' });-- this.root = el('div', { class: 'ed-root' }, [this.actionBtn, this.modalRoot, this.panel]);- document.body.appendChild(this.root);- }-- _injectStyles() {- if (document.getElementById('ed-styles')) return;- const s = document.createElement('style');- s.id = 'ed-styles';- s.textContent = `- .ed-root { font-family: Inter, system-ui, sans-serif; }- .ed-action {- position: fixed; left: 50%; bottom: 118px; transform: translateX(-50%);- z-index: 26; display: inline-flex; align-items: center; gap: 9px;- padding: 11px 18px; border-radius: 999px; cursor: pointer;- background: var(--cc-panel-solid, #0c0c0e); color: var(--cc-text, #f5f5f6);- border: 1px solid var(--cc-edge, rgba(255,255,255,0.16));- box-shadow: var(--cc-shadow, 0 10px 34px rgba(0,0,0,0.6));- font-size: 13px; font-weight: 700; letter-spacing: 0.03em;- transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;- }- .ed-action:hover { transform: translateX(-50%) translateY(-2px); border-color: rgba(255,255,255,0.5); }- .ed-action:active { transform: translateX(-50%) translateY(0); }- .ed-action:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }- .ed-action[disabled] { opacity: 0.55; cursor: default; pointer-events: none; }- .ed-action-key {- display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px;- background: #fff; color: var(--cc-ink, #060607); border-radius: 4px; font-weight: 800; font-size: 11px;- }-- .ed-modal {- position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;- padding: 16px; background: rgba(4,4,6,0.62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);- opacity: 0; transition: opacity 0.2s ease;- }- .ed-modal.ed-show { opacity: 1; }- .ed-card {- width: min(460px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;- background: var(--cc-panel-solid, #0c0c0e); color: var(--cc-text, #f5f5f6);- border: 1px solid var(--cc-edge, rgba(255,255,255,0.14)); border-radius: 12px;- box-shadow: 0 24px 70px rgba(0,0,0,0.75);- transform: translateY(8px) scale(0.99); transition: transform 0.2s ease;- }- .ed-modal.ed-show .ed-card { transform: none; }- .ed-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 6px; }- .ed-card-title { font-size: 15px; font-weight: 800; letter-spacing: 0.01em; }- .ed-card-meta { margin-top: 3px; font-size: 11.5px; color: var(--cc-dim, #8c8c92); }- .ed-x { background: none; border: none; color: var(--cc-dim, #8c8c92); font-size: 18px; line-height: 1; cursor: pointer; padding: 4px; border-radius: 6px; }- .ed-x:hover { color: #fff; background: rgba(255,255,255,0.08); }- .ed-x:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }- .ed-form { padding: 6px 16px 16px; display: flex; flex-direction: column; gap: 13px; }- .ed-field { display: flex; flex-direction: column; gap: 5px; }- .ed-field-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }- .ed-label { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }- .ed-req { color: var(--cc-dim, #8c8c92); font-weight: 600; }- .ed-count { font-size: 11px; color: var(--cc-faint, #5a5a60); font-variant-numeric: tabular-nums; }- .ed-count.ed-over { color: #e06c75; }- .ed-input, .ed-textarea {- width: 100%; box-sizing: border-box; background: rgba(255,255,255,0.04);- border: 1px solid var(--cc-edge, rgba(255,255,255,0.14)); border-radius: 8px;- color: var(--cc-text, #f5f5f6); font: inherit; font-size: 13px; padding: 9px 11px;- transition: border-color 0.15s ease, box-shadow 0.15s ease;- }- .ed-textarea { resize: vertical; min-height: 84px; line-height: 1.45; }- .ed-input::placeholder, .ed-textarea::placeholder { color: var(--cc-faint, #5a5a60); }- .ed-input:hover, .ed-textarea:hover { border-color: rgba(255,255,255,0.28); }- .ed-input:focus, .ed-textarea:focus { outline: none; border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,0.12); }- .ed-field.ed-invalid .ed-input, .ed-field.ed-invalid .ed-textarea { border-color: #e06c75; }- .ed-hint { font-size: 11px; color: var(--cc-faint, #5a5a60); }- .ed-error { font-size: 11.5px; color: #e06c75; min-height: 0; }- .ed-form-error { font-size: 12px; color: #e06c75; padding: 0 16px; }- .ed-actions { display: flex; gap: 9px; justify-content: flex-end; padding: 4px 16px 16px; }- .ed-btn {- padding: 9px 16px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;- border: 1px solid var(--cc-edge, rgba(255,255,255,0.16)); background: transparent; color: var(--cc-text, #f5f5f6);- transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease, opacity 0.14s ease;- }- .ed-btn:hover { border-color: rgba(255,255,255,0.5); transform: translateY(-1px); }- .ed-btn:active { transform: translateY(0); }- .ed-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }- .ed-btn-primary { background: #fff; color: var(--cc-ink, #060607); border-color: #fff; }- .ed-btn-primary:hover { background: #ededed; }- .ed-btn[disabled] { opacity: 0.5; cursor: default; pointer-events: none; }- .ed-empty { padding: 18px 16px 20px; text-align: center; color: var(--cc-dim, #8c8c92); font-size: 13px; line-height: 1.5; }- .ed-empty b { color: var(--cc-text, #f5f5f6); }-- .ed-panel {- position: fixed; left: 50%; top: 84px; transform: translateX(-50%) translateY(-8px);- z-index: 28; width: min(440px, calc(100vw - 28px));- background: var(--cc-panel, rgba(12,12,14,0.94)); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);- border: 1px solid var(--cc-edge, rgba(255,255,255,0.14)); border-radius: 10px;- box-shadow: 0 18px 56px rgba(0,0,0,0.72); color: var(--cc-text, #f5f5f6);- padding: 13px 15px; opacity: 0; pointer-events: none; transition: opacity 0.22s ease, transform 0.22s ease;- }- .ed-panel.ed-show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }- .ed-ph { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }- .ed-pt { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--cc-dim, #8c8c92); }- .ed-pt b { color: var(--cc-text, #f5f5f6); }- .ed-fee { font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }- .ed-steps { display: flex; gap: 6px; }- .ed-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--cc-faint, #5a5a60); }- .ed-step .ed-dot { width: 100%; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.08); transition: background 0.2s ease; }- .ed-step.is-active { color: var(--cc-dim, #8c8c92); }- .ed-step.is-active .ed-dot { background: rgba(255,255,255,0.5); animation: ed-pulse 1s ease-in-out infinite; }- .ed-step.is-done { color: var(--cc-text, #f5f5f6); }- .ed-step.is-done .ed-dot { background: #fff; box-shadow: 0 0 8px rgba(255,255,255,0.6); }- .ed-step.is-err .ed-dot { background: #e06c75; box-shadow: 0 0 8px rgba(224,108,117,0.6); }- @keyframes ed-pulse { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }- .ed-sub { margin-top: 10px; font-size: 12.5px; line-height: 1.45; color: var(--cc-dim, #8c8c92); }- .ed-sub b { color: var(--cc-text, #f5f5f6); }- .ed-receipt { margin-top: 11px; padding-top: 11px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 12px; }- .ed-rrow { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; color: var(--cc-dim, #8c8c92); }- .ed-rrow .ed-v { color: var(--cc-text, #f5f5f6); font-variant-numeric: tabular-nums; }- .ed-rrow a { color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,0.4); }- .ed-rrow a:hover { border-bottom-color: #fff; }- .ed-err-msg { margin-top: 10px; font-size: 12.5px; line-height: 1.45; color: var(--cc-text, #f5f5f6); }- .ed-err-msg .ed-warn { color: #e0b46c; font-weight: 700; }- @media (prefers-reduced-motion: reduce) {- .ed-modal, .ed-card, .ed-panel, .ed-action, .ed-btn { transition: none !important; }- .ed-step.is-active .ed-dot { animation: none !important; }- }- @media (max-width: 560px) { .ed-action { bottom: 150px; } }- `;- document.head.appendChild(s);- }-- // ── proximity + per-frame ───────────────────────────────────────────────────- _playerNear() {- if (!this.getPlayer) return true;- const p = this.getPlayer();- if (!p) return false;- return Math.hypot((p.x ?? 0) - this.pos.x, (p.z ?? 0) - this.pos.z) <= INTERACT_RANGE;- }-- update(dt) {- this._t += dt;- const reduced = prefersReducedMotion();-- // Ground-ring breathing, brighter when the player is in range.- this._near = this._playerNear();- if (this.ring) {- const base = this._near ? 0.34 : 0.16;- this.ring.material.opacity = reduced ? base : base + 0.12 * (0.5 + 0.5 * Math.sin(this._t * 2));- }-- // Celebration light decay.- if (this._celebrateT > 0) {- this._celebrateT = Math.max(0, this._celebrateT - dt);- const k = this._celebrateT / CELEBRATE_MS_S;- if (this.celebrateLight) this.celebrateLight.intensity = reduced ? (this._celebrateT > 0 ? 1.4 : 0) : 6 * k;- if (this.accent) this.accent.material.opacity = 0.5 + 0.5 * k;- }-- this._syncActionButton();- }-- _syncActionButton() {- const show = this._near && !this.busy && !this.composeOpen;- const btn = this.actionBtn;- if (!show) { if (!btn.hidden) btn.hidden = true; return; }- const contestId = this.getContestId();- const already = contestId && this._submitted.has(String(contestId));- btn.hidden = false;- btn.toggleAttribute('disabled', !!already);- const label = btn.querySelector('.ed-action-label');- const key = btn.querySelector('.ed-action-key');- if (already) {- if (key) key.hidden = true;- if (label) label.textContent = 'Entered ✓';- this._paintScreen('Entry submitted', 'You’re in this round');- } else {- if (key) key.hidden = false;- if (label) label.textContent = 'Enter contest';- this._paintScreen('Enter the contest');- }- }-- _handleKey(e) {- if (e.key !== 'e' && e.key !== 'E') return;- if (e.metaKey || e.ctrlKey || e.altKey) return;- const t = e.target;- if (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;- if (!this._near || this.busy || this.composeOpen) return;- e.preventDefault();- this.interact();- }-- // ── interaction → compose → submit ──────────────────────────────────────────- interact() {- if (this.busy || this.composeOpen) return;- if (this.getPlayer && !this._playerNear()) return;-- if (!omniologyBase()) {- this._toast('Omniology contests aren’t live here yet — check back soon.', 'info');- return;- }- const contestId = this.getContestId();- if (!contestId) {- this._toast('No contest is open right now. Watch the screens for the next round.', 'info');- return;- }- if (this._submitted.has(String(contestId))) {- this._toast('You’ve already entered this round — one entry per round.', 'info');- return;- }- this._run(contestId).catch((err) => log.warn('[entry-desk] submit failed:', err?.message));- }-- async _run(contestId) {- this.composeOpen = true;- this.actionBtn.hidden = true;- let entry;- try {- entry = await this.buildEntry();- } finally {- this.composeOpen = false;- }- if (!entry) return; // cancelled-- // Final guard: never submit (or pay) an entry that fails local validation.- const v = validateEntry(entry);- if (!v.ok) {- this._toast('That entry isn’t valid yet — please fix the highlighted fields.', 'warn');- return;- }- // The contest could have rolled over while the form was open.- const liveContest = this.getContestId() || contestId;- if (this._submitted.has(String(liveContest))) {- this._toast('You’ve already entered this round.', 'info');- return;- }-- let request;- try {- request = submitEntryRequest(liveContest, normalizeEntry(entry), this.getAgentName());- } catch (err) {- this._toast(err?.message || 'Could not prepare the entry.', 'warn');- return;- }-- this.busy = true;- try {- const mode = entryFeeMode();- const result = mode === 'free'- ? await this._submitFree(request)- : await this._submitPaid(request);- this._onSuccess(liveContest, result);- } catch (err) {- this._renderError(err);- } finally {- this.busy = false;- }- }-- // Free path: POST the submit URL directly, no x402, no stepper (CONTRACTS §1.2).- async _submitFree(request) {- this._renderPanel({ stage: null, free: true });- this.panel.classList.add('ed-show');- let res;- try {- res = await fetch(request.url, {- method: request.method,- headers: { 'content-type': 'application/json', accept: 'application/json' },- body: JSON.stringify(request.body),- });- } catch {- throw Object.assign(new Error('Could not reach Omniology to submit your entry.'), { code: 'endpoint_unreachable' });- }- let body = null;- try { body = await res.json(); } catch { body = null; }- if (!res.ok) {- const msg = (body && (body.error_description || body.error)) || `Omniology rejected the entry (HTTP ${res.status}).`;- throw Object.assign(new Error(msg), { code: body?.code || 'submit_rejected', status: res.status });- }- return { ok: true, free: true, result: body, payment: null };- }-- // Paid/auto path: stream the real x402 lifecycle from /api/x402-pay. Every- // stepper stage below is driven by a genuine SSE event — no fake progress.- async _submitPaid(request) {- const agentId = this.getAgentId();- if (!agentId) {- throw Object.assign(- new Error('Connect a paying agent wallet to enter — entries settle from your agent’s Solana USDC.'),- { code: 'agent_required' },- );- }- this._amount = null;- this._renderPanel({ stage: 'challenge', active: true });- this.panel.classList.add('ed-show');-- const onEvent = (event, data) => {- if (event === 'challenge') {- if (data?.amount != null) this._amount = data.amount;- this._renderPanel({ stage: 'built', active: true, sub: 'Fee · awaiting signature' });- } else if (event === 'built') {- this._renderPanel({ stage: 'settled', active: true, sub: 'Signed · settling on Solana' });- } else if (event === 'settled') {- this._explorer = data?.explorer || (data?.tx ? `https://solscan.io/tx/${data.tx}` : null);- this._renderPanel({ stage: 'done', active: true, sub: 'Settled on Solana', explorer: this._explorer });- }- // 'result'/'error' are handled by payX402Stream's resolve/throw below.- };-- return payX402Stream(- { agentId, url: request.url, method: request.method, body: request.body, serviceLabel: SERVICE_LABEL },- onEvent,- );- }-- _onSuccess(contestId, result) {- this._submitted.add(String(contestId));- const agentName = this.getAgentName();- const confirmation = readEntryConfirmation(result);- const payment = result?.payment || null;-- // Push to the in-world screens immediately (optimistic), then the next poll- // reconciles it with Omniology's authoritative feed.- try {- this.onSubmitted({ entryId: confirmation.entryId, agent: agentName, payment });- } catch (err) {- log.warn('[entry-desk] onSubmitted handler threw:', err?.message);- }-- this._celebrate();- this._renderReceipt(confirmation, payment, !!result?.free);- this._scheduleHide(11000);- }-- // ── compose UI (default buildEntry) ─────────────────────────────────────────- _composeDefault() {- return new Promise((resolve) => {- const root = this.modalRoot;- root.replaceChildren();- root.hidden = false;-- let settled = false;- const finish = (val) => {- if (settled) return; settled = true;- root.classList.remove('ed-show');- window.removeEventListener('keydown', onEsc, true);- setTimeout(() => { root.hidden = true; root.replaceChildren(); }, 200);- resolve(val);- };- const onEsc = (e) => { if (e.key === 'Escape') { e.preventDefault(); finish(null); } };- window.addEventListener('keydown', onEsc, true);-- const card = el('div', { class: 'ed-card' });- root.appendChild(card);- root.onclick = (e) => { if (e.target === root) finish(null); };-- const contestId = this.getContestId();- const agentId = this.getAgentId();- const mode = entryFeeMode();-- const head = el('div', { class: 'ed-card-head' }, [- el('div', {}, [- el('div', { class: 'ed-card-title', text: 'Submit your entry' }),- el('div', { class: 'ed-card-meta', text: contestId ? `Round contest · ${mode === 'free' ? 'free entry' : 'pays an entry fee in USDC'}` : 'No live contest' }),- ]),- el('button', { class: 'ed-x', type: 'button', 'aria-label': 'Close', text: '✕', onclick: () => finish(null) }),- ]);- card.appendChild(head);-- // Designed empty/blocked state: a paid round with no paying agent connected.- if (mode !== 'free' && !agentId) {- card.appendChild(el('div', { class: 'ed-empty', html: 'Entries settle from <b>your agent’s Solana wallet</b>. Connect or create a paying agent, then come back to the desk to enter.' }));- card.appendChild(el('div', { class: 'ed-actions' }, [- el('button', { class: 'ed-btn', type: 'button', text: 'Close', onclick: () => finish(null) }),- ]));- requestAnimationFrame(() => root.classList.add('ed-show'));- return;- }-- const form = el('form', { class: 'ed-form', novalidate: 'novalidate' });- const controls = new Map();- for (const f of ENTRY_FIELDS) {- const id = `ed-f-${f.key}`;- const counter = f.max ? el('span', { class: 'ed-count', text: `0/${f.max}` }) : null;- const top = el('div', { class: 'ed-field-top' }, [- el('label', { class: 'ed-label', for: id, html: `${escHtml(f.label)}${f.required ? '' : ' <span class="ed-req">(optional)</span>'}` }),- counter,- ]);- const input = f.type === 'textarea'- ? el('textarea', { class: 'ed-textarea', id, placeholder: f.placeholder || '', 'aria-required': String(!!f.required), rows: '3' })- : el('input', { class: 'ed-input', id, type: f.type === 'url' ? 'url' : 'text', placeholder: f.placeholder || '', 'aria-required': String(!!f.required), inputmode: f.type === 'url' ? 'url' : 'text' });- const err = el('div', { class: 'ed-error', id: `${id}-err`, role: 'alert' });- const field = el('div', { class: 'ed-field' }, [- top, input,- f.hint ? el('div', { class: 'ed-hint', text: f.hint }) : null,- err,- ]);- const sync = () => {- if (counter) {- const n = input.value.length;- counter.textContent = `${n}/${f.max}`;- counter.classList.toggle('ed-over', n > f.max);- }- };- input.addEventListener('input', () => { sync(); field.classList.remove('ed-invalid'); err.textContent = ''; });- controls.set(f.key, { input, err, field });- form.appendChild(field);- }- card.appendChild(form);-- const formError = el('div', { class: 'ed-form-error', role: 'alert' });- card.appendChild(formError);-- const submitBtn = el('button', { class: 'ed-btn ed-btn-primary', type: 'submit', text: mode === 'free' ? 'Submit entry' : 'Review & pay' });- const actions = el('div', { class: 'ed-actions' }, [- el('button', { class: 'ed-btn', type: 'button', text: 'Cancel', onclick: () => finish(null) }),- submitBtn,- ]);- card.appendChild(actions);-- form.addEventListener('submit', (e) => {- e.preventDefault();- const values = {};- for (const [key, c] of controls) values[key] = c.input.value;- const result = validateEntry(values);- if (!result.ok) {- formError.textContent = 'Please fix the highlighted fields before submitting.';- let firstBad = null;- for (const [key, c] of controls) {- const msg = result.errors[key];- c.field.classList.toggle('ed-invalid', !!msg);- c.err.textContent = msg || '';- if (msg && !firstBad) firstBad = c.input;- }- firstBad?.focus();- return;- }- finish(normalizeEntry(values));- });-- requestAnimationFrame(() => {- root.classList.add('ed-show');- controls.get(ENTRY_FIELDS[0].key)?.input.focus();- });- });- }-- // ── payment panel rendering ─────────────────────────────────────────────────- _renderPanel({ stage, active = false, sub = null, explorer = null, free = false }) {- if (free) {- this.panel.innerHTML =- '<div class="ed-ph"><span class="ed-pt">Submitting to <b>Omniology</b></span><span class="ed-fee">Free entry</span></div>' +- '<div class="ed-sub">Sending your entry…</div>';- return;- }- const activeIdx = STAGES.findIndex((s) => s.id === stage);- const steps = STAGES.map((s, i) => {- const cls = i < activeIdx ? 'is-done' : (i === activeIdx && active ? 'is-active' : (i === activeIdx ? 'is-done' : ''));- return `<div class="ed-step ${cls}"><span class="ed-dot"></span>${escHtml(s.label)}</div>`;- }).join('');- const feeTxt = this._amount != null ? escHtml(fmtUsdc(this._amount)) : '— USDC';- let subHtml = '';- if (sub) {- subHtml = `<div class="ed-sub">${escHtml(sub)}`;- if (explorer) subHtml += ` · <a href="${escHtml(explorer)}" target="_blank" rel="noopener">Solscan ↗</a>`;- subHtml += '</div>';- }- this.panel.innerHTML =- `<div class="ed-ph"><span class="ed-pt">Entering <b>Omniology</b> contest</span><span class="ed-fee">${feeTxt}</span></div>` +- `<div class="ed-steps">${steps}</div>${subHtml}`;- }-- _renderReceipt(confirmation, payment, free) {- // Stepper fully done.- if (!free) {- this._renderPanel({ stage: 'done', active: false, sub: 'Entry accepted' });- this.panel.querySelectorAll('.ed-step').forEach((node) => { node.classList.remove('is-active'); node.classList.add('is-done'); });- } else {- this.panel.innerHTML =- '<div class="ed-ph"><span class="ed-pt">Submitted to <b>Omniology</b></span><span class="ed-fee">Free entry</span></div>';- }-- const rows = [];- const pos = confirmation.position;- const round = confirmation.round;- if (round != null) rows.push(['Round', String(round)]);- if (pos != null) rows.push(['Position', `#${pos}`]);- if (confirmation.entryId) rows.push(['Entry', shortAddr(confirmation.entryId)]);-- const receipt = el('div', { class: 'ed-receipt' });- const head = el('div', { class: 'ed-sub', html: '<b>You’re in.</b> Your entry just hit the live ticker.' });- receipt.appendChild(head);- for (const [k, val] of rows) {- receipt.appendChild(el('div', { class: 'ed-rrow' }, [el('span', { text: k }), el('span', { class: 'ed-v', text: val })]));- }- if (payment) {- const amount = payment.amount ? fmtUsdc(payment.amount) : '— USDC';- receipt.appendChild(el('div', { class: 'ed-rrow' }, [el('span', { text: 'Paid · network' }), el('span', { class: 'ed-v', text: `${amount} · Solana` })]));- const tx = payment.tx;- if (tx) {- const link = el('a', { href: payment.explorer || `https://solscan.io/tx/${tx}`, target: '_blank', rel: 'noopener', text: `${String(tx).slice(0, 8)}…${String(tx).slice(-6)} ↗` });- receipt.appendChild(el('div', { class: 'ed-rrow' }, [el('span', { text: 'Transaction' }), el('span', { class: 'ed-v' }, [link])]));- }- }- this.panel.appendChild(receipt);- this.panel.classList.add('ed-show');- }-- // Designed, honest error. The charging note is derived from the failure code so- // we never imply funds were untouched after settlement was uncertain.- _renderError(err) {- const code = err?.code || '';- const movedNoFunds = ['agent_required', 'endpoint_unreachable', 'invalid_challenge', 'blocked_url', 'no_solana_accept', 'missing_fee_payer', 'payment_required', 'submit_rejected', 'unsupported_asset'].includes(code);- const uncertain = code === 'settle_uncertain';-- this.panel.classList.add('ed-show');- // Mark the current stepper stage as errored if a stepper is showing.- const steps = this.panel.querySelectorAll('.ed-step');- if (steps.length) {- let lastActive = -1;- steps.forEach((n, i) => { if (n.classList.contains('is-active')) lastActive = i; });- const idx = lastActive >= 0 ? lastActive : 0;- steps.forEach((n, i) => { n.classList.remove('is-active'); if (i === idx) n.classList.add('is-err'); });- } else {- this.panel.innerHTML = '<div class="ed-ph"><span class="ed-pt">Entry not submitted</span></div>';- }-- const note = uncertain- ? '<span class="ed-warn">⚠ Payment status couldn’t be confirmed.</span> Check your agent’s activity before retrying so you don’t pay twice.'- : movedNoFunds- ? 'No payment was made — your wallet is unchanged. You can try again.'- : 'Something went wrong. No entry was recorded; try again in a moment.';- const msg = el('div', { class: 'ed-err-msg', html: `${escHtml(err?.message || 'Submission failed.')}<br>${note}` });- this.panel.appendChild(msg);- this._scheduleHide(uncertain ? 14000 : 8000);- }-- _scheduleHide(ms) {- clearTimeout(this._hideTimer);- this._hideTimer = setTimeout(() => { this.panel.classList.remove('ed-show'); }, ms);- }-- // ── celebration (sound + light pulse, reduced-motion gated) ──────────────────- _celebrate() {- this._celebrateT = CELEBRATE_MS_S;- if (!prefersReducedMotion()) this._chime();- }-- _chime() {- try {- const Ctx = window.AudioContext || window.webkitAudioContext;- if (!Ctx) return;- const ctx = this._audio || (this._audio = new Ctx());- if (ctx.state === 'suspended') ctx.resume().catch(() => {});- const now = ctx.currentTime;- const notes = [523.25, 783.99]; // C5 → G5, a soft confirming two-note- notes.forEach((freq, i) => {- const osc = ctx.createOscillator();- const gain = ctx.createGain();- osc.type = 'sine';- osc.frequency.value = freq;- const t = now + i * 0.11;- gain.gain.setValueAtTime(0.0001, t);- gain.gain.exponentialRampToValueAtTime(0.12, t + 0.02);- gain.gain.exponentialRampToValueAtTime(0.0001, t + 0.32);- osc.connect(gain).connect(ctx.destination);- osc.start(t);- osc.stop(t + 0.34);- });- } catch (err) {- log.warn('[entry-desk] chime failed:', err?.message);- }- }-- _toast(msg, tone) {- if (this.ui?.toast) this.ui.toast(msg, tone);- else log.info(`[entry-desk] ${msg}`);- }-- dispose() {- window.removeEventListener('keydown', this._onKey);- clearTimeout(this._hideTimer);- if (this.group) {- this.scene.remove(this.group);- this.group.traverse((n) => {- if (n.isMesh) {- n.geometry?.dispose?.();- const mats = Array.isArray(n.material) ? n.material : [n.material];- mats.forEach((m) => { m?.map?.dispose?.(); m?.dispose?.(); });- }- });- this.group = null;- }- this._screenTex?.dispose?.();- this.root?.remove();- if (this._audio && this._audio.state !== 'closed') this._audio.close().catch(() => {});- }-}diff --git a/src/game/arena/omniology-adapter.js b/src/game/arena/omniology-adapter.jsdeleted file mode 100644index a2558ab1b..000000000--- a/src/game/arena/omniology-adapter.js+++ /dev/null@@ -1,330 +0,0 @@-// Omniology adapter — the ONLY module that knows Omniology's wire shapes.-//-// Omniology (omniology.ai) is an external collaborator running AI-agent contests-// every ~88 seconds with USDC-on-Solana prizes. Their service exposes a single-// polled feed for the in-world screens and an x402-priced submit endpoint for the-// entry desk. This adapter is the boundary: it reads the configured base URL,-// fetches the raw feed, and normalizes it into the camelCase / millisecond shape-// the rest of the Arena consumes. Everything downstream (contest-screen.js,-// entry-desk.js) speaks NormalizedFeed only — so swapping the real base URL, or-// adapting to a wire-shape change, is a one-file edit here.-//-// Contract: docs/omniology-arena/CONTRACTS.md §1.1 (feed), §1.2 (submit), §2.1.-// No mocks, ever (CLAUDE.md): when no base URL is configured, fetchLiveFeed()-// surfaces an explicit `unconfigured` status — it NEVER fabricates contest data.--// ── config ───────────────────────────────────────────────────────────────────--/**- * Resolve Omniology's base URL (no trailing slash) from, in priority order:- * 1. window.OMNIOLOGY_BASE — runtime override (tests / embeds)- * 2. <meta name="omniology-base"> — baked into the Arena page- * 3. VITE_OMNIOLOGY_BASE — build-time env- * Returns '' when nothing is configured, which fetchLiveFeed() treats as the- * designed "unconfigured" state rather than an error.- * @returns {string}- */-export function omniologyBase() {- if (typeof window !== 'undefined' && window.OMNIOLOGY_BASE) {- return clean(window.OMNIOLOGY_BASE);- }- if (typeof document !== 'undefined') {- const v = document.querySelector('meta[name="omniology-base"]')?.getAttribute('content');- if (v && v.trim()) return clean(v);- }- try {- const env = import.meta?.env?.VITE_OMNIOLOGY_BASE;- if (env) return clean(String(env));- } catch (_) { /* import.meta unavailable outside a bundler (e.g. node tests) */ }- return '';-}--function clean(url) {- return String(url).trim().replace(/\/+$/, '');-}--// ── read: live contest feed ───────────────────────────────────────────────────--/**- * GET {base}/v1/contests/live and normalize to NormalizedFeed.- *- * - Unconfigured (no base URL): resolves to a NormalizedFeed with `ok:false` and- * `reason:'unconfigured'` — never fabricated data. The screens render their- * "connecting to Omniology" placeholder for this.- * - Network / HTTP error: THROWS (the poller catches it and drives the designed,- * auto-retrying error state). This matches the CONTRACTS §2.1 boundary.- *- * @returns {Promise<NormalizedFeed>}- */-export async function fetchLiveFeed() {- const base = omniologyBase();- if (!base) return unconfiguredFeed();-- const res = await fetch(`${base}/v1/contests/live`, {- headers: { accept: 'application/json' },- });- if (!res.ok) throw new Error(`Omniology feed HTTP ${res.status}`);- const data = await res.json();- return normalizeFeed(data);-}--/**- * Normalize Omniology's wire feed (snake_case, unix seconds) into the Arena's- * internal shape (camelCase, ms). Exported so the adapter's contract is unit- * testable without a live endpoint. Tolerant of nulls per CONTRACTS §1.1: an- * unknown field becomes null/empty, never invented.- * @param {object} data- * @returns {NormalizedFeed}- */-export function normalizeFeed(data) {- const d = data || {};- const serverNowMs = secToMs(d.now_unix) ?? nowMs();-- const c = d.current;- const current = c && c.id != null ? {- id: str(c.id),- title: str(c.title) || 'Live contest',- round: num(c.round) ?? 0,- opensMs: secToMs(c.opened_unix),- closesMs: secToMs(c.closes_unix),- entriesCount: num(c.entries_count) ?? 0,- prizeUsdc: num(c.prize_usdc) ?? 0,- prizeAsset: str(c.prize_asset) || 'USDC',- } : null;-- const next = d.next && d.next.opens_unix != null- ? { opensMs: secToMs(d.next.opens_unix) }- : null;-- const leaderboard = asArray(d.leaderboard).map((e, i) => ({- rank: num(e?.rank) ?? i + 1,- entryId: str(e?.entry_id),- agent: str(e?.agent) || 'anon',- score: num(e?.score),- thumbUrl: httpsUrl(e?.thumb_url),- }));-- const recentEntries = asArray(d.recent_entries).map((e) => ({- entryId: str(e?.entry_id),- agent: str(e?.agent) || 'anon',- submittedMs: secToMs(e?.submitted_unix) ?? serverNowMs,- }));-- const recentWinners = asArray(d.recent_winners).map((w) => ({- round: num(w?.round) ?? 0,- agent: str(w?.agent) || 'anon',- prizeUsdc: num(w?.prize_usdc) ?? 0,- tx: w?.tx ? str(w.tx) : null,- }));-- return {- ok: true,- reason: null,- serverNowMs,- current,- next,- leaderboard,- recentEntries,- recentWinners,- };-}--function unconfiguredFeed() {- return {- ok: false,- reason: 'unconfigured',- serverNowMs: nowMs(),- current: null,- next: null,- leaderboard: [],- recentEntries: [],- recentWinners: [],- };-}--// ── write: submit entry (consumed by the entry desk, prompt 04) ────────────────--/**- * Build the exact request the entry desk hands to `POST /api/x402-pay` for the- * external x402 flow (CONTRACTS §1.2 / §2.3). Defined here now so the boundary is- * frozen before prompt 04 — keep this signature stable.- *- * The server-side x402 payer handles the 402 challenge → sign → retry; this only- * describes the target request. The paying agentId is attached by the desk, not- * here (no wallet/secret ever touches this client module).- *- * @param {string} contestId- * @param {object} entry partner-defined entry payload- * @param {string|null} [agent] display name, or null- * @returns {{ url:string, method:'POST', body:{ entry:object, agent:string|null } }}- */-export function submitEntryRequest(contestId, entry, agent) {- const base = omniologyBase();- const id = encodeURIComponent(String(contestId ?? ''));- return {- url: `${base}/v1/contests/${id}/entries`,- method: 'POST',- body: { entry: entry ?? {}, agent: agent ?? null },- };-}--// ── compose schema + local validation (entry desk, prompt 04) ──────────────────-//-// Omniology's exact entry fields are pending QUESTIONS-FOR-OMNIOLOGY.md #6. This-// is the documented default contract and the SINGLE place to update when the-// partner confirms — the desk's compose UI renders itself from ENTRY_FIELDS, so a-// field change never touches entry-desk.js. Validation runs BEFORE any payment so-// a doomed entry is never charged (acceptance criteria + QUESTIONS #10).--/**- * @typedef {object} EntryField- * @property {string} key- * @property {string} label- * @property {'text'|'textarea'|'url'} type- * @property {boolean} required- * @property {number} [max] max characters- * @property {string} [placeholder]- * @property {string} [hint]- */--/** @type {EntryField[]} */-export const ENTRY_FIELDS = [- { key: 'title', label: 'Title', type: 'text', required: true, max: 80, placeholder: 'Name your entry', hint: 'Shown on the leaderboard.' },- { key: 'prompt', label: 'Your entry', type: 'textarea', required: true, max: 600, placeholder: 'What are you submitting to this round?', hint: 'This is what gets judged.' },- { key: 'media_url', label: 'Image or model URL', type: 'url', required: false, placeholder: 'https://… (optional)', hint: 'Optional HTTPS link to an image or 3D model.' },-];--/**- * Trim string fields and drop empty optionals so the wire body is clean and- * deterministic. Required-but-empty fields are kept as '' so validateEntry can- * flag them (rather than silently omitting and shipping an incomplete entry).- * @param {object} values raw compose-form values- * @returns {object}- */-export function normalizeEntry(values) {- const src = values && typeof values === 'object' ? values : {};- const out = {};- for (const f of ENTRY_FIELDS) {- const raw = src[f.key];- const val = typeof raw === 'string' ? raw.trim() : raw;- if (val === undefined || val === null || val === '') {- if (f.required) out[f.key] = '';- continue;- }- out[f.key] = val;- }- return out;-}--/**- * Validate a compose-form entry against Omniology's documented rules locally,- * before payment. Returns { ok, errors:{ [field]: message } }.- * @param {object} values- * @returns {{ ok:boolean, errors:Record<string,string> }}- */-export function validateEntry(values) {- const entry = normalizeEntry(values);- const errors = {};- for (const f of ENTRY_FIELDS) {- const val = entry[f.key];- if (f.required && (val == null || !String(val).length)) {- errors[f.key] = `${f.label} is required.`;- continue;- }- if (val == null || val === '') continue; // empty optional — nothing to check- const s = String(val);- if (f.max && s.length > f.max) {- errors[f.key] = `${f.label} must be ${f.max} characters or fewer.`;- continue;- }- if (f.type === 'url') {- let ok = false;- try { ok = new URL(s).protocol === 'https:'; } catch { ok = false; }- if (!ok) errors[f.key] = 'Enter a valid https:// link, or leave it blank.';- }- }- return { ok: Object.keys(errors).length === 0, errors };-}--/**- * How entries are priced — selected by config, NEVER a hardcoded flag in the desk:- * 'auto' (default) — let /api/x402-pay probe the submit URL: a 402 ⇒ paid (real- * x402 USDC), a plain 200 ⇒ free (no funds move).- * 'free' — Omniology confirmed entries are free (QUESTIONS #7); the desk POSTs- * the submit URL directly and skips the payment stepper entirely.- * 'paid' — entries always carry a fee; the desk always runs the x402 flow.- * Reads `window.OMNIOLOGY_ENTRY_FEE`, then `<meta name="omniology-entry-fee">`,- * then VITE_OMNIOLOGY_ENTRY_FEE.- * @returns {'auto'|'free'|'paid'}- */-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 */ } }- v = v.trim().toLowerCase();- return v === 'free' || v === 'paid' ? v : 'auto';-}--/**- * Pull the player-facing confirmation out of Omniology's submit response. On the- * paid path the body arrives nested under the payer's result envelope- * ({ result: { entry_id, status, round, position } }); on the free path it is the- * bare body. Tolerant of either, and of string/number round/position, so the desk- * always shows a real confirmation rather than "undefined".- * @param {object} resultEnvelope- * @returns {{ entryId:string|null, status:string|null, round:number|null, position:number|null }}- */-export function readEntryConfirmation(resultEnvelope) {- const env = resultEnvelope && typeof resultEnvelope === 'object' ? resultEnvelope : {};- const body = env.result && typeof env.result === 'object' ? env.result : env;- return {- entryId: body.entry_id ?? body.entryId ?? null,- status: body.status ?? null,- round: num(body.round),- position: num(body.position),- };-}--// ── coercion helpers (defensive: the feed is external) ─────────────────────────--function nowMs() { return Date.now(); }--function num(v) {- if (v == null) return null;- const n = Number(v);- return Number.isFinite(n) ? n : null;-}--function str(v) {- return v == null ? '' : String(v);-}--function secToMs(v) {- const n = num(v);- return n == null ? null : Math.round(n * 1000);-}--function asArray(v) {- return Array.isArray(v) ? v : [];-}--// Only surface CORS-readable HTTPS thumbnails; anything else (http, data:, junk)-// becomes null so the screen renders its designed monogram fallback instead of a-// broken-image box.-function httpsUrl(v) {- const s = str(v).trim();- return /^https:\/\//i.test(s) ? s : null;-}--/**- * @typedef {object} NormalizedFeed- * @property {boolean} ok true on a real feed, false when unconfigured- * @property {string|null} reason 'unconfigured' when ok is false, else null- * @property {number} serverNowMs server clock (ms) for countdown drift correction- * @property {{id:string,title:string,round:number,opensMs:number|null,closesMs:number|null,entriesCount:number,prizeUsdc:number,prizeAsset:string}|null} current- * @property {{opensMs:number|null}|null} next- * @property {Array<{rank:number,entryId:string,agent:string,score:number|null,thumbUrl:string|null}>} leaderboard- * @property {Array<{entryId:string,agent:string,submittedMs:number}>} recentEntries- * @property {Array<{round:number,agent:string,prizeUsdc:number,tx:string|null}>} recentWinners- */diff --git a/src/game/arena/omniology.js b/src/game/arena/omniology.jsdeleted file mode 100644index 0b28d38e5..000000000--- a/src/game/arena/omniology.js+++ /dev/null@@ -1,369 +0,0 @@-// Omniology Arena — entry module.-//-// Boots the OmniologyArena world, loads the local player's avatar through the-// shared avatar-rig library (the same path /play uses), connects multiplayer-// presence via CommunityNet to a namespaced `walk_world` instance, and renders-// every remote player with a nameplate and smooth interpolation. No multiplayer-// server changes: we join the existing `walk_world` room with a synthetic coin-// token (`arena:omniology`, tier '') so Colyseus isolates the arena into its own-// room instances, separate from every real coin world.-//-// Prompts 02–04 mount the venue GLB (via arena.setAnchors), the live contest-// screens, and the entry desk on top — they register with the arena, they don't-// edit this file.--import { Group } from 'three';-import { OmniologyArena, REMOTE_LERP, RUN_TIMESCALE } from './arena.js';-import { AnimationManager } from '../../animation-manager.js';-import { CommunityNet } from '../community-net.js';-import { mountContestScreens } from './contest-screens.js';-import { createEntryDesk } from './entry-desk.js';-import {- resolveAvatarUrl, buildAvatar, loadManifest, CLIP_IDLE, CLIP_WALK,-} from '../avatar-rig.js';-import {- getRequestedAvatar, getPlayCosmetics, setPlayName, GUEST_SENTINEL, uploadPendingGuestAvatar, CC_NAME_KEY,-} from '../play-handoff.js';-import { log } from '../../shared/log.js';--// The synthetic identity that namespaces the arena into its own walk_world-// instances. NOT a coin — a stable room key. $THREE is the only coin the platform-// references; this is plumbing (a room token), it names nothing tradeable.-const ARENA_COIN = { mint: 'arena:omniology', name: 'Omniology Arena', symbol: 'OMNI', image: '' };--// A networked peer: avatar rig + animation + nameplate, interpolated toward the-// server's authoritative transform. A focused sibling of coincommunities.js's-// RemotePlayer — it reuses the same avatar-rig library and the same REMOTE_LERP-// interpolation, minus the /play-only cosmetics + mini-game coupling the arena-// skeleton doesn't need. Registered as an arena updatable so it ticks each frame.-class RemotePlayer {- constructor(arena, player) {- this.arena = arena;- this.scene = arena.scene;- this.rig = new Group();- this.anim = new AnimationManager();- this.targetX = player.x; this.targetY = player.y; this.targetZ = player.z;- this.targetYaw = player.yaw; this.curYaw = player.yaw;- this.motion = player.motion || 'idle';- this.height = 1.7;- this._avatarUrl = null;- this._avatarToken = 0;- this._disposed = false;- this.rig.position.set(player.x, player.y, player.z);- this.scene.add(this.rig);-- // Nameplate — reuses the shared .cc-label treatment from coincommunities.css.- this.label = document.createElement('div');- this.label.className = 'cc-label';- this.label.textContent = player.name || 'guest';- document.body.appendChild(this.label);-- this.setAvatar(player.avatar);- }-- setAvatar(url) {- if (url === this._avatarUrl) return;- this._avatarUrl = url;- this.rig.clear();- this.anim = new AnimationManager();- // Tag this load so a slower in-flight GLB can't attach after a newer swap.- const token = (this._avatarToken += 1);- const anim = this.anim;- resolveAvatarUrl(url).then((u) => buildAvatar(this.rig, u, anim).then(({ height }) => {- if (this._disposed || token !== this._avatarToken) return;- this.height = height;- anim.crossfadeTo(this.motion === 'walk' || this.motion === 'run' ? CLIP_WALK : CLIP_IDLE, 0);- })).catch(() => {});- }-- apply(player) {- this.targetX = player.x; this.targetY = player.y; this.targetZ = player.z;- this.targetYaw = player.yaw;- if (player.name) this.label.textContent = player.name;- if (player.avatar !== this._avatarUrl) this.setAvatar(player.avatar);- if (player.motion !== this.motion) {- this.motion = player.motion;- this.anim.crossfadeTo(this.motion === 'walk' || this.motion === 'run' ? CLIP_WALK : CLIP_IDLE, 0.18);- }- }-- // Ticked by the arena loop: interpolate transform, advance animation, and- // re-anchor the nameplate above the head in screen space.- update(dt) {- this.rig.position.x += (this.targetX - this.rig.position.x) * REMOTE_LERP;- this.rig.position.y += (this.targetY - this.rig.position.y) * REMOTE_LERP;- this.rig.position.z += (this.targetZ - this.rig.position.z) * REMOTE_LERP;- let d = this.targetYaw - 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;- if (this.anim.currentName === CLIP_WALK) this.anim.setSpeed(this.motion === 'run' ? RUN_TIMESCALE : 1);- this.anim.update(dt);- this._placeLabel();- }-- _placeLabel() {- const p = this.arena.project({ x: this.rig.position.x, y: this.rig.position.y + this.height + 0.2, z: this.rig.position.z });- if (!p.visible) { this.label.style.display = 'none'; return; }- this.label.style.display = '';- this.label.style.transform = `translate(-50%, -100%) translate(${p.x}px, ${p.y}px)`;- }-- dispose() {- this._disposed = true;- this.scene.remove(this.rig);- this.rig.traverse((n) => {- n.geometry?.dispose?.();- const m = n.material;- if (Array.isArray(m)) m.forEach((x) => x?.dispose?.()); else m?.dispose?.();- });- this.label.remove();- }-}--// ----------------------------------------------------------------- status pill-function setStatus(state, label) {- const pill = document.getElementById('arena-status');- if (!pill) return;- pill.dataset.state = state;- const text = pill.querySelector('.label');- if (text) text.textContent = label;-}--// Map CommunityNet status → a human pill state. Mirrors the honest states from-// /play: connecting, online, reconnecting, single-player.-function applyNetStatus(net, status) {- switch (status) {- case 'connecting': setStatus('connecting', 'Connecting'); break;- case 'online': setStatus('online', 'Live'); break;- case 'failed': setStatus('connecting', 'Reconnecting'); break;- case 'offline': setStatus('offline', 'Offline'); break;- case 'unavailable': setStatus('offline', 'Single-player'); break;- default: setStatus('connecting', 'Connecting');- }- // Let the player force a retry when we've given up.- const pill = document.getElementById('arena-status');- if (!pill) return;- if (status === 'offline') {- pill.dataset.retry = '1';- pill.title = 'Reconnect';- pill.onclick = () => net.retry();- } else {- pill.dataset.retry = '0';- pill.title = '';- pill.onclick = null;- }-}--// ----------------------------------------------------------------- boot-async function hideLoader() {- const l = document.getElementById('kx-loading');- if (!l) return;- const boot = window.__ccBootAvatar;- try { await boot?.ready; } catch { /* proceed regardless */ }- l.classList.add('kx-hidden');- setTimeout(() => { try { boot?.dispose?.(); } catch {} l.remove(); }, 600);-}--// Resolve the player's paying agent — the custodial agent whose Solana USDC-// settles an entry fee at the desk. Reads the signed-in owner's agents (the same-// list the wallet hub Pay tab uses) and picks the first with a Solana wallet.-// Returns null when the visitor isn't signed in or has no walletted agent, which-// the desk renders as a designed "connect a paying agent" state — it never-// invents an identity or charges the wrong wallet.-async function resolvePayingAgent() {- try {- const res = await fetch('/api/x402-pay?agents=1', { credentials: 'include' });- if (!res.ok) return null;- const json = await res.json().catch(() => ({}));- const agents = Array.isArray(json.agents) ? json.agents : [];- return agents.find((a) => a && a.solana_address) || null;- } catch {- return null;- }-}--async function start(canvas) {- const arena = new OmniologyArena(canvas);-- // Kick the animation manifest fetch early (idempotent + cached); buildAvatar- // awaits it internally, so this just warms the cache.- loadManifest();-- // Local avatar — resolved exactly like /play (?avatar= deep link → saved- // cc-avatar → default). A staged-but-not-yet-uploaded guest avatar can't be- // loaded by peers, so we join without one and broadcast the public URL once the- // background upload finishes.- const avatarInput = getRequestedAvatar();- const localRig = new Group();- const localAnim = new AnimationManager();- const url = await resolveAvatarUrl(avatarInput);- const { height, fallback } = await buildAvatar(localRig, url, localAnim);- arena.attachLocalAvatar(localRig, localAnim, height);- arena.seatAtSpawn();- if (fallback && avatarInput !== GUEST_SENTINEL) {- log.warn('[omniology] avatar failed to load — using stand-in:', url);- }-- // Live contest screens (03) — one per venue screen anchor, all fed by a single- // shared Omniology poller (no duplicate requests, pauses when the tab is- // hidden). Reads whatever anchors are current, so it works against the authored- // defaults now and the venue GLB's resolved anchors once prompt 02 calls- // setAnchors before this. pushEntry is handed to the entry desk (04) so a- // settled submission lands on every screen the instant it confirms.- const contestScreens = mountContestScreens(arena);-- // Display name — reuse /play's persisted name (cc-name); mint a stable guest- // name if blank, and persist it so it sticks across worlds.- let name = '';- try { name = (localStorage.getItem(CC_NAME_KEY) || '').trim(); } catch { /* storage disabled */ }- if (!name) {- name = 'guest-' + Math.random().toString(36).slice(2, 6);- setPlayName(name);- }-- const isGuest = avatarInput === GUEST_SENTINEL;- const netAvatar = isGuest- ? ''- : (/^https?:\/\//i.test(avatarInput) || avatarInput.startsWith('/') ? avatarInput : url);-- // Connect presence. tier '' + an unset platform gate = open join (verified in- // WalkRoom.onAuth). The synthetic coin token isolates the arena room instances.- const net = new CommunityNet({- name,- avatar: netAvatar,- coin: ARENA_COIN,- tier: '',- cosmetics: getPlayCosmetics(),- });-- const remotes = new Map(); // sessionId → RemotePlayer- const unregister = new Map(); // sessionId → arena unregister fn-- const addRemote = (player, id) => {- if (id === net.sessionId) return; // that's us- if (remotes.has(id)) { remotes.get(id).apply(player); return; }- const r = new RemotePlayer(arena, player);- remotes.set(id, r);- unregister.set(id, arena.registerUpdatable(r));- };- const removeRemote = (id) => {- const r = remotes.get(id);- if (!r) return;- unregister.get(id)?.();- unregister.delete(id);- r.dispose();- remotes.delete(id);- };-- net.on('status', ({ status }) => applyNetStatus(net, status));- net.on('add', (p, id) => addRemote(p, id));- net.on('change', (p, id) => { if (id !== net.sessionId) remotes.get(id)?.apply(p); });- net.on('remove', (id) => removeRemote(id));-- // Stream our authoritative transform at the net's own 15Hz cadence. Registered- // as an arena updatable so it ticks inside the single render loop.- const mover = { update() { net.sendMove(arena.getLocalState()); } };- arena.registerUpdatable(mover);-- // Entry desk (04) — the in-world kiosk. Walk up, press E, compose an entry, and- // submit it to Omniology with a REAL USDC-on-Solana x402 payment (settled from- // the player's own agent wallet via /api/x402-pay). On confirmation it pushes the- // entry to every screen's live ticker, then the next poll reconciles it. Mounted- // at the venue's desk anchor; proximity is driven by the local player's position.- let payingAgent = null;- resolvePayingAgent().then((a) => { payingAgent = a; });- const desk = createEntryDesk(arena.scene, {- position: arena.anchors.desk.position,- rotationY: arena.anchors.desk.rotationY,- getAgentId: () => payingAgent?.id || null,- getAgentName: () => payingAgent?.name || name,- getContestId: () => contestScreens.getContestId(),- getPlayer: () => ({ x: arena.localPos.x, z: arena.localPos.z }),- onSubmitted: ({ entryId, agent }) => contestScreens.pushEntry({ entryId, agent: agent || name }),- });- arena.registerUpdatable(desk);-- if (isGuest) uploadPendingGuestAvatar((publicUrl) => net.setAvatar(publicUrl));-- net.connect();-- await hideLoader();-- // Teardown: drop the socket, every remote, the local avatar, and the world so- // navigating away leaks no rAF, listeners, or GPU memory.- let torn = false;- const teardown = () => {- if (torn) return;- torn = true;- try { net.destroy(); } catch {}- for (const id of [...remotes.keys()]) removeRemote(id);- try { desk.dispose(); } catch {}- try { contestScreens.dispose(); } catch {}- try {- localRig.traverse((n) => {- n.geometry?.dispose?.();- const m = n.material;- if (Array.isArray(m)) m.forEach((x) => x?.dispose?.()); else m?.dispose?.();- });- } catch {}- try { arena.dispose(); } catch {}- };- window.addEventListener('pagehide', teardown);- window.addEventListener('beforeunload', teardown);-- // Expose for debugging + future HUD prompts (mirrors window.__CC__).- if (typeof window !== 'undefined') {- // contestScreens.pushEntry is the hand-off the entry desk (04) wires to its- // onSubmitted callback so a confirmed entry shows on the screens immediately.- window.__ARENA__ = { arena, net, remotes, teardown, contestScreens, desk, pushEntry: contestScreens.pushEntry };- }-}--// Swap the boot loader for an actionable error state when the world can't start-// (most often WebGL unavailable), instead of a loader that never resolves.-function renderBootError(err) {- log.error('[omniology] boot failed:', err);- const noWebGL = err?.code === 'NO_WEBGL' || /webgl|context/i.test(err?.message || '');- let overlay = document.getElementById('kx-loading');- if (!overlay) { overlay = document.createElement('div'); overlay.id = 'kx-loading'; document.body.appendChild(overlay); }- overlay.classList.remove('kx-hidden');- overlay.replaceChildren();- try { window.__ccBootAvatar?.dispose?.(); } catch {}-- const card = document.createElement('div');- card.className = 'kx-loading-card kx-boot-error';- card.setAttribute('role', 'alert');- const mark = document.createElement('div');- mark.className = 'kx-loading-mark';- mark.textContent = noWebGL ? 'WebGL unavailable' : 'Couldn’t load the arena';- card.appendChild(mark);- const msg = document.createElement('p');- msg.className = 'kx-boot-error-msg';- msg.textContent = noWebGL- ? 'Your browser couldn’t start 3D graphics. Turn on hardware acceleration (or WebGL) and reload — on most browsers it’s under Settings › System.'- : 'Something went wrong starting the Omniology Arena. Reload to try again — if it keeps happening, your browser may be out of date.';- card.appendChild(msg);- const actions = document.createElement('div');- actions.className = 'kx-boot-error-actions';- const retry = document.createElement('button');- retry.type = 'button';- retry.className = 'kx-boot-error-btn';- retry.textContent = 'Try again';- retry.addEventListener('click', () => location.reload());- actions.appendChild(retry);- const home = document.createElement('a');- home.className = 'kx-boot-error-link';- home.href = '/';- home.textContent = 'Back to three.ws';- actions.appendChild(home);- card.appendChild(actions);- overlay.appendChild(card);- retry.focus();-}--const canvas = document.getElementById('kx-canvas');-if (canvas) {- start(canvas).catch(renderBootError);-}diff --git a/tests/agora-task-supply.test.js b/tests/agora-task-supply.test.jsindex 8f3cc1317..65f6962c1 100644--- a/tests/agora-task-supply.test.js+++ b/tests/agora-task-supply.test.js@@ -185,10 +185,7 @@ describe('roster assembly', () => {const specs = buildRoster([], { maxCitizens: 4 });expect(specs.length).toBe(4);expect(specs.every((s) => s.kind === 'agent')).toBe(true);- // 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);+ expect(specs.every((s) => s.professionBits === 1n)).toBe(true); // all Fetchers in Task 02});it('respects the citizen cap', () => {diff --git a/tests/arena-contest-screen.test.js b/tests/arena-contest-screen.test.jsdeleted file mode 100644index 93bde4854..000000000--- a/tests/arena-contest-screen.test.js+++ /dev/null@@ -1,175 +0,0 @@-// Contest screen + poller — unit tests for the pure logic (CONTRACTS §2.2).-//-// The canvas rendering needs a real 2D context (not available headless), so these-// pin the parts that carry the contract risk: the countdown formatting + drift-// colouring, the ticker de-dup/cap, the shared poller's cadence, round-flip-// fast-repoll, visibility pausing, and error backoff.--import { describe, it, expect, vi, afterEach, beforeEach } from 'vitest';-import {- formatCountdown,- countdownColor,- mergeTicker,-} from '../src/game/arena/contest-screen.js';-import {- createContestPoller,- backoffDelay,-} from '../src/game/arena/contest-screens.js';--describe('formatCountdown()', () => {- it('formats M:SS and floors at 0:00', () => {- expect(formatCountdown(88000)).toBe('1:28');- expect(formatCountdown(8000)).toBe('0:08');- expect(formatCountdown(0)).toBe('0:00');- expect(formatCountdown(-2000)).toBe('0:00');- });- it('handles null / non-finite', () => {- expect(formatCountdown(null)).toBe('—:—');- expect(formatCountdown(NaN)).toBe('—:—');- });-});--describe('countdownColor()', () => {- it('shifts calm → amber → red as the round closes', () => {- const calm = countdownColor(60000);- const warn = countdownColor(15000);- const danger = countdownColor(5000);- expect(calm).not.toBe(warn);- expect(warn).not.toBe(danger);- expect(countdownColor(60000)).toBe(calm); // stable above thresholds- expect(countdownColor(5000)).toBe(danger);- });-});--describe('mergeTicker()', () => {- it('dedupes by entryId, newest-first, capped', () => {- const existing = [- { entryId: 'b', agent: 'b', submittedMs: 200 },- { entryId: 'a', agent: 'a', submittedMs: 100 },- ];- const incoming = [- { entryId: 'c', agent: 'c', submittedMs: 300 },- { entryId: 'b', agent: 'b', submittedMs: 200 }, // dup — ignored- ];- const out = mergeTicker(existing, incoming, 10);- expect(out.map((e) => e.entryId)).toEqual(['c', 'b', 'a']);- });- it('caps to the requested length', () => {- const many = Array.from({ length: 30 }, (_, i) => ({ entryId: 's' + i, submittedMs: i }));- expect(mergeTicker([], many, 5)).toHaveLength(5);- });- it('collapses an optimistic entry once the feed confirms it (no double-count)', () => {- // applyFeed merges feed entries (incoming) over the existing buffer that- // holds the optimistic push — same entryId folds to a single, now-confirmed row.- const existing = [{ entryId: 'x1', agent: 'you', submittedMs: 500, optimistic: true }];- const incoming = [{ entryId: 'x1', agent: 'you', submittedMs: 500 }];- const out = mergeTicker(existing, incoming, 10);- expect(out).toHaveLength(1);- expect(out[0].optimistic).toBeUndefined(); // confirmed copy supersedes the optimistic one- });-- it('lists a fresh optimistic push ahead of older entries', () => {- const existing = [{ entryId: 'old', agent: 'a', submittedMs: 100 }];- const pushed = [{ entryId: 'new', agent: 'you', submittedMs: 900, optimistic: true }];- const out = mergeTicker(existing, pushed, 10);- expect(out[0].entryId).toBe('new');- expect(out[0].optimistic).toBe(true);- });-});--describe('backoffDelay()', () => {- it('grows exponentially and caps', () => {- expect(backoffDelay(1, 5000, 30000)).toBe(5000);- expect(backoffDelay(2, 5000, 30000)).toBe(10000);- expect(backoffDelay(3, 5000, 30000)).toBe(20000);- expect(backoffDelay(4, 5000, 30000)).toBe(30000);- expect(backoffDelay(10, 5000, 30000)).toBe(30000);- });-});--describe('createContestPoller()', () => {- beforeEach(() => { vi.useFakeTimers(); });- afterEach(() => {- vi.useRealTimers();- delete globalThis.document;- });-- function feedClosingIn(ms) {- const now = Date.now();- return {- ok: true, serverNowMs: now,- current: { id: 'c', round: 1, opensMs: now - 80000, closesMs: now + ms },- next: null, leaderboard: [], recentEntries: [], recentWinners: [],- };- }-- it('polls immediately on start, then at the steady cadence', async () => {- const fetchFeed = vi.fn(async () => feedClosingIn(60000));- const onFeed = vi.fn();- const poller = createContestPoller({ fetchFeed, onFeed, onError: () => {}, pollMs: 5000 });- poller.start();- await vi.advanceTimersByTimeAsync(1);- expect(fetchFeed).toHaveBeenCalledTimes(1);- expect(onFeed).toHaveBeenCalledTimes(1);- await vi.advanceTimersByTimeAsync(5000);- expect(fetchFeed).toHaveBeenCalledTimes(2);- poller.dispose();- });-- it('fast-repolls right after a round closes to catch the flip', async () => {- // First feed closes in 1s; after the 1s steady? no — within FLIP grace, so- // the next delay is the fast 1.5s, not 5s.- const fetchFeed = vi.fn(async () => feedClosingIn(1000));- const poller = createContestPoller({ fetchFeed, onFeed: () => {}, onError: () => {}, pollMs: 5000 });- poller.start();- await vi.advanceTimersByTimeAsync(1);- expect(fetchFeed).toHaveBeenCalledTimes(1);- // fast repoll fires at 1.5s, before the 5s steady cadence would- await vi.advanceTimersByTimeAsync(1500);- expect(fetchFeed).toHaveBeenCalledTimes(2);- poller.dispose();- });-- it('backs off and keeps retrying on error', async () => {- const fetchFeed = vi.fn(async () => { throw new Error('down'); });- const onError = vi.fn();- const poller = createContestPoller({ fetchFeed, onFeed: () => {}, onError, pollMs: 5000 });- poller.start();- await vi.advanceTimersByTimeAsync(1);- expect(onError).toHaveBeenCalledTimes(1);- // first backoff step is 5s; nothing before then- await vi.advanceTimersByTimeAsync(4000);- expect(fetchFeed).toHaveBeenCalledTimes(1);- await vi.advanceTimersByTimeAsync(1000);- expect(fetchFeed).toHaveBeenCalledTimes(2);- poller.dispose();- });-- it('stops polling after dispose', async () => {- const fetchFeed = vi.fn(async () => feedClosingIn(60000));- const poller = createContestPoller({ fetchFeed, onFeed: () => {}, onError: () => {}, pollMs: 5000 });- poller.start();- await vi.advanceTimersByTimeAsync(1);- poller.dispose();- await vi.advanceTimersByTimeAsync(20000);- expect(fetchFeed).toHaveBeenCalledTimes(1);- });-- it('pauses while the tab is hidden', async () => {- let hidden = false;- globalThis.document = {- get hidden() { return hidden; },- addEventListener: () => {},- removeEventListener: () => {},- };- const fetchFeed = vi.fn(async () => feedClosingIn(60000));- const poller = createContestPoller({ fetchFeed, onFeed: () => {}, onError: () => {}, pollMs: 5000 });- poller.start();- await vi.advanceTimersByTimeAsync(1);- expect(fetchFeed).toHaveBeenCalledTimes(1);- hidden = true;- await vi.advanceTimersByTimeAsync(20000); // scheduled ticks no-op while hidden- expect(fetchFeed).toHaveBeenCalledTimes(1);- poller.dispose();- });-});diff --git a/tests/arena-entry-desk.test.js b/tests/arena-entry-desk.test.jsdeleted file mode 100644index 99e664302..000000000--- a/tests/arena-entry-desk.test.js+++ /dev/null@@ -1,153 +0,0 @@-// Entry desk — unit tests for the prompt-04 logic that lives in the adapter-// boundary: the entry schema, LOCAL validation that must reject a bad entry-// BEFORE any payment, the config-driven free/paid fee mode (never a hardcoded-// flag), the wire normalization that drops empty optionals, and the tolerant-// confirmation parser. These are the correctness guarantees the desk depends on;-// the 3D kiosk + SSE stepper are exercised in a real browser (see prompt 04-// acceptance), not here.-//-// Contract: docs/omniology-arena/CONTRACTS.md §1.2, §2.3.--import { describe, it, expect, afterEach } from 'vitest';-import {- ENTRY_FIELDS,- normalizeEntry,- validateEntry,- entryFeeMode,- readEntryConfirmation,-} from '../src/game/arena/omniology-adapter.js';--describe('ENTRY_FIELDS', () => {- it('declares the documented required fields the compose UI renders from', () => {- const keys = ENTRY_FIELDS.map((f) => f.key);- expect(keys).toContain('title');- expect(keys).toContain('prompt');- // At least one required field, so an empty submit can never pass.- expect(ENTRY_FIELDS.some((f) => f.required)).toBe(true);- // Every field carries a label + type so the form is self-describing.- for (const f of ENTRY_FIELDS) {- expect(typeof f.label).toBe('string');- expect(['text', 'textarea', 'url']).toContain(f.type);- }- });-});--describe('normalizeEntry()', () => {- it('trims strings and drops empty optionals', () => {- const out = normalizeEntry({ title: ' Sunset ', prompt: 'a calm beach', media_url: ' ' });- expect(out.title).toBe('Sunset');- expect(out.prompt).toBe('a calm beach');- expect('media_url' in out).toBe(false); // empty optional dropped- });-- it('keeps a required-but-empty field as "" so validation can flag it', () => {- const out = normalizeEntry({ prompt: 'x' });- expect(out.title).toBe(''); // required, missing → kept empty, not omitted- });-- it('keeps a valid optional value', () => {- const out = normalizeEntry({ title: 'a', prompt: 'b', media_url: 'https://x.test/i.png' });- expect(out.media_url).toBe('https://x.test/i.png');- });-});--describe('validateEntry() — rejects bad entries before payment', () => {- it('passes a complete, valid entry', () => {- const v = validateEntry({ title: 'Sunset', prompt: 'a calm beach at dusk' });- expect(v.ok).toBe(true);- expect(v.errors).toEqual({});- });-- it('flags missing required fields', () => {- const v = validateEntry({ title: '', prompt: ' ' });- expect(v.ok).toBe(false);- expect(v.errors.title).toMatch(/required/i);- expect(v.errors.prompt).toMatch(/required/i);- });-- it('enforces the per-field character limit', () => {- const titleField = ENTRY_FIELDS.find((f) => f.key === 'title');- const tooLong = 'x'.repeat(titleField.max + 1);- const v = validateEntry({ title: tooLong, prompt: 'ok' });- expect(v.ok).toBe(false);- expect(v.errors.title).toMatch(new RegExp(`${titleField.max}`));- });-- it('rejects a non-https media URL but accepts a blank optional', () => {- const bad = validateEntry({ title: 't', prompt: 'p', media_url: 'http://insecure/x.png' });- expect(bad.ok).toBe(false);- expect(bad.errors.media_url).toMatch(/https/i);-- const blankOptional = validateEntry({ title: 't', prompt: 'p', media_url: '' });- expect(blankOptional.ok).toBe(true);-- const goodUrl = validateEntry({ title: 't', prompt: 'p', media_url: 'https://cdn.test/x.png' });- expect(goodUrl.ok).toBe(true);- });-});--describe('entryFeeMode() — selected by config, never hardcoded', () => {- afterEach(() => {- delete globalThis.window;- delete globalThis.document;- });-- it('defaults to auto when unconfigured', () => {- expect(entryFeeMode()).toBe('auto');- });-- it('reads window.OMNIOLOGY_ENTRY_FEE (case-insensitive)', () => {- globalThis.window = { OMNIOLOGY_ENTRY_FEE: 'FREE' };- expect(entryFeeMode()).toBe('free');- globalThis.window = { OMNIOLOGY_ENTRY_FEE: 'paid' };- expect(entryFeeMode()).toBe('paid');- });-- it('reads the <meta name="omniology-entry-fee"> tag', () => {- globalThis.document = {- querySelector: (sel) =>- sel === 'meta[name="omniology-entry-fee"]'- ? { getAttribute: () => 'free' }- : null,- };- expect(entryFeeMode()).toBe('free');- });-- it('falls back to auto for an unrecognized value', () => {- globalThis.window = { OMNIOLOGY_ENTRY_FEE: 'whenever' };- expect(entryFeeMode()).toBe('auto');- });-});--describe('readEntryConfirmation() — tolerant of both wire shapes', () => {- it('reads the paid-path nested result envelope', () => {- const env = {- ok: true,- result: { entry_id: 'e_42', status: 'accepted', round: 1421, position: 38 },- payment: { tx: 'sig', amount: '250000' },- };- expect(readEntryConfirmation(env)).toEqual({- entryId: 'e_42', status: 'accepted', round: 1421, position: 38,- });- });-- it('reads the free-path bare body', () => {- const env = { entry_id: 'e_7', status: 'accepted', round: 9, position: 2 };- expect(readEntryConfirmation(env)).toEqual({- entryId: 'e_7', status: 'accepted', round: 9, position: 2,- });- });-- it('coerces string round/position and tolerates missing fields', () => {- const env = { result: { entry_id: 'e1', round: '12', position: '4' } };- const c = readEntryConfirmation(env);- expect(c.round).toBe(12);- expect(c.position).toBe(4);- expect(c.status).toBeNull();- });-- it('never throws on an empty/garbage envelope', () => {- expect(readEntryConfirmation(null)).toEqual({ entryId: null, status: null, round: null, position: null });- expect(readEntryConfirmation({})).toEqual({ entryId: null, status: null, round: null, position: null });- });-});diff --git a/tests/arena-omniology-adapter.test.js b/tests/arena-omniology-adapter.test.jsdeleted file mode 100644index f0bd914fc..000000000--- a/tests/arena-omniology-adapter.test.js+++ /dev/null@@ -1,158 +0,0 @@-// Omniology adapter — unit tests for the wire→normalized boundary (CONTRACTS §2.1).-//-// The adapter is the ONLY module that knows Omniology's wire shapes, so this is-// where the contract is pinned: base-URL resolution, the snake_case→camelCase /-// unix-seconds→ms normalization, the no-mocks "unconfigured" surface, throwing on-// HTTP error, and the frozen submitEntryRequest payload that prompt 04 depends on.--import { describe, it, expect, afterEach, vi } from 'vitest';-import {- omniologyBase,- normalizeFeed,- fetchLiveFeed,- submitEntryRequest,-} from '../src/game/arena/omniology-adapter.js';--// A realistic feed straight from CONTRACTS §1.1.-const WIRE = {- now_unix: 1719259200,- current: {- id: 'c_abc',- title: 'Best landscape',- round: 1421,- opened_unix: 1719259112,- closes_unix: 1719259200,- entries_count: 37,- prize_usdc: 12.5,- prize_asset: 'USDC',- },- next: { opens_unix: 1719259260 },- leaderboard: [- { rank: 1, entry_id: 'e1', agent: 'nova', score: 0.92, thumb_url: 'https://cdn.omniology.ai/e1.png' },- { rank: 2, entry_id: 'e2', agent: 'atlas', score: 0.81, thumb_url: null },- ],- recent_entries: [- { entry_id: 'e9', agent: 'zephyr', submitted_unix: 1719259190 },- ],- recent_winners: [- { round: 1420, agent: 'orion', prize_usdc: 11.0, tx: '5xSig' },- ],-};--describe('omniologyBase()', () => {- afterEach(() => {- delete globalThis.window;- delete globalThis.document;- });-- it('returns empty string when nothing is configured', () => {- expect(omniologyBase()).toBe('');- });-- it('reads window.OMNIOLOGY_BASE and strips trailing slashes', () => {- globalThis.window = { OMNIOLOGY_BASE: 'https://api.omniology.ai/' };- expect(omniologyBase()).toBe('https://api.omniology.ai');- });-- it('reads the <meta name="omniology-base"> tag', () => {- globalThis.document = {- querySelector: (sel) =>- sel === 'meta[name="omniology-base"]'- ? { getAttribute: () => ' https://feed.omniology.ai/ ' }- : null,- };- expect(omniologyBase()).toBe('https://feed.omniology.ai');- });-});--describe('normalizeFeed()', () => {- it('maps the wire feed to camelCase / ms', () => {- const f = normalizeFeed(WIRE);- expect(f.ok).toBe(true);- expect(f.serverNowMs).toBe(1719259200 * 1000);- expect(f.current).toMatchObject({- id: 'c_abc',- title: 'Best landscape',- round: 1421,- opensMs: 1719259112000,- closesMs: 1719259200000,- entriesCount: 37,- prizeUsdc: 12.5,- prizeAsset: 'USDC',- });- expect(f.next).toEqual({ opensMs: 1719259260000 });- expect(f.leaderboard[0]).toMatchObject({ rank: 1, entryId: 'e1', agent: 'nova', score: 0.92 });- expect(f.leaderboard[0].thumbUrl).toBe('https://cdn.omniology.ai/e1.png');- expect(f.recentEntries[0]).toMatchObject({ entryId: 'e9', agent: 'zephyr', submittedMs: 1719259190000 });- expect(f.recentWinners[0]).toMatchObject({ round: 1420, agent: 'orion', prizeUsdc: 11, tx: '5xSig' });- });-- it('tolerates nulls and missing fields without inventing data', () => {- const f = normalizeFeed({ now_unix: 1719259200, current: null, next: null });- expect(f.current).toBeNull();- expect(f.next).toBeNull();- expect(f.leaderboard).toEqual([]);- expect(f.recentEntries).toEqual([]);- expect(f.recentWinners).toEqual([]);- });-- it('drops non-HTTPS thumbnails to null (designed monogram fallback)', () => {- const f = normalizeFeed({- ...WIRE,- leaderboard: [{ rank: 1, entry_id: 'e1', agent: 'nova', score: 0.5, thumb_url: 'http://insecure/x.png' }],- });- expect(f.leaderboard[0].thumbUrl).toBeNull();- });-});--describe('fetchLiveFeed()', () => {- afterEach(() => {- delete globalThis.window;- delete globalThis.document;- vi.unstubAllGlobals();- });-- it('surfaces an unconfigured status (never fabricated data) when no base is set', async () => {- const f = await fetchLiveFeed();- expect(f.ok).toBe(false);- expect(f.reason).toBe('unconfigured');- expect(f.current).toBeNull();- expect(f.leaderboard).toEqual([]);- });-- it('fetches and normalizes against a configured base', async () => {- globalThis.window = { OMNIOLOGY_BASE: 'https://api.omniology.ai' };- const fetchMock = vi.fn(async (url) => {- expect(url).toBe('https://api.omniology.ai/v1/contests/live');- return { ok: true, json: async () => WIRE };- });- vi.stubGlobal('fetch', fetchMock);- const f = await fetchLiveFeed();- expect(fetchMock).toHaveBeenCalledOnce();- expect(f.ok).toBe(true);- expect(f.current.round).toBe(1421);- });-- it('throws on an HTTP error so the poller can drive the retry state', async () => {- globalThis.window = { OMNIOLOGY_BASE: 'https://api.omniology.ai' };- vi.stubGlobal('fetch', vi.fn(async () => ({ ok: false, status: 503 })));- await expect(fetchLiveFeed()).rejects.toThrow(/503/);- });-});--describe('submitEntryRequest()', () => {- afterEach(() => { delete globalThis.window; });-- it('builds the frozen POST payload for the x402 desk flow', () => {- globalThis.window = { OMNIOLOGY_BASE: 'https://api.omniology.ai' };- const req = submitEntryRequest('c abc/1', { prompt: 'a cat' }, 'nova');- expect(req.method).toBe('POST');- expect(req.url).toBe('https://api.omniology.ai/v1/contests/c%20abc%2F1/entries');- expect(req.body).toEqual({ entry: { prompt: 'a cat' }, agent: 'nova' });- });-- it('defaults a null agent and empty entry', () => {- const req = submitEntryRequest('c1');- expect(req.body).toEqual({ entry: {}, agent: null });- });-});diff --git a/tests/arena-venue.test.js b/tests/arena-venue.test.jsdeleted file mode 100644index 3cb645305..000000000--- a/tests/arena-venue.test.js+++ /dev/null@@ -1,200 +0,0 @@-// Tests for the named-empty contract between the authored Omniology Arena-// venue GLB and the runtime. We don't boot the bootstrap here — that pulls in-// a WebGLRenderer + the live DOM — instead we exercise the pure helpers in-// src/game/arena/arena-venue.js against a synthetic three.js scene graph.-//-// Locks in the guarantees the prompt 02 spec demands:-// 1. When the venue exposes every required empty, the runtime reads spawn /-// screen / desk / light / camera transforms FROM those empties (world-// space), so moving an empty in the build script moves the runtime-// feature with it.-// 2. When ANY required empty is missing, the load fails loudly and the error-// names which empty is absent — so the author can fix it without guessing.--import { describe, it, expect } from 'vitest';-import { Group, Object3D, Vector3 } from 'three';--import {- ARENA_REQUIRED_EMPTIES,- ARENA_SCREEN_SLOTS,- ARENA_RIM_LIGHTS,- DEFAULT_SCREEN_WIDTH_M,- collectArenaEmpties,- resolveArenaAnchors,- arenaBounds,-} from '../src/game/arena/arena-venue.js';--/**- * Build a synthetic scene that satisfies ARENA_REQUIRED_EMPTIES. Each named- * empty gets a deterministic world position (and, where it matters, a yaw,- * scale, or extras) so the tests can assert on exact values.- *- * @param {object} [opts]- * @param {Set<string>} [opts.omit] — names to skip (sad-path test).- */-function makeSyntheticArena({ omit = new Set() } = {}) {- const root = new Group();- root.name = 'arena';-- const positions = {- spawn_01: [0, 0, 6],- screen_01: [-8, 3, -8],- screen_02: [0, 3, -10],- screen_03: [8, 3, -8],- desk_01: [0, 0, 4],- light_key: [4, 7, 4],- light_fill: [-4, 6, 2],- light_rim_01: [-9, 5, -9],- light_rim_02: [0, 5, -11],- light_rim_03: [9, 5, -9],- camera_intro: [0, 2.2, 12],- };-- const nodes = {};- for (const [name, [x, y, z]] of Object.entries(positions)) {- if (omit.has(name)) continue;- const obj = new Object3D();- obj.name = name;- obj.position.set(x, y, z);- root.add(obj);- nodes[name] = obj;- }-- // Author a known yaw + width on screen_01 and an intro-camera yaw so the- // resolver's world-transform reads are exercised, not just positions.- if (nodes.screen_01) {- nodes.screen_01.rotation.y = Math.PI / 2;- nodes.screen_01.scale.set(9, 1, 1); // width = 9 m- }- if (nodes.spawn_01) nodes.spawn_01.rotation.y = Math.PI;- if (nodes.camera_intro) nodes.camera_intro.rotation.y = Math.PI; // faces +Z toward spawn- // Author light extras (glTF extras → userData) on the key light.- if (nodes.light_key) nodes.light_key.userData = { color: '#ff8800', intensity: 5, castShadow: true };-- root.updateMatrixWorld(true);- return { root, positions, nodes };-}--describe('ARENA_REQUIRED_EMPTIES', () => {- it('enumerates spawn, every screen + rim slot, desk, key/fill, and intro camera', () => {- expect(ARENA_REQUIRED_EMPTIES).toContain('spawn_01');- expect(ARENA_REQUIRED_EMPTIES).toContain('desk_01');- expect(ARENA_REQUIRED_EMPTIES).toContain('light_key');- expect(ARENA_REQUIRED_EMPTIES).toContain('light_fill');- expect(ARENA_REQUIRED_EMPTIES).toContain('camera_intro');-- const screens = ARENA_REQUIRED_EMPTIES.filter((n) => /^screen_\d{2}$/.test(n));- const rims = ARENA_REQUIRED_EMPTIES.filter((n) => /^light_rim_\d{2}$/.test(n));- expect(screens).toHaveLength(ARENA_SCREEN_SLOTS);- expect(rims).toHaveLength(ARENA_RIM_LIGHTS);- });-});--describe('collectArenaEmpties', () => {- it('returns a Map keyed by name covering every required empty', () => {- const { root } = makeSyntheticArena();- const empties = collectArenaEmpties(root, ARENA_REQUIRED_EMPTIES);-- expect(empties.size).toBe(ARENA_REQUIRED_EMPTIES.length);- for (const name of ARENA_REQUIRED_EMPTIES) {- expect(empties.has(name)).toBe(true);- expect(empties.get(name).name).toBe(name);- }- });-- it('throws naming every missing empty when the venue is incomplete', () => {- const { root } = makeSyntheticArena({ omit: new Set(['screen_02', 'light_key']) });- expect(() => collectArenaEmpties(root, ARENA_REQUIRED_EMPTIES)).toThrow(/screen_02/);- expect(() => collectArenaEmpties(root, ARENA_REQUIRED_EMPTIES)).toThrow(/light_key/);- });-- it('rejects a non-Object3D root with a clear error', () => {- expect(() => collectArenaEmpties(null)).toThrow(/Object3D/);- expect(() => collectArenaEmpties({})).toThrow(/Object3D/);- });-});--describe('resolveArenaAnchors', () => {- it('reads spawn / screen / desk transforms from the empties (world space)', () => {- const { root, positions } = makeSyntheticArena();- const empties = collectArenaEmpties(root, ARENA_REQUIRED_EMPTIES);- const anchors = resolveArenaAnchors(empties);-- 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].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.position.toArray()).toEqual(positions.desk_01);- expect(anchors.desk.node.name).toBe('desk_01');- });-- it('resolves the lighting rig with per-role defaults and authored extras', () => {- const { root } = makeSyntheticArena();- const empties = collectArenaEmpties(root, ARENA_REQUIRED_EMPTIES);- const anchors = resolveArenaAnchors(empties);-- const key = anchors.lights.find((l) => l.name === 'light_key');- expect(key.kind).toBe('key');- expect(key.castShadow).toBe(true);- expect(key.color).toBe(0xff8800); // authored via extras '#ff8800'- expect(key.intensity).toBe(5); // authored via extras-- const fill = anchors.lights.find((l) => l.name === 'light_fill');- expect(fill.kind).toBe('fill');- expect(fill.castShadow).toBe(false); // default — fill never shadows-- const rims = anchors.lights.filter((l) => l.kind === 'rim');- expect(rims).toHaveLength(ARENA_RIM_LIGHTS);- for (const rim of rims) expect(rim.castShadow).toBe(false);- });-- it('aims the intro camera by the empty facing (rotating it re-aims lookAt)', () => {- const { root, positions } = makeSyntheticArena();- const empties = collectArenaEmpties(root, ARENA_REQUIRED_EMPTIES);- const anchors = resolveArenaAnchors(empties);-- 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.position.z);- expect(anchors.camera_intro.lookAt.x).toBeCloseTo(anchors.camera_intro.position.x, 5);- });-- it('honors a parent transform when computing world positions', () => {- const { root } = makeSyntheticArena();- root.position.set(10, 0, -2);- root.updateMatrixWorld(true);-- const empties = collectArenaEmpties(root, ARENA_REQUIRED_EMPTIES);- const anchors = resolveArenaAnchors(empties);- // spawn_01 local (0,0,6) + parent (10,0,-2) → world (10,0,4).- expect(anchors.spawn.position.toArray()).toEqual([10, 0, 4]);- });-});--describe('arenaBounds', () => {- it('derives a walkable footprint that contains the spawn and clamps outside it', () => {- const { root } = makeSyntheticArena();- const empties = collectArenaEmpties(root, ARENA_REQUIRED_EMPTIES);- const anchors = resolveArenaAnchors(empties);- const bounds = arenaBounds(anchors);-- // Spawn must be reachable (inside the clamp).- 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);-- // A point far outside the room is pulled back onto the bound.- const far = bounds.clamp(999, 999);- expect(far.x).toBeLessThanOrEqual(bounds.center.x + bounds.halfX + 1e-6);- expect(far.z).toBeLessThanOrEqual(bounds.center.z + bounds.halfZ + 1e-6);- });-});diff --git a/tests/atelier-adapter.test.js b/tests/atelier-adapter.test.jsdeleted file mode 100644index bbfd387a6..000000000--- a/tests/atelier-adapter.test.js+++ /dev/null@@ -1,128 +0,0 @@-// Tests for the Atelier marketplace boundary — the ONLY module that knows-// Atelier's wire shapes. We exercise the pure normalizers (no live endpoint, no-// DOM) so the contract the plaza consumes is locked:-// 1. The three.ws 3D Studio is ALWAYS present and featured (the strategy: we're-// registered as Atelier's 3D specialist), even with an empty/absent feed.-// 2. Wire agents normalize snake_case → camelCase, unix→ms, with null-tolerant-// coercion — never inventing data for missing fields.-// 3. Hire requests build the exact /api/x402-pay external payload, and the-// internal studio is excluded from x402 (it routes to the forge).--import { describe, it, expect } from 'vitest';--import {- STUDIO_AGENT,- normalizeRoster,- normalizeAgent,- hireRequest,-} from '../src/game/arena/atelier-adapter.js';--const BASE = 'https://api.atelierai.xyz';--describe('STUDIO_AGENT', () => {- it('is always-present, featured, internal, and free', () => {- expect(STUDIO_AGENT.id).toBe('threews-studio');- expect(STUDIO_AGENT.featured).toBe(true);- expect(STUDIO_AGENT.internal).toBe(true);- expect(STUDIO_AGENT.priceUsdc).toBe(0);- expect(STUDIO_AGENT.hireUrl).toBe('/forge');- });- it('is frozen so a consumer can never mutate the shared listing', () => {- expect(Object.isFrozen(STUDIO_AGENT)).toBe(true);- });-});--describe('normalizeRoster', () => {- it('prepends the studio agent even when the feed is empty', () => {- const r = normalizeRoster({ now_unix: 1719259200, agents: [] }, BASE);- expect(r.ok).toBe(true);- expect(r.agents).toHaveLength(1);- expect(r.agents[0].id).toBe('threews-studio');- expect(r.serverNowMs).toBe(1719259200 * 1000);- });-- it('tolerates a null/garbage payload without throwing', () => {- expect(() => normalizeRoster(null)).not.toThrow();- expect(() => normalizeRoster({ agents: 'nope' })).not.toThrow();- const r = normalizeRoster(undefined);- expect(r.agents[0].id).toBe('threews-studio');- expect(typeof r.serverNowMs).toBe('number');- });-- it('normalizes marketplace agents after the studio', () => {- const r = normalizeRoster({- now_unix: 1719259200,- agents: [- { id: 'img-1', name: 'Pixel', specialty: 'Image', price_usdc: 4, price_period: 'per task', rating: 4.8, jobs_done: 1203, avatar_url: 'https://cdn.x/a.glb', hire_url: '/v1/agents/img-1/hire' },- ],- }, BASE);- expect(r.agents).toHaveLength(2);- const a = r.agents[1];- expect(a).toMatchObject({- id: 'img-1', name: 'Pixel', specialty: 'Image',- priceUsdc: 4, pricePeriod: 'per task', rating: 4.8, jobsDone: 1203,- avatarUrl: 'https://cdn.x/a.glb', featured: false, internal: false,- });- expect(a.hireUrl).toBe(`${BASE}/v1/agents/img-1/hire`);- });-});--describe('normalizeAgent', () => {- it('drops an agent with no id (it cannot be hired or addressed)', () => {- expect(normalizeAgent({ name: 'ghost' })).toBeNull();- expect(normalizeAgent(null)).toBeNull();- });-- it('fills sensible defaults for missing fields, never inventing values', () => {- const a = normalizeAgent({ id: 'x' }, BASE);- expect(a.name).toBe('Untitled agent');- expect(a.tagline).toBe('');- expect(a.priceUsdc).toBe(0);- expect(a.pricePeriod).toBe('per task');- expect(a.rating).toBeNull();- expect(a.jobsDone).toBeNull();- // hire URL defaults to the canonical per-agent route when none is supplied- expect(a.hireUrl).toBe(`${BASE}/v1/agents/x/hire`);- });-- it('rejects a non-https avatar URL (renders the monogram fallback instead)', () => {- expect(normalizeAgent({ id: 'x', avatar_url: 'http://insecure/a.png' }, BASE).avatarUrl).toBe('');- expect(normalizeAgent({ id: 'x', avatar_url: 'data:image/png;base64,zz' }, BASE).avatarUrl).toBe('');- expect(normalizeAgent({ id: 'x', avatar_url: 'https://ok/a.png' }, BASE).avatarUrl).toBe('https://ok/a.png');- });-- it('keeps an absolute https hire URL, and absolutizes a relative one', () => {- expect(normalizeAgent({ id: 'x', hire_url: 'https://pay.x/hire' }, BASE).hireUrl).toBe('https://pay.x/hire');- expect(normalizeAgent({ id: 'x', hire_url: 'hire' }, BASE).hireUrl).toBe(`${BASE}/hire`);- expect(normalizeAgent({ id: 'x', hire_url: '/hire' }, BASE).hireUrl).toBe(`${BASE}/hire`);- });-- it('encodes ids with URL-special characters in the default hire route', () => {- expect(normalizeAgent({ id: 'a/b c' }, BASE).hireUrl).toBe(`${BASE}/v1/agents/a%2Fb%20c/hire`);- });-});--describe('hireRequest', () => {- it('returns null for the internal studio agent (routes to the forge, not x402)', () => {- expect(hireRequest(STUDIO_AGENT)).toBeNull();- });-- it('returns null for an agent missing a hire URL', () => {- expect(hireRequest({ id: 'x', internal: false, hireUrl: '' })).toBeNull();- });-- it('builds the exact /api/x402-pay external payload for a marketplace agent', () => {- const a = normalizeAgent({ id: 'img-1', hire_url: 'https://pay.x/hire' }, BASE);- const req = hireRequest(a, { prompt: 'a fox mascot' });- expect(req).toEqual({- url: 'https://pay.x/hire',- method: 'POST',- body: { brief: { prompt: 'a fox mascot' } },- });- });-- it('defaults the brief to an empty object', () => {- const a = normalizeAgent({ id: 'img-1', hire_url: 'https://pay.x/hire' }, BASE);- expect(hireRequest(a).body).toEqual({ brief: {} });- });-});diff --git a/vercel.json b/vercel.jsonindex bdd75d977..114643549 100644--- a/vercel.json+++ b/vercel.json@@ -882,14 +882,6 @@"src": "/play/arena/?","dest": "/play/arena.html"},- {- "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.jsindex 8ca56a674..c2222fbf5 100644--- a/vite.config.js+++ b/vite.config.js@@ -471,7 +471,6 @@ const appConfig = {'play-ufo': resolve(__dirname, 'pages/play/ufo.html'),agi: resolve(__dirname, 'pages/agi.html'),arena: resolve(__dirname, 'pages/arena.html'),- 'arena-omniology': resolve(__dirname, 'pages/arena/omniology.html'),'smart-money': resolve(__dirname, 'pages/smart-money.html'),pose: resolve(__dirname, 'pages/pose.html'),'pose-mini': resolve(__dirname, 'pages/pose-mini.html'),@@ -845,10 +844,6 @@ support: resolve(__dirname, 'pages/support.html'),'/vaults/': resolve(root, 'pages/vaults.html'),'/alpha-copilot': resolve(root, 'pages/alpha-copilot.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'),@@ -1694,26 +1689,20 @@ support: resolve(__dirname, 'pages/support.html'),.split('/').pop();if (EMBED_FILES.has(filename)) return [];- // Inline the dependency-free source directly as a classic- // (non-module) script. Two failure modes this avoids:- // 1. A `type=module` inline script gets externalized by Vite- // into a `?html-proxy` request that 404s to the SPA HTML- // fallback for repo-root dir-index pages (e.g. /docs).- // 2. A dynamic `import('/src/view-transitions.js')` is rewritten- // by the prod build into `import('data:text/javascript;…')`,- // which the site CSP (no `data:` in script-src) blocks — the- // transition wiring then silently never runs.- // Inlining the actual source sidesteps both: it runs under the- // existing `'unsafe-inline'` allowance with no extra fetch. The- // file stays the single source of truth (dev imports it directly).- const vtSource = readFileSync(- resolve(__dirname, 'src/view-transitions.js'),- 'utf8',- ).replace(/^export\s+function/m, 'function');return [{tag: 'script',- children: `(function(){${vtSource}\ntry{enableViewTransitions();}catch(e){}})();`,+ // Classic (non-module) inline script on purpose: a `type=module`+ // inline script gets externalized by Vite into a `?html-proxy`+ // request that fails to resolve for repo-root dir-index pages+ // (e.g. /docs → docs/index.html), where the proxy URL falls+ // through to the SPA HTML fallback and the browser throws+ // "Failed to load module script … MIME type text/html". A classic+ // script keeps the dynamic import inline; /src/view-transitions.js+ // is dependency-free browser ESM that Vite serves directly in dev+ // and the copy-src-to-dist plugin mirrors into dist/ for prod, so+ // it resolves in both — no html-proxy needed.+ children: `import('/src/view-transitions.js').then(m=>m.enableViewTransitions()).catch(()=>{});`,injectTo: 'head',},];diff --git a/workers/agora-citizens/work/_skills.js b/workers/agora-citizens/work/_skills.jsindex b2780d8f9..3e78b327a 100644--- a/workers/agora-citizens/work/_skills.js+++ b/workers/agora-citizens/work/_skills.js@@ -47,16 +47,17 @@ export function proofBytesFromHex(hex) {}// A compact, deterministic 64-byte on-chain resultData pointer — a CID-style-// sha256 reference to the artifact. The on-chain slot is exactly [u8;64], so the-// pointer is packed into a fixed 64-byte buffer: `.copy` writes at most 64 bytes,-// so an over-long pointer is truncated to fit rather than overflowing the slot.-// resultData is a non-authoritative forensic locator — the 32-byte `proofHash` is-// the real binding — so truncating a locator never discards a completed-// deliverable. Producer pointers (`agora:<profession>:cid:sha256:<32hex>`) top out-// at 62 bytes, so truncation is a safety floor the real path never reaches.+// sha256 reference to the artifact. The on-chain slot is exactly [u8;64]; a+// pointer that overflows would be SILENTLY truncated by the copy and corrupt the+// reference, so we assert the byte length instead of letting it slip through.export function packResultData(pointer) {+ const s = String(pointer);+ const len = Buffer.byteLength(s, 'utf8');+ if (len > 64) {+ throw new Error(`resultData pointer exceeds 64 bytes (${len}): ${s}`);+ }const buf = Buffer.alloc(64);- Buffer.from(String(pointer), 'utf8').copy(buf, 0);+ Buffer.from(s, 'utf8').copy(buf, 0);return Uint8Array.from(buf);}