@mengine/medeo-client 1.0.0 → 1.0.1-alpha.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,1421 @@
1
+ import { E as MoveVideoClipsInput, H as AdjustVideoClipVolumeInput, I as DeleteBgmInput, J as AdjustBgmVolumeInput, K as AdjustSpeechVolumeInput, O as MoveSpeechesInput, P as DeleteSpeechesInput, Q as AddSpeechesInput, R as ChangeSpeechScriptInput, S as SetBgmInput, W as AdjustVideoClipDurationInput, X as AddVideoClipsInput, b as SetCaptionStyleInput, g as SetVideoClipSpeedShiftInput, j as DeleteVideoClipsInput, v as SetCaptionVisibilityInput, w as ReplaceVideoClipContentInput, z as ChangeSpeechVoiceInput } from "./index-6e5cbdM3.js";
2
+ import { InferInputType } from "loro-mirror";
3
+ import { z } from "zod";
4
+ import { LoroDoc, PeerID } from "loro-crdt";
5
+
6
+ //#region src/document/generated/video-draft-idl.d.ts
7
+ /**
8
+ * @generated by @mengine/idl-codegen — DO NOT EDIT MANUALLY.
9
+ *
10
+ * VideoDraft read-view types extracted from the Smithy IDL
11
+ * (medeo-v2-design-materials). Re-run `vp run @mengine/idl-codegen#sync`.
12
+ * Source IDL commit: 902e82e3fec1e94b36e14ef671de91abd210dc86
13
+ *
14
+ * WHY EVERY FIELD IS `T | undefined`:
15
+ * AWS `smithy-typescript-codegen` widens every structure member to
16
+ * `T | undefined` regardless of the Smithy `@required` trait — it favours
17
+ * deserialization robustness (a peer may omit a field on the wire) over
18
+ * encoding requiredness in the static type. So these generated types are NOT
19
+ * the source of truth for which fields are required: the Smithy `.smithy`
20
+ * model is. Many fields here (e.g. `VideoClipPart.play_in` / `play_out` /
21
+ * `volume` / `origin_media_id`) are `@required` in the contract.
22
+ *
23
+ * Requiredness is restored at the write-time gate, not here: see the part
24
+ * schemas in `../zod-schema.ts`, which re-mark the `@required` fields as
25
+ * mandatory before a VideoDocument is committed to Loro. Do not assume a
26
+ * field is optional just because its type is `| undefined`.
27
+ */
28
+ /**
29
+ * @public
30
+ * @enum
31
+ */
32
+ declare const PartKind$1: {
33
+ readonly BGM: 'bgm';
34
+ readonly CAPTION: 'caption';
35
+ readonly SPEECH: 'speech';
36
+ readonly VIDEO_CLIP: 'video_clip';
37
+ };
38
+ /**
39
+ * @public
40
+ */
41
+ type PartKind$1 = (typeof PartKind$1)[keyof typeof PartKind$1];
42
+ /**
43
+ * @public
44
+ */
45
+ interface VoiceSummary {
46
+ name: string | undefined;
47
+ id: string | undefined;
48
+ }
49
+ /**
50
+ * @public
51
+ */
52
+ interface SpeechPart$1 {
53
+ id: string | undefined;
54
+ duration_ms: number | undefined;
55
+ /**
56
+ * Types of parts that can be contained in tracks
57
+ * @public
58
+ */
59
+ kind: PartKind$1 | undefined;
60
+ audio_script: string | undefined;
61
+ volume: number | undefined;
62
+ audio_storage_key: string | undefined;
63
+ origin_speech_id: string | undefined;
64
+ voice: VoiceSummary | undefined;
65
+ caption_ids: string[] | undefined;
66
+ }
67
+ /**
68
+ * Caption visual style configuration
69
+ * @public
70
+ */
71
+ interface CaptionStyle {
72
+ /**
73
+ * Font ID referencing a font from the font library. Defaults to system font if not provided
74
+ * @public
75
+ */
76
+ font_id?: string | undefined;
77
+ /**
78
+ * Font size in points
79
+ * @public
80
+ */
81
+ font_size?: number | undefined;
82
+ /**
83
+ * Font color as hex string (e.g. "#FFFFFF")
84
+ * @public
85
+ */
86
+ font_color?: string | undefined;
87
+ /**
88
+ * Numeric font weight, e.g. 400 for regular or 700 for bold
89
+ * @public
90
+ */
91
+ font_weight?: number | undefined;
92
+ /**
93
+ * Caption entrance animation preset ID, e.g. "fade", "slideUp", or "none"
94
+ * @public
95
+ */
96
+ entrance_animation?: string | undefined;
97
+ /**
98
+ * Caption entrance animation duration in milliseconds
99
+ * @public
100
+ */
101
+ entrance_animation_duration_ms?: number | undefined;
102
+ /**
103
+ * Caption outline/stroke color as hex string (e.g. "#000000")
104
+ * @public
105
+ */
106
+ stroke_color?: string | undefined;
107
+ /**
108
+ * Caption outline/stroke width in pixels
109
+ * @public
110
+ */
111
+ stroke_width?: number | undefined;
112
+ /**
113
+ * Caption center X position as a percentage (0.0 to 1.0)
114
+ * @public
115
+ */
116
+ position_x?: number | undefined;
117
+ /**
118
+ * Caption center Y position as a percentage (0.0 to 1.0)
119
+ * @public
120
+ */
121
+ position_y?: number | undefined;
122
+ }
123
+ /**
124
+ * @public
125
+ */
126
+ interface CaptionPart$1 {
127
+ id: string | undefined;
128
+ duration_ms: number | undefined;
129
+ /**
130
+ * Types of parts that can be contained in tracks
131
+ * @public
132
+ */
133
+ kind: PartKind$1 | undefined;
134
+ speech_part_id: string | undefined;
135
+ text: string | undefined;
136
+ start_ms: number | undefined;
137
+ /**
138
+ * Caption visual style (font, size, color, weight, animation, outline). Uses default style if not provided
139
+ * @public
140
+ */
141
+ style?: CaptionStyle | undefined;
142
+ }
143
+ /**
144
+ * @public
145
+ * @enum
146
+ */
147
+ declare const AspectRatio: {
148
+ readonly RATIO_16_9: '16:9';
149
+ readonly RATIO_9_16: '9:16';
150
+ };
151
+ /**
152
+ * @public
153
+ */
154
+ type AspectRatio = (typeof AspectRatio)[keyof typeof AspectRatio];
155
+ /**
156
+ * @public
157
+ * @enum
158
+ */
159
+ declare const AssetSource: {
160
+ readonly AI_IMAGES: 'ai_images';
161
+ readonly AI_VIDEOS: 'ai_videos';
162
+ readonly MY_UPLOADED_ASSETS: 'my_uploaded_assets';
163
+ readonly STOCK_VIDEOS: 'stock_videos';
164
+ };
165
+ /**
166
+ * @public
167
+ */
168
+ type AssetSource = (typeof AssetSource)[keyof typeof AssetSource];
169
+ /**
170
+ * An extra aspect ratio variant with independent storage keys for thumbnail,
171
+ * preview video, and highlight video. Stored inside video_settings JSONB.
172
+ * @public
173
+ */
174
+ interface RatioVariant {
175
+ aspect_ratio: string | undefined;
176
+ thumb_storage_key: string | undefined;
177
+ video_storage_key: string | undefined;
178
+ highlight_video_storage_key?: string | undefined;
179
+ }
180
+ /**
181
+ * @public
182
+ */
183
+ interface VideoCreationSettings$1 {
184
+ voice_id?: string | undefined;
185
+ duration_ms?: number | undefined;
186
+ aspect_ratio?: AspectRatio | undefined;
187
+ video_style_id?: string | undefined;
188
+ asset_sources?: AssetSource[] | undefined;
189
+ recipe_id?: string | undefined;
190
+ enable_high_cost_confirm?: boolean | undefined;
191
+ user_confirm_cost_threshold?: number | undefined;
192
+ /**
193
+ * Extra aspect ratio variants with independent storage keys.
194
+ * Each variant carries its own thumbnail, preview video, and optional highlight video.
195
+ * Used when a recipe supports multiple aspect ratios (e.g. both 16:9 and 9:16).
196
+ * @public
197
+ */
198
+ extra_ratios?: RatioVariant[] | undefined;
199
+ }
200
+ /**
201
+ * @public
202
+ */
203
+ interface TrackItem$1 {
204
+ abs_time_position: number | undefined;
205
+ part_id: string | undefined;
206
+ }
207
+ /**
208
+ * @public
209
+ */
210
+ interface Track$1 {
211
+ id: string | undefined;
212
+ /**
213
+ * Types of parts that can be contained in tracks
214
+ * @public
215
+ */
216
+ parts_kind: PartKind$1 | undefined;
217
+ is_hidden: boolean | undefined;
218
+ items: TrackItem$1[] | undefined;
219
+ }
220
+ /**
221
+ * @public
222
+ */
223
+ interface Attachment {
224
+ part_id: string | undefined;
225
+ relative_time_position: number | undefined;
226
+ }
227
+ /**
228
+ * @public
229
+ */
230
+ interface PartAggregation {
231
+ body_part_id: string | undefined;
232
+ attachments: Attachment[] | undefined;
233
+ }
234
+ /**
235
+ * @public
236
+ */
237
+ interface BgmPart$1 {
238
+ id: string | undefined;
239
+ duration_ms: number | undefined;
240
+ /**
241
+ * Types of parts that can be contained in tracks
242
+ * @public
243
+ */
244
+ kind: PartKind$1 | undefined;
245
+ audio_storage_key: string | undefined;
246
+ volume: number | undefined;
247
+ origin_media_id: string | undefined;
248
+ }
249
+ /**
250
+ * @public
251
+ * @enum
252
+ */
253
+ declare const SpeedShiftCategory: {
254
+ /**
255
+ * Variable speed controlled by Bezier keyframes
256
+ */
257
+ readonly CURVE: 'curve';
258
+ /**
259
+ * Constant speed multiplier across the entire clip
260
+ */
261
+ readonly LINEAR: 'linear';
262
+ };
263
+ /**
264
+ * @public
265
+ */
266
+ type SpeedShiftCategory = (typeof SpeedShiftCategory)[keyof typeof SpeedShiftCategory];
267
+ /**
268
+ * @public
269
+ */
270
+ interface TangentHandle {
271
+ x: number | undefined;
272
+ y: number | undefined;
273
+ }
274
+ /**
275
+ * @public
276
+ */
277
+ interface SpeedKeyframe {
278
+ position: number | undefined;
279
+ rate: number | undefined;
280
+ in_tangent?: TangentHandle | undefined;
281
+ out_tangent?: TangentHandle | undefined;
282
+ }
283
+ /**
284
+ * @public
285
+ */
286
+ interface CurveConfig {
287
+ keyframes: SpeedKeyframe[] | undefined;
288
+ }
289
+ /**
290
+ * @public
291
+ */
292
+ interface LinearConfig {
293
+ speed: number | undefined;
294
+ }
295
+ /**
296
+ * @public
297
+ */
298
+ type SpeedShiftConfigUnion = SpeedShiftConfigUnion.CurveMember | SpeedShiftConfigUnion.LinearMember | SpeedShiftConfigUnion.$UnknownMember;
299
+ /**
300
+ * @public
301
+ */
302
+ declare namespace SpeedShiftConfigUnion {
303
+ interface LinearMember {
304
+ linear: LinearConfig;
305
+ curve?: never;
306
+ $unknown?: never;
307
+ }
308
+ interface CurveMember {
309
+ linear?: never;
310
+ curve: CurveConfig;
311
+ $unknown?: never;
312
+ }
313
+ /**
314
+ * @public
315
+ */
316
+ interface $UnknownMember {
317
+ linear?: never;
318
+ curve?: never;
319
+ $unknown: [string, any];
320
+ }
321
+ interface Visitor<T> {
322
+ linear: (value: LinearConfig) => T;
323
+ curve: (value: CurveConfig) => T;
324
+ _: (name: string, value: any) => T;
325
+ }
326
+ const visit: <T>(value: SpeedShiftConfigUnion, visitor: Visitor<T>) => T;
327
+ }
328
+ /**
329
+ * @public
330
+ */
331
+ interface SpeedShift {
332
+ category: SpeedShiftCategory | undefined;
333
+ mode: string | undefined;
334
+ config: SpeedShiftConfigUnion | undefined;
335
+ }
336
+ /**
337
+ * @public
338
+ */
339
+ interface VideoClipPart$1 {
340
+ id: string | undefined;
341
+ duration_ms: number | undefined;
342
+ /**
343
+ * Types of parts that can be contained in tracks
344
+ * @public
345
+ */
346
+ kind: PartKind$1 | undefined;
347
+ play_in: number | undefined;
348
+ play_out: number | undefined;
349
+ volume: number | undefined;
350
+ origin_media_id: string | undefined;
351
+ speed_shift?: SpeedShift | undefined;
352
+ }
353
+ /**
354
+ * @public
355
+ */
356
+ type PartUnion$1 = PartUnion$1.BgmMember | PartUnion$1.CaptionMember | PartUnion$1.SpeechMember | PartUnion$1.Video_clipMember | PartUnion$1.$UnknownMember;
357
+ /**
358
+ * @public
359
+ */
360
+ declare namespace PartUnion$1 {
361
+ interface Video_clipMember {
362
+ video_clip: VideoClipPart$1;
363
+ bgm?: never;
364
+ speech?: never;
365
+ caption?: never;
366
+ $unknown?: never;
367
+ }
368
+ interface BgmMember {
369
+ video_clip?: never;
370
+ bgm: BgmPart$1;
371
+ speech?: never;
372
+ caption?: never;
373
+ $unknown?: never;
374
+ }
375
+ interface SpeechMember {
376
+ video_clip?: never;
377
+ bgm?: never;
378
+ speech: SpeechPart$1;
379
+ caption?: never;
380
+ $unknown?: never;
381
+ }
382
+ interface CaptionMember {
383
+ video_clip?: never;
384
+ bgm?: never;
385
+ speech?: never;
386
+ caption: CaptionPart$1;
387
+ $unknown?: never;
388
+ }
389
+ /**
390
+ * @public
391
+ */
392
+ interface $UnknownMember {
393
+ video_clip?: never;
394
+ bgm?: never;
395
+ speech?: never;
396
+ caption?: never;
397
+ $unknown: [string, any];
398
+ }
399
+ interface Visitor<T> {
400
+ video_clip: (value: VideoClipPart$1) => T;
401
+ bgm: (value: BgmPart$1) => T;
402
+ speech: (value: SpeechPart$1) => T;
403
+ caption: (value: CaptionPart$1) => T;
404
+ _: (name: string, value: any) => T;
405
+ }
406
+ const visit: <T>(value: PartUnion$1, visitor: Visitor<T>) => T;
407
+ }
408
+ /**
409
+ * Timeline configuration for video editing
410
+ * @public
411
+ */
412
+ interface Timeline$1 {
413
+ duration_ms: number | undefined;
414
+ unit_time_ms: number | undefined;
415
+ }
416
+ /**
417
+ * Complete video draft information with timeline and tracks
418
+ * @public
419
+ */
420
+ interface VideoDraft$1 {
421
+ id?: string | undefined;
422
+ project_id: string | undefined;
423
+ owner_id: string | undefined;
424
+ /**
425
+ * for-code-gen: property value may be empty string ("")
426
+ * @public
427
+ */
428
+ thumbnail_storage_key: string | undefined;
429
+ /**
430
+ * Timeline configuration for video editing
431
+ * @public
432
+ */
433
+ timeline?: Timeline$1 | undefined;
434
+ video_creation_settings?: VideoCreationSettings$1 | undefined;
435
+ chat_session_id: string | undefined;
436
+ main_track?: Track$1 | undefined;
437
+ above_main_tracks: Track$1[] | undefined;
438
+ below_main_tracks: Track$1[] | undefined;
439
+ part_aggregations: PartAggregation[] | undefined;
440
+ part_library: Record<string, PartUnion$1> | undefined;
441
+ version: number | undefined;
442
+ }
443
+ //#endregion
444
+ //#region src/document/types.d.ts
445
+ declare const VIDEO_DOCUMENT_SCHEMA_VERSION: 'video-document/v0';
446
+ type VideoDocumentSchemaVersion = typeof VIDEO_DOCUMENT_SCHEMA_VERSION;
447
+ type PartKind = 'video_clip' | 'speech' | 'caption' | 'bgm';
448
+ /**
449
+ * Project-level creation settings. Mirrors the IDL, but keeps the two fields the
450
+ * upstream (Director / FE) sends as an explicit `null` nullable — the IDL models
451
+ * "absent" only as `undefined`, whereas these arrive as `null` to mean
452
+ * "explicitly cleared". Relaxing the type here avoids forcing every caller to
453
+ * map `null` → `undefined`.
454
+ */
455
+ type VideoCreationSettings = Omit<VideoCreationSettings$1, 'video_style_id' | 'duration_ms'> & {
456
+ video_style_id?: string | null | undefined;
457
+ duration_ms?: number | null | undefined;
458
+ };
459
+ /**
460
+ * Video clip part. `duration_ms` is dropped from the authoritative type
461
+ * (reference/17 §5): it is the derived effective length and is re-derived into
462
+ * the read-view by the projection. `play_in` / `play_out` are required (smithy
463
+ * `@required`), so the timeline length is always the trim window over the speed
464
+ * multiplier — no need to store the media's intrinsic length either. `speed_shift`
465
+ * is the IDL type. See `effectiveVideoClipDurationMs`.
466
+ */
467
+ type VideoClipPart = Omit<VideoClipPart$1, 'duration_ms'>;
468
+ /**
469
+ * Speech part. `duration_ms` is dropped from the authoritative type
470
+ * (reference/17 §5) in favour of the engine-only `media_duration_ms`: a speech
471
+ * cannot be trimmed or speed-shifted, so its effective timeline duration equals
472
+ * the TTS audio's intrinsic length. The read-view `duration_ms` is re-derived
473
+ * from it by the projection.
474
+ */
475
+ type SpeechPart = Omit<SpeechPart$1, 'duration_ms'> & {
476
+ media_duration_ms?: number | undefined;
477
+ };
478
+ /**
479
+ * Authoritative caption part. The IDL `CaptionPart` carries `duration_ms` (the
480
+ * effective display length, a derived read-view value); the authoritative store
481
+ * instead keeps `initial_duration_ms` — the caption's length at generation time,
482
+ * parsed from the voiceover, a resource-intrinsic fact that does not change
483
+ * (reference/17 §5; onscreen-caption plan). The effective `duration_ms` is
484
+ * re-derived into the `VideoDraft` read-view by the projection.
485
+ *
486
+ * `speech_part_id` / `start_ms` are kept as resource-intrinsic facts (which
487
+ * speech it was split from, and its offset in that source) — reference/17
488
+ * principle 4.
489
+ */
490
+ type CaptionPart = Omit<CaptionPart$1, 'duration_ms'> & {
491
+ initial_duration_ms?: number | undefined;
492
+ };
493
+ /**
494
+ * Background music. The IDL marks `duration_ms` required (via its part mixin),
495
+ * but a bgm has no authoritative duration — its effective length is always the
496
+ * whole timeline, derived on read (RFC 02 §0b). The engine therefore keeps it
497
+ * optional rather than carrying the IDL's required field into storage.
498
+ */
499
+ type BgmPart = Omit<BgmPart$1, 'duration_ms'> & {
500
+ duration_ms?: number | undefined;
501
+ };
502
+ /**
503
+ * How a `TrackItem`'s start is determined — the authoritative positioning fact
504
+ * (RFC 02 §4, reference/17 §3). The absolute time is never stored; it is solved
505
+ * by the cascade at projection time. The three modes express "where the start
506
+ * comes from": `sequential` follows the track's flow order, `anchored` hangs off
507
+ * another part plus an offset, `absolute` pins to the timeline origin.
508
+ * `anchorPartId` points at another item's `part_id` (a part is placed at most
509
+ * once per lane, so `part_id` is the placement identity).
510
+ *
511
+ * `time_position` carries only the real editing intent (mode + anchor + offset),
512
+ * so it is a single last-writer-wins unit safe to overwrite wholesale. The
513
+ * derived fallback snapshot lives outside it on `TrackItem.fallback_abs_ms`.
514
+ */
515
+ type TrackItemTimePosition = {
516
+ mode: 'sequential';
517
+ } | {
518
+ mode: 'anchored';
519
+ anchorPartId: string;
520
+ offsetMs: number;
521
+ } | {
522
+ mode: 'absolute';
523
+ offsetMs: number;
524
+ };
525
+ /**
526
+ * Authoritative track item: only facts. Absolute time is derived, not stored.
527
+ *
528
+ * `fallback_abs_ms` is the one deliberately-retained derived snapshot in
529
+ * authoritative state: the `relative` item's absolute landing, so that when its
530
+ * anchor is concurrently deleted (orphan, RFC 02 §11.1), the item can be put
531
+ * back on the timeline and re-parented to the nearest video — orphan handling
532
+ * needs an absolute anchor and cannot guess one.
533
+ *
534
+ * It is written by the write-side ops that create or move a `relative` item:
535
+ * each resolves the item's absolute landing from its anchor once (add/change
536
+ * speech from the host clip's start + offset; `moveSpeeches` from the requested
537
+ * start; §9.1 reparent from the preserved abs) and stamps it here. The read-side
538
+ * projection never writes it back — the authoritative model stays write-derived,
539
+ * not read-derived. It is a field of its own (not inside `time_position`) so the
540
+ * two are separate LWW units: a fallback refresh can never clobber a concurrent
541
+ * `offsetMs` edit, since they carry unequal business value. When the anchor's
542
+ * absolute position cannot be resolved at write time it is left undefined. Only
543
+ * meaningful for `anchored` items.
544
+ */
545
+ interface TrackItem {
546
+ part_id: string;
547
+ time_position: TrackItemTimePosition;
548
+ fallback_abs_ms?: number | undefined;
549
+ }
550
+ interface Track {
551
+ id: string | undefined;
552
+ parts_kind: PartKind | undefined;
553
+ is_hidden: boolean | undefined;
554
+ items: TrackItem[] | undefined;
555
+ }
556
+ /** The linear speed multiplier of a `speed_shift`, defaulting to 1 (original). */
557
+ declare function speedOf(speedShift: SpeedShift | undefined): number;
558
+ /**
559
+ * A video clip's effective timeline duration, derived from authoritative facts
560
+ * (RFC 02, `reference/16` §4, reference/17 §5): the trim window
561
+ * `play_out - play_in` divided by the speed multiplier, rounded to integer ms.
562
+ * `play_in` / `play_out` are optional in the IDL but every write path sets them
563
+ * (defaulting to the whole media), and the legacy-ingest projection backfills the
564
+ * window from a legacy `duration_ms` — so an authoritative clip always carries a
565
+ * trim window and there is no stored `duration_ms` to fall back to. A clip with
566
+ * neither bound yields 0. Speeds the clip up (>1× → shorter) or down (<1×).
567
+ */
568
+ declare function effectiveVideoClipDurationMs(clip: VideoClipPart): number;
569
+ /**
570
+ * Authoritative part union: a flat discriminated union over the four part kinds.
571
+ * Deliberately *not* the IDL's namespace union (no `$unknown` / `visit`): engine
572
+ * storage rejects unknown kinds, and projection / validation read parts by plain
573
+ * `part.video_clip` / `part.speech` property access, which this shape supports.
574
+ */
575
+ type PartUnion = {
576
+ video_clip: VideoClipPart;
577
+ speech?: never;
578
+ caption?: never;
579
+ bgm?: never;
580
+ } | {
581
+ video_clip?: never;
582
+ speech: SpeechPart;
583
+ caption?: never;
584
+ bgm?: never;
585
+ } | {
586
+ video_clip?: never;
587
+ speech?: never;
588
+ caption: CaptionPart;
589
+ bgm?: never;
590
+ } | {
591
+ video_clip?: never;
592
+ speech?: never;
593
+ caption?: never;
594
+ bgm: BgmPart;
595
+ };
596
+ /**
597
+ * Read-view part union for the derived `VideoDraft` (reference/17 §5/§7). The
598
+ * authoritative parts drop their derived durations; the projection re-injects an
599
+ * effective `duration_ms` for downstream compatibility — for a video clip it is
600
+ * `(play_out - play_in) / speed`, for a speech it is `media_duration_ms`, for a
601
+ * caption it is `initial_duration_ms`, for a bgm it is the timeline total. Each
602
+ * read-view part is therefore the authoritative part plus a derived `duration_ms`.
603
+ */
604
+ type VideoDraftPartUnion = {
605
+ video_clip: VideoClipPart & {
606
+ duration_ms?: number;
607
+ };
608
+ speech?: never;
609
+ caption?: never;
610
+ bgm?: never;
611
+ } | {
612
+ video_clip?: never;
613
+ speech: SpeechPart & {
614
+ duration_ms?: number;
615
+ };
616
+ caption?: never;
617
+ bgm?: never;
618
+ } | {
619
+ video_clip?: never;
620
+ speech?: never;
621
+ caption: CaptionPart & {
622
+ duration_ms?: number;
623
+ };
624
+ bgm?: never;
625
+ } | {
626
+ video_clip?: never;
627
+ speech?: never;
628
+ caption?: never;
629
+ bgm: BgmPart & {
630
+ duration_ms?: number;
631
+ };
632
+ };
633
+ /**
634
+ * Derived `VideoDraft` read-view. The shape follows the IDL verbatim except for
635
+ * `part_library`: the IDL types its parts with the generated namespace
636
+ * `PartUnion`, but the engine's projection emits `VideoDraftPartUnion` — the
637
+ * authoritative parts with the derived `duration_ms` re-injected (reference/17 §7)
638
+ * plus the engine extensions (`media_duration_ms`, the looser `SpeedShift`). This
639
+ * is the intentional superset over the IDL `VideoDraft` (see the extensions note).
640
+ */
641
+ type VideoDraft = Omit<VideoDraft$1, 'part_library' | 'video_creation_settings'> & {
642
+ part_library: Record<string, VideoDraftPartUnion> | undefined;
643
+ video_creation_settings?: VideoCreationSettings | undefined;
644
+ };
645
+ /** Authoritative timeline: `duration_ms` is derived (= longest track), not stored. */
646
+ interface Timeline {
647
+ unit_time_ms: number | undefined;
648
+ }
649
+ /**
650
+ * Project-level scalars that do not participate in track ordering. Grouped under
651
+ * `meta` because the loro-mirror `schema()` root only accepts container schemas,
652
+ * not bare scalars — so these must live inside a map container in storage. The
653
+ * domain type mirrors that storage shape 1:1 (RFC 03 §4) rather than flattening,
654
+ * keeping `VideoDocument` and the loro draft isomorphic and the mapping layer a
655
+ * near-identity. `schema_version` lives here too (it is a scalar fact).
656
+ */
657
+ interface VideoDocumentMeta {
658
+ schema_version: VideoDocumentSchemaVersion;
659
+ draft_id?: string | undefined;
660
+ project_id: VideoDraft['project_id'];
661
+ owner_id: VideoDraft['owner_id'];
662
+ thumbnail_storage_key: VideoDraft['thumbnail_storage_key'];
663
+ chat_session_id: VideoDraft['chat_session_id'];
664
+ video_creation_settings: VideoDraft['video_creation_settings'];
665
+ version: VideoDraft['version'];
666
+ }
667
+ /**
668
+ * Authoritative collaborative document: only facts. Positioning lives on each
669
+ * `TrackItem.time_position`; absolute time, `part_aggregations`, and total
670
+ * duration are derived in the `VideoDraft` projection, not stored here (RFC 02 §6).
671
+ *
672
+ * The shape mirrors the loro storage structure 1:1 (RFC 03 §4): a `meta` map of
673
+ * project scalars, plus a single ordered `tracks` list (reference/17 §4). A
674
+ * track's lane is expressed by its `parts_kind`, not by which container it lives
675
+ * in — the `main` / `above` / `below` three-pane view is reconstructed at
676
+ * projection time. Order is the list order itself, so there is no `lane` /
677
+ * `lane_order` field to diverge under concurrent edits.
678
+ */
679
+ interface VideoDocument {
680
+ meta: VideoDocumentMeta;
681
+ timeline: Timeline | undefined;
682
+ tracks: Track[] | undefined;
683
+ part_library: Record<string, PartUnion> | undefined;
684
+ }
685
+ type VideoDocumentValidationIssueCode = 'invalid_schema' | 'duplicate_track_item_identity' | 'unknown_part_kind' | 'part_kind_mismatch' | 'missing_part_reference' | 'track_kind_mismatch' | 'main_track_non_video_clip' | 'invalid_part_value' | 'invalid_speech_caption_reference' | 'invalid_position_anchor';
686
+ /**
687
+ * Issue severity (RFC 02 §11.1). `error` is a hard reject — the document is not
688
+ * a legal `VideoDocument` and must not be projected. `recoverable` marks a
689
+ * business inconsistency the projection is designed to heal on read (currently
690
+ * only a dangling `anchorPartId`: the orphan condition, recovered via the item's
691
+ * `fallback_abs_ms` snapshot + cascade reassign), so it is surfaced for
692
+ * observability but does NOT block projection. Absent `severity` means `error`.
693
+ */
694
+ type VideoDocumentValidationIssueSeverity = 'error' | 'recoverable';
695
+ interface VideoDocumentValidationIssue {
696
+ code: VideoDocumentValidationIssueCode;
697
+ path: string;
698
+ message: string;
699
+ severity?: VideoDocumentValidationIssueSeverity;
700
+ }
701
+ //#endregion
702
+ //#region src/document/projection.d.ts
703
+ /**
704
+ * Projection between the authoritative `VideoDocument` and the legacy
705
+ * `VideoDraft` read-view (RFC 02 §5/§7). Both directions live here:
706
+ *
707
+ * - `toVideoDocument` ingests a `VideoDraft`, deriving each item's `position`
708
+ * from the legacy absolute layout + aggregations; derived values (abs time,
709
+ * `part_aggregations`, total duration) are dropped.
710
+ * - `fromVideoDocument` solves a `VideoDocument` back into a `VideoDraft` via the
711
+ * timeline-core cascade, re-deriving exactly those values.
712
+ *
713
+ * Business validation lives in `validation.ts`; `fromVideoDocument` asserts a
714
+ * valid document before solving.
715
+ */
716
+ /**
717
+ * Ingest the legacy `VideoDraft` into the authoritative `VideoDocument`,
718
+ * deriving each item's `time_position` from the legacy absolute layout +
719
+ * aggregations (RFC 02 §4/§5). Absolute time, `part_aggregations`, and total
720
+ * duration are dropped — they are re-derived by the projection.
721
+ */
722
+ declare function toVideoDocument(draft: VideoDraft): VideoDocument;
723
+ /** speech/attachment part_id → its host video part_id + relative offset. */
724
+ type SpeechHostMap = Map<string, {
725
+ hostPartId: string;
726
+ offsetMs: number;
727
+ }>;
728
+ /**
729
+ * Build a speech-host map from a part_aggregations list. Used by
730
+ * `toVideoDocument` (legacy VideoDraft → VideoDocument) to recover each speech's
731
+ * host video clip and relative offset. Aggregation items with null ids are
732
+ * skipped (malformed input tolerance).
733
+ */
734
+ declare function buildSpeechHostMap(aggregations: Array<{
735
+ body_part_id?: string | null;
736
+ attachments?: Array<{
737
+ part_id?: string | null;
738
+ relative_time_position?: number | null;
739
+ }> | null;
740
+ }> | null | undefined): SpeechHostMap;
741
+ /** The derived time position + orphan-recovery snapshot for one item. */
742
+ interface DerivedItemPosition {
743
+ timePosition: TrackItemTimePosition;
744
+ /** Present only for `anchored` items (RFC 02 §11.1). */
745
+ fallbackAbsMs?: number;
746
+ }
747
+ /**
748
+ * Derive `time_position` (and `fallbackAbsMs` for anchored items) from a legacy
749
+ * absolute time + pre-built speech-host map + part library. The three-branch
750
+ * rule (RFC 02 §4/§5, reference/17 §3):
751
+ *
752
+ * 1. main-track → `sequential`
753
+ * 2. speech/attachment (part_id in speechHost) → `anchored(host, offsetMs)`
754
+ * 3. caption (part has `speech_part_id`) → `anchored(speech, start_ms)`
755
+ * 4. everything else → `absolute(abs)`
756
+ *
757
+ * `partLibrary` values may be `PartUnion | string | undefined` (draft raw
758
+ * form); only object-typed entries are inspected for `caption`.
759
+ */
760
+ declare function derivePositionFromAbs(partId: string, abs: number, isMain: boolean, speechHost: SpeechHostMap, partLibrary: Record<string, PartUnion | string | undefined>): DerivedItemPosition;
761
+ /**
762
+ * Project the authoritative `VideoDocument` back into the legacy `VideoDraft`
763
+ * read-view, solving each item's absolute position, the `part_aggregations`, and
764
+ * the total duration via the timeline-core cascade.
765
+ */
766
+ declare function fromVideoDocument(document: VideoDocument): VideoDraft;
767
+ //#endregion
768
+ //#region src/document/validation.d.ts
769
+ /**
770
+ * Business-level schema guard for `VideoDocument` (RFC 03 §9). It is the gate
771
+ * that decides whether an arbitrary value is a *legal* `VideoDocument` before it
772
+ * is written into Loro — distinct from two neighbours:
773
+ *
774
+ * - `zod-schema.ts` (`videoDocumentSchema`) checks structure/shape only; this
775
+ * file layers the business rules on top (part-kind match, reference integrity,
776
+ * `position.anchorPartId` targets, value ranges, identity uniqueness).
777
+ * - loro-mirror's own `validateSchema` (run on every `setState`) only checks the
778
+ * storage structure, never these business invariants.
779
+ *
780
+ * Projection (`projection.ts`) calls `assertValidVideoDocument` before solving a
781
+ * document into the legacy `VideoDraft`.
782
+ */
783
+ declare class VideoDocumentValidationError extends Error {
784
+ readonly issues: VideoDocumentValidationIssue[];
785
+ constructor(issues: VideoDocumentValidationIssue[]);
786
+ }
787
+ /**
788
+ * Assert the document is legal enough to project. Only `error`-severity issues
789
+ * hard-reject; `recoverable` ones (dangling anchor / orphan, RFC 02 §11.1) are
790
+ * left for the projection to heal on read and do NOT throw. Use
791
+ * `validateVideoDocument` directly to inspect recoverable issues too.
792
+ */
793
+ declare function assertValidVideoDocument(document: unknown): asserts document is VideoDocument;
794
+ declare function validateVideoDocument(document: unknown): VideoDocumentValidationIssue[];
795
+ //#endregion
796
+ //#region src/document/mirror-schema.d.ts
797
+ declare const videoDocumentMirrorSchema: import("loro-mirror").RootSchemaType<{
798
+ meta: import("loro-mirror").LoroMapSchema<{
799
+ schema_version: /*elided*/any;
800
+ draft_id: /*elided*/any;
801
+ project_id: /*elided*/any;
802
+ owner_id: /*elided*/any;
803
+ thumbnail_storage_key: /*elided*/any;
804
+ chat_session_id: /*elided*/any;
805
+ video_creation_settings: /*elided*/any;
806
+ version: /*elided*/any;
807
+ }> & {
808
+ options: {};
809
+ } & {
810
+ catchall: <C extends import("loro-mirror").SchemaType>(catchallSchema: C) => import("loro-mirror").LoroMapSchemaWithCatchall<{
811
+ schema_version: /*elided*/any;
812
+ draft_id: /*elided*/any;
813
+ project_id: /*elided*/any;
814
+ owner_id: /*elided*/any;
815
+ thumbnail_storage_key: /*elided*/any;
816
+ chat_session_id: /*elided*/any;
817
+ video_creation_settings: /*elided*/any;
818
+ version: /*elided*/any;
819
+ }, C>;
820
+ };
821
+ timeline: import("loro-mirror").LoroMapSchema<{
822
+ unit_time_ms: /*elided*/any;
823
+ }> & {
824
+ options: {};
825
+ } & {
826
+ catchall: <C extends import("loro-mirror").SchemaType>(catchallSchema: C) => import("loro-mirror").LoroMapSchemaWithCatchall<{
827
+ unit_time_ms: /*elided*/any;
828
+ }, C>;
829
+ };
830
+ tracks: import("loro-mirror").LoroMovableListSchema<import("loro-mirror").LoroMapSchema<{
831
+ id: /*elided*/any;
832
+ parts_kind: /*elided*/any;
833
+ is_hidden: /*elided*/any;
834
+ items: /*elided*/any;
835
+ }> & {
836
+ options: {};
837
+ } & {
838
+ catchall: <C extends import("loro-mirror").SchemaType>(catchallSchema: C) => import("loro-mirror").LoroMapSchemaWithCatchall<{
839
+ id: /*elided*/any;
840
+ parts_kind: /*elided*/any;
841
+ is_hidden: /*elided*/any;
842
+ items: /*elided*/any;
843
+ }, C>;
844
+ }> & {
845
+ options: {};
846
+ };
847
+ part_library: import("loro-mirror").LoroMapSchemaWithCatchall<{}, import("loro-mirror").LoroMapSchema<{
848
+ video_clip: /*elided*/any;
849
+ speech: /*elided*/any;
850
+ caption: /*elided*/any;
851
+ bgm: /*elided*/any;
852
+ }> & {
853
+ options: {};
854
+ } & {
855
+ catchall: <C extends import("loro-mirror").SchemaType>(catchallSchema: C) => import("loro-mirror").LoroMapSchemaWithCatchall<{
856
+ video_clip: /*elided*/any;
857
+ speech: /*elided*/any;
858
+ caption: /*elided*/any;
859
+ bgm: /*elided*/any;
860
+ }, C>;
861
+ }> & {
862
+ options: {};
863
+ };
864
+ }> & {
865
+ options: {};
866
+ };
867
+ type VideoDocumentMirrorSchema = typeof videoDocumentMirrorSchema;
868
+ /**
869
+ * The mutable draft an op's `transact` callback edits, inferred from the schema.
870
+ *
871
+ * `InferInputType` is the schema's *input* shape: the declared business fields
872
+ * with the `$cid` container ids (which mirror injects into its output
873
+ * `InferType`) made optional, so ops assign plain objects without supplying
874
+ * `$cid`. Deriving it from the schema keeps draft and storage in lockstep — a
875
+ * schema change is a compile error at every edit site, not a silent drift.
876
+ * Reorders within `items` still diff to real Loro `move` ops because the schema
877
+ * keys items by `part_id`.
878
+ */
879
+ type VideoDocumentDraft = InferInputType<VideoDocumentMirrorSchema>;
880
+ /** Track value as it appears in a draft. Derived from the single `tracks` movable list. */
881
+ type TrackDraft = NonNullable<NonNullable<VideoDocumentDraft['tracks']>[number]>;
882
+ /** A single track item in a draft. */
883
+ type TrackItemDraft = NonNullable<NonNullable<TrackDraft['items']>[number]>;
884
+ //#endregion
885
+ //#region src/editor/id-gen.d.ts
886
+ /**
887
+ * Part-id generation, aligned with the online ecosystem.
888
+ *
889
+ * The authoritative online producers — agent-harness (`@harness/shared`
890
+ * `genObjId`) and director.v2 (`common/obj_id.py` `gen_obj_id`) — both mint part
891
+ * ids as `` `${prefix}_${ulid()}` ``, and real captured drafts use exactly that
892
+ * shape (`clip_…` / `spe_…` / `cap_…` / `bgm_…`, each a 26-char ULID). The engine
893
+ * previously emitted `vc_<base36 timestamp><6 random>`, a different prefix AND a
894
+ * different encoding — the sole cross-repo id divergence. This module removes it
895
+ * by emitting the same `<prefix>_<ULID>` bytes.
896
+ *
897
+ * The ULID is generated inline (Crockford Base32, 48-bit time + 80-bit random)
898
+ * rather than pulling the `ulid` npm package: the randomness class matches the
899
+ * old generator (both `Math.random`-based) and it keeps `@mengine/medeo-client`
900
+ * dependency-free for a purely mechanical id string. Part ids only need to be
901
+ * unique and lexicographically time-sortable, which this satisfies.
902
+ */
903
+ /**
904
+ * Online part-id semantic prefixes. `clip` (video clip) is the only value the
905
+ * engine currently mints (see `addVideoClips`); the rest are declared so the
906
+ * type documents the shared vocabulary and guards against reintroducing the old
907
+ * `vc`/`sp`/`cp`/`bg` names. Speech/caption/bgm ids arrive pre-minted in op
908
+ * payloads, so the engine never generates them itself.
909
+ */
910
+ type PartIdPrefix = 'clip' | 'spe' | 'cap' | 'bgm' | 'ti';
911
+ declare function generatePartId(prefix: PartIdPrefix): string;
912
+ /** Injectable part-id mint; defaults to `generatePartId` on `SemanticEditor`. */
913
+ type PartIdFactory = (prefix: PartIdPrefix) => string;
914
+ //#endregion
915
+ //#region src/editor/schema-validator.d.ts
916
+ interface SnapshotReadable {
917
+ snapshot(): VideoDocument;
918
+ }
919
+ declare class ValidationError extends Error {
920
+ readonly code: string;
921
+ readonly context?: Record<string, unknown>;
922
+ constructor(code: string, message: string, context?: Record<string, unknown>);
923
+ }
924
+ declare class SchemaValidator {
925
+ validateMoveVideoClips(input: MoveVideoClipsInput, doc: SnapshotReadable): void;
926
+ validateDeleteVideoClips(input: DeleteVideoClipsInput, doc: SnapshotReadable): void;
927
+ validateAddVideoClips(input: AddVideoClipsInput, doc: SnapshotReadable): void;
928
+ validateAdjustVideoClipVolume(input: AdjustVideoClipVolumeInput, doc: SnapshotReadable): void;
929
+ validateSetVideoClipSpeedShift(input: SetVideoClipSpeedShiftInput, doc: SnapshotReadable): void;
930
+ validateReplaceVideoClipContent(input: ReplaceVideoClipContentInput, doc: SnapshotReadable): void;
931
+ validateAdjustVideoClipDuration(input: AdjustVideoClipDurationInput, doc: SnapshotReadable): void;
932
+ validateAdjustSpeechVolume(input: AdjustSpeechVolumeInput, doc: SnapshotReadable): void;
933
+ validateAdjustBgmVolume(input: AdjustBgmVolumeInput, doc: SnapshotReadable): void;
934
+ validateAddSpeeches(input: AddSpeechesInput, doc: SnapshotReadable): void;
935
+ validateChangeSpeechScript(input: ChangeSpeechScriptInput, doc: SnapshotReadable): void;
936
+ validateChangeSpeechVoice(input: ChangeSpeechVoiceInput, doc: SnapshotReadable): void;
937
+ validateDeleteSpeeches(input: DeleteSpeechesInput, doc: SnapshotReadable): void;
938
+ validateMoveSpeeches(input: MoveSpeechesInput, doc: SnapshotReadable): void;
939
+ validateSetBgm(input: SetBgmInput, _doc: SnapshotReadable): void;
940
+ validateDeleteBgm(input: DeleteBgmInput, _doc: SnapshotReadable): void;
941
+ validateSetCaptionVisibility(input: SetCaptionVisibilityInput, _doc: SnapshotReadable): void;
942
+ validateSetCaptionStyle(input: SetCaptionStyleInput, _doc: SnapshotReadable): void;
943
+ private parse;
944
+ private mainTrackIds;
945
+ /** Every caption a speech declares in `caption_ids` must be supplied in `captions`. */
946
+ private assertCaptionsOwned;
947
+ /** Each regenerated speech (re-TTS) must already exist in the document. */
948
+ private assertSpeechesExist;
949
+ /**
950
+ * Each speech's `anchor_part_id` must point at a video clip that already
951
+ * exists. A relative speech anchored to a missing clip cannot be positioned
952
+ * by the projection and has no host to recover to (RFC 02 §4/§11.1), so the
953
+ * write must be rejected rather than landing a dangling reference. (Restores
954
+ * the dangling-reference guard the old `validateMaterializedPatch` carried;
955
+ * ADR 0009.)
956
+ */
957
+ private assertAnchorsExist;
958
+ private assertPartKind;
959
+ }
960
+ //#endregion
961
+ //#region src/editor/types.d.ts
962
+ /**
963
+ * `SemanticOp` contract surface — the frozen catalogue of business write
964
+ * operations the collaborative editor recognises.
965
+ *
966
+ * This is the single source of truth; `SemanticEditor` derives its method set
967
+ * (`SemanticOpName`) from `ImplementedSemanticOpKind`, so adding a method
968
+ * without listing it here (or vice versa) is a type error.
969
+ *
970
+ * Mapping of each kind to UI Operation / agent tool / side-effect routing is
971
+ * maintained in
972
+ * `docs/projects/medeo-integration/reference/operation-semantic-matrix.md`; the
973
+ * frozen contract narrative lives in
974
+ * `docs/projects/medeo-integration/results/phase-4-semantic-op-contract.md`.
975
+ */
976
+ /**
977
+ * Operations implemented by `SemanticEditor`. FROZEN: each entry has a
978
+ * `SemanticEditor` method, a narrow zod input schema (business intent +
979
+ * materialized side-effect assets, never a document slice), and validation. The
980
+ * editor runs the timeline-core cascade in-transaction to derive every position
981
+ * (ADR 0009 — no caller-materialized layout).
982
+ *
983
+ * Effectful ops (TTS for `AddSpeeches` / `ChangeSpeechScript` /
984
+ * `ChangeSpeechVoice`, media import for `ReplaceVideoClipContent`, BGM for
985
+ * `SetBgm`) receive their stable side-effect result already materialized — the
986
+ * editor only writes the document; it never performs the side effect. See the
987
+ * side-effect payload contract in
988
+ * `docs/projects/medeo-integration/results/phase-4-side-effect-payload-contract.md`.
989
+ */
990
+ type ImplementedSemanticOpKind = 'MoveVideoClips' | 'DeleteVideoClips' | 'AddVideoClips' | 'AdjustVideoClipVolume' | 'SetVideoClipSpeedShift' | 'ReplaceVideoClipContent' | 'AdjustVideoClipDuration' | 'AddSpeeches' | 'DeleteSpeeches' | 'MoveSpeeches' | 'ChangeSpeechScript' | 'ChangeSpeechVoice' | 'AdjustSpeechVolume' | 'SetCaptionVisibility' | 'SetCaptionStyle' | 'SetBgm' | 'DeleteBgm' | 'AdjustBgmVolume';
991
+ /**
992
+ * Operations on the roadmap but NOT yet implemented by `SemanticEditor`. Empty:
993
+ * Phase 4 covers every op with a real entry point. Kept as a named type so the
994
+ * contract surface stays explicit and re-expanding the roadmap is a typed edit.
995
+ * To re-add planned kinds, list them here and add them back to the
996
+ * `SemanticOpKind` union below.
997
+ */
998
+ type PlannedSemanticOpKind = never;
999
+ /**
1000
+ * Every SemanticOp kind. Currently equals `ImplementedSemanticOpKind` because
1001
+ * `PlannedSemanticOpKind` is empty; re-add `| PlannedSemanticOpKind` when the
1002
+ * roadmap is re-expanded.
1003
+ */
1004
+ type SemanticOpKind = ImplementedSemanticOpKind;
1005
+ /** Runtime list of the frozen, implemented kinds (for guards / introspection). */
1006
+ declare const IMPLEMENTED_SEMANTIC_OP_KINDS: readonly ImplementedSemanticOpKind[];
1007
+ declare function isImplementedSemanticOpKind(kind: string): kind is ImplementedSemanticOpKind;
1008
+ //#endregion
1009
+ //#region src/editor/semantic-editor.d.ts
1010
+ interface CommitOptions {
1011
+ /**
1012
+ * Caller-supplied intent attached to the op's audit message.
1013
+ *
1014
+ * Typed as `unknown` to match `TransactAudit.intent`. The wire (real
1015
+ * mengine-server and the in-memory test double) only surfaces **string**
1016
+ * intents onto the audit log — non-string values stay in the Loro commit
1017
+ * message but parse to `null`. Agent callers should pass a string.
1018
+ */
1019
+ intent?: unknown;
1020
+ }
1021
+ type SemanticOpInput = MoveVideoClipsInput | DeleteVideoClipsInput | AddVideoClipsInput | AdjustVideoClipVolumeInput | AdjustSpeechVolumeInput | AdjustBgmVolumeInput | SetVideoClipSpeedShiftInput | ReplaceVideoClipContentInput | AdjustVideoClipDurationInput | AddSpeechesInput | DeleteSpeechesInput | MoveSpeechesInput | SetCaptionVisibilityInput | SetCaptionStyleInput | SetBgmInput | DeleteBgmInput;
1022
+ type SemanticOpName = ImplementedSemanticOpKind;
1023
+ /** Audit metadata committed alongside an op's writes. */
1024
+ interface TransactAudit {
1025
+ kind: SemanticOpName;
1026
+ payload: unknown;
1027
+ intent?: unknown;
1028
+ }
1029
+ /**
1030
+ * Narrow write surface the `SemanticEditor` drives (ADR 0008 / 0009). It stays
1031
+ * off raw Loro: every op runs its document mutations inside a single `transact`
1032
+ * callback, which the storage adapter applies as one CRDT transaction + commit
1033
+ * carrying the audit message.
1034
+ *
1035
+ * The callback edits a `VideoDocumentDraft` — an immer draft of the whole
1036
+ * document state. A throw inside it discards the draft and never touches Loro,
1037
+ * so partial writes roll back naturally (no `commit`/`rollback` machinery). The
1038
+ * adapter's declarative diff turns the edited draft into minimal CRDT ops,
1039
+ * including real `move`s for reordered track items (keyed by `part_id`), so
1040
+ * per-item identity survives on every lane.
1041
+ *
1042
+ * Each op takes a narrow business input (intent + materialized side-effect
1043
+ * assets, never a document slice); the editor applies the authoritative facts
1044
+ * and runs the timeline-core cascade inside the callback to derive every
1045
+ * position. The caller never materializes a layout (ADR 0009).
1046
+ */
1047
+ interface SemanticDocumentAdapter extends SnapshotReadable {
1048
+ /** True once the document holds real content (a bootstrapped/synced snapshot). */
1049
+ hasContent(): boolean;
1050
+ /**
1051
+ * Apply one op's whole mutation in a single transaction. `edit` mutates the
1052
+ * document draft; the adapter diffs the result and commits once with `audit`.
1053
+ * A throw in `edit` rolls back (the draft is discarded, Loro untouched). An
1054
+ * edit that changes nothing produces no commit (no phantom audit entry).
1055
+ */
1056
+ transact(edit: (draft: VideoDocumentDraft) => void, audit: TransactAudit): void;
1057
+ }
1058
+ declare class SemanticEditor {
1059
+ private readonly doc;
1060
+ private readonly validator;
1061
+ private readonly idFactory;
1062
+ constructor(doc: SemanticDocumentAdapter, validator?: SchemaValidator, idFactory?: PartIdFactory);
1063
+ moveVideoClips(input: MoveVideoClipsInput, options?: CommitOptions): Promise<void>;
1064
+ deleteVideoClips(input: DeleteVideoClipsInput, options?: CommitOptions): Promise<void>;
1065
+ addVideoClips(input: AddVideoClipsInput, options?: CommitOptions): Promise<void>;
1066
+ adjustVideoClipVolume(input: AdjustVideoClipVolumeInput, options?: CommitOptions): Promise<void>;
1067
+ setVideoClipSpeedShift(input: SetVideoClipSpeedShiftInput, options?: CommitOptions): Promise<void>;
1068
+ adjustSpeechVolume(input: AdjustSpeechVolumeInput, options?: CommitOptions): Promise<void>;
1069
+ adjustBgmVolume(input: AdjustBgmVolumeInput, options?: CommitOptions): Promise<void>;
1070
+ /**
1071
+ * Replace the media backing existing video clips. The new media's stable
1072
+ * result (new media id, intrinsic length, reset trim window) is materialized
1073
+ * upstream; the clip ids and their track items are unchanged. Only the part
1074
+ * facts change — effective duration and downstream positions are derived by
1075
+ * the projection on read.
1076
+ */
1077
+ replaceVideoClipContent(input: ReplaceVideoClipContentInput, options?: CommitOptions): Promise<void>;
1078
+ /**
1079
+ * Re-trim clips. Only the `play_in` / `play_out` facts change; the new
1080
+ * effective duration and the resulting downstream reflow are derived by the
1081
+ * projection on read (anchored speeches follow their host clip automatically).
1082
+ */
1083
+ adjustVideoClipDuration(input: AdjustVideoClipDurationInput, options?: CommitOptions): Promise<void>;
1084
+ /**
1085
+ * Add speeches (and their captions). TTS runs upstream; the materialized
1086
+ * speech / caption parts arrive in `input`, each carrying its host clip
1087
+ * `anchor_part_id` + `offset_ms`. The editor writes the parts and their
1088
+ * `anchored` `time_position` facts verbatim — no write-time host-picking, no
1089
+ * cascade. The projection derives absolute positions on read.
1090
+ */
1091
+ addSpeeches(input: AddSpeechesInput, options?: CommitOptions): Promise<void>;
1092
+ /** Delete speeches with their captions; the subtree is removed (§9.2). Surviving lanes keep their facts. */
1093
+ deleteSpeeches(input: DeleteSpeechesInput, options?: CommitOptions): Promise<void>;
1094
+ /**
1095
+ * Move speeches in time (§9.1). One forward positioning pass: anchor each
1096
+ * speech to the main-track clip its new absolute start lands in and write the
1097
+ * resulting `anchored` `time_position` fact. No cascade — the projection
1098
+ * derives absolute positions on read.
1099
+ */
1100
+ moveSpeeches(input: MoveSpeechesInput, options?: CommitOptions): Promise<void>;
1101
+ /** Change a speech's script. Re-TTS runs upstream; the regenerated parts arrive materialized (no cascade). */
1102
+ changeSpeechScript(input: ChangeSpeechScriptInput, options?: CommitOptions): Promise<void>;
1103
+ /** Change a speech's voice. Re-TTS runs upstream; the regenerated parts arrive materialized (no cascade). */
1104
+ changeSpeechVoice(input: ChangeSpeechVoiceInput, options?: CommitOptions): Promise<void>;
1105
+ /**
1106
+ * Set the document BGM. The media's stable result arrives materialized.
1107
+ *
1108
+ * KNOWN GAP (non-blocking): when the BGM comes from the public library, the
1109
+ * Director must also register project-level stock media ownership. That is a
1110
+ * separate "register-only, no draft write" side effect Director does not yet
1111
+ * expose; until it does, a public-library BGM set here will not auto-appear in
1112
+ * the project media library. The document edit itself is complete and correct.
1113
+ * See `docs/projects/medeo-integration/results/phase-4-op-side-effect-classification.md`.
1114
+ */
1115
+ setBgm(input: SetBgmInput, options?: CommitOptions): Promise<void>;
1116
+ /** Remove the document BGM; clears the bgm lane and removes the part. */
1117
+ deleteBgm(input: DeleteBgmInput, options?: CommitOptions): Promise<void>;
1118
+ /** Toggle caption visibility (caption track `is_hidden`). */
1119
+ setCaptionVisibility(input: SetCaptionVisibilityInput, options?: CommitOptions): Promise<void>;
1120
+ /**
1121
+ * Set the document-wide caption style. GLOBAL (no `caption_id`): the patch is
1122
+ * merged onto EVERY caption part's `style`, mirroring the FE, which applies a
1123
+ * single style to all captions (`caption-style.ts:persistCaptionStylePatch`).
1124
+ *
1125
+ * Merge, not replace: only the fields present in the input overwrite the
1126
+ * caption's existing style; absent fields are carried forward. So a partial
1127
+ * patch ("recolor only") keeps the caption's font size. Pure document edit, no
1128
+ * cascade — positions are untouched.
1129
+ */
1130
+ setCaptionStyle(input: SetCaptionStyleInput, options?: CommitOptions): Promise<void>;
1131
+ /**
1132
+ * Resolve the main-track sequential layout from `source`. Callers inside a
1133
+ * `transact` MUST pass the live `draft` so item order reflects in-progress
1134
+ * mutations; the default `this.doc.snapshot()` is only committed state and is
1135
+ * correct for read-only callers outside a transaction. `readMainTrackItems` /
1136
+ * `readPartDurationMs` accept both an immer draft and a raw snapshot.
1137
+ */
1138
+ private computeMainTrackLayout;
1139
+ private indexForStartMs;
1140
+ private computeAddInsertIndex;
1141
+ }
1142
+ //#endregion
1143
+ //#region src/document/mirror-adapter.d.ts
1144
+ interface MirrorVideoDocumentOptions {
1145
+ peerId?: PeerID;
1146
+ origin?: string;
1147
+ }
1148
+ /**
1149
+ * Storage-layer adapter that backs a `VideoDocument` with `loro-mirror` (ADR
1150
+ * 0008). The mirror holds an in-memory immutable state synced to the `LoroDoc`
1151
+ * by declarative diff, replacing the hand-rolled `@mengine/schema` adapter:
1152
+ *
1153
+ * - `snapshot()` projects the mirror's in-memory state to the read model — no
1154
+ * per-call `toJSON()` FFI rebuild.
1155
+ * - `transact(edit, audit)` runs the whole op in one `mirror.setState` callback:
1156
+ * one diff, one `doc.commit` carrying the audit message. The callback edits an
1157
+ * immer draft, so a throw inside it discards the draft and never touches Loro
1158
+ * (natural rollback) — no `guard` / `rollback` / `openTransaction` machinery.
1159
+ * - mirror's `idSelector` (track items keyed by `part_id`) diffs reorders to
1160
+ * real Loro `move` ops on every lane, so per-item CRDT identity survives on
1161
+ * main and secondary tracks alike.
1162
+ */
1163
+ declare class MirrorVideoDocumentAdapter implements SemanticDocumentAdapter {
1164
+ readonly doc: LoroDoc;
1165
+ private readonly mirror;
1166
+ constructor(doc: LoroDoc);
1167
+ snapshot(): VideoDocument;
1168
+ /**
1169
+ * True once the doc holds real document content. A fresh mirror over an empty
1170
+ * doc still reports defaulted root maps, so probe the stored `schema_version`
1171
+ * (empty until a snapshot is bootstrapped or synced in).
1172
+ */
1173
+ hasContent(): boolean;
1174
+ /**
1175
+ * Apply one op as a single transaction. `edit` mutates the immer draft; mirror
1176
+ * diffs the result and commits once with the audit `message`. A throw in `edit`
1177
+ * discards the draft (Loro untouched). When `edit` produces no change, mirror
1178
+ * skips the commit — matching the prior "empty op leaves no audit" behavior.
1179
+ */
1180
+ transact(edit: (draft: VideoDocumentDraft) => void, audit: TransactAudit): void;
1181
+ }
1182
+ /** Build a fresh Loro doc seeded with `document` through the mirror. */
1183
+ declare function createMirrorVideoDocument(document: VideoDocument, options?: MirrorVideoDocumentOptions): LoroDoc;
1184
+ /** Build a `MirrorVideoDocumentAdapter` over a fresh doc seeded with `document`. */
1185
+ declare function createMirrorVideoDocumentAdapter(document: VideoDocument, options?: MirrorVideoDocumentOptions): MirrorVideoDocumentAdapter;
1186
+ /** Write a whole `VideoDocument` into a draft (seed a fresh doc / plain-memory state). */
1187
+ declare function writeVideoDocumentToDraft(draft: VideoDocumentDraft, document: VideoDocument): void;
1188
+ //#endregion
1189
+ //#region src/document/plain-memory-adapter.d.ts
1190
+ /**
1191
+ * A `TransactAudit` widened with the ordered ids minted during that transact.
1192
+ * `generated_ids` is empty when the op never called the id factory.
1193
+ */
1194
+ interface JournalEntry extends TransactAudit {
1195
+ /** Ids produced by the adapter's id factory during this transact, in mint order. */
1196
+ generated_ids: string[];
1197
+ }
1198
+ interface PlainMemoryAdapterOptions {
1199
+ /** Underlying id mint; wrapped so each call inside a transact is journaled. */
1200
+ idFactory?: PartIdFactory;
1201
+ }
1202
+ /**
1203
+ * Pure in-memory `SemanticDocumentAdapter` — no Loro/WASM. Holds a
1204
+ * `VideoDocumentDraft` object and applies each `transact` via immer `produce`,
1205
+ * journaling every audit that actually mutated state (plus any ids minted
1206
+ * during that transact).
1207
+ *
1208
+ * Known benign difference vs `MirrorVideoDocumentAdapter`: the editor's
1209
+ * `setPart` assigns a fresh part object on every call, so a same-value rewrite
1210
+ * produces a new immer state and IS journaled here, while the mirror's deep
1211
+ * diff emits no commit. Terminal `snapshot()` stays equal; replay is idempotent.
1212
+ */
1213
+ declare class PlainMemoryAdapter implements SemanticDocumentAdapter {
1214
+ private state;
1215
+ private readonly _journal;
1216
+ private readonly baseIdFactory;
1217
+ /** Non-null only while a `transact` edit callback is running. */
1218
+ private pendingIds;
1219
+ /**
1220
+ * Recording wrapper around the underlying factory. Callers (sandbox editor)
1221
+ * use this so every minted id is appended to the current transact's list.
1222
+ */
1223
+ readonly idFactory: PartIdFactory;
1224
+ constructor(document: VideoDocument, options?: PlainMemoryAdapterOptions);
1225
+ get journal(): readonly JournalEntry[];
1226
+ hasContent(): boolean;
1227
+ snapshot(): VideoDocument;
1228
+ /**
1229
+ * Apply one op via immer. A throw in `edit` discards the draft (state and
1230
+ * journal unchanged). When `produce` returns the same reference, there was
1231
+ * no structural change — skip journal, matching mirror "no change, no commit".
1232
+ */
1233
+ transact(edit: (draft: VideoDocumentDraft) => void, audit: TransactAudit): void;
1234
+ }
1235
+ /** Build a `PlainMemoryAdapter` seeded with `document`. */
1236
+ declare function createPlainMemoryAdapter(document: VideoDocument, options?: PlainMemoryAdapterOptions): PlainMemoryAdapter;
1237
+ //#endregion
1238
+ //#region src/document/mirror-read.d.ts
1239
+ /**
1240
+ * Project the mirror state (`VideoDocumentDraft`) into the authoritative
1241
+ * `VideoDocument`. The storage shape is isomorphic to the domain shape (RFC 03
1242
+ * §4, reference/17 §4: meta map + a single `tracks` list + part_library), so this
1243
+ * is a near-identity — it reads `time_position` / `fallback_abs_ms` JSON blobs
1244
+ * back into structured values and trims empty strings, nothing more.
1245
+ *
1246
+ * It maps only authoritative facts (RFC 02 §6): `part_id` + `time_position`. The
1247
+ * projection-derived `VideoDraft` read-view (absolute time, `part_aggregations`,
1248
+ * total duration) is solved separately by the cascade, not here.
1249
+ *
1250
+ * It reads in-memory mirror state (O(n) over the document), not a Loro
1251
+ * `toJSON()` FFI rebuild — the cost the prior schema adapter paid on every
1252
+ * `snapshot()`.
1253
+ */
1254
+ declare function readVideoDocumentFromDraft(draft: VideoDocumentDraft): VideoDocument;
1255
+ //#endregion
1256
+ //#region src/document/zod-schema.d.ts
1257
+ declare const partUnionSchema: z.ZodUnion<readonly [z.ZodObject<{
1258
+ video_clip: z.ZodObject<{
1259
+ id: z.ZodOptional<z.ZodString>;
1260
+ kind: z.ZodLiteral<"video_clip">;
1261
+ duration_ms: z.ZodOptional<z.ZodNumber>;
1262
+ play_in: z.ZodNumber;
1263
+ play_out: z.ZodNumber;
1264
+ volume: z.ZodNumber;
1265
+ origin_media_id: z.ZodString;
1266
+ speed_shift: z.ZodOptional<z.ZodObject<{
1267
+ category: z.ZodOptional<z.ZodString>;
1268
+ mode: z.ZodOptional<z.ZodString>;
1269
+ config: z.ZodOptional<z.ZodObject<{
1270
+ linear: z.ZodOptional<z.ZodObject<{
1271
+ speed: z.ZodOptional<z.ZodNumber>;
1272
+ }, z.core.$loose>>;
1273
+ }, z.core.$loose>>;
1274
+ }, z.core.$loose>>;
1275
+ }, z.core.$loose>;
1276
+ }, z.core.$loose>, z.ZodObject<{
1277
+ speech: z.ZodObject<{
1278
+ id: z.ZodOptional<z.ZodString>;
1279
+ kind: z.ZodLiteral<"speech">;
1280
+ media_duration_ms: z.ZodNumber;
1281
+ duration_ms: z.ZodOptional<z.ZodNumber>;
1282
+ audio_script: z.ZodString;
1283
+ volume: z.ZodNumber;
1284
+ audio_storage_key: z.ZodString;
1285
+ origin_speech_id: z.ZodString;
1286
+ voice: z.ZodUnknown;
1287
+ caption_ids: z.ZodArray<z.ZodString>;
1288
+ }, z.core.$loose>;
1289
+ }, z.core.$loose>, z.ZodObject<{
1290
+ caption: z.ZodObject<{
1291
+ id: z.ZodOptional<z.ZodString>;
1292
+ kind: z.ZodLiteral<"caption">;
1293
+ initial_duration_ms: z.ZodNumber;
1294
+ speech_part_id: z.ZodString;
1295
+ text: z.ZodString;
1296
+ start_ms: z.ZodNumber;
1297
+ style: z.ZodOptional<z.ZodObject<{
1298
+ font_id: z.ZodOptional<z.ZodString>;
1299
+ font_size: z.ZodOptional<z.ZodNumber>;
1300
+ font_color: z.ZodOptional<z.ZodString>;
1301
+ font_weight: z.ZodOptional<z.ZodNumber>;
1302
+ entrance_animation: z.ZodOptional<z.ZodString>;
1303
+ entrance_animation_duration_ms: z.ZodOptional<z.ZodNumber>;
1304
+ stroke_color: z.ZodOptional<z.ZodString>;
1305
+ stroke_width: z.ZodOptional<z.ZodNumber>;
1306
+ position_x: z.ZodOptional<z.ZodNumber>;
1307
+ position_y: z.ZodOptional<z.ZodNumber>;
1308
+ }, z.core.$loose>>;
1309
+ }, z.core.$loose>;
1310
+ }, z.core.$loose>, z.ZodObject<{
1311
+ bgm: z.ZodObject<{
1312
+ id: z.ZodOptional<z.ZodString>;
1313
+ kind: z.ZodLiteral<"bgm">;
1314
+ audio_storage_key: z.ZodString;
1315
+ volume: z.ZodNumber;
1316
+ origin_media_id: z.ZodString;
1317
+ }, z.core.$loose>;
1318
+ }, z.core.$loose>]>;
1319
+ declare const videoDocumentSchema: z.ZodObject<{
1320
+ meta: z.ZodObject<{
1321
+ schema_version: z.ZodLiteral<"video-document/v0">;
1322
+ draft_id: z.ZodOptional<z.ZodString>;
1323
+ project_id: z.ZodOptional<z.ZodString>;
1324
+ owner_id: z.ZodOptional<z.ZodString>;
1325
+ thumbnail_storage_key: z.ZodOptional<z.ZodString>;
1326
+ chat_session_id: z.ZodOptional<z.ZodString>;
1327
+ video_creation_settings: z.ZodOptional<z.ZodUnknown>;
1328
+ version: z.ZodOptional<z.ZodNumber>;
1329
+ }, z.core.$loose>;
1330
+ timeline: z.ZodOptional<z.ZodObject<{
1331
+ unit_time_ms: z.ZodOptional<z.ZodNumber>;
1332
+ }, z.core.$loose>>;
1333
+ tracks: z.ZodOptional<z.ZodArray<z.ZodObject<{
1334
+ id: z.ZodOptional<z.ZodString>;
1335
+ parts_kind: z.ZodOptional<z.ZodEnum<{
1336
+ bgm: "bgm";
1337
+ caption: "caption";
1338
+ speech: "speech";
1339
+ video_clip: "video_clip";
1340
+ }>>;
1341
+ is_hidden: z.ZodOptional<z.ZodBoolean>;
1342
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
1343
+ part_id: z.ZodString;
1344
+ time_position: z.ZodDiscriminatedUnion<[z.ZodObject<{
1345
+ mode: z.ZodLiteral<"sequential">;
1346
+ }, z.core.$loose>, z.ZodObject<{
1347
+ mode: z.ZodLiteral<"anchored">;
1348
+ anchorPartId: z.ZodString;
1349
+ offsetMs: z.ZodNumber;
1350
+ }, z.core.$loose>, z.ZodObject<{
1351
+ mode: z.ZodLiteral<"absolute">;
1352
+ offsetMs: z.ZodNumber;
1353
+ }, z.core.$loose>], "mode">;
1354
+ fallback_abs_ms: z.ZodOptional<z.ZodNumber>;
1355
+ }, z.core.$loose>>>;
1356
+ }, z.core.$loose>>>;
1357
+ part_library: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
1358
+ video_clip: z.ZodObject<{
1359
+ id: z.ZodOptional<z.ZodString>;
1360
+ kind: z.ZodLiteral<"video_clip">;
1361
+ duration_ms: z.ZodOptional<z.ZodNumber>;
1362
+ play_in: z.ZodNumber;
1363
+ play_out: z.ZodNumber;
1364
+ volume: z.ZodNumber;
1365
+ origin_media_id: z.ZodString;
1366
+ speed_shift: z.ZodOptional<z.ZodObject<{
1367
+ category: z.ZodOptional<z.ZodString>;
1368
+ mode: z.ZodOptional<z.ZodString>;
1369
+ config: z.ZodOptional<z.ZodObject<{
1370
+ linear: z.ZodOptional<z.ZodObject<{
1371
+ speed: z.ZodOptional<z.ZodNumber>;
1372
+ }, z.core.$loose>>;
1373
+ }, z.core.$loose>>;
1374
+ }, z.core.$loose>>;
1375
+ }, z.core.$loose>;
1376
+ }, z.core.$loose>, z.ZodObject<{
1377
+ speech: z.ZodObject<{
1378
+ id: z.ZodOptional<z.ZodString>;
1379
+ kind: z.ZodLiteral<"speech">;
1380
+ media_duration_ms: z.ZodNumber;
1381
+ duration_ms: z.ZodOptional<z.ZodNumber>;
1382
+ audio_script: z.ZodString;
1383
+ volume: z.ZodNumber;
1384
+ audio_storage_key: z.ZodString;
1385
+ origin_speech_id: z.ZodString;
1386
+ voice: z.ZodUnknown;
1387
+ caption_ids: z.ZodArray<z.ZodString>;
1388
+ }, z.core.$loose>;
1389
+ }, z.core.$loose>, z.ZodObject<{
1390
+ caption: z.ZodObject<{
1391
+ id: z.ZodOptional<z.ZodString>;
1392
+ kind: z.ZodLiteral<"caption">;
1393
+ initial_duration_ms: z.ZodNumber;
1394
+ speech_part_id: z.ZodString;
1395
+ text: z.ZodString;
1396
+ start_ms: z.ZodNumber;
1397
+ style: z.ZodOptional<z.ZodObject<{
1398
+ font_id: z.ZodOptional<z.ZodString>;
1399
+ font_size: z.ZodOptional<z.ZodNumber>;
1400
+ font_color: z.ZodOptional<z.ZodString>;
1401
+ font_weight: z.ZodOptional<z.ZodNumber>;
1402
+ entrance_animation: z.ZodOptional<z.ZodString>;
1403
+ entrance_animation_duration_ms: z.ZodOptional<z.ZodNumber>;
1404
+ stroke_color: z.ZodOptional<z.ZodString>;
1405
+ stroke_width: z.ZodOptional<z.ZodNumber>;
1406
+ position_x: z.ZodOptional<z.ZodNumber>;
1407
+ position_y: z.ZodOptional<z.ZodNumber>;
1408
+ }, z.core.$loose>>;
1409
+ }, z.core.$loose>;
1410
+ }, z.core.$loose>, z.ZodObject<{
1411
+ bgm: z.ZodObject<{
1412
+ id: z.ZodOptional<z.ZodString>;
1413
+ kind: z.ZodLiteral<"bgm">;
1414
+ audio_storage_key: z.ZodString;
1415
+ volume: z.ZodNumber;
1416
+ origin_media_id: z.ZodString;
1417
+ }, z.core.$loose>;
1418
+ }, z.core.$loose>]>>>;
1419
+ }, z.core.$loose>;
1420
+ //#endregion
1421
+ export { VideoClipPart as $, TrackItemDraft as A, derivePositionFromAbs as B, isImplementedSemanticOpKind as C, PartIdFactory as D, ValidationError as E, assertValidVideoDocument as F, PartKind as G, toVideoDocument as H, validateVideoDocument as I, Timeline as J, PartUnion as K, DerivedItemPosition as L, VideoDocumentMirrorSchema as M, videoDocumentMirrorSchema as N, generatePartId as O, VideoDocumentValidationError as P, VIDEO_DOCUMENT_SCHEMA_VERSION as Q, SpeechHostMap as R, SemanticOpKind as S, SnapshotReadable as T, BgmPart as U, fromVideoDocument as V, CaptionPart as W, TrackItem as X, Track as Y, TrackItemTimePosition as Z, SemanticOpName as _, PlainMemoryAdapter as a, effectiveVideoClipDurationMs as at, ImplementedSemanticOpKind as b, MirrorVideoDocumentAdapter as c, CaptionPart$1 as ct, createMirrorVideoDocumentAdapter as d, SpeedShift as dt, VideoDocument as et, writeVideoDocumentToDraft as f, Timeline$1 as ft, SemanticOpInput as g, SemanticEditor as h, JournalEntry as i, VideoDraft as it, VideoDocumentDraft as j, TrackDraft as k, MirrorVideoDocumentOptions as l, CaptionStyle as lt, SemanticDocumentAdapter as m, TrackItem$1 as mt, videoDocumentSchema as n, VideoDocumentValidationIssue as nt, PlainMemoryAdapterOptions as o, speedOf as ot, CommitOptions as p, Track$1 as pt, SpeechPart as q, readVideoDocumentFromDraft as r, VideoDocumentValidationIssueCode as rt, createPlainMemoryAdapter as s, Attachment as st, partUnionSchema as t, VideoDocumentSchemaVersion as tt, createMirrorVideoDocument as u, PartAggregation as ut, TransactAudit as v, SchemaValidator as w, PlannedSemanticOpKind as x, IMPLEMENTED_SEMANTIC_OP_KINDS as y, buildSpeechHostMap as z };