@mengine/medeo-client 2.0.1-alpha.1 → 2.0.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.
- package/README.md +116 -14
- package/dist/document-CjdIw9rE.js +4658 -0
- package/dist/index-CMa6ZCtX.d.ts +609 -0
- package/dist/{index-CnZ9l3rb.d.ts → index-qAoWdqvp.d.ts} +490 -694
- package/dist/index.d.ts +750 -141
- package/dist/index.js +2691 -636
- package/dist/schemas.d.ts +2 -0
- package/dist/schemas.js +482 -0
- package/dist/shared-iWnU2osE.js +39 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +40 -1
- package/package.json +10 -5
- package/dist/document-CmjJwOba.js +0 -1628
|
@@ -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:
|
|
33
|
-
readonly CAPTION:
|
|
34
|
-
readonly SPEECH:
|
|
35
|
-
readonly 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:
|
|
148
|
-
readonly RATIO_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:
|
|
160
|
-
readonly AI_VIDEOS:
|
|
161
|
-
readonly MY_UPLOADED_ASSETS:
|
|
162
|
-
readonly 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:
|
|
257
|
+
readonly CURVE: "curve";
|
|
257
258
|
/**
|
|
258
259
|
* Constant speed multiplier across the entire clip
|
|
259
260
|
*/
|
|
260
|
-
readonly LINEAR:
|
|
261
|
+
readonly LINEAR: "linear";
|
|
261
262
|
};
|
|
262
263
|
/**
|
|
263
264
|
* @public
|
|
@@ -482,9 +483,21 @@ type SpeechPart = Omit<SpeechPart$1, 'duration_ms'> & {
|
|
|
482
483
|
*
|
|
483
484
|
* `speech_part_id` / `start_ms` are kept as resource-intrinsic facts (which
|
|
484
485
|
* speech it was split from, and its offset in that source) — reference/17
|
|
485
|
-
* principle 4.
|
|
486
|
-
|
|
486
|
+
* principle 4. An independently placed Caption (its own Clip and Sequence
|
|
487
|
+
* Marker, no Voice take) has no owning speech: both fields stay unset and its
|
|
488
|
+
* position is expressed entirely by the Clip's placement. Generation source
|
|
489
|
+
* (AudioScript provenance) and Voice alignment are entity Relations, decoupled
|
|
490
|
+
* from this display-side legacy view.
|
|
491
|
+
*/
|
|
492
|
+
/** Derived render interval, relative to the placed Caption Clip; never an Entity. */
|
|
493
|
+
interface CaptionDisplayCue {
|
|
494
|
+
segmentId: string;
|
|
495
|
+
text: string;
|
|
496
|
+
startMs: number;
|
|
497
|
+
durationMs: number;
|
|
498
|
+
}
|
|
487
499
|
type CaptionPart = Omit<CaptionPart$1, 'duration_ms'> & {
|
|
500
|
+
display_cues?: CaptionDisplayCue[];
|
|
488
501
|
initial_duration_ms?: number | undefined;
|
|
489
502
|
};
|
|
490
503
|
/**
|
|
@@ -550,6 +563,19 @@ interface Track {
|
|
|
550
563
|
is_hidden: boolean | undefined;
|
|
551
564
|
items: TrackItem[] | undefined;
|
|
552
565
|
}
|
|
566
|
+
/** The linear speed multiplier of a `speed_shift`, defaulting to 1 (original). */
|
|
567
|
+
declare function speedOf(speedShift: SpeedShift | undefined): number;
|
|
568
|
+
/**
|
|
569
|
+
* A video clip's effective timeline duration, derived from authoritative facts
|
|
570
|
+
* (RFC 02, `reference/16` §4, reference/17 §5): the trim window
|
|
571
|
+
* `play_out - play_in` divided by the speed multiplier, rounded to integer ms.
|
|
572
|
+
* `play_in` / `play_out` are optional in the IDL but every write path sets them
|
|
573
|
+
* (defaulting to the whole media), and the legacy-ingest projection backfills the
|
|
574
|
+
* window from a legacy `duration_ms` — so an authoritative clip always carries a
|
|
575
|
+
* trim window and there is no stored `duration_ms` to fall back to. A clip with
|
|
576
|
+
* neither bound yields 0. Speeds the clip up (>1× → shorter) or down (<1×).
|
|
577
|
+
*/
|
|
578
|
+
declare function effectiveVideoClipDurationMs(clip: VideoClipPart): number;
|
|
553
579
|
/**
|
|
554
580
|
* Authoritative part union: a flat discriminated union over the four part kinds.
|
|
555
581
|
* Deliberately *not* the IDL's namespace union (no `$unknown` / `visit`): engine
|
|
@@ -709,6 +735,184 @@ interface VideoDocumentValidationIssue {
|
|
|
709
735
|
severity?: VideoDocumentValidationIssueSeverity;
|
|
710
736
|
}
|
|
711
737
|
//#endregion
|
|
738
|
+
//#region src/document/mirror-schema.d.ts
|
|
739
|
+
declare const videoDocumentMirrorSchema: import("loro-mirror").RootSchemaType<{
|
|
740
|
+
timeline: import("loro-mirror").LoroMapSchema<{
|
|
741
|
+
unit_time_ms: /*elided*/any;
|
|
742
|
+
}> & {
|
|
743
|
+
options: {};
|
|
744
|
+
} & {
|
|
745
|
+
catchall: <C extends import("loro-mirror").SchemaType>(catchallSchema: C) => import("loro-mirror").LoroMapSchemaWithCatchall<{
|
|
746
|
+
unit_time_ms: /*elided*/any;
|
|
747
|
+
}, C>;
|
|
748
|
+
};
|
|
749
|
+
tracks: import("loro-mirror").LoroMovableListSchema<import("loro-mirror").LoroMapSchema<{
|
|
750
|
+
id: /*elided*/any;
|
|
751
|
+
parts_kind: /*elided*/any;
|
|
752
|
+
is_hidden: /*elided*/any;
|
|
753
|
+
items: /*elided*/any;
|
|
754
|
+
}> & {
|
|
755
|
+
options: {};
|
|
756
|
+
} & {
|
|
757
|
+
catchall: <C extends import("loro-mirror").SchemaType>(catchallSchema: C) => import("loro-mirror").LoroMapSchemaWithCatchall<{
|
|
758
|
+
id: /*elided*/any;
|
|
759
|
+
parts_kind: /*elided*/any;
|
|
760
|
+
is_hidden: /*elided*/any;
|
|
761
|
+
items: /*elided*/any;
|
|
762
|
+
}, C>;
|
|
763
|
+
}> & {
|
|
764
|
+
options: {};
|
|
765
|
+
};
|
|
766
|
+
part_library: import("loro-mirror").LoroMapSchemaWithCatchall<{}, import("loro-mirror").LoroMapSchema<{
|
|
767
|
+
video_clip: /*elided*/any;
|
|
768
|
+
speech: /*elided*/any;
|
|
769
|
+
caption: /*elided*/any;
|
|
770
|
+
bgm: /*elided*/any;
|
|
771
|
+
}> & {
|
|
772
|
+
options: {};
|
|
773
|
+
} & {
|
|
774
|
+
catchall: <C extends import("loro-mirror").SchemaType>(catchallSchema: C) => import("loro-mirror").LoroMapSchemaWithCatchall<{
|
|
775
|
+
video_clip: /*elided*/any;
|
|
776
|
+
speech: /*elided*/any;
|
|
777
|
+
caption: /*elided*/any;
|
|
778
|
+
bgm: /*elided*/any;
|
|
779
|
+
}, C>;
|
|
780
|
+
}> & {
|
|
781
|
+
options: {};
|
|
782
|
+
};
|
|
783
|
+
}> & {
|
|
784
|
+
options: {};
|
|
785
|
+
};
|
|
786
|
+
type VideoDocumentMirrorSchema = typeof videoDocumentMirrorSchema;
|
|
787
|
+
/**
|
|
788
|
+
* The mutable draft an op's `transact` callback edits, inferred from the schema.
|
|
789
|
+
*
|
|
790
|
+
* `InferInputType` is the schema's *input* shape: the declared business fields
|
|
791
|
+
* with the `$cid` container ids (which mirror injects into its output
|
|
792
|
+
* `InferType`) made optional, so ops assign plain objects without supplying
|
|
793
|
+
* `$cid`. Deriving it from the schema keeps draft and storage in lockstep — a
|
|
794
|
+
* schema change is a compile error at every edit site, not a silent drift.
|
|
795
|
+
* Reorders within `items` still diff to real Loro `move` ops because the schema
|
|
796
|
+
* keys items by `part_id`.
|
|
797
|
+
*/
|
|
798
|
+
type VideoDocumentDraft = InferInputType<VideoDocumentMirrorSchema>;
|
|
799
|
+
/** Track value as it appears in a draft. Derived from the single `tracks` movable list. */
|
|
800
|
+
type TrackDraft = NonNullable<NonNullable<VideoDocumentDraft['tracks']>[number]>;
|
|
801
|
+
/** A single track item in a draft. */
|
|
802
|
+
type TrackItemDraft = NonNullable<NonNullable<TrackDraft['items']>[number]>;
|
|
803
|
+
//#endregion
|
|
804
|
+
//#region src/timeline-core/bridge.d.ts
|
|
805
|
+
/**
|
|
806
|
+
* Bridge between the authoritative `VideoDocument` (position-only facts) and the
|
|
807
|
+
* flat `TimelineDoc` the cascade primitives solve over.
|
|
808
|
+
*
|
|
809
|
+
* The data flow is single-directional (RFC 02 §7/§10): ops write only facts
|
|
810
|
+
* (`time_position`, parts) to `VideoDocument`; absolute time, `part_aggregations`,
|
|
811
|
+
* total duration, and gap fillers are NOT stored — the projection derives them
|
|
812
|
+
* on read by running the cascade. There is no write-back of solved positions.
|
|
813
|
+
*
|
|
814
|
+
* - `solveVideoDocument` seeds a `TimelineDoc` from each item's `time_position`,
|
|
815
|
+
* runs the full cascade, and returns the derived read-view (abs / aggregations
|
|
816
|
+
* / duration). It is the single solve shared by the legacy `VideoDraft`
|
|
817
|
+
* projection.
|
|
818
|
+
* - `ensureLaneTrack` / `findLaneTrack` locate (or mint) a secondary lane's
|
|
819
|
+
* track row in the draft, so ops can write authoritative facts onto the right
|
|
820
|
+
* named container (lane = container).
|
|
821
|
+
*/
|
|
822
|
+
/** The projection-derived read-view of a `VideoDocument` (RFC 02 §7). */
|
|
823
|
+
interface SolvedVideoDocument {
|
|
824
|
+
absByPartId: Map<string, number>;
|
|
825
|
+
aggregations: PartAggregation[];
|
|
826
|
+
durationMs: number;
|
|
827
|
+
partLibrary: Record<string, PartUnion>;
|
|
828
|
+
/**
|
|
829
|
+
* Part ids of the gap fillers this solve minted.
|
|
830
|
+
*
|
|
831
|
+
* They exist only inside the solve: gap filling needs them so the clips after a
|
|
832
|
+
* gap land at the right absolute time, but they are not authoritative state and
|
|
833
|
+
* the read view does not carry them (see `fromVideoDocument`).
|
|
834
|
+
*
|
|
835
|
+
* Reported as ids rather than left for the caller to detect, because the caller
|
|
836
|
+
* *cannot* detect them. The obvious predicate — `origin_media_id === ''` — also
|
|
837
|
+
* matches an empty clip a writer placed on purpose (`batch_replace_video_clip_sequence`
|
|
838
|
+
* documents "Omit to create an empty clip placeholder"), and those are
|
|
839
|
+
* authoritative parts that must survive the projection. The mint callback is the
|
|
840
|
+
* only place that knows the difference.
|
|
841
|
+
*
|
|
842
|
+
* Note this deliberately excludes the fillers that gap filling *extended* rather
|
|
843
|
+
* than minted (`fillMainTrackTimeGaps` cases 1 and 2): those are authoritative
|
|
844
|
+
* empty clips already in `part_library`, and only their length is derived.
|
|
845
|
+
*/
|
|
846
|
+
derivedFillerPartIds: Set<string>;
|
|
847
|
+
}
|
|
848
|
+
/** How the caller obtained the document it is asking to be solved. */
|
|
849
|
+
interface SolveVideoDocumentOptions {
|
|
850
|
+
/**
|
|
851
|
+
* The producer already resolved every placement, so the legacy cascade must
|
|
852
|
+
* not run. Only an Entity projection can state this: its placement comes from
|
|
853
|
+
* Clip order / clip-anchor offsets / Marker targetRange, and re-solving would
|
|
854
|
+
* overwrite those and synthesize gap fillers the Entity graph never had.
|
|
855
|
+
*
|
|
856
|
+
* The document itself no longer carries its provenance (P7M14 moved business
|
|
857
|
+
* metadata out of the CRDT), so the caller states it. `hasResolvedPlacement`
|
|
858
|
+
* only verifies the claim — it is never the branch condition, because a
|
|
859
|
+
* legacy draft can satisfy it by accident and a broken projection can fail it.
|
|
860
|
+
*/
|
|
861
|
+
readonly placementResolved?: boolean;
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* Solve a `VideoDocument` (authoritative, position-only) into its derived
|
|
865
|
+
* read-view: absolute time per item, `part_aggregations`, and total duration.
|
|
866
|
+
* This is the read side of the single-directional flow — never written back.
|
|
867
|
+
*/
|
|
868
|
+
declare function solveVideoDocument(document: VideoDocument, options?: SolveVideoDocumentOptions): SolvedVideoDocument;
|
|
869
|
+
/** The named container a secondary lane lives in. */
|
|
870
|
+
type SecondaryLane = 'speech' | 'caption' | 'bgm';
|
|
871
|
+
/** A lane's track kind: the `video_clip` main lane plus the three secondary lanes. */
|
|
872
|
+
type LaneKind = SecondaryLane | 'video_clip';
|
|
873
|
+
/**
|
|
874
|
+
* The four lanes in top-to-bottom stack order — the order a `tracks` list holds
|
|
875
|
+
* them in (see {@link laneRank}).
|
|
876
|
+
*
|
|
877
|
+
* Exported so a document can be seeded with all four lanes up front. That seed is
|
|
878
|
+
* not cosmetic: {@link ensureLaneTrack} is find-then-mint over a `LoroMovableList`,
|
|
879
|
+
* so two concurrent writers that each mint the same absent lane both keep their
|
|
880
|
+
* row, and the merged document holds two tracks for one lane. For the main lane
|
|
881
|
+
* that is fatal — `videoDocumentSchema` allows at most one `video_clip` track, so
|
|
882
|
+
* the merged document stops being projectable at all, symmetrically on both
|
|
883
|
+
* replicas. Pre-seeding every lane makes `ensureLaneTrack` always take its find
|
|
884
|
+
* branch, which removes the race by construction rather than by detection.
|
|
885
|
+
*
|
|
886
|
+
* What closes the race is that a track with the lane's `parts_kind` EXISTS — the
|
|
887
|
+
* lookup is by kind, not by id. So a seed is only safe if it covers every lane:
|
|
888
|
+
* a partial seed leaves the uncovered lanes exactly as exposed as before.
|
|
889
|
+
*/
|
|
890
|
+
declare const LANE_KINDS_IN_STACK_ORDER: readonly LaneKind[];
|
|
891
|
+
/**
|
|
892
|
+
* The conventional track id for a lane (`main_track`, `<kind>_track`). Shared by
|
|
893
|
+
* the up-front seed and {@link ensureLaneTrack}'s lazy mint so a document's lane
|
|
894
|
+
* ids do not depend on which of the two created the track.
|
|
895
|
+
*
|
|
896
|
+
* Ids are cosmetic to the merge itself — lane lookup goes by `parts_kind`, so
|
|
897
|
+
* drifting them apart would not reopen the concurrent-mint race. They matter to
|
|
898
|
+
* readers that address a lane by id (the FE editor's panes, fixtures), which is
|
|
899
|
+
* why there is one convention rather than two.
|
|
900
|
+
*/
|
|
901
|
+
declare function laneTrackId(kind: LaneKind): string;
|
|
902
|
+
/**
|
|
903
|
+
* Locate a lane's track row in the single `tracks` list by kind, minting an empty
|
|
904
|
+
* row in lane-stacking order if absent (reference/17 §4: lane = `parts_kind`).
|
|
905
|
+
* Ops use this to write authoritative items onto the right lane. The track id
|
|
906
|
+
* comes from {@link laneTrackId}, shared with the up-front seed.
|
|
907
|
+
*
|
|
908
|
+
* The mint branch is a concurrency hazard, not a convenience: see
|
|
909
|
+
* {@link LANE_KINDS_IN_STACK_ORDER}. A document seeded with all four lanes never
|
|
910
|
+
* reaches it.
|
|
911
|
+
*/
|
|
912
|
+
declare function ensureLaneTrack(draft: VideoDocumentDraft, kind: LaneKind): TrackDraft;
|
|
913
|
+
/** Find a secondary lane's track row without minting it. */
|
|
914
|
+
declare function findLaneTrack(draft: VideoDocumentDraft, kind: SecondaryLane): TrackDraft | undefined;
|
|
915
|
+
//#endregion
|
|
712
916
|
//#region src/document/projection.d.ts
|
|
713
917
|
/**
|
|
714
918
|
* Projection between authoritative `VideoDocument` and compatible content
|
|
@@ -787,7 +991,7 @@ declare function derivePositionFromAbs(partId: string, abs: number, isMain: bool
|
|
|
787
991
|
* here — it belongs to Director assembly using the server envelope update_seq.
|
|
788
992
|
* Neither business metadata nor a revision counter belongs in content projection.
|
|
789
993
|
*/
|
|
790
|
-
declare function fromVideoDocument(document: VideoDocument): VideoDraftContent;
|
|
994
|
+
declare function fromVideoDocument(document: VideoDocument, options?: SolveVideoDocumentOptions): VideoDraftContent;
|
|
791
995
|
//#endregion
|
|
792
996
|
//#region src/document/initial-document.d.ts
|
|
793
997
|
/**
|
|
@@ -815,6 +1019,170 @@ declare function fromVideoDocument(document: VideoDocument): VideoDraftContent;
|
|
|
815
1019
|
*/
|
|
816
1020
|
declare function buildInitialVideoDocument(): VideoDocument;
|
|
817
1021
|
//#endregion
|
|
1022
|
+
//#region ../medeo-dsl/src/ids.d.ts
|
|
1023
|
+
declare const entityIdBrand: unique symbol;
|
|
1024
|
+
declare const relationIdBrand: unique symbol;
|
|
1025
|
+
type EntityId = string & {
|
|
1026
|
+
readonly [entityIdBrand]: 'EntityId';
|
|
1027
|
+
};
|
|
1028
|
+
type RelationId = string & {
|
|
1029
|
+
readonly [relationIdBrand]: 'RelationId';
|
|
1030
|
+
};
|
|
1031
|
+
//#endregion
|
|
1032
|
+
//#region ../medeo-dsl/src/json-values.d.ts
|
|
1033
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
1034
|
+
type JsonValue = JsonPrimitive | JsonObject | readonly JsonValue[];
|
|
1035
|
+
type JsonObject = {
|
|
1036
|
+
readonly [key: string]: JsonValue;
|
|
1037
|
+
};
|
|
1038
|
+
//#endregion
|
|
1039
|
+
//#region ../medeo-dsl/src/entities.d.ts
|
|
1040
|
+
type KnownEntityKind = 'axvideo' | 'timeline' | 'track' | 'clip' | 'asset' | 'video' | 'audio' | 'voice' | 'image' | 'sequence-marker' | 'viewport' | 'audio-script' | 'phonetic-script' | 'caption';
|
|
1041
|
+
declare const extensionEntityKindBrand: unique symbol;
|
|
1042
|
+
type ExtensionEntityKind = string & {
|
|
1043
|
+
readonly [extensionEntityKindBrand]: 'ExtensionEntityKind';
|
|
1044
|
+
};
|
|
1045
|
+
/** Extensions require explicit branding so removed or reserved domain kinds cannot reappear accidentally. */
|
|
1046
|
+
type EntityKind = KnownEntityKind | ExtensionEntityKind;
|
|
1047
|
+
interface SequenceRange<Point = unknown> {
|
|
1048
|
+
readonly start: Point;
|
|
1049
|
+
readonly end: Point;
|
|
1050
|
+
}
|
|
1051
|
+
type SequenceDuration<Span = unknown> = {
|
|
1052
|
+
readonly mode: 'from-source';
|
|
1053
|
+
} | {
|
|
1054
|
+
readonly mode: 'fixed';
|
|
1055
|
+
readonly value: Span;
|
|
1056
|
+
};
|
|
1057
|
+
interface ScriptTextSegment {
|
|
1058
|
+
readonly segmentId: string;
|
|
1059
|
+
readonly text: string;
|
|
1060
|
+
readonly language?: string;
|
|
1061
|
+
}
|
|
1062
|
+
interface VoiceDescriptor {
|
|
1063
|
+
readonly system: 'voice-library';
|
|
1064
|
+
readonly key: string;
|
|
1065
|
+
readonly name?: string;
|
|
1066
|
+
}
|
|
1067
|
+
interface CaptionFontDescriptor {
|
|
1068
|
+
readonly system: 'font-library';
|
|
1069
|
+
readonly key: string;
|
|
1070
|
+
}
|
|
1071
|
+
interface CaptionStyleFields {
|
|
1072
|
+
readonly font?: CaptionFontDescriptor;
|
|
1073
|
+
readonly fontSize?: number;
|
|
1074
|
+
readonly fontColor?: string;
|
|
1075
|
+
readonly fontWeight?: number;
|
|
1076
|
+
readonly entranceAnimation?: string;
|
|
1077
|
+
readonly entranceAnimationDurationMs?: number;
|
|
1078
|
+
readonly strokeColor?: string;
|
|
1079
|
+
readonly strokeWidth?: number;
|
|
1080
|
+
readonly positionX?: number;
|
|
1081
|
+
readonly positionY?: number;
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Half-open `[start, end)` position window inside one Segment's text, counted
|
|
1085
|
+
* in Unicode code points (not UTF-16 code units), so a boundary never splits a
|
|
1086
|
+
* surrogate pair. Positions are non-negative safe integers with `start < end`;
|
|
1087
|
+
* `end` must not exceed the Segment's code-point length.
|
|
1088
|
+
*/
|
|
1089
|
+
interface CaptionTextRange extends JsonObject {
|
|
1090
|
+
readonly start: number;
|
|
1091
|
+
readonly end: number;
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* The Caption's single text selection. `segmentId` quotes the
|
|
1095
|
+
* composed AudioScript's own stable segment identity — a local id quoted by the
|
|
1096
|
+
* variant, never a peer Entity reference. Text itself is never copied here;
|
|
1097
|
+
* complete Caption content is assembled through its direct baseEntityIds.
|
|
1098
|
+
* The optional `textRange` narrows one Segment to an intra-Segment sub-span
|
|
1099
|
+
* (intra-segment re-segmentation); without it the whole Segment text is selected.
|
|
1100
|
+
*/
|
|
1101
|
+
type CaptionSegmentSelection = JsonObject & {
|
|
1102
|
+
readonly segmentId: string;
|
|
1103
|
+
readonly textRange?: CaptionTextRange;
|
|
1104
|
+
};
|
|
1105
|
+
//#endregion
|
|
1106
|
+
//#region ../medeo-dsl/src/relations.d.ts
|
|
1107
|
+
type KnownRelationKind = 'timeline-track' | 'track-clip' | 'clip-marker' | 'marker-content' | 'axvideo-marker' | 'marker-timeline' | 'from-asset' | 'generated' | 'caption-alignment' | 'clip-anchor' | 'phonetic-script-render' | 'audio-script-source' | 'audio-script-marker';
|
|
1108
|
+
type RelationKind = KnownRelationKind | (string & {});
|
|
1109
|
+
type RelationTrace = JsonObject;
|
|
1110
|
+
/**
|
|
1111
|
+
* Authoritative persisted relation value.
|
|
1112
|
+
*
|
|
1113
|
+
* A kind may assign semantic roles to endpoint 0 and endpoint 1. Callers and
|
|
1114
|
+
* storage adapters must preserve the submitted positions; kinds whose
|
|
1115
|
+
* semantics are unordered simply do not interpret those positions.
|
|
1116
|
+
*/
|
|
1117
|
+
interface RelationRow<K extends RelationKind = RelationKind, Metadata extends JsonObject = JsonObject> {
|
|
1118
|
+
readonly relationId: RelationId;
|
|
1119
|
+
readonly endpoint0EntityId: EntityId;
|
|
1120
|
+
readonly endpoint1EntityId: EntityId;
|
|
1121
|
+
readonly relationKind: K;
|
|
1122
|
+
readonly metadata: Metadata;
|
|
1123
|
+
readonly trace: RelationTrace;
|
|
1124
|
+
}
|
|
1125
|
+
//#endregion
|
|
1126
|
+
//#region ../medeo-dsl/src/rows.d.ts
|
|
1127
|
+
/** One persisted first-class entity. Its owned fields live directly in payload. */
|
|
1128
|
+
interface EntityRow<K extends EntityKind = EntityKind> {
|
|
1129
|
+
readonly entityId: EntityId;
|
|
1130
|
+
readonly entityKind: K;
|
|
1131
|
+
readonly payload: JsonObject;
|
|
1132
|
+
}
|
|
1133
|
+
/** Complete persistence value for an entity set and its authoritative relations. */
|
|
1134
|
+
interface EntityRelationRows {
|
|
1135
|
+
readonly entities: readonly EntityRow[];
|
|
1136
|
+
readonly relations: readonly RelationRow[];
|
|
1137
|
+
}
|
|
1138
|
+
//#endregion
|
|
1139
|
+
//#region src/document/entity-projection-values.d.ts
|
|
1140
|
+
/** A graph cannot be represented faithfully by the compatibility reader. */
|
|
1141
|
+
declare class EntityTimelineProjectionError extends Error {
|
|
1142
|
+
constructor(message: string);
|
|
1143
|
+
}
|
|
1144
|
+
//#endregion
|
|
1145
|
+
//#region src/document/entity-projection.d.ts
|
|
1146
|
+
/**
|
|
1147
|
+
* One-way compatibility view over the Entity graph. A legacy part is never
|
|
1148
|
+
* consulted as an editing fact. Peer IDs appear only in this derived read
|
|
1149
|
+
* contract, reconstructed from relations; they are not stored in payloads.
|
|
1150
|
+
*/
|
|
1151
|
+
declare function projectEntityTimeline(rows: EntityRelationRows): VideoDocument;
|
|
1152
|
+
//#endregion
|
|
1153
|
+
//#region src/document/entity-timeline-layout.d.ts
|
|
1154
|
+
type EntityTimelineTrackRole = 'video_clip' | 'speech' | 'caption' | 'bgm';
|
|
1155
|
+
interface ResolvedEntityClipPlacement {
|
|
1156
|
+
readonly clipEntityId: string;
|
|
1157
|
+
readonly markerEntityId: string;
|
|
1158
|
+
readonly contentEntityId: string;
|
|
1159
|
+
readonly trackEntityId: string;
|
|
1160
|
+
readonly start: number;
|
|
1161
|
+
readonly duration: number;
|
|
1162
|
+
readonly mode: 'sequential' | 'absolute' | 'anchored';
|
|
1163
|
+
readonly anchorClipEntityId?: string;
|
|
1164
|
+
readonly anchorOffset?: number;
|
|
1165
|
+
}
|
|
1166
|
+
interface ResolvedEntityTrack {
|
|
1167
|
+
readonly entityId: string;
|
|
1168
|
+
readonly role: EntityTimelineTrackRole;
|
|
1169
|
+
readonly order: number;
|
|
1170
|
+
readonly hidden: boolean;
|
|
1171
|
+
readonly clips: readonly ResolvedEntityClipPlacement[];
|
|
1172
|
+
}
|
|
1173
|
+
interface ResolvedEntityTimelineLayout {
|
|
1174
|
+
readonly tracks: readonly ResolvedEntityTrack[];
|
|
1175
|
+
readonly clips: ReadonlyMap<string, ResolvedEntityClipPlacement>;
|
|
1176
|
+
/** Background music fills this duration; it never extends the timeline. */
|
|
1177
|
+
readonly durationMs: number;
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Resolve only entity-owned placement facts. This does not choose new anchors,
|
|
1181
|
+
* manufacture clips, or mutate a graph while reading. Write-side operations
|
|
1182
|
+
* must express any detach/reparent/overlap decision in their entity plan.
|
|
1183
|
+
*/
|
|
1184
|
+
declare function resolveEntityTimelineLayout(rows: EntityRelationRows): ResolvedEntityTimelineLayout;
|
|
1185
|
+
//#endregion
|
|
818
1186
|
//#region src/document/validation.d.ts
|
|
819
1187
|
/**
|
|
820
1188
|
* Business-level schema guard for `VideoDocument` (RFC 03 §9). It is the gate
|
|
@@ -843,677 +1211,35 @@ declare class VideoDocumentValidationError extends Error {
|
|
|
843
1211
|
declare function assertValidVideoDocument(document: unknown): asserts document is VideoDocument;
|
|
844
1212
|
declare function validateVideoDocument(document: unknown): VideoDocumentValidationIssue[];
|
|
845
1213
|
//#endregion
|
|
846
|
-
//#region src/
|
|
847
|
-
declare const videoDocumentMirrorSchema: import("loro-mirror").RootSchemaType<{
|
|
848
|
-
timeline: import("loro-mirror").LoroMapSchema<{
|
|
849
|
-
unit_time_ms: /*elided*/any;
|
|
850
|
-
}> & {
|
|
851
|
-
options: {};
|
|
852
|
-
} & {
|
|
853
|
-
catchall: <C extends import("loro-mirror").SchemaType>(catchallSchema: C) => import("loro-mirror").LoroMapSchemaWithCatchall<{
|
|
854
|
-
unit_time_ms: /*elided*/any;
|
|
855
|
-
}, C>;
|
|
856
|
-
};
|
|
857
|
-
tracks: import("loro-mirror").LoroMovableListSchema<import("loro-mirror").LoroMapSchema<{
|
|
858
|
-
id: /*elided*/any;
|
|
859
|
-
parts_kind: /*elided*/any;
|
|
860
|
-
is_hidden: /*elided*/any;
|
|
861
|
-
items: /*elided*/any;
|
|
862
|
-
}> & {
|
|
863
|
-
options: {};
|
|
864
|
-
} & {
|
|
865
|
-
catchall: <C extends import("loro-mirror").SchemaType>(catchallSchema: C) => import("loro-mirror").LoroMapSchemaWithCatchall<{
|
|
866
|
-
id: /*elided*/any;
|
|
867
|
-
parts_kind: /*elided*/any;
|
|
868
|
-
is_hidden: /*elided*/any;
|
|
869
|
-
items: /*elided*/any;
|
|
870
|
-
}, C>;
|
|
871
|
-
}> & {
|
|
872
|
-
options: {};
|
|
873
|
-
};
|
|
874
|
-
part_library: import("loro-mirror").LoroMapSchemaWithCatchall<{}, import("loro-mirror").LoroMapSchema<{
|
|
875
|
-
video_clip: /*elided*/any;
|
|
876
|
-
speech: /*elided*/any;
|
|
877
|
-
caption: /*elided*/any;
|
|
878
|
-
bgm: /*elided*/any;
|
|
879
|
-
}> & {
|
|
880
|
-
options: {};
|
|
881
|
-
} & {
|
|
882
|
-
catchall: <C extends import("loro-mirror").SchemaType>(catchallSchema: C) => import("loro-mirror").LoroMapSchemaWithCatchall<{
|
|
883
|
-
video_clip: /*elided*/any;
|
|
884
|
-
speech: /*elided*/any;
|
|
885
|
-
caption: /*elided*/any;
|
|
886
|
-
bgm: /*elided*/any;
|
|
887
|
-
}, C>;
|
|
888
|
-
}> & {
|
|
889
|
-
options: {};
|
|
890
|
-
};
|
|
891
|
-
}> & {
|
|
892
|
-
options: {};
|
|
893
|
-
};
|
|
894
|
-
type VideoDocumentMirrorSchema = typeof videoDocumentMirrorSchema;
|
|
895
|
-
/**
|
|
896
|
-
* The mutable draft an op's `transact` callback edits, inferred from the schema.
|
|
897
|
-
*
|
|
898
|
-
* `InferInputType` is the schema's *input* shape: the declared business fields
|
|
899
|
-
* with the `$cid` container ids (which mirror injects into its output
|
|
900
|
-
* `InferType`) made optional, so ops assign plain objects without supplying
|
|
901
|
-
* `$cid`. Deriving it from the schema keeps draft and storage in lockstep — a
|
|
902
|
-
* schema change is a compile error at every edit site, not a silent drift.
|
|
903
|
-
* Reorders within `items` still diff to real Loro `move` ops because the schema
|
|
904
|
-
* keys items by `part_id`.
|
|
905
|
-
*/
|
|
906
|
-
type VideoDocumentDraft = InferInputType<VideoDocumentMirrorSchema>;
|
|
907
|
-
/** Track value as it appears in a draft. Derived from the single `tracks` movable list. */
|
|
908
|
-
type TrackDraft = NonNullable<NonNullable<VideoDocumentDraft['tracks']>[number]>;
|
|
909
|
-
/** A single track item in a draft. */
|
|
910
|
-
type TrackItemDraft = NonNullable<NonNullable<TrackDraft['items']>[number]>;
|
|
911
|
-
//#endregion
|
|
912
|
-
//#region src/editor/schemas/add-speeches.d.ts
|
|
913
|
-
/**
|
|
914
|
-
* Add speeches (and their captions). TTS runs upstream; the stable speech /
|
|
915
|
-
* caption parts arrive materialized (see `speech-assets.ts`). The op writes the
|
|
916
|
-
* parts and each speech's `{ mode:'anchored', anchorPartId, offsetMs }` fact
|
|
917
|
-
* verbatim — no write-time host-picking, no cascade (RFC 02 §4). The projection
|
|
918
|
-
* derives absolute positions on read.
|
|
919
|
-
*/
|
|
920
|
-
declare const addSpeechesInputSchema: z.ZodObject<{
|
|
921
|
-
speeches: z.ZodArray<z.ZodObject<{
|
|
922
|
-
speech_id: z.ZodString;
|
|
923
|
-
anchor_part_id: z.ZodString;
|
|
924
|
-
offset_ms: z.ZodNumber;
|
|
925
|
-
audio_storage_key: z.ZodString;
|
|
926
|
-
duration_ms: z.ZodNumber;
|
|
927
|
-
audio_script: z.ZodString;
|
|
928
|
-
volume: z.ZodNumber;
|
|
929
|
-
voice: z.ZodObject<{
|
|
930
|
-
id: z.ZodString;
|
|
931
|
-
name: z.ZodString;
|
|
932
|
-
}, z.core.$strip>;
|
|
933
|
-
origin_speech_id: z.ZodString;
|
|
934
|
-
caption_ids: z.ZodArray<z.ZodString>;
|
|
935
|
-
}, z.core.$strip>>;
|
|
936
|
-
captions: z.ZodArray<z.ZodObject<{
|
|
937
|
-
caption_id: z.ZodString;
|
|
938
|
-
speech_part_id: z.ZodString;
|
|
939
|
-
text: z.ZodString;
|
|
940
|
-
start_ms: z.ZodNumber;
|
|
941
|
-
duration_ms: z.ZodNumber;
|
|
942
|
-
}, z.core.$strip>>;
|
|
943
|
-
}, z.core.$strip>;
|
|
944
|
-
type AddSpeechesInput = z.infer<typeof addSpeechesInputSchema>;
|
|
945
|
-
//#endregion
|
|
946
|
-
//#region src/editor/schemas/add-video-clips.d.ts
|
|
947
|
-
/**
|
|
948
|
-
* Add video clips to a track. Each clip's duration facts are separated so a
|
|
949
|
-
* single number is never overloaded (RFC 02 / `reference/16` §0b):
|
|
950
|
-
*
|
|
951
|
-
* - `media_duration_ms` is the source media's intrinsic full length (a resource
|
|
952
|
-
* fact, written to the part);
|
|
953
|
-
* - `play_in` / `play_out` are the optional trim window into that media; when
|
|
954
|
-
* omitted the whole media is used (`play_in=0`, `play_out=media_duration_ms`).
|
|
955
|
-
*
|
|
956
|
-
* The clip's effective timeline duration is derived by the projection from the
|
|
957
|
-
* trim window and `speed_shift` — it is never an input here.
|
|
958
|
-
*/
|
|
959
|
-
declare const addVideoClipsInputSchema: z.ZodObject<{
|
|
960
|
-
clips: z.ZodArray<z.ZodObject<{
|
|
961
|
-
media_id: z.ZodString;
|
|
962
|
-
start_ms: z.ZodOptional<z.ZodNumber>;
|
|
963
|
-
media_duration_ms: z.ZodNumber;
|
|
964
|
-
play_in: z.ZodOptional<z.ZodNumber>;
|
|
965
|
-
play_out: z.ZodOptional<z.ZodNumber>;
|
|
966
|
-
track_id: z.ZodOptional<z.ZodString>;
|
|
967
|
-
}, z.core.$strip>>;
|
|
968
|
-
before_clip_id: z.ZodOptional<z.ZodString>;
|
|
969
|
-
after_clip_id: z.ZodOptional<z.ZodString>;
|
|
970
|
-
}, z.core.$strip>;
|
|
971
|
-
type AddVideoClipsInput = z.infer<typeof addVideoClipsInputSchema>;
|
|
972
|
-
//#endregion
|
|
973
|
-
//#region src/editor/schemas/adjust-bgm-volume.d.ts
|
|
974
|
-
declare const adjustBgmVolumeInputSchema: z.ZodObject<{
|
|
975
|
-
bgm: z.ZodArray<z.ZodObject<{
|
|
976
|
-
bgm_id: z.ZodString;
|
|
977
|
-
volume: z.ZodNumber;
|
|
978
|
-
}, z.core.$strip>>;
|
|
979
|
-
}, z.core.$strip>;
|
|
980
|
-
type AdjustBgmVolumeInput = z.infer<typeof adjustBgmVolumeInputSchema>;
|
|
981
|
-
//#endregion
|
|
982
|
-
//#region src/editor/schemas/adjust-speech-volume.d.ts
|
|
983
|
-
declare const adjustSpeechVolumeInputSchema: z.ZodObject<{
|
|
984
|
-
speeches: z.ZodArray<z.ZodObject<{
|
|
985
|
-
speech_id: z.ZodString;
|
|
986
|
-
volume: z.ZodNumber;
|
|
987
|
-
}, z.core.$strip>>;
|
|
988
|
-
}, z.core.$strip>;
|
|
989
|
-
type AdjustSpeechVolumeInput = z.infer<typeof adjustSpeechVolumeInputSchema>;
|
|
990
|
-
//#endregion
|
|
991
|
-
//#region src/editor/schemas/adjust-video-clip-duration.d.ts
|
|
992
|
-
/**
|
|
993
|
-
* Re-trim existing video clips (the user-facing "adjust duration" gesture is a
|
|
994
|
-
* trim of the source window). The new `play_in` / `play_out` are the facts; the
|
|
995
|
-
* effective timeline duration is derived from them and the clip's `speed_shift`,
|
|
996
|
-
* and the change reflows downstream clips, speeches, and the timeline inside the
|
|
997
|
-
* op's transaction (no caller-materialized cascade).
|
|
998
|
-
*/
|
|
999
|
-
declare const adjustVideoClipDurationInputSchema: z.ZodObject<{
|
|
1000
|
-
clips: z.ZodArray<z.ZodObject<{
|
|
1001
|
-
clip_id: z.ZodString;
|
|
1002
|
-
play_in: z.ZodNumber;
|
|
1003
|
-
play_out: z.ZodNumber;
|
|
1004
|
-
}, z.core.$strip>>;
|
|
1005
|
-
}, z.core.$strip>;
|
|
1006
|
-
type AdjustVideoClipDurationInput = z.infer<typeof adjustVideoClipDurationInputSchema>;
|
|
1007
|
-
//#endregion
|
|
1008
|
-
//#region src/editor/schemas/adjust-video-clip-volume.d.ts
|
|
1009
|
-
declare const adjustVideoClipVolumeInputSchema: z.ZodObject<{
|
|
1010
|
-
clips: z.ZodArray<z.ZodObject<{
|
|
1011
|
-
clip_id: z.ZodString;
|
|
1012
|
-
volume: z.ZodNumber;
|
|
1013
|
-
}, z.core.$strip>>;
|
|
1014
|
-
}, z.core.$strip>;
|
|
1015
|
-
type AdjustVideoClipVolumeInput = z.infer<typeof adjustVideoClipVolumeInputSchema>;
|
|
1016
|
-
//#endregion
|
|
1017
|
-
//#region src/editor/schemas/change-speech.d.ts
|
|
1018
|
-
/**
|
|
1019
|
-
* Change a speech's script or voice. Both re-run TTS upstream and return the
|
|
1020
|
-
* regenerated speech / caption parts in the same materialized shape as
|
|
1021
|
-
* `AddSpeeches` (`speech-assets.ts`); the op upserts them by id (the speech part
|
|
1022
|
-
* id is preserved across a re-TTS), re-seats at `start_ms`, and reflows. Old
|
|
1023
|
-
* caption parts no longer owned by the speech are removed via `caption_ids`.
|
|
1024
|
-
*/
|
|
1025
|
-
declare const changeSpeechScriptInputSchema: z.ZodObject<{
|
|
1026
|
-
speeches: z.ZodArray<z.ZodObject<{
|
|
1027
|
-
speech_id: z.ZodString;
|
|
1028
|
-
anchor_part_id: z.ZodString;
|
|
1029
|
-
offset_ms: z.ZodNumber;
|
|
1030
|
-
audio_storage_key: z.ZodString;
|
|
1031
|
-
duration_ms: z.ZodNumber;
|
|
1032
|
-
audio_script: z.ZodString;
|
|
1033
|
-
volume: z.ZodNumber;
|
|
1034
|
-
voice: z.ZodObject<{
|
|
1035
|
-
id: z.ZodString;
|
|
1036
|
-
name: z.ZodString;
|
|
1037
|
-
}, z.core.$strip>;
|
|
1038
|
-
origin_speech_id: z.ZodString;
|
|
1039
|
-
caption_ids: z.ZodArray<z.ZodString>;
|
|
1040
|
-
}, z.core.$strip>>;
|
|
1041
|
-
captions: z.ZodArray<z.ZodObject<{
|
|
1042
|
-
caption_id: z.ZodString;
|
|
1043
|
-
speech_part_id: z.ZodString;
|
|
1044
|
-
text: z.ZodString;
|
|
1045
|
-
start_ms: z.ZodNumber;
|
|
1046
|
-
duration_ms: z.ZodNumber;
|
|
1047
|
-
}, z.core.$strip>>;
|
|
1048
|
-
}, z.core.$strip>;
|
|
1049
|
-
declare const changeSpeechVoiceInputSchema: z.ZodObject<{
|
|
1050
|
-
speeches: z.ZodArray<z.ZodObject<{
|
|
1051
|
-
speech_id: z.ZodString;
|
|
1052
|
-
anchor_part_id: z.ZodString;
|
|
1053
|
-
offset_ms: z.ZodNumber;
|
|
1054
|
-
audio_storage_key: z.ZodString;
|
|
1055
|
-
duration_ms: z.ZodNumber;
|
|
1056
|
-
audio_script: z.ZodString;
|
|
1057
|
-
volume: z.ZodNumber;
|
|
1058
|
-
voice: z.ZodObject<{
|
|
1059
|
-
id: z.ZodString;
|
|
1060
|
-
name: z.ZodString;
|
|
1061
|
-
}, z.core.$strip>;
|
|
1062
|
-
origin_speech_id: z.ZodString;
|
|
1063
|
-
caption_ids: z.ZodArray<z.ZodString>;
|
|
1064
|
-
}, z.core.$strip>>;
|
|
1065
|
-
captions: z.ZodArray<z.ZodObject<{
|
|
1066
|
-
caption_id: z.ZodString;
|
|
1067
|
-
speech_part_id: z.ZodString;
|
|
1068
|
-
text: z.ZodString;
|
|
1069
|
-
start_ms: z.ZodNumber;
|
|
1070
|
-
duration_ms: z.ZodNumber;
|
|
1071
|
-
}, z.core.$strip>>;
|
|
1072
|
-
}, z.core.$strip>;
|
|
1073
|
-
type ChangeSpeechScriptInput = z.infer<typeof changeSpeechScriptInputSchema>;
|
|
1074
|
-
type ChangeSpeechVoiceInput = z.infer<typeof changeSpeechVoiceInputSchema>;
|
|
1075
|
-
//#endregion
|
|
1076
|
-
//#region src/editor/schemas/delete-bgm.d.ts
|
|
1077
|
-
/**
|
|
1078
|
-
* Remove the document BGM. Pure document edit: clears the bgm lane and removes
|
|
1079
|
-
* the bgm part. Takes no input (a document holds at most one bgm); an empty
|
|
1080
|
-
* object keeps the op signature uniform with the rest.
|
|
1081
|
-
*/
|
|
1082
|
-
declare const deleteBgmInputSchema: z.ZodObject<{}, z.core.$strip>;
|
|
1083
|
-
type DeleteBgmInput = z.infer<typeof deleteBgmInputSchema>;
|
|
1084
|
-
//#endregion
|
|
1085
|
-
//#region src/editor/schemas/delete-speeches.d.ts
|
|
1086
|
-
/**
|
|
1087
|
-
* Delete speeches with their captions. Pure document edit (no side effect): the
|
|
1088
|
-
* op removes each speech part, cascade-deletes the captions it owns (via
|
|
1089
|
-
* `caption_ids` / `speech_part_id`), drops their track items, and reflows.
|
|
1090
|
-
*/
|
|
1091
|
-
declare const deleteSpeechesInputSchema: z.ZodObject<{
|
|
1092
|
-
speech_ids: z.ZodArray<z.ZodString>;
|
|
1093
|
-
}, z.core.$strip>;
|
|
1094
|
-
type DeleteSpeechesInput = z.infer<typeof deleteSpeechesInputSchema>;
|
|
1095
|
-
//#endregion
|
|
1096
|
-
//#region src/editor/schemas/delete-video-clips.d.ts
|
|
1214
|
+
//#region src/editor/id-gen.d.ts
|
|
1097
1215
|
/**
|
|
1098
|
-
*
|
|
1099
|
-
* and their captions) — a delete-op policy, not a data-model field (reference/17
|
|
1100
|
-
* §6). `cascade` (default) removes the subtree; `detach` keeps the direct
|
|
1101
|
-
* anchored children, re-pinning them to `absolute` so they stay on the timeline.
|
|
1102
|
-
*/
|
|
1103
|
-
declare const anchoredDeletePolicySchema: z.ZodEnum<{
|
|
1104
|
-
cascade: "cascade";
|
|
1105
|
-
detach: "detach";
|
|
1106
|
-
}>;
|
|
1107
|
-
type AnchoredDeletePolicy = z.infer<typeof anchoredDeletePolicySchema>;
|
|
1108
|
-
declare const deleteVideoClipsInputSchema: z.ZodObject<{
|
|
1109
|
-
clip_ids: z.ZodArray<z.ZodString>;
|
|
1110
|
-
on_anchored: z.ZodOptional<z.ZodEnum<{
|
|
1111
|
-
cascade: "cascade";
|
|
1112
|
-
detach: "detach";
|
|
1113
|
-
}>>;
|
|
1114
|
-
}, z.core.$strip>;
|
|
1115
|
-
type DeleteVideoClipsInput = z.infer<typeof deleteVideoClipsInputSchema>;
|
|
1116
|
-
//#endregion
|
|
1117
|
-
//#region src/editor/schemas/move-speeches.d.ts
|
|
1118
|
-
/**
|
|
1119
|
-
* Move speeches in time. Pure document edit: the op re-seats each speech at its
|
|
1120
|
-
* new absolute `start_ms`; the cascade reassigns it to the host video clip,
|
|
1121
|
-
* resolves overlaps, and reflows. Captions follow their speech.
|
|
1122
|
-
*/
|
|
1123
|
-
declare const moveSpeechesInputSchema: z.ZodObject<{
|
|
1124
|
-
speeches: z.ZodArray<z.ZodObject<{
|
|
1125
|
-
speech_id: z.ZodString;
|
|
1126
|
-
new_start_ms: z.ZodNumber;
|
|
1127
|
-
}, z.core.$strip>>;
|
|
1128
|
-
}, z.core.$strip>;
|
|
1129
|
-
type MoveSpeechesInput = z.infer<typeof moveSpeechesInputSchema>;
|
|
1130
|
-
//#endregion
|
|
1131
|
-
//#region src/editor/schemas/move-video-clips-by-anchor.d.ts
|
|
1132
|
-
/**
|
|
1133
|
-
* Where the moved block lands on the main track.
|
|
1134
|
-
*
|
|
1135
|
-
* A discriminated union rather than two optional `before_clip_id` /
|
|
1136
|
-
* `after_clip_id` fields (the shape `addVideoClips` had to use, because there the
|
|
1137
|
-
* two modes share a whole clip description): here the alternatives carry nothing
|
|
1138
|
-
* in common, so making them mutually exclusive *by type* removes three runtime
|
|
1139
|
-
* `superRefine` checks that would otherwise have to be written and tested.
|
|
1140
|
-
*
|
|
1141
|
-
* `track_start` is an explicit member, not the absence of an anchor. The
|
|
1142
|
-
* agent-harness mutation this maps from treats "neither anchor given" as
|
|
1143
|
-
* "move to the front" (`applyBatchMoveVideoClips` falls back to `insertIndex = 0`),
|
|
1144
|
-
* which is a default buried in a tool description. Requiring the caller to name
|
|
1145
|
-
* that intent keeps a forgotten field from silently reordering the timeline.
|
|
1146
|
-
*/
|
|
1147
|
-
declare const moveAnchorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1148
|
-
position: z.ZodLiteral<"before">;
|
|
1149
|
-
clip_id: z.ZodString;
|
|
1150
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1151
|
-
position: z.ZodLiteral<"after">;
|
|
1152
|
-
clip_id: z.ZodString;
|
|
1153
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1154
|
-
position: z.ZodLiteral<"track_start">;
|
|
1155
|
-
}, z.core.$strip>], "position">;
|
|
1156
|
-
/**
|
|
1157
|
-
* What happens to the speeches anchored to the clips being moved.
|
|
1216
|
+
* Part-id generation, aligned with the online ecosystem.
|
|
1158
1217
|
*
|
|
1159
|
-
*
|
|
1160
|
-
*
|
|
1161
|
-
*
|
|
1162
|
-
*
|
|
1163
|
-
*
|
|
1164
|
-
*
|
|
1165
|
-
*
|
|
1166
|
-
* is the branch that costs an extra pass, and the one the FE timeline uses.
|
|
1218
|
+
* The authoritative online producers — agent-harness (`@harness/shared`
|
|
1219
|
+
* `genObjId`) and director.v2 (`common/obj_id.py` `gen_obj_id`) — both mint part
|
|
1220
|
+
* ids as `` `${prefix}_${ulid()}` ``, and real captured drafts use exactly that
|
|
1221
|
+
* shape (`clip_…` / `spe_…` / `cap_…` / `bgm_…`, each a 26-char ULID). The engine
|
|
1222
|
+
* previously emitted `vc_<base36 timestamp><6 random>`, a different prefix AND a
|
|
1223
|
+
* different encoding — the sole cross-repo id divergence. This module removes it
|
|
1224
|
+
* by emitting the same `<prefix>_<ULID>` bytes.
|
|
1167
1225
|
*
|
|
1168
|
-
*
|
|
1169
|
-
* `
|
|
1170
|
-
*
|
|
1171
|
-
*
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
*
|
|
1179
|
-
*
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
* Keeping them separate also isolates blast radius — this method can diverge on
|
|
1186
|
-
* speech policy without touching the FE path.
|
|
1187
|
-
*
|
|
1188
|
-
* `clip_ids` need not be contiguous. They move as one block, keeping their
|
|
1189
|
-
* relative order, which is the agent-harness `batch_move_video_clips` contract.
|
|
1190
|
-
*/
|
|
1191
|
-
declare const moveVideoClipsByAnchorInputSchema: z.ZodObject<{
|
|
1192
|
-
clip_ids: z.ZodArray<z.ZodString>;
|
|
1193
|
-
anchor: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1194
|
-
position: z.ZodLiteral<"before">;
|
|
1195
|
-
clip_id: z.ZodString;
|
|
1196
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1197
|
-
position: z.ZodLiteral<"after">;
|
|
1198
|
-
clip_id: z.ZodString;
|
|
1199
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1200
|
-
position: z.ZodLiteral<"track_start">;
|
|
1201
|
-
}, z.core.$strip>], "position">;
|
|
1202
|
-
on_anchored: z.ZodEnum<{
|
|
1203
|
-
follow: "follow";
|
|
1204
|
-
keep_absolute: "keep_absolute";
|
|
1205
|
-
}>;
|
|
1206
|
-
}, z.core.$strip>;
|
|
1207
|
-
type MoveAnchor = z.infer<typeof moveAnchorSchema>;
|
|
1208
|
-
type MovedClipAnchoredPolicy = z.infer<typeof movedClipAnchoredPolicySchema>;
|
|
1209
|
-
type MoveVideoClipsByAnchorInput = z.infer<typeof moveVideoClipsByAnchorInputSchema>;
|
|
1210
|
-
//#endregion
|
|
1211
|
-
//#region src/editor/schemas/move-video-clips.d.ts
|
|
1212
|
-
declare const moveVideoClipsInputSchema: z.ZodObject<{
|
|
1213
|
-
clips: z.ZodArray<z.ZodObject<{
|
|
1214
|
-
clip_id: z.ZodString;
|
|
1215
|
-
new_start_ms: z.ZodNumber;
|
|
1216
|
-
new_track_id: z.ZodOptional<z.ZodString>;
|
|
1217
|
-
}, z.core.$strip>>;
|
|
1218
|
-
}, z.core.$strip>;
|
|
1219
|
-
type MoveVideoClipsInput = z.infer<typeof moveVideoClipsInputSchema>;
|
|
1220
|
-
//#endregion
|
|
1221
|
-
//#region src/editor/schemas/replace-video-clip-content.d.ts
|
|
1222
|
-
/**
|
|
1223
|
-
* Replace the media backing existing video clips. The media import runs upstream
|
|
1224
|
-
* (Director); its stable result — the new media id, intrinsic length, and the
|
|
1225
|
-
* reset trim window — arrives materialized (see
|
|
1226
|
-
* `results/phase-4-side-effect-payload-contract.md` §4). Director resets
|
|
1227
|
-
* `play_in=0` / `play_out=media_duration_ms` and clears `speed_shift` on
|
|
1228
|
-
* replacement. The clip `part_id`s (hence their track items) are unchanged; the
|
|
1229
|
-
* editor reflows the main track from the new effective durations.
|
|
1230
|
-
*/
|
|
1231
|
-
declare const replaceVideoClipContentInputSchema: z.ZodObject<{
|
|
1232
|
-
clips: z.ZodArray<z.ZodObject<{
|
|
1233
|
-
clip_id: z.ZodString;
|
|
1234
|
-
origin_media_id: z.ZodString;
|
|
1235
|
-
media_duration_ms: z.ZodNumber;
|
|
1236
|
-
play_in: z.ZodNumber;
|
|
1237
|
-
play_out: z.ZodNumber;
|
|
1238
|
-
volume: z.ZodNumber;
|
|
1239
|
-
}, z.core.$strip>>;
|
|
1240
|
-
}, z.core.$strip>;
|
|
1241
|
-
type ReplaceVideoClipContentInput = z.infer<typeof replaceVideoClipContentInputSchema>;
|
|
1242
|
-
//#endregion
|
|
1243
|
-
//#region src/editor/schemas/replace-video-clip-sequence.d.ts
|
|
1244
|
-
/**
|
|
1245
|
-
* What happens to the speeches anchored to the clips being replaced.
|
|
1246
|
-
*
|
|
1247
|
-
* - `remap` re-anchors each surviving speech to the new clip in the SAME POSITION
|
|
1248
|
-
* of the sequence, keeping its offset — old[i]'s children become new[i]'s
|
|
1249
|
-
* children. An old clip with no counterpart (fewer new clips than old) has its
|
|
1250
|
-
* subtree deleted, because there is nothing left to anchor to.
|
|
1251
|
-
* - `cascade` deletes every anchored speech (and its captions) outright, like
|
|
1252
|
-
* `deleteVideoClips`.
|
|
1253
|
-
*
|
|
1254
|
-
* **Required, with no default.** The two branches differ in whether the user's
|
|
1255
|
-
* narration survives, and the agent tool that drives this op makes its
|
|
1256
|
-
* `preserve_speeches` flag required for that reason. A default here would let a
|
|
1257
|
-
* caller that forgot the field silently delete speech.
|
|
1258
|
-
*/
|
|
1259
|
-
declare const anchoredReplacePolicySchema: z.ZodEnum<{
|
|
1260
|
-
cascade: "cascade";
|
|
1261
|
-
remap: "remap";
|
|
1262
|
-
}>;
|
|
1263
|
-
type AnchoredReplacePolicy = z.infer<typeof anchoredReplacePolicySchema>;
|
|
1264
|
-
/**
|
|
1265
|
-
* Replace a contiguous run of main-track clips with a new run.
|
|
1266
|
-
*
|
|
1267
|
-
* A composite of delete + insert that cannot be expressed as the two ops in
|
|
1268
|
-
* sequence, because the anchored speeches have to survive *across* the swap: with
|
|
1269
|
-
* `remap` they are re-anchored positionally, which needs both the old and the new
|
|
1270
|
-
* ids in the same transaction (ADR 0009 — the cascade stays in the editor, callers
|
|
1271
|
-
* never re-wire anchors themselves).
|
|
1272
|
-
*
|
|
1273
|
-
* Duration facts follow `addVideoClips`: `media_duration_ms` is the source's
|
|
1274
|
-
* intrinsic length and the trim window defaults to the whole media. The effective
|
|
1275
|
-
* timeline duration is derived by the projection, never an input.
|
|
1276
|
-
*
|
|
1277
|
-
* `media_id` is optional: omitting it creates a **deliberate empty placeholder
|
|
1278
|
-
* clip** (`origin_media_id: ''`) — structure with no picture. This is the only op
|
|
1279
|
-
* that can produce one, and it is authoritative state, unlike the gap fillers the
|
|
1280
|
-
* read-side solve mints (which never enter the document).
|
|
1281
|
-
*/
|
|
1282
|
-
declare const replaceVideoClipSequenceInputSchema: z.ZodObject<{
|
|
1283
|
-
old_clip_ids: z.ZodArray<z.ZodString>;
|
|
1284
|
-
new_clips: z.ZodArray<z.ZodObject<{
|
|
1285
|
-
media_id: z.ZodOptional<z.ZodString>;
|
|
1286
|
-
media_duration_ms: z.ZodNumber;
|
|
1287
|
-
play_in: z.ZodOptional<z.ZodNumber>;
|
|
1288
|
-
play_out: z.ZodOptional<z.ZodNumber>;
|
|
1289
|
-
}, z.core.$strip>>;
|
|
1290
|
-
on_anchored: z.ZodEnum<{
|
|
1291
|
-
cascade: "cascade";
|
|
1292
|
-
remap: "remap";
|
|
1293
|
-
}>;
|
|
1294
|
-
}, z.core.$strip>;
|
|
1295
|
-
type ReplaceVideoClipSequenceInput = z.infer<typeof replaceVideoClipSequenceInputSchema>;
|
|
1296
|
-
//#endregion
|
|
1297
|
-
//#region src/editor/schemas/set-bgm.d.ts
|
|
1298
|
-
/**
|
|
1299
|
-
* Set the document BGM. The media's stable result (storage key) arrives
|
|
1300
|
-
* materialized from upstream (see
|
|
1301
|
-
* `results/phase-4-side-effect-payload-contract.md` §3). The op upserts the bgm
|
|
1302
|
-
* part and seats it on the bgm lane; its effective length is always the whole
|
|
1303
|
-
* timeline, derived by the projection on read — so there is no `duration_ms`
|
|
1304
|
-
* input or fact (RFC 02 / `reference/16` §0b). A `bgm_id` lets the op replace an
|
|
1305
|
-
* existing bgm part by id.
|
|
1306
|
-
*/
|
|
1307
|
-
declare const setBgmInputSchema: z.ZodObject<{
|
|
1308
|
-
bgm_id: z.ZodString;
|
|
1309
|
-
audio_storage_key: z.ZodString;
|
|
1310
|
-
origin_media_id: z.ZodString;
|
|
1311
|
-
volume: z.ZodNumber;
|
|
1312
|
-
}, z.core.$strip>;
|
|
1313
|
-
type SetBgmInput = z.infer<typeof setBgmInputSchema>;
|
|
1314
|
-
//#endregion
|
|
1315
|
-
//#region src/editor/schemas/set-caption-style.d.ts
|
|
1316
|
-
/**
|
|
1317
|
-
* Set the caption visual style. GLOBAL by design: the style applies to every
|
|
1318
|
-
* caption part in the document — it carries NO `caption_id`. This mirrors the FE,
|
|
1319
|
-
* whose caption-style store (`caption-style.ts:persistCaptionStylePatch`) iterates
|
|
1320
|
-
* ALL captions and writes the same normalized style to each; the product has a
|
|
1321
|
-
* single document-wide caption style, not per-caption styling.
|
|
1322
|
-
*
|
|
1323
|
-
* Every field is optional and maps to a `CaptionStyle` attribute (snake_case
|
|
1324
|
-
* IDL). A field present in the input is written to every caption; a field ABSENT
|
|
1325
|
-
* from the input is left untouched on each caption (the editor merges the patch
|
|
1326
|
-
* onto each caption's existing style — this is a value edit, not a full-style
|
|
1327
|
-
* replace, so a partial patch such as "recolor only" does not wipe font size).
|
|
1328
|
-
*
|
|
1329
|
-
* Pure document edit, no cascade — captions keep their positions; only the style
|
|
1330
|
-
* sub-map of each caption part changes.
|
|
1331
|
-
*/
|
|
1332
|
-
declare const setCaptionStyleInputSchema: z.ZodObject<{
|
|
1333
|
-
font_id: z.ZodOptional<z.ZodString>;
|
|
1334
|
-
font_size: z.ZodOptional<z.ZodNumber>;
|
|
1335
|
-
font_color: z.ZodOptional<z.ZodString>;
|
|
1336
|
-
font_weight: z.ZodOptional<z.ZodNumber>;
|
|
1337
|
-
entrance_animation: z.ZodOptional<z.ZodString>;
|
|
1338
|
-
entrance_animation_duration_ms: z.ZodOptional<z.ZodNumber>;
|
|
1339
|
-
stroke_color: z.ZodOptional<z.ZodString>;
|
|
1340
|
-
stroke_width: z.ZodOptional<z.ZodNumber>;
|
|
1341
|
-
position_x: z.ZodOptional<z.ZodNumber>;
|
|
1342
|
-
position_y: z.ZodOptional<z.ZodNumber>;
|
|
1343
|
-
}, z.core.$strip>;
|
|
1344
|
-
type SetCaptionStyleInput = z.infer<typeof setCaptionStyleInputSchema>;
|
|
1345
|
-
//#endregion
|
|
1346
|
-
//#region src/editor/schemas/set-caption-visibility.d.ts
|
|
1347
|
-
/**
|
|
1348
|
-
* Toggle caption visibility (the caption track's `is_hidden` flag). Pure
|
|
1349
|
-
* document edit, no cascade — captions keep their positions; only the lane's
|
|
1350
|
-
* hidden flag changes.
|
|
1351
|
-
*/
|
|
1352
|
-
declare const setCaptionVisibilityInputSchema: z.ZodObject<{
|
|
1353
|
-
is_hidden: z.ZodBoolean;
|
|
1354
|
-
}, z.core.$strip>;
|
|
1355
|
-
type SetCaptionVisibilityInput = z.infer<typeof setCaptionVisibilityInputSchema>;
|
|
1356
|
-
//#endregion
|
|
1357
|
-
//#region src/editor/schemas/set-video-clip-speed-shift.d.ts
|
|
1358
|
-
/**
|
|
1359
|
-
* Set the playback speed of existing video clips. Per the speed-shift decision
|
|
1360
|
-
* (`reference/16` §0): the op writes only the `speed_shift` fact — it does NOT
|
|
1361
|
-
* store an effective `duration_ms` (projection derives it from the trim window /
|
|
1362
|
-
* speed) and does NOT scale anchored speeches' relative offsets (offsets stay
|
|
1363
|
-
* put; the cascade reflows absolute positions). A `null` speed_shift clears the
|
|
1364
|
-
* speed back to original (1×).
|
|
1365
|
-
*/
|
|
1366
|
-
declare const setVideoClipSpeedShiftInputSchema: z.ZodObject<{
|
|
1367
|
-
clips: z.ZodArray<z.ZodObject<{
|
|
1368
|
-
clip_id: z.ZodString;
|
|
1369
|
-
speed_shift: z.ZodNullable<z.ZodObject<{
|
|
1370
|
-
category: z.ZodEnum<{
|
|
1371
|
-
curve: "curve";
|
|
1372
|
-
linear: "linear";
|
|
1373
|
-
}>;
|
|
1374
|
-
mode: z.ZodString;
|
|
1375
|
-
config: z.ZodUnion<readonly [z.ZodObject<{
|
|
1376
|
-
linear: z.ZodObject<{
|
|
1377
|
-
speed: z.ZodNumber;
|
|
1378
|
-
}, z.core.$strip>;
|
|
1379
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1380
|
-
curve: z.ZodObject<{
|
|
1381
|
-
keyframes: z.ZodArray<z.ZodObject<{
|
|
1382
|
-
position: z.ZodNumber;
|
|
1383
|
-
rate: z.ZodNumber;
|
|
1384
|
-
in_tangent: z.ZodOptional<z.ZodObject<{
|
|
1385
|
-
x: z.ZodNumber;
|
|
1386
|
-
y: z.ZodNumber;
|
|
1387
|
-
}, z.core.$strip>>;
|
|
1388
|
-
out_tangent: z.ZodOptional<z.ZodObject<{
|
|
1389
|
-
x: z.ZodNumber;
|
|
1390
|
-
y: z.ZodNumber;
|
|
1391
|
-
}, z.core.$strip>>;
|
|
1392
|
-
}, z.core.$strip>>;
|
|
1393
|
-
}, z.core.$strip>;
|
|
1394
|
-
}, z.core.$strip>]>;
|
|
1395
|
-
}, z.core.$strip>>;
|
|
1396
|
-
}, z.core.$strip>>;
|
|
1397
|
-
}, z.core.$strip>;
|
|
1398
|
-
type SetVideoClipSpeedShiftInput = z.infer<typeof setVideoClipSpeedShiftInputSchema>;
|
|
1399
|
-
//#endregion
|
|
1400
|
-
//#region src/editor/schemas/shared.d.ts
|
|
1401
|
-
declare const clipIdSchema: z.ZodString;
|
|
1402
|
-
declare const clipIdsSchema: z.ZodArray<z.ZodString>;
|
|
1403
|
-
declare const mediaIdSchema: z.ZodString;
|
|
1404
|
-
declare const speechIdSchema: z.ZodString;
|
|
1405
|
-
declare const timelineMsSchema: z.ZodNumber;
|
|
1406
|
-
declare const positiveMsSchema: z.ZodNumber;
|
|
1407
|
-
declare const volumeSchema: z.ZodNumber;
|
|
1408
|
-
declare const speechIdsSchema: z.ZodArray<z.ZodString>;
|
|
1409
|
-
/**
|
|
1410
|
-
* A clip's playback-speed fact, the only thing `SetVideoClipSpeedShift` writes.
|
|
1411
|
-
* Mirrors the IDL `SpeedShift`: `category` is `linear` | `curve`, and `config`
|
|
1412
|
-
* is a discriminated union — `{ linear: { speed } }` for a constant multiplier
|
|
1413
|
-
* (the multiplier projection reads at `config.linear.speed`) or `{ curve: {
|
|
1414
|
-
* keyframes } }` for a Bezier-controlled variable speed (RFC 02 / `reference/16`
|
|
1415
|
-
* §0). Exactly one of `linear` / `curve` is present.
|
|
1416
|
-
*/
|
|
1417
|
-
declare const speedShiftSchema: z.ZodObject<{
|
|
1418
|
-
category: z.ZodEnum<{
|
|
1419
|
-
curve: "curve";
|
|
1420
|
-
linear: "linear";
|
|
1421
|
-
}>;
|
|
1422
|
-
mode: z.ZodString;
|
|
1423
|
-
config: z.ZodUnion<readonly [z.ZodObject<{
|
|
1424
|
-
linear: z.ZodObject<{
|
|
1425
|
-
speed: z.ZodNumber;
|
|
1426
|
-
}, z.core.$strip>;
|
|
1427
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
1428
|
-
curve: z.ZodObject<{
|
|
1429
|
-
keyframes: z.ZodArray<z.ZodObject<{
|
|
1430
|
-
position: z.ZodNumber;
|
|
1431
|
-
rate: z.ZodNumber;
|
|
1432
|
-
in_tangent: z.ZodOptional<z.ZodObject<{
|
|
1433
|
-
x: z.ZodNumber;
|
|
1434
|
-
y: z.ZodNumber;
|
|
1435
|
-
}, z.core.$strip>>;
|
|
1436
|
-
out_tangent: z.ZodOptional<z.ZodObject<{
|
|
1437
|
-
x: z.ZodNumber;
|
|
1438
|
-
y: z.ZodNumber;
|
|
1439
|
-
}, z.core.$strip>>;
|
|
1440
|
-
}, z.core.$strip>>;
|
|
1441
|
-
}, z.core.$strip>;
|
|
1442
|
-
}, z.core.$strip>]>;
|
|
1443
|
-
}, z.core.$strip>;
|
|
1444
|
-
declare const voiceSchema: z.ZodObject<{
|
|
1445
|
-
id: z.ZodString;
|
|
1446
|
-
name: z.ZodString;
|
|
1447
|
-
}, z.core.$strip>;
|
|
1448
|
-
//#endregion
|
|
1449
|
-
//#region src/editor/schemas/speech-assets.d.ts
|
|
1450
|
-
/**
|
|
1451
|
-
* The materialized TTS result shared by `AddSpeeches` / `ChangeSpeechScript` /
|
|
1452
|
-
* `ChangeSpeechVoice` (see `results/phase-4-side-effect-payload-contract.md`
|
|
1453
|
-
* §1/§2). The side effect (TTS/ASR + billing) runs upstream; the op receives the
|
|
1454
|
-
* stable speech + caption parts and writes them as authoritative facts. No
|
|
1455
|
-
* cascade runs on write — the projection derives absolute positions on read.
|
|
1456
|
-
*
|
|
1457
|
-
* Each speech carries the anchoring fact directly (RFC 02 §4): the host video
|
|
1458
|
-
* clip `anchor_part_id` and the `offset_ms` within it. The upstream caller
|
|
1459
|
-
* already knows which clip a speech attaches to, so the op writes
|
|
1460
|
-
* `{ mode:'anchored', anchorPartId, offsetMs }` verbatim — no write-time
|
|
1461
|
-
* host-picking. Captions anchor to their speech via the caption part's
|
|
1462
|
-
* `start_ms` (offset within the speech).
|
|
1463
|
-
*/
|
|
1464
|
-
declare const speechAssetSchema: z.ZodObject<{
|
|
1465
|
-
speech_id: z.ZodString;
|
|
1466
|
-
anchor_part_id: z.ZodString;
|
|
1467
|
-
offset_ms: z.ZodNumber;
|
|
1468
|
-
audio_storage_key: z.ZodString;
|
|
1469
|
-
duration_ms: z.ZodNumber;
|
|
1470
|
-
audio_script: z.ZodString;
|
|
1471
|
-
volume: z.ZodNumber;
|
|
1472
|
-
voice: z.ZodObject<{
|
|
1473
|
-
id: z.ZodString;
|
|
1474
|
-
name: z.ZodString;
|
|
1475
|
-
}, z.core.$strip>;
|
|
1476
|
-
origin_speech_id: z.ZodString;
|
|
1477
|
-
caption_ids: z.ZodArray<z.ZodString>;
|
|
1478
|
-
}, z.core.$strip>;
|
|
1479
|
-
declare const captionAssetSchema: z.ZodObject<{
|
|
1480
|
-
caption_id: z.ZodString;
|
|
1481
|
-
speech_part_id: z.ZodString;
|
|
1482
|
-
text: z.ZodString;
|
|
1483
|
-
start_ms: z.ZodNumber;
|
|
1484
|
-
duration_ms: z.ZodNumber;
|
|
1485
|
-
}, z.core.$strip>;
|
|
1486
|
-
/** A materialized speech-subtree write (speeches + their captions). */
|
|
1487
|
-
declare const speechAssetsSchema: z.ZodObject<{
|
|
1488
|
-
speeches: z.ZodArray<z.ZodObject<{
|
|
1489
|
-
speech_id: z.ZodString;
|
|
1490
|
-
anchor_part_id: z.ZodString;
|
|
1491
|
-
offset_ms: z.ZodNumber;
|
|
1492
|
-
audio_storage_key: z.ZodString;
|
|
1493
|
-
duration_ms: z.ZodNumber;
|
|
1494
|
-
audio_script: z.ZodString;
|
|
1495
|
-
volume: z.ZodNumber;
|
|
1496
|
-
voice: z.ZodObject<{
|
|
1497
|
-
id: z.ZodString;
|
|
1498
|
-
name: z.ZodString;
|
|
1499
|
-
}, z.core.$strip>;
|
|
1500
|
-
origin_speech_id: z.ZodString;
|
|
1501
|
-
caption_ids: z.ZodArray<z.ZodString>;
|
|
1502
|
-
}, z.core.$strip>>;
|
|
1503
|
-
captions: z.ZodArray<z.ZodObject<{
|
|
1504
|
-
caption_id: z.ZodString;
|
|
1505
|
-
speech_part_id: z.ZodString;
|
|
1506
|
-
text: z.ZodString;
|
|
1507
|
-
start_ms: z.ZodNumber;
|
|
1508
|
-
duration_ms: z.ZodNumber;
|
|
1509
|
-
}, z.core.$strip>>;
|
|
1510
|
-
}, z.core.$strip>;
|
|
1511
|
-
type SpeechAsset = z.infer<typeof speechAssetSchema>;
|
|
1512
|
-
type CaptionAsset = z.infer<typeof captionAssetSchema>;
|
|
1513
|
-
type SpeechAssets = z.infer<typeof speechAssetsSchema>;
|
|
1514
|
-
declare namespace index_d_exports {
|
|
1515
|
-
export { AddSpeechesInput, AddVideoClipsInput, AdjustBgmVolumeInput, AdjustSpeechVolumeInput, AdjustVideoClipDurationInput, AdjustVideoClipVolumeInput, AnchoredDeletePolicy, AnchoredReplacePolicy, CaptionAsset, ChangeSpeechScriptInput, ChangeSpeechVoiceInput, DeleteBgmInput, DeleteSpeechesInput, DeleteVideoClipsInput, MoveAnchor, MoveSpeechesInput, MoveVideoClipsByAnchorInput, MoveVideoClipsInput, MovedClipAnchoredPolicy, ReplaceVideoClipContentInput, ReplaceVideoClipSequenceInput, SetBgmInput, SetCaptionStyleInput, SetCaptionVisibilityInput, SetVideoClipSpeedShiftInput, SpeechAsset, SpeechAssets, addSpeechesInputSchema, addVideoClipsInputSchema, adjustBgmVolumeInputSchema, adjustSpeechVolumeInputSchema, adjustVideoClipDurationInputSchema, adjustVideoClipVolumeInputSchema, anchoredDeletePolicySchema, anchoredReplacePolicySchema, changeSpeechScriptInputSchema, changeSpeechVoiceInputSchema, clipIdSchema, clipIdsSchema, deleteBgmInputSchema, deleteSpeechesInputSchema, deleteVideoClipsInputSchema, mediaIdSchema, moveAnchorSchema, moveSpeechesInputSchema, moveVideoClipsByAnchorInputSchema, moveVideoClipsInputSchema, movedClipAnchoredPolicySchema, positiveMsSchema, replaceVideoClipContentInputSchema, replaceVideoClipSequenceInputSchema, setBgmInputSchema, setCaptionStyleInputSchema, setCaptionVisibilityInputSchema, setVideoClipSpeedShiftInputSchema, speechAssetsSchema, speechIdSchema, speechIdsSchema, speedShiftSchema, timelineMsSchema, voiceSchema, volumeSchema };
|
|
1516
|
-
}
|
|
1226
|
+
* The ULID is generated inline (Crockford Base32, 48-bit time + 80-bit random)
|
|
1227
|
+
* rather than pulling the `ulid` npm package: the randomness class matches the
|
|
1228
|
+
* old generator (both `Math.random`-based) and it keeps `@mengine/medeo-client`
|
|
1229
|
+
* dependency-free for a purely mechanical id string. Part ids only need to be
|
|
1230
|
+
* unique and lexicographically time-sortable, which this satisfies.
|
|
1231
|
+
*/
|
|
1232
|
+
/**
|
|
1233
|
+
* Online part-id semantic prefixes. `clip` (video clip) is the only value the
|
|
1234
|
+
* engine currently mints (see `addVideoClips`); the rest are declared so the
|
|
1235
|
+
* type documents the shared vocabulary and guards against reintroducing the old
|
|
1236
|
+
* `vc`/`sp`/`cp`/`bg` names. Speech/caption/bgm ids arrive pre-minted in op
|
|
1237
|
+
* payloads, so the engine never generates them itself.
|
|
1238
|
+
*/
|
|
1239
|
+
type PartIdPrefix = 'clip' | 'spe' | 'cap' | 'bgm' | 'ti';
|
|
1240
|
+
declare function generatePartId(prefix: PartIdPrefix): string;
|
|
1241
|
+
/** Injectable part-id mint; defaults to `generatePartId` on `SemanticEditor`. */
|
|
1242
|
+
type PartIdFactory = (prefix: PartIdPrefix) => string;
|
|
1517
1243
|
//#endregion
|
|
1518
1244
|
//#region src/editor/schema-validator.d.ts
|
|
1519
1245
|
interface SnapshotReadable {
|
|
@@ -1667,10 +1393,15 @@ interface OpActor {
|
|
|
1667
1393
|
role: 'user' | 'agent';
|
|
1668
1394
|
}
|
|
1669
1395
|
interface CommitOptions {
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1396
|
+
/**
|
|
1397
|
+
* Caller-supplied intent attached to the op's audit message.
|
|
1398
|
+
*
|
|
1399
|
+
* Typed as `unknown` to match `TransactAudit.intent`. The wire (real
|
|
1400
|
+
* mengine-server and the in-memory test double) only surfaces **string**
|
|
1401
|
+
* intents onto the audit log — non-string values stay in the Loro commit
|
|
1402
|
+
* message but parse to `null`. Agent callers should pass a string.
|
|
1403
|
+
*/
|
|
1404
|
+
intent?: unknown;
|
|
1674
1405
|
/** Author of this op; omitted for writes with no acting user (bootstrap, repair). */
|
|
1675
1406
|
actor?: OpActor;
|
|
1676
1407
|
}
|
|
@@ -1714,7 +1445,8 @@ interface SemanticDocumentAdapter extends SnapshotReadable {
|
|
|
1714
1445
|
declare class SemanticEditor {
|
|
1715
1446
|
private readonly doc;
|
|
1716
1447
|
private readonly validator;
|
|
1717
|
-
|
|
1448
|
+
private readonly idFactory;
|
|
1449
|
+
constructor(doc: SemanticDocumentAdapter, validator?: SchemaValidator, idFactory?: PartIdFactory);
|
|
1718
1450
|
moveVideoClips(input: MoveVideoClipsInput, options?: CommitOptions): Promise<void>;
|
|
1719
1451
|
/**
|
|
1720
1452
|
* Reorder main-track clips relative to an anchor clip, moving them as one block.
|
|
@@ -1882,6 +1614,14 @@ declare class MirrorVideoDocumentAdapter implements SemanticDocumentAdapter {
|
|
|
1882
1614
|
private disposed;
|
|
1883
1615
|
constructor(doc: LoroDoc, mutationGuard?: DocumentMutationGuard);
|
|
1884
1616
|
snapshot(): VideoDocument;
|
|
1617
|
+
/**
|
|
1618
|
+
* Native Entity authority: placement is already solved by the Entity graph.
|
|
1619
|
+
*
|
|
1620
|
+
* The root check goes through `getShallowValue` first because `getMap` creates
|
|
1621
|
+
* the container on access — probing a legacy document for `medeo` would
|
|
1622
|
+
* otherwise mutate it, which a read must never do.
|
|
1623
|
+
*/
|
|
1624
|
+
isEntityDocument(): boolean;
|
|
1885
1625
|
/**
|
|
1886
1626
|
* Release mirror subscriptions; do not reuse this adapter afterwards.
|
|
1887
1627
|
* The caller still owns the borrowed LoroDoc.
|
|
@@ -1901,6 +1641,62 @@ declare function createMirrorVideoDocument(document: VideoDocument, options?: Mi
|
|
|
1901
1641
|
/** Build a `MirrorVideoDocumentAdapter` over a fresh doc seeded with `document`. */
|
|
1902
1642
|
declare function createMirrorVideoDocumentAdapter(document: VideoDocument, options?: MirrorVideoDocumentOptions): MirrorVideoDocumentAdapter;
|
|
1903
1643
|
//#endregion
|
|
1644
|
+
//#region src/document/plain-memory-adapter.d.ts
|
|
1645
|
+
/**
|
|
1646
|
+
* A `TransactAudit` widened with the ordered ids minted during that transact.
|
|
1647
|
+
* `generated_ids` is empty when the op never called the id factory.
|
|
1648
|
+
*/
|
|
1649
|
+
interface JournalEntry extends TransactAudit {
|
|
1650
|
+
/** Ids produced by the adapter's id factory during this transact, in mint order. */
|
|
1651
|
+
generated_ids: string[];
|
|
1652
|
+
}
|
|
1653
|
+
interface PlainMemoryAdapterOptions {
|
|
1654
|
+
/** Underlying id mint; wrapped so each call inside a transact is journaled. */
|
|
1655
|
+
idFactory?: PartIdFactory;
|
|
1656
|
+
/**
|
|
1657
|
+
* Refuse every `transact`. Set when the seed document is an Entity projection:
|
|
1658
|
+
* its timeline is owned by the Entity graph, and the document itself no longer
|
|
1659
|
+
* states its provenance (business metadata left the CRDT), so the caller does.
|
|
1660
|
+
*/
|
|
1661
|
+
readOnly?: boolean;
|
|
1662
|
+
}
|
|
1663
|
+
/**
|
|
1664
|
+
* Pure in-memory `SemanticDocumentAdapter` — no Loro/WASM. Holds a
|
|
1665
|
+
* `VideoDocumentDraft` object and applies each `transact` via immer `produce`,
|
|
1666
|
+
* journaling every audit that actually mutated state (plus any ids minted
|
|
1667
|
+
* during that transact).
|
|
1668
|
+
*
|
|
1669
|
+
* Known benign difference vs `MirrorVideoDocumentAdapter`: the editor's
|
|
1670
|
+
* `setPart` assigns a fresh part object on every call, so a same-value rewrite
|
|
1671
|
+
* produces a new immer state and IS journaled here, while the mirror's deep
|
|
1672
|
+
* diff emits no commit. Terminal `snapshot()` stays equal; replay is idempotent.
|
|
1673
|
+
*/
|
|
1674
|
+
declare class PlainMemoryAdapter implements SemanticDocumentAdapter {
|
|
1675
|
+
private state;
|
|
1676
|
+
private readonly _journal;
|
|
1677
|
+
private readonly baseIdFactory;
|
|
1678
|
+
/** Non-null only while a `transact` edit callback is running. */
|
|
1679
|
+
private pendingIds;
|
|
1680
|
+
/**
|
|
1681
|
+
* Recording wrapper around the underlying factory. Callers (sandbox editor)
|
|
1682
|
+
* use this so every minted id is appended to the current transact's list.
|
|
1683
|
+
*/
|
|
1684
|
+
readonly idFactory: PartIdFactory;
|
|
1685
|
+
private readonly readOnly;
|
|
1686
|
+
constructor(document: VideoDocument, options?: PlainMemoryAdapterOptions);
|
|
1687
|
+
get journal(): readonly JournalEntry[];
|
|
1688
|
+
hasContent(): boolean;
|
|
1689
|
+
snapshot(): VideoDocument;
|
|
1690
|
+
/**
|
|
1691
|
+
* Apply one op via immer. A throw in `edit` discards the draft (state and
|
|
1692
|
+
* journal unchanged). When `produce` returns the same reference, there was
|
|
1693
|
+
* no structural change — skip journal, matching mirror "no change, no commit".
|
|
1694
|
+
*/
|
|
1695
|
+
transact(edit: (draft: VideoDocumentDraft) => void, audit: TransactAudit): void;
|
|
1696
|
+
}
|
|
1697
|
+
/** Build a `PlainMemoryAdapter` seeded with `document`. */
|
|
1698
|
+
declare function createPlainMemoryAdapter(document: VideoDocument, options?: PlainMemoryAdapterOptions): PlainMemoryAdapter;
|
|
1699
|
+
//#endregion
|
|
1904
1700
|
//#region src/document/mirror-read.d.ts
|
|
1905
1701
|
/**
|
|
1906
1702
|
* Project the mirror state (`VideoDocumentDraft`) into the authoritative
|
|
@@ -1957,7 +1753,7 @@ declare const partUnionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
1957
1753
|
id: z.ZodOptional<z.ZodString>;
|
|
1958
1754
|
kind: z.ZodLiteral<"caption">;
|
|
1959
1755
|
initial_duration_ms: z.ZodNumber;
|
|
1960
|
-
speech_part_id: z.ZodString
|
|
1756
|
+
speech_part_id: z.ZodOptional<z.ZodString>;
|
|
1961
1757
|
text: z.ZodString;
|
|
1962
1758
|
start_ms: z.ZodNumber;
|
|
1963
1759
|
style: z.ZodOptional<z.ZodObject<{
|
|
@@ -1989,10 +1785,10 @@ declare const videoDocumentSchema: z.ZodObject<{
|
|
|
1989
1785
|
tracks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1990
1786
|
id: z.ZodOptional<z.ZodString>;
|
|
1991
1787
|
parts_kind: z.ZodOptional<z.ZodEnum<{
|
|
1992
|
-
bgm: "bgm";
|
|
1993
|
-
caption: "caption";
|
|
1994
|
-
speech: "speech";
|
|
1995
1788
|
video_clip: "video_clip";
|
|
1789
|
+
speech: "speech";
|
|
1790
|
+
caption: "caption";
|
|
1791
|
+
bgm: "bgm";
|
|
1996
1792
|
}>>;
|
|
1997
1793
|
is_hidden: z.ZodOptional<z.ZodBoolean>;
|
|
1998
1794
|
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -2047,7 +1843,7 @@ declare const videoDocumentSchema: z.ZodObject<{
|
|
|
2047
1843
|
id: z.ZodOptional<z.ZodString>;
|
|
2048
1844
|
kind: z.ZodLiteral<"caption">;
|
|
2049
1845
|
initial_duration_ms: z.ZodNumber;
|
|
2050
|
-
speech_part_id: z.ZodString
|
|
1846
|
+
speech_part_id: z.ZodOptional<z.ZodString>;
|
|
2051
1847
|
text: z.ZodString;
|
|
2052
1848
|
start_ms: z.ZodNumber;
|
|
2053
1849
|
style: z.ZodOptional<z.ZodObject<{
|
|
@@ -2074,4 +1870,4 @@ declare const videoDocumentSchema: z.ZodObject<{
|
|
|
2074
1870
|
}, z.core.$loose>]>>>;
|
|
2075
1871
|
}, z.core.$loose>;
|
|
2076
1872
|
//#endregion
|
|
2077
|
-
export {
|
|
1873
|
+
export { SpeechHostMap as $, assertValidVideoDocument as A, VideoDocumentValidationIssueCode as At, EntityRow as B, SpeedShift as Bt, isImplementedSemanticOpKind as C, Timeline as Ct, PartIdFactory as D, VideoClipPart as Dt, ValidationError as E, TrackItemTimePosition as Et, ResolvedEntityTrack as F, speedOf as Ft, SequenceDuration as G, CaptionSegmentSelection as H, Track$1 as Ht, resolveEntityTimelineLayout as I, Attachment as It, JsonObject as J, SequenceRange as K, projectEntityTimeline as L, CaptionPart$1 as Lt, EntityTimelineTrackRole as M, VideoDraftContent as Mt, ResolvedEntityClipPlacement as N, VideoDraftPartUnion as Nt, generatePartId as O, VideoDocument as Ot, ResolvedEntityTimelineLayout as P, effectiveVideoClipDurationMs as Pt, DerivedItemPosition as Q, EntityTimelineProjectionError as R, CaptionStyle as Rt, SemanticOpKind as S, SpeechPart as St, SnapshotReadable as T, TrackItem as Tt, CaptionStyleFields as U, TrackItem$1 as Ut, RelationRow as V, Timeline$1 as Vt, ScriptTextSegment as W, EntityId as X, JsonValue as Y, buildInitialVideoDocument as Z, SemanticOpName as _, CaptionDisplayCue as _t, PlainMemoryAdapter as a, LaneKind as at, ImplementedSemanticOpKind as b, PartKind as bt, MirrorVideoDocumentAdapter as c, findLaneTrack as ct, createMirrorVideoDocumentAdapter as d, TrackDraft as dt, buildSpeechHostMap as et, CommitOptions as f, TrackItemDraft as ft, SemanticOpInput as g, BgmPart as gt, SemanticEditor as h, videoDocumentMirrorSchema as ht, JournalEntry as i, LANE_KINDS_IN_STACK_ORDER as it, validateVideoDocument as j, VideoDraft as jt, VideoDocumentValidationError as k, VideoDocumentValidationIssue as kt, MirrorVideoDocumentOptions as l, laneTrackId as lt, SemanticDocumentAdapter as m, VideoDocumentMirrorSchema as mt, videoDocumentSchema as n, fromVideoDocument as nt, PlainMemoryAdapterOptions as o, SolvedVideoDocument as ot, OpActor as p, VideoDocumentDraft as pt, VoiceDescriptor as q, readVideoDocumentFromDraft as r, toVideoDocument as rt, createPlainMemoryAdapter as s, ensureLaneTrack as st, partUnionSchema as t, derivePositionFromAbs as tt, createMirrorVideoDocument as u, solveVideoDocument as ut, TransactAudit as v, CaptionPart as vt, SchemaValidator as w, Track as wt, PlannedSemanticOpKind as x, PartUnion as xt, IMPLEMENTED_SEMANTIC_OP_KINDS as y, DEFAULT_UNIT_TIME_MS as yt, EntityRelationRows as z, PartAggregation as zt };
|