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

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,4 +1,4 @@
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";
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-hKZbJSRP.mjs";
2
2
  import { JournalEntry, ManualSyncDoc, MediaAssetFact, 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
 
@@ -209,6 +209,38 @@ type EditScriptResult = {
209
209
  /** Run `script` against a forked document snapshot; always resolves (never rejects). */
210
210
  declare function runEditScript(options: RunEditScriptOptions): Promise<EditScriptResult>;
211
211
  //#endregion
212
+ //#region src/entity/generation-sync.d.ts
213
+ /** Factual generation lineage for recalled Memota assets, supplied by the host. */
214
+ interface AssetGenerationFact {
215
+ /** External asset id of the generation output (memota asset or speech result id). */
216
+ readonly outputAssetId: string;
217
+ /** Factual input asset ids; empty for text-only generation. */
218
+ readonly inputAssetIds: readonly string[];
219
+ }
220
+ /**
221
+ * Host callback resolving lineage by external asset id. Implementations return
222
+ * every known generation record involving the given ids in either role; an
223
+ * empty array means no known lineage and a rejection means the lineage query
224
+ * failed. Entity and Relation semantics stay inside this package.
225
+ */
226
+ type GenerationFactsLoader = (docId: string, assetIds: readonly string[]) => Promise<readonly AssetGenerationFact[]>;
227
+ /**
228
+ * Outcome of the post-commit lineage sync. `failed` is always also surfaced as
229
+ * a `generation_sync_failed` warning so an unavailable lineage query is never
230
+ * presented as synced state.
231
+ */
232
+ interface GenerationSyncOutcome {
233
+ /**
234
+ * applied: new generated Relations were committed.
235
+ * current: the query succeeded and nothing was missing (no created asset,
236
+ * single side absent, text-only generation, or pair already linked).
237
+ * failed: the host query or the sync commit failed.
238
+ */
239
+ readonly status: 'applied' | 'current' | 'failed';
240
+ readonly created_relation_ids?: readonly string[];
241
+ readonly message?: string;
242
+ }
243
+ //#endregion
212
244
  //#region src/prompt.d.ts
213
245
  declare const MEDEO_TOOL_DESCRIPTION: string;
214
246
  //#endregion
@@ -224,223 +256,223 @@ type MedeoToolOp = 'snapshot' | 'migrate-legacy' | 'run-edit-script' | 'commit-p
224
256
  * journal used for commit.
225
257
  */
226
258
  declare const MEDEO_TOOL_PARAMETERS: {
227
- readonly type: 'object';
228
- readonly required: readonly ['op', 'doc_id'];
259
+ readonly type: "object";
260
+ readonly required: readonly ["op", "doc_id"];
229
261
  readonly additionalProperties: false;
230
262
  readonly properties: {
231
263
  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.';
264
+ readonly type: "string";
265
+ readonly enum: readonly ["snapshot", "migrate-legacy", "run-edit-script", "commit-plan"];
266
+ readonly description: "Which Medeo document operation to run.";
235
267
  };
236
268
  readonly doc_id: {
237
- readonly type: 'string';
269
+ readonly type: "string";
238
270
  readonly minLength: 1;
239
- readonly description: 'Medeo document id. Copy it from the host context; never invent it.';
271
+ readonly description: "Medeo document id. Copy it from the host context; never invent it.";
240
272
  };
241
273
  readonly script: {
242
- readonly type: 'string';
274
+ readonly type: "string";
243
275
  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.';
276
+ 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
277
  };
246
278
  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.';
279
+ readonly type: "object";
280
+ 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.";
249
281
  };
250
282
  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.';
283
+ readonly type: "array";
284
+ 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
285
  readonly items: {
254
286
  readonly oneOf: readonly [{
255
- readonly type: 'object';
287
+ readonly type: "object";
256
288
  readonly additionalProperties: false;
257
- readonly required: readonly ['assetId', 'kind'];
289
+ readonly required: readonly ["assetId", "kind"];
258
290
  readonly properties: {
259
291
  readonly assetId: {
260
- readonly type: 'string';
292
+ readonly type: "string";
261
293
  readonly minLength: 1;
262
294
  };
263
295
  readonly kind: {
264
- readonly const: 'image';
296
+ readonly const: "image";
265
297
  };
266
298
  readonly storageKey: {
267
- readonly type: 'string';
299
+ readonly type: "string";
268
300
  readonly minLength: 1;
269
301
  };
270
302
  };
271
303
  }, {
272
- readonly type: 'object';
304
+ readonly type: "object";
273
305
  readonly additionalProperties: false;
274
- readonly required: readonly ['assetId', 'kind', 'durationMs'];
306
+ readonly required: readonly ["assetId", "kind", "durationMs"];
275
307
  readonly properties: {
276
308
  readonly assetId: {
277
- readonly type: 'string';
309
+ readonly type: "string";
278
310
  readonly minLength: 1;
279
311
  };
280
312
  readonly kind: {
281
- readonly const: 'video';
313
+ readonly const: "video";
282
314
  };
283
315
  readonly durationMs: {
284
- readonly type: 'integer';
316
+ readonly type: "integer";
285
317
  readonly minimum: 1;
286
318
  };
287
319
  readonly storageKey: {
288
- readonly type: 'string';
320
+ readonly type: "string";
289
321
  readonly minLength: 1;
290
322
  };
291
323
  };
292
324
  }, {
293
- readonly type: 'object';
325
+ readonly type: "object";
294
326
  readonly additionalProperties: false;
295
- readonly required: readonly ['assetId', 'kind', 'durationMs', 'storageKey'];
327
+ readonly required: readonly ["assetId", "kind", "durationMs", "storageKey"];
296
328
  readonly properties: {
297
329
  readonly assetId: {
298
- readonly type: 'string';
330
+ readonly type: "string";
299
331
  readonly minLength: 1;
300
332
  };
301
333
  readonly kind: {
302
- readonly const: 'audio';
334
+ readonly const: "audio";
303
335
  };
304
336
  readonly durationMs: {
305
- readonly type: 'integer';
337
+ readonly type: "integer";
306
338
  readonly minimum: 1;
307
339
  };
308
340
  readonly storageKey: {
309
- readonly type: 'string';
341
+ readonly type: "string";
310
342
  readonly minLength: 1;
311
343
  };
312
344
  };
313
345
  }, {
314
- readonly type: 'object';
346
+ readonly type: "object";
315
347
  readonly additionalProperties: false;
316
- readonly required: readonly ['assetId', 'kind', 'durationMs', 'storageKey', 'voice'];
348
+ readonly required: readonly ["assetId", "kind", "durationMs", "storageKey", "voice"];
317
349
  readonly properties: {
350
+ readonly kind: {
351
+ readonly const: "voice";
352
+ };
318
353
  readonly assetId: {
319
- readonly type: 'string';
354
+ readonly type: "string";
320
355
  readonly minLength: 1;
321
356
  };
322
357
  readonly durationMs: {
323
- readonly type: 'integer';
358
+ readonly type: "integer";
324
359
  readonly minimum: 1;
325
360
  };
326
361
  readonly storageKey: {
327
- readonly type: 'string';
362
+ readonly type: "string";
328
363
  readonly minLength: 1;
329
364
  };
330
365
  readonly voice: {
331
- readonly type: 'object';
366
+ readonly type: "object";
332
367
  readonly additionalProperties: false;
333
- readonly required: readonly ['system', 'key'];
368
+ readonly required: readonly ["system", "key"];
334
369
  readonly properties: {
335
370
  readonly system: {
336
- readonly const: 'voice-library';
371
+ readonly const: "voice-library";
337
372
  };
338
373
  readonly key: {
339
- readonly type: 'string';
374
+ readonly type: "string";
340
375
  readonly minLength: 1;
341
376
  };
342
377
  readonly name: {
343
- readonly type: 'string';
378
+ readonly type: "string";
344
379
  };
345
380
  };
346
381
  };
347
- readonly kind: {
348
- readonly const: 'voice';
349
- };
350
382
  };
351
383
  }];
352
384
  };
353
385
  };
354
386
  readonly timeout_ms: {
355
- readonly type: 'integer';
387
+ readonly type: "integer";
356
388
  readonly minimum: 1;
357
- readonly description: 'Maximum script wall-clock time after worker startup (default 2000).';
389
+ readonly description: "Maximum script wall-clock time after worker startup (default 2000).";
358
390
  };
359
391
  readonly memory_limit_mb: {
360
- readonly type: 'integer';
392
+ readonly type: "integer";
361
393
  readonly minimum: 16;
362
- readonly description: 'Worker old-generation memory ceiling in MB (default 256).';
394
+ readonly description: "Worker old-generation memory ceiling in MB (default 256).";
363
395
  };
364
396
  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.';
397
+ readonly type: "boolean";
398
+ readonly description: "Commit the returned plan immediately after the sandbox succeeds. Default false: return preview plus plan_id for explicit commit.";
367
399
  };
368
400
  readonly plan_id: {
369
- readonly type: 'string';
401
+ readonly type: "string";
370
402
  readonly minLength: 1;
371
- readonly description: 'Plan id returned by run-edit-script; required by commit-plan.';
403
+ readonly description: "Plan id returned by run-edit-script; required by commit-plan.";
372
404
  };
373
405
  readonly validation: {
374
- readonly type: 'string';
375
- readonly enum: readonly ['version'];
376
- readonly description: 'Commit with Entity revision CAS; reject concurrent changes.';
406
+ readonly type: "string";
407
+ readonly enum: readonly ["version"];
408
+ readonly description: "Commit with Entity revision CAS; reject concurrent changes.";
377
409
  };
378
410
  };
379
411
  readonly oneOf: readonly [{
380
- readonly required: readonly ['op', 'doc_id', 'asset_facts'];
412
+ readonly required: readonly ["op", "doc_id", "asset_facts"];
381
413
  readonly properties: {
382
414
  readonly op: {
383
- readonly const: 'migrate-legacy';
415
+ readonly const: "migrate-legacy";
384
416
  };
385
417
  readonly doc_id: {
386
- readonly $ref: '#/properties/doc_id';
418
+ readonly $ref: "#/properties/doc_id";
387
419
  };
388
420
  readonly asset_facts: {
389
- readonly $ref: '#/properties/asset_facts';
421
+ readonly $ref: "#/properties/asset_facts";
390
422
  };
391
423
  };
392
424
  readonly additionalProperties: false;
393
425
  }, {
394
- readonly required: readonly ['op', 'doc_id'];
426
+ readonly required: readonly ["op", "doc_id"];
395
427
  readonly properties: {
396
428
  readonly op: {
397
- readonly const: 'snapshot';
429
+ readonly const: "snapshot";
398
430
  };
399
431
  readonly doc_id: {
400
- readonly $ref: '#/properties/doc_id';
432
+ readonly $ref: "#/properties/doc_id";
401
433
  };
402
434
  };
403
435
  readonly additionalProperties: false;
404
436
  }, {
405
- readonly required: readonly ['op', 'doc_id', 'script'];
437
+ readonly required: readonly ["op", "doc_id", "script"];
406
438
  readonly properties: {
407
439
  readonly op: {
408
- readonly const: 'run-edit-script';
440
+ readonly const: "run-edit-script";
409
441
  };
410
442
  readonly doc_id: {
411
- readonly $ref: '#/properties/doc_id';
443
+ readonly $ref: "#/properties/doc_id";
412
444
  };
413
445
  readonly script: {
414
- readonly $ref: '#/properties/script';
446
+ readonly $ref: "#/properties/script";
415
447
  };
416
448
  readonly inputs: {
417
- readonly $ref: '#/properties/inputs';
449
+ readonly $ref: "#/properties/inputs";
418
450
  };
419
451
  readonly timeout_ms: {
420
- readonly $ref: '#/properties/timeout_ms';
452
+ readonly $ref: "#/properties/timeout_ms";
421
453
  };
422
454
  readonly memory_limit_mb: {
423
- readonly $ref: '#/properties/memory_limit_mb';
455
+ readonly $ref: "#/properties/memory_limit_mb";
424
456
  };
425
457
  readonly auto_commit: {
426
- readonly $ref: '#/properties/auto_commit';
458
+ readonly $ref: "#/properties/auto_commit";
427
459
  };
428
460
  };
429
461
  readonly additionalProperties: false;
430
462
  }, {
431
- readonly required: readonly ['op', 'doc_id', 'plan_id'];
463
+ readonly required: readonly ["op", "doc_id", "plan_id"];
432
464
  readonly properties: {
433
465
  readonly op: {
434
- readonly const: 'commit-plan';
466
+ readonly const: "commit-plan";
435
467
  };
436
468
  readonly doc_id: {
437
- readonly $ref: '#/properties/doc_id';
469
+ readonly $ref: "#/properties/doc_id";
438
470
  };
439
471
  readonly plan_id: {
440
- readonly $ref: '#/properties/plan_id';
472
+ readonly $ref: "#/properties/plan_id";
441
473
  };
442
474
  readonly validation: {
443
- readonly $ref: '#/properties/validation';
475
+ readonly $ref: "#/properties/validation";
444
476
  };
445
477
  };
446
478
  readonly additionalProperties: false;
@@ -530,6 +562,15 @@ interface CreateMedeoToolOptions {
530
562
  * snapshot, and tolerates a concurrent creator winning the race.
531
563
  */
532
564
  loadInitialDraft?: (docId: string) => Promise<VideoDraft>;
565
+ /**
566
+ * Resolve factual generation lineage by external asset id after a confirmed
567
+ * entity commit. Return every known generation record involving the given
568
+ * ids in either role; an empty array means no known lineage and a rejection
569
+ * means the lineage query failed (surfaced as a warning, never as synced
570
+ * state). The package owns all Entity/Relation semantics: the host never
571
+ * names entities, relations, or endpoints.
572
+ */
573
+ loadGenerationFacts?: GenerationFactsLoader;
533
574
  fetchImpl?: typeof fetch;
534
575
  /** @deprecated ManualSyncDoc has no SSE or reconnect loop. */
535
576
  sseReconnectDelayMs?: number;
@@ -576,15 +617,20 @@ type MedeoToolInput = {
576
617
  plan_id: string;
577
618
  validation?: 'version' | 'preflight';
578
619
  };
579
- interface MedeoToolWarning {
620
+ type MedeoToolWarning = {
580
621
  kind: 'pull_failed';
581
622
  message: string;
582
- }
623
+ } | {
624
+ kind: 'generation_sync_failed';
625
+ message: string;
626
+ };
583
627
  type EntityCommitResult = {
584
628
  kind: 'committed';
585
629
  ops_applied: number;
586
630
  collaborated: false;
587
- entity_revision: number;
631
+ entity_revision: number; /** Present only when the host supplies loadGenerationFacts. */
632
+ generation_sync?: GenerationSyncOutcome;
633
+ warnings?: MedeoToolWarning[];
588
634
  } | {
589
635
  kind: 'unconfirmed';
590
636
  reason: 'push_failed';
@@ -682,5 +728,5 @@ type MedeoInitialDraft = VideoDraft;
682
728
  */
683
729
  declare function createMedeoTool(options: CreateMedeoToolOptions): MedeoTool;
684
730
  //#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 };
731
+ 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
732
  //# sourceMappingURL=index.d.mts.map