Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

docs(world): document world.three.ws deploy, admin gating, and build traps

fudjiac691d42b8aa6
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7d0a8aa46..f93a84fd7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Homepage: agent thumbnails load, and the marketplace strip is alive again** — The avatar picker on the homepage was asking our image server for five pictures that had never been made, so the browser refused them and those slots sat blank. It now asks only for pictures that actually exist, and it leads with the avatars that have one — where an avatar has no picture yet, it draws a clean initial instead of a broken tile. Underneath it, the live marketplace strip had been silently empty: it was reading the agent list in the wrong shape and quietly gave up every time, leaving just a lone "Browse marketplace" link. It now reads the list correctly and shows ten real agents you can click straight through to. The 3D models themselves were always loading fine and are untouched. (`/`) `[fix]`
- **IRL on phones: controls no longer cover each other** — The IRL screen was built up feature by feature until buttons buried the view on phones — the action pills stacked five rows deep over the walk joystick, the money-drops button floated on top of other controls, and small close buttons were easy to miss. The whole HUD is now built for thumbs: one swipeable action row hugs the bottom edge, the joystick zone floats above it so drags never hit a button, the drops button repositions itself and steps aside whenever a sheet is open, and every close button and tab meets the 44-pixel tap size. The avatar and camera view are finally unobstructed. (`/irl`) `[improvement, fix]`
- **Live SOL price restored on /three-live; Flappin UFO demo retired** — Two quiet breakages, fixed. The live trade feed on /three-live now prices SOL-only trades correctly again — it was reading a price API directly from your browser, which the provider silently blocks, so those trades showed no dollar value; it now reads the same cached, multi-provider SOL/USD price the rest of the platform uses. Separately, the Flappin UFO arcade demo ran on an external deployment that has gone offline, leaving a blank screen and a leaderboard that never loaded. Rather than leave a broken page up, /play/ufo is now an honest retired notice that points you to the live experiences — the coin world, Sniper Arena, and Coin Clash. (`/three-live`) `[fix]`
+- **The 3D world is locked down — visitors can no longer delete the ground** — Until today, every single person who opened world.three.ws arrived with full build rights. Anyone could move or delete any object in the world, replace the scene, or fill it with broken models — no account, no password, nothing. That is what emptied the world once before, when the ground itself was deleted and everyone who joined fell into a black void. The world now starts locked: visitors can walk around, chat, and explore, but only someone holding the admin code can change anything. Builders unlock their tools in-world by typing /admin followed by the code. The server refuses to start at all if the code is missing, so the world can never quietly come back up unprotected again. `[security, infra]`
- **Two broken pages fixed: vanity receipt verifier and Drive Your Avatar** — Both pages failed to load anything at all, and both are working again. The receipt verifier at /vanity/verify loads its cryptography straight into your browser so the audit runs on your machine and nothing is sent anywhere — but the browser had no way to locate those crypto libraries, so the page sat dead and no receipt could be checked. It now resolves them properly: paste a receipt and every check runs, right through to opening a sealed envelope. On /temporary, the payment widget behind the in-world "Feature your content" billboard was loaded the wrong way and crashed on arrival, taking the pay button with it. It now loads the same way it does on every other page that uses it. (`/vanity/verify`) `[fix]`
- **Your agents can now be placed privately, and nobody can browse /irl locations from afar** — Two changes to how /irl handles where you are. First, reading the agents near you now requires proving you have a recent location fix for that spot — until today anyone could ask our servers what agents sat at any coordinate on earth without ever going there. Second, a placed agent can now be private: you still see it in AR exactly where you left it, but it is withheld from everyone else's nearby feed, from shared rooms, and from the World Lines quest map. New placements are private by default while /irl is still in testing, and the privacy center's unpublish button now makes a pin private instead of hiding it from you too. You can make any pin public again whenever you want. (`/irl-privacy`) `[security, feature, improvement]`
diff --git a/STRUCTURE.md b/STRUCTURE.md
index 01e6fc866..966765754 100644
--- a/STRUCTURE.md
+++ b/STRUCTURE.md
@@ -54,6 +54,7 @@ bottom.
| Integration demos | [multiplayer/](multiplayer), [examples/coach-leo/](examples/coach-leo) | In-repo | Multiplayer and VR demos |
| Avatar service backend | [api/](api) + [workers/](workers) | In-repo | Serverless-style handlers + Cloudflare workers |
| Production server (Google Cloud Run) | [server/](server) + [Dockerfile](Dockerfile) | Live | Single Express container serving the static frontend, the vercel.json route table, and all `api/**` handlers with Vercel-parity routing; deploy via `npm run deploy:gcp` ([server/cloudbuild.yaml](server/cloudbuild.yaml)), crons via [scripts/create-gcp-scheduler.mjs](scripts/create-gcp-scheduler.mjs) · see [server/README.md](server/README.md) |
+| Multiplayer 3D world (world.three.ws) | [deploy/world/](deploy/world) — [Dockerfile](deploy/world/Dockerfile), [cloudrun.yaml](deploy/world/cloudrun.yaml), [apply-hardening.sh](deploy/world/apply-hardening.sh), patches in [deploy/world/patches/](deploy/world/patches); health monitor [api/cron/world-health.js](api/cron/world-health.js) | Live · `hyperfy-world` on Cloud Run | [Hyperfy](https://github.com/hyperfy-xyz/hyperfy) pinned to an exact upstream commit and rebuilt with three local patches (server-side upload cap, `/status` blueprint-asset enumeration, fail-closed-without-`ADMIN_CODE`). World state (SQLite + uploaded assets) lives in the GCS bucket `world-three-ws-data` mounted at `/app/world`, so the container is stateless. **The world is gated:** without `ADMIN_CODE` Hyperfy's `effectiveRank` falls back to `Ranks.ADMIN` and every anonymous visitor gets server-side build rights — the fail-open default that emptied the world on 2026-06-12. Deploy + verify with `bash deploy/world/apply-hardening.sh`; builders unlock in-world with `/admin <code>`. See [deploy/world/README.md](deploy/world/README.md) |
| On-chain identity | [contracts/](contracts) | In-repo | Foundry-based on-chain agent identity, ERC-8004 |
| 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) |
| Tokenized 3D (mint an avatar as an NFT) | [api/_lib/tokenize-3d.js](api/_lib/tokenize-3d.js) + [api/_lib/tokenize-3d-metadata.js](api/_lib/tokenize-3d-metadata.js), MCP tools [api/_mcp/tools/tokenize.js](api/_mcp/tools/tokenize.js) (`mint_3d_asset`, `get_3d_asset_onchain`), signed ledger provenance [api/_lib/asset-provenance.js](api/_lib/asset-provenance.js), launch directory [api/v1/tokenized/launches.js](api/v1/tokenized/launches.js) `→ GET /api/v1/tokenized/launches`, public gallery [pages/minted.html](pages/minted.html) + [src/minted.js](src/minted.js) `→ /minted` | In-repo | Mint a generated/owned GLB as a Metaplex Core NFT whose media is a live 3D viewer (GLB under `animation_url`), with baked provenance + enforced capped royalties (10%), idempotent, devnet-default. Every generated avatar AND every mint also appends an ERC-191-signed record to the `agent_actions` ledger (verifiable via `@three-ws/provenance-mcp`'s `query_action`). A mint naming `parent_mint` (a remix) routes the parent creator's royalty out of the mint fee as a real on-chain USDC transfer (mainnet, x402-collected calls only) — [api/_lib/remix-royalty.js](api/_lib/remix-royalty.js) split math, [api/_lib/remix-settlement.js](api/_lib/remix-settlement.js) payout wallet. Premium/token-gated generation: the Forge High tier (200k poly + PBR) is $THREE hold-or-pay gated — [api/forge.js](api/forge.js) `requireFeatureAccess('forge.high')` + [api/_lib/three-tier.js](api/_lib/three-tier.js) tier ladder, x402 pay-per-use or credits fallback; Draft/Standard stay free and ungated. Launch record: [tokenized_3d_assets](api/_lib/migrations/20260707120000_tokenized_3d_assets.sql) + [remix-royalty columns](api/_lib/migrations/20260708130000_tokenized_3d_remix_royalty.sql). Public gallery: `/minted` renders the launch directory live (model-viewer thumbnails, network toggle, royalty + remix badges) — the NFT counterpart of `/launches`. Docs: [docs/mcp.md](docs/mcp.md#mint_3d_asset). E2E: [scripts/tokenize-3d-devnet-e2e.mjs](scripts/tokenize-3d-devnet-e2e.mjs). Tests: [tests/tokenize-3d.test.js](tests/tokenize-3d.test.js), [tests/tokenize-3d-remix-royalty.test.js](tests/tokenize-3d-remix-royalty.test.js), [tests/asset-provenance.test.js](tests/asset-provenance.test.js) |
diff --git a/data/changelog.json b/data/changelog.json
index 1ef7f88be..dbaf2d4b9 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,15 @@
{
"$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-07-09",
+ "title": "The 3D world is locked down — visitors can no longer delete the ground",
+ "summary": "Until today, every single person who opened world.three.ws arrived with full build rights. Anyone could move or delete any object in the world, replace the scene, or fill it with broken models — no account, no password, nothing. That is what emptied the world once before, when the ground itself was deleted and everyone who joined fell into a black void. The world now starts locked: visitors can walk around, chat, and explore, but only someone holding the admin code can change anything. Builders unlock their tools in-world by typing /admin followed by the code. The server refuses to start at all if the code is missing, so the world can never quietly come back up unprotected again.",
+ "tags": [
+ "security",
+ "infra"
+ ]
+ },
{
"date": "2026-07-09",
"title": "Your agents can now be placed privately, and nobody can browse /irl locations from afar",
diff --git a/deploy/world/README.md b/deploy/world/README.md
new file mode 100644
index 000000000..004bd7926
--- /dev/null
+++ b/deploy/world/README.md
@@ -0,0 +1,123 @@
+# `deploy/world` — world.three.ws (Hyperfy on Cloud Run)
+
+Build and deploy config for the multiplayer 3D world at **https://world.three.ws**.
+
+The world is a [Hyperfy](https://github.com/hyperfy-xyz/hyperfy) server pinned to an exact
+upstream commit and rebuilt with three local patches. It runs as its own Cloud Run service
+(`hyperfy-world`, `us-central1`), separate from the main `three-ws-api` container. World state —
+the SQLite database and every uploaded asset — lives in the GCS bucket `world-three-ws-data`,
+mounted at `/app/world`, so the container itself is stateless and can be rebuilt without losing
+the world.
+
+## Why the admin code matters
+
+Hyperfy computes a player's effective rank as:
+
+```js
+get effectiveRank() {
+ return this.hasAdminCode ? this.rank : Ranks.ADMIN // src/core/systems/Settings.js
+}
+```
+
+With no `ADMIN_CODE` set, `hasAdminCode` is `false` and **every visitor is `Ranks.ADMIN`** — the
+server itself (`ServerNetwork.js`) then accepts entity add/modify/remove packets from anyone. That
+fail-open default is not a UI oversight; it is real, server-side build access for every anonymous
+visitor. It is how the world broke on 2026-06-12: the `$scene` script asset was deleted, the ground
+unloaded, and every player who joined fell into a black void.
+
+With `ADMIN_CODE` set, `effectiveRank` falls back to the world's own `settings.rank` (`0` =
+`VISITOR`), so visitors can walk, chat, and explore but cannot mutate the world. A builder claims
+rights in-world with the chat command:
+
+```
+/admin <code>
+```
+
+Running it again drops back to `VISITOR`.
+
+## Deploying
+
+From the repo root, with `gcloud` credentials that have Cloud Run, Secret Manager, and Cloud Build
+access on `aerial-vehicle-466722-p5`:
+
+```bash
+bash deploy/world/apply-hardening.sh
+```
+
+The script is idempotent and safe to re-run. It:
+
+1. Creates the Secret Manager secret `hyperfy-admin-code` **only if it does not already exist** —
+ an existing code is reused, never rotated, so previously issued codes keep working. A freshly
+ created code is printed exactly once.
+2. Grants `roles/secretmanager.secretAccessor` on that secret to the runtime service account
+ `hyperfy-world-sa@aerial-vehicle-466722-p5.iam.gserviceaccount.com`.
+3. Rebuilds and pushes the image via `cloudbuild.yaml`, as the `three-ws-build@` service account
+ (this project has no legacy default Cloud Build SA, so an unqualified submit fails).
+4. Applies `cloudrun.yaml`, wiring `ADMIN_CODE` from the secret and `PUBLIC_MAX_UPLOAD_SIZE=16`.
+5. Polls `https://world.three.ws/status` until it reports `"protected":true`, and exits non-zero if
+ it never does.
+
+Step 5 is the part that proves the deploy worked. Do not hand-edit the Cloud Run env var instead of
+running the script — without the verification loop you can "succeed" against a revision that never
+actually flipped `protected:true`.
+
+## Retrieving the admin code
+
+The code lives in Secret Manager and nowhere else. It is never committed, never printed to logs,
+and never stored in this repo:
+
+```bash
+gcloud secrets versions access latest \
+ --secret=hyperfy-admin-code \
+ --project=aerial-vehicle-466722-p5
+```
+
+To rotate it deliberately, add a new secret version and redeploy so the new revision picks it up:
+
+```bash
+printf '%s' "$(openssl rand -base64 24 | tr -dc 'a-zA-Z0-9' | head -c 24)" \
+ | gcloud secrets versions add hyperfy-admin-code --data-file=- --project=aerial-vehicle-466722-p5
+gcloud run services replace deploy/world/cloudrun.yaml --region=us-central1
+```
+
+Rotation invalidates every previously issued code.
+
+## Patches
+
+Applied in order to the pinned upstream ref by the `Dockerfile`. Re-verify them whenever you bump
+`HYPERFY_REF`; `git apply` fails the build loudly if a hunk no longer lands.
+
+| Patch | What it does |
+| --- | --- |
+| `0001-upload-limit-from-env.patch` | Enforces `PUBLIC_MAX_UPLOAD_SIZE` on `/api/upload` server-side. Upstream hard-codes a 200 MB multipart cap on an unauthenticated route. |
+| `0002-status-blueprint-assets.patch` | Makes `/status` enumerate every content-hashed asset each blueprint references, with absolute URLs, so `api/cron/world-health.js` can `HEAD` them and catch a missing asset before it crashes the scene for every joiner. |
+| `0003-fail-closed-without-admin-code.patch` | In production, refuse to boot without `ADMIN_CODE` (exit 1) instead of warning and serving an unprotected world. A secret-less revision then fails its Cloud Run startup probe, and traffic stays on the last protected revision. |
+
+Patch `0003` exits explicitly rather than throwing: `import 'ses'` installs an uncaught-exception
+handler that reports a top-level throw but still lets the process exit `0`, which reads as a clean
+shutdown in Cloud Run logs.
+
+## Build gotchas
+
+- Hyperfy's `npm run build` emits everything to **`build/`** — the server bundle (`build/index.js`,
+ per `package.json` `"start"`), the client bundle and its assets (`build/public/`), and the PhysX
+ wasm. There is no `dist/` and no top-level `public/`. Naming them is what silently broke every
+ build of this image before 2026-07-09.
+- Do not wrap the build in `|| true`. A swallowed failure resurfaces much later as a confusing
+ `COPY failed: stat app/dist: file does not exist`.
+- The container runs as **root**, deliberately. Cloud Run mounts the gcsfuse volume at `/app/world`
+ root-owned, and the server writes SQLite plus uploaded assets there every `SAVE_INTERVAL`. A
+ non-root `USER` boots cleanly but silently loses every world save — a quieter version of the data
+ loss this hardening exists to prevent. Dropping privileges needs gcsfuse uid/gid mount options,
+ not just a `USER` line.
+
+## Monitoring
+
+`api/cron/world-health.js` probes `/status` every 15 minutes and alerts on two conditions:
+
+- **UNPROTECTED** — `protected` is not `true`; every visitor has build rights.
+- **MISSING ASSET** — a blueprint references an asset URL that `404`s, the failure that unloaded
+ the ground on 2026-06-12.
+
+It parks its verdict in the cache for `/api/healthz` to read (`subsystems` → `world`). Run it by
+hand with `curl -H "X-Cron-Secret: $CRON_SECRET" https://three.ws/api/cron/world-health`.
diff --git a/public/changelog.json b/public/changelog.json
index 050310215..6d6b78257 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-09T21:44:29.532Z",
+ "generated_at": "2026-07-09T21:46:44.895Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -68,6 +68,17 @@
"fix"
]
},
+ {
+ "date": "2026-07-09",
+ "type": "update",
+ "title": "The 3D world is locked down — visitors can no longer delete the ground",
+ "summary": "Until today, every single person who opened world.three.ws arrived with full build rights. Anyone could move or delete any object in the world, replace the scene, or fill it with broken models — no account, no password, nothing. That is what emptied the world once before, when the ground itself was deleted and everyone who joined fell into a black void. The world now starts locked: visitors can walk around, chat, and explore, but only someone holding the admin code can change anything. Builders unlock their tools in-world by typing /admin followed by the code. The server refuses to start at all if the code is missing, so the world can never quietly come back up unprotected again.",
+ "link": null,
+ "tags": [
+ "security",
+ "infra"
+ ]
+ },
{
"date": "2026-07-09",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index d7a7ea806..3f9a0e6b0 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -54,6 +54,14 @@
<category>fix</category>
<description>Two quiet breakages, fixed. The live trade feed on /three-live now prices SOL-only trades correctly again — it was reading a price API directly from your browser, which the provider silently blocks, so those trades showed no dollar value; it now reads the same cached, multi-provider SOL/USD price the rest of the platform uses. Separately, the Flappin UFO arcade demo ran on an external deployment that has gone offline, leaving a blank screen and a leaderboard that never loaded. Rather than leave a broken page up, /play/ufo is now an honest retired notice that points you to the live experiences — the coin world, Sniper Arena, and Coin Clash.</description>
</item>
+ <item>
+ <title>The 3D world is locked down — visitors can no longer delete the ground</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-07-09:The 3D world is locked down — visitors can no longer delete the ground</guid>
+ <pubDate>Thu, 09 Jul 2026 12:00:00 GMT</pubDate>
+ <category>security</category>
+ <description>Until today, every single person who opened world.three.ws arrived with full build rights. Anyone could move or delete any object in the world, replace the scene, or fill it with broken models — no account, no password, nothing. That is what emptied the world once before, when the ground itself was deleted and everyone who joined fell into a black void. The world now starts locked: visitors can walk around, chat, and explore, but only someone holding the admin code can change anything. Builders unlock their tools in-world by typing /admin followed by the code. The server refuses to start at all if the code is missing, so the world can never quietly come back up unprotected again.</description>
+ </item>
<item>
<title>Two broken pages fixed: vanity receipt verifier and Drive Your Avatar</title>
<link>https://three.ws/vanity/verify</link>
diff --git a/public/features.json b/public/features.json
index 48160ebd2..0beda46c6 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-09T21:44:29.508Z",
+ "generated_at": "2026-07-09T21:46:44.872Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",