@mengine/medeo-tool 1.2.1-alpha.8 → 1.3.1-alpha.10

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.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as SandboxEntity, a as EntityFacade, b as UpdateEntityInput, c as ImportAssetInput, d as JsonValue, f as KnownEntityKind, g as RelationFacade, h as LinkRelationInput, i as EntityCommand, l as JsonObject, m as LinkGeneratedRelationInput, n as CreateEntityInput, o as EntityPlanState, p as KnownRelationKind, r as DeleteEntityInput, s as EntityStoreSnapshot, t as AuthorableRelationKind, u as JsonPrimitive, v as SandboxRelation, y as UnlinkRelationInput } from "./entity-contract-DycLxdQ5.mjs";
2
- import { JournalEntry, ManualSyncDoc, MediaAssetFact, PartIdFactory, SemanticOpName, VideoDocument, VideoDraft, fromVideoDocument } from "@mengine/medeo-client";
1
+ import { _ as SandboxEntity, a as EntityFacade, b as UpdateEntityInput, c as JsonObject, d as KnownEntityKind, f as KnownRelationKind, g as ResourceEntityKind, h as RelationFacade, i as EntityCommand, l as JsonPrimitive, m as LinkRelationInput, n as CreateEntityInput, o as EntityPlanState, p as LinkGeneratedRelationInput, r as DeleteEntityInput, s as EntityStoreSnapshot, t as AuthorableRelationKind, u as JsonValue, v as SandboxRelation, y as UnlinkRelationInput } from "./entity-contract-DHasvrhq.mjs";
2
+ import { JournalEntry, ManualSyncDoc, PartIdFactory, SemanticOpName, VideoDocument, VideoDraft, fromVideoDocument } from "@mengine/medeo-client";
3
3
  import { AddSpeechesInput, AddVideoClipsInput, AdjustBgmVolumeInput, AdjustSpeechVolumeInput, AdjustVideoClipDurationInput, AdjustVideoClipVolumeInput, ChangeSpeechScriptInput, ChangeSpeechVoiceInput, DeleteBgmInput, DeleteSpeechesInput, DeleteVideoClipsInput, MoveSpeechesInput, MoveVideoClipsByAnchorInput, MoveVideoClipsInput, ReplaceVideoClipContentInput, ReplaceVideoClipSequenceInput, SetBgmInput, SetCaptionStyleInput, SetCaptionVisibilityInput, SetVideoClipSpeedShiftInput } from "@mengine/medeo-client/schemas";
4
4
 
5
5
  //#region src/document/compact-projection.d.ts
@@ -49,6 +49,8 @@ interface SandboxCheckpoint {
49
49
  readonly index: number;
50
50
  }
51
51
  interface ChangePlan {
52
+ /** Native operations compiled against the causal sandbox baseline. */
53
+ loro_update?: string;
52
54
  readonly plan_kind: 'timeline' | 'entities';
53
55
  doc_id: string;
54
56
  base_version: string;
@@ -209,12 +211,44 @@ type EditScriptResult = {
209
211
  /** Run `script` against a forked document snapshot; always resolves (never rejects). */
210
212
  declare function runEditScript(options: RunEditScriptOptions): Promise<EditScriptResult>;
211
213
  //#endregion
214
+ //#region src/entity/generation-sync.d.ts
215
+ /** Factual generation lineage for recalled Memota assets, supplied by the host. */
216
+ interface AssetGenerationFact {
217
+ /** External asset id of the generation output (memota asset or speech result id). */
218
+ readonly outputAssetId: string;
219
+ /** Factual input asset ids; empty for text-only generation. */
220
+ readonly inputAssetIds: readonly string[];
221
+ }
222
+ /**
223
+ * Host callback resolving lineage by external asset id. Implementations return
224
+ * every known generation record involving the given ids in either role; an
225
+ * empty array means no known lineage and a rejection means the lineage query
226
+ * failed. Entity and Relation semantics stay inside this package.
227
+ */
228
+ type GenerationFactsLoader = (docId: string, assetIds: readonly string[]) => Promise<readonly AssetGenerationFact[]>;
229
+ /**
230
+ * Outcome of the post-commit lineage sync. `failed` is always also surfaced as
231
+ * a `generation_sync_failed` warning so an unavailable lineage query is never
232
+ * presented as synced state.
233
+ */
234
+ interface GenerationSyncOutcome {
235
+ /**
236
+ * applied: new generated Relations were committed.
237
+ * current: the query succeeded and nothing was missing (no created asset,
238
+ * single side absent, text-only generation, or pair already linked).
239
+ * failed: the host query or the sync commit failed.
240
+ */
241
+ readonly status: 'applied' | 'current' | 'failed';
242
+ readonly created_relation_ids?: readonly string[];
243
+ readonly message?: string;
244
+ }
245
+ //#endregion
212
246
  //#region src/prompt.d.ts
213
247
  declare const MEDEO_TOOL_DESCRIPTION: string;
214
248
  //#endregion
215
249
  //#region src/schema.d.ts
216
250
  declare const MEDEO_TOOL_NAME = "medeo";
217
- type MedeoToolOp = 'snapshot' | 'migrate-legacy' | 'run-edit-script' | 'commit-plan';
251
+ type MedeoToolOp = 'snapshot' | 'run-edit-script' | 'commit-plan';
218
252
  /**
219
253
  * JSON Schema for the host-facing `medeo` tool surface.
220
254
  *
@@ -224,223 +258,105 @@ type MedeoToolOp = 'snapshot' | 'migrate-legacy' | 'run-edit-script' | 'commit-p
224
258
  * journal used for commit.
225
259
  */
226
260
  declare const MEDEO_TOOL_PARAMETERS: {
227
- readonly type: 'object';
228
- readonly required: readonly ['op', 'doc_id'];
261
+ readonly type: "object";
262
+ readonly required: readonly ["op", "doc_id"];
229
263
  readonly additionalProperties: false;
230
264
  readonly properties: {
231
265
  readonly op: {
232
- readonly type: 'string';
233
- readonly enum: readonly ['snapshot', 'migrate-legacy', 'run-edit-script', 'commit-plan'];
234
- readonly description: 'Which Medeo document operation to run.';
266
+ readonly type: "string";
267
+ readonly enum: readonly ["snapshot", "run-edit-script", "commit-plan"];
268
+ readonly description: "Which Medeo document operation to run.";
235
269
  };
236
270
  readonly doc_id: {
237
- readonly type: 'string';
271
+ readonly type: "string";
238
272
  readonly minLength: 1;
239
- readonly description: 'Medeo document id. Copy it from the host context; never invent it.';
273
+ readonly description: "Medeo document id. Copy it from the host context; never invent it.";
240
274
  };
241
275
  readonly script: {
242
- readonly type: 'string';
276
+ readonly type: "string";
243
277
  readonly minLength: 1;
244
- readonly description: 'JavaScript body for run-edit-script. Use edit, timeline, entities, relations, checkpoint, rollbackTo, inputs, and console. Asset import, media relations, and timeline entity edits share one entity plan.';
278
+ readonly description: "JavaScript body for run-edit-script. Use edit, timeline, entities, relations, checkpoint, rollbackTo, inputs, and console. Asset import, media relations, and timeline entity edits share one entity plan.";
245
279
  };
246
280
  readonly inputs: {
247
- readonly type: 'object';
248
- readonly description: 'Pre-materialized, side-effect-free values passed into the script, including recalled generation lineage and asset facts. Generation and network IO must happen in the host before this call.';
249
- };
250
- readonly asset_facts: {
251
- readonly type: 'array';
252
- readonly description: 'Factual asset metadata recalled by the host for migrate-legacy only. The package reads the canonical legacy snapshot and version itself; never supply a clip trim window as media duration.';
253
- readonly items: {
254
- readonly oneOf: readonly [{
255
- readonly type: 'object';
256
- readonly additionalProperties: false;
257
- readonly required: readonly ['assetId', 'kind'];
258
- readonly properties: {
259
- readonly assetId: {
260
- readonly type: 'string';
261
- readonly minLength: 1;
262
- };
263
- readonly kind: {
264
- readonly const: 'image';
265
- };
266
- readonly storageKey: {
267
- readonly type: 'string';
268
- readonly minLength: 1;
269
- };
270
- };
271
- }, {
272
- readonly type: 'object';
273
- readonly additionalProperties: false;
274
- readonly required: readonly ['assetId', 'kind', 'durationMs'];
275
- readonly properties: {
276
- readonly assetId: {
277
- readonly type: 'string';
278
- readonly minLength: 1;
279
- };
280
- readonly kind: {
281
- readonly const: 'video';
282
- };
283
- readonly durationMs: {
284
- readonly type: 'integer';
285
- readonly minimum: 1;
286
- };
287
- readonly storageKey: {
288
- readonly type: 'string';
289
- readonly minLength: 1;
290
- };
291
- };
292
- }, {
293
- readonly type: 'object';
294
- readonly additionalProperties: false;
295
- readonly required: readonly ['assetId', 'kind', 'durationMs', 'storageKey'];
296
- readonly properties: {
297
- readonly assetId: {
298
- readonly type: 'string';
299
- readonly minLength: 1;
300
- };
301
- readonly kind: {
302
- readonly const: 'audio';
303
- };
304
- readonly durationMs: {
305
- readonly type: 'integer';
306
- readonly minimum: 1;
307
- };
308
- readonly storageKey: {
309
- readonly type: 'string';
310
- readonly minLength: 1;
311
- };
312
- };
313
- }, {
314
- readonly type: 'object';
315
- readonly additionalProperties: false;
316
- readonly required: readonly ['assetId', 'kind', 'durationMs', 'storageKey', 'voice'];
317
- readonly properties: {
318
- readonly assetId: {
319
- readonly type: 'string';
320
- readonly minLength: 1;
321
- };
322
- readonly durationMs: {
323
- readonly type: 'integer';
324
- readonly minimum: 1;
325
- };
326
- readonly storageKey: {
327
- readonly type: 'string';
328
- readonly minLength: 1;
329
- };
330
- readonly voice: {
331
- readonly type: 'object';
332
- readonly additionalProperties: false;
333
- readonly required: readonly ['system', 'key'];
334
- readonly properties: {
335
- readonly system: {
336
- readonly const: 'voice-library';
337
- };
338
- readonly key: {
339
- readonly type: 'string';
340
- readonly minLength: 1;
341
- };
342
- readonly name: {
343
- readonly type: 'string';
344
- };
345
- };
346
- };
347
- readonly kind: {
348
- readonly const: 'voice';
349
- };
350
- };
351
- }];
352
- };
281
+ readonly type: "object";
282
+ readonly description: "Pre-materialized, side-effect-free values passed into the script, including recalled asset facts. Generation history is never an input: the host queries lineage itself and syncs generated Relations after each commit. Generation and network IO must happen in the host before this call.";
353
283
  };
354
284
  readonly timeout_ms: {
355
- readonly type: 'integer';
285
+ readonly type: "integer";
356
286
  readonly minimum: 1;
357
- readonly description: 'Maximum script wall-clock time after worker startup (default 2000).';
287
+ readonly description: "Maximum script wall-clock time after worker startup (default 2000).";
358
288
  };
359
289
  readonly memory_limit_mb: {
360
- readonly type: 'integer';
290
+ readonly type: "integer";
361
291
  readonly minimum: 16;
362
- readonly description: 'Worker old-generation memory ceiling in MB (default 256).';
292
+ readonly description: "Worker old-generation memory ceiling in MB (default 256).";
363
293
  };
364
294
  readonly auto_commit: {
365
- readonly type: 'boolean';
366
- readonly description: 'Commit the returned plan immediately after the sandbox succeeds. Default false: return preview plus plan_id for explicit commit.';
295
+ readonly type: "boolean";
296
+ readonly description: "Commit the returned plan immediately after the sandbox succeeds. Default false: return preview plus plan_id for explicit commit.";
367
297
  };
368
298
  readonly plan_id: {
369
- readonly type: 'string';
299
+ readonly type: "string";
370
300
  readonly minLength: 1;
371
- readonly description: 'Plan id returned by run-edit-script; required by commit-plan.';
301
+ readonly description: "Plan id returned by run-edit-script; required by commit-plan.";
372
302
  };
373
303
  readonly validation: {
374
- readonly type: 'string';
375
- readonly enum: readonly ['version'];
376
- readonly description: 'Commit with Entity revision CAS; reject concurrent changes.';
304
+ readonly type: "string";
305
+ readonly enum: readonly ["preflight"];
306
+ readonly description: "Publish the native update already validated on its causal Loro fork.";
377
307
  };
378
308
  };
379
309
  readonly oneOf: readonly [{
380
- readonly required: readonly ['op', 'doc_id', 'asset_facts'];
310
+ readonly required: readonly ["op", "doc_id"];
381
311
  readonly properties: {
382
312
  readonly op: {
383
- readonly const: 'migrate-legacy';
313
+ readonly const: "snapshot";
384
314
  };
385
315
  readonly doc_id: {
386
- readonly $ref: '#/properties/doc_id';
387
- };
388
- readonly asset_facts: {
389
- readonly $ref: '#/properties/asset_facts';
390
- };
391
- };
392
- readonly additionalProperties: false;
393
- }, {
394
- readonly required: readonly ['op', 'doc_id'];
395
- readonly properties: {
396
- readonly op: {
397
- readonly const: 'snapshot';
398
- };
399
- readonly doc_id: {
400
- readonly $ref: '#/properties/doc_id';
316
+ readonly $ref: "#/properties/doc_id";
401
317
  };
402
318
  };
403
319
  readonly additionalProperties: false;
404
320
  }, {
405
- readonly required: readonly ['op', 'doc_id', 'script'];
321
+ readonly required: readonly ["op", "doc_id", "script"];
406
322
  readonly properties: {
407
323
  readonly op: {
408
- readonly const: 'run-edit-script';
324
+ readonly const: "run-edit-script";
409
325
  };
410
326
  readonly doc_id: {
411
- readonly $ref: '#/properties/doc_id';
327
+ readonly $ref: "#/properties/doc_id";
412
328
  };
413
329
  readonly script: {
414
- readonly $ref: '#/properties/script';
330
+ readonly $ref: "#/properties/script";
415
331
  };
416
332
  readonly inputs: {
417
- readonly $ref: '#/properties/inputs';
333
+ readonly $ref: "#/properties/inputs";
418
334
  };
419
335
  readonly timeout_ms: {
420
- readonly $ref: '#/properties/timeout_ms';
336
+ readonly $ref: "#/properties/timeout_ms";
421
337
  };
422
338
  readonly memory_limit_mb: {
423
- readonly $ref: '#/properties/memory_limit_mb';
339
+ readonly $ref: "#/properties/memory_limit_mb";
424
340
  };
425
341
  readonly auto_commit: {
426
- readonly $ref: '#/properties/auto_commit';
342
+ readonly $ref: "#/properties/auto_commit";
427
343
  };
428
344
  };
429
345
  readonly additionalProperties: false;
430
346
  }, {
431
- readonly required: readonly ['op', 'doc_id', 'plan_id'];
347
+ readonly required: readonly ["op", "doc_id", "plan_id"];
432
348
  readonly properties: {
433
349
  readonly op: {
434
- readonly const: 'commit-plan';
350
+ readonly const: "commit-plan";
435
351
  };
436
352
  readonly doc_id: {
437
- readonly $ref: '#/properties/doc_id';
353
+ readonly $ref: "#/properties/doc_id";
438
354
  };
439
355
  readonly plan_id: {
440
- readonly $ref: '#/properties/plan_id';
356
+ readonly $ref: "#/properties/plan_id";
441
357
  };
442
358
  readonly validation: {
443
- readonly $ref: '#/properties/validation';
359
+ readonly $ref: "#/properties/validation";
444
360
  };
445
361
  };
446
362
  readonly additionalProperties: false;
@@ -530,6 +446,15 @@ interface CreateMedeoToolOptions {
530
446
  * snapshot, and tolerates a concurrent creator winning the race.
531
447
  */
532
448
  loadInitialDraft?: (docId: string) => Promise<VideoDraft>;
449
+ /**
450
+ * Resolve factual generation lineage by external asset id after a confirmed
451
+ * entity commit. Return every known generation record involving the given
452
+ * ids in either role; an empty array means no known lineage and a rejection
453
+ * means the lineage query failed (surfaced as a warning, never as synced
454
+ * state). The package owns all Entity/Relation semantics: the host never
455
+ * names entities, relations, or endpoints.
456
+ */
457
+ loadGenerationFacts?: GenerationFactsLoader;
533
458
  fetchImpl?: typeof fetch;
534
459
  /** @deprecated ManualSyncDoc has no SSE or reconnect loop. */
535
460
  sseReconnectDelayMs?: number;
@@ -558,10 +483,6 @@ interface MedeoModelContext {
558
483
  type MedeoToolInput = {
559
484
  op: 'snapshot';
560
485
  doc_id: string;
561
- } | {
562
- op: 'migrate-legacy';
563
- doc_id: string;
564
- asset_facts: readonly MediaAssetFact[];
565
486
  } | {
566
487
  op: 'run-edit-script';
567
488
  doc_id: string;
@@ -574,27 +495,32 @@ type MedeoToolInput = {
574
495
  op: 'commit-plan';
575
496
  doc_id: string;
576
497
  plan_id: string;
577
- validation?: 'version' | 'preflight';
498
+ validation?: 'preflight';
578
499
  };
579
- interface MedeoToolWarning {
500
+ type MedeoToolWarning = {
580
501
  kind: 'pull_failed';
581
502
  message: string;
582
- }
503
+ } | {
504
+ kind: 'generation_sync_failed';
505
+ message: string;
506
+ };
583
507
  type EntityCommitResult = {
508
+ kind: 'conflicted';
509
+ accepted: true;
510
+ entity_revision: number;
511
+ message: string;
512
+ } | {
584
513
  kind: 'committed';
585
514
  ops_applied: number;
586
- collaborated: false;
587
- entity_revision: number;
515
+ collaborated: boolean;
516
+ entity_revision: number; /** Present only when the host supplies loadGenerationFacts. */
517
+ generation_sync?: GenerationSyncOutcome;
518
+ warnings?: MedeoToolWarning[];
588
519
  } | {
589
520
  kind: 'unconfirmed';
590
521
  reason: 'push_failed';
591
522
  ops_applied: number;
592
523
  message: string;
593
- } | {
594
- kind: 'rejected';
595
- reason: 'entity_revision_mismatch';
596
- expected: number;
597
- actual: number;
598
524
  } | {
599
525
  kind: 'rejected';
600
526
  reason: 'entity_state_rejected';
@@ -603,13 +529,6 @@ type EntityCommitResult = {
603
529
  };
604
530
  type MedeoCommitResult = CommitPlanResult | EntityCommitResult;
605
531
  type MedeoToolResult = {
606
- ok: true;
607
- op: 'migrate-legacy';
608
- doc_id: string;
609
- migration_status: 'committed' | 'already_entity';
610
- entity_revision: number;
611
- next_action: 'snapshot';
612
- } | {
613
532
  ok: true;
614
533
  op: 'snapshot';
615
534
  doc_id: string;
@@ -682,5 +601,5 @@ type MedeoInitialDraft = VideoDraft;
682
601
  */
683
602
  declare function createMedeoTool(options: CreateMedeoToolOptions): MedeoTool;
684
603
  //#endregion
685
- export { type AuthorableRelationKind, type ChangePlan, type CommitPlan, type CommitPlanOptions, type CommitPlanResult, type CompactProjectionOptions, type ConsoleShim, type CreateEntityInput, type CreateMedeoToolOptions, type DeleteEntityInput, type EditFacade, EditSandboxSession, type EditSandboxSessionOptions, type EditScriptResult, type EntityCommand, type EntityCommitResult, type EntityFacade, type EntityPlanState, type EntityStoreSnapshot, type ImportAssetInput, type JsonObject, type JsonPrimitive, type JsonValue, type KnownEntityKind, type KnownRelationKind, type LinkGeneratedRelationInput, type LinkRelationInput, MEDEO_TOOL_DESCRIPTION, MEDEO_TOOL_NAME, MEDEO_TOOL_PARAMETERS, type MedeoCommitResult, type MedeoInitialDraft, type MedeoModelContext, type MedeoModelContextInput, type MedeoTool, type MedeoToolInput, type MedeoToolOp, type MedeoToolResult, type RelationFacade, type RunEditScriptOptions, type SandboxCheckpoint, type SandboxEntity, type SandboxRelation, type TimelineClipDescriptor, type TimelineFacade, type TimelinePartDescriptor, type UnlinkRelationInput, type UpdateEntityInput, collectAffectedPartIds, commitPlan, createMedeoTool, renderCompactProjection, renderPreview, runEditScript };
604
+ export { type AssetGenerationFact, type AuthorableRelationKind, type ChangePlan, type CommitPlan, type CommitPlanOptions, type CommitPlanResult, type CompactProjectionOptions, type ConsoleShim, type CreateEntityInput, type CreateMedeoToolOptions, type DeleteEntityInput, type EditFacade, EditSandboxSession, type EditSandboxSessionOptions, type EditScriptResult, type EntityCommand, type EntityCommitResult, type EntityFacade, type EntityPlanState, type EntityStoreSnapshot, type GenerationFactsLoader, type GenerationSyncOutcome, type JsonObject, type JsonPrimitive, type JsonValue, type KnownEntityKind, type KnownRelationKind, type LinkGeneratedRelationInput, type LinkRelationInput, MEDEO_TOOL_DESCRIPTION, MEDEO_TOOL_NAME, MEDEO_TOOL_PARAMETERS, type MedeoCommitResult, type MedeoInitialDraft, type MedeoModelContext, type MedeoModelContextInput, type MedeoTool, type MedeoToolInput, type MedeoToolOp, type MedeoToolResult, type RelationFacade, type ResourceEntityKind, type RunEditScriptOptions, type SandboxCheckpoint, type SandboxEntity, type SandboxRelation, type TimelineClipDescriptor, type TimelineFacade, type TimelinePartDescriptor, type UnlinkRelationInput, type UpdateEntityInput, collectAffectedPartIds, commitPlan, createMedeoTool, renderCompactProjection, renderPreview, runEditScript };
686
605
  //# sourceMappingURL=index.d.mts.map