@nodetool-ai/protocol 0.7.0-rc.23 → 0.8.2

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 (624) hide show
  1. package/README.md +56 -0
  2. package/dist/.nodetool-build-stamp +1 -0
  3. package/dist/ai-video-production.d.ts +276 -0
  4. package/dist/ai-video-production.d.ts.map +1 -0
  5. package/dist/ai-video-production.js +131 -0
  6. package/dist/ai-video-production.js.map +1 -0
  7. package/dist/api-schemas/agent-access.d.ts +134 -0
  8. package/dist/api-schemas/agent-access.d.ts.map +1 -0
  9. package/dist/api-schemas/agent-access.js +93 -0
  10. package/dist/api-schemas/agent-access.js.map +1 -0
  11. package/dist/api-schemas/api-error-code.d.ts +11 -1
  12. package/dist/api-schemas/api-error-code.d.ts.map +1 -1
  13. package/dist/api-schemas/api-error-code.js +10 -0
  14. package/dist/api-schemas/api-error-code.js.map +1 -1
  15. package/dist/api-schemas/app-runs.d.ts +1410 -0
  16. package/dist/api-schemas/app-runs.d.ts.map +1 -0
  17. package/dist/api-schemas/app-runs.js +105 -0
  18. package/dist/api-schemas/app-runs.js.map +1 -0
  19. package/dist/api-schemas/applications.d.ts +3216 -0
  20. package/dist/api-schemas/applications.d.ts.map +1 -0
  21. package/dist/api-schemas/applications.js +487 -0
  22. package/dist/api-schemas/applications.js.map +1 -0
  23. package/dist/api-schemas/assets.d.ts +239 -0
  24. package/dist/api-schemas/assets.d.ts.map +1 -1
  25. package/dist/api-schemas/assets.js +136 -5
  26. package/dist/api-schemas/assets.js.map +1 -1
  27. package/dist/api-schemas/bug-reports.d.ts +38 -0
  28. package/dist/api-schemas/bug-reports.d.ts.map +1 -0
  29. package/dist/api-schemas/bug-reports.js +34 -0
  30. package/dist/api-schemas/bug-reports.js.map +1 -0
  31. package/dist/api-schemas/code-gen.d.ts +176 -0
  32. package/dist/api-schemas/code-gen.d.ts.map +1 -0
  33. package/dist/api-schemas/code-gen.js +205 -0
  34. package/dist/api-schemas/code-gen.js.map +1 -0
  35. package/dist/api-schemas/collections.d.ts.map +1 -1
  36. package/dist/api-schemas/collections.js +3 -4
  37. package/dist/api-schemas/collections.js.map +1 -1
  38. package/dist/api-schemas/costs.d.ts +179 -0
  39. package/dist/api-schemas/costs.d.ts.map +1 -1
  40. package/dist/api-schemas/costs.js +100 -4
  41. package/dist/api-schemas/costs.js.map +1 -1
  42. package/dist/api-schemas/credits.d.ts +42 -0
  43. package/dist/api-schemas/credits.d.ts.map +1 -0
  44. package/dist/api-schemas/credits.js +43 -0
  45. package/dist/api-schemas/credits.js.map +1 -0
  46. package/dist/api-schemas/documents.d.ts +163 -0
  47. package/dist/api-schemas/documents.d.ts.map +1 -0
  48. package/dist/api-schemas/documents.js +75 -0
  49. package/dist/api-schemas/documents.js.map +1 -0
  50. package/dist/api-schemas/error-traces.d.ts +249 -0
  51. package/dist/api-schemas/error-traces.d.ts.map +1 -0
  52. package/dist/api-schemas/error-traces.js +112 -0
  53. package/dist/api-schemas/error-traces.js.map +1 -0
  54. package/dist/api-schemas/files.d.ts +13 -0
  55. package/dist/api-schemas/files.d.ts.map +1 -1
  56. package/dist/api-schemas/files.js +8 -0
  57. package/dist/api-schemas/files.js.map +1 -1
  58. package/dist/api-schemas/fonts.d.ts +17 -1
  59. package/dist/api-schemas/fonts.d.ts.map +1 -1
  60. package/dist/api-schemas/fonts.js +19 -3
  61. package/dist/api-schemas/fonts.js.map +1 -1
  62. package/dist/api-schemas/index.d.ts +27 -1
  63. package/dist/api-schemas/index.d.ts.map +1 -1
  64. package/dist/api-schemas/index.js +27 -1
  65. package/dist/api-schemas/index.js.map +1 -1
  66. package/dist/api-schemas/jobs.d.ts +44 -0
  67. package/dist/api-schemas/jobs.d.ts.map +1 -1
  68. package/dist/api-schemas/jobs.js +26 -2
  69. package/dist/api-schemas/jobs.js.map +1 -1
  70. package/dist/api-schemas/js-scripts.d.ts +367 -0
  71. package/dist/api-schemas/js-scripts.d.ts.map +1 -0
  72. package/dist/api-schemas/js-scripts.js +341 -0
  73. package/dist/api-schemas/js-scripts.js.map +1 -0
  74. package/dist/api-schemas/mcp-config.d.ts +4 -1
  75. package/dist/api-schemas/mcp-config.d.ts.map +1 -1
  76. package/dist/api-schemas/mcp-config.js +10 -3
  77. package/dist/api-schemas/mcp-config.js.map +1 -1
  78. package/dist/api-schemas/memories.d.ts +84 -0
  79. package/dist/api-schemas/memories.d.ts.map +1 -0
  80. package/dist/api-schemas/memories.js +54 -0
  81. package/dist/api-schemas/memories.js.map +1 -0
  82. package/dist/api-schemas/messages.d.ts +1 -0
  83. package/dist/api-schemas/messages.d.ts.map +1 -1
  84. package/dist/api-schemas/messages.js +4 -4
  85. package/dist/api-schemas/messages.js.map +1 -1
  86. package/dist/api-schemas/models.d.ts +164 -0
  87. package/dist/api-schemas/models.d.ts.map +1 -1
  88. package/dist/api-schemas/models.js +53 -6
  89. package/dist/api-schemas/models.js.map +1 -1
  90. package/dist/api-schemas/nodes.d.ts +97 -0
  91. package/dist/api-schemas/nodes.d.ts.map +1 -1
  92. package/dist/api-schemas/nodes.js +89 -0
  93. package/dist/api-schemas/nodes.js.map +1 -1
  94. package/dist/api-schemas/projects.d.ts +427 -0
  95. package/dist/api-schemas/projects.d.ts.map +1 -0
  96. package/dist/api-schemas/projects.js +224 -0
  97. package/dist/api-schemas/projects.js.map +1 -0
  98. package/dist/api-schemas/recipes.d.ts +172 -0
  99. package/dist/api-schemas/recipes.d.ts.map +1 -0
  100. package/dist/api-schemas/recipes.js +144 -0
  101. package/dist/api-schemas/recipes.js.map +1 -0
  102. package/dist/api-schemas/resources.d.ts +112 -0
  103. package/dist/api-schemas/resources.d.ts.map +1 -0
  104. package/dist/api-schemas/resources.js +44 -0
  105. package/dist/api-schemas/resources.js.map +1 -0
  106. package/dist/api-schemas/runs.d.ts +6 -0
  107. package/dist/api-schemas/runs.d.ts.map +1 -0
  108. package/dist/api-schemas/runs.js +4 -0
  109. package/dist/api-schemas/runs.js.map +1 -0
  110. package/dist/api-schemas/scripts.d.ts +1571 -0
  111. package/dist/api-schemas/scripts.d.ts.map +1 -0
  112. package/dist/api-schemas/scripts.js +153 -0
  113. package/dist/api-schemas/scripts.js.map +1 -0
  114. package/dist/api-schemas/sdk-execution-v1.d.ts +468 -0
  115. package/dist/api-schemas/sdk-execution-v1.d.ts.map +1 -0
  116. package/dist/api-schemas/sdk-execution-v1.js +115 -0
  117. package/dist/api-schemas/sdk-execution-v1.js.map +1 -0
  118. package/dist/api-schemas/sdk-lifecycle-v1.d.ts +217 -0
  119. package/dist/api-schemas/sdk-lifecycle-v1.d.ts.map +1 -0
  120. package/dist/api-schemas/sdk-lifecycle-v1.js +117 -0
  121. package/dist/api-schemas/sdk-lifecycle-v1.js.map +1 -0
  122. package/dist/api-schemas/sdk-models-v1.d.ts +181 -0
  123. package/dist/api-schemas/sdk-models-v1.d.ts.map +1 -0
  124. package/dist/api-schemas/sdk-models-v1.js +108 -0
  125. package/dist/api-schemas/sdk-models-v1.js.map +1 -0
  126. package/dist/api-schemas/sdk-v1-http-operations.d.ts +941 -0
  127. package/dist/api-schemas/sdk-v1-http-operations.d.ts.map +1 -0
  128. package/dist/api-schemas/sdk-v1-http-operations.js +465 -0
  129. package/dist/api-schemas/sdk-v1-http-operations.js.map +1 -0
  130. package/dist/api-schemas/sdk-v1-operations.d.ts +151 -0
  131. package/dist/api-schemas/sdk-v1-operations.d.ts.map +1 -0
  132. package/dist/api-schemas/sdk-v1-operations.js +97 -0
  133. package/dist/api-schemas/sdk-v1-operations.js.map +1 -0
  134. package/dist/api-schemas/sdk-v1-websocket-operations.d.ts +97 -0
  135. package/dist/api-schemas/sdk-v1-websocket-operations.d.ts.map +1 -0
  136. package/dist/api-schemas/sdk-v1-websocket-operations.js +96 -0
  137. package/dist/api-schemas/sdk-v1-websocket-operations.js.map +1 -0
  138. package/dist/api-schemas/sdk-v1.d.ts +15 -0
  139. package/dist/api-schemas/sdk-v1.d.ts.map +1 -0
  140. package/dist/api-schemas/sdk-v1.js +22 -0
  141. package/dist/api-schemas/sdk-v1.js.map +1 -0
  142. package/dist/api-schemas/segmentation.d.ts +75 -0
  143. package/dist/api-schemas/segmentation.d.ts.map +1 -0
  144. package/dist/api-schemas/segmentation.js +54 -0
  145. package/dist/api-schemas/segmentation.js.map +1 -0
  146. package/dist/api-schemas/settings.d.ts +162 -0
  147. package/dist/api-schemas/settings.d.ts.map +1 -1
  148. package/dist/api-schemas/settings.js +71 -0
  149. package/dist/api-schemas/settings.js.map +1 -1
  150. package/dist/api-schemas/sketch.d.ts +858 -0
  151. package/dist/api-schemas/sketch.d.ts.map +1 -0
  152. package/dist/api-schemas/sketch.js +546 -0
  153. package/dist/api-schemas/sketch.js.map +1 -0
  154. package/dist/api-schemas/skills.d.ts +27 -14
  155. package/dist/api-schemas/skills.d.ts.map +1 -1
  156. package/dist/api-schemas/skills.js +64 -11
  157. package/dist/api-schemas/skills.js.map +1 -1
  158. package/dist/api-schemas/storage.d.ts +8 -0
  159. package/dist/api-schemas/storage.d.ts.map +1 -1
  160. package/dist/api-schemas/storage.js +7 -0
  161. package/dist/api-schemas/storage.js.map +1 -1
  162. package/dist/api-schemas/storyboards.d.ts +8595 -0
  163. package/dist/api-schemas/storyboards.d.ts.map +1 -0
  164. package/dist/api-schemas/storyboards.js +524 -0
  165. package/dist/api-schemas/storyboards.js.map +1 -0
  166. package/dist/api-schemas/threads.d.ts +12 -4
  167. package/dist/api-schemas/threads.d.ts.map +1 -1
  168. package/dist/api-schemas/threads.js +12 -4
  169. package/dist/api-schemas/threads.js.map +1 -1
  170. package/dist/api-schemas/timeline-tool-contracts.d.ts +1687 -0
  171. package/dist/api-schemas/timeline-tool-contracts.d.ts.map +1 -0
  172. package/dist/api-schemas/timeline-tool-contracts.js +725 -0
  173. package/dist/api-schemas/timeline-tool-contracts.js.map +1 -0
  174. package/dist/api-schemas/timeline-tool-params.d.ts +1270 -0
  175. package/dist/api-schemas/timeline-tool-params.d.ts.map +1 -0
  176. package/dist/api-schemas/timeline-tool-params.js +1529 -0
  177. package/dist/api-schemas/timeline-tool-params.js.map +1 -0
  178. package/dist/api-schemas/timeline.d.ts +13740 -0
  179. package/dist/api-schemas/timeline.d.ts.map +1 -0
  180. package/dist/api-schemas/timeline.js +1928 -0
  181. package/dist/api-schemas/timeline.js.map +1 -0
  182. package/dist/api-schemas/ui-tool-contract.d.ts +35 -0
  183. package/dist/api-schemas/ui-tool-contract.d.ts.map +1 -0
  184. package/dist/api-schemas/ui-tool-contract.js +31 -0
  185. package/dist/api-schemas/ui-tool-contract.js.map +1 -0
  186. package/dist/api-schemas/workflows.d.ts +904 -18
  187. package/dist/api-schemas/workflows.d.ts.map +1 -1
  188. package/dist/api-schemas/workflows.js +507 -6
  189. package/dist/api-schemas/workflows.js.map +1 -1
  190. package/dist/api-schemas/workspace.d.ts +45 -0
  191. package/dist/api-schemas/workspace.d.ts.map +1 -1
  192. package/dist/api-schemas/workspace.js +47 -1
  193. package/dist/api-schemas/workspace.js.map +1 -1
  194. package/dist/api-types.d.ts +651 -27
  195. package/dist/api-types.d.ts.map +1 -1
  196. package/dist/api-types.js +252 -1
  197. package/dist/api-types.js.map +1 -1
  198. package/dist/app-deployment.d.ts +37 -0
  199. package/dist/app-deployment.d.ts.map +1 -0
  200. package/dist/app-deployment.js +42 -0
  201. package/dist/app-deployment.js.map +1 -0
  202. package/dist/asset-file-name.d.ts +15 -0
  203. package/dist/asset-file-name.d.ts.map +1 -0
  204. package/dist/asset-file-name.js +61 -0
  205. package/dist/asset-file-name.js.map +1 -0
  206. package/dist/asset-generation.d.ts +58 -0
  207. package/dist/asset-generation.d.ts.map +1 -0
  208. package/dist/asset-generation.js +147 -0
  209. package/dist/asset-generation.js.map +1 -0
  210. package/dist/blend-modes.d.ts +20 -0
  211. package/dist/blend-modes.d.ts.map +1 -0
  212. package/dist/blend-modes.js +33 -0
  213. package/dist/blend-modes.js.map +1 -0
  214. package/dist/bridge-frames.d.ts +654 -0
  215. package/dist/bridge-frames.d.ts.map +1 -0
  216. package/dist/bridge-frames.js +448 -0
  217. package/dist/bridge-frames.js.map +1 -0
  218. package/dist/bridge-frames.schema.json +862 -0
  219. package/dist/bridge-protocol.d.ts +57 -20
  220. package/dist/bridge-protocol.d.ts.map +1 -1
  221. package/dist/bridge-protocol.js +57 -20
  222. package/dist/bridge-protocol.js.map +1 -1
  223. package/dist/browser-run-traces.d.ts +102 -0
  224. package/dist/browser-run-traces.d.ts.map +1 -0
  225. package/dist/browser-run-traces.js +30 -0
  226. package/dist/browser-run-traces.js.map +1 -0
  227. package/dist/builtin-packs.d.ts +45 -0
  228. package/dist/builtin-packs.d.ts.map +1 -0
  229. package/dist/builtin-packs.js +121 -0
  230. package/dist/builtin-packs.js.map +1 -0
  231. package/dist/caption-word.d.ts +15 -0
  232. package/dist/caption-word.d.ts.map +1 -0
  233. package/dist/caption-word.js +10 -0
  234. package/dist/caption-word.js.map +1 -0
  235. package/dist/cloud-profile.d.ts +187 -0
  236. package/dist/cloud-profile.d.ts.map +1 -0
  237. package/dist/cloud-profile.js +286 -0
  238. package/dist/cloud-profile.js.map +1 -0
  239. package/dist/creative.d.ts +580 -0
  240. package/dist/creative.d.ts.map +1 -0
  241. package/dist/creative.js +274 -0
  242. package/dist/creative.js.map +1 -0
  243. package/dist/custom-providers.d.ts +70 -0
  244. package/dist/custom-providers.d.ts.map +1 -0
  245. package/dist/custom-providers.js +125 -0
  246. package/dist/custom-providers.js.map +1 -0
  247. package/dist/document-ops.d.ts +15 -0
  248. package/dist/document-ops.d.ts.map +1 -0
  249. package/dist/document-ops.js +2 -0
  250. package/dist/document-ops.js.map +1 -0
  251. package/dist/game-assets.d.ts +344 -0
  252. package/dist/game-assets.d.ts.map +1 -0
  253. package/dist/game-assets.js +297 -0
  254. package/dist/game-assets.js.map +1 -0
  255. package/dist/game-authoring.d.ts +113 -0
  256. package/dist/game-authoring.d.ts.map +1 -0
  257. package/dist/game-authoring.js +37 -0
  258. package/dist/game-authoring.js.map +1 -0
  259. package/dist/game-design.d.ts +90 -0
  260. package/dist/game-design.d.ts.map +1 -0
  261. package/dist/game-design.js +417 -0
  262. package/dist/game-design.js.map +1 -0
  263. package/dist/game-flow-prompt.d.ts +68 -0
  264. package/dist/game-flow-prompt.d.ts.map +1 -0
  265. package/dist/game-flow-prompt.js +121 -0
  266. package/dist/game-flow-prompt.js.map +1 -0
  267. package/dist/game-graph.d.ts +96 -0
  268. package/dist/game-graph.d.ts.map +1 -0
  269. package/dist/game-graph.js +481 -0
  270. package/dist/game-graph.js.map +1 -0
  271. package/dist/game-migration.d.ts +4 -0
  272. package/dist/game-migration.d.ts.map +1 -0
  273. package/dist/game-migration.js +6 -0
  274. package/dist/game-migration.js.map +1 -0
  275. package/dist/game-slot-prompt.d.ts +90 -0
  276. package/dist/game-slot-prompt.d.ts.map +1 -0
  277. package/dist/game-slot-prompt.js +237 -0
  278. package/dist/game-slot-prompt.js.map +1 -0
  279. package/dist/game-step.d.ts +10 -0
  280. package/dist/game-step.d.ts.map +1 -0
  281. package/dist/game-step.js +2 -0
  282. package/dist/game-step.js.map +1 -0
  283. package/dist/game.d.ts +2 -0
  284. package/dist/game.d.ts.map +1 -0
  285. package/dist/game.js +2 -0
  286. package/dist/game.js.map +1 -0
  287. package/dist/game2d/components/animator.d.ts +22 -0
  288. package/dist/game2d/components/animator.d.ts.map +1 -0
  289. package/dist/game2d/components/animator.js +6 -0
  290. package/dist/game2d/components/animator.js.map +1 -0
  291. package/dist/game2d/components/assets.d.ts +132 -0
  292. package/dist/game2d/components/assets.d.ts.map +1 -0
  293. package/dist/game2d/components/assets.js +52 -0
  294. package/dist/game2d/components/assets.js.map +1 -0
  295. package/dist/game2d/components/audioSource.d.ts +7 -0
  296. package/dist/game2d/components/audioSource.d.ts.map +1 -0
  297. package/dist/game2d/components/audioSource.js +4 -0
  298. package/dist/game2d/components/audioSource.js.map +1 -0
  299. package/dist/game2d/components/background.d.ts +38 -0
  300. package/dist/game2d/components/background.d.ts.map +1 -0
  301. package/dist/game2d/components/background.js +10 -0
  302. package/dist/game2d/components/background.js.map +1 -0
  303. package/dist/game2d/components/behaviors.d.ts +50 -0
  304. package/dist/game2d/components/behaviors.d.ts.map +1 -0
  305. package/dist/game2d/components/behaviors.js +15 -0
  306. package/dist/game2d/components/behaviors.js.map +1 -0
  307. package/dist/game2d/components/body2d.d.ts +13 -0
  308. package/dist/game2d/components/body2d.d.ts.map +1 -0
  309. package/dist/game2d/components/body2d.js +4 -0
  310. package/dist/game2d/components/body2d.js.map +1 -0
  311. package/dist/game2d/components/camera2d.d.ts +7 -0
  312. package/dist/game2d/components/camera2d.d.ts.map +1 -0
  313. package/dist/game2d/components/camera2d.js +4 -0
  314. package/dist/game2d/components/camera2d.js.map +1 -0
  315. package/dist/game2d/components/collider2d.d.ts +10 -0
  316. package/dist/game2d/components/collider2d.d.ts.map +1 -0
  317. package/dist/game2d/components/collider2d.js +5 -0
  318. package/dist/game2d/components/collider2d.js.map +1 -0
  319. package/dist/game2d/components/common.d.ts +16 -0
  320. package/dist/game2d/components/common.d.ts.map +1 -0
  321. package/dist/game2d/components/common.js +13 -0
  322. package/dist/game2d/components/common.js.map +1 -0
  323. package/dist/game2d/components/entity-components.d.ts +181 -0
  324. package/dist/game2d/components/entity-components.d.ts.map +1 -0
  325. package/dist/game2d/components/entity-components.js +21 -0
  326. package/dist/game2d/components/entity-components.js.map +1 -0
  327. package/dist/game2d/components/light2d.d.ts +12 -0
  328. package/dist/game2d/components/light2d.d.ts.map +1 -0
  329. package/dist/game2d/components/light2d.js +5 -0
  330. package/dist/game2d/components/light2d.js.map +1 -0
  331. package/dist/game2d/components/lighting.d.ts +17 -0
  332. package/dist/game2d/components/lighting.d.ts.map +1 -0
  333. package/dist/game2d/components/lighting.js +6 -0
  334. package/dist/game2d/components/lighting.js.map +1 -0
  335. package/dist/game2d/components/music.d.ts +8 -0
  336. package/dist/game2d/components/music.d.ts.map +1 -0
  337. package/dist/game2d/components/music.js +4 -0
  338. package/dist/game2d/components/music.js.map +1 -0
  339. package/dist/game2d/components/sprite.d.ts +26 -0
  340. package/dist/game2d/components/sprite.d.ts.map +1 -0
  341. package/dist/game2d/components/sprite.js +6 -0
  342. package/dist/game2d/components/sprite.js.map +1 -0
  343. package/dist/game2d/components/tilemap.d.ts +23 -0
  344. package/dist/game2d/components/tilemap.d.ts.map +1 -0
  345. package/dist/game2d/components/tilemap.js +6 -0
  346. package/dist/game2d/components/tilemap.js.map +1 -0
  347. package/dist/game2d/components/transform.d.ts +10 -0
  348. package/dist/game2d/components/transform.d.ts.map +1 -0
  349. package/dist/game2d/components/transform.js +10 -0
  350. package/dist/game2d/components/transform.js.map +1 -0
  351. package/dist/game2d/components/visual-animation.d.ts +148 -0
  352. package/dist/game2d/components/visual-animation.d.ts.map +1 -0
  353. package/dist/game2d/components/visual-animation.js +10 -0
  354. package/dist/game2d/components/visual-animation.js.map +1 -0
  355. package/dist/game2d/index.d.ts +1426 -0
  356. package/dist/game2d/index.d.ts.map +1 -0
  357. package/dist/game2d/index.js +135 -0
  358. package/dist/game2d/index.js.map +1 -0
  359. package/dist/game3d/components/animator.d.ts +9 -0
  360. package/dist/game3d/components/animator.d.ts.map +1 -0
  361. package/dist/game3d/components/animator.js +7 -0
  362. package/dist/game3d/components/animator.js.map +1 -0
  363. package/dist/game3d/components/assets.d.ts +261 -0
  364. package/dist/game3d/components/assets.d.ts.map +1 -0
  365. package/dist/game3d/components/assets.js +21 -0
  366. package/dist/game3d/components/assets.js.map +1 -0
  367. package/dist/game3d/components/behaviors.d.ts +66 -0
  368. package/dist/game3d/components/behaviors.d.ts.map +1 -0
  369. package/dist/game3d/components/behaviors.js +9 -0
  370. package/dist/game3d/components/behaviors.js.map +1 -0
  371. package/dist/game3d/components/body.d.ts +53 -0
  372. package/dist/game3d/components/body.d.ts.map +1 -0
  373. package/dist/game3d/components/body.js +15 -0
  374. package/dist/game3d/components/body.js.map +1 -0
  375. package/dist/game3d/components/camera.d.ts +49 -0
  376. package/dist/game3d/components/camera.d.ts.map +1 -0
  377. package/dist/game3d/components/camera.js +20 -0
  378. package/dist/game3d/components/camera.js.map +1 -0
  379. package/dist/game3d/components/character.d.ts +16 -0
  380. package/dist/game3d/components/character.d.ts.map +1 -0
  381. package/dist/game3d/components/character.js +10 -0
  382. package/dist/game3d/components/character.js.map +1 -0
  383. package/dist/game3d/components/collider-geometry.d.ts +7 -0
  384. package/dist/game3d/components/collider-geometry.d.ts.map +1 -0
  385. package/dist/game3d/components/collider-geometry.js +13 -0
  386. package/dist/game3d/components/collider-geometry.js.map +1 -0
  387. package/dist/game3d/components/collider.d.ts +79 -0
  388. package/dist/game3d/components/collider.d.ts.map +1 -0
  389. package/dist/game3d/components/collider.js +16 -0
  390. package/dist/game3d/components/collider.js.map +1 -0
  391. package/dist/game3d/components/common.d.ts +8 -0
  392. package/dist/game3d/components/common.d.ts.map +1 -0
  393. package/dist/game3d/components/common.js +8 -0
  394. package/dist/game3d/components/common.js.map +1 -0
  395. package/dist/game3d/components/environment.d.ts +20 -0
  396. package/dist/game3d/components/environment.d.ts.map +1 -0
  397. package/dist/game3d/components/environment.js +8 -0
  398. package/dist/game3d/components/environment.js.map +1 -0
  399. package/dist/game3d/components/interaction-actor.d.ts +6 -0
  400. package/dist/game3d/components/interaction-actor.d.ts.map +1 -0
  401. package/dist/game3d/components/interaction-actor.js +3 -0
  402. package/dist/game3d/components/interaction-actor.js.map +1 -0
  403. package/dist/game3d/components/light.d.ts +23 -0
  404. package/dist/game3d/components/light.d.ts.map +1 -0
  405. package/dist/game3d/components/light.js +9 -0
  406. package/dist/game3d/components/light.js.map +1 -0
  407. package/dist/game3d/components/material.d.ts +15 -0
  408. package/dist/game3d/components/material.d.ts.map +1 -0
  409. package/dist/game3d/components/material.js +9 -0
  410. package/dist/game3d/components/material.js.map +1 -0
  411. package/dist/game3d/components/model.d.ts +22 -0
  412. package/dist/game3d/components/model.d.ts.map +1 -0
  413. package/dist/game3d/components/model.js +8 -0
  414. package/dist/game3d/components/model.js.map +1 -0
  415. package/dist/game3d/components/primitive.d.ts +31 -0
  416. package/dist/game3d/components/primitive.d.ts.map +1 -0
  417. package/dist/game3d/components/primitive.js +10 -0
  418. package/dist/game3d/components/primitive.js.map +1 -0
  419. package/dist/game3d/components/transform.d.ts +24 -0
  420. package/dist/game3d/components/transform.d.ts.map +1 -0
  421. package/dist/game3d/components/transform.js +10 -0
  422. package/dist/game3d/components/transform.js.map +1 -0
  423. package/dist/game3d/index.d.ts +4045 -0
  424. package/dist/game3d/index.d.ts.map +1 -0
  425. package/dist/game3d/index.js +159 -0
  426. package/dist/game3d/index.js.map +1 -0
  427. package/dist/game3d.d.ts +2 -0
  428. package/dist/game3d.d.ts.map +1 -0
  429. package/dist/game3d.js +2 -0
  430. package/dist/game3d.js.map +1 -0
  431. package/dist/graph.d.ts +192 -5
  432. package/dist/graph.d.ts.map +1 -1
  433. package/dist/graph.js +515 -0
  434. package/dist/graph.js.map +1 -1
  435. package/dist/index.d.ts +59 -2
  436. package/dist/index.d.ts.map +1 -1
  437. package/dist/index.js +57 -2
  438. package/dist/index.js.map +1 -1
  439. package/dist/loop.d.ts +38 -0
  440. package/dist/loop.d.ts.map +1 -0
  441. package/dist/loop.js +69 -0
  442. package/dist/loop.js.map +1 -0
  443. package/dist/mcp-server-config.d.ts +113 -0
  444. package/dist/mcp-server-config.d.ts.map +1 -0
  445. package/dist/mcp-server-config.js +147 -0
  446. package/dist/mcp-server-config.js.map +1 -0
  447. package/dist/messages.d.ts +1577 -243
  448. package/dist/messages.d.ts.map +1 -1
  449. package/dist/messages.js +718 -22
  450. package/dist/messages.js.map +1 -1
  451. package/dist/missing-runtime-package.d.ts +23 -0
  452. package/dist/missing-runtime-package.d.ts.map +1 -0
  453. package/dist/missing-runtime-package.js +34 -0
  454. package/dist/missing-runtime-package.js.map +1 -0
  455. package/dist/model-selection.d.ts +20 -0
  456. package/dist/model-selection.d.ts.map +1 -0
  457. package/dist/model-selection.js +27 -0
  458. package/dist/model-selection.js.map +1 -0
  459. package/dist/nodetool-models.d.ts +71 -0
  460. package/dist/nodetool-models.d.ts.map +1 -0
  461. package/dist/nodetool-models.js +138 -0
  462. package/dist/nodetool-models.js.map +1 -0
  463. package/dist/package-assets.d.ts +39 -0
  464. package/dist/package-assets.d.ts.map +1 -0
  465. package/dist/package-assets.js +63 -0
  466. package/dist/package-assets.js.map +1 -0
  467. package/dist/platform.d.ts +66 -0
  468. package/dist/platform.d.ts.map +1 -0
  469. package/dist/platform.js +68 -0
  470. package/dist/platform.js.map +1 -0
  471. package/dist/predicates.d.ts +43 -0
  472. package/dist/predicates.d.ts.map +1 -0
  473. package/dist/predicates.js +65 -0
  474. package/dist/predicates.js.map +1 -0
  475. package/dist/processing-messages.schema.json +2545 -0
  476. package/dist/production-authoring.d.ts +931 -0
  477. package/dist/production-authoring.d.ts.map +1 -0
  478. package/dist/production-authoring.js +931 -0
  479. package/dist/production-authoring.js.map +1 -0
  480. package/dist/python-packs.d.ts +25 -0
  481. package/dist/python-packs.d.ts.map +1 -0
  482. package/dist/python-packs.js +51 -0
  483. package/dist/python-packs.js.map +1 -0
  484. package/dist/render-record.d.ts +228 -0
  485. package/dist/render-record.d.ts.map +1 -0
  486. package/dist/render-record.js +212 -0
  487. package/dist/render-record.js.map +1 -0
  488. package/dist/resource-id.d.ts +22 -0
  489. package/dist/resource-id.d.ts.map +1 -0
  490. package/dist/resource-id.js +32 -0
  491. package/dist/resource-id.js.map +1 -0
  492. package/dist/resource-uri.d.ts +15 -0
  493. package/dist/resource-uri.d.ts.map +1 -0
  494. package/dist/resource-uri.js +91 -0
  495. package/dist/resource-uri.js.map +1 -0
  496. package/dist/run-readers.d.ts +760 -0
  497. package/dist/run-readers.d.ts.map +1 -0
  498. package/dist/run-readers.js +153 -0
  499. package/dist/run-readers.js.map +1 -0
  500. package/dist/run-trace.d.ts +206 -0
  501. package/dist/run-trace.d.ts.map +1 -0
  502. package/dist/run-trace.js +177 -0
  503. package/dist/run-trace.js.map +1 -0
  504. package/dist/sandbox-capability.d.ts +86 -0
  505. package/dist/sandbox-capability.d.ts.map +1 -0
  506. package/dist/sandbox-capability.js +106 -0
  507. package/dist/sandbox-capability.js.map +1 -0
  508. package/dist/sandbox-host.d.ts +98 -0
  509. package/dist/sandbox-host.d.ts.map +1 -0
  510. package/dist/sandbox-host.js +311 -0
  511. package/dist/sandbox-host.js.map +1 -0
  512. package/dist/sandbox-package.d.ts +674 -0
  513. package/dist/sandbox-package.d.ts.map +1 -0
  514. package/dist/sandbox-package.js +622 -0
  515. package/dist/sandbox-package.js.map +1 -0
  516. package/dist/sandbox-wasm.d.ts +84 -0
  517. package/dist/sandbox-wasm.d.ts.map +1 -0
  518. package/dist/sandbox-wasm.js +139 -0
  519. package/dist/sandbox-wasm.js.map +1 -0
  520. package/dist/screenplay-authoring.d.ts +69 -0
  521. package/dist/screenplay-authoring.d.ts.map +1 -0
  522. package/dist/screenplay-authoring.js +352 -0
  523. package/dist/screenplay-authoring.js.map +1 -0
  524. package/dist/script-authoring.d.ts +161 -0
  525. package/dist/script-authoring.d.ts.map +1 -0
  526. package/dist/script-authoring.js +503 -0
  527. package/dist/script-authoring.js.map +1 -0
  528. package/dist/script-fill.d.ts +39 -0
  529. package/dist/script-fill.d.ts.map +1 -0
  530. package/dist/script-fill.js +67 -0
  531. package/dist/script-fill.js.map +1 -0
  532. package/dist/script-link.d.ts +110 -0
  533. package/dist/script-link.d.ts.map +1 -0
  534. package/dist/script-link.js +252 -0
  535. package/dist/script-link.js.map +1 -0
  536. package/dist/script-pace.d.ts +4 -0
  537. package/dist/script-pace.d.ts.map +1 -0
  538. package/dist/script-pace.js +11 -0
  539. package/dist/script-pace.js.map +1 -0
  540. package/dist/sha256.d.ts +11 -0
  541. package/dist/sha256.d.ts.map +1 -0
  542. package/dist/sha256.js +110 -0
  543. package/dist/sha256.js.map +1 -0
  544. package/dist/shot-prompt.d.ts +78 -0
  545. package/dist/shot-prompt.d.ts.map +1 -0
  546. package/dist/shot-prompt.js +120 -0
  547. package/dist/shot-prompt.js.map +1 -0
  548. package/dist/skill-document.d.ts +36 -0
  549. package/dist/skill-document.d.ts.map +1 -0
  550. package/dist/skill-document.js +140 -0
  551. package/dist/skill-document.js.map +1 -0
  552. package/dist/storyboard-render-spec.d.ts +4 -0
  553. package/dist/storyboard-render-spec.d.ts.map +1 -0
  554. package/dist/storyboard-render-spec.js +4 -0
  555. package/dist/storyboard-render-spec.js.map +1 -0
  556. package/dist/style-presets.d.ts +73 -0
  557. package/dist/style-presets.d.ts.map +1 -0
  558. package/dist/style-presets.js +147 -0
  559. package/dist/style-presets.js.map +1 -0
  560. package/dist/supervisor.d.ts +227 -0
  561. package/dist/supervisor.d.ts.map +1 -0
  562. package/dist/supervisor.js +116 -0
  563. package/dist/supervisor.js.map +1 -0
  564. package/dist/token-providers.d.ts +31 -0
  565. package/dist/token-providers.d.ts.map +1 -0
  566. package/dist/token-providers.js +52 -0
  567. package/dist/token-providers.js.map +1 -0
  568. package/dist/toolSchemas.d.ts +18 -14
  569. package/dist/toolSchemas.d.ts.map +1 -1
  570. package/dist/toolSchemas.js +30 -31
  571. package/dist/toolSchemas.js.map +1 -1
  572. package/dist/triggers.d.ts +41 -0
  573. package/dist/triggers.d.ts.map +1 -0
  574. package/dist/triggers.js +50 -0
  575. package/dist/triggers.js.map +1 -0
  576. package/dist/trpc-policy.d.ts +3 -0
  577. package/dist/trpc-policy.d.ts.map +1 -0
  578. package/dist/trpc-policy.js +3 -0
  579. package/dist/trpc-policy.js.map +1 -0
  580. package/dist/type-metadata.d.ts +5 -0
  581. package/dist/type-metadata.d.ts.map +1 -1
  582. package/dist/type-metadata.js +17 -8
  583. package/dist/type-metadata.js.map +1 -1
  584. package/dist/typecheck.d.ts.map +1 -1
  585. package/dist/typecheck.js +5 -4
  586. package/dist/typecheck.js.map +1 -1
  587. package/dist/wasm-binary.d.ts +61 -0
  588. package/dist/wasm-binary.d.ts.map +1 -0
  589. package/dist/wasm-binary.js +215 -0
  590. package/dist/wasm-binary.js.map +1 -0
  591. package/dist/workflow-document-revision.d.ts +4 -0
  592. package/dist/workflow-document-revision.d.ts.map +1 -0
  593. package/dist/workflow-document-revision.js +111 -0
  594. package/dist/workflow-document-revision.js.map +1 -0
  595. package/dist/workflow-plan.d.ts +274 -0
  596. package/dist/workflow-plan.d.ts.map +1 -0
  597. package/dist/workflow-plan.js +667 -0
  598. package/dist/workflow-plan.js.map +1 -0
  599. package/dist/wrap-primitives.d.ts +0 -11
  600. package/dist/wrap-primitives.d.ts.map +1 -1
  601. package/dist/wrap-primitives.js +3 -9
  602. package/dist/wrap-primitives.js.map +1 -1
  603. package/dist/ws-commands.d.ts +770 -0
  604. package/dist/ws-commands.d.ts.map +1 -0
  605. package/dist/ws-commands.js +624 -0
  606. package/dist/ws-commands.js.map +1 -0
  607. package/dist/zod-schema.d.ts +20 -0
  608. package/dist/zod-schema.d.ts.map +1 -0
  609. package/dist/zod-schema.js +298 -0
  610. package/dist/zod-schema.js.map +1 -0
  611. package/package.json +96 -7
  612. package/schema/sdk-v1.asyncapi.implemented.json +65 -0
  613. package/schema/sdk-v1.asyncapi.json +65 -0
  614. package/schema/sdk-v1.discovery.schema.json +1218 -0
  615. package/schema/sdk-v1.execution.schema.json +2792 -0
  616. package/schema/sdk-v1.lifecycle.schema.json +1031 -0
  617. package/schema/sdk-v1.manifest.json +71 -0
  618. package/schema/sdk-v1.openapi.implemented.json +730 -0
  619. package/schema/sdk-v1.openapi.json +730 -0
  620. package/schema/sdk-v1.operations.json +732 -0
  621. package/dist/agent-protocol.d.ts +0 -217
  622. package/dist/agent-protocol.d.ts.map +0 -1
  623. package/dist/agent-protocol.js +0 -85
  624. package/dist/agent-protocol.js.map +0 -1
@@ -0,0 +1,1928 @@
1
+ import { z } from "zod";
2
+ import { BLEND_MODE_TUPLE } from "../blend-modes.js";
3
+ import { creativeContext, productionTakeMetadata, productionRequirement } from "../production-authoring.js";
4
+ import { captionWord } from "../caption-word.js";
5
+ export { captionWord } from "../caption-word.js";
6
+ const blendModeEnum = z.enum(BLEND_MODE_TUPLE);
7
+ /**
8
+ * Curves a clip fade ramps along. The gain functions live in
9
+ * `@nodetool-ai/timeline` (`audioFade.ts`), which cannot be imported here
10
+ * without a cycle; `clipFadeShape.protocol.test.ts` there fails if the two
11
+ * lists drift apart.
12
+ */
13
+ export const CLIP_FADE_SHAPE_TUPLE = [
14
+ "linear",
15
+ "sCurve",
16
+ "plus3dB",
17
+ "minus3dB"
18
+ ];
19
+ export const clipFadeShapeEnum = z.enum(CLIP_FADE_SHAPE_TUPLE);
20
+ // ── Shared sub-schemas ───────────────────────────────────────────────────────
21
+ export const clipVersion = z.object({
22
+ id: z.string(),
23
+ createdAt: z.string(),
24
+ jobId: z.string(),
25
+ assetId: z.string(),
26
+ workflowUpdatedAt: z.string(),
27
+ dependencyHash: z.string(),
28
+ paramOverridesSnapshot: z.record(z.string(), z.unknown()),
29
+ costCredits: z.number().optional(),
30
+ durationMs: z.number().optional(),
31
+ status: z.enum(["success", "failed", "cancelled"]),
32
+ favorite: z.boolean().optional(),
33
+ /** Take metadata (P0 AI Video, PRD § 8.10). Without these fields Zod
34
+ * strips them on every PATCH, breaking take labels/provenance round-trips. */
35
+ label: z.string().optional(),
36
+ source: z
37
+ .enum([
38
+ "imported",
39
+ "generated",
40
+ "extended",
41
+ "inpainted",
42
+ "object_replace",
43
+ "video_to_video"
44
+ ])
45
+ .optional(),
46
+ provider: z.string().optional(),
47
+ model: z.string().optional(),
48
+ prompt: z.string().optional(),
49
+ negativePrompt: z.string().optional(),
50
+ parentTakeId: z.string().optional(),
51
+ /** Stable production candidate identity captured before dispatch. */
52
+ ...productionTakeMetadata.shape,
53
+ /** Immutable direct-generation inputs for recipe-based New take replay. */
54
+ generationRecipe: z
55
+ .object({
56
+ schemaVersion: z.literal(1),
57
+ task: z.literal("text_to_video"),
58
+ prompt: z.string().trim().min(1),
59
+ provider: z.string().trim().min(1),
60
+ model: z.string().trim().min(1),
61
+ durationMs: z.number().finite().positive(),
62
+ negativePrompt: z.string().trim().min(1).optional(),
63
+ aspectRatio: z.string().trim().min(1).optional(),
64
+ resolution: z.string().trim().min(1).optional(),
65
+ width: z.number().finite().positive().optional(),
66
+ height: z.number().finite().positive().optional(),
67
+ strength: z.number().finite().optional(),
68
+ numInferenceSteps: z.number().int().positive().optional(),
69
+ seed: z.number().int().optional(),
70
+ referenceAssetIds: z.array(z.string().trim().min(1)).optional()
71
+ })
72
+ .optional(),
73
+ /** Immutable Script context for a Change line delivery candidate. */
74
+ lineDelivery: z
75
+ .object({
76
+ action: z.literal("change_line_delivery"),
77
+ modelTask: z.literal("text_to_speech"),
78
+ requestId: z.string(),
79
+ sourceContext: z.object({
80
+ scriptId: z.string().trim().min(1),
81
+ lineId: z.string().trim().min(1),
82
+ speakerId: z.string().trim().min(1).optional(),
83
+ text: z.string().trim().min(1),
84
+ voice: z.object({
85
+ provider: z.string().trim().min(1),
86
+ model: z.string().trim().min(1),
87
+ voice: z.string().trim().min(1)
88
+ }),
89
+ direction: z.string().trim().min(1).optional(),
90
+ language: z.string().trim().min(1).optional(),
91
+ pace: z.enum(["slow", "normal", "fast"]).optional(),
92
+ targetDurationMs: z.number().finite().positive().optional()
93
+ }),
94
+ instructions: z.string().trim().min(1).optional(),
95
+ speed: z.number().finite().min(0.25).max(4).optional()
96
+ })
97
+ .optional(),
98
+ sourceMapping: z
99
+ .object({
100
+ inPointMs: z.number().optional(),
101
+ outPointMs: z.number().optional(),
102
+ speedMultiplier: z.number().optional(),
103
+ speedBaked: z.boolean().optional()
104
+ })
105
+ .optional(),
106
+ mediaEdit: z
107
+ .object({
108
+ action: z.literal("video_edit"),
109
+ modelTask: z.literal("video_to_video"),
110
+ referenceAssetIds: z.array(z.string().trim().min(1)).optional(),
111
+ entityIds: z.array(z.string().trim().min(1)).optional(),
112
+ requestId: z.string(),
113
+ instruction: z.string(),
114
+ provider: z.string(),
115
+ model: z.string(),
116
+ sourceContext: z.object({
117
+ sequenceId: z.string(),
118
+ clipId: z.string(),
119
+ sourceAssetId: z.string(),
120
+ sourceTakeId: z.string().optional(),
121
+ sourceStartMs: z.number(),
122
+ sourceEndMs: z.number(),
123
+ timelineStartMs: z.number(),
124
+ timelineDurationMs: z.number(),
125
+ speedMultiplier: z.number()
126
+ }),
127
+ strength: z.number().optional(),
128
+ resolution: z.string().optional()
129
+ })
130
+ .optional()
131
+ });
132
+ export const timelineMarker = z.object({
133
+ id: z.string(),
134
+ timeMs: z.number(),
135
+ label: z.string(),
136
+ color: z.string().optional(),
137
+ note: z.string().optional()
138
+ });
139
+ // ── Captions ─────────────────────────────────────────────────────────────────
140
+ /**
141
+ * Authored look of a caption layer. Every field is optional: an absent one
142
+ * keeps the drawing default, so a caption written before styling existed
143
+ * renders exactly as it did.
144
+ */
145
+ export const captionStyle = z.object({
146
+ fontFamily: z.string().optional(),
147
+ fontSizeFrac: z.number().optional(),
148
+ color: z.string().optional(),
149
+ activeColor: z.string().optional(),
150
+ outline: z.object({ color: z.string(), widthPx: z.number() }).optional(),
151
+ bottomMarginFrac: z.number().optional(),
152
+ background: z
153
+ .object({
154
+ color: z.string(),
155
+ paddingPx: z.number(),
156
+ radiusPx: z.number().optional()
157
+ })
158
+ .optional()
159
+ });
160
+ /**
161
+ * Word-level caption data carried by a caption clip. Sourced from the
162
+ * transcription of the beat's voiceover. A single fixed render style is used
163
+ * for the MVP, so no style fields are persisted yet.
164
+ */
165
+ export const clipCaption = z.object({
166
+ words: z.array(captionWord),
167
+ /** Caption look. Without this field Zod strips it on every PATCH, so a
168
+ * restyled caption reverts to the built-in look on the next save. */
169
+ style: captionStyle.optional()
170
+ });
171
+ // ── Transcript (Studio) ────────────────────────────────────────────────────
172
+ /**
173
+ * One line of the Studio transcript. Each line owns the clips generated from
174
+ * it (`clipIds` — typically a voiceover audio clip and a caption clip).
175
+ * `beatStartMs` is the line's position on the timeline, recomputed whenever
176
+ * beats are added, removed, reordered, or re-flowed.
177
+ */
178
+ export const transcriptLine = z.object({
179
+ id: z.string(),
180
+ text: z.string(),
181
+ beatStartMs: z.number(),
182
+ clipIds: z.array(z.string())
183
+ });
184
+ // ── Track DSP effects ────────────────────────────────────────────────────────
185
+ export const trackGainEffect = z.object({
186
+ id: z.string(),
187
+ type: z.literal("gain"),
188
+ enabled: z.boolean(),
189
+ gainDb: z.number()
190
+ });
191
+ export const trackEq3Effect = z.object({
192
+ id: z.string(),
193
+ type: z.literal("eq3"),
194
+ enabled: z.boolean(),
195
+ lowFreq: z.number(),
196
+ lowGainDb: z.number(),
197
+ midFreq: z.number(),
198
+ midQ: z.number(),
199
+ midGainDb: z.number(),
200
+ highFreq: z.number(),
201
+ highGainDb: z.number()
202
+ });
203
+ export const trackFilterEffect = z.object({
204
+ id: z.string(),
205
+ type: z.literal("filter"),
206
+ enabled: z.boolean(),
207
+ mode: z.enum(["lowpass", "highpass", "bandpass"]),
208
+ frequency: z.number(),
209
+ q: z.number()
210
+ });
211
+ export const trackCompressorEffect = z.object({
212
+ id: z.string(),
213
+ type: z.literal("compressor"),
214
+ enabled: z.boolean(),
215
+ thresholdDb: z.number(),
216
+ ratio: z.number(),
217
+ attackMs: z.number(),
218
+ releaseMs: z.number(),
219
+ kneeDb: z.number()
220
+ });
221
+ // ── Track video effects ──────────────────────────────────────────────────────
222
+ export const trackColorCorrectionEffect = z.object({
223
+ id: z.string(),
224
+ type: z.literal("colorCorrection"),
225
+ enabled: z.boolean(),
226
+ brightness: z.number(),
227
+ contrast: z.number(),
228
+ saturation: z.number(),
229
+ hue: z.number(),
230
+ temperature: z.number(),
231
+ tint: z.number(),
232
+ shadows: z.number(),
233
+ highlights: z.number()
234
+ });
235
+ export const trackVideoBlurEffect = z.object({
236
+ id: z.string(),
237
+ type: z.literal("videoBlur"),
238
+ enabled: z.boolean(),
239
+ radius: z.number()
240
+ });
241
+ export const trackSharpenEffect = z.object({
242
+ id: z.string(),
243
+ type: z.literal("sharpen"),
244
+ enabled: z.boolean(),
245
+ amount: z.number(),
246
+ threshold: z.number()
247
+ });
248
+ export const trackVignetteEffect = z.object({
249
+ id: z.string(),
250
+ type: z.literal("vignette"),
251
+ enabled: z.boolean(),
252
+ intensity: z.number(),
253
+ radius: z.number(),
254
+ softness: z.number()
255
+ });
256
+ export const trackChromaKeyEffect = z.object({
257
+ id: z.string(),
258
+ type: z.literal("chromaKey"),
259
+ enabled: z.boolean(),
260
+ keyColor: z.string(),
261
+ tolerance: z.number(),
262
+ softness: z.number(),
263
+ spill: z.number()
264
+ });
265
+ export const trackEffect = z.discriminatedUnion("type", [
266
+ trackGainEffect,
267
+ trackEq3Effect,
268
+ trackFilterEffect,
269
+ trackCompressorEffect,
270
+ trackColorCorrectionEffect,
271
+ trackVideoBlurEffect,
272
+ trackSharpenEffect,
273
+ trackVignetteEffect,
274
+ trackChromaKeyEffect
275
+ ]);
276
+ // ── MIDI ─────────────────────────────────────────────────────────────────────
277
+ /**
278
+ * How many notes one midi clip may carry. A clip is a phrase, not a song: the
279
+ * cap keeps a runaway generator from writing a document no editor can open,
280
+ * and it is checked here so the limit is the same on every surface.
281
+ */
282
+ export const MIDI_MAX_NOTES_PER_CLIP = 4096;
283
+ /**
284
+ * One note inside a midi clip. `startTick`/`durationTick` are ticks (960 per
285
+ * quarter note, `MIDI_PPQ` in `@nodetool-ai/timeline`) measured from the
286
+ * clip's *content* start, not from its window — exactly as an audio clip's
287
+ * samples are measured from the head of its source. Trimming the window
288
+ * therefore hides notes rather than deleting them.
289
+ */
290
+ export const midiNote = z.object({
291
+ id: z.string(),
292
+ pitch: z.number().int().min(0).max(127),
293
+ velocity: z.number().int().min(1).max(127),
294
+ startTick: z.number().int().min(0),
295
+ durationTick: z.number().int().positive()
296
+ });
297
+ /** An ADSR envelope, in milliseconds with a 0..1 sustain level. */
298
+ export const midiEnvelope = z.object({
299
+ attackMs: z.number().min(0),
300
+ decayMs: z.number().min(0),
301
+ sustain: z.number().min(0).max(1),
302
+ releaseMs: z.number().min(0)
303
+ });
304
+ /** The filter shapes the FableSynth-derived voices offer. */
305
+ export const midiFilterType = z.enum(["lp12", "lp24", "bp12", "hp12", "notch"]);
306
+ /** The tonal wavetables WT-1 and BL-1 play. */
307
+ export const midiWavetableName = z.enum([
308
+ "prime",
309
+ "bloom",
310
+ "pulse",
311
+ "vox",
312
+ "chime",
313
+ "glitch"
314
+ ]);
315
+ /** DR-1's percussive tables. A pad can also play any tonal table. */
316
+ export const midiDrumTableName = z.enum(["thud", "crack", "tine", "grit"]);
317
+ /** One of WT-1's two wavetable oscillators. */
318
+ export const wavetableOscillator = z.object({
319
+ table: midiWavetableName,
320
+ /** Morph position across the table's frames, 0..1. */
321
+ position: z.number().min(0).max(1),
322
+ /** Offset from the played note, in semitones. */
323
+ semitones: z.number(),
324
+ /** Further offset in cents. */
325
+ fine: z.number(),
326
+ /** Output level, 0..1. */
327
+ level: z.number().min(0).max(1),
328
+ /** Detuned copies of the oscillator, 1..7. */
329
+ unison: z.number().int().min(1).max(7),
330
+ /** How far the copies spread, 0..1 (1 = ±50 cents). */
331
+ detune: z.number().min(0).max(1)
332
+ });
333
+ /** One DR-1 pad: a tuned one-shot with its own envelope and filter. */
334
+ export const drumPad = z.object({
335
+ name: z.string(),
336
+ table: z.union([midiWavetableName, midiDrumTableName]),
337
+ position: z.number().min(0).max(1),
338
+ /** Pitch offset from the pad's base note, in semitones. */
339
+ semitones: z.number(),
340
+ /** How far the pitch envelope starts above the pad's pitch, in semitones. */
341
+ pitchEnvAmount: z.number(),
342
+ pitchEnvDecayMs: z.number().min(0),
343
+ noiseLevel: z.number().min(0).max(1),
344
+ /** Noise colour, -1 (dark) to 1 (bright). */
345
+ noiseColor: z.number().min(-1).max(1),
346
+ /** Ring-modulator carrier in Hz. */
347
+ ringHz: z.number().positive(),
348
+ ringMix: z.number().min(0).max(1),
349
+ attackMs: z.number().min(0),
350
+ /** How long the envelope holds at full before decaying, in ms. */
351
+ holdMs: z.number().min(0),
352
+ decayMs: z.number().min(0),
353
+ /** Decay shape, 0 (a straight line) to 1 (exponential). */
354
+ curve: z.number().min(0).max(1),
355
+ /** The pad's filter, or null for no filter. */
356
+ filter: z
357
+ .object({
358
+ type: midiFilterType,
359
+ cutoffHz: z.number().positive(),
360
+ resonance: z.number().min(0).max(1)
361
+ })
362
+ .nullable(),
363
+ level: z.number().min(0).max(1),
364
+ /** How much velocity scales the level, 0..1. */
365
+ velocityToLevel: z.number().min(0).max(1)
366
+ });
367
+ /**
368
+ * The voice a midi track plays.
369
+ *
370
+ * `subtractive` is the built-in synth. The other three are ports of the
371
+ * FableSynth instruments (github.com/georgi/fablesynth): WT-1 the wavetable
372
+ * synth, BL-1 the acid bassline, DR-1 the drum machine.
373
+ */
374
+ export const samplerZone = z.object({
375
+ id: z.string().min(1),
376
+ name: z.string(),
377
+ assetId: z.string().regex(/^[a-f0-9]{32}$/, "Use a full audio asset id"),
378
+ rootNote: z.number().int().min(0).max(127),
379
+ lowNote: z.number().int().min(0).max(127),
380
+ highNote: z.number().int().min(0).max(127),
381
+ gainDb: z.number().min(-60).max(12)
382
+ }).refine(zone => zone.lowNote <= zone.highNote, {
383
+ message: "The lowest key must not exceed the highest key"
384
+ });
385
+ export const samplerMidiInstrument = z.object({
386
+ type: z.literal("sampler"),
387
+ zones: z.array(samplerZone).max(32),
388
+ oneShot: z.boolean(),
389
+ attackMs: z.number().min(0).max(10000),
390
+ releaseMs: z.number().min(0).max(30000),
391
+ gainDb: z.number().min(-60).max(12)
392
+ });
393
+ export const midiInstrument = z.discriminatedUnion("type", [
394
+ samplerMidiInstrument,
395
+ z.object({
396
+ type: z.literal("subtractive"),
397
+ waveform: z.enum(["saw", "square", "triangle", "sine"]),
398
+ /** Envelope attack in ms. */
399
+ attackMs: z.number().min(0),
400
+ /** Envelope decay in ms. */
401
+ decayMs: z.number().min(0),
402
+ /** Sustain level, 0..1 of the peak. */
403
+ sustain: z.number().min(0).max(1),
404
+ /** Envelope release in ms. */
405
+ releaseMs: z.number().min(0),
406
+ /** Lowpass cutoff in Hz. */
407
+ cutoffHz: z.number().positive(),
408
+ /** Lowpass Q. */
409
+ resonance: z.number().positive(),
410
+ /** Output gain in dB. */
411
+ gainDb: z.number()
412
+ }),
413
+ z.object({
414
+ type: z.literal("wavetable"),
415
+ oscA: wavetableOscillator,
416
+ oscB: wavetableOscillator,
417
+ /** Sine sub-oscillator level, 0..1. */
418
+ subLevel: z.number().min(0).max(1),
419
+ /** Sub octave below the note: -1 or -2. */
420
+ subOctave: z.number().int().min(-2).max(-1),
421
+ /** White noise level, 0..1. */
422
+ noiseLevel: z.number().min(0).max(1),
423
+ filterType: midiFilterType,
424
+ cutoffHz: z.number().positive(),
425
+ /** Filter resonance, 0..1. */
426
+ resonance: z.number().min(0).max(1),
427
+ /** Anti-aliased tanh drive into the filter, 0..1. */
428
+ drive: z.number().min(0).max(1),
429
+ /** How far the mod envelope sweeps the cutoff, in octaves. */
430
+ filterEnvAmount: z.number(),
431
+ /** How far the played note tracks the cutoff, 0..1. */
432
+ keyTrack: z.number().min(0).max(1),
433
+ ampEnv: midiEnvelope,
434
+ modEnv: midiEnvelope,
435
+ gainDb: z.number()
436
+ }),
437
+ z.object({
438
+ type: z.literal("bass"),
439
+ table: midiWavetableName,
440
+ position: z.number().min(0).max(1),
441
+ /** Offset from the played note, in semitones. */
442
+ semitones: z.number(),
443
+ subShape: z.enum(["sine", "square"]),
444
+ /** Sub octave below the note: -1 or -2. */
445
+ subOctave: z.number().int().min(-2).max(-1),
446
+ subLevel: z.number().min(0).max(1),
447
+ filterType: midiFilterType,
448
+ cutoffHz: z.number().positive(),
449
+ resonance: z.number().min(0).max(1),
450
+ drive: z.number().min(0).max(1),
451
+ /** How far the filter envelope sweeps the cutoff, in octaves. */
452
+ filterEnvAmount: z.number(),
453
+ keyTrack: z.number().min(0).max(1),
454
+ filterAttackMs: z.number().min(0),
455
+ filterDecayMs: z.number().min(0),
456
+ ampEnv: midiEnvelope,
457
+ /** How much an accented note adds to its level and filter sweep, 0..1. */
458
+ accentAmount: z.number().min(0).max(1),
459
+ /** The velocity at which a note counts as accented. */
460
+ accentVelocity: z.number().int().min(1).max(127),
461
+ /** How long a note overlapping the one before it glides, in ms. */
462
+ slideMs: z.number().min(0),
463
+ gainDb: z.number()
464
+ }),
465
+ z.object({
466
+ type: z.literal("drum"),
467
+ /** The MIDI note pad 0 answers to. Pads run `baseNote`..`baseNote + 15`. */
468
+ baseNote: z.number().int().min(0).max(127),
469
+ pads: z.array(drumPad),
470
+ gainDb: z.number()
471
+ })
472
+ ]);
473
+ /**
474
+ * Document-level constant tempo. Milliseconds stay the stored master clock —
475
+ * ticks are read against `bpm` — so changing the tempo rescales every midi
476
+ * clip's timing around `offsetMs` and leaves every other clip where it is.
477
+ */
478
+ export const timelineTempo = z.object({
479
+ bpm: z.number().positive(),
480
+ /** Where beat one sits on the timeline, in ms. */
481
+ offsetMs: z.number().min(0),
482
+ timeSignature: z.object({
483
+ beatsPerBar: z.number().int().positive(),
484
+ beatUnit: z.number().int().positive()
485
+ })
486
+ });
487
+ export const timelineTrack = z.object({
488
+ id: z.string(),
489
+ name: z.string(),
490
+ type: z.enum(["video", "audio", "overlay", "subtitle", "midi"]),
491
+ index: z.number().int(),
492
+ folderId: z.string().optional(),
493
+ visible: z.boolean(),
494
+ locked: z.boolean(),
495
+ muted: z.boolean().optional(),
496
+ solo: z.boolean().optional(),
497
+ heightPx: z.number().optional(),
498
+ effects: z.array(trackEffect).optional(),
499
+ /** The voice a `midi` track plays; the track owns the instrument, not the
500
+ * clip. Without this field Zod strips it on every PATCH, so a track reverts
501
+ * to the default synth on the first autosave. */
502
+ instrument: midiInstrument.optional()
503
+ });
504
+ export const timelineTrackFolder = z.object({
505
+ id: z.string(),
506
+ name: z.string().min(1)
507
+ });
508
+ // ── Per-clip placement, transitions, and GPU effects ─────────────────────────
509
+ export const clipTransform = z.object({
510
+ position: z.object({ x: z.number(), y: z.number() }),
511
+ scale: z.object({ x: z.number(), y: z.number() }),
512
+ rotation: z.number(),
513
+ rotationX: z.number().optional(),
514
+ rotationY: z.number().optional(),
515
+ perspective: z.number().positive().optional(),
516
+ depthPx: z.number().optional(),
517
+ anchor: z.object({ x: z.number(), y: z.number() })
518
+ });
519
+ export const timelineCamera2d = z.object({
520
+ position: z.object({ x: z.number(), y: z.number() }),
521
+ depthPx: z.number(),
522
+ focalLengthPx: z.number().positive(),
523
+ focusDepthPx: z.number().optional(),
524
+ aperturePx: z.number().nonnegative().optional(),
525
+ keyframes: z.array(z.object({
526
+ timeMs: z.number(),
527
+ position: z.object({ x: z.number(), y: z.number() }),
528
+ depthPx: z.number(),
529
+ focusDepthPx: z.number().optional(),
530
+ aperturePx: z.number().nonnegative().optional()
531
+ })).optional()
532
+ });
533
+ const flexJustifyEnum = z.enum([
534
+ "flex-start",
535
+ "flex-end",
536
+ "center",
537
+ "space-between",
538
+ "space-around",
539
+ "space-evenly"
540
+ ]);
541
+ const flexAlignEnum = z.enum(["flex-start", "flex-end", "center", "stretch", "baseline"]);
542
+ const clipLayoutEdges = z.object({
543
+ top: z.number().optional(),
544
+ right: z.number().optional(),
545
+ bottom: z.number().optional(),
546
+ left: z.number().optional()
547
+ });
548
+ /** A px number or a percentage string, as `types.ts`'s `ClipLayoutDimension` names it. */
549
+ const clipLayoutDimension = z.union([z.number(), z.string()]);
550
+ /** A flex container (Yoga). See `types.ts`'s `ClipLayout` for the field-by-field contract. */
551
+ export const clipLayout = z.object({
552
+ display: z.literal("flex"),
553
+ flexDirection: z.enum(["row", "column"]).optional(),
554
+ justifyContent: flexJustifyEnum.optional(),
555
+ alignItems: flexAlignEnum.optional(),
556
+ alignContent: flexJustifyEnum.optional(),
557
+ flexWrap: z.enum(["nowrap", "wrap", "wrap-reverse"]).optional(),
558
+ gap: z.number().optional(),
559
+ rowGap: z.number().optional(),
560
+ columnGap: z.number().optional(),
561
+ padding: z.union([z.number(), clipLayoutEdges]).optional(),
562
+ width: clipLayoutDimension.optional(),
563
+ height: clipLayoutDimension.optional(),
564
+ minWidth: clipLayoutDimension.optional(),
565
+ maxWidth: clipLayoutDimension.optional(),
566
+ minHeight: clipLayoutDimension.optional(),
567
+ maxHeight: clipLayoutDimension.optional()
568
+ });
569
+ /** A flex child's own sizing/placement. See `types.ts`'s `ClipFlexItem`. */
570
+ export const clipFlexItem = z.object({
571
+ grow: z.number().optional(),
572
+ shrink: z.number().optional(),
573
+ basis: clipLayoutDimension.optional(),
574
+ alignSelf: flexAlignEnum.optional(),
575
+ width: clipLayoutDimension.optional(),
576
+ height: clipLayoutDimension.optional(),
577
+ margin: z.union([z.number(), clipLayoutEdges]).optional(),
578
+ position: z.enum(["relative", "absolute"]).optional(),
579
+ inset: z.union([z.number(), clipLayoutEdges]).optional()
580
+ });
581
+ export const clipRepeater = z.object({
582
+ count: z.number().int().min(1).max(128),
583
+ positionStep: z.object({ x: z.number(), y: z.number() }),
584
+ columns: z.number().int().min(1).max(128).optional(),
585
+ rowStep: z.object({ x: z.number(), y: z.number() }).optional(),
586
+ timeStepMs: z.number(),
587
+ colorStep: z.object({ hueDegrees: z.number(), brightness: z.number().optional() }).optional()
588
+ });
589
+ /**
590
+ * Per-clip incoming transition. `easing` and `direction` are plain strings on
591
+ * the wire for the same forward compat `preset` has: a value this build cannot
592
+ * parse falls back rather than failing the document. Without the new members
593
+ * Zod strips the whole `transitionIn` of any non-crossfade transition on every
594
+ * PATCH, so the cut silently reverts to a hard one.
595
+ */
596
+ const knownClipTransition = z.discriminatedUnion("type", [
597
+ z.object({
598
+ type: z.literal("crossfade"),
599
+ durationMs: z.number(),
600
+ easing: z.string().optional()
601
+ }),
602
+ z.object({
603
+ type: z.literal("dipToColor"),
604
+ durationMs: z.number(),
605
+ color: z.string(),
606
+ easing: z.string().optional()
607
+ }),
608
+ z.object({
609
+ type: z.literal("wipe"),
610
+ durationMs: z.number(),
611
+ direction: z.string(),
612
+ softness: z.number().optional(),
613
+ easing: z.string().optional()
614
+ }),
615
+ z.object({
616
+ type: z.literal("push"),
617
+ durationMs: z.number(),
618
+ direction: z.string(),
619
+ easing: z.string().optional()
620
+ }),
621
+ z.object({
622
+ type: z.literal("slide"),
623
+ durationMs: z.number(),
624
+ direction: z.string(),
625
+ easing: z.string().optional()
626
+ }),
627
+ z.object({
628
+ type: z.literal("zoom"),
629
+ durationMs: z.number(),
630
+ easing: z.string().optional()
631
+ }),
632
+ z.object({
633
+ type: z.literal("whip"), durationMs: z.number(), direction: z.string(), blur: z.number().optional(), easing: z.string().optional()
634
+ }),
635
+ z.object({
636
+ type: z.literal("zoomBlur"), durationMs: z.number(), blur: z.number().optional(), easing: z.string().optional()
637
+ }),
638
+ z.object({
639
+ type: z.literal("glitch"), durationMs: z.number(), amount: z.number().optional(), easing: z.string().optional()
640
+ }),
641
+ z.object({
642
+ type: z.literal("gradientWipe"), durationMs: z.number(), direction: z.string(), softness: z.number().optional(), map: z.enum(["linear", "radial", "noise"]).optional(), scale: z.number().optional(), seed: z.number().optional(), easing: z.string().optional()
643
+ }),
644
+ z.object({
645
+ type: z.literal("iris"), durationMs: z.number(), softness: z.number().optional(), easing: z.string().optional()
646
+ }),
647
+ z.object({
648
+ type: z.literal("lightLeak"), durationMs: z.number(), color: z.string().optional(), scale: z.number().optional(), seed: z.number().optional(), easing: z.string().optional()
649
+ })
650
+ ]);
651
+ /**
652
+ * Every transition `type` the members above spell out field by field. Exported
653
+ * as a list so the agent tool schemas in `timeline-tool-params.ts` enumerate
654
+ * the same cuts this schema stores — an enum written out twice drifts.
655
+ */
656
+ export const KNOWN_TRANSITION_TYPE_LIST = [
657
+ "crossfade",
658
+ "dipToColor",
659
+ "wipe",
660
+ "push",
661
+ "slide",
662
+ "zoom",
663
+ "whip",
664
+ "zoomBlur",
665
+ "glitch",
666
+ "gradientWipe",
667
+ "iris",
668
+ "lightLeak"
669
+ ];
670
+ const KNOWN_TRANSITION_TYPES = new Set(KNOWN_TRANSITION_TYPE_LIST);
671
+ /**
672
+ * A cut authored by a newer build (I2). The `refine` is what keeps the two
673
+ * halves disjoint: a type one of the members above claims can never reach this
674
+ * one, so `crossfade` with a string `durationMs` still fails rather than
675
+ * sliding into the permissive branch. Everything past the shared shape rides
676
+ * through untyped — dropping it here would lose the newer build's parameters
677
+ * on the first save, which is the data loss `field_stripped` reports.
678
+ */
679
+ const forwardClipTransition = z.looseObject({
680
+ // `abort` is what keeps the failure legible: without it a bad field on a
681
+ // known type leaves this the only branch Zod reports, so the error reads
682
+ // "unknown type" about a type we ship.
683
+ type: z.string().refine((type) => !KNOWN_TRANSITION_TYPES.has(type), {
684
+ abort: true,
685
+ error: (issue) => `"${String(issue.input)}" is a transition type this build declares; it must match that type's own fields.`
686
+ }),
687
+ durationMs: z.number(),
688
+ easing: z.string().optional()
689
+ });
690
+ export const clipTransition = z.union([
691
+ knownClipTransition,
692
+ forwardClipTransition
693
+ ]);
694
+ export const clipColorEffect = z.object({
695
+ id: z.string(),
696
+ type: z.literal("color"),
697
+ enabled: z.boolean(),
698
+ brightness: z.number().optional(),
699
+ contrast: z.number().optional(),
700
+ saturation: z.number().optional(),
701
+ hue: z.number().optional(),
702
+ temperature: z.number().optional(),
703
+ tint: z.number().optional(),
704
+ shadows: z.number().optional(),
705
+ highlights: z.number().optional()
706
+ });
707
+ export const clipBlurEffect = z.object({
708
+ id: z.string(),
709
+ type: z.literal("blur"),
710
+ enabled: z.boolean(),
711
+ radius: z.number(),
712
+ sigma: z.number().optional()
713
+ });
714
+ export const clipPixelateEffect = z.object({
715
+ id: z.string(),
716
+ type: z.literal("pixelate"),
717
+ enabled: z.boolean(),
718
+ cellSize: z.number().min(1).max(128)
719
+ });
720
+ export const clipPosterizeEffect = z.object({
721
+ id: z.string(),
722
+ type: z.literal("posterize"),
723
+ enabled: z.boolean(),
724
+ levels: z.number().min(2).max(256)
725
+ });
726
+ export const clipDirectionalBlurEffect = z.object({
727
+ id: z.string(),
728
+ type: z.literal("directionalBlur"),
729
+ enabled: z.boolean(),
730
+ radius: z.number().min(0).max(256),
731
+ angle: z.number()
732
+ });
733
+ export const clipLensDistortionEffect = z.object({
734
+ id: z.string(),
735
+ type: z.literal("lensDistortion"),
736
+ enabled: z.boolean(),
737
+ amount: z.number().min(-1).max(1)
738
+ });
739
+ export const clipStylizeEffect = z.object({
740
+ id: z.string(),
741
+ type: z.literal("stylize"),
742
+ enabled: z.boolean(),
743
+ mode: z.enum(["rgbSplit", "radialBlur", "zoomBlur", "turbulence", "glitch", "halftone", "dither", "lightRays", "lensFlare", "innerShadow", "innerGlow", "edgeHighlight", "displacement", "gradientWipe", "lightLeakOverlay"]),
744
+ amount: z.number(),
745
+ scale: z.number().optional(),
746
+ angle: z.number().optional(),
747
+ time: z.number().optional(),
748
+ animate: z.boolean().optional(),
749
+ seed: z.number().optional(),
750
+ color: z.string().optional(),
751
+ softness: z.number().optional()
752
+ });
753
+ export const clipGeneratorEffect = z.object({
754
+ id: z.string(),
755
+ type: z.literal("generator"),
756
+ enabled: z.boolean(),
757
+ mode: z.enum(["noise", "fractal", "conicGradient", "meshGradient", "gradientField", "particles", "lightLeak", "gridPattern"]),
758
+ amount: z.number().optional(),
759
+ scale: z.number().optional(),
760
+ angle: z.number().optional(),
761
+ time: z.number().optional(),
762
+ animate: z.boolean().optional(),
763
+ seed: z.number().optional(),
764
+ colorA: z.string().optional(),
765
+ colorB: z.string().optional()
766
+ });
767
+ export const clipLutEffect = z.object({
768
+ id: z.string(),
769
+ type: z.literal("lut"),
770
+ enabled: z.boolean(),
771
+ cube: z.string().min(1),
772
+ intensity: z.number().min(0).max(1).optional()
773
+ });
774
+ /** One control point of a tone curve. Both axes are normalized 0..1. */
775
+ export const curvePoint = z.object({ x: z.number(), y: z.number() });
776
+ export const clipGlowEffect = z.object({
777
+ id: z.string(),
778
+ type: z.literal("glow"),
779
+ enabled: z.boolean(),
780
+ radius: z.number(),
781
+ intensity: z.number(),
782
+ color: z.string().optional()
783
+ });
784
+ export const clipDropShadowEffect = z.object({
785
+ id: z.string(),
786
+ type: z.literal("dropShadow"),
787
+ enabled: z.boolean(),
788
+ offsetX: z.number(),
789
+ offsetY: z.number(),
790
+ blur: z.number(),
791
+ color: z.string(),
792
+ opacity: z.number().optional()
793
+ });
794
+ export const clipVignetteEffect = z.object({
795
+ id: z.string(),
796
+ type: z.literal("vignette"),
797
+ enabled: z.boolean(),
798
+ amount: z.number(),
799
+ softness: z.number(),
800
+ /** Absent means the shader's own default. Mirrors ClipVignetteEffect.radius. */
801
+ radius: z.number().optional()
802
+ });
803
+ export const clipSharpenEffect = z.object({
804
+ id: z.string(),
805
+ type: z.literal("sharpen"),
806
+ enabled: z.boolean(),
807
+ amount: z.number(),
808
+ radius: z.number().optional(),
809
+ /** Absent means the shader's own default. Mirrors ClipSharpenEffect.threshold. */
810
+ threshold: z.number().optional()
811
+ });
812
+ export const clipChromaKeyEffect = z.object({
813
+ id: z.string(),
814
+ type: z.literal("chromaKey"),
815
+ enabled: z.boolean(),
816
+ color: z.string(),
817
+ tolerance: z.number(),
818
+ softness: z.number(),
819
+ spill: z.number().optional()
820
+ });
821
+ export const clipCurvesEffect = z.object({
822
+ id: z.string(),
823
+ type: z.literal("curves"),
824
+ enabled: z.boolean(),
825
+ master: z.array(curvePoint),
826
+ r: z.array(curvePoint).optional(),
827
+ g: z.array(curvePoint).optional(),
828
+ b: z.array(curvePoint).optional()
829
+ });
830
+ export const clipLevelsEffect = z.object({
831
+ id: z.string(),
832
+ type: z.literal("levels"),
833
+ enabled: z.boolean(),
834
+ inBlack: z.number(),
835
+ inWhite: z.number(),
836
+ gamma: z.number(),
837
+ outBlack: z.number(),
838
+ outWhite: z.number()
839
+ });
840
+ const rgbTriple = z.tuple([z.number(), z.number(), z.number()]);
841
+ export const clipLiftGammaGainEffect = z.object({
842
+ id: z.string(),
843
+ type: z.literal("liftGammaGain"),
844
+ enabled: z.boolean(),
845
+ lift: rgbTriple,
846
+ gamma: rgbTriple,
847
+ gain: rgbTriple
848
+ });
849
+ /** Mirrors ClipGrainEffect. Absent knobs mean `filters.grain@1`'s own defaults. */
850
+ export const clipGrainEffect = z.object({
851
+ id: z.string(),
852
+ type: z.literal("grain"),
853
+ enabled: z.boolean(),
854
+ amount: z.number(),
855
+ size: z.number().optional(),
856
+ colorAmount: z.number().optional(),
857
+ animate: z.boolean().optional(),
858
+ seed: z.number().optional()
859
+ });
860
+ /**
861
+ * The clip effect chain. Without the members below Zod drops any effect whose
862
+ * type it does not carry on every PATCH, so a graded clip loses that step of
863
+ * its chain on the next save.
864
+ */
865
+ const knownClipEffect = z.discriminatedUnion("type", [
866
+ clipColorEffect,
867
+ clipBlurEffect,
868
+ clipPixelateEffect,
869
+ clipPosterizeEffect,
870
+ clipDirectionalBlurEffect,
871
+ clipLensDistortionEffect,
872
+ clipStylizeEffect,
873
+ clipGeneratorEffect,
874
+ clipLutEffect,
875
+ clipGlowEffect,
876
+ clipDropShadowEffect,
877
+ clipVignetteEffect,
878
+ clipSharpenEffect,
879
+ clipChromaKeyEffect,
880
+ clipCurvesEffect,
881
+ clipLevelsEffect,
882
+ clipLiftGammaGainEffect,
883
+ clipGrainEffect
884
+ ]);
885
+ /**
886
+ * Every effect `type` the members above spell out field by field. Exported as
887
+ * a list for the same reason {@link KNOWN_TRANSITION_TYPE_LIST} is.
888
+ */
889
+ export const KNOWN_CLIP_EFFECT_TYPE_LIST = [
890
+ "color",
891
+ "blur",
892
+ "pixelate",
893
+ "posterize",
894
+ "directionalBlur",
895
+ "lensDistortion",
896
+ "stylize",
897
+ "generator",
898
+ "lut",
899
+ "glow",
900
+ "dropShadow",
901
+ "vignette",
902
+ "sharpen",
903
+ "chromaKey",
904
+ "curves",
905
+ "levels",
906
+ "liftGammaGain",
907
+ "grain"
908
+ ];
909
+ const KNOWN_CLIP_EFFECT_TYPES = new Set(KNOWN_CLIP_EFFECT_TYPE_LIST);
910
+ /**
911
+ * An effect authored by a newer build (I2), same construction as
912
+ * `forwardClipTransition`: the `refine` keeps this branch unreachable for a
913
+ * type the members above claim, so their field validation is untouched, and
914
+ * the parameters the newer build wrote ride through instead of being dropped
915
+ * on the next save. `id` and `enabled` are required because the whole chain is
916
+ * addressed and filtered by them.
917
+ */
918
+ const forwardClipEffect = z.looseObject({
919
+ id: z.string(),
920
+ type: z.string().refine((type) => !KNOWN_CLIP_EFFECT_TYPES.has(type), {
921
+ abort: true,
922
+ error: (issue) => `"${String(issue.input)}" is an effect type this build declares; it must match that type's own fields.`
923
+ }),
924
+ enabled: z.boolean()
925
+ });
926
+ export const clipEffect = z.union([knownClipEffect, forwardClipEffect]);
927
+ export const clipBindingKind = z.enum([
928
+ "workflow",
929
+ "text-to-image",
930
+ "image-to-image",
931
+ "text-to-video",
932
+ "image-to-video",
933
+ "text-to-music",
934
+ "text-to-audio"
935
+ ]);
936
+ // ── Motion-design animations ─────────────────────────────────────────────────
937
+ /**
938
+ * One keyframe of a baked custom-animation curve. `t` is normalized 0..1
939
+ * within the animation window; `easing` names the segment ENDING at this
940
+ * keyframe and is a plain string for the same forward compat as `preset`.
941
+ *
942
+ * On a `timeBase: "source"` curve the keyframe is placed by `sourceMs` — an
943
+ * absolute time in the media — and `t` is derived from it, which is why `t`
944
+ * defaults rather than being required there.
945
+ */
946
+ export const animationKeyframe = z.object({
947
+ t: z.number().default(0),
948
+ value: z.number(),
949
+ easing: z.string().optional(),
950
+ /**
951
+ * Absolute source-media time in ms. Required on every keyframe of a
952
+ * source-anchored curve (non-negative and non-decreasing along the curve,
953
+ * enforced by `normalizeCustomCurves`); ignored on a clip-based one.
954
+ */
955
+ sourceMs: z.number().optional()
956
+ });
957
+ /**
958
+ * One baked property curve. `property` is a plain string on the wire: a curve
959
+ * naming a property this build does not animate parses fine and is dropped at
960
+ * compile time, the same forward compat `preset` has.
961
+ */
962
+ export const animationPropertyCurve = z.object({
963
+ property: z.string(),
964
+ /**
965
+ * Bounded to `MAX_CUSTOM_KEYFRAMES` in
966
+ * `packages/timeline/src/animation/custom.ts` — a curve the bake would refuse
967
+ * must not be storable through the wire either. `packages/timeline` depends
968
+ * on this package, so the two are pinned equal by
969
+ * `packages/execution/tests/timeline-schema-bounds.test.ts` rather than by an
970
+ * import.
971
+ */
972
+ keyframes: z.array(animationKeyframe).max(4096)
973
+ });
974
+ /**
975
+ * A custom animation: curves produced by a JS body rather than by a shipped
976
+ * preset. The body runs ONCE, host-side in the QuickJS sandbox, and its
977
+ * keyframes are baked in here — so playback, export, and the headless
978
+ * compositor sample identical curves and no renderer needs a JS engine.
979
+ *
980
+ * `scriptId`/`code` are provenance: they say what produced `curves` so the
981
+ * editor can re-bake, and are never executed at render time.
982
+ */
983
+ export const customClipAnimation = z.object({
984
+ /** JS script document (`js_scripts` row) the curves were baked from. */
985
+ scriptId: z.string().optional(),
986
+ /** Inline body the curves were baked from. */
987
+ code: z.string().optional(),
988
+ /** ISO timestamp of the bake that produced `curves`. */
989
+ bakedAt: z.string().optional(),
990
+ /**
991
+ * Clock the keyframes are placed on: `"clip"` (default) normalizes `t` over
992
+ * the animation window, `"source"` places every keyframe at an absolute
993
+ * `sourceMs` in the media so the motion tracks the footage through speed,
994
+ * in-point and time remap — and a trim or split re-slices the curve instead
995
+ * of stretching it.
996
+ */
997
+ timeBase: z.enum(["clip", "source"]).optional(),
998
+ /** Bounded to `MAX_CUSTOM_CURVES`; see `animationPropertyCurve.keyframes`. */
999
+ curves: z.array(animationPropertyCurve).max(16),
1000
+ /**
1001
+ * Required when a curve drives `wipeProgress`: direction and softness never
1002
+ * animate, so they ride here rather than on a curve.
1003
+ */
1004
+ mask: z.object({ direction: z.string(), softness: z.number() }).optional(),
1005
+ /**
1006
+ * What produced these curves when a hand edit did not — an audio bake, a
1007
+ * tracker. Provenance to re-bake from, never something to execute, so `kind`
1008
+ * is a plain string the way `preset` is.
1009
+ */
1010
+ bakedFrom: z
1011
+ .object({
1012
+ kind: z.string(),
1013
+ clipId: z.string().optional(),
1014
+ assetId: z.string().optional(),
1015
+ settings: z
1016
+ .record(z.string(), z.union([z.number(), z.string(), z.boolean()]))
1017
+ .optional()
1018
+ })
1019
+ .optional()
1020
+ });
1021
+ /**
1022
+ * `POST /api/timelines/animations/bake` — run a custom animation's JS body once
1023
+ * and get back the keyframes to store on the clip. Exactly one of `code` and
1024
+ * `script_id` names the body; the rest is the context the body reads off
1025
+ * `inputs` (see `buildCustomAnimationInputs` in `@nodetool-ai/timeline`).
1026
+ */
1027
+ export const bakeCustomAnimationRequest = z
1028
+ .object({
1029
+ code: z.string().min(1).optional(),
1030
+ script_id: z.string().min(1).optional(),
1031
+ role: z.enum(["in", "out", "emphasis", "loop"]),
1032
+ duration_ms: z.number().positive(),
1033
+ clip_duration_ms: z.number().positive(),
1034
+ canvas: z.object({
1035
+ width: z.number().positive(),
1036
+ height: z.number().positive()
1037
+ }),
1038
+ params: z
1039
+ .record(z.string(), z.union([z.number(), z.string(), z.boolean()]))
1040
+ .optional(),
1041
+ stagger_count: z.number().int().nonnegative().optional(),
1042
+ sample_count: z.number().int().positive().optional()
1043
+ })
1044
+ .refine((body) => (body.code === undefined) !== (body.script_id === undefined), { message: "Pass exactly one of `code` or `script_id`" });
1045
+ export const bakeCustomAnimationResponse = z.object({
1046
+ ok: z.boolean(),
1047
+ /** Present only when `ok`. Store these under the animation's `custom`. */
1048
+ curves: z.array(animationPropertyCurve).optional(),
1049
+ mask: z.object({ direction: z.string(), softness: z.number() }).optional(),
1050
+ logs: z.array(z.string()),
1051
+ error: z.string().optional(),
1052
+ duration_ms: z.number()
1053
+ });
1054
+ /**
1055
+ * One motion-design animation attached to a clip. `preset` and `easing` are
1056
+ * plain strings on the wire by design (forward compat): a document saved by a
1057
+ * newer client may carry ids this build doesn't know — they parse fine and are
1058
+ * skipped at compile time. Validation of preset/role is the engine's job, not
1059
+ * the schema's. Without this field on the clip schema Zod would strip
1060
+ * `animations` on every PATCH, silently losing motion on save.
1061
+ */
1062
+ export const clipAnimation = z.object({
1063
+ id: z.string(),
1064
+ role: z.enum(["in", "out", "emphasis", "loop"]),
1065
+ preset: z.string(),
1066
+ /** A zero or negative window has no frames to fill. (`z.number()` already
1067
+ * refuses NaN and Infinity, so `delayMs` needs no bound of its own —
1068
+ * `packages/execution/tests/timeline-schema-bounds.test.ts` pins that.) */
1069
+ durationMs: z.number().positive(),
1070
+ delayMs: z.number().optional(),
1071
+ beat: z.object({
1072
+ index: z.number().int().min(1),
1073
+ scope: z.enum(["clip", "sequence"]),
1074
+ offsetMs: z.number().optional()
1075
+ }).optional(),
1076
+ easing: z.string().optional(),
1077
+ enabled: z.boolean().optional(),
1078
+ params: z
1079
+ .record(z.string(), z.union([z.number(), z.string(), z.boolean()]))
1080
+ .optional(),
1081
+ /** Baked curves for a `"custom"` preset animation. Without this field Zod
1082
+ * strips it on every PATCH, silently reverting custom motion to nothing on
1083
+ * save. */
1084
+ custom: customClipAnimation.optional(),
1085
+ styleTracks: z.array(z.object({
1086
+ target: z.string().min(1),
1087
+ keyframes: z.array(z.object({
1088
+ t: z.number().min(0).max(1),
1089
+ value: z.union([z.number(), z.string()]),
1090
+ easing: z.string().optional()
1091
+ })).min(2).max(4096)
1092
+ })).max(32).optional(),
1093
+ textAnimator: z.union([
1094
+ z.object({
1095
+ kind: z.literal("ticker"),
1096
+ from: z.number(),
1097
+ to: z.number(),
1098
+ decimals: z.number().int().min(0).max(6).optional(),
1099
+ padTo: z.number().int().min(0).max(32).optional(),
1100
+ groupSeparator: z.string().min(1).max(4).optional(),
1101
+ prefix: z.string().optional(),
1102
+ suffix: z.string().optional()
1103
+ }),
1104
+ z.object({
1105
+ kind: z.literal("scramble"),
1106
+ charset: z.string().min(1).max(128).optional(),
1107
+ seed: z.number().optional()
1108
+ })
1109
+ ]).optional(),
1110
+ /** Per-unit stagger on a text clip's animation. `unit` is a plain string on
1111
+ * the wire (word, character and line are implemented; unknown units compile un-staggered)
1112
+ * for the same forward compat as `preset`. Without this field Zod strips it
1113
+ * on every PATCH, silently flattening staggered titles into block motion. */
1114
+ stagger: z
1115
+ .object({
1116
+ unit: z.string(),
1117
+ offsetMs: z.number(),
1118
+ from: z.enum(["start", "end", "center"]).optional()
1119
+ })
1120
+ .optional(),
1121
+ caret: z.object({
1122
+ color: z.string(),
1123
+ widthPx: z.number().positive(),
1124
+ blinkPeriodMs: z.number().positive()
1125
+ }).optional()
1126
+ });
1127
+ /**
1128
+ * How a shape or a text run is filled. Stop offsets are normalized 0..1, so a
1129
+ * fill is independent of the shape's size.
1130
+ */
1131
+ export const shapeFill = z.discriminatedUnion("type", [
1132
+ z.object({ type: z.literal("solid"), color: z.string() }),
1133
+ z.object({
1134
+ type: z.literal("linear"),
1135
+ angle: z.number(),
1136
+ stops: z.array(z.object({ offset: z.number(), color: z.string() }))
1137
+ }),
1138
+ z.object({
1139
+ type: z.literal("radial"),
1140
+ stops: z.array(z.object({ offset: z.number(), color: z.string() }))
1141
+ })
1142
+ ]);
1143
+ export const clipTextStyle = z.object({
1144
+ text: z.string(),
1145
+ path: z.string().optional(),
1146
+ fontFamily: z.string().optional(),
1147
+ fontSizePx: z.number(),
1148
+ fontWeight: z.number().optional(),
1149
+ color: z.string(),
1150
+ align: z.enum(["left", "center", "right"]).optional(),
1151
+ maxWidthFrac: z.number().optional(),
1152
+ /** Every field below is styling the rasterizer reads. Without them Zod
1153
+ * strips the styling on every PATCH, so a stroked, shadowed or backed title
1154
+ * reverts to plain fill on the next save. */
1155
+ fontStyle: z.string().optional(),
1156
+ letterSpacingPx: z.number().optional(),
1157
+ lineHeight: z.number().optional(),
1158
+ verticalAlign: z.string().optional(),
1159
+ strikethrough: z.boolean().optional(),
1160
+ stroke: z.object({ color: z.string(), widthPx: z.number() }).optional(),
1161
+ shadow: z
1162
+ .object({
1163
+ color: z.string(),
1164
+ blurPx: z.number(),
1165
+ offsetX: z.number(),
1166
+ offsetY: z.number()
1167
+ })
1168
+ .optional(),
1169
+ background: z
1170
+ .object({
1171
+ color: z.string(),
1172
+ paddingPx: z.number(),
1173
+ radiusPx: z.number().optional()
1174
+ })
1175
+ .optional(),
1176
+ fill: shapeFill.optional()
1177
+ });
1178
+ export const clipShapeStyle = z.object({
1179
+ /** A plain string for forward compat (I2): a kind a newer build authored
1180
+ * parses and is skipped at render time — the geometry builder returns no
1181
+ * outline and the validator reports `unknown_shape_kind` — rather than
1182
+ * failing the whole document. */
1183
+ kind: z.string(),
1184
+ fill: z.union([z.string(), shapeFill]).optional(),
1185
+ stroke: z.string().optional(),
1186
+ strokeWidthPx: z.number().optional(),
1187
+ x: z.number().optional(),
1188
+ y: z.number().optional(),
1189
+ width: z.number().optional(),
1190
+ height: z.number().optional(),
1191
+ x2: z.number().optional(),
1192
+ y2: z.number().optional(),
1193
+ /** Every field below is authored geometry. Without them Zod strips the
1194
+ * geometry on every PATCH, so a path, gradient, dash or trim reverts to a
1195
+ * plain filled box on the next save. */
1196
+ d: z.string().optional(),
1197
+ sides: z.number().optional(),
1198
+ innerRadius: z.number().optional(),
1199
+ cornerRadius: z.number().optional(),
1200
+ fillStyle: shapeFill.optional(),
1201
+ dash: z.array(z.number()).optional(),
1202
+ lineCap: z.string().optional(),
1203
+ lineJoin: z.string().optional(),
1204
+ trimStart: z.number().optional(),
1205
+ trimEnd: z.number().optional()
1206
+ });
1207
+ /**
1208
+ * How a `model3d` clip frames its glTF. `orbit` frames the model's bounding
1209
+ * sphere in the vocabulary `nodetool.model3d.RenderToImage`, the Blender bake
1210
+ * and the model editor's pose already share; `scene` uses a camera the glTF
1211
+ * itself declares and ignores the orbit terms.
1212
+ */
1213
+ export const clipModel3DCamera = z.object({
1214
+ mode: z.enum(["orbit", "scene"]),
1215
+ azimuthDeg: z.number(),
1216
+ elevationDeg: z.number(),
1217
+ fovDeg: z.number(),
1218
+ /** Distance multiplier on the auto-framed fit: above 1 moves closer. */
1219
+ zoom: z.number(),
1220
+ /** Look-at offset from the bounding-sphere center, in world units. */
1221
+ targetOffset: z.tuple([z.number(), z.number(), z.number()]).optional(),
1222
+ /** `scene` mode: the glTF camera's name; the first camera when absent. */
1223
+ sceneCameraName: z.string().optional()
1224
+ });
1225
+ /** Which glTF animation a `model3d` clip plays, and how. */
1226
+ export const clipModel3DAnimation = z.object({
1227
+ /** glTF animation name; every animation plays when absent. */
1228
+ clipName: z.string().optional(),
1229
+ loop: z.boolean(),
1230
+ /** Playback multiplier on top of the clip's own speed and time remap. */
1231
+ speed: z.number()
1232
+ });
1233
+ /**
1234
+ * Everything a `model3d` clip adds on top of its glTF asset, which lives in
1235
+ * `currentAssetId` exactly the way an image clip keeps its image. Every field
1236
+ * below has to be listed here or Zod strips it on every PATCH, so a camera
1237
+ * pose, an animation choice or a finished bake would be lost on the next save.
1238
+ */
1239
+ export const clipModel3DStyle = z.object({
1240
+ camera: clipModel3DCamera,
1241
+ animation: clipModel3DAnimation,
1242
+ lighting: z.enum(["studio", "soft", "flat"]),
1243
+ lightIntensity: z.number(),
1244
+ background: z.discriminatedUnion("transparent", [
1245
+ z.object({ transparent: z.literal(true) }),
1246
+ z.object({ transparent: z.literal(false), color: z.string() })
1247
+ ]),
1248
+ /**
1249
+ * A Blender render of this clip at a given style. The scene model plays it
1250
+ * as video while `dependencyHash` matches the live style; a style edit makes
1251
+ * it stale and the live 3D layer draws again.
1252
+ */
1253
+ bake: z.object({ assetId: z.string(), dependencyHash: z.string() }).optional()
1254
+ });
1255
+ /**
1256
+ * The part of the source a clip keeps, as the fraction of each edge dropped.
1257
+ * Mirrors ClipCrop: a crop reframes (the kept rectangle becomes the picture and
1258
+ * is re-fit to the canvas), where `clipMask` with `kind: "rect"` hides part of
1259
+ * a layer that stays put.
1260
+ */
1261
+ export const clipCrop = z.object({
1262
+ left: z.number(),
1263
+ right: z.number(),
1264
+ top: z.number(),
1265
+ bottom: z.number()
1266
+ });
1267
+ /**
1268
+ * Shape mask on one clip, in the layer's own normalized 0..1 space. `kind` is
1269
+ * a plain string for forward compat: an unknown kind parses and is skipped at
1270
+ * render time rather than failing the document.
1271
+ */
1272
+ export const clipMask = z.object({
1273
+ kind: z.string(),
1274
+ x: z.number().optional(),
1275
+ y: z.number().optional(),
1276
+ width: z.number().optional(),
1277
+ height: z.number().optional(),
1278
+ radiusPx: z.number().nonnegative().optional(),
1279
+ d: z.string().optional(),
1280
+ featherPx: z.number().optional(),
1281
+ invert: z.boolean().optional()
1282
+ });
1283
+ /** Track matte: another clip's alpha or luma drives this layer's alpha. */
1284
+ export const clipMatte = z.object({
1285
+ sourceClipId: z.string(),
1286
+ mode: z.string(),
1287
+ invert: z.boolean().optional()
1288
+ });
1289
+ const generatedMatteSettings = z.record(z.string(), z.union([z.number(), z.string(), z.boolean()]));
1290
+ /**
1291
+ * A matte generated from the clip's own source and carried on that clip (D2),
1292
+ * so a trim, a split or a move keeps it aligned with no second clip to sync.
1293
+ * The asset is a luma mask video cut from `sourceAssetId` frame for frame.
1294
+ */
1295
+ export const clipGeneratedMatte = z.object({
1296
+ assetId: z.string(),
1297
+ sourceAssetId: z.string(),
1298
+ sourceRange: z.object({ fromMs: z.number(), toMs: z.number() }),
1299
+ settings: generatedMatteSettings,
1300
+ invert: z.boolean().optional(),
1301
+ strength: z.number().optional(),
1302
+ featherPx: z.number().optional(),
1303
+ versions: z
1304
+ .array(z.object({
1305
+ assetId: z.string(),
1306
+ sourceAssetId: z.string(),
1307
+ createdAt: z.string(),
1308
+ jobId: z.string().optional(),
1309
+ settings: generatedMatteSettings
1310
+ }))
1311
+ .optional(),
1312
+ status: z.enum(["ready", "generating", "failed"]).optional()
1313
+ });
1314
+ /**
1315
+ * One sample of a subject/object track (P0 AI Video, Phase 2), anchored to
1316
+ * the tracked clip's own source clock. Mirrors `MediaTrackSample` in
1317
+ * `@nodetool-ai/timeline`.
1318
+ */
1319
+ export const mediaTrackSample = z.object({
1320
+ sourceMs: z.number(),
1321
+ x: z.number().optional(),
1322
+ y: z.number().optional(),
1323
+ width: z.number().optional(),
1324
+ height: z.number().optional(),
1325
+ rotation: z.number().optional(),
1326
+ quad: z
1327
+ .tuple([
1328
+ z.number(),
1329
+ z.number(),
1330
+ z.number(),
1331
+ z.number(),
1332
+ z.number(),
1333
+ z.number(),
1334
+ z.number(),
1335
+ z.number()
1336
+ ])
1337
+ .optional(),
1338
+ maskAssetId: z.string().optional(),
1339
+ confidence: z.number().optional()
1340
+ });
1341
+ /**
1342
+ * A subject/object track: document-level, `clipId`-owned samples of one
1343
+ * subject moving through one clip's source (P0 AI Video, Phase 2). Mirrors
1344
+ * `MediaTrack` in `@nodetool-ai/timeline`.
1345
+ */
1346
+ export const mediaTrack = z.object({
1347
+ id: z.string(),
1348
+ clipId: z.string(),
1349
+ sourceAssetId: z.string(),
1350
+ name: z.string(),
1351
+ kind: z.enum(["point", "box", "quad", "mask"]),
1352
+ sourceStartMs: z.number(),
1353
+ sourceEndMs: z.number(),
1354
+ samples: z.array(mediaTrackSample),
1355
+ confidence: z.number().optional(),
1356
+ status: z.enum(["ready", "generating", "stale", "failed"]),
1357
+ provenance: z
1358
+ .object({
1359
+ provider: z.string().optional(),
1360
+ model: z.string().optional(),
1361
+ settings: z.record(z.string(), z.unknown()).optional()
1362
+ })
1363
+ .optional()
1364
+ });
1365
+ /**
1366
+ * A clip following a `MediaTrack` (P0 AI Video, Phase 2). Only
1367
+ * `"position"`/`"position_scale"` are live in the scene model today. Smart
1368
+ * Reframe uses `clipReframe` rather than this binding so manual source-time
1369
+ * corrections remain first-class; the other modes stay reserved.
1370
+ */
1371
+ export const trackBinding = z.object({
1372
+ trackId: z.string(),
1373
+ mode: z.enum([
1374
+ "position",
1375
+ "position_scale",
1376
+ "transform",
1377
+ "mask",
1378
+ "effect_region",
1379
+ "reframe"
1380
+ ]),
1381
+ offset: z.object({ x: z.number(), y: z.number() }).optional(),
1382
+ scale: z.number().optional(),
1383
+ rotationOffset: z.number().optional(),
1384
+ smoothing: z.number().optional()
1385
+ });
1386
+ export const reframeSample = z.object({
1387
+ sourceMs: z.number(),
1388
+ x: z.number(),
1389
+ y: z.number(),
1390
+ width: z.number().optional(),
1391
+ height: z.number().optional(),
1392
+ confidence: z.number().optional()
1393
+ });
1394
+ export const reframeKeyframe = z.object({
1395
+ sourceMs: z.number(),
1396
+ x: z.number(),
1397
+ y: z.number(),
1398
+ zoom: z.number().optional()
1399
+ });
1400
+ export const clipReframe = z.object({
1401
+ mode: z.enum(["center", "auto", "track"]),
1402
+ trackId: z.string().optional(),
1403
+ safeMargin: z.number().optional(),
1404
+ smoothing: z.number().optional(),
1405
+ samples: z.array(reframeSample).optional(),
1406
+ keyframes: z.array(reframeKeyframe).optional(),
1407
+ sourceAssetId: z.string().optional(),
1408
+ sourceWidth: z.number().positive().optional(),
1409
+ sourceHeight: z.number().positive().optional()
1410
+ });
1411
+ /**
1412
+ * Retimes a clip's source. `t` is normalized 0..1 over the clip's window and
1413
+ * must ascend; `sourceMs` may descend, which is reverse playback.
1414
+ */
1415
+ export const clipTimeRemap = z.object({
1416
+ keyframes: z.array(z.object({
1417
+ t: z.number(),
1418
+ sourceMs: z.number(),
1419
+ easing: z.string().optional()
1420
+ }))
1421
+ });
1422
+ export const timelineClip = z.object({
1423
+ id: z.string(),
1424
+ trackId: z.string(),
1425
+ name: z.string(),
1426
+ startMs: z.number(),
1427
+ durationMs: z.number(),
1428
+ inPointMs: z.number().optional(),
1429
+ outPointMs: z.number().optional(),
1430
+ /** `"group"` carries no media: it is a transform parent children name with
1431
+ * `parentId`. `"adjustment"` carries none either: its effects treat the
1432
+ * composite of the layers drawn beneath it. Without them here Zod fails a
1433
+ * document containing either. */
1434
+ mediaType: z.enum([
1435
+ "image",
1436
+ "video",
1437
+ "audio",
1438
+ "overlay",
1439
+ "text",
1440
+ "shape",
1441
+ "model3d",
1442
+ "group",
1443
+ "adjustment",
1444
+ "midi"
1445
+ ]),
1446
+ sourceType: z.enum(["imported", "generated"]),
1447
+ bindingKind: clipBindingKind.optional(),
1448
+ workflowId: z.string().optional(),
1449
+ selectedOutputNodeId: z.string().optional(),
1450
+ paramOverrides: z.record(z.string(), z.unknown()).optional(),
1451
+ prompt: z.string().optional(),
1452
+ negativePrompt: z.string().optional(),
1453
+ provider: z.string().optional(),
1454
+ model: z.string().optional(),
1455
+ /** TTS voice id for `text-to-audio` direct-gen clips. */
1456
+ voice: z.string().optional(),
1457
+ sourceClipId: z.string().nullable().optional(),
1458
+ /** Shared id linking a video clip to its auto-extracted audio clip so they
1459
+ * move/trim together. Without this field Zod strips it on every PATCH, so
1460
+ * autosave/reload silently breaks the link. */
1461
+ linkId: z.string().optional(),
1462
+ width: z.number().optional(),
1463
+ height: z.number().optional(),
1464
+ /** Direct-gen target aspect ratio ("16:9") and resolution tier ("720p"),
1465
+ * both written by the direct-gen clip panel. Without these fields Zod strips
1466
+ * them on every PATCH, so a clip re-generates at the provider default rather
1467
+ * than at the size the user picked. */
1468
+ aspectRatio: z.string().optional(),
1469
+ resolution: z.string().optional(),
1470
+ strength: z.number().optional(),
1471
+ numInferenceSteps: z.number().optional(),
1472
+ seed: z.number().optional(),
1473
+ dependencyHash: z.string().optional(),
1474
+ lastGeneratedHash: z.string().optional(),
1475
+ currentAssetId: z.string().optional(),
1476
+ /** Read-only convenience alias for the active take's id (P0 AI Video, PRD
1477
+ * § 8.10). Without this field Zod strips it on every PATCH. */
1478
+ activeTakeId: z.string().optional(),
1479
+ thumbnailAssetId: z.string().optional(),
1480
+ waveformAssetId: z.string().optional(),
1481
+ /** Storyboard provenance (assemble bridge). Without these fields Zod
1482
+ * strips them on every PATCH, breaking shot→clip revision round-trips. */
1483
+ storyboardBoardId: z.string().optional(),
1484
+ storyboardShotId: z.string().optional(),
1485
+ storyboardElementId: z.string().optional(),
1486
+ storyboardElementRole: z.string().optional(),
1487
+ storyboardMaterializationBaseline: z.string().optional(),
1488
+ /** Script provenance (script→timeline assemble bridge). Without these
1489
+ * fields Zod strips them on every PATCH, breaking line→clip re-voice
1490
+ * round-trips. */
1491
+ scriptId: z.string().optional(),
1492
+ scriptLineId: z.string().optional(),
1493
+ /** The `setup.beats` entry this clip was generated from (PRD § 8.5). Without
1494
+ * it the plan behind a finished timeline is unreadable after one save. */
1495
+ beatId: z.string().optional(),
1496
+ status: z.enum([
1497
+ "draft",
1498
+ "queued",
1499
+ "generating",
1500
+ "generated",
1501
+ "stale",
1502
+ "failed",
1503
+ "locked",
1504
+ "missing"
1505
+ ]),
1506
+ locked: z.boolean(),
1507
+ muted: z.boolean().optional(),
1508
+ hidden: z.boolean().optional(),
1509
+ versions: z.array(clipVersion),
1510
+ opacity: z.number().optional(),
1511
+ blendMode: blendModeEnum.optional(),
1512
+ speedMultiplier: z.number().optional(),
1513
+ speedBaked: z.boolean().optional(),
1514
+ volumeDb: z.number().optional(),
1515
+ fadeInMs: z.number().optional(),
1516
+ fadeOutMs: z.number().optional(),
1517
+ fadeInShape: clipFadeShapeEnum.optional(),
1518
+ fadeOutShape: clipFadeShapeEnum.optional(),
1519
+ transform: clipTransform.optional(),
1520
+ layout: clipLayout.optional(),
1521
+ flexItem: clipFlexItem.optional(),
1522
+ repeater: clipRepeater.optional(),
1523
+ motionBlur: z.object({ samplesPerFrame: z.number().int().min(1).max(32), shutterAngle: z.number().min(0).max(360) }).optional(),
1524
+ steppedTime: z.object({ fps: z.number().positive() }).optional(),
1525
+ temporalEcho: z.object({ copies: z.number().int().min(1).max(32), intervalMs: z.number().positive(), opacityDecay: z.number().min(0).max(1) }).optional(),
1526
+ borderRadius: z.number().optional(),
1527
+ /** Without this field Zod strips it on every PATCH and a cropped clip
1528
+ * reverts to its full frame on the next save. */
1529
+ crop: clipCrop.optional(),
1530
+ effects: z.array(clipEffect).optional(),
1531
+ transitionIn: clipTransition.optional(),
1532
+ textStyle: clipTextStyle.optional(),
1533
+ shapeStyle: clipShapeStyle.optional(),
1534
+ /** Camera, animation and look for a `model3d` clip; the glTF itself is the
1535
+ * clip's asset. Without this field Zod strips it on every PATCH, so a posed,
1536
+ * lit and baked 3D clip reverts to nothing on the next save. */
1537
+ model3dStyle: clipModel3DStyle.optional(),
1538
+ /** Word-level caption data; present only on caption clips. Without this
1539
+ * field Zod strips it on every PATCH, so autosave erases captions. */
1540
+ caption: clipCaption.optional(),
1541
+ /** Speaker label for transcript clips. Without this field Zod strips it on
1542
+ * every PATCH, so autosave erases the speaker. */
1543
+ speaker: z.string().optional(),
1544
+ /** Paragraph grouping id for transcript clips. Without this field Zod strips
1545
+ * it on every PATCH, so autosave silently breaks paragraph grouping. */
1546
+ paragraphId: z.string().optional(),
1547
+ /** Motion-design animations. Without this field Zod strips it on every
1548
+ * PATCH, so autosave erases animations. */
1549
+ animations: z.array(clipAnimation).optional(),
1550
+ animationLinks: z.array(z.union([
1551
+ z.object({
1552
+ target: z.enum(["positionX", "positionY", "scale", "rotation", "opacity"]),
1553
+ sourceClipId: z.string(),
1554
+ source: z.enum(["positionX", "positionY", "scale", "rotation", "opacity"]),
1555
+ timeOffsetMs: z.number().optional(),
1556
+ loop: z.boolean().optional(),
1557
+ scale: z.number().optional(),
1558
+ offset: z.number().optional()
1559
+ }),
1560
+ z.object({
1561
+ target: z.enum(["positionX", "positionY", "scale", "rotation", "opacity"]),
1562
+ kind: z.literal("wiggle"),
1563
+ amplitude: z.number(),
1564
+ amplitudeKeyframes: z.array(z.object({ timeMs: z.number().nonnegative(), value: z.number() })).optional(),
1565
+ frequencyHz: z.number().nonnegative(),
1566
+ seed: z.number().optional()
1567
+ })
1568
+ ])).max(32).optional(),
1569
+ /** Group this clip is parented to. Without this field Zod strips it on every
1570
+ * PATCH, so autosave unparents every child of a group. */
1571
+ parentId: z.string().optional(),
1572
+ /** The scene name this group is the root of, on a scene group `v.scene()`
1573
+ * built. Without this field Zod strips it on every PATCH, so a code-backed
1574
+ * timeline's next rebake could no longer tell this scene apart from a hand
1575
+ * edit. */
1576
+ sourceScene: z.string().optional(),
1577
+ /** Shape mask. Without this field Zod strips it on every PATCH, so a masked
1578
+ * layer reverts to its full rectangle on the next save. */
1579
+ mask: clipMask.optional(),
1580
+ /** Track matte. Without this field Zod strips it on every PATCH, so the
1581
+ * matted layer reverts to opaque on the next save. */
1582
+ matte: clipMatte.optional(),
1583
+ /** Matte generated from the clip's own source. Without this field Zod strips
1584
+ * it on every PATCH, so a cut-out subject reverts to its full frame on the
1585
+ * next save and the generation has to be paid for again. */
1586
+ generatedMatte: clipGeneratedMatte.optional(),
1587
+ /** Follows a subject/object track (P0 AI Video, Phase 2). Without this
1588
+ * field Zod strips it on every PATCH, so a text/shape clip following a
1589
+ * tracked subject reverts to static on the next save. */
1590
+ trackBinding: trackBinding.optional(),
1591
+ /** Source-time Smart Reframe state. Without this field Zod strips the
1592
+ * framing path and manual corrections on every PATCH. */
1593
+ reframe: clipReframe.optional(),
1594
+ /** Time remap. Without this field Zod strips it on every PATCH, so a
1595
+ * retimed or reversed clip plays back at its plain rate after one save. */
1596
+ timeRemap: clipTimeRemap.optional(),
1597
+ /** Composition provenance stamped by `insert_composition`. Without these
1598
+ * fields Zod strips them on every PATCH, so an instantiated composition
1599
+ * loses the link to its template and its parameter values. */
1600
+ compositionId: z.string().optional(),
1601
+ compositionParams: z
1602
+ .record(z.string(), z.union([z.number(), z.string(), z.boolean()]))
1603
+ .optional(),
1604
+ /** Notes carried inline by a `midi` clip, in content ticks. Without this
1605
+ * field Zod strips it on every PATCH, so autosave erases the performance. */
1606
+ notes: z.array(midiNote).max(MIDI_MAX_NOTES_PER_CLIP).optional()
1607
+ });
1608
+ // ── Guided setup (PRD § 8.5) ─────────────────────────────────────────────────
1609
+ /**
1610
+ * Where a sequence sits in the guided video flow. A sequence built before the
1611
+ * flow existed carries no `setup` at all and opens straight in the editor, so
1612
+ * there is no `"done"` default to write anywhere — absence is the signal.
1613
+ */
1614
+ export const timelineSetupStage = z.enum([
1615
+ "idea",
1616
+ "format",
1617
+ "review",
1618
+ "look",
1619
+ "done"
1620
+ ]);
1621
+ /**
1622
+ * One beat of the plan: the cheap, editable text the creator reviews before
1623
+ * anything is spent (D4). `clip_id` is written at generate time, which is what
1624
+ * lets the finished timeline be read back as the plan that produced it.
1625
+ */
1626
+ export const timelineBeat = z
1627
+ .object({
1628
+ id: z.string(),
1629
+ prompt: z.string(),
1630
+ duration_ms: z.number(),
1631
+ /** How this beat opens against the one before it, e.g. "crossfade". */
1632
+ transition: z.string().optional(),
1633
+ /** The line spoken over this beat. Absent or empty means no voiceover. */
1634
+ voiceover: z.string().optional(),
1635
+ music: z.boolean().optional(),
1636
+ clip_id: z.string().optional(),
1637
+ /** Imported source footage this beat edits instead of replacing. */
1638
+ source_clip_id: z.string().optional(),
1639
+ /** Optional production requirements reviewed before generation. */
1640
+ production: productionRequirement.optional()
1641
+ })
1642
+ .passthrough();
1643
+ /**
1644
+ * The flow's state, on the document the flow produces (D19). Loose, like the
1645
+ * beat: the field travels through the editor, autosave and version history
1646
+ * untouched, so a client that knows more about it than this schema does keeps
1647
+ * what it wrote.
1648
+ */
1649
+ export const timelineSetup = z
1650
+ .object({
1651
+ stage: timelineSetupStage,
1652
+ brief: z.string(),
1653
+ /** The format card's id, e.g. "social-9x16". */
1654
+ format: z.string().optional(),
1655
+ /**
1656
+ * Whether the cut gets a voiceover. Absent means the creator has not said,
1657
+ * so the beats' own lines decide. `false` is a deliberate "no voiceover",
1658
+ * which the lines cannot express: reading it off them would make silence
1659
+ * indistinguishable from an unwritten line, and writing it by clearing
1660
+ * them would throw the creator's words away (PRD § 8.3).
1661
+ */
1662
+ voiceover: z.boolean().optional(),
1663
+ /** Optional shared product, audience, and reference context. */
1664
+ creative_context: creativeContext.optional(),
1665
+ /** Fingerprint of the reviewed production requirements. */
1666
+ production_review_fingerprint: z.string().optional(),
1667
+ /** Model and voice intent owned by this draft, seeded from preferences once. */
1668
+ generation_settings: z
1669
+ .object({
1670
+ video: z.object({ provider: z.string(), model: z.string() }).optional(),
1671
+ voice: z
1672
+ .object({
1673
+ provider: z.string(),
1674
+ model: z.string(),
1675
+ voice: z.string()
1676
+ })
1677
+ .optional()
1678
+ })
1679
+ .optional(),
1680
+ /** Durable destinations and request identities saved before paid dispatch. */
1681
+ prepared_generation: z
1682
+ .object({
1683
+ batch_id: z.string(),
1684
+ /** Immutable generation inputs this batch was prepared from. */
1685
+ fingerprint: z.string(),
1686
+ status: z.enum(["unsubmitted", "prepared", "submitted"]),
1687
+ requests: z.array(z.object({
1688
+ clip_id: z.string(),
1689
+ request_id: z.string(),
1690
+ kind: z.enum(["video", "voiceover", "music"]),
1691
+ beat_id: z.string().optional(),
1692
+ variation_index: z.number().int().positive().optional()
1693
+ }))
1694
+ })
1695
+ .optional(),
1696
+ beats: z.array(timelineBeat).optional(),
1697
+ /**
1698
+ * The language model that drafts the beats. Absent means the flow picks
1699
+ * one: the curated NodeTool director when this server can serve it, and
1700
+ * otherwise the first model a configured provider reports. Stored so the
1701
+ * creator's pick survives a reload and so a re-plan runs on the same
1702
+ * model the estimate was shown for.
1703
+ */
1704
+ directorModel: z
1705
+ .object({
1706
+ id: z.string(),
1707
+ provider: z.string(),
1708
+ name: z.string().optional()
1709
+ })
1710
+ .optional()
1711
+ })
1712
+ .passthrough();
1713
+ /**
1714
+ * A timeline's authoring code and the scene hashes its last bake recorded.
1715
+ * See `TimelineSource` in `@nodetool-ai/timeline`.
1716
+ */
1717
+ export const timelineSource = z.object({
1718
+ lang: z.literal("js"),
1719
+ code: z.string(),
1720
+ bakedAt: z.string(),
1721
+ scenes: z.record(z.string(), z.object({ groupId: z.string(), hash: z.string() }))
1722
+ });
1723
+ export const timelineDocument = z.object({
1724
+ tracks: z.array(timelineTrack),
1725
+ trackFolders: z.array(timelineTrackFolder).optional(),
1726
+ clips: z.array(timelineClip),
1727
+ markers: z.array(timelineMarker),
1728
+ storyboardMaterializations: z.array(z.object({ boardId: z.string(), elementKeys: z.array(z.string()), stage: z.enum(["layout", "finished"]).optional() })).optional(),
1729
+ transcript: z.array(transcriptLine).optional(),
1730
+ scriptEnabled: z.boolean().optional(),
1731
+ /** Constant tempo the midi clips are read against. Without this field Zod
1732
+ * strips it on every PATCH, so the document falls back to 120 BPM and every
1733
+ * midi clip plays at the wrong speed after one save. */
1734
+ tempo: timelineTempo.optional(),
1735
+ /** Guided-setup state. Absent on every sequence not built through the flow. */
1736
+ setup: timelineSetup.optional(),
1737
+ /** Sequence this one was retargeted from. Without this field Zod strips it
1738
+ * on every PATCH and the lineage is lost on the first save. */
1739
+ templateId: z.string().nullable().optional(),
1740
+ /** The authoring code this timeline was baked from, and the scene hashes
1741
+ * the last bake recorded. Without this field Zod strips it on every PATCH,
1742
+ * so an editor save between bakes would silently detach the code. */
1743
+ source: timelineSource.nullable().optional(),
1744
+ /** Subject/object tracks (P0 AI Video, Phase 2). Without this field Zod
1745
+ * strips it on every PATCH, so a track and every clip following it are
1746
+ * lost on the next save. */
1747
+ mediaTracks: z.array(mediaTrack).optional(),
1748
+ camera2d: timelineCamera2d.nullable().optional()
1749
+ });
1750
+ /** Read-only bundle shipped in the example timeline catalog. */
1751
+ export const exampleTimelineBundle = z.object({
1752
+ name: z.string().min(1),
1753
+ description: z.string().min(1),
1754
+ fps: z.number().int().positive(),
1755
+ width: z.number().int().positive(),
1756
+ height: z.number().int().positive(),
1757
+ durationMs: z.number().int().positive(),
1758
+ videoUri: z.string(),
1759
+ posterUri: z.string(),
1760
+ document: timelineDocument
1761
+ });
1762
+ export const exampleTimelineSummary = z.object({
1763
+ slug: z.string(),
1764
+ name: z.string(),
1765
+ description: z.string(),
1766
+ durationMs: z.number().int().positive(),
1767
+ fps: z.number().int().positive(),
1768
+ clipCount: z.number().int().nonnegative(),
1769
+ videoUri: z.string(),
1770
+ posterUri: z.string()
1771
+ });
1772
+ export const installExampleTimelineInput = z.object({
1773
+ slug: z.string(),
1774
+ projectId: z.string().min(1).optional(),
1775
+ name: z.string().min(1).optional()
1776
+ });
1777
+ // ── Sequence response ────────────────────────────────────────────────────────
1778
+ export const timelineSequenceResponse = z.object({
1779
+ id: z.string(),
1780
+ projectId: z.string(),
1781
+ workflowId: z.string().optional(),
1782
+ name: z.string(),
1783
+ fps: z.number(),
1784
+ width: z.number(),
1785
+ height: z.number(),
1786
+ durationMs: z.number(),
1787
+ tracks: z.array(timelineTrack),
1788
+ trackFolders: z.array(timelineTrackFolder).optional(),
1789
+ clips: z.array(timelineClip),
1790
+ markers: z.array(timelineMarker),
1791
+ storyboardMaterializations: z.array(z.object({ boardId: z.string(), elementKeys: z.array(z.string()), stage: z.enum(["layout", "finished"]).optional() })).optional(),
1792
+ transcript: z.array(transcriptLine).optional(),
1793
+ scriptEnabled: z.boolean().optional(),
1794
+ /** Constant tempo, mirroring the document's. Without this field Zod strips
1795
+ * it from every read, so the editor loads a tempo-less sequence. */
1796
+ tempo: timelineTempo.optional(),
1797
+ setup: timelineSetup.optional(),
1798
+ /** Sequence this one was retargeted from, mirroring the document's. */
1799
+ templateId: z.string().nullable().optional(),
1800
+ /** The authoring code this timeline was baked from, mirroring the document's. */
1801
+ source: timelineSource.nullable().optional(),
1802
+ /** Subject/object tracks, mirroring the document's. */
1803
+ mediaTracks: z.array(mediaTrack).optional(),
1804
+ camera2d: timelineCamera2d.nullable().optional(),
1805
+ createdAt: z.string(),
1806
+ updatedAt: z.string()
1807
+ });
1808
+ // Minimal list item (id, name, updatedAt only)
1809
+ export const timelineSequenceListItem = z.object({
1810
+ id: z.string(),
1811
+ projectId: z.string(),
1812
+ name: z.string(),
1813
+ updatedAt: z.string()
1814
+ });
1815
+ // ── create (POST /api/timeline) ──────────────────────────────────────────────
1816
+ export const createTimelineInput = z.object({
1817
+ /**
1818
+ * Client-supplied id. The caller mints it so the sequence is addressable
1819
+ * (agent tools, tab refs) before the create round-trip returns, and so a
1820
+ * retried create is idempotent rather than duplicating the sequence.
1821
+ */
1822
+ id: z.string().optional(),
1823
+ name: z.string().min(1),
1824
+ projectId: z.string().min(1),
1825
+ fps: z.number().int().min(1).optional().default(30),
1826
+ width: z.number().int().min(1).optional().default(1920),
1827
+ height: z.number().int().min(1).optional().default(1080)
1828
+ });
1829
+ // ── patch (PATCH /api/timeline/:id) ─────────────────────────────────────────
1830
+ export const patchTimelineInput = z
1831
+ .object({
1832
+ name: z.string().min(1).optional(),
1833
+ fps: z.number().int().min(1).optional(),
1834
+ width: z.number().int().min(1).optional(),
1835
+ height: z.number().int().min(1).optional(),
1836
+ durationMs: z.number().int().nonnegative().optional(),
1837
+ document: timelineDocument.optional()
1838
+ })
1839
+ .refine((v) => Object.keys(v).length > 0, {
1840
+ message: "at least one field is required"
1841
+ });
1842
+ // ── append clip version (POST /api/timeline/:id/clips/:clipId/versions) ──────
1843
+ export const appendClipVersionInput = z.object({
1844
+ ...productionTakeMetadata.shape,
1845
+ jobId: z.string(),
1846
+ assetId: z.string(),
1847
+ dependencyHash: z.string(),
1848
+ workflowUpdatedAt: z.string(),
1849
+ paramOverridesSnapshot: z.record(z.string(), z.unknown()).optional(),
1850
+ costCredits: z.number().optional(),
1851
+ durationMs: z.number().optional(),
1852
+ status: z
1853
+ .enum(["success", "failed", "cancelled"])
1854
+ .optional()
1855
+ .default("success")
1856
+ });
1857
+ // ── create clip (POST /api/timeline/:id/clips) ────────────────────────────────
1858
+ export const createClipInput = z.object({
1859
+ /** Timeline sequence that will own the clip. */
1860
+ id: z.string(),
1861
+ trackId: z.string(),
1862
+ startMs: z.number().int().min(0),
1863
+ /** The source workflow the clip will run. The clip references it directly; no clone is created. */
1864
+ sourceWorkflowId: z.string(),
1865
+ /**
1866
+ * Override which terminal node's output becomes the clip's media.
1867
+ * Required when the source workflow has multiple terminal output nodes;
1868
+ * optional (server auto-picks) when there is exactly one.
1869
+ */
1870
+ selectedOutputNodeId: z.string().optional(),
1871
+ /** If placed on an overlay track, pass `"overlay"` to override mediaType. */
1872
+ mediaTypeOverride: z.enum(["overlay"]).optional()
1873
+ });
1874
+ /** Response shape returned by `timeline.clips.create`. */
1875
+ export const timelineClipResponse = timelineClip;
1876
+ // ── sequence version history (/api/timeline/:id/versions) ────────────────────
1877
+ /**
1878
+ * How a snapshot came to exist. `restore` marks the snapshot taken of the
1879
+ * *pre-restore* state, so restoring is itself undoable.
1880
+ */
1881
+ export const timelineVersionSaveType = z.enum([
1882
+ "manual",
1883
+ "autosave",
1884
+ "restore"
1885
+ ]);
1886
+ /**
1887
+ * Metadata for one snapshot. Deliberately carries no `document`: a timeline
1888
+ * document is large, and the history list renders from metadata alone.
1889
+ */
1890
+ export const timelineVersionListItem = z.object({
1891
+ id: z.string(),
1892
+ timelineId: z.string(),
1893
+ version: z.number().int(),
1894
+ name: z.string().nullable().optional(),
1895
+ saveType: timelineVersionSaveType,
1896
+ fps: z.number(),
1897
+ width: z.number(),
1898
+ height: z.number(),
1899
+ durationMs: z.number(),
1900
+ createdAt: z.string()
1901
+ });
1902
+ /** One snapshot including the document it captured. */
1903
+ export const timelineVersionResponse = timelineVersionListItem.extend({
1904
+ document: timelineDocument
1905
+ });
1906
+ export const listTimelineVersionsInput = z.object({
1907
+ /** Timeline sequence whose history is read. */
1908
+ id: z.string(),
1909
+ limit: z.number().int().positive().max(500).optional(),
1910
+ saveType: timelineVersionSaveType.optional()
1911
+ });
1912
+ export const getTimelineVersionInput = z.object({
1913
+ id: z.string(),
1914
+ version: z.number().int()
1915
+ });
1916
+ export const createTimelineVersionInput = z.object({
1917
+ id: z.string(),
1918
+ name: z.string().max(200).optional()
1919
+ });
1920
+ export const restoreTimelineVersionInput = z.object({
1921
+ id: z.string(),
1922
+ version: z.number().int()
1923
+ });
1924
+ export const deleteTimelineVersionInput = z.object({
1925
+ id: z.string(),
1926
+ version: z.number().int()
1927
+ });
1928
+ //# sourceMappingURL=timeline.js.map