@nodaro/shared 3.31.0 → 3.32.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 (372) hide show
  1. package/README.md +17 -0
  2. package/dist/chunk-2NIQO2J3.cjs +54 -0
  3. package/dist/chunk-2NIQO2J3.cjs.map +1 -0
  4. package/dist/chunk-2OJIVO7R.cjs +32 -0
  5. package/dist/chunk-2OJIVO7R.cjs.map +1 -0
  6. package/dist/chunk-2RF4Z7KG.cjs +803 -0
  7. package/dist/chunk-2RF4Z7KG.cjs.map +1 -0
  8. package/dist/chunk-3CUFITU7.js +1905 -0
  9. package/dist/chunk-3CUFITU7.js.map +1 -0
  10. package/dist/chunk-3RYKIUAE.js +86 -0
  11. package/dist/chunk-3RYKIUAE.js.map +1 -0
  12. package/dist/chunk-44I73CQS.cjs +194 -0
  13. package/dist/chunk-44I73CQS.cjs.map +1 -0
  14. package/dist/chunk-5AUSSJIM.cjs +3372 -0
  15. package/dist/chunk-5AUSSJIM.cjs.map +1 -0
  16. package/dist/chunk-5PC6JBGJ.cjs +1419 -0
  17. package/dist/chunk-5PC6JBGJ.cjs.map +1 -0
  18. package/dist/chunk-5RU2HCW2.js +30 -0
  19. package/dist/chunk-5RU2HCW2.js.map +1 -0
  20. package/dist/chunk-5THUHJ3E.js +46 -0
  21. package/dist/chunk-5THUHJ3E.js.map +1 -0
  22. package/dist/chunk-5U7VLG43.js +141 -0
  23. package/dist/chunk-5U7VLG43.js.map +1 -0
  24. package/dist/chunk-6DAWSVX2.cjs +103 -0
  25. package/dist/chunk-6DAWSVX2.cjs.map +1 -0
  26. package/dist/chunk-6DKDOWBL.js +1567 -0
  27. package/dist/chunk-6DKDOWBL.js.map +1 -0
  28. package/dist/chunk-6IJOPRZP.cjs +197 -0
  29. package/dist/chunk-6IJOPRZP.cjs.map +1 -0
  30. package/dist/chunk-7G7G42KS.js +86 -0
  31. package/dist/chunk-7G7G42KS.js.map +1 -0
  32. package/dist/chunk-AINCI23X.js +2171 -0
  33. package/dist/chunk-AINCI23X.js.map +1 -0
  34. package/dist/chunk-AROWPFO2.js +773 -0
  35. package/dist/chunk-AROWPFO2.js.map +1 -0
  36. package/dist/chunk-AVQK77G6.cjs +2000 -0
  37. package/dist/chunk-AVQK77G6.cjs.map +1 -0
  38. package/dist/chunk-C57NEO3X.js +3327 -0
  39. package/dist/chunk-C57NEO3X.js.map +1 -0
  40. package/dist/chunk-CK3GK34R.js +1381 -0
  41. package/dist/chunk-CK3GK34R.js.map +1 -0
  42. package/dist/chunk-E2TGXG6X.cjs +1770 -0
  43. package/dist/chunk-E2TGXG6X.cjs.map +1 -0
  44. package/dist/chunk-EK362Q45.cjs +38 -0
  45. package/dist/chunk-EK362Q45.cjs.map +1 -0
  46. package/dist/chunk-FBV5DF6D.js +95 -0
  47. package/dist/chunk-FBV5DF6D.js.map +1 -0
  48. package/dist/chunk-FG4E7MTG.cjs +4 -0
  49. package/dist/chunk-FG4E7MTG.cjs.map +1 -0
  50. package/dist/chunk-G6IIVKMO.js +26 -0
  51. package/dist/chunk-G6IIVKMO.js.map +1 -0
  52. package/dist/chunk-HGC5JNVA.cjs +1503 -0
  53. package/dist/chunk-HGC5JNVA.cjs.map +1 -0
  54. package/dist/chunk-HSHCCBIV.js +255 -0
  55. package/dist/chunk-HSHCCBIV.js.map +1 -0
  56. package/dist/chunk-IEBZHTPE.js +254 -0
  57. package/dist/chunk-IEBZHTPE.js.map +1 -0
  58. package/dist/chunk-ISJDAFKS.js +1604 -0
  59. package/dist/chunk-ISJDAFKS.js.map +1 -0
  60. package/dist/chunk-J6KHW2E5.cjs +1963 -0
  61. package/dist/chunk-J6KHW2E5.cjs.map +1 -0
  62. package/dist/chunk-J7BMO73N.cjs +114 -0
  63. package/dist/chunk-J7BMO73N.cjs.map +1 -0
  64. package/dist/chunk-JL4C5VJ7.cjs +488 -0
  65. package/dist/chunk-JL4C5VJ7.cjs.map +1 -0
  66. package/dist/chunk-JSGIEF6Z.cjs +1087 -0
  67. package/dist/chunk-JSGIEF6Z.cjs.map +1 -0
  68. package/dist/chunk-JSNV5O2F.cjs +34 -0
  69. package/dist/chunk-JSNV5O2F.cjs.map +1 -0
  70. package/dist/chunk-JWA5SGCS.js +203 -0
  71. package/dist/chunk-JWA5SGCS.js.map +1 -0
  72. package/dist/chunk-JX5YZ4DH.cjs +430 -0
  73. package/dist/chunk-JX5YZ4DH.cjs.map +1 -0
  74. package/dist/chunk-KHCBJ7KD.js +42 -0
  75. package/dist/chunk-KHCBJ7KD.js.map +1 -0
  76. package/dist/chunk-KU6S7IYV.cjs +210 -0
  77. package/dist/chunk-KU6S7IYV.cjs.map +1 -0
  78. package/dist/chunk-LKAIXWK3.js +181 -0
  79. package/dist/chunk-LKAIXWK3.js.map +1 -0
  80. package/dist/chunk-LPW3XNC2.js +471 -0
  81. package/dist/chunk-LPW3XNC2.js.map +1 -0
  82. package/dist/chunk-M36G6SRP.js +447 -0
  83. package/dist/chunk-M36G6SRP.js.map +1 -0
  84. package/dist/chunk-MRXGWL42.cjs +4 -0
  85. package/dist/chunk-MRXGWL42.cjs.map +1 -0
  86. package/dist/chunk-NB72XWXQ.cjs +54 -0
  87. package/dist/chunk-NB72XWXQ.cjs.map +1 -0
  88. package/dist/chunk-NEJ2PV4C.cjs +211 -0
  89. package/dist/chunk-NEJ2PV4C.cjs.map +1 -0
  90. package/dist/chunk-NT6IJH4L.cjs +273 -0
  91. package/dist/chunk-NT6IJH4L.cjs.map +1 -0
  92. package/dist/chunk-O5MP52U2.cjs +526 -0
  93. package/dist/chunk-O5MP52U2.cjs.map +1 -0
  94. package/dist/chunk-O7PUQLJ3.cjs +818 -0
  95. package/dist/chunk-O7PUQLJ3.cjs.map +1 -0
  96. package/dist/chunk-PQHS255G.js +1369 -0
  97. package/dist/chunk-PQHS255G.js.map +1 -0
  98. package/dist/chunk-PRYE7AZQ.cjs +1227 -0
  99. package/dist/chunk-PRYE7AZQ.cjs.map +1 -0
  100. package/dist/chunk-Q4CDQ2KO.js +21 -0
  101. package/dist/chunk-Q4CDQ2KO.js.map +1 -0
  102. package/dist/chunk-QELDJGDK.cjs +1714 -0
  103. package/dist/chunk-QELDJGDK.cjs.map +1 -0
  104. package/dist/chunk-QJRP44ZO.js +769 -0
  105. package/dist/chunk-QJRP44ZO.js.map +1 -0
  106. package/dist/chunk-QNGNOU4Z.js +29 -0
  107. package/dist/chunk-QNGNOU4Z.js.map +1 -0
  108. package/dist/chunk-RJL7RCEM.cjs +159 -0
  109. package/dist/chunk-RJL7RCEM.cjs.map +1 -0
  110. package/dist/chunk-RN3RMBJZ.js +1164 -0
  111. package/dist/chunk-RN3RMBJZ.js.map +1 -0
  112. package/dist/chunk-S5DMKUWK.cjs +1273 -0
  113. package/dist/chunk-S5DMKUWK.cjs.map +1 -0
  114. package/dist/chunk-SES6GDBQ.cjs +624 -0
  115. package/dist/chunk-SES6GDBQ.cjs.map +1 -0
  116. package/dist/chunk-TNPDV7I4.cjs +2346 -0
  117. package/dist/chunk-TNPDV7I4.cjs.map +1 -0
  118. package/dist/chunk-TZBIY5C3.js +187 -0
  119. package/dist/chunk-TZBIY5C3.js.map +1 -0
  120. package/dist/chunk-TZE673G6.js +3 -0
  121. package/dist/chunk-TZE673G6.js.map +1 -0
  122. package/dist/chunk-ULXI7A6Q.cjs +1047 -0
  123. package/dist/chunk-ULXI7A6Q.cjs.map +1 -0
  124. package/dist/chunk-VIWSWVAW.js +1782 -0
  125. package/dist/chunk-VIWSWVAW.js.map +1 -0
  126. package/dist/chunk-VWGNPMJZ.cjs +19 -0
  127. package/dist/chunk-VWGNPMJZ.cjs.map +1 -0
  128. package/dist/chunk-WDIBOWAA.js +1054 -0
  129. package/dist/chunk-WDIBOWAA.js.map +1 -0
  130. package/dist/chunk-WNG7HRVA.cjs +25 -0
  131. package/dist/chunk-WNG7HRVA.cjs.map +1 -0
  132. package/dist/chunk-WNVQ3SMB.cjs +96 -0
  133. package/dist/chunk-WNVQ3SMB.cjs.map +1 -0
  134. package/dist/chunk-WRSWH7US.cjs +285 -0
  135. package/dist/chunk-WRSWH7US.cjs.map +1 -0
  136. package/dist/chunk-XAMC4S53.js +17 -0
  137. package/dist/chunk-XAMC4S53.js.map +1 -0
  138. package/dist/chunk-XNISPHTZ.js +1039 -0
  139. package/dist/chunk-XNISPHTZ.js.map +1 -0
  140. package/dist/chunk-Y2PM3FFL.js +3 -0
  141. package/dist/chunk-Y2PM3FFL.js.map +1 -0
  142. package/dist/chunk-YBPBK5KI.js +1030 -0
  143. package/dist/chunk-YBPBK5KI.js.map +1 -0
  144. package/dist/chunk-YHRG7UOC.js +31 -0
  145. package/dist/chunk-YHRG7UOC.js.map +1 -0
  146. package/dist/chunk-YWNYGYI7.cjs +31 -0
  147. package/dist/chunk-YWNYGYI7.cjs.map +1 -0
  148. package/dist/chunk-YYV35XOS.js +122 -0
  149. package/dist/chunk-YYV35XOS.js.map +1 -0
  150. package/dist/chunk-Z2OL5AJD.cjs +133 -0
  151. package/dist/chunk-Z2OL5AJD.cjs.map +1 -0
  152. package/dist/chunk-Z4AZW6FY.js +920 -0
  153. package/dist/chunk-Z4AZW6FY.js.map +1 -0
  154. package/dist/chunk-ZDFHA2EC.js +572 -0
  155. package/dist/chunk-ZDFHA2EC.js.map +1 -0
  156. package/dist/chunk-ZNZDQAXN.js +175 -0
  157. package/dist/chunk-ZNZDQAXN.js.map +1 -0
  158. package/dist/chunk-ZRL2UFTH.cjs +1073 -0
  159. package/dist/chunk-ZRL2UFTH.cjs.map +1 -0
  160. package/dist/chunk-ZT77RY6R.js +404 -0
  161. package/dist/chunk-ZT77RY6R.js.map +1 -0
  162. package/dist/entries/apps.cjs +155 -0
  163. package/dist/entries/apps.cjs.map +1 -0
  164. package/dist/entries/apps.d.cts +283 -0
  165. package/dist/entries/apps.d.ts +283 -0
  166. package/dist/entries/apps.js +10 -0
  167. package/dist/entries/apps.js.map +1 -0
  168. package/dist/entries/captions.cjs +124 -0
  169. package/dist/entries/captions.cjs.map +1 -0
  170. package/dist/entries/captions.d.cts +354 -0
  171. package/dist/entries/captions.d.ts +354 -0
  172. package/dist/entries/captions.js +3 -0
  173. package/dist/entries/captions.js.map +1 -0
  174. package/dist/entries/catalogs.cjs +165 -0
  175. package/dist/entries/catalogs.cjs.map +1 -0
  176. package/dist/entries/catalogs.d.cts +385 -0
  177. package/dist/entries/catalogs.d.ts +385 -0
  178. package/dist/entries/catalogs.js +4 -0
  179. package/dist/entries/catalogs.js.map +1 -0
  180. package/dist/entries/credits.cjs +592 -0
  181. package/dist/entries/credits.cjs.map +1 -0
  182. package/dist/entries/credits.d.cts +1429 -0
  183. package/dist/entries/credits.d.ts +1429 -0
  184. package/dist/entries/credits.js +11 -0
  185. package/dist/entries/credits.js.map +1 -0
  186. package/dist/entries/edl.cjs +409 -0
  187. package/dist/entries/edl.cjs.map +1 -0
  188. package/dist/entries/edl.d.cts +1199 -0
  189. package/dist/entries/edl.d.ts +1199 -0
  190. package/dist/entries/edl.js +4 -0
  191. package/dist/entries/edl.js.map +1 -0
  192. package/dist/entries/entities.cjs +530 -0
  193. package/dist/entries/entities.cjs.map +1 -0
  194. package/dist/entries/entities.d.cts +1371 -0
  195. package/dist/entries/entities.d.ts +1371 -0
  196. package/dist/entries/entities.js +5 -0
  197. package/dist/entries/entities.js.map +1 -0
  198. package/dist/entries/i18n.cjs +48 -0
  199. package/dist/entries/i18n.cjs.map +1 -0
  200. package/dist/entries/i18n.d.cts +69 -0
  201. package/dist/entries/i18n.d.ts +69 -0
  202. package/dist/entries/i18n.js +3 -0
  203. package/dist/entries/i18n.js.map +1 -0
  204. package/dist/entries/llm-models.cjs +177 -0
  205. package/dist/entries/llm-models.cjs.map +1 -0
  206. package/dist/entries/llm-models.d.cts +435 -0
  207. package/dist/entries/llm-models.d.ts +435 -0
  208. package/dist/entries/llm-models.js +4 -0
  209. package/dist/entries/llm-models.js.map +1 -0
  210. package/dist/entries/media.cjs +335 -0
  211. package/dist/entries/media.cjs.map +1 -0
  212. package/dist/entries/media.d.cts +518 -0
  213. package/dist/entries/media.d.ts +518 -0
  214. package/dist/entries/media.js +6 -0
  215. package/dist/entries/media.js.map +1 -0
  216. package/dist/entries/model-catalog.cjs +247 -0
  217. package/dist/entries/model-catalog.cjs.map +1 -0
  218. package/dist/entries/model-catalog.d.cts +202 -0
  219. package/dist/entries/model-catalog.d.ts +202 -0
  220. package/dist/entries/model-catalog.js +6 -0
  221. package/dist/entries/model-catalog.js.map +1 -0
  222. package/dist/entries/models.cjs +833 -0
  223. package/dist/entries/models.cjs.map +1 -0
  224. package/dist/entries/models.d.cts +287 -0
  225. package/dist/entries/models.d.ts +287 -0
  226. package/dist/entries/models.js +8 -0
  227. package/dist/entries/models.js.map +1 -0
  228. package/dist/entries/nodes.cjs +789 -0
  229. package/dist/entries/nodes.cjs.map +1 -0
  230. package/dist/entries/nodes.d.cts +1600 -0
  231. package/dist/entries/nodes.d.ts +1600 -0
  232. package/dist/entries/nodes.js +16 -0
  233. package/dist/entries/nodes.js.map +1 -0
  234. package/dist/entries/organizations.cjs +80 -0
  235. package/dist/entries/organizations.cjs.map +1 -0
  236. package/dist/entries/organizations.d.cts +466 -0
  237. package/dist/entries/organizations.d.ts +466 -0
  238. package/dist/entries/organizations.js +3 -0
  239. package/dist/entries/organizations.js.map +1 -0
  240. package/dist/entries/pipeline.cjs +594 -0
  241. package/dist/entries/pipeline.cjs.map +1 -0
  242. package/dist/entries/pipeline.d.cts +2617 -0
  243. package/dist/entries/pipeline.d.ts +2617 -0
  244. package/dist/entries/pipeline.js +5 -0
  245. package/dist/entries/pipeline.js.map +1 -0
  246. package/dist/entries/scene3d.cjs +704 -0
  247. package/dist/entries/scene3d.cjs.map +1 -0
  248. package/dist/entries/scene3d.d.cts +4284 -0
  249. package/dist/entries/scene3d.d.ts +4284 -0
  250. package/dist/entries/scene3d.js +3 -0
  251. package/dist/entries/scene3d.js.map +1 -0
  252. package/dist/entries/social.cjs +714 -0
  253. package/dist/entries/social.cjs.map +1 -0
  254. package/dist/entries/social.d.cts +1366 -0
  255. package/dist/entries/social.d.ts +1366 -0
  256. package/dist/entries/social.js +5 -0
  257. package/dist/entries/social.js.map +1 -0
  258. package/dist/entries/types.cjs +13 -0
  259. package/dist/entries/types.cjs.map +1 -0
  260. package/dist/entries/types.d.cts +162 -0
  261. package/dist/entries/types.d.ts +162 -0
  262. package/dist/entries/types.js +4 -0
  263. package/dist/entries/types.js.map +1 -0
  264. package/dist/entries/ugc.cjs +279 -0
  265. package/dist/entries/ugc.cjs.map +1 -0
  266. package/dist/entries/ugc.d.cts +575 -0
  267. package/dist/entries/ugc.d.ts +575 -0
  268. package/dist/entries/ugc.js +6 -0
  269. package/dist/entries/ugc.js.map +1 -0
  270. package/dist/entries/video.cjs +549 -0
  271. package/dist/entries/video.cjs.map +1 -0
  272. package/dist/entries/video.d.cts +1791 -0
  273. package/dist/entries/video.d.ts +1791 -0
  274. package/dist/entries/video.js +8 -0
  275. package/dist/entries/video.js.map +1 -0
  276. package/dist/entries/workflow.cjs +574 -0
  277. package/dist/entries/workflow.cjs.map +1 -0
  278. package/dist/entries/workflow.d.cts +1733 -0
  279. package/dist/entries/workflow.d.ts +1733 -0
  280. package/dist/entries/workflow.js +5 -0
  281. package/dist/entries/workflow.js.map +1 -0
  282. package/dist/fan-out-meta-Bu6VyXcZ.d.cts +19 -0
  283. package/dist/fan-out-meta-Bu6VyXcZ.d.ts +19 -0
  284. package/dist/gemini-omni-voices-zeRXxSbZ.d.cts +174 -0
  285. package/dist/gemini-omni-voices-zeRXxSbZ.d.ts +174 -0
  286. package/dist/image-overlay-layers-CyBfRhxJ.d.cts +208 -0
  287. package/dist/image-overlay-layers-CyBfRhxJ.d.ts +208 -0
  288. package/dist/index.cjs +7731 -27084
  289. package/dist/index.cjs.map +1 -1
  290. package/dist/index.d.cts +32 -24198
  291. package/dist/index.d.ts +32 -24198
  292. package/dist/index.js +40 -25220
  293. package/dist/index.js.map +1 -1
  294. package/dist/model-catalog-flJYaa-g.d.cts +561 -0
  295. package/dist/model-catalog-flJYaa-g.d.ts +561 -0
  296. package/dist/presentation-types-0ENOCjoj.d.cts +61 -0
  297. package/dist/presentation-types-0ENOCjoj.d.ts +61 -0
  298. package/dist/presentation-utils-BIqiCzSA.d.cts +90 -0
  299. package/dist/presentation-utils-BdiObtwq.d.ts +90 -0
  300. package/dist/scene-node-types-DjenYFLO.d.cts +1949 -0
  301. package/dist/scene-node-types-DjenYFLO.d.ts +1949 -0
  302. package/dist/supported-fonts-CRoF1gOy.d.cts +16 -0
  303. package/dist/supported-fonts-CRoF1gOy.d.ts +16 -0
  304. package/dist/types-BRlFPEru.d.cts +511 -0
  305. package/dist/types-BRlFPEru.d.ts +511 -0
  306. package/dist/types-DffyGSy5.d.cts +67 -0
  307. package/dist/types-DffyGSy5.d.ts +67 -0
  308. package/package.json +102 -1
  309. package/src/__tests__/add-captions-plan.test.ts +6 -2
  310. package/src/__tests__/caption-edge-dash.test.ts +23 -0
  311. package/src/__tests__/fixtures/root-exports.baseline.json +4625 -0
  312. package/src/__tests__/input-field-extra-keys.test.ts +1 -0
  313. package/src/__tests__/no-internal-imports.test.ts +1 -1
  314. package/src/__tests__/node-aspect-ratio.test.ts +25 -0
  315. package/src/__tests__/node-runtime-keys.test.ts +9 -0
  316. package/src/__tests__/package-entries.test.ts +50 -0
  317. package/src/__tests__/pitch-tempo-pricing.test.ts +21 -0
  318. package/src/__tests__/preview-gate-use-case.test.ts +151 -0
  319. package/src/__tests__/run-continuation.test.ts +7 -1
  320. package/src/__tests__/site-capture-node.test.ts +58 -0
  321. package/src/__tests__/ugc-lane-wires.test.ts +228 -0
  322. package/src/__tests__/ugc-node-wires.test.ts +9 -3
  323. package/src/__tests__/ugc-run-state.test.ts +5 -4
  324. package/src/__tests__/video-analysis-catalog-sync.test.ts +1 -1
  325. package/src/__tests__/video-analysis-pricing.test.ts +6 -6
  326. package/src/__tests__/voice-changer-pro-quote.test.ts +79 -0
  327. package/src/add-captions-plan.ts +9 -3
  328. package/src/caption-edge-dash.ts +33 -0
  329. package/src/credit-estimators/index.ts +22 -1
  330. package/src/credit-estimators/pitch-tempo.ts +15 -1
  331. package/src/credit-estimators/speech.ts +72 -4
  332. package/src/credit-estimators/unit-quote.ts +52 -0
  333. package/src/credit-estimators/video-sfx.ts +15 -0
  334. package/src/credit-estimators/voice-changer-pro-quote.ts +138 -0
  335. package/src/entity-image-handle.ts +2 -0
  336. package/src/entries/apps.ts +63 -0
  337. package/src/entries/captions.ts +34 -0
  338. package/src/entries/catalogs.ts +65 -0
  339. package/src/entries/credits.ts +104 -0
  340. package/src/entries/edl.ts +42 -0
  341. package/src/entries/entities.ts +144 -0
  342. package/src/entries/i18n.ts +31 -0
  343. package/src/entries/llm-models.ts +63 -0
  344. package/src/entries/media.ts +36 -0
  345. package/src/entries/model-catalog.ts +89 -0
  346. package/src/entries/models.ts +266 -0
  347. package/src/entries/nodes.ts +245 -0
  348. package/src/entries/organizations.ts +9 -0
  349. package/src/entries/pipeline.ts +43 -0
  350. package/src/entries/scene3d.ts +27 -0
  351. package/src/entries/social.ts +297 -0
  352. package/src/entries/types.ts +26 -0
  353. package/src/entries/ugc.ts +14 -0
  354. package/src/entries/video.ts +59 -0
  355. package/src/entries/workflow.ts +172 -0
  356. package/src/fan-out-rows.ts +2 -0
  357. package/src/index.ts +25 -1845
  358. package/src/json-kinds.ts +4 -0
  359. package/src/model-catalog.ts +36 -34
  360. package/src/node-mappable-fields.ts +1 -0
  361. package/src/node-run-routes.ts +2 -0
  362. package/src/node-runtime-keys.ts +8 -0
  363. package/src/normalize-node-params.ts +30 -0
  364. package/src/presentation-utils.ts +5 -0
  365. package/src/preview-gate.ts +92 -14
  366. package/src/producer-types.ts +16 -2
  367. package/src/run-continuation.ts +21 -0
  368. package/src/site-capture-node.ts +82 -0
  369. package/src/ugc-lane-wires.ts +246 -0
  370. package/src/ugc-node-wires.ts +37 -7
  371. package/src/ugc-run-state.ts +5 -3
  372. package/src/video-analysis-pricing.ts +31 -29
@@ -6,6 +6,7 @@ import { INPUT_FIELD_EXTRA_KEYS, INPUT_FIELD_MAP, UGC_OVERRIDABLE_FIELDS, getInp
6
6
  /** The keys the node actually reads (its data fields). PR B's UgcCreatorData must keep these names. */
7
7
  const NODE_READS: Record<string, readonly string[]> = {
8
8
  "ugc-creator": ["source", "gender", "photoUrl", "categoryOverride", "seed", "keepResult", "result"],
9
+ "ugc-script": ["targetDurationSec", "language", "keepResult", "result"],
9
10
  }
10
11
 
11
12
  describe("INPUT_FIELD_EXTRA_KEYS (spec §6.6)", () => {
@@ -19,7 +19,7 @@ function walk(dir: string): string[] {
19
19
  describe("Apache boundary", () => {
20
20
  it("no shared source file imports @nodaro/prompts", () => {
21
21
  const offenders = walk(join(__dirname, ".."))
22
- .filter((f) => /from\s+["']@nodaro\/prompts["']/.test(readFileSync(f, "utf8")))
22
+ .filter((f) => /from\s+["']@nodaro\/prompts(?:\/[\w-]+)?["']/.test(readFileSync(f, "utf8")))
23
23
  expect(offenders).toEqual([])
24
24
  })
25
25
  })
@@ -0,0 +1,25 @@
1
+ import { describe, it, expect } from "vitest"
2
+ import { nodeAspectRatio, PHOTO_AUTO_ASPECT_NODE_TYPES } from "../normalize-node-params.js"
3
+
4
+ describe("nodeAspectRatio — unset is Auto on the photo-Auto nodes", () => {
5
+ it("fills auto for an unset or blank ratio on Generate Image and Modify Image", () => {
6
+ for (const type of PHOTO_AUTO_ASPECT_NODE_TYPES) {
7
+ expect(nodeAspectRatio(type, undefined)).toBe("auto")
8
+ expect(nodeAspectRatio(type, "")).toBe("auto")
9
+ expect(nodeAspectRatio(type, " ")).toBe("auto")
10
+ expect(nodeAspectRatio(type, null)).toBe("auto")
11
+ }
12
+ })
13
+
14
+ it("returns a set ratio untouched", () => {
15
+ expect(nodeAspectRatio("modify-image", "3:4")).toBe("3:4")
16
+ expect(nodeAspectRatio("generate-image", "auto")).toBe("auto")
17
+ })
18
+
19
+ it("leaves every other node type alone", () => {
20
+ expect(nodeAspectRatio("image-to-image", undefined)).toBeUndefined()
21
+ expect(nodeAspectRatio("edit-image", undefined)).toBeUndefined()
22
+ expect(nodeAspectRatio(undefined, undefined)).toBeUndefined()
23
+ expect(nodeAspectRatio("image-to-image", "1:1")).toBe("1:1")
24
+ })
25
+ })
@@ -73,6 +73,15 @@ describe("TRANSIENT_RUNTIME_KEYS", () => {
73
73
  })
74
74
  })
75
75
 
76
+ describe("a use-case node's continuation", () => {
77
+ it("is one run's, never saved: a save strips it, so a saved one cannot turn a later run into a continuation", () => {
78
+ expect(EXECUTION_DATA_KEYS.has("useCaseContinue")).toBe(true)
79
+ expect(TRANSIENT_RUNTIME_KEYS.has("useCaseContinue")).toBe(true)
80
+ const [saved] = stripTransientRuntimeData([{ data: { useCaseContinue: { mode: "from-failed", jobId: "j1" }, captions: true } }])
81
+ expect(saved!.data).toEqual({ captions: true })
82
+ })
83
+ })
84
+
76
85
  describe("EXECUTION_DATA_KEYS", () => {
77
86
  it("files the clear-results watermark as runtime bookkeeping — never preset / template / copilot-visible config", () => {
78
87
  expect(EXECUTION_DATA_KEYS.has("resultsClearedAt")).toBe(true)
@@ -0,0 +1,50 @@
1
+ /**
2
+ * The subpath entries of @nodaro/shared (`@nodaro/shared/<entry>`, one per
3
+ * domain in src/entries/) — additive to the root, which stays the union of them.
4
+ *
5
+ * External consumers pin older versions and import only the root, so the root
6
+ * may only grow (baseline: fixtures/root-exports.baseline.json). Most checks
7
+ * read the BUILT dist, which is what consumers load — CI builds the packages
8
+ * before this suite runs; locally run `npm run build:packages` first.
9
+ *
10
+ * The checks live in tools/package-entries/entries-guard.mjs (shared with
11
+ * @nodaro/prompts); each returns the problems it found.
12
+ */
13
+ import path from "node:path"
14
+ import { fileURLToPath } from "node:url"
15
+ import { describe, expect, it } from "vitest"
16
+ // @ts-expect-error — untyped .mjs tooling module
17
+ import * as guard from "../../../../tools/package-entries/entries-guard.mjs"
18
+
19
+ const PKG_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..")
20
+ const PKG = "@nodaro/shared"
21
+
22
+ describe("@nodaro/shared subpath entries", () => {
23
+ it("src/index.ts only re-exports every entry in src/entries/", () => {
24
+ expect(guard.indexShapeErrors(PKG_DIR)).toEqual([])
25
+ })
26
+
27
+ it("package.json exports = the unchanged root + one subpath per entry", () => {
28
+ expect(guard.exportsMapErrors(PKG_DIR)).toEqual([])
29
+ })
30
+
31
+ it("every exports target is built", () => {
32
+ expect(guard.distFileErrors(PKG_DIR)).toEqual([])
33
+ })
34
+
35
+ it("the root still exports every baseline name (types d.ts + d.cts, values ESM + CJS)", async () => {
36
+ expect(await guard.rootAdditiveErrors(PKG_DIR)).toEqual([])
37
+ }, 60_000)
38
+
39
+ it("the root's names are exactly the union of the entries' names, each with one owner", () => {
40
+ expect(guard.unionErrors(PKG_DIR, {})).toEqual([])
41
+ }, 60_000)
42
+
43
+ it("each subpath's types resolve from a consumer (bundler + NodeNext)", () => {
44
+ expect(guard.typeResolutionErrors(PKG_DIR, PKG)).toEqual([])
45
+ })
46
+
47
+ it("each subpath loads ALONE by package name (fresh process, ESM + CJS) and shares the root's instances", async () => {
48
+ expect(await guard.consumerLoadErrors(PKG_DIR, PKG)).toEqual([])
49
+ }, 120_000)
50
+ })
@@ -60,3 +60,24 @@ describe("pitch-tempo pricing", () => {
60
60
  expect(semitonesToPitchRatio(3)).toBeCloseTo(1.189207, 6)
61
61
  })
62
62
  })
63
+
64
+ // A quote before a run names the id the run reserves for a known length, and
65
+ // the most a run can be charged for an unknown one (decided 2026-10-13): the
66
+ // run measures the file before it reserves and refuses one it cannot measure.
67
+ describe("the quote of an input of unknown length", () => {
68
+ it("Pitch & Tempo: a known length's started minutes, else 30 minutes", async () => {
69
+ const { pitchTempoQuoteCreditId } = await import("../index.js")
70
+ expect(pitchTempoQuoteCreditId(190)).toBe("pitch-tempo:4m")
71
+ expect(pitchTempoQuoteCreditId(45)).toBe("pitch-tempo:1m")
72
+ for (const unknown of [undefined, null, 0, -3, Number.NaN]) expect(pitchTempoQuoteCreditId(unknown)).toBe("pitch-tempo:30m")
73
+ })
74
+
75
+ it("Video SFX: a known length's row, else the 300-second row", async () => {
76
+ const { videoSfxQuoteCreditId, videoSfxCreditId } = await import("../index.js")
77
+ expect(videoSfxQuoteCreditId(12)).toBe("replicate-mmaudio:15s")
78
+ expect(videoSfxQuoteCreditId(12)).toBe(videoSfxCreditId(12))
79
+ for (const unknown of [undefined, null, 0, Number.NaN]) expect(videoSfxQuoteCreditId(unknown)).toBe("replicate-mmaudio:300s")
80
+ // The charge of an unmeasurable clip stays the 8-second row — never above the quote.
81
+ expect(videoSfxCreditId(undefined)).toBe("replicate-mmaudio:8s")
82
+ })
83
+ })
@@ -0,0 +1,151 @@
1
+ import { describe, it, expect } from "vitest"
2
+ // Through the package index: both engines and the editor read the hold from here.
3
+ import {
4
+ PREVIEW_RENDER_NODE_TYPES,
5
+ REVIEW_HOLDING_USE_CASE_TYPES,
6
+ isPreviewHoldingType,
7
+ previewStops,
8
+ rendersAsPreview,
9
+ withRunOverrides,
10
+ PREVIEW_REVIEW_REQUIRED,
11
+ PREVIEW_REVIEW_REQUIRED_REVIEW_ON,
12
+ PREVIEW_REVIEW_REQUIRED_MIXED,
13
+ PREVIEW_RENDER_NESTED,
14
+ PREVIEW_RENDER_NESTED_REVIEW_ON,
15
+ PREVIEW_RENDER_NESTED_MIXED,
16
+ isPreviewRefusalCode,
17
+ } from "../index.js"
18
+
19
+ const rec = { id: "rec", type: "upload-video", data: {} }
20
+ const t1 = (data: Record<string, unknown>) => ({ id: "t1", type: "tighten-episode", data })
21
+ const fmt = { id: "fmt", type: "social-media-format", data: {} }
22
+ const post = { id: "post", type: "webhook-output", data: {} }
23
+ const edges = [
24
+ { source: "rec", target: "t1" },
25
+ { source: "t1", target: "fmt", sourceHandle: "media" },
26
+ { source: "fmt", target: "post" },
27
+ ]
28
+
29
+ describe("a review-on use-case node holds what follows it until its Render final", () => {
30
+ it("is a preview-holding type without joining the render set", () => {
31
+ expect([...REVIEW_HOLDING_USE_CASE_TYPES]).toEqual(["tighten-episode"])
32
+ expect(isPreviewHoldingType("tighten-episode")).toBe(true)
33
+ expect(isPreviewHoldingType("apply-edl")).toBe(true)
34
+ expect(isPreviewHoldingType("speaker-view")).toBe(true)
35
+ expect(isPreviewHoldingType("social-media-format")).toBe(false)
36
+ expect(isPreviewHoldingType(undefined)).toBe(false)
37
+ expect(isPreviewHoldingType(null)).toBe(false)
38
+ expect(PREVIEW_RENDER_NODE_TYPES.has("tighten-episode")).toBe(false)
39
+ })
40
+
41
+ it("review on: holds its descendants when it executes", () => {
42
+ const stops = previewStops([rec, t1({ reviewBeforeRender: true }), fmt, post], edges)
43
+ expect(stops.previewRenderIds).toEqual(["t1"])
44
+ expect([...stops.gatedNodeIds].sort()).toEqual(["fmt", "post"])
45
+ })
46
+
47
+ it("review off: holds nothing", () => {
48
+ expect(previewStops([rec, t1({}), fmt, post], edges).gatedNodeIds.size).toBe(0)
49
+ expect(previewStops([rec, t1({ reviewBeforeRender: false }), fmt, post], edges).gatedNodeIds.size).toBe(0)
50
+ })
51
+
52
+ it("a quality field on the node does not decide it: review does", () => {
53
+ expect(rendersAsPreview(t1({ quality: "proxy" }))).toBe(false)
54
+ expect(rendersAsPreview(t1({ reviewBeforeRender: true, quality: "final" }))).toBe(true)
55
+ })
56
+
57
+ it("its Render final (a render-final continuation naming its run) releases them", () => {
58
+ const node = t1({ reviewBeforeRender: true, useCaseContinue: { mode: "render-final", jobId: "job-1" } })
59
+ expect(rendersAsPreview(node)).toBe(false)
60
+ expect(previewStops([rec, node, fmt, post], edges).gatedNodeIds.size).toBe(0)
61
+ })
62
+
63
+ it("the continuation set as a run override releases them too", () => {
64
+ const graph = withRunOverrides([rec, t1({ reviewBeforeRender: true }), fmt, post], {
65
+ t1: { useCaseContinue: { mode: "render-final", jobId: "job-1" } },
66
+ })
67
+ expect(previewStops(graph, edges).gatedNodeIds.size).toBe(0)
68
+ })
69
+
70
+ it("a continuation the node would not run as one still holds: no run named, or a continue from a failure", () => {
71
+ // The executor runs a fresh review-on run when the continuation names no
72
+ // run, so what follows would build on its preview.
73
+ expect(rendersAsPreview(t1({ reviewBeforeRender: true, useCaseContinue: { mode: "render-final" } }))).toBe(true)
74
+ expect(rendersAsPreview(t1({ reviewBeforeRender: true, useCaseContinue: { mode: "render-final", jobId: 7 } }))).toBe(true)
75
+ // A continue from a failure finishes the run it continues: a review-on run's preview.
76
+ expect(rendersAsPreview(t1({ reviewBeforeRender: true, useCaseContinue: { mode: "from-failed", jobId: "job-1" } }))).toBe(true)
77
+ })
78
+
79
+ it("not executing, a saved Preview take holds them (the run view, a continuation of something else)", () => {
80
+ const stops = previewStops([rec, t1({ reviewBeforeRender: true }), fmt, post], edges, {
81
+ executes: () => false,
82
+ savedRenders: {
83
+ output: (d) => ((d as { reviewBeforeRender?: boolean }).reviewBeforeRender ? { quality: "proxy" } : undefined),
84
+ batch: () => undefined,
85
+ },
86
+ })
87
+ expect(stops.savedPreviewRenderIds).toEqual(["t1"])
88
+ expect([...stops.gatedNodeIds].sort()).toEqual(["fmt", "post"])
89
+ })
90
+
91
+ it("not executing, a saved Final take holds nothing", () => {
92
+ const stops = previewStops([rec, t1({ reviewBeforeRender: true }), fmt, post], edges, {
93
+ executes: () => false,
94
+ savedRenders: { output: () => ({ quality: "final" }), batch: () => undefined },
95
+ })
96
+ expect(stops.gatedNodeIds.size).toBe(0)
97
+ })
98
+ })
99
+
100
+ describe("the preview refusal codes", () => {
101
+ it("six codes, one predicate: the render's two (and every older row's) plus a review-on and a mixed one of each", () => {
102
+ const codes = [
103
+ PREVIEW_REVIEW_REQUIRED,
104
+ PREVIEW_REVIEW_REQUIRED_REVIEW_ON,
105
+ PREVIEW_REVIEW_REQUIRED_MIXED,
106
+ PREVIEW_RENDER_NESTED,
107
+ PREVIEW_RENDER_NESTED_REVIEW_ON,
108
+ PREVIEW_RENDER_NESTED_MIXED,
109
+ ]
110
+ expect(new Set(codes).size).toBe(6)
111
+ for (const code of codes) {
112
+ expect(code).toMatch(/^[a-z_]+$/)
113
+ expect(isPreviewRefusalCode(code)).toBe(true)
114
+ }
115
+ expect(PREVIEW_REVIEW_REQUIRED).toBe("preview_review_required")
116
+ expect(PREVIEW_RENDER_NESTED).toBe("preview_render_nested")
117
+ for (const other of ["continuation_not_found", "", undefined, null, 7]) expect(isPreviewRefusalCode(other)).toBe(false)
118
+ })
119
+ })
120
+
121
+ describe("a continuation saved on the graph is never a run's (the engine's rule, in the shared funnel)", () => {
122
+ const saved = (cont: Record<string, unknown>) => [rec, t1({ reviewBeforeRender: true, useCaseContinue: cont }), fmt, post]
123
+
124
+ it("a saved render-final naming a run, with no override: dropped — the node is a Preview and holds what follows", () => {
125
+ const graph = withRunOverrides(saved({ mode: "render-final", jobId: "job-old" }), undefined)
126
+ const node = graph.find((n) => n.id === "t1")!
127
+ expect(node.data).not.toHaveProperty("useCaseContinue")
128
+ expect(rendersAsPreview(node)).toBe(true)
129
+ expect([...previewStops(graph, edges).gatedNodeIds].sort()).toEqual(["fmt", "post"])
130
+ // Overrides for other nodes drop it too.
131
+ expect(withRunOverrides(saved({ mode: "render-final", jobId: "job-old" }), { fmt: { x: 1 } }).find((n) => n.id === "t1")!.data).not.toHaveProperty("useCaseContinue")
132
+ })
133
+
134
+ it("this run's own override still sets it, over a stale saved one", () => {
135
+ const graph = withRunOverrides(saved({ mode: "from-failed", jobId: "job-old" }), { t1: { useCaseContinue: { mode: "render-final", jobId: "job-1" } } })
136
+ const node = graph.find((n) => n.id === "t1")!
137
+ expect((node.data as Record<string, unknown>).useCaseContinue).toEqual({ mode: "render-final", jobId: "job-1" })
138
+ expect(rendersAsPreview(node)).toBe(false)
139
+ })
140
+
141
+ it("is applied once, to the saved graph: a second pass drops the continuation the first set", () => {
142
+ const once = withRunOverrides(saved({}), { t1: { useCaseContinue: { mode: "render-final", jobId: "job-1" } } })
143
+ expect(withRunOverrides(once, undefined).find((n) => n.id === "t1")!.data).not.toHaveProperty("useCaseContinue")
144
+ })
145
+
146
+ it("a node with neither an override nor a saved run-only field is returned as is", () => {
147
+ const nodes = [rec, t1({ reviewBeforeRender: true }), fmt]
148
+ const out = withRunOverrides(nodes, undefined)
149
+ out.forEach((n, i) => expect(n).toBe(nodes[i]))
150
+ })
151
+ })
@@ -1,8 +1,10 @@
1
1
  import { describe, expect, it } from "vitest"
2
2
  import {
3
3
  CONTINUATION_NOT_COMPLETED,
4
+ CONTINUATION_NOT_FAILED,
4
5
  CONTINUATION_NOT_FOUND,
5
6
  CONTINUATION_SUBSET_REQUIRED,
7
+ CONTINUATION_SUPERSEDED,
6
8
  CONTINUATION_VERSION_MISMATCH,
7
9
  CONTINUATION_WORKFLOW_MISMATCH,
8
10
  RUN_CONTINUATION_CODES,
@@ -15,15 +17,19 @@ describe("run continuation refusal codes", () => {
15
17
  expect(CONTINUATION_VERSION_MISMATCH).toBe("continuation_version_mismatch")
16
18
  expect(CONTINUATION_NOT_COMPLETED).toBe("continuation_not_completed")
17
19
  expect(CONTINUATION_SUBSET_REQUIRED).toBe("continuation_subset_required")
20
+ expect(CONTINUATION_NOT_FAILED).toBe("continuation_not_failed")
21
+ expect(CONTINUATION_SUPERSEDED).toBe("continuation_superseded")
18
22
  })
19
23
 
20
24
  it("lists every code once", () => {
21
- expect(new Set(RUN_CONTINUATION_CODES).size).toBe(5)
25
+ expect(new Set(RUN_CONTINUATION_CODES).size).toBe(7)
22
26
  expect([...RUN_CONTINUATION_CODES].sort()).toEqual(
23
27
  [
24
28
  CONTINUATION_NOT_COMPLETED,
29
+ CONTINUATION_NOT_FAILED,
25
30
  CONTINUATION_NOT_FOUND,
26
31
  CONTINUATION_SUBSET_REQUIRED,
32
+ CONTINUATION_SUPERSEDED,
27
33
  CONTINUATION_VERSION_MISMATCH,
28
34
  CONTINUATION_WORKFLOW_MISMATCH,
29
35
  ].sort(),
@@ -0,0 +1,58 @@
1
+ import { describe, expect, it } from "vitest"
2
+ import { siteCaptureMaxStills, siteCaptureNodeOutputs, siteCapturePageUrl, siteCaptureStillUrls, siteCaptureStills } from "../site-capture-node.js"
3
+
4
+ const CAPTURE = {
5
+ pageUrl: "https://example.com/",
6
+ title: "Example",
7
+ fullPage: { url: "https://cdn.example/full.jpg", width: 412, height: 6000, truncated: false },
8
+ stills: [
9
+ { index: 1, sectionOrder: 3, label: "Pricing", category: "pricing", url: "https://cdn.example/1.png" },
10
+ { index: 0, sectionOrder: 0, label: "Hero", category: "hero", url: "https://cdn.example/0.png" },
11
+ { index: 2, sectionOrder: 5, label: "Broken", category: "other", url: "" },
12
+ ],
13
+ facts: ["$12 per month"],
14
+ }
15
+
16
+ describe("siteCapturePageUrl — the page a run captures", () => {
17
+ it("is the address typed on the node", () => expect(siteCapturePageUrl(" example.com/pricing ", "https://other.com")).toBe("example.com/pricing"))
18
+ it("else the first web address in the wired text, without trailing punctuation", () =>
19
+ expect(siteCapturePageUrl("", "Look at https://acme.io/pricing, then https://b.io.")).toBe("https://acme.io/pricing"))
20
+ it("else the wired text's first word (the route normalises or refuses it)", () => expect(siteCapturePageUrl(undefined, "acme.io is the site")).toBe("acme.io"))
21
+ it("else nothing", () => {
22
+ expect(siteCapturePageUrl("", " ")).toBe("")
23
+ expect(siteCapturePageUrl(undefined, undefined)).toBe("")
24
+ })
25
+ })
26
+
27
+ describe("siteCaptureMaxStills — the route's bounds", () => {
28
+ it.each([
29
+ [undefined, 8],
30
+ ["5", 8],
31
+ [Number.NaN, 8],
32
+ [1, 3],
33
+ [5.4, 5],
34
+ [12, 8],
35
+ ])("%j → %i", (value, stills) => expect(siteCaptureMaxStills(value)).toBe(stills))
36
+ })
37
+
38
+ describe("the capture's outputs", () => {
39
+ it("lists the stills in page order and drops one with no address; the full page is never one of them", () => {
40
+ expect(siteCaptureStills(CAPTURE).map((s) => s.label)).toEqual(["Hero", "Pricing"])
41
+ expect(siteCaptureStillUrls(CAPTURE)).toEqual(["https://cdn.example/0.png", "https://cdn.example/1.png"])
42
+ })
43
+
44
+ it("hands on the capture as json, its first still as the image and every still as the list", () => {
45
+ expect(siteCaptureNodeOutputs(CAPTURE)).toEqual({
46
+ json: CAPTURE,
47
+ imageUrl: "https://cdn.example/0.png",
48
+ listResults: ["https://cdn.example/0.png", "https://cdn.example/1.png"],
49
+ })
50
+ })
51
+
52
+ it("a capture with no still hands on its json only; anything that is not a capture hands on nothing", () => {
53
+ expect(siteCaptureNodeOutputs({ ...CAPTURE, stills: [] })).toEqual({ json: { ...CAPTURE, stills: [] } })
54
+ expect(siteCaptureNodeOutputs(null)).toEqual({})
55
+ expect(siteCaptureNodeOutputs([CAPTURE])).toEqual({})
56
+ expect(siteCaptureStills("nope")).toEqual([])
57
+ })
58
+ })
@@ -0,0 +1,228 @@
1
+ /**
2
+ * The UGC wires of a video whose clips are cut from one recorded speech: UGC Clips' prelude, the
3
+ * script's language, the Script (sized) output that carries the finish call, and UGC Finish. The
4
+ * URLs and texts are placeholders; nothing here reads what a call says.
5
+ */
6
+ import { describe, expect, it } from "vitest"
7
+ import {
8
+ FAN_IN_TARGETS,
9
+ UGC_FINISH_CLIPS_TYPE,
10
+ UGC_NODE_MESSAGES,
11
+ UGC_NODE_TYPES,
12
+ UGC_OVERRIDABLE_FIELDS,
13
+ UGC_PRELUDE_ROUTES,
14
+ UGC_PRIMARY_HANDLE,
15
+ VIDEO_PRODUCER_TYPES,
16
+ defaultEdgeOutputMode,
17
+ getInputFieldExtraKeys,
18
+ isFanInEdge,
19
+ isFanInNodeType,
20
+ ugcClipsOutputs,
21
+ ugcClipsPhase,
22
+ ugcClipsPhase2Body,
23
+ ugcFinishOutputs,
24
+ ugcFinishPlan,
25
+ ugcFinishWired,
26
+ ugcLaneNeedsFinish,
27
+ ugcPrelude,
28
+ ugcPreludeOutput,
29
+ ugcRenderHoldBody,
30
+ ugcRenderHoldVerdict,
31
+ ugcRunEstimateInput,
32
+ ugcScriptBody,
33
+ } from "../index.js"
34
+
35
+ const PHASE1 = {
36
+ errors: [],
37
+ lane: "segmented-reference",
38
+ phase: 1,
39
+ speech: { tool: "generate_speech", args: { text: "one two three", model: "speech-model", language_code: "xx", voice_id: "voice-1", voice_type: "library" } },
40
+ align: { tool: "forced_alignment", args: { transcript: "one two three" } },
41
+ split: { tool: "ugc_split_speech", args: { plan: { v: 1, hook: "one" } } },
42
+ }
43
+ const SEGMENTS = [{ index: 1, text: "one two" }, { index: 2, text: "three" }]
44
+ const PHASE2 = {
45
+ errors: [],
46
+ phase: 2,
47
+ tickets: [{ v: 1, index: 0, durationSec: 7 }, { v: 1, index: 1, durationSec: 7 }],
48
+ sizedPlan: { hook: "one", clipBreaks: [], clipDurations: [14] },
49
+ transcript: "one two three",
50
+ hasCards: false,
51
+ speechCheckCall: { tool: "transcribe", args: { language: "xx" } },
52
+ finish: { tool: "ugc_finish_clips", args: { segments: SEGMENTS } },
53
+ }
54
+
55
+ describe("the script's language", () => {
56
+ it("the node's choice goes to the script route; none, or one this app does not know, is English", () => {
57
+ const body = (language: unknown) => (ugcScriptBody({ site: "Acme", screenshots: [], language }) as { body: Record<string, unknown> }).body.language
58
+ expect(body("he")).toBe("he")
59
+ expect(body("en")).toBe("en")
60
+ expect(body(undefined)).toBe("en")
61
+ expect(body("fr")).toBe("en")
62
+ })
63
+ it("is an overridable field and an extra app-input key, together", () => {
64
+ expect(UGC_OVERRIDABLE_FIELDS["ugc-script"]).toContain("language")
65
+ expect(getInputFieldExtraKeys("ugc-script")).toEqual([{ key: "language", type: "select" }])
66
+ })
67
+ })
68
+
69
+ describe("UGC Clips' prelude", () => {
70
+ it("reads an answer's phase: 1 runs the prelude, 2 the clips, none is one call", () => {
71
+ expect(ugcClipsPhase(PHASE1)).toBe(1)
72
+ expect(ugcClipsPhase(PHASE2)).toBe(2)
73
+ expect(ugcClipsPhase({ tickets: [] })).toBeNull()
74
+ })
75
+ it("maps the three calls to the routes their MCP tools dispatch to, argument by argument", () => {
76
+ const p = ugcPrelude(PHASE1)
77
+ if ("error" in p) throw new Error(p.error)
78
+ expect(p.speech).toEqual({ text: "one two three", voice: "voice-1", voiceType: "library", provider: "speech-model", languageCode: "xx" })
79
+ expect(p.alignment("https://cdn.example/s.mp3")).toEqual({ transcript: "one two three", audioUrl: "https://cdn.example/s.mp3" })
80
+ expect(p.split("https://cdn.example/s.mp3", [{ word: "one", start: 0, end: 1 }])).toEqual({
81
+ plan: { v: 1, hook: "one" }, audioUrl: "https://cdn.example/s.mp3", alignment: [{ word: "one", start: 0, end: 1 }],
82
+ })
83
+ expect(UGC_PRELUDE_ROUTES).toEqual({
84
+ speech: { path: "/v1/text-to-speech", jobType: "text-to-speech" },
85
+ alignment: { path: "/v1/forced-alignment", jobType: "forced-alignment" },
86
+ split: { path: "/v1/ugc/segments", jobType: "ugc-segments" },
87
+ })
88
+ })
89
+ it("an answer missing a call, or naming another tool, is the newer-app sentence", () => {
90
+ expect(ugcPrelude({ ...PHASE1, align: undefined })).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
91
+ expect(ugcPrelude({ ...PHASE1, speech: { tool: "generate_dialogue", args: { text: "x" } } })).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
92
+ expect(ugcPrelude({ ...PHASE1, split: { tool: "ugc_split_speech", args: {} } })).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
93
+ })
94
+ it("reads each step's job output: the speech's audio, the word timings, the segments", () => {
95
+ expect(ugcPreludeOutput("speech", { audioUrl: "https://cdn.example/s.mp3" })).toEqual({ value: "https://cdn.example/s.mp3" })
96
+ expect(ugcPreludeOutput("alignment", { alignment: [{ word: "a" }] })).toEqual({ value: [{ word: "a" }] })
97
+ expect(ugcPreludeOutput("split", { segments: SEGMENTS })).toEqual({ value: SEGMENTS })
98
+ for (const [step, out] of [["speech", {}], ["alignment", { alignment: [] }], ["split", undefined]] as const) {
99
+ expect(ugcPreludeOutput(step, out as never)).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
100
+ }
101
+ })
102
+ it("the second call is the first call's body with the segments", () => {
103
+ expect(ugcClipsPhase2Body({ plan: { v: 1 }, surface: "canvas", userId: "u" }, SEGMENTS)).toEqual({ plan: { v: 1 }, surface: "canvas", userId: "u", segments: SEGMENTS })
104
+ })
105
+ it("the phase-2 answer's Script (sized) output carries the finish call's arguments; an answer without one is unchanged", () => {
106
+ const read = ugcClipsOutputs(PHASE2)
107
+ if ("error" in read) throw new Error(read.error)
108
+ expect(JSON.parse(read.outputs["plan-out"]!)).toEqual({ v: 1, plan: PHASE2.sizedPlan, transcribeArgs: { language: "xx" }, finish: { segments: SEGMENTS } })
109
+ const { finish: _f, phase: _p, ...english } = PHASE2
110
+ const en = ugcClipsOutputs(english)
111
+ if ("error" in en) throw new Error(en.error)
112
+ expect(JSON.parse(en.outputs["plan-out"]!)).toEqual({ v: 1, plan: PHASE2.sizedPlan, transcribeArgs: { language: "xx" } })
113
+ })
114
+ it("says the clips go through UGC Finish's job exactly when its plan-out carries the finish call (the quote prices it then)", () => {
115
+ const read = ugcClipsOutputs(PHASE2)
116
+ if ("error" in read) throw new Error(read.error)
117
+ expect(read.finishes).toBe(true)
118
+ expect("finish" in JSON.parse(read.outputs["plan-out"]!)).toBe(true)
119
+ const { finish: _f, phase: _p, ...english } = PHASE2
120
+ const en = ugcClipsOutputs(english)
121
+ if ("error" in en) throw new Error(en.error)
122
+ expect(en.finishes).toBe(false)
123
+ // A finish with no arguments is not carried, so it is not priced either.
124
+ const bare = ugcClipsOutputs({ ...PHASE2, finish: { tool: "ugc_finish_clips" } })
125
+ if ("error" in bare) throw new Error(bare.error)
126
+ expect([bare.finishes, "finish" in JSON.parse(bare.outputs["plan-out"]!)]).toEqual([false, false])
127
+ })
128
+ it("is refused before anything is spent when no UGC Finish reads this UGC Clips' Script (sized) output", () => {
129
+ const nodes = [{ id: "clips", type: "ugc-clips" }, { id: "fin", type: UGC_FINISH_CLIPS_TYPE }, { id: "join", type: "combine-videos" }]
130
+ const wired = [{ source: "clips", target: "fin", sourceHandle: "plan-out", targetHandle: "plan" }]
131
+ expect(ugcFinishWired(wired, nodes, "clips")).toBe(true)
132
+ expect(ugcLaneNeedsFinish(wired, nodes, "clips")).toBeNull()
133
+ // Another UGC Clips' finish, another output, or no UGC Finish at all: refused.
134
+ expect(ugcLaneNeedsFinish(wired, nodes, "other")).toBe(UGC_NODE_MESSAGES.needsFinish)
135
+ expect(ugcLaneNeedsFinish([{ ...wired[0]!, sourceHandle: "transcript" }], nodes, "clips")).toBe(UGC_NODE_MESSAGES.needsFinish)
136
+ expect(ugcLaneNeedsFinish([{ ...wired[0]!, target: "join" }], nodes, "clips")).toBe(UGC_NODE_MESSAGES.needsFinish)
137
+ })
138
+ })
139
+
140
+ describe("UGC Finish", () => {
141
+ const PLAN_OUT_EN = JSON.stringify({ v: 1, plan: { hook: "h" }, transcribeArgs: {} })
142
+ const PLAN_OUT_LANE = JSON.stringify({ v: 1, plan: { hook: "h" }, transcribeArgs: {}, finish: { segments: SEGMENTS } })
143
+ const CLIPS = ["https://cdn.example/1.mp4", "https://cdn.example/2.mp4"]
144
+
145
+ it("is a registered UGC node, a video producer, and folds its clips into one run (never fanned out)", () => {
146
+ expect(UGC_NODE_TYPES.has(UGC_FINISH_CLIPS_TYPE)).toBe(true)
147
+ expect(VIDEO_PRODUCER_TYPES.has(UGC_FINISH_CLIPS_TYPE)).toBe(true)
148
+ expect(FAN_IN_TARGETS[UGC_FINISH_CLIPS_TYPE]).toEqual(["clips"])
149
+ expect(isFanInNodeType(UGC_FINISH_CLIPS_TYPE)).toBe(true)
150
+ expect(isFanInEdge(UGC_FINISH_CLIPS_TYPE, "clips")).toBe(true)
151
+ expect(isFanInEdge(UGC_FINISH_CLIPS_TYPE, "plan")).toBe(false)
152
+ expect(UGC_PRIMARY_HANDLE[UGC_FINISH_CLIPS_TYPE]).toBe("video-out")
153
+ // Its output is one value per edge by default; a Bundle edge hands on the whole list.
154
+ expect(defaultEdgeOutputMode(UGC_FINISH_CLIPS_TYPE, "video-out")).toBe("last")
155
+ })
156
+ it("English (no finish call on the plan): the clips pass through as they came — no call, no job", () => {
157
+ expect(ugcFinishPlan({ planOutWire: PLAN_OUT_EN, clipUrls: CLIPS })).toEqual({ kind: "pass", clips: CLIPS })
158
+ })
159
+ it("the segmented lane: the finish job's body — the segments as they came, one roll per clip, in order", () => {
160
+ expect(ugcFinishPlan({ planOutWire: PLAN_OUT_LANE, clipUrls: CLIPS })).toEqual({
161
+ kind: "job", path: "/v1/ugc/finish",
162
+ body: { segments: SEGMENTS, clips: [{ clip: 1, rolls: [CLIPS[0]] }, { clip: 2, rolls: [CLIPS[1]] }] },
163
+ })
164
+ })
165
+ it("refuses before any call: no clips, no plan, or a clip count that is not the segment count", () => {
166
+ expect(ugcFinishPlan({ planOutWire: PLAN_OUT_LANE, clipUrls: [] })).toEqual({ error: UGC_NODE_MESSAGES.finishNeedsClips })
167
+ expect(ugcFinishPlan({ planOutWire: undefined, clipUrls: CLIPS })).toEqual({ error: UGC_NODE_MESSAGES.needsPlanOut })
168
+ expect(ugcFinishPlan({ planOutWire: PLAN_OUT_LANE, clipUrls: CLIPS.slice(0, 1) })).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
169
+ })
170
+ it("a finished job → the clips in clip order with their real length; a dry finish's warning rides every clip", () => {
171
+ const out = ugcFinishOutputs({
172
+ ready: true,
173
+ clips: [{ clip: 2, url: "https://cdn.example/f2.mp4", sec: 5.2 }, { clip: 1, url: "https://cdn.example/f1.mp4", sec: 6.1 }],
174
+ warnings: [{ code: "ACOUSTICS_SKIPPED", cause: null, reason: "r" }],
175
+ })
176
+ expect(out).toEqual({
177
+ clips: [
178
+ { url: "https://cdn.example/f1.mp4", meta: { warnings: ["ACOUSTICS_SKIPPED"], durationSec: 6.1 } },
179
+ { url: "https://cdn.example/f2.mp4", meta: { warnings: ["ACOUSTICS_SKIPPED"], durationSec: 5.2 } },
180
+ ],
181
+ })
182
+ })
183
+ it("ready: false fails with its sentence; a clip list with a gap is never handed on", () => {
184
+ expect(ugcFinishOutputs({ ready: false, reroll: [2], failed: [] })).toEqual({ error: UGC_NODE_MESSAGES.finishNotReady })
185
+ expect(ugcFinishOutputs({ ready: true, clips: [{ clip: 1, url: "u1" }, { clip: 3, url: "u3" }] })).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
186
+ expect(ugcFinishOutputs(undefined)).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
187
+ })
188
+ })
189
+
190
+ describe("the hold check once the speech is split", () => {
191
+ const T = { v: 1, index: 0, durationSec: 7, video: { tool: "generate_video", args: {} } }
192
+ const PLAN = { v: 1, hook: "h", language: "he", targetDurationSec: 20, beats: [{ screenshot: { slot: 1 } }, { screenshot: { slot: 2 } }, { screenshot: "x" }, "not a beat"] }
193
+ const INPUT = { targetDurationSec: 20, screenshotCount: 2, source: "sampled", language: "he" } as const
194
+
195
+ it("reads the video's estimate input from the plan UGC Clips was sent (or its wire): length, screenshot cards, language", () => {
196
+ expect(ugcRunEstimateInput(PLAN)).toEqual({ runEstimate: INPUT })
197
+ expect(ugcRunEstimateInput(JSON.stringify(PLAN))).toEqual({ runEstimate: INPUT })
198
+ // A plan with no beats has no cards to count.
199
+ const { beats: _b, ...noBeats } = PLAN
200
+ expect(ugcRunEstimateInput(noBeats)).toEqual({ runEstimate: { ...INPUT, screenshotCount: 0 } })
201
+ })
202
+ it("never guesses: a plan with no length, an English or unknown language, or no plan → the newer-app sentence", () => {
203
+ const { targetDurationSec: _t, ...noLength } = PLAN
204
+ for (const plan of [noLength, { ...PLAN, targetDurationSec: 2 }, { ...PLAN, language: "en" }, { ...PLAN, language: "xx" }, { ...PLAN, language: undefined }, undefined, "not json"]) {
205
+ expect(ugcRunEstimateInput(plan), JSON.stringify(plan)).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
206
+ }
207
+ })
208
+ it("asks the quote for the clips handed on, with that input", () => {
209
+ expect(ugcRenderHoldBody({ runEstimate: INPUT, tickets: [T], hasCards: true, finishes: true })).toEqual({
210
+ path: "/v1/ugc/quote",
211
+ body: { tickets: [T], hasCards: true, finishes: true, runEstimate: INPUT },
212
+ })
213
+ // No finish call → no `finishes` key.
214
+ expect(ugcRenderHoldBody({ runEstimate: INPUT, tickets: [T], hasCards: false, finishes: false })).toEqual({
215
+ path: "/v1/ugc/quote",
216
+ body: { tickets: [T], hasCards: false, runEstimate: INPUT },
217
+ })
218
+ for (const tickets of [[], undefined, "x"]) expect(ugcRenderHoldBody({ runEstimate: INPUT, tickets, hasCards: false, finishes: true })).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
219
+ })
220
+ it("goes on at or under what the run was checked for; over it, the over-hold sentence; without both figures, the newer-app sentence", () => {
221
+ expect(ugcRenderHoldVerdict({ ceiling: 2400, runHold: 2400 })).toEqual({ ok: true })
222
+ expect(ugcRenderHoldVerdict({ ceiling: 0, runHold: 1 })).toEqual({ ok: true })
223
+ expect(ugcRenderHoldVerdict({ ceiling: 2401, runHold: 2400 })).toEqual({ error: UGC_NODE_MESSAGES.overHold })
224
+ for (const answer of [undefined, null, [], {}, { ceiling: 1 }, { runHold: 1 }, { ceiling: "1", runHold: 2 }, { ceiling: 1, runHold: Number.NaN }, { ceiling: -1, runHold: 2 }]) {
225
+ expect(ugcRenderHoldVerdict(answer), JSON.stringify(answer)).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
226
+ }
227
+ })
228
+ })