@mengine/medeo-client 2.0.1-alpha.12 → 2.0.1-alpha.14

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.
@@ -4663,4 +4663,4 @@ function createPlainMemoryAdapter(document, options) {
4663
4663
  return new PlainMemoryAdapter(document, options);
4664
4664
  }
4665
4665
  //#endregion
4666
- export { findLaneTrack as $, assemblePhoneticScriptContent as A, isMediaAssetVariantKind as B, EntityProjectionGraph as C, ScriptCompositionError as D, decodeEntityRelationRows as E, variantBaseEntityIds as F, toVideoDocument as G, buildSpeechHostMap as H, isJsonObject as I, validateVideoDocument as J, VideoDocumentValidationError as K, createEntityId as L, findComposedAudioScript as M, selectAudioScriptSegment as N, assembleCaptionContent as O, updateEntityFields as P, ensureLaneTrack as Q, createRelationId as R, projectEntityTimeline as S, bytesToBase64 as St, EntityTimelineProjectionError as T, derivePositionFromAbs as U, buildInitialVideoDocument as V, fromVideoDocument as W, videoDocumentSchema as X, partUnionSchema as Y, LANE_KINDS_IN_STACK_ORDER as Z, audioScriptAssetOf as _, speedOf as _t, createMirrorVideoDocument as a, fillMainTrackTimeGaps as at, assertFieldChanges as b, videoDocumentMirrorSchema as bt, DocumentMutationGuard as c, resolveAllSpeechOverlaps as ct, LoroEntityDraft as d, TIMELINE_SKELETON_DURATION_MS as dt, hasResolvedPlacement as et, readEntityDocument as f, isEmptyVideoClip as ft, audioScriptAssetHash as g, effectiveVideoClipDurationMs as gt, audioScriptAssetFields as h, DEFAULT_UNIT_TIME_MS as ht, MirrorVideoDocumentAdapter as i, arrangeMainTrackSeamlessly as it, assembleScriptText as j, assembleEntityContent as k, LORO_ENTITY_SCHEMA as l, resolveSpeechOverlapByShiftingVideos as lt, audioScriptAssetContent as m, safeDurationMs as mt, createPlainMemoryAdapter as n, solveVideoDocument as nt, createMirrorVideoDocumentAdapter as o, reassignSpeechesToVideoClipsByTime as ot, entityOrderGroups as p, partDurationMs as pt, assertValidVideoDocument as q, generatePartId as r, cascadeAfterVideoClipChanges as rt, readVideoDocumentFromDraft as s, recalculateTimelineDuration as st, PlainMemoryAdapter as t, laneTrackId as tt, LoroEntityDocument as u, syncAggregatedClipsTimePosition as ut, equalJson as v, partUnionToDraft as vt, resolveEntityTimelineLayout as w, resolveFieldPath as x, base64ToBytes as xt, applyFieldChanges as y, recordEntries as yt, hasSequence as z };
4666
+ export { ensureLaneTrack as $, assembleEntityContent as A, hasSequence as B, projectEntityTimeline as C, bytesToBase64 as Ct, decodeEntityRelationRows as D, EntityTimelineProjectionError as E, updateEntityFields as F, fromVideoDocument as G, buildInitialVideoDocument as H, variantBaseEntityIds as I, assertValidVideoDocument as J, toVideoDocument as K, isJsonObject as L, assembleScriptText as M, findComposedAudioScript as N, ScriptCompositionError as O, selectAudioScriptSegment as P, LANE_KINDS_IN_STACK_ORDER as Q, createEntityId as R, resolveFieldPath as S, base64ToBytes as St, resolveEntityTimelineLayout as T, buildSpeechHostMap as U, isMediaAssetVariantKind as V, derivePositionFromAbs as W, partUnionSchema as X, validateVideoDocument as Y, videoDocumentSchema as Z, audioScriptAssetOf as _, effectiveVideoClipDurationMs as _t, createMirrorVideoDocument as a, arrangeMainTrackSeamlessly as at, applyFieldChanges as b, recordEntries as bt, DocumentMutationGuard as c, recalculateTimelineDuration as ct, LoroEntityDraft as d, syncAggregatedClipsTimePosition as dt, findLaneTrack as et, readEntityDocument as f, TIMELINE_SKELETON_DURATION_MS as ft, audioScriptAssetHash as g, DEFAULT_UNIT_TIME_MS as gt, audioScriptAssetFields as h, safeDurationMs as ht, MirrorVideoDocumentAdapter as i, cascadeAfterVideoClipChanges as it, assemblePhoneticScriptContent as j, assembleCaptionContent as k, LORO_ENTITY_SCHEMA as l, resolveAllSpeechOverlaps as lt, audioScriptAssetContent as m, partDurationMs as mt, createPlainMemoryAdapter as n, laneTrackId as nt, createMirrorVideoDocumentAdapter as o, fillMainTrackTimeGaps as ot, entityOrderGroups as p, isEmptyVideoClip as pt, VideoDocumentValidationError as q, generatePartId as r, solveVideoDocument as rt, readVideoDocumentFromDraft as s, reassignSpeechesToVideoClipsByTime as st, PlainMemoryAdapter as t, hasResolvedPlacement as tt, LoroEntityDocument as u, resolveSpeechOverlapByShiftingVideos as ut, canonicalJson as v, speedOf as vt, EntityProjectionGraph as w, assertFieldChanges as x, videoDocumentMirrorSchema as xt, equalJson as y, partUnionToDraft as yt, createRelationId as z };
package/dist/index.d.ts CHANGED
@@ -262,6 +262,167 @@ declare class EntityGraphHttpClient {
262
262
  private request;
263
263
  }
264
264
  //#endregion
265
+ //#region src/entity-crdt/field-changes.d.ts
266
+ /** List members are addressed by identity, never a transient array offset. */
267
+ type FieldPath = readonly (string | {
268
+ elementId: string;
269
+ })[];
270
+ type FieldChange = {
271
+ op: 'set';
272
+ path: FieldPath;
273
+ value: JsonValue;
274
+ } | {
275
+ op: 'unset';
276
+ path: FieldPath;
277
+ } | {
278
+ op: 'text.splice';
279
+ path: FieldPath;
280
+ index: number;
281
+ deleteCount: number;
282
+ text: string;
283
+ } | {
284
+ op: 'list.insert';
285
+ path: FieldPath;
286
+ value: JsonValue;
287
+ beforeElementId: string | null;
288
+ } | {
289
+ op: 'list.move';
290
+ path: FieldPath;
291
+ elementId: string;
292
+ beforeElementId: string | null;
293
+ } | {
294
+ op: 'list.remove';
295
+ path: FieldPath;
296
+ elementId: string;
297
+ };
298
+ declare function assertFieldChanges(changes: readonly FieldChange[]): void;
299
+ /** Resolve against the sequential causal view; the numeric path never crosses the API boundary. */
300
+ declare function resolveFieldPath(payload: JsonObject, path: FieldPath): (string | number)[];
301
+ /** Detached plan evaluation. Native compilation replays the original operations, not this snapshot. */
302
+ declare function applyFieldChanges(payload: JsonObject, changes: readonly FieldChange[]): JsonObject;
303
+ //#endregion
304
+ //#region src/entity-crdt/entity-document.d.ts
305
+ declare const LORO_ENTITY_SCHEMA = "medeo.entities.loro.v1";
306
+ interface EntityDocumentState {
307
+ readonly rows: EntityRelationRows;
308
+ readonly project: Readonly<Record<string, string>>;
309
+ }
310
+ type Command = {
311
+ type: 'create';
312
+ row: EntityRow;
313
+ } | {
314
+ type: 'selection-baseline';
315
+ root: string;
316
+ fingerprint: string;
317
+ } | {
318
+ type: 'order';
319
+ group: string;
320
+ roots: string[];
321
+ token: string;
322
+ } | {
323
+ type: 'write';
324
+ root: string;
325
+ payload: JsonObject;
326
+ token: string;
327
+ } | {
328
+ type: 'text';
329
+ root: string;
330
+ path: readonly (string | number)[];
331
+ start: number;
332
+ deleteCount: number;
333
+ text: string;
334
+ token: string;
335
+ } | {
336
+ type: 'field';
337
+ root: string;
338
+ path: (string | number)[];
339
+ change: FieldChange;
340
+ token: string;
341
+ } | {
342
+ type: 'relation-field';
343
+ root: string;
344
+ path: (string | number)[];
345
+ change: FieldChange;
346
+ } | {
347
+ type: 'delete';
348
+ root: string;
349
+ } | {
350
+ type: 'relation';
351
+ row: RelationRow;
352
+ } | {
353
+ type: 'relation-fields';
354
+ root: string;
355
+ metadata: JsonObject;
356
+ trace: JsonObject;
357
+ } | {
358
+ type: 'unlink';
359
+ root: string;
360
+ } | {
361
+ type: 'attach';
362
+ slot: string;
363
+ entityId: string;
364
+ };
365
+ /** Plain domain objects assembled from native Loro state, never a second writable authority. */
366
+ declare function readEntityDocument(doc: LoroDoc, allowSelectionConflicts?: boolean): EntityDocumentState;
367
+ /** Native editing containers survive domain version changes and merge independently. */
368
+ declare class LoroEntityDocument {
369
+ readonly doc: LoroDoc;
370
+ private readonly validate?;
371
+ private readonly undoManager;
372
+ constructor(doc: LoroDoc, validate?: ((state: EntityDocumentState) => void) | undefined);
373
+ /** Open a causal snapshot using the same Loro runtime as the compiler. */
374
+ static fromSnapshot(snapshot: Uint8Array, validate?: (state: EntityDocumentState) => void): LoroEntityDocument;
375
+ static create(rows: EntityRelationRows, project?: Readonly<Record<string, string>>, peerId?: PeerID): LoroEntityDocument;
376
+ snapshot(): EntityDocumentState;
377
+ relationsOf(entityId: string): readonly RelationRow[];
378
+ /** Resolve a queued edit target through its native identity without changing history. */
379
+ resolveCurrentEntityId(id: string): string;
380
+ getVersion(id: string): EntityRow | undefined;
381
+ /** The callback and every domain validation execute on a causally complete fork first. */
382
+ transact(edit: (draft: LoroEntityDraft) => void): Uint8Array;
383
+ /** Import preserves native operation identities; projection errors never discard remote operations. */
384
+ import(update: Uint8Array): void;
385
+ /**
386
+ * Bind a saved snapshot without rewriting text operations or resolving
387
+ * selection conflicts. The script names the bytes the same way everything
388
+ * else does — an Asset entity plus a `from-asset` Relation — and keeps only
389
+ * the fingerprint that tells a stale snapshot from a current one.
390
+ */
391
+ bindAudioScriptAsset(entityId: string, assetId: string, expectedContentHash: string): Uint8Array;
392
+ canUndo(): boolean;
393
+ canRedo(): boolean;
394
+ undo(): boolean;
395
+ redo(): boolean;
396
+ private historyEdit;
397
+ }
398
+ declare class LoroEntityDraft {
399
+ private readonly doc;
400
+ readonly commands: Command[];
401
+ private readonly selectedRoots;
402
+ private readonly relationAliases;
403
+ constructor(doc: LoroDoc);
404
+ snapshot(): EntityDocumentState;
405
+ order(groupId: string, entityIds: readonly string[]): void;
406
+ /** Project the final scalar placement intents onto the existing native ordering containers. */
407
+ reconcileOrder(rows: EntityRelationRows): void;
408
+ create(row: EntityRow): void;
409
+ delete(entityId: string): void;
410
+ attach(slot: string, entityId: string): void;
411
+ link(row: RelationRow): void;
412
+ patchRelation(relationId: string, metadata: JsonObject, trace: JsonObject): void;
413
+ unlink(relationId: string): void;
414
+ private relationRoot;
415
+ update(entityId: string, fields: JsonObject): void;
416
+ declare(entityId: string, fields: JsonObject): void;
417
+ replaceOwned(entityId: string, payload: JsonObject): void;
418
+ editText(entityId: string, path: readonly (string | number)[], start: number, deleteCount: number, text: string): void;
419
+ /** Generic assembled-field edit compiled at the author's causal position. */
420
+ change(entityId: string, changes: readonly FieldChange[]): void;
421
+ changeRelation(relationId: string, changes: readonly FieldChange[]): void;
422
+ captureSelectionBaselines(): void;
423
+ private record;
424
+ }
425
+ //#endregion
265
426
  //#region src/entity-editor/types.d.ts
266
427
  /** Injectable domain-id mint shared by Entity and Relation authoring surfaces. */
267
428
  type EntityTimelineIdFactory = (prefix: 'entity' | 'relation') => string;
@@ -298,6 +459,71 @@ interface VoiceoverMediaAssetFact {
298
459
  }
299
460
  /** Facts resolved from media storage. A trim window never substitutes for intrinsic duration. */
300
461
  type MediaAssetFact = ImageMediaAssetFact | VideoMediaAssetFact | AudioMediaAssetFact | VoiceoverMediaAssetFact;
462
+ /** Host-resolved ASR artifact. The SDK treats its storage fields as opaque facts. */
463
+ interface CaptionAssetFact {
464
+ readonly assetId: string;
465
+ readonly storageKey?: string;
466
+ }
467
+ interface AsrCaptionSegment extends ScriptTextSegment {
468
+ readonly startMs: number;
469
+ readonly endMs: number;
470
+ }
471
+ /** One closed host command for materializing an ASR result into the Entity graph. */
472
+ interface ApplyCaptionAssetsInput {
473
+ readonly effectId: string;
474
+ readonly timelineEntityId: string;
475
+ readonly trackEntityId: string;
476
+ readonly source: {
477
+ readonly entityId: string;
478
+ readonly entityKind: 'audio' | 'video';
479
+ };
480
+ /** The exact placed use whose source-relative ASR timing is being materialized. */
481
+ readonly sourceOccurrence: {
482
+ readonly clipEntityId: string;
483
+ readonly markerEntityId: string;
484
+ };
485
+ readonly captionAsset: CaptionAssetFact;
486
+ readonly segments: readonly AsrCaptionSegment[];
487
+ }
488
+ interface ApplyCaptionAssetsResult {
489
+ readonly audioScriptEntityId: string;
490
+ readonly audioScriptMarkerEntityId: string;
491
+ readonly captionAssetEntityId: string;
492
+ readonly captionEntityIds: readonly string[];
493
+ readonly captionClipEntityIds: readonly string[];
494
+ }
495
+ interface CaptionAssetsEffectEnvelope {
496
+ readonly version: 1;
497
+ readonly baselineFingerprint: string;
498
+ readonly effectId: string;
499
+ readonly signature: string;
500
+ readonly input: ApplyCaptionAssetsInput;
501
+ readonly decisions: {
502
+ readonly sourceOccurrence: {
503
+ readonly sourceStartMs: number;
504
+ readonly sourceEndMs: number;
505
+ readonly timelineStartMs: number;
506
+ readonly rate: number;
507
+ };
508
+ readonly targetRanges: readonly {
509
+ readonly segmentId: string;
510
+ readonly start: number;
511
+ readonly end: number;
512
+ }[];
513
+ readonly captionAsset: {
514
+ readonly mode: 'create' | 'reuse' | 'replace';
515
+ readonly priorAssetEntityId?: string;
516
+ readonly resultAssetEntityId: string;
517
+ readonly reboundRelationIds: readonly string[];
518
+ };
519
+ };
520
+ }
521
+ interface CompiledCaptionAssetsEffect {
522
+ readonly result: ApplyCaptionAssetsResult;
523
+ readonly replayed: boolean;
524
+ readonly update?: Uint8Array;
525
+ readonly rows: EntityRelationRows;
526
+ }
301
527
  type ClipPlacement = {
302
528
  readonly kind: 'sequential';
303
529
  readonly order: number;
@@ -430,6 +656,139 @@ interface SetClipSpeedInput {
430
656
  readonly clipEntityId: string;
431
657
  readonly timeRemapping: LinearClipSpeed | null;
432
658
  }
659
+ type VideoClipSpeedMode = '0.5x' | '0.75x' | '1.0x' | '1.5x' | '2.0x';
660
+ interface SetVideoClipSpeedEffectInput {
661
+ readonly clips: readonly {
662
+ readonly videoClipEntityId: string;
663
+ readonly mode: VideoClipSpeedMode;
664
+ }[];
665
+ }
666
+ interface GeneratedVisualClipFact {
667
+ readonly media: VisualMediaAssetFact;
668
+ /** Finite timeline use duration. Required for still images and bounded for video. */
669
+ readonly durationMs: number;
670
+ readonly generationJobId: string;
671
+ readonly sourceMediaEntityIds: readonly string[];
672
+ readonly volume?: number;
673
+ }
674
+ interface GeneratedVisualsInputBase {
675
+ readonly effectId: string;
676
+ readonly timelineEntityId: string;
677
+ readonly clips: readonly GeneratedVisualClipFact[];
678
+ }
679
+ /** Exactly one explicit occurrence anchor; the SDK never guesses a track edge. */
680
+ type AddGeneratedVisualsInput = GeneratedVisualsInputBase & ({
681
+ readonly beforeClipEntityId: string;
682
+ readonly afterClipEntityId?: never;
683
+ } | {
684
+ readonly beforeClipEntityId?: never;
685
+ readonly afterClipEntityId: string;
686
+ });
687
+ interface ContinueVideoInput {
688
+ readonly effectId: string;
689
+ readonly timelineEntityId: string;
690
+ readonly afterClipEntityId: string;
691
+ readonly tailFrameEntityId: string;
692
+ readonly sourceMediaEntityId: string;
693
+ readonly media: VideoMediaAssetFact;
694
+ }
695
+ interface GeneratedVisualEffectEnvelope {
696
+ readonly version: 1;
697
+ readonly baselineFingerprint: string;
698
+ readonly effectId: string;
699
+ readonly signature: string;
700
+ readonly input: AddGeneratedVisualsInput;
701
+ readonly decisions: {
702
+ readonly trackEntityId: string;
703
+ readonly anchorOrder: number;
704
+ readonly anchorPosition: 'before' | 'after';
705
+ readonly insertionOrders: readonly number[];
706
+ };
707
+ }
708
+ interface GeneratedVisualEffectResult {
709
+ readonly clipEntityIds: readonly string[];
710
+ readonly mediaEntityIds: readonly string[];
711
+ }
712
+ interface CompiledGeneratedVisualEffect {
713
+ readonly result: GeneratedVisualEffectResult;
714
+ readonly replayed: boolean;
715
+ readonly update?: Uint8Array;
716
+ readonly rows: EntityRelationRows;
717
+ }
718
+ interface GeneratedSpeechCaptionFact {
719
+ readonly startMs: number;
720
+ readonly endMs: number;
721
+ readonly selection: CaptionSegmentSelection;
722
+ }
723
+ /** Host-resolved current Loro segment; arbitrary immutable JSON fields remain owned by the script. */
724
+ type ResolvedSpeechScriptSegment = ScriptTextSegment & JsonObject;
725
+ type ResolvedAsrSpeechSegment = AsrCaptionSegment & JsonObject;
726
+ type GeneratedSpeechSourceFact = {
727
+ readonly kind: 'phonetic-script';
728
+ readonly audioScriptEntityId: string;
729
+ readonly phoneticScriptEntityId: string;
730
+ readonly segments: readonly ResolvedSpeechScriptSegment[];
731
+ readonly phonemeScript?: string;
732
+ } | {
733
+ readonly kind: 'audio-script';
734
+ readonly audioScriptEntityId?: string;
735
+ readonly segments: readonly ResolvedAsrSpeechSegment[];
736
+ readonly sourceMediaEntityIds: readonly string[];
737
+ readonly sourceStartMs: number;
738
+ };
739
+ interface GeneratedSpeechFact {
740
+ readonly media: VoiceoverMediaAssetFact;
741
+ readonly source: GeneratedSpeechSourceFact;
742
+ readonly captions: readonly GeneratedSpeechCaptionFact[];
743
+ readonly volume?: number;
744
+ }
745
+ interface AddSpeechAssetsInput {
746
+ readonly effectId: string;
747
+ readonly timelineEntityId: string;
748
+ readonly items: readonly (GeneratedSpeechFact & {
749
+ readonly placementStartMs: number;
750
+ })[];
751
+ }
752
+ interface ReplaceVoiceSpeechAssetsInput {
753
+ readonly effectId: string;
754
+ readonly timelineEntityId: string;
755
+ readonly items: readonly (GeneratedSpeechFact & {
756
+ readonly targetSpeechClipEntityId: string; /** Explicit current Caption uses replaced with this selected speech use. */
757
+ readonly targetCaptionClipEntityIds: readonly string[];
758
+ })[];
759
+ }
760
+ type SpeechAssetsEffectInput = {
761
+ readonly mode: 'add';
762
+ readonly value: AddSpeechAssetsInput;
763
+ } | {
764
+ readonly mode: 'replace-voice';
765
+ readonly value: ReplaceVoiceSpeechAssetsInput;
766
+ };
767
+ interface SpeechAssetsEffectEnvelope {
768
+ readonly version: 1;
769
+ readonly baselineFingerprint: string;
770
+ readonly effectId: string;
771
+ readonly signature: string;
772
+ readonly input: SpeechAssetsEffectInput;
773
+ readonly decisions: {
774
+ readonly speechTrackEntityId: string;
775
+ readonly captionTrackEntityId?: string;
776
+ readonly targetStartsMs: readonly number[];
777
+ };
778
+ }
779
+ interface SpeechAssetsEffectResult {
780
+ readonly speechClipEntityIds: readonly string[];
781
+ readonly speechAudioEntityIds: readonly string[];
782
+ readonly audioScriptEntityIds: readonly string[];
783
+ readonly phoneticScriptEntityIds: readonly string[];
784
+ readonly captionClipEntityIds: readonly (readonly string[])[];
785
+ }
786
+ interface CompiledSpeechAssetsEffect {
787
+ readonly result: SpeechAssetsEffectResult;
788
+ readonly replayed: boolean;
789
+ readonly update?: Uint8Array;
790
+ readonly rows: EntityRelationRows;
791
+ }
433
792
  interface TrimClipInput {
434
793
  readonly clipEntityId: string;
435
794
  readonly sourceRange: SequenceRange<number>;
@@ -535,6 +894,7 @@ type ClipEntityId = EntityId;
535
894
  * and committed only after validation succeeds.
536
895
  */
537
896
  declare class EntityTimelineEditor {
897
+ #private;
538
898
  private readonly idFactory;
539
899
  private state;
540
900
  constructor(initialRows: EntityRelationRows, idFactory?: EntityTimelineIdFactory);
@@ -552,6 +912,9 @@ declare class EntityTimelineEditor {
552
912
  replaceMediaClip(input: ReplaceMediaClipInput): void;
553
913
  setClipVolume(input: SetClipVolumeInput): void;
554
914
  setClipSpeed(input: SetClipSpeedInput): void;
915
+ /** Apply one typed Director speed effect as a single graph transaction. */
916
+ setVideoClipSpeeds(input: SetVideoClipSpeedEffectInput): void;
917
+ private setClipSpeedIntoDraft;
555
918
  trimClip(input: TrimClipInput): void;
556
919
  replaceSequentialClips(input: ReplaceSequentialClipsInput): readonly ClipEntityId[];
557
920
  deleteClip(input: DeleteClipInput): void;
@@ -572,6 +935,9 @@ declare class EntityTimelineEditor {
572
935
  * never the Caption entity or the AudioScript.
573
936
  */
574
937
  insertCaptionClip(input: InsertCaptionClipInput): ClipEntityId;
938
+ static compileCaptionAssetsEffect(base: LoroEntityDocument, envelope: CaptionAssetsEffectEnvelope): CompiledCaptionAssetsEffect;
939
+ static compileGeneratedVisualEffect(base: LoroEntityDocument, envelope: GeneratedVisualEffectEnvelope): CompiledGeneratedVisualEffect;
940
+ static compileSpeechAssetsEffect(base: LoroEntityDocument, envelope: SpeechAssetsEffectEnvelope): CompiledSpeechAssetsEffect;
575
941
  private insertPlacedClipIntoDraft;
576
942
  private ensureRoleTrack;
577
943
  /** The existing pronunciation variant a voiceover consumes; composition is required. */
@@ -600,6 +966,21 @@ declare class EntityTimelineEditor {
600
966
  private relinkRelation;
601
967
  private mintRelationId;
602
968
  }
969
+ /** Freeze every state-dependent choice once in the sole FE tool-effect handler. */
970
+ declare function prepareCaptionAssetsEffect(base: LoroEntityDocument, rawInput: ApplyCaptionAssetsInput): CaptionAssetsEffectEnvelope;
971
+ /**
972
+ * Compile only a frozen envelope on its exact causal baseline. Collaborators
973
+ * receive the resulting Loro update, never the raw effect.
974
+ */
975
+ declare function compileCaptionAssetsEffect(base: LoroEntityDocument, envelope: CaptionAssetsEffectEnvelope): CompiledCaptionAssetsEffect;
976
+ /** Freeze the explicit insertion anchor and lineage on one causal baseline. */
977
+ declare function prepareGeneratedVisualEffect(base: LoroEntityDocument, rawInput: AddGeneratedVisualsInput): GeneratedVisualEffectEnvelope;
978
+ declare function prepareContinueVideoEffect(base: LoroEntityDocument, input: ContinueVideoInput): GeneratedVisualEffectEnvelope;
979
+ /** Compile once at the FE authority; retain the returned update bytes for retry and collaborators. */
980
+ declare function compileGeneratedVisualEffect(base: LoroEntityDocument, envelope: GeneratedVisualEffectEnvelope): CompiledGeneratedVisualEffect;
981
+ declare function prepareSpeechAssetsEffect(base: LoroEntityDocument, rawInput: SpeechAssetsEffectInput): SpeechAssetsEffectEnvelope;
982
+ /** Compile once at the FE authority; retain the returned update bytes for retry and collaborators. */
983
+ declare function compileSpeechAssetsEffect(base: LoroEntityDocument, envelope: SpeechAssetsEffectEnvelope): CompiledSpeechAssetsEffect;
603
984
  //#endregion
604
985
  //#region src/entity-editor/editor-resources.d.ts
605
986
  declare const roleOrder: {
@@ -652,6 +1033,12 @@ interface ImportedMediaAsset {
652
1033
  /** The timbre identity of a synthesized voiceover; absent for recorded media. */
653
1034
  readonly voiceEntityId?: string;
654
1035
  }
1036
+ interface ImportedCaptionAsset {
1037
+ readonly rows: EntityRelationRows;
1038
+ readonly assetEntityId: string;
1039
+ }
1040
+ /** Import only the fixed ASR artifact; Caption entities are authored separately. */
1041
+ declare function importCaptionAsset(initial: EntityRelationRows, fact: CaptionAssetFact, idFactory?: EntityTimelineIdFactory): ImportedCaptionAsset;
655
1042
  /**
656
1043
  * Import at the editor boundary, not at asset generation time. Existing
657
1044
  * provenance is retained.
@@ -694,167 +1081,6 @@ interface DocumentAudioScriptState {
694
1081
  /** Read only the attached version and preserve every segment; never aggregate other scripts. */
695
1082
  declare function readDocumentAudioScript(state: DocumentAudioScriptState): DocumentAudioScript;
696
1083
  //#endregion
697
- //#region src/entity-crdt/field-changes.d.ts
698
- /** List members are addressed by identity, never a transient array offset. */
699
- type FieldPath = readonly (string | {
700
- elementId: string;
701
- })[];
702
- type FieldChange = {
703
- op: 'set';
704
- path: FieldPath;
705
- value: JsonValue;
706
- } | {
707
- op: 'unset';
708
- path: FieldPath;
709
- } | {
710
- op: 'text.splice';
711
- path: FieldPath;
712
- index: number;
713
- deleteCount: number;
714
- text: string;
715
- } | {
716
- op: 'list.insert';
717
- path: FieldPath;
718
- value: JsonValue;
719
- beforeElementId: string | null;
720
- } | {
721
- op: 'list.move';
722
- path: FieldPath;
723
- elementId: string;
724
- beforeElementId: string | null;
725
- } | {
726
- op: 'list.remove';
727
- path: FieldPath;
728
- elementId: string;
729
- };
730
- declare function assertFieldChanges(changes: readonly FieldChange[]): void;
731
- /** Resolve against the sequential causal view; the numeric path never crosses the API boundary. */
732
- declare function resolveFieldPath(payload: JsonObject, path: FieldPath): (string | number)[];
733
- /** Detached plan evaluation. Native compilation replays the original operations, not this snapshot. */
734
- declare function applyFieldChanges(payload: JsonObject, changes: readonly FieldChange[]): JsonObject;
735
- //#endregion
736
- //#region src/entity-crdt/entity-document.d.ts
737
- declare const LORO_ENTITY_SCHEMA = "medeo.entities.loro.v1";
738
- interface EntityDocumentState {
739
- readonly rows: EntityRelationRows;
740
- readonly project: Readonly<Record<string, string>>;
741
- }
742
- type Command = {
743
- type: 'create';
744
- row: EntityRow;
745
- } | {
746
- type: 'selection-baseline';
747
- root: string;
748
- fingerprint: string;
749
- } | {
750
- type: 'order';
751
- group: string;
752
- roots: string[];
753
- token: string;
754
- } | {
755
- type: 'write';
756
- root: string;
757
- payload: JsonObject;
758
- token: string;
759
- } | {
760
- type: 'text';
761
- root: string;
762
- path: readonly (string | number)[];
763
- start: number;
764
- deleteCount: number;
765
- text: string;
766
- token: string;
767
- } | {
768
- type: 'field';
769
- root: string;
770
- path: (string | number)[];
771
- change: FieldChange;
772
- token: string;
773
- } | {
774
- type: 'relation-field';
775
- root: string;
776
- path: (string | number)[];
777
- change: FieldChange;
778
- } | {
779
- type: 'delete';
780
- root: string;
781
- } | {
782
- type: 'relation';
783
- row: RelationRow;
784
- } | {
785
- type: 'relation-fields';
786
- root: string;
787
- metadata: JsonObject;
788
- trace: JsonObject;
789
- } | {
790
- type: 'unlink';
791
- root: string;
792
- } | {
793
- type: 'attach';
794
- slot: string;
795
- entityId: string;
796
- };
797
- /** Plain domain objects assembled from native Loro state, never a second writable authority. */
798
- declare function readEntityDocument(doc: LoroDoc, allowSelectionConflicts?: boolean): EntityDocumentState;
799
- /** Native editing containers survive domain version changes and merge independently. */
800
- declare class LoroEntityDocument {
801
- readonly doc: LoroDoc;
802
- private readonly validate?;
803
- private readonly undoManager;
804
- constructor(doc: LoroDoc, validate?: ((state: EntityDocumentState) => void) | undefined);
805
- /** Open a causal snapshot using the same Loro runtime as the compiler. */
806
- static fromSnapshot(snapshot: Uint8Array, validate?: (state: EntityDocumentState) => void): LoroEntityDocument;
807
- static create(rows: EntityRelationRows, project?: Readonly<Record<string, string>>, peerId?: PeerID): LoroEntityDocument;
808
- snapshot(): EntityDocumentState;
809
- relationsOf(entityId: string): readonly RelationRow[];
810
- /** Resolve a queued edit target through its native identity without changing history. */
811
- resolveCurrentEntityId(id: string): string;
812
- getVersion(id: string): EntityRow | undefined;
813
- /** The callback and every domain validation execute on a causally complete fork first. */
814
- transact(edit: (draft: LoroEntityDraft) => void): Uint8Array;
815
- /** Import preserves native operation identities; projection errors never discard remote operations. */
816
- import(update: Uint8Array): void;
817
- /**
818
- * Bind a saved snapshot without rewriting text operations or resolving
819
- * selection conflicts. The script names the bytes the same way everything
820
- * else does — an Asset entity plus a `from-asset` Relation — and keeps only
821
- * the fingerprint that tells a stale snapshot from a current one.
822
- */
823
- bindAudioScriptAsset(entityId: string, assetId: string, expectedContentHash: string): Uint8Array;
824
- canUndo(): boolean;
825
- canRedo(): boolean;
826
- undo(): boolean;
827
- redo(): boolean;
828
- private historyEdit;
829
- }
830
- declare class LoroEntityDraft {
831
- private readonly doc;
832
- readonly commands: Command[];
833
- private readonly selectedRoots;
834
- private readonly relationAliases;
835
- constructor(doc: LoroDoc);
836
- snapshot(): EntityDocumentState;
837
- order(groupId: string, entityIds: readonly string[]): void;
838
- /** Project the final scalar placement intents onto the existing native ordering containers. */
839
- reconcileOrder(rows: EntityRelationRows): void;
840
- create(row: EntityRow): void;
841
- delete(entityId: string): void;
842
- attach(slot: string, entityId: string): void;
843
- link(row: RelationRow): void;
844
- patchRelation(relationId: string, metadata: JsonObject, trace: JsonObject): void;
845
- unlink(relationId: string): void;
846
- private relationRoot;
847
- update(entityId: string, fields: JsonObject): void;
848
- declare(entityId: string, fields: JsonObject): void;
849
- replaceOwned(entityId: string, payload: JsonObject): void;
850
- editText(entityId: string, path: readonly (string | number)[], start: number, deleteCount: number, text: string): void;
851
- /** Generic assembled-field edit compiled at the author's causal position. */
852
- change(entityId: string, changes: readonly FieldChange[]): void;
853
- changeRelation(relationId: string, changes: readonly FieldChange[]): void;
854
- captureSelectionBaselines(): void;
855
- private record;
856
- }
857
- //#endregion
858
1084
  //#region src/entity-crdt/compile-rows.d.ts
859
1085
  /** Lower a detached ordinary-object edit against its actual causal Loro baseline. */
860
1086
  declare function compileEntityRows(snapshot: Uint8Array, rows: EntityRelationRows, validate?: (state: EntityDocumentState) => void): {
@@ -1743,4 +1969,4 @@ declare function audioScriptAssetOf(rows: EntityRelationRows, entityId: string):
1743
1969
  /** Internal fingerprint prevents a resource from silently describing an older text revision. */
1744
1970
  declare function audioScriptAssetFields(payload: JsonObject): JsonObject;
1745
1971
  //#endregion
1746
- export { type Aggregation, type AssembledCaptionContent, type AssembledPhoneticScriptContent, type Attachment, type AudioMediaAssetFact, type BgmPart, type CaptionContentInput, type CaptionDisplayCue, type CaptionPart, type CaptionSegmentSelection, type CaptionStyle, type ClipEntityId, type ClipPlacement, type CommitOptions, DEFAULT_UNIT_TIME_MS, type DeleteBgmInput, type DeleteClipInput, type DeleteClipTreeInput, type DeleteVoiceoverInput, type DerivedItemPosition, type DocStorageLike, type DocVersionMark, type DocumentAudioScript, type DocumentAudioScriptState, type EditorFoundation, EntityDocumentState, type EntityGraphCommitOptions, EntityGraphHttpClient, type EntityGraphState, EntityTimelineEditor, type EntityTimelineIdFactory, EntityTimelineProjectionError, type EntityTimelineTrackRole, type FieldChange, type FieldPath, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImageMediaAssetFact, type ImplementedSemanticOpKind, type ImportedMediaAsset, type InsertCaptionClipInput, type InsertClipInput, type InsertMediaClipInput, type InsertMediaClipsInput, type InsertPlacedClipInput, type JournalEntry, LANE_KINDS_IN_STACK_ORDER, LORO_ENTITY_SCHEMA, type LaneKind, type LinearClipSpeed, LoroEntityDocument, LoroEntityDraft, type MainClipRange, type MakeEmptyPart, ManualSyncDoc, type ManualSyncDocOptions, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, type MediaAssetFact, type MediaClipInsertion, MemoryDocStorage, MengineAckFailedError, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocSyncState, type MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUndoState, type MengineUpdateMeta, MirrorVideoDocumentAdapter, type MirrorVideoDocumentOptions, type MoveClipInput, type MoveClipsToStartsInput, type MoveSequentialClipsInput, type MoveVoiceoverInput, type OpActor, type PartAggregation, type PartIdFactory, type PartKind, type PartUnion, type PatchCaptionStyleInput, PlainMemoryAdapter, type PlainMemoryAdapterOptions, type PlannedSemanticOpKind, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, type ReplaceClipContentInput, type ReplaceMediaClipInput, type ReplaceSequentialClipsInput, type ReplacementMediaClipInput, type ResolvedEntityClipPlacement, type ResolvedEntityTimelineLayout, type ResolvedEntityTrack, SchemaValidator, ScriptCompositionError, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, type SequentialClipAnchor, type SetBgmInput, type SetCaptionVisibilityInput, type SetClipPlacementInput, type SetClipSpeedInput, type SetClipVolumeInput, type SnapshotReadable, type SolvedVideoDocument, type SpeechHostMap, type SpeechPart, type SpeedShift, TIMELINE_SKELETON_DURATION_MS, type Timeline, type TimelineDoc, type TimelineItem, type Track, type TrackDraft, type TrackItem, type TrackItemDraft, type TrackItemTimePosition, type TransactAudit, type TrimClipInput, type UpdateClipInput, type UpdateClipMarkerInput, ValidationError, type VideoClipPart, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type VideoDraftContent, type VideoDraftPartUnion, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, type VideoMediaAssetFact, type VisualMediaAssetFact, type VoiceoverCaptionFact, type VoiceoverMediaAssetFact, type VoiceoverTakeInput, type VoiceoverTakeResult, type WaitForServerAckOptions, applyEntityRows, applyFieldChanges, arrangeMainTrackSeamlessly, assembleCaptionContent, assembleEntityContent, assemblePhoneticScriptContent, assembleScriptText, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertFieldChanges, assertMediaAssetWritePolicy, assertValidVideoDocument, audioScriptAssetContent, audioScriptAssetFields, audioScriptAssetHash, audioScriptAssetOf, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, compileEntityRows, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, findComposedAudioScript, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, importMediaAsset, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, migrateLegacyTimelineToEntities, partDurationMs, partUnionSchema, prepareCaptionContent, projectEntityTimeline, readDocumentAudioScript, readEntityDocument, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveFieldPath, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, selectAudioScriptSegment, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema };
1972
+ export { type AddGeneratedVisualsInput, type AddSpeechAssetsInput, type Aggregation, type ApplyCaptionAssetsInput, type ApplyCaptionAssetsResult, type AsrCaptionSegment, type AssembledCaptionContent, type AssembledPhoneticScriptContent, type Attachment, type AudioMediaAssetFact, type BgmPart, type CaptionAssetFact, type CaptionAssetsEffectEnvelope, type CaptionContentInput, type CaptionDisplayCue, type CaptionPart, type CaptionSegmentSelection, type CaptionStyle, type ClipEntityId, type ClipPlacement, type CommitOptions, type CompiledCaptionAssetsEffect, type CompiledGeneratedVisualEffect, type CompiledSpeechAssetsEffect, type ContinueVideoInput, DEFAULT_UNIT_TIME_MS, type DeleteBgmInput, type DeleteClipInput, type DeleteClipTreeInput, type DeleteVoiceoverInput, type DerivedItemPosition, type DocStorageLike, type DocVersionMark, type DocumentAudioScript, type DocumentAudioScriptState, type EditorFoundation, EntityDocumentState, type EntityGraphCommitOptions, EntityGraphHttpClient, type EntityGraphState, EntityTimelineEditor, type EntityTimelineIdFactory, EntityTimelineProjectionError, type EntityTimelineTrackRole, type FieldChange, type FieldPath, type GeneratedSpeechCaptionFact, type GeneratedSpeechFact, type GeneratedSpeechSourceFact, type GeneratedVisualClipFact, type GeneratedVisualEffectEnvelope, type GeneratedVisualEffectResult, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImageMediaAssetFact, type ImplementedSemanticOpKind, type ImportedCaptionAsset, type ImportedMediaAsset, type InsertCaptionClipInput, type InsertClipInput, type InsertMediaClipInput, type InsertMediaClipsInput, type InsertPlacedClipInput, type JournalEntry, LANE_KINDS_IN_STACK_ORDER, LORO_ENTITY_SCHEMA, type LaneKind, type LinearClipSpeed, LoroEntityDocument, LoroEntityDraft, type MainClipRange, type MakeEmptyPart, ManualSyncDoc, type ManualSyncDocOptions, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, type MediaAssetFact, type MediaClipInsertion, MemoryDocStorage, MengineAckFailedError, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocSyncState, type MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUndoState, type MengineUpdateMeta, MirrorVideoDocumentAdapter, type MirrorVideoDocumentOptions, type MoveClipInput, type MoveClipsToStartsInput, type MoveSequentialClipsInput, type MoveVoiceoverInput, type OpActor, type PartAggregation, type PartIdFactory, type PartKind, type PartUnion, type PatchCaptionStyleInput, PlainMemoryAdapter, type PlainMemoryAdapterOptions, type PlannedSemanticOpKind, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, type ReplaceClipContentInput, type ReplaceMediaClipInput, type ReplaceSequentialClipsInput, type ReplaceVoiceSpeechAssetsInput, type ReplacementMediaClipInput, type ResolvedAsrSpeechSegment, type ResolvedEntityClipPlacement, type ResolvedEntityTimelineLayout, type ResolvedEntityTrack, type ResolvedSpeechScriptSegment, SchemaValidator, ScriptCompositionError, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, type SequentialClipAnchor, type SetBgmInput, type SetCaptionVisibilityInput, type SetClipPlacementInput, type SetClipSpeedInput, type SetClipVolumeInput, type SetVideoClipSpeedEffectInput, type SnapshotReadable, type SolvedVideoDocument, type SpeechAssetsEffectEnvelope, type SpeechAssetsEffectInput, type SpeechAssetsEffectResult, type SpeechHostMap, type SpeechPart, type SpeedShift, TIMELINE_SKELETON_DURATION_MS, type Timeline, type TimelineDoc, type TimelineItem, type Track, type TrackDraft, type TrackItem, type TrackItemDraft, type TrackItemTimePosition, type TransactAudit, type TrimClipInput, type UpdateClipInput, type UpdateClipMarkerInput, ValidationError, type VideoClipPart, type VideoClipSpeedMode, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type VideoDraftContent, type VideoDraftPartUnion, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, type VideoMediaAssetFact, type VisualMediaAssetFact, type VoiceoverCaptionFact, type VoiceoverMediaAssetFact, type VoiceoverTakeInput, type VoiceoverTakeResult, type WaitForServerAckOptions, applyEntityRows, applyFieldChanges, arrangeMainTrackSeamlessly, assembleCaptionContent, assembleEntityContent, assemblePhoneticScriptContent, assembleScriptText, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertFieldChanges, assertMediaAssetWritePolicy, assertValidVideoDocument, audioScriptAssetContent, audioScriptAssetFields, audioScriptAssetHash, audioScriptAssetOf, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, compileCaptionAssetsEffect, compileEntityRows, compileGeneratedVisualEffect, compileSpeechAssetsEffect, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, findComposedAudioScript, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, importCaptionAsset, importMediaAsset, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, migrateLegacyTimelineToEntities, partDurationMs, partUnionSchema, prepareCaptionAssetsEffect, prepareCaptionContent, prepareContinueVideoEffect, prepareGeneratedVisualEffect, prepareSpeechAssetsEffect, projectEntityTimeline, readDocumentAudioScript, readEntityDocument, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveFieldPath, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, selectAudioScriptSegment, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema };