@mengine/medeo-tool 1.4.1-alpha.2 → 1.4.1-alpha.3

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.
@@ -19,70 +19,25 @@ interface BoundedNativeSequencePayload extends JsonObject {
19
19
  sampling: 'native';
20
20
  coordinateSpace: JsonValue;
21
21
  }
22
- /** Business editing surface. Infrastructure Assets are assembled by the host. */
22
+ /** Business editing surface. Reads are assembled snapshots; writes preserve native operation intent. */
23
23
  interface BusinessEntityFacade {
24
24
  list(): SandboxEntity[];
25
25
  get(entityId: string): SandboxEntity | null;
26
- readCaptionContent(entityId: string): ComposedScriptContent;
27
- readPhoneticScriptContent(entityId: string): ComposedPhoneticContent;
28
26
  create(input: Exclude<CreateEntityInput, {
29
27
  entity_kind: 'asset';
30
28
  }>): string;
31
- update(input: UpdateEntityInput): void;
29
+ update(input: EntityUpdateInput): void;
32
30
  declareFields(input: UpdateEntityInput): void;
33
31
  delete(input: DeleteEntityInput): void;
34
32
  }
35
- /** Physical Asset bindings are maintained outside the sandbox. */
33
+ /** Endpoint order is retained; each relation kind defines its endpoint semantics. */
36
34
  interface BusinessRelationFacade {
37
35
  list(): SandboxRelation[];
38
36
  of(entityId: string, relationKind?: KnownRelationKind): SandboxRelation[];
39
- link(input: Exclude<LinkRelationInput, {
40
- relation_kind: 'physical-asset';
41
- }>): string;
42
- linkGenerated(input: LinkGeneratedRelationInput): string;
43
- linkClipAnchor(input: LinkClipAnchorRelationInput): string;
44
- linkPhoneticScriptRender(input: LinkPhoneticScriptRenderRelationInput): string;
45
- linkAudioScriptSource(input: LinkAudioScriptSourceRelationInput): string;
37
+ link(input: LinkRelationInput): string;
38
+ update(input: RelationUpdateInput): void;
46
39
  unlink(input: UnlinkRelationInput): void;
47
40
  }
48
- interface CaptionFontDescriptor {
49
- readonly system: 'font-library';
50
- readonly key: string;
51
- }
52
- /**
53
- * One ordered entry of the Caption's segment selection. `segmentId` quotes the
54
- * composed AudioScript's own stable segment identity — a local id quoted by the
55
- * variant, never a peer Entity reference. Text itself is never copied here;
56
- * complete Caption content is assembled through its direct baseEntityIds.
57
- * The optional `textRange` narrows one Segment to an intra-Segment sub-span
58
- * (intra-segment re-segmentation); without it the whole Segment text is selected.
59
- */
60
- type CaptionSegmentSelection = JsonObject & {
61
- readonly segmentId: string;
62
- readonly textRange?: CaptionTextRange;
63
- };
64
- interface CaptionStyleFields {
65
- readonly font?: CaptionFontDescriptor;
66
- readonly fontSize?: number;
67
- readonly fontColor?: string;
68
- readonly fontWeight?: number;
69
- readonly entranceAnimation?: string;
70
- readonly entranceAnimationDurationMs?: number;
71
- readonly strokeColor?: string;
72
- readonly strokeWidth?: number;
73
- readonly positionX?: number;
74
- readonly positionY?: number;
75
- }
76
- /**
77
- * Half-open `[start, end)` position window inside one Segment's text, counted
78
- * in Unicode code points (not UTF-16 code units), so a boundary never splits a
79
- * surrogate pair. Positions are non-negative safe integers with `start < end`;
80
- * `end` must not exceed the Segment's code-point length.
81
- */
82
- interface CaptionTextRange extends JsonObject {
83
- readonly start: number;
84
- readonly end: number;
85
- }
86
41
  type CaptionTextSelection = JsonObject & {
87
42
  segmentId: string; /** Half-open Unicode code-point range within the selected source segment. */
88
43
  textRange?: {
@@ -90,56 +45,19 @@ type CaptionTextSelection = JsonObject & {
90
45
  end: number;
91
46
  };
92
47
  };
93
- type ClipEntityId = EntityId;
94
- type ClipPlacement = {
95
- readonly kind: 'sequential';
96
- readonly order: number;
97
- } | {
98
- readonly kind: 'absolute';
99
- readonly targetRange: SequenceRange<number>;
100
- } | {
101
- readonly kind: 'anchored';
102
- readonly hostClipEntityId: string;
103
- readonly anchorOffset: number;
104
- };
105
- interface ComposedPhoneticContent extends ComposedScriptContent {
106
- phonemeScript?: string;
107
- prosody?: JsonObject;
108
- }
109
- /** Read result only: base text is assembled from the real AudioScript row. */
110
- interface ComposedScriptContent {
111
- audio_script_entity_id: string;
112
- text: string;
113
- segments: ScriptTextSegment[];
114
- }
115
48
  type CreateEntityInput = { [K in KnownEntityKind]: {
116
49
  entity_id?: string;
117
50
  entity_kind: K;
118
51
  payload: StoredEntityPayload<K>;
119
52
  } }[KnownEntityKind];
120
- interface DeleteBgmInput {
121
- readonly timelineEntityId: string;
122
- }
123
- interface DeleteClipInput {
124
- readonly clipEntityId: string;
125
- }
126
- interface DeleteClipTreeInput {
127
- readonly clipEntityIds: readonly string[];
128
- readonly onAnchored: 'cascade' | 'detach';
129
- }
130
53
  interface DeleteEntityInput {
131
54
  entity_id: string;
132
55
  }
133
- interface DeleteVoiceoverInput {
134
- readonly voiceoverClipEntityIds: readonly string[];
135
- }
136
- type EmptyRelationKind = 'timeline-track' | 'track-clip' | 'clip-marker' | 'marker-content' | 'axvideo-marker' | 'marker-timeline' | 'audio-script-marker';
137
56
  /** Immutable resource content resolved by the host for a document Entity. */
138
57
  interface EntityAssetContent {
139
58
  assetId: string;
140
59
  content: JsonValue;
141
60
  }
142
- type EntityId = string;
143
61
  interface EntityPayloadByKind {
144
62
  axvideo: BoundedDerivedSequencePayload;
145
63
  timeline: JsonObject;
@@ -196,49 +114,46 @@ interface EntityPayloadByKind {
196
114
  }[];
197
115
  };
198
116
  }
199
- interface EntityStoreSnapshot {
200
- /** Causal compiler baseline; required for publishing edits. */
201
- loroSnapshot?: string;
202
- revision: number;
203
- /** Current AudioScript version attached to the project; initialized projects always attach a script, possibly empty. */
204
- audioScriptEntityId: string | null;
205
- entities: SandboxEntity[];
206
- relations: SandboxRelation[];
207
- }
208
- interface InsertCaptionClipInput {
209
- readonly timelineEntityId: string;
210
- /** Existing generation identity for newly materialized Caption content, distinct from its Clip. */
211
- readonly captionEntityId?: string;
212
- /** Stable placed caption identity, distinct from the Caption content identity. */
213
- readonly captionClipEntityId?: string;
214
- /** Existing bases composed by this variant; includes an AudioScript text owner. */
215
- readonly baseEntityIds: readonly string[];
216
- /** Ordered selection of the AudioScript segments this Caption displays. */
217
- readonly selections: readonly CaptionSegmentSelection[];
218
- /** Intrinsic cue length of the Caption entity itself; display comes from the placement. */
219
- readonly durationMs: number;
220
- readonly style?: CaptionStyleFields;
221
- readonly placement: ClipPlacement;
222
- }
223
- interface InsertClipInput {
224
- readonly trackEntityId: string;
225
- /** Existing Sequence media Entity id. Asset ids and URLs are not content ids. */
226
- readonly contentEntityId: string;
227
- readonly sourceRange: SequenceRange<number>;
228
- readonly duration: SequenceDuration<number>;
229
- readonly targetRange?: SequenceRange<number>;
230
- readonly clipPayload?: JsonObject;
117
+ /** Tokens have no script-authored data; only the creating session can validate them. */
118
+ interface EntitySandboxCheckpoint {
119
+ readonly __checkpoint: unique symbol;
231
120
  }
232
- interface InsertPlacedClipInput {
233
- readonly trackEntityId: string;
234
- readonly contentEntityId: string;
235
- readonly sourceRange: SequenceRange<number>;
236
- readonly duration: SequenceDuration<number>;
237
- readonly placement: ClipPlacement;
238
- readonly clipPayload?: JsonObject;
239
- /** Stable caller-owned placement identity, when one already exists outside the graph. */
240
- readonly clipEntityId?: string;
121
+ interface EntityUpdateInput {
122
+ entity_id: string;
123
+ changes: FieldChange[];
241
124
  }
125
+ type FieldChange = {
126
+ op: 'set';
127
+ path: FieldPath;
128
+ value: JsonValue;
129
+ } | {
130
+ op: 'unset';
131
+ path: FieldPath;
132
+ } | {
133
+ op: 'text.splice';
134
+ path: FieldPath;
135
+ index: number;
136
+ deleteCount: number;
137
+ text: string;
138
+ } | {
139
+ op: 'list.insert';
140
+ path: FieldPath;
141
+ value: JsonValue;
142
+ beforeElementId: string | null;
143
+ } | {
144
+ op: 'list.move';
145
+ path: FieldPath;
146
+ elementId: string;
147
+ beforeElementId: string | null;
148
+ } | {
149
+ op: 'list.remove';
150
+ path: FieldPath;
151
+ elementId: string;
152
+ };
153
+ /** List members are addressed by identity, never a transient array offset. */
154
+ type FieldPath = readonly (string | {
155
+ elementId: string;
156
+ })[];
242
157
  interface JsonObject {
243
158
  [key: string]: JsonValue;
244
159
  }
@@ -246,96 +161,25 @@ type JsonPrimitive = string | number | boolean | null;
246
161
  type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
247
162
  type KnownEntityKind = 'axvideo' | 'timeline' | 'track' | 'clip' | 'video' | 'audio' | 'voice' | 'image' | 'sequence-marker' | 'viewport' | 'audio-script' | 'phonetic-script' | 'caption';
248
163
  type KnownRelationKind = 'timeline-track' | 'track-clip' | 'clip-marker' | 'marker-content' | 'axvideo-marker' | 'marker-timeline' | 'generated' | 'caption-alignment' | 'clip-anchor' | 'phonetic-script-render' | 'audio-script-source' | 'audio-script-marker';
249
- interface LinearClipSpeed {
250
- readonly kind: 'linear';
251
- readonly rate: number;
252
- readonly mode?: string;
253
- }
254
- /** `audio-script-source(script, source)`; the script was transcribed from the source media. */
255
- interface LinkAudioScriptSourceRelationInput {
256
- relation_id?: string;
257
- script_entity_id: string;
258
- source_entity_id: string;
259
- trace?: JsonObject;
260
- }
261
- interface LinkClipAnchorRelationInput {
262
- relation_id?: string;
263
- child_clip_entity_id: string;
264
- host_clip_entity_id: string;
265
- trace?: JsonObject;
266
- }
267
- interface LinkGeneratedRelationInput {
268
- relation_id?: string;
269
- output_entity_id: string;
270
- input_entity_id: string;
271
- trace?: JsonObject;
272
- }
273
- interface LinkPhoneticScriptRenderRelationInput {
274
- relation_id?: string;
275
- output_entity_id: string;
276
- phonetic_script_entity_id: string;
277
- trace?: JsonObject;
278
- }
279
164
  interface LinkRelationBase {
280
165
  relation_id?: string;
281
166
  endpoint_0_entity_id: string;
282
167
  endpoint_1_entity_id: string;
283
168
  trace?: JsonObject;
284
169
  }
285
- type LinkRelationInput = (LinkRelationBase & {
286
- relation_kind: EmptyRelationKind;
287
- metadata?: {
288
- [key: string]: never;
289
- };
290
- }) | (LinkRelationBase & {
291
- relation_kind: 'physical-asset';
170
+ interface LinkRelationInput extends LinkRelationBase {
171
+ relation_kind: KnownRelationKind;
292
172
  metadata?: JsonObject;
293
- }) | (LinkRelationBase & {
294
- relation_kind: 'caption-alignment';
295
- metadata: JsonObject & {
296
- alignment: JsonValue;
297
- };
298
- });
173
+ }
299
174
  type MediaAssetPayload = JsonObject & {
300
175
  external: {
301
176
  system: 'memota' | 'memota-speech';
302
177
  key: string;
303
178
  };
304
179
  };
305
- interface MoveClipInput {
306
- readonly clipEntityId: string;
307
- readonly trackEntityId: string;
308
- }
309
- interface MoveClipsToStartsInput {
310
- readonly moves: readonly {
311
- readonly clipEntityId: string;
312
- readonly newStartMs: number;
313
- }[];
314
- /** Absolute-time drags preserve every voiceover's current visible landing. */
315
- readonly onAnchored: 'keepAbsolute';
316
- }
317
- interface MoveSequentialClipsInput {
318
- readonly clipEntityIds: readonly string[];
319
- readonly anchor: SequentialClipAnchor;
320
- readonly onAnchored: 'follow' | 'keepAbsolute';
321
- }
322
- interface MoveVoiceoverInput {
323
- readonly voiceoverClipEntityId: string;
324
- /** Absolute requested timeline start; MEngine resolves and persists the host relation. */
325
- readonly newStartMs: number;
326
- }
327
- interface PatchCaptionStyleInput {
328
- readonly timelineEntityId: string;
329
- readonly style: CaptionStyleFields;
330
- }
331
- interface ReplaceClipContentInput {
332
- readonly clipEntityId: string;
333
- /** Existing Sequence media Entity id. Asset ids and URLs are not content ids. */
334
- readonly contentEntityId: string;
335
- readonly sourceRange: SequenceRange<number>;
336
- readonly duration: SequenceDuration<number>;
337
- readonly targetRange?: SequenceRange<number>;
338
- readonly timeRemapping?: JsonValue;
180
+ interface RelationUpdateInput {
181
+ relation_id: string;
182
+ changes: FieldChange[];
339
183
  }
340
184
  interface SandboxEntity<K extends KnownEntityKind = KnownEntityKind> {
341
185
  entity_id: string;
@@ -355,47 +199,10 @@ type ScriptTextSegment = JsonObject & {
355
199
  text: string;
356
200
  language?: string;
357
201
  };
358
- type SequenceDuration<Span = unknown> = {
359
- readonly mode: 'from-source';
360
- } | {
361
- readonly mode: 'fixed';
362
- readonly value: Span;
363
- };
364
- interface SequenceRange<Point = unknown> {
365
- readonly start: Point;
366
- readonly end: Point;
367
- }
368
- type SequentialClipAnchor = {
369
- readonly position: 'before' | 'after';
370
- readonly clipEntityId: string;
371
- } | {
372
- readonly position: 'trackStart';
373
- };
374
- interface SetCaptionVisibilityInput {
375
- readonly timelineEntityId: string;
376
- readonly hidden: boolean;
377
- }
378
- interface SetClipPlacementInput {
379
- readonly clipEntityId: string;
380
- readonly placement: ClipPlacement;
381
- }
382
- interface SetClipSpeedInput {
383
- readonly clipEntityId: string;
384
- readonly timeRemapping: LinearClipSpeed | null;
385
- }
386
- interface SetClipVolumeInput {
387
- readonly clipEntityId: string;
388
- /** Playback gain in decibels. */
389
- readonly volume: number;
390
- }
391
202
  /** Stored own fields; a variant may obtain required content fields from its declared bases. */
392
203
  type StoredEntityPayload<K extends KnownEntityKind> = EntityPayloadByKind[K] | (K extends 'caption' ? JsonObject & Pick<MediaAssetPayload, 'external'> : never) | (JsonObject & Partial<EntityPayloadByKind[K]> & {
393
204
  baseEntityIds: string[];
394
205
  });
395
- interface TrimClipInput {
396
- readonly clipEntityId: string;
397
- readonly sourceRange: SequenceRange<number>;
398
- }
399
206
  interface UnboundedConstantSequencePayload extends JsonObject {
400
207
  extent: {
401
208
  kind: 'unbounded';
@@ -407,65 +214,24 @@ interface UnboundedConstantSequencePayload extends JsonObject {
407
214
  interface UnlinkRelationInput {
408
215
  relation_id: string;
409
216
  }
410
- interface UpdateClipInput {
411
- readonly clipEntityId: string;
412
- /** Complete replacement for the Clip-owned payload. */
413
- readonly payload: JsonObject;
414
- }
415
- interface UpdateClipMarkerInput {
416
- readonly clipEntityId: string;
417
- readonly sourceRange?: SequenceRange<number>;
418
- /** Passing `undefined` explicitly removes the optional target range. */
419
- readonly targetRange?: SequenceRange<number> | undefined;
420
- readonly duration?: SequenceDuration<number>;
421
- /** Passing `undefined` explicitly removes the optional remapping value. */
422
- readonly timeRemapping?: JsonValue | undefined;
423
- }
424
217
  /** Patch supplied fields on the assembled entity; omitted fields remain unchanged. */
425
218
  interface UpdateEntityInput {
426
219
  entity_id: string;
427
220
  payload: JsonObject;
428
221
  }
429
- /** Timeline writes accept existing media Entity ids, never Memota asset ids or URLs. */
430
- interface EditApi {
431
- insertClip(input: InsertClipInput): ClipEntityId;
432
- insertPlacedClip(input: InsertPlacedClipInput): ClipEntityId;
433
- updateClipMarker(input: UpdateClipMarkerInput): void;
434
- setClipPlacement(input: SetClipPlacementInput): void;
435
- moveSequentialClips(input: MoveSequentialClipsInput): void;
436
- moveClip(input: MoveClipInput): void;
437
- replaceClipContent(input: ReplaceClipContentInput): void;
438
- setClipVolume(input: SetClipVolumeInput): void;
439
- setClipSpeed(input: SetClipSpeedInput): void;
440
- trimClip(input: TrimClipInput): void;
441
- deleteClip(input: DeleteClipInput): void;
442
- deleteClipTree(input: DeleteClipTreeInput): void;
443
- updateClip(input: UpdateClipInput): void;
444
- moveVoiceover(input: MoveVoiceoverInput): void;
445
- moveClipsToStarts(input: MoveClipsToStartsInput): void;
446
- deleteVoiceover(input: DeleteVoiceoverInput): void;
447
- deleteBgm(input: DeleteBgmInput): void;
448
- setCaptionVisibility(input: SetCaptionVisibilityInput): void;
449
- patchCaptionStyle(input: PatchCaptionStyleInput): void;
450
- insertCaptionClip(input: InsertCaptionClipInput): ClipEntityId;
451
- }
452
- interface TimelineApi {
453
- snapshot(): EntityStoreSnapshot & {
454
- audioScriptEntityId: string;
455
- };
456
- }
457
- interface SandboxCheckpoint {
458
- readonly index: number;
459
- }
460
- declare const edit: EditApi;
461
- declare const timeline: TimelineApi;
462
222
  declare const entities: BusinessEntityFacade;
463
223
  declare const relations: BusinessRelationFacade;
464
- /** Resolve the resource attached to an Entity through the host; await before using a new Caption. */
224
+ /** Resolve this Entity's attached resource through the host; await before using an uninitialized Caption. */
465
225
  declare function rgetAssetFromEntity(entityId: string): Promise<EntityAssetContent>;
466
- declare function checkpoint(): SandboxCheckpoint;
467
- declare function rollbackTo(cp: SandboxCheckpoint): void;
226
+ declare function checkpoint(): EntitySandboxCheckpoint;
227
+ declare function rollbackTo(cp: EntitySandboxCheckpoint): void;
468
228
  declare const inputs: Readonly<Record<string, unknown>>;
229
+ declare const console: {
230
+ log(...values: unknown[]): void;
231
+ info(...values: unknown[]): void;
232
+ warn(...values: unknown[]): void;
233
+ error(...values: unknown[]): void;
234
+ };
469
235
  //#endregion
470
- export type { BoundedDerivedSequencePayload, BoundedNativeSequencePayload, BusinessEntityFacade, BusinessRelationFacade, CaptionFontDescriptor, CaptionSegmentSelection, CaptionStyleFields, CaptionTextRange, CaptionTextSelection, ClipEntityId, ClipPlacement, ComposedPhoneticContent, ComposedScriptContent, CreateEntityInput, DeleteBgmInput, DeleteClipInput, DeleteClipTreeInput, DeleteEntityInput, DeleteVoiceoverInput, EditApi, EmptyRelationKind, EntityAssetContent, EntityId, EntityPayloadByKind, EntityStoreSnapshot, InsertCaptionClipInput, InsertClipInput, InsertPlacedClipInput, JsonObject, JsonPrimitive, JsonValue, KnownEntityKind, KnownRelationKind, LinearClipSpeed, LinkAudioScriptSourceRelationInput, LinkClipAnchorRelationInput, LinkGeneratedRelationInput, LinkPhoneticScriptRenderRelationInput, LinkRelationInput, MediaAssetPayload, MoveClipInput, MoveClipsToStartsInput, MoveSequentialClipsInput, MoveVoiceoverInput, PatchCaptionStyleInput, ReplaceClipContentInput, SandboxCheckpoint, SandboxEntity, SandboxRelation, ScriptTextSegment, SequenceDuration, SequenceRange, SequentialClipAnchor, SetCaptionVisibilityInput, SetClipPlacementInput, SetClipSpeedInput, SetClipVolumeInput, StoredEntityPayload, TimelineApi, TrimClipInput, UnboundedConstantSequencePayload, UnlinkRelationInput, UpdateClipInput, UpdateClipMarkerInput, UpdateEntityInput, checkpoint, edit, entities, inputs, relations, rgetAssetFromEntity, rollbackTo, timeline };
236
+ export type { BoundedDerivedSequencePayload, BoundedNativeSequencePayload, BusinessEntityFacade, BusinessRelationFacade, CaptionTextSelection, CreateEntityInput, DeleteEntityInput, EntityAssetContent, EntityPayloadByKind, EntitySandboxCheckpoint, EntityUpdateInput, FieldChange, FieldPath, JsonObject, JsonPrimitive, JsonValue, KnownEntityKind, KnownRelationKind, LinkRelationInput, MediaAssetPayload, RelationUpdateInput, SandboxEntity, SandboxRelation, ScriptTextSegment, StoredEntityPayload, UnboundedConstantSequencePayload, UnlinkRelationInput, UpdateEntityInput, checkpoint, console, entities, inputs, relations, rgetAssetFromEntity, rollbackTo };
471
237
  //# sourceMappingURL=sandbox-api.d.mts.map
@@ -1,4 +1,4 @@
1
- import { s as EntityStoreSnapshot } from "./entity-contract-Cpf3P69H.mjs";
1
+ import { l as EntityStoreSnapshot } from "./entity-contract-DQ56Ihrh.mjs";
2
2
  import { VideoDocument } from "@mengine/medeo-client";
3
3
 
4
4
  //#region src/sandbox/worker-entry.d.ts
@@ -15,7 +15,6 @@ interface WorkerData {
15
15
  inputs?: Record<string, unknown>;
16
16
  entityState?: EntityStoreSnapshot;
17
17
  idLabel?: string;
18
- entityOnly?: boolean;
19
18
  }
20
19
  //#endregion
21
20
  export { WorkerData };