@nodaro/shared 3.63.0 → 3.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. package/dist/{chunk-3K24DWOH.js → chunk-222QM7CO.js} +3 -3
  2. package/dist/{chunk-3K24DWOH.js.map → chunk-222QM7CO.js.map} +1 -1
  3. package/dist/chunk-27HA6YOL.cjs +377 -0
  4. package/dist/chunk-27HA6YOL.cjs.map +1 -0
  5. package/dist/{chunk-4DVWXEB6.js → chunk-2NKF476Z.js} +3 -3
  6. package/dist/{chunk-4DVWXEB6.js.map → chunk-2NKF476Z.js.map} +1 -1
  7. package/dist/chunk-3AU52TSW.js +143 -0
  8. package/dist/chunk-3AU52TSW.js.map +1 -0
  9. package/dist/{chunk-F6WGGYQW.cjs → chunk-5NVGKXJV.cjs} +68 -29
  10. package/dist/chunk-5NVGKXJV.cjs.map +1 -0
  11. package/dist/{chunk-HWQ2SYNA.js → chunk-5SSMPYE5.js} +99 -9
  12. package/dist/chunk-5SSMPYE5.js.map +1 -0
  13. package/dist/{chunk-WRSWH7US.cjs → chunk-6BRWPJPP.cjs} +17 -2
  14. package/dist/chunk-6BRWPJPP.cjs.map +1 -0
  15. package/dist/{chunk-KHH54GRP.cjs → chunk-6ET3KDO4.cjs} +15 -338
  16. package/dist/chunk-6ET3KDO4.cjs.map +1 -0
  17. package/dist/{chunk-TM5JYSJF.cjs → chunk-6OSIOVF7.cjs} +98 -37
  18. package/dist/chunk-6OSIOVF7.cjs.map +1 -0
  19. package/dist/{chunk-YUER7TJG.js → chunk-6X5PBAC4.js} +13 -4
  20. package/dist/chunk-6X5PBAC4.js.map +1 -0
  21. package/dist/chunk-7BN4EDIC.cjs +185 -0
  22. package/dist/chunk-7BN4EDIC.cjs.map +1 -0
  23. package/dist/{chunk-6M563QE6.js → chunk-7OWXHW7Z.js} +78 -28
  24. package/dist/chunk-7OWXHW7Z.js.map +1 -0
  25. package/dist/{chunk-FXGNRYQQ.js → chunk-AT53ZQUC.js} +3 -3
  26. package/dist/{chunk-FXGNRYQQ.js.map → chunk-AT53ZQUC.js.map} +1 -1
  27. package/dist/{chunk-HSHCCBIV.js → chunk-BQYCZLMF.js} +16 -3
  28. package/dist/chunk-BQYCZLMF.js.map +1 -0
  29. package/dist/{chunk-34QLPTSA.js → chunk-BSTAAGLY.js} +3 -3
  30. package/dist/{chunk-34QLPTSA.js.map → chunk-BSTAAGLY.js.map} +1 -1
  31. package/dist/{chunk-PSKZKLDG.js → chunk-CW6MMQNO.js} +562 -26
  32. package/dist/chunk-CW6MMQNO.js.map +1 -0
  33. package/dist/{chunk-EPXGG27L.js → chunk-D5Y3EYRM.js} +5 -5
  34. package/dist/{chunk-EPXGG27L.js.map → chunk-D5Y3EYRM.js.map} +1 -1
  35. package/dist/{chunk-XGVJGNZW.cjs → chunk-DQ2PARNH.cjs} +15 -5
  36. package/dist/chunk-DQ2PARNH.cjs.map +1 -0
  37. package/dist/{chunk-6BZC2ZHC.cjs → chunk-E66HSC2E.cjs} +9 -9
  38. package/dist/{chunk-6BZC2ZHC.cjs.map → chunk-E66HSC2E.cjs.map} +1 -1
  39. package/dist/{chunk-NIAFR5EE.js → chunk-FGBGKBML.js} +32 -3
  40. package/dist/chunk-FGBGKBML.js.map +1 -0
  41. package/dist/{chunk-M5OCFGHF.cjs → chunk-FI3HJZWM.cjs} +588 -25
  42. package/dist/chunk-FI3HJZWM.cjs.map +1 -0
  43. package/dist/{chunk-L2TVY6XN.cjs → chunk-FJZTQTF4.cjs} +4 -4
  44. package/dist/{chunk-L2TVY6XN.cjs.map → chunk-FJZTQTF4.cjs.map} +1 -1
  45. package/dist/{chunk-XGGZWA4A.cjs → chunk-GJ3D5X4X.cjs} +52 -49
  46. package/dist/chunk-GJ3D5X4X.cjs.map +1 -0
  47. package/dist/{chunk-Q6IES3U2.js → chunk-H5KHWTAE.js} +5 -2
  48. package/dist/chunk-H5KHWTAE.js.map +1 -0
  49. package/dist/{chunk-MD4XHED4.js → chunk-H745DQ6V.js} +3 -3
  50. package/dist/{chunk-MD4XHED4.js.map → chunk-H745DQ6V.js.map} +1 -1
  51. package/dist/{chunk-KCZHQH2O.js → chunk-HAH2F7LT.js} +4 -4
  52. package/dist/{chunk-KCZHQH2O.js.map → chunk-HAH2F7LT.js.map} +1 -1
  53. package/dist/{chunk-V5EEQR2U.cjs → chunk-JQMFJAYU.cjs} +21 -21
  54. package/dist/{chunk-V5EEQR2U.cjs.map → chunk-JQMFJAYU.cjs.map} +1 -1
  55. package/dist/{chunk-WZVIBAKN.cjs → chunk-JYU5EIRM.cjs} +12 -12
  56. package/dist/{chunk-WZVIBAKN.cjs.map → chunk-JYU5EIRM.cjs.map} +1 -1
  57. package/dist/{chunk-Y35JQPT6.cjs → chunk-K6RIN3LW.cjs} +142 -45
  58. package/dist/chunk-K6RIN3LW.cjs.map +1 -0
  59. package/dist/{chunk-BLJUCPMV.cjs → chunk-KSHAAPQF.cjs} +5 -2
  60. package/dist/chunk-KSHAAPQF.cjs.map +1 -0
  61. package/dist/{chunk-2PU3AGGS.cjs → chunk-KTCEKGBJ.cjs} +7 -7
  62. package/dist/{chunk-2PU3AGGS.cjs.map → chunk-KTCEKGBJ.cjs.map} +1 -1
  63. package/dist/{chunk-LH72PQO2.cjs → chunk-KWYS4IIM.cjs} +165 -50
  64. package/dist/chunk-KWYS4IIM.cjs.map +1 -0
  65. package/dist/{chunk-GSKLPI3J.cjs → chunk-MIT2USTS.cjs} +118 -61
  66. package/dist/chunk-MIT2USTS.cjs.map +1 -0
  67. package/dist/{chunk-Y4GCJJPF.cjs → chunk-NYZQOIXJ.cjs} +35 -2
  68. package/dist/chunk-NYZQOIXJ.cjs.map +1 -0
  69. package/dist/{chunk-A2PX5IRC.cjs → chunk-PERUFUVH.cjs} +13 -13
  70. package/dist/{chunk-A2PX5IRC.cjs.map → chunk-PERUFUVH.cjs.map} +1 -1
  71. package/dist/{chunk-X5BAFW3Q.cjs → chunk-PGDR7CO3.cjs} +8 -8
  72. package/dist/{chunk-X5BAFW3Q.cjs.map → chunk-PGDR7CO3.cjs.map} +1 -1
  73. package/dist/{chunk-OV3JTKBY.js → chunk-PL7AQQV7.js} +123 -22
  74. package/dist/chunk-PL7AQQV7.js.map +1 -0
  75. package/dist/chunk-Q4YOLT4M.js +164 -0
  76. package/dist/chunk-Q4YOLT4M.js.map +1 -0
  77. package/dist/{chunk-GMBDLNLD.cjs → chunk-R5ILCNCC.cjs} +197 -60
  78. package/dist/chunk-R5ILCNCC.cjs.map +1 -0
  79. package/dist/chunk-RP4KQUNU.cjs +168 -0
  80. package/dist/chunk-RP4KQUNU.cjs.map +1 -0
  81. package/dist/{chunk-77WU3V3J.cjs → chunk-SPU7MUWE.cjs} +6 -6
  82. package/dist/{chunk-77WU3V3J.cjs.map → chunk-SPU7MUWE.cjs.map} +1 -1
  83. package/dist/{chunk-XBTYGQ6Z.js → chunk-ST7OBB5J.js} +8 -5
  84. package/dist/chunk-ST7OBB5J.js.map +1 -0
  85. package/dist/{chunk-2QKF7M2Z.js → chunk-TAPBDT47.js} +3 -3
  86. package/dist/{chunk-2QKF7M2Z.js.map → chunk-TAPBDT47.js.map} +1 -1
  87. package/dist/{chunk-BMJVKYVB.js → chunk-V5NLQ4L5.js} +123 -7
  88. package/dist/chunk-V5NLQ4L5.js.map +1 -0
  89. package/dist/{chunk-KMGCHV6O.js → chunk-V6OXSXIX.js} +63 -30
  90. package/dist/chunk-V6OXSXIX.js.map +1 -0
  91. package/dist/{chunk-LMAQUR55.cjs → chunk-WQMPIURW.cjs} +6 -6
  92. package/dist/{chunk-LMAQUR55.cjs.map → chunk-WQMPIURW.cjs.map} +1 -1
  93. package/dist/{chunk-ZPE2ZTJ4.cjs → chunk-WZG6GZIL.cjs} +4 -4
  94. package/dist/{chunk-ZPE2ZTJ4.cjs.map → chunk-WZG6GZIL.cjs.map} +1 -1
  95. package/dist/{chunk-AE3AAJ4O.js → chunk-XJANKTIL.js} +3 -3
  96. package/dist/{chunk-AE3AAJ4O.js.map → chunk-XJANKTIL.js.map} +1 -1
  97. package/dist/{chunk-O7RZRUMZ.js → chunk-XJWED257.js} +14 -309
  98. package/dist/chunk-XJWED257.js.map +1 -0
  99. package/dist/chunk-XSSLNINL.js +346 -0
  100. package/dist/chunk-XSSLNINL.js.map +1 -0
  101. package/dist/{chunk-6TGB7ECA.cjs → chunk-YD4XY74W.cjs} +12 -8
  102. package/dist/chunk-YD4XY74W.cjs.map +1 -0
  103. package/dist/{chunk-YX6TFX7H.js → chunk-YMZUE2IX.js} +66 -11
  104. package/dist/chunk-YMZUE2IX.js.map +1 -0
  105. package/dist/{chunk-4MMZD63H.js → chunk-Z77M7Q2R.js} +3 -3
  106. package/dist/{chunk-4MMZD63H.js.map → chunk-Z77M7Q2R.js.map} +1 -1
  107. package/dist/{chunk-CZ5IQB3L.js → chunk-ZSRXY5YT.js} +8 -5
  108. package/dist/chunk-ZSRXY5YT.js.map +1 -0
  109. package/dist/entries/apps.cjs +43 -42
  110. package/dist/entries/apps.js +8 -7
  111. package/dist/entries/captions.cjs +38 -30
  112. package/dist/entries/captions.d.cts +48 -2
  113. package/dist/entries/captions.d.ts +48 -2
  114. package/dist/entries/captions.js +1 -1
  115. package/dist/entries/credits.cjs +319 -191
  116. package/dist/entries/credits.d.cts +260 -19
  117. package/dist/entries/credits.d.ts +260 -19
  118. package/dist/entries/credits.js +11 -11
  119. package/dist/entries/entities.cjs +202 -193
  120. package/dist/entries/entities.d.cts +44 -9
  121. package/dist/entries/entities.d.ts +44 -9
  122. package/dist/entries/entities.js +2 -1
  123. package/dist/entries/llm-models.cjs +86 -62
  124. package/dist/entries/llm-models.d.cts +73 -20
  125. package/dist/entries/llm-models.d.ts +73 -20
  126. package/dist/entries/llm-models.js +2 -2
  127. package/dist/entries/media.cjs +79 -63
  128. package/dist/entries/media.d.cts +154 -1
  129. package/dist/entries/media.d.ts +154 -1
  130. package/dist/entries/media.js +1 -1
  131. package/dist/entries/model-catalog.cjs +205 -109
  132. package/dist/entries/model-catalog.d.cts +65 -58
  133. package/dist/entries/model-catalog.d.ts +65 -58
  134. package/dist/entries/model-catalog.js +4 -4
  135. package/dist/entries/models.cjs +527 -346
  136. package/dist/entries/models.d.cts +86 -7
  137. package/dist/entries/models.d.ts +86 -7
  138. package/dist/entries/models.js +6 -5
  139. package/dist/entries/nodes.cjs +220 -211
  140. package/dist/entries/nodes.d.cts +46 -3
  141. package/dist/entries/nodes.d.ts +46 -3
  142. package/dist/entries/nodes.js +10 -9
  143. package/dist/entries/pipeline.cjs +156 -152
  144. package/dist/entries/pipeline.d.cts +14 -4
  145. package/dist/entries/pipeline.d.ts +14 -4
  146. package/dist/entries/pipeline.js +3 -3
  147. package/dist/entries/social.cjs +177 -177
  148. package/dist/entries/social.js +2 -2
  149. package/dist/entries/ugc.cjs +71 -71
  150. package/dist/entries/ugc.js +4 -4
  151. package/dist/entries/video.cjs +174 -145
  152. package/dist/entries/video.d.cts +114 -2
  153. package/dist/entries/video.d.ts +114 -2
  154. package/dist/entries/video.js +7 -6
  155. package/dist/entries/workflow.cjs +150 -150
  156. package/dist/entries/workflow.d.cts +1 -1
  157. package/dist/entries/workflow.d.ts +1 -1
  158. package/dist/entries/workflow.js +2 -2
  159. package/dist/index.cjs +2430 -1929
  160. package/dist/index.d.cts +13 -12
  161. package/dist/index.d.ts +13 -12
  162. package/dist/index.js +28 -27
  163. package/dist/{model-catalog-C_Eo35tL.d.cts → model-catalog-BoUKGFNl.d.cts} +182 -3
  164. package/dist/{model-catalog-C_Eo35tL.d.ts → model-catalog-BoUKGFNl.d.ts} +182 -3
  165. package/dist/{model-constants-DWcxOmaY.d.cts → model-constants-BElS3AeE.d.ts} +142 -23
  166. package/dist/{model-constants-Bg4ccSQb.d.ts → model-constants-CpQz1bGa.d.cts} +142 -23
  167. package/dist/tts-capabilities-BtnDWK9K.d.ts +133 -0
  168. package/dist/tts-capabilities-C52UccTI.d.cts +133 -0
  169. package/package.json +1 -1
  170. package/src/__tests__/add-captions-nemotron-pricing.test.ts +111 -0
  171. package/src/__tests__/dialogue-capabilities.test.ts +167 -6
  172. package/src/__tests__/extend-providers.test.ts +353 -26
  173. package/src/__tests__/fixtures/mask-composite-quote-parity.json +1 -1
  174. package/src/__tests__/fixtures/measured-input-quote-parity.json +1435 -0
  175. package/src/__tests__/fixtures/planned-length-quote-parity.json +1866 -0
  176. package/src/__tests__/fixtures/video-utility-quote-parity.json +2343 -0
  177. package/src/__tests__/flux-3-klein.test.ts +203 -0
  178. package/src/__tests__/gpt-image-2-6-formats.test.ts +3 -1
  179. package/src/__tests__/kling4-catalog.test.ts +1 -1
  180. package/src/__tests__/llm-models.test.ts +48 -13
  181. package/src/__tests__/llm-price-key.test.ts +12 -0
  182. package/src/__tests__/model-makers.test.ts +3 -0
  183. package/src/__tests__/node-runtime-keys.test.ts +7 -0
  184. package/src/__tests__/normalize-node-params.test.ts +147 -1
  185. package/src/__tests__/retired-lip-sync-providers.test.ts +43 -0
  186. package/src/__tests__/seedance-extend-source-credit-id.test.ts +89 -0
  187. package/src/__tests__/sequence-execution.test.ts +22 -1
  188. package/src/__tests__/speech-pricing.test.ts +62 -1
  189. package/src/__tests__/suno-credit-type.test.ts +21 -2
  190. package/src/__tests__/transcribe-capabilities.test.ts +4 -2
  191. package/src/__tests__/tts-capabilities.test.ts +160 -4
  192. package/src/__tests__/video-analysis-catalog-sync.test.ts +4 -2
  193. package/src/__tests__/video-analysis-pricing.test.ts +22 -9
  194. package/src/__tests__/video-subjects.test.ts +192 -0
  195. package/src/__tests__/wired-character-names.test.ts +142 -0
  196. package/src/caption-styles.ts +62 -0
  197. package/src/credit-estimators/add-captions-nemotron.ts +73 -0
  198. package/src/credit-estimators/index.ts +14 -0
  199. package/src/credit-estimators/speech.ts +57 -9
  200. package/src/credit-identifiers.ts +284 -13
  201. package/src/dialogue-capabilities.ts +220 -3
  202. package/src/dubbing-structure.ts +186 -0
  203. package/src/entries/captions.ts +2 -0
  204. package/src/entries/credits.ts +25 -1
  205. package/src/entries/entities.ts +2 -0
  206. package/src/entries/llm-models.ts +7 -0
  207. package/src/entries/media.ts +3 -1
  208. package/src/entries/model-catalog.ts +30 -0
  209. package/src/entries/models.ts +54 -0
  210. package/src/entries/nodes.ts +2 -0
  211. package/src/entries/pipeline.ts +1 -1
  212. package/src/entries/video.ts +8 -1
  213. package/src/flux-3-klein.ts +69 -0
  214. package/src/gemini-tts.ts +144 -0
  215. package/src/input-image-pricing.ts +23 -6
  216. package/src/llm-models.ts +130 -36
  217. package/src/model-catalog.ts +539 -25
  218. package/src/model-constants.ts +247 -25
  219. package/src/node-default-mappings.ts +3 -0
  220. package/src/node-runtime-keys.ts +3 -0
  221. package/src/normalize-node-params.ts +123 -2
  222. package/src/seedance-extend-rate.ts +116 -0
  223. package/src/sequence-execution.ts +24 -0
  224. package/src/transcribe-preflight.ts +23 -0
  225. package/src/tts-capabilities.ts +193 -1
  226. package/src/video-analysis-pricing.ts +39 -15
  227. package/src/video-character-refs.ts +160 -3
  228. package/src/wired-character-names.ts +134 -18
  229. package/src/wired-character-video-subjects.ts +63 -0
  230. package/dist/chunk-63H4C56Q.cjs +0 -38
  231. package/dist/chunk-63H4C56Q.cjs.map +0 -1
  232. package/dist/chunk-6M563QE6.js.map +0 -1
  233. package/dist/chunk-6TGB7ECA.cjs.map +0 -1
  234. package/dist/chunk-6XUG4L7X.cjs +0 -54
  235. package/dist/chunk-6XUG4L7X.cjs.map +0 -1
  236. package/dist/chunk-BLJUCPMV.cjs.map +0 -1
  237. package/dist/chunk-BMJVKYVB.js.map +0 -1
  238. package/dist/chunk-CZ5IQB3L.js.map +0 -1
  239. package/dist/chunk-F6WGGYQW.cjs.map +0 -1
  240. package/dist/chunk-GMBDLNLD.cjs.map +0 -1
  241. package/dist/chunk-GSKLPI3J.cjs.map +0 -1
  242. package/dist/chunk-HBXF6RUU.js +0 -31
  243. package/dist/chunk-HBXF6RUU.js.map +0 -1
  244. package/dist/chunk-HSHCCBIV.js.map +0 -1
  245. package/dist/chunk-HWQ2SYNA.js.map +0 -1
  246. package/dist/chunk-IY3Y462W.js +0 -42
  247. package/dist/chunk-IY3Y462W.js.map +0 -1
  248. package/dist/chunk-KHH54GRP.cjs.map +0 -1
  249. package/dist/chunk-KMGCHV6O.js.map +0 -1
  250. package/dist/chunk-LH72PQO2.cjs.map +0 -1
  251. package/dist/chunk-M5OCFGHF.cjs.map +0 -1
  252. package/dist/chunk-NIAFR5EE.js.map +0 -1
  253. package/dist/chunk-O7RZRUMZ.js.map +0 -1
  254. package/dist/chunk-OV3JTKBY.js.map +0 -1
  255. package/dist/chunk-PSKZKLDG.js.map +0 -1
  256. package/dist/chunk-Q6IES3U2.js.map +0 -1
  257. package/dist/chunk-TM5JYSJF.cjs.map +0 -1
  258. package/dist/chunk-WRSWH7US.cjs.map +0 -1
  259. package/dist/chunk-XBTYGQ6Z.js.map +0 -1
  260. package/dist/chunk-XGGZWA4A.cjs.map +0 -1
  261. package/dist/chunk-XGVJGNZW.cjs.map +0 -1
  262. package/dist/chunk-Y35JQPT6.cjs.map +0 -1
  263. package/dist/chunk-Y4GCJJPF.cjs.map +0 -1
  264. package/dist/chunk-YUER7TJG.js.map +0 -1
  265. package/dist/chunk-YX6TFX7H.js.map +0 -1
@@ -1,16 +1,44 @@
1
1
  import { describe, expect, it } from "vitest"
2
- import { EXTEND_VIDEO_PROVIDERS, isSeedanceExtendProvider, isTailExtendProvider } from "../model-constants.js"
2
+ import {
3
+ EXTEND_VIDEO_PROVIDERS,
4
+ GROK_EXTEND_PROVIDER,
5
+ PIXVERSE_V6_EXTEND_PROVIDER,
6
+ extendHasSoundSwitch,
7
+ getMaxVideoPromptChars,
8
+ isCatalogExtendProvider,
9
+ isGrokExtendProvider,
10
+ isPixverseExtendProvider,
11
+ isSeedanceExtendProvider,
12
+ isTailExtendProvider,
13
+ } from "../model-constants.js"
3
14
  import { MODEL_CATALOG } from "../model-catalog.js"
4
- import { buildVideoCreditModelIdentifier, seedanceExtendCreditId, seedanceExtendResolution, tailExtendCreditId, tailExtendResolution } from "../credit-identifiers.js"
15
+ import {
16
+ buildVideoCreditModelIdentifier,
17
+ catalogExtendCreditId,
18
+ catalogExtendResolution,
19
+ grokExtendCreditId,
20
+ grokExtendSeconds,
21
+ grokExtendWiredSourceResolution,
22
+ pixverseExtendCreditId,
23
+ pixverseExtendQuality,
24
+ seedanceExtendCreditId,
25
+ seedanceExtendResolution,
26
+ tailExtendCreditId,
27
+ tailExtendResolution,
28
+ } from "../credit-identifiers.js"
5
29
 
6
30
  const range = (from: number, to: number): number[] => Array.from({ length: to - from + 1 }, (_, i) => from + i)
7
31
  const RESOLUTIONS = ["480p", "720p", "1080p"] as const
8
32
 
9
33
  /**
10
34
  * Extend Video runs Seedance as two providers, one per model: Seedance 2.5
11
- * (4–30 s added) and Seedance 2.0 (4–15 s). Each is priced on its own rows,
12
- * one per second added and resolution.
35
+ * (4–30 s added) and Seedance 2.0 (4–15 s). Seedance 2.0 is priced on its own
36
+ * rows, one per second added and resolution. Seedance 2.5 is charged per second
37
+ * it sends and adds (the source's last 10 s, all of a shorter source): the
38
+ * builder names the most a run of that length costs, the whole-window quote of
39
+ * its resolution's two-second row, `seedance-2-5-extend:<res>:per-2s:<(10 + N) / 2>u`.
13
40
  */
41
+ const fullWindow = (seconds: number, res: string): string => `seedance-2-5-extend:${res}:per-2s:${(10 + seconds) / 2}u`
14
42
  describe("Seedance Extend Video providers", () => {
15
43
  it("lists Seedance 2.5 and 2.0 as two extend providers", () => {
16
44
  expect(EXTEND_VIDEO_PROVIDERS).toEqual(expect.arrayContaining(["seedance-2-5-extend", "seedance-2-0-extend"]))
@@ -27,16 +55,17 @@ describe("Seedance Extend Video providers", () => {
27
55
  expect(isSeedanceExtendProvider(undefined)).toBe(false)
28
56
  })
29
57
 
30
- it("prices each Seedance extend on its own rows", () => {
31
- expect(tailExtendCreditId("seedance-2-5-extend", 8, "720p")).toBe("seedance-2-5-extend:8s:720p")
58
+ it("prices Seedance 2.0 on its own rows, and Seedance 2.5 at its whole-window quote", () => {
59
+ expect(tailExtendCreditId("seedance-2-5-extend", 8, "720p")).toBe("seedance-2-5-extend:720p:per-2s:9u")
32
60
  expect(tailExtendCreditId("seedance-2-0-extend", 8, "720p")).toBe("seedance-2-0-extend:8s:720p")
33
- expect(tailExtendCreditId("seedance-2-5-extend", 30, "1080p")).toBe("seedance-2-5-extend:30s:1080p")
61
+ expect(tailExtendCreditId("seedance-2-5-extend", 30, "1080p")).toBe("seedance-2-5-extend:1080p:per-2s:20u")
34
62
  expect(tailExtendCreditId("seedance-2-0-extend", 25, "480p")).toBe("seedance-2-0-extend:15s:480p")
35
- expect(tailExtendCreditId("seedance-2-5-extend")).toBe("seedance-2-5-extend:8s:720p")
63
+ expect(tailExtendCreditId("seedance-2-5-extend")).toBe("seedance-2-5-extend:720p:per-2s:9u")
36
64
  })
37
65
 
38
66
  it("prices both Seedance models per second added", () => {
39
- expect(tailExtendCreditId("seedance-2-5-extend", 6, "480p")).toBe("seedance-2-5-extend:6s:480p")
67
+ expect(tailExtendCreditId("seedance-2-5-extend", 6, "480p")).toBe("seedance-2-5-extend:480p:per-2s:8u")
68
+ expect(tailExtendCreditId("seedance-2-5-extend", 5, "480p")).toBe("seedance-2-5-extend:480p:per-2s:7.5u")
40
69
  expect(tailExtendCreditId("seedance-2-0-extend", 6, "480p")).toBe("seedance-2-0-extend:6s:480p")
41
70
  expect(tailExtendCreditId("seedance-2-0-extend", 10, "1080p")).toBe("seedance-2-0-extend:10s:1080p")
42
71
  expect(tailExtendCreditId("seedance-2-0-extend", 4, "720p")).toBe("seedance-2-0-extend:4s:720p")
@@ -44,12 +73,12 @@ describe("Seedance Extend Video providers", () => {
44
73
  })
45
74
 
46
75
  it("snaps a length or a resolution the provider does not offer", () => {
47
- expect(tailExtendCreditId("seedance-2-5-extend", 2, "720p")).toBe("seedance-2-5-extend:4s:720p")
48
- expect(tailExtendCreditId("seedance-2-5-extend", 45, "720p")).toBe("seedance-2-5-extend:30s:720p")
49
- expect(tailExtendCreditId("seedance-2-5-extend", 8, "4k")).toBe("seedance-2-5-extend:8s:720p")
76
+ expect(tailExtendCreditId("seedance-2-5-extend", 2, "720p")).toBe(fullWindow(4, "720p"))
77
+ expect(tailExtendCreditId("seedance-2-5-extend", 45, "720p")).toBe(fullWindow(30, "720p"))
78
+ expect(tailExtendCreditId("seedance-2-5-extend", 8, "4k")).toBe(fullWindow(8, "720p"))
50
79
  expect(tailExtendCreditId("seedance-2-0-extend", 8, "4k")).toBe("seedance-2-0-extend:8s:720p")
51
80
  expect(tailExtendCreditId("seedance-2-0-extend", 2, "480p")).toBe("seedance-2-0-extend:4s:480p")
52
- expect(tailExtendCreditId("seedance-2-5-extend", 0, "480p")).toBe("seedance-2-5-extend:8s:480p")
81
+ expect(tailExtendCreditId("seedance-2-5-extend", 0, "480p")).toBe(fullWindow(8, "480p"))
53
82
  })
54
83
 
55
84
  it("renders at the resolution it is priced at: one the model offers, else 720p", () => {
@@ -60,7 +89,9 @@ describe("Seedance Extend Video providers", () => {
60
89
  }
61
90
  // The id names exactly the resolution the run renders at.
62
91
  for (const res of [...RESOLUTIONS, undefined, "4k"]) {
63
- expect(tailExtendCreditId(provider, 8, res)).toBe(`${provider}:8s:${tailExtendResolution(provider, res)}`)
92
+ expect(tailExtendCreditId(provider, 8, res)).toBe(
93
+ provider === "seedance-2-5-extend" ? fullWindow(8, tailExtendResolution(provider, res)) : `${provider}:8s:${tailExtendResolution(provider, res)}`,
94
+ )
64
95
  }
65
96
  }
66
97
  })
@@ -68,8 +99,8 @@ describe("Seedance Extend Video providers", () => {
68
99
  it("names only rows each provider is priced on, for any length and resolution", () => {
69
100
  // The Seedance 2.0 rows: every second of its window at three resolutions.
70
101
  const rows20 = new Set(range(4, 15).flatMap((n) => RESOLUTIONS.map((r) => `seedance-2-0-extend:${n}s:${r}`)))
71
- // The Seedance 2.5 rows: every second of its window at three resolutions.
72
- const rows25 = new Set(range(4, 30).flatMap((n) => RESOLUTIONS.map((r) => `seedance-2-5-extend:${n}s:${r}`)))
102
+ // Seedance 2.5: the whole-window quote of every second of its window at three resolutions.
103
+ const rows25 = new Set(range(4, 30).flatMap((n) => RESOLUTIONS.map((r) => fullWindow(n, r))))
73
104
  for (const res of [...RESOLUTIONS, undefined, "4k"]) {
74
105
  for (const duration of [undefined, ...range(-1, 35)]) {
75
106
  expect(rows20.has(tailExtendCreditId("seedance-2-0-extend", duration, res)), `2.0 ${duration}s ${res}`).toBe(true)
@@ -78,7 +109,7 @@ describe("Seedance Extend Video providers", () => {
78
109
  }
79
110
  })
80
111
 
81
- it("the generic video builder prices a Seedance extend on its own rows, never a bare unpriced id", () => {
112
+ it("the generic video builder prices a Seedance extend through the extend builder, never a bare unpriced id", () => {
82
113
  for (const provider of ["seedance-2-5-extend", "seedance-2-0-extend"] as const) {
83
114
  for (const duration of [undefined, 1, 6, 12, 25, 45, "12"]) {
84
115
  for (const res of [undefined, "480p", "720p", "1080p", "4k"]) {
@@ -88,8 +119,8 @@ describe("Seedance Extend Video providers", () => {
88
119
  }
89
120
  }
90
121
  // The retired id is priced as the provider it runs as.
91
- expect(buildVideoCreditModelIdentifier("seedance-2-extend", 12, undefined, undefined, undefined, "1080p")).toBe("seedance-2-5-extend:12s:1080p")
92
- expect(buildVideoCreditModelIdentifier("seedance-2-extend")).toBe("seedance-2-5-extend:8s:720p")
122
+ expect(buildVideoCreditModelIdentifier("seedance-2-extend", 12, undefined, undefined, undefined, "1080p")).toBe("seedance-2-5-extend:1080p:per-2s:11u")
123
+ expect(buildVideoCreditModelIdentifier("seedance-2-extend")).toBe("seedance-2-5-extend:720p:per-2s:9u")
93
124
  })
94
125
 
95
126
  it("catalogs each with its own window", () => {
@@ -102,14 +133,23 @@ describe("Seedance Extend Video providers", () => {
102
133
  expect(entry.maker).toBe("bytedance")
103
134
  expect(entry.defaultDuration).toBe(8)
104
135
  expect(entry.resolutions).toEqual([...RESOLUTIONS])
105
- // Each catalog entry lists the rows its default length is priced on.
106
- const ids = entry.pricing.map((p) => p.identifier)
107
- for (const res of RESOLUTIONS) expect(ids, `${id} ${res}`).toContain(tailExtendCreditId(id, 8, res))
108
- // The first row is the default run's price; the retired provider id is
109
- // never listed (sent as a provider, it runs and bills as Seedance 2.5).
110
- expect(entry.pricing[0]!.identifier, id).toBe(tailExtendCreditId(id))
111
- expect(ids, id).not.toContain("seedance-2-extend")
136
+ // The retired provider id is never listed (sent as a provider, it runs and bills as Seedance 2.5).
137
+ expect(entry.pricing.map((p) => p.identifier), id).not.toContain("seedance-2-extend")
112
138
  }
139
+ // Seedance 2.0 lists the rows its default length is priced on, the default run's first.
140
+ const ids20 = MODEL_CATALOG["seedance-2-0-extend"]!.pricing.map((p) => p.identifier)
141
+ for (const res of RESOLUTIONS) expect(ids20, res).toContain(tailExtendCreditId("seedance-2-0-extend", 8, res))
142
+ expect(ids20[0]).toBe(tailExtendCreditId("seedance-2-0-extend"))
143
+ // Seedance 2.5 is charged per second sent and added (decided 2026-11-12): it
144
+ // lists its default run (8 s added to a source of 10 s or more: 9 units of
145
+ // each resolution's two-second rate row) as whole-run quote ids, 720p first.
146
+ expect(MODEL_CATALOG["seedance-2-5-extend"]!.pricing.map((p) => p.identifier)).toEqual([
147
+ "seedance-2-5-extend:720p:per-2s:9u",
148
+ "seedance-2-5-extend:480p:per-2s:9u",
149
+ "seedance-2-5-extend:1080p:per-2s:9u",
150
+ ])
151
+ // Its default run is the builder's default.
152
+ expect(MODEL_CATALOG["seedance-2-5-extend"]!.pricing[0]!.identifier).toBe(tailExtendCreditId("seedance-2-5-extend"))
113
153
  })
114
154
  })
115
155
 
@@ -192,3 +232,290 @@ describe("the tail-recipe extend providers", () => {
192
232
  }
193
233
  })
194
234
  })
235
+
236
+ /**
237
+ * PixVerse V6 extends any video natively: the whole source goes in, and the
238
+ * same clip comes back with the new seconds joined on (the worker keeps only
239
+ * those). `pixverse-v6-extend`: 1–15 s added at 360p / 540p / 720p / 1080p,
240
+ * with a sound switch, priced on its own rows (`:audio` with sound).
241
+ */
242
+ describe("PixVerse V6 Extend Video provider", () => {
243
+ const QUALITIES = ["360p", "540p", "720p", "1080p"] as const
244
+
245
+ it("is listed after Kling 4, and is no tail recipe", () => {
246
+ const at = EXTEND_VIDEO_PROVIDERS.indexOf("pixverse-v6-extend")
247
+ expect(at).toBeGreaterThan(-1)
248
+ expect(EXTEND_VIDEO_PROVIDERS[at - 1]).toBe("kling-4-extend")
249
+ expect(PIXVERSE_V6_EXTEND_PROVIDER).toBe("pixverse-v6-extend")
250
+ expect(isPixverseExtendProvider("pixverse-v6-extend")).toBe(true)
251
+ expect(isPixverseExtendProvider("pixverse-v6-max")).toBe(false)
252
+ expect(isPixverseExtendProvider(undefined)).toBe(false)
253
+ expect(isTailExtendProvider("pixverse-v6-extend")).toBe(false)
254
+ expect(isSeedanceExtendProvider("pixverse-v6-extend")).toBe(false)
255
+ })
256
+
257
+ it("is a catalog extend provider, as the tail recipes are; VEO, Runway and LTX are not", () => {
258
+ expect(EXTEND_VIDEO_PROVIDERS.filter(isCatalogExtendProvider)).toEqual([
259
+ "seedance-2-5-extend", "seedance-2-0-extend", "kling-4-extend", "pixverse-v6-extend",
260
+ ])
261
+ for (const p of ["veo-extend", "runway-extend", "ltx-2.3-pro", "seedance-2-extend", "toString", undefined]) {
262
+ expect(isCatalogExtendProvider(p), String(p)).toBe(false)
263
+ }
264
+ })
265
+
266
+ it("has a sound switch, as Seedance does; Kling 4 has none", () => {
267
+ expect(EXTEND_VIDEO_PROVIDERS.filter(extendHasSoundSwitch)).toEqual(["seedance-2-5-extend", "seedance-2-0-extend", "pixverse-v6-extend"])
268
+ })
269
+
270
+ it("offers 1–15 s and 360p–1080p in a catalog entry of its own, its default row first", () => {
271
+ const entry = MODEL_CATALOG["pixverse-v6-extend"]!
272
+ expect(entry.modes).toEqual(["extend"])
273
+ expect(entry.maker).toBe("pixverse")
274
+ expect(entry.durations).toEqual(range(1, 15))
275
+ expect(entry.defaultDuration).toBe(5)
276
+ expect(entry.resolutions).toEqual([...QUALITIES])
277
+ expect(entry.pricing[0]!.identifier).toBe(pixverseExtendCreditId())
278
+ expect(entry.pricing[0]!.identifier).toBe("pixverse-v6-extend:5s:720p:audio")
279
+ })
280
+
281
+ it("takes PixVerse's prompt limit, 5000 characters", () => {
282
+ expect(getMaxVideoPromptChars("pixverse-v6-extend")).toBe(5000)
283
+ })
284
+
285
+ it("renders a quality it offers as asked; 480p at the nearest it offers, 540p; anything else at 720p", () => {
286
+ for (const q of QUALITIES) expect(pixverseExtendQuality(q)).toBe(q)
287
+ expect(pixverseExtendQuality("480p")).toBe("540p")
288
+ for (const other of [undefined, "", "4k", "2160p", "1080P", 720, null]) {
289
+ expect(pixverseExtendQuality(other), String(other)).toBe("720p")
290
+ }
291
+ })
292
+
293
+ it("prices the seconds added, the quality and the sound on its own rows, sound on unless turned off", () => {
294
+ expect(pixverseExtendCreditId(5, "540p", true)).toBe("pixverse-v6-extend:5s:540p:audio")
295
+ expect(pixverseExtendCreditId(5, "540p", false)).toBe("pixverse-v6-extend:5s:540p")
296
+ expect(pixverseExtendCreditId(5, "540p")).toBe("pixverse-v6-extend:5s:540p:audio")
297
+ expect(pixverseExtendCreditId(15, "1080p", false)).toBe("pixverse-v6-extend:15s:1080p")
298
+ expect(pixverseExtendCreditId(1, "360p", false)).toBe("pixverse-v6-extend:1s:360p")
299
+ expect(pixverseExtendCreditId(undefined, undefined, undefined)).toBe("pixverse-v6-extend:5s:720p:audio")
300
+ expect(pixverseExtendCreditId(8, "480p", false)).toBe("pixverse-v6-extend:8s:540p")
301
+ expect(pixverseExtendCreditId(40, "4k", false)).toBe("pixverse-v6-extend:15s:720p")
302
+ // Every id it can name is one of its 120 rows.
303
+ const rows = new Set(range(1, 15).flatMap((n) => QUALITIES.flatMap((q) => [`pixverse-v6-extend:${n}s:${q}`, `pixverse-v6-extend:${n}s:${q}:audio`])))
304
+ expect(rows.size).toBe(120)
305
+ for (const res of [...QUALITIES, undefined, "480p", "4k"]) {
306
+ for (const duration of [undefined, "7", ...range(-1, 20)]) {
307
+ for (const sound of [true, false, undefined]) {
308
+ expect(rows.has(pixverseExtendCreditId(duration, res, sound)), `${duration}s ${res} ${sound}`).toBe(true)
309
+ }
310
+ }
311
+ }
312
+ })
313
+
314
+ it("the catalog-extend builders answer for PixVerse and for every tail recipe alike", () => {
315
+ expect(catalogExtendCreditId("pixverse-v6-extend", 5, "540p", false)).toBe(pixverseExtendCreditId(5, "540p", false))
316
+ expect(catalogExtendResolution("pixverse-v6-extend", "480p")).toBe("540p")
317
+ for (const provider of ["seedance-2-5-extend", "seedance-2-0-extend", "kling-4-extend"] as const) {
318
+ for (const res of [undefined, "480p", "540p", "1080p", "4k"]) {
319
+ // A tail recipe has no priced sound switch: its row ignores it.
320
+ for (const sound of [true, false, undefined]) {
321
+ expect(catalogExtendCreditId(provider, 12, res, sound)).toBe(tailExtendCreditId(provider, 12, res))
322
+ }
323
+ expect(catalogExtendResolution(provider, res)).toBe(tailExtendResolution(provider, res))
324
+ }
325
+ }
326
+ })
327
+
328
+ it("the generic video builder prices a PixVerse extend on its own rows, reading generateAudio then sound", () => {
329
+ for (const duration of [undefined, 1, 5, 12, 15, 30, "12"]) {
330
+ for (const res of [undefined, "480p", "540p", "1080p"]) {
331
+ expect(buildVideoCreditModelIdentifier("pixverse-v6-extend", duration, undefined, undefined, undefined, res), `${duration} ${res}`)
332
+ .toBe(pixverseExtendCreditId(duration, res, true))
333
+ expect(buildVideoCreditModelIdentifier("pixverse-v6-extend", duration, { generateAudio: false }, undefined, undefined, res))
334
+ .toBe(pixverseExtendCreditId(duration, res, false))
335
+ expect(buildVideoCreditModelIdentifier("pixverse-v6-extend", duration, false, undefined, undefined, res))
336
+ .toBe(pixverseExtendCreditId(duration, res, false))
337
+ }
338
+ }
339
+ })
340
+ })
341
+
342
+ /**
343
+ * Grok extends only its own clips (a Grok Imagine text-to-video or
344
+ * image-to-video run), by the source's task. It adds 6 or 10 seconds, at the
345
+ * source's resolution — never a resolution the request names — so it is no
346
+ * catalog extend (whose resolution is a lever).
347
+ */
348
+ describe("Grok Extend Video provider", () => {
349
+ const ROWS = ["grok-extend:6s:480p", "grok-extend:6s:720p", "grok-extend:10s:480p", "grok-extend:10s:720p"]
350
+
351
+ it("is listed last, and is neither a tail recipe nor a catalog extend", () => {
352
+ expect(EXTEND_VIDEO_PROVIDERS[EXTEND_VIDEO_PROVIDERS.length - 1]).toBe("grok-extend")
353
+ expect(EXTEND_VIDEO_PROVIDERS[EXTEND_VIDEO_PROVIDERS.length - 2]).toBe("pixverse-v6-extend")
354
+ expect(GROK_EXTEND_PROVIDER).toBe("grok-extend")
355
+ expect(isGrokExtendProvider("grok-extend")).toBe(true)
356
+ for (const p of ["grok", "grok-i2v", "grok-imagine-video-1.5", "pixverse-v6-extend", "veo-extend", undefined]) {
357
+ expect(isGrokExtendProvider(p), String(p)).toBe(false)
358
+ }
359
+ expect(isTailExtendProvider("grok-extend")).toBe(false)
360
+ expect(isCatalogExtendProvider("grok-extend")).toBe(false)
361
+ expect(extendHasSoundSwitch("grok-extend")).toBe(false)
362
+ })
363
+
364
+ it("offers 6 or 10 s in a catalog entry of its own, with no resolution lever, its unknown-source row first", () => {
365
+ const entry = MODEL_CATALOG["grok-extend"]!
366
+ expect(entry.modes).toEqual(["extend"])
367
+ expect(entry.maker).toBe("xai")
368
+ expect(entry.durations).toEqual([6, 10])
369
+ expect(entry.defaultDuration).toBe(6)
370
+ // The source decides the resolution: none is offered as a choice.
371
+ expect(entry.resolutions).toBeUndefined()
372
+ expect(entry.pricing.map((p) => p.identifier).sort()).toEqual([...ROWS].sort())
373
+ // Led by the row a run is quoted at before its source is known: 6 s, the dearer 720p.
374
+ expect(entry.pricing[0]!.identifier).toBe(grokExtendCreditId())
375
+ expect(entry.pricing[0]!.identifier).toBe("grok-extend:6s:720p")
376
+ })
377
+
378
+ it("prices the seconds added at the source's resolution; an unknown source at 720p, never below", () => {
379
+ expect(grokExtendCreditId(6, "480p")).toBe("grok-extend:6s:480p")
380
+ expect(grokExtendCreditId(10, "480p")).toBe("grok-extend:10s:480p")
381
+ expect(grokExtendCreditId(6, "720p")).toBe("grok-extend:6s:720p")
382
+ expect(grokExtendCreditId(10, "720p")).toBe("grok-extend:10s:720p")
383
+ expect(grokExtendCreditId("10", "480p")).toBe("grok-extend:10s:480p")
384
+ // No length: its default, 6 s. A length it does not add snaps into 6 / 10.
385
+ expect(grokExtendCreditId(undefined, "480p")).toBe("grok-extend:6s:480p")
386
+ expect(grokExtendCreditId(8, "480p")).toBe("grok-extend:6s:480p")
387
+ expect(grokExtendCreditId(15, "720p")).toBe("grok-extend:10s:720p")
388
+ // A source whose resolution is not known is priced at the dearer row.
389
+ for (const res of [undefined, "", "720P", "1080p", "540p", 480]) {
390
+ expect(grokExtendCreditId(6, res), String(res)).toBe("grok-extend:6s:720p")
391
+ }
392
+ expect(grokExtendSeconds(undefined)).toBe(6)
393
+ expect(grokExtendSeconds(10)).toBe(10)
394
+ expect(grokExtendSeconds("10")).toBe(10)
395
+ expect(grokExtendSeconds(7)).toBe(6)
396
+ // Every id it can name is one of its four rows.
397
+ for (const duration of [undefined, "7", ...range(-1, 20)]) {
398
+ for (const res of [undefined, "480p", "720p", "1080p", "4k"]) {
399
+ expect(ROWS, `${duration}s ${res}`).toContain(grokExtendCreditId(duration, res))
400
+ }
401
+ }
402
+ })
403
+
404
+ it("the generic video builder never prices a Grok extend at a resolution it is handed", () => {
405
+ for (const res of [undefined, "480p", "720p"]) {
406
+ expect(buildVideoCreditModelIdentifier("grok-extend", 10, undefined, undefined, undefined, res), String(res)).toBe("grok-extend:10s:720p")
407
+ }
408
+ })
409
+
410
+ it("quotes 480p only for a wired Grok Imagine video node set to 480p; anything else at 720p", () => {
411
+ const video = (provider: unknown, resolution?: unknown, type = "generate-video") => ({ id: "src", type, data: { provider, ...(resolution !== undefined ? { resolution } : {}) } })
412
+ const ext = { id: "ext", type: "extend-video", data: { provider: "grok-extend" } }
413
+ const wire = (targetHandle: string | null = "video") => [{ source: "src", target: "ext", targetHandle }]
414
+ for (const type of ["generate-video", "text-to-video", "image-to-video"]) {
415
+ for (const provider of ["grok", "grok-i2v"]) {
416
+ expect(grokExtendWiredSourceResolution("ext", [ext, video(provider, "480p", type)], wire()), `${type} ${provider}`).toBe("480p")
417
+ expect(grokExtendWiredSourceResolution("ext", [ext, video(provider, " 480P ", type)], wire())).toBe("480p")
418
+ // Unset: Grok may render it at either, so the dearer.
419
+ for (const res of [undefined, "720p", "1080p", ""]) {
420
+ expect(grokExtendWiredSourceResolution("ext", [ext, video(provider, res, type)], wire()), `${type} ${provider} ${res}`).toBe("720p")
421
+ }
422
+ }
423
+ }
424
+ // A legacy wire with no handle reads the same.
425
+ expect(grokExtendWiredSourceResolution("ext", [ext, video("grok-i2v", "480p")], wire(null))).toBe("480p")
426
+ // Not a Grok Imagine video node: another model, Grok 1.5, an upload, a Grok image.
427
+ for (const src of [video("seedance-2-5", "480p"), video("grok-imagine-video-1.5", "480p"), video(undefined, "480p", "upload-video"), video("grok", "480p", "generate-image")]) {
428
+ expect(grokExtendWiredSourceResolution("ext", [ext, src], wire())).toBe("720p")
429
+ }
430
+ // Nothing wired, or a wire on another input.
431
+ expect(grokExtendWiredSourceResolution("ext", [ext], [])).toBe("720p")
432
+ expect(grokExtendWiredSourceResolution("ext", [ext, video("grok-i2v", "480p")], wire("prompt"))).toBe("720p")
433
+ })
434
+
435
+ // The charge reads the resolution the SOURCE's job recorded (`input_data.resolution`; none: the
436
+ // KIE config's pin, else Grok's own 480p default). Every lane that lands a take records the task
437
+ // that made it and that recorded resolution on the result row, so the quote reads the same fact,
438
+ // off the take the node's task names (the clip the run extends): `480p` → the 480p row; anything
439
+ // else, or none → the 720p row, never below the charge.
440
+ describe("a Grok node that already made a clip: quoted from the resolution its job recorded, not from its setting", () => {
441
+ const ext = { id: "ext", type: "extend-video", data: { provider: "grok-extend" } }
442
+ const wire = [{ source: "src", target: "ext", targetHandle: "video" }]
443
+ type Row = { task?: string; recorded?: string; width?: number; height?: number }
444
+ /** A Grok Imagine node holding task `t-latest`, set to `resolution`; its results newest first. */
445
+ const ran = (rows: readonly Row[], resolution?: string, extra: Record<string, unknown> = {}) => ({
446
+ id: "src",
447
+ type: "generate-video",
448
+ data: {
449
+ provider: "grok-i2v",
450
+ ...(resolution !== undefined ? { resolution } : {}),
451
+ kieTaskId: "t-latest",
452
+ generatedResults: rows.map((r, i) => ({
453
+ url: `https://cdn.example/${i}.mp4`, jobId: `j${i}`,
454
+ ...(r.task !== undefined ? { kieTaskId: r.task } : {}),
455
+ ...(r.recorded !== undefined ? { recordedResolution: r.recorded } : {}),
456
+ ...(r.width !== undefined ? { width: r.width, height: r.height } : {}),
457
+ })),
458
+ ...extra,
459
+ },
460
+ })
461
+ const quote = (node: ReturnType<typeof ran>, rerunIds?: ReadonlySet<string>) => grokExtendWiredSourceResolution("ext", [ext, node], wire, rerunIds)
462
+
463
+ it("the take the task names recorded 480p: 480p, whatever the node is set to now", () => {
464
+ for (const resolution of ["480p", "720p", undefined]) {
465
+ expect(quote(ran([{ task: "t-latest", recorded: "480p" }], resolution)), String(resolution)).toBe("480p")
466
+ }
467
+ // Case-insensitive, as the charge reads it.
468
+ expect(quote(ran([{ task: "t-latest", recorded: "480P" }]))).toBe("480p")
469
+ })
470
+
471
+ it("recorded 720p (a node set to 480p since): 720p", () => {
472
+ expect(quote(ran([{ task: "t-latest", recorded: "720p" }], "480p"))).toBe("720p")
473
+ })
474
+
475
+ it("the take names the task but recorded no resolution: 720p", () => {
476
+ expect(quote(ran([{ task: "t-latest" }], "480p"))).toBe("720p")
477
+ })
478
+
479
+ it("the file's pixel size is never read: a 480p-sized file whose job recorded 720p is 720p (and a 720p-sized one recording 480p is 480p)", () => {
480
+ expect(quote(ran([{ task: "t-latest", recorded: "720p", width: 854, height: 480 }], "480p"))).toBe("720p")
481
+ expect(quote(ran([{ task: "t-latest", recorded: "480p", width: 1280, height: 720 }], "720p"))).toBe("480p")
482
+ expect(quote(ran([{ task: "t-latest", width: 854, height: 480 }], "480p"))).toBe("720p")
483
+ })
484
+
485
+ it("no result names the node's task — its result deleted, results from before they recorded their task, or none at all: 720p", () => {
486
+ for (const resolution of ["480p", "720p", undefined]) {
487
+ // The newest (720p) result deleted; the node still holds its task.
488
+ expect(quote(ran([{ task: "t-older", recorded: "480p" }], resolution)), String(resolution)).toBe("720p")
489
+ // Results that recorded no task.
490
+ expect(quote(ran([{ recorded: "480p" }, { width: 854, height: 480 }], resolution)), String(resolution)).toBe("720p")
491
+ // A task with no result.
492
+ expect(quote(ran([], resolution)), String(resolution)).toBe("720p")
493
+ }
494
+ })
495
+
496
+ it("reads the take the task names — never the one only shown, nor the newest", () => {
497
+ const node = ran([{ task: "t-older", recorded: "720p" }, { task: "t-latest", recorded: "480p" }], "720p", { activeResultIndex: 0 })
498
+ expect(quote(node)).toBe("480p")
499
+ // An edit landed after it (a result with no task of its own).
500
+ expect(quote(ran([{ recorded: "720p" }, { task: "t-latest", recorded: "480p" }], "720p"))).toBe("480p")
501
+ })
502
+
503
+ it("a node that has not run quotes its setting: 480p as set, else 720p", () => {
504
+ const fresh = (resolution?: string) => ({ id: "src", type: "generate-video", data: { provider: "grok", ...(resolution !== undefined ? { resolution } : {}) } })
505
+ expect(grokExtendWiredSourceResolution("ext", [ext, fresh("480p")], wire)).toBe("480p")
506
+ expect(grokExtendWiredSourceResolution("ext", [ext, fresh()], wire)).toBe("720p")
507
+ expect(grokExtendWiredSourceResolution("ext", [ext, fresh("720p")], wire)).toBe("720p")
508
+ })
509
+
510
+ it("a node that makes a new clip in the quoted run is quoted at its setting (the clip it will make)", () => {
511
+ // Recorded 480p, now set to 720p, and it runs again: the run extends the new 720p clip.
512
+ expect(quote(ran([{ task: "t-latest", recorded: "480p" }], "720p"), new Set(["src", "ext"]))).toBe("720p")
513
+ // Recorded 720p, now set to 480p, and it runs again: the new clip is 480p.
514
+ expect(quote(ran([{ task: "t-latest", recorded: "720p" }], "480p"), new Set(["src", "ext"]))).toBe("480p")
515
+ // A frozen node does not run again: it hands on the clip it holds.
516
+ expect(quote(ran([{ task: "t-latest", recorded: "720p" }], "480p", { skipped: true }), new Set(["src", "ext"]))).toBe("720p")
517
+ // Outside the run's nodes (Run from here on the extension): the clip it holds.
518
+ expect(quote(ran([{ task: "t-latest", recorded: "720p" }], "480p"), new Set(["ext"]))).toBe("720p")
519
+ })
520
+ })
521
+ })
@@ -1,5 +1,5 @@
1
1
  {
2
- "$comment": "Mask Composite's quote before a run, read by BOTH estimates over the same graphs: the editor's (frontend maskCompositePricingUnits — the node's pill, its Run button, the confirm and the workflow badge) and the server's run estimate (CreditsService.estimateWorkflowBaseCredits). Each case wires its sources into the composite `c`; `expectedUnits` is the 5-second units both quote (60 = the 300 s cap). The sources are uploads, Library clips and Video links, which the two read the same way (as they do Trim / Loop / Combine Videos or length-keeping steps built only on those). Any other node's output (a generation, an Extend Video, or a step that recorded a length of its own, and a chain built on one) is not a case: the editor reads the length that node records or is set to, which the server's run estimate does not read. `fallbackDecidedBefore` marks a shape the editor used to price from a length the upstream node merely stores (an upload's metadata, a Video link's whole length) — the server never read it, so the editor now quotes the cap there too. `libraryAsset` is the Library asset a case's upload node was added from: the editor half builds that node through `assetToUploadNode` and holds it to `nodes[0].data` (all but the row's `jobId` and `timestamp`, which no reader reads), so the server half reads exactly what a Library add writes.",
2
+ "$comment": "Mask Composite's quote before a run, read by BOTH estimates over the same graphs: the editor's (frontend maskCompositePricingUnits — the node's pill, its Run button, the confirm and the workflow badge) and the server's run estimate (CreditsService.estimateWorkflowBaseCredits). Each case wires its sources into the composite `c`; `expectedUnits` is the 5-second units both quote (60 = the 300 s cap). The sources here are uploads, Library clips and Video links (recordings, read the same way by both through the shared measured walk, `measuredWireLengthSec`); a video another node makes — a generation, an Extend Video, a step that re-runs, and a chain built on one — is held to the same parity by the sibling fixture planned-length-quote-parity.json, for Mask Composite and Video Overlay both. `fallbackDecidedBefore` marks a shape the editor used to price from a length the upstream node merely stores (an upload's metadata, a Video link's whole length) — the server never read it, so the editor now quotes the cap there too. `libraryAsset` is the Library asset a case's upload node was added from: the editor half builds that node through `assetToUploadNode` and holds it to `nodes[0].data` (all but the row's `jobId` and `timestamp`, which no reader reads), so the server half reads exactly what a Library add writes.",
3
3
  "cases": [
4
4
  {
5
5
  "name": "an uploaded clip: the result row the upload recorded for its current file",