@nodaro/shared 3.64.0 → 3.66.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-J6B7J73J.cjs → chunk-23IKLMRL.cjs} +49 -49
- package/dist/{chunk-J6B7J73J.cjs.map → chunk-23IKLMRL.cjs.map} +1 -1
- package/dist/chunk-27HA6YOL.cjs +377 -0
- package/dist/chunk-27HA6YOL.cjs.map +1 -0
- package/dist/{chunk-OOZW2MM6.cjs → chunk-37ZSFS6A.cjs} +9 -9
- package/dist/{chunk-OOZW2MM6.cjs.map → chunk-37ZSFS6A.cjs.map} +1 -1
- package/dist/{chunk-AZNZ5WNZ.cjs → chunk-3L7GMQ4M.cjs} +142 -45
- package/dist/chunk-3L7GMQ4M.cjs.map +1 -0
- package/dist/{chunk-SXHHLZ22.js → chunk-3QJ3UR5Z.js} +9 -9
- package/dist/{chunk-SXHHLZ22.js.map → chunk-3QJ3UR5Z.js.map} +1 -1
- package/dist/chunk-3YWZ5SOZ.js +164 -0
- package/dist/chunk-3YWZ5SOZ.js.map +1 -0
- package/dist/{chunk-TTGZ2L3O.js → chunk-5GG4CG4Y.js} +3 -3
- package/dist/{chunk-TTGZ2L3O.js.map → chunk-5GG4CG4Y.js.map} +1 -1
- package/dist/{chunk-3KTWYYCN.js → chunk-5IZHECUP.js} +3 -3
- package/dist/{chunk-3KTWYYCN.js.map → chunk-5IZHECUP.js.map} +1 -1
- package/dist/{chunk-Q2Y4JHF7.js → chunk-5J2LIQYU.js} +5 -5
- package/dist/{chunk-Q2Y4JHF7.js.map → chunk-5J2LIQYU.js.map} +1 -1
- package/dist/{chunk-SHH2T4CR.js → chunk-5LWYX4GV.js} +3 -3
- package/dist/{chunk-SHH2T4CR.js.map → chunk-5LWYX4GV.js.map} +1 -1
- package/dist/{chunk-7AJGUI7L.cjs → chunk-5NVGKXJV.cjs} +34 -17
- package/dist/chunk-5NVGKXJV.cjs.map +1 -0
- package/dist/{chunk-D4KWNDPH.cjs → chunk-66QSUUB4.cjs} +12 -12
- package/dist/{chunk-D4KWNDPH.cjs.map → chunk-66QSUUB4.cjs.map} +1 -1
- package/dist/{chunk-KHH54GRP.cjs → chunk-6ET3KDO4.cjs} +15 -338
- package/dist/chunk-6ET3KDO4.cjs.map +1 -0
- package/dist/{chunk-ZI3QDUHO.js → chunk-AT53ZQUC.js} +3 -3
- package/dist/{chunk-ZI3QDUHO.js.map → chunk-AT53ZQUC.js.map} +1 -1
- package/dist/chunk-BMDOPJBP.cjs +185 -0
- package/dist/chunk-BMDOPJBP.cjs.map +1 -0
- package/dist/{chunk-PJJAZQVZ.js → chunk-BNR5FKL5.js} +3 -3
- package/dist/{chunk-PJJAZQVZ.js.map → chunk-BNR5FKL5.js.map} +1 -1
- package/dist/{chunk-5OBTGNUQ.cjs → chunk-E62W5I6A.cjs} +298 -2
- package/dist/chunk-E62W5I6A.cjs.map +1 -0
- package/dist/{chunk-GTWUS6MQ.cjs → chunk-EFYWV2V5.cjs} +61 -61
- package/dist/{chunk-GTWUS6MQ.cjs.map → chunk-EFYWV2V5.cjs.map} +1 -1
- package/dist/chunk-F6XIH3TZ.cjs +168 -0
- package/dist/chunk-F6XIH3TZ.cjs.map +1 -0
- package/dist/{chunk-NIAFR5EE.js → chunk-FGBGKBML.js} +32 -3
- package/dist/chunk-FGBGKBML.js.map +1 -0
- package/dist/{chunk-YQV53HRR.cjs → chunk-G2G7XGFU.cjs} +7 -7
- package/dist/{chunk-YQV53HRR.cjs.map → chunk-G2G7XGFU.cjs.map} +1 -1
- package/dist/{chunk-7KQ6W5DS.js → chunk-GF7ZA26H.js} +4 -4
- package/dist/{chunk-7KQ6W5DS.js.map → chunk-GF7ZA26H.js.map} +1 -1
- package/dist/{chunk-SPAHI7DY.cjs → chunk-GNLA5NTT.cjs} +4 -4
- package/dist/{chunk-SPAHI7DY.cjs.map → chunk-GNLA5NTT.cjs.map} +1 -1
- package/dist/{chunk-VPTA4Z7G.js → chunk-GTBW2KAY.js} +5 -5
- package/dist/{chunk-VPTA4Z7G.js.map → chunk-GTBW2KAY.js.map} +1 -1
- package/dist/{chunk-CHS2SIP6.cjs → chunk-HTDKEYMY.cjs} +90 -76
- package/dist/chunk-HTDKEYMY.cjs.map +1 -0
- package/dist/{chunk-EXEVT6D2.cjs → chunk-IWUW3YPM.cjs} +5 -5
- package/dist/{chunk-EXEVT6D2.cjs.map → chunk-IWUW3YPM.cjs.map} +1 -1
- package/dist/{chunk-ACZZHHFZ.cjs → chunk-JTYCJ5OL.cjs} +44 -22
- package/dist/chunk-JTYCJ5OL.cjs.map +1 -0
- package/dist/{chunk-HDPJNNMF.cjs → chunk-M5QY464F.cjs} +21 -21
- package/dist/{chunk-HDPJNNMF.cjs.map → chunk-M5QY464F.cjs.map} +1 -1
- package/dist/{chunk-DZ4IOP3Q.js → chunk-MVXZP6VB.js} +281 -3
- package/dist/chunk-MVXZP6VB.js.map +1 -0
- package/dist/{chunk-Y4GCJJPF.cjs → chunk-NYZQOIXJ.cjs} +35 -2
- package/dist/chunk-NYZQOIXJ.cjs.map +1 -0
- package/dist/{chunk-KB2SQAR3.js → chunk-OFQ6CU6S.js} +3 -3
- package/dist/{chunk-KB2SQAR3.js.map → chunk-OFQ6CU6S.js.map} +1 -1
- package/dist/{chunk-36VWLB4J.js → chunk-OXBU5AGH.js} +3 -3
- package/dist/{chunk-36VWLB4J.js.map → chunk-OXBU5AGH.js.map} +1 -1
- package/dist/{chunk-CHTZZRAL.cjs → chunk-OXTF4Y3P.cjs} +6 -6
- package/dist/{chunk-CHTZZRAL.cjs.map → chunk-OXTF4Y3P.cjs.map} +1 -1
- package/dist/{chunk-3AYM47GW.js → chunk-PAUWEWTY.js} +99 -9
- package/dist/chunk-PAUWEWTY.js.map +1 -0
- package/dist/{chunk-FHGRKQVZ.cjs → chunk-PGDR7CO3.cjs} +8 -8
- package/dist/{chunk-FHGRKQVZ.cjs.map → chunk-PGDR7CO3.cjs.map} +1 -1
- package/dist/{chunk-W6VJAUGM.cjs → chunk-PJAJCFLP.cjs} +94 -37
- package/dist/chunk-PJAJCFLP.cjs.map +1 -0
- package/dist/{chunk-IYSOVS7O.js → chunk-RVQW623D.js} +31 -13
- package/dist/chunk-RVQW623D.js.map +1 -0
- package/dist/{chunk-TPQJKS7D.js → chunk-SCDE676D.js} +21 -7
- package/dist/{chunk-CHS2SIP6.cjs.map → chunk-SCDE676D.js.map} +1 -1
- package/dist/chunk-SW5ZD7BO.js +143 -0
- package/dist/chunk-SW5ZD7BO.js.map +1 -0
- package/dist/{chunk-T2OVDF2M.cjs → chunk-T4GIHHXY.cjs} +6 -6
- package/dist/{chunk-T2OVDF2M.cjs.map → chunk-T4GIHHXY.cjs.map} +1 -1
- package/dist/{chunk-QYU7J5EQ.js → chunk-V6OXSXIX.js} +29 -18
- package/dist/chunk-V6OXSXIX.js.map +1 -0
- package/dist/{chunk-W7KHHNZR.js → chunk-VBP4DH37.js} +61 -9
- package/dist/chunk-VBP4DH37.js.map +1 -0
- package/dist/{chunk-67CMMTLN.cjs → chunk-WZG6GZIL.cjs} +4 -4
- package/dist/{chunk-67CMMTLN.cjs.map → chunk-WZG6GZIL.cjs.map} +1 -1
- package/dist/{chunk-O4RPXBDZ.cjs → chunk-X2YHKP4D.cjs} +8 -8
- package/dist/{chunk-O4RPXBDZ.cjs.map → chunk-X2YHKP4D.cjs.map} +1 -1
- package/dist/{chunk-OBOOHG3N.js → chunk-XEPKONJC.js} +3 -3
- package/dist/{chunk-OBOOHG3N.js.map → chunk-XEPKONJC.js.map} +1 -1
- package/dist/{chunk-O7RZRUMZ.js → chunk-XJWED257.js} +14 -309
- package/dist/chunk-XJWED257.js.map +1 -0
- package/dist/chunk-XSSLNINL.js +346 -0
- package/dist/chunk-XSSLNINL.js.map +1 -0
- package/dist/{chunk-4IUE2JB7.js → chunk-Z77M7Q2R.js} +3 -3
- package/dist/{chunk-4IUE2JB7.js.map → chunk-Z77M7Q2R.js.map} +1 -1
- package/dist/entries/apps.cjs +42 -42
- package/dist/entries/apps.js +7 -7
- package/dist/entries/captions.d.cts +1 -1
- package/dist/entries/captions.d.ts +1 -1
- package/dist/entries/credits.cjs +230 -214
- package/dist/entries/credits.d.cts +51 -14
- package/dist/entries/credits.d.ts +51 -14
- package/dist/entries/credits.js +10 -10
- package/dist/entries/entities.cjs +202 -193
- package/dist/entries/entities.d.cts +44 -9
- package/dist/entries/entities.d.ts +44 -9
- package/dist/entries/entities.js +2 -1
- package/dist/entries/llm-models.cjs +86 -62
- package/dist/entries/llm-models.d.cts +46 -15
- package/dist/entries/llm-models.d.ts +46 -15
- package/dist/entries/llm-models.js +2 -2
- package/dist/entries/media.cjs +79 -63
- package/dist/entries/media.d.cts +154 -1
- package/dist/entries/media.d.ts +154 -1
- package/dist/entries/media.js +1 -1
- package/dist/entries/model-catalog.cjs +175 -119
- package/dist/entries/model-catalog.d.cts +4 -54
- package/dist/entries/model-catalog.d.ts +4 -54
- package/dist/entries/model-catalog.js +4 -4
- package/dist/entries/models.cjs +503 -358
- package/dist/entries/models.d.cts +86 -7
- package/dist/entries/models.d.ts +86 -7
- package/dist/entries/models.js +6 -5
- package/dist/entries/nodes.cjs +212 -212
- package/dist/entries/nodes.d.cts +1 -1
- package/dist/entries/nodes.d.ts +1 -1
- package/dist/entries/nodes.js +8 -8
- package/dist/entries/pipeline.cjs +153 -153
- package/dist/entries/pipeline.d.cts +3 -3
- package/dist/entries/pipeline.d.ts +3 -3
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/social.cjs +177 -177
- 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 +174 -145
- package/dist/entries/video.d.cts +119 -2
- package/dist/entries/video.d.ts +119 -2
- package/dist/entries/video.js +7 -6
- package/dist/entries/workflow.d.cts +1 -1
- package/dist/entries/workflow.d.ts +1 -1
- package/dist/index.cjs +2086 -1793
- package/dist/index.d.cts +10 -9
- package/dist/index.d.ts +10 -9
- package/dist/index.js +24 -23
- package/dist/{model-catalog-Cf9fkEUp.d.ts → model-catalog-B-aQnUS8.d.cts} +186 -2
- package/dist/{model-catalog-Cf9fkEUp.d.cts → model-catalog-B-aQnUS8.d.ts} +186 -2
- package/dist/{model-constants-C_Nyft_i.d.cts → model-constants-BstsUup6.d.cts} +105 -6
- package/dist/{model-constants-BxjiWVQ9.d.ts → model-constants-DZ3tPGFO.d.ts} +105 -6
- package/dist/tts-capabilities-BJ4N8MIB.d.ts +133 -0
- package/dist/tts-capabilities-Cf_4nu1Z.d.cts +133 -0
- package/package.json +1 -1
- package/src/__tests__/dialogue-capabilities.test.ts +167 -6
- package/src/__tests__/extend-providers.test.ts +87 -0
- package/src/__tests__/flux-3-klein.test.ts +51 -3
- package/src/__tests__/image-run-limit.test.ts +96 -0
- package/src/__tests__/kling4-catalog.test.ts +1 -1
- package/src/__tests__/llm-models.test.ts +41 -4
- package/src/__tests__/seedream-5-5.test.ts +17 -0
- package/src/__tests__/speech-pricing.test.ts +62 -1
- package/src/__tests__/tts-capabilities.test.ts +160 -4
- package/src/__tests__/video-analysis-pricing.test.ts +13 -1
- package/src/__tests__/video-subjects.test.ts +209 -0
- package/src/__tests__/wired-character-names.test.ts +142 -0
- package/src/credit-estimators/index.ts +4 -0
- package/src/credit-estimators/speech.ts +57 -9
- package/src/credit-identifiers.ts +48 -13
- package/src/dialogue-capabilities.ts +220 -3
- package/src/dubbing-structure.ts +186 -0
- package/src/entries/entities.ts +2 -0
- package/src/entries/llm-models.ts +7 -0
- package/src/entries/media.ts +3 -1
- package/src/entries/model-catalog.ts +17 -0
- package/src/entries/models.ts +43 -0
- package/src/entries/video.ts +8 -1
- package/src/gemini-tts.ts +144 -0
- package/src/llm-models.ts +71 -21
- package/src/model-catalog.ts +283 -2
- package/src/model-constants.ts +167 -8
- package/src/tts-capabilities.ts +193 -1
- package/src/video-analysis-pricing.ts +11 -0
- package/src/video-character-refs.ts +165 -3
- package/src/wired-character-names.ts +134 -18
- package/src/wired-character-video-subjects.ts +63 -0
- package/dist/chunk-3AYM47GW.js.map +0 -1
- package/dist/chunk-5OBTGNUQ.cjs.map +0 -1
- package/dist/chunk-6YIV37V7.js +0 -31
- package/dist/chunk-6YIV37V7.js.map +0 -1
- package/dist/chunk-7AJGUI7L.cjs.map +0 -1
- package/dist/chunk-ACZZHHFZ.cjs.map +0 -1
- package/dist/chunk-AZNZ5WNZ.cjs.map +0 -1
- package/dist/chunk-DZ4IOP3Q.js.map +0 -1
- package/dist/chunk-IYSOVS7O.js.map +0 -1
- package/dist/chunk-KHH54GRP.cjs.map +0 -1
- package/dist/chunk-NIAFR5EE.js.map +0 -1
- package/dist/chunk-O7RZRUMZ.js.map +0 -1
- package/dist/chunk-QYU7J5EQ.js.map +0 -1
- package/dist/chunk-S3UGLZSF.js +0 -42
- package/dist/chunk-S3UGLZSF.js.map +0 -1
- package/dist/chunk-TPQJKS7D.js.map +0 -1
- package/dist/chunk-TQW3R44P.cjs +0 -38
- package/dist/chunk-TQW3R44P.cjs.map +0 -1
- package/dist/chunk-VZ6TE23U.cjs +0 -54
- package/dist/chunk-VZ6TE23U.cjs.map +0 -1
- package/dist/chunk-W6VJAUGM.cjs.map +0 -1
- package/dist/chunk-W7KHHNZR.js.map +0 -1
- package/dist/chunk-Y4GCJJPF.cjs.map +0 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { ttsVoiceForModel, ttsDirectionFor, ttsTakesReplica, replicaOf, ttsReplicaProblem, ttsDirectionProblem } from './chunk-SW5ZD7BO.js';
|
|
2
|
+
import { DEFAULT_DIALOGUE_PROVIDER, TTS_OUTPUT_FORMATS, DEFAULT_TTS_OUTPUT_FORMAT } from './chunk-VBP4DH37.js';
|
|
3
|
+
import { MODEL_CATALOG } from './chunk-MVXZP6VB.js';
|
|
4
|
+
|
|
5
|
+
// src/dialogue-capabilities.ts
|
|
6
|
+
function findDialogueCapabilities(provider) {
|
|
7
|
+
if (typeof provider !== "string" || !provider) return void 0;
|
|
8
|
+
if (!Object.hasOwn(MODEL_CATALOG, provider)) return void 0;
|
|
9
|
+
const entry = MODEL_CATALOG[provider];
|
|
10
|
+
return entry.modes.includes("dialogue") ? entry.tts : void 0;
|
|
11
|
+
}
|
|
12
|
+
function dialogueProviderOf(provider) {
|
|
13
|
+
return findDialogueCapabilities(provider) ? provider : DEFAULT_DIALOGUE_PROVIDER;
|
|
14
|
+
}
|
|
15
|
+
function getDialogueCapabilities(provider) {
|
|
16
|
+
return MODEL_CATALOG[dialogueProviderOf(provider)].tts;
|
|
17
|
+
}
|
|
18
|
+
function dialogueHasLever(provider, lever) {
|
|
19
|
+
return getDialogueCapabilities(provider).levers.includes(lever);
|
|
20
|
+
}
|
|
21
|
+
function dialogueSupportsTimestamps(provider) {
|
|
22
|
+
return getDialogueCapabilities(provider).timestamps;
|
|
23
|
+
}
|
|
24
|
+
function dialogueStabilityAccepted(provider, value) {
|
|
25
|
+
if (!Number.isFinite(value) || value < 0 || value > 1) return false;
|
|
26
|
+
const steps = getDialogueCapabilities(provider).stabilitySteps;
|
|
27
|
+
return steps ? steps.includes(value) : true;
|
|
28
|
+
}
|
|
29
|
+
var ELEVENLABS_DIALOGUE_MAX_VOICES = 10;
|
|
30
|
+
function dialogueMaxSpeakers(provider) {
|
|
31
|
+
return getDialogueCapabilities(provider).dialogueSpeakers ?? ELEVENLABS_DIALOGUE_MAX_VOICES;
|
|
32
|
+
}
|
|
33
|
+
function dialogueTakesFillerWords(provider) {
|
|
34
|
+
return getDialogueCapabilities(provider).fillerWords === true;
|
|
35
|
+
}
|
|
36
|
+
function dialogueVoicesForModel(provider, voices, speakers) {
|
|
37
|
+
const sheet = getDialogueCapabilities(provider);
|
|
38
|
+
const id = dialogueProviderOf(provider);
|
|
39
|
+
const named = sheet.voices;
|
|
40
|
+
if (!named) return voices.map((v) => ttsVoiceForModel(id, v) ?? "");
|
|
41
|
+
const clones = dialogueReplicaVoices(id, speakers);
|
|
42
|
+
const own = (v) => typeof v === "string" && (named.some((n) => n.id === v) || clones.has(v));
|
|
43
|
+
const used = new Set(voices.filter(own));
|
|
44
|
+
const pool = [sheet.defaultVoice, ...named.map((n) => n.id)].filter((v) => typeof v === "string");
|
|
45
|
+
const moved = /* @__PURE__ */ new Map();
|
|
46
|
+
return voices.map((v) => {
|
|
47
|
+
if (own(v)) return v;
|
|
48
|
+
const key = typeof v === "string" ? v : "";
|
|
49
|
+
const kept = moved.get(key);
|
|
50
|
+
if (kept !== void 0) return kept;
|
|
51
|
+
const next = pool.find((p) => !used.has(p)) ?? sheet.defaultVoice ?? named[0].id;
|
|
52
|
+
used.add(next);
|
|
53
|
+
moved.set(key, next);
|
|
54
|
+
return next;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function dialogueLineStyleMaxChars(provider) {
|
|
58
|
+
const d = getDialogueCapabilities(provider).direction;
|
|
59
|
+
return d && d.styles === void 0 ? d.styleMaxChars : void 0;
|
|
60
|
+
}
|
|
61
|
+
function dialogueLineStyleFor(provider, value) {
|
|
62
|
+
const max = dialogueLineStyleMaxChars(provider);
|
|
63
|
+
if (max === void 0 || typeof value !== "string") return void 0;
|
|
64
|
+
const trimmed = value.trim();
|
|
65
|
+
return trimmed && trimmed.length <= max ? trimmed : void 0;
|
|
66
|
+
}
|
|
67
|
+
function dialogueTakesSpeakerDirection(provider) {
|
|
68
|
+
const d = getDialogueCapabilities(provider).direction;
|
|
69
|
+
return d !== void 0 && (d.styles !== void 0 || d.paces !== void 0 || d.accents !== void 0 || d.audioProfileMaxChars !== void 0);
|
|
70
|
+
}
|
|
71
|
+
function dialogueSpeakerDirectionFor(provider, values) {
|
|
72
|
+
return dialogueTakesSpeakerDirection(provider) ? ttsDirectionFor(dialogueProviderOf(provider), values) : {};
|
|
73
|
+
}
|
|
74
|
+
function dialogueOutputFormats(provider) {
|
|
75
|
+
return getDialogueCapabilities(provider).dialogueAnyOutputFormat ? TTS_OUTPUT_FORMATS : [DEFAULT_TTS_OUTPUT_FORMAT];
|
|
76
|
+
}
|
|
77
|
+
function dialogueOutputFormatFor(provider, value) {
|
|
78
|
+
return typeof value === "string" && dialogueOutputFormats(provider).includes(value) ? value : void 0;
|
|
79
|
+
}
|
|
80
|
+
function dialogueReplicaVoices(provider, speakers) {
|
|
81
|
+
const id = dialogueProviderOf(provider);
|
|
82
|
+
if (!ttsTakesReplica(id) || !Array.isArray(speakers)) return /* @__PURE__ */ new Set();
|
|
83
|
+
const out = /* @__PURE__ */ new Set();
|
|
84
|
+
for (const entry of speakers) {
|
|
85
|
+
const s = entry;
|
|
86
|
+
if (s && typeof s.voice === "string" && s.voice && replicaOf(s.replica)) out.add(s.voice);
|
|
87
|
+
}
|
|
88
|
+
return out;
|
|
89
|
+
}
|
|
90
|
+
function dialogueReplicaOf(provider, speakers, voice) {
|
|
91
|
+
if (!dialogueReplicaVoices(provider, speakers).has(voice) || !Array.isArray(speakers)) return void 0;
|
|
92
|
+
const entry = speakers.find((s) => s?.voice === voice);
|
|
93
|
+
return replicaOf(entry?.replica);
|
|
94
|
+
}
|
|
95
|
+
function dialogueVoicesOf(lines) {
|
|
96
|
+
if (!Array.isArray(lines)) return [];
|
|
97
|
+
const out = [];
|
|
98
|
+
for (const line of lines) {
|
|
99
|
+
const voice = line?.voice;
|
|
100
|
+
if (typeof voice === "string" && !out.includes(voice)) out.push(voice);
|
|
101
|
+
}
|
|
102
|
+
return out;
|
|
103
|
+
}
|
|
104
|
+
function dialogueProblem(provider, request) {
|
|
105
|
+
const id = dialogueProviderOf(provider);
|
|
106
|
+
const sheet = getDialogueCapabilities(id);
|
|
107
|
+
const lines = Array.isArray(request.dialogue) ? request.dialogue : [];
|
|
108
|
+
if (Array.isArray(request.speakers)) {
|
|
109
|
+
const seen = /* @__PURE__ */ new Set();
|
|
110
|
+
for (let i = 0; i < request.speakers.length; i++) {
|
|
111
|
+
const voice = request.speakers[i]?.voice;
|
|
112
|
+
if (typeof voice !== "string") continue;
|
|
113
|
+
if (seen.has(voice)) return { path: ["speakers", i, "voice"], message: `speakers lists the voice "${voice}" more than once; give each speaker one entry` };
|
|
114
|
+
seen.add(voice);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const voices = dialogueVoicesOf(lines);
|
|
118
|
+
const max = dialogueMaxSpeakers(id);
|
|
119
|
+
if (voices.length > max) {
|
|
120
|
+
return { path: ["dialogue"], message: `A dialogue can use at most ${max} unique voices \u2014 reuse voices across lines or split the script into two nodes` };
|
|
121
|
+
}
|
|
122
|
+
if (Array.isArray(request.speakers)) {
|
|
123
|
+
for (let i = 0; i < request.speakers.length; i++) {
|
|
124
|
+
const replica = request.speakers[i]?.replica;
|
|
125
|
+
const problem = ttsReplicaProblem(id, replica);
|
|
126
|
+
if (problem) return { path: ["speakers", i, "replica"], message: problem };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const clones = dialogueReplicaVoices(id, request.speakers);
|
|
130
|
+
const named = sheet.voices;
|
|
131
|
+
if (named) {
|
|
132
|
+
for (let i = 0; i < lines.length; i++) {
|
|
133
|
+
const voice = lines[i]?.voice;
|
|
134
|
+
if (typeof voice === "string" && !clones.has(voice) && !named.some((v) => v.id === voice)) {
|
|
135
|
+
return { path: ["dialogue", i, "voice"], message: `${voice} is not a voice of ${id}. Its voices: ${named.map((v) => v.id).join(", ")}` };
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const styleMax = dialogueLineStyleMaxChars(id);
|
|
140
|
+
if (styleMax !== void 0) {
|
|
141
|
+
for (let i = 0; i < lines.length; i++) {
|
|
142
|
+
const style = lines[i]?.styleDirection;
|
|
143
|
+
if (style === void 0) continue;
|
|
144
|
+
if (typeof style !== "string") return { path: ["dialogue", i, "styleDirection"], message: "styleDirection must be a string" };
|
|
145
|
+
if (style.trim().length > styleMax) return { path: ["dialogue", i, "styleDirection"], message: `styleDirection must be at most ${styleMax} characters` };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (request.outputFormat !== void 0 && dialogueOutputFormatFor(id, request.outputFormat) === void 0) {
|
|
149
|
+
return { path: ["outputFormat"], message: `outputFormat on ${id} must be one of: ${dialogueOutputFormats(id).join(", ")}` };
|
|
150
|
+
}
|
|
151
|
+
if (dialogueTakesSpeakerDirection(id) && Array.isArray(request.speakers)) {
|
|
152
|
+
for (let i = 0; i < request.speakers.length; i++) {
|
|
153
|
+
const speaker = request.speakers[i];
|
|
154
|
+
if (!speaker || typeof speaker !== "object") continue;
|
|
155
|
+
const problem = ttsDirectionProblem(id, speaker);
|
|
156
|
+
if (problem) return { path: ["speakers", i, problem.field], message: problem.message };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return void 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export { ELEVENLABS_DIALOGUE_MAX_VOICES, dialogueHasLever, dialogueLineStyleFor, dialogueLineStyleMaxChars, dialogueMaxSpeakers, dialogueOutputFormatFor, dialogueOutputFormats, dialogueProblem, dialogueProviderOf, dialogueReplicaOf, dialogueReplicaVoices, dialogueSpeakerDirectionFor, dialogueStabilityAccepted, dialogueSupportsTimestamps, dialogueTakesFillerWords, dialogueTakesSpeakerDirection, dialogueVoicesForModel, dialogueVoicesOf, findDialogueCapabilities, getDialogueCapabilities };
|
|
163
|
+
//# sourceMappingURL=chunk-3YWZ5SOZ.js.map
|
|
164
|
+
//# sourceMappingURL=chunk-3YWZ5SOZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dialogue-capabilities.ts"],"names":[],"mappings":";;;;;AAiBO,SAAS,yBAAyB,QAAA,EAAgD;AACvF,EAAA,IAAI,OAAO,QAAA,KAAa,QAAA,IAAY,CAAC,UAAU,OAAO,MAAA;AACtD,EAAA,IAAI,CAAC,MAAA,CAAO,MAAA,CAAO,aAAA,EAAe,QAAQ,GAAG,OAAO,MAAA;AACpD,EAAA,MAAM,KAAA,GAAQ,cAAc,QAAQ,CAAA;AACpC,EAAA,OAAO,MAAM,K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,CAAE,IAAA,CAAK,IAAI,CAAC,CAAA,CAAA,EAAG;AAAA,EAC5H;AACA,EAAA,IAAI,8BAA8B,EAAE,CAAA,IAAK,MAAM,OAAA,CAAQ,OAAA,CAAQ,QAAQ,CAAA,EAAG;AACxE,IAAA,KAAA,IAAS,IAAI,CAAA,EAAG,CAAA,GAAI,OAAA,CAAQ,QAAA,CAAS,QAAQ,CAAA,EAAA,EAAK;AAChD,MAAA,MAAM,OAAA,GAAU,OAAA,CAAQ,QAAA,CAAS,CAAC,CAAA;AAClC,MAAA,IAAI,CAAC,OAAA,IAAW,OAAO,OAAA,KAAY,QAAA,EAAU;AAC7C,MAAA,MAAM,OAAA,GAAU,mBAAA,CAAoB,EAAA,EAAI,OAAkC,CAAA;AAC1E,MAAA,IAAI,OAAA,EAAS,OAAO,EAAE,IAAA,EAAM,CAAC,UAAA,EAAY,CAAA,EAAG,OAAA,CAAQ,KAAK,CAAA,EAAG,OAAA,EAAS,OAAA,CAAQ,OAAA,EAAQ;AAAA,IACvF;AAAA,EACF;AACA,EAAA,OAAO,MAAA;AACT","file":"chunk-3YWZ5SOZ.js","sourcesContent":["/**\n * Capability lookups for the DIALOGUE lane (`/v1/text-to-dialogue`, the Text to\n * Dialogue node, the voiced-video multi-speaker track).\n *\n * The dialogue models carry a `tts` sheet in `MODEL_CATALOG` like the\n * text-to-speech models, but each lane answers only for its own models: the\n * text-to-speech lookups (`tts-capabilities.ts`) treat a dialogue-only id as\n * unknown, and these treat a text-to-speech-only id as unknown (a model in both\n * lanes — Gemini — has one sheet, read by either). An unknown id here runs as\n * {@link DEFAULT_DIALOGUE_PROVIDER} (v3 dialogue) — not as the text-to-speech\n * fallback (turbo), which has no dialogue form.\n */\nimport { MODEL_CATALOG, type TtsCapabilities, type TtsSettingLever } from \"./model-catalog.js\"\nimport { DEFAULT_DIALOGUE_PROVIDER, DEFAULT_TTS_OUTPUT_FORMAT, TTS_OUTPUT_FORMATS, type DialogueProvider, type TtsOutputFormat } from \"./model-constants.js\"\nimport { replicaOf, ttsDirectionFor, ttsDirectionProblem, ttsReplicaProblem, ttsTakesReplica, ttsVoiceForModel, type TtsDirectionValues } from \"./tts-capabilities.js\"\n\n/** The sheet of a dialogue model, or `undefined` when the id is not one. Own properties only; a non-string is unknown. */\nexport function findDialogueCapabilities(provider: unknown): TtsCapabilities | undefined {\n if (typeof provider !== \"string\" || !provider) return undefined\n if (!Object.hasOwn(MODEL_CATALOG, provider)) return undefined\n const entry = MODEL_CATALOG[provider]!\n return entry.modes.includes(\"dialogue\") ? entry.tts : undefined\n}\n\n/** The dialogue model a request naming `provider` runs on (and is billed as). */\nexport function dialogueProviderOf(provider: unknown): DialogueProvider {\n return findDialogueCapabilities(provider) ? (provider as DialogueProvider) : DEFAULT_DIALOGUE_PROVIDER\n}\n\n/** The sheet a dialogue request runs under. */\nexport function getDialogueCapabilities(provider: unknown): TtsCapabilities {\n return MODEL_CATALOG[dialogueProviderOf(provider)]!.tts!\n}\n\n/** The dialogue model honours this voice-setting lever. */\nexport function dialogueHasLever(provider: unknown, lever: TtsSettingLever): boolean {\n return getDialogueCapabilities(provider).levers.includes(lever)\n}\n\n/** The dialogue model answers `/v1/text-to-dialogue/with-timestamps` (character timings + per-line voice segments). */\nexport function dialogueSupportsTimestamps(provider: unknown): boolean {\n return getDialogueCapabilities(provider).timestamps\n}\n\n/** `value` is a stability this platform accepts for the dialogue model: one of its steps, or any finite 0–1 when it has none. */\nexport function dialogueStabilityAccepted(provider: unknown, value: number): boolean {\n if (!Number.isFinite(value) || value < 0 || value > 1) return false\n const steps = getDialogueCapabilities(provider).stabilitySteps\n return steps ? steps.includes(value) : true\n}\n\n/** The ElevenLabs dialogue lane's own limit on distinct voices in one script (probed 2026-08-30: an 11th → 400). */\nexport const ELEVENLABS_DIALOGUE_MAX_VOICES = 10\n\n/** The most speakers (distinct voices) one script on the dialogue model may have: its sheet's, else the ElevenLabs limit. */\nexport function dialogueMaxSpeakers(provider: unknown): number {\n return getDialogueCapabilities(provider).dialogueSpeakers ?? ELEVENLABS_DIALOGUE_MAX_VOICES\n}\n\n/** The dialogue model adds filler words between two speakers on request (`TtsCapabilities.fillerWords`). */\nexport function dialogueTakesFillerWords(provider: unknown): boolean {\n return getDialogueCapabilities(provider).fillerWords === true\n}\n\n/**\n * Each line's voice on the dialogue model, when the model and the voices may\n * have been chosen apart (a published app's Model card, a field mapping, the\n * editor's model switch): the text-to-speech lane's `ttsVoiceForModel` rule,\n * per speaker. A voice the model speaks stays. On a model with named voices\n * (Gemini) every other voice moves onto one of its voices that the script does\n * not use yet, its default first — so two speakers are never merged into one\n * voice by the move. On an ElevenLabs model a voice only a named-voice model\n * speaks becomes \"\" (the deployment's default voice). Returns the voices in\n * line order.\n */\nexport function dialogueVoicesForModel(provider: unknown, voices: readonly unknown[], speakers?: unknown): string[] {\n const sheet = getDialogueCapabilities(provider)\n const id = dialogueProviderOf(provider)\n const named = sheet.voices\n if (!named) return voices.map((v) => ttsVoiceForModel(id, v) ?? \"\")\n // A speaker cloned for this request (`replica`) is the model's own voice too, on a model that clones;\n // on any other model it is a foreign voice and moves (decided 2026-11-13: one rule, `dialogueReplicaVoices`).\n const clones = dialogueReplicaVoices(id, speakers)\n const own = (v: unknown): v is string => typeof v === \"string\" && (named.some((n) => n.id === v) || clones.has(v))\n const used = new Set(voices.filter(own))\n const pool = [sheet.defaultVoice, ...named.map((n) => n.id)].filter((v): v is string => typeof v === \"string\")\n const moved = new Map<string, string>()\n return voices.map((v) => {\n if (own(v)) return v\n const key = typeof v === \"string\" ? v : \"\"\n const kept = moved.get(key)\n if (kept !== undefined) return kept\n const next = pool.find((p) => !used.has(p)) ?? sheet.defaultVoice ?? named[0]!.id\n used.add(next)\n moved.set(key, next)\n return next\n })\n}\n\n/**\n * The most characters of the free-text style ONE LINE takes on the dialogue\n * model (Gemini 3.8: `direction.styleMaxChars`, a style per turn), or\n * undefined on a model whose style is a speaker's choice (3.1 / 2.5) or that\n * takes none (ElevenLabs).\n */\nexport function dialogueLineStyleMaxChars(provider: unknown): number | undefined {\n const d = getDialogueCapabilities(provider).direction\n return d && d.styles === undefined ? d.styleMaxChars : undefined\n}\n\n/** A line's style as the dialogue model is sent it: trimmed, when the model takes one per line and it fits; else undefined. */\nexport function dialogueLineStyleFor(provider: unknown, value: unknown): string | undefined {\n const max = dialogueLineStyleMaxChars(provider)\n if (max === undefined || typeof value !== \"string\") return undefined\n const trimmed = value.trim()\n return trimmed && trimmed.length <= max ? trimmed : undefined\n}\n\n/** Whether the dialogue model takes direction per SPEAKER (Gemini 3.1 / 2.5: a style, pace, accent and audio profile per voice). */\nexport function dialogueTakesSpeakerDirection(provider: unknown): boolean {\n const d = getDialogueCapabilities(provider).direction\n return d !== undefined && (d.styles !== undefined || d.paces !== undefined || d.accents !== undefined || d.audioProfileMaxChars !== undefined)\n}\n\n/** One speaker's direction as the dialogue model is sent it (`ttsDirectionFor`), or {} on a model that takes none per speaker. */\nexport function dialogueSpeakerDirectionFor(provider: unknown, values: Readonly<Record<string, unknown>>): TtsDirectionValues {\n return dialogueTakesSpeakerDirection(provider) ? ttsDirectionFor(dialogueProviderOf(provider), values) : {}\n}\n\n/**\n * The files the dialogue model delivers: every speech file format on a model\n * that renders a WAV the platform keeps or encodes (Gemini,\n * `dialogueAnyOutputFormat`); the default MP3 only on the ElevenLabs dialogue\n * models, as the platform calls them.\n */\nexport function dialogueOutputFormats(provider: unknown): readonly TtsOutputFormat[] {\n return getDialogueCapabilities(provider).dialogueAnyOutputFormat ? TTS_OUTPUT_FORMATS : [DEFAULT_TTS_OUTPUT_FORMAT]\n}\n\n/** The file a dialogue request on `provider` asks for, when it is one the model delivers; else undefined (the default MP3). */\nexport function dialogueOutputFormatFor(provider: unknown, value: unknown): TtsOutputFormat | undefined {\n return typeof value === \"string\" && (dialogueOutputFormats(provider) as readonly string[]).includes(value) ? (value as TtsOutputFormat) : undefined\n}\n\n/** A dialogue request as every lane reads it (the route's body, a node's data, the MCP verb's args mapped). */\nexport interface DialogueRequestShape {\n readonly dialogue?: unknown\n readonly speakers?: unknown\n /** The file asked for; judged against `dialogueOutputFormats` when given. */\n readonly outputFormat?: unknown\n}\n\n/** Why a dialogue request cannot run on its model: where, and the sentence a caller is answered with. */\nexport interface DialogueProblem {\n readonly path: ReadonlyArray<string | number>\n readonly message: string\n}\n\n/**\n * The speakers a dialogue clones for this request: the voice labels whose\n * `speakers` entry carries a `replica` (two https links), on a model that\n * clones (`TtsCapabilities.replica`); none on any other. The ONE predicate\n * every dialogue seam reads — the voice move, the check, the worker — so a\n * cloned speaker is kept on a model that clones and never silently voiced by\n * a stock voice in its place.\n */\nexport function dialogueReplicaVoices(provider: unknown, speakers: unknown): Set<string> {\n const id = dialogueProviderOf(provider)\n if (!ttsTakesReplica(id) || !Array.isArray(speakers)) return new Set()\n const out = new Set<string>()\n for (const entry of speakers) {\n const s = entry as { voice?: unknown; replica?: unknown } | null\n if (s && typeof s.voice === \"string\" && s.voice && replicaOf(s.replica)) out.add(s.voice)\n }\n return out\n}\n\n/** A cloned speaker's recordings in a dialogue request, by voice label (`dialogueReplicaVoices`' speakers). */\nexport function dialogueReplicaOf(provider: unknown, speakers: unknown, voice: string): ReturnType<typeof replicaOf> {\n if (!dialogueReplicaVoices(provider, speakers).has(voice) || !Array.isArray(speakers)) return undefined\n const entry = speakers.find((s) => (s as { voice?: unknown } | null)?.voice === voice) as { replica?: unknown } | undefined\n return replicaOf(entry?.replica)\n}\n\n/** The distinct voices of a script, in the order they first speak. */\nexport function dialogueVoicesOf(lines: unknown): string[] {\n if (!Array.isArray(lines)) return []\n const out: string[] = []\n for (const line of lines) {\n const voice = (line as { voice?: unknown } | null)?.voice\n if (typeof voice === \"string\" && !out.includes(voice)) out.push(voice)\n }\n return out\n}\n\n/**\n * The first reason a dialogue request cannot run on `provider`, or undefined.\n * The ONE rule the route's schema, the workflow engine and the MCP verb read,\n * so a script is refused the same way at every door and before any hold:\n * at most `dialogueMaxSpeakers` distinct voices; on a model with named voices\n * (Gemini) every voice one of them; a line's style within what the model takes\n * per line; each speaker's direction within what the model takes per speaker.\n * A field the model does not take is never sent, so it is no problem (as on\n * one speaker: `ttsDirectionProblem`). The script's length is the caller's to\n * judge (`dialogueTextBeforeCap`, @nodaro/prompts).\n */\nexport function dialogueProblem(provider: unknown, request: DialogueRequestShape): DialogueProblem | undefined {\n const id = dialogueProviderOf(provider)\n const sheet = getDialogueCapabilities(id)\n const lines = Array.isArray(request.dialogue) ? request.dialogue : []\n // One entry per speaker: two entries for one voice would leave which one applies to chance.\n if (Array.isArray(request.speakers)) {\n const seen = new Set<string>()\n for (let i = 0; i < request.speakers.length; i++) {\n const voice = (request.speakers[i] as { voice?: unknown } | null)?.voice\n if (typeof voice !== \"string\") continue\n if (seen.has(voice)) return { path: [\"speakers\", i, \"voice\"], message: `speakers lists the voice \"${voice}\" more than once; give each speaker one entry` }\n seen.add(voice)\n }\n }\n const voices = dialogueVoicesOf(lines)\n const max = dialogueMaxSpeakers(id)\n if (voices.length > max) {\n return { path: [\"dialogue\"], message: `A dialogue can use at most ${max} unique voices — reuse voices across lines or split the script into two nodes` }\n }\n // A one-off clone (`replica`) on a speaker: refused on a model that does not clone, never dropped.\n if (Array.isArray(request.speakers)) {\n for (let i = 0; i < request.speakers.length; i++) {\n const replica = (request.speakers[i] as { replica?: unknown } | null)?.replica\n const problem = ttsReplicaProblem(id, replica)\n if (problem) return { path: [\"speakers\", i, \"replica\"], message: problem }\n }\n }\n const clones = dialogueReplicaVoices(id, request.speakers)\n const named = sheet.voices\n if (named) {\n for (let i = 0; i < lines.length; i++) {\n const voice = (lines[i] as { voice?: unknown } | null)?.voice\n if (typeof voice === \"string\" && !clones.has(voice) && !named.some((v) => v.id === voice)) {\n return { path: [\"dialogue\", i, \"voice\"], message: `${voice} is not a voice of ${id}. Its voices: ${named.map((v) => v.id).join(\", \")}` }\n }\n }\n }\n const styleMax = dialogueLineStyleMaxChars(id)\n if (styleMax !== undefined) {\n for (let i = 0; i < lines.length; i++) {\n const style = (lines[i] as { styleDirection?: unknown } | null)?.styleDirection\n if (style === undefined) continue\n if (typeof style !== \"string\") return { path: [\"dialogue\", i, \"styleDirection\"], message: \"styleDirection must be a string\" }\n if (style.trim().length > styleMax) return { path: [\"dialogue\", i, \"styleDirection\"], message: `styleDirection must be at most ${styleMax} characters` }\n }\n }\n if (request.outputFormat !== undefined && dialogueOutputFormatFor(id, request.outputFormat) === undefined) {\n return { path: [\"outputFormat\"], message: `outputFormat on ${id} must be one of: ${dialogueOutputFormats(id).join(\", \")}` }\n }\n if (dialogueTakesSpeakerDirection(id) && Array.isArray(request.speakers)) {\n for (let i = 0; i < request.speakers.length; i++) {\n const speaker = request.speakers[i]\n if (!speaker || typeof speaker !== \"object\") continue\n const problem = ttsDirectionProblem(id, speaker as Record<string, unknown>)\n if (problem) return { path: [\"speakers\", i, problem.field], message: problem.message }\n }\n }\n return undefined\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MODEL_CATALOG, normalizeModelInput } from './chunk-
|
|
1
|
+
import { MODEL_CATALOG, normalizeModelInput } from './chunk-MVXZP6VB.js';
|
|
2
2
|
|
|
3
3
|
// src/image-model-roles.ts
|
|
4
4
|
var IMAGE_MODEL_ROLE_DEFAULTS = {
|
|
@@ -57,5 +57,5 @@ function normalizeVideoUpscaleResolution(provider, targetResolution) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export { IMAGE_MODEL_RATIO_FALLBACKS, IMAGE_MODEL_ROLE_DEFAULTS, VIDEO_UPSCALE_RESOLUTIONS, defaultImageModel, defaultImageModelForNode, imageModelDrawsRatio, normalizeVideoUpscaleResolution, videoUpscaleModelOf, videoUpscaleResolutionsFor };
|
|
60
|
-
//# sourceMappingURL=chunk-
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
60
|
+
//# sourceMappingURL=chunk-5GG4CG4Y.js.map
|
|
61
|
+
//# sourceMappingURL=chunk-5GG4CG4Y.js.map
|
|
@@ -1 +1 @@
|
|
|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GAAa,EAAE,gBAAA,EAAkB,UAAA,CAAW,UAAA,EAAY,YAAW,GAAI,EAAE,gBAAA,EAAkB,UAAA,CAAW,UAAA,EAAW;AAC1H","file":"chunk-5GG4CG4Y.js","sourcesContent":["import { MODEL_CATALOG } from \"./model-catalog.js\"\n\n/**\n * The platform's answer to \"which image model, when the caller names none\".\n *\n * One table by ROLE, so every surface that picks for the user (node defaults,\n * route and workflow fallbacks, MCP tools, studios, pipelines) reads the same\n * model instead of keeping its own literal. Before this table those literals\n * had drifted apart: the Generate Image node started on Nano Banana Pro, the\n * routes fell back to the original Nano Banana, and MCP used Nano Banana 2.1.\n *\n * Decided on 2026-10-08 from a blind five-model comparison, quality\n * first and price second:\n * - characters, general text-to-image and video anchors on GPT Image 2;\n * - edits on the current GPT Image Flare (2.6 since 2026-11-09), which renders\n * at its default Medium when a run names no quality.\n * With reference images attached, GPT Image 2 runs as its i2i sibling (the\n * provider swaps it), so `character` covers identity-from-reference too.\n *\n * Nano Banana Pro is no longer a default. It remains a FALLBACK only: last in\n * the ratio chain below, the GPT-family safety-block retry, and the swimwear\n * dressing model.\n */\nexport const IMAGE_MODEL_ROLE_DEFAULTS = {\n character: \"gpt-image-2\",\n general: \"gpt-image-2\",\n anchor: \"gpt-image-2\",\n edit: \"gpt-image-2-6-flare-i2i\",\n} as const\n\nexport type ImageModelRole = keyof typeof IMAGE_MODEL_ROLE_DEFAULTS\n\n/**\n * Where a role's model goes when it cannot draw the requested aspect ratio.\n * GPT Image 2 draws only auto / 1:1 / 16:9 / 9:16 / 4:3 / 3:4, so 21:9, 3:2,\n * 2:3, 4:5, 5:4 and the other wide or in-between ratios move to GPT Image 2.6\n * Sunburst. GPT Image 2.5 Sunburst stays behind it for the ratios only 2.5\n * draws, and Nano Banana Pro comes last.\n */\nexport const IMAGE_MODEL_RATIO_FALLBACKS: Readonly<Record<ImageModelRole, readonly string[]>> = {\n character: [\"gpt-image-2-6-sunburst\", \"gpt-image-2-5-sunburst\", \"nano-banana-pro\"],\n general: [\"gpt-image-2-6-sunburst\", \"gpt-image-2-5-sunburst\", \"nano-banana-pro\"],\n anchor: [\"gpt-image-2-6-sunburst\", \"gpt-image-2-5-sunburst\", \"nano-banana-pro\"],\n edit: [\"gpt-image-2-6-sunburst-i2i\", \"gpt-image-2-5-sunburst-i2i\", \"nano-banana-pro\"],\n}\n\n/** True when the model's catalog entry lists the ratio (or no ratio was asked for). */\nexport function imageModelDrawsRatio(modelId: string, aspectRatio?: string | null): boolean {\n if (!aspectRatio) return true\n const ratios = MODEL_CATALOG[modelId]?.aspectRatios\n return ratios === undefined || ratios.includes(aspectRatio)\n}\n\n/**\n * The default image model for a role at the requested aspect ratio: the role's\n * model when it draws the ratio, else the first fallback that does, else the\n * role's model (whose own ratio normalization then snaps the ratio). Read from\n * the catalog, so widening a model's documented ratios moves this with it.\n */\nexport function defaultImageModel(role: ImageModelRole, aspectRatio?: string | null): string {\n const primary = IMAGE_MODEL_ROLE_DEFAULTS[role]\n if (imageModelDrawsRatio(primary, aspectRatio)) return primary\n return IMAGE_MODEL_RATIO_FALLBACKS[role].find((id) => imageModelDrawsRatio(id, aspectRatio)) ?? primary\n}\n\n/**\n * The model an image node that names none runs on, by node type: the same\n * default its route and its workflow branch apply. For the node types that\n * have one; undefined for any other.\n */\nexport function defaultImageModelForNode(nodeType: string, aspectRatio?: string | null): string | undefined {\n switch (nodeType) {\n case \"generate-image\":\n return defaultImageModel(\"general\", aspectRatio)\n case \"image-to-image\":\n case \"modify-image\":\n return defaultImageModel(\"edit\", aspectRatio)\n case \"reference-board\":\n return defaultImageModel(\"character\", aspectRatio)\n default:\n return undefined\n }\n}\n","/**\n * The Video Upscale node's target resolution, per provider, from the catalog.\n *\n * The node stores one `targetResolution` for every provider, and the providers\n * take different sets: Topaz 720p / 1080p / 4K (a short side, its own list in\n * `topaz-video.ts`), Nodaro Video Upscale 1080p / 2K / 4K (an output box), the\n * VEO and Seedance HD upscales none. For a provider whose catalog entry\n * declares its resolutions (`resolutions`, `defaultResolution`; today Nodaro\n * Video Upscale), this is the one coercion every lane applies — a node written\n * straight into workflow JSON, a request to the API and an MCP call never pass\n * through the editor's menus: a value it does not take becomes its default. A\n * provider whose entry declares none (Topaz included) is left alone: its run\n * reads the field by its own rules.\n */\nimport { MODEL_CATALOG, normalizeModelInput, type ModelInputAdjustment } from \"./model-catalog.js\"\n\n/**\n * Every target resolution some Video Upscale provider takes — Nodaro Video\n * Upscale's route schema and the MCP verb's enum. Which ones a provider takes:\n * its catalog entry's `resolutions` where it declares them\n * ({@link normalizeVideoUpscaleResolution}), else its own list (Topaz's).\n */\nexport const VIDEO_UPSCALE_RESOLUTIONS = [\"720p\", \"1080p\", \"2k\", \"4k\"] as const\nexport type VideoUpscaleResolution = (typeof VIDEO_UPSCALE_RESOLUTIONS)[number]\n\n/** The provider a Video Upscale node runs when it names none. */\nconst DEFAULT_VIDEO_UPSCALE_PROVIDER = \"topaz\"\n\n/**\n * Video Upscale's `provider` value as the catalog model it runs: its \"topaz\"\n * is the catalog's `topaz-video`; every other value is its own id.\n */\nexport function videoUpscaleModelOf(provider: string): string {\n return provider === \"topaz\" ? \"topaz-video\" : provider\n}\n\n/** The resolutions a Video Upscale provider's catalog entry declares, in its order; empty when it declares none (Topaz keeps its own list). */\nexport function videoUpscaleResolutionsFor(provider: string | undefined): readonly string[] {\n const id = videoUpscaleModelOf(provider || DEFAULT_VIDEO_UPSCALE_PROVIDER)\n return MODEL_CATALOG[id]?.resolutions ?? []\n}\n\nexport interface NormalizedVideoUpscaleResolution {\n /** The value to store and send: the one asked for, its canonical spelling, or the provider's default. */\n readonly targetResolution: string | undefined\n /** What changed, when anything did. */\n readonly adjustment?: ModelInputAdjustment\n}\n\n/**\n * `targetResolution` coerced to one `provider` takes. Unset stays unset (each\n * run applies its own default). A value the provider does not list becomes the\n * provider's `defaultResolution`, a spelling variant (\"2K\") its canonical form.\n * A provider with no resolution setting gets the value back unchanged; a value\n * that is not a string, or an empty one, reads as unset.\n */\nexport function normalizeVideoUpscaleResolution(\n provider: string | undefined,\n targetResolution: unknown,\n): NormalizedVideoUpscaleResolution {\n if (typeof targetResolution !== \"string\" || targetResolution === \"\") return { targetResolution: undefined }\n const id = videoUpscaleModelOf(provider || DEFAULT_VIDEO_UPSCALE_PROVIDER)\n if ((MODEL_CATALOG[id]?.resolutions ?? []).length === 0) return { targetResolution }\n const normalized = normalizeModelInput(id, { resolution: targetResolution })\n const adjustment = normalized.adjustments.find((a) => a.field === \"resolution\")\n return adjustment ? { targetResolution: normalized.resolution, adjustment } : { targetResolution: normalized.resolution }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isGptImage26Tiered, isGptImage26I2i, GPT_IMAGE_2_6_MOODBOARD_MAX_IMAGES } from './chunk-RGNHHIMN.js';
|
|
2
|
-
import { isMinimaxH3Image, isSeedream55, isMinimaxH3ImageI2i, isSeedream55I2i, isFlux3Klein, getModel } from './chunk-
|
|
2
|
+
import { isMinimaxH3Image, isSeedream55, isMinimaxH3ImageI2i, isSeedream55I2i, isFlux3Klein, getModel } from './chunk-MVXZP6VB.js';
|
|
3
3
|
|
|
4
4
|
// src/input-image-pricing.ts
|
|
5
5
|
function isPricedPerInputImage(model) {
|
|
@@ -41,5 +41,5 @@ function safetyRetryPolicy(modelId) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export { isPricedPerInputImage, isPricedPerInputImageEdit, priceReadsInputImages, pricedEstimatedImages, pricedSentImages, safetyRetryPolicy };
|
|
44
|
-
//# sourceMappingURL=chunk-
|
|
45
|
-
//# sourceMappingURL=chunk-
|
|
44
|
+
//# sourceMappingURL=chunk-5IZHECUP.js.map
|
|
45
|
+
//# sourceMappingURL=chunk-5IZHECUP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/input-image-pricing.ts","../src/safety-retry-policy.ts"],"names":[],"mappings":";;;;AAkBO,SAAS,sBAAsB,KAAA,EAAyB;AAC7D,EAAA,OA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S,CAAA,GAAI,CAAA,GAAI,CAAA;AAC5E,EAAA,OACE,MAAA,CAAO,IAAA,CAAK,kBAAkB,CAAA,GAC9B,OAAO,IAAA,CAAK,sBAAsB,CAAA,GAClC,MAAA,CAAO,KAAK,SAAS,CAAA,GACrB,MAAA,CAAO,IAAA,CAAK,iBAAiB,CAAA,GAC7B,MAAA,CAAO,IAAA,CAAK,YAAY,CAAA,GACxB,MAAA,CAAO,IAAA,CAAK,cAAc,IAC1B,WAAA,IACC,cAAA,CAAe,IAAA,CAAK,SAAS,IAAI,kCAAA,GAAqC,CAAA,CAAA,IACtE,yBAAA,CAA0B,KAAK,IAAI,CAAA,GAAI,CAAA,CAAA;AAE5C;;;AClEO,SAAS,kBAAkB,OAAA,EAAoC;AACpE,EAAA,MAAM,KAAA,GAAQ,SAAS,OAAO,CAAA;AAC9B,EAAA,MAAM,eAAe,KAAA,EAAO,YAAA;AAC5B,EAAA,IAAI,CAAC,YAAA,EAAc,UAAA,EAAY,OAAO,EAAE,aAAa,CAAA,EAAE;AAEvD,EAAA,MAAM,WAAW,YAAA,CAAa,QAAA;AAC9B,EAAA,IAAI,QAAA,IAAY,QAAA,CAAS,QAAQ,CAAA,EAAG;AAClC,IAAA,OAAO,EAAE,WAAA,EAAa,CAAA,EAAG,QAAA,EAAS;AAAA,EACpC;AACA,EAAA,OAAO,EAAE,aAAa,CAAA,EAAE;AAC1B","file":"chunk-5IZHECUP.js","sourcesContent":["/**\n * The image models whose price depends on how many input images a run sends:\n * GPT Image 2.6 Flare and Sunburst, MiniMax H3 Image and Seedream 5.5. Every place that\n * prices a run counts those images through here, so a model that joins\n * `isPricedPerInputImage` is counted on every path at once. FLUX 3 Klein is\n * counted the same way (`priceReadsInputImages`): its price does not move with\n * the images, but whether any go decides the id it runs, and is priced, on.\n */\nimport {\n GPT_IMAGE_2_6_MOODBOARD_MAX_IMAGES,\n isGptImage26I2i,\n isGptImage26Tiered,\n} from \"./gpt-image-2-6.js\"\nimport { isMinimaxH3Image, isMinimaxH3ImageI2i } from \"./minimax-h3-image.js\"\nimport { isSeedream55, isSeedream55I2i } from \"./seedream-5-5.js\"\nimport { isFlux3Klein } from \"./flux-3-klein.js\"\n\n/** True for a model whose price counts the input images a run sends. */\nexport function isPricedPerInputImage(model: unknown): boolean {\n return typeof model === \"string\" && (isGptImage26Tiered(model) || isMinimaxH3Image(model) || isSeedream55(model))\n}\n\n/** True for the edit id of such a model: it always sends at least its source. */\nexport function isPricedPerInputImageEdit(model: unknown): boolean {\n return typeof model === \"string\" && (isGptImage26I2i(model) || isMinimaxH3ImageI2i(model) || isSeedream55I2i(model))\n}\n\n/**\n * True for a model whose price id reads the input images a run sends: one\n * priced per input image ({@link isPricedPerInputImage}), or FLUX 3 Klein, which\n * runs on its edit id whenever an image goes (its text-to-image endpoint takes\n * none) and is priced on that id, at the same price. Every place that prices a\n * run counts the images through {@link pricedSentImages} and\n * {@link pricedEstimatedImages} for such a model, so the id priced is the id\n * the provider runs.\n */\nexport function priceReadsInputImages(model: unknown): boolean {\n return isPricedPerInputImage(model) || isFlux3Klein(model)\n}\n\n/**\n * The images a Generate Image run sends its provider: its references and, when\n * it edits a base image, that image too (the worker puts it first, unless it is\n * already one of the references). The base is counted only on a model whose\n * price reads the images ({@link priceReadsInputImages}); any other model is\n * priced, and held to its image limit, on its references alone, as before.\n */\nexport function pricedSentImages(\n provider: string | undefined,\n references: readonly string[],\n baseImageUrl: unknown,\n): number {\n const countsBase =\n priceReadsInputImages(provider) &&\n typeof baseImageUrl === \"string\" &&\n baseImageUrl.length > 0 &&\n !references.includes(baseImageUrl)\n return references.length + (countsBase ? 1 : 0)\n}\n\nfunction namesMoodboard(direction: unknown): boolean {\n if (direction === null || typeof direction !== \"object\") return false\n const style = (direction as Record<string, unknown>).style\n return (Array.isArray(style) ? style : [style]).some(\n (value) => typeof value === \"string\" && value.startsWith(\"moodboard:\"),\n )\n}\n\n/**\n * The input images a workflow estimate counts for one node on a model whose\n * price reads them ({@link priceReadsInputImages}): every list on the node, its source or base image, what is\n * wired in, a moodboard its direction names (at the most a moodboard holds),\n * and an edit model's own source. An estimate may over-quote, never under.\n */\nexport function pricedEstimatedImages(\n model: string,\n data: Record<string, unknown>,\n wiredImages: number,\n): number {\n const listed = (v: unknown) => (Array.isArray(v) ? v.length : 0)\n const single = (v: unknown) => (typeof v === \"string\" && v.length > 0 ? 1 : 0)\n return (\n listed(data.referenceImageUrls) +\n listed(data.characterDefinitionIds) +\n listed(data.extraRefs) +\n single(data.referenceImageUrl) +\n single(data.baseImageUrl) +\n single(data.sourceImageUrl) +\n wiredImages +\n (namesMoodboard(data.direction) ? GPT_IMAGE_2_6_MOODBOARD_MAX_IMAGES : 0) +\n (isPricedPerInputImageEdit(model) ? 1 : 0)\n )\n}\n","import { getModel } from \"./model-catalog.js\"\n\n/**\n * Retry/fallback behavior derived from a catalog entry's `safetyFilter`\n * flag (see `ModelCatalogEntry.safetyFilter` in `model-catalog.ts`).\n */\nexport interface SafetyRetryPolicy {\n /** 2 when the model declares `safetyFilter.stochastic`, else 1. */\n maxAttempts: 1 | 2\n /**\n * Catalog model id to offer when the retry also blocks. Only present\n * when the entry declares one AND it resolves to a real catalog entry.\n */\n fallback?: string\n}\n\n/**\n * The provider's safety filter is known to be non-deterministic on some\n * catalog models — a benign prompt can trip it once and pass on an\n * identical retry. For those models the platform retries a blocked\n * request once (`maxAttempts: 2`) before giving up; `fallback` names the\n * catalog model to offer the user when the retry also blocks.\n *\n * Every model not flagged this way — including an unrecognized id —\n * gets a single attempt and no fallback.\n */\nexport function safetyRetryPolicy(modelId: string): SafetyRetryPolicy {\n const entry = getModel(modelId)\n const safetyFilter = entry?.safetyFilter\n if (!safetyFilter?.stochastic) return { maxAttempts: 1 }\n\n const fallback = safetyFilter.fallback\n if (fallback && getModel(fallback)) {\n return { maxAttempts: 2, fallback }\n }\n return { maxAttempts: 2 }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { UGC_PRIMARY_HANDLE } from './chunk-
|
|
1
|
+
import { UGC_PRIMARY_HANDLE } from './chunk-OFQ6CU6S.js';
|
|
2
2
|
import { composeUnitSet, unitProducers, composeUnitRecord, unitFanOutEach, unitListPips } from './chunk-KL6GAYTT.js';
|
|
3
|
-
import { isSeedance2Provider, isMinimaxH3Provider, isWan3Provider, isKling4RunnerProvider, isViduQ4Provider, isGeminiOmniPerSecondProvider, isPixverseV6MaxProvider, PRICING_DEFAULT_RESOLUTION, isGeminiOmniProvider } from './chunk-
|
|
4
|
-
import { MODEL_CATALOG } from './chunk-
|
|
3
|
+
import { isSeedance2Provider, isMinimaxH3Provider, isWan3Provider, isKling4RunnerProvider, isViduQ4Provider, isGeminiOmniPerSecondProvider, isPixverseV6MaxProvider, PRICING_DEFAULT_RESOLUTION, isGeminiOmniProvider } from './chunk-VBP4DH37.js';
|
|
4
|
+
import { MODEL_CATALOG } from './chunk-MVXZP6VB.js';
|
|
5
5
|
|
|
6
6
|
// src/producer-types.ts
|
|
7
7
|
var VIDEO_PRODUCER_TYPES = composeUnitSet("VIDEO_PRODUCER_TYPES", [
|
|
@@ -327,5 +327,5 @@ function uiDurationFill(provider) {
|
|
|
327
327
|
}
|
|
328
328
|
|
|
329
329
|
export { AUDIO_PRODUCER_TYPES, DYNAMIC_PRODUCER_TYPES, FAN_IN_TARGETS, FAN_OUT_ALL_OR_NOTHING_TYPES, FAN_OUT_EACH_HANDLES, FAN_OUT_EACH_TYPES, IMAGE_PRODUCER_TYPES, LIST_OUTPUT_HANDLES, OWN_LIST_NODE_TYPES, VIDEO_PRODUCER_TYPES, defaultEdgeOutputMode, isFanInEdge, isFanInNodeType, isListOutputHandle, listResultsServeHandle, ownsItsList, uiAspectRatioFill, uiDurationFill, uiResolutionFill };
|
|
330
|
-
//# sourceMappingURL=chunk-
|
|
331
|
-
//# sourceMappingURL=chunk-
|
|
330
|
+
//# sourceMappingURL=chunk-5J2LIQYU.js.map
|
|
331
|
+
//# sourceMappingURL=chunk-5J2LIQYU.js.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AAQ,CAAA,EAAG,OAAO,cAAc,QAAQ,CAAA,EAAG,cAAc,CAAC,CAAA;AAClF,EAAA,OAAO,MAAA;AACT;AAWO,SAAS,eAAe,QAAA,EAAsC;AACnE,EAAA,IAAI,cAAA,CAAe,QAAQ,CAAA,IAAK,gBAAA,CAAiB,QAAQ,CAAA,IAAK,sBAAA,CAAuB,QAAQ,CAAA,IAAK,uBAAA,CAAwB,QAAQ,CAAA,EAAG,OAAO,CAAA;AAC5I,EAAA,IAAI,oBAAA,CAAqB,QAAQ,CAAA,EAAG,OAAO,CAAA;AAC3C,EAAA,OAAO,MAAA;AACT","file":"chunk-Q2Y4JHF7.js","sourcesContent":["/**\n * Producer-type sets — single source of truth for the node types whose\n * primary output is a video URL, audio URL, etc.\n *\n * Consumed by:\n * - backend/src/services/workflow-engine/execution-graph.ts (orchestrator\n * dispatch + asset-type tagging in payload-builder, output-extractor,\n * inline-executor — re-exported there as VIDEO_SOURCE_TYPES /\n * AUDIO_SOURCE_TYPES for backwards compatibility).\n * - frontend/src/lib/generate-video-handles.ts (handle connection\n * validation on the Generate Video node).\n *\n * Lifting these here ensures the frontend handle validator can never reject\n * a connection from a node type that the backend would happily route at\n * execution time (the prior drift bug, see issue 1 of the Task 4.1 review).\n */\nimport { UGC_PRIMARY_HANDLE } from \"./ugc-node-wires.js\"\nimport { composeUnitRecord, composeUnitSet, unitFanOutEach, unitListPips, unitProducers } from \"./unit-contract-compose.js\"\n\n// Each producer set below is its hand-written members ∪ the node units\n// (tools/units/README.md) of that producer kind, from their generated contract\n// rows, in that order — a type in both throws at load (composeUnitSet).\n\n/**\n * Source node types whose primary output is a video URL.\n * Mirrors the backend execution-graph VIDEO_SOURCE_TYPES verbatim.\n */\nexport const VIDEO_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"VIDEO_PRODUCER_TYPES\", [\n \"image-to-video\",\n \"video-to-video\",\n \"switchx\", // Beeble SwitchX relight/composite\n \"text-to-video\",\n // Unified video node — emits videoUrl identically to i2v/t2v (its payload-builder\n // case dispatches dynamically to \"image-to-video\" or \"text-to-video\" jobName based\n // on whether a start frame is wired). Without this, getPrimaryOutput would fall\n // through to the imageUrl/videoUrl/audioUrl/text default and downstream consumers\n // could silently misroute the output.\n \"generate-video\",\n // Generate Video Pro — Seedance-2-family multi-segment stitch variant of\n // generate-video (same \"emits videoUrl\" contract; a trimmed provider +\n // handle set). Must mirror generate-video here or its output can't connect\n // downstream (the recurring \"cannot connect the outputs\" bug class).\n \"generate-video-pro\",\n // Edit Video Pro — Seedance-2-family span-replace sibling of generate-\n // video-pro (same \"emits videoUrl\" contract; source video + prompt in,\n // ONE video out). Must mirror generate-video-pro here or its output can't\n // connect downstream (the recurring \"cannot connect the outputs\" bug class).\n \"edit-video-pro\",\n \"upload-video\",\n \"youtube-video\",\n \"combine-videos\",\n \"lip-sync\",\n \"speech-to-video\",\n \"motion-transfer\",\n \"video-upscale\",\n \"video-depth\",\n \"extend-video\",\n // face-swap output is video (writes generatedVideoUrl, per-result `url`).\n // Frontend execution-graph already includes it in VIDEO_SOURCE_TYPES; this\n // entry brings the shared set in line so canvas typed-handle validation\n // doesn't reject face-swap → video-consumer edges that the orchestrator\n // would happily route at runtime.\n \"face-swap\",\n // Speaker View (C3.2): an EDL rendered with its speakers framed — one VIDEO\n // out (no audio-only render). Registered in RENDER_NODE_TYPES as well.\n \"speaker-view\",\n \"video-retake\",\n // video-sfx: adds an SFX track to a video → emits a video URL. Belongs here so\n // canvas handle validation accepts video-sfx → video-consumer edges and the\n // backend routes its output as video (it was previously relying on a fallback).\n \"video-sfx\",\n \"suno-music-video\",\n \"merge-video-audio\",\n \"add-captions\",\n \"resize-video\",\n \"social-media-format\",\n \"trim-video\",\n \"render-video\",\n \"speed-ramp\",\n \"loop-video\",\n \"fade-video\",\n // Video Mask emits its mask as a video; Mask Composite its composite.\n \"video-mask\",\n \"mask-composite\",\n \"transcode-video\",\n \"manual-edit\",\n // AI Avatar (HeyGen): avatar + voice/audio → video.\n \"ai-avatar\",\n // Cinematic Avatar (HeyGen cinematic_avatar): prompt + 1–3 avatar looks → video.\n \"cinematic-avatar\",\n // Assemble Narrated Video: fits N (clip, voice) blocks into one MP4 → video.\n \"assemble-narrated-video\",\n // Still to Video: one still image + one audio track → MP4 (local FFmpeg,\n // no provider). Emits generatedVideoUrl like every other ffmpeg video node.\n \"still-to-video\",\n // Slideshow: 2-100 stills + one optional audio track → MP4 (local FFmpeg,\n // no provider). Same contract; images arrive via the image-collage lane.\n \"slideshow\",\n // 3D Render Pro: authors a scene AND exports it in one operation, settling\n // with the standard `videoUrl` field. It is a video producer as much as it\n // is a composition producer — omitting it here is the \"cannot connect the\n // outputs\" bug, and its `composition` handle is typed separately.\n \"pro-3d-render\",\n // Video Overlay: timed image layers over a video in one local FFmpeg pass\n // (the base audio copied) — emits a video URL on `video-out`.\n \"video-overlay\",\n // UGC Clip: renders one clip of a UGC video from its ticket — emits a video\n // URL on `video-out` (one per fan-out iteration).\n \"ugc-clip\",\n // UGC Finish: the video's clips, finished, as one ordered list — a registered producer, so a\n // Bundle edge into Combine Videos routes each one as a video, in order.\n \"ugc-finish-clips\",\n], unitProducers(\"video\"))\n\n/**\n * Source node types whose output media-type cannot be classified\n * statically — iterators, dynamic dispatchers, sub-workflow wrappers.\n * The orchestrator decides their actual output type at execution time\n * based on what's wired upstream (loop iterates upstream column type;\n * sub-workflow emits its leaf node's type; adjust-volume passes through\n * video or audio based on its `lastInputType` runtime field;\n * voice-changer emits audio in audio mode, video+audio in video mode).\n *\n * Typed-handle validators (frontend/src/lib/{generate-image,generate-\n * video,ffmpeg}-handles.ts) must include these as acceptors on EVERY\n * media-typed input handle — otherwise the canvas validator hard-\n * rejects edges that the orchestrator would happily route at runtime.\n *\n * Lifted here from `frontend/src/lib/ffmpeg-handles.ts` (where the\n * escape hatch was first added) so the same set drives ALL handle\n * validators uniformly. Adding a new dynamic-output node type means\n * one edit here instead of N across sibling validator files.\n *\n * Intentionally OMITTED:\n * - `webhook-trigger` / `schedule-trigger` — their outputs are\n * user-defined JSON shapes, not media URLs. Accepting them as\n * media producers creates false-positive drops at the canvas\n * that fail at execution. Users wanting trigger → media flows\n * should wire through an upload node.\n */\nexport const DYNAMIC_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"DYNAMIC_PRODUCER_TYPES\", [\n \"list\",\n \"sub-workflow\",\n \"adjust-volume\",\n // Pitch & Tempo: audio in → audio out, video in → video out (picture\n // copied). Dual-mode like adjust-volume; stays in AUDIO_PRODUCER_TYPES as\n // its default.\n \"pitch-tempo\",\n // Dual-mode: audio in → audio out; video in → video out (+ revoiced audio).\n // Listed here so canvas validators accept its output on BOTH audio and video\n // input handles (it also stays in AUDIO_PRODUCER_TYPES as its default).\n \"voice-changer\",\n // voice-changer-pro (renamed from voice-recast in #3581) is a behavioral\n // twin of voice-changer — identical dual-mode output. Must mirror it in\n // EVERY producer set or its outputs can't connect (was the \"cannot connect\n // the outputs of voice-changer-pro\" bug). Guarded by producer-types.test.ts.\n \"voice-changer-pro\",\n // Dubbing joined the dual-mode family with the full-surface upgrade:\n // audio in → dubbed audio; video in (or a video sourceUrl) → dubbed VIDEO\n // (+ audio sidecar). Same wiring contract as voice-changer; stays in\n // AUDIO_PRODUCER_TYPES as its default. Explicitly asserted in\n // producer-types.test.ts (the suite does not fail on omission).\n \"dubbing\",\n \"reduce\",\n // Dual-output time chunker (UI label \"Split into Chunks\"; type id stays\n // \"split-media\"): video in → video chunks, audio in → audio chunks — two\n // independent lanes on two output handles. Like voice-changer, the canvas\n // validator only sees the source NODE type, not which handle a wire leaves,\n // so it lives here to be accepted on BOTH audio and video input handles. The\n // backend routes the correct lane by sourceHandle in getPrimaryOutput\n // (output-extractor.ts); the frontend does so in extractNodeOutput.\n \"split-media\",\n // apply-edl renders an EDL into ONE media output whose type is decided at\n // run time by the node's `output` setting (video OR audio) — so its static\n // medium is genuinely unknown and it belongs here, letting canvas validators\n // accept its default media handle on BOTH audio and video input handles. It\n // ALSO emits a fixed `json` handle (the remapped Transcript); that half lives\n // in JSON_PRODUCER_TYPES (frontend/src/lib/data-handles.ts). The FIRST node\n // with both a dynamic media handle and a fixed json handle. Because\n // getOutputType (presentation-utils.ts) deliberately returns \"data\" for\n // DYNAMIC members, apply-edl is ALSO added to the literal VIDEO_OUTPUT_TYPES\n // there so a published app renders the cut as video, mirroring the\n // voice-changer/dubbing precedent. Asserted in producer-types.test.ts (the\n // suite does not fail on omission).\n \"apply-edl\",\n], unitProducers(\"dynamic\"))\n\n/**\n * Source node types whose primary output is an audio URL.\n * Mirrors the backend execution-graph AUDIO_SOURCE_TYPES verbatim.\n */\nexport const AUDIO_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"AUDIO_PRODUCER_TYPES\", [\n \"text-to-speech\",\n \"text-to-audio\",\n \"generate-music\",\n \"upload-audio\",\n \"suno-generate\",\n \"suno-cover\",\n \"suno-extend\",\n \"suno-separate\",\n \"audio-separation\",\n \"suno-mashup\",\n \"suno-replace-section\",\n \"suno-add-instrumental\",\n \"suno-add-vocals\",\n \"suno-convert-wav\",\n \"suno-upload-extend\",\n \"trim-audio\",\n \"mix-audio\",\n \"combine-audio\",\n \"adjust-volume\",\n \"audio-fx\",\n \"pitch-tempo\",\n \"reference-audio\",\n \"audio-isolation\",\n \"text-to-dialogue\",\n \"voice-changer\",\n // Twin of voice-changer (see DYNAMIC_PRODUCER_TYPES note). Audio is its\n // default output mode; video mode is handled via DYNAMIC membership.\n \"voice-changer-pro\",\n \"dubbing\",\n \"voice-remix\",\n \"voice-design\",\n // Extract Audio: demuxes a video's audio track to a standalone MP3.\n \"extract-audio\",\n], unitProducers(\"audio\"))\n\n/**\n * Source node types whose output is an IMAGE URL — what feeds a References\n * input. ONE set for the canvas validators (`frontend/src/lib/\n * generate-image-handles.ts` re-exports it), the backend's Generate Image\n * handle migration and the MCP edge normalizer (`llm-chat`'s legacy `in`):\n * they used to keep separate copies, and the backend's lagged by eight types.\n */\nexport const IMAGE_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"IMAGE_PRODUCER_TYPES\", [\n \"upload-image\", \"generate-image\", \"edit-image\", \"image-to-image\", \"modify-image\", \"upscale-image\", \"remove-background\",\n // extract-frame produces a single still image extracted from a video source.\n \"extract-frame\",\n // generate-mask emits the source image AND a mask PNG; its `image` source\n // pip is the passthrough (the same image as the input).\n \"generate-mask\",\n // paint-mask emits the hand-painted mask PNG (a plain image at runtime).\n // Membership is what makes mask targets accept it — mask is an advisory\n // color, not a gated type.\n \"paint-mask\",\n // reference-sheet's `sheet` is one composited image and `panels` carries\n // clean reference images; both resolve to image URLs at runtime.\n \"reference-sheet\",\n // reference-board's `image` pip emits a real generated board image.\n \"reference-board\",\n // image-collage composites N images → ONE image.\n \"image-collage\",\n // image-overlay places layers on a base → ONE image.\n \"image-overlay\",\n // 3D Render Pro's `stills` handle carries one PNG per shot of the exported\n // composition (spread into referenceImageUrls like reference-sheet\n // `panels`). A validator sees only the source NODE type, so this also makes\n // its `video` pip droppable on an image input — the handle-blind trade\n // reference-sheet and split-media already make; the input resolvers route\n // by handle, so only `stills` becomes an image at runtime. Deliberately NOT\n // in IMAGE_SOURCE_TYPES on either engine: that set types the node's PRIMARY\n // asset, and 3D Render Pro's is the MP4.\n \"pro-3d-render\",\n], unitProducers(\"image\"))\n\n/**\n * Source node types whose primary output is a LIST that, by default, fans out\n * one downstream execution per element when an edge leaves them WITHOUT an\n * explicit `outputMode` (all other edges default to \"last\"). `selector` is\n * included because its picked/rest channels are lists too.\n *\n * Single source of truth for the fan-out \"each\" default, consumed by:\n * - backend/src/services/workflow-engine/input-resolver.ts (DEFAULT_EACH_TYPES)\n * - frontend/src/components/editor/workflow-editor/types.ts (FAN_OUT_EACH_TYPES)\n * - frontend/src/components/editor/workflow-editor/node-input-resolver.ts\n *\n * These three previously kept independent copies; the backend copy drifted\n * (missing the four list-transform types), so server-side workflow runs\n * silently dropped all-but-the-first item for filter-list / deduplicate /\n * merge-lists / sort-list sources while the canvas fanned out N ways. Lifting\n * the set here makes that drift impossible.\n */\nexport const FAN_OUT_EACH_TYPES: ReadonlySet<string> = new Set([\n \"list\",\n \"split-text\",\n \"filter-list\",\n \"deduplicate\",\n \"merge-lists\",\n \"sort-list\",\n \"selector\",\n // edit-plan `clips` mode emits a bare `Edl[]` on `data.generatedJson`, so an\n // edge leaving it defaults to \"each\" — one downstream execution (typically an\n // apply-edl render) per clip. The `tighten`/`chapters` modes emit an OBJECT,\n // for which the list extractors return undefined, so an \"each\" edge falls back\n // to the scalar `edl` value (no fan-out) — the same graceful degradation\n // web-scrape relies on. See `unwrapEditPlanOutput` in `edit-plan-contract.ts`.\n \"edit-plan\",\n // Content Ideas emits one creative brief per idea on `listResults`, so an\n // edge leaving it defaults to \"each\" — the node after it (typically\n // Generate Script) runs once per idea, on the server too.\n \"content-ideas\",\n])\n\n/**\n * Per-HANDLE \"each\" defaults, for a node whose outputs differ in kind: on the\n * `each` handles an edge without an explicit `outputMode` defaults to \"each\",\n * on its other handles to \"last\". `primary` is the handle an edge with no\n * `sourceHandle` reads (agent-written workflow JSON often omits it).\n *\n * The list an \"each\" edge reads is the node's per-iteration results\n * (`listResults`) — it exists only when the node itself ran once per item, so\n * after a single run the edge degrades to the single value, exactly like a\n * `FAN_OUT_EACH_TYPES` member with one item.\n *\n * Its hand-written rows ∪ the node units' rows (`contract.fanOutEach`,\n * generated/unit-contracts.ts); a type in both refuses to load.\n */\nexport const FAN_OUT_EACH_HANDLES: Readonly<Record<string, { readonly each: readonly string[]; readonly primary: string }>> = composeUnitRecord(\"FAN_OUT_EACH_HANDLES\", {\n // Camera Switch run once per clip (Edit Plan in clips mode): each clip's\n // switched EDL is its own Apply EDL render. Its transcript is the same for\n // every clip (the master clock, renamed), so that handle stays one value\n // (decided 2026-10-04).\n \"camera-switch\": { each: [\"edl\"], primary: \"edl\" },\n // UGC Clips: one ticket per clip on `clips` (each); `plan-out` and\n // `transcript` carry one value. Not a FAN_OUT_EACH_TYPES member — every\n // handle of such a member would fan out. Its one run writes the tickets as\n // its list (`listResults`, the editor's `__listResults`). The pip an edge\n // with no handle reads is the UGC wires' own (UGC_PRIMARY_HANDLE).\n \"ugc-clips\": { each: [\"clips\"], primary: UGC_PRIMARY_HANDLE[\"ugc-clips\"]! },\n // A node unit declares its row in unit.json (contract.fanOutEach); it is added after these.\n}, unitFanOutEach())\n\n/**\n * Fan-out nodes whose iterations must ALL succeed: one failed item fails the\n * node (today's rule tolerates a partial list). UGC Clip — a missing clip\n * silently drops a beat from the script (spec R17). Already-started items\n * finish and settle; their jobs are reused on the next run.\n */\nexport const FAN_OUT_ALL_OR_NOTHING_TYPES: ReadonlySet<string> = new Set([\"ugc-clip\"])\n\n/**\n * Nodes whose saved list is the list their last run PRODUCED — `__listResults`\n * (Extract Field's JSON value on `generatedJson`) — and never a history in\n * `generatedResults`: Extract Field, JSON Process and Site Capture. No run of the first two writes\n * one; earlier builds' server runs did (the run's text, the links of a list of\n * links), and both engines' list readers leave it out for these two (decided\n * 2026-10-05). Single source of truth for the backend engine and the editor.\n */\nexport const OWN_LIST_NODE_TYPES: ReadonlySet<string> = new Set([\n \"extract-field\",\n \"json-process\",\n // Site Capture: its stills, in page order — the last capture's, never every capture's (site-capture-node.ts).\n \"site-capture\",\n])\n\n/** Whether a node's saved list is its own `__listResults`, never a history. */\nexport function ownsItsList(nodeType: string | null | undefined): boolean {\n return typeof nodeType === \"string\" && OWN_LIST_NODE_TYPES.has(nodeType)\n}\n\n/**\n * The output pips that carry the LIST one run produced — several files on one\n * pip (a node unit's `handles.outputs[].list`: each layer of a split image). An\n * edge leaving one runs the next node once per item by default (\"each\"); a\n * Bundle hands the whole list to a node that takes several. Unlike\n * FAN_OUT_EACH_HANDLES, the list is what ONE run made on that pip, never the\n * node's per-iteration results. An edge naming no pip reads the node's primary\n * output, which is never a list pip (tools/units/json-output-rules.mjs).\n * Node units only (generated/unit-contracts.ts UNIT_LIST_PIPS).\n */\nexport const LIST_OUTPUT_HANDLES: Readonly<Record<string, readonly string[]>> = composeUnitRecord(\"LIST_OUTPUT_HANDLES\", {}, unitListPips())\n\n/** Whether an edge leaving `sourceHandle` of a `sourceType` node carries a list one run produced (LIST_OUTPUT_HANDLES). */\nexport function isListOutputHandle(\n sourceType: string | null | undefined,\n sourceHandle: string | null | undefined,\n): boolean {\n if (typeof sourceType !== \"string\" || typeof sourceHandle !== \"string\" || !Object.hasOwn(LIST_OUTPUT_HANDLES, sourceType)) return false\n return LIST_OUTPUT_HANDLES[sourceType]!.includes(sourceHandle)\n}\n\n/** The `outputMode` an edge has when none is set on it — the ONE rule both\n * engines, the credit estimate and the editor read. */\nexport function defaultEdgeOutputMode(\n sourceType: string | null | undefined,\n sourceHandle: string | null | undefined,\n): \"each\" | \"last\" {\n if (typeof sourceType !== \"string\") return \"last\"\n if (FAN_OUT_EACH_TYPES.has(sourceType)) return \"each\"\n if (isListOutputHandle(sourceType, sourceHandle)) return \"each\"\n const entry = FAN_OUT_EACH_HANDLES[sourceType]\n if (!entry) return \"last\"\n return entry.each.includes(sourceHandle || entry.primary) ? \"each\" : \"last\"\n}\n\n/** Whether an edge from `sourceHandle` reads the node's per-iteration results\n * (`listResults` — each iteration's PRIMARY output). False on the other\n * handles of a `FAN_OUT_EACH_HANDLES` node: Camera Switch's transcript is one\n * value, never the list of switched EDLs, whatever mode its edge is set to. */\nexport function listResultsServeHandle(\n sourceType: string | null | undefined,\n sourceHandle: string | null | undefined,\n): boolean {\n const entry = typeof sourceType === \"string\" ? FAN_OUT_EACH_HANDLES[sourceType] : undefined\n return !entry || entry.each.includes(sourceHandle || entry.primary)\n}\n\n/**\n * FAN-IN targets: nodes that FOLD everything wired into them into ONE run,\n * instead of running once per upstream item. Keyed by node type; the value\n * names the target handles that fold (`\"*\"` = every handle). An edge into any\n * other handle of such a node is routed normally — Content Ideas folds its\n * recipes but reads its brand from a `field-brand` wire like any field.\n *\n * Single source of truth for both engines' input resolvers (the backend and\n * the editor each used to keep a private `new Set([\"reduce\"])`). A fan-in\n * node is never itself fanned out by an upstream list.\n */\nexport const FAN_IN_TARGETS: Readonly<Record<string, \"*\" | readonly string[]>> = {\n // Choose Best — every wire is a candidate.\n reduce: \"*\",\n // Content Ideas — one or more recipes, from several Content Recipe nodes\n // and/or one that ran once per post.\n \"content-ideas\": [\"recipes\"],\n // Telegram Reply — one message per run, whatever is wired into its text\n // input: a list (or a writer that ran once per item) arrives as one\n // message, never as a burst of sends to the owner's chat.\n \"telegram-account-send\": [\"in\"],\n // The list operators — they READ the whole list wired into them (their\n // executors collect every upstream item themselves) and emit a list. Run\n // once per item by an \"each\" wire (a Split Text, a List, a node that ran per\n // item), every iteration saw the same whole list and answered with its\n // first match: a Filter List fed 11 stories handed 11 copies of story one\n // downstream, and every paid stage after it ran 11 times on it\n // (2026-10-06). A list operator is never fanned out, on any wire.\n \"filter-list\": \"*\",\n deduplicate: \"*\",\n \"merge-lists\": \"*\",\n \"sort-list\": \"*\",\n selector: \"*\",\n // Speaker Frames on a clip pack (P3-24 (a), decided 2026-10-06): ONE run over\n // the union of the clips' spans — the pack's EDLs fold onto its `edl` wire\n // instead of running one detection job (and one minimum charge) per clip.\n \"speaker-frames\": [\"edl\"],\n // UGC Finish: ONE run over every clip of the video, in clip order — the finish plans its\n // cut and its sound over all of them at once, so it is never run once per clip.\n \"ugc-finish-clips\": [\"clips\"],\n}\n\nexport function isFanInNodeType(nodeType: string | undefined | null): boolean {\n return typeof nodeType === \"string\" && Object.prototype.hasOwnProperty.call(FAN_IN_TARGETS, nodeType)\n}\n\n/** True when an edge into `targetHandle` of a `targetType` node is folded.\n * An edge with NO target handle (workflow JSON written by an agent often\n * omits it) lands on the node's primary input, which is the folding one. */\nexport function isFanInEdge(targetType: string | undefined | null, targetHandle: string | null | undefined): boolean {\n if (!isFanInNodeType(targetType)) return false\n const spec = FAN_IN_TARGETS[targetType as string]!\n if (spec === \"*\") return true\n return targetHandle == null || targetHandle === \"\" || spec.includes(targetHandle)\n}\n","/**\n * UI-default fills for the unified video nodes — the ONE source of truth shared\n * by the backend DAG payload builder, the config-panel fail-safe snaps and the\n * node's hover/run strip.\n *\n * Several config panels RENDER a default without persisting it to node data, so\n * an untouched node submits `aspectRatio` / `resolution` undefined and the\n * enqueued job row (and the /v1/jobs echo) then disagrees with what actually\n * renders. Worse, the panels' generic snap writes `resolutions[0]` for a stale\n * value, which is the CHEAPEST tier under the repo's ascending-resolution\n * convention — not necessarily the tier the model renders and bills.\n *\n * These helpers were local to `backend/src/services/workflow-engine/payload-builder.ts`\n * until the Wan 3.0 launch gave the platform its first provider whose declared\n * billing default differs from `resolutions[0]`; three surfaces then had to\n * agree, so they live here.\n *\n * The resolution fill is per-family ON PURPOSE. Wan 3.0 (and Vidu Q4, whose\n * ascending list starts at 540p) reads its DECLARED\n * billing default (PRICING_DEFAULT_RESOLUTION = 720p) because its catalog list\n * is ascending, so an index-0 fill would write 480p — a tier both `runWan3`\n * (which renders 720P) and the credit identifier (which bills the 720p row)\n * disagree with. The Seedance family keeps its historical first-catalog-tier\n * fill, deliberately: switching it to PRICING_DEFAULT_RESOLUTION would reprice\n * live seedance-2-5 runs, whose declared default (720p) differs from the 480p\n * this has always filled. That 480p-fill vs 720p-billing-default divergence on\n * seedance-2-5 is a KNOWN pre-existing gap, out of scope here — do not \"align\"\n * the branches without repricing it deliberately.\n */\n\nimport {\n PRICING_DEFAULT_RESOLUTION,\n isSeedance2Provider,\n isMinimaxH3Provider,\n isWan3Provider,\n isViduQ4Provider,\n isKling4RunnerProvider,\n isGeminiOmniProvider,\n isGeminiOmniPerSecondProvider,\n isPixverseV6MaxProvider,\n} from \"./model-constants.js\"\nimport { MODEL_CATALOG } from \"./model-catalog.js\"\n\n/** `adaptive` is the aspect default for Seedance 2, MiniMax H3 and Wan 3.0. */\nexport function uiAspectRatioFill(provider: string): string | undefined {\n if (isSeedance2Provider(provider) || isMinimaxH3Provider(provider) || isWan3Provider(provider)) return \"adaptive\"\n // Kling 4.0 (and Flash): `auto` follows the materials (frames / references)\n // and renders 16:9 with none — KIE's own default when the field is omitted.\n // Flash's keyframe endpoint has no `auto`, but it runs only with a start\n // frame, where the ratio is never sent (the clip follows the frame).\n if (isKling4RunnerProvider(provider)) return \"auto\"\n return undefined\n}\n\n/** See the file docstring — per-family on purpose; never a generic\n * PRICING_DEFAULT_RESOLUTION read (that would reprice seedance-2-5). */\nexport function uiResolutionFill(provider: string): string | undefined {\n if (isWan3Provider(provider) || isViduQ4Provider(provider) || isKling4RunnerProvider(provider) || isGeminiOmniPerSecondProvider(provider) || isPixverseV6MaxProvider(provider)) return PRICING_DEFAULT_RESOLUTION[provider]\n if (isSeedance2Provider(provider)) return MODEL_CATALOG[provider]?.resolutions?.[0]\n return undefined\n}\n\n/**\n * Duration the node RENDERS and BILLS when `data.duration` is unset, for the\n * families whose credit identifier declares a duration fallback that is NOT\n * `durations[0]`. Wan 3.0's bare identifier is the 5s tier while its ladder\n * starts at 2s; Vidu Q4's is the 5s tier while its ladder starts at 3s;\n * PixVerse V6 Max's is the 5s tier while its ladder starts at 1s; the\n * Gemini Omni family's is the 8s tier while its ladder starts at 4s. Everyone else falls back to the first listed duration, so this returns\n * undefined and the caller keeps `durations[0]`.\n */\nexport function uiDurationFill(provider: string): number | undefined {\n if (isWan3Provider(provider) || isViduQ4Provider(provider) || isKling4RunnerProvider(provider) || isPixverseV6MaxProvider(provider)) return 5\n if (isGeminiOmniProvider(provider)) return 8\n return undefined\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/producer-types.ts","../src/video-ui-defaults.ts"],"names":[],"mappings":";;;;;;AA2BO,IAAM,oBAAA,GAA4C,eAAe,sBAAA,EAAwB;AAAA,EAC9F,gBAAA;AAAA,EACA,gBAAA;AAAA,EACA,SAAA;AAAA;AAAA,EACA,eAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,gBAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,oBAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,gBAAA;AAAA,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AAO,MAAA;AACT","file":"chunk-5J2LIQYU.js","sourcesContent":["/**\n * Producer-type sets — single source of truth for the node types whose\n * primary output is a video URL, audio URL, etc.\n *\n * Consumed by:\n * - backend/src/services/workflow-engine/execution-graph.ts (orchestrator\n * dispatch + asset-type tagging in payload-builder, output-extractor,\n * inline-executor — re-exported there as VIDEO_SOURCE_TYPES /\n * AUDIO_SOURCE_TYPES for backwards compatibility).\n * - frontend/src/lib/generate-video-handles.ts (handle connection\n * validation on the Generate Video node).\n *\n * Lifting these here ensures the frontend handle validator can never reject\n * a connection from a node type that the backend would happily route at\n * execution time (the prior drift bug, see issue 1 of the Task 4.1 review).\n */\nimport { UGC_PRIMARY_HANDLE } from \"./ugc-node-wires.js\"\nimport { composeUnitRecord, composeUnitSet, unitFanOutEach, unitListPips, unitProducers } from \"./unit-contract-compose.js\"\n\n// Each producer set below is its hand-written members ∪ the node units\n// (tools/units/README.md) of that producer kind, from their generated contract\n// rows, in that order — a type in both throws at load (composeUnitSet).\n\n/**\n * Source node types whose primary output is a video URL.\n * Mirrors the backend execution-graph VIDEO_SOURCE_TYPES verbatim.\n */\nexport const VIDEO_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"VIDEO_PRODUCER_TYPES\", [\n \"image-to-video\",\n \"video-to-video\",\n \"switchx\", // Beeble SwitchX relight/composite\n \"text-to-video\",\n // Unified video node — emits videoUrl identically to i2v/t2v (its payload-builder\n // case dispatches dynamically to \"image-to-video\" or \"text-to-video\" jobName based\n // on whether a start frame is wired). Without this, getPrimaryOutput would fall\n // through to the imageUrl/videoUrl/audioUrl/text default and downstream consumers\n // could silently misroute the output.\n \"generate-video\",\n // Generate Video Pro — Seedance-2-family multi-segment stitch variant of\n // generate-video (same \"emits videoUrl\" contract; a trimmed provider +\n // handle set). Must mirror generate-video here or its output can't connect\n // downstream (the recurring \"cannot connect the outputs\" bug class).\n \"generate-video-pro\",\n // Edit Video Pro — Seedance-2-family span-replace sibling of generate-\n // video-pro (same \"emits videoUrl\" contract; source video + prompt in,\n // ONE video out). Must mirror generate-video-pro here or its output can't\n // connect downstream (the recurring \"cannot connect the outputs\" bug class).\n \"edit-video-pro\",\n \"upload-video\",\n \"youtube-video\",\n \"combine-videos\",\n \"lip-sync\",\n \"speech-to-video\",\n \"motion-transfer\",\n \"video-upscale\",\n \"video-depth\",\n \"extend-video\",\n // face-swap output is video (writes generatedVideoUrl, per-result `url`).\n // Frontend execution-graph already includes it in VIDEO_SOURCE_TYPES; this\n // entry brings the shared set in line so canvas typed-handle validation\n // doesn't reject face-swap → video-consumer edges that the orchestrator\n // would happily route at runtime.\n \"face-swap\",\n // Speaker View (C3.2): an EDL rendered with its speakers framed — one VIDEO\n // out (no audio-only render). Registered in RENDER_NODE_TYPES as well.\n \"speaker-view\",\n \"video-retake\",\n // video-sfx: adds an SFX track to a video → emits a video URL. Belongs here so\n // canvas handle validation accepts video-sfx → video-consumer edges and the\n // backend routes its output as video (it was previously relying on a fallback).\n \"video-sfx\",\n \"suno-music-video\",\n \"merge-video-audio\",\n \"add-captions\",\n \"resize-video\",\n \"social-media-format\",\n \"trim-video\",\n \"render-video\",\n \"speed-ramp\",\n \"loop-video\",\n \"fade-video\",\n // Video Mask emits its mask as a video; Mask Composite its composite.\n \"video-mask\",\n \"mask-composite\",\n \"transcode-video\",\n \"manual-edit\",\n // AI Avatar (HeyGen): avatar + voice/audio → video.\n \"ai-avatar\",\n // Cinematic Avatar (HeyGen cinematic_avatar): prompt + 1–3 avatar looks → video.\n \"cinematic-avatar\",\n // Assemble Narrated Video: fits N (clip, voice) blocks into one MP4 → video.\n \"assemble-narrated-video\",\n // Still to Video: one still image + one audio track → MP4 (local FFmpeg,\n // no provider). Emits generatedVideoUrl like every other ffmpeg video node.\n \"still-to-video\",\n // Slideshow: 2-100 stills + one optional audio track → MP4 (local FFmpeg,\n // no provider). Same contract; images arrive via the image-collage lane.\n \"slideshow\",\n // 3D Render Pro: authors a scene AND exports it in one operation, settling\n // with the standard `videoUrl` field. It is a video producer as much as it\n // is a composition producer — omitting it here is the \"cannot connect the\n // outputs\" bug, and its `composition` handle is typed separately.\n \"pro-3d-render\",\n // Video Overlay: timed image layers over a video in one local FFmpeg pass\n // (the base audio copied) — emits a video URL on `video-out`.\n \"video-overlay\",\n // UGC Clip: renders one clip of a UGC video from its ticket — emits a video\n // URL on `video-out` (one per fan-out iteration).\n \"ugc-clip\",\n // UGC Finish: the video's clips, finished, as one ordered list — a registered producer, so a\n // Bundle edge into Combine Videos routes each one as a video, in order.\n \"ugc-finish-clips\",\n], unitProducers(\"video\"))\n\n/**\n * Source node types whose output media-type cannot be classified\n * statically — iterators, dynamic dispatchers, sub-workflow wrappers.\n * The orchestrator decides their actual output type at execution time\n * based on what's wired upstream (loop iterates upstream column type;\n * sub-workflow emits its leaf node's type; adjust-volume passes through\n * video or audio based on its `lastInputType` runtime field;\n * voice-changer emits audio in audio mode, video+audio in video mode).\n *\n * Typed-handle validators (frontend/src/lib/{generate-image,generate-\n * video,ffmpeg}-handles.ts) must include these as acceptors on EVERY\n * media-typed input handle — otherwise the canvas validator hard-\n * rejects edges that the orchestrator would happily route at runtime.\n *\n * Lifted here from `frontend/src/lib/ffmpeg-handles.ts` (where the\n * escape hatch was first added) so the same set drives ALL handle\n * validators uniformly. Adding a new dynamic-output node type means\n * one edit here instead of N across sibling validator files.\n *\n * Intentionally OMITTED:\n * - `webhook-trigger` / `schedule-trigger` — their outputs are\n * user-defined JSON shapes, not media URLs. Accepting them as\n * media producers creates false-positive drops at the canvas\n * that fail at execution. Users wanting trigger → media flows\n * should wire through an upload node.\n */\nexport const DYNAMIC_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"DYNAMIC_PRODUCER_TYPES\", [\n \"list\",\n \"sub-workflow\",\n \"adjust-volume\",\n // Pitch & Tempo: audio in → audio out, video in → video out (picture\n // copied). Dual-mode like adjust-volume; stays in AUDIO_PRODUCER_TYPES as\n // its default.\n \"pitch-tempo\",\n // Dual-mode: audio in → audio out; video in → video out (+ revoiced audio).\n // Listed here so canvas validators accept its output on BOTH audio and video\n // input handles (it also stays in AUDIO_PRODUCER_TYPES as its default).\n \"voice-changer\",\n // voice-changer-pro (renamed from voice-recast in #3581) is a behavioral\n // twin of voice-changer — identical dual-mode output. Must mirror it in\n // EVERY producer set or its outputs can't connect (was the \"cannot connect\n // the outputs of voice-changer-pro\" bug). Guarded by producer-types.test.ts.\n \"voice-changer-pro\",\n // Dubbing joined the dual-mode family with the full-surface upgrade:\n // audio in → dubbed audio; video in (or a video sourceUrl) → dubbed VIDEO\n // (+ audio sidecar). Same wiring contract as voice-changer; stays in\n // AUDIO_PRODUCER_TYPES as its default. Explicitly asserted in\n // producer-types.test.ts (the suite does not fail on omission).\n \"dubbing\",\n \"reduce\",\n // Dual-output time chunker (UI label \"Split into Chunks\"; type id stays\n // \"split-media\"): video in → video chunks, audio in → audio chunks — two\n // independent lanes on two output handles. Like voice-changer, the canvas\n // validator only sees the source NODE type, not which handle a wire leaves,\n // so it lives here to be accepted on BOTH audio and video input handles. The\n // backend routes the correct lane by sourceHandle in getPrimaryOutput\n // (output-extractor.ts); the frontend does so in extractNodeOutput.\n \"split-media\",\n // apply-edl renders an EDL into ONE media output whose type is decided at\n // run time by the node's `output` setting (video OR audio) — so its static\n // medium is genuinely unknown and it belongs here, letting canvas validators\n // accept its default media handle on BOTH audio and video input handles. It\n // ALSO emits a fixed `json` handle (the remapped Transcript); that half lives\n // in JSON_PRODUCER_TYPES (frontend/src/lib/data-handles.ts). The FIRST node\n // with both a dynamic media handle and a fixed json handle. Because\n // getOutputType (presentation-utils.ts) deliberately returns \"data\" for\n // DYNAMIC members, apply-edl is ALSO added to the literal VIDEO_OUTPUT_TYPES\n // there so a published app renders the cut as video, mirroring the\n // voice-changer/dubbing precedent. Asserted in producer-types.test.ts (the\n // suite does not fail on omission).\n \"apply-edl\",\n], unitProducers(\"dynamic\"))\n\n/**\n * Source node types whose primary output is an audio URL.\n * Mirrors the backend execution-graph AUDIO_SOURCE_TYPES verbatim.\n */\nexport const AUDIO_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"AUDIO_PRODUCER_TYPES\", [\n \"text-to-speech\",\n \"text-to-audio\",\n \"generate-music\",\n \"upload-audio\",\n \"suno-generate\",\n \"suno-cover\",\n \"suno-extend\",\n \"suno-separate\",\n \"audio-separation\",\n \"suno-mashup\",\n \"suno-replace-section\",\n \"suno-add-instrumental\",\n \"suno-add-vocals\",\n \"suno-convert-wav\",\n \"suno-upload-extend\",\n \"trim-audio\",\n \"mix-audio\",\n \"combine-audio\",\n \"adjust-volume\",\n \"audio-fx\",\n \"pitch-tempo\",\n \"reference-audio\",\n \"audio-isolation\",\n \"text-to-dialogue\",\n \"voice-changer\",\n // Twin of voice-changer (see DYNAMIC_PRODUCER_TYPES note). Audio is its\n // default output mode; video mode is handled via DYNAMIC membership.\n \"voice-changer-pro\",\n \"dubbing\",\n \"voice-remix\",\n \"voice-design\",\n // Extract Audio: demuxes a video's audio track to a standalone MP3.\n \"extract-audio\",\n], unitProducers(\"audio\"))\n\n/**\n * Source node types whose output is an IMAGE URL — what feeds a References\n * input. ONE set for the canvas validators (`frontend/src/lib/\n * generate-image-handles.ts` re-exports it), the backend's Generate Image\n * handle migration and the MCP edge normalizer (`llm-chat`'s legacy `in`):\n * they used to keep separate copies, and the backend's lagged by eight types.\n */\nexport const IMAGE_PRODUCER_TYPES: ReadonlySet<string> = composeUnitSet(\"IMAGE_PRODUCER_TYPES\", [\n \"upload-image\", \"generate-image\", \"edit-image\", \"image-to-image\", \"modify-image\", \"upscale-image\", \"remove-background\",\n // extract-frame produces a single still image extracted from a video source.\n \"extract-frame\",\n // generate-mask emits the source image AND a mask PNG; its `image` source\n // pip is the passthrough (the same image as the input).\n \"generate-mask\",\n // paint-mask emits the hand-painted mask PNG (a plain image at runtime).\n // Membership is what makes mask targets accept it — mask is an advisory\n // color, not a gated type.\n \"paint-mask\",\n // reference-sheet's `sheet` is one composited image and `panels` carries\n // clean reference images; both resolve to image URLs at runtime.\n \"reference-sheet\",\n // reference-board's `image` pip emits a real generated board image.\n \"reference-board\",\n // image-collage composites N images → ONE image.\n \"image-collage\",\n // image-overlay places layers on a base → ONE image.\n \"image-overlay\",\n // 3D Render Pro's `stills` handle carries one PNG per shot of the exported\n // composition (spread into referenceImageUrls like reference-sheet\n // `panels`). A validator sees only the source NODE type, so this also makes\n // its `video` pip droppable on an image input — the handle-blind trade\n // reference-sheet and split-media already make; the input resolvers route\n // by handle, so only `stills` becomes an image at runtime. Deliberately NOT\n // in IMAGE_SOURCE_TYPES on either engine: that set types the node's PRIMARY\n // asset, and 3D Render Pro's is the MP4.\n \"pro-3d-render\",\n], unitProducers(\"image\"))\n\n/**\n * Source node types whose primary output is a LIST that, by default, fans out\n * one downstream execution per element when an edge leaves them WITHOUT an\n * explicit `outputMode` (all other edges default to \"last\"). `selector` is\n * included because its picked/rest channels are lists too.\n *\n * Single source of truth for the fan-out \"each\" default, consumed by:\n * - backend/src/services/workflow-engine/input-resolver.ts (DEFAULT_EACH_TYPES)\n * - frontend/src/components/editor/workflow-editor/types.ts (FAN_OUT_EACH_TYPES)\n * - frontend/src/components/editor/workflow-editor/node-input-resolver.ts\n *\n * These three previously kept independent copies; the backend copy drifted\n * (missing the four list-transform types), so server-side workflow runs\n * silently dropped all-but-the-first item for filter-list / deduplicate /\n * merge-lists / sort-list sources while the canvas fanned out N ways. Lifting\n * the set here makes that drift impossible.\n */\nexport const FAN_OUT_EACH_TYPES: ReadonlySet<string> = new Set([\n \"list\",\n \"split-text\",\n \"filter-list\",\n \"deduplicate\",\n \"merge-lists\",\n \"sort-list\",\n \"selector\",\n // edit-plan `clips` mode emits a bare `Edl[]` on `data.generatedJson`, so an\n // edge leaving it defaults to \"each\" — one downstream execution (typically an\n // apply-edl render) per clip. The `tighten`/`chapters` modes emit an OBJECT,\n // for which the list extractors return undefined, so an \"each\" edge falls back\n // to the scalar `edl` value (no fan-out) — the same graceful degradation\n // web-scrape relies on. See `unwrapEditPlanOutput` in `edit-plan-contract.ts`.\n \"edit-plan\",\n // Content Ideas emits one creative brief per idea on `listResults`, so an\n // edge leaving it defaults to \"each\" — the node after it (typically\n // Generate Script) runs once per idea, on the server too.\n \"content-ideas\",\n])\n\n/**\n * Per-HANDLE \"each\" defaults, for a node whose outputs differ in kind: on the\n * `each` handles an edge without an explicit `outputMode` defaults to \"each\",\n * on its other handles to \"last\". `primary` is the handle an edge with no\n * `sourceHandle` reads (agent-written workflow JSON often omits it).\n *\n * The list an \"each\" edge reads is the node's per-iteration results\n * (`listResults`) — it exists only when the node itself ran once per item, so\n * after a single run the edge degrades to the single value, exactly like a\n * `FAN_OUT_EACH_TYPES` member with one item.\n *\n * Its hand-written rows ∪ the node units' rows (`contract.fanOutEach`,\n * generated/unit-contracts.ts); a type in both refuses to load.\n */\nexport const FAN_OUT_EACH_HANDLES: Readonly<Record<string, { readonly each: readonly string[]; readonly primary: string }>> = composeUnitRecord(\"FAN_OUT_EACH_HANDLES\", {\n // Camera Switch run once per clip (Edit Plan in clips mode): each clip's\n // switched EDL is its own Apply EDL render. Its transcript is the same for\n // every clip (the master clock, renamed), so that handle stays one value\n // (decided 2026-10-04).\n \"camera-switch\": { each: [\"edl\"], primary: \"edl\" },\n // UGC Clips: one ticket per clip on `clips` (each); `plan-out` and\n // `transcript` carry one value. Not a FAN_OUT_EACH_TYPES member — every\n // handle of such a member would fan out. Its one run writes the tickets as\n // its list (`listResults`, the editor's `__listResults`). The pip an edge\n // with no handle reads is the UGC wires' own (UGC_PRIMARY_HANDLE).\n \"ugc-clips\": { each: [\"clips\"], primary: UGC_PRIMARY_HANDLE[\"ugc-clips\"]! },\n // A node unit declares its row in unit.json (contract.fanOutEach); it is added after these.\n}, unitFanOutEach())\n\n/**\n * Fan-out nodes whose iterations must ALL succeed: one failed item fails the\n * node (today's rule tolerates a partial list). UGC Clip — a missing clip\n * silently drops a beat from the script (spec R17). Already-started items\n * finish and settle; their jobs are reused on the next run.\n */\nexport const FAN_OUT_ALL_OR_NOTHING_TYPES: ReadonlySet<string> = new Set([\"ugc-clip\"])\n\n/**\n * Nodes whose saved list is the list their last run PRODUCED — `__listResults`\n * (Extract Field's JSON value on `generatedJson`) — and never a history in\n * `generatedResults`: Extract Field, JSON Process and Site Capture. No run of the first two writes\n * one; earlier builds' server runs did (the run's text, the links of a list of\n * links), and both engines' list readers leave it out for these two (decided\n * 2026-10-05). Single source of truth for the backend engine and the editor.\n */\nexport const OWN_LIST_NODE_TYPES: ReadonlySet<string> = new Set([\n \"extract-field\",\n \"json-process\",\n // Site Capture: its stills, in page order — the last capture's, never every capture's (site-capture-node.ts).\n \"site-capture\",\n])\n\n/** Whether a node's saved list is its own `__listResults`, never a history. */\nexport function ownsItsList(nodeType: string | null | undefined): boolean {\n return typeof nodeType === \"string\" && OWN_LIST_NODE_TYPES.has(nodeType)\n}\n\n/**\n * The output pips that carry the LIST one run produced — several files on one\n * pip (a node unit's `handles.outputs[].list`: each layer of a split image). An\n * edge leaving one runs the next node once per item by default (\"each\"); a\n * Bundle hands the whole list to a node that takes several. Unlike\n * FAN_OUT_EACH_HANDLES, the list is what ONE run made on that pip, never the\n * node's per-iteration results. An edge naming no pip reads the node's primary\n * output, which is never a list pip (tools/units/json-output-rules.mjs).\n * Node units only (generated/unit-contracts.ts UNIT_LIST_PIPS).\n */\nexport const LIST_OUTPUT_HANDLES: Readonly<Record<string, readonly string[]>> = composeUnitRecord(\"LIST_OUTPUT_HANDLES\", {}, unitListPips())\n\n/** Whether an edge leaving `sourceHandle` of a `sourceType` node carries a list one run produced (LIST_OUTPUT_HANDLES). */\nexport function isListOutputHandle(\n sourceType: string | null | undefined,\n sourceHandle: string | null | undefined,\n): boolean {\n if (typeof sourceType !== \"string\" || typeof sourceHandle !== \"string\" || !Object.hasOwn(LIST_OUTPUT_HANDLES, sourceType)) return false\n return LIST_OUTPUT_HANDLES[sourceType]!.includes(sourceHandle)\n}\n\n/** The `outputMode` an edge has when none is set on it — the ONE rule both\n * engines, the credit estimate and the editor read. */\nexport function defaultEdgeOutputMode(\n sourceType: string | null | undefined,\n sourceHandle: string | null | undefined,\n): \"each\" | \"last\" {\n if (typeof sourceType !== \"string\") return \"last\"\n if (FAN_OUT_EACH_TYPES.has(sourceType)) return \"each\"\n if (isListOutputHandle(sourceType, sourceHandle)) return \"each\"\n const entry = FAN_OUT_EACH_HANDLES[sourceType]\n if (!entry) return \"last\"\n return entry.each.includes(sourceHandle || entry.primary) ? \"each\" : \"last\"\n}\n\n/** Whether an edge from `sourceHandle` reads the node's per-iteration results\n * (`listResults` — each iteration's PRIMARY output). False on the other\n * handles of a `FAN_OUT_EACH_HANDLES` node: Camera Switch's transcript is one\n * value, never the list of switched EDLs, whatever mode its edge is set to. */\nexport function listResultsServeHandle(\n sourceType: string | null | undefined,\n sourceHandle: string | null | undefined,\n): boolean {\n const entry = typeof sourceType === \"string\" ? FAN_OUT_EACH_HANDLES[sourceType] : undefined\n return !entry || entry.each.includes(sourceHandle || entry.primary)\n}\n\n/**\n * FAN-IN targets: nodes that FOLD everything wired into them into ONE run,\n * instead of running once per upstream item. Keyed by node type; the value\n * names the target handles that fold (`\"*\"` = every handle). An edge into any\n * other handle of such a node is routed normally — Content Ideas folds its\n * recipes but reads its brand from a `field-brand` wire like any field.\n *\n * Single source of truth for both engines' input resolvers (the backend and\n * the editor each used to keep a private `new Set([\"reduce\"])`). A fan-in\n * node is never itself fanned out by an upstream list.\n */\nexport const FAN_IN_TARGETS: Readonly<Record<string, \"*\" | readonly string[]>> = {\n // Choose Best — every wire is a candidate.\n reduce: \"*\",\n // Content Ideas — one or more recipes, from several Content Recipe nodes\n // and/or one that ran once per post.\n \"content-ideas\": [\"recipes\"],\n // Telegram Reply — one message per run, whatever is wired into its text\n // input: a list (or a writer that ran once per item) arrives as one\n // message, never as a burst of sends to the owner's chat.\n \"telegram-account-send\": [\"in\"],\n // The list operators — they READ the whole list wired into them (their\n // executors collect every upstream item themselves) and emit a list. Run\n // once per item by an \"each\" wire (a Split Text, a List, a node that ran per\n // item), every iteration saw the same whole list and answered with its\n // first match: a Filter List fed 11 stories handed 11 copies of story one\n // downstream, and every paid stage after it ran 11 times on it\n // (2026-10-06). A list operator is never fanned out, on any wire.\n \"filter-list\": \"*\",\n deduplicate: \"*\",\n \"merge-lists\": \"*\",\n \"sort-list\": \"*\",\n selector: \"*\",\n // Speaker Frames on a clip pack (P3-24 (a), decided 2026-10-06): ONE run over\n // the union of the clips' spans — the pack's EDLs fold onto its `edl` wire\n // instead of running one detection job (and one minimum charge) per clip.\n \"speaker-frames\": [\"edl\"],\n // UGC Finish: ONE run over every clip of the video, in clip order — the finish plans its\n // cut and its sound over all of them at once, so it is never run once per clip.\n \"ugc-finish-clips\": [\"clips\"],\n}\n\nexport function isFanInNodeType(nodeType: string | undefined | null): boolean {\n return typeof nodeType === \"string\" && Object.prototype.hasOwnProperty.call(FAN_IN_TARGETS, nodeType)\n}\n\n/** True when an edge into `targetHandle` of a `targetType` node is folded.\n * An edge with NO target handle (workflow JSON written by an agent often\n * omits it) lands on the node's primary input, which is the folding one. */\nexport function isFanInEdge(targetType: string | undefined | null, targetHandle: string | null | undefined): boolean {\n if (!isFanInNodeType(targetType)) return false\n const spec = FAN_IN_TARGETS[targetType as string]!\n if (spec === \"*\") return true\n return targetHandle == null || targetHandle === \"\" || spec.includes(targetHandle)\n}\n","/**\n * UI-default fills for the unified video nodes — the ONE source of truth shared\n * by the backend DAG payload builder, the config-panel fail-safe snaps and the\n * node's hover/run strip.\n *\n * Several config panels RENDER a default without persisting it to node data, so\n * an untouched node submits `aspectRatio` / `resolution` undefined and the\n * enqueued job row (and the /v1/jobs echo) then disagrees with what actually\n * renders. Worse, the panels' generic snap writes `resolutions[0]` for a stale\n * value, which is the CHEAPEST tier under the repo's ascending-resolution\n * convention — not necessarily the tier the model renders and bills.\n *\n * These helpers were local to `backend/src/services/workflow-engine/payload-builder.ts`\n * until the Wan 3.0 launch gave the platform its first provider whose declared\n * billing default differs from `resolutions[0]`; three surfaces then had to\n * agree, so they live here.\n *\n * The resolution fill is per-family ON PURPOSE. Wan 3.0 (and Vidu Q4, whose\n * ascending list starts at 540p) reads its DECLARED\n * billing default (PRICING_DEFAULT_RESOLUTION = 720p) because its catalog list\n * is ascending, so an index-0 fill would write 480p — a tier both `runWan3`\n * (which renders 720P) and the credit identifier (which bills the 720p row)\n * disagree with. The Seedance family keeps its historical first-catalog-tier\n * fill, deliberately: switching it to PRICING_DEFAULT_RESOLUTION would reprice\n * live seedance-2-5 runs, whose declared default (720p) differs from the 480p\n * this has always filled. That 480p-fill vs 720p-billing-default divergence on\n * seedance-2-5 is a KNOWN pre-existing gap, out of scope here — do not \"align\"\n * the branches without repricing it deliberately.\n */\n\nimport {\n PRICING_DEFAULT_RESOLUTION,\n isSeedance2Provider,\n isMinimaxH3Provider,\n isWan3Provider,\n isViduQ4Provider,\n isKling4RunnerProvider,\n isGeminiOmniProvider,\n isGeminiOmniPerSecondProvider,\n isPixverseV6MaxProvider,\n} from \"./model-constants.js\"\nimport { MODEL_CATALOG } from \"./model-catalog.js\"\n\n/** `adaptive` is the aspect default for Seedance 2, MiniMax H3 and Wan 3.0. */\nexport function uiAspectRatioFill(provider: string): string | undefined {\n if (isSeedance2Provider(provider) || isMinimaxH3Provider(provider) || isWan3Provider(provider)) return \"adaptive\"\n // Kling 4.0 (and Flash): `auto` follows the materials (frames / references)\n // and renders 16:9 with none — KIE's own default when the field is omitted.\n // Flash's keyframe endpoint has no `auto`, but it runs only with a start\n // frame, where the ratio is never sent (the clip follows the frame).\n if (isKling4RunnerProvider(provider)) return \"auto\"\n return undefined\n}\n\n/** See the file docstring — per-family on purpose; never a generic\n * PRICING_DEFAULT_RESOLUTION read (that would reprice seedance-2-5). */\nexport function uiResolutionFill(provider: string): string | undefined {\n if (isWan3Provider(provider) || isViduQ4Provider(provider) || isKling4RunnerProvider(provider) || isGeminiOmniPerSecondProvider(provider) || isPixverseV6MaxProvider(provider)) return PRICING_DEFAULT_RESOLUTION[provider]\n if (isSeedance2Provider(provider)) return MODEL_CATALOG[provider]?.resolutions?.[0]\n return undefined\n}\n\n/**\n * Duration the node RENDERS and BILLS when `data.duration` is unset, for the\n * families whose credit identifier declares a duration fallback that is NOT\n * `durations[0]`. Wan 3.0's bare identifier is the 5s tier while its ladder\n * starts at 2s; Vidu Q4's is the 5s tier while its ladder starts at 3s;\n * PixVerse V6 Max's is the 5s tier while its ladder starts at 1s; the\n * Gemini Omni family's is the 8s tier while its ladder starts at 4s. Everyone else falls back to the first listed duration, so this returns\n * undefined and the caller keeps `durations[0]`.\n */\nexport function uiDurationFill(provider: string): number | undefined {\n if (isWan3Provider(provider) || isViduQ4Provider(provider) || isKling4RunnerProvider(provider) || isPixverseV6MaxProvider(provider)) return 5\n if (isGeminiOmniProvider(provider)) return 8\n return undefined\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { INPUT_FIELD_MAP, canonicalExposedFieldKey } from './chunk-
|
|
1
|
+
import { INPUT_FIELD_MAP, canonicalExposedFieldKey } from './chunk-GF7ZA26H.js';
|
|
2
2
|
|
|
3
3
|
// src/picker-restrictions.ts
|
|
4
4
|
var valuesOf = (v) => (Array.isArray(v) ? v : [v]).filter((x) => x !== void 0 && x !== null && x !== "").map(String);
|
|
@@ -139,5 +139,5 @@ function templateCategoryStoredValues(category) {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
export { DEFAULT_TEMPLATE_CATEGORY, HANDLE_PORT_SEPARATOR, INPUT_FIELD_MAP2 as INPUT_FIELD_MAP, LEGACY_TEMPLATE_CATEGORIES, OAUTH_SCOPES, OUTPUT_FIELD_MAP, RECAST_SEGMENT_PACKS, TEMPLATE_CATEGORIES, applyHandleInputOverride, findRestrictedPickerValue, isHandleInputWired, isTemplateCategory, mergeExposedSettings, normalizeTemplateCategory, parseHandleId, resolveTemplateCategory, templateCategoryStoredValues };
|
|
142
|
-
//# sourceMappingURL=chunk-
|
|
143
|
-
//# sourceMappingURL=chunk-
|
|
142
|
+
//# sourceMappingURL=chunk-5LWYX4GV.js.map
|
|
143
|
+
//# sourceMappingURL=chunk-5LWYX4GV.js.map
|