@nodaro/shared 3.63.0 → 3.65.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.
Files changed (265) hide show
  1. package/dist/{chunk-3K24DWOH.js → chunk-222QM7CO.js} +3 -3
  2. package/dist/{chunk-3K24DWOH.js.map → chunk-222QM7CO.js.map} +1 -1
  3. package/dist/chunk-27HA6YOL.cjs +377 -0
  4. package/dist/chunk-27HA6YOL.cjs.map +1 -0
  5. package/dist/{chunk-4DVWXEB6.js → chunk-2NKF476Z.js} +3 -3
  6. package/dist/{chunk-4DVWXEB6.js.map → chunk-2NKF476Z.js.map} +1 -1
  7. package/dist/chunk-3AU52TSW.js +143 -0
  8. package/dist/chunk-3AU52TSW.js.map +1 -0
  9. package/dist/{chunk-F6WGGYQW.cjs → chunk-5NVGKXJV.cjs} +68 -29
  10. package/dist/chunk-5NVGKXJV.cjs.map +1 -0
  11. package/dist/{chunk-HWQ2SYNA.js → chunk-5SSMPYE5.js} +99 -9
  12. package/dist/chunk-5SSMPYE5.js.map +1 -0
  13. package/dist/{chunk-WRSWH7US.cjs → chunk-6BRWPJPP.cjs} +17 -2
  14. package/dist/chunk-6BRWPJPP.cjs.map +1 -0
  15. package/dist/{chunk-KHH54GRP.cjs → chunk-6ET3KDO4.cjs} +15 -338
  16. package/dist/chunk-6ET3KDO4.cjs.map +1 -0
  17. package/dist/{chunk-TM5JYSJF.cjs → chunk-6OSIOVF7.cjs} +98 -37
  18. package/dist/chunk-6OSIOVF7.cjs.map +1 -0
  19. package/dist/{chunk-YUER7TJG.js → chunk-6X5PBAC4.js} +13 -4
  20. package/dist/chunk-6X5PBAC4.js.map +1 -0
  21. package/dist/chunk-7BN4EDIC.cjs +185 -0
  22. package/dist/chunk-7BN4EDIC.cjs.map +1 -0
  23. package/dist/{chunk-6M563QE6.js → chunk-7OWXHW7Z.js} +78 -28
  24. package/dist/chunk-7OWXHW7Z.js.map +1 -0
  25. package/dist/{chunk-FXGNRYQQ.js → chunk-AT53ZQUC.js} +3 -3
  26. package/dist/{chunk-FXGNRYQQ.js.map → chunk-AT53ZQUC.js.map} +1 -1
  27. package/dist/{chunk-HSHCCBIV.js → chunk-BQYCZLMF.js} +16 -3
  28. package/dist/chunk-BQYCZLMF.js.map +1 -0
  29. package/dist/{chunk-34QLPTSA.js → chunk-BSTAAGLY.js} +3 -3
  30. package/dist/{chunk-34QLPTSA.js.map → chunk-BSTAAGLY.js.map} +1 -1
  31. package/dist/{chunk-PSKZKLDG.js → chunk-CW6MMQNO.js} +562 -26
  32. package/dist/chunk-CW6MMQNO.js.map +1 -0
  33. package/dist/{chunk-EPXGG27L.js → chunk-D5Y3EYRM.js} +5 -5
  34. package/dist/{chunk-EPXGG27L.js.map → chunk-D5Y3EYRM.js.map} +1 -1
  35. package/dist/{chunk-XGVJGNZW.cjs → chunk-DQ2PARNH.cjs} +15 -5
  36. package/dist/chunk-DQ2PARNH.cjs.map +1 -0
  37. package/dist/{chunk-6BZC2ZHC.cjs → chunk-E66HSC2E.cjs} +9 -9
  38. package/dist/{chunk-6BZC2ZHC.cjs.map → chunk-E66HSC2E.cjs.map} +1 -1
  39. package/dist/{chunk-NIAFR5EE.js → chunk-FGBGKBML.js} +32 -3
  40. package/dist/chunk-FGBGKBML.js.map +1 -0
  41. package/dist/{chunk-M5OCFGHF.cjs → chunk-FI3HJZWM.cjs} +588 -25
  42. package/dist/chunk-FI3HJZWM.cjs.map +1 -0
  43. package/dist/{chunk-L2TVY6XN.cjs → chunk-FJZTQTF4.cjs} +4 -4
  44. package/dist/{chunk-L2TVY6XN.cjs.map → chunk-FJZTQTF4.cjs.map} +1 -1
  45. package/dist/{chunk-XGGZWA4A.cjs → chunk-GJ3D5X4X.cjs} +52 -49
  46. package/dist/chunk-GJ3D5X4X.cjs.map +1 -0
  47. package/dist/{chunk-Q6IES3U2.js → chunk-H5KHWTAE.js} +5 -2
  48. package/dist/chunk-H5KHWTAE.js.map +1 -0
  49. package/dist/{chunk-MD4XHED4.js → chunk-H745DQ6V.js} +3 -3
  50. package/dist/{chunk-MD4XHED4.js.map → chunk-H745DQ6V.js.map} +1 -1
  51. package/dist/{chunk-KCZHQH2O.js → chunk-HAH2F7LT.js} +4 -4
  52. package/dist/{chunk-KCZHQH2O.js.map → chunk-HAH2F7LT.js.map} +1 -1
  53. package/dist/{chunk-V5EEQR2U.cjs → chunk-JQMFJAYU.cjs} +21 -21
  54. package/dist/{chunk-V5EEQR2U.cjs.map → chunk-JQMFJAYU.cjs.map} +1 -1
  55. package/dist/{chunk-WZVIBAKN.cjs → chunk-JYU5EIRM.cjs} +12 -12
  56. package/dist/{chunk-WZVIBAKN.cjs.map → chunk-JYU5EIRM.cjs.map} +1 -1
  57. package/dist/{chunk-Y35JQPT6.cjs → chunk-K6RIN3LW.cjs} +142 -45
  58. package/dist/chunk-K6RIN3LW.cjs.map +1 -0
  59. package/dist/{chunk-BLJUCPMV.cjs → chunk-KSHAAPQF.cjs} +5 -2
  60. package/dist/chunk-KSHAAPQF.cjs.map +1 -0
  61. package/dist/{chunk-2PU3AGGS.cjs → chunk-KTCEKGBJ.cjs} +7 -7
  62. package/dist/{chunk-2PU3AGGS.cjs.map → chunk-KTCEKGBJ.cjs.map} +1 -1
  63. package/dist/{chunk-LH72PQO2.cjs → chunk-KWYS4IIM.cjs} +165 -50
  64. package/dist/chunk-KWYS4IIM.cjs.map +1 -0
  65. package/dist/{chunk-GSKLPI3J.cjs → chunk-MIT2USTS.cjs} +118 -61
  66. package/dist/chunk-MIT2USTS.cjs.map +1 -0
  67. package/dist/{chunk-Y4GCJJPF.cjs → chunk-NYZQOIXJ.cjs} +35 -2
  68. package/dist/chunk-NYZQOIXJ.cjs.map +1 -0
  69. package/dist/{chunk-A2PX5IRC.cjs → chunk-PERUFUVH.cjs} +13 -13
  70. package/dist/{chunk-A2PX5IRC.cjs.map → chunk-PERUFUVH.cjs.map} +1 -1
  71. package/dist/{chunk-X5BAFW3Q.cjs → chunk-PGDR7CO3.cjs} +8 -8
  72. package/dist/{chunk-X5BAFW3Q.cjs.map → chunk-PGDR7CO3.cjs.map} +1 -1
  73. package/dist/{chunk-OV3JTKBY.js → chunk-PL7AQQV7.js} +123 -22
  74. package/dist/chunk-PL7AQQV7.js.map +1 -0
  75. package/dist/chunk-Q4YOLT4M.js +164 -0
  76. package/dist/chunk-Q4YOLT4M.js.map +1 -0
  77. package/dist/{chunk-GMBDLNLD.cjs → chunk-R5ILCNCC.cjs} +197 -60
  78. package/dist/chunk-R5ILCNCC.cjs.map +1 -0
  79. package/dist/chunk-RP4KQUNU.cjs +168 -0
  80. package/dist/chunk-RP4KQUNU.cjs.map +1 -0
  81. package/dist/{chunk-77WU3V3J.cjs → chunk-SPU7MUWE.cjs} +6 -6
  82. package/dist/{chunk-77WU3V3J.cjs.map → chunk-SPU7MUWE.cjs.map} +1 -1
  83. package/dist/{chunk-XBTYGQ6Z.js → chunk-ST7OBB5J.js} +8 -5
  84. package/dist/chunk-ST7OBB5J.js.map +1 -0
  85. package/dist/{chunk-2QKF7M2Z.js → chunk-TAPBDT47.js} +3 -3
  86. package/dist/{chunk-2QKF7M2Z.js.map → chunk-TAPBDT47.js.map} +1 -1
  87. package/dist/{chunk-BMJVKYVB.js → chunk-V5NLQ4L5.js} +123 -7
  88. package/dist/chunk-V5NLQ4L5.js.map +1 -0
  89. package/dist/{chunk-KMGCHV6O.js → chunk-V6OXSXIX.js} +63 -30
  90. package/dist/chunk-V6OXSXIX.js.map +1 -0
  91. package/dist/{chunk-LMAQUR55.cjs → chunk-WQMPIURW.cjs} +6 -6
  92. package/dist/{chunk-LMAQUR55.cjs.map → chunk-WQMPIURW.cjs.map} +1 -1
  93. package/dist/{chunk-ZPE2ZTJ4.cjs → chunk-WZG6GZIL.cjs} +4 -4
  94. package/dist/{chunk-ZPE2ZTJ4.cjs.map → chunk-WZG6GZIL.cjs.map} +1 -1
  95. package/dist/{chunk-AE3AAJ4O.js → chunk-XJANKTIL.js} +3 -3
  96. package/dist/{chunk-AE3AAJ4O.js.map → chunk-XJANKTIL.js.map} +1 -1
  97. package/dist/{chunk-O7RZRUMZ.js → chunk-XJWED257.js} +14 -309
  98. package/dist/chunk-XJWED257.js.map +1 -0
  99. package/dist/chunk-XSSLNINL.js +346 -0
  100. package/dist/chunk-XSSLNINL.js.map +1 -0
  101. package/dist/{chunk-6TGB7ECA.cjs → chunk-YD4XY74W.cjs} +12 -8
  102. package/dist/chunk-YD4XY74W.cjs.map +1 -0
  103. package/dist/{chunk-YX6TFX7H.js → chunk-YMZUE2IX.js} +66 -11
  104. package/dist/chunk-YMZUE2IX.js.map +1 -0
  105. package/dist/{chunk-4MMZD63H.js → chunk-Z77M7Q2R.js} +3 -3
  106. package/dist/{chunk-4MMZD63H.js.map → chunk-Z77M7Q2R.js.map} +1 -1
  107. package/dist/{chunk-CZ5IQB3L.js → chunk-ZSRXY5YT.js} +8 -5
  108. package/dist/chunk-ZSRXY5YT.js.map +1 -0
  109. package/dist/entries/apps.cjs +43 -42
  110. package/dist/entries/apps.js +8 -7
  111. package/dist/entries/captions.cjs +38 -30
  112. package/dist/entries/captions.d.cts +48 -2
  113. package/dist/entries/captions.d.ts +48 -2
  114. package/dist/entries/captions.js +1 -1
  115. package/dist/entries/credits.cjs +319 -191
  116. package/dist/entries/credits.d.cts +260 -19
  117. package/dist/entries/credits.d.ts +260 -19
  118. package/dist/entries/credits.js +11 -11
  119. package/dist/entries/entities.cjs +202 -193
  120. package/dist/entries/entities.d.cts +44 -9
  121. package/dist/entries/entities.d.ts +44 -9
  122. package/dist/entries/entities.js +2 -1
  123. package/dist/entries/llm-models.cjs +86 -62
  124. package/dist/entries/llm-models.d.cts +73 -20
  125. package/dist/entries/llm-models.d.ts +73 -20
  126. package/dist/entries/llm-models.js +2 -2
  127. package/dist/entries/media.cjs +79 -63
  128. package/dist/entries/media.d.cts +154 -1
  129. package/dist/entries/media.d.ts +154 -1
  130. package/dist/entries/media.js +1 -1
  131. package/dist/entries/model-catalog.cjs +205 -109
  132. package/dist/entries/model-catalog.d.cts +65 -58
  133. package/dist/entries/model-catalog.d.ts +65 -58
  134. package/dist/entries/model-catalog.js +4 -4
  135. package/dist/entries/models.cjs +527 -346
  136. package/dist/entries/models.d.cts +86 -7
  137. package/dist/entries/models.d.ts +86 -7
  138. package/dist/entries/models.js +6 -5
  139. package/dist/entries/nodes.cjs +220 -211
  140. package/dist/entries/nodes.d.cts +46 -3
  141. package/dist/entries/nodes.d.ts +46 -3
  142. package/dist/entries/nodes.js +10 -9
  143. package/dist/entries/pipeline.cjs +156 -152
  144. package/dist/entries/pipeline.d.cts +14 -4
  145. package/dist/entries/pipeline.d.ts +14 -4
  146. package/dist/entries/pipeline.js +3 -3
  147. package/dist/entries/social.cjs +177 -177
  148. package/dist/entries/social.js +2 -2
  149. package/dist/entries/ugc.cjs +71 -71
  150. package/dist/entries/ugc.js +4 -4
  151. package/dist/entries/video.cjs +174 -145
  152. package/dist/entries/video.d.cts +114 -2
  153. package/dist/entries/video.d.ts +114 -2
  154. package/dist/entries/video.js +7 -6
  155. package/dist/entries/workflow.cjs +150 -150
  156. package/dist/entries/workflow.d.cts +1 -1
  157. package/dist/entries/workflow.d.ts +1 -1
  158. package/dist/entries/workflow.js +2 -2
  159. package/dist/index.cjs +2430 -1929
  160. package/dist/index.d.cts +13 -12
  161. package/dist/index.d.ts +13 -12
  162. package/dist/index.js +28 -27
  163. package/dist/{model-catalog-C_Eo35tL.d.cts → model-catalog-BoUKGFNl.d.cts} +182 -3
  164. package/dist/{model-catalog-C_Eo35tL.d.ts → model-catalog-BoUKGFNl.d.ts} +182 -3
  165. package/dist/{model-constants-DWcxOmaY.d.cts → model-constants-BElS3AeE.d.ts} +142 -23
  166. package/dist/{model-constants-Bg4ccSQb.d.ts → model-constants-CpQz1bGa.d.cts} +142 -23
  167. package/dist/tts-capabilities-BtnDWK9K.d.ts +133 -0
  168. package/dist/tts-capabilities-C52UccTI.d.cts +133 -0
  169. package/package.json +1 -1
  170. package/src/__tests__/add-captions-nemotron-pricing.test.ts +111 -0
  171. package/src/__tests__/dialogue-capabilities.test.ts +167 -6
  172. package/src/__tests__/extend-providers.test.ts +353 -26
  173. package/src/__tests__/fixtures/mask-composite-quote-parity.json +1 -1
  174. package/src/__tests__/fixtures/measured-input-quote-parity.json +1435 -0
  175. package/src/__tests__/fixtures/planned-length-quote-parity.json +1866 -0
  176. package/src/__tests__/fixtures/video-utility-quote-parity.json +2343 -0
  177. package/src/__tests__/flux-3-klein.test.ts +203 -0
  178. package/src/__tests__/gpt-image-2-6-formats.test.ts +3 -1
  179. package/src/__tests__/kling4-catalog.test.ts +1 -1
  180. package/src/__tests__/llm-models.test.ts +48 -13
  181. package/src/__tests__/llm-price-key.test.ts +12 -0
  182. package/src/__tests__/model-makers.test.ts +3 -0
  183. package/src/__tests__/node-runtime-keys.test.ts +7 -0
  184. package/src/__tests__/normalize-node-params.test.ts +147 -1
  185. package/src/__tests__/retired-lip-sync-providers.test.ts +43 -0
  186. package/src/__tests__/seedance-extend-source-credit-id.test.ts +89 -0
  187. package/src/__tests__/sequence-execution.test.ts +22 -1
  188. package/src/__tests__/speech-pricing.test.ts +62 -1
  189. package/src/__tests__/suno-credit-type.test.ts +21 -2
  190. package/src/__tests__/transcribe-capabilities.test.ts +4 -2
  191. package/src/__tests__/tts-capabilities.test.ts +160 -4
  192. package/src/__tests__/video-analysis-catalog-sync.test.ts +4 -2
  193. package/src/__tests__/video-analysis-pricing.test.ts +22 -9
  194. package/src/__tests__/video-subjects.test.ts +192 -0
  195. package/src/__tests__/wired-character-names.test.ts +142 -0
  196. package/src/caption-styles.ts +62 -0
  197. package/src/credit-estimators/add-captions-nemotron.ts +73 -0
  198. package/src/credit-estimators/index.ts +14 -0
  199. package/src/credit-estimators/speech.ts +57 -9
  200. package/src/credit-identifiers.ts +284 -13
  201. package/src/dialogue-capabilities.ts +220 -3
  202. package/src/dubbing-structure.ts +186 -0
  203. package/src/entries/captions.ts +2 -0
  204. package/src/entries/credits.ts +25 -1
  205. package/src/entries/entities.ts +2 -0
  206. package/src/entries/llm-models.ts +7 -0
  207. package/src/entries/media.ts +3 -1
  208. package/src/entries/model-catalog.ts +30 -0
  209. package/src/entries/models.ts +54 -0
  210. package/src/entries/nodes.ts +2 -0
  211. package/src/entries/pipeline.ts +1 -1
  212. package/src/entries/video.ts +8 -1
  213. package/src/flux-3-klein.ts +69 -0
  214. package/src/gemini-tts.ts +144 -0
  215. package/src/input-image-pricing.ts +23 -6
  216. package/src/llm-models.ts +130 -36
  217. package/src/model-catalog.ts +539 -25
  218. package/src/model-constants.ts +247 -25
  219. package/src/node-default-mappings.ts +3 -0
  220. package/src/node-runtime-keys.ts +3 -0
  221. package/src/normalize-node-params.ts +123 -2
  222. package/src/seedance-extend-rate.ts +116 -0
  223. package/src/sequence-execution.ts +24 -0
  224. package/src/transcribe-preflight.ts +23 -0
  225. package/src/tts-capabilities.ts +193 -1
  226. package/src/video-analysis-pricing.ts +39 -15
  227. package/src/video-character-refs.ts +160 -3
  228. package/src/wired-character-names.ts +134 -18
  229. package/src/wired-character-video-subjects.ts +63 -0
  230. package/dist/chunk-63H4C56Q.cjs +0 -38
  231. package/dist/chunk-63H4C56Q.cjs.map +0 -1
  232. package/dist/chunk-6M563QE6.js.map +0 -1
  233. package/dist/chunk-6TGB7ECA.cjs.map +0 -1
  234. package/dist/chunk-6XUG4L7X.cjs +0 -54
  235. package/dist/chunk-6XUG4L7X.cjs.map +0 -1
  236. package/dist/chunk-BLJUCPMV.cjs.map +0 -1
  237. package/dist/chunk-BMJVKYVB.js.map +0 -1
  238. package/dist/chunk-CZ5IQB3L.js.map +0 -1
  239. package/dist/chunk-F6WGGYQW.cjs.map +0 -1
  240. package/dist/chunk-GMBDLNLD.cjs.map +0 -1
  241. package/dist/chunk-GSKLPI3J.cjs.map +0 -1
  242. package/dist/chunk-HBXF6RUU.js +0 -31
  243. package/dist/chunk-HBXF6RUU.js.map +0 -1
  244. package/dist/chunk-HSHCCBIV.js.map +0 -1
  245. package/dist/chunk-HWQ2SYNA.js.map +0 -1
  246. package/dist/chunk-IY3Y462W.js +0 -42
  247. package/dist/chunk-IY3Y462W.js.map +0 -1
  248. package/dist/chunk-KHH54GRP.cjs.map +0 -1
  249. package/dist/chunk-KMGCHV6O.js.map +0 -1
  250. package/dist/chunk-LH72PQO2.cjs.map +0 -1
  251. package/dist/chunk-M5OCFGHF.cjs.map +0 -1
  252. package/dist/chunk-NIAFR5EE.js.map +0 -1
  253. package/dist/chunk-O7RZRUMZ.js.map +0 -1
  254. package/dist/chunk-OV3JTKBY.js.map +0 -1
  255. package/dist/chunk-PSKZKLDG.js.map +0 -1
  256. package/dist/chunk-Q6IES3U2.js.map +0 -1
  257. package/dist/chunk-TM5JYSJF.cjs.map +0 -1
  258. package/dist/chunk-WRSWH7US.cjs.map +0 -1
  259. package/dist/chunk-XBTYGQ6Z.js.map +0 -1
  260. package/dist/chunk-XGGZWA4A.cjs.map +0 -1
  261. package/dist/chunk-XGVJGNZW.cjs.map +0 -1
  262. package/dist/chunk-Y35JQPT6.cjs.map +0 -1
  263. package/dist/chunk-Y4GCJJPF.cjs.map +0 -1
  264. package/dist/chunk-YUER7TJG.js.map +0 -1
  265. package/dist/chunk-YX6TFX7H.js.map +0 -1
@@ -0,0 +1,203 @@
1
+ import { describe, expect, it } from "vitest"
2
+ import { MODEL_CATALOG, MODEL_MAKERS, defaultResolutionFor, normalizeModelInput } from "../model-catalog.js"
3
+ import { buildCreditModelIdentifier, resolveNormalizedImageGen } from "../credit-identifiers.js"
4
+ import {
5
+ IMAGE_ASPECT_RATIO_VALUES,
6
+ IMAGE_GEN_PROVIDERS,
7
+ IMAGE_I2I_PROVIDERS,
8
+ MODELS_WITH_REFERENCE_IMAGE_SUPPORT,
9
+ SEED_SUPPORT,
10
+ T2I_TO_I2I_VARIANT,
11
+ VARIABLE_PRICING_MODELS,
12
+ getMaxImagePromptChars,
13
+ getMinImagePromptChars,
14
+ imageReferenceLimit,
15
+ requestImageLimit,
16
+ } from "../model-constants.js"
17
+ import { isPricedPerInputImage, priceReadsInputImages, pricedEstimatedImages, pricedSentImages } from "../input-image-pricing.js"
18
+ import { isFlux2Model } from "../flux2-pricing.js"
19
+ import { mapQuality } from "../node-default-mappings.js"
20
+ import {
21
+ FLUX_3_KLEIN_DEFAULT_RESOLUTION,
22
+ FLUX_3_KLEIN_I2I,
23
+ FLUX_3_KLEIN_T2I,
24
+ flux3KleinCreditId,
25
+ flux3KleinResolution,
26
+ isFlux3Klein,
27
+ isFlux3KleinI2i,
28
+ } from "../flux-3-klein.js"
29
+
30
+ const T2I = FLUX_3_KLEIN_T2I
31
+ const I2I = FLUX_3_KLEIN_I2I
32
+ const NINE = ["1:1", "4:3", "3:4", "3:2", "2:3", "16:9", "9:16", "21:9", "9:21"]
33
+
34
+ describe("FLUX 3 Klein in the catalog", () => {
35
+ it("two ids, Black Forest Labs' own, in the Flux line, beside and apart from FLUX 2 Klein", () => {
36
+ for (const id of [T2I, I2I]) {
37
+ const m = MODEL_CATALOG[id]!
38
+ expect(m.kind).toBe("image")
39
+ expect(m.maker).toBe("black-forest-labs")
40
+ expect(MODEL_MAKERS["black-forest-labs"].name).toBe("Black Forest Labs")
41
+ expect(m.series).toBe("Flux")
42
+ expect(isFlux2Model(id)).toBe(false)
43
+ }
44
+ expect(MODEL_CATALOG[T2I]!.modes).toEqual(["t2i"])
45
+ expect(MODEL_CATALOG[I2I]!.modes).toEqual(["i2i"])
46
+ expect(MODEL_CATALOG["flux-2-klein"]).toBeDefined()
47
+ expect(isFlux3Klein("flux-2-klein")).toBe(false)
48
+ expect(isFlux3KleinI2i(T2I)).toBe(false)
49
+ expect(isFlux3KleinI2i(I2I)).toBe(true)
50
+ })
51
+
52
+ it("takes 1K, 2K and 4K, 1K when none is named", () => {
53
+ for (const id of [T2I, I2I]) {
54
+ expect(MODEL_CATALOG[id]!.resolutions).toEqual(["1K", "2K", "4K"])
55
+ expect(MODEL_CATALOG[id]!.defaultResolution).toBeUndefined()
56
+ expect(defaultResolutionFor(id)).toBeUndefined()
57
+ }
58
+ expect(FLUX_3_KLEIN_DEFAULT_RESOLUTION).toBe("1K")
59
+ expect(flux3KleinResolution(undefined)).toBe("1K")
60
+ expect(flux3KleinResolution("2k")).toBe("2K")
61
+ expect(flux3KleinResolution(" 4K ")).toBe("4K")
62
+ expect(flux3KleinResolution("1.5K")).toBe("1K")
63
+ expect(flux3KleinResolution("2 MP")).toBe("1K")
64
+ })
65
+
66
+ it("text to image lists the nine ratios, 1:1 first and no auto; the edit adds auto last", () => {
67
+ expect(MODEL_CATALOG[T2I]!.aspectRatios).toEqual(NINE)
68
+ expect(MODEL_CATALOG[I2I]!.aspectRatios).toEqual([...NINE, "auto"])
69
+ for (const ratio of [...NINE, "auto"]) expect(IMAGE_ASPECT_RATIO_VALUES).toContain(ratio)
70
+ // A provider schema with a closed list: the Scene and surround lanes check the ratio.
71
+ expect(MODEL_CATALOG[T2I]!.strictAspectRatios).toBe(true)
72
+ expect(MODEL_CATALOG[I2I]!.strictAspectRatios).toBe(true)
73
+ // The schema says the edit's auto takes the first image's shape; unmeasured, so not overridden.
74
+ expect(MODEL_CATALOG[I2I]!.autoAspectFromSourceImage).toBeUndefined()
75
+ })
76
+
77
+ it("auto on text to image becomes a real ratio, the edit keeps its own", () => {
78
+ expect(normalizeModelInput(T2I, { aspectRatio: "auto" }).aspectRatio).toBe("1:1")
79
+ const portrait = normalizeModelInput(T2I, { aspectRatio: "auto" }, { sourceImage: { width: 768, height: 1024 } })
80
+ expect(portrait.aspectRatio).toBe("3:4")
81
+ expect(normalizeModelInput(I2I, { aspectRatio: "auto" }).aspectRatio).toBe("auto")
82
+ expect(normalizeModelInput(T2I, { aspectRatio: "9:21" }).aspectRatio).toBe("9:21")
83
+ })
84
+
85
+ it("a size it does not list snaps to 1K before anything is priced", () => {
86
+ expect(normalizeModelInput(T2I, { resolution: "1.5K" }).resolution).toBe("1K")
87
+ expect(normalizeModelInput(I2I, { resolution: "2 MP" }).resolution).toBe("1K")
88
+ expect(normalizeModelInput(T2I, { resolution: "4K" }).resolution).toBe("4K")
89
+ })
90
+
91
+ it("writes PNG (the default) or JPEG; offers no background or quality", () => {
92
+ for (const id of [T2I, I2I]) {
93
+ const m = MODEL_CATALOG[id]!
94
+ expect(m.outputFormats).toEqual(["png", "jpeg"])
95
+ expect(m.backgrounds).toBeUndefined()
96
+ expect(m.qualities).toBeUndefined()
97
+ expect(normalizeModelInput(id, { outputFormat: "jpg" }).outputFormat).toBe("jpeg")
98
+ // WebP, which the provider also writes, is not offered: it snaps to PNG.
99
+ expect(normalizeModelInput(id, { outputFormat: "webp" }).outputFormat).toBe("png")
100
+ }
101
+ })
102
+
103
+ it("the catalog's price rows: the bare id and one per size, the same on both ids", () => {
104
+ const rows = (id: string) => Object.fromEntries(MODEL_CATALOG[id]!.pricing.map((r) => [r.identifier, r.credits]))
105
+ expect(rows(T2I)).toEqual({ "flux-3-klein": 4, "flux-3-klein:1K": 4, "flux-3-klein:2K": 7, "flux-3-klein:4K": 17 })
106
+ expect(rows(I2I)).toEqual({ "flux-3-klein-i2i": 4, "flux-3-klein-i2i:1K": 4, "flux-3-klein-i2i:2K": 7, "flux-3-klein-i2i:4K": 17 })
107
+ expect(MODEL_CATALOG[T2I]!.pricing[0]!.identifier).toBe(T2I)
108
+ expect(MODEL_CATALOG[I2I]!.pricing[0]!.identifier).toBe(I2I)
109
+ })
110
+ })
111
+
112
+ describe("FLUX 3 Klein price ids", () => {
113
+ it("one id per size, 1K for none or a size it does not list", () => {
114
+ expect(buildCreditModelIdentifier(T2I)).toBe("flux-3-klein:1K")
115
+ expect(buildCreditModelIdentifier(T2I, undefined, "1K")).toBe("flux-3-klein:1K")
116
+ expect(buildCreditModelIdentifier(T2I, undefined, "2K")).toBe("flux-3-klein:2K")
117
+ expect(buildCreditModelIdentifier(T2I, undefined, "4K")).toBe("flux-3-klein:4K")
118
+ expect(buildCreditModelIdentifier(T2I, undefined, "1.5K")).toBe("flux-3-klein:1K")
119
+ expect(buildCreditModelIdentifier(I2I, undefined, "4K")).toBe("flux-3-klein-i2i:4K")
120
+ expect(buildCreditModelIdentifier(I2I)).toBe("flux-3-klein-i2i:1K")
121
+ })
122
+
123
+ it("a quality never reaches the id", () => {
124
+ expect(buildCreditModelIdentifier(T2I, "high", "2K")).toBe("flux-3-klein:2K")
125
+ })
126
+
127
+ it("images move the text-to-image id onto the edit id; their count never shows", () => {
128
+ expect(buildCreditModelIdentifier(T2I, undefined, "2K", undefined, undefined, 3)).toBe("flux-3-klein-i2i:2K")
129
+ for (const n of [0, 1, 10, 20]) {
130
+ expect(buildCreditModelIdentifier(I2I, undefined, "4K", undefined, undefined, n)).toBe("flux-3-klein-i2i:4K")
131
+ }
132
+ expect(flux3KleinCreditId(T2I, "2K", Number.NaN)).toBe("flux-3-klein:2K")
133
+ })
134
+
135
+ it("is priced by size, not per input image", () => {
136
+ expect(isPricedPerInputImage(T2I)).toBe(false)
137
+ expect(isPricedPerInputImage(I2I)).toBe(false)
138
+ expect(VARIABLE_PRICING_MODELS[T2I]).toBe("resolution")
139
+ expect(VARIABLE_PRICING_MODELS[I2I]).toBe("resolution")
140
+ })
141
+
142
+ it("counts every image a run sends, a base image included, so the id priced is the edit it runs", () => {
143
+ expect(priceReadsInputImages(T2I)).toBe(true)
144
+ expect(priceReadsInputImages(I2I)).toBe(true)
145
+ expect(pricedSentImages(T2I, [], "https://base.png")).toBe(1)
146
+ expect(pricedSentImages(T2I, ["https://a.png"], "https://base.png")).toBe(2)
147
+ expect(pricedSentImages(T2I, ["https://base.png"], "https://base.png")).toBe(1)
148
+ expect(buildCreditModelIdentifier(T2I, undefined, "2K", undefined, undefined, pricedSentImages(T2I, [], "https://base.png"))).toBe("flux-3-klein-i2i:2K")
149
+ expect(pricedEstimatedImages(T2I, {}, 2)).toBe(2)
150
+ // FLUX 2 Klein and the models not priced by their images count as before.
151
+ expect(priceReadsInputImages("flux-2-klein")).toBe(false)
152
+ expect(pricedSentImages("flux-2-klein", ["https://a.png"], "https://base.png")).toBe(1)
153
+ expect(pricedSentImages("nano-banana-pro", ["https://a.png"], "https://base.png")).toBe(1)
154
+ })
155
+
156
+ it("a Generate Image run with references is snapped and priced on the edit", () => {
157
+ const n = resolveNormalizedImageGen({ provider: T2I, aspectRatio: "auto", resolution: "2K", refCount: 2, swapToI2i: true })
158
+ expect(n.modelId).toBe(I2I)
159
+ expect(n.aspectRatio).toBe("auto")
160
+ expect(n.identifier).toBe("flux-3-klein-i2i:2K")
161
+ const t2i = resolveNormalizedImageGen({ provider: T2I, aspectRatio: "auto", refCount: 0, swapToI2i: true })
162
+ expect(t2i.modelId).toBe(T2I)
163
+ expect(t2i.aspectRatio).toBe("1:1")
164
+ expect(t2i.identifier).toBe("flux-3-klein:1K")
165
+ })
166
+ })
167
+
168
+ describe("FLUX 3 Klein's place in the shared lists", () => {
169
+ it("joins the route vocabularies, the reference-image models and the seed models", () => {
170
+ expect(IMAGE_GEN_PROVIDERS).toContain(T2I)
171
+ expect(IMAGE_I2I_PROVIDERS).toContain(I2I)
172
+ expect(MODELS_WITH_REFERENCE_IMAGE_SUPPORT.has(T2I)).toBe(true)
173
+ expect(MODELS_WITH_REFERENCE_IMAGE_SUPPORT.has(I2I)).toBe(true)
174
+ expect(SEED_SUPPORT.has(T2I)).toBe(true)
175
+ expect(SEED_SUPPORT.has(I2I)).toBe(true)
176
+ })
177
+
178
+ it("references swap text to image onto the edit, which takes up to 10", () => {
179
+ expect(T2I_TO_I2I_VARIANT[T2I]).toBe(I2I)
180
+ expect(imageReferenceLimit(T2I)).toBe(10)
181
+ expect(imageReferenceLimit(I2I)).toBe(10)
182
+ expect(requestImageLimit(T2I)).toBe(10)
183
+ expect(requestImageLimit(I2I)).toBe(10)
184
+ // FLUX 2 Klein's limits are its own.
185
+ expect(imageReferenceLimit("flux-2-klein")).toBe(1)
186
+ expect(requestImageLimit("flux-2-klein")).toBe(14)
187
+ })
188
+
189
+ it("prompts of 1 to 5000 characters: the default cap, no minimum", () => {
190
+ expect(getMaxImagePromptChars(T2I)).toBe(5000)
191
+ expect(getMaxImagePromptChars(I2I)).toBe(5000)
192
+ expect(getMinImagePromptChars(T2I)).toBe(0)
193
+ expect(getMinImagePromptChars(I2I)).toBe(0)
194
+ })
195
+
196
+ it("an admin's quality level maps onto its sizes", () => {
197
+ for (const id of [T2I, I2I]) {
198
+ expect(mapQuality(id, "low")).toEqual({ field: "resolution", value: "1K" })
199
+ expect(mapQuality(id, "mid")).toEqual({ field: "resolution", value: "2K" })
200
+ expect(mapQuality(id, "high")).toEqual({ field: "resolution", value: "4K" })
201
+ }
202
+ })
203
+ })
@@ -21,11 +21,13 @@ describe("which models write which files", () => {
21
21
 
22
22
  it("a menu offers a format only on a model that writes more than one", () => {
23
23
  const formats = outputFormatOptionsByKind("image")
24
- expect(Object.keys(formats).sort()).toEqual(["gpt-image-2-6-economy", "gpt-image-2-6-flare", "gpt-image-2-6-flare-i2i", "gpt-image-2-6-sunburst", "gpt-image-2-6-sunburst-i2i", "minimax-h3-image", "minimax-h3-image-i2i", "seedream-5-5", "seedream-5-5-i2i"])
24
+ expect(Object.keys(formats).sort()).toEqual(["flux-3-klein", "flux-3-klein-i2i", "gpt-image-2-6-economy", "gpt-image-2-6-flare", "gpt-image-2-6-flare-i2i", "gpt-image-2-6-sunburst", "gpt-image-2-6-sunburst-i2i", "minimax-h3-image", "minimax-h3-image-i2i", "seedream-5-5", "seedream-5-5-i2i"])
25
25
  expect(formats[FLARE]!.map((o) => o.value)).toEqual(["png", "jpeg", "webp", "gif", "svg"])
26
26
  expect(formats["minimax-h3-image"]!.map((o) => o.value)).toEqual(["png", "jpeg"])
27
27
  expect(formats["minimax-h3-image-i2i"]!.map((o) => o.value)).toEqual(["png", "jpeg"])
28
28
  expect(formats["seedream-5-5"]!.map((o) => o.value)).toEqual(["png", "jpeg"])
29
+ expect(formats["flux-3-klein"]!.map((o) => o.value)).toEqual(["png", "jpeg"])
30
+ expect(formats["flux-3-klein-i2i"]!.map((o) => o.value)).toEqual(["png", "jpeg"])
29
31
  expect(Object.keys(svgLevelOptionsByKind("image")).sort()).toEqual(["gpt-image-2-6-flare", "gpt-image-2-6-flare-i2i", "gpt-image-2-6-sunburst", "gpt-image-2-6-sunburst-i2i"])
30
32
  expect(svgLevelOptionsByKind("image")[FLARE]!.map((o) => o.label)).toEqual(["SVG Standard", "SVG Detailed", "SVG Max"])
31
33
  })
@@ -39,7 +39,7 @@ describe("kling-4 / kling-4-keyframes catalog", () => {
39
39
  })
40
40
 
41
41
  it("reference: subjects, voices and reference videos; keyframes: in-between frames on their own channel", () => {
42
- expect(VIDEO_REF_LIMITS_BY_PROVIDER["kling-4"]).toEqual({ images: 10, videos: 5, audio: 3, characters: 7, materials: 15 })
42
+ expect(VIDEO_REF_LIMITS_BY_PROVIDER["kling-4"]).toEqual({ images: 10, videos: 5, audio: 3, characters: 7, materials: 15, videoCharacters: 3, videoCharactersBillAsReferenceVideo: true })
43
43
  expect(VIDEO_REF_VIDEO_DURATION_LIMITS["kling-4"]).toEqual({ minSec: 2, maxSec: 30, maxTotalSec: 30 })
44
44
  expect(hasFeature("kling-4", "character-subjects")).toBe(true)
45
45
  expect(VIDEO_REF_LIMITS_BY_PROVIDER["kling-4-keyframes"]).toEqual({ images: 8 })
@@ -14,6 +14,8 @@ import {
14
14
  getLlmTier,
15
15
  getLlmModalityCaps,
16
16
  VIDEO_ANALYSIS_LLM_MODELS,
17
+ VIDEO_ANALYSIS_TIERS,
18
+ resolveVideoAnalysisModel,
17
19
  buildLlmCreditIdentifier,
18
20
  resolveLlmCreditId,
19
21
  motionGraphicsFeature,
@@ -32,6 +34,13 @@ import {
32
34
  llmServesDirect,
33
35
  llmTierCreditIds,
34
36
  LLM_CREDIT_RUNGS,
37
+ LLM_MODALITY_CAPS,
38
+ LLM_FILE_MODELS,
39
+ LLM_REFERENCE_FILES_MAX,
40
+ LLM_REFERENCE_FILES_MAX_TOTAL_BYTES,
41
+ LLM_REFERENCE_FILES_MAX_PAGES,
42
+ LLM_REFERENCE_FILE_MIME_TYPES,
43
+ llmAcceptsFiles,
35
44
  } from "../llm-models.js"
36
45
  import type { LlmModelDef, LlmTier, LlmFeature } from "../llm-models.js"
37
46
  import { PIPELINE_ACCEPTED_SCRIPT_LLMS, PIPELINE_LEGACY_PINNED_SCRIPT_LLMS, PIPELINE_PINNABLE_SCRIPT_LLMS, PipelineConfigSchema } from "../pipeline-types.js"
@@ -1008,15 +1017,12 @@ describe("gemini-3.8-flash exposure", () => {
1008
1017
  expect(getLlmModel("gemini-3-8-flash-openai")?.id).toBe("gemini-3.8-flash")
1009
1018
  })
1010
1019
 
1011
- it("stays OUT of video-analysis — image-only modality caps by decision, not omission", () => {
1012
- // Google's own 3.8 lane understands video (agentic video via the
1013
- // Interactions API), so full caps here would auto-enroll it in
1014
- // VIDEO_ANALYSIS_LLM_MODELS and force a VA tier + pricing decision that is
1015
- // deliberately deferred until the 3.8-vs-3.7 analysis A/B concludes.
1016
- // If this goes red, someone flipped the caps — only valid TOGETHER with
1017
- // that VA-side decision.
1018
- expect(getLlmModalityCaps("gemini-3.8-flash")).toEqual({ image: true, video: false, audio: false })
1019
- expect(VIDEO_ANALYSIS_LLM_MODELS).not.toContain("gemini-3.8-flash")
1020
+ it("backs the video-analysis fast tier — full video + audio caps (decided 2026-11-13)", () => {
1021
+ // Full caps are what enrol it in VIDEO_ANALYSIS_LLM_MODELS; the fast tier
1022
+ // moved here when KIE dropped gemini-3-flash's channel.
1023
+ expect(getLlmModalityCaps("gemini-3.8-flash")).toEqual({ image: true, video: true, audio: true })
1024
+ expect(VIDEO_ANALYSIS_LLM_MODELS).toContain("gemini-3.8-flash")
1025
+ expect(VIDEO_ANALYSIS_TIERS.fast).toBe("gemini-3.8-flash")
1020
1026
  })
1021
1027
  })
1022
1028
 
@@ -1120,9 +1126,13 @@ describe("gemini-4-carbon exposure", () => {
1120
1126
  expect(Object.values(LLM_FEATURE_DEFAULTS)).not.toContain("gemini-4-carbon")
1121
1127
  })
1122
1128
 
1123
- it("stays OUT of video-analysis — image-only caps until its video + audio change", () => {
1124
- expect(getLlmModalityCaps("gemini-4-carbon")).toEqual({ image: true, video: false, audio: false })
1125
- expect(VIDEO_ANALYSIS_LLM_MODELS).not.toContain("gemini-4-carbon")
1129
+ it("reads video + audio and backs the video-analysis `ultra` tier (decided 2026-11-13)", () => {
1130
+ // Full caps are what enrol it in VIDEO_ANALYSIS_LLM_MODELS; the `ultra`
1131
+ // tier is the decision that comes with them.
1132
+ expect(getLlmModalityCaps("gemini-4-carbon")).toEqual({ image: true, video: true, audio: true })
1133
+ expect(VIDEO_ANALYSIS_LLM_MODELS).toContain("gemini-4-carbon")
1134
+ expect(VIDEO_ANALYSIS_TIERS.ultra).toBe("gemini-4-carbon")
1135
+ expect(resolveVideoAnalysisModel("ultra")).toBe("gemini-4-carbon")
1126
1136
  })
1127
1137
  })
1128
1138
 
@@ -1138,7 +1148,8 @@ describe("gpt-6.1-terra exposure", () => {
1138
1148
  expect(m.supportsTemperature).toBe(false)
1139
1149
  expect(m.kieCollapseStream).toBeUndefined()
1140
1150
  expect(supportsAdvancedMode("gpt-6.1-terra")).toBe(false)
1141
- expect(getLlmModalityCaps("gpt-6.1-terra")).toEqual({ image: true, video: false, audio: false })
1151
+ // Reads documents (PDF): the one model whose caps say `file` (2026-11-13).
1152
+ expect(getLlmModalityCaps("gpt-6.1-terra")).toEqual({ image: true, video: false, audio: false, file: true })
1142
1153
  })
1143
1154
 
1144
1155
  it("offers low…max but never `none`: a `none` request clamps to Auto (nothing sent)", () => {
@@ -1157,6 +1168,30 @@ describe("gpt-6.1-terra exposure", () => {
1157
1168
  })
1158
1169
  })
1159
1170
 
1171
+ describe("the `file` modality cap (documents, decided 2026-11-13)", () => {
1172
+ it("is declared on GPT-6.1 Terra alone, and never derived for another model", () => {
1173
+ expect(LLM_FILE_MODELS.map((m) => m.id)).toEqual(["gpt-6.1-terra"])
1174
+ expect(Object.entries(LLM_MODALITY_CAPS).filter(([, c]) => c.file).map(([id]) => id)).toEqual(["gpt-6.1-terra"])
1175
+ for (const m of LLM_MODELS) expect(llmAcceptsFiles(m.id), m.id).toBe(m.id === "gpt-6.1-terra")
1176
+ expect(llmAcceptsFiles(undefined)).toBe(false)
1177
+ expect(llmAcceptsFiles("no-such-model")).toBe(false)
1178
+ // Its siblings on the same endpoint do not read files here.
1179
+ expect(llmAcceptsFiles("gpt-6.1-sol")).toBe(false)
1180
+ expect(llmAcceptsFiles("gpt-5.6-terra")).toBe(false)
1181
+ })
1182
+
1183
+ it("PDF only, up to 5 files, 6 MB in all and 100 pages in all", () => {
1184
+ expect(LLM_REFERENCE_FILE_MIME_TYPES).toEqual(["application/pdf"])
1185
+ expect(LLM_REFERENCE_FILES_MAX).toBe(5)
1186
+ expect(LLM_REFERENCE_FILES_MAX_TOTAL_BYTES).toBe(6 * 1024 * 1024)
1187
+ expect(LLM_REFERENCE_FILES_MAX_PAGES).toBe(100)
1188
+ })
1189
+
1190
+ it("a document never enrolls a model in video analysis", () => {
1191
+ expect(VIDEO_ANALYSIS_LLM_MODELS).not.toContain("gpt-6.1-terra")
1192
+ })
1193
+ })
1194
+
1160
1195
  describe("kimi-k3.1-pro exposure", () => {
1161
1196
  it("premium Kimi on the openai responses wire with an enforced schema, KIE only", () => {
1162
1197
  const m = getLlmModel("kimi-k3.1-pro")!
@@ -195,6 +195,18 @@ describe("structured output: a trusted mode vs a schema hint", () => {
195
195
  }
196
196
  })
197
197
 
198
+ it("kieSchemaInPrompt: only 3.8 Flash and 3.7 Flash (one KIE endpoint), only on a chat-completions response_format model, trust kept", () => {
199
+ expect(LLM_MODELS.filter((m) => m.kieSchemaInPrompt).map((m) => m.id).sort()).toEqual(["gemini-3.7-flash", "gemini-3.8-flash"])
200
+ for (const m of LLM_MODELS.filter((x) => x.kieSchemaInPrompt)) {
201
+ expect(m.kieFormat, m.id).toBe("chat-completions")
202
+ expect(structuredWireMode(m), m.id).toBe("kie-response-format")
203
+ // Per lane: the model-level mode, and the trust it carries, stay.
204
+ expect(m.structuredOutputMode, m.id).toBe("kie-response-format")
205
+ expect(llmSendsSchema(m.id), m.id).toBe(true)
206
+ }
207
+ expect(STRUCTURED_VISION_MODELS.map((m) => m.id)).toContain("gemini-3.8-flash")
208
+ })
209
+
198
210
  it("llmSendsSchema: a model that sends its schema (trusted or hinted) counts it; one that sends none does not", () => {
199
211
  expect(llmSendsSchema("gemini-4-carbon")).toBe(true)
200
212
  expect(llmSendsSchema("gpt-6.1-terra")).toBe(true)
@@ -93,6 +93,9 @@ describe("model makers", () => {
93
93
  expect(MODEL_CATALOG["depth-anything-frames"]!.maker).toBe("bytedance")
94
94
  expect(MODEL_CATALOG["volcengine-lipsync"]!.maker).toBe("bytedance") // Volcano Engine
95
95
  expect(MODEL_CATALOG["infinitalk"]!.maker).toBe("meituan") // MeiGen-AI
96
+ expect(MODEL_CATALOG["latentsync"]!.maker).toBe("bytedance") // ByteDance's research release
97
+ expect(MODEL_CATALOG["lipsync-2-pro"]!.maker).toBe("sync-labs") // sync.so
98
+ expect(MODEL_CATALOG["heygen-lipsync-precision"]!.maker).toBe("heygen")
96
99
  })
97
100
 
98
101
  it("modelMakerOf serves the maker's id and the company's name", () => {
@@ -158,6 +158,13 @@ describe("EXECUTION_DATA_KEYS", () => {
158
158
  }
159
159
  })
160
160
 
161
+ it("files an Extend / Upscale Video run's own output task as a run result: never undo, preset or template state, and persisted", () => {
162
+ for (const type of ["extend-video", "video-upscale", undefined]) {
163
+ expect(isExecutionDataKey("outputKieTaskId", type), String(type)).toBe(true)
164
+ }
165
+ expect(TRANSIENT_RUNTIME_KEYS.has("outputKieTaskId")).toBe(false)
166
+ })
167
+
161
168
  it("a type's own keys come with every global one, as a set", () => {
162
169
  const ugcClip = executionDataKeysOf("ugc-clip")
163
170
  for (const key of EXECUTION_DATA_KEYS) expect(ugcClip.has(key), key).toBe(true)
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from "vitest"
2
- import { normalizeNodeModelParams, MODEL_PARAM_NODE_TYPES } from "../normalize-node-params.js"
2
+ import { describeNodeAdjustments, normalizeNodeModelParams, withListedReferenceTaskTypes, MODEL_PARAM_NODE_TYPES } from "../normalize-node-params.js"
3
3
 
4
4
  /**
5
5
  * Write-boundary guard for agent/import-authored graphs. The config panel's
@@ -154,3 +154,149 @@ describe("normalizeNodeModelParams — Motion Transfer (decided 2026-11-12)", ()
154
154
  nodes.forEach((n, i) => expect(n).toBe(input[i]))
155
155
  })
156
156
  })
157
+
158
+ /**
159
+ * A video node's stored reference task type (decided 2026-11-13): kept only
160
+ * while a model the node runs lists it (`MODEL_CATALOG[id].referenceTaskTypes`,
161
+ * read through `listedSeedanceTaskType`), else removed — never left hidden on
162
+ * a model that ignores it, to come back when the node is later switched to one
163
+ * that reads it.
164
+ */
165
+ describe("normalizeNodeModelParams — a stored reference task type (decided 2026-11-13)", () => {
166
+ const VIDEO_TYPES = ["generate-video", "image-to-video", "text-to-video", "video-to-video"] as const
167
+ const brief = (a: { nodeId: string; provider: string; field: string; from: unknown; to: unknown }) =>
168
+ ({ nodeId: a.nodeId, provider: a.provider, field: a.field, from: a.from, to: a.to })
169
+
170
+ it.each(VIDEO_TYPES)("%s on Kling, written with edit: the key is removed, and the removal reported", (type) => {
171
+ const input = [node("k", type, { provider: "kling-3.0", prompt: "a cat", referenceTaskType: "edit" })]
172
+ const { nodes, adjustments } = normalizeNodeModelParams(input)
173
+ expect(nodes[0]!.data).toStrictEqual({ provider: "kling-3.0", prompt: "a cat" })
174
+ expect(nodes[0]!.data).not.toHaveProperty("referenceTaskType")
175
+ expect(adjustments.map(brief)).toEqual([{ nodeId: "k", provider: "kling-3.0", field: "referenceTaskType", from: "edit", to: undefined }])
176
+ // The caller's node is never mutated.
177
+ expect(input[0]!.data.referenceTaskType).toBe("edit")
178
+ })
179
+
180
+ it.each(VIDEO_TYPES)("%s on Seedance 2.5 keeps every value it lists, the node returned as it came", (type) => {
181
+ for (const value of ["reference", "edit", "extend"]) {
182
+ const input = [node("s", type, { provider: "seedance-2-5", referenceTaskType: value })]
183
+ const { nodes, adjustments } = normalizeNodeModelParams(input)
184
+ expect(adjustments).toEqual([])
185
+ expect(nodes[0]).toBe(input[0])
186
+ }
187
+ })
188
+
189
+ it("\"auto\", a wrong case, a number and any other value no model lists are removed, even on Seedance 2.5", () => {
190
+ for (const value of ["auto", "Edit", "bogus", 3, null, true]) {
191
+ const { nodes, adjustments } = normalizeNodeModelParams([node("s", "generate-video", { provider: "seedance-2-5", referenceTaskType: value })])
192
+ expect(nodes[0]!.data, String(value)).toStrictEqual({ provider: "seedance-2-5" })
193
+ expect(adjustments.map(brief), String(value)).toEqual([
194
+ { nodeId: "s", provider: "seedance-2-5", field: "referenceTaskType", from: typeof value === "number" ? value : String(value), to: undefined },
195
+ ])
196
+ }
197
+ })
198
+
199
+ it("a node of another type is untouched, whatever it stores", () => {
200
+ const input = [
201
+ node("img", "generate-image", { provider: "gpt-image-2", aspectRatio: "16:9", resolution: "2K", referenceTaskType: "edit" }),
202
+ node("ext", "extend-video", { provider: "seedance-2-5-extend", referenceTaskType: "auto" }),
203
+ node("txt", "text-prompt", { text: "hi", referenceTaskType: "edit" }),
204
+ node("up", "upload-video", { url: "https://cdn.example/a.mp4", referenceTaskType: "bogus" }),
205
+ ]
206
+ const { nodes, adjustments } = normalizeNodeModelParams(input)
207
+ expect(adjustments).toEqual([])
208
+ nodes.forEach((n, i) => expect(n).toBe(input[i]))
209
+ })
210
+
211
+ it("a video node with no task type stored (or the editor's in-memory undefined for Auto) is returned as it came", () => {
212
+ const input = [
213
+ ...VIDEO_TYPES.map((type) => node(type, type, { provider: "kling-3.0", aspectRatio: "21:9", duration: 5 })),
214
+ node("auto", "generate-video", { provider: "kling-3.0", referenceTaskType: undefined }),
215
+ ]
216
+ const { nodes, adjustments } = normalizeNodeModelParams(input)
217
+ expect(adjustments).toEqual([])
218
+ nodes.forEach((n, i) => expect(n).toBe(input[i]))
219
+ })
220
+
221
+ it("a node naming no model is judged on the model its run uses (none of today's defaults lists one)", () => {
222
+ for (const type of VIDEO_TYPES) {
223
+ const { nodes, adjustments } = normalizeNodeModelParams([node("d", type, { referenceTaskType: "edit" })])
224
+ expect(nodes[0]!.data, type).toStrictEqual({})
225
+ expect(adjustments.map((a) => a.field), type).toEqual(["referenceTaskType"])
226
+ }
227
+ })
228
+
229
+ it("a node naming several models keeps it while any of them lists it", () => {
230
+ const kept = [node("m", "image-to-video", { providers: ["kling-3.0", "seedance-2-5"], provider: "kling-3.0", referenceTaskType: "extend" })]
231
+ expect(normalizeNodeModelParams(kept).nodes[0]).toBe(kept[0])
232
+ const dropped = normalizeNodeModelParams([node("m", "image-to-video", { providers: ["kling-3.0", "seedance-2-fast"], provider: "kling-3.0", referenceTaskType: "extend" })])
233
+ expect(dropped.nodes[0]!.data).not.toHaveProperty("referenceTaskType")
234
+ })
235
+
236
+ it("is idempotent — a second pass reports nothing", () => {
237
+ const first = normalizeNodeModelParams([node("k", "generate-video", { provider: "kling-3.0", referenceTaskType: "edit" })])
238
+ const second = normalizeNodeModelParams(first.nodes)
239
+ expect(second.adjustments).toEqual([])
240
+ expect(second.nodes[0]).toBe(first.nodes[0])
241
+ })
242
+
243
+ it("describes a removal as one line", () => {
244
+ const { adjustments } = normalizeNodeModelParams([node("k", "generate-video", { provider: "kling-3.0", referenceTaskType: "edit" })])
245
+ expect(describeNodeAdjustments(adjustments)).toEqual([
246
+ expect.stringMatching(/^k \(kling-3\.0\): referenceTaskType "edit" → removed — /),
247
+ ])
248
+ })
249
+ })
250
+
251
+ /**
252
+ * `withListedReferenceTaskTypes` (decided 2026-11-13): the one rule for a
253
+ * stored reference task type that every workflow write runs — the editor's
254
+ * saves, the REST writes, imports, copies, clones, published snapshots — and
255
+ * `normalizeNodeModelParams` runs for that field. It removes that one key and
256
+ * coerces nothing else.
257
+ */
258
+ describe("withListedReferenceTaskTypes — the write paths' rule", () => {
259
+ const GRAPH = [
260
+ node("kling", "generate-video", { provider: "kling-3.0", prompt: "a cat", aspectRatio: "21:9", resolution: "4K", referenceTaskType: "edit" }),
261
+ node("sd25", "generate-video", { provider: "seedance-2-5", prompt: "a cat", referenceTaskType: "edit" }),
262
+ // An image ratio the catalog normalizer WOULD snap: the write paths leave it as stored.
263
+ node("img", "generate-image", { provider: "gpt-image", aspectRatio: "16:9", resolution: "2K" }),
264
+ node("t", "text-prompt", { text: "hi" }),
265
+ ]
266
+
267
+ it("removes only that key: the whole graph is otherwise exactly as written", () => {
268
+ const out = withListedReferenceTaskTypes(GRAPH)
269
+ expect(out).toStrictEqual([
270
+ node("kling", "generate-video", { provider: "kling-3.0", prompt: "a cat", aspectRatio: "21:9", resolution: "4K" }),
271
+ GRAPH[1],
272
+ GRAPH[2],
273
+ GRAPH[3],
274
+ ])
275
+ expect(out[1]).toBe(GRAPH[1])
276
+ expect(out[2]).toBe(GRAPH[2])
277
+ expect(JSON.stringify(out[0])).toBe(JSON.stringify(GRAPH[0]).replace(',"referenceTaskType":"edit"', ""))
278
+ // The caller's graph is never mutated.
279
+ expect(GRAPH[0]!.data).toHaveProperty("referenceTaskType", "edit")
280
+ })
281
+
282
+ it("a graph without such a value comes back as the SAME array (written byte for byte as before)", () => {
283
+ const clean = [GRAPH[1], GRAPH[2], GRAPH[3]]
284
+ expect(withListedReferenceTaskTypes(clean)).toBe(clean)
285
+ expect(withListedReferenceTaskTypes([])).toStrictEqual([])
286
+ })
287
+
288
+ it("takes the stored value as it comes: anything that is not an array, or a malformed entry, is left as it came", () => {
289
+ for (const v of [undefined, null, "nodes", 3, { id: "x" }]) expect(withListedReferenceTaskTypes(v)).toBe(v)
290
+ const odd = [null, 7, "x", [], { type: "generate-video" }, { type: "generate-video", data: null }]
291
+ expect(withListedReferenceTaskTypes(odd)).toBe(odd)
292
+ })
293
+
294
+ it("is the rule normalizeNodeModelParams runs for the field: the same nodes and the same reports", () => {
295
+ const videoOnly = GRAPH.filter((n) => n.type !== "generate-image")
296
+ const adjustments: Parameters<typeof withListedReferenceTaskTypes>[1] = []
297
+ const viaWrites = withListedReferenceTaskTypes(videoOnly, adjustments)
298
+ const viaNormalizer = normalizeNodeModelParams(videoOnly)
299
+ expect(viaWrites).toStrictEqual(viaNormalizer.nodes)
300
+ expect(adjustments).toStrictEqual(viaNormalizer.adjustments)
301
+ })
302
+ })
@@ -0,0 +1,43 @@
1
+ import { describe, it, expect } from "vitest"
2
+ import {
3
+ LIP_SYNC_PROVIDERS,
4
+ REPLICATE_LIP_SYNC_PROVIDERS,
5
+ VIDEO_INPUT_LIP_SYNC_PROVIDERS,
6
+ FLEXIBLE_INPUT_LIP_SYNC_PROVIDERS,
7
+ RETIRED_LIP_SYNC_PROVIDERS,
8
+ retiredLipSyncProviderName,
9
+ retiredLipSyncProviderMessage,
10
+ } from "../entries/models.js"
11
+ import { MODEL_CATALOG } from "../entries/model-catalog.js"
12
+
13
+ /** Wav2Lip, VideoReTalking and SadTalker are retired from Lip Sync (decided 2026-11-12). */
14
+ describe("the Lip Sync models retired from Lip Sync", () => {
15
+ const RETIRED = ["wav2lip", "video-retalking", "sadtalker"]
16
+
17
+ it("are exactly the three, each with the name it is shown by", () => {
18
+ expect(RETIRED_LIP_SYNC_PROVIDERS).toEqual({ wav2lip: "Wav2Lip", "video-retalking": "VideoReTalking", sadtalker: "SadTalker" })
19
+ })
20
+
21
+ it("are offered nowhere: not a Lip Sync option, not a Replicate lip-sync option, not a catalog model", () => {
22
+ for (const id of RETIRED) {
23
+ expect(LIP_SYNC_PROVIDERS as readonly string[], id).not.toContain(id)
24
+ expect(REPLICATE_LIP_SYNC_PROVIDERS.has(id as never), id).toBe(false)
25
+ expect(MODEL_CATALOG[id], id).toBeUndefined()
26
+ }
27
+ })
28
+
29
+ it("keep their input kind, so a saved node on one keeps the inputs its connections attach to", () => {
30
+ expect(VIDEO_INPUT_LIP_SYNC_PROVIDERS.has("video-retalking" as never)).toBe(true)
31
+ expect(FLEXIBLE_INPUT_LIP_SYNC_PROVIDERS.has("wav2lip" as never)).toBe(true)
32
+ })
33
+
34
+ it("answer one sentence each, and nothing else does (own keys only)", () => {
35
+ expect(retiredLipSyncProviderMessage("wav2lip")).toBe("Wav2Lip is no longer available for Lip Sync. Pick another Lip Sync model.")
36
+ expect(retiredLipSyncProviderMessage("video-retalking")).toBe("VideoReTalking is no longer available for Lip Sync. Pick another Lip Sync model.")
37
+ expect(retiredLipSyncProviderMessage("sadtalker")).toBe("SadTalker is no longer available for Lip Sync. Pick another Lip Sync model.")
38
+ for (const value of [undefined, null, 42, "", "latentsync", "kling-avatar", "constructor", "toString", "__proto__"]) {
39
+ expect(retiredLipSyncProviderName(value), String(value)).toBeUndefined()
40
+ expect(retiredLipSyncProviderMessage(value), String(value)).toBeUndefined()
41
+ }
42
+ })
43
+ })