@nodaro/shared 3.35.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.
- package/dist/{chunk-RUKFN3LJ.cjs → chunk-33QG2DOW.cjs} +6 -6
- package/dist/{chunk-RUKFN3LJ.cjs.map → chunk-33QG2DOW.cjs.map} +1 -1
- package/dist/{chunk-FKQJYMCO.js → chunk-4XI6B4RU.js} +25 -13
- package/dist/chunk-4XI6B4RU.js.map +1 -0
- package/dist/{chunk-XS7FI4JA.js → chunk-5OED47LE.js} +3 -3
- package/dist/{chunk-XS7FI4JA.js.map → chunk-5OED47LE.js.map} +1 -1
- package/dist/{chunk-GZH2SIOF.cjs → chunk-5PCI6M44.cjs} +18 -6
- package/dist/chunk-5PCI6M44.cjs.map +1 -0
- package/dist/chunk-6Q4BS6AR.js +158 -0
- package/dist/chunk-6Q4BS6AR.js.map +1 -0
- package/dist/{chunk-IRUPCNW2.cjs → chunk-6Y66YM4M.cjs} +46 -46
- package/dist/{chunk-IRUPCNW2.cjs.map → chunk-6Y66YM4M.cjs.map} +1 -1
- package/dist/{chunk-F4ZT5X2S.cjs → chunk-75ZMA34U.cjs} +11 -11
- package/dist/{chunk-F4ZT5X2S.cjs.map → chunk-75ZMA34U.cjs.map} +1 -1
- package/dist/{chunk-5VNBQ4QK.cjs → chunk-7Q75OZBL.cjs} +16 -16
- package/dist/{chunk-5VNBQ4QK.cjs.map → chunk-7Q75OZBL.cjs.map} +1 -1
- package/dist/{chunk-ETXUOETU.js → chunk-7QITUDRT.js} +5 -5
- package/dist/{chunk-ETXUOETU.js.map → chunk-7QITUDRT.js.map} +1 -1
- package/dist/{chunk-2QWNPYDG.js → chunk-AZBIXGM5.js} +3 -3
- package/dist/{chunk-2QWNPYDG.js.map → chunk-AZBIXGM5.js.map} +1 -1
- package/dist/{chunk-A5Z3IMSJ.cjs → chunk-BYP62B7F.cjs} +6 -6
- package/dist/{chunk-A5Z3IMSJ.cjs.map → chunk-BYP62B7F.cjs.map} +1 -1
- package/dist/{chunk-GRIMIJJ3.js → chunk-CMH2ACOX.js} +3 -3
- package/dist/{chunk-GRIMIJJ3.js.map → chunk-CMH2ACOX.js.map} +1 -1
- package/dist/{chunk-TCBHVIMD.js → chunk-CQJYKSXF.js} +18 -6
- package/dist/chunk-CQJYKSXF.js.map +1 -0
- package/dist/chunk-DBD4BCGH.cjs +169 -0
- package/dist/chunk-DBD4BCGH.cjs.map +1 -0
- package/dist/{chunk-NWXB4F6D.cjs → chunk-DE3PEIIP.cjs} +21 -21
- package/dist/{chunk-NWXB4F6D.cjs.map → chunk-DE3PEIIP.cjs.map} +1 -1
- package/dist/{chunk-IJNQYMN7.js → chunk-DKTRVOU5.js} +4 -4
- package/dist/{chunk-IJNQYMN7.js.map → chunk-DKTRVOU5.js.map} +1 -1
- package/dist/{chunk-XE5PE54B.cjs → chunk-ENFBA33M.cjs} +27 -27
- package/dist/{chunk-XE5PE54B.cjs.map → chunk-ENFBA33M.cjs.map} +1 -1
- package/dist/{chunk-BBLE4UTG.cjs → chunk-GLON7ANZ.cjs} +48 -15
- package/dist/chunk-GLON7ANZ.cjs.map +1 -0
- package/dist/{chunk-XJOBMAWW.js → chunk-GW54ANCH.js} +3 -3
- package/dist/{chunk-XJOBMAWW.js.map → chunk-GW54ANCH.js.map} +1 -1
- package/dist/{chunk-3YG3MYDE.cjs → chunk-HABDAHZR.cjs} +21 -21
- package/dist/{chunk-3YG3MYDE.cjs.map → chunk-HABDAHZR.cjs.map} +1 -1
- package/dist/{chunk-JSGIEF6Z.cjs → chunk-HSJU5KNR.cjs} +6 -3
- package/dist/chunk-HSJU5KNR.cjs.map +1 -0
- package/dist/{chunk-Q4ZXDDWA.js → chunk-IIGKJYWL.js} +3 -3
- package/dist/{chunk-Q4ZXDDWA.js.map → chunk-IIGKJYWL.js.map} +1 -1
- package/dist/{chunk-YD3JA36S.cjs → chunk-JABZNRXL.cjs} +4 -4
- package/dist/{chunk-YD3JA36S.cjs.map → chunk-JABZNRXL.cjs.map} +1 -1
- package/dist/{chunk-72IFMNJE.cjs → chunk-JLKZEKQ3.cjs} +71 -54
- package/dist/chunk-JLKZEKQ3.cjs.map +1 -0
- package/dist/{chunk-GVHBHUFV.js → chunk-JMUHMLJP.js} +5 -5
- package/dist/{chunk-GVHBHUFV.js.map → chunk-JMUHMLJP.js.map} +1 -1
- package/dist/{chunk-5ZCXWA7J.cjs → chunk-KOP7UTQR.cjs} +15 -2
- package/dist/chunk-KOP7UTQR.cjs.map +1 -0
- package/dist/{chunk-2HVFF5SS.js → chunk-L6HS52BV.js} +3 -3
- package/dist/{chunk-2HVFF5SS.js.map → chunk-L6HS52BV.js.map} +1 -1
- package/dist/{chunk-V3N56Z2S.cjs → chunk-M6JHRWVY.cjs} +27 -12
- package/dist/chunk-M6JHRWVY.cjs.map +1 -0
- package/dist/{chunk-AGEZY4LL.cjs → chunk-MSDECC3A.cjs} +42 -42
- package/dist/{chunk-AGEZY4LL.cjs.map → chunk-MSDECC3A.cjs.map} +1 -1
- package/dist/{chunk-B7WJJHJS.cjs → chunk-MSIIC6MY.cjs} +4 -4
- package/dist/{chunk-B7WJJHJS.cjs.map → chunk-MSIIC6MY.cjs.map} +1 -1
- package/dist/{chunk-AWWOQH46.cjs → chunk-NARVPCWW.cjs} +6 -6
- package/dist/{chunk-AWWOQH46.cjs.map → chunk-NARVPCWW.cjs.map} +1 -1
- package/dist/{chunk-RRI5YBUK.js → chunk-QXTCIJP5.js} +3 -3
- package/dist/{chunk-RRI5YBUK.js.map → chunk-QXTCIJP5.js.map} +1 -1
- package/dist/{chunk-ANOQWAMU.js → chunk-R6B2UDFR.js} +35 -5
- package/dist/chunk-R6B2UDFR.js.map +1 -0
- package/dist/{chunk-ZXBSARZX.js → chunk-SPP6HQMM.js} +4 -4
- package/dist/{chunk-ZXBSARZX.js.map → chunk-SPP6HQMM.js.map} +1 -1
- package/dist/{chunk-MUA5L25B.js → chunk-VRLRPGO7.js} +3 -3
- package/dist/{chunk-MUA5L25B.js.map → chunk-VRLRPGO7.js.map} +1 -1
- package/dist/{chunk-QIIG2QDP.cjs → chunk-VRUN5TG2.cjs} +8 -8
- package/dist/{chunk-QIIG2QDP.cjs.map → chunk-VRUN5TG2.cjs.map} +1 -1
- package/dist/{chunk-QXW6O56Z.js → chunk-W4GABGRD.js} +4 -4
- package/dist/{chunk-QXW6O56Z.js.map → chunk-W4GABGRD.js.map} +1 -1
- package/dist/{chunk-MEN7VLQ5.js → chunk-WD6AJ533.js} +5 -5
- package/dist/{chunk-MEN7VLQ5.js.map → chunk-WD6AJ533.js.map} +1 -1
- package/dist/{chunk-XNISPHTZ.js → chunk-WPT5ZTA2.js} +6 -3
- package/dist/chunk-WPT5ZTA2.js.map +1 -0
- package/dist/{chunk-LJMNCSDG.js → chunk-XA53RUSD.js} +27 -11
- package/dist/chunk-XA53RUSD.js.map +1 -0
- package/dist/chunk-XJ3HJSO5.cjs +25 -0
- package/dist/{chunk-YYODFQEU.cjs.map → chunk-XJ3HJSO5.cjs.map} +1 -1
- package/dist/{chunk-PVVO23LZ.js → chunk-YHCG3HOR.js} +3 -3
- package/dist/{chunk-PVVO23LZ.js.map → chunk-YHCG3HOR.js.map} +1 -1
- package/dist/{chunk-24ZKPE33.cjs → chunk-YNJ44IAL.cjs} +5 -5
- package/dist/{chunk-24ZKPE33.cjs.map → chunk-YNJ44IAL.cjs.map} +1 -1
- package/dist/{chunk-GHBXS5RT.cjs → chunk-YSEM7JDE.cjs} +4 -4
- package/dist/{chunk-GHBXS5RT.cjs.map → chunk-YSEM7JDE.cjs.map} +1 -1
- package/dist/{chunk-W36WCZS2.js → chunk-YVKUCBY2.js} +6 -6
- package/dist/{chunk-W36WCZS2.js.map → chunk-YVKUCBY2.js.map} +1 -1
- package/dist/{chunk-GKJRNIP4.js → chunk-ZG4XSEZV.js} +15 -2
- package/dist/chunk-ZG4XSEZV.js.map +1 -0
- package/dist/entries/apps.cjs +43 -43
- package/dist/entries/apps.js +8 -8
- package/dist/entries/credits.cjs +153 -153
- package/dist/entries/credits.d.cts +1 -1
- package/dist/entries/credits.d.ts +1 -1
- package/dist/entries/credits.js +8 -8
- package/dist/entries/llm-models.cjs +60 -48
- package/dist/entries/llm-models.d.cts +45 -14
- package/dist/entries/llm-models.d.ts +45 -14
- package/dist/entries/llm-models.js +1 -1
- package/dist/entries/model-catalog.cjs +66 -66
- package/dist/entries/model-catalog.d.cts +2 -2
- package/dist/entries/model-catalog.d.ts +2 -2
- package/dist/entries/model-catalog.js +4 -4
- package/dist/entries/models.cjs +267 -226
- package/dist/entries/models.d.cts +58 -2
- package/dist/entries/models.d.ts +58 -2
- package/dist/entries/models.js +6 -5
- package/dist/entries/nodes.cjs +212 -207
- package/dist/entries/nodes.d.cts +20 -3
- package/dist/entries/nodes.d.ts +20 -3
- package/dist/entries/nodes.js +11 -10
- package/dist/entries/pipeline.cjs +149 -149
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/social.cjs +174 -174
- package/dist/entries/social.js +2 -2
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +115 -115
- package/dist/entries/video.js +4 -4
- package/dist/entries/workflow.cjs +157 -144
- package/dist/entries/workflow.d.cts +49 -1
- package/dist/entries/workflow.d.ts +49 -1
- package/dist/entries/workflow.js +4 -3
- package/dist/index.cjs +1435 -1366
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +23 -22
- package/dist/{model-catalog-VIHGmQL2.d.ts → model-catalog-I48SvalA.d.cts} +3 -0
- package/dist/{model-catalog-VIHGmQL2.d.cts → model-catalog-I48SvalA.d.ts} +3 -0
- package/package.json +1 -1
- package/src/__tests__/llm-models.test.ts +61 -18
- package/src/__tests__/node-preset-extract.test.ts +10 -0
- package/src/__tests__/node-runtime-keys.test.ts +21 -2
- package/src/__tests__/render-output.test.ts +64 -0
- package/src/__tests__/schedule-retry.test.ts +35 -0
- package/src/__tests__/suno-separate.test.ts +78 -0
- package/src/__tests__/video-catalog-totality.test.ts +15 -1
- package/src/entries/llm-models.ts +3 -0
- package/src/entries/models.ts +19 -0
- package/src/entries/workflow.ts +6 -0
- package/src/generated/unit-contracts.ts +8 -2
- package/src/llm-models.ts +63 -23
- package/src/model-catalog.ts +13 -0
- package/src/node-preset-extract.ts +4 -0
- package/src/node-runtime-keys.ts +7 -0
- package/src/render-output.ts +36 -1
- package/src/schedule-retry.ts +71 -0
- package/src/suno-separate.ts +210 -0
- package/dist/chunk-5ZCXWA7J.cjs.map +0 -1
- package/dist/chunk-72IFMNJE.cjs.map +0 -1
- package/dist/chunk-ANOQWAMU.js.map +0 -1
- package/dist/chunk-BBLE4UTG.cjs.map +0 -1
- package/dist/chunk-FKQJYMCO.js.map +0 -1
- package/dist/chunk-GKJRNIP4.js.map +0 -1
- package/dist/chunk-GZH2SIOF.cjs.map +0 -1
- package/dist/chunk-JSGIEF6Z.cjs.map +0 -1
- package/dist/chunk-LJMNCSDG.js.map +0 -1
- package/dist/chunk-TCBHVIMD.js.map +0 -1
- package/dist/chunk-V3N56Z2S.cjs.map +0 -1
- package/dist/chunk-XNISPHTZ.js.map +0 -1
- package/dist/chunk-YYODFQEU.cjs +0 -25
package/src/model-catalog.ts
CHANGED
|
@@ -173,6 +173,7 @@ export const MODEL_MAKERS = {
|
|
|
173
173
|
ideogram: { name: "Ideogram" },
|
|
174
174
|
kuaishou: { name: "Kuaishou" },
|
|
175
175
|
lightricks: { name: "Lightricks" },
|
|
176
|
+
luma: { name: "Luma AI" },
|
|
176
177
|
meituan: { name: "Meituan" },
|
|
177
178
|
minimax: { name: "MiniMax" },
|
|
178
179
|
nodaro: { name: "Nodaro" },
|
|
@@ -2465,6 +2466,18 @@ const VIDEO_MODELS: Record<string, ModelCatalogEntry> = {
|
|
|
2465
2466
|
useCases: ["v2v", "restyle"],
|
|
2466
2467
|
pricing: [{ identifier: "runway-aleph", credits: 350, note: "5s clip" }],
|
|
2467
2468
|
},
|
|
2469
|
+
"luma-modify": {
|
|
2470
|
+
id: "luma-modify",
|
|
2471
|
+
kind: "video",
|
|
2472
|
+
modes: ["v2v"] as const,
|
|
2473
|
+
family: "Luma",
|
|
2474
|
+
maker: "luma",
|
|
2475
|
+
label: "Luma Modify",
|
|
2476
|
+
series: "Luma",
|
|
2477
|
+
description: "Luma Modify — changes or restyles an existing video from a prompt.",
|
|
2478
|
+
useCases: ["v2v", "restyle"],
|
|
2479
|
+
pricing: [{ identifier: "luma-modify", credits: 320, note: "per clip" }],
|
|
2480
|
+
},
|
|
2468
2481
|
|
|
2469
2482
|
// ── Extend / Upscale ──
|
|
2470
2483
|
"veo-extend": {
|
|
@@ -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",
|
package/src/node-runtime-keys.ts
CHANGED
|
@@ -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? */
|
package/src/render-output.ts
CHANGED
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Suno Separate — the public contract of the separation node and its API.
|
|
3
|
+
*
|
|
4
|
+
* The three separation modes, the stem names "one instrument" mode accepts,
|
|
5
|
+
* the result fields a run writes, the credit id each mode is priced from, and
|
|
6
|
+
* the rule that turns a run's output into the URL behind each handle. One
|
|
7
|
+
* module so the route, the worker, both engines' output extractors and the
|
|
8
|
+
* editor read the same answers (they used to keep their own copies and price
|
|
9
|
+
* or route a mode in one place but not another). Structural vocabulary only.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** Separation modes, in the provider's wire spelling. */
|
|
13
|
+
export const SUNO_SEPARATE_TYPES = ["separate_vocal", "split_stem", "split_stem_advanced"] as const
|
|
14
|
+
export type SunoSeparateType = (typeof SUNO_SEPARATE_TYPES)[number]
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Every `stem_name` the provider accepts for `split_stem_advanced` ("one
|
|
18
|
+
* instrument"), verbatim and in the provider's order.
|
|
19
|
+
*/
|
|
20
|
+
export const SUNO_STEM_NAMES = [
|
|
21
|
+
"Lead Vocal",
|
|
22
|
+
"Drum Kit",
|
|
23
|
+
"Kick",
|
|
24
|
+
"Snare",
|
|
25
|
+
"Risers",
|
|
26
|
+
"Bass",
|
|
27
|
+
"Backing Vocals",
|
|
28
|
+
"Piano",
|
|
29
|
+
"Electric Guitar",
|
|
30
|
+
"Percussion",
|
|
31
|
+
"String Section",
|
|
32
|
+
"Synth",
|
|
33
|
+
"Acoustic Guitar",
|
|
34
|
+
"Sound Effects",
|
|
35
|
+
"Synth Pad",
|
|
36
|
+
"Synth Bass",
|
|
37
|
+
"Guitar",
|
|
38
|
+
"Brass Section",
|
|
39
|
+
"Organ",
|
|
40
|
+
"Electronic Drum Kit",
|
|
41
|
+
"Lead Electric Guitar",
|
|
42
|
+
"Synth Keys",
|
|
43
|
+
"Rhythm Electric Guitar",
|
|
44
|
+
"Electric Piano",
|
|
45
|
+
"Upright Bass",
|
|
46
|
+
"Keyboards",
|
|
47
|
+
"Distorted Electric Guitar",
|
|
48
|
+
"Synth Strings",
|
|
49
|
+
"Synth Lead",
|
|
50
|
+
"Woodwinds",
|
|
51
|
+
"Rhythm Acoustic Guitar",
|
|
52
|
+
"Flute",
|
|
53
|
+
"Harp",
|
|
54
|
+
"Tambourine",
|
|
55
|
+
"Trumpet",
|
|
56
|
+
"Arpeggiator",
|
|
57
|
+
"Accordion",
|
|
58
|
+
"Fiddle",
|
|
59
|
+
"Pedal Steel Guitar",
|
|
60
|
+
"Synth Voice",
|
|
61
|
+
"Violin",
|
|
62
|
+
"Digital Piano",
|
|
63
|
+
"Synth Brass",
|
|
64
|
+
"Mandolin",
|
|
65
|
+
"Choir",
|
|
66
|
+
"Banjo",
|
|
67
|
+
"Bells",
|
|
68
|
+
"Clarinet",
|
|
69
|
+
"Tenor Saxophone",
|
|
70
|
+
"Trombone",
|
|
71
|
+
"Shaker",
|
|
72
|
+
"French Horn",
|
|
73
|
+
"Glockenspiel",
|
|
74
|
+
"Electric Bass",
|
|
75
|
+
"Cello",
|
|
76
|
+
"Timpani",
|
|
77
|
+
"Harmonica",
|
|
78
|
+
"Marimba",
|
|
79
|
+
"Vibraphone",
|
|
80
|
+
"Lap Steel Guitar",
|
|
81
|
+
"Saxophone",
|
|
82
|
+
"Orchestra",
|
|
83
|
+
"Horns",
|
|
84
|
+
"Cymbals",
|
|
85
|
+
"Hand Clap",
|
|
86
|
+
"Oboe",
|
|
87
|
+
"Celesta",
|
|
88
|
+
"Congas",
|
|
89
|
+
"Drone",
|
|
90
|
+
"Alto Saxophone",
|
|
91
|
+
"Double Bass",
|
|
92
|
+
"Ukulele",
|
|
93
|
+
"Harpsichord",
|
|
94
|
+
"Baritone Saxophone",
|
|
95
|
+
"Xylophone",
|
|
96
|
+
"Tuba",
|
|
97
|
+
"Bass Guitar",
|
|
98
|
+
"Whistle",
|
|
99
|
+
"Lead Guitar",
|
|
100
|
+
"Rhodes",
|
|
101
|
+
"808",
|
|
102
|
+
"Bongos",
|
|
103
|
+
"Bassoon",
|
|
104
|
+
"Cowbell",
|
|
105
|
+
"Viola",
|
|
106
|
+
"Sitar",
|
|
107
|
+
"Steel Drums",
|
|
108
|
+
"Piccolo",
|
|
109
|
+
"Theremin",
|
|
110
|
+
"Bagpipes",
|
|
111
|
+
"Hi-Hat",
|
|
112
|
+
"Music Box",
|
|
113
|
+
"Melodica",
|
|
114
|
+
"Tabla",
|
|
115
|
+
"Koto",
|
|
116
|
+
"Djembe",
|
|
117
|
+
"Taiko",
|
|
118
|
+
"Didgeridoo",
|
|
119
|
+
] as const
|
|
120
|
+
export type SunoStemName = (typeof SUNO_STEM_NAMES)[number]
|
|
121
|
+
|
|
122
|
+
export const DEFAULT_SUNO_STEM_NAME: SunoStemName = "Lead Vocal"
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Credit id a mode is priced from. Anything that is not a full-stems or
|
|
126
|
+
* one-instrument run prices as the two-stem (vocals + instrumental) split.
|
|
127
|
+
*/
|
|
128
|
+
export function sunoSeparateCreditId(
|
|
129
|
+
type: unknown,
|
|
130
|
+
): "suno-separate" | "suno-separate-stem" | "suno-separate-single" {
|
|
131
|
+
if (type === "split_stem") return "suno-separate-stem"
|
|
132
|
+
if (type === "split_stem_advanced") return "suno-separate-single"
|
|
133
|
+
return "suno-separate"
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Flat per-stem URL fields of a run's output. `otherUrl` carries the Demucs
|
|
138
|
+
* `other` stem of a full-stems fallback run.
|
|
139
|
+
*/
|
|
140
|
+
export const SUNO_SEPARATE_STEM_FIELDS = [
|
|
141
|
+
"vocalUrl", "instrumentalUrl", "backingVocalsUrl", "drumsUrl",
|
|
142
|
+
"bassUrl", "guitarUrl", "pianoUrl", "keyboardUrl",
|
|
143
|
+
"percussionUrl", "stringsUrl", "synthUrl", "fxUrl",
|
|
144
|
+
"brassUrl", "woodwindsUrl", "otherUrl",
|
|
145
|
+
] as const
|
|
146
|
+
export type SunoSeparateStemField = (typeof SUNO_SEPARATE_STEM_FIELDS)[number]
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* One-instrument mode's two takes: the named instrument alone (`isolated`) and
|
|
150
|
+
* the song without it (`without`). Take 1 drives the `isolated` / `without`
|
|
151
|
+
* handles; take 2 is kept with the result but is not wireable.
|
|
152
|
+
*/
|
|
153
|
+
export const SUNO_SEPARATE_TAKE_FIELDS = ["isolatedUrl", "withoutUrl", "isolated2Url", "without2Url"] as const
|
|
154
|
+
|
|
155
|
+
/** Every URL field a run's output can carry. */
|
|
156
|
+
export const SUNO_SEPARATE_RESULT_FIELDS = [...SUNO_SEPARATE_STEM_FIELDS, ...SUNO_SEPARATE_TAKE_FIELDS] as const
|
|
157
|
+
export type SunoSeparateResultField = (typeof SUNO_SEPARATE_RESULT_FIELDS)[number]
|
|
158
|
+
|
|
159
|
+
/** Non-URL fields a run's output records about how it ran. */
|
|
160
|
+
export const SUNO_SEPARATE_META_FIELDS = ["separateType", "stemName", "engineUsed", "sunoRefused", "fallbackReason"] as const
|
|
161
|
+
|
|
162
|
+
function str(v: unknown): string | undefined {
|
|
163
|
+
return typeof v === "string" && v !== "" ? v : undefined
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// An output written before the per-field URLs existed: only `audioUrl`.
|
|
167
|
+
function isLegacyShape(output: Readonly<Record<string, unknown>>): boolean {
|
|
168
|
+
return !SUNO_SEPARATE_RESULT_FIELDS.some((field) => str(output[field]) !== undefined)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* The URL a run's output puts behind one handle. A stem that did not come back
|
|
173
|
+
* is empty — never filled with the main audio; only an output of the legacy
|
|
174
|
+
* shape routes `audioUrl` to `vocals` / `instrumental`. Accepts the old handle
|
|
175
|
+
* spellings (`vocal`, `vocal-out`, `instrumental-out`). Any other handle, or
|
|
176
|
+
* none, gets the primary URL.
|
|
177
|
+
*/
|
|
178
|
+
export function sunoSeparateHandleUrl(
|
|
179
|
+
output: Readonly<Record<string, unknown>>,
|
|
180
|
+
handle: string | null | undefined,
|
|
181
|
+
): string | undefined {
|
|
182
|
+
switch (handle) {
|
|
183
|
+
case "vocals":
|
|
184
|
+
case "vocal":
|
|
185
|
+
case "vocal-out":
|
|
186
|
+
return str(output.vocalUrl) ?? (isLegacyShape(output) ? str(output.audioUrl) : undefined)
|
|
187
|
+
case "instrumental":
|
|
188
|
+
case "instrumental-out":
|
|
189
|
+
return str(output.instrumentalUrl) ?? (isLegacyShape(output) ? str(output.audioUrl) : undefined)
|
|
190
|
+
case "isolated":
|
|
191
|
+
return str(output.isolatedUrl)
|
|
192
|
+
case "without":
|
|
193
|
+
return str(output.withoutUrl)
|
|
194
|
+
default:
|
|
195
|
+
return sunoSeparatePrimaryUrl(output) ?? str(output.audioUrl)
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* A run's main URL: vocals, else instrumental, else the isolated instrument,
|
|
201
|
+
* else the first stem that came back.
|
|
202
|
+
*/
|
|
203
|
+
export function sunoSeparatePrimaryUrl(output: Readonly<Record<string, unknown>>): string | undefined {
|
|
204
|
+
return (
|
|
205
|
+
str(output.vocalUrl) ??
|
|
206
|
+
str(output.instrumentalUrl) ??
|
|
207
|
+
str(output.isolatedUrl) ??
|
|
208
|
+
SUNO_SEPARATE_STEM_FIELDS.map((field) => str(output[field])).find((url) => url !== undefined)
|
|
209
|
+
)
|
|
210
|
+
}
|