@nodaro/shared 3.30.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 (388) 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 -26444
  289. package/dist/index.cjs.map +1 -1
  290. package/dist/index.d.cts +32 -23733
  291. package/dist/index.d.ts +32 -23733
  292. package/dist/index.js +40 -24641
  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__/entity-image-handle.test.ts +61 -1
  312. package/src/__tests__/fixtures/root-exports.baseline.json +4625 -0
  313. package/src/__tests__/input-field-extra-keys.test.ts +1 -0
  314. package/src/__tests__/json-kinds.test.ts +10 -0
  315. package/src/__tests__/model-seed-capability.test.ts +34 -0
  316. package/src/__tests__/no-internal-imports.test.ts +1 -1
  317. package/src/__tests__/node-aspect-ratio.test.ts +25 -0
  318. package/src/__tests__/node-preset-extract.test.ts +8 -0
  319. package/src/__tests__/node-run-routes.test.ts +63 -0
  320. package/src/__tests__/node-runtime-keys.test.ts +70 -0
  321. package/src/__tests__/package-entries.test.ts +50 -0
  322. package/src/__tests__/pitch-tempo-pricing.test.ts +21 -0
  323. package/src/__tests__/presentation-utils.test.ts +14 -0
  324. package/src/__tests__/preview-gate-use-case.test.ts +151 -0
  325. package/src/__tests__/producer-types.test.ts +15 -0
  326. package/src/__tests__/run-continuation.test.ts +7 -1
  327. package/src/__tests__/seedance-draft.test.ts +74 -0
  328. package/src/__tests__/site-capture-node.test.ts +58 -0
  329. package/src/__tests__/ugc-clip-saved-list.test.ts +19 -0
  330. package/src/__tests__/ugc-lane-wires.test.ts +228 -0
  331. package/src/__tests__/ugc-node-wires.test.ts +606 -0
  332. package/src/__tests__/ugc-run-state.test.ts +85 -7
  333. package/src/__tests__/video-analysis-catalog-sync.test.ts +1 -1
  334. package/src/__tests__/video-analysis-pricing.test.ts +6 -6
  335. package/src/__tests__/voice-changer-pro-quote.test.ts +79 -0
  336. package/src/__tests__/workflow-export-strip.test.ts +14 -0
  337. package/src/add-captions-plan.ts +9 -3
  338. package/src/caption-edge-dash.ts +33 -0
  339. package/src/credit-estimators/index.ts +22 -1
  340. package/src/credit-estimators/pitch-tempo.ts +15 -1
  341. package/src/credit-estimators/speech.ts +72 -4
  342. package/src/credit-estimators/unit-quote.ts +52 -0
  343. package/src/credit-estimators/video-sfx.ts +15 -0
  344. package/src/credit-estimators/voice-changer-pro-quote.ts +138 -0
  345. package/src/entity-image-handle.ts +50 -1
  346. package/src/entries/apps.ts +63 -0
  347. package/src/entries/captions.ts +34 -0
  348. package/src/entries/catalogs.ts +65 -0
  349. package/src/entries/credits.ts +104 -0
  350. package/src/entries/edl.ts +42 -0
  351. package/src/entries/entities.ts +144 -0
  352. package/src/entries/i18n.ts +31 -0
  353. package/src/entries/llm-models.ts +63 -0
  354. package/src/entries/media.ts +36 -0
  355. package/src/entries/model-catalog.ts +89 -0
  356. package/src/entries/models.ts +266 -0
  357. package/src/entries/nodes.ts +245 -0
  358. package/src/entries/organizations.ts +9 -0
  359. package/src/entries/pipeline.ts +43 -0
  360. package/src/entries/scene3d.ts +27 -0
  361. package/src/entries/social.ts +297 -0
  362. package/src/entries/types.ts +26 -0
  363. package/src/entries/ugc.ts +14 -0
  364. package/src/entries/video.ts +59 -0
  365. package/src/entries/workflow.ts +172 -0
  366. package/src/fan-out-rows.ts +2 -0
  367. package/src/index.ts +25 -1838
  368. package/src/json-kinds.ts +13 -0
  369. package/src/model-catalog.ts +97 -36
  370. package/src/model-constants.ts +3 -0
  371. package/src/node-mappable-fields.ts +1 -0
  372. package/src/node-preset-export.ts +2 -2
  373. package/src/node-preset-extract.ts +6 -4
  374. package/src/node-run-routes.ts +78 -0
  375. package/src/node-runtime-keys.ts +50 -1
  376. package/src/normalize-node-params.ts +30 -0
  377. package/src/presentation-utils.ts +8 -0
  378. package/src/preview-gate.ts +92 -14
  379. package/src/producer-types.ts +26 -2
  380. package/src/run-continuation.ts +21 -0
  381. package/src/seedance-draft.ts +64 -0
  382. package/src/site-capture-node.ts +82 -0
  383. package/src/social-post.ts +13 -0
  384. package/src/ugc-lane-wires.ts +246 -0
  385. package/src/ugc-node-wires.ts +653 -0
  386. package/src/ugc-run-state.ts +65 -8
  387. package/src/video-analysis-pricing.ts +31 -29
  388. package/src/workflow-export.ts +3 -1
@@ -0,0 +1,1567 @@
1
+ import { SceneInputModeSchema } from './chunk-VIWSWVAW.js';
2
+ import { z } from 'zod';
3
+
4
+ // src/pipeline-defaults.ts
5
+ var PIPELINE_TYPES = ["story_to_video", "song_to_music_video"];
6
+ var PIPELINE_FORMATS = [
7
+ "trailer",
8
+ "short_film",
9
+ "music_video",
10
+ "reel",
11
+ "commercial"
12
+ ];
13
+ var PIPELINE_MODES = ["manual", "auto", "guided"];
14
+ var PIPELINE_ACTIVATION_MODES = ["interactive", "programmatic"];
15
+ var PIPELINE_OUTPUT_RESOLUTIONS = ["480p", "720p", "1080p", "4K"];
16
+ var PER_FORMAT_DURATION_BOUNDS = {
17
+ reel: { min: 7, max: 90 },
18
+ commercial: { min: 10, max: 90 },
19
+ trailer: { min: 30, max: 180 },
20
+ short_film: { min: 12, max: 600 },
21
+ music_video: { min: 30, max: 600 }
22
+ };
23
+ var GLOBAL_MAX_DURATION_SECONDS = 600;
24
+ function validateDurationForFormat(format, seconds) {
25
+ if (seconds > GLOBAL_MAX_DURATION_SECONDS) {
26
+ return { ok: false, reason: `target_duration_seconds must be <= ${GLOBAL_MAX_DURATION_SECONDS}` };
27
+ }
28
+ const bounds = PER_FORMAT_DURATION_BOUNDS[format];
29
+ if (seconds < bounds.min || seconds > bounds.max) {
30
+ return {
31
+ ok: false,
32
+ reason: `${format} requires duration in [${bounds.min}, ${bounds.max}] seconds`
33
+ };
34
+ }
35
+ return { ok: true };
36
+ }
37
+ function validateModeActivation(mode, activation) {
38
+ if (activation === "programmatic" && mode === "guided") {
39
+ return {
40
+ ok: false,
41
+ reason: "Programmatic activation cannot use guided mode (no user for chat turns)"
42
+ };
43
+ }
44
+ return { ok: true };
45
+ }
46
+ var TIER_PIPELINE_PARALLELISM = {
47
+ free: 0,
48
+ payg: 1,
49
+ // derived tier — pipeline entitlements copy basic's
50
+ basic: 1,
51
+ standard: 2,
52
+ pro: 3,
53
+ business: 5
54
+ };
55
+ var TIER_MAX_PIPELINE_COST_CREDITS = {
56
+ free: 0,
57
+ payg: 3e3,
58
+ // derived tier — copies basic
59
+ basic: 3e3,
60
+ standard: 8e3,
61
+ pro: 2e4,
62
+ business: 5e4
63
+ };
64
+ var PIPELINE_STAGE_TIMEOUT_MS = 30 * 60 * 1e3;
65
+ var PIPELINE_HARD_TIMEOUT_MS = 4 * 60 * 60 * 1e3;
66
+ var ENTITY_TOOL_RETRY_CAP = 3;
67
+ var DEFAULT_CHARACTER_ANGLE_COUNT = 3;
68
+ var DEFAULT_CHARACTER_EXPRESSION_COUNT = 2;
69
+ var SHORT_FILM_VARIANT_THRESHOLD_SEC = 120;
70
+ var SHORT_FILM_ANGLE_COUNT = 2;
71
+ var SHORT_FILM_EXPRESSION_COUNT = 1;
72
+ var MAX_LOCATION_VARIANTS = 4;
73
+ var CHAT_TURN_CAPS = {
74
+ script: 20,
75
+ shot_list: 15,
76
+ post_merge: 8
77
+ };
78
+ var IMAGE_CRITIC_UNRESOLVABLE = "image_critic_unresolvable";
79
+ var IMAGE_CRITIC_MAX_RETRIES = 2;
80
+ var IMAGE_CRITIC_MIN_ADHERENCE_SCORE = 5;
81
+ var IMAGE_CRITIC_METADATA_KEYS = [
82
+ "last_error",
83
+ "last_error_at",
84
+ "critic_findings",
85
+ "last_attempted_image_url",
86
+ "last_attempted_asset_id",
87
+ "image_critic_retry_count"
88
+ ];
89
+ function clearImageCriticMetadata(meta) {
90
+ if (!meta) return {};
91
+ const next = { ...meta };
92
+ for (const key of IMAGE_CRITIC_METADATA_KEYS) {
93
+ delete next[key];
94
+ }
95
+ return next;
96
+ }
97
+ var VIDEO_CRITIC_FRAME_MODES = ["first_last", "first_middle_last", "five_evenly"];
98
+ var VIDEO_CRITIC_RESERVED_CREDITS_PER_SHOT = {
99
+ first_last: 20,
100
+ first_middle_last: 30,
101
+ five_evenly: 40
102
+ };
103
+ var VIDEO_CRITIC_MAX_RETRIES = 1;
104
+ var VIDEO_CRITIC_MIN_ADHERENCE_SCORE = 5;
105
+ var VIDEO_CRITIC_METADATA_KEYS = [
106
+ "video_critic_findings",
107
+ "video_critic_score",
108
+ "video_critic_continuity_score",
109
+ "video_critic_identified_action",
110
+ "video_critic_retry_count",
111
+ "video_critic_last_attempted_url",
112
+ "video_critic_failed",
113
+ "video_critic_verdict"
114
+ ];
115
+ function clearVideoCriticMetadata(shot) {
116
+ const cleaned = { ...shot };
117
+ for (const key of VIDEO_CRITIC_METADATA_KEYS) {
118
+ delete cleaned[key];
119
+ }
120
+ return cleaned;
121
+ }
122
+ var CHAT_STAGES = {
123
+ script: { wired: true },
124
+ shot_list: { wired: false },
125
+ post_merge: { wired: true }
126
+ };
127
+ var CHAT_ENABLED_STAGES = Object.keys(
128
+ CHAT_STAGES
129
+ );
130
+ var CHAT_WIRED_STAGES = {
131
+ script: CHAT_STAGES.script.wired,
132
+ shot_list: CHAT_STAGES.shot_list.wired,
133
+ post_merge: CHAT_STAGES.post_merge.wired
134
+ };
135
+ var TransitionTypeSchema = z.enum([
136
+ "hard_cut",
137
+ "dissolve",
138
+ "match_cut",
139
+ "overlap"
140
+ ]);
141
+ var sceneRenderStateRegistry = z.registry();
142
+ var RENDER_STATE = { render_state: true };
143
+ var ShotSpecSchema = z.object({
144
+ shot_id: z.string().regex(/^shot_\d{2,3}$/, "shot_id must be shot_NN or shot_NNN"),
145
+ camera: z.object({
146
+ shot_type: z.enum([
147
+ "wide",
148
+ "medium",
149
+ "close_up",
150
+ "extreme_close_up",
151
+ "pov",
152
+ "over_shoulder"
153
+ ]),
154
+ angle: z.enum(["eye_level", "low", "high", "dutch", "birds_eye"]),
155
+ motion: z.enum(["static", "pan", "tilt", "dolly", "tracking", "handheld"])
156
+ }),
157
+ shot_intensity_kind: z.enum([
158
+ "establishing_shot",
159
+ "action_shot",
160
+ "dialogue_shot",
161
+ "reaction_shot",
162
+ "climactic_shot",
163
+ "transition_shot"
164
+ ]),
165
+ action: z.string().max(300),
166
+ dialogue_line: z.string().max(200).nullable(),
167
+ duration_seconds: z.number().min(0.3).max(8),
168
+ motion_prompt: z.string().max(200),
169
+ // Internal continuity within this scene
170
+ start_state: z.string().max(200),
171
+ end_state: z.string().max(200),
172
+ continuity_with_previous: z.string().max(200).nullable(),
173
+ // Provider-neutral intent — engine maps to provider-specific directives at call time
174
+ shot_intent: z.object({
175
+ needs_multishot_reference: z.boolean().default(false),
176
+ is_loopable: z.boolean().default(false),
177
+ needs_music_suppression: z.boolean().default(true),
178
+ is_match_cut: z.boolean().default(false)
179
+ // v4.1 Method 7
180
+ }),
181
+ visual_keyframe_prompt: z.string().min(1).max(1e3),
182
+ // v4.1 Method 2 — pre-planned paired keyframes (required when shot_input_mode='first_last_frame')
183
+ end_keyframe_prompt: z.string().max(1e3).optional(),
184
+ // v4.1 Method 3 — video continuation (this shot extends extends_shot_id's clip)
185
+ extends_shot_id: z.string().optional(),
186
+ // v4.1 Method 5 — i2i bridge applied to prior last_frame before this shot animates
187
+ bridge_image_prompt: z.string().max(500).optional(),
188
+ // v4.1 Method 8 — sparse keyframes for interpolation models
189
+ interpolation_keyframes: z.array(
190
+ z.object({
191
+ timestamp_sec: z.number().nonnegative(),
192
+ prompt: z.string().min(10).max(1e3)
193
+ })
194
+ ).max(16).optional(),
195
+ // Phase 1C.3 Method 8 — generated R2 URLs of the sub-keyframes, one per
196
+ // `interpolation_keyframes[N].prompt`. Stage 6 writes these BEFORE Stage 7
197
+ // runs so the animate step can pass them to the interpolation provider.
198
+ // Length MUST equal `interpolation_keyframes.length` when populated.
199
+ interpolation_keyframe_urls: z.array(z.string().url()).max(16).optional(),
200
+ // v4.1 Method 10 — parametric 3D camera path
201
+ camera_path_directive: z.object({
202
+ path_kind: z.enum(["orbit", "dolly", "crane", "arc", "reveal"]),
203
+ parameters: z.record(z.string(), z.unknown()).optional()
204
+ }).optional(),
205
+ // ─── Execution state (engine writes; null on planning) ─────────────────────
206
+ // Phase 1C.1: per-shot execution state lands directly on the shot record so
207
+ // the SceneNode internal pipeline + continuity chain can read/write them in
208
+ // one place. All optional — planning-time ShotSpec carries none of these.
209
+ // Stage 6 (scene_images) writes these after keyframe generation.
210
+ keyframe_asset_id: z.string().uuid().optional(),
211
+ keyframe_url: z.string().url().optional(),
212
+ // Stage 7 (animate_audio_edit) step 3 (animate) writes these after the
213
+ // image-to-video / text-to-video call succeeds.
214
+ video_asset_id: z.string().uuid().optional(),
215
+ video_url: z.string().url().optional(),
216
+ // Stage 7 step 3 (extract_frame chain — sequential mode only) writes these
217
+ // after each shot's last frame is extracted at duration - 0.1s. Used by the
218
+ // next shot's continuity chain (Method 1).
219
+ last_frame_asset_id: z.string().uuid().optional(),
220
+ last_frame_url: z.string().url().optional(),
221
+ // Stage 7 step 4 (speech) writes these per shot with dialogue_line.
222
+ audio_asset_id: z.string().uuid().optional(),
223
+ audio_url: z.string().url().optional(),
224
+ // Stage 7 step 5 (lip-sync) writes these when lipsync_enabled and the shot
225
+ // has dialogue. The lipsynced clip replaces the shot's video_url in the
226
+ // step-6 combine call.
227
+ lipsynced_asset_id: z.string().uuid().optional(),
228
+ lipsynced_url: z.string().url().optional(),
229
+ // Phase 1C.3 — bridged frame (Method 5). Defensive placeholder; never set
230
+ // in 1C.1 (continuity.applyContinuityToStartFrame already reads this).
231
+ bridged_frame_url: z.string().url().optional(),
232
+ // Phase 1D.1 Method 7 — set true when the user accepts a MatchCutCritic
233
+ // 'break' verdict for this shot's pair. Stage 6 reads this to know the
234
+ // break is resolved and the scene can advance to Stage 7.
235
+ accepted_match_cut_break: z.boolean().optional().register(sceneRenderStateRegistry, RENDER_STATE),
236
+ // ─── Phase 1C.2 — dialogue + editor cut metadata ───────────────────────────
237
+ // All optional; planning-time ShotSpec carries none of these. Populated by
238
+ // the Editor LLM (Stage 7) and the silent-cut-preview sub-gate handler.
239
+ // True when `dialogue_line` is non-null AND the speech generator produced
240
+ // an audio track. The Editor LLM uses this to gate cut-in / cut-out into
241
+ // the dialogue_no_cut_zone (Method 5.13.1 — never trim a syllable).
242
+ has_dialogue: z.boolean().default(false).register(sceneRenderStateRegistry, RENDER_STATE),
243
+ // Measured length of the per-shot speech audio (Stage 7 step 4 writes this).
244
+ // Separate from `duration_seconds` (the planning intent) — the actual
245
+ // recording can run longer/shorter than the spec.
246
+ actual_audio_duration_sec: z.number().optional().register(sceneRenderStateRegistry, RENDER_STATE),
247
+ // Inclusive [start, end] window (seconds, relative to the shot's video clip)
248
+ // during which the Editor LLM MUST NOT cut. Computed from
249
+ // `actual_audio_duration_sec` + small padding by the Editor LLM stage.
250
+ // null when has_dialogue=false (no zone to protect).
251
+ dialogue_no_cut_zone: z.object({ start: z.number(), end: z.number() }).nullable().optional().register(sceneRenderStateRegistry, RENDER_STATE),
252
+ // Editor LLM output (Phase 1C.2). Populated by the Editor LLM stage; the
253
+ // silent-cut-preview sub-gate may patch it via user-applied overrides.
254
+ // Mirrors the editor_decisions audit row shape (migration 135).
255
+ cut_decision: z.object({
256
+ in_offset_sec: z.number().min(0).max(2).default(0),
257
+ out_offset_sec: z.number().min(0).max(2).default(0),
258
+ transition_to_next: TransitionTypeSchema,
259
+ transition_duration_sec: z.number().min(0).max(2).optional(),
260
+ beat_snap_seconds: z.number().nullable().optional()
261
+ }).optional().register(sceneRenderStateRegistry, RENDER_STATE)
262
+ });
263
+ var AssetRefSchema = z.object({
264
+ asset_id: z.string().uuid(),
265
+ url: z.string().url()
266
+ });
267
+ var SceneNodeDataSchema = z.object({
268
+ // Plan fields (Scene Director fills; user editable)
269
+ scene_index: z.number().int().min(1),
270
+ description: z.string().max(500),
271
+ emotional_beat: z.string(),
272
+ duration_seconds: z.number().positive(),
273
+ // Input mode — gates which video_model values are valid
274
+ shot_input_mode: SceneInputModeSchema,
275
+ // Echoed inputs (Scene Director copies from SceneSpec)
276
+ cast_keys: z.array(z.string()),
277
+ location_key: z.string(),
278
+ object_keys: z.array(z.string()),
279
+ continuity_from_prev: z.enum(["hard_cut", "match_last_frame", "dissolve"]),
280
+ // Model picks
281
+ image_model: z.string(),
282
+ video_model: z.string(),
283
+ // Shot list
284
+ shots: z.array(ShotSpecSchema).min(1).max(8),
285
+ // v4.1 Method 6 — pre-generated master keyframe (set in 1C; Phase 1B.2 always null)
286
+ scene_anchor_keyframe: AssetRefSchema.nullable().default(null),
287
+ // Optional per-scene style override
288
+ style_directives: z.object({
289
+ visualStyle: z.string().optional(),
290
+ colorPalette: z.string().optional(),
291
+ lighting: z.string().optional(),
292
+ cameraLanguage: z.string().optional(),
293
+ avoid: z.string().optional()
294
+ }).partial().optional(),
295
+ // Execution state (engine writes; null on planning — Phase 1C populates)
296
+ generated_keyframes: z.array(AssetRefSchema).default([]),
297
+ generated_clips: z.array(AssetRefSchema).default([]),
298
+ composite_video: AssetRefSchema.nullable().default(null),
299
+ last_frame: AssetRefSchema.nullable().default(null),
300
+ scene_audio_track: AssetRefSchema.nullable().default(null),
301
+ // Phase 1C.1 Stage 7 result — composite video assembled from the per-shot
302
+ // clips inside this scene. Optional flat fields kept alongside
303
+ // `composite_video` (AssetRefSchema) so consumers can read either shape.
304
+ composite_video_asset_id: z.string().uuid().optional(),
305
+ composite_video_url: z.string().url().optional()
306
+ });
307
+ var SceneMetadataSchema = z.object({
308
+ entity_type: z.literal("scene"),
309
+ scene_id: z.string(),
310
+ shot_ids: z.array(z.string()),
311
+ emotional_beat: z.string(),
312
+ // Canonical pointer to the canvas SceneNode (workflows.nodes[i].id)
313
+ scene_node_id: z.string(),
314
+ // Opt-in Explode tracking (Phase 2 — null in 1B.2)
315
+ exploded_to_workflow_id: z.string().uuid().nullable().default(null),
316
+ // Phase 1B.2 stashes the full SceneNodeData here so the orchestrator + panel UI
317
+ // don't have to re-resolve it from canvas state.
318
+ // Optional because Stage 5 inserts the entity row BEFORE the Scene Director runs
319
+ // (status='pending' / 'generating') — the field lands after the Scene Director succeeds.
320
+ scene_node_data: SceneNodeDataSchema.optional()
321
+ });
322
+ var MatchCutVerdictSchema = z.object({
323
+ shot_pair: z.tuple([z.string(), z.string()]),
324
+ match_strength: z.enum(["strong", "moderate", "weak", "break"]),
325
+ suggested_adjustments: z.string().max(300),
326
+ checked_at: z.string().datetime()
327
+ });
328
+
329
+ // src/pipeline-types.ts
330
+ var StyleDirectivesSchema = z.object({
331
+ visualStyle: z.string().max(200).optional(),
332
+ colorPalette: z.string().max(200).optional(),
333
+ lighting: z.string().max(200).optional(),
334
+ cameraLanguage: z.string().max(200).optional(),
335
+ avoid: z.string().max(400).optional()
336
+ });
337
+ var PIPELINE_MODEL_STAGES = [
338
+ "characters_image",
339
+ "locations_image",
340
+ "objects_image",
341
+ "scene_keyframes_image",
342
+ "shots_video",
343
+ "script_llm"
344
+ ];
345
+ z.enum(PIPELINE_MODEL_STAGES);
346
+ var PIPELINE_PINNABLE_IMAGE_MODELS = [
347
+ "nano-banana",
348
+ "nano-banana-pro",
349
+ "nano-banana-2-1",
350
+ "flux",
351
+ "gpt-image",
352
+ "gpt-image-2",
353
+ "gpt-image-2-5-flare",
354
+ "gpt-image-2-5-sunburst"
355
+ ];
356
+ var PIPELINE_LEGACY_PINNED_IMAGE_MODELS = ["nano-banana-2"];
357
+ var PIPELINE_ACCEPTED_IMAGE_MODELS = [
358
+ ...PIPELINE_PINNABLE_IMAGE_MODELS,
359
+ ...PIPELINE_LEGACY_PINNED_IMAGE_MODELS
360
+ ];
361
+ var PIPELINE_PINNABLE_VIDEO_MODELS = [
362
+ "kling-turbo",
363
+ "kling",
364
+ "kling-3.0",
365
+ "seedance",
366
+ "seedance-2",
367
+ "seedance-2-fast",
368
+ "seedance-2-mini",
369
+ "seedance-2-5",
370
+ "veo3",
371
+ "veo3.1",
372
+ "veo3_lite",
373
+ "minimax",
374
+ "hailuo-standard",
375
+ "wan-turbo",
376
+ "bytedance-lite",
377
+ "bytedance-pro"
378
+ ];
379
+ var PIPELINE_PINNABLE_SCRIPT_LLMS = [
380
+ "claude-haiku-5-5",
381
+ "claude-sonnet-4-6",
382
+ "claude-opus-4-7",
383
+ "claude-opus-5"
384
+ ];
385
+ var PIPELINE_LEGACY_PINNED_SCRIPT_LLMS = ["claude-haiku-4-5"];
386
+ var PIPELINE_ACCEPTED_SCRIPT_LLMS = [
387
+ ...PIPELINE_PINNABLE_SCRIPT_LLMS,
388
+ ...PIPELINE_LEGACY_PINNED_SCRIPT_LLMS
389
+ ];
390
+ var ImageModelEnum = z.enum(PIPELINE_ACCEPTED_IMAGE_MODELS);
391
+ var VideoModelEnum = z.enum(PIPELINE_PINNABLE_VIDEO_MODELS);
392
+ var ScriptLlmEnum = z.enum(PIPELINE_ACCEPTED_SCRIPT_LLMS);
393
+ var StageModelsSchema = z.object({
394
+ characters_image: ImageModelEnum.optional(),
395
+ locations_image: ImageModelEnum.optional(),
396
+ objects_image: ImageModelEnum.optional(),
397
+ scene_keyframes_image: ImageModelEnum.optional(),
398
+ shots_video: VideoModelEnum.optional(),
399
+ script_llm: ScriptLlmEnum.optional()
400
+ }).optional();
401
+ var PipelineConfigSchema = z.object({
402
+ music_enabled: z.boolean().default(true),
403
+ narration_enabled: z.boolean().default(true),
404
+ lipsync_enabled: z.boolean().default(true),
405
+ freecut_export_enabled: z.boolean().default(false),
406
+ // Phase 1C.2.1 §H — when freecut_export_enabled, choose the serialization
407
+ // format. JSON is the original Nodaro-flat-timeline-v1 shape; FCPXML emits
408
+ // an FCPXML 1.10 timeline that Final Cut Pro / DaVinci Resolve / Premiere
409
+ // can ingest directly. Both reuse the same in-memory timeline reduction.
410
+ freecut_export_format: z.enum(["json", "fcpxml"]).default("json"),
411
+ shot_generation_mode: z.enum(["parallel", "sequential"]).default("parallel"),
412
+ silent_cut_review: z.boolean().default(true),
413
+ // Phase 0 studio — when true, the script stage skips the critic + refine loop
414
+ // and pauses for the user immediately after the first draft ("critic off by
415
+ // default; you decide" — the user can Edit / Regenerate at the gate).
416
+ skip_script_critic: z.boolean().default(false),
417
+ // Studio — when true, the PRODUCTION stages (shot_list / scene_images) advance
418
+ // automatically instead of pausing for per-scene / keyframe review. The
419
+ // studio's control is the creative entities (script/cast/props/locations); the
420
+ // engine then produces the film. The final cut (post_merge) still pauses for
421
+ // review, and animate sub-gates (dialogue/silent-cut) still surface. Mirrors
422
+ // auto-mode's advance for those stages without skipping the creative gates.
423
+ auto_advance_production: z.boolean().default(false),
424
+ // Studio speed — when true, the shot-list stage does NOT auto-force sequential
425
+ // mode for shot continuity, so the animate stage renders all shots in parallel
426
+ // (~minutes vs ~an hour for a multi-shot reel). Trades continuity chaining for
427
+ // speed; per-shot keyframe identity still holds.
428
+ force_parallel_animate: z.boolean().default(false),
429
+ // Global model overrides — apply to every stage of the matching kind unless
430
+ // a more-specific entry in `stage_models` overrides it. Constrained to the
431
+ // pinnable allowlists above; the route handler still re-validates against
432
+ // tier restrictions before pipeline creation.
433
+ image_model: ImageModelEnum.optional(),
434
+ video_model: VideoModelEnum.optional(),
435
+ music_model: z.string().optional(),
436
+ script_llm: ScriptLlmEnum.optional(),
437
+ // Per-stage overrides. Each key is constrained to its kind's allowlist.
438
+ // Empty/missing key = fall back to the global field.
439
+ stage_models: StageModelsSchema
440
+ });
441
+ function resolvePipelineModel(config, stage) {
442
+ if (!config) return void 0;
443
+ const override = config.stage_models?.[stage];
444
+ if (override) return override;
445
+ if (stage === "script_llm") return config.script_llm;
446
+ if (stage.endsWith("_video")) return config.video_model;
447
+ if (stage.endsWith("_image")) return config.image_model;
448
+ return void 0;
449
+ }
450
+ var PipelineInputSchema = z.object({
451
+ pipeline_type: z.enum(PIPELINE_TYPES).default("story_to_video"),
452
+ workflow_id: z.string().uuid().optional(),
453
+ root_node_id: z.string().min(1),
454
+ story_prompt: z.string().min(1).max(4e3),
455
+ target_duration_seconds: z.number().int().min(5).max(3600),
456
+ format: z.enum(PIPELINE_FORMATS),
457
+ output_resolution: z.enum(PIPELINE_OUTPUT_RESOLUTIONS).default("720p"),
458
+ language: z.string().min(2).max(10).default("en"),
459
+ mode: z.enum(PIPELINE_MODES).default("manual"),
460
+ // Legacy back-compat — when both `mode` and `auto_mode` present, `mode` wins.
461
+ auto_mode: z.boolean().optional(),
462
+ style_directives: StyleDirectivesSchema.optional(),
463
+ config: PipelineConfigSchema.partial().optional(),
464
+ max_cost_credits: z.number().int().positive().optional(),
465
+ video_critic_frame_count: z.enum(VIDEO_CRITIC_FRAME_MODES).default("first_last")
466
+ });
467
+ var DetectionResultSchema = z.object({
468
+ characters: z.array(
469
+ z.object({
470
+ key: z.string().regex(/^[a-z][a-z0-9_]{0,63}$/),
471
+ name: z.string(),
472
+ visual_description: z.string(),
473
+ role_hint: z.enum(["protagonist", "antagonist", "supporting", "cameo"]),
474
+ has_dialogue_hint: z.boolean()
475
+ })
476
+ ),
477
+ objects: z.array(
478
+ z.object({
479
+ key: z.string().regex(/^[a-z][a-z0-9_]{0,63}$/),
480
+ name: z.string(),
481
+ visual_description: z.string(),
482
+ narrative_significance: z.string()
483
+ })
484
+ ),
485
+ locations: z.array(
486
+ z.object({
487
+ key: z.string().regex(/^[a-z][a-z0-9_]{0,63}$/),
488
+ name: z.string(),
489
+ visual_description: z.string(),
490
+ parent_location_key: z.string().nullable(),
491
+ variant_kind: z.enum(["main", "time_of_day", "weather", "aftermath"]).nullable()
492
+ })
493
+ ),
494
+ audio_intent: z.object({
495
+ has_narrator: z.boolean(),
496
+ narrator_profile_hint: z.string().nullable(),
497
+ dialogue_speaker_keys: z.array(z.string()),
498
+ music: z.object({
499
+ mood_hint: z.string(),
500
+ bpm_hint: z.number(),
501
+ genre_hints: z.array(z.string())
502
+ }),
503
+ sfx_hints: z.array(z.string())
504
+ })
505
+ });
506
+ var EMOTIONAL_BEAT = z.enum([
507
+ "setup",
508
+ "inciting",
509
+ "rising",
510
+ "tension",
511
+ "climax",
512
+ "release",
513
+ "denouement",
514
+ "reveal",
515
+ "shock",
516
+ "release_humor",
517
+ "reflection"
518
+ ]);
519
+ var SceneSpecSchema = z.object({
520
+ scene_index: z.number().int().min(1),
521
+ description: z.string().max(500),
522
+ emotional_beat: EMOTIONAL_BEAT,
523
+ duration_seconds: z.number().positive(),
524
+ cast_keys: z.array(z.string()),
525
+ location_key: z.string(),
526
+ object_keys: z.array(z.string()),
527
+ dialogue: z.array(
528
+ z.object({
529
+ cast_key: z.string(),
530
+ line: z.string().max(200)
531
+ })
532
+ ).default([]),
533
+ narration: z.string().nullable(),
534
+ continuity_from_prev: z.enum(["hard_cut", "match_last_frame", "dissolve"]),
535
+ shot_count_hint: z.number().int().min(1).max(8)
536
+ });
537
+ var ShowrunnerPlanSchema = z.object({
538
+ title: z.string(),
539
+ logline: z.string().max(200),
540
+ target_duration_seconds: z.number().positive(),
541
+ format: z.enum(PIPELINE_FORMATS),
542
+ output_resolution: z.enum(PIPELINE_OUTPUT_RESOLUTIONS),
543
+ language: z.string(),
544
+ genre: z.enum([
545
+ "action",
546
+ "drama",
547
+ "thriller",
548
+ "comedy",
549
+ "horror",
550
+ "sci-fi",
551
+ "documentary"
552
+ ]),
553
+ tone: z.array(
554
+ z.enum([
555
+ "gritty",
556
+ "hopeful",
557
+ "tense",
558
+ "melancholic",
559
+ "playful",
560
+ "epic",
561
+ "intimate",
562
+ "surreal",
563
+ "nostalgic",
564
+ "urgent",
565
+ "dreamy",
566
+ "cold",
567
+ "warm",
568
+ "menacing",
569
+ "whimsical",
570
+ "somber",
571
+ "triumphant",
572
+ "eerie"
573
+ ])
574
+ ).max(5),
575
+ cast: z.array(
576
+ z.object({
577
+ key: z.string(),
578
+ name: z.string(),
579
+ role: z.enum(["protagonist", "antagonist", "supporting", "cameo"]),
580
+ visual_description: z.string(),
581
+ voice_profile: z.string(),
582
+ has_dialogue: z.boolean(),
583
+ angle_count_hint: z.number().int().min(1).max(8),
584
+ expression_set_hint: z.array(
585
+ z.enum([
586
+ "neutral",
587
+ "smiling",
588
+ "laughing",
589
+ "angry",
590
+ "scared",
591
+ "determined",
592
+ "sad",
593
+ "surprised",
594
+ "thoughtful",
595
+ "crying"
596
+ ])
597
+ ).max(6).default([])
598
+ })
599
+ ).max(8),
600
+ locations: z.array(
601
+ z.object({
602
+ key: z.string(),
603
+ name: z.string(),
604
+ visual_description: z.string(),
605
+ variants_needed: z.array(z.string()).default([])
606
+ })
607
+ ).max(8),
608
+ objects: z.array(
609
+ z.object({
610
+ key: z.string(),
611
+ name: z.string(),
612
+ visual_description: z.string(),
613
+ narrative_significance: z.string()
614
+ })
615
+ ).max(10),
616
+ scenes: z.array(SceneSpecSchema).min(3).max(20),
617
+ beats: z.array(
618
+ z.object({
619
+ type: z.enum(["hook", "rising", "climax", "resolution"]),
620
+ scene_indices: z.array(z.number().int())
621
+ })
622
+ ),
623
+ has_narrator: z.boolean(),
624
+ narrator_profile: z.string().nullable(),
625
+ /**
626
+ * Phase 1C.2.1 §G — optional narration_script for omniscient narrator-style
627
+ * formats (trailers, documentaries, retro storytelling). When present, Stage
628
+ * 7 sub-step 7c synthesizes a single narration audio track that spans the
629
+ * full pipeline duration and gets mixed over the music in the final merge
630
+ * (music ducks to 60% volume per spec §G5). Leave undefined for dialogue-
631
+ * driven scenes that don't benefit from narration.
632
+ */
633
+ narration_script: z.object({
634
+ text: z.string().min(20).max(4e3),
635
+ voice_id: z.string().optional()
636
+ }).optional(),
637
+ music_plan: z.object({
638
+ mood: z.string(),
639
+ bpm_target: z.number(),
640
+ genre_hints: z.array(z.string())
641
+ }),
642
+ global_style: z.object({
643
+ visual_style: z.string(),
644
+ color_palette: z.string(),
645
+ lighting: z.string(),
646
+ camera_language: z.string()
647
+ }),
648
+ total_duration_seconds: z.number(),
649
+ estimated_scene_count: z.number(),
650
+ warnings: z.array(z.string())
651
+ });
652
+ var CriticIssueSchema = z.object({
653
+ severity: z.enum(["blocking", "warning"]),
654
+ scene_index: z.number().int().nullable(),
655
+ issue_type: z.string(),
656
+ description: z.string(),
657
+ suggested_fix: z.string()
658
+ });
659
+ var ScriptCriticVerdictSchema = z.object({
660
+ verdict: z.enum(["pass", "fail"]),
661
+ issues: z.array(
662
+ CriticIssueSchema.extend({
663
+ issue_type: z.enum([
664
+ "duration",
665
+ "consistency",
666
+ "shot_count_hint",
667
+ "generatability",
668
+ "dialogue",
669
+ "continuity",
670
+ "arc"
671
+ ])
672
+ })
673
+ ),
674
+ duration_analysis: z.object({
675
+ target_seconds: z.number(),
676
+ actual_sum_seconds: z.number(),
677
+ deviation_percent: z.number(),
678
+ within_tolerance: z.boolean()
679
+ }),
680
+ improvement_suggestions: z.array(z.string()).optional()
681
+ });
682
+ var CastCoverageCriticVerdictSchema = z.object({
683
+ verdict: z.enum(["pass", "fail"]),
684
+ issues: z.array(
685
+ CriticIssueSchema.extend({
686
+ issue_type: z.enum([
687
+ "orphan_cast",
688
+ "unresolved_ref",
689
+ "dialogue_load_skew",
690
+ "role_completeness",
691
+ "key_uniqueness"
692
+ ])
693
+ })
694
+ ),
695
+ dialogue_distribution: z.array(
696
+ z.object({
697
+ cast_key: z.string(),
698
+ line_count: z.number(),
699
+ share_pct: z.number()
700
+ })
701
+ )
702
+ });
703
+ var LocationsCoverageCriticIssueSchema = CriticIssueSchema.extend({
704
+ issue_type: z.enum([
705
+ "orphan_location",
706
+ "unresolved_scene_location_ref",
707
+ "duplicate_key",
708
+ "name_too_similar",
709
+ "description_too_short",
710
+ "redundant_location"
711
+ ]),
712
+ // `nullish()` (= `.nullable().optional()`) instead of `.optional()` —
713
+ // Sonnet routinely emits `"location_key": null` for issue_types like
714
+ // `redundant_location` that flag a structural problem without pointing
715
+ // at a specific key. `.optional()` only accepted `undefined`, so those
716
+ // emits failed Zod validation, exhausted the critic retry budget, and
717
+ // killed the whole Stage 1 with `locations_coverage validation failed
718
+ // after 2 attempts: issues.N.location_key: Expected string, received
719
+ // null`. Same fix already in place on `scene_index` below.
720
+ location_key: z.string().nullish(),
721
+ scene_index: z.number().int().nullish()
722
+ });
723
+ var LocationsCoverageCriticVerdictSchema = z.object({
724
+ verdict: z.enum(["pass", "fail"]),
725
+ issues: z.array(LocationsCoverageCriticIssueSchema)
726
+ });
727
+ var CharacterImageCriticVerdictSchema = z.object({
728
+ verdict: z.enum(["pass", "fail"]),
729
+ prompt_adherence_score: z.number().int().min(0).max(10),
730
+ identified_subject: z.string().min(1).max(500),
731
+ issues: z.array(
732
+ z.object({
733
+ severity: z.enum(["blocking", "warning"]),
734
+ category: z.enum([
735
+ "wrong_subject",
736
+ "wrong_attributes",
737
+ "visual_artifacts",
738
+ "style_mismatch",
739
+ "other"
740
+ ]),
741
+ description: z.string().min(1).max(500),
742
+ suggested_fix: z.string().min(1).max(300)
743
+ })
744
+ ),
745
+ approved_summary: z.string().min(1).max(500).optional()
746
+ });
747
+ var LocationImageCriticVerdictSchema = z.object({
748
+ verdict: z.enum(["pass", "fail"]),
749
+ prompt_adherence_score: z.number().int().min(0).max(10),
750
+ identified_subject: z.string().min(1).max(500),
751
+ issues: z.array(
752
+ z.object({
753
+ severity: z.enum(["blocking", "warning"]),
754
+ category: z.enum([
755
+ "wrong_location_type",
756
+ "wrong_time_of_day",
757
+ "wrong_attributes",
758
+ "visual_artifacts",
759
+ "style_mismatch",
760
+ "other"
761
+ ]),
762
+ description: z.string().min(1).max(500),
763
+ suggested_fix: z.string().min(1).max(300)
764
+ })
765
+ ),
766
+ approved_summary: z.string().min(1).max(500).optional()
767
+ });
768
+ var StoryboardCohesionCriticVerdictSchema = z.object({
769
+ overall_assessment: z.enum(["coherent", "minor_issues", "incoherent"]),
770
+ coherence_score: z.number().int().min(0).max(10),
771
+ summary: z.string().min(1).max(500),
772
+ findings: z.array(
773
+ z.object({
774
+ severity: z.enum(["info", "warning", "blocking"]),
775
+ category: z.enum([
776
+ "character_inconsistency",
777
+ "location_inconsistency",
778
+ "lighting_mismatch",
779
+ "style_drift",
780
+ "missing_establishing_shot",
781
+ "plot_jump",
782
+ "other"
783
+ ]),
784
+ affected_scenes: z.array(z.number().int().min(1)).max(20),
785
+ description: z.string().min(1).max(500),
786
+ suggested_action: z.string().min(1).max(300)
787
+ })
788
+ ).max(30)
789
+ });
790
+ var VideoCriticVerdictSchema = z.object({
791
+ verdict: z.enum(["pass", "fail"]),
792
+ prompt_adherence_score: z.number().int().min(0).max(10),
793
+ continuity_score: z.number().int().min(0).max(10).nullable(),
794
+ identified_action: z.string().min(1).max(500),
795
+ issues: z.array(
796
+ z.object({
797
+ severity: z.enum(["blocking", "warning"]),
798
+ category: z.enum([
799
+ "wrong_action",
800
+ "prompt_mismatch",
801
+ "continuity_break",
802
+ "visual_artifacts",
803
+ "motion_glitch",
804
+ "style_mismatch",
805
+ "other"
806
+ ]),
807
+ description: z.string().min(1).max(500),
808
+ suggested_fix: z.string().min(1).max(300)
809
+ })
810
+ ).max(20),
811
+ approved_summary: z.string().min(1).max(500).optional()
812
+ });
813
+ var CharacterMetadataSchema = z.object({
814
+ entity_type: z.literal("character"),
815
+ name: z.string(),
816
+ visual_description: z.string(),
817
+ role: z.enum(["protagonist", "antagonist", "supporting", "cameo"]),
818
+ estimated_screen_time_shots: z.number(),
819
+ has_dialogue: z.boolean(),
820
+ voice_profile: z.string().optional(),
821
+ angle_count: z.number().int().min(1).max(8)
822
+ });
823
+ var ObjectMetadataSchema = z.object({
824
+ entity_type: z.literal("object"),
825
+ name: z.string(),
826
+ visual_description: z.string(),
827
+ narrative_significance: z.string(),
828
+ scenes_present: z.array(z.string())
829
+ });
830
+ var LocationMetadataSchema = z.object({
831
+ entity_type: z.literal("location"),
832
+ name: z.string(),
833
+ visual_description: z.string(),
834
+ variants_needed: z.array(z.string())
835
+ });
836
+ var EntityMetadataSchema = z.discriminatedUnion("entity_type", [
837
+ CharacterMetadataSchema,
838
+ ObjectMetadataSchema,
839
+ LocationMetadataSchema,
840
+ SceneMetadataSchema
841
+ // new in Phase 1B.2
842
+ ]);
843
+
844
+ // src/pipeline-chat.ts
845
+ var ChatTurnResponseSchema = z.object({
846
+ reply: z.string().min(1).max(4e3),
847
+ proposed_change: z.discriminatedUnion("change_type", [
848
+ z.object({
849
+ change_type: z.literal("edit_artifact"),
850
+ json_patch: z.array(
851
+ z.object({
852
+ op: z.enum(["add", "remove", "replace"]),
853
+ path: z.string().min(1),
854
+ value: z.unknown().optional()
855
+ })
856
+ ).min(1).max(50),
857
+ summary: z.string().min(1).max(200)
858
+ }),
859
+ z.object({
860
+ change_type: z.literal("suggest_branch"),
861
+ from_stage: z.enum([
862
+ "script",
863
+ "characters",
864
+ "objects",
865
+ "locations",
866
+ "shot_list",
867
+ "scene_images",
868
+ "animate_audio_edit"
869
+ ]),
870
+ reason: z.string().min(1).max(300)
871
+ })
872
+ ]).nullable()
873
+ });
874
+ var STAGE_PATCH_SCHEMA = {
875
+ script: ShowrunnerPlanSchema,
876
+ characters: null,
877
+ objects: null,
878
+ locations: null,
879
+ shot_list: null,
880
+ scene_images: null,
881
+ animate_audio_edit: null,
882
+ post_merge: null
883
+ };
884
+ var PIPELINE_STAGE_NAMES = [
885
+ "script",
886
+ "characters",
887
+ "objects",
888
+ "locations",
889
+ "shot_list",
890
+ "scene_images",
891
+ "animate_audio_edit",
892
+ "post_merge"
893
+ ];
894
+ var PipelineStageNameSchema = z.enum(PIPELINE_STAGE_NAMES);
895
+ var PipelineStatusSchema = z.enum([
896
+ "queued",
897
+ "running",
898
+ "awaiting_approval",
899
+ "completed",
900
+ "failed",
901
+ "cancelled",
902
+ "forked"
903
+ ]);
904
+ var PipelineStageStatusSchema = z.enum([
905
+ "pending",
906
+ "running",
907
+ "awaiting_approval",
908
+ "approved",
909
+ "rejected",
910
+ "failed",
911
+ "cancelled"
912
+ ]);
913
+ var PipelineStateSchema = z.enum([
914
+ "pipeline_owned_running",
915
+ "pipeline_owned_awaiting_approval",
916
+ "pipeline_owned_approved",
917
+ "pipeline_orphaned"
918
+ ]);
919
+ var EntityStateChangeEventSchema = z.object({
920
+ type: z.literal("entity:state_change"),
921
+ pipelineId: z.string(),
922
+ pipelineEntityId: z.string(),
923
+ newState: PipelineStateSchema
924
+ });
925
+ var EntityStaleEventSchema = z.object({
926
+ type: z.literal("entity:stale"),
927
+ pipelineId: z.string(),
928
+ pipelineEntityId: z.string(),
929
+ reason: z.enum(["upstream_changed", "user_edit", "manual"]).optional()
930
+ });
931
+ var PipelineForkedEventSchema = z.object({
932
+ type: z.literal("pipeline:forked"),
933
+ pipelineId: z.string(),
934
+ forkedAt: z.string(),
935
+ // ISO timestamp
936
+ forkedStatus: z.string(),
937
+ forkReason: z.string().optional()
938
+ });
939
+ var PipelineDriftSummarySchema = z.object({
940
+ type: z.literal("pipeline:drift"),
941
+ pipelineId: z.string(),
942
+ stageName: z.string(),
943
+ driftedEntityIds: z.array(z.string()),
944
+ summary: z.string().optional()
945
+ });
946
+ var PipelineCompletedEventSchema = z.object({
947
+ type: z.literal("pipeline:completed"),
948
+ pipelineId: z.string(),
949
+ finalOutputAssetId: z.string().uuid().nullable(),
950
+ finalOutputUrl: z.string()
951
+ });
952
+ var SubGateNameSchema = z.enum([
953
+ "silent_cut_preview",
954
+ "dialogue_recheck",
955
+ "match_cut_break_pending"
956
+ ]);
957
+ var ANIMATE_SUB_GATES = ["silent_cut_preview", "dialogue_recheck"];
958
+ var AnimateSubGateSchema = z.enum(ANIMATE_SUB_GATES);
959
+ var MATCH_CUT_BREAK_GATE = "match_cut_break_pending";
960
+ var StageAwaitingSubGateEventSchema = z.object({
961
+ type: z.literal("stage:awaiting_sub_gate"),
962
+ pipelineId: z.string().uuid(),
963
+ stageName: z.enum(["animate_audio_edit", "scene_images"]),
964
+ subGate: SubGateNameSchema,
965
+ payload: z.record(z.string(), z.unknown()).optional()
966
+ });
967
+ var PipelineMusicReadyEventSchema = z.object({
968
+ type: z.literal("pipeline:music_ready"),
969
+ pipelineId: z.string().uuid(),
970
+ musicAssetUrl: z.string().url(),
971
+ beatGridLength: z.number()
972
+ });
973
+ var PipelineEditorDecisionsReadyEventSchema = z.object({
974
+ type: z.literal("pipeline:editor_decisions_ready"),
975
+ pipelineId: z.string().uuid()
976
+ });
977
+
978
+ // src/pipeline-validation.ts
979
+ function validateObjects(objects, plan) {
980
+ const issues = [];
981
+ const seenKeys = /* @__PURE__ */ new Map();
982
+ for (const obj of objects) {
983
+ seenKeys.set(obj.key, (seenKeys.get(obj.key) ?? 0) + 1);
984
+ }
985
+ for (const [key, count] of seenKeys) {
986
+ if (count > 1) {
987
+ issues.push({
988
+ severity: "blocking",
989
+ type: "duplicate_key",
990
+ object_key: key,
991
+ message: `Object key "${key}" appears ${count} times \u2014 keys must be unique`
992
+ });
993
+ }
994
+ }
995
+ for (const obj of objects) {
996
+ if (!obj.narrative_significance || obj.narrative_significance.trim() === "") {
997
+ issues.push({
998
+ severity: "blocking",
999
+ type: "empty_significance",
1000
+ object_key: obj.key,
1001
+ message: `Object "${obj.key}" has empty narrative_significance`
1002
+ });
1003
+ }
1004
+ }
1005
+ const objectKeySet = new Set(objects.map((o) => o.key));
1006
+ const referencedKeys = /* @__PURE__ */ new Set();
1007
+ for (const sc of plan.scenes) {
1008
+ for (const k of sc.object_keys) {
1009
+ referencedKeys.add(k);
1010
+ if (!objectKeySet.has(k)) {
1011
+ issues.push({
1012
+ severity: "blocking",
1013
+ type: "unresolved_scene_object_ref",
1014
+ object_key: k,
1015
+ scene_index: sc.scene_index,
1016
+ message: `Scene ${sc.scene_index} references unknown object_key "${k}"`
1017
+ });
1018
+ }
1019
+ }
1020
+ }
1021
+ for (const obj of objects) {
1022
+ if (!referencedKeys.has(obj.key)) {
1023
+ issues.push({
1024
+ severity: "warning",
1025
+ type: "orphan_object",
1026
+ object_key: obj.key,
1027
+ message: `Object "${obj.key}" listed but no scene references it`
1028
+ });
1029
+ }
1030
+ }
1031
+ const ok = !issues.some((i) => i.severity === "blocking");
1032
+ return { ok, verdict: ok ? "pass" : "fail", issues };
1033
+ }
1034
+ var VoiceMatchSchema = z.object({
1035
+ voice_source: z.enum(["premade", "custom"]),
1036
+ voice_id: z.string().min(1).optional(),
1037
+ voice_design_prompt: z.string().max(500).optional(),
1038
+ reasoning: z.string().max(500)
1039
+ }).refine(
1040
+ (v) => v.voice_source === "premade" ? typeof v.voice_id === "string" && v.voice_id.length > 0 : typeof v.voice_design_prompt === "string" && v.voice_design_prompt.length > 0,
1041
+ {
1042
+ message: "voice_id is required when voice_source='premade'; voice_design_prompt is required when voice_source='custom'"
1043
+ }
1044
+ );
1045
+
1046
+ // src/character-voice.ts
1047
+ var RDQUO = String.fromCharCode(8221);
1048
+ var LDQUO = String.fromCharCode(8220);
1049
+ var RAQUO = String.fromCharCode(187);
1050
+ var LAQUO = String.fromCharCode(171);
1051
+ var RSQUO = String.fromCharCode(8217);
1052
+ var ATTRIBUTED_DIALOGUE_RE = new RegExp(
1053
+ String.raw`(?<=^|[\n\r.!?;,"${RDQUO}${RAQUO}])\s*([\p{L}][\p{L}\p{N}'${RSQUO}-]*(?:\s+[\p{L}][\p{L}\p{N}'${RSQUO}-]*){0,3})\s*:\s*(?:"([^"]+)"|${LDQUO}([^${RDQUO}]+)${RDQUO}|${LAQUO}([^${RAQUO}]+)${RAQUO})`,
1054
+ "gu"
1055
+ );
1056
+ function parseAttributedDialogue(prompt) {
1057
+ if (!prompt) return [];
1058
+ const out = [];
1059
+ for (const m of prompt.matchAll(ATTRIBUTED_DIALOGUE_RE)) {
1060
+ const speaker = m[1]?.trim() ?? "";
1061
+ const line = (m[2] ?? m[3] ?? m[4] ?? "").trim();
1062
+ if (speaker && line) out.push({ speaker, line });
1063
+ }
1064
+ return out;
1065
+ }
1066
+ function resolveDialogueVoices(dialogue, voices, defaultVoiceId) {
1067
+ const bySpeaker = /* @__PURE__ */ new Map();
1068
+ for (const v of voices) {
1069
+ const key = v.speaker?.trim().toLowerCase();
1070
+ if (key) bySpeaker.set(key, v);
1071
+ }
1072
+ const soleVoice = voices.length === 1 ? voices[0] : void 0;
1073
+ const firstVoice = voices[0];
1074
+ const lineFor = (text, spec) => ({
1075
+ text,
1076
+ voice: spec.voiceId,
1077
+ ...spec.voiceType ? { voiceType: spec.voiceType } : {}
1078
+ });
1079
+ const out = [];
1080
+ for (const { speaker, line } of dialogue) {
1081
+ const text = line.trim();
1082
+ if (!text) continue;
1083
+ const matched = bySpeaker.get(speaker.trim().toLowerCase());
1084
+ if (matched) {
1085
+ out.push(lineFor(text, matched));
1086
+ } else if (defaultVoiceId) {
1087
+ out.push({ text, voice: defaultVoiceId });
1088
+ } else if (soleVoice) {
1089
+ out.push(lineFor(text, soleVoice));
1090
+ } else if (firstVoice) {
1091
+ out.push(lineFor(text, firstVoice));
1092
+ }
1093
+ }
1094
+ return out;
1095
+ }
1096
+ var EntityRejectInputSchema = z.object({
1097
+ feedback: z.string().min(1).max(2e3)
1098
+ });
1099
+ var ENTITY_STATUSES = [
1100
+ "pending",
1101
+ "generating",
1102
+ "awaiting_approval",
1103
+ "approved",
1104
+ "rejected",
1105
+ "failed",
1106
+ // Phase 3 (granular-pipeline-control) — Stage 2 Character Wizard.
1107
+ // `pending_description` is the initial state for character entities in
1108
+ // manual/guided mode pipelines; the engine waits for the user's Step A
1109
+ // approval before generating the portrait. `skipped` is a terminal state
1110
+ // for entities the user explicitly opts out of (no generation, excluded
1111
+ // from stage-advance gating). Migration: 154_phase_1d3_character_wizard.sql.
1112
+ "pending_description",
1113
+ "skipped"
1114
+ ];
1115
+ var ENTITY_TYPES = ["character", "object", "location", "scene"];
1116
+ var ImageCriticIssueSchema = z.object({
1117
+ type: z.enum([
1118
+ "continuity_break",
1119
+ "identity_mismatch",
1120
+ "composition_break",
1121
+ "wardrobe_inconsistency",
1122
+ "style_drift",
1123
+ "prompt_mismatch"
1124
+ ]),
1125
+ severity: z.enum(["blocking", "warning", "info"]),
1126
+ message: z.string(),
1127
+ suggested_fix: z.string().optional()
1128
+ });
1129
+ var ImageCriticVerdictSchema = z.object({
1130
+ ok: z.boolean(),
1131
+ issues: z.array(ImageCriticIssueSchema),
1132
+ notes: z.string().max(500)
1133
+ });
1134
+ var IMAGE_CRITIC_LEAF_MODES = [
1135
+ "character-consistency",
1136
+ "realism",
1137
+ "prompt-adherence",
1138
+ "anatomy",
1139
+ "aesthetic",
1140
+ "style-match"
1141
+ ];
1142
+ var IMAGE_CRITIC_MODES = [
1143
+ ...IMAGE_CRITIC_LEAF_MODES,
1144
+ "all"
1145
+ ];
1146
+ var modeResult = z.object({
1147
+ score: z.number().min(0).max(1),
1148
+ feedback: z.string().min(1).max(300)
1149
+ });
1150
+ var issue = z.object({
1151
+ category: z.string(),
1152
+ severity: z.enum(["blocking", "warning", "info"]),
1153
+ description: z.string().max(400)
1154
+ });
1155
+ var issueLenient = z.preprocess(
1156
+ (v) => typeof v === "string" ? { category: "general", severity: "warning", description: v.slice(0, 400) } : v,
1157
+ issue
1158
+ );
1159
+ var ImageCriticResultSchema = z.object({
1160
+ score: z.number().min(0).max(1),
1161
+ feedback: z.string().min(1).max(600),
1162
+ issues: z.array(issueLenient).optional(),
1163
+ perMode: z.object({
1164
+ "character-consistency": modeResult.optional(),
1165
+ "realism": modeResult.optional(),
1166
+ "prompt-adherence": modeResult.optional(),
1167
+ "anatomy": modeResult.optional(),
1168
+ "aesthetic": modeResult.optional(),
1169
+ "style-match": modeResult.optional()
1170
+ }).strict().optional()
1171
+ });
1172
+ var SCENE_HELPER_NAMES = [
1173
+ // Text/planning-only — shipped in 1B.3
1174
+ "audit_prompt",
1175
+ "improve_prompt",
1176
+ "generate_motion",
1177
+ "optimize_for_model",
1178
+ "add_broll",
1179
+ "bridge_to_next_scene",
1180
+ "anchor_scene_style",
1181
+ // Vision-keyframe — activated in Phase 1C.1
1182
+ "audit_images",
1183
+ "fix_continuity",
1184
+ "validate_match_cut"
1185
+ ];
1186
+ var SceneHelperNameSchema = z.enum(SCENE_HELPER_NAMES);
1187
+ var HELPERS_SHIPPED_IN_1B3 = /* @__PURE__ */ new Set([
1188
+ "audit_prompt",
1189
+ "improve_prompt",
1190
+ "generate_motion",
1191
+ "optimize_for_model",
1192
+ "add_broll",
1193
+ "bridge_to_next_scene",
1194
+ "anchor_scene_style",
1195
+ // Phase 1C.1 — activated
1196
+ "audit_images",
1197
+ "fix_continuity",
1198
+ "validate_match_cut"
1199
+ ]);
1200
+ var ACTIVE_SCENE_HELPERS = HELPERS_SHIPPED_IN_1B3;
1201
+ var AuditPromptIssueSchema = z.object({
1202
+ shot_id: z.string(),
1203
+ severity: z.enum(["blocking", "warning", "info"]),
1204
+ issue_type: z.enum([
1205
+ "contradiction",
1206
+ "missing_beat",
1207
+ "off_format",
1208
+ "camera_motion_mismatch"
1209
+ ]),
1210
+ message: z.string(),
1211
+ suggested_fix: z.string()
1212
+ });
1213
+ var AuditPromptResultSchema = z.object({
1214
+ scene_id: z.string(),
1215
+ ok: z.boolean(),
1216
+ issues_per_shot: z.array(AuditPromptIssueSchema),
1217
+ scene_level_notes: z.string().max(400)
1218
+ });
1219
+ var ImprovePromptInputSchema = z.object({
1220
+ shot_ids: z.array(z.string()).min(1),
1221
+ field_targets: z.array(z.enum(["action", "motion_prompt", "dialogue"])).min(1)
1222
+ });
1223
+ var ImprovePromptResultSchema = z.object({
1224
+ scene_id: z.string(),
1225
+ shots: z.array(
1226
+ z.object({
1227
+ shot_id: z.string(),
1228
+ action: z.string().max(300).optional(),
1229
+ motion_prompt: z.string().max(200).optional(),
1230
+ dialogue_line: z.string().max(200).optional(),
1231
+ reasoning: z.string().max(300)
1232
+ })
1233
+ )
1234
+ });
1235
+ var GenerateMotionInputSchema = z.object({
1236
+ shot_ids: z.array(z.string()).min(1)
1237
+ });
1238
+ var GenerateMotionResultSchema = z.object({
1239
+ scene_id: z.string(),
1240
+ shots: z.array(
1241
+ z.object({
1242
+ shot_id: z.string(),
1243
+ motion_prompt: z.string().max(200)
1244
+ })
1245
+ )
1246
+ });
1247
+ var OptimizeForModelInputSchema = z.object({
1248
+ target_model: z.string()
1249
+ });
1250
+ var OptimizeForModelResultSchema = z.object({
1251
+ scene_id: z.string(),
1252
+ target_model: z.string(),
1253
+ shots: z.array(
1254
+ z.object({
1255
+ shot_id: z.string(),
1256
+ action: z.string().max(300),
1257
+ motion_prompt: z.string().max(200)
1258
+ })
1259
+ ),
1260
+ rationale: z.string().max(300)
1261
+ });
1262
+ var AddBRollResultSchema = z.object({
1263
+ scene_id: z.string(),
1264
+ candidates: z.array(
1265
+ z.object({
1266
+ proposed_insert_after_shot_id: z.string(),
1267
+ insert_kind: z.enum(["reaction_shot", "cutaway", "establishing", "transition"]),
1268
+ shot: ShotSpecSchema,
1269
+ rationale: z.string().max(200)
1270
+ })
1271
+ ).min(1).max(4),
1272
+ scene_duration_delta: z.number()
1273
+ });
1274
+ var BridgeToNextSceneInputSchema = z.object({
1275
+ target_shot_id: z.string()
1276
+ });
1277
+ var BridgeToNextSceneResultSchema = z.object({
1278
+ scene_id: z.string(),
1279
+ target_shot_id: z.string(),
1280
+ bridge_image_prompt: z.string().max(500),
1281
+ reasoning: z.string().max(300)
1282
+ });
1283
+ var AnchorSceneStyleResultSchema = z.object({
1284
+ scene_id: z.string(),
1285
+ anchor_prompt: z.string().max(800),
1286
+ asset_id: z.string().uuid(),
1287
+ asset_url: z.string().url(),
1288
+ credits_spent: z.number()
1289
+ });
1290
+ var AuditImagesShotEntrySchema = z.object({
1291
+ shot_id: z.string(),
1292
+ ok: z.boolean(),
1293
+ /** Verdict body — empty when the shot has no `keyframe_url` yet (skipped). */
1294
+ verdict: ImageCriticVerdictSchema.nullable(),
1295
+ /** True when the shot had no keyframe to audit. */
1296
+ skipped: z.boolean()
1297
+ });
1298
+ var AuditImagesResultSchema = z.object({
1299
+ scene_id: z.string(),
1300
+ ok: z.boolean(),
1301
+ shot_issues: z.array(AuditImagesShotEntrySchema),
1302
+ /** Roll-up summary suitable for in-app display ("3 of 5 shots have issues"). */
1303
+ summary: z.string().max(400)
1304
+ });
1305
+ var FixContinuityInputSchema = z.object({
1306
+ target_shot_id: z.string()
1307
+ });
1308
+ var FixContinuityResultSchema = z.object({
1309
+ scene_id: z.string(),
1310
+ target_shot_id: z.string(),
1311
+ action: z.enum(["regenerated", "no_action_needed"]),
1312
+ critic_verdict: ImageCriticVerdictSchema,
1313
+ /** Populated only when `action === "regenerated"`. */
1314
+ new_keyframe_url: z.string().url().optional(),
1315
+ new_keyframe_asset_id: z.string().uuid().optional()
1316
+ });
1317
+ var ValidateMatchCutInputSchema = z.object({
1318
+ target_shot_id: z.string()
1319
+ });
1320
+ var ValidateMatchCutResultSchema = z.object({
1321
+ scene_id: z.string(),
1322
+ /** Tuple [shot_id_a, shot_id_b] — the target shot + the next shot. */
1323
+ shot_pair: z.tuple([z.string(), z.string()]),
1324
+ match_strength: z.enum(["strong", "moderate", "weak", "break"]),
1325
+ critic_verdict: ImageCriticVerdictSchema,
1326
+ /** Optional follow-up actions the user could take (free-form, ≤300 chars). */
1327
+ suggested_adjustments: z.string().max(300)
1328
+ });
1329
+
1330
+ // src/studio-transient.ts
1331
+ var STUDIO_TRANSIENT_KEYS = [
1332
+ "trash",
1333
+ "pendingStills",
1334
+ "pendingClips",
1335
+ // The two markers that genuinely DO live at this level: a soundtrack render
1336
+ // and a story-planning run in flight. Same rule as the per-shot pair — they
1337
+ // name jobs on the owner's account and nobody else can land them.
1338
+ "pendingMusic",
1339
+ "pendingDraft",
1340
+ "freecutDraftUrl"
1341
+ ];
1342
+ var STUDIO_SHOT_TRANSIENT_KEYS = ["pendingClips", "pendingClip", "pendingStills"];
1343
+ var STUDIO_SHOT_DRAFT_KEYS = ["stillSlots", "clipSlots"];
1344
+ var STUDIO_PREVIZ_RUN_STATE_KEYS = ["pendingJobs", "proSubmission"];
1345
+ var STUDIO_SHOT_PRIVATE_KEYS = [...STUDIO_SHOT_TRANSIENT_KEYS, ...STUDIO_SHOT_DRAFT_KEYS];
1346
+ var STUDIO_TAKE_VOICE_KEYS = ["revoiceTo", "voiceMode"];
1347
+ var STUDIO_TAKE_SEQUENCE_KEYS = ["sequenceEndpoints"];
1348
+ var STUDIO_TAKE_PRIVATE_KEYS = [...STUDIO_TAKE_VOICE_KEYS, ...STUDIO_TAKE_SEQUENCE_KEYS];
1349
+ var STUDIO_SEQUENCE_PLANNING_KEYS = ["sequenceRecommendations"];
1350
+ var STUDIO_SEQUENCE_UNIT_REVIEW_KEYS = ["continuationAcceptance"];
1351
+ var STUDIO_SEQUENCE_POLICY_KEYS = ["sequenceGenerationPolicies"];
1352
+ var STUDIO_SEQUENCE_UNIT_MANIFEST_KEYS = ["requestManifest"];
1353
+ var STUDIO_KEYFRAME_NODE_TRANSIENT_KEYS = ["keyframePendingImages"];
1354
+ var STUDIO_KEYFRAME_TRANSIENT_KEYS = ["pendingImages"];
1355
+ var STUDIO_KEYFRAME_REVIEW_KEYS = ["rejections"];
1356
+ var STUDIO_KEYFRAME_ACCEPTANCE_PRIVATE_KEYS = ["waivedReason"];
1357
+ var STUDIO_KEYFRAME_PRIVATE_KEYS = [...STUDIO_KEYFRAME_TRANSIENT_KEYS, ...STUDIO_KEYFRAME_REVIEW_KEYS];
1358
+ function isRecord(value) {
1359
+ return !!value && typeof value === "object" && !Array.isArray(value);
1360
+ }
1361
+ function withoutKeys(source, drop) {
1362
+ const kept = {};
1363
+ for (const [key, value] of Object.entries(source)) {
1364
+ if (drop.includes(key)) continue;
1365
+ kept[key] = value;
1366
+ }
1367
+ return kept;
1368
+ }
1369
+ function stripShots(value, drop) {
1370
+ if (!Array.isArray(value)) return value;
1371
+ let changed = false;
1372
+ const out = value.map((entry) => {
1373
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) return entry;
1374
+ const shot = entry;
1375
+ if (!drop.some((key) => key in shot)) return entry;
1376
+ changed = true;
1377
+ return withoutKeys(shot, drop);
1378
+ });
1379
+ return changed ? out : value;
1380
+ }
1381
+ function stripPrevizRunState(value) {
1382
+ if (!Array.isArray(value)) return value;
1383
+ let changed = false;
1384
+ const out = value.map((entry) => {
1385
+ if (!isRecord(entry)) return entry;
1386
+ const previz = entry.previsualization;
1387
+ if (!isRecord(previz) || !STUDIO_PREVIZ_RUN_STATE_KEYS.some((key) => key in previz)) return entry;
1388
+ changed = true;
1389
+ return { ...entry, previsualization: withoutKeys(previz, STUDIO_PREVIZ_RUN_STATE_KEYS) };
1390
+ });
1391
+ return changed ? out : value;
1392
+ }
1393
+ function stripStudioTransientSettings(settings) {
1394
+ if (!settings || typeof settings !== "object") return settings;
1395
+ const studio = settings.studio;
1396
+ if (!studio || typeof studio !== "object" || Array.isArray(studio)) return settings;
1397
+ const source = studio;
1398
+ const kept = withoutKeys(source, STUDIO_TRANSIENT_KEYS);
1399
+ const shots = stripPrevizRunState(stripShots(source.shots, STUDIO_SHOT_PRIVATE_KEYS));
1400
+ if (source.shots !== void 0) kept.shots = shots;
1401
+ const planned = stripLinkedOwnerState(kept);
1402
+ if (Object.keys(kept).length === Object.keys(source).length && shots === source.shots && planned === kept) {
1403
+ return settings;
1404
+ }
1405
+ return { ...settings, studio: planned };
1406
+ }
1407
+ function stripStudioTakeVoiceRecords(nodes) {
1408
+ if (!Array.isArray(nodes)) return nodes;
1409
+ let changed = false;
1410
+ const out = nodes.map((node) => {
1411
+ const data = isRecord(node) ? node.data : void 0;
1412
+ if (!isRecord(data)) return node;
1413
+ const results = stripRows(data.generatedResults, STUDIO_TAKE_PRIVATE_KEYS);
1414
+ const unitResults = stripRows(data.sequenceUnitResults, STUDIO_SEQUENCE_UNIT_MANIFEST_KEYS);
1415
+ const running = STUDIO_KEYFRAME_NODE_TRANSIENT_KEYS.some((key) => key in data);
1416
+ if (results === data.generatedResults && unitResults === data.sequenceUnitResults && !running) return node;
1417
+ changed = true;
1418
+ const kept = withoutKeys(data, STUDIO_KEYFRAME_NODE_TRANSIENT_KEYS);
1419
+ if (results !== data.generatedResults) kept.generatedResults = results;
1420
+ if (unitResults !== data.sequenceUnitResults) kept.sequenceUnitResults = unitResults;
1421
+ return { ...node, data: kept };
1422
+ });
1423
+ return changed ? out : nodes;
1424
+ }
1425
+ function stripRows(value, drop) {
1426
+ if (!Array.isArray(value)) return value;
1427
+ let changed = false;
1428
+ const out = value.map((row) => {
1429
+ if (!isRecord(row) || !drop.some((key) => key in row)) return row;
1430
+ changed = true;
1431
+ return withoutKeys(row, drop);
1432
+ });
1433
+ return changed ? out : value;
1434
+ }
1435
+ function stripLinkedOwnerState(studio) {
1436
+ const takes = stripTakeUnitReviews(studio.sequenceTakes);
1437
+ const keyframes = stripKeyframes(studio.keyframes);
1438
+ const preferences = STUDIO_SEQUENCE_POLICY_KEYS.filter((key) => {
1439
+ const value = studio[key];
1440
+ return isRecord(value) && Object.keys(value).length > 0;
1441
+ });
1442
+ if (!STUDIO_SEQUENCE_PLANNING_KEYS.some((key) => key in studio) && takes === studio.sequenceTakes && keyframes === studio.keyframes && preferences.length === 0) return studio;
1443
+ const kept = withoutKeys(studio, STUDIO_SEQUENCE_PLANNING_KEYS);
1444
+ if (takes !== studio.sequenceTakes) kept.sequenceTakes = takes;
1445
+ if (keyframes !== studio.keyframes) kept.keyframes = keyframes;
1446
+ for (const key of preferences) kept[key] = {};
1447
+ return kept;
1448
+ }
1449
+ function stripTakeUnitReviews(value) {
1450
+ if (!Array.isArray(value)) return value;
1451
+ let changed = false;
1452
+ const out = value.map((take) => {
1453
+ if (!isRecord(take) || !Array.isArray(take.units)) return take;
1454
+ let touched = false;
1455
+ const units = take.units.map((unit) => {
1456
+ if (!isRecord(unit) || !STUDIO_SEQUENCE_UNIT_REVIEW_KEYS.some((key) => key in unit)) return unit;
1457
+ touched = true;
1458
+ return withoutKeys(unit, STUDIO_SEQUENCE_UNIT_REVIEW_KEYS);
1459
+ });
1460
+ if (!touched) return take;
1461
+ changed = true;
1462
+ return { ...take, units };
1463
+ });
1464
+ return changed ? out : value;
1465
+ }
1466
+ function stripKeyframes(value) {
1467
+ if (!Array.isArray(value)) return value;
1468
+ let changed = false;
1469
+ const out = value.map((frame) => {
1470
+ if (!isRecord(frame)) return frame;
1471
+ const kept = keyframeForReader(frame, STUDIO_KEYFRAME_REVIEW_KEYS);
1472
+ if (kept !== frame) changed = true;
1473
+ return kept;
1474
+ });
1475
+ return changed ? out : value;
1476
+ }
1477
+ function keyframeForReader(frame, drop) {
1478
+ const acceptance = frame.acceptance;
1479
+ const waived = isRecord(acceptance) && STUDIO_KEYFRAME_ACCEPTANCE_PRIVATE_KEYS.some((key) => key in acceptance);
1480
+ if (!waived && !drop.some((key) => key in frame)) return frame;
1481
+ const kept = withoutKeys(frame, drop);
1482
+ if (waived) kept.acceptance = withoutKeys(acceptance, STUDIO_KEYFRAME_ACCEPTANCE_PRIVATE_KEYS);
1483
+ return kept;
1484
+ }
1485
+ function stripStudioDraftSettings(settings) {
1486
+ if (!settings || typeof settings !== "object") return settings;
1487
+ const studio = settings.studio;
1488
+ if (!isRecord(studio)) return settings;
1489
+ const shots = stripShots(studio.shots, STUDIO_SHOT_PRIVATE_KEYS);
1490
+ const trash = stripBin(studio.trash);
1491
+ const planned = stripLinkedOwnerState(studio);
1492
+ if (shots === studio.shots && trash === studio.trash && planned === studio) return settings;
1493
+ const kept = { ...planned };
1494
+ if (shots !== studio.shots) kept.shots = shots;
1495
+ if (trash !== studio.trash) kept.trash = trash;
1496
+ return { ...settings, studio: kept };
1497
+ }
1498
+ function stripBin(trash) {
1499
+ if (!Array.isArray(trash)) return trash;
1500
+ let changed = false;
1501
+ const out = [];
1502
+ for (const entry of trash) {
1503
+ if (isRecord(entry) && entry.kind === "slot") {
1504
+ changed = true;
1505
+ continue;
1506
+ }
1507
+ const kept = !isRecord(entry) ? entry : entry.kind === "shot" ? binSceneForReader(entry) : entry.kind === "keyframe" ? binKeyframeForReader(entry) : binTakeForReader(entry);
1508
+ if (kept !== entry) changed = true;
1509
+ out.push(kept);
1510
+ }
1511
+ return changed ? out : trash;
1512
+ }
1513
+ function binSceneForReader(entry) {
1514
+ const graph = entry.graph;
1515
+ if (!isRecord(graph)) return entry;
1516
+ const nodes = stripStudioTakeVoiceRecords(graph.nodes);
1517
+ const settings = stripStudioDraftSettings(graph.settings);
1518
+ if (nodes === graph.nodes && settings === graph.settings) return entry;
1519
+ return { ...entry, graph: { ...graph, nodes, settings } };
1520
+ }
1521
+ function binTakeForReader(entry) {
1522
+ const result = entry.result;
1523
+ if (!isRecord(result) || !STUDIO_TAKE_PRIVATE_KEYS.some((key) => key in result)) return entry;
1524
+ return { ...entry, result: withoutKeys(result, STUDIO_TAKE_PRIVATE_KEYS) };
1525
+ }
1526
+ function binKeyframeForReader(entry) {
1527
+ const keyframe = entry.keyframe;
1528
+ if (!isRecord(keyframe)) return entry;
1529
+ const kept = keyframeForReader(keyframe, STUDIO_KEYFRAME_PRIVATE_KEYS);
1530
+ return kept === keyframe ? entry : { ...entry, keyframe: kept };
1531
+ }
1532
+ function stripStudioDraftWorkflow(row) {
1533
+ const nodes = "nodes" in row ? stripStudioTakeVoiceRecords(row.nodes) : row.nodes;
1534
+ const settings = "settings" in row ? stripStudioDraftSettings(row.settings) : row.settings;
1535
+ if (nodes === row.nodes && settings === row.settings) return row;
1536
+ return {
1537
+ ...row,
1538
+ ...nodes !== row.nodes ? { nodes } : {},
1539
+ ...settings !== row.settings ? { settings } : {}
1540
+ };
1541
+ }
1542
+
1543
+ // src/sequence-execution.ts
1544
+ var STUDIO_DEPENDENT_FRAMES_CAPABILITY = "studio-dependent-frames-v1";
1545
+ var SequenceExecutionRequiredError = class extends Error {
1546
+ constructor(nodeIds) {
1547
+ super("Generate linked frames and clips in Studio or through its production API so the reviewed images are used.");
1548
+ this.nodeIds = nodeIds;
1549
+ this.name = "SequenceExecutionRequiredError";
1550
+ }
1551
+ nodeIds;
1552
+ code = "sequence_execution_required";
1553
+ statusCode = 400;
1554
+ };
1555
+ function requiresSequenceExecution(node) {
1556
+ if (!node.data || typeof node.data !== "object" || Array.isArray(node.data)) return false;
1557
+ const data = node.data;
1558
+ return data.keyframeId !== void 0 || data.sequenceBinding !== void 0 || Array.isArray(data.requiredCapabilities) && data.requiredCapabilities.includes(STUDIO_DEPENDENT_FRAMES_CAPABILITY);
1559
+ }
1560
+ function assertCanvasExecutionAllowed(nodes) {
1561
+ const blocked = nodes.filter(requiresSequenceExecution).map((node) => node.id);
1562
+ if (blocked.length) throw new SequenceExecutionRequiredError(blocked);
1563
+ }
1564
+
1565
+ export { ACTIVE_SCENE_HELPERS, ANIMATE_SUB_GATES, AddBRollResultSchema, AnchorSceneStyleResultSchema, AnimateSubGateSchema, AssetRefSchema, AuditImagesResultSchema, AuditImagesShotEntrySchema, AuditPromptIssueSchema, AuditPromptResultSchema, BridgeToNextSceneInputSchema, BridgeToNextSceneResultSchema, CHAT_ENABLED_STAGES, CHAT_STAGES, CHAT_TURN_CAPS, CHAT_WIRED_STAGES, CastCoverageCriticVerdictSchema, CharacterImageCriticVerdictSchema, CharacterMetadataSchema, ChatTurnResponseSchema, CriticIssueSchema, DEFAULT_CHARACTER_ANGLE_COUNT, DEFAULT_CHARACTER_EXPRESSION_COUNT, DetectionResultSchema, EMOTIONAL_BEAT, ENTITY_STATUSES, ENTITY_TOOL_RETRY_CAP, ENTITY_TYPES, EntityMetadataSchema, EntityRejectInputSchema, EntityStaleEventSchema, EntityStateChangeEventSchema, FixContinuityInputSchema, FixContinuityResultSchema, GLOBAL_MAX_DURATION_SECONDS, GenerateMotionInputSchema, GenerateMotionResultSchema, HELPERS_SHIPPED_IN_1B3, IMAGE_CRITIC_LEAF_MODES, IMAGE_CRITIC_MAX_RETRIES, IMAGE_CRITIC_METADATA_KEYS, IMAGE_CRITIC_MIN_ADHERENCE_SCORE, IMAGE_CRITIC_MODES, IMAGE_CRITIC_UNRESOLVABLE, ImageCriticIssueSchema, ImageCriticResultSchema, ImageCriticVerdictSchema, ImprovePromptInputSchema, ImprovePromptResultSchema, LocationImageCriticVerdictSchema, LocationMetadataSchema, LocationsCoverageCriticIssueSchema, LocationsCoverageCriticVerdictSchema, MATCH_CUT_BREAK_GATE, MAX_LOCATION_VARIANTS, MatchCutVerdictSchema, ObjectMetadataSchema, OptimizeForModelInputSchema, OptimizeForModelResultSchema, PER_FORMAT_DURATION_BOUNDS, PIPELINE_ACCEPTED_IMAGE_MODELS, PIPELINE_ACCEPTED_SCRIPT_LLMS, PIPELINE_ACTIVATION_MODES, PIPELINE_FORMATS, PIPELINE_HARD_TIMEOUT_MS, PIPELINE_LEGACY_PINNED_IMAGE_MODELS, PIPELINE_LEGACY_PINNED_SCRIPT_LLMS, PIPELINE_MODEL_STAGES, PIPELINE_MODES, PIPELINE_OUTPUT_RESOLUTIONS, PIPELINE_PINNABLE_IMAGE_MODELS, PIPELINE_PINNABLE_SCRIPT_LLMS, PIPELINE_PINNABLE_VIDEO_MODELS, PIPELINE_STAGE_NAMES, PIPELINE_STAGE_TIMEOUT_MS, PIPELINE_TYPES, PipelineCompletedEventSchema, PipelineConfigSchema, PipelineDriftSummarySchema, PipelineEditorDecisionsReadyEventSchema, PipelineForkedEventSchema, PipelineInputSchema, PipelineMusicReadyEventSchema, PipelineStageNameSchema, PipelineStageStatusSchema, PipelineStateSchema, PipelineStatusSchema, SCENE_HELPER_NAMES, SHORT_FILM_ANGLE_COUNT, SHORT_FILM_EXPRESSION_COUNT, SHORT_FILM_VARIANT_THRESHOLD_SEC, STAGE_PATCH_SCHEMA, STUDIO_DEPENDENT_FRAMES_CAPABILITY, STUDIO_KEYFRAME_ACCEPTANCE_PRIVATE_KEYS, STUDIO_KEYFRAME_NODE_TRANSIENT_KEYS, STUDIO_KEYFRAME_REVIEW_KEYS, STUDIO_KEYFRAME_TRANSIENT_KEYS, STUDIO_PREVIZ_RUN_STATE_KEYS, STUDIO_SEQUENCE_PLANNING_KEYS, STUDIO_SEQUENCE_POLICY_KEYS, STUDIO_SEQUENCE_UNIT_MANIFEST_KEYS, STUDIO_SEQUENCE_UNIT_REVIEW_KEYS, STUDIO_SHOT_DRAFT_KEYS, STUDIO_SHOT_TRANSIENT_KEYS, STUDIO_TAKE_SEQUENCE_KEYS, STUDIO_TAKE_VOICE_KEYS, STUDIO_TRANSIENT_KEYS, SceneHelperNameSchema, SceneMetadataSchema, SceneNodeDataSchema, SceneSpecSchema, ScriptCriticVerdictSchema, SequenceExecutionRequiredError, ShotSpecSchema, ShowrunnerPlanSchema, StageAwaitingSubGateEventSchema, StoryboardCohesionCriticVerdictSchema, StyleDirectivesSchema, SubGateNameSchema, TIER_MAX_PIPELINE_COST_CREDITS, TIER_PIPELINE_PARALLELISM, TransitionTypeSchema, VIDEO_CRITIC_FRAME_MODES, VIDEO_CRITIC_MAX_RETRIES, VIDEO_CRITIC_METADATA_KEYS, VIDEO_CRITIC_MIN_ADHERENCE_SCORE, VIDEO_CRITIC_RESERVED_CREDITS_PER_SHOT, ValidateMatchCutInputSchema, ValidateMatchCutResultSchema, VideoCriticVerdictSchema, VoiceMatchSchema, assertCanvasExecutionAllowed, clearImageCriticMetadata, clearVideoCriticMetadata, parseAttributedDialogue, requiresSequenceExecution, resolveDialogueVoices, resolvePipelineModel, sceneRenderStateRegistry, stripStudioDraftSettings, stripStudioDraftWorkflow, stripStudioTakeVoiceRecords, stripStudioTransientSettings, validateDurationForFormat, validateModeActivation, validateObjects };
1566
+ //# sourceMappingURL=chunk-6DKDOWBL.js.map
1567
+ //# sourceMappingURL=chunk-6DKDOWBL.js.map