@mengine/medeo-client 1.2.1-alpha.10 → 1.2.1-alpha.11
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/README.md +1 -91
- package/dist/document-C0o_cjAH.js +1654 -0
- package/dist/{index-PAM9x_fu.d.ts → index-DWVYLTjv.d.ts} +625 -265
- package/dist/index.d.ts +53 -434
- package/dist/index.js +686 -2482
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -40
- package/package.json +5 -9
- package/dist/document-CC9M0bf9.js +0 -3261
- package/dist/index-CMa6ZCtX.d.ts +0 -609
- package/dist/schemas.d.ts +0 -2
- package/dist/schemas.js +0 -482
- package/dist/shared-iWnU2osE.js +0 -39
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as VoiceDescriptor, A as generatePartId, At as Attachment, B as ResolvedEntityClipPlacement, C as PlannedSemanticOpKind, Ct as VideoDocumentSchemaVersion, D as SnapshotReadable, Dt as VideoDraftPartUnion, E as SchemaValidator, Et as VideoDraft, F as videoDocumentMirrorSchema, Ft as Timeline$1, G as EntityTimelineProjectionError, H as ResolvedEntityTrack, I as VideoDocumentValidationError, It as Track$1, J as JsonObject, K as EntityRelationRows, L as assertValidVideoDocument, Lt as TrackItem$1, M as TrackItemDraft, Mt as CaptionStyle, N as VideoDocumentDraft, Nt as PartAggregation, O as ValidationError, Ot as effectiveVideoClipDurationMs, P as VideoDocumentMirrorSchema, Pt as SpeedShift, Q as SequenceRange, R as validateVideoDocument, S as ImplementedSemanticOpKind, St as VideoDocument, T as isImplementedSemanticOpKind, Tt as VideoDocumentValidationIssueCode, U as resolveEntityTimelineLayout, V as ResolvedEntityTimelineLayout, W as projectEntityTimeline, X as CaptionStyleFields, Y as JsonValue, Z as SequenceDuration, _ as SemanticEditor, _t as Track, a as PlainMemoryAdapter, at as buildSpeechHostMap, b as TransactAudit, bt as VIDEO_DOCUMENT_SCHEMA_VERSION, c as MirrorVideoDocumentAdapter, ct as toVideoDocument, d as createMirrorVideoDocument, dt as DEFAULT_UNIT_TIME_MS, et as EntityId, f as createMirrorVideoDocumentAdapter, ft as ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, g as SemanticDocumentAdapter, gt as Timeline, h as OpActor, ht as SpeechPart, i as JournalEntry, it as SpeechHostMap, j as TrackDraft, jt as CaptionPart$1, k as PartIdFactory, kt as speedOf, l as MirrorVideoDocumentOptions, lt as BgmPart, m as CommitOptions, mt as PartUnion, n as videoDocumentSchema, nt as buildInitialVideoDocument, o as PlainMemoryAdapterOptions, ot as derivePositionFromAbs, p as writeVideoDocumentToDraft, pt as PartKind, q as EntityRow, r as readVideoDocumentFromDraft, rt as DerivedItemPosition, s as createPlainMemoryAdapter, st as fromVideoDocument, t as partUnionSchema, tt as InitialDocumentFacts, u as applyEntityTimelineProjection, ut as CaptionPart, v as SemanticOpInput, vt as TrackItem, w as SemanticOpKind, wt as VideoDocumentValidationIssue, x as IMPLEMENTED_SEMANTIC_OP_KINDS, xt as VideoClipPart, y as SemanticOpName, yt as TrackItemTimePosition, z as EntityTimelineTrackRole } from "./index-PAM9x_fu.js";
|
|
1
|
+
import { $ as VideoDocumentSchemaVersion, A as assertValidVideoDocument, B as BgmPart, C as index_d_exports, D as VideoDocumentMirrorSchema, E as VideoDocumentDraft, F as SpeechHostMap, G as SpeechPart, H as DEFAULT_UNIT_TIME_MS, I as buildSpeechHostMap, J as TrackItem, K as Timeline, L as derivePositionFromAbs, M as InitialDocumentFacts, N as buildInitialVideoDocument, O as videoDocumentMirrorSchema, P as DerivedItemPosition, Q as VideoDocument, R as fromVideoDocument, S as ValidationError, T as TrackItemDraft, U as PartKind, V as CaptionPart, W as PartUnion, X as VIDEO_DOCUMENT_SCHEMA_VERSION, Y as TrackItemTimePosition, Z as VideoClipPart, _ as PlannedSemanticOpKind, a as MirrorVideoDocumentOptions, at as CaptionPart$1, b as SchemaValidator, c as CommitOptions, ct as SpeedShift, d as SemanticEditor, dt as TrackItem$1, et as VideoDocumentValidationIssue, f as SemanticOpInput, g as ImplementedSemanticOpKind, h as IMPLEMENTED_SEMANTIC_OP_KINDS, i as MirrorVideoDocumentAdapter, it as Attachment, j as validateVideoDocument, k as VideoDocumentValidationError, l as OpActor, lt as Timeline$1, m as TransactAudit, n as videoDocumentSchema, nt as VideoDraft, o as createMirrorVideoDocument, ot as CaptionStyle, p as SemanticOpName, q as Track, r as readVideoDocumentFromDraft, rt as VideoDraftPartUnion, s as createMirrorVideoDocumentAdapter, st as PartAggregation, t as partUnionSchema, tt as VideoDocumentValidationIssueCode, u as SemanticDocumentAdapter, ut as Track$1, v as SemanticOpKind, w as TrackDraft, x as SnapshotReadable, y as isImplementedSemanticOpKind, z as toVideoDocument } from "./index-DWVYLTjv.js";
|
|
3
2
|
import { PeerID } from "loro-crdt";
|
|
4
3
|
import { DocState } from "@mengine/sync";
|
|
5
4
|
import { BaseDocStorage, Connection, DocDiff, DocPushReceipt, DocSnapshotRecord, DocStorage, DocStorageOptions, DocUpdate, DocUpdateRecord } from "@mengine/storage";
|
|
@@ -178,410 +177,33 @@ interface MengineEventStreamOptions {
|
|
|
178
177
|
}
|
|
179
178
|
declare function readMengineEventStream(options: MengineEventStreamOptions): Promise<void>;
|
|
180
179
|
//#endregion
|
|
181
|
-
//#region src/
|
|
182
|
-
/** One authenticated revision of the authoritative Medeo Entity graph. */
|
|
183
|
-
interface EntityGraphState {
|
|
184
|
-
readonly revision: number;
|
|
185
|
-
readonly rows: EntityRelationRows;
|
|
186
|
-
}
|
|
187
|
-
interface EntityGraphCommitOptions {
|
|
188
|
-
/** Server version vector proving the explicit legacy-to-Entity migration baseline. */
|
|
189
|
-
readonly migrationBaseVv?: string;
|
|
190
|
-
}
|
|
191
|
-
/** Browser-safe authenticated CAS client for a document's Entity graph. */
|
|
192
|
-
declare class EntityGraphHttpClient {
|
|
193
|
-
private readonly options;
|
|
194
|
-
private readonly transport;
|
|
195
|
-
private readonly endpoint;
|
|
196
|
-
constructor(options: MengineHttpClientOptions);
|
|
197
|
-
fetchState(): Promise<EntityGraphState>;
|
|
198
|
-
/**
|
|
199
|
-
* Replace the complete Entity graph under the baseline revision.
|
|
200
|
-
*
|
|
201
|
-
* Deletion intent is derived from baseline IDs omitted from `nextRows`, so a
|
|
202
|
-
* transient create-then-remove never becomes a request to delete unknown
|
|
203
|
-
* persisted data.
|
|
204
|
-
*/
|
|
205
|
-
commit(baseState: EntityGraphState, nextRows: EntityRelationRows, options?: EntityGraphCommitOptions): Promise<EntityGraphState>;
|
|
206
|
-
private request;
|
|
207
|
-
}
|
|
208
|
-
//#endregion
|
|
209
|
-
//#region src/entity-editor/types.d.ts
|
|
210
|
-
/** Injectable domain-id mint shared by Entity and Relation authoring surfaces. */
|
|
211
|
-
type EntityTimelineIdFactory = (prefix: 'entity' | 'relation') => string;
|
|
212
|
-
interface ImageMediaAssetFact {
|
|
213
|
-
readonly assetId: string;
|
|
214
|
-
readonly kind: 'image';
|
|
215
|
-
readonly storageKey?: string;
|
|
216
|
-
}
|
|
217
|
-
interface VideoMediaAssetFact {
|
|
218
|
-
readonly assetId: string;
|
|
219
|
-
readonly kind: 'video';
|
|
220
|
-
readonly durationMs: number;
|
|
221
|
-
readonly storageKey?: string;
|
|
222
|
-
}
|
|
223
|
-
interface AudioMediaAssetFact {
|
|
224
|
-
readonly assetId: string;
|
|
225
|
-
readonly kind: 'audio';
|
|
226
|
-
readonly durationMs: number;
|
|
227
|
-
readonly storageKey: string;
|
|
228
|
-
}
|
|
229
|
-
interface VoiceMediaAssetFact {
|
|
230
|
-
/** Stable external speech result id, independent of the placed Clip id. */
|
|
231
|
-
readonly assetId: string;
|
|
232
|
-
readonly kind: 'voice';
|
|
233
|
-
readonly durationMs: number;
|
|
234
|
-
readonly storageKey: string;
|
|
235
|
-
readonly voice: VoiceDescriptor;
|
|
236
|
-
}
|
|
237
|
-
/** Facts resolved from media storage. A trim window never substitutes for intrinsic duration. */
|
|
238
|
-
type MediaAssetFact = ImageMediaAssetFact | VideoMediaAssetFact | AudioMediaAssetFact | VoiceMediaAssetFact;
|
|
239
|
-
type ClipPlacement = {
|
|
240
|
-
readonly kind: 'sequential';
|
|
241
|
-
readonly order: number;
|
|
242
|
-
} | {
|
|
243
|
-
readonly kind: 'absolute';
|
|
244
|
-
readonly targetRange: SequenceRange<number>;
|
|
245
|
-
} | {
|
|
246
|
-
readonly kind: 'anchored';
|
|
247
|
-
readonly hostClipEntityId: string;
|
|
248
|
-
readonly anchorOffset: number;
|
|
249
|
-
};
|
|
250
|
-
interface InsertPlacedClipInput {
|
|
251
|
-
readonly trackEntityId: string;
|
|
252
|
-
readonly contentEntityId: string;
|
|
253
|
-
readonly sourceRange: SequenceRange<number>;
|
|
254
|
-
readonly duration: SequenceDuration<number>;
|
|
255
|
-
readonly placement: ClipPlacement;
|
|
256
|
-
readonly clipPayload?: JsonObject;
|
|
257
|
-
/** Stable caller-owned placement identity, when one already exists outside the graph. */
|
|
258
|
-
readonly clipEntityId?: string;
|
|
259
|
-
}
|
|
260
|
-
interface SetClipPlacementInput {
|
|
261
|
-
readonly clipEntityId: string;
|
|
262
|
-
readonly placement: ClipPlacement;
|
|
263
|
-
}
|
|
264
|
-
type SequentialClipAnchor = {
|
|
265
|
-
readonly position: 'before' | 'after';
|
|
266
|
-
readonly clipEntityId: string;
|
|
267
|
-
} | {
|
|
268
|
-
readonly position: 'trackStart';
|
|
269
|
-
};
|
|
270
|
-
interface MoveSequentialClipsInput {
|
|
271
|
-
readonly clipEntityIds: readonly string[];
|
|
272
|
-
readonly anchor: SequentialClipAnchor;
|
|
273
|
-
readonly onAnchored: 'follow' | 'keepAbsolute';
|
|
274
|
-
}
|
|
275
|
-
interface MoveClipsToStartsInput {
|
|
276
|
-
readonly moves: readonly {
|
|
277
|
-
readonly clipEntityId: string;
|
|
278
|
-
readonly newStartMs: number;
|
|
279
|
-
}[];
|
|
280
|
-
/** Absolute-time drags preserve every voiceover's current visible landing. */
|
|
281
|
-
readonly onAnchored: 'keepAbsolute';
|
|
282
|
-
}
|
|
283
|
-
interface DeleteClipTreeInput {
|
|
284
|
-
readonly clipEntityIds: readonly string[];
|
|
285
|
-
readonly onAnchored: 'cascade' | 'detach';
|
|
286
|
-
}
|
|
287
|
-
interface VoiceoverCaptionFact {
|
|
288
|
-
/** Stable placed caption identity supplied by the materialized side effect. */
|
|
289
|
-
readonly captionClipEntityId: string;
|
|
290
|
-
readonly text: string;
|
|
291
|
-
readonly startMs: number;
|
|
292
|
-
readonly durationMs: number;
|
|
293
|
-
readonly style?: CaptionStyleFields;
|
|
294
|
-
}
|
|
295
|
-
interface VoiceoverTakeInput {
|
|
296
|
-
readonly timelineEntityId: string;
|
|
297
|
-
/** Stable placed speech identity, distinct from media.assetId. */
|
|
298
|
-
readonly voiceoverClipEntityId: string;
|
|
299
|
-
readonly hostClipEntityId: string;
|
|
300
|
-
readonly anchorOffset: number;
|
|
301
|
-
readonly media: VoiceMediaAssetFact;
|
|
302
|
-
/** Complete spoken text; the editor owns the deterministic local script segment identity. */
|
|
303
|
-
readonly scriptText: string;
|
|
304
|
-
readonly volume: number;
|
|
305
|
-
readonly captions: readonly VoiceoverCaptionFact[];
|
|
306
|
-
}
|
|
307
|
-
type VisualMediaAssetFact = ImageMediaAssetFact | VideoMediaAssetFact;
|
|
308
|
-
interface InsertMediaClipInput {
|
|
309
|
-
readonly timelineEntityId: string;
|
|
310
|
-
readonly clipEntityId?: string;
|
|
311
|
-
readonly media: VisualMediaAssetFact;
|
|
312
|
-
/** Source/display window in whole milliseconds. Images use this as their finite display span. */
|
|
313
|
-
readonly sourceRange: SequenceRange<number>;
|
|
314
|
-
readonly placement: ClipPlacement;
|
|
315
|
-
readonly volume?: number;
|
|
316
|
-
}
|
|
317
|
-
interface ReplaceMediaClipInput {
|
|
318
|
-
readonly clipEntityId: string;
|
|
319
|
-
readonly media: VisualMediaAssetFact;
|
|
320
|
-
readonly sourceRange: SequenceRange<number>;
|
|
321
|
-
}
|
|
322
|
-
interface ReplacementMediaClipInput {
|
|
323
|
-
readonly clipEntityId?: string;
|
|
324
|
-
readonly media: VisualMediaAssetFact;
|
|
325
|
-
readonly sourceRange: SequenceRange<number>;
|
|
326
|
-
readonly volume?: number;
|
|
327
|
-
}
|
|
328
|
-
type MediaClipInsertion = {
|
|
329
|
-
readonly kind: 'before';
|
|
330
|
-
readonly clipEntityId: string;
|
|
331
|
-
} | {
|
|
332
|
-
readonly kind: 'after';
|
|
333
|
-
readonly clipEntityId: string;
|
|
334
|
-
} | {
|
|
335
|
-
readonly kind: 'firstStart';
|
|
336
|
-
readonly startMs: number;
|
|
337
|
-
};
|
|
338
|
-
interface InsertMediaClipsInput {
|
|
339
|
-
readonly timelineEntityId: string;
|
|
340
|
-
readonly clips: readonly ReplacementMediaClipInput[];
|
|
341
|
-
/** One placement decision for the whole input-ordered block. */
|
|
342
|
-
readonly insertion: MediaClipInsertion;
|
|
343
|
-
}
|
|
344
|
-
interface ReplaceSequentialClipsInput {
|
|
345
|
-
readonly timelineEntityId: string;
|
|
346
|
-
readonly oldClipEntityIds: readonly string[];
|
|
347
|
-
readonly newClips: readonly ReplacementMediaClipInput[];
|
|
348
|
-
readonly onAnchored: 'remap' | 'cascade';
|
|
349
|
-
}
|
|
350
|
-
interface SetClipVolumeInput {
|
|
351
|
-
readonly clipEntityId: string;
|
|
352
|
-
/** Playback gain in decibels. */
|
|
353
|
-
readonly volume: number;
|
|
354
|
-
}
|
|
355
|
-
interface LinearClipSpeed {
|
|
356
|
-
readonly kind: 'linear';
|
|
357
|
-
readonly rate: number;
|
|
358
|
-
readonly mode?: string;
|
|
359
|
-
}
|
|
360
|
-
interface SetClipSpeedInput {
|
|
361
|
-
readonly clipEntityId: string;
|
|
362
|
-
readonly timeRemapping: LinearClipSpeed | null;
|
|
363
|
-
}
|
|
364
|
-
interface TrimClipInput {
|
|
365
|
-
readonly clipEntityId: string;
|
|
366
|
-
readonly sourceRange: SequenceRange<number>;
|
|
367
|
-
}
|
|
368
|
-
interface VoiceoverTakeResult {
|
|
369
|
-
readonly voiceoverClipEntityId: string;
|
|
370
|
-
readonly voiceEntityId: string;
|
|
371
|
-
readonly audioScriptEntityId: string;
|
|
372
|
-
readonly captionClipEntityIds: readonly string[];
|
|
373
|
-
}
|
|
374
|
-
interface MoveVoiceoverInput {
|
|
375
|
-
readonly voiceoverClipEntityId: string;
|
|
376
|
-
/** Absolute requested timeline start; MEngine resolves and persists the host relation. */
|
|
377
|
-
readonly newStartMs: number;
|
|
378
|
-
}
|
|
379
|
-
interface DeleteVoiceoverInput {
|
|
380
|
-
readonly voiceoverClipEntityIds: readonly string[];
|
|
381
|
-
}
|
|
382
|
-
interface SetBgmInput {
|
|
383
|
-
readonly timelineEntityId: string;
|
|
384
|
-
readonly bgmClipEntityId: string;
|
|
385
|
-
readonly media: AudioMediaAssetFact;
|
|
386
|
-
readonly volume: number;
|
|
387
|
-
}
|
|
388
|
-
interface DeleteBgmInput {
|
|
389
|
-
readonly timelineEntityId: string;
|
|
390
|
-
}
|
|
391
|
-
interface SetCaptionVisibilityInput {
|
|
392
|
-
readonly timelineEntityId: string;
|
|
393
|
-
readonly hidden: boolean;
|
|
394
|
-
}
|
|
395
|
-
interface PatchCaptionStyleInput {
|
|
396
|
-
readonly timelineEntityId: string;
|
|
397
|
-
readonly style: CaptionStyleFields;
|
|
398
|
-
}
|
|
399
|
-
interface InsertClipInput {
|
|
400
|
-
readonly trackEntityId: string;
|
|
401
|
-
/** Existing Sequence media Entity id. Asset ids and URLs are not content ids. */
|
|
402
|
-
readonly contentEntityId: string;
|
|
403
|
-
readonly sourceRange: SequenceRange<number>;
|
|
404
|
-
readonly duration: SequenceDuration<number>;
|
|
405
|
-
readonly targetRange?: SequenceRange<number>;
|
|
406
|
-
readonly clipPayload?: JsonObject;
|
|
407
|
-
}
|
|
408
|
-
interface UpdateClipMarkerInput {
|
|
409
|
-
readonly clipEntityId: string;
|
|
410
|
-
readonly sourceRange?: SequenceRange<number>;
|
|
411
|
-
/** Passing `undefined` explicitly removes the optional target range. */
|
|
412
|
-
readonly targetRange?: SequenceRange<number> | undefined;
|
|
413
|
-
readonly duration?: SequenceDuration<number>;
|
|
414
|
-
/** Passing `undefined` explicitly removes the optional remapping value. */
|
|
415
|
-
readonly timeRemapping?: JsonValue | undefined;
|
|
416
|
-
}
|
|
417
|
-
interface MoveClipInput {
|
|
418
|
-
readonly clipEntityId: string;
|
|
419
|
-
readonly trackEntityId: string;
|
|
420
|
-
}
|
|
421
|
-
interface ReplaceClipContentInput {
|
|
422
|
-
readonly clipEntityId: string;
|
|
423
|
-
/** Existing Sequence media Entity id. Asset ids and URLs are not content ids. */
|
|
424
|
-
readonly contentEntityId: string;
|
|
425
|
-
readonly sourceRange: SequenceRange<number>;
|
|
426
|
-
readonly duration: SequenceDuration<number>;
|
|
427
|
-
readonly targetRange?: SequenceRange<number>;
|
|
428
|
-
readonly timeRemapping?: JsonValue;
|
|
429
|
-
}
|
|
430
|
-
interface DeleteClipInput {
|
|
431
|
-
readonly clipEntityId: string;
|
|
432
|
-
}
|
|
433
|
-
interface UpdateClipInput {
|
|
434
|
-
readonly clipEntityId: string;
|
|
435
|
-
/** Complete replacement for the Clip-owned payload. */
|
|
436
|
-
readonly payload: JsonObject;
|
|
437
|
-
}
|
|
438
|
-
type ClipEntityId = EntityId;
|
|
439
|
-
//#endregion
|
|
440
|
-
//#region src/entity-editor/entity-timeline-editor.d.ts
|
|
180
|
+
//#region src/editor/id-gen.d.ts
|
|
441
181
|
/**
|
|
442
|
-
*
|
|
182
|
+
* Part-id generation, aligned with the online ecosystem.
|
|
443
183
|
*
|
|
444
|
-
*
|
|
445
|
-
* and
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
rows(): EntityRelationRows;
|
|
452
|
-
insertClip(input: InsertClipInput): ClipEntityId;
|
|
453
|
-
insertPlacedClip(input: InsertPlacedClipInput): ClipEntityId;
|
|
454
|
-
updateClipMarker(input: UpdateClipMarkerInput): void;
|
|
455
|
-
setClipPlacement(input: SetClipPlacementInput): void;
|
|
456
|
-
moveSequentialClips(input: MoveSequentialClipsInput): void;
|
|
457
|
-
moveClipsToStarts(input: MoveClipsToStartsInput): void;
|
|
458
|
-
moveClip(input: MoveClipInput): void;
|
|
459
|
-
replaceClipContent(input: ReplaceClipContentInput): void;
|
|
460
|
-
insertMediaClip(input: InsertMediaClipInput): ClipEntityId;
|
|
461
|
-
insertMediaClips(input: InsertMediaClipsInput): readonly ClipEntityId[];
|
|
462
|
-
replaceMediaClip(input: ReplaceMediaClipInput): void;
|
|
463
|
-
setClipVolume(input: SetClipVolumeInput): void;
|
|
464
|
-
setClipSpeed(input: SetClipSpeedInput): void;
|
|
465
|
-
trimClip(input: TrimClipInput): void;
|
|
466
|
-
replaceSequentialClips(input: ReplaceSequentialClipsInput): readonly ClipEntityId[];
|
|
467
|
-
deleteClip(input: DeleteClipInput): void;
|
|
468
|
-
deleteClipTree(input: DeleteClipTreeInput): void;
|
|
469
|
-
updateClip(input: UpdateClipInput): void;
|
|
470
|
-
upsertVoiceoverTake(input: VoiceoverTakeInput): VoiceoverTakeResult;
|
|
471
|
-
moveVoiceover(input: MoveVoiceoverInput): void;
|
|
472
|
-
deleteVoiceover(input: DeleteVoiceoverInput): void;
|
|
473
|
-
setBgm(input: SetBgmInput): ClipEntityId;
|
|
474
|
-
deleteBgm(input: DeleteBgmInput): void;
|
|
475
|
-
setCaptionVisibility(input: SetCaptionVisibilityInput): void;
|
|
476
|
-
patchCaptionStyle(input: PatchCaptionStyleInput): void;
|
|
477
|
-
private insertPlacedClipIntoDraft;
|
|
478
|
-
private ensureRoleTrack;
|
|
479
|
-
private ensureAudioScript;
|
|
480
|
-
private reconcileVoiceoverCaptions;
|
|
481
|
-
private ensureRoleTrackForClip;
|
|
482
|
-
private replaceCaptionSemanticRelations;
|
|
483
|
-
private removeCaptionClipGraph;
|
|
484
|
-
private replaceAnchorHost;
|
|
485
|
-
/** Rebuild the legacy edit baseline from current visual order before a high-level cascade. */
|
|
486
|
-
private normalizeMainSequential;
|
|
487
|
-
private resolveOneVoiceoverOverlap;
|
|
488
|
-
private applyClipPlacement;
|
|
489
|
-
private reanchorAtAbsolute;
|
|
490
|
-
private removeAnchoredDescendants;
|
|
491
|
-
private removeClipGraph;
|
|
492
|
-
private transact;
|
|
493
|
-
private mintEntityId;
|
|
494
|
-
private createRelation;
|
|
495
|
-
private relinkRelation;
|
|
496
|
-
private mintRelationId;
|
|
497
|
-
}
|
|
498
|
-
//#endregion
|
|
499
|
-
//#region src/entity-editor/editor-resources.d.ts
|
|
500
|
-
declare const roleOrder: {
|
|
501
|
-
readonly caption: 0;
|
|
502
|
-
readonly video_clip: 1;
|
|
503
|
-
readonly speech: 2;
|
|
504
|
-
readonly bgm: 3;
|
|
505
|
-
};
|
|
506
|
-
type EditorTrackRole = keyof typeof roleOrder;
|
|
507
|
-
interface EditorFoundation {
|
|
508
|
-
readonly rows: EntityRelationRows;
|
|
509
|
-
readonly timelineEntityId: string;
|
|
510
|
-
readonly trackEntityIds: Readonly<Record<EditorTrackRole, string>>;
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* MEngine editor policy, not a cardinality restriction on the general-purpose DSL.
|
|
184
|
+
* The authoritative online producers — agent-harness (`@harness/shared`
|
|
185
|
+
* `genObjId`) and director.v2 (`common/obj_id.py` `gen_obj_id`) — both mint part
|
|
186
|
+
* ids as `` `${prefix}_${ulid()}` ``, and real captured drafts use exactly that
|
|
187
|
+
* shape (`clip_…` / `spe_…` / `cap_…` / `bgm_…`, each a 26-char ULID). The engine
|
|
188
|
+
* previously emitted `vc_<base36 timestamp><6 random>`, a different prefix AND a
|
|
189
|
+
* different encoding — the sole cross-repo id divergence. This module removes it
|
|
190
|
+
* by emitting the same `<prefix>_<ULID>` bytes.
|
|
514
191
|
*
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
*
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
* `physical-asset` binding.
|
|
192
|
+
* The ULID is generated inline (Crockford Base32, 48-bit time + 80-bit random)
|
|
193
|
+
* rather than pulling the `ulid` npm package: the randomness class matches the
|
|
194
|
+
* old generator (both `Math.random`-based) and it keeps `@mengine/medeo-client`
|
|
195
|
+
* dependency-free for a purely mechanical id string. Part ids only need to be
|
|
196
|
+
* unique and lexicographically time-sortable, which this satisfies.
|
|
521
197
|
*/
|
|
522
|
-
declare function assertCanonicalEditorResources(rows: EntityRelationRows): void;
|
|
523
198
|
/**
|
|
524
|
-
*
|
|
525
|
-
*
|
|
526
|
-
*
|
|
527
|
-
*
|
|
528
|
-
*
|
|
529
|
-
* 1. every Image/Video/Audio/Voice Entity carries its own Asset `external`
|
|
530
|
-
* identity;
|
|
531
|
-
* 2. no `physical-asset` Relation may bind a media variant (Caption inline
|
|
532
|
-
* text keeps its inline Asset and binding);
|
|
533
|
-
* 3. a self-carried media identity is immutable — it cannot be rewritten to
|
|
534
|
-
* another asset id.
|
|
535
|
-
*
|
|
536
|
-
* Dual-entity media graphs are rejected instead of being migrated or merged
|
|
537
|
-
* implicitly. Deleting media is explicit and allowed.
|
|
199
|
+
* Online part-id semantic prefixes. `clip` (video clip) is the only value the
|
|
200
|
+
* engine currently mints (see `addVideoClips`); the rest are declared so the
|
|
201
|
+
* type documents the shared vocabulary and guards against reintroducing the old
|
|
202
|
+
* `vc`/`sp`/`cp`/`bg` names. Speech/caption/bgm ids arrive pre-minted in op
|
|
203
|
+
* payloads, so the engine never generates them itself.
|
|
538
204
|
*/
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
declare function ensureEditorFoundation(initial: EntityRelationRows, idFactory?: EntityTimelineIdFactory, timelinePayload?: EntityRow['payload']): EditorFoundation;
|
|
542
|
-
//#endregion
|
|
543
|
-
//#region src/entity-editor/media-asset-import.d.ts
|
|
544
|
-
interface ImportedMediaAsset {
|
|
545
|
-
readonly rows: EntityRelationRows;
|
|
546
|
-
/** The single media variant identity for this asset id; it is its own Asset. */
|
|
547
|
-
readonly contentEntityId: string;
|
|
548
|
-
}
|
|
549
|
-
/**
|
|
550
|
-
* Import at the editor boundary, not at asset generation time. Existing
|
|
551
|
-
* provenance is retained.
|
|
552
|
-
*
|
|
553
|
-
* A media variant is a logical facet of its Asset and shares one entity
|
|
554
|
-
* identity: the import mints exactly one entity of the media kind that carries
|
|
555
|
-
* the external locator itself, and deduplicates only against existing variants
|
|
556
|
-
* that already carry the same `(system, key)`. Legacy dual-entity graphs
|
|
557
|
-
* (`asset` row plus a `physical-asset` binding) are not reused and are
|
|
558
|
-
* rejected by the canonical resource policy instead of being migrated.
|
|
559
|
-
*/
|
|
560
|
-
declare function importMediaAsset(initial: EntityRelationRows, fact: MediaAssetFact, idFactory?: EntityTimelineIdFactory): ImportedMediaAsset;
|
|
561
|
-
//#endregion
|
|
562
|
-
//#region src/entity-editor/legacy-entity-migration.d.ts
|
|
563
|
-
/** One-time import only. Ordinary editor operations must never reverse-diff a legacy document. */
|
|
564
|
-
declare function migrateLegacyTimelineToEntities(legacy: VideoDocument, assetFacts: readonly MediaAssetFact[], initial?: EntityRelationRows, idFactory?: EntityTimelineIdFactory): EntityRelationRows;
|
|
565
|
-
/** Server gate: a cutover may change representation, never the existing render facts. */
|
|
566
|
-
declare function assertEntityProjectionPreservesLegacy(legacy: VideoDocument, projection: VideoDocument, rows: EntityRelationRows): void;
|
|
567
|
-
//#endregion
|
|
568
|
-
//#region src/editor/journal.d.ts
|
|
569
|
-
/**
|
|
570
|
-
* Wire a plain-memory adapter + editor that share a recording id factory, so
|
|
571
|
-
* every mutating transact lands in `journal` with ordered `generated_ids`.
|
|
572
|
-
*/
|
|
573
|
-
declare function createEditSandbox(document: VideoDocument, options?: PlainMemoryAdapterOptions): {
|
|
574
|
-
adapter: PlainMemoryAdapter;
|
|
575
|
-
editor: SemanticEditor;
|
|
576
|
-
journal: readonly JournalEntry[];
|
|
577
|
-
};
|
|
578
|
-
/**
|
|
579
|
-
* Re-drive `doc` from a recorded journal, forcing each entry's `generated_ids`
|
|
580
|
-
* through a queue-backed id factory. Never mints fresh ids: an empty queue on
|
|
581
|
-
* demand throws `unrecorded id`; leftover ids after an entry throws
|
|
582
|
-
* `unconsumed ids`. Legacy entries without `generated_ids` are treated as `[]`.
|
|
583
|
-
*/
|
|
584
|
-
declare function replayJournal(doc: SemanticDocumentAdapter, journal: readonly JournalEntry[]): Promise<void>;
|
|
205
|
+
type PartIdPrefix = 'clip' | 'spe' | 'cap' | 'bgm' | 'ti';
|
|
206
|
+
declare function generatePartId(prefix: PartIdPrefix): string;
|
|
585
207
|
//#endregion
|
|
586
208
|
//#region src/editor/snapshot-utils.d.ts
|
|
587
209
|
/** Main-track item identity read from a raw snapshot (only `part_id` is needed). */
|
|
@@ -674,7 +296,9 @@ type PushResultKind = 'ack' | 'duplicate' | 'rejected' | 'failed' | 'nothing_to_
|
|
|
674
296
|
*/
|
|
675
297
|
interface PushResult {
|
|
676
298
|
kind: PushResultKind;
|
|
677
|
-
/** Server
|
|
299
|
+
/** Server document sequence observed after a successful `ack` or `duplicate`. */
|
|
300
|
+
mengineUpdateSeq?: number | undefined;
|
|
301
|
+
/** @deprecated Ack-only sequence retained until consumers adopt `mengineUpdateSeq`. */
|
|
678
302
|
updateSeq?: number | undefined;
|
|
679
303
|
/** Whether the server held ops the local document lacked. See above. */
|
|
680
304
|
collaborated: boolean;
|
|
@@ -800,16 +424,6 @@ declare class ManualSyncDoc {
|
|
|
800
424
|
editorPeerId(): PeerID;
|
|
801
425
|
/** Current document projected to the legacy `VideoDraft` read shape. */
|
|
802
426
|
draft(): VideoDraft;
|
|
803
|
-
/**
|
|
804
|
-
* Replay a deterministic sandbox journal into this document.
|
|
805
|
-
*
|
|
806
|
-
* The adapter stays private so callers cannot bypass the manual-sync
|
|
807
|
-
* lifecycle; journal replay is the one host-side operation that needs the
|
|
808
|
-
* adapter's transaction boundary and recorded id queue. Durability is still
|
|
809
|
-
* explicit: call {@link push} after replay and report success only from its
|
|
810
|
-
* verdict.
|
|
811
|
-
*/
|
|
812
|
-
replayJournal(journal: readonly JournalEntry[]): Promise<void>;
|
|
813
427
|
/**
|
|
814
428
|
* Mark the document state the caller has just observed, for a later
|
|
815
429
|
* {@link hasChangedSince}.
|
|
@@ -963,6 +577,9 @@ declare class MedeoHttpDocStorage implements DocStorage {
|
|
|
963
577
|
* tool-level ack wait) subscribe here.
|
|
964
578
|
*/
|
|
965
579
|
subscribePushOutcome(callback: (outcome: PushOutcome) => void): () => void;
|
|
580
|
+
/** Authoritative HTTP reads and accepted pushes, never inferred from SSE bytes. */
|
|
581
|
+
subscribeServerVersion(callback: (version: Uint8Array) => void): () => void;
|
|
582
|
+
private reportServerVersion;
|
|
966
583
|
deleteDoc(_docId: string): Promise<void>;
|
|
967
584
|
subscribeDocUpdate(callback: (update: DocUpdate, origin: unknown) => void): () => void;
|
|
968
585
|
private assertDocId;
|
|
@@ -1011,6 +628,14 @@ interface WaitForServerAckOptions {
|
|
|
1011
628
|
/** Deadline in ms. Rejects with reason `timeout` when it elapses. */
|
|
1012
629
|
timeoutMs?: number;
|
|
1013
630
|
}
|
|
631
|
+
/** Document-level confirmation is independent of local operation completion. */
|
|
632
|
+
interface MengineDocSyncState {
|
|
633
|
+
/** Remote-only imports do not create a new local confirmation obligation. */
|
|
634
|
+
readonly confirmation: 'unknown' | 'pending' | 'confirmed';
|
|
635
|
+
/** Transport/activity phase. Idle does not imply confirmation; failure details
|
|
636
|
+
* remain available through push outcomes and confirmation wait errors. */
|
|
637
|
+
readonly phase: 'connecting' | 'idle' | 'syncing' | 'offline' | 'failed';
|
|
638
|
+
}
|
|
1014
639
|
interface MengineDocSessionOptions {
|
|
1015
640
|
docId: string;
|
|
1016
641
|
client: MengineHttpClient;
|
|
@@ -1021,11 +646,6 @@ interface MengineDocSessionOptions {
|
|
|
1021
646
|
*/
|
|
1022
647
|
localStorage?: DocStorageLike;
|
|
1023
648
|
sseReconnectDelayMs?: number;
|
|
1024
|
-
/**
|
|
1025
|
-
* Keep remote synchronization read-only: pull snapshot/diffs and subscribe to
|
|
1026
|
-
* SSE updates, but never POST local Loro updates to the server.
|
|
1027
|
-
*/
|
|
1028
|
-
readonlyMode?: boolean;
|
|
1029
649
|
}
|
|
1030
650
|
/**
|
|
1031
651
|
* A live editing session for one Medeo document — the single entry point clients
|
|
@@ -1061,8 +681,14 @@ declare class MengineDocSession {
|
|
|
1061
681
|
private adapterValue;
|
|
1062
682
|
private editorValue;
|
|
1063
683
|
private started;
|
|
684
|
+
private destroyed;
|
|
685
|
+
private lifetime;
|
|
686
|
+
private hasConnected;
|
|
687
|
+
private initialVersionValue;
|
|
688
|
+
private localVersionValue;
|
|
689
|
+
private pushErrorValue;
|
|
1064
690
|
/**
|
|
1065
|
-
* Latest server oplog version seen on
|
|
691
|
+
* Latest server oplog version seen on an authoritative HTTP response. Lets `waitForServerAck`
|
|
1066
692
|
* return without waiting when the server is already known to cover the local
|
|
1067
693
|
* doc (e.g. nothing was edited since the last confirmed push).
|
|
1068
694
|
*/
|
|
@@ -1077,14 +703,14 @@ declare class MengineDocSession {
|
|
|
1077
703
|
*/
|
|
1078
704
|
subscribePushOutcome(callback: (outcome: PushOutcome) => void): () => void;
|
|
1079
705
|
/**
|
|
1080
|
-
* Resolve once the server has durably accepted the local
|
|
706
|
+
* Resolve once the server has durably accepted the local commits as of
|
|
1081
707
|
* *now* — the capability an Agent tool needs to answer "did my edit land?"
|
|
1082
708
|
* before reporting success.
|
|
1083
709
|
*
|
|
1084
710
|
* Call it right after the editor ops whose durability matters. It snapshots the
|
|
1085
|
-
* local
|
|
1086
|
-
*
|
|
1087
|
-
*
|
|
711
|
+
* latest local commit's version (or the loaded baseline before any edit) and
|
|
712
|
+
* resolves when an authoritative server version covers it. Remote-only
|
|
713
|
+
* imports do not extend this target, matching the displayed confirmation state.
|
|
1088
714
|
*
|
|
1089
715
|
* Version coverage, not byte identity, is the acceptance test — for two reasons:
|
|
1090
716
|
* the ops may reach the server inside a merged blob rather than as the exact
|
|
@@ -1106,18 +732,6 @@ declare class MengineDocSession {
|
|
|
1106
732
|
* step. The committed change drives DocManager's local-update push.
|
|
1107
733
|
*/
|
|
1108
734
|
get editor(): SemanticEditor;
|
|
1109
|
-
/**
|
|
1110
|
-
* Opaque version token of the local oplog (base64 `VersionVector.encode`).
|
|
1111
|
-
* Equality-comparable only: equal means no observed change (local or
|
|
1112
|
-
* remote-arrived) since the token was taken. Throws when not started.
|
|
1113
|
-
*/
|
|
1114
|
-
version(): string;
|
|
1115
|
-
/**
|
|
1116
|
-
* The live document adapter, exposed for journal replay (commit channel).
|
|
1117
|
-
* Replaying through it still goes SemanticEditor → Loro → mengine-server —
|
|
1118
|
-
* no write bypass. Typed by the narrow interface on purpose.
|
|
1119
|
-
*/
|
|
1120
|
-
get documentAdapter(): SemanticDocumentAdapter;
|
|
1121
735
|
/** Current document snapshot (read model). */
|
|
1122
736
|
snapshot(): VideoDocument;
|
|
1123
737
|
/**
|
|
@@ -1128,6 +742,11 @@ declare class MengineDocSession {
|
|
|
1128
742
|
* surfaces through `subscribe`.
|
|
1129
743
|
*/
|
|
1130
744
|
start(): Promise<VideoDocument>;
|
|
745
|
+
getSyncState(): MengineDocSyncState;
|
|
746
|
+
private confirmationTarget;
|
|
747
|
+
/** Immediately supplies current state; unsubscribe when the host changes docs. */
|
|
748
|
+
subscribeSyncState(cb: (state: MengineDocSyncState) => void): () => void;
|
|
749
|
+
private emitSyncState;
|
|
1131
750
|
subscribe(cb: (event: MengineDocSessionUpdateEvent) => void): () => void;
|
|
1132
751
|
onStateChange(cb: (state: DocState) => void): () => void;
|
|
1133
752
|
getState(): DocState;
|
|
@@ -1469,4 +1088,4 @@ declare function hostForAbsMs(ranges: MainClipRange[], absMs: number): MainClipR
|
|
|
1469
1088
|
*/
|
|
1470
1089
|
declare function relativePositionForAbs(ranges: MainClipRange[], absMs: number): TrackItemTimePosition;
|
|
1471
1090
|
//#endregion
|
|
1472
|
-
export { type Aggregation, type Attachment, type
|
|
1091
|
+
export { type Aggregation, type Attachment, type BgmPart, type CaptionPart, type CaptionStyle, type CommitOptions, DEFAULT_UNIT_TIME_MS, type DerivedItemPosition, type DocStorageLike, type DocVersionMark, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImplementedSemanticOpKind, type InitialDocumentFacts, LANE_KINDS_IN_STACK_ORDER, type LaneKind, type MainClipRange, type MakeEmptyPart, ManualSyncDoc, type ManualSyncDocOptions, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, 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 MengineUpdateMeta, MirrorVideoDocumentAdapter, type MirrorVideoDocumentOptions, type OpActor, type PartAggregation, type PartKind, type PartUnion, type PlannedSemanticOpKind, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, SchemaValidator, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, 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, 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 WaitForServerAckOptions, 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, index_d_exports as schemas, snapshotToPlain, solveVideoDocument, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema };
|