@nodaro/shared 3.61.0 → 3.62.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 (254) hide show
  1. package/dist/{chunk-IVXSNW2B.cjs → chunk-2D5LQFV4.cjs} +18 -332
  2. package/dist/chunk-2D5LQFV4.cjs.map +1 -0
  3. package/dist/{chunk-XUJC6GHE.cjs → chunk-2HZGDZZN.cjs} +6 -6
  4. package/dist/{chunk-XUJC6GHE.cjs.map → chunk-2HZGDZZN.cjs.map} +1 -1
  5. package/dist/{chunk-43TGSZRJ.js → chunk-2QKF7M2Z.js} +3 -3
  6. package/dist/{chunk-43TGSZRJ.js.map → chunk-2QKF7M2Z.js.map} +1 -1
  7. package/dist/{chunk-7ARKVJTN.cjs → chunk-2W745U4A.cjs} +228 -355
  8. package/dist/chunk-2W745U4A.cjs.map +1 -0
  9. package/dist/{chunk-673E4KYC.js → chunk-3OYO3XCC.js} +70 -6
  10. package/dist/chunk-3OYO3XCC.js.map +1 -0
  11. package/dist/{chunk-FMXFHJWX.cjs → chunk-4ZEFP2FQ.cjs} +4 -4
  12. package/dist/{chunk-FMXFHJWX.cjs.map → chunk-4ZEFP2FQ.cjs.map} +1 -1
  13. package/dist/{chunk-A3FHTSLB.js → chunk-5YYN5X57.js} +302 -27
  14. package/dist/chunk-5YYN5X57.js.map +1 -0
  15. package/dist/{chunk-4KYLNTR7.cjs → chunk-6CSXMWL4.cjs} +4 -4
  16. package/dist/{chunk-4KYLNTR7.cjs.map → chunk-6CSXMWL4.cjs.map} +1 -1
  17. package/dist/{chunk-M3SXUUWC.cjs → chunk-6FQBKI2A.cjs} +4 -11
  18. package/dist/chunk-6FQBKI2A.cjs.map +1 -0
  19. package/dist/{chunk-G4XWVWRI.js → chunk-6G7NN4S4.js} +5 -4
  20. package/dist/chunk-6G7NN4S4.js.map +1 -0
  21. package/dist/{chunk-ZFJN23V4.cjs → chunk-A2PX5IRC.cjs} +4 -4
  22. package/dist/{chunk-ZFJN23V4.cjs.map → chunk-A2PX5IRC.cjs.map} +1 -1
  23. package/dist/{chunk-JHTT2V4A.cjs → chunk-AFYTX4AI.cjs} +52 -43
  24. package/dist/chunk-AFYTX4AI.cjs.map +1 -0
  25. package/dist/chunk-ALRXY4QH.cjs +13 -0
  26. package/dist/chunk-ALRXY4QH.cjs.map +1 -0
  27. package/dist/chunk-AOJ6B7K4.cjs +351 -0
  28. package/dist/chunk-AOJ6B7K4.cjs.map +1 -0
  29. package/dist/{chunk-ZDBPQBAA.js → chunk-C7POAYFE.js} +3 -3
  30. package/dist/{chunk-ZDBPQBAA.js.map → chunk-C7POAYFE.js.map} +1 -1
  31. package/dist/{chunk-B6BG3LV2.js → chunk-CC4V2B7S.js} +3 -3
  32. package/dist/{chunk-B6BG3LV2.js.map → chunk-CC4V2B7S.js.map} +1 -1
  33. package/dist/{chunk-XZKFZMRT.cjs → chunk-CIPPPT7E.cjs} +6 -6
  34. package/dist/{chunk-XZKFZMRT.cjs.map → chunk-CIPPPT7E.cjs.map} +1 -1
  35. package/dist/{chunk-6XVHYD5R.js → chunk-CLAKSLXF.js} +4 -9
  36. package/dist/chunk-CLAKSLXF.js.map +1 -0
  37. package/dist/chunk-CTANEPMY.js +61 -0
  38. package/dist/chunk-CTANEPMY.js.map +1 -0
  39. package/dist/{chunk-WGKAOUEQ.cjs → chunk-D34K455O.cjs} +3 -2
  40. package/dist/chunk-D34K455O.cjs.map +1 -0
  41. package/dist/chunk-E2HZTGYX.js +331 -0
  42. package/dist/chunk-E2HZTGYX.js.map +1 -0
  43. package/dist/{chunk-RQ4F3AJH.cjs → chunk-G3KVK7OU.cjs} +21 -21
  44. package/dist/{chunk-RQ4F3AJH.cjs.map → chunk-G3KVK7OU.cjs.map} +1 -1
  45. package/dist/chunk-G4U3HW6W.js +453 -0
  46. package/dist/chunk-G4U3HW6W.js.map +1 -0
  47. package/dist/{chunk-IRQ3SPX7.js → chunk-GSFB537T.js} +3 -3
  48. package/dist/{chunk-IRQ3SPX7.js.map → chunk-GSFB537T.js.map} +1 -1
  49. package/dist/chunk-HRY7KGAE.cjs +506 -0
  50. package/dist/chunk-HRY7KGAE.cjs.map +1 -0
  51. package/dist/{chunk-VOWJCUMR.js → chunk-I2RQB7VG.js} +3 -3
  52. package/dist/{chunk-VOWJCUMR.js.map → chunk-I2RQB7VG.js.map} +1 -1
  53. package/dist/chunk-IDTKF5EX.cjs +48 -0
  54. package/dist/chunk-IDTKF5EX.cjs.map +1 -0
  55. package/dist/{chunk-5XRRENHD.cjs → chunk-IWWVPR3W.cjs} +88 -11
  56. package/dist/chunk-IWWVPR3W.cjs.map +1 -0
  57. package/dist/{chunk-SCMTN57Y.js → chunk-JJNNM23P.js} +3 -3
  58. package/dist/{chunk-SCMTN57Y.js.map → chunk-JJNNM23P.js.map} +1 -1
  59. package/dist/{chunk-ZZGQRRN7.js → chunk-JZGZ26YB.js} +6 -306
  60. package/dist/chunk-JZGZ26YB.js.map +1 -0
  61. package/dist/{chunk-XROE3CAS.cjs → chunk-KHH54GRP.cjs} +120 -79
  62. package/dist/chunk-KHH54GRP.cjs.map +1 -0
  63. package/dist/{chunk-NJVOJXBS.cjs → chunk-KJSRPHJ2.cjs} +48 -47
  64. package/dist/chunk-KJSRPHJ2.cjs.map +1 -0
  65. package/dist/{chunk-FVVD6XY2.js → chunk-KL6GAYTT.js} +13 -4
  66. package/dist/chunk-KL6GAYTT.js.map +1 -0
  67. package/dist/{chunk-AFQFGZN7.cjs → chunk-KYMHFVAZ.cjs} +8 -6
  68. package/dist/chunk-KYMHFVAZ.cjs.map +1 -0
  69. package/dist/{chunk-F5YEMSNK.cjs → chunk-MYJQELFN.cjs} +320 -26
  70. package/dist/chunk-MYJQELFN.cjs.map +1 -0
  71. package/dist/chunk-N5HH46JF.cjs +68 -0
  72. package/dist/chunk-N5HH46JF.cjs.map +1 -0
  73. package/dist/{chunk-MQZRQ5LM.cjs → chunk-N7OUQK7E.cjs} +8 -8
  74. package/dist/{chunk-MQZRQ5LM.cjs.map → chunk-N7OUQK7E.cjs.map} +1 -1
  75. package/dist/{chunk-UARGJ5IZ.js → chunk-NGKKNSK6.js} +30 -7
  76. package/dist/chunk-NGKKNSK6.js.map +1 -0
  77. package/dist/{chunk-SWVGHAYO.js → chunk-O7RZRUMZ.js} +110 -74
  78. package/dist/chunk-O7RZRUMZ.js.map +1 -0
  79. package/dist/{chunk-C77F4ZTL.js → chunk-PTD6EDUU.js} +3 -3
  80. package/dist/{chunk-C77F4ZTL.js.map → chunk-PTD6EDUU.js.map} +1 -1
  81. package/dist/{chunk-ZNM2LW3D.cjs → chunk-QWYFHQYK.cjs} +78 -53
  82. package/dist/chunk-QWYFHQYK.cjs.map +1 -0
  83. package/dist/{chunk-VB2ARGQ6.js → chunk-RGNHHIMN.js} +3 -3
  84. package/dist/chunk-RGNHHIMN.js.map +1 -0
  85. package/dist/{chunk-MOMFX32D.js → chunk-S24ZBUB4.js} +194 -299
  86. package/dist/chunk-S24ZBUB4.js.map +1 -0
  87. package/dist/{chunk-EWS2VFO4.js → chunk-S5TMRJMX.js} +4 -4
  88. package/dist/{chunk-EWS2VFO4.js.map → chunk-S5TMRJMX.js.map} +1 -1
  89. package/dist/chunk-SMOO5FAH.js +10 -0
  90. package/dist/chunk-SMOO5FAH.js.map +1 -0
  91. package/dist/{chunk-RUHKBEFF.js → chunk-SYWR5G3T.js} +16 -7
  92. package/dist/chunk-SYWR5G3T.js.map +1 -0
  93. package/dist/{chunk-FQXRYPCX.cjs → chunk-TRVWMKNE.cjs} +337 -52
  94. package/dist/chunk-TRVWMKNE.cjs.map +1 -0
  95. package/dist/{chunk-LLOIAGFB.js → chunk-UDDVDQMF.js} +292 -35
  96. package/dist/chunk-UDDVDQMF.js.map +1 -0
  97. package/dist/{chunk-PONP5J5E.cjs → chunk-V24EPI5N.cjs} +13 -3
  98. package/dist/chunk-V24EPI5N.cjs.map +1 -0
  99. package/dist/{chunk-5I4T4QR5.cjs → chunk-VACPZPUA.cjs} +5 -5
  100. package/dist/{chunk-5I4T4QR5.cjs.map → chunk-VACPZPUA.cjs.map} +1 -1
  101. package/dist/{chunk-HGI2VKIV.js → chunk-Y6X7UJSD.js} +10 -9
  102. package/dist/chunk-Y6X7UJSD.js.map +1 -0
  103. package/dist/chunk-YCXRSWCQ.js +42 -0
  104. package/dist/chunk-YCXRSWCQ.js.map +1 -0
  105. package/dist/entries/apps.cjs +44 -44
  106. package/dist/entries/apps.js +9 -9
  107. package/dist/entries/credits.cjs +217 -152
  108. package/dist/entries/credits.d.cts +105 -3
  109. package/dist/entries/credits.d.ts +105 -3
  110. package/dist/entries/credits.js +13 -8
  111. package/dist/entries/entities.cjs +188 -143
  112. package/dist/entries/entities.d.cts +122 -1
  113. package/dist/entries/entities.d.ts +122 -1
  114. package/dist/entries/entities.js +2 -1
  115. package/dist/entries/llm-models.d.cts +2 -1
  116. package/dist/entries/llm-models.d.ts +2 -1
  117. package/dist/entries/media.cjs +92 -87
  118. package/dist/entries/media.d.cts +11 -1
  119. package/dist/entries/media.d.ts +11 -1
  120. package/dist/entries/media.js +3 -2
  121. package/dist/entries/model-catalog.cjs +195 -103
  122. package/dist/entries/model-catalog.d.cts +90 -4
  123. package/dist/entries/model-catalog.d.ts +90 -4
  124. package/dist/entries/model-catalog.js +5 -5
  125. package/dist/entries/models.cjs +407 -294
  126. package/dist/entries/models.d.cts +4 -3
  127. package/dist/entries/models.d.ts +4 -3
  128. package/dist/entries/models.js +6 -5
  129. package/dist/entries/nodes.cjs +241 -233
  130. package/dist/entries/nodes.d.cts +15 -2
  131. package/dist/entries/nodes.d.ts +15 -2
  132. package/dist/entries/nodes.js +10 -10
  133. package/dist/entries/pipeline.cjs +152 -152
  134. package/dist/entries/pipeline.d.cts +2 -1
  135. package/dist/entries/pipeline.d.ts +2 -1
  136. package/dist/entries/pipeline.js +3 -3
  137. package/dist/entries/ugc.cjs +71 -71
  138. package/dist/entries/ugc.js +4 -4
  139. package/dist/entries/video.cjs +308 -204
  140. package/dist/entries/video.d.cts +480 -98
  141. package/dist/entries/video.d.ts +480 -98
  142. package/dist/entries/video.js +8 -4
  143. package/dist/entries/workflow.cjs +102 -102
  144. package/dist/entries/workflow.d.cts +5 -4
  145. package/dist/entries/workflow.d.ts +5 -4
  146. package/dist/entries/workflow.js +2 -2
  147. package/dist/{gpt-image-2-6-BeZdT-pW.d.cts → gpt-image-2-6-jIRQBRag.d.cts} +6 -0
  148. package/dist/{gpt-image-2-6-BeZdT-pW.d.ts → gpt-image-2-6-jIRQBRag.d.ts} +6 -0
  149. package/dist/index.cjs +2309 -1886
  150. package/dist/index.d.cts +9 -9
  151. package/dist/index.d.ts +9 -9
  152. package/dist/index.js +26 -23
  153. package/dist/{model-catalog-BgSvskgY.d.cts → model-catalog-CCEcv08q.d.cts} +128 -14
  154. package/dist/{model-catalog-BgSvskgY.d.ts → model-catalog-CCEcv08q.d.ts} +128 -14
  155. package/dist/{model-constants-DHd9jwQ7.d.ts → model-constants-B88p6XR0.d.ts} +299 -19
  156. package/dist/{model-constants-DHd9jwQ7.d.cts → model-constants-Cf3zaITt.d.cts} +299 -19
  157. package/package.json +1 -1
  158. package/src/__tests__/extend-providers.test.ts +114 -0
  159. package/src/__tests__/fixtures/mask-composite-quote-parity.json +118 -0
  160. package/src/__tests__/fixtures/root-exports.baseline.json +68 -0
  161. package/src/__tests__/gpt-image-2-6-formats.test.ts +4 -1
  162. package/src/__tests__/grok-video-15-catalog.test.ts +189 -0
  163. package/src/__tests__/gvp-supported-providers.test.ts +5 -2
  164. package/src/__tests__/minimax-h3-image.test.ts +140 -0
  165. package/src/__tests__/model-makers.test.ts +49 -11
  166. package/src/__tests__/model-tree.test.ts +13 -0
  167. package/src/__tests__/retired-video-provider.test.ts +15 -5
  168. package/src/__tests__/seedance-25-catalog-modes.test.ts +1 -1
  169. package/src/__tests__/seedance-task-type.test.ts +178 -0
  170. package/src/__tests__/seedream-5-5.test.ts +117 -0
  171. package/src/__tests__/unit-contract-compose.test.ts +27 -1
  172. package/src/__tests__/unit-contracts.test.ts +20 -6
  173. package/src/__tests__/upscale-factors.test.ts +107 -0
  174. package/src/__tests__/video-character-refs.test.ts +20 -2
  175. package/src/__tests__/video-collapse-parity.test.ts +19 -0
  176. package/src/__tests__/video-overlay-geometry.test.ts +68 -0
  177. package/src/__tests__/video-overlay-layer-plan.test.ts +3 -4
  178. package/src/__tests__/video-overlay-layouts.test.ts +529 -0
  179. package/src/__tests__/video-overlay-pricing.test.ts +61 -0
  180. package/src/__tests__/video-overlay-validate.test.ts +128 -0
  181. package/src/__tests__/video-overlay-wired-kind.test.ts +207 -0
  182. package/src/__tests__/video-overlay.test.ts +280 -194
  183. package/src/__tests__/video-ref-limits.test.ts +2 -1
  184. package/src/__tests__/video-reference-only.test.ts +6 -2
  185. package/src/__tests__/video-start-frame-only.test.ts +98 -0
  186. package/src/__tests__/wired-character-names.test.ts +220 -0
  187. package/src/credit-estimators/index.ts +8 -0
  188. package/src/credit-estimators/video-overlay.ts +70 -0
  189. package/src/credit-identifiers.ts +94 -1
  190. package/src/entity-image-url.ts +21 -0
  191. package/src/entries/credits.ts +14 -0
  192. package/src/entries/entities.ts +14 -0
  193. package/src/entries/model-catalog.ts +35 -1
  194. package/src/entries/models.ts +34 -0
  195. package/src/entries/nodes.ts +2 -0
  196. package/src/entries/video.ts +6 -0
  197. package/src/generated/unit-contracts.ts +8 -1
  198. package/src/gpt-image-2-6.ts +6 -0
  199. package/src/input-image-pricing.ts +76 -0
  200. package/src/mask-composite.ts +11 -0
  201. package/src/minimax-h3-image.ts +61 -0
  202. package/src/model-catalog.ts +355 -37
  203. package/src/model-constants.ts +590 -32
  204. package/src/node-default-mappings.ts +12 -2
  205. package/src/node-execution-state.ts +4 -3
  206. package/src/producer-types.ts +23 -1
  207. package/src/seedance-task-type.ts +37 -0
  208. package/src/seedream-5-5.ts +45 -0
  209. package/src/unit-contract-compose.ts +4 -1
  210. package/src/upscale-factors.ts +111 -0
  211. package/src/video-character-refs.ts +7 -4
  212. package/src/video-overlay-geometry.ts +99 -0
  213. package/src/video-overlay-input.ts +25 -0
  214. package/src/video-overlay-layout-ids.ts +48 -0
  215. package/src/video-overlay-layouts.ts +315 -0
  216. package/src/video-overlay-validate.ts +223 -0
  217. package/src/video-overlay-video-layers.ts +304 -0
  218. package/src/video-overlay.ts +165 -297
  219. package/src/video-ui-defaults.ts +8 -6
  220. package/src/wired-character-names.ts +202 -0
  221. package/dist/chunk-5XRRENHD.cjs.map +0 -1
  222. package/dist/chunk-673E4KYC.js.map +0 -1
  223. package/dist/chunk-6XVHYD5R.js.map +0 -1
  224. package/dist/chunk-7ARKVJTN.cjs.map +0 -1
  225. package/dist/chunk-7WGKP3EU.js +0 -23
  226. package/dist/chunk-7WGKP3EU.js.map +0 -1
  227. package/dist/chunk-A3FHTSLB.js.map +0 -1
  228. package/dist/chunk-AFQFGZN7.cjs.map +0 -1
  229. package/dist/chunk-F5YEMSNK.cjs.map +0 -1
  230. package/dist/chunk-FQXRYPCX.cjs.map +0 -1
  231. package/dist/chunk-FVVD6XY2.js.map +0 -1
  232. package/dist/chunk-G4XWVWRI.js.map +0 -1
  233. package/dist/chunk-HGI2VKIV.js.map +0 -1
  234. package/dist/chunk-IVXSNW2B.cjs.map +0 -1
  235. package/dist/chunk-JHTT2V4A.cjs.map +0 -1
  236. package/dist/chunk-KHZAQGRP.js +0 -17
  237. package/dist/chunk-KHZAQGRP.js.map +0 -1
  238. package/dist/chunk-LLOIAGFB.js.map +0 -1
  239. package/dist/chunk-M3SXUUWC.cjs.map +0 -1
  240. package/dist/chunk-MOMFX32D.js.map +0 -1
  241. package/dist/chunk-NCOGGRRP.cjs +0 -27
  242. package/dist/chunk-NCOGGRRP.cjs.map +0 -1
  243. package/dist/chunk-NJVOJXBS.cjs.map +0 -1
  244. package/dist/chunk-PONP5J5E.cjs.map +0 -1
  245. package/dist/chunk-RUHKBEFF.js.map +0 -1
  246. package/dist/chunk-SWVGHAYO.js.map +0 -1
  247. package/dist/chunk-UARGJ5IZ.js.map +0 -1
  248. package/dist/chunk-VB2ARGQ6.js.map +0 -1
  249. package/dist/chunk-WGKAOUEQ.cjs.map +0 -1
  250. package/dist/chunk-XROE3CAS.cjs.map +0 -1
  251. package/dist/chunk-ZLDFPVVI.cjs +0 -19
  252. package/dist/chunk-ZLDFPVVI.cjs.map +0 -1
  253. package/dist/chunk-ZNM2LW3D.cjs.map +0 -1
  254. package/dist/chunk-ZZGQRRN7.js.map +0 -1
@@ -0,0 +1,140 @@
1
+ import { describe, expect, it } from "vitest"
2
+ import { buildCreditModelIdentifier, resolveNormalizedImageGen } from "../credit-identifiers.js"
3
+ import { MODEL_CATALOG, defaultResolutionFor, normalizeModelInput } from "../model-catalog.js"
4
+ import {
5
+ MINIMAX_H3_IMAGE_I2I,
6
+ MINIMAX_H3_IMAGE_T2I,
7
+ isMinimaxH3Image,
8
+ minimaxH3ImageCreditId,
9
+ } from "../minimax-h3-image.js"
10
+ import { isPricedPerInputImage, pricedEstimatedImages, pricedSentImages } from "../input-image-pricing.js"
11
+ import {
12
+ IMAGE_GEN_PROVIDERS,
13
+ IMAGE_I2I_PROVIDERS,
14
+ MINIMAX_H3_PROVIDERS,
15
+ REF_IMAGE_MAX_LIMITS,
16
+ T2I_TO_I2I_VARIANT,
17
+ imageReferenceLimit,
18
+ isMinimaxH3Provider,
19
+ requestImageLimit,
20
+ } from "../model-constants.js"
21
+
22
+ const T2I = MINIMAX_H3_IMAGE_T2I
23
+ const I2I = MINIMAX_H3_IMAGE_I2I
24
+
25
+ describe("MiniMax H3 Image ids", () => {
26
+ it("is an image model on both lists, and never the H3 video model", () => {
27
+ expect(IMAGE_GEN_PROVIDERS).toContain(T2I)
28
+ expect(IMAGE_I2I_PROVIDERS).toContain(I2I)
29
+ for (const id of [T2I, I2I]) {
30
+ expect(MODEL_CATALOG[id]!.kind).toBe("image")
31
+ expect(MINIMAX_H3_PROVIDERS.has(id)).toBe(false)
32
+ expect(isMinimaxH3Provider(id)).toBe(false)
33
+ }
34
+ expect(isMinimaxH3Image("minimax-h3")).toBe(false)
35
+ expect(isPricedPerInputImage("minimax-h3")).toBe(false)
36
+ })
37
+
38
+ it("references move a prompt to the edit id, up to sixteen of them", () => {
39
+ expect(T2I_TO_I2I_VARIANT[T2I]).toBe(I2I)
40
+ expect(REF_IMAGE_MAX_LIMITS[I2I]).toBe(16)
41
+ expect(imageReferenceLimit(T2I)).toBe(16)
42
+ expect(requestImageLimit(T2I)).toBe(16)
43
+ expect(requestImageLimit(I2I)).toBe(16)
44
+ })
45
+ })
46
+
47
+ describe("MiniMax H3 Image catalog entries", () => {
48
+ it("offer ten ratios and auto, auto last so a first-listed fallback lands on a real ratio", () => {
49
+ for (const id of [T2I, I2I]) {
50
+ const ratios = MODEL_CATALOG[id]!.aspectRatios!
51
+ expect(ratios).toHaveLength(11)
52
+ expect(ratios[0]).not.toBe("auto")
53
+ expect(ratios[ratios.length - 1]).toBe("auto")
54
+ expect([...ratios].sort()).toEqual(["1:1", "16:9", "21:9", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "auto"].sort())
55
+ }
56
+ })
57
+
58
+ it("render 1K, 2K and 4K at every ratio, 2K by default", () => {
59
+ for (const id of [T2I, I2I]) {
60
+ const entry = MODEL_CATALOG[id]!
61
+ expect(entry.resolutions).toEqual(["1K", "2K", "4K"])
62
+ expect(entry.resolutionsByAspectRatio).toBeUndefined()
63
+ expect(defaultResolutionFor(id)).toBe("2K")
64
+ }
65
+ })
66
+
67
+ it("write PNG by default or JPEG, and nothing else", () => {
68
+ for (const id of [T2I, I2I]) {
69
+ expect(MODEL_CATALOG[id]!.outputFormats).toEqual(["png", "jpeg"])
70
+ expect(normalizeModelInput(id, { outputFormat: "webp" }).outputFormat).toBe("png")
71
+ expect(normalizeModelInput(id, { outputFormat: "jpeg" }).outputFormat).toBe("jpeg")
72
+ }
73
+ })
74
+
75
+ it("take a seed and no quality, background or mask", () => {
76
+ for (const id of [T2I, I2I]) {
77
+ const entry = MODEL_CATALOG[id]!
78
+ expect(entry.noSeed).toBeUndefined()
79
+ expect(entry.qualities).toBeUndefined()
80
+ expect(entry.backgrounds).toBeUndefined()
81
+ expect(entry.features ?? []).not.toContain("mask")
82
+ expect(entry.autoAspectFromSourceImage).toBeUndefined()
83
+ }
84
+ })
85
+ })
86
+
87
+ describe("MiniMax H3 Image price ids", () => {
88
+ it("a prompt is priced by its size, 2K when none or an unknown one is named", () => {
89
+ expect(buildCreditModelIdentifier(T2I)).toBe("minimax-h3-image:2K")
90
+ expect(buildCreditModelIdentifier(T2I, undefined, "1K")).toBe("minimax-h3-image:1K")
91
+ expect(buildCreditModelIdentifier(T2I, undefined, "4K")).toBe("minimax-h3-image:4K")
92
+ expect(buildCreditModelIdentifier(T2I, undefined, "4k")).toBe("minimax-h3-image:4K")
93
+ expect(buildCreditModelIdentifier(T2I, undefined, "2 MP")).toBe("minimax-h3-image:2K")
94
+ })
95
+
96
+ it("a quality another model takes changes nothing", () => {
97
+ expect(buildCreditModelIdentifier(T2I, "high", "1K")).toBe("minimax-h3-image:1K")
98
+ })
99
+
100
+ it("an edit is priced by its size and its reference images, one to sixteen", () => {
101
+ expect(buildCreditModelIdentifier(I2I, undefined, "4K", undefined, undefined, 3)).toBe("minimax-h3-image-i2i:4K:3ref")
102
+ expect(buildCreditModelIdentifier(I2I, undefined, undefined, undefined, undefined, 0)).toBe("minimax-h3-image-i2i:2K:1ref")
103
+ expect(buildCreditModelIdentifier(I2I, undefined, "1K", undefined, undefined, 40)).toBe("minimax-h3-image-i2i:1K:16ref")
104
+ })
105
+
106
+ it("the text-to-image id sent images is priced as the edit it runs as", () => {
107
+ expect(minimaxH3ImageCreditId(T2I, "1K", 2)).toBe("minimax-h3-image-i2i:1K:2ref")
108
+ expect(buildCreditModelIdentifier(T2I, undefined, "4K", undefined, undefined, 1)).toBe("minimax-h3-image-i2i:4K:1ref")
109
+ })
110
+
111
+ it("the route and workflow snap price the size they send, with the swap or without", () => {
112
+ const swapped = resolveNormalizedImageGen({ provider: T2I, resolution: "4K", aspectRatio: "16:9", refCount: 2, swapToI2i: true })
113
+ expect(swapped.modelId).toBe(I2I)
114
+ expect(swapped.identifier).toBe("minimax-h3-image-i2i:4K:2ref")
115
+ const entity = resolveNormalizedImageGen({ provider: T2I, refCount: 1, swapToI2i: false })
116
+ expect(entity.modelId).toBe(T2I)
117
+ expect(entity.identifier).toBe("minimax-h3-image-i2i:2K:1ref")
118
+ })
119
+ })
120
+
121
+ describe("MiniMax H3 Image: the images a run sends", () => {
122
+ const BASE = "https://cdn.example.com/base.png"
123
+ const REF = "https://cdn.example.com/ref.png"
124
+
125
+ it("counts the base of an edit, once", () => {
126
+ expect(pricedSentImages(T2I, [], BASE)).toBe(1)
127
+ expect(pricedSentImages(T2I, [REF], BASE)).toBe(2)
128
+ expect(pricedSentImages(T2I, [BASE, REF], BASE)).toBe(2)
129
+ })
130
+
131
+ it("leaves every other model on its references alone", () => {
132
+ expect(pricedSentImages("seedream-5-flash", [REF], BASE)).toBe(1)
133
+ expect(pricedSentImages("minimax-h3", [REF], BASE)).toBe(1)
134
+ })
135
+
136
+ it("an estimate counts the node's images, the wired ones and an edit's own source", () => {
137
+ expect(pricedEstimatedImages(T2I, { referenceImageUrls: [REF] }, 2)).toBe(3)
138
+ expect(pricedEstimatedImages(I2I, {}, 0)).toBe(1)
139
+ })
140
+ })
@@ -1,19 +1,50 @@
1
1
  import { describe, it, expect } from "vitest"
2
- import { MODEL_CATALOG, MODEL_MAKERS, isModelMakerId, modelMakerOf } from "../model-catalog.js"
2
+ import { MODEL_CATALOG, MODEL_MAKERS, isModelMakerId, modelMakerOf, type ModelCatalogEntry, type ModelCatalogEntryFields } from "../model-catalog.js"
3
3
 
4
4
  /**
5
5
  * Every catalog model names the company that made it (`maker`), served on
6
6
  * `GET /v1/models` as `maker: { id, name }` and used to pick the maker's mark
7
- * (`logoUrl`). The field is required on `ModelCatalogEntry`, so a new model
8
- * without one does not compile; these cases also cover entries built at run
7
+ * (`logoUrl`) — unless it is marked `ownLabel: true` (offered under the
8
+ * deployment's own label, decided 2026-11-11), which names none and may carry
9
+ * none. `ModelCatalogEntry` requires exactly one of the two, so a new model
10
+ * without either does not compile; these cases also cover entries built at run
9
11
  * time and keep the registry and the catalog in step.
10
12
  */
13
+
14
+ /** What is wrong with who each entry is offered under: no maker and no `ownLabel`, an unknown maker, or a maker on an own-label model. */
15
+ function offeredUnderProblems(entries: ReadonlyArray<{ id: string; maker?: unknown; ownLabel?: unknown }>): string[] {
16
+ return entries.flatMap((m) => {
17
+ if (m.ownLabel === true) return m.maker === undefined ? [] : [`${m.id}: marked ownLabel but names maker ${String(m.maker)}`]
18
+ if (m.ownLabel !== undefined) return [`${m.id}: ownLabel must be true or absent, not ${String(m.ownLabel)}`]
19
+ return isModelMakerId(m.maker) ? [] : [`${m.id}: names no maker from the registry (${String(m.maker)})`]
20
+ })
21
+ }
22
+
11
23
  describe("model makers", () => {
12
- it("every catalog model names a maker from the registry", () => {
13
- const unknown = Object.values(MODEL_CATALOG)
14
- .filter((m) => !isModelMakerId(m.maker))
15
- .map((m) => `${m.id}: ${String(m.maker)}`)
16
- expect(unknown).toEqual([])
24
+ it("every catalog model names a maker from the registry, unless it is offered under the deployment's own label", () => {
25
+ expect(offeredUnderProblems(Object.values(MODEL_CATALOG))).toEqual([])
26
+ })
27
+
28
+ it("the guard refuses a model with no maker that is not marked ownLabel", () => {
29
+ expect(offeredUnderProblems([{ id: "x" }])).toEqual(["x: names no maker from the registry (undefined)"])
30
+ expect(offeredUnderProblems([{ id: "x", maker: "acme" }])).toEqual(["x: names no maker from the registry (acme)"])
31
+ expect(offeredUnderProblems([{ id: "x", ownLabel: false }])).toEqual(["x: ownLabel must be true or absent, not false"])
32
+ })
33
+
34
+ it("the guard refuses a model marked ownLabel that names a maker", () => {
35
+ expect(offeredUnderProblems([{ id: "x", ownLabel: true, maker: "google" }])).toEqual(["x: marked ownLabel but names maker google"])
36
+ expect(offeredUnderProblems([{ id: "x", ownLabel: true }])).toEqual([])
37
+ })
38
+
39
+ it("the type requires exactly one of maker and ownLabel", () => {
40
+ const fields = {} as ModelCatalogEntryFields
41
+ const withMaker: ModelCatalogEntry = { ...fields, maker: "google" }
42
+ const ownLabel: ModelCatalogEntry = { ...fields, ownLabel: true }
43
+ // @ts-expect-error — neither
44
+ const neither: ModelCatalogEntry = { ...fields }
45
+ // @ts-expect-error — both
46
+ const both: ModelCatalogEntry = { ...fields, ownLabel: true, maker: "google" }
47
+ expect([withMaker, ownLabel, neither, both]).toHaveLength(4)
17
48
  })
18
49
 
19
50
  // `series` is the product line ("Kling", "Flux") — required on every entry,
@@ -27,7 +58,7 @@ describe("model makers", () => {
27
58
  })
28
59
 
29
60
  it("every registered maker makes at least one catalog model", () => {
30
- const used = new Set<string>(Object.values(MODEL_CATALOG).map((m) => m.maker))
61
+ const used = new Set<string>(Object.values(MODEL_CATALOG).flatMap((m) => (m.maker === undefined ? [] : [m.maker])))
31
62
  expect(Object.keys(MODEL_MAKERS).filter((id) => !used.has(id))).toEqual([])
32
63
  })
33
64
 
@@ -41,11 +72,12 @@ describe("model makers", () => {
41
72
  it("all the models of one family come from one maker", () => {
42
73
  // `family` is the vendor / lab grouping clients filter on; a family whose
43
74
  // models name two makers is almost always a copied entry that kept the
44
- // other company's maker.
75
+ // other company's maker. An own-label model counts as its own "maker", so
76
+ // a family is never half own-label.
45
77
  const makersByFamily = new Map<string, Set<string>>()
46
78
  for (const m of Object.values(MODEL_CATALOG)) {
47
79
  const makers = makersByFamily.get(m.family) ?? new Set<string>()
48
- makers.add(m.maker)
80
+ makers.add(m.maker ?? "(own label)")
49
81
  makersByFamily.set(m.family, makers)
50
82
  }
51
83
  const split = [...makersByFamily]
@@ -69,6 +101,12 @@ describe("model makers", () => {
69
101
  expect(modelMakerOf(MODEL_CATALOG["seedance-2"]!)).toEqual({ id: "bytedance", name: "ByteDance" })
70
102
  })
71
103
 
104
+ it("modelMakerOf serves no maker for a model offered under the deployment's own label", () => {
105
+ expect(modelMakerOf({ ownLabel: true })).toBeUndefined()
106
+ // Even one built at run time (or by a JavaScript caller) that also names a maker.
107
+ expect(modelMakerOf({ ownLabel: true, maker: "google" } as unknown as Pick<ModelCatalogEntry, "maker" | "ownLabel">)).toBeUndefined()
108
+ })
109
+
72
110
  it("modelMakerOf never throws: an entry built at run time without a known maker has none", () => {
73
111
  expect(modelMakerOf({ maker: "acme" as never })).toBeUndefined()
74
112
  expect(modelMakerOf({ maker: undefined as never })).toBeUndefined()
@@ -69,6 +69,19 @@ describe("buildModelTree", () => {
69
69
  expect(flux?.models.some((m) => m.label.toLowerCase().includes("kontext"))).toBe(true)
70
70
  expect(tree.some((l) => l.series.toLowerCase().includes("kontext"))).toBe(false)
71
71
  })
72
+ it("keeps the Hailuo line the video line it was, and MiniMax H3 Image in a line of its own", () => {
73
+ const hailuo = tree.filter((l) => l.series === "Hailuo")
74
+ expect(hailuo).toHaveLength(1)
75
+ expect(hailuo[0]!.kind).toBe("video")
76
+ // The members the line had before MiniMax H3 Image was added: no image model joins it.
77
+ expect(hailuo[0]!.models.map((m) => m.id).sort()).toEqual(
78
+ ["hailuo-2.3", "hailuo-2.3-pro", "hailuo-avatar", "hailuo-standard", "minimax", "minimax-h3"],
79
+ )
80
+ const image = tree.filter((l) => l.series === "MiniMax Image")
81
+ expect(image).toHaveLength(1)
82
+ expect(image[0]!.kind).toBe("image")
83
+ expect(image[0]!.models.map((m) => m.id).sort()).toEqual(["minimax-h3-image", "minimax-h3-image-i2i"])
84
+ })
72
85
  })
73
86
 
74
87
  describe("searchModelVariants", () => {
@@ -1,5 +1,6 @@
1
1
  import { describe, expect, it } from "vitest"
2
2
  import {
3
+ EXTEND_VIDEO_PROVIDERS,
3
4
  IMAGE_TO_VIDEO_PROVIDERS,
4
5
  OBJECT_MOTION_PROVIDERS,
5
6
  RETIRED_VIDEO_PROVIDERS,
@@ -10,26 +11,35 @@ import { MODEL_CATALOG } from "../model-catalog.js"
10
11
  import { PIPELINE_PINNABLE_VIDEO_MODELS, PipelineConfigSchema } from "../pipeline-types.js"
11
12
 
12
13
  /**
13
- * A retired video model (Seedance 1.5, retired upstream 2026-10-25) has no
14
+ * A retired video model id (Seedance 1.5, retired upstream 2026-10-25; the one
15
+ * Seedance Extend Video provider, split into one provider per model) has no
14
16
  * catalog entry and is in no provider list; every stored or sent copy of its
15
17
  * id runs as the model it became.
16
18
  */
17
19
  describe("RETIRED_VIDEO_PROVIDERS", () => {
18
- it("a retired id is gone from the catalog and every provider list; the model it runs as is live in both modes", () => {
20
+ it("a retired id is gone from the catalog and every provider list; the model it runs as is live in the list of its own kind", () => {
19
21
  for (const [retired, runsAs] of Object.entries(RETIRED_VIDEO_PROVIDERS)) {
20
22
  expect(MODEL_CATALOG[retired], retired).toBeUndefined()
21
- for (const list of [IMAGE_TO_VIDEO_PROVIDERS, TEXT_TO_VIDEO_PROVIDERS, OBJECT_MOTION_PROVIDERS, PIPELINE_PINNABLE_VIDEO_MODELS]) {
23
+ for (const list of [IMAGE_TO_VIDEO_PROVIDERS, TEXT_TO_VIDEO_PROVIDERS, OBJECT_MOTION_PROVIDERS, PIPELINE_PINNABLE_VIDEO_MODELS, EXTEND_VIDEO_PROVIDERS]) {
22
24
  expect((list as readonly string[]).includes(retired), retired).toBe(false)
23
25
  }
24
26
  expect(MODEL_CATALOG[runsAs]?.kind, runsAs).toBe("video")
25
- expect((IMAGE_TO_VIDEO_PROVIDERS as readonly string[]).includes(runsAs)).toBe(true)
26
- expect((TEXT_TO_VIDEO_PROVIDERS as readonly string[]).includes(runsAs)).toBe(true)
27
+ if (MODEL_CATALOG[runsAs]!.modes.includes("extend")) {
28
+ // An Extend Video provider: live in the extend list.
29
+ expect((EXTEND_VIDEO_PROVIDERS as readonly string[]).includes(runsAs), runsAs).toBe(true)
30
+ } else {
31
+ // A generation model: live in both modes.
32
+ expect((IMAGE_TO_VIDEO_PROVIDERS as readonly string[]).includes(runsAs), runsAs).toBe(true)
33
+ expect((TEXT_TO_VIDEO_PROVIDERS as readonly string[]).includes(runsAs), runsAs).toBe(true)
34
+ }
27
35
  }
28
36
  })
29
37
 
30
38
  it("canonicalVideoProvider maps a retired id and passes anything else through", () => {
31
39
  expect(canonicalVideoProvider("seedance")).toBe("seedance-2-mini")
40
+ expect(canonicalVideoProvider("seedance-2-extend")).toBe("seedance-2-5-extend")
32
41
  expect(canonicalVideoProvider("seedance-2")).toBe("seedance-2")
42
+ expect(canonicalVideoProvider("seedance-2-0-extend")).toBe("seedance-2-0-extend")
33
43
  expect(canonicalVideoProvider(undefined)).toBeUndefined()
34
44
  expect(canonicalVideoProvider("constructor")).toBe("constructor")
35
45
  })
@@ -30,6 +30,6 @@ describe("Seedance 2.5 in the catalog", () => {
30
30
 
31
31
  it("is not listed as an extend model: extending is a model of its own", () => {
32
32
  expect(entry.modes).not.toContain("extend")
33
- expect(MODEL_CATALOG["seedance-2-extend"]?.modes).toContain("extend")
33
+ expect(MODEL_CATALOG["seedance-2-5-extend"]?.modes).toContain("extend")
34
34
  })
35
35
  })
@@ -0,0 +1,178 @@
1
+ import { describe, it, expect } from "vitest"
2
+ import {
3
+ listedSeedanceTaskType,
4
+ resolveSeedanceTaskType,
5
+ seedanceTaskTypeFitsMedia,
6
+ supportsReferenceTaskType,
7
+ SEEDANCE_VIDEO_EDIT_SHAPE,
8
+ type SeedanceTaskTypeFacts,
9
+ } from "../model-constants.js"
10
+ import { isVideoAutoAspectToken, videoAutoAspectRunsAt } from "../model-catalog.js"
11
+
12
+ const base: Omit<SeedanceTaskTypeFacts, "requested"> = {
13
+ provider: "seedance-2-5",
14
+ draft: false,
15
+ referenceImageCount: 0,
16
+ referenceAudioCount: 0,
17
+ referenceVideoSec: [6],
18
+ aspectRatio: "16:9",
19
+ duration: 5,
20
+ }
21
+
22
+ /** Nothing declared, ratio and length exactly as given, nothing reported. */
23
+ function expectUnchanged(facts: SeedanceTaskTypeFacts): void {
24
+ expect(resolveSeedanceTaskType(facts)).toEqual({
25
+ taskType: undefined,
26
+ aspectRatio: facts.aspectRatio,
27
+ duration: facts.duration,
28
+ adjustments: [],
29
+ })
30
+ }
31
+
32
+ describe("resolveSeedanceTaskType", () => {
33
+ it("edit: declares it and forces adaptive + Auto", () => {
34
+ const r = resolveSeedanceTaskType({ ...base, requested: "edit" })
35
+ expect(r).toMatchObject({ taskType: "edit", aspectRatio: "adaptive", duration: -1 })
36
+ expect(r.adjustments.map((a) => a.field).sort()).toEqual(["aspectRatio", "duration"])
37
+ })
38
+
39
+ it("extend: forces adaptive, keeps a fixed length, replaces Auto with the model's default", () => {
40
+ expect(resolveSeedanceTaskType({ ...base, requested: "extend" })).toMatchObject({ taskType: "extend", aspectRatio: "adaptive", duration: 5 })
41
+ expect(resolveSeedanceTaskType({ ...base, requested: "extend", duration: -1 }).duration).toBe(8)
42
+ expect(resolveSeedanceTaskType({ ...base, requested: "extend", duration: undefined }).duration).toBe(8)
43
+ })
44
+
45
+ it("reference: declares it and changes nothing, adaptive and Auto included", () => {
46
+ expect(resolveSeedanceTaskType({ ...base, requested: "reference", aspectRatio: "adaptive", duration: -1 }))
47
+ .toEqual({ taskType: "reference", aspectRatio: "adaptive", duration: -1, adjustments: [] })
48
+ expect(resolveSeedanceTaskType({ ...base, requested: "reference", referenceVideoSec: [], referenceImageCount: 2 }).taskType).toBe("reference")
49
+ })
50
+
51
+ it.each([
52
+ ["auto", "auto"], ["absent", undefined], ["wrong case", "EDIT"], ["number", 1], ["array", []], ["null", null],
53
+ ])("%s is Auto: unchanged", (_n, requested) => {
54
+ expectUnchanged({ ...base, requested })
55
+ })
56
+
57
+ it("another model: unchanged, even with a stale value", () => {
58
+ expectUnchanged({ ...base, provider: "kling-4", requested: "edit" })
59
+ })
60
+
61
+ it("a draft: unchanged", () => {
62
+ expectUnchanged({ ...base, draft: true, requested: "edit" })
63
+ })
64
+
65
+ it("no reference media at all: unchanged", () => {
66
+ expectUnchanged({ ...base, requested: "reference", referenceVideoSec: [], referenceImageCount: 0, referenceAudioCount: 0 })
67
+ })
68
+
69
+ it("edit or extend without a reference video: unchanged", () => {
70
+ expectUnchanged({ ...base, requested: "edit", referenceVideoSec: [], referenceImageCount: 1 })
71
+ expectUnchanged({ ...base, requested: "extend", referenceVideoSec: [], referenceImageCount: 1 })
72
+ })
73
+
74
+ it.each([[[3]], [[6, 3]], [[31]], [[undefined]], [[6, undefined]]])("edit with videos %j: unchanged", (referenceVideoSec) => {
75
+ expectUnchanged({ ...base, requested: "edit", referenceVideoSec })
76
+ })
77
+
78
+ it("edit at the bounds is declared", () => {
79
+ expect(resolveSeedanceTaskType({ ...base, requested: "edit", referenceVideoSec: [4] }).taskType).toBe("edit")
80
+ expect(resolveSeedanceTaskType({ ...base, requested: "edit", referenceVideoSec: [30] }).taskType).toBe("edit")
81
+ })
82
+
83
+ // Only `edit` needs measured lengths inside 4–30 s: `reference` and `extend`
84
+ // are declared whatever the reference video measures, or if it was not measured.
85
+ it.each([[[3]], [[31]], [[undefined]]])("reference and extend with videos %j are still declared", (referenceVideoSec) => {
86
+ expect(resolveSeedanceTaskType({ ...base, requested: "reference", referenceVideoSec }).taskType).toBe("reference")
87
+ expect(resolveSeedanceTaskType({ ...base, requested: "extend", referenceVideoSec }).taskType).toBe("extend")
88
+ })
89
+
90
+ it("edit reports the ratio and the length it replaces, from and to", () => {
91
+ const { adjustments } = resolveSeedanceTaskType({ ...base, requested: "edit" })
92
+ expect(adjustments).toEqual([
93
+ expect.objectContaining({ field: "aspectRatio", from: "16:9", to: "adaptive" }),
94
+ expect.objectContaining({ field: "duration", from: 5, to: -1 }),
95
+ ])
96
+ })
97
+
98
+ it("edit runs in the purpose-built edit shape", () => {
99
+ const r = resolveSeedanceTaskType({ ...base, requested: "edit" })
100
+ expect({ aspectRatio: r.aspectRatio, duration: r.duration }).toEqual(SEEDANCE_VIDEO_EDIT_SHAPE)
101
+ })
102
+
103
+ it("extend reports the ratio it replaces and an Auto length it replaces, from and to", () => {
104
+ expect(resolveSeedanceTaskType({ ...base, requested: "extend" }).adjustments).toEqual([
105
+ expect.objectContaining({ field: "aspectRatio", from: "16:9", to: "adaptive" }),
106
+ ])
107
+ expect(resolveSeedanceTaskType({ ...base, requested: "extend", duration: -1 }).adjustments).toEqual([
108
+ expect.objectContaining({ field: "aspectRatio", from: "16:9", to: "adaptive" }),
109
+ expect.objectContaining({ field: "duration", from: -1, to: 8 }),
110
+ ])
111
+ })
112
+
113
+ // "Auto" is the unified node's ratio token: with a reference video to match, a
114
+ // model that lists "adaptive" runs it at "adaptive" (`videoAutoAspectRunsAt`,
115
+ // the KIE adapter's own rule), so an edit or extend of an "Auto" request runs
116
+ // at the ratio it asked for — nothing is replaced, so nothing is reported.
117
+ it.each(["edit", "extend"] as const)("%s of an \"Auto\" or \"auto\" ratio reports no ratio adjustment, and still runs at adaptive", (requested) => {
118
+ for (const aspectRatio of ["Auto", "auto"]) {
119
+ const r = resolveSeedanceTaskType({ ...base, requested, aspectRatio, duration: requested === "edit" ? -1 : 8 })
120
+ expect(r).toEqual({ taskType: requested, aspectRatio: "adaptive", duration: requested === "edit" ? -1 : 8, adjustments: [] })
121
+ }
122
+ })
123
+
124
+ it.each(["edit", "extend"] as const)("%s of a fixed ratio still reports it", (requested) => {
125
+ const r = resolveSeedanceTaskType({ ...base, requested, aspectRatio: "16:9", duration: requested === "edit" ? -1 : 8 })
126
+ expect(r.adjustments).toEqual([expect.objectContaining({ field: "aspectRatio", from: "16:9", to: "adaptive" })])
127
+ })
128
+
129
+ it("the Auto token runs at adaptive only with a visual input, on a model that lists adaptive", () => {
130
+ expect(isVideoAutoAspectToken("Auto")).toBe(true)
131
+ expect(isVideoAutoAspectToken("auto")).toBe(true)
132
+ // Exactly the spellings the provider adapter matches.
133
+ for (const other of ["AUTO", " Auto", "adaptive", "16:9", "", undefined]) expect(isVideoAutoAspectToken(other)).toBe(false)
134
+ expect(videoAutoAspectRunsAt("seedance-2-5", true)).toBe("adaptive")
135
+ expect(videoAutoAspectRunsAt("seedance-2-5", false)).toBeUndefined()
136
+ expect(videoAutoAspectRunsAt("kling-4", true)).toBeUndefined()
137
+ expect(videoAutoAspectRunsAt(undefined, true)).toBeUndefined()
138
+ })
139
+
140
+ it("extend filling in a missing length reports nothing", () => {
141
+ const r = resolveSeedanceTaskType({ ...base, requested: "extend", aspectRatio: "adaptive", duration: undefined })
142
+ expect(r).toEqual({ taskType: "extend", aspectRatio: "adaptive", duration: 8, adjustments: [] })
143
+ })
144
+
145
+ it("the catalog names the model", () => {
146
+ expect(supportsReferenceTaskType("seedance-2-5")).toBe(true)
147
+ expect(supportsReferenceTaskType("seedance-2")).toBe(false)
148
+ expect(supportsReferenceTaskType(undefined)).toBe(false)
149
+ })
150
+
151
+ it("listedSeedanceTaskType: a value the model's list holds, matched exactly", () => {
152
+ for (const value of ["reference", "edit", "extend"]) {
153
+ expect(listedSeedanceTaskType("seedance-2-5", value)).toBe(value)
154
+ }
155
+ for (const value of ["auto", "EDIT", undefined, null, 1, []]) {
156
+ expect(listedSeedanceTaskType("seedance-2-5", value)).toBeUndefined()
157
+ }
158
+ expect(listedSeedanceTaskType("seedance-2", "edit")).toBeUndefined()
159
+ expect(listedSeedanceTaskType(undefined, "edit")).toBeUndefined()
160
+ })
161
+ })
162
+
163
+ describe("seedanceTaskTypeFitsMedia — the media each declared type needs", () => {
164
+ const none = { imageCount: 0, videoCount: 0, audioCount: 0 }
165
+
166
+ it("reference takes any reference media", () => {
167
+ expect(seedanceTaskTypeFitsMedia("reference", { ...none, imageCount: 1 })).toBe(true)
168
+ expect(seedanceTaskTypeFitsMedia("reference", { ...none, videoCount: 1 })).toBe(true)
169
+ expect(seedanceTaskTypeFitsMedia("reference", { ...none, audioCount: 1 })).toBe(true)
170
+ expect(seedanceTaskTypeFitsMedia("reference", none)).toBe(false)
171
+ })
172
+
173
+ it.each(["edit", "extend"] as const)("%s needs a reference video", (type) => {
174
+ expect(seedanceTaskTypeFitsMedia(type, { ...none, videoCount: 1 })).toBe(true)
175
+ expect(seedanceTaskTypeFitsMedia(type, { imageCount: 3, videoCount: 0, audioCount: 2 })).toBe(false)
176
+ expect(seedanceTaskTypeFitsMedia(type, none)).toBe(false)
177
+ })
178
+ })
@@ -0,0 +1,117 @@
1
+ import { describe, expect, it } from "vitest"
2
+ import { MODEL_CATALOG, defaultResolutionFor, normalizeModelInput } from "../model-catalog.js"
3
+ import { resolveNormalizedImageGen } from "../credit-identifiers.js"
4
+ import {
5
+ IMAGE_RESOLUTION_VALUES,
6
+ getMinImagePromptChars,
7
+ imageReferenceLimit,
8
+ requestImageLimit,
9
+ T2I_TO_I2I_VARIANT,
10
+ } from "../model-constants.js"
11
+ import { isPricedPerInputImage, isPricedPerInputImageEdit, pricedEstimatedImages, pricedSentImages } from "../input-image-pricing.js"
12
+ import { gptImage26EstimatedImages, gptImage26SentImages } from "../gpt-image-2-6.js"
13
+ import { SEEDREAM_5_5_DEFAULT_RESOLUTION, seedream55Resolution } from "../seedream-5-5.js"
14
+
15
+ describe("Seedream 5.5 in the catalog", () => {
16
+ it("takes 1K, 1.5K and 2K, 2K when none is named", () => {
17
+ for (const id of ["seedream-5-5", "seedream-5-5-i2i"]) {
18
+ expect(MODEL_CATALOG[id]!.resolutions).toEqual(["1K", "1.5K", "2K"])
19
+ expect(defaultResolutionFor(id)).toBe("2K")
20
+ }
21
+ expect(SEEDREAM_5_5_DEFAULT_RESOLUTION).toBe("2K")
22
+ expect(seedream55Resolution(undefined)).toBe("2K")
23
+ expect(seedream55Resolution("1.5k")).toBe("1.5K")
24
+ })
25
+
26
+ it("text to image never lists auto (its schema requires a real ratio); the edit lists it first", () => {
27
+ expect(MODEL_CATALOG["seedream-5-5"]!.aspectRatios).not.toContain("auto")
28
+ expect(MODEL_CATALOG["seedream-5-5"]!.aspectRatios).toHaveLength(8)
29
+ expect(MODEL_CATALOG["seedream-5-5-i2i"]!.aspectRatios![0]).toBe("auto")
30
+ expect(MODEL_CATALOG["seedream-5-5-i2i"]!.aspectRatios).toHaveLength(9)
31
+ })
32
+
33
+ it("auto on text to image becomes a real ratio: the one nearest a photo, else the first listed", () => {
34
+ const none = normalizeModelInput("seedream-5-5", { aspectRatio: "auto" })
35
+ expect(none.aspectRatio).toBe("1:1")
36
+ const portrait = normalizeModelInput("seedream-5-5", { aspectRatio: "auto" }, { sourceImage: { width: 768, height: 1024 } })
37
+ expect(portrait.aspectRatio).toBe("3:4")
38
+ expect(normalizeModelInput("seedream-5-5-i2i", { aspectRatio: "auto" }).aspectRatio).toBe("auto")
39
+ })
40
+
41
+ it("a stale size snaps to its default, 2K, and 1.5K is kept", () => {
42
+ expect(normalizeModelInput("seedream-5-5", { resolution: "4K" }).resolution).toBe("2K")
43
+ expect(normalizeModelInput("seedream-5-5", { resolution: "1.5K" }).resolution).toBe("1.5K")
44
+ expect(normalizeModelInput("seedream-5-5-i2i", { resolution: "1.5k" }).resolution).toBe("1.5K")
45
+ })
46
+
47
+ it("1.5K is in the route vocabulary, and moves to a size the model lists on every other model", () => {
48
+ expect(IMAGE_RESOLUTION_VALUES).toContain("1.5K")
49
+ for (const [id, m] of Object.entries(MODEL_CATALOG)) {
50
+ if (m.kind !== "image" || id.startsWith("seedream-5-5")) continue
51
+ expect(m.resolutions ?? [], id).not.toContain("1.5K")
52
+ const n = normalizeModelInput(id, { resolution: "1.5K" })
53
+ expect(n.resolution === undefined || (m.resolutions ?? []).includes(n.resolution), id).toBe(true)
54
+ }
55
+ })
56
+
57
+ it("a transparent background is kept in PNG and moved to auto in JPEG, before anything is priced", () => {
58
+ expect(normalizeModelInput("seedream-5-5", { background: "transparent" }).background).toBe("transparent")
59
+ expect(normalizeModelInput("seedream-5-5", { background: "transparent", outputFormat: "png" }).background).toBe("transparent")
60
+ const jpeg = normalizeModelInput("seedream-5-5-i2i", { background: "transparent", outputFormat: "jpeg" })
61
+ expect(jpeg.background).toBe("auto")
62
+ expect(jpeg.outputFormat).toBe("jpeg")
63
+ expect(jpeg.adjustments.map((a) => a.field)).toContain("background")
64
+ // A transparent background renders at every size here: nothing moves the size.
65
+ expect(normalizeModelInput("seedream-5-5", { background: "transparent", resolution: "2K" }).resolution).toBe("2K")
66
+ })
67
+
68
+ it("writes PNG or JPEG only", () => {
69
+ expect(normalizeModelInput("seedream-5-5", { outputFormat: "webp" }).outputFormat).toBe("png")
70
+ expect(normalizeModelInput("seedream-5-5", { outputFormat: "jpg" }).outputFormat).toBe("jpeg")
71
+ })
72
+ })
73
+
74
+ describe("Seedream 5.5 input images", () => {
75
+ it("references swap text to image onto the edit, which takes up to 10", () => {
76
+ expect(T2I_TO_I2I_VARIANT["seedream-5-5"]).toBe("seedream-5-5-i2i")
77
+ expect(imageReferenceLimit("seedream-5-5")).toBe(10)
78
+ expect(requestImageLimit("seedream-5-5")).toBe(10)
79
+ expect(requestImageLimit("seedream-5-5-i2i")).toBe(10)
80
+ // Every other model's request limit is unchanged.
81
+ expect(requestImageLimit("seedream-5-flash-i2i")).toBe(14)
82
+ expect(requestImageLimit("gpt-image-2-6-flare-i2i")).toBe(16)
83
+ })
84
+
85
+ it("is priced per input image, and counted as GPT Image 2.6 is", () => {
86
+ expect(isPricedPerInputImage("seedream-5-5")).toBe(true)
87
+ expect(isPricedPerInputImageEdit("seedream-5-5-i2i")).toBe(true)
88
+ expect(isPricedPerInputImage("seedream-5-flash")).toBe(false)
89
+ expect(pricedSentImages("seedream-5-5", ["https://a.png"], "https://b.png")).toBe(2)
90
+ expect(pricedSentImages("seedream-5-flash", ["https://a.png"], "https://b.png")).toBe(1)
91
+ expect(pricedEstimatedImages("seedream-5-5-i2i", { referenceImageUrls: ["https://a.png"] }, 1)).toBe(3)
92
+ // The generic count is GPT Image 2.6's count, unchanged.
93
+ for (const model of ["gpt-image-2-6-flare", "gpt-image-2-6-sunburst-i2i", "gpt-image-2-5-flare", "nano-banana-pro"]) {
94
+ expect(pricedSentImages(model, ["https://a.png"], "https://b.png")).toBe(gptImage26SentImages(model, ["https://a.png"], "https://b.png"))
95
+ const data = { referenceImageUrls: ["https://a.png"], baseImageUrl: "https://b.png", direction: { style: "moodboard:1" } }
96
+ expect(pricedEstimatedImages(model, data, 2)).toBe(gptImage26EstimatedImages(model, data, 2))
97
+ }
98
+ })
99
+
100
+ it("a Generate Image run with references is snapped and priced on the edit's own lists", () => {
101
+ const n = resolveNormalizedImageGen({ provider: "seedream-5-5", aspectRatio: "auto", resolution: "1.5K", refCount: 2, swapToI2i: true })
102
+ expect(n.modelId).toBe("seedream-5-5-i2i")
103
+ expect(n.aspectRatio).toBe("auto")
104
+ expect(n.identifier).toBe("seedream-5-5-i2i:1.5K:2ref")
105
+ const t2i = resolveNormalizedImageGen({ provider: "seedream-5-5", aspectRatio: "auto", refCount: 0, swapToI2i: true })
106
+ expect(t2i.modelId).toBe("seedream-5-5")
107
+ expect(t2i.aspectRatio).toBe("1:1")
108
+ expect(t2i.identifier).toBe("seedream-5-5:2K")
109
+ })
110
+
111
+ it("states a 5-character prompt minimum; no other model has one", () => {
112
+ expect(getMinImagePromptChars("seedream-5-5")).toBe(5)
113
+ expect(getMinImagePromptChars("seedream-5-5-i2i")).toBe(5)
114
+ expect(getMinImagePromptChars("seedream-5-flash")).toBe(0)
115
+ expect(getMinImagePromptChars(undefined)).toBe(0)
116
+ })
117
+ })