@nodaro/shared 3.63.0 → 3.64.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 (209) hide show
  1. package/dist/{chunk-AE3AAJ4O.js → chunk-36VWLB4J.js} +3 -3
  2. package/dist/{chunk-AE3AAJ4O.js.map → chunk-36VWLB4J.js.map} +1 -1
  3. package/dist/{chunk-HWQ2SYNA.js → chunk-3AYM47GW.js} +5 -5
  4. package/dist/{chunk-HWQ2SYNA.js.map → chunk-3AYM47GW.js.map} +1 -1
  5. package/dist/{chunk-CZ5IQB3L.js → chunk-3KTWYYCN.js} +8 -5
  6. package/dist/chunk-3KTWYYCN.js.map +1 -0
  7. package/dist/{chunk-4MMZD63H.js → chunk-4IUE2JB7.js} +3 -3
  8. package/dist/{chunk-4MMZD63H.js.map → chunk-4IUE2JB7.js.map} +1 -1
  9. package/dist/{chunk-M5OCFGHF.cjs → chunk-5OBTGNUQ.cjs} +296 -25
  10. package/dist/chunk-5OBTGNUQ.cjs.map +1 -0
  11. package/dist/{chunk-ZPE2ZTJ4.cjs → chunk-67CMMTLN.cjs} +4 -4
  12. package/dist/{chunk-ZPE2ZTJ4.cjs.map → chunk-67CMMTLN.cjs.map} +1 -1
  13. package/dist/{chunk-WRSWH7US.cjs → chunk-6BRWPJPP.cjs} +17 -2
  14. package/dist/chunk-6BRWPJPP.cjs.map +1 -0
  15. package/dist/{chunk-HBXF6RUU.js → chunk-6YIV37V7.js} +4 -4
  16. package/dist/{chunk-HBXF6RUU.js.map → chunk-6YIV37V7.js.map} +1 -1
  17. package/dist/{chunk-F6WGGYQW.cjs → chunk-7AJGUI7L.cjs} +37 -15
  18. package/dist/chunk-7AJGUI7L.cjs.map +1 -0
  19. package/dist/{chunk-KCZHQH2O.js → chunk-7KQ6W5DS.js} +4 -4
  20. package/dist/{chunk-KCZHQH2O.js.map → chunk-7KQ6W5DS.js.map} +1 -1
  21. package/dist/{chunk-TM5JYSJF.cjs → chunk-ACZZHHFZ.cjs} +72 -33
  22. package/dist/chunk-ACZZHHFZ.cjs.map +1 -0
  23. package/dist/{chunk-Y35JQPT6.cjs → chunk-AZNZ5WNZ.cjs} +42 -42
  24. package/dist/{chunk-Y35JQPT6.cjs.map → chunk-AZNZ5WNZ.cjs.map} +1 -1
  25. package/dist/{chunk-HSHCCBIV.js → chunk-BQYCZLMF.js} +16 -3
  26. package/dist/chunk-BQYCZLMF.js.map +1 -0
  27. package/dist/{chunk-GMBDLNLD.cjs → chunk-CHS2SIP6.cjs} +183 -60
  28. package/dist/chunk-CHS2SIP6.cjs.map +1 -0
  29. package/dist/{chunk-77WU3V3J.cjs → chunk-CHTZZRAL.cjs} +6 -6
  30. package/dist/{chunk-77WU3V3J.cjs.map → chunk-CHTZZRAL.cjs.map} +1 -1
  31. package/dist/{chunk-WZVIBAKN.cjs → chunk-D4KWNDPH.cjs} +12 -12
  32. package/dist/{chunk-WZVIBAKN.cjs.map → chunk-D4KWNDPH.cjs.map} +1 -1
  33. package/dist/{chunk-PSKZKLDG.js → chunk-DZ4IOP3Q.js} +288 -26
  34. package/dist/chunk-DZ4IOP3Q.js.map +1 -0
  35. package/dist/{chunk-XGVJGNZW.cjs → chunk-EXEVT6D2.cjs} +15 -5
  36. package/dist/chunk-EXEVT6D2.cjs.map +1 -0
  37. package/dist/{chunk-X5BAFW3Q.cjs → chunk-FHGRKQVZ.cjs} +8 -8
  38. package/dist/{chunk-X5BAFW3Q.cjs.map → chunk-FHGRKQVZ.cjs.map} +1 -1
  39. package/dist/{chunk-GSKLPI3J.cjs → chunk-GTWUS6MQ.cjs} +118 -61
  40. package/dist/chunk-GTWUS6MQ.cjs.map +1 -0
  41. package/dist/{chunk-Q6IES3U2.js → chunk-H5KHWTAE.js} +5 -2
  42. package/dist/chunk-H5KHWTAE.js.map +1 -0
  43. package/dist/{chunk-V5EEQR2U.cjs → chunk-HDPJNNMF.cjs} +21 -21
  44. package/dist/{chunk-V5EEQR2U.cjs.map → chunk-HDPJNNMF.cjs.map} +1 -1
  45. package/dist/{chunk-6M563QE6.js → chunk-IYSOVS7O.js} +55 -23
  46. package/dist/chunk-IYSOVS7O.js.map +1 -0
  47. package/dist/{chunk-XGGZWA4A.cjs → chunk-J6B7J73J.cjs} +52 -49
  48. package/dist/chunk-J6B7J73J.cjs.map +1 -0
  49. package/dist/{chunk-MD4XHED4.js → chunk-KB2SQAR3.js} +3 -3
  50. package/dist/{chunk-MD4XHED4.js.map → chunk-KB2SQAR3.js.map} +1 -1
  51. package/dist/{chunk-BLJUCPMV.cjs → chunk-KSHAAPQF.cjs} +5 -2
  52. package/dist/chunk-KSHAAPQF.cjs.map +1 -0
  53. package/dist/{chunk-6TGB7ECA.cjs → chunk-O4RPXBDZ.cjs} +12 -8
  54. package/dist/chunk-O4RPXBDZ.cjs.map +1 -0
  55. package/dist/{chunk-YUER7TJG.js → chunk-OBOOHG3N.js} +13 -4
  56. package/dist/chunk-OBOOHG3N.js.map +1 -0
  57. package/dist/{chunk-6BZC2ZHC.cjs → chunk-OOZW2MM6.cjs} +9 -9
  58. package/dist/{chunk-6BZC2ZHC.cjs.map → chunk-OOZW2MM6.cjs.map} +1 -1
  59. package/dist/{chunk-A2PX5IRC.cjs → chunk-PERUFUVH.cjs} +13 -13
  60. package/dist/{chunk-A2PX5IRC.cjs.map → chunk-PERUFUVH.cjs.map} +1 -1
  61. package/dist/{chunk-3K24DWOH.js → chunk-PJJAZQVZ.js} +3 -3
  62. package/dist/{chunk-3K24DWOH.js.map → chunk-PJJAZQVZ.js.map} +1 -1
  63. package/dist/{chunk-EPXGG27L.js → chunk-Q2Y4JHF7.js} +5 -5
  64. package/dist/{chunk-EPXGG27L.js.map → chunk-Q2Y4JHF7.js.map} +1 -1
  65. package/dist/{chunk-KMGCHV6O.js → chunk-QYU7J5EQ.js} +37 -15
  66. package/dist/chunk-QYU7J5EQ.js.map +1 -0
  67. package/dist/{chunk-IY3Y462W.js → chunk-S3UGLZSF.js} +3 -3
  68. package/dist/{chunk-IY3Y462W.js.map → chunk-S3UGLZSF.js.map} +1 -1
  69. package/dist/{chunk-34QLPTSA.js → chunk-SHH2T4CR.js} +3 -3
  70. package/dist/{chunk-34QLPTSA.js.map → chunk-SHH2T4CR.js.map} +1 -1
  71. package/dist/{chunk-L2TVY6XN.cjs → chunk-SPAHI7DY.cjs} +4 -4
  72. package/dist/{chunk-L2TVY6XN.cjs.map → chunk-SPAHI7DY.cjs.map} +1 -1
  73. package/dist/{chunk-YX6TFX7H.js → chunk-SXHHLZ22.js} +66 -11
  74. package/dist/chunk-SXHHLZ22.js.map +1 -0
  75. package/dist/{chunk-LMAQUR55.cjs → chunk-T2OVDF2M.cjs} +6 -6
  76. package/dist/{chunk-LMAQUR55.cjs.map → chunk-T2OVDF2M.cjs.map} +1 -1
  77. package/dist/{chunk-2QKF7M2Z.js → chunk-TAPBDT47.js} +3 -3
  78. package/dist/{chunk-2QKF7M2Z.js.map → chunk-TAPBDT47.js.map} +1 -1
  79. package/dist/{chunk-BMJVKYVB.js → chunk-TPQJKS7D.js} +109 -7
  80. package/dist/chunk-TPQJKS7D.js.map +1 -0
  81. package/dist/{chunk-63H4C56Q.cjs → chunk-TQW3R44P.cjs} +8 -8
  82. package/dist/{chunk-63H4C56Q.cjs.map → chunk-TQW3R44P.cjs.map} +1 -1
  83. package/dist/{chunk-4DVWXEB6.js → chunk-TTGZ2L3O.js} +3 -3
  84. package/dist/{chunk-4DVWXEB6.js.map → chunk-TTGZ2L3O.js.map} +1 -1
  85. package/dist/{chunk-XBTYGQ6Z.js → chunk-VPTA4Z7G.js} +8 -5
  86. package/dist/chunk-VPTA4Z7G.js.map +1 -0
  87. package/dist/{chunk-6XUG4L7X.cjs → chunk-VZ6TE23U.cjs} +6 -6
  88. package/dist/{chunk-6XUG4L7X.cjs.map → chunk-VZ6TE23U.cjs.map} +1 -1
  89. package/dist/{chunk-LH72PQO2.cjs → chunk-W6VJAUGM.cjs} +114 -45
  90. package/dist/chunk-W6VJAUGM.cjs.map +1 -0
  91. package/dist/{chunk-OV3JTKBY.js → chunk-W7KHHNZR.js} +74 -17
  92. package/dist/chunk-W7KHHNZR.js.map +1 -0
  93. package/dist/{chunk-2PU3AGGS.cjs → chunk-YQV53HRR.cjs} +7 -7
  94. package/dist/{chunk-2PU3AGGS.cjs.map → chunk-YQV53HRR.cjs.map} +1 -1
  95. package/dist/{chunk-FXGNRYQQ.js → chunk-ZI3QDUHO.js} +3 -3
  96. package/dist/{chunk-FXGNRYQQ.js.map → chunk-ZI3QDUHO.js.map} +1 -1
  97. package/dist/entries/apps.cjs +43 -42
  98. package/dist/entries/apps.js +8 -7
  99. package/dist/entries/captions.cjs +38 -30
  100. package/dist/entries/captions.d.cts +47 -1
  101. package/dist/entries/captions.d.ts +47 -1
  102. package/dist/entries/captions.js +1 -1
  103. package/dist/entries/credits.cjs +303 -191
  104. package/dist/entries/credits.d.cts +219 -15
  105. package/dist/entries/credits.d.ts +219 -15
  106. package/dist/entries/credits.js +11 -11
  107. package/dist/entries/llm-models.cjs +62 -62
  108. package/dist/entries/llm-models.d.cts +29 -7
  109. package/dist/entries/llm-models.d.ts +29 -7
  110. package/dist/entries/llm-models.js +2 -2
  111. package/dist/entries/model-catalog.cjs +149 -109
  112. package/dist/entries/model-catalog.d.cts +64 -7
  113. package/dist/entries/model-catalog.d.ts +64 -7
  114. package/dist/entries/model-catalog.js +4 -4
  115. package/dist/entries/models.cjs +394 -346
  116. package/dist/entries/models.d.cts +4 -4
  117. package/dist/entries/models.d.ts +4 -4
  118. package/dist/entries/models.js +5 -5
  119. package/dist/entries/nodes.cjs +220 -211
  120. package/dist/entries/nodes.d.cts +46 -3
  121. package/dist/entries/nodes.d.ts +46 -3
  122. package/dist/entries/nodes.js +10 -9
  123. package/dist/entries/pipeline.cjs +156 -152
  124. package/dist/entries/pipeline.d.cts +13 -3
  125. package/dist/entries/pipeline.d.ts +13 -3
  126. package/dist/entries/pipeline.js +3 -3
  127. package/dist/entries/social.cjs +177 -177
  128. package/dist/entries/social.js +2 -2
  129. package/dist/entries/ugc.cjs +71 -71
  130. package/dist/entries/ugc.js +4 -4
  131. package/dist/entries/video.cjs +145 -145
  132. package/dist/entries/video.js +6 -6
  133. package/dist/entries/workflow.cjs +150 -150
  134. package/dist/entries/workflow.d.cts +1 -1
  135. package/dist/entries/workflow.d.ts +1 -1
  136. package/dist/entries/workflow.js +2 -2
  137. package/dist/index.cjs +1879 -1659
  138. package/dist/index.d.cts +7 -7
  139. package/dist/index.d.ts +7 -7
  140. package/dist/index.js +25 -25
  141. package/dist/{model-catalog-C_Eo35tL.d.cts → model-catalog-Cf9fkEUp.d.cts} +15 -2
  142. package/dist/{model-catalog-C_Eo35tL.d.ts → model-catalog-Cf9fkEUp.d.ts} +15 -2
  143. package/dist/{model-constants-DWcxOmaY.d.cts → model-constants-BxjiWVQ9.d.ts} +89 -19
  144. package/dist/{model-constants-Bg4ccSQb.d.ts → model-constants-C_Nyft_i.d.cts} +89 -19
  145. package/package.json +1 -1
  146. package/src/__tests__/add-captions-nemotron-pricing.test.ts +111 -0
  147. package/src/__tests__/extend-providers.test.ts +266 -26
  148. package/src/__tests__/fixtures/mask-composite-quote-parity.json +1 -1
  149. package/src/__tests__/fixtures/measured-input-quote-parity.json +1435 -0
  150. package/src/__tests__/fixtures/planned-length-quote-parity.json +1866 -0
  151. package/src/__tests__/fixtures/video-utility-quote-parity.json +2343 -0
  152. package/src/__tests__/flux-3-klein.test.ts +203 -0
  153. package/src/__tests__/gpt-image-2-6-formats.test.ts +3 -1
  154. package/src/__tests__/llm-models.test.ts +7 -9
  155. package/src/__tests__/llm-price-key.test.ts +12 -0
  156. package/src/__tests__/model-makers.test.ts +3 -0
  157. package/src/__tests__/node-runtime-keys.test.ts +7 -0
  158. package/src/__tests__/normalize-node-params.test.ts +147 -1
  159. package/src/__tests__/retired-lip-sync-providers.test.ts +43 -0
  160. package/src/__tests__/seedance-extend-source-credit-id.test.ts +89 -0
  161. package/src/__tests__/sequence-execution.test.ts +22 -1
  162. package/src/__tests__/suno-credit-type.test.ts +21 -2
  163. package/src/__tests__/transcribe-capabilities.test.ts +4 -2
  164. package/src/__tests__/video-analysis-catalog-sync.test.ts +4 -2
  165. package/src/__tests__/video-analysis-pricing.test.ts +10 -9
  166. package/src/caption-styles.ts +62 -0
  167. package/src/credit-estimators/add-captions-nemotron.ts +73 -0
  168. package/src/credit-estimators/index.ts +10 -0
  169. package/src/credit-identifiers.ts +249 -13
  170. package/src/entries/captions.ts +2 -0
  171. package/src/entries/credits.ts +25 -1
  172. package/src/entries/model-catalog.ts +13 -0
  173. package/src/entries/models.ts +15 -0
  174. package/src/entries/nodes.ts +2 -0
  175. package/src/entries/pipeline.ts +1 -1
  176. package/src/flux-3-klein.ts +69 -0
  177. package/src/input-image-pricing.ts +23 -6
  178. package/src/llm-models.ts +60 -16
  179. package/src/model-catalog.ts +280 -25
  180. package/src/model-constants.ts +146 -17
  181. package/src/node-default-mappings.ts +3 -0
  182. package/src/node-runtime-keys.ts +3 -0
  183. package/src/normalize-node-params.ts +123 -2
  184. package/src/seedance-extend-rate.ts +116 -0
  185. package/src/sequence-execution.ts +24 -0
  186. package/src/transcribe-preflight.ts +23 -0
  187. package/src/video-analysis-pricing.ts +28 -15
  188. package/dist/chunk-6M563QE6.js.map +0 -1
  189. package/dist/chunk-6TGB7ECA.cjs.map +0 -1
  190. package/dist/chunk-BLJUCPMV.cjs.map +0 -1
  191. package/dist/chunk-BMJVKYVB.js.map +0 -1
  192. package/dist/chunk-CZ5IQB3L.js.map +0 -1
  193. package/dist/chunk-F6WGGYQW.cjs.map +0 -1
  194. package/dist/chunk-GMBDLNLD.cjs.map +0 -1
  195. package/dist/chunk-GSKLPI3J.cjs.map +0 -1
  196. package/dist/chunk-HSHCCBIV.js.map +0 -1
  197. package/dist/chunk-KMGCHV6O.js.map +0 -1
  198. package/dist/chunk-LH72PQO2.cjs.map +0 -1
  199. package/dist/chunk-M5OCFGHF.cjs.map +0 -1
  200. package/dist/chunk-OV3JTKBY.js.map +0 -1
  201. package/dist/chunk-PSKZKLDG.js.map +0 -1
  202. package/dist/chunk-Q6IES3U2.js.map +0 -1
  203. package/dist/chunk-TM5JYSJF.cjs.map +0 -1
  204. package/dist/chunk-WRSWH7US.cjs.map +0 -1
  205. package/dist/chunk-XBTYGQ6Z.js.map +0 -1
  206. package/dist/chunk-XGGZWA4A.cjs.map +0 -1
  207. package/dist/chunk-XGVJGNZW.cjs.map +0 -1
  208. package/dist/chunk-YUER7TJG.js.map +0 -1
  209. 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
  })
@@ -14,6 +14,7 @@ import {
14
14
  getLlmTier,
15
15
  getLlmModalityCaps,
16
16
  VIDEO_ANALYSIS_LLM_MODELS,
17
+ VIDEO_ANALYSIS_TIERS,
17
18
  buildLlmCreditIdentifier,
18
19
  resolveLlmCreditId,
19
20
  motionGraphicsFeature,
@@ -1008,15 +1009,12 @@ describe("gemini-3.8-flash exposure", () => {
1008
1009
  expect(getLlmModel("gemini-3-8-flash-openai")?.id).toBe("gemini-3.8-flash")
1009
1010
  })
1010
1011
 
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")
1012
+ it("backs the video-analysis fast tier — full video + audio caps (decided 2026-11-13)", () => {
1013
+ // Full caps are what enrol it in VIDEO_ANALYSIS_LLM_MODELS; the fast tier
1014
+ // moved here when KIE dropped gemini-3-flash's channel.
1015
+ expect(getLlmModalityCaps("gemini-3.8-flash")).toEqual({ image: true, video: true, audio: true })
1016
+ expect(VIDEO_ANALYSIS_LLM_MODELS).toContain("gemini-3.8-flash")
1017
+ expect(VIDEO_ANALYSIS_TIERS.fast).toBe("gemini-3.8-flash")
1020
1018
  })
1021
1019
  })
1022
1020
 
@@ -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
+ })
@@ -0,0 +1,89 @@
1
+ import { describe, expect, it } from "vitest"
2
+ import {
3
+ seedanceExtendAddedSec,
4
+ seedanceExtendFullWindowCreditId,
5
+ seedanceExtendRefusesSource,
6
+ seedanceExtendSentSec,
7
+ seedanceExtendSourceCreditId,
8
+ seedanceExtendSourceSec,
9
+ seedanceExtendUnits,
10
+ tailExtendCreditId,
11
+ } from "../entries/credits.js"
12
+
13
+ /**
14
+ * `seedanceExtendSourceCreditId` (decided 2026-11-13): the ONE whole-run quote
15
+ * id a Seedance 2.5 Extend run on a known source is charged, by the seconds
16
+ * rule the server charges it by — units = (seconds sent + seconds added) ÷ 2,
17
+ * the seconds sent the source's picture read by the container-overhang rule,
18
+ * at most 10. Its parity with the server's charge is held in the backend
19
+ * (`seedance-extend-source-quote.test.ts`), where the server's quote
20
+ * resolution runs.
21
+ */
22
+
23
+ const RESOLUTIONS = [undefined, "480p", "720p", "1080p", "4k"] as const
24
+ const DURATIONS = [undefined, 1, 4, 8, 12, 30, 45, "12", -1] as const
25
+
26
+ describe("seedanceExtendSourceCreditId", () => {
27
+ it.each([
28
+ // [source picture s, seconds added, resolution, id]
29
+ [1.8, 4, "480p", "seedance-2-5-extend:480p:per-2s:2.9u"],
30
+ [4, 8, "720p", "seedance-2-5-extend:720p:per-2s:6u"],
31
+ // 8.04 s is a whole 8 s by the container-overhang rule; 8.3 s counts as measured.
32
+ [8.04, 8, "720p", "seedance-2-5-extend:720p:per-2s:8u"],
33
+ [8.3, 8, "720p", "seedance-2-5-extend:720p:per-2s:8.15u"],
34
+ // At most the 10 s window is sent: 10.05 s reads as 10 s, 25 s sends its last 10.
35
+ [10.05, 30, "1080p", "seedance-2-5-extend:1080p:per-2s:20u"],
36
+ [25, 4, "1080p", "seedance-2-5-extend:1080p:per-2s:7u"],
37
+ ] as const)("a %s s source, %s s added at %s: %s", (source, added, resolution, id) => {
38
+ expect(seedanceExtendSourceCreditId(source, added, resolution)).toBe(id)
39
+ })
40
+
41
+ it("a source the extend refuses (a measured picture under 1.8 s) names no id, whatever the seconds added", () => {
42
+ for (const [source, added] of [[1.7, 4], [1.7, 8], [1.0, 8], [0.5, 30], [1.79, 30]] as const) {
43
+ expect(seedanceExtendSourceCreditId(source, added, "720p"), `${source} s + ${added} s`).toBeUndefined()
44
+ }
45
+ expect(seedanceExtendSourceCreditId(1.8, 8, "720p")).toBe("seedance-2-5-extend:720p:per-2s:4.9u")
46
+ expect([1.79, 1.8, undefined, 0].map(seedanceExtendRefusesSource)).toEqual([true, false, false, false])
47
+ })
48
+
49
+ it("a length not known or unreadable names the full-window id, string for string", () => {
50
+ for (const unknown of [undefined, null, Number.NaN, 0, -1, -0.5, Number.POSITIVE_INFINITY]) {
51
+ for (const duration of DURATIONS) {
52
+ for (const resolution of RESOLUTIONS) {
53
+ expect(seedanceExtendSourceCreditId(unknown, duration, resolution), `${String(unknown)} ${String(duration)} ${String(resolution)}`)
54
+ .toBe(seedanceExtendFullWindowCreditId(duration, resolution))
55
+ }
56
+ }
57
+ }
58
+ // …which is what every client's builder names for a Seedance 2.5 extend.
59
+ expect(seedanceExtendFullWindowCreditId(8, "720p")).toBe(tailExtendCreditId("seedance-2-5-extend", 8, "720p"))
60
+ expect(seedanceExtendFullWindowCreditId(8, "720p")).toBe("seedance-2-5-extend:720p:per-2s:9u")
61
+ })
62
+
63
+ it("a source of 10 s or longer is the full window: the most a run sends", () => {
64
+ for (const source of [10, 10.2, 12, 25, 3600]) {
65
+ expect(seedanceExtendSourceCreditId(source, 8, "720p")).toBe(seedanceExtendFullWindowCreditId(8, "720p"))
66
+ }
67
+ })
68
+
69
+ it("is the seconds rule, composed: units = (sent + added) ÷ 2 on the resolution's two-second row", () => {
70
+ for (const source of [1.8, 2, 4.37, 6.04, 8.25, 8.26, 9.99]) {
71
+ for (const duration of DURATIONS) {
72
+ const units = seedanceExtendUnits(seedanceExtendSentSec(source), seedanceExtendAddedSec("seedance-2-5-extend", duration))
73
+ expect(seedanceExtendSourceCreditId(source, duration, "1080p")).toBe(`seedance-2-5-extend:1080p:per-2s:${String(units)}u`)
74
+ }
75
+ }
76
+ })
77
+ })
78
+
79
+ describe("the seconds rule (moved from @nodaro/render-rules, unchanged)", () => {
80
+ it("reads a picture by the container-overhang rule, then caps it at the 10 s window", () => {
81
+ expect([8.04, 8.25, 8.26, 8.3, 4.37, 0.5, 1.2].map(seedanceExtendSourceSec)).toEqual([8, 8, 8.26, 8.3, 4.37, 0.5, 1])
82
+ expect([1.8, 8.04, 10.05, 25, undefined, null, 0, Number.NaN].map(seedanceExtendSentSec)).toEqual([1.8, 8, 10, 10, 10, 10, 10, 10])
83
+ })
84
+
85
+ it("adds the requested seconds held in the catalog window (default 8 s), for every tail-recipe provider", () => {
86
+ expect([undefined, 1, 4, 30, 45, "12", "abc"].map((d) => seedanceExtendAddedSec("seedance-2-5-extend", d))).toEqual([8, 4, 4, 30, 30, 12, 8])
87
+ expect(seedanceExtendAddedSec("kling-4-extend", undefined)).toBe(5)
88
+ })
89
+ })
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, it } from "vitest"
2
- import { assertCanvasExecutionAllowed, requiresSequenceExecution, STUDIO_DEPENDENT_FRAMES_CAPABILITY } from "../sequence-execution"
2
+ import { assertCanvasExecutionAllowed, isCodecOwnedDocument, requiresSequenceExecution, STUDIO_DEPENDENT_FRAMES_CAPABILITY } from "../sequence-execution"
3
3
 
4
4
  describe("dependency execution boundary", () => {
5
5
  it.each([
@@ -18,3 +18,24 @@ describe("dependency execution boundary", () => {
18
18
  .toThrow(expect.objectContaining({ nodeIds: ["linked"] }))
19
19
  })
20
20
  })
21
+
22
+ describe("isCodecOwnedDocument — the one predicate the server's routes and the editor ask", () => {
23
+ it("a Studio settings block holding keyframes, sequences or settled jobs, or declaring dependent frames", () => {
24
+ for (const studio of [{ keyframes: [] }, { sequences: [] }, { settledJobIds: [] }, { requiredCapabilities: [STUDIO_DEPENDENT_FRAMES_CAPABILITY] }]) {
25
+ expect(isCodecOwnedDocument([], { studio }), JSON.stringify(studio)).toBe(true)
26
+ }
27
+ })
28
+
29
+ it("any node carrying keyframeId, sequenceBinding or the declaration — whatever the settings", () => {
30
+ for (const data of [{ keyframeId: "k" }, { keyframeId: undefined }, { sequenceBinding: {} }, { requiredCapabilities: [STUDIO_DEPENDENT_FRAMES_CAPABILITY] }]) {
31
+ expect(isCodecOwnedDocument([{ id: "a", data: {} }, { id: "b", data }], {}), JSON.stringify(data)).toBe(true)
32
+ }
33
+ })
34
+
35
+ it("an ordinary document, a Studio marker alone, and malformed input are not", () => {
36
+ expect(isCodecOwnedDocument([{ id: "a", data: { prompt: "x" } }], {})).toBe(false)
37
+ expect(isCodecOwnedDocument([], { studio: { shots: [] } })).toBe(false)
38
+ expect(isCodecOwnedDocument([{ id: "a", data: { requiredCapabilities: ["other"] } }], null)).toBe(false)
39
+ for (const v of [undefined, null, "x", 3, [null, 7, { data: null }]]) expect(isCodecOwnedDocument(v, v)).toBe(false)
40
+ })
41
+ })