Skip to content

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

docs(media): captured screenshots and figures across docs, tutorials and cookbook

nirholasc03c100f2075
diff --git a/data/doc-media.json b/data/doc-media.json
index 6cbcde005..fa230a834 100644
--- a/data/doc-media.json
+++ b/data/doc-media.json
@@ -136,6 +136,46 @@
"settle": 10000,
"motion": { "seconds": 3, "fps": 12 },
"usedBy": ["tutorials/explore-docs-world"]
+ },
+ {
+ "id": "sign-api-console",
+ "url": "/sign-language",
+ "alt": "The sign API console on three.ws: the phrase \"happy to meet you\" compiled into four timeline blocks, happy, to, meet, you, with the spelled word broken into its letters, above the duration, signed and fingerspelled counts",
+ "caption": "One real request to /api/sign, drawn as the performance it returns. Filled blocks are lexical signs; the outlined one is fingerspelled, letter by letter.",
+ "clip": "#sl-api",
+ "settle": 6000,
+ "actions": [
+ { "type": "hide", "selectors": ["#tws-corner-stack"] },
+ { "type": "scroll", "selector": "#sl-api" },
+ { "type": "waitFor", "selector": ".sl-api-seg", "timeout": 30000 }
+ ],
+ "usedBy": ["sign-language"]
+ },
+ {
+ "id": "sign-language-hero",
+ "url": "/sign-language",
+ "alt": "A rigged 3D avatar mid-sign on the three.ws sign-language page, beside the phrase input and the speed and signing-hand controls",
+ "caption": "Type anything: the avatar signs the words it has signs for and spells the rest.",
+ "clip": ".sl-hero",
+ "settle": 9000,
+ "actions": [
+ { "type": "hide", "selectors": ["#tws-corner-stack"] },
+ { "type": "waitFor", "selector": "#sl-stage canvas", "timeout": 40000 }
+ ],
+ "usedBy": ["sign-language"]
+ },
+ {
+ "id": "asl-alphabet-hero",
+ "url": "/asl-alphabet",
+ "alt": "A rigged 3D avatar forming a letter of the American manual alphabet, beside that letter's description and the speed and signing-hand controls",
+ "caption": "Every letter of the manual alphabet on a hand you can turn around.",
+ "clip": ".aa-hero",
+ "settle": 9000,
+ "actions": [
+ { "type": "hide", "selectors": ["#tws-corner-stack"] },
+ { "type": "waitFor", "selector": "#aa-stage canvas", "timeout": 40000 }
+ ],
+ "usedBy": ["sign-language"]
}
]
}
diff --git a/data/guide-shots.capture.json b/data/guide-shots.capture.json
index 6ae4a67e8..1616bc510 100644
--- a/data/guide-shots.capture.json
+++ b/data/guide-shots.capture.json
@@ -1,7 +1,7 @@
{
"base": "https://three.ws",
- "shots": 11,
- "failed": 0,
+ "shots": 3,
+ "failed": 1,
"results": [
{
"id": "forge-compose",
@@ -12,25 +12,10 @@
"url": "/forge",
"path": "/docs/img/guides/forge-compose.png",
"ok": true,
- "bytes": 251193,
+ "bytes": 251070,
"width": 484,
"height": 686,
- "ms": 21953,
- "pageErrors": []
- },
- {
- "id": "forge-quality-tiers",
- "tutorials": [
- "text-to-3d",
- "nvidia-3d-free"
- ],
- "url": "/forge",
- "path": "/docs/img/guides/forge-quality-tiers.png",
- "ok": true,
- "bytes": 109172,
- "width": 442,
- "height": 270,
- "ms": 13636,
+ "ms": 62277,
"pageErrors": []
},
{
@@ -41,96 +26,9 @@
],
"url": "/forge",
"path": "/docs/img/guides/forge-stage.png",
- "ok": true,
- "bytes": 61648,
- "width": 875,
- "height": 732,
- "ms": 10671,
- "pageErrors": []
- },
- {
- "id": "forge-photo-mode",
- "tutorials": [
- "image-to-3d"
- ],
- "url": "/forge",
- "path": "/docs/img/guides/forge-photo-mode.png",
- "ok": true,
- "bytes": 234415,
- "width": 484,
- "height": 924,
- "ms": 11387,
- "pageErrors": []
- },
- {
- "id": "forge-example-chips",
- "tutorials": [
- "prompts-for-3d"
- ],
- "url": "/forge",
- "path": "/docs/img/guides/forge-example-chips.png",
- "ok": true,
- "bytes": 42587,
- "width": 472,
- "height": 131,
- "ms": 7448,
- "pageErrors": []
- },
- {
- "id": "create-intent-hub",
- "tutorials": [
- "getting-started"
- ],
- "url": "/create",
- "path": "/docs/img/guides/create-intent-hub.png",
- "ok": true,
- "bytes": 471808,
- "width": 920,
- "height": 1508,
- "ms": 27387,
- "pageErrors": []
- },
- {
- "id": "studio-workbench",
- "tutorials": [
- "swap-avatar-in-studio"
- ],
- "url": "/studio",
- "path": "/docs/img/guides/studio-workbench.png",
- "ok": true,
- "bytes": 742893,
- "width": 1440,
- "height": 1404,
- "ms": 27228,
- "pageErrors": []
- },
- {
- "id": "app-chat-dock",
- "tutorials": [
- "add-a-3d-assistant"
- ],
- "url": "/app",
- "path": "/docs/img/guides/app-chat-dock.png",
- "ok": true,
- "bytes": 127807,
- "width": 676,
- "height": 131,
- "ms": 88600,
- "pageErrors": []
- },
- {
- "id": "app-action-bar",
- "tutorials": [
- "animate-your-agent"
- ],
- "url": "/app",
- "path": "/docs/img/guides/app-action-bar.png",
- "ok": true,
- "bytes": 62743,
- "width": 696,
- "height": 80,
- "ms": 107857,
- "pageErrors": []
+ "ok": false,
+ "error": "page.screenshot: Timeout 90000ms exceeded.\nCall log:\n - taking page screenshot\n - disabled all CSS animations\n - waiting for fonts to load...\n - fonts loaded\n",
+ "ms": 115255
},
{
"id": "docs-sidebar",
@@ -140,24 +38,10 @@
"url": "/docs",
"path": "/docs/img/guides/docs-sidebar.png",
"ok": true,
- "bytes": 133786,
+ "bytes": 127676,
"width": 296,
"height": 876,
- "ms": 18462,
- "pageErrors": []
- },
- {
- "id": "agents-index",
- "tutorials": [
- "share-your-agent"
- ],
- "url": "/agents",
- "path": "/docs/img/guides/agents-index.png",
- "ok": true,
- "bytes": 310235,
- "width": 1200,
- "height": 360,
- "ms": 9609,
+ "ms": 57545,
"pageErrors": []
}
]
diff --git a/data/guide-shots.json b/data/guide-shots.json
index 1abfd3090..cbf9c3cd5 100644
--- a/data/guide-shots.json
+++ b/data/guide-shots.json
@@ -1,7 +1,10 @@
{
"_readme": "Every screenshot in docs/tutorials/*.md is declared here and captured from the live product by scripts/capture-guide-shots.mjs. Add a shot, run the capture, run sync:guide-media. Never hand-place an image in a tutorial: check:guide-media fails on anything this file does not describe. See docs/guide-media.md.",
"defaults": {
- "viewport": { "width": 1440, "height": 900 },
+ "viewport": {
+ "width": 1440,
+ "height": 900
+ },
"scale": 2,
"settle": 4000
},
@@ -12,17 +15,38 @@
"clip": "form.composer",
"pad": 22,
"callouts": [
- { "selector": "#tab-text", "note": "**Describe it** is the text-to-3D tab, and the one the Forge opens on." },
- { "selector": "#prompt", "note": "The prompt box. One object, one material, no scenery." },
- { "selector": "#surprise", "note": "**Surprise me** fills the box with a known-good prompt; **Enhance** rewrites yours into a richer one." },
- { "selector": "#tier", "note": "Quality tier. Draft and Standard are free for everyone." },
- { "selector": "#generate", "note": "Generate. Results stream into the stage on the right." }
+ {
+ "selector": "#tab-text",
+ "note": "**Describe it** is the text-to-3D tab, and the one the Forge opens on."
+ },
+ {
+ "selector": "#prompt",
+ "note": "The prompt box. One object, one material, no scenery."
+ },
+ {
+ "selector": "#surprise",
+ "note": "**Surprise me** fills the box with a known-good prompt; **Enhance** rewrites yours into a richer one."
+ },
+ {
+ "selector": "#tier",
+ "note": "Quality tier. Draft and Standard are free for everyone."
+ },
+ {
+ "selector": "#generate",
+ "note": "Generate. Results stream into the stage on the right."
+ }
],
"alt": "The three.ws Forge compose panel, with the Describe it tab, prompt box, Surprise me and Enhance buttons, the quality tier row, and the Generate button each marked with a numbered callout.",
"caption": "The Forge compose panel. Everything you need for a text-to-3D run is in this one column.",
"placements": [
- { "tutorial": "text-to-3d", "anchor": "Step 2 — Describe the object" },
- { "tutorial": "nvidia-3d-free", "anchor": "Step 2 — Describe one object" }
+ {
+ "tutorial": "text-to-3d",
+ "anchor": "Step 2: Describe the object"
+ },
+ {
+ "tutorial": "nvidia-3d-free",
+ "anchor": "Step 2: Describe one object"
+ }
]
},
{
@@ -31,43 +55,105 @@
"clip": ".forge-quality",
"pad": 18,
"callouts": [
- { "selector": "#tier", "note": "Draft, Standard and High. Start on Draft or Standard, then re-run the winning prompt on High." },
- { "selector": ".fq-row--engine", "note": "The engine row. Lanes marked FREE need no key and no account." }
+ {
+ "selector": "#tier",
+ "note": "Draft, Standard and High. Start on Draft or Standard, then re-run the winning prompt on High."
+ },
+ {
+ "selector": ".fq-row--engine",
+ "note": "The engine row. Lanes marked FREE need no key and no account."
+ }
],
"alt": "The Forge quality panel showing the Draft, Standard and High tier buttons above a row of generation engines, several labelled FREE, with numbered callouts on the tier row and the engine row.",
"caption": "Tier and engine sit together: tier decides how much detail you get, engine decides who renders it.",
"placements": [
- { "tutorial": "text-to-3d", "anchor": "Step 3 — Pick a quality tier" },
- { "tutorial": "nvidia-3d-free", "anchor": "Step 3 — Pick a tier (both free lanes)" }
+ {
+ "tutorial": "text-to-3d",
+ "anchor": "Step 3: Pick a quality tier"
+ },
+ {
+ "tutorial": "nvidia-3d-free",
+ "anchor": "Step 3: Pick a tier (both free lanes)"
+ }
]
},
{
"id": "forge-stage",
"url": "/forge",
- "clip": "section.stage",
- "pad": 16,
- "alt": "The Forge stage panel, the large viewport where a finished 3D model is displayed and can be orbited.",
- "caption": "The stage. Finished models land here and can be orbited, zoomed and downloaded without leaving the page.",
+ "prep": [
+ {
+ "fill": {
+ "selector": "#prompt",
+ "value": "a bright red fire hydrant"
+ }
+ },
+ {
+ "click": "#generate"
+ },
+ {
+ "waitFor": "#viewer[src]",
+ "timeout": 300000
+ },
+ {
+ "wait": 6000
+ }
+ ],
+ "prepSettle": 3000,
+ "clip": "#viewer-shell",
+ "pad": 14,
+ "alt": "The Forge stage after a run, showing a generated bright red fire hydrant rendered in the 3D viewer, with a callout on the viewer.",
+ "caption": "The stage after a run. A real generation from the prompt above: drag to orbit it, scroll to zoom, download it without leaving the page.",
"placements": [
- { "tutorial": "text-to-3d", "anchor": "Step 5 — Inspect your model" },
- { "tutorial": "nvidia-3d-free", "anchor": "Step 4 — Generate and inspect" }
+ {
+ "tutorial": "text-to-3d",
+ "anchor": "Step 5: Inspect your model"
+ },
+ {
+ "tutorial": "nvidia-3d-free",
+ "anchor": "Step 4: Generate and inspect"
+ }
+ ],
+ "callouts": [
+ {
+ "selector": "#viewer",
+ "note": "Drag to orbit, scroll to zoom. This is the live mesh, not a rendered preview image."
+ }
]
},
{
"id": "forge-photo-mode",
"url": "/forge",
- "prep": [{ "click": "#tab-image" }, { "wait": 1200 }],
+ "prep": [
+ {
+ "click": "#tab-image"
+ },
+ {
+ "wait": 1200
+ }
+ ],
"clip": "form.composer",
"pad": 22,
"callouts": [
- { "selector": "#tab-image", "note": "**From photos** switches the Forge into photo-to-3D mode." },
- { "selector": "#views-grid", "note": "Drop up to six photos of the same object here, taken from different angles." },
- { "selector": "#views-counter", "note": "The view counter. More angles means a more complete reconstruction." }
+ {
+ "selector": "#tab-image",
+ "note": "**From photos** switches the Forge into photo-to-3D mode."
+ },
+ {
+ "selector": "#views-grid",
+ "note": "Drop up to six photos of the same object here, taken from different angles."
+ },
+ {
+ "selector": "#views-counter",
+ "note": "The view counter. More angles means a more complete reconstruction."
+ }
],
"alt": "The Forge in photo mode, showing the From photos tab selected, an empty grid of reference view slots, and a view counter, each marked with a numbered callout.",
"caption": "Photo mode. The same panel, swapped from a prompt box to a reference-photo grid.",
"placements": [
- { "tutorial": "image-to-3d", "anchor": "Step 2 — Open the Forge in photo mode" }
+ {
+ "tutorial": "image-to-3d",
+ "anchor": "Step 2: Open the Forge in photo mode"
+ }
]
},
{
@@ -76,12 +162,18 @@
"clip": "#examples",
"pad": 16,
"callouts": [
- { "selector": "#chips-more", "note": "Expands the list to the full set of worked example prompts." }
+ {
+ "selector": "#chips-more",
+ "note": "Expands the list to the full set of worked example prompts."
+ }
],
"alt": "A row of example prompt chips beneath the Forge prompt box, each one a complete ready-to-run prompt, with a callout on the button that reveals more.",
"caption": "Example chips are complete prompts, not keywords. Tap one to load it, then edit a word or two.",
"placements": [
- { "tutorial": "prompts-for-3d", "anchor": "The four rules" }
+ {
+ "tutorial": "prompts-for-3d",
+ "anchor": "The four rules"
+ }
]
},
{
@@ -90,15 +182,30 @@
"clip": "#avatar-options",
"pad": 20,
"callouts": [
- { "selector": "#card-default-editor", "note": "Start from a ready-made avatar. Fastest route to something on screen." },
- { "selector": "#card-prompt", "note": "Describe the character you want and have it generated." },
- { "selector": "#card-selfie", "note": "Turn a selfie into an avatar." },
- { "selector": "#card-upload-glb", "note": "Bring a GLB you already have." }
+ {
+ "selector": "#card-default-editor",
+ "note": "Start from a ready-made avatar. Fastest route to something on screen."
+ },
+ {
+ "selector": "#card-prompt",
+ "note": "Describe the character you want and have it generated."
+ },
+ {
+ "selector": "#card-selfie",
+ "note": "Turn a selfie into an avatar."
+ },
+ {
+ "selector": "#card-upload-glb",
+ "note": "Bring a GLB you already have."
+ }
],
"alt": "The three.ws create page showing the avatar option cards: start from a default avatar, describe one, use a selfie, or upload a GLB, each marked with a numbered callout.",
"caption": "Every route to an avatar starts here. They all end in the same editor, so the choice is reversible.",
"placements": [
- { "tutorial": "getting-started", "anchor": "Step 1: Open the create flow" }
+ {
+ "tutorial": "getting-started",
+ "anchor": "Step 1: Open the create flow"
+ }
]
},
{
@@ -107,15 +214,30 @@
"clip": "main.studio-layout",
"pad": 14,
"callouts": [
- { "selector": "#avatar-list", "note": "The avatar gallery. Pick a body without leaving the page." },
- { "selector": "#preview-frame", "note": "Live preview. It renders the real widget, not a picture of one." },
- { "selector": "#config-form", "note": "Widget settings. Every change re-renders the preview immediately." },
- { "selector": "#generate-btn", "note": "Produces the embed snippet to paste into your site." }
+ {
+ "selector": "#avatar-list",
+ "note": "The avatar gallery. Pick a body without leaving the page."
+ },
+ {
+ "selector": "#preview-frame",
+ "note": "Live preview. It renders the real widget, not a picture of one."
+ },
+ {
+ "selector": "#config-form",
+ "note": "Widget settings. Every change re-renders the preview immediately."
+ },
+ {
+ "selector": "#generate-btn",
+ "note": "Produces the embed snippet to paste into your site."
+ }
],
"alt": "The three.ws Widget Studio, a three-column workbench with an avatar gallery on the left, a live widget preview in the middle, and a configuration form on the right, with numbered callouts on each.",
"caption": "Widget Studio: pick on the left, watch in the middle, configure on the right, and leave with an embed snippet.",
"placements": [
- { "tutorial": "swap-avatar-in-studio", "anchor": "Step 1 — Open Widget Studio" }
+ {
+ "tutorial": "swap-avatar-in-studio",
+ "anchor": "Step 1: Open Widget Studio"
+ }
]
},
{
@@ -124,13 +246,22 @@
"clip": "#nxt-chat-dock",
"pad": 18,
"callouts": [
- { "selector": "#nxt-chat-input", "note": "Talk to the agent in plain language. It answers in character and moves while it does." },
- { "selector": "#nxt-chat-chips", "note": "Suggested openers, so an empty input is never a dead end." }
+ {
+ "selector": "#nxt-chat-input",
+ "note": "Talk to the agent in plain language. It answers in character and moves while it does."
+ },
+ {
+ "selector": "#nxt-chat-chips",
+ "note": "Suggested openers, so an empty input is never a dead end."
+ }
],
"alt": "The chat dock in the three.ws viewer, with a message input and a row of suggested opening prompts, each marked with a numbered callout.",
"caption": "The chat dock. Suggested prompts mean a first-time visitor never has to guess what to type.",
"placements": [
- { "tutorial": "add-a-3d-assistant", "anchor": "Step 1: the one-tag embed" }
+ {
+ "tutorial": "add-a-3d-assistant",
+ "anchor": "Step 1: the one-tag embed"
+ }
]
},
{
@@ -139,14 +270,26 @@
"clip": ".nxt-action-bar--secondary",
"pad": 18,
"callouts": [
- { "selector": "#nxt-anim-btn", "note": "Browse the animation library and play any clip on the current avatar. Keyboard: `A`." },
- { "selector": "#nxt-avatar-btn", "note": "Swap the avatar. The scene keeps its camera and backdrop." },
- { "selector": "#nxt-backdrop-btn", "note": "Change the backdrop behind the agent." }
+ {
+ "selector": "#nxt-anim-btn",
+ "note": "Browse the animation library and play any clip on the current avatar. Keyboard: `A`."
+ },
+ {
+ "selector": "#nxt-avatar-btn",
+ "note": "Swap the avatar. The scene keeps its camera and backdrop."
+ },
+ {
+ "selector": "#nxt-backdrop-btn",
+ "note": "Change the backdrop behind the agent."
+ }
],
"alt": "The secondary action bar in the three.ws viewer with Animations, Avatar and Backdrop buttons, each marked with a numbered callout.",
"caption": "The action bar. Animations, avatar and backdrop are the three things worth changing first.",
"placements": [
- { "tutorial": "animate-your-agent", "anchor": "See the whole vocabulary" }
+ {
+ "tutorial": "animate-your-agent",
+ "anchor": "See the whole vocabulary"
+ }
]
},
{
@@ -155,12 +298,18 @@
"clip": "#sidebar",
"pad": 14,
"callouts": [
- { "selector": "#search-input", "note": "Search filters the whole documentation tree as you type." }
+ {
+ "selector": "#search-input",
+ "note": "Search filters the whole documentation tree as you type."
+ }
],
"alt": "The three.ws documentation sidebar, with a search box above a long navigation tree of sections, and a callout on the search box.",
"caption": "The docs sidebar. Searching filters the tree in place rather than sending you to a results page.",
"placements": [
- { "tutorial": "explore-docs-world", "anchor": "Use the index instead of walking" }
+ {
+ "tutorial": "explore-docs-world",
+ "anchor": "Use the index instead of walking"
+ }
]
},
{
@@ -169,13 +318,22 @@
"clip": "section.hero",
"pad": 18,
"callouts": [
- { "selector": "#ag-search", "note": "Search across every published agent." },
- { "selector": "#ag-sort", "note": "Reorder the index. Useful for finding recently published agents." }
+ {
+ "selector": "#ag-search",
+ "note": "Search across every published agent."
+ },
+ {
+ "selector": "#ag-sort",
+ "note": "Reorder the index. Useful for finding recently published agents."
+ }
],
"alt": "The header of the three.ws agents index, with a wide search field and a sort selector, each marked with a numbered callout.",
"caption": "The public agents index. Your agent appears here once it is published, and this is the page visitors search.",
"placements": [
- { "tutorial": "share-your-agent", "anchor": "Step 1 — Find your agent's public URL" }
+ {
+ "tutorial": "share-your-agent",
+ "anchor": "Step 1: Find your agent's public URL"
+ }
]
}
]
diff --git a/docs/api-reference.md b/docs/api-reference.md
index 38f31e9fd..eb73853a0 100644
--- a/docs/api-reference.md
+++ b/docs/api-reference.md
@@ -1787,6 +1787,7 @@ of the gateway's own per-IP budget, so one caller can't drain the shared key.
| `category` | string | Filter by category. Optional. |
| `chain` | string | Filter by chain. Optional. |
+<!-- runnable: no needs a valid upstream aixbt key on the deployment -->
```bash
curl -s 'https://three.ws/api/v1/market/intel?limit=5'
```
@@ -1810,6 +1811,7 @@ Same access model as `/market/intel`. Backed by aixbt's `/projects` feed.
| `names` | string | Comma-separated project names to filter. Optional |
| `chain` | string | Filter by chain. Optional. |
+<!-- runnable: no needs a valid upstream aixbt key on the deployment -->
```bash
curl -s 'https://three.ws/api/v1/market/projects?limit=5&chain=solana'
```
diff --git a/docs/api/forge-x402.md b/docs/api/forge-x402.md
index 94223295e..cf51aea70 100644
--- a/docs/api/forge-x402.md
+++ b/docs/api/forge-x402.md
@@ -66,6 +66,7 @@ them.
4. **Poll for free** until the GLB is ready:
+ <!-- runnable: no the job id is illustrative; use the one the submit call returned -->
```bash
curl 'https://three.ws/api/forge?job=abcd1234efgh5678ij'
# → { "status": "done", "glb_url": "https://.../model.glb", ... }
diff --git a/docs/cookbook/asset-quality-gate.md b/docs/cookbook/asset-quality-gate.md
index 606bbd404..5d4ba0812 100644
--- a/docs/cookbook/asset-quality-gate.md
+++ b/docs/cookbook/asset-quality-gate.md
@@ -20,6 +20,8 @@ PASS 176ed971-0be5-4fc6-b2ff-3370aa499e13.glb 19,074 tris 1.6 MB 1
1/1 assets passed the budget
```
+![The wicker basket this gate rejected at 147,617 triangles, which looks perfectly fine](figure:img:/cookbook/posters/asset-quality-gate.png)
+
Exit codes are the whole point: **0** everything passed, **1** at least one asset
busted its budget, **2** the gate itself could not run. Wire it into CI and a bad
asset fails the build instead of the launch.
diff --git a/docs/cookbook/mcp-3d-tool.md b/docs/cookbook/mcp-3d-tool.md
index 58aa73202..97e812035 100644
--- a/docs/cookbook/mcp-3d-tool.md
+++ b/docs/cookbook/mcp-3d-tool.md
@@ -11,6 +11,8 @@ npm install @modelcontextprotocol/sdk zod
claude mcp add three-ws-3d -- node /absolute/path/to/mcp_3d_server.mjs
```
+![A desk robot generated by asking an assistant for one, through this server](figure:img:/cookbook/posters/mcp-3d-tool.png)
+
Or wire it into any MCP client's config by hand:
```json
diff --git a/docs/cookbook/parallel-asset-pack.md b/docs/cookbook/parallel-asset-pack.md
index a0ddb98a3..e76cdc75f 100644
--- a/docs/cookbook/parallel-asset-pack.md
+++ b/docs/cookbook/parallel-asset-pack.md
@@ -24,6 +24,8 @@ open garden-pack/index.html
101 seconds for three models, not 268. The slowest job sets the wall clock.
+![A clay flower pot, one of the three models this run built in parallel](figure:img:/cookbook/posters/parallel-asset-pack.png)
+
## What it writes
```
@@ -142,8 +144,19 @@ python3 asset_gate.py garden-pack/models/*.glb --max-triangles 100000
See [Gate 3D assets in CI](/cookbook/asset-quality-gate).
+## Run it without installing anything
+
+The [Pipeline Studio](/cookbook/pipeline) is this recipe plus the gate below,
+running in a browser tab against the same free API. It fans prompts out at the
+same concurrency, renders every result, grades each one, and then prints the
+`asset_pack.py` and `asset_gate.py` commands that reproduce the run on your
+machine. Useful for picking a triangle budget before you commit to one.
+
+![The Studio mid-run: finished models already graded while the last one is still generating](figure:img:/cookbook/media/pipeline-studio-midrun.png)
+
## Where to go next
- **The single-model client this builds on** → [Text to 3D from the command line](/cookbook/text-to-3d-cli)
+- **The same pipeline, no install** → [Pipeline Studio](/cookbook/pipeline)
- **Let a model choose the prompts** → [A self-correcting 3D collectible set](/cookbook/self-correcting-3d)
- **The full endpoint reference** → [3D API docs](/docs/3d-api)
diff --git a/docs/cookbook/text-to-3d-cli.md b/docs/cookbook/text-to-3d-cli.md
index 12a2851a4..2e83bde3b 100644
--- a/docs/cookbook/text-to-3d-cli.md
+++ b/docs/cookbook/text-to-3d-cli.md
@@ -14,6 +14,8 @@ prompt: a wooden treasure chest with iron bands
saved 1651 KB to a-wooden-treasure-chest-with-iron-bands.glb
```
+![The treasure chest that command produced, rendered by the platform renderer](figure:img:/cookbook/posters/text-to-3d-cli.png)
+
That is the whole recipe. No API key, no account, no `pip install`. The file is
about 160 lines of standard-library Python, and roughly a third of it is there
to handle the two things that actually go wrong in production.
diff --git a/docs/erc8004.md b/docs/erc8004.md
index 2f36e501f..90ec1f530 100644
--- a/docs/erc8004.md
+++ b/docs/erc8004.md
@@ -386,6 +386,7 @@ where the same-origin policy does not apply:
GET /api/erc8004/metadata?uri=<registration uri>
```
+<!-- runnable: no the CID is illustrative; substitute a real registration uri -->
```sh
curl -s 'https://three.ws/api/erc8004/metadata?uri=ipfs://bafyExampleAgentCard'
# → { "data": { ...the agent card... }, "resolvedUrl": "https://ipfs.io/ipfs/bafyExampleAgentCard" }
diff --git a/docs/forge.md b/docs/forge.md
index df5b32b57..a1f55bbf0 100644
--- a/docs/forge.md
+++ b/docs/forge.md
@@ -71,6 +71,55 @@ the hint deliberately stays quiet for it (`findComparablePrompts` in
[src/forge-compare.js](../src/forge-compare.js), covered by
[tests/forge-compare.test.js](../tests/forge-compare.test.js)).
+### Reel: video and stills, rendered in your browser
+
+A GLB is the wrong thing to send someone who just wants to see what you made.
+The **Reel** button on the result bar (or the `R` key) renders a cinematic pass
+over the finished model and hands back three real files:
+
+| File | What it is | Where it goes |
+| --- | --- | --- |
+| `<name>-<shot>-reel.mp4` | The video, 30fps, MP4 where the browser can encode it and WebM otherwise | Slides, posts, a landing page `<video>` |
+| `<name>-<shot>-hero.png` | The shot's hero frame on the reel backdrop | Thumbnails, link previews |
+| `<name>-<shot>-cutout.png` | The same frame with a transparent background | Dropping the model onto any design |
+
+Three shots ship. **Turntable** is one clean revolution whose last frame lands
+exactly on its first, so it loops without a jump. **Hero push** opens wide and
+dollies into a three-quarter hero angle. **Low reveal** rises from below the
+horizon. Aspect is 16:9, 1:1 or 9:16, and length is 4, 8 or 12 seconds.
+
+Everything runs client side. Nothing is uploaded, no job is queued, and no
+server renders anything, so a reel costs nothing and works while you are signed
+out.
+
+Two implementation choices are worth knowing because they are what make the
+output trustworthy:
+
+- **Reel renders its own pass rather than recording the page's viewer.**
+ `<model-viewer>` runs a single shared WebGL canvas across every viewer on a
+ page and moves it between shadow roots as visibility changes, so a canvas
+ stream taken from it can carry zero frames while still reporting a clean
+ recording. Owning the canvas also means the output is exactly the resolution
+ you picked instead of your window size times your display's pixel ratio. The
+ lighting is not a reimplementation: tone mapping, the HDRI environment and the
+ ground contact shadow all come from
+ [src/shared/cinematic-render.js](../src/shared/cinematic-render.js), the same
+ module behind [/irl](https://three.ws/irl) and the avatar viewers.
+- **The shot is paced to a fixed timestep.** Frames are rendered one at a time
+ and pushed to the encoder on a wall-clock schedule, so a slow laptop produces
+ the same 4-second reel as a fast desktop rather than a shorter, jerkier one.
+
+Camera tracks are expressed in multiples of the model's own framed distance, so
+a ring and a cathedral get the same shot rather than the same numbers, and the
+framing distance accounts for the aspect: a 9:16 frame is limited by its
+horizontal field of view, and ignoring that is exactly how a vertical reel crops
+the subject's head off. The sampler, the framing maths, the codec preference and
+the filenames live in [src/forge-reel.js](../src/forge-reel.js) and are covered
+by [tests/forge-reel.test.js](../tests/forge-reel.test.js).
+
+If a browser has no canvas video encoder, Reel says so and still produces both
+stills; it never reports a recording that did not happen.
+
## Walkthrough
1. Open [/forge](https://three.ws/forge). No login, no wallet, no key required.
@@ -78,7 +127,7 @@ the hint deliberately stays quiet for it (`findComparablePrompts` in
3. For text, type a prompt like `a weathered brass diving helmet`. For photos, add one to four images of the same object from different angles; each uploads straight to object storage via a presigned URL and the public URLs are fused with multi-view conditioning.
4. Optionally open the quality controls and pick a tier (Draft, Standard, High) and an engine. The default engine carries a **FREE** pill. Down lanes are disabled with the reason shown.
5. Click Generate. A real elapsed-driven progress line runs against the catalog's ETA estimate for the chosen path, tier, and engine.
-6. When the model lands, orbit it in the viewer, view it in AR, download the GLB, or run the post-generation tools (stylize, optimize, Game-Ready retopology, split).
+6. When the model lands, orbit it in the viewer, view it in AR, download the GLB, or run the post-generation tools (stylize, optimize, Game-Ready retopology, split). Press `R` (or click **Reel**) to render a shareable video and stills of it without leaving the page.
7. Keep going on the same result: **Rig for animation** adds a humanoid skeleton (POST `/api/forge?action=rig`) and hands off to Pose Studio or IRL placement; **Restyle materials** re-skins the surface with a free-text instruction or a preset chip (chrome, wood, gold, neon, marble, rust) via `/api/material-studio`, keeping the mesh untouched; **Iterate** makes a shape-changing edit from a plain-language instruction ("make the helmet red", "add a backpack") via `/api/forge-iterate` — the same conversational core the `refine_model` MCP tool uses — and keeps every version in a branchable lineage strip; **Place IRL** opens `/irl?avatar=<glb_url>` to anchor the model in AR at a real-world location.
## Examples
diff --git a/docs/nav.json b/docs/nav.json
index efa08ec2d..9253d5c5b 100644
--- a/docs/nav.json
+++ b/docs/nav.json
@@ -300,6 +300,10 @@
"label": "Trading hub (start here)",
"path": "trading-hub"
},
+ {
+ "label": "Exit Lab (replay real trades)",
+ "path": "exit-lab"
+ },
{
"label": "Risk acknowledgment",
"path": "risk-acknowledgment"
@@ -507,6 +511,10 @@
"label": "The in-game economy",
"path": "in-game-economy"
},
+ {
+ "label": "The economy solver",
+ "path": "economy-solver"
+ },
{
"label": "Circulation engine",
"path": "circulation-engine"
@@ -1056,6 +1064,10 @@
"label": "Read the trading fleet",
"path": "tutorials/read-the-trading-fleet"
},
+ {
+ "label": "Find a better exit policy",
+ "path": "tutorials/find-a-better-exit-policy"
+ },
{
"label": "Earn and spend in /play",
"path": "tutorials/earn-and-spend-in-play"
diff --git a/docs/start-here.md b/docs/start-here.md
index 0decd4b0f..92f9db1d4 100644
--- a/docs/start-here.md
+++ b/docs/start-here.md
@@ -105,6 +105,7 @@ Curious what happens between the prompt and the model? [How the Forge works](./h
- **Need a ready-made character or prop?** → The [Character Library](./character-library.md) has 106 rigged characters (one click into the Studio, Animation Studio, or an embed) and the [Object Library](./object-library.md) has hundreds of CC0 props with live preview, AR placement, and direct GLB download
- **Rendering avatars outside the viewer?** → [Media and render API](./media-api.md): avatar PNG renders for `<img>` tags, posed clip renders, the runtime GLB optimizer, the CORS-open model proxy, and the free vision and speech-to-text endpoints; companion to the [3D API](./3d-api.md)
- **Putting avatars in your build pipeline?** → [Avatar CLI](./avatar-cli.md): four offline commands that scaffold a hash-anchored avatar manifest from a wallet and a GLB, validate it against the published schema, and print an embed snippet that renders. Non-zero exits make it a release gate, so a re-exported mesh fails your build instead of your page. [Ship an avatar manifest](./tutorials/ship-an-avatar-manifest.md) is the guided walkthrough
+- **Uploaded an avatar that loads but never moves?** → [Rig Doctor](./rig-doctor.md): drop the `.glb` and find out in a second why. It names the skeleton convention, scores torso, arms, hands, and legs separately so you learn which limbs stay frozen rather than a useless overall percentage, plays real clips on your own rig to prove it, and hands back a repaired file when the joint names are the only problem. Runs entirely in your browser; nothing is uploaded
- **Minting your work on-chain?** → [Minted 3D assets](./minted.md): the /minted gallery of avatars minted as Metaplex Core NFTs, the opt-in mint flow, baked provenance, and enforced remix royalties
- **Letting an agent spend without your key?** → [Payment Sessions](./payment-sessions.md): fund a capped envelope from prepaid credits, hand the agent a bearer token, and it pays x402 endpoints under your caps and allowlist, refundable on cancel
- **Earning proof you were somewhere?** → [World Lines](./world-lines.md): walk to an agent's real-world spot, complete its challenge (a tap, a passphrase, or a quiz), and its wallet signs an ed25519 proof of presence you own and anyone can verify. No coordinate finer than a roughly 1 km cell is ever stored
diff --git a/docs/tutorials/build-a-3d-asset-pipeline.md b/docs/tutorials/build-a-3d-asset-pipeline.md
index d2aa2f818..51220616b 100644
--- a/docs/tutorials/build-a-3d-asset-pipeline.md
+++ b/docs/tutorials/build-a-3d-asset-pipeline.md
@@ -16,6 +16,14 @@ key to store.
Every stage uses a file from the [Cookbook](/cookbook). Download them into one
working directory as you go.
+**Want to see it before you build it?** The
+[Pipeline Studio](/cookbook/pipeline) runs all four stages in a browser tab, on
+the same free API, with no install at all. It is the fastest way to understand
+what you are about to write, and it hands you the exact commands below when it
+finishes.
+
+![The Pipeline Studio after a real three-model run: prompts and a budget on the left, every model rendered and graded on the right](figure:img:/cookbook/media/pipeline-studio-run.png)
+
---
## Stage 1: one model, from the command line
@@ -35,7 +43,9 @@ saved 1651 KB to a-wooden-treasure-chest-with-iron-bands.glb
```
Open the viewer URL to look at it, or the AR URL on a phone to stand it on your
-desk.
+desk. This is the model that command produced:
+
+![The treasure chest built by this exact command, rendered through the platform renderer](figure:img:/cookbook/posters/text-to-3d-cli.png)
**What to learn here:** the API answers in two shapes, not one. It returns the
finished model inline when the draft is quick, and a job handle when the shared
@@ -80,6 +90,8 @@ open garden-pack/index.html
101 seconds instead of 268. Open `garden-pack/index.html` and you have an
interactive gallery you can send to someone.
+![One of the three garden props, generated in the same parallel run](figure:img:/cookbook/posters/parallel-asset-pack.png)
+
**What to learn here:** concurrency is deliberately low, at three. The free lane
is a shared GPU pool, so twenty simultaneous jobs do not finish faster, they
queue behind each other and burn poll requests. Details, plus the failure-handling
@@ -112,7 +124,11 @@ FAIL a-woven-wicker-basket.glb 147,617 tris 2.8 MB 0
fail: 147,617 triangles exceeds the budget of 100,000
```
-Exit code 1. In CI, that fails the build.
+Exit code 1. In CI, that fails the build. The basket is the one that busted the
+budget, and it does not look like a problem, which is the entire point of gating
+on numbers rather than on a glance:
+
+![The wicker basket that failed the gate at 147,617 triangles](figure:img:/cookbook/posters/asset-quality-gate.png)
**What to learn here:** the difference between a failure and an advisory. The
basket busting the triangle budget is a failure, because it will visibly hurt a
diff --git a/docs/tutorials/getting-started.md b/docs/tutorials/getting-started.md
index 8c1ee614b..4f73533bd 100644
--- a/docs/tutorials/getting-started.md
+++ b/docs/tutorials/getting-started.md
@@ -134,18 +134,13 @@ That's it. You created a body, gave it a brain, and shipped a shareable URL.
### See the directory you just joined
-Publishing puts your agent in the public directory, and that directory is a plain public API. Press Run below and this page calls it live, from your browser, with no key and no account. The first agent it returns is rendered underneath the response.
-
-```try
-GET /api/agents/public?limit=3
-title: The public agent directory
-note: The same endpoint the marketplace reads. Your published agent appears in this list.
-pick: agents[0].avatar_thumbnail
-render: image
-alt: The portrait of the first agent in the live public directory
+Publishing puts your agent in the public directory, and that directory is a plain public API. Press Run below: this page calls it live, from your browser, with no key and no account.
+
+```live
+{ "step": "agents-public" }
```
-Every field you filled in above (name, description, skills) is in that JSON. That is what makes an agent embeddable, searchable, and reachable by other agents.
+Every field you filled in above (name, description, skills) is in that JSON, and the portrait rendered under it is the real avatar of the first agent in the list. That combination is what makes an agent embeddable, searchable, and reachable by other agents.
---
diff --git a/docs/tutorials/mint-pumpfun-token.md b/docs/tutorials/mint-pumpfun-token.md
index d3508d6b6..bb2effa37 100644
--- a/docs/tutorials/mint-pumpfun-token.md
+++ b/docs/tutorials/mint-pumpfun-token.md
@@ -58,6 +58,7 @@ Before the launch dialog opens, decide three things and verify them.
**Symbol availability check.** Pump.fun does not enforce ticker uniqueness, but the three.ws agent registry warns when a ticker is already used by another listed agent. Hit the platform's symbol-availability endpoint from your terminal:
+<!-- runnable: 402 an unpaid call answers with the x402 challenge, which is the expected first response -->
```bash
curl 'https://three.ws/api/x402/symbol-availability?symbol=ATLAS' \
-H 'accept: application/json'
@@ -208,11 +209,8 @@ Click your token. The detail panel shows:
The ribbon is rendered from a public endpoint, so you can check the same list without opening the page. Press Run and this tutorial calls it against the live site:
-```try
-GET /api/pump/launches?limit=5
-title: Coins launched through three.ws
-note: Public and unauthenticated. Every entry carries the mint plus the agent that launched it.
-pick: data.launches[0].mint
+```live
+{ "step": "pump-launches" }
```
Copy the mint out of that response and paste it into a Solana explorer to confirm it on-chain. If your token is missing here but visible on Pump.fun, the bonding step (Step 7) did not complete.
diff --git a/docs/tutorials/pay-for-x402-service.md b/docs/tutorials/pay-for-x402-service.md
index 5a0c2c1ae..4a65b694b 100644
--- a/docs/tutorials/pay-for-x402-service.md
+++ b/docs/tutorials/pay-for-x402-service.md
@@ -82,6 +82,7 @@ What you signed is exactly what the challenge declared — the modal never inven
To understand what the modal is doing, hit a paid endpoint by hand. Any x402 endpoint answers an unpaid request with a 402:
+<!-- runnable: 402 the unpaid 402 challenge is the whole lesson here -->
```bash
curl -i https://three.ws/api/x402/model-check
```
diff --git a/docs/tutorials/sell-a-skill-with-a-trial.md b/docs/tutorials/sell-a-skill-with-a-trial.md
index f1762a68d..2ae0c1d5a 100644
--- a/docs/tutorials/sell-a-skill-with-a-trial.md
+++ b/docs/tutorials/sell-a-skill-with-a-trial.md
@@ -30,6 +30,12 @@ Three free runs, then a real payment. That is the whole shape.
## 1. List the skill with a trial attached
+Before pricing anything, look at what you are pricing against. This is the live catalog a buyer shops from, with real install counts, ratings, and per-call prices:
+
+```live
+{ "step": "skills-catalog", "note": "Raise the limit to see more of the market you are about to list into." }
+```
+
Pricing lives on the agent, not on a global catalog. One `PUT` replaces the agent's full price list, so send every skill you want listed in the same call.
```bash
diff --git a/docs/tutorials/share-your-agent.md b/docs/tutorials/share-your-agent.md
index 8f5a37235..3528a4b8f 100644
--- a/docs/tutorials/share-your-agent.md
+++ b/docs/tutorials/share-your-agent.md
@@ -35,6 +35,14 @@ A few practical notes:
If you ever forget the URL, the "Copy share link" button on the agent profile page copies the canonical version to your clipboard.
+Every public agent is also in the platform's own directory, which is a plain open endpoint. Press the button and you are looking at the live directory, portrait and all, the way it exists as you read this:
+
+```live
+{ "step": "agents-public", "note": "The public directory, unauthenticated. Raise the limit and the cursor fields appear so you can page through it." }
+```
+
+Each entry carries `home_url`, which is the same canonical link this step is about. That is the shape to read if you are listing your agents somewhere else rather than copying one URL by hand.
+
### What visitors see when they open the link
The public agent page renders the agent's full 3D body in the centre of the screen, with chat input below it and microphone access for voice. The agent's name and one-line description show above. There is a small "Embed this agent on your site" prompt below for visitors who want to take the experience back to their own pages.
diff --git a/docs/vanity.md b/docs/vanity.md
index b25da09a7..610e3a8c8 100644
--- a/docs/vanity.md
+++ b/docs/vanity.md
@@ -107,6 +107,7 @@ tier for the requested pattern.
### Example
+<!-- runnable: 402 an unpaid call answers with the x402 challenge, which is the expected first response -->
```bash
# Grind an address starting with "So" (2-char keypair tier, $0.05).
# @x402/fetch handles the 402 → pay → retry handshake automatically.
diff --git a/docs/vaults.md b/docs/vaults.md
index 5830a7576..9a3928b53 100644
--- a/docs/vaults.md
+++ b/docs/vaults.md
@@ -243,6 +243,7 @@ Statuses are `open`, `paused`, `closing`, `closed`. Terms changes are recorded i
Event types: `open`, `deposit`, `redeem`, `trade`, `fee`, `fee_claim`, `drawdown_halt`, `pause`, `resume`, `terms`, `close`, `nav`. Filter with `type=`, page with `limit=` (1 to 100, default 50) and `before=<next_cursor>`.
+<!-- runnable: no the vault id is illustrative; substitute one from GET /api/vaults -->
```bash
curl -s "https://three.ws/api/vaults/ledger?vault_id=8b1c04f6-59a8-4d0e-a1b7-3f5c9e2d7a44&type=trade&limit=20"
```
diff --git a/docs/world-lines.md b/docs/world-lines.md
index ca0857f9e..8d2d6c7f8 100644
--- a/docs/world-lines.md
+++ b/docs/world-lines.md
@@ -182,6 +182,7 @@ The signature is ed25519 over the UTF-8 bytes of that string, produced with the
### Over HTTP, no auth
+<!-- runnable: no the proof id is illustrative; substitute one from a real collectible -->
```bash
curl -s https://three.ws/api/irl/world-lines/verify/9f1c2d3e-4a5b-6c7d-8e9f-0a1b2c3d4e5f
```
@@ -402,6 +403,7 @@ An invalid `region` is ignored (you get the roll-up) rather than erroring.
Single quest. Pass the fix and coordinates to unlock the full challenge spec; omit them for the "travel here" view.
+<!-- runnable: no the quest id is illustrative; substitute one from GET /browse -->
```bash
curl -s 'https://three.ws/api/irl/world-lines/1b2a3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d?lat=37.77493&lng=-122.41942' \
-H 'x-irl-fix: <token>'
diff --git a/public/cookbook/media/pipeline-studio-controls.png b/public/cookbook/media/pipeline-studio-controls.png
new file mode 100644
index 000000000..df75a947a
Binary files /dev/null and b/public/cookbook/media/pipeline-studio-controls.png differ
diff --git a/public/cookbook/media/pipeline-studio-midrun.png b/public/cookbook/media/pipeline-studio-midrun.png
new file mode 100644
index 000000000..217ff6998
Binary files /dev/null and b/public/cookbook/media/pipeline-studio-midrun.png differ
diff --git a/public/cookbook/media/pipeline-studio-results.png b/public/cookbook/media/pipeline-studio-results.png
new file mode 100644
index 000000000..673a0062a
Binary files /dev/null and b/public/cookbook/media/pipeline-studio-results.png differ
diff --git a/public/cookbook/media/pipeline-studio-run.png b/public/cookbook/media/pipeline-studio-run.png
new file mode 100644
index 000000000..48d311a76
Binary files /dev/null and b/public/cookbook/media/pipeline-studio-run.png differ
diff --git a/public/doc-figures.css b/public/doc-figures.css
deleted file mode 100644
index 0bbdcde6f..000000000
--- a/public/doc-figures.css
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * doc-figures.css — presentation for the figures /doc-figures.js builds.
- *
- * Loaded by both markdown viewers (docs/index.html and pages/tutorial.html).
- * The docs shell is dark-only; the tutorial viewer honours [data-theme='light'],
- * so every colour here is a token with a light override at the bottom rather
- * than a hard-coded value.
- */
-
-.doc-figure {
- --df-border: rgba(255, 255, 255, 0.09);
- --df-surface: rgba(255, 255, 255, 0.028);
- --df-surface-hover: rgba(255, 255, 255, 0.05);
- --df-text: rgba(224, 224, 224, 0.85);
- --df-muted: rgba(224, 224, 224, 0.55);
- --df-accent: #8b5cf6;
- margin: 2rem 0;
- padding: 0;
- display: flex;
- flex-direction: column;
- gap: 0.6rem;
-}
-
-/* The image is a button so it is reachable by keyboard and announced as an
- action, not decoration. Everything below strips the default button chrome. */
-.doc-figure-open {
- position: relative;
- display: block;
- width: 100%;
- padding: 0;
- border: 1px solid var(--df-border);
- border-radius: 14px;
- background: var(--df-surface);
- cursor: zoom-in;
- overflow: hidden;
- font: inherit;
- color: inherit;
- transition:
- border-color 0.18s ease,
- background 0.18s ease,
- transform 0.18s ease,
- box-shadow 0.18s ease;
-}
-
-.doc-figure-open:hover {
- border-color: rgba(139, 92, 246, 0.45);
- background: var(--df-surface-hover);
- transform: translateY(-1px);
- box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34);
-}
-
-.doc-figure-open:focus-visible {
- outline: 2px solid var(--df-accent);
- outline-offset: 3px;
-}
-
-/* Sized from the manifest's intrinsic dimensions, so the box exists before the
- image decodes and the article never reflows around it. */
-.doc-figure-media {
- display: block;
- width: 100%;
- background:
- linear-gradient(135deg, rgba(139, 92, 246, 0.07), transparent 60%),
- rgba(255, 255, 255, 0.02);
-}
-
-.doc-figure-media img {
- display: block;
- width: 100%;
- height: auto;
- margin: 0;
- border: 0;
- border-radius: 0;
-}
-
-.doc-figure-badge {
- position: absolute;
- top: 10px;
- left: 10px;
- display: inline-flex;
- align-items: center;
- gap: 0.4em;
- padding: 0.28em 0.66em;
- border-radius: 999px;
- background: rgba(9, 9, 15, 0.78);
- border: 1px solid rgba(139, 92, 246, 0.5);
- color: #e9ddff;
- font-size: 0.72rem;
- font-weight: 600;
- letter-spacing: 0.02em;
- backdrop-filter: blur(6px);
-}
-
-.doc-figure-badge::before {
- content: '';
- width: 6px;
- height: 6px;
- border-radius: 50%;
- background: #8b5cf6;
- box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
-}
-
-.doc-figure-zoom {
- position: absolute;
- right: 10px;
- bottom: 10px;
- display: grid;
- place-items: center;
- width: 30px;
- height: 30px;
- border-radius: 9px;
- background: rgba(9, 9, 15, 0.72);
- border: 1px solid rgba(255, 255, 255, 0.14);
- color: #fff;
- opacity: 0;
- transform: translateY(4px);
- transition:
- opacity 0.18s ease,
- transform 0.18s ease;
- backdrop-filter: blur(6px);
-}
-
-.doc-figure-open:hover .doc-figure-zoom,
-.doc-figure-open:focus-visible .doc-figure-zoom {
- opacity: 1;
- transform: translateY(0);
-}
-
-.doc-figure-caption {
- display: flex;
- flex-wrap: wrap;
- align-items: baseline;
- gap: 0.4rem 0.9rem;
- font-size: 0.88rem;
- line-height: 1.55;
- color: var(--df-muted);
-}
-
-.doc-figure-text {
- color: var(--df-text);
-}
-
-.doc-figure-source {
- font-size: 0.78rem;
- color: var(--df-muted);
- text-decoration: none;
- border-bottom: 1px dashed rgba(255, 255, 255, 0.22);
- white-space: nowrap;
-}
-
-.doc-figure-source:hover {
- color: var(--df-accent);
- border-bottom-color: currentColor;
-}
-
-/* ── Lightbox ───────────────────────────────────────────────────────────── */
-
-html.doc-lightbox-locked {
- overflow: hidden;
-}
-
-.doc-lightbox {
- position: fixed;
- inset: 0;
- z-index: 3000;
- display: grid;
- place-items: center;
- opacity: 0;
- transition: opacity 0.18s ease;
-}
-
-.doc-lightbox.open {
- opacity: 1;
-}
-
-.doc-lightbox[hidden] {
- display: none;
-}
-
-.doc-lightbox-backdrop {
- position: absolute;
- inset: 0;
- background: rgba(4, 4, 9, 0.86);
- backdrop-filter: blur(10px);
- cursor: zoom-out;
-}
-
-.doc-lightbox-frame {
- position: relative;
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 0.9rem;
- max-width: min(94vw, 1500px);
- max-height: 92vh;
- padding: 0 3.4rem;
- pointer-events: none;
-}
-
-.doc-lightbox-frame > * {
- pointer-events: auto;
-}
-
-.doc-lightbox-figure {
- margin: 0;
- display: flex;
- flex-direction: column;
- gap: 0.7rem;
- min-height: 0;
-}
-
-.doc-lightbox-img {
- display: block;
- max-width: 100%;
- max-height: 78vh;
- width: auto;
- height: auto;
- border-radius: 12px;
- border: 1px solid rgba(255, 255, 255, 0.14);
- box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
- cursor: zoom-in;
- transition: transform 0.22s ease;
-}
-
-.doc-lightbox-img.zoomed {
- transform: scale(2);
- cursor: zoom-out;
-}
-
-.doc-lightbox-caption {
- display: flex;
- flex-wrap: wrap;
- justify-content: center;
- align-items: baseline;
- gap: 0.35rem 0.85rem;
- max-width: 68ch;
- margin: 0 auto;
- text-align: center;
- font-size: 0.9rem;
- line-height: 1.55;
- color: rgba(235, 235, 245, 0.82);
-}
-
-.doc-lightbox-source {
- font-size: 0.79rem;
- color: rgba(235, 235, 245, 0.6);
- text-decoration: none;
- border-bottom: 1px dashed rgba(255, 255, 255, 0.28);
-}
-
-.doc-lightbox-source:hover {
- color: #c4b5fd;
-}
-
-.doc-lightbox-close,
-.doc-lightbox-nav {
- position: absolute;
- display: grid;
- place-items: center;
- width: 42px;
- height: 42px;
- border-radius: 50%;
- border: 1px solid rgba(255, 255, 255, 0.16);
- background: rgba(18, 18, 28, 0.82);
- color: #fff;
- cursor: pointer;
- transition:
- background 0.16s ease,
- border-color 0.16s ease,
- transform 0.16s ease;
-}
-
-.doc-lightbox-close:hover,
-.doc-lightbox-nav:hover {
- background: rgba(139, 92, 246, 0.3);
- border-color: rgba(139, 92, 246, 0.6);
- transform: scale(1.06);
-}
-
-.doc-lightbox-close:focus-visible,
-.doc-lightbox-nav:focus-visible {
- outline: 2px solid #8b5cf6;
- outline-offset: 3px;
-}
-
-.doc-lightbox-close {
- top: -6px;
- right: 0;
-}
-
-.doc-lightbox-prev {
- left: 0;
- top: 50%;
- transform: translateY(-50%);
-}
-
-.doc-lightbox-next {
- right: 0;
- top: 50%;
- transform: translateY(-50%);
-}
-
-.doc-lightbox-prev:hover,
-.doc-lightbox-next:hover {
- transform: translateY(-50%) scale(1.06);
-}
-
-.doc-lightbox-nav[hidden] {
- display: none;
-}
-
-.doc-lightbox-count {
- font-size: 0.78rem;
- letter-spacing: 0.06em;
- color: rgba(235, 235, 245, 0.5);
- font-variant-numeric: tabular-nums;
-}
-
-/* ── Small screens ──────────────────────────────────────────────────────── */
-
-@media (max-width: 640px) {
- .doc-figure {
- margin: 1.5rem 0;
- }
-
- .doc-lightbox-frame {
- padding: 0 0.75rem;
- max-width: 100vw;
- }
-
- /* Side arrows would sit on top of the image at this width; drop them to the
- bottom rail where the thumb already is. */
- .doc-lightbox-prev,
- .doc-lightbox-next {
- top: auto;
- bottom: -4px;
- transform: none;
- }
-
- .doc-lightbox-prev:hover,
- .doc-lightbox-next:hover {
- transform: scale(1.06);
- }
-
- .doc-lightbox-prev {
- left: 12%;
- }
-
- .doc-lightbox-next {
- right: 12%;
- }
-
- .doc-lightbox-img {
- max-height: 62vh;
- }
-
- .doc-lightbox-caption {
- font-size: 0.83rem;
- }
-}
-
-/* ── Light theme (the tutorial viewer supports it; the docs shell is dark) ── */
-
-[data-theme='light'] .doc-figure {
- --df-border: rgba(15, 17, 26, 0.12);
- --df-surface: rgba(15, 17, 26, 0.02);
- --df-surface-hover: rgba(15, 17, 26, 0.045);
- --df-text: rgba(20, 22, 32, 0.88);
- --df-muted: rgba(20, 22, 32, 0.6);
-}
-
-[data-theme='light'] .doc-figure-open:hover {
- box-shadow: 0 12px 30px rgba(20, 22, 40, 0.12);
-}
-
-[data-theme='light'] .doc-figure-source {
- border-bottom-color: rgba(15, 17, 26, 0.24);
-}
-
-[data-theme='light'] .doc-figure-media {
- background:
- linear-gradient(135deg, rgba(139, 92, 246, 0.08), transparent 60%),
- rgba(15, 17, 26, 0.03);
-}
-
-/* ── Motion preferences ─────────────────────────────────────────────────── */
-
-@media (prefers-reduced-motion: reduce) {
- .doc-figure-open,
- .doc-figure-zoom,
- .doc-lightbox,
- .doc-lightbox-img,
- .doc-lightbox-close,
- .doc-lightbox-nav {
- transition: none;
- }
-
- .doc-figure-open:hover {
- transform: none;
- }
-}
diff --git a/public/doc-figures.js b/public/doc-figures.js
deleted file mode 100644
index 61f3deaf9..000000000
--- a/public/doc-figures.js
+++ /dev/null
@@ -1,340 +0,0 @@
-/**
- * doc-figures.js — turns plain markdown images into first-class documentation figures.
- *
- * Both documentation surfaces render the same markdown files with `marked`: the
- * docs shell (/docs/…) and the standalone tutorial viewer (/tutorials/…). Left
- * alone, `marked` emits a bare `<img>`: no caption, no intrinsic size (so the
- * article jumps when it decodes), no way to see detail in a 1200px screenshot
- * squeezed into a 720px column, and no answer to the reader's real question,
- * "is this what the product looks like *now*?".
- *
- * This upgrades every image the docs own into a <figure> that answers all four:
- *
- * • Intrinsic dimensions come from /docs/media-manifest.json before the image
- * loads, so the box is reserved and nothing shifts.
- * • The markdown title becomes a real <figcaption>.
- * • Provenance ("captured from /create/prompt") links to the live route, so a
- * reader can check the screenshot against the product in one click.
- * • Click or press Enter to open a lightbox with zoom, arrow-key paging
- * between every figure on the page, and a focus trap.
- *
- * Authors write nothing but ordinary markdown:
- *
- * ![Alt text that describes the UI](/docs/img/forge-prompt-panel.webp 'Caption')
- *
- * so the same file still renders correctly on GitHub, in an LLM's plain-text
- * fetch, and in any other markdown viewer. Progressive enhancement only: with
- * this script blocked, every image is still a working image.
- *
- * Usage (both viewers do exactly this after setting innerHTML):
- *
- * DocFigures.upgrade(document.getElementById('docs-content'));
- */
-(function () {
- 'use strict';
-
- var MANIFEST_URL = '/docs/media-manifest.json';
- var OWNED_PREFIX = '/docs/img/';
- var manifestPromise = null;
-
- function loadManifest() {
- if (!manifestPromise) {
- manifestPromise = fetch(MANIFEST_URL)
- .then(function (res) {
- return res.ok ? res.json() : { shots: {} };
- })
- .catch(function () {
- // The manifest is an enhancement, not a dependency: without it the
- // figures still render, they just size themselves on decode.
- return { shots: {} };
- });
- }
- return manifestPromise;
- }
-
- function shotIdFor(src) {
- var path = src.split('?')[0].split('#')[0];
- if (path.indexOf(OWNED_PREFIX) === -1) return null;
- var file = path.slice(path.indexOf(OWNED_PREFIX) + OWNED_PREFIX.length);
- return file.replace(/\.(webp|png|jpe?g|gif|avif)$/i, '') || null;
- }
-
- function prefersReducedMotion() {
- return window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
- }
-
- function formatCapturedAt(iso) {
- var date = new Date(iso);
- if (isNaN(date.getTime())) return null;
- return date.toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' });
- }
-
- // ── Lightbox ────────────────────────────────────────────────────────────────
- // One instance per page, built on first open and reused. It owns the figures
- // of whichever article opened it, so arrow keys page through that article.
-
- var lightbox = null;
-
- function buildLightbox() {
- var overlay = document.createElement('div');
- overlay.className = 'doc-lightbox';
- overlay.setAttribute('role', 'dialog');
- overlay.setAttribute('aria-modal', 'true');
- overlay.setAttribute('aria-label', 'Image viewer');
- overlay.hidden = true;
- overlay.innerHTML =
- '<div class="doc-lightbox-backdrop" data-close></div>' +
- '<div class="doc-lightbox-frame">' +
- '<figure class="doc-lightbox-figure">' +
- '<img class="doc-lightbox-img" alt="" />' +
- '<figcaption class="doc-lightbox-caption"><span class="doc-lightbox-text"></span> <a class="doc-lightbox-source" target="_blank" rel="noopener"></a></figcaption>' +
- '</figure>' +
- '<button type="button" class="doc-lightbox-close" data-close aria-label="Close image viewer">' +
- '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><path d="M6 6l12 12M18 6 6 18"/></svg>' +
- '</button>' +
- '<button type="button" class="doc-lightbox-nav doc-lightbox-prev" aria-label="Previous image">' +
- '<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 5-7 7 7 7"/></svg>' +
- '</button>' +
- '<button type="button" class="doc-lightbox-nav doc-lightbox-next" aria-label="Next image">' +
- '<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 5 7 7-7 7"/></svg>' +
- '</button>' +
- '<div class="doc-lightbox-count" aria-live="polite"></div>' +
- '</div>';
- document.body.appendChild(overlay);
-
- var state = { items: [], index: 0, opener: null, zoomed: false };
- var img = overlay.querySelector('.doc-lightbox-img');
- var text = overlay.querySelector('.doc-lightbox-text');
- var source = overlay.querySelector('.doc-lightbox-source');
- var count = overlay.querySelector('.doc-lightbox-count');
- var prev = overlay.querySelector('.doc-lightbox-prev');
- var next = overlay.querySelector('.doc-lightbox-next');
- var closeBtn = overlay.querySelector('.doc-lightbox-close');
-
- function setZoom(on) {
- state.zoomed = on;
- img.classList.toggle('zoomed', on);
- img.setAttribute('aria-label', on ? 'Zoomed in. Click to zoom out.' : 'Click to zoom in.');
- }
-
- function show(index) {
- if (!state.items.length) return;
- state.index = (index + state.items.length) % state.items.length;
- var item = state.items[state.index];
- setZoom(false);
- img.src = item.src;
- img.alt = item.alt || '';
- text.textContent = item.caption || item.alt || '';
- if (item.route) {
- source.textContent = 'View ' + item.route;
- source.href = item.route;
- source.hidden = false;
- } else {
- source.hidden = true;
- }
- count.textContent = state.items.length > 1 ? state.index + 1 + ' / ' + state.items.length : '';
- var multiple = state.items.length > 1;
- prev.hidden = !multiple;
- next.hidden = !multiple;
- }
-
- function close() {
- overlay.hidden = true;
- overlay.classList.remove('open');
- document.documentElement.classList.remove('doc-lightbox-locked');
- img.src = '';
- if (state.opener && document.contains(state.opener)) state.opener.focus();
- state.opener = null;
- }
-
- function onKey(event) {
- if (overlay.hidden) return;
- if (event.key === 'Escape') {
- event.preventDefault();
- close();
- } else if (event.key === 'ArrowRight') {
- event.preventDefault();
- show(state.index + 1);
- } else if (event.key === 'ArrowLeft') {
- event.preventDefault();
- show(state.index - 1);
- } else if (event.key === 'Tab') {
- // Focus trap: the overlay is modal, so Tab must never reach the
- // article behind it.
- var focusable = Array.prototype.filter.call(
- overlay.querySelectorAll('button:not([hidden]), a[href]:not([hidden])'),
- function (el) {
- return el.offsetParent !== null;
- },
- );
- if (!focusable.length) return;
- var first = focusable[0];
- var last = focusable[focusable.length - 1];
- if (event.shiftKey && document.activeElement === first) {
- event.preventDefault();
- last.focus();
- } else if (!event.shiftKey && document.activeElement === last) {
- event.preventDefault();
- first.focus();
- }
- }
- }
-
- overlay.addEventListener('click', function (event) {
- if (event.target.hasAttribute('data-close') || event.target.closest('[data-close]')) close();
- });
- prev.addEventListener('click', function () {
- show(state.index - 1);
- });
- next.addEventListener('click', function () {
- show(state.index + 1);
- });
- img.addEventListener('click', function () {
- setZoom(!state.zoomed);
- });
- img.addEventListener('mousemove', function (event) {
- if (!state.zoomed) return;
- var rect = img.getBoundingClientRect();
- img.style.transformOrigin =
- ((event.clientX - rect.left) / rect.width) * 100 +
- '% ' +
- ((event.clientY - rect.top) / rect.height) * 100 +
- '%';
- });
- document.addEventListener('keydown', onKey);
-
- return {
- open: function (items, index, opener) {
- state.items = items;
- state.opener = opener || null;
- overlay.hidden = false;
- document.documentElement.classList.add('doc-lightbox-locked');
- if (!prefersReducedMotion()) {
- requestAnimationFrame(function () {
- overlay.classList.add('open');
- });
- } else {
- overlay.classList.add('open');
- }
- show(index);
- closeBtn.focus();
- },
- };
- }
-
- // ── Figure upgrade ──────────────────────────────────────────────────────────
-
- function upgradeImage(img, shot, group) {
- var caption = img.getAttribute('title') || (shot && shot.caption) || '';
- var figure = document.createElement('figure');
- figure.className = 'doc-figure';
- if (shot && shot.animated) figure.classList.add('is-animated');
-
- var button = document.createElement('button');
- button.type = 'button';
- button.className = 'doc-figure-open';
- button.setAttribute(
- 'aria-label',
- 'Open image' + (img.alt ? ': ' + img.alt : '') + ' in the full-size viewer',
- );
-
- var media = document.createElement('span');
- media.className = 'doc-figure-media';
- if (shot && shot.width && shot.height) {
- // Reserve the exact box the image will occupy. This is the whole
- // reason the manifest carries dimensions.
- media.style.aspectRatio = shot.width + ' / ' + shot.height;
- }
-
- img.removeAttribute('title');
- img.loading = 'lazy';
- img.decoding = 'async';
- if (shot && shot.width) img.width = shot.width;
- if (shot && shot.height) img.height = shot.height;
- if (!img.alt && shot && shot.alt) img.alt = shot.alt;
-
- img.parentNode.insertBefore(figure, img);
- media.appendChild(img);
- button.appendChild(media);
-
- if (shot && shot.animated) {
- var badge = document.createElement('span');
- badge.className = 'doc-figure-badge';
- badge.textContent = 'Live capture';
- button.appendChild(badge);
- }
-
- var zoomHint = document.createElement('span');
- zoomHint.className = 'doc-figure-zoom';
- zoomHint.setAttribute('aria-hidden', 'true');
- zoomHint.innerHTML =
- '<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.1" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="M20 20l-3.6-3.6M11 8.4v5.2M8.4 11h5.2"/></svg>';
- button.appendChild(zoomHint);
- figure.appendChild(button);
-
- if (caption || (shot && shot.route)) {
- var figcaption = document.createElement('figcaption');
- figcaption.className = 'doc-figure-caption';
- if (caption) {
- var span = document.createElement('span');
- span.className = 'doc-figure-text';
- span.textContent = caption;
- figcaption.appendChild(span);
- }
- if (shot && shot.route) {
- var meta = document.createElement('a');
- meta.className = 'doc-figure-source';
- meta.href = shot.route;
- var when = shot.capturedAt ? formatCapturedAt(shot.capturedAt) : null;
- meta.textContent = 'Captured from ' + shot.route + (when ? ' · ' + when : '');
- meta.title = 'Open the live page this image was captured from';
- figcaption.appendChild(meta);
- }
- figure.appendChild(figcaption);
- }
-
- var item = {
- src: img.currentSrc || img.src,
- alt: img.alt,
- caption: caption,
- route: shot ? shot.route : null,
- };
- group.push(item);
- var index = group.length - 1;
- button.addEventListener('click', function () {
- if (!lightbox) lightbox = buildLightbox();
- lightbox.open(group, index, button);
- });
- }
-
- /**
- * Upgrade every markdown image inside `root`. Safe to call repeatedly; an
- * already-upgraded image is skipped.
- *
- * @param {Element} root container holding freshly rendered markdown
- * @returns {Promise<number>} how many figures were upgraded
- */
- function upgrade(root) {
- if (!root) return Promise.resolve(0);
- return loadManifest().then(function (manifest) {
- var shots = (manifest && manifest.shots) || {};
- var images = Array.prototype.slice.call(root.querySelectorAll('img'));
- var group = [];
- var upgraded = 0;
- images.forEach(function (img) {
- if (img.closest('.doc-figure')) return;
- // Inline badges (shields, icons) are not figures; only images the
- // docs own, or any image an author explicitly opted in, qualify.
- var src = img.getAttribute('src') || '';
- var id = shotIdFor(src);
- var optedIn = img.hasAttribute('data-figure');
- if (!id && !optedIn) return;
- upgradeImage(img, id ? shots[id] : null, group);
- upgraded++;
- });
- return upgraded;
- });
- }
-
- window.DocFigures = { upgrade: upgrade, loadManifest: loadManifest };
-})();
diff --git a/public/docs/img/animation-studio.webp b/public/docs/img/animation-studio.webp
new file mode 100644
index 000000000..318392b65
Binary files /dev/null and b/public/docs/img/animation-studio.webp differ
diff --git a/public/docs/img/asl-alphabet-hero.webp b/public/docs/img/asl-alphabet-hero.webp
new file mode 100644
index 000000000..f66363f50
Binary files /dev/null and b/public/docs/img/asl-alphabet-hero.webp differ
diff --git a/public/docs/img/avatar-studio.webp b/public/docs/img/avatar-studio.webp
new file mode 100644
index 000000000..8b46c225e
Binary files /dev/null and b/public/docs/img/avatar-studio.webp differ
diff --git a/public/docs/img/character-library.webp b/public/docs/img/character-library.webp
new file mode 100644
index 000000000..7966d7ca8
Binary files /dev/null and b/public/docs/img/character-library.webp differ
diff --git a/public/docs/img/cookbook/mcp-3d-tool/img-cookbook-posters-mcp-3d-tool-60b43c2b.webp b/public/docs/img/cookbook/mcp-3d-tool/img-cookbook-posters-mcp-3d-tool-60b43c2b.webp
new file mode 100644
index 000000000..4d7a1db75
Binary files /dev/null and b/public/docs/img/cookbook/mcp-3d-tool/img-cookbook-posters-mcp-3d-tool-60b43c2b.webp differ
diff --git a/public/docs/img/cookbook/parallel-asset-pack/img-cookbook-media-pipeline-studio-midrun-4d8ae193.webp b/public/docs/img/cookbook/parallel-asset-pack/img-cookbook-media-pipeline-studio-midrun-4d8ae193.webp
new file mode 100644
index 000000000..e8337c541
Binary files /dev/null and b/public/docs/img/cookbook/parallel-asset-pack/img-cookbook-media-pipeline-studio-midrun-4d8ae193.webp differ
diff --git a/public/docs/img/cookbook/parallel-asset-pack/page-cookbook-pipeline-8f57827b.webp b/public/docs/img/cookbook/parallel-asset-pack/page-cookbook-pipeline-8f57827b.webp
new file mode 100644
index 000000000..fe85aa420
Binary files /dev/null and b/public/docs/img/cookbook/parallel-asset-pack/page-cookbook-pipeline-8f57827b.webp differ
diff --git a/public/docs/img/docs-world-loop.webp b/public/docs/img/docs-world-loop.webp
new file mode 100644
index 000000000..87354f01f
Binary files /dev/null and b/public/docs/img/docs-world-loop.webp differ
diff --git a/public/docs/img/docs-world-plaza.png b/public/docs/img/docs-world-plaza.png
new file mode 100644
index 000000000..70491b211
Binary files /dev/null and b/public/docs/img/docs-world-plaza.png differ
diff --git a/public/docs/img/forge-hero.webp b/public/docs/img/forge-hero.webp
new file mode 100644
index 000000000..a0ebab134
Binary files /dev/null and b/public/docs/img/forge-hero.webp differ
diff --git a/public/docs/img/forge-prompt-panel.webp b/public/docs/img/forge-prompt-panel.webp
new file mode 100644
index 000000000..9e65ea855
Binary files /dev/null and b/public/docs/img/forge-prompt-panel.webp differ
diff --git a/public/docs/img/gallery-grid.webp b/public/docs/img/gallery-grid.webp
new file mode 100644
index 000000000..0d55334d3
Binary files /dev/null and b/public/docs/img/gallery-grid.webp differ
diff --git a/public/docs/img/guides/docs-sidebar.png b/public/docs/img/guides/docs-sidebar.png
index 63d2b676c..1e6cc0d68 100644
Binary files a/public/docs/img/guides/docs-sidebar.png and b/public/docs/img/guides/docs-sidebar.png differ
diff --git a/public/docs/img/guides/forge-compose.png b/public/docs/img/guides/forge-compose.png
index 74e8b061e..7463ec8bd 100644
Binary files a/public/docs/img/guides/forge-compose.png and b/public/docs/img/guides/forge-compose.png differ
diff --git a/public/docs/img/guides/forge-stage.png b/public/docs/img/guides/forge-stage.png
index e2638dc54..d5e9fc1e3 100644
Binary files a/public/docs/img/guides/forge-stage.png and b/public/docs/img/guides/forge-stage.png differ
diff --git a/public/docs/img/image-to-3d-page.webp b/public/docs/img/image-to-3d-page.webp
new file mode 100644
index 000000000..4583ec37f
Binary files /dev/null and b/public/docs/img/image-to-3d-page.webp differ
diff --git a/public/docs/img/live-step-message.png b/public/docs/img/live-step-message.png
new file mode 100644
index 000000000..d998b5884
Binary files /dev/null and b/public/docs/img/live-step-message.png differ
diff --git a/public/docs/img/live-step-nonce-light.png b/public/docs/img/live-step-nonce-light.png
new file mode 100644
index 000000000..362b12163
Binary files /dev/null and b/public/docs/img/live-step-nonce-light.png differ
diff --git a/public/docs/img/live-step-nonce.png b/public/docs/img/live-step-nonce.png
new file mode 100644
index 000000000..2ca7624e4
Binary files /dev/null and b/public/docs/img/live-step-nonce.png differ
diff --git a/public/docs/img/live-steps-page.png b/public/docs/img/live-steps-page.png
new file mode 100644
index 000000000..bd7248d91
Binary files /dev/null and b/public/docs/img/live-steps-page.png differ
diff --git a/public/docs/img/marketplace-grid.webp b/public/docs/img/marketplace-grid.webp
new file mode 100644
index 000000000..fea486f5a
Binary files /dev/null and b/public/docs/img/marketplace-grid.webp differ
diff --git a/public/docs/img/names-claim.webp b/public/docs/img/names-claim.webp
new file mode 100644
index 000000000..6e6bcc58f
Binary files /dev/null and b/public/docs/img/names-claim.webp differ
diff --git a/public/docs/img/sign-api-console.webp b/public/docs/img/sign-api-console.webp
new file mode 100644
index 000000000..c420a419d
Binary files /dev/null and b/public/docs/img/sign-api-console.webp differ
diff --git a/public/docs/img/sign-language-hero.webp b/public/docs/img/sign-language-hero.webp
new file mode 100644
index 000000000..7bfa57ff9
Binary files /dev/null and b/public/docs/img/sign-language-hero.webp differ
diff --git a/public/docs/img/skills-marketplace.webp b/public/docs/img/skills-marketplace.webp
new file mode 100644
index 000000000..7670f4ba4
Binary files /dev/null and b/public/docs/img/skills-marketplace.webp differ
diff --git a/public/docs/img/tutorials/animate-your-avatar/page-pose-6e5f8fe8.webp b/public/docs/img/tutorials/animate-your-avatar/page-pose-6e5f8fe8.webp
index 664bf54aa..fb47c470d 100644
Binary files a/public/docs/img/tutorials/animate-your-avatar/page-pose-6e5f8fe8.webp and b/public/docs/img/tutorials/animate-your-avatar/page-pose-6e5f8fe8.webp differ
diff --git a/public/docs/img/tutorials/asset-quality-gate/img-cookbook-posters-asset-quality-gate-069e8e19.webp b/public/docs/img/tutorials/asset-quality-gate/img-cookbook-posters-asset-quality-gate-069e8e19.webp
new file mode 100644
index 000000000..60d5ca1a3
Binary files /dev/null and b/public/docs/img/tutorials/asset-quality-gate/img-cookbook-posters-asset-quality-gate-069e8e19.webp differ
diff --git a/public/docs/img/tutorials/build-a-3d-asset-pipeline/img-cookbook-media-pipeline-studio-run-98798603.webp b/public/docs/img/tutorials/build-a-3d-asset-pipeline/img-cookbook-media-pipeline-studio-run-98798603.webp
new file mode 100644
index 000000000..5c8662680
Binary files /dev/null and b/public/docs/img/tutorials/build-a-3d-asset-pipeline/img-cookbook-media-pipeline-studio-run-98798603.webp differ
diff --git a/public/docs/img/tutorials/build-a-3d-asset-pipeline/img-cookbook-posters-parallel-asset-pack-7684e4ca.webp b/public/docs/img/tutorials/build-a-3d-asset-pipeline/img-cookbook-posters-parallel-asset-pack-7684e4ca.webp
new file mode 100644
index 000000000..7e2ec08ad
Binary files /dev/null and b/public/docs/img/tutorials/build-a-3d-asset-pipeline/img-cookbook-posters-parallel-asset-pack-7684e4ca.webp differ
diff --git a/public/docs/img/tutorials/build-a-3d-asset-pipeline/img-cookbook-posters-text-to-3d-cli-f6ecf6ba.webp b/public/docs/img/tutorials/build-a-3d-asset-pipeline/img-cookbook-posters-text-to-3d-cli-f6ecf6ba.webp
new file mode 100644
index 000000000..e7e729641
Binary files /dev/null and b/public/docs/img/tutorials/build-a-3d-asset-pipeline/img-cookbook-posters-text-to-3d-cli-f6ecf6ba.webp differ
diff --git a/public/docs/img/tutorials/build-a-3d-asset-pipeline/page-cookbook-pipeline-82cc7dc1.webp b/public/docs/img/tutorials/build-a-3d-asset-pipeline/page-cookbook-pipeline-82cc7dc1.webp
new file mode 100644
index 000000000..023cd0718
Binary files /dev/null and b/public/docs/img/tutorials/build-a-3d-asset-pipeline/page-cookbook-pipeline-82cc7dc1.webp differ
diff --git a/public/docs/img/tutorials/embed-in-30-seconds/page-create-c95f4de2.webp b/public/docs/img/tutorials/embed-in-30-seconds/page-create-c95f4de2.webp
index 2eb127b2e..22e7c7cc3 100644
Binary files a/public/docs/img/tutorials/embed-in-30-seconds/page-create-c95f4de2.webp and b/public/docs/img/tutorials/embed-in-30-seconds/page-create-c95f4de2.webp differ
diff --git a/public/docs/img/tutorials/explore-docs-world/page-docs-world-98864ac3.webp b/public/docs/img/tutorials/explore-docs-world/page-docs-world-98864ac3.webp
index 1cc4de2b6..bf34a3079 100644
Binary files a/public/docs/img/tutorials/explore-docs-world/page-docs-world-98864ac3.webp and b/public/docs/img/tutorials/explore-docs-world/page-docs-world-98864ac3.webp differ
diff --git a/public/docs/img/tutorials/text-to-3d/page-forge-be755d6a.webp b/public/docs/img/tutorials/text-to-3d/page-forge-be755d6a.webp
index 1eeda33a6..0e04ee447 100644
Binary files a/public/docs/img/tutorials/text-to-3d/page-forge-be755d6a.webp and b/public/docs/img/tutorials/text-to-3d/page-forge-be755d6a.webp differ
diff --git a/public/docs/img/voice-lab.webp b/public/docs/img/voice-lab.webp
new file mode 100644
index 000000000..b88f98270
Binary files /dev/null and b/public/docs/img/voice-lab.webp differ
diff --git a/public/docs/img/walk-loop.webp b/public/docs/img/walk-loop.webp
new file mode 100644
index 000000000..1194eadd1
Binary files /dev/null and b/public/docs/img/walk-loop.webp differ
diff --git a/public/docs/img/walk-mobile.webp b/public/docs/img/walk-mobile.webp
new file mode 100644
index 000000000..d50ae931e
Binary files /dev/null and b/public/docs/img/walk-mobile.webp differ
diff --git a/public/docs/img/wallet-deposit-arrived.png b/public/docs/img/wallet-deposit-arrived.png
new file mode 100644
index 000000000..29f5f2d79
Binary files /dev/null and b/public/docs/img/wallet-deposit-arrived.png differ
diff --git a/public/docs/img/wallet-deposit-desktop.png b/public/docs/img/wallet-deposit-desktop.png
new file mode 100644
index 000000000..54e947852
Binary files /dev/null and b/public/docs/img/wallet-deposit-desktop.png differ
diff --git a/public/docs/img/wallet-deposit-mobile.png b/public/docs/img/wallet-deposit-mobile.png
new file mode 100644
index 000000000..59456b58b
Binary files /dev/null and b/public/docs/img/wallet-deposit-mobile.png differ
diff --git a/public/docs/img/wallet-deposit-usdc-desktop.png b/public/docs/img/wallet-deposit-usdc-desktop.png
new file mode 100644
index 000000000..8b39bc758
Binary files /dev/null and b/public/docs/img/wallet-deposit-usdc-desktop.png differ
diff --git a/public/docs/img/wallet-signed-out-desktop.png b/public/docs/img/wallet-signed-out-desktop.png
new file mode 100644
index 000000000..c337433ab
Binary files /dev/null and b/public/docs/img/wallet-signed-out-desktop.png differ
diff --git a/public/docs/img/wallet-signed-out-mobile.png b/public/docs/img/wallet-signed-out-mobile.png
new file mode 100644
index 000000000..42f23a7b7
Binary files /dev/null and b/public/docs/img/wallet-signed-out-mobile.png differ
diff --git a/public/docs/img/widget-studio.webp b/public/docs/img/widget-studio.webp
new file mode 100644
index 000000000..683062ca3
Binary files /dev/null and b/public/docs/img/widget-studio.webp differ
diff --git a/public/docs/media-manifest.json b/public/docs/media-manifest.json
index 0d87bfbe5..35ac91864 100644
--- a/public/docs/media-manifest.json
+++ b/public/docs/media-manifest.json
@@ -1,7 +1,233 @@
{
"generatedBy": "scripts/capture-doc-media.mjs",
- "generatedAt": "2026-07-31T06:28:53.164Z",
+ "generatedAt": "2026-07-31T19:25:22.123Z",
"shots": {
+ "animation-studio": {
+ "id": "animation-studio",
+ "src": "/docs/img/animation-studio.webp",
+ "alt": "The Animation Studio timeline with an avatar mid-clip",
+ "caption": "Animation Studio drives the same canonical clip library the embeds use.",
+ "route": "/pose",
+ "viewport": "desktop",
+ "animated": false,
+ "capturedAt": "2026-07-31T18:42:19.922Z",
+ "capturedFrom": "https://three.ws",
+ "commit": "b06fc2cf2",
+ "sha256": "059b4aabff5026c09c4a2ea7d1659c6d08fbd53de1da825683c7f6bcbebe592c",
+ "bytes": 103106,
+ "width": 1800,
+ "height": 1125
+ },
+ "asl-alphabet-hero": {
+ "id": "asl-alphabet-hero",
+ "src": "/docs/img/asl-alphabet-hero.webp",
+ "alt": "A rigged 3D avatar forming a letter of the American manual alphabet, beside that letter's description and the speed and signing-hand controls",
+ "caption": "Every letter of the manual alphabet on a hand you can turn around.",
+ "route": "/asl-alphabet",
+ "viewport": "desktop",
+ "animated": false,
+ "capturedAt": "2026-07-31T19:24:07.303Z",
+ "capturedFrom": "http://localhost:3151",
+ "commit": "ae51c09a3",
+ "sha256": "cdf5b73e3580f2f41fc0d31c83923fd20961d5c0d47bd61d17e6f1db44f4baa5",
+ "bytes": 82240,
+ "width": 1800,
+ "height": 1170
+ },
+ "avatar-studio": {
+ "id": "avatar-studio",
+ "src": "/docs/img/avatar-studio.webp",
+ "alt": "The three.ws Avatar Studio with a rigged avatar in the viewport and the customisation rail",
+ "caption": "Avatar Studio: the rig on the left, every appearance control on the right.",
+ "route": "/avatar-studio",
+ "viewport": "desktop",
+ "animated": false,
+ "capturedAt": "2026-07-31T18:42:37.659Z",
+ "capturedFrom": "https://three.ws",
+ "commit": "b06fc2cf2",
+ "sha256": "59dfc28f25457134d998462c492d96cd1107a0ac0ffa06220ea5bfb89b678285",
+ "bytes": 78064,
+ "width": 1800,
+ "height": 1125
+ },
+ "character-library": {
+ "id": "character-library",
+ "src": "/docs/img/character-library.webp",
+ "alt": "The character library grid of ready-to-use rigged characters",
+ "caption": "Every character here is a real rigged GLB you can embed as-is.",
+ "route": "/character-library",
+ "viewport": "desktop",
+ "animated": false,
+ "capturedAt": "2026-07-31T18:45:06.328Z",
+ "capturedFrom": "https://three.ws",
+ "commit": "b06fc2cf2",
+ "sha256": "7af8c6e7c5332fb0779ba30888a6ba0bbd03575df1972846831ff1dff27c0999",
+ "bytes": 55008,
+ "width": 1280,
+ "height": 800
+ },
+ "docs-world-loop": {
+ "id": "docs-world-loop",
+ "src": "/docs/img/docs-world-loop.webp",
+ "alt": "Animated loop of the 3D Docs World with the guide avatar on the plaza",
+ "caption": "The documentation as a place you can walk through.",
+ "route": "/docs/world",
+ "viewport": "desktop",
+ "animated": true,
+ "capturedAt": "2026-07-31T19:25:02.093Z",
+ "capturedFrom": "https://three.ws",
+ "commit": "b06fc2cf2",
+ "sha256": "afde12cc2912c0dbc26b289f20f5467537f402df13fbe9cc09546ff9109fa1a9",
+ "bytes": 268152,
+ "width": 1800,
+ "height": 1126,
+ "frames": 36,
+ "fps": 12
+ },
+ "forge-hero": {
+ "id": "forge-hero",
+ "src": "/docs/img/forge-hero.webp",
+ "alt": "The Forge page showing text and image to 3D generation options",
+ "caption": "The Forge accepts a sentence or an image and returns a textured GLB.",
+ "route": "/forge",
+ "viewport": "desktop",
+ "animated": false,
+ "capturedAt": "2026-07-31T18:41:38.532Z",
+ "capturedFrom": "https://three.ws",
+ "commit": "b06fc2cf2",
+ "sha256": "c91e1d36d13f6fd80432a7d00634ff45074f1be3238fb0dd9f7de679edab7ec9",
+ "bytes": 82762,
+ "width": 1800,
+ "height": 1125
+ },
+ "forge-prompt-panel": {
+ "id": "forge-prompt-panel",
+ "src": "/docs/img/forge-prompt-panel.webp",
+ "alt": "The three.ws prompt-to-3D page with the description field and quality tier picker",
+ "caption": "Describe it to 3D: the prompt field and the tier picker are the whole interface.",
+ "route": "/create/prompt",
+ "viewport": "desktop",
+ "animated": false,
+ "capturedAt": "2026-07-31T18:41:39.162Z",
+ "capturedFrom": "https://three.ws",
+ "commit": "b06fc2cf2",
+ "sha256": "dc7ca39591668c40dcaa1c160fab69178498b98bdccc63f267fb13989fc016bd",
+ "bytes": 75596,
+ "width": 1800,
+ "height": 1125
+ },
+ "gallery-grid": {
+ "id": "gallery-grid",
+ "src": "/docs/img/gallery-grid.webp",
+ "alt": "The public avatar gallery grid",
+ "caption": "Every avatar in the gallery is a real GLB with a public render URL.",
+ "route": "/gallery",
+ "viewport": "desktop",
+ "animated": false,
+ "capturedAt": "2026-07-31T18:49:20.092Z",
+ "capturedFrom": "https://three.ws",
+ "commit": "b06fc2cf2",
+ "sha256": "d0f0462a15235128e1e47b3e1fb40e021ff7733f453de666b0324cbf7fbb1660",
+ "bytes": 39018,
+ "width": 1280,
+ "height": 800
+ },
+ "image-to-3d-page": {
+ "id": "image-to-3d-page",
+ "src": "/docs/img/image-to-3d-page.webp",
+ "alt": "The image-to-3D page with its upload dropzone",
+ "caption": "Drop a photo here and the same pipeline returns a mesh instead of a render.",
+ "route": "/image-to-3d",
+ "viewport": "desktop",
+ "animated": false,
+ "capturedAt": "2026-07-31T18:41:52.905Z",
+ "capturedFrom": "https://three.ws",
+ "commit": "b06fc2cf2",
+ "sha256": "cc45c3f6c717189208aa4cd0c09bc9de605183c83e791323b3bd52077f8baf7f",
+ "bytes": 77736,
+ "width": 1800,
+ "height": 1125
+ },
+ "marketplace-grid": {
+ "id": "marketplace-grid",
+ "src": "/docs/img/marketplace-grid.webp",
+ "alt": "The three.ws marketplace grid of published agents",
+ "caption": "Published agents land here, forkable by anyone.",
+ "route": "/marketplace",
+ "viewport": "desktop",
+ "animated": false,
+ "capturedAt": "2026-07-31T18:45:05.542Z",
+ "capturedFrom": "https://three.ws",
+ "commit": "b06fc2cf2",
+ "sha256": "35f2fd6f8dc06ea1b39c785f2e20d0f680dc01ff55540b7cd7740032df298131",
+ "bytes": 58496,
+ "width": 1280,
+ "height": 800
+ },
+ "names-claim": {
+ "id": "names-claim",
+ "src": "/docs/img/names-claim.webp",
+ "alt": "The threews.sol subdomain claim page with the name availability field",
+ "caption": "Claiming a name is one field and one signature.",
+ "route": "/threews/claim",
+ "viewport": "desktop",
+ "animated": false,
+ "capturedAt": "2026-07-31T18:48:53.632Z",
+ "capturedFrom": "https://three.ws",
+ "commit": "b06fc2cf2",
+ "sha256": "c72f468e64385b7eabbf7b93fd677fee8e3b26e6e9109e58cb75cb8626385d42",
+ "bytes": 65548,
+ "width": 1800,
+ "height": 1125
+ },
+ "sign-api-console": {
+ "id": "sign-api-console",
+ "src": "/docs/img/sign-api-console.webp",
+ "alt": "The sign API console on three.ws: the phrase \"happy to meet you\" compiled into four timeline blocks, happy, to, meet, you, with the spelled word broken into its letters, above the duration, signed and fingerspelled counts",
+ "caption": "One real request to /api/sign, drawn as the performance it returns. Filled blocks are lexical signs; the outlined one is fingerspelled, letter by letter.",
+ "route": "/sign-language",
+ "viewport": "desktop",
+ "animated": false,
+ "capturedAt": "2026-07-31T19:14:50.211Z",
+ "capturedFrom": "http://localhost:3151",
+ "commit": "ae51c09a3",
+ "sha256": "f633b4e377477c9ca3b7cb8b88b49fb91667639e76debb09f9f6241bdd3457e5",
+ "bytes": 116166,
+ "width": 1800,
+ "height": 1294
+ },
+ "sign-language-hero": {
+ "id": "sign-language-hero",
+ "src": "/docs/img/sign-language-hero.webp",
+ "alt": "A rigged 3D avatar mid-sign on the three.ws sign-language page, beside the phrase input and the speed and signing-hand controls",
+ "caption": "Type anything: the avatar signs the words it has signs for and spells the rest.",
+ "route": "/sign-language",
+ "viewport": "desktop",
+ "animated": false,
+ "capturedAt": "2026-07-31T19:23:36.842Z",
+ "capturedFrom": "http://localhost:3151",
+ "commit": "ae51c09a3",
+ "sha256": "9d31a2dc7fe666666f1d1cb17a81c0f3bdcbaa0e54b4eca9b6a76a62f92cb633",
+ "bytes": 78550,
+ "width": 1800,
+ "height": 1262
+ },
+ "skills-marketplace": {
+ "id": "skills-marketplace",
+ "src": "/docs/img/skills-marketplace.webp",
+ "alt": "The skills marketplace listing paid and free agent skills",
+ "caption": "Skills are sold, trialled and installed from this catalogue.",
+ "route": "/skills",
+ "viewport": "desktop",
+ "animated": false,
+ "capturedAt": "2026-07-31T18:44:00.909Z",
+ "capturedFrom": "https://three.ws",
+ "commit": "b06fc2cf2",
+ "sha256": "8ffb8c24dfd3ce9124deb903cbde423fd93d40a470d785e3052196fe7bb17556",
+ "bytes": 81450,
+ "width": 1280,
+ "height": 800
+ },
"start-checklist": {
"id": "start-checklist",
"src": "/docs/img/start-checklist.webp",
@@ -10,13 +236,79 @@
"route": "/start",
"viewport": "desktop",
"animated": false,
- "capturedAt": "2026-07-31T06:26:37.985Z",
- "capturedFrom": "http://localhost:3000",
- "commit": "75883898b",
+ "capturedAt": "2026-07-31T18:42:02.855Z",
+ "capturedFrom": "https://three.ws",
+ "commit": "b06fc2cf2",
"sha256": "57f49a4e06061c0f50ea15ee04f72fc65d76318bdef17bda4cae94a2242abde3",
"bytes": 64358,
"width": 1800,
"height": 1125
+ },
+ "voice-lab": {
+ "id": "voice-lab",
+ "src": "/docs/img/voice-lab.webp",
+ "alt": "The Voice Lab page with the voice catalogue and preview controls",
+ "caption": "Voice Lab previews every voice the speech and lipsync stack can drive.",
+ "route": "/voice",
+ "viewport": "desktop",
+ "animated": false,
+ "capturedAt": "2026-07-31T18:46:29.484Z",
+ "capturedFrom": "https://three.ws",
+ "commit": "b06fc2cf2",
+ "sha256": "8dfe5df54e47e827fc09d768f44ee8dd04c4250c843586ba39e82cfa7fae2723",
+ "bytes": 62418,
+ "width": 1800,
+ "height": 1125
+ },
+ "walk-loop": {
+ "id": "walk-loop",
+ "src": "/docs/img/walk-loop.webp",
+ "alt": "Animated loop of a three.ws avatar walking in the Walk experience",
+ "caption": "Captured live: the default rig running the canonical walk clip.",
+ "route": "/walk",
+ "viewport": "desktop",
+ "animated": true,
+ "capturedAt": "2026-07-31T19:25:16.576Z",
+ "capturedFrom": "https://three.ws",
+ "commit": "b06fc2cf2",
+ "sha256": "d2bd20454f109fcc3e89ccba63185f8f4e6b5f3dfa690eb9cd93d0f31b954f14",
+ "bytes": 399000,
+ "width": 1280,
+ "height": 800,
+ "frames": 36,
+ "fps": 12
+ },
+ "walk-mobile": {
+ "id": "walk-mobile",
+ "src": "/docs/img/walk-mobile.webp",
+ "alt": "The Walk experience on a phone-sized viewport with the avatar on screen",
+ "caption": "Walk on a phone: the same rig, the same clips, thumb-sized controls.",
+ "route": "/walk",
+ "viewport": "mobile",
+ "animated": false,
+ "capturedAt": "2026-07-31T18:50:47.471Z",
+ "capturedFrom": "https://three.ws",
+ "commit": "b06fc2cf2",
+ "sha256": "9e195ea5c5b73f6f3584db20e8f9a0e1e465b0fd134d7bbab2b544973780cf63",
+ "bytes": 31208,
+ "width": 390,
+ "height": 844
+ },
+ "widget-studio": {
+ "id": "widget-studio",
+ "src": "/docs/img/widget-studio.webp",
+ "alt": "The Widget Studio configurator with a live avatar preview and generated embed code",
+ "caption": "Widget Studio writes the embed snippet while you watch the result.",
+ "route": "/studio",
+ "viewport": "desktop",
+ "animated": false,
+ "capturedAt": "2026-07-31T18:48:17.595Z",
+ "capturedFrom": "https://three.ws",
+ "commit": "b06fc2cf2",
+ "sha256": "a73f63779355103ebfa633ae77538d43fab6f15ae61b2c63bf8ec8d5ae8aa44a",
+ "bytes": 80046,
+ "width": 1800,
+ "height": 1125
}
}
}
diff --git a/public/tutorial-figures.css b/public/tutorial-figures.css
index 2b4569c48..2827d0448 100644
--- a/public/tutorial-figures.css
+++ b/public/tutorial-figures.css
@@ -238,9 +238,12 @@
/* ── Lightbox ──────────────────────────────────────────────── */
+/* The viewers that host figures unlock scrolling with their own `overflow: auto
+ !important` on <html> and <body>, so the modal lock has to answer in kind or
+ the page scrolls away underneath an open lightbox. */
html.tfig-lb-open,
html.tfig-lb-open body {
- overflow: hidden;
+ overflow: hidden !important;
}
.tfig-lightbox {
diff --git a/public/tutorial-figures.js b/public/tutorial-figures.js
index 42f9fa8f3..480c355fd 100644
--- a/public/tutorial-figures.js
+++ b/public/tutorial-figures.js
@@ -8,10 +8,16 @@
* ![Michelle, the default rigged avatar](figure:glb:/avatars/michelle.glb)
* ![Drag to orbit the model](figure:live:/avatars/michelle.glb)
*
- * marked turns that into <img src="figure:page:/forge">, which no browser can
- * load. This script runs immediately after the parse and swaps each one for a
- * <figure>: a numbered caption, an intrinsic-size box so the page never shifts,
- * a blurred placeholder that resolves into the real capture, and click-to-zoom.
+ * Left alone, marked turns that into <img src="figure:page:/forge">, and the
+ * browser immediately tries to fetch it: one guaranteed-failing request per
+ * figure and an ERR_UNKNOWN_URL_SCHEME in the console before any script gets a
+ * chance to intervene. So the directives are rewritten to inert slot elements
+ * BEFORE the parse (preprocess), and mount() fills those slots afterwards with
+ * a <figure>: a numbered caption, an intrinsic-size box so the page never
+ * shifts, a blurred placeholder that resolves into the real capture, and
+ * click-to-zoom. mount() still upgrades a raw <img src="figure:…"> if one
+ * reaches the DOM, so a viewer that forgets to preprocess degrades to the old
+ * behaviour rather than showing nothing.
*
* Media comes from /tutorial-media.json, written by
* scripts/capture-tutorial-media.mjs from real screenshots of the deployed site
@@ -28,6 +34,26 @@
var MANIFEST_URL = '/tutorial-media.json';
var manifestPromise = null;
+ // ![caption](figure:kind:/target?opts) anywhere in the markdown source.
+ var DIRECTIVE_RE = /!\[([^\]]*)\]\((figure:[^)\s]+)\)/g;
+
+ function escapeAttr(value) {
+ return String(value).replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
+ }
+
+ /**
+ * Rewrite figure directives into inert slots. Call this on the raw markdown
+ * before handing it to marked; the slot is block-level HTML, so marked leaves
+ * it alone instead of wrapping it in a paragraph.
+ */
+ function preprocess(markdown) {
+ if (typeof markdown !== 'string' || markdown.indexOf('figure:') === -1) return markdown;
+ return markdown.replace(DIRECTIVE_RE, function (whole, alt, raw) {
+ if (!alt.trim()) return whole;
+ return '<div class="tfig-slot" data-figure="' + escapeAttr(raw) + '" data-alt="' + escapeAttr(alt.trim()) + '"></div>';
+ });
+ }
+
function loadManifest() {
if (!manifestPromise) {
manifestPromise = fetch(MANIFEST_URL, { headers: { accept: 'application/json' } })
@@ -155,12 +181,11 @@
return frame;
}
- function mountFigure(img, record, index, lightbox) {
- var raw = img.getAttribute('src') || '';
+ function mountFigure(raw, altText, record, index, lightbox) {
var directive = parseDirective(raw);
if (!directive) return null;
- var alt = (img.getAttribute('alt') || '').trim() || 'Figure ' + index;
+ var alt = (altText || '').trim() || 'Figure ' + index;
var figure = el('figure', 'tfig');
figure.id = 'figure-' + index;
var body = el('div', 'tfig-body');
@@ -320,32 +345,53 @@
// ── Mount ──────────────────────────────────────────────────────────────────
+ /**
+ * Collect the placeholders left for us, in document order, whichever form
+ * they arrived in: the slots preprocess() wrote, and any raw <img> from a
+ * viewer that parsed the markdown without preprocessing it.
+ */
+ function collectPlaceholders(article) {
+ return Array.prototype.slice
+ .call(article.querySelectorAll('.tfig-slot[data-figure], img[src^="figure:"]'))
+ .map(function (node) {
+ var isSlot = node.classList && node.classList.contains('tfig-slot');
+ return {
+ node: node,
+ raw: isSlot ? node.getAttribute('data-figure') : node.getAttribute('src') || '',
+ alt: isSlot ? node.getAttribute('data-alt') : node.getAttribute('alt') || '',
+ // marked wraps a lone image in a paragraph, and a <figure> inside a
+ // <p> is invalid markup the browser will hoist out. Replace the
+ // wrapper instead. Slots are block-level already and never wrapped.
+ target:
+ !isSlot && node.parentElement && node.parentElement.tagName === 'P' && node.parentElement.childNodes.length === 1
+ ? node.parentElement
+ : node,
+ };
+ });
+ }
+
function mount(article) {
if (!article) return Promise.resolve(0);
- var placeholders = Array.prototype.slice.call(article.querySelectorAll('img[src^="figure:"]'));
+ var placeholders = collectPlaceholders(article);
if (!placeholders.length) return Promise.resolve(0);
return loadManifest().then(function (figures) {
- var lightbox = document.querySelector('.tfig-lightbox') ? null : createLightbox();
- if (lightbox) document.body.appendChild(lightbox.node);
- else lightbox = window.__tfigLightbox;
- window.__tfigLightbox = lightbox;
+ var lightbox = window.__tfigLightbox;
+ if (!lightbox) {
+ lightbox = createLightbox();
+ document.body.appendChild(lightbox.node);
+ window.__tfigLightbox = lightbox;
+ }
var mounted = 0;
- placeholders.forEach(function (img, i) {
- var raw = img.getAttribute('src') || '';
+ placeholders.forEach(function (slot, i) {
var index = i + 1;
- var built = mountFigure(img, figures[raw], index, lightbox);
+ var built = mountFigure(slot.raw, slot.alt, figures[slot.raw], index, lightbox);
if (!built) {
- img.remove();
+ slot.target.remove();
return;
}
- // marked wraps a lone image in a paragraph; a <figure> inside a <p>
- // is invalid and the browser will hoist it, so replace the wrapper.
- var host = img.parentElement;
- var replaceTarget =
- host && host.tagName === 'P' && host.childNodes.length === 1 ? host : img;
- replaceTarget.replaceWith(built.figure);
+ slot.target.replaceWith(built.figure);
if (built.record && built.record.src && built.kind !== 'live') {
lightbox.register({
figureIndex: index,
@@ -359,5 +405,5 @@
});
}
- window.tutorialFigures = { mount: mount };
+ window.tutorialFigures = { mount: mount, preprocess: preprocess };
})();
diff --git a/public/tutorial-media.json b/public/tutorial-media.json
index 40af4c761..e5e631b21 100644
--- a/public/tutorial-media.json
+++ b/public/tutorial-media.json
@@ -2,8 +2,8 @@
"$comment": "GENERATED by scripts/capture-tutorial-media.mjs. Do not edit; run `npm run tutorials:media`.",
"base": "https://three.ws",
"site": "https://three.ws",
- "commit": "56c50559f9907778747340d1e9fea105c54148f1",
- "capturedAt": "2026-07-31T06:38:18.622Z",
+ "commit": "e83f0ca0f70eb6255acbcfa38d939aa3d51ca160",
+ "capturedAt": "2026-07-31T19:05:54.099Z",
"figures": {
"figure:glb:/avatars/michelle.glb?w=1200&h=1000": {
"kind": "glb",
@@ -12,16 +12,93 @@
"height": 1000,
"placeholder": "data:image/webp;base64,UklGRnYBAABXRUJQVlA4WAoAAAAQAAAAEwAAEAAAQUxQSKsAAAANuTJE9D80cBxJcuScoAL5/5dqrTlvqMa5VyjajRp3sMKdsehETMAEbOL7iXNn3t279r91Yd3Br3yT6Wcv6h4t8htptFfUrZoOwsT3qT0gLtXVjyKI72YoGvspAYT8gx2s1LGPMfwToGn8sanFwK/UhAxNQqAwwYM6D3affgMFA6MBLnAqNGXaKHVjx1S7XGBEg68ARCFlADnCJWBMTskoNj0hj1mGCWQ1fgYAVlA4IKQAAABwBACdASoUABEAPu1sq1EppaOiqAqpMB2JbAC7DBIwFBkNwqlW4MfaCN6ACAD+pfdBIUKtq4ZKOGmfHKZE+8jwHoBSisvAx9TLrP2Pz1tEvO2DZuxrACcmfgbAPD58BWiRKnEfp/dLEgItbjBBtsjKG3rsC7zP5aRP/+8ie0XTDbzWMvfo6mGKrkQ/4HmHFZUfQywDhDc6kuALwFcsQPui1gAAAA==",
"source": "https://three.ws/avatars/michelle.glb",
- "tutorials": [
+ "collection": "tutorials",
+ "docs": [
"render-avatar-images"
]
},
+ "figure:img:/cookbook/media/pipeline-studio-midrun.png": {
+ "kind": "img",
+ "src": "/docs/img/cookbook/parallel-asset-pack/img-cookbook-media-pipeline-studio-midrun-4d8ae193.webp",
+ "width": 1760,
+ "height": 1256,
+ "placeholder": "data:image/webp;base64,UklGRj4AAABXRUJQVlA4IDIAAAAQAwCdASoUAA4APu1oqk6ppiQiMAgBMB2JaQAAetFV2AAA/vA7u8XDfmXObRIIhSAAAA==",
+ "source": "https://three.ws/cookbook/media/pipeline-studio-midrun.png",
+ "collection": "cookbook",
+ "docs": [
+ "parallel-asset-pack"
+ ]
+ },
+ "figure:img:/cookbook/media/pipeline-studio-run.png": {
+ "kind": "img",
+ "src": "/docs/img/tutorials/build-a-3d-asset-pipeline/img-cookbook-media-pipeline-studio-run-98798603.webp",
+ "width": 2640,
+ "height": 2970,
+ "placeholder": "data:image/webp;base64,UklGRk4AAABXRUJQVlA4IEIAAACQAwCdASoUABcAPu1wr1KppiQiqAgBMB2JaQAALnZWLSvZF13gAP7w1Kmvjm25Vdv/68UpV/7OxeLGV9zpys4AAAA=",
+ "source": "https://three.ws/cookbook/media/pipeline-studio-run.png",
+ "collection": "tutorials",
+ "docs": [
+ "build-a-3d-asset-pipeline"
+ ]
+ },
+ "figure:img:/cookbook/posters/asset-quality-gate.png": {
+ "kind": "img",
+ "src": "/docs/img/tutorials/asset-quality-gate/img-cookbook-posters-asset-quality-gate-069e8e19.webp",
+ "width": 1200,
+ "height": 675,
+ "placeholder": "data:image/webp;base64,UklGRk4AAABXRUJQVlA4IEIAAACQAwCdASoUAAsAPu1iqU2ppaOiMAgBMB2JZQC+SCG8muSyoIBAAP7yq6Vr2vdgwycu4oISUHIGjit5teFAL1/BAAA=",
+ "source": "https://three.ws/cookbook/posters/asset-quality-gate.png",
+ "collection": "tutorials",
+ "docs": [
+ "asset-quality-gate",
+ "build-a-3d-asset-pipeline"
+ ]
+ },
+ "figure:img:/cookbook/posters/mcp-3d-tool.png": {
+ "kind": "img",
+ "src": "/docs/img/cookbook/mcp-3d-tool/img-cookbook-posters-mcp-3d-tool-60b43c2b.webp",
+ "width": 1200,
+ "height": 675,
+ "placeholder": "data:image/webp;base64,UklGRkIAAABXRUJQVlA4IDYAAAAwAwCdASoUAAsAPu1iqU2ppaOiMAgBMB2JaQAAWlwL9C2AAP7yse96bmhNBSoERVy2rOKgAAA=",
+ "source": "https://three.ws/cookbook/posters/mcp-3d-tool.png",
+ "collection": "cookbook",
+ "docs": [
+ "mcp-3d-tool"
+ ]
+ },
+ "figure:img:/cookbook/posters/parallel-asset-pack.png": {
+ "kind": "img",
+ "src": "/docs/img/tutorials/build-a-3d-asset-pipeline/img-cookbook-posters-parallel-asset-pack-7684e4ca.webp",
+ "width": 1200,
+ "height": 675,
+ "placeholder": "data:image/webp;base64,UklGRkwAAABXRUJQVlA4IEAAAABwAwCdASoUAAsAPu1iqU2ppaOiMAgBMB2JYwDG9BjMEx8xmQAA/vKyGRPJo09Rmk8AzSqHsJPqnC/oeyVpgAAA",
+ "source": "https://three.ws/cookbook/posters/parallel-asset-pack.png",
+ "collection": "tutorials",
+ "docs": [
+ "build-a-3d-asset-pipeline",
+ "parallel-asset-pack"
+ ]
+ },
+ "figure:img:/cookbook/posters/text-to-3d-cli.png": {
+ "kind": "img",
+ "src": "/docs/img/tutorials/build-a-3d-asset-pipeline/img-cookbook-posters-text-to-3d-cli-f6ecf6ba.webp",
+ "width": 1200,
+ "height": 675,
+ "placeholder": "data:image/webp;base64,UklGRkAAAABXRUJQVlA4IDQAAABQAwCdASoUAAsAPu1iqU2ppaQiMAgBMB2JZwAAUqvPkLCQAAD+8rSMe5he7Ppsq921QAAA",
+ "source": "https://three.ws/cookbook/posters/text-to-3d-cli.png",
+ "collection": "tutorials",
+ "docs": [
+ "build-a-3d-asset-pipeline",
+ "text-to-3d-cli"
+ ]
+ },
"figure:live:/avatars/default.glb": {
"kind": "live",
"model": "/avatars/default.glb",
"orbit": null,
"source": "https://three.ws/avatars/default.glb",
- "tutorials": [
+ "collection": "tutorials",
+ "docs": [
"getting-started"
]
},
@@ -30,7 +107,8 @@
"model": "/avatars/fox.glb",
"orbit": "25deg 72deg 3.2m",
"source": "https://three.ws/avatars/fox.glb",
- "tutorials": [
+ "collection": "tutorials",
+ "docs": [
"text-to-3d"
]
},
@@ -39,7 +117,8 @@
"model": "/avatars/mannequin.glb",
"orbit": null,
"source": "https://three.ws/avatars/mannequin.glb",
- "tutorials": [
+ "collection": "tutorials",
+ "docs": [
"animate-your-avatar"
]
},
@@ -50,7 +129,8 @@
"height": 1520,
"placeholder": "data:image/webp;base64,UklGRj4AAABXRUJQVlA4IDIAAAAwAwCdASoUAAwAPu1iqk2ppaQiMAgBMB2JaQAAetHT2BoAAP7wtpvEmNXE0SZyoAAAAA==",
"source": "https://three.ws/create",
- "tutorials": [
+ "collection": "tutorials",
+ "docs": [
"embed-in-30-seconds",
"getting-started"
]
@@ -60,9 +140,10 @@
"src": "/docs/img/tutorials/explore-docs-world/page-docs-world-98864ac3.webp",
"width": 2560,
"height": 1520,
- "placeholder": "data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAADQAgCdASoUAAwAPu1iqU2ppaOiMAgBMB2JaQAAijeAAP7wtGuwmzAgTsUKAAAA",
+ "placeholder": "data:image/webp;base64,UklGRjwAAABXRUJQVlA4IDAAAADwAgCdASoUAAwAPu1iqU2ppaOiMAgBMB2JZwAAetEDAAD+8FdRnxRNi1htXF2AAAA=",
"source": "https://three.ws/docs/world",
- "tutorials": [
+ "collection": "tutorials",
+ "docs": [
"explore-docs-world"
]
},
@@ -71,9 +152,10 @@
"src": "/docs/img/tutorials/text-to-3d/page-forge-be755d6a.webp",
"width": 2560,
"height": 1520,
- "placeholder": "data:image/webp;base64,UklGRkQAAABXRUJQVlA4IDgAAAAwAwCdASoUAAwAPu1iqU2ppaOiMAgBMB2JaQAAW+lhScUwAP7w1SjXcRIn1IbJjhAFFveexJwAAA==",
+ "placeholder": "data:image/webp;base64,UklGRkQAAABXRUJQVlA4IDgAAAAwAwCdASoUAAwAPu1iqk2ppaQiMAgBMB2JaQAAW+lhScUwAP7w1SjXcRIn1IbJjhAFFveexJwAAA==",
"source": "https://three.ws/forge",
- "tutorials": [
+ "collection": "tutorials",
+ "docs": [
"text-to-3d"
]
},
@@ -84,7 +166,8 @@
"height": 1520,
"placeholder": "data:image/webp;base64,UklGRj4AAABXRUJQVlA4IDIAAAAwAwCdASoUAAwAPu1iqU2ppaOiMAgBMB2JaQAAW+qpUSgAAP7ypwE0v0XD7ktY4TQAAA==",
"source": "https://three.ws/import/rpm",
- "tutorials": [
+ "collection": "tutorials",
+ "docs": [
"import-avatar-url"
]
},
@@ -93,9 +176,10 @@
"src": "/docs/img/tutorials/animate-your-avatar/page-pose-6e5f8fe8.webp",
"width": 2560,
"height": 1520,
- "placeholder": "data:image/webp;base64,UklGRkIAAABXRUJQVlA4IDYAAAAQAwCdASoUAAwAPu1iqk4ppaQiMAgBMB2JaQAAetGDHAAA/vCeu2zZVGzaoRW1uMN9vyKQAAA=",
+ "placeholder": "data:image/webp;base64,UklGRkIAAABXRUJQVlA4IDYAAAAQAwCdASoUAAwAPu1iqk4ppaQiMAgBMB2JaQAAetGDgsAA/vCeu2zZVGzaoRW1uMN9+qCUAAA=",
"source": "https://three.ws/pose",
- "tutorials": [
+ "collection": "tutorials",
+ "docs": [
"animate-your-avatar"
]
},
@@ -106,7 +190,8 @@
"height": 1520,
"placeholder": "data:image/webp;base64,UklGRjQAAABXRUJQVlA4ICgAAACwAgCdASoUAAwAPu1iqU2ppaQiMAgBMB2JaQAAeyAA/vDtzS+UgAAA",
"source": "https://three.ws/scan",
- "tutorials": [
+ "collection": "tutorials",
+ "docs": [
"selfie-to-avatar"
]
}
diff --git a/scripts/capture-doc-media.mjs b/scripts/capture-doc-media.mjs
index b861333ee..e1dc7d96e 100644
--- a/scripts/capture-doc-media.mjs
+++ b/scripts/capture-doc-media.mjs
@@ -28,18 +28,22 @@
* line the reader can click.
*
* ── Usage ────────────────────────────────────────────────────────────────────
- * node scripts/capture-doc-media.mjs # every shot, against localhost:3000
+ * node scripts/capture-doc-media.mjs # every shot, against https://three.ws
* node scripts/capture-doc-media.mjs --only forge-prompt,walk-hero
- * node scripts/capture-doc-media.mjs --base https://three.ws
+ * node scripts/capture-doc-media.mjs --base http://localhost:3000
* node scripts/capture-doc-media.mjs --list # print the shot table, capture nothing
* node scripts/capture-doc-media.mjs --concurrency 2 # default 2; 3D routes are GPU-less and heavy
*
- * Target defaults to http://localhost:3000 (`npm run dev`) so a capture reflects
- * the working tree rather than whatever is deployed. Pass --base to shoot prod.
+ * Target defaults to the live site, because that is the build a reader is
+ * looking at when they compare a figure against the product. Pass
+ * `--base http://localhost:3000` to shoot the working tree instead (worth doing
+ * before shipping a UI change that a figure documents).
*
* Headless Chromium renders WebGL through ANGLE/SwiftShader, which is slower
* than a GPU but faithful; `settle` per shot is the knob when a 3D route needs
- * longer to finish loading its rig.
+ * longer to finish loading its rig. On those routes the compositor can also be
+ * too busy to satisfy Playwright's screenshot within its timeout, so `shoot()`
+ * falls back to a direct CDP capture that never waits for a stable frame.
*/
import { chromium } from 'playwright';
import { execFile, execFileSync } from 'node:child_process';
@@ -65,7 +69,7 @@ const opt = (name, fallback) => {
return i !== -1 && argv[i + 1] ? argv[i + 1] : fallback;
};
-const BASE = (opt('base', process.env.BASE_URL || 'http://localhost:3000')).replace(/\/$/, '');
+const BASE = opt('base', process.env.BASE_URL || 'https://three.ws').replace(/\/$/, '');
const CONCURRENCY = Math.max(1, Number(opt('concurrency', 2)) || 2);
const ONLY = (opt('only', '') || '')
.split(',')
@@ -160,6 +164,19 @@ async function applyActions(page, actions = []) {
case 'wait':
await page.waitForTimeout(action.ms || 500);
break;
+ // Site chrome that legitimately belongs on a live page: the corner
+ // companion, the onboarding checklist, a "have you tried" promo: sits
+ // on top of whatever a doc figure is trying to show. Hiding it is not
+ // staging the product; it is framing the subject, the same way a crop
+ // is. Anything hidden here is named in the recipe, so a reader can see
+ // exactly what was taken out of frame.
+ case 'hide':
+ await page.evaluate((selectors) => {
+ for (const sel of selectors) {
+ for (const node of document.querySelectorAll(sel)) node.style.display = 'none';
+ }
+ }, Array.isArray(action.selectors) ? action.selectors : [action.selector]);
+ break;
default:
fail(`unknown action type "${action.type}"`);
}
@@ -174,11 +191,18 @@ async function preparePage(page, shot) {
/* long-poll and 3D routes may never idle; the settle below covers them */
});
await page.evaluate(() => document.fonts?.ready).catch(() => {});
- // Dismiss anything that would sit on top of the subject in a first visit.
+ // Site chrome that follows the visitor across every route and parks itself
+ // over the bottom-right of the viewport: the corner companion stack (the
+ // "have you tried…" promo and the getting-started pill) and consent banners.
+ // It is real UI, but it is never the subject of a doc figure, and leaving it
+ // in means every screenshot on the site carries the same two floating cards
+ // over whatever the reader was told to look at. Framing it out is a crop,
+ // not a fabrication: nothing about the documented surface changes.
await page
.evaluate(() => {
- for (const sel of ['#cookie-banner', '.cookie-banner', '[data-consent-banner]']) {
- document.querySelector(sel)?.remove();
+ const chrome = ['#tws-corner-stack', '#cookie-banner', '.cookie-banner', '[data-consent-banner]'];
+ for (const selector of chrome) {
+ for (const node of document.querySelectorAll(selector)) node.remove();
}
})
.catch(() => {});
@@ -195,6 +219,46 @@ async function subjectOf(page, shot) {
return handle;
}
+/**
+ * Take one PNG of `subject`.
+ *
+ * Playwright's screenshot waits for the compositor to produce a stable frame.
+ * On a route running a continuous WebGL render loop through SwiftShader that
+ * can never happen inside the timeout, and the capture dies on a page that is
+ * in fact rendering perfectly. So: try the normal path (it produces the better
+ * result, element-clipped and correctly scaled), and when it times out fall
+ * back to a raw CDP capture, which grabs whatever is on screen right now. The
+ * clip rectangle is recomputed from the element box so a cropped shot stays
+ * cropped.
+ */
+async function shoot(page, subject, { fullPage = false, timeout = 20000 } = {}) {
+ const isElement = subject !== page;
+ try {
+ return await subject.screenshot({
+ type: 'png',
+ timeout,
+ ...(isElement ? {} : { fullPage }),
+ });
+ } catch (err) {
+ if (!/timeout/i.test(String(err?.message))) throw err;
+ const session = await page.context().newCDPSession(page);
+ try {
+ const box = isElement ? await subject.boundingBox() : null;
+ const scale = await page.evaluate(() => window.devicePixelRatio).catch(() => 1);
+ const { data } = await session.send('Page.captureScreenshot', {
+ format: 'png',
+ captureBeyondViewport: false,
+ ...(box
+ ? { clip: { x: box.x, y: box.y, width: box.width, height: box.height, scale } }
+ : {}),
+ });
+ return Buffer.from(data, 'base64');
+ } finally {
+ await session.detach().catch(() => {});
+ }
+ }
+}
+
/** PNG buffer from Chromium → optimised WebP on disk. Returns the written metadata. */
async function writeStill(buffer, outPath) {
const image = sharp(buffer);
@@ -224,7 +288,10 @@ async function writeMotion(page, shot, subject, outPath) {
const interval = 1000 / fps;
for (let i = 0; i < frameCount; i++) {
const started = Date.now();
- const buffer = await subject.screenshot({ type: 'png', animations: 'allow' });
+ // Short per-frame timeout on purpose: a frame that cannot be taken
+ // promptly must fall through to the CDP grab, otherwise one slow
+ // frame stalls the whole cadence and the loop plays back uneven.
+ const buffer = await shoot(page, subject, { timeout: 8000 });
writeFileSync(path.join(frameDir, `f${String(i).padStart(4, '0')}.png`), buffer);
const elapsed = Date.now() - started;
if (elapsed < interval) await page.waitForTimeout(interval - elapsed);
@@ -286,24 +353,24 @@ async function captureShot(browser, shot, commit) {
}, shot.theme === 'light' ? 'light' : 'dark');
const page = await context.newPage();
- const ext = shot.motion ? 'webp' : 'webp';
- const outPath = path.join(OUT_DIR, `${shot.id}.${ext}`);
+ // Stills and loops both ship as WebP: a UI screenshot at quality 90 is
+ // visually lossless at a fraction of PNG's bytes, and an animated WebP is
+ // the only looping format that stays an ordinary <img> on every browser
+ // the site supports.
+ const outPath = path.join(OUT_DIR, `${shot.id}.webp`);
try {
await preparePage(page, shot);
const subject = await subjectOf(page, shot);
const written = shot.motion
? await writeMotion(page, shot, subject, outPath)
: await writeStill(
- await subject.screenshot({
- type: 'png',
- ...(subject === page ? { fullPage: Boolean(shot.fullPage) } : {}),
- }),
+ await shoot(page, subject, { fullPage: Boolean(shot.fullPage), timeout: 25000 }),
outPath,
);
const sha256 = createHash('sha256').update(readFileSync(outPath)).digest('hex');
return {
id: shot.id,
- src: `/docs/img/${shot.id}.${ext}`,
+ src: `/docs/img/${shot.id}.webp`,
alt: shot.alt,
caption: shot.caption || null,
route: shot.url,
@@ -395,6 +462,8 @@ async function main() {
const specIds = new Set(readSpec().map((s) => s.id));
for (const id of Object.keys(merged)) if (!specIds.has(id)) delete merged[id];
+ // Manifest alt text echoes doc copy, and the repo bans em/en dashes in
+ // committed bytes, so scrub them at the boundary.
writeFileSync(
MANIFEST_FILE,
`${JSON.stringify(
@@ -405,7 +474,7 @@ async function main() {
},
null,
'\t',
- )}\n`,
+ ).replace(/ [\u2013\u2014] /g, ': ').replace(/[\u2013\u2014]/g, '-')}\n`,
);
console.log(
diff --git a/scripts/capture-docs-media.mjs b/scripts/capture-docs-media.mjs
new file mode 100644
index 000000000..1f45677c3
--- /dev/null
+++ b/scripts/capture-docs-media.mjs
@@ -0,0 +1,272 @@
+#!/usr/bin/env node
+/**
+ * Capture the documentation's own screenshots from the running product.
+ *
+ * Every tutorial image on this platform has to be a picture of the real thing,
+ * which means the pictures have to be reproducible or they rot the moment the
+ * UI moves. This script drives a real browser through /docs/world and writes
+ * the images the docs embed, so refreshing them after a design change is one
+ * command rather than a manual screenshot session.
+ *
+ * npm run capture:docs-world # against the dev server
+ * npm run capture:docs-world -- --base https://three.ws
+ * npm run capture:docs-world -- --only search,reader
+ *
+ * Output: public/docs/img/docs-world-*.png, referenced from
+ * docs/docs-world.md and docs/tutorials/explore-docs-world.md.
+ *
+ * The scene is WebGL, so a headless run needs a software rasteriser; the
+ * swiftshader flags below are the same ones the repo's other browser checks
+ * use. Frames are deterministic apart from the ambient shimmer, which is
+ * stilled by forcing prefers-reduced-motion.
+ */
+
+import { mkdir, writeFile } from 'node:fs/promises';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { chromium } from 'playwright';
+
+const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
+const OUT_DIR = path.join(ROOT, 'public', 'docs', 'img');
+
+const SLOW_MS = 120_000; // ceiling for every wait: see setDefaultTimeout below
+
+const DESKTOP = { width: 1440, height: 900 };
+const MOBILE = { width: 390, height: 844 };
+
+function arg(name, fallback = null) {
+ const i = process.argv.indexOf('--' + name);
+ return i > -1 && process.argv[i + 1] ? process.argv[i + 1] : fallback;
+}
+
+const BASE = (arg('base', process.env.CAPTURE_BASE || 'http://localhost:3000')).replace(/\/$/, '');
+const ONLY = arg('only') ? new Set(arg('only').split(',').map((s) => s.trim())) : null;
+
+const want = (id) => !ONLY || ONLY.has(id);
+
+/** Wait until the world has booted AND the avatar's real rig has loaded. */
+async function waitForWorld(page) {
+ await page.waitForFunction(() => !!window.__docsWorld, null, { timeout: SLOW_MS });
+ // player.height only leaves its 1.7 default once a GLB has been measured, so
+ // this is the honest "the avatar is really here" signal rather than a delay.
+ await page.waitForFunction(
+ () => window.__docsWorld.player.height > 1.5 && window.__docsWorld.player.root.children.length > 0,
+ null,
+ { timeout: SLOW_MS },
+ );
+ // One more governed frame so the first render includes the loaded body.
+ await page.waitForTimeout(600);
+}
+
+async function newWorldPage(browser, { viewport, skipTour = true, isMobile = false }) {
+ const context = await browser.newContext({
+ viewport,
+ // 1.5x is the quality/cost knee for a software-rasterised WebGL page: sharp
+ // on a retina display at the width docs render images, while a 2x buffer
+ // (2880x1800) takes long enough per frame on a loaded machine that the
+ // screenshot itself starts timing out.
+ deviceScaleFactor: 1.5,
+ isMobile,
+ hasTouch: isMobile,
+ // Stills the shimmer, the label bob and the chevron flow, so two runs of
+ // this script produce the same picture instead of a random phase of it.
+ reducedMotion: 'reduce',
+ });
+ // This repo's dev machine routinely runs several agents' build and browser
+ // workloads at once, and every wait here is against a live render loop
+ // competing for the same cores. Generous ceilings keep a slow machine from
+ // being reported as a broken page.
+ context.setDefaultTimeout(SLOW_MS);
+ const page = await context.newPage();
+ if (skipTour) {
+ await page.addInitScript(() => {
+ try {
+ localStorage.setItem('tour:docs-world-welcome:done', '1');
+ } catch {
+ /* the tour simply shows; the shot is still valid */
+ }
+ });
+ }
+ const errors = [];
+ page.on('pageerror', (e) => errors.push(e.message));
+ await gotoWorld(page);
+ await waitForWorld(page);
+ return { context, page, errors };
+}
+
+/**
+ * Navigate, retrying a refused connection.
+ *
+ * A capture run is minutes long and a Vite dev server restarts itself whenever
+ * any config file is touched, so a single refused connection is far more often
+ * "the server is two seconds into a restart" than "there is no server". Failing
+ * the whole run on it would make the script unusable on a machine where anyone
+ * else is working.
+ */
+async function gotoWorld(page, attempts = 6) {
+ let lastErr;
+ for (let i = 0; i < attempts; i++) {
+ try {
+ await page.goto(BASE + '/docs/world', { waitUntil: 'domcontentloaded', timeout: SLOW_MS });
+ return;
+ } catch (err) {
+ lastErr = err;
+ if (!/ERR_CONNECTION_REFUSED|ERR_EMPTY_RESPONSE|Timeout/.test(String(err))) throw err;
+ const waitMs = 1500 * (i + 1);
+ console.log(' server not answering yet, retrying in ' + waitMs + 'ms');
+ await page.waitForTimeout(waitMs);
+ }
+ }
+ throw lastErr;
+}
+
+/**
+ * Open the search palette and type a query.
+ *
+ * Deliberately not a mouse click on the chip. The scene is a live WebGL render
+ * loop, and under a software rasteriser at 2x device scale a frame can take
+ * long enough that Playwright's actionability checks (hit-target, stability)
+ * never see two quiet frames in a row and time out on a button that is, to a
+ * real user on real hardware, perfectly clickable. Driving the palette through
+ * the keyboard and its own API skips those checks entirely and exercises the
+ * same code path the docs tell readers to use.
+ */
+async function openPalette(page, query) {
+ await page.evaluate(() => window.__docsWorld.search.open());
+ // open() focuses the input itself, so typing lands in the right place.
+ await page.waitForFunction(() => document.activeElement?.id === 'dw-search-input', null, {
+ timeout: SLOW_MS,
+ });
+ await page.keyboard.type(query, { delay: 12 });
+ await page.waitForFunction(() => document.querySelectorAll('.dw-sr').length > 0, null, {
+ timeout: SLOW_MS,
+ });
+ await page.waitForTimeout(250);
+}
+
+async function shoot(page, name) {
+ const file = path.join(OUT_DIR, name + '.png');
+ // animations:'disabled' freezes CSS transitions at their end state, so an
+ // overlay caught mid-fade is captured fully opaque instead of ghosted.
+ await page.screenshot({ path: file, timeout: SLOW_MS, animations: 'disabled' });
+ console.log(' wrote public/docs/img/' + name + '.png');
+ return file;
+}
+
+async function main() {
+ await mkdir(OUT_DIR, { recursive: true });
+ const browser = await chromium.launch({
+ args: ['--use-gl=swiftshader', '--enable-unsafe-swiftshader', '--no-sandbox'],
+ });
+ const written = [];
+ const problems = [];
+
+ try {
+ // ── Desktop: plaza, search, wayfinder, reader, top down ────────────────
+ const { context, page, errors } = await newWorldPage(browser, { viewport: DESKTOP });
+
+ if (want('plaza')) {
+ console.log('plaza: the spawn view');
+ written.push(await shoot(page, 'docs-world-plaza'));
+ }
+
+ if (want('search')) {
+ console.log('search: the palette over the scene');
+ await openPalette(page, 'web component');
+ written.push(await shoot(page, 'docs-world-search'));
+ await page.keyboard.press('Escape');
+ await page.waitForTimeout(200);
+ }
+
+ if (want('wayfinder')) {
+ console.log('wayfinder: a live route across the plaza');
+ await openPalette(page, 'web component');
+ await page.keyboard.press('Shift+Enter'); // walk me there
+ await page.waitForTimeout(600);
+ // A raised, angled camera shows the trail bending around the ring, which
+ // a shoulder-height follow cam cannot: the lane vanishes under the avatar.
+ await page.evaluate(() => {
+ const c = window.__docsWorld.controls;
+ c.orbit.pitch = 0.78;
+ c.orbit.dist = 15;
+ });
+ await page.waitForTimeout(700);
+ const active = await page.evaluate(() => window.__docsWorld.wayfinder.active);
+ if (!active) problems.push('wayfinder: no route was running at capture time');
+ written.push(await shoot(page, 'docs-world-wayfinder'));
+ }
+
+ if (want('reader')) {
+ console.log('reader: live markdown inside the scene');
+ await page.evaluate(() => window.__docsWorld.overlays.openDoc('web-component'));
+ await page.waitForFunction(
+ () => document.getElementById('dw-reader-body').textContent.length > 1200,
+ null,
+ { timeout: SLOW_MS },
+ );
+ await page.waitForTimeout(400);
+ written.push(await shoot(page, 'docs-world-reader'));
+ await page.keyboard.press('Escape');
+ await page.waitForTimeout(250);
+ }
+
+ if (want('topdown')) {
+ console.log('topdown: the whole ring at once');
+ await page.evaluate(() => {
+ const dw = window.__docsWorld;
+ dw.player.root.position.set(0, 0, 8);
+ // Cycle to the top-down mode by name rather than by counting presses,
+ // so the shot survives a reordering of the camera modes.
+ const btn = document.getElementById('dw-camera-btn');
+ for (let i = 0; i < 6 && btn.textContent.trim() !== 'Top down'; i++) btn.click();
+ });
+ await page.waitForTimeout(1200);
+ const mode = await page.locator('#dw-camera-btn').textContent();
+ if (mode.trim() !== 'Top down') problems.push('topdown: camera stopped on "' + mode.trim() + '"');
+ written.push(await shoot(page, 'docs-world-topdown'));
+ }
+
+ if (errors.length) problems.push('desktop page errors: ' + errors.join(' | '));
+ await context.close();
+
+ // ── Onboarding: the first-run coach mark, tour NOT suppressed ──────────
+ if (want('tour')) {
+ console.log('tour: the first-run welcome');
+ const first = await newWorldPage(browser, { viewport: DESKTOP, skipTour: false });
+ await first.page.waitForSelector('.tour-bubble', { timeout: SLOW_MS });
+ await first.page.waitForTimeout(400);
+ written.push(await shoot(first.page, 'docs-world-tour'));
+ await first.context.close();
+ }
+
+ // ── Mobile: joystick, collapsed chips, full-width reader ───────────────
+ if (want('mobile')) {
+ console.log('mobile: the touch HUD at 390px');
+ const m = await newWorldPage(browser, { viewport: MOBILE, isMobile: true });
+ written.push(await shoot(m.page, 'docs-world-mobile'));
+ await m.context.close();
+ }
+ } finally {
+ await browser.close();
+ }
+
+ // A manifest so the docs and the tests can agree on what exists without
+ // either of them hardcoding the list twice.
+ const manifest = written.map((f) => '/docs/img/' + path.basename(f)).sort();
+ await writeFile(
+ path.join(OUT_DIR, 'docs-world-media.json'),
+ JSON.stringify({ base: BASE, images: manifest }, null, '\t') + '\n',
+ );
+
+ console.log('\n' + written.length + ' image(s) captured from ' + BASE);
+ if (problems.length) {
+ console.error('\nProblems:');
+ for (const p of problems) console.error(' - ' + p);
+ process.exitCode = 1;
+ }
+}
+
+main().catch((err) => {
+ console.error(err);
+ process.exit(1);
+});
diff --git a/scripts/capture-guide-shots.mjs b/scripts/capture-guide-shots.mjs
index bc4b3331a..a86987b5c 100644
--- a/scripts/capture-guide-shots.mjs
+++ b/scripts/capture-guide-shots.mjs
@@ -116,6 +116,18 @@ const ANNOTATE = (callouts) => {
return missing;
};
+// Freeze anything still moving. A three.ws page is full of live media: a
+// model-viewer orbits by default, videos loop, canvases redraw. Playwright waits
+// for the capture target to hold still, so an un-frozen 3D viewer never settles
+// and the shot times out instead of failing honestly.
+const FREEZE = () => {
+ document.querySelectorAll('model-viewer').forEach(mv => {
+ mv.removeAttribute('auto-rotate');
+ try { mv.pause?.(); } catch {}
+ });
+ document.querySelectorAll('video').forEach(v => { try { v.pause(); } catch {} });
+};
+
// A transparent, absolutely-positioned rect used as the screenshot target. Using
// an element (rather than a raw clip box) keeps padding unambiguous: Playwright
// scrolls it into view and captures exactly its bounds.
@@ -131,15 +143,7 @@ const FRAME = ({ selector, pad }) => {
const y = Math.max(0, r.top + window.scrollY - pad);
const w = Math.min(docW - x, r.width + pad * 2);
const h = Math.min(docH - y, r.height + pad * 2);
- const frame = document.createElement('div');
- frame.id = 'tws-capture-frame';
- Object.assign(frame.style, {
- position: 'absolute', top: y + 'px', left: x + 'px',
- width: w + 'px', height: h + 'px',
- pointerEvents: 'none', background: 'transparent', zIndex: '0',
- });
- document.body.appendChild(frame);
- return { w: Math.round(w), h: Math.round(h) };
+ return { x: Math.round(x), y: Math.round(y), w: Math.round(w), h: Math.round(h) };
};
// ── prep steps: drive the UI into the state a guide step describes ────────────
@@ -160,6 +164,13 @@ async function runPrep(page, prep) {
await page.locator(step.scrollTo).first()
.scrollIntoViewIfNeeded({ timeout: 15000 });
}
+ // waitFor lets a shot depend on real work finishing (a generation
+ // completing, a model loading) instead of a guessed sleep, so a picture
+ // captioned "your finished model" actually contains one.
+ if (step.waitFor) {
+ await page.locator(step.waitFor).first()
+ .waitFor({ state: 'visible', timeout: step.timeout ?? 240000 });
+ }
if (step.wait) await page.waitForTimeout(step.wait);
}
}
@@ -234,6 +245,7 @@ for (const shot of shots) {
// Re-apply after prep: a click can mount fresh chrome.
await page.addStyleTag({ content: SUPPRESS_CSS });
+ await page.evaluate(FREEZE);
let missing = [];
if (shot.callouts?.length) {
@@ -247,8 +259,12 @@ for (const shot of shots) {
if (shot.clip) {
dims = await page.evaluate(FRAME, { selector: shot.clip, pad: shot.pad ?? 20 });
if (!dims) throw new Error(`clip target not found or zero-size: ${shot.clip}`);
- await page.locator('#tws-capture-frame').screenshot({
- path: outPath, timeout: 90000, animations: 'disabled',
+ // A document-coordinate clip rather than an element screenshot: these
+ // pages stream content in, so waiting for an element's box to hold
+ // still can never succeed on a page that is legitimately alive.
+ await page.screenshot({
+ path: outPath, timeout: 90000, animations: 'disabled', fullPage: true,
+ clip: { x: dims.x, y: dims.y, width: dims.w, height: dims.h },
});
} else {
await page.screenshot({
@@ -281,12 +297,14 @@ for (const shot of shots) {
await browser.close();
const failed = results.filter(r => !r.ok);
+// Captured captions echo page copy, and the repo bans em/en dashes in
+// committed bytes, so scrub them at the boundary.
writeFileSync(REPORT, JSON.stringify({
base: BASE,
shots: results.length,
failed: failed.length,
results,
-}, null, '\t') + '\n');
+}, null, '\t').replace(/ [\u2013\u2014] /g, ': ').replace(/[\u2013\u2014]/g, '-') + '\n');
console.log(`\n${results.length - failed.length}/${results.length} captured -> public/docs/img/guides/`);
console.log(`report: data/guide-shots.capture.json`);
diff --git a/scripts/capture-live-steps-media.mjs b/scripts/capture-live-steps-media.mjs
new file mode 100644
index 000000000..3d40460e1
--- /dev/null
+++ b/scripts/capture-live-steps-media.mjs
@@ -0,0 +1,192 @@
+#!/usr/bin/env node
+/**
+ * Capture the tutorial media for live steps, from the real running product.
+ * ===========================================================================
+ *
+ * Documentation screenshots rot the moment the UI moves, and a hand-cropped PNG
+ * is nobody's job to refresh. So this script drives the actual tutorial page in
+ * a real browser, presses the actual buttons, waits for the actual API to
+ * answer, and writes the resulting images into public/docs/img/.
+ *
+ * It is also the acceptance test for the feature: it fails loudly if the cards
+ * do not mount, if a step does not reach a terminal state, if redaction stops
+ * firing, if a value fails to chain between steps, if the page overflows
+ * horizontally on a phone, or if anything logs a console error. A screenshot of
+ * a broken card is worse than no screenshot, so it never writes one.
+ *
+ * npm run media:live-steps # against a dev server on :4737
+ * BASE=https://three.ws npm run media:live-steps
+ *
+ * Start the dev server first (npm run dev -- --port 4737), or point BASE at a
+ * deployed origin. Requires playwright, which the repo already depends on.
+ */
+import { chromium } from 'playwright';
+import { mkdirSync } from 'node:fs';
+import { resolve, dirname } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
+const OUT = resolve(ROOT, 'public/docs/img');
+const BASE = process.env.BASE || 'http://127.0.0.1:4737';
+const PAGE = `${BASE}/tutorials/wallet-sign-in`;
+
+mkdirSync(OUT, { recursive: true });
+
+const failures = [];
+function check(label, condition, detail) {
+ const ok = Boolean(condition);
+ console.log(`${ok ? 'ok ' : 'FAIL'} ${label}${detail ? ` (${detail})` : ''}`);
+ if (!ok) failures.push(label);
+ return ok;
+}
+
+/** Press a card's button and wait for it to leave the running state. */
+async function runCard(page, step) {
+ const card = page.locator(`.ls-card[data-step="${step}"]`);
+ await card.scrollIntoViewIfNeeded();
+ await card.locator('.ls-run').click();
+ await page.waitForFunction(
+ (id) => {
+ const el = document.querySelector(`.ls-card[data-step="${id}"]`);
+ return el && el.dataset.state !== 'running';
+ },
+ step,
+ { timeout: 30000 },
+ );
+ return card;
+}
+
+/*
+ * The rendered body, or an empty string when the card produced none. A bare
+ * locator read would hang for the full timeout on a step that failed, which
+ * hides the actual cause behind a Playwright stack trace.
+ */
+async function bodyOf(card) {
+ const pre = card.locator('.ls-pre');
+ return (await pre.count()) ? pre.innerText() : '';
+}
+
+/** Everything the card said, for when a check fails and you need the why. */
+async function transcript(card) {
+ return (await card.innerText()).replace(/\n{2,}/g, '\n').slice(0, 600);
+}
+
+const browser = await chromium.launch();
+const consoleIssues = [];
+const apiTraffic = [];
+
+try {
+ const ctx = await browser.newContext({
+ viewport: { width: 1240, height: 1100 },
+ deviceScaleFactor: 2,
+ });
+ const page = await ctx.newPage();
+ page.on('console', (m) => {
+ if (m.type() === 'error') consoleIssues.push(m.text());
+ });
+ page.on('pageerror', (e) => consoleIssues.push(`pageerror: ${e.message}`));
+ /* API traffic, so a failed card is diagnosable without a second run. */
+ page.on('response', (r) => {
+ if (r.url().includes('/api/')) apiTraffic.push(`${r.status()} ${new URL(r.url()).pathname}`);
+ });
+ page.on('requestfailed', (r) => {
+ if (r.url().includes('/api/')) {
+ apiTraffic.push(`FAILED ${new URL(r.url()).pathname} ${r.failure()?.errorText || ''}`);
+ }
+ });
+
+ await page.goto(PAGE, { waitUntil: 'domcontentloaded' });
+ await page.waitForSelector('.ls-card', { timeout: 20000 });
+
+ const mounted = await page.$$eval('.ls-card', (els) => els.map((e) => e.dataset.step));
+ check('cards mount from the markdown', mounted.length >= 3, mounted.join(', '));
+ check('the run-every-step toolbar appears', await page.$('.ls-toolbar'));
+
+ /* ── The nonce step: a real call to the live API ─────────────────────── */
+ const nonce = await runCard(page, 'siws-nonce');
+ const nonceState = await nonce.getAttribute('data-state');
+ const nonceBody = await bodyOf(nonce);
+ if (nonceState !== 'ok') console.error(`\n${await transcript(nonce)}\n`);
+ check('the nonce step reaches a 2xx', nonceState === 'ok', (await nonce.locator('.ls-meta').innerText()).replace(/\n/g, ' '));
+ check('the response carries a real nonce', /"nonce":\s*"[A-Za-z0-9_-]{10,}"/.test(nonceBody));
+ check('the csrf token is redacted from the view', nonceBody.includes('redacted in this view'));
+ check(
+ 'chained values are published',
+ (await nonce.locator('.ls-note.is-ok').innerText()).includes('nonce'),
+ );
+
+ /* ── The derive step: consumes what the nonce step published ─────────── */
+ const message = page.locator('.ls-card[data-step="siws-message"]');
+ await message.locator('.ls-input').fill('YourWa11etAddressGoesHere');
+ await message.locator('.ls-run').click();
+ await page.waitForFunction(
+ () => document.querySelector('.ls-card[data-step="siws-message"]')?.dataset.state === 'ok',
+ null,
+ { timeout: 20000 },
+ );
+ const derived = (await bodyOf(message)).split('\n');
+ const liveNonce = JSON.parse(nonceBody).nonce;
+ check('the derived message opens with the domain the server returned', derived[0].startsWith('three.ws wants you to sign in'));
+ check('the two structural blank lines survive', derived[2] === '' && derived[4] === '');
+ check('the chained nonce reached the message', derived.some((l) => l === `Nonce: ${liveNonce}`));
+ check('Chain ID is a network name, not a number', derived.includes('Chain ID: mainnet'));
+
+ /* ── auth-me: whichever signed-out shape this browser gets ───────────── */
+ const me = await runCard(page, 'auth-me');
+ const meBody = await bodyOf(me);
+ check('the session probe answers', ['ok', 'error'].includes(await me.getAttribute('data-state')), meBody.replace(/\s+/g, ' ').slice(0, 80));
+
+ /* ── Media ───────────────────────────────────────────────────────────── */
+ await nonce.scrollIntoViewIfNeeded();
+ await page.waitForTimeout(350);
+ await nonce.screenshot({ path: `${OUT}/live-step-nonce.png` });
+ await message.screenshot({ path: `${OUT}/live-step-message.png` });
+
+ await page.evaluate(() => document.querySelector('.ls-toolbar').scrollIntoView({ block: 'start' }));
+ await page.waitForTimeout(400);
+ await page.screenshot({ path: `${OUT}/live-steps-page.png` });
+
+ /* ── Light theme ─────────────────────────────────────────────────────── */
+ await page.evaluate(() => {
+ localStorage.setItem('twx_theme', 'light');
+ document.documentElement.setAttribute('data-theme', 'light');
+ });
+ await page.reload({ waitUntil: 'domcontentloaded' });
+ await page.waitForSelector('.ls-card', { timeout: 20000 });
+ const lightNonce = await runCard(page, 'siws-nonce');
+ check('the card works in the light theme', (await lightNonce.getAttribute('data-state')) === 'ok');
+ await lightNonce.scrollIntoViewIfNeeded();
+ await page.waitForTimeout(350);
+ await lightNonce.screenshot({ path: `${OUT}/live-step-nonce-light.png` });
+ await ctx.close();
+
+ /* ── Phone ───────────────────────────────────────────────────────────── */
+ const mobileCtx = await browser.newContext({
+ viewport: { width: 390, height: 844 },
+ deviceScaleFactor: 2,
+ });
+ const mp = await mobileCtx.newPage();
+ mp.on('pageerror', (e) => consoleIssues.push(`mobile pageerror: ${e.message}`));
+ await mp.goto(PAGE, { waitUntil: 'domcontentloaded' });
+ await mp.waitForSelector('.ls-card', { timeout: 20000 });
+ const overflows = await mp.evaluate(
+ () => document.documentElement.scrollWidth > document.documentElement.clientWidth + 1,
+ );
+ check('the phone layout does not scroll sideways', !overflows);
+ const mobileNonce = await runCard(mp, 'siws-nonce');
+ check('the card works on a phone', (await mobileNonce.getAttribute('data-state')) === 'ok');
+ await mobileNonce.scrollIntoViewIfNeeded();
+ await mp.waitForTimeout(350);
+ await mobileNonce.screenshot({ path: `${OUT}/live-step-mobile.png` });
+ await mobileCtx.close();
+
+ check('no console errors', consoleIssues.length === 0, consoleIssues.join(' | '));
+} finally {
+ await browser.close();
+}
+
+if (failures.length) {
+ console.error(`\n${failures.length} check(s) failed:\n ${failures.join('\n ')}`);
+ process.exit(1);
+}
+console.log(`\nAll checks passed. Media written to public/docs/img/.`);
diff --git a/scripts/capture-pipeline-studio.mjs b/scripts/capture-pipeline-studio.mjs
new file mode 100644
index 000000000..24d27e81f
--- /dev/null
+++ b/scripts/capture-pipeline-studio.mjs
@@ -0,0 +1,196 @@
+#!/usr/bin/env node
+/**
+ * capture-pipeline-studio.mjs
+ *
+ * Drives the Pipeline Studio (/cookbook/pipeline) through a real end-to-end run
+ * in a real browser, then screenshots the result.
+ *
+ * This is both the page's verification harness and the source of its
+ * documentation figures, deliberately. The Studio's whole claim is that it runs
+ * the actual pipeline against the actual free API, so the only honest picture of
+ * it is one taken after it really did that. Nothing here seeds state, stubs a
+ * response, or fakes a verdict: it types prompts, presses Run, and waits for the
+ * models to come back from the same GPU lane a visitor would hit.
+ *
+ * It also fails loudly on console errors and on a run that produces no models,
+ * so a regression in the page shows up here before it ships.
+ *
+ * node scripts/capture-pipeline-studio.mjs # against prod
+ * BASE_URL=http://localhost:3001 node scripts/capture-pipeline-studio.mjs
+ * node scripts/capture-pipeline-studio.mjs --prompts "a red clay mug"
+ *
+ * Output: public/cookbook/media/*.png, referenced from the cookbook docs as
+ * `figure:img:` directives and picked up by scripts/capture-tutorial-media.mjs.
+ */
+import { chromium } from 'playwright';
+import { mkdirSync, writeFileSync } from 'node:fs';
+import { resolve, dirname } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
+const BASE_URL = (process.env.BASE_URL || 'https://three.ws').replace(/\/$/, '');
+const OUT_DIR = resolve(ROOT, 'public/cookbook/media');
+
+const argv = process.argv.slice(2);
+const opt = (name, fallback) => {
+ const i = argv.indexOf(`--${name}`);
+ return i !== -1 && argv[i + 1] ? argv[i + 1] : fallback;
+};
+
+// Three single-subject prompts: what the free draft lane is actually good at,
+// and enough of them to show the worker pool doing more than one thing at once.
+const PROMPTS = opt(
+ 'prompts',
+ ['a clay flower pot with a saucer', 'a woven wicker basket', 'a brass watering can'].join('\n'),
+);
+
+// A draft is 60 to 120 seconds and three of them run at once, so one wave plus
+// generous headroom for a busy shared lane.
+const RUN_TIMEOUT_MS = Number(opt('timeout', 8 * 60 * 1000));
+
+async function main() {
+ mkdirSync(OUT_DIR, { recursive: true });
+ const browser = await chromium.launch({ args: ['--no-sandbox', '--disable-dev-shm-usage'] });
+ const context = await browser.newContext({
+ viewport: { width: 1440, height: 1000 },
+ deviceScaleFactor: 2,
+ colorScheme: 'dark',
+ reducedMotion: 'reduce',
+ });
+ // Start from a clean slate so the run captured is the run this script did,
+ // not something a previous session left in localStorage.
+ await context.addInitScript(`try{localStorage.removeItem('threews.pipeline-studio.v1')}catch(e){}`);
+
+ const page = await context.newPage();
+ const consoleErrors = [];
+ page.on('console', (msg) => {
+ if (msg.type() === 'error') consoleErrors.push(msg.text());
+ });
+ page.on('pageerror', (err) => consoleErrors.push(`pageerror: ${err.message}`));
+
+ // "Failed to load resource" without a URL is an unactionable console line, so
+ // record which request actually failed. Session probes are excluded: the nav
+ // asks who you are on every page and a signed-out 401 is the correct answer.
+ const badResponses = [];
+ page.on('response', (res) => {
+ if (res.status() < 400) return;
+ const url = res.url();
+ if (/\/api\/(auth|user|session|me)\b/.test(url)) return;
+ badResponses.push(`HTTP ${res.status()} ${url.replace(BASE_URL, '')}`);
+ });
+
+ const failures = [];
+ try {
+ const url = `${BASE_URL}/cookbook/pipeline`;
+ console.log(`opening ${url}`);
+ const res = await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 });
+ if (!res || res.status() >= 400) throw new Error(`${url} returned HTTP ${res && res.status()}`);
+
+ // The page has to be usable before it is photogenic.
+ await page.waitForSelector('#pl-run', { state: 'visible', timeout: 20000 });
+ await page.waitForSelector('.nav a', { timeout: 20000 });
+ const navLinks = await page.locator('header a').count();
+ if (navLinks < 10) failures.push(`site navigation did not mount (${navLinks} header links)`);
+
+ const presets = await page.locator('.pl-preset').count();
+ if (presets < 1) failures.push('no preset packs rendered');
+
+ const prefilled = await page.locator('#pl-prompts').inputValue();
+ if (!prefilled.trim()) failures.push('the prompt box arrived empty; it should open on a working pack');
+
+ // Tooltips: hover the first hint and confirm it actually says something.
+ await page.locator('.pl-hint').first().hover();
+ await page.waitForTimeout(300);
+ const tipText = (await page.locator('#pl-tip').textContent()) || '';
+ if (tipText.trim().length < 20) failures.push('the first tooltip rendered empty');
+ await page.keyboard.press('Escape');
+
+ await page.fill('#pl-prompts', PROMPTS);
+ const wanted = PROMPTS.split('\n').filter(Boolean).length;
+
+ console.log(`running ${wanted} prompt(s) against ${BASE_URL} for real, this takes a couple of minutes`);
+ const started = Date.now();
+ await page.click('#pl-run');
+
+ // Mid-run frame: at least one model finished and at least one is still
+ // working. Worth its own figure because it shows the pool in motion.
+ let midShot = null;
+ const midDeadline = Date.now() + RUN_TIMEOUT_MS;
+ while (Date.now() < midDeadline) {
+ const done = await page.locator('.pl-card[data-status="pass"], .pl-card[data-status="fail"]').count();
+ const busy = await page
+ .locator('.pl-card[data-status="generating"], .pl-card[data-status="rendering"], .pl-card[data-status="inspecting"]')
+ .count();
+ if (done >= 1 && busy >= 1) {
+ midShot = await page.locator('.pl-results').screenshot({ type: 'png' });
+ console.log(` mid-run frame captured at ${Math.round((Date.now() - started) / 1000)}s`);
+ break;
+ }
+ if (done >= wanted) break;
+ await page.waitForTimeout(2000);
+ }
+
+ // Then wait for the whole run to settle.
+ await page.waitForFunction(
+ (n) => document.querySelectorAll('.pl-card[data-status="pass"], .pl-card[data-status="fail"], .pl-card[data-status="error"]').length >= n,
+ wanted,
+ { timeout: RUN_TIMEOUT_MS },
+ );
+ const elapsed = Math.round((Date.now() - started) / 1000);
+ console.log(` run finished in ${elapsed}s`);
+
+ const built = await page.locator('.pl-card[data-status="pass"], .pl-card[data-status="fail"]').count();
+ const broke = await page.locator('.pl-card[data-status="error"]').count();
+ console.log(` ${built} model(s) built, ${broke} failed to build`);
+ if (built === 0) failures.push('the run produced no models at all');
+
+ // The export panel only appears when there is something to export.
+ if (built > 0 && (await page.locator('#pl-export').isHidden())) {
+ failures.push('models were built but the export panel stayed hidden');
+ }
+ const repro = (await page.locator('#pl-repro').textContent()) || '';
+ if (built > 0 && !repro.includes('asset_gate.py')) {
+ failures.push('the reproduce block did not include the gate command');
+ }
+
+ // Let the stills finish decoding before the hero shot.
+ await page.waitForTimeout(1500);
+ await page.evaluate(() => window.scrollTo(0, 0));
+
+ const shots = [
+ ['pipeline-studio-run.png', await page.locator('.pl-shell').screenshot({ type: 'png' })],
+ ['pipeline-studio-results.png', await page.locator('.pl-results').screenshot({ type: 'png' })],
+ ['pipeline-studio-controls.png', await page.locator('.pl-rail').screenshot({ type: 'png' })],
+ ];
+ if (midShot) shots.push(['pipeline-studio-midrun.png', midShot]);
+
+ for (const [name, buf] of shots) {
+ const out = resolve(OUT_DIR, name);
+ writeFileSync(out, buf);
+ console.log(` wrote public/cookbook/media/${name} ${(buf.length / 1024).toFixed(0)} KB`);
+ }
+ } finally {
+ await context.close();
+ await browser.close();
+ }
+
+ // model-viewer and third-party CDNs are noisy on unrelated pages; only the
+ // Studio's own failures matter, and it loads no third-party script.
+ if (consoleErrors.length) {
+ console.error(`\n${consoleErrors.length} console error(s):`);
+ for (const e of consoleErrors.slice(0, 12)) console.error(` ${e}`);
+ failures.push(`${consoleErrors.length} console error(s)`);
+ }
+
+ if (failures.length) {
+ console.error(`\ncapture-pipeline-studio: ${failures.length} problem(s):`);
+ for (const f of failures) console.error(` ${f}`);
+ process.exit(1);
+ }
+ console.log('\ncapture-pipeline-studio: the Studio ran end to end and every check passed.');
+}
+
+main().catch((err) => {
+ console.error(`capture-pipeline-studio: ${err.message}`);
+ process.exit(1);
+});
diff --git a/scripts/capture-tutorial-media.mjs b/scripts/capture-tutorial-media.mjs
index 15eed393f..a6e498495 100644
--- a/scripts/capture-tutorial-media.mjs
+++ b/scripts/capture-tutorial-media.mjs
@@ -22,6 +22,7 @@
*
* Kinds:
* page:<path> screenshot of https://three.ws<path> in a real browser
+ * img:<path> an image already committed under public/, adopted as a figure
* glb:<path> PNG returned by GET /api/render/glb?glbUrl=…
* live:<path> an interactive <model-viewer>, mounted at runtime. No capture
* happens here; it is listed in the manifest so the checker can
@@ -41,7 +42,7 @@
* npm run tutorials:media -- --only embed-in-30-seconds
* BASE_URL=http://localhost:3000 npm run tutorials:media
*
- * Output: public/docs/img/tutorials/<slug>/<name>-<hash>.webp plus a manifest
+ * Output: public/docs/img/<collection>/<slug>/<name>-<hash>.webp plus a manifest
* carrying intrinsic width/height and a blurred inline placeholder, so the page
* reserves the exact box before the byte arrives and never shifts layout.
*/
@@ -59,10 +60,17 @@ const BASE_URL = (process.env.BASE_URL || 'https://three.ws').replace(/\/$/, '')
// NOT the capture base: figures are usually shot against a local server running
// the commit being shipped, and a doorway into localhost is a dead link.
const SITE_URL = (process.env.SITE_URL || 'https://three.ws').replace(/\/$/, '');
-const TUTORIAL_DIR = resolve(ROOT, 'docs/tutorials');
-const IMG_ROOT = resolve(ROOT, 'public/docs/img/tutorials');
const MANIFEST = resolve(ROOT, 'public/tutorial-media.json');
+// Every markdown collection whose figures this script captures. Both viewers
+// (pages/tutorial.html and pages/recipe.html) load the same tutorial-figures.js
+// and read the same manifest, so a collection is just a directory plus the
+// folder its assets land in. Adding a third is one more row.
+const COLLECTIONS = [
+ { name: 'tutorials', dir: resolve(ROOT, 'docs/tutorials'), img: 'docs/img/tutorials' },
+ { name: 'cookbook', dir: resolve(ROOT, 'docs/cookbook'), img: 'docs/img/cookbook' },
+];
+
const argv = process.argv.slice(2);
const has = (name) => argv.includes(`--${name}`);
const opt = (name, fallback) => {
@@ -75,7 +83,7 @@ const ONLY = opt('only', '');
const QUALITY = Math.max(40, Math.min(100, Number(opt('quality', 82)) || 82));
const FIGURE_RE = /!\[([^\]]*)\]\((figure:[^)\s]+)\)/g;
-const KINDS = new Set(['page', 'glb', 'live']);
+const KINDS = new Set(['page', 'glb', 'live', 'img']);
// ── Parse ────────────────────────────────────────────────────────────────────
@@ -85,7 +93,7 @@ function parseDirective(raw) {
const colon = body.indexOf(':');
if (colon === -1) return { error: 'a figure needs a kind, as in figure:page:/create' };
const kind = body.slice(0, colon);
- if (!KINDS.has(kind)) return { error: `unknown figure kind "${kind}" (use page, glb or live)` };
+ if (!KINDS.has(kind)) return { error: `unknown figure kind "${kind}" (use page, glb, img or live)` };
const rest = body.slice(colon + 1);
const q = rest.indexOf('?');
const target = q === -1 ? rest : rest.slice(0, q);
@@ -95,26 +103,29 @@ function parseDirective(raw) {
}
function collectDirectives() {
- const files = readdirSync(TUTORIAL_DIR)
- .filter((f) => f.endsWith('.md'))
- .filter((f) => !ONLY || f === `${ONLY}.md`);
const found = [];
const problems = [];
- for (const file of files) {
- const slug = file.replace(/\.md$/, '');
- const md = readFileSync(resolve(TUTORIAL_DIR, file), 'utf8');
- for (const match of md.matchAll(FIGURE_RE)) {
- const [, alt, raw] = match;
- const parsed = parseDirective(raw);
- if (parsed.error) {
- problems.push(`${file}: ${parsed.error}`);
- continue;
- }
- if (!alt.trim()) {
- problems.push(`${file}: ${raw} has an empty caption. Every figure needs one, for the caption and the alt text.`);
- continue;
+ for (const collection of COLLECTIONS) {
+ if (!existsSync(collection.dir)) continue;
+ const files = readdirSync(collection.dir)
+ .filter((f) => f.endsWith('.md'))
+ .filter((f) => !ONLY || f === `${ONLY}.md`);
+ for (const file of files) {
+ const slug = file.replace(/\.md$/, '');
+ const md = readFileSync(resolve(collection.dir, file), 'utf8');
+ for (const match of md.matchAll(FIGURE_RE)) {
+ const [, alt, raw] = match;
+ const parsed = parseDirective(raw);
+ if (parsed.error) {
+ problems.push(`${file}: ${parsed.error}`);
+ continue;
+ }
+ if (!alt.trim()) {
+ problems.push(`${file}: ${raw} has an empty caption. Every figure needs one, for the caption and the alt text.`);
+ continue;
+ }
+ found.push({ collection: collection.name, img: collection.img, slug, alt: alt.trim(), raw, ...parsed });
}
- found.push({ slug, alt: alt.trim(), raw, ...parsed });
}
}
return { found, problems };
@@ -153,28 +164,40 @@ async function capturePage(browser, entry) {
// The site reads its theme from localStorage before first paint, so setting
// it as an init script is the only way to capture the light theme honestly.
await context.addInitScript(`try{localStorage.setItem('twx_theme',${JSON.stringify(theme)})}catch(e){}`);
+ // Floating chrome is not the UI a tutorial is teaching, and most of it
+ // rotates its contents per visit, so leaving it in makes every re-capture a
+ // spurious diff. Hiding it with a stylesheet installed before first paint
+ // beats removing the nodes after load: the i18n switcher and the corner
+ // stack both mount asynchronously, after any fixed settle has elapsed, so a
+ // removal pass races them and loses on the slower pages.
+ await context.addInitScript(`(function(){
+ var css = '#cookie-banner,.cookie-banner,[data-role="consent"],.newsletter-toast,'
+ + '#tws-corner-stack,.twx-i18n-fab,lang-switcher,.walk-c2w-fx,.nav-skip,'
+ + '.tour-overlay,.tour-spotlight,.tour-bubble'
+ + '{display:none !important}';
+ function put(){ var s=document.createElement('style'); s.textContent=css; (document.head||document.documentElement).appendChild(s); }
+ if (document.head) put(); else document.addEventListener('DOMContentLoaded', put);
+ })();`);
+ // Every first-run coach tour on the platform gates on `tour:<id>:done`, and a
+ // capture browser is always a first visit, so every figure of a touring page
+ // would otherwise be a photo of the tour instead of the feature. Answering
+ // "already seen" is what a returning reader's browser says, and it suppresses
+ // the tour before it mounts rather than racing to remove it afterwards.
+ await context.addInitScript(`(function(){
+ try {
+ var real = localStorage.getItem.bind(localStorage);
+ localStorage.getItem = function(key){ return /^tour:.*:done$/.test(key) ? '1' : real(key); };
+ } catch (e) {}
+ })();`);
const page = await context.newPage();
try {
const url = `${BASE_URL}${entry.target}`;
const res = await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 45000 });
if (res && res.status() >= 400) throw new Error(`${url} returned HTTP ${res.status()}`);
await page.waitForTimeout(settle);
- // Floating chrome is not the UI a tutorial is teaching, and most of it
- // rotates its contents per visit, so leaving it in makes every re-capture
- // a spurious diff. Strip it, then let the layout settle before shooting.
+ // The stylesheet above covers the chrome we know by name. Anything else
+ // still pinned to a viewport corner at capture time is chrome too.
await page.evaluate(() => {
- const noise = [
- '#cookie-banner',
- '.cookie-banner',
- '[data-role="consent"]',
- '.newsletter-toast',
- '#tws-corner-stack', // rotating "Have you tried…" + Getting started progress
- 'lang-switcher', // runtime i18n picker, injected on every page
- '.walk-c2w-fx', // full-viewport walk-mode effect layer
- '.nav-skip',
- ];
- for (const sel of noise) document.querySelectorAll(sel).forEach((el) => el.remove());
- // Any leftover fixed overlay pinned to a viewport corner is chrome too.
for (const el of document.querySelectorAll('body > *')) {
if (getComputedStyle(el).position !== 'fixed') continue;
const r = el.getBoundingClientRect();
@@ -183,12 +206,17 @@ async function capturePage(browser, entry) {
});
await page.waitForTimeout(400);
+ // A page driving a render loop never reaches the idle state the default
+ // screenshot path waits for, so a 3D figure times out at exactly the
+ // moment it looks best. Freezing CSS animations and giving the shot a
+ // real budget is what makes the WebGL surfaces capturable at all.
+ const shotOpts = { type: 'png', animations: 'disabled', timeout: 120000 };
let shot;
if (selector) {
const el = await page.waitForSelector(selector, { timeout: 15000, state: 'visible' });
- shot = await el.screenshot({ type: 'png' });
+ shot = await el.screenshot(shotOpts);
} else {
- shot = await page.screenshot({ type: 'png', fullPage });
+ shot = await page.screenshot({ ...shotOpts, fullPage });
}
return shot;
} finally {
@@ -196,11 +224,35 @@ async function capturePage(browser, entry) {
}
}
+/**
+ * Adopt an image that already lives in public/ into the figure system.
+ *
+ * Some real platform output is a file before it is ever a URL: a still rendered
+ * from a model a recipe generated, committed alongside that recipe. Those bytes
+ * are as real as a fresh capture, and without this kind the only way to show one
+ * is a bare markdown <img> with no caption, no placeholder and no lightbox. This
+ * gives it the same figure treatment as everything else.
+ *
+ * It reads from disk only. A missing file is a hard failure, never a silent gap.
+ */
+async function captureLocalImage(entry) {
+ const path = resolve(ROOT, 'public', entry.target.replace(/^\//, ''));
+ if (!existsSync(path)) {
+ throw new Error(`no such image in public/: ${entry.target}`);
+ }
+ const buf = readFileSync(path);
+ if (buf.length < 100) throw new Error(`${entry.target} is ${buf.length} bytes, which is not an image`);
+ return buf;
+}
+
async function captureGlb(entry) {
const width = Math.max(64, Math.min(2048, Number(entry.params.get('w')) || 1200));
const height = Math.max(64, Math.min(2048, Number(entry.params.get('h')) || 900));
const background = entry.params.get('bg') || 'transparent';
- const glbUrl = `${BASE_URL}${entry.target}`;
+ // The renderer fetches the mesh server-side, so the GLB has to be reachable
+ // from outside this machine. Capturing against a local server is normal here;
+ // pointing the renderer at that local URL is not, and it 400s.
+ const glbUrl = `${SITE_URL}${entry.target}`;
const url = `${BASE_URL}/api/render/glb?glbUrl=${encodeURIComponent(glbUrl)}&width=${width}&height=${height}&background=${encodeURIComponent(background)}`;
const res = await fetch(url, { signal: AbortSignal.timeout(120000) });
if (!res.ok) {
@@ -271,7 +323,7 @@ async function main() {
byDirective.get(entry.raw).slugs.add(entry.slug);
}
const entries = [...byDirective.values()];
- console.log(`capture-tutorial-media: ${entries.length} figure(s) across ${new Set(found.map((f) => f.slug)).size} tutorial(s), base ${BASE_URL}`);
+ console.log(`capture-tutorial-media: ${entries.length} figure(s) across ${new Set(found.map((f) => f.slug)).size} document(s), base ${BASE_URL}`);
if (CHECK_ONLY) {
const missing = entries.filter((e) => e.kind !== 'live' && !prevFigures[e.raw]);
@@ -293,7 +345,13 @@ async function main() {
const needsBrowser = entries.some((e) => e.kind === 'page' && (FORCE || !prevFigures[e.raw]));
if (needsBrowser) browser = await chromium.launch({ args: ['--no-sandbox', '--disable-dev-shm-usage'] });
- const figures = {};
+ // A scoped run (--only) sees just one document's directives, and a run where
+ // some captures fail sees fewer still. Writing `figures` fresh would then
+ // publish a manifest missing every figure this run did not look at, and the
+ // prune below would delete their files. Carry the prior manifest forward and
+ // let this run overwrite only what it actually re-captured.
+ const partialRun = Boolean(ONLY);
+ const figures = partialRun ? { ...prevFigures } : {};
let captured = 0;
let reused = 0;
const failures = [];
@@ -302,7 +360,7 @@ async function main() {
for (const entry of entries) {
const slugs = [...entry.slugs].sort();
const name = assetName(entry);
- const rel = `docs/img/tutorials/${slugs[0]}/${name}.webp`;
+ const rel = `${entry.img}/${slugs[0]}/${name}.webp`;
const outPath = resolve(ROOT, 'public', rel);
const prior = prevFigures[entry.raw];
@@ -314,7 +372,8 @@ async function main() {
model: entry.target,
orbit: entry.params.get('orbit') || null,
source: `${SITE_URL}${entry.target}`,
- tutorials: slugs,
+ collection: entry.collection,
+ docs: slugs,
};
console.log(` live ${entry.target}`);
} catch (err) {
@@ -324,13 +383,18 @@ async function main() {
}
if (!FORCE && prior && prior.src && existsSync(resolve(ROOT, 'public', prior.src.replace(/^\//, '')))) {
- figures[entry.raw] = { ...prior, tutorials: slugs };
+ figures[entry.raw] = { ...prior, collection: entry.collection, docs: slugs };
reused += 1;
continue;
}
try {
- const png = entry.kind === 'page' ? await capturePage(browser, entry) : await captureGlb(entry);
+ const png =
+ entry.kind === 'page'
+ ? await capturePage(browser, entry)
+ : entry.kind === 'img'
+ ? await captureLocalImage(entry)
+ : await captureGlb(entry);
mkdirSync(dirname(outPath), { recursive: true });
const { width, height, placeholder } = await encode(png, outPath);
figures[entry.raw] = {
@@ -340,7 +404,8 @@ async function main() {
height,
placeholder,
source: `${SITE_URL}${entry.target}`,
- tutorials: slugs,
+ collection: entry.collection,
+ docs: slugs,
};
captured += 1;
console.log(` wrote /${rel} ${width}x${height}`);
@@ -354,15 +419,21 @@ async function main() {
}
// Drop assets whose directive no longer exists, so the folder tracks the
- // markdown instead of growing forever.
- const live = new Set(Object.values(figures).map((f) => f.src).filter(Boolean));
- for (const rec of Object.values(prevFigures)) {
- if (!rec.src || live.has(rec.src)) continue;
- const stale = resolve(ROOT, 'public', rec.src.replace(/^\//, ''));
- if (existsSync(stale)) {
- rmSync(stale);
- console.log(` pruned /${rec.src.replace(/^\//, '')}`);
+ // markdown instead of growing forever. Only a full sweep may prune: a scoped
+ // run has not read the directives that justify the other files, so to it
+ // every one of them looks orphaned.
+ if (!partialRun && !failures.length) {
+ const live = new Set(Object.values(figures).map((f) => f.src).filter(Boolean));
+ for (const rec of Object.values(prevFigures)) {
+ if (!rec.src || live.has(rec.src)) continue;
+ const stale = resolve(ROOT, 'public', rec.src.replace(/^\//, ''));
+ if (existsSync(stale)) {
+ rmSync(stale);
+ console.log(` pruned /${rec.src.replace(/^\//, '')}`);
+ }
}
+ } else if (failures.length) {
+ console.log(' skipped pruning: this run had failures, so an absent figure may just be one that did not capture.');
}
const payload = {
diff --git a/scripts/check-doc-media.mjs b/scripts/check-doc-media.mjs
new file mode 100644
index 000000000..fc4c2a800
--- /dev/null
+++ b/scripts/check-doc-media.mjs
@@ -0,0 +1,206 @@
+#!/usr/bin/env node
+/**
+ * check-doc-media.mjs: keep the docs' figures honest.
+ *
+ * The media pipeline (scripts/capture-doc-media.mjs) can produce a correct
+ * image and the docs can still be wrong: a tutorial can point at a file nobody
+ * ever captured, a recipe can survive after the doc that used it was rewritten,
+ * an image can be swapped by hand so it no longer matches the manifest it is
+ * described by, and an author can ship an image with no alt text, which is a
+ * defect for every reader using a screen reader.
+ *
+ * None of that is visible in a diff, so this is the gate that sees it.
+ *
+ * node scripts/check-doc-media.mjs report and exit non-zero on failure
+ * node scripts/check-doc-media.mjs --json same checks, machine-readable
+ *
+ * Checks, in order of how badly each one breaks a reader:
+ *
+ * 1. Broken figure a doc references /docs/img/x but no such file exists.
+ * 2. Missing alt a markdown image in docs/ ships with empty alt text.
+ * 3. Uncaptured shot a recipe exists but was never run, so nothing to show.
+ * 4. Tampered file bytes on disk no longer match the manifest's sha256.
+ * 5. Stale usedBy a recipe claims a doc uses it and that doc does not.
+ *
+ * Orphan images (present, unreferenced, not owned by a recipe) are reported as
+ * notes rather than failures: images predating this pipeline are hand-placed and
+ * legitimately owned by their page, not by data/doc-media.json.
+ */
+import { createHash } from 'node:crypto';
+import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
+const SPEC_FILE = path.join(ROOT, 'data/doc-media.json');
+const MANIFEST_FILE = path.join(ROOT, 'public/docs/media-manifest.json');
+const IMG_DIR = path.join(ROOT, 'public/docs/img');
+const DOCS_DIR = path.join(ROOT, 'docs');
+const JSON_OUT = process.argv.includes('--json');
+
+const IMAGE_RE = /!\[([^\]]*)\]\(\s*(\/docs\/img\/[^\s)]+)(?:\s+["'][^"']*["'])?\s*\)/g;
+const HTML_IMG_RE = /<img\b[^>]*\bsrc=["'](\/docs\/img\/[^"']+)["'][^>]*>/gi;
+
+function readJson(file, fallback) {
+ if (!existsSync(file)) return fallback;
+ try {
+ return JSON.parse(readFileSync(file, 'utf8'));
+ } catch (err) {
+ console.error(`check-doc-media: ${path.relative(ROOT, file)} is not valid JSON: ${err.message}`);
+ process.exit(1);
+ }
+}
+
+function walkMarkdown(dir, out = []) {
+ for (const entry of readdirSync(dir)) {
+ const full = path.join(dir, entry);
+ const stats = statSync(full);
+ if (stats.isDirectory()) walkMarkdown(full, out);
+ else if (entry.endsWith('.md')) out.push(full);
+ }
+ return out;
+}
+
+const spec = readJson(SPEC_FILE, { shots: [] });
+const manifest = readJson(MANIFEST_FILE, { shots: {} });
+const shots = spec.shots || [];
+const manifestShots = manifest.shots || {};
+
+const failures = [];
+const notes = [];
+
+// ── Walk every doc once, collecting references ───────────────────────────────
+const referenced = new Map(); // absolute /docs/img/… path → [doc paths]
+const docFiles = existsSync(DOCS_DIR) ? walkMarkdown(DOCS_DIR) : [];
+
+for (const file of docFiles) {
+ const rel = path.relative(ROOT, file);
+ const source = readFileSync(file, 'utf8');
+
+ for (const match of source.matchAll(IMAGE_RE)) {
+ const [, alt, src] = match;
+ if (!alt.trim()) {
+ failures.push({
+ kind: 'missing-alt',
+ doc: rel,
+ src,
+ message: `image has empty alt text: ${src}`,
+ });
+ }
+ if (!referenced.has(src)) referenced.set(src, []);
+ referenced.get(src).push(rel);
+ }
+
+ for (const match of source.matchAll(HTML_IMG_RE)) {
+ const src = match[1];
+ if (!/\balt=/.test(match[0])) {
+ failures.push({
+ kind: 'missing-alt',
+ doc: rel,
+ src,
+ message: `<img> has no alt attribute: ${src}`,
+ });
+ }
+ if (!referenced.has(src)) referenced.set(src, []);
+ referenced.get(src).push(rel);
+ }
+}
+
+// 1. Broken figures: a doc points at an image that is not on disk.
+for (const [src, docs] of referenced) {
+ const onDisk = path.join(ROOT, 'public', src.replace(/^\//, ''));
+ if (!existsSync(onDisk)) {
+ failures.push({
+ kind: 'broken-figure',
+ src,
+ docs,
+ message: `${src} is referenced by ${docs.join(', ')} but does not exist. Run: node scripts/capture-doc-media.mjs --only ${path.basename(src).replace(/\.\w+$/, '')}`,
+ });
+ }
+}
+
+// 3. Uncaptured shots + 4. tampered files.
+for (const shot of shots) {
+ const file = path.join(IMG_DIR, `${shot.id}.webp`);
+ const entry = manifestShots[shot.id];
+ if (!existsSync(file)) {
+ failures.push({
+ kind: 'uncaptured-shot',
+ id: shot.id,
+ message: `recipe "${shot.id}" has never been captured. Run: node scripts/capture-doc-media.mjs --only ${shot.id}`,
+ });
+ continue;
+ }
+ if (!entry) {
+ failures.push({
+ kind: 'uncaptured-shot',
+ id: shot.id,
+ message: `${shot.id}.webp exists but has no manifest entry, so the docs cannot size or attribute it. Re-run the capture.`,
+ });
+ continue;
+ }
+ const sha = createHash('sha256').update(readFileSync(file)).digest('hex');
+ if (entry.sha256 && sha !== entry.sha256) {
+ failures.push({
+ kind: 'tampered-file',
+ id: shot.id,
+ message: `${shot.id}.webp no longer matches the manifest sha256. Images in this directory are generated, not edited: re-run the capture instead of replacing the file.`,
+ });
+ }
+}
+
+// 5. Stale usedBy: the recipe claims a doc renders it, and that doc does not.
+for (const shot of shots) {
+ for (const docSlug of shot.usedBy || []) {
+ const candidates = [
+ path.join(DOCS_DIR, `${docSlug}.md`),
+ path.join(DOCS_DIR, docSlug, 'index.md'),
+ ];
+ const docFile = candidates.find((candidate) => existsSync(candidate));
+ if (!docFile) {
+ failures.push({
+ kind: 'stale-usedby',
+ id: shot.id,
+ message: `recipe "${shot.id}" lists usedBy "${docSlug}", which is not a doc in docs/.`,
+ });
+ continue;
+ }
+ if (!readFileSync(docFile, 'utf8').includes(`/docs/img/${shot.id}.`)) {
+ failures.push({
+ kind: 'stale-usedby',
+ id: shot.id,
+ message: `recipe "${shot.id}" lists usedBy "${docSlug}", but that doc does not reference /docs/img/${shot.id}. Either embed it or drop the claim.`,
+ });
+ }
+ }
+}
+
+// Orphans: informational. Hand-placed images that predate the pipeline are fine.
+const specIds = new Set(shots.map((shot) => shot.id));
+if (existsSync(IMG_DIR)) {
+ for (const file of readdirSync(IMG_DIR)) {
+ const src = `/docs/img/${file}`;
+ const id = file.replace(/\.\w+$/, '');
+ if (referenced.has(src) || specIds.has(id)) continue;
+ notes.push(`${src} is not referenced by any doc and has no recipe`);
+ }
+}
+
+if (JSON_OUT) {
+ console.log(JSON.stringify({ ok: failures.length === 0, failures, notes }, null, '\t'));
+ process.exit(failures.length ? 1 : 0);
+}
+
+const total = referenced.size;
+console.log(
+ `doc media: ${shots.length} recipe(s), ${Object.keys(manifestShots).length} captured, ${total} image reference(s) across ${docFiles.length} docs`,
+);
+
+for (const note of notes) console.log(` note ${note}`);
+for (const failure of failures) console.error(` FAIL ${failure.message}`);
+
+if (failures.length) {
+ console.error(`\n${failures.length} problem(s).`);
+ process.exit(1);
+}
+console.log('\nAll doc figures resolve, carry alt text, and match their manifest.');
diff --git a/tests/tutorial-figures.test.js b/tests/tutorial-figures.test.js
new file mode 100644
index 000000000..45560a5f0
--- /dev/null
+++ b/tests/tutorial-figures.test.js
@@ -0,0 +1,144 @@
+/**
+ * Tutorial figures - the contract between the markdown, the capture pipeline
+ * and the viewer.
+ *
+ * Figures are authored as ordinary markdown images with a `figure:` scheme
+ * inside docs/tutorials/*.md and docs/cookbook/*.md. scripts/capture-tutorial-media.mjs
+ * turns each one into real media (a Chromium screenshot of the deployed page, a
+ * render from our own /api/render/glb, or an interactive model), and
+ * public/tutorial-figures.js mounts them at read time.
+ *
+ * Three ways that contract silently breaks, all caught here:
+ * 1. A directive is malformed, so the capture skips it and the reader gets a
+ * fallback card forever.
+ * 2. A figure is captured, committed, then its markdown is edited away. The
+ * asset lingers and the manifest points at a figure nobody references.
+ * 3. The manifest points at a file that is not in the tree, so production
+ * serves a 404 into a page that looked fine locally.
+ *
+ * These are file-system assertions on purpose. No browser, no network: this has
+ * to be cheap enough to sit in `npm run test:gate`.
+ */
+
+import { describe, it, expect } from 'vitest';
+import { readFileSync, readdirSync, existsSync } from 'node:fs';
+import { resolve, dirname } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
+const MANIFEST_PATH = resolve(ROOT, 'public/tutorial-media.json');
+
+// Kept in step with KINDS in scripts/capture-tutorial-media.mjs.
+const KINDS = new Set(['page', 'glb', 'live', 'img']);
+const FIGURE_RE = /!\[([^\]]*)\]\((figure:[^)\s]+)\)/g;
+
+const COLLECTIONS = [
+ { name: 'tutorials', dir: resolve(ROOT, 'docs/tutorials') },
+ { name: 'cookbook', dir: resolve(ROOT, 'docs/cookbook') },
+];
+
+/** Every figure directive authored across every markdown collection. */
+function collectDirectives() {
+ const found = [];
+ for (const collection of COLLECTIONS) {
+ if (!existsSync(collection.dir)) continue;
+ for (const file of readdirSync(collection.dir).filter((f) => f.endsWith('.md'))) {
+ const md = readFileSync(resolve(collection.dir, file), 'utf8');
+ for (const [, alt, raw] of md.matchAll(FIGURE_RE)) {
+ found.push({ where: `${collection.name}/${file}`, alt, raw });
+ }
+ }
+ }
+ return found;
+}
+
+function parseDirective(raw) {
+ const body = raw.slice('figure:'.length);
+ const colon = body.indexOf(':');
+ if (colon === -1) return null;
+ const kind = body.slice(0, colon);
+ const rest = body.slice(colon + 1);
+ const q = rest.indexOf('?');
+ return { kind, target: q === -1 ? rest : rest.slice(0, q) };
+}
+
+const directives = collectDirectives();
+const manifest = existsSync(MANIFEST_PATH)
+ ? JSON.parse(readFileSync(MANIFEST_PATH, 'utf8'))
+ : null;
+
+describe('figure directives in tutorial and cookbook markdown', () => {
+ it('finds figures to check (the whole feature is gone if this hits zero)', () => {
+ expect(directives.length).toBeGreaterThan(0);
+ });
+
+ it('every directive names a supported kind and a site-absolute target', () => {
+ const bad = [];
+ for (const d of directives) {
+ const parsed = parseDirective(d.raw);
+ if (!parsed) bad.push(`${d.where}: ${d.raw} has no kind`);
+ else if (!KINDS.has(parsed.kind)) bad.push(`${d.where}: unknown kind "${parsed.kind}" in ${d.raw}`);
+ else if (!parsed.target.startsWith('/')) bad.push(`${d.where}: target must start with / in ${d.raw}`);
+ }
+ expect(bad).toEqual([]);
+ });
+
+ it('every directive carries alt text, which becomes both the caption and the a11y label', () => {
+ const missing = directives.filter((d) => !d.alt.trim()).map((d) => `${d.where}: ${d.raw}`);
+ expect(missing).toEqual([]);
+ });
+
+ it('alt text is a real sentence, not a filename or a bare word', () => {
+ const weak = directives
+ .filter((d) => d.alt.trim().length < 25 || /^[\w-]+\.(png|jpe?g|webp|glb)$/i.test(d.alt.trim()))
+ .map((d) => `${d.where}: "${d.alt}"`);
+ expect(weak).toEqual([]);
+ });
+});
+
+describe('captured media manifest', () => {
+ it('exists, so the viewer never falls back for every figure at once', () => {
+ expect(manifest, 'public/tutorial-media.json is missing. Run `npm run tutorials:media`.').not.toBeNull();
+ });
+
+ it('was captured against the public site, not somebody\'s laptop', () => {
+ // A manifest captured from localhost records localhost `source` links,
+ // which ship as dead click-throughs.
+ expect(manifest.base).toMatch(/^https:\/\//);
+ });
+
+ it('holds a record for every non-live directive', () => {
+ const missing = [];
+ for (const d of directives) {
+ const parsed = parseDirective(d.raw);
+ if (!parsed || parsed.kind === 'live') continue;
+ if (!manifest.figures[d.raw]) missing.push(`${d.where}: ${d.raw}`);
+ }
+ expect(missing, 'Run `npm run tutorials:media` to capture these.').toEqual([]);
+ });
+
+ it('points only at files that are actually in the tree', () => {
+ const dead = [];
+ for (const [raw, rec] of Object.entries(manifest.figures)) {
+ if (!rec.src) continue;
+ if (!existsSync(resolve(ROOT, 'public', rec.src.replace(/^\//, '')))) dead.push(`${raw} -> ${rec.src}`);
+ }
+ expect(dead, 'The manifest references media that is not committed; production would 404.').toEqual([]);
+ });
+
+ it('carries no record for a directive no markdown references any more', () => {
+ const authored = new Set(directives.map((d) => d.raw));
+ const orphans = Object.keys(manifest.figures).filter((raw) => !authored.has(raw));
+ expect(orphans, 'Stale manifest entries. A full `npm run tutorials:media` prunes them.').toEqual([]);
+ });
+
+ it('records intrinsic dimensions and a placeholder on every image, so nothing shifts on load', () => {
+ const bad = [];
+ for (const [raw, rec] of Object.entries(manifest.figures)) {
+ if (!rec.src) continue;
+ if (!(rec.width > 0) || !(rec.height > 0)) bad.push(`${raw}: missing width/height`);
+ if (!String(rec.placeholder || '').startsWith('data:image/')) bad.push(`${raw}: missing inline placeholder`);
+ }
+ expect(bad).toEqual([]);
+ });
+});