@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,1529 @@
1
+ /**
2
+ * Parameter schemas for the timeline agent tools, shared by every surface that
3
+ * exposes them.
4
+ *
5
+ * Three hosts drive the same `ui_timeline_*` contract: the headless bridge in
6
+ * `packages/agents/src/evals/surfaces/timeline.ts` (which `edit_timeline`
7
+ * dispatches its ops to), the browser tools in
8
+ * `web/src/lib/tools/builtin/timeline.ts`, and the live editor's handler.
9
+ * Invariant I11 says they share one implementation; the field lists below are
10
+ * the half a copy-paste twin gets wrong. `textStyle`, `shapeStyle` and
11
+ * `captionStyle` were each written out three times and each copy fell behind
12
+ * the renderer — a stroked title or a dashed path was expressible in the
13
+ * document and unreachable from a tool call.
14
+ *
15
+ * So the style bags are the document schemas themselves: what a tool accepts
16
+ * is exactly what a save stores (I1), and a field added to `timeline.ts` is
17
+ * reachable from every surface the same day. The flat bags — a transition, a
18
+ * mask, an effect — cannot be the document schema, because a tool call sends
19
+ * one object rather than a union member; those enumerate their types from the
20
+ * document schema's own lists and narrow through the `build*` helpers here, so
21
+ * a field the named type does not read is never stored to be stripped later.
22
+ */
23
+ import { z } from "zod";
24
+ import { isRecord, isString } from "../predicates.js";
25
+ import { withKeyRemedies } from "../zod-schema.js";
26
+ import { captionStyle, clipModel3DAnimation, clipModel3DCamera, clipModel3DStyle, clipShapeStyle, clipTextStyle, midiInstrument, samplerMidiInstrument, samplerZone, KNOWN_CLIP_EFFECT_TYPE_LIST, KNOWN_TRANSITION_TYPE_LIST, MIDI_MAX_NOTES_PER_CLIP } from "./timeline.js";
27
+ /** How every clip-addressing tool names its target. */
28
+ export const targetParam = z
29
+ .string()
30
+ .describe('Clip id, clip name (case-insensitive), or the literal "selected" for the currently-selected clip.');
31
+ /** Explicit target and prompt for the nondestructive video-edit operation. */
32
+ const requireProviderModelPair = (value, ctx) => {
33
+ if ((value.provider === undefined) !== (value.model === undefined)) {
34
+ ctx.addIssue({
35
+ code: z.ZodIssueCode.custom,
36
+ path: [value.provider === undefined ? "provider" : "model"],
37
+ message: "provider and model must be provided together"
38
+ });
39
+ }
40
+ };
41
+ export const generativelyEditClipParams = z
42
+ .object({
43
+ clip_id: z.string().trim().min(1),
44
+ instruction: z.string().trim().min(1),
45
+ provider: z.string().trim().min(1).optional(),
46
+ model: z.string().trim().min(1).optional()
47
+ })
48
+ .strict()
49
+ .superRefine(requireProviderModelPair);
50
+ /** Apply the edit contract's cross-field validation to a host-specific shape. */
51
+ export const strictGenerativelyEditClipParams = (schema) => schema.strict().superRefine(requireProviderModelPair);
52
+ /** Select a completed candidate take without changing other clip fields. */
53
+ export const applyTakeParams = z
54
+ .object({
55
+ clip_id: z.string().trim().min(1),
56
+ take_id: z.string().trim().min(1)
57
+ })
58
+ .strict();
59
+ /** How the track-addressing tools name their target. */
60
+ export const trackTargetParam = z
61
+ .string()
62
+ .describe("Track id or track name (case-insensitive).");
63
+ /**
64
+ * `add_track` and `move_track`. Track order *is* z-order — the first track
65
+ * (index 0) draws on top — and a track is created at the bottom of the stack,
66
+ * so a picture track added last covers every overlay added before it. Before
67
+ * `move_track` existed the only remedy was to author the tracks in reverse and
68
+ * hope; the description says so on both tools, because the trap is sprung at
69
+ * `add_track` and only visible at render.
70
+ */
71
+ export const ADD_TRACK_DESCRIPTION = "Add a new track to the specified timeline sequence. `type` is one of " +
72
+ "video, audio, overlay, subtitle, midi. Optionally provide a name. The new " +
73
+ "track goes to the BOTTOM of the stack, and track order is z-order: index 0 " +
74
+ "draws on top, so a track added later renders *under* the ones already " +
75
+ "there. Add overlays and titles after the picture track they sit on, or " +
76
+ "reorder afterwards with move_track.";
77
+ /**
78
+ * Clip opacity on the ops that author a clip.
79
+ *
80
+ * A scrim can be authored two ways — an alpha fill (`#05070CCC`) or a
81
+ * translucent clip — and only the second is what `opacity` means everywhere
82
+ * else, so an `opacity` sent to `add_shape_clip` used to be refused as an
83
+ * unknown key and cost a `set_clip_params` round trip to apply.
84
+ */
85
+ export const clipOpacityParam = z
86
+ .number()
87
+ .min(0)
88
+ .max(1)
89
+ .optional()
90
+ .describe("Clip opacity, 0..1. Defaults to 1.");
91
+ /** Static placement, merged over the clip's current transform. */
92
+ export const clipTransformPatchParam = z
93
+ .object({
94
+ position: z
95
+ .object({ x: z.number().optional(), y: z.number().optional() })
96
+ .optional(),
97
+ scale: z
98
+ .object({ x: z.number().optional(), y: z.number().optional() })
99
+ .optional(),
100
+ rotation: z.number().optional(),
101
+ rotationX: z.number().optional(),
102
+ rotationY: z.number().optional(),
103
+ perspective: z.number().positive().optional(),
104
+ anchor: z
105
+ .object({ x: z.number().optional(), y: z.number().optional() })
106
+ .optional()
107
+ })
108
+ .optional();
109
+ /**
110
+ * `move_track`'s arguments, in either spelling.
111
+ *
112
+ * The op names the track in `target` and its destination in `toIndex`, but a
113
+ * caller reaching for it after `add_media_clip` (which takes `trackId`) sends
114
+ * `{trackId, index}` — refused by name, one round trip spent on each. Both are
115
+ * the same call, so both are accepted.
116
+ */
117
+ export const moveTrackShape = {
118
+ target: trackTargetParam.optional(),
119
+ trackId: trackTargetParam.optional().describe("Alias for `target`."),
120
+ toIndex: z
121
+ .number()
122
+ .int()
123
+ .optional()
124
+ .describe("Destination index; 0 is the top of the stack."),
125
+ index: z.number().int().optional().describe("Alias for `toIndex`."),
126
+ before: z.string().optional(),
127
+ after: z.string().optional()
128
+ };
129
+ /**
130
+ * Normalize either spelling, or say what the call is missing. A destination is
131
+ * required: a `move_track` with none named nothing to do and used to reorder
132
+ * to index 0 by accident.
133
+ */
134
+ export function resolveMoveTrackArgs(input) {
135
+ const target = (input.target ?? input.trackId);
136
+ if (!isString(target) || target.trim() === "") {
137
+ throw new Error("move_track needs the track to move in `target` (a track id or name).");
138
+ }
139
+ const toIndex = (input.toIndex ?? input.index);
140
+ const before = input.before;
141
+ const after = input.after;
142
+ if (toIndex === undefined && before === undefined && after === undefined) {
143
+ throw new Error(`move_track needs a destination for "${target}": one of \`toIndex\` ` +
144
+ "(0 is the top of the stack), `before` or `after` (a track name or id).");
145
+ }
146
+ const args = { target };
147
+ if (toIndex !== undefined)
148
+ args.toIndex = toIndex;
149
+ if (before !== undefined)
150
+ args.before = before;
151
+ if (after !== undefined)
152
+ args.after = after;
153
+ return args;
154
+ }
155
+ /**
156
+ * `delete_track`'s arguments.
157
+ *
158
+ * Tracks were add-only: a build that reached for `add_track` one time too many
159
+ * — or created a picture track and then decided the piece was typographic —
160
+ * had no way back, and the op list said so only by omission. The editor's own
161
+ * track menu has removed a track and its clips all along, so the gap was the
162
+ * agent surface's alone.
163
+ *
164
+ * Deleting a track deletes the clips on it, which is the one thing about this
165
+ * op that can lose work, so an occupied track is refused unless the caller
166
+ * says `deleteClips: true`.
167
+ */
168
+ export const deleteTrackShape = {
169
+ target: trackTargetParam.optional(),
170
+ trackId: trackTargetParam.optional().describe("Alias for `target`."),
171
+ deleteClips: z
172
+ .boolean()
173
+ .optional()
174
+ .describe("Required to delete a track that still holds clips; they go with it.")
175
+ };
176
+ export function resolveDeleteTrackArgs(input) {
177
+ const target = (input.target ?? input.trackId);
178
+ if (!isString(target) || target.trim() === "") {
179
+ throw new Error("delete_track needs the track to delete in `target` (a track id or name).");
180
+ }
181
+ return { target, deleteClips: input.deleteClips === true };
182
+ }
183
+ export const DELETE_TRACK_DESCRIPTION = "Remove one track from the specified timeline sequence, named in `target` " +
184
+ "(a track id or name). Every track below it moves up one index, which is " +
185
+ "z-order, so the stack closes over the gap. A track that still holds clips " +
186
+ "is refused unless you pass `deleteClips: true` — then the clips go with " +
187
+ "it. An empty track draws nothing, so delete one to tidy the stack, not to " +
188
+ "fix a render.";
189
+ export const MOVE_TRACK_DESCRIPTION = "Reorder one track in the stack, which is what decides z-order: index 0 " +
190
+ "draws on top of every track below it. Name the track in `target` and its " +
191
+ "destination with exactly one of `toIndex` (0 is the top), `before` (a " +
192
+ "track it should draw in front of) or `after`. Clips do not move — only " +
193
+ "which track covers which. Use it when a picture track added last is " +
194
+ "hiding the overlays beneath it.";
195
+ // ── Style bags ──────────────────────────────────────────────────────────────
196
+ /**
197
+ * Attach one-line notes to a document schema's fields for the model reading the
198
+ * tool. A note naming a field the schema does not have throws at import, so a
199
+ * note cannot outlive the field it describes — which is the same drift this
200
+ * module exists to stop, one level down.
201
+ */
202
+ export function withFieldNotes(schema, notes) {
203
+ // Safety: a `ZodObject<T>`'s shape is `T`, whose values are schemas; through
204
+ // the generic parameter TypeScript only sees the core constraint, which
205
+ // carries no `describe`.
206
+ const shape = schema.shape;
207
+ const next = { ...shape };
208
+ for (const [field, note] of Object.entries(notes)) {
209
+ if (!(field in shape) || note === undefined) {
210
+ throw new Error(`timeline tool params: no field "${field}" to describe (have: ${Object.keys(shape).join(", ")}).`);
211
+ }
212
+ next[field] = next[field].describe(note);
213
+ }
214
+ // Safety: every entry of `next` is the schema's own field with a description
215
+ // attached — `describe` returns the same type it was called on — so the
216
+ // rebuilt object has `T`'s shape. TypeScript loses that through the
217
+ // string-keyed record the loop needs.
218
+ return z.object(next);
219
+ }
220
+ /**
221
+ * The nested bags of a text clip's look, refusing a key by name.
222
+ *
223
+ * The document schema strips what it does not know, which is right for a
224
+ * stored document and wrong for a tool call: `background: {color, paddingPx,
225
+ * cornerRadius: 40}` saved a square plate and reported success, because the
226
+ * field is spelled `radiusPx`. The top level has refused unknown keys since
227
+ * strict schemas went in; these are the same refusal one level down, where
228
+ * three of the four fields are named after a CSS property that is spelled
229
+ * differently here.
230
+ *
231
+ * The offsets default rather than being required: `{color, blurPx}` is a
232
+ * complete description of a centred drop shadow, and demanding `offsetX: 0`
233
+ * cost a round trip on a call that was already right.
234
+ */
235
+ const textShadowParams = z
236
+ .object({
237
+ color: z.string().default("#000000"),
238
+ blurPx: z.number().default(0),
239
+ offsetX: z.number().default(0).describe("Default 0."),
240
+ offsetY: z.number().default(0).describe("Default 0.")
241
+ })
242
+ .strict();
243
+ const textStrokeParams = z
244
+ .object({ color: z.string(), widthPx: z.number() })
245
+ .strict();
246
+ const textBackgroundParams = z
247
+ .object({
248
+ color: z.string(),
249
+ paddingPx: z.number(),
250
+ radiusPx: z.number().optional().describe("Corner rounding, in sequence px.")
251
+ })
252
+ .strict();
253
+ /**
254
+ * CSS weight keywords, as the number the rasterizer draws with.
255
+ *
256
+ * `fontWeight` is a number on the document because that is what a canvas font
257
+ * shorthand takes, but every caller writes CSS, and `"bold"` came back as a
258
+ * Zod type error on a title that was otherwise complete. The keywords are
259
+ * unambiguous, so translating them costs nothing; a weight that is neither a
260
+ * number nor a keyword is still refused.
261
+ */
262
+ const FONT_WEIGHT_KEYWORDS = {
263
+ thin: 100,
264
+ hairline: 100,
265
+ extralight: 200,
266
+ ultralight: 200,
267
+ light: 300,
268
+ normal: 400,
269
+ regular: 400,
270
+ book: 400,
271
+ medium: 500,
272
+ semibold: 600,
273
+ demibold: 600,
274
+ bold: 700,
275
+ extrabold: 800,
276
+ ultrabold: 800,
277
+ black: 900,
278
+ heavy: 900
279
+ };
280
+ /** A weight written as a word (or a quoted number), as its number. */
281
+ const writtenFontWeight = z
282
+ .string()
283
+ .transform((raw) => raw
284
+ .trim()
285
+ .toLowerCase()
286
+ .replace(/[\s_-]/g, ""))
287
+ .refine((key) => FONT_WEIGHT_KEYWORDS[key] !== undefined || isFiniteWeight(key), {
288
+ message: `not a weight — use a number, or one of: ${Object.keys(FONT_WEIGHT_KEYWORDS).join(", ")}`
289
+ })
290
+ .transform((key) => FONT_WEIGHT_KEYWORDS[key] ?? Number(key));
291
+ const isFiniteWeight = (key) => key !== "" && Number.isFinite(Number(key));
292
+ /** `fontWeight`, accepting the CSS keyword spellings as well as the number. */
293
+ export const fontWeightParam = z
294
+ .union([z.number(), writtenFontWeight])
295
+ .describe("Numeric weight (400 regular, 600 semibold, 800 extrabold). The CSS " +
296
+ 'keywords ("bold", "semibold", …) are accepted and stored as their number.');
297
+ /** A text clip's whole authored look, as `set_clip_params` replaces it. */
298
+ export const textStyleParams = withFieldNotes(clipTextStyle, {
299
+ fontSizePx: "Font size in sequence pixels, not CSS pixels.",
300
+ fontStyle: '"normal" (default) or "italic".',
301
+ letterSpacingPx: "Extra advance between glyphs, in sequence px. Default 0.",
302
+ lineHeight: "Line advance as a multiple of the font size. Default 1.2.",
303
+ maxWidthFrac: "Wrap width as a fraction of frame width.",
304
+ strikethrough: "Draw a line through the text in its fill colour, as on a superseded price.",
305
+ fill: 'Gradient or solid fill, {type: "solid"|"linear"|"radial", ...}. ' +
306
+ "Wins over `color` when set."
307
+ }).extend({
308
+ /**
309
+ * Refused by name here, lenient in the document.
310
+ *
311
+ * `clipTextStyle.verticalAlign` is a free string and the rasterizer reads
312
+ * anything it does not know as `"middle"` — deliberate, so a stored document
313
+ * always draws. But the horizontal `align` right beside it *does* take
314
+ * `"center"`, so `"center"` is the value a caller reaches for vertically,
315
+ * and the lenient read then made it a silent no-op: the title stayed exactly
316
+ * where it was and nothing said why. Two text clips both left at the default
317
+ * stack on top of each other, which is the failure this refusal exists to
318
+ * name.
319
+ *
320
+ * Only the authoring surface is strict. Widening the document schema would
321
+ * make an already-saved sequence carrying `"center"` fail to save.
322
+ */
323
+ fontWeight: fontWeightParam.optional(),
324
+ verticalAlign: z
325
+ .enum(["top", "middle", "bottom"])
326
+ .optional()
327
+ .describe('"top", "middle" (default) or "bottom". Not "center" — that is the ' +
328
+ "horizontal `align` spelling."),
329
+ shadow: textShadowParams
330
+ .optional()
331
+ .describe("Drop shadow behind the glyphs: {color, blurPx, offsetX?, offsetY?}. " +
332
+ "The blur field is `blurPx`, not `blur`; the offsets default to 0."),
333
+ stroke: textStrokeParams
334
+ .optional()
335
+ .describe("Outline drawn under the fill: {color, widthPx}."),
336
+ background: textBackgroundParams
337
+ .optional()
338
+ .describe("Scrim drawn behind the wrapped block: {color, paddingPx, radiusPx?}. " +
339
+ "The rounding field is `radiusPx`, not `cornerRadius`. An 8-digit " +
340
+ "hex or rgba() colour keeps the picture visible through it.")
341
+ });
342
+ /**
343
+ * Where a text clip is placed, for a caller that reached for x/y.
344
+ *
345
+ * Text has no coordinates: it is anchored to one of nine positions and wrapped
346
+ * to `maxWidthFrac`. The refusal listed thirteen style fields and no
347
+ * coordinates, which reads as "text cannot be positioned" rather than "text is
348
+ * positioned differently".
349
+ */
350
+ export const TEXT_CLIP_KEY_REMEDIES = {
351
+ x: "Text has no x/y: place it with `align` (left/center/right) and `verticalAlign` (top/middle/bottom), and set its wrap with `maxWidthFrac`. For a nudge off that anchor, animate `offsetX`/`offsetY` with the `custom` preset.",
352
+ y: "Text has no x/y: place it with `align` (left/center/right) and `verticalAlign` (top/middle/bottom), and set its wrap with `maxWidthFrac`. For a nudge off that anchor, animate `offsetX`/`offsetY` with the `custom` preset.",
353
+ width: "A text clip has no box: its wrap width is `maxWidthFrac`, a fraction of the frame.",
354
+ height: "A text clip has no box: its height follows the wrapped lines. Set `fontSizePx` and `lineHeight`.",
355
+ fontSize: "Font size is `fontSizePx`, in sequence pixels.",
356
+ blur: "Blur belongs to the shadow bag: {shadow: {color, blurPx}}.",
357
+ cornerRadius: "The plate behind the words is `background: {color, paddingPx, radiusPx}`."
358
+ };
359
+ /** Attach {@link TEXT_CLIP_KEY_REMEDIES} to a host's `add_text_clip` schema. */
360
+ export function withTextClipRemedies(schema) {
361
+ return withKeyRemedies(schema, TEXT_CLIP_KEY_REMEDIES);
362
+ }
363
+ /**
364
+ * The same look on `add_text_clip`, where the words come from `text` and every
365
+ * remaining field falls back to a drawing default.
366
+ */
367
+ export const partialTextStyleParams = textStyleParams
368
+ .omit({ text: true })
369
+ .partial();
370
+ /**
371
+ * The look as `set_clip_params` takes it: every field optional, merged over
372
+ * what the clip already carries.
373
+ *
374
+ * Changing one field used to mean re-sending the whole style, because
375
+ * `textStyleParams` requires `text`, `fontSizePx` and `color` — so
376
+ * `{textStyle: {fontFamily: "Space Grotesk"}}` on a finished title failed
377
+ * validation, and re-sending the whole object to get past it is how a caller
378
+ * overwrites the four fields it did not mean to touch. The op merges instead,
379
+ * and a clip with no text style yet still needs the three required fields
380
+ * before it draws anything.
381
+ */
382
+ export const textStylePatchParams = textStyleParams.partial();
383
+ /** A shape clip's geometry and fill. */
384
+ export const shapeStyleParams = withFieldNotes(clipShapeStyle, {
385
+ x: "Left edge (or the line's first point), 0..1 of frame width.",
386
+ y: "Top edge (or the line's first point), 0..1 of frame height.",
387
+ width: "Width, 0..1 of frame width.",
388
+ height: "Height, 0..1 of frame height.",
389
+ x2: 'kind "line" only: the second point, 0..1 of frame width.',
390
+ y2: 'kind "line" only: the second point, 0..1 of frame height.',
391
+ d: 'kind "path" only: SVG path data in the same 0..1 space.',
392
+ sides: 'Point count for kind "polygon" and "star".',
393
+ innerRadius: 'kind "star" only: inner radius as a fraction of the outer.',
394
+ cornerRadius: "Corner rounding, in the same normalized units.",
395
+ fill: "Solid colour string or linear/radial gradient object. Alpha belongs " +
396
+ "in the colour or gradient stop colours.",
397
+ stroke: "Outline colour. Omit it and the shape is drawn with no outline; " +
398
+ "`strokeWidthPx` defaults to 8 once a stroke colour is set.",
399
+ fillStyle: "Gradient or solid fill, wins over `fill` when set. A soft scrim is " +
400
+ '{type: "linear", angle: 90, stops: [{offset: 0, color: "#05070C00"}, ' +
401
+ '{offset: 1, color: "#05070CDD"}]} — the alpha lives in the stop colours.',
402
+ strokeWidthPx: "Outline width in sequence pixels. Default 8.",
403
+ dash: "Dash pattern in normalized units, as ctx.setLineDash takes it.",
404
+ lineCap: '"butt", "round" or "square".',
405
+ lineJoin: '"miter", "round" or "bevel".',
406
+ trimStart: "Stroke only the sub-range [trimStart, trimEnd] of the path, 0..1.",
407
+ trimEnd: "Stroke only the sub-range [trimStart, trimEnd] of the path, 0..1."
408
+ // Strict for the same reason the text bags are: a geometry key spelled
409
+ // wrong inside `shape` was stripped, and the shape drew at its default
410
+ // somewhere else on the frame with nothing said about it.
411
+ }).strict();
412
+ /**
413
+ * What `add_text_clip` and `add_shape_clip` tell the model, shared so the
414
+ * browser registry and the headless bridge describe one tool.
415
+ *
416
+ * Both spell out the traps a build actually hit: a style field sent at the top
417
+ * level used to be stripped in silence (a 120px title reverted to the 96px
418
+ * default), and a rectangle's fill is opaque unless the caller says otherwise,
419
+ * so a scrim authored as a plain fill covers the picture instead of darkening
420
+ * it.
421
+ */
422
+ export const ADD_TEXT_CLIP_DESCRIPTION = "Add authored text to the specified timeline sequence. It goes on an " +
423
+ "overlay track, creating one when needed, lasts 3000ms by default, and " +
424
+ "accepts the same motion presets as media clips. The look goes in `style` " +
425
+ "— {fontSizePx, fontFamily, fontWeight, color, align, maxWidthFrac, " +
426
+ "stroke, shadow, background, fill, ...} — and every one of those keys is " +
427
+ "also read from the top level. `fontSizePx` is in sequence pixels, so 120 " +
428
+ "in a 1080p frame is 120px tall. `opacity` (0..1) sets the clip's own " +
429
+ "opacity. A key neither this tool nor the style bag knows is refused by " +
430
+ "name rather than ignored.";
431
+ export const ADD_SHAPE_CLIP_DESCRIPTION = "Add a rectangle, ellipse, line, polygon, star or path on an overlay track " +
432
+ "of the specified timeline sequence. The geometry goes in `shape` (or " +
433
+ '`shapeStyle`, the name `set_clip_params` uses): {kind: "rect"|"ellipse"|' +
434
+ '"line"|"polygon"|"star"|"path", x, y, width, height, fill, fillStyle, ' +
435
+ "stroke, strokeWidthPx, ...}, with x/y/width/height as 0..1 fractions of " +
436
+ "the frame; every one of those keys is also read from the top level. With " +
437
+ "no geometry at all the shape is a full-frame rect. A shape with no colour " +
438
+ "at all gets a white fill (a line, a white stroke); a shape you fill gets " +
439
+ "no stroke unless you ask for one. A solid `fill` is opaque unless its colour " +
440
+ "carries alpha, so a scrim over picture needs 8-digit hex (#05070CCC) or " +
441
+ 'rgba(); for a gradient scrim use fillStyle: {type: "linear", angle, ' +
442
+ "stops: [{offset, color}]} with a transparent stop (#05070C00) at one end. " +
443
+ "A key this tool does not know is refused by name rather than ignored. " +
444
+ "`opacity` (0..1) sets the clip's own opacity, which is the other way to " +
445
+ "author a scrim. `fill` also accepts the gradient object directly. " +
446
+ "Shapes are rasterized for preview/export and take the standard motion " +
447
+ "presets.";
448
+ /** Every key that says where a shape is or what outline it follows. */
449
+ const SHAPE_GEOMETRY_KEYS = [
450
+ "x",
451
+ "y",
452
+ "width",
453
+ "height",
454
+ "x2",
455
+ "y2",
456
+ "d",
457
+ "sides",
458
+ "innerRadius"
459
+ ];
460
+ /**
461
+ * The shape geometry for `add_shape_clip`, merged from all three forms the
462
+ * caller may have used: `shape`, `shapeStyle` (the name `set_clip_params`
463
+ * takes), and the keys spread at the top level.
464
+ *
465
+ * They are one description of one shape, so they merge — `shape` wins a
466
+ * contested key, then `shapeStyle`, then the top level. Taking the first bag
467
+ * whole and dropping the rest is what put a white full-frame rectangle over a
468
+ * finished ad: the kind and fill went in `shape`, the box at the top level,
469
+ * and the call reported success having read half of it.
470
+ *
471
+ * With no geometry at all the shape is a full-frame rect — a caller that asked
472
+ * for a shape and named no box wants something it can see, not a schema error
473
+ * about a field it did not know existed. Geometry that *is* named is left
474
+ * alone, so a line keeps its two points and gains no width.
475
+ */
476
+ export function resolveShapeArg(shape, shapeStyle, loose) {
477
+ const defined = (bag) => isRecord(bag)
478
+ ? Object.fromEntries(Object.entries(bag).filter(([, value]) => value !== undefined))
479
+ : {};
480
+ const bare = defined(loose);
481
+ const merged = {
482
+ kind: "rect",
483
+ ...bare,
484
+ ...defined(shapeStyle),
485
+ ...defined(shape)
486
+ };
487
+ const placed = SHAPE_GEOMETRY_KEYS.some((key) => key in merged);
488
+ const parsed = shapeStyleParams.safeParse(placed ? merged : { ...merged, x: 0, y: 0, width: 1, height: 1 });
489
+ if (!parsed.success) {
490
+ throw new Error("add_shape_clip takes the geometry in `shape` (or `shapeStyle`): " +
491
+ '{kind: "rect"|"ellipse"|"line"|"polygon"|"star"|"path", x, y, ' +
492
+ "width, height, fill?, fillStyle?, stroke?, strokeWidthPx?}, with " +
493
+ "x/y/width/height as 0..1 fractions of the frame. " +
494
+ parsed.error.issues
495
+ .map((i) => `${i.path.join(".")}: ${i.message}`)
496
+ .join("; "));
497
+ }
498
+ return parsed.data;
499
+ }
500
+ /** Where a 3D clip's camera sits, in the orbit terms every 3D surface shares. */
501
+ const model3dCameraParams = withFieldNotes(clipModel3DCamera, {
502
+ mode: '"orbit" (default) frames the model\'s bounding sphere with the terms ' +
503
+ 'below; "scene" uses a camera the glTF declares and ignores them.',
504
+ azimuthDeg: "Rotation around the model, degrees. 0 is front.",
505
+ elevationDeg: "Height of the camera, degrees. 0 is level, 90 is overhead.",
506
+ fovDeg: "Vertical field of view, degrees. Lower is a longer lens.",
507
+ zoom: "Distance multiplier on the auto-framed fit: above 1 moves closer.",
508
+ targetOffset: "[x, y, z] offset of the look-at point from the bounding-sphere centre, " +
509
+ "in the model's own units. Use it to frame a detail off-centre.",
510
+ sceneCameraName: 'mode "scene" only: the glTF camera to shoot through. The first one when ' +
511
+ "absent."
512
+ }).strict();
513
+ /** Which glTF animation a 3D clip plays, and how. */
514
+ const model3dAnimationParams = withFieldNotes(clipModel3DAnimation, {
515
+ clipName: "Name of the glTF animation to play. Every animation the model declares " +
516
+ "plays when this is absent.",
517
+ loop: "Wrap at the animation's end (default), or hold its last frame.",
518
+ speed: "Playback multiplier on top of the clip's own speed and time remap. The " +
519
+ "animation follows the clip's source time, so a trim hides frames rather " +
520
+ "than dropping them."
521
+ }).strict();
522
+ /**
523
+ * A 3D clip's look, as both `add_model3d_clip` and `set_model3d_style` take
524
+ * it: a patch, merged one level down over what the clip already has.
525
+ *
526
+ * Every block is optional so `{camera: {azimuthDeg: 90}}` turns the model and
527
+ * leaves the elevation, lens and framing alone — sending the camera whole to
528
+ * change one term is how a caller resets the other four by accident.
529
+ * `background` is the exception and replaces whole: it is a union, and half of
530
+ * it is not a background. `bake` is absent because a bake is a render paired
531
+ * with the hash it was rendered at, which only bake_model3d_clip can pair.
532
+ */
533
+ export const model3dStyleParams = z
534
+ .object({
535
+ camera: model3dCameraParams.partial().optional(),
536
+ animation: model3dAnimationParams.partial().optional(),
537
+ lighting: clipModel3DStyle.shape.lighting
538
+ .optional()
539
+ .describe('"studio" (default), "soft" or "flat". The same three presets ' +
540
+ "nodetool.model3d.RenderToImage lights with."),
541
+ lightIntensity: clipModel3DStyle.shape.lightIntensity
542
+ .optional()
543
+ .describe("Multiplier on the lighting preset. Default 1."),
544
+ background: clipModel3DStyle.shape.background
545
+ .optional()
546
+ .describe("{transparent: true} (default — the model composites over the layers " +
547
+ 'under it) or {transparent: false, color: "#101418"}.')
548
+ })
549
+ .strict();
550
+ export const ADD_MODEL3D_CLIP_DESCRIPTION = "Place a glTF model on a picture track of the specified timeline sequence. " +
551
+ "`assetId` is the .glb/.gltf asset's id (list_assets prints them) — the " +
552
+ "model is the clip's asset the way an image is an image clip's. Without a " +
553
+ "track the clip lands on the first overlay track, creating one when there " +
554
+ "is none; without `startMs` it is appended after that track's content. It " +
555
+ "lasts 4000ms by default. `style` is the look — camera (orbit " +
556
+ "azimuth/elevation/fov/zoom, or a glTF camera by name), which animation " +
557
+ "plays, lighting and background — and every field it leaves out takes the " +
558
+ "default: a 45\u00b0/25\u00b0 orbit, studio lighting, and a transparent background so " +
559
+ "the model composites over the picture beneath it. The model's own " +
560
+ "animation follows the clip's source time, so trimming and speed apply to " +
561
+ "it like video. For a turntable, animate_clip with the `orbit` preset " +
562
+ "drives the camera.";
563
+ export const SET_MODEL3D_STYLE_DESCRIPTION = "Change a 3D clip's camera, animation choice, lighting or background. The " +
564
+ "patch merges one level down, so {camera: {azimuthDeg: 90}} turns the model " +
565
+ "and keeps the elevation, lens and framing it was framed at. `background` " +
566
+ "replaces whole: {transparent: true} or {transparent: false, color}. Use " +
567
+ "animate_clip with the `orbit` preset for a camera move over time rather " +
568
+ "than a fixed pose.";
569
+ export const BAKE_MODEL3D_CLIP_DESCRIPTION = "Render a 3D clip through Blender and store the result on it, so the clip " +
570
+ "plays that video instead of the live proxy. The bake is the clip as it " +
571
+ "stands — its trim, speed, time remap, animation choice and camera move all " +
572
+ "applied — at the sequence's fps and resolution, and it is played from the " +
573
+ "clip's own first frame. Any later edit that changes the picture (the " +
574
+ "style, the model, the trim, the duration, the speed, the remap, a camera " +
575
+ "animation, or the sequence settings) makes it stale and the live 3D layer " +
576
+ "draws again until it is baked afresh; validate_timeline reports that as " +
577
+ "`bake_stale`. A clip with a transparent background is refused: an alpha " +
578
+ "bake needs a WebM VP9 encode this build does not have.";
579
+ /**
580
+ * A caption's look. Every field is optional and an absent one keeps the
581
+ * built-in value, so a partial patch restyles one thing rather than resetting
582
+ * the rest.
583
+ */
584
+ export const captionStyleParams = withFieldNotes(captionStyle, {
585
+ fontSizeFrac: "Font size as a fraction of frame height. Default 0.05.",
586
+ color: "Colour of the words not being spoken.",
587
+ activeColor: "Colour of the word being spoken. Default #FFD60A.",
588
+ outline: "Outline under the glyphs. widthPx 0 draws none.",
589
+ bottomMarginFrac: "Gap from the frame bottom, as a fraction of height. Default 0.12.",
590
+ background: "Scrim behind the whole block."
591
+ });
592
+ // ── Transitions ─────────────────────────────────────────────────────────────
593
+ /**
594
+ * A cut, authored on the incoming clip (D5). The type is an enum so a model
595
+ * inventing one is refused with the list, rather than saving a document the
596
+ * renderer then quietly cross-fades.
597
+ */
598
+ export const transitionParams = z.object({
599
+ type: z.enum(KNOWN_TRANSITION_TYPE_LIST),
600
+ durationMs: z
601
+ .number()
602
+ .describe("Length of the cut from the clip's start. 0 or less is a hard cut."),
603
+ easing: z
604
+ .string()
605
+ .optional()
606
+ .describe("Easing id, cubic-bezier(x1,y1,x2,y2) or spring(stiffness,damping,mass)."),
607
+ color: z.string().optional().describe("dipToColor only, e.g. #000000."),
608
+ direction: z
609
+ .enum(["left", "right", "up", "down"])
610
+ .optional()
611
+ .describe("wipe, push and slide only: the edge the incoming clip arrives from."),
612
+ softness: z
613
+ .number()
614
+ .optional()
615
+ .describe("wipe, gradientWipe or iris: feathered edge width, 0..1."),
616
+ map: z.enum(["linear", "radial", "noise"]).optional().describe("gradientWipe: threshold field."),
617
+ scale: z.number().optional().describe("gradientWipe noise frequency or lightLeak field falloff."),
618
+ seed: z.number().optional().describe("gradientWipe or lightLeak field seed."),
619
+ blur: z.number().optional().describe("whip or zoomBlur: blur radius in source pixels."),
620
+ amount: z.number().optional().describe("glitch: displacement strength.")
621
+ });
622
+ export const APPLY_TRANSITION_AT_CUT_DESCRIPTION = "Apply one transition candidate to two explicitly adjacent clips as a single undoable cut operation. The outgoing clip must precede the incoming clip on the same track. Provide durationMs or overlapMs. Transition-specific fields match set_transition: color controls dipToColor; direction controls wipe, push and slide; softness controls wipe. Do not use this to replace either clip's take.";
623
+ export const applyTransitionAtCutParams = transitionParams.extend({
624
+ outgoingClipId: z.string().trim().min(1),
625
+ incomingClipId: z.string().trim().min(1),
626
+ durationMs: z.number().positive().optional(),
627
+ overlapMs: z.number().positive().optional(),
628
+ type: transitionParams.shape.type.optional()
629
+ });
630
+ /**
631
+ * The union member the named type actually takes. The input schema is one flat
632
+ * object because that is what a tool call can express, so a `color` sent with a
633
+ * `push` would otherwise be stored and then silently stripped on the next save
634
+ * — a `field_stripped` warning for a field that never meant anything.
635
+ */
636
+ export function buildTransition(input) {
637
+ const { type, durationMs, easing } = input;
638
+ const direction = input.direction ?? "left";
639
+ switch (type) {
640
+ case "dipToColor":
641
+ return { type, durationMs, easing, color: input.color ?? "#000000" };
642
+ case "wipe":
643
+ return { type, durationMs, easing, direction, softness: input.softness };
644
+ case "gradientWipe":
645
+ return { type, durationMs, easing, direction, softness: input.softness, map: input.map, scale: input.scale, seed: input.seed };
646
+ case "push":
647
+ case "slide":
648
+ return { type, durationMs, easing, direction };
649
+ case "whip":
650
+ return { type, durationMs, easing, direction, blur: input.blur };
651
+ case "zoomBlur":
652
+ return { type, durationMs, easing, blur: input.blur };
653
+ case "glitch":
654
+ return { type, durationMs, easing, amount: input.amount };
655
+ case "iris":
656
+ return { type, durationMs, easing, softness: input.softness };
657
+ case "lightLeak":
658
+ return { type, durationMs, easing, color: input.color, scale: input.scale, seed: input.seed };
659
+ case "crossfade":
660
+ case "zoom":
661
+ return { type, durationMs, easing };
662
+ }
663
+ }
664
+ // ── Masks and mattes ────────────────────────────────────────────────────────
665
+ /**
666
+ * The mask kinds `drawMask` rasterizes. The document types `kind` as a plain
667
+ * string for forward compat (I2), but a kind this build cannot draw is a mask
668
+ * that silently does nothing, and refusing it at the call is cheaper than
669
+ * finding it in the pixels.
670
+ */
671
+ export const MASK_KINDS = ["rect", "ellipse", "path"];
672
+ /** A shape mask on one clip, in the layer's own normalized 0..1 space (D6). */
673
+ export const maskParams = z.object({
674
+ kind: z.enum(MASK_KINDS),
675
+ x: z
676
+ .number()
677
+ .optional()
678
+ .describe("Left edge, 0..1 of the layer's width. Default 0."),
679
+ y: z
680
+ .number()
681
+ .optional()
682
+ .describe("Top edge, 0..1 of the layer's height. Default 0."),
683
+ width: z
684
+ .number()
685
+ .optional()
686
+ .describe("Width, 0..1 of the layer's width. Default 1."),
687
+ height: z
688
+ .number()
689
+ .optional()
690
+ .describe("Height, 0..1 of the layer's height. Default 1."),
691
+ radiusPx: z.number().nonnegative().optional().describe("rect only: corner radius in source pixels."),
692
+ d: z
693
+ .string()
694
+ .optional()
695
+ .describe('kind "path" only: SVG path data in the same 0..1 space. M, L, C, Q and Z, absolute or relative.'),
696
+ featherPx: z
697
+ .number()
698
+ .optional()
699
+ .describe("Soft edge width in the layer's own pixels. 0 is a hard edge."),
700
+ invert: z
701
+ .boolean()
702
+ .optional()
703
+ .describe("Keep what the mask excludes instead of what it covers.")
704
+ });
705
+ /**
706
+ * The stored mask, with the fields the named kind does not use left off — the
707
+ * same reason {@link buildTransition} narrows a flat input.
708
+ *
709
+ * `checkPath` is the host's own path parser (`parseSvgPath`). Path data is
710
+ * parsed at the call rather than at render time so a path the renderer cannot
711
+ * read is refused while the caller can still fix it; a host with no parser in
712
+ * reach passes none and stores the data unchecked.
713
+ */
714
+ export function buildMask(input, checkPath) {
715
+ const { kind, x, y, width, height, radiusPx, featherPx, invert } = input;
716
+ if (kind === "rect")
717
+ return { kind, x, y, width, height, radiusPx, featherPx, invert };
718
+ if (kind === "ellipse")
719
+ return { kind, x, y, width, height, featherPx, invert };
720
+ const d = input.d ?? "";
721
+ const parsed = checkPath?.(d);
722
+ if (parsed && !parsed.ok) {
723
+ throw new Error(`mask.d is not path data this build can draw: ${parsed.error}`);
724
+ }
725
+ return { kind, d, featherPx, invert };
726
+ }
727
+ /** A track matte: another clip's alpha or luminance drives this layer's alpha. */
728
+ export const matteParams = z.object({
729
+ source: z
730
+ .string()
731
+ .describe("The clip whose pixels drive the alpha, by id or name."),
732
+ mode: z
733
+ .enum(["alpha", "luma"])
734
+ .describe("alpha reads the source's transparency; luma reads its brightness."),
735
+ invert: z.boolean().optional()
736
+ });
737
+ /**
738
+ * The knobs on a matte generated from the clip's own source (D2).
739
+ *
740
+ * Generating one is `isolate_subject`, a paid provider call. This is what a
741
+ * person does with the result: invert the keyhole, ease its strength, feather
742
+ * its edge, go back to the version before the last regenerate, throw it away.
743
+ * Every field is optional and an absent one leaves the stored value alone;
744
+ * `clear` wins over the rest, then `selectVersionAssetId`, then the knobs.
745
+ */
746
+ export const setGeneratedMatteParams = z.object({
747
+ target: targetParam,
748
+ invert: z
749
+ .boolean()
750
+ .optional()
751
+ .describe("Keep what the matte excludes instead of what it covers."),
752
+ strength: z
753
+ .number()
754
+ .min(0)
755
+ .max(1)
756
+ .optional()
757
+ .describe("Multiplier on the matte's alpha. 1 is the full cutout, 0 none."),
758
+ featherPx: z
759
+ .number()
760
+ .min(0)
761
+ .optional()
762
+ .describe("Soften the cutout edge, in source px. GPU only — the Canvas 2D compositor draws the edge hard and reports it."),
763
+ selectVersionAssetId: z
764
+ .string()
765
+ .optional()
766
+ .describe("Make a stored version current, by its mask asset id. A version that is not in the list is a no-op."),
767
+ clear: z
768
+ .boolean()
769
+ .optional()
770
+ .describe("Remove the generated matte, stored versions and all.")
771
+ });
772
+ export const SET_GENERATED_MATTE_DESCRIPTION = "Adjust the matte isolate_subject cut from a clip's own source: invert it, " +
773
+ "ease its strength, feather its edge, put an earlier version back, or " +
774
+ "clear it. This does not generate anything and costs nothing — " +
775
+ "isolate_subject is the call that runs the provider. Fields you leave out " +
776
+ "keep the value they have, so one call can change strength alone. Use " +
777
+ "set_matte instead for a keyhole authored from another clip's picture.";
778
+ /**
779
+ * A time-remap curve: where in the source each instant of the clip sits (D13).
780
+ *
781
+ * `t` is normalized over the clip's own window, so the curve has to span it —
782
+ * a list starting at 0.3 would leave the first third of the clip held on a
783
+ * frame the caller never asked for, and `evaluateTimeRemapMs` holds flat
784
+ * outside the ends rather than reporting that. The ordering rule is the
785
+ * sampler's: it reads keyframes in array order and never sorts, so a list that
786
+ * does not ascend samples wrong instead of failing.
787
+ */
788
+ export const timeRemapParams = z.object({
789
+ keyframes: z
790
+ .array(z.object({
791
+ t: z
792
+ .number()
793
+ .min(0)
794
+ .max(1)
795
+ .describe("Position in the clip's window, 0..1."),
796
+ sourceMs: z
797
+ .number()
798
+ .min(0)
799
+ .describe("Milliseconds into the source media shown at this position."),
800
+ easing: z
801
+ .string()
802
+ .optional()
803
+ .describe("Easing for the segment ending here. Default linear.")
804
+ }))
805
+ .min(2)
806
+ .describe("At least two keyframes, ascending in `t`, starting at 0 and ending at 1.")
807
+ });
808
+ /** `set_time_remap`'s whole input: a curve, or null to play at the clip's rate. */
809
+ export const setTimeRemapParams = z.object({
810
+ target: targetParam,
811
+ timeRemap: timeRemapParams
812
+ .nullable()
813
+ .describe("The curve, or null to clear it and play at the clip's rate.")
814
+ });
815
+ /**
816
+ * The stored remap, refusing the curves the sampler cannot read.
817
+ *
818
+ * Checked here rather than in Zod so every host reports one message, and so a
819
+ * caller that built the object itself gets the same refusal a tool call does.
820
+ */
821
+ export function buildTimeRemap(input) {
822
+ const kfs = input.keyframes;
823
+ if (kfs.length < 2) {
824
+ throw new Error("timeRemap needs at least two keyframes — one is a freeze frame, not a curve.");
825
+ }
826
+ if (kfs[0].t !== 0 || kfs[kfs.length - 1].t !== 1) {
827
+ throw new Error(`timeRemap must span the clip: the first keyframe's t must be 0 and the last 1 (got ${kfs[0].t} and ${kfs[kfs.length - 1].t}).`);
828
+ }
829
+ for (let i = 1; i < kfs.length; i++) {
830
+ if (kfs[i].t <= kfs[i - 1].t) {
831
+ throw new Error(`timeRemap keyframes must ascend in t — keyframe ${i} is at ${kfs[i].t}, after ${kfs[i - 1].t}.`);
832
+ }
833
+ }
834
+ return {
835
+ keyframes: kfs.map(({ t, sourceMs, easing }) => easing === undefined ? { t, sourceMs } : { t, sourceMs, easing })
836
+ };
837
+ }
838
+ // ── Baked animations ────────────────────────────────────────────────────────
839
+ /**
840
+ * Where a baked curve came from, stored on the animation as
841
+ * `custom.bakedFrom`.
842
+ *
843
+ * `kind` plus the driven property is the identity a re-bake matches to replace
844
+ * its own curve, so it is required. The rest is what a caller needs to re-run
845
+ * the bake or show its provenance: which clip was measured, which asset, and
846
+ * the settings that produced these numbers. `kind` is a free string for the
847
+ * forward compat `preset` has — one this build does not know is provenance to
848
+ * display, never something to execute.
849
+ */
850
+ export const bakedFromParams = z.object({
851
+ kind: z
852
+ .string()
853
+ .min(1)
854
+ .describe('What produced the curve, e.g. "audio". A second bake of the same kind driving the same property replaces this one.'),
855
+ clipId: z
856
+ .string()
857
+ .optional()
858
+ .describe("The clip that was measured, when it is not the animated one."),
859
+ assetId: z.string().optional().describe("The media the curve was read from."),
860
+ settings: z
861
+ .record(z.string(), z.union([z.number(), z.string(), z.boolean()]))
862
+ .optional()
863
+ .describe("The knobs the bake ran with, so it can be repeated.")
864
+ });
865
+ /**
866
+ * One source-anchored curve, as `set_baked_animation` takes it.
867
+ *
868
+ * `sourceMs` is absolute time in the animated clip's own media, not time on
869
+ * the timeline and not `t` over the clip's window: the curve travels with the
870
+ * footage, so a trim or a split re-slices it instead of stretching it. The
871
+ * property name is loose here — `@nodetool-ai/timeline` owns the list, and
872
+ * `normalizeCustomCurves` is the one gate that checks it, the same way it
873
+ * checks a curve `animate_clip` writes.
874
+ */
875
+ export const bakedAnimationParams = z.object({
876
+ property: z
877
+ .string()
878
+ .describe("Channel the curve drives, e.g. scale, opacity, offsetX. list_animation_presets reports every one with its identity and range."),
879
+ keyframes: z
880
+ .array(z.object({
881
+ sourceMs: z
882
+ .number()
883
+ .min(0)
884
+ .describe("Milliseconds into the animated clip's own source media."),
885
+ value: z.number().describe("The channel's value at that source time."),
886
+ easing: z
887
+ .string()
888
+ .optional()
889
+ .describe("Easing for the segment ending here. Default linear.")
890
+ }))
891
+ .min(1)
892
+ .describe("Ascending in `sourceMs`; a list that goes back is refused."),
893
+ timeBase: z
894
+ .literal("source")
895
+ .optional()
896
+ .describe('Only "source". A curve normalized over the clip\'s window is what animate_clip takes.'),
897
+ bakedFrom: bakedFromParams,
898
+ role: z
899
+ .enum(["in", "out", "emphasis", "loop"])
900
+ .optional()
901
+ .describe('Default "emphasis" — the role whose window is the whole clip.'),
902
+ durationMs: z
903
+ .number()
904
+ .positive()
905
+ .optional()
906
+ .describe("The animation's window. Default the clip's own duration."),
907
+ delayMs: z.number().optional().describe("Offset of the window. Default 0."),
908
+ easing: z
909
+ .string()
910
+ .optional()
911
+ .describe("Overrides every segment's own easing."),
912
+ params: z
913
+ .record(z.string(), z.union([z.number(), z.string(), z.boolean()]))
914
+ .optional(),
915
+ mask: z
916
+ .object({
917
+ direction: z.enum(["left", "right", "up", "down"]),
918
+ softness: z.number().min(0).max(1)
919
+ })
920
+ .optional()
921
+ .describe("Required when the curve drives wipeProgress."),
922
+ replace: z
923
+ .boolean()
924
+ .optional()
925
+ .describe("Default true: overwrite the curve an earlier bake of this kind left on this property. False appends beside it.")
926
+ });
927
+ /** `set_baked_animation`'s whole input. */
928
+ export const setBakedAnimationParams = z.object({
929
+ target: targetParam,
930
+ animation: bakedAnimationParams
931
+ });
932
+ export const SET_BAKED_ANIMATION_DESCRIPTION = "Write one machine-produced curve onto a clip, anchored to the clip's own " +
933
+ "media rather than to its window: every keyframe names an absolute " +
934
+ "`sourceMs`, so a trim or a split re-slices the motion instead of " +
935
+ "stretching it. `bakedFrom` says what produced the curve, and a second " +
936
+ "bake of the same `kind` driving the same property replaces that curve in " +
937
+ "place, keeping its id. An animation with no `bakedFrom` — anything a " +
938
+ "person keyframed — is never touched. Use animate_clip for a preset or a " +
939
+ "hand-written curve; this op is for a bake something measured.";
940
+ // ── Effects ─────────────────────────────────────────────────────────────────
941
+ /** A tone-curve control point list, normalized on both axes. */
942
+ const curvePoints = z.array(z.object({ x: z.number(), y: z.number() }));
943
+ /** Three numbers, one per channel, for the three-way grade. */
944
+ const rgbTriple = z.tuple([z.number(), z.number(), z.number()]);
945
+ const EFFECT_PARAMETER_FIELDS = {
946
+ color: ["brightness", "contrast", "saturation", "hue", "temperature", "tint", "shadows", "highlights"],
947
+ blur: ["radius"],
948
+ pixelate: ["cellSize"],
949
+ posterize: ["levels"],
950
+ directionalBlur: ["radius", "angle"],
951
+ lensDistortion: ["amount"],
952
+ stylize: ["mode", "amount", "scale", "angle", "time", "seed", "animate", "color", "softness"],
953
+ generator: ["mode", "amount", "scale", "angle", "time", "seed", "animate", "colorA", "colorB"],
954
+ lut: ["cube", "intensity"],
955
+ glow: ["radius", "intensity", "color"],
956
+ dropShadow: ["offsetX", "offsetY", "blur", "radius", "color", "opacity"],
957
+ vignette: ["amount", "softness"],
958
+ sharpen: ["amount", "radius"],
959
+ chromaKey: ["color", "tolerance", "softness", "spill"],
960
+ grain: ["amount", "size", "colorAmount", "animate"],
961
+ curves: ["master", "r", "g", "b"],
962
+ levels: ["inBlack", "inWhite", "gamma", "outBlack", "outWhite"],
963
+ liftGammaGain: ["lift", "gammaRgb", "gain"]
964
+ };
965
+ /**
966
+ * One effect in a clip's chain (D7). `type` decides which of the other fields
967
+ * are accepted. A tool call sends one flat object, and a knob the named type
968
+ * cannot read is rejected before {@link buildEffect} writes the chain.
969
+ *
970
+ * `enabled` and `id` are not asked for — the chain is replaced whole, so an
971
+ * effect the caller sent is an effect it wants on, and an id it never sees is
972
+ * one it cannot get wrong.
973
+ */
974
+ export const effectParams = z.object({
975
+ type: z.enum(KNOWN_CLIP_EFFECT_TYPE_LIST),
976
+ brightness: z.number().optional().describe("color: -1..1, 0 is unchanged."),
977
+ contrast: z.number().optional().describe("color: 0..4, 1 is unchanged."),
978
+ saturation: z.number().optional().describe("color: 0..4, 1 is unchanged."),
979
+ hue: z.number().optional().describe("color: degrees, -180..180."),
980
+ temperature: z.number().optional().describe("color: -1..1, cool to warm."),
981
+ tint: z.number().optional().describe("color: -1..1, green to magenta."),
982
+ shadows: z.number().optional().describe("color: -1..1."),
983
+ highlights: z.number().optional().describe("color: -1..1."),
984
+ radius: z
985
+ .number()
986
+ .optional()
987
+ .describe("blur, glow and sharpen: radius in the clip's own pixels."),
988
+ cellSize: z.number().optional().describe("pixelate: square cell width in source pixels."),
989
+ levels: z.number().optional().describe("posterize: number of channel levels."),
990
+ angle: z.number().optional().describe("directionalBlur and visual effects: angle in degrees."),
991
+ mode: z.string().optional().describe("stylize or generator mode."),
992
+ scale: z.number().optional().describe("stylize or generator spatial scale."),
993
+ time: z.number().optional().describe("stylize or generator time in seconds."),
994
+ seed: z.number().optional().describe("stylize or generator deterministic seed."),
995
+ colorA: z.string().optional().describe("generator first colour."),
996
+ colorB: z.string().optional().describe("generator second colour."),
997
+ cube: z.string().optional().describe("lut: full contents of a 3D .cube file."),
998
+ intensity: z.number().optional().describe("glow: bloom strength, 0..2."),
999
+ offsetX: z
1000
+ .number()
1001
+ .optional()
1002
+ .describe("dropShadow: offset in the clip's own pixels, positive is right."),
1003
+ offsetY: z
1004
+ .number()
1005
+ .optional()
1006
+ .describe("dropShadow: offset in the clip's own pixels, positive is down."),
1007
+ blur: z.number().optional().describe("dropShadow: blur radius in pixels."),
1008
+ color: z
1009
+ .string()
1010
+ .optional()
1011
+ .describe("dropShadow shadow colour, chromaKey key colour, e.g. #00ff00."),
1012
+ opacity: z.number().optional().describe("dropShadow: 0..1."),
1013
+ amount: z
1014
+ .number()
1015
+ .optional()
1016
+ .describe("vignette, sharpen and grain: strength."),
1017
+ size: z
1018
+ .number()
1019
+ .optional()
1020
+ .describe("grain: cell size in the clip's own pixels, 1 is per-pixel."),
1021
+ colorAmount: z
1022
+ .number()
1023
+ .optional()
1024
+ .describe("grain: 0 is monochrome grain, 1 full colour noise."),
1025
+ animate: z
1026
+ .boolean()
1027
+ .optional()
1028
+ .describe("grain: roll the pattern per frame instead of holding one."),
1029
+ softness: z
1030
+ .number()
1031
+ .optional()
1032
+ .describe("vignette falloff and chromaKey edge, 0..1."),
1033
+ tolerance: z.number().optional().describe("chromaKey: match width, 0..1."),
1034
+ spill: z.number().optional().describe("chromaKey: spill suppression, 0..1."),
1035
+ master: curvePoints.optional().describe("curves: the luminance curve."),
1036
+ r: curvePoints.optional().describe("curves: red channel."),
1037
+ g: curvePoints.optional().describe("curves: green channel."),
1038
+ b: curvePoints.optional().describe("curves: blue channel."),
1039
+ inBlack: z.number().optional().describe("levels: input black point, 0..1."),
1040
+ inWhite: z.number().optional().describe("levels: input white point, 0..1."),
1041
+ gamma: z.number().optional().describe("levels: midtone gamma, 1 is neutral."),
1042
+ outBlack: z.number().optional().describe("levels: output black point, 0..1."),
1043
+ outWhite: z.number().optional().describe("levels: output white point, 0..1."),
1044
+ lift: rgbTriple
1045
+ .optional()
1046
+ .describe("liftGammaGain: shadow offset per channel."),
1047
+ gain: rgbTriple
1048
+ .optional()
1049
+ .describe("liftGammaGain: highlight scale per channel."),
1050
+ gammaRgb: rgbTriple
1051
+ .optional()
1052
+ .describe("liftGammaGain: midtone gamma per channel.")
1053
+ })
1054
+ // `.passthrough()` (not `.strict()`) so a key the schema has never heard of
1055
+ // reaches this refinement instead of failing on a bare `unrecognized_keys`
1056
+ // issue, which would never name the type's actual allowed fields.
1057
+ .passthrough()
1058
+ .superRefine((input, context) => {
1059
+ const allowed = EFFECT_PARAMETER_FIELDS[input.type];
1060
+ for (const [field, value] of Object.entries(input)) {
1061
+ if (field !== "type" && value !== undefined && !allowed.includes(field)) {
1062
+ context.addIssue({
1063
+ code: "custom",
1064
+ path: [field],
1065
+ message: `${input.type} does not accept parameter "${field}". Allowed parameters: ${allowed.join(", ")}.`
1066
+ });
1067
+ }
1068
+ }
1069
+ });
1070
+ /**
1071
+ * The stored effect, narrowed to the fields its type reads. Defaults are the
1072
+ * neutral value of each knob, so an effect named with nothing else set is
1073
+ * harmless rather than refused.
1074
+ */
1075
+ export function buildEffect(input, index) {
1076
+ effectParams.parse(input);
1077
+ const base = { id: `fx-${index + 1}`, enabled: true };
1078
+ switch (input.type) {
1079
+ case "color":
1080
+ return {
1081
+ ...base,
1082
+ type: "color",
1083
+ brightness: input.brightness,
1084
+ contrast: input.contrast,
1085
+ saturation: input.saturation,
1086
+ hue: input.hue,
1087
+ temperature: input.temperature,
1088
+ tint: input.tint,
1089
+ shadows: input.shadows,
1090
+ highlights: input.highlights
1091
+ };
1092
+ case "blur":
1093
+ return { ...base, type: "blur", radius: input.radius ?? 0 };
1094
+ case "pixelate":
1095
+ return { ...base, type: "pixelate", cellSize: input.cellSize ?? 8 };
1096
+ case "posterize":
1097
+ return { ...base, type: "posterize", levels: input.levels ?? 4 };
1098
+ case "directionalBlur":
1099
+ return { ...base, type: "directionalBlur", radius: input.radius ?? 8, angle: input.angle ?? 0 };
1100
+ case "lensDistortion":
1101
+ return { ...base, type: "lensDistortion", amount: input.amount ?? 0.5 };
1102
+ case "stylize": {
1103
+ const modes = ["rgbSplit", "radialBlur", "zoomBlur", "turbulence", "glitch", "halftone", "dither", "lightRays", "lensFlare", "innerShadow", "innerGlow", "edgeHighlight", "displacement", "gradientWipe", "lightLeakOverlay"];
1104
+ const mode = modes.find((candidate) => candidate === input.mode);
1105
+ if (!mode)
1106
+ throw new Error(`Unknown stylize mode: "${input.mode}". Valid modes: ${modes.join(", ")}.`);
1107
+ return { ...base, type: "stylize", mode, amount: input.amount ?? 0.5, scale: input.scale, angle: input.angle, time: input.time, seed: input.seed, animate: input.animate, color: input.color, softness: input.softness };
1108
+ }
1109
+ case "generator": {
1110
+ const modes = ["noise", "fractal", "conicGradient", "meshGradient", "gradientField", "particles", "lightLeak", "gridPattern"];
1111
+ const mode = modes.find((candidate) => candidate === input.mode);
1112
+ if (!mode)
1113
+ throw new Error(`Unknown generator mode: "${input.mode}". Valid modes: ${modes.join(", ")}.`);
1114
+ return { ...base, type: "generator", mode, amount: input.amount, scale: input.scale, angle: input.angle, time: input.time, seed: input.seed, animate: input.animate, colorA: input.colorA, colorB: input.colorB };
1115
+ }
1116
+ case "lut":
1117
+ if (!input.cube)
1118
+ throw new Error("lut requires .cube file contents");
1119
+ return { ...base, type: "lut", cube: input.cube, intensity: input.intensity ?? 1 };
1120
+ case "glow":
1121
+ return {
1122
+ ...base,
1123
+ type: "glow",
1124
+ radius: input.radius ?? 8,
1125
+ intensity: input.intensity ?? 1,
1126
+ color: input.color
1127
+ };
1128
+ case "dropShadow":
1129
+ return {
1130
+ ...base,
1131
+ type: "dropShadow",
1132
+ offsetX: input.offsetX ?? 0,
1133
+ offsetY: input.offsetY ?? 0,
1134
+ blur: input.blur ?? input.radius ?? 8,
1135
+ color: input.color ?? "#000000",
1136
+ opacity: input.opacity
1137
+ };
1138
+ case "vignette":
1139
+ return {
1140
+ ...base,
1141
+ type: "vignette",
1142
+ amount: input.amount ?? 0.5,
1143
+ softness: input.softness ?? 0.5
1144
+ };
1145
+ case "sharpen":
1146
+ return {
1147
+ ...base,
1148
+ type: "sharpen",
1149
+ amount: input.amount ?? 1,
1150
+ radius: input.radius
1151
+ };
1152
+ case "chromaKey":
1153
+ return {
1154
+ ...base,
1155
+ type: "chromaKey",
1156
+ color: input.color ?? "#00ff00",
1157
+ tolerance: input.tolerance ?? 0.1,
1158
+ softness: input.softness ?? 0.05,
1159
+ spill: input.spill
1160
+ };
1161
+ case "grain":
1162
+ return {
1163
+ ...base,
1164
+ type: "grain",
1165
+ amount: input.amount ?? 0.25,
1166
+ size: input.size,
1167
+ colorAmount: input.colorAmount,
1168
+ animate: input.animate
1169
+ };
1170
+ case "curves":
1171
+ return {
1172
+ ...base,
1173
+ type: "curves",
1174
+ master: input.master ?? [
1175
+ { x: 0, y: 0 },
1176
+ { x: 1, y: 1 }
1177
+ ],
1178
+ r: input.r,
1179
+ g: input.g,
1180
+ b: input.b
1181
+ };
1182
+ case "levels":
1183
+ return {
1184
+ ...base,
1185
+ type: "levels",
1186
+ inBlack: input.inBlack ?? 0,
1187
+ inWhite: input.inWhite ?? 1,
1188
+ gamma: input.gamma ?? 1,
1189
+ outBlack: input.outBlack ?? 0,
1190
+ outWhite: input.outWhite ?? 1
1191
+ };
1192
+ case "liftGammaGain":
1193
+ return {
1194
+ ...base,
1195
+ type: "liftGammaGain",
1196
+ lift: input.lift ?? [0, 0, 0],
1197
+ gamma: input.gammaRgb ?? [1, 1, 1],
1198
+ gain: input.gain ?? [1, 1, 1]
1199
+ };
1200
+ }
1201
+ }
1202
+ // ── Groups ──────────────────────────────────────────────────────────────────
1203
+ /**
1204
+ * A group clip: no media of its own, just a transform, an opacity and a window
1205
+ * the clips naming it inherit (D4). It occupies a track like any other clip, so
1206
+ * the picture stays where it is — a child's z-order is its own track's (I9).
1207
+ */
1208
+ export const addGroupParams = z.object({
1209
+ name: z.string().trim().min(1).describe("Label for the group clip."),
1210
+ transform: clipTransformPatchParam,
1211
+ startMs: z.number().describe("Where the group's window opens."),
1212
+ durationMs: z
1213
+ .number()
1214
+ .describe("How long the window stays open. A child is clipped to it, so cover the children."),
1215
+ trackId: z
1216
+ .string()
1217
+ .optional()
1218
+ .describe("Track for the group clip, by id or name. Defaults to an overlay track, creating one when needed."),
1219
+ children: z
1220
+ .array(z.string())
1221
+ .optional()
1222
+ .describe("Clips to parent to the new group, by id or name. Each keeps its own track.")
1223
+ });
1224
+ /** Parent one clip to a group, or unparent it with `parentId: null`. */
1225
+ export const setParentParams = z.object({
1226
+ target: targetParam,
1227
+ parentId: z
1228
+ .string()
1229
+ .nullable()
1230
+ .describe("The group clip to inherit from, by id or name. null releases the clip.")
1231
+ });
1232
+ // ── MIDI ────────────────────────────────────────────────────────────────────
1233
+ /**
1234
+ * A note as a tool call writes it. Ticks are content-relative (960 per quarter
1235
+ * note) so a note keeps its place when the clip's window is trimmed, and `id`
1236
+ * is optional because the implementation mints one — a caller that wants to
1237
+ * edit a note it already knows sends the id back.
1238
+ */
1239
+ export const midiNoteParams = z.object({
1240
+ id: z
1241
+ .string()
1242
+ .optional()
1243
+ .describe("Keep an existing note's id. Omit and one is assigned."),
1244
+ pitch: z
1245
+ .number()
1246
+ .int()
1247
+ .min(0)
1248
+ .max(127)
1249
+ .describe("MIDI note number, 0..127. 60 is middle C."),
1250
+ velocity: z
1251
+ .number()
1252
+ .int()
1253
+ .min(1)
1254
+ .max(127)
1255
+ .optional()
1256
+ .describe("How hard the note is struck, 1..127. Default 100."),
1257
+ start_tick: z
1258
+ .number()
1259
+ .int()
1260
+ .min(0)
1261
+ .describe("Where the note starts, in ticks from the clip's content start. 960 ticks = one quarter note."),
1262
+ duration_tick: z
1263
+ .number()
1264
+ .int()
1265
+ .positive()
1266
+ .describe("How long the note is held, in ticks. 960 = one quarter note.")
1267
+ });
1268
+ const notesParam = z
1269
+ .array(midiNoteParams)
1270
+ .max(MIDI_MAX_NOTES_PER_CLIP)
1271
+ .describe(`The notes, in ticks from the clip's content start. At most ${MIDI_MAX_NOTES_PER_CLIP} per clip.`);
1272
+ /**
1273
+ * `add_midi_clip`. The clip carries its notes inline and the track carries the
1274
+ * instrument, so a clip moved to another midi track plays that track's voice.
1275
+ */
1276
+ export const addMidiClipParams = z.object({
1277
+ track: trackTargetParam.describe("Midi track for the clip, by id or name. Must be a track of type `midi`."),
1278
+ start_ms: z
1279
+ .number()
1280
+ .describe("Where the clip starts on the timeline, in ms."),
1281
+ duration_ms: z
1282
+ .number()
1283
+ .positive()
1284
+ .describe("The clip's window length in ms. Notes past the window end are gated at it, not deleted."),
1285
+ name: z.string().optional().describe("Label for the clip."),
1286
+ notes: notesParam.optional()
1287
+ });
1288
+ /** `set_notes`. Replaces the whole list — send every note the clip should keep. */
1289
+ export const setNotesParams = z.object({
1290
+ clip: targetParam,
1291
+ notes: notesParam.describe("The clip's complete note list; this replaces what is there. Pass a note's `id` to keep it.")
1292
+ });
1293
+ /** `set_tempo`. One constant tempo for the document. */
1294
+ export const setTempoParams = z.object({
1295
+ bpm: z.number().positive().describe("Beats per minute."),
1296
+ offset_ms: z
1297
+ .number()
1298
+ .min(0)
1299
+ .optional()
1300
+ .describe("Where beat one sits on the timeline, in ms. Default 0."),
1301
+ beats_per_bar: z
1302
+ .number()
1303
+ .int()
1304
+ .positive()
1305
+ .optional()
1306
+ .describe("Time-signature numerator, e.g. 4 in 4/4. Default 4."),
1307
+ beat_unit: z
1308
+ .number()
1309
+ .int()
1310
+ .positive()
1311
+ .optional()
1312
+ .describe("Time-signature denominator, e.g. 4 in 4/4. Default 4.")
1313
+ });
1314
+ export const SET_TEMPO_DESCRIPTION = "Set the document's constant tempo. Milliseconds are the timeline's master " +
1315
+ "clock and a note's ticks are read against the tempo, so changing it " +
1316
+ "rescales every midi clip around `offset_ms` — halving the BPM doubles each " +
1317
+ "midi clip's start and length, and the notes keep their place inside it. " +
1318
+ "Clips that are not midi do not move, so a midi part re-tempoed against " +
1319
+ "picture will no longer line up with it.";
1320
+ /** A voice named instead of spelled out. The id is one of the engine's
1321
+ * `MIDI_INSTRUMENT_PRESETS`; the handler resolves it to the full instrument
1322
+ * and stores that, so the track keeps its sound if the table changes. */
1323
+ export const midiInstrumentPresetRef = z.object({
1324
+ preset: z
1325
+ .string()
1326
+ .describe("A shipped voice by id. sampler starts an empty sample instrument. For recordings pass a full sampler instrument: type sampler, zones [{id, name, assetId (full audio asset id), rootNote, lowNote, highNote, gainDb}], oneShot, attackMs, releaseMs, gainDb. One-shot plays full recordings; gated mode releases on note-off. Recordings must be at most 60 seconds. Soundtrack presets: wt1-cinematic-strings, wt1-chamber-strings, wt1-short-strings, wt1-low-strings, wt1-warm-brass, wt1-air-choir, wt1-dark-swell, wt1-soft-keys, wt1-glass-mallet, wt1-muted-pluck, bl1-cinematic-sub, bl1-score-pulse, bl1-rounded-bass, dr1-cinematic. Also available: saw-lead, square-lead, soft-pad, pluck, bass, bell, wt1-prime-lead, wt1-bloom-pad, wt1-vox-morph, wt1-chime-bell, bl1-acid, bl1-deep, bl1-rubber, dr1-tr-void. Orchestral voices are synthesized. Play low strings around MIDI 36–55, ensembles around 48–79, and basses around 28–48. Drum pads use MIDI 36–51.")
1327
+ });
1328
+ /** `set_track_instrument`. The track owns the voice every clip on it plays. */
1329
+ export const setTrackInstrumentParams = z.object({
1330
+ track: trackTargetParam.describe("Midi track, by id or name."),
1331
+ instrument: z
1332
+ .union([midiInstrument, midiInstrumentPresetRef, samplerMidiInstrument.extend({
1333
+ zones: z.array(samplerZone.safeExtend({
1334
+ assetId: z.string().regex(/^(?:[a-f0-9]{12}|[a-f0-9]{32})$/)
1335
+ })).max(32)
1336
+ })])
1337
+ .describe('The voice this track\'s clips play, either way round. Named: `{"preset": "wt1-cinematic-strings"}`. See the preset field for available voices. Spelled out, there are four synths. `subtractive` is one oscillator through a lowpass filter and an ADSR envelope: `waveform` saw/square/triangle/sine, `attackMs`/`decayMs`/`releaseMs` in milliseconds, `sustain` 0..1 of the peak, `cutoffHz` the filter frequency in Hz, `resonance` its Q, `gainDb` the output level in dB. The other three are the FableSynth instruments: `wavetable` (WT-1) is two morphing wavetable oscillators plus a sub and noise through one filter swept by `modEnv`; `bass` (BL-1) is a monophonic acid line where a note at or above `accentVelocity` hits harder and a note overlapping the one before it glides over `slideMs`; `drum` (DR-1) is a kit of pads played one per note from `baseNote`, each ringing for its own decay however short the note is.')
1338
+ });
1339
+ export const SET_TRACK_INSTRUMENT_DESCRIPTION = "Set the synth a midi track plays. Every clip on the track uses it — the " +
1340
+ "track owns the instrument, not the clip — so moving a clip to another midi " +
1341
+ "track changes its sound.";
1342
+ /**
1343
+ * The quantize grids, duplicated from `QUANTIZE_DIVISIONS` in
1344
+ * `@nodetool-ai/timeline`: that package depends on this one, so the list
1345
+ * cannot be imported here. `packages/timeline/tests/midi.protocolCompat.test.ts`
1346
+ * pins the two equal.
1347
+ */
1348
+ export const QUANTIZE_DIVISION_VALUES = [
1349
+ "1/4",
1350
+ "1/8",
1351
+ "1/16",
1352
+ "1/32",
1353
+ "1/8T",
1354
+ "1/16T"
1355
+ ];
1356
+ /** `transpose_clip`. Moves every note in the clip, ids kept. */
1357
+ export const transposeClipParams = z.object({
1358
+ clip: targetParam,
1359
+ semitones: z
1360
+ .number()
1361
+ .int()
1362
+ .min(-48)
1363
+ .max(48)
1364
+ .describe("Whole semitones to move every note by. 12 is an octave up, -12 an octave down.")
1365
+ });
1366
+ export const TRANSPOSE_CLIP_DESCRIPTION = "Move every note in a midi clip by whole semitones (12 = one octave). A " +
1367
+ "note pushed past the 0..127 MIDI range is held at the end rather than " +
1368
+ "dropped, so transposing up and back down does not always return the same " +
1369
+ "phrase.";
1370
+ /** `quantize_notes`. Snaps onsets, and optionally lengths, to a note grid. */
1371
+ export const quantizeNotesParams = z.object({
1372
+ clip: targetParam,
1373
+ division: z
1374
+ .enum(QUANTIZE_DIVISION_VALUES)
1375
+ .describe("The grid, as a note value: 1/4, 1/8, 1/16, 1/32, or the triplets 1/8T and 1/16T. Ticks are PPQ 960, so 1/4 is 960 ticks, 1/16 is 240 and 1/8T is 320."),
1376
+ strength: z
1377
+ .number()
1378
+ .min(0)
1379
+ .max(1)
1380
+ .optional()
1381
+ .describe("How far toward the grid each note travels. 1 snaps exactly, 0.5 halves the distance, 0 changes nothing. Default 1."),
1382
+ target: z
1383
+ .enum(["start", "start_and_length"])
1384
+ .optional()
1385
+ .describe('"start" moves onsets only; "start_and_length" also rounds each held length to whole grid steps, never below one. Default "start".')
1386
+ });
1387
+ export const QUANTIZE_NOTES_DESCRIPTION = "Snap a midi clip's note onsets to a grid. The grid is a note value — 1/4, " +
1388
+ "1/8, 1/16, 1/32, or the triplets 1/8T and 1/16T — read in ticks at PPQ " +
1389
+ "960, so 1/4 is 960 ticks and 1/16 is 240. `strength` below 1 moves each " +
1390
+ "note part of the way and keeps the part's feel; `target` " +
1391
+ '"start_and_length" also rounds how long each note is held.';
1392
+ /** `scale_velocity`. Multiplies how hard every note is struck. */
1393
+ export const scaleVelocityParams = z.object({
1394
+ clip: targetParam,
1395
+ factor: z
1396
+ .number()
1397
+ .min(0.1)
1398
+ .max(4)
1399
+ .describe("Multiplier on every velocity. 1.2 plays the phrase harder, 0.8 softer.")
1400
+ });
1401
+ export const SCALE_VELOCITY_DESCRIPTION = "Scale how hard every note in a midi clip is struck. Velocities are clamped " +
1402
+ "to 1..127, so a large factor flattens the part's dynamics rather than " +
1403
+ "making it louder — set the track's `gainDb` for level.";
1404
+ // ── Smart Reframe ───────────────────────────────────────────────────────────
1405
+ const safeMarginParam = z
1406
+ .number()
1407
+ .min(0)
1408
+ .max(0.5)
1409
+ .optional()
1410
+ .describe("Safe margin around the followed subject, as a 0..0.5 fraction.");
1411
+ export const retargetFormatParams = z
1412
+ .object({
1413
+ aspect_ratio: z
1414
+ .string()
1415
+ .regex(/^\s*\d+(?:\.\d+)?\s*:\s*\d+(?:\.\d+)?\s*$/)
1416
+ .describe('Target display aspect, for example "9:16", "1:1" or "4:5".'),
1417
+ strategy: z.enum(["center", "smart", "track"]),
1418
+ safe_margin: safeMarginParam,
1419
+ track_ids: z
1420
+ .record(z.string(), z.string())
1421
+ .optional()
1422
+ .describe("Optional map of clip id to preferred MediaTrack id.")
1423
+ })
1424
+ .strict();
1425
+ export const setReframeSubjectParams = z
1426
+ .object({
1427
+ clip_id: z.string().min(1),
1428
+ track_id: z.string().min(1),
1429
+ safe_margin: safeMarginParam,
1430
+ smoothing: z.number().min(0).max(1).optional()
1431
+ })
1432
+ .strict();
1433
+ export const addReframeKeyframeParams = z
1434
+ .object({
1435
+ clip_id: z.string().min(1),
1436
+ source_ms: z.number().nonnegative(),
1437
+ x: z.number().min(0).max(1),
1438
+ y: z.number().min(0).max(1),
1439
+ zoom: z.number().min(1).optional()
1440
+ })
1441
+ .strict();
1442
+ export const clearReframeParams = z
1443
+ .object({ clip_id: z.string().min(1) })
1444
+ .strict();
1445
+ // ── The shared tool surface ─────────────────────────────────────────────────
1446
+ /**
1447
+ * Every `ui_timeline_*` tool both the headless bridge and the browser registry
1448
+ * must expose. A tool one surface has and the other lacks is the drift I11
1449
+ * forbids and no shared field list can catch on its own, so each side asserts
1450
+ * this list against what it registered
1451
+ * (`packages/agents/tests/timelines-op-input.test.ts`,
1452
+ * `web/src/lib/tools/__tests__/timelineTools.test.ts`).
1453
+ *
1454
+ * The tools only one host can implement are named in
1455
+ * `BROWSER_ONLY_TIMELINE_TOOL_NAMES` / `HEADLESS_ONLY_TIMELINE_TOOL_NAMES`
1456
+ * (`timeline-tool-contracts.ts`), and this list must match the contract record
1457
+ * there key for key — `packages/protocol/tests/ui-tool-contracts.test.ts`.
1458
+ */
1459
+ export const SHARED_TIMELINE_TOOL_NAMES = [
1460
+ "ui_timeline_get_state",
1461
+ "ui_timeline_get_clip_frames",
1462
+ "ui_timeline_add_track",
1463
+ "ui_timeline_move_track",
1464
+ "ui_timeline_delete_track",
1465
+ "ui_timeline_add_media_clip",
1466
+ "ui_timeline_add_text_clip",
1467
+ "ui_timeline_add_shape_clip",
1468
+ // 3D is picture, so it goes on a video or overlay track like any other
1469
+ // layer; the model is the clip's asset and the style is everything the
1470
+ // timeline adds on top.
1471
+ "ui_timeline_add_model3d_clip",
1472
+ "ui_timeline_set_model3d_style",
1473
+ "ui_timeline_bake_model3d_clip",
1474
+ "ui_timeline_add_group",
1475
+ "ui_timeline_generate_clip",
1476
+ "ui_timeline_generatively_edit_clip",
1477
+ "ui_timeline_apply_take",
1478
+ "ui_timeline_split_clip",
1479
+ "ui_timeline_trim_clip",
1480
+ "ui_timeline_move_clip",
1481
+ "ui_timeline_delete_clip",
1482
+ "ui_timeline_duplicate_clip",
1483
+ "ui_timeline_set_clip_params",
1484
+ "ui_timeline_set_parent",
1485
+ "ui_timeline_set_transition",
1486
+ "ui_timeline_set_mask",
1487
+ "ui_timeline_set_matte",
1488
+ "ui_timeline_set_time_remap",
1489
+ "ui_timeline_set_effects",
1490
+ "ui_timeline_set_clip_binding",
1491
+ "ui_timeline_animate_clip",
1492
+ "ui_timeline_stagger_animations",
1493
+ "ui_timeline_clear_animations",
1494
+ "ui_timeline_list_animation_presets",
1495
+ "ui_timeline_select_clip",
1496
+ "ui_timeline_seek",
1497
+ // T20's markers. Both surfaces register them, so they belong here rather
1498
+ // than in a hand-written list on either side.
1499
+ "ui_timeline_add_marker",
1500
+ "ui_timeline_delete_marker",
1501
+ // Both surfaces registered these from the start and neither list named them,
1502
+ // so nothing checked they stayed in step.
1503
+ "ui_timeline_set_markers_from_beats",
1504
+ "ui_timeline_snap_to_beats",
1505
+ // The midi surface: notes live on the clip, the instrument on the track,
1506
+ // and the tempo on the document, so each gets its own op.
1507
+ "ui_timeline_add_midi_clip",
1508
+ "ui_timeline_set_notes",
1509
+ "ui_timeline_set_tempo",
1510
+ "ui_timeline_set_track_instrument",
1511
+ // A2's note edits. Each rewrites the clip's whole note list, keeping ids.
1512
+ "ui_timeline_transpose_clip",
1513
+ "ui_timeline_quantize_notes",
1514
+ "ui_timeline_scale_velocity",
1515
+ // The guided video flow (PRD § 8.6). Both surfaces register them; the
1516
+ // headless one writes the plan itself where the editor asks the Director.
1517
+ "ui_timeline_set_setup",
1518
+ "ui_timeline_plan_beats",
1519
+ "ui_timeline_update_beat",
1520
+ "ui_timeline_remove_beat",
1521
+ "ui_timeline_generate_from_beats",
1522
+ // Smart Reframe is one shared edit surface: both hosts derive a sequence or
1523
+ // mutate the same persisted clip.reframe model through these contracts.
1524
+ "ui_timeline_retarget_format",
1525
+ "ui_timeline_set_reframe_subject",
1526
+ "ui_timeline_add_reframe_keyframe",
1527
+ "ui_timeline_clear_reframe"
1528
+ ];
1529
+ //# sourceMappingURL=timeline-tool-params.js.map