@mengine/medeo-client 1.1.0 → 1.2.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{document-C98vSu7J.js → document-49OdvviW.js} +146 -6
- package/dist/{index-BUKA3L7o.d.ts → index-BO2fSUKi.d.ts} +127 -608
- package/dist/index-InEWX9rk.d.ts +609 -0
- package/dist/index.d.ts +42 -34
- package/dist/index.js +148 -575
- package/dist/schemas.d.ts +2 -0
- package/dist/schemas.js +518 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +40 -1
- package/package.json +7 -4
|
@@ -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-InEWX9rk.js";
|
|
1
2
|
import { InferInputType } from "loro-mirror";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
import { LoroDoc, PeerID } from "loro-crdt";
|
|
@@ -552,6 +553,19 @@ interface Track {
|
|
|
552
553
|
is_hidden: boolean | undefined;
|
|
553
554
|
items: TrackItem[] | undefined;
|
|
554
555
|
}
|
|
556
|
+
/** The linear speed multiplier of a `speed_shift`, defaulting to 1 (original). */
|
|
557
|
+
declare function speedOf(speedShift: SpeedShift | undefined): number;
|
|
558
|
+
/**
|
|
559
|
+
* A video clip's effective timeline duration, derived from authoritative facts
|
|
560
|
+
* (RFC 02, `reference/16` §4, reference/17 §5): the trim window
|
|
561
|
+
* `play_out - play_in` divided by the speed multiplier, rounded to integer ms.
|
|
562
|
+
* `play_in` / `play_out` are optional in the IDL but every write path sets them
|
|
563
|
+
* (defaulting to the whole media), and the legacy-ingest projection backfills the
|
|
564
|
+
* window from a legacy `duration_ms` — so an authoritative clip always carries a
|
|
565
|
+
* trim window and there is no stored `duration_ms` to fall back to. A clip with
|
|
566
|
+
* neither bound yields 0. Speeds the clip up (>1× → shorter) or down (<1×).
|
|
567
|
+
*/
|
|
568
|
+
declare function effectiveVideoClipDurationMs(clip: VideoClipPart): number;
|
|
555
569
|
/**
|
|
556
570
|
* Authoritative part union: a flat discriminated union over the four part kinds.
|
|
557
571
|
* Deliberately *not* the IDL's namespace union (no `$unknown` / `visit`): engine
|
|
@@ -632,6 +646,16 @@ type VideoDraft = Omit<VideoDraft$1, 'part_library' | 'video_creation_settings'>
|
|
|
632
646
|
interface Timeline {
|
|
633
647
|
unit_time_ms: number | undefined;
|
|
634
648
|
}
|
|
649
|
+
/**
|
|
650
|
+
* The `timeline.unit_time_ms` the read-view states when the document states none.
|
|
651
|
+
*
|
|
652
|
+
* One frame at 30fps. A document legitimately has no such fact (display
|
|
653
|
+
* granularity is the editor's, not the timeline's), but the read-view IDL marks
|
|
654
|
+
* the field `@required`, so the projection has to name a value. This one is a
|
|
655
|
+
* usable granularity; `0` — which a downstream consumer had been defaulting to —
|
|
656
|
+
* is not, and passes any `>= 0` guard on its way to an editor that cannot use it.
|
|
657
|
+
*/
|
|
658
|
+
declare const DEFAULT_UNIT_TIME_MS = 33.333;
|
|
635
659
|
/**
|
|
636
660
|
* Project-level scalars that do not participate in track ordering. Grouped under
|
|
637
661
|
* `meta` because the loro-mirror `schema()` root only accepts container schemas,
|
|
@@ -748,6 +772,20 @@ declare function derivePositionFromAbs(partId: string, abs: number, isMain: bool
|
|
|
748
772
|
* Project the authoritative `VideoDocument` back into the legacy `VideoDraft`
|
|
749
773
|
* read-view, solving each item's absolute position, the `part_aggregations`, and
|
|
750
774
|
* the total duration via the timeline-core cascade.
|
|
775
|
+
*
|
|
776
|
+
* The read-view is a compatibility contract, and the IDL declares
|
|
777
|
+
* `Timeline.unit_time_ms` and `Track.is_hidden` `@required`
|
|
778
|
+
* (`video_draft_comp.smithy`) — so a projection that omitted them handed every
|
|
779
|
+
* consumer a payload that violated the shape it claims to satisfy, leaving each
|
|
780
|
+
* one to invent its own default. Two already had, and they disagreed: the agent
|
|
781
|
+
* harness used `unit_time_ms: 0`, director used a frame at 30fps. Defaulting here
|
|
782
|
+
* makes the contract true at the one place that produces it.
|
|
783
|
+
*
|
|
784
|
+
* These two are defaultable because the projection knows their values on its own:
|
|
785
|
+
* absent `unit_time_ms` means "no display granularity was ever stated" and absent
|
|
786
|
+
* `is_hidden` means "this track was never hidden". `version` is NOT defaultable
|
|
787
|
+
* here — its only honest value is server state (`update_seq`) that a
|
|
788
|
+
* `VideoDocument` cannot see, so it stays absent and the HTTP layer fills it.
|
|
751
789
|
*/
|
|
752
790
|
declare function fromVideoDocument(document: VideoDocument): VideoDraft;
|
|
753
791
|
//#endregion
|
|
@@ -911,611 +949,35 @@ type TrackDraft = NonNullable<NonNullable<VideoDocumentDraft['tracks']>[number]>
|
|
|
911
949
|
/** A single track item in a draft. */
|
|
912
950
|
type TrackItemDraft = NonNullable<NonNullable<TrackDraft['items']>[number]>;
|
|
913
951
|
//#endregion
|
|
914
|
-
//#region src/editor/
|
|
915
|
-
/**
|
|
916
|
-
* Add speeches (and their captions). TTS runs upstream; the stable speech /
|
|
917
|
-
* caption parts arrive materialized (see `speech-assets.ts`). The op writes the
|
|
918
|
-
* parts and each speech's `{ mode:'anchored', anchorPartId, offsetMs }` fact
|
|
919
|
-
* verbatim — no write-time host-picking, no cascade (RFC 02 §4). The projection
|
|
920
|
-
* derives absolute positions on read.
|
|
921
|
-
*/
|
|
922
|
-
declare const addSpeechesInputSchema: z.ZodObject<{
|
|
923
|
-
speeches: z.ZodArray<z.ZodObject<{
|
|
924
|
-
speech_id: z.ZodString;
|
|
925
|
-
anchor_part_id: z.ZodString;
|
|
926
|
-
offset_ms: z.ZodNumber;
|
|
927
|
-
audio_storage_key: z.ZodString;
|
|
928
|
-
duration_ms: z.ZodNumber;
|
|
929
|
-
audio_script: z.ZodString;
|
|
930
|
-
volume: z.ZodNumber;
|
|
931
|
-
voice: z.ZodObject<{
|
|
932
|
-
id: z.ZodString;
|
|
933
|
-
name: z.ZodString;
|
|
934
|
-
}, z.core.$strip>;
|
|
935
|
-
origin_speech_id: z.ZodString;
|
|
936
|
-
caption_ids: z.ZodArray<z.ZodString>;
|
|
937
|
-
}, z.core.$strip>>;
|
|
938
|
-
captions: z.ZodArray<z.ZodObject<{
|
|
939
|
-
caption_id: z.ZodString;
|
|
940
|
-
speech_part_id: z.ZodString;
|
|
941
|
-
text: z.ZodString;
|
|
942
|
-
start_ms: z.ZodNumber;
|
|
943
|
-
duration_ms: z.ZodNumber;
|
|
944
|
-
}, z.core.$strip>>;
|
|
945
|
-
}, z.core.$strip>;
|
|
946
|
-
type AddSpeechesInput = z.infer<typeof addSpeechesInputSchema>;
|
|
947
|
-
//#endregion
|
|
948
|
-
//#region src/editor/schemas/add-video-clips.d.ts
|
|
949
|
-
/**
|
|
950
|
-
* Add video clips to a track. Each clip's duration facts are separated so a
|
|
951
|
-
* single number is never overloaded (RFC 02 / `reference/16` §0b):
|
|
952
|
-
*
|
|
953
|
-
* - `media_duration_ms` is the source media's intrinsic full length (a resource
|
|
954
|
-
* fact, written to the part);
|
|
955
|
-
* - `play_in` / `play_out` are the optional trim window into that media; when
|
|
956
|
-
* omitted the whole media is used (`play_in=0`, `play_out=media_duration_ms`).
|
|
957
|
-
*
|
|
958
|
-
* The clip's effective timeline duration is derived by the projection from the
|
|
959
|
-
* trim window and `speed_shift` — it is never an input here.
|
|
960
|
-
*/
|
|
961
|
-
declare const addVideoClipsInputSchema: z.ZodObject<{
|
|
962
|
-
clips: z.ZodArray<z.ZodObject<{
|
|
963
|
-
media_id: z.ZodString;
|
|
964
|
-
start_ms: z.ZodOptional<z.ZodNumber>;
|
|
965
|
-
media_duration_ms: z.ZodNumber;
|
|
966
|
-
play_in: z.ZodOptional<z.ZodNumber>;
|
|
967
|
-
play_out: z.ZodOptional<z.ZodNumber>;
|
|
968
|
-
track_id: z.ZodOptional<z.ZodString>;
|
|
969
|
-
}, z.core.$strip>>;
|
|
970
|
-
before_clip_id: z.ZodOptional<z.ZodString>;
|
|
971
|
-
after_clip_id: z.ZodOptional<z.ZodString>;
|
|
972
|
-
}, z.core.$strip>;
|
|
973
|
-
type AddVideoClipsInput = z.infer<typeof addVideoClipsInputSchema>;
|
|
974
|
-
//#endregion
|
|
975
|
-
//#region src/editor/schemas/adjust-bgm-volume.d.ts
|
|
976
|
-
declare const adjustBgmVolumeInputSchema: z.ZodObject<{
|
|
977
|
-
bgm: z.ZodArray<z.ZodObject<{
|
|
978
|
-
bgm_id: z.ZodString;
|
|
979
|
-
volume: z.ZodNumber;
|
|
980
|
-
}, z.core.$strip>>;
|
|
981
|
-
}, z.core.$strip>;
|
|
982
|
-
type AdjustBgmVolumeInput = z.infer<typeof adjustBgmVolumeInputSchema>;
|
|
983
|
-
//#endregion
|
|
984
|
-
//#region src/editor/schemas/adjust-speech-volume.d.ts
|
|
985
|
-
declare const adjustSpeechVolumeInputSchema: z.ZodObject<{
|
|
986
|
-
speeches: z.ZodArray<z.ZodObject<{
|
|
987
|
-
speech_id: z.ZodString;
|
|
988
|
-
volume: z.ZodNumber;
|
|
989
|
-
}, z.core.$strip>>;
|
|
990
|
-
}, z.core.$strip>;
|
|
991
|
-
type AdjustSpeechVolumeInput = z.infer<typeof adjustSpeechVolumeInputSchema>;
|
|
992
|
-
//#endregion
|
|
993
|
-
//#region src/editor/schemas/adjust-video-clip-duration.d.ts
|
|
994
|
-
/**
|
|
995
|
-
* Re-trim existing video clips (the user-facing "adjust duration" gesture is a
|
|
996
|
-
* trim of the source window). The new `play_in` / `play_out` are the facts; the
|
|
997
|
-
* effective timeline duration is derived from them and the clip's `speed_shift`,
|
|
998
|
-
* and the change reflows downstream clips, speeches, and the timeline inside the
|
|
999
|
-
* op's transaction (no caller-materialized cascade).
|
|
1000
|
-
*/
|
|
1001
|
-
declare const adjustVideoClipDurationInputSchema: z.ZodObject<{
|
|
1002
|
-
clips: z.ZodArray<z.ZodObject<{
|
|
1003
|
-
clip_id: z.ZodString;
|
|
1004
|
-
play_in: z.ZodNumber;
|
|
1005
|
-
play_out: z.ZodNumber;
|
|
1006
|
-
}, z.core.$strip>>;
|
|
1007
|
-
}, z.core.$strip>;
|
|
1008
|
-
type AdjustVideoClipDurationInput = z.infer<typeof adjustVideoClipDurationInputSchema>;
|
|
1009
|
-
//#endregion
|
|
1010
|
-
//#region src/editor/schemas/adjust-video-clip-volume.d.ts
|
|
1011
|
-
declare const adjustVideoClipVolumeInputSchema: z.ZodObject<{
|
|
1012
|
-
clips: z.ZodArray<z.ZodObject<{
|
|
1013
|
-
clip_id: z.ZodString;
|
|
1014
|
-
volume: z.ZodNumber;
|
|
1015
|
-
}, z.core.$strip>>;
|
|
1016
|
-
}, z.core.$strip>;
|
|
1017
|
-
type AdjustVideoClipVolumeInput = z.infer<typeof adjustVideoClipVolumeInputSchema>;
|
|
1018
|
-
//#endregion
|
|
1019
|
-
//#region src/editor/schemas/change-speech.d.ts
|
|
1020
|
-
/**
|
|
1021
|
-
* Change a speech's script or voice. Both re-run TTS upstream and return the
|
|
1022
|
-
* regenerated speech / caption parts in the same materialized shape as
|
|
1023
|
-
* `AddSpeeches` (`speech-assets.ts`); the op upserts them by id (the speech part
|
|
1024
|
-
* id is preserved across a re-TTS), re-seats at `start_ms`, and reflows. Old
|
|
1025
|
-
* caption parts no longer owned by the speech are removed via `caption_ids`.
|
|
1026
|
-
*/
|
|
1027
|
-
declare const changeSpeechScriptInputSchema: z.ZodObject<{
|
|
1028
|
-
speeches: z.ZodArray<z.ZodObject<{
|
|
1029
|
-
speech_id: z.ZodString;
|
|
1030
|
-
anchor_part_id: z.ZodString;
|
|
1031
|
-
offset_ms: z.ZodNumber;
|
|
1032
|
-
audio_storage_key: z.ZodString;
|
|
1033
|
-
duration_ms: z.ZodNumber;
|
|
1034
|
-
audio_script: z.ZodString;
|
|
1035
|
-
volume: z.ZodNumber;
|
|
1036
|
-
voice: z.ZodObject<{
|
|
1037
|
-
id: z.ZodString;
|
|
1038
|
-
name: z.ZodString;
|
|
1039
|
-
}, z.core.$strip>;
|
|
1040
|
-
origin_speech_id: z.ZodString;
|
|
1041
|
-
caption_ids: z.ZodArray<z.ZodString>;
|
|
1042
|
-
}, z.core.$strip>>;
|
|
1043
|
-
captions: z.ZodArray<z.ZodObject<{
|
|
1044
|
-
caption_id: z.ZodString;
|
|
1045
|
-
speech_part_id: z.ZodString;
|
|
1046
|
-
text: z.ZodString;
|
|
1047
|
-
start_ms: z.ZodNumber;
|
|
1048
|
-
duration_ms: z.ZodNumber;
|
|
1049
|
-
}, z.core.$strip>>;
|
|
1050
|
-
}, z.core.$strip>;
|
|
1051
|
-
declare const changeSpeechVoiceInputSchema: z.ZodObject<{
|
|
1052
|
-
speeches: z.ZodArray<z.ZodObject<{
|
|
1053
|
-
speech_id: z.ZodString;
|
|
1054
|
-
anchor_part_id: z.ZodString;
|
|
1055
|
-
offset_ms: z.ZodNumber;
|
|
1056
|
-
audio_storage_key: z.ZodString;
|
|
1057
|
-
duration_ms: z.ZodNumber;
|
|
1058
|
-
audio_script: z.ZodString;
|
|
1059
|
-
volume: z.ZodNumber;
|
|
1060
|
-
voice: z.ZodObject<{
|
|
1061
|
-
id: z.ZodString;
|
|
1062
|
-
name: z.ZodString;
|
|
1063
|
-
}, z.core.$strip>;
|
|
1064
|
-
origin_speech_id: z.ZodString;
|
|
1065
|
-
caption_ids: z.ZodArray<z.ZodString>;
|
|
1066
|
-
}, z.core.$strip>>;
|
|
1067
|
-
captions: z.ZodArray<z.ZodObject<{
|
|
1068
|
-
caption_id: z.ZodString;
|
|
1069
|
-
speech_part_id: z.ZodString;
|
|
1070
|
-
text: z.ZodString;
|
|
1071
|
-
start_ms: z.ZodNumber;
|
|
1072
|
-
duration_ms: z.ZodNumber;
|
|
1073
|
-
}, z.core.$strip>>;
|
|
1074
|
-
}, z.core.$strip>;
|
|
1075
|
-
type ChangeSpeechScriptInput = z.infer<typeof changeSpeechScriptInputSchema>;
|
|
1076
|
-
type ChangeSpeechVoiceInput = z.infer<typeof changeSpeechVoiceInputSchema>;
|
|
1077
|
-
//#endregion
|
|
1078
|
-
//#region src/editor/schemas/delete-bgm.d.ts
|
|
1079
|
-
/**
|
|
1080
|
-
* Remove the document BGM. Pure document edit: clears the bgm lane and removes
|
|
1081
|
-
* the bgm part. Takes no input (a document holds at most one bgm); an empty
|
|
1082
|
-
* object keeps the op signature uniform with the rest.
|
|
1083
|
-
*/
|
|
1084
|
-
declare const deleteBgmInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
1085
|
-
type DeleteBgmInput = z.infer<typeof deleteBgmInputSchema>;
|
|
1086
|
-
//#endregion
|
|
1087
|
-
//#region src/editor/schemas/delete-speeches.d.ts
|
|
1088
|
-
/**
|
|
1089
|
-
* Delete speeches with their captions. Pure document edit (no side effect): the
|
|
1090
|
-
* op removes each speech part, cascade-deletes the captions it owns (via
|
|
1091
|
-
* `caption_ids` / `speech_part_id`), drops their track items, and reflows.
|
|
1092
|
-
*/
|
|
1093
|
-
declare const deleteSpeechesInputSchema: z.ZodObject<{
|
|
1094
|
-
speech_ids: z.ZodArray<z.ZodString>;
|
|
1095
|
-
}, z.core.$strip>;
|
|
1096
|
-
type DeleteSpeechesInput = z.infer<typeof deleteSpeechesInputSchema>;
|
|
1097
|
-
//#endregion
|
|
1098
|
-
//#region src/editor/schemas/delete-video-clips.d.ts
|
|
1099
|
-
/**
|
|
1100
|
-
* How a delete handles the anchored subtree (speeches anchored to a deleted clip,
|
|
1101
|
-
* and their captions) — a delete-op policy, not a data-model field (reference/17
|
|
1102
|
-
* §6). `cascade` (default) removes the subtree; `detach` keeps the direct
|
|
1103
|
-
* anchored children, re-pinning them to `absolute` so they stay on the timeline.
|
|
1104
|
-
*/
|
|
1105
|
-
declare const anchoredDeletePolicySchema: z.ZodEnum<{
|
|
1106
|
-
cascade: "cascade";
|
|
1107
|
-
detach: "detach";
|
|
1108
|
-
}>;
|
|
1109
|
-
type AnchoredDeletePolicy = z.infer<typeof anchoredDeletePolicySchema>;
|
|
1110
|
-
declare const deleteVideoClipsInputSchema: z.ZodObject<{
|
|
1111
|
-
clip_ids: z.ZodArray<z.ZodString>;
|
|
1112
|
-
on_anchored: z.ZodOptional<z.ZodEnum<{
|
|
1113
|
-
cascade: "cascade";
|
|
1114
|
-
detach: "detach";
|
|
1115
|
-
}>>;
|
|
1116
|
-
}, z.core.$strip>;
|
|
1117
|
-
type DeleteVideoClipsInput = z.infer<typeof deleteVideoClipsInputSchema>;
|
|
1118
|
-
//#endregion
|
|
1119
|
-
//#region src/editor/schemas/move-speeches.d.ts
|
|
1120
|
-
/**
|
|
1121
|
-
* Move speeches in time. Pure document edit: the op re-seats each speech at its
|
|
1122
|
-
* new absolute `start_ms`; the cascade reassigns it to the host video clip,
|
|
1123
|
-
* resolves overlaps, and reflows. Captions follow their speech.
|
|
1124
|
-
*/
|
|
1125
|
-
declare const moveSpeechesInputSchema: z.ZodObject<{
|
|
1126
|
-
speeches: z.ZodArray<z.ZodObject<{
|
|
1127
|
-
speech_id: z.ZodString;
|
|
1128
|
-
new_start_ms: z.ZodNumber;
|
|
1129
|
-
}, z.core.$strip>>;
|
|
1130
|
-
}, z.core.$strip>;
|
|
1131
|
-
type MoveSpeechesInput = z.infer<typeof moveSpeechesInputSchema>;
|
|
1132
|
-
//#endregion
|
|
1133
|
-
//#region src/editor/schemas/move-video-clips-by-anchor.d.ts
|
|
1134
|
-
/**
|
|
1135
|
-
* Where the moved block lands on the main track.
|
|
1136
|
-
*
|
|
1137
|
-
* A discriminated union rather than two optional `before_clip_id` /
|
|
1138
|
-
* `after_clip_id` fields (the shape `addVideoClips` had to use, because there the
|
|
1139
|
-
* two modes share a whole clip description): here the alternatives carry nothing
|
|
1140
|
-
* in common, so making them mutually exclusive *by type* removes three runtime
|
|
1141
|
-
* `superRefine` checks that would otherwise have to be written and tested.
|
|
1142
|
-
*
|
|
1143
|
-
* `track_start` is an explicit member, not the absence of an anchor. The
|
|
1144
|
-
* agent-harness mutation this maps from treats "neither anchor given" as
|
|
1145
|
-
* "move to the front" (`applyBatchMoveVideoClips` falls back to `insertIndex = 0`),
|
|
1146
|
-
* which is a default buried in a tool description. Requiring the caller to name
|
|
1147
|
-
* that intent keeps a forgotten field from silently reordering the timeline.
|
|
1148
|
-
*/
|
|
1149
|
-
declare const moveAnchorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1150
|
-
position: z.ZodLiteral<"before">;
|
|
1151
|
-
clip_id: z.ZodString;
|
|
1152
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1153
|
-
position: z.ZodLiteral<"after">;
|
|
1154
|
-
clip_id: z.ZodString;
|
|
1155
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1156
|
-
position: z.ZodLiteral<"track_start">;
|
|
1157
|
-
}, z.core.$strip>], "position">;
|
|
1158
|
-
/**
|
|
1159
|
-
* What happens to the speeches anchored to the clips being moved.
|
|
1160
|
-
*
|
|
1161
|
-
* - `follow` keeps each speech anchored where it is, so it travels with its clip
|
|
1162
|
-
* to the new position. In the anchored model this is the *no-op* branch: a
|
|
1163
|
-
* speech's authoritative fact is `{ anchorPartId, offsetMs }` and its absolute
|
|
1164
|
-
* time is derived on read from the host's position, so moving the host moves
|
|
1165
|
-
* the speech with no write to the speech at all.
|
|
1166
|
-
* - `keep_absolute` preserves each speech's current absolute landing instead, then
|
|
1167
|
-
* re-anchors it to whichever clip now covers that time (RFC 02 §9.1/§11.1). This
|
|
1168
|
-
* is the branch that costs an extra pass, and the one the FE timeline uses.
|
|
1169
|
-
*
|
|
1170
|
-
* **Required, with no default**, matching `deleteVideoClips` and
|
|
1171
|
-
* `replaceVideoClipSequence`. The two branches decide which picture the user's
|
|
1172
|
-
* narration ends up over, which is too consequential to infer from a missing
|
|
1173
|
-
* field — and neither branch is "safe enough" to be the implicit one.
|
|
1174
|
-
*/
|
|
1175
|
-
declare const movedClipAnchoredPolicySchema: z.ZodEnum<{
|
|
1176
|
-
follow: "follow";
|
|
1177
|
-
keep_absolute: "keep_absolute";
|
|
1178
|
-
}>;
|
|
1179
|
-
/**
|
|
1180
|
-
* Reorder a set of main-track clips relative to a reference clip.
|
|
1181
|
-
*
|
|
1182
|
-
* Distinct from `moveVideoClips`, which positions clips by absolute time
|
|
1183
|
-
* (`new_start_ms`) and is what the FE timeline dispatches after a drag. Main-track
|
|
1184
|
-
* clips are `sequential`-positioned, so absolute time is not authoritative state
|
|
1185
|
-
* there (RFC 02 §4/§7): `moveVideoClips` has to *guess* an index back out of the
|
|
1186
|
-
* time it was handed, whereas an anchor already is the ordinal fact being changed.
|
|
1187
|
-
* Keeping them separate also isolates blast radius — this method can diverge on
|
|
1188
|
-
* speech policy without touching the FE path.
|
|
1189
|
-
*
|
|
1190
|
-
* `clip_ids` need not be contiguous. They move as one block, keeping their
|
|
1191
|
-
* relative order, which is the agent-harness `batch_move_video_clips` contract.
|
|
1192
|
-
*/
|
|
1193
|
-
declare const moveVideoClipsByAnchorInputSchema: z.ZodObject<{
|
|
1194
|
-
clip_ids: z.ZodArray<z.ZodString>;
|
|
1195
|
-
anchor: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1196
|
-
position: z.ZodLiteral<"before">;
|
|
1197
|
-
clip_id: z.ZodString;
|
|
1198
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1199
|
-
position: z.ZodLiteral<"after">;
|
|
1200
|
-
clip_id: z.ZodString;
|
|
1201
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1202
|
-
position: z.ZodLiteral<"track_start">;
|
|
1203
|
-
}, z.core.$strip>], "position">;
|
|
1204
|
-
on_anchored: z.ZodEnum<{
|
|
1205
|
-
follow: "follow";
|
|
1206
|
-
keep_absolute: "keep_absolute";
|
|
1207
|
-
}>;
|
|
1208
|
-
}, z.core.$strip>;
|
|
1209
|
-
type MoveAnchor = z.infer<typeof moveAnchorSchema>;
|
|
1210
|
-
type MovedClipAnchoredPolicy = z.infer<typeof movedClipAnchoredPolicySchema>;
|
|
1211
|
-
type MoveVideoClipsByAnchorInput = z.infer<typeof moveVideoClipsByAnchorInputSchema>;
|
|
1212
|
-
//#endregion
|
|
1213
|
-
//#region src/editor/schemas/move-video-clips.d.ts
|
|
1214
|
-
declare const moveVideoClipsInputSchema: z.ZodObject<{
|
|
1215
|
-
clips: z.ZodArray<z.ZodObject<{
|
|
1216
|
-
clip_id: z.ZodString;
|
|
1217
|
-
new_start_ms: z.ZodNumber;
|
|
1218
|
-
new_track_id: z.ZodOptional<z.ZodString>;
|
|
1219
|
-
}, z.core.$strip>>;
|
|
1220
|
-
}, z.core.$strip>;
|
|
1221
|
-
type MoveVideoClipsInput = z.infer<typeof moveVideoClipsInputSchema>;
|
|
1222
|
-
//#endregion
|
|
1223
|
-
//#region src/editor/schemas/replace-video-clip-content.d.ts
|
|
1224
|
-
/**
|
|
1225
|
-
* Replace the media backing existing video clips. The media import runs upstream
|
|
1226
|
-
* (Director); its stable result — the new media id, intrinsic length, and the
|
|
1227
|
-
* reset trim window — arrives materialized (see
|
|
1228
|
-
* `results/phase-4-side-effect-payload-contract.md` §4). Director resets
|
|
1229
|
-
* `play_in=0` / `play_out=media_duration_ms` and clears `speed_shift` on
|
|
1230
|
-
* replacement. The clip `part_id`s (hence their track items) are unchanged; the
|
|
1231
|
-
* editor reflows the main track from the new effective durations.
|
|
1232
|
-
*/
|
|
1233
|
-
declare const replaceVideoClipContentInputSchema: z.ZodObject<{
|
|
1234
|
-
clips: z.ZodArray<z.ZodObject<{
|
|
1235
|
-
clip_id: z.ZodString;
|
|
1236
|
-
origin_media_id: z.ZodString;
|
|
1237
|
-
media_duration_ms: z.ZodNumber;
|
|
1238
|
-
play_in: z.ZodNumber;
|
|
1239
|
-
play_out: z.ZodNumber;
|
|
1240
|
-
volume: z.ZodNumber;
|
|
1241
|
-
}, z.core.$strip>>;
|
|
1242
|
-
}, z.core.$strip>;
|
|
1243
|
-
type ReplaceVideoClipContentInput = z.infer<typeof replaceVideoClipContentInputSchema>;
|
|
1244
|
-
//#endregion
|
|
1245
|
-
//#region src/editor/schemas/replace-video-clip-sequence.d.ts
|
|
1246
|
-
/**
|
|
1247
|
-
* What happens to the speeches anchored to the clips being replaced.
|
|
1248
|
-
*
|
|
1249
|
-
* - `remap` re-anchors each surviving speech to the new clip in the SAME POSITION
|
|
1250
|
-
* of the sequence, keeping its offset — old[i]'s children become new[i]'s
|
|
1251
|
-
* children. An old clip with no counterpart (fewer new clips than old) has its
|
|
1252
|
-
* subtree deleted, because there is nothing left to anchor to.
|
|
1253
|
-
* - `cascade` deletes every anchored speech (and its captions) outright, like
|
|
1254
|
-
* `deleteVideoClips`.
|
|
1255
|
-
*
|
|
1256
|
-
* **Required, with no default.** The two branches differ in whether the user's
|
|
1257
|
-
* narration survives, and the agent tool that drives this op makes its
|
|
1258
|
-
* `preserve_speeches` flag required for that reason. A default here would let a
|
|
1259
|
-
* caller that forgot the field silently delete speech.
|
|
1260
|
-
*/
|
|
1261
|
-
declare const anchoredReplacePolicySchema: z.ZodEnum<{
|
|
1262
|
-
cascade: "cascade";
|
|
1263
|
-
remap: "remap";
|
|
1264
|
-
}>;
|
|
1265
|
-
type AnchoredReplacePolicy = z.infer<typeof anchoredReplacePolicySchema>;
|
|
1266
|
-
/**
|
|
1267
|
-
* Replace a contiguous run of main-track clips with a new run.
|
|
1268
|
-
*
|
|
1269
|
-
* A composite of delete + insert that cannot be expressed as the two ops in
|
|
1270
|
-
* sequence, because the anchored speeches have to survive *across* the swap: with
|
|
1271
|
-
* `remap` they are re-anchored positionally, which needs both the old and the new
|
|
1272
|
-
* ids in the same transaction (ADR 0009 — the cascade stays in the editor, callers
|
|
1273
|
-
* never re-wire anchors themselves).
|
|
1274
|
-
*
|
|
1275
|
-
* Duration facts follow `addVideoClips`: `media_duration_ms` is the source's
|
|
1276
|
-
* intrinsic length and the trim window defaults to the whole media. The effective
|
|
1277
|
-
* timeline duration is derived by the projection, never an input.
|
|
1278
|
-
*
|
|
1279
|
-
* `media_id` is optional: omitting it creates a **deliberate empty placeholder
|
|
1280
|
-
* clip** (`origin_media_id: ''`) — structure with no picture. This is the only op
|
|
1281
|
-
* that can produce one, and it is authoritative state, unlike the gap fillers the
|
|
1282
|
-
* read-side solve mints (which never enter the document).
|
|
1283
|
-
*/
|
|
1284
|
-
declare const replaceVideoClipSequenceInputSchema: z.ZodObject<{
|
|
1285
|
-
old_clip_ids: z.ZodArray<z.ZodString>;
|
|
1286
|
-
new_clips: z.ZodArray<z.ZodObject<{
|
|
1287
|
-
media_id: z.ZodOptional<z.ZodString>;
|
|
1288
|
-
media_duration_ms: z.ZodNumber;
|
|
1289
|
-
play_in: z.ZodOptional<z.ZodNumber>;
|
|
1290
|
-
play_out: z.ZodOptional<z.ZodNumber>;
|
|
1291
|
-
}, z.core.$strip>>;
|
|
1292
|
-
on_anchored: z.ZodEnum<{
|
|
1293
|
-
cascade: "cascade";
|
|
1294
|
-
remap: "remap";
|
|
1295
|
-
}>;
|
|
1296
|
-
}, z.core.$strip>;
|
|
1297
|
-
type ReplaceVideoClipSequenceInput = z.infer<typeof replaceVideoClipSequenceInputSchema>;
|
|
1298
|
-
//#endregion
|
|
1299
|
-
//#region src/editor/schemas/set-bgm.d.ts
|
|
1300
|
-
/**
|
|
1301
|
-
* Set the document BGM. The media's stable result (storage key) arrives
|
|
1302
|
-
* materialized from upstream (see
|
|
1303
|
-
* `results/phase-4-side-effect-payload-contract.md` §3). The op upserts the bgm
|
|
1304
|
-
* part and seats it on the bgm lane; its effective length is always the whole
|
|
1305
|
-
* timeline, derived by the projection on read — so there is no `duration_ms`
|
|
1306
|
-
* input or fact (RFC 02 / `reference/16` §0b). A `bgm_id` lets the op replace an
|
|
1307
|
-
* existing bgm part by id.
|
|
1308
|
-
*/
|
|
1309
|
-
declare const setBgmInputSchema: z.ZodObject<{
|
|
1310
|
-
bgm_id: z.ZodString;
|
|
1311
|
-
audio_storage_key: z.ZodString;
|
|
1312
|
-
origin_media_id: z.ZodString;
|
|
1313
|
-
volume: z.ZodNumber;
|
|
1314
|
-
}, z.core.$strip>;
|
|
1315
|
-
type SetBgmInput = z.infer<typeof setBgmInputSchema>;
|
|
1316
|
-
//#endregion
|
|
1317
|
-
//#region src/editor/schemas/set-caption-style.d.ts
|
|
952
|
+
//#region src/editor/id-gen.d.ts
|
|
1318
953
|
/**
|
|
1319
|
-
*
|
|
1320
|
-
* caption part in the document — it carries NO `caption_id`. This mirrors the FE,
|
|
1321
|
-
* whose caption-style store (`caption-style.ts:persistCaptionStylePatch`) iterates
|
|
1322
|
-
* ALL captions and writes the same normalized style to each; the product has a
|
|
1323
|
-
* single document-wide caption style, not per-caption styling.
|
|
954
|
+
* Part-id generation, aligned with the online ecosystem.
|
|
1324
955
|
*
|
|
1325
|
-
*
|
|
1326
|
-
*
|
|
1327
|
-
*
|
|
1328
|
-
*
|
|
1329
|
-
*
|
|
956
|
+
* The authoritative online producers — agent-harness (`@harness/shared`
|
|
957
|
+
* `genObjId`) and director.v2 (`common/obj_id.py` `gen_obj_id`) — both mint part
|
|
958
|
+
* ids as `` `${prefix}_${ulid()}` ``, and real captured drafts use exactly that
|
|
959
|
+
* shape (`clip_…` / `spe_…` / `cap_…` / `bgm_…`, each a 26-char ULID). The engine
|
|
960
|
+
* previously emitted `vc_<base36 timestamp><6 random>`, a different prefix AND a
|
|
961
|
+
* different encoding — the sole cross-repo id divergence. This module removes it
|
|
962
|
+
* by emitting the same `<prefix>_<ULID>` bytes.
|
|
1330
963
|
*
|
|
1331
|
-
*
|
|
1332
|
-
*
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
//#region src/editor/schemas/set-caption-visibility.d.ts
|
|
1349
|
-
/**
|
|
1350
|
-
* Toggle caption visibility (the caption track's `is_hidden` flag). Pure
|
|
1351
|
-
* document edit, no cascade — captions keep their positions; only the lane's
|
|
1352
|
-
* hidden flag changes.
|
|
1353
|
-
*/
|
|
1354
|
-
declare const setCaptionVisibilityInputSchema: z.ZodObject<{
|
|
1355
|
-
is_hidden: z.ZodBoolean;
|
|
1356
|
-
}, z.core.$strip>;
|
|
1357
|
-
type SetCaptionVisibilityInput = z.infer<typeof setCaptionVisibilityInputSchema>;
|
|
1358
|
-
//#endregion
|
|
1359
|
-
//#region src/editor/schemas/set-video-clip-speed-shift.d.ts
|
|
1360
|
-
/**
|
|
1361
|
-
* Set the playback speed of existing video clips. Per the speed-shift decision
|
|
1362
|
-
* (`reference/16` §0): the op writes only the `speed_shift` fact — it does NOT
|
|
1363
|
-
* store an effective `duration_ms` (projection derives it from the trim window /
|
|
1364
|
-
* speed) and does NOT scale anchored speeches' relative offsets (offsets stay
|
|
1365
|
-
* put; the cascade reflows absolute positions). A `null` speed_shift clears the
|
|
1366
|
-
* speed back to original (1×).
|
|
1367
|
-
*/
|
|
1368
|
-
declare const setVideoClipSpeedShiftInputSchema: z.ZodObject<{
|
|
1369
|
-
clips: z.ZodArray<z.ZodObject<{
|
|
1370
|
-
clip_id: z.ZodString;
|
|
1371
|
-
speed_shift: z.ZodNullable<z.ZodObject<{
|
|
1372
|
-
category: z.ZodEnum<{
|
|
1373
|
-
curve: "curve";
|
|
1374
|
-
linear: "linear";
|
|
1375
|
-
}>;
|
|
1376
|
-
mode: z.ZodString;
|
|
1377
|
-
config: z.ZodUnion<readonly [z.ZodObject<{
|
|
1378
|
-
linear: z.ZodObject<{
|
|
1379
|
-
speed: z.ZodNumber;
|
|
1380
|
-
}, z.core.$strip>;
|
|
1381
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1382
|
-
curve: z.ZodObject<{
|
|
1383
|
-
keyframes: z.ZodArray<z.ZodObject<{
|
|
1384
|
-
position: z.ZodNumber;
|
|
1385
|
-
rate: z.ZodNumber;
|
|
1386
|
-
in_tangent: z.ZodOptional<z.ZodObject<{
|
|
1387
|
-
x: z.ZodNumber;
|
|
1388
|
-
y: z.ZodNumber;
|
|
1389
|
-
}, z.core.$strip>>;
|
|
1390
|
-
out_tangent: z.ZodOptional<z.ZodObject<{
|
|
1391
|
-
x: z.ZodNumber;
|
|
1392
|
-
y: z.ZodNumber;
|
|
1393
|
-
}, z.core.$strip>>;
|
|
1394
|
-
}, z.core.$strip>>;
|
|
1395
|
-
}, z.core.$strip>;
|
|
1396
|
-
}, z.core.$strip>]>;
|
|
1397
|
-
}, z.core.$strip>>;
|
|
1398
|
-
}, z.core.$strip>>;
|
|
1399
|
-
}, z.core.$strip>;
|
|
1400
|
-
type SetVideoClipSpeedShiftInput = z.infer<typeof setVideoClipSpeedShiftInputSchema>;
|
|
1401
|
-
//#endregion
|
|
1402
|
-
//#region src/editor/schemas/shared.d.ts
|
|
1403
|
-
declare const clipIdSchema: z.ZodString;
|
|
1404
|
-
declare const clipIdsSchema: z.ZodArray<z.ZodString>;
|
|
1405
|
-
declare const mediaIdSchema: z.ZodString;
|
|
1406
|
-
declare const speechIdSchema: z.ZodString;
|
|
1407
|
-
declare const timelineMsSchema: z.ZodNumber;
|
|
1408
|
-
declare const positiveMsSchema: z.ZodNumber;
|
|
1409
|
-
declare const volumeSchema: z.ZodNumber;
|
|
1410
|
-
declare const speechIdsSchema: z.ZodArray<z.ZodString>;
|
|
1411
|
-
/**
|
|
1412
|
-
* A clip's playback-speed fact, the only thing `SetVideoClipSpeedShift` writes.
|
|
1413
|
-
* Mirrors the IDL `SpeedShift`: `category` is `linear` | `curve`, and `config`
|
|
1414
|
-
* is a discriminated union — `{ linear: { speed } }` for a constant multiplier
|
|
1415
|
-
* (the multiplier projection reads at `config.linear.speed`) or `{ curve: {
|
|
1416
|
-
* keyframes } }` for a Bezier-controlled variable speed (RFC 02 / `reference/16`
|
|
1417
|
-
* §0). Exactly one of `linear` / `curve` is present.
|
|
1418
|
-
*/
|
|
1419
|
-
declare const speedShiftSchema: z.ZodObject<{
|
|
1420
|
-
category: z.ZodEnum<{
|
|
1421
|
-
curve: "curve";
|
|
1422
|
-
linear: "linear";
|
|
1423
|
-
}>;
|
|
1424
|
-
mode: z.ZodString;
|
|
1425
|
-
config: z.ZodUnion<readonly [z.ZodObject<{
|
|
1426
|
-
linear: z.ZodObject<{
|
|
1427
|
-
speed: z.ZodNumber;
|
|
1428
|
-
}, z.core.$strip>;
|
|
1429
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1430
|
-
curve: z.ZodObject<{
|
|
1431
|
-
keyframes: z.ZodArray<z.ZodObject<{
|
|
1432
|
-
position: z.ZodNumber;
|
|
1433
|
-
rate: z.ZodNumber;
|
|
1434
|
-
in_tangent: z.ZodOptional<z.ZodObject<{
|
|
1435
|
-
x: z.ZodNumber;
|
|
1436
|
-
y: z.ZodNumber;
|
|
1437
|
-
}, z.core.$strip>>;
|
|
1438
|
-
out_tangent: z.ZodOptional<z.ZodObject<{
|
|
1439
|
-
x: z.ZodNumber;
|
|
1440
|
-
y: z.ZodNumber;
|
|
1441
|
-
}, z.core.$strip>>;
|
|
1442
|
-
}, z.core.$strip>>;
|
|
1443
|
-
}, z.core.$strip>;
|
|
1444
|
-
}, z.core.$strip>]>;
|
|
1445
|
-
}, z.core.$strip>;
|
|
1446
|
-
declare const voiceSchema: z.ZodObject<{
|
|
1447
|
-
id: z.ZodString;
|
|
1448
|
-
name: z.ZodString;
|
|
1449
|
-
}, z.core.$strip>;
|
|
1450
|
-
//#endregion
|
|
1451
|
-
//#region src/editor/schemas/speech-assets.d.ts
|
|
1452
|
-
/**
|
|
1453
|
-
* The materialized TTS result shared by `AddSpeeches` / `ChangeSpeechScript` /
|
|
1454
|
-
* `ChangeSpeechVoice` (see `results/phase-4-side-effect-payload-contract.md`
|
|
1455
|
-
* §1/§2). The side effect (TTS/ASR + billing) runs upstream; the op receives the
|
|
1456
|
-
* stable speech + caption parts and writes them as authoritative facts. No
|
|
1457
|
-
* cascade runs on write — the projection derives absolute positions on read.
|
|
1458
|
-
*
|
|
1459
|
-
* Each speech carries the anchoring fact directly (RFC 02 §4): the host video
|
|
1460
|
-
* clip `anchor_part_id` and the `offset_ms` within it. The upstream caller
|
|
1461
|
-
* already knows which clip a speech attaches to, so the op writes
|
|
1462
|
-
* `{ mode:'anchored', anchorPartId, offsetMs }` verbatim — no write-time
|
|
1463
|
-
* host-picking. Captions anchor to their speech via the caption part's
|
|
1464
|
-
* `start_ms` (offset within the speech).
|
|
1465
|
-
*/
|
|
1466
|
-
declare const speechAssetSchema: z.ZodObject<{
|
|
1467
|
-
speech_id: z.ZodString;
|
|
1468
|
-
anchor_part_id: z.ZodString;
|
|
1469
|
-
offset_ms: z.ZodNumber;
|
|
1470
|
-
audio_storage_key: z.ZodString;
|
|
1471
|
-
duration_ms: z.ZodNumber;
|
|
1472
|
-
audio_script: z.ZodString;
|
|
1473
|
-
volume: z.ZodNumber;
|
|
1474
|
-
voice: z.ZodObject<{
|
|
1475
|
-
id: z.ZodString;
|
|
1476
|
-
name: z.ZodString;
|
|
1477
|
-
}, z.core.$strip>;
|
|
1478
|
-
origin_speech_id: z.ZodString;
|
|
1479
|
-
caption_ids: z.ZodArray<z.ZodString>;
|
|
1480
|
-
}, z.core.$strip>;
|
|
1481
|
-
declare const captionAssetSchema: z.ZodObject<{
|
|
1482
|
-
caption_id: z.ZodString;
|
|
1483
|
-
speech_part_id: z.ZodString;
|
|
1484
|
-
text: z.ZodString;
|
|
1485
|
-
start_ms: z.ZodNumber;
|
|
1486
|
-
duration_ms: z.ZodNumber;
|
|
1487
|
-
}, z.core.$strip>;
|
|
1488
|
-
/** A materialized speech-subtree write (speeches + their captions). */
|
|
1489
|
-
declare const speechAssetsSchema: z.ZodObject<{
|
|
1490
|
-
speeches: z.ZodArray<z.ZodObject<{
|
|
1491
|
-
speech_id: z.ZodString;
|
|
1492
|
-
anchor_part_id: z.ZodString;
|
|
1493
|
-
offset_ms: z.ZodNumber;
|
|
1494
|
-
audio_storage_key: z.ZodString;
|
|
1495
|
-
duration_ms: z.ZodNumber;
|
|
1496
|
-
audio_script: z.ZodString;
|
|
1497
|
-
volume: z.ZodNumber;
|
|
1498
|
-
voice: z.ZodObject<{
|
|
1499
|
-
id: z.ZodString;
|
|
1500
|
-
name: z.ZodString;
|
|
1501
|
-
}, z.core.$strip>;
|
|
1502
|
-
origin_speech_id: z.ZodString;
|
|
1503
|
-
caption_ids: z.ZodArray<z.ZodString>;
|
|
1504
|
-
}, z.core.$strip>>;
|
|
1505
|
-
captions: z.ZodArray<z.ZodObject<{
|
|
1506
|
-
caption_id: z.ZodString;
|
|
1507
|
-
speech_part_id: z.ZodString;
|
|
1508
|
-
text: z.ZodString;
|
|
1509
|
-
start_ms: z.ZodNumber;
|
|
1510
|
-
duration_ms: z.ZodNumber;
|
|
1511
|
-
}, z.core.$strip>>;
|
|
1512
|
-
}, z.core.$strip>;
|
|
1513
|
-
type SpeechAsset = z.infer<typeof speechAssetSchema>;
|
|
1514
|
-
type CaptionAsset = z.infer<typeof captionAssetSchema>;
|
|
1515
|
-
type SpeechAssets = z.infer<typeof speechAssetsSchema>;
|
|
1516
|
-
declare namespace index_d_exports {
|
|
1517
|
-
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 };
|
|
1518
|
-
}
|
|
964
|
+
* The ULID is generated inline (Crockford Base32, 48-bit time + 80-bit random)
|
|
965
|
+
* rather than pulling the `ulid` npm package: the randomness class matches the
|
|
966
|
+
* old generator (both `Math.random`-based) and it keeps `@mengine/medeo-client`
|
|
967
|
+
* dependency-free for a purely mechanical id string. Part ids only need to be
|
|
968
|
+
* unique and lexicographically time-sortable, which this satisfies.
|
|
969
|
+
*/
|
|
970
|
+
/**
|
|
971
|
+
* Online part-id semantic prefixes. `clip` (video clip) is the only value the
|
|
972
|
+
* engine currently mints (see `addVideoClips`); the rest are declared so the
|
|
973
|
+
* type documents the shared vocabulary and guards against reintroducing the old
|
|
974
|
+
* `vc`/`sp`/`cp`/`bg` names. Speech/caption/bgm ids arrive pre-minted in op
|
|
975
|
+
* payloads, so the engine never generates them itself.
|
|
976
|
+
*/
|
|
977
|
+
type PartIdPrefix = 'clip' | 'spe' | 'cap' | 'bgm' | 'ti';
|
|
978
|
+
declare function generatePartId(prefix: PartIdPrefix): string;
|
|
979
|
+
/** Injectable part-id mint; defaults to `generatePartId` on `SemanticEditor`. */
|
|
980
|
+
type PartIdFactory = (prefix: PartIdPrefix) => string;
|
|
1519
981
|
//#endregion
|
|
1520
982
|
//#region src/editor/schema-validator.d.ts
|
|
1521
983
|
interface SnapshotReadable {
|
|
@@ -1669,10 +1131,15 @@ interface OpActor {
|
|
|
1669
1131
|
role: 'user' | 'agent';
|
|
1670
1132
|
}
|
|
1671
1133
|
interface CommitOptions {
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1134
|
+
/**
|
|
1135
|
+
* Caller-supplied intent attached to the op's audit message.
|
|
1136
|
+
*
|
|
1137
|
+
* Typed as `unknown` to match `TransactAudit.intent`. The wire (real
|
|
1138
|
+
* mengine-server and the in-memory test double) only surfaces **string**
|
|
1139
|
+
* intents onto the audit log — non-string values stay in the Loro commit
|
|
1140
|
+
* message but parse to `null`. Agent callers should pass a string.
|
|
1141
|
+
*/
|
|
1142
|
+
intent?: unknown;
|
|
1676
1143
|
/** Author of this op; omitted for writes with no acting user (bootstrap, repair). */
|
|
1677
1144
|
actor?: OpActor;
|
|
1678
1145
|
}
|
|
@@ -1717,7 +1184,8 @@ interface SemanticDocumentAdapter extends SnapshotReadable {
|
|
|
1717
1184
|
declare class SemanticEditor {
|
|
1718
1185
|
private readonly doc;
|
|
1719
1186
|
private readonly validator;
|
|
1720
|
-
|
|
1187
|
+
private readonly idFactory;
|
|
1188
|
+
constructor(doc: SemanticDocumentAdapter, validator?: SchemaValidator, idFactory?: PartIdFactory);
|
|
1721
1189
|
moveVideoClips(input: MoveVideoClipsInput, options?: CommitOptions): Promise<void>;
|
|
1722
1190
|
/**
|
|
1723
1191
|
* Reorder main-track clips relative to an anchor clip, moving them as one block.
|
|
@@ -1888,6 +1356,57 @@ declare class MirrorVideoDocumentAdapter implements SemanticDocumentAdapter {
|
|
|
1888
1356
|
declare function createMirrorVideoDocument(document: VideoDocument, options?: MirrorVideoDocumentOptions): LoroDoc;
|
|
1889
1357
|
/** Build a `MirrorVideoDocumentAdapter` over a fresh doc seeded with `document`. */
|
|
1890
1358
|
declare function createMirrorVideoDocumentAdapter(document: VideoDocument, options?: MirrorVideoDocumentOptions): MirrorVideoDocumentAdapter;
|
|
1359
|
+
/** Write a whole `VideoDocument` into a draft (seed a fresh doc / plain-memory state). */
|
|
1360
|
+
declare function writeVideoDocumentToDraft(draft: VideoDocumentDraft, document: VideoDocument): void;
|
|
1361
|
+
//#endregion
|
|
1362
|
+
//#region src/document/plain-memory-adapter.d.ts
|
|
1363
|
+
/**
|
|
1364
|
+
* A `TransactAudit` widened with the ordered ids minted during that transact.
|
|
1365
|
+
* `generated_ids` is empty when the op never called the id factory.
|
|
1366
|
+
*/
|
|
1367
|
+
interface JournalEntry extends TransactAudit {
|
|
1368
|
+
/** Ids produced by the adapter's id factory during this transact, in mint order. */
|
|
1369
|
+
generated_ids: string[];
|
|
1370
|
+
}
|
|
1371
|
+
interface PlainMemoryAdapterOptions {
|
|
1372
|
+
/** Underlying id mint; wrapped so each call inside a transact is journaled. */
|
|
1373
|
+
idFactory?: PartIdFactory;
|
|
1374
|
+
}
|
|
1375
|
+
/**
|
|
1376
|
+
* Pure in-memory `SemanticDocumentAdapter` — no Loro/WASM. Holds a
|
|
1377
|
+
* `VideoDocumentDraft` object and applies each `transact` via immer `produce`,
|
|
1378
|
+
* journaling every audit that actually mutated state (plus any ids minted
|
|
1379
|
+
* during that transact).
|
|
1380
|
+
*
|
|
1381
|
+
* Known benign difference vs `MirrorVideoDocumentAdapter`: the editor's
|
|
1382
|
+
* `setPart` assigns a fresh part object on every call, so a same-value rewrite
|
|
1383
|
+
* produces a new immer state and IS journaled here, while the mirror's deep
|
|
1384
|
+
* diff emits no commit. Terminal `snapshot()` stays equal; replay is idempotent.
|
|
1385
|
+
*/
|
|
1386
|
+
declare class PlainMemoryAdapter implements SemanticDocumentAdapter {
|
|
1387
|
+
private state;
|
|
1388
|
+
private readonly _journal;
|
|
1389
|
+
private readonly baseIdFactory;
|
|
1390
|
+
/** Non-null only while a `transact` edit callback is running. */
|
|
1391
|
+
private pendingIds;
|
|
1392
|
+
/**
|
|
1393
|
+
* Recording wrapper around the underlying factory. Callers (sandbox editor)
|
|
1394
|
+
* use this so every minted id is appended to the current transact's list.
|
|
1395
|
+
*/
|
|
1396
|
+
readonly idFactory: PartIdFactory;
|
|
1397
|
+
constructor(document: VideoDocument, options?: PlainMemoryAdapterOptions);
|
|
1398
|
+
get journal(): readonly JournalEntry[];
|
|
1399
|
+
hasContent(): boolean;
|
|
1400
|
+
snapshot(): VideoDocument;
|
|
1401
|
+
/**
|
|
1402
|
+
* Apply one op via immer. A throw in `edit` discards the draft (state and
|
|
1403
|
+
* journal unchanged). When `produce` returns the same reference, there was
|
|
1404
|
+
* no structural change — skip journal, matching mirror "no change, no commit".
|
|
1405
|
+
*/
|
|
1406
|
+
transact(edit: (draft: VideoDocumentDraft) => void, audit: TransactAudit): void;
|
|
1407
|
+
}
|
|
1408
|
+
/** Build a `PlainMemoryAdapter` seeded with `document`. */
|
|
1409
|
+
declare function createPlainMemoryAdapter(document: VideoDocument, options?: PlainMemoryAdapterOptions): PlainMemoryAdapter;
|
|
1891
1410
|
//#endregion
|
|
1892
1411
|
//#region src/document/mirror-read.d.ts
|
|
1893
1412
|
/**
|
|
@@ -2072,4 +1591,4 @@ declare const videoDocumentSchema: z.ZodObject<{
|
|
|
2072
1591
|
}, z.core.$loose>]>>>;
|
|
2073
1592
|
}, z.core.$loose>;
|
|
2074
1593
|
//#endregion
|
|
2075
|
-
export {
|
|
1594
|
+
export { Track as $, TrackDraft as A, DerivedItemPosition as B, SemanticOpKind as C, ValidationError as D, SnapshotReadable as E, VideoDocumentValidationError as F, toVideoDocument as G, buildSpeechHostMap as H, assertValidVideoDocument as I, DEFAULT_UNIT_TIME_MS as J, BgmPart as K, validateVideoDocument as L, VideoDocumentDraft as M, VideoDocumentMirrorSchema as N, PartIdFactory as O, videoDocumentMirrorSchema as P, Timeline as Q, InitialDocumentFacts as R, PlannedSemanticOpKind as S, SchemaValidator as T, derivePositionFromAbs as U, SpeechHostMap as V, fromVideoDocument as W, PartUnion as X, PartKind as Y, SpeechPart as Z, SemanticOpInput as _, Timeline$1 as _t, PlainMemoryAdapter as a, VideoDocumentSchemaVersion as at, IMPLEMENTED_SEMANTIC_OP_KINDS as b, MirrorVideoDocumentAdapter as c, VideoDraft as ct, createMirrorVideoDocumentAdapter as d, speedOf as dt, TrackItem as et, writeVideoDocumentToDraft as f, Attachment as ft, SemanticEditor as g, SpeedShift as gt, SemanticDocumentAdapter as h, PartAggregation as ht, JournalEntry as i, VideoDocument as it, TrackItemDraft as j, generatePartId as k, MirrorVideoDocumentOptions as l, VideoDraftPartUnion as lt, OpActor as m, CaptionStyle as mt, videoDocumentSchema as n, VIDEO_DOCUMENT_SCHEMA_VERSION as nt, PlainMemoryAdapterOptions as o, VideoDocumentValidationIssue as ot, CommitOptions as p, CaptionPart$1 as pt, CaptionPart as q, readVideoDocumentFromDraft as r, VideoClipPart as rt, createPlainMemoryAdapter as s, VideoDocumentValidationIssueCode as st, partUnionSchema as t, TrackItemTimePosition as tt, createMirrorVideoDocument as u, effectiveVideoClipDurationMs as ut, SemanticOpName as v, Track$1 as vt, isImplementedSemanticOpKind as w, ImplementedSemanticOpKind as x, TransactAudit as y, TrackItem$1 as yt, buildInitialVideoDocument as z };
|