@nodaro/shared 3.33.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 (265) hide show
  1. package/dist/{chunk-2NQLSLSN.cjs → chunk-24ZKPE33.cjs} +5 -5
  2. package/dist/{chunk-2NQLSLSN.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-FT5CF6IA.js → chunk-2QWNPYDG.js} +3 -3
  8. package/dist/{chunk-FT5CF6IA.js.map → chunk-2QWNPYDG.js.map} +1 -1
  9. package/dist/{chunk-M7GQBRZU.cjs → chunk-3YG3MYDE.cjs} +153 -24
  10. package/dist/chunk-3YG3MYDE.cjs.map +1 -0
  11. package/dist/{chunk-VNQRI2RO.cjs → chunk-5VNBQ4QK.cjs} +16 -16
  12. package/dist/{chunk-VNQRI2RO.cjs.map → chunk-5VNBQ4QK.cjs.map} +1 -1
  13. package/dist/{chunk-K3LLGRK7.cjs → chunk-5ZCXWA7J.cjs} +59 -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-D26ENTN2.cjs → chunk-72IFMNJE.cjs} +80 -52
  18. package/dist/chunk-72IFMNJE.cjs.map +1 -0
  19. package/dist/{chunk-SAW5OK36.cjs → chunk-A5Z3IMSJ.cjs} +6 -6
  20. package/dist/{chunk-SAW5OK36.cjs.map → chunk-A5Z3IMSJ.cjs.map} +1 -1
  21. package/dist/{chunk-VA42637J.cjs → chunk-AGEZY4LL.cjs} +46 -41
  22. package/dist/chunk-AGEZY4LL.cjs.map +1 -0
  23. package/dist/{chunk-BG5D5CZ6.js → chunk-ANOQWAMU.js} +23 -6
  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-JFS3NWZ5.cjs → chunk-B7WJJHJS.cjs} +7 -4
  28. package/dist/chunk-B7WJJHJS.cjs.map +1 -0
  29. package/dist/{chunk-D6GNRSCV.cjs → chunk-BBLE4UTG.cjs} +23 -6
  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-PXFQVLBX.js → chunk-ETXUOETU.js} +26 -36
  36. package/dist/chunk-ETXUOETU.js.map +1 -0
  37. package/dist/{chunk-HKFMXNVQ.cjs → chunk-F4ZT5X2S.cjs} +11 -11
  38. package/dist/{chunk-HKFMXNVQ.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-ZL7UM6PU.cjs → chunk-GHBXS5RT.cjs} +4 -4
  44. package/dist/{chunk-ZL7UM6PU.cjs.map → chunk-GHBXS5RT.cjs.map} +1 -1
  45. package/dist/{chunk-ZO5PBBFX.js → chunk-GKJRNIP4.js} +59 -15
  46. package/dist/chunk-GKJRNIP4.js.map +1 -0
  47. package/dist/{chunk-UCFWI6D4.js → chunk-GRIMIJJ3.js} +3 -3
  48. package/dist/{chunk-UCFWI6D4.js.map → chunk-GRIMIJJ3.js.map} +1 -1
  49. package/dist/{chunk-5RYLK3MQ.js → chunk-GVHBHUFV.js} +11 -6
  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-SFW3UB2P.js → chunk-IJNQYMN7.js} +4 -4
  54. package/dist/{chunk-SFW3UB2P.js.map → chunk-IJNQYMN7.js.map} +1 -1
  55. package/dist/{chunk-HC7VKIV5.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-23FJQTEA.js → chunk-LJMNCSDG.js} +38 -15
  60. package/dist/chunk-LJMNCSDG.js.map +1 -0
  61. package/dist/{chunk-PVJBAPYJ.js → chunk-MEN7VLQ5.js} +8 -5
  62. package/dist/chunk-MEN7VLQ5.js.map +1 -0
  63. package/dist/{chunk-PHZ23DP3.js → chunk-MUA5L25B.js} +125 -12
  64. package/dist/chunk-MUA5L25B.js.map +1 -0
  65. package/dist/{chunk-WD6HJRBG.cjs → chunk-NWXB4F6D.cjs} +21 -21
  66. package/dist/{chunk-WD6HJRBG.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-XGFTL5XY.js → chunk-PVVO23LZ.js} +3 -3
  70. package/dist/{chunk-XGFTL5XY.js.map → chunk-PVVO23LZ.js.map} +1 -1
  71. package/dist/{chunk-CUH22J4D.js → chunk-Q4ZXDDWA.js} +3 -3
  72. package/dist/{chunk-CUH22J4D.js.map → chunk-Q4ZXDDWA.js.map} +1 -1
  73. package/dist/{chunk-WKOIGLQX.cjs → chunk-QIIG2QDP.cjs} +8 -8
  74. package/dist/{chunk-WKOIGLQX.cjs.map → chunk-QIIG2QDP.cjs.map} +1 -1
  75. package/dist/{chunk-QA3MVQ32.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-7Z5LUTGU.js → chunk-RRI5YBUK.js} +6 -3
  80. package/dist/{chunk-JFS3NWZ5.cjs.map → chunk-RRI5YBUK.js.map} +1 -1
  81. package/dist/{chunk-HUR6ZJ7S.cjs → chunk-RUKFN3LJ.cjs} +6 -6
  82. package/dist/{chunk-HUR6ZJ7S.cjs.map → chunk-RUKFN3LJ.cjs.map} +1 -1
  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-6WZ2VN7V.js → chunk-W36WCZS2.js} +6 -6
  90. package/dist/{chunk-6WZ2VN7V.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-VXPLKQWY.cjs → chunk-XE5PE54B.cjs} +30 -40
  94. package/dist/chunk-XE5PE54B.cjs.map +1 -0
  95. package/dist/{chunk-OZSACQ2V.js → chunk-XJOBMAWW.js} +3 -3
  96. package/dist/{chunk-OZSACQ2V.js.map → chunk-XJOBMAWW.js.map} +1 -1
  97. package/dist/{chunk-OTATNBMD.js → chunk-XS7FI4JA.js} +3 -3
  98. package/dist/{chunk-OTATNBMD.js.map → chunk-XS7FI4JA.js.map} +1 -1
  99. package/dist/{chunk-HRXEZ3SX.cjs → chunk-YD3JA36S.cjs} +4 -4
  100. package/dist/{chunk-HRXEZ3SX.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-UTQSSKSG.js → chunk-ZXBSARZX.js} +4 -4
  104. package/dist/{chunk-UTQSSKSG.js.map → chunk-ZXBSARZX.js.map} +1 -1
  105. package/dist/entries/apps.cjs +43 -42
  106. package/dist/entries/apps.d.cts +2 -2
  107. package/dist/entries/apps.d.ts +2 -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 +153 -153
  112. package/dist/entries/credits.d.cts +1 -1
  113. package/dist/entries/credits.d.ts +1 -1
  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 +66 -66
  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 +8 -4
  149. package/dist/entries/pipeline.d.ts +8 -4
  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 +7 -18
  165. package/dist/entries/workflow.d.ts +7 -18
  166. package/dist/entries/workflow.js +2 -1
  167. package/dist/index.cjs +1708 -1567
  168. package/dist/index.d.cts +9 -9
  169. package/dist/index.d.ts +9 -9
  170. package/dist/index.js +26 -25
  171. package/dist/{model-catalog-V-ZNzRSd.d.ts → model-catalog-VIHGmQL2.d.cts} +22 -0
  172. package/dist/{model-catalog-V-ZNzRSd.d.cts → model-catalog-VIHGmQL2.d.ts} +22 -0
  173. package/dist/{presentation-utils-D0kxsWf9.d.cts → presentation-utils-A4i92SYo.d.cts} +1 -1
  174. package/dist/{presentation-utils-pZwlEAzo.d.ts → presentation-utils-DjdPtM9k.d.ts} +1 -1
  175. package/dist/{scene-node-types-C3kl_zyK.d.ts → scene-node-types-Cvbtf-0a.d.cts} +147 -6
  176. package/dist/{scene-node-types-C3kl_zyK.d.cts → scene-node-types-Cvbtf-0a.d.ts} +147 -6
  177. package/dist/{types-DffyGSy5.d.cts → types-CU6SQnMS.d.cts} +0 -5
  178. package/dist/{types-DffyGSy5.d.ts → types-CU6SQnMS.d.ts} +0 -5
  179. package/dist/{types-BRlFPEru.d.ts → types-DzUBR7yr.d.cts} +8 -1
  180. package/dist/{types-BRlFPEru.d.cts → 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__/node-preset-extract.test.ts +10 -0
  192. package/src/__tests__/preview-gate-use-case.test.ts +16 -1
  193. package/src/__tests__/producer-types.test.ts +19 -0
  194. package/src/__tests__/run-continuation.test.ts +4 -1
  195. package/src/__tests__/speaker-map-contract.test.ts +48 -0
  196. package/src/__tests__/unit-contract-compose.test.ts +129 -0
  197. package/src/__tests__/unit-contracts.test.ts +134 -0
  198. package/src/__tests__/use-case-types.test.ts +33 -0
  199. package/src/__tests__/video-collapse-parity.test.ts +10 -0
  200. package/src/__tests__/video-frame-slot.test.ts +85 -0
  201. package/src/__tests__/video-mode-aliases.test.ts +1 -0
  202. package/src/__tests__/video-reference-only.test.ts +117 -0
  203. package/src/__tests__/vidu-q4-catalog.test.ts +230 -0
  204. package/src/camera-switch-contract.ts +36 -2
  205. package/src/credit-identifiers.ts +19 -6
  206. package/src/entity-asset-types.ts +13 -0
  207. package/src/entries/edl.ts +2 -0
  208. package/src/entries/llm-models.ts +5 -0
  209. package/src/entries/media.ts +1 -0
  210. package/src/entries/models.ts +25 -0
  211. package/src/entries/nodes.ts +5 -1
  212. package/src/fan-out-rows.ts +36 -3
  213. package/src/generate-mask.ts +40 -0
  214. package/src/generated/unit-contracts.ts +58 -0
  215. package/src/i18n/types.ts +13 -2
  216. package/src/json-kinds.ts +24 -4
  217. package/src/llm-models.ts +184 -31
  218. package/src/meta-ads-scrape.ts +16 -8
  219. package/src/model-catalog.ts +78 -13
  220. package/src/model-constants.ts +260 -5
  221. package/src/node-default-mappings.ts +3 -0
  222. package/src/node-preset-extract.ts +8 -0
  223. package/src/pipeline-types.ts +3 -0
  224. package/src/presentation-utils.ts +12 -12
  225. package/src/preview-gate.ts +4 -2
  226. package/src/producer-types.ts +19 -19
  227. package/src/run-continuation.ts +26 -4
  228. package/src/speaker-layouts.ts +8 -3
  229. package/src/speaker-map-contract.ts +77 -0
  230. package/src/unit-contract-compose.ts +55 -0
  231. package/src/use-case-types.ts +19 -0
  232. package/src/video-ui-defaults.ts +7 -5
  233. package/dist/chunk-23FJQTEA.js.map +0 -1
  234. package/dist/chunk-5PC6JBGJ.cjs.map +0 -1
  235. package/dist/chunk-5RYLK3MQ.js.map +0 -1
  236. package/dist/chunk-7Z5LUTGU.js.map +0 -1
  237. package/dist/chunk-BG5D5CZ6.js.map +0 -1
  238. package/dist/chunk-CK3GK34R.js.map +0 -1
  239. package/dist/chunk-D26ENTN2.cjs.map +0 -1
  240. package/dist/chunk-D6GNRSCV.cjs.map +0 -1
  241. package/dist/chunk-HC7VKIV5.cjs.map +0 -1
  242. package/dist/chunk-HGC5JNVA.cjs.map +0 -1
  243. package/dist/chunk-JL4C5VJ7.cjs.map +0 -1
  244. package/dist/chunk-K3LLGRK7.cjs.map +0 -1
  245. package/dist/chunk-M36G6SRP.js.map +0 -1
  246. package/dist/chunk-M7GQBRZU.cjs.map +0 -1
  247. package/dist/chunk-PHZ23DP3.js.map +0 -1
  248. package/dist/chunk-PQHS255G.js.map +0 -1
  249. package/dist/chunk-PRYE7AZQ.cjs.map +0 -1
  250. package/dist/chunk-PVJBAPYJ.js.map +0 -1
  251. package/dist/chunk-PXFQVLBX.js.map +0 -1
  252. package/dist/chunk-QA3MVQ32.js.map +0 -1
  253. package/dist/chunk-SES6GDBQ.cjs.map +0 -1
  254. package/dist/chunk-TU33KYKW.cjs +0 -25
  255. package/dist/chunk-TU33KYKW.cjs.map +0 -1
  256. package/dist/chunk-VA42637J.cjs.map +0 -1
  257. package/dist/chunk-VXPLKQWY.cjs.map +0 -1
  258. package/dist/chunk-WDIBOWAA.js.map +0 -1
  259. package/dist/chunk-YBPBK5KI.js.map +0 -1
  260. package/dist/chunk-YYV35XOS.js.map +0 -1
  261. package/dist/chunk-Z2OL5AJD.cjs.map +0 -1
  262. package/dist/chunk-ZDFHA2EC.js.map +0 -1
  263. package/dist/chunk-ZO5PBBFX.js.map +0 -1
  264. package/dist/chunk-ZRL2UFTH.cjs.map +0 -1
  265. package/src/__tests__/__snapshots__/prompt-builder-segments.test.ts.snap +0 -65
@@ -0,0 +1,230 @@
1
+ import { describe, it, expect } from "vitest"
2
+ import { MODEL_CATALOG, MODEL_MAKERS, normalizeVideoRequestParams } from "../model-catalog.js"
3
+ import {
4
+ IMAGE_TO_VIDEO_PROVIDERS,
5
+ TEXT_TO_VIDEO_PROVIDERS,
6
+ VIDEO_REF_LIMITS_BY_PROVIDER,
7
+ VIDEO_PROVIDERS_REQUIRING_IMAGE,
8
+ getVideoAudioCapability,
9
+ defaultVideoAspectRatio,
10
+ getMaxVideoPromptChars,
11
+ VIDU_Q4_PROVIDERS,
12
+ isViduQ4Provider,
13
+ VIDU_Q4_DEFAULT_RESOLUTION,
14
+ normalizeViduQ4Resolution,
15
+ isWan3Provider,
16
+ isSeedance2Provider,
17
+ isMinimaxH3Provider,
18
+ DURATION_PRICED_PROVIDERS,
19
+ VIDEO_DURATION_TIERS,
20
+ RESOLUTION_DURATION_PRICING,
21
+ PRICING_DEFAULT_RESOLUTION,
22
+ NATIVE_ADAPTIVE_ASPECT,
23
+ VIDEO_REF_AUDIO_RULES,
24
+ checkRefAudioRules,
25
+ resolveVideoModeForInputs,
26
+ videoProviderFoldsLoneEndFrame,
27
+ GVP_EXTEND_PROVIDERS,
28
+ } from "../model-constants.js"
29
+ import { buildVideoCreditModelIdentifier, videoGenerationCreditId } from "../credit-identifiers.js"
30
+ import { uiDurationFill, uiResolutionFill } from "../video-ui-defaults.js"
31
+
32
+ const ID = "vidu-q4"
33
+ const DURATIONS_3_TO_16 = Array.from({ length: 14 }, (_, i) => i + 3)
34
+ const RESOLUTIONS = ["540p", "720p", "1080p", "2k", "4k"] as const
35
+
36
+ describe("vidu-q4 catalog", () => {
37
+ const entry = MODEL_CATALOG[ID]!
38
+
39
+ it("is ONE i2v-only id made by ShengShu (no t2v mode exists on KIE)", () => {
40
+ expect(entry.kind).toBe("video")
41
+ expect([...entry.modes]).toEqual(["i2v"])
42
+ expect(entry.label).toBe("Vidu Q4")
43
+ expect(entry.series).toBe("Vidu")
44
+ expect(entry.maker).toBe("shengshu")
45
+ expect(MODEL_MAKERS.shengshu.name).toBe("ShengShu")
46
+ })
47
+
48
+ it("lists resolutions ASCENDING with lowercase 2k/4k; the 720p default is declared, not index 0", () => {
49
+ expect(entry.resolutions).toEqual([...RESOLUTIONS])
50
+ expect(PRICING_DEFAULT_RESOLUTION[ID]).toBe("720p")
51
+ expect(VIDU_Q4_DEFAULT_RESOLUTION).toBe("720p")
52
+ expect(entry.unlistedResolutionRendersAs).toBe("720p")
53
+ })
54
+
55
+ it("offers every integer second 3-16 with a 5s default", () => {
56
+ expect(entry.durations).toEqual(DURATIONS_3_TO_16)
57
+ expect(entry.defaultDuration).toBe(5)
58
+ })
59
+
60
+ it("carries the reference-to-video ratio enum and takes no seed", () => {
61
+ expect(entry.aspectRatios).toEqual(["16:9", "9:16", "1:1", "4:3", "3:4"])
62
+ expect(entry.noSeed).toBe(true)
63
+ })
64
+
65
+ it("declares audio + reference-image + reference-to-video, and NOT end-frame or video-reference", () => {
66
+ // reference-to-video: the reference endpoint runs from reference images
67
+ // alone (no start frame), so a references-only run is never image-gated.
68
+ expect([...(entry.features ?? [])].sort()).toEqual(["audio", "reference-image", "reference-to-video"])
69
+ })
70
+ })
71
+
72
+ describe("vidu-q4 capability sets", () => {
73
+ it("is in both route enums and image-gated on the t2v route", () => {
74
+ expect(IMAGE_TO_VIDEO_PROVIDERS as readonly string[]).toContain(ID)
75
+ expect(TEXT_TO_VIDEO_PROVIDERS as readonly string[]).toContain(ID)
76
+ expect(VIDEO_PROVIDERS_REQUIRING_IMAGE.has(ID)).toBe(true)
77
+ })
78
+
79
+ it("routes a start frame to image-to-video and a prompt-only run to the gated t2v lane", () => {
80
+ expect(resolveVideoModeForInputs(ID, { hasStartFrame: true, hasImageRefs: false })).toBe("image-to-video")
81
+ expect(resolveVideoModeForInputs(ID, { hasStartFrame: true, hasImageRefs: true })).toBe("image-to-video")
82
+ expect(resolveVideoModeForInputs(ID, { hasStartFrame: false, hasImageRefs: false })).toBe("text-to-video")
83
+ })
84
+
85
+ it("has no home for a lone end frame (no fold into the references)", () => {
86
+ expect(videoProviderFoldsLoneEndFrame(ID)).toBe(false)
87
+ })
88
+
89
+ it("carries 15 reference images and 3 reference audio clips, no reference videos", () => {
90
+ expect(VIDEO_REF_LIMITS_BY_PROVIDER[ID]).toEqual({ images: 15, audio: 3 })
91
+ })
92
+
93
+ it("audio: ambient behind the model's own `audio` boolean, default on, not cost-affecting", () => {
94
+ expect(getVideoAudioCapability(ID)).toEqual({ mode: "ambient", field: "audio", defaultOn: true })
95
+ })
96
+
97
+ it("keeps the historical 16:9 aspect default (no adaptive token on its enum)", () => {
98
+ expect(defaultVideoAspectRatio(ID)).toBe("16:9")
99
+ expect(NATIVE_ADAPTIVE_ASPECT[ID]).toBeUndefined()
100
+ })
101
+
102
+ it("prompt cap is the documented 20000 chars", () => {
103
+ expect(getMaxVideoPromptChars(ID)).toBe(20000)
104
+ })
105
+
106
+ it("is a family of its own", () => {
107
+ expect([...VIDU_Q4_PROVIDERS]).toEqual([ID])
108
+ expect(isViduQ4Provider(ID)).toBe(true)
109
+ expect(isViduQ4Provider("vidu")).toBe(false)
110
+ expect(isViduQ4Provider(undefined)).toBe(false)
111
+ expect(isWan3Provider(ID) || isSeedance2Provider(ID) || isMinimaxH3Provider(ID)).toBe(false)
112
+ })
113
+
114
+ it("renders keyframes only in generate-video-pro (no video-reference feature)", () => {
115
+ expect(GVP_EXTEND_PROVIDERS as readonly string[]).not.toContain(ID)
116
+ })
117
+
118
+ it("fills the 720p / 5s defaults rather than the ladder's first rung", () => {
119
+ expect(uiResolutionFill(ID)).toBe("720p")
120
+ expect(uiDurationFill(ID)).toBe(5)
121
+ })
122
+ })
123
+
124
+ describe("normalizeViduQ4Resolution", () => {
125
+ it("keeps every supported tier, case-insensitively, in the lowercase wire spelling", () => {
126
+ for (const r of RESOLUTIONS) {
127
+ expect(normalizeViduQ4Resolution(r)).toBe(r)
128
+ expect(normalizeViduQ4Resolution(r.toUpperCase())).toBe(r)
129
+ }
130
+ expect(normalizeViduQ4Resolution(" 2K ")).toBe("2k")
131
+ })
132
+
133
+ it("collapses undefined / garbage / an off-menu tier to the 720p default", () => {
134
+ for (const v of [undefined, "", "480p", "8k", "nonsense"]) {
135
+ expect(normalizeViduQ4Resolution(v)).toBe("720p")
136
+ }
137
+ })
138
+
139
+ it("the catalog funnel canonicalises an uppercase 2K/4K to the lowercase band", () => {
140
+ expect(normalizeVideoRequestParams(ID, { resolution: "4K" }).resolution).toBe("4k")
141
+ expect(normalizeVideoRequestParams(ID, { resolution: "2K" }).resolution).toBe("2k")
142
+ })
143
+ })
144
+
145
+ describe("vidu-q4 credit identifier", () => {
146
+ it("is duration-priced with one tier per allowed second 3-16", () => {
147
+ expect(DURATION_PRICED_PROVIDERS.has(ID)).toBe(true)
148
+ expect(VIDEO_DURATION_TIERS[ID]!.map((t) => t.maxSeconds)).toEqual(DURATIONS_3_TO_16)
149
+ expect(RESOLUTION_DURATION_PRICING[ID]).toEqual([...RESOLUTIONS])
150
+ })
151
+
152
+ it("emits exactly one composite per (duration, resolution) pair — 70 distinct ids", () => {
153
+ const ids = new Set<string>()
154
+ for (const d of DURATIONS_3_TO_16) {
155
+ for (const r of RESOLUTIONS) {
156
+ const id = buildVideoCreditModelIdentifier(ID, d, undefined, "image-to-video", undefined, r)
157
+ expect(id).toBe(`${ID}:${d}s:${r}`)
158
+ ids.add(id)
159
+ }
160
+ }
161
+ expect(ids.size).toBe(70)
162
+ })
163
+
164
+ it("prices an OMITTED resolution and duration at the declared 5s 720p default", () => {
165
+ expect(buildVideoCreditModelIdentifier(ID, undefined, undefined, "image-to-video")).toBe("vidu-q4:5s:720p")
166
+ expect(videoGenerationCreditId({ provider: ID })).toBe("vidu-q4:5s:720p")
167
+ })
168
+
169
+ it("bills the tier it RENDERS for every spelling, and 720p for anything unknown", () => {
170
+ expect(buildVideoCreditModelIdentifier(ID, 8, undefined, "image-to-video", undefined, "4K")).toBe("vidu-q4:8s:4k")
171
+ expect(buildVideoCreditModelIdentifier(ID, 8, undefined, "image-to-video", undefined, "480p")).toBe("vidu-q4:8s:720p")
172
+ expect(buildVideoCreditModelIdentifier(ID, 8, undefined, "image-to-video", undefined, "nonsense")).toBe("vidu-q4:8s:720p")
173
+ })
174
+
175
+ it("has no audio and no reference dimension — one ladder for both endpoints", () => {
176
+ const plain = buildVideoCreditModelIdentifier(ID, 6, undefined, "image-to-video", undefined, "1080p")
177
+ expect(buildVideoCreditModelIdentifier(ID, 6, true, "image-to-video", undefined, "1080p")).toBe(plain)
178
+ expect(buildVideoCreditModelIdentifier(ID, 6, false, "image-to-video", undefined, "1080p")).toBe(plain)
179
+ expect(buildVideoCreditModelIdentifier(ID, 6, undefined, "image-to-video", undefined, "1080p", true)).toBe(plain)
180
+ })
181
+
182
+ it("snaps an off-menu duration into a seeded tier", () => {
183
+ expect(buildVideoCreditModelIdentifier(ID, 2, undefined, "image-to-video", undefined, "720p")).toBe("vidu-q4:3s:720p")
184
+ expect(buildVideoCreditModelIdentifier(ID, 40, undefined, "image-to-video", undefined, "720p")).toBe("vidu-q4:16s:720p")
185
+ })
186
+
187
+ it("every catalog pricing row is an id the builder can emit (or the bare default)", () => {
188
+ const emittable = new Set<string>([ID])
189
+ for (const d of DURATIONS_3_TO_16) for (const r of RESOLUTIONS) emittable.add(`${ID}:${d}s:${r}`)
190
+ for (const row of MODEL_CATALOG[ID]!.pricing) expect(emittable.has(row.identifier), row.identifier).toBe(true)
191
+ })
192
+ })
193
+
194
+ describe("vidu-q4 reference-audio rules", () => {
195
+ it("declares MP3-only clips of 3-12 seconds", () => {
196
+ expect(VIDEO_REF_AUDIO_RULES[ID]).toEqual({ formats: ["mp3"], minSec: 3, maxSec: 12 })
197
+ })
198
+
199
+ it("accepts MP3 clips inside the window", () => {
200
+ expect(checkRefAudioRules(ID, [{ formatNames: ["mp3"], durationSec: 3 }, { formatNames: ["mp3"], durationSec: 12 }])).toEqual({ ok: true })
201
+ })
202
+
203
+ it("refuses a non-MP3 clip with the format code", () => {
204
+ const r = checkRefAudioRules(ID, [{ formatNames: ["mp3"], durationSec: 5 }, { formatNames: ["wav"], durationSec: 5 }])
205
+ expect(r.ok).toBe(false)
206
+ if (!r.ok) {
207
+ expect(r.code).toBe("audio_format_unsupported")
208
+ expect(r.message).toContain("Reference audio 2")
209
+ expect(r.message).toContain("MP3")
210
+ }
211
+ const m4a = checkRefAudioRules(ID, [{ formatNames: ["mov", "mp4", "m4a", "3gp", "3g2", "mj2"], durationSec: 5 }])
212
+ expect(m4a.ok).toBe(false)
213
+ })
214
+
215
+ it("refuses a clip outside 3-12 seconds", () => {
216
+ const short = checkRefAudioRules(ID, [{ formatNames: ["mp3"], durationSec: 2.5 }])
217
+ expect(short.ok === false && short.code).toBe("audio_too_short")
218
+ const long = checkRefAudioRules(ID, [{ formatNames: ["mp3"], durationSec: 12.4 }])
219
+ expect(long.ok === false && long.code).toBe("audio_too_long")
220
+ })
221
+
222
+ it("ignores whatever a probe could not read — a blip never blocks a run", () => {
223
+ expect(checkRefAudioRules(ID, [{}, { durationSec: Number.NaN }, { formatNames: [] }])).toEqual({ ok: true })
224
+ })
225
+
226
+ it("is a no-op for a provider with no declared rule", () => {
227
+ expect(checkRefAudioRules("wan-3", [{ formatNames: ["wav"], durationSec: 1 }])).toEqual({ ok: true })
228
+ expect(checkRefAudioRules(undefined, [{ formatNames: ["wav"] }])).toEqual({ ok: true })
229
+ })
230
+ })
@@ -5,6 +5,7 @@
5
5
  * and pre-fill the speaker table. Pure, no I/O.
6
6
  */
7
7
  import { normalizeTranscript } from "./edl.js"
8
+ import { speakerMapByOrdinal, speakerMapResultOf } from "./speaker-map-contract.js"
8
9
 
9
10
  /** The settings and their decided defaults (the plugin holds its own copy, D13). */
10
11
  export const CAMERA_SWITCH_DEFAULTS = Object.freeze({
@@ -135,6 +136,10 @@ export function defaultSpeakerMap(
135
136
  * settings and the same pre-filled speaker table. */
136
137
  export interface CameraSwitchNodeSettings {
137
138
  readonly speakerMap?: Readonly<Record<string, string>>
139
+ /** Who is on which camera by ordinal — "1" the first voice heard → a camera
140
+ * SOURCE id, "" none; what a use-case node's override writes (decided
141
+ * 2026-10-17). A label in `speakerMap` beats it. */
142
+ readonly speakerMapByOrder?: Readonly<Record<string, string>>
138
143
  readonly speakerNames?: Readonly<Record<string, string>>
139
144
  readonly minShotMs?: number
140
145
  readonly leadMs?: number
@@ -142,10 +147,40 @@ export interface CameraSwitchNodeSettings {
142
147
  readonly wideEvery?: number
143
148
  readonly layoutHints?: boolean
144
149
  }
150
+ /**
151
+ * Who is on which camera — the ONE merge of the speaker table's layers
152
+ * (decided 2026-10-17). Per speaker, the first that names them wins: an
153
+ * explicit label in `speakerMap`, the ordinal override `speakerMapByOrder`, a
154
+ * wired Speaker Map result, then the order default (`defaultSpeakerMap`).
155
+ * Each layer above the default is passed as `existing`, so its "" (no camera
156
+ * of their own) is SENT as "" and is never re-filled by the order default; an
157
+ * explicit entry that is not a string is ignored, so it never hides a layer
158
+ * below it. `cameraSwitchSettingsPayload` sends this; the config panel's
159
+ * "What the run will use" shows this — never a second copy of the order.
160
+ */
161
+ export function cameraSwitchSpeakerMap(
162
+ data: Pick<CameraSwitchNodeSettings, "speakerMap" | "speakerMapByOrder">,
163
+ edl: unknown,
164
+ transcript: unknown,
165
+ wired?: { readonly speakerMap?: unknown },
166
+ ): Record<string, string> {
167
+ const labels = transcriptSpeakerLabels(transcript)
168
+ const explicit = data.speakerMap && typeof data.speakerMap === "object" && !Array.isArray(data.speakerMap)
169
+ ? Object.fromEntries(Object.entries(data.speakerMap).filter(([, camera]) => typeof camera === "string"))
170
+ : {}
171
+ const existing = {
172
+ ...(speakerMapResultOf(wired?.speakerMap)?.speakerMap ?? {}),
173
+ ...speakerMapByOrdinal(labels, data.speakerMapByOrder),
174
+ ...explicit,
175
+ }
176
+ return defaultSpeakerMap(labels, cameraSwitchCameras(edl).map((c) => c.id), existing)
177
+ }
178
+
145
179
  export function cameraSwitchSettingsPayload(
146
180
  data: CameraSwitchNodeSettings,
147
181
  edl: unknown,
148
182
  transcript: unknown,
183
+ wired?: { readonly speakerMap?: unknown },
149
184
  ): {
150
185
  speakerMap: Record<string, string>
151
186
  speakerNames: Record<string, string>
@@ -155,9 +190,8 @@ export function cameraSwitchSettingsPayload(
155
190
  wideEvery?: number
156
191
  layoutHints: boolean
157
192
  } {
158
- const existing = data.speakerMap && typeof data.speakerMap === "object" ? data.speakerMap : {}
159
193
  const out: ReturnType<typeof cameraSwitchSettingsPayload> = {
160
- speakerMap: defaultSpeakerMap(transcriptSpeakerLabels(transcript), cameraSwitchCameras(edl).map((c) => c.id), existing),
194
+ speakerMap: cameraSwitchSpeakerMap(data, edl, transcript, wired),
161
195
  speakerNames: cleanSpeakerNames(data.speakerNames),
162
196
  layoutHints: data.layoutHints === true,
163
197
  }
@@ -24,8 +24,10 @@ import {
24
24
  isMinimaxH3Provider,
25
25
  isGeminiOmniProvider,
26
26
  isWan3Provider,
27
+ isViduQ4Provider,
27
28
  normalizeMinimaxH3Resolution,
28
29
  normalizeWan3Resolution,
30
+ normalizeViduQ4Resolution,
29
31
  getVideoAudioCapability,
30
32
  } from "./model-constants.js"
31
33
  import { isFlux2Model, FLUX2_RES_MP, type Flux2Model } from "./flux2-pricing.js"
@@ -335,6 +337,18 @@ function ltxPricedTier(
335
337
  return { band, duration: dur }
336
338
  }
337
339
 
340
+ /**
341
+ * The resolution a provider whose runner NORMALIZES the lever actually renders,
342
+ * in the lowercase spelling of its credit composites — billing collapses
343
+ * through the very normalizer the runner sends, so render == billed for every
344
+ * spelling. `undefined` passes through untouched for every other provider.
345
+ */
346
+ function wireNormalizedResolution(provider: string, resolution: string | undefined): string | undefined {
347
+ if (isWan3Provider(provider)) return normalizeWan3Resolution(resolution).toLowerCase()
348
+ if (isViduQ4Provider(provider)) return normalizeViduQ4Resolution(resolution)
349
+ return resolution
350
+ }
351
+
338
352
  export function buildVideoCreditModelIdentifier(
339
353
  provider: string,
340
354
  duration?: number | string,
@@ -476,12 +490,11 @@ export function buildVideoCreditModelIdentifier(
476
490
  // the 720p row, a shortfall `commit_credits` (refund-only) can never collect.
477
491
  // Collapsing through the SAME normalizer the runner uses makes render == billed
478
492
  // by construction for every spelling, including garbage (→ the declared 720p).
479
- // Scoped to the wan family on purpose: the other RESOLUTION_DURATION_PRICING
480
- // members pass `resolution` to their wire verbatim, so case-folding their
481
- // billing without probing their wire would reprice live models.
482
- const requested = isWan3Provider(effectiveProvider)
483
- ? normalizeWan3Resolution(resolution).toLowerCase()
484
- : resolution
493
+ // Scoped to the families whose runner normalizes on purpose (Wan 3.0, Vidu
494
+ // Q4): the other RESOLUTION_DURATION_PRICING members pass `resolution` to
495
+ // their wire verbatim, so case-folding their billing without probing their
496
+ // wire would reprice live models.
497
+ const requested = wireNormalizedResolution(effectiveProvider, resolution)
485
498
  const res = requested && resTiers.includes(requested) ? requested : fallback
486
499
  identifier += `:${res}`
487
500
  }
@@ -74,6 +74,19 @@ export const CHARACTER_ATTACH_COLUMNS = [
74
74
  ] as const
75
75
  export type CharacterAttachColumn = (typeof CHARACTER_ATTACH_COLUMNS)[number]
76
76
 
77
+ /**
78
+ * The narrower set `/v1/image-to-image`'s `attachToColumn` accepts (Character
79
+ * Studio refining an existing asset): the four refinable buckets. A subset of
80
+ * {@link CHARACTER_ATTACH_COLUMNS}, checked at compile time.
81
+ */
82
+ export const IMAGE_TO_IMAGE_ATTACH_COLUMNS = [
83
+ "expressions",
84
+ "poses",
85
+ "angles",
86
+ "lighting_variations",
87
+ ] as const satisfies readonly CharacterAttachColumn[]
88
+ export type ImageToImageAttachColumn = (typeof IMAGE_TO_IMAGE_ATTACH_COLUMNS)[number]
89
+
77
90
  /**
78
91
  * Canonical variant presets per character asset type — the SINGLE source of
79
92
  * truth shared by the `generate-character-asset` route (Zod validation rejects a
@@ -37,6 +37,8 @@ export * from "../edl-multicam.js"
37
37
  // Speaker tracks: the face-tracking result (box body + the node's descriptor) and its validators.
38
38
  export * from "../speaker-tracks.js"
39
39
  export * from "../camera-switch-contract.js"
40
+ // Speaker Map's result contract (which camera each speaker is on) and the override's ordinal keys.
41
+ export * from "../speaker-map-contract.js"
40
42
  export * from "../edit-plan-contract.js"
41
43
  // A person's review of an Edit Plan (`editedEdl`) and the one resolver that applies it.
42
44
  export * from "../edit-plan-review.js"
@@ -13,6 +13,9 @@ export {
13
13
  LLM_VENDOR_LABELS,
14
14
  groupLlmModelsByVendor,
15
15
  orderedLlmModels,
16
+ PICKABLE_LLM_MODELS,
17
+ pickableLlmModels,
18
+ isLlmModelRetired,
16
19
  type LlmVendor,
17
20
  type LlmModelGroup,
18
21
  VIDEO_ANALYSIS_LLM_MODELS,
@@ -30,6 +33,7 @@ export {
30
33
  isVideoAnalysisMixedTier,
31
34
  resolveVideoAnalysisModel,
32
35
  LLM_FEATURE_DEFAULTS,
36
+ DESCRIBE_TO_PICKER_FALLBACK_MODEL,
33
37
  LLM_FEATURE_DEFAULT_EFFORTS,
34
38
  defaultReasoningEffort,
35
39
  LLM_MODALITY_CAPS,
@@ -39,6 +43,7 @@ export {
39
43
  getLlmTier,
40
44
  getLlmModalityCaps,
41
45
  buildLlmCreditIdentifier,
46
+ llmCreditRung,
42
47
  resolveLlmCreditId,
43
48
  supportsAdvancedMode,
44
49
  llmServesDirect,
@@ -31,6 +31,7 @@ export type { LottieOverlayCatalogEntry } from "../lottie-overlay-catalog.js"
31
31
  export * from "../audio-fx-presets.js"
32
32
  export * from "../image-overlay-layers.js"
33
33
  export * from "../video-mask.js"
34
+ export * from "../generate-mask.js"
34
35
  export * from "../mask-composite.js"
35
36
  export * from "../image-overlay-shapes.js"
36
37
  export * from "../image-overlay-platforms.js"
@@ -9,6 +9,10 @@ export {
9
9
  CREDIT_BASE_USD,
10
10
  IMAGE_PROMPT_MAX,
11
11
  IMAGE_ASPECT_RATIO_VALUES,
12
+ IMAGE_RESOLUTION_VALUES,
13
+ IMAGE_QUALITY_VALUES,
14
+ IMAGE_RENDERING_SPEED_VALUES,
15
+ IMAGE_EDIT_TARGET_RESOLUTION_VALUES,
12
16
  MAX_IMAGE_PROMPT_CHARS_BY_PROVIDER,
13
17
  getMaxImagePromptChars,
14
18
  PROMPT_HARD_CEILING,
@@ -56,6 +60,7 @@ export {
56
60
  IMAGE_I2I_PROVIDERS,
57
61
  IMAGE_EDIT_PROVIDERS,
58
62
  TASK_CHAINED_EDIT_PROVIDERS,
63
+ TASK_CHAINED_EDIT_PROVIDER_IDS,
59
64
  IMAGE_TO_VIDEO_PROVIDERS,
60
65
  TEXT_TO_VIDEO_PROVIDERS,
61
66
  VIDEO_GEN_PROVIDERS,
@@ -131,6 +136,11 @@ export {
131
136
  VIDEO_GEN_COLLAPSED_T2V_IDS,
132
137
  resolveVideoProviderForMode,
133
138
  resolveVideoModeForInputs,
139
+ videoProviderRunsFromReferences,
140
+ videoProviderReferenceSyntax,
141
+ videoProviderAppendsFrames,
142
+ videoProviderRefModeFrameSeats,
143
+ VIDEO_PROVIDERS_WITH_SEPARATE_FRAME_CHANNEL,
134
144
  isSeedance2Provider,
135
145
  MINIMAX_H3_PROVIDERS,
136
146
  isMinimaxH3Provider,
@@ -140,6 +150,10 @@ export {
140
150
  isWan3Provider,
141
151
  WAN_3_DEFAULT_RESOLUTION,
142
152
  normalizeWan3Resolution,
153
+ VIDU_Q4_PROVIDERS,
154
+ isViduQ4Provider,
155
+ VIDU_Q4_DEFAULT_RESOLUTION,
156
+ normalizeViduQ4Resolution,
143
157
  GEMINI_OMNI_PROVIDERS,
144
158
  isGeminiOmniProvider,
145
159
  VIDEO_PROVIDERS_WITHOUT_DISPATCH,
@@ -170,6 +184,8 @@ export {
170
184
  SEEDANCE_2_R2V_MAX_AUDIO_SEC_BY_PROVIDER,
171
185
  seedance2AudioLimitSec,
172
186
  findSeedance2AudioOverLimit,
187
+ VIDEO_REF_AUDIO_RULES,
188
+ checkRefAudioRules,
173
189
  DEFAULT_VIDEO_PROVIDER,
174
190
  DEFAULT_VIDEO_DURATION_SEC,
175
191
  applyDefaultVideoSelection,
@@ -183,6 +199,11 @@ export {
183
199
  } from "../model-constants.js"
184
200
  export type {
185
201
  ImageAspectRatio,
202
+ ImageResolution,
203
+ ImageQuality,
204
+ ImageRenderingSpeed,
205
+ ImageEditTargetResolution,
206
+ TaskChainedEditProvider,
186
207
  ImageGenProvider,
187
208
  ImageMaskMode,
188
209
  ImageI2IProvider,
@@ -224,6 +245,10 @@ export type {
224
245
  GvpAnchorChoice,
225
246
  GvpAnchorWireMode,
226
247
  RefVideoDurationLimit,
248
+ RefAudioRule,
249
+ RefAudioProbe,
250
+ RefAudioCheck,
251
+ VideoReferenceSyntax,
227
252
  } from "../model-constants.js"
228
253
  export { GEMINI_OMNI_VOICE_PRESETS, GEMINI_OMNI_VOICE_PRESET_IDS } from "../gemini-omni-voices.js"
229
254
  export type { GeminiOmniVoicePreset, GeminiOmniVoicePresetId } from "../gemini-omni-voices.js"
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `@nodaro/shared/nodes` — Per-node-type rules: producer types, handle aliases, render nodes, JSON kinds, preview/render-final, settings inputs, node presets, collections.
2
+ * `@nodaro/shared/nodes` — Per-node-type rules: producer types, use-case node types, handle aliases, render nodes, JSON kinds, preview/render-final, settings inputs, node presets, collections.
3
3
  *
4
4
  * One of the package's subpath entries (see `src/index.ts`). The root
5
5
  * re-exports every entry, so each name here is also importable from
@@ -99,6 +99,7 @@ export {
99
99
  type SavedRenderQualityStamp,
100
100
  type SavedRenderStampReader,
101
101
  } from "../preview-gate.js"
102
+ export { USE_CASE_NODE_TYPES, isUseCaseNodeType, type UseCaseNodeType } from "../use-case-types.js"
102
103
  export {
103
104
  CONTINUATION_NOT_FOUND,
104
105
  CONTINUATION_WORKFLOW_MISMATCH,
@@ -107,9 +108,12 @@ export {
107
108
  CONTINUATION_SUBSET_REQUIRED,
108
109
  CONTINUATION_NOT_FAILED,
109
110
  CONTINUATION_SUPERSEDED,
111
+ CONTINUATION_PREVIEW_PENDING,
110
112
  CONTINUATION_SETTLING,
111
113
  RENDER_FINAL_ALREADY_RENDERED,
112
114
  RENDER_FINAL_ALREADY_RENDERED_MESSAGE,
115
+ USE_CASE_NOTHING_KEPT,
116
+ USE_CASE_NOTHING_KEPT_MESSAGE,
113
117
  RUN_CONTINUATION_CODES,
114
118
  type RunContinuationCode,
115
119
  } from "../run-continuation.js"
@@ -18,6 +18,7 @@
18
18
  import { evaluateJsonPath, stringifyPathResults } from "./json-path.js"
19
19
  import { expandItemsWithRepeat } from "./repeat-types.js"
20
20
  import { isDefaultSelectorConfig, resolveIndex, selectListItems, type SelectorFields } from "./selector.js"
21
+ import { unitNonPromptInputs } from "./unit-contract-compose.js"
21
22
 
22
23
  /**
23
24
  * The text LANES the input resolvers route somewhere OTHER than the prompt slot
@@ -37,7 +38,7 @@ import { isDefaultSelectorConfig, resolveIndex, selectListItems, type SelectorFi
37
38
  * unlisted lane keeps the old behavior (the item is the prompt), so a miss can
38
39
  * only ever reproduce the old bug on that one lane, never a new one.
39
40
  */
40
- export const NON_PROMPT_TEXT_LANES: Readonly<Record<string, "*" | readonly string[]>> = {
41
+ const LEGACY_NON_PROMPT_TEXT_LANES: Readonly<Record<string, "*" | readonly string[]>> = {
41
42
  negative: "*",
42
43
  "system-prompt": "*",
43
44
  script: ["ai-avatar"],
@@ -47,6 +48,8 @@ export const NON_PROMPT_TEXT_LANES: Readonly<Record<string, "*" | readonly strin
47
48
  tracks: ["speaker-view"],
48
49
  silence: ["edit-plan"],
49
50
  offsets: ["edit-plan"],
51
+ // Camera Switch's speaker map (a Speaker Map result): who is on which camera, never a prompt.
52
+ speakerMap: ["camera-switch"],
50
53
  qrText: ["image-overlay"],
51
54
  layerPlan: ["video-overlay"],
52
55
  captionPlan: ["add-captions"],
@@ -55,8 +58,38 @@ export const NON_PROMPT_TEXT_LANES: Readonly<Record<string, "*" | readonly strin
55
58
  // the material it analyzes — a list of links fanned through it must not be
56
59
  // written into the material too.
57
60
  link: ["content-recipe"],
58
- // Tighten Episode's `music` is the bed's address (inputs.useCaseMusic), never a prompt.
59
- music: ["tighten-episode"],
61
+ }
62
+
63
+ /**
64
+ * The hand-written lanes ∪ the node units' `contract.nonPromptInputs` rows
65
+ * (generated/unit-contracts.ts): each unit type joins the list of every handle
66
+ * it names (a handle no list names yet gets one). A `"*"` lane already covers
67
+ * every type, so it stays as it is. A type listed twice for one handle throws
68
+ * at load — a type is hand-written or a node unit, never both.
69
+ */
70
+ export const NON_PROMPT_TEXT_LANES: Readonly<Record<string, "*" | readonly string[]>> = composeNonPromptLanes(LEGACY_NON_PROMPT_TEXT_LANES, unitNonPromptInputs())
71
+
72
+ function composeNonPromptLanes(
73
+ legacy: Readonly<Record<string, "*" | readonly string[]>>,
74
+ rows: ReadonlyArray<readonly [string, ReadonlyArray<string>]>,
75
+ ): Record<string, "*" | readonly string[]> {
76
+ const out: Record<string, "*" | readonly string[]> = { ...legacy }
77
+ for (const [type, handles] of rows) {
78
+ const own = new Set<string>()
79
+ for (const handle of handles) {
80
+ // A unit naming one handle twice in its own row is its own mistake, not a clash with the hand-written lanes.
81
+ if (own.has(handle)) throw new Error(`NON_PROMPT_TEXT_LANES: node unit ${type} lists "${handle}" twice in its contract.nonPromptInputs`)
82
+ own.add(handle)
83
+ const scope = Object.hasOwn(out, handle) ? out[handle] : []
84
+ if (scope === "*") continue
85
+ // Only the same handle clashes here: a unit hand-listed under a DIFFERENT
86
+ // handle is a string literal of a unit's id outside its folders, which
87
+ // G2 fails (frontend/src/__tests__/node-units-structure.test.ts).
88
+ if (scope.includes(type)) throw new Error(`NON_PROMPT_TEXT_LANES: ${type} is listed for "${handle}" both by hand and as a node unit — a type lives in one place`)
89
+ out[handle] = [...scope, type]
90
+ }
91
+ }
92
+ return out
60
93
  }
61
94
 
62
95
  /** Does a TEXT list wired to `targetHandle` of a `nodeType` node feed its prompt slot? */
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Generate Mask — text-prompted IMAGE segmentation (Grounded SAM). The wire
3
+ * contract of `POST /v1/generate-mask`, the `generate_mask` MCP verb, the SDK's
4
+ * `nodes.run("generate-mask", …)` and `nodaro media generate-mask`, defined ONCE:
5
+ * every bound the route schema and the SDK/CLI read.
6
+ *
7
+ * The finished job's output is `{ maskUrl, imageUrl }`: `maskUrl` is the
8
+ * black-and-white mask PNG (white = the subject), `imageUrl` is the SOURCE
9
+ * image passed through unchanged, so an inpainting step can take the pair.
10
+ *
11
+ * Wire contract only — no I/O.
12
+ */
13
+
14
+ export const GENERATE_MASK_LIMITS = {
15
+ /** Subject description length cap. */
16
+ PROMPT_MAX_LENGTH: 500,
17
+ /** Segmentation confidence bounds. */
18
+ THRESHOLD_MIN: 0,
19
+ THRESHOLD_MAX: 1,
20
+ /** Default segmentation confidence. Lower selects more (and less precise) regions. */
21
+ THRESHOLD_DEFAULT: 0.3,
22
+ } as const
23
+
24
+ /** `POST /v1/generate-mask` request body. */
25
+ export interface GenerateMaskRequest {
26
+ /** The image to segment. */
27
+ readonly imageUrl: string
28
+ /** What to select, in plain words (e.g. "the person", "sky and clouds"). 1–500 characters. */
29
+ readonly prompt: string
30
+ /** Segmentation confidence, `GENERATE_MASK_LIMITS.THRESHOLD_MIN`–`THRESHOLD_MAX` (default 0.3). */
31
+ readonly threshold?: number
32
+ }
33
+
34
+ /** A completed Generate Mask job's `output_data`. */
35
+ export interface GenerateMaskOutput {
36
+ /** The mask: a black-and-white PNG, white = the subject. */
37
+ readonly maskUrl: string
38
+ /** The source image, passed through unchanged. */
39
+ readonly imageUrl: string
40
+ }