@protomaze/demo-engine 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -106,7 +106,8 @@ Presentation (shown until the step ends, or `for` ms; `clear` takes all down):
106
106
  The app may add its own actions (a map's `view`, `mapClick`): `validate` lists every kind it knows
107
107
  when one is wrong; read the app's demos (`demoEngine.get(id)`) for examples.
108
108
 
109
- Step options: `title` (for the editor), `hold` (ms after), `pause: true` (waits for the presenter).
109
+ Step options: `title` (for the editor), `hold` (ms after), `pause: true` (waits for the presenter),
110
+ `notes` (on the presenter's screen only: what to add live, figures to mention, questions to expect).
110
111
 
111
112
  `cleanup`: actions done after the demo - when it ends or is stopped - quickly and unseen, so the app
112
113
  is as it found it and the demo plays again: clear filters and searches, close what was opened, go
package/README.md CHANGED
@@ -1,176 +1,201 @@
1
- # Protomaze Demo Engine
2
-
3
- Demos of a web app, made and played in the app itself, in the browser: no backend.
4
-
5
- - **Make**: by an AI through the browser (`window.demoEngine`), by recording what you do (and say),
6
- or by hand in the studio, on a `@protomaze/time` timeline.
7
- - **Narrate**: text to speech in the browser (Kokoro, Piper: free, no key) or ElevenLabs; speech to
8
- text (Whisper in the browser, or ElevenLabs) turns what you said into narration and subtitles.
9
- - **Show**: a stand-in pointer, spotlights, rings, arrows, notes, blur, title cards, zoom, keycaps.
10
- - **Play**: as a video would; **present** step by step with a clicker; **guide** a viewer who does
11
- each step themselves (tutorials, trainings); **loop** unattended at an expo booth.
12
- - **Film**: an MP4 or WebM of the tab with narration, music and subtitles, made in the browser, at
13
- exactly 720p, 1080p, 1440p or 4K, landscape, portrait or square.
14
- - **Music**: four tracks the engine composes itself (calm, lo-fi, bright, piano) - free to use
15
- anywhere, nothing downloaded - or a file of one's own; quieter under the narration.
16
- - **Share**: `.demo.json`, a scenario `.md`, a link with the demo in it, the video, `.vtt` / `.srt`.
17
-
18
- ```bash
19
- npm run dev # the sample app, on http://localhost:8095: "Demos" bottom left
20
- npm test # the model: validation, timing, subtitles
21
- npm run check # type-check everything, sample included
22
- ```
23
-
24
- ## In an app
25
-
26
- ```ts
27
- import { DemoEngine, dictionaryLabels } from '@protomaze/demo-engine';
28
-
29
- const engine = new DemoEngine({
30
- app: 'orders', // where demos, videos and settings are kept
31
- demos: [{ demo: tour, scenario: tourMarkdown }], // the app's own, checked in as <id>.demo.json
32
- languages: ['en', 'de'], // narration is written in these
33
- language: () => i18n.language, // the page's
34
- labels: dictionaryLabels(() => LOCALES[i18n.language], key => t(key)), // targets in every language
35
- start: { // where a demo starts, in the app's terms
36
- current: () => ({ tenant, mode }),
37
- go: start => (start.tenant !== tenant ? reloadWith(start) : setMode(start.mode)), // 'reload' if it navigates
38
- },
39
- plugins: [mapPlugin(map)], // actions only the app knows
40
- ready: () => map.whenReady(), // before a demo plays
41
- filmElement: () => document.getElementById('app'), // videos crop to it, where the browser can
42
- launcher: true, // a "Demos" button, for apps without a panel
43
- });
44
- await engine.mount();
45
- ```
46
-
47
- Or put the library in the app's own panel: `<DemoLibrary engine={engine} />` (in its own shadow
48
- root: the app's styles stay out). Everything else - the studio, the bars while playing and
49
- recording, effects - the engine renders over the app, in the top layer.
50
-
51
- From code: `engine.play(demo, { from })`, `engine.guide(demo)`, `engine.film(demo)`,
52
- `engine.record()`, `engine.loop(demos, { idle, reset: 'reload' })`, `engine.check(demo)`,
53
- `engine.openStudio(demo)`, `engine.link(demo)`. Sound and filming need a click in the app's window:
54
- started from elsewhere (a dev panel in its own window, a link, code) the engine asks for one.
55
- React: `useEngine(engine)`, `useDemos(engine)`.
56
-
57
- ## Demos
58
-
59
- ```json
60
- {
61
- "id": "risk-tour",
62
- "title": "Risk, explained",
63
- "start": { "tenant": "Gelsenkirchen" },
64
- "steps": [
65
- {
66
- "say": { "en": "Which pipes matter most?", "de": "Welche Haltungen sind am wichtigsten?" },
67
- "actions": [
68
- { "do": "spotlight", "target": { "css": "[data-demo=\"risk matrix\"]" } },
69
- { "do": "click", "target": { "css": "button", "key": "risk_reset_weights" }, "cue": 0, "wait": 1200 }
70
- ]
71
- }
72
- ]
73
- }
74
- ```
75
-
76
- Each step's narration is spoken a sentence at a time, each a subtitle, while its actions play one
77
- after the other. A target is `{ css, text?, key?, index? }`: the elements matching `css` whose label -
78
- `data-demo`, their text, `aria-label`, a field's label - is `text`, or the locale `key`'s text in the
79
- page's language. Labels compare without case or spacing, every number as `#`. `wait` is ms before an
80
- action (800), `cue` starts it with a sentence of the step: synced in every language and voice.
81
-
82
- Actions: `click`, `hover`, `type`, `key`, `select`, `drag`, `scroll`, `waitFor`; and to present,
83
- `spotlight`, `ring`, `arrow`, `callout`, `blur`, `card`, `zoom`, `clear` (shown till the step ends,
84
- or `for` ms). [AGENTS.md](AGENTS.md) has every field; it is also what an AI reads.
85
-
86
- A demo leaves the app as it found it, so it plays again and the next starts where it expects:
87
- its `cleanup` actions run after it - when it ends or is stopped - quickly and unseen (filters
88
- cleared, what it opened closed); what the app cannot undo through its UI, `start.go` resets before
89
- every play and check (a sandbox tenant, demo data reloaded, the page reloaded).
90
-
91
- `data-demo="name"` on an element names it for demos in every language and gives targets a scope.
92
- `data-demo-ignore` keeps a part of the page out of recording and targets (a dev panel).
93
-
94
- ## Plugins
95
-
96
- What only the app knows: a map's views and points, a canvas chart's bars.
97
-
98
- ```ts
99
- const mapPlugin = (map: WebGLMap): DemoPlugin => ({
100
- name: 'map',
101
- actions: {
102
- view: { play: action => showBounds(map, action.bounds), read: () => 'Move the map', duration: () => 1200 },
103
- mapClick: {
104
- async play(action, { hand }) {
105
- const at = toView(map, action.at); // lon, lat → px in the map
106
- const box = map.domNode.getBoundingClientRect();
107
- await hand.click(map.domNode, { x: box.left + at.x, y: box.top + at.y }, { shift: action.shift });
108
- },
109
- read: () => 'Click on the map',
110
- },
111
- },
112
- record: ({ push }) => {
113
- const moved = map.on('MapChange', () => /* once at rest */ push({ do: 'view', bounds: viewBounds(map) }));
114
- return {
115
- claims: element => map.domNode.contains(element), // the engine records nothing there itself
116
- click: (element, x, y) => ({ do: 'mapClick', at: toWorld(map, x, y) }),
117
- stop: () => moved.remove(),
118
- };
119
- },
120
- });
121
- ```
122
-
123
- ## Playing
124
-
125
- | | |
126
- |---|---|
127
- | Space | pause, resume |
128
- | → Enter PageDown | waiting: go on; else on to the next step (the rest of this one done quickly) |
129
- | ← PageUp | waiting: say the step again |
130
- | Esc | stop |
131
- | Ctrl+Shift+L | stop a loop |
132
- | Recording: Alt+N, Alt+H, Esc | next step, a hover where the pointer is, stop |
133
-
134
- While a demo plays, the viewer's own clicks, keys and scrolling do not reach the app - they would
135
- take the demo off its path - and the bar says why. Paused, the app is theirs. Guided, the ringed
136
- part is. At a booth, a visitor's touch hands the app over.
137
-
138
- A presenter's clicker sends PageDown and PageUp: "Wait for the presenter after each step" makes
139
- a pitch. Guided, the viewer does each click, entry and choice; "Do it for me" lets the demo. Looped,
140
- a visitor's touch hands the app over; after `idle` it plays on, from the app's start (or a reload).
141
- A booth with sound: start the browser allowing it, e.g. Chrome's
142
- `--autoplay-policy=no-user-gesture-required --kiosk`.
143
-
144
- ## In the browser
145
-
146
- Free voices and Whisper download once from public CDNs (jsDelivr, Hugging Face) and are kept by the
147
- browser: about 80-330 MB for Kokoro, 60 MB per Piper voice, 40-250 MB for Whisper. An ElevenLabs
148
- key is kept in the browser's local storage, every sentence paid for once and kept. Demos, videos
149
- and the music are kept in IndexedDB, per app. Filming uses the tab's own capture (Chrome, Edge:
150
- MP4; Firefox: WebM).
151
-
152
- ## From Ing+ `src/demos`
153
-
154
- The format is the same: `.demo.json` files play as they are, once the map's actions
155
- (`view`, `mapClick`, `mapHover`) come in as a plugin. `DemoPlayer`, `DemoRecorder`, `DemoTargets`,
156
- `DemoSpeech`, `DemoVideo`, `DemoStore`, `DemoLink`, `DemoSession`, `DemoOverlay` and `DemoEditor` are
157
- the engine; `DemosGroup` becomes `<DemoLibrary>`; `start` and its reloads go to `start`; the locale
158
- keys to `labels`; the highlight manager's readiness to `ready`.
159
-
160
- ## Publishing
161
-
162
- Straight to npm, by [`.github/workflows/publish.yml`](.github/workflows/publish.yml) with npm's
163
- **Trusted Publishing**: no npm token anywhere. A `v*.*.*` tag push runs it: it tests, compiles and
164
- publishes `build/`, which is the package.
165
-
166
- ```bash
167
- npm version patch # or minor / major - bumps package.json and tags it
168
- git push --follow-tags
169
- ```
170
-
171
- One-time setup, by the npm account owner: publish the first version by hand (`npm login
172
- --auth-type=web`, then `npm run deploy`; `npm-first-publish.cmd` in the protomaze folder does both),
173
- then in the package's settings on npmjs.com add a Trusted Publisher: GitHub Actions, repository
174
- `protomaze/demo-engine`, workflow `publish.yml`. npm checks `repository.url` in `package.json`
175
- against the repository, so it stays `git+https://github.com/protomaze/demo-engine.git`. The
176
- protomaze folder's `NPM_README.md` has the whole procedure, for every package.
1
+ # Protomaze Demo Engine
2
+
3
+ Demos of a web app, made and played in the app itself, in the browser: no backend.
4
+
5
+ - **Make**: by an AI through the browser (`window.demoEngine`), by recording what you do (and say),
6
+ or by hand in the studio, on a `@protomaze/time` timeline.
7
+ - **Narrate**: text to speech in the browser (Kokoro, Piper: free, no key) or ElevenLabs; speech to
8
+ text (Whisper in the browser, or ElevenLabs) turns what you said into narration and subtitles.
9
+ A **narration pack** keeps a demo's finished audio, so every viewer hears it without a key, tokens
10
+ or a model download.
11
+ - **Show**: a stand-in pointer, spotlights, rings, arrows, notes, blur, title cards, zoom, keycaps.
12
+ - **Play**: as a video would; **present** step by step with a clicker and a presenter's screen
13
+ (script, notes, what comes next, the clock); **guide** a viewer who does each step themselves
14
+ (tutorials, trainings); **loop** unattended at an expo booth.
15
+ - **Film**: an MP4 or WebM of the tab with narration, music and subtitles, made in the browser, at
16
+ exactly 720p, 1080p, 1440p or 4K, landscape, portrait or square.
17
+ - **Music**: four tracks the engine composes itself (calm, lo-fi, bright, piano) - free to use
18
+ anywhere, nothing downloaded - or a file of one's own; quieter under the narration.
19
+ - **Share**: `.demo.json`, a scenario `.md`, a link with the demo in it, the video, `.vtt` / `.srt`.
20
+
21
+ ```bash
22
+ npm run dev # the sample app, on http://localhost:8095: "Demos" bottom left
23
+ npm test # the model: validation, timing, subtitles
24
+ npm run check # type-check everything, sample included
25
+ ```
26
+
27
+ ## In an app
28
+
29
+ ```ts
30
+ import { DemoEngine, dictionaryLabels } from '@protomaze/demo-engine';
31
+
32
+ const engine = new DemoEngine({
33
+ app: 'orders', // where demos, videos and settings are kept
34
+ demos: [{ demo: tour, scenario: tourMarkdown }], // the app's own, checked in as <id>.demo.json
35
+ languages: ['en', 'de'], // narration is written in these
36
+ language: () => i18n.language, // the page's
37
+ labels: dictionaryLabels(() => LOCALES[i18n.language], key => t(key)), // targets in every language
38
+ start: { // where a demo starts, in the app's terms
39
+ current: () => ({ tenant, mode }),
40
+ go: start => (start.tenant !== tenant ? reloadWith(start) : setMode(start.mode)), // 'reload' if it navigates
41
+ },
42
+ plugins: [mapPlugin(map)], // actions only the app knows
43
+ ready: () => map.whenReady(), // before a demo plays
44
+ filmElement: () => document.getElementById('app'), // videos crop to it, where the browser can
45
+ launcher: true, // a "Demos" button, for apps without a panel
46
+ narration: demo => `/demos/${demo.id}.narration.zip`, // packs checked in beside the demos
47
+ });
48
+ await engine.mount();
49
+ ```
50
+
51
+ Or put the library in the app's own panel: `<DemoLibrary engine={engine} />` (in its own shadow
52
+ root: the app's styles stay out). Everything else - the studio, the bars while playing and
53
+ recording, effects - the engine renders over the app, in the top layer.
54
+
55
+ From code: `engine.play(demo, { from })`, `engine.guide(demo)`, `engine.film(demo)`,
56
+ `engine.record()`, `engine.loop(demos, { idle, reset: 'reload' })`, `engine.check(demo)`,
57
+ `engine.openStudio(demo)`, `engine.link(demo)`. Sound and filming need a click in the app's window:
58
+ started from elsewhere (a dev panel in its own window, a link, code) the engine asks for one.
59
+ React: `useEngine(engine)`, `useDemos(engine)`.
60
+
61
+ ## Demos
62
+
63
+ ```json
64
+ {
65
+ "id": "risk-tour",
66
+ "title": "Risk, explained",
67
+ "start": { "tenant": "Gelsenkirchen" },
68
+ "steps": [
69
+ {
70
+ "say": { "en": "Which pipes matter most?", "de": "Welche Haltungen sind am wichtigsten?" },
71
+ "actions": [
72
+ { "do": "spotlight", "target": { "css": "[data-demo=\"risk matrix\"]" } },
73
+ { "do": "click", "target": { "css": "button", "key": "risk_reset_weights" }, "cue": 0, "wait": 1200 }
74
+ ]
75
+ }
76
+ ]
77
+ }
78
+ ```
79
+
80
+ Each step's narration is spoken a sentence at a time, each a subtitle, while its actions play one
81
+ after the other. A target is `{ css, text?, key?, index? }`: the elements matching `css` whose label -
82
+ `data-demo`, their text, `aria-label`, a field's label - is `text`, or the locale `key`'s text in the
83
+ page's language. Labels compare without case or spacing, every number as `#`. `wait` is ms before an
84
+ action (800), `cue` starts it with a sentence of the step: synced in every language and voice.
85
+
86
+ Actions: `click`, `hover`, `type`, `key`, `select`, `drag`, `scroll`, `waitFor`; and to present,
87
+ `spotlight`, `ring`, `arrow`, `callout`, `blur`, `card`, `zoom`, `clear` (shown till the step ends,
88
+ or `for` ms). [AGENTS.md](AGENTS.md) has every field; it is also what an AI reads.
89
+
90
+ A demo leaves the app as it found it, so it plays again and the next starts where it expects:
91
+ its `cleanup` actions run after it - when it ends or is stopped - quickly and unseen (filters
92
+ cleared, what it opened closed); what the app cannot undo through its UI, `start.go` resets before
93
+ every play and check (a sandbox tenant, demo data reloaded, the page reloaded).
94
+
95
+ `data-demo="name"` on an element names it for demos in every language and gives targets a scope.
96
+ `data-demo-ignore` keeps a part of the page out of recording and targets (a dev panel).
97
+
98
+ ## Plugins
99
+
100
+ What only the app knows: a map's views and points, a canvas chart's bars.
101
+
102
+ ```ts
103
+ const mapPlugin = (map: WebGLMap): DemoPlugin => ({
104
+ name: 'map',
105
+ actions: {
106
+ view: { play: action => showBounds(map, action.bounds), read: () => 'Move the map', duration: () => 1200 },
107
+ mapClick: {
108
+ async play(action, { hand }) {
109
+ const at = toView(map, action.at); // lon, lat → px in the map
110
+ const box = map.domNode.getBoundingClientRect();
111
+ await hand.click(map.domNode, { x: box.left + at.x, y: box.top + at.y }, { shift: action.shift });
112
+ },
113
+ read: () => 'Click on the map',
114
+ },
115
+ },
116
+ record: ({ push }) => {
117
+ const moved = map.on('MapChange', () => /* once at rest */ push({ do: 'view', bounds: viewBounds(map) }));
118
+ return {
119
+ claims: element => map.domNode.contains(element), // the engine records nothing there itself
120
+ click: (element, x, y) => ({ do: 'mapClick', at: toWorld(map, x, y) }),
121
+ stop: () => moved.remove(),
122
+ };
123
+ },
124
+ });
125
+ ```
126
+
127
+ ## Narration packs
128
+
129
+ The studio's share menu (or the library's) makes `<id>.narration.zip`: every sentence of the demo, in
130
+ every language it is written in, with the voice chosen - ElevenLabs' answers as they came (kept in
131
+ the browser, so not paid twice), the free voices' as WAV. Check it in beside `<id>.demo.json` and
132
+ give its URL as `narration`. It plays before any voice: viewers need no key, pay no tokens and
133
+ download no model, at a booth or on a sales laptop. A sentence changed since is said by the voice
134
+ chosen, as ever; make the pack again to keep it too (what the pack has from the same voice is
135
+ reused). A pack made here is kept in this browser as well.
136
+
137
+ ## Playing
138
+
139
+ | | |
140
+ |---|---|
141
+ | Space | pause, resume |
142
+ | → Enter PageDown | waiting: go on; else on to the next step (the rest of this one done quickly) |
143
+ | ← PageUp | this step again; pressed in its first seconds, the step before |
144
+ | 1-9 Home End | to that step, the first, the last; the bar's step list and the studio's timeline too |
145
+ | Esc | stop |
146
+ | Ctrl+Shift+L | stop a loop |
147
+ | Recording: Alt+N, Alt+H, Esc | next step, a hover where the pointer is, stop |
148
+
149
+ While a demo plays, the viewer's own clicks, keys and scrolling do not reach the app - they would
150
+ take the demo off its path - and the bar says why. Paused, the app is theirs. Guided, the ringed
151
+ part is. At a booth, a visitor's touch hands the app over.
152
+
153
+ Going forward, the steps between are caught up under a card naming the step; going back, the app is
154
+ reset - the demo's cleanup, its start - and caught up to the step, under the card. Not while filming.
155
+
156
+ **Presenting**: `engine.present(demo)` waits after each step and opens the presenter's screen in a
157
+ window of its own - beside the projected app, never in a video: the step's script with the sentence
158
+ being said, the step's `notes` (for the presenter only), what comes next, the clock against the
159
+ plan, every step to go to, big controls. `engine.openPresenter({ onTop: true })` keeps a compact one
160
+ always on top (Chrome's Document Picture-in-Picture). `mountPresenter(engine, document)` puts it in
161
+ a window or frame of the app's own. A clicker works in either window.
162
+
163
+ A presenter's clicker sends PageDown and PageUp: "Wait for the presenter after each step" makes
164
+ a pitch. Guided, the viewer does each click, entry and choice; "Do it for me" lets the demo. Looped,
165
+ a visitor's touch hands the app over; after `idle` it plays on, from the app's start (or a reload).
166
+ A booth with sound: start the browser allowing it, e.g. Chrome's
167
+ `--autoplay-policy=no-user-gesture-required --kiosk`.
168
+
169
+ ## In the browser
170
+
171
+ Free voices and Whisper download once from public CDNs (jsDelivr, Hugging Face) and are kept by the
172
+ browser: about 80-330 MB for Kokoro, 60 MB per Piper voice, 40-250 MB for Whisper. An ElevenLabs
173
+ key is kept in the browser's local storage, every sentence paid for once and kept. Demos, videos
174
+ and the music are kept in IndexedDB, per app. Filming uses the tab's own capture (Chrome, Edge:
175
+ MP4; Firefox: WebM).
176
+
177
+ ## From Ing+ `src/demos`
178
+
179
+ The format is the same: `.demo.json` files play as they are, once the map's actions
180
+ (`view`, `mapClick`, `mapHover`) come in as a plugin. `DemoPlayer`, `DemoRecorder`, `DemoTargets`,
181
+ `DemoSpeech`, `DemoVideo`, `DemoStore`, `DemoLink`, `DemoSession`, `DemoOverlay` and `DemoEditor` are
182
+ the engine; `DemosGroup` becomes `<DemoLibrary>`; `start` and its reloads go to `start`; the locale
183
+ keys to `labels`; the highlight manager's readiness to `ready`.
184
+
185
+ ## Publishing
186
+
187
+ Straight to npm, by [`.github/workflows/publish.yml`](.github/workflows/publish.yml) with npm's
188
+ **Trusted Publishing**: no npm token anywhere. A `v*.*.*` tag push runs it: it tests, compiles and
189
+ publishes `build/`, which is the package.
190
+
191
+ ```bash
192
+ npm version patch # or minor / major - bumps package.json and tags it
193
+ git push --follow-tags
194
+ ```
195
+
196
+ One-time setup, by the npm account owner: publish the first version by hand (`npm login
197
+ --auth-type=web`, then `npm run deploy`; `npm-first-publish.cmd` in the protomaze folder does both),
198
+ then in the package's settings on npmjs.com add a Trusted Publisher: GitHub Actions, repository
199
+ `protomaze/demo-engine`, workflow `publish.yml`. npm checks `repository.url` in `package.json`
200
+ against the repository, so it stays `git+https://github.com/protomaze/demo-engine.git`. The
201
+ protomaze folder's `NPM_README.md` has the whole procedure, for every package.
package/agent/Guide.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** How an AI makes a demo with `window.demoEngine`: `demoEngine.help()` returns it; AGENTS.md is made from it. */
2
- export declare const GUIDE = "# Making a demo with demoEngine\n\nYou see the app in a browser and run JavaScript in it. `window.demoEngine` has the tools; every\nresult is plain data. A demo is steps; each step's narration is spoken (and subtitled) a sentence at\na time while its actions play one after the other. Actions point at elements as a person would: by\nwhat they show, not where they are.\n\n## Workflow\n\n1. `demoEngine.languages()` - which languages to write narration in.\n `demoEngine.start()` - where the app is; a demo starts there. `demoEngine.demos()` - what exists.\n2. Explore. `demoEngine.page()` lists what can be acted on, each with a ready `target`, its label,\n state and box; `page({ query: 'save' })` or `page({ within: '[data-demo=\"filters\"]' })` narrows it.\n Look with screenshots too. `demoEngine.try({ do: 'click', target })` does one action now and says\n what appeared and went: walk the app this way to learn the path the demo will take.\n3. Plan the story before the actions: what should the viewer understand at the end? One idea per step.\n4. Write the demo (format below). Narration first, then the actions that show it.\n5. `demoEngine.validate(demo)` - its shape. Then `await demoEngine.check(demo)` - from the demo's\n start, fast and silent, going past what fails, its cleanup after; fix every failure and check\n again until `ok` twice in a row (the second run proves the cleanup).\n6. `await demoEngine.save(demo)`, then `demoEngine.open(demo.id)` - the person sees it in the\n studio, can play, tune, film and share it. `demoEngine.play(id)` plays it with sound once the\n person clicks. `demoEngine.estimate(demo)` gives its length.\n\n## Length\n\n- Short (a teaser, one feature): 4-7 steps, 30-60 s, one or two sentences a step.\n- Normal (a tour): 8-12 steps, 1-3 min.\n- Detailed (a deep dive): 12-25 steps, 3-6 min; still one idea per step.\n\n## What it is for\n\n- Marketing video: short, benefit first, a `card` to open and close, zooms on what impresses; no\n setup steps on screen. The person films it (film button); music can play under it.\n- Sales pitch: one step per point the presenter makes; `pause: true` on steps where they talk\n freely. They advance with a clicker (PageDown) and repeat with PageUp.\n- Expo booth: 30-90 s, readable without sound (subtitles carry it), ends where it started so it can\n loop. `demoEngine.loop([ids])` plays them unattended; a visitor's touch hands the app over.\n- Tutorial or training: `demoEngine.guide(id)` lets the viewer do each click and entry themselves,\n ringed with what to do. Narrate why, not only what; small steps; one new thing each.\n\n## Narration\n\n- For the viewer, about what matters to them: \"Which pipes need work first?\" before \"Click Risk\".\n- Present tense, plain words, at most ~20 words a sentence; a step ~1-3 sentences.\n- Say what to look at as it happens; name things as the app names them.\n- Every language of `languages().write`: `say: { en: '\u2026', de: '\u2026' }`. Same meaning, natural in each.\n- No \"In this demo\u2026\" filler; open with the question or the benefit, close with what was shown.\n\n## Format\n\n```json\n{\n \"id\": \"orders-tour\",\n \"title\": \"Orders, from list to invoice\",\n \"description\": \"One sentence: who it is for and what it shows.\",\n \"start\": { \"\u2026\": \"as demoEngine.start() gives it, or leave out\" },\n \"steps\": [\n {\n \"title\": \"Find an order\",\n \"say\": { \"en\": \"Every order lands here, newest first. Let's find one from Berlin.\" },\n \"actions\": [\n { \"do\": \"spotlight\", \"target\": { \"css\": \"table\", \"text\": \"orders\" }, \"for\": 2500 },\n { \"do\": \"type\", \"target\": { \"css\": \"input[type=\\\"search\\\"]\" }, \"text\": \"Berlin\", \"cue\": 1 },\n { \"do\": \"click\", \"target\": { \"css\": \"tr\", \"text\": \"berlin #\" }, \"wait\": 1200 }\n ]\n }\n ]\n}\n```\n\nA target: `{ css, text?, key?, index? }` - the `index`th (0-based) element matching `css` whose label\nis `text` (or the app's locale `key`'s text: works in every language). Labels compare without case,\nspacing, and with every number as \"#\": a row \"Berlin 42\" is \"berlin #\". Use the targets `page()` and\n`describe()` give: they prefer locale keys and named regions. Avoid `index` where a scope does it:\n`{ css: '[data-demo=\"filters\"] button', text: 'apply' }`.\n\nEvery action has `wait` (ms before it, default 800) and `cue` (start with the step's sentence of that\nindex, 0-based: syncs a click with the words about it, in every language and voice).\n\nInteractions:\n- `click` { target, at?: [x, y] fractions of the box, double?, right?, shift?, ctrl?, alt?, meta? }\n- `hover` { target, at? } - shows tooltips and hover cards (not CSS :hover looks)\n- `type` { target, text } - replaces the field's text, a letter at a time\n- `key` { key, target? } - 'Escape', 'Enter', 'ArrowDown', 'Control+K'; shown as keycaps\n- `select` { target, option } - a native <select>'s option by text or value\n- `drag` { target, at?, to: { target?, at? } } - sliders, drag and drop, panning\n- `scroll` { target?, by?: [x, y] } - into view, or by pixels\n- `waitFor` { target, gone?, timeout? } - until it shows (or goes): after what loads\n\nPresentation (shown until the step ends, or `for` ms; `clear` takes all down):\n- `spotlight` { target, text?, padding? } - dims everything else: the one thing to look at\n- `ring` { target, text?, color?, shape?: 'box' | 'circle' } - a pulsing outline\n- `arrow` { target, text?, from?: 'top' | 'right' | 'bottom' | 'left' } - points at it\n- `callout` { text, target?, side?, corner? } - a note by the target, or in a corner\n- `blur` { target } - hides names, addresses, anything private\n- `card` { title, text? } - full screen: an opening title, a chapter, the end\n- `zoom` { target, scale? } - magnifies the page around it (1.8 by default)\n- `clear`\n\nThe app may add its own actions (a map's `view`, `mapClick`): `validate` lists every kind it knows\nwhen one is wrong; read the app's demos (`demoEngine.get(id)`) for examples.\n\nStep options: `title` (for the editor), `hold` (ms after), `pause: true` (waits for the presenter).\n\n`cleanup`: actions done after the demo - when it ends or is stopped - quickly and unseen, so the app\nis as it found it and the demo plays again: clear filters and searches, close what was opened, go\nback to the first tab. What the app cannot undo through its UI, its start resets.\n\n## Good demos\n\n- Open with a `card` (title, one line of promise), close with one (what was shown, what next).\n- Direct the eye: a spotlight or ring on what the sentence is about, an arrow for small things.\n- Let the viewer see results: a `wait` of 1500-3000 ms after what changes a lot; `waitFor` what loads.\n- Keep the pointer purposeful: no clicks that do not move the story.\n- Blur personal data.\n- Leave the app as it started: a `cleanup` list undoes what the steps changed, so demos run one\n after another and again. Check that too: `check` runs the cleanup, then `check` again.\n\n## Tools\n\nhelp() \u00B7 languages() \u00B7 start() \u00B7 page({ within?, query?, limit? }) \u00B7 find(target) \u00B7\ndescribe(css | [x, y]) \u00B7 try(action) \u00B7 preview(presentationAction, ms?) \u00B7 demos() \u00B7 get(id) \u00B7\nvalidate(demo) \u00B7 estimate(demoOrId) \u00B7 check(demoOrId, { from?, to? }) \u00B7 save(demo) \u00B7 remove(id) \u00B7\nopen(demoOrId) \u00B7 play(demoOrId, { from? }) \u00B7 guide(demoOrId, { from? }) \u00B7 loop([demoOrId]) \u00B7\nstopLoop() \u00B7 stop() \u00B7 state() \u00B7 link(demoOrId)\n";
2
+ export declare const GUIDE = "# Making a demo with demoEngine\n\nYou see the app in a browser and run JavaScript in it. `window.demoEngine` has the tools; every\nresult is plain data. A demo is steps; each step's narration is spoken (and subtitled) a sentence at\na time while its actions play one after the other. Actions point at elements as a person would: by\nwhat they show, not where they are.\n\n## Workflow\n\n1. `demoEngine.languages()` - which languages to write narration in.\n `demoEngine.start()` - where the app is; a demo starts there. `demoEngine.demos()` - what exists.\n2. Explore. `demoEngine.page()` lists what can be acted on, each with a ready `target`, its label,\n state and box; `page({ query: 'save' })` or `page({ within: '[data-demo=\"filters\"]' })` narrows it.\n Look with screenshots too. `demoEngine.try({ do: 'click', target })` does one action now and says\n what appeared and went: walk the app this way to learn the path the demo will take.\n3. Plan the story before the actions: what should the viewer understand at the end? One idea per step.\n4. Write the demo (format below). Narration first, then the actions that show it.\n5. `demoEngine.validate(demo)` - its shape. Then `await demoEngine.check(demo)` - from the demo's\n start, fast and silent, going past what fails, its cleanup after; fix every failure and check\n again until `ok` twice in a row (the second run proves the cleanup).\n6. `await demoEngine.save(demo)`, then `demoEngine.open(demo.id)` - the person sees it in the\n studio, can play, tune, film and share it. `demoEngine.play(id)` plays it with sound once the\n person clicks. `demoEngine.estimate(demo)` gives its length.\n\n## Length\n\n- Short (a teaser, one feature): 4-7 steps, 30-60 s, one or two sentences a step.\n- Normal (a tour): 8-12 steps, 1-3 min.\n- Detailed (a deep dive): 12-25 steps, 3-6 min; still one idea per step.\n\n## What it is for\n\n- Marketing video: short, benefit first, a `card` to open and close, zooms on what impresses; no\n setup steps on screen. The person films it (film button); music can play under it.\n- Sales pitch: one step per point the presenter makes; `pause: true` on steps where they talk\n freely. They advance with a clicker (PageDown) and repeat with PageUp.\n- Expo booth: 30-90 s, readable without sound (subtitles carry it), ends where it started so it can\n loop. `demoEngine.loop([ids])` plays them unattended; a visitor's touch hands the app over.\n- Tutorial or training: `demoEngine.guide(id)` lets the viewer do each click and entry themselves,\n ringed with what to do. Narrate why, not only what; small steps; one new thing each.\n\n## Narration\n\n- For the viewer, about what matters to them: \"Which pipes need work first?\" before \"Click Risk\".\n- Present tense, plain words, at most ~20 words a sentence; a step ~1-3 sentences.\n- Say what to look at as it happens; name things as the app names them.\n- Every language of `languages().write`: `say: { en: '\u2026', de: '\u2026' }`. Same meaning, natural in each.\n- No \"In this demo\u2026\" filler; open with the question or the benefit, close with what was shown.\n\n## Format\n\n```json\n{\n \"id\": \"orders-tour\",\n \"title\": \"Orders, from list to invoice\",\n \"description\": \"One sentence: who it is for and what it shows.\",\n \"start\": { \"\u2026\": \"as demoEngine.start() gives it, or leave out\" },\n \"steps\": [\n {\n \"title\": \"Find an order\",\n \"say\": { \"en\": \"Every order lands here, newest first. Let's find one from Berlin.\" },\n \"actions\": [\n { \"do\": \"spotlight\", \"target\": { \"css\": \"table\", \"text\": \"orders\" }, \"for\": 2500 },\n { \"do\": \"type\", \"target\": { \"css\": \"input[type=\\\"search\\\"]\" }, \"text\": \"Berlin\", \"cue\": 1 },\n { \"do\": \"click\", \"target\": { \"css\": \"tr\", \"text\": \"berlin #\" }, \"wait\": 1200 }\n ]\n }\n ]\n}\n```\n\nA target: `{ css, text?, key?, index? }` - the `index`th (0-based) element matching `css` whose label\nis `text` (or the app's locale `key`'s text: works in every language). Labels compare without case,\nspacing, and with every number as \"#\": a row \"Berlin 42\" is \"berlin #\". Use the targets `page()` and\n`describe()` give: they prefer locale keys and named regions. Avoid `index` where a scope does it:\n`{ css: '[data-demo=\"filters\"] button', text: 'apply' }`.\n\nEvery action has `wait` (ms before it, default 800) and `cue` (start with the step's sentence of that\nindex, 0-based: syncs a click with the words about it, in every language and voice).\n\nInteractions:\n- `click` { target, at?: [x, y] fractions of the box, double?, right?, shift?, ctrl?, alt?, meta? }\n- `hover` { target, at? } - shows tooltips and hover cards (not CSS :hover looks)\n- `type` { target, text } - replaces the field's text, a letter at a time\n- `key` { key, target? } - 'Escape', 'Enter', 'ArrowDown', 'Control+K'; shown as keycaps\n- `select` { target, option } - a native <select>'s option by text or value\n- `drag` { target, at?, to: { target?, at? } } - sliders, drag and drop, panning\n- `scroll` { target?, by?: [x, y] } - into view, or by pixels\n- `waitFor` { target, gone?, timeout? } - until it shows (or goes): after what loads\n\nPresentation (shown until the step ends, or `for` ms; `clear` takes all down):\n- `spotlight` { target, text?, padding? } - dims everything else: the one thing to look at\n- `ring` { target, text?, color?, shape?: 'box' | 'circle' } - a pulsing outline\n- `arrow` { target, text?, from?: 'top' | 'right' | 'bottom' | 'left' } - points at it\n- `callout` { text, target?, side?, corner? } - a note by the target, or in a corner\n- `blur` { target } - hides names, addresses, anything private\n- `card` { title, text? } - full screen: an opening title, a chapter, the end\n- `zoom` { target, scale? } - magnifies the page around it (1.8 by default)\n- `clear`\n\nThe app may add its own actions (a map's `view`, `mapClick`): `validate` lists every kind it knows\nwhen one is wrong; read the app's demos (`demoEngine.get(id)`) for examples.\n\nStep options: `title` (for the editor), `hold` (ms after), `pause: true` (waits for the presenter),\n`notes` (on the presenter's screen only: what to add live, figures to mention, questions to expect).\n\n`cleanup`: actions done after the demo - when it ends or is stopped - quickly and unseen, so the app\nis as it found it and the demo plays again: clear filters and searches, close what was opened, go\nback to the first tab. What the app cannot undo through its UI, its start resets.\n\n## Good demos\n\n- Open with a `card` (title, one line of promise), close with one (what was shown, what next).\n- Direct the eye: a spotlight or ring on what the sentence is about, an arrow for small things.\n- Let the viewer see results: a `wait` of 1500-3000 ms after what changes a lot; `waitFor` what loads.\n- Keep the pointer purposeful: no clicks that do not move the story.\n- Blur personal data.\n- Leave the app as it started: a `cleanup` list undoes what the steps changed, so demos run one\n after another and again. Check that too: `check` runs the cleanup, then `check` again.\n\n## Tools\n\nhelp() \u00B7 languages() \u00B7 start() \u00B7 page({ within?, query?, limit? }) \u00B7 find(target) \u00B7\ndescribe(css | [x, y]) \u00B7 try(action) \u00B7 preview(presentationAction, ms?) \u00B7 demos() \u00B7 get(id) \u00B7\nvalidate(demo) \u00B7 estimate(demoOrId) \u00B7 check(demoOrId, { from?, to? }) \u00B7 save(demo) \u00B7 remove(id) \u00B7\nopen(demoOrId) \u00B7 play(demoOrId, { from? }) \u00B7 guide(demoOrId, { from? }) \u00B7 loop([demoOrId]) \u00B7\nstopLoop() \u00B7 stop() \u00B7 state() \u00B7 link(demoOrId)\n";
package/agent/Guide.js CHANGED
@@ -1 +1 @@
1
- export const GUIDE='# Making a demo with demoEngine\n\nYou see the app in a browser and run JavaScript in it. `window.demoEngine` has the tools; every\nresult is plain data. A demo is steps; each step\'s narration is spoken (and subtitled) a sentence at\na time while its actions play one after the other. Actions point at elements as a person would: by\nwhat they show, not where they are.\n\n## Workflow\n\n1. `demoEngine.languages()` - which languages to write narration in.\n `demoEngine.start()` - where the app is; a demo starts there. `demoEngine.demos()` - what exists.\n2. Explore. `demoEngine.page()` lists what can be acted on, each with a ready `target`, its label,\n state and box; `page({ query: \'save\' })` or `page({ within: \'[data-demo="filters"]\' })` narrows it.\n Look with screenshots too. `demoEngine.try({ do: \'click\', target })` does one action now and says\n what appeared and went: walk the app this way to learn the path the demo will take.\n3. Plan the story before the actions: what should the viewer understand at the end? One idea per step.\n4. Write the demo (format below). Narration first, then the actions that show it.\n5. `demoEngine.validate(demo)` - its shape. Then `await demoEngine.check(demo)` - from the demo\'s\n start, fast and silent, going past what fails, its cleanup after; fix every failure and check\n again until `ok` twice in a row (the second run proves the cleanup).\n6. `await demoEngine.save(demo)`, then `demoEngine.open(demo.id)` - the person sees it in the\n studio, can play, tune, film and share it. `demoEngine.play(id)` plays it with sound once the\n person clicks. `demoEngine.estimate(demo)` gives its length.\n\n## Length\n\n- Short (a teaser, one feature): 4-7 steps, 30-60 s, one or two sentences a step.\n- Normal (a tour): 8-12 steps, 1-3 min.\n- Detailed (a deep dive): 12-25 steps, 3-6 min; still one idea per step.\n\n## What it is for\n\n- Marketing video: short, benefit first, a `card` to open and close, zooms on what impresses; no\n setup steps on screen. The person films it (film button); music can play under it.\n- Sales pitch: one step per point the presenter makes; `pause: true` on steps where they talk\n freely. They advance with a clicker (PageDown) and repeat with PageUp.\n- Expo booth: 30-90 s, readable without sound (subtitles carry it), ends where it started so it can\n loop. `demoEngine.loop([ids])` plays them unattended; a visitor\'s touch hands the app over.\n- Tutorial or training: `demoEngine.guide(id)` lets the viewer do each click and entry themselves,\n ringed with what to do. Narrate why, not only what; small steps; one new thing each.\n\n## Narration\n\n- For the viewer, about what matters to them: "Which pipes need work first?" before "Click Risk".\n- Present tense, plain words, at most ~20 words a sentence; a step ~1-3 sentences.\n- Say what to look at as it happens; name things as the app names them.\n- Every language of `languages().write`: `say: { en: \'…\', de: \'…\' }`. Same meaning, natural in each.\n- No "In this demo…" filler; open with the question or the benefit, close with what was shown.\n\n## Format\n\n```json\n{\n "id": "orders-tour",\n "title": "Orders, from list to invoice",\n "description": "One sentence: who it is for and what it shows.",\n "start": { "…": "as demoEngine.start() gives it, or leave out" },\n "steps": [\n {\n "title": "Find an order",\n "say": { "en": "Every order lands here, newest first. Let\'s find one from Berlin." },\n "actions": [\n { "do": "spotlight", "target": { "css": "table", "text": "orders" }, "for": 2500 },\n { "do": "type", "target": { "css": "input[type=\\"search\\"]" }, "text": "Berlin", "cue": 1 },\n { "do": "click", "target": { "css": "tr", "text": "berlin #" }, "wait": 1200 }\n ]\n }\n ]\n}\n```\n\nA target: `{ css, text?, key?, index? }` - the `index`th (0-based) element matching `css` whose label\nis `text` (or the app\'s locale `key`\'s text: works in every language). Labels compare without case,\nspacing, and with every number as "#": a row "Berlin 42" is "berlin #". Use the targets `page()` and\n`describe()` give: they prefer locale keys and named regions. Avoid `index` where a scope does it:\n`{ css: \'[data-demo="filters"] button\', text: \'apply\' }`.\n\nEvery action has `wait` (ms before it, default 800) and `cue` (start with the step\'s sentence of that\nindex, 0-based: syncs a click with the words about it, in every language and voice).\n\nInteractions:\n- `click` { target, at?: [x, y] fractions of the box, double?, right?, shift?, ctrl?, alt?, meta? }\n- `hover` { target, at? } - shows tooltips and hover cards (not CSS :hover looks)\n- `type` { target, text } - replaces the field\'s text, a letter at a time\n- `key` { key, target? } - \'Escape\', \'Enter\', \'ArrowDown\', \'Control+K\'; shown as keycaps\n- `select` { target, option } - a native <select>\'s option by text or value\n- `drag` { target, at?, to: { target?, at? } } - sliders, drag and drop, panning\n- `scroll` { target?, by?: [x, y] } - into view, or by pixels\n- `waitFor` { target, gone?, timeout? } - until it shows (or goes): after what loads\n\nPresentation (shown until the step ends, or `for` ms; `clear` takes all down):\n- `spotlight` { target, text?, padding? } - dims everything else: the one thing to look at\n- `ring` { target, text?, color?, shape?: \'box\' | \'circle\' } - a pulsing outline\n- `arrow` { target, text?, from?: \'top\' | \'right\' | \'bottom\' | \'left\' } - points at it\n- `callout` { text, target?, side?, corner? } - a note by the target, or in a corner\n- `blur` { target } - hides names, addresses, anything private\n- `card` { title, text? } - full screen: an opening title, a chapter, the end\n- `zoom` { target, scale? } - magnifies the page around it (1.8 by default)\n- `clear`\n\nThe app may add its own actions (a map\'s `view`, `mapClick`): `validate` lists every kind it knows\nwhen one is wrong; read the app\'s demos (`demoEngine.get(id)`) for examples.\n\nStep options: `title` (for the editor), `hold` (ms after), `pause: true` (waits for the presenter).\n\n`cleanup`: actions done after the demo - when it ends or is stopped - quickly and unseen, so the app\nis as it found it and the demo plays again: clear filters and searches, close what was opened, go\nback to the first tab. What the app cannot undo through its UI, its start resets.\n\n## Good demos\n\n- Open with a `card` (title, one line of promise), close with one (what was shown, what next).\n- Direct the eye: a spotlight or ring on what the sentence is about, an arrow for small things.\n- Let the viewer see results: a `wait` of 1500-3000 ms after what changes a lot; `waitFor` what loads.\n- Keep the pointer purposeful: no clicks that do not move the story.\n- Blur personal data.\n- Leave the app as it started: a `cleanup` list undoes what the steps changed, so demos run one\n after another and again. Check that too: `check` runs the cleanup, then `check` again.\n\n## Tools\n\nhelp() · languages() · start() · page({ within?, query?, limit? }) · find(target) ·\ndescribe(css | [x, y]) · try(action) · preview(presentationAction, ms?) · demos() · get(id) ·\nvalidate(demo) · estimate(demoOrId) · check(demoOrId, { from?, to? }) · save(demo) · remove(id) ·\nopen(demoOrId) · play(demoOrId, { from? }) · guide(demoOrId, { from? }) · loop([demoOrId]) ·\nstopLoop() · stop() · state() · link(demoOrId)\n';
1
+ export const GUIDE='# Making a demo with demoEngine\n\nYou see the app in a browser and run JavaScript in it. `window.demoEngine` has the tools; every\nresult is plain data. A demo is steps; each step\'s narration is spoken (and subtitled) a sentence at\na time while its actions play one after the other. Actions point at elements as a person would: by\nwhat they show, not where they are.\n\n## Workflow\n\n1. `demoEngine.languages()` - which languages to write narration in.\n `demoEngine.start()` - where the app is; a demo starts there. `demoEngine.demos()` - what exists.\n2. Explore. `demoEngine.page()` lists what can be acted on, each with a ready `target`, its label,\n state and box; `page({ query: \'save\' })` or `page({ within: \'[data-demo="filters"]\' })` narrows it.\n Look with screenshots too. `demoEngine.try({ do: \'click\', target })` does one action now and says\n what appeared and went: walk the app this way to learn the path the demo will take.\n3. Plan the story before the actions: what should the viewer understand at the end? One idea per step.\n4. Write the demo (format below). Narration first, then the actions that show it.\n5. `demoEngine.validate(demo)` - its shape. Then `await demoEngine.check(demo)` - from the demo\'s\n start, fast and silent, going past what fails, its cleanup after; fix every failure and check\n again until `ok` twice in a row (the second run proves the cleanup).\n6. `await demoEngine.save(demo)`, then `demoEngine.open(demo.id)` - the person sees it in the\n studio, can play, tune, film and share it. `demoEngine.play(id)` plays it with sound once the\n person clicks. `demoEngine.estimate(demo)` gives its length.\n\n## Length\n\n- Short (a teaser, one feature): 4-7 steps, 30-60 s, one or two sentences a step.\n- Normal (a tour): 8-12 steps, 1-3 min.\n- Detailed (a deep dive): 12-25 steps, 3-6 min; still one idea per step.\n\n## What it is for\n\n- Marketing video: short, benefit first, a `card` to open and close, zooms on what impresses; no\n setup steps on screen. The person films it (film button); music can play under it.\n- Sales pitch: one step per point the presenter makes; `pause: true` on steps where they talk\n freely. They advance with a clicker (PageDown) and repeat with PageUp.\n- Expo booth: 30-90 s, readable without sound (subtitles carry it), ends where it started so it can\n loop. `demoEngine.loop([ids])` plays them unattended; a visitor\'s touch hands the app over.\n- Tutorial or training: `demoEngine.guide(id)` lets the viewer do each click and entry themselves,\n ringed with what to do. Narrate why, not only what; small steps; one new thing each.\n\n## Narration\n\n- For the viewer, about what matters to them: "Which pipes need work first?" before "Click Risk".\n- Present tense, plain words, at most ~20 words a sentence; a step ~1-3 sentences.\n- Say what to look at as it happens; name things as the app names them.\n- Every language of `languages().write`: `say: { en: \'…\', de: \'…\' }`. Same meaning, natural in each.\n- No "In this demo…" filler; open with the question or the benefit, close with what was shown.\n\n## Format\n\n```json\n{\n "id": "orders-tour",\n "title": "Orders, from list to invoice",\n "description": "One sentence: who it is for and what it shows.",\n "start": { "…": "as demoEngine.start() gives it, or leave out" },\n "steps": [\n {\n "title": "Find an order",\n "say": { "en": "Every order lands here, newest first. Let\'s find one from Berlin." },\n "actions": [\n { "do": "spotlight", "target": { "css": "table", "text": "orders" }, "for": 2500 },\n { "do": "type", "target": { "css": "input[type=\\"search\\"]" }, "text": "Berlin", "cue": 1 },\n { "do": "click", "target": { "css": "tr", "text": "berlin #" }, "wait": 1200 }\n ]\n }\n ]\n}\n```\n\nA target: `{ css, text?, key?, index? }` - the `index`th (0-based) element matching `css` whose label\nis `text` (or the app\'s locale `key`\'s text: works in every language). Labels compare without case,\nspacing, and with every number as "#": a row "Berlin 42" is "berlin #". Use the targets `page()` and\n`describe()` give: they prefer locale keys and named regions. Avoid `index` where a scope does it:\n`{ css: \'[data-demo="filters"] button\', text: \'apply\' }`.\n\nEvery action has `wait` (ms before it, default 800) and `cue` (start with the step\'s sentence of that\nindex, 0-based: syncs a click with the words about it, in every language and voice).\n\nInteractions:\n- `click` { target, at?: [x, y] fractions of the box, double?, right?, shift?, ctrl?, alt?, meta? }\n- `hover` { target, at? } - shows tooltips and hover cards (not CSS :hover looks)\n- `type` { target, text } - replaces the field\'s text, a letter at a time\n- `key` { key, target? } - \'Escape\', \'Enter\', \'ArrowDown\', \'Control+K\'; shown as keycaps\n- `select` { target, option } - a native <select>\'s option by text or value\n- `drag` { target, at?, to: { target?, at? } } - sliders, drag and drop, panning\n- `scroll` { target?, by?: [x, y] } - into view, or by pixels\n- `waitFor` { target, gone?, timeout? } - until it shows (or goes): after what loads\n\nPresentation (shown until the step ends, or `for` ms; `clear` takes all down):\n- `spotlight` { target, text?, padding? } - dims everything else: the one thing to look at\n- `ring` { target, text?, color?, shape?: \'box\' | \'circle\' } - a pulsing outline\n- `arrow` { target, text?, from?: \'top\' | \'right\' | \'bottom\' | \'left\' } - points at it\n- `callout` { text, target?, side?, corner? } - a note by the target, or in a corner\n- `blur` { target } - hides names, addresses, anything private\n- `card` { title, text? } - full screen: an opening title, a chapter, the end\n- `zoom` { target, scale? } - magnifies the page around it (1.8 by default)\n- `clear`\n\nThe app may add its own actions (a map\'s `view`, `mapClick`): `validate` lists every kind it knows\nwhen one is wrong; read the app\'s demos (`demoEngine.get(id)`) for examples.\n\nStep options: `title` (for the editor), `hold` (ms after), `pause: true` (waits for the presenter),\n`notes` (on the presenter\'s screen only: what to add live, figures to mention, questions to expect).\n\n`cleanup`: actions done after the demo - when it ends or is stopped - quickly and unseen, so the app\nis as it found it and the demo plays again: clear filters and searches, close what was opened, go\nback to the first tab. What the app cannot undo through its UI, its start resets.\n\n## Good demos\n\n- Open with a `card` (title, one line of promise), close with one (what was shown, what next).\n- Direct the eye: a spotlight or ring on what the sentence is about, an arrow for small things.\n- Let the viewer see results: a `wait` of 1500-3000 ms after what changes a lot; `waitFor` what loads.\n- Keep the pointer purposeful: no clicks that do not move the story.\n- Blur personal data.\n- Leave the app as it started: a `cleanup` list undoes what the steps changed, so demos run one\n after another and again. Check that too: `check` runs the cleanup, then `check` again.\n\n## Tools\n\nhelp() · languages() · start() · page({ within?, query?, limit? }) · find(target) ·\ndescribe(css | [x, y]) · try(action) · preview(presentationAction, ms?) · demos() · get(id) ·\nvalidate(demo) · estimate(demoOrId) · check(demoOrId, { from?, to? }) · save(demo) · remove(id) ·\nopen(demoOrId) · play(demoOrId, { from? }) · guide(demoOrId, { from? }) · loop([demoOrId]) ·\nstopLoop() · stop() · state() · link(demoOrId)\n';
@@ -7,6 +7,7 @@ import { Overlay, OverlayOptions } from '../page/Overlay';
7
7
  import { Labels, Targets, TargetsOptions } from '../page/Targets';
8
8
  import { Speech, SpeechState } from '../speech/Speech';
9
9
  import { DemoVideo, KeptDemo, Store } from '../store/Store';
10
+ import { NarrationPack } from '../speech/Pack';
10
11
  import { PlayOptions, Player, PlayResult, PlayState } from './Player';
11
12
  import type { DemoPlugin } from './Plugin';
12
13
  import { RecordState } from './Recorder';
@@ -49,6 +50,12 @@ export type DemoEngineOptions = {
49
50
  agent?: string | false;
50
51
  /** A "Demos" button on the page opening the library: for apps without a panel of their own. */
51
52
  launcher?: boolean;
53
+ /**
54
+ * Where a demo's narration pack is (`<id>.narration.zip`, made in the studio and checked in
55
+ * beside its `.demo.json`): its audio plays before any voice, for every viewer - no key, no
56
+ * tokens, no model to download. None where it has none.
57
+ */
58
+ narration?: (demo: Demo) => string | undefined;
52
59
  };
53
60
  /** What the engine is doing: one thing at a time. */
54
61
  export type Session = {
@@ -167,6 +174,7 @@ export declare class DemoEngine {
167
174
  private player;
168
175
  private looping;
169
176
  private musicLoaded;
177
+ private packs;
170
178
  constructor(options: DemoEngineOptions);
171
179
  getState: () => EngineState;
172
180
  subscribe: (listener: () => void) => (() => void);
@@ -237,8 +245,21 @@ export declare class DemoEngine {
237
245
  resume(): void;
238
246
  /** The presenter's next: on from a wait, or on to the next step. */
239
247
  next(): void;
240
- /** The presenter's back: waiting after a step, its narration again. */
241
- again(): void;
248
+ /** The presenter's back: this step again, or - in its first seconds - the one before. */
249
+ back(): void;
250
+ /**
251
+ * The presenter's screen, in a window of its own - or `onTop`, always on top where the browser
252
+ * can: the script, notes, what comes next, the clock, the controls. From a click.
253
+ */
254
+ openPresenter(options?: {
255
+ onTop?: boolean;
256
+ }): Promise<boolean>;
257
+ /** Keys pressed in another window of the engine's (the presenter's): a clicker's go to whichever is in front. */
258
+ presenterKey(event: KeyboardEvent): void;
259
+ /** Presents it: waiting after each step, the presenter's screen open beside it. From a click. */
260
+ present(demo: Demo, options?: Partial<PlayOptions>): Promise<PlayResult | undefined>;
261
+ /** To a step of what plays (0-based): forward or back. False where it cannot (filmed). */
262
+ goTo(step: number): boolean;
242
263
  /**
243
264
  * Guided, for tutorials and trainings: the viewer does every click, entry and choice themselves,
244
265
  * each ringed with what to do; the narration explains. "Do it for me" (`doItForMe`) lets the demo.
@@ -246,6 +267,18 @@ export declare class DemoEngine {
246
267
  guide(demo: Demo, options?: Partial<PlayOptions>): Promise<PlayResult | undefined>;
247
268
  /** Guided: the demo does what the viewer was to do. */
248
269
  doItForMe(): void;
270
+ /** The demo's narration pack: made here (kept in this browser), else the app's (`narration`); none without. */
271
+ pack(demo: Demo): Promise<NarrationPack | undefined>;
272
+ /**
273
+ * The demo's narration, every sentence in every language it is written in, made once with the
274
+ * voice chosen - what a pack has already from that voice kept, ElevenLabs' kept answers not paid
275
+ * again - as `<id>.narration.zip`. Kept in this browser too; check it in beside the demo.
276
+ */
277
+ makePack(demo: Demo, progress?: (done: number, total: number) => void): Promise<Blob>;
278
+ /** Makes the pack, and downloads it: `<id>.narration.zip`. */
279
+ downloadPack(demo: Demo): Promise<void>;
280
+ /** The pack made here goes: the app's own (`narration`), or the voice, plays again. */
281
+ dropPack(demo: Demo): Promise<void>;
249
282
  /** The music under demos: an audio file of one's own, kept here; none to go back to a composed track. */
250
283
  setMusic(file: File | Blob | undefined): Promise<void>;
251
284
  /** The chosen music, made or decoded once; false if there is none. */