@nodaro/shared 3.36.0 → 3.37.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.
Files changed (97) hide show
  1. package/dist/{chunk-BSQCKTXH.cjs → chunk-33QG2DOW.cjs} +6 -6
  2. package/dist/{chunk-BSQCKTXH.cjs.map → chunk-33QG2DOW.cjs.map} +1 -1
  3. package/dist/{chunk-FKQJYMCO.js → chunk-4XI6B4RU.js} +25 -13
  4. package/dist/chunk-4XI6B4RU.js.map +1 -0
  5. package/dist/{chunk-NYMOHNYV.js → chunk-5OED47LE.js} +3 -3
  6. package/dist/{chunk-NYMOHNYV.js.map → chunk-5OED47LE.js.map} +1 -1
  7. package/dist/{chunk-GZH2SIOF.cjs → chunk-5PCI6M44.cjs} +18 -6
  8. package/dist/chunk-5PCI6M44.cjs.map +1 -0
  9. package/dist/chunk-6Q4BS6AR.js +158 -0
  10. package/dist/chunk-6Q4BS6AR.js.map +1 -0
  11. package/dist/{chunk-LT5IJO4Y.cjs → chunk-6Y66YM4M.cjs} +10 -10
  12. package/dist/{chunk-LT5IJO4Y.cjs.map → chunk-6Y66YM4M.cjs.map} +1 -1
  13. package/dist/{chunk-YN6AXDN5.cjs → chunk-7Q75OZBL.cjs} +7 -7
  14. package/dist/{chunk-YN6AXDN5.cjs.map → chunk-7Q75OZBL.cjs.map} +1 -1
  15. package/dist/{chunk-AXUW64ZY.js → chunk-7QITUDRT.js} +3 -3
  16. package/dist/{chunk-AXUW64ZY.js.map → chunk-7QITUDRT.js.map} +1 -1
  17. package/dist/{chunk-TCBHVIMD.js → chunk-CQJYKSXF.js} +18 -6
  18. package/dist/chunk-CQJYKSXF.js.map +1 -0
  19. package/dist/chunk-DBD4BCGH.cjs +169 -0
  20. package/dist/chunk-DBD4BCGH.cjs.map +1 -0
  21. package/dist/{chunk-7VQPHLZ5.cjs → chunk-ENFBA33M.cjs} +21 -21
  22. package/dist/{chunk-7VQPHLZ5.cjs.map → chunk-ENFBA33M.cjs.map} +1 -1
  23. package/dist/{chunk-BBLE4UTG.cjs → chunk-GLON7ANZ.cjs} +48 -15
  24. package/dist/chunk-GLON7ANZ.cjs.map +1 -0
  25. package/dist/{chunk-JSGIEF6Z.cjs → chunk-HSJU5KNR.cjs} +6 -3
  26. package/dist/chunk-HSJU5KNR.cjs.map +1 -0
  27. package/dist/{chunk-NITAUX3A.cjs → chunk-JLKZEKQ3.cjs} +45 -28
  28. package/dist/chunk-JLKZEKQ3.cjs.map +1 -0
  29. package/dist/{chunk-2HVFF5SS.js → chunk-L6HS52BV.js} +3 -3
  30. package/dist/{chunk-2HVFF5SS.js.map → chunk-L6HS52BV.js.map} +1 -1
  31. package/dist/{chunk-V3N56Z2S.cjs → chunk-M6JHRWVY.cjs} +27 -12
  32. package/dist/chunk-M6JHRWVY.cjs.map +1 -0
  33. package/dist/{chunk-AWWOQH46.cjs → chunk-NARVPCWW.cjs} +6 -6
  34. package/dist/{chunk-AWWOQH46.cjs.map → chunk-NARVPCWW.cjs.map} +1 -1
  35. package/dist/{chunk-ANOQWAMU.js → chunk-R6B2UDFR.js} +35 -5
  36. package/dist/chunk-R6B2UDFR.js.map +1 -0
  37. package/dist/{chunk-56VQ7V3V.js → chunk-WD6AJ533.js} +3 -3
  38. package/dist/{chunk-56VQ7V3V.js.map → chunk-WD6AJ533.js.map} +1 -1
  39. package/dist/{chunk-XNISPHTZ.js → chunk-WPT5ZTA2.js} +6 -3
  40. package/dist/chunk-WPT5ZTA2.js.map +1 -0
  41. package/dist/{chunk-NTHRTRQK.js → chunk-XA53RUSD.js} +22 -6
  42. package/dist/chunk-XA53RUSD.js.map +1 -0
  43. package/dist/{chunk-7AB3AE5L.js → chunk-YVKUCBY2.js} +3 -3
  44. package/dist/{chunk-7AB3AE5L.js.map → chunk-YVKUCBY2.js.map} +1 -1
  45. package/dist/entries/apps.cjs +38 -38
  46. package/dist/entries/apps.js +3 -3
  47. package/dist/entries/credits.cjs +128 -128
  48. package/dist/entries/credits.js +2 -2
  49. package/dist/entries/llm-models.cjs +60 -48
  50. package/dist/entries/llm-models.d.cts +45 -14
  51. package/dist/entries/llm-models.d.ts +45 -14
  52. package/dist/entries/llm-models.js +1 -1
  53. package/dist/entries/models.cjs +68 -27
  54. package/dist/entries/models.d.cts +57 -1
  55. package/dist/entries/models.d.ts +57 -1
  56. package/dist/entries/models.js +3 -2
  57. package/dist/entries/nodes.cjs +204 -199
  58. package/dist/entries/nodes.d.cts +19 -2
  59. package/dist/entries/nodes.d.ts +19 -2
  60. package/dist/entries/nodes.js +5 -4
  61. package/dist/entries/social.cjs +174 -174
  62. package/dist/entries/social.js +2 -2
  63. package/dist/entries/workflow.cjs +157 -144
  64. package/dist/entries/workflow.d.cts +49 -1
  65. package/dist/entries/workflow.d.ts +49 -1
  66. package/dist/entries/workflow.js +4 -3
  67. package/dist/index.cjs +820 -751
  68. package/dist/index.d.cts +4 -4
  69. package/dist/index.d.ts +4 -4
  70. package/dist/index.js +11 -10
  71. package/package.json +1 -1
  72. package/src/__tests__/llm-models.test.ts +61 -18
  73. package/src/__tests__/node-preset-extract.test.ts +10 -0
  74. package/src/__tests__/node-runtime-keys.test.ts +21 -2
  75. package/src/__tests__/render-output.test.ts +64 -0
  76. package/src/__tests__/schedule-retry.test.ts +35 -0
  77. package/src/__tests__/suno-separate.test.ts +78 -0
  78. package/src/entries/llm-models.ts +3 -0
  79. package/src/entries/models.ts +19 -0
  80. package/src/entries/workflow.ts +6 -0
  81. package/src/generated/unit-contracts.ts +8 -2
  82. package/src/llm-models.ts +63 -23
  83. package/src/node-preset-extract.ts +4 -0
  84. package/src/node-runtime-keys.ts +7 -0
  85. package/src/render-output.ts +36 -1
  86. package/src/schedule-retry.ts +71 -0
  87. package/src/suno-separate.ts +210 -0
  88. package/dist/chunk-ANOQWAMU.js.map +0 -1
  89. package/dist/chunk-BBLE4UTG.cjs.map +0 -1
  90. package/dist/chunk-FKQJYMCO.js.map +0 -1
  91. package/dist/chunk-GZH2SIOF.cjs.map +0 -1
  92. package/dist/chunk-JSGIEF6Z.cjs.map +0 -1
  93. package/dist/chunk-NITAUX3A.cjs.map +0 -1
  94. package/dist/chunk-NTHRTRQK.js.map +0 -1
  95. package/dist/chunk-TCBHVIMD.js.map +0 -1
  96. package/dist/chunk-V3N56Z2S.cjs.map +0 -1
  97. package/dist/chunk-XNISPHTZ.js.map +0 -1
@@ -140,6 +140,16 @@ describe("an audio-locked use-case node's memory is never a preset setting", ()
140
140
  expect(tighten).not.toHaveProperty("settingsBeforeAudio")
141
141
  expect(PRESET_EXCLUDED_KEYS.has("settingsBeforeAudio")).toBe(true)
142
142
  })
143
+
144
+ it("a preset saved from a use-case node carries neither its recordings order (this node's wiring) nor its last run's cameras report", () => {
145
+ const tighten = extractPresetData({
146
+ label: "T", output: "video", cameras: { wide: 2 }, mediaOrder: ["cam-a", "cam-b"],
147
+ useCaseCameras: { speakers: [{ speaker: "speaker_0", ordinal: 1, camera: 2, marginDb: 7 }], syncNotes: [], mapNotes: [] },
148
+ }, "tighten-episode")
149
+ expect(tighten).toEqual({ output: "video", cameras: { wide: 2 } })
150
+ expect(PRESET_EXCLUDED_KEYS.has("mediaOrder")).toBe(true)
151
+ expect(PRESET_EXCLUDED_KEYS.has("useCaseCameras")).toBe(true)
152
+ })
143
153
  })
144
154
 
145
155
  describe("PRESET_EXCLUDED_KEYS ⊇ PRESET_APPLY_CLEAR_KEYS", () => {
@@ -8,6 +8,7 @@ import {
8
8
  isExecutionDataKey,
9
9
  stripTransientRuntimeData,
10
10
  } from "../index.js"
11
+ import { SUNO_SEPARATE_RESULT_FIELDS } from "../suno-separate.js"
11
12
 
12
13
  /**
13
14
  * TRANSIENT_RUNTIME_KEYS = run-state that must neither mark the workflow
@@ -119,13 +120,31 @@ describe("EXECUTION_DATA_KEYS", () => {
119
120
  expect(isExecutionDataKey("candidates", "ugc-clip")).toBe(false)
120
121
  })
121
122
 
122
- it("files only UGC types' generic names: Video Overlay's results stay as every other surface reads them", () => {
123
+ it("files only UGC types' and Suno Separate's own names: Video Overlay's results stay as every other surface reads them", () => {
123
124
  // Presets capture them, Reset clears them, exports and the Copilot keep them — as on any node.
124
125
  for (const key of ["durationSec", "width", "height", "warnings", "resultCompositionKey"]) {
125
126
  expect(isExecutionDataKey(key, "video-overlay"), key).toBe(false)
126
127
  }
127
128
  expect(executionDataKeysOf("video-overlay")).toBe(EXECUTION_DATA_KEYS)
128
- for (const type of Object.keys(NODE_TYPE_EXECUTION_DATA_KEYS)) expect(type, type).toMatch(/^ugc-/)
129
+ for (const type of Object.keys(NODE_TYPE_EXECUTION_DATA_KEYS)) expect(type, type).toMatch(/^(ugc-|suno-separate$)/)
130
+ })
131
+
132
+ it("files every Suno Separate result field and run fact as that type's run result: never undo, preset or template state", () => {
133
+ for (const key of [...SUNO_SEPARATE_RESULT_FIELDS, "engineUsed", "sunoRefused", "fallbackReason", "separateType"]) {
134
+ expect(isExecutionDataKey(key, "suno-separate"), key).toBe(true)
135
+ expect(TRANSIENT_RUNTIME_KEYS.has(key), `${key} must stay persisted`).toBe(false)
136
+ }
137
+ })
138
+
139
+ it("never files Suno Separate's settings as run state, nor its result names on another node", () => {
140
+ // stemName is the instrument SETTING (the run only echoes it back).
141
+ for (const key of ["stemName", "type", "fallbackToDemucs", "taskId", "audioId", "label"]) {
142
+ expect(isExecutionDataKey(key, "suno-separate"), key).toBe(false)
143
+ }
144
+ for (const key of ["vocalUrl", "isolatedUrl", "engineUsed"]) {
145
+ expect(isExecutionDataKey(key, "audio-separation"), key).toBe(false)
146
+ expect(isExecutionDataKey(key, undefined), key).toBe(false)
147
+ }
129
148
  })
130
149
 
131
150
  it("a type's own keys come with every global one, as a set", () => {
@@ -5,6 +5,8 @@ import {
5
5
  edlSpanKey,
6
6
  planClipKeyAt,
7
7
  renderClipKey,
8
+ renderLoneRow,
9
+ renderPlanBasis,
8
10
  renderPlanClipKey,
9
11
  renderPlanNodeId,
10
12
  renderPlanPath,
@@ -390,3 +392,65 @@ describe("renderPlanClipKey — the clip a row reads is picked by every selector
390
392
  })
391
393
  })
392
394
  })
395
+
396
+ describe("renderLoneRow — a render run once behind a Camera Switch with one delivered row (decided 2026-10-20)", () => {
397
+ const span = (inMs: number, outMs: number, title: string) =>
398
+ JSON.stringify({ version: 1, clock: "master", sources: [], segments: [{ id: `s${inMs}`, inMs, outMs }], meta: { title } })
399
+ const PLAN = [span(0, 1000, "one"), span(2000, 3000, "two"), span(4000, 5000, "three")]
400
+ const nodes = [
401
+ { id: "plan", type: "edit-plan" },
402
+ { id: "tp-send", type: "teleport-send" },
403
+ { id: "tp-recv", type: "teleport-receive" },
404
+ { id: "switch", type: "camera-switch" },
405
+ { id: "render", type: "speaker-view" },
406
+ ]
407
+ const viaSwitch = [
408
+ { source: "plan", sourceHandle: "edl", target: "switch", targetHandle: "edl" },
409
+ { source: "switch", sourceHandle: "edl", target: "render", targetHandle: "edl" },
410
+ ]
411
+ const batchOf = (batch: readonly unknown[] | undefined) => (n: { id: string }) => (n.id === "switch" ? batch : PLAN)
412
+ const planList = () => PLAN
413
+ const ran: ReadonlySet<string> = new Set(["switch", "render"])
414
+
415
+ it("the switch's one delivered row is the row: the clip key and the plan basis are that clip's", () => {
416
+ const row = renderLoneRow("render", nodes, viaSwitch, batchOf(["", "", "switched-3"]))
417
+ expect(row).toBe(2)
418
+ expect(renderPlanClipKey("render", nodes, viaSwitch, planList, row)).toBe("4000-5000")
419
+ expect(renderPlanBasis("render", nodes, viaSwitch, planList, row, ran)).toBe(renderPlanBasis("render", nodes, viaSwitch, planList, 2, ran))
420
+ // Without it the render reads the plan's three clips and names none.
421
+ expect(renderPlanClipKey("render", nodes, viaSwitch, planList, undefined)).toBeUndefined()
422
+ expect(renderPlanBasis("render", nodes, viaSwitch, planList, undefined, ran)).toBeUndefined()
423
+ // `null` is a hole too, and a teleport between the switch and the render changes nothing.
424
+ expect(renderLoneRow("render", nodes, viaSwitch, batchOf([null, "switched-2", null]))).toBe(1)
425
+ const teleported = [
426
+ viaSwitch[0]!,
427
+ { source: "switch", sourceHandle: "edl", target: "tp-send", targetHandle: "in" },
428
+ { source: "tp-send", target: "tp-recv" },
429
+ { source: "tp-recv", target: "render", targetHandle: "edl" },
430
+ ]
431
+ expect(renderLoneRow("render", nodes, teleported, batchOf(["", "switched-2", ""]))).toBe(1)
432
+ })
433
+
434
+ it("the row is in the switch's KEPT-clip row space: a clip dropped from the plan has no switch row", () => {
435
+ const holed = () => [PLAN[0], "", PLAN[2]]
436
+ // Two kept clips, so the switch ran twice; its second row (plan clip 3) delivered.
437
+ const row = renderLoneRow("render", nodes, viaSwitch, () => ["", "switched-3"])
438
+ expect(row).toBe(1)
439
+ expect(renderPlanClipKey("render", nodes, viaSwitch, holed, row)).toBe("4000-5000")
440
+ })
441
+
442
+ it("names no row when the batch has several delivered rows, none, or no batch at all", () => {
443
+ expect(renderLoneRow("render", nodes, viaSwitch, batchOf(["a", "", "c"]))).toBeUndefined()
444
+ expect(renderLoneRow("render", nodes, viaSwitch, batchOf(["", "", ""]))).toBeUndefined()
445
+ expect(renderLoneRow("render", nodes, viaSwitch, batchOf(undefined))).toBeUndefined()
446
+ })
447
+
448
+ it("names no row for a render wired straight to its plan (a one-recording pack), a Selected wire, or a selector on the render's wire", () => {
449
+ const direct = [{ source: "plan", sourceHandle: "edl", target: "render", targetHandle: "edl" }]
450
+ expect(renderLoneRow("render", nodes, direct, () => ["", "", PLAN[2]])).toBeUndefined()
451
+ const selected = [viaSwitch[0]!, { ...viaSwitch[1]!, data: { outputMode: "last" } }]
452
+ expect(renderLoneRow("render", nodes, selected, batchOf(["", "", "switched-3"]))).toBeUndefined()
453
+ const picked = [viaSwitch[0]!, { ...viaSwitch[1]!, data: { selectorMode: "list", listExpression: "3" } }]
454
+ expect(renderLoneRow("render", nodes, picked, batchOf(["", "", "switched-3"]))).toBeUndefined()
455
+ })
456
+ })
@@ -0,0 +1,35 @@
1
+ import { describe, it, expect } from "vitest"
2
+ import { SCHEDULE_RETRY_DEFAULTS, SCHEDULE_RETRY_LIMITS, normalizeScheduleRetry } from "../schedule-retry.js"
3
+
4
+ describe("normalizeScheduleRetry — the node's retry policy as the server runs it", () => {
5
+ it("absent, null or not an object is the feature off", () => {
6
+ expect(normalizeScheduleRetry(undefined)).toBeNull()
7
+ expect(normalizeScheduleRetry(null)).toBeNull()
8
+ expect(normalizeScheduleRetry(true)).toBeNull()
9
+ expect(normalizeScheduleRetry("30")).toBeNull()
10
+ })
11
+
12
+ it("an empty object is the defaults: 30 minutes, 3 attempts, cheap lanes only", () => {
13
+ expect(normalizeScheduleRetry({})).toEqual(SCHEDULE_RETRY_DEFAULTS)
14
+ expect(SCHEDULE_RETRY_DEFAULTS).toEqual({ afterMinutes: 30, maxAttempts: 3, cheapLanesOnly: true })
15
+ })
16
+
17
+ it("keeps in-range values, reads a numeric string, and clamps the rest into range", () => {
18
+ expect(normalizeScheduleRetry({ afterMinutes: 90, maxAttempts: 2, cheapLanesOnly: false })).toEqual({ afterMinutes: 90, maxAttempts: 2, cheapLanesOnly: false })
19
+ expect(normalizeScheduleRetry({ afterMinutes: "45", maxAttempts: "1" })).toMatchObject({ afterMinutes: 45, maxAttempts: 1 })
20
+ expect(normalizeScheduleRetry({ afterMinutes: 1, maxAttempts: 9 })).toMatchObject({
21
+ afterMinutes: SCHEDULE_RETRY_LIMITS.afterMinutes[0],
22
+ maxAttempts: SCHEDULE_RETRY_LIMITS.maxAttempts[1],
23
+ })
24
+ expect(normalizeScheduleRetry({ afterMinutes: 100000, maxAttempts: 0 })).toMatchObject({
25
+ afterMinutes: SCHEDULE_RETRY_LIMITS.afterMinutes[1],
26
+ maxAttempts: SCHEDULE_RETRY_LIMITS.maxAttempts[0],
27
+ })
28
+ })
29
+
30
+ it("cheap lanes only is off only when said so — a missing or truthy flag keeps it on", () => {
31
+ expect(normalizeScheduleRetry({ cheapLanesOnly: false })?.cheapLanesOnly).toBe(false)
32
+ expect(normalizeScheduleRetry({ cheapLanesOnly: "false" })?.cheapLanesOnly).toBe(true)
33
+ expect(normalizeScheduleRetry({ cheapLanesOnly: undefined })?.cheapLanesOnly).toBe(true)
34
+ })
35
+ })
@@ -0,0 +1,78 @@
1
+ import { describe, it, expect } from "vitest"
2
+ import {
3
+ SUNO_SEPARATE_TYPES,
4
+ SUNO_STEM_NAMES,
5
+ DEFAULT_SUNO_STEM_NAME,
6
+ SUNO_SEPARATE_STEM_FIELDS,
7
+ SUNO_SEPARATE_TAKE_FIELDS,
8
+ SUNO_SEPARATE_RESULT_FIELDS,
9
+ SUNO_SEPARATE_META_FIELDS,
10
+ sunoSeparateCreditId,
11
+ sunoSeparateHandleUrl,
12
+ sunoSeparatePrimaryUrl,
13
+ } from "../entries/models.js"
14
+
15
+ describe("sunoSeparateCreditId", () => {
16
+ it.each([
17
+ ["separate_vocal", "suno-separate"], ["split_stem", "suno-separate-stem"],
18
+ ["split_stem_advanced", "suno-separate-single"], [undefined, "suno-separate"], ["junk", "suno-separate"],
19
+ ])("%s → %s", (t, id) => expect(sunoSeparateCreditId(t)).toBe(id))
20
+ })
21
+
22
+ it("SUNO_STEM_NAMES is KIE's 98-value enum", () => {
23
+ expect(SUNO_STEM_NAMES).toHaveLength(98)
24
+ expect(new Set(SUNO_STEM_NAMES).size).toBe(98)
25
+ expect(SUNO_STEM_NAMES[0]).toBe("Lead Vocal")
26
+ expect(SUNO_STEM_NAMES[SUNO_STEM_NAMES.length - 1]).toBe("Didgeridoo")
27
+ expect(SUNO_STEM_NAMES).toContain("808")
28
+ expect(SUNO_STEM_NAMES).toContain(DEFAULT_SUNO_STEM_NAME)
29
+ })
30
+
31
+ it("the three separation modes", () => {
32
+ expect(SUNO_SEPARATE_TYPES).toEqual(["separate_vocal", "split_stem", "split_stem_advanced"])
33
+ })
34
+
35
+ it("result-field lists", () => {
36
+ expect(SUNO_SEPARATE_STEM_FIELDS).toEqual([
37
+ "vocalUrl", "instrumentalUrl", "backingVocalsUrl", "drumsUrl",
38
+ "bassUrl", "guitarUrl", "pianoUrl", "keyboardUrl",
39
+ "percussionUrl", "stringsUrl", "synthUrl", "fxUrl",
40
+ "brassUrl", "woodwindsUrl", "otherUrl",
41
+ ])
42
+ expect(SUNO_SEPARATE_TAKE_FIELDS).toEqual(["isolatedUrl", "withoutUrl", "isolated2Url", "without2Url"])
43
+ expect(SUNO_SEPARATE_RESULT_FIELDS).toEqual([...SUNO_SEPARATE_STEM_FIELDS, ...SUNO_SEPARATE_TAKE_FIELDS])
44
+ expect(SUNO_SEPARATE_META_FIELDS).toEqual(["separateType", "stemName", "engineUsed", "sunoRefused", "fallbackReason"])
45
+ })
46
+
47
+ describe("sunoSeparateHandleUrl", () => {
48
+ const legacy = { audioUrl: "A" }
49
+ const vocalOnly = { audioUrl: "V", vocalUrl: "V" }
50
+ const stems = { audioUrl: "V", vocalUrl: "V", drumsUrl: "D" }
51
+ const single = { audioUrl: "I", isolatedUrl: "I", withoutUrl: "W", isolated2Url: "I2" }
52
+ it("legacy shape (no per-field urls) still routes audioUrl", () => {
53
+ expect(sunoSeparateHandleUrl(legacy, "vocals")).toBe("A")
54
+ expect(sunoSeparateHandleUrl(legacy, "instrumental")).toBe("A")
55
+ })
56
+ it("a stem that did not come back is empty", () => {
57
+ expect(sunoSeparateHandleUrl(stems, "instrumental")).toBeUndefined()
58
+ expect(sunoSeparateHandleUrl(vocalOnly, "instrumental")).toBeUndefined()
59
+ })
60
+ it("one-instrument mode", () => {
61
+ expect(sunoSeparateHandleUrl(single, "vocals")).toBeUndefined()
62
+ expect(sunoSeparateHandleUrl(single, "instrumental")).toBeUndefined()
63
+ expect(sunoSeparateHandleUrl(single, "isolated")).toBe("I")
64
+ expect(sunoSeparateHandleUrl(single, "without")).toBe("W")
65
+ })
66
+ it("legacy handle spellings", () => {
67
+ expect(sunoSeparateHandleUrl(stems, "vocal-out")).toBe("V")
68
+ expect(sunoSeparateHandleUrl({ ...stems, instrumentalUrl: "N" }, "instrumental-out")).toBe("N")
69
+ })
70
+ it("no handle → primary", () => expect(sunoSeparateHandleUrl(single, null)).toBe("I"))
71
+ })
72
+
73
+ it("sunoSeparatePrimaryUrl", () => {
74
+ expect(sunoSeparatePrimaryUrl({ vocalUrl: "V", instrumentalUrl: "N" })).toBe("V")
75
+ expect(sunoSeparatePrimaryUrl({ instrumentalUrl: "N" })).toBe("N")
76
+ expect(sunoSeparatePrimaryUrl({ isolatedUrl: "I", withoutUrl: "W" })).toBe("I")
77
+ expect(sunoSeparatePrimaryUrl({ drumsUrl: "D" })).toBe("D")
78
+ })
@@ -34,6 +34,9 @@ export {
34
34
  resolveVideoAnalysisModel,
35
35
  LLM_FEATURE_DEFAULTS,
36
36
  DESCRIBE_TO_PICKER_FALLBACK_MODEL,
37
+ DESCRIBE_TO_PICKER_MODELS,
38
+ DESCRIBE_TO_PICKER_WITHHELD_MODELS,
39
+ LLM_STRUCTURED_WITHHELD_MODELS,
37
40
  LLM_FEATURE_DEFAULT_EFFORTS,
38
41
  defaultReasoningEffort,
39
42
  LLM_MODALITY_CAPS,
@@ -281,6 +281,25 @@ export {
281
281
  export * from "../provider-directive-defaults.js"
282
282
  export * from "../lora-routing.js"
283
283
  export { SUNO_TRACK_SOURCE_TYPES } from "../suno-track-sources.js"
284
+ // Suno Separate's public contract: modes, stem names, each mode's credit id, result + handle fields.
285
+ export {
286
+ SUNO_SEPARATE_TYPES,
287
+ SUNO_STEM_NAMES,
288
+ DEFAULT_SUNO_STEM_NAME,
289
+ sunoSeparateCreditId,
290
+ SUNO_SEPARATE_STEM_FIELDS,
291
+ SUNO_SEPARATE_TAKE_FIELDS,
292
+ SUNO_SEPARATE_RESULT_FIELDS,
293
+ SUNO_SEPARATE_META_FIELDS,
294
+ sunoSeparateHandleUrl,
295
+ sunoSeparatePrimaryUrl,
296
+ } from "../suno-separate.js"
297
+ export type {
298
+ SunoSeparateType,
299
+ SunoStemName,
300
+ SunoSeparateStemField,
301
+ SunoSeparateResultField,
302
+ } from "../suno-separate.js"
284
303
  export {
285
304
  VOICE_CHANGER_MODELS,
286
305
  VOICE_CHANGER_MODEL_IDS,
@@ -133,6 +133,12 @@ export {
133
133
  type ScheduleSpec,
134
134
  type LocalTime,
135
135
  } from "../schedule-rules.js"
136
+ export {
137
+ SCHEDULE_RETRY_LIMITS,
138
+ SCHEDULE_RETRY_DEFAULTS,
139
+ normalizeScheduleRetry,
140
+ type ScheduleRetry,
141
+ } from "../schedule-retry.js"
136
142
  export { VARIABLES_HANDLE_ID, buildConditionVariables } from "../condition-variables.js"
137
143
  export { extractAllGeneratedResults, extractGeneratedJsonAsList, spreadJsonArrayIfSingleton } from "../generated-results.js"
138
144
  export { resolveFieldMappings, resolveLocationFields, type FieldEdgeSource } from "../resolve-field-mappings.js"
@@ -10,6 +10,7 @@ export const UNIT_CONTRACTS: ReadonlyArray<readonly [type: string, producer: "au
10
10
  ["tighten-episode", "dynamic"], // unit:tighten-episode
11
11
  ["episode-trailer", "video"], // unit:episode-trailer
12
12
  ["clip-pack", "dynamic"], // unit:clip-pack
13
+ ["speaker-layout", "video"], // unit:speaker-layout
13
14
  ["remove-audio", "video"], // unit:remove-audio
14
15
  ["gif-to-video", "video"], // unit:gif-to-video
15
16
  ]
@@ -20,6 +21,7 @@ export const UNIT_USE_CASE_TYPES = [
20
21
  "episode-chapters", // unit:episode-chapters
21
22
  "episode-trailer", // unit:episode-trailer
22
23
  "clip-pack", // unit:clip-pack
24
+ "speaker-layout", // unit:speaker-layout
23
25
  ] as const
24
26
 
25
27
  // What each JSON (look) output pip carries (contract.jsonPips) — json-kinds.ts composes these.
@@ -28,13 +30,16 @@ export const UNIT_JSON_PIPS: ReadonlyArray<readonly [type: string, pips: Readonl
28
30
  ["episode-chapters", { "json": "other" }], // unit:episode-chapters
29
31
  ["episode-trailer", { "json": "edl" }], // unit:episode-trailer
30
32
  ["clip-pack", { "json": "edl" }], // unit:clip-pack
33
+ ["speaker-layout", { "json": "edl" }], // unit:speaker-layout
31
34
  ["speaker-map", { "edl": "edl", "json": "other" }], // unit:speaker-map
32
35
  ]
33
36
 
34
37
  // Input pips that are never a prompt lane (contract.nonPromptInputs) — fan-out-rows.ts composes these.
35
38
  export const UNIT_NON_PROMPT_INPUTS: ReadonlyArray<readonly [type: string, handles: ReadonlyArray<string>]> = [
36
- ["tighten-episode", ["music"]], // unit:tighten-episode
37
- ["episode-trailer", ["introCard"]], // unit:episode-trailer
39
+ ["tighten-episode", ["music", "masterAudio"]], // unit:tighten-episode
40
+ ["episode-trailer", ["introCard", "masterAudio"]], // unit:episode-trailer
41
+ ["clip-pack", ["masterAudio"]], // unit:clip-pack
42
+ ["speaker-layout", ["masterAudio"]], // unit:speaker-layout
38
43
  ]
39
44
 
40
45
  // Use-case units whose review-on run ends at a Preview that holds what follows (contract.reviewHold) — preview-gate.ts.
@@ -42,6 +47,7 @@ export const UNIT_REVIEW_HOLDS: ReadonlyArray<string> = [
42
47
  "tighten-episode", // unit:tighten-episode
43
48
  "episode-trailer", // unit:episode-trailer
44
49
  "clip-pack", // unit:clip-pack
50
+ "speaker-layout", // unit:speaker-layout
45
51
  ]
46
52
 
47
53
  // How a published app shows each unit's result where the producer sets do not decide it (contract.presents) — presentation-utils.ts.
package/src/llm-models.ts CHANGED
@@ -1062,6 +1062,37 @@ export const STRUCTURED_VISION_MODELS = LLM_MODELS.filter(
1062
1062
  (m) => m.supportsImages && m.structuredOutputMode != null,
1063
1063
  )
1064
1064
 
1065
+ /**
1066
+ * Models {@link STRUCTURED_VISION_MODELS} carries that describe-to-picker does
1067
+ * NOT offer. Its analyzer prompt is a rendered catalog legend — tens of
1068
+ * thousands of input tokens per read — and on these models a single read
1069
+ * costs far above what any of the node's credit rungs covers (production cost
1070
+ * audit, 2026-10-20; the basis is in backend/src/ee/billing/credits.ts).
1071
+ * Withheld from this feature only: the scrapers' per-post analysis reads a
1072
+ * frame and a caption, not a legend, and keeps the whole list.
1073
+ */
1074
+ export const DESCRIBE_TO_PICKER_WITHHELD_MODELS: ReadonlySet<string> = new Set(["claude-fable-5"])
1075
+
1076
+ /**
1077
+ * The same models, withheld from the other legend-sized structured reads for
1078
+ * the same reason: `POST /v1/text-to-picker` (describe-to-picker's text twin,
1079
+ * whose default run analyzes every picker's legend) and `POST /v1/llm/structured`
1080
+ * (a caller's own legend-sized system prompt). One set, so a model withheld
1081
+ * from one read of that size is withheld from all of them.
1082
+ */
1083
+ export const LLM_STRUCTURED_WITHHELD_MODELS: ReadonlySet<string> = DESCRIBE_TO_PICKER_WITHHELD_MODELS
1084
+
1085
+ /**
1086
+ * The models describe-to-picker offers and accepts: the structured vision
1087
+ * models minus {@link DESCRIBE_TO_PICKER_WITHHELD_MODELS}. The ONE list the
1088
+ * route gate, the config panel and the quick strip read, so a model the route
1089
+ * refuses is never offered and a saved node naming one is snapped to the
1090
+ * default (the route answers it with a `validation_error`).
1091
+ */
1092
+ export const DESCRIBE_TO_PICKER_MODELS = STRUCTURED_VISION_MODELS.filter(
1093
+ (m) => !DESCRIBE_TO_PICKER_WITHHELD_MODELS.has(m.id),
1094
+ )
1095
+
1065
1096
  /**
1066
1097
  * Vendor presentation order + labels for model pickers. Every LlmVendor MUST
1067
1098
  * appear in the order list (guarded by a registry test) so a new vendor can't
@@ -1177,9 +1208,14 @@ export const LLM_FEATURE_DEFAULTS: Record<LlmFeature, string> = {
1177
1208
  // runs once per returned ad — volume, not depth. Must stay an image-capable
1178
1209
  // structured-output model (STRUCTURED_VISION_MODELS); a registry test pins it.
1179
1210
  "meta-ads-analysis": "gemini-3.6-flash",
1180
- // Moved from claude-opus-5 on 2026-10-08 (decided: Opus 5.5 takes the Opus 5
1181
- // defaults). Still an image-capable structured model — a registry test pins it.
1182
- "describe-to-picker": "claude-opus-5.5",
1211
+ // Economy by decision (2026-10-20, from a production cost audit): the
1212
+ // analyzer's legend-sized prompt made the former default, Opus 5.5 at high
1213
+ // on Anthropic's own API, the platform's most expensive read per run. Gemini
1214
+ // 3.8 Flash reads it on the aggregator at the cheapest rung; Opus 5.5 at
1215
+ // high stays available by choice (LLM_FEATURE_DEFAULT_EFFORTS). Still an
1216
+ // image-capable structured model (DESCRIBE_TO_PICKER_MODELS) — a registry
1217
+ // test pins it.
1218
+ "describe-to-picker": "gemini-3.8-flash",
1183
1219
  "qa-check": "gemini-3.6-flash",
1184
1220
  "generate-script": "gemini-3.6-flash",
1185
1221
  "translate": "gemini-3.6-flash",
@@ -1209,39 +1245,43 @@ export const LLM_FEATURE_DEFAULTS: Record<LlmFeature, string> = {
1209
1245
  export const DESCRIBE_TO_PICKER_FALLBACK_MODEL = "gemini-3.8-flash"
1210
1246
 
1211
1247
  /**
1212
- * Feature → the reasoning effort its DEFAULT model runs at when the caller
1213
- * sends none. Read it through {@link defaultReasoningEffort}, never directly:
1214
- * the effort belongs to the default model, so a call on any other model must
1215
- * not pick it up.
1248
+ * Feature → ONE model with a recipe: the reasoning effort it runs at on that
1249
+ * feature when the caller sends none. Read it through
1250
+ * {@link defaultReasoningEffort}, never directly: the effort belongs to that
1251
+ * model, so a call on any other model — the feature's default included, when
1252
+ * it is a different model — must not pick it up.
1216
1253
  */
1217
- export const LLM_FEATURE_DEFAULT_EFFORTS: Partial<Record<LlmFeature, LlmReasoningEffort>> = {
1254
+ export const LLM_FEATURE_DEFAULT_EFFORTS: Partial<Record<LlmFeature, { model: string; effort: LlmReasoningEffort }>> = {
1218
1255
  // Decided 2026-10-09 from the picker bake-off v2: Opus 5.5 at `high` read
1219
1256
  // 4/4 portraits with the most attributes per image, ~9 s a read. Its effort
1220
- // only takes effect on Anthropic's own API (`effortRequiresDirect`), so the
1221
- // default analysis runs direct — and bills as such (`llmServesDirect`).
1222
- "describe-to-picker": "high",
1257
+ // only takes effect on Anthropic's own API (`effortRequiresDirect`), so a
1258
+ // read on it runs direct — and bills as such (`llmServesDirect`). It was the
1259
+ // feature's default model until 2026-10-20 (see LLM_FEATURE_DEFAULTS); the
1260
+ // recipe stays with the model, so choosing Opus 5.5 still reads at high.
1261
+ "describe-to-picker": { model: "claude-opus-5.5", effort: "high" },
1223
1262
  }
1224
1263
 
1225
1264
  /**
1226
1265
  * The reasoning effort a `feature` call runs at when the caller sends none:
1227
- * the feature's default effort ({@link LLM_FEATURE_DEFAULT_EFFORTS}), but ONLY
1228
- * while the call runs on the feature's default model — named, or omitted
1229
- * (`undefined` / `""`) so the default model applies. A caller who picked
1230
- * another model and no effort gets `undefined`: that model's Auto, as before.
1266
+ * the recipe effort ({@link LLM_FEATURE_DEFAULT_EFFORTS}), but ONLY while the
1267
+ * call runs on the recipe's model — named, or reached because the model was
1268
+ * omitted (`undefined` / `""`) and it is the feature's default. A caller on
1269
+ * any other model with no effort gets `undefined`: that model's Auto.
1231
1270
  *
1232
- * WHY only on the default model: the default effort is part of the default
1233
- * model's recipe, not a global policy. Forcing `high` on a Gemini or GPT call
1234
- * that never asked for it would change the timing of every existing workflow
1235
- * that picked one (and, on a Claude model, its lane and its bill).
1271
+ * WHY only on that model: the effort is part of that model's recipe, not a
1272
+ * feature policy. Forcing `high` on a Gemini or GPT call that never asked for
1273
+ * it would change the timing of every existing workflow that picked one (and,
1274
+ * on a Claude model, its lane and its bill) — which is also why the feature's
1275
+ * default model gets it only when it IS the recipe's model.
1236
1276
  *
1237
1277
  * The one place the route, the node's credit badge and its effort pickers
1238
1278
  * read, so what runs, what is billed and what is shown cannot disagree.
1239
1279
  */
1240
1280
  export function defaultReasoningEffort(feature: string, modelId?: string): LlmReasoningEffort | undefined {
1241
- const effort = LLM_FEATURE_DEFAULT_EFFORTS[feature as LlmFeature]
1242
- if (!effort) return undefined
1243
- if (!modelId) return effort
1244
- return getLlmModel(modelId)?.id === LLM_FEATURE_DEFAULTS[feature as LlmFeature] ? effort : undefined
1281
+ const recipe = LLM_FEATURE_DEFAULT_EFFORTS[feature as LlmFeature]
1282
+ if (!recipe) return undefined
1283
+ const effective = modelId || LLM_FEATURE_DEFAULTS[feature as LlmFeature]
1284
+ return getLlmModel(effective)?.id === recipe.model ? recipe.effort : undefined
1245
1285
  }
1246
1286
 
1247
1287
  /**
@@ -165,6 +165,10 @@ export const PRESET_EXCLUDED_KEYS: ReadonlySet<string> = new Set([
165
165
  "extraRefs",
166
166
  // editor-only memory of the node's own wiring (an audio recording's lock)
167
167
  "settingsBeforeAudio",
168
+ // a use-case node's recordings order (its upstream node ids — this node's
169
+ // wiring) and the cameras report of its last run (a result, never config)
170
+ "mediaOrder",
171
+ "useCaseCameras",
168
172
  // structural identifiers
169
173
  "routes",
170
174
  "routeId",
@@ -1,3 +1,5 @@
1
+ import { SUNO_SEPARATE_META_FIELDS, SUNO_SEPARATE_RESULT_FIELDS } from "./suno-separate.js"
2
+
1
3
  /**
2
4
  * Field names on a node's `data` that hold runtime / result / transient execution
3
5
  * state (job ids, progress, generated outputs, fan-out bookkeeping). These are NEVER
@@ -175,6 +177,10 @@ export const EXECUTION_DATA_KEYS: ReadonlySet<string> = new Set([
175
177
  * warnings, length and Re-render marks (`rerenderPending`: the clips pressed for
176
178
  * Re-render that no run has rendered yet — run bookkeeping; the press itself,
177
179
  * `rerender`, is a choice).
180
+ *
181
+ * Suno Separate: every stem / take URL a run writes and the run's facts (its
182
+ * engine, a Demucs fallback's refusal and reason, its mode) — not `stemName`,
183
+ * the node's instrument setting that the run only echoes back.
178
184
  */
179
185
  export const NODE_TYPE_EXECUTION_DATA_KEYS: Readonly<Record<string, readonly string[]>> = {
180
186
  "ugc-creator": ["ugcOutputs", "candidates", "optionFailed"],
@@ -182,6 +188,7 @@ export const NODE_TYPE_EXECUTION_DATA_KEYS: Readonly<Record<string, readonly str
182
188
  "ugc-clips": ["ugcOutputs", "quote"],
183
189
  "ugc-clip": ["ugcOutputs", "clipWarnings", "durationSec", "rerenderPending"],
184
190
  "ugc-cards": ["ugcOutputs"],
191
+ "suno-separate": [...SUNO_SEPARATE_RESULT_FIELDS, ...SUNO_SEPARATE_META_FIELDS.filter((key) => key !== "stemName")],
185
192
  }
186
193
 
187
194
  /** Is `key` execution data (run state or a run's result) on a node of `type`: global, or that type's own? */
@@ -23,7 +23,7 @@
23
23
  import { normalizeEdl } from "./edl.js"
24
24
  import { editPlanBasis } from "./edit-plan-review.js"
25
25
  import { defaultEdgeOutputMode } from "./producer-types.js"
26
- import { resolveIndex, selectListItems, type SelectorFields } from "./selector.js"
26
+ import { isDefaultSelectorConfig, resolveIndex, selectListItems, type SelectorFields } from "./selector.js"
27
27
 
28
28
  /** The quality an Apply EDL render was made at. "proxy" is a Preview. */
29
29
  export type RenderQuality = "proxy" | "final"
@@ -423,6 +423,41 @@ export function renderPlanClipKey(
423
423
  return renderClipKey(planClips(planNode), row, path.hops)
424
424
  }
425
425
 
426
+ /**
427
+ * The row a render run ONCE reads behind a pass-through node whose batch has
428
+ * exactly one delivered row (decided 2026-10-20): Camera Switch ran per clip,
429
+ * every row but row k failed (`""`), and both engines run the render once on
430
+ * the one live value, with no list row — a list with one live value drives
431
+ * nothing (their `> 1` fan-out rule, which stays). That value IS row k of the
432
+ * switch's batch, which is the row space `renderPlanValue` indexes after a
433
+ * pass-through hop, so the render is stamped as if row k drove it.
434
+ *
435
+ * Only when the render's last wire is an Each wire out of a pass-through node
436
+ * (two hops or more, `renderPlanPath`) with no selector of its own — a
437
+ * selector would re-index the batch. `batchOf` reads the pass-through node's
438
+ * batch as the engine holds it (a hole is `""` or `null`). `undefined`
439
+ * otherwise; callers pass `row ?? renderLoneRow(…)`, so a list-driven render
440
+ * and a render wired straight to its plan are untouched.
441
+ */
442
+ export function renderLoneRow(
443
+ renderId: string,
444
+ nodes: readonly RenderGraphNode[],
445
+ edges: readonly RenderGraphEdge[],
446
+ batchOf: (passNode: RenderGraphNode) => readonly unknown[] | undefined,
447
+ ): number | undefined {
448
+ const path = renderPlanPath(renderId, nodes, edges)
449
+ if (!path || path.hops.length < 2) return undefined
450
+ const last = path.hops[path.hops.length - 1]!
451
+ if (!last.each || !isDefaultSelectorConfig(last.edge.data as SelectorFields | undefined)) return undefined
452
+ // The node the last wire hands on from: the target of the hop before it.
453
+ const passId = path.hops[path.hops.length - 2]!.edge.target
454
+ const passNode = nodes.find((n) => n.id === passId)
455
+ const batch = passNode ? batchOf(passNode) : undefined
456
+ if (!batch) return undefined
457
+ const live = batch.flatMap((v, k) => (isHole(v) ? [] : [k]))
458
+ return live.length === 1 ? live[0] : undefined
459
+ }
460
+
426
461
  /**
427
462
  * The clip key of EVERY iteration of a render's fan-out, row-aligned with its
428
463
  * batch: `rows[k]` is iteration k's list row (`FanOutPlan.rows`), as both
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Schedule Trigger "Retry on failure" — the ONE shape both sides read.
3
+ *
4
+ * A scheduled run nobody watches can fail for a reason that passes
5
+ * (a provider lane down for a while). With a retry policy on the node, the
6
+ * server runs the failed run again after a wait, a bounded number of times;
7
+ * absent, nothing is retried and the schedule behaves exactly as before.
8
+ *
9
+ * - `afterMinutes` — how long after the failure the retry may start.
10
+ * - `maxAttempts` — how many retries one failed scheduled run may get
11
+ * (the original run is not an attempt).
12
+ * - `cheapLanesOnly` — the model calls made by the run (the original
13
+ * scheduled run AND its retries) that honour the flag stay on the
14
+ * aggregator lane: a call that fails there is not re-asked on the vendor's
15
+ * own, pricier API; it fails, and the retry handles it later. Which node
16
+ * types honour it is listed on the Schedule Trigger's docs page
17
+ * (docs/nodes/input/schedule-trigger.md, "Cheap lanes only").
18
+ *
19
+ * The node stores it as `data.retry`, the server projects it onto the
20
+ * trigger row's `config.retry` (lib/workflow-trigger-sync.ts), and the API
21
+ * takes the same object in `config` (POST / PATCH /v1/workflow-triggers).
22
+ */
23
+
24
+ export interface ScheduleRetry {
25
+ /** 5–1440 (a day). */
26
+ readonly afterMinutes: number
27
+ /** 1–5. */
28
+ readonly maxAttempts: number
29
+ readonly cheapLanesOnly: boolean
30
+ }
31
+
32
+ export const SCHEDULE_RETRY_LIMITS = {
33
+ afterMinutes: [5, 1440] as const,
34
+ maxAttempts: [1, 5] as const,
35
+ } as const
36
+
37
+ export const SCHEDULE_RETRY_DEFAULTS: ScheduleRetry = Object.freeze({
38
+ afterMinutes: 30,
39
+ maxAttempts: 3,
40
+ cheapLanesOnly: true,
41
+ })
42
+
43
+ function int(value: unknown): number | null {
44
+ if (typeof value === "number" && Number.isFinite(value)) return Math.trunc(value)
45
+ if (typeof value === "string" && /^-?\d+$/.test(value.trim())) return parseInt(value.trim(), 10)
46
+ return null
47
+ }
48
+
49
+ function clamp(value: number | null, [lo, hi]: readonly [number, number], fallback: number): number {
50
+ if (value === null) return fallback
51
+ return Math.min(hi, Math.max(lo, value))
52
+ }
53
+
54
+ /**
55
+ * A retry policy as stored on a node or a row → the policy the server runs,
56
+ * or `null` when there is none (absent, `null`, or not an object — the
57
+ * feature off). Out-of-range numbers are clamped, never refused: like a
58
+ * rule, a half-typed value must not silently switch the retry off; the API
59
+ * refuses out-of-range values before they are stored (its Zod), so a stored
60
+ * value reaching the clamp is a node written by hand.
61
+ */
62
+ export function normalizeScheduleRetry(raw: unknown): ScheduleRetry | null {
63
+ if (!raw || typeof raw !== "object") return null
64
+ const r = raw as Record<string, unknown>
65
+ return {
66
+ afterMinutes: clamp(int(r.afterMinutes), SCHEDULE_RETRY_LIMITS.afterMinutes, SCHEDULE_RETRY_DEFAULTS.afterMinutes),
67
+ maxAttempts: clamp(int(r.maxAttempts), SCHEDULE_RETRY_LIMITS.maxAttempts, SCHEDULE_RETRY_DEFAULTS.maxAttempts),
68
+ // Off only when said so: the default keeps a scheduled run on the cheap lanes.
69
+ cheapLanesOnly: r.cheapLanesOnly !== false,
70
+ }
71
+ }