@mengine/medeo-client 1.1.0 → 1.2.1-alpha.0

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.js CHANGED
@@ -1,6 +1,5 @@
1
- import { t as __exportAll } from "./chunk-D7D4PA-g.js";
2
- import { A as partDurationMs, C as reassignSpeechesToVideoClipsByTime, D as syncAggregatedClipsTimePosition, E as resolveSpeechOverlapByShiftingVideos, F as recordEntries, I as videoDocumentMirrorSchema, L as base64ToBytes, M as VIDEO_DOCUMENT_SCHEMA_VERSION, N as effectiveVideoClipDurationMs, O as TIMELINE_SKELETON_DURATION_MS, P as partUnionToDraft, R as bytesToBase64, S as fillMainTrackTimeGaps, T as resolveAllSpeechOverlaps, _ as findLaneTrack, a as buildInitialVideoDocument, b as cascadeAfterVideoClipChanges, c as fromVideoDocument, d as assertValidVideoDocument, f as validateVideoDocument, g as ensureLaneTrack, h as LANE_KINDS_IN_STACK_ORDER, i as readVideoDocumentFromDraft, j as safeDurationMs, k as isEmptyVideoClip, l as toVideoDocument, m as videoDocumentSchema, n as createMirrorVideoDocument, o as buildSpeechHostMap, p as partUnionSchema, r as createMirrorVideoDocumentAdapter, s as derivePositionFromAbs, t as MirrorVideoDocumentAdapter, u as VideoDocumentValidationError, v as laneTrackId, w as recalculateTimelineDuration, x as arrangeMainTrackSeamlessly, y as solveVideoDocument } from "./document-C98vSu7J.js";
3
- import { z } from "zod";
1
+ import { A as resolveSpeechOverlapByShiftingVideos, B as partUnionToDraft, C as solveVideoDocument, D as reassignSpeechesToVideoClipsByTime, E as fillMainTrackTimeGaps, F as safeDurationMs, H as videoDocumentMirrorSchema, I as DEFAULT_UNIT_TIME_MS, L as VIDEO_DOCUMENT_SCHEMA_VERSION, M as TIMELINE_SKELETON_DURATION_MS, N as isEmptyVideoClip, O as recalculateTimelineDuration, P as partDurationMs, R as effectiveVideoClipDurationMs, S as laneTrackId, T as arrangeMainTrackSeamlessly, U as base64ToBytes, V as recordEntries, W as bytesToBase64, _ as partUnionSchema, a as createMirrorVideoDocument, b as ensureLaneTrack, c as readVideoDocumentFromDraft, d as derivePositionFromAbs, f as fromVideoDocument, g as validateVideoDocument, h as assertValidVideoDocument, i as MirrorVideoDocumentAdapter, j as syncAggregatedClipsTimePosition, k as resolveAllSpeechOverlaps, l as buildInitialVideoDocument, m as VideoDocumentValidationError, n as createPlainMemoryAdapter, o as createMirrorVideoDocumentAdapter, p as toVideoDocument, r as generatePartId, s as writeVideoDocumentToDraft, t as PlainMemoryAdapter, u as buildSpeechHostMap, v as videoDocumentSchema, w as cascadeAfterVideoClipChanges, x as findLaneTrack, y as LANE_KINDS_IN_STACK_ORDER, z as speedOf } from "./document-49OdvviW.js";
2
+ import { addSpeechesInputSchema, addVideoClipsInputSchema, adjustBgmVolumeInputSchema, adjustSpeechVolumeInputSchema, adjustVideoClipDurationInputSchema, adjustVideoClipVolumeInputSchema, changeSpeechScriptInputSchema, changeSpeechVoiceInputSchema, deleteBgmInputSchema, deleteSpeechesInputSchema, deleteVideoClipsInputSchema, moveSpeechesInputSchema, moveVideoClipsByAnchorInputSchema, moveVideoClipsInputSchema, replaceVideoClipContentInputSchema, replaceVideoClipSequenceInputSchema, setBgmInputSchema, setCaptionStyleInputSchema, setCaptionVisibilityInputSchema, setVideoClipSpeedShiftInputSchema, t as schemas_exports } from "./schemas.js";
4
3
  import { LoroDoc, VersionVector } from "loro-crdt";
5
4
  import { ClientServerSynchronizer, DocManager } from "@mengine/sync";
6
5
  import { DisposableSet, EventBus, Task } from "@mengine/utils";
@@ -218,566 +217,6 @@ function findSseFrameBoundary(buffer) {
218
217
  return Math.min(lf, crlf);
219
218
  }
220
219
  //#endregion
221
- //#region src/editor/id-gen.ts
222
- /**
223
- * Part-id generation, aligned with the online ecosystem.
224
- *
225
- * The authoritative online producers — agent-harness (`@harness/shared`
226
- * `genObjId`) and director.v2 (`common/obj_id.py` `gen_obj_id`) — both mint part
227
- * ids as `` `${prefix}_${ulid()}` ``, and real captured drafts use exactly that
228
- * shape (`clip_…` / `spe_…` / `cap_…` / `bgm_…`, each a 26-char ULID). The engine
229
- * previously emitted `vc_<base36 timestamp><6 random>`, a different prefix AND a
230
- * different encoding — the sole cross-repo id divergence. This module removes it
231
- * by emitting the same `<prefix>_<ULID>` bytes.
232
- *
233
- * The ULID is generated inline (Crockford Base32, 48-bit time + 80-bit random)
234
- * rather than pulling the `ulid` npm package: the randomness class matches the
235
- * old generator (both `Math.random`-based) and it keeps `@mengine/medeo-client`
236
- * dependency-free for a purely mechanical id string. Part ids only need to be
237
- * unique and lexicographically time-sortable, which this satisfies.
238
- */
239
- /** Crockford Base32 alphabet (no I, L, O, U), per the ULID spec. */
240
- const CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
241
- const TIME_LEN = 10;
242
- const RANDOM_LEN = 16;
243
- function encodeTime(now) {
244
- let out = "";
245
- let ms = now;
246
- for (let i = TIME_LEN - 1; i >= 0; i--) {
247
- const mod = ms % 32;
248
- out = CROCKFORD[mod] + out;
249
- ms = (ms - mod) / 32;
250
- }
251
- return out;
252
- }
253
- function encodeRandom() {
254
- let out = "";
255
- for (let i = 0; i < RANDOM_LEN; i++) out += CROCKFORD[Math.floor(Math.random() * 32)];
256
- return out;
257
- }
258
- /** A 26-char Crockford Base32 ULID (10-char time + 16-char random). */
259
- function ulid() {
260
- return encodeTime(Date.now()) + encodeRandom();
261
- }
262
- function generatePartId(prefix) {
263
- return `${prefix}_${ulid()}`;
264
- }
265
- //#endregion
266
- //#region src/editor/schemas/shared.ts
267
- const clipIdSchema = z.string().min(1).describe("The clip part ID on the timeline");
268
- const clipIdsSchema = z.array(clipIdSchema).min(1).refine((ids) => new Set(ids).size === ids.length, { message: "Duplicate clip IDs are not allowed" }).describe("List of clip part IDs (no duplicates allowed)");
269
- const mediaIdSchema = z.string().min(1).describe("The media asset ID");
270
- const speechIdSchema = z.string().min(1).describe("The speech part ID on the timeline");
271
- const timelineMsSchema = z.number().int().min(0).describe("Time position in milliseconds on the timeline (>= 0)");
272
- const positiveMsSchema = z.number().int().positive().describe("Duration in milliseconds (> 0)");
273
- const volumeSchema = z.number().min(-60).max(20).describe("Volume in decibels (-60.0 to 20.0; 0.0 = original, -60 = mute, +20 = max)");
274
- const speechIdsSchema = z.array(speechIdSchema).min(1).refine((ids) => new Set(ids).size === ids.length, { message: "Duplicate speech IDs are not allowed" }).describe("List of speech part IDs (no duplicates allowed)");
275
- const tangentHandleSchema = z.object({
276
- x: z.number().finite(),
277
- y: z.number().finite()
278
- }).describe("Bezier tangent handle (x, y)");
279
- const speedKeyframeSchema = z.object({
280
- position: z.number().min(0).max(1),
281
- rate: z.number().min(0),
282
- in_tangent: tangentHandleSchema.optional(),
283
- out_tangent: tangentHandleSchema.optional()
284
- }).describe("A speed keyframe: normalized position (0..1), rate, optional tangents");
285
- /**
286
- * A clip's playback-speed fact, the only thing `SetVideoClipSpeedShift` writes.
287
- * Mirrors the IDL `SpeedShift`: `category` is `linear` | `curve`, and `config`
288
- * is a discriminated union — `{ linear: { speed } }` for a constant multiplier
289
- * (the multiplier projection reads at `config.linear.speed`) or `{ curve: {
290
- * keyframes } }` for a Bezier-controlled variable speed (RFC 02 / `reference/16`
291
- * §0). Exactly one of `linear` / `curve` is present.
292
- */
293
- const speedShiftSchema = z.object({
294
- category: z.enum(["linear", "curve"]),
295
- mode: z.string(),
296
- config: z.union([z.object({ linear: z.object({ speed: z.number().finite().positive() }) }), z.object({ curve: z.object({ keyframes: z.array(speedKeyframeSchema).min(2) }) })])
297
- }).describe("Speed shift: linear multiplier or Bezier curve, mirroring the IDL shape");
298
- const voiceSchema = z.object({
299
- id: z.string().min(1),
300
- name: z.string()
301
- }).describe("TTS voice summary attached to a speech");
302
- //#endregion
303
- //#region src/editor/schemas/speech-assets.ts
304
- /**
305
- * The materialized TTS result shared by `AddSpeeches` / `ChangeSpeechScript` /
306
- * `ChangeSpeechVoice` (see `results/phase-4-side-effect-payload-contract.md`
307
- * §1/§2). The side effect (TTS/ASR + billing) runs upstream; the op receives the
308
- * stable speech + caption parts and writes them as authoritative facts. No
309
- * cascade runs on write — the projection derives absolute positions on read.
310
- *
311
- * Each speech carries the anchoring fact directly (RFC 02 §4): the host video
312
- * clip `anchor_part_id` and the `offset_ms` within it. The upstream caller
313
- * already knows which clip a speech attaches to, so the op writes
314
- * `{ mode:'anchored', anchorPartId, offsetMs }` verbatim — no write-time
315
- * host-picking. Captions anchor to their speech via the caption part's
316
- * `start_ms` (offset within the speech).
317
- */
318
- const speechAssetSchema = z.object({
319
- speech_id: speechIdSchema.describe("The speech part ID (= side-effect speech_parts[].id)"),
320
- anchor_part_id: clipIdSchema.describe("Host video clip part ID the speech anchors to (RFC 02 §4)"),
321
- offset_ms: timelineMsSchema.describe("Offset within the host clip (speech.abs = host.abs + offset_ms)"),
322
- audio_storage_key: z.string().min(1),
323
- duration_ms: positiveMsSchema,
324
- audio_script: z.string(),
325
- volume: volumeSchema,
326
- voice: voiceSchema,
327
- origin_speech_id: z.string().min(1),
328
- caption_ids: z.array(z.string().min(1)).describe("Caption part IDs owned by this speech")
329
- });
330
- const captionAssetSchema = z.object({
331
- caption_id: z.string().min(1).describe("The caption part ID (= side-effect created_caption_parts[].id)"),
332
- speech_part_id: speechIdSchema.describe("The owning speech part ID"),
333
- text: z.string(),
334
- start_ms: timelineMsSchema.describe("Offset within the host speech (caption.abs = speech.abs + start_ms)"),
335
- duration_ms: positiveMsSchema
336
- });
337
- /** A materialized speech-subtree write (speeches + their captions). */
338
- const speechAssetsSchema = z.object({
339
- speeches: z.array(speechAssetSchema).min(1).describe("Materialized speech parts to write"),
340
- captions: z.array(captionAssetSchema).describe("Materialized caption parts owned by the speeches")
341
- });
342
- //#endregion
343
- //#region src/editor/schemas/add-speeches.ts
344
- /**
345
- * Add speeches (and their captions). TTS runs upstream; the stable speech /
346
- * caption parts arrive materialized (see `speech-assets.ts`). The op writes the
347
- * parts and each speech's `{ mode:'anchored', anchorPartId, offsetMs }` fact
348
- * verbatim — no write-time host-picking, no cascade (RFC 02 §4). The projection
349
- * derives absolute positions on read.
350
- */
351
- const addSpeechesInputSchema = speechAssetsSchema.describe("Materialized speeches + captions to add");
352
- //#endregion
353
- //#region src/editor/schemas/add-video-clips.ts
354
- /**
355
- * Add video clips to a track. Each clip's duration facts are separated so a
356
- * single number is never overloaded (RFC 02 / `reference/16` §0b):
357
- *
358
- * - `media_duration_ms` is the source media's intrinsic full length (a resource
359
- * fact, written to the part);
360
- * - `play_in` / `play_out` are the optional trim window into that media; when
361
- * omitted the whole media is used (`play_in=0`, `play_out=media_duration_ms`).
362
- *
363
- * The clip's effective timeline duration is derived by the projection from the
364
- * trim window and `speed_shift` — it is never an input here.
365
- */
366
- const addVideoClipsInputSchema = z.object({
367
- clips: z.array(z.object({
368
- media_id: mediaIdSchema.describe("The media asset ID for the video clip"),
369
- start_ms: timelineMsSchema.optional().describe("Absolute start time in milliseconds on the timeline"),
370
- media_duration_ms: positiveMsSchema.describe("The source media's intrinsic full length in ms"),
371
- play_in: timelineMsSchema.optional().describe("Trim window start in the media (default 0)"),
372
- play_out: positiveMsSchema.optional().describe("Trim window end in the media (default media_duration_ms)"),
373
- track_id: z.string().min(1).optional().describe("Target track ID (optional, defaults to main track)")
374
- })).min(1).describe("List of video clips to create"),
375
- before_clip_id: z.string().min(1).optional().describe("Insert new clips before this clip ID"),
376
- after_clip_id: z.string().min(1).optional().describe("Insert new clips after this clip ID")
377
- }).superRefine((data, ctx) => {
378
- if (data.before_clip_id != null && data.after_clip_id != null) {
379
- ctx.addIssue({
380
- code: z.ZodIssueCode.custom,
381
- message: "Cannot provide both before_clip_id and after_clip_id"
382
- });
383
- return;
384
- }
385
- const hasRelative = data.before_clip_id != null || data.after_clip_id != null;
386
- for (let i = 0; i < data.clips.length; i++) {
387
- const clip = data.clips[i];
388
- if (hasRelative && clip.start_ms != null) ctx.addIssue({
389
- code: z.ZodIssueCode.custom,
390
- message: `clips[${i}].start_ms must not be provided when using before_clip_id or after_clip_id`,
391
- path: [
392
- "clips",
393
- i,
394
- "start_ms"
395
- ]
396
- });
397
- if (!hasRelative && clip.start_ms == null) ctx.addIssue({
398
- code: z.ZodIssueCode.custom,
399
- message: `clips[${i}].start_ms is required when not using relative positioning`,
400
- path: [
401
- "clips",
402
- i,
403
- "start_ms"
404
- ]
405
- });
406
- const playIn = clip.play_in ?? 0;
407
- const playOut = clip.play_out ?? clip.media_duration_ms;
408
- if (playOut > clip.media_duration_ms) ctx.addIssue({
409
- code: z.ZodIssueCode.custom,
410
- message: `clips[${i}].play_out ${playOut}ms exceeds media_duration_ms ${clip.media_duration_ms}ms`,
411
- path: [
412
- "clips",
413
- i,
414
- "play_out"
415
- ]
416
- });
417
- if (playIn >= playOut) ctx.addIssue({
418
- code: z.ZodIssueCode.custom,
419
- message: `clips[${i}].play_in ${playIn}ms must be less than play_out ${playOut}ms`,
420
- path: [
421
- "clips",
422
- i,
423
- "play_in"
424
- ]
425
- });
426
- }
427
- });
428
- //#endregion
429
- //#region src/editor/schemas/adjust-bgm-volume.ts
430
- const adjustBgmVolumeInputSchema = z.object({ bgm: z.array(z.object({
431
- bgm_id: clipIdSchema.describe("The bgm part ID to adjust volume for"),
432
- volume: volumeSchema.describe("Volume in decibels (-60.0 to 20.0; 0.0 = original)")
433
- })).min(1).describe("List of bgm parts with their new volume settings") });
434
- //#endregion
435
- //#region src/editor/schemas/adjust-speech-volume.ts
436
- const adjustSpeechVolumeInputSchema = z.object({ speeches: z.array(z.object({
437
- speech_id: speechIdSchema.describe("The speech part ID to adjust volume for"),
438
- volume: volumeSchema.describe("Volume in decibels (-60.0 to 20.0; 0.0 = original)")
439
- })).min(1).describe("List of speeches with their new volume settings") });
440
- //#endregion
441
- //#region src/editor/schemas/adjust-video-clip-duration.ts
442
- /**
443
- * Re-trim existing video clips (the user-facing "adjust duration" gesture is a
444
- * trim of the source window). The new `play_in` / `play_out` are the facts; the
445
- * effective timeline duration is derived from them and the clip's `speed_shift`,
446
- * and the change reflows downstream clips, speeches, and the timeline inside the
447
- * op's transaction (no caller-materialized cascade).
448
- */
449
- const adjustVideoClipDurationInputSchema = z.object({ clips: z.array(z.object({
450
- clip_id: clipIdSchema.describe("The video clip part ID to re-trim"),
451
- play_in: timelineMsSchema.describe("New trim window start in the source media"),
452
- play_out: positiveMsSchema.describe("New trim window end in the source media")
453
- })).min(1).describe("Video clips with their new trim windows") });
454
- //#endregion
455
- //#region src/editor/schemas/adjust-video-clip-volume.ts
456
- const adjustVideoClipVolumeInputSchema = z.object({ clips: z.array(z.object({
457
- clip_id: clipIdSchema.describe("The video clip part ID to adjust volume for"),
458
- volume: volumeSchema.describe("Volume in decibels (-60.0 to 20.0; 0.0 = original)")
459
- })).min(1).describe("List of video clips with their new volume settings") });
460
- //#endregion
461
- //#region src/editor/schemas/change-speech.ts
462
- /**
463
- * Change a speech's script or voice. Both re-run TTS upstream and return the
464
- * regenerated speech / caption parts in the same materialized shape as
465
- * `AddSpeeches` (`speech-assets.ts`); the op upserts them by id (the speech part
466
- * id is preserved across a re-TTS), re-seats at `start_ms`, and reflows. Old
467
- * caption parts no longer owned by the speech are removed via `caption_ids`.
468
- */
469
- const changeSpeechScriptInputSchema = speechAssetsSchema.describe("Regenerated speeches + captions (new script)");
470
- const changeSpeechVoiceInputSchema = speechAssetsSchema.describe("Regenerated speeches + captions (new voice)");
471
- //#endregion
472
- //#region src/editor/schemas/delete-bgm.ts
473
- /**
474
- * Remove the document BGM. Pure document edit: clears the bgm lane and removes
475
- * the bgm part. Takes no input (a document holds at most one bgm); an empty
476
- * object keeps the op signature uniform with the rest.
477
- */
478
- const deleteBgmInputSchema = z.object({}).describe("Remove the document BGM (no parameters)");
479
- //#endregion
480
- //#region src/editor/schemas/delete-speeches.ts
481
- /**
482
- * Delete speeches with their captions. Pure document edit (no side effect): the
483
- * op removes each speech part, cascade-deletes the captions it owns (via
484
- * `caption_ids` / `speech_part_id`), drops their track items, and reflows.
485
- */
486
- const deleteSpeechesInputSchema = z.object({ speech_ids: speechIdsSchema.describe("Speech part IDs to delete (their captions cascade-delete)") });
487
- //#endregion
488
- //#region src/editor/schemas/delete-video-clips.ts
489
- /**
490
- * How a delete handles the anchored subtree (speeches anchored to a deleted clip,
491
- * and their captions) — a delete-op policy, not a data-model field (reference/17
492
- * §6). `cascade` (default) removes the subtree; `detach` keeps the direct
493
- * anchored children, re-pinning them to `absolute` so they stay on the timeline.
494
- */
495
- const anchoredDeletePolicySchema = z.enum(["cascade", "detach"]);
496
- const deleteVideoClipsInputSchema = z.object({
497
- clip_ids: clipIdsSchema.describe("List of video clip part IDs to delete from the main track"),
498
- on_anchored: anchoredDeletePolicySchema.optional().describe("How to treat anchored children (default cascade)")
499
- });
500
- //#endregion
501
- //#region src/editor/schemas/move-speeches.ts
502
- /**
503
- * Move speeches in time. Pure document edit: the op re-seats each speech at its
504
- * new absolute `start_ms`; the cascade reassigns it to the host video clip,
505
- * resolves overlaps, and reflows. Captions follow their speech.
506
- */
507
- const moveSpeechesInputSchema = z.object({ speeches: z.array(z.object({
508
- speech_id: speechIdSchema.describe("The speech part ID to move"),
509
- new_start_ms: timelineMsSchema.describe("New absolute start time on the timeline")
510
- })).min(1).describe("Speeches to move to new positions") });
511
- //#endregion
512
- //#region src/editor/schemas/move-video-clips-by-anchor.ts
513
- /**
514
- * Where the moved block lands on the main track.
515
- *
516
- * A discriminated union rather than two optional `before_clip_id` /
517
- * `after_clip_id` fields (the shape `addVideoClips` had to use, because there the
518
- * two modes share a whole clip description): here the alternatives carry nothing
519
- * in common, so making them mutually exclusive *by type* removes three runtime
520
- * `superRefine` checks that would otherwise have to be written and tested.
521
- *
522
- * `track_start` is an explicit member, not the absence of an anchor. The
523
- * agent-harness mutation this maps from treats "neither anchor given" as
524
- * "move to the front" (`applyBatchMoveVideoClips` falls back to `insertIndex = 0`),
525
- * which is a default buried in a tool description. Requiring the caller to name
526
- * that intent keeps a forgotten field from silently reordering the timeline.
527
- */
528
- const moveAnchorSchema = z.discriminatedUnion("position", [
529
- z.object({
530
- position: z.literal("before"),
531
- clip_id: clipIdSchema.describe("The moved block lands immediately before this clip")
532
- }),
533
- z.object({
534
- position: z.literal("after"),
535
- clip_id: clipIdSchema.describe("The moved block lands immediately after this clip")
536
- }),
537
- z.object({ position: z.literal("track_start") })
538
- ]).describe("Where the moved block lands: before/after a reference clip, or at the head of the track");
539
- /**
540
- * What happens to the speeches anchored to the clips being moved.
541
- *
542
- * - `follow` keeps each speech anchored where it is, so it travels with its clip
543
- * to the new position. In the anchored model this is the *no-op* branch: a
544
- * speech's authoritative fact is `{ anchorPartId, offsetMs }` and its absolute
545
- * time is derived on read from the host's position, so moving the host moves
546
- * the speech with no write to the speech at all.
547
- * - `keep_absolute` preserves each speech's current absolute landing instead, then
548
- * re-anchors it to whichever clip now covers that time (RFC 02 §9.1/§11.1). This
549
- * is the branch that costs an extra pass, and the one the FE timeline uses.
550
- *
551
- * **Required, with no default**, matching `deleteVideoClips` and
552
- * `replaceVideoClipSequence`. The two branches decide which picture the user's
553
- * narration ends up over, which is too consequential to infer from a missing
554
- * field — and neither branch is "safe enough" to be the implicit one.
555
- */
556
- const movedClipAnchoredPolicySchema = z.enum(["follow", "keep_absolute"]);
557
- /**
558
- * Reorder a set of main-track clips relative to a reference clip.
559
- *
560
- * Distinct from `moveVideoClips`, which positions clips by absolute time
561
- * (`new_start_ms`) and is what the FE timeline dispatches after a drag. Main-track
562
- * clips are `sequential`-positioned, so absolute time is not authoritative state
563
- * there (RFC 02 §4/§7): `moveVideoClips` has to *guess* an index back out of the
564
- * time it was handed, whereas an anchor already is the ordinal fact being changed.
565
- * Keeping them separate also isolates blast radius — this method can diverge on
566
- * speech policy without touching the FE path.
567
- *
568
- * `clip_ids` need not be contiguous. They move as one block, keeping their
569
- * relative order, which is the agent-harness `batch_move_video_clips` contract.
570
- */
571
- const moveVideoClipsByAnchorInputSchema = z.object({
572
- clip_ids: clipIdsSchema.describe("Clips to move as one block, keeping their relative order. Need not be contiguous on the track."),
573
- anchor: moveAnchorSchema,
574
- on_anchored: movedClipAnchoredPolicySchema.describe("What happens to speeches anchored to the moved clips (required — see the policy doc)")
575
- });
576
- //#endregion
577
- //#region src/editor/schemas/move-video-clips.ts
578
- const moveVideoClipsInputSchema = z.object({ clips: z.array(z.object({
579
- clip_id: clipIdSchema.describe("The video clip part ID to move"),
580
- new_start_ms: timelineMsSchema.describe("New absolute start time in milliseconds on the timeline"),
581
- new_track_id: z.string().min(1).optional().describe("Target track ID to move the clip to (optional)")
582
- })).min(1).describe("List of video clips to move to new positions") });
583
- //#endregion
584
- //#region src/editor/schemas/replace-video-clip-content.ts
585
- /**
586
- * Replace the media backing existing video clips. The media import runs upstream
587
- * (Director); its stable result — the new media id, intrinsic length, and the
588
- * reset trim window — arrives materialized (see
589
- * `results/phase-4-side-effect-payload-contract.md` §4). Director resets
590
- * `play_in=0` / `play_out=media_duration_ms` and clears `speed_shift` on
591
- * replacement. The clip `part_id`s (hence their track items) are unchanged; the
592
- * editor reflows the main track from the new effective durations.
593
- */
594
- const replaceVideoClipContentInputSchema = z.object({ clips: z.array(z.object({
595
- clip_id: clipIdSchema.describe("Existing video clip part ID to re-point"),
596
- origin_media_id: mediaIdSchema.describe("The new media asset ID"),
597
- media_duration_ms: positiveMsSchema.describe("The new media's intrinsic full length"),
598
- play_in: timelineMsSchema.describe("Trim window start in the new media (usually 0)"),
599
- play_out: positiveMsSchema.describe("Trim window end in the new media (usually = media_duration_ms)"),
600
- volume: volumeSchema
601
- })).min(1).describe("Video clips whose media is being replaced") });
602
- //#endregion
603
- //#region src/editor/schemas/replace-video-clip-sequence.ts
604
- /**
605
- * What happens to the speeches anchored to the clips being replaced.
606
- *
607
- * - `remap` re-anchors each surviving speech to the new clip in the SAME POSITION
608
- * of the sequence, keeping its offset — old[i]'s children become new[i]'s
609
- * children. An old clip with no counterpart (fewer new clips than old) has its
610
- * subtree deleted, because there is nothing left to anchor to.
611
- * - `cascade` deletes every anchored speech (and its captions) outright, like
612
- * `deleteVideoClips`.
613
- *
614
- * **Required, with no default.** The two branches differ in whether the user's
615
- * narration survives, and the agent tool that drives this op makes its
616
- * `preserve_speeches` flag required for that reason. A default here would let a
617
- * caller that forgot the field silently delete speech.
618
- */
619
- const anchoredReplacePolicySchema = z.enum(["remap", "cascade"]);
620
- /**
621
- * Replace a contiguous run of main-track clips with a new run.
622
- *
623
- * A composite of delete + insert that cannot be expressed as the two ops in
624
- * sequence, because the anchored speeches have to survive *across* the swap: with
625
- * `remap` they are re-anchored positionally, which needs both the old and the new
626
- * ids in the same transaction (ADR 0009 — the cascade stays in the editor, callers
627
- * never re-wire anchors themselves).
628
- *
629
- * Duration facts follow `addVideoClips`: `media_duration_ms` is the source's
630
- * intrinsic length and the trim window defaults to the whole media. The effective
631
- * timeline duration is derived by the projection, never an input.
632
- *
633
- * `media_id` is optional: omitting it creates a **deliberate empty placeholder
634
- * clip** (`origin_media_id: ''`) — structure with no picture. This is the only op
635
- * that can produce one, and it is authoritative state, unlike the gap fillers the
636
- * read-side solve mints (which never enter the document).
637
- */
638
- const replaceVideoClipSequenceInputSchema = z.object({
639
- old_clip_ids: clipIdsSchema.describe("The clips being replaced: a contiguous main-track run, listed in timeline order"),
640
- new_clips: z.array(z.object({
641
- media_id: mediaIdSchema.optional().describe("The replacement media asset ID. Omit to create an empty placeholder clip."),
642
- media_duration_ms: positiveMsSchema.describe("The source media's intrinsic full length in ms"),
643
- play_in: timelineMsSchema.optional().describe("Trim window start in the media (default 0)"),
644
- play_out: positiveMsSchema.optional().describe("Trim window end in the media (default media_duration_ms)")
645
- })).min(1).describe("The replacement clips, in the order they take on the track"),
646
- on_anchored: anchoredReplacePolicySchema.describe("What happens to speeches anchored to the replaced clips (required — see the policy doc)")
647
- }).superRefine((data, ctx) => {
648
- for (let i = 0; i < data.new_clips.length; i++) {
649
- const clip = data.new_clips[i];
650
- const playIn = clip.play_in ?? 0;
651
- const playOut = clip.play_out ?? clip.media_duration_ms;
652
- if (playOut > clip.media_duration_ms) ctx.addIssue({
653
- code: z.ZodIssueCode.custom,
654
- message: `new_clips[${i}].play_out ${playOut}ms exceeds media_duration_ms ${clip.media_duration_ms}ms`,
655
- path: [
656
- "new_clips",
657
- i,
658
- "play_out"
659
- ]
660
- });
661
- if (playIn >= playOut) ctx.addIssue({
662
- code: z.ZodIssueCode.custom,
663
- message: `new_clips[${i}].play_in ${playIn}ms must be less than play_out ${playOut}ms`,
664
- path: [
665
- "new_clips",
666
- i,
667
- "play_in"
668
- ]
669
- });
670
- }
671
- });
672
- //#endregion
673
- //#region src/editor/schemas/set-bgm.ts
674
- /**
675
- * Set the document BGM. The media's stable result (storage key) arrives
676
- * materialized from upstream (see
677
- * `results/phase-4-side-effect-payload-contract.md` §3). The op upserts the bgm
678
- * part and seats it on the bgm lane; its effective length is always the whole
679
- * timeline, derived by the projection on read — so there is no `duration_ms`
680
- * input or fact (RFC 02 / `reference/16` §0b). A `bgm_id` lets the op replace an
681
- * existing bgm part by id.
682
- */
683
- const setBgmInputSchema = z.object({
684
- bgm_id: z.string().min(1).describe("The bgm part ID to write"),
685
- audio_storage_key: z.string().min(1),
686
- origin_media_id: mediaIdSchema,
687
- volume: volumeSchema
688
- });
689
- //#endregion
690
- //#region src/editor/schemas/set-caption-style.ts
691
- /**
692
- * Set the caption visual style. GLOBAL by design: the style applies to every
693
- * caption part in the document — it carries NO `caption_id`. This mirrors the FE,
694
- * whose caption-style store (`caption-style.ts:persistCaptionStylePatch`) iterates
695
- * ALL captions and writes the same normalized style to each; the product has a
696
- * single document-wide caption style, not per-caption styling.
697
- *
698
- * Every field is optional and maps to a `CaptionStyle` attribute (snake_case
699
- * IDL). A field present in the input is written to every caption; a field ABSENT
700
- * from the input is left untouched on each caption (the editor merges the patch
701
- * onto each caption's existing style — this is a value edit, not a full-style
702
- * replace, so a partial patch such as "recolor only" does not wipe font size).
703
- *
704
- * Pure document edit, no cascade — captions keep their positions; only the style
705
- * sub-map of each caption part changes.
706
- */
707
- const setCaptionStyleInputSchema = z.object({
708
- font_id: z.string().min(1).optional().describe("Font ID referencing a font from the font library"),
709
- font_size: z.number().positive().optional().describe("Font size in points"),
710
- font_color: z.string().min(1).optional().describe("Font color as hex string, e.g. \"#FFFFFF\""),
711
- font_weight: z.number().int().optional().describe("Numeric font weight, e.g. 400 or 700"),
712
- entrance_animation: z.string().optional().describe("Entrance animation preset ID, e.g. \"fade\" or \"none\""),
713
- entrance_animation_duration_ms: z.number().min(0).optional().describe("Entrance animation duration in ms"),
714
- stroke_color: z.string().min(1).optional().describe("Outline/stroke color as hex string, e.g. \"#000000\""),
715
- stroke_width: z.number().min(0).optional().describe("Outline/stroke width in pixels"),
716
- position_x: z.number().optional().describe("Caption center X as a fraction (0.0 to 1.0)"),
717
- position_y: z.number().optional().describe("Caption center Y as a fraction (0.0 to 1.0)")
718
- }).describe("Document-wide caption style patch (no caption_id; applies to every caption)");
719
- //#endregion
720
- //#region src/editor/schemas/set-caption-visibility.ts
721
- /**
722
- * Toggle caption visibility (the caption track's `is_hidden` flag). Pure
723
- * document edit, no cascade — captions keep their positions; only the lane's
724
- * hidden flag changes.
725
- */
726
- const setCaptionVisibilityInputSchema = z.object({ is_hidden: z.boolean().describe("Whether the caption track is hidden") });
727
- //#endregion
728
- //#region src/editor/schemas/set-video-clip-speed-shift.ts
729
- /**
730
- * Set the playback speed of existing video clips. Per the speed-shift decision
731
- * (`reference/16` §0): the op writes only the `speed_shift` fact — it does NOT
732
- * store an effective `duration_ms` (projection derives it from the trim window /
733
- * speed) and does NOT scale anchored speeches' relative offsets (offsets stay
734
- * put; the cascade reflows absolute positions). A `null` speed_shift clears the
735
- * speed back to original (1×).
736
- */
737
- const setVideoClipSpeedShiftInputSchema = z.object({ clips: z.array(z.object({
738
- clip_id: clipIdSchema.describe("The video clip part ID to set speed for"),
739
- speed_shift: speedShiftSchema.nullable().describe("The new speed setting, or null to reset to 1×")
740
- })).min(1).describe("Video clips with their new speed settings") });
741
- //#endregion
742
- //#region src/editor/schemas/index.ts
743
- var schemas_exports = /* @__PURE__ */ __exportAll({
744
- addSpeechesInputSchema: () => addSpeechesInputSchema,
745
- addVideoClipsInputSchema: () => addVideoClipsInputSchema,
746
- adjustBgmVolumeInputSchema: () => adjustBgmVolumeInputSchema,
747
- adjustSpeechVolumeInputSchema: () => adjustSpeechVolumeInputSchema,
748
- adjustVideoClipDurationInputSchema: () => adjustVideoClipDurationInputSchema,
749
- adjustVideoClipVolumeInputSchema: () => adjustVideoClipVolumeInputSchema,
750
- anchoredDeletePolicySchema: () => anchoredDeletePolicySchema,
751
- anchoredReplacePolicySchema: () => anchoredReplacePolicySchema,
752
- changeSpeechScriptInputSchema: () => changeSpeechScriptInputSchema,
753
- changeSpeechVoiceInputSchema: () => changeSpeechVoiceInputSchema,
754
- clipIdSchema: () => clipIdSchema,
755
- clipIdsSchema: () => clipIdsSchema,
756
- deleteBgmInputSchema: () => deleteBgmInputSchema,
757
- deleteSpeechesInputSchema: () => deleteSpeechesInputSchema,
758
- deleteVideoClipsInputSchema: () => deleteVideoClipsInputSchema,
759
- mediaIdSchema: () => mediaIdSchema,
760
- moveAnchorSchema: () => moveAnchorSchema,
761
- moveSpeechesInputSchema: () => moveSpeechesInputSchema,
762
- moveVideoClipsByAnchorInputSchema: () => moveVideoClipsByAnchorInputSchema,
763
- moveVideoClipsInputSchema: () => moveVideoClipsInputSchema,
764
- movedClipAnchoredPolicySchema: () => movedClipAnchoredPolicySchema,
765
- positiveMsSchema: () => positiveMsSchema,
766
- replaceVideoClipContentInputSchema: () => replaceVideoClipContentInputSchema,
767
- replaceVideoClipSequenceInputSchema: () => replaceVideoClipSequenceInputSchema,
768
- setBgmInputSchema: () => setBgmInputSchema,
769
- setCaptionStyleInputSchema: () => setCaptionStyleInputSchema,
770
- setCaptionVisibilityInputSchema: () => setCaptionVisibilityInputSchema,
771
- setVideoClipSpeedShiftInputSchema: () => setVideoClipSpeedShiftInputSchema,
772
- speechAssetsSchema: () => speechAssetsSchema,
773
- speechIdSchema: () => speechIdSchema,
774
- speechIdsSchema: () => speechIdsSchema,
775
- speedShiftSchema: () => speedShiftSchema,
776
- timelineMsSchema: () => timelineMsSchema,
777
- voiceSchema: () => voiceSchema,
778
- volumeSchema: () => volumeSchema
779
- });
780
- //#endregion
781
220
  //#region src/editor/snapshot-utils.ts
782
221
  function isMap(value) {
783
222
  return value instanceof Map;
@@ -1126,9 +565,11 @@ function readPartLibrary(draft) {
1126
565
  var SemanticEditor = class {
1127
566
  doc;
1128
567
  validator;
1129
- constructor(doc, validator = new SchemaValidator()) {
568
+ idFactory;
569
+ constructor(doc, validator = new SchemaValidator(), idFactory = generatePartId) {
1130
570
  this.doc = doc;
1131
571
  this.validator = validator;
572
+ this.idFactory = idFactory;
1132
573
  }
1133
574
  async moveVideoClips(input, options) {
1134
575
  this.validator.validateMoveVideoClips(input, this.doc);
@@ -1208,7 +649,7 @@ var SemanticEditor = class {
1208
649
  track.items ??= [];
1209
650
  let at = insertIndex;
1210
651
  for (const clip of input.clips) {
1211
- const partId = generatePartId("clip");
652
+ const partId = this.idFactory("clip");
1212
653
  setPart(draft, partId, { video_clip: {
1213
654
  id: partId,
1214
655
  kind: "video_clip",
@@ -1255,7 +696,7 @@ var SemanticEditor = class {
1255
696
  const newItems = [];
1256
697
  const newClipIds = [];
1257
698
  for (const clip of input.new_clips) {
1258
- const partId = generatePartId("clip");
699
+ const partId = this.idFactory("clip");
1259
700
  setPart(draft, partId, { video_clip: {
1260
701
  id: partId,
1261
702
  kind: "video_clip",
@@ -1875,6 +1316,111 @@ function deleteAnchoredSubtree(draft, clipId) {
1875
1316
  for (const speechId of anchored) deleteSpeechSubtree(draft, speechId);
1876
1317
  }
1877
1318
  //#endregion
1319
+ //#region src/editor/journal.ts
1320
+ /**
1321
+ * Wire a plain-memory adapter + editor that share a recording id factory, so
1322
+ * every mutating transact lands in `journal` with ordered `generated_ids`.
1323
+ */
1324
+ function createEditSandbox(document, options) {
1325
+ const adapter = createPlainMemoryAdapter(document, options);
1326
+ return {
1327
+ adapter,
1328
+ editor: new SemanticEditor(adapter, new SchemaValidator(), adapter.idFactory),
1329
+ journal: adapter.journal
1330
+ };
1331
+ }
1332
+ /**
1333
+ * Re-drive `doc` from a recorded journal, forcing each entry's `generated_ids`
1334
+ * through a queue-backed id factory. Never mints fresh ids: an empty queue on
1335
+ * demand throws `unrecorded id`; leftover ids after an entry throws
1336
+ * `unconsumed ids`. Legacy entries without `generated_ids` are treated as `[]`.
1337
+ */
1338
+ async function replayJournal(doc, journal) {
1339
+ const queue = [];
1340
+ const idFactory = (_prefix) => {
1341
+ const id = queue.shift();
1342
+ if (id == null) throw new Error("unrecorded id");
1343
+ return id;
1344
+ };
1345
+ const editor = new SemanticEditor(doc, new SchemaValidator(), idFactory);
1346
+ for (const entry of journal) {
1347
+ queue.push(...entry.generated_ids ?? []);
1348
+ await dispatchEntry(editor, entry);
1349
+ if (queue.length > 0) throw new Error("unconsumed ids");
1350
+ }
1351
+ }
1352
+ /** Dispatch one journal entry to the matching editor method; payload is passed through. */
1353
+ async function dispatchEntry(editor, entry) {
1354
+ const payload = entry.payload;
1355
+ const options = entry.intent != null ? { intent: entry.intent } : void 0;
1356
+ switch (entry.kind) {
1357
+ case "MoveVideoClips":
1358
+ await editor.moveVideoClips(payload, options);
1359
+ return;
1360
+ case "MoveVideoClipsByAnchor":
1361
+ await editor.moveVideoClipsByAnchor(payload, options);
1362
+ return;
1363
+ case "DeleteVideoClips":
1364
+ await editor.deleteVideoClips(payload, options);
1365
+ return;
1366
+ case "AddVideoClips":
1367
+ await editor.addVideoClips(payload, options);
1368
+ return;
1369
+ case "AdjustVideoClipVolume":
1370
+ await editor.adjustVideoClipVolume(payload, options);
1371
+ return;
1372
+ case "SetVideoClipSpeedShift":
1373
+ await editor.setVideoClipSpeedShift(payload, options);
1374
+ return;
1375
+ case "ReplaceVideoClipContent":
1376
+ await editor.replaceVideoClipContent(payload, options);
1377
+ return;
1378
+ case "ReplaceVideoClipSequence":
1379
+ await editor.replaceVideoClipSequence(payload, options);
1380
+ return;
1381
+ case "AdjustVideoClipDuration":
1382
+ await editor.adjustVideoClipDuration(payload, options);
1383
+ return;
1384
+ case "AddSpeeches":
1385
+ await editor.addSpeeches(payload, options);
1386
+ return;
1387
+ case "DeleteSpeeches":
1388
+ await editor.deleteSpeeches(payload, options);
1389
+ return;
1390
+ case "MoveSpeeches":
1391
+ await editor.moveSpeeches(payload, options);
1392
+ return;
1393
+ case "ChangeSpeechScript":
1394
+ await editor.changeSpeechScript(payload, options);
1395
+ return;
1396
+ case "ChangeSpeechVoice":
1397
+ await editor.changeSpeechVoice(payload, options);
1398
+ return;
1399
+ case "AdjustSpeechVolume":
1400
+ await editor.adjustSpeechVolume(payload, options);
1401
+ return;
1402
+ case "SetCaptionVisibility":
1403
+ await editor.setCaptionVisibility(payload, options);
1404
+ return;
1405
+ case "SetCaptionStyle":
1406
+ await editor.setCaptionStyle(payload, options);
1407
+ return;
1408
+ case "SetBgm":
1409
+ await editor.setBgm(payload, options);
1410
+ return;
1411
+ case "DeleteBgm":
1412
+ await editor.deleteBgm(payload, options);
1413
+ return;
1414
+ case "AdjustBgmVolume":
1415
+ await editor.adjustBgmVolume(payload, options);
1416
+ return;
1417
+ default: {
1418
+ const _exhaustive = entry.kind;
1419
+ throw new Error(`replayJournal: unsupported kind ${String(_exhaustive)}`);
1420
+ }
1421
+ }
1422
+ }
1423
+ //#endregion
1878
1424
  //#region src/editor/types.ts
1879
1425
  /** Runtime list of the frozen, implemented kinds (for guards / introspection). */
1880
1426
  const IMPLEMENTED_SEMANTIC_OP_KINDS = [
@@ -2348,13 +1894,18 @@ var MedeoHttpDocStorage = class {
2348
1894
  };
2349
1895
  }
2350
1896
  /**
2351
- * Forward one update to the server.
1897
+ * Forward one update to the server, returning what the server says it now holds.
2352
1898
  *
2353
- * The `DocStorage` contract returns `void`, so the server's verdict cannot be
2354
- * the return value it is published on {@link subscribePushOutcome} instead,
2355
- * for BOTH outcomes and failures. That channel is what makes the push
2356
- * observable; previously the verdict was read and dropped, so a `duplicate`
2357
- * (bytes contributed nothing) was indistinguishable from a successful write.
1899
+ * The returned `server_vv` is the server's own statement about itself, computed
1900
+ * inside the write transaction. A caller tracking "what the remote has" can
1901
+ * adopt it directly, which is strictly better than inferring that bound from
1902
+ * the pushed blob: it also covers ops other peers wrote, so those stop being
1903
+ * re-sent on every later push. `ack` and `duplicate` both carry it.
1904
+ *
1905
+ * The verdict itself stays on {@link subscribePushOutcome}, which reports
1906
+ * failures too — a return value cannot. Previously the verdict was read and
1907
+ * dropped, so a `duplicate` (bytes contributed nothing) was indistinguishable
1908
+ * from a successful write.
2358
1909
  *
2359
1910
  * The error is still rethrown after being published: the synchronizer treats a
2360
1911
  * throw as "retry this cycle", and swallowing it here would strand the update.
@@ -2362,14 +1913,17 @@ var MedeoHttpDocStorage = class {
2362
1913
  */
2363
1914
  async pushDocUpdate(update, _origin) {
2364
1915
  this.assertDocId(update.docId);
2365
- if (this.isReadonly || update.data.byteLength === 0) return;
1916
+ if (this.isReadonly) throw new Error(`MedeoHttpDocStorage is readonly; refusing to push ${update.docId}`);
1917
+ if (update.data.byteLength === 0) return {};
2366
1918
  try {
2367
1919
  const response = await this.client.pushUpdate(update.data);
1920
+ const serverVV = decodeServerVV(response.version?.server_vv);
2368
1921
  this.events.emit("pushOutcome", {
2369
1922
  kind: response.kind,
2370
1923
  updateSeq: response.update_seq ?? void 0,
2371
- serverVV: decodeServerVV(response.version?.server_vv)
1924
+ serverVV
2372
1925
  });
1926
+ return { version: serverVV };
2373
1927
  } catch (error) {
2374
1928
  const failure = error instanceof Error ? error : new Error(String(error));
2375
1929
  const rejected = error instanceof MenginePushRejectedError;
@@ -2467,6 +2021,7 @@ var MemoryDocStorage = class extends BaseDocStorage {
2467
2021
  },
2468
2022
  origin
2469
2023
  });
2024
+ return {};
2470
2025
  }
2471
2026
  async deleteDoc(docId) {
2472
2027
  this.entries.delete(docId);
@@ -2659,6 +2214,24 @@ var MengineDocSession = class {
2659
2214
  if (this.editorValue == null) throw new Error("mengine doc session is not started");
2660
2215
  return this.editorValue;
2661
2216
  }
2217
+ /**
2218
+ * Opaque version token of the local oplog (base64 `VersionVector.encode`).
2219
+ * Equality-comparable only: equal means no observed change (local or
2220
+ * remote-arrived) since the token was taken. Throws when not started.
2221
+ */
2222
+ version() {
2223
+ if (this.adapterValue == null) throw new Error("mengine doc session is not started");
2224
+ return bytesToBase64(this.adapterValue.doc.oplogVersion().encode());
2225
+ }
2226
+ /**
2227
+ * The live document adapter, exposed for journal replay (commit channel).
2228
+ * Replaying through it still goes SemanticEditor → Loro → mengine-server —
2229
+ * no write bypass. Typed by the narrow interface on purpose.
2230
+ */
2231
+ get documentAdapter() {
2232
+ if (this.adapterValue == null) throw new Error("mengine doc session is not started");
2233
+ return this.adapterValue;
2234
+ }
2662
2235
  /** Current document snapshot (read model). */
2663
2236
  snapshot() {
2664
2237
  if (this.adapterValue == null) throw new Error("mengine doc session is not started");
@@ -2769,4 +2342,4 @@ function serverCovers(serverVV, target) {
2769
2342
  return covers(server, target);
2770
2343
  }
2771
2344
  //#endregion
2772
- export { IMPLEMENTED_SEMANTIC_OP_KINDS, LANE_KINDS_IN_STACK_ORDER, ManualSyncDoc, MedeoHttpDocStorage, MemoryDocStorage, MengineAckFailedError, MengineDocSession, MengineHttpClient, MengineHttpRequestError, MenginePushRejectedError, MirrorVideoDocumentAdapter, SchemaValidator, SemanticEditor, TIMELINE_SKELETON_DURATION_MS, VIDEO_DOCUMENT_SCHEMA_VERSION, ValidationError, VideoDocumentValidationError, arrangeMainTrackSeamlessly, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, decodeDocVersionMark, derivePositionFromAbs, encodeDocVersionMark, ensureLaneTrack, fillMainTrackTimeGaps, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, partDurationMs, partUnionSchema, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, resolveAllSpeechOverlaps, resolveSpeechOverlapByShiftingVideos, safeDurationMs, schemas_exports as schemas, snapshotToPlain, solveVideoDocument, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema };
2345
+ export { DEFAULT_UNIT_TIME_MS, IMPLEMENTED_SEMANTIC_OP_KINDS, LANE_KINDS_IN_STACK_ORDER, ManualSyncDoc, MedeoHttpDocStorage, MemoryDocStorage, MengineAckFailedError, MengineDocSession, MengineHttpClient, MengineHttpRequestError, MenginePushRejectedError, MirrorVideoDocumentAdapter, PlainMemoryAdapter, SchemaValidator, SemanticEditor, TIMELINE_SKELETON_DURATION_MS, VIDEO_DOCUMENT_SCHEMA_VERSION, ValidationError, VideoDocumentValidationError, arrangeMainTrackSeamlessly, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureLaneTrack, fillMainTrackTimeGaps, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, partDurationMs, partUnionSchema, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveSpeechOverlapByShiftingVideos, safeDurationMs, schemas_exports as schemas, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema, writeVideoDocumentToDraft };