@mengine/medeo-client 1.2.1-alpha.1 → 1.2.1-alpha.10

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,8 +442,10 @@ interface VideoDraft$1 {
441
442
  }
442
443
  //#endregion
443
444
  //#region src/document/types.d.ts
444
- declare const VIDEO_DOCUMENT_SCHEMA_VERSION: 'video-document/v0';
445
- type VideoDocumentSchemaVersion = typeof VIDEO_DOCUMENT_SCHEMA_VERSION;
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;
446
449
  type PartKind = 'video_clip' | 'speech' | 'caption' | 'bgm';
447
450
  /**
448
451
  * Project-level creation settings. Mirrors the IDL, but keeps the two fields the
@@ -545,8 +548,6 @@ interface TrackItem {
545
548
  part_id: string;
546
549
  time_position: TrackItemTimePosition;
547
550
  fallback_abs_ms?: number | undefined;
548
- /** Presentation window for this placement; currently used by caption resize. */
549
- duration_override_ms?: number | undefined;
550
551
  }
551
552
  interface Track {
552
553
  id: string | undefined;
@@ -554,6 +555,19 @@ interface Track {
554
555
  is_hidden: boolean | undefined;
555
556
  items: TrackItem[] | undefined;
556
557
  }
558
+ /** The linear speed multiplier of a `speed_shift`, defaulting to 1 (original). */
559
+ declare function speedOf(speedShift: SpeedShift | undefined): number;
560
+ /**
561
+ * A video clip's effective timeline duration, derived from authoritative facts
562
+ * (RFC 02, `reference/16` §4, reference/17 §5): the trim window
563
+ * `play_out - play_in` divided by the speed multiplier, rounded to integer ms.
564
+ * `play_in` / `play_out` are optional in the IDL but every write path sets them
565
+ * (defaulting to the whole media), and the legacy-ingest projection backfills the
566
+ * window from a legacy `duration_ms` — so an authoritative clip always carries a
567
+ * trim window and there is no stored `duration_ms` to fall back to. A clip with
568
+ * neither bound yields 0. Speeds the clip up (>1× → shorter) or down (<1×).
569
+ */
570
+ declare function effectiveVideoClipDurationMs(clip: VideoClipPart): number;
557
571
  /**
558
572
  * Authoritative part union: a flat discriminated union over the four part kinds.
559
573
  * Deliberately *not* the IDL's namespace union (no `$unknown` / `visit`): engine
@@ -660,6 +674,7 @@ interface VideoDocumentMeta {
660
674
  thumbnail_storage_key: VideoDraft['thumbnail_storage_key'];
661
675
  chat_session_id: VideoDraft['chat_session_id'];
662
676
  video_creation_settings: VideoDraft['video_creation_settings'];
677
+ /** Legacy imported version for v0; committed Entity revision for entity-projection-v1. */
663
678
  version: VideoDraft['version'];
664
679
  }
665
680
  /**
@@ -820,6 +835,143 @@ interface InitialDocumentFacts {
820
835
  */
821
836
  declare function buildInitialVideoDocument(facts: InitialDocumentFacts): VideoDocument;
822
837
  //#endregion
838
+ //#region ../medeo-dsl/src/ids.d.ts
839
+ declare const entityIdBrand: unique symbol;
840
+ declare const relationIdBrand: unique symbol;
841
+ type EntityId = string & {
842
+ readonly [entityIdBrand]: 'EntityId';
843
+ };
844
+ type RelationId = string & {
845
+ readonly [relationIdBrand]: 'RelationId';
846
+ };
847
+ //#endregion
848
+ //#region ../medeo-dsl/src/entities.d.ts
849
+ type KnownEntityKind = 'axvideo' | 'timeline' | 'track' | 'clip' | 'asset' | 'video' | 'audio' | 'voice' | 'image' | 'sequence-marker' | 'viewport' | 'audio-script' | 'phonetic-script' | 'caption';
850
+ declare const extensionEntityKindBrand: unique symbol;
851
+ type ExtensionEntityKind = string & {
852
+ readonly [extensionEntityKindBrand]: 'ExtensionEntityKind';
853
+ };
854
+ /** Extensions require explicit branding so removed or reserved domain kinds cannot reappear accidentally. */
855
+ type EntityKind = KnownEntityKind | ExtensionEntityKind;
856
+ interface SequenceRange<Point = unknown> {
857
+ readonly start: Point;
858
+ readonly end: Point;
859
+ }
860
+ type SequenceDuration<Span = unknown> = {
861
+ readonly mode: 'from-source';
862
+ } | {
863
+ readonly mode: 'fixed';
864
+ readonly value: Span;
865
+ };
866
+ interface VoiceDescriptor {
867
+ readonly system: 'voice-library';
868
+ readonly key: string;
869
+ readonly name?: string;
870
+ }
871
+ interface CaptionFontDescriptor {
872
+ readonly system: 'font-library';
873
+ readonly key: string;
874
+ }
875
+ interface CaptionStyleFields {
876
+ readonly font?: CaptionFontDescriptor;
877
+ readonly fontSize?: number;
878
+ readonly fontColor?: string;
879
+ readonly fontWeight?: number;
880
+ readonly entranceAnimation?: string;
881
+ readonly entranceAnimationDurationMs?: number;
882
+ readonly strokeColor?: string;
883
+ readonly strokeWidth?: number;
884
+ readonly positionX?: number;
885
+ readonly positionY?: number;
886
+ }
887
+ //#endregion
888
+ //#region ../medeo-dsl/src/json-values.d.ts
889
+ type JsonPrimitive = string | number | boolean | null;
890
+ type JsonValue = JsonPrimitive | JsonObject | readonly JsonValue[];
891
+ type JsonObject = {
892
+ readonly [key: string]: JsonValue;
893
+ };
894
+ //#endregion
895
+ //#region ../medeo-dsl/src/relations.d.ts
896
+ type KnownRelationKind = 'timeline-track' | 'track-clip' | 'clip-marker' | 'marker-content' | 'axvideo-marker' | 'marker-timeline' | 'physical-asset' | 'generated' | 'phonetic-script-provenance' | 'caption-provenance' | 'caption-alignment' | 'clip-anchor' | 'audio-script-render';
897
+ type RelationKind = KnownRelationKind | (string & {});
898
+ type RelationTrace = JsonObject;
899
+ /**
900
+ * Authoritative persisted relation value.
901
+ *
902
+ * A kind may assign semantic roles to endpoint 0 and endpoint 1. Callers and
903
+ * storage adapters must preserve the submitted positions; kinds whose
904
+ * semantics are unordered simply do not interpret those positions.
905
+ */
906
+ interface RelationRow<K extends RelationKind = RelationKind, Metadata extends JsonObject = JsonObject> {
907
+ readonly relationId: RelationId;
908
+ readonly endpoint0EntityId: EntityId;
909
+ readonly endpoint1EntityId: EntityId;
910
+ readonly relationKind: K;
911
+ readonly metadata: Metadata;
912
+ readonly trace: RelationTrace;
913
+ }
914
+ //#endregion
915
+ //#region ../medeo-dsl/src/rows.d.ts
916
+ /** One persisted first-class entity. Its owned fields live directly in payload. */
917
+ interface EntityRow<K extends EntityKind = EntityKind> {
918
+ readonly entityId: EntityId;
919
+ readonly entityKind: K;
920
+ readonly payload: JsonObject;
921
+ }
922
+ /** Complete persistence value for an entity set and its authoritative relations. */
923
+ interface EntityRelationRows {
924
+ readonly entities: readonly EntityRow[];
925
+ readonly relations: readonly RelationRow[];
926
+ }
927
+ //#endregion
928
+ //#region src/document/entity-projection-values.d.ts
929
+ /** A graph cannot be represented faithfully by the compatibility reader. */
930
+ declare class EntityTimelineProjectionError extends Error {
931
+ constructor(message: string);
932
+ }
933
+ //#endregion
934
+ //#region src/document/entity-projection.d.ts
935
+ /**
936
+ * One-way compatibility view over the Entity graph. A legacy part is never
937
+ * consulted as an editing fact. Peer IDs appear only in this derived read
938
+ * contract, reconstructed from relations; they are not stored in payloads.
939
+ */
940
+ declare function projectEntityTimeline(rows: EntityRelationRows, meta: VideoDocumentMeta): VideoDocument;
941
+ //#endregion
942
+ //#region src/document/entity-timeline-layout.d.ts
943
+ type EntityTimelineTrackRole = 'video_clip' | 'speech' | 'caption' | 'bgm';
944
+ interface ResolvedEntityClipPlacement {
945
+ readonly clipEntityId: string;
946
+ readonly markerEntityId: string;
947
+ readonly contentEntityId: string;
948
+ readonly trackEntityId: string;
949
+ readonly start: number;
950
+ readonly duration: number;
951
+ readonly mode: 'sequential' | 'absolute' | 'anchored';
952
+ readonly anchorClipEntityId?: string;
953
+ readonly anchorOffset?: number;
954
+ }
955
+ interface ResolvedEntityTrack {
956
+ readonly entityId: string;
957
+ readonly role: EntityTimelineTrackRole;
958
+ readonly order: number;
959
+ readonly hidden: boolean;
960
+ readonly clips: readonly ResolvedEntityClipPlacement[];
961
+ }
962
+ interface ResolvedEntityTimelineLayout {
963
+ readonly tracks: readonly ResolvedEntityTrack[];
964
+ readonly clips: ReadonlyMap<string, ResolvedEntityClipPlacement>;
965
+ /** Background music fills this duration; it never extends the timeline. */
966
+ readonly durationMs: number;
967
+ }
968
+ /**
969
+ * Resolve only entity-owned placement facts. This does not choose new anchors,
970
+ * manufacture clips, or mutate a graph while reading. Write-side operations
971
+ * must express any detach/reparent/overlap decision in their entity plan.
972
+ */
973
+ declare function resolveEntityTimelineLayout(rows: EntityRelationRows): ResolvedEntityTimelineLayout;
974
+ //#endregion
823
975
  //#region src/document/validation.d.ts
824
976
  /**
825
977
  * Business-level schema guard for `VideoDocument` (RFC 03 §9). It is the gate
@@ -937,619 +1089,35 @@ type TrackDraft = NonNullable<NonNullable<VideoDocumentDraft['tracks']>[number]>
937
1089
  /** A single track item in a draft. */
938
1090
  type TrackItemDraft = NonNullable<NonNullable<TrackDraft['items']>[number]>;
939
1091
  //#endregion
940
- //#region src/editor/schemas/add-speeches.d.ts
941
- /**
942
- * Add speeches (and their captions). TTS runs upstream; the stable speech /
943
- * caption parts arrive materialized (see `speech-assets.ts`). The op writes the
944
- * parts and each speech's `{ mode:'anchored', anchorPartId, offsetMs }` fact
945
- * verbatim — no write-time host-picking, no cascade (RFC 02 §4). The projection
946
- * derives absolute positions on read.
947
- */
948
- declare const addSpeechesInputSchema: z.ZodObject<{
949
- speeches: z.ZodArray<z.ZodObject<{
950
- speech_id: z.ZodString;
951
- anchor_part_id: z.ZodString;
952
- offset_ms: z.ZodNumber;
953
- audio_storage_key: z.ZodString;
954
- duration_ms: z.ZodNumber;
955
- audio_script: z.ZodString;
956
- volume: z.ZodNumber;
957
- voice: z.ZodObject<{
958
- id: z.ZodString;
959
- name: z.ZodString;
960
- }, z.core.$strip>;
961
- origin_speech_id: z.ZodString;
962
- caption_ids: z.ZodArray<z.ZodString>;
963
- }, z.core.$strip>>;
964
- captions: z.ZodArray<z.ZodObject<{
965
- caption_id: z.ZodString;
966
- speech_part_id: z.ZodString;
967
- text: z.ZodString;
968
- start_ms: z.ZodNumber;
969
- duration_ms: z.ZodNumber;
970
- }, z.core.$strip>>;
971
- }, z.core.$strip>;
972
- type AddSpeechesInput = z.infer<typeof addSpeechesInputSchema>;
973
- //#endregion
974
- //#region src/editor/schemas/add-video-clips.d.ts
1092
+ //#region src/editor/id-gen.d.ts
975
1093
  /**
976
- * Add video clips to a track. Each clip's duration facts are separated so a
977
- * single number is never overloaded (RFC 02 / `reference/16` §0b):
1094
+ * Part-id generation, aligned with the online ecosystem.
978
1095
  *
979
- * - `media_duration_ms` is the source media's intrinsic full length (a resource
980
- * fact, written to the part);
981
- * - `play_in` / `play_out` are the optional trim window into that media; when
982
- * omitted the whole media is used (`play_in=0`, `play_out=media_duration_ms`).
1096
+ * The authoritative online producers — agent-harness (`@harness/shared`
1097
+ * `genObjId`) and director.v2 (`common/obj_id.py` `gen_obj_id`) — both mint part
1098
+ * ids as `` `${prefix}_${ulid()}` ``, and real captured drafts use exactly that
1099
+ * shape (`clip_…` / `spe_…` / `cap_…` / `bgm_…`, each a 26-char ULID). The engine
1100
+ * previously emitted `vc_<base36 timestamp><6 random>`, a different prefix AND a
1101
+ * different encoding — the sole cross-repo id divergence. This module removes it
1102
+ * by emitting the same `<prefix>_<ULID>` bytes.
983
1103
  *
984
- * The clip's effective timeline duration is derived by the projection from the
985
- * trim window and `speed_shift` — it is never an input here.
986
- */
987
- declare const addVideoClipsInputSchema: z.ZodObject<{
988
- clips: z.ZodArray<z.ZodObject<{
989
- media_id: z.ZodString;
990
- start_ms: z.ZodOptional<z.ZodNumber>;
991
- media_duration_ms: z.ZodNumber;
992
- play_in: z.ZodOptional<z.ZodNumber>;
993
- play_out: z.ZodOptional<z.ZodNumber>;
994
- track_id: z.ZodOptional<z.ZodString>;
995
- }, z.core.$strip>>;
996
- before_clip_id: z.ZodOptional<z.ZodString>;
997
- after_clip_id: z.ZodOptional<z.ZodString>;
998
- }, z.core.$strip>;
999
- type AddVideoClipsInput = z.infer<typeof addVideoClipsInputSchema>;
1000
- //#endregion
1001
- //#region src/editor/schemas/adjust-bgm-volume.d.ts
1002
- declare const adjustBgmVolumeInputSchema: z.ZodObject<{
1003
- bgm: z.ZodArray<z.ZodObject<{
1004
- bgm_id: z.ZodString;
1005
- volume: z.ZodNumber;
1006
- }, z.core.$strip>>;
1007
- }, z.core.$strip>;
1008
- type AdjustBgmVolumeInput = z.infer<typeof adjustBgmVolumeInputSchema>;
1009
- //#endregion
1010
- //#region src/editor/schemas/adjust-speech-volume.d.ts
1011
- declare const adjustSpeechVolumeInputSchema: z.ZodObject<{
1012
- speeches: z.ZodArray<z.ZodObject<{
1013
- speech_id: z.ZodString;
1014
- volume: z.ZodNumber;
1015
- }, z.core.$strip>>;
1016
- }, z.core.$strip>;
1017
- type AdjustSpeechVolumeInput = z.infer<typeof adjustSpeechVolumeInputSchema>;
1018
- //#endregion
1019
- //#region src/editor/schemas/adjust-video-clip-duration.d.ts
1020
- /**
1021
- * Re-trim existing video clips (the user-facing "adjust duration" gesture is a
1022
- * trim of the source window). The new `play_in` / `play_out` are the facts; the
1023
- * effective timeline duration is derived from them and the clip's `speed_shift`,
1024
- * and the change reflows downstream clips, speeches, and the timeline inside the
1025
- * op's transaction (no caller-materialized cascade).
1026
- */
1027
- declare const adjustVideoClipDurationInputSchema: z.ZodObject<{
1028
- clips: z.ZodArray<z.ZodObject<{
1029
- clip_id: z.ZodString;
1030
- play_in: z.ZodNumber;
1031
- play_out: z.ZodNumber;
1032
- }, z.core.$strip>>;
1033
- }, z.core.$strip>;
1034
- type AdjustVideoClipDurationInput = z.infer<typeof adjustVideoClipDurationInputSchema>;
1035
- //#endregion
1036
- //#region src/editor/schemas/adjust-video-clip-volume.d.ts
1037
- declare const adjustVideoClipVolumeInputSchema: z.ZodObject<{
1038
- clips: z.ZodArray<z.ZodObject<{
1039
- clip_id: z.ZodString;
1040
- volume: z.ZodNumber;
1041
- }, z.core.$strip>>;
1042
- }, z.core.$strip>;
1043
- type AdjustVideoClipVolumeInput = z.infer<typeof adjustVideoClipVolumeInputSchema>;
1044
- //#endregion
1045
- //#region src/editor/schemas/change-speech.d.ts
1046
- /**
1047
- * Change a speech's script or voice. Both re-run TTS upstream and return the
1048
- * regenerated speech / caption parts in the same materialized shape as
1049
- * `AddSpeeches` (`speech-assets.ts`); the op upserts them by id (the speech part
1050
- * id is preserved across a re-TTS), re-seats at `start_ms`, and reflows. Old
1051
- * caption parts no longer owned by the speech are removed via `caption_ids`.
1052
- */
1053
- declare const changeSpeechScriptInputSchema: z.ZodObject<{
1054
- speeches: z.ZodArray<z.ZodObject<{
1055
- speech_id: z.ZodString;
1056
- anchor_part_id: z.ZodString;
1057
- offset_ms: z.ZodNumber;
1058
- audio_storage_key: z.ZodString;
1059
- duration_ms: z.ZodNumber;
1060
- audio_script: z.ZodString;
1061
- volume: z.ZodNumber;
1062
- voice: z.ZodObject<{
1063
- id: z.ZodString;
1064
- name: z.ZodString;
1065
- }, z.core.$strip>;
1066
- origin_speech_id: z.ZodString;
1067
- caption_ids: z.ZodArray<z.ZodString>;
1068
- }, z.core.$strip>>;
1069
- captions: z.ZodArray<z.ZodObject<{
1070
- caption_id: z.ZodString;
1071
- speech_part_id: z.ZodString;
1072
- text: z.ZodString;
1073
- start_ms: z.ZodNumber;
1074
- duration_ms: z.ZodNumber;
1075
- }, z.core.$strip>>;
1076
- }, z.core.$strip>;
1077
- declare const changeSpeechVoiceInputSchema: z.ZodObject<{
1078
- speeches: z.ZodArray<z.ZodObject<{
1079
- speech_id: z.ZodString;
1080
- anchor_part_id: z.ZodString;
1081
- offset_ms: z.ZodNumber;
1082
- audio_storage_key: z.ZodString;
1083
- duration_ms: z.ZodNumber;
1084
- audio_script: z.ZodString;
1085
- volume: z.ZodNumber;
1086
- voice: z.ZodObject<{
1087
- id: z.ZodString;
1088
- name: z.ZodString;
1089
- }, z.core.$strip>;
1090
- origin_speech_id: z.ZodString;
1091
- caption_ids: z.ZodArray<z.ZodString>;
1092
- }, z.core.$strip>>;
1093
- captions: z.ZodArray<z.ZodObject<{
1094
- caption_id: z.ZodString;
1095
- speech_part_id: z.ZodString;
1096
- text: z.ZodString;
1097
- start_ms: z.ZodNumber;
1098
- duration_ms: z.ZodNumber;
1099
- }, z.core.$strip>>;
1100
- }, z.core.$strip>;
1101
- type ChangeSpeechScriptInput = z.infer<typeof changeSpeechScriptInputSchema>;
1102
- type ChangeSpeechVoiceInput = z.infer<typeof changeSpeechVoiceInputSchema>;
1103
- //#endregion
1104
- //#region src/editor/schemas/delete-bgm.d.ts
1105
- /**
1106
- * Remove the document BGM. Pure document edit: clears the bgm lane and removes
1107
- * the bgm part. Takes no input (a document holds at most one bgm); an empty
1108
- * object keeps the op signature uniform with the rest.
1109
- */
1110
- declare const deleteBgmInputSchema: z.ZodObject<{}, z.core.$strip>;
1111
- type DeleteBgmInput = z.infer<typeof deleteBgmInputSchema>;
1112
- //#endregion
1113
- //#region src/editor/schemas/delete-speeches.d.ts
1114
- /**
1115
- * Delete speeches with their captions. Pure document edit (no side effect): the
1116
- * op removes each speech part, cascade-deletes the captions it owns (via
1117
- * `caption_ids` / `speech_part_id`), drops their track items, and reflows.
1118
- */
1119
- declare const deleteSpeechesInputSchema: z.ZodObject<{
1120
- speech_ids: z.ZodArray<z.ZodString>;
1121
- }, z.core.$strip>;
1122
- type DeleteSpeechesInput = z.infer<typeof deleteSpeechesInputSchema>;
1123
- //#endregion
1124
- //#region src/editor/schemas/delete-video-clips.d.ts
1125
- /**
1126
- * How a delete handles the anchored subtree (speeches anchored to a deleted clip,
1127
- * and their captions) — a delete-op policy, not a data-model field (reference/17
1128
- * §6). `cascade` (default) removes the subtree; `detach` keeps the direct
1129
- * anchored children, re-pinning them to `absolute` so they stay on the timeline.
1130
- */
1131
- declare const anchoredDeletePolicySchema: z.ZodEnum<{
1132
- cascade: "cascade";
1133
- detach: "detach";
1134
- }>;
1135
- type AnchoredDeletePolicy = z.infer<typeof anchoredDeletePolicySchema>;
1136
- declare const deleteVideoClipsInputSchema: z.ZodObject<{
1137
- clip_ids: z.ZodArray<z.ZodString>;
1138
- on_anchored: z.ZodOptional<z.ZodEnum<{
1139
- cascade: "cascade";
1140
- detach: "detach";
1141
- }>>;
1142
- }, z.core.$strip>;
1143
- type DeleteVideoClipsInput = z.infer<typeof deleteVideoClipsInputSchema>;
1144
- //#endregion
1145
- //#region src/editor/schemas/move-speeches.d.ts
1146
- /**
1147
- * Move speeches in time. Pure document edit: the op re-seats each speech at its
1148
- * new absolute `start_ms`; the cascade reassigns it to the host video clip,
1149
- * resolves overlaps, and reflows. Captions follow their speech.
1150
- */
1151
- declare const moveSpeechesInputSchema: z.ZodObject<{
1152
- speeches: z.ZodArray<z.ZodObject<{
1153
- speech_id: z.ZodString;
1154
- new_start_ms: z.ZodNumber;
1155
- }, z.core.$strip>>;
1156
- }, z.core.$strip>;
1157
- type MoveSpeechesInput = z.infer<typeof moveSpeechesInputSchema>;
1158
- //#endregion
1159
- //#region src/editor/schemas/move-video-clips-by-anchor.d.ts
1160
- /**
1161
- * Where the moved block lands on the main track.
1162
- *
1163
- * A discriminated union rather than two optional `before_clip_id` /
1164
- * `after_clip_id` fields (the shape `addVideoClips` had to use, because there the
1165
- * two modes share a whole clip description): here the alternatives carry nothing
1166
- * in common, so making them mutually exclusive *by type* removes three runtime
1167
- * `superRefine` checks that would otherwise have to be written and tested.
1168
- *
1169
- * `track_start` is an explicit member, not the absence of an anchor. The
1170
- * agent-harness mutation this maps from treats "neither anchor given" as
1171
- * "move to the front" (`applyBatchMoveVideoClips` falls back to `insertIndex = 0`),
1172
- * which is a default buried in a tool description. Requiring the caller to name
1173
- * that intent keeps a forgotten field from silently reordering the timeline.
1174
- */
1175
- declare const moveAnchorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1176
- position: z.ZodLiteral<"before">;
1177
- clip_id: z.ZodString;
1178
- }, z.core.$strip>, z.ZodObject<{
1179
- position: z.ZodLiteral<"after">;
1180
- clip_id: z.ZodString;
1181
- }, z.core.$strip>, z.ZodObject<{
1182
- position: z.ZodLiteral<"track_start">;
1183
- }, z.core.$strip>], "position">;
1184
- /**
1185
- * What happens to the speeches anchored to the clips being moved.
1186
- *
1187
- * - `follow` keeps each speech anchored where it is, so it travels with its clip
1188
- * to the new position. In the anchored model this is the *no-op* branch: a
1189
- * speech's authoritative fact is `{ anchorPartId, offsetMs }` and its absolute
1190
- * time is derived on read from the host's position, so moving the host moves
1191
- * the speech with no write to the speech at all.
1192
- * - `keep_absolute` preserves each speech's current absolute landing instead, then
1193
- * re-anchors it to whichever clip now covers that time (RFC 02 §9.1/§11.1). This
1194
- * is the branch that costs an extra pass, and the one the FE timeline uses.
1195
- *
1196
- * **Required, with no default**, matching `deleteVideoClips` and
1197
- * `replaceVideoClipSequence`. The two branches decide which picture the user's
1198
- * narration ends up over, which is too consequential to infer from a missing
1199
- * field — and neither branch is "safe enough" to be the implicit one.
1200
- */
1201
- declare const movedClipAnchoredPolicySchema: z.ZodEnum<{
1202
- follow: "follow";
1203
- keep_absolute: "keep_absolute";
1204
- }>;
1205
- /**
1206
- * Reorder a set of main-track clips relative to a reference clip.
1207
- *
1208
- * Distinct from `moveVideoClips`, which positions clips by absolute time
1209
- * (`new_start_ms`) and is what the FE timeline dispatches after a drag. Main-track
1210
- * clips are `sequential`-positioned, so absolute time is not authoritative state
1211
- * there (RFC 02 §4/§7): `moveVideoClips` has to *guess* an index back out of the
1212
- * time it was handed, whereas an anchor already is the ordinal fact being changed.
1213
- * Keeping them separate also isolates blast radius — this method can diverge on
1214
- * speech policy without touching the FE path.
1215
- *
1216
- * `clip_ids` need not be contiguous. They move as one block, keeping their
1217
- * relative order, which is the agent-harness `batch_move_video_clips` contract.
1218
- */
1219
- declare const moveVideoClipsByAnchorInputSchema: z.ZodObject<{
1220
- clip_ids: z.ZodArray<z.ZodString>;
1221
- anchor: z.ZodDiscriminatedUnion<[z.ZodObject<{
1222
- position: z.ZodLiteral<"before">;
1223
- clip_id: z.ZodString;
1224
- }, z.core.$strip>, z.ZodObject<{
1225
- position: z.ZodLiteral<"after">;
1226
- clip_id: z.ZodString;
1227
- }, z.core.$strip>, z.ZodObject<{
1228
- position: z.ZodLiteral<"track_start">;
1229
- }, z.core.$strip>], "position">;
1230
- on_anchored: z.ZodEnum<{
1231
- follow: "follow";
1232
- keep_absolute: "keep_absolute";
1233
- }>;
1234
- }, z.core.$strip>;
1235
- type MoveAnchor = z.infer<typeof moveAnchorSchema>;
1236
- type MovedClipAnchoredPolicy = z.infer<typeof movedClipAnchoredPolicySchema>;
1237
- type MoveVideoClipsByAnchorInput = z.infer<typeof moveVideoClipsByAnchorInputSchema>;
1238
- //#endregion
1239
- //#region src/editor/schemas/move-video-clips.d.ts
1240
- declare const moveVideoClipsInputSchema: z.ZodObject<{
1241
- clips: z.ZodArray<z.ZodObject<{
1242
- clip_id: z.ZodString;
1243
- new_start_ms: z.ZodNumber;
1244
- new_track_id: z.ZodOptional<z.ZodString>;
1245
- }, z.core.$strip>>;
1246
- }, z.core.$strip>;
1247
- type MoveVideoClipsInput = z.infer<typeof moveVideoClipsInputSchema>;
1248
- //#endregion
1249
- //#region src/editor/schemas/replace-video-clip-content.d.ts
1250
- /**
1251
- * Replace the media backing existing video clips. The media import runs upstream
1252
- * (Director); its stable result — the new media id, intrinsic length, and the
1253
- * reset trim window — arrives materialized (see
1254
- * `results/phase-4-side-effect-payload-contract.md` §4). Director resets
1255
- * `play_in=0` / `play_out=media_duration_ms` and clears `speed_shift` on
1256
- * replacement. The clip `part_id`s (hence their track items) are unchanged; the
1257
- * editor reflows the main track from the new effective durations.
1258
- */
1259
- declare const replaceVideoClipContentInputSchema: z.ZodObject<{
1260
- clips: z.ZodArray<z.ZodObject<{
1261
- clip_id: z.ZodString;
1262
- origin_media_id: z.ZodString;
1263
- media_duration_ms: z.ZodNumber;
1264
- play_in: z.ZodNumber;
1265
- play_out: z.ZodNumber;
1266
- volume: z.ZodNumber;
1267
- }, z.core.$strip>>;
1268
- }, z.core.$strip>;
1269
- type ReplaceVideoClipContentInput = z.infer<typeof replaceVideoClipContentInputSchema>;
1270
- //#endregion
1271
- //#region src/editor/schemas/replace-video-clip-sequence.d.ts
1272
- /**
1273
- * What happens to the speeches anchored to the clips being replaced.
1274
- *
1275
- * - `remap` re-anchors each surviving speech to the new clip in the SAME POSITION
1276
- * of the sequence, keeping its offset — old[i]'s children become new[i]'s
1277
- * children. An old clip with no counterpart (fewer new clips than old) has its
1278
- * subtree deleted, because there is nothing left to anchor to.
1279
- * - `cascade` deletes every anchored speech (and its captions) outright, like
1280
- * `deleteVideoClips`.
1281
- *
1282
- * **Required, with no default.** The two branches differ in whether the user's
1283
- * narration survives, and the agent tool that drives this op makes its
1284
- * `preserve_speeches` flag required for that reason. A default here would let a
1285
- * caller that forgot the field silently delete speech.
1286
- */
1287
- declare const anchoredReplacePolicySchema: z.ZodEnum<{
1288
- cascade: "cascade";
1289
- remap: "remap";
1290
- }>;
1291
- type AnchoredReplacePolicy = z.infer<typeof anchoredReplacePolicySchema>;
1292
- /**
1293
- * Replace a contiguous run of main-track clips with a new run.
1294
- *
1295
- * A composite of delete + insert that cannot be expressed as the two ops in
1296
- * sequence, because the anchored speeches have to survive *across* the swap: with
1297
- * `remap` they are re-anchored positionally, which needs both the old and the new
1298
- * ids in the same transaction (ADR 0009 — the cascade stays in the editor, callers
1299
- * never re-wire anchors themselves).
1300
- *
1301
- * Duration facts follow `addVideoClips`: `media_duration_ms` is the source's
1302
- * intrinsic length and the trim window defaults to the whole media. The effective
1303
- * timeline duration is derived by the projection, never an input.
1304
- *
1305
- * `media_id` is optional: omitting it creates a **deliberate empty placeholder
1306
- * clip** (`origin_media_id: ''`) — structure with no picture. This is the only op
1307
- * that can produce one, and it is authoritative state, unlike the gap fillers the
1308
- * read-side solve mints (which never enter the document).
1309
- */
1310
- declare const replaceVideoClipSequenceInputSchema: z.ZodObject<{
1311
- old_clip_ids: z.ZodArray<z.ZodString>;
1312
- new_clips: z.ZodArray<z.ZodObject<{
1313
- media_id: z.ZodOptional<z.ZodString>;
1314
- media_duration_ms: z.ZodNumber;
1315
- play_in: z.ZodOptional<z.ZodNumber>;
1316
- play_out: z.ZodOptional<z.ZodNumber>;
1317
- }, z.core.$strip>>;
1318
- on_anchored: z.ZodEnum<{
1319
- cascade: "cascade";
1320
- remap: "remap";
1321
- }>;
1322
- }, z.core.$strip>;
1323
- type ReplaceVideoClipSequenceInput = z.infer<typeof replaceVideoClipSequenceInputSchema>;
1324
- //#endregion
1325
- //#region src/editor/schemas/resize-caption.d.ts
1326
- /** Resize one caption placement without changing its cue/source duration. */
1327
- declare const resizeCaptionInputSchema: z.ZodObject<{
1328
- caption_id: z.ZodString;
1329
- duration_ms: z.ZodNumber;
1330
- }, z.core.$strip>;
1331
- type ResizeCaptionInput = z.infer<typeof resizeCaptionInputSchema>;
1332
- //#endregion
1333
- //#region src/editor/schemas/set-bgm.d.ts
1334
- /**
1335
- * Set the document BGM. The media's stable result (storage key) arrives
1336
- * materialized from upstream (see
1337
- * `results/phase-4-side-effect-payload-contract.md` §3). The op upserts the bgm
1338
- * part and seats it on the bgm lane; its effective length is always the whole
1339
- * timeline, derived by the projection on read — so there is no `duration_ms`
1340
- * input or fact (RFC 02 / `reference/16` §0b). A `bgm_id` lets the op replace an
1341
- * existing bgm part by id.
1342
- */
1343
- declare const setBgmInputSchema: z.ZodObject<{
1344
- bgm_id: z.ZodString;
1345
- audio_storage_key: z.ZodString;
1346
- origin_media_id: z.ZodString;
1347
- volume: z.ZodNumber;
1348
- }, z.core.$strip>;
1349
- type SetBgmInput = z.infer<typeof setBgmInputSchema>;
1350
- //#endregion
1351
- //#region src/editor/schemas/set-caption-style.d.ts
1352
- /**
1353
- * Set the caption visual style. GLOBAL by design: the style applies to every
1354
- * caption part in the document — it carries NO `caption_id`. This mirrors the FE,
1355
- * whose caption-style store (`caption-style.ts:persistCaptionStylePatch`) iterates
1356
- * ALL captions and writes the same normalized style to each; the product has a
1357
- * single document-wide caption style, not per-caption styling.
1358
- *
1359
- * Every field is optional and maps to a `CaptionStyle` attribute (snake_case
1360
- * IDL). A field present in the input is written to every caption; a field ABSENT
1361
- * from the input is left untouched on each caption (the editor merges the patch
1362
- * onto each caption's existing style — this is a value edit, not a full-style
1363
- * replace, so a partial patch such as "recolor only" does not wipe font size).
1364
- *
1365
- * Pure document edit, no cascade — captions keep their positions; only the style
1366
- * sub-map of each caption part changes.
1367
- */
1368
- declare const setCaptionStyleInputSchema: z.ZodObject<{
1369
- font_id: z.ZodOptional<z.ZodString>;
1370
- font_size: z.ZodOptional<z.ZodNumber>;
1371
- font_color: z.ZodOptional<z.ZodString>;
1372
- font_weight: z.ZodOptional<z.ZodNumber>;
1373
- entrance_animation: z.ZodOptional<z.ZodString>;
1374
- entrance_animation_duration_ms: z.ZodOptional<z.ZodNumber>;
1375
- stroke_color: z.ZodOptional<z.ZodString>;
1376
- stroke_width: z.ZodOptional<z.ZodNumber>;
1377
- position_x: z.ZodOptional<z.ZodNumber>;
1378
- position_y: z.ZodOptional<z.ZodNumber>;
1379
- }, z.core.$strip>;
1380
- type SetCaptionStyleInput = z.infer<typeof setCaptionStyleInputSchema>;
1381
- //#endregion
1382
- //#region src/editor/schemas/set-caption-visibility.d.ts
1383
- /**
1384
- * Toggle caption visibility (the caption track's `is_hidden` flag). Pure
1385
- * document edit, no cascade — captions keep their positions; only the lane's
1386
- * hidden flag changes.
1387
- */
1388
- declare const setCaptionVisibilityInputSchema: z.ZodObject<{
1389
- is_hidden: z.ZodBoolean;
1390
- }, z.core.$strip>;
1391
- type SetCaptionVisibilityInput = z.infer<typeof setCaptionVisibilityInputSchema>;
1392
- //#endregion
1393
- //#region src/editor/schemas/set-video-clip-speed-shift.d.ts
1394
- /**
1395
- * Set the playback speed of existing video clips. Per the speed-shift decision
1396
- * (`reference/16` §0): the op writes only the `speed_shift` fact — it does NOT
1397
- * store an effective `duration_ms` (projection derives it from the trim window /
1398
- * speed) and does NOT scale anchored speeches' relative offsets (offsets stay
1399
- * put; the cascade reflows absolute positions). A `null` speed_shift clears the
1400
- * speed back to original (1×).
1401
- */
1402
- declare const setVideoClipSpeedShiftInputSchema: z.ZodObject<{
1403
- clips: z.ZodArray<z.ZodObject<{
1404
- clip_id: z.ZodString;
1405
- speed_shift: z.ZodNullable<z.ZodObject<{
1406
- category: z.ZodEnum<{
1407
- curve: "curve";
1408
- linear: "linear";
1409
- }>;
1410
- mode: z.ZodString;
1411
- config: z.ZodUnion<readonly [z.ZodObject<{
1412
- linear: z.ZodObject<{
1413
- speed: z.ZodNumber;
1414
- }, z.core.$strip>;
1415
- }, z.core.$strip>, z.ZodObject<{
1416
- curve: z.ZodObject<{
1417
- keyframes: z.ZodArray<z.ZodObject<{
1418
- position: z.ZodNumber;
1419
- rate: z.ZodNumber;
1420
- in_tangent: z.ZodOptional<z.ZodObject<{
1421
- x: z.ZodNumber;
1422
- y: z.ZodNumber;
1423
- }, z.core.$strip>>;
1424
- out_tangent: z.ZodOptional<z.ZodObject<{
1425
- x: z.ZodNumber;
1426
- y: z.ZodNumber;
1427
- }, z.core.$strip>>;
1428
- }, z.core.$strip>>;
1429
- }, z.core.$strip>;
1430
- }, z.core.$strip>]>;
1431
- }, z.core.$strip>>;
1432
- }, z.core.$strip>>;
1433
- }, z.core.$strip>;
1434
- type SetVideoClipSpeedShiftInput = z.infer<typeof setVideoClipSpeedShiftInputSchema>;
1435
- //#endregion
1436
- //#region src/editor/schemas/shared.d.ts
1437
- declare const clipIdSchema: z.ZodString;
1438
- declare const clipIdsSchema: z.ZodArray<z.ZodString>;
1439
- declare const mediaIdSchema: z.ZodString;
1440
- declare const speechIdSchema: z.ZodString;
1441
- declare const timelineMsSchema: z.ZodNumber;
1442
- declare const positiveMsSchema: z.ZodNumber;
1443
- declare const volumeSchema: z.ZodNumber;
1444
- declare const speechIdsSchema: z.ZodArray<z.ZodString>;
1445
- /**
1446
- * A clip's playback-speed fact, the only thing `SetVideoClipSpeedShift` writes.
1447
- * Mirrors the IDL `SpeedShift`: `category` is `linear` | `curve`, and `config`
1448
- * is a discriminated union — `{ linear: { speed } }` for a constant multiplier
1449
- * (the multiplier projection reads at `config.linear.speed`) or `{ curve: {
1450
- * keyframes } }` for a Bezier-controlled variable speed (RFC 02 / `reference/16`
1451
- * §0). Exactly one of `linear` / `curve` is present.
1452
- */
1453
- declare const speedShiftSchema: z.ZodObject<{
1454
- category: z.ZodEnum<{
1455
- curve: "curve";
1456
- linear: "linear";
1457
- }>;
1458
- mode: z.ZodString;
1459
- config: z.ZodUnion<readonly [z.ZodObject<{
1460
- linear: z.ZodObject<{
1461
- speed: z.ZodNumber;
1462
- }, z.core.$strip>;
1463
- }, z.core.$strip>, z.ZodObject<{
1464
- curve: z.ZodObject<{
1465
- keyframes: z.ZodArray<z.ZodObject<{
1466
- position: z.ZodNumber;
1467
- rate: z.ZodNumber;
1468
- in_tangent: z.ZodOptional<z.ZodObject<{
1469
- x: z.ZodNumber;
1470
- y: z.ZodNumber;
1471
- }, z.core.$strip>>;
1472
- out_tangent: z.ZodOptional<z.ZodObject<{
1473
- x: z.ZodNumber;
1474
- y: z.ZodNumber;
1475
- }, z.core.$strip>>;
1476
- }, z.core.$strip>>;
1477
- }, z.core.$strip>;
1478
- }, z.core.$strip>]>;
1479
- }, z.core.$strip>;
1480
- declare const voiceSchema: z.ZodObject<{
1481
- id: z.ZodString;
1482
- name: z.ZodString;
1483
- }, z.core.$strip>;
1484
- //#endregion
1485
- //#region src/editor/schemas/speech-assets.d.ts
1486
- /**
1487
- * The materialized TTS result shared by `AddSpeeches` / `ChangeSpeechScript` /
1488
- * `ChangeSpeechVoice` (see `results/phase-4-side-effect-payload-contract.md`
1489
- * §1/§2). The side effect (TTS/ASR + billing) runs upstream; the op receives the
1490
- * stable speech + caption parts and writes them as authoritative facts. No
1491
- * cascade runs on write — the projection derives absolute positions on read.
1492
- *
1493
- * Each speech carries the anchoring fact directly (RFC 02 §4): the host video
1494
- * clip `anchor_part_id` and the `offset_ms` within it. The upstream caller
1495
- * already knows which clip a speech attaches to, so the op writes
1496
- * `{ mode:'anchored', anchorPartId, offsetMs }` verbatim — no write-time
1497
- * host-picking. Captions anchor to their speech via the caption part's
1498
- * `start_ms` (offset within the speech).
1499
- */
1500
- declare const speechAssetSchema: z.ZodObject<{
1501
- speech_id: z.ZodString;
1502
- anchor_part_id: z.ZodString;
1503
- offset_ms: z.ZodNumber;
1504
- audio_storage_key: z.ZodString;
1505
- duration_ms: z.ZodNumber;
1506
- audio_script: z.ZodString;
1507
- volume: z.ZodNumber;
1508
- voice: z.ZodObject<{
1509
- id: z.ZodString;
1510
- name: z.ZodString;
1511
- }, z.core.$strip>;
1512
- origin_speech_id: z.ZodString;
1513
- caption_ids: z.ZodArray<z.ZodString>;
1514
- }, z.core.$strip>;
1515
- declare const captionAssetSchema: z.ZodObject<{
1516
- caption_id: z.ZodString;
1517
- speech_part_id: z.ZodString;
1518
- text: z.ZodString;
1519
- start_ms: z.ZodNumber;
1520
- duration_ms: z.ZodNumber;
1521
- }, z.core.$strip>;
1522
- /** A materialized speech-subtree write (speeches + their captions). */
1523
- declare const speechAssetsSchema: z.ZodObject<{
1524
- speeches: z.ZodArray<z.ZodObject<{
1525
- speech_id: z.ZodString;
1526
- anchor_part_id: z.ZodString;
1527
- offset_ms: z.ZodNumber;
1528
- audio_storage_key: z.ZodString;
1529
- duration_ms: z.ZodNumber;
1530
- audio_script: z.ZodString;
1531
- volume: z.ZodNumber;
1532
- voice: z.ZodObject<{
1533
- id: z.ZodString;
1534
- name: z.ZodString;
1535
- }, z.core.$strip>;
1536
- origin_speech_id: z.ZodString;
1537
- caption_ids: z.ZodArray<z.ZodString>;
1538
- }, z.core.$strip>>;
1539
- captions: z.ZodArray<z.ZodObject<{
1540
- caption_id: z.ZodString;
1541
- speech_part_id: z.ZodString;
1542
- text: z.ZodString;
1543
- start_ms: z.ZodNumber;
1544
- duration_ms: z.ZodNumber;
1545
- }, z.core.$strip>>;
1546
- }, z.core.$strip>;
1547
- type SpeechAsset = z.infer<typeof speechAssetSchema>;
1548
- type CaptionAsset = z.infer<typeof captionAssetSchema>;
1549
- type SpeechAssets = z.infer<typeof speechAssetsSchema>;
1550
- declare namespace index_d_exports {
1551
- export { AddSpeechesInput, AddVideoClipsInput, AdjustBgmVolumeInput, AdjustSpeechVolumeInput, AdjustVideoClipDurationInput, AdjustVideoClipVolumeInput, AnchoredDeletePolicy, AnchoredReplacePolicy, CaptionAsset, ChangeSpeechScriptInput, ChangeSpeechVoiceInput, DeleteBgmInput, DeleteSpeechesInput, DeleteVideoClipsInput, MoveAnchor, MoveSpeechesInput, MoveVideoClipsByAnchorInput, MoveVideoClipsInput, MovedClipAnchoredPolicy, ReplaceVideoClipContentInput, ReplaceVideoClipSequenceInput, ResizeCaptionInput, 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, resizeCaptionInputSchema, setBgmInputSchema, setCaptionStyleInputSchema, setCaptionVisibilityInputSchema, setVideoClipSpeedShiftInputSchema, speechAssetsSchema, speechIdSchema, speechIdsSchema, speedShiftSchema, timelineMsSchema, voiceSchema, volumeSchema };
1552
- }
1104
+ * The ULID is generated inline (Crockford Base32, 48-bit time + 80-bit random)
1105
+ * rather than pulling the `ulid` npm package: the randomness class matches the
1106
+ * old generator (both `Math.random`-based) and it keeps `@mengine/medeo-client`
1107
+ * dependency-free for a purely mechanical id string. Part ids only need to be
1108
+ * unique and lexicographically time-sortable, which this satisfies.
1109
+ */
1110
+ /**
1111
+ * Online part-id semantic prefixes. `clip` (video clip) is the only value the
1112
+ * engine currently mints (see `addVideoClips`); the rest are declared so the
1113
+ * type documents the shared vocabulary and guards against reintroducing the old
1114
+ * `vc`/`sp`/`cp`/`bg` names. Speech/caption/bgm ids arrive pre-minted in op
1115
+ * payloads, so the engine never generates them itself.
1116
+ */
1117
+ type PartIdPrefix = 'clip' | 'spe' | 'cap' | 'bgm' | 'ti';
1118
+ declare function generatePartId(prefix: PartIdPrefix): string;
1119
+ /** Injectable part-id mint; defaults to `generatePartId` on `SemanticEditor`. */
1120
+ type PartIdFactory = (prefix: PartIdPrefix) => string;
1553
1121
  //#endregion
1554
1122
  //#region src/editor/schema-validator.d.ts
1555
1123
  interface SnapshotReadable {
@@ -1600,7 +1168,6 @@ declare class SchemaValidator {
1600
1168
  validateSetBgm(input: SetBgmInput, _doc: SnapshotReadable): void;
1601
1169
  validateDeleteBgm(input: DeleteBgmInput, _doc: SnapshotReadable): void;
1602
1170
  validateSetCaptionVisibility(input: SetCaptionVisibilityInput, _doc: SnapshotReadable): void;
1603
- validateResizeCaption(input: ResizeCaptionInput, doc: SnapshotReadable): void;
1604
1171
  validateSetCaptionStyle(input: SetCaptionStyleInput, _doc: SnapshotReadable): void;
1605
1172
  private parse;
1606
1173
  private mainTrackIds;
@@ -1649,7 +1216,7 @@ declare class SchemaValidator {
1649
1216
  * side-effect payload contract in
1650
1217
  * `docs/projects/medeo-integration/results/phase-4-side-effect-payload-contract.md`.
1651
1218
  */
1652
- type ImplementedSemanticOpKind = 'MoveVideoClips' | 'MoveVideoClipsByAnchor' | 'DeleteVideoClips' | 'AddVideoClips' | 'AdjustVideoClipVolume' | 'SetVideoClipSpeedShift' | 'ReplaceVideoClipContent' | 'ReplaceVideoClipSequence' | 'AdjustVideoClipDuration' | 'AddSpeeches' | 'DeleteSpeeches' | 'MoveSpeeches' | 'ChangeSpeechScript' | 'ChangeSpeechVoice' | 'AdjustSpeechVolume' | 'ResizeCaption' | 'SetCaptionVisibility' | 'SetCaptionStyle' | 'SetBgm' | 'DeleteBgm' | 'AdjustBgmVolume';
1219
+ type ImplementedSemanticOpKind = 'MoveVideoClips' | 'MoveVideoClipsByAnchor' | 'DeleteVideoClips' | 'AddVideoClips' | 'AdjustVideoClipVolume' | 'SetVideoClipSpeedShift' | 'ReplaceVideoClipContent' | 'ReplaceVideoClipSequence' | 'AdjustVideoClipDuration' | 'AddSpeeches' | 'DeleteSpeeches' | 'MoveSpeeches' | 'ChangeSpeechScript' | 'ChangeSpeechVoice' | 'AdjustSpeechVolume' | 'SetCaptionVisibility' | 'SetCaptionStyle' | 'SetBgm' | 'DeleteBgm' | 'AdjustBgmVolume';
1653
1220
  /**
1654
1221
  * Operations on the roadmap but NOT yet implemented by `SemanticEditor`. Empty:
1655
1222
  * Phase 4 covers every op with a real entry point. Kept as a named type so the
@@ -1704,14 +1271,19 @@ interface OpActor {
1704
1271
  role: 'user' | 'agent';
1705
1272
  }
1706
1273
  interface CommitOptions {
1707
- intent?: {
1708
- kind: string;
1709
- payload: unknown;
1710
- };
1274
+ /**
1275
+ * Caller-supplied intent attached to the op's audit message.
1276
+ *
1277
+ * Typed as `unknown` to match `TransactAudit.intent`. The wire (real
1278
+ * mengine-server and the in-memory test double) only surfaces **string**
1279
+ * intents onto the audit log — non-string values stay in the Loro commit
1280
+ * message but parse to `null`. Agent callers should pass a string.
1281
+ */
1282
+ intent?: unknown;
1711
1283
  /** Author of this op; omitted for writes with no acting user (bootstrap, repair). */
1712
1284
  actor?: OpActor;
1713
1285
  }
1714
- type SemanticOpInput = MoveVideoClipsInput | MoveVideoClipsByAnchorInput | DeleteVideoClipsInput | AddVideoClipsInput | AdjustVideoClipVolumeInput | AdjustSpeechVolumeInput | AdjustBgmVolumeInput | SetVideoClipSpeedShiftInput | ReplaceVideoClipContentInput | ReplaceVideoClipSequenceInput | AdjustVideoClipDurationInput | AddSpeechesInput | DeleteSpeechesInput | MoveSpeechesInput | ResizeCaptionInput | SetCaptionVisibilityInput | SetCaptionStyleInput | SetBgmInput | DeleteBgmInput;
1286
+ type SemanticOpInput = MoveVideoClipsInput | MoveVideoClipsByAnchorInput | DeleteVideoClipsInput | AddVideoClipsInput | AdjustVideoClipVolumeInput | AdjustSpeechVolumeInput | AdjustBgmVolumeInput | SetVideoClipSpeedShiftInput | ReplaceVideoClipContentInput | ReplaceVideoClipSequenceInput | AdjustVideoClipDurationInput | AddSpeechesInput | DeleteSpeechesInput | MoveSpeechesInput | SetCaptionVisibilityInput | SetCaptionStyleInput | SetBgmInput | DeleteBgmInput;
1715
1287
  type SemanticOpName = ImplementedSemanticOpKind;
1716
1288
  /** Audit metadata committed alongside an op's writes. */
1717
1289
  interface TransactAudit {
@@ -1752,7 +1324,8 @@ interface SemanticDocumentAdapter extends SnapshotReadable {
1752
1324
  declare class SemanticEditor {
1753
1325
  private readonly doc;
1754
1326
  private readonly validator;
1755
- constructor(doc: SemanticDocumentAdapter, validator?: SchemaValidator);
1327
+ private readonly idFactory;
1328
+ constructor(doc: SemanticDocumentAdapter, validator?: SchemaValidator, idFactory?: PartIdFactory);
1756
1329
  moveVideoClips(input: MoveVideoClipsInput, options?: CommitOptions): Promise<void>;
1757
1330
  /**
1758
1331
  * Reorder main-track clips relative to an anchor clip, moving them as one block.
@@ -1857,8 +1430,6 @@ declare class SemanticEditor {
1857
1430
  deleteBgm(input: DeleteBgmInput, options?: CommitOptions): Promise<void>;
1858
1431
  /** Toggle caption visibility (caption track `is_hidden`). */
1859
1432
  setCaptionVisibility(input: SetCaptionVisibilityInput, options?: CommitOptions): Promise<void>;
1860
- /** Resize the caption placement window; cue/source duration stays immutable. */
1861
- resizeCaption(input: ResizeCaptionInput, options?: CommitOptions): Promise<void>;
1862
1433
  /**
1863
1434
  * Set the document-wide caption style. GLOBAL (no `caption_id`): the patch is
1864
1435
  * merged onto EVERY caption part's `style`, mirroring the FE, which applies a
@@ -1925,6 +1496,59 @@ declare class MirrorVideoDocumentAdapter implements SemanticDocumentAdapter {
1925
1496
  declare function createMirrorVideoDocument(document: VideoDocument, options?: MirrorVideoDocumentOptions): LoroDoc;
1926
1497
  /** Build a `MirrorVideoDocumentAdapter` over a fresh doc seeded with `document`. */
1927
1498
  declare function createMirrorVideoDocumentAdapter(document: VideoDocument, options?: MirrorVideoDocumentOptions): MirrorVideoDocumentAdapter;
1499
+ /** Host-only replacement of a derived view, retaining the existing Loro history. */
1500
+ declare function applyEntityTimelineProjection(doc: LoroDoc, projection: VideoDocument, entityRevision: number): Uint8Array;
1501
+ /** Write a whole `VideoDocument` into a draft (seed a fresh doc / plain-memory state). */
1502
+ declare function writeVideoDocumentToDraft(draft: VideoDocumentDraft, document: VideoDocument): void;
1503
+ //#endregion
1504
+ //#region src/document/plain-memory-adapter.d.ts
1505
+ /**
1506
+ * A `TransactAudit` widened with the ordered ids minted during that transact.
1507
+ * `generated_ids` is empty when the op never called the id factory.
1508
+ */
1509
+ interface JournalEntry extends TransactAudit {
1510
+ /** Ids produced by the adapter's id factory during this transact, in mint order. */
1511
+ generated_ids: string[];
1512
+ }
1513
+ interface PlainMemoryAdapterOptions {
1514
+ /** Underlying id mint; wrapped so each call inside a transact is journaled. */
1515
+ idFactory?: PartIdFactory;
1516
+ }
1517
+ /**
1518
+ * Pure in-memory `SemanticDocumentAdapter` — no Loro/WASM. Holds a
1519
+ * `VideoDocumentDraft` object and applies each `transact` via immer `produce`,
1520
+ * journaling every audit that actually mutated state (plus any ids minted
1521
+ * during that transact).
1522
+ *
1523
+ * Known benign difference vs `MirrorVideoDocumentAdapter`: the editor's
1524
+ * `setPart` assigns a fresh part object on every call, so a same-value rewrite
1525
+ * produces a new immer state and IS journaled here, while the mirror's deep
1526
+ * diff emits no commit. Terminal `snapshot()` stays equal; replay is idempotent.
1527
+ */
1528
+ declare class PlainMemoryAdapter implements SemanticDocumentAdapter {
1529
+ private state;
1530
+ private readonly _journal;
1531
+ private readonly baseIdFactory;
1532
+ /** Non-null only while a `transact` edit callback is running. */
1533
+ private pendingIds;
1534
+ /**
1535
+ * Recording wrapper around the underlying factory. Callers (sandbox editor)
1536
+ * use this so every minted id is appended to the current transact's list.
1537
+ */
1538
+ readonly idFactory: PartIdFactory;
1539
+ constructor(document: VideoDocument, options?: PlainMemoryAdapterOptions);
1540
+ get journal(): readonly JournalEntry[];
1541
+ hasContent(): boolean;
1542
+ snapshot(): VideoDocument;
1543
+ /**
1544
+ * Apply one op via immer. A throw in `edit` discards the draft (state and
1545
+ * journal unchanged). When `produce` returns the same reference, there was
1546
+ * no structural change — skip journal, matching mirror "no change, no commit".
1547
+ */
1548
+ transact(edit: (draft: VideoDocumentDraft) => void, audit: TransactAudit): void;
1549
+ }
1550
+ /** Build a `PlainMemoryAdapter` seeded with `document`. */
1551
+ declare function createPlainMemoryAdapter(document: VideoDocument, options?: PlainMemoryAdapterOptions): PlainMemoryAdapter;
1928
1552
  //#endregion
1929
1553
  //#region src/document/mirror-read.d.ts
1930
1554
  /**
@@ -2009,7 +1633,10 @@ declare const partUnionSchema: z.ZodUnion<readonly [z.ZodObject<{
2009
1633
  }, z.core.$loose>]>;
2010
1634
  declare const videoDocumentSchema: z.ZodObject<{
2011
1635
  meta: z.ZodObject<{
2012
- schema_version: z.ZodLiteral<"video-document/v0">;
1636
+ schema_version: z.ZodEnum<{
1637
+ "video-document/v0": "video-document/v0";
1638
+ "video-document/entity-projection-v1": "video-document/entity-projection-v1";
1639
+ }>;
2013
1640
  draft_id: z.ZodOptional<z.ZodString>;
2014
1641
  project_id: z.ZodOptional<z.ZodString>;
2015
1642
  owner_id: z.ZodOptional<z.ZodString>;
@@ -2024,9 +1651,9 @@ declare const videoDocumentSchema: z.ZodObject<{
2024
1651
  tracks: z.ZodOptional<z.ZodArray<z.ZodObject<{
2025
1652
  id: z.ZodOptional<z.ZodString>;
2026
1653
  parts_kind: z.ZodOptional<z.ZodEnum<{
2027
- bgm: "bgm";
2028
- caption: "caption";
2029
1654
  speech: "speech";
1655
+ caption: "caption";
1656
+ bgm: "bgm";
2030
1657
  video_clip: "video_clip";
2031
1658
  }>>;
2032
1659
  is_hidden: z.ZodOptional<z.ZodBoolean>;
@@ -2043,7 +1670,6 @@ declare const videoDocumentSchema: z.ZodObject<{
2043
1670
  offsetMs: z.ZodNumber;
2044
1671
  }, z.core.$loose>], "mode">;
2045
1672
  fallback_abs_ms: z.ZodOptional<z.ZodNumber>;
2046
- duration_override_ms: z.ZodOptional<z.ZodNumber>;
2047
1673
  }, z.core.$loose>>>;
2048
1674
  }, z.core.$loose>>>;
2049
1675
  part_library: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
@@ -2110,4 +1736,4 @@ declare const videoDocumentSchema: z.ZodObject<{
2110
1736
  }, z.core.$loose>]>>>;
2111
1737
  }, z.core.$loose>;
2112
1738
  //#endregion
2113
- export { VideoDocumentSchemaVersion as $, assertValidVideoDocument as A, BgmPart as B, index_d_exports as C, VideoDocumentMirrorSchema as D, VideoDocumentDraft as E, SpeechHostMap as F, SpeechPart as G, DEFAULT_UNIT_TIME_MS as H, buildSpeechHostMap as I, TrackItem as J, Timeline as K, derivePositionFromAbs as L, InitialDocumentFacts as M, buildInitialVideoDocument as N, videoDocumentMirrorSchema as O, DerivedItemPosition as P, VideoDocument as Q, fromVideoDocument as R, ValidationError as S, TrackItemDraft as T, PartKind as U, CaptionPart as V, PartUnion as W, VIDEO_DOCUMENT_SCHEMA_VERSION as X, TrackItemTimePosition as Y, VideoClipPart as Z, PlannedSemanticOpKind as _, MirrorVideoDocumentOptions as a, CaptionPart$1 as at, SchemaValidator as b, CommitOptions as c, SpeedShift as ct, SemanticEditor as d, TrackItem$1 as dt, VideoDocumentValidationIssue as et, SemanticOpInput as f, ImplementedSemanticOpKind as g, IMPLEMENTED_SEMANTIC_OP_KINDS as h, MirrorVideoDocumentAdapter as i, Attachment as it, validateVideoDocument as j, VideoDocumentValidationError as k, OpActor as l, Timeline$1 as lt, TransactAudit as m, videoDocumentSchema as n, VideoDraft as nt, createMirrorVideoDocument as o, CaptionStyle as ot, SemanticOpName as p, Track as q, readVideoDocumentFromDraft as r, VideoDraftPartUnion as rt, createMirrorVideoDocumentAdapter as s, PartAggregation as st, partUnionSchema as t, VideoDocumentValidationIssueCode as tt, SemanticDocumentAdapter as u, Track$1 as ut, SemanticOpKind as v, TrackDraft as w, SnapshotReadable as x, isImplementedSemanticOpKind as y, toVideoDocument as z };
1739
+ export { VoiceDescriptor as $, generatePartId as A, Attachment as At, ResolvedEntityClipPlacement as B, PlannedSemanticOpKind as C, VideoDocumentSchemaVersion as Ct, SnapshotReadable as D, VideoDraftPartUnion as Dt, SchemaValidator as E, VideoDraft as Et, videoDocumentMirrorSchema as F, Timeline$1 as Ft, EntityTimelineProjectionError as G, ResolvedEntityTrack as H, VideoDocumentValidationError as I, Track$1 as It, JsonObject as J, EntityRelationRows as K, assertValidVideoDocument as L, TrackItem$1 as Lt, TrackItemDraft as M, CaptionStyle as Mt, VideoDocumentDraft as N, PartAggregation as Nt, ValidationError as O, effectiveVideoClipDurationMs as Ot, VideoDocumentMirrorSchema as P, SpeedShift as Pt, SequenceRange as Q, validateVideoDocument as R, ImplementedSemanticOpKind as S, VideoDocument as St, isImplementedSemanticOpKind as T, VideoDocumentValidationIssueCode as Tt, resolveEntityTimelineLayout as U, ResolvedEntityTimelineLayout as V, projectEntityTimeline as W, CaptionStyleFields as X, JsonValue as Y, SequenceDuration as Z, SemanticEditor as _, Track as _t, PlainMemoryAdapter as a, buildSpeechHostMap as at, TransactAudit as b, VIDEO_DOCUMENT_SCHEMA_VERSION as bt, MirrorVideoDocumentAdapter as c, toVideoDocument as ct, createMirrorVideoDocument as d, DEFAULT_UNIT_TIME_MS as dt, EntityId as et, createMirrorVideoDocumentAdapter as f, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION as ft, SemanticDocumentAdapter as g, Timeline as gt, OpActor as h, SpeechPart as ht, JournalEntry as i, SpeechHostMap as it, TrackDraft as j, CaptionPart$1 as jt, PartIdFactory as k, speedOf as kt, MirrorVideoDocumentOptions as l, BgmPart as lt, CommitOptions as m, PartUnion as mt, videoDocumentSchema as n, buildInitialVideoDocument as nt, PlainMemoryAdapterOptions as o, derivePositionFromAbs as ot, writeVideoDocumentToDraft as p, PartKind as pt, EntityRow as q, readVideoDocumentFromDraft as r, DerivedItemPosition as rt, createPlainMemoryAdapter as s, fromVideoDocument as st, partUnionSchema as t, InitialDocumentFacts as tt, applyEntityTimelineProjection as u, CaptionPart as ut, SemanticOpInput as v, TrackItem as vt, SemanticOpKind as w, VideoDocumentValidationIssue as wt, IMPLEMENTED_SEMANTIC_OP_KINDS as x, VideoClipPart as xt, SemanticOpName as y, TrackItemTimePosition as yt, EntityTimelineTrackRole as z };