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

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,4 @@
1
- import { t as index_d_exports } from "./index-InEWX9rk.js";
2
- import { $ as Track, A as TrackDraft, B as DerivedItemPosition, C as SemanticOpKind, D as ValidationError, E as SnapshotReadable, F as VideoDocumentValidationError, G as toVideoDocument, H as buildSpeechHostMap, I as assertValidVideoDocument, J as DEFAULT_UNIT_TIME_MS, K as BgmPart, L as validateVideoDocument, M as VideoDocumentDraft, N as VideoDocumentMirrorSchema, O as PartIdFactory, P as videoDocumentMirrorSchema, Q as Timeline, R as InitialDocumentFacts, S as PlannedSemanticOpKind, T as SchemaValidator, U as derivePositionFromAbs, V as SpeechHostMap, W as fromVideoDocument, X as PartUnion, Y as PartKind, Z as SpeechPart, _ as SemanticOpInput, _t as Timeline$1, a as PlainMemoryAdapter, at as VideoDocumentSchemaVersion, b as IMPLEMENTED_SEMANTIC_OP_KINDS, c as MirrorVideoDocumentAdapter, ct as VideoDraft, d as createMirrorVideoDocumentAdapter, dt as speedOf, et as TrackItem, f as writeVideoDocumentToDraft, ft as Attachment, g as SemanticEditor, gt as SpeedShift, h as SemanticDocumentAdapter, ht as PartAggregation, i as JournalEntry, it as VideoDocument, j as TrackItemDraft, k as generatePartId, l as MirrorVideoDocumentOptions, lt as VideoDraftPartUnion, m as OpActor, mt as CaptionStyle, n as videoDocumentSchema, nt as VIDEO_DOCUMENT_SCHEMA_VERSION, o as PlainMemoryAdapterOptions, ot as VideoDocumentValidationIssue, p as CommitOptions, pt as CaptionPart$1, q as CaptionPart, r as readVideoDocumentFromDraft, rt as VideoClipPart, s as createPlainMemoryAdapter, st as VideoDocumentValidationIssueCode, t as partUnionSchema, tt as TrackItemTimePosition, u as createMirrorVideoDocument, ut as effectiveVideoClipDurationMs, v as SemanticOpName, vt as Track$1, w as isImplementedSemanticOpKind, x as ImplementedSemanticOpKind, y as TransactAudit, yt as TrackItem$1, z as buildInitialVideoDocument } from "./index-BO2fSUKi.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-CZlTzzrm.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,23 +177,33 @@ interface MengineEventStreamOptions {
178
177
  }
179
178
  declare function readMengineEventStream(options: MengineEventStreamOptions): Promise<void>;
180
179
  //#endregion
181
- //#region src/editor/journal.d.ts
180
+ //#region src/editor/id-gen.d.ts
182
181
  /**
183
- * Wire a plain-memory adapter + editor that share a recording id factory, so
184
- * every mutating transact lands in `journal` with ordered `generated_ids`.
182
+ * Part-id generation, aligned with the online ecosystem.
183
+ *
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.
191
+ *
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.
185
197
  */
186
- declare function createEditSandbox(document: VideoDocument, options?: PlainMemoryAdapterOptions): {
187
- adapter: PlainMemoryAdapter;
188
- editor: SemanticEditor;
189
- journal: readonly JournalEntry[];
190
- };
191
198
  /**
192
- * Re-drive `doc` from a recorded journal, forcing each entry's `generated_ids`
193
- * through a queue-backed id factory. Never mints fresh ids: an empty queue on
194
- * demand throws `unrecorded id`; leftover ids after an entry throws
195
- * `unconsumed ids`. Legacy entries without `generated_ids` are treated as `[]`.
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.
196
204
  */
197
- 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;
198
207
  //#endregion
199
208
  //#region src/editor/snapshot-utils.d.ts
200
209
  /** Main-track item identity read from a raw snapshot (only `part_id` is needed). */
@@ -704,18 +713,6 @@ declare class MengineDocSession {
704
713
  * step. The committed change drives DocManager's local-update push.
705
714
  */
706
715
  get editor(): SemanticEditor;
707
- /**
708
- * Opaque version token of the local oplog (base64 `VersionVector.encode`).
709
- * Equality-comparable only: equal means no observed change (local or
710
- * remote-arrived) since the token was taken. Throws when not started.
711
- */
712
- version(): string;
713
- /**
714
- * The live document adapter, exposed for journal replay (commit channel).
715
- * Replaying through it still goes SemanticEditor → Loro → mengine-server —
716
- * no write bypass. Typed by the narrow interface on purpose.
717
- */
718
- get documentAdapter(): SemanticDocumentAdapter;
719
716
  /** Current document snapshot (read model). */
720
717
  snapshot(): VideoDocument;
721
718
  /**
@@ -1067,4 +1064,4 @@ declare function hostForAbsMs(ranges: MainClipRange[], absMs: number): MainClipR
1067
1064
  */
1068
1065
  declare function relativePositionForAbs(ranges: MainClipRange[], absMs: number): TrackItemTimePosition;
1069
1066
  //#endregion
1070
- 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, type JournalEntry, 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 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 PartIdFactory, type PartKind, type PartUnion, PlainMemoryAdapter, type PlainMemoryAdapterOptions, 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, 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, index_d_exports as schemas, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema, writeVideoDocumentToDraft };
1067
+ 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 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 };