Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat(choreograph): sequence agent gestures into named, replayable routines
nirholas3f36ce099c0d
diff --git a/STRUCTURE.md b/STRUCTURE.mdindex 42d8c3694..04daf2300 100644--- a/STRUCTURE.md+++ b/STRUCTURE.md@@ -97,6 +97,8 @@ bottom.| Garment Forge (text prompt → catalog garment) | [workers/garment-forge/](workers/garment-forge), public API [api/garment-forge.js](api/garment-forge.js) `→ POST/GET /api/garment-forge`, MCP tools [api/_mcp/tools/garments.js](api/_mcp/tools/garments.js) (`generate_garment`, `garment_status`, `list_garment_catalog`), verify harness [scripts/verify-garment.mjs](scripts/verify-garment.mjs), contract [specs/GARMENT_MANIFEST.md](specs/GARMENT_MANIFEST.md) | Live · Cloud Run CPU (`garment-forge`, us-central1) | Generation lane that feeds the additive wardrobe's catalog: prompt → ghost-mannequin reference photo (Vertex image lane) → PBR mesh on the deployed GPU fleet (`model-hunyuan3d-21-rtx` → `model-hunyuan3d-21` → `model-trellis`) → composed onto the canonical reference body (parametric-base) → rigged by `model-rig` with full-body context → reference body stripped back out (pure glTF repack), bones canonicalized, `occludes` derived from REGION_BONES weight mass, all 6 manifest rules validated in-process (including the ≥60% bind-coverage gate) → `garment.glb` + `manifest.json` + `thumb.webp` published immutably to `gs://three-ws-garments/garments/<slot>/<id>/v<n>/` and appended to the live catalog. Build gate: [workers/garment-forge/test_garment_glb.py](workers/garment-forge/test_garment_glb.py) (33 checks, runs inside `docker build`). Docs: [workers/garment-forge/README.md](workers/garment-forge/README.md) || Parametric avatar base (change-everything sliders) | Baker [scripts/build-parametric-base.mjs](scripts/build-parametric-base.mjs) → [public/avatars/parametric-base.glb](public/avatars), CC0 source data [avatar-sources/anny/](avatar-sources/anny), studio wiring [src/avatar-studio.js](src/avatar-studio.js) (`?base=parametric`) + [src/avatar-sculpt.js](src/avatar-sculpt.js) | Live in Avatar Studio (Base switcher) | One canonical humanoid whose identity is **122 baked morph-target sliders** (nose/ears/mouth/eyes/jaw/cheeks/head shape/neck plus gender, muscle, weight, age, height, torso, hips, limbs), built from the CC0 MakeHuman/MPFB2 body vendored via [naver/anny](https://github.com/naver/anny). 52-bone `mixamorig:*` skeleton, so the full clip library retargets onto every slider combination. Sparse-accessor morphs keep the GLB at ~4 MB. Roadmap to conforming hair/garments + sculpt brush: [prompts/roadmap/avatar-parametric-editor.md](prompts/roadmap/avatar-parametric-editor.md). Tests: [tests/parametric-base.test.js](tests/parametric-base.test.js) || Animation gallery | [pages/animations.html](pages/animations.html) + [src/animations-gallery.js](src/animations-gallery.js) | Live at `/animations` | 2,100+ clips with poster thumbnails ([scripts/build-animation-thumbnails.mjs](scripts/build-animation-thumbnails.mjs)), derived categories ([src/animation-categories.js](src/animation-categories.js)), shared live-preview engine ([src/animations-live-preview.js](src/animations-live-preview.js)) · see [docs/animations.md](docs/animations.md) |+| Gesture vocabulary | [pages/gestures.html](pages/gestures.html) + [src/gestures-page.js](src/gestures-page.js), slots [src/runtime/animation-slots.js](src/runtime/animation-slots.js) | Live at `/gestures` | The 19 gesture slots an agent plays, each previewed on a live avatar, with the skill hints that trigger it and a builder that saves a per-slot clip override straight onto an agent (`meta.edits.animations`). Hint table is generated from the shipped skill definitions by [scripts/build-agent-hints.mjs](scripts/build-agent-hints.mjs), so attribution cannot go stale · see [docs/animations.md](docs/animations.md) |+| Choreographer | [pages/choreograph.html](pages/choreograph.html) + [src/choreograph-page.js](src/choreograph-page.js), engine [src/runtime/choreography.js](src/runtime/choreography.js) | Live at `/choreograph` | Timeline for composing gesture slots into named, timed routines, previewed on the shared live-preview engine with crossfades and a scrubbable playhead. One dependency-free module defines the routine format, the URL wire format and the timing engine; the studio, `PUT /api/agents/:id/animations` (stored at `meta.choreographies`), the public manifest and `AgentAvatar.playChoreography` all import it, and `<agent-3d>.playRoutine('welcome')` performs one from any embed. Also published as `@three-ws/avatar/runtime/choreography.js` · see [docs/choreography.md](docs/choreography.md) || Character Library | [pages/character-library.html](pages/character-library.html) + [src/character-library.js](src/character-library.js) → `/character-library`, API [api/avatars/library.js](api/avatars/library.js) | Live at `/character-library` | 106 professionally rigged Mixamo characters (skinned GLB + thumbnails on R2, `avatars/mixamo/`), each drives the full animation library. Pipeline: [scripts/fetch-mixamo-avatars.mjs](scripts/fetch-mixamo-avatars.mjs) → [scripts/convert-mixamo-avatars.mjs](scripts/convert-mixamo-avatars.mjs) → [scripts/fetch-mixamo-avatar-thumbnails.mjs](scripts/fetch-mixamo-avatar-thumbnails.mjs) → [scripts/build-mixamo-avatar-library.mjs](scripts/build-mixamo-avatar-library.mjs) publishes `avatars/library/manifest.json`. Cards deep-link into the 3D viewer (`/app#model=`), Widget Studio (`/studio?model=`), and Animation Studio (`/pose?src=`). Mirrors the animation-library R2-manifest pattern (no DB). See [public/avatars/mixamo/README.md](public/avatars/mixamo/README.md) || Object Library | [pages/objects.html](pages/objects.html) + [src/objects-library.js](src/objects-library.js) → `/objects`, API [api/objects/library.js](api/objects/library.js) | Live at `/objects` | Hundreds of CC0 (public-domain) 3D props from Poly Haven (packed to GLB on R2, `objects/polyhaven/`). Pipeline: [scripts/fetch-polyhaven-objects.mjs](scripts/fetch-polyhaven-objects.mjs) (glTF→GLB via @gltf-transform) → [scripts/render-glb-thumbnails.mjs](scripts/render-glb-thumbnails.mjs) → [scripts/build-object-library.mjs](scripts/build-object-library.mjs) publishes `objects/library/manifest.json`. Same R2-manifest pattern as the Character/animation libraries (no DB). Cards preview in the 3D viewer (`/app#model=`), place into AR Studio (`/ar/studio?src=`), and download the GLB directly (CC0). AR Studio's tray also has an Objects tab over the same manifest. || Agent-Forged Gallery | [pages/forged.html](pages/forged.html) + [src/forged-gallery.js](src/forged-gallery.js) → `/forged`, API [api/forged.js](api/forged.js), writer [api/_lib/x402/pipelines/forge-content.js](api/_lib/x402/pipelines/forge-content.js) | Live at `/forged` | 3D props BOUGHT by the autonomous x402 agents with real USDC: the hourly forge-content pipeline pays `/api/x402/forge` (draft tier), the generated GLB lands in `forge_autonomous_props` with payment provenance (payer wallet, price, Solana settlement signature), and `/forged` renders each prop with its on-chain receipt linked to Solscan. Honest feed: no synthetic entries; before the first paid generation the page shows its designed empty state. Category chips (crate/barrel/furniture/terrain), prompt search, newest/priciest/most-novel sorts. |diff --git a/avatar-sdk/build.mjs b/avatar-sdk/build.mjsindex 341422a8b..d08ad9f3f 100644--- a/avatar-sdk/build.mjs+++ b/avatar-sdk/build.mjs@@ -30,6 +30,22 @@ mkdirSync(outDir, { recursive: true });copyFileSync(src, resolve(outDir, 'index.mjs'));+// Runtime modules published as their own subpaths. Both are dependency-free+// (no Three.js, no DOM), which is the whole reason they can ship this way: a+// consumer driving its own renderer wants the gesture vocabulary and the+// routine sequencer without pulling in a second WebGL context. `choreography`+// imports `animation-slots` by relative path, so they travel together.+const runtimeDir = resolve(outDir, 'runtime');+mkdirSync(runtimeDir, { recursive: true });+for (const name of ['animation-slots.js', 'choreography.js']) {+ const from = resolve(repoRoot, 'src', 'runtime', name);+ if (!existsSync(from)) {+ console.error(`[avatar-sdk] src/runtime/${name} is missing. Cannot publish the subpath.`);+ process.exit(1);+ }+ copyFileSync(from, resolve(runtimeDir, name));+}+// Stylesheet stub. The custom element injects its own styles, so this is empty// — but consumers that bundle ".css" side-effect imports get a no-op instead// of a missing-file error.diff --git a/avatar-sdk/package.json b/avatar-sdk/package.jsonindex 5d74de6d8..09d571094 100644--- a/avatar-sdk/package.json+++ b/avatar-sdk/package.json@@ -59,6 +59,8 @@"import": "./src/react.jsx","default": "./src/react.jsx"},+ "./runtime/choreography.js": "./dist/runtime/choreography.js",+ "./runtime/animation-slots.js": "./dist/runtime/animation-slots.js","./style.css": "./dist/style.css"},"files": [diff --git a/data/changelog.json b/data/changelog.jsonindex 3ad914f4f..fc6063caf 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -1,6 +1,16 @@{"$comment": "Curated changelog entries for three.ws, the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.","entries": [+ {+ "date": "2026-07-31",+ "title": "Your agent can perform a routine, not just a gesture",+ "summary": "Until now an agent's body language was one beat at a time: a wave, a nod, a celebration, each fired on its own by something that happened. There was no way to say \"when someone lands on my agent, have it wave, then nod, then settle\", which is what a greeting actually is. The new Choreographer at three.ws/choreograph is a timeline for exactly that. Drop gestures onto it, set how long each one holds, drag them into the order you want, and watch the whole performance play on a live 3D avatar as you edit, with a playhead that follows along. Five routines are there to start from (a welcome, a demo pitch, a win, a failure, and a waiting loop) and every one of them is editable. Save a routine to an agent you own and it travels with that agent: any site embedding it can play the whole performance by name with one line of code, and it holds the stage, so a stray reaction cannot cut into the middle of it. A routine is also just a link, so you can share one with someone who has no account and they can open it, play it, and change it. Routines are built from gesture names rather than specific motion files, which means the same routine looks right on someone else's agent, in their agent's own body language.",+ "tags": [+ "feature",+ "sdk"+ ],+ "link": "/choreograph"+ },{"date": "2026-07-30","title": "Your agent's gestures now work, and you can choose them",diff --git a/data/pages.json b/data/pages.jsonindex 450612afe..f3d42c856 100644--- a/data/pages.json+++ b/data/pages.json@@ -55,6 +55,14 @@"changefreq": "weekly","added": "2026-07-30"},+ {+ "path": "/choreograph",+ "title": "Choreographer",+ "description": "Compose agent gestures into a timed routine on a real timeline, preview the whole performance on a live 3D avatar, then save it to your agent and play it by name from any embed.",+ "priority": 0.7,+ "changefreq": "weekly",+ "added": "2026-07-31"+ },{"path": "/character-library","title": "Character Library",@@ -3574,6 +3582,13 @@"priority": 0.6,"changefreq": "monthly"},+ {+ "path": "/docs/choreography",+ "title": "Docs · Choreography",+ "description": "The developer reference for agent gesture routines: the routine format, the storage and manifest fields, the URL wire format that makes a link a routine, and every way to play one from an embed or your own renderer.",+ "priority": 0.6,+ "changefreq": "monthly"+ },{"path": "/docs/architecture","title": "Docs · Architecture overview",diff --git a/docs/choreography.md b/docs/choreography.mdnew file mode 100644index 000000000..5a07fdc07--- /dev/null+++ b/docs/choreography.md@@ -0,0 +1,241 @@+# Choreography++A three.ws agent already reacts on its own: it thinks while a skill runs, nods when a model loads, celebrates a settled payment. Those are single beats, each one a **gesture slot** resolved to a clip ([Animations](animations.md) is the reference for that layer).++A **routine** is the next thing up: a named, timed sequence of those gestures, authored once and replayed on demand. Wave, then nod, then settle into idle. Inspect, think, point, present. It is the difference between an agent that twitches in response to events and one that performs.++Compose one at **[three.ws/choreograph](https://three.ws/choreograph)**. This page is the developer reference: the shape of a routine, where it is stored, how it travels, and every way to play one.++- Build and preview: [/choreograph](https://three.ws/choreograph)+- The gesture vocabulary a routine is built from: [/gestures](https://three.ws/gestures)+- Every clip a step can point at: [/animations](https://three.ws/animations)++---++## What a routine is++```json+{+ "id": "welcome",+ "name": "Welcome",+ "loop": false,+ "steps": [+ { "slot": "wave", "clip": null, "hold": 2, "speed": 1 },+ { "slot": "nod", "clip": null, "hold": 1.2, "speed": 1 },+ { "slot": "idle", "clip": null, "hold": 1.6, "speed": 1 }+ ]+}+```++| Field | Meaning |+| --- | --- |+| `id` | Slug derived from `name` unless you set it. This is the key `playRoutine('welcome')` looks up. Unique per agent. |+| `name` | Display name, up to 40 characters. |+| `loop` | `true` restarts the routine instead of ending it. Use it for waiting states, not greetings. |+| `steps` | 1 to 24 beats, played back to back in order. |+| `steps[].slot` | One of the 19 gesture slots ([the vocabulary](animations.md#agent-slots)). Required. |+| `steps[].clip` | Optional. Pins this step to one specific clip instead of letting the slot resolve. `null` is the normal case. |+| `steps[].hold` | How long the beat occupies the timeline, 0.2 to 20 seconds. Defaults to 1.6. |+| `steps[].speed` | Playback rate, 0.25 to 3. A step at `2` occupies half its `hold` on the timeline. |++Everything is validated by one module, [`src/runtime/choreography.js`](../src/runtime/choreography.js), which the studio, the API and the avatar runtime all import. There is no second definition anywhere, so a routine the browser can build is exactly a routine the server will store and the avatar will play.++### Why steps name slots, not clips++A step says `wave`, not `wave.json`. The slot resolves at playback time, in this order:++1. the step's own `clip`, if it pins one+2. the performing agent's slot bindings (`meta.edits.animations`, editable on [/gestures](https://three.ws/gestures))+3. the platform default for that slot++That ordering is the whole point of the format. Share a routine with someone whose agent has remapped `dance` to its own clip and the routine still reads correctly on their agent, in their agent's body language. Pin a clip only when the specific motion *is* the intent.++---++## Storing a routine on an agent++Routines live at `meta.choreographies` on the agent record. Write them with the animations endpoint:++```bash+curl -X PUT https://three.ws/api/agents/$AGENT_ID/animations \+ -H "authorization: Bearer $THREE_WS_API_KEY" \+ -H "content-type: application/json" \+ -d '{+ "choreographies": [+ {+ "name": "Welcome",+ "steps": [+ { "slot": "wave", "hold": 2 },+ { "slot": "nod", "hold": 1.2 },+ { "slot": "idle", "hold": 1.6 }+ ]+ }+ ]+ }'+```++```json+{+ "animations": [],+ "animationGraph": null,+ "animationSlots": null,+ "choreographies": [+ {+ "id": "welcome",+ "name": "Welcome",+ "loop": false,+ "steps": [+ { "slot": "wave", "clip": null, "hold": 2, "speed": 1 },+ { "slot": "nod", "clip": null, "hold": 1.2, "speed": 1 },+ { "slot": "idle", "clip": null, "hold": 1.6, "speed": 1 }+ ]+ }+ ]+}+```++Rules worth knowing before you call it:++- **The field is a full replacement.** Send the whole list you want the agent to end up with. To add one routine, read the existing list, merge on `id`, send the result. The studio does exactly this.+- **Omitting the field changes nothing.** Every field on this endpoint is independent: saving `animationSlots` alone never touches your routines, and vice versa.+- **`"choreographies": []` clears them.**+- **The response is read back from the row**, not echoed from your request, so it is the truth about what is stored.+- **Limits:** 12 routines per agent, 24 steps per routine, unique ids. A violation is a `400 validation_error` naming the problem, never a silent truncation.+- **Owner only.** Session cookie (with CSRF) or a bearer token belonging to the agent's owner.++---++## Playing a routine++### From an embed++Any page already rendering an [`<agent-3d>`](embedding.md) element can perform the agent's saved routines by name:++```html+<agent-3d agent="YOUR_AGENT_ID"></agent-3d>++<script type="module">+ const el = document.querySelector('agent-3d');+ el.playRoutine('welcome');+</script>+```++`playRoutine()` accepts either an id (or display name) of a saved routine, or a literal routine object your page owns:++```js+el.playRoutine({+ name: 'Thinking it over',+ steps: [+ { slot: 'think', hold: 2.4 },+ { slot: 'point', hold: 1.2 },+ { slot: 'present', hold: 2.4 },+ ],+});+```++| Method | Behavior |+| --- | --- |+| `playRoutine(idOrRoutine, { loop })` | Performs it. Returns `false` when a named routine does not exist. Safe to call before the avatar has booted: the call is queued and lands on mount. |+| `stopRoutine()` | Ends the performance. The current gesture reverts to idle as usual. |+| `getRoutines()` | The agent's saved routines, normalized. |++A performing routine outranks the avatar's autonomous reflexes: an emotion spike that would normally fire `celebrate` on its own waits until the routine finishes rather than cutting into it. That gate is what makes an authored performance survive a busy agent.++### Reacting to real events++The routine is the vocabulary; your page decides when it speaks. A trading surface might do:++```js+const el = document.querySelector('agent-3d');++source.addEventListener('fill', () => el.playRoutine('shipped-it'));+source.addEventListener('error', () => el.playRoutine('bad-news'));+source.addEventListener('pending', () => el.playRoutine('waiting', { loop: true }));+```++`loop: true` on a waiting routine is the honest version of a spinner: the agent stays alive on screen for as long as the work takes, without pretending to progress.++### In your own renderer++If you drive an avatar directly rather than through the embed, the same engine is importable. It owns sequencing and timing and nothing else, so it composes with whatever loop you already run:++```js+import { RoutinePlayer } from '@three-ws/avatar/runtime/choreography.js';++const player = new RoutinePlayer(routine, {+ onStep: (step) => avatar.playSlot(step.slot, step.hold / step.speed, step.clip),+ onEnd: () => console.log('done'),+});++player.start();+// then, from your animation loop:+player.update(deltaSeconds);+```++| Member | Behavior |+| --- | --- |+| `start()` | Restarts from the top and fires the first step immediately. |+| `update(dt)` | Advances by `dt` seconds. A large `dt` (a backgrounded tab) catches up rather than replaying every intervening step. |+| `seek(t)` | Moves the playhead and re-fires the step it lands on. This is what the studio's timeline scrubber calls. |+| `pause()` / `resume()` / `stop()` | Transport. `update()` is a no-op while paused, so you can call it unconditionally. |+| `time`, `index`, `playing`, `duration` | Read-only state for a progress bar or a playhead. |++---++## Sharing a routine without an account++Routines round-trip through the URL, so a link is the routine. The studio keeps `?r=` in sync as you edit:++```+https://three.ws/choreograph?r=Welcome%7Cwave%3A2%2Cnod%3A1.2%2Cidle%3A1.6+```++The encoding is deliberately legible rather than base64, so you can read a link before you click it and hand-write one when that is easier:++```+Name|slot:hold[*speed][@clip],slot:hold,…+```++- `Welcome|wave:2,nod:1.2` gives two beats+- `Slow%20clap|celebrate:3*0.5` plays at half speed+- `Encore|dance:4@rumba` pins a specific clip+- `Waiting~loop|patience:3,fidget:2.4` sets `loop` via the `~loop` suffix on the name++`encodeRoutine()` and `decodeRoutine()` in the runtime module are the canonical implementations. A malformed link throws with the reason rather than dropping steps quietly, and the studio shows that reason instead of silently loading something else.++---++## The studio++[/choreograph](https://three.ws/choreograph) is the authoring surface. Worth knowing:++- **It opens on a real routine**, not an empty timeline. Five presets cover the common performances (welcome, pitch, shipped it, bad news, long wait).+- **The timeline is real time.** Segment width is the beat's actual duration, so a long step looks long. Click to jump to a beat, drag to scrub, and the 3D stage follows the playhead.+- **Steps crossfade** on the preview stage, and the camera frames the union of every clip in the routine once, rather than re-framing at each cut. What you preview is what the embed performs.+- **Reordering works without a pointer.** Drag the grip, or use the ↑/↓ button on any row.+- **Keyboard:** <kbd>Space</kbd> play/pause, <kbd>R</kbd> restart, <kbd>←</kbd>/<kbd>→</kbd> scrub, <kbd>Esc</kbd> stop.+- **Nothing 3D loads until you press play.** The page paints without a WebGL context.+- **Signed out, everything except saving works**: composing, previewing, sharing the link.++Coming from [/gestures](https://three.ws/gestures), the **Use in a routine** button carries the gesture you have staged (and its clip, if you overrode one) straight into the studio as a one-step routine.++---++## Where each piece lives++| Piece | File |+| --- | --- |+| Format, validation, wire format, timing engine | [`src/runtime/choreography.js`](../src/runtime/choreography.js) |+| Studio page | [`pages/choreograph.html`](../pages/choreograph.html), [`src/choreograph-page.js`](../src/choreograph-page.js) |+| Storage + validation at the boundary | [`api/agents/_id/_sub.js`](../api/agents/_id/_sub.js) (`handleAnimations`) |+| Public manifest field | `api/agents/_id/_sub.js` (`handleManifest`) |+| Playback on the avatar | [`src/agent-avatar.js`](../src/agent-avatar.js) (`playChoreography`) |+| Embed API | [`src/element.js`](../src/element.js) (`playRoutine`) |+| Tests | [`tests/choreography.test.js`](../tests/choreography.test.js), [`tests/agent-avatar-choreography.test.js`](../tests/agent-avatar-choreography.test.js), [`tests/agent-choreography-wiring.test.js`](../tests/agent-choreography-wiring.test.js) |++## Related++- [Animations](animations.md): clips, collections, and the slot vocabulary underneath every routine+- [Procedural animation](procedural-animation.md): the IK layers that run on top of whatever clip is playing+- [Agent manifest](agent-manifest.md): the public document that carries `choreographies` to embeds+- [Embedding an agent](embedding.md): the `<agent-3d>` element these methods live ondiff --git a/docs/nav.json b/docs/nav.jsonindex 511adea19..efa08ec2d 100644--- a/docs/nav.json+++ b/docs/nav.json@@ -692,6 +692,10 @@"label": "Animations (clips & slots)","path": "animations"},+ {+ "label": "Choreography (gesture routines)",+ "path": "choreography"+ },{"label": "Avatar inspector","path": "avatar-inspector"diff --git a/docs/start-here.md b/docs/start-here.mdindex 834676f40..0decd4b0f 100644--- a/docs/start-here.md+++ b/docs/start-here.md@@ -71,6 +71,7 @@ Curious what happens between the prompt and the model? [How the Forge works](./h- **Just exploring?** → Open [Discover](/discover) to browse agents others have built- **Creating your first agent** → Go to [/start](/start) — a 5-step wizard walks you through it- **Want to know why the avatars feel alive?** → [Procedural animation](./procedural-animation.md) — the runtime IK layers that run on top of the recorded clips: gaze that follows your cursor or meets your eyes, and feet that land on uneven ground instead of floating over it+- **Want your agent to perform, not just react?** → [Choreography](./choreography.md): compose gestures into a named routine on a real timeline at [/choreograph](https://three.ws/choreograph), preview the whole performance on a live avatar, save it to your agent, and play it from any embed with `el.playRoutine('welcome')`. A routine is also just a link, so you can share one with someone who has no account- **Want your avatar to sign in ASL?** → Start with the 15-minute walkthrough, [Make your avatar sign](https://three.ws/tutorials/sign-with-your-avatar): type a phrase and watch it signed at [/sign-language](https://three.ws/sign-language), share it as a link (`?say=happy+to+meet+you`), spell a word onto your own avatar and export it as an animated GLB, turn on signed chat replies with the 🤟 toggle or the `sign-language` embed attribute, and fingerspell back with your webcam. The full reference is [Sign language](./sign-language.md)- **Wondering who the little character in the corner is?** → [The agent shell](./agent-shell.md) — every visitor gets a named agent in the first five seconds (claim it to make it real), the ⌘K palette runs real commands (`forge …`, `digest`, `price btc`, `ask …`), and shell pages navigate without ever unloading your agent- **Want to drive your agent's computer yourself?** → [Take the wheel](./agent-screen-control.md), every agent has a live screen you can watch on [/agent-screen](https://three.ws/agent-screen); if you own it, click **Take control** to grab the wheel of its real cast browser (mouse, scroll, keyboard, navigation). The agent stands aside while you drive, and the browser holds no wallet, so control can never move fundsdiff --git a/pages/choreograph.html b/pages/choreograph.htmlindex 08c7497d3..6985775b1 100644--- a/pages/choreograph.html+++ b/pages/choreograph.html@@ -63,6 +63,10 @@<a class="ch-btn ch-btn--ghost" href="/animations">Browse every clip</a><a class="ch-btn ch-btn--ghost" href="/docs/choreography">Developer reference</a></div>+ <!-- Reserved for the one message a sighted user must not miss: a shared+ link that could not be read. The live region below the stage carries+ everything else. -->+ <p class="ch-notice" data-role="notice" role="alert" hidden></p></section><section class="ch-body">diff --git a/pages/gestures.html b/pages/gestures.htmlindex 03e9fad58..32cd6c5c4 100644--- a/pages/gestures.html+++ b/pages/gestures.html@@ -15,12 +15,12 @@<meta property="og:title" content="Agent Gestures · three.ws" /><meta property="og:description" content="The agent gesture vocabulary: 19 slots, the clip each plays, the skills that trigger them, and a live override builder." /><meta property="og:url" content="https://three.ws/gestures" />- <meta property="og:image" content="https://three.ws/api/page-og?s=build&t=Agent+Gestures&d=Every+gesture+a+three.ws+agent+can+play%2C+previewed+live%2C+with+the+skills+that+trigger+it.&p=%2Fgestures" />+ <meta property="og:image" content="https://three.ws/api/page-og?s=main&t=Agent+Gestures&d=The+three.ws+agent+gesture+vocabulary%3A+every+animation+slot%2C+the+clip+it+plays%2C+the+skills+that+trigger+it%2C+and+a+builder+for+overriding+any+slot+on+your+own&p=%2Fgestures" /><meta name="twitter:card" content="summary_large_image" /><meta name="twitter:site" content="@trythreews" /><meta name="twitter:title" content="Agent Gestures · three.ws" /><meta name="twitter:description" content="19 gesture slots, previewed live, with the skills that trigger each one." />- <meta name="twitter:image" content="https://three.ws/api/page-og?s=build&t=Agent+Gestures&d=Every+gesture+a+three.ws+agent+can+play%2C+previewed+live%2C+with+the+skills+that+trigger+it.&p=%2Fgestures" />+ <meta name="twitter:image" content="https://three.ws/api/page-og?s=main&t=Agent+Gestures&d=The+three.ws+agent+gesture+vocabulary%3A+every+animation+slot%2C+the+clip+it+plays%2C+the+skills+that+trigger+it%2C+and+a+builder+for+overriding+any+slot+on+your+own&p=%2Fgestures" /><link rel="icon" href="/favicon.ico" sizes="any" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" />@@ -60,8 +60,9 @@it, and how to point a slot at any other clip in the library.</p><div class="gv-hero-actions">- <a class="gv-btn gv-btn--primary" href="/animations">Browse every clip</a>- <a class="gv-btn gv-btn--secondary" href="/pose">Animation Studio</a>+ <a class="gv-btn gv-btn--primary" href="/choreograph">Sequence gestures into a routine</a>+ <a class="gv-btn gv-btn--secondary" href="/animations">Browse every clip</a>+ <a class="gv-btn gv-btn--ghost" href="/pose">Animation Studio</a><a class="gv-btn gv-btn--ghost" href="/docs/animations">Developer reference</a></div><dl class="gv-stats" data-role="stats" aria-live="polite">@@ -153,6 +154,10 @@<div class="gv-override-actions"><button type="button" class="gv-btn gv-btn--ghost" data-role="override-reset">Reset to default</button>+ <!-- Carries the staged slot and clip straight into the sequencer,+ so "this gesture is good" turns into a routine without+ re-picking it there. Href is rewritten on every selection. -->+ <a class="gv-btn gv-btn--ghost" href="/choreograph" data-role="override-sequence">Use in a routine</a></div></div></aside>diff --git a/public/choreograph.css b/public/choreograph.cssindex 363377dfe..af498c858 100644--- a/public/choreograph.css+++ b/public/choreograph.css@@ -108,6 +108,17 @@gap: 10px;}+.ch-notice {+ margin: 18px 0 0;+ padding: 11px 14px;+ border: 1px solid color-mix(in srgb, var(--ch-err) 45%, transparent);+ border-radius: 10px;+ background: color-mix(in srgb, var(--ch-err) 12%, transparent);+ font-size: 13px;+ line-height: 1.55;+ color: var(--text, #fafafa);+}+/* ── Buttons ───────────────────────────────────────────────────────────── */.ch-btn {diff --git a/src/agent-avatar.js b/src/agent-avatar.jsindex 071c9e039..12dea8cfb 100644--- a/src/agent-avatar.js+++ b/src/agent-avatar.js@@ -503,7 +503,14 @@ export class AgentAvatar {playChoreography(nameOrRoutine, opts = {}) {let routine = null;if (typeof nameOrRoutine === 'string') {- routine = this._routines?.get(slugify(nameOrRoutine)) ?? null;+ // Ids are the contract, but a caller who types the display name it saw+ // in the studio ("Take a bow") means the same routine as `take-a-bow`,+ // and failing that is a papercut with no upside.+ const key = slugify(nameOrRoutine);+ routine =+ this._routines?.get(key) ??+ [...(this._routines?.values() ?? [])].find((r) => slugify(r.name) === key) ??+ null;if (!routine) {log.warn(`[AgentAvatar] no choreography named "${nameOrRoutine}"`);return false;diff --git a/src/choreograph-page.js b/src/choreograph-page.jsindex 8c14ece52..fcc6cba7e 100644--- a/src/choreograph-page.js+++ b/src/choreograph-page.js@@ -74,6 +74,8 @@ const state = {stagedClip: null, // clip currently mounted on the stageagents: null, // null = not fetched, [] = signed out or nonedragIndex: -1,+ loadedFromLink: false,+ boundClips: [],};/* ── helpers ───────────────────────────────────────────────────────────── */@@ -425,6 +427,10 @@ function renderSavedRoutines() {/** Every mutation funnels through here so the URL, exports and stage agree. */function commit({ restage = true } = {}) {+ // Any edit answers the "your link was broken" notice: the routine on screen+ // is now the user's own, so the warning about the one they arrived with is+ // stale.+ setNotice('');renderSteps();if (restage) restageIfPlaying();highlightActive();@@ -468,6 +474,19 @@ function setStatus(text) {el('stage-status').textContent = text;}+/**+ * The one message that gets its own visible slot. `setStatus` writes to a+ * screen-reader live region, which is right for play/pause chatter and wrong+ * for "your link was broken": a sighted user arriving on a bad share link would+ * otherwise see a routine they did not ask for and no explanation.+ * @param {string} text (empty to clear)+ */+function setNotice(text) {+ const box = el('notice');+ box.textContent = text;+ box.hidden = !text;+}+function setStageState(name, detail = '') {el('stage-empty').hidden = name !== 'empty';el('stage-loading').hidden = name !== 'loading';@@ -532,6 +551,10 @@ async function startPlayback(fromIndex = 0) {el('stage-loading-text').textContent =state.stagedClip ? 'Cueing the routine…' : 'Retargeting the routine…';if (!state.stagedClip) setStageState('loading');+ // Flip the transport before the await. Binding every clip in the routine can+ // take seconds on a cold first play, and a play button that still reads "▶"+ // while the stage spins reads as a click that did not register.+ setPlayButton(true);await prepareClips(routine);@@ -976,9 +999,14 @@ renderPresets();wire();loadManifest();loadAgents();-if (!applyDeepLink()) {+const linkError = applyDeepLink();+if (!state.loadedFromLink) {// An empty timeline is the hardest screen to start on, so the page opens on a// real routine. Nothing 3D loads until the user presses play.loadRoutine(PRESET_ROUTINES[0], { announce: false });- setStatus('Loaded the Welcome routine. Press play, or change any step.');+ const opening = linkError+ ? `That shared routine could not be read (${linkError}). Loaded the Welcome routine instead.`+ : 'Loaded the Welcome routine. Press play, or change any step.';+ setStatus(opening);+ if (linkError) setNotice(opening);}diff --git a/src/gestures-page.js b/src/gestures-page.jsindex db8d827fc..ff16504f4 100644--- a/src/gestures-page.js+++ b/src/gestures-page.js@@ -241,6 +241,11 @@ function renderOverride() {$('code', el('override-code')).textContent = json;const isDefault = state.clip === DEFAULT_ANIMATION_MAP[state.slot];el('override-reset').disabled = isDefault;+ // Hand the staged slot (and its clip, when it is not the default) to the+ // sequencer as a one-step routine. Same wire format /choreograph shares with,+ // so the link is the routine rather than a hint to go rebuild it there.+ const step = isDefault ? `${state.slot}:1.6` : `${state.slot}:1.6@${state.clip}`;+ el('override-sequence').href = `/choreograph?r=${encodeURIComponent(state.slot)}|${step}`;renderApply();}diff --git a/tests/agent-avatar-choreography.test.js b/tests/agent-avatar-choreography.test.jsnew file mode 100644index 000000000..f1297f80f--- /dev/null+++ b/tests/agent-avatar-choreography.test.js@@ -0,0 +1,260 @@+/**+ * AgentAvatar x choreography: routine playback on a live avatar.+ *+ * tests/choreography.test.js pins the routine format and the timing engine in+ * isolation. This file pins the half that engine cannot check on its own: that+ * a routine actually reaches the rig, in order, with the right clips, and that+ * it holds the stage against the reflexes that would otherwise cut into it.+ *+ * Every historical bug in this area was one of those two failures (a gesture+ * that resolved to nothing, or an autonomous trigger stomping a deliberate+ * one), so both are asserted against clip names the fake rig actually has, in+ * the same style as tests/agent-avatar-mood-gesture.test.js. No renderer or real+ * clips needed: `_tickEmotion()` is the frame hook, so driving it directly is+ * driving the real playback path.+ */++import { describe, it, expect, beforeEach } from 'vitest';+import { DEFAULT_ANIMATION_MAP } from '../src/runtime/animation-slots.js';++let AgentAvatar;++function makeRoot() {+ return {+ isObject3D: true,+ children: [],+ traverse(fn) {+ fn(this);+ },+ };+}++/** Records every clip name handed to the animation manager, in order. */+function makeFakeAnimationManager(loadedNames = []) {+ const loaded = new Set(loadedNames);+ const played = [];+ return {+ currentName: null,+ isLoaded: (name) => loaded.has(name),+ getAnimationDefs: () => [],+ play: (name) => {+ played.push(name);+ return Promise.resolve(true);+ },+ crossfadeTo: (name) => {+ played.push(name);+ },+ played,+ };+}++function makeAvatar(am) {+ return new AgentAvatar({ content: makeRoot(), animationManager: am, state: {} }, {}, {+ id: 'test',+ });+}++/** Advance the avatar's frame hook by `seconds`, in `steps` slices. */+function run(avatar, seconds, steps = 20) {+ for (let i = 0; i < steps; i++) avatar._tickEmotion(seconds / steps);+}++const WELCOME = {+ name: 'Welcome',+ steps: [+ { slot: 'wave', hold: 1 },+ { slot: 'nod', hold: 1 },+ { slot: 'celebrate', hold: 1 },+ ],+};++/** The clips WELCOME resolves to on a rig with no overrides. */+const WELCOME_CLIPS = ['wave', 'nod', 'celebrate'].map((s) => DEFAULT_ANIMATION_MAP[s]);++beforeEach(async () => {+ if (!AgentAvatar) ({ AgentAvatar } = await import('../src/agent-avatar.js'));+});++describe('AgentAvatar.playChoreography', () => {+ it('plays every step, in order, on the rig', () => {+ const am = makeFakeAnimationManager(WELCOME_CLIPS);+ const avatar = makeAvatar(am);++ expect(avatar.playChoreography(WELCOME)).toBe(true);+ run(avatar, 3.2);++ expect(am.played).toEqual(WELCOME_CLIPS);+ });++ it('plays the first step immediately, before a frame has passed', () => {+ const am = makeFakeAnimationManager(WELCOME_CLIPS);+ const avatar = makeAvatar(am);++ avatar.playChoreography(WELCOME);+ expect(am.played).toEqual([WELCOME_CLIPS[0]]);+ });++ it('honors the agent’s own slot overrides', () => {+ const am = makeFakeAnimationManager(['victory-dance-custom', 'nod', 'wave']);+ const avatar = makeAvatar(am);+ avatar.setAnimationMap({ celebrate: 'victory-dance-custom' });++ avatar.playChoreography(WELCOME);+ run(avatar, 3.2);++ expect(am.played).toContain('victory-dance-custom');+ expect(am.played).not.toContain(DEFAULT_ANIMATION_MAP.celebrate);+ });++ it('a step that pins a clip beats both the override and the default', () => {+ const am = makeFakeAnimationManager(['thriller', 'rumba']);+ const avatar = makeAvatar(am);+ avatar.setAnimationMap({ dance: 'rumba' });++ avatar.playChoreography({ name: 'Pinned', steps: [{ slot: 'dance', clip: 'thriller' }] });++ expect(am.played).toEqual(['thriller']);+ });++ it('reports performing state and stops on request', () => {+ const am = makeFakeAnimationManager(WELCOME_CLIPS);+ const avatar = makeAvatar(am);++ avatar.playChoreography(WELCOME);+ expect(avatar.isPerforming).toBe(true);++ avatar.stopChoreography();+ expect(avatar.isPerforming).toBe(false);++ const before = am.played.length;+ run(avatar, 3.2);+ // A stopped routine must not keep firing steps on later frames.+ expect(am.played.length).toBe(before);+ });++ it('stops performing once the routine ends', () => {+ const am = makeFakeAnimationManager(WELCOME_CLIPS);+ const avatar = makeAvatar(am);++ avatar.playChoreography(WELCOME);+ run(avatar, 3.5);++ expect(avatar.isPerforming).toBe(false);+ expect(am.played).toEqual(WELCOME_CLIPS);+ });++ it('loops without ever ending when asked to', () => {+ const am = makeFakeAnimationManager(WELCOME_CLIPS);+ const avatar = makeAvatar(am);++ avatar.playChoreography(WELCOME, { loop: true });+ run(avatar, 7, 70);++ expect(avatar.isPerforming).toBe(true);+ expect(am.played.length).toBeGreaterThan(WELCOME_CLIPS.length);+ expect(am.played.slice(0, 6)).toEqual([...WELCOME_CLIPS, ...WELCOME_CLIPS]);+ });++ it('starting a second routine replaces the first rather than interleaving', () => {+ const am = makeFakeAnimationManager([...WELCOME_CLIPS, DEFAULT_ANIMATION_MAP.bow]);+ const avatar = makeAvatar(am);++ avatar.playChoreography(WELCOME);+ avatar.playChoreography({ name: 'Bow', steps: [{ slot: 'bow', hold: 1 }] });+ run(avatar, 3.2);++ expect(am.played).toEqual([WELCOME_CLIPS[0], DEFAULT_ANIMATION_MAP.bow]);+ });++ it('an emotion spike cannot cut into a performing routine', () => {+ // A high celebration weight normally fires the celebrate slot on its own+ // (Stage 3). While a routine performs, the routine owns the body: without+ // this gate the reflex fires in the seam between two steps and the+ // authored performance visibly breaks.+ const am = makeFakeAnimationManager([DEFAULT_ANIMATION_MAP.bow, DEFAULT_ANIMATION_MAP.celebrate]);+ const avatar = makeAvatar(am);++ avatar.playChoreography({+ name: 'Slow bow',+ steps: [+ { slot: 'bow', hold: 2 },+ { slot: 'bow', hold: 2 },+ ],+ });+ avatar._emotion.celebration = 1;+ run(avatar, 4, 80);++ expect(am.played.every((clip) => clip === DEFAULT_ANIMATION_MAP.bow)).toBe(true);+ });++ it('the same emotion spike still fires once the routine is over', () => {+ const am = makeFakeAnimationManager([DEFAULT_ANIMATION_MAP.bow, DEFAULT_ANIMATION_MAP.celebrate]);+ const avatar = makeAvatar(am);++ avatar.playChoreography({ name: 'Quick bow', steps: [{ slot: 'bow', hold: 0.5 }] });+ run(avatar, 0.6, 6);+ avatar._emotion.celebration = 1;+ run(avatar, 1, 10);++ expect(am.played).toContain(DEFAULT_ANIMATION_MAP.celebrate);+ });+});++describe('AgentAvatar.setChoreographies', () => {+ const SAVED = [+ { id: 'welcome', name: 'Welcome', steps: [{ slot: 'wave', hold: 1 }] },+ { id: 'bow', name: 'Take a bow', steps: [{ slot: 'bow', hold: 1 }] },+ ];++ it('registers routines and plays one by id', () => {+ const am = makeFakeAnimationManager([DEFAULT_ANIMATION_MAP.wave]);+ const avatar = makeAvatar(am);++ expect(avatar.setChoreographies(SAVED)).toBe(2);+ expect(avatar.playChoreography('welcome')).toBe(true);+ expect(am.played).toEqual([DEFAULT_ANIMATION_MAP.wave]);+ });++ it('resolves a routine by its display name too', () => {+ const am = makeFakeAnimationManager([DEFAULT_ANIMATION_MAP.bow]);+ const avatar = makeAvatar(am);+ avatar.setChoreographies(SAVED);++ expect(avatar.playChoreography('Take a bow')).toBe(true);+ expect(am.played).toEqual([DEFAULT_ANIMATION_MAP.bow]);+ });++ it('reports a miss instead of guessing a routine', () => {+ const am = makeFakeAnimationManager([]);+ const avatar = makeAvatar(am);+ avatar.setChoreographies(SAVED);++ expect(avatar.playChoreography('nope')).toBe(false);+ expect(am.played).toEqual([]);+ });++ it('drops an invalid saved routine without losing the valid ones', () => {+ // One malformed entry (a stored routine from a future format, a hand-edited+ // record) must not cost the agent its whole body language.+ const am = makeFakeAnimationManager([DEFAULT_ANIMATION_MAP.wave]);+ const avatar = makeAvatar(am);++ expect(avatar.setChoreographies([{ id: 'broken', steps: [] }, SAVED[0]])).toBe(1);+ expect(avatar.playChoreography('welcome')).toBe(true);+ });++ it('refuses an invalid literal routine rather than throwing at the caller', () => {+ const am = makeFakeAnimationManager([]);+ const avatar = makeAvatar(am);++ expect(avatar.playChoreography({ name: 'Nope', steps: [{ slot: 'moonwalk' }] })).toBe(false);+ expect(avatar.isPerforming).toBe(false);+ });++ it('exposes the registered routines', () => {+ const avatar = makeAvatar(makeFakeAnimationManager([]));+ avatar.setChoreographies(SAVED);++ expect(avatar.getChoreographies().map((r) => r.id)).toEqual(['welcome', 'bow']);+ });+});diff --git a/tests/agent-choreography-wiring.test.js b/tests/agent-choreography-wiring.test.jsnew file mode 100644index 000000000..4122c745e--- /dev/null+++ b/tests/agent-choreography-wiring.test.js@@ -0,0 +1,150 @@+/**+ * The choreography feature is only real if all four of its ends stay connected:+ * the studio composes a routine, the API stores it, the manifest publishes it,+ * and the embed plays it. Each end lives in a different file, and each one on+ * its own looks finished while the chain is broken. That is the exact failure mode+ * that shipped `meta.edits.animations` with a writer and no reader+ * (tests/agent-animation-slots.test.js documents that one).+ *+ * So this file asserts the seams, in the same source-reading style as that+ * test: importing the handler would drag in the DB client and the session+ * layer, and the point here is the wiring, not the SQL.+ */++import { describe, it, expect } from 'vitest';+import { readFileSync } from 'node:fs';+import { fileURLToPath } from 'node:url';+import { dirname, resolve } from 'node:path';+import { normalizeRoutines, MAX_ROUTINES, MAX_STEPS } from '../src/runtime/choreography.js';++const __dirname = dirname(fileURLToPath(import.meta.url));+const read = (p) => readFileSync(resolve(__dirname, p), 'utf8');+const SUB = read('../api/agents/_id/_sub.js');++describe('the API validates with the runtime module, not a second opinion', () => {+ it('imports the shared normalizer instead of restating the shape in zod', () => {+ expect(SUB).toMatch(/from '\.\.\/\.\.\/\.\.\/src\/runtime\/choreography\.js'/);+ expect(SUB).toContain('normalizeRoutines(list)');+ });++ it('accepts what the studio produces', () => {+ const fromStudio = [+ { id: 'welcome', name: 'Welcome', steps: [{ slot: 'wave', clip: null, hold: 2, speed: 1 }] },+ ];+ expect(normalizeRoutines(fromStudio)).toEqual([+ { id: 'welcome', name: 'Welcome', loop: false, steps: [{ slot: 'wave', clip: null, hold: 2, speed: 1 }] },+ ]);+ });++ it('rejects at the boundary what the avatar could not play', () => {+ expect(() => normalizeRoutines([{ name: 'Bad', steps: [{ slot: 'moonwalk' }] }])).toThrow();+ expect(() => normalizeRoutines([{ name: 'Empty', steps: [] }])).toThrow();+ expect(() =>+ normalizeRoutines([{ name: 'Path', steps: [{ slot: 'wave', clip: '../../etc/passwd' }] }]),+ ).toThrow();+ });++ it('caps both dimensions so one agent cannot store an unbounded blob', () => {+ const many = Array.from({ length: MAX_ROUTINES + 1 }, (_, i) => ({+ name: `R${i}`,+ steps: [{ slot: 'wave' }],+ }));+ expect(() => normalizeRoutines(many)).toThrow(/at most/);+ const long = [+ { name: 'Long', steps: Array.from({ length: MAX_STEPS + 1 }, () => ({ slot: 'wave' })) },+ ];+ expect(() => normalizeRoutines(long)).toThrow(/at most/);+ });++ it('an empty array is the documented way to clear them', () => {+ expect(normalizeRoutines([])).toEqual([]);+ });+});++describe('the handler stores and returns them', () => {+ it('writes to meta.choreographies', () => {+ expect(SUB).toContain("'{choreographies}'");+ });++ it('leaves them alone when the request omits the field', () => {+ // The same non-destructive rule as every other field on this endpoint: a+ // slot-only save must not wipe an agent's routines.+ expect(SUB).toContain("has('choreographies')");+ });++ it('reads the stored value back into the response rather than echoing input', () => {+ expect(SUB).toMatch(/meta->'choreographies' AS choreographies/);+ expect(SUB).toContain('choreographies: row?.choreographies ?? []');+ });++ it('lists the field in the "send at least one of" guard', () => {+ expect(SUB).toContain('b.choreographies !== undefined');+ });+});++describe('the manifest publishes them and the embed plays them', () => {+ it('the public manifest carries the routines', () => {+ expect(SUB).toContain('choreographies: Array.isArray(row.meta?.choreographies)');+ });++ it('the embed registers the manifest routines on the avatar', () => {+ const element = read('../src/element.js');+ expect(element).toContain('manifest.choreographies');+ expect(element).toContain('this._avatar.setChoreographies(_routines)');+ });++ it('the embed exposes a public play method', () => {+ const element = read('../src/element.js');+ expect(element).toContain('playRoutine(nameOrRoutine');+ expect(element).toContain('stopRoutine()');+ // A routine asked for before boot has to land after it, or every host page+ // that calls it from its own load handler silently does nothing.+ expect(element).toContain('_applyPendingRoutine');+ });++ it('the avatar drives routines from the same frame hook as everything else', () => {+ const avatar = read('../src/agent-avatar.js');+ expect(avatar).toContain('this._routinePlayer?.update(dt)');+ // The gate that stops an autonomous reflex cutting into a performance.+ expect(avatar).toContain('!this._isPlayingOneShot && !this._routinePlayer');+ });+});++describe('the studio is reachable and wired', () => {+ it('the page is registered as a build input and a route', () => {+ expect(read('../vite.config.js')).toContain("choreograph: resolve(__dirname, 'pages/choreograph.html')");+ expect(read('../vercel.json')).toContain('/choreograph.html');+ });++ it('the gesture page links into it, carrying the staged gesture', () => {+ const gestures = read('../src/gestures-page.js');+ expect(gestures).toContain('/choreograph?r=');+ expect(read('../pages/gestures.html')).toContain('data-role="override-sequence"');+ });++ it('the studio saves through the documented endpoint', () => {+ const page = read('../src/choreograph-page.js');+ expect(page).toContain('/api/agents/${agentId}/animations');+ expect(page).toContain('choreographies: merged');+ });++ it('the studio previews with the shared runtime player, not its own timer', () => {+ const page = read('../src/choreograph-page.js');+ expect(page).toContain("from './runtime/choreography.js'");+ expect(page).toContain('new RoutinePlayer(');+ });++ it('the page is declared in data/pages.json so the sitemap and changelog see it', () => {+ const pages = JSON.parse(read('../data/pages.json'));+ const all = pages.sections.flatMap((s) => s.pages || []);+ const entry = all.find((p) => p.path === '/choreograph');+ expect(entry, '/choreograph missing from data/pages.json').toBeTruthy();+ expect(entry.title).toBeTruthy();+ expect(entry.description.length).toBeGreaterThan(40);+ });++ it('the developer reference exists and is linked from the page', () => {+ expect(read('../docs/choreography.md').length).toBeGreaterThan(1000);+ expect(read('../pages/choreograph.html')).toContain('/docs/choreography');+ });+});diff --git a/vercel.json b/vercel.jsonindex c9e3014c4..2e5c449a4 100644--- a/vercel.json+++ b/vercel.json@@ -230,6 +230,10 @@"src": "/cdn/(.+)","dest": "/api/cdn-object?key=$1"},+ {+ "src": "/atlas/?$",+ "dest": "/atlas.html"+ },{"src": "/agent-exchange","dest": "/agent-exchange.html"diff --git a/vite.config.js b/vite.config.jsindex 3ae3848b8..de3626919 100644--- a/vite.config.js+++ b/vite.config.js@@ -359,6 +359,7 @@ const appConfig = {'app-next': resolve(__dirname, 'pages/app-next.html'),home: resolve(__dirname, 'pages/home.html'),'what-is': resolve(__dirname, 'pages/what-is.html'),+ atlas: resolve(__dirname, 'pages/atlas.html'),tour: resolve(__dirname, 'pages/tour.html'),concierge: resolve(__dirname, 'pages/concierge.html'),'tour-builder': resolve(__dirname, 'pages/tour-builder.html'),