@mengine/medeo-client 1.3.1-alpha.0 → 1.3.1-alpha.2

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.
@@ -849,6 +849,13 @@ type RelationId = string & {
849
849
  readonly [relationIdBrand]: 'RelationId';
850
850
  };
851
851
  //#endregion
852
+ //#region ../medeo-dsl/src/json-values.d.ts
853
+ type JsonPrimitive = string | number | boolean | null;
854
+ type JsonValue = JsonPrimitive | JsonObject | readonly JsonValue[];
855
+ type JsonObject = {
856
+ readonly [key: string]: JsonValue;
857
+ };
858
+ //#endregion
852
859
  //#region ../medeo-dsl/src/entities.d.ts
853
860
  type KnownEntityKind = 'axvideo' | 'timeline' | 'track' | 'clip' | 'asset' | 'video' | 'audio' | 'voice' | 'image' | 'sequence-marker' | 'viewport' | 'audio-script' | 'phonetic-script' | 'caption';
854
861
  declare const extensionEntityKindBrand: unique symbol;
@@ -867,6 +874,11 @@ type SequenceDuration<Span = unknown> = {
867
874
  readonly mode: 'fixed';
868
875
  readonly value: Span;
869
876
  };
877
+ interface ScriptTextSegment {
878
+ readonly segmentId: string;
879
+ readonly text: string;
880
+ readonly language?: string;
881
+ }
870
882
  interface VoiceDescriptor {
871
883
  readonly system: 'voice-library';
872
884
  readonly key: string;
@@ -888,16 +900,31 @@ interface CaptionStyleFields {
888
900
  readonly positionX?: number;
889
901
  readonly positionY?: number;
890
902
  }
891
- //#endregion
892
- //#region ../medeo-dsl/src/json-values.d.ts
893
- type JsonPrimitive = string | number | boolean | null;
894
- type JsonValue = JsonPrimitive | JsonObject | readonly JsonValue[];
895
- type JsonObject = {
896
- readonly [key: string]: JsonValue;
903
+ /**
904
+ * Half-open `[start, end)` position window inside one Segment's text, counted
905
+ * in Unicode code points (not UTF-16 code units), so a boundary never splits a
906
+ * surrogate pair. Positions are non-negative safe integers with `start < end`;
907
+ * `end` must not exceed the Segment's code-point length.
908
+ */
909
+ interface CaptionTextRange extends JsonObject {
910
+ readonly start: number;
911
+ readonly end: number;
912
+ }
913
+ /**
914
+ * One ordered entry of the Caption's segment selection. `segmentId` quotes the
915
+ * composed AudioScript's own stable segment identity — a local id quoted by the
916
+ * variant, never a peer Entity reference. Text itself is never copied here;
917
+ * complete Caption content is assembled through its direct baseEntityIds.
918
+ * The optional `textRange` narrows one Segment to an intra-Segment sub-span
919
+ * (intra-segment re-segmentation); without it the whole Segment text is selected.
920
+ */
921
+ type CaptionSegmentSelection = JsonObject & {
922
+ readonly segmentId: string;
923
+ readonly textRange?: CaptionTextRange;
897
924
  };
898
925
  //#endregion
899
926
  //#region ../medeo-dsl/src/relations.d.ts
900
- type KnownRelationKind = 'timeline-track' | 'track-clip' | 'clip-marker' | 'marker-content' | 'axvideo-marker' | 'marker-timeline' | 'physical-asset' | 'generated' | 'phonetic-script-provenance' | 'caption-provenance' | 'caption-alignment' | 'clip-anchor' | 'audio-script-render' | 'audio-script-source' | 'audio-script-marker';
927
+ type KnownRelationKind = 'timeline-track' | 'track-clip' | 'clip-marker' | 'marker-content' | 'axvideo-marker' | 'marker-timeline' | 'physical-asset' | 'generated' | 'caption-alignment' | 'clip-anchor' | 'phonetic-script-render' | 'audio-script-source' | 'audio-script-marker';
901
928
  type RelationKind = KnownRelationKind | (string & {});
902
929
  type RelationTrace = JsonObject;
903
930
  /**
@@ -1655,10 +1682,10 @@ declare const videoDocumentSchema: z.ZodObject<{
1655
1682
  tracks: z.ZodOptional<z.ZodArray<z.ZodObject<{
1656
1683
  id: z.ZodOptional<z.ZodString>;
1657
1684
  parts_kind: z.ZodOptional<z.ZodEnum<{
1685
+ video_clip: "video_clip";
1658
1686
  speech: "speech";
1659
1687
  caption: "caption";
1660
1688
  bgm: "bgm";
1661
- video_clip: "video_clip";
1662
1689
  }>>;
1663
1690
  is_hidden: z.ZodOptional<z.ZodBoolean>;
1664
1691
  items: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1740,4 +1767,4 @@ declare const videoDocumentSchema: z.ZodObject<{
1740
1767
  }, z.core.$loose>]>>>;
1741
1768
  }, z.core.$loose>;
1742
1769
  //#endregion
1743
- export { VoiceDescriptor as $, generatePartId as A, Attachment as At, ResolvedEntityClipPlacement as B, PlannedSemanticOpKind as C, VideoDocumentSchemaVersion as Ct, SnapshotReadable as D, VideoDraftPartUnion as Dt, SchemaValidator as E, VideoDraft as Et, videoDocumentMirrorSchema as F, Timeline$1 as Ft, EntityTimelineProjectionError as G, ResolvedEntityTrack as H, VideoDocumentValidationError as I, Track$1 as It, JsonObject as J, EntityRelationRows as K, assertValidVideoDocument as L, TrackItem$1 as Lt, TrackItemDraft as M, CaptionStyle as Mt, VideoDocumentDraft as N, PartAggregation as Nt, ValidationError as O, effectiveVideoClipDurationMs as Ot, VideoDocumentMirrorSchema as P, SpeedShift as Pt, SequenceRange as Q, validateVideoDocument as R, ImplementedSemanticOpKind as S, VideoDocument as St, isImplementedSemanticOpKind as T, VideoDocumentValidationIssueCode as Tt, resolveEntityTimelineLayout as U, ResolvedEntityTimelineLayout as V, projectEntityTimeline as W, CaptionStyleFields as X, JsonValue as Y, SequenceDuration as Z, SemanticEditor as _, Track as _t, PlainMemoryAdapter as a, buildSpeechHostMap as at, TransactAudit as b, VIDEO_DOCUMENT_SCHEMA_VERSION as bt, MirrorVideoDocumentAdapter as c, toVideoDocument as ct, createMirrorVideoDocument as d, DEFAULT_UNIT_TIME_MS as dt, EntityId as et, createMirrorVideoDocumentAdapter as f, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION as ft, SemanticDocumentAdapter as g, Timeline as gt, OpActor as h, SpeechPart as ht, JournalEntry as i, SpeechHostMap as it, TrackDraft as j, CaptionPart$1 as jt, PartIdFactory as k, speedOf as kt, MirrorVideoDocumentOptions as l, BgmPart as lt, CommitOptions as m, PartUnion as mt, videoDocumentSchema as n, buildInitialVideoDocument as nt, PlainMemoryAdapterOptions as o, derivePositionFromAbs as ot, writeVideoDocumentToDraft as p, PartKind as pt, EntityRow as q, readVideoDocumentFromDraft as r, DerivedItemPosition as rt, createPlainMemoryAdapter as s, fromVideoDocument as st, partUnionSchema as t, InitialDocumentFacts as tt, applyEntityTimelineProjection as u, CaptionPart as ut, SemanticOpInput as v, TrackItem as vt, SemanticOpKind as w, VideoDocumentValidationIssue as wt, IMPLEMENTED_SEMANTIC_OP_KINDS as x, VideoClipPart as xt, SemanticOpName as y, TrackItemTimePosition as yt, EntityTimelineTrackRole as z };
1770
+ export { VoiceDescriptor as $, generatePartId as A, effectiveVideoClipDurationMs as At, ResolvedEntityClipPlacement as B, PlannedSemanticOpKind as C, VideoClipPart as Ct, SnapshotReadable as D, VideoDocumentValidationIssueCode as Dt, SchemaValidator as E, VideoDocumentValidationIssue as Et, videoDocumentMirrorSchema as F, PartAggregation as Ft, EntityTimelineProjectionError as G, ResolvedEntityTrack as H, VideoDocumentValidationError as I, SpeedShift as It, CaptionSegmentSelection as J, EntityRelationRows as K, assertValidVideoDocument as L, Timeline$1 as Lt, TrackItemDraft as M, Attachment as Mt, VideoDocumentDraft as N, CaptionPart$1 as Nt, ValidationError as O, VideoDraft as Ot, VideoDocumentMirrorSchema as P, CaptionStyle as Pt, SequenceRange as Q, validateVideoDocument as R, Track$1 as Rt, ImplementedSemanticOpKind as S, VIDEO_DOCUMENT_SCHEMA_VERSION as St, isImplementedSemanticOpKind as T, VideoDocumentSchemaVersion as Tt, resolveEntityTimelineLayout as U, ResolvedEntityTimelineLayout as V, projectEntityTimeline as W, ScriptTextSegment as X, CaptionStyleFields as Y, SequenceDuration as Z, SemanticEditor as _, SpeechPart as _t, PlainMemoryAdapter as a, DerivedItemPosition as at, TransactAudit as b, TrackItem as bt, MirrorVideoDocumentAdapter as c, derivePositionFromAbs as ct, createMirrorVideoDocument as d, BgmPart as dt, JsonObject as et, createMirrorVideoDocumentAdapter as f, CaptionPart as ft, SemanticDocumentAdapter as g, PartUnion as gt, OpActor as h, PartKind as ht, JournalEntry as i, buildInitialVideoDocument as it, TrackDraft as j, speedOf as jt, PartIdFactory as k, VideoDraftPartUnion as kt, MirrorVideoDocumentOptions as l, fromVideoDocument as lt, CommitOptions as m, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION as mt, videoDocumentSchema as n, EntityId as nt, PlainMemoryAdapterOptions as o, SpeechHostMap as ot, writeVideoDocumentToDraft as p, DEFAULT_UNIT_TIME_MS as pt, EntityRow as q, readVideoDocumentFromDraft as r, InitialDocumentFacts as rt, createPlainMemoryAdapter as s, buildSpeechHostMap as st, partUnionSchema as t, JsonValue as tt, applyEntityTimelineProjection as u, toVideoDocument as ut, SemanticOpInput as v, Timeline as vt, SemanticOpKind as w, VideoDocument as wt, IMPLEMENTED_SEMANTIC_OP_KINDS as x, TrackItemTimePosition as xt, SemanticOpName as y, Track as yt, EntityTimelineTrackRole as z, TrackItem$1 as zt };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as index_d_exports } from "./index-CMa6ZCtX.js";
2
- import { $ as VoiceDescriptor, A as generatePartId, At as Attachment, B as ResolvedEntityClipPlacement, C as PlannedSemanticOpKind, Ct as VideoDocumentSchemaVersion, D as SnapshotReadable, Dt as VideoDraftPartUnion, E as SchemaValidator, Et as VideoDraft, F as videoDocumentMirrorSchema, Ft as Timeline$1, G as EntityTimelineProjectionError, H as ResolvedEntityTrack, I as VideoDocumentValidationError, It as Track$1, J as JsonObject, K as EntityRelationRows, L as assertValidVideoDocument, Lt as TrackItem$1, M as TrackItemDraft, Mt as CaptionStyle, N as VideoDocumentDraft, Nt as PartAggregation, O as ValidationError, Ot as effectiveVideoClipDurationMs, P as VideoDocumentMirrorSchema, Pt as SpeedShift, Q as SequenceRange, R as validateVideoDocument, S as ImplementedSemanticOpKind, St as VideoDocument, T as isImplementedSemanticOpKind, Tt as VideoDocumentValidationIssueCode, U as resolveEntityTimelineLayout, V as ResolvedEntityTimelineLayout, W as projectEntityTimeline, X as CaptionStyleFields, Y as JsonValue, Z as SequenceDuration, _ as SemanticEditor, _t as Track, a as PlainMemoryAdapter, at as buildSpeechHostMap, b as TransactAudit, bt as VIDEO_DOCUMENT_SCHEMA_VERSION, c as MirrorVideoDocumentAdapter, ct as toVideoDocument, d as createMirrorVideoDocument, dt as DEFAULT_UNIT_TIME_MS, et as EntityId, f as createMirrorVideoDocumentAdapter, ft as ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, g as SemanticDocumentAdapter, gt as Timeline, h as OpActor, ht as SpeechPart, i as JournalEntry, it as SpeechHostMap, j as TrackDraft, jt as CaptionPart$1, k as PartIdFactory, kt as speedOf, l as MirrorVideoDocumentOptions, lt as BgmPart, m as CommitOptions, mt as PartUnion, n as videoDocumentSchema, nt as buildInitialVideoDocument, o as PlainMemoryAdapterOptions, ot as derivePositionFromAbs, p as writeVideoDocumentToDraft, pt as PartKind, q as EntityRow, r as readVideoDocumentFromDraft, rt as DerivedItemPosition, s as createPlainMemoryAdapter, st as fromVideoDocument, t as partUnionSchema, tt as InitialDocumentFacts, u as applyEntityTimelineProjection, ut as CaptionPart, v as SemanticOpInput, vt as TrackItem, w as SemanticOpKind, wt as VideoDocumentValidationIssue, x as IMPLEMENTED_SEMANTIC_OP_KINDS, xt as VideoClipPart, y as SemanticOpName, yt as TrackItemTimePosition, z as EntityTimelineTrackRole } from "./index-WxMNUbOa.js";
2
+ import { $ as VoiceDescriptor, A as generatePartId, At as effectiveVideoClipDurationMs, B as ResolvedEntityClipPlacement, C as PlannedSemanticOpKind, Ct as VideoClipPart, D as SnapshotReadable, Dt as VideoDocumentValidationIssueCode, E as SchemaValidator, Et as VideoDocumentValidationIssue, F as videoDocumentMirrorSchema, Ft as PartAggregation, G as EntityTimelineProjectionError, H as ResolvedEntityTrack, I as VideoDocumentValidationError, It as SpeedShift, J as CaptionSegmentSelection, K as EntityRelationRows, L as assertValidVideoDocument, Lt as Timeline$1, M as TrackItemDraft, Mt as Attachment, N as VideoDocumentDraft, Nt as CaptionPart$1, O as ValidationError, Ot as VideoDraft, P as VideoDocumentMirrorSchema, Pt as CaptionStyle, Q as SequenceRange, R as validateVideoDocument, Rt as Track$1, S as ImplementedSemanticOpKind, St as VIDEO_DOCUMENT_SCHEMA_VERSION, T as isImplementedSemanticOpKind, Tt as VideoDocumentSchemaVersion, U as resolveEntityTimelineLayout, V as ResolvedEntityTimelineLayout, W as projectEntityTimeline, X as ScriptTextSegment, Y as CaptionStyleFields, Z as SequenceDuration, _ as SemanticEditor, _t as SpeechPart, a as PlainMemoryAdapter, at as DerivedItemPosition, b as TransactAudit, bt as TrackItem, c as MirrorVideoDocumentAdapter, ct as derivePositionFromAbs, d as createMirrorVideoDocument, dt as BgmPart, et as JsonObject, f as createMirrorVideoDocumentAdapter, ft as CaptionPart, g as SemanticDocumentAdapter, gt as PartUnion, h as OpActor, ht as PartKind, i as JournalEntry, it as buildInitialVideoDocument, j as TrackDraft, jt as speedOf, k as PartIdFactory, kt as VideoDraftPartUnion, l as MirrorVideoDocumentOptions, lt as fromVideoDocument, m as CommitOptions, mt as ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, n as videoDocumentSchema, nt as EntityId, o as PlainMemoryAdapterOptions, ot as SpeechHostMap, p as writeVideoDocumentToDraft, pt as DEFAULT_UNIT_TIME_MS, q as EntityRow, r as readVideoDocumentFromDraft, rt as InitialDocumentFacts, s as createPlainMemoryAdapter, st as buildSpeechHostMap, t as partUnionSchema, tt as JsonValue, u as applyEntityTimelineProjection, ut as toVideoDocument, v as SemanticOpInput, vt as Timeline, w as SemanticOpKind, wt as VideoDocument, x as IMPLEMENTED_SEMANTIC_OP_KINDS, xt as TrackItemTimePosition, y as SemanticOpName, yt as Track, z as EntityTimelineTrackRole, zt as TrackItem$1 } from "./index-Dxxu0Mi1.js";
3
3
  import { PeerID } from "loro-crdt";
4
4
  import { DocState } from "@mengine/sync";
5
5
  import { BaseDocStorage, Connection, DocDiff, DocPushReceipt, DocSnapshotRecord, DocStorage, DocStorageOptions, DocUpdate, DocUpdateRecord } from "@mengine/storage";
@@ -178,6 +178,46 @@ interface MengineEventStreamOptions {
178
178
  }
179
179
  declare function readMengineEventStream(options: MengineEventStreamOptions): Promise<void>;
180
180
  //#endregion
181
+ //#region ../medeo-dsl/src/composition.d.ts
182
+ type ScriptCompositionIssueCode = 'field_conflict' | 'composition_cycle' | 'invalid_bases' | 'composition_missing' | 'composition_ambiguous' | 'composition_dangling' | 'unknown_segment' | 'empty_selection' | 'invalid_script' | 'invalid_selection';
183
+ /** Assembly fails explicitly when declared bases cannot provide valid, unambiguous content. */
184
+ declare class ScriptCompositionError extends Error {
185
+ readonly code: ScriptCompositionIssueCode;
186
+ readonly entityId: EntityId;
187
+ constructor(code: ScriptCompositionIssueCode, entityId: EntityId, message: string);
188
+ }
189
+ interface AssembledCaptionContent {
190
+ readonly caption: EntityRow<'caption'>;
191
+ readonly audioScript: EntityRow<'audio-script'>;
192
+ /** Selected AudioScript segments in Caption selection order. */
193
+ readonly segments: readonly ScriptTextSegment[];
194
+ /** Complete display text: the selected segments' text joined in order. */
195
+ readonly text: string;
196
+ }
197
+ interface AssembledPhoneticScriptContent {
198
+ readonly phoneticScript: EntityRow<'phonetic-script'>;
199
+ readonly audioScript: EntityRow<'audio-script'>;
200
+ /** All AudioScript segments in script order; the pronunciation variant never reorders text. */
201
+ readonly segments: readonly ScriptTextSegment[];
202
+ /** Complete base text owned by the AudioScript. */
203
+ readonly text: string;
204
+ }
205
+ /** Validate all base providers before applying explicit own fields; ordering cannot resolve ambiguity. */
206
+ declare function assembleEntityContent(rows: EntityRelationRows, entityId: EntityId): EntityRow;
207
+ /** Find the actual AudioScript text owner through direct variant bases. */
208
+ declare function findComposedAudioScript(rows: EntityRelationRows, variantEntityId: EntityId, variantKind: 'caption' | 'phonetic-script'): EntityRow<'audio-script'>;
209
+ /** Join the whole AudioScript text in segment order. */
210
+ declare function assembleScriptText(script: EntityRow<'audio-script'>): string;
211
+ /** Assemble selected text after base-field validation and explicit variant overrides. */
212
+ declare function assembleCaptionContent(rows: EntityRelationRows, captionEntityId: EntityId): AssembledCaptionContent;
213
+ /**
214
+ * Assemble the complete Phonetic Script content for TTS: the composed
215
+ * AudioScript's base text plus the variant's own phoneme and prosody fields.
216
+ */
217
+ declare function assemblePhoneticScriptContent(rows: EntityRelationRows, phoneticScriptEntityId: EntityId): AssembledPhoneticScriptContent;
218
+ /** Select source text without creating another authoritative text field. */
219
+ declare function selectAudioScriptSegments(script: EntityRow<'audio-script'>, selections: readonly CaptionSegmentSelection[]): readonly ScriptTextSegment[];
220
+ //#endregion
181
221
  //#region src/entity-editor/entity-graph-http-client.d.ts
182
222
  /** One authenticated revision of the authoritative Medeo Entity graph. */
183
223
  interface EntityGraphState {
@@ -288,7 +328,10 @@ interface DeleteClipTreeInput {
288
328
  interface VoiceoverCaptionFact {
289
329
  /** Stable placed caption identity supplied by the materialized side effect. */
290
330
  readonly captionClipEntityId: string;
291
- readonly text: string;
331
+ /** Directly held bases; includes the AudioScript used by the Voice. */
332
+ readonly baseEntityIds: readonly string[];
333
+ /** Ordered selection of AudioScript segments; caption text is never passed inline. */
334
+ readonly selections: readonly CaptionSegmentSelection[];
292
335
  readonly startMs: number;
293
336
  readonly durationMs: number;
294
337
  readonly style?: CaptionStyleFields;
@@ -296,8 +339,8 @@ interface VoiceoverCaptionFact {
296
339
  type VoiceoverTakeInput = {
297
340
  readonly timelineEntityId: string; /** Stable placed speech identity, distinct from media.assetId. */
298
341
  readonly voiceoverClipEntityId: string;
299
- readonly media: VoiceMediaAssetFact; /** Complete spoken text; the editor owns the deterministic local script segment identity. */
300
- readonly scriptText: string;
342
+ readonly media: VoiceMediaAssetFact; /** Existing pronunciation variant; its composed AudioScript stays the text owner. */
343
+ readonly phoneticScriptEntityId: string;
301
344
  readonly volume: number;
302
345
  readonly captions: readonly VoiceoverCaptionFact[];
303
346
  } & ({
@@ -373,6 +416,9 @@ interface TrimClipInput {
373
416
  interface VoiceoverTakeResult {
374
417
  readonly voiceoverClipEntityId: string;
375
418
  readonly voiceEntityId: string;
419
+ /** The pronunciation variant the Voice was rendered from. */
420
+ readonly phoneticScriptEntityId: string;
421
+ /** The base-text owner resolved from the PhoneticScript baseEntityIds. */
376
422
  readonly audioScriptEntityId: string;
377
423
  readonly captionClipEntityIds: readonly string[];
378
424
  }
@@ -405,7 +451,10 @@ interface InsertCaptionClipInput {
405
451
  readonly timelineEntityId: string;
406
452
  /** Stable placed caption identity, distinct from the Caption content identity. */
407
453
  readonly captionClipEntityId?: string;
408
- readonly text: string;
454
+ /** Existing bases composed by this variant; includes an AudioScript text owner. */
455
+ readonly baseEntityIds: readonly string[];
456
+ /** Ordered selection of the AudioScript segments this Caption displays. */
457
+ readonly selections: readonly CaptionSegmentSelection[];
409
458
  /** Intrinsic cue length of the Caption entity itself; display comes from the placement. */
410
459
  readonly durationMs: number;
411
460
  readonly style?: CaptionStyleFields;
@@ -490,18 +539,26 @@ declare class EntityTimelineEditor {
490
539
  setCaptionVisibility(input: SetCaptionVisibilityInput): void;
491
540
  patchCaptionStyle(input: PatchCaptionStyleInput): void;
492
541
  /**
493
- * Place an independent Caption: its own content entity, inline text Asset,
494
- * and Clip with a display Marker. No Voice, provenance, or alignment is
495
- * required — the placement describes only this use. Moving or stretching
496
- * the returned Clip later changes the Clip/Marker, never the Caption entity.
542
+ * Place a Caption as a composed variant of an existing AudioScript: the
543
+ * entity stores baseEntityIds, selection, optional style, and inherent cue-bounded
544
+ * Sequence. This helper does not copy base text. The Clip and its display Marker describe this use;
545
+ * moving or stretching the returned Clip later changes the Clip/Marker,
546
+ * never the Caption entity or the AudioScript.
497
547
  */
498
548
  insertCaptionClip(input: InsertCaptionClipInput): ClipEntityId;
499
549
  private insertPlacedClipIntoDraft;
500
550
  private ensureRoleTrack;
501
- private ensureAudioScript;
551
+ /** The existing pronunciation variant a Voice consumes; composition is required. */
552
+ private requireComposedPhoneticScript;
553
+ /** Preserve the factual synthesis input, regardless of persisted endpoint positions. */
554
+ private ensurePhoneticRender;
502
555
  private reconcileVoiceoverCaptions;
503
556
  private ensureRoleTrackForClip;
504
- private replaceCaptionSemanticRelations;
557
+ private replaceCaptionAlignment;
558
+ /**
559
+ * Remove one placed Caption use. The composed AudioScript outlives the
560
+ * caption: it may anchor further captions and remains the text owner.
561
+ */
505
562
  private removeCaptionClipGraph;
506
563
  private replaceAnchorHost;
507
564
  /** Rebuild the legacy edit baseline from current visual order before a high-level cascade. */
@@ -538,8 +595,7 @@ interface EditorFoundation {
538
595
  * Image/Video/Audio/Voice Entity must carry its own external locator, every
539
596
  * external asset id has exactly one claimant, and no media variant may be
540
597
  * bound through a legacy `physical-asset` Relation. Dual-entity media graphs
541
- * are rejected, not migrated. Caption inline text keeps its inline Asset and
542
- * `physical-asset` binding.
598
+ * are rejected, not migrated. Caption composes AudioScript text and has no physical text Asset.
543
599
  */
544
600
  declare function assertCanonicalEditorResources(rows: EntityRelationRows): void;
545
601
  /**
@@ -550,8 +606,7 @@ declare function assertCanonicalEditorResources(rows: EntityRelationRows): void;
550
606
  *
551
607
  * 1. every Image/Video/Audio/Voice Entity carries its own Asset `external`
552
608
  * identity;
553
- * 2. no `physical-asset` Relation may bind a media variant (Caption inline
554
- * text keeps its inline Asset and binding);
609
+ * 2. no `physical-asset` Relation may bind a media variant or Caption;
555
610
  * 3. a self-carried media identity is immutable — it cannot be rewritten to
556
611
  * another asset id.
557
612
  *
@@ -587,6 +642,17 @@ declare function migrateLegacyTimelineToEntities(legacy: VideoDocument, assetFac
587
642
  /** Server gate: a cutover may change representation, never the existing render facts. */
588
643
  declare function assertEntityProjectionPreservesLegacy(legacy: VideoDocument, projection: VideoDocument, rows: EntityRelationRows): void;
589
644
  //#endregion
645
+ //#region src/entity-editor/caption-content.d.ts
646
+ interface CaptionContentInput {
647
+ readonly contentEntityId: string;
648
+ readonly audioScriptEntityId: string;
649
+ readonly text: string;
650
+ readonly selections?: readonly CaptionSegmentSelection[];
651
+ readonly durationMs: number;
652
+ }
653
+ /** Author Caption content from semantic intent; callers never reconcile variant bases or assembled fields. */
654
+ declare function prepareCaptionContent(rows: EntityRelationRows, input: CaptionContentInput): EntityRow<'caption'>;
655
+ //#endregion
590
656
  //#region src/editor/journal.d.ts
591
657
  /**
592
658
  * Wire a plain-memory adapter + editor that share a recording id factory, so
@@ -1491,4 +1557,4 @@ declare function hostForAbsMs(ranges: MainClipRange[], absMs: number): MainClipR
1491
1557
  */
1492
1558
  declare function relativePositionForAbs(ranges: MainClipRange[], absMs: number): TrackItemTimePosition;
1493
1559
  //#endregion
1494
- export { type Aggregation, type Attachment, type AudioMediaAssetFact, type BgmPart, type CaptionPart, 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, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, type EditorFoundation, type EntityGraphCommitOptions, EntityGraphHttpClient, type EntityGraphState, EntityTimelineEditor, type EntityTimelineIdFactory, EntityTimelineProjectionError, type EntityTimelineTrackRole, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImageMediaAssetFact, type ImplementedSemanticOpKind, type ImportedMediaAsset, type InitialDocumentFacts, type InsertCaptionClipInput, type InsertClipInput, type InsertMediaClipInput, type InsertMediaClipsInput, type InsertPlacedClipInput, type JournalEntry, LANE_KINDS_IN_STACK_ORDER, type LaneKind, type LinearClipSpeed, 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 MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, 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, 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, VIDEO_DOCUMENT_SCHEMA_VERSION, ValidationError, type VideoClipPart, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, type VideoDocumentSchemaVersion, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type VideoDraftPartUnion, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, type VideoMediaAssetFact, type VisualMediaAssetFact, type VoiceMediaAssetFact, type VoiceoverCaptionFact, type VoiceoverTakeInput, type VoiceoverTakeResult, type WaitForServerAckOptions, applyEntityTimelineProjection, arrangeMainTrackSeamlessly, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertMediaAssetWritePolicy, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, importMediaAsset, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, migrateLegacyTimelineToEntities, partDurationMs, partUnionSchema, projectEntityTimeline, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema, writeVideoDocumentToDraft };
1560
+ export { type Aggregation, type AssembledCaptionContent, type AssembledPhoneticScriptContent, type Attachment, type AudioMediaAssetFact, type BgmPart, type CaptionContentInput, 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, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, type EditorFoundation, type EntityGraphCommitOptions, EntityGraphHttpClient, type EntityGraphState, EntityTimelineEditor, type EntityTimelineIdFactory, EntityTimelineProjectionError, type EntityTimelineTrackRole, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImageMediaAssetFact, type ImplementedSemanticOpKind, type ImportedMediaAsset, type InitialDocumentFacts, type InsertCaptionClipInput, type InsertClipInput, type InsertMediaClipInput, type InsertMediaClipsInput, type InsertPlacedClipInput, type JournalEntry, LANE_KINDS_IN_STACK_ORDER, type LaneKind, type LinearClipSpeed, 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 MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, 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, VIDEO_DOCUMENT_SCHEMA_VERSION, ValidationError, type VideoClipPart, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, type VideoDocumentSchemaVersion, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type VideoDraftPartUnion, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, type VideoMediaAssetFact, type VisualMediaAssetFact, type VoiceMediaAssetFact, type VoiceoverCaptionFact, type VoiceoverTakeInput, type VoiceoverTakeResult, type WaitForServerAckOptions, applyEntityTimelineProjection, arrangeMainTrackSeamlessly, assembleCaptionContent, assembleEntityContent, assemblePhoneticScriptContent, assembleScriptText, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertMediaAssetWritePolicy, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, 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, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, selectAudioScriptSegments, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema, writeVideoDocumentToDraft };