@mengine/medeo-client 2.0.1-alpha.4 → 2.0.1-alpha.6

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.
@@ -1,3 +1,4 @@
1
+ import { A as MoveVideoClipsInput, J as ChangeSpeechScriptInput, K as DeleteBgmInput, N as MoveVideoClipsByAnchorInput, O as ReplaceVideoClipContentInput, Q as AdjustVideoClipVolumeInput, R as MoveSpeechesInput, S as SetBgmInput, T as ReplaceVideoClipSequenceInput, V as DeleteVideoClipsInput, W as DeleteSpeechesInput, Y as ChangeSpeechVoiceInput, b as SetCaptionStyleInput, ct as AddSpeechesInput, et as AdjustVideoClipDurationInput, g as SetVideoClipSpeedShiftInput, it as AdjustBgmVolumeInput, nt as AdjustSpeechVolumeInput, ot as AddVideoClipsInput, v as SetCaptionVisibilityInput } from "./index-CMa6ZCtX.js";
1
2
  import { InferInputType } from "loro-mirror";
2
3
  import { z } from "zod";
3
4
  import { LoroDoc, PeerID } from "loro-crdt";
@@ -29,10 +30,10 @@ import { LoroDoc, PeerID } from "loro-crdt";
29
30
  * @enum
30
31
  */
31
32
  declare const PartKind$1: {
32
- readonly BGM: 'bgm';
33
- readonly CAPTION: 'caption';
34
- readonly SPEECH: 'speech';
35
- readonly VIDEO_CLIP: 'video_clip';
33
+ readonly BGM: "bgm";
34
+ readonly CAPTION: "caption";
35
+ readonly SPEECH: "speech";
36
+ readonly VIDEO_CLIP: "video_clip";
36
37
  };
37
38
  /**
38
39
  * @public
@@ -144,8 +145,8 @@ interface CaptionPart$1 {
144
145
  * @enum
145
146
  */
146
147
  declare const AspectRatio: {
147
- readonly RATIO_16_9: '16:9';
148
- readonly RATIO_9_16: '9:16';
148
+ readonly RATIO_16_9: "16:9";
149
+ readonly RATIO_9_16: "9:16";
149
150
  };
150
151
  /**
151
152
  * @public
@@ -156,10 +157,10 @@ type AspectRatio = (typeof AspectRatio)[keyof typeof AspectRatio];
156
157
  * @enum
157
158
  */
158
159
  declare const AssetSource: {
159
- readonly AI_IMAGES: 'ai_images';
160
- readonly AI_VIDEOS: 'ai_videos';
161
- readonly MY_UPLOADED_ASSETS: 'my_uploaded_assets';
162
- readonly STOCK_VIDEOS: 'stock_videos';
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";
163
164
  };
164
165
  /**
165
166
  * @public
@@ -253,11 +254,11 @@ declare const SpeedShiftCategory: {
253
254
  /**
254
255
  * Variable speed controlled by Bezier keyframes
255
256
  */
256
- readonly CURVE: 'curve';
257
+ readonly CURVE: "curve";
257
258
  /**
258
259
  * Constant speed multiplier across the entire clip
259
260
  */
260
- readonly LINEAR: 'linear';
261
+ readonly LINEAR: "linear";
261
262
  };
262
263
  /**
263
264
  * @public
@@ -441,6 +442,10 @@ interface VideoDraft$1 {
441
442
  }
442
443
  //#endregion
443
444
  //#region src/document/types.d.ts
445
+ declare const VIDEO_DOCUMENT_SCHEMA_VERSION: "video-document/v0";
446
+ /** A server-derived compatibility view, never an editor write authority. */
447
+ declare const ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION: "video-document/entity-projection-v1";
448
+ type VideoDocumentSchemaVersion = typeof VIDEO_DOCUMENT_SCHEMA_VERSION | typeof ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION;
444
449
  type PartKind = 'video_clip' | 'speech' | 'caption' | 'bgm';
445
450
  /**
446
451
  * Project-level creation settings. Mirrors the IDL, but keeps the two fields the
@@ -482,9 +487,21 @@ type SpeechPart = Omit<SpeechPart$1, 'duration_ms'> & {
482
487
  *
483
488
  * `speech_part_id` / `start_ms` are kept as resource-intrinsic facts (which
484
489
  * speech it was split from, and its offset in that source) — reference/17
485
- * principle 4.
486
- */
490
+ * principle 4. An independently placed Caption (its own Clip and Sequence
491
+ * Marker, no Voice take) has no owning speech: both fields stay unset and its
492
+ * position is expressed entirely by the Clip's placement. Generation source
493
+ * (AudioScript provenance) and Voice alignment are entity Relations, decoupled
494
+ * from this display-side legacy view.
495
+ */
496
+ /** Derived render interval, relative to the placed Caption Clip; never an Entity. */
497
+ interface CaptionDisplayCue {
498
+ segmentId: string;
499
+ text: string;
500
+ startMs: number;
501
+ durationMs: number;
502
+ }
487
503
  type CaptionPart = Omit<CaptionPart$1, 'duration_ms'> & {
504
+ display_cues?: CaptionDisplayCue[];
488
505
  initial_duration_ms?: number | undefined;
489
506
  };
490
507
  /**
@@ -550,6 +567,19 @@ interface Track {
550
567
  is_hidden: boolean | undefined;
551
568
  items: TrackItem[] | undefined;
552
569
  }
570
+ /** The linear speed multiplier of a `speed_shift`, defaulting to 1 (original). */
571
+ declare function speedOf(speedShift: SpeedShift | undefined): number;
572
+ /**
573
+ * A video clip's effective timeline duration, derived from authoritative facts
574
+ * (RFC 02, `reference/16` §4, reference/17 §5): the trim window
575
+ * `play_out - play_in` divided by the speed multiplier, rounded to integer ms.
576
+ * `play_in` / `play_out` are optional in the IDL but every write path sets them
577
+ * (defaulting to the whole media), and the legacy-ingest projection backfills the
578
+ * window from a legacy `duration_ms` — so an authoritative clip always carries a
579
+ * trim window and there is no stored `duration_ms` to fall back to. A clip with
580
+ * neither bound yields 0. Speeds the clip up (>1× → shorter) or down (<1×).
581
+ */
582
+ declare function effectiveVideoClipDurationMs(clip: VideoClipPart): number;
553
583
  /**
554
584
  * Authoritative part union: a flat discriminated union over the four part kinds.
555
585
  * Deliberately *not* the IDL's namespace union (no `$unknown` / `visit`): engine
@@ -615,52 +645,17 @@ type VideoDraftPartUnion = {
615
645
  };
616
646
  };
617
647
  /**
618
- * Legacy Draft import shape. It allows omitted durations and engine extensions
619
- * so existing fixtures and migrations can state only the facts they have.
620
- * Projection returns the narrower `VideoDraftContent` contract instead.
648
+ * Derived `VideoDraft` read-view. The shape follows the IDL verbatim except for
649
+ * `part_library`: the IDL types its parts with the generated namespace
650
+ * `PartUnion`, but the engine's projection emits `VideoDraftPartUnion` — the
651
+ * authoritative parts with the derived `duration_ms` re-injected (reference/17 §7)
652
+ * plus the engine extensions (`media_duration_ms`, the looser `SpeedShift`). This
653
+ * is the intentional superset over the IDL `VideoDraft` (see the extensions note).
621
654
  */
622
655
  type VideoDraft = Omit<VideoDraft$1, 'part_library' | 'video_creation_settings'> & {
623
656
  part_library: Record<string, VideoDraftPartUnion> | undefined;
624
657
  video_creation_settings?: VideoCreationSettings | undefined;
625
658
  };
626
- /**
627
- * The complete content read model produced by the shared projection. Business
628
- * identity, settings, thumbnail and revision counters are assembled by Director;
629
- * keeping an explicit field list prevents new business DTO fields entering here.
630
- */
631
- type VideoDraftContent = Pick<VideoDraft, 'timeline' | 'main_track' | 'above_main_tracks' | 'below_main_tracks' | 'part_aggregations'> & {
632
- part_library: Record<string, VideoDraftContentPartUnion> | undefined;
633
- };
634
- /** Projection always states the duration field; legacy imports may omit it. */
635
- type VideoDraftContentPartUnion = {
636
- video_clip: VideoClipPart & {
637
- duration_ms: number | undefined;
638
- };
639
- speech?: never;
640
- caption?: never;
641
- bgm?: never;
642
- } | {
643
- video_clip?: never;
644
- speech: SpeechPart & {
645
- duration_ms: number | undefined;
646
- };
647
- caption?: never;
648
- bgm?: never;
649
- } | {
650
- video_clip?: never;
651
- speech?: never;
652
- caption: CaptionPart & {
653
- duration_ms: number | undefined;
654
- };
655
- bgm?: never;
656
- } | {
657
- video_clip?: never;
658
- speech?: never;
659
- caption?: never;
660
- bgm: BgmPart & {
661
- duration_ms: number | undefined;
662
- };
663
- };
664
659
  /** Authoritative timeline: `duration_ms` is derived (= longest track), not stored. */
665
660
  interface Timeline {
666
661
  unit_time_ms: number | undefined;
@@ -675,19 +670,39 @@ interface Timeline {
675
670
  * is not, and passes any `>= 0` guard on its way to an editor that cannot use it.
676
671
  */
677
672
  declare const DEFAULT_UNIT_TIME_MS = 33.333;
673
+ /**
674
+ * Project-level scalars that do not participate in track ordering. Grouped under
675
+ * `meta` because the loro-mirror `schema()` root only accepts container schemas,
676
+ * not bare scalars — so these must live inside a map container in storage. The
677
+ * domain type mirrors that storage shape 1:1 (RFC 03 §4) rather than flattening,
678
+ * keeping `VideoDocument` and the loro draft isomorphic and the mapping layer a
679
+ * near-identity. `schema_version` lives here too (it is a scalar fact).
680
+ */
681
+ interface VideoDocumentMeta {
682
+ schema_version: VideoDocumentSchemaVersion;
683
+ draft_id?: string | undefined;
684
+ project_id: VideoDraft['project_id'];
685
+ owner_id: VideoDraft['owner_id'];
686
+ thumbnail_storage_key: VideoDraft['thumbnail_storage_key'];
687
+ chat_session_id: VideoDraft['chat_session_id'];
688
+ video_creation_settings: VideoDraft['video_creation_settings'];
689
+ /** Legacy imported version for v0; committed Entity revision for entity-projection-v1. */
690
+ version: VideoDraft['version'];
691
+ }
678
692
  /**
679
693
  * Authoritative collaborative document: only facts. Positioning lives on each
680
694
  * `TrackItem.time_position`; absolute time, `part_aggregations`, and total
681
695
  * duration are derived in the `VideoDraft` projection, not stored here (RFC 02 §6).
682
696
  *
683
- * The content mirrors Loro storage: timeline, part library, and a single
684
- * ordered `tracks` list (reference/17 §4). Business metadata stays in Director. A
697
+ * The shape mirrors the loro storage structure 1:1 (RFC 03 §4): a `meta` map of
698
+ * project scalars, plus a single ordered `tracks` list (reference/17 §4). A
685
699
  * track's lane is expressed by its `parts_kind`, not by which container it lives
686
700
  * in — the `main` / `above` / `below` three-pane view is reconstructed at
687
701
  * projection time. Order is the list order itself, so there is no `lane` /
688
702
  * `lane_order` field to diverge under concurrent edits.
689
703
  */
690
704
  interface VideoDocument {
705
+ meta: VideoDocumentMeta;
691
706
  timeline: Timeline | undefined;
692
707
  tracks: Track[] | undefined;
693
708
  part_library: Record<string, PartUnion> | undefined;
@@ -711,13 +726,13 @@ interface VideoDocumentValidationIssue {
711
726
  //#endregion
712
727
  //#region src/document/projection.d.ts
713
728
  /**
714
- * Projection between authoritative `VideoDocument` and compatible content
715
- * layouts (RFC 02 §5/§7). Both directions live here:
729
+ * Projection between the authoritative `VideoDocument` and the legacy
730
+ * `VideoDraft` read-view (RFC 02 §5/§7). Both directions live here:
716
731
  *
717
732
  * - `toVideoDocument` ingests a `VideoDraft`, deriving each item's `position`
718
733
  * from the legacy absolute layout + aggregations; derived values (abs time,
719
734
  * `part_aggregations`, total duration) are dropped.
720
- * - `fromVideoDocument` solves a `VideoDocument` into `VideoDraftContent` via the
735
+ * - `fromVideoDocument` solves a `VideoDocument` back into a `VideoDraft` via the
721
736
  * timeline-core cascade, re-deriving exactly those values.
722
737
  *
723
738
  * Business validation lives in `validation.ts`; `fromVideoDocument` asserts a
@@ -729,7 +744,7 @@ interface VideoDocumentValidationIssue {
729
744
  * aggregations (RFC 02 §4/§5). Absolute time, `part_aggregations`, and total
730
745
  * duration are dropped — they are re-derived by the projection.
731
746
  */
732
- declare function toVideoDocument(draft: Pick<VideoDraft, keyof VideoDraftContent>): VideoDocument;
747
+ declare function toVideoDocument(draft: VideoDraft): VideoDocument;
733
748
  /** speech/attachment part_id → its host video part_id + relative offset. */
734
749
  type SpeechHostMap = Map<string, {
735
750
  hostPartId: string;
@@ -769,8 +784,8 @@ interface DerivedItemPosition {
769
784
  */
770
785
  declare function derivePositionFromAbs(partId: string, abs: number, isMain: boolean, speechHost: SpeechHostMap, partLibrary: Record<string, PartUnion | string | undefined>): DerivedItemPosition;
771
786
  /**
772
- * Project `VideoDocument` into `VideoDraftContent`, solving each item's
773
- * absolute position, the `part_aggregations`, and
787
+ * Project the authoritative `VideoDocument` back into the legacy `VideoDraft`
788
+ * read-view, solving each item's absolute position, the `part_aggregations`, and
774
789
  * the total duration via the timeline-core cascade.
775
790
  *
776
791
  * The read-view is a compatibility contract, and the IDL declares
@@ -784,15 +799,32 @@ declare function derivePositionFromAbs(partId: string, abs: number, isMain: bool
784
799
  * These two are defaultable because the projection knows their values on its own:
785
800
  * absent `unit_time_ms` means "no display granularity was ever stated" and absent
786
801
  * `is_hidden` means "this track was never hidden". `version` is NOT defaultable
787
- * here — it belongs to Director assembly using the server envelope update_seq.
788
- * Neither business metadata nor a revision counter belongs in content projection.
802
+ * here — its only honest value is server state (`update_seq`) that a
803
+ * `VideoDocument` cannot see, so it stays absent and the HTTP layer fills it.
789
804
  */
790
- declare function fromVideoDocument(document: VideoDocument): VideoDraftContent;
805
+ declare function fromVideoDocument(document: VideoDocument): VideoDraft;
791
806
  //#endregion
792
807
  //#region src/document/initial-document.d.ts
808
+ /**
809
+ * The project facts a freshly created document is built from — exactly the five
810
+ * fields Director sets when it creates a draft row, and nothing else.
811
+ *
812
+ * Deliberately not a whole `VideoDraft`: tracks and the part library of a new
813
+ * document are empty by definition, so accepting them would mean accepting
814
+ * values that must always be empty, and every such field is a place for a future
815
+ * caller to send something that is silently dropped. The narrow shape makes the
816
+ * "a new document has no content" rule structural instead of a convention.
817
+ */
818
+ interface InitialDocumentFacts {
819
+ draftId: string;
820
+ projectId: string | undefined;
821
+ ownerId: string | undefined;
822
+ chatSessionId: string | undefined;
823
+ videoCreationSettings: VideoCreationSettings | undefined;
824
+ }
793
825
  /**
794
826
  * Build the `VideoDocument` a newly created project starts from: the caller's
795
- * no parts and one empty track per lane. Business facts remain in Director.
827
+ * project facts, no parts, and one empty track per lane.
796
828
  *
797
829
  * The empty lane tracks are the reason this function exists rather than callers
798
830
  * assembling a document inline. Lane tracks are otherwise minted lazily by the
@@ -813,7 +845,171 @@ declare function fromVideoDocument(document: VideoDocument): VideoDraftContent;
813
845
  * supplies, and total duration is derived on read (RFC 02 §6), so a new document
814
846
  * has no timeline fact to state.
815
847
  */
816
- declare function buildInitialVideoDocument(): VideoDocument;
848
+ declare function buildInitialVideoDocument(facts: InitialDocumentFacts): VideoDocument;
849
+ //#endregion
850
+ //#region ../medeo-dsl/src/ids.d.ts
851
+ declare const entityIdBrand: unique symbol;
852
+ declare const relationIdBrand: unique symbol;
853
+ type EntityId = string & {
854
+ readonly [entityIdBrand]: 'EntityId';
855
+ };
856
+ type RelationId = string & {
857
+ readonly [relationIdBrand]: 'RelationId';
858
+ };
859
+ //#endregion
860
+ //#region ../medeo-dsl/src/json-values.d.ts
861
+ type JsonPrimitive = string | number | boolean | null;
862
+ type JsonValue = JsonPrimitive | JsonObject | readonly JsonValue[];
863
+ type JsonObject = {
864
+ readonly [key: string]: JsonValue;
865
+ };
866
+ //#endregion
867
+ //#region ../medeo-dsl/src/entities.d.ts
868
+ type KnownEntityKind = 'axvideo' | 'timeline' | 'track' | 'clip' | 'asset' | 'video' | 'audio' | 'voice' | 'image' | 'sequence-marker' | 'viewport' | 'audio-script' | 'phonetic-script' | 'caption';
869
+ declare const extensionEntityKindBrand: unique symbol;
870
+ type ExtensionEntityKind = string & {
871
+ readonly [extensionEntityKindBrand]: 'ExtensionEntityKind';
872
+ };
873
+ /** Extensions require explicit branding so removed or reserved domain kinds cannot reappear accidentally. */
874
+ type EntityKind = KnownEntityKind | ExtensionEntityKind;
875
+ interface SequenceRange<Point = unknown> {
876
+ readonly start: Point;
877
+ readonly end: Point;
878
+ }
879
+ type SequenceDuration<Span = unknown> = {
880
+ readonly mode: 'from-source';
881
+ } | {
882
+ readonly mode: 'fixed';
883
+ readonly value: Span;
884
+ };
885
+ interface ScriptTextSegment {
886
+ readonly segmentId: string;
887
+ readonly text: string;
888
+ readonly language?: string;
889
+ }
890
+ interface VoiceDescriptor {
891
+ readonly system: 'voice-library';
892
+ readonly key: string;
893
+ readonly name?: string;
894
+ }
895
+ interface CaptionFontDescriptor {
896
+ readonly system: 'font-library';
897
+ readonly key: string;
898
+ }
899
+ interface CaptionStyleFields {
900
+ readonly font?: CaptionFontDescriptor;
901
+ readonly fontSize?: number;
902
+ readonly fontColor?: string;
903
+ readonly fontWeight?: number;
904
+ readonly entranceAnimation?: string;
905
+ readonly entranceAnimationDurationMs?: number;
906
+ readonly strokeColor?: string;
907
+ readonly strokeWidth?: number;
908
+ readonly positionX?: number;
909
+ readonly positionY?: number;
910
+ }
911
+ /**
912
+ * Half-open `[start, end)` position window inside one Segment's text, counted
913
+ * in Unicode code points (not UTF-16 code units), so a boundary never splits a
914
+ * surrogate pair. Positions are non-negative safe integers with `start < end`;
915
+ * `end` must not exceed the Segment's code-point length.
916
+ */
917
+ interface CaptionTextRange extends JsonObject {
918
+ readonly start: number;
919
+ readonly end: number;
920
+ }
921
+ /**
922
+ * The Caption's single text selection. `segmentId` quotes the
923
+ * composed AudioScript's own stable segment identity — a local id quoted by the
924
+ * variant, never a peer Entity reference. Text itself is never copied here;
925
+ * complete Caption content is assembled through its direct baseEntityIds.
926
+ * The optional `textRange` narrows one Segment to an intra-Segment sub-span
927
+ * (intra-segment re-segmentation); without it the whole Segment text is selected.
928
+ */
929
+ type CaptionSegmentSelection = JsonObject & {
930
+ readonly segmentId: string;
931
+ readonly textRange?: CaptionTextRange;
932
+ };
933
+ //#endregion
934
+ //#region ../medeo-dsl/src/relations.d.ts
935
+ type KnownRelationKind = 'timeline-track' | 'track-clip' | 'clip-marker' | 'marker-content' | 'axvideo-marker' | 'marker-timeline' | 'physical-asset' | 'generated' | 'caption-alignment' | 'clip-anchor' | 'phonetic-script-render' | 'audio-script-source' | 'audio-script-marker';
936
+ type RelationKind = KnownRelationKind | (string & {});
937
+ type RelationTrace = JsonObject;
938
+ /**
939
+ * Authoritative persisted relation value.
940
+ *
941
+ * A kind may assign semantic roles to endpoint 0 and endpoint 1. Callers and
942
+ * storage adapters must preserve the submitted positions; kinds whose
943
+ * semantics are unordered simply do not interpret those positions.
944
+ */
945
+ interface RelationRow<K extends RelationKind = RelationKind, Metadata extends JsonObject = JsonObject> {
946
+ readonly relationId: RelationId;
947
+ readonly endpoint0EntityId: EntityId;
948
+ readonly endpoint1EntityId: EntityId;
949
+ readonly relationKind: K;
950
+ readonly metadata: Metadata;
951
+ readonly trace: RelationTrace;
952
+ }
953
+ //#endregion
954
+ //#region ../medeo-dsl/src/rows.d.ts
955
+ /** One persisted first-class entity. Its owned fields live directly in payload. */
956
+ interface EntityRow<K extends EntityKind = EntityKind> {
957
+ readonly entityId: EntityId;
958
+ readonly entityKind: K;
959
+ readonly payload: JsonObject;
960
+ }
961
+ /** Complete persistence value for an entity set and its authoritative relations. */
962
+ interface EntityRelationRows {
963
+ readonly entities: readonly EntityRow[];
964
+ readonly relations: readonly RelationRow[];
965
+ }
966
+ //#endregion
967
+ //#region src/document/entity-projection-values.d.ts
968
+ /** A graph cannot be represented faithfully by the compatibility reader. */
969
+ declare class EntityTimelineProjectionError extends Error {
970
+ constructor(message: string);
971
+ }
972
+ //#endregion
973
+ //#region src/document/entity-projection.d.ts
974
+ /**
975
+ * One-way compatibility view over the Entity graph. A legacy part is never
976
+ * consulted as an editing fact. Peer IDs appear only in this derived read
977
+ * contract, reconstructed from relations; they are not stored in payloads.
978
+ */
979
+ declare function projectEntityTimeline(rows: EntityRelationRows, meta: VideoDocumentMeta): VideoDocument;
980
+ //#endregion
981
+ //#region src/document/entity-timeline-layout.d.ts
982
+ type EntityTimelineTrackRole = 'video_clip' | 'speech' | 'caption' | 'bgm';
983
+ interface ResolvedEntityClipPlacement {
984
+ readonly clipEntityId: string;
985
+ readonly markerEntityId: string;
986
+ readonly contentEntityId: string;
987
+ readonly trackEntityId: string;
988
+ readonly start: number;
989
+ readonly duration: number;
990
+ readonly mode: 'sequential' | 'absolute' | 'anchored';
991
+ readonly anchorClipEntityId?: string;
992
+ readonly anchorOffset?: number;
993
+ }
994
+ interface ResolvedEntityTrack {
995
+ readonly entityId: string;
996
+ readonly role: EntityTimelineTrackRole;
997
+ readonly order: number;
998
+ readonly hidden: boolean;
999
+ readonly clips: readonly ResolvedEntityClipPlacement[];
1000
+ }
1001
+ interface ResolvedEntityTimelineLayout {
1002
+ readonly tracks: readonly ResolvedEntityTrack[];
1003
+ readonly clips: ReadonlyMap<string, ResolvedEntityClipPlacement>;
1004
+ /** Background music fills this duration; it never extends the timeline. */
1005
+ readonly durationMs: number;
1006
+ }
1007
+ /**
1008
+ * Resolve only entity-owned placement facts. This does not choose new anchors,
1009
+ * manufacture clips, or mutate a graph while reading. Write-side operations
1010
+ * must express any detach/reparent/overlap decision in their entity plan.
1011
+ */
1012
+ declare function resolveEntityTimelineLayout(rows: EntityRelationRows): ResolvedEntityTimelineLayout;
817
1013
  //#endregion
818
1014
  //#region src/document/validation.d.ts
819
1015
  /**
@@ -845,6 +1041,29 @@ declare function validateVideoDocument(document: unknown): VideoDocumentValidati
845
1041
  //#endregion
846
1042
  //#region src/document/mirror-schema.d.ts
847
1043
  declare const videoDocumentMirrorSchema: import("loro-mirror").RootSchemaType<{
1044
+ meta: import("loro-mirror").LoroMapSchema<{
1045
+ schema_version: /*elided*/any;
1046
+ draft_id: /*elided*/any;
1047
+ project_id: /*elided*/any;
1048
+ owner_id: /*elided*/any;
1049
+ thumbnail_storage_key: /*elided*/any;
1050
+ chat_session_id: /*elided*/any;
1051
+ video_creation_settings: /*elided*/any;
1052
+ version: /*elided*/any;
1053
+ }> & {
1054
+ options: {};
1055
+ } & {
1056
+ catchall: <C extends import("loro-mirror").SchemaType>(catchallSchema: C) => import("loro-mirror").LoroMapSchemaWithCatchall<{
1057
+ schema_version: /*elided*/any;
1058
+ draft_id: /*elided*/any;
1059
+ project_id: /*elided*/any;
1060
+ owner_id: /*elided*/any;
1061
+ thumbnail_storage_key: /*elided*/any;
1062
+ chat_session_id: /*elided*/any;
1063
+ video_creation_settings: /*elided*/any;
1064
+ version: /*elided*/any;
1065
+ }, C>;
1066
+ };
848
1067
  timeline: import("loro-mirror").LoroMapSchema<{
849
1068
  unit_time_ms: /*elided*/any;
850
1069
  }> & {
@@ -909,611 +1128,35 @@ type TrackDraft = NonNullable<NonNullable<VideoDocumentDraft['tracks']>[number]>
909
1128
  /** A single track item in a draft. */
910
1129
  type TrackItemDraft = NonNullable<NonNullable<TrackDraft['items']>[number]>;
911
1130
  //#endregion
912
- //#region src/editor/schemas/add-speeches.d.ts
913
- /**
914
- * Add speeches (and their captions). TTS runs upstream; the stable speech /
915
- * caption parts arrive materialized (see `speech-assets.ts`). The op writes the
916
- * parts and each speech's `{ mode:'anchored', anchorPartId, offsetMs }` fact
917
- * verbatim — no write-time host-picking, no cascade (RFC 02 §4). The projection
918
- * derives absolute positions on read.
919
- */
920
- declare const addSpeechesInputSchema: z.ZodObject<{
921
- speeches: z.ZodArray<z.ZodObject<{
922
- speech_id: z.ZodString;
923
- anchor_part_id: z.ZodString;
924
- offset_ms: z.ZodNumber;
925
- audio_storage_key: z.ZodString;
926
- duration_ms: z.ZodNumber;
927
- audio_script: z.ZodString;
928
- volume: z.ZodNumber;
929
- voice: z.ZodObject<{
930
- id: z.ZodString;
931
- name: z.ZodString;
932
- }, z.core.$strip>;
933
- origin_speech_id: z.ZodString;
934
- caption_ids: z.ZodArray<z.ZodString>;
935
- }, z.core.$strip>>;
936
- captions: z.ZodArray<z.ZodObject<{
937
- caption_id: z.ZodString;
938
- speech_part_id: z.ZodString;
939
- text: z.ZodString;
940
- start_ms: z.ZodNumber;
941
- duration_ms: z.ZodNumber;
942
- }, z.core.$strip>>;
943
- }, z.core.$strip>;
944
- type AddSpeechesInput = z.infer<typeof addSpeechesInputSchema>;
945
- //#endregion
946
- //#region src/editor/schemas/add-video-clips.d.ts
1131
+ //#region src/editor/id-gen.d.ts
947
1132
  /**
948
- * Add video clips to a track. Each clip's duration facts are separated so a
949
- * single number is never overloaded (RFC 02 / `reference/16` §0b):
1133
+ * Part-id generation, aligned with the online ecosystem.
950
1134
  *
951
- * - `media_duration_ms` is the source media's intrinsic full length (a resource
952
- * fact, written to the part);
953
- * - `play_in` / `play_out` are the optional trim window into that media; when
954
- * omitted the whole media is used (`play_in=0`, `play_out=media_duration_ms`).
1135
+ * The authoritative online producers — agent-harness (`@harness/shared`
1136
+ * `genObjId`) and director.v2 (`common/obj_id.py` `gen_obj_id`) — both mint part
1137
+ * ids as `` `${prefix}_${ulid()}` ``, and real captured drafts use exactly that
1138
+ * shape (`clip_…` / `spe_…` / `cap_…` / `bgm_…`, each a 26-char ULID). The engine
1139
+ * previously emitted `vc_<base36 timestamp><6 random>`, a different prefix AND a
1140
+ * different encoding — the sole cross-repo id divergence. This module removes it
1141
+ * by emitting the same `<prefix>_<ULID>` bytes.
955
1142
  *
956
- * The clip's effective timeline duration is derived by the projection from the
957
- * trim window and `speed_shift` — it is never an input here.
958
- */
959
- declare const addVideoClipsInputSchema: z.ZodObject<{
960
- clips: z.ZodArray<z.ZodObject<{
961
- media_id: z.ZodString;
962
- start_ms: z.ZodOptional<z.ZodNumber>;
963
- media_duration_ms: z.ZodNumber;
964
- play_in: z.ZodOptional<z.ZodNumber>;
965
- play_out: z.ZodOptional<z.ZodNumber>;
966
- track_id: z.ZodOptional<z.ZodString>;
967
- }, z.core.$strip>>;
968
- before_clip_id: z.ZodOptional<z.ZodString>;
969
- after_clip_id: z.ZodOptional<z.ZodString>;
970
- }, z.core.$strip>;
971
- type AddVideoClipsInput = z.infer<typeof addVideoClipsInputSchema>;
972
- //#endregion
973
- //#region src/editor/schemas/adjust-bgm-volume.d.ts
974
- declare const adjustBgmVolumeInputSchema: z.ZodObject<{
975
- bgm: z.ZodArray<z.ZodObject<{
976
- bgm_id: z.ZodString;
977
- volume: z.ZodNumber;
978
- }, z.core.$strip>>;
979
- }, z.core.$strip>;
980
- type AdjustBgmVolumeInput = z.infer<typeof adjustBgmVolumeInputSchema>;
981
- //#endregion
982
- //#region src/editor/schemas/adjust-speech-volume.d.ts
983
- declare const adjustSpeechVolumeInputSchema: z.ZodObject<{
984
- speeches: z.ZodArray<z.ZodObject<{
985
- speech_id: z.ZodString;
986
- volume: z.ZodNumber;
987
- }, z.core.$strip>>;
988
- }, z.core.$strip>;
989
- type AdjustSpeechVolumeInput = z.infer<typeof adjustSpeechVolumeInputSchema>;
990
- //#endregion
991
- //#region src/editor/schemas/adjust-video-clip-duration.d.ts
992
- /**
993
- * Re-trim existing video clips (the user-facing "adjust duration" gesture is a
994
- * trim of the source window). The new `play_in` / `play_out` are the facts; the
995
- * effective timeline duration is derived from them and the clip's `speed_shift`,
996
- * and the change reflows downstream clips, speeches, and the timeline inside the
997
- * op's transaction (no caller-materialized cascade).
998
- */
999
- declare const adjustVideoClipDurationInputSchema: z.ZodObject<{
1000
- clips: z.ZodArray<z.ZodObject<{
1001
- clip_id: z.ZodString;
1002
- play_in: z.ZodNumber;
1003
- play_out: z.ZodNumber;
1004
- }, z.core.$strip>>;
1005
- }, z.core.$strip>;
1006
- type AdjustVideoClipDurationInput = z.infer<typeof adjustVideoClipDurationInputSchema>;
1007
- //#endregion
1008
- //#region src/editor/schemas/adjust-video-clip-volume.d.ts
1009
- declare const adjustVideoClipVolumeInputSchema: z.ZodObject<{
1010
- clips: z.ZodArray<z.ZodObject<{
1011
- clip_id: z.ZodString;
1012
- volume: z.ZodNumber;
1013
- }, z.core.$strip>>;
1014
- }, z.core.$strip>;
1015
- type AdjustVideoClipVolumeInput = z.infer<typeof adjustVideoClipVolumeInputSchema>;
1016
- //#endregion
1017
- //#region src/editor/schemas/change-speech.d.ts
1018
- /**
1019
- * Change a speech's script or voice. Both re-run TTS upstream and return the
1020
- * regenerated speech / caption parts in the same materialized shape as
1021
- * `AddSpeeches` (`speech-assets.ts`); the op upserts them by id (the speech part
1022
- * id is preserved across a re-TTS), re-seats at `start_ms`, and reflows. Old
1023
- * caption parts no longer owned by the speech are removed via `caption_ids`.
1024
- */
1025
- declare const changeSpeechScriptInputSchema: z.ZodObject<{
1026
- speeches: z.ZodArray<z.ZodObject<{
1027
- speech_id: z.ZodString;
1028
- anchor_part_id: z.ZodString;
1029
- offset_ms: z.ZodNumber;
1030
- audio_storage_key: z.ZodString;
1031
- duration_ms: z.ZodNumber;
1032
- audio_script: z.ZodString;
1033
- volume: z.ZodNumber;
1034
- voice: z.ZodObject<{
1035
- id: z.ZodString;
1036
- name: z.ZodString;
1037
- }, z.core.$strip>;
1038
- origin_speech_id: z.ZodString;
1039
- caption_ids: z.ZodArray<z.ZodString>;
1040
- }, z.core.$strip>>;
1041
- captions: z.ZodArray<z.ZodObject<{
1042
- caption_id: z.ZodString;
1043
- speech_part_id: z.ZodString;
1044
- text: z.ZodString;
1045
- start_ms: z.ZodNumber;
1046
- duration_ms: z.ZodNumber;
1047
- }, z.core.$strip>>;
1048
- }, z.core.$strip>;
1049
- declare const changeSpeechVoiceInputSchema: z.ZodObject<{
1050
- speeches: z.ZodArray<z.ZodObject<{
1051
- speech_id: z.ZodString;
1052
- anchor_part_id: z.ZodString;
1053
- offset_ms: z.ZodNumber;
1054
- audio_storage_key: z.ZodString;
1055
- duration_ms: z.ZodNumber;
1056
- audio_script: z.ZodString;
1057
- volume: z.ZodNumber;
1058
- voice: z.ZodObject<{
1059
- id: z.ZodString;
1060
- name: z.ZodString;
1061
- }, z.core.$strip>;
1062
- origin_speech_id: z.ZodString;
1063
- caption_ids: z.ZodArray<z.ZodString>;
1064
- }, z.core.$strip>>;
1065
- captions: z.ZodArray<z.ZodObject<{
1066
- caption_id: z.ZodString;
1067
- speech_part_id: z.ZodString;
1068
- text: z.ZodString;
1069
- start_ms: z.ZodNumber;
1070
- duration_ms: z.ZodNumber;
1071
- }, z.core.$strip>>;
1072
- }, z.core.$strip>;
1073
- type ChangeSpeechScriptInput = z.infer<typeof changeSpeechScriptInputSchema>;
1074
- type ChangeSpeechVoiceInput = z.infer<typeof changeSpeechVoiceInputSchema>;
1075
- //#endregion
1076
- //#region src/editor/schemas/delete-bgm.d.ts
1077
- /**
1078
- * Remove the document BGM. Pure document edit: clears the bgm lane and removes
1079
- * the bgm part. Takes no input (a document holds at most one bgm); an empty
1080
- * object keeps the op signature uniform with the rest.
1081
- */
1082
- declare const deleteBgmInputSchema: z.ZodObject<{}, z.core.$strip>;
1083
- type DeleteBgmInput = z.infer<typeof deleteBgmInputSchema>;
1084
- //#endregion
1085
- //#region src/editor/schemas/delete-speeches.d.ts
1086
- /**
1087
- * Delete speeches with their captions. Pure document edit (no side effect): the
1088
- * op removes each speech part, cascade-deletes the captions it owns (via
1089
- * `caption_ids` / `speech_part_id`), drops their track items, and reflows.
1090
- */
1091
- declare const deleteSpeechesInputSchema: z.ZodObject<{
1092
- speech_ids: z.ZodArray<z.ZodString>;
1093
- }, z.core.$strip>;
1094
- type DeleteSpeechesInput = z.infer<typeof deleteSpeechesInputSchema>;
1095
- //#endregion
1096
- //#region src/editor/schemas/delete-video-clips.d.ts
1097
- /**
1098
- * How a delete handles the anchored subtree (speeches anchored to a deleted clip,
1099
- * and their captions) — a delete-op policy, not a data-model field (reference/17
1100
- * §6). `cascade` (default) removes the subtree; `detach` keeps the direct
1101
- * anchored children, re-pinning them to `absolute` so they stay on the timeline.
1102
- */
1103
- declare const anchoredDeletePolicySchema: z.ZodEnum<{
1104
- cascade: "cascade";
1105
- detach: "detach";
1106
- }>;
1107
- type AnchoredDeletePolicy = z.infer<typeof anchoredDeletePolicySchema>;
1108
- declare const deleteVideoClipsInputSchema: z.ZodObject<{
1109
- clip_ids: z.ZodArray<z.ZodString>;
1110
- on_anchored: z.ZodOptional<z.ZodEnum<{
1111
- cascade: "cascade";
1112
- detach: "detach";
1113
- }>>;
1114
- }, z.core.$strip>;
1115
- type DeleteVideoClipsInput = z.infer<typeof deleteVideoClipsInputSchema>;
1116
- //#endregion
1117
- //#region src/editor/schemas/move-speeches.d.ts
1118
- /**
1119
- * Move speeches in time. Pure document edit: the op re-seats each speech at its
1120
- * new absolute `start_ms`; the cascade reassigns it to the host video clip,
1121
- * resolves overlaps, and reflows. Captions follow their speech.
1122
- */
1123
- declare const moveSpeechesInputSchema: z.ZodObject<{
1124
- speeches: z.ZodArray<z.ZodObject<{
1125
- speech_id: z.ZodString;
1126
- new_start_ms: z.ZodNumber;
1127
- }, z.core.$strip>>;
1128
- }, z.core.$strip>;
1129
- type MoveSpeechesInput = z.infer<typeof moveSpeechesInputSchema>;
1130
- //#endregion
1131
- //#region src/editor/schemas/move-video-clips-by-anchor.d.ts
1132
- /**
1133
- * Where the moved block lands on the main track.
1134
- *
1135
- * A discriminated union rather than two optional `before_clip_id` /
1136
- * `after_clip_id` fields (the shape `addVideoClips` had to use, because there the
1137
- * two modes share a whole clip description): here the alternatives carry nothing
1138
- * in common, so making them mutually exclusive *by type* removes three runtime
1139
- * `superRefine` checks that would otherwise have to be written and tested.
1140
- *
1141
- * `track_start` is an explicit member, not the absence of an anchor. The
1142
- * agent-harness mutation this maps from treats "neither anchor given" as
1143
- * "move to the front" (`applyBatchMoveVideoClips` falls back to `insertIndex = 0`),
1144
- * which is a default buried in a tool description. Requiring the caller to name
1145
- * that intent keeps a forgotten field from silently reordering the timeline.
1146
- */
1147
- declare const moveAnchorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1148
- position: z.ZodLiteral<"before">;
1149
- clip_id: z.ZodString;
1150
- }, z.core.$strip>, z.ZodObject<{
1151
- position: z.ZodLiteral<"after">;
1152
- clip_id: z.ZodString;
1153
- }, z.core.$strip>, z.ZodObject<{
1154
- position: z.ZodLiteral<"track_start">;
1155
- }, z.core.$strip>], "position">;
1156
- /**
1157
- * What happens to the speeches anchored to the clips being moved.
1158
- *
1159
- * - `follow` keeps each speech anchored where it is, so it travels with its clip
1160
- * to the new position. In the anchored model this is the *no-op* branch: a
1161
- * speech's authoritative fact is `{ anchorPartId, offsetMs }` and its absolute
1162
- * time is derived on read from the host's position, so moving the host moves
1163
- * the speech with no write to the speech at all.
1164
- * - `keep_absolute` preserves each speech's current absolute landing instead, then
1165
- * re-anchors it to whichever clip now covers that time (RFC 02 §9.1/§11.1). This
1166
- * is the branch that costs an extra pass, and the one the FE timeline uses.
1167
- *
1168
- * **Required, with no default**, matching `deleteVideoClips` and
1169
- * `replaceVideoClipSequence`. The two branches decide which picture the user's
1170
- * narration ends up over, which is too consequential to infer from a missing
1171
- * field — and neither branch is "safe enough" to be the implicit one.
1172
- */
1173
- declare const movedClipAnchoredPolicySchema: z.ZodEnum<{
1174
- follow: "follow";
1175
- keep_absolute: "keep_absolute";
1176
- }>;
1177
- /**
1178
- * Reorder a set of main-track clips relative to a reference clip.
1179
- *
1180
- * Distinct from `moveVideoClips`, which positions clips by absolute time
1181
- * (`new_start_ms`) and is what the FE timeline dispatches after a drag. Main-track
1182
- * clips are `sequential`-positioned, so absolute time is not authoritative state
1183
- * there (RFC 02 §4/§7): `moveVideoClips` has to *guess* an index back out of the
1184
- * time it was handed, whereas an anchor already is the ordinal fact being changed.
1185
- * Keeping them separate also isolates blast radius — this method can diverge on
1186
- * speech policy without touching the FE path.
1187
- *
1188
- * `clip_ids` need not be contiguous. They move as one block, keeping their
1189
- * relative order, which is the agent-harness `batch_move_video_clips` contract.
1190
- */
1191
- declare const moveVideoClipsByAnchorInputSchema: z.ZodObject<{
1192
- clip_ids: z.ZodArray<z.ZodString>;
1193
- anchor: z.ZodDiscriminatedUnion<[z.ZodObject<{
1194
- position: z.ZodLiteral<"before">;
1195
- clip_id: z.ZodString;
1196
- }, z.core.$strip>, z.ZodObject<{
1197
- position: z.ZodLiteral<"after">;
1198
- clip_id: z.ZodString;
1199
- }, z.core.$strip>, z.ZodObject<{
1200
- position: z.ZodLiteral<"track_start">;
1201
- }, z.core.$strip>], "position">;
1202
- on_anchored: z.ZodEnum<{
1203
- follow: "follow";
1204
- keep_absolute: "keep_absolute";
1205
- }>;
1206
- }, z.core.$strip>;
1207
- type MoveAnchor = z.infer<typeof moveAnchorSchema>;
1208
- type MovedClipAnchoredPolicy = z.infer<typeof movedClipAnchoredPolicySchema>;
1209
- type MoveVideoClipsByAnchorInput = z.infer<typeof moveVideoClipsByAnchorInputSchema>;
1210
- //#endregion
1211
- //#region src/editor/schemas/move-video-clips.d.ts
1212
- declare const moveVideoClipsInputSchema: z.ZodObject<{
1213
- clips: z.ZodArray<z.ZodObject<{
1214
- clip_id: z.ZodString;
1215
- new_start_ms: z.ZodNumber;
1216
- new_track_id: z.ZodOptional<z.ZodString>;
1217
- }, z.core.$strip>>;
1218
- }, z.core.$strip>;
1219
- type MoveVideoClipsInput = z.infer<typeof moveVideoClipsInputSchema>;
1220
- //#endregion
1221
- //#region src/editor/schemas/replace-video-clip-content.d.ts
1222
- /**
1223
- * Replace the media backing existing video clips. The media import runs upstream
1224
- * (Director); its stable result — the new media id, intrinsic length, and the
1225
- * reset trim window — arrives materialized (see
1226
- * `results/phase-4-side-effect-payload-contract.md` §4). Director resets
1227
- * `play_in=0` / `play_out=media_duration_ms` and clears `speed_shift` on
1228
- * replacement. The clip `part_id`s (hence their track items) are unchanged; the
1229
- * editor reflows the main track from the new effective durations.
1230
- */
1231
- declare const replaceVideoClipContentInputSchema: z.ZodObject<{
1232
- clips: z.ZodArray<z.ZodObject<{
1233
- clip_id: z.ZodString;
1234
- origin_media_id: z.ZodString;
1235
- media_duration_ms: z.ZodNumber;
1236
- play_in: z.ZodNumber;
1237
- play_out: z.ZodNumber;
1238
- volume: z.ZodNumber;
1239
- }, z.core.$strip>>;
1240
- }, z.core.$strip>;
1241
- type ReplaceVideoClipContentInput = z.infer<typeof replaceVideoClipContentInputSchema>;
1242
- //#endregion
1243
- //#region src/editor/schemas/replace-video-clip-sequence.d.ts
1244
- /**
1245
- * What happens to the speeches anchored to the clips being replaced.
1246
- *
1247
- * - `remap` re-anchors each surviving speech to the new clip in the SAME POSITION
1248
- * of the sequence, keeping its offset — old[i]'s children become new[i]'s
1249
- * children. An old clip with no counterpart (fewer new clips than old) has its
1250
- * subtree deleted, because there is nothing left to anchor to.
1251
- * - `cascade` deletes every anchored speech (and its captions) outright, like
1252
- * `deleteVideoClips`.
1253
- *
1254
- * **Required, with no default.** The two branches differ in whether the user's
1255
- * narration survives, and the agent tool that drives this op makes its
1256
- * `preserve_speeches` flag required for that reason. A default here would let a
1257
- * caller that forgot the field silently delete speech.
1258
- */
1259
- declare const anchoredReplacePolicySchema: z.ZodEnum<{
1260
- cascade: "cascade";
1261
- remap: "remap";
1262
- }>;
1263
- type AnchoredReplacePolicy = z.infer<typeof anchoredReplacePolicySchema>;
1264
- /**
1265
- * Replace a contiguous run of main-track clips with a new run.
1266
- *
1267
- * A composite of delete + insert that cannot be expressed as the two ops in
1268
- * sequence, because the anchored speeches have to survive *across* the swap: with
1269
- * `remap` they are re-anchored positionally, which needs both the old and the new
1270
- * ids in the same transaction (ADR 0009 — the cascade stays in the editor, callers
1271
- * never re-wire anchors themselves).
1272
- *
1273
- * Duration facts follow `addVideoClips`: `media_duration_ms` is the source's
1274
- * intrinsic length and the trim window defaults to the whole media. The effective
1275
- * timeline duration is derived by the projection, never an input.
1276
- *
1277
- * `media_id` is optional: omitting it creates a **deliberate empty placeholder
1278
- * clip** (`origin_media_id: ''`) — structure with no picture. This is the only op
1279
- * that can produce one, and it is authoritative state, unlike the gap fillers the
1280
- * read-side solve mints (which never enter the document).
1281
- */
1282
- declare const replaceVideoClipSequenceInputSchema: z.ZodObject<{
1283
- old_clip_ids: z.ZodArray<z.ZodString>;
1284
- new_clips: z.ZodArray<z.ZodObject<{
1285
- media_id: z.ZodOptional<z.ZodString>;
1286
- media_duration_ms: z.ZodNumber;
1287
- play_in: z.ZodOptional<z.ZodNumber>;
1288
- play_out: z.ZodOptional<z.ZodNumber>;
1289
- }, z.core.$strip>>;
1290
- on_anchored: z.ZodEnum<{
1291
- cascade: "cascade";
1292
- remap: "remap";
1293
- }>;
1294
- }, z.core.$strip>;
1295
- type ReplaceVideoClipSequenceInput = z.infer<typeof replaceVideoClipSequenceInputSchema>;
1296
- //#endregion
1297
- //#region src/editor/schemas/set-bgm.d.ts
1298
- /**
1299
- * Set the document BGM. The media's stable result (storage key) arrives
1300
- * materialized from upstream (see
1301
- * `results/phase-4-side-effect-payload-contract.md` §3). The op upserts the bgm
1302
- * part and seats it on the bgm lane; its effective length is always the whole
1303
- * timeline, derived by the projection on read — so there is no `duration_ms`
1304
- * input or fact (RFC 02 / `reference/16` §0b). A `bgm_id` lets the op replace an
1305
- * existing bgm part by id.
1306
- */
1307
- declare const setBgmInputSchema: z.ZodObject<{
1308
- bgm_id: z.ZodString;
1309
- audio_storage_key: z.ZodString;
1310
- origin_media_id: z.ZodString;
1311
- volume: z.ZodNumber;
1312
- }, z.core.$strip>;
1313
- type SetBgmInput = z.infer<typeof setBgmInputSchema>;
1314
- //#endregion
1315
- //#region src/editor/schemas/set-caption-style.d.ts
1316
- /**
1317
- * Set the caption visual style. GLOBAL by design: the style applies to every
1318
- * caption part in the document — it carries NO `caption_id`. This mirrors the FE,
1319
- * whose caption-style store (`caption-style.ts:persistCaptionStylePatch`) iterates
1320
- * ALL captions and writes the same normalized style to each; the product has a
1321
- * single document-wide caption style, not per-caption styling.
1322
- *
1323
- * Every field is optional and maps to a `CaptionStyle` attribute (snake_case
1324
- * IDL). A field present in the input is written to every caption; a field ABSENT
1325
- * from the input is left untouched on each caption (the editor merges the patch
1326
- * onto each caption's existing style — this is a value edit, not a full-style
1327
- * replace, so a partial patch such as "recolor only" does not wipe font size).
1328
- *
1329
- * Pure document edit, no cascade — captions keep their positions; only the style
1330
- * sub-map of each caption part changes.
1331
- */
1332
- declare const setCaptionStyleInputSchema: z.ZodObject<{
1333
- font_id: z.ZodOptional<z.ZodString>;
1334
- font_size: z.ZodOptional<z.ZodNumber>;
1335
- font_color: z.ZodOptional<z.ZodString>;
1336
- font_weight: z.ZodOptional<z.ZodNumber>;
1337
- entrance_animation: z.ZodOptional<z.ZodString>;
1338
- entrance_animation_duration_ms: z.ZodOptional<z.ZodNumber>;
1339
- stroke_color: z.ZodOptional<z.ZodString>;
1340
- stroke_width: z.ZodOptional<z.ZodNumber>;
1341
- position_x: z.ZodOptional<z.ZodNumber>;
1342
- position_y: z.ZodOptional<z.ZodNumber>;
1343
- }, z.core.$strip>;
1344
- type SetCaptionStyleInput = z.infer<typeof setCaptionStyleInputSchema>;
1345
- //#endregion
1346
- //#region src/editor/schemas/set-caption-visibility.d.ts
1347
- /**
1348
- * Toggle caption visibility (the caption track's `is_hidden` flag). Pure
1349
- * document edit, no cascade — captions keep their positions; only the lane's
1350
- * hidden flag changes.
1351
- */
1352
- declare const setCaptionVisibilityInputSchema: z.ZodObject<{
1353
- is_hidden: z.ZodBoolean;
1354
- }, z.core.$strip>;
1355
- type SetCaptionVisibilityInput = z.infer<typeof setCaptionVisibilityInputSchema>;
1356
- //#endregion
1357
- //#region src/editor/schemas/set-video-clip-speed-shift.d.ts
1358
- /**
1359
- * Set the playback speed of existing video clips. Per the speed-shift decision
1360
- * (`reference/16` §0): the op writes only the `speed_shift` fact — it does NOT
1361
- * store an effective `duration_ms` (projection derives it from the trim window /
1362
- * speed) and does NOT scale anchored speeches' relative offsets (offsets stay
1363
- * put; the cascade reflows absolute positions). A `null` speed_shift clears the
1364
- * speed back to original (1×).
1365
- */
1366
- declare const setVideoClipSpeedShiftInputSchema: z.ZodObject<{
1367
- clips: z.ZodArray<z.ZodObject<{
1368
- clip_id: z.ZodString;
1369
- speed_shift: z.ZodNullable<z.ZodObject<{
1370
- category: z.ZodEnum<{
1371
- curve: "curve";
1372
- linear: "linear";
1373
- }>;
1374
- mode: z.ZodString;
1375
- config: z.ZodUnion<readonly [z.ZodObject<{
1376
- linear: z.ZodObject<{
1377
- speed: z.ZodNumber;
1378
- }, z.core.$strip>;
1379
- }, z.core.$strip>, z.ZodObject<{
1380
- curve: z.ZodObject<{
1381
- keyframes: z.ZodArray<z.ZodObject<{
1382
- position: z.ZodNumber;
1383
- rate: z.ZodNumber;
1384
- in_tangent: z.ZodOptional<z.ZodObject<{
1385
- x: z.ZodNumber;
1386
- y: z.ZodNumber;
1387
- }, z.core.$strip>>;
1388
- out_tangent: z.ZodOptional<z.ZodObject<{
1389
- x: z.ZodNumber;
1390
- y: z.ZodNumber;
1391
- }, z.core.$strip>>;
1392
- }, z.core.$strip>>;
1393
- }, z.core.$strip>;
1394
- }, z.core.$strip>]>;
1395
- }, z.core.$strip>>;
1396
- }, z.core.$strip>>;
1397
- }, z.core.$strip>;
1398
- type SetVideoClipSpeedShiftInput = z.infer<typeof setVideoClipSpeedShiftInputSchema>;
1399
- //#endregion
1400
- //#region src/editor/schemas/shared.d.ts
1401
- declare const clipIdSchema: z.ZodString;
1402
- declare const clipIdsSchema: z.ZodArray<z.ZodString>;
1403
- declare const mediaIdSchema: z.ZodString;
1404
- declare const speechIdSchema: z.ZodString;
1405
- declare const timelineMsSchema: z.ZodNumber;
1406
- declare const positiveMsSchema: z.ZodNumber;
1407
- declare const volumeSchema: z.ZodNumber;
1408
- declare const speechIdsSchema: z.ZodArray<z.ZodString>;
1409
- /**
1410
- * A clip's playback-speed fact, the only thing `SetVideoClipSpeedShift` writes.
1411
- * Mirrors the IDL `SpeedShift`: `category` is `linear` | `curve`, and `config`
1412
- * is a discriminated union — `{ linear: { speed } }` for a constant multiplier
1413
- * (the multiplier projection reads at `config.linear.speed`) or `{ curve: {
1414
- * keyframes } }` for a Bezier-controlled variable speed (RFC 02 / `reference/16`
1415
- * §0). Exactly one of `linear` / `curve` is present.
1416
- */
1417
- declare const speedShiftSchema: z.ZodObject<{
1418
- category: z.ZodEnum<{
1419
- curve: "curve";
1420
- linear: "linear";
1421
- }>;
1422
- mode: z.ZodString;
1423
- config: z.ZodUnion<readonly [z.ZodObject<{
1424
- linear: z.ZodObject<{
1425
- speed: z.ZodNumber;
1426
- }, z.core.$strip>;
1427
- }, z.core.$strip>, z.ZodObject<{
1428
- curve: z.ZodObject<{
1429
- keyframes: z.ZodArray<z.ZodObject<{
1430
- position: z.ZodNumber;
1431
- rate: z.ZodNumber;
1432
- in_tangent: z.ZodOptional<z.ZodObject<{
1433
- x: z.ZodNumber;
1434
- y: z.ZodNumber;
1435
- }, z.core.$strip>>;
1436
- out_tangent: z.ZodOptional<z.ZodObject<{
1437
- x: z.ZodNumber;
1438
- y: z.ZodNumber;
1439
- }, z.core.$strip>>;
1440
- }, z.core.$strip>>;
1441
- }, z.core.$strip>;
1442
- }, z.core.$strip>]>;
1443
- }, z.core.$strip>;
1444
- declare const voiceSchema: z.ZodObject<{
1445
- id: z.ZodString;
1446
- name: z.ZodString;
1447
- }, z.core.$strip>;
1448
- //#endregion
1449
- //#region src/editor/schemas/speech-assets.d.ts
1450
- /**
1451
- * The materialized TTS result shared by `AddSpeeches` / `ChangeSpeechScript` /
1452
- * `ChangeSpeechVoice` (see `results/phase-4-side-effect-payload-contract.md`
1453
- * §1/§2). The side effect (TTS/ASR + billing) runs upstream; the op receives the
1454
- * stable speech + caption parts and writes them as authoritative facts. No
1455
- * cascade runs on write — the projection derives absolute positions on read.
1456
- *
1457
- * Each speech carries the anchoring fact directly (RFC 02 §4): the host video
1458
- * clip `anchor_part_id` and the `offset_ms` within it. The upstream caller
1459
- * already knows which clip a speech attaches to, so the op writes
1460
- * `{ mode:'anchored', anchorPartId, offsetMs }` verbatim — no write-time
1461
- * host-picking. Captions anchor to their speech via the caption part's
1462
- * `start_ms` (offset within the speech).
1463
- */
1464
- declare const speechAssetSchema: z.ZodObject<{
1465
- speech_id: z.ZodString;
1466
- anchor_part_id: z.ZodString;
1467
- offset_ms: z.ZodNumber;
1468
- audio_storage_key: z.ZodString;
1469
- duration_ms: z.ZodNumber;
1470
- audio_script: z.ZodString;
1471
- volume: z.ZodNumber;
1472
- voice: z.ZodObject<{
1473
- id: z.ZodString;
1474
- name: z.ZodString;
1475
- }, z.core.$strip>;
1476
- origin_speech_id: z.ZodString;
1477
- caption_ids: z.ZodArray<z.ZodString>;
1478
- }, z.core.$strip>;
1479
- declare const captionAssetSchema: z.ZodObject<{
1480
- caption_id: z.ZodString;
1481
- speech_part_id: z.ZodString;
1482
- text: z.ZodString;
1483
- start_ms: z.ZodNumber;
1484
- duration_ms: z.ZodNumber;
1485
- }, z.core.$strip>;
1486
- /** A materialized speech-subtree write (speeches + their captions). */
1487
- declare const speechAssetsSchema: z.ZodObject<{
1488
- speeches: z.ZodArray<z.ZodObject<{
1489
- speech_id: z.ZodString;
1490
- anchor_part_id: z.ZodString;
1491
- offset_ms: z.ZodNumber;
1492
- audio_storage_key: z.ZodString;
1493
- duration_ms: z.ZodNumber;
1494
- audio_script: z.ZodString;
1495
- volume: z.ZodNumber;
1496
- voice: z.ZodObject<{
1497
- id: z.ZodString;
1498
- name: z.ZodString;
1499
- }, z.core.$strip>;
1500
- origin_speech_id: z.ZodString;
1501
- caption_ids: z.ZodArray<z.ZodString>;
1502
- }, z.core.$strip>>;
1503
- captions: z.ZodArray<z.ZodObject<{
1504
- caption_id: z.ZodString;
1505
- speech_part_id: z.ZodString;
1506
- text: z.ZodString;
1507
- start_ms: z.ZodNumber;
1508
- duration_ms: z.ZodNumber;
1509
- }, z.core.$strip>>;
1510
- }, z.core.$strip>;
1511
- type SpeechAsset = z.infer<typeof speechAssetSchema>;
1512
- type CaptionAsset = z.infer<typeof captionAssetSchema>;
1513
- type SpeechAssets = z.infer<typeof speechAssetsSchema>;
1514
- declare namespace index_d_exports {
1515
- export { AddSpeechesInput, AddVideoClipsInput, AdjustBgmVolumeInput, AdjustSpeechVolumeInput, AdjustVideoClipDurationInput, AdjustVideoClipVolumeInput, AnchoredDeletePolicy, AnchoredReplacePolicy, CaptionAsset, ChangeSpeechScriptInput, ChangeSpeechVoiceInput, DeleteBgmInput, DeleteSpeechesInput, DeleteVideoClipsInput, MoveAnchor, MoveSpeechesInput, MoveVideoClipsByAnchorInput, MoveVideoClipsInput, MovedClipAnchoredPolicy, ReplaceVideoClipContentInput, ReplaceVideoClipSequenceInput, SetBgmInput, SetCaptionStyleInput, SetCaptionVisibilityInput, SetVideoClipSpeedShiftInput, SpeechAsset, SpeechAssets, addSpeechesInputSchema, addVideoClipsInputSchema, adjustBgmVolumeInputSchema, adjustSpeechVolumeInputSchema, adjustVideoClipDurationInputSchema, adjustVideoClipVolumeInputSchema, anchoredDeletePolicySchema, anchoredReplacePolicySchema, changeSpeechScriptInputSchema, changeSpeechVoiceInputSchema, clipIdSchema, clipIdsSchema, deleteBgmInputSchema, deleteSpeechesInputSchema, deleteVideoClipsInputSchema, mediaIdSchema, moveAnchorSchema, moveSpeechesInputSchema, moveVideoClipsByAnchorInputSchema, moveVideoClipsInputSchema, movedClipAnchoredPolicySchema, positiveMsSchema, replaceVideoClipContentInputSchema, replaceVideoClipSequenceInputSchema, setBgmInputSchema, setCaptionStyleInputSchema, setCaptionVisibilityInputSchema, setVideoClipSpeedShiftInputSchema, speechAssetsSchema, speechIdSchema, speechIdsSchema, speedShiftSchema, timelineMsSchema, voiceSchema, volumeSchema };
1516
- }
1143
+ * The ULID is generated inline (Crockford Base32, 48-bit time + 80-bit random)
1144
+ * rather than pulling the `ulid` npm package: the randomness class matches the
1145
+ * old generator (both `Math.random`-based) and it keeps `@mengine/medeo-client`
1146
+ * dependency-free for a purely mechanical id string. Part ids only need to be
1147
+ * unique and lexicographically time-sortable, which this satisfies.
1148
+ */
1149
+ /**
1150
+ * Online part-id semantic prefixes. `clip` (video clip) is the only value the
1151
+ * engine currently mints (see `addVideoClips`); the rest are declared so the
1152
+ * type documents the shared vocabulary and guards against reintroducing the old
1153
+ * `vc`/`sp`/`cp`/`bg` names. Speech/caption/bgm ids arrive pre-minted in op
1154
+ * payloads, so the engine never generates them itself.
1155
+ */
1156
+ type PartIdPrefix = 'clip' | 'spe' | 'cap' | 'bgm' | 'ti';
1157
+ declare function generatePartId(prefix: PartIdPrefix): string;
1158
+ /** Injectable part-id mint; defaults to `generatePartId` on `SemanticEditor`. */
1159
+ type PartIdFactory = (prefix: PartIdPrefix) => string;
1517
1160
  //#endregion
1518
1161
  //#region src/editor/schema-validator.d.ts
1519
1162
  interface SnapshotReadable {
@@ -1667,10 +1310,15 @@ interface OpActor {
1667
1310
  role: 'user' | 'agent';
1668
1311
  }
1669
1312
  interface CommitOptions {
1670
- intent?: {
1671
- kind: string;
1672
- payload: unknown;
1673
- };
1313
+ /**
1314
+ * Caller-supplied intent attached to the op's audit message.
1315
+ *
1316
+ * Typed as `unknown` to match `TransactAudit.intent`. The wire (real
1317
+ * mengine-server and the in-memory test double) only surfaces **string**
1318
+ * intents onto the audit log — non-string values stay in the Loro commit
1319
+ * message but parse to `null`. Agent callers should pass a string.
1320
+ */
1321
+ intent?: unknown;
1674
1322
  /** Author of this op; omitted for writes with no acting user (bootstrap, repair). */
1675
1323
  actor?: OpActor;
1676
1324
  }
@@ -1702,19 +1350,21 @@ interface TransactAudit {
1702
1350
  * position. The caller never materializes a layout (ADR 0009).
1703
1351
  */
1704
1352
  interface SemanticDocumentAdapter extends SnapshotReadable {
1353
+ /** True once the document holds real content (a bootstrapped/synced snapshot). */
1354
+ hasContent(): boolean;
1705
1355
  /**
1706
- * Apply one op's domain mutation in a single synchronous transaction. `edit`
1707
- * must finish before returning; async callbacks/await are unsupported. The
1708
- * adapter diffs the resulting draft and commits once with `audit`.
1356
+ * Apply one op's whole mutation in a single transaction. `edit` mutates the
1357
+ * document draft; the adapter diffs the result and commits once with `audit`.
1709
1358
  * A throw in `edit` rolls back (the draft is discarded, Loro untouched). An
1710
- * edit that changes nothing produces no domain commit (no phantom undo step).
1359
+ * edit that changes nothing produces no commit (no phantom audit entry).
1711
1360
  */
1712
1361
  transact(edit: (draft: VideoDocumentDraft) => void, audit: TransactAudit): void;
1713
1362
  }
1714
1363
  declare class SemanticEditor {
1715
1364
  private readonly doc;
1716
1365
  private readonly validator;
1717
- constructor(doc: SemanticDocumentAdapter, validator?: SchemaValidator);
1366
+ private readonly idFactory;
1367
+ constructor(doc: SemanticDocumentAdapter, validator?: SchemaValidator, idFactory?: PartIdFactory);
1718
1368
  moveVideoClips(input: MoveVideoClipsInput, options?: CommitOptions): Promise<void>;
1719
1369
  /**
1720
1370
  * Reorder main-track clips relative to an anchor clip, moving them as one block.
@@ -1842,19 +1492,6 @@ declare class SemanticEditor {
1842
1492
  private computeAddInsertIndex;
1843
1493
  }
1844
1494
  //#endregion
1845
- //#region src/document/document-mutation-guard.d.ts
1846
- /**
1847
- * @internal
1848
- * Shared by synchronous mutation entry points for one document. The session
1849
- * closes it before teardown callbacks can attempt another write.
1850
- */
1851
- declare class DocumentMutationGuard {
1852
- private running;
1853
- private closed;
1854
- run<T>(mutation: () => T): T;
1855
- close(): void;
1856
- }
1857
- //#endregion
1858
1495
  //#region src/document/mirror-adapter.d.ts
1859
1496
  interface MirrorVideoDocumentOptions {
1860
1497
  peerId?: PeerID;
@@ -1870,23 +1507,22 @@ interface MirrorVideoDocumentOptions {
1870
1507
  * - `transact(edit, audit)` runs the whole op in one `mirror.setState` callback:
1871
1508
  * one diff, one `doc.commit` carrying the audit message. The callback edits an
1872
1509
  * immer draft, so a throw inside it discards the draft and never touches Loro
1873
- * (natural rollback) without a document checkout or compensating commit.
1510
+ * (natural rollback) — no `guard` / `rollback` / `openTransaction` machinery.
1874
1511
  * - mirror's `idSelector` (track items keyed by `part_id`) diffs reorders to
1875
1512
  * real Loro `move` ops on every lane, so per-item CRDT identity survives on
1876
1513
  * main and secondary tracks alike.
1877
1514
  */
1878
1515
  declare class MirrorVideoDocumentAdapter implements SemanticDocumentAdapter {
1879
1516
  readonly doc: LoroDoc;
1880
- private readonly mutationGuard;
1881
1517
  private readonly mirror;
1882
- private disposed;
1883
- constructor(doc: LoroDoc, mutationGuard?: DocumentMutationGuard);
1518
+ constructor(doc: LoroDoc);
1884
1519
  snapshot(): VideoDocument;
1885
1520
  /**
1886
- * Release mirror subscriptions; do not reuse this adapter afterwards.
1887
- * The caller still owns the borrowed LoroDoc.
1521
+ * True once the doc holds real document content. A fresh mirror over an empty
1522
+ * doc still reports defaulted root maps, so probe the stored `schema_version`
1523
+ * (empty until a snapshot is bootstrapped or synced in).
1888
1524
  */
1889
- dispose(): void;
1525
+ hasContent(): boolean;
1890
1526
  /**
1891
1527
  * Apply one op as a single transaction. `edit` mutates the immer draft; mirror
1892
1528
  * diffs the result and commits once with the audit `message`. A throw in `edit`
@@ -1894,20 +1530,72 @@ declare class MirrorVideoDocumentAdapter implements SemanticDocumentAdapter {
1894
1530
  * skips the commit — matching the prior "empty op leaves no audit" behavior.
1895
1531
  */
1896
1532
  transact(edit: (draft: VideoDocumentDraft) => void, audit: TransactAudit): void;
1897
- private assertActive;
1898
1533
  }
1899
1534
  /** Build a fresh Loro doc seeded with `document` through the mirror. */
1900
1535
  declare function createMirrorVideoDocument(document: VideoDocument, options?: MirrorVideoDocumentOptions): LoroDoc;
1901
1536
  /** Build a `MirrorVideoDocumentAdapter` over a fresh doc seeded with `document`. */
1902
1537
  declare function createMirrorVideoDocumentAdapter(document: VideoDocument, options?: MirrorVideoDocumentOptions): MirrorVideoDocumentAdapter;
1538
+ /** Host-only replacement of a derived view, retaining the existing Loro history. */
1539
+ declare function applyEntityTimelineProjection(doc: LoroDoc, projection: VideoDocument, entityRevision: number): Uint8Array;
1540
+ /** Write a whole `VideoDocument` into a draft (seed a fresh doc / plain-memory state). */
1541
+ declare function writeVideoDocumentToDraft(draft: VideoDocumentDraft, document: VideoDocument): void;
1542
+ //#endregion
1543
+ //#region src/document/plain-memory-adapter.d.ts
1544
+ /**
1545
+ * A `TransactAudit` widened with the ordered ids minted during that transact.
1546
+ * `generated_ids` is empty when the op never called the id factory.
1547
+ */
1548
+ interface JournalEntry extends TransactAudit {
1549
+ /** Ids produced by the adapter's id factory during this transact, in mint order. */
1550
+ generated_ids: string[];
1551
+ }
1552
+ interface PlainMemoryAdapterOptions {
1553
+ /** Underlying id mint; wrapped so each call inside a transact is journaled. */
1554
+ idFactory?: PartIdFactory;
1555
+ }
1556
+ /**
1557
+ * Pure in-memory `SemanticDocumentAdapter` — no Loro/WASM. Holds a
1558
+ * `VideoDocumentDraft` object and applies each `transact` via immer `produce`,
1559
+ * journaling every audit that actually mutated state (plus any ids minted
1560
+ * during that transact).
1561
+ *
1562
+ * Known benign difference vs `MirrorVideoDocumentAdapter`: the editor's
1563
+ * `setPart` assigns a fresh part object on every call, so a same-value rewrite
1564
+ * produces a new immer state and IS journaled here, while the mirror's deep
1565
+ * diff emits no commit. Terminal `snapshot()` stays equal; replay is idempotent.
1566
+ */
1567
+ declare class PlainMemoryAdapter implements SemanticDocumentAdapter {
1568
+ private state;
1569
+ private readonly _journal;
1570
+ private readonly baseIdFactory;
1571
+ /** Non-null only while a `transact` edit callback is running. */
1572
+ private pendingIds;
1573
+ /**
1574
+ * Recording wrapper around the underlying factory. Callers (sandbox editor)
1575
+ * use this so every minted id is appended to the current transact's list.
1576
+ */
1577
+ readonly idFactory: PartIdFactory;
1578
+ constructor(document: VideoDocument, options?: PlainMemoryAdapterOptions);
1579
+ get journal(): readonly JournalEntry[];
1580
+ hasContent(): boolean;
1581
+ snapshot(): VideoDocument;
1582
+ /**
1583
+ * Apply one op via immer. A throw in `edit` discards the draft (state and
1584
+ * journal unchanged). When `produce` returns the same reference, there was
1585
+ * no structural change — skip journal, matching mirror "no change, no commit".
1586
+ */
1587
+ transact(edit: (draft: VideoDocumentDraft) => void, audit: TransactAudit): void;
1588
+ }
1589
+ /** Build a `PlainMemoryAdapter` seeded with `document`. */
1590
+ declare function createPlainMemoryAdapter(document: VideoDocument, options?: PlainMemoryAdapterOptions): PlainMemoryAdapter;
1903
1591
  //#endregion
1904
1592
  //#region src/document/mirror-read.d.ts
1905
1593
  /**
1906
1594
  * Project the mirror state (`VideoDocumentDraft`) into the authoritative
1907
1595
  * `VideoDocument`. The storage shape is isomorphic to the domain shape (RFC 03
1908
- * §4, reference/17 §4: timeline + a single `tracks` list + part_library), so this
1596
+ * §4, reference/17 §4: meta map + a single `tracks` list + part_library), so this
1909
1597
  * is a near-identity — it reads `time_position` / `fallback_abs_ms` JSON blobs
1910
- * back into structured values and selects content fields. Legacy meta is ignored.
1598
+ * back into structured values and trims empty strings, nothing more.
1911
1599
  *
1912
1600
  * It maps only authoritative facts (RFC 02 §6): `part_id` + `time_position`. The
1913
1601
  * projection-derived `VideoDraft` read-view (absolute time, `part_aggregations`,
@@ -1957,7 +1645,7 @@ declare const partUnionSchema: z.ZodUnion<readonly [z.ZodObject<{
1957
1645
  id: z.ZodOptional<z.ZodString>;
1958
1646
  kind: z.ZodLiteral<"caption">;
1959
1647
  initial_duration_ms: z.ZodNumber;
1960
- speech_part_id: z.ZodString;
1648
+ speech_part_id: z.ZodOptional<z.ZodString>;
1961
1649
  text: z.ZodString;
1962
1650
  start_ms: z.ZodNumber;
1963
1651
  style: z.ZodOptional<z.ZodObject<{
@@ -1983,16 +1671,29 @@ declare const partUnionSchema: z.ZodUnion<readonly [z.ZodObject<{
1983
1671
  }, z.core.$loose>;
1984
1672
  }, z.core.$loose>]>;
1985
1673
  declare const videoDocumentSchema: z.ZodObject<{
1674
+ meta: z.ZodObject<{
1675
+ schema_version: z.ZodEnum<{
1676
+ "video-document/v0": "video-document/v0";
1677
+ "video-document/entity-projection-v1": "video-document/entity-projection-v1";
1678
+ }>;
1679
+ draft_id: z.ZodOptional<z.ZodString>;
1680
+ project_id: z.ZodOptional<z.ZodString>;
1681
+ owner_id: z.ZodOptional<z.ZodString>;
1682
+ thumbnail_storage_key: z.ZodOptional<z.ZodString>;
1683
+ chat_session_id: z.ZodOptional<z.ZodString>;
1684
+ video_creation_settings: z.ZodOptional<z.ZodUnknown>;
1685
+ version: z.ZodOptional<z.ZodNumber>;
1686
+ }, z.core.$loose>;
1986
1687
  timeline: z.ZodOptional<z.ZodObject<{
1987
1688
  unit_time_ms: z.ZodOptional<z.ZodNumber>;
1988
1689
  }, z.core.$loose>>;
1989
1690
  tracks: z.ZodOptional<z.ZodArray<z.ZodObject<{
1990
1691
  id: z.ZodOptional<z.ZodString>;
1991
1692
  parts_kind: z.ZodOptional<z.ZodEnum<{
1992
- bgm: "bgm";
1993
- caption: "caption";
1994
- speech: "speech";
1995
1693
  video_clip: "video_clip";
1694
+ speech: "speech";
1695
+ caption: "caption";
1696
+ bgm: "bgm";
1996
1697
  }>>;
1997
1698
  is_hidden: z.ZodOptional<z.ZodBoolean>;
1998
1699
  items: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -2047,7 +1748,7 @@ declare const videoDocumentSchema: z.ZodObject<{
2047
1748
  id: z.ZodOptional<z.ZodString>;
2048
1749
  kind: z.ZodLiteral<"caption">;
2049
1750
  initial_duration_ms: z.ZodNumber;
2050
- speech_part_id: z.ZodString;
1751
+ speech_part_id: z.ZodOptional<z.ZodString>;
2051
1752
  text: z.ZodString;
2052
1753
  start_ms: z.ZodNumber;
2053
1754
  style: z.ZodOptional<z.ZodObject<{
@@ -2074,4 +1775,4 @@ declare const videoDocumentSchema: z.ZodObject<{
2074
1775
  }, z.core.$loose>]>>>;
2075
1776
  }, z.core.$loose>;
2076
1777
  //#endregion
2077
- export { VideoDraft as $, assertValidVideoDocument as A, CaptionPart as B, index_d_exports as C, VideoDocumentMirrorSchema as D, VideoDocumentDraft as E, buildSpeechHostMap as F, Timeline as G, PartKind as H, derivePositionFromAbs as I, TrackItemTimePosition as J, Track as K, fromVideoDocument as L, buildInitialVideoDocument as M, DerivedItemPosition as N, videoDocumentMirrorSchema as O, SpeechHostMap as P, VideoDocumentValidationIssueCode as Q, toVideoDocument as R, ValidationError as S, TrackItemDraft as T, PartUnion as U, DEFAULT_UNIT_TIME_MS as V, SpeechPart as W, VideoDocument as X, VideoClipPart as Y, VideoDocumentValidationIssue as Z, PlannedSemanticOpKind as _, MirrorVideoDocumentOptions as a, PartAggregation as at, SchemaValidator as b, CommitOptions as c, Track$1 as ct, SemanticEditor as d, VideoDraftContent as et, SemanticOpInput as f, ImplementedSemanticOpKind as g, IMPLEMENTED_SEMANTIC_OP_KINDS as h, MirrorVideoDocumentAdapter as i, CaptionStyle as it, validateVideoDocument as j, VideoDocumentValidationError as k, OpActor as l, TrackItem$1 as lt, TransactAudit as m, videoDocumentSchema as n, Attachment as nt, createMirrorVideoDocument as o, SpeedShift as ot, SemanticOpName as p, TrackItem as q, readVideoDocumentFromDraft as r, CaptionPart$1 as rt, createMirrorVideoDocumentAdapter as s, Timeline$1 as st, partUnionSchema as t, VideoDraftPartUnion as tt, SemanticDocumentAdapter as u, SemanticOpKind as v, TrackDraft as w, SnapshotReadable as x, isImplementedSemanticOpKind as y, BgmPart as z };
1778
+ export { SequenceRange as $, generatePartId as A, VideoDraft as At, ResolvedEntityClipPlacement as B, Track$1 as Bt, PlannedSemanticOpKind as C, TrackItemTimePosition as Ct, SnapshotReadable as D, VideoDocumentSchemaVersion as Dt, SchemaValidator as E, VideoDocument as Et, videoDocumentMirrorSchema as F, CaptionPart$1 as Ft, EntityTimelineProjectionError as G, ResolvedEntityTrack as H, VideoDocumentValidationError as I, CaptionStyle as It, RelationRow as J, EntityRelationRows as K, assertValidVideoDocument as L, PartAggregation as Lt, TrackItemDraft as M, effectiveVideoClipDurationMs as Mt, VideoDocumentDraft as N, speedOf as Nt, ValidationError as O, VideoDocumentValidationIssue as Ot, VideoDocumentMirrorSchema as P, Attachment as Pt, SequenceDuration as Q, validateVideoDocument as R, SpeedShift as Rt, ImplementedSemanticOpKind as S, TrackItem as St, isImplementedSemanticOpKind as T, VideoClipPart as Tt, resolveEntityTimelineLayout as U, ResolvedEntityTimelineLayout as V, TrackItem$1 as Vt, projectEntityTimeline as W, CaptionStyleFields as X, CaptionSegmentSelection as Y, ScriptTextSegment as Z, SemanticEditor as _, PartKind as _t, PlainMemoryAdapter as a, buildInitialVideoDocument as at, TransactAudit as b, Timeline as bt, MirrorVideoDocumentAdapter as c, buildSpeechHostMap as ct, createMirrorVideoDocument as d, toVideoDocument as dt, VoiceDescriptor as et, createMirrorVideoDocumentAdapter as f, BgmPart as ft, SemanticDocumentAdapter as g, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION as gt, OpActor as h, DEFAULT_UNIT_TIME_MS as ht, JournalEntry as i, InitialDocumentFacts as it, TrackDraft as j, VideoDraftPartUnion as jt, PartIdFactory as k, VideoDocumentValidationIssueCode as kt, MirrorVideoDocumentOptions as l, derivePositionFromAbs as lt, CommitOptions as m, CaptionPart as mt, videoDocumentSchema as n, JsonValue as nt, PlainMemoryAdapterOptions as o, DerivedItemPosition as ot, writeVideoDocumentToDraft as p, CaptionDisplayCue as pt, EntityRow as q, readVideoDocumentFromDraft as r, EntityId as rt, createPlainMemoryAdapter as s, SpeechHostMap as st, partUnionSchema as t, JsonObject as tt, applyEntityTimelineProjection as u, fromVideoDocument as ut, SemanticOpInput as v, PartUnion as vt, SemanticOpKind as w, VIDEO_DOCUMENT_SCHEMA_VERSION as wt, IMPLEMENTED_SEMANTIC_OP_KINDS as x, Track as xt, SemanticOpName as y, SpeechPart as yt, EntityTimelineTrackRole as z, Timeline$1 as zt };