@nodaro/shared 3.70.0 → 3.72.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-M7LU4NTI.cjs → chunk-26GM45QE.cjs} +18 -2
- package/dist/chunk-26GM45QE.cjs.map +1 -0
- package/dist/{chunk-PWIKUOLB.cjs → chunk-32QY5AIY.cjs} +8 -8
- package/dist/{chunk-PWIKUOLB.cjs.map → chunk-32QY5AIY.cjs.map} +1 -1
- package/dist/{chunk-4U7QAUV3.cjs → chunk-4BCODXK6.cjs} +61 -61
- package/dist/{chunk-4U7QAUV3.cjs.map → chunk-4BCODXK6.cjs.map} +1 -1
- package/dist/{chunk-DOY47F7S.cjs → chunk-5WXVPPRH.cjs} +7 -7
- package/dist/{chunk-DOY47F7S.cjs.map → chunk-5WXVPPRH.cjs.map} +1 -1
- package/dist/{chunk-NS34PZ2S.js → chunk-7DMK7B3Q.js} +3 -3
- package/dist/{chunk-NS34PZ2S.js.map → chunk-7DMK7B3Q.js.map} +1 -1
- package/dist/{chunk-5DRSENY3.cjs → chunk-AIPOZKQV.cjs} +14 -12
- package/dist/{chunk-PKWRAMVB.js.map → chunk-AIPOZKQV.cjs.map} +1 -1
- package/dist/{chunk-HWBLZSM3.cjs → chunk-AXDTMRWR.cjs} +51 -28
- package/dist/chunk-AXDTMRWR.cjs.map +1 -0
- package/dist/{chunk-OW5AXH2Y.js → chunk-CL7ECTK2.js} +5 -4
- package/dist/chunk-CL7ECTK2.js.map +1 -0
- package/dist/{chunk-KKFFQUMM.js → chunk-D5NRBVUH.js} +5 -5
- package/dist/chunk-D5NRBVUH.js.map +1 -0
- package/dist/{chunk-52JNQG4K.js → chunk-D7DCDIMU.js} +3 -3
- package/dist/{chunk-52JNQG4K.js.map → chunk-D7DCDIMU.js.map} +1 -1
- package/dist/{chunk-HW6TLOK4.cjs → chunk-DRPHRE4J.cjs} +2 -2
- package/dist/{chunk-HW6TLOK4.cjs.map → chunk-DRPHRE4J.cjs.map} +1 -1
- package/dist/{chunk-PKWRAMVB.js → chunk-EI4V43DI.js} +7 -5
- package/dist/chunk-EI4V43DI.js.map +1 -0
- package/dist/{chunk-EWNDK4FV.js → chunk-EOYQD6DU.js} +3 -3
- package/dist/{chunk-EWNDK4FV.js.map → chunk-EOYQD6DU.js.map} +1 -1
- package/dist/{chunk-HA2PVTER.js → chunk-GCOS7CFL.js} +4 -4
- package/dist/{chunk-HA2PVTER.js.map → chunk-GCOS7CFL.js.map} +1 -1
- package/dist/{chunk-XBHDXURR.cjs → chunk-HJGL2UNQ.cjs} +78 -78
- package/dist/chunk-HJGL2UNQ.cjs.map +1 -0
- package/dist/{chunk-HBRDKHIW.cjs → chunk-HOQ4TLDW.cjs} +21 -21
- package/dist/{chunk-HBRDKHIW.cjs.map → chunk-HOQ4TLDW.cjs.map} +1 -1
- package/dist/{chunk-POZBRZUM.cjs → chunk-I2GFLOLD.cjs} +41 -41
- package/dist/{chunk-POZBRZUM.cjs.map → chunk-I2GFLOLD.cjs.map} +1 -1
- package/dist/{chunk-LTBM2KMY.js → chunk-INJP7EFI.js} +235 -9
- package/dist/chunk-INJP7EFI.js.map +1 -0
- package/dist/{chunk-BLGZW3UF.cjs → chunk-JUCWBIEE.cjs} +291 -20
- package/dist/chunk-JUCWBIEE.cjs.map +1 -0
- package/dist/{chunk-JEUZNHLL.cjs → chunk-L2WHTUBA.cjs} +40 -34
- package/dist/chunk-L2WHTUBA.cjs.map +1 -0
- package/dist/{chunk-V6TC2NDG.js → chunk-LMBHF5TZ.js} +4 -4
- package/dist/{chunk-V6TC2NDG.js.map → chunk-LMBHF5TZ.js.map} +1 -1
- package/dist/{chunk-QCVQVKCI.js → chunk-LP5KZZAF.js} +3 -3
- package/dist/{chunk-QCVQVKCI.js.map → chunk-LP5KZZAF.js.map} +1 -1
- package/dist/{chunk-42ICEVUN.js → chunk-M4MXK7RJ.js} +3 -3
- package/dist/{chunk-42ICEVUN.js.map → chunk-M4MXK7RJ.js.map} +1 -1
- package/dist/{chunk-BIQ7COJP.js → chunk-MR4KSZY3.js} +5 -5
- package/dist/{chunk-BIQ7COJP.js.map → chunk-MR4KSZY3.js.map} +1 -1
- package/dist/{chunk-OZHE77T3.cjs → chunk-NEBO32KZ.cjs} +9 -9
- package/dist/{chunk-OZHE77T3.cjs.map → chunk-NEBO32KZ.cjs.map} +1 -1
- package/dist/{chunk-MZ772ZXA.cjs → chunk-NSKH5ULV.cjs} +17 -17
- package/dist/{chunk-MZ772ZXA.cjs.map → chunk-NSKH5ULV.cjs.map} +1 -1
- package/dist/{chunk-QV32JI4L.cjs → chunk-OALWH5VV.cjs} +4 -4
- package/dist/{chunk-QV32JI4L.cjs.map → chunk-OALWH5VV.cjs.map} +1 -1
- package/dist/{chunk-IKN54UGB.js → chunk-OWNGS4DF.js} +3 -3
- package/dist/{chunk-IKN54UGB.js.map → chunk-OWNGS4DF.js.map} +1 -1
- package/dist/{chunk-FWPGRC4X.cjs → chunk-QFW25UCC.cjs} +5 -5
- package/dist/{chunk-FWPGRC4X.cjs.map → chunk-QFW25UCC.cjs.map} +1 -1
- package/dist/{chunk-FMQ43SJP.cjs → chunk-QVRAPR4D.cjs} +6 -6
- package/dist/{chunk-FMQ43SJP.cjs.map → chunk-QVRAPR4D.cjs.map} +1 -1
- package/dist/{chunk-PYYYBINP.cjs → chunk-RMDTBXYT.cjs} +6 -6
- package/dist/{chunk-PYYYBINP.cjs.map → chunk-RMDTBXYT.cjs.map} +1 -1
- package/dist/{chunk-O53P2D4V.js → chunk-SXDLBXSB.js} +9 -5
- package/dist/chunk-SXDLBXSB.js.map +1 -0
- package/dist/{chunk-YLDY23N2.js → chunk-U7PHAD2O.js} +5 -5
- package/dist/{chunk-YLDY23N2.js.map → chunk-U7PHAD2O.js.map} +1 -1
- package/dist/{chunk-TADEEG5E.js → chunk-UC3CMPDN.js} +18 -3
- package/dist/chunk-UC3CMPDN.js.map +1 -0
- package/dist/{chunk-QCZYYAPZ.cjs → chunk-UMUSJHH2.cjs} +48 -48
- package/dist/{chunk-QCZYYAPZ.cjs.map → chunk-UMUSJHH2.cjs.map} +1 -1
- package/dist/{chunk-H2E4QXEZ.js → chunk-VVLW63HD.js} +3 -3
- package/dist/{chunk-H2E4QXEZ.js.map → chunk-VVLW63HD.js.map} +1 -1
- package/dist/{chunk-HP3YIWNJ.js → chunk-WARGPM7P.js} +2 -2
- package/dist/{chunk-HP3YIWNJ.js.map → chunk-WARGPM7P.js.map} +1 -1
- package/dist/{chunk-QVAUBB2T.js → chunk-WXJMPWYR.js} +9 -9
- package/dist/{chunk-QVAUBB2T.js.map → chunk-WXJMPWYR.js.map} +1 -1
- package/dist/{chunk-R22UHRR6.js → chunk-X7UDZGXW.js} +51 -28
- package/dist/chunk-X7UDZGXW.js.map +1 -0
- package/dist/{chunk-2VOXSVIE.js → chunk-XEMEUKXK.js} +3 -3
- package/dist/{chunk-2VOXSVIE.js.map → chunk-XEMEUKXK.js.map} +1 -1
- package/dist/{chunk-GC77W57T.cjs → chunk-YHDTBO45.cjs} +9 -9
- package/dist/{chunk-GC77W57T.cjs.map → chunk-YHDTBO45.cjs.map} +1 -1
- package/dist/{chunk-WHV7MDNC.cjs → chunk-ZJQ2L3MI.cjs} +5 -3
- package/dist/chunk-ZJQ2L3MI.cjs.map +1 -0
- package/dist/entries/apps.cjs +42 -42
- package/dist/entries/apps.js +7 -7
- package/dist/entries/credits.cjs +418 -238
- package/dist/entries/credits.d.cts +263 -2
- package/dist/entries/credits.d.ts +263 -2
- package/dist/entries/credits.js +9 -9
- package/dist/entries/edl.cjs +60 -60
- package/dist/entries/edl.d.cts +96 -1
- package/dist/entries/edl.d.ts +96 -1
- package/dist/entries/edl.js +1 -1
- package/dist/entries/i18n.cjs +15 -11
- package/dist/entries/i18n.d.cts +19 -1
- package/dist/entries/i18n.d.ts +19 -1
- package/dist/entries/i18n.js +1 -1
- package/dist/entries/llm-models.d.cts +1 -1
- package/dist/entries/llm-models.d.ts +1 -1
- package/dist/entries/model-catalog.cjs +133 -133
- package/dist/entries/model-catalog.js +4 -4
- package/dist/entries/models.cjs +412 -404
- package/dist/entries/models.d.cts +2 -2
- package/dist/entries/models.d.ts +2 -2
- package/dist/entries/models.js +5 -5
- package/dist/entries/nodes.cjs +212 -212
- package/dist/entries/nodes.js +8 -8
- package/dist/entries/pipeline.cjs +153 -153
- package/dist/entries/pipeline.d.cts +1 -1
- package/dist/entries/pipeline.d.ts +1 -1
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/social.cjs +195 -191
- package/dist/entries/social.d.cts +9 -3
- package/dist/entries/social.d.ts +9 -3
- package/dist/entries/social.js +1 -1
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +152 -152
- package/dist/entries/video.js +6 -6
- package/dist/index.cjs +1835 -1639
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +21 -21
- package/dist/{model-constants-CQr_d3Kw.d.cts → model-constants-C4RL9Xtn.d.cts} +20 -4
- package/dist/{model-constants-B5DNHIP8.d.ts → model-constants-kRg3YCIJ.d.ts} +20 -4
- package/dist/style.ar-4WUT56YH.js +63 -0
- package/dist/style.ar-4WUT56YH.js.map +1 -0
- package/dist/style.ar-ZRS6ZSSS.cjs +65 -0
- package/dist/style.ar-ZRS6ZSSS.cjs.map +1 -0
- package/dist/style.de-6543OVTB.cjs +65 -0
- package/dist/style.de-6543OVTB.cjs.map +1 -0
- package/dist/style.de-HQS4NOVN.js +63 -0
- package/dist/style.de-HQS4NOVN.js.map +1 -0
- package/dist/style.es-ADFPO6LM.cjs +65 -0
- package/dist/style.es-ADFPO6LM.cjs.map +1 -0
- package/dist/style.es-O4N36TIJ.js +63 -0
- package/dist/style.es-O4N36TIJ.js.map +1 -0
- package/dist/style.fr-A3ZO6BP3.cjs +65 -0
- package/dist/style.fr-A3ZO6BP3.cjs.map +1 -0
- package/dist/style.fr-XKYO3NOK.js +63 -0
- package/dist/style.fr-XKYO3NOK.js.map +1 -0
- package/dist/style.he-DI4PXGJG.cjs +65 -0
- package/dist/style.he-DI4PXGJG.cjs.map +1 -0
- package/dist/style.he-L4SD3G7D.js +63 -0
- package/dist/style.he-L4SD3G7D.js.map +1 -0
- package/dist/style.hi-K625E6UR.js +63 -0
- package/dist/style.hi-K625E6UR.js.map +1 -0
- package/dist/style.hi-LMDM6S3Q.cjs +65 -0
- package/dist/style.hi-LMDM6S3Q.cjs.map +1 -0
- package/dist/style.ja-3YGEMQKQ.js +63 -0
- package/dist/style.ja-3YGEMQKQ.js.map +1 -0
- package/dist/style.ja-QV4Z4B3Y.cjs +65 -0
- package/dist/style.ja-QV4Z4B3Y.cjs.map +1 -0
- package/dist/style.ko-KIKAE2WS.js +63 -0
- package/dist/style.ko-KIKAE2WS.js.map +1 -0
- package/dist/style.ko-WXYT3ZAL.cjs +65 -0
- package/dist/style.ko-WXYT3ZAL.cjs.map +1 -0
- package/dist/style.pt-BR-R6WOR67L.js +64 -0
- package/dist/style.pt-BR-R6WOR67L.js.map +1 -0
- package/dist/style.pt-BR-WWGO7RUX.cjs +66 -0
- package/dist/style.pt-BR-WWGO7RUX.cjs.map +1 -0
- package/dist/style.ru-UVLIITMR.js +63 -0
- package/dist/style.ru-UVLIITMR.js.map +1 -0
- package/dist/style.ru-ZCB4IUCW.cjs +65 -0
- package/dist/style.ru-ZCB4IUCW.cjs.map +1 -0
- package/dist/style.zh-CN-IFAAZ475.cjs +65 -0
- package/dist/style.zh-CN-IFAAZ475.cjs.map +1 -0
- package/dist/style.zh-CN-RQEZCV44.js +63 -0
- package/dist/style.zh-CN-RQEZCV44.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/audio-isolation-pricing.test.ts +49 -0
- package/src/__tests__/competitors.test.ts +6 -1
- package/src/__tests__/credit-identifiers.test.ts +9 -10
- package/src/__tests__/motion-transfer-pricing.test.ts +252 -0
- package/src/__tests__/normalize-node-params.test.ts +9 -2
- package/src/__tests__/style-sidecar-loaders.test.ts +29 -0
- package/src/__tests__/video-catalog-totality.test.ts +37 -5
- package/src/__tests__/video-to-video-pricing.test.ts +151 -0
- package/src/audio-isolation-pricing.ts +80 -0
- package/src/competitors.ts +8 -2
- package/src/credit-identifiers.ts +6 -0
- package/src/entries/credits.ts +54 -0
- package/src/entries/edl.ts +2 -0
- package/src/entries/i18n.ts +1 -0
- package/src/entries/models.ts +2 -0
- package/src/entries/social.ts +1 -0
- package/src/i18n/style-sidecar-loaders.ts +30 -0
- package/src/model-catalog.ts +49 -23
- package/src/model-constants.ts +24 -4
- package/src/motion-transfer-pricing.ts +239 -0
- package/src/producer-types.ts +2 -0
- package/src/use-case-output.ts +102 -0
- package/src/video-to-video-pricing.ts +248 -0
- package/dist/chunk-5DRSENY3.cjs.map +0 -1
- package/dist/chunk-BLGZW3UF.cjs.map +0 -1
- package/dist/chunk-HWBLZSM3.cjs.map +0 -1
- package/dist/chunk-JEUZNHLL.cjs.map +0 -1
- package/dist/chunk-KKFFQUMM.js.map +0 -1
- package/dist/chunk-LTBM2KMY.js.map +0 -1
- package/dist/chunk-M7LU4NTI.cjs.map +0 -1
- package/dist/chunk-O53P2D4V.js.map +0 -1
- package/dist/chunk-OW5AXH2Y.js.map +0 -1
- package/dist/chunk-R22UHRR6.js.map +0 -1
- package/dist/chunk-TADEEG5E.js.map +0 -1
- package/dist/chunk-WHV7MDNC.cjs.map +0 -1
- package/dist/chunk-XBHDXURR.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkAXDTMRWR_cjs = require('./chunk-AXDTMRWR.cjs');
|
|
4
4
|
|
|
5
5
|
// src/image-model-roles.ts
|
|
6
6
|
var IMAGE_MODEL_ROLE_DEFAULTS = {
|
|
@@ -17,7 +17,7 @@ var IMAGE_MODEL_RATIO_FALLBACKS = {
|
|
|
17
17
|
};
|
|
18
18
|
function imageModelDrawsRatio(modelId, aspectRatio) {
|
|
19
19
|
if (!aspectRatio) return true;
|
|
20
|
-
const ratios =
|
|
20
|
+
const ratios = chunkAXDTMRWR_cjs.MODEL_CATALOG[modelId]?.aspectRatios;
|
|
21
21
|
return ratios === void 0 || ratios.includes(aspectRatio);
|
|
22
22
|
}
|
|
23
23
|
function defaultImageModel(role, aspectRatio) {
|
|
@@ -47,13 +47,13 @@ function videoUpscaleModelOf(provider) {
|
|
|
47
47
|
}
|
|
48
48
|
function videoUpscaleResolutionsFor(provider) {
|
|
49
49
|
const id = videoUpscaleModelOf(provider || DEFAULT_VIDEO_UPSCALE_PROVIDER);
|
|
50
|
-
return
|
|
50
|
+
return chunkAXDTMRWR_cjs.MODEL_CATALOG[id]?.resolutions ?? [];
|
|
51
51
|
}
|
|
52
52
|
function normalizeVideoUpscaleResolution(provider, targetResolution) {
|
|
53
53
|
if (typeof targetResolution !== "string" || targetResolution === "") return { targetResolution: void 0 };
|
|
54
54
|
const id = videoUpscaleModelOf(provider || DEFAULT_VIDEO_UPSCALE_PROVIDER);
|
|
55
|
-
if ((
|
|
56
|
-
const normalized =
|
|
55
|
+
if ((chunkAXDTMRWR_cjs.MODEL_CATALOG[id]?.resolutions ?? []).length === 0) return { targetResolution };
|
|
56
|
+
const normalized = chunkAXDTMRWR_cjs.normalizeModelInput(id, { resolution: targetResolution });
|
|
57
57
|
const adjustment = normalized.adjustments.find((a) => a.field === "resolution");
|
|
58
58
|
return adjustment ? { targetResolution: normalized.resolution, adjustment } : { targetResolution: normalized.resolution };
|
|
59
59
|
}
|
|
@@ -67,5 +67,5 @@ exports.imageModelDrawsRatio = imageModelDrawsRatio;
|
|
|
67
67
|
exports.normalizeVideoUpscaleResolution = normalizeVideoUpscaleResolution;
|
|
68
68
|
exports.videoUpscaleModelOf = videoUpscaleModelOf;
|
|
69
69
|
exports.videoUpscaleResolutionsFor = videoUpscaleResolutionsFor;
|
|
70
|
-
//# sourceMappingURL=chunk-
|
|
71
|
-
//# sourceMappingURL=chunk-
|
|
70
|
+
//# sourceMappingURL=chunk-5WXVPPRH.cjs.map
|
|
71
|
+
//# sourceMappingURL=chunk-5WXVPPRH.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/image-model-roles.ts","../src/video-upscale-params.ts"],"names":["MODEL_CATALOG","normalizeModelInput"],"mappings":";;;;;AAuBO,IAAM,yBAAA,GAA4B;AAAA,EACvC,SAAA,EAAW,aAAA;AAAA,EACX,OAAA,EAAS,aAAA;AAAA,EACT,MAAA,EAAQ,aAAA;AAAA,EACR,IAAA,EAAM;AACR;AAWO,IAAM,2BAAA,GAAmF;AAAA,EAC9F,SAAA,EAAW,CAAC,wBAAA,EAA0B,wBAAA,EAA0B,iBAAiB,CAAA;AAAA,EACjF,OAAA,EAAS,CAAC,wBAAA,EAA0B,wBAAA,EAA0B,iBAAiB,CAAA;AAAA,EAC/E,MAAA,EAAQ,CAAC,wBAAA,EAA0B,wBAAA,EAA0B,iBAAiB,CAAA;AAAA,EAC9E,IAAA,EAAM,CAAC,4BAAA,EAA8B,4BAAA,EAA8B,iBAAiB;AACtF;AAGO,SAAS,oBAAA,CAAqB,SAAiB,WAAA,EAAsC;AAC1F,EAAA,IAAI,CAAC,aAAa,OAAO,IAAA;AACzB,EAAA,MAAM,MAAA,GAASA,+BAAA,CAAc,OAAO,CAAA,EAAG,YAAA;AACvC,EAAA,OAAO,MAAA,KAAW,MAAA,IAAa,MAAA,CAAO,QAAA,CAAS,WAAW,CAAA;AAC5D;AAQO,SAAS,iBAAA,CAAkB,MAAsB,WAAA,EAAqC;AAC3F,EAAA,MAAM,OAAA,GAAU,0BAA0B,IAAI,CAAA;AAC9C,EAAA,IAAI,oBAAA,CAAqB,OAAA,EAAS,WAAW,CAAA,EAAG,OAAO,OAAA;AACvD,EAAA,OAAO,2BAAA,CAA4B,IAAI,CAAA,CAAE,IAAA,CAAK,CAAC,OAAO,oBAAA,CAAqB,EAAA,EAAI,WAAW,CAAC,CAAA,IAAK,OAAA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AAoB,EAAA,EAAI,EAAE,UAAA,EAAY,kBAAkB,CAAA;AAC3E,EAAA,MAAM,UAAA,GAAa,WAAW,WAAA,CAAY,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,UAAU,YAAY,CAAA;AAC9E,EAAA,OAAO,UAAA,GAAa,EAAE,gBAAA,EAAkB,UAAA,CAAW,UAAA,EAAY,YAAW,GAAI,EAAE,gBAAA,EAAkB,UAAA,CAAW,UAAA,EAAW;AAC1H","file":"chunk-5WXVPPRH.cjs","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,4 +1,4 @@
|
|
|
1
|
-
import { MODEL_CATALOG, REPLICA_CONSENT_ATTESTATION } from './chunk-
|
|
1
|
+
import { MODEL_CATALOG, REPLICA_CONSENT_ATTESTATION } from './chunk-X7UDZGXW.js';
|
|
2
2
|
|
|
3
3
|
// src/tts-capabilities.ts
|
|
4
4
|
var TTS_PROVIDER_ALIASES = {
|
|
@@ -139,5 +139,5 @@ function replicaConsentProblem(value) {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
export { TTS_FALLBACK_PROVIDER, TTS_PROVIDER_ALIASES, canonicalTtsProvider, findTtsCapabilities, getTtsCapabilities, replicaConsentProblem, replicaModels, replicaOf, ttsAcceptsVoice, ttsAngleTags, ttsDirection, ttsDirectionFor, ttsDirectionProblem, ttsHasLever, ttsLanguageCodes, ttsNamedVoiceFor, ttsNamedVoices, ttsReplicaProblem, ttsSupportsAudioTags, ttsSupportsSsmlBreaks, ttsSupportsStitching, ttsSupportsTimestamps, ttsTakesReplica, ttsVoiceForModel };
|
|
142
|
-
//# sourceMappingURL=chunk-
|
|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AY,CAAA,iDAAA,EAAoD,eAAc,CAAE,IAAA,CAAK,IAAI,CAAC,CAAA,CAAA;AAAA,EAClH;AACA,EAAA,OAAO,SAAA,CAAU,KAAK,CAAA,GAAI,MAAA,GAAY,yFAAA;AACxC;AAQO,SAAS,sBAAsB,KAAA,EAAoC;AACxE,EAAA,IAAI,KAAA,KAAU,MAAA,IAAa,KAAA,KAAU,IAAA,EAAM,OAAO,MAAA;AAClD,EAAA,OAAQ,KAAA,CAAgC,OAAA,KAAY,IAAA,GAChD,MAAA,GACA,8CAA8C,2BAA2B,CAAA,CAAA,CAAA;AAC/E","file":"chunk-NS34PZ2S.js","sourcesContent":["/**\n * Capability lookups for the text-to-speech lane.\n *\n * Every \"does this model do X\" decision on that lane reads the model's `tts`\n * sheet in `MODEL_CATALOG` through these helpers — tag stripping, which voice\n * settings are sent and shown, the language picker, whether neighbouring text\n * is sent. Declare the sheet honestly\n * on the catalog entry and a new model is covered everywhere; do not compare a\n * provider id by hand.\n *\n * \"The text-to-speech lane\" means the models that list the `tts` mode. The\n * dialogue models carry a sheet too, read by `dialogue-capabilities.ts`; a\n * text-to-speech request that names one runs as the fallback model, so these\n * helpers answer for the fallback there.\n */\nimport { MODEL_CATALOG, type TtsCapabilities, type TtsDirectionSheet, type TtsSettingLever } from \"./model-catalog.js\"\nimport { REPLICA_CONSENT_ATTESTATION, type TtsNamedVoice, type TtsReplica } from \"./gemini-tts.js\"\n\n/** Legacy provider ids that are another model under an old name. They have no catalog entry of their own. */\nexport const TTS_PROVIDER_ALIASES: Readonly<Record<string, string>> = {\n elevenlabs: \"elevenlabs-turbo\",\n}\n\n/** The model a request runs on when its provider id is missing or unknown. */\nexport const TTS_FALLBACK_PROVIDER = \"elevenlabs-turbo\"\n\n/**\n * Resolve a legacy alias to the catalog id it runs as. Any other id passes\n * through unchanged. Own properties only: an id that happens to be the name of\n * an inherited object member (`constructor`, `__proto__`, `toString`) is an\n * unknown id like any other, never a function.\n */\nexport function canonicalTtsProvider(provider: string): string {\n return typeof provider === \"string\" && Object.hasOwn(TTS_PROVIDER_ALIASES, provider) ? TTS_PROVIDER_ALIASES[provider]! : provider\n}\n\n/** The capability sheet of a text-to-speech model, or `undefined` when the id is not one. */\nexport function findTtsCapabilities(provider: string | undefined): TtsCapabilities | undefined {\n // `typeof`: node data can be written straight into workflow JSON, so the \"string\" is not guaranteed — and\n // `Object.hasOwn` would coerce an array like [\"elevenlabs-v3\"] into that model's id. A non-string is an unknown id.\n if (typeof provider !== \"string\" || !provider) return undefined\n const id = canonicalTtsProvider(provider)\n if (!Object.hasOwn(MODEL_CATALOG, id)) return undefined\n const entry = MODEL_CATALOG[id]!\n return entry.modes.includes(\"tts\") ? entry.tts : undefined\n}\n\n/**\n * The capability sheet a text-to-speech request will actually run under: a\n * missing or unknown provider id runs as {@link TTS_FALLBACK_PROVIDER}, so it\n * gets that sheet — including its `maxChars` (turbo's 40,000), where\n * `getMaxTtsChars` keeps answering its 5,000 default for such ids.\n */\nexport function getTtsCapabilities(provider: string | undefined): TtsCapabilities {\n return findTtsCapabilities(provider) ?? MODEL_CATALOG[TTS_FALLBACK_PROVIDER]!.tts!\n}\n\n/** The model performs inline `[audio tags]`. false ⇒ strip them before sending. */\nexport function ttsSupportsAudioTags(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).audioTags\n}\n\n/** The model honours SSML `<break time=\"…\"/>` tags. */\nexport function ttsSupportsSsmlBreaks(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).ssmlBreaks\n}\n\n/**\n * The model conditions on neighbouring text (`previous_text` / `next_text`).\n * false ⇒ the provider funnel never puts the fields on the wire, whatever the\n * request carries — the model would reject them.\n */\nexport function ttsSupportsStitching(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).stitching\n}\n\n/** The model honours this voice-setting lever. */\nexport function ttsHasLever(provider: string | undefined, lever: TtsSettingLever): boolean {\n return getTtsCapabilities(provider).levers.includes(lever)\n}\n\n/** The model answers `/v1/text-to-speech/{voice}/with-timestamps` (character timings). */\nexport function ttsSupportsTimestamps(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).timestamps\n}\n\n/** Language codes offered for the model, in catalog order. */\nexport function ttsLanguageCodes(provider: string | undefined): readonly string[] {\n return getTtsCapabilities(provider).languages\n}\n\n/**\n * The named voices the model speaks, or `undefined` when it speaks the\n * ElevenLabs voices (premade, library, clones). See `TtsCapabilities.voices`.\n */\nexport function ttsNamedVoices(provider: string | undefined): readonly TtsNamedVoice[] | undefined {\n return getTtsCapabilities(provider).voices\n}\n\n/**\n * Whether `voice` is one the model can speak: on a model with named voices,\n * one of them by its exact wire name; on any other model, any id (the\n * ElevenLabs voice checks apply there, as before).\n */\nexport function ttsAcceptsVoice(provider: string | undefined, voice: string): boolean {\n const named = ttsNamedVoices(provider)\n return !named || named.some((v) => v.id === voice)\n}\n\n/**\n * The voice a request on a named-voice model runs with: the one it names when\n * the model speaks it, else the model's default. `undefined` on an ElevenLabs\n * model (its own default applies downstream).\n */\nexport function ttsNamedVoiceFor(provider: string | undefined, voice: unknown): string | undefined {\n const caps = getTtsCapabilities(provider)\n if (!caps.voices) return undefined\n return typeof voice === \"string\" && caps.voices.some((v) => v.id === voice) ? voice : caps.defaultVoice\n}\n\n/** The style direction the model takes (`TtsCapabilities.direction`), or `undefined` when it takes none. */\nexport function ttsDirection(provider: string | undefined): TtsDirectionSheet | undefined {\n return getTtsCapabilities(provider).direction\n}\n\n/** The model writes its tone tags `<in angle brackets>` from a closed list (`TtsCapabilities.tagSyntax`). */\nexport function ttsAngleTags(provider: string | undefined): readonly string[] | undefined {\n const caps = getTtsCapabilities(provider)\n return caps.audioTags && caps.tagSyntax === \"angle\" ? (caps.tags ?? []) : undefined\n}\n\n/**\n * The style direction of a request, as the model takes it: each field kept\n * only when the model's sheet names it and the value is one it accepts (a\n * listed choice, or free text within its cap — trimmed, an empty one\n * dropped). What the provider funnel sends and the workflow engine passes on;\n * the REST route rejects instead of dropping (`ttsDirectionProblem`).\n */\nexport interface TtsDirectionValues {\n styleDirection?: string\n pace?: string\n accent?: string\n audioProfile?: string\n}\n\nexport function ttsDirectionFor(provider: string | undefined, values: Readonly<Record<string, unknown>>): TtsDirectionValues {\n const sheet = ttsDirection(provider)\n if (!sheet) return {}\n const text = (value: unknown, max: number | undefined): string | undefined => {\n if (max === undefined || typeof value !== \"string\") return undefined\n const trimmed = value.trim()\n return trimmed && trimmed.length <= max ? trimmed : undefined\n }\n const choice = (value: unknown, choices: readonly string[] | undefined): string | undefined =>\n choices && typeof value === \"string\" && choices.includes(value) ? value : undefined\n const out: TtsDirectionValues = {}\n const style = sheet.styles ? choice(values.styleDirection, sheet.styles) : text(values.styleDirection, sheet.styleMaxChars)\n if (style !== undefined) out.styleDirection = style\n const pace = choice(values.pace, sheet.paces)\n if (pace !== undefined) out.pace = pace\n const accent = choice(values.accent, sheet.accents)\n if (accent !== undefined) out.accent = accent\n const profile = text(values.audioProfile, sheet.audioProfileMaxChars)\n if (profile !== undefined) out.audioProfile = profile\n return out\n}\n\n/**\n * Why a request's style direction cannot run on the model, or `undefined`\n * when it can. Only the fields the model takes are judged; on a model that\n * takes none, or a field it does not take, the value is never sent (as the\n * neighbour text on a model that does not stitch), so it is no problem.\n */\nexport function ttsDirectionProblem(provider: string | undefined, values: Readonly<Record<string, unknown>>): { field: keyof TtsDirectionValues; message: string } | undefined {\n const sheet = ttsDirection(provider)\n if (!sheet) return undefined\n const textProblem = (field: keyof TtsDirectionValues, max: number | undefined) => {\n const value = values[field]\n if (max === undefined || value === undefined) return undefined\n if (typeof value !== \"string\") return { field, message: `${field} must be a string` }\n return value.trim().length > max ? { field, message: `${field} must be at most ${max} characters` } : undefined\n }\n const choiceProblem = (field: keyof TtsDirectionValues, choices: readonly string[] | undefined) => {\n const value = values[field]\n if (!choices || value === undefined || value === \"\") return undefined\n return typeof value === \"string\" && choices.includes(value) ? undefined : { field, message: `${field} must be one of: ${choices.join(\", \")}` }\n }\n return (\n (sheet.styles ? choiceProblem(\"styleDirection\", sheet.styles) : textProblem(\"styleDirection\", sheet.styleMaxChars)) ??\n choiceProblem(\"pace\", sheet.paces) ??\n choiceProblem(\"accent\", sheet.accents) ??\n textProblem(\"audioProfile\", sheet.audioProfileMaxChars)\n )\n}\n\n/** Every voice name a named-voice model speaks (all of them, across models). Built once from the catalog. */\nlet namedVoiceIds: ReadonlySet<string> | undefined\nfunction anyModelsNamedVoice(voice: string): boolean {\n namedVoiceIds ??= new Set(\n Object.values(MODEL_CATALOG).flatMap((m) => (m.modes.includes(\"tts\") ? (m.tts?.voices ?? []).map((v) => v.id) : [])),\n )\n return namedVoiceIds.has(voice)\n}\n\n/**\n * The voice a text-to-speech run on `provider` speaks, when the model and the\n * voice may have been chosen apart — a published app's Model card, a field\n * mapping onto the model, an upstream Character's voice, a preset's voice with\n * a model the caller named (decided 2026-11-13: the editor's model-switch rule,\n * applied wherever the editor is not there to apply it):\n * - a model with named voices (Gemini): the voice when it is one of them, its\n * default voice for any other voice, and none (its default) for none;\n * - an ElevenLabs model: none (the deployment's default) for a voice that only\n * a named-voice model speaks (`Fola`, `Kore`…), else the voice as given.\n * Returns `undefined` for \"no voice named\"; never a voice the model refuses.\n */\nexport function ttsVoiceForModel(provider: string | undefined, voice: unknown): string | undefined {\n const named = typeof voice === \"string\" && voice.length > 0 ? voice : undefined\n const caps = getTtsCapabilities(provider)\n if (caps.voices) {\n if (named === undefined) return undefined\n return caps.voices.some((v) => v.id === named) ? named : caps.defaultVoice\n }\n return named !== undefined && anyModelsNamedVoice(named) ? undefined : named\n}\n\n/** The model clones a speaker's voice for one request (`TtsCapabilities.replica`: Gemini 3.8 Flash). */\nexport function ttsTakesReplica(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).replica === true\n}\n\n/** Every model that takes a one-off clone, in catalog order (for a refusal's sentence). */\nexport function replicaModels(): string[] {\n return Object.values(MODEL_CATALOG).filter((m) => m.modes.includes(\"tts\") && m.tts?.replica === true).map((m) => m.id)\n}\n\n/** Whether `value` is an https link (the only scheme a recording is fetched from). */\nfunction isHttpsLink(value: unknown): value is string {\n if (typeof value !== \"string\") return false\n try {\n return new URL(value).protocol === \"https:\"\n } catch {\n return false\n }\n}\n\n/** A request's one-off clone as the platform reads it: two https links, or undefined when absent or not that shape. */\nexport function replicaOf(value: unknown): TtsReplica | undefined {\n if (!value || typeof value !== \"object\") return undefined\n const { sourceAudioUrl, consentAudioUrl } = value as Record<string, unknown>\n return isHttpsLink(sourceAudioUrl) && isHttpsLink(consentAudioUrl) ? { sourceAudioUrl, consentAudioUrl } : undefined\n}\n\n/**\n * Why a request's one-off clone (`replica`) cannot run on the model, or\n * undefined (none asked, or one it takes). Refused, never dropped: a clone\n * that is not sent is someone else's voice. The recordings themselves (WAV,\n * size, length) are judged where they are fetched (backend\n * `lib/voice-replica.ts`).\n */\nexport function ttsReplicaProblem(provider: string | undefined, value: unknown): string | undefined {\n if (value === undefined || value === null) return undefined\n if (!ttsTakesReplica(provider)) {\n return `${provider ?? \"This model\"} does not clone a voice; a one-off clone runs on ${replicaModels().join(\", \")}`\n }\n return replicaOf(value) ? undefined : \"replica needs sourceAudioUrl and consentAudioUrl, each an https link to a WAV recording\"\n}\n\n/**\n * Why an API or MCP clone lacks its consent, or undefined: a `replica` asked\n * must say `consent: true` — the caller's confirmation of\n * `REPLICA_CONSENT_ATTESTATION`, what the editor's checkbox says (decided\n * 2026-11-13). Refused before anything is read or held.\n */\nexport function replicaConsentProblem(value: unknown): string | undefined {\n if (value === undefined || value === null) return undefined\n return (value as { consent?: unknown }).consent === true\n ? undefined\n : `replica.consent must be true: it confirms \"${REPLICA_CONSENT_ATTESTATION}\"`\n}\n\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/tts-capabilities.ts"],"names":[],"mappings":";;;AAmBO,IAAM,oBAAA,GAAyD;AAAA,EACpE,UAAA,EAAY;AACd;AAGO,IAAM,qBAAA,GAAwB;AAQ9B,SAAS,qBAAqB,QAAA,EAA0B;AAC7D,EAAA,OAAO,OAAO,QAAA,KAAa,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CAAA,CAAA;AAC/E","file":"chunk-7DMK7B3Q.js","sourcesContent":["/**\n * Capability lookups for the text-to-speech lane.\n *\n * Every \"does this model do X\" decision on that lane reads the model's `tts`\n * sheet in `MODEL_CATALOG` through these helpers — tag stripping, which voice\n * settings are sent and shown, the language picker, whether neighbouring text\n * is sent. Declare the sheet honestly\n * on the catalog entry and a new model is covered everywhere; do not compare a\n * provider id by hand.\n *\n * \"The text-to-speech lane\" means the models that list the `tts` mode. The\n * dialogue models carry a sheet too, read by `dialogue-capabilities.ts`; a\n * text-to-speech request that names one runs as the fallback model, so these\n * helpers answer for the fallback there.\n */\nimport { MODEL_CATALOG, type TtsCapabilities, type TtsDirectionSheet, type TtsSettingLever } from \"./model-catalog.js\"\nimport { REPLICA_CONSENT_ATTESTATION, type TtsNamedVoice, type TtsReplica } from \"./gemini-tts.js\"\n\n/** Legacy provider ids that are another model under an old name. They have no catalog entry of their own. */\nexport const TTS_PROVIDER_ALIASES: Readonly<Record<string, string>> = {\n elevenlabs: \"elevenlabs-turbo\",\n}\n\n/** The model a request runs on when its provider id is missing or unknown. */\nexport const TTS_FALLBACK_PROVIDER = \"elevenlabs-turbo\"\n\n/**\n * Resolve a legacy alias to the catalog id it runs as. Any other id passes\n * through unchanged. Own properties only: an id that happens to be the name of\n * an inherited object member (`constructor`, `__proto__`, `toString`) is an\n * unknown id like any other, never a function.\n */\nexport function canonicalTtsProvider(provider: string): string {\n return typeof provider === \"string\" && Object.hasOwn(TTS_PROVIDER_ALIASES, provider) ? TTS_PROVIDER_ALIASES[provider]! : provider\n}\n\n/** The capability sheet of a text-to-speech model, or `undefined` when the id is not one. */\nexport function findTtsCapabilities(provider: string | undefined): TtsCapabilities | undefined {\n // `typeof`: node data can be written straight into workflow JSON, so the \"string\" is not guaranteed — and\n // `Object.hasOwn` would coerce an array like [\"elevenlabs-v3\"] into that model's id. A non-string is an unknown id.\n if (typeof provider !== \"string\" || !provider) return undefined\n const id = canonicalTtsProvider(provider)\n if (!Object.hasOwn(MODEL_CATALOG, id)) return undefined\n const entry = MODEL_CATALOG[id]!\n return entry.modes.includes(\"tts\") ? entry.tts : undefined\n}\n\n/**\n * The capability sheet a text-to-speech request will actually run under: a\n * missing or unknown provider id runs as {@link TTS_FALLBACK_PROVIDER}, so it\n * gets that sheet — including its `maxChars` (turbo's 40,000), where\n * `getMaxTtsChars` keeps answering its 5,000 default for such ids.\n */\nexport function getTtsCapabilities(provider: string | undefined): TtsCapabilities {\n return findTtsCapabilities(provider) ?? MODEL_CATALOG[TTS_FALLBACK_PROVIDER]!.tts!\n}\n\n/** The model performs inline `[audio tags]`. false ⇒ strip them before sending. */\nexport function ttsSupportsAudioTags(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).audioTags\n}\n\n/** The model honours SSML `<break time=\"…\"/>` tags. */\nexport function ttsSupportsSsmlBreaks(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).ssmlBreaks\n}\n\n/**\n * The model conditions on neighbouring text (`previous_text` / `next_text`).\n * false ⇒ the provider funnel never puts the fields on the wire, whatever the\n * request carries — the model would reject them.\n */\nexport function ttsSupportsStitching(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).stitching\n}\n\n/** The model honours this voice-setting lever. */\nexport function ttsHasLever(provider: string | undefined, lever: TtsSettingLever): boolean {\n return getTtsCapabilities(provider).levers.includes(lever)\n}\n\n/** The model answers `/v1/text-to-speech/{voice}/with-timestamps` (character timings). */\nexport function ttsSupportsTimestamps(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).timestamps\n}\n\n/** Language codes offered for the model, in catalog order. */\nexport function ttsLanguageCodes(provider: string | undefined): readonly string[] {\n return getTtsCapabilities(provider).languages\n}\n\n/**\n * The named voices the model speaks, or `undefined` when it speaks the\n * ElevenLabs voices (premade, library, clones). See `TtsCapabilities.voices`.\n */\nexport function ttsNamedVoices(provider: string | undefined): readonly TtsNamedVoice[] | undefined {\n return getTtsCapabilities(provider).voices\n}\n\n/**\n * Whether `voice` is one the model can speak: on a model with named voices,\n * one of them by its exact wire name; on any other model, any id (the\n * ElevenLabs voice checks apply there, as before).\n */\nexport function ttsAcceptsVoice(provider: string | undefined, voice: string): boolean {\n const named = ttsNamedVoices(provider)\n return !named || named.some((v) => v.id === voice)\n}\n\n/**\n * The voice a request on a named-voice model runs with: the one it names when\n * the model speaks it, else the model's default. `undefined` on an ElevenLabs\n * model (its own default applies downstream).\n */\nexport function ttsNamedVoiceFor(provider: string | undefined, voice: unknown): string | undefined {\n const caps = getTtsCapabilities(provider)\n if (!caps.voices) return undefined\n return typeof voice === \"string\" && caps.voices.some((v) => v.id === voice) ? voice : caps.defaultVoice\n}\n\n/** The style direction the model takes (`TtsCapabilities.direction`), or `undefined` when it takes none. */\nexport function ttsDirection(provider: string | undefined): TtsDirectionSheet | undefined {\n return getTtsCapabilities(provider).direction\n}\n\n/** The model writes its tone tags `<in angle brackets>` from a closed list (`TtsCapabilities.tagSyntax`). */\nexport function ttsAngleTags(provider: string | undefined): readonly string[] | undefined {\n const caps = getTtsCapabilities(provider)\n return caps.audioTags && caps.tagSyntax === \"angle\" ? (caps.tags ?? []) : undefined\n}\n\n/**\n * The style direction of a request, as the model takes it: each field kept\n * only when the model's sheet names it and the value is one it accepts (a\n * listed choice, or free text within its cap — trimmed, an empty one\n * dropped). What the provider funnel sends and the workflow engine passes on;\n * the REST route rejects instead of dropping (`ttsDirectionProblem`).\n */\nexport interface TtsDirectionValues {\n styleDirection?: string\n pace?: string\n accent?: string\n audioProfile?: string\n}\n\nexport function ttsDirectionFor(provider: string | undefined, values: Readonly<Record<string, unknown>>): TtsDirectionValues {\n const sheet = ttsDirection(provider)\n if (!sheet) return {}\n const text = (value: unknown, max: number | undefined): string | undefined => {\n if (max === undefined || typeof value !== \"string\") return undefined\n const trimmed = value.trim()\n return trimmed && trimmed.length <= max ? trimmed : undefined\n }\n const choice = (value: unknown, choices: readonly string[] | undefined): string | undefined =>\n choices && typeof value === \"string\" && choices.includes(value) ? value : undefined\n const out: TtsDirectionValues = {}\n const style = sheet.styles ? choice(values.styleDirection, sheet.styles) : text(values.styleDirection, sheet.styleMaxChars)\n if (style !== undefined) out.styleDirection = style\n const pace = choice(values.pace, sheet.paces)\n if (pace !== undefined) out.pace = pace\n const accent = choice(values.accent, sheet.accents)\n if (accent !== undefined) out.accent = accent\n const profile = text(values.audioProfile, sheet.audioProfileMaxChars)\n if (profile !== undefined) out.audioProfile = profile\n return out\n}\n\n/**\n * Why a request's style direction cannot run on the model, or `undefined`\n * when it can. Only the fields the model takes are judged; on a model that\n * takes none, or a field it does not take, the value is never sent (as the\n * neighbour text on a model that does not stitch), so it is no problem.\n */\nexport function ttsDirectionProblem(provider: string | undefined, values: Readonly<Record<string, unknown>>): { field: keyof TtsDirectionValues; message: string } | undefined {\n const sheet = ttsDirection(provider)\n if (!sheet) return undefined\n const textProblem = (field: keyof TtsDirectionValues, max: number | undefined) => {\n const value = values[field]\n if (max === undefined || value === undefined) return undefined\n if (typeof value !== \"string\") return { field, message: `${field} must be a string` }\n return value.trim().length > max ? { field, message: `${field} must be at most ${max} characters` } : undefined\n }\n const choiceProblem = (field: keyof TtsDirectionValues, choices: readonly string[] | undefined) => {\n const value = values[field]\n if (!choices || value === undefined || value === \"\") return undefined\n return typeof value === \"string\" && choices.includes(value) ? undefined : { field, message: `${field} must be one of: ${choices.join(\", \")}` }\n }\n return (\n (sheet.styles ? choiceProblem(\"styleDirection\", sheet.styles) : textProblem(\"styleDirection\", sheet.styleMaxChars)) ??\n choiceProblem(\"pace\", sheet.paces) ??\n choiceProblem(\"accent\", sheet.accents) ??\n textProblem(\"audioProfile\", sheet.audioProfileMaxChars)\n )\n}\n\n/** Every voice name a named-voice model speaks (all of them, across models). Built once from the catalog. */\nlet namedVoiceIds: ReadonlySet<string> | undefined\nfunction anyModelsNamedVoice(voice: string): boolean {\n namedVoiceIds ??= new Set(\n Object.values(MODEL_CATALOG).flatMap((m) => (m.modes.includes(\"tts\") ? (m.tts?.voices ?? []).map((v) => v.id) : [])),\n )\n return namedVoiceIds.has(voice)\n}\n\n/**\n * The voice a text-to-speech run on `provider` speaks, when the model and the\n * voice may have been chosen apart — a published app's Model card, a field\n * mapping onto the model, an upstream Character's voice, a preset's voice with\n * a model the caller named (decided 2026-11-13: the editor's model-switch rule,\n * applied wherever the editor is not there to apply it):\n * - a model with named voices (Gemini): the voice when it is one of them, its\n * default voice for any other voice, and none (its default) for none;\n * - an ElevenLabs model: none (the deployment's default) for a voice that only\n * a named-voice model speaks (`Fola`, `Kore`…), else the voice as given.\n * Returns `undefined` for \"no voice named\"; never a voice the model refuses.\n */\nexport function ttsVoiceForModel(provider: string | undefined, voice: unknown): string | undefined {\n const named = typeof voice === \"string\" && voice.length > 0 ? voice : undefined\n const caps = getTtsCapabilities(provider)\n if (caps.voices) {\n if (named === undefined) return undefined\n return caps.voices.some((v) => v.id === named) ? named : caps.defaultVoice\n }\n return named !== undefined && anyModelsNamedVoice(named) ? undefined : named\n}\n\n/** The model clones a speaker's voice for one request (`TtsCapabilities.replica`: Gemini 3.8 Flash). */\nexport function ttsTakesReplica(provider: string | undefined): boolean {\n return getTtsCapabilities(provider).replica === true\n}\n\n/** Every model that takes a one-off clone, in catalog order (for a refusal's sentence). */\nexport function replicaModels(): string[] {\n return Object.values(MODEL_CATALOG).filter((m) => m.modes.includes(\"tts\") && m.tts?.replica === true).map((m) => m.id)\n}\n\n/** Whether `value` is an https link (the only scheme a recording is fetched from). */\nfunction isHttpsLink(value: unknown): value is string {\n if (typeof value !== \"string\") return false\n try {\n return new URL(value).protocol === \"https:\"\n } catch {\n return false\n }\n}\n\n/** A request's one-off clone as the platform reads it: two https links, or undefined when absent or not that shape. */\nexport function replicaOf(value: unknown): TtsReplica | undefined {\n if (!value || typeof value !== \"object\") return undefined\n const { sourceAudioUrl, consentAudioUrl } = value as Record<string, unknown>\n return isHttpsLink(sourceAudioUrl) && isHttpsLink(consentAudioUrl) ? { sourceAudioUrl, consentAudioUrl } : undefined\n}\n\n/**\n * Why a request's one-off clone (`replica`) cannot run on the model, or\n * undefined (none asked, or one it takes). Refused, never dropped: a clone\n * that is not sent is someone else's voice. The recordings themselves (WAV,\n * size, length) are judged where they are fetched (backend\n * `lib/voice-replica.ts`).\n */\nexport function ttsReplicaProblem(provider: string | undefined, value: unknown): string | undefined {\n if (value === undefined || value === null) return undefined\n if (!ttsTakesReplica(provider)) {\n return `${provider ?? \"This model\"} does not clone a voice; a one-off clone runs on ${replicaModels().join(\", \")}`\n }\n return replicaOf(value) ? undefined : \"replica needs sourceAudioUrl and consentAudioUrl, each an https link to a WAV recording\"\n}\n\n/**\n * Why an API or MCP clone lacks its consent, or undefined: a `replica` asked\n * must say `consent: true` — the caller's confirmation of\n * `REPLICA_CONSENT_ATTESTATION`, what the editor's checkbox says (decided\n * 2026-11-13). Refused before anything is read or held.\n */\nexport function replicaConsentProblem(value: unknown): string | undefined {\n if (value === undefined || value === null) return undefined\n return (value as { consent?: unknown }).consent === true\n ? undefined\n : `replica.consent must be true: it confirms \"${REPLICA_CONSENT_ATTESTATION}\"`\n}\n\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOALWH5VV_cjs = require('./chunk-OALWH5VV.cjs');
|
|
4
4
|
var chunkU4DIGIC3_cjs = require('./chunk-U4DIGIC3.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var chunkL2WHTUBA_cjs = require('./chunk-L2WHTUBA.cjs');
|
|
6
|
+
var chunkAXDTMRWR_cjs = require('./chunk-AXDTMRWR.cjs');
|
|
7
7
|
|
|
8
8
|
// src/producer-types.ts
|
|
9
9
|
var VIDEO_PRODUCER_TYPES = chunkU4DIGIC3_cjs.composeUnitSet("VIDEO_PRODUCER_TYPES", [
|
|
@@ -53,6 +53,8 @@ var VIDEO_PRODUCER_TYPES = chunkU4DIGIC3_cjs.composeUnitSet("VIDEO_PRODUCER_TYPE
|
|
|
53
53
|
"video-sfx",
|
|
54
54
|
"suno-music-video",
|
|
55
55
|
"merge-video-audio",
|
|
56
|
+
// Replace Audio (Nodaro Cloud plugin): the video with its sound replaced → video.
|
|
57
|
+
"replace-audio",
|
|
56
58
|
"add-captions",
|
|
57
59
|
"resize-video",
|
|
58
60
|
"social-media-format",
|
|
@@ -241,7 +243,7 @@ var FAN_OUT_EACH_HANDLES = chunkU4DIGIC3_cjs.composeUnitRecord("FAN_OUT_EACH_HAN
|
|
|
241
243
|
// handle of such a member would fan out. Its one run writes the tickets as
|
|
242
244
|
// its list (`listResults`, the editor's `__listResults`). The pip an edge
|
|
243
245
|
// with no handle reads is the UGC wires' own (UGC_PRIMARY_HANDLE).
|
|
244
|
-
"ugc-clips": { each: ["clips"], primary:
|
|
246
|
+
"ugc-clips": { each: ["clips"], primary: chunkOALWH5VV_cjs.UGC_PRIMARY_HANDLE["ugc-clips"] }
|
|
245
247
|
// A node unit declares its row in unit.json (contract.fanOutEach); it is added after these.
|
|
246
248
|
}, chunkU4DIGIC3_cjs.unitFanOutEach());
|
|
247
249
|
var FAN_OUT_ALL_OR_NOTHING_TYPES = /* @__PURE__ */ new Set(["ugc-clip"]);
|
|
@@ -313,18 +315,18 @@ function isFanInEdge(targetType, targetHandle) {
|
|
|
313
315
|
|
|
314
316
|
// src/video-ui-defaults.ts
|
|
315
317
|
function uiAspectRatioFill(provider) {
|
|
316
|
-
if (
|
|
317
|
-
if (
|
|
318
|
+
if (chunkL2WHTUBA_cjs.isSeedance2Provider(provider) || chunkL2WHTUBA_cjs.isMinimaxH3Provider(provider) || chunkL2WHTUBA_cjs.isWan3Provider(provider)) return "adaptive";
|
|
319
|
+
if (chunkL2WHTUBA_cjs.isKling4RunnerProvider(provider)) return "auto";
|
|
318
320
|
return void 0;
|
|
319
321
|
}
|
|
320
322
|
function uiResolutionFill(provider) {
|
|
321
|
-
if (
|
|
322
|
-
if (
|
|
323
|
+
if (chunkL2WHTUBA_cjs.isWan3Provider(provider) || chunkL2WHTUBA_cjs.isViduQ4Provider(provider) || chunkL2WHTUBA_cjs.isKling4RunnerProvider(provider) || chunkL2WHTUBA_cjs.isGeminiOmniPerSecondProvider(provider) || chunkL2WHTUBA_cjs.isPixverseV6MaxProvider(provider)) return chunkL2WHTUBA_cjs.PRICING_DEFAULT_RESOLUTION[provider];
|
|
324
|
+
if (chunkL2WHTUBA_cjs.isSeedance2Provider(provider)) return chunkAXDTMRWR_cjs.MODEL_CATALOG[provider]?.resolutions?.[0];
|
|
323
325
|
return void 0;
|
|
324
326
|
}
|
|
325
327
|
function uiDurationFill(provider) {
|
|
326
|
-
if (
|
|
327
|
-
if (
|
|
328
|
+
if (chunkL2WHTUBA_cjs.isWan3Provider(provider) || chunkL2WHTUBA_cjs.isViduQ4Provider(provider) || chunkL2WHTUBA_cjs.isKling4RunnerProvider(provider) || chunkL2WHTUBA_cjs.isPixverseV6MaxProvider(provider)) return 5;
|
|
329
|
+
if (chunkL2WHTUBA_cjs.isGeminiOmniProvider(provider)) return 8;
|
|
328
330
|
return void 0;
|
|
329
331
|
}
|
|
330
332
|
|
|
@@ -347,5 +349,5 @@ exports.ownsItsList = ownsItsList;
|
|
|
347
349
|
exports.uiAspectRatioFill = uiAspectRatioFill;
|
|
348
350
|
exports.uiDurationFill = uiDurationFill;
|
|
349
351
|
exports.uiResolutionFill = uiResolutionFill;
|
|
350
|
-
//# sourceMappingURL=chunk-
|
|
351
|
-
//# sourceMappingURL=chunk-
|
|
352
|
+
//# sourceMappingURL=chunk-AIPOZKQV.cjs.map
|
|
353
|
+
//# sourceMappingURL=chunk-AIPOZKQV.cjs.map
|
|
@@ -1 +1 @@
|
|
|
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;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BAAA,CAAwB,QAAQ,CAAA,EAAG,OAAO,CAAA;AAC5I,EAAA,IAAI,oBAAA,CAAqB,QAAQ,CAAA,EAAG,OAAO,CAAA;AAC3C,EAAA,OAAO,MAAA;AACT","file":"chunk-PKWRAMVB.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":["composeUnitSet","unitProducers","composeUnitRecord","UGC_PRIMARY_HANDLE","unitFanOutEach","unitListPips","isSeedance2Provider","isMinimaxH3Provider","isWan3Provider","isKling4RunnerProvider","isViduQ4Provider","isGeminiOmniPerSecondProvider","isPixverseV6MaxProvider","PRICING_DEFAULT_RESOLUTION","MODEL_CATALOG","isGeminiOmniProvider"],"mappings":";;;;;;;;AA2BO,IAAM,oBAAA,GAA4CA,iCAAe,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,EACA,cAAA;AAAA,EACA,eAA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,QAAQ,CAAA,EAAG,OAAO,CAAA;AAC3C,EAAA,OAAO,MAAA;AACT","file":"chunk-AIPOZKQV.cjs","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 // Replace Audio (Nodaro Cloud plugin): the video with its sound replaced → video.\n \"replace-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"]}
|