@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.
- package/dist/{chunk-BSQCKTXH.cjs → chunk-33QG2DOW.cjs} +6 -6
- package/dist/{chunk-BSQCKTXH.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-NYMOHNYV.js → chunk-5OED47LE.js} +3 -3
- package/dist/{chunk-NYMOHNYV.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-LT5IJO4Y.cjs → chunk-6Y66YM4M.cjs} +10 -10
- package/dist/{chunk-LT5IJO4Y.cjs.map → chunk-6Y66YM4M.cjs.map} +1 -1
- package/dist/{chunk-YN6AXDN5.cjs → chunk-7Q75OZBL.cjs} +7 -7
- package/dist/{chunk-YN6AXDN5.cjs.map → chunk-7Q75OZBL.cjs.map} +1 -1
- package/dist/{chunk-AXUW64ZY.js → chunk-7QITUDRT.js} +3 -3
- package/dist/{chunk-AXUW64ZY.js.map → chunk-7QITUDRT.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-7VQPHLZ5.cjs → chunk-ENFBA33M.cjs} +21 -21
- package/dist/{chunk-7VQPHLZ5.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-JSGIEF6Z.cjs → chunk-HSJU5KNR.cjs} +6 -3
- package/dist/chunk-HSJU5KNR.cjs.map +1 -0
- package/dist/{chunk-NITAUX3A.cjs → chunk-JLKZEKQ3.cjs} +45 -28
- package/dist/chunk-JLKZEKQ3.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-AWWOQH46.cjs → chunk-NARVPCWW.cjs} +6 -6
- package/dist/{chunk-AWWOQH46.cjs.map → chunk-NARVPCWW.cjs.map} +1 -1
- package/dist/{chunk-ANOQWAMU.js → chunk-R6B2UDFR.js} +35 -5
- package/dist/chunk-R6B2UDFR.js.map +1 -0
- package/dist/{chunk-56VQ7V3V.js → chunk-WD6AJ533.js} +3 -3
- package/dist/{chunk-56VQ7V3V.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-NTHRTRQK.js → chunk-XA53RUSD.js} +22 -6
- package/dist/chunk-XA53RUSD.js.map +1 -0
- package/dist/{chunk-7AB3AE5L.js → chunk-YVKUCBY2.js} +3 -3
- package/dist/{chunk-7AB3AE5L.js.map → chunk-YVKUCBY2.js.map} +1 -1
- package/dist/entries/apps.cjs +38 -38
- package/dist/entries/apps.js +3 -3
- package/dist/entries/credits.cjs +128 -128
- package/dist/entries/credits.js +2 -2
- 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/models.cjs +68 -27
- package/dist/entries/models.d.cts +57 -1
- package/dist/entries/models.d.ts +57 -1
- package/dist/entries/models.js +3 -2
- package/dist/entries/nodes.cjs +204 -199
- package/dist/entries/nodes.d.cts +19 -2
- package/dist/entries/nodes.d.ts +19 -2
- package/dist/entries/nodes.js +5 -4
- package/dist/entries/social.cjs +174 -174
- package/dist/entries/social.js +2 -2
- 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 +820 -751
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +11 -10
- 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/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/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-ANOQWAMU.js.map +0 -1
- package/dist/chunk-BBLE4UTG.cjs.map +0 -1
- package/dist/chunk-FKQJYMCO.js.map +0 -1
- package/dist/chunk-GZH2SIOF.cjs.map +0 -1
- package/dist/chunk-JSGIEF6Z.cjs.map +0 -1
- package/dist/chunk-NITAUX3A.cjs.map +0 -1
- package/dist/chunk-NTHRTRQK.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
|
@@ -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
|
+
}
|