@mengine/medeo-client 2.0.1-alpha.5 → 2.0.1-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as index_d_exports } from "./index-CMa6ZCtX.js";
2
- import { $ as SequenceRange, A as generatePartId, At as VideoDraft, B as ResolvedEntityClipPlacement, Bt as Track$1, C as PlannedSemanticOpKind, Ct as TrackItemTimePosition, D as SnapshotReadable, Dt as VideoDocumentSchemaVersion, E as SchemaValidator, Et as VideoDocument, F as videoDocumentMirrorSchema, Ft as CaptionPart$1, G as EntityTimelineProjectionError, H as ResolvedEntityTrack, I as VideoDocumentValidationError, It as CaptionStyle, J as RelationRow, K as EntityRelationRows, L as assertValidVideoDocument, Lt as PartAggregation, M as TrackItemDraft, Mt as effectiveVideoClipDurationMs, N as VideoDocumentDraft, Nt as speedOf, O as ValidationError, Ot as VideoDocumentValidationIssue, P as VideoDocumentMirrorSchema, Pt as Attachment, Q as SequenceDuration, R as validateVideoDocument, Rt as SpeedShift, S as ImplementedSemanticOpKind, St as TrackItem, T as isImplementedSemanticOpKind, Tt as VideoClipPart, U as resolveEntityTimelineLayout, V as ResolvedEntityTimelineLayout, Vt as TrackItem$1, W as projectEntityTimeline, X as CaptionStyleFields, Y as CaptionSegmentSelection, Z as ScriptTextSegment, _ as SemanticEditor, _t as PartKind, a as PlainMemoryAdapter, at as buildInitialVideoDocument, b as TransactAudit, bt as Timeline, c as MirrorVideoDocumentAdapter, ct as buildSpeechHostMap, d as createMirrorVideoDocument, dt as toVideoDocument, et as VoiceDescriptor, f as createMirrorVideoDocumentAdapter, ft as BgmPart, g as SemanticDocumentAdapter, gt as ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, h as OpActor, ht as DEFAULT_UNIT_TIME_MS, i as JournalEntry, it as InitialDocumentFacts, j as TrackDraft, jt as VideoDraftPartUnion, k as PartIdFactory, kt as VideoDocumentValidationIssueCode, l as MirrorVideoDocumentOptions, lt as derivePositionFromAbs, m as CommitOptions, mt as CaptionPart, n as videoDocumentSchema, nt as JsonValue, o as PlainMemoryAdapterOptions, ot as DerivedItemPosition, p as writeVideoDocumentToDraft, pt as CaptionDisplayCue, q as EntityRow, r as readVideoDocumentFromDraft, rt as EntityId, s as createPlainMemoryAdapter, st as SpeechHostMap, t as partUnionSchema, tt as JsonObject, u as applyEntityTimelineProjection, ut as fromVideoDocument, v as SemanticOpInput, vt as PartUnion, w as SemanticOpKind, wt as VIDEO_DOCUMENT_SCHEMA_VERSION, x as IMPLEMENTED_SEMANTIC_OP_KINDS, xt as Track, y as SemanticOpName, yt as SpeechPart, z as EntityTimelineTrackRole, zt as Timeline$1 } from "./index-B31KeDzA.js";
2
+ import { $ as SpeechHostMap, A as assertValidVideoDocument, At as VideoDocumentValidationIssueCode, B as EntityRow, Bt as SpeedShift, C as isImplementedSemanticOpKind, Ct as Timeline, D as PartIdFactory, Dt as VideoClipPart, E as ValidationError, Et as TrackItemTimePosition, F as ResolvedEntityTrack, Ft as speedOf, G as SequenceDuration, H as CaptionSegmentSelection, Ht as Track$1, I as resolveEntityTimelineLayout, It as Attachment, J as JsonObject, K as SequenceRange, L as projectEntityTimeline, Lt as CaptionPart$1, M as EntityTimelineTrackRole, Mt as VideoDraftContent, N as ResolvedEntityClipPlacement, Nt as VideoDraftPartUnion, O as generatePartId, Ot as VideoDocument, P as ResolvedEntityTimelineLayout, Pt as effectiveVideoClipDurationMs, Q as DerivedItemPosition, R as EntityTimelineProjectionError, Rt as CaptionStyle, S as SemanticOpKind, St as SpeechPart, T as SnapshotReadable, Tt as TrackItem, U as CaptionStyleFields, Ut as TrackItem$1, V as RelationRow, Vt as Timeline$1, W as ScriptTextSegment, X as EntityId, Y as JsonValue, Z as buildInitialVideoDocument, _ as SemanticOpName, _t as CaptionDisplayCue, a as PlainMemoryAdapter, at as LaneKind, b as ImplementedSemanticOpKind, bt as PartKind, c as MirrorVideoDocumentAdapter, ct as findLaneTrack, d as createMirrorVideoDocumentAdapter, dt as TrackDraft, et as buildSpeechHostMap, f as CommitOptions, ft as TrackItemDraft, g as SemanticOpInput, gt as BgmPart, h as SemanticEditor, ht as videoDocumentMirrorSchema, i as JournalEntry, it as LANE_KINDS_IN_STACK_ORDER, j as validateVideoDocument, jt as VideoDraft, k as VideoDocumentValidationError, kt as VideoDocumentValidationIssue, l as MirrorVideoDocumentOptions, lt as laneTrackId, m as SemanticDocumentAdapter, mt as VideoDocumentMirrorSchema, n as videoDocumentSchema, nt as fromVideoDocument, o as PlainMemoryAdapterOptions, ot as SolvedVideoDocument, p as OpActor, pt as VideoDocumentDraft, q as VoiceDescriptor, r as readVideoDocumentFromDraft, rt as toVideoDocument, s as createPlainMemoryAdapter, st as ensureLaneTrack, t as partUnionSchema, tt as derivePositionFromAbs, u as createMirrorVideoDocument, ut as solveVideoDocument, v as TransactAudit, vt as CaptionPart, w as SchemaValidator, wt as Track, x as PlannedSemanticOpKind, xt as PartUnion, y as IMPLEMENTED_SEMANTIC_OP_KINDS, yt as DEFAULT_UNIT_TIME_MS, z as EntityRelationRows, zt as PartAggregation } from "./index-CDrPUhBH.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";
@@ -134,7 +134,6 @@ declare class MengineHttpClient {
134
134
  private readonly fetchImpl;
135
135
  constructor(options: MengineHttpClientOptions);
136
136
  fetchSnapshot(): Promise<MengineSnapshotResponse>;
137
- bootstrapSnapshot(snapshot: Uint8Array): Promise<MengineSnapshotResponse>;
138
137
  /**
139
138
  * Loro VV-diff pull: send the caller's oplog `VersionVector.encode` as `from`
140
139
  * (omit for a full pull) and receive exactly the updates it is missing plus
@@ -175,6 +174,8 @@ interface MengineEventStreamOptions {
175
174
  /** Fired once the stream response is established (HTTP ok, body readable). */
176
175
  onOpen?(): void;
177
176
  onUpdate(event: MengineSseUpdateEvent): void;
177
+ /** A committed update omitted from live transport; fetch the missing operations by VV. */
178
+ onResync?(): void;
178
179
  }
179
180
  declare function readMengineEventStream(options: MengineEventStreamOptions): Promise<void>;
180
181
  //#endregion
@@ -789,6 +790,8 @@ declare class LoroEntityDocument {
789
790
  static create(rows: EntityRelationRows, project?: Readonly<Record<string, string>>, peerId?: PeerID): LoroEntityDocument;
790
791
  snapshot(): EntityDocumentState;
791
792
  relationsOf(entityId: string): readonly RelationRow[];
793
+ /** Resolve a queued edit target through its native identity without changing history. */
794
+ resolveCurrentEntityId(id: string): string;
792
795
  getVersion(id: string): EntityRow | undefined;
793
796
  /** The callback and every domain validation execute on a causally complete fork first. */
794
797
  transact(edit: (draft: LoroEntityDraft) => void): Uint8Array;
@@ -951,7 +954,9 @@ type PushResultKind = 'ack' | 'duplicate' | 'rejected' | 'failed' | 'nothing_to_
951
954
  */
952
955
  interface PushResult {
953
956
  kind: PushResultKind;
954
- /** Server-allocated sequence number; only present for `ack`. */
957
+ /** Server document sequence observed after a successful `ack` or `duplicate`. */
958
+ mengineUpdateSeq?: number | undefined;
959
+ /** @deprecated Ack-only sequence retained until consumers adopt `mengineUpdateSeq`. */
955
960
  updateSeq?: number | undefined;
956
961
  /** Whether the server held ops the local document lacked. See above. */
957
962
  collaborated: boolean;
@@ -1045,6 +1050,8 @@ declare class ManualSyncDoc {
1045
1050
  private readonly client;
1046
1051
  private readonly doc;
1047
1052
  private readonly adapter;
1053
+ /** Whether this document's timeline is owned by the Entity graph. */
1054
+ isEntityDocument(): boolean;
1048
1055
  readonly editor: SemanticEditor;
1049
1056
  /**
1050
1057
  * The version the server is known to hold. Starts empty (nothing confirmed)
@@ -1058,8 +1065,7 @@ declare class ManualSyncDoc {
1058
1065
  * Fetches the snapshot up front rather than starting empty and converging: the
1059
1066
  * agent's first act is to read the document, so there is no useful state before
1060
1067
  * the snapshot lands. This also fails fast and loudly on a document that does
1061
- * not exist, instead of `MengineDocSession.waitForContent()`'s behavior of
1062
- * waiting forever for content that will never arrive.
1068
+ * not exist or whose first snapshot is incomplete or invalid.
1063
1069
  */
1064
1070
  static open(options: ManualSyncDocOptions): Promise<ManualSyncDoc>;
1065
1071
  /** Current document read model (authoritative shape). */
@@ -1075,8 +1081,8 @@ declare class ManualSyncDoc {
1075
1081
  * was passed to the constructor.
1076
1082
  */
1077
1083
  editorPeerId(): PeerID;
1078
- /** Current document projected to the legacy `VideoDraft` read shape. */
1079
- draft(): VideoDraft;
1084
+ /** Current content projected into the compatible track and part read shape. */
1085
+ content(): VideoDraftContent;
1080
1086
  /**
1081
1087
  * Replay a deterministic sandbox journal into this document.
1082
1088
  *
@@ -1093,9 +1099,8 @@ declare class ManualSyncDoc {
1093
1099
  *
1094
1100
  * This pair replaces the legacy integer-version comparison that
1095
1101
  * `DraftVersionDetector` used to tell the LLM "the draft was modified
1096
- * externally, reload before editing". Under mengine `meta.version` never
1097
- * changes, so that detector would go permanently silent; comparing version
1098
- * vectors restores the same capability.
1102
+ * externally, reload before editing". Comparing Loro version vectors covers
1103
+ * all collaborative edits without a business revision field in the document.
1099
1104
  *
1100
1105
  * Same capability, not a stronger one: like the legacy detector, this only
1101
1106
  * reports what changed between two moments the caller chose to sample.
@@ -1240,12 +1245,24 @@ declare class MedeoHttpDocStorage implements DocStorage {
1240
1245
  * tool-level ack wait) subscribe here.
1241
1246
  */
1242
1247
  subscribePushOutcome(callback: (outcome: PushOutcome) => void): () => void;
1248
+ /** Observe live hints that require VV catch-up without replacing the SSE connection. */
1249
+ subscribeResync(callback: () => void): () => void;
1250
+ /** Authoritative HTTP reads and accepted pushes, never inferred from SSE bytes. */
1251
+ subscribeServerVersion(callback: (version: Uint8Array) => void): () => void;
1252
+ private reportServerVersion;
1243
1253
  deleteDoc(_docId: string): Promise<void>;
1244
1254
  subscribeDocUpdate(callback: (update: DocUpdate, origin: unknown) => void): () => void;
1245
1255
  private assertDocId;
1246
1256
  private emitUpdate;
1247
1257
  }
1248
1258
  //#endregion
1259
+ //#region src/session/document-undo-manager.d.ts
1260
+ /** Availability for this document's current editing session, not server revisions. */
1261
+ interface MengineUndoState {
1262
+ readonly canUndo: boolean;
1263
+ readonly canRedo: boolean;
1264
+ }
1265
+ //#endregion
1249
1266
  //#region src/session/types.d.ts
1250
1267
  /**
1251
1268
  * Local storage contract the runtime depends on. Aliased to the engine
@@ -1288,6 +1305,14 @@ interface WaitForServerAckOptions {
1288
1305
  /** Deadline in ms. Rejects with reason `timeout` when it elapses. */
1289
1306
  timeoutMs?: number;
1290
1307
  }
1308
+ /** Document-level confirmation is independent of local operation completion. */
1309
+ interface MengineDocSyncState {
1310
+ /** Remote-only imports do not create a new local confirmation obligation. */
1311
+ readonly confirmation: 'unknown' | 'pending' | 'confirmed';
1312
+ /** Transport/activity phase. Idle does not imply confirmation; failure details
1313
+ * remain available through push outcomes and confirmation wait errors. */
1314
+ readonly phase: 'connecting' | 'idle' | 'syncing' | 'offline' | 'failed';
1315
+ }
1291
1316
  interface MengineDocSessionOptions {
1292
1317
  docId: string;
1293
1318
  client: MengineHttpClient;
@@ -1308,13 +1333,9 @@ interface MengineDocSessionOptions {
1308
1333
  * A live editing session for one Medeo document — the single entry point clients
1309
1334
  * (FE draft driver, Agent, embeds) use to open, edit, and observe a document.
1310
1335
  *
1311
- * It assembles the engine sync stack around one Medeo document:
1312
- *
1313
- * local DocStorage ─┐
1314
- * ├─ ClientServerSynchronizer ── DocManager ── LoroDoc
1315
- * MedeoHttpDocStorage┘ │
1316
- * (remote = Rust mengine-server) ▼
1317
- * MirrorVideoDocumentAdapter + SemanticEditor
1336
+ * SemanticEditor writes through MirrorVideoDocumentAdapter directly, while
1337
+ * DocumentUndoManager observes the same LoroDoc independently. Both mutation
1338
+ * paths use the session's DocumentMutationGuard, closed before teardown.
1318
1339
  *
1319
1340
  * `DocManager` owns the `LoroDoc`: local edits committed on the adapter are
1320
1341
  * picked up via `subscribeLocalUpdates`, saved to local storage, then pushed to
@@ -1335,11 +1356,20 @@ declare class MengineDocSession {
1335
1356
  private readonly manager;
1336
1357
  private readonly events;
1337
1358
  private readonly disposables;
1359
+ private readonly mutationGuard;
1338
1360
  private adapterValue;
1339
1361
  private editorValue;
1362
+ private undoManagerValue;
1340
1363
  private started;
1364
+ private startTask;
1365
+ private destroyed;
1366
+ private lifetime;
1367
+ private hasConnected;
1368
+ private initialVersionValue;
1369
+ private localVersionValue;
1370
+ private pushErrorValue;
1341
1371
  /**
1342
- * Latest server oplog version seen on a push outcome. Lets `waitForServerAck`
1372
+ * Latest server oplog version seen on an authoritative HTTP response. Lets `waitForServerAck`
1343
1373
  * return without waiting when the server is already known to cover the local
1344
1374
  * doc (e.g. nothing was edited since the last confirmed push).
1345
1375
  */
@@ -1354,14 +1384,14 @@ declare class MengineDocSession {
1354
1384
  */
1355
1385
  subscribePushOutcome(callback: (outcome: PushOutcome) => void): () => void;
1356
1386
  /**
1357
- * Resolve once the server has durably accepted the local document state as of
1387
+ * Resolve once the server has durably accepted the local commits as of
1358
1388
  * *now* — the capability an Agent tool needs to answer "did my edit land?"
1359
1389
  * before reporting success.
1360
1390
  *
1361
1391
  * Call it right after the editor ops whose durability matters. It snapshots the
1362
- * local doc's current version and resolves on the first push outcome whose
1363
- * `serverVV` covers that version, i.e. the server log is at least as advanced as
1364
- * the local doc was when this was called.
1392
+ * latest local commit's version (or the loaded baseline before any edit) and
1393
+ * resolves when an authoritative server version covers it. Remote-only
1394
+ * imports do not extend this target, matching the displayed confirmation state.
1365
1395
  *
1366
1396
  * Version coverage, not byte identity, is the acceptance test — for two reasons:
1367
1397
  * the ops may reach the server inside a merged blob rather than as the exact
@@ -1397,29 +1427,58 @@ declare class MengineDocSession {
1397
1427
  get documentAdapter(): SemanticDocumentAdapter;
1398
1428
  /** Current document snapshot (read model). */
1399
1429
  snapshot(): VideoDocument;
1430
+ /** Current-session undo/redo availability. Loading and closed sessions report false. */
1431
+ getUndoState(): MengineUndoState;
1432
+ /**
1433
+ * Supplies current availability immediately, then coalesces stack changes in a
1434
+ * microtask. Session teardown publishes empty availability synchronously.
1435
+ */
1436
+ subscribeUndoState(cb: (state: MengineUndoState) => void): () => void;
1437
+ /**
1438
+ * Undo a local edit immediately; server confirmation remains asynchronous.
1439
+ * On a shared LWW field this writes its prior value, potentially overwriting a
1440
+ * later remote edit to that same field. Returns false if no update is produced.
1441
+ */
1442
+ undo(options?: CommitOptions): boolean;
1443
+ /**
1444
+ * Restore the state visible before undo without rerunning external side effects.
1445
+ * Returns false if no update is produced; durable confirmation is separate.
1446
+ */
1447
+ redo(options?: CommitOptions): boolean;
1448
+ /**
1449
+ * Combine existing semantic operations (e.g. trim a clip and adjust its volume)
1450
+ * or repeated commits during one drag gesture into a single undo step. A gesture
1451
+ * that only previews locally and commits once on release needs no group.
1452
+ * Each commit is immediately visible locally and enters sync independently;
1453
+ * a later failure does not roll it back.
1454
+ * Always pair with endUndoGroup in a finally block. Conflicting remote imports
1455
+ * can end/split the group early, and unrelated local edits would join it.
1456
+ * Complete asynchronous asset preparation before opening the group.
1457
+ */
1458
+ beginUndoGroup(): void;
1459
+ /** End a gesture, including one already split by a conflicting remote import. */
1460
+ endUndoGroup(): void;
1400
1461
  /**
1401
1462
  * Start the sync stack and connect the document.
1402
1463
  *
1403
- * Returns once the local snapshot has loaded into the Loro doc so callers can
1404
- * read an initial snapshot. Remote convergence continues in the background and
1405
- * surfaces through `subscribe`.
1464
+ * Returns after DocManager loads a local snapshot, or after the first remote
1465
+ * sync when no local snapshot exists. A valid empty document is ready too.
1466
+ * Cached documents can open before SSE connects; subsequent remote changes
1467
+ * surface through `subscribe`.
1406
1468
  */
1407
1469
  start(): Promise<VideoDocument>;
1470
+ private open;
1471
+ getSyncState(): MengineDocSyncState;
1472
+ private confirmationTarget;
1473
+ /** Immediately supplies current state; unsubscribe when the host changes docs. */
1474
+ subscribeSyncState(cb: (state: MengineDocSyncState) => void): () => void;
1475
+ private emitSyncState;
1408
1476
  subscribe(cb: (event: MengineDocSessionUpdateEvent) => void): () => void;
1409
1477
  onStateChange(cb: (state: DocState) => void): () => void;
1410
1478
  getState(): DocState;
1411
1479
  destroy(): void;
1412
- /**
1413
- * Resolve once the Loro doc holds the document root.
1414
- *
1415
- * `DocManager` loads from local storage, which starts empty for a fresh
1416
- * client; the server snapshot arrives asynchronously via the first sync job.
1417
- * `loaded` only means the local load ran, so we wait for actual content
1418
- * (populated schema roots) instead, surfaced by the doc subscription set up
1419
- * in `start()`.
1420
- */
1421
- private waitForContent;
1422
- private hasContent;
1480
+ /** Local absence needs a remote sync; empty business content does not. */
1481
+ private waitForInitialLoad;
1423
1482
  }
1424
1483
  //#endregion
1425
1484
  //#region src/storage/memory-doc-storage.d.ts
@@ -1606,103 +1665,6 @@ type MakeEmptyPart = (durationMs: number) => {
1606
1665
  */
1607
1666
  declare function cascadeAfterVideoClipChanges(doc: TimelineDoc, makeEmptyPart: MakeEmptyPart): void;
1608
1667
  //#endregion
1609
- //#region src/timeline-core/bridge.d.ts
1610
- /**
1611
- * Bridge between the authoritative `VideoDocument` (position-only facts) and the
1612
- * flat `TimelineDoc` the cascade primitives solve over.
1613
- *
1614
- * The data flow is single-directional (RFC 02 §7/§10): ops write only facts
1615
- * (`time_position`, parts) to `VideoDocument`; absolute time, `part_aggregations`,
1616
- * total duration, and gap fillers are NOT stored — the projection derives them
1617
- * on read by running the cascade. There is no write-back of solved positions.
1618
- *
1619
- * - `solveVideoDocument` seeds a `TimelineDoc` from each item's `time_position`,
1620
- * runs the full cascade, and returns the derived read-view (abs / aggregations
1621
- * / duration). It is the single solve shared by the legacy `VideoDraft`
1622
- * projection.
1623
- * - `ensureLaneTrack` / `findLaneTrack` locate (or mint) a secondary lane's
1624
- * track row in the draft, so ops can write authoritative facts onto the right
1625
- * named container (lane = container).
1626
- */
1627
- /** The projection-derived read-view of a `VideoDocument` (RFC 02 §7). */
1628
- interface SolvedVideoDocument {
1629
- absByPartId: Map<string, number>;
1630
- aggregations: PartAggregation[];
1631
- durationMs: number;
1632
- partLibrary: Record<string, PartUnion>;
1633
- /**
1634
- * Part ids of the gap fillers this solve minted.
1635
- *
1636
- * They exist only inside the solve: gap filling needs them so the clips after a
1637
- * gap land at the right absolute time, but they are not authoritative state and
1638
- * the read view does not carry them (see `fromVideoDocument`).
1639
- *
1640
- * Reported as ids rather than left for the caller to detect, because the caller
1641
- * *cannot* detect them. The obvious predicate — `origin_media_id === ''` — also
1642
- * matches an empty clip a writer placed on purpose (`batch_replace_video_clip_sequence`
1643
- * documents "Omit to create an empty clip placeholder"), and those are
1644
- * authoritative parts that must survive the projection. The mint callback is the
1645
- * only place that knows the difference.
1646
- *
1647
- * Note this deliberately excludes the fillers that gap filling *extended* rather
1648
- * than minted (`fillMainTrackTimeGaps` cases 1 and 2): those are authoritative
1649
- * empty clips already in `part_library`, and only their length is derived.
1650
- */
1651
- derivedFillerPartIds: Set<string>;
1652
- }
1653
- /**
1654
- * Solve a `VideoDocument` (authoritative, position-only) into its derived
1655
- * read-view: absolute time per item, `part_aggregations`, and total duration.
1656
- * This is the read side of the single-directional flow — never written back.
1657
- */
1658
- declare function solveVideoDocument(document: VideoDocument): SolvedVideoDocument;
1659
- /** The named container a secondary lane lives in. */
1660
- type SecondaryLane = 'speech' | 'caption' | 'bgm';
1661
- /** A lane's track kind: the `video_clip` main lane plus the three secondary lanes. */
1662
- type LaneKind = SecondaryLane | 'video_clip';
1663
- /**
1664
- * The four lanes in top-to-bottom stack order — the order a `tracks` list holds
1665
- * them in (see {@link laneRank}).
1666
- *
1667
- * Exported so a document can be seeded with all four lanes up front. That seed is
1668
- * not cosmetic: {@link ensureLaneTrack} is find-then-mint over a `LoroMovableList`,
1669
- * so two concurrent writers that each mint the same absent lane both keep their
1670
- * row, and the merged document holds two tracks for one lane. For the main lane
1671
- * that is fatal — `videoDocumentSchema` allows at most one `video_clip` track, so
1672
- * the merged document stops being projectable at all, symmetrically on both
1673
- * replicas. Pre-seeding every lane makes `ensureLaneTrack` always take its find
1674
- * branch, which removes the race by construction rather than by detection.
1675
- *
1676
- * What closes the race is that a track with the lane's `parts_kind` EXISTS — the
1677
- * lookup is by kind, not by id. So a seed is only safe if it covers every lane:
1678
- * a partial seed leaves the uncovered lanes exactly as exposed as before.
1679
- */
1680
- declare const LANE_KINDS_IN_STACK_ORDER: readonly LaneKind[];
1681
- /**
1682
- * The conventional track id for a lane (`main_track`, `<kind>_track`). Shared by
1683
- * the up-front seed and {@link ensureLaneTrack}'s lazy mint so a document's lane
1684
- * ids do not depend on which of the two created the track.
1685
- *
1686
- * Ids are cosmetic to the merge itself — lane lookup goes by `parts_kind`, so
1687
- * drifting them apart would not reopen the concurrent-mint race. They matter to
1688
- * readers that address a lane by id (the FE editor's panes, fixtures), which is
1689
- * why there is one convention rather than two.
1690
- */
1691
- declare function laneTrackId(kind: LaneKind): string;
1692
- /**
1693
- * Locate a lane's track row in the single `tracks` list by kind, minting an empty
1694
- * row in lane-stacking order if absent (reference/17 §4: lane = `parts_kind`).
1695
- * Ops use this to write authoritative items onto the right lane. The track id
1696
- * comes from {@link laneTrackId}, shared with the up-front seed.
1697
- *
1698
- * The mint branch is a concurrency hazard, not a convenience: see
1699
- * {@link LANE_KINDS_IN_STACK_ORDER}. A document seeded with all four lanes never
1700
- * reaches it.
1701
- */
1702
- declare function ensureLaneTrack(draft: VideoDocumentDraft, kind: LaneKind): TrackDraft;
1703
- /** Find a secondary lane's track row without minting it. */
1704
- declare function findLaneTrack(draft: VideoDocumentDraft, kind: SecondaryLane): TrackDraft | undefined;
1705
- //#endregion
1706
1668
  //#region src/timeline-core/locate.d.ts
1707
1669
  /**
1708
1670
  * Forward positioning for write-time ops (RFC 02 §9.1) — NOT a cascade.
@@ -1754,4 +1716,4 @@ declare function hasAudioScriptAsset(payload: JsonObject): boolean;
1754
1716
  /** Internal fingerprint prevents a resource from silently describing an older text revision. */
1755
1717
  declare function audioScriptAssetFields(payload: JsonObject, assetId: string): JsonObject;
1756
1718
  //#endregion
1757
- 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, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, 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 InitialDocumentFacts, 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 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, applyEntityRows, applyEntityTimelineProjection, applyFieldChanges, arrangeMainTrackSeamlessly, assembleCaptionContent, assembleEntityContent, assemblePhoneticScriptContent, assembleScriptText, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertFieldChanges, assertMediaAssetWritePolicy, assertValidVideoDocument, audioScriptAssetContent, audioScriptAssetFields, audioScriptAssetHash, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, compileEntityRows, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, findComposedAudioScript, findLaneTrack, fromVideoDocument, generatePartId, getAt, hasAudioScriptAsset, 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, writeVideoDocumentToDraft };
1719
+ 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 VoiceMediaAssetFact, type VoiceoverCaptionFact, type VoiceoverTakeInput, type VoiceoverTakeResult, type WaitForServerAckOptions, applyEntityRows, applyFieldChanges, arrangeMainTrackSeamlessly, assembleCaptionContent, assembleEntityContent, assemblePhoneticScriptContent, assembleScriptText, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertFieldChanges, assertMediaAssetWritePolicy, assertValidVideoDocument, audioScriptAssetContent, audioScriptAssetFields, audioScriptAssetHash, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, compileEntityRows, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, findComposedAudioScript, findLaneTrack, fromVideoDocument, generatePartId, getAt, hasAudioScriptAsset, 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 };