@mengine/medeo-client 0.1.3 → 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.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { InferInputType } from "loro-mirror";
2
- import { z } from "zod";
3
- import { LoroDoc, PeerID } from "loro-crdt";
1
+ import { t as index_d_exports } from "./index-6e5cbdM3.js";
2
+ import { $ as VideoClipPart, A as TrackItemDraft, B as derivePositionFromAbs, C as isImplementedSemanticOpKind, D as PartIdFactory, E as ValidationError, F as assertValidVideoDocument, G as PartKind, H as toVideoDocument, I as validateVideoDocument, J as Timeline, K as PartUnion, L as DerivedItemPosition, M as VideoDocumentMirrorSchema, N as videoDocumentMirrorSchema, O as generatePartId, P as VideoDocumentValidationError, Q as VIDEO_DOCUMENT_SCHEMA_VERSION, R as SpeechHostMap, S as SemanticOpKind, T as SnapshotReadable, U as BgmPart, V as fromVideoDocument, W as CaptionPart, X as TrackItem, Y as Track, Z as TrackItemTimePosition, _ as SemanticOpName, a as PlainMemoryAdapter, at as effectiveVideoClipDurationMs, b as ImplementedSemanticOpKind, c as MirrorVideoDocumentAdapter, ct as CaptionPart$1, d as createMirrorVideoDocumentAdapter, dt as SpeedShift, et as VideoDocument, f as writeVideoDocumentToDraft, ft as Timeline$1, g as SemanticOpInput, h as SemanticEditor, i as JournalEntry, it as VideoDraft, j as VideoDocumentDraft, k as TrackDraft, l as MirrorVideoDocumentOptions, lt as CaptionStyle, m as SemanticDocumentAdapter, mt as TrackItem$1, n as videoDocumentSchema, nt as VideoDocumentValidationIssue, o as PlainMemoryAdapterOptions, ot as speedOf, p as CommitOptions, pt as Track$1, q as SpeechPart, r as readVideoDocumentFromDraft, rt as VideoDocumentValidationIssueCode, s as createPlainMemoryAdapter, st as Attachment, t as partUnionSchema, tt as VideoDocumentSchemaVersion, u as createMirrorVideoDocument, ut as PartAggregation, v as TransactAudit, w as SchemaValidator, x as PlannedSemanticOpKind, y as IMPLEMENTED_SEMANTIC_OP_KINDS, z as buildSpeechHostMap } from "./index-DRUGsbm2.js";
3
+ import { PeerID } from "loro-crdt";
4
4
  import { DocState } from "@mengine/sync";
5
5
  import { BaseDocStorage, Connection, DocDiff, DocSnapshotRecord, DocStorage, DocStorageOptions, DocUpdate, DocUpdateRecord } from "@mengine/storage";
6
6
 
@@ -131,1820 +131,23 @@ interface MengineEventStreamOptions {
131
131
  }
132
132
  declare function readMengineEventStream(options: MengineEventStreamOptions): Promise<void>;
133
133
  //#endregion
134
- //#region src/document/generated/video-draft-idl.d.ts
134
+ //#region src/editor/journal.d.ts
135
135
  /**
136
- * @generated by @mengine/idl-codegen DO NOT EDIT MANUALLY.
137
- *
138
- * VideoDraft read-view types extracted from the Smithy IDL
139
- * (medeo-v2-design-materials). Re-run `vp run @mengine/idl-codegen#sync`.
140
- * Source IDL commit: 902e82e3fec1e94b36e14ef671de91abd210dc86
141
- *
142
- * WHY EVERY FIELD IS `T | undefined`:
143
- * AWS `smithy-typescript-codegen` widens every structure member to
144
- * `T | undefined` regardless of the Smithy `@required` trait — it favours
145
- * deserialization robustness (a peer may omit a field on the wire) over
146
- * encoding requiredness in the static type. So these generated types are NOT
147
- * the source of truth for which fields are required: the Smithy `.smithy`
148
- * model is. Many fields here (e.g. `VideoClipPart.play_in` / `play_out` /
149
- * `volume` / `origin_media_id`) are `@required` in the contract.
150
- *
151
- * Requiredness is restored at the write-time gate, not here: see the part
152
- * schemas in `../zod-schema.ts`, which re-mark the `@required` fields as
153
- * mandatory before a VideoDocument is committed to Loro. Do not assume a
154
- * field is optional just because its type is `| undefined`.
155
- */
156
- /**
157
- * @public
158
- * @enum
159
- */
160
- declare const PartKind$1: {
161
- readonly BGM: 'bgm';
162
- readonly CAPTION: 'caption';
163
- readonly SPEECH: 'speech';
164
- readonly VIDEO_CLIP: 'video_clip';
165
- };
166
- /**
167
- * @public
168
- */
169
- type PartKind$1 = (typeof PartKind$1)[keyof typeof PartKind$1];
170
- /**
171
- * @public
136
+ * Wire a plain-memory adapter + editor that share a recording id factory, so
137
+ * every mutating transact lands in `journal` with ordered `generated_ids`.
172
138
  */
173
- interface VoiceSummary {
174
- name: string | undefined;
175
- id: string | undefined;
176
- }
177
- /**
178
- * @public
179
- */
180
- interface SpeechPart$1 {
181
- id: string | undefined;
182
- duration_ms: number | undefined;
183
- /**
184
- * Types of parts that can be contained in tracks
185
- * @public
186
- */
187
- kind: PartKind$1 | undefined;
188
- audio_script: string | undefined;
189
- volume: number | undefined;
190
- audio_storage_key: string | undefined;
191
- origin_speech_id: string | undefined;
192
- voice: VoiceSummary | undefined;
193
- caption_ids: string[] | undefined;
194
- }
195
- /**
196
- * Caption visual style configuration
197
- * @public
198
- */
199
- interface CaptionStyle {
200
- /**
201
- * Font ID referencing a font from the font library. Defaults to system font if not provided
202
- * @public
203
- */
204
- font_id?: string | undefined;
205
- /**
206
- * Font size in points
207
- * @public
208
- */
209
- font_size?: number | undefined;
210
- /**
211
- * Font color as hex string (e.g. "#FFFFFF")
212
- * @public
213
- */
214
- font_color?: string | undefined;
215
- /**
216
- * Numeric font weight, e.g. 400 for regular or 700 for bold
217
- * @public
218
- */
219
- font_weight?: number | undefined;
220
- /**
221
- * Caption entrance animation preset ID, e.g. "fade", "slideUp", or "none"
222
- * @public
223
- */
224
- entrance_animation?: string | undefined;
225
- /**
226
- * Caption entrance animation duration in milliseconds
227
- * @public
228
- */
229
- entrance_animation_duration_ms?: number | undefined;
230
- /**
231
- * Caption outline/stroke color as hex string (e.g. "#000000")
232
- * @public
233
- */
234
- stroke_color?: string | undefined;
235
- /**
236
- * Caption outline/stroke width in pixels
237
- * @public
238
- */
239
- stroke_width?: number | undefined;
240
- /**
241
- * Caption center X position as a percentage (0.0 to 1.0)
242
- * @public
243
- */
244
- position_x?: number | undefined;
245
- /**
246
- * Caption center Y position as a percentage (0.0 to 1.0)
247
- * @public
248
- */
249
- position_y?: number | undefined;
250
- }
251
- /**
252
- * @public
253
- */
254
- interface CaptionPart$1 {
255
- id: string | undefined;
256
- duration_ms: number | undefined;
257
- /**
258
- * Types of parts that can be contained in tracks
259
- * @public
260
- */
261
- kind: PartKind$1 | undefined;
262
- speech_part_id: string | undefined;
263
- text: string | undefined;
264
- start_ms: number | undefined;
265
- /**
266
- * Caption visual style (font, size, color, weight, animation, outline). Uses default style if not provided
267
- * @public
268
- */
269
- style?: CaptionStyle | undefined;
270
- }
271
- /**
272
- * @public
273
- * @enum
274
- */
275
- declare const AspectRatio: {
276
- readonly RATIO_16_9: '16:9';
277
- readonly RATIO_9_16: '9:16';
278
- };
279
- /**
280
- * @public
281
- */
282
- type AspectRatio = (typeof AspectRatio)[keyof typeof AspectRatio];
283
- /**
284
- * @public
285
- * @enum
286
- */
287
- declare const AssetSource: {
288
- readonly AI_IMAGES: 'ai_images';
289
- readonly AI_VIDEOS: 'ai_videos';
290
- readonly MY_UPLOADED_ASSETS: 'my_uploaded_assets';
291
- readonly STOCK_VIDEOS: 'stock_videos';
292
- };
293
- /**
294
- * @public
295
- */
296
- type AssetSource = (typeof AssetSource)[keyof typeof AssetSource];
297
- /**
298
- * An extra aspect ratio variant with independent storage keys for thumbnail,
299
- * preview video, and highlight video. Stored inside video_settings JSONB.
300
- * @public
301
- */
302
- interface RatioVariant {
303
- aspect_ratio: string | undefined;
304
- thumb_storage_key: string | undefined;
305
- video_storage_key: string | undefined;
306
- highlight_video_storage_key?: string | undefined;
307
- }
308
- /**
309
- * @public
310
- */
311
- interface VideoCreationSettings$1 {
312
- voice_id?: string | undefined;
313
- duration_ms?: number | undefined;
314
- aspect_ratio?: AspectRatio | undefined;
315
- video_style_id?: string | undefined;
316
- asset_sources?: AssetSource[] | undefined;
317
- recipe_id?: string | undefined;
318
- enable_high_cost_confirm?: boolean | undefined;
319
- user_confirm_cost_threshold?: number | undefined;
320
- /**
321
- * Extra aspect ratio variants with independent storage keys.
322
- * Each variant carries its own thumbnail, preview video, and optional highlight video.
323
- * Used when a recipe supports multiple aspect ratios (e.g. both 16:9 and 9:16).
324
- * @public
325
- */
326
- extra_ratios?: RatioVariant[] | undefined;
327
- }
328
- /**
329
- * @public
330
- */
331
- interface TrackItem$1 {
332
- abs_time_position: number | undefined;
333
- part_id: string | undefined;
334
- }
335
- /**
336
- * @public
337
- */
338
- interface Track$1 {
339
- id: string | undefined;
340
- /**
341
- * Types of parts that can be contained in tracks
342
- * @public
343
- */
344
- parts_kind: PartKind$1 | undefined;
345
- is_hidden: boolean | undefined;
346
- items: TrackItem$1[] | undefined;
347
- }
348
- /**
349
- * @public
350
- */
351
- interface Attachment {
352
- part_id: string | undefined;
353
- relative_time_position: number | undefined;
354
- }
355
- /**
356
- * @public
357
- */
358
- interface PartAggregation {
359
- body_part_id: string | undefined;
360
- attachments: Attachment[] | undefined;
361
- }
362
- /**
363
- * @public
364
- */
365
- interface BgmPart$1 {
366
- id: string | undefined;
367
- duration_ms: number | undefined;
368
- /**
369
- * Types of parts that can be contained in tracks
370
- * @public
371
- */
372
- kind: PartKind$1 | undefined;
373
- audio_storage_key: string | undefined;
374
- volume: number | undefined;
375
- origin_media_id: string | undefined;
376
- }
377
- /**
378
- * @public
379
- * @enum
380
- */
381
- declare const SpeedShiftCategory: {
382
- /**
383
- * Variable speed controlled by Bezier keyframes
384
- */
385
- readonly CURVE: 'curve';
386
- /**
387
- * Constant speed multiplier across the entire clip
388
- */
389
- readonly LINEAR: 'linear';
139
+ declare function createEditSandbox(document: VideoDocument, options?: PlainMemoryAdapterOptions): {
140
+ adapter: PlainMemoryAdapter;
141
+ editor: SemanticEditor;
142
+ journal: readonly JournalEntry[];
390
143
  };
391
144
  /**
392
- * @public
393
- */
394
- type SpeedShiftCategory = (typeof SpeedShiftCategory)[keyof typeof SpeedShiftCategory];
395
- /**
396
- * @public
397
- */
398
- interface TangentHandle {
399
- x: number | undefined;
400
- y: number | undefined;
401
- }
402
- /**
403
- * @public
404
- */
405
- interface SpeedKeyframe {
406
- position: number | undefined;
407
- rate: number | undefined;
408
- in_tangent?: TangentHandle | undefined;
409
- out_tangent?: TangentHandle | undefined;
410
- }
411
- /**
412
- * @public
413
- */
414
- interface CurveConfig {
415
- keyframes: SpeedKeyframe[] | undefined;
416
- }
417
- /**
418
- * @public
419
- */
420
- interface LinearConfig {
421
- speed: number | undefined;
422
- }
423
- /**
424
- * @public
425
- */
426
- type SpeedShiftConfigUnion = SpeedShiftConfigUnion.CurveMember | SpeedShiftConfigUnion.LinearMember | SpeedShiftConfigUnion.$UnknownMember;
427
- /**
428
- * @public
429
- */
430
- declare namespace SpeedShiftConfigUnion {
431
- interface LinearMember {
432
- linear: LinearConfig;
433
- curve?: never;
434
- $unknown?: never;
435
- }
436
- interface CurveMember {
437
- linear?: never;
438
- curve: CurveConfig;
439
- $unknown?: never;
440
- }
441
- /**
442
- * @public
443
- */
444
- interface $UnknownMember {
445
- linear?: never;
446
- curve?: never;
447
- $unknown: [string, any];
448
- }
449
- interface Visitor<T> {
450
- linear: (value: LinearConfig) => T;
451
- curve: (value: CurveConfig) => T;
452
- _: (name: string, value: any) => T;
453
- }
454
- const visit: <T>(value: SpeedShiftConfigUnion, visitor: Visitor<T>) => T;
455
- }
456
- /**
457
- * @public
145
+ * Re-drive `doc` from a recorded journal, forcing each entry's `generated_ids`
146
+ * through a queue-backed id factory. Never mints fresh ids: an empty queue on
147
+ * demand throws `unrecorded id`; leftover ids after an entry throws
148
+ * `unconsumed ids`. Legacy entries without `generated_ids` are treated as `[]`.
458
149
  */
459
- interface SpeedShift {
460
- category: SpeedShiftCategory | undefined;
461
- mode: string | undefined;
462
- config: SpeedShiftConfigUnion | undefined;
463
- }
464
- /**
465
- * @public
466
- */
467
- interface VideoClipPart$1 {
468
- id: string | undefined;
469
- duration_ms: number | undefined;
470
- /**
471
- * Types of parts that can be contained in tracks
472
- * @public
473
- */
474
- kind: PartKind$1 | undefined;
475
- play_in: number | undefined;
476
- play_out: number | undefined;
477
- volume: number | undefined;
478
- origin_media_id: string | undefined;
479
- speed_shift?: SpeedShift | undefined;
480
- }
481
- /**
482
- * @public
483
- */
484
- type PartUnion$1 = PartUnion$1.BgmMember | PartUnion$1.CaptionMember | PartUnion$1.SpeechMember | PartUnion$1.Video_clipMember | PartUnion$1.$UnknownMember;
485
- /**
486
- * @public
487
- */
488
- declare namespace PartUnion$1 {
489
- interface Video_clipMember {
490
- video_clip: VideoClipPart$1;
491
- bgm?: never;
492
- speech?: never;
493
- caption?: never;
494
- $unknown?: never;
495
- }
496
- interface BgmMember {
497
- video_clip?: never;
498
- bgm: BgmPart$1;
499
- speech?: never;
500
- caption?: never;
501
- $unknown?: never;
502
- }
503
- interface SpeechMember {
504
- video_clip?: never;
505
- bgm?: never;
506
- speech: SpeechPart$1;
507
- caption?: never;
508
- $unknown?: never;
509
- }
510
- interface CaptionMember {
511
- video_clip?: never;
512
- bgm?: never;
513
- speech?: never;
514
- caption: CaptionPart$1;
515
- $unknown?: never;
516
- }
517
- /**
518
- * @public
519
- */
520
- interface $UnknownMember {
521
- video_clip?: never;
522
- bgm?: never;
523
- speech?: never;
524
- caption?: never;
525
- $unknown: [string, any];
526
- }
527
- interface Visitor<T> {
528
- video_clip: (value: VideoClipPart$1) => T;
529
- bgm: (value: BgmPart$1) => T;
530
- speech: (value: SpeechPart$1) => T;
531
- caption: (value: CaptionPart$1) => T;
532
- _: (name: string, value: any) => T;
533
- }
534
- const visit: <T>(value: PartUnion$1, visitor: Visitor<T>) => T;
535
- }
536
- /**
537
- * Timeline configuration for video editing
538
- * @public
539
- */
540
- interface Timeline$1 {
541
- duration_ms: number | undefined;
542
- unit_time_ms: number | undefined;
543
- }
544
- /**
545
- * Complete video draft information with timeline and tracks
546
- * @public
547
- */
548
- interface VideoDraft$1 {
549
- id?: string | undefined;
550
- project_id: string | undefined;
551
- owner_id: string | undefined;
552
- /**
553
- * for-code-gen: property value may be empty string ("")
554
- * @public
555
- */
556
- thumbnail_storage_key: string | undefined;
557
- /**
558
- * Timeline configuration for video editing
559
- * @public
560
- */
561
- timeline?: Timeline$1 | undefined;
562
- video_creation_settings?: VideoCreationSettings$1 | undefined;
563
- chat_session_id: string | undefined;
564
- main_track?: Track$1 | undefined;
565
- above_main_tracks: Track$1[] | undefined;
566
- below_main_tracks: Track$1[] | undefined;
567
- part_aggregations: PartAggregation[] | undefined;
568
- part_library: Record<string, PartUnion$1> | undefined;
569
- version: number | undefined;
570
- }
571
- //#endregion
572
- //#region src/document/types.d.ts
573
- declare const VIDEO_DOCUMENT_SCHEMA_VERSION: 'video-document/v0';
574
- type VideoDocumentSchemaVersion = typeof VIDEO_DOCUMENT_SCHEMA_VERSION;
575
- type PartKind = 'video_clip' | 'speech' | 'caption' | 'bgm';
576
- /**
577
- * Project-level creation settings. Mirrors the IDL, but keeps the two fields the
578
- * upstream (Director / FE) sends as an explicit `null` nullable — the IDL models
579
- * "absent" only as `undefined`, whereas these arrive as `null` to mean
580
- * "explicitly cleared". Relaxing the type here avoids forcing every caller to
581
- * map `null` → `undefined`.
582
- */
583
- type VideoCreationSettings = Omit<VideoCreationSettings$1, 'video_style_id' | 'duration_ms'> & {
584
- video_style_id?: string | null | undefined;
585
- duration_ms?: number | null | undefined;
586
- };
587
- /**
588
- * Video clip part. `duration_ms` is dropped from the authoritative type
589
- * (reference/17 §5): it is the derived effective length and is re-derived into
590
- * the read-view by the projection. `play_in` / `play_out` are required (smithy
591
- * `@required`), so the timeline length is always the trim window over the speed
592
- * multiplier — no need to store the media's intrinsic length either. `speed_shift`
593
- * is the IDL type. See `effectiveVideoClipDurationMs`.
594
- */
595
- type VideoClipPart = Omit<VideoClipPart$1, 'duration_ms'>;
596
- /**
597
- * Speech part. `duration_ms` is dropped from the authoritative type
598
- * (reference/17 §5) in favour of the engine-only `media_duration_ms`: a speech
599
- * cannot be trimmed or speed-shifted, so its effective timeline duration equals
600
- * the TTS audio's intrinsic length. The read-view `duration_ms` is re-derived
601
- * from it by the projection.
602
- */
603
- type SpeechPart = Omit<SpeechPart$1, 'duration_ms'> & {
604
- media_duration_ms?: number | undefined;
605
- };
606
- /**
607
- * Authoritative caption part. The IDL `CaptionPart` carries `duration_ms` (the
608
- * effective display length, a derived read-view value); the authoritative store
609
- * instead keeps `initial_duration_ms` — the caption's length at generation time,
610
- * parsed from the voiceover, a resource-intrinsic fact that does not change
611
- * (reference/17 §5; onscreen-caption plan). The effective `duration_ms` is
612
- * re-derived into the `VideoDraft` read-view by the projection.
613
- *
614
- * `speech_part_id` / `start_ms` are kept as resource-intrinsic facts (which
615
- * speech it was split from, and its offset in that source) — reference/17
616
- * principle 4.
617
- */
618
- type CaptionPart = Omit<CaptionPart$1, 'duration_ms'> & {
619
- initial_duration_ms?: number | undefined;
620
- };
621
- /**
622
- * Background music. The IDL marks `duration_ms` required (via its part mixin),
623
- * but a bgm has no authoritative duration — its effective length is always the
624
- * whole timeline, derived on read (RFC 02 §0b). The engine therefore keeps it
625
- * optional rather than carrying the IDL's required field into storage.
626
- */
627
- type BgmPart = Omit<BgmPart$1, 'duration_ms'> & {
628
- duration_ms?: number | undefined;
629
- };
630
- /**
631
- * How a `TrackItem`'s start is determined — the authoritative positioning fact
632
- * (RFC 02 §4, reference/17 §3). The absolute time is never stored; it is solved
633
- * by the cascade at projection time. The three modes express "where the start
634
- * comes from": `sequential` follows the track's flow order, `anchored` hangs off
635
- * another part plus an offset, `absolute` pins to the timeline origin.
636
- * `anchorPartId` points at another item's `part_id` (a part is placed at most
637
- * once per lane, so `part_id` is the placement identity).
638
- *
639
- * `time_position` carries only the real editing intent (mode + anchor + offset),
640
- * so it is a single last-writer-wins unit safe to overwrite wholesale. The
641
- * derived fallback snapshot lives outside it on `TrackItem.fallback_abs_ms`.
642
- */
643
- type TrackItemTimePosition = {
644
- mode: 'sequential';
645
- } | {
646
- mode: 'anchored';
647
- anchorPartId: string;
648
- offsetMs: number;
649
- } | {
650
- mode: 'absolute';
651
- offsetMs: number;
652
- };
653
- /**
654
- * Authoritative track item: only facts. Absolute time is derived, not stored.
655
- *
656
- * `fallback_abs_ms` is the one deliberately-retained derived snapshot in
657
- * authoritative state: the `relative` item's absolute landing, so that when its
658
- * anchor is concurrently deleted (orphan, RFC 02 §11.1), the item can be put
659
- * back on the timeline and re-parented to the nearest video — orphan handling
660
- * needs an absolute anchor and cannot guess one.
661
- *
662
- * It is written by the write-side ops that create or move a `relative` item:
663
- * each resolves the item's absolute landing from its anchor once (add/change
664
- * speech from the host clip's start + offset; `moveSpeeches` from the requested
665
- * start; §9.1 reparent from the preserved abs) and stamps it here. The read-side
666
- * projection never writes it back — the authoritative model stays write-derived,
667
- * not read-derived. It is a field of its own (not inside `time_position`) so the
668
- * two are separate LWW units: a fallback refresh can never clobber a concurrent
669
- * `offsetMs` edit, since they carry unequal business value. When the anchor's
670
- * absolute position cannot be resolved at write time it is left undefined. Only
671
- * meaningful for `anchored` items.
672
- */
673
- interface TrackItem {
674
- part_id: string;
675
- time_position: TrackItemTimePosition;
676
- fallback_abs_ms?: number | undefined;
677
- }
678
- interface Track {
679
- id: string | undefined;
680
- parts_kind: PartKind | undefined;
681
- is_hidden: boolean | undefined;
682
- items: TrackItem[] | undefined;
683
- }
684
- /**
685
- * Authoritative part union: a flat discriminated union over the four part kinds.
686
- * Deliberately *not* the IDL's namespace union (no `$unknown` / `visit`): engine
687
- * storage rejects unknown kinds, and projection / validation read parts by plain
688
- * `part.video_clip` / `part.speech` property access, which this shape supports.
689
- */
690
- type PartUnion = {
691
- video_clip: VideoClipPart;
692
- speech?: never;
693
- caption?: never;
694
- bgm?: never;
695
- } | {
696
- video_clip?: never;
697
- speech: SpeechPart;
698
- caption?: never;
699
- bgm?: never;
700
- } | {
701
- video_clip?: never;
702
- speech?: never;
703
- caption: CaptionPart;
704
- bgm?: never;
705
- } | {
706
- video_clip?: never;
707
- speech?: never;
708
- caption?: never;
709
- bgm: BgmPart;
710
- };
711
- /**
712
- * Read-view part union for the derived `VideoDraft` (reference/17 §5/§7). The
713
- * authoritative parts drop their derived durations; the projection re-injects an
714
- * effective `duration_ms` for downstream compatibility — for a video clip it is
715
- * `(play_out - play_in) / speed`, for a speech it is `media_duration_ms`, for a
716
- * caption it is `initial_duration_ms`, for a bgm it is the timeline total. Each
717
- * read-view part is therefore the authoritative part plus a derived `duration_ms`.
718
- */
719
- type VideoDraftPartUnion = {
720
- video_clip: VideoClipPart & {
721
- duration_ms?: number;
722
- };
723
- speech?: never;
724
- caption?: never;
725
- bgm?: never;
726
- } | {
727
- video_clip?: never;
728
- speech: SpeechPart & {
729
- duration_ms?: number;
730
- };
731
- caption?: never;
732
- bgm?: never;
733
- } | {
734
- video_clip?: never;
735
- speech?: never;
736
- caption: CaptionPart & {
737
- duration_ms?: number;
738
- };
739
- bgm?: never;
740
- } | {
741
- video_clip?: never;
742
- speech?: never;
743
- caption?: never;
744
- bgm: BgmPart & {
745
- duration_ms?: number;
746
- };
747
- };
748
- /**
749
- * Derived `VideoDraft` read-view. The shape follows the IDL verbatim except for
750
- * `part_library`: the IDL types its parts with the generated namespace
751
- * `PartUnion`, but the engine's projection emits `VideoDraftPartUnion` — the
752
- * authoritative parts with the derived `duration_ms` re-injected (reference/17 §7)
753
- * plus the engine extensions (`media_duration_ms`, the looser `SpeedShift`). This
754
- * is the intentional superset over the IDL `VideoDraft` (see the extensions note).
755
- */
756
- type VideoDraft = Omit<VideoDraft$1, 'part_library' | 'video_creation_settings'> & {
757
- part_library: Record<string, VideoDraftPartUnion> | undefined;
758
- video_creation_settings?: VideoCreationSettings | undefined;
759
- };
760
- /** Authoritative timeline: `duration_ms` is derived (= longest track), not stored. */
761
- interface Timeline {
762
- unit_time_ms: number | undefined;
763
- }
764
- /**
765
- * Project-level scalars that do not participate in track ordering. Grouped under
766
- * `meta` because the loro-mirror `schema()` root only accepts container schemas,
767
- * not bare scalars — so these must live inside a map container in storage. The
768
- * domain type mirrors that storage shape 1:1 (RFC 03 §4) rather than flattening,
769
- * keeping `VideoDocument` and the loro draft isomorphic and the mapping layer a
770
- * near-identity. `schema_version` lives here too (it is a scalar fact).
771
- */
772
- interface VideoDocumentMeta {
773
- schema_version: VideoDocumentSchemaVersion;
774
- draft_id?: string | undefined;
775
- project_id: VideoDraft['project_id'];
776
- owner_id: VideoDraft['owner_id'];
777
- thumbnail_storage_key: VideoDraft['thumbnail_storage_key'];
778
- chat_session_id: VideoDraft['chat_session_id'];
779
- video_creation_settings: VideoDraft['video_creation_settings'];
780
- version: VideoDraft['version'];
781
- }
782
- /**
783
- * Authoritative collaborative document: only facts. Positioning lives on each
784
- * `TrackItem.time_position`; absolute time, `part_aggregations`, and total
785
- * duration are derived in the `VideoDraft` projection, not stored here (RFC 02 §6).
786
- *
787
- * The shape mirrors the loro storage structure 1:1 (RFC 03 §4): a `meta` map of
788
- * project scalars, plus a single ordered `tracks` list (reference/17 §4). A
789
- * track's lane is expressed by its `parts_kind`, not by which container it lives
790
- * in — the `main` / `above` / `below` three-pane view is reconstructed at
791
- * projection time. Order is the list order itself, so there is no `lane` /
792
- * `lane_order` field to diverge under concurrent edits.
793
- */
794
- interface VideoDocument {
795
- meta: VideoDocumentMeta;
796
- timeline: Timeline | undefined;
797
- tracks: Track[] | undefined;
798
- part_library: Record<string, PartUnion> | undefined;
799
- }
800
- 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';
801
- /**
802
- * Issue severity (RFC 02 §11.1). `error` is a hard reject — the document is not
803
- * a legal `VideoDocument` and must not be projected. `recoverable` marks a
804
- * business inconsistency the projection is designed to heal on read (currently
805
- * only a dangling `anchorPartId`: the orphan condition, recovered via the item's
806
- * `fallback_abs_ms` snapshot + cascade reassign), so it is surfaced for
807
- * observability but does NOT block projection. Absent `severity` means `error`.
808
- */
809
- type VideoDocumentValidationIssueSeverity = 'error' | 'recoverable';
810
- interface VideoDocumentValidationIssue {
811
- code: VideoDocumentValidationIssueCode;
812
- path: string;
813
- message: string;
814
- severity?: VideoDocumentValidationIssueSeverity;
815
- }
816
- //#endregion
817
- //#region src/document/projection.d.ts
818
- /**
819
- * Projection between the authoritative `VideoDocument` and the legacy
820
- * `VideoDraft` read-view (RFC 02 §5/§7). Both directions live here:
821
- *
822
- * - `toVideoDocument` ingests a `VideoDraft`, deriving each item's `position`
823
- * from the legacy absolute layout + aggregations; derived values (abs time,
824
- * `part_aggregations`, total duration) are dropped.
825
- * - `fromVideoDocument` solves a `VideoDocument` back into a `VideoDraft` via the
826
- * timeline-core cascade, re-deriving exactly those values.
827
- *
828
- * Business validation lives in `validation.ts`; `fromVideoDocument` asserts a
829
- * valid document before solving.
830
- */
831
- /**
832
- * Ingest the legacy `VideoDraft` into the authoritative `VideoDocument`,
833
- * deriving each item's `time_position` from the legacy absolute layout +
834
- * aggregations (RFC 02 §4/§5). Absolute time, `part_aggregations`, and total
835
- * duration are dropped — they are re-derived by the projection.
836
- */
837
- declare function toVideoDocument(draft: VideoDraft): VideoDocument;
838
- /** speech/attachment part_id → its host video part_id + relative offset. */
839
- type SpeechHostMap = Map<string, {
840
- hostPartId: string;
841
- offsetMs: number;
842
- }>;
843
- /**
844
- * Build a speech-host map from a part_aggregations list. Used by
845
- * `toVideoDocument` (legacy VideoDraft → VideoDocument) to recover each speech's
846
- * host video clip and relative offset. Aggregation items with null ids are
847
- * skipped (malformed input tolerance).
848
- */
849
- declare function buildSpeechHostMap(aggregations: Array<{
850
- body_part_id?: string | null;
851
- attachments?: Array<{
852
- part_id?: string | null;
853
- relative_time_position?: number | null;
854
- }> | null;
855
- }> | null | undefined): SpeechHostMap;
856
- /** The derived time position + orphan-recovery snapshot for one item. */
857
- interface DerivedItemPosition {
858
- timePosition: TrackItemTimePosition;
859
- /** Present only for `anchored` items (RFC 02 §11.1). */
860
- fallbackAbsMs?: number;
861
- }
862
- /**
863
- * Derive `time_position` (and `fallbackAbsMs` for anchored items) from a legacy
864
- * absolute time + pre-built speech-host map + part library. The three-branch
865
- * rule (RFC 02 §4/§5, reference/17 §3):
866
- *
867
- * 1. main-track → `sequential`
868
- * 2. speech/attachment (part_id in speechHost) → `anchored(host, offsetMs)`
869
- * 3. caption (part has `speech_part_id`) → `anchored(speech, start_ms)`
870
- * 4. everything else → `absolute(abs)`
871
- *
872
- * `partLibrary` values may be `PartUnion | string | undefined` (draft raw
873
- * form); only object-typed entries are inspected for `caption`.
874
- */
875
- declare function derivePositionFromAbs(partId: string, abs: number, isMain: boolean, speechHost: SpeechHostMap, partLibrary: Record<string, PartUnion | string | undefined>): DerivedItemPosition;
876
- /**
877
- * Project the authoritative `VideoDocument` back into the legacy `VideoDraft`
878
- * read-view, solving each item's absolute position, the `part_aggregations`, and
879
- * the total duration via the timeline-core cascade.
880
- */
881
- declare function fromVideoDocument(document: VideoDocument): VideoDraft;
882
- //#endregion
883
- //#region src/document/validation.d.ts
884
- /**
885
- * Business-level schema guard for `VideoDocument` (RFC 03 §9). It is the gate
886
- * that decides whether an arbitrary value is a *legal* `VideoDocument` before it
887
- * is written into Loro — distinct from two neighbours:
888
- *
889
- * - `zod-schema.ts` (`videoDocumentSchema`) checks structure/shape only; this
890
- * file layers the business rules on top (part-kind match, reference integrity,
891
- * `position.anchorPartId` targets, value ranges, identity uniqueness).
892
- * - loro-mirror's own `validateSchema` (run on every `setState`) only checks the
893
- * storage structure, never these business invariants.
894
- *
895
- * Projection (`projection.ts`) calls `assertValidVideoDocument` before solving a
896
- * document into the legacy `VideoDraft`.
897
- */
898
- declare class VideoDocumentValidationError extends Error {
899
- readonly issues: VideoDocumentValidationIssue[];
900
- constructor(issues: VideoDocumentValidationIssue[]);
901
- }
902
- /**
903
- * Assert the document is legal enough to project. Only `error`-severity issues
904
- * hard-reject; `recoverable` ones (dangling anchor / orphan, RFC 02 §11.1) are
905
- * left for the projection to heal on read and do NOT throw. Use
906
- * `validateVideoDocument` directly to inspect recoverable issues too.
907
- */
908
- declare function assertValidVideoDocument(document: unknown): asserts document is VideoDocument;
909
- declare function validateVideoDocument(document: unknown): VideoDocumentValidationIssue[];
910
- //#endregion
911
- //#region src/document/mirror-schema.d.ts
912
- declare const videoDocumentMirrorSchema: import("loro-mirror").RootSchemaType<{
913
- meta: import("loro-mirror").LoroMapSchema<{
914
- schema_version: /*elided*/any;
915
- draft_id: /*elided*/any;
916
- project_id: /*elided*/any;
917
- owner_id: /*elided*/any;
918
- thumbnail_storage_key: /*elided*/any;
919
- chat_session_id: /*elided*/any;
920
- video_creation_settings: /*elided*/any;
921
- version: /*elided*/any;
922
- }> & {
923
- options: {};
924
- } & {
925
- catchall: <C extends import("loro-mirror").SchemaType>(catchallSchema: C) => import("loro-mirror").LoroMapSchemaWithCatchall<{
926
- schema_version: /*elided*/any;
927
- draft_id: /*elided*/any;
928
- project_id: /*elided*/any;
929
- owner_id: /*elided*/any;
930
- thumbnail_storage_key: /*elided*/any;
931
- chat_session_id: /*elided*/any;
932
- video_creation_settings: /*elided*/any;
933
- version: /*elided*/any;
934
- }, C>;
935
- };
936
- timeline: import("loro-mirror").LoroMapSchema<{
937
- unit_time_ms: /*elided*/any;
938
- }> & {
939
- options: {};
940
- } & {
941
- catchall: <C extends import("loro-mirror").SchemaType>(catchallSchema: C) => import("loro-mirror").LoroMapSchemaWithCatchall<{
942
- unit_time_ms: /*elided*/any;
943
- }, C>;
944
- };
945
- tracks: import("loro-mirror").LoroMovableListSchema<import("loro-mirror").LoroMapSchema<{
946
- id: /*elided*/any;
947
- parts_kind: /*elided*/any;
948
- is_hidden: /*elided*/any;
949
- items: /*elided*/any;
950
- }> & {
951
- options: {};
952
- } & {
953
- catchall: <C extends import("loro-mirror").SchemaType>(catchallSchema: C) => import("loro-mirror").LoroMapSchemaWithCatchall<{
954
- id: /*elided*/any;
955
- parts_kind: /*elided*/any;
956
- is_hidden: /*elided*/any;
957
- items: /*elided*/any;
958
- }, C>;
959
- }> & {
960
- options: {};
961
- };
962
- part_library: import("loro-mirror").LoroMapSchemaWithCatchall<{}, import("loro-mirror").LoroMapSchema<{
963
- video_clip: /*elided*/any;
964
- speech: /*elided*/any;
965
- caption: /*elided*/any;
966
- bgm: /*elided*/any;
967
- }> & {
968
- options: {};
969
- } & {
970
- catchall: <C extends import("loro-mirror").SchemaType>(catchallSchema: C) => import("loro-mirror").LoroMapSchemaWithCatchall<{
971
- video_clip: /*elided*/any;
972
- speech: /*elided*/any;
973
- caption: /*elided*/any;
974
- bgm: /*elided*/any;
975
- }, C>;
976
- }> & {
977
- options: {};
978
- };
979
- }> & {
980
- options: {};
981
- };
982
- type VideoDocumentMirrorSchema = typeof videoDocumentMirrorSchema;
983
- /**
984
- * The mutable draft an op's `transact` callback edits, inferred from the schema.
985
- *
986
- * `InferInputType` is the schema's *input* shape: the declared business fields
987
- * with the `$cid` container ids (which mirror injects into its output
988
- * `InferType`) made optional, so ops assign plain objects without supplying
989
- * `$cid`. Deriving it from the schema keeps draft and storage in lockstep — a
990
- * schema change is a compile error at every edit site, not a silent drift.
991
- * Reorders within `items` still diff to real Loro `move` ops because the schema
992
- * keys items by `part_id`.
993
- */
994
- type VideoDocumentDraft = InferInputType<VideoDocumentMirrorSchema>;
995
- /** Track value as it appears in a draft. Derived from the single `tracks` movable list. */
996
- type TrackDraft = NonNullable<NonNullable<VideoDocumentDraft['tracks']>[number]>;
997
- /** A single track item in a draft. */
998
- type TrackItemDraft = NonNullable<NonNullable<TrackDraft['items']>[number]>;
999
- //#endregion
1000
- //#region src/editor/schemas/add-speeches.d.ts
1001
- /**
1002
- * Add speeches (and their captions). TTS runs upstream; the stable speech /
1003
- * caption parts arrive materialized (see `speech-assets.ts`). The op writes the
1004
- * parts and each speech's `{ mode:'anchored', anchorPartId, offsetMs }` fact
1005
- * verbatim — no write-time host-picking, no cascade (RFC 02 §4). The projection
1006
- * derives absolute positions on read.
1007
- */
1008
- declare const addSpeechesInputSchema: z.ZodObject<{
1009
- speeches: z.ZodArray<z.ZodObject<{
1010
- speech_id: z.ZodString;
1011
- anchor_part_id: z.ZodString;
1012
- offset_ms: z.ZodNumber;
1013
- audio_storage_key: z.ZodString;
1014
- duration_ms: z.ZodNumber;
1015
- audio_script: z.ZodString;
1016
- volume: z.ZodNumber;
1017
- voice: z.ZodObject<{
1018
- id: z.ZodString;
1019
- name: z.ZodString;
1020
- }, z.core.$strip>;
1021
- origin_speech_id: z.ZodString;
1022
- caption_ids: z.ZodArray<z.ZodString>;
1023
- }, z.core.$strip>>;
1024
- captions: z.ZodArray<z.ZodObject<{
1025
- caption_id: z.ZodString;
1026
- speech_part_id: z.ZodString;
1027
- text: z.ZodString;
1028
- start_ms: z.ZodNumber;
1029
- duration_ms: z.ZodNumber;
1030
- }, z.core.$strip>>;
1031
- }, z.core.$strip>;
1032
- type AddSpeechesInput = z.infer<typeof addSpeechesInputSchema>;
1033
- //#endregion
1034
- //#region src/editor/schemas/add-video-clips.d.ts
1035
- /**
1036
- * Add video clips to a track. Each clip's duration facts are separated so a
1037
- * single number is never overloaded (RFC 02 / `reference/16` §0b):
1038
- *
1039
- * - `media_duration_ms` is the source media's intrinsic full length (a resource
1040
- * fact, written to the part);
1041
- * - `play_in` / `play_out` are the optional trim window into that media; when
1042
- * omitted the whole media is used (`play_in=0`, `play_out=media_duration_ms`).
1043
- *
1044
- * The clip's effective timeline duration is derived by the projection from the
1045
- * trim window and `speed_shift` — it is never an input here.
1046
- */
1047
- declare const addVideoClipsInputSchema: z.ZodObject<{
1048
- clips: z.ZodArray<z.ZodObject<{
1049
- media_id: z.ZodString;
1050
- start_ms: z.ZodOptional<z.ZodNumber>;
1051
- media_duration_ms: z.ZodNumber;
1052
- play_in: z.ZodOptional<z.ZodNumber>;
1053
- play_out: z.ZodOptional<z.ZodNumber>;
1054
- track_id: z.ZodOptional<z.ZodString>;
1055
- }, z.core.$strip>>;
1056
- before_clip_id: z.ZodOptional<z.ZodString>;
1057
- after_clip_id: z.ZodOptional<z.ZodString>;
1058
- }, z.core.$strip>;
1059
- type AddVideoClipsInput = z.infer<typeof addVideoClipsInputSchema>;
1060
- //#endregion
1061
- //#region src/editor/schemas/adjust-bgm-volume.d.ts
1062
- declare const adjustBgmVolumeInputSchema: z.ZodObject<{
1063
- bgm: z.ZodArray<z.ZodObject<{
1064
- bgm_id: z.ZodString;
1065
- volume: z.ZodNumber;
1066
- }, z.core.$strip>>;
1067
- }, z.core.$strip>;
1068
- type AdjustBgmVolumeInput = z.infer<typeof adjustBgmVolumeInputSchema>;
1069
- //#endregion
1070
- //#region src/editor/schemas/adjust-speech-volume.d.ts
1071
- declare const adjustSpeechVolumeInputSchema: z.ZodObject<{
1072
- speeches: z.ZodArray<z.ZodObject<{
1073
- speech_id: z.ZodString;
1074
- volume: z.ZodNumber;
1075
- }, z.core.$strip>>;
1076
- }, z.core.$strip>;
1077
- type AdjustSpeechVolumeInput = z.infer<typeof adjustSpeechVolumeInputSchema>;
1078
- //#endregion
1079
- //#region src/editor/schemas/adjust-video-clip-duration.d.ts
1080
- /**
1081
- * Re-trim existing video clips (the user-facing "adjust duration" gesture is a
1082
- * trim of the source window). The new `play_in` / `play_out` are the facts; the
1083
- * effective timeline duration is derived from them and the clip's `speed_shift`,
1084
- * and the change reflows downstream clips, speeches, and the timeline inside the
1085
- * op's transaction (no caller-materialized cascade).
1086
- */
1087
- declare const adjustVideoClipDurationInputSchema: z.ZodObject<{
1088
- clips: z.ZodArray<z.ZodObject<{
1089
- clip_id: z.ZodString;
1090
- play_in: z.ZodNumber;
1091
- play_out: z.ZodNumber;
1092
- }, z.core.$strip>>;
1093
- }, z.core.$strip>;
1094
- type AdjustVideoClipDurationInput = z.infer<typeof adjustVideoClipDurationInputSchema>;
1095
- //#endregion
1096
- //#region src/editor/schemas/adjust-video-clip-volume.d.ts
1097
- declare const adjustVideoClipVolumeInputSchema: z.ZodObject<{
1098
- clips: z.ZodArray<z.ZodObject<{
1099
- clip_id: z.ZodString;
1100
- volume: z.ZodNumber;
1101
- }, z.core.$strip>>;
1102
- }, z.core.$strip>;
1103
- type AdjustVideoClipVolumeInput = z.infer<typeof adjustVideoClipVolumeInputSchema>;
1104
- //#endregion
1105
- //#region src/editor/schemas/change-speech.d.ts
1106
- /**
1107
- * Change a speech's script or voice. Both re-run TTS upstream and return the
1108
- * regenerated speech / caption parts in the same materialized shape as
1109
- * `AddSpeeches` (`speech-assets.ts`); the op upserts them by id (the speech part
1110
- * id is preserved across a re-TTS), re-seats at `start_ms`, and reflows. Old
1111
- * caption parts no longer owned by the speech are removed via `caption_ids`.
1112
- */
1113
- declare const changeSpeechScriptInputSchema: z.ZodObject<{
1114
- speeches: z.ZodArray<z.ZodObject<{
1115
- speech_id: z.ZodString;
1116
- anchor_part_id: z.ZodString;
1117
- offset_ms: z.ZodNumber;
1118
- audio_storage_key: z.ZodString;
1119
- duration_ms: z.ZodNumber;
1120
- audio_script: z.ZodString;
1121
- volume: z.ZodNumber;
1122
- voice: z.ZodObject<{
1123
- id: z.ZodString;
1124
- name: z.ZodString;
1125
- }, z.core.$strip>;
1126
- origin_speech_id: z.ZodString;
1127
- caption_ids: z.ZodArray<z.ZodString>;
1128
- }, z.core.$strip>>;
1129
- captions: z.ZodArray<z.ZodObject<{
1130
- caption_id: z.ZodString;
1131
- speech_part_id: z.ZodString;
1132
- text: z.ZodString;
1133
- start_ms: z.ZodNumber;
1134
- duration_ms: z.ZodNumber;
1135
- }, z.core.$strip>>;
1136
- }, z.core.$strip>;
1137
- declare const changeSpeechVoiceInputSchema: z.ZodObject<{
1138
- speeches: z.ZodArray<z.ZodObject<{
1139
- speech_id: z.ZodString;
1140
- anchor_part_id: z.ZodString;
1141
- offset_ms: z.ZodNumber;
1142
- audio_storage_key: z.ZodString;
1143
- duration_ms: z.ZodNumber;
1144
- audio_script: z.ZodString;
1145
- volume: z.ZodNumber;
1146
- voice: z.ZodObject<{
1147
- id: z.ZodString;
1148
- name: z.ZodString;
1149
- }, z.core.$strip>;
1150
- origin_speech_id: z.ZodString;
1151
- caption_ids: z.ZodArray<z.ZodString>;
1152
- }, z.core.$strip>>;
1153
- captions: z.ZodArray<z.ZodObject<{
1154
- caption_id: z.ZodString;
1155
- speech_part_id: z.ZodString;
1156
- text: z.ZodString;
1157
- start_ms: z.ZodNumber;
1158
- duration_ms: z.ZodNumber;
1159
- }, z.core.$strip>>;
1160
- }, z.core.$strip>;
1161
- type ChangeSpeechScriptInput = z.infer<typeof changeSpeechScriptInputSchema>;
1162
- type ChangeSpeechVoiceInput = z.infer<typeof changeSpeechVoiceInputSchema>;
1163
- //#endregion
1164
- //#region src/editor/schemas/delete-bgm.d.ts
1165
- /**
1166
- * Remove the document BGM. Pure document edit: clears the bgm lane and removes
1167
- * the bgm part. Takes no input (a document holds at most one bgm); an empty
1168
- * object keeps the op signature uniform with the rest.
1169
- */
1170
- declare const deleteBgmInputSchema: z.ZodObject<{}, z.core.$strip>;
1171
- type DeleteBgmInput = z.infer<typeof deleteBgmInputSchema>;
1172
- //#endregion
1173
- //#region src/editor/schemas/delete-speeches.d.ts
1174
- /**
1175
- * Delete speeches with their captions. Pure document edit (no side effect): the
1176
- * op removes each speech part, cascade-deletes the captions it owns (via
1177
- * `caption_ids` / `speech_part_id`), drops their track items, and reflows.
1178
- */
1179
- declare const deleteSpeechesInputSchema: z.ZodObject<{
1180
- speech_ids: z.ZodArray<z.ZodString>;
1181
- }, z.core.$strip>;
1182
- type DeleteSpeechesInput = z.infer<typeof deleteSpeechesInputSchema>;
1183
- //#endregion
1184
- //#region src/editor/schemas/delete-video-clips.d.ts
1185
- /**
1186
- * How a delete handles the anchored subtree (speeches anchored to a deleted clip,
1187
- * and their captions) — a delete-op policy, not a data-model field (reference/17
1188
- * §6). `cascade` (default) removes the subtree; `detach` keeps the direct
1189
- * anchored children, re-pinning them to `absolute` so they stay on the timeline.
1190
- */
1191
- declare const anchoredDeletePolicySchema: z.ZodEnum<{
1192
- cascade: "cascade";
1193
- detach: "detach";
1194
- }>;
1195
- type AnchoredDeletePolicy = z.infer<typeof anchoredDeletePolicySchema>;
1196
- declare const deleteVideoClipsInputSchema: z.ZodObject<{
1197
- clip_ids: z.ZodArray<z.ZodString>;
1198
- on_anchored: z.ZodOptional<z.ZodEnum<{
1199
- cascade: "cascade";
1200
- detach: "detach";
1201
- }>>;
1202
- }, z.core.$strip>;
1203
- type DeleteVideoClipsInput = z.infer<typeof deleteVideoClipsInputSchema>;
1204
- //#endregion
1205
- //#region src/editor/schemas/move-speeches.d.ts
1206
- /**
1207
- * Move speeches in time. Pure document edit: the op re-seats each speech at its
1208
- * new absolute `start_ms`; the cascade reassigns it to the host video clip,
1209
- * resolves overlaps, and reflows. Captions follow their speech.
1210
- */
1211
- declare const moveSpeechesInputSchema: z.ZodObject<{
1212
- speeches: z.ZodArray<z.ZodObject<{
1213
- speech_id: z.ZodString;
1214
- new_start_ms: z.ZodNumber;
1215
- }, z.core.$strip>>;
1216
- }, z.core.$strip>;
1217
- type MoveSpeechesInput = z.infer<typeof moveSpeechesInputSchema>;
1218
- //#endregion
1219
- //#region src/editor/schemas/move-video-clips.d.ts
1220
- declare const moveVideoClipsInputSchema: z.ZodObject<{
1221
- clips: z.ZodArray<z.ZodObject<{
1222
- clip_id: z.ZodString;
1223
- new_start_ms: z.ZodNumber;
1224
- new_track_id: z.ZodOptional<z.ZodString>;
1225
- }, z.core.$strip>>;
1226
- }, z.core.$strip>;
1227
- type MoveVideoClipsInput = z.infer<typeof moveVideoClipsInputSchema>;
1228
- //#endregion
1229
- //#region src/editor/schemas/replace-video-clip-content.d.ts
1230
- /**
1231
- * Replace the media backing existing video clips. The media import runs upstream
1232
- * (Director); its stable result — the new media id, intrinsic length, and the
1233
- * reset trim window — arrives materialized (see
1234
- * `results/phase-4-side-effect-payload-contract.md` §4). Director resets
1235
- * `play_in=0` / `play_out=media_duration_ms` and clears `speed_shift` on
1236
- * replacement. The clip `part_id`s (hence their track items) are unchanged; the
1237
- * editor reflows the main track from the new effective durations.
1238
- */
1239
- declare const replaceVideoClipContentInputSchema: z.ZodObject<{
1240
- clips: z.ZodArray<z.ZodObject<{
1241
- clip_id: z.ZodString;
1242
- origin_media_id: z.ZodString;
1243
- media_duration_ms: z.ZodNumber;
1244
- play_in: z.ZodNumber;
1245
- play_out: z.ZodNumber;
1246
- volume: z.ZodNumber;
1247
- }, z.core.$strip>>;
1248
- }, z.core.$strip>;
1249
- type ReplaceVideoClipContentInput = z.infer<typeof replaceVideoClipContentInputSchema>;
1250
- //#endregion
1251
- //#region src/editor/schemas/set-bgm.d.ts
1252
- /**
1253
- * Set the document BGM. The media's stable result (storage key) arrives
1254
- * materialized from upstream (see
1255
- * `results/phase-4-side-effect-payload-contract.md` §3). The op upserts the bgm
1256
- * part and seats it on the bgm lane; its effective length is always the whole
1257
- * timeline, derived by the projection on read — so there is no `duration_ms`
1258
- * input or fact (RFC 02 / `reference/16` §0b). A `bgm_id` lets the op replace an
1259
- * existing bgm part by id.
1260
- */
1261
- declare const setBgmInputSchema: z.ZodObject<{
1262
- bgm_id: z.ZodString;
1263
- audio_storage_key: z.ZodString;
1264
- origin_media_id: z.ZodString;
1265
- volume: z.ZodNumber;
1266
- }, z.core.$strip>;
1267
- type SetBgmInput = z.infer<typeof setBgmInputSchema>;
1268
- //#endregion
1269
- //#region src/editor/schemas/set-caption-style.d.ts
1270
- /**
1271
- * Set the caption visual style. GLOBAL by design: the style applies to every
1272
- * caption part in the document — it carries NO `caption_id`. This mirrors the FE,
1273
- * whose caption-style store (`caption-style.ts:persistCaptionStylePatch`) iterates
1274
- * ALL captions and writes the same normalized style to each; the product has a
1275
- * single document-wide caption style, not per-caption styling.
1276
- *
1277
- * Every field is optional and maps to a `CaptionStyle` attribute (snake_case
1278
- * IDL). A field present in the input is written to every caption; a field ABSENT
1279
- * from the input is left untouched on each caption (the editor merges the patch
1280
- * onto each caption's existing style — this is a value edit, not a full-style
1281
- * replace, so a partial patch such as "recolor only" does not wipe font size).
1282
- *
1283
- * Pure document edit, no cascade — captions keep their positions; only the style
1284
- * sub-map of each caption part changes.
1285
- */
1286
- declare const setCaptionStyleInputSchema: z.ZodObject<{
1287
- font_id: z.ZodOptional<z.ZodString>;
1288
- font_size: z.ZodOptional<z.ZodNumber>;
1289
- font_color: z.ZodOptional<z.ZodString>;
1290
- font_weight: z.ZodOptional<z.ZodNumber>;
1291
- entrance_animation: z.ZodOptional<z.ZodString>;
1292
- entrance_animation_duration_ms: z.ZodOptional<z.ZodNumber>;
1293
- stroke_color: z.ZodOptional<z.ZodString>;
1294
- stroke_width: z.ZodOptional<z.ZodNumber>;
1295
- position_x: z.ZodOptional<z.ZodNumber>;
1296
- position_y: z.ZodOptional<z.ZodNumber>;
1297
- }, z.core.$strip>;
1298
- type SetCaptionStyleInput = z.infer<typeof setCaptionStyleInputSchema>;
1299
- //#endregion
1300
- //#region src/editor/schemas/set-caption-visibility.d.ts
1301
- /**
1302
- * Toggle caption visibility (the caption track's `is_hidden` flag). Pure
1303
- * document edit, no cascade — captions keep their positions; only the lane's
1304
- * hidden flag changes.
1305
- */
1306
- declare const setCaptionVisibilityInputSchema: z.ZodObject<{
1307
- is_hidden: z.ZodBoolean;
1308
- }, z.core.$strip>;
1309
- type SetCaptionVisibilityInput = z.infer<typeof setCaptionVisibilityInputSchema>;
1310
- //#endregion
1311
- //#region src/editor/schemas/set-video-clip-speed-shift.d.ts
1312
- /**
1313
- * Set the playback speed of existing video clips. Per the speed-shift decision
1314
- * (`reference/16` §0): the op writes only the `speed_shift` fact — it does NOT
1315
- * store an effective `duration_ms` (projection derives it from the trim window /
1316
- * speed) and does NOT scale anchored speeches' relative offsets (offsets stay
1317
- * put; the cascade reflows absolute positions). A `null` speed_shift clears the
1318
- * speed back to original (1×).
1319
- */
1320
- declare const setVideoClipSpeedShiftInputSchema: z.ZodObject<{
1321
- clips: z.ZodArray<z.ZodObject<{
1322
- clip_id: z.ZodString;
1323
- speed_shift: z.ZodNullable<z.ZodObject<{
1324
- category: z.ZodEnum<{
1325
- curve: "curve";
1326
- linear: "linear";
1327
- }>;
1328
- mode: z.ZodString;
1329
- config: z.ZodUnion<readonly [z.ZodObject<{
1330
- linear: z.ZodObject<{
1331
- speed: z.ZodNumber;
1332
- }, z.core.$strip>;
1333
- }, z.core.$strip>, z.ZodObject<{
1334
- curve: z.ZodObject<{
1335
- keyframes: z.ZodArray<z.ZodObject<{
1336
- position: z.ZodNumber;
1337
- rate: z.ZodNumber;
1338
- in_tangent: z.ZodOptional<z.ZodObject<{
1339
- x: z.ZodNumber;
1340
- y: z.ZodNumber;
1341
- }, z.core.$strip>>;
1342
- out_tangent: z.ZodOptional<z.ZodObject<{
1343
- x: z.ZodNumber;
1344
- y: z.ZodNumber;
1345
- }, z.core.$strip>>;
1346
- }, z.core.$strip>>;
1347
- }, z.core.$strip>;
1348
- }, z.core.$strip>]>;
1349
- }, z.core.$strip>>;
1350
- }, z.core.$strip>>;
1351
- }, z.core.$strip>;
1352
- type SetVideoClipSpeedShiftInput = z.infer<typeof setVideoClipSpeedShiftInputSchema>;
1353
- //#endregion
1354
- //#region src/editor/schemas/shared.d.ts
1355
- declare const clipIdSchema: z.ZodString;
1356
- declare const clipIdsSchema: z.ZodArray<z.ZodString>;
1357
- declare const mediaIdSchema: z.ZodString;
1358
- declare const speechIdSchema: z.ZodString;
1359
- declare const timelineMsSchema: z.ZodNumber;
1360
- declare const positiveMsSchema: z.ZodNumber;
1361
- declare const volumeSchema: z.ZodNumber;
1362
- declare const speechIdsSchema: z.ZodArray<z.ZodString>;
1363
- /**
1364
- * A clip's playback-speed fact, the only thing `SetVideoClipSpeedShift` writes.
1365
- * Mirrors the IDL `SpeedShift`: `category` is `linear` | `curve`, and `config`
1366
- * is a discriminated union — `{ linear: { speed } }` for a constant multiplier
1367
- * (the multiplier projection reads at `config.linear.speed`) or `{ curve: {
1368
- * keyframes } }` for a Bezier-controlled variable speed (RFC 02 / `reference/16`
1369
- * §0). Exactly one of `linear` / `curve` is present.
1370
- */
1371
- declare const speedShiftSchema: z.ZodObject<{
1372
- category: z.ZodEnum<{
1373
- curve: "curve";
1374
- linear: "linear";
1375
- }>;
1376
- mode: z.ZodString;
1377
- config: z.ZodUnion<readonly [z.ZodObject<{
1378
- linear: z.ZodObject<{
1379
- speed: z.ZodNumber;
1380
- }, z.core.$strip>;
1381
- }, z.core.$strip>, z.ZodObject<{
1382
- curve: z.ZodObject<{
1383
- keyframes: z.ZodArray<z.ZodObject<{
1384
- position: z.ZodNumber;
1385
- rate: z.ZodNumber;
1386
- in_tangent: z.ZodOptional<z.ZodObject<{
1387
- x: z.ZodNumber;
1388
- y: z.ZodNumber;
1389
- }, z.core.$strip>>;
1390
- out_tangent: z.ZodOptional<z.ZodObject<{
1391
- x: z.ZodNumber;
1392
- y: z.ZodNumber;
1393
- }, z.core.$strip>>;
1394
- }, z.core.$strip>>;
1395
- }, z.core.$strip>;
1396
- }, z.core.$strip>]>;
1397
- }, z.core.$strip>;
1398
- declare const voiceSchema: z.ZodObject<{
1399
- id: z.ZodString;
1400
- name: z.ZodString;
1401
- }, z.core.$strip>;
1402
- //#endregion
1403
- //#region src/editor/schemas/speech-assets.d.ts
1404
- /**
1405
- * The materialized TTS result shared by `AddSpeeches` / `ChangeSpeechScript` /
1406
- * `ChangeSpeechVoice` (see `results/phase-4-side-effect-payload-contract.md`
1407
- * §1/§2). The side effect (TTS/ASR + billing) runs upstream; the op receives the
1408
- * stable speech + caption parts and writes them as authoritative facts. No
1409
- * cascade runs on write — the projection derives absolute positions on read.
1410
- *
1411
- * Each speech carries the anchoring fact directly (RFC 02 §4): the host video
1412
- * clip `anchor_part_id` and the `offset_ms` within it. The upstream caller
1413
- * already knows which clip a speech attaches to, so the op writes
1414
- * `{ mode:'anchored', anchorPartId, offsetMs }` verbatim — no write-time
1415
- * host-picking. Captions anchor to their speech via the caption part's
1416
- * `start_ms` (offset within the speech).
1417
- */
1418
- declare const speechAssetSchema: z.ZodObject<{
1419
- speech_id: z.ZodString;
1420
- anchor_part_id: z.ZodString;
1421
- offset_ms: z.ZodNumber;
1422
- audio_storage_key: z.ZodString;
1423
- duration_ms: z.ZodNumber;
1424
- audio_script: z.ZodString;
1425
- volume: z.ZodNumber;
1426
- voice: z.ZodObject<{
1427
- id: z.ZodString;
1428
- name: z.ZodString;
1429
- }, z.core.$strip>;
1430
- origin_speech_id: z.ZodString;
1431
- caption_ids: z.ZodArray<z.ZodString>;
1432
- }, z.core.$strip>;
1433
- declare const captionAssetSchema: z.ZodObject<{
1434
- caption_id: z.ZodString;
1435
- speech_part_id: z.ZodString;
1436
- text: z.ZodString;
1437
- start_ms: z.ZodNumber;
1438
- duration_ms: z.ZodNumber;
1439
- }, z.core.$strip>;
1440
- /** A materialized speech-subtree write (speeches + their captions). */
1441
- declare const speechAssetsSchema: z.ZodObject<{
1442
- speeches: z.ZodArray<z.ZodObject<{
1443
- speech_id: z.ZodString;
1444
- anchor_part_id: z.ZodString;
1445
- offset_ms: z.ZodNumber;
1446
- audio_storage_key: z.ZodString;
1447
- duration_ms: z.ZodNumber;
1448
- audio_script: z.ZodString;
1449
- volume: z.ZodNumber;
1450
- voice: z.ZodObject<{
1451
- id: z.ZodString;
1452
- name: z.ZodString;
1453
- }, z.core.$strip>;
1454
- origin_speech_id: z.ZodString;
1455
- caption_ids: z.ZodArray<z.ZodString>;
1456
- }, z.core.$strip>>;
1457
- captions: z.ZodArray<z.ZodObject<{
1458
- caption_id: z.ZodString;
1459
- speech_part_id: z.ZodString;
1460
- text: z.ZodString;
1461
- start_ms: z.ZodNumber;
1462
- duration_ms: z.ZodNumber;
1463
- }, z.core.$strip>>;
1464
- }, z.core.$strip>;
1465
- type SpeechAsset = z.infer<typeof speechAssetSchema>;
1466
- type CaptionAsset = z.infer<typeof captionAssetSchema>;
1467
- type SpeechAssets = z.infer<typeof speechAssetsSchema>;
1468
- declare namespace index_d_exports {
1469
- export { AddSpeechesInput, AddVideoClipsInput, AdjustBgmVolumeInput, AdjustSpeechVolumeInput, AdjustVideoClipDurationInput, AdjustVideoClipVolumeInput, AnchoredDeletePolicy, CaptionAsset, ChangeSpeechScriptInput, ChangeSpeechVoiceInput, DeleteBgmInput, DeleteSpeechesInput, DeleteVideoClipsInput, MoveSpeechesInput, MoveVideoClipsInput, ReplaceVideoClipContentInput, SetBgmInput, SetCaptionStyleInput, SetCaptionVisibilityInput, SetVideoClipSpeedShiftInput, SpeechAsset, SpeechAssets, addSpeechesInputSchema, addVideoClipsInputSchema, adjustBgmVolumeInputSchema, adjustSpeechVolumeInputSchema, adjustVideoClipDurationInputSchema, adjustVideoClipVolumeInputSchema, anchoredDeletePolicySchema, changeSpeechScriptInputSchema, changeSpeechVoiceInputSchema, clipIdSchema, clipIdsSchema, deleteBgmInputSchema, deleteSpeechesInputSchema, deleteVideoClipsInputSchema, mediaIdSchema, moveSpeechesInputSchema, moveVideoClipsInputSchema, positiveMsSchema, replaceVideoClipContentInputSchema, setBgmInputSchema, setCaptionStyleInputSchema, setCaptionVisibilityInputSchema, setVideoClipSpeedShiftInputSchema, speechAssetsSchema, speechIdSchema, speechIdsSchema, speedShiftSchema, timelineMsSchema, voiceSchema, volumeSchema };
1470
- }
1471
- //#endregion
1472
- //#region src/editor/schema-validator.d.ts
1473
- interface SnapshotReadable {
1474
- snapshot(): VideoDocument;
1475
- }
1476
- declare class ValidationError extends Error {
1477
- readonly code: string;
1478
- readonly context?: Record<string, unknown>;
1479
- constructor(code: string, message: string, context?: Record<string, unknown>);
1480
- }
1481
- declare class SchemaValidator {
1482
- validateMoveVideoClips(input: MoveVideoClipsInput, doc: SnapshotReadable): void;
1483
- validateDeleteVideoClips(input: DeleteVideoClipsInput, doc: SnapshotReadable): void;
1484
- validateAddVideoClips(input: AddVideoClipsInput, doc: SnapshotReadable): void;
1485
- validateAdjustVideoClipVolume(input: AdjustVideoClipVolumeInput, doc: SnapshotReadable): void;
1486
- validateSetVideoClipSpeedShift(input: SetVideoClipSpeedShiftInput, doc: SnapshotReadable): void;
1487
- validateReplaceVideoClipContent(input: ReplaceVideoClipContentInput, doc: SnapshotReadable): void;
1488
- validateAdjustVideoClipDuration(input: AdjustVideoClipDurationInput, doc: SnapshotReadable): void;
1489
- validateAdjustSpeechVolume(input: AdjustSpeechVolumeInput, doc: SnapshotReadable): void;
1490
- validateAdjustBgmVolume(input: AdjustBgmVolumeInput, doc: SnapshotReadable): void;
1491
- validateAddSpeeches(input: AddSpeechesInput, doc: SnapshotReadable): void;
1492
- validateChangeSpeechScript(input: ChangeSpeechScriptInput, doc: SnapshotReadable): void;
1493
- validateChangeSpeechVoice(input: ChangeSpeechVoiceInput, doc: SnapshotReadable): void;
1494
- validateDeleteSpeeches(input: DeleteSpeechesInput, doc: SnapshotReadable): void;
1495
- validateMoveSpeeches(input: MoveSpeechesInput, doc: SnapshotReadable): void;
1496
- validateSetBgm(input: SetBgmInput, _doc: SnapshotReadable): void;
1497
- validateDeleteBgm(input: DeleteBgmInput, _doc: SnapshotReadable): void;
1498
- validateSetCaptionVisibility(input: SetCaptionVisibilityInput, _doc: SnapshotReadable): void;
1499
- validateSetCaptionStyle(input: SetCaptionStyleInput, _doc: SnapshotReadable): void;
1500
- private parse;
1501
- private mainTrackIds;
1502
- /** Every caption a speech declares in `caption_ids` must be supplied in `captions`. */
1503
- private assertCaptionsOwned;
1504
- /** Each regenerated speech (re-TTS) must already exist in the document. */
1505
- private assertSpeechesExist;
1506
- /**
1507
- * Each speech's `anchor_part_id` must point at a video clip that already
1508
- * exists. A relative speech anchored to a missing clip cannot be positioned
1509
- * by the projection and has no host to recover to (RFC 02 §4/§11.1), so the
1510
- * write must be rejected rather than landing a dangling reference. (Restores
1511
- * the dangling-reference guard the old `validateMaterializedPatch` carried;
1512
- * ADR 0009.)
1513
- */
1514
- private assertAnchorsExist;
1515
- private assertPartKind;
1516
- }
1517
- //#endregion
1518
- //#region src/editor/types.d.ts
1519
- /**
1520
- * `SemanticOp` contract surface — the frozen catalogue of business write
1521
- * operations the collaborative editor recognises.
1522
- *
1523
- * This is the single source of truth; `SemanticEditor` derives its method set
1524
- * (`SemanticOpName`) from `ImplementedSemanticOpKind`, so adding a method
1525
- * without listing it here (or vice versa) is a type error.
1526
- *
1527
- * Mapping of each kind to UI Operation / agent tool / side-effect routing is
1528
- * maintained in
1529
- * `docs/projects/medeo-integration/reference/operation-semantic-matrix.md`; the
1530
- * frozen contract narrative lives in
1531
- * `docs/projects/medeo-integration/results/phase-4-semantic-op-contract.md`.
1532
- */
1533
- /**
1534
- * Operations implemented by `SemanticEditor`. FROZEN: each entry has a
1535
- * `SemanticEditor` method, a narrow zod input schema (business intent +
1536
- * materialized side-effect assets, never a document slice), and validation. The
1537
- * editor runs the timeline-core cascade in-transaction to derive every position
1538
- * (ADR 0009 — no caller-materialized layout).
1539
- *
1540
- * Effectful ops (TTS for `AddSpeeches` / `ChangeSpeechScript` /
1541
- * `ChangeSpeechVoice`, media import for `ReplaceVideoClipContent`, BGM for
1542
- * `SetBgm`) receive their stable side-effect result already materialized — the
1543
- * editor only writes the document; it never performs the side effect. See the
1544
- * side-effect payload contract in
1545
- * `docs/projects/medeo-integration/results/phase-4-side-effect-payload-contract.md`.
1546
- */
1547
- type ImplementedSemanticOpKind = 'MoveVideoClips' | 'DeleteVideoClips' | 'AddVideoClips' | 'AdjustVideoClipVolume' | 'SetVideoClipSpeedShift' | 'ReplaceVideoClipContent' | 'AdjustVideoClipDuration' | 'AddSpeeches' | 'DeleteSpeeches' | 'MoveSpeeches' | 'ChangeSpeechScript' | 'ChangeSpeechVoice' | 'AdjustSpeechVolume' | 'SetCaptionVisibility' | 'SetCaptionStyle' | 'SetBgm' | 'DeleteBgm' | 'AdjustBgmVolume';
1548
- /**
1549
- * Operations on the roadmap but NOT yet implemented by `SemanticEditor`. Empty:
1550
- * Phase 4 covers every op with a real entry point. Kept as a named type so the
1551
- * contract surface stays explicit and re-expanding the roadmap is a typed edit.
1552
- * To re-add planned kinds, list them here and add them back to the
1553
- * `SemanticOpKind` union below.
1554
- */
1555
- type PlannedSemanticOpKind = never;
1556
- /**
1557
- * Every SemanticOp kind. Currently equals `ImplementedSemanticOpKind` because
1558
- * `PlannedSemanticOpKind` is empty; re-add `| PlannedSemanticOpKind` when the
1559
- * roadmap is re-expanded.
1560
- */
1561
- type SemanticOpKind = ImplementedSemanticOpKind;
1562
- /** Runtime list of the frozen, implemented kinds (for guards / introspection). */
1563
- declare const IMPLEMENTED_SEMANTIC_OP_KINDS: readonly ImplementedSemanticOpKind[];
1564
- declare function isImplementedSemanticOpKind(kind: string): kind is ImplementedSemanticOpKind;
1565
- //#endregion
1566
- //#region src/editor/semantic-editor.d.ts
1567
- interface CommitOptions {
1568
- intent?: {
1569
- kind: string;
1570
- payload: unknown;
1571
- };
1572
- }
1573
- type SemanticOpInput = MoveVideoClipsInput | DeleteVideoClipsInput | AddVideoClipsInput | AdjustVideoClipVolumeInput | AdjustSpeechVolumeInput | AdjustBgmVolumeInput | SetVideoClipSpeedShiftInput | ReplaceVideoClipContentInput | AdjustVideoClipDurationInput | AddSpeechesInput | DeleteSpeechesInput | MoveSpeechesInput | SetCaptionVisibilityInput | SetCaptionStyleInput | SetBgmInput | DeleteBgmInput;
1574
- type SemanticOpName = ImplementedSemanticOpKind;
1575
- /** Audit metadata committed alongside an op's writes. */
1576
- interface TransactAudit {
1577
- kind: SemanticOpName;
1578
- payload: unknown;
1579
- intent?: unknown;
1580
- }
1581
- /**
1582
- * Narrow write surface the `SemanticEditor` drives (ADR 0008 / 0009). It stays
1583
- * off raw Loro: every op runs its document mutations inside a single `transact`
1584
- * callback, which the storage adapter applies as one CRDT transaction + commit
1585
- * carrying the audit message.
1586
- *
1587
- * The callback edits a `VideoDocumentDraft` — an immer draft of the whole
1588
- * document state. A throw inside it discards the draft and never touches Loro,
1589
- * so partial writes roll back naturally (no `commit`/`rollback` machinery). The
1590
- * adapter's declarative diff turns the edited draft into minimal CRDT ops,
1591
- * including real `move`s for reordered track items (keyed by `part_id`), so
1592
- * per-item identity survives on every lane.
1593
- *
1594
- * Each op takes a narrow business input (intent + materialized side-effect
1595
- * assets, never a document slice); the editor applies the authoritative facts
1596
- * and runs the timeline-core cascade inside the callback to derive every
1597
- * position. The caller never materializes a layout (ADR 0009).
1598
- */
1599
- interface SemanticDocumentAdapter extends SnapshotReadable {
1600
- /** True once the document holds real content (a bootstrapped/synced snapshot). */
1601
- hasContent(): boolean;
1602
- /**
1603
- * Apply one op's whole mutation in a single transaction. `edit` mutates the
1604
- * document draft; the adapter diffs the result and commits once with `audit`.
1605
- * A throw in `edit` rolls back (the draft is discarded, Loro untouched). An
1606
- * edit that changes nothing produces no commit (no phantom audit entry).
1607
- */
1608
- transact(edit: (draft: VideoDocumentDraft) => void, audit: TransactAudit): void;
1609
- }
1610
- declare class SemanticEditor {
1611
- private readonly doc;
1612
- private readonly validator;
1613
- constructor(doc: SemanticDocumentAdapter, validator?: SchemaValidator);
1614
- moveVideoClips(input: MoveVideoClipsInput, options?: CommitOptions): Promise<void>;
1615
- deleteVideoClips(input: DeleteVideoClipsInput, options?: CommitOptions): Promise<void>;
1616
- addVideoClips(input: AddVideoClipsInput, options?: CommitOptions): Promise<void>;
1617
- adjustVideoClipVolume(input: AdjustVideoClipVolumeInput, options?: CommitOptions): Promise<void>;
1618
- setVideoClipSpeedShift(input: SetVideoClipSpeedShiftInput, options?: CommitOptions): Promise<void>;
1619
- adjustSpeechVolume(input: AdjustSpeechVolumeInput, options?: CommitOptions): Promise<void>;
1620
- adjustBgmVolume(input: AdjustBgmVolumeInput, options?: CommitOptions): Promise<void>;
1621
- /**
1622
- * Replace the media backing existing video clips. The new media's stable
1623
- * result (new media id, intrinsic length, reset trim window) is materialized
1624
- * upstream; the clip ids and their track items are unchanged. Only the part
1625
- * facts change — effective duration and downstream positions are derived by
1626
- * the projection on read.
1627
- */
1628
- replaceVideoClipContent(input: ReplaceVideoClipContentInput, options?: CommitOptions): Promise<void>;
1629
- /**
1630
- * Re-trim clips. Only the `play_in` / `play_out` facts change; the new
1631
- * effective duration and the resulting downstream reflow are derived by the
1632
- * projection on read (anchored speeches follow their host clip automatically).
1633
- */
1634
- adjustVideoClipDuration(input: AdjustVideoClipDurationInput, options?: CommitOptions): Promise<void>;
1635
- /**
1636
- * Add speeches (and their captions). TTS runs upstream; the materialized
1637
- * speech / caption parts arrive in `input`, each carrying its host clip
1638
- * `anchor_part_id` + `offset_ms`. The editor writes the parts and their
1639
- * `anchored` `time_position` facts verbatim — no write-time host-picking, no
1640
- * cascade. The projection derives absolute positions on read.
1641
- */
1642
- addSpeeches(input: AddSpeechesInput, options?: CommitOptions): Promise<void>;
1643
- /** Delete speeches with their captions; the subtree is removed (§9.2). Surviving lanes keep their facts. */
1644
- deleteSpeeches(input: DeleteSpeechesInput, options?: CommitOptions): Promise<void>;
1645
- /**
1646
- * Move speeches in time (§9.1). One forward positioning pass: anchor each
1647
- * speech to the main-track clip its new absolute start lands in and write the
1648
- * resulting `anchored` `time_position` fact. No cascade — the projection
1649
- * derives absolute positions on read.
1650
- */
1651
- moveSpeeches(input: MoveSpeechesInput, options?: CommitOptions): Promise<void>;
1652
- /** Change a speech's script. Re-TTS runs upstream; the regenerated parts arrive materialized (no cascade). */
1653
- changeSpeechScript(input: ChangeSpeechScriptInput, options?: CommitOptions): Promise<void>;
1654
- /** Change a speech's voice. Re-TTS runs upstream; the regenerated parts arrive materialized (no cascade). */
1655
- changeSpeechVoice(input: ChangeSpeechVoiceInput, options?: CommitOptions): Promise<void>;
1656
- /**
1657
- * Set the document BGM. The media's stable result arrives materialized.
1658
- *
1659
- * KNOWN GAP (non-blocking): when the BGM comes from the public library, the
1660
- * Director must also register project-level stock media ownership. That is a
1661
- * separate "register-only, no draft write" side effect Director does not yet
1662
- * expose; until it does, a public-library BGM set here will not auto-appear in
1663
- * the project media library. The document edit itself is complete and correct.
1664
- * See `docs/projects/medeo-integration/results/phase-4-op-side-effect-classification.md`.
1665
- */
1666
- setBgm(input: SetBgmInput, options?: CommitOptions): Promise<void>;
1667
- /** Remove the document BGM; clears the bgm lane and removes the part. */
1668
- deleteBgm(input: DeleteBgmInput, options?: CommitOptions): Promise<void>;
1669
- /** Toggle caption visibility (caption track `is_hidden`). */
1670
- setCaptionVisibility(input: SetCaptionVisibilityInput, options?: CommitOptions): Promise<void>;
1671
- /**
1672
- * Set the document-wide caption style. GLOBAL (no `caption_id`): the patch is
1673
- * merged onto EVERY caption part's `style`, mirroring the FE, which applies a
1674
- * single style to all captions (`caption-style.ts:persistCaptionStylePatch`).
1675
- *
1676
- * Merge, not replace: only the fields present in the input overwrite the
1677
- * caption's existing style; absent fields are carried forward. So a partial
1678
- * patch ("recolor only") keeps the caption's font size. Pure document edit, no
1679
- * cascade — positions are untouched.
1680
- */
1681
- setCaptionStyle(input: SetCaptionStyleInput, options?: CommitOptions): Promise<void>;
1682
- /**
1683
- * Resolve the main-track sequential layout from `source`. Callers inside a
1684
- * `transact` MUST pass the live `draft` so item order reflects in-progress
1685
- * mutations; the default `this.doc.snapshot()` is only committed state and is
1686
- * correct for read-only callers outside a transaction. `readMainTrackItems` /
1687
- * `readPartDurationMs` accept both an immer draft and a raw snapshot.
1688
- */
1689
- private computeMainTrackLayout;
1690
- private indexForStartMs;
1691
- private computeAddInsertIndex;
1692
- }
1693
- //#endregion
1694
- //#region src/document/mirror-adapter.d.ts
1695
- interface MirrorVideoDocumentOptions {
1696
- peerId?: PeerID;
1697
- origin?: string;
1698
- }
1699
- /**
1700
- * Storage-layer adapter that backs a `VideoDocument` with `loro-mirror` (ADR
1701
- * 0008). The mirror holds an in-memory immutable state synced to the `LoroDoc`
1702
- * by declarative diff, replacing the hand-rolled `@mengine/schema` adapter:
1703
- *
1704
- * - `snapshot()` projects the mirror's in-memory state to the read model — no
1705
- * per-call `toJSON()` FFI rebuild.
1706
- * - `transact(edit, audit)` runs the whole op in one `mirror.setState` callback:
1707
- * one diff, one `doc.commit` carrying the audit message. The callback edits an
1708
- * immer draft, so a throw inside it discards the draft and never touches Loro
1709
- * (natural rollback) — no `guard` / `rollback` / `openTransaction` machinery.
1710
- * - mirror's `idSelector` (track items keyed by `part_id`) diffs reorders to
1711
- * real Loro `move` ops on every lane, so per-item CRDT identity survives on
1712
- * main and secondary tracks alike.
1713
- */
1714
- declare class MirrorVideoDocumentAdapter implements SemanticDocumentAdapter {
1715
- readonly doc: LoroDoc;
1716
- private readonly mirror;
1717
- constructor(doc: LoroDoc);
1718
- snapshot(): VideoDocument;
1719
- /**
1720
- * True once the doc holds real document content. A fresh mirror over an empty
1721
- * doc still reports defaulted root maps, so probe the stored `schema_version`
1722
- * (empty until a snapshot is bootstrapped or synced in).
1723
- */
1724
- hasContent(): boolean;
1725
- /**
1726
- * Apply one op as a single transaction. `edit` mutates the immer draft; mirror
1727
- * diffs the result and commits once with the audit `message`. A throw in `edit`
1728
- * discards the draft (Loro untouched). When `edit` produces no change, mirror
1729
- * skips the commit — matching the prior "empty op leaves no audit" behavior.
1730
- */
1731
- transact(edit: (draft: VideoDocumentDraft) => void, audit: TransactAudit): void;
1732
- }
1733
- /** Build a fresh Loro doc seeded with `document` through the mirror. */
1734
- declare function createMirrorVideoDocument(document: VideoDocument, options?: MirrorVideoDocumentOptions): LoroDoc;
1735
- /** Build a `MirrorVideoDocumentAdapter` over a fresh doc seeded with `document`. */
1736
- declare function createMirrorVideoDocumentAdapter(document: VideoDocument, options?: MirrorVideoDocumentOptions): MirrorVideoDocumentAdapter;
1737
- //#endregion
1738
- //#region src/document/mirror-read.d.ts
1739
- /**
1740
- * Project the mirror state (`VideoDocumentDraft`) into the authoritative
1741
- * `VideoDocument`. The storage shape is isomorphic to the domain shape (RFC 03
1742
- * §4, reference/17 §4: meta map + a single `tracks` list + part_library), so this
1743
- * is a near-identity — it reads `time_position` / `fallback_abs_ms` JSON blobs
1744
- * back into structured values and trims empty strings, nothing more.
1745
- *
1746
- * It maps only authoritative facts (RFC 02 §6): `part_id` + `time_position`. The
1747
- * projection-derived `VideoDraft` read-view (absolute time, `part_aggregations`,
1748
- * total duration) is solved separately by the cascade, not here.
1749
- *
1750
- * It reads in-memory mirror state (O(n) over the document), not a Loro
1751
- * `toJSON()` FFI rebuild — the cost the prior schema adapter paid on every
1752
- * `snapshot()`.
1753
- */
1754
- declare function readVideoDocumentFromDraft(draft: VideoDocumentDraft): VideoDocument;
1755
- //#endregion
1756
- //#region src/document/zod-schema.d.ts
1757
- declare const partUnionSchema: z.ZodUnion<readonly [z.ZodObject<{
1758
- video_clip: z.ZodObject<{
1759
- id: z.ZodOptional<z.ZodString>;
1760
- kind: z.ZodLiteral<"video_clip">;
1761
- duration_ms: z.ZodOptional<z.ZodNumber>;
1762
- play_in: z.ZodNumber;
1763
- play_out: z.ZodNumber;
1764
- volume: z.ZodNumber;
1765
- origin_media_id: z.ZodString;
1766
- speed_shift: z.ZodOptional<z.ZodObject<{
1767
- category: z.ZodOptional<z.ZodString>;
1768
- mode: z.ZodOptional<z.ZodString>;
1769
- config: z.ZodOptional<z.ZodObject<{
1770
- linear: z.ZodOptional<z.ZodObject<{
1771
- speed: z.ZodOptional<z.ZodNumber>;
1772
- }, z.core.$loose>>;
1773
- }, z.core.$loose>>;
1774
- }, z.core.$loose>>;
1775
- }, z.core.$loose>;
1776
- }, z.core.$loose>, z.ZodObject<{
1777
- speech: z.ZodObject<{
1778
- id: z.ZodOptional<z.ZodString>;
1779
- kind: z.ZodLiteral<"speech">;
1780
- media_duration_ms: z.ZodNumber;
1781
- duration_ms: z.ZodOptional<z.ZodNumber>;
1782
- audio_script: z.ZodString;
1783
- volume: z.ZodNumber;
1784
- audio_storage_key: z.ZodString;
1785
- origin_speech_id: z.ZodString;
1786
- voice: z.ZodUnknown;
1787
- caption_ids: z.ZodArray<z.ZodString>;
1788
- }, z.core.$loose>;
1789
- }, z.core.$loose>, z.ZodObject<{
1790
- caption: z.ZodObject<{
1791
- id: z.ZodOptional<z.ZodString>;
1792
- kind: z.ZodLiteral<"caption">;
1793
- initial_duration_ms: z.ZodNumber;
1794
- speech_part_id: z.ZodString;
1795
- text: z.ZodString;
1796
- start_ms: z.ZodNumber;
1797
- style: z.ZodOptional<z.ZodObject<{
1798
- font_id: z.ZodOptional<z.ZodString>;
1799
- font_size: z.ZodOptional<z.ZodNumber>;
1800
- font_color: z.ZodOptional<z.ZodString>;
1801
- font_weight: z.ZodOptional<z.ZodNumber>;
1802
- entrance_animation: z.ZodOptional<z.ZodString>;
1803
- entrance_animation_duration_ms: z.ZodOptional<z.ZodNumber>;
1804
- stroke_color: z.ZodOptional<z.ZodString>;
1805
- stroke_width: z.ZodOptional<z.ZodNumber>;
1806
- position_x: z.ZodOptional<z.ZodNumber>;
1807
- position_y: z.ZodOptional<z.ZodNumber>;
1808
- }, z.core.$loose>>;
1809
- }, z.core.$loose>;
1810
- }, z.core.$loose>, z.ZodObject<{
1811
- bgm: z.ZodObject<{
1812
- id: z.ZodOptional<z.ZodString>;
1813
- kind: z.ZodLiteral<"bgm">;
1814
- audio_storage_key: z.ZodString;
1815
- volume: z.ZodNumber;
1816
- origin_media_id: z.ZodString;
1817
- }, z.core.$loose>;
1818
- }, z.core.$loose>]>;
1819
- declare const videoDocumentSchema: z.ZodObject<{
1820
- meta: z.ZodObject<{
1821
- schema_version: z.ZodLiteral<"video-document/v0">;
1822
- draft_id: z.ZodOptional<z.ZodString>;
1823
- project_id: z.ZodOptional<z.ZodString>;
1824
- owner_id: z.ZodOptional<z.ZodString>;
1825
- thumbnail_storage_key: z.ZodOptional<z.ZodString>;
1826
- chat_session_id: z.ZodOptional<z.ZodString>;
1827
- video_creation_settings: z.ZodOptional<z.ZodUnknown>;
1828
- version: z.ZodOptional<z.ZodNumber>;
1829
- }, z.core.$loose>;
1830
- timeline: z.ZodOptional<z.ZodObject<{
1831
- unit_time_ms: z.ZodOptional<z.ZodNumber>;
1832
- }, z.core.$loose>>;
1833
- tracks: z.ZodOptional<z.ZodArray<z.ZodObject<{
1834
- id: z.ZodOptional<z.ZodString>;
1835
- parts_kind: z.ZodOptional<z.ZodEnum<{
1836
- bgm: "bgm";
1837
- caption: "caption";
1838
- speech: "speech";
1839
- video_clip: "video_clip";
1840
- }>>;
1841
- is_hidden: z.ZodOptional<z.ZodBoolean>;
1842
- items: z.ZodOptional<z.ZodArray<z.ZodObject<{
1843
- part_id: z.ZodString;
1844
- time_position: z.ZodDiscriminatedUnion<[z.ZodObject<{
1845
- mode: z.ZodLiteral<"sequential">;
1846
- }, z.core.$loose>, z.ZodObject<{
1847
- mode: z.ZodLiteral<"anchored">;
1848
- anchorPartId: z.ZodString;
1849
- offsetMs: z.ZodNumber;
1850
- }, z.core.$loose>, z.ZodObject<{
1851
- mode: z.ZodLiteral<"absolute">;
1852
- offsetMs: z.ZodNumber;
1853
- }, z.core.$loose>], "mode">;
1854
- fallback_abs_ms: z.ZodOptional<z.ZodNumber>;
1855
- }, z.core.$loose>>>;
1856
- }, z.core.$loose>>>;
1857
- part_library: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
1858
- video_clip: z.ZodObject<{
1859
- id: z.ZodOptional<z.ZodString>;
1860
- kind: z.ZodLiteral<"video_clip">;
1861
- duration_ms: z.ZodOptional<z.ZodNumber>;
1862
- play_in: z.ZodNumber;
1863
- play_out: z.ZodNumber;
1864
- volume: z.ZodNumber;
1865
- origin_media_id: z.ZodString;
1866
- speed_shift: z.ZodOptional<z.ZodObject<{
1867
- category: z.ZodOptional<z.ZodString>;
1868
- mode: z.ZodOptional<z.ZodString>;
1869
- config: z.ZodOptional<z.ZodObject<{
1870
- linear: z.ZodOptional<z.ZodObject<{
1871
- speed: z.ZodOptional<z.ZodNumber>;
1872
- }, z.core.$loose>>;
1873
- }, z.core.$loose>>;
1874
- }, z.core.$loose>>;
1875
- }, z.core.$loose>;
1876
- }, z.core.$loose>, z.ZodObject<{
1877
- speech: z.ZodObject<{
1878
- id: z.ZodOptional<z.ZodString>;
1879
- kind: z.ZodLiteral<"speech">;
1880
- media_duration_ms: z.ZodNumber;
1881
- duration_ms: z.ZodOptional<z.ZodNumber>;
1882
- audio_script: z.ZodString;
1883
- volume: z.ZodNumber;
1884
- audio_storage_key: z.ZodString;
1885
- origin_speech_id: z.ZodString;
1886
- voice: z.ZodUnknown;
1887
- caption_ids: z.ZodArray<z.ZodString>;
1888
- }, z.core.$loose>;
1889
- }, z.core.$loose>, z.ZodObject<{
1890
- caption: z.ZodObject<{
1891
- id: z.ZodOptional<z.ZodString>;
1892
- kind: z.ZodLiteral<"caption">;
1893
- initial_duration_ms: z.ZodNumber;
1894
- speech_part_id: z.ZodString;
1895
- text: z.ZodString;
1896
- start_ms: z.ZodNumber;
1897
- style: z.ZodOptional<z.ZodObject<{
1898
- font_id: z.ZodOptional<z.ZodString>;
1899
- font_size: z.ZodOptional<z.ZodNumber>;
1900
- font_color: z.ZodOptional<z.ZodString>;
1901
- font_weight: z.ZodOptional<z.ZodNumber>;
1902
- entrance_animation: z.ZodOptional<z.ZodString>;
1903
- entrance_animation_duration_ms: z.ZodOptional<z.ZodNumber>;
1904
- stroke_color: z.ZodOptional<z.ZodString>;
1905
- stroke_width: z.ZodOptional<z.ZodNumber>;
1906
- position_x: z.ZodOptional<z.ZodNumber>;
1907
- position_y: z.ZodOptional<z.ZodNumber>;
1908
- }, z.core.$loose>>;
1909
- }, z.core.$loose>;
1910
- }, z.core.$loose>, z.ZodObject<{
1911
- bgm: z.ZodObject<{
1912
- id: z.ZodOptional<z.ZodString>;
1913
- kind: z.ZodLiteral<"bgm">;
1914
- audio_storage_key: z.ZodString;
1915
- volume: z.ZodNumber;
1916
- origin_media_id: z.ZodString;
1917
- }, z.core.$loose>;
1918
- }, z.core.$loose>]>>>;
1919
- }, z.core.$loose>;
1920
- //#endregion
1921
- //#region src/editor/id-gen.d.ts
1922
- /**
1923
- * Part-id generation, aligned with the online ecosystem.
1924
- *
1925
- * The authoritative online producers — agent-harness (`@harness/shared`
1926
- * `genObjId`) and director.v2 (`common/obj_id.py` `gen_obj_id`) — both mint part
1927
- * ids as `` `${prefix}_${ulid()}` ``, and real captured drafts use exactly that
1928
- * shape (`clip_…` / `spe_…` / `cap_…` / `bgm_…`, each a 26-char ULID). The engine
1929
- * previously emitted `vc_<base36 timestamp><6 random>`, a different prefix AND a
1930
- * different encoding — the sole cross-repo id divergence. This module removes it
1931
- * by emitting the same `<prefix>_<ULID>` bytes.
1932
- *
1933
- * The ULID is generated inline (Crockford Base32, 48-bit time + 80-bit random)
1934
- * rather than pulling the `ulid` npm package: the randomness class matches the
1935
- * old generator (both `Math.random`-based) and it keeps `@mengine/medeo-client`
1936
- * dependency-free for a purely mechanical id string. Part ids only need to be
1937
- * unique and lexicographically time-sortable, which this satisfies.
1938
- */
1939
- /**
1940
- * Online part-id semantic prefixes. `clip` (video clip) is the only value the
1941
- * engine currently mints (see `addVideoClips`); the rest are declared so the
1942
- * type documents the shared vocabulary and guards against reintroducing the old
1943
- * `vc`/`sp`/`cp`/`bg` names. Speech/caption/bgm ids arrive pre-minted in op
1944
- * payloads, so the engine never generates them itself.
1945
- */
1946
- type PartIdPrefix = 'clip' | 'spe' | 'cap' | 'bgm' | 'ti';
1947
- declare function generatePartId(prefix: PartIdPrefix): string;
150
+ declare function replayJournal(doc: SemanticDocumentAdapter, journal: readonly JournalEntry[]): Promise<void>;
1948
151
  //#endregion
1949
152
  //#region src/editor/snapshot-utils.d.ts
1950
153
  /** Main-track item identity read from a raw snapshot (only `part_id` is needed). */
@@ -2035,6 +238,18 @@ declare class MengineDocSession {
2035
238
  * step. The committed change drives DocManager's local-update push.
2036
239
  */
2037
240
  get editor(): SemanticEditor;
241
+ /**
242
+ * Opaque version token of the local oplog (base64 `VersionVector.encode`).
243
+ * Equality-comparable only: equal means no observed change (local or
244
+ * remote-arrived) since the token was taken. Throws when not started.
245
+ */
246
+ version(): string;
247
+ /**
248
+ * The live document adapter, exposed for journal replay (commit channel).
249
+ * Replaying through it still goes SemanticEditor → Loro → mengine-server —
250
+ * no write bypass. Typed by the narrow interface on purpose.
251
+ */
252
+ get documentAdapter(): SemanticDocumentAdapter;
2038
253
  /** Current document snapshot (read model). */
2039
254
  snapshot(): VideoDocument;
2040
255
  /**
@@ -2377,4 +592,4 @@ declare function hostForAbsMs(ranges: MainClipRange[], absMs: number): MainClipR
2377
592
  */
2378
593
  declare function relativePositionForAbs(ranges: MainClipRange[], absMs: number): TrackItemTimePosition;
2379
594
  //#endregion
2380
- export { type Aggregation, type Attachment, type BgmPart, type CaptionPart, type CaptionStyle, type CommitOptions, type DerivedItemPosition, type DocStorageLike, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImplementedSemanticOpKind, type MainClipRange, type MakeEmptyPart, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, MemoryDocStorage, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUpdateMeta, MirrorVideoDocumentAdapter, type MirrorVideoDocumentOptions, type PartAggregation, type PartKind, type PartUnion, type PlannedSemanticOpKind, SchemaValidator, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, type SnapshotReadable, type SolvedVideoDocument, type SpeechHostMap, type SpeechPart, type SpeedShift, TIMELINE_SKELETON_DURATION_MS, type Timeline, type TimelineDoc, type TimelineItem, type Track, type TrackDraft, type TrackItem, type TrackItemDraft, type TrackItemTimePosition, type TransactAudit, VIDEO_DOCUMENT_SCHEMA_VERSION, ValidationError, type VideoClipPart, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, type VideoDocumentSchemaVersion, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, arrangeMainTrackSeamlessly, assertValidVideoDocument, base64ToBytes, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, derivePositionFromAbs, ensureLaneTrack, fillMainTrackTimeGaps, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, mainTrackRanges, partDurationMs, partUnionSchema, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, resolveAllSpeechOverlaps, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, snapshotToPlain, solveVideoDocument, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema };
595
+ export { type Aggregation, type Attachment, type BgmPart, type CaptionPart, type CaptionStyle, type CommitOptions, type DerivedItemPosition, type DocStorageLike, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImplementedSemanticOpKind, type JournalEntry, type MainClipRange, type MakeEmptyPart, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, MemoryDocStorage, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUpdateMeta, MirrorVideoDocumentAdapter, type MirrorVideoDocumentOptions, type PartAggregation, type PartIdFactory, type PartKind, type PartUnion, PlainMemoryAdapter, type PlainMemoryAdapterOptions, type PlannedSemanticOpKind, SchemaValidator, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, type SnapshotReadable, type SolvedVideoDocument, type SpeechHostMap, type SpeechPart, type SpeedShift, TIMELINE_SKELETON_DURATION_MS, type Timeline, type TimelineDoc, type TimelineItem, type Track, type TrackDraft, type TrackItem, type TrackItemDraft, type TrackItemTimePosition, type TransactAudit, VIDEO_DOCUMENT_SCHEMA_VERSION, ValidationError, type VideoClipPart, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, type VideoDocumentSchemaVersion, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, arrangeMainTrackSeamlessly, assertValidVideoDocument, base64ToBytes, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, derivePositionFromAbs, effectiveVideoClipDurationMs, ensureLaneTrack, fillMainTrackTimeGaps, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, mainTrackRanges, partDurationMs, partUnionSchema, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema, writeVideoDocumentToDraft };