@nodaro/shared 3.16.0 → 3.18.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.
@@ -0,0 +1,71 @@
1
+ import { describe, it, expect } from "vitest"
2
+ import {
3
+ TEXT_TO_AUDIO_PRICING,
4
+ TEXT_TO_AUDIO_SFX_CREDIT_IDS,
5
+ textToAudioBilledSeconds,
6
+ textToAudioCreditId,
7
+ } from "../credit-estimators/index.js"
8
+
9
+ describe("textToAudioBilledSeconds — whole seconds, rounded up", () => {
10
+ it.each([
11
+ [0.5, 1],
12
+ [1, 1],
13
+ [1.2, 2],
14
+ [10, 10],
15
+ [22, 22],
16
+ [22.3, 23],
17
+ [30, 30],
18
+ ])("%s s bills %i s", (duration, billed) => {
19
+ expect(textToAudioBilledSeconds(duration)).toBe(billed)
20
+ })
21
+
22
+ it.each([[undefined], [null], [0], [-3], [Number.NaN], [Number.POSITIVE_INFINITY], ["abc"], [""]])(
23
+ "no usable duration (%s) bills the default %i s",
24
+ (duration) => {
25
+ expect(textToAudioBilledSeconds(duration)).toBe(TEXT_TO_AUDIO_PRICING.DEFAULT_BILLED_SEC)
26
+ expect(TEXT_TO_AUDIO_PRICING.DEFAULT_BILLED_SEC).toBe(5)
27
+ },
28
+ )
29
+
30
+ it("reads a numeric string (a field mapping can deliver one)", () => {
31
+ expect(textToAudioBilledSeconds("7.5")).toBe(8)
32
+ })
33
+
34
+ it("never bills past the longest clip the model makes", () => {
35
+ expect(textToAudioBilledSeconds(45)).toBe(30)
36
+ })
37
+ })
38
+
39
+ describe("textToAudioCreditId — the price row a Text to Audio run is charged from", () => {
40
+ it.each([
41
+ [0.5, "elevenlabs-sfx:1s"],
42
+ [6, "elevenlabs-sfx:6s"],
43
+ [10, "elevenlabs-sfx:10s"],
44
+ [22, "elevenlabs-sfx:22s"],
45
+ [30, "elevenlabs-sfx:30s"],
46
+ ])("%s s → %s", (duration, id) => {
47
+ expect(textToAudioCreditId("elevenlabs-sfx", duration)).toBe(id)
48
+ })
49
+
50
+ it("no duration → the 5 s row", () => {
51
+ expect(textToAudioCreditId("elevenlabs-sfx", undefined)).toBe("elevenlabs-sfx:5s")
52
+ })
53
+
54
+ it("no provider → the default engine's row", () => {
55
+ expect(textToAudioCreditId(undefined, 8)).toBe("elevenlabs-sfx:8s")
56
+ expect(textToAudioCreditId("", undefined)).toBe("elevenlabs-sfx:5s")
57
+ })
58
+
59
+ it("an engine not priced per second keeps its own row", () => {
60
+ expect(textToAudioCreditId("tangoflux", 8)).toBe("tangoflux")
61
+ })
62
+
63
+ it("every id it can return is in the published per-second id list (1 s … 30 s)", () => {
64
+ expect(TEXT_TO_AUDIO_SFX_CREDIT_IDS).toHaveLength(30)
65
+ expect(TEXT_TO_AUDIO_SFX_CREDIT_IDS[0]).toBe("elevenlabs-sfx:1s")
66
+ expect(TEXT_TO_AUDIO_SFX_CREDIT_IDS[29]).toBe("elevenlabs-sfx:30s")
67
+ for (const d of [undefined, 0.5, 1, 4.2, 22, 30, 99]) {
68
+ expect(TEXT_TO_AUDIO_SFX_CREDIT_IDS).toContain(textToAudioCreditId("elevenlabs-sfx", d))
69
+ }
70
+ })
71
+ })
@@ -0,0 +1,237 @@
1
+ import { describe, it, expect } from "vitest"
2
+ import { MODEL_CATALOG } from "../model-catalog.js"
3
+ import { TTS_PROVIDERS, MAX_TTS_CHARS_BY_PROVIDER, getMaxTtsChars, TTS_TEXT_MAX } from "../model-constants.js"
4
+ import {
5
+ TTS_PROVIDER_ALIASES,
6
+ TTS_FALLBACK_PROVIDER,
7
+ canonicalTtsProvider,
8
+ findTtsCapabilities,
9
+ getTtsCapabilities,
10
+ ttsSupportsAudioTags,
11
+ ttsSupportsSsmlBreaks,
12
+ ttsHasLever,
13
+ ttsLanguageCodes,
14
+ } from "../tts-capabilities.js"
15
+
16
+ describe("speech-model capability sheets — totality", () => {
17
+ it("every text-to-speech provider id resolves to a catalog model with a sheet and a price", () => {
18
+ for (const id of TTS_PROVIDERS) {
19
+ const entry = MODEL_CATALOG[canonicalTtsProvider(id)]
20
+ expect(entry, `${id} has no catalog entry`).toBeDefined()
21
+ expect(entry!.tts, `${id} has no capability sheet`).toBeDefined()
22
+ expect(entry!.pricing.length, `${id} has no pricing row`).toBeGreaterThan(0)
23
+ }
24
+ })
25
+
26
+ it("every catalog model that speaks (tts or dialogue mode) carries a sheet, and nothing else does", () => {
27
+ for (const m of Object.values(MODEL_CATALOG)) {
28
+ const speaks = m.modes.includes("tts") || m.modes.includes("dialogue")
29
+ expect(m.tts !== undefined, `${m.id}: sheet presence must match its modes`).toBe(speaks)
30
+ }
31
+ })
32
+
33
+ it("every non-alias provider id IS a catalog id, and every alias points at a real speech model", () => {
34
+ for (const id of TTS_PROVIDERS) {
35
+ if (id in TTS_PROVIDER_ALIASES) continue
36
+ expect(MODEL_CATALOG[id]?.modes).toContain("tts")
37
+ }
38
+ for (const [alias, target] of Object.entries(TTS_PROVIDER_ALIASES)) {
39
+ expect(MODEL_CATALOG[alias], `${alias} is an alias and must not have its own entry`).toBeUndefined()
40
+ expect(MODEL_CATALOG[target]?.tts).toBeDefined()
41
+ }
42
+ expect(MODEL_CATALOG[TTS_FALLBACK_PROVIDER]?.tts).toBeDefined()
43
+ })
44
+
45
+ it("each sheet is internally consistent", () => {
46
+ for (const m of Object.values(MODEL_CATALOG)) {
47
+ if (!m.tts) continue
48
+ expect(Number.isInteger(m.tts.maxChars) && m.tts.maxChars > 0, `${m.id} maxChars`).toBe(true)
49
+ expect(m.tts.levers, `${m.id} must honour stability`).toContain("stability")
50
+ expect(new Set(m.tts.levers).size, `${m.id} duplicate lever`).toBe(m.tts.levers.length)
51
+ expect(m.tts.languages.length, `${m.id} languages`).toBeGreaterThan(0)
52
+ expect(new Set(m.tts.languages).size, `${m.id} duplicate language`).toBe(m.tts.languages.length)
53
+ // The `features` flag other packages already read must agree with the sheet.
54
+ expect(m.features?.includes("audio-tags") ?? false, `${m.id} audio-tags feature`).toBe(m.tts.audioTags)
55
+ }
56
+ })
57
+ })
58
+
59
+ describe("speech-model capability sheets — what each model does today", () => {
60
+ it("v3: tags, no SSML, stability only, 5,000 characters, 46 languages", () => {
61
+ const c = getTtsCapabilities("elevenlabs-v3")
62
+ expect(c.audioTags).toBe(true)
63
+ expect(c.ssmlBreaks).toBe(false)
64
+ expect(c.levers).toEqual(["stability"])
65
+ expect(c.languageCode).toBe(true)
66
+ expect(c.maxChars).toBe(5000)
67
+ expect(c.languages).toHaveLength(46)
68
+ expect(c.languages).toContain("he")
69
+ })
70
+
71
+ it("turbo: no tags, SSML, all five levers, 40,000 characters, 32 languages", () => {
72
+ const c = getTtsCapabilities("elevenlabs-turbo")
73
+ expect(c.audioTags).toBe(false)
74
+ expect(c.ssmlBreaks).toBe(true)
75
+ expect(c.levers).toEqual(["stability", "similarity", "style", "speed", "speakerBoost"])
76
+ expect(c.languageCode).toBe(true)
77
+ expect(c.maxChars).toBe(40000)
78
+ expect(c.languages).toHaveLength(32)
79
+ expect(c.languages).not.toContain("he")
80
+ })
81
+
82
+ it("multilingual: no tags, SSML, all five levers, no language code, 10,000 characters, 29 languages", () => {
83
+ const c = getTtsCapabilities("elevenlabs-multilingual")
84
+ expect(c.audioTags).toBe(false)
85
+ expect(c.ssmlBreaks).toBe(true)
86
+ expect(c.levers).toEqual(["stability", "similarity", "style", "speed", "speakerBoost"])
87
+ expect(c.languageCode).toBe(false)
88
+ expect(c.maxChars).toBe(10000)
89
+ expect(c.languages).toHaveLength(29)
90
+ })
91
+
92
+ it("dialogue (read from its catalog entry — its own lane): tags, stability only, 5,000 characters in total", () => {
93
+ const c = MODEL_CATALOG["elevenlabs-dialogue"]!.tts!
94
+ expect(c.audioTags).toBe(true)
95
+ expect(c.levers).toEqual(["stability"])
96
+ expect(c.maxChars).toBe(5000)
97
+ })
98
+ })
99
+
100
+ describe("speech-model capability lookups", () => {
101
+ it("the legacy alias reads as the model it runs on", () => {
102
+ expect(canonicalTtsProvider("elevenlabs")).toBe("elevenlabs-turbo")
103
+ expect(canonicalTtsProvider("elevenlabs-v3")).toBe("elevenlabs-v3")
104
+ expect(findTtsCapabilities("elevenlabs")).toBe(getTtsCapabilities("elevenlabs-turbo"))
105
+ })
106
+
107
+ it("a missing or unknown id gets the fallback model's sheet, and `find` says it is unknown", () => {
108
+ expect(findTtsCapabilities(undefined)).toBeUndefined()
109
+ expect(findTtsCapabilities("")).toBeUndefined()
110
+ expect(findTtsCapabilities("not-a-model")).toBeUndefined()
111
+ expect(findTtsCapabilities("nano-banana-pro")).toBeUndefined() // a real model, not a speech model
112
+ expect(getTtsCapabilities(undefined)).toBe(getTtsCapabilities("elevenlabs-turbo"))
113
+ expect(getTtsCapabilities("not-a-model")).toBe(getTtsCapabilities("elevenlabs-turbo"))
114
+ })
115
+
116
+ it("an id that is the name of an inherited object member is an unknown id, never a function", () => {
117
+ for (const id of ["constructor", "__proto__", "toString", "hasOwnProperty", "valueOf"]) {
118
+ expect(canonicalTtsProvider(id), id).toBe(id)
119
+ expect(findTtsCapabilities(id), id).toBeUndefined()
120
+ expect(getTtsCapabilities(id), id).toBe(getTtsCapabilities("elevenlabs-turbo"))
121
+ expect(ttsSupportsAudioTags(id), id).toBe(false)
122
+ expect(getMaxTtsChars(id), id).toBe(TTS_TEXT_MAX)
123
+ }
124
+ })
125
+
126
+ it("a non-string id (node data can be written straight into workflow JSON) is an unknown id — an array is not coerced into the model it spells", () => {
127
+ for (const id of [["elevenlabs-v3"], ["elevenlabs-multilingual"], ["elevenlabs"], 3, {}, true, null] as unknown as string[]) {
128
+ expect(findTtsCapabilities(id), JSON.stringify(id)).toBeUndefined()
129
+ expect(getTtsCapabilities(id), JSON.stringify(id)).toBe(getTtsCapabilities("elevenlabs-turbo"))
130
+ expect(ttsSupportsAudioTags(id), JSON.stringify(id)).toBe(false)
131
+ expect(ttsHasLever(id, "style"), JSON.stringify(id)).toBe(true)
132
+ expect(canonicalTtsProvider(id), JSON.stringify(id)).toBe(id)
133
+ }
134
+ })
135
+
136
+ it("the dialogue model has a sheet for its own lane but is not a text-to-speech model: a speech request naming it runs as the fallback", () => {
137
+ expect(MODEL_CATALOG["elevenlabs-dialogue"]!.tts).toBeDefined()
138
+ expect(findTtsCapabilities("elevenlabs-dialogue")).toBeUndefined()
139
+ expect(getTtsCapabilities("elevenlabs-dialogue")).toBe(getTtsCapabilities("elevenlabs-turbo"))
140
+ expect(ttsSupportsAudioTags("elevenlabs-dialogue")).toBe(false)
141
+ expect(ttsHasLever("elevenlabs-dialogue", "style")).toBe(true)
142
+ })
143
+
144
+ it("audio tags: kept on v3, stripped everywhere else (alias, unknown and missing included)", () => {
145
+ expect(ttsSupportsAudioTags("elevenlabs-v3")).toBe(true)
146
+ expect(ttsSupportsAudioTags("elevenlabs-turbo")).toBe(false)
147
+ expect(ttsSupportsAudioTags("elevenlabs-multilingual")).toBe(false)
148
+ expect(ttsSupportsAudioTags("elevenlabs")).toBe(false)
149
+ expect(ttsSupportsAudioTags(undefined)).toBe(false)
150
+ expect(ttsSupportsAudioTags("not-a-model")).toBe(false)
151
+ })
152
+
153
+ it("SSML breaks are the mirror image", () => {
154
+ expect(ttsSupportsSsmlBreaks("elevenlabs-turbo")).toBe(true)
155
+ expect(ttsSupportsSsmlBreaks("elevenlabs-multilingual")).toBe(true)
156
+ expect(ttsSupportsSsmlBreaks("elevenlabs-v3")).toBe(false)
157
+ })
158
+
159
+ it("levers", () => {
160
+ expect(ttsHasLever("elevenlabs-v3", "stability")).toBe(true)
161
+ expect(ttsHasLever("elevenlabs-v3", "similarity")).toBe(false)
162
+ expect(ttsHasLever("elevenlabs-v3", "speed")).toBe(false)
163
+ expect(ttsHasLever("elevenlabs-turbo", "similarity")).toBe(true)
164
+ expect(ttsHasLever("elevenlabs-turbo", "speed")).toBe(true)
165
+ expect(ttsHasLever("elevenlabs-turbo", "speakerBoost")).toBe(true)
166
+ })
167
+
168
+ it("languages nest: multilingual ⊂ turbo ⊂ v3", () => {
169
+ const multi = ttsLanguageCodes("elevenlabs-multilingual")
170
+ const turbo = ttsLanguageCodes("elevenlabs-turbo")
171
+ const v3 = ttsLanguageCodes("elevenlabs-v3")
172
+ expect(multi.every((c) => turbo.includes(c))).toBe(true)
173
+ expect(turbo.every((c) => v3.includes(c))).toBe(true)
174
+ expect(turbo.filter((c) => !multi.includes(c))).toEqual(["hu", "no", "vi"])
175
+ })
176
+ })
177
+
178
+ describe("character caps derive from the sheets", () => {
179
+ it("MAX_TTS_CHARS_BY_PROVIDER has exactly the catalog's speech models", () => {
180
+ const speaking = Object.values(MODEL_CATALOG).filter((m) => m.tts).map((m) => m.id).sort()
181
+ expect(Object.keys(MAX_TTS_CHARS_BY_PROVIDER).sort()).toEqual(speaking)
182
+ })
183
+
184
+ it("keeps every cap it had before the sheets existed; the alias and unknown ids keep the default", () => {
185
+ expect(getMaxTtsChars("elevenlabs-turbo")).toBe(40000)
186
+ expect(getMaxTtsChars("elevenlabs-multilingual")).toBe(10000)
187
+ expect(getMaxTtsChars("elevenlabs-v3")).toBe(5000)
188
+ expect(getMaxTtsChars("elevenlabs-dialogue")).toBe(5000)
189
+ expect(getMaxTtsChars("elevenlabs")).toBe(TTS_TEXT_MAX)
190
+ expect(getMaxTtsChars(undefined)).toBe(TTS_TEXT_MAX)
191
+ })
192
+ })
193
+
194
+ describe("elevenlabs-v4 — added beside v3", () => {
195
+ it("is a text-to-speech provider, in the catalog, with the sheet below", () => {
196
+ expect(TTS_PROVIDERS).toContain("elevenlabs-v4")
197
+ expect(MODEL_CATALOG["elevenlabs-v4"]?.modes).toContain("tts")
198
+ })
199
+
200
+ it("tags, no SSML, stability + similarity, 10,000 characters, the same 46 languages as v3", () => {
201
+ const c = getTtsCapabilities("elevenlabs-v4")
202
+ expect(c.audioTags).toBe(true)
203
+ expect(c.ssmlBreaks).toBe(false)
204
+ expect(c.levers).toEqual(["stability", "similarity"])
205
+ expect(c.languageCode).toBe(true)
206
+ expect(c.maxChars).toBe(10000)
207
+ expect(c.languages).toEqual(getTtsCapabilities("elevenlabs-v3").languages)
208
+ })
209
+
210
+ it("keeps [audio tags] and has no SSML breaks", () => {
211
+ expect(ttsSupportsAudioTags("elevenlabs-v4")).toBe(true)
212
+ expect(ttsSupportsSsmlBreaks("elevenlabs-v4")).toBe(false)
213
+ })
214
+
215
+ it("honours similarity but not speed, style or speaker boost", () => {
216
+ expect(ttsHasLever("elevenlabs-v4", "similarity")).toBe(true)
217
+ expect(ttsHasLever("elevenlabs-v4", "speed")).toBe(false)
218
+ expect(ttsHasLever("elevenlabs-v4", "style")).toBe(false)
219
+ expect(ttsHasLever("elevenlabs-v4", "speakerBoost")).toBe(false)
220
+ })
221
+
222
+ it("is capped at 10,000 characters; v3 stays at 5,000", () => {
223
+ expect(getMaxTtsChars("elevenlabs-v4")).toBe(10000)
224
+ expect(getMaxTtsChars("elevenlabs-v3")).toBe(5000)
225
+ })
226
+
227
+ it("costs a flat 30 credits with no per-length note, and is not the featured model — v3 stays the default", () => {
228
+ const v4 = MODEL_CATALOG["elevenlabs-v4"]!
229
+ expect(v4.pricing).toEqual([{ identifier: "elevenlabs-v4", credits: 30 }])
230
+ expect(v4.featured).toBeUndefined()
231
+ expect(MODEL_CATALOG["elevenlabs-v3"]!.featured).toBe(true)
232
+ })
233
+
234
+ it("does not call v3 the latest model any more", () => {
235
+ expect(MODEL_CATALOG["elevenlabs-v3"]!.description).not.toMatch(/latest/i)
236
+ })
237
+ })
@@ -16,6 +16,13 @@ export {
16
16
 
17
17
  export { VIDEO_SFX_PRICING, videoSfxCreditId } from "./video-sfx.js"
18
18
 
19
+ export {
20
+ TEXT_TO_AUDIO_PRICING,
21
+ TEXT_TO_AUDIO_SFX_CREDIT_IDS,
22
+ textToAudioBilledSeconds,
23
+ textToAudioCreditId,
24
+ } from "./text-to-audio.js"
25
+
19
26
  export {
20
27
  LTX_EXTEND_PER_SECOND_CREDIT_ID,
21
28
  LTX_EXTEND_DURATION,
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Text to Audio (sound effects) pricing — which price row a run is charged
3
+ * from, by the length of the clip it asks for. One mapping for every place
4
+ * that names the row: the route (`POST /v1/text-to-audio`), the workflow run's
5
+ * reservation, the node's Run button and the workflow estimates.
6
+ *
7
+ * `elevenlabs-sfx` is priced per second: one `model_pricing` row per whole
8
+ * second (`elevenlabs-sfx:1s` … `elevenlabs-sfx:30s`); the credit amounts live
9
+ * there, never here. The requested length is rounded UP to whole seconds, and
10
+ * a request that names no length is priced as 5 seconds. Worked examples
11
+ * (repeated in docs/nodes/ai-audio/text-to-audio.md):
12
+ * 0.5 s → `:1s`, 6 s → `:6s`, 22.3 s → `:23s`, no duration → `:5s`.
13
+ */
14
+
15
+ import { DEFAULT_TEXT_TO_AUDIO_PROVIDER } from "../model-constants.js"
16
+
17
+ export const TEXT_TO_AUDIO_PRICING = {
18
+ /** The engine priced per second of requested audio. */
19
+ PER_SECOND_PROVIDER: "elevenlabs-sfx",
20
+ /** The longest clip a request may ask for, in seconds. */
21
+ MAX_DURATION_SEC: 30,
22
+ /** The length priced when a request names none (the model picks the length). */
23
+ DEFAULT_BILLED_SEC: 5,
24
+ } as const
25
+
26
+ /** Every per-second price row, shortest first: `elevenlabs-sfx:1s` … `:30s`. */
27
+ export const TEXT_TO_AUDIO_SFX_CREDIT_IDS: readonly string[] = Array.from(
28
+ { length: TEXT_TO_AUDIO_PRICING.MAX_DURATION_SEC },
29
+ (_, i) => `${TEXT_TO_AUDIO_PRICING.PER_SECOND_PROVIDER}:${i + 1}s`,
30
+ )
31
+
32
+ /**
33
+ * The whole seconds a request of `duration` seconds is billed for: rounded up,
34
+ * at most the 30 s cap. No usable length (absent, empty, non-numeric, zero or
35
+ * negative) bills the 5 s default. A numeric string counts — a field mapping
36
+ * can deliver the length as text.
37
+ */
38
+ export function textToAudioBilledSeconds(duration: unknown): number {
39
+ const seconds =
40
+ typeof duration === "number"
41
+ ? duration
42
+ : typeof duration === "string" && duration.trim() !== ""
43
+ ? Number(duration)
44
+ : Number.NaN
45
+ if (!Number.isFinite(seconds) || seconds <= 0) return TEXT_TO_AUDIO_PRICING.DEFAULT_BILLED_SEC
46
+ return Math.min(Math.ceil(seconds), TEXT_TO_AUDIO_PRICING.MAX_DURATION_SEC)
47
+ }
48
+
49
+ /**
50
+ * The price row for a Text to Audio request. A request with no provider runs
51
+ * (and is priced as) the default engine. An engine that is not priced per
52
+ * second keeps its own flat row.
53
+ */
54
+ export function textToAudioCreditId(provider: string | null | undefined, duration: unknown): string {
55
+ const engine = provider || DEFAULT_TEXT_TO_AUDIO_PROVIDER
56
+ if (engine !== TEXT_TO_AUDIO_PRICING.PER_SECOND_PROVIDER) return engine
57
+ return `${engine}:${textToAudioBilledSeconds(duration)}s`
58
+ }
@@ -662,6 +662,18 @@ export function speedRampCreditId(quality: unknown): "speed-ramp" | "speed-ramp:
662
662
  return quality === "smooth" ? "speed-ramp:smooth" : "speed-ramp"
663
663
  }
664
664
 
665
+ /**
666
+ * Apply EDL's price id: a `proxy` render (the 720p preview) is its own,
667
+ * cheaper per-output-minute row; a `final` render keeps the bare id. One id per
668
+ * QUALITY, for a video and an audio output alike (decided 2026-10-04). Anything
669
+ * that is not exactly "proxy" is the final, as the route and the node default
670
+ * it. The route, the workflow run, and the editor's badge and run estimate all
671
+ * price through this; the job itself is always named `apply-edl`.
672
+ */
673
+ export function applyEdlCreditId(quality: unknown): "apply-edl" | "apply-edl:proxy" {
674
+ return quality === "proxy" ? "apply-edl:proxy" : "apply-edl"
675
+ }
676
+
665
677
  /**
666
678
  * OUR Nodaro credit key for a Suno operation, given the model version and the
667
679
  * operation (which is also the node type and the BullMQ job name).
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Exposed-field keys that were renamed to the node's real data field.
3
+ *
4
+ * A published app stores which fields it exposes as `{ type: "field", nodeId, field }` items in its
5
+ * immutable snapshot settings, and external callers send `inputOverrides[nodeId][field]` with that same
6
+ * string — it is part of the public wire contract (docs/embed-app-guide.md). Renaming a descriptor's key
7
+ * must not strand the apps already published with the old spelling: they keep that string forever, so every
8
+ * place that turns a stored key into a node-data key — or compares it with a descriptor key — goes through
9
+ * `canonicalExposedFieldKey`.
10
+ *
11
+ * CLOSED LIST. A row needs a spelling that was published (a card that existed in apps) and a target the
12
+ * node's descriptor now declares (the frontend guard `exposable-field-keys.test.ts` checks both). Only list a
13
+ * field whose card cannot carry `allowedValues` (slider / toggle / text / color): the server validates
14
+ * `allowedValues` against the stored key (backend routes/app-runner.ts `validateRestrictedFields`). Never list
15
+ * a field of an outbound node type: the run-request override lock (backend lib/input-override-lock.ts) reads
16
+ * the stored key, before this table renames it.
17
+ */
18
+ export const LEGACY_EXPOSED_FIELD_KEYS: Readonly<Record<string, Readonly<Record<string, string>>>> = {
19
+ // Published as the Text to Speech slider's key. The node's data field, and every runner, route and config
20
+ // panel, has always been `similarityBoost` — so the slider moved nothing.
21
+ "text-to-speech": { similarity: "similarityBoost" },
22
+ }
23
+
24
+ /** The node-data key an exposed field's stored key stands for. Unknown node types and keys pass through. */
25
+ export function canonicalExposedFieldKey(nodeType: string | undefined, key: string): string {
26
+ if (typeof nodeType !== "string" || !Object.hasOwn(LEGACY_EXPOSED_FIELD_KEYS, nodeType)) return key
27
+ const renames = LEGACY_EXPOSED_FIELD_KEYS[nodeType]!
28
+ return Object.hasOwn(renames, key) ? renames[key]! : key
29
+ }
30
+
31
+ /**
32
+ * The override map with every legacy spelling replaced by its current key. When the caller sent both
33
+ * spellings the current one wins (it is their current intent) and the legacy key is dropped — a dead key
34
+ * is never written to node data. Returns the same object when nothing renames; never mutates.
35
+ */
36
+ export function canonicalizeOverrideKeys(
37
+ nodeType: string | undefined,
38
+ overrides: Record<string, unknown>,
39
+ ): Record<string, unknown> {
40
+ let out: Record<string, unknown> | undefined
41
+ for (const key of Object.keys(overrides)) {
42
+ const current = canonicalExposedFieldKey(nodeType, key)
43
+ if (current === key) continue
44
+ out ??= { ...overrides }
45
+ delete out[key]
46
+ if (!Object.hasOwn(overrides, current)) out[current] = overrides[key]
47
+ }
48
+ return out ?? overrides
49
+ }
package/src/index.ts CHANGED
@@ -87,6 +87,7 @@ export {
87
87
  MOTION_TRANSFER_PROVIDERS,
88
88
  TTS_PROVIDERS,
89
89
  TEXT_TO_AUDIO_PROVIDERS,
90
+ DEFAULT_TEXT_TO_AUDIO_PROVIDER,
90
91
  MUSIC_PROVIDERS,
91
92
  DEFAULT_MUSIC_PROVIDER,
92
93
  MUSIC_PROVIDER_LABELS,
@@ -274,6 +275,7 @@ export {
274
275
  pricedVideoSelection,
275
276
  buildMotionCreditModelIdentifier,
276
277
  speedRampCreditId,
278
+ applyEdlCreditId,
277
279
  sunoCreditType,
278
280
  SUNO_VERSION_CREDIT_KEYS,
279
281
  SUNO_VERSION_PRICED_OPERATIONS,
@@ -315,6 +317,12 @@ export {
315
317
  type InputFieldSchema,
316
318
  } from "./presentation-utils.js"
317
319
 
320
+ export {
321
+ LEGACY_EXPOSED_FIELD_KEYS,
322
+ canonicalExposedFieldKey,
323
+ canonicalizeOverrideKeys,
324
+ } from "./exposed-field-keys.js"
325
+
318
326
  export {
319
327
  ITER_CLONE_PATTERN,
320
328
  isExpandedClone,
@@ -833,6 +841,8 @@ export {
833
841
  resolveInstagramScrapeCreditId,
834
842
  instagramScrapeSources,
835
843
  instagramScrapeCreditIdFromNode,
844
+ instagramRequestedCount,
845
+ instagramPostLink,
836
846
  splitInstagramTargets,
837
847
  clampInstagramFeaturedIndex,
838
848
  featuredInstagramOutputs,
@@ -1115,8 +1125,22 @@ export type {
1115
1125
  ModelMenuOption,
1116
1126
  ModelInputAdjustment,
1117
1127
  NormalizedModelInput,
1128
+ TtsCapabilities,
1129
+ TtsSettingLever,
1118
1130
  } from "./model-catalog.js"
1119
1131
 
1132
+ // Speech-model capability lookups (derive from `ModelCatalogEntry.tts` above).
1133
+ export {
1134
+ TTS_PROVIDER_ALIASES,
1135
+ TTS_FALLBACK_PROVIDER,
1136
+ canonicalTtsProvider,
1137
+ getTtsCapabilities,
1138
+ ttsSupportsAudioTags,
1139
+ ttsSupportsSsmlBreaks,
1140
+ ttsHasLever,
1141
+ ttsLanguageCodes,
1142
+ } from "./tts-capabilities.js"
1143
+
1120
1144
  // Per-model safety-filter retry/fallback policy (derives from
1121
1145
  // `ModelCatalogEntry.safetyFilter` above).
1122
1146
  export { safetyRetryPolicy } from "./safety-retry-policy.js"
@@ -1495,10 +1519,20 @@ export {
1495
1519
  STUDIO_SHOT_TRANSIENT_KEYS,
1496
1520
  STUDIO_SHOT_DRAFT_KEYS,
1497
1521
  STUDIO_TAKE_VOICE_KEYS,
1522
+ STUDIO_PREVIZ_RUN_STATE_KEYS,
1498
1523
  stripStudioTransientSettings,
1499
1524
  stripStudioDraftSettings,
1500
1525
  stripStudioDraftWorkflow,
1501
1526
  stripStudioTakeVoiceRecords,
1527
+ STUDIO_TAKE_SEQUENCE_KEYS,
1528
+ STUDIO_SEQUENCE_PLANNING_KEYS,
1529
+ STUDIO_SEQUENCE_UNIT_REVIEW_KEYS,
1530
+ STUDIO_SEQUENCE_POLICY_KEYS,
1531
+ STUDIO_SEQUENCE_UNIT_MANIFEST_KEYS,
1532
+ STUDIO_KEYFRAME_NODE_TRANSIENT_KEYS,
1533
+ STUDIO_KEYFRAME_TRANSIENT_KEYS,
1534
+ STUDIO_KEYFRAME_REVIEW_KEYS,
1535
+ STUDIO_KEYFRAME_ACCEPTANCE_PRIVATE_KEYS,
1502
1536
  } from "./studio-transient.js"
1503
1537
 
1504
1538
  export * from "./scene3d-v2-edit.js"