oficina / slides Public

Clone
git clone https://amadan.net/oficina/slides

Plain git — no account needed to clone.

Download

Download this file

1# Scenes and clips — design
2
3Design, 2026-11-23, by Claude Opus 5.5 from conversation with Paul the
4same day. Draft 2 after a builder check (§8). Approved by Paul 2026-11-24 ("Go ahead"). Builds on the editor-tidy design §9 (the
5order of slices) and the steps slice (presses, the presenter window).
6
7## 0. Intent
8
9The HalfStack Vienna talk explained itself with moving pictures: one
10small world (the corporate district, Paul's garden, the buildings he
11owns) shown from slide to slide, changing a little with each press, and
12short screen recordings of apps in use. Slides could not do either, so
13the talk ran on a custom deck. This slice lets a deck carry both.
14
15**Success** is that the HalfStack world can be a scene in a Slides deck:
16written by an agent, its words and pieces adjustable by Paul in the
17editor, carried from slide to slide as he presses, and shown as a still
18picture wherever code can't run.
19
20### 0.1 Goals
21
221. A **scene** is code (HTML, CSS, JavaScript, WebGL) that belongs to a
23 deck and draws named **states**.
242. Any slide can show a scene and walk it through a range of its states,
25 one per press.
263. When the next slide shows the same scene in the same place, the scene
27 **carries on**: it stays on screen and moves to the new state.
284. A scene runs **sealed**: no network, no cookies, no way into Slides or
29 the person's account.
305. Every state has a **still picture**, used wherever the scene doesn't
31 run, and a text **description** for assistive technology.
326. Paul can change a scene by asking an agent, or by hand in the editor:
33 its words, its data, which states a slide shows, and its code.
347. A **clip** is a short video uploaded to a deck, played on a press,
35 looped or played once.
36
37### 0.2 Non-goals
38
39- Dragging a scene's pieces on the slide (the data table covers it).
40- Scenes that talk to the network, play sound, or read the camera.
41- Server-side rendering of stills (no headless browser on our side).
42- A separate origin for scenes (approach B, possible later).
43- Editing or trimming video; streaming; captions files (later).
44
45### 0.3 Anti-goals
46
47- **A scene that can reach anything.** A scene that reads a cookie, calls
48 the network or touches the page around it is a failure even if it
49 draws beautifully.
50- **A blank where a scene should be.** The PDF, a thumbnail, the phone,
51 the presenter's Next preview, reduced motion and scripts-off all show
52 the state's still.
53- **A press with no visible answer**, as in the steps slice.
54- **A cut between slides that share a scene.** Carrying on is the point.
55
56## 1. Decisions
57
58| # | Decision | Whose |
59|---|---|---|
60| C1 | A scene is code an agent writes, run sealed, told only its state, size, words, data and whether to reduce motion. Slides keeps the presses. | Paul (editor-tidy §9) |
61| C2 | Stored as a fixed bundle with a named author. | Paul (§9) |
62| C3 | A still picture per state, used by the PDF, thumbnails, phone view and checks. | Paul (§9) |
63| C4 | A scene can appear on several slides and carries on between them. | Paul, 23 Nov |
64| C5 | Changed by asking an agent, and by hand in the editor. | Paul, 23 Nov |
65| C6 | Approach A: a sealed frame on the same site; stills made by whoever writes the scene. | Paul, 23 Nov |
66| C7 | Editing by hand has three layers: words and states in the slide's card, data as a table, code in a panel with a live preview. | Paul ("Seems good") |
67| C8 | States are named and absolute, like positions. | This design |
68| C9 | A scene's words and data live in the deck, not in its code. | This design |
69| C10 | Clips are stored like pictures; their still is their first frame, captured in the uploader's browser. | This design |
70
71## 2. The document
72
73**Scenes** are a deck-level map, `scenes`, keyed by scene id:
74
75- `name`: shown in the editor.
76- `author`: the agent or person who wrote the current code.
77- `code`: the ref of a stored bundle, one HTML document (≤ 2 MiB) holding
78 all its script and style inline.
79- `states`: an ordered list of `{id, name, description}`. `id` is stable;
80 `name` shows in the editor; `description` is the text assistive
81 technology reads for that state.
82- `words`: a map of key → text, the scene's labels.
83- `data`: one JSON value (≤ 2 MiB), the scene's model. For the world:
84 its pieces, and a per-state table (camera, sky, which pieces show,
85 signs, figures, routes), with routes worked out when the data is made,
86 never by the scene at run time.
87- `version`: a hash the server computes over the code ref, the data and
88 the words; it changes with any of them.
89- `stills`: a map of state id → `{ref, made}`, where `made` is the
90 `version` the still was drawn from.
91
92**A scene block** on a slide: `type: "scene"`, `props: {scene, from,
93to}` where `from` and `to` are state ids. The block arrives with the
94slide at `from`; each press then moves one state towards `to`. It takes
95part in presses exactly as an `each` list does: its own `step` says
96which press starts it (absent means right after arrival), and
97`deck.Presses` gives it one press per state after `from`.
98
99**Clips**: a picture-like asset of kind video (MP4 or WebM, ≤ 50 MiB)
100with a poster still; a `clip` block, `props: {asset, play: "press" |
101"loop" | "once"}`. Clips play muted in this slice (screen recordings;
102sound needs a gesture in the window that plays it, which the slide
103window doesn't get). `play: press` takes one press, like an `each` item;
104going back pauses and rewinds it. `loop` and `once` start when the block
105arrives.
106
107All of it travels on existing ops plus `add_scene`, `set_scene`,
108`remove_scene`, in Rust, JS and Go with vectors, as the fixtures rule
109requires.
110
111## 3. Running a scene
112
113- **The frame.** A scene runs in an `<iframe>` whose document comes from
114 `/{surface}/scenes/{id}/{code}` with the response header
115 `Content-Security-Policy: sandbox allow-scripts; default-src 'none';
116 script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data:
117 blob:; font-src data:; media-src data: blob:`. The sandbox without
118 `allow-same-origin` gives it an opaque origin: no cookies, no storage,
119 nothing of the page around it, no network, no forms, no popups, no
120 navigation of the top window.
121- **The conversation.** Slides sends `{type: "init", state, size, words,
122 data, reducedMotion, fonts}` and then `{type: "state", state, animate}`;
123 the scene answers `{type: "ready"}` once and nothing else matters.
124 Messages are checked by source window. A scene that doesn't answer
125 within 3 seconds is shown as its still.
126- **A small contract**, `docs/scenes.md`, with a 40-line example, is all
127 an agent needs to write one.
128- **Carrying on.** When the next slide in the talk has a scene block for
129 the same scene with the same box, the presenting windows keep the
130 frame and send the new state with `animate: true`. Otherwise the new
131 slide's frame starts at its `from` state. Going back moves it back.
132 Jumps send the target state with `animate: false`. Two blocks of one
133 scene on a slide each run a frame; they pair with the next slide's
134 blocks of that scene by order (first with first), and only a pair in
135 the same box carries on (final review ruling).
136- **Where it runs live:** the editor stage (while the block is selected
137 or the play-through runs), the slide and presenter windows' Now panel,
138 the viewer and share link, the follow link. **Where the still shows:**
139 thumbnails, the PDF, the phone view, the presenter's Next preview,
140 scripts off, reduced motion (the scene still runs, told to reduce
141 motion, but readers who asked for less motion get the still until a
142 state settles), and any frame that isn't ready.
143- **Next previews the next press**, so its still is the state that press
144 arrives at, while thumbnails and the PDF show each scene block at its
145 `to` state (final review ruling).
146
147## 4. Stills
148
149- The agent that writes or changes a scene renders each state in its own
150 browser and uploads the stills through the API
151 (`PUT /api/v1/decks/{sqid}/scenes/{id}/stills/{state}`, PNG or WebP,
152 ≤ 4 MiB), recording the version they came from.
153- When code, data or words change, the editor marks the scene's stills as
154 out of date (a small note on the block's card) and offers to ask the
155 deck's agent to redo them. Out-of-date stills are still used rather
156 than nothing.
157- A clip's still is its first frame, drawn by the uploader's browser onto
158 a canvas and uploaded with it.
159
160## 5. Editing by hand
161
162- **The slide's card** for a scene block: the scene's name, *From* and
163 *To* state menus, its words as text fields, and the out-of-date note.
164- **Data**: a table for a list of objects (rows and columns from the
165 data), with a raw JSON view for anything else; changes redraw the
166 selected block live.
167- **Code**: a panel with the bundle's text and a live preview in the same
168 sealed frame. Saving makes a new bundle and marks the stills out of
169 date. Paul is the named author of a hand edit.
170- Agents use the API ops and the stills route; they see scenes in the
171 deck's JSON like everything else.
172
173## 6. Constraints and testing
174
175From AGENTS.md: no flash, scripts-off works, 320px reflow, WCAG 2.2 AA,
176every UI string a catalog key through Paul's copy review first. A
177scene's own words are deck content, edited by the deck's people, not UI
178copy.
179
180Tests, each written first:
181- The sandbox: a scene that tries `fetch`, `document.cookie`,
182 `localStorage`, `top.location` and a form post gets nothing and
183 changes nothing.
184- Presses: a scene block's states as presses beside other steps, with
185 the same vectors in Go and JS.
186- Carrying on: two slides sharing a scene keep one frame and animate; a
187 jump lands on the right state; a different box starts fresh.
188- Stills everywhere a scene can't run, and out-of-date marking.
189- Clips: play on a press, loop, once; the poster in pictures and PDF.
190- Existing decks render byte for byte.
191- The HalfStack world as the worked example: a scene built from
192 `acts/world.py`'s model and drawn with its CSS 3D kit, walked through
193 a short deck.
194
195## 7. Order of building
196
1971. The document: scenes, scene and clip blocks, ops, presses, vectors.
1982. Serving and the sealed frame, the contract and the example.
1993. Running scenes on every surface, carrying on, stills in pictures and
200 PDF.
2014. The stills API and out-of-date marking.
2025. The editor: the card, the data table, the code panel.
2036. Clips.
2047. The HalfStack world as a scene, in a deck.
205
206## 8. Calls from the builder check
207
208A builder read draft 1 and asked nine questions. None needed Paul; these
209are this design's calls, each reversible:
210
2111. **The HalfStack world** becomes one scene, ported from
212 `acts/worldsvg.py` and `paintWorld()` (SVG, iso and flat looks as part
213 of each state), with `acts/world.py`'s model exported as `data`,
214 routes precomputed. Not a CSS 3D rewrite.
2152. **Pictures of a range** show the block's `to` state, the slide fully
216 built, as steps already do; the PDF stays one page a slide.
2173. **A state with no still** shows a plain panel in the scene's box with
218 the scene's name and the state's description, drawn by Slides; a
219 check in the editor lists scenes missing stills.
2204. **The bundle** is a new asset kind, `scene`, through the existing
221 upload, register and verify flow (sniffed as one HTML document,
222 served only through the sealed route); **stills** go through the
223 picture flow, PNG or WebP as pictures already allow. The sealed
224 route checks the same capability as pictures on `/d`, `/s` and `/p`;
225 the remote shows stills only.
2265. **`version`** is computed by the server (above); the stills route
227 takes the `version` the agent read and refuses one that isn't
228 current. Any change to code, data or words marks stills out of date.
2296. **The code panel's preview** posts the unsaved text to a
230 preview-only route for signed-in editors, which answers it under the
231 same sealed policy. The sealed route sets `frame-ancestors 'self'`,
232 so the app's one-policy test gains this exception.
2337. **The same box** means the same `box` on canvas slides and the same
234 region on flow slides. Carrying on keeps one frame in a layer outside
235 the slide's DOM on every scripted surface; with scripts off each
236 slide shows its still.
2378. **Clips** play muted (§2).
2389. **`author`** is filled in by the server from whoever acted;
239 `set_scene` patches fields; `words` merges per key, `data` is
240 replaced whole.
241
242## 9. Left to the builder
243
244Table and column layouts; the message field names beyond those above;
245how the data table infers columns; exact size limits if a real scene
246needs more.
247