@nodaro/shared 3.60.1 → 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 (261) hide show
  1. package/dist/{chunk-5Y42RIGY.cjs → chunk-2D5LQFV4.cjs} +18 -332
  2. package/dist/chunk-2D5LQFV4.cjs.map +1 -0
  3. package/dist/{chunk-5G23AJBU.cjs → chunk-2HZGDZZN.cjs} +6 -6
  4. package/dist/{chunk-5G23AJBU.cjs.map → chunk-2HZGDZZN.cjs.map} +1 -1
  5. package/dist/{chunk-DS2TOM32.js → chunk-2QKF7M2Z.js} +28 -4
  6. package/dist/chunk-2QKF7M2Z.js.map +1 -0
  7. package/dist/{chunk-CIOXUPCJ.cjs → chunk-2W745U4A.cjs} +228 -355
  8. package/dist/chunk-2W745U4A.cjs.map +1 -0
  9. package/dist/{chunk-LN3EVFRS.js → chunk-3OYO3XCC.js} +70 -6
  10. package/dist/chunk-3OYO3XCC.js.map +1 -0
  11. package/dist/{chunk-5HK5Z5OB.cjs → chunk-4ZEFP2FQ.cjs} +4 -4
  12. package/dist/{chunk-5HK5Z5OB.cjs.map → chunk-4ZEFP2FQ.cjs.map} +1 -1
  13. package/dist/{chunk-KOLC7AF2.js → chunk-5YYN5X57.js} +398 -38
  14. package/dist/chunk-5YYN5X57.js.map +1 -0
  15. package/dist/{chunk-RRPPXZ36.cjs → chunk-6CSXMWL4.cjs} +4 -4
  16. package/dist/{chunk-RRPPXZ36.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-HOKWJXHA.cjs → chunk-A2PX5IRC.cjs} +31 -4
  22. package/dist/chunk-A2PX5IRC.cjs.map +1 -0
  23. package/dist/{chunk-W4M7TNXG.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-KJZVQIN4.js → chunk-C7POAYFE.js} +3 -3
  30. package/dist/{chunk-KJZVQIN4.js.map → chunk-C7POAYFE.js.map} +1 -1
  31. package/dist/{chunk-6Q6SI7AG.js → chunk-CC4V2B7S.js} +3 -3
  32. package/dist/{chunk-6Q6SI7AG.js.map → chunk-CC4V2B7S.js.map} +1 -1
  33. package/dist/{chunk-GNPJ2JLE.cjs → chunk-CIPPPT7E.cjs} +6 -6
  34. package/dist/{chunk-GNPJ2JLE.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-SKFJIFEV.cjs → chunk-G3KVK7OU.cjs} +21 -21
  44. package/dist/{chunk-SKFJIFEV.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-EN2YI5TV.js → chunk-GSFB537T.js} +3 -3
  48. package/dist/{chunk-EN2YI5TV.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-6AJOTEVC.js → chunk-I2RQB7VG.js} +3 -3
  52. package/dist/{chunk-6AJOTEVC.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-DQIJPDHC.cjs → chunk-IWWVPR3W.cjs} +88 -11
  56. package/dist/chunk-IWWVPR3W.cjs.map +1 -0
  57. package/dist/{chunk-URLDVK67.js → chunk-JJNNM23P.js} +3 -3
  58. package/dist/{chunk-URLDVK67.js.map → chunk-JJNNM23P.js.map} +1 -1
  59. package/dist/{chunk-YHVEZVAO.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-AXT7YNOR.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-A6HRY3WF.cjs → chunk-MYJQELFN.cjs} +420 -37
  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-BXNPO3PL.cjs → chunk-N7OUQK7E.cjs} +8 -8
  74. package/dist/{chunk-BXNPO3PL.cjs.map → chunk-N7OUQK7E.cjs.map} +1 -1
  75. package/dist/{chunk-JKZVRKN3.js → chunk-NGKKNSK6.js} +31 -8
  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-SCYBGTX6.js → chunk-PTD6EDUU.js} +3 -3
  80. package/dist/{chunk-SCYBGTX6.js.map → chunk-PTD6EDUU.js.map} +1 -1
  81. package/dist/{chunk-BDXXOEBZ.cjs → chunk-QWYFHQYK.cjs} +79 -54
  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-AZGONXWV.js → chunk-S24ZBUB4.js} +194 -299
  86. package/dist/chunk-S24ZBUB4.js.map +1 -0
  87. package/dist/{chunk-IV6IDECY.js → chunk-S5TMRJMX.js} +4 -4
  88. package/dist/{chunk-IV6IDECY.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-HYBACFYW.js → chunk-SYWR5G3T.js} +16 -7
  92. package/dist/chunk-SYWR5G3T.js.map +1 -0
  93. package/dist/{chunk-GWBQ3GPO.cjs → chunk-TRVWMKNE.cjs} +343 -53
  94. package/dist/chunk-TRVWMKNE.cjs.map +1 -0
  95. package/dist/{chunk-G6GMY5BC.js → chunk-UDDVDQMF.js} +298 -36
  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-HDHLZK7C.cjs → chunk-VACPZPUA.cjs} +5 -5
  100. package/dist/{chunk-HDHLZK7C.cjs.map → chunk-VACPZPUA.cjs.map} +1 -1
  101. package/dist/{chunk-ICDLYU4I.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 +112 -6
  109. package/dist/entries/credits.d.ts +112 -6
  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 +207 -99
  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 +111 -99
  144. package/dist/entries/workflow.d.cts +29 -2
  145. package/dist/entries/workflow.d.ts +29 -2
  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 +2321 -1870
  150. package/dist/index.d.cts +10 -10
  151. package/dist/index.d.ts +10 -10
  152. package/dist/index.js +26 -23
  153. package/dist/{model-catalog-D6Es7VG-.d.cts → model-catalog-CCEcv08q.d.cts} +179 -14
  154. package/dist/{model-catalog-D6Es7VG-.d.ts → model-catalog-CCEcv08q.d.ts} +179 -14
  155. package/dist/{model-constants-22k3fjp1.d.cts → model-constants-B88p6XR0.d.ts} +305 -20
  156. package/dist/{model-constants-22k3fjp1.d.ts → model-constants-Cf3zaITt.d.cts} +305 -20
  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__/gpt-image-2-6.test.ts +7 -0
  163. package/src/__tests__/grok-video-15-catalog.test.ts +189 -0
  164. package/src/__tests__/gvp-supported-providers.test.ts +5 -2
  165. package/src/__tests__/image-mask-mode.test.ts +34 -1
  166. package/src/__tests__/mask-edit-follows-source.test.ts +150 -0
  167. package/src/__tests__/minimax-h3-image.test.ts +140 -0
  168. package/src/__tests__/model-makers.test.ts +49 -11
  169. package/src/__tests__/model-tree.test.ts +13 -0
  170. package/src/__tests__/retired-video-provider.test.ts +15 -5
  171. package/src/__tests__/seedance-25-catalog-modes.test.ts +1 -1
  172. package/src/__tests__/seedance-task-type.test.ts +178 -0
  173. package/src/__tests__/seedream-5-5.test.ts +117 -0
  174. package/src/__tests__/unit-contract-compose.test.ts +27 -1
  175. package/src/__tests__/unit-contracts.test.ts +20 -6
  176. package/src/__tests__/upscale-factors.test.ts +107 -0
  177. package/src/__tests__/video-character-refs.test.ts +20 -2
  178. package/src/__tests__/video-collapse-parity.test.ts +19 -0
  179. package/src/__tests__/video-overlay-geometry.test.ts +68 -0
  180. package/src/__tests__/video-overlay-layer-plan.test.ts +3 -4
  181. package/src/__tests__/video-overlay-layouts.test.ts +529 -0
  182. package/src/__tests__/video-overlay-pricing.test.ts +61 -0
  183. package/src/__tests__/video-overlay-validate.test.ts +128 -0
  184. package/src/__tests__/video-overlay-wired-kind.test.ts +207 -0
  185. package/src/__tests__/video-overlay.test.ts +280 -194
  186. package/src/__tests__/video-ref-limits.test.ts +2 -1
  187. package/src/__tests__/video-reference-only.test.ts +6 -2
  188. package/src/__tests__/video-start-frame-only.test.ts +98 -0
  189. package/src/__tests__/wired-character-names.test.ts +220 -0
  190. package/src/credit-estimators/index.ts +8 -0
  191. package/src/credit-estimators/video-overlay.ts +70 -0
  192. package/src/credit-identifiers.ts +102 -5
  193. package/src/entity-image-url.ts +21 -0
  194. package/src/entries/credits.ts +14 -0
  195. package/src/entries/entities.ts +14 -0
  196. package/src/entries/model-catalog.ts +39 -1
  197. package/src/entries/models.ts +34 -0
  198. package/src/entries/nodes.ts +2 -0
  199. package/src/entries/video.ts +6 -0
  200. package/src/entries/workflow.ts +1 -0
  201. package/src/generated/unit-contracts.ts +8 -1
  202. package/src/gpt-image-2-6.ts +6 -0
  203. package/src/input-image-pricing.ts +76 -0
  204. package/src/mask-composite.ts +11 -0
  205. package/src/minimax-h3-image.ts +61 -0
  206. package/src/model-catalog.ts +512 -48
  207. package/src/model-constants.ts +602 -34
  208. package/src/node-default-mappings.ts +12 -2
  209. package/src/node-execution-state.ts +4 -1
  210. package/src/producer-types.ts +23 -1
  211. package/src/seedance-task-type.ts +37 -0
  212. package/src/seedream-5-5.ts +45 -0
  213. package/src/unit-contract-compose.ts +4 -1
  214. package/src/upscale-factors.ts +111 -0
  215. package/src/video-character-refs.ts +7 -4
  216. package/src/video-overlay-geometry.ts +99 -0
  217. package/src/video-overlay-input.ts +25 -0
  218. package/src/video-overlay-layout-ids.ts +48 -0
  219. package/src/video-overlay-layouts.ts +315 -0
  220. package/src/video-overlay-validate.ts +223 -0
  221. package/src/video-overlay-video-layers.ts +304 -0
  222. package/src/video-overlay.ts +165 -297
  223. package/src/video-ui-defaults.ts +8 -6
  224. package/src/wired-character-names.ts +202 -0
  225. package/src/wired-image-size.ts +55 -0
  226. package/dist/chunk-5Y42RIGY.cjs.map +0 -1
  227. package/dist/chunk-6XVHYD5R.js.map +0 -1
  228. package/dist/chunk-A6HRY3WF.cjs.map +0 -1
  229. package/dist/chunk-AFQFGZN7.cjs.map +0 -1
  230. package/dist/chunk-AXT7YNOR.cjs.map +0 -1
  231. package/dist/chunk-AZGONXWV.js.map +0 -1
  232. package/dist/chunk-BDXXOEBZ.cjs.map +0 -1
  233. package/dist/chunk-CIOXUPCJ.cjs.map +0 -1
  234. package/dist/chunk-DQIJPDHC.cjs.map +0 -1
  235. package/dist/chunk-DS2TOM32.js.map +0 -1
  236. package/dist/chunk-FVVD6XY2.js.map +0 -1
  237. package/dist/chunk-G4XWVWRI.js.map +0 -1
  238. package/dist/chunk-G6GMY5BC.js.map +0 -1
  239. package/dist/chunk-G7ZYZQKO.cjs +0 -27
  240. package/dist/chunk-G7ZYZQKO.cjs.map +0 -1
  241. package/dist/chunk-GWBQ3GPO.cjs.map +0 -1
  242. package/dist/chunk-HNEF2N5C.cjs +0 -19
  243. package/dist/chunk-HNEF2N5C.cjs.map +0 -1
  244. package/dist/chunk-HOKWJXHA.cjs.map +0 -1
  245. package/dist/chunk-HYBACFYW.js.map +0 -1
  246. package/dist/chunk-ICDLYU4I.js.map +0 -1
  247. package/dist/chunk-JKZVRKN3.js.map +0 -1
  248. package/dist/chunk-KOLC7AF2.js.map +0 -1
  249. package/dist/chunk-LN3EVFRS.js.map +0 -1
  250. package/dist/chunk-M3SXUUWC.cjs.map +0 -1
  251. package/dist/chunk-MHY47BLL.js +0 -23
  252. package/dist/chunk-MHY47BLL.js.map +0 -1
  253. package/dist/chunk-PONP5J5E.cjs.map +0 -1
  254. package/dist/chunk-SWVGHAYO.js.map +0 -1
  255. package/dist/chunk-VB2ARGQ6.js.map +0 -1
  256. package/dist/chunk-VYQ25YQF.js +0 -17
  257. package/dist/chunk-VYQ25YQF.js.map +0 -1
  258. package/dist/chunk-W4M7TNXG.cjs.map +0 -1
  259. package/dist/chunk-WGKAOUEQ.cjs.map +0 -1
  260. package/dist/chunk-XROE3CAS.cjs.map +0 -1
  261. package/dist/chunk-YHVEZVAO.js.map +0 -1
@@ -22,15 +22,21 @@ const portrait = (over: Partial<VideoCharacterReference> = {}): VideoCharacterRe
22
22
  })
23
23
 
24
24
  describe("character reference capability (data-driven)", () => {
25
- it("both Gemini Omni SKUs declare a 3-character cap, Kling 4.0 a 7-subject cap; nothing else does", () => {
25
+ it("both Gemini Omni SKUs declare a 3-character cap, Kling 4.0 and Kling 4.0 Flash a 7-subject cap; nothing else does", () => {
26
26
  expect(VIDEO_REF_LIMITS_BY_PROVIDER["gemini-omni-video"]?.characters).toBe(3)
27
27
  expect(VIDEO_REF_LIMITS_BY_PROVIDER["gemini-omni-flash"]?.characters).toBe(3)
28
28
  expect(VIDEO_REF_LIMITS_BY_PROVIDER["kling-4"]?.characters).toBe(7)
29
+ expect(VIDEO_REF_LIMITS_BY_PROVIDER["kling-4-flash"]?.characters).toBe(7)
29
30
  const others = Object.entries(VIDEO_REF_LIMITS_BY_PROVIDER)
30
- .filter(([id, l]) => !id.startsWith("gemini-omni") && id !== "kling-4" && (l?.characters ?? 0) > 0)
31
+ .filter(([id, l]) => !id.startsWith("gemini-omni") && id !== "kling-4" && id !== "kling-4-flash" && (l?.characters ?? 0) > 0)
31
32
  expect(others).toEqual([])
32
33
  })
33
34
 
35
+ it("only Kling 4.0 Flash binds its audio to the characters", () => {
36
+ const binders = Object.entries(VIDEO_REF_LIMITS_BY_PROVIDER).filter(([, l]) => l?.audioBindsToCharacters).map(([id]) => id)
37
+ expect(binders).toEqual(["kling-4-flash"])
38
+ })
39
+
34
40
  it("the wire ceiling is the widest declared cap", () => {
35
41
  const widest = Math.max(...Object.values(VIDEO_REF_LIMITS_BY_PROVIDER).map((l) => l?.characters ?? 0))
36
42
  expect(VIDEO_CHARACTER_REFS_WIRE_MAX).toBe(widest)
@@ -115,6 +121,18 @@ describe("videoCharacterRefProblem", () => {
115
121
  expect(videoCharacterRefProblem({ ...base, imageCount: 4, characterReferences: [withBody, withBody] })?.code)
116
122
  .toBe("character_references_quota")
117
123
  })
124
+
125
+ it("Kling 4.0 counts voice clips in its 15 materials; Flash's clips ride the characters and take no seat", () => {
126
+ const two = [portrait(), portrait()]
127
+ // 10 images + 1 start frame + 2 videos + 2 characters = 15.
128
+ const shape = { imageCount: 10, videoCount: 2, hasStartFrame: true, characterReferences: two }
129
+ expect(videoCharacterRefProblem({ ...shape, provider: "kling-4", audioCount: 0 })).toBeNull()
130
+ expect(videoCharacterRefProblem({ ...shape, provider: "kling-4", audioCount: 1 })?.code).toBe("character_references_quota")
131
+ expect(videoCharacterRefProblem({ ...shape, provider: "kling-4-flash", audioCount: 2 })).toBeNull()
132
+ const over = videoCharacterRefProblem({ ...shape, provider: "kling-4-flash", imageCount: 11, audioCount: 2 })
133
+ expect(over?.code).toBe("character_references_quota")
134
+ expect(over?.message).not.toContain("voices")
135
+ })
118
136
  })
119
137
 
120
138
  describe("Gemini Omni voice presets (data)", () => {
@@ -4,6 +4,8 @@ import {
4
4
  normalizeMinimaxH3Resolution,
5
5
  normalizeWan3Resolution,
6
6
  normalizeViduQ4Resolution,
7
+ normalizeGrokVideo15Resolution,
8
+ KLING_4_FLASH_RESOLUTION,
7
9
  VIDEO_GEN_PROVIDERS,
8
10
  } from "../model-constants.js"
9
11
 
@@ -59,6 +61,23 @@ describe("unlistedResolutionRendersAs matches the provider's own collapse rule",
59
61
  }
60
62
  })
61
63
 
64
+ it("grok-imagine-video-1.5 declares what normalizeGrokVideo15Resolution collapses to", () => {
65
+ const declared = MODEL_CATALOG["grok-imagine-video-1.5"]!.unlistedResolutionRendersAs
66
+ expect(declared).toBe("480p")
67
+ for (const off of ["360p", "2k", "4k", "nonsense"]) {
68
+ expect(normalizeGrokVideo15Resolution(off), `grok renders ${off} as`).toBe(declared)
69
+ expect(normalizeVideoRequestParams("grok-imagine-video-1.5", { resolution: off }).resolution).toBe(declared)
70
+ }
71
+ })
72
+
73
+ it("kling-4-flash declares the one band it renders — the runner sends 720p for anything", () => {
74
+ const declared = MODEL_CATALOG["kling-4-flash"]!.unlistedResolutionRendersAs
75
+ expect(declared).toBe(KLING_4_FLASH_RESOLUTION)
76
+ for (const off of ["480p", "1080p", "4k", "nonsense"]) {
77
+ expect(normalizeVideoRequestParams("kling-4-flash", { resolution: off }).resolution).toBe(declared)
78
+ }
79
+ })
80
+
62
81
  it("a declared collapse target is always one of the model's own bands", () => {
63
82
  for (const provider of VIDEO_GEN_PROVIDERS) {
64
83
  const entry = MODEL_CATALOG[provider]
@@ -0,0 +1,68 @@
1
+ import { describe, it, expect } from "vitest"
2
+ import { VIDEO_OVERLAY_PRESETS } from "../video-overlay.js"
3
+ import { resolveVideoOverlayGeometry, videoOverlayCanvas } from "../video-overlay-geometry.js"
4
+
5
+ describe("resolveVideoOverlayGeometry (§3.4 — shared by the preview and the worker)", () => {
6
+ it("the card preset on 1080×1920 (the spec's worked example)", () => {
7
+ expect(resolveVideoOverlayGeometry({ w: 1080, h: 1920 }, VIDEO_OVERLAY_PRESETS.card, 1080 / 2160)).toEqual({
8
+ box: { left: 119, top: 307, width: 842, height: 1152 },
9
+ drawn: { left: 252, top: 307, width: 576, height: 1152 },
10
+ })
11
+ })
12
+ it("full-frame on a 9:16 canvas is the whole canvas — no edge shrink", () => {
13
+ expect(resolveVideoOverlayGeometry({ w: 1080, h: 1920 }, VIDEO_OVERLAY_PRESETS["full-frame"], 16 / 9).drawn).toEqual({ left: 0, top: 0, width: 1080, height: 1920 })
14
+ })
15
+ it("a corner badge on 16:9", () => {
16
+ expect(resolveVideoOverlayGeometry({ w: 1920, h: 1080 }, VIDEO_OVERLAY_PRESETS["corner-badge"]["bottom-right"], 1).drawn).toEqual({ left: 1497, top: 691, width: 346, height: 346 })
17
+ })
18
+ it("an odd drawn size is rounded DOWN to even (libx264 yuv420p)", () => {
19
+ expect(resolveVideoOverlayGeometry({ w: 1000, h: 1000 }, { anchor: "top-left", x: 0, y: 0, width: 25, fit: "contain" }, 3).drawn).toEqual({ left: 1, top: 0, width: 248, height: 82 })
20
+ })
21
+ it("a very tall image at width 60 % with no height is fitted inside the canvas (the clamp): 192 × 1920", () => {
22
+ expect(resolveVideoOverlayGeometry({ w: 1080, h: 1920 }, { anchor: "center", x: 0, y: 0, width: 60, fit: "contain" }, 400 / 4000)).toEqual({
23
+ box: { left: 444, top: 0, width: 192, height: 1920 },
24
+ drawn: { left: 444, top: 0, width: 192, height: 1920 },
25
+ })
26
+ })
27
+ it("…and with height 60 % set: box 648 × 1152, contain → 114 × 1152, no clamp", () => {
28
+ const g = resolveVideoOverlayGeometry({ w: 1080, h: 1920 }, { anchor: "center", x: 0, y: 0, width: 60, height: 60, fit: "contain" }, 400 / 4000)
29
+ expect(g.box).toEqual({ left: 216, top: 384, width: 648, height: 1152 })
30
+ expect(g.drawn).toEqual({ left: 483, top: 384, width: 114, height: 1152 })
31
+ })
32
+ it("a drawn size that would round below 2 px is floored at 2 × 2 (Review Focus 4)", () => {
33
+ expect(resolveVideoOverlayGeometry({ w: 100, h: 100 }, { anchor: "top-left", x: 0, y: 0, width: 1, fit: "contain" }, 1).drawn).toMatchObject({ width: 2, height: 2 })
34
+ })
35
+ it("property: drawn is even, ≥ 2 and never larger than the canvas", () => {
36
+ const canvases = [{ w: 1080, h: 1920 }, { w: 1920, h: 1080 }, { w: 100, h: 100 }, { w: 640, h: 360 }]
37
+ for (const canvas of canvases) {
38
+ for (let width = 1; width <= 100; width += 7) {
39
+ for (const height of [undefined, 1, 14, 60, 100]) {
40
+ for (const aspect of [0.05, 0.5, 1, 2, 20]) {
41
+ for (const fit of ["contain", "cover"] as const) {
42
+ const { drawn } = resolveVideoOverlayGeometry(canvas, { anchor: "center", x: 0, y: 0, width, height, fit }, aspect)
43
+ expect(drawn.width % 2).toBe(0)
44
+ expect(drawn.height % 2).toBe(0)
45
+ expect(drawn.width).toBeGreaterThanOrEqual(2)
46
+ expect(drawn.width).toBeLessThanOrEqual(canvas.w)
47
+ expect(drawn.height).toBeLessThanOrEqual(canvas.h)
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ })
54
+ })
55
+
56
+ describe("videoOverlayCanvas", () => {
57
+ it("is the display size: SAR resolved, even-rounded", () => {
58
+ expect(videoOverlayCanvas({ width: 540, height: 1920, sar: 2 })).toEqual({ w: 1080, h: 1920 })
59
+ expect(videoOverlayCanvas({ width: 1079, height: 1919 })).toEqual({ w: 1078, h: 1918 })
60
+ })
61
+ it("a target aspect wins", () => {
62
+ expect(videoOverlayCanvas({ width: 1920, height: 1080 }, "9:16")).toEqual({ w: 1080, h: 1920 })
63
+ expect(videoOverlayCanvas(null, "4:5")).toEqual({ w: 1080, h: 1350 })
64
+ })
65
+ it("unknown size and no aspect → null", () => {
66
+ expect(videoOverlayCanvas(null)).toBeNull()
67
+ })
68
+ })
@@ -2,13 +2,12 @@ import { describe, expect, it } from "vitest"
2
2
  import {
3
3
  VIDEO_OVERLAY_MAX_LAYERS,
4
4
  assembleVideoOverlayRequest,
5
- formatVideoOverlayError,
6
5
  parseVideoOverlayLayerPlan,
7
- validateVideoOverlayRequest,
8
6
  videoOverlayCompositionKey,
9
7
  videoOverlayRenderOrder,
10
8
  videoOverlaySlotSources,
11
9
  } from "../video-overlay.js"
10
+ import { formatVideoOverlayError, validateVideoOverlayRequest } from "../video-overlay-validate.js"
12
11
 
13
12
  const box = { anchor: "top", x: 0, y: 12, width: 78, height: 52, fit: "contain" } as const
14
13
  const plan = [
@@ -47,13 +46,13 @@ describe("the layerPlan input (SP2 D6, spec §6.1)", () => {
47
46
  expect(verdict.ok).toBe(false)
48
47
  if (!verdict.ok) {
49
48
  expect(verdict.code).toBe("layer_without_image")
50
- expect(formatVideoOverlayError(verdict)).toBe("Plan layer 1: no image — set imageUrl on this layer in the plan.")
49
+ expect(formatVideoOverlayError(verdict)).toBe("Plan layer 1: no image or video — set imageUrl or videoUrl on this layer in the plan.")
51
50
  }
52
51
  })
53
52
  it("a handle layer without an image keeps the handle wording", () => {
54
53
  const verdict = validateVideoOverlayRequest({ layers: [{ start: 0, slot: 2 }] })
55
54
  expect(verdict.ok).toBe(false)
56
- if (!verdict.ok) expect(formatVideoOverlayError(verdict)).toBe("Layer 2: no image — connect one to the layer's handle or set imageUrl")
55
+ if (!verdict.ok) expect(formatVideoOverlayError(verdict)).toBe("Layer 2: no image or video — connect one to the layer's handle or set imageUrl or videoUrl")
57
56
  })
58
57
  it("reports an unparseable plan as invalid_layer_plan", () => {
59
58
  const req = assembleVideoOverlayRequest({ videoUrl: "https://cdn.example/v.mp4", data: { layers: [] }, wiredImageUrls: [], planLayers: "not json" })