@nodaro/shared 3.19.0 → 3.21.0

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.cjs CHANGED
@@ -69,7 +69,7 @@ var MODEL_RECOMMENDATIONS = [
69
69
  { intent: "cheap batch video clips", modelIds: ["veo3.1", "wan-turbo", "bytedance-lite"], note: "VEO 3.1 Fast is the best price/quality balance with native audio." },
70
70
  { intent: "video with start + end frame", modelIds: ["veo3", "veo3.1", "kling-turbo", "minimax", "hailuo-standard", "seedance-2"], note: "All listed support an end frame; VEO uses imageUrls[start, end]." },
71
71
  { intent: "music / song generation", modelIds: ["suno-v6", "suno-v6_wild", "suno-v6_mini", "suno-v5_5"], note: "V6 is the default flagship; V6 Wild for bolder, less predictable results; V6 Mini when speed matters; v5.5 / v5 / v4 keep their own character. Same price." },
72
- { intent: "voice over / narration", modelIds: ["elevenlabs-v3", "elevenlabs-turbo"], note: "v3 supports [audio tags] for emotion; Turbo is cheaper for plain narration." },
72
+ { intent: "voice over / narration", modelIds: ["elevenlabs-v4", "elevenlabs-v3", "elevenlabs-turbo"], note: "v4 is the default: [audio tags] for emotion and up to 10,000 characters per request. v3 is the previous expressive model, still selectable. Turbo is cheaper for plain narration." },
73
73
  { intent: "lip-sync a portrait to audio", modelIds: ["kling-avatar-pro", "kling-avatar", "infinitalk"], note: "Pro for best mouth shape; InfiniTalk for resolution control." },
74
74
  { intent: "transcription / captions", modelIds: ["elevenlabs-stt", "incredibly-fast-whisper", "whisper"], note: "Captions need WORD timestamps: ElevenLabs STT (always) or Incredibly Fast Whisper. Plain Whisper returns phrase segments only." },
75
75
  { intent: "motion transfer (drive a subject by another video)", modelIds: ["motion-transfer", "kling-3.0-motion"], note: "Kling 2.6 base is cheap; Kling 3.0 is premium." }
@@ -2301,7 +2301,6 @@ var AUDIO_MODELS = {
2301
2301
  useCases: ["tts", "voice-over", "narration", "expressive"],
2302
2302
  features: ["audio-tags", "voice-cloning"],
2303
2303
  pricing: [{ identifier: "elevenlabs-v3", credits: 30 }],
2304
- featured: true,
2305
2304
  tts: {
2306
2305
  audioTags: true,
2307
2306
  ssmlBreaks: false,
@@ -2323,6 +2322,8 @@ var AUDIO_MODELS = {
2323
2322
  useCases: ["tts", "voice-over", "narration", "expressive", "long-form"],
2324
2323
  features: ["audio-tags", "voice-cloning"],
2325
2324
  pricing: [{ identifier: "elevenlabs-v4", credits: 30 }],
2325
+ // The default speech model (DEFAULT_TTS_PROVIDER) carries the star.
2326
+ featured: true,
2326
2327
  tts: {
2327
2328
  audioTags: true,
2328
2329
  ssmlBreaks: false,
@@ -3747,6 +3748,7 @@ var TTS_PROVIDERS = [
3747
3748
  "elevenlabs-multilingual",
3748
3749
  "elevenlabs"
3749
3750
  ];
3751
+ var DEFAULT_TTS_PROVIDER = "elevenlabs-v4";
3750
3752
  var TEXT_TO_AUDIO_PROVIDERS = [
3751
3753
  // Replicate disabled
3752
3754
  // "tangoflux",
@@ -5816,6 +5818,10 @@ var FAN_OUT_EACH_HANDLES = {
5816
5818
  // (decided 2026-10-04).
5817
5819
  "camera-switch": { each: ["edl"], primary: "edl" }
5818
5820
  };
5821
+ var OWN_LIST_NODE_TYPES = /* @__PURE__ */ new Set(["extract-field", "json-process"]);
5822
+ function ownsItsList(nodeType) {
5823
+ return typeof nodeType === "string" && OWN_LIST_NODE_TYPES.has(nodeType);
5824
+ }
5819
5825
  function defaultEdgeOutputMode(sourceType, sourceHandle) {
5820
5826
  if (typeof sourceType !== "string") return "last";
5821
5827
  if (FAN_OUT_EACH_TYPES.has(sourceType)) return "each";
@@ -12793,6 +12799,11 @@ var EXECUTION_DATA_KEYS = /* @__PURE__ */ new Set([
12793
12799
  "__pickedTotal",
12794
12800
  "__restTotal",
12795
12801
  "generatedJson",
12802
+ // Edit Plan: a person's review of the plan (`EditedEdl`, edit-plan-review.ts),
12803
+ // kept beside `generatedJson` and fingerprinted against it. Run-result data
12804
+ // (TA14, decided 2026-10-04): out of undo, presets, templates and exports,
12805
+ // and Clear results wipes it. Persisted — never transient.
12806
+ "editedEdl",
12796
12807
  "subWorkflowProgress",
12797
12808
  "outputResults",
12798
12809
  "shots",
@@ -21273,6 +21284,167 @@ function unwrapEditPlanOutput(outputData) {
21273
21284
  return rest;
21274
21285
  }
21275
21286
 
21287
+ // src/edit-plan-review.ts
21288
+ var EDITED_EDL_VERSION = 1;
21289
+ function canonicalJson(value) {
21290
+ if (value === null) return "null";
21291
+ switch (typeof value) {
21292
+ case "string":
21293
+ case "boolean":
21294
+ return JSON.stringify(value);
21295
+ case "number":
21296
+ return Number.isFinite(value) ? JSON.stringify(value) : "null";
21297
+ case "object": {
21298
+ const toJSON = value.toJSON;
21299
+ if (typeof toJSON === "function") return canonicalJson(value.toJSON());
21300
+ if (Array.isArray(value)) return `[${value.map((item) => canonicalJson(item) ?? "null").join(",")}]`;
21301
+ const parts = [];
21302
+ for (const key of Object.keys(value).sort()) {
21303
+ const text = canonicalJson(value[key]);
21304
+ if (text !== void 0) parts.push(`${JSON.stringify(key)}:${text}`);
21305
+ }
21306
+ return `{${parts.join(",")}}`;
21307
+ }
21308
+ default:
21309
+ return void 0;
21310
+ }
21311
+ }
21312
+ function fnv1a64(text) {
21313
+ let hi = 3421674724;
21314
+ let lo = 2216829733;
21315
+ const mix = (byte) => {
21316
+ lo = (lo ^ byte) >>> 0;
21317
+ const loProduct = lo * 435;
21318
+ const carry = Math.floor(loProduct / 4294967296);
21319
+ hi = hi * 435 + carry + (lo << 8 >>> 0) >>> 0;
21320
+ lo = loProduct >>> 0;
21321
+ };
21322
+ for (let i = 0; i < text.length; i++) {
21323
+ let code = text.charCodeAt(i);
21324
+ if (code >= 55296 && code <= 56319) {
21325
+ const next = i + 1 < text.length ? text.charCodeAt(i + 1) : 0;
21326
+ if (next >= 56320 && next <= 57343) {
21327
+ code = 65536 + (code - 55296 << 10) + (next - 56320);
21328
+ i++;
21329
+ } else code = 65533;
21330
+ } else if (code >= 56320 && code <= 57343) code = 65533;
21331
+ if (code < 128) mix(code);
21332
+ else if (code < 2048) {
21333
+ mix(192 | code >> 6);
21334
+ mix(128 | code & 63);
21335
+ } else if (code < 65536) {
21336
+ mix(224 | code >> 12);
21337
+ mix(128 | code >> 6 & 63);
21338
+ mix(128 | code & 63);
21339
+ } else {
21340
+ mix(240 | code >> 18);
21341
+ mix(128 | code >> 12 & 63);
21342
+ mix(128 | code >> 6 & 63);
21343
+ mix(128 | code & 63);
21344
+ }
21345
+ }
21346
+ return hi.toString(16).padStart(8, "0") + lo.toString(16).padStart(8, "0");
21347
+ }
21348
+ function editPlanBasis(plan) {
21349
+ return fnv1a64(canonicalJson(plan) ?? "");
21350
+ }
21351
+ var isRecord3 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
21352
+ function planShape(plan) {
21353
+ if (Array.isArray(plan)) return "clips";
21354
+ if (isRecord3(plan) && Array.isArray(plan.segments)) return "edl";
21355
+ return "other";
21356
+ }
21357
+ function checkEnvelope(edited, plan) {
21358
+ if (edited === void 0 || edited === null) return { status: "none" };
21359
+ if (!isRecord3(edited)) return { status: "invalid", issue: "editedEdl must be an object" };
21360
+ if (edited.v !== EDITED_EDL_VERSION) return { status: "invalid", issue: `editedEdl.v must be ${EDITED_EDL_VERSION}` };
21361
+ if (typeof edited.basis !== "string" || edited.basis.length === 0) {
21362
+ return { status: "invalid", issue: "editedEdl.basis must be a non-empty string" };
21363
+ }
21364
+ if (edited.kind !== "edl" && edited.kind !== "clips") {
21365
+ return { status: "invalid", issue: `editedEdl.kind must be "edl" or "clips"` };
21366
+ }
21367
+ if (edited.basis !== editPlanBasis(plan)) {
21368
+ return { status: "stale", issue: "editedEdl.basis does not match the plan: the plan changed since this edit was made" };
21369
+ }
21370
+ const shape = planShape(plan);
21371
+ if (edited.kind === "edl") {
21372
+ if (shape !== "edl") return { status: "invalid", issue: `an "edl" edit needs a Tighten plan (one EDL); this plan is ${describeShape(shape)}` };
21373
+ const edl = edited.edl;
21374
+ if (!isRecord3(edl) || !Array.isArray(edl.segments) || !Array.isArray(edl.dropped)) {
21375
+ return { status: "invalid", issue: "editedEdl.edl must hold a segments array and a dropped array" };
21376
+ }
21377
+ } else if (edited.kind === "clips") {
21378
+ if (shape !== "clips") return { status: "invalid", issue: `a "clips" edit needs a clip set; this plan is ${describeShape(shape)}` };
21379
+ const clips = edited.clips;
21380
+ if (!Array.isArray(clips)) return { status: "invalid", issue: "editedEdl.clips must be an array" };
21381
+ const planned = plan.length;
21382
+ if (clips.length !== planned) {
21383
+ return { status: "invalid", issue: `editedEdl.clips holds ${clips.length} decisions; the plan has ${planned} clips` };
21384
+ }
21385
+ const bad = clips.findIndex(
21386
+ (c) => !isRecord3(c) || typeof c.keep !== "boolean" || c.hook !== void 0 && typeof c.hook !== "string"
21387
+ );
21388
+ if (bad >= 0) return { status: "invalid", issue: `editedEdl.clips[${bad}] must be {keep: boolean, hook?: string}` };
21389
+ }
21390
+ return { status: "applied", edited };
21391
+ }
21392
+ function describeShape(shape) {
21393
+ return shape === "edl" ? "a Tighten plan" : shape === "clips" ? "a clip set" : "neither (a chapter list, or no plan)";
21394
+ }
21395
+ function plannedList(plan) {
21396
+ return plan.map((clip) => typeof clip === "string" ? clip : JSON.stringify(clip));
21397
+ }
21398
+ function asOutput(plan) {
21399
+ return Array.isArray(plan) ? { json: plan, listResults: plannedList(plan) } : { json: plan };
21400
+ }
21401
+ function withHook(clip, hook) {
21402
+ if (hook === void 0) return clip;
21403
+ let value = clip;
21404
+ if (typeof clip === "string") {
21405
+ try {
21406
+ value = JSON.parse(clip);
21407
+ } catch {
21408
+ return clip;
21409
+ }
21410
+ }
21411
+ if (!isRecord3(value)) return clip;
21412
+ const meta = isRecord3(value.meta) ? value.meta : {};
21413
+ return { ...value, meta: { ...meta, hook } };
21414
+ }
21415
+ function resolveEditPlanOutput(plan, editedEdl) {
21416
+ const check = checkEnvelope(editedEdl, plan);
21417
+ if (check.status !== "applied") return { status: check.status, ...asOutput(plan) };
21418
+ const edited = check.edited;
21419
+ if (edited.kind === "edl") {
21420
+ const json = { ...plan, segments: edited.edl.segments, dropped: edited.edl.dropped };
21421
+ return { status: "applied", json };
21422
+ }
21423
+ const rows = plan.map((clip, i) => {
21424
+ const decision = edited.clips[i];
21425
+ return decision.keep ? withHook(clip, decision.hook) : void 0;
21426
+ });
21427
+ return {
21428
+ status: "applied",
21429
+ json: rows.filter((clip) => clip !== void 0),
21430
+ listResults: rows.map((clip) => clip === void 0 ? "" : typeof clip === "string" ? clip : JSON.stringify(clip))
21431
+ };
21432
+ }
21433
+ function editPlanSavedOutput(data) {
21434
+ const plan = data.generatedJson;
21435
+ if (plan === void 0) return void 0;
21436
+ const { status: _status, ...output } = resolveEditPlanOutput(plan, data.editedEdl);
21437
+ return output;
21438
+ }
21439
+ function validateEditedEdl(editedEdl, plan) {
21440
+ const check = checkEnvelope(editedEdl, plan);
21441
+ if (check.status === "none") return { ok: false, issues: ["there is no edit"], warnings: [] };
21442
+ if (check.status !== "applied") return { ok: false, issues: [check.issue], warnings: [] };
21443
+ if (check.edited.kind === "clips") return { ok: true, issues: [], warnings: [] };
21444
+ const resolved = resolveEditPlanOutput(plan, editedEdl).json;
21445
+ return validateEdl(resolved);
21446
+ }
21447
+
21276
21448
  exports.ACCESS_LEVELS = ACCESS_LEVELS;
21277
21449
  exports.ACTION_CARD_KINDS = ACTION_CARD_KINDS;
21278
21450
  exports.ACTIVE_SCENE_HELPERS = ACTIVE_SCENE_HELPERS;
@@ -21410,6 +21582,7 @@ exports.DEFAULT_TEMPLATE_CATEGORY = DEFAULT_TEMPLATE_CATEGORY;
21410
21582
  exports.DEFAULT_TEXT_TO_AUDIO_PROVIDER = DEFAULT_TEXT_TO_AUDIO_PROVIDER;
21411
21583
  exports.DEFAULT_TRANSCRIBE_NODE_PROVIDER = DEFAULT_TRANSCRIBE_NODE_PROVIDER;
21412
21584
  exports.DEFAULT_TRANSCRIBE_PROVIDER = DEFAULT_TRANSCRIBE_PROVIDER;
21585
+ exports.DEFAULT_TTS_PROVIDER = DEFAULT_TTS_PROVIDER;
21413
21586
  exports.DEFAULT_USAGE_MODE = DEFAULT_USAGE_MODE;
21414
21587
  exports.DEFAULT_VIDEO_ANALYSIS_MODEL = DEFAULT_VIDEO_ANALYSIS_MODEL;
21415
21588
  exports.DEFAULT_VIDEO_ANALYSIS_TIER = DEFAULT_VIDEO_ANALYSIS_TIER;
@@ -21423,6 +21596,7 @@ exports.DETAIL_VARIANTS = DETAIL_VARIANTS;
21423
21596
  exports.DURATION_PRICED_PROVIDERS = DURATION_PRICED_PROVIDERS;
21424
21597
  exports.DYNAMIC_PRODUCER_TYPES = DYNAMIC_PRODUCER_TYPES;
21425
21598
  exports.DetectionResultSchema = DetectionResultSchema;
21599
+ exports.EDITED_EDL_VERSION = EDITED_EDL_VERSION;
21426
21600
  exports.EDIT_PLAN_BASE_CREDIT_ID = EDIT_PLAN_BASE_CREDIT_ID;
21427
21601
  exports.EDIT_PLAN_BUCKET_MINUTES = EDIT_PLAN_BUCKET_MINUTES;
21428
21602
  exports.EDIT_PLAN_DEFAULT_CLIP_COUNT = EDIT_PLAN_DEFAULT_CLIP_COUNT;
@@ -21662,6 +21836,7 @@ exports.OVERLAY_PLATFORM_IDS = OVERLAY_PLATFORM_IDS;
21662
21836
  exports.OVERLAY_SHAPES = OVERLAY_SHAPES;
21663
21837
  exports.OVERLAY_TEXT_ALIGNS = OVERLAY_TEXT_ALIGNS;
21664
21838
  exports.OVERLAY_VARIANT_HANDLE_PREFIX = OVERLAY_VARIANT_HANDLE_PREFIX;
21839
+ exports.OWN_LIST_NODE_TYPES = OWN_LIST_NODE_TYPES;
21665
21840
  exports.ObjectMetadataSchema = ObjectMetadataSchema;
21666
21841
  exports.OptimizeForModelInputSchema = OptimizeForModelInputSchema;
21667
21842
  exports.OptimizeForModelResultSchema = OptimizeForModelResultSchema;
@@ -22179,7 +22354,9 @@ exports.detectVideoLinkPlatform = detectVideoLinkPlatform;
22179
22354
  exports.dropUnknownBindings = dropUnknownBindings;
22180
22355
  exports.dropUnknownSpeakers = dropUnknownSpeakers;
22181
22356
  exports.durationsByMode = durationsByMode;
22357
+ exports.editPlanBasis = editPlanBasis;
22182
22358
  exports.editPlanBucketMinutes = editPlanBucketMinutes;
22359
+ exports.editPlanSavedOutput = editPlanSavedOutput;
22183
22360
  exports.editPlanSourceDurationSec = editPlanSourceDurationSec;
22184
22361
  exports.editPlanTranscriptOrigin = editPlanTranscriptOrigin;
22185
22362
  exports.edlDurationMs = edlDurationMs;
@@ -22451,6 +22628,7 @@ exports.overlayStrokeSchema = overlayStrokeSchema;
22451
22628
  exports.overlayTextStyleSchema = overlayTextStyleSchema;
22452
22629
  exports.overlayVariantHandle = overlayVariantHandle;
22453
22630
  exports.overlayVariantIdFromHandle = overlayVariantIdFromHandle;
22631
+ exports.ownsItsList = ownsItsList;
22454
22632
  exports.parseAspectToken = parseAspectToken;
22455
22633
  exports.parseAttributedDialogue = parseAttributedDialogue;
22456
22634
  exports.parseCharacterMentionToken = parseCharacterMentionToken;
@@ -22518,6 +22696,7 @@ exports.resolveConditionValue = resolveConditionValue;
22518
22696
  exports.resolveDefaultRole = resolveDefaultRole;
22519
22697
  exports.resolveDescription = resolveDescription;
22520
22698
  exports.resolveDialogueVoices = resolveDialogueVoices;
22699
+ exports.resolveEditPlanOutput = resolveEditPlanOutput;
22521
22700
  exports.resolveEditPlanSources = resolveEditPlanSources;
22522
22701
  exports.resolveEdlSegmentSlots = resolveEdlSegmentSlots;
22523
22702
  exports.resolveEffectiveSourceType = resolveEffectiveSourceType;
@@ -22756,6 +22935,7 @@ exports.usdToCredits = usdToCredits;
22756
22935
  exports.validateAiAvatarPayload = validateAiAvatarPayload;
22757
22936
  exports.validateCinematicAvatarPayload = validateCinematicAvatarPayload;
22758
22937
  exports.validateDurationForFormat = validateDurationForFormat;
22938
+ exports.validateEditedEdl = validateEditedEdl;
22759
22939
  exports.validateEdl = validateEdl;
22760
22940
  exports.validateEdlClipSet = validateEdlClipSet;
22761
22941
  exports.validateModeActivation = validateModeActivation;