@nodaro/shared 3.32.0 → 3.35.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 (274) hide show
  1. package/dist/{chunk-VWGNPMJZ.cjs → chunk-24ZKPE33.cjs} +5 -5
  2. package/dist/{chunk-VWGNPMJZ.cjs.map → chunk-24ZKPE33.cjs.map} +1 -1
  3. package/dist/{chunk-CK3GK34R.js → chunk-2HIDE3QV.js} +9 -3
  4. package/dist/chunk-2HIDE3QV.js.map +1 -0
  5. package/dist/{chunk-WDIBOWAA.js → chunk-2HVFF5SS.js} +6 -6
  6. package/dist/chunk-2HVFF5SS.js.map +1 -0
  7. package/dist/{chunk-KHCBJ7KD.js → chunk-2QWNPYDG.js} +3 -3
  8. package/dist/{chunk-KHCBJ7KD.js.map → chunk-2QWNPYDG.js.map} +1 -1
  9. package/dist/{chunk-J6KHW2E5.cjs → chunk-3YG3MYDE.cjs} +153 -24
  10. package/dist/chunk-3YG3MYDE.cjs.map +1 -0
  11. package/dist/{chunk-ULXI7A6Q.cjs → chunk-5VNBQ4QK.cjs} +16 -16
  12. package/dist/{chunk-ULXI7A6Q.cjs.map → chunk-5VNBQ4QK.cjs.map} +1 -1
  13. package/dist/{chunk-5AUSSJIM.cjs → chunk-5ZCXWA7J.cjs} +232 -15
  14. package/dist/chunk-5ZCXWA7J.cjs.map +1 -0
  15. package/dist/{chunk-Z2OL5AJD.cjs → chunk-6F6GGX2W.cjs} +4 -3
  16. package/dist/chunk-6F6GGX2W.cjs.map +1 -0
  17. package/dist/{chunk-E2TGXG6X.cjs → chunk-72IFMNJE.cjs} +80 -52
  18. package/dist/chunk-72IFMNJE.cjs.map +1 -0
  19. package/dist/{chunk-NB72XWXQ.cjs → chunk-A5Z3IMSJ.cjs} +6 -6
  20. package/dist/{chunk-NB72XWXQ.cjs.map → chunk-A5Z3IMSJ.cjs.map} +1 -1
  21. package/dist/{chunk-NT6IJH4L.cjs → chunk-AGEZY4LL.cjs} +66 -47
  22. package/dist/chunk-AGEZY4LL.cjs.map +1 -0
  23. package/dist/{chunk-3CUFITU7.js → chunk-ANOQWAMU.js} +88 -54
  24. package/dist/chunk-ANOQWAMU.js.map +1 -0
  25. package/dist/{chunk-PRYE7AZQ.cjs → chunk-AWWOQH46.cjs} +7 -7
  26. package/dist/chunk-AWWOQH46.cjs.map +1 -0
  27. package/dist/{chunk-QELDJGDK.cjs → chunk-B7WJJHJS.cjs} +7 -4
  28. package/dist/chunk-B7WJJHJS.cjs.map +1 -0
  29. package/dist/{chunk-AVQK77G6.cjs → chunk-BBLE4UTG.cjs} +88 -54
  30. package/dist/chunk-BBLE4UTG.cjs.map +1 -0
  31. package/dist/{chunk-HGC5JNVA.cjs → chunk-BVVKMQKR.cjs} +9 -2
  32. package/dist/chunk-BVVKMQKR.cjs.map +1 -0
  33. package/dist/{chunk-YYV35XOS.js → chunk-C4R7BTBQ.js} +4 -3
  34. package/dist/chunk-C4R7BTBQ.js.map +1 -0
  35. package/dist/{chunk-AROWPFO2.js → chunk-ETXUOETU.js} +29 -36
  36. package/dist/chunk-ETXUOETU.js.map +1 -0
  37. package/dist/{chunk-S5DMKUWK.cjs → chunk-F4ZT5X2S.cjs} +11 -11
  38. package/dist/{chunk-S5DMKUWK.cjs.map → chunk-F4ZT5X2S.cjs.map} +1 -1
  39. package/dist/{chunk-YBPBK5KI.js → chunk-FKQJYMCO.js} +97 -23
  40. package/dist/chunk-FKQJYMCO.js.map +1 -0
  41. package/dist/{chunk-ZDFHA2EC.js → chunk-FVKCNAEQ.js} +51 -7
  42. package/dist/chunk-FVKCNAEQ.js.map +1 -0
  43. package/dist/{chunk-JSNV5O2F.cjs → chunk-GHBXS5RT.cjs} +4 -4
  44. package/dist/{chunk-JSNV5O2F.cjs.map → chunk-GHBXS5RT.cjs.map} +1 -1
  45. package/dist/{chunk-C57NEO3X.js → chunk-GKJRNIP4.js} +230 -16
  46. package/dist/chunk-GKJRNIP4.js.map +1 -0
  47. package/dist/{chunk-QNGNOU4Z.js → chunk-GRIMIJJ3.js} +3 -3
  48. package/dist/{chunk-QNGNOU4Z.js.map → chunk-GRIMIJJ3.js.map} +1 -1
  49. package/dist/{chunk-IEBZHTPE.js → chunk-GVHBHUFV.js} +34 -16
  50. package/dist/chunk-GVHBHUFV.js.map +1 -0
  51. package/dist/chunk-GZH2SIOF.cjs +99 -0
  52. package/dist/chunk-GZH2SIOF.cjs.map +1 -0
  53. package/dist/{chunk-YHRG7UOC.js → chunk-IJNQYMN7.js} +4 -4
  54. package/dist/{chunk-YHRG7UOC.js.map → chunk-IJNQYMN7.js.map} +1 -1
  55. package/dist/{chunk-JX5YZ4DH.cjs → chunk-IRUPCNW2.cjs} +49 -46
  56. package/dist/chunk-IRUPCNW2.cjs.map +1 -0
  57. package/dist/{chunk-JL4C5VJ7.cjs → chunk-J65CAOUV.cjs} +14 -2
  58. package/dist/chunk-J65CAOUV.cjs.map +1 -0
  59. package/dist/{chunk-ISJDAFKS.js → chunk-LJMNCSDG.js} +38 -15
  60. package/dist/chunk-LJMNCSDG.js.map +1 -0
  61. package/dist/{chunk-ZT77RY6R.js → chunk-MEN7VLQ5.js} +8 -5
  62. package/dist/chunk-MEN7VLQ5.js.map +1 -0
  63. package/dist/{chunk-VIWSWVAW.js → chunk-MUA5L25B.js} +125 -12
  64. package/dist/chunk-MUA5L25B.js.map +1 -0
  65. package/dist/{chunk-6IJOPRZP.cjs → chunk-NWXB4F6D.cjs} +21 -21
  66. package/dist/{chunk-6IJOPRZP.cjs.map → chunk-NWXB4F6D.cjs.map} +1 -1
  67. package/dist/{chunk-PQHS255G.js → chunk-OHSIVNJO.js} +3 -3
  68. package/dist/chunk-OHSIVNJO.js.map +1 -0
  69. package/dist/{chunk-LKAIXWK3.js → chunk-PVVO23LZ.js} +3 -3
  70. package/dist/{chunk-LKAIXWK3.js.map → chunk-PVVO23LZ.js.map} +1 -1
  71. package/dist/{chunk-XAMC4S53.js → chunk-Q4ZXDDWA.js} +3 -3
  72. package/dist/{chunk-XAMC4S53.js.map → chunk-Q4ZXDDWA.js.map} +1 -1
  73. package/dist/{chunk-EK362Q45.cjs → chunk-QIIG2QDP.cjs} +8 -8
  74. package/dist/{chunk-EK362Q45.cjs.map → chunk-QIIG2QDP.cjs.map} +1 -1
  75. package/dist/{chunk-Q4CDQ2KO.js → chunk-QXW6O56Z.js} +6 -6
  76. package/dist/chunk-QXW6O56Z.js.map +1 -0
  77. package/dist/{chunk-5PC6JBGJ.cjs → chunk-R2VF5NQG.cjs} +3 -3
  78. package/dist/chunk-R2VF5NQG.cjs.map +1 -0
  79. package/dist/{chunk-6DKDOWBL.js → chunk-RRI5YBUK.js} +6 -3
  80. package/dist/{chunk-QELDJGDK.cjs.map → chunk-RRI5YBUK.js.map} +1 -1
  81. package/dist/{chunk-RJL7RCEM.cjs → chunk-RUKFN3LJ.cjs} +6 -6
  82. package/dist/chunk-RUKFN3LJ.cjs.map +1 -0
  83. package/dist/chunk-TCBHVIMD.js +89 -0
  84. package/dist/chunk-TCBHVIMD.js.map +1 -0
  85. package/dist/{chunk-SES6GDBQ.cjs → chunk-UJJUX6NW.cjs} +59 -8
  86. package/dist/chunk-UJJUX6NW.cjs.map +1 -0
  87. package/dist/{chunk-ZRL2UFTH.cjs → chunk-V3N56Z2S.cjs} +101 -22
  88. package/dist/chunk-V3N56Z2S.cjs.map +1 -0
  89. package/dist/{chunk-Z4AZW6FY.js → chunk-W36WCZS2.js} +6 -6
  90. package/dist/{chunk-Z4AZW6FY.js.map → chunk-W36WCZS2.js.map} +1 -1
  91. package/dist/{chunk-M36G6SRP.js → chunk-WXNQMJ67.js} +14 -3
  92. package/dist/chunk-WXNQMJ67.js.map +1 -0
  93. package/dist/{chunk-O7PUQLJ3.cjs → chunk-XE5PE54B.cjs} +33 -40
  94. package/dist/chunk-XE5PE54B.cjs.map +1 -0
  95. package/dist/{chunk-LPW3XNC2.js → chunk-XJOBMAWW.js} +3 -3
  96. package/dist/{chunk-LPW3XNC2.js.map → chunk-XJOBMAWW.js.map} +1 -1
  97. package/dist/{chunk-5U7VLG43.js → chunk-XS7FI4JA.js} +3 -3
  98. package/dist/chunk-XS7FI4JA.js.map +1 -0
  99. package/dist/{chunk-O5MP52U2.cjs → chunk-YD3JA36S.cjs} +4 -4
  100. package/dist/{chunk-O5MP52U2.cjs.map → chunk-YD3JA36S.cjs.map} +1 -1
  101. package/dist/chunk-YYODFQEU.cjs +25 -0
  102. package/dist/chunk-YYODFQEU.cjs.map +1 -0
  103. package/dist/{chunk-RN3RMBJZ.js → chunk-ZXBSARZX.js} +4 -4
  104. package/dist/{chunk-RN3RMBJZ.js.map → chunk-ZXBSARZX.js.map} +1 -1
  105. package/dist/entries/apps.cjs +43 -42
  106. package/dist/entries/apps.d.cts +11 -2
  107. package/dist/entries/apps.d.ts +11 -2
  108. package/dist/entries/apps.js +8 -7
  109. package/dist/entries/catalogs.d.cts +1 -1
  110. package/dist/entries/catalogs.d.ts +1 -1
  111. package/dist/entries/credits.cjs +156 -152
  112. package/dist/entries/credits.d.cts +41 -10
  113. package/dist/entries/credits.d.ts +41 -10
  114. package/dist/entries/credits.js +8 -8
  115. package/dist/entries/edl.cjs +130 -102
  116. package/dist/entries/edl.d.cts +74 -3
  117. package/dist/entries/edl.d.ts +74 -3
  118. package/dist/entries/edl.js +2 -2
  119. package/dist/entries/entities.cjs +126 -122
  120. package/dist/entries/entities.d.cts +2 -2
  121. package/dist/entries/entities.d.ts +2 -2
  122. package/dist/entries/entities.js +1 -1
  123. package/dist/entries/i18n.cjs +11 -11
  124. package/dist/entries/i18n.d.cts +2 -2
  125. package/dist/entries/i18n.d.ts +2 -2
  126. package/dist/entries/i18n.js +1 -1
  127. package/dist/entries/llm-models.cjs +63 -43
  128. package/dist/entries/llm-models.d.cts +71 -4
  129. package/dist/entries/llm-models.d.ts +71 -4
  130. package/dist/entries/llm-models.js +1 -1
  131. package/dist/entries/media.cjs +45 -41
  132. package/dist/entries/media.d.cts +39 -1
  133. package/dist/entries/media.d.ts +39 -1
  134. package/dist/entries/media.js +1 -1
  135. package/dist/entries/model-catalog.cjs +75 -63
  136. package/dist/entries/model-catalog.d.cts +2 -2
  137. package/dist/entries/model-catalog.d.ts +2 -2
  138. package/dist/entries/model-catalog.js +4 -4
  139. package/dist/entries/models.cjs +274 -210
  140. package/dist/entries/models.d.cts +3 -3
  141. package/dist/entries/models.d.ts +3 -3
  142. package/dist/entries/models.js +5 -5
  143. package/dist/entries/nodes.cjs +222 -201
  144. package/dist/entries/nodes.d.cts +48 -8
  145. package/dist/entries/nodes.d.ts +48 -8
  146. package/dist/entries/nodes.js +10 -9
  147. package/dist/entries/pipeline.cjs +149 -149
  148. package/dist/entries/pipeline.d.cts +12 -8
  149. package/dist/entries/pipeline.d.ts +12 -8
  150. package/dist/entries/pipeline.js +3 -3
  151. package/dist/entries/social.cjs +174 -174
  152. package/dist/entries/social.d.cts +13 -5
  153. package/dist/entries/social.d.ts +13 -5
  154. package/dist/entries/social.js +2 -2
  155. package/dist/entries/types.d.cts +1 -1
  156. package/dist/entries/types.d.ts +1 -1
  157. package/dist/entries/ugc.cjs +71 -71
  158. package/dist/entries/ugc.js +4 -4
  159. package/dist/entries/video.cjs +115 -115
  160. package/dist/entries/video.d.cts +4 -3
  161. package/dist/entries/video.d.ts +4 -3
  162. package/dist/entries/video.js +4 -4
  163. package/dist/entries/workflow.cjs +96 -95
  164. package/dist/entries/workflow.d.cts +19 -20
  165. package/dist/entries/workflow.d.ts +19 -20
  166. package/dist/entries/workflow.js +2 -1
  167. package/dist/index.cjs +1720 -1563
  168. package/dist/index.d.cts +10 -10
  169. package/dist/index.d.ts +10 -10
  170. package/dist/index.js +26 -25
  171. package/dist/{model-catalog-flJYaa-g.d.ts → model-catalog-VIHGmQL2.d.cts} +113 -1
  172. package/dist/{model-catalog-flJYaa-g.d.cts → model-catalog-VIHGmQL2.d.ts} +113 -1
  173. package/dist/{presentation-utils-BIqiCzSA.d.cts → presentation-utils-A4i92SYo.d.cts} +3 -1
  174. package/dist/{presentation-utils-BdiObtwq.d.ts → presentation-utils-DjdPtM9k.d.ts} +3 -1
  175. package/dist/{scene-node-types-DjenYFLO.d.ts → scene-node-types-Cvbtf-0a.d.cts} +147 -6
  176. package/dist/{scene-node-types-DjenYFLO.d.cts → scene-node-types-Cvbtf-0a.d.ts} +147 -6
  177. package/dist/{types-DffyGSy5.d.ts → types-CU6SQnMS.d.cts} +0 -5
  178. package/dist/{types-DffyGSy5.d.cts → types-CU6SQnMS.d.ts} +0 -5
  179. package/dist/{types-BRlFPEru.d.cts → types-DzUBR7yr.d.cts} +8 -1
  180. package/dist/{types-BRlFPEru.d.ts → types-DzUBR7yr.d.ts} +8 -1
  181. package/package.json +1 -1
  182. package/src/__tests__/camera-switch-contract.test.ts +33 -1
  183. package/src/__tests__/character-mention-slug.test.ts +0 -8
  184. package/src/__tests__/effective-tier.test.ts +3 -14
  185. package/src/__tests__/fixtures/camera-switch-speaker-map-parity.json +178 -0
  186. package/src/__tests__/fixtures/root-exports.baseline.json +21 -0
  187. package/src/__tests__/fixtures/speaker-map-camera-ids.json +26 -0
  188. package/src/__tests__/gvp-supported-providers.test.ts +1 -0
  189. package/src/__tests__/i18n-locale-completeness.test.ts +38 -3
  190. package/src/__tests__/llm-models.test.ts +200 -20
  191. package/src/__tests__/model-makers.test.ts +76 -0
  192. package/src/__tests__/node-preset-extract.test.ts +10 -0
  193. package/src/__tests__/presentation-utils.test.ts +15 -0
  194. package/src/__tests__/preview-gate-use-case.test.ts +16 -1
  195. package/src/__tests__/private-host.test.ts +53 -0
  196. package/src/__tests__/producer-types.test.ts +19 -0
  197. package/src/__tests__/run-continuation.test.ts +4 -1
  198. package/src/__tests__/speaker-map-contract.test.ts +48 -0
  199. package/src/__tests__/unit-contract-compose.test.ts +129 -0
  200. package/src/__tests__/unit-contracts.test.ts +134 -0
  201. package/src/__tests__/use-case-types.test.ts +33 -0
  202. package/src/__tests__/video-collapse-parity.test.ts +10 -0
  203. package/src/__tests__/video-frame-slot.test.ts +85 -0
  204. package/src/__tests__/video-mode-aliases.test.ts +1 -0
  205. package/src/__tests__/video-reference-only.test.ts +117 -0
  206. package/src/__tests__/vidu-q4-catalog.test.ts +230 -0
  207. package/src/camera-switch-contract.ts +36 -2
  208. package/src/component-types.ts +9 -0
  209. package/src/credit-identifiers.ts +81 -23
  210. package/src/entity-asset-types.ts +13 -0
  211. package/src/entries/credits.ts +1 -0
  212. package/src/entries/edl.ts +2 -0
  213. package/src/entries/llm-models.ts +5 -0
  214. package/src/entries/media.ts +1 -0
  215. package/src/entries/model-catalog.ts +6 -0
  216. package/src/entries/models.ts +25 -0
  217. package/src/entries/nodes.ts +5 -1
  218. package/src/fan-out-rows.ts +36 -3
  219. package/src/generate-mask.ts +40 -0
  220. package/src/generated/unit-contracts.ts +58 -0
  221. package/src/i18n/types.ts +13 -2
  222. package/src/json-kinds.ts +24 -4
  223. package/src/llm-models.ts +184 -31
  224. package/src/meta-ads-scrape.ts +16 -8
  225. package/src/model-catalog.ts +285 -13
  226. package/src/model-constants.ts +260 -5
  227. package/src/node-default-mappings.ts +3 -0
  228. package/src/node-preset-extract.ts +8 -0
  229. package/src/pipeline-types.ts +3 -0
  230. package/src/presentation-utils.ts +19 -12
  231. package/src/preview-gate.ts +4 -2
  232. package/src/private-host.ts +89 -59
  233. package/src/producer-types.ts +19 -19
  234. package/src/run-continuation.ts +26 -4
  235. package/src/speaker-layouts.ts +8 -3
  236. package/src/speaker-map-contract.ts +77 -0
  237. package/src/unit-contract-compose.ts +55 -0
  238. package/src/use-case-types.ts +19 -0
  239. package/src/video-ui-defaults.ts +7 -5
  240. package/dist/chunk-3CUFITU7.js.map +0 -1
  241. package/dist/chunk-5AUSSJIM.cjs.map +0 -1
  242. package/dist/chunk-5PC6JBGJ.cjs.map +0 -1
  243. package/dist/chunk-5U7VLG43.js.map +0 -1
  244. package/dist/chunk-6DKDOWBL.js.map +0 -1
  245. package/dist/chunk-AROWPFO2.js.map +0 -1
  246. package/dist/chunk-AVQK77G6.cjs.map +0 -1
  247. package/dist/chunk-C57NEO3X.js.map +0 -1
  248. package/dist/chunk-CK3GK34R.js.map +0 -1
  249. package/dist/chunk-E2TGXG6X.cjs.map +0 -1
  250. package/dist/chunk-HGC5JNVA.cjs.map +0 -1
  251. package/dist/chunk-IEBZHTPE.js.map +0 -1
  252. package/dist/chunk-ISJDAFKS.js.map +0 -1
  253. package/dist/chunk-J6KHW2E5.cjs.map +0 -1
  254. package/dist/chunk-JL4C5VJ7.cjs.map +0 -1
  255. package/dist/chunk-JX5YZ4DH.cjs.map +0 -1
  256. package/dist/chunk-M36G6SRP.js.map +0 -1
  257. package/dist/chunk-NT6IJH4L.cjs.map +0 -1
  258. package/dist/chunk-O7PUQLJ3.cjs.map +0 -1
  259. package/dist/chunk-PQHS255G.js.map +0 -1
  260. package/dist/chunk-PRYE7AZQ.cjs.map +0 -1
  261. package/dist/chunk-Q4CDQ2KO.js.map +0 -1
  262. package/dist/chunk-RJL7RCEM.cjs.map +0 -1
  263. package/dist/chunk-SES6GDBQ.cjs.map +0 -1
  264. package/dist/chunk-VIWSWVAW.js.map +0 -1
  265. package/dist/chunk-WDIBOWAA.js.map +0 -1
  266. package/dist/chunk-WNG7HRVA.cjs +0 -25
  267. package/dist/chunk-WNG7HRVA.cjs.map +0 -1
  268. package/dist/chunk-YBPBK5KI.js.map +0 -1
  269. package/dist/chunk-YYV35XOS.js.map +0 -1
  270. package/dist/chunk-Z2OL5AJD.cjs.map +0 -1
  271. package/dist/chunk-ZDFHA2EC.js.map +0 -1
  272. package/dist/chunk-ZRL2UFTH.cjs.map +0 -1
  273. package/dist/chunk-ZT77RY6R.js.map +0 -1
  274. package/src/__tests__/__snapshots__/prompt-builder-segments.test.ts.snap +0 -65
@@ -53,6 +53,28 @@ export const IMAGE_ASPECT_RATIO_VALUES = [
53
53
  /** A ratio string the image routes accept (pre-snap vocabulary, not a per-model guarantee). */
54
54
  export type ImageAspectRatio = typeof IMAGE_ASPECT_RATIO_VALUES[number]
55
55
 
56
+ /**
57
+ * The `resolution` vocabulary `/v1/generate-image` and `/v1/image-to-image`
58
+ * accept: the K tiers (`1K`/`2K`/`4K`) and the Flux 2 megapixel tiers. Like
59
+ * {@link IMAGE_ASPECT_RATIO_VALUES} it is a vocabulary bound, not a per-model
60
+ * gate — the catalog snap corrects a value the chosen model does not declare.
61
+ * One tuple for the route Zod enums and the SDK's `ImageResolution`.
62
+ */
63
+ export const IMAGE_RESOLUTION_VALUES = ["1K", "2K", "4K", "0.5 MP", "1 MP", "2 MP", "4 MP"] as const
64
+ export type ImageResolution = typeof IMAGE_RESOLUTION_VALUES[number]
65
+
66
+ /** The `quality` vocabulary of the same two routes (vocabulary bound; the catalog snap gates per model). */
67
+ export const IMAGE_QUALITY_VALUES = ["medium", "high", "basic"] as const
68
+ export type ImageQuality = typeof IMAGE_QUALITY_VALUES[number]
69
+
70
+ /** The `renderingSpeed` vocabulary (Ideogram's speed tiers — see {@link RENDERING_SPEED_SUPPORT}). */
71
+ export const IMAGE_RENDERING_SPEED_VALUES = ["TURBO", "BALANCED", "QUALITY"] as const
72
+ export type ImageRenderingSpeed = typeof IMAGE_RENDERING_SPEED_VALUES[number]
73
+
74
+ /** `/v1/edit-image`'s `targetResolution` (the upscalers' output tier; topaz maps it to a factor). */
75
+ export const IMAGE_EDIT_TARGET_RESOLUTION_VALUES = ["2K", "4K", "8K"] as const
76
+ export type ImageEditTargetResolution = typeof IMAGE_EDIT_TARGET_RESOLUTION_VALUES[number]
77
+
56
78
  /**
57
79
  * Per-provider maximum ASSEMBLED image-prompt length (chars), VERIFIED against
58
80
  * each model's official docs.kie.ai schema (2026-06). Providers absent here use
@@ -222,6 +244,9 @@ export const MAX_VIDEO_PROMPT_CHARS_BY_PROVIDER: Record<string, number> = {
222
244
  // (docs.kie.ai/market/wan/3-0-video and /3-0-video-prime).
223
245
  "wan-3": 20000,
224
246
  "wan-3-prime": 20000,
247
+ // Vidu Q4 — 20000 chars on both endpoints
248
+ // (docs.kie.ai/market/vidu-q4/image-to-video and /reference-to-video).
249
+ "vidu-q4": 20000,
225
250
  "bytedance-lite": 10000,
226
251
  "bytedance-pro": 10000,
227
252
  "bytedance-pro-fast": 10000,
@@ -816,12 +841,17 @@ export const IMAGE_EDIT_PROVIDERS = [
816
841
  * (`imageParam: "task_id"`) places it in the request body. Membership here
817
842
  * must match the KIE configs with `imageParam: "task_id"` — guarded by
818
843
  * backend/src/routes/__tests__/edit-image.test.ts.
844
+ *
845
+ * The ids as a tuple ({@link TaskChainedEditProvider} is its type); the Set is
846
+ * built from it, so the two cannot disagree.
819
847
  */
820
- export const TASK_CHAINED_EDIT_PROVIDERS: ReadonlySet<string> = new Set([
848
+ export const TASK_CHAINED_EDIT_PROVIDER_IDS = [
821
849
  "grok-upscale",
822
850
  "grok-2-edit",
823
851
  "grok-2-segment",
824
- ])
852
+ ] as const satisfies readonly (typeof IMAGE_EDIT_PROVIDERS)[number][]
853
+ export type TaskChainedEditProvider = typeof TASK_CHAINED_EDIT_PROVIDER_IDS[number]
854
+ export const TASK_CHAINED_EDIT_PROVIDERS: ReadonlySet<string> = new Set(TASK_CHAINED_EDIT_PROVIDER_IDS)
825
855
 
826
856
  /** Modify image providers (I2I + edit-with-prompt) */
827
857
  export const MODIFY_IMAGE_PROVIDERS = [
@@ -878,6 +908,10 @@ export const IMAGE_TO_VIDEO_PROVIDERS = [
878
908
  // so each id is listed in this array AND in TEXT_TO_VIDEO_PROVIDERS.
879
909
  "wan-3",
880
910
  "wan-3-prime",
911
+ // Vidu Q4 — one id over KIE's image-to-video and reference-to-video
912
+ // endpoints. No text-to-video mode: also listed in TEXT_TO_VIDEO_PROVIDERS's
913
+ // image-required section so the t2v route answers with the friendly 400.
914
+ "vidu-q4",
881
915
  "ltx-2.3-pro",
882
916
  "ltx-2.3-fast",
883
917
  // xAI Grok Imagine Video 1.5 — KIE i2v (image_urls required). Also listed in
@@ -939,6 +973,7 @@ export const TEXT_TO_VIDEO_PROVIDERS = [
939
973
  "hailuo-2.3-pro",
940
974
  "bytedance-pro-fast",
941
975
  "happyhorse-ref2v",
976
+ "vidu-q4",
942
977
  // Replicate disabled
943
978
  // "runway",
944
979
  // "pika",
@@ -1024,8 +1059,16 @@ export function resolveVideoProviderForMode(
1024
1059
  * `grok` → silently dropped (#861). When refs are present and ONLY the i2v
1025
1060
  * twin can carry them, the run is image-to-video with the refs as its images.
1026
1061
  * Derived from VIDEO_REF_LIMITS_BY_PROVIDER (= the catalog's `reference-image`
1027
- * feature), never from a provider name; single-id models are untouched
1028
- * because both twins are the same id.
1062
+ * feature), never from a provider name.
1063
+ *
1064
+ * A SINGLE-id model with no text-to-video mode is the other nuance: its t2v
1065
+ * lane is image-gated (VIDEO_PROVIDERS_REQUIRING_IMAGE), so a references-only
1066
+ * run sent there was refused even when the provider runs happily from
1067
+ * references alone (Vidu Q4, HappyHorse Ref2V). When the catalog declares the
1068
+ * `reference-to-video` capability ({@link videoProviderRunsFromReferences}),
1069
+ * such a run takes the image-to-video lane with the refs as its images —
1070
+ * exactly what `/v1/generate-video` already did for the direct API. A single-id
1071
+ * model WITH a text-to-video mode keeps the t2v lane, which carries its refs.
1029
1072
  */
1030
1073
  export function resolveVideoModeForInputs(
1031
1074
  provider: string | undefined,
@@ -1035,11 +1078,85 @@ export function resolveVideoModeForInputs(
1035
1078
  if (!provider || !inputs.hasImageRefs) return "text-to-video"
1036
1079
  const i2v = resolveVideoProviderForMode(provider, "image-to-video")
1037
1080
  const t2v = resolveVideoProviderForMode(provider, "text-to-video")
1038
- if (i2v === t2v) return "text-to-video"
1081
+ if (i2v === t2v) {
1082
+ const entry = MODEL_CATALOG[i2v]
1083
+ const noTextMode = !!entry && !(entry.modes as readonly string[]).includes("t2v")
1084
+ return noTextMode && videoProviderRunsFromReferences(i2v) ? "image-to-video" : "text-to-video"
1085
+ }
1039
1086
  const carriesImageRefs = (id: string) => (VIDEO_REF_LIMITS_BY_PROVIDER[id]?.images ?? 0) > 0
1040
1087
  return carriesImageRefs(i2v) && !carriesImageRefs(t2v) ? "image-to-video" : "text-to-video"
1041
1088
  }
1042
1089
 
1090
+ /** The prompt syntax a video provider addresses its images in, by array order. */
1091
+ export type VideoReferenceSyntax = "@image_N" | "@image(n)" | "[Image N]"
1092
+
1093
+ /**
1094
+ * The syntax this video model's frame / identity binding sentences are written
1095
+ * in — the catalog's `referenceSyntax`, else the platform's `@image_N`. One
1096
+ * descriptor for the app's resolvers and for a client (the cloud plugins) that
1097
+ * cites references by ordinal.
1098
+ */
1099
+ export function videoProviderReferenceSyntax(provider: string | undefined): VideoReferenceSyntax {
1100
+ return (provider ? MODEL_CATALOG[provider]?.referenceSyntax : undefined) ?? "@image_N"
1101
+ }
1102
+
1103
+ /**
1104
+ * Reference-capable video models whose start/end frames ride a channel of
1105
+ * their OWN (separate frame parameters next to the reference list), so a frame
1106
+ * never occupies a reference seat. `kling-3-omni` (Replicate `start_image` /
1107
+ * `end_image`) is the only one — and it has no dispatch path today.
1108
+ */
1109
+ export const VIDEO_PROVIDERS_WITH_SEPARATE_FRAME_CHANNEL: ReadonlySet<string> = new Set([
1110
+ "kling-3-omni",
1111
+ ])
1112
+
1113
+ /**
1114
+ * True when this video model puts a start (and end) frame AFTER the caller's
1115
+ * own reference images in ONE shared image list, bound in the prompt as the
1116
+ * opening / closing frame in its own syntax — the platform convention, so the
1117
+ * caller's image token N always means their Nth reference. At the image cap
1118
+ * the frames are kept and trailing caller references are dropped.
1119
+ *
1120
+ * Every reference-capable video model, except one whose frames ride a separate
1121
+ * channel ({@link VIDEO_PROVIDERS_WITH_SEPARATE_FRAME_CHANNEL}).
1122
+ */
1123
+ export function videoProviderAppendsFrames(provider: string | undefined): boolean {
1124
+ if (!provider) return false
1125
+ const entry = MODEL_CATALOG[provider]
1126
+ return !!entry && entry.kind === "video" &&
1127
+ entry.features?.includes("reference-image") === true &&
1128
+ !VIDEO_PROVIDERS_WITH_SEPARATE_FRAME_CHANNEL.has(provider)
1129
+ }
1130
+
1131
+ /**
1132
+ * How many of a reference run's image seats the wired frames take on this
1133
+ * model: the start frame, plus the end frame where the model takes one (the
1134
+ * catalog `end-frame` feature). 0 on a model whose frames do not share its
1135
+ * reference list. A caller budgeting its own references subtracts this from
1136
+ * the provider's image cap so no reference of its is dropped.
1137
+ */
1138
+ export function videoProviderRefModeFrameSeats(
1139
+ provider: string | undefined,
1140
+ frames: { readonly hasStartFrame: boolean; readonly hasEndFrame: boolean },
1141
+ ): number {
1142
+ if (!provider) return 0
1143
+ if (!videoProviderAppendsFrames(provider)) return 0
1144
+ const start = frames.hasStartFrame ? 1 : 0
1145
+ const end = frames.hasEndFrame && MODEL_CATALOG[provider]?.features?.includes("end-frame") === true ? 1 : 0
1146
+ return start + end
1147
+ }
1148
+
1149
+ /**
1150
+ * True when the model's provider endpoint runs from reference images ALONE —
1151
+ * no start frame (the catalog's `reference-to-video` feature, declared only on
1152
+ * provider-spec evidence). The single capability every surface reads to decide
1153
+ * whether wired references satisfy "needs an image": the mode resolver above,
1154
+ * and through it the editor gate, the browser DAG and the orchestrator.
1155
+ */
1156
+ export function videoProviderRunsFromReferences(provider: string | undefined): boolean {
1157
+ return !!provider && MODEL_CATALOG[provider]?.features?.includes("reference-to-video") === true
1158
+ }
1159
+
1043
1160
  /**
1044
1161
  * t2v twin ids hidden from the unified Generate Video picker — the i2v/base
1045
1162
  * entry already represents both modes (execution remaps by image presence).
@@ -1631,6 +1748,9 @@ export const DURATION_PRICED_PROVIDERS = new Set([
1631
1748
  // this gate is consulted.
1632
1749
  "wan-3",
1633
1750
  "wan-3-prime",
1751
+ // Vidu Q4 — per-second billing at five resolution rates, identical on both
1752
+ // endpoints and with audio on or off.
1753
+ "vidu-q4",
1634
1754
  ])
1635
1755
 
1636
1756
  /**
@@ -1736,6 +1856,45 @@ export function normalizeWan3Resolution(resolution: string | undefined): "480P"
1736
1856
  }
1737
1857
  }
1738
1858
 
1859
+ /**
1860
+ * Vidu Q4 family — the KIE "vidu-q4" market model. One Nodaro id covers two KIE
1861
+ * endpoints (image-to-video / reference-to-video); the provider layer picks the
1862
+ * endpoint by which inputs are wired. Exact-membership set, like the other
1863
+ * family predicates.
1864
+ */
1865
+ export const VIDU_Q4_PROVIDERS = new Set<string>([
1866
+ "vidu-q4",
1867
+ ])
1868
+
1869
+ export function isViduQ4Provider(provider: string | undefined): boolean {
1870
+ return !!provider && VIDU_Q4_PROVIDERS.has(provider)
1871
+ }
1872
+
1873
+ /** Vidu Q4 resolution the platform renders when the param is omitted or
1874
+ * unknown — the tier the bare credit identifier prices (also KIE's own
1875
+ * default). Never `resolutions[0]`, which is the cheaper 540p. */
1876
+ export const VIDU_Q4_DEFAULT_RESOLUTION = "720p"
1877
+
1878
+ /**
1879
+ * SINGLE normalization for the Vidu Q4 resolution lever. The KIE wire enum is
1880
+ * LOWERCASE ("540p" | "720p" | "1080p" | "2k" | "4k") — the same spelling as
1881
+ * the catalog and every credit identifier — so this only folds case and
1882
+ * collapses anything else (undefined, garbage, a stale "480p") to
1883
+ * {@link VIDU_Q4_DEFAULT_RESOLUTION}. The provider layer sends what this
1884
+ * returns and the credit identifier bills what this returns, so the two can
1885
+ * never disagree.
1886
+ */
1887
+ export function normalizeViduQ4Resolution(resolution: string | undefined): "540p" | "720p" | "1080p" | "2k" | "4k" {
1888
+ switch (resolution?.trim().toLowerCase()) {
1889
+ case "540p": return "540p"
1890
+ case "1080p": return "1080p"
1891
+ case "2k": return "2k"
1892
+ case "4k": return "4k"
1893
+ case "720p": return "720p"
1894
+ default: return VIDU_Q4_DEFAULT_RESOLUTION
1895
+ }
1896
+ }
1897
+
1739
1898
  /**
1740
1899
  * Google Gemini Omni family — the KIE "gemini-omni-video" market model and its
1741
1900
  * faster/cheaper "google/gemini-omni-flash-1-1" sibling. Both take the SAME
@@ -2148,6 +2307,70 @@ export function findSeedance2AudioOverLimit(
2148
2307
  return null
2149
2308
  }
2150
2309
 
2310
+ /** A provider's documented contract for each REFERENCE AUDIO clip. */
2311
+ export interface RefAudioRule {
2312
+ /** Accepted containers, as ffprobe's `format_name` spells them ("mp3"). */
2313
+ formats?: readonly string[]
2314
+ minSec?: number
2315
+ maxSec?: number
2316
+ }
2317
+
2318
+ /**
2319
+ * Reference-audio rules that apply on EVERY lane — the video routes' preHandler
2320
+ * and the DAG's `executeWorkerNode` both run `checkRefAudioRules` before any
2321
+ * reservation, so a clip the provider would refuse never costs a run.
2322
+ *
2323
+ * Data-driven like VIDEO_REF_VIDEO_DURATION_LIMITS: only providers with a
2324
+ * DOCUMENTED rule are listed. (The older max-only
2325
+ * SEEDANCE_2_R2V_MAX_AUDIO_SEC_BY_PROVIDER above is checked by the routes
2326
+ * alone.)
2327
+ *
2328
+ * Vidu Q4: "MP3 only, each 3-12 seconds and up to 50 MB"
2329
+ * (docs.kie.ai/market/vidu-q4/reference-to-video). Nothing converts a clip for
2330
+ * it, so a WAV / M4A from the audio tray is refused with a clear message rather
2331
+ * than failing at the provider.
2332
+ */
2333
+ export const VIDEO_REF_AUDIO_RULES: Record<string, RefAudioRule | undefined> = {
2334
+ "vidu-q4": { formats: ["mp3"], minSec: 3, maxSec: 12 },
2335
+ }
2336
+
2337
+ /** One probed reference-audio clip. A field the probe could not read is absent. */
2338
+ export interface RefAudioProbe {
2339
+ /** ffprobe `format_name`, split on commas ("mp3", "wav", "mov,mp4,m4a,…"). */
2340
+ formatNames?: readonly string[]
2341
+ durationSec?: number
2342
+ }
2343
+
2344
+ export type RefAudioCheck =
2345
+ | { ok: true }
2346
+ | { ok: false; code: "audio_format_unsupported" | "audio_too_short" | "audio_too_long"; message: string }
2347
+
2348
+ /**
2349
+ * Check probed reference-audio clips against {@link VIDEO_REF_AUDIO_RULES}.
2350
+ * An unreadable field is IGNORED, never rejected — a probe blip must not block
2351
+ * a legal run (the provider still has the final say).
2352
+ */
2353
+ export function checkRefAudioRules(provider: string | undefined, probes: readonly RefAudioProbe[]): RefAudioCheck {
2354
+ const rule = provider ? VIDEO_REF_AUDIO_RULES[provider] : undefined
2355
+ if (!rule) return { ok: true }
2356
+ for (const [i, p] of probes.entries()) {
2357
+ const n = i + 1
2358
+ if (rule.formats && p.formatNames && p.formatNames.length > 0 && !p.formatNames.some((f) => rule.formats!.includes(f))) {
2359
+ const want = rule.formats.map((f) => f.toUpperCase()).join(" or ")
2360
+ return { ok: false, code: "audio_format_unsupported", message: `Reference audio ${n} must be ${want} for this model. Convert the clip to ${want} and try again.` }
2361
+ }
2362
+ const d = p.durationSec
2363
+ if (d === undefined || !Number.isFinite(d) || d <= 0) continue
2364
+ if (rule.minSec !== undefined && d < rule.minSec) {
2365
+ return { ok: false, code: "audio_too_short", message: `Reference audio ${n} is too short for this model: ${d.toFixed(1)}s is under the ${rule.minSec}s minimum.` }
2366
+ }
2367
+ if (rule.maxSec !== undefined && d > rule.maxSec) {
2368
+ return { ok: false, code: "audio_too_long", message: `Reference audio ${n} is too long for this model: ${d.toFixed(1)}s exceeds the ${rule.maxSec}s limit. Please use a shorter audio clip.` }
2369
+ }
2370
+ }
2371
+ return { ok: true }
2372
+ }
2373
+
2151
2374
  /**
2152
2375
  * Per-provider connection caps for the typed reference handles on Generate Video
2153
2376
  * AND the cap for the server-side `connectedReferences` assembly (`imageCap`).
@@ -2182,6 +2405,10 @@ export const VIDEO_REF_LIMITS_BY_PROVIDER: Record<
2182
2405
  // provider (docs.kie.ai/market/wan/3-0-video).
2183
2406
  "wan-3": { images: 10, videos: 5, audio: 5 },
2184
2407
  "wan-3-prime": { images: 10, videos: 5, audio: 5 },
2408
+ // Vidu Q4 — reference-to-video takes 1-15 reference images and up to 3
2409
+ // reference audio clips (MP3 only, each 3-12s — VIDEO_REF_AUDIO_RULES), and
2410
+ // no reference videos (docs.kie.ai/market/vidu-q4/reference-to-video).
2411
+ "vidu-q4": { images: 15, audio: 3 },
2185
2412
  // Multi-image reference providers.
2186
2413
  // `characters` = the dedicated identity input (KIE `character_ids`, max 3).
2187
2414
  // It is NOT an image-reference lane: it draws from the SAME 7-unit budget as
@@ -2336,6 +2563,11 @@ export const RESOLUTION_DURATION_PRICING: Record<string, readonly string[]> = {
2336
2563
  // the provider layer pins the same 720P so render == billed.
2337
2564
  "wan-3": ["480p", "720p", "1080p"],
2338
2565
  "wan-3-prime": ["480p", "720p", "1080p"],
2566
+ // Vidu Q4 — per-second billing at five resolution rates, one ladder for both
2567
+ // endpoints. Ascending; the billed default (720p) is declared in
2568
+ // PRICING_DEFAULT_RESOLUTION, and normalizeViduQ4Resolution pins the same
2569
+ // 720p at the wire.
2570
+ "vidu-q4": ["540p", "720p", "1080p", "2k", "4k"],
2339
2571
  }
2340
2572
 
2341
2573
  /**
@@ -2558,6 +2790,12 @@ export const VIDEO_AUDIO_CAPABILITY: Record<string, VideoAudioCapability> = {
2558
2790
  // per-second rate, so NOT cost-affecting (no `:audio` composite).
2559
2791
  "wan-3": { mode: "ambient", field: "audio", defaultOn: true },
2560
2792
  "wan-3-prime": { mode: "ambient", field: "audio", defaultOn: true },
2793
+ // Vidu Q4 — the same boolean `audio` lever (KIE default true). The schema
2794
+ // says "dialogue and sound effects", but classified "ambient" on the Wan 3.0
2795
+ // rule: no live probe has verified lip-synced speech, and `native_speech` /
2796
+ // `audio_driven` would reroute the Story→Video dialogue pipeline. Audio is
2797
+ // priced into the uniform per-second rate (no `:audio` composite).
2798
+ "vidu-q4": { mode: "ambient", field: "audio", defaultOn: true },
2561
2799
  // Gemini Omni (both SKUs — the pro `gemini-omni-video` and the faster
2562
2800
  // `gemini-omni-flash`; one model at two speeds, so their rows are identical
2563
2801
  // and a test pins that). Settled 2026-09-03 from Google's own documentation
@@ -2723,6 +2961,9 @@ export const VIDEO_VARIABLE_PRICING: Record<string, "duration" | "duration+audio
2723
2961
  // entry, mirroring gemini-omni-video which has none either.
2724
2962
  "wan-3": "duration+resolution",
2725
2963
  "wan-3-prime": "duration+resolution",
2964
+ // Vidu Q4 — per-second billing at five resolution rates; no reference or
2965
+ // audio dimension.
2966
+ "vidu-q4": "duration+resolution",
2726
2967
  }
2727
2968
 
2728
2969
  /**
@@ -2835,6 +3076,9 @@ export const PRICING_DEFAULT_RESOLUTION: Record<string, string> = {
2835
3076
  // first tier, so the catalog can stay ascending without repricing anything.
2836
3077
  "wan-3": "720p",
2837
3078
  "wan-3-prime": "720p",
3079
+ // Vidu Q4 — KIE renders 720p when `resolution` is omitted, and
3080
+ // normalizeViduQ4Resolution pins the same tier for anything unknown.
3081
+ "vidu-q4": "720p",
2838
3082
  }
2839
3083
 
2840
3084
  /** HappyHorse 1.1 per-second tiers — one per allowed duration (3–15s), shared
@@ -2874,6 +3118,16 @@ const WAN_3_DURATION_TIERS: Array<{ maxSeconds: number; suffix: string }> = Arra
2874
3118
  (_, i) => ({ maxSeconds: i + 2, suffix: `${i + 2}s` }),
2875
3119
  )
2876
3120
 
3121
+ /**
3122
+ * Vidu Q4 per-second tiers — one per allowed duration (3-16s). Per-second for
3123
+ * the same reason as Wan 3.0: a coarse ladder would snap a long render down to
3124
+ * a shorter tier's price, which `commit_credits` can never collect afterwards.
3125
+ */
3126
+ const VIDU_Q4_DURATION_TIERS: Array<{ maxSeconds: number; suffix: string }> = Array.from(
3127
+ { length: 14 },
3128
+ (_, i) => ({ maxSeconds: i + 3, suffix: `${i + 3}s` }),
3129
+ )
3130
+
2877
3131
  /**
2878
3132
  * Duration tier breakpoints for variable-priced video models.
2879
3133
  * Maps provider → array of { maxSeconds, suffix } in ascending order.
@@ -2956,6 +3210,7 @@ export const VIDEO_DURATION_TIERS: Record<string, Array<{ maxSeconds: number; su
2956
3210
  "seedance-2-5": SEEDANCE_2_5_DURATION_TIERS,
2957
3211
  "wan-3": WAN_3_DURATION_TIERS,
2958
3212
  "wan-3-prime": WAN_3_DURATION_TIERS,
3213
+ "vidu-q4": VIDU_Q4_DURATION_TIERS,
2959
3214
  // MiniMax Hailuo 3 — true per-second billing (KIE 36.5 cr/s @2K, 22.5 cr/s
2960
3215
  // @768P). One tier per allowed second (4-15s) so the composite identifier
2961
3216
  // maps 1:1 to the seeded price — no rounding/overcharge for any on-menu
@@ -199,6 +199,9 @@ const QUALITY_MAP: Record<string, QualityMapping> = {
199
199
  // uppercase KIE wire form is produced only by normalizeWan3Resolution).
200
200
  "wan-3": { field: "resolution", values: { low: "480p", mid: "720p", high: "1080p" } },
201
201
  "wan-3-prime": { field: "resolution", values: { low: "480p", mid: "720p", high: "1080p" } },
202
+ // Vidu Q4 — five tiers; the quality rungs stop at 1080p so "high" never
203
+ // lands on the 2k/4k ladder (4k is closed to the free tier).
204
+ "vidu-q4": { field: "resolution", values: { low: "540p", mid: "720p", high: "1080p" } },
202
205
  "wan-2.7-i2v": { field: "resolution", values: { low: "720p", mid: "1080p", high: "1080p" } },
203
206
  "wan-2.7-t2v": { field: "resolution", values: { low: "720p", mid: "1080p", high: "1080p" } },
204
207
  "happyhorse": { field: "resolution", values: { low: "720p", mid: "1080p", high: "1080p" } },
@@ -134,6 +134,12 @@ export function presetLeverClearKeys(
134
134
  * - `__promptFinalView`: field keys currently showing the final-prompt view (Edit ⇄ Final
135
135
  * per-field toggle). Node-local UI state, never part of a preset's own config.
136
136
  *
137
+ * Editor-only memory:
138
+ * - `settingsBeforeAudio`: the picture settings an audio recording turned off on a use-case node
139
+ * (Tighten Episode, Clip Pack), kept to give back when a video is wired again. It belongs to
140
+ * THIS node's wiring, never a reusable configuration — a preset applied elsewhere would hand
141
+ * another node values to restore on its next video wire.
142
+ *
137
143
  * NOTE: manual reference image urls (`referenceImageUrl` / `referenceImageUrls`) are deliberately
138
144
  * KEPT — they are self-contained R2 urls a user set as input, and portable across nodes.
139
145
  *
@@ -157,6 +163,8 @@ export const PRESET_EXCLUDED_KEYS: ReadonlySet<string> = new Set([
157
163
  "suppressedCanonicalLocationIds",
158
164
  "identityMeta",
159
165
  "extraRefs",
166
+ // editor-only memory of the node's own wiring (an audio recording's lock)
167
+ "settingsBeforeAudio",
160
168
  // structural identifiers
161
169
  "routes",
162
170
  "routeId",
@@ -96,6 +96,9 @@ export type PipelinePinnableVideoModel = (typeof PIPELINE_PINNABLE_VIDEO_MODELS)
96
96
  // through `lib/llm-client.ts` first; until then, keep this list tight.
97
97
  export const PIPELINE_PINNABLE_SCRIPT_LLMS = [
98
98
  "claude-haiku-5-5",
99
+ // The pipeline's own default (Auto) since 2026-10-16; callLLM asks it with
100
+ // tool_choice auto, as it refuses a forced tool choice.
101
+ "claude-sonnet-5-5",
99
102
  "claude-sonnet-4-6",
100
103
  "claude-opus-4-7",
101
104
  "claude-opus-5",
@@ -9,6 +9,7 @@ import { AUDIO_PRODUCER_TYPES, VIDEO_PRODUCER_TYPES } from "./producer-types.js"
9
9
  import { canonicalizeOverrideKeys } from "./exposed-field-keys.js"
10
10
  import { RENDER_NODE_TYPE_IDS } from "./render-nodes.js"
11
11
  import { dropStaleVideoLinkFields } from "./video-link.js"
12
+ import { composeUnitSet, unitsPresenting } from "./unit-contract-compose.js"
12
13
 
13
14
  // ---------------------------------------------------------------------------
14
15
  // Node type sets
@@ -130,18 +131,20 @@ const MEDIA_PRODUCING_TYPES = new Set([
130
131
  "video-depth",
131
132
  ])
132
133
 
133
- // Output type categorizations
134
- const IMAGE_OUTPUT_TYPES = new Set([
134
+ // Output type categorizations — each the hand-written list ∪ the node units
135
+ // that declare the same presentation (contract.presents, generated rows); a
136
+ // type in both throws at load (composeUnitSet).
137
+ const IMAGE_OUTPUT_TYPES = composeUnitSet("IMAGE_OUTPUT_TYPES", [
135
138
  "generate-image", "edit-image", "image-to-image",
136
139
  "upload-image",
137
- ])
140
+ ], unitsPresenting("image"))
138
141
 
139
142
  /**
140
143
  * Video-output types NOT already declared by `VIDEO_PRODUCER_TYPES` — the two
141
144
  * are unioned in `getOutputType`, which is where the reading order (and the
142
145
  * reason the literal sets win) is documented.
143
146
  */
144
- const VIDEO_OUTPUT_TYPES = new Set([
147
+ const VIDEO_OUTPUT_TYPES = composeUnitSet("VIDEO_OUTPUT_TYPES", [
145
148
  "image-to-video", "text-to-video", "video-to-video", "extend-video",
146
149
  "render-video", "video-composer", "after-effects", "lottie-overlay",
147
150
  "3d-title", "motion-graphics", "composite",
@@ -158,27 +161,24 @@ const VIDEO_OUTPUT_TYPES = new Set([
158
161
  // audio-only cut still plays in a video element). Asserted in
159
162
  // producer-types.test.ts.
160
163
  ...RENDER_NODE_TYPE_IDS,
161
- // Tighten Episode: a published app shows the episode as media, never as data
162
- // (it is not a render, so RENDER_NODE_TYPE_IDS does not bring it).
163
- "tighten-episode",
164
- ])
164
+ ], unitsPresenting("video"))
165
165
 
166
- const AUDIO_OUTPUT_TYPES = new Set([
166
+ const AUDIO_OUTPUT_TYPES = composeUnitSet("AUDIO_OUTPUT_TYPES", [
167
167
  "text-to-speech", "generate-music", "text-to-audio",
168
168
  "text-to-dialogue", "voice-changer", "dubbing", "voice-remix",
169
169
  "voice-design", "mix-audio", "adjust-volume", "audio-fx", "pitch-tempo", "trim-audio",
170
170
  "audio-isolation",
171
171
  "audio-separation",
172
172
  "upload-audio",
173
- ])
173
+ ], unitsPresenting("audio"))
174
174
 
175
- const TEXT_OUTPUT_TYPES = new Set([
175
+ const TEXT_OUTPUT_TYPES = composeUnitSet("TEXT_OUTPUT_TYPES", [
176
176
  "generate-script", "ai-writer", "llm-chat", "transcribe", "image-to-text", "qa-check",
177
177
  "text-prompt",
178
178
  // UGC Cards' output card is its Notes: a run hands it on as the node's text
179
179
  // (`output.text`, `generatedText` on the canvas).
180
180
  "ugc-cards",
181
- ])
181
+ ], unitsPresenting("text"))
182
182
 
183
183
  // ---------------------------------------------------------------------------
184
184
  // Output type enum
@@ -457,6 +457,8 @@ const MEDIA_INPUT_FIELD_TYPES: ReadonlySet<InputFieldSchema["type"]> = new Set([
457
457
  *
458
458
  * An override sent under a renamed exposed-field key (an app published before
459
459
  * the rename) lands on the node's current field — `canonicalizeOverrideKeys`.
460
+ *
461
+ * An override of `null` clears the field: the merged node has no such key.
460
462
  */
461
463
  export function mergeNodeInputOverrides(
462
464
  nodeType: string | undefined,
@@ -467,6 +469,11 @@ export function mergeNodeInputOverrides(
467
469
  // A Video URL node on a new link sheds what was fetched for the old one.
468
470
  const base = nodeType === "youtube-video" ? dropStaleVideoLinkFields(data, incoming) : data
469
471
  const merged: Record<string, unknown> = { ...base, ...incoming }
472
+ // A null override CLEARS the field: the run has no value there, neither null nor the saved one. JSON cannot
473
+ // carry `undefined`, so this is how a run says "unset" (an app card clearing a lever the chosen model lacks).
474
+ for (const [key, value] of Object.entries(incoming)) {
475
+ if (value === null) delete merged[key]
476
+ }
470
477
  const schema = nodeType ? INPUT_FIELD_MAP[nodeType] : undefined
471
478
  if (
472
479
  schema &&
@@ -26,6 +26,7 @@ import { buildFeedMaps } from "./trigger-feeds.js"
26
26
  import { defaultEdgeOutputMode } from "./producer-types.js"
27
27
  import { mergeNodeInputOverrides } from "./presentation-utils.js"
28
28
  import { RENDER_NODE_TYPE_IDS } from "./render-nodes.js"
29
+ import { unitReviewHolds } from "./unit-contract-compose.js"
29
30
 
30
31
  /** Render nodes a run can stop at: every render in the registry (SV18). */
31
32
  export const PREVIEW_RENDER_NODE_TYPES: ReadonlySet<string> = new Set(RENDER_NODE_TYPE_IDS)
@@ -34,9 +35,10 @@ export const PREVIEW_RENDER_NODE_TYPES: ReadonlySet<string> = new Set(RENDER_NOD
34
35
  * Use-case nodes whose review-on run ends at a Preview of their own: what
35
36
  * follows them waits for their Render final, exactly as after a render at
36
37
  * Preview. They are not render nodes (`PREVIEW_RENDER_NODE_TYPES` stays the
37
- * renders), so they join the hold here.
38
+ * renders), so they join the hold here: the node units that declare
39
+ * `contract.reviewHold` (generated/unit-contracts.ts).
38
40
  */
39
- export const REVIEW_HOLDING_USE_CASE_TYPES: ReadonlySet<string> = new Set(["tighten-episode"])
41
+ export const REVIEW_HOLDING_USE_CASE_TYPES: ReadonlySet<string> = new Set(unitReviewHolds())
40
42
 
41
43
  /** A node whose take can be a Preview that holds what follows it. */
42
44
  export function isPreviewHoldingType(type: string | null | undefined): boolean {