@mengine/medeo-client 2.0.1-alpha.23 → 2.0.1-alpha.25

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.
@@ -738,8 +738,6 @@ type VideoClipPart = Omit<VideoClipPart$1, 'duration_ms'>;
738
738
  type SpeechPart = Omit<SpeechPart$1, 'duration_ms'> & {
739
739
  media_duration_ms?: number | undefined;
740
740
  };
741
- /** Asset namespace exposed only by the legacy read view; never an authoritative Speech fact. */
742
- type SpeechOriginAssetSystem = 'memota' | 'memota-speech';
743
741
  /**
744
742
  * Authoritative caption part. The IDL `CaptionPart` carries `duration_ms` (the
745
743
  * effective display length, a derived read-view value); the authoritative store
@@ -888,8 +886,7 @@ type VideoDraftPartUnion = {
888
886
  } | {
889
887
  video_clip?: never;
890
888
  speech: SpeechPart & {
891
- duration_ms?: number; /** Absent only on historical drafts created before this read-view discriminator. */
892
- origin_asset_system?: SpeechOriginAssetSystem;
889
+ duration_ms?: number;
893
890
  };
894
891
  caption?: never;
895
892
  bgm?: never;
@@ -937,7 +934,6 @@ type VideoDraftContentPartUnion = {
937
934
  video_clip?: never;
938
935
  speech: SpeechPart & {
939
936
  duration_ms: number | undefined;
940
- origin_asset_system?: SpeechOriginAssetSystem;
941
937
  };
942
938
  caption?: never;
943
939
  bgm?: never;
@@ -1288,6 +1284,11 @@ declare function fromVideoDocument(document: VideoDocument, options?: SolveVideo
1288
1284
  */
1289
1285
  declare function buildInitialVideoDocument(): VideoDocument;
1290
1286
  //#endregion
1287
+ //#region ../medeo-dsl/src/sandbox.d.ts
1288
+ /** Kinds a script can author. */
1289
+ type EntityKind = 'timeline' | 'track' | 'clip' | 'sequence-marker' | 'video' | 'audio' | 'voiceover-recording' | 'image' | 'voice' | 'audio-script' | 'phonetic-script' | 'caption';
1290
+ type RelationKind = 'contain' | 'marker' | 'clip-anchor' | 'voice-timbre' | 'caption-alignment' | 'derived-from';
1291
+ //#endregion
1291
1292
  //#region ../medeo-dsl/src/ids.d.ts
1292
1293
  declare const entityIdBrand: unique symbol;
1293
1294
  declare const relationIdBrand: unique symbol;
@@ -1306,23 +1307,13 @@ type JsonObject = {
1306
1307
  };
1307
1308
  //#endregion
1308
1309
  //#region ../medeo-dsl/src/entities.d.ts
1309
- type KnownEntityKind = 'axvideo' | 'timeline' | 'track' | 'clip' | 'asset' | 'video' | 'audio' | 'voiceover' | 'voice' | 'image' | 'sequence-marker' | 'viewport' | 'audio-script' | 'phonetic-script' | 'caption';
1310
+ type StoredEntityKind = EntityKind | 'asset';
1310
1311
  declare const extensionEntityKindBrand: unique symbol;
1311
1312
  type ExtensionEntityKind = string & {
1312
1313
  readonly [extensionEntityKindBrand]: 'ExtensionEntityKind';
1313
1314
  };
1314
1315
  /** Extensions require explicit branding so removed or reserved domain kinds cannot reappear accidentally. */
1315
- type EntityKind = KnownEntityKind | ExtensionEntityKind;
1316
- interface SequenceRange<Point = unknown> {
1317
- readonly start: Point;
1318
- readonly end: Point;
1319
- }
1320
- type SequenceDuration<Span = unknown> = {
1321
- readonly mode: 'from-source';
1322
- } | {
1323
- readonly mode: 'fixed';
1324
- readonly value: Span;
1325
- };
1316
+ type AnyEntityKind = StoredEntityKind | ExtensionEntityKind;
1326
1317
  interface ScriptTextSegment {
1327
1318
  readonly segmentId: string;
1328
1319
  readonly text: string;
@@ -1373,8 +1364,8 @@ type CaptionSegmentSelection = JsonObject & {
1373
1364
  };
1374
1365
  //#endregion
1375
1366
  //#region ../medeo-dsl/src/relations.d.ts
1376
- type KnownRelationKind = 'timeline-track' | 'track-clip' | 'clip-marker' | 'marker-content' | 'axvideo-marker' | 'marker-timeline' | 'from-asset' | 'to-asset' | 'generated' | 'caption-alignment' | 'clip-anchor' | 'phonetic-script-render' | 'voice-timbre' | 'audio-script-source' | 'audio-script-marker';
1377
- type RelationKind = KnownRelationKind | (string & {});
1367
+ type StoredRelationKind = RelationKind | 'from-asset' | 'to-asset';
1368
+ type AnyRelationKind = StoredRelationKind | (string & {});
1378
1369
  type RelationTrace = JsonObject;
1379
1370
  /**
1380
1371
  * Authoritative persisted relation value.
@@ -1383,7 +1374,7 @@ type RelationTrace = JsonObject;
1383
1374
  * storage adapters must preserve the submitted positions; kinds whose
1384
1375
  * semantics are unordered simply do not interpret those positions.
1385
1376
  */
1386
- interface RelationRow<K extends RelationKind = RelationKind, Metadata extends JsonObject = JsonObject> {
1377
+ interface RelationRow<K extends AnyRelationKind = AnyRelationKind, Metadata extends JsonObject = JsonObject> {
1387
1378
  readonly relationId: RelationId;
1388
1379
  readonly endpoint0EntityId: EntityId;
1389
1380
  readonly endpoint1EntityId: EntityId;
@@ -1394,7 +1385,7 @@ interface RelationRow<K extends RelationKind = RelationKind, Metadata extends Js
1394
1385
  //#endregion
1395
1386
  //#region ../medeo-dsl/src/rows.d.ts
1396
1387
  /** One persisted first-class entity. Its owned fields live directly in payload. */
1397
- interface EntityRow<K extends EntityKind = EntityKind> {
1388
+ interface EntityRow<K extends AnyEntityKind = AnyEntityKind> {
1398
1389
  readonly entityId: EntityId;
1399
1390
  readonly entityKind: K;
1400
1391
  readonly payload: JsonObject;
@@ -1412,26 +1403,12 @@ declare class EntityTimelineProjectionError extends Error {
1412
1403
  }
1413
1404
  //#endregion
1414
1405
  //#region src/document/entity-projection.d.ts
1415
- type EntityTimelineProjectionPart = Exclude<PartUnion, {
1416
- speech: SpeechPart;
1417
- }> | {
1418
- video_clip?: never;
1419
- speech: SpeechPart & {
1420
- origin_asset_system: SpeechOriginAssetSystem;
1421
- };
1422
- caption?: never;
1423
- bgm?: never;
1424
- };
1425
- /** Ephemeral compatibility document; the origin discriminator is never stored in Loro. */
1426
- type EntityTimelineProjectionDocument = Omit<VideoDocument, 'part_library'> & {
1427
- part_library: Record<string, EntityTimelineProjectionPart>;
1428
- };
1429
1406
  /**
1430
1407
  * One-way compatibility view over the Entity graph. A legacy part is never
1431
1408
  * consulted as an editing fact. Peer IDs appear only in this derived read
1432
1409
  * contract, reconstructed from relations; they are not stored in payloads.
1433
1410
  */
1434
- declare function projectEntityTimeline(rows: EntityRelationRows): EntityTimelineProjectionDocument;
1411
+ declare function projectEntityTimeline(rows: EntityRelationRows): VideoDocument;
1435
1412
  //#endregion
1436
1413
  //#region src/document/entity-timeline-layout.d.ts
1437
1414
  type EntityTimelineTrackRole = 'video_clip' | 'speech' | 'caption' | 'bgm';
@@ -2153,4 +2130,4 @@ declare const videoDocumentSchema: z.ZodObject<{
2153
2130
  }, z.core.$loose>]>>>;
2154
2131
  }, z.core.$loose>;
2155
2132
  //#endregion
2156
- export { DerivedItemPosition as $, assertValidVideoDocument as A, VideoDocument as At, EntityRelationRows as B, CaptionStyle as Bt, isImplementedSemanticOpKind as C, SpeechOriginAssetSystem as Ct, PartIdFactory as D, TrackItem as Dt, ValidationError as E, Track as Et, ResolvedEntityTrack as F, VideoDraftPartUnion as Ft, ScriptTextSegment as G, TrackItem$1 as Gt, RelationRow as H, SpeedShift as Ht, resolveEntityTimelineLayout as I, effectiveVideoClipDurationMs as It, VoiceDescriptor as J, SequenceDuration as K, EntityTimelineProjectionDocument as L, speedOf as Lt, EntityTimelineTrackRole as M, VideoDocumentValidationIssueCode as Mt, ResolvedEntityClipPlacement as N, VideoDraft as Nt, generatePartId as O, TrackItemTimePosition as Ot, ResolvedEntityTimelineLayout as P, VideoDraftContent as Pt, buildInitialVideoDocument as Q, projectEntityTimeline as R, Attachment as Rt, SemanticOpKind as S, PartUnion as St, SnapshotReadable as T, Timeline as Tt, CaptionSegmentSelection as U, Timeline$1 as Ut, EntityRow as V, PartAggregation as Vt, CaptionStyleFields as W, Track$1 as Wt, JsonValue as X, JsonObject as Y, EntityId as Z, SemanticOpName as _, BgmPart as _t, PlainMemoryAdapter as a, LANE_KINDS_IN_STACK_ORDER as at, ImplementedSemanticOpKind as b, DEFAULT_UNIT_TIME_MS as bt, MirrorVideoDocumentAdapter as c, ensureLaneTrack as ct, createMirrorVideoDocumentAdapter as d, solveVideoDocument as dt, SpeechHostMap as et, CommitOptions as f, TrackDraft as ft, SemanticOpInput as g, videoDocumentMirrorSchema as gt, SemanticEditor as h, VideoDocumentMirrorSchema as ht, JournalEntry as i, toVideoDocument as it, validateVideoDocument as j, VideoDocumentValidationIssue as jt, VideoDocumentValidationError as k, VideoClipPart as kt, MirrorVideoDocumentOptions as l, findLaneTrack as lt, SemanticDocumentAdapter as m, VideoDocumentDraft as mt, videoDocumentSchema as n, derivePositionFromAbs as nt, PlainMemoryAdapterOptions as o, LaneKind as ot, OpActor as p, TrackItemDraft as pt, SequenceRange as q, readVideoDocumentFromDraft as r, fromVideoDocument as rt, createPlainMemoryAdapter as s, SolvedVideoDocument as st, partUnionSchema as t, buildSpeechHostMap as tt, createMirrorVideoDocument as u, laneTrackId as ut, TransactAudit as v, CaptionDisplayCue as vt, SchemaValidator as w, SpeechPart as wt, PlannedSemanticOpKind as x, PartKind as xt, IMPLEMENTED_SEMANTIC_OP_KINDS as y, CaptionPart as yt, EntityTimelineProjectionError as z, CaptionPart$1 as zt };
2133
+ export { derivePositionFromAbs as $, assertValidVideoDocument as A, VideoDraftContent as At, EntityRow as B, Track$1 as Bt, isImplementedSemanticOpKind as C, TrackItem as Ct, PartIdFactory as D, VideoDocumentValidationIssue as Dt, ValidationError as E, VideoDocument as Et, ResolvedEntityTrack as F, CaptionPart$1 as Ft, VoiceDescriptor as G, CaptionSegmentSelection as H, resolveEntityTimelineLayout as I, CaptionStyle as It, EntityId as J, JsonObject as K, projectEntityTimeline as L, PartAggregation as Lt, EntityTimelineTrackRole as M, effectiveVideoClipDurationMs as Mt, ResolvedEntityClipPlacement as N, speedOf as Nt, generatePartId as O, VideoDocumentValidationIssueCode as Ot, ResolvedEntityTimelineLayout as P, Attachment as Pt, buildSpeechHostMap as Q, EntityTimelineProjectionError as R, SpeedShift as Rt, SemanticOpKind as S, Track as St, SnapshotReadable as T, VideoClipPart as Tt, CaptionStyleFields as U, RelationRow as V, TrackItem$1 as Vt, ScriptTextSegment as W, DerivedItemPosition as X, buildInitialVideoDocument as Y, SpeechHostMap as Z, SemanticOpName as _, DEFAULT_UNIT_TIME_MS as _t, PlainMemoryAdapter as a, ensureLaneTrack as at, ImplementedSemanticOpKind as b, SpeechPart as bt, MirrorVideoDocumentAdapter as c, solveVideoDocument as ct, createMirrorVideoDocumentAdapter as d, VideoDocumentDraft as dt, fromVideoDocument as et, CommitOptions as f, VideoDocumentMirrorSchema as ft, SemanticOpInput as g, CaptionPart as gt, SemanticEditor as h, CaptionDisplayCue as ht, JournalEntry as i, SolvedVideoDocument as it, validateVideoDocument as j, VideoDraftPartUnion as jt, VideoDocumentValidationError as k, VideoDraft as kt, MirrorVideoDocumentOptions as l, TrackDraft as lt, SemanticDocumentAdapter as m, BgmPart as mt, videoDocumentSchema as n, LANE_KINDS_IN_STACK_ORDER as nt, PlainMemoryAdapterOptions as o, findLaneTrack as ot, OpActor as p, videoDocumentMirrorSchema as pt, JsonValue as q, readVideoDocumentFromDraft as r, LaneKind as rt, createPlainMemoryAdapter as s, laneTrackId as st, partUnionSchema as t, toVideoDocument as tt, createMirrorVideoDocument as u, TrackItemDraft as ut, TransactAudit as v, PartKind as vt, SchemaValidator as w, TrackItemTimePosition as wt, PlannedSemanticOpKind as x, Timeline as xt, IMPLEMENTED_SEMANTIC_OP_KINDS as y, PartUnion as yt, EntityRelationRows as z, Timeline$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 DerivedItemPosition, A as assertValidVideoDocument, At as VideoDocument, B as EntityRelationRows, Bt as CaptionStyle, C as isImplementedSemanticOpKind, Ct as SpeechOriginAssetSystem, D as PartIdFactory, Dt as TrackItem, E as ValidationError, Et as Track, F as ResolvedEntityTrack, Ft as VideoDraftPartUnion, G as ScriptTextSegment, Gt as TrackItem$1, H as RelationRow, Ht as SpeedShift, I as resolveEntityTimelineLayout, It as effectiveVideoClipDurationMs, J as VoiceDescriptor, K as SequenceDuration, L as EntityTimelineProjectionDocument, Lt as speedOf, M as EntityTimelineTrackRole, Mt as VideoDocumentValidationIssueCode, N as ResolvedEntityClipPlacement, Nt as VideoDraft, O as generatePartId, Ot as TrackItemTimePosition, P as ResolvedEntityTimelineLayout, Pt as VideoDraftContent, Q as buildInitialVideoDocument, R as projectEntityTimeline, Rt as Attachment, S as SemanticOpKind, St as PartUnion, T as SnapshotReadable, Tt as Timeline, U as CaptionSegmentSelection, Ut as Timeline$1, V as EntityRow, Vt as PartAggregation, W as CaptionStyleFields, Wt as Track$1, X as JsonValue, Y as JsonObject, Z as EntityId, _ as SemanticOpName, _t as BgmPart, a as PlainMemoryAdapter, at as LANE_KINDS_IN_STACK_ORDER, b as ImplementedSemanticOpKind, bt as DEFAULT_UNIT_TIME_MS, c as MirrorVideoDocumentAdapter, ct as ensureLaneTrack, d as createMirrorVideoDocumentAdapter, dt as solveVideoDocument, et as SpeechHostMap, f as CommitOptions, ft as TrackDraft, g as SemanticOpInput, gt as videoDocumentMirrorSchema, h as SemanticEditor, ht as VideoDocumentMirrorSchema, i as JournalEntry, it as toVideoDocument, j as validateVideoDocument, jt as VideoDocumentValidationIssue, k as VideoDocumentValidationError, kt as VideoClipPart, l as MirrorVideoDocumentOptions, lt as findLaneTrack, m as SemanticDocumentAdapter, mt as VideoDocumentDraft, n as videoDocumentSchema, nt as derivePositionFromAbs, o as PlainMemoryAdapterOptions, ot as LaneKind, p as OpActor, pt as TrackItemDraft, q as SequenceRange, r as readVideoDocumentFromDraft, rt as fromVideoDocument, s as createPlainMemoryAdapter, st as SolvedVideoDocument, t as partUnionSchema, tt as buildSpeechHostMap, u as createMirrorVideoDocument, ut as laneTrackId, v as TransactAudit, vt as CaptionDisplayCue, w as SchemaValidator, wt as SpeechPart, x as PlannedSemanticOpKind, xt as PartKind, y as IMPLEMENTED_SEMANTIC_OP_KINDS, yt as CaptionPart, z as EntityTimelineProjectionError, zt as CaptionPart$1 } from "./index-mGObzOh4.js";
2
+ import { $ as derivePositionFromAbs, A as assertValidVideoDocument, At as VideoDraftContent, B as EntityRow, Bt as Track$1, C as isImplementedSemanticOpKind, Ct as TrackItem, D as PartIdFactory, Dt as VideoDocumentValidationIssue, E as ValidationError, Et as VideoDocument, F as ResolvedEntityTrack, Ft as CaptionPart$1, G as VoiceDescriptor, H as CaptionSegmentSelection, I as resolveEntityTimelineLayout, It as CaptionStyle, J as EntityId, K as JsonObject, L as projectEntityTimeline, Lt as PartAggregation, M as EntityTimelineTrackRole, Mt as effectiveVideoClipDurationMs, N as ResolvedEntityClipPlacement, Nt as speedOf, O as generatePartId, Ot as VideoDocumentValidationIssueCode, P as ResolvedEntityTimelineLayout, Pt as Attachment, Q as buildSpeechHostMap, R as EntityTimelineProjectionError, Rt as SpeedShift, S as SemanticOpKind, St as Track, T as SnapshotReadable, Tt as VideoClipPart, U as CaptionStyleFields, V as RelationRow, Vt as TrackItem$1, W as ScriptTextSegment, X as DerivedItemPosition, Y as buildInitialVideoDocument, Z as SpeechHostMap, _ as SemanticOpName, _t as DEFAULT_UNIT_TIME_MS, a as PlainMemoryAdapter, at as ensureLaneTrack, b as ImplementedSemanticOpKind, bt as SpeechPart, c as MirrorVideoDocumentAdapter, ct as solveVideoDocument, d as createMirrorVideoDocumentAdapter, dt as VideoDocumentDraft, et as fromVideoDocument, f as CommitOptions, ft as VideoDocumentMirrorSchema, g as SemanticOpInput, gt as CaptionPart, h as SemanticEditor, ht as CaptionDisplayCue, i as JournalEntry, it as SolvedVideoDocument, j as validateVideoDocument, jt as VideoDraftPartUnion, k as VideoDocumentValidationError, kt as VideoDraft, l as MirrorVideoDocumentOptions, lt as TrackDraft, m as SemanticDocumentAdapter, mt as BgmPart, n as videoDocumentSchema, nt as LANE_KINDS_IN_STACK_ORDER, o as PlainMemoryAdapterOptions, ot as findLaneTrack, p as OpActor, pt as videoDocumentMirrorSchema, q as JsonValue, r as readVideoDocumentFromDraft, rt as LaneKind, s as createPlainMemoryAdapter, st as laneTrackId, t as partUnionSchema, tt as toVideoDocument, u as createMirrorVideoDocument, ut as TrackItemDraft, v as TransactAudit, vt as PartKind, w as SchemaValidator, wt as TrackItemTimePosition, x as PlannedSemanticOpKind, xt as Timeline, y as IMPLEMENTED_SEMANTIC_OP_KINDS, yt as PartUnion, z as EntityRelationRows, zt as Timeline$1 } from "./index-BYv9FPSS.js";
3
3
  import { LoroDoc, 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";
@@ -242,6 +242,19 @@ interface EntityGraphCommitOptions {
242
242
  /** Server version vector proving the explicit legacy-to-Entity migration baseline. */
243
243
  readonly migrationBaseVv?: string;
244
244
  }
245
+ interface EntityGraphRevisionConflictPayload {
246
+ readonly error: {
247
+ readonly code: 'revision_conflict';
248
+ readonly message: string;
249
+ readonly expected_revision: number;
250
+ readonly current_revision: number;
251
+ };
252
+ }
253
+ declare class EntityGraphRevisionConflictError extends MengineHttpRequestError {
254
+ readonly expectedRevision: number;
255
+ readonly currentRevision: number;
256
+ constructor(expectedRevision: number, currentRevision: number, payload: EntityGraphRevisionConflictPayload);
257
+ }
245
258
  /** Browser-safe authenticated Loro client for a document's Entity graph. */
246
259
  declare class EntityGraphHttpClient {
247
260
  private readonly options;
@@ -251,14 +264,16 @@ declare class EntityGraphHttpClient {
251
264
  fetchState(): Promise<EntityGraphState>;
252
265
  /**
253
266
  * Compile edits against the original causal snapshot and publish native Loro operations.
267
+ * The base revision is sent as an optimistic precondition, so a stale adoption
268
+ * fails loudly instead of letting Loro choose between concurrent selections.
254
269
  *
255
270
  * Deletion intent is derived from baseline IDs omitted from `nextRows`, so a
256
271
  * transient create-then-remove never becomes a request to delete unknown
257
272
  * persisted data.
258
273
  */
259
274
  commit(baseState: Pick<EntityGraphState, 'revision' | 'rows' | 'loroSnapshot'>, nextRows: EntityRelationRows, options?: EntityGraphCommitOptions): Promise<EntityGraphState>;
260
- /** Send the same prepared bytes on retry; never recompile an unconfirmed edit. */
261
- commitUpdate(update: string): Promise<EntityGraphState>;
275
+ /** Send prepared bytes directly; omit `expectedRevision` for immutable fact publication. */
276
+ commitUpdate(update: string, expectedRevision?: number): Promise<EntityGraphState>;
262
277
  private request;
263
278
  }
264
279
  //#endregion
@@ -282,16 +297,11 @@ interface AudioMediaAssetFact {
282
297
  readonly durationMs: number;
283
298
  readonly storageKey: string;
284
299
  }
285
- /**
286
- * Speech. It materializes as a `voiceover` entity — its own kind, because only
287
- * speech answers which words it said; `voice` names the timbre identity it was
288
- * synthesized with, which becomes its own Voice entity linked by a
289
- * `voice-timbre` Relation.
290
- */
300
+ /** A synthesized speech result. Uploaded recordings remain raw `audio`. */
291
301
  interface VoiceoverMediaAssetFact {
292
302
  /** Stable external speech result id, independent of the placed Clip id. */
293
303
  readonly assetId: string;
294
- readonly kind: 'voiceover';
304
+ readonly kind: 'voiceover-recording';
295
305
  readonly durationMs: number;
296
306
  readonly storageKey: string;
297
307
  /**
@@ -300,27 +310,28 @@ interface VoiceoverMediaAssetFact {
300
310
  * way a take that never names one is refused when a plan is built.
301
311
  */
302
312
  readonly phoneticScriptEntityId?: string;
303
- /** Present for synthesized speech, absent for original recorded audio. */
313
+ /** Timbre identity used for synthesis, when the caller has it. */
304
314
  readonly voice?: VoiceDescriptor;
305
315
  }
306
316
  /** Facts resolved from media storage. A trim window never substitutes for intrinsic duration. */
307
317
  type MediaAssetFact = ImageMediaAssetFact | VideoMediaAssetFact | AudioMediaAssetFact | VoiceoverMediaAssetFact;
318
+ /** Where a Clip starts: in flow by order, or at a stated start on its Track or inside its host. */
308
319
  type ClipPlacement = {
309
320
  readonly kind: 'sequential';
310
321
  readonly order: number;
311
322
  } | {
312
323
  readonly kind: 'absolute';
313
- readonly targetRange: SequenceRange<number>;
324
+ readonly startMs: number;
314
325
  } | {
315
326
  readonly kind: 'anchored';
316
327
  readonly hostClipEntityId: string;
317
- readonly anchorOffset: number;
328
+ readonly startMs: number;
318
329
  };
319
330
  interface InsertPlacedClipInput {
320
331
  readonly trackEntityId: string;
321
332
  readonly contentEntityId: string;
322
- readonly sourceRange: SequenceRange<number>;
323
- readonly duration: SequenceDuration<number>;
333
+ readonly inMs: number;
334
+ readonly outMs: number;
324
335
  readonly placement: ClipPlacement;
325
336
  readonly clipPayload?: JsonObject;
326
337
  /** Stable caller-owned placement identity, when one already exists outside the graph. */
@@ -374,31 +385,34 @@ type VoiceoverTakeInput = {
374
385
  } & ({
375
386
  readonly placement: ClipPlacement;
376
387
  readonly hostClipEntityId?: never;
377
- readonly anchorOffset?: never;
388
+ readonly startMs?: never;
378
389
  } | {
379
390
  readonly placement?: never;
380
391
  readonly hostClipEntityId: string;
381
- readonly anchorOffset: number;
392
+ readonly startMs: number;
382
393
  });
383
394
  type VisualMediaAssetFact = ImageMediaAssetFact | VideoMediaAssetFact;
384
395
  interface InsertMediaClipInput {
385
396
  readonly timelineEntityId: string;
386
397
  readonly clipEntityId?: string;
387
398
  readonly media: VisualMediaAssetFact;
388
- /** Source/display window in whole milliseconds. Images use this as their finite display span. */
389
- readonly sourceRange: SequenceRange<number>;
399
+ /** Window on the source, whole milliseconds. An Image uses it as its finite display span. */
400
+ readonly inMs: number;
401
+ readonly outMs: number;
390
402
  readonly placement: ClipPlacement;
391
403
  readonly volume?: number;
392
404
  }
393
405
  interface ReplaceMediaClipInput {
394
406
  readonly clipEntityId: string;
395
407
  readonly media: VisualMediaAssetFact;
396
- readonly sourceRange: SequenceRange<number>;
408
+ readonly inMs: number;
409
+ readonly outMs: number;
397
410
  }
398
411
  interface ReplacementMediaClipInput {
399
412
  readonly clipEntityId?: string;
400
413
  readonly media: VisualMediaAssetFact;
401
- readonly sourceRange: SequenceRange<number>;
414
+ readonly inMs: number;
415
+ readonly outMs: number;
402
416
  readonly volume?: number;
403
417
  }
404
418
  type MediaClipInsertion = {
@@ -435,11 +449,13 @@ interface LinearClipSpeed {
435
449
  }
436
450
  interface SetClipSpeedInput {
437
451
  readonly clipEntityId: string;
438
- readonly timeRemapping: LinearClipSpeed | null;
452
+ /** Linear speed; null restores the source's own pace. */
453
+ readonly rate: number | null;
439
454
  }
440
455
  interface TrimClipInput {
441
456
  readonly clipEntityId: string;
442
- readonly sourceRange: SequenceRange<number>;
457
+ readonly inMs: number;
458
+ readonly outMs: number;
443
459
  }
444
460
  interface VoiceoverTakeResult {
445
461
  readonly voiceoverClipEntityId: string;
@@ -497,19 +513,21 @@ interface InsertClipInput {
497
513
  readonly trackEntityId: string;
498
514
  /** Existing Sequence media Entity id. Asset ids and URLs are not content ids. */
499
515
  readonly contentEntityId: string;
500
- readonly sourceRange: SequenceRange<number>;
501
- readonly duration: SequenceDuration<number>;
502
- readonly targetRange?: SequenceRange<number>;
516
+ readonly inMs: number;
517
+ readonly outMs: number;
518
+ readonly startMs?: number;
519
+ /** Where among its Track's Clips it lands; appended when omitted. */
520
+ readonly order?: number;
503
521
  readonly clipPayload?: JsonObject;
504
522
  }
505
523
  interface UpdateClipMarkerInput {
506
524
  readonly clipEntityId: string;
507
- readonly sourceRange?: SequenceRange<number>;
508
- /** Passing `undefined` explicitly removes the optional target range. */
509
- readonly targetRange?: SequenceRange<number> | undefined;
510
- readonly duration?: SequenceDuration<number>;
511
- /** Passing `undefined` explicitly removes the optional remapping value. */
512
- readonly timeRemapping?: JsonValue | undefined;
525
+ readonly inMs?: number;
526
+ readonly outMs?: number;
527
+ /** Passing `undefined` explicitly removes the optional start. */
528
+ readonly startMs?: number | undefined;
529
+ /** Passing `undefined` explicitly removes the optional rate. */
530
+ readonly rate?: number | undefined;
513
531
  }
514
532
  interface MoveClipInput {
515
533
  readonly clipEntityId: string;
@@ -519,10 +537,10 @@ interface ReplaceClipContentInput {
519
537
  readonly clipEntityId: string;
520
538
  /** Existing Sequence media Entity id. Asset ids and URLs are not content ids. */
521
539
  readonly contentEntityId: string;
522
- readonly sourceRange: SequenceRange<number>;
523
- readonly duration: SequenceDuration<number>;
524
- readonly targetRange?: SequenceRange<number>;
525
- readonly timeRemapping?: JsonValue;
540
+ readonly inMs: number;
541
+ readonly outMs: number;
542
+ readonly startMs?: number;
543
+ readonly rate?: number;
526
544
  }
527
545
  interface DeleteClipInput {
528
546
  readonly clipEntityId: string;
@@ -773,6 +791,7 @@ declare const LORO_ENTITY_SCHEMA = "medeo.entities.loro.v1";
773
791
  interface EntityDocumentState {
774
792
  readonly rows: EntityRelationRows;
775
793
  readonly project: Readonly<Record<string, string>>;
794
+ readonly phoneticScriptSelections?: Readonly<Record<string, string>>;
776
795
  }
777
796
  /** One stable native relation root, including records tombstoned from the active projection. */
778
797
  interface EntityRelationRecord extends RelationRow {
@@ -830,6 +849,14 @@ type Command = {
830
849
  } | {
831
850
  type: 'unlink';
832
851
  root: string;
852
+ } | {
853
+ type: 'select-clip-content';
854
+ clipRoot: string;
855
+ relationRoot: string;
856
+ } | {
857
+ type: 'select-phonetic-script';
858
+ clipRoot: string;
859
+ phoneticScriptRoot: string;
833
860
  } | {
834
861
  type: 'attach';
835
862
  slot: string;
@@ -884,20 +911,12 @@ declare class LoroEntityDraft {
884
911
  delete(entityId: string): void;
885
912
  attach(slot: string, entityId: string): void;
886
913
  link(row: RelationRow): void;
887
- linkGenerated(input: {
888
- relationId: RelationRow['relationId'];
889
- outputEntityId: RelationRow['endpoint0EntityId'];
890
- inputEntityId: RelationRow['endpoint1EntityId'];
891
- trace?: JsonObject;
892
- }): void;
893
- linkClipAnchor(input: {
894
- relationId: RelationRow['relationId'];
895
- childClipEntityId: RelationRow['endpoint0EntityId'];
896
- hostClipEntityId: RelationRow['endpoint1EntityId'];
897
- trace?: JsonObject;
898
- }): void;
899
914
  patchRelationTrace(relationId: string, trace: JsonObject): void;
900
915
  unlink(relationId: string): void;
916
+ /** Select the one content membership projected for this stable Clip identity. */
917
+ selectClipContent(relationId: string): void;
918
+ /** Select the pending immutable pronunciation variant for one stable Speech Clip. */
919
+ selectPhoneticScript(clipEntityId: string, phoneticScriptEntityId: string): void;
901
920
  private relationRoot;
902
921
  update(entityId: string, fields: JsonObject): void;
903
922
  declare(entityId: string, fields: JsonObject): void;
@@ -911,13 +930,22 @@ declare class LoroEntityDraft {
911
930
  }
912
931
  //#endregion
913
932
  //#region src/entity-crdt/compile-rows.d.ts
933
+ interface ApplyEntityRowsOptions {
934
+ readonly projectAttachments?: Readonly<Record<string, string>>;
935
+ readonly phoneticScriptSelections?: Readonly<Record<string, string>>;
936
+ }
914
937
  /** Lower a detached ordinary-object edit against its actual causal Loro baseline. */
915
- declare function compileEntityRows(snapshot: Uint8Array, rows: EntityRelationRows, validate?: (state: EntityDocumentState) => void): {
938
+ declare function compileEntityRows(snapshot: Uint8Array, rows: EntityRelationRows, validate?: (state: EntityDocumentState) => void, options?: ApplyEntityRowsOptions): {
939
+ update: Uint8Array;
940
+ state: EntityDocumentState;
941
+ };
942
+ /** Publish final rows as imported causal operations, outside the caller's local undo history. */
943
+ declare function publishEntityRows(editor: LoroEntityDocument, rows: EntityRelationRows, options?: ApplyEntityRowsOptions): {
916
944
  update: Uint8Array;
917
945
  state: EntityDocumentState;
918
946
  };
919
947
  /** Compile an edit on an existing peer, retaining its native local undo history. */
920
- declare function applyEntityRows(editor: LoroEntityDocument, rows: EntityRelationRows): {
948
+ declare function applyEntityRows(editor: LoroEntityDocument, rows: EntityRelationRows, options?: ApplyEntityRowsOptions): {
921
949
  update: Uint8Array;
922
950
  state: EntityDocumentState;
923
951
  };
@@ -1818,4 +1846,4 @@ declare function phoneticScriptAssetHash(rows: EntityRelationRows, entityId: str
1818
1846
  /** The Asset a PhoneticScript was written out to, read from the graph. */
1819
1847
  declare function phoneticScriptAssetOf(rows: EntityRelationRows, entityId: string): EntityRow | undefined;
1820
1848
  //#endregion
1821
- 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, EntityRelationRecord, EntityTimelineEditor, type EntityTimelineIdFactory, type EntityTimelineProjectionDocument, 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, type ReviseAudioScriptInput, type ReviseAudioScriptResult, 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 SpeechOriginAssetSystem, 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, phoneticScriptAssetContent, phoneticScriptAssetHash, phoneticScriptAssetOf, prepareCaptionContent, projectEntityTimeline, readDocumentAudioScript, readEntityDocument, readEntityRelationRecords, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveFieldPath, resolveSpeechOverlapByShiftingVideos, reviseAudioScript, safeDurationMs, index_d_exports as schemas, scriptSourceAssetOf, selectAudioScriptSegment, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema };
1849
+ export { type Aggregation, ApplyEntityRowsOptions, 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, EntityGraphRevisionConflictError, type EntityGraphRevisionConflictPayload, type EntityGraphState, EntityRelationRecord, 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, type ReviseAudioScriptInput, type ReviseAudioScriptResult, 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, phoneticScriptAssetContent, phoneticScriptAssetHash, phoneticScriptAssetOf, prepareCaptionContent, projectEntityTimeline, publishEntityRows, readDocumentAudioScript, readEntityDocument, readEntityRelationRecords, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveFieldPath, resolveSpeechOverlapByShiftingVideos, reviseAudioScript, safeDurationMs, index_d_exports as schemas, scriptSourceAssetOf, selectAudioScriptSegment, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema };