@nodaro/shared 3.33.0 → 3.36.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 (266) hide show
  1. package/dist/{chunk-CK3GK34R.js → chunk-2HIDE3QV.js} +9 -3
  2. package/dist/chunk-2HIDE3QV.js.map +1 -0
  3. package/dist/{chunk-WDIBOWAA.js → chunk-2HVFF5SS.js} +6 -6
  4. package/dist/chunk-2HVFF5SS.js.map +1 -0
  5. package/dist/{chunk-PVJBAPYJ.js → chunk-56VQ7V3V.js} +8 -5
  6. package/dist/chunk-56VQ7V3V.js.map +1 -0
  7. package/dist/{chunk-Z2OL5AJD.cjs → chunk-6F6GGX2W.cjs} +4 -3
  8. package/dist/chunk-6F6GGX2W.cjs.map +1 -0
  9. package/dist/{chunk-HKFMXNVQ.cjs → chunk-75ZMA34U.cjs} +11 -11
  10. package/dist/{chunk-HKFMXNVQ.cjs.map → chunk-75ZMA34U.cjs.map} +1 -1
  11. package/dist/{chunk-6WZ2VN7V.js → chunk-7AB3AE5L.js} +6 -6
  12. package/dist/{chunk-6WZ2VN7V.js.map → chunk-7AB3AE5L.js.map} +1 -1
  13. package/dist/{chunk-VXPLKQWY.cjs → chunk-7VQPHLZ5.cjs} +30 -40
  14. package/dist/chunk-7VQPHLZ5.cjs.map +1 -0
  15. package/dist/{chunk-BG5D5CZ6.js → chunk-ANOQWAMU.js} +23 -6
  16. package/dist/chunk-ANOQWAMU.js.map +1 -0
  17. package/dist/{chunk-PRYE7AZQ.cjs → chunk-AWWOQH46.cjs} +7 -7
  18. package/dist/chunk-AWWOQH46.cjs.map +1 -0
  19. package/dist/{chunk-PXFQVLBX.js → chunk-AXUW64ZY.js} +26 -36
  20. package/dist/chunk-AXUW64ZY.js.map +1 -0
  21. package/dist/{chunk-FT5CF6IA.js → chunk-AZBIXGM5.js} +3 -3
  22. package/dist/{chunk-FT5CF6IA.js.map → chunk-AZBIXGM5.js.map} +1 -1
  23. package/dist/{chunk-D6GNRSCV.cjs → chunk-BBLE4UTG.cjs} +23 -6
  24. package/dist/chunk-BBLE4UTG.cjs.map +1 -0
  25. package/dist/{chunk-HUR6ZJ7S.cjs → chunk-BSQCKTXH.cjs} +6 -6
  26. package/dist/{chunk-HUR6ZJ7S.cjs.map → chunk-BSQCKTXH.cjs.map} +1 -1
  27. package/dist/{chunk-HGC5JNVA.cjs → chunk-BVVKMQKR.cjs} +9 -2
  28. package/dist/chunk-BVVKMQKR.cjs.map +1 -0
  29. package/dist/{chunk-SAW5OK36.cjs → chunk-BYP62B7F.cjs} +6 -6
  30. package/dist/{chunk-SAW5OK36.cjs.map → chunk-BYP62B7F.cjs.map} +1 -1
  31. package/dist/{chunk-YYV35XOS.js → chunk-C4R7BTBQ.js} +4 -3
  32. package/dist/chunk-C4R7BTBQ.js.map +1 -0
  33. package/dist/{chunk-UCFWI6D4.js → chunk-CMH2ACOX.js} +3 -3
  34. package/dist/{chunk-UCFWI6D4.js.map → chunk-CMH2ACOX.js.map} +1 -1
  35. package/dist/{chunk-WD6HJRBG.cjs → chunk-DE3PEIIP.cjs} +21 -21
  36. package/dist/{chunk-WD6HJRBG.cjs.map → chunk-DE3PEIIP.cjs.map} +1 -1
  37. package/dist/{chunk-SFW3UB2P.js → chunk-DKTRVOU5.js} +4 -4
  38. package/dist/{chunk-SFW3UB2P.js.map → chunk-DKTRVOU5.js.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-OZSACQ2V.js → chunk-GW54ANCH.js} +3 -3
  44. package/dist/{chunk-OZSACQ2V.js.map → chunk-GW54ANCH.js.map} +1 -1
  45. package/dist/chunk-GZH2SIOF.cjs +99 -0
  46. package/dist/chunk-GZH2SIOF.cjs.map +1 -0
  47. package/dist/{chunk-M7GQBRZU.cjs → chunk-HABDAHZR.cjs} +153 -24
  48. package/dist/chunk-HABDAHZR.cjs.map +1 -0
  49. package/dist/{chunk-CUH22J4D.js → chunk-IIGKJYWL.js} +3 -3
  50. package/dist/{chunk-CUH22J4D.js.map → chunk-IIGKJYWL.js.map} +1 -1
  51. package/dist/{chunk-JL4C5VJ7.cjs → chunk-J65CAOUV.cjs} +14 -2
  52. package/dist/chunk-J65CAOUV.cjs.map +1 -0
  53. package/dist/{chunk-HRXEZ3SX.cjs → chunk-JABZNRXL.cjs} +4 -4
  54. package/dist/{chunk-HRXEZ3SX.cjs.map → chunk-JABZNRXL.cjs.map} +1 -1
  55. package/dist/{chunk-5RYLK3MQ.js → chunk-JMUHMLJP.js} +11 -6
  56. package/dist/chunk-JMUHMLJP.js.map +1 -0
  57. package/dist/{chunk-K3LLGRK7.cjs → chunk-KOP7UTQR.cjs} +72 -15
  58. package/dist/chunk-KOP7UTQR.cjs.map +1 -0
  59. package/dist/{chunk-HC7VKIV5.cjs → chunk-LT5IJO4Y.cjs} +49 -46
  60. package/dist/chunk-LT5IJO4Y.cjs.map +1 -0
  61. package/dist/{chunk-VA42637J.cjs → chunk-MSDECC3A.cjs} +46 -41
  62. package/dist/chunk-MSDECC3A.cjs.map +1 -0
  63. package/dist/{chunk-JFS3NWZ5.cjs → chunk-MSIIC6MY.cjs} +7 -4
  64. package/dist/chunk-MSIIC6MY.cjs.map +1 -0
  65. package/dist/{chunk-D26ENTN2.cjs → chunk-NITAUX3A.cjs} +80 -52
  66. package/dist/chunk-NITAUX3A.cjs.map +1 -0
  67. package/dist/{chunk-23FJQTEA.js → chunk-NTHRTRQK.js} +38 -15
  68. package/dist/chunk-NTHRTRQK.js.map +1 -0
  69. package/dist/{chunk-OTATNBMD.js → chunk-NYMOHNYV.js} +3 -3
  70. package/dist/{chunk-OTATNBMD.js.map → chunk-NYMOHNYV.js.map} +1 -1
  71. package/dist/{chunk-PQHS255G.js → chunk-OHSIVNJO.js} +3 -3
  72. package/dist/chunk-OHSIVNJO.js.map +1 -0
  73. package/dist/{chunk-7Z5LUTGU.js → chunk-QXTCIJP5.js} +6 -3
  74. package/dist/{chunk-JFS3NWZ5.cjs.map → chunk-QXTCIJP5.js.map} +1 -1
  75. package/dist/{chunk-5PC6JBGJ.cjs → chunk-R2VF5NQG.cjs} +3 -3
  76. package/dist/chunk-R2VF5NQG.cjs.map +1 -0
  77. package/dist/{chunk-UTQSSKSG.js → chunk-SPP6HQMM.js} +4 -4
  78. package/dist/{chunk-UTQSSKSG.js.map → chunk-SPP6HQMM.js.map} +1 -1
  79. package/dist/chunk-TCBHVIMD.js +89 -0
  80. package/dist/chunk-TCBHVIMD.js.map +1 -0
  81. package/dist/{chunk-SES6GDBQ.cjs → chunk-UJJUX6NW.cjs} +59 -8
  82. package/dist/chunk-UJJUX6NW.cjs.map +1 -0
  83. package/dist/{chunk-ZRL2UFTH.cjs → chunk-V3N56Z2S.cjs} +101 -22
  84. package/dist/chunk-V3N56Z2S.cjs.map +1 -0
  85. package/dist/{chunk-PHZ23DP3.js → chunk-VRLRPGO7.js} +125 -12
  86. package/dist/chunk-VRLRPGO7.js.map +1 -0
  87. package/dist/{chunk-WKOIGLQX.cjs → chunk-VRUN5TG2.cjs} +8 -8
  88. package/dist/{chunk-WKOIGLQX.cjs.map → chunk-VRUN5TG2.cjs.map} +1 -1
  89. package/dist/{chunk-QA3MVQ32.js → chunk-W4GABGRD.js} +6 -6
  90. package/dist/chunk-W4GABGRD.js.map +1 -0
  91. package/dist/{chunk-M36G6SRP.js → chunk-WXNQMJ67.js} +14 -3
  92. package/dist/chunk-WXNQMJ67.js.map +1 -0
  93. package/dist/chunk-XJ3HJSO5.cjs +25 -0
  94. package/dist/chunk-XJ3HJSO5.cjs.map +1 -0
  95. package/dist/{chunk-XGFTL5XY.js → chunk-YHCG3HOR.js} +3 -3
  96. package/dist/{chunk-XGFTL5XY.js.map → chunk-YHCG3HOR.js.map} +1 -1
  97. package/dist/{chunk-VNQRI2RO.cjs → chunk-YN6AXDN5.cjs} +16 -16
  98. package/dist/{chunk-VNQRI2RO.cjs.map → chunk-YN6AXDN5.cjs.map} +1 -1
  99. package/dist/{chunk-2NQLSLSN.cjs → chunk-YNJ44IAL.cjs} +5 -5
  100. package/dist/{chunk-2NQLSLSN.cjs.map → chunk-YNJ44IAL.cjs.map} +1 -1
  101. package/dist/{chunk-ZL7UM6PU.cjs → chunk-YSEM7JDE.cjs} +4 -4
  102. package/dist/{chunk-ZL7UM6PU.cjs.map → chunk-YSEM7JDE.cjs.map} +1 -1
  103. package/dist/{chunk-ZO5PBBFX.js → chunk-ZG4XSEZV.js} +72 -15
  104. package/dist/chunk-ZG4XSEZV.js.map +1 -0
  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-I48SvalA.d.cts} +25 -0
  172. package/dist/{model-catalog-V-ZNzRSd.d.cts → model-catalog-I48SvalA.d.ts} +25 -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-catalog-totality.test.ts +15 -1
  200. package/src/__tests__/video-collapse-parity.test.ts +10 -0
  201. package/src/__tests__/video-frame-slot.test.ts +85 -0
  202. package/src/__tests__/video-mode-aliases.test.ts +1 -0
  203. package/src/__tests__/video-reference-only.test.ts +117 -0
  204. package/src/__tests__/vidu-q4-catalog.test.ts +230 -0
  205. package/src/camera-switch-contract.ts +36 -2
  206. package/src/credit-identifiers.ts +19 -6
  207. package/src/entity-asset-types.ts +13 -0
  208. package/src/entries/edl.ts +2 -0
  209. package/src/entries/llm-models.ts +5 -0
  210. package/src/entries/media.ts +1 -0
  211. package/src/entries/models.ts +25 -0
  212. package/src/entries/nodes.ts +5 -1
  213. package/src/fan-out-rows.ts +36 -3
  214. package/src/generate-mask.ts +40 -0
  215. package/src/generated/unit-contracts.ts +58 -0
  216. package/src/i18n/types.ts +13 -2
  217. package/src/json-kinds.ts +24 -4
  218. package/src/llm-models.ts +184 -31
  219. package/src/meta-ads-scrape.ts +16 -8
  220. package/src/model-catalog.ts +91 -13
  221. package/src/model-constants.ts +260 -5
  222. package/src/node-default-mappings.ts +3 -0
  223. package/src/node-preset-extract.ts +8 -0
  224. package/src/pipeline-types.ts +3 -0
  225. package/src/presentation-utils.ts +12 -12
  226. package/src/preview-gate.ts +4 -2
  227. package/src/producer-types.ts +19 -19
  228. package/src/run-continuation.ts +26 -4
  229. package/src/speaker-layouts.ts +8 -3
  230. package/src/speaker-map-contract.ts +77 -0
  231. package/src/unit-contract-compose.ts +55 -0
  232. package/src/use-case-types.ts +19 -0
  233. package/src/video-ui-defaults.ts +7 -5
  234. package/dist/chunk-23FJQTEA.js.map +0 -1
  235. package/dist/chunk-5PC6JBGJ.cjs.map +0 -1
  236. package/dist/chunk-5RYLK3MQ.js.map +0 -1
  237. package/dist/chunk-7Z5LUTGU.js.map +0 -1
  238. package/dist/chunk-BG5D5CZ6.js.map +0 -1
  239. package/dist/chunk-CK3GK34R.js.map +0 -1
  240. package/dist/chunk-D26ENTN2.cjs.map +0 -1
  241. package/dist/chunk-D6GNRSCV.cjs.map +0 -1
  242. package/dist/chunk-HC7VKIV5.cjs.map +0 -1
  243. package/dist/chunk-HGC5JNVA.cjs.map +0 -1
  244. package/dist/chunk-JL4C5VJ7.cjs.map +0 -1
  245. package/dist/chunk-K3LLGRK7.cjs.map +0 -1
  246. package/dist/chunk-M36G6SRP.js.map +0 -1
  247. package/dist/chunk-M7GQBRZU.cjs.map +0 -1
  248. package/dist/chunk-PHZ23DP3.js.map +0 -1
  249. package/dist/chunk-PQHS255G.js.map +0 -1
  250. package/dist/chunk-PRYE7AZQ.cjs.map +0 -1
  251. package/dist/chunk-PVJBAPYJ.js.map +0 -1
  252. package/dist/chunk-PXFQVLBX.js.map +0 -1
  253. package/dist/chunk-QA3MVQ32.js.map +0 -1
  254. package/dist/chunk-SES6GDBQ.cjs.map +0 -1
  255. package/dist/chunk-TU33KYKW.cjs +0 -25
  256. package/dist/chunk-TU33KYKW.cjs.map +0 -1
  257. package/dist/chunk-VA42637J.cjs.map +0 -1
  258. package/dist/chunk-VXPLKQWY.cjs.map +0 -1
  259. package/dist/chunk-WDIBOWAA.js.map +0 -1
  260. package/dist/chunk-YBPBK5KI.js.map +0 -1
  261. package/dist/chunk-YYV35XOS.js.map +0 -1
  262. package/dist/chunk-Z2OL5AJD.cjs.map +0 -1
  263. package/dist/chunk-ZDFHA2EC.js.map +0 -1
  264. package/dist/chunk-ZO5PBBFX.js.map +0 -1
  265. package/dist/chunk-ZRL2UFTH.cjs.map +0 -1
  266. package/src/__tests__/__snapshots__/prompt-builder-segments.test.ts.snap +0 -65
@@ -27,14 +27,29 @@ export const CONTINUATION_NOT_COMPLETED = "continuation_not_completed"
27
27
  * on the execution's output. */
28
28
  export const CONTINUATION_SUBSET_REQUIRED = "continuation_subset_required"
29
29
 
30
- /** A continue-from-failed run (use-case nodes) needs an execution that ended
31
- * `failed`: a completed run has nothing to resume, a running one is not over. */
30
+ /** A continue-from-failed run (a use-case node's, or a saved workflow's) needs
31
+ * an execution that ended `failed`: a completed run has nothing to resume, a
32
+ * running one is not over. */
32
33
  export const CONTINUATION_NOT_FAILED = "continuation_not_failed"
33
34
 
34
- /** A continue-from-failed (use-case nodes) of a run a later continuation of
35
- * it has superseded — that later one failed too: continue it instead. */
35
+ /** A continue-from-failed of a run a later continuation of it has superseded
36
+ * — that later one failed too: continue it instead. A saved workflow's run
37
+ * also answers it when a later continuation completed everything the run left
38
+ * (the work is done; its results are on that run). */
36
39
  export const CONTINUATION_SUPERSEDED = "continuation_superseded"
37
40
 
41
+ /** A continue-from-failed of a saved workflow's run whose lineage's newest
42
+ * continuation COMPLETED by stopping at a Preview review — of an Apply EDL
43
+ * render, or of a use-case node with review on (Tighten Episode): continuing
44
+ * again would only stop at the same Preview. The answer names that execution
45
+ * (`executionId`), its renders (`renderNodeIds`) and its use-case nodes
46
+ * (`reviewNodeIds`), and the run that finishes them (`next`:
47
+ * `continueFromExecutionId`, `nodeIds`, `inputOverrides`, to send to `/run`):
48
+ * for one render, its Render final (`renderFinal` with
49
+ * `continueFromExecutionId` set to that execution) is the same run. A
50
+ * continue-from-failed after it builds on that run. */
51
+ export const CONTINUATION_PREVIEW_PENDING = "continuation_preview_pending"
52
+
38
53
  /** A continue-from-failed (use-case nodes) of a failed run whose wrapper is not
39
54
  * settled yet (its fee not yet refunded): ask again in a moment. A retry
40
55
  * answer, not a refusal — outside `RUN_CONTINUATION_CODES`. */
@@ -46,6 +61,12 @@ export const CONTINUATION_SETTLING = "continuation_settling"
46
61
  export const RENDER_FINAL_ALREADY_RENDERED = "render_final_already_rendered"
47
62
  export const RENDER_FINAL_ALREADY_RENDERED_MESSAGE = "Already rendered with this edit."
48
63
 
64
+ /** A Render final (use-case nodes) of a clip pack whose review dropped every
65
+ * clip: there is nothing to render, so nothing runs and nothing is charged.
66
+ * A refusal of the request, outside `RUN_CONTINUATION_CODES`. */
67
+ export const USE_CASE_NOTHING_KEPT = "use_case_nothing_kept"
68
+ export const USE_CASE_NOTHING_KEPT_MESSAGE = "Every clip was dropped in the review: keep at least one clip to render the final."
69
+
49
70
  /** Every continuation refusal code. */
50
71
  export const RUN_CONTINUATION_CODES = [
51
72
  CONTINUATION_NOT_FOUND,
@@ -55,6 +76,7 @@ export const RUN_CONTINUATION_CODES = [
55
76
  CONTINUATION_SUBSET_REQUIRED,
56
77
  CONTINUATION_NOT_FAILED,
57
78
  CONTINUATION_SUPERSEDED,
79
+ CONTINUATION_PREVIEW_PENDING,
58
80
  ] as const
59
81
 
60
82
  export type RunContinuationCode = (typeof RUN_CONTINUATION_CODES)[number]
@@ -78,8 +78,13 @@ export function speakerSwitchOverlaps(type: string): boolean {
78
78
  return typeof type === "string" && type.startsWith(XFADE_SWITCH_PREFIX)
79
79
  }
80
80
 
81
+ /** A Speaker View switch id: `cut`, `pan`, `zoom`, or `xfade:<combine transition id>`
82
+ * (one per real ffmpeg xfade transition — `SPEAKER_SWITCH_IDS` lists them). Every
83
+ * sheet below is built from one, so a new switch outside this shape fails to compile. */
84
+ export type SpeakerSwitchId = "cut" | "pan" | "zoom" | `${typeof XFADE_SWITCH_PREFIX}${string}`
85
+
81
86
  export interface SpeakerSwitchSheet {
82
- /** "cut" | "pan" | "zoom" | `xfade:${combine id}` */
87
+ /** "cut" | "pan" | "zoom" | `xfade:${combine id}` (a `SpeakerSwitchId`) */
83
88
  readonly id: string
84
89
  /** = `speakerSwitchOverlaps(id)`, derived, never hand-set. */
85
90
  readonly overlaps: boolean
@@ -87,7 +92,7 @@ export interface SpeakerSwitchSheet {
87
92
  readonly requiresSameSource: boolean
88
93
  }
89
94
 
90
- const switchSheet = (id: string, requiresSameSource: boolean): SpeakerSwitchSheet => ({
95
+ const switchSheet = (id: SpeakerSwitchId, requiresSameSource: boolean): SpeakerSwitchSheet => ({
91
96
  id,
92
97
  overlaps: speakerSwitchOverlaps(id),
93
98
  requiresSameSource,
@@ -101,7 +106,7 @@ export const SPEAKER_SWITCHES: readonly SpeakerSwitchSheet[] = [
101
106
  switchSheet("cut", false),
102
107
  switchSheet("pan", true),
103
108
  switchSheet("zoom", false),
104
- ...COMBINE_TRANSITIONS.filter((t) => t.xfade !== null).map((t) => switchSheet(XFADE_SWITCH_PREFIX + t.id, false)),
109
+ ...COMBINE_TRANSITIONS.filter((t) => t.xfade !== null).map((t) => switchSheet(`${XFADE_SWITCH_PREFIX}${t.id}`, false)),
105
110
  ]
106
111
 
107
112
  export const SPEAKER_SWITCH_IDS: readonly string[] = SPEAKER_SWITCHES.map((s) => s.id)
@@ -0,0 +1,77 @@
1
+ /**
2
+ * speaker-map (podcast use-case nodes, decided 2026-10-12/17) — which camera
3
+ * each speaker is on, worked out from the cameras' own microphones: the
4
+ * structural pieces every caller shares (the canvas engines, MCP, the SDK).
5
+ * HOW the levels are compared is the server's. Pure, no I/O.
6
+ */
7
+ import type { Edl } from "./edl.js"
8
+
9
+ export const SPEAKER_MAP_VERSION = 1 as const
10
+ /** Recordings one run reads (cameras, plus the master when it also emits the edit). */
11
+ export const SPEAKER_MAP_MAX_SOURCES = 6
12
+ /** Candidate cameras a comparison needs. */
13
+ export const SPEAKER_MAP_MIN_CAMERAS = 2
14
+ /** How far the loudest camera must beat the next for the speaker to get it. */
15
+ export const SPEAKER_MAP_DEFAULT_MARGIN_DB = 3
16
+
17
+ export interface SpeakerMapConfidence {
18
+ /** The camera the speaker got; "" = none clear (shown on the wide shot). */
19
+ readonly camera: string
20
+ /** The loudest camera's lead over the next, in dB; null when there was nothing to compare. */
21
+ readonly marginDb: number | null
22
+ }
23
+
24
+ export interface SpeakerMapResult {
25
+ readonly version: typeof SPEAKER_MAP_VERSION
26
+ /** Transcript speaker label → camera source id; "" = no camera of their own. Feeds Camera Switch's `speakerMap`. */
27
+ readonly speakerMap: Readonly<Record<string, string>>
28
+ readonly confidence: Readonly<Record<string, SpeakerMapConfidence>>
29
+ readonly notes: readonly string[]
30
+ /** The recordings as one edit on the master clock (offsets applied, roles and speakers set, one segment). */
31
+ readonly edl?: Edl
32
+ }
33
+
34
+ const parse = (raw: unknown): unknown => {
35
+ if (typeof raw !== "string") return raw
36
+ try { return JSON.parse(raw) } catch { return undefined }
37
+ }
38
+ const isRecord = (v: unknown): v is Record<string, unknown> => !!v && typeof v === "object" && !Array.isArray(v)
39
+
40
+ const isConfidence = (v: unknown): boolean =>
41
+ isRecord(v) && typeof v.camera === "string" && (v.marginDb === null || (typeof v.marginDb === "number" && Number.isFinite(v.marginDb)))
42
+
43
+ /** A Speaker Map result (an object or its JSON string), or null when it is not
44
+ * one: every map value and confidence camera a string, every margin a finite
45
+ * number or null, every note a string — so a reader can trust each field. */
46
+ export function speakerMapResultOf(raw: unknown): SpeakerMapResult | null {
47
+ const v = parse(raw)
48
+ if (!isRecord(v) || v.version !== SPEAKER_MAP_VERSION || !isRecord(v.speakerMap) || !isRecord(v.confidence) || !Array.isArray(v.notes)) return null
49
+ if (!Object.values(v.speakerMap).every((c) => typeof c === "string")) return null
50
+ if (!Object.values(v.confidence).every(isConfidence)) return null
51
+ if (!v.notes.every((n) => typeof n === "string")) return null
52
+ return v as unknown as SpeakerMapResult
53
+ }
54
+
55
+ /** An ordinal key: a whole number from 1, written plainly ("1", "12" — never " 1", "01", "1.0", "1e0"). */
56
+ const ORDINAL = /^[1-9]\d*$/
57
+
58
+ /**
59
+ * The override keyed by ordinal ("1" = the first voice heard) as a map keyed
60
+ * by the transcript's own labels. `labels` is the transcript's speakers in
61
+ * first-heard order — the caller passes `transcriptSpeakerLabels(transcript)`,
62
+ * so this module imports nothing from camera-switch-contract (one import
63
+ * direction: camera-switch-contract → speaker-map-contract, no cycle for the
64
+ * structure ratchet). An ordinal past the transcript's speakers maps nobody,
65
+ * and so do a key that is not a plain ordinal and an override that is not an
66
+ * object (a hand-written workflow).
67
+ */
68
+ export function speakerMapByOrdinal(labels: readonly string[], byOrder: Readonly<Record<string, string>> | undefined): Record<string, string> {
69
+ if (!isRecord(byOrder)) return {}
70
+ const out: Record<string, string> = {}
71
+ for (const [ordinal, camera] of Object.entries(byOrder)) {
72
+ if (!ORDINAL.test(ordinal)) continue
73
+ const label = labels[Number(ordinal) - 1]
74
+ if (label !== undefined && typeof camera === "string") out[label] = camera
75
+ }
76
+ return out
77
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * The node units' rows in @nodaro/shared (tools/units/README.md): the readers
3
+ * of `generated/unit-contracts.ts` and the one rule every table that composes
4
+ * them keeps — a type is hand-written or a node unit, never both. Internal:
5
+ * no entry exports this module, so it adds nothing to the published surface;
6
+ * the tables that compose its rows (producer-types, presentation-utils,
7
+ * json-kinds, fan-out-rows, preview-gate) are what consumers read.
8
+ */
9
+ import { UNIT_CONTRACTS, UNIT_FAN_OUT_EACH, UNIT_JSON_PIPS, UNIT_NON_PROMPT_INPUTS, UNIT_PRESENTS, UNIT_REVIEW_HOLDS } from "./generated/unit-contracts.js"
10
+
11
+ /**
12
+ * `legacy ∪ units` as a set, `legacy` first, refusing a type that is in both —
13
+ * a type lives in one place (G1; the editor's and the server's composeSet keep
14
+ * the same rule). Throws at module load, so any import of the set fails.
15
+ */
16
+ export function composeUnitSet(what: string, legacy: readonly string[], units: readonly string[]): ReadonlySet<string> {
17
+ const clash = units.filter((t) => legacy.includes(t))
18
+ if (clash.length > 0) throw new Error(`${what}: ${clash.join(", ")} is both hand-written and a node unit — a type lives in one place (tools/units/README.md)`)
19
+ return new Set([...legacy, ...units])
20
+ }
21
+
22
+ /**
23
+ * `legacy` with each unit row added after it, refusing a type that is in both
24
+ * or a unit row given twice — the record twin of `composeUnitSet`. Throws at
25
+ * module load, so any import of the record fails.
26
+ */
27
+ export function composeUnitRecord<V>(what: string, legacy: Readonly<Record<string, V>>, units: ReadonlyArray<readonly [string, V]>): Readonly<Record<string, V>> {
28
+ const out: Record<string, V> = { ...legacy }
29
+ for (const [type, value] of units) {
30
+ if (Object.hasOwn(legacy, type)) throw new Error(`${what}: ${type} is both hand-written and a node unit — a type lives in one place (tools/units/README.md)`)
31
+ if (Object.hasOwn(out, type)) throw new Error(`${what}: node unit ${type} has more than one row`)
32
+ out[type] = value
33
+ }
34
+ return out
35
+ }
36
+
37
+ /** The node units of one producer kind (`contract.producer`), in generated order. */
38
+ export const unitProducers = (kind: "audio" | "video" | "image" | "dynamic"): string[] =>
39
+ UNIT_CONTRACTS.filter(([, producer]) => producer === kind).map(([type]) => type)
40
+
41
+ /** The node units a published app shows as `kind` (`contract.presents`). */
42
+ export const unitsPresenting = (kind: "image" | "video" | "audio" | "text"): string[] =>
43
+ UNIT_PRESENTS.filter(([, presents]) => presents === kind).map(([type]) => type)
44
+
45
+ /** What each node unit's JSON (look) output pips carry (`contract.jsonPips`). */
46
+ export const unitJsonPips = (): ReadonlyArray<readonly [string, Readonly<Record<string, "transcript" | "edl" | "other">>]> => UNIT_JSON_PIPS
47
+
48
+ /** Each node unit's input pips that are never a prompt lane (`contract.nonPromptInputs`). */
49
+ export const unitNonPromptInputs = (): ReadonlyArray<readonly [string, ReadonlyArray<string>]> => UNIT_NON_PROMPT_INPUTS
50
+
51
+ /** The use-case units whose review-on run ends at a Preview that holds what follows (`contract.reviewHold`). */
52
+ export const unitReviewHolds = (): readonly string[] => UNIT_REVIEW_HOLDS
53
+
54
+ /** Each node unit's fan-out "each" outputs and primary pip (`contract.fanOutEach`), in generated order. */
55
+ export const unitFanOutEach = (): ReadonlyArray<readonly [string, { readonly each: ReadonlyArray<string>; readonly primary: string }]> => UNIT_FAN_OUT_EACH
@@ -0,0 +1,19 @@
1
+ import { UNIT_USE_CASE_TYPES } from "./generated/unit-contracts.js"
2
+
3
+ /**
4
+ * The use-case node types — each a route (`POST /v1/<type>`, `/estimate`,
5
+ * and `POST /v1/<type>/continue` to continue one of its runs): the node units
6
+ * whose execution.kind is "use-case" (generated/unit-contracts.ts), in their
7
+ * position order, the order every list of the types shows.
8
+ */
9
+ export const USE_CASE_NODE_TYPES = UNIT_USE_CASE_TYPES
10
+ export type UseCaseNodeType = (typeof USE_CASE_NODE_TYPES)[number]
11
+
12
+ /** Is `type` a use-case node type? Anything that is not one of the strings above is not (an object key like "constructor" included). */
13
+ export function isUseCaseNodeType(type: unknown): type is UseCaseNodeType {
14
+ return typeof type === "string" && (USE_CASE_NODE_TYPES as readonly string[]).includes(type)
15
+ }
16
+
17
+ if (new Set(USE_CASE_NODE_TYPES).size !== USE_CASE_NODE_TYPES.length) {
18
+ throw new Error(`USE_CASE_NODE_TYPES: ${USE_CASE_NODE_TYPES.join(", ")} lists a type twice — a type is one node unit`)
19
+ }
@@ -15,7 +15,8 @@
15
15
  * billing default differs from `resolutions[0]`; three surfaces then had to
16
16
  * agree, so they live here.
17
17
  *
18
- * The resolution fill is per-family ON PURPOSE. Wan 3.0 reads its DECLARED
18
+ * The resolution fill is per-family ON PURPOSE. Wan 3.0 (and Vidu Q4, whose
19
+ * ascending list starts at 540p) reads its DECLARED
19
20
  * billing default (PRICING_DEFAULT_RESOLUTION = 720p) because its catalog list
20
21
  * is ascending, so an index-0 fill would write 480p — a tier both `runWan3`
21
22
  * (which renders 720P) and the credit identifier (which bills the 720p row)
@@ -32,6 +33,7 @@ import {
32
33
  isSeedance2Provider,
33
34
  isMinimaxH3Provider,
34
35
  isWan3Provider,
36
+ isViduQ4Provider,
35
37
  isGeminiOmniProvider,
36
38
  } from "./model-constants.js"
37
39
  import { MODEL_CATALOG } from "./model-catalog.js"
@@ -46,7 +48,7 @@ export function uiAspectRatioFill(provider: string): string | undefined {
46
48
  /** See the file docstring — per-family on purpose; never a generic
47
49
  * PRICING_DEFAULT_RESOLUTION read (that would reprice seedance-2-5). */
48
50
  export function uiResolutionFill(provider: string): string | undefined {
49
- if (isWan3Provider(provider)) return PRICING_DEFAULT_RESOLUTION[provider]
51
+ if (isWan3Provider(provider) || isViduQ4Provider(provider)) return PRICING_DEFAULT_RESOLUTION[provider]
50
52
  if (isSeedance2Provider(provider)) return MODEL_CATALOG[provider]?.resolutions?.[0]
51
53
  return undefined
52
54
  }
@@ -55,12 +57,12 @@ export function uiResolutionFill(provider: string): string | undefined {
55
57
  * Duration the node RENDERS and BILLS when `data.duration` is unset, for the
56
58
  * families whose credit identifier declares a duration fallback that is NOT
57
59
  * `durations[0]`. Wan 3.0's bare identifier is the 5s tier while its ladder
58
- * starts at 2s; the Gemini Omni family's is the 8s tier while its ladder starts
59
- * at 4s. Everyone else falls back to the first listed duration, so this returns
60
+ * starts at 2s; Vidu Q4's is the 5s tier while its ladder starts at 3s; the
61
+ * Gemini Omni family's is the 8s tier while its ladder starts at 4s. Everyone else falls back to the first listed duration, so this returns
60
62
  * undefined and the caller keeps `durations[0]`.
61
63
  */
62
64
  export function uiDurationFill(provider: string): number | undefined {
63
- if (isWan3Provider(provider)) return 5
65
+ if (isWan3Provider(provider) || isViduQ4Provider(provider)) return 5
64
66
  if (isGeminiOmniProvider(provider)) return 8
65
67
  return undefined
66
68
  }