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
fix(ar): give iPhone real Quick Look AR instead of a camera overlay
nirholasfbfd81e48725
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 7b21abae3..42c2a2d24 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,9 +4,14 @@Public history for [three.ws](https://three.ws), newest first. New pages come from `added` dates in data/pages.json; everything else is curated in data/changelog.json. Also available as [JSON](https://three.ws/changelog.json) and [RSS](https://three.ws/changelog.xml), live at [three.ws/changelog](https://three.ws/changelog).+## 2026-08-20++- **AR now actually opens AR on iPhone: AR Forge and AR Studio, not just avatars**: Placing a model from AR Forge or the multi-model AR Studio in your real room worked correctly on Android, but iPhone quietly got a downgrade: AR Forge fell back to the plain 3D viewer, and AR Studio faked it with a camera overlay that had no real-world plane detection, no correct scale, and nothing to rest the model on the floor. Only the avatar AR page did this right. Both surfaces now use the same real pipeline: a genuine USDZ is generated on your device (the same three.js conversion the avatar page always used) and handed to Apple Quick Look, so the model is actually tracked to your room, sized correctly, and sits on your real floor. AR Studio's AR button now also offers Google Scene Viewer directly instead of only the raw WebXR session. Shared AR links still unfurl with a real render of the model when pasted into X, Discord, or iMessage. (`/ar`) `[fix, improvement]`+## 2026-08-19- **Deploy On-chain** (`/deploy-onchain`): Mint your agent into the Metaplex Agent Registry on Solana, in the exact shape the Genesis 333 shipped: a Metaplex Core asset with its own wallet, EIP-8004 identity, verified creator, royalties, and immutable metadata. Phantom, Solflare, or any Solana wallet signs; keys never leave the browser, and devnet rehearsal is free.+- **View in AR** (`/ar/view`): Place any three.ws GLB in your real space from a plain link: real ARKit Quick Look on iPhone (a genuine on-device USDZ conversion, not a camera overlay), Scene Viewer or WebXR on Android. The shared landing page behind /api/ar and every AR hand-off across the site.- **A page that fails to load now tells you which thing went wrong**: When an avatar or agent page could not load, it always said the same thing: not found, followed by whatever internal message the browser happened to throw. A stale link and a temporary server hiccup looked identical, and the explanation was often developer jargon rather than English. The two cases are now told apart. A link to something that no longer exists says exactly that and points you at the marketplace or the agent directory. A genuine failure on our side says so, offers a Try again button, and keeps the technical detail as a small footnote instead of presenting it as the reason. `[improvement, fix]`- **Agent pages show what an agent can actually do, and what it charges**: The studio page every agent link opens now carries the agent's real substance. Its Capabilities tab lists the skills it genuinely exposes with the real per-call price of each, and a summary line telling you the cheapest paid call up front (or that everything is free). Skill names read as words instead of raw slugs, with the exact slug shown underneath for anyone wiring an integration. Under the title there is now a row of real counters: skills, conversations, wallet, whether the identity is on-chain, and how long the agent has been around. Below the fold, an agent recommends similar agents rather than unrelated avatars, each rendered as a live 3D card. The page also loads better: a skeleton in the real layout instead of a line of text, cards that show a picture while their 3D model downloads, and full keyboard support on the section tabs with a shareable link per tab. (`/agents`) `[improvement, feature]`- **Agents can now hold a spending allowance instead of your private key**: Handing an AI agent a wallet has always meant handing it a private key, which means handing it everything in that wallet. The new onchain-agent-wallets MCP server replaces that with an allowance. Your money stays in an account you own, and the agent gets permission to spend a slice of it that the Solana token program enforces on-chain: it cannot spend past the ceiling however it is prompted, every spend decrements what is left, and you can cancel the whole thing in one instruction or take the balance back without the agent's cooperation. On top of that you set the rules it runs under: a maximum per transaction, a maximum per day, which addresses it may pay, which APIs it may buy from, an expiry, and a pause switch that stops it instantly for free. It can pay x402 APIs out of the allowance, and the price is always read before any money moves. Every decision, including every refusal and the reason for it, is written to an audit log you can read. You never have to put a secret key on the machine: owner actions come back as an unsigned transaction for Phantom, Solflare, or a Ledger to sign. `[feature, sdk, security]`diff --git a/STRUCTURE.md b/STRUCTURE.mdindex 4d301990a..77ef6a94f 100644--- a/STRUCTURE.md+++ b/STRUCTURE.md@@ -72,10 +72,10 @@ bottom.| Claude.ai artifact embed + builder | Endpoint [api/artifact.js](api/artifact.js) `→ /api/artifact`, prebuilt viewer [public/artifact-viewer.bundle.js](public/artifact-viewer.bundle.js) (source [scripts/artifact-viewer/src.js](scripts/artifact-viewer/src.js), `npm run build:artifact-viewer`), builder page [public/artifact/index.html](public/artifact/index.html) `→ /artifact` + [README](public/artifact/README.md), contract [specs/CLAUDE_ARTIFACT.md](specs/CLAUDE_ARTIFACT.md), vendored sandbox CSP [public/claude-artifact-csp.txt](public/claude-artifact-csp.txt) (refresh: [scripts/refresh-claude-csp.mjs](scripts/refresh-claude-csp.mjs)). | Live | `GET /api/artifact?agent=<uuid>` returns ONE self-contained HTML document with three.js, GLTFLoader, the viewer and the agent GLB all inlined, because Claude's artifact sandbox CSP blocks every external script and fetch. Paste the URL into a Claude conversation and the agent renders inline. The builder page is the pre-flight: it lists real public agents that carry an embeddable avatar (`/api/agents/public?avatar=1`), renders the response in a sandboxed iframe under the same CSP Claude applies, and reports payload size, fetch time, frame render time and sandbox compliance before you paste. Size is graded against the ceiling the endpoint can actually emit (a 6 MB model base64-inlines to 8 MB, plus the 565 KB viewer), not against the raw model cap, so a large-but-accepted artifact is not flagged as over budget. `?model=<glb url>` is the viewer-only lane (allowlisted https origins, SSRF-guarded, 6 MB cap). Tests: [tests/api/artifact.test.js](tests/api/artifact.test.js) pins the generated HTML against the vendored Claude CSP. || Avatar Artifact: the standalone shareable viewer | Page [pages/avatar-artifact.html](pages/avatar-artifact.html) `→ /avatar-artifact`, scene + artifact loader [src/avatar-artifact.js](src/avatar-artifact.js), docs [docs/avatar-artifact.md](docs/avatar-artifact.md). | Live | One page, one avatar, no wrapper: the URL you paste into an `<iframe>` on someone else's site or send to a person who has never heard of three.ws. `?agent=<uuid>` renders that agent's avatar from the live public record (the name becomes the heading and the document title, an Open profile link appears), `?model=<glb url>` renders any GLB from the same allowlisted hosts `/api/artifact` enforces, and a bare link renders the house portrait: a procedural figure that tracks cursor, touch and arrow keys. Ships no third-party CDN (three.js is bundled, because an embed host never agreed to a cross-origin script) and suspends its render loop on a hidden tab. An avatar with no baked clips is driven by the shared retargeted `idle` from the universal clip library rather than left in a bind-pose T-pose. Every failure lane (no such agent, private avatar, no avatar yet, blocked host, dead model, no WebGL) has its own sentence and its own next move; the Copy embed snippet carries the artifact parameters so the iframe shows what you were looking at. || Spatial MCP (3D as a native response type) | Spec [specs/SPATIAL_MCP.md](specs/SPATIAL_MCP.md), pure validator/builder/lint [public/spatial-mcp/spatial-validator.js](public/spatial-mcp/spatial-validator.js) (published at `https://three.ws/spatial-mcp/spatial-validator.js`; server-side re-export [api/_lib/spatial-mcp.js](api/_lib/spatial-mcp.js)), npm package + conformance fixture corpus [packages/spatial-mcp/](packages/spatial-mcp) (`@three-ws/spatial-mcp`, CC0, drift-guarded byte-identical to the published module), validator tool [api/_mcp3d/tools/spatial.js](api/_mcp3d/tools/spatial.js) (`validate_spatial_response`, free), reference renderer [public/spatial-mcp/spatial-renderer.js](public/spatial-mcp/spatial-renderer.js) + demo/checker [public/spatial-mcp/index.html](public/spatial-mcp/index.html) + [public/spatial-mcp/demo.js](public/spatial-mcp/demo.js) `→ /spatial-mcp`, docs [docs/spatial-mcp.md](docs/spatial-mcp.md). | Live · both stores | Open (CC0) shape for returning a live, interactive 3D scene as a first-class MCP tool result (scene GLB, camera, environment, animation, AR handoff, affordances) instead of a URL. Every three.ws 3D generator emits a conformant artifact under `structuredContent.spatial`; the validator returns actionable errors, not a boolean; the framework-free reference renderer displays any conformant payload — including one transformed from a foreign tool result (portability proof at `/spatial-mcp`). The page runs the real validator in the browser: every rendered payload shows its verdict, and a paste-in checker validates arbitrary payloads as you type (with a deliberately broken example) so an implementer debugs an adapter without leaving the page. Zero coin surface — reusable in the OpenAI free app. Tests: [tests/spatial-mcp.test.js](tests/spatial-mcp.test.js), render smoke [tests/e2e/spatial-mcp-render.spec.js](tests/e2e/spatial-mcp-render.spec.js). Evidence: [prompts/store-submissions/_generated/spatial-mcp/](prompts/store-submissions/_generated/spatial-mcp/). Store-submission prompt 20. |-| AR-ready exports ("View in your space") | Device-routing core [api/_lib/ar-launch.js](api/_lib/ar-launch.js), UA-branched launch endpoint [api/ar.js](api/ar.js) `→ /api/ar`, MCP tool [api/_mcp3d/tools/ar.js](api/_mcp3d/tools/ar.js) (`export_ar`, free), in-viewer AR button [public/viewer.html](public/viewer.html), docs [docs/ar.md](docs/ar.md). | Live · both stores | `GET /api/ar?src=<glb>` branches on the request User-Agent server-side: iOS → Apple Quick Look (USDZ generated from the GLB on the fly by model-viewer's three.js USDZExporter — real conversion, no server USD tooling), Android → 302 Google Scene Viewer ARCore intent with browser fallback, desktop → WebGL viewer. Bad input rejected at the boundary with a designed error page. `export_ar` returns the AR launch link + a conformant Spatial-MCP artifact; response is OpenAI-clean (no ids/coin surface). `kind=avatar` is the living-agent lane: the launch page leads with a "Bring it to life" handoff into `/irl?avatar=<glb>` (avatar-producing tools return `irlUrl` automatically), and Android serves the launch page instead of the blind Scene Viewer redirect so the living path stays visible. Shared links unfurl: the launch page's `og:image` points at `GET /api/render/glb?glbUrl=` ([api/render/glb.js](api/render/glb.js), server-side PNG of the actual model, CDN-cached a day) and the page carries "Create your own" → `/ar` conversion CTAs. Tests: [tests/ar-export.test.js](tests/ar-export.test.js). Evidence: [prompts/store-submissions/_generated/ar/](prompts/store-submissions/_generated/ar/). Store-submission prompt 21. |+| AR-ready exports ("View in your space") | Device-routing core [api/_lib/ar-launch.js](api/_lib/ar-launch.js), UA-branched launch endpoint [api/ar.js](api/ar.js) `→ /api/ar`, the actual AR page it hands off to [pages/ar-view.html](pages/ar-view.html) + [src/ar-view.js](src/ar-view.js) `→ /ar/view`, MCP tool [api/_mcp3d/tools/ar.js](api/_mcp3d/tools/ar.js) (`export_ar`, free), in-viewer AR button [public/viewer.html](public/viewer.html), docs [docs/ar.md](docs/ar.md). | Live · both stores | `GET /api/ar?src=<glb>` branches on the request User-Agent server-side: Android gets a clean 302 into the Google Scene Viewer ARCore intent (browser fallback to the WebGL viewer); iOS, desktop, and any live avatar get a 200 interstitial carrying this model's real `og:image`/title (so a pasted link still unfurls, which a bare 302 cannot do) that immediately hands off to `/ar/view`. `/ar/view` is a real Vite-bundled page, not HTML this endpoint writes inline, because Quick Look needs a genuine USDZ and `<model-viewer>` does not generate one on its own: the page fetches the GLB and runs it through the same client-side `usdz-pipeline.js` (three.js `USDZExporter`) that `/avatars/:id/ar` ([src/ar-page.js](src/ar-page.js)) already used correctly, sets the result as `ios-src`, then offers Quick Look. An earlier version of this endpoint inlined a `<model-viewer>` with no `ios-src` and a comment claiming model-viewer converted GLB to USDZ on its own; it does not, so iOS visitors silently fell back to the plain 3D viewer for months. Bad input rejected at the boundary with a designed error page. `export_ar` returns the AR launch link + a conformant Spatial-MCP artifact; response is OpenAI-clean (no ids/coin surface). `kind=avatar` is the living-agent lane: the interstitial's redirect target leads with a "Bring it to life" handoff into `/irl?avatar=<glb>` (avatar-producing tools return `irlUrl` automatically), and Android goes to `/ar/view` too instead of the blind Scene Viewer redirect so the living path stays visible. Tests: [tests/ar-export.test.js](tests/ar-export.test.js), [tests/api/ar-endpoint.test.js](tests/api/ar-endpoint.test.js). Evidence: [prompts/store-submissions/_generated/ar/](prompts/store-submissions/_generated/ar/). Store-submission prompt 21. || AR Forge (prompt → model → your room) | [public/ar-forge.html](public/ar-forge.html) `→ /ar` (self-contained page, CDN model-viewer + local meshopt decoder, no Vite registration needed; vercel route sets `xr-spatial-tracking` permissions-policy) | Live | Mobile-first app: one prompt hits the free NVIDIA lane (`POST /api/forge {backend:"nvidia"}`, poll `?job=`), the result renders in an AR-capable `<model-viewer>` with "View in your space" (WebXR / Scene Viewer / Quick Look). Non-AR devices get a QR handoff to `GET /api/ar?src=` (server-side UA routing) plus a copyable `/viewer?src=` share link. Deep link `/ar?src=<glb>&title=` reopens any shared model; recent forges persist in localStorage. Designed idle/working/failed/result states; https-only GLB guard. || Daily Forge (daily challenge + creator streak) | [pages/daily.html](pages/daily.html) `→ /daily` + [src/daily.js](src/daily.js), deterministic theme rotation [src/daily/daily-theme.js](src/daily/daily-theme.js), streak state machine [src/daily/creator-streak.js](src/daily/creator-streak.js) | Live | The **anonymous-first retention loop** the platform lacked: the logged-in streak system ([api/_lib/streaks.js](api/_lib/streaks.js)) needs an account, so the no-sign-up forge majority had no reason to return. Every UTC day resolves to one curated creative theme (the same for everyone, hashed from the date — no backend, no randomness) with a running "Day N" counter; forging today's theme on the free lane lights a localStorage streak (consecutive-day state machine: extend / reset-on-gap / never-double-count, `best` preserved, at-risk vs lapsed display), and milestones (3/7/14/30/50/100/365) fire a celebration. The generation lands in the shared recents so it's one tap from `/ar` and `/ar/studio`; a "Fresh from the community" strip reads `/api/forge-gallery?scope=community`. `changefreq: daily` in the sitemap. Tests: [tests/daily-theme.test.js](tests/daily-theme.test.js), [tests/creator-streak.test.js](tests/creator-streak.test.js). |-| AR Studio (multi-model live camera scene) | [pages/ar-studio.html](pages/ar-studio.html) `→ /ar/studio` + [src/ar-studio.js](src/ar-studio.js), multi-anchor WebXR session [src/ar/multi-place.js](src/ar/multi-place.js), pure scene math [src/ar/studio-scene.js](src/ar/studio-scene.js) | Live | The standalone multi-model AR surface: place ANY number of models/avatars into one live camera view (every earlier AR lane was single-model). Model sources: in-view forge (`POST /api/forge {backend:"nvidia"}` runs behind the live camera, result drops into the room), the forge gallery (`/api/forge-gallery`, yours + community tabs), recent forges (localStorage, shared with `/ar`), the CC0 Object Library (`/api/objects/library`, an Objects tray tab with client-side name/category search), a pasted GLB link, or repeatable `?src=` deep links (https/relative only). Rendering ladder: WebXR immersive-ar with one XRAnchor per placed model + always-armed reticle (Android), getUserMedia passthrough + gyro world-lock (iOS/everywhere), grid preview + drag-look + QR handoff (desktop). Gestures: tap select, drag move, pinch resize, two-finger twist rotate; per-model duplicate/rotate/remove, clear-with-undo. Humanoids with no baked clips idle via the universal retarget ([src/irl/pin-idle.js](src/irl/pin-idle.js)); scene persists in localStorage and the whole ARRANGEMENT (models + transforms) round-trips through a base64url `#s=` hash on the share/QR URL, so a composed scene reopens exactly on any device. **Presence realism:** WebXR placements are lit by the real room via lighting-estimation ([src/ar/estimated-lighting.js](src/ar/estimated-lighting.js), three's `XREstimatedLight`, real primary-light direction/colour + a live environment cube map so metal/glass reflect the actual room, reverting to baked lights when the device isn't estimating) and occluded by real geometry via depth-sensing ([src/ar/depth-occlusion.js](src/ar/depth-occlusion.js)); the passthrough path matches room brightness AND colour by sampling the camera feed. Desktop keyboard controls (arrows nudge / R rotate / D duplicate / Delete). Photo capture composites camera + WebGL ([src/irl/share-frame.js](src/irl/share-frame.js)). Reachable from `/ar`, the forge AR panel, and the `/viewer` action sheet. **Shared rooms (build together, live):** "Share live" opens a room with a 6-char code; anyone who opens `/ar/studio?room=CODE` joins the same scene and every add / move / scale / rotate / remove delta-syncs in real time, with a live "N here" presence pill. New Colyseus room [multiplayer/src/rooms/StudioRoom.js](multiplayer/src/rooms/StudioRoom.js) + schema [multiplayer/src/studio-schemas.js](multiplayer/src/studio-schemas.js) (owner-gated edits, per-room/per-owner caps, per-client rate limit, https-only src validation, the same discipline as WalkRoom's object channel), client wrapper [src/ar/studio-net.js](src/ar/studio-net.js), and a shared logical coordinate frame [src/ar/studio-coords.js](src/ar/studio-coords.js) (relEast/relNorth/yawDeg) so every device agrees on placement; QR-marker colocalization ([src/irl/marker-anchor.js](src/irl/marker-anchor.js)) is the co-located "same physical table" upgrade. Runs on the same Colyseus host as /walk and /irl (a new room, not a new process). Tests: [tests/ar-studio-scene.test.js](tests/ar-studio-scene.test.js), [tests/ar-studio-coords.test.js](tests/ar-studio-coords.test.js), [tests/ar-estimated-lighting.test.js](tests/ar-estimated-lighting.test.js), [tests/studio-room.test.js](tests/studio-room.test.js). **Shipped as open source:** the same surface is extracted, generalized and published as [3d-ar-studio](https://www.npmjs.com/package/3d-ar-studio) (repo [nirholas/3D-AR-Studio](https://github.com/nirholas/3D-AR-Studio), demo https://nirholas.github.io/3D-AR-Studio/, MCP server `io.github.nirholas/3d-ar-studio`), so any site can embed a multi-model AR studio with one script tag. It defaults to OUR catalogue and generation lane (`/cdn/objects/library/manifest.json`, `/api/mcp-studio`, `/animations/manifest.json`, `/hdri/*`, `/api/ar`), which is why those surfaces answer open CORS. |+| AR Studio (multi-model live camera scene) | [pages/ar-studio.html](pages/ar-studio.html) `→ /ar/studio` + [src/ar-studio.js](src/ar-studio.js), multi-anchor WebXR session [src/ar/multi-place.js](src/ar/multi-place.js), pure scene math [src/ar/studio-scene.js](src/ar/studio-scene.js) | Live | The standalone multi-model AR surface: place ANY number of models/avatars into one live camera view (every earlier AR lane was single-model). Model sources: in-view forge (`POST /api/forge {backend:"nvidia"}` runs behind the live camera, result drops into the room), the forge gallery (`/api/forge-gallery`, yours + community tabs), recent forges (localStorage, shared with `/ar`), the CC0 Object Library (`/api/objects/library`, an Objects tray tab with client-side name/category search), a pasted GLB link, or repeatable `?src=` deep links (https/relative only). Rendering ladder: WebXR immersive-ar with one XRAnchor per placed model + always-armed reticle (Android), getUserMedia passthrough + gyro world-lock (iOS/everywhere), grid preview + drag-look + QR handoff (desktop). Gestures: tap select, drag move, pinch resize, two-finger twist rotate; per-model duplicate/rotate/remove, clear-with-undo. **Real device AR, not just the camera composite:** the AR control resolves what the device can actually do and routes there rather than defaulting every non-WebXR device to the composite: the immersive WebXR session where it exists, Apple Quick Look on iOS and Google Scene Viewer on Android otherwise (both selectable per-model from the selection bar too), and an honest "open this on a phone" QR prompt everywhere else. The button relabels itself to match ("Immersive" only where an immersive session is real). Quick Look reads USDZ, so the selected model's GLB is converted on the device through the same `usdz-pipeline.js` bake `/avatars/:id/ar` uses, not the camera-passthrough composite, which has no real-world plane detection or scale and previously shipped as the only iOS experience. Humanoids with no baked clips idle via the universal retarget ([src/irl/pin-idle.js](src/irl/pin-idle.js)); scene persists in localStorage and the whole ARRANGEMENT (models + transforms) round-trips through a base64url `#s=` hash on the share/QR URL, so a composed scene reopens exactly on any device. **Presence realism:** WebXR placements are lit by the real room via lighting-estimation ([src/ar/estimated-lighting.js](src/ar/estimated-lighting.js), three's `XREstimatedLight`, real primary-light direction/colour + a live environment cube map so metal/glass reflect the actual room, reverting to baked lights when the device isn't estimating) and occluded by real geometry via depth-sensing ([src/ar/depth-occlusion.js](src/ar/depth-occlusion.js)); the passthrough path matches room brightness AND colour by sampling the camera feed. Desktop keyboard controls (arrows nudge / R rotate / D duplicate / Delete). Photo capture composites camera + WebGL ([src/irl/share-frame.js](src/irl/share-frame.js)). Reachable from `/ar`, the forge AR panel, and the `/viewer` action sheet. **Shared rooms (build together, live):** "Share live" opens a room with a 6-char code; anyone who opens `/ar/studio?room=CODE` joins the same scene and every add / move / scale / rotate / remove delta-syncs in real time, with a live "N here" presence pill. New Colyseus room [multiplayer/src/rooms/StudioRoom.js](multiplayer/src/rooms/StudioRoom.js) + schema [multiplayer/src/studio-schemas.js](multiplayer/src/studio-schemas.js) (owner-gated edits, per-room/per-owner caps, per-client rate limit, https-only src validation, the same discipline as WalkRoom's object channel), client wrapper [src/ar/studio-net.js](src/ar/studio-net.js), and a shared logical coordinate frame [src/ar/studio-coords.js](src/ar/studio-coords.js) (relEast/relNorth/yawDeg) so every device agrees on placement; QR-marker colocalization ([src/irl/marker-anchor.js](src/irl/marker-anchor.js)) is the co-located "same physical table" upgrade. Runs on the same Colyseus host as /walk and /irl (a new room, not a new process). Tests: [tests/ar-studio-scene.test.js](tests/ar-studio-scene.test.js), [tests/ar-studio-coords.test.js](tests/ar-studio-coords.test.js), [tests/ar-estimated-lighting.test.js](tests/ar-estimated-lighting.test.js), [tests/studio-room.test.js](tests/studio-room.test.js). **Shipped as open source:** the same surface is extracted, generalized and published as [3d-ar-studio](https://www.npmjs.com/package/3d-ar-studio) (repo [nirholas/3D-AR-Studio](https://github.com/nirholas/3D-AR-Studio), demo https://nirholas.github.io/3D-AR-Studio/, MCP server `io.github.nirholas/3d-ar-studio`), so any site can embed a multi-model AR studio with one script tag. It defaults to OUR catalogue and generation lane (`/cdn/objects/library/manifest.json`, `/api/mcp-studio`, `/animations/manifest.json`, `/hdri/*`, `/api/ar`), which is why those surfaces answer open CORS. || IRL (agents in the real world) | [pages/irl.html](pages/irl.html) `→ /irl` + [src/irl.js](src/irl.js), WebXR placement [src/ar/webxr.js](src/ar/webxr.js) + pinch [src/ar/pinch-scale.js](src/ar/pinch-scale.js), animated Quick Look bake [src/usdz-animated.js](src/usdz-animated.js) (static fallback [src/usdz-pipeline.js](src/usdz-pipeline.js)), backend [api/irl/](api/irl) | Live | Pin an agent at a real GPS spot; discovery is presence-proof-gated ([docs/irl/THREAT-MODEL.md](docs/irl/THREAT-MODEL.md)). **Place in AR** leads the dock on AR-capable devices: WebXR hit-test anchoring on Android with two-finger pinch resize (25%..400%) persisted to the pin (`anchor_scale`; the pinch lands as a follow-up `PATCH /api/irl/pins {id, scale}` after the placement tap), and ARKit Quick Look on iOS with the idle clip baked into the USDZ so the agent moves instead of standing in a T-pose. Discovered pins are equally alive in the in-page camera view: every mounted humanoid GLB plays the retargeted idle clip via a per-pin mixer ([src/irl/pin-idle.js](src/irl/pin-idle.js), phase-randomized, LOD-bounded), camera-aware gaze composes on top of the running animation, and the scene renders with ACES tone mapping + IBL + soft shadows (e2e: [tests/e2e/irl-pin-idle.spec.js](tests/e2e/irl-pin-idle.spec.js)). Inbound `/irl?avatar=<glb>` is the living-agent handoff from `GET /api/ar?…&kind=avatar` (explicit `?avatar=` wins over a saved session). Money Drops and World Lines: [docs/irl.md](docs/irl.md). SDK: [packages/irl/](packages/irl). **Share** ([src/irl/share-frame.js](src/irl/share-frame.js), [api/irl/share.js](api/irl/share.js), [api/irl/share/[token].js](api/irl/share/%5Btoken%5D.js)) mints a permanent, unfurlable `/irl/s/:token` link from the captured AR photo for the pin you just placed - never a coordinate, owner-gated, falls back to the plain native share sheet with no active pin. **Analytics** ([api/_lib/irl-analytics.js](api/_lib/irl-analytics.js), [api/irl/analytics.js](api/irl/analytics.js)) is the first site-wide usage rollup for the feature - pins placed, nearby reads, placement method, shares, drop claims - aged out by the existing hourly reaper. || Verifiable 3D provenance (content credentials) | Spec [specs/PROVENANCE_3D.md](specs/PROVENANCE_3D.md), pure core [api/_lib/provenance-3d.js](api/_lib/provenance-3d.js), Solana anchor [api/_lib/provenance-anchor.js](api/_lib/provenance-anchor.js), MCP tools [api/_mcp3d/tools/provenance.js](api/_mcp3d/tools/provenance.js) (`verify_provenance` free, `anchor_provenance` paid $0.05), free REST verify [api/provenance.js](api/provenance.js) `→ /api/provenance`, viewer badge [public/viewer.html](public/viewer.html), docs [docs/provenance.md](docs/provenance.md). | Live (verify) · anchor gated on issuer key + devnet funds | C2PA-style signed content credentials for AI 3D: creator, prompt, model/provider, lineage, timestamp, and the GLB's sha256, ed25519-signed by the three.ws issuer with the credential hash anchored on Solana. Free public `verify_provenance` / `GET /api/provenance?src=…` recompute the hash and return `verified | tampered | unknown` (a single changed byte → tampered); the verify path and response are coin-clean (both stores). `anchor_provenance` signs + writes the SPL Memo anchor + stores the credential in R2. Tests: [tests/provenance-3d.test.js](tests/provenance-3d.test.js). Evidence: [prompts/store-submissions/_generated/provenance/](prompts/store-submissions/_generated/provenance/). Store-submission prompt 19. || OpenAI Select Partner (partner surface + announcement pack) | [pages/openai/index.html](pages/openai/index.html) `→ /openai`, badge assets [public/partners/openai/](public/partners/openai), announcement [blog/three-ws-openai-select-partner.html](blog/three-ws-openai-select-partner.html) `→ /blog/three-ws-openai-select-partner`, directory card in [pages/partners.html](pages/partners.html) `→ /partners`, press/social pack [marketing/openai-select-partner/](marketing/openai-select-partner/README.md), original OpenAI-supplied badge files + press-release template [OAI Select Tier Assets/](OAI%20Select%20Tier%20Assets/README.md) | Live | three.ws's OpenAI Partner Network Select-tier surface. `/openai` is the partner landing: the supplied badge (used unmodified, on a white plate), the four live OpenAI surfaces (the free keyless [3D Studio MCP connector](docs/mcp-studio.md) `→ /api/mcp-studio`, the custom-GPT Actions twin `→ /api/3d/studio`, [Spatial MCP](specs/SPATIAL_MCP.md), and [AR in ChatGPT](docs/chatgpt-ar.md)), the connect table, and the nine-tool list. The marketing pack holds badge-usage rules and the press-release draft, which is gated on OpenAI's written approval before publishing (see its README). |diff --git a/api/_lib/ar-launch.js b/api/_lib/ar-launch.jsindex c9222a723..e838225c5 100644--- a/api/_lib/ar-launch.js+++ b/api/_lib/ar-launch.js@@ -1,26 +1,33 @@-// AR launch — device-aware "View in your space" routing for a generated GLB.+// AR launch: device-aware "View in your space" routing for a generated GLB.//// The pure core behind GET /api/ar (api/ar.js) and the export_ar MCP tool. Given// a GLB URL and a User-Agent, it decides how to place the model in AR://-// • iOS → Apple Quick Look. model-viewer generates a USDZ from the GLB on-// the fly (a real conversion via three.js USDZExporter, in-page),-// so the launch page hands iOS a Quick Look experience with no-// server-side USD tooling required.// • Android → Google Scene Viewer via an ARCore intent:// URL (the GLB is the// Scene Viewer source), with a browser fallback to the WebGL viewer.-// • desktop → the interactive WebGL viewer (no AR hardware).+// • iOS / desktop / any live avatar → a 302 to /ar/view (pages/ar-view.html,+// src/ar-view.js), a Vite-bundled page that generates a real USDZ+// from the GLB on the device (three.js USDZExporter) and sets it+// as <model-viewer>'s ios-src before Quick Look is offered.+// <model-viewer> does NOT convert GLB to USDZ on its own: an+// earlier version of this file inlined a <model-viewer> with no+// ios-src and a comment claiming otherwise, which is why iOS+// visitors silently fell back to the plain 3D viewer instead of+// Quick Look. Never inline that HTML again: any surface that+// needs real Quick Look must route through a page Vite bundles+// (bare `three` imports don't resolve in a raw server-rendered+// string or an unbundled static file).//// AR here is not a prop viewer: it is how three.ws agents cross into physical// space. A static object gets Quick Look / Scene Viewer placement; a LIVE asset// (a rigged avatar, an agent's body) additionally gets the IRL handoff// (/irl?avatar=<glb>): camera passthrough, animation, movement, and conversation// with the AI in the user's real room. `live: true` in planArLaunch marks that-// lane; it keeps Android on the launch page (instead of the blind Scene Viewer+// lane; it keeps Android on /ar/view (instead of the blind Scene Viewer// redirect) so the living-agent path is always visible.//// It is dependency-free and side-effect-free so the routing decision is unit--// tested in isolation, and carries ZERO payment/wallet/coin surface — AR is pure+// tested in isolation, and carries ZERO payment/wallet/coin surface: AR is pure// consumer value and ships on both the Claude and OpenAI tracks.// A GLB URL must be https and point at a .glb/.gltf asset (query string allowed).@@ -50,7 +57,7 @@ function arError(code, message) {export function detectArTarget(userAgent) {const ua = String(userAgent || '');// iPadOS 13+ reports a Mac UA; the "Mobile" token + touch is the tell, but- // server-side we only have the string — match the explicit iOS device tokens.+ // server-side we only have the string, so match the explicit iOS device tokens.if (/\b(iphone|ipad|ipod)\b/i.test(ua)) return 'ios';if (/\bandroid\b/i.test(ua)) return 'android';return 'desktop';@@ -97,12 +104,28 @@ export function buildIrlUrl(origin, glbUrl) {}/**- * Resolve the launch plan for a request. Returns:- * { target, action:'redirect', url } Android static model: 302 to Scene Viewer- * { target, action:'page' } iOS/desktop, and any live avatar- * plus the resolved viewer + scene-viewer URLs for the page/tool to use, and- * `irlUrl` when live (a rigged avatar) so the launch surface can offer the- * walking, talking agent experience alongside static placement.+ * The /ar/view URL for a GLB: the shared, Vite-bundled "place this in AR" page+ * (pages/ar-view.html, src/ar-view.js) that does the real on-device USDZ+ * conversion Quick Look needs. `irlUrl`, when set, adds the "Bring it to life"+ * hand-off for a live avatar.+ */+export function buildArViewUrl(origin, glbUrl, title = '', { irlUrl = '' } = {}) {+ const base = String(origin || 'https://three.ws').replace(/\/$/, '');+ const params = new URLSearchParams({ src: glbUrl });+ if (title) params.set('title', title);+ if (irlUrl) params.set('irl', irlUrl);+ return `${base}/ar/view?${params.toString()}`;+}++/**+ * Resolve the launch plan for a request. Every branch is a 302:+ * Android, static model → Scene Viewer's ARCore intent:// URL+ * iOS / desktop / any live avatar → /ar/view, which renders the right thing+ * per device (Quick Look with a real ios-src on iOS, the interactive+ * WebGL viewer on desktop) and carries the "Bring it to life" hand-off+ * when `irlUrl` is set.+ * `viewerUrl` and `sceneViewerUrl` are still returned for callers (the+ * export_ar MCP tool) that want the raw URLs alongside the launch link.*/export function planArLaunch({ glbUrl, userAgent, origin, title = '', live = false }) {const asset = assertArAssetUrl(glbUrl);@@ -110,10 +133,11 @@ export function planArLaunch({ glbUrl, userAgent, origin, title = '', live = falconst viewerUrl = buildViewerUrl(origin, asset, title);const sceneViewerUrl = buildSceneViewerUrl(asset, { title, fallbackUrl: viewerUrl });const irlUrl = live ? buildIrlUrl(origin, asset) : '';- // Live avatars always get the launch page: a straight Scene Viewer redirect- // would place a frozen body and hide the "bring it to life" path entirely.+ // Live avatars always get /ar/view: a straight Scene Viewer redirect would+ // place a frozen body and hide the "bring it to life" path entirely.if (target === 'android' && !live) {return { target, action: 'redirect', url: sceneViewerUrl, asset, viewerUrl, sceneViewerUrl, irlUrl };}- return { target, action: 'page', asset, viewerUrl, sceneViewerUrl, irlUrl, live };+ const viewUrl = buildArViewUrl(origin, asset, title, { irlUrl });+ return { target, action: 'redirect', url: viewUrl, asset, viewerUrl, sceneViewerUrl, irlUrl, live };}diff --git a/api/_lib/model-viewer-cdn.js b/api/_lib/model-viewer-cdn.jsindex 38e9b64c3..4304824c5 100644--- a/api/_lib/model-viewer-cdn.js+++ b/api/_lib/model-viewer-cdn.js@@ -1,22 +1,21 @@-// The single source of truth for the <model-viewer> build the server-rendered+// The single source of truth for the <model-viewer> build server-rendered// embed surfaces load.//-// Two surfaces render a GLB from HTML this repo generates on the server:-// • api/ar.js (the /api/ar device-aware AR launch page)-// • api/_mcp-studio/component.js (the ChatGPT Apps SDK inline widget)+// Current consumer: api/_mcp-studio/component.js (the ChatGPT Apps SDK inline+// widget), which renders a GLB from HTML generated on the server and needs the+// CDN host named in its `openai/widgetCSP` resource_domains allowlist, a second+// reason the URL must not be retyped per file. (/api/ar used to inline a+// <model-viewer> from this pin too; it now 302s to /ar/view, a Vite-bundled+// page (see api/_lib/ar-launch.js) because a server-rendered HTML string+// can offer AR modes but can never generate the ios-src USDZ Quick Look+// actually needs.)//-// Both import MODEL_VIEWER_SRC from here, so the pin moves in one place and the-// two surfaces can never drift apart. The CDN host is also what the widget's-// `openai/widgetCSP` resource_domains allowlist has to name, which is a second-// reason the URL must not be retyped per file.-//-// Why 3.5.0 and not the newest release: these two pages run inside someone-// else's frame (ChatGPT's sandboxed iframe, and a mobile in-app browser after a-// link tap). 3.5.0 is the build the rest of the platform's embeddable bundles-// ship (public/agenc/embed.js, public/ar-forge.html, public/spatial-mcp/), so an-// embedding page that already loaded model-viewer for one three.ws embed reuses-// the exact same module instead of registering a second, conflicting-// <model-viewer> custom element.+// Why 3.5.0 and not the newest release: the widget runs inside someone else's+// frame (ChatGPT's sandboxed iframe). 3.5.0 is the build the rest of the+// platform's embeddable bundles ship (public/agenc/embed.js,+// public/ar-forge.html, public/spatial-mcp/), so an embedding page that already+// loaded model-viewer for one three.ws embed reuses the exact same module+// instead of registering a second, conflicting <model-viewer> custom element.//// The standalone browser viewer (public/viewer.html) is deliberately NOT on this// pin. It is a first-party top-level page, not an embed, so it takes 4.0.0 withdiff --git a/api/ar.js b/api/ar.jsindex 6e45d14ef..677e2c771 100644--- a/api/ar.js+++ b/api/ar.js@@ -2,29 +2,34 @@* Device-aware AR launch: GET /api/ar?src=<glbUrl>&title=<name>&kind=<avatar?>* -----------------------------------------------------------------------------* Places a generated GLB in the user's space, branching on the request's- * User-Agent (server-side, from the header — no client round-trip):+ * User-Agent (server-side, from the header, no client round-trip):*- * • Android → 302 to a Google Scene Viewer ARCore intent:// URL (GLB as the- * source), with a browser fallback to the WebGL viewer.- * • iOS → an HTML launch page with <model-viewer>; tapping "View in AR"- * enters Apple Quick Look, for which model-viewer generates a USDZ from the- * GLB on the fly (a real conversion via three.js USDZExporter, in-page).- * • desktop → the same launch page, which falls back to the interactive WebGL- * viewer (no AR hardware).+ * • Android → a straight 302 to a Google Scene Viewer ARCore intent:// URL+ * (GLB as the source), with a browser fallback to the WebGL viewer.+ * • iOS / desktop / any live avatar → an interstitial that carries this+ * model's real og:image/title so a pasted link still unfurls, then hands+ * off to /ar/view (pages/ar-view.html), which generates a real USDZ from+ * the GLB on the device (three.js USDZExporter) before offering Apple+ * Quick Look. <model-viewer> does not do that conversion on its own, so+ * the actual AR page has to be a real Vite-bundled page rather than HTML+ * this handler writes inline (a bare `three` import does not resolve+ * outside a bundle). See api/_lib/ar-launch.js for the full routing+ * rationale. A plain 302 here would drop the unfurl (crawlers don't run+ * the JS on the redirect target), which is why this branch gets a real+ * page instead of Android's clean redirect.** `kind=avatar` marks a LIVE asset (a rigged avatar, an agent's body). AR is how* three.ws agents cross into the physical world, so an avatar launch always- * serves the page (Android included) with a "Bring it to life" handoff into+ * lands on /ar/view (Android included) with a "Bring it to life" hand-off into* /irl?avatar=<glb>: camera passthrough, animation, movement, and conversation* with the AI in the user's real room, alongside the static AR placement.** Bad input (non-https, non-GLB, missing) is rejected at the boundary with a- * clean, designed error page — never a crash. Zero payment/coin surface.+ * clean, designed error page, never a crash. Zero payment/coin surface.*/import { cors, method, wrap } from './_lib/http.js';import { planArLaunch } from './_lib/ar-launch.js';-import { MODEL_VIEWER_SRC } from './_lib/model-viewer-cdn.js';function esc(s) {return String(s || '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));@@ -48,17 +53,20 @@ border-radius:10px;padding:9px 14px;text-decoration:none;font-weight:600;font-si<a href="https://three.ws">Create a 3D model</a></div></body></html>`;}-function launchPage({ target, asset, viewerUrl, title, irlUrl, origin, pageUrl }) {+// A crawler (X, Discord, iMessage) reads only this static HTML and never runs+// the redirect script, so the unfurl meta has to be right here rather than on+// /ar/view. A real visitor's browser runs the one-line redirect immediately;+// there is no visible interstitial in practice.+function interstitialPage({ target, asset, title, irlUrl, origin, pageUrl }) {const t = title ? esc(title) : irlUrl ? '3D avatar' : '3D model';- // Share card: a real render of THIS model (GET /api/render/glb, CDN-cached a- // day), so a pasted AR link unfurls with the object itself, not a logo.const ogImage = `${origin}/api/render/glb?glbUrl=${encodeURIComponent(asset)}&width=1200&height=630`;const ogDesc = irlUrl? 'A living AI agent. Open on your phone to place it in your room, or bring it to life to walk and talk with it.': 'Open on your phone to place this 3D model in your room at real size. Made on three.ws: type a sentence, get a 3D model.';return `<!doctype html><html lang="en"><head><meta charset="utf-8"/>-<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"/>+<meta name="viewport" content="width=device-width,initial-scale=1"/><title>View ${t} in AR · three.ws</title><meta name="robots" content="noindex"/>+<meta http-equiv="refresh" content="0;url=${esc(target)}"/><meta property="og:type" content="website"/><meta property="og:site_name" content="three.ws"/><meta property="og:title" content="Place ${t} in your room"/>@@ -69,49 +77,16 @@ function launchPage({ target, asset, viewerUrl, title, irlUrl, origin, pageUrl }<meta name="twitter:title" content="Place ${t} in your room"/><meta name="twitter:description" content="${esc(ogDesc)}"/><meta name="twitter:image" content="${esc(ogImage)}"/>-<script src="/model-viewer-meshopt.js"></script>-<script type="module" src="${MODEL_VIEWER_SRC}"></script>-<style>:root{color-scheme:dark;--accent:#6ea8fe}*{box-sizing:border-box}html,body{margin:0;height:100%}-body{font-family:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;background:radial-gradient(130% 130% at 50% 0%,#14161c,#08090c);color:#e8eaf0;overflow:hidden}-.wrap{display:flex;flex-direction:column;height:100dvh}.stage{position:relative;flex:1 1 auto;min-height:0}-model-viewer{width:100%;height:100%;--progress-bar-color:var(--accent);background:transparent}-.bar{display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:center;padding:14px 16px;border-top:1px solid rgba(255,255,255,.07);background:rgba(10,11,14,.55);backdrop-filter:blur(8px)}-.name{position:absolute;top:14px;left:50%;transform:translateX(-50%);max-width:min(86vw,48ch);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#cdd3de;font-size:13px;font-weight:600;background:rgba(10,11,14,.5);border:1px solid rgba(255,255,255,.07);border-radius:999px;padding:6px 14px;backdrop-filter:blur(8px);pointer-events:none}-.loading{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:#9aa3b2;font-size:13px;pointer-events:none;transition:opacity .3s ease}-button.ar,a.ar{appearance:none;cursor:pointer;text-decoration:none;font-size:14px;font-weight:700;color:#0b0c10;background:var(--accent);border:0;border-radius:12px;padding:12px 20px;display:inline-flex;align-items:center;gap:8px}-button.ar:active{transform:translateY(1px)}button.ar:focus-visible{outline:2px solid #fff;outline-offset:2px}-.ghost{appearance:none;cursor:pointer;text-decoration:none;font-size:14px;font-weight:700;color:var(--accent);background:rgba(110,168,254,.14);border:1px solid rgba(110,168,254,.45);border-radius:12px;padding:11px 18px;display:inline-flex;align-items:center;gap:8px;transition:background .15s ease}-.ghost:hover{background:rgba(110,168,254,.24)}.ghost:active{transform:translateY(1px)}.ghost:focus-visible{outline:2px solid #fff;outline-offset:2px}-.hint{position:absolute;left:0;right:0;bottom:16px;text-align:center;color:#9aa3b2;font-size:12px;pointer-events:none}-a.alt{color:#aeb6c4;font-size:12.5px;text-decoration:underline}</style></head>-<body><div class="wrap"><div class="stage">-<model-viewer id="mv" src="${esc(asset)}" alt="${t}" camera-controls auto-rotate touch-action="pan-y"- environment-image="neutral" exposure="1.05" shadow-intensity="1" tone-mapping="aces"- ar ar-modes="webxr scene-viewer quick-look" ar-scale="auto" ${target === 'ios' ? 'reveal="auto"' : ''}>-</model-viewer>-${title ? `<div class="name">${t}</div>` : ''}-<div class="loading" id="loading">Loading your model…</div>-<div class="hint" id="hint">${irlUrl ? 'This is a living agent. Bring it to life to walk and talk with it in your room.' : 'Move your phone to place the model in your space.'}</div>-</div>-<div class="bar">-${irlUrl ? `<a class="ar" href="${esc(irlUrl)}" aria-label="Bring this avatar to life in your room: it moves and talks through your camera">🤖 Bring it to life</a>\n<button class="ghost" id="ar-btn" type="button" aria-label="Place a static copy of this avatar in augmented reality">📱 Place in your space</button>` : `<button class="ar" id="ar-btn" type="button" aria-label="View this model in augmented reality">📱 View in your space</button>`}-<a class="alt" href="${esc(viewerUrl)}">Open in 3D viewer</a>-<a class="alt" href="/ar" aria-label="Create your own 3D model from a sentence, free">Create your own</a>-</div></div>-<script>-(function(){var mv=document.getElementById('mv'),btn=document.getElementById('ar-btn'),hint=document.getElementById('hint'),loading=document.getElementById('loading'),live=${irlUrl ? 'true' : 'false'};-function sync(){ loading.style.opacity='0'; if(!mv.canActivateAR){ btn.textContent='View in 3D'; if(!live){ hint.style.display='none'; } } }-mv.addEventListener('load',sync);-mv.addEventListener('error',function(){ loading.textContent='This model could not load. Try the 3D viewer below.'; });-btn.addEventListener('click',function(){ if(mv.canActivateAR){ try{mv.activateAR();}catch(e){} } else { window.location.href='${esc(viewerUrl)}'; } });-})();-</script></body></html>`;+<style>:root{color-scheme:dark}body{margin:0;min-height:100dvh;display:flex;align-items:center;justify-content:center;+font-family:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;background:radial-gradient(130% 130% at 50% 0%,#14161c,#08090c);color:#9aa3b2;font-size:13px}</style>+<script>location.replace(${JSON.stringify(target)});</script>+</head><body>Opening AR…</body></html>`;}export default wrap(async (req, res) => {if (cors(req, res, { methods: 'GET,OPTIONS' })) return;// The CORS preflight already advertises GET only; enforce it too, so a POST- // gets a 405 with an Allow header instead of being served the launch page.+ // gets a 405 with an Allow header instead of a redirect.if (!method(req, res, ['GET'])) return;const url = new URL(req.url, 'http://x');@@ -119,10 +94,11 @@ export default wrap(async (req, res) => {const title = (url.searchParams.get('title') || '').slice(0, 120);// kind=avatar marks a rigged agent body; it unlocks the IRL living handoff.const live = url.searchParams.get('kind') === 'avatar';+ const origin = originFrom(req);let plan;try {- plan = planArLaunch({ glbUrl: src, userAgent: req.headers['user-agent'], origin: originFrom(req), title, live });+ plan = planArLaunch({ glbUrl: src, userAgent: req.headers['user-agent'], origin, title, live });} catch (err) {res.statusCode = 400;res.setHeader('content-type', 'text/html; charset=utf-8');@@ -131,28 +107,25 @@ export default wrap(async (req, res) => {return;}- if (plan.action === 'redirect') {+ // Every branch here is device-specific (Android gets Scene Viewer, everyone+ // else gets /ar/view), so a shared CDN cache must never serve one device's+ // response to another.+ res.setHeader('vary', 'user-agent');+ res.setHeader('cache-control', 'no-store');++ if (plan.url.startsWith('intent://')) {res.statusCode = 302;res.setHeader('location', plan.url);- res.setHeader('cache-control', 'no-store');res.end();return;}res.statusCode = 200;res.setHeader('content-type', 'text/html; charset=utf-8');- // The page is UA-branched (iOS Quick Look vs desktop fallback) while Android- // gets a 302 above — without Vary a CDN-cached desktop page can be served to- // an Android phone and swallow the straight-into-AR redirect. Vary keeps the- // browser cache (one UA per browser) and stops the cross-device bleed.- res.setHeader('vary', 'user-agent');- res.setHeader('cache-control', 'public, max-age=60, s-maxage=600');- const origin = originFrom(req);res.end(- launchPage({- target: plan.target,+ interstitialPage({+ target: plan.url,asset: plan.asset,- viewerUrl: plan.viewerUrl,title,irlUrl: plan.irlUrl,origin,diff --git a/data/changelog.json b/data/changelog.jsonindex bbd08d3ec..f3f148a30 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,16 @@{"$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-08-20",+ "title": "AR now actually opens AR on iPhone: AR Forge and AR Studio, not just avatars",+ "summary": "Placing a model from AR Forge or the multi-model AR Studio in your real room worked correctly on Android, but iPhone quietly got a downgrade: AR Forge fell back to the plain 3D viewer, and AR Studio faked it with a camera overlay that had no real-world plane detection, no correct scale, and nothing to rest the model on the floor. Only the avatar AR page did this right. Both surfaces now use the same real pipeline: a genuine USDZ is generated on your device (the same three.js conversion the avatar page always used) and handed to Apple Quick Look, so the model is actually tracked to your room, sized correctly, and sits on your real floor. AR Studio's AR button now also offers Google Scene Viewer directly instead of only the raw WebXR session. Shared AR links still unfurl with a real render of the model when pasted into X, Discord, or iMessage.",+ "tags": [+ "fix",+ "improvement"+ ],+ "link": "/ar"+ },{"date": "2026-08-19","title": "Our AR studio is now a package anyone can drop into their own site",diff --git a/data/pages.json b/data/pages.jsonindex 619502dbd..a7d6e2bcb 100644--- a/data/pages.json+++ b/data/pages.json@@ -1008,6 +1008,14 @@"added": "2026-07-17","showcase": true},+ {+ "path": "/ar/view",+ "title": "View in AR",+ "description": "Place any three.ws GLB in your real space from a plain link: real ARKit Quick Look on iPhone (a genuine on-device USDZ conversion, not a camera overlay), Scene Viewer or WebXR on Android. The shared landing page behind /api/ar and every AR hand-off across the site.",+ "priority": 0.3,+ "changefreq": "monthly",+ "added": "2026-08-19"+ },{"path": "/daily","title": "Daily Forge",diff --git a/pages/ar-view.html b/pages/ar-view.htmlnew file mode 100644index 000000000..dd77dfe72--- /dev/null+++ b/pages/ar-view.html@@ -0,0 +1,211 @@+<!doctype html>+<html lang="en">+ <head>+ <style>/* three.ws hidden-guard: make the `hidden` attribute authoritative; see scripts/lib/hidden-guard.mjs */[hidden]{display:none!important}</style>+ <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" />+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />+ <meta name="theme-color" content="#000000" />+ <title data-i18n="ar_view.meta_title">View in AR · three.ws</title>+ <link rel="icon" href="/favicon.ico" sizes="any" />+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />+ <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />+ <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <meta name="description" content="Place any three.ws 3D model in your real space: Quick Look on iPhone, Scene Viewer or WebXR on Android." data-i18n-attr="content:ar_view.meta_description" />+ <meta name="robots" content="noindex" />+ <link rel="canonical" href="https://three.ws/ar/view" />++ <script+ type="module"+ src="https://ajax.googleapis.com/ajax/libs/model-viewer/4.0.0/model-viewer.min.js"+ integrity="sha384-sr9b4Ux0WhAUGclJ0ym0FSY2zSOMmNSn0bP/SA0e6bNCrpn/5W3QL8mm+LdlQMKw"+ crossorigin="anonymous"+ ></script>+ <script type="module" src="/src/ar-view.js"></script>++ <style>+ :root {+ --bg: #000000;+ --text: #e8e8e8;+ --text-2: #888888;+ --text-3: #555555;+ --accent: #ffffff;+ --accent-2: #ffffff;+ --border: rgba(255, 255, 255, 0.08);+ }+ *, *::before, *::after { box-sizing: border-box; }+ html, body {+ margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;+ background: var(--bg); color: var(--text);+ font-family: 'Inter', system-ui, sans-serif; -webkit-font-smoothing: antialiased;+ }+ .ar-bg { position: fixed; inset: 0; pointer-events: none; z-index: 0; }+ .ar-bg::before {+ content: ''; position: absolute; inset: 0;+ background:+ radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255, 255, 255, 0.03) 0%, transparent 65%),+ radial-gradient(ellipse 60% 50% at 80% 80%, rgba(255, 255, 255, 0.02) 0%, transparent 60%),+ radial-gradient(ellipse 50% 40% at 20% 70%, rgba(255, 255, 255, 0.02) 0%, transparent 55%);+ }+ #ar-shell { position: relative; width: 100%; height: 100%; z-index: 1; display: flex; flex-direction: column; }+ .ar-topbar {+ position: absolute; top: 0; left: 0; right: 0; z-index: 10;+ display: flex; align-items: center; justify-content: space-between;+ padding-left: 16px; padding-right: 16px;+ padding-top: calc(env(safe-area-inset-top, 0px) + 14px); padding-bottom: 14px;+ background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85) 0%, transparent 100%);+ }+ .ar-back {+ display: inline-flex; align-items: center; gap: 6px;+ color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500;+ transition: color 0.15s; padding: 6px 0;+ }+ .ar-back:hover { color: var(--text); }+ .ar-back svg { flex-shrink: 0; }+ .ar-topbar-center { position: absolute; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; }+ .ar-badge {+ display: inline-flex; align-items: center; gap: 5px;+ font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;+ color: var(--accent); background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.2);+ border-radius: 999px; padding: 4px 10px;+ }+ .ar-badge-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: ar-pulse 2s ease-in-out infinite; }+ @keyframes ar-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.75); } }+ .ar-share-btn {+ background: transparent; border: 1px solid var(--border); border-radius: 999px;+ color: var(--text-2); font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer;+ padding: 6px 14px; transition: border-color 0.15s, color 0.15s;+ }+ .ar-share-btn:hover { border-color: var(--text-3); color: var(--text); }+ model-viewer { position: absolute; inset: 0; width: 100%; height: 100%; --poster-color: transparent; background: transparent; }+ model-viewer::part(default-ar-button) { display: none; }+ .ar-bottom {+ position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;+ padding: 0 20px; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);+ background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.6) 60%, transparent 100%);+ display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none;+ }+ .ar-bottom > * { pointer-events: auto; }+ .ar-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); text-align: center; margin: 0; line-height: 1.2; font-family: 'Space Grotesk', system-ui, sans-serif; }+ .ar-subtitle { font-size: 13px; color: var(--text-2); text-align: center; margin: 0; }+ .ar-status { font-size: 12.5px; color: var(--accent-2); text-align: center; height: 18px; display: flex; align-items: center; gap: 6px; }+ .ar-status.is-error { color: #f87171; }+ .ar-status-spinner {+ width: 13px; height: 13px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25);+ border-top-color: var(--accent-2); animation: ar-spin 0.7s linear infinite; flex-shrink: 0;+ }+ @keyframes ar-spin { to { transform: rotate(360deg); } }+ .ar-launch-btn {+ width: 100%; max-width: 380px; height: 60px; background: #ffffff; color: #000000; border: 0;+ border-radius: 18px; font-family: 'Space Grotesk', system-ui, sans-serif; font-size: 17px; font-weight: 700;+ letter-spacing: -0.01em; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;+ transition: transform 0.12s, box-shadow 0.2s, opacity 0.15s;+ box-shadow: 0 8px 32px -8px rgba(255, 255, 255, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;+ position: relative; overflow: hidden;+ }+ .ar-launch-btn::after {+ content: ''; position: absolute; inset: 0;+ background: linear-gradient(to bottom, rgba(255, 255, 255, 0.12) 0%, transparent 50%); pointer-events: none;+ }+ .ar-launch-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 14px 40px -8px rgba(255, 255, 255, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1) inset; }+ .ar-launch-btn:active:not(:disabled) { transform: translateY(0); }+ .ar-launch-btn:disabled { opacity: 0.45; cursor: not-allowed; }+ .ar-launch-btn svg { flex-shrink: 0; }+ .ar-live-btn {+ width: 100%; max-width: 380px; height: 52px; margin-top: 10px;+ background: rgba(255, 255, 255, 0.08); color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.22);+ border-radius: 16px; font-family: 'Space Grotesk', system-ui, sans-serif; font-size: 15.5px; font-weight: 700;+ letter-spacing: -0.01em; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 9px;+ text-decoration: none; transition: transform 0.12s, background 0.2s, border-color 0.2s;+ }+ .ar-live-btn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.34); }+ .ar-live-btn:active { transform: translateY(0); }+ .ar-live-btn:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }+ .ar-live-btn[hidden] { display: none; }+ .ar-live-btn svg { flex-shrink: 0; }+ .ar-footer-links { display: flex; align-items: center; gap: 8px; margin-top: 12px; justify-content: center; flex-wrap: wrap; }+ .ar-footer-link { font-size: 12px; color: var(--text-3); text-decoration: none; transition: color 0.15s; }+ .ar-footer-link:hover { color: var(--text-2); }+ .ar-footer-sep { font-size: 12px; color: var(--text-3); }+ .ar-error { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-2); font-size: 15px; text-align: center; padding: 2rem; }+ </style>+ <script src="/model-viewer-meshopt.js"></script>+ </head>+ <body>+ <div class="ar-bg" aria-hidden="true"></div>++ <div id="ar-shell">+ <model-viewer+ id="ar-viewer"+ alt="3D model"+ camera-controls+ auto-rotate+ rotation-per-second="12deg"+ interaction-prompt="none"+ exposure="1.1"+ shadow-intensity="0.8"+ shadow-softness="0.9"+ environment-image="neutral"+ tone-mapping="aces"+ ar+ ar-modes="webxr scene-viewer quick-look"+ ar-scale="auto"+ reveal="auto"+ ></model-viewer>++ <header class="ar-topbar">+ <a class="ar-back" id="ar-back-link" href="/ar">+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <polyline points="15 18 9 12 15 6" />+ </svg>+ Back+ </a>+ <div class="ar-topbar-center">+ <span class="ar-badge" data-i18n-html="ar_view.ar_ready">+ <span class="ar-badge-dot"></span>+ AR Ready+ </span>+ </div>+ <button class="ar-share-btn" id="ar-share-btn" type="button" aria-label="Share" data-i18n="ar_view.share" data-i18n-attr="aria-label:ar_view.share_arialabel">+ Share+ </button>+ </header>++ <footer class="ar-bottom">+ <h1 class="ar-title" id="ar-title" data-i18n="ar_view.loading">Loading…</h1>+ <p class="ar-subtitle" data-i18n="ar_view.point_your_device_at_a_flat_surface">Point your device at a flat surface to place</p>+ <p class="ar-status" id="ar-status" hidden>+ <span class="ar-status-spinner" aria-hidden="true"></span>+ <span id="ar-status-text"></span>+ </p>+ <button class="ar-launch-btn" id="ar-launch-btn" type="button" disabled aria-busy="true">+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z" />+ </svg>+ Place in your space+ </button>+ <a class="ar-live-btn" id="ar-live-link" href="/irl" aria-label="Bring this avatar to life: it walks and talks with you through your camera" hidden data-i18n-attr="aria-label:ar_view.bring_this_avatar_to_life_it_arialabel">+ <svg width="19" height="19" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <circle cx="12" cy="5" r="3" />+ <path d="M12 8v6" />+ <path d="M9 22l3-8 3 8" />+ <path d="M8 12h8" />+ </svg>+ Bring it to life+ </a>+ <div class="ar-footer-links">+ <a href="/features/ar" class="ar-footer-link" data-i18n="ar_view.ar_feature_overview">AR feature overview</a>+ <span class="ar-footer-sep" aria-hidden="true">·</span>+ <a href="/docs/ar" class="ar-footer-link" data-i18n="ar_view.how_it_works">How it works</a>+ <span class="ar-footer-sep" aria-hidden="true">·</span>+ <a href="/ar" class="ar-footer-link" data-i18n="ar_view.make_your_own">Make your own</a>+ </div>+ </footer>+ </div>+ <script src="/brand.js" defer></script>+ <!-- Runtime i18n: detects locale, swaps annotated copy, mounts <lang-switcher>. -->+ <script type="module" src="/i18n.js"></script>+ </body>+</html>diff --git a/public/ar-forge.html b/public/ar-forge.htmlindex cce053cbe..4378d9662 100644--- a/public/ar-forge.html+++ b/public/ar-forge.html@@ -558,8 +558,12 @@arBtn.addEventListener('click', function () {if (mv.canActivateAR) { try { mv.activateAR(); return; } catch (e) {} }- // Desktop / unsupported browser: the server-side launcher routes any device correctly.- window.open(arLink(), '_blank', 'noopener');+ // iOS Safari never reports canActivateAR here (this model-viewer has no+ // ios-src: Quick Look needs a real USDZ, which only /ar/view generates+ // on the device). /api/ar 302s any device to the right place: Quick Look+ // on iOS, the WebGL viewer on desktop. Same-tab so a phone tap feels like+ // one action, not a background tab nobody notices.+ location.href = arLink();});shareBtn.addEventListener('click', function () {diff --git a/public/changelog.json b/public/changelog.jsonindex f900deefa..edb11ba77 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,11 +1,22 @@{- "generated_at": "2026-08-19T21:24:49.110Z",+ "generated_at": "2026-08-20T00:11:00.463Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws","url": "https://three.ws"},"entries": [+ {+ "date": "2026-08-20",+ "type": "update",+ "title": "AR now actually opens AR on iPhone: AR Forge and AR Studio, not just avatars",+ "summary": "Placing a model from AR Forge or the multi-model AR Studio in your real room worked correctly on Android, but iPhone quietly got a downgrade: AR Forge fell back to the plain 3D viewer, and AR Studio faked it with a camera overlay that had no real-world plane detection, no correct scale, and nothing to rest the model on the floor. Only the avatar AR page did this right. Both surfaces now use the same real pipeline: a genuine USDZ is generated on your device (the same three.js conversion the avatar page always used) and handed to Apple Quick Look, so the model is actually tracked to your room, sized correctly, and sits on your real floor. AR Studio's AR button now also offers Google Scene Viewer directly instead of only the raw WebXR session. Shared AR links still unfurl with a real render of the model when pasted into X, Discord, or iMessage.",+ "link": "/ar",+ "tags": [+ "fix",+ "improvement"+ ]+ },{"date": "2026-08-19","type": "launch",@@ -16,6 +27,16 @@"launch"]},+ {+ "date": "2026-08-19",+ "type": "launch",+ "title": "View in AR",+ "summary": "Place any three.ws GLB in your real space from a plain link: real ARKit Quick Look on iPhone (a genuine on-device USDZ conversion, not a camera overlay), Scene Viewer or WebXR on Android. The shared landing page behind /api/ar and every AR hand-off across the site.",+ "link": "/ar/view",+ "tags": [+ "launch"+ ]+ },{"date": "2026-08-19","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex ed41ae6e0..27dccc6c6 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -6,6 +6,14 @@<atom:link href="https://three.ws/changelog.xml" rel="self" type="application/rss+xml"/><description>What's new on three.ws: features, improvements, and releases, newest first.</description><language>en</language>+ <item>+ <title>AR now actually opens AR on iPhone: AR Forge and AR Studio, not just avatars</title>+ <link>https://three.ws/ar</link>+ <guid isPermaLink="false">2026-08-20:AR now actually opens AR on iPhone: AR Forge and AR Studio, not just avatars</guid>+ <pubDate>Thu, 20 Aug 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Placing a model from AR Forge or the multi-model AR Studio in your real room worked correctly on Android, but iPhone quietly got a downgrade: AR Forge fell back to the plain 3D viewer, and AR Studio faked it with a camera overlay that had no real-world plane detection, no correct scale, and nothing to rest the model on the floor. Only the avatar AR page did this right. Both surfaces now use the same real pipeline: a genuine USDZ is generated on your device (the same three.js conversion the avatar page always used) and handed to Apple Quick Look, so the model is actually tracked to your room, sized correctly, and sits on your real floor. AR Studio's AR button now also offers Google Scene Viewer directly instead of only the raw WebXR session. Shared AR links still unfurl with a real render of the model when pasted into X, Discord, or iMessage.</description>+ </item><item><title>Deploy On-chain</title><link>https://three.ws/deploy-onchain</link>@@ -14,6 +22,14 @@<category>launch</category><description>Mint your agent into the Metaplex Agent Registry on Solana, in the exact shape the Genesis 333 shipped: a Metaplex Core asset with its own wallet, EIP-8004 identity, verified creator, royalties, and immutable metadata. Phantom, Solflare, or any Solana wallet signs; keys never leave the browser, and devnet rehearsal is free.</description></item>+ <item>+ <title>View in AR</title>+ <link>https://three.ws/ar/view</link>+ <guid isPermaLink="false">2026-08-19:View in AR</guid>+ <pubDate>Wed, 19 Aug 2026 12:00:00 GMT</pubDate>+ <category>launch</category>+ <description>Place any three.ws GLB in your real space from a plain link: real ARKit Quick Look on iPhone (a genuine on-device USDZ conversion, not a camera overlay), Scene Viewer or WebXR on Android. The shared landing page behind /api/ar and every AR hand-off across the site.</description>+ </item><item><title>A page that fails to load now tells you which thing went wrong</title><link>https://three.ws/changelog</link>diff --git a/public/features.json b/public/features.jsonindex f26fa9034..cbfaa5280 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-08-19T21:24:49.099Z",+ "generated_at": "2026-08-20T00:11:00.455Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",@@ -1229,6 +1229,16 @@"tags": [],"showcase": true},+ {+ "path": "/ar/view",+ "title": "View in AR",+ "description": "Place any three.ws GLB in your real space from a plain link: real ARKit Quick Look on iPhone (a genuine on-device USDZ conversion, not a camera overlay), Scene Viewer or WebXR on Android. The shared landing page behind /api/ar and every AR hand-off across the site.",+ "added": "2026-08-19",+ "auth": null,+ "indexable": true,+ "tags": [],+ "showcase": false+ },{"path": "/daily","title": "Daily Forge",diff --git a/public/llms-full.txt b/public/llms-full.txtindex e4f4691c5..b4dc91eba 100644--- a/public/llms-full.txt+++ b/public/llms-full.txt@@ -748,6 +748,12 @@ URL: https://three.ws/ar/studioA live multi-model AR scene through your camera: place any number of 3D models and avatars in your real space, pull in your forge creations, community models, the CC0 object library, or any GLB link, and generate new models by prompt without leaving the view.+### View in AR++URL: https://three.ws/ar/view++Place any three.ws GLB in your real space from a plain link: real ARKit Quick Look on iPhone (a genuine on-device USDZ conversion, not a camera overlay), Scene Viewer or WebXR on Android. The shared landing page behind /api/ar and every AR hand-off across the site.+### Daily ForgeURL: https://three.ws/dailydiff --git a/public/llms.txt b/public/llms.txtindex 477ad34fb..c66476046 100644--- a/public/llms.txt+++ b/public/llms.txt@@ -155,6 +155,7 @@ Experimental features actively shipping. Expect fast iteration.- [Generation Watch](https://three.ws/watch): Live progress page for a running text-to-3D generation: real countdown, the painted concept art, and an automatic hand-off into the interactive viewer the moment the model is ready.- [AR Forge](https://three.ws/ar): Type a prompt, get a real 3D model, and place it in your room: free text-to-3D with one-tap AR on any phone (WebXR, Scene Viewer, Quick Look) and a QR handoff from desktop.- [AR Studio](https://three.ws/ar/studio): A live multi-model AR scene through your camera: place any number of 3D models and avatars in your real space, pull in your forge creations, community models, the CC0 object library, or any GLB link, and generate new models by prompt without leaving the view.+- [View in AR](https://three.ws/ar/view): Place any three.ws GLB in your real space from a plain link: real ARKit Quick Look on iPhone (a genuine on-device USDZ conversion, not a camera overlay), Scene Viewer or WebXR on Android. The shared landing page behind /api/ar and every AR hand-off across the site.- [Daily Forge](https://three.ws/daily): A new 3D creative challenge every day. Forge today's theme into a real 3D model, free and no sign-up, build a daily streak, and place your creation in AR on your phone.- [Spatial MCP: reference renderer](https://three.ws/spatial-mcp): The open standard for returning a live, interactive 3D scene as a first-class MCP tool result, with a framework-free reference renderer that displays any conformant artifact: including ones transformed from other tools.- [Playground](https://three.ws/playground): Sandbox for experimenting with agents, prompts, and 3D scenes.diff --git a/public/sitemap/index.html b/public/sitemap/index.htmlindex c015618f0..dcf0198a2 100644--- a/public/sitemap/index.html+++ b/public/sitemap/index.html@@ -83,7 +83,7 @@<main class="sm-wrap"><div class="sm-hero"><h1>Sitemap</h1>- <p>All 826 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p>+ <p>All 827 pages on three.ws, grouped by purpose. Looking for the machine-readable versions?</p><div class="sm-formats"><a href="/sitemap.xml"><code>sitemap.xml</code> · for search engines</a><a href="/llms.txt"><code>llms.txt</code> · for AI agents</a>@@ -95,7 +95,7 @@</div><div class="sm-filter"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="m21 21-4.3-4.3"/></svg>- <input id="sm-filter-input" type="search" placeholder="Filter 826 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" />+ <input id="sm-filter-input" type="search" placeholder="Filter 827 pages by name, path, or description…" aria-label="Filter pages" autocomplete="off" spellcheck="false" /><kbd aria-hidden="true">/</kbd></div><p class="sm-filter-count" id="sm-filter-count" role="status" aria-live="polite"></p>@@ -103,6 +103,14 @@<h2 id="sm-new-title">Newest<a class="sm-new-more" href="/changelog">full changelog →</a></h2><p class="sm-section-desc">The 9 most recently launched pages, straight to the live surface.</p><ul class="sm-list">+ <li>+ <a href="/ar/view">+ <span class="sm-new-date">Aug 19, 2026</span>+ <span class="sm-title">View in AR</span>+ <span class="sm-path">/ar/view</span>+ <span class="sm-desc">Place any three.ws GLB in your real space from a plain link: real ARKit Quick Look on iPhone (a genuine on-device USDZ conversion, not a camera overlay), Scene Viewer or WebXR on Android. The shared landing page behind /api/ar and every AR hand-off across the site.</span>+ </a>+ </li><li><a href="/deploy-onchain"><span class="sm-new-date">Aug 19, 2026</span>@@ -167,14 +175,6 @@<span class="sm-desc">Every finished reconstruction is stored durably and minted as a draft on-chain agent identity: the Solana leg, the ERC-8004 leg, the flags that arm each one, and how to prove the whole path on devnet.</span></a></li>- <li>- <a href="/docs/agent-index">- <span class="sm-new-date">Aug 14, 2026</span>- <span class="sm-title">Docs · The Agent Index</span>- <span class="sm-path">/docs/agent-index</span>- <span class="sm-desc">The platform's own cross-chain index of agent registrations, token launches, reputation attestations, transfers and delegations, Solana first: one public endpoint, absolute on-chain timestamps, and published index freshness.</span>- </a>- </li></ul></section><nav class="sm-toc" aria-label="Sections">@@ -987,7 +987,7 @@<section class="sm-section" id="labs"><header>- <h2>Labs<span class="sm-count" data-count>21</span></h2>+ <h2>Labs<span class="sm-count" data-count>22</span></h2><p class="sm-section-desc">Experimental features actively shipping. Expect fast iteration.</p></header><ul class="sm-list">@@ -1054,6 +1054,13 @@<span class="sm-desc">A live multi-model AR scene through your camera: place any number of 3D models and avatars in your real space, pull in your forge creations, community models, the CC0 object library, or any GLB link, and generate new models by prompt without leaving the view.</span></a></li>+ <li>+ <a href="/ar/view">+ <span class="sm-title">View in AR</span>+ <span class="sm-path">/ar/view</span>+ <span class="sm-desc">Place any three.ws GLB in your real space from a plain link: real ARKit Quick Look on iPhone (a genuine on-device USDZ conversion, not a camera overlay), Scene Viewer or WebXR on Android. The shared landing page behind /api/ar and every AR hand-off across the site.</span>+ </a>+ </li><li><a href="/daily"><span class="sm-title">Daily Forge</span>diff --git a/src/ar-view.js b/src/ar-view.jsnew file mode 100644index 000000000..90b341644--- /dev/null+++ b/src/ar-view.js@@ -0,0 +1,162 @@+// /ar/view: generic "place this GLB in AR" page, driven entirely by query+// params instead of an avatar record. This is the shared landing spot for+// every "give me a src, open real device AR" caller that isn't itself a+// bundled page: /api/ar (AR Forge's iOS/desktop fallback, the export_ar MCP+// tool, Object Library), and the AR Studio single-model hand-off. It exists+// because <model-viewer>'s Quick Look mode needs a real USDZ file (ios-src),+// which model-viewer does NOT generate on its own. The conversion has to+// run here, in a page Vite actually bundles (so `import 'three/addons/...'`+// resolves), exactly the way /avatars/:id/ar (src/ar-page.js) already does.+// Never copy this logic back into an unbundled static file or a server-+// rendered HTML string: it will 404 or throw on the bare 'three' import.++import { glbBlobToUsdzBlob } from './usdz-pipeline.js';+import { createLogger } from './shared/log.js';++const log = createLogger('ar-view');++const $ = (id) => document.getElementById(id);++const params = new URLSearchParams(location.search);+const glbUrl = params.get('src') || '';+const title = (params.get('title') || '').slice(0, 120);+const irlUrl = params.get('irl') || '';+const backUrl = params.get('back') || '/ar';++let usdzObjectUrl = null;++function isHttpsGlb(u) {+ try {+ const parsed = new URL(u);+ return parsed.protocol === 'https:' && /\.(glb|gltf)$/i.test(parsed.pathname);+ } catch {+ return false;+ }+}++function showError(msg) {+ const shell = $('ar-shell');+ if (shell) shell.innerHTML = `<div class="ar-error">${msg}</div>`;+}++function setStatus(msg) {+ const el = $('ar-status');+ const txt = $('ar-status-text');+ if (!msg) { el.hidden = true; return; }+ txt.textContent = msg;+ el.hidden = false;+}++function setArReady() {+ $('ar-status').hidden = true;+ $('ar-launch-btn').disabled = false;+ $('ar-launch-btn').removeAttribute('aria-busy');+}++function applyUsdzSrc(src) {+ $('ar-viewer').setAttribute('ios-src', src);+}++async function generateUsdz(url) {+ const btn = $('ar-launch-btn');+ setStatus('Preparing AR preview…');+ btn.disabled = true;+ btn.setAttribute('aria-busy', 'true');+ try {+ setStatus('Downloading model…');+ const r = await fetch(url);+ if (!r.ok) throw new Error(`GLB fetch ${r.status}`);+ const glbBlob = await r.blob();+ setStatus('Generating AR preview…');+ const usdzBlob = await glbBlobToUsdzBlob(glbBlob);+ if (usdzObjectUrl) URL.revokeObjectURL(usdzObjectUrl);+ usdzObjectUrl = URL.createObjectURL(usdzBlob);+ applyUsdzSrc(usdzObjectUrl);+ setArReady();+ setStatus('AR preview ready');+ setTimeout(() => setStatus(null), 2000);+ } catch (err) {+ log.warn('[ar-view] USDZ generation failed:', err?.message);+ $('ar-status').classList.add('is-error');+ setStatus(`Couldn't generate AR preview: ${err.message}`);+ btn.disabled = false;+ btn.removeAttribute('aria-busy');+ }+}++async function shareModel() {+ const url = location.href;+ const shareTitle = title ? `${title} in AR · three.ws` : '3D model in AR · three.ws';+ if (navigator.share) {+ try {+ await navigator.share({ title: shareTitle, url });+ return;+ } catch {+ // fall through to clipboard+ }+ }+ try {+ await navigator.clipboard.writeText(url);+ const btn = $('ar-share-btn');+ const orig = btn.textContent;+ btn.textContent = 'Copied!';+ setTimeout(() => { btn.textContent = orig; }, 1800);+ } catch {+ // nothing to do+ }+}++// Desktop / unsupported browsers report canActivateAR === false; there is no+// AR mode to activate, so copy the link for a phone instead.+async function offerArOnPhone() {+ const statusEl = $('ar-status');+ statusEl.classList.remove('is-error');+ try {+ await navigator.clipboard.writeText(location.href);+ setStatus('AR needs a phone: link copied. Open it on your iPhone or Android.');+ } catch {+ setStatus('AR needs a phone: open this page on your iPhone or Android device.');+ }+ setTimeout(() => setStatus(null), 6000);+}++function init() {+ if (!isHttpsGlb(glbUrl)) {+ showError("Couldn't open this in AR: provide a valid https URL to a .glb model.");+ return;+ }++ $('ar-title').textContent = title || '3D model';+ document.title = title ? `${title} in AR · three.ws` : 'View in AR · three.ws';+ $('ar-back-link').href = backUrl;++ const viewer = $('ar-viewer');+ viewer.setAttribute('src', glbUrl);+ viewer.setAttribute('alt', title || '3D model');++ if (irlUrl) {+ const liveLink = $('ar-live-link');+ liveLink.href = irlUrl;+ liveLink.hidden = false;+ }++ viewer.addEventListener('load', () => generateUsdz(glbUrl), { once: true });+ viewer.addEventListener('error', () => {+ showError('This model could not be displayed here.');+ }, { once: true });++ $('ar-share-btn').addEventListener('click', shareModel);+ $('ar-launch-btn').addEventListener('click', () => {+ if (viewer.canActivateAR) {+ viewer.activateAR();+ } else {+ offerArOnPhone();+ }+ });++ window.addEventListener('beforeunload', () => {+ if (usdzObjectUrl) URL.revokeObjectURL(usdzObjectUrl);+ });+}++document.addEventListener('DOMContentLoaded', init);diff --git a/tests/api/ar-endpoint.test.js b/tests/api/ar-endpoint.test.jsindex 9d4040282..2f927ef1e 100644--- a/tests/api/ar-endpoint.test.js+++ b/tests/api/ar-endpoint.test.js@@ -4,13 +4,24 @@//// The routing core is pure and unit-tested in tests/ar-export.test.js. What was// never pinned is the HTTP surface a reviewer actually hits: the User-Agent-// branch (Android intent redirect vs iOS/desktop launch page vs the avatar IRL-// handoff), the designed error page for a bad src, and the cache/Vary headers-// that keep a CDN from serving a desktop page to an Android phone.+// branch (Android intent redirect vs the /ar/view interstitial vs the avatar+// IRL handoff carried through the query string), the designed error page for a+// bad src, and the cache/Vary headers that keep a CDN from serving one device's+// response to another.+//+// Android gets a clean 302 straight into the Scene Viewer intent. Everyone else+// gets a 200 interstitial: real og:image/title meta (so a pasted link still+// unfurls on X/Discord/iMessage, which a bare 302 cannot do) plus an immediate+// client-side redirect to /ar/view, the Vite-bundled page that actually+// generates a USDZ from the GLB on the device (three.js USDZExporter) before+// offering Apple Quick Look. The handler used to inline a <model-viewer> launch+// page directly for iOS/desktop instead, but that HTML never set ios-src+// (Quick Look needs a real USDZ, and <model-viewer> does not generate one on+// its own), so iOS visitors silently fell back to the plain 3D viewer.//// No network and no mocks: the handler is invoked directly with mocked req/res// objects (the pattern used by tests/api/avatar-og.test.js), so every assertion-// runs against the real handler, the real planArLaunch, and the real HTML.+// runs against the real handler and the real planArLaunch.import { describe, it, expect } from 'vitest';@@ -59,6 +70,13 @@ async function get(opts) {return res;}+// The interstitial embeds its redirect target in a <meta http-equiv="refresh">+// and a location.replace call; pull it out of either rather than re-deriving it.+function redirectTargetOf(html) {+ const m = html.match(/location\.replace\((".*?")\)/);+ return m ? JSON.parse(m[1]) : null;+}+describe('GET /api/ar - Android Scene Viewer branch', () => {it('302s a static model straight into the ARCore Scene Viewer intent', async () => {const res = await get({ ua: UA.android, title: 'a low-poly fox' });@@ -79,33 +97,32 @@ describe('GET /api/ar - Android Scene Viewer branch', () => {});});-describe('GET /api/ar - iOS and desktop launch page', () => {- it('serves the HTML launch page to iPhone with the model wired into model-viewer', async () => {- const res = await get({ ua: UA.iphone });+describe('GET /api/ar - iOS and desktop interstitial to /ar/view', () => {+ it('serves an iPhone a 200 interstitial that redirects to /ar/view with the model and title carried through', async () => {+ const res = await get({ ua: UA.iphone, title: 'a low-poly fox' });expect(res.statusCode).toBe(200);expect(res._h['content-type']).toBe('text/html; charset=utf-8');- expect(res._body).toContain(`<model-viewer id="mv" src="${GLB}"`);- // Quick Look is what iOS enters; model-viewer converts the GLB in-page.- expect(res._body).toContain('ar-modes="webxr scene-viewer quick-look"');- expect(res._body).toContain('id="ar-btn"');- expect(res._body).toContain('View in your space');+ const target = new URL(redirectTargetOf(res._body));+ expect(target.pathname).toBe('/ar/view');+ expect(target.searchParams.get('src')).toBe(GLB);+ expect(target.searchParams.get('title')).toBe('a low-poly fox');});- it('serves the same page to iPad and to desktop, with the 3D viewer fallback link', async () => {+ it('sends iPad and desktop to the same /ar/view interstitial', async () => {for (const ua of [UA.ipad, UA.desktop]) {const res = await get({ ua });expect(res.statusCode).toBe(200);- expect(res._body).toContain(`href="https://three.ws/viewer?src=${encodeURIComponent(GLB)}"`);- expect(res._body).toContain('Open in 3D viewer');+ expect(redirectTargetOf(res._body)).toContain('/ar/view?src=');}});- it('renders the title into the document title and the name chip, HTML-escaped', async () => {+ it('carries the title through untouched, HTML-escaped in the unfurl meta', async () => {const res = await get({ ua: UA.desktop, title: '<img src=x onerror=alert(1)>' });expect(res.statusCode).toBe(200);- expect(res._body).not.toContain('<img src=x');+ expect(res._body).not.toContain('<img src=x onerror');expect(res._body).toContain('<img src=x onerror=alert(1)>');- expect(res._body).toContain('class="name"');+ const target = new URL(redirectTargetOf(res._body));+ expect(target.searchParams.get('title')).toBe('<img src=x onerror=alert(1)>');});it('unfurls with a real render of THIS model, not a logo', async () => {@@ -116,39 +133,43 @@ describe('GET /api/ar - iOS and desktop launch page', () => {expect(res._body).toContain('<meta property="og:url" content="https://three.ws/api/ar?src=');});- it('honours the forwarded host so the page links back to the origin that served it', async () => {+ it('honours the forwarded host so the interstitial links back to the origin that served it', async () => {const req = mkReq({ ua: UA.desktop, headers: { 'x-forwarded-host': 'staging.three.ws' } });const res = mkRes();await handler(req, res);- expect(res._body).toContain('https://staging.three.ws/viewer?src=');+ expect(redirectTargetOf(res._body).startsWith('https://staging.three.ws/ar/view?src=')).toBe(true);expect(res._body).toContain('https://staging.three.ws/api/render/glb?');});++ it('is not indexed and never cached (the content is UA-specific)', async () => {+ const res = await get({ ua: UA.iphone });+ expect(res._body).toContain('<meta name="robots" content="noindex"/>');+ expect(res._h['cache-control']).toBe('no-store');+ });});describe('GET /api/ar - kind=avatar IRL handoff', () => {- it('keeps Android on the launch page so the living-agent path stays visible', async () => {+ it('sends Android to the /ar/view interstitial too, so the living-agent path stays visible', async () => {const res = await get({ ua: UA.android, kind: 'avatar' });expect(res.statusCode).toBe(200);- expect(res._h.location).toBeUndefined();- expect(res._body).toContain(`href="https://three.ws/irl?avatar=${encodeURIComponent(GLB)}"`);- expect(res._body).toContain('Bring it to life');- // Static placement stays available alongside the living handoff.- expect(res._body).toContain('Place in your space');+ const target = new URL(redirectTargetOf(res._body));+ expect(target.pathname).toBe('/ar/view');+ expect(target.searchParams.get('irl')).toBe(`https://three.ws/irl?avatar=${encodeURIComponent(GLB)}`);+ expect(res._body).toContain('living AI agent');});- it('offers the IRL handoff on iOS and desktop too', async () => {+ it('carries the same irl handoff for iOS and desktop', async () => {for (const ua of [UA.iphone, UA.desktop]) {const res = await get({ ua, kind: 'avatar' });expect(res.statusCode).toBe(200);- expect(res._body).toContain('/irl?avatar=');- expect(res._body).toContain('This is a living agent.');+ expect(redirectTargetOf(res._body)).toContain('irl=');}});- it('a static model gets no IRL link at all', async () => {+ it('a static model interstitial carries no irl param and the static-model description', async () => {const res = await get({ ua: UA.desktop });- expect(res._body).not.toContain('/irl?avatar=');- expect(res._body).not.toContain('Bring it to life');+ expect(redirectTargetOf(res._body)).not.toContain('irl=');+ expect(res._body).not.toContain('living AI agent');});});@@ -171,8 +192,7 @@ describe('GET /api/ar - designed error page for bad input', () => {expect(res._body).toContain(c.message);// The error state is actionable: it offers the way forward.expect(res._body).toContain('Create a 3D model');- // A rejected asset never reaches the page.- expect(res._body).not.toContain('<model-viewer');+ expect(res._h.location).toBeUndefined();});}@@ -181,15 +201,15 @@ describe('GET /api/ar - designed error page for bad input', () => {expect(bad.statusCode).toBe(400);const ok = await get({ src: 'https://cdn.example/scene.gltf?v=2', ua: UA.desktop });expect(ok.statusCode).toBe(200);- expect(ok._body).toContain('https://cdn.example/scene.gltf?v=2');+ expect(redirectTargetOf(ok._body)).toContain(encodeURIComponent('https://cdn.example/scene.gltf?v=2'));});});describe('GET /api/ar - caching and CORS headers', () => {- it('varies the cached page on user-agent so an Android phone cannot be served a desktop page', async () => {+ it('varies the response on user-agent so a CDN never serves one device the wrong content', async () => {const res = await get({ ua: UA.desktop });expect(res._h.vary).toBe('user-agent');- expect(res._h['cache-control']).toBe('public, max-age=60, s-maxage=600');+ expect(res._h['cache-control']).toBe('no-store');});it('answers the CORS preflight with 204 and no body', async () => {@@ -202,6 +222,6 @@ describe('GET /api/ar - caching and CORS headers', () => {it('treats an absent User-Agent as desktop rather than failing', async () => {const res = await get({ ua: '' });expect(res.statusCode).toBe(200);- expect(res._body).toContain('<model-viewer');+ expect(redirectTargetOf(res._body)).toContain('/ar/view?src=');});});diff --git a/tests/ar-export.test.js b/tests/ar-export.test.jsindex 18845bafb..0c3320432 100644--- a/tests/ar-export.test.js+++ b/tests/ar-export.test.js@@ -7,6 +7,7 @@ import {buildViewerUrl,buildArLaunchUrl,buildIrlUrl,+ buildArViewUrl,planArLaunch,} from '../api/_lib/ar-launch.js';import { toolDefs as arDefs } from '../api/_mcp3d/tools/ar.js';@@ -27,13 +28,13 @@ describe('detectArTarget', () => {});});-describe('assertArAssetUrl — boundary rejection', () => {+describe('assertArAssetUrl: boundary rejection', () => {it('accepts an https .glb / .gltf', () => {expect(assertArAssetUrl(GLB)).toBe(GLB);expect(assertArAssetUrl('https://x.io/a.gltf')).toBe('https://x.io/a.gltf');expect(assertArAssetUrl('https://x.io/a.glb?token=1')).toContain('.glb');});- it('rejects non-https, non-glb, and garbage — with a coded error, not a crash', () => {+ it('rejects non-https, non-glb, and garbage: a coded error, not a crash', () => {expect(() => assertArAssetUrl('http://x.io/a.glb')).toThrow(/https/i);expect(() => assertArAssetUrl('https://x.io/a.png')).toThrow(/\.glb/i);expect(() => assertArAssetUrl('not a url')).toThrow(/valid https url/i);@@ -56,30 +57,44 @@ describe('buildSceneViewerUrl', () => {});});-describe('planArLaunch — device routing', () => {+describe('buildArViewUrl', () => {+ it('builds the /ar/view URL with src and title', () => {+ const u = buildArViewUrl('https://three.ws', GLB, 'Robot');+ expect(u).toBe(`https://three.ws/ar/view?src=${encodeURIComponent(GLB)}&title=Robot`);+ });+ it('adds irl only when passed', () => {+ expect(buildArViewUrl('https://three.ws', GLB)).not.toContain('irl=');+ const u = buildArViewUrl('https://three.ws', GLB, 'Scout', { irlUrl: 'https://three.ws/irl?avatar=x' });+ expect(u).toContain(`irl=${encodeURIComponent('https://three.ws/irl?avatar=x')}`);+ });+});++describe('planArLaunch: device routing', () => {it('Android → redirect to Scene Viewer', () => {const p = planArLaunch({ glbUrl: GLB, userAgent: ANDROID, origin: 'https://three.ws' });expect(p.target).toBe('android');expect(p.action).toBe('redirect');expect(p.url).toContain('scene-viewer');});- it('iOS → serve the launch page', () => {+ it('iOS → redirect to /ar/view, the page that generates a real ios-src USDZ', () => {const p = planArLaunch({ glbUrl: GLB, userAgent: IOS, origin: 'https://three.ws' });expect(p.target).toBe('ios');- expect(p.action).toBe('page');+ expect(p.action).toBe('redirect');+ expect(p.url).toContain('/ar/view?src=');expect(p.viewerUrl).toContain('/viewer?src=');});- it('desktop → serve the launch page (WebGL fallback)', () => {+ it('desktop → redirect to /ar/view too (its own WebGL fallback handles no-AR-hardware)', () => {const p = planArLaunch({ glbUrl: GLB, userAgent: DESKTOP, origin: 'https://three.ws' });expect(p.target).toBe('desktop');- expect(p.action).toBe('page');+ expect(p.action).toBe('redirect');+ expect(p.url).toContain('/ar/view?src=');});it('bad input throws at the boundary (handled by the endpoint)', () => {expect(() => planArLaunch({ glbUrl: 'http://x/a.glb', userAgent: IOS, origin: 'https://three.ws' })).toThrow();});});-describe('GET /api/ar — response caching is UA-safe', () => {+describe('GET /api/ar: response caching and redirect targets', () => {function makeReq(ua) {return {method: 'GET',@@ -106,13 +121,15 @@ describe('GET /api/ar — response caching is UA-safe', () => {};}- it('the launch page varies on User-Agent so a CDN never serves a desktop page to a phone', async () => {+ it('iOS gets a 200 interstitial that redirects to /ar/view, never cached (the content is UA-specific)', async () => {const { default: handler } = await import('../api/ar.js');const res = makeRes();await handler(makeReq(IOS), res);expect(res.statusCode).toBe(200);+ expect(res._body).toContain('/ar/view?src=');+ expect(res._body).toContain('title=Robot');expect(res.getHeader('vary')).toMatch(/user-agent/i);- expect(res.getHeader('cache-control')).toContain('public');+ expect(res.getHeader('cache-control')).toBe('no-store');});it('the Android Scene Viewer redirect stays uncached (no-store)', async () => {@@ -124,36 +141,12 @@ describe('GET /api/ar — response caching is UA-safe', () => {expect(res.getHeader('cache-control')).toBe('no-store');});- it('the launch page unfurls as a share card: og/twitter meta with a real model render', async () => {- const { default: handler } = await import('../api/ar.js');- const res = makeRes();- await handler(makeReq(IOS), res);- const html = res._body;- expect(html).toContain('og:title');- expect(html).toContain('Place Robot in your room');- expect(html).toContain('summary_large_image');- // og:image is the GET renderer pointed at THIS model, sized for unfurls.- expect(html).toContain('/api/render/glb?glbUrl=' + encodeURIComponent(GLB));- expect(html).toContain('width=1200&height=630');- });-- it('the launch page shows the model name and invites the viewer to create their own', async () => {+ it('desktop also gets the /ar/view interstitial', async () => {const { default: handler } = await import('../api/ar.js');const res = makeRes();await handler(makeReq(DESKTOP), res);- const html = res._body;- expect(html).toContain('class="name">Robot<');- expect(html).toContain('Create your own');- expect(html).toContain('Loading your model');- });-- it('embeds THIS GLB in the launch page <model-viewer src>', async () => {- const { default: handler } = await import('../api/ar.js');- const res = makeRes();- await handler(makeReq(IOS), res);- const html = res._body;- expect(html).toContain(`src="${GLB}"`);- expect(html).toContain('ar-modes="webxr scene-viewer quick-look"');+ expect(res.statusCode).toBe(200);+ expect(res._body).toContain('/ar/view?src=');});it('a missing/invalid src is rejected at the boundary with a designed 400 error page, not a crash', async () => {@@ -164,7 +157,6 @@ describe('GET /api/ar — response caching is UA-safe', () => {expect(missing.statusCode).toBe(400);expect(missing.getHeader('cache-control')).toBe('no-store');expect(missing._body).toContain("Can't open this in AR");- expect(missing._body).not.toContain('<model-viewer');// Non-https src.const insecure = makeRes();await handler(@@ -175,56 +167,17 @@ describe('GET /api/ar — response caching is UA-safe', () => {expect(insecure._body).toContain("Can't open this in AR");});- it('kind=avatar serves the living-agent launch page with a "Bring it to life" IRL handoff (Android included)', async () => {+ it('kind=avatar sends everyone (Android included) to the /ar/view interstitial carrying the irl handoff', async () => {const { default: handler } = await import('../api/ar.js');const res = makeRes();- // Android would normally 302 to Scene Viewer, but an avatar always gets the page.+ // Android would normally 302 to Scene Viewer, but an avatar always goes to /ar/view.await handler({ method: 'GET', url: `/api/ar?src=${encodeURIComponent(GLB)}&title=Scout&kind=avatar`, headers: { 'user-agent': ANDROID, host: 'three.ws' } },res,);expect(res.statusCode).toBe(200);- expect(res._body).toContain('Bring it to life');- expect(res._body).toContain('/irl?avatar=' + encodeURIComponent(GLB));- });-});--describe('GET /api/render/glb — URL-addressable render (share cards)', () => {- function makeReq(url) {- return { method: 'GET', url, headers: { host: 'three.ws' } };- }- function makeRes() {- return {- statusCode: 200,- _h: {},- writableEnded: false,- headersSent: false,- setHeader(k, v) {- this._h[k.toLowerCase()] = v;- },- getHeader(k) {- return this._h[k.toLowerCase()];- },- end(body) {- this._body = body;- this.writableEnded = true;- },- };- }-- it('400s a GET without glbUrl (no chromium spin-up on junk)', async () => {- const { default: handler } = await import('../api/render/glb.js');- const res = makeRes();- await handler(makeReq('/api/render/glb'), res);- expect(res.statusCode).toBe(400);- expect(JSON.parse(res._body).error).toBe('bad_request');- });-- it('400s a GET pointing at a private address (SSRF guard holds on the GET path)', async () => {- const { default: handler } = await import('../api/render/glb.js');- const res = makeRes();- await handler(makeReq('/api/render/glb?glbUrl=' + encodeURIComponent('https://10.0.0.8/a.glb')), res);- expect(res.statusCode).toBe(400);+ expect(res._body).toContain('/ar/view?src=');+ expect(res._body).toContain(`irl=${encodeURIComponent(`https://three.ws/irl?avatar=${encodeURIComponent(GLB)}`)}`);});});@@ -299,36 +252,34 @@ describe('live (avatar) AR lane: the agent-economy bridge into physical space',expect(buildArLaunchUrl('https://three.ws', GLB)).not.toContain('kind=avatar');});- it('planArLaunch live: Android gets the page (never a blind Scene Viewer redirect), with irlUrl', () => {+ it('planArLaunch live: Android goes to /ar/view (never a blind Scene Viewer redirect), with irlUrl', () => {const p = planArLaunch({ glbUrl: GLB, userAgent: ANDROID, origin: 'https://three.ws', live: true });- expect(p.action).toBe('page');+ expect(p.action).toBe('redirect');+ expect(p.url).toContain('/ar/view?src=');expect(p.irlUrl).toContain('/irl?avatar=');});- it('planArLaunch live: iOS and desktop carry irlUrl on the page plan', () => {+ it('planArLaunch live: iOS and desktop carry irlUrl into the /ar/view redirect', () => {for (const ua of [IOS, DESKTOP]) {const p = planArLaunch({ glbUrl: GLB, userAgent: ua, origin: 'https://three.ws', live: true });- expect(p.action).toBe('page');- expect(p.irlUrl).toContain('/irl?avatar=');+ expect(p.action).toBe('redirect');+ expect(p.url).toContain(`irl=${encodeURIComponent(p.irlUrl)}`);}});- it('planArLaunch static: Android redirect unchanged, no irlUrl anywhere', () => {+ it('planArLaunch static: Android still goes straight to Scene Viewer, no irlUrl anywhere', () => {const android = planArLaunch({ glbUrl: GLB, userAgent: ANDROID, origin: 'https://three.ws' });expect(android.action).toBe('redirect');+ expect(android.url).toContain('scene-viewer');expect(android.irlUrl).toBe('');const ios = planArLaunch({ glbUrl: GLB, userAgent: IOS, origin: 'https://three.ws' });expect(ios.irlUrl).toBe('');});});-describe('GET /api/ar?kind=avatar: living-agent launch page', () => {- function makeReq(ua, extra = '') {- return {- method: 'GET',- url: `/api/ar?src=${encodeURIComponent(GLB)}&title=Scout${extra}`,- headers: { 'user-agent': ua, host: 'three.ws' },- };+describe('GET /api/render/glb: URL-addressable render (share cards)', () => {+ function makeReq(url) {+ return { method: 'GET', url, headers: { host: 'three.ws' } };}function makeRes() {return {@@ -349,28 +300,18 @@ describe('GET /api/ar?kind=avatar: living-agent launch page', () => {};}- it('an avatar launch serves the page on Android with the Bring-it-to-life handoff', async () => {- const { default: handler } = await import('../api/ar.js');- const res = makeRes();- await handler(makeReq(ANDROID, '&kind=avatar'), res);- expect(res.statusCode).toBe(200);- expect(res._body).toContain('Bring it to life');- expect(res._body).toContain('/irl?avatar=');- });-- it('an avatar launch on iOS offers both the living handoff and static placement', async () => {- const { default: handler } = await import('../api/ar.js');+ it('400s a GET without glbUrl (no chromium spin-up on junk)', async () => {+ const { default: handler } = await import('../api/render/glb.js');const res = makeRes();- await handler(makeReq(IOS, '&kind=avatar'), res);- expect(res._body).toContain('Bring it to life');- expect(res._body).toContain('Place in your space');+ await handler(makeReq('/api/render/glb'), res);+ expect(res.statusCode).toBe(400);+ expect(JSON.parse(res._body).error).toBe('bad_request');});- it('a static model launch page has no living-agent surface', async () => {- const { default: handler } = await import('../api/ar.js');+ it('400s a GET pointing at a private address (SSRF guard holds on the GET path)', async () => {+ const { default: handler } = await import('../api/render/glb.js');const res = makeRes();- await handler(makeReq(IOS), res);- expect(res._body).not.toContain('Bring it to life');- expect(res._body).not.toContain('/irl?avatar=');+ await handler(makeReq('/api/render/glb?glbUrl=' + encodeURIComponent('https://10.0.0.8/a.glb')), res);+ expect(res.statusCode).toBe(400);});});diff --git a/vercel.json b/vercel.jsonindex 5acf4cf9b..4047b0055 100644--- a/vercel.json+++ b/vercel.json@@ -1549,6 +1549,13 @@},"dest": "/ar-studio.html"},+ {+ "src": "/ar/view/?",+ "headers": {+ "permissions-policy": "xr-spatial-tracking=*, camera=(self), microphone=()"+ },+ "dest": "/ar-view.html"+ },{"src": "/daily/?","headers": {diff --git a/vite.config.js b/vite.config.jsindex 22de1bc44..fc4e8f41a 100644--- a/vite.config.js+++ b/vite.config.js@@ -786,6 +786,7 @@ const appConfig = {irl: resolve(__dirname, 'pages/irl.html'),daily: resolve(__dirname, 'pages/daily.html'),'ar-studio': resolve(__dirname, 'pages/ar-studio.html'),+ 'ar-view': resolve(__dirname, 'pages/ar-view.html'),'irl-privacy': resolve(__dirname, 'pages/irl-privacy.html'),'world-lines': resolve(__dirname, 'pages/world-lines.html'),communities: resolve(__dirname, 'pages/communities.html'),@@ -1476,6 +1477,8 @@ const appConfig = {'/irl/': resolve(root, 'pages/irl.html'),'/ar/studio': resolve(root, 'pages/ar-studio.html'),'/ar/studio/': resolve(root, 'pages/ar-studio.html'),+ '/ar/view': resolve(root, 'pages/ar-view.html'),+ '/ar/view/': resolve(root, 'pages/ar-view.html'),// AR Forge lives in public/ (no bundler), so dev must map /ar the// same way vercel.json does or the route 404s only in dev.'/ar': resolve(root, 'public/ar-forge.html'),