oficina / slides Public

Slides docs: building a deck with a scene, from the worked example

docs/scenes.md gains the five steps an agent takes (the bundle, one batch
for the scene and its slides, where it carries on, the version, a still
per state); docs/api.md's Scenes and AGENTS.md point at it and at
docs/scenes/example.html.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev cf7e24c8a1779160a8c0cb924e9b257ab731bc88 parent 6d3600f
3 files changed, +50 −1
  • AGENTS.md +12 −0
  • docs/api.md +6 −1
  • docs/scenes.md +32 −0
diff --git a/AGENTS.md b/AGENTS.md
index d9b35ee..067f296 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -243,6 +243,18 @@ comments, and version history. Those are the triggers in spec §9.
`docs/api.md` is the reference for the API, written for a person and an
agent both.
+**Scenes** are a deck's own HTML documents, each drawing a set of named
+states, run in a sealed frame and carried from slide to slide.
+`docs/scenes.md` is the contract a scene keeps, with a worked example
+in `docs/scenes/example.html` (its browser test is
+`TestTheExampleSceneAnswersReady`), and the steps for building a deck
+with a scene through the API: the bundle, one batch for the scene and
+its slides, the version, a still per state. The code: `core/src/scene.rs`
+and `internal/slides/deck/scenes.go` (the document and the version),
+`internal/slides/scenes.go` and `scenestills.go` (the sealed routes and
+the stills), `fixtures/scene-*.mjs` (the frame, its layer and the
+editor's card).
+
**The deployment's object store is bound (2026-11-11, bucket
`carlos-store-bds-slides`) and served through the app**, not presigned:
`cmd/slides` wraps it in `slides.ThroughApp`, so the browser uploads to
diff --git a/docs/api.md b/docs/api.md
index d0065ae..5b390f2 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -611,7 +611,12 @@ which is content-addressed and shared.
### Scenes
A scene is code that draws a set of named states; slides show it
-through `scene` blocks. In the deck's JSON each scene is:
+through `scene` blocks. [scenes.md](scenes.md) says what a scene's code
+must do, starting from a worked example,
+[scenes/example.html](scenes/example.html), and
+[how to build a deck with one](scenes.md#building-a-deck-with-a-scene):
+the bundle, the batch, the version, then a still per state. In the
+deck's JSON each scene is:
```json
"scenes": {"k7m2xqrdwbcd": {"name": "The world", "author": "agent:7",
diff --git a/docs/scenes.md b/docs/scenes.md
index 59ef3c2..f830f30 100644
--- a/docs/scenes.md
+++ b/docs/scenes.md
@@ -201,6 +201,38 @@ other. The text may be 2 MiB and the whole request 2 MiB plus 64 KiB,
so post a large draft as multipart: url-encoding can triple its size.
Only a signed-in person who can open the deck gets an answer.
+## Building a deck with a scene
+
+An agent does it in five steps, all with its bearer token
+([api.md](api.md)):
+
+1. **Upload the bundle.** `POST /api/v1/decks/{sqid}/scene-bundles`
+ with the HTML as the body and `Content-Type: text/html`. It answers
+ `{"ref": "…"}`.
+2. **Add the scene and its slides in one batch.** `add_scene` with that
+ ref as its `code`, and its states, words and data; then the slides
+ and their `scene` blocks. Give the scene an `id` of your own, twelve
+ characters from `a` to `z` and `2` to `7`, so the blocks after it in
+ the batch can name it.
+3. **Decide where it carries on.** Two slides in a row whose blocks show
+ the same scene in the same place (the same `box` on canvas slides,
+ the same region on flow slides) share one frame. Start the second
+ block at the state the first one ends on. A block over the scene's
+ box with a higher `z` makes it start afresh on each slide.
+4. **Work out the version** from the code ref and the data and words you
+ sent ([api.md](api.md#scenes) says how). Sending the same bundle to
+ `PUT /api/v1/decks/{sqid}/scenes/{id}/code` answers it as well.
+5. **Draw a still for each state and upload it.** Serve the bundle with
+ the header above, frame it at 1920 by 1080, send it `init` for the
+ state with `reducedMotion: true`, wait for `ready` and take a picture
+ of the frame. Then `PUT /api/v1/decks/{sqid}/scenes/{id}/stills/{state}?made={version}`.
+ A `409 stale` means the scene changed after you worked the version
+ out: read the deck again and draw again.
+
+To check the result, `GET /api/v1/decks/{sqid}` shows each still's
+`made` equal to the version, and `GET …/slides/{id}.svg` shows each
+slide as the PDF will.
+
## The example
[`scenes/example.html`](scenes/example.html) expects `data.states` to