@canvakit/showreel 0.0.0-stage → 0.2.0

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.
@@ -0,0 +1,998 @@
1
+ import { z } from 'zod';
2
+ import { DesignSourceContext } from '@canvakit/designkit';
3
+ export { DesignArtifact, DesignLister, DesignResolver, DesignSource, DesignSourceContext, DesignSourceEntry, DesignSourceRegistry, createDefaultRegistry, defaultRegistry } from '@canvakit/designkit';
4
+ import { FilesystemLike } from '@canvakit/core';
5
+
6
+ /**
7
+ * @canvakit/showreel — the frozen contract.
8
+ *
9
+ * This module owns two things that everything downstream depends on:
10
+ *
11
+ * 1. `ShowreelConfig` — the *declared input*, parsed from
12
+ * `showreel.config.json`. A single ordered `timeline` of
13
+ * heterogeneous `scene | capture` items; narration is anchored to an
14
+ * item by its `id` (never by a magic offset).
15
+ *
16
+ * 2. `MeasuredTimeline` — the *measured output* of the capture stage:
17
+ * `{ id, kind, startMs, endMs }[]`. This is THE contract between
18
+ * capture and assembly. Durations are real (a capture lasts as long
19
+ * as its `waitFor` resolved; a scene lasts its declared `duration`),
20
+ * never assumed. Narration `adelay` and clip placement derive from
21
+ * this — so A/V sync is deterministic and CI-diffable.
22
+ *
23
+ * The pipeline (browser/scenes/audio/assemble) is stubbed elsewhere; this
24
+ * schema is intentionally solid because it's the piece we freeze today.
25
+ */
26
+
27
+ declare const ViewportSchema: z.ZodObject<{
28
+ width: z.ZodDefault<z.ZodNumber>;
29
+ height: z.ZodDefault<z.ZodNumber>;
30
+ dpr: z.ZodDefault<z.ZodNumber>;
31
+ }, z.core.$strip>;
32
+ type Viewport = z.infer<typeof ViewportSchema>;
33
+ declare const TargetSchema: z.ZodObject<{
34
+ url: z.ZodString;
35
+ viewport: z.ZodDefault<z.ZodObject<{
36
+ width: z.ZodDefault<z.ZodNumber>;
37
+ height: z.ZodDefault<z.ZodNumber>;
38
+ dpr: z.ZodDefault<z.ZodNumber>;
39
+ }, z.core.$strip>>;
40
+ chromePath: z.ZodDefault<z.ZodString>;
41
+ readyFlag: z.ZodDefault<z.ZodString>;
42
+ }, z.core.$strip>;
43
+ type Target = z.infer<typeof TargetSchema>;
44
+ declare const BrandFontSchema: z.ZodObject<{
45
+ family: z.ZodString;
46
+ weights: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
47
+ href: z.ZodOptional<z.ZodString>;
48
+ }, z.core.$strip>;
49
+ type BrandFont = z.infer<typeof BrandFontSchema>;
50
+ declare const BrandSchema: z.ZodObject<{
51
+ preset: z.ZodOptional<z.ZodString>;
52
+ tokens: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
53
+ fonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
54
+ family: z.ZodString;
55
+ weights: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
56
+ href: z.ZodOptional<z.ZodString>;
57
+ }, z.core.$strip>>>;
58
+ }, z.core.$strip>;
59
+ type Brand = z.infer<typeof BrandSchema>;
60
+ declare const NavigateStepSchema: z.ZodObject<{
61
+ action: z.ZodLiteral<"navigate">;
62
+ path: z.ZodString;
63
+ }, z.core.$strip>;
64
+ declare const TypeStepSchema: z.ZodObject<{
65
+ action: z.ZodLiteral<"type">;
66
+ selector: z.ZodString;
67
+ text: z.ZodString;
68
+ delay: z.ZodDefault<z.ZodNumber>;
69
+ }, z.core.$strip>;
70
+ declare const ClickStepSchema: z.ZodObject<{
71
+ action: z.ZodLiteral<"click">;
72
+ selector: z.ZodString;
73
+ }, z.core.$strip>;
74
+ declare const WaitForStepSchema: z.ZodObject<{
75
+ action: z.ZodLiteral<"waitFor">;
76
+ selector: z.ZodString;
77
+ timeout: z.ZodDefault<z.ZodNumber>;
78
+ }, z.core.$strip>;
79
+ declare const CaptureStepSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
80
+ action: z.ZodLiteral<"navigate">;
81
+ path: z.ZodString;
82
+ }, z.core.$strip>, z.ZodObject<{
83
+ action: z.ZodLiteral<"type">;
84
+ selector: z.ZodString;
85
+ text: z.ZodString;
86
+ delay: z.ZodDefault<z.ZodNumber>;
87
+ }, z.core.$strip>, z.ZodObject<{
88
+ action: z.ZodLiteral<"click">;
89
+ selector: z.ZodString;
90
+ }, z.core.$strip>, z.ZodObject<{
91
+ action: z.ZodLiteral<"waitFor">;
92
+ selector: z.ZodString;
93
+ timeout: z.ZodDefault<z.ZodNumber>;
94
+ }, z.core.$strip>], "action">;
95
+ type CaptureStep = z.infer<typeof CaptureStepSchema>;
96
+ declare const SceneItemSchema: z.ZodObject<{
97
+ kind: z.ZodLiteral<"scene">;
98
+ id: z.ZodString;
99
+ template: z.ZodString;
100
+ data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
101
+ duration: z.ZodNumber;
102
+ narration: z.ZodOptional<z.ZodString>;
103
+ }, z.core.$strip>;
104
+ type SceneItem = z.infer<typeof SceneItemSchema>;
105
+ declare const RecordSchema: z.ZodObject<{
106
+ fps: z.ZodDefault<z.ZodNumber>;
107
+ maxDuration: z.ZodDefault<z.ZodNumber>;
108
+ }, z.core.$strip>;
109
+ type Record$1 = z.infer<typeof RecordSchema>;
110
+ declare const ScreenshotSchema: z.ZodObject<{
111
+ at: z.ZodDefault<z.ZodArray<z.ZodString>>;
112
+ }, z.core.$strip>;
113
+ declare const CaptureItemSchema: z.ZodObject<{
114
+ kind: z.ZodLiteral<"capture">;
115
+ id: z.ZodString;
116
+ record: z.ZodDefault<z.ZodObject<{
117
+ fps: z.ZodDefault<z.ZodNumber>;
118
+ maxDuration: z.ZodDefault<z.ZodNumber>;
119
+ }, z.core.$strip>>;
120
+ steps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
121
+ action: z.ZodLiteral<"navigate">;
122
+ path: z.ZodString;
123
+ }, z.core.$strip>, z.ZodObject<{
124
+ action: z.ZodLiteral<"type">;
125
+ selector: z.ZodString;
126
+ text: z.ZodString;
127
+ delay: z.ZodDefault<z.ZodNumber>;
128
+ }, z.core.$strip>, z.ZodObject<{
129
+ action: z.ZodLiteral<"click">;
130
+ selector: z.ZodString;
131
+ }, z.core.$strip>, z.ZodObject<{
132
+ action: z.ZodLiteral<"waitFor">;
133
+ selector: z.ZodString;
134
+ timeout: z.ZodDefault<z.ZodNumber>;
135
+ }, z.core.$strip>], "action">>;
136
+ screenshot: z.ZodOptional<z.ZodObject<{
137
+ at: z.ZodDefault<z.ZodArray<z.ZodString>>;
138
+ }, z.core.$strip>>;
139
+ narration: z.ZodOptional<z.ZodString>;
140
+ }, z.core.$strip>;
141
+ type CaptureItem = z.infer<typeof CaptureItemSchema>;
142
+ declare const ClipItemSchema: z.ZodObject<{
143
+ kind: z.ZodLiteral<"clip">;
144
+ id: z.ZodString;
145
+ src: z.ZodString;
146
+ trim: z.ZodOptional<z.ZodObject<{
147
+ startMs: z.ZodOptional<z.ZodNumber>;
148
+ endMs: z.ZodOptional<z.ZodNumber>;
149
+ }, z.core.$strip>>;
150
+ fit: z.ZodDefault<z.ZodEnum<{
151
+ cover: "cover";
152
+ contain: "contain";
153
+ }>>;
154
+ narration: z.ZodOptional<z.ZodString>;
155
+ }, z.core.$strip>;
156
+ type ClipItem = z.infer<typeof ClipItemSchema>;
157
+ declare const TimelineItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
158
+ kind: z.ZodLiteral<"scene">;
159
+ id: z.ZodString;
160
+ template: z.ZodString;
161
+ data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
162
+ duration: z.ZodNumber;
163
+ narration: z.ZodOptional<z.ZodString>;
164
+ }, z.core.$strip>, z.ZodObject<{
165
+ kind: z.ZodLiteral<"capture">;
166
+ id: z.ZodString;
167
+ record: z.ZodDefault<z.ZodObject<{
168
+ fps: z.ZodDefault<z.ZodNumber>;
169
+ maxDuration: z.ZodDefault<z.ZodNumber>;
170
+ }, z.core.$strip>>;
171
+ steps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
172
+ action: z.ZodLiteral<"navigate">;
173
+ path: z.ZodString;
174
+ }, z.core.$strip>, z.ZodObject<{
175
+ action: z.ZodLiteral<"type">;
176
+ selector: z.ZodString;
177
+ text: z.ZodString;
178
+ delay: z.ZodDefault<z.ZodNumber>;
179
+ }, z.core.$strip>, z.ZodObject<{
180
+ action: z.ZodLiteral<"click">;
181
+ selector: z.ZodString;
182
+ }, z.core.$strip>, z.ZodObject<{
183
+ action: z.ZodLiteral<"waitFor">;
184
+ selector: z.ZodString;
185
+ timeout: z.ZodDefault<z.ZodNumber>;
186
+ }, z.core.$strip>], "action">>;
187
+ screenshot: z.ZodOptional<z.ZodObject<{
188
+ at: z.ZodDefault<z.ZodArray<z.ZodString>>;
189
+ }, z.core.$strip>>;
190
+ narration: z.ZodOptional<z.ZodString>;
191
+ }, z.core.$strip>, z.ZodObject<{
192
+ kind: z.ZodLiteral<"clip">;
193
+ id: z.ZodString;
194
+ src: z.ZodString;
195
+ trim: z.ZodOptional<z.ZodObject<{
196
+ startMs: z.ZodOptional<z.ZodNumber>;
197
+ endMs: z.ZodOptional<z.ZodNumber>;
198
+ }, z.core.$strip>>;
199
+ fit: z.ZodDefault<z.ZodEnum<{
200
+ cover: "cover";
201
+ contain: "contain";
202
+ }>>;
203
+ narration: z.ZodOptional<z.ZodString>;
204
+ }, z.core.$strip>], "kind">;
205
+ type TimelineItem = z.infer<typeof TimelineItemSchema>;
206
+ declare const VoiceSchema: z.ZodObject<{
207
+ provider: z.ZodDefault<z.ZodLiteral<"elevenlabs">>;
208
+ voiceId: z.ZodString;
209
+ model: z.ZodDefault<z.ZodString>;
210
+ }, z.core.$strip>;
211
+ type Voice = z.infer<typeof VoiceSchema>;
212
+ declare const MusicSchema: z.ZodObject<{
213
+ prompt: z.ZodString;
214
+ duckDb: z.ZodDefault<z.ZodNumber>;
215
+ fade: z.ZodDefault<z.ZodNumber>;
216
+ }, z.core.$strip>;
217
+ type Music = z.infer<typeof MusicSchema>;
218
+ declare const OutputSchema: z.ZodObject<{
219
+ dir: z.ZodDefault<z.ZodString>;
220
+ video: z.ZodDefault<z.ZodString>;
221
+ deck: z.ZodDefault<z.ZodString>;
222
+ res: z.ZodDefault<z.ZodString>;
223
+ seed: z.ZodDefault<z.ZodNumber>;
224
+ }, z.core.$strip>;
225
+ type Output = z.infer<typeof OutputSchema>;
226
+ declare const ShowreelConfigSchema: z.ZodObject<{
227
+ $schema: z.ZodOptional<z.ZodString>;
228
+ target: z.ZodObject<{
229
+ url: z.ZodString;
230
+ viewport: z.ZodDefault<z.ZodObject<{
231
+ width: z.ZodDefault<z.ZodNumber>;
232
+ height: z.ZodDefault<z.ZodNumber>;
233
+ dpr: z.ZodDefault<z.ZodNumber>;
234
+ }, z.core.$strip>>;
235
+ chromePath: z.ZodDefault<z.ZodString>;
236
+ readyFlag: z.ZodDefault<z.ZodString>;
237
+ }, z.core.$strip>;
238
+ brand: z.ZodDefault<z.ZodUnion<readonly [z.ZodObject<{
239
+ preset: z.ZodOptional<z.ZodString>;
240
+ tokens: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
241
+ fonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
242
+ family: z.ZodString;
243
+ weights: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
244
+ href: z.ZodOptional<z.ZodString>;
245
+ }, z.core.$strip>>>;
246
+ }, z.core.$strip>, z.ZodString]>>;
247
+ timeline: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
248
+ kind: z.ZodLiteral<"scene">;
249
+ id: z.ZodString;
250
+ template: z.ZodString;
251
+ data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
252
+ duration: z.ZodNumber;
253
+ narration: z.ZodOptional<z.ZodString>;
254
+ }, z.core.$strip>, z.ZodObject<{
255
+ kind: z.ZodLiteral<"capture">;
256
+ id: z.ZodString;
257
+ record: z.ZodDefault<z.ZodObject<{
258
+ fps: z.ZodDefault<z.ZodNumber>;
259
+ maxDuration: z.ZodDefault<z.ZodNumber>;
260
+ }, z.core.$strip>>;
261
+ steps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
262
+ action: z.ZodLiteral<"navigate">;
263
+ path: z.ZodString;
264
+ }, z.core.$strip>, z.ZodObject<{
265
+ action: z.ZodLiteral<"type">;
266
+ selector: z.ZodString;
267
+ text: z.ZodString;
268
+ delay: z.ZodDefault<z.ZodNumber>;
269
+ }, z.core.$strip>, z.ZodObject<{
270
+ action: z.ZodLiteral<"click">;
271
+ selector: z.ZodString;
272
+ }, z.core.$strip>, z.ZodObject<{
273
+ action: z.ZodLiteral<"waitFor">;
274
+ selector: z.ZodString;
275
+ timeout: z.ZodDefault<z.ZodNumber>;
276
+ }, z.core.$strip>], "action">>;
277
+ screenshot: z.ZodOptional<z.ZodObject<{
278
+ at: z.ZodDefault<z.ZodArray<z.ZodString>>;
279
+ }, z.core.$strip>>;
280
+ narration: z.ZodOptional<z.ZodString>;
281
+ }, z.core.$strip>, z.ZodObject<{
282
+ kind: z.ZodLiteral<"clip">;
283
+ id: z.ZodString;
284
+ src: z.ZodString;
285
+ trim: z.ZodOptional<z.ZodObject<{
286
+ startMs: z.ZodOptional<z.ZodNumber>;
287
+ endMs: z.ZodOptional<z.ZodNumber>;
288
+ }, z.core.$strip>>;
289
+ fit: z.ZodDefault<z.ZodEnum<{
290
+ cover: "cover";
291
+ contain: "contain";
292
+ }>>;
293
+ narration: z.ZodOptional<z.ZodString>;
294
+ }, z.core.$strip>], "kind">>;
295
+ voice: z.ZodObject<{
296
+ provider: z.ZodDefault<z.ZodLiteral<"elevenlabs">>;
297
+ voiceId: z.ZodString;
298
+ model: z.ZodDefault<z.ZodString>;
299
+ }, z.core.$strip>;
300
+ music: z.ZodObject<{
301
+ prompt: z.ZodString;
302
+ duckDb: z.ZodDefault<z.ZodNumber>;
303
+ fade: z.ZodDefault<z.ZodNumber>;
304
+ }, z.core.$strip>;
305
+ output: z.ZodDefault<z.ZodObject<{
306
+ dir: z.ZodDefault<z.ZodString>;
307
+ video: z.ZodDefault<z.ZodString>;
308
+ deck: z.ZodDefault<z.ZodString>;
309
+ res: z.ZodDefault<z.ZodString>;
310
+ seed: z.ZodDefault<z.ZodNumber>;
311
+ }, z.core.$strip>>;
312
+ }, z.core.$strip>;
313
+ type ShowreelConfig = z.infer<typeof ShowreelConfigSchema>;
314
+ interface MeasuredTimelineItem {
315
+ /** matches the `id` of the source ShowreelConfig timeline item */
316
+ id: string;
317
+ kind: "scene" | "capture" | "clip";
318
+ /** measured start offset on the master timeline, in ms */
319
+ startMs: number;
320
+ /** measured end offset on the master timeline, in ms */
321
+ endMs: number;
322
+ }
323
+ type MeasuredTimeline = MeasuredTimelineItem[];
324
+ declare class ShowreelConfigError extends Error {
325
+ readonly issues: z.core.$ZodIssue[];
326
+ constructor(message: string, issues: z.core.$ZodIssue[]);
327
+ }
328
+ /**
329
+ * Parse an unknown value into a validated `ShowreelConfig`.
330
+ * Throws `ShowreelConfigError` (with structured `issues`) on failure.
331
+ */
332
+ declare function validateConfig(input: unknown): ShowreelConfig;
333
+
334
+ /**
335
+ * `resolveBrand` — the one seam where `@canvakit/showreel` depends on
336
+ * `@canvakit/designkit`. Turns the config's `brand` field (an inline
337
+ * `Brand` object, or a design ref string like `"dk:heritage"`) into a
338
+ * concrete `Brand` every stage (html-still renderer, agentic brief) can
339
+ * consume without knowing about design refs at all.
340
+ */
341
+
342
+ /** Context a ref resolution needs — currently just the filesystem, for
343
+ * `ws:`/`kit:` refs. Re-export of designkit's own context shape so
344
+ * callers don't need a second import for the same thing. */
345
+ type ResolveBrandContext = DesignSourceContext;
346
+ /**
347
+ * Resolve the config's `brand` field into a concrete `Brand`.
348
+ *
349
+ * - A `Brand` object is returned as-is (identity — the common,
350
+ * backward-compatible case).
351
+ * - A string is treated as a design ref (`dk:`/`ws:`/`kit:` or the
352
+ * registry's fallback path shorthand) and resolved via
353
+ * `@canvakit/designkit`'s `defaultRegistry`. The resolved
354
+ * `DesignArtifact`'s flat `tokens.colors` map becomes `Brand.tokens`
355
+ * (the same flat shape `Brand.tokens` already used — `accent`,
356
+ * `background`, …), and `fonts` (when the source ships any) threads
357
+ * straight through so the agentic brief can prescribe exact faces.
358
+ *
359
+ * Throws a readable error when the ref doesn't resolve — an unknown
360
+ * brand ref is a config mistake the caller should see immediately, not
361
+ * a silent empty brand.
362
+ */
363
+ declare function resolveBrand(input: Brand | string, ctx: ResolveBrandContext): Promise<Brand>;
364
+
365
+ /**
366
+ * Node-backed filesystem for `resolveBrand`'s `ctx.fs` — the default used
367
+ * by `runShowreel`/`runShowreelWith` when no `deps.fs` is injected. Only
368
+ * exercised for `ws:`/`kit:` brand refs (`dk:` presets need no fs at all);
369
+ * a `dk:`-only config never touches this. Mirrors `@canvakit/cli`'s
370
+ * `local-fs.ts` — duplicated rather than imported because showreel has no
371
+ * dependency edge onto the CLI package (and shouldn't grow one).
372
+ */
373
+
374
+ declare function createLocalFs(baseDir: string): ResolveBrandContext["fs"];
375
+
376
+ /**
377
+ * `SceneTemplateRegistry` — a scene IS a canvakit-core canva.
378
+ *
379
+ * A scene template ref is a `<scheme>:<id>` string, dispatched by scheme
380
+ * prefix — same shape as `@canvakit/designkit`'s `DesignSourceRegistry`
381
+ * (the "patron"): `resolve()` never throws (warns + returns `null`),
382
+ * `register()` adds a scheme, `list()` aggregates every scheme that opts
383
+ * in, and a bare name with no scheme (`"hero-split"`) falls back to
384
+ * `builtin:hero-split` — the same "un-prefixed ref is sugar" trick
385
+ * designkit uses for its own fallback resolver.
386
+ *
387
+ * Built-in schemes:
388
+ *
389
+ * - `builtin:<id>` — a canva shipped with `@canvakit/showreel` itself.
390
+ * These are the templates the html-still renderer used to hand-roll
391
+ * as `SCENE_TEMPLATES` (`hero-split`, `cta-card`) — now real canvakit
392
+ * templates rendered via `renderCanva`. `hero` / `cta` are ergonomic
393
+ * aliases for the same two canva.
394
+ * - `ws:<path>` — a canva authored in the workspace (e.g.
395
+ * `ws:_scenes/cold-open.md`). Slots are derived from the template's
396
+ * own top-level `{{placeholder}}` references.
397
+ */
398
+
399
+ /** `SceneItem.data` — an arbitrary map of scene fields (title, subtitle, …). */
400
+ type SceneData = SceneItem["data"];
401
+ /**
402
+ * Reserved for a future CSS motion preset system — a canva can name a
403
+ * preset + duration override without the renderer hard-coding either.
404
+ * Not consumed by `renderCanva` yet; carried through so authors can
405
+ * declare it once the CSS-motion layer lands.
406
+ */
407
+ interface SceneMotionSpec {
408
+ /** named motion preset the canva's CSS opts into, e.g. "fade-in" */
409
+ preset?: string;
410
+ /** motion duration override in ms; falls back to the scene's declared duration */
411
+ durationMs?: number;
412
+ }
413
+ /**
414
+ * A scene, as a canvakit-core canva: `source` is template text (frontmatter
415
+ * + mustache body) `@canvakit/core` `render()` can consume directly.
416
+ */
417
+ interface SceneTemplate {
418
+ /** canonical resolved ref, e.g. "builtin:hero-split" */
419
+ id: string;
420
+ /** canvakit-core template text — frontmatter + mustache body */
421
+ source: string;
422
+ /** merged UNDER caller-supplied `data` (`data` wins on key conflict) */
423
+ defaults?: SceneData;
424
+ /** data fields the canva expects — title, subtitle, stat, … */
425
+ slots: string[];
426
+ motion?: SceneMotionSpec;
427
+ }
428
+ /** Context a scene-template resolution needs — the workspace filesystem,
429
+ * for `ws:` refs. Same shape as designkit's `DesignSourceContext`. */
430
+ interface SceneTemplateContext {
431
+ fs: FilesystemLike;
432
+ }
433
+ type SceneTemplateResolver = (id: string, ctx: SceneTemplateContext) => Promise<SceneTemplate | null>;
434
+ /** One scene template discoverable via `SceneTemplateRegistry.list()`. */
435
+ interface SceneTemplateEntry {
436
+ /** the full ref that would resolve this entry, e.g. "builtin:hero-split" */
437
+ ref: string;
438
+ scheme: string;
439
+ }
440
+ /** Optional — a scheme with no `list` simply doesn't contribute to
441
+ * `list()`'s aggregate; it's still fully resolvable via `resolve()`.
442
+ * Same never-throw contract as `SceneTemplateResolver`. */
443
+ type SceneTemplateLister = (ctx: SceneTemplateContext) => Promise<SceneTemplateEntry[]>;
444
+ interface SceneTemplateSource {
445
+ /** scheme prefix without the trailing colon — e.g. "builtin", "ws" */
446
+ scheme: string;
447
+ resolve: SceneTemplateResolver;
448
+ list?: SceneTemplateLister;
449
+ }
450
+ declare class SceneTemplateRegistry {
451
+ #private;
452
+ register(source: SceneTemplateSource): void;
453
+ has(scheme: string): boolean;
454
+ /**
455
+ * Resolve a ref to a `SceneTemplate`. Splits on the first colon to
456
+ * extract the scheme. A ref with no scheme (no colon, or a leading
457
+ * colon) is sugar for `builtin:<ref>` — never throws; an unknown
458
+ * scheme or unknown id warns once and returns `null`.
459
+ */
460
+ resolve(ref: string, ctx: SceneTemplateContext): Promise<SceneTemplate | null>;
461
+ /**
462
+ * Enumerate every scene template discoverable across schemes that expose
463
+ * a `list`. Aggregated result is sorted by `(scheme, ref)` and
464
+ * de-duplicated by `ref`. Per-lister isolation matches `resolve()`'s
465
+ * never-throw contract — a misbehaving lister is warned about and
466
+ * skipped rather than crashing the aggregate.
467
+ */
468
+ list(ctx: SceneTemplateContext): Promise<SceneTemplateEntry[]>;
469
+ }
470
+ /**
471
+ * Look up a builtin canva's raw `.md` source by id or alias — for the
472
+ * future `canvakit scene init <builtin> <dest>` (Rang 6) to copy into the
473
+ * workspace for editing.
474
+ */
475
+ declare function builtinSceneSource(id: string): string | null;
476
+ /** Build a registry pre-populated with the built-in schemes. */
477
+ declare function createDefaultSceneTemplateRegistry(): SceneTemplateRegistry;
478
+ /** Default singleton — `resolveSceneTemplate` uses this. */
479
+ declare const defaultSceneTemplateRegistry: SceneTemplateRegistry;
480
+ /** Resolve a scene template ref against the default registry. Never throws. */
481
+ declare function resolveSceneTemplate(ref: string, ctx: SceneTemplateContext): Promise<SceneTemplate | null>;
482
+
483
+ /**
484
+ * AUTO-GENERATED by scripts/gen-builtin-scenes.mjs from scenes/*.md — do not edit by hand.
485
+ * Regenerate with pnpm --filter=@canvakit/showreel gen:scenes.
486
+ */
487
+
488
+ interface BuiltinScene {
489
+ source: string;
490
+ slots: string[];
491
+ defaults?: SceneData;
492
+ aliases?: string[];
493
+ }
494
+ declare const BUILTIN_SCENES: Record<string, BuiltinScene>;
495
+
496
+ /**
497
+ * `renderCanva` — the pont core: turns a resolved `SceneTemplate` + scene
498
+ * `data` + a resolved `Brand` into a rendered HTML page, via
499
+ * `@canvakit/core` `render()` and `@canvakit/designkit`'s
500
+ * `designkitExtension()`. This is the junction of Axis 1 (design — the
501
+ * resolved `Brand`) and Axis 2 (composition — the `SceneTemplate` canva):
502
+ * `render()` marries them.
503
+ *
504
+ * `Brand` is already fully resolved (see `../brand/resolve.ts`) — this
505
+ * function never touches the workspace `DesignSourceRegistry` or the
506
+ * filesystem again. It wraps `brand` in a tiny one-scheme registry so
507
+ * `designkitExtension` (the design↔render bridge) can contribute
508
+ * `$design.colors.*` to the mustache context exactly like it would for a
509
+ * `dk:`/`ws:`/`kit:` ref, without re-resolving anything.
510
+ *
511
+ * Font handling is intentionally NOT delegated to `designkitExtension`
512
+ * (its `embed` mode reads font files off a filesystem path — brand fonts
513
+ * here are typically remote URLs or `data:` URIs). Instead this ports the
514
+ * old `renderSceneHtml`'s bespoke font-head renderer verbatim: a `data:`
515
+ * or recognised font-file href becomes an inlined `@font-face`; anything
516
+ * else becomes a `<link rel="stylesheet">`.
517
+ */
518
+
519
+ /**
520
+ * Render a resolved `SceneTemplate` + scene `data` under `brand` to a full
521
+ * HTML page. `data` is merged over `template.defaults` (data wins).
522
+ */
523
+ declare function renderCanva(template: SceneTemplate, data: SceneData, brand: Brand): Promise<string>;
524
+
525
+ /**
526
+ * @canvakit/showreel — browser stage.
527
+ *
528
+ * Drives the live target app with puppeteer-core: runs the scripted
529
+ * capture steps, records frames via CDP `Page.startScreencast`, and
530
+ * returns the *measured* timing for each capture item.
531
+ *
532
+ * The returned `MeasuredTimeline` slice is the contract the rest of the
533
+ * pipeline builds on — durations here are real (a capture lasts until its
534
+ * `waitFor` resolves), never assumed. The screencast is written as a raw
535
+ * (variable-rate) mp4; CFR rescaling against the measured durations is the
536
+ * assembly stage's job.
537
+ */
538
+
539
+ interface CaptureResult {
540
+ /** measured timing for the captured items, in master-timeline ms */
541
+ timeline: MeasuredTimeline;
542
+ /** absolute paths to screenshot stills keyed to `screenshot.at` */
543
+ screenshots: string[];
544
+ /** absolute path to the raw screen-recording (frames → mp4) */
545
+ screencastPath: string;
546
+ }
547
+ /**
548
+ * Resolve a Chrome/Chromium executable. Accepts an absolute path, an
549
+ * `env:VAR` reference, or falls back to the puppeteer cache / the system
550
+ * Google Chrome. Returns `null` when nothing is found (callers decide
551
+ * whether that's fatal or a skip).
552
+ */
553
+ declare function findChrome(spec?: string): string | null;
554
+ /**
555
+ * Launch Chrome, run each capture item's steps against `target`, record
556
+ * the screencast, and measure real start/end offsets on the master
557
+ * timeline (rooted at `startOffsetMs`).
558
+ *
559
+ * KNOWN LIMITATION (deliberately not solved here): when `scene` items are
560
+ * interleaved between captures on the master montage, re-basing capture
561
+ * offsets around the scenes' declared durations is the *core orchestrator's*
562
+ * responsibility (a later link). `runCapture` treats its `items` as a
563
+ * contiguous block starting at `startOffsetMs`.
564
+ */
565
+ declare function runCapture(target: Target, items: CaptureItem[], startOffsetMs: number): Promise<CaptureResult>;
566
+ /**
567
+ * Encode buffered JPEG screencast frames into a raw mp4 via ffmpeg.
568
+ * The frames are variable-rate (screencast emits on paint); we tag them at
569
+ * `fps` and let the assembly stage rescale to a uniform CFR against the
570
+ * measured per-item durations. Throws if no frames were captured.
571
+ */
572
+ declare function encodeFramesToMp4(frames: Buffer[], fps: number, outPath: string): Promise<void>;
573
+
574
+ /**
575
+ * @canvakit/showreel — content-addressed scene render cache.
576
+ *
577
+ * `cachingVisualRenderer` decorates ANY `VisualRenderer` (html-still,
578
+ * agentic, or a future engine) with a disk cache keyed by a stable hash of
579
+ * the scene's template + data + duration + brand (+ an opaque engine
580
+ * `salt`). A hit short-circuits the inner renderer entirely; a miss
581
+ * renders once through `inner` and stores an atomic copy for next time.
582
+ * This is a pure decorator — it never touches `renderScenesWith` or the
583
+ * orchestrator's scene concurrency, so it composes identically whichever
584
+ * engine (and whatever concurrency) wraps it.
585
+ */
586
+
587
+ interface SceneCacheOptions {
588
+ /** Cache directory. Default: `<cwd>/.canvakit/scene-cache`. */
589
+ dir?: string;
590
+ /** Cache active? Default true. `false` ⇒ always delegates to `inner` (no disk touched). */
591
+ enabled?: boolean;
592
+ /**
593
+ * Opaque salt mixed into the hash — identifies the ENGINE + its version
594
+ * + its params (e.g. `maxRounds`). Ensures an html-still clip never
595
+ * satisfies an agentic cache key, and vice versa.
596
+ */
597
+ salt?: string;
598
+ }
599
+ /** Wrap `inner` with a content-addressed disk cache, keyed by scene + brand + salt. */
600
+ declare function cachingVisualRenderer(inner: VisualRenderer, opts?: SceneCacheOptions): VisualRenderer;
601
+
602
+ /**
603
+ * @canvakit/showreel — VisualRenderer: the pluggable seam for turning one
604
+ * scene into an exact-duration video clip. Mirrors @canvakit/export's
605
+ * `ChromeRenderer`/`resolveRenderer`: an interface + a resolver + a
606
+ * zero-dependency shipped default (`htmlStillVisualRenderer`), with room to
607
+ * inject another engine (e.g. `@canvakit/showreel-remotion`'s
608
+ * `remotionVisualRenderer`) via `resolveVisualRenderer({ renderer })`.
609
+ *
610
+ * The shipped default renders a scene's template to a static HTML/CSS page,
611
+ * screenshots it with headless Chrome, and encodes the still into an
612
+ * exact-duration mp4 via ffmpeg — the same logic `renderScenes` always ran,
613
+ * now behind the interface.
614
+ */
615
+
616
+ /** One rendered scene clip — an exact-duration mp4 + the duration it claims. */
617
+ interface RenderedClip {
618
+ /** absolute path to the rendered clip (mp4) */
619
+ clipPath: string;
620
+ /** the clip's real playback duration, in ms */
621
+ durationMs: number;
622
+ }
623
+ /** Turn one scene into an exact-duration video clip. Mirrors ChromeRenderer. */
624
+ interface VisualRenderer {
625
+ renderScene(item: SceneItem, brand: Brand): Promise<RenderedClip>;
626
+ /**
627
+ * Release any resources held across `renderScene` calls (e.g. a shared
628
+ * headless browser). Called once per batch by `renderScenesWith`; a
629
+ * renderer stays usable after — the next `renderScene` re-acquires lazily.
630
+ */
631
+ dispose?(): Promise<void>;
632
+ }
633
+ interface ResolveVisualRendererOptions {
634
+ /** An explicit renderer to use (e.g. a Remotion-backed adapter). Wins. */
635
+ renderer?: VisualRenderer;
636
+ /**
637
+ * Wrap the resolved renderer with the content-addressed scene cache
638
+ * (see `./cache.js`). Absent, or `enabled: false`, leaves the resolved
639
+ * renderer untouched — same behaviour as before this option existed.
640
+ */
641
+ cache?: SceneCacheOptions;
642
+ }
643
+ /**
644
+ * Pick the renderer for scene clips — injection > the shipped HTML/still
645
+ * default. Returns a FRESH `htmlStillVisualRenderer` instance per call
646
+ * (rather than a shared singleton): `renderScenes()` calls this once per
647
+ * invocation, and the orchestrator may run several such invocations
648
+ * CONCURRENTLY (independent scenes) — each needs its own private
649
+ * browser/dispose lifecycle so one call's teardown can never race another's
650
+ * in-flight render.
651
+ */
652
+ declare function resolveVisualRenderer(opts?: ResolveVisualRendererOptions): VisualRenderer;
653
+ /**
654
+ * The shipped default instance, for direct import/reuse across several
655
+ * `renderScene` calls made explicitly by a caller (e.g. via
656
+ * `resolveVisualRenderer({ renderer: htmlStillVisualRenderer })`).
657
+ * `resolveVisualRenderer()`'s own internal default does NOT reuse this
658
+ * singleton — see the concurrency note above.
659
+ */
660
+ declare const htmlStillVisualRenderer: VisualRenderer;
661
+ /**
662
+ * Render a scene's `template` + `data` + `brand` to a full HTML page.
663
+ * `fs` resolves `ws:` scene-template refs (a canva authored in the
664
+ * workspace); defaults to a Node fs rooted at `process.cwd()`, same
665
+ * default `resolveBrand` uses for `ws:`/`kit:` brand refs.
666
+ */
667
+ declare function renderSceneHtml(item: SceneItem, brand: Brand, fs?: FilesystemLike): Promise<string>;
668
+
669
+ /**
670
+ * @canvakit/showreel — scenes stage.
671
+ *
672
+ * Walks the declared scene items, accumulating the deterministic timeline
673
+ * from `startOffsetMs` using each item's declared `duration` (never a
674
+ * measurement — a scene lasts exactly as long as it says), and renders each
675
+ * one through an injected {@link VisualRenderer}. `renderScenes` is the
676
+ * public entry point, wired to the shipped HTML/still default; mirrors the
677
+ * `synthesizeAudioWith`/`synthesizeAudio` injection idiom in `../audio`.
678
+ */
679
+
680
+ interface SceneResult {
681
+ /** measured timing for the rendered scenes, in master-timeline ms */
682
+ timeline: MeasuredTimeline;
683
+ /** absolute paths to the rendered scene clips (mp4), montage order */
684
+ clipPaths: string[];
685
+ }
686
+ /**
687
+ * Render each scene item through `renderer`, accumulating the deterministic
688
+ * timeline from `startOffsetMs`. Durations are declared, never measured.
689
+ */
690
+ declare function renderScenesWith(renderer: VisualRenderer, items: SceneItem[], brand: Brand, startOffsetMs: number): Promise<SceneResult>;
691
+ /**
692
+ * Render + record each scene item via the shipped HTML/still
693
+ * {@link VisualRenderer} (headless Chrome screenshot + ffmpeg encode).
694
+ */
695
+ declare function renderScenes(items: SceneItem[], brand: Brand, startOffsetMs: number): Promise<SceneResult>;
696
+
697
+ /**
698
+ * @canvakit/showreel — clips stage.
699
+ *
700
+ * A `clip` timeline item borrows an existing video file. Unlike a `scene`
701
+ * (declared duration) or a `capture` (measured live, in-process), a clip's
702
+ * real length is a fact about a file on disk — so this is the one place
703
+ * that calls ffprobe against a user-supplied source. The schema
704
+ * deliberately carries no `duration` field for `clip` (see
705
+ * `../core/schema.ts`); `trim` only narrows a window that must already fit
706
+ * inside what ffprobe reports, never a declared guess.
707
+ *
708
+ * `src` resolves against the *config file's* directory (not
709
+ * `process.cwd()`, unlike a `brand` ref) — a clip asset travels with its
710
+ * config. Every failure mode here throws, naming the item id and the
711
+ * resolved path: a missing file, an unreadable one, or a `trim` outside the
712
+ * measured duration must stop the run, never silently produce a
713
+ * zero-length slot.
714
+ */
715
+
716
+ /** Everything the assemble stage needs to place a clip's real frames into the timeline. */
717
+ interface ClipResult {
718
+ /** matches the source ClipItem's id */
719
+ id: string;
720
+ /** resolved absolute path to the source video */
721
+ path: string;
722
+ /** the measured, validated trim window within `path`, in ms */
723
+ trim: {
724
+ startMs: number;
725
+ endMs: number;
726
+ };
727
+ fit: "cover" | "contain";
728
+ }
729
+ interface ResolvedClip {
730
+ /** this clip's slot on the master timeline, rooted at the offset it was measured from */
731
+ slot: MeasuredTimelineItem;
732
+ result: ClipResult;
733
+ }
734
+ /**
735
+ * Resolve a clip's declared `src` against the config file's directory.
736
+ * Absolute paths pass through unchanged — the same convention `@canvakit/cli`
737
+ * uses for other config-relative fields.
738
+ */
739
+ declare function resolveClipSrc(src: string, configDir: string): string;
740
+ /**
741
+ * Given a clip item and its REAL measured duration, compute the validated
742
+ * trim window. Pure — no I/O — so the arithmetic and failure messages are
743
+ * unit-testable without a real ffprobe call; `measureClip` below is the only
744
+ * caller that supplies a real `durationMs`.
745
+ *
746
+ * Both bounds default to the full measured span; an explicit bound outside
747
+ * `[0, durationMs]` (or an inverted/empty window) throws immediately, naming
748
+ * the item id and the resolved path — never clamped, never a silent skip.
749
+ */
750
+ declare function computeTrimWindow(item: ClipItem, durationMs: number, resolvedPath: string): {
751
+ startMs: number;
752
+ endMs: number;
753
+ };
754
+ /**
755
+ * Resolve, probe, and place one `clip` item on the master timeline, rooted
756
+ * at `startOffsetMs`. This is the `MeasureClip` callback `buildMasterTimeline`
757
+ * (`../orchestrate/timeline.js`) invokes for real; tests inject a synthetic
758
+ * fake instead so they never shell out to ffprobe.
759
+ */
760
+ declare function measureClip(item: ClipItem, startOffsetMs: number, configDir: string): Promise<ResolvedClip>;
761
+
762
+ /**
763
+ * @canvakit/showreel — audio stage.
764
+ *
765
+ * Synthesizes narration (ElevenLabs TTS, one clip per timeline item that
766
+ * declares `narration`) and generates ducked background music (ElevenLabs
767
+ * Music API). Narration clips are placed by their item's *measured*
768
+ * startMs — the adelay comes from the MeasuredTimeline, never a constant.
769
+ */
770
+
771
+ interface NarrationClip {
772
+ /** timeline item id this clip is anchored to */
773
+ id: string;
774
+ /** absolute path to the synthesized narration audio */
775
+ path: string;
776
+ /** placement on the master timeline (== item.startMs), in ms */
777
+ startMs: number;
778
+ /** measured clip duration, in ms */
779
+ durationMs: number;
780
+ }
781
+ interface AudioResult {
782
+ narration: NarrationClip[];
783
+ /** absolute path to the generated music bed */
784
+ musicPath: string;
785
+ }
786
+ /**
787
+ * Injectable synthesis backends — the public `synthesizeAudio` signature is
788
+ * frozen at 4 args, so tests reach the real logic through
789
+ * `synthesizeAudioWith` instead of adding a params object here.
790
+ */
791
+ interface AudioDeps {
792
+ tts(text: string, voice: Voice): Promise<Buffer>;
793
+ makeMusic(prompt: string, totalMs: number): Promise<Buffer>;
794
+ }
795
+ /**
796
+ * Produce narration clips anchored to the measured timeline plus a music
797
+ * bed sized to the timeline's total length. Takes its synthesis backends as
798
+ * `deps` so tests can swap in fakes without touching the network.
799
+ */
800
+ declare function synthesizeAudioWith(deps: AudioDeps, items: TimelineItem[], measured: MeasuredTimeline, voice: Voice, music: Music): Promise<AudioResult>;
801
+ /**
802
+ * Produce narration clips anchored to the measured timeline plus a music
803
+ * bed sized to the timeline's total length.
804
+ */
805
+ declare function synthesizeAudio(items: TimelineItem[], measured: MeasuredTimeline, voice: Voice, music: Music): Promise<AudioResult>;
806
+
807
+ /**
808
+ * @canvakit/showreel — assemble stage.
809
+ *
810
+ * The ffmpeg layer + PDF deck. Consumes the MeasuredTimeline plus the
811
+ * clips/screenshots/audio from the earlier stages and produces the final
812
+ * artifacts:
813
+ *
814
+ * - fit each clip to its measured timeline slot (pad-by-frame-hold or
815
+ * trim), then concat all clips to a single CFR video (rescale to -r
816
+ * fps, -fps_mode cfr) so mux is trivial, total duration matches the
817
+ * master timeline, and audio never drifts. A `clip` timeline item's
818
+ * source is first cut down to its `ClipResult.trim` window (a
819
+ * frame-accurate re-encode — the source may be far longer than the
820
+ * window it lends the montage), THEN put through the exact same
821
+ * fit-to-slot path scene/capture clips use, honouring `fit`
822
+ * (`cover` crops to fill, `contain` letterboxes — scene/capture clips
823
+ * always use `contain`, since their source is already produced at the
824
+ * output aspect ratio).
825
+ * - place narration via adelay=startMs derived from the measured
826
+ * timeline, then amix; duck music under narration
827
+ * - deck PDF via @canvakit/export (headless-Chrome print-to-pdf)
828
+ *
829
+ * KNOWN LIMITATION (deliberately not solved here): a `CaptureResult` is one
830
+ * continuous recording spanning several capture items (see
831
+ * `browser/index.ts`), so its `screencastPath` is emitted once, the first
832
+ * time any of its items appears in the measured timeline, and fit to the
833
+ * *combined* span of all its items — precise per-item trimming of a shared
834
+ * capture recording is the core orchestrator's job (a later link).
835
+ */
836
+
837
+ interface AssembleInput {
838
+ measured: MeasuredTimeline;
839
+ captures: CaptureResult[];
840
+ scenes: SceneResult[];
841
+ clips: ClipResult[];
842
+ audio: AudioResult;
843
+ music: Music;
844
+ output: Output;
845
+ /** the declared ShowreelConfig timeline — source of each scene's `data` (title/subtitle) and narration script text for the deck (measured/audio only carry timing). */
846
+ timeline: TimelineItem[];
847
+ }
848
+ interface ShowreelArtifacts {
849
+ /** absolute path to the final muxed video */
850
+ videoPath: string;
851
+ /** absolute path to the exported deck PDF */
852
+ deckPath: string;
853
+ }
854
+ /**
855
+ * Build the deck's HTML — a cover plus one page per measured item, enriched
856
+ * with each scene's `data` (title/subtitle) and its narration script text
857
+ * (sourced from the declared `timeline`, since `measured`/`audio` only carry
858
+ * timing). Pure and exported so tests can assert on the markup directly,
859
+ * without needing Chrome to export a PDF.
860
+ */
861
+ declare function buildDeckHtml(measured: MeasuredTimeline, captures: CaptureResult[], audio: AudioResult, timeline: TimelineItem[]): string;
862
+ /**
863
+ * Mux everything into the final video (CFR concat + ducked audio) and
864
+ * export the deck PDF.
865
+ */
866
+ declare function assemble(input: AssembleInput): Promise<ShowreelArtifacts>;
867
+
868
+ /**
869
+ * @canvakit/showreel — orchestrator: timeline segmentation.
870
+ *
871
+ * `assemble.buildClipList` needs one screencast per CONTIGUOUS run of
872
+ * `capture` items (a single `runCapture` call spans a shared live-app
873
+ * session). This groups the declared `timeline` into maximal runs —
874
+ * `scene` and `clip` items are always singletons, `capture` items are
875
+ * merged with their immediate `capture` neighbors — while preserving
876
+ * montage order. Pure, zero I/O: this is planning, not execution.
877
+ */
878
+
879
+ type Segment = {
880
+ kind: "scene";
881
+ item: SceneItem;
882
+ index: number;
883
+ } | {
884
+ kind: "clip";
885
+ item: ClipItem;
886
+ index: number;
887
+ } | {
888
+ kind: "capture";
889
+ items: CaptureItem[];
890
+ indices: number[];
891
+ };
892
+ declare function segmentTimeline(timeline: TimelineItem[]): Segment[];
893
+
894
+ /**
895
+ * @canvakit/showreel — orchestrator: master timeline builder.
896
+ *
897
+ * Scene durations are DECLARED; capture durations are MEASURED only after
898
+ * running Chrome; clip durations are MEASURED only after ffprobing a file on
899
+ * disk — so the master `MeasuredTimeline` cannot be precomputed. This walks
900
+ * `segmentTimeline`'s output left→right with a running `cursorMs`, giving
901
+ * scenes their declared slice immediately and asking the injected `measure`
902
+ * / `measureClip` callbacks for a segment's real timing only once the
903
+ * cursor reaches it. Pure aside from those two injected callbacks — no
904
+ * direct fs/Chrome/ffmpeg I/O here.
905
+ */
906
+
907
+ /**
908
+ * Measures one contiguous capture run, rooted at `startOffsetMs` on the
909
+ * master timeline. Implementations run the real capture (Chrome + ffmpeg);
910
+ * tests inject a synthetic fake — this file never calls the real one.
911
+ */
912
+ type MeasureCaptureSegment = (items: CaptureItem[], startOffsetMs: number) => Promise<{
913
+ slots: MeasuredTimelineItem[];
914
+ }>;
915
+ /**
916
+ * Measures one `clip` item, rooted at `startOffsetMs`. The real
917
+ * implementation (`../clips/index.js`'s `measureClip`) resolves `src` and
918
+ * ffprobes it; tests inject a synthetic fake so this walk never shells out.
919
+ * Optional on `buildMasterTimeline` — a timeline with no `clip` items never
920
+ * needs one, matching every existing caller/test that predates this kind.
921
+ */
922
+ type MeasureClip = (item: ClipItem, startOffsetMs: number) => Promise<MeasuredTimelineItem>;
923
+ interface CaptureSegmentPlacement {
924
+ /** timeline item ids covered by one `runCapture`/`measure` call, in order */
925
+ ids: string[];
926
+ /** master-timeline offset the segment was measured from */
927
+ startOffsetMs: number;
928
+ }
929
+ interface BuiltTimeline {
930
+ /** master timeline, montage order, gap-free */
931
+ measured: MeasuredTimeline;
932
+ /** one entry per `measure` call (== one `runCapture` call downstream) */
933
+ captureSegments: CaptureSegmentPlacement[];
934
+ /** scene id → its slot on the master timeline */
935
+ sceneSlots: Map<string, MeasuredTimelineItem>;
936
+ }
937
+ declare function buildMasterTimeline(timeline: TimelineItem[], measure: MeasureCaptureSegment, measureClip?: MeasureClip): Promise<BuiltTimeline>;
938
+
939
+ /**
940
+ * @canvakit/showreel — core orchestrator.
941
+ *
942
+ * Wires the 4 pipeline stages end-to-end from a single `ShowreelConfig`:
943
+ * build the master timeline (measuring capture segments as the cursor
944
+ * reaches them), render each scene at its measured slot, synthesize audio
945
+ * anchored to the master timeline, then assemble the final artifacts.
946
+ *
947
+ * `runShowreelWith` takes its stage functions as injectable `deps` — mirrors
948
+ * the `synthesizeAudioWith` pattern — so tests can wire fakes without
949
+ * touching Chrome/ffmpeg/ElevenLabs. `runShowreel` is the real thing.
950
+ */
951
+
952
+ /** Injectable stage backends — real ones in `runShowreel`, fakes in tests. */
953
+ interface ShowreelDeps {
954
+ runCapture: typeof runCapture;
955
+ renderScenes: typeof renderScenes;
956
+ synthesizeAudio: typeof synthesizeAudio;
957
+ assemble: typeof assemble;
958
+ /**
959
+ * Resolves + ffprobes one `clip` item, already bound to the config's
960
+ * directory (see `measureClip` in `../clips/index.js`, and how
961
+ * `runShowreel` below and the CLI bind it). Optional — a config with no
962
+ * `clip` items never needs one, matching every existing caller/test that
963
+ * predates this kind; `buildMasterTimeline` throws a clear error if a
964
+ * `clip` item shows up without one.
965
+ */
966
+ measureClip?: (item: ClipItem, startOffsetMs: number) => Promise<ResolvedClip>;
967
+ /**
968
+ * Max scene renders in flight at once. Scene slots are declared upfront
969
+ * (durations aren't measured), so independent scenes can render
970
+ * concurrently instead of one-at-a-time. Default 3.
971
+ */
972
+ sceneConcurrency?: number;
973
+ /**
974
+ * Filesystem used to resolve a string `brand` ref (`ws:`/`kit:` need
975
+ * disk access; `dk:` presets don't touch it at all). Defaults to a
976
+ * Node fs rooted at `process.cwd()` — override for tests or to root
977
+ * workspace-relative refs elsewhere.
978
+ */
979
+ fs?: ResolveBrandContext["fs"];
980
+ }
981
+ /**
982
+ * Run the full showreel pipeline against injected stage `deps`. Builds the
983
+ * master timeline via a sequential left→right walk (captures are measured,
984
+ * one `runCapture` per contiguous run, never parallelized — they share one
985
+ * live target-app session), renders scenes at their measured slots
986
+ * CONCURRENTLY (up to `deps.sceneConcurrency`, default 3 — scene durations
987
+ * are declared, not measured, so every scene's slot is already known before
988
+ * any of them render), synthesizes audio anchored to the master timeline,
989
+ * then assembles.
990
+ */
991
+ declare function runShowreelWith(deps: ShowreelDeps, config: ShowreelConfig): Promise<ShowreelArtifacts>;
992
+ /** Run the full showreel pipeline for real — Chrome capture/scenes, ElevenLabs audio, ffmpeg assembly. */
993
+ declare function runShowreel(config: ShowreelConfig, opts?: {
994
+ sceneConcurrency?: number;
995
+ configDir?: string;
996
+ }): Promise<ShowreelArtifacts>;
997
+
998
+ export { type AssembleInput, type AudioDeps, type AudioResult, BUILTIN_SCENES, type Brand, type BrandFont, BrandFontSchema, BrandSchema, type BuiltTimeline, type BuiltinScene, type CaptureItem, CaptureItemSchema, type CaptureResult, type CaptureSegmentPlacement, type CaptureStep, CaptureStepSchema, ClickStepSchema, type ClipItem, ClipItemSchema, type ClipResult, type MeasureCaptureSegment, type MeasureClip, type MeasuredTimeline, type MeasuredTimelineItem, type Music, MusicSchema, type NarrationClip, NavigateStepSchema, type Output, OutputSchema, type Record$1 as Record, RecordSchema, type RenderedClip, type ResolveBrandContext, type ResolveVisualRendererOptions, type ResolvedClip, type SceneCacheOptions, type SceneData, type SceneItem, SceneItemSchema, type SceneMotionSpec, type SceneResult, type SceneTemplate, type SceneTemplateContext, type SceneTemplateEntry, type SceneTemplateLister, SceneTemplateRegistry, type SceneTemplateResolver, type SceneTemplateSource, ScreenshotSchema, type Segment, type ShowreelArtifacts, type ShowreelConfig, ShowreelConfigError, ShowreelConfigSchema, type ShowreelDeps, type Target, TargetSchema, type TimelineItem, TimelineItemSchema, TypeStepSchema, type Viewport, ViewportSchema, type VisualRenderer, type Voice, VoiceSchema, WaitForStepSchema, assemble, buildDeckHtml, buildMasterTimeline, builtinSceneSource, cachingVisualRenderer, computeTrimWindow, createDefaultSceneTemplateRegistry, createLocalFs, defaultSceneTemplateRegistry, encodeFramesToMp4, findChrome, htmlStillVisualRenderer, measureClip, renderCanva, renderSceneHtml, renderScenes, renderScenesWith, resolveBrand, resolveClipSrc, resolveSceneTemplate, resolveVisualRenderer, runCapture, runShowreel, runShowreelWith, segmentTimeline, synthesizeAudio, synthesizeAudioWith, validateConfig };