@nodetool-ai/agents 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 (1645) hide show
  1. package/README.md +35 -0
  2. package/dist/.nodetool-build-stamp +1 -0
  3. package/dist/analysis/audio-dsp.d.ts +224 -0
  4. package/dist/analysis/audio-dsp.d.ts.map +1 -0
  5. package/dist/analysis/audio-dsp.js +645 -0
  6. package/dist/analysis/audio-dsp.js.map +1 -0
  7. package/dist/analysis/media-decode.d.ts +98 -0
  8. package/dist/analysis/media-decode.d.ts.map +1 -0
  9. package/dist/analysis/media-decode.js +226 -0
  10. package/dist/analysis/media-decode.js.map +1 -0
  11. package/dist/analysis/mediabunny-runtime.d.ts +15 -0
  12. package/dist/analysis/mediabunny-runtime.d.ts.map +1 -0
  13. package/dist/analysis/mediabunny-runtime.js +30 -0
  14. package/dist/analysis/mediabunny-runtime.js.map +1 -0
  15. package/dist/analysis/video-frames.d.ts +120 -0
  16. package/dist/analysis/video-frames.d.ts.map +1 -0
  17. package/dist/analysis/video-frames.js +288 -0
  18. package/dist/analysis/video-frames.js.map +1 -0
  19. package/dist/apify/assets.d.ts +80 -0
  20. package/dist/apify/assets.d.ts.map +1 -0
  21. package/dist/apify/assets.js +192 -0
  22. package/dist/apify/assets.js.map +1 -0
  23. package/dist/apify/catalog.d.ts +44 -0
  24. package/dist/apify/catalog.d.ts.map +1 -0
  25. package/dist/apify/catalog.js +108 -0
  26. package/dist/apify/catalog.js.map +1 -0
  27. package/dist/apify/client.d.ts +137 -0
  28. package/dist/apify/client.d.ts.map +1 -0
  29. package/dist/apify/client.js +346 -0
  30. package/dist/apify/client.js.map +1 -0
  31. package/dist/apify/errors.d.ts +85 -0
  32. package/dist/apify/errors.d.ts.map +1 -0
  33. package/dist/apify/errors.js +90 -0
  34. package/dist/apify/errors.js.map +1 -0
  35. package/dist/apify/normalize.d.ts +131 -0
  36. package/dist/apify/normalize.d.ts.map +1 -0
  37. package/dist/apify/normalize.js +202 -0
  38. package/dist/apify/normalize.js.map +1 -0
  39. package/dist/apify/policy.d.ts +136 -0
  40. package/dist/apify/policy.d.ts.map +1 -0
  41. package/dist/apify/policy.js +223 -0
  42. package/dist/apify/policy.js.map +1 -0
  43. package/dist/apify/run.d.ts +86 -0
  44. package/dist/apify/run.d.ts.map +1 -0
  45. package/dist/apify/run.js +158 -0
  46. package/dist/apify/run.js.map +1 -0
  47. package/dist/app-build/author.d.ts +67 -0
  48. package/dist/app-build/author.d.ts.map +1 -0
  49. package/dist/app-build/author.js +231 -0
  50. package/dist/app-build/author.js.map +1 -0
  51. package/dist/app-build/bridge.d.ts +130 -0
  52. package/dist/app-build/bridge.d.ts.map +1 -0
  53. package/dist/app-build/bridge.js +647 -0
  54. package/dist/app-build/bridge.js.map +1 -0
  55. package/dist/app-build/build-service.d.ts +66 -0
  56. package/dist/app-build/build-service.d.ts.map +1 -0
  57. package/dist/app-build/build-service.js +249 -0
  58. package/dist/app-build/build-service.js.map +1 -0
  59. package/dist/app-build/build.d.ts +115 -0
  60. package/dist/app-build/build.d.ts.map +1 -0
  61. package/dist/app-build/build.js +901 -0
  62. package/dist/app-build/build.js.map +1 -0
  63. package/dist/app-build/interactions.d.ts +20 -0
  64. package/dist/app-build/interactions.d.ts.map +1 -0
  65. package/dist/app-build/interactions.js +121 -0
  66. package/dist/app-build/interactions.js.map +1 -0
  67. package/dist/app-build/judge.d.ts +113 -0
  68. package/dist/app-build/judge.d.ts.map +1 -0
  69. package/dist/app-build/judge.js +318 -0
  70. package/dist/app-build/judge.js.map +1 -0
  71. package/dist/app-build/markdown.d.ts +10 -0
  72. package/dist/app-build/markdown.d.ts.map +1 -0
  73. package/dist/app-build/markdown.js +65 -0
  74. package/dist/app-build/markdown.js.map +1 -0
  75. package/dist/app-build/spec.d.ts +228 -0
  76. package/dist/app-build/spec.d.ts.map +1 -0
  77. package/dist/app-build/spec.js +651 -0
  78. package/dist/app-build/spec.js.map +1 -0
  79. package/dist/app-build/tool-loop.d.ts +84 -0
  80. package/dist/app-build/tool-loop.d.ts.map +1 -0
  81. package/dist/app-build/tool-loop.js +113 -0
  82. package/dist/app-build/tool-loop.js.map +1 -0
  83. package/dist/app-build/types.d.ts +215 -0
  84. package/dist/app-build/types.d.ts.map +1 -0
  85. package/dist/app-build/types.js +28 -0
  86. package/dist/app-build/types.js.map +1 -0
  87. package/dist/author-graph.d.ts +90 -0
  88. package/dist/author-graph.d.ts.map +1 -0
  89. package/dist/author-graph.js +317 -0
  90. package/dist/author-graph.js.map +1 -0
  91. package/dist/background-subtasks.d.ts +79 -0
  92. package/dist/background-subtasks.d.ts.map +1 -0
  93. package/dist/background-subtasks.js +139 -0
  94. package/dist/background-subtasks.js.map +1 -0
  95. package/dist/blender-gate.d.ts +21 -0
  96. package/dist/blender-gate.d.ts.map +1 -0
  97. package/dist/blender-gate.js +27 -0
  98. package/dist/blender-gate.js.map +1 -0
  99. package/dist/browser-gate.d.ts +28 -0
  100. package/dist/browser-gate.d.ts.map +1 -0
  101. package/dist/browser-gate.js +34 -0
  102. package/dist/browser-gate.js.map +1 -0
  103. package/dist/capabilities/GamePublishRequest.d.ts +14 -0
  104. package/dist/capabilities/GamePublishRequest.d.ts.map +1 -0
  105. package/dist/capabilities/GamePublishRequest.js +2 -0
  106. package/dist/capabilities/GamePublishRequest.js.map +1 -0
  107. package/dist/capabilities/adapters.d.ts +27 -0
  108. package/dist/capabilities/adapters.d.ts.map +1 -0
  109. package/dist/capabilities/adapters.js +39 -0
  110. package/dist/capabilities/adapters.js.map +1 -0
  111. package/dist/capabilities/agent-activity.d.ts +27 -0
  112. package/dist/capabilities/agent-activity.d.ts.map +1 -0
  113. package/dist/capabilities/agent-activity.js +103 -0
  114. package/dist/capabilities/agent-activity.js.map +1 -0
  115. package/dist/capabilities/agentic-storyboard-finish.d.ts +67 -0
  116. package/dist/capabilities/agentic-storyboard-finish.d.ts.map +1 -0
  117. package/dist/capabilities/agentic-storyboard-finish.js +1321 -0
  118. package/dist/capabilities/agentic-storyboard-finish.js.map +1 -0
  119. package/dist/capabilities/agents.d.ts +81 -0
  120. package/dist/capabilities/agents.d.ts.map +1 -0
  121. package/dist/capabilities/agents.js +376 -0
  122. package/dist/capabilities/agents.js.map +1 -0
  123. package/dist/capabilities/agents.specs.d.ts +30 -0
  124. package/dist/capabilities/agents.specs.d.ts.map +1 -0
  125. package/dist/capabilities/agents.specs.js +313 -0
  126. package/dist/capabilities/agents.specs.js.map +1 -0
  127. package/dist/capabilities/analysis.d.ts +93 -0
  128. package/dist/capabilities/analysis.d.ts.map +1 -0
  129. package/dist/capabilities/analysis.js +823 -0
  130. package/dist/capabilities/analysis.js.map +1 -0
  131. package/dist/capabilities/analysis.specs.d.ts +39 -0
  132. package/dist/capabilities/analysis.specs.d.ts.map +1 -0
  133. package/dist/capabilities/analysis.specs.js +217 -0
  134. package/dist/capabilities/analysis.specs.js.map +1 -0
  135. package/dist/capabilities/apify.d.ts +34 -0
  136. package/dist/capabilities/apify.d.ts.map +1 -0
  137. package/dist/capabilities/apify.js +449 -0
  138. package/dist/capabilities/apify.js.map +1 -0
  139. package/dist/capabilities/apify.specs.d.ts +28 -0
  140. package/dist/capabilities/apify.specs.d.ts.map +1 -0
  141. package/dist/capabilities/apify.specs.js +232 -0
  142. package/dist/capabilities/apify.specs.js.map +1 -0
  143. package/dist/capabilities/apps.d.ts +40 -0
  144. package/dist/capabilities/apps.d.ts.map +1 -0
  145. package/dist/capabilities/apps.js +415 -0
  146. package/dist/capabilities/apps.js.map +1 -0
  147. package/dist/capabilities/apps.specs.d.ts +23 -0
  148. package/dist/capabilities/apps.specs.d.ts.map +1 -0
  149. package/dist/capabilities/apps.specs.js +236 -0
  150. package/dist/capabilities/apps.specs.js.map +1 -0
  151. package/dist/capabilities/args.d.ts +62 -0
  152. package/dist/capabilities/args.d.ts.map +1 -0
  153. package/dist/capabilities/args.js +215 -0
  154. package/dist/capabilities/args.js.map +1 -0
  155. package/dist/capabilities/assets.d.ts +45 -0
  156. package/dist/capabilities/assets.d.ts.map +1 -0
  157. package/dist/capabilities/assets.js +952 -0
  158. package/dist/capabilities/assets.js.map +1 -0
  159. package/dist/capabilities/assets.specs.d.ts +54 -0
  160. package/dist/capabilities/assets.specs.d.ts.map +1 -0
  161. package/dist/capabilities/assets.specs.js +291 -0
  162. package/dist/capabilities/assets.specs.js.map +1 -0
  163. package/dist/capabilities/background-generation.d.ts +14 -0
  164. package/dist/capabilities/background-generation.d.ts.map +1 -0
  165. package/dist/capabilities/background-generation.js +29 -0
  166. package/dist/capabilities/background-generation.js.map +1 -0
  167. package/dist/capabilities/browser.d.ts +30 -0
  168. package/dist/capabilities/browser.d.ts.map +1 -0
  169. package/dist/capabilities/browser.js +250 -0
  170. package/dist/capabilities/browser.js.map +1 -0
  171. package/dist/capabilities/browser.specs.d.ts +37 -0
  172. package/dist/capabilities/browser.specs.d.ts.map +1 -0
  173. package/dist/capabilities/browser.specs.js +173 -0
  174. package/dist/capabilities/browser.specs.js.map +1 -0
  175. package/dist/capabilities/code-grading.d.ts +68 -0
  176. package/dist/capabilities/code-grading.d.ts.map +1 -0
  177. package/dist/capabilities/code-grading.js +75 -0
  178. package/dist/capabilities/code-grading.js.map +1 -0
  179. package/dist/capabilities/code.d.ts +61 -0
  180. package/dist/capabilities/code.d.ts.map +1 -0
  181. package/dist/capabilities/code.js +366 -0
  182. package/dist/capabilities/code.js.map +1 -0
  183. package/dist/capabilities/code.specs.d.ts +22 -0
  184. package/dist/capabilities/code.specs.d.ts.map +1 -0
  185. package/dist/capabilities/code.specs.js +175 -0
  186. package/dist/capabilities/code.specs.js.map +1 -0
  187. package/dist/capabilities/collections.d.ts +44 -0
  188. package/dist/capabilities/collections.d.ts.map +1 -0
  189. package/dist/capabilities/collections.js +432 -0
  190. package/dist/capabilities/collections.js.map +1 -0
  191. package/dist/capabilities/collections.specs.d.ts +25 -0
  192. package/dist/capabilities/collections.specs.d.ts.map +1 -0
  193. package/dist/capabilities/collections.specs.js +299 -0
  194. package/dist/capabilities/collections.specs.js.map +1 -0
  195. package/dist/capabilities/compositions.d.ts +57 -0
  196. package/dist/capabilities/compositions.d.ts.map +1 -0
  197. package/dist/capabilities/compositions.js +384 -0
  198. package/dist/capabilities/compositions.js.map +1 -0
  199. package/dist/capabilities/compositions.specs.d.ts +22 -0
  200. package/dist/capabilities/compositions.specs.d.ts.map +1 -0
  201. package/dist/capabilities/compositions.specs.js +126 -0
  202. package/dist/capabilities/compositions.specs.js.map +1 -0
  203. package/dist/capabilities/concurrency.d.ts +12 -0
  204. package/dist/capabilities/concurrency.d.ts.map +1 -0
  205. package/dist/capabilities/concurrency.js +30 -0
  206. package/dist/capabilities/concurrency.js.map +1 -0
  207. package/dist/capabilities/costs.d.ts +20 -0
  208. package/dist/capabilities/costs.d.ts.map +1 -0
  209. package/dist/capabilities/costs.js +40 -0
  210. package/dist/capabilities/costs.js.map +1 -0
  211. package/dist/capabilities/costs.specs.d.ts +12 -0
  212. package/dist/capabilities/costs.specs.d.ts.map +1 -0
  213. package/dist/capabilities/costs.specs.js +35 -0
  214. package/dist/capabilities/costs.specs.js.map +1 -0
  215. package/dist/capabilities/dispatcher.d.ts +57 -0
  216. package/dist/capabilities/dispatcher.d.ts.map +1 -0
  217. package/dist/capabilities/dispatcher.js +117 -0
  218. package/dist/capabilities/dispatcher.js.map +1 -0
  219. package/dist/capabilities/documents.d.ts +25 -0
  220. package/dist/capabilities/documents.d.ts.map +1 -0
  221. package/dist/capabilities/documents.js +278 -0
  222. package/dist/capabilities/documents.js.map +1 -0
  223. package/dist/capabilities/documents.specs.d.ts +18 -0
  224. package/dist/capabilities/documents.specs.d.ts.map +1 -0
  225. package/dist/capabilities/documents.specs.js +201 -0
  226. package/dist/capabilities/documents.specs.js.map +1 -0
  227. package/dist/capabilities/email.d.ts +23 -0
  228. package/dist/capabilities/email.d.ts.map +1 -0
  229. package/dist/capabilities/email.js +226 -0
  230. package/dist/capabilities/email.js.map +1 -0
  231. package/dist/capabilities/email.specs.d.ts +16 -0
  232. package/dist/capabilities/email.specs.d.ts.map +1 -0
  233. package/dist/capabilities/email.specs.js +102 -0
  234. package/dist/capabilities/email.specs.js.map +1 -0
  235. package/dist/capabilities/entities.d.ts +52 -0
  236. package/dist/capabilities/entities.d.ts.map +1 -0
  237. package/dist/capabilities/entities.js +478 -0
  238. package/dist/capabilities/entities.js.map +1 -0
  239. package/dist/capabilities/entities.specs.d.ts +25 -0
  240. package/dist/capabilities/entities.specs.d.ts.map +1 -0
  241. package/dist/capabilities/entities.specs.js +247 -0
  242. package/dist/capabilities/entities.specs.js.map +1 -0
  243. package/dist/capabilities/errors.d.ts +19 -0
  244. package/dist/capabilities/errors.d.ts.map +1 -0
  245. package/dist/capabilities/errors.js +109 -0
  246. package/dist/capabilities/errors.js.map +1 -0
  247. package/dist/capabilities/errors.specs.d.ts +11 -0
  248. package/dist/capabilities/errors.specs.d.ts.map +1 -0
  249. package/dist/capabilities/errors.specs.js +100 -0
  250. package/dist/capabilities/errors.specs.js.map +1 -0
  251. package/dist/capabilities/example-timelines.d.ts +3 -0
  252. package/dist/capabilities/example-timelines.d.ts.map +1 -0
  253. package/dist/capabilities/example-timelines.js +233 -0
  254. package/dist/capabilities/example-timelines.js.map +1 -0
  255. package/dist/capabilities/example-timelines.specs.d.ts +6 -0
  256. package/dist/capabilities/example-timelines.specs.d.ts.map +1 -0
  257. package/dist/capabilities/example-timelines.specs.js +71 -0
  258. package/dist/capabilities/example-timelines.specs.js.map +1 -0
  259. package/dist/capabilities/files.d.ts +53 -0
  260. package/dist/capabilities/files.d.ts.map +1 -0
  261. package/dist/capabilities/files.js +1172 -0
  262. package/dist/capabilities/files.js.map +1 -0
  263. package/dist/capabilities/files.specs.d.ts +28 -0
  264. package/dist/capabilities/files.specs.d.ts.map +1 -0
  265. package/dist/capabilities/files.specs.js +259 -0
  266. package/dist/capabilities/files.specs.js.map +1 -0
  267. package/dist/capabilities/finish-storyboard.d.ts +5 -0
  268. package/dist/capabilities/finish-storyboard.d.ts.map +1 -0
  269. package/dist/capabilities/finish-storyboard.js +278 -0
  270. package/dist/capabilities/finish-storyboard.js.map +1 -0
  271. package/dist/capabilities/flow.d.ts +93 -0
  272. package/dist/capabilities/flow.d.ts.map +1 -0
  273. package/dist/capabilities/flow.js +285 -0
  274. package/dist/capabilities/flow.js.map +1 -0
  275. package/dist/capabilities/flow.specs.d.ts +25 -0
  276. package/dist/capabilities/flow.specs.d.ts.map +1 -0
  277. package/dist/capabilities/flow.specs.js +114 -0
  278. package/dist/capabilities/flow.specs.js.map +1 -0
  279. package/dist/capabilities/game-asset-source.d.ts +31 -0
  280. package/dist/capabilities/game-asset-source.d.ts.map +1 -0
  281. package/dist/capabilities/game-asset-source.js +81 -0
  282. package/dist/capabilities/game-asset-source.js.map +1 -0
  283. package/dist/capabilities/game.d.ts +24 -0
  284. package/dist/capabilities/game.d.ts.map +1 -0
  285. package/dist/capabilities/game.js +1432 -0
  286. package/dist/capabilities/game.js.map +1 -0
  287. package/dist/capabilities/game.specs.d.ts +5 -0
  288. package/dist/capabilities/game.specs.d.ts.map +1 -0
  289. package/dist/capabilities/game.specs.js +110 -0
  290. package/dist/capabilities/game.specs.js.map +1 -0
  291. package/dist/capabilities/game3d.d.ts +17 -0
  292. package/dist/capabilities/game3d.d.ts.map +1 -0
  293. package/dist/capabilities/game3d.js +433 -0
  294. package/dist/capabilities/game3d.js.map +1 -0
  295. package/dist/capabilities/gate-from-context.d.ts +39 -0
  296. package/dist/capabilities/gate-from-context.d.ts.map +1 -0
  297. package/dist/capabilities/gate-from-context.js +97 -0
  298. package/dist/capabilities/gate-from-context.js.map +1 -0
  299. package/dist/capabilities/generations.d.ts +81 -0
  300. package/dist/capabilities/generations.d.ts.map +1 -0
  301. package/dist/capabilities/generations.js +387 -0
  302. package/dist/capabilities/generations.js.map +1 -0
  303. package/dist/capabilities/generations.specs.d.ts +62 -0
  304. package/dist/capabilities/generations.specs.d.ts.map +1 -0
  305. package/dist/capabilities/generations.specs.js +230 -0
  306. package/dist/capabilities/generations.specs.js.map +1 -0
  307. package/dist/capabilities/google.d.ts +50 -0
  308. package/dist/capabilities/google.d.ts.map +1 -0
  309. package/dist/capabilities/google.js +246 -0
  310. package/dist/capabilities/google.js.map +1 -0
  311. package/dist/capabilities/google.specs.d.ts +52 -0
  312. package/dist/capabilities/google.specs.d.ts.map +1 -0
  313. package/dist/capabilities/google.specs.js +391 -0
  314. package/dist/capabilities/google.specs.js.map +1 -0
  315. package/dist/capabilities/html-text.d.ts +28 -0
  316. package/dist/capabilities/html-text.d.ts.map +1 -0
  317. package/dist/capabilities/html-text.js +76 -0
  318. package/dist/capabilities/html-text.js.map +1 -0
  319. package/dist/capabilities/index.d.ts +19 -0
  320. package/dist/capabilities/index.d.ts.map +1 -0
  321. package/dist/capabilities/index.js +14 -0
  322. package/dist/capabilities/index.js.map +1 -0
  323. package/dist/capabilities/invoke.d.ts +78 -0
  324. package/dist/capabilities/invoke.d.ts.map +1 -0
  325. package/dist/capabilities/invoke.js +251 -0
  326. package/dist/capabilities/invoke.js.map +1 -0
  327. package/dist/capabilities/jobs.d.ts +32 -0
  328. package/dist/capabilities/jobs.d.ts.map +1 -0
  329. package/dist/capabilities/jobs.js +167 -0
  330. package/dist/capabilities/jobs.js.map +1 -0
  331. package/dist/capabilities/jobs.specs.d.ts +20 -0
  332. package/dist/capabilities/jobs.specs.d.ts.map +1 -0
  333. package/dist/capabilities/jobs.specs.js +105 -0
  334. package/dist/capabilities/jobs.specs.js.map +1 -0
  335. package/dist/capabilities/js-scripts.d.ts +108 -0
  336. package/dist/capabilities/js-scripts.d.ts.map +1 -0
  337. package/dist/capabilities/js-scripts.js +807 -0
  338. package/dist/capabilities/js-scripts.js.map +1 -0
  339. package/dist/capabilities/js-scripts.specs.d.ts +52 -0
  340. package/dist/capabilities/js-scripts.specs.d.ts.map +1 -0
  341. package/dist/capabilities/js-scripts.specs.js +394 -0
  342. package/dist/capabilities/js-scripts.specs.js.map +1 -0
  343. package/dist/capabilities/lazy-tool.d.ts +41 -0
  344. package/dist/capabilities/lazy-tool.d.ts.map +1 -0
  345. package/dist/capabilities/lazy-tool.js +82 -0
  346. package/dist/capabilities/lazy-tool.js.map +1 -0
  347. package/dist/capabilities/legacy-tools.d.ts +15 -0
  348. package/dist/capabilities/legacy-tools.d.ts.map +1 -0
  349. package/dist/capabilities/legacy-tools.js +98 -0
  350. package/dist/capabilities/legacy-tools.js.map +1 -0
  351. package/dist/capabilities/local-browser.d.ts +24 -0
  352. package/dist/capabilities/local-browser.d.ts.map +1 -0
  353. package/dist/capabilities/local-browser.js +105 -0
  354. package/dist/capabilities/local-browser.js.map +1 -0
  355. package/dist/capabilities/media.d.ts +112 -0
  356. package/dist/capabilities/media.d.ts.map +1 -0
  357. package/dist/capabilities/media.js +2258 -0
  358. package/dist/capabilities/media.js.map +1 -0
  359. package/dist/capabilities/media.specs.d.ts +65 -0
  360. package/dist/capabilities/media.specs.d.ts.map +1 -0
  361. package/dist/capabilities/media.specs.js +779 -0
  362. package/dist/capabilities/media.specs.js.map +1 -0
  363. package/dist/capabilities/memory.d.ts +31 -0
  364. package/dist/capabilities/memory.d.ts.map +1 -0
  365. package/dist/capabilities/memory.js +403 -0
  366. package/dist/capabilities/memory.js.map +1 -0
  367. package/dist/capabilities/memory.specs.d.ts +55 -0
  368. package/dist/capabilities/memory.specs.d.ts.map +1 -0
  369. package/dist/capabilities/memory.specs.js +208 -0
  370. package/dist/capabilities/memory.specs.js.map +1 -0
  371. package/dist/capabilities/model3d.d.ts +29 -0
  372. package/dist/capabilities/model3d.d.ts.map +1 -0
  373. package/dist/capabilities/model3d.js +482 -0
  374. package/dist/capabilities/model3d.js.map +1 -0
  375. package/dist/capabilities/model3d.specs.d.ts +28 -0
  376. package/dist/capabilities/model3d.specs.d.ts.map +1 -0
  377. package/dist/capabilities/model3d.specs.js +305 -0
  378. package/dist/capabilities/model3d.specs.js.map +1 -0
  379. package/dist/capabilities/models.d.ts +138 -0
  380. package/dist/capabilities/models.d.ts.map +1 -0
  381. package/dist/capabilities/models.js +805 -0
  382. package/dist/capabilities/models.js.map +1 -0
  383. package/dist/capabilities/models.specs.d.ts +21 -0
  384. package/dist/capabilities/models.specs.d.ts.map +1 -0
  385. package/dist/capabilities/models.specs.js +141 -0
  386. package/dist/capabilities/models.specs.js.map +1 -0
  387. package/dist/capabilities/nodes.d.ts +26 -0
  388. package/dist/capabilities/nodes.d.ts.map +1 -0
  389. package/dist/capabilities/nodes.js +266 -0
  390. package/dist/capabilities/nodes.js.map +1 -0
  391. package/dist/capabilities/nodes.specs.d.ts +20 -0
  392. package/dist/capabilities/nodes.specs.d.ts.map +1 -0
  393. package/dist/capabilities/nodes.specs.js +106 -0
  394. package/dist/capabilities/nodes.specs.js.map +1 -0
  395. package/dist/capabilities/packs.d.ts +69 -0
  396. package/dist/capabilities/packs.d.ts.map +1 -0
  397. package/dist/capabilities/packs.js +246 -0
  398. package/dist/capabilities/packs.js.map +1 -0
  399. package/dist/capabilities/packs.specs.d.ts +27 -0
  400. package/dist/capabilities/packs.specs.d.ts.map +1 -0
  401. package/dist/capabilities/packs.specs.js +64 -0
  402. package/dist/capabilities/packs.specs.js.map +1 -0
  403. package/dist/capabilities/project-scope.d.ts +12 -0
  404. package/dist/capabilities/project-scope.d.ts.map +1 -0
  405. package/dist/capabilities/project-scope.js +19 -0
  406. package/dist/capabilities/project-scope.js.map +1 -0
  407. package/dist/capabilities/projects.d.ts +23 -0
  408. package/dist/capabilities/projects.d.ts.map +1 -0
  409. package/dist/capabilities/projects.js +206 -0
  410. package/dist/capabilities/projects.js.map +1 -0
  411. package/dist/capabilities/projects.specs.d.ts +23 -0
  412. package/dist/capabilities/projects.specs.d.ts.map +1 -0
  413. package/dist/capabilities/projects.specs.js +118 -0
  414. package/dist/capabilities/projects.specs.js.map +1 -0
  415. package/dist/capabilities/registry.d.ts +111 -0
  416. package/dist/capabilities/registry.d.ts.map +1 -0
  417. package/dist/capabilities/registry.js +473 -0
  418. package/dist/capabilities/registry.js.map +1 -0
  419. package/dist/capabilities/run-agent.d.ts +19 -0
  420. package/dist/capabilities/run-agent.d.ts.map +1 -0
  421. package/dist/capabilities/run-agent.js +183 -0
  422. package/dist/capabilities/run-agent.js.map +1 -0
  423. package/dist/capabilities/runs.d.ts +9 -0
  424. package/dist/capabilities/runs.d.ts.map +1 -0
  425. package/dist/capabilities/runs.js +46 -0
  426. package/dist/capabilities/runs.js.map +1 -0
  427. package/dist/capabilities/runs.specs.d.ts +39 -0
  428. package/dist/capabilities/runs.specs.d.ts.map +1 -0
  429. package/dist/capabilities/runs.specs.js +52 -0
  430. package/dist/capabilities/runs.specs.js.map +1 -0
  431. package/dist/capabilities/script-link.d.ts +22 -0
  432. package/dist/capabilities/script-link.d.ts.map +1 -0
  433. package/dist/capabilities/script-link.js +35 -0
  434. package/dist/capabilities/script-link.js.map +1 -0
  435. package/dist/capabilities/scripts.d.ts +43 -0
  436. package/dist/capabilities/scripts.d.ts.map +1 -0
  437. package/dist/capabilities/scripts.js +1795 -0
  438. package/dist/capabilities/scripts.js.map +1 -0
  439. package/dist/capabilities/scripts.specs.d.ts +40 -0
  440. package/dist/capabilities/scripts.specs.d.ts.map +1 -0
  441. package/dist/capabilities/scripts.specs.js +319 -0
  442. package/dist/capabilities/scripts.specs.js.map +1 -0
  443. package/dist/capabilities/serpapi.d.ts +42 -0
  444. package/dist/capabilities/serpapi.d.ts.map +1 -0
  445. package/dist/capabilities/serpapi.js +262 -0
  446. package/dist/capabilities/serpapi.js.map +1 -0
  447. package/dist/capabilities/serpapi.specs.d.ts +24 -0
  448. package/dist/capabilities/serpapi.specs.d.ts.map +1 -0
  449. package/dist/capabilities/serpapi.specs.js +174 -0
  450. package/dist/capabilities/serpapi.specs.js.map +1 -0
  451. package/dist/capabilities/settings.d.ts +48 -0
  452. package/dist/capabilities/settings.d.ts.map +1 -0
  453. package/dist/capabilities/settings.js +226 -0
  454. package/dist/capabilities/settings.js.map +1 -0
  455. package/dist/capabilities/settings.specs.d.ts +42 -0
  456. package/dist/capabilities/settings.specs.d.ts.map +1 -0
  457. package/dist/capabilities/settings.specs.js +126 -0
  458. package/dist/capabilities/settings.specs.js.map +1 -0
  459. package/dist/capabilities/shared.d.ts +35 -0
  460. package/dist/capabilities/shared.d.ts.map +1 -0
  461. package/dist/capabilities/shared.js +165 -0
  462. package/dist/capabilities/shared.js.map +1 -0
  463. package/dist/capabilities/shared.specs.d.ts +19 -0
  464. package/dist/capabilities/shared.specs.d.ts.map +1 -0
  465. package/dist/capabilities/shared.specs.js +134 -0
  466. package/dist/capabilities/shared.specs.js.map +1 -0
  467. package/dist/capabilities/sketches.d.ts +52 -0
  468. package/dist/capabilities/sketches.d.ts.map +1 -0
  469. package/dist/capabilities/sketches.js +1165 -0
  470. package/dist/capabilities/sketches.js.map +1 -0
  471. package/dist/capabilities/sketches.specs.d.ts +44 -0
  472. package/dist/capabilities/sketches.specs.d.ts.map +1 -0
  473. package/dist/capabilities/sketches.specs.js +392 -0
  474. package/dist/capabilities/sketches.specs.js.map +1 -0
  475. package/dist/capabilities/skills.d.ts +28 -0
  476. package/dist/capabilities/skills.d.ts.map +1 -0
  477. package/dist/capabilities/skills.js +289 -0
  478. package/dist/capabilities/skills.js.map +1 -0
  479. package/dist/capabilities/skills.specs.d.ts +17 -0
  480. package/dist/capabilities/skills.specs.d.ts.map +1 -0
  481. package/dist/capabilities/skills.specs.js +108 -0
  482. package/dist/capabilities/skills.specs.js.map +1 -0
  483. package/dist/capabilities/storyboard-layout-check.d.ts +33 -0
  484. package/dist/capabilities/storyboard-layout-check.d.ts.map +1 -0
  485. package/dist/capabilities/storyboard-layout-check.js +229 -0
  486. package/dist/capabilities/storyboard-layout-check.js.map +1 -0
  487. package/dist/capabilities/storyboard-measured-sources.d.ts +10 -0
  488. package/dist/capabilities/storyboard-measured-sources.d.ts.map +1 -0
  489. package/dist/capabilities/storyboard-measured-sources.js +67 -0
  490. package/dist/capabilities/storyboard-measured-sources.js.map +1 -0
  491. package/dist/capabilities/storyboard-review-times.d.ts +4 -0
  492. package/dist/capabilities/storyboard-review-times.d.ts.map +1 -0
  493. package/dist/capabilities/storyboard-review-times.js +39 -0
  494. package/dist/capabilities/storyboard-review-times.js.map +1 -0
  495. package/dist/capabilities/storyboards.d.ts +52 -0
  496. package/dist/capabilities/storyboards.d.ts.map +1 -0
  497. package/dist/capabilities/storyboards.js +2467 -0
  498. package/dist/capabilities/storyboards.js.map +1 -0
  499. package/dist/capabilities/storyboards.specs.d.ts +45 -0
  500. package/dist/capabilities/storyboards.specs.d.ts.map +1 -0
  501. package/dist/capabilities/storyboards.specs.js +457 -0
  502. package/dist/capabilities/storyboards.specs.js.map +1 -0
  503. package/dist/capabilities/threads.d.ts +25 -0
  504. package/dist/capabilities/threads.d.ts.map +1 -0
  505. package/dist/capabilities/threads.js +240 -0
  506. package/dist/capabilities/threads.js.map +1 -0
  507. package/dist/capabilities/threads.specs.d.ts +26 -0
  508. package/dist/capabilities/threads.specs.d.ts.map +1 -0
  509. package/dist/capabilities/threads.specs.js +108 -0
  510. package/dist/capabilities/threads.specs.js.map +1 -0
  511. package/dist/capabilities/timeline-audio-bake.d.ts +114 -0
  512. package/dist/capabilities/timeline-audio-bake.d.ts.map +1 -0
  513. package/dist/capabilities/timeline-audio-bake.js +188 -0
  514. package/dist/capabilities/timeline-audio-bake.js.map +1 -0
  515. package/dist/capabilities/timeline-bake.d.ts +21 -0
  516. package/dist/capabilities/timeline-bake.d.ts.map +1 -0
  517. package/dist/capabilities/timeline-bake.js +118 -0
  518. package/dist/capabilities/timeline-bake.js.map +1 -0
  519. package/dist/capabilities/timeline-bridge.d.ts +359 -0
  520. package/dist/capabilities/timeline-bridge.d.ts.map +1 -0
  521. package/dist/capabilities/timeline-bridge.js +1016 -0
  522. package/dist/capabilities/timeline-bridge.js.map +1 -0
  523. package/dist/capabilities/timeline-clip-frames.d.ts +17 -0
  524. package/dist/capabilities/timeline-clip-frames.d.ts.map +1 -0
  525. package/dist/capabilities/timeline-clip-frames.js +84 -0
  526. package/dist/capabilities/timeline-clip-frames.js.map +1 -0
  527. package/dist/capabilities/timeline-isolate-subject.d.ts +157 -0
  528. package/dist/capabilities/timeline-isolate-subject.d.ts.map +1 -0
  529. package/dist/capabilities/timeline-isolate-subject.js +293 -0
  530. package/dist/capabilities/timeline-isolate-subject.js.map +1 -0
  531. package/dist/capabilities/timeline-media-edit.d.ts +8 -0
  532. package/dist/capabilities/timeline-media-edit.d.ts.map +1 -0
  533. package/dist/capabilities/timeline-media-edit.js +94 -0
  534. package/dist/capabilities/timeline-media-edit.js.map +1 -0
  535. package/dist/capabilities/timeline-native-media.d.ts +4 -0
  536. package/dist/capabilities/timeline-native-media.d.ts.map +1 -0
  537. package/dist/capabilities/timeline-native-media.js +960 -0
  538. package/dist/capabilities/timeline-native-media.js.map +1 -0
  539. package/dist/capabilities/timeline-track-object.d.ts +83 -0
  540. package/dist/capabilities/timeline-track-object.d.ts.map +1 -0
  541. package/dist/capabilities/timeline-track-object.js +195 -0
  542. package/dist/capabilities/timeline-track-object.js.map +1 -0
  543. package/dist/capabilities/timelines.d.ts +250 -0
  544. package/dist/capabilities/timelines.d.ts.map +1 -0
  545. package/dist/capabilities/timelines.js +2825 -0
  546. package/dist/capabilities/timelines.js.map +1 -0
  547. package/dist/capabilities/timelines.specs.d.ts +142 -0
  548. package/dist/capabilities/timelines.specs.d.ts.map +1 -0
  549. package/dist/capabilities/timelines.specs.js +1527 -0
  550. package/dist/capabilities/timelines.specs.js.map +1 -0
  551. package/dist/capabilities/types.d.ts +199 -0
  552. package/dist/capabilities/types.d.ts.map +1 -0
  553. package/dist/capabilities/types.js +19 -0
  554. package/dist/capabilities/types.js.map +1 -0
  555. package/dist/capabilities/ui.d.ts +38 -0
  556. package/dist/capabilities/ui.d.ts.map +1 -0
  557. package/dist/capabilities/ui.js +150 -0
  558. package/dist/capabilities/ui.js.map +1 -0
  559. package/dist/capabilities/ui.specs.d.ts +22 -0
  560. package/dist/capabilities/ui.specs.d.ts.map +1 -0
  561. package/dist/capabilities/ui.specs.js +59 -0
  562. package/dist/capabilities/ui.specs.js.map +1 -0
  563. package/dist/capabilities/video-production-acceptance.d.ts +27 -0
  564. package/dist/capabilities/video-production-acceptance.d.ts.map +1 -0
  565. package/dist/capabilities/video-production-acceptance.js +41 -0
  566. package/dist/capabilities/video-production-acceptance.js.map +1 -0
  567. package/dist/capabilities/video-production.d.ts +179 -0
  568. package/dist/capabilities/video-production.d.ts.map +1 -0
  569. package/dist/capabilities/video-production.js +1492 -0
  570. package/dist/capabilities/video-production.js.map +1 -0
  571. package/dist/capabilities/video-production.specs.d.ts +13 -0
  572. package/dist/capabilities/video-production.specs.d.ts.map +1 -0
  573. package/dist/capabilities/video-production.specs.js +256 -0
  574. package/dist/capabilities/video-production.specs.js.map +1 -0
  575. package/dist/capabilities/web.d.ts +86 -0
  576. package/dist/capabilities/web.d.ts.map +1 -0
  577. package/dist/capabilities/web.js +850 -0
  578. package/dist/capabilities/web.js.map +1 -0
  579. package/dist/capabilities/web.specs.d.ts +33 -0
  580. package/dist/capabilities/web.specs.d.ts.map +1 -0
  581. package/dist/capabilities/web.specs.js +286 -0
  582. package/dist/capabilities/web.specs.js.map +1 -0
  583. package/dist/capabilities/workflows.d.ts +58 -0
  584. package/dist/capabilities/workflows.d.ts.map +1 -0
  585. package/dist/capabilities/workflows.js +1557 -0
  586. package/dist/capabilities/workflows.js.map +1 -0
  587. package/dist/capabilities/workflows.specs.d.ts +63 -0
  588. package/dist/capabilities/workflows.specs.d.ts.map +1 -0
  589. package/dist/capabilities/workflows.specs.js +858 -0
  590. package/dist/capabilities/workflows.specs.js.map +1 -0
  591. package/dist/code-gen/analyze.d.ts +26 -0
  592. package/dist/code-gen/analyze.d.ts.map +1 -0
  593. package/dist/code-gen/analyze.js +79 -0
  594. package/dist/code-gen/analyze.js.map +1 -0
  595. package/dist/code-gen/port-types.d.ts +58 -0
  596. package/dist/code-gen/port-types.d.ts.map +1 -0
  597. package/dist/code-gen/port-types.js +115 -0
  598. package/dist/code-gen/port-types.js.map +1 -0
  599. package/dist/code-gen/prompt.d.ts +37 -0
  600. package/dist/code-gen/prompt.d.ts.map +1 -0
  601. package/dist/code-gen/prompt.js +129 -0
  602. package/dist/code-gen/prompt.js.map +1 -0
  603. package/dist/code-gen/sandbox-manifest.d.ts +120 -0
  604. package/dist/code-gen/sandbox-manifest.d.ts.map +1 -0
  605. package/dist/code-gen/sandbox-manifest.js +1023 -0
  606. package/dist/code-gen/sandbox-manifest.js.map +1 -0
  607. package/dist/code-gen/sandbox-prompt.d.ts +26 -0
  608. package/dist/code-gen/sandbox-prompt.d.ts.map +1 -0
  609. package/dist/code-gen/sandbox-prompt.js +126 -0
  610. package/dist/code-gen/sandbox-prompt.js.map +1 -0
  611. package/dist/code-planner.d.ts +72 -0
  612. package/dist/code-planner.d.ts.map +1 -0
  613. package/dist/code-planner.js +271 -0
  614. package/dist/code-planner.js.map +1 -0
  615. package/dist/codeact/action-diagnostics.d.ts +35 -0
  616. package/dist/codeact/action-diagnostics.d.ts.map +1 -0
  617. package/dist/codeact/action-diagnostics.js +197 -0
  618. package/dist/codeact/action-diagnostics.js.map +1 -0
  619. package/dist/codeact/capability-modules.d.ts +66 -0
  620. package/dist/codeact/capability-modules.d.ts.map +1 -0
  621. package/dist/codeact/capability-modules.js +278 -0
  622. package/dist/codeact/capability-modules.js.map +1 -0
  623. package/dist/codeact/chat-codeact.d.ts +104 -0
  624. package/dist/codeact/chat-codeact.d.ts.map +1 -0
  625. package/dist/codeact/chat-codeact.js +424 -0
  626. package/dist/codeact/chat-codeact.js.map +1 -0
  627. package/dist/codeact/codeact-executor.d.ts +247 -0
  628. package/dist/codeact/codeact-executor.d.ts.map +1 -0
  629. package/dist/codeact/codeact-executor.js +1184 -0
  630. package/dist/codeact/codeact-executor.js.map +1 -0
  631. package/dist/codeact/compact-ids.d.ts +28 -0
  632. package/dist/codeact/compact-ids.d.ts.map +1 -0
  633. package/dist/codeact/compact-ids.js +81 -0
  634. package/dist/codeact/compact-ids.js.map +1 -0
  635. package/dist/codeact/execute-code-contract.d.ts +97 -0
  636. package/dist/codeact/execute-code-contract.d.ts.map +1 -0
  637. package/dist/codeact/execute-code-contract.js +225 -0
  638. package/dist/codeact/execute-code-contract.js.map +1 -0
  639. package/dist/codeact/fabric-package.d.ts +29 -0
  640. package/dist/codeact/fabric-package.d.ts.map +1 -0
  641. package/dist/codeact/fabric-package.js +62 -0
  642. package/dist/codeact/fabric-package.js.map +1 -0
  643. package/dist/codeact/flow-package.d.ts +31 -0
  644. package/dist/codeact/flow-package.d.ts.map +1 -0
  645. package/dist/codeact/flow-package.js +80 -0
  646. package/dist/codeact/flow-package.js.map +1 -0
  647. package/dist/codeact/graph-dsl-package.d.ts +42 -0
  648. package/dist/codeact/graph-dsl-package.d.ts.map +1 -0
  649. package/dist/codeact/graph-dsl-package.js +100 -0
  650. package/dist/codeact/graph-dsl-package.js.map +1 -0
  651. package/dist/codeact/graph-model.d.ts +30 -0
  652. package/dist/codeact/graph-model.d.ts.map +1 -0
  653. package/dist/codeact/graph-model.js +407 -0
  654. package/dist/codeact/graph-model.js.map +1 -0
  655. package/dist/codeact/mcp-guest-contract.d.ts +66 -0
  656. package/dist/codeact/mcp-guest-contract.d.ts.map +1 -0
  657. package/dist/codeact/mcp-guest-contract.js +108 -0
  658. package/dist/codeact/mcp-guest-contract.js.map +1 -0
  659. package/dist/codeact/nodetool-api.d.ts +60 -0
  660. package/dist/codeact/nodetool-api.d.ts.map +1 -0
  661. package/dist/codeact/nodetool-api.js +1974 -0
  662. package/dist/codeact/nodetool-api.js.map +1 -0
  663. package/dist/codeact/prompt.d.ts +88 -0
  664. package/dist/codeact/prompt.d.ts.map +1 -0
  665. package/dist/codeact/prompt.js +326 -0
  666. package/dist/codeact/prompt.js.map +1 -0
  667. package/dist/codeact/sandbox-package-docs.d.ts +48 -0
  668. package/dist/codeact/sandbox-package-docs.d.ts.map +1 -0
  669. package/dist/codeact/sandbox-package-docs.js +55 -0
  670. package/dist/codeact/sandbox-package-docs.js.map +1 -0
  671. package/dist/codeact/sandbox-package-listing.d.ts +81 -0
  672. package/dist/codeact/sandbox-package-listing.d.ts.map +1 -0
  673. package/dist/codeact/sandbox-package-listing.js +101 -0
  674. package/dist/codeact/sandbox-package-listing.js.map +1 -0
  675. package/dist/codeact/sandbox-packages.d.ts +72 -0
  676. package/dist/codeact/sandbox-packages.d.ts.map +1 -0
  677. package/dist/codeact/sandbox-packages.js +230 -0
  678. package/dist/codeact/sandbox-packages.js.map +1 -0
  679. package/dist/codeact/timeline-package.d.ts +5 -0
  680. package/dist/codeact/timeline-package.d.ts.map +1 -0
  681. package/dist/codeact/timeline-package.js +10 -0
  682. package/dist/codeact/timeline-package.js.map +1 -0
  683. package/dist/codeact/tool-api.d.ts +200 -0
  684. package/dist/codeact/tool-api.d.ts.map +1 -0
  685. package/dist/codeact/tool-api.js +452 -0
  686. package/dist/codeact/tool-api.js.map +1 -0
  687. package/dist/codeact/tools-prelude.d.ts +32 -0
  688. package/dist/codeact/tools-prelude.d.ts.map +1 -0
  689. package/dist/codeact/tools-prelude.js +65 -0
  690. package/dist/codeact/tools-prelude.js.map +1 -0
  691. package/dist/constants.d.ts +47 -2
  692. package/dist/constants.d.ts.map +1 -1
  693. package/dist/constants.js +64 -2
  694. package/dist/constants.js.map +1 -1
  695. package/dist/custom-animation-bake.d.ts +57 -0
  696. package/dist/custom-animation-bake.d.ts.map +1 -0
  697. package/dist/custom-animation-bake.js +88 -0
  698. package/dist/custom-animation-bake.js.map +1 -0
  699. package/dist/dynamic-slots.d.ts +72 -0
  700. package/dist/dynamic-slots.d.ts.map +1 -0
  701. package/dist/dynamic-slots.js +0 -0
  702. package/dist/dynamic-slots.js.map +1 -0
  703. package/dist/evals/app-build-cases.d.ts +35 -0
  704. package/dist/evals/app-build-cases.d.ts.map +1 -0
  705. package/dist/evals/app-build-cases.js +722 -0
  706. package/dist/evals/app-build-cases.js.map +1 -0
  707. package/dist/evals/app-build-eval.d.ts +208 -0
  708. package/dist/evals/app-build-eval.d.ts.map +1 -0
  709. package/dist/evals/app-build-eval.js +518 -0
  710. package/dist/evals/app-build-eval.js.map +1 -0
  711. package/dist/evals/app-build-plan.d.ts +76 -0
  712. package/dist/evals/app-build-plan.d.ts.map +1 -0
  713. package/dist/evals/app-build-plan.js +140 -0
  714. package/dist/evals/app-build-plan.js.map +1 -0
  715. package/dist/evals/code-gen-cases.d.ts +13 -0
  716. package/dist/evals/code-gen-cases.d.ts.map +1 -0
  717. package/dist/evals/code-gen-cases.js +124 -0
  718. package/dist/evals/code-gen-cases.js.map +1 -0
  719. package/dist/evals/code-gen-eval.d.ts +109 -0
  720. package/dist/evals/code-gen-eval.d.ts.map +1 -0
  721. package/dist/evals/code-gen-eval.js +299 -0
  722. package/dist/evals/code-gen-eval.js.map +1 -0
  723. package/dist/evals/codeact-api-cases.d.ts +14 -0
  724. package/dist/evals/codeact-api-cases.d.ts.map +1 -0
  725. package/dist/evals/codeact-api-cases.js +31 -0
  726. package/dist/evals/codeact-api-cases.js.map +1 -0
  727. package/dist/evals/codeact-api-core.d.ts +23 -0
  728. package/dist/evals/codeact-api-core.d.ts.map +1 -0
  729. package/dist/evals/codeact-api-core.js +1411 -0
  730. package/dist/evals/codeact-api-core.js.map +1 -0
  731. package/dist/evals/codeact-api-runs.d.ts +3 -0
  732. package/dist/evals/codeact-api-runs.d.ts.map +1 -0
  733. package/dist/evals/codeact-api-runs.js +33 -0
  734. package/dist/evals/codeact-api-runs.js.map +1 -0
  735. package/dist/evals/codeact-api-surfaces.d.ts +25 -0
  736. package/dist/evals/codeact-api-surfaces.d.ts.map +1 -0
  737. package/dist/evals/codeact-api-surfaces.js +2191 -0
  738. package/dist/evals/codeact-api-surfaces.js.map +1 -0
  739. package/dist/evals/codeact-cases.d.ts +76 -0
  740. package/dist/evals/codeact-cases.d.ts.map +1 -0
  741. package/dist/evals/codeact-cases.js +151 -0
  742. package/dist/evals/codeact-cases.js.map +1 -0
  743. package/dist/evals/codeact-eval.d.ts +66 -0
  744. package/dist/evals/codeact-eval.d.ts.map +1 -0
  745. package/dist/evals/codeact-eval.js +250 -0
  746. package/dist/evals/codeact-eval.js.map +1 -0
  747. package/dist/evals/codeact-sandbox-pack-cases.d.ts +31 -0
  748. package/dist/evals/codeact-sandbox-pack-cases.d.ts.map +1 -0
  749. package/dist/evals/codeact-sandbox-pack-cases.js +219 -0
  750. package/dist/evals/codeact-sandbox-pack-cases.js.map +1 -0
  751. package/dist/evals/escalation-cases.d.ts +22 -0
  752. package/dist/evals/escalation-cases.d.ts.map +1 -0
  753. package/dist/evals/escalation-cases.js +343 -0
  754. package/dist/evals/escalation-cases.js.map +1 -0
  755. package/dist/evals/escalation.d.ts +92 -0
  756. package/dist/evals/escalation.d.ts.map +1 -0
  757. package/dist/evals/escalation.js +152 -0
  758. package/dist/evals/escalation.js.map +1 -0
  759. package/dist/evals/goal-judge.d.ts +51 -0
  760. package/dist/evals/goal-judge.d.ts.map +1 -0
  761. package/dist/evals/goal-judge.js +152 -0
  762. package/dist/evals/goal-judge.js.map +1 -0
  763. package/dist/evals/graph-e2e-cases.d.ts +21 -0
  764. package/dist/evals/graph-e2e-cases.d.ts.map +1 -0
  765. package/dist/evals/graph-e2e-cases.js +262 -0
  766. package/dist/evals/graph-e2e-cases.js.map +1 -0
  767. package/dist/evals/graph-e2e-eval.d.ts +202 -0
  768. package/dist/evals/graph-e2e-eval.d.ts.map +1 -0
  769. package/dist/evals/graph-e2e-eval.js +438 -0
  770. package/dist/evals/graph-e2e-eval.js.map +1 -0
  771. package/dist/evals/graph-planner-cases.d.ts +12 -0
  772. package/dist/evals/graph-planner-cases.d.ts.map +1 -0
  773. package/dist/evals/graph-planner-cases.js +256 -0
  774. package/dist/evals/graph-planner-cases.js.map +1 -0
  775. package/dist/evals/graph-planner-eval.d.ts +178 -0
  776. package/dist/evals/graph-planner-eval.d.ts.map +1 -0
  777. package/dist/evals/graph-planner-eval.js +495 -0
  778. package/dist/evals/graph-planner-eval.js.map +1 -0
  779. package/dist/evals/planner-tools.d.ts +21 -0
  780. package/dist/evals/planner-tools.d.ts.map +1 -0
  781. package/dist/evals/planner-tools.js +66 -0
  782. package/dist/evals/planner-tools.js.map +1 -0
  783. package/dist/evals/subtask-cases.d.ts +88 -0
  784. package/dist/evals/subtask-cases.d.ts.map +1 -0
  785. package/dist/evals/subtask-cases.js +322 -0
  786. package/dist/evals/subtask-cases.js.map +1 -0
  787. package/dist/evals/subtask-eval.d.ts +129 -0
  788. package/dist/evals/subtask-eval.d.ts.map +1 -0
  789. package/dist/evals/subtask-eval.js +397 -0
  790. package/dist/evals/subtask-eval.js.map +1 -0
  791. package/dist/evals/surfaces/app.d.ts +19 -0
  792. package/dist/evals/surfaces/app.d.ts.map +1 -0
  793. package/dist/evals/surfaces/app.js +341 -0
  794. package/dist/evals/surfaces/app.js.map +1 -0
  795. package/dist/evals/surfaces/creative-pipeline.d.ts +203 -0
  796. package/dist/evals/surfaces/creative-pipeline.d.ts.map +1 -0
  797. package/dist/evals/surfaces/creative-pipeline.js +909 -0
  798. package/dist/evals/surfaces/creative-pipeline.js.map +1 -0
  799. package/dist/evals/surfaces/game.d.ts +5 -0
  800. package/dist/evals/surfaces/game.d.ts.map +1 -0
  801. package/dist/evals/surfaces/game.js +42 -0
  802. package/dist/evals/surfaces/game.js.map +1 -0
  803. package/dist/evals/surfaces/js-script.d.ts +66 -0
  804. package/dist/evals/surfaces/js-script.d.ts.map +1 -0
  805. package/dist/evals/surfaces/js-script.js +407 -0
  806. package/dist/evals/surfaces/js-script.js.map +1 -0
  807. package/dist/evals/surfaces/memory.d.ts +34 -0
  808. package/dist/evals/surfaces/memory.d.ts.map +1 -0
  809. package/dist/evals/surfaces/memory.js +264 -0
  810. package/dist/evals/surfaces/memory.js.map +1 -0
  811. package/dist/evals/surfaces/model3d.d.ts +45 -0
  812. package/dist/evals/surfaces/model3d.d.ts.map +1 -0
  813. package/dist/evals/surfaces/model3d.js +346 -0
  814. package/dist/evals/surfaces/model3d.js.map +1 -0
  815. package/dist/evals/surfaces/script.d.ts +96 -0
  816. package/dist/evals/surfaces/script.d.ts.map +1 -0
  817. package/dist/evals/surfaces/script.js +709 -0
  818. package/dist/evals/surfaces/script.js.map +1 -0
  819. package/dist/evals/surfaces/sketch.d.ts +126 -0
  820. package/dist/evals/surfaces/sketch.d.ts.map +1 -0
  821. package/dist/evals/surfaces/sketch.js +1306 -0
  822. package/dist/evals/surfaces/sketch.js.map +1 -0
  823. package/dist/evals/surfaces/storyboard.d.ts +97 -0
  824. package/dist/evals/surfaces/storyboard.d.ts.map +1 -0
  825. package/dist/evals/surfaces/storyboard.js +693 -0
  826. package/dist/evals/surfaces/storyboard.js.map +1 -0
  827. package/dist/evals/surfaces/timeline.d.ts +63 -0
  828. package/dist/evals/surfaces/timeline.d.ts.map +1 -0
  829. package/dist/evals/surfaces/timeline.js +655 -0
  830. package/dist/evals/surfaces/timeline.js.map +1 -0
  831. package/dist/evals/task-planner-cases.d.ts +57 -0
  832. package/dist/evals/task-planner-cases.d.ts.map +1 -0
  833. package/dist/evals/task-planner-cases.js +117 -0
  834. package/dist/evals/task-planner-cases.js.map +1 -0
  835. package/dist/evals/task-planner-eval.d.ts +101 -0
  836. package/dist/evals/task-planner-eval.d.ts.map +1 -0
  837. package/dist/evals/task-planner-eval.js +380 -0
  838. package/dist/evals/task-planner-eval.js.map +1 -0
  839. package/dist/evals/tool-loop-bridge.d.ts +61 -0
  840. package/dist/evals/tool-loop-bridge.d.ts.map +1 -0
  841. package/dist/evals/tool-loop-bridge.js +129 -0
  842. package/dist/evals/tool-loop-bridge.js.map +1 -0
  843. package/dist/evals/tool-loop-cases.d.ts +21 -0
  844. package/dist/evals/tool-loop-cases.d.ts.map +1 -0
  845. package/dist/evals/tool-loop-cases.js +401 -0
  846. package/dist/evals/tool-loop-cases.js.map +1 -0
  847. package/dist/evals/tool-loop-eval.d.ts +236 -0
  848. package/dist/evals/tool-loop-eval.d.ts.map +1 -0
  849. package/dist/evals/tool-loop-eval.js +378 -0
  850. package/dist/evals/tool-loop-eval.js.map +1 -0
  851. package/dist/evals/tool-loop-permission.d.ts +29 -0
  852. package/dist/evals/tool-loop-permission.d.ts.map +1 -0
  853. package/dist/evals/tool-loop-permission.js +58 -0
  854. package/dist/evals/tool-loop-permission.js.map +1 -0
  855. package/dist/game-authoring.d.ts +4737 -0
  856. package/dist/game-authoring.d.ts.map +1 -0
  857. package/dist/game-authoring.js +146 -0
  858. package/dist/game-authoring.js.map +1 -0
  859. package/dist/game-code-bake.d.ts +26 -0
  860. package/dist/game-code-bake.d.ts.map +1 -0
  861. package/dist/game-code-bake.js +98 -0
  862. package/dist/game-code-bake.js.map +1 -0
  863. package/dist/game-examples.d.ts +1303 -0
  864. package/dist/game-examples.d.ts.map +1 -0
  865. package/dist/game-examples.js +188 -0
  866. package/dist/game-examples.js.map +1 -0
  867. package/dist/graph-builder.d.ts +55 -3
  868. package/dist/graph-builder.d.ts.map +1 -1
  869. package/dist/graph-builder.js +159 -4
  870. package/dist/graph-builder.js.map +1 -1
  871. package/dist/graph-dsl-core.d.ts +25 -0
  872. package/dist/graph-dsl-core.d.ts.map +1 -0
  873. package/dist/graph-dsl-core.js +312 -0
  874. package/dist/graph-dsl-core.js.map +1 -0
  875. package/dist/graph-dsl.d.ts +30 -0
  876. package/dist/graph-dsl.d.ts.map +1 -0
  877. package/dist/graph-dsl.js +116 -0
  878. package/dist/graph-dsl.js.map +1 -0
  879. package/dist/host-binaries.d.ts +6 -0
  880. package/dist/host-binaries.d.ts.map +1 -0
  881. package/dist/host-binaries.js +6 -0
  882. package/dist/host-binaries.js.map +1 -0
  883. package/dist/host-binary-guard.d.ts +100 -0
  884. package/dist/host-binary-guard.d.ts.map +1 -0
  885. package/dist/host-binary-guard.js +205 -0
  886. package/dist/host-binary-guard.js.map +1 -0
  887. package/dist/host-modules/aws.d.ts +57 -0
  888. package/dist/host-modules/aws.d.ts.map +1 -0
  889. package/dist/host-modules/aws.js +309 -0
  890. package/dist/host-modules/aws.js.map +1 -0
  891. package/dist/host-modules/chrono.d.ts +15 -0
  892. package/dist/host-modules/chrono.d.ts.map +1 -0
  893. package/dist/host-modules/chrono.js +35 -0
  894. package/dist/host-modules/chrono.js.map +1 -0
  895. package/dist/host-modules/csv.d.ts +17 -0
  896. package/dist/host-modules/csv.d.ts.map +1 -0
  897. package/dist/host-modules/csv.js +64 -0
  898. package/dist/host-modules/csv.js.map +1 -0
  899. package/dist/host-modules/diff.d.ts +9 -0
  900. package/dist/host-modules/diff.d.ts.map +1 -0
  901. package/dist/host-modules/diff.js +26 -0
  902. package/dist/host-modules/diff.js.map +1 -0
  903. package/dist/host-modules/dispatcher.d.ts +41 -0
  904. package/dist/host-modules/dispatcher.d.ts.map +1 -0
  905. package/dist/host-modules/dispatcher.js +99 -0
  906. package/dist/host-modules/dispatcher.js.map +1 -0
  907. package/dist/host-modules/docx.d.ts +19 -0
  908. package/dist/host-modules/docx.d.ts.map +1 -0
  909. package/dist/host-modules/docx.js +120 -0
  910. package/dist/host-modules/docx.js.map +1 -0
  911. package/dist/host-modules/epub.d.ts +48 -0
  912. package/dist/host-modules/epub.d.ts.map +1 -0
  913. package/dist/host-modules/epub.js +100 -0
  914. package/dist/host-modules/epub.js.map +1 -0
  915. package/dist/host-modules/exif.d.ts +8 -0
  916. package/dist/host-modules/exif.d.ts.map +1 -0
  917. package/dist/host-modules/exif.js +19 -0
  918. package/dist/host-modules/exif.js.map +1 -0
  919. package/dist/host-modules/expr.d.ts +16 -0
  920. package/dist/host-modules/expr.d.ts.map +1 -0
  921. package/dist/host-modules/expr.js +18 -0
  922. package/dist/host-modules/expr.js.map +1 -0
  923. package/dist/host-modules/fabric.d.ts +46 -0
  924. package/dist/host-modules/fabric.d.ts.map +1 -0
  925. package/dist/host-modules/fabric.js +178 -0
  926. package/dist/host-modules/fabric.js.map +1 -0
  927. package/dist/host-modules/html.d.ts +51 -0
  928. package/dist/host-modules/html.d.ts.map +1 -0
  929. package/dist/host-modules/html.js +198 -0
  930. package/dist/host-modules/html.js.map +1 -0
  931. package/dist/host-modules/ics.d.ts +9 -0
  932. package/dist/host-modules/ics.d.ts.map +1 -0
  933. package/dist/host-modules/ics.js +35 -0
  934. package/dist/host-modules/ics.js.map +1 -0
  935. package/dist/host-modules/limits.d.ts +41 -0
  936. package/dist/host-modules/limits.d.ts.map +1 -0
  937. package/dist/host-modules/limits.js +76 -0
  938. package/dist/host-modules/limits.js.map +1 -0
  939. package/dist/host-modules/mammoth.d.ts +11 -0
  940. package/dist/host-modules/mammoth.d.ts.map +1 -0
  941. package/dist/host-modules/mammoth.js +29 -0
  942. package/dist/host-modules/mammoth.js.map +1 -0
  943. package/dist/host-modules/notion.d.ts +45 -0
  944. package/dist/host-modules/notion.d.ts.map +1 -0
  945. package/dist/host-modules/notion.js +128 -0
  946. package/dist/host-modules/notion.js.map +1 -0
  947. package/dist/host-modules/ocr.d.ts +25 -0
  948. package/dist/host-modules/ocr.d.ts.map +1 -0
  949. package/dist/host-modules/ocr.js +74 -0
  950. package/dist/host-modules/ocr.js.map +1 -0
  951. package/dist/host-modules/pdf.d.ts +21 -0
  952. package/dist/host-modules/pdf.d.ts.map +1 -0
  953. package/dist/host-modules/pdf.js +53 -0
  954. package/dist/host-modules/pdf.js.map +1 -0
  955. package/dist/host-modules/pdflib.d.ts +17 -0
  956. package/dist/host-modules/pdflib.d.ts.map +1 -0
  957. package/dist/host-modules/pdflib.js +138 -0
  958. package/dist/host-modules/pdflib.js.map +1 -0
  959. package/dist/host-modules/pptx.d.ts +19 -0
  960. package/dist/host-modules/pptx.d.ts.map +1 -0
  961. package/dist/host-modules/pptx.js +67 -0
  962. package/dist/host-modules/pptx.js.map +1 -0
  963. package/dist/host-modules/pptxgen.d.ts +13 -0
  964. package/dist/host-modules/pptxgen.d.ts.map +1 -0
  965. package/dist/host-modules/pptxgen.js +98 -0
  966. package/dist/host-modules/pptxgen.js.map +1 -0
  967. package/dist/host-modules/prepared-request.d.ts +41 -0
  968. package/dist/host-modules/prepared-request.d.ts.map +1 -0
  969. package/dist/host-modules/prepared-request.js +104 -0
  970. package/dist/host-modules/prepared-request.js.map +1 -0
  971. package/dist/host-modules/registry.d.ts +31 -0
  972. package/dist/host-modules/registry.d.ts.map +1 -0
  973. package/dist/host-modules/registry.js +193 -0
  974. package/dist/host-modules/registry.js.map +1 -0
  975. package/dist/host-modules/subtitle.d.ts +15 -0
  976. package/dist/host-modules/subtitle.d.ts.map +1 -0
  977. package/dist/host-modules/subtitle.js +45 -0
  978. package/dist/host-modules/subtitle.js.map +1 -0
  979. package/dist/host-modules/supabase.d.ts +42 -0
  980. package/dist/host-modules/supabase.d.ts.map +1 -0
  981. package/dist/host-modules/supabase.js +141 -0
  982. package/dist/host-modules/supabase.js.map +1 -0
  983. package/dist/host-modules/tfjs.d.ts +42 -0
  984. package/dist/host-modules/tfjs.d.ts.map +1 -0
  985. package/dist/host-modules/tfjs.js +186 -0
  986. package/dist/host-modules/tfjs.js.map +1 -0
  987. package/dist/host-modules/tokens.d.ts +17 -0
  988. package/dist/host-modules/tokens.d.ts.map +1 -0
  989. package/dist/host-modules/tokens.js +74 -0
  990. package/dist/host-modules/tokens.js.map +1 -0
  991. package/dist/host-modules/twilio.d.ts +34 -0
  992. package/dist/host-modules/twilio.d.ts.map +1 -0
  993. package/dist/host-modules/twilio.js +67 -0
  994. package/dist/host-modules/twilio.js.map +1 -0
  995. package/dist/host-modules/xlsx.d.ts +26 -0
  996. package/dist/host-modules/xlsx.d.ts.map +1 -0
  997. package/dist/host-modules/xlsx.js +323 -0
  998. package/dist/host-modules/xlsx.js.map +1 -0
  999. package/dist/host-modules/xml.d.ts +23 -0
  1000. package/dist/host-modules/xml.d.ts.map +1 -0
  1001. package/dist/host-modules/xml.js +38 -0
  1002. package/dist/host-modules/xml.js.map +1 -0
  1003. package/dist/host-modules/zip.d.ts +24 -0
  1004. package/dist/host-modules/zip.d.ts.map +1 -0
  1005. package/dist/host-modules/zip.js +70 -0
  1006. package/dist/host-modules/zip.js.map +1 -0
  1007. package/dist/index.d.ts +208 -60
  1008. package/dist/index.d.ts.map +1 -1
  1009. package/dist/index.js +163 -60
  1010. package/dist/index.js.map +1 -1
  1011. package/dist/js-sandbox-worker/engine.d.ts +4 -0
  1012. package/dist/js-sandbox-worker/engine.d.ts.map +1 -0
  1013. package/dist/js-sandbox-worker/engine.js +45 -0
  1014. package/dist/js-sandbox-worker/engine.js.map +1 -0
  1015. package/dist/js-sandbox-worker/host.d.ts +136 -0
  1016. package/dist/js-sandbox-worker/host.d.ts.map +1 -0
  1017. package/dist/js-sandbox-worker/host.js +482 -0
  1018. package/dist/js-sandbox-worker/host.js.map +1 -0
  1019. package/dist/js-sandbox-worker/interpreter.d.ts +276 -0
  1020. package/dist/js-sandbox-worker/interpreter.d.ts.map +1 -0
  1021. package/dist/js-sandbox-worker/interpreter.js +1293 -0
  1022. package/dist/js-sandbox-worker/interpreter.js.map +1 -0
  1023. package/dist/js-sandbox-worker/protocol.d.ts +168 -0
  1024. package/dist/js-sandbox-worker/protocol.d.ts.map +1 -0
  1025. package/dist/js-sandbox-worker/protocol.js +217 -0
  1026. package/dist/js-sandbox-worker/protocol.js.map +1 -0
  1027. package/dist/js-sandbox-worker/worker-entry.d.ts +26 -0
  1028. package/dist/js-sandbox-worker/worker-entry.d.ts.map +1 -0
  1029. package/dist/js-sandbox-worker/worker-entry.js +308 -0
  1030. package/dist/js-sandbox-worker/worker-entry.js.map +1 -0
  1031. package/dist/js-sandbox.d.ts +457 -15
  1032. package/dist/js-sandbox.d.ts.map +1 -1
  1033. package/dist/js-sandbox.js +2008 -311
  1034. package/dist/js-sandbox.js.map +1 -1
  1035. package/dist/js-script-app-runner.d.ts +11 -0
  1036. package/dist/js-script-app-runner.d.ts.map +1 -0
  1037. package/dist/js-script-app-runner.js +54 -0
  1038. package/dist/js-script-app-runner.js.map +1 -0
  1039. package/dist/js-script-sandbox.d.ts +27 -0
  1040. package/dist/js-script-sandbox.d.ts.map +1 -0
  1041. package/dist/js-script-sandbox.js +36 -0
  1042. package/dist/js-script-sandbox.js.map +1 -0
  1043. package/dist/jtbd/friction.d.ts +26 -0
  1044. package/dist/jtbd/friction.d.ts.map +1 -0
  1045. package/dist/jtbd/friction.js +169 -0
  1046. package/dist/jtbd/friction.js.map +1 -0
  1047. package/dist/jtbd/index.d.ts +6 -0
  1048. package/dist/jtbd/index.d.ts.map +1 -0
  1049. package/dist/jtbd/index.js +6 -0
  1050. package/dist/jtbd/index.js.map +1 -0
  1051. package/dist/jtbd/optimize.d.ts +71 -0
  1052. package/dist/jtbd/optimize.d.ts.map +1 -0
  1053. package/dist/jtbd/optimize.js +176 -0
  1054. package/dist/jtbd/optimize.js.map +1 -0
  1055. package/dist/jtbd/registry.d.ts +29 -0
  1056. package/dist/jtbd/registry.d.ts.map +1 -0
  1057. package/dist/jtbd/registry.js +451 -0
  1058. package/dist/jtbd/registry.js.map +1 -0
  1059. package/dist/jtbd/run.d.ts +70 -0
  1060. package/dist/jtbd/run.d.ts.map +1 -0
  1061. package/dist/jtbd/run.js +177 -0
  1062. package/dist/jtbd/run.js.map +1 -0
  1063. package/dist/jtbd/types.d.ts +141 -0
  1064. package/dist/jtbd/types.d.ts.map +1 -0
  1065. package/dist/jtbd/types.js +25 -0
  1066. package/dist/jtbd/types.js.map +1 -0
  1067. package/dist/model-prompting-skills.d.ts +45 -0
  1068. package/dist/model-prompting-skills.d.ts.map +1 -0
  1069. package/dist/model-prompting-skills.js +116 -0
  1070. package/dist/model-prompting-skills.js.map +1 -0
  1071. package/dist/network-guard.d.ts +50 -0
  1072. package/dist/network-guard.d.ts.map +1 -0
  1073. package/dist/network-guard.js +106 -0
  1074. package/dist/network-guard.js.map +1 -0
  1075. package/dist/normalize-model-properties.d.ts +26 -0
  1076. package/dist/normalize-model-properties.d.ts.map +1 -0
  1077. package/dist/normalize-model-properties.js +58 -0
  1078. package/dist/normalize-model-properties.js.map +1 -0
  1079. package/dist/output-format.d.ts +5 -1
  1080. package/dist/output-format.d.ts.map +1 -1
  1081. package/dist/output-format.js.map +1 -1
  1082. package/dist/parallel-task-executor.d.ts +68 -37
  1083. package/dist/parallel-task-executor.d.ts.map +1 -1
  1084. package/dist/parallel-task-executor.js +234 -203
  1085. package/dist/parallel-task-executor.js.map +1 -1
  1086. package/dist/prompts/background-subtask-prompt.d.ts +14 -0
  1087. package/dist/prompts/background-subtask-prompt.d.ts.map +1 -0
  1088. package/dist/prompts/background-subtask-prompt.js +64 -0
  1089. package/dist/prompts/background-subtask-prompt.js.map +1 -0
  1090. package/dist/prompts/product-knowledge.d.ts +3 -0
  1091. package/dist/prompts/product-knowledge.d.ts.map +1 -0
  1092. package/dist/prompts/product-knowledge.js +120 -0
  1093. package/dist/prompts/product-knowledge.js.map +1 -0
  1094. package/dist/prompts/read-only-search-prompt.d.ts +33 -0
  1095. package/dist/prompts/read-only-search-prompt.d.ts.map +1 -0
  1096. package/dist/prompts/read-only-search-prompt.js +109 -0
  1097. package/dist/prompts/read-only-search-prompt.js.map +1 -0
  1098. package/dist/prompts/sandbox-pack-catalog.d.ts +23 -0
  1099. package/dist/prompts/sandbox-pack-catalog.d.ts.map +1 -0
  1100. package/dist/prompts/sandbox-pack-catalog.js +40 -0
  1101. package/dist/prompts/sandbox-pack-catalog.js.map +1 -0
  1102. package/dist/prompts/security-monitor-prompt.d.ts +32 -0
  1103. package/dist/prompts/security-monitor-prompt.d.ts.map +1 -0
  1104. package/dist/prompts/security-monitor-prompt.js +99 -0
  1105. package/dist/prompts/security-monitor-prompt.js.map +1 -0
  1106. package/dist/prompts/workflow-authoring-knowledge.d.ts +77 -0
  1107. package/dist/prompts/workflow-authoring-knowledge.d.ts.map +1 -0
  1108. package/dist/prompts/workflow-authoring-knowledge.js +319 -0
  1109. package/dist/prompts/workflow-authoring-knowledge.js.map +1 -0
  1110. package/dist/run-policy.d.ts +25 -0
  1111. package/dist/run-policy.d.ts.map +1 -0
  1112. package/dist/run-policy.js +54 -0
  1113. package/dist/run-policy.js.map +1 -0
  1114. package/dist/sandbox-av-media.d.ts +33 -0
  1115. package/dist/sandbox-av-media.d.ts.map +1 -0
  1116. package/dist/sandbox-av-media.js +666 -0
  1117. package/dist/sandbox-av-media.js.map +1 -0
  1118. package/dist/sandbox-bootstrap-modules.d.ts +54 -0
  1119. package/dist/sandbox-bootstrap-modules.d.ts.map +1 -0
  1120. package/dist/sandbox-bootstrap-modules.js +104 -0
  1121. package/dist/sandbox-bootstrap-modules.js.map +1 -0
  1122. package/dist/sandbox-bytes.d.ts +43 -0
  1123. package/dist/sandbox-bytes.d.ts.map +1 -0
  1124. package/dist/sandbox-bytes.js +61 -0
  1125. package/dist/sandbox-bytes.js.map +1 -0
  1126. package/dist/sandbox-canvas-api.d.ts +30 -0
  1127. package/dist/sandbox-canvas-api.d.ts.map +1 -0
  1128. package/dist/sandbox-canvas-api.js +81 -0
  1129. package/dist/sandbox-canvas-api.js.map +1 -0
  1130. package/dist/sandbox-constants.d.ts +5 -0
  1131. package/dist/sandbox-constants.d.ts.map +1 -0
  1132. package/dist/sandbox-constants.js +13 -0
  1133. package/dist/sandbox-constants.js.map +1 -0
  1134. package/dist/sandbox-json-transport.d.ts +107 -0
  1135. package/dist/sandbox-json-transport.d.ts.map +1 -0
  1136. package/dist/sandbox-json-transport.js +324 -0
  1137. package/dist/sandbox-json-transport.js.map +1 -0
  1138. package/dist/sandbox-media-handle.d.ts +78 -0
  1139. package/dist/sandbox-media-handle.d.ts.map +1 -0
  1140. package/dist/sandbox-media-handle.js +114 -0
  1141. package/dist/sandbox-media-handle.js.map +1 -0
  1142. package/dist/sandbox-media-ref.d.ts +134 -0
  1143. package/dist/sandbox-media-ref.d.ts.map +1 -0
  1144. package/dist/sandbox-media-ref.js +442 -0
  1145. package/dist/sandbox-media-ref.js.map +1 -0
  1146. package/dist/sandbox-media.d.ts +177 -0
  1147. package/dist/sandbox-media.d.ts.map +1 -0
  1148. package/dist/sandbox-media.js +963 -0
  1149. package/dist/sandbox-media.js.map +1 -0
  1150. package/dist/sandbox-module-fixtures.d.ts +445 -0
  1151. package/dist/sandbox-module-fixtures.d.ts.map +1 -0
  1152. package/dist/sandbox-module-fixtures.js +214 -0
  1153. package/dist/sandbox-module-fixtures.js.map +1 -0
  1154. package/dist/sandbox-pack-resolution.d.ts +21 -0
  1155. package/dist/sandbox-pack-resolution.d.ts.map +1 -0
  1156. package/dist/sandbox-pack-resolution.js +42 -0
  1157. package/dist/sandbox-pack-resolution.js.map +1 -0
  1158. package/dist/sandbox-toolbelt.d.ts +15 -0
  1159. package/dist/sandbox-toolbelt.d.ts.map +1 -0
  1160. package/dist/sandbox-toolbelt.js +70 -0
  1161. package/dist/sandbox-toolbelt.js.map +1 -0
  1162. package/dist/security-monitor.d.ts +89 -0
  1163. package/dist/security-monitor.d.ts.map +1 -0
  1164. package/dist/security-monitor.js +307 -0
  1165. package/dist/security-monitor.js.map +1 -0
  1166. package/dist/serpapi/catalog.d.ts +101 -0
  1167. package/dist/serpapi/catalog.d.ts.map +1 -0
  1168. package/dist/serpapi/catalog.js +246 -0
  1169. package/dist/serpapi/catalog.js.map +1 -0
  1170. package/dist/serpapi/client.d.ts +81 -0
  1171. package/dist/serpapi/client.d.ts.map +1 -0
  1172. package/dist/serpapi/client.js +228 -0
  1173. package/dist/serpapi/client.js.map +1 -0
  1174. package/dist/serpapi/errors.d.ts +49 -0
  1175. package/dist/serpapi/errors.d.ts.map +1 -0
  1176. package/dist/serpapi/errors.js +64 -0
  1177. package/dist/serpapi/errors.js.map +1 -0
  1178. package/dist/serpapi/normalize.d.ts +58 -0
  1179. package/dist/serpapi/normalize.d.ts.map +1 -0
  1180. package/dist/serpapi/normalize.js +140 -0
  1181. package/dist/serpapi/normalize.js.map +1 -0
  1182. package/dist/skill-prompt.d.ts +37 -0
  1183. package/dist/skill-prompt.d.ts.map +1 -0
  1184. package/dist/skill-prompt.js +72 -0
  1185. package/dist/skill-prompt.js.map +1 -0
  1186. package/dist/step-executor.d.ts +90 -77
  1187. package/dist/step-executor.d.ts.map +1 -1
  1188. package/dist/step-executor.js +384 -690
  1189. package/dist/step-executor.js.map +1 -1
  1190. package/dist/subagent.d.ts +275 -0
  1191. package/dist/subagent.d.ts.map +1 -0
  1192. package/dist/subagent.js +444 -0
  1193. package/dist/subagent.js.map +1 -0
  1194. package/dist/supervisor/prompt.d.ts +12 -0
  1195. package/dist/supervisor/prompt.d.ts.map +1 -0
  1196. package/dist/supervisor/prompt.js +51 -0
  1197. package/dist/supervisor/prompt.js.map +1 -0
  1198. package/dist/supervisor/supervisor-agent.d.ts +72 -0
  1199. package/dist/supervisor/supervisor-agent.d.ts.map +1 -0
  1200. package/dist/supervisor/supervisor-agent.js +185 -0
  1201. package/dist/supervisor/supervisor-agent.js.map +1 -0
  1202. package/dist/supervisor/tools.d.ts +56 -0
  1203. package/dist/supervisor/tools.d.ts.map +1 -0
  1204. package/dist/supervisor/tools.js +83 -0
  1205. package/dist/supervisor/tools.js.map +1 -0
  1206. package/dist/supervisor/verdict-schema.d.ts +18 -0
  1207. package/dist/supervisor/verdict-schema.d.ts.map +1 -0
  1208. package/dist/supervisor/verdict-schema.js +58 -0
  1209. package/dist/supervisor/verdict-schema.js.map +1 -0
  1210. package/dist/system-skills.d.ts +74 -0
  1211. package/dist/system-skills.d.ts.map +1 -0
  1212. package/dist/system-skills.js +168 -0
  1213. package/dist/system-skills.js.map +1 -0
  1214. package/dist/task-executor.d.ts +90 -40
  1215. package/dist/task-executor.d.ts.map +1 -1
  1216. package/dist/task-executor.js +259 -282
  1217. package/dist/task-executor.js.map +1 -1
  1218. package/dist/task-planner.d.ts +18 -12
  1219. package/dist/task-planner.d.ts.map +1 -1
  1220. package/dist/task-planner.js +342 -328
  1221. package/dist/task-planner.js.map +1 -1
  1222. package/dist/timeline-capture.d.ts +21 -0
  1223. package/dist/timeline-capture.d.ts.map +1 -0
  1224. package/dist/timeline-capture.js +564 -0
  1225. package/dist/timeline-capture.js.map +1 -0
  1226. package/dist/timeline-code-bake.d.ts +75 -0
  1227. package/dist/timeline-code-bake.d.ts.map +1 -0
  1228. package/dist/timeline-code-bake.js +327 -0
  1229. package/dist/timeline-code-bake.js.map +1 -0
  1230. package/dist/timeline-preview/compare.d.ts +27 -0
  1231. package/dist/timeline-preview/compare.d.ts.map +1 -0
  1232. package/dist/timeline-preview/compare.js +71 -0
  1233. package/dist/timeline-preview/compare.js.map +1 -0
  1234. package/dist/timeline-preview/frames.d.ts +193 -0
  1235. package/dist/timeline-preview/frames.d.ts.map +1 -0
  1236. package/dist/timeline-preview/frames.js +731 -0
  1237. package/dist/timeline-preview/frames.js.map +1 -0
  1238. package/dist/timeline-preview/model3d.d.ts +67 -0
  1239. package/dist/timeline-preview/model3d.d.ts.map +1 -0
  1240. package/dist/timeline-preview/model3d.js +165 -0
  1241. package/dist/timeline-preview/model3d.js.map +1 -0
  1242. package/dist/timeline-preview/rasterize.d.ts +33 -0
  1243. package/dist/timeline-preview/rasterize.d.ts.map +1 -0
  1244. package/dist/timeline-preview/rasterize.js +83 -0
  1245. package/dist/timeline-preview/rasterize.js.map +1 -0
  1246. package/dist/timeline-preview/sheet.d.ts +38 -0
  1247. package/dist/timeline-preview/sheet.d.ts.map +1 -0
  1248. package/dist/timeline-preview/sheet.js +72 -0
  1249. package/dist/timeline-preview/sheet.js.map +1 -0
  1250. package/dist/tools/asset-persist.d.ts +29 -0
  1251. package/dist/tools/asset-persist.d.ts.map +1 -0
  1252. package/dist/tools/asset-persist.js +78 -0
  1253. package/dist/tools/asset-persist.js.map +1 -0
  1254. package/dist/tools/base-tool.d.ts +53 -5
  1255. package/dist/tools/base-tool.d.ts.map +1 -1
  1256. package/dist/tools/base-tool.js +180 -3
  1257. package/dist/tools/base-tool.js.map +1 -1
  1258. package/dist/tools/binary-output.d.ts +54 -0
  1259. package/dist/tools/binary-output.d.ts.map +1 -0
  1260. package/dist/tools/binary-output.js +127 -0
  1261. package/dist/tools/binary-output.js.map +1 -0
  1262. package/dist/tools/browser-tools.d.ts +5 -29
  1263. package/dist/tools/browser-tools.d.ts.map +1 -1
  1264. package/dist/tools/browser-tools.js +5 -205
  1265. package/dist/tools/browser-tools.js.map +1 -1
  1266. package/dist/tools/builtin-tools.d.ts +52 -0
  1267. package/dist/tools/builtin-tools.d.ts.map +1 -0
  1268. package/dist/tools/builtin-tools.js +289 -0
  1269. package/dist/tools/builtin-tools.js.map +1 -0
  1270. package/dist/tools/control-tool.d.ts +2 -5
  1271. package/dist/tools/control-tool.d.ts.map +1 -1
  1272. package/dist/tools/control-tool.js +18 -15
  1273. package/dist/tools/control-tool.js.map +1 -1
  1274. package/dist/tools/dataseo-tools.d.ts +34 -32
  1275. package/dist/tools/dataseo-tools.d.ts.map +1 -1
  1276. package/dist/tools/dataseo-tools.js +148 -233
  1277. package/dist/tools/dataseo-tools.js.map +1 -1
  1278. package/dist/tools/external-capability-tools.d.ts +36 -0
  1279. package/dist/tools/external-capability-tools.d.ts.map +1 -0
  1280. package/dist/tools/external-capability-tools.js +41 -0
  1281. package/dist/tools/external-capability-tools.js.map +1 -0
  1282. package/dist/tools/external-mcp-tools.d.ts +139 -0
  1283. package/dist/tools/external-mcp-tools.d.ts.map +1 -0
  1284. package/dist/tools/external-mcp-tools.js +552 -0
  1285. package/dist/tools/external-mcp-tools.js.map +1 -0
  1286. package/dist/tools/finish-step-tool.d.ts +1 -1
  1287. package/dist/tools/finish-step-tool.d.ts.map +1 -1
  1288. package/dist/tools/finish-step-tool.js +3 -3
  1289. package/dist/tools/finish-step-tool.js.map +1 -1
  1290. package/dist/tools/google-tools.d.ts +28 -39
  1291. package/dist/tools/google-tools.d.ts.map +1 -1
  1292. package/dist/tools/google-tools.js +51 -164
  1293. package/dist/tools/google-tools.js.map +1 -1
  1294. package/dist/tools/google-workspace-tools.d.ts +23 -0
  1295. package/dist/tools/google-workspace-tools.d.ts.map +1 -0
  1296. package/dist/tools/google-workspace-tools.js +26 -0
  1297. package/dist/tools/google-workspace-tools.js.map +1 -0
  1298. package/dist/tools/graph-validation-registry.d.ts +33 -0
  1299. package/dist/tools/graph-validation-registry.d.ts.map +1 -0
  1300. package/dist/tools/graph-validation-registry.js +54 -0
  1301. package/dist/tools/graph-validation-registry.js.map +1 -0
  1302. package/dist/tools/http-tools.d.ts +5 -53
  1303. package/dist/tools/http-tools.d.ts.map +1 -1
  1304. package/dist/tools/http-tools.js +5 -177
  1305. package/dist/tools/http-tools.js.map +1 -1
  1306. package/dist/tools/image-injection.d.ts +51 -0
  1307. package/dist/tools/image-injection.d.ts.map +1 -0
  1308. package/dist/tools/image-injection.js +85 -0
  1309. package/dist/tools/image-injection.js.map +1 -0
  1310. package/dist/tools/mcp-tool-support.d.ts +204 -0
  1311. package/dist/tools/mcp-tool-support.d.ts.map +1 -0
  1312. package/dist/tools/mcp-tool-support.js +537 -0
  1313. package/dist/tools/mcp-tool-support.js.map +1 -0
  1314. package/dist/tools/mcp-tools.d.ts +106 -390
  1315. package/dist/tools/mcp-tools.d.ts.map +1 -1
  1316. package/dist/tools/mcp-tools.js +132 -601
  1317. package/dist/tools/mcp-tools.js.map +1 -1
  1318. package/dist/tools/media-tools.d.ts +9 -272
  1319. package/dist/tools/media-tools.d.ts.map +1 -1
  1320. package/dist/tools/media-tools.js +11 -676
  1321. package/dist/tools/media-tools.js.map +1 -1
  1322. package/dist/tools/memory-tools.d.ts +36 -0
  1323. package/dist/tools/memory-tools.d.ts.map +1 -0
  1324. package/dist/tools/memory-tools.js +52 -0
  1325. package/dist/tools/memory-tools.js.map +1 -0
  1326. package/dist/tools/openai-tools.d.ts +28 -68
  1327. package/dist/tools/openai-tools.d.ts.map +1 -1
  1328. package/dist/tools/openai-tools.js +51 -181
  1329. package/dist/tools/openai-tools.js.map +1 -1
  1330. package/dist/tools/plan-builder-tools.d.ts +141 -7
  1331. package/dist/tools/plan-builder-tools.d.ts.map +1 -1
  1332. package/dist/tools/plan-builder-tools.js +159 -86
  1333. package/dist/tools/plan-builder-tools.js.map +1 -1
  1334. package/dist/tools/run-search-tool.d.ts +82 -0
  1335. package/dist/tools/run-search-tool.d.ts.map +1 -0
  1336. package/dist/tools/run-search-tool.js +121 -0
  1337. package/dist/tools/run-search-tool.js.map +1 -0
  1338. package/dist/tools/run-subtask-tool.d.ts +49 -0
  1339. package/dist/tools/run-subtask-tool.d.ts.map +1 -0
  1340. package/dist/tools/run-subtask-tool.js +88 -0
  1341. package/dist/tools/run-subtask-tool.js.map +1 -0
  1342. package/dist/tools/search-tools.d.ts +5 -36
  1343. package/dist/tools/search-tools.d.ts.map +1 -1
  1344. package/dist/tools/search-tools.js +5 -215
  1345. package/dist/tools/search-tools.js.map +1 -1
  1346. package/dist/tools/serp-providers/apify-provider.d.ts +18 -0
  1347. package/dist/tools/serp-providers/apify-provider.d.ts.map +1 -0
  1348. package/dist/tools/serp-providers/apify-provider.js +93 -0
  1349. package/dist/tools/serp-providers/apify-provider.js.map +1 -0
  1350. package/dist/tools/serp-providers/brave-provider.d.ts +34 -0
  1351. package/dist/tools/serp-providers/brave-provider.d.ts.map +1 -0
  1352. package/dist/tools/serp-providers/brave-provider.js +86 -0
  1353. package/dist/tools/serp-providers/brave-provider.js.map +1 -0
  1354. package/dist/tools/serp-providers/dataforseo-provider.d.ts +14 -1
  1355. package/dist/tools/serp-providers/dataforseo-provider.d.ts.map +1 -1
  1356. package/dist/tools/serp-providers/dataforseo-provider.js +0 -9
  1357. package/dist/tools/serp-providers/dataforseo-provider.js.map +1 -1
  1358. package/dist/tools/serp-providers/gemini-provider.d.ts +45 -0
  1359. package/dist/tools/serp-providers/gemini-provider.d.ts.map +1 -0
  1360. package/dist/tools/serp-providers/gemini-provider.js +148 -0
  1361. package/dist/tools/serp-providers/gemini-provider.js.map +1 -0
  1362. package/dist/tools/serp-providers/index.d.ts +61 -0
  1363. package/dist/tools/serp-providers/index.d.ts.map +1 -1
  1364. package/dist/tools/serp-providers/index.js +119 -3
  1365. package/dist/tools/serp-providers/index.js.map +1 -1
  1366. package/dist/tools/serp-providers/openai-provider.d.ts +58 -0
  1367. package/dist/tools/serp-providers/openai-provider.d.ts.map +1 -0
  1368. package/dist/tools/serp-providers/openai-provider.js +113 -0
  1369. package/dist/tools/serp-providers/openai-provider.js.map +1 -0
  1370. package/dist/tools/serp-providers/serpapi-provider.d.ts +9 -5
  1371. package/dist/tools/serp-providers/serpapi-provider.d.ts.map +1 -1
  1372. package/dist/tools/serp-providers/serpapi-provider.js +26 -44
  1373. package/dist/tools/serp-providers/serpapi-provider.js.map +1 -1
  1374. package/dist/tools/serp-tool-factory.d.ts +27 -0
  1375. package/dist/tools/serp-tool-factory.d.ts.map +1 -0
  1376. package/dist/tools/serp-tool-factory.js +56 -0
  1377. package/dist/tools/serp-tool-factory.js.map +1 -0
  1378. package/dist/tools/shared-tools.d.ts +33 -0
  1379. package/dist/tools/shared-tools.d.ts.map +1 -0
  1380. package/dist/tools/shared-tools.js +39 -0
  1381. package/dist/tools/shared-tools.js.map +1 -0
  1382. package/dist/tools/start-subtask-tool.d.ts +51 -0
  1383. package/dist/tools/start-subtask-tool.d.ts.map +1 -0
  1384. package/dist/tools/start-subtask-tool.js +189 -0
  1385. package/dist/tools/start-subtask-tool.js.map +1 -0
  1386. package/dist/tools/submit-code-tool.d.ts +159 -0
  1387. package/dist/tools/submit-code-tool.d.ts.map +1 -0
  1388. package/dist/tools/submit-code-tool.js +209 -0
  1389. package/dist/tools/submit-code-tool.js.map +1 -0
  1390. package/dist/tools/subtask-fields.d.ts +11 -0
  1391. package/dist/tools/subtask-fields.d.ts.map +1 -0
  1392. package/dist/tools/subtask-fields.js +11 -0
  1393. package/dist/tools/subtask-fields.js.map +1 -0
  1394. package/dist/tools/todo-tools.d.ts +15 -0
  1395. package/dist/tools/todo-tools.d.ts.map +1 -0
  1396. package/dist/tools/todo-tools.js +15 -0
  1397. package/dist/tools/todo-tools.js.map +1 -0
  1398. package/dist/tools/tool-permissions.d.ts +40 -0
  1399. package/dist/tools/tool-permissions.d.ts.map +1 -0
  1400. package/dist/tools/tool-permissions.js +52 -0
  1401. package/dist/tools/tool-permissions.js.map +1 -0
  1402. package/dist/tools/tool-search.d.ts +39 -0
  1403. package/dist/tools/tool-search.d.ts.map +1 -0
  1404. package/dist/tools/tool-search.js +108 -0
  1405. package/dist/tools/tool-search.js.map +1 -0
  1406. package/dist/tools/vector-tool-support.d.ts +15 -0
  1407. package/dist/tools/vector-tool-support.d.ts.map +1 -0
  1408. package/dist/tools/vector-tool-support.js +133 -0
  1409. package/dist/tools/vector-tool-support.js.map +1 -0
  1410. package/dist/tools/vector-tools.d.ts +13 -220
  1411. package/dist/tools/vector-tools.d.ts.map +1 -1
  1412. package/dist/tools/vector-tools.js +7 -578
  1413. package/dist/tools/vector-tools.js.map +1 -1
  1414. package/dist/tools/wait-subtasks-tool.d.ts +27 -0
  1415. package/dist/tools/wait-subtasks-tool.d.ts.map +1 -0
  1416. package/dist/tools/wait-subtasks-tool.js +66 -0
  1417. package/dist/tools/wait-subtasks-tool.js.map +1 -0
  1418. package/dist/types.d.ts +16 -31
  1419. package/dist/types.d.ts.map +1 -1
  1420. package/dist/types.js +8 -1
  1421. package/dist/types.js.map +1 -1
  1422. package/dist/utils/dag-scheduler.d.ts +85 -0
  1423. package/dist/utils/dag-scheduler.d.ts.map +1 -0
  1424. package/dist/utils/dag-scheduler.js +180 -0
  1425. package/dist/utils/dag-scheduler.js.map +1 -0
  1426. package/dist/utils/json-parser.d.ts +32 -1
  1427. package/dist/utils/json-parser.d.ts.map +1 -1
  1428. package/dist/utils/json-parser.js +145 -10
  1429. package/dist/utils/json-parser.js.map +1 -1
  1430. package/dist/utils/json-schema-validate.d.ts +29 -0
  1431. package/dist/utils/json-schema-validate.d.ts.map +1 -0
  1432. package/dist/utils/json-schema-validate.js +228 -0
  1433. package/dist/utils/json-schema-validate.js.map +1 -0
  1434. package/dist/utils/link-abort.d.ts +13 -0
  1435. package/dist/utils/link-abort.d.ts.map +1 -0
  1436. package/dist/utils/link-abort.js +23 -0
  1437. package/dist/utils/link-abort.js.map +1 -0
  1438. package/dist/utils/merge-generators.d.ts +58 -0
  1439. package/dist/utils/merge-generators.d.ts.map +1 -0
  1440. package/dist/utils/merge-generators.js +148 -0
  1441. package/dist/utils/merge-generators.js.map +1 -0
  1442. package/dist/utils/remove-base64-images.d.ts +0 -5
  1443. package/dist/utils/remove-base64-images.d.ts.map +1 -1
  1444. package/dist/utils/remove-base64-images.js.map +1 -1
  1445. package/dist/utils/step-failure.d.ts +20 -0
  1446. package/dist/utils/step-failure.d.ts.map +1 -0
  1447. package/dist/utils/step-failure.js +43 -0
  1448. package/dist/utils/step-failure.js.map +1 -0
  1449. package/dist/utils/think-tags.d.ts +16 -0
  1450. package/dist/utils/think-tags.d.ts.map +1 -0
  1451. package/dist/utils/think-tags.js +23 -0
  1452. package/dist/utils/think-tags.js.map +1 -0
  1453. package/dist/utils/type-guards.d.ts +26 -0
  1454. package/dist/utils/type-guards.d.ts.map +1 -0
  1455. package/dist/utils/type-guards.js +44 -0
  1456. package/dist/utils/type-guards.js.map +1 -0
  1457. package/dist/utils/ui-event-buffer.d.ts +18 -0
  1458. package/dist/utils/ui-event-buffer.d.ts.map +1 -0
  1459. package/dist/utils/ui-event-buffer.js +18 -0
  1460. package/dist/utils/ui-event-buffer.js.map +1 -0
  1461. package/dist/utils/wrap-generators-parallel.d.ts +0 -5
  1462. package/dist/utils/wrap-generators-parallel.d.ts.map +1 -1
  1463. package/dist/utils/wrap-generators-parallel.js +3 -6
  1464. package/dist/utils/wrap-generators-parallel.js.map +1 -1
  1465. package/dist/wasm-sandbox/host.d.ts +106 -0
  1466. package/dist/wasm-sandbox/host.d.ts.map +1 -0
  1467. package/dist/wasm-sandbox/host.js +409 -0
  1468. package/dist/wasm-sandbox/host.js.map +1 -0
  1469. package/dist/wasm-sandbox/workers.d.ts +43 -0
  1470. package/dist/wasm-sandbox/workers.d.ts.map +1 -0
  1471. package/dist/wasm-sandbox/workers.js +150 -0
  1472. package/dist/wasm-sandbox/workers.js.map +1 -0
  1473. package/dist/workspace-paths.d.ts +40 -0
  1474. package/dist/workspace-paths.d.ts.map +1 -0
  1475. package/dist/workspace-paths.js +102 -0
  1476. package/dist/workspace-paths.js.map +1 -0
  1477. package/dist/yt-dlp-gate.d.ts +19 -0
  1478. package/dist/yt-dlp-gate.d.ts.map +1 -0
  1479. package/dist/yt-dlp-gate.js +22 -0
  1480. package/dist/yt-dlp-gate.js.map +1 -0
  1481. package/package.json +114 -14
  1482. package/dist/agent-executor.d.ts +0 -62
  1483. package/dist/agent-executor.d.ts.map +0 -1
  1484. package/dist/agent-executor.js +0 -324
  1485. package/dist/agent-executor.js.map +0 -1
  1486. package/dist/agent-step-executor.d.ts +0 -28
  1487. package/dist/agent-step-executor.d.ts.map +0 -1
  1488. package/dist/agent-step-executor.js +0 -99
  1489. package/dist/agent-step-executor.js.map +0 -1
  1490. package/dist/agent-workflow-runner.d.ts +0 -31
  1491. package/dist/agent-workflow-runner.d.ts.map +0 -1
  1492. package/dist/agent-workflow-runner.js +0 -124
  1493. package/dist/agent-workflow-runner.js.map +0 -1
  1494. package/dist/agent.d.ts +0 -115
  1495. package/dist/agent.d.ts.map +0 -1
  1496. package/dist/agent.js +0 -587
  1497. package/dist/agent.js.map +0 -1
  1498. package/dist/base-agent.d.ts +0 -42
  1499. package/dist/base-agent.d.ts.map +0 -1
  1500. package/dist/base-agent.js +0 -29
  1501. package/dist/base-agent.js.map +0 -1
  1502. package/dist/graph-planner.d.ts +0 -56
  1503. package/dist/graph-planner.d.ts.map +0 -1
  1504. package/dist/graph-planner.js +0 -311
  1505. package/dist/graph-planner.js.map +0 -1
  1506. package/dist/multi-mode-agent.d.ts +0 -86
  1507. package/dist/multi-mode-agent.d.ts.map +0 -1
  1508. package/dist/multi-mode-agent.js +0 -476
  1509. package/dist/multi-mode-agent.js.map +0 -1
  1510. package/dist/prompts/graph-planner-prompt.d.ts +0 -48
  1511. package/dist/prompts/graph-planner-prompt.d.ts.map +0 -1
  1512. package/dist/prompts/graph-planner-prompt.js +0 -180
  1513. package/dist/prompts/graph-planner-prompt.js.map +0 -1
  1514. package/dist/reject-agentic-provider.d.ts +0 -21
  1515. package/dist/reject-agentic-provider.d.ts.map +0 -1
  1516. package/dist/reject-agentic-provider.js +0 -32
  1517. package/dist/reject-agentic-provider.js.map +0 -1
  1518. package/dist/simple-agent.d.ts +0 -29
  1519. package/dist/simple-agent.d.ts.map +0 -1
  1520. package/dist/simple-agent.js +0 -54
  1521. package/dist/simple-agent.js.map +0 -1
  1522. package/dist/sub-agent-planner.d.ts +0 -33
  1523. package/dist/sub-agent-planner.d.ts.map +0 -1
  1524. package/dist/sub-agent-planner.js +0 -203
  1525. package/dist/sub-agent-planner.js.map +0 -1
  1526. package/dist/team/db-task-board.d.ts +0 -54
  1527. package/dist/team/db-task-board.d.ts.map +0 -1
  1528. package/dist/team/db-task-board.js +0 -361
  1529. package/dist/team/db-task-board.js.map +0 -1
  1530. package/dist/team/edge-message-bus.d.ts +0 -51
  1531. package/dist/team/edge-message-bus.d.ts.map +0 -1
  1532. package/dist/team/edge-message-bus.js +0 -169
  1533. package/dist/team/edge-message-bus.js.map +0 -1
  1534. package/dist/team/edge-task-board.d.ts +0 -77
  1535. package/dist/team/edge-task-board.d.ts.map +0 -1
  1536. package/dist/team/edge-task-board.js +0 -140
  1537. package/dist/team/edge-task-board.js.map +0 -1
  1538. package/dist/team/index.d.ts +0 -16
  1539. package/dist/team/index.d.ts.map +0 -1
  1540. package/dist/team/index.js +0 -17
  1541. package/dist/team/index.js.map +0 -1
  1542. package/dist/team/message-bus.d.ts +0 -58
  1543. package/dist/team/message-bus.d.ts.map +0 -1
  1544. package/dist/team/message-bus.js +0 -151
  1545. package/dist/team/message-bus.js.map +0 -1
  1546. package/dist/team/task-board.d.ts +0 -106
  1547. package/dist/team/task-board.d.ts.map +0 -1
  1548. package/dist/team/task-board.js +0 -370
  1549. package/dist/team/task-board.js.map +0 -1
  1550. package/dist/team/team-executor.d.ts +0 -72
  1551. package/dist/team/team-executor.d.ts.map +0 -1
  1552. package/dist/team/team-executor.js +0 -466
  1553. package/dist/team/team-executor.js.map +0 -1
  1554. package/dist/team/team-tools.d.ts +0 -252
  1555. package/dist/team/team-tools.d.ts.map +0 -1
  1556. package/dist/team/team-tools.js +0 -412
  1557. package/dist/team/team-tools.js.map +0 -1
  1558. package/dist/team/types.d.ts +0 -198
  1559. package/dist/team/types.d.ts.map +0 -1
  1560. package/dist/team/types.js +0 -8
  1561. package/dist/team/types.js.map +0 -1
  1562. package/dist/tools/add-edge-tool.d.ts +0 -18
  1563. package/dist/tools/add-edge-tool.d.ts.map +0 -1
  1564. package/dist/tools/add-edge-tool.js +0 -92
  1565. package/dist/tools/add-edge-tool.js.map +0 -1
  1566. package/dist/tools/add-node-tool.d.ts +0 -22
  1567. package/dist/tools/add-node-tool.d.ts.map +0 -1
  1568. package/dist/tools/add-node-tool.js +0 -128
  1569. package/dist/tools/add-node-tool.js.map +0 -1
  1570. package/dist/tools/asset-tools.d.ts +0 -58
  1571. package/dist/tools/asset-tools.d.ts.map +0 -1
  1572. package/dist/tools/asset-tools.js +0 -191
  1573. package/dist/tools/asset-tools.js.map +0 -1
  1574. package/dist/tools/calculator-tool.d.ts +0 -24
  1575. package/dist/tools/calculator-tool.d.ts.map +0 -1
  1576. package/dist/tools/calculator-tool.js +0 -64
  1577. package/dist/tools/calculator-tool.js.map +0 -1
  1578. package/dist/tools/claude-code-tools.d.ts +0 -96
  1579. package/dist/tools/claude-code-tools.d.ts.map +0 -1
  1580. package/dist/tools/claude-code-tools.js +0 -463
  1581. package/dist/tools/claude-code-tools.js.map +0 -1
  1582. package/dist/tools/code-tools.d.ts +0 -26
  1583. package/dist/tools/code-tools.d.ts.map +0 -1
  1584. package/dist/tools/code-tools.js +0 -82
  1585. package/dist/tools/code-tools.js.map +0 -1
  1586. package/dist/tools/create-plan-tool.d.ts +0 -29
  1587. package/dist/tools/create-plan-tool.d.ts.map +0 -1
  1588. package/dist/tools/create-plan-tool.js +0 -355
  1589. package/dist/tools/create-plan-tool.js.map +0 -1
  1590. package/dist/tools/create-task-tool.d.ts +0 -28
  1591. package/dist/tools/create-task-tool.d.ts.map +0 -1
  1592. package/dist/tools/create-task-tool.js +0 -254
  1593. package/dist/tools/create-task-tool.js.map +0 -1
  1594. package/dist/tools/email-tools.d.ts +0 -76
  1595. package/dist/tools/email-tools.d.ts.map +0 -1
  1596. package/dist/tools/email-tools.js +0 -259
  1597. package/dist/tools/email-tools.js.map +0 -1
  1598. package/dist/tools/filesystem-tools.d.ts +0 -77
  1599. package/dist/tools/filesystem-tools.d.ts.map +0 -1
  1600. package/dist/tools/filesystem-tools.js +0 -334
  1601. package/dist/tools/filesystem-tools.js.map +0 -1
  1602. package/dist/tools/find-model-tool.d.ts +0 -25
  1603. package/dist/tools/find-model-tool.d.ts.map +0 -1
  1604. package/dist/tools/find-model-tool.js +0 -236
  1605. package/dist/tools/find-model-tool.js.map +0 -1
  1606. package/dist/tools/finish-graph-tool.d.ts +0 -23
  1607. package/dist/tools/finish-graph-tool.d.ts.map +0 -1
  1608. package/dist/tools/finish-graph-tool.js +0 -46
  1609. package/dist/tools/finish-graph-tool.js.map +0 -1
  1610. package/dist/tools/js-code-tool.d.ts +0 -30
  1611. package/dist/tools/js-code-tool.d.ts.map +0 -1
  1612. package/dist/tools/js-code-tool.js +0 -98
  1613. package/dist/tools/js-code-tool.js.map +0 -1
  1614. package/dist/tools/local-get-node-info-tool.d.ts +0 -19
  1615. package/dist/tools/local-get-node-info-tool.d.ts.map +0 -1
  1616. package/dist/tools/local-get-node-info-tool.js +0 -75
  1617. package/dist/tools/local-get-node-info-tool.js.map +0 -1
  1618. package/dist/tools/local-list-nodes-tool.d.ts +0 -19
  1619. package/dist/tools/local-list-nodes-tool.d.ts.map +0 -1
  1620. package/dist/tools/local-list-nodes-tool.js +0 -69
  1621. package/dist/tools/local-list-nodes-tool.js.map +0 -1
  1622. package/dist/tools/local-search-nodes-tool.d.ts +0 -21
  1623. package/dist/tools/local-search-nodes-tool.d.ts.map +0 -1
  1624. package/dist/tools/local-search-nodes-tool.js +0 -111
  1625. package/dist/tools/local-search-nodes-tool.js.map +0 -1
  1626. package/dist/tools/math-tools.d.ts +0 -156
  1627. package/dist/tools/math-tools.d.ts.map +0 -1
  1628. package/dist/tools/math-tools.js +0 -422
  1629. package/dist/tools/math-tools.js.map +0 -1
  1630. package/dist/tools/model-tools.d.ts +0 -25
  1631. package/dist/tools/model-tools.d.ts.map +0 -1
  1632. package/dist/tools/model-tools.js +0 -48
  1633. package/dist/tools/model-tools.js.map +0 -1
  1634. package/dist/tools/pdf-tools.d.ts +0 -152
  1635. package/dist/tools/pdf-tools.d.ts.map +0 -1
  1636. package/dist/tools/pdf-tools.js +0 -339
  1637. package/dist/tools/pdf-tools.js.map +0 -1
  1638. package/dist/tools/tool-registry.d.ts +0 -9
  1639. package/dist/tools/tool-registry.d.ts.map +0 -1
  1640. package/dist/tools/tool-registry.js +0 -17
  1641. package/dist/tools/tool-registry.js.map +0 -1
  1642. package/dist/tools/workspace-tools.d.ts +0 -58
  1643. package/dist/tools/workspace-tools.d.ts.map +0 -1
  1644. package/dist/tools/workspace-tools.js +0 -152
  1645. package/dist/tools/workspace-tools.js.map +0 -1
@@ -0,0 +1,1795 @@
1
+ /**
2
+ * The `scripts` capability module.
3
+ *
4
+ * Five capabilities that used to be five `Tool` subclasses in
5
+ * `../tools/script-voice-tools.ts`: reading a script, voicing its lines through
6
+ * the TTS provider, assembling the voiced takes into a timeline sequence, and
7
+ * writing the lines in the first place.
8
+ *
9
+ * Wire names, descriptions and schemas are unchanged, and `voice_script_lines`
10
+ * still delegates to `GenerateSpeechTool` — the one code path that knows how to
11
+ * ask a provider for encoded audio and fall back to the streaming route.
12
+ *
13
+ * The voice rule (`effectiveVoice`), the staleness rule (`needsVoicing`) and
14
+ * the script → timeline mapping (`buildScriptTimeline`) come from
15
+ * `@nodetool-ai/timeline`, the same module the editor and the nodes use, so a
16
+ * headlessly voiced script matches one voiced in the UI. Every heavy dependency
17
+ * is imported inside the implementation that needs it.
18
+ *
19
+ * Design: docs/tool-class-retirement-design.md § "Migration".
20
+ */
21
+ import { paceSpeed } from "@nodetool-ai/protocol";
22
+ import { isFunction, isNonBlankString, isNonEmptyString, isNumber, isObjectLike, isRecord, isString } from "../utils/type-guards.js";
23
+ import { UNGATED, createCapabilityRun } from "./invoke.js";
24
+ import { stampScriptStoryboardId } from "./script-link.js";
25
+ import { listScriptsSpec, createScriptSpec, getScriptSpec, voiceScriptLinesSpec, assembleScriptTimelineSpec, editScriptSpec, writeScriptSpec, deriveStoryboardFromScriptSpec, DEFAULT_ASR_PROVIDER, DEFAULT_ASR_MODEL, deleteScriptSpec } from "./scripts.specs.js";
26
+ import { clampConcurrency, mapWithConcurrency } from "./concurrency.js";
27
+ import { resolveProjectId } from "./project-scope.js";
28
+ /** Lines one call may voice, so a whole-script call cannot run away. */
29
+ const MAX_LINES_PER_CALL = 60;
30
+ /** Tokens the writer may spend on one script. */
31
+ const MAX_WRITER_TOKENS = 8192;
32
+ /** The length a script is written to when no step wrote one. */
33
+ const DEFAULT_SCRIPT_SECONDS = 60;
34
+ /** The guided-setup stages, in order. Mirrors `scriptSetupStage`. */
35
+ const SETUP_STAGES = [
36
+ "idea",
37
+ "format",
38
+ "review",
39
+ "voices",
40
+ "done"
41
+ ];
42
+ /** The reading paces a script can be written and estimated at. */
43
+ const SETUP_PACES = ["slow", "normal", "fast"];
44
+ /** Attempts to land a document write: the first try plus one re-read-and-reapply (ADR 0001). */
45
+ const CAS_ATTEMPTS = 2;
46
+ const isError = (value) => !!value &&
47
+ typeof value === "object" &&
48
+ typeof value.error === "string";
49
+ const errorMessage = (e) => e instanceof Error ? e.message : String(e);
50
+ async function loadScript(run, scriptId) {
51
+ if (!isNonEmptyString(scriptId)) {
52
+ return { error: "script_id is required (use list_scripts to find one)." };
53
+ }
54
+ const { Script } = await import("@nodetool-ai/models");
55
+ const row = await Script.findById(scriptId);
56
+ // A script owned by someone else reads as missing — the same rule the tRPC
57
+ // router's ownership check applies.
58
+ if (!row || row.user_id !== run.context.userId) {
59
+ return { error: `Script ${scriptId} was not found.` };
60
+ }
61
+ return { row, doc: row.toDocument() };
62
+ }
63
+ /** Resolve a line reference: line id, 0-based reading-order index, or its text. */
64
+ function findLine(lines, target) {
65
+ const byId = lines.find((l) => l.id === target);
66
+ if (byId)
67
+ return byId;
68
+ const index = Number(target);
69
+ if (Number.isInteger(index) && index >= 0 && index < lines.length) {
70
+ return lines[index];
71
+ }
72
+ const text = target.trim().toLowerCase();
73
+ return lines.find((l) => l.text.trim().toLowerCase() === text);
74
+ }
75
+ /**
76
+ * Append a take to one line and persist the script.
77
+ *
78
+ * Lines are voiced concurrently against a single row, so the write is a CAS on
79
+ * `updated_at`: on conflict the row is re-read and the take appended to the
80
+ * fresher document, never to the stale copy the synthesis started from.
81
+ */
82
+ async function appendTake(scriptId, lineId, take) {
83
+ const { Script } = await import("@nodetool-ai/models");
84
+ for (let attempt = 0; attempt < CAS_ATTEMPTS; attempt++) {
85
+ const row = await Script.findById(scriptId);
86
+ if (!row)
87
+ return { error: `Script ${scriptId} was not found.` };
88
+ const doc = row.toDocument();
89
+ let updated;
90
+ const sections = doc.sections.map((section) => ({
91
+ ...section,
92
+ lines: section.lines.map((line) => {
93
+ if (line.id !== lineId)
94
+ return line;
95
+ updated = {
96
+ ...line,
97
+ takes: [...line.takes, take],
98
+ currentTakeId: take.id
99
+ };
100
+ return updated;
101
+ })
102
+ }));
103
+ if (!updated)
104
+ return { error: `Line ${lineId} is no longer in the script.` };
105
+ const saved = await Script.updateFieldsIfUnchanged(scriptId, row.updated_at, { document: JSON.stringify({ ...doc, sections }) },
106
+ // The take op rides on the write so an open editor merges this into its
107
+ // draft per line instead of treating the whole script as replaced.
108
+ {
109
+ ops: [
110
+ {
111
+ tool: "append_take",
112
+ input: { line_id: lineId, take_id: take.id }
113
+ }
114
+ ]
115
+ });
116
+ if (saved)
117
+ return updated;
118
+ }
119
+ return {
120
+ error: `Script ${scriptId} is being modified concurrently; the take was synthesized but could not be saved. Retry the call.`
121
+ };
122
+ }
123
+ /**
124
+ * Duration of the synthesized audio.
125
+ *
126
+ * ffprobe is the accurate answer and is what the editor's browser probe and the
127
+ * VoiceScript node both effectively measure. When it is unavailable (no ffmpeg
128
+ * on PATH), the last word timing is a close second, and the placeholder is the
129
+ * floor — a take is still playable and still assemblable without an exact
130
+ * length.
131
+ */
132
+ async function measureDurationMs(bytes, words) {
133
+ const { execFile: execFileCb } = await import("node:child_process");
134
+ const { promisify } = await import("node:util");
135
+ const { promises: fs } = await import("node:fs");
136
+ const os = await import("node:os");
137
+ const path = await import("node:path");
138
+ const { PLACEHOLDER_LINE_MS } = await import("@nodetool-ai/timeline");
139
+ const execFile = promisify(execFileCb);
140
+ const dir = await fs.mkdtemp(path.join(os.tmpdir(), "nodetool-voice-"));
141
+ const file = path.join(dir, "take");
142
+ try {
143
+ await fs.writeFile(file, bytes);
144
+ const { stdout } = await execFile("ffprobe", [
145
+ "-v",
146
+ "error",
147
+ "-show_entries",
148
+ "format=duration",
149
+ "-of",
150
+ "default=noprint_wrappers=1:nokey=1",
151
+ file
152
+ ]);
153
+ const seconds = parseFloat(stdout.trim());
154
+ if (Number.isFinite(seconds) && seconds > 0) {
155
+ return Math.round(seconds * 1000);
156
+ }
157
+ }
158
+ catch {
159
+ // ffprobe missing or unreadable output — fall through to the estimates.
160
+ }
161
+ finally {
162
+ await fs.rm(dir, { recursive: true, force: true });
163
+ }
164
+ const lastWordEnd = words.length > 0 ? words[words.length - 1].endMs : 0;
165
+ return lastWordEnd > 0 ? lastWordEnd : PLACEHOLDER_LINE_MS;
166
+ }
167
+ /** Word timings for a take. Best-effort: a failed pass leaves the take playable. */
168
+ async function transcribeWords(context, audio, provider, model) {
169
+ try {
170
+ const asr = await context.getProvider(provider);
171
+ const result = await asr.automaticSpeechRecognition({
172
+ audio,
173
+ model,
174
+ word_timestamps: true
175
+ });
176
+ return (result.chunks ?? [])
177
+ .map((chunk) => ({
178
+ word: chunk.text.trim(),
179
+ startMs: Math.round(chunk.timestamp[0] * 1000),
180
+ endMs: Math.round(chunk.timestamp[1] * 1000)
181
+ }))
182
+ .filter((w) => w.word.length > 0);
183
+ }
184
+ catch {
185
+ return [];
186
+ }
187
+ }
188
+ /** The voicing state of a line, as the editor's gutter shows it. */
189
+ function lineStatus(line, voice, helpers) {
190
+ if (!voice)
191
+ return "no_voice";
192
+ if (!helpers.currentTake(line))
193
+ return "draft";
194
+ return helpers.needsVoicing(line, voice) ? "stale" : "voiced";
195
+ }
196
+ const EMPTY_LINK = {
197
+ linked: false,
198
+ storyboard_id: null,
199
+ orphan_line_ids: [],
200
+ drifted_shot_ids: [],
201
+ shot_id_by_line_id: {},
202
+ issues: []
203
+ };
204
+ /**
205
+ * The board this script points at, and what its link looks like now.
206
+ *
207
+ * The board owns the link (design §1.1) and `scripts.storyboard_id` is the
208
+ * back-pointer (design §1.2), so this is one read by id. A pointer at a board
209
+ * that is gone, or at one that no longer names this script, is reported as an
210
+ * issue rather than silently dropped — the script still works, only the link
211
+ * affordances do not.
212
+ */
213
+ async function storyboardLinkFor(userId, storyboardId, scriptId, doc) {
214
+ if (!userId || !storyboardId)
215
+ return EMPTY_LINK;
216
+ const { Storyboard } = await import("@nodetool-ai/models");
217
+ const { orphanedLineIds, shotDialogueDrifted, validateScriptLink } = await import("@nodetool-ai/protocol");
218
+ const stale = (message) => ({
219
+ ...EMPTY_LINK,
220
+ storyboard_id: storyboardId,
221
+ issues: [message]
222
+ });
223
+ const board = await Storyboard.findById(storyboardId);
224
+ if (!board || board.user_id !== userId) {
225
+ return stale(`Storyboard ${storyboardId} is no longer available, so the script's back-pointer is stale.`);
226
+ }
227
+ const boardDoc = board.toDocument();
228
+ if (boardDoc.screenplay?.script_id !== scriptId) {
229
+ return stale(`Storyboard ${storyboardId} does not link this script back, so the back-pointer is stale.`);
230
+ }
231
+ const screenplay = {
232
+ ...boardDoc.screenplay,
233
+ shots: boardDoc.shots
234
+ };
235
+ const scriptDoc = { sections: doc.sections };
236
+ const linesById = new Map(doc.sections.flatMap((section) => section.lines.map((line) => [line.id, line])));
237
+ const shotIdByLineId = {};
238
+ for (const shot of screenplay.shots) {
239
+ for (const lineId of shot.script_line_ids ?? []) {
240
+ shotIdByLineId[lineId] = shot.id;
241
+ }
242
+ }
243
+ const validation = validateScriptLink(screenplay, scriptDoc);
244
+ return {
245
+ linked: true,
246
+ storyboard_id: board.id,
247
+ orphan_line_ids: orphanedLineIds(screenplay, scriptDoc),
248
+ drifted_shot_ids: screenplay.shots
249
+ .filter((shot) => shotDialogueDrifted(shot, linesById))
250
+ .map((shot) => shot.id),
251
+ shot_id_by_line_id: shotIdByLineId,
252
+ issues: [...validation.errors, ...validation.warnings].map((issue) => issue.message)
253
+ };
254
+ }
255
+ const listScripts = {
256
+ spec: listScriptsSpec,
257
+ impl: async (run, params) => {
258
+ const userId = run.context.userId;
259
+ if (!userId)
260
+ return { error: "No user is bound to this session." };
261
+ const { Script } = await import("@nodetool-ai/models");
262
+ const { currentTake, effectiveVoice, needsVoicing, scriptLines } = await import("@nodetool-ai/timeline");
263
+ const limit = Math.max(1, Math.min(Number(params["limit"]) || 20, 100));
264
+ const rows = await Script.listByUser(userId, limit);
265
+ return {
266
+ scripts: rows.map((row) => {
267
+ const doc = row.toDocument();
268
+ const lines = scriptLines(doc.sections);
269
+ return {
270
+ id: row.id,
271
+ name: row.name,
272
+ cast: doc.cast.length,
273
+ lines: lines.length,
274
+ voiced: lines.filter((line) => lineStatus(line, effectiveVoice(line, doc.cast), {
275
+ currentTake,
276
+ needsVoicing
277
+ }) === "voiced").length,
278
+ timeline_id: row.timeline_id ?? undefined,
279
+ updated_at: row.updated_at
280
+ };
281
+ })
282
+ };
283
+ }
284
+ };
285
+ const createScript = {
286
+ spec: createScriptSpec,
287
+ impl: async (run, params) => {
288
+ const userId = run.context.userId;
289
+ if (!userId)
290
+ return { error: "No user is bound to this session." };
291
+ const name = params["name"];
292
+ if (!isNonBlankString(name)) {
293
+ return { error: "name is required and must be a non-empty string." };
294
+ }
295
+ const { Script, emptyScriptDocument } = await import("@nodetool-ai/models");
296
+ const requestedId = isNonBlankString(params["id"])
297
+ ? params["id"].trim()
298
+ : undefined;
299
+ if (requestedId) {
300
+ const existing = await Script.findById(requestedId);
301
+ if (existing) {
302
+ // A script someone else owns reads as taken, not as theirs to read.
303
+ if (existing.user_id !== userId) {
304
+ return { error: `A script with id ${requestedId} already exists.` };
305
+ }
306
+ return {
307
+ ok: true,
308
+ script_id: existing.id,
309
+ name: existing.name,
310
+ project_id: existing.project_id,
311
+ updated_at: existing.updated_at
312
+ };
313
+ }
314
+ }
315
+ const fields = {
316
+ user_id: userId,
317
+ project_id: resolveProjectId(run, params),
318
+ name: name.trim(),
319
+ document: JSON.stringify(emptyScriptDocument())
320
+ };
321
+ if (requestedId)
322
+ fields.id = requestedId;
323
+ const script = new Script(fields);
324
+ await script.save();
325
+ return {
326
+ ok: true,
327
+ script_id: script.id,
328
+ name: script.name,
329
+ project_id: script.project_id,
330
+ updated_at: script.updated_at
331
+ };
332
+ }
333
+ };
334
+ const getScript = {
335
+ spec: getScriptSpec,
336
+ impl: async (run, params) => {
337
+ const handle = await loadScript(run, params["script_id"]);
338
+ if (isError(handle))
339
+ return handle;
340
+ const { row, doc } = handle;
341
+ const { currentTake, effectiveVoice, needsVoicing, scriptLines } = await import("@nodetool-ai/timeline");
342
+ const link = await storyboardLinkFor(run.context.userId, row.storyboard_id ?? null, row.id, doc);
343
+ const orphans = new Set(link.orphan_line_ids);
344
+ return {
345
+ id: row.id,
346
+ name: row.name,
347
+ timeline_id: row.timeline_id ?? undefined,
348
+ storyboard_id: link.storyboard_id,
349
+ storyboard_link: link,
350
+ cast: doc.cast.map((speaker) => ({
351
+ id: speaker.id,
352
+ name: speaker.name,
353
+ voice: speaker.voice ?? null,
354
+ entityId: speaker.entityId ?? null
355
+ })),
356
+ lines: scriptLines(doc.sections).map((line, index) => {
357
+ const voice = effectiveVoice(line, doc.cast);
358
+ return {
359
+ id: line.id,
360
+ index,
361
+ speaker_id: line.speakerId ?? null,
362
+ text: line.text,
363
+ direction: line.direction,
364
+ pause_after_ms: line.pauseAfterMs,
365
+ voice,
366
+ status: lineStatus(line, voice, { currentTake, needsVoicing }),
367
+ take_count: line.takes.length,
368
+ shot_id: link.shot_id_by_line_id[line.id] ?? null,
369
+ orphaned: link.linked && orphans.has(line.id)
370
+ };
371
+ })
372
+ };
373
+ }
374
+ };
375
+ // ---------------------------------------------------------------------------
376
+ // voice_script_lines
377
+ // ---------------------------------------------------------------------------
378
+ /** The call-level voice override, or null when the lines' own voices apply. */
379
+ function voiceOverrideFrom(rawParams) {
380
+ const params = flattenVoiceArg(rawParams);
381
+ const provider = params["provider"];
382
+ const model = params["model"];
383
+ const voice = params["voice"];
384
+ const any = [provider, model, voice].some((v) => isNonEmptyString(v));
385
+ if (!any)
386
+ return null;
387
+ if (!isNonEmptyString(provider) ||
388
+ !isNonEmptyString(model) ||
389
+ !isNonEmptyString(voice)) {
390
+ // A provider and a model with no voice is the shape a caller sends when
391
+ // it means "use this TTS endpoint for the whole script" — there is no
392
+ // such thing here, because the endpoint does not pick a voice. Naming the
393
+ // op that does say it saves the round trip the refusal used to cost.
394
+ return {
395
+ error: "A voice override needs all three of provider, model, and voice — " +
396
+ "`voice` is the voice's own name (e.g. \"Aoede\"), which find_model " +
397
+ "with capability=text_to_speech lists per model. To give the whole " +
398
+ 'script one model, set each speaker\'s voice once with edit_script ' +
399
+ '{"op": "set_speaker_voice", "target": "<speaker>", "provider", ' +
400
+ '"model", "voice"} and call this with no override at all.'
401
+ };
402
+ }
403
+ return { provider, model, voice };
404
+ }
405
+ /**
406
+ * The lines a voicing call acts on: the explicit `targets` when given, else
407
+ * every line that needs voicing — the default that makes a whole script one
408
+ * call. An override applies to every named line, since the caller chose the
409
+ * voice; without one, staleness is measured against the line's own voice.
410
+ */
411
+ function selectLines(lines, targets, override, doc, helpers) {
412
+ if (targets === undefined || targets === null) {
413
+ return lines
414
+ .map((line, index) => ({ line, index }))
415
+ .filter(({ line }) => {
416
+ const voice = override ?? helpers.effectiveVoice(line, doc.cast);
417
+ return (line.text.trim().length > 0 &&
418
+ !!voice &&
419
+ helpers.needsVoicing(line, voice));
420
+ });
421
+ }
422
+ const list = Array.isArray(targets) ? targets : [targets];
423
+ const selected = [];
424
+ for (const raw of list) {
425
+ const target = String(raw);
426
+ const line = findLine(lines, target);
427
+ if (!line) {
428
+ return {
429
+ error: `No line matches "${target}". Call get_script to list line ids and indexes.`
430
+ };
431
+ }
432
+ if (selected.some((s) => s.line.id === line.id))
433
+ continue;
434
+ selected.push({ line, index: lines.indexOf(line) });
435
+ }
436
+ return selected;
437
+ }
438
+ const voiceScriptLines = {
439
+ spec: voiceScriptLinesSpec,
440
+ impl: async (run, params) => {
441
+ const context = run.context;
442
+ const handle = await loadScript(run, params["script_id"]);
443
+ if (isError(handle))
444
+ return handle;
445
+ const { row, doc } = handle;
446
+ const override = voiceOverrideFrom(params);
447
+ if (isError(override))
448
+ return override;
449
+ const { effectiveVoice, needsVoicing, scriptLines } = await import("@nodetool-ai/timeline");
450
+ const lines = scriptLines(doc.sections);
451
+ const selected = selectLines(lines, params["targets"], override, doc, {
452
+ effectiveVoice,
453
+ needsVoicing
454
+ });
455
+ if (isError(selected))
456
+ return selected;
457
+ if (selected.length === 0) {
458
+ // "Every line with a voice is already up to date" was true of a script
459
+ // whose lines have no voice at all — vacuously, since there were none to
460
+ // be out of date. Read as written it says the work is done, and a chat
461
+ // that had just written eight unvoiced lines took it that way. The reason
462
+ // nothing was selected is the useful half, so it is the half reported.
463
+ const withText = lines.filter((line) => line.text.trim().length > 0);
464
+ const voiceless = withText.filter((line) => !(override ?? effectiveVoice(line, doc.cast)));
465
+ if (withText.length === 0) {
466
+ return {
467
+ voiced: 0,
468
+ results: [],
469
+ note: "This script has no line with text in it yet. Write lines with edit_script, then voice them."
470
+ };
471
+ }
472
+ if (voiceless.length > 0) {
473
+ return {
474
+ voiced: 0,
475
+ results: [],
476
+ skipped_without_voice: voiceless.length,
477
+ note: `${voiceless.length} of ${withText.length} lines have no voice, so nothing could be voiced` +
478
+ (voiceless.length < withText.length
479
+ ? "; the rest are already up to date. "
480
+ : ". ") +
481
+ 'Give each speaker a voice with edit_script {"op": "set_speaker_voice", "target": "<speaker>", provider, model, voice} — find_model with capability=text_to_speech resolves one — or pass provider, model and voice to this call to override them all.'
482
+ };
483
+ }
484
+ return {
485
+ voiced: 0,
486
+ results: [],
487
+ note: `All ${withText.length} lines are voiced and up to date. Name lines explicitly with \`targets\` to re-voice them.`
488
+ };
489
+ }
490
+ if (selected.length > MAX_LINES_PER_CALL) {
491
+ return {
492
+ error: `${selected.length} lines selected, over the ${MAX_LINES_PER_CALL}-line per-call limit. Pass targets in batches.`
493
+ };
494
+ }
495
+ // Synthesis stays with `generate_speech`: it is the one place that knows
496
+ // how to ask a provider for encoded audio, fall back to streaming PCM, and
497
+ // persist the result as an asset.
498
+ const { generateSpeech } = await import("./media.js");
499
+ const speechRun = createCapabilityRun({ context, gate: UNGATED });
500
+ const speed = isNumber(params["speed"])
501
+ ? params["speed"]
502
+ : paceSpeed(doc.setup?.pace);
503
+ const transcribe = params["transcribe"] !== false;
504
+ const asrProvider = isString(params["asr_provider"])
505
+ ? params["asr_provider"]
506
+ : DEFAULT_ASR_PROVIDER;
507
+ const asrModel = isString(params["asr_model"])
508
+ ? params["asr_model"]
509
+ : DEFAULT_ASR_MODEL;
510
+ const results = await mapWithConcurrency(selected, clampConcurrency(params["concurrency"]), async ({ line, index }) => {
511
+ const base = {
512
+ line_id: line.id,
513
+ index,
514
+ text: line.text,
515
+ ok: false
516
+ };
517
+ const text = line.text.trim();
518
+ if (!text)
519
+ return { ...base, error: "Line has no text to voice." };
520
+ const voice = override ?? effectiveVoice(line, doc.cast);
521
+ if (!voice) {
522
+ return {
523
+ ...base,
524
+ error: "Line has no voice — give its speaker a voice, set a per-line override, or pass provider/model/voice to this call."
525
+ };
526
+ }
527
+ try {
528
+ const speechParams = {
529
+ provider: voice.provider,
530
+ model: voice.model,
531
+ text,
532
+ voice: voice.voice
533
+ };
534
+ if (speed !== undefined) {
535
+ speechParams["speed"] = speed;
536
+ }
537
+ const synthesized = (await generateSpeech.impl(speechRun, speechParams));
538
+ if (synthesized.error)
539
+ return { ...base, error: synthesized.error };
540
+ if (!synthesized.asset_id) {
541
+ return {
542
+ ...base,
543
+ error: "The take was synthesized but could not be saved as an asset, so it cannot be attached to the line. This host has no asset storage wired."
544
+ };
545
+ }
546
+ const { bytes } = await context.resolveAssetBytes(synthesized.asset_uri ?? synthesized.asset_id);
547
+ const audio = bytes ?? new Uint8Array();
548
+ const words = transcribe
549
+ ? await transcribeWords(context, audio, asrProvider, asrModel)
550
+ : [];
551
+ const durationMs = await measureDurationMs(audio, words);
552
+ const { randomUUID } = await import("node:crypto");
553
+ const take = {
554
+ id: `take_${randomUUID()}`,
555
+ assetId: synthesized.asset_id,
556
+ durationMs,
557
+ words,
558
+ textSnapshot: line.text,
559
+ voiceSnapshot: voice,
560
+ createdAt: new Date().toISOString()
561
+ };
562
+ const saved = await appendTake(row.id, line.id, take);
563
+ if (isError(saved))
564
+ return { ...base, error: saved.error };
565
+ return {
566
+ ...base,
567
+ ok: true,
568
+ take_id: take.id,
569
+ asset_id: take.assetId,
570
+ duration_ms: durationMs,
571
+ word_count: words.length
572
+ };
573
+ }
574
+ catch (e) {
575
+ return {
576
+ ...base,
577
+ error: `text_to_speech failed: ${errorMessage(e)}`
578
+ };
579
+ }
580
+ });
581
+ return {
582
+ script_id: row.id,
583
+ voiced: results.filter((r) => r.ok).length,
584
+ failed: results.filter((r) => !r.ok).length,
585
+ results
586
+ };
587
+ }
588
+ };
589
+ const assembleScriptTimeline = {
590
+ spec: assembleScriptTimelineSpec,
591
+ impl: async (run, params) => {
592
+ const context = run.context;
593
+ const handle = await loadScript(run, params["script_id"]);
594
+ if (isError(handle))
595
+ return handle;
596
+ const { row, doc } = handle;
597
+ const { Script, TimelineSequence } = await import("@nodetool-ai/models");
598
+ const { buildScriptTimeline, foreignTimelineParts } = await import("@nodetool-ai/timeline");
599
+ const assembled = buildScriptTimeline({
600
+ scriptId: row.id,
601
+ cast: doc.cast,
602
+ sections: doc.sections
603
+ });
604
+ if (assembled.clips.length === 0) {
605
+ return {
606
+ error: "No line has a voiced take, so there is nothing to assemble. Run voice_script_lines first.",
607
+ skipped_line_ids: assembled.skippedLineIds
608
+ };
609
+ }
610
+ const fps = Math.max(1, Math.min(Number(params["fps"]) || 30, 120));
611
+ const name = isNonEmptyString(params["name"])
612
+ ? params["name"]
613
+ : row.name;
614
+ const existing = row.timeline_id
615
+ ? await TimelineSequence.findById(row.timeline_id)
616
+ : null;
617
+ const reuse = existing && existing.user_id === context.userId ? existing : null;
618
+ if (!reuse) {
619
+ const sequence = new TimelineSequence({
620
+ user_id: context.userId,
621
+ project_id: row.project_id,
622
+ name
623
+ });
624
+ sequence.name = name;
625
+ sequence.fps = fps;
626
+ sequence.duration_ms = assembled.durationMs;
627
+ sequence.fromDocument({
628
+ tracks: assembled.tracks,
629
+ clips: assembled.clips,
630
+ markers: []
631
+ });
632
+ await sequence.save();
633
+ if (row.timeline_id !== sequence.id) {
634
+ await Script.updateFieldsIfUnchanged(row.id, row.updated_at, { timeline_id: sequence.id }, { ops: [{ tool: "set_link", input: { timeline_id: sequence.id } }] });
635
+ }
636
+ return {
637
+ ok: true,
638
+ timeline_id: sequence.id,
639
+ name: sequence.name,
640
+ fps,
641
+ duration_ms: assembled.durationMs,
642
+ clip_count: assembled.clips.length,
643
+ track_count: assembled.tracks.length,
644
+ skipped_line_ids: assembled.skippedLineIds
645
+ };
646
+ }
647
+ // Re-assembling over an existing sequence is a CAS write carrying its
648
+ // ops (S2.1): the foreign parts are re-read per attempt, and an open
649
+ // editor merges the change instead of seeing the sequence as replaced.
650
+ for (let attempt = 0; attempt < CAS_ATTEMPTS; attempt++) {
651
+ const current = attempt === 0 ? reuse : await TimelineSequence.findById(reuse.id);
652
+ if (!current ||
653
+ current.user_id !== context.userId) {
654
+ return {
655
+ error: `Timeline ${reuse.id} was deleted while assembling; create a new timeline by calling this again.`
656
+ };
657
+ }
658
+ // Re-assembling replaces this script's voiceover track and clips, and
659
+ // leaves everything another surface put in the sequence alone.
660
+ const foreign = foreignTimelineParts(current.toDocument(), (clip) => clip.scriptId === row.id);
661
+ const tracks = [...assembled.tracks, ...foreign.tracks];
662
+ const clips = [...assembled.clips, ...foreign.clips];
663
+ const durationMs = clips.reduce((end, c) => Math.max(end, c.startMs + c.durationMs), 0);
664
+ const previous = current.toDocument();
665
+ const nextDocument = {
666
+ ...previous,
667
+ tracks,
668
+ clips,
669
+ markers: previous.markers ?? []
670
+ };
671
+ const saved = await TimelineSequence.updateFieldsIfUnchanged(current.id, current.updated_at, {
672
+ name,
673
+ fps,
674
+ duration_ms: durationMs,
675
+ document: JSON.stringify(nextDocument)
676
+ }, {
677
+ ops: [
678
+ {
679
+ tool: "assemble_script_timeline",
680
+ input: { script_id: row.id }
681
+ }
682
+ ]
683
+ });
684
+ if (!saved)
685
+ continue;
686
+ if (row.timeline_id !== current.id) {
687
+ await Script.updateFieldsIfUnchanged(row.id, row.updated_at, { timeline_id: current.id }, { ops: [{ tool: "set_link", input: { timeline_id: current.id } }] });
688
+ }
689
+ return {
690
+ ok: true,
691
+ timeline_id: current.id,
692
+ name,
693
+ fps,
694
+ duration_ms: durationMs,
695
+ clip_count: clips.length,
696
+ track_count: tracks.length,
697
+ skipped_line_ids: assembled.skippedLineIds
698
+ };
699
+ }
700
+ return {
701
+ error: `Timeline ${reuse.id} is being modified concurrently; the assembly finished but could not be saved. Retry the call.`
702
+ };
703
+ }
704
+ };
705
+ // ---------------------------------------------------------------------------
706
+ // edit_script
707
+ // ---------------------------------------------------------------------------
708
+ //
709
+ // The voicing capabilities above turn written lines into audio; this one writes
710
+ // the lines. Adding a speaker, adding or rewriting a line, assigning a voice —
711
+ // all of it was browser-only, since the `ui_script_*` tools round-trip into the
712
+ // open editor's store. An agent could voice a script it could not author.
713
+ /** Operations one call may apply, so a runaway script cannot rewrite a script. */
714
+ const MAX_SCRIPT_OPS = 80;
715
+ const SCRIPT_OPS = [
716
+ "set_setup",
717
+ "add_speaker",
718
+ "set_speaker",
719
+ "set_speaker_voice",
720
+ "remove_speaker",
721
+ "add_section",
722
+ "add_line",
723
+ "set_line_text",
724
+ "set_line_speaker",
725
+ "remove_line"
726
+ ];
727
+ const isScriptOpName = (value) => SCRIPT_OPS.includes(value);
728
+ /**
729
+ * Every argument each op reads. An op used to take whatever object it was
730
+ * handed and read the keys it knew, so a key it did not know was dropped in
731
+ * silence: `add_line {text, speaker_id}` — the field name `get_script`
732
+ * *reports* a line's speaker under — added the line with no speaker at all and
733
+ * reported `ok`. A chat wrote eight lines that way, read them back unattributed,
734
+ * and spent the rest of the session rebuilding the script twice trying to
735
+ * work out which call had not taken. A key no op reads is now refused, by name.
736
+ */
737
+ const OP_KEYS = {
738
+ set_setup: ["stage", "brief", "format", "length_seconds", "pace", "language"],
739
+ add_speaker: [
740
+ "name",
741
+ "color",
742
+ "provider",
743
+ "model",
744
+ "voice",
745
+ "settings",
746
+ "entityId",
747
+ "entity_id"
748
+ ],
749
+ set_speaker: ["target", "name", "color", "entityId", "entity_id"],
750
+ set_speaker_voice: ["target", "provider", "model", "voice", "settings"],
751
+ remove_speaker: ["target"],
752
+ add_section: ["title"],
753
+ add_line: [
754
+ "text",
755
+ "speaker",
756
+ "section",
757
+ "direction",
758
+ "pause_after_ms",
759
+ "index"
760
+ ],
761
+ set_line_text: ["target", "text"],
762
+ set_line_speaker: ["target", "speaker"],
763
+ remove_line: ["target"]
764
+ };
765
+ /**
766
+ * Spellings that mean one of an op's own keys. These are the names the rest of
767
+ * the surface already uses for the same thing: `get_script` answers with `id`,
768
+ * `speaker_id` and `line_id`, and reading a script then editing it by the
769
+ * field names it just reported is consistency, not a mistake. Translating them
770
+ * costs nothing; a spelling that would collide with a key already present is
771
+ * refused rather than guessed at.
772
+ */
773
+ const OP_ALIASES = {
774
+ set_setup: { seconds: "length_seconds", length: "length_seconds" },
775
+ add_speaker: { speaker: "name", speaker_name: "name" },
776
+ set_speaker: { id: "target", speaker: "target", speaker_id: "target" },
777
+ set_speaker_voice: {
778
+ id: "target",
779
+ speaker: "target",
780
+ speaker_id: "target"
781
+ },
782
+ remove_speaker: { id: "target", speaker: "target", speaker_id: "target" },
783
+ add_section: { name: "title" },
784
+ add_line: { speaker_id: "speaker", section_id: "section" },
785
+ set_line_text: { id: "target", line: "target", line_id: "target" },
786
+ set_line_speaker: {
787
+ id: "target",
788
+ line: "target",
789
+ line_id: "target",
790
+ speaker_id: "speaker"
791
+ },
792
+ remove_line: { id: "target", line: "target", line_id: "target" }
793
+ };
794
+ /**
795
+ * One op's arguments, with the known aliases translated, or the reason it
796
+ * cannot be applied as written.
797
+ */
798
+ function normalizeOpArgs(op, index, raw) {
799
+ const known = OP_KEYS[op];
800
+ const aliases = OP_ALIASES[op];
801
+ const args = {};
802
+ for (const [key, value] of Object.entries(raw)) {
803
+ if (known.includes(key)) {
804
+ args[key] = value;
805
+ continue;
806
+ }
807
+ const alias = aliases[key];
808
+ if (alias === undefined) {
809
+ return {
810
+ error: `ops[${index}] (${op}) has no argument "${key}"; it takes ${known.join(", ")}.`
811
+ };
812
+ }
813
+ if (raw[alias] !== undefined) {
814
+ return {
815
+ error: `ops[${index}] (${op}) passes both "${key}" and "${alias}", which mean the same argument. Pass one.`
816
+ };
817
+ }
818
+ args[alias] = value;
819
+ }
820
+ return args;
821
+ }
822
+ function parseScriptOps(raw) {
823
+ if (!Array.isArray(raw) || raw.length === 0) {
824
+ return {
825
+ // The ops are listed here as well as in the spec: a caller that reached
826
+ // this message was already guessing, and one that has to guess again
827
+ // spends a turn calling edit_script with a made-up op just to read the
828
+ // list off the rejection.
829
+ error: 'ops must be a non-empty array, e.g. [{"op": "add_line", "text": "Hello."}]. ' +
830
+ `The ops are: ${SCRIPT_OPS.join(", ")}.`
831
+ };
832
+ }
833
+ if (raw.length > MAX_SCRIPT_OPS) {
834
+ return {
835
+ error: `ops holds ${raw.length} entries; at most ${MAX_SCRIPT_OPS} per call.`
836
+ };
837
+ }
838
+ const parsed = [];
839
+ for (const [index, entry] of raw.entries()) {
840
+ if (!isRecord(entry)) {
841
+ return { error: `ops[${index}] must be an object.` };
842
+ }
843
+ const { op, ...rest } = entry;
844
+ if (!isString(op) || !isScriptOpName(op.trim())) {
845
+ return {
846
+ error: `ops[${index}] names "${String(op)}"; expected one of ${SCRIPT_OPS.join(", ")}.`
847
+ };
848
+ }
849
+ const name = op.trim();
850
+ const args = normalizeOpArgs(name, index, rest);
851
+ if (isError(args))
852
+ return args;
853
+ parsed.push({ op: name, args });
854
+ }
855
+ return parsed;
856
+ }
857
+ /** Resolve a speaker reference: id or name (case-insensitive). */
858
+ function findSpeakerIndex(doc, target) {
859
+ const raw = isString(target) ? target.trim() : "";
860
+ const byId = doc.cast.findIndex((speaker) => speaker.id === raw);
861
+ if (byId >= 0)
862
+ return byId;
863
+ const name = raw.toLowerCase();
864
+ return doc.cast.findIndex((speaker) => speaker.name.trim().toLowerCase() === name);
865
+ }
866
+ /**
867
+ * Why a speaker op found no speaker. A speaker op whose `target` is a line id
868
+ * is the same confusion twice over — the cast and the lines both answer to
869
+ * `target`, and `set_speaker` reads as "set this line's speaker" — so the one
870
+ * mistake worth naming is named.
871
+ */
872
+ function noSpeaker(doc, target) {
873
+ const raw = isString(target) ? target.trim() : String(target);
874
+ const cast = doc.cast.map((speaker) => `${speaker.id} (${speaker.name})`);
875
+ const looksLikeLine = /^line[_-]?\d+$/i.test(raw);
876
+ return new Error(`No speaker matches "${raw}".` +
877
+ (looksLikeLine
878
+ ? ' That is a line id — to give a line a speaker use {"op": "set_line_speaker", "target": "<line>", "speaker": "<speaker>"}.'
879
+ : "") +
880
+ (cast.length > 0
881
+ ? ` The cast is: ${cast.join(", ")}.`
882
+ : " This script has no cast yet; add one with add_speaker."));
883
+ }
884
+ /** The section an op addresses: by id, else the last one, else a fresh one. */
885
+ function resolveSection(doc, target) {
886
+ if (isNonBlankString(target)) {
887
+ const found = doc.sections.find((section) => section.id === target.trim());
888
+ if (!found)
889
+ throw new Error(`No section matches "${target}".`);
890
+ return found;
891
+ }
892
+ if (doc.sections.length === 0) {
893
+ const section = { id: `section_1`, lines: [] };
894
+ doc.sections.push(section);
895
+ return section;
896
+ }
897
+ return doc.sections[doc.sections.length - 1];
898
+ }
899
+ function mintId(prefix, used) {
900
+ let n = used.size + 1;
901
+ while (used.has(`${prefix}_${n}`))
902
+ n += 1;
903
+ return `${prefix}_${n}`;
904
+ }
905
+ /**
906
+ * How the voice's own name is spelled inside a nested voice object, depending
907
+ * on which surface printed it. All five mean the same field.
908
+ */
909
+ const VOICE_NAME_KEYS = ["voice", "voice_id", "voiceId", "id", "name"];
910
+ /**
911
+ * Flatten a voice sent as an object under `voice`.
912
+ *
913
+ * The binding is three sibling keys, but `get_script` *reports* a speaker's
914
+ * voice as one object, so `{op: "set_speaker_voice", target, voice: {provider,
915
+ * model, voice_id}}` is what a caller writes after reading the cast back — and
916
+ * it used to land as a `voice` that was not a string, fail the triple check,
917
+ * and be refused with a message listing the three keys it had just supplied.
918
+ */
919
+ function flattenVoiceArg(args) {
920
+ const nested = args["voice"];
921
+ if (!isRecord(nested))
922
+ return args;
923
+ const { voice: _nested, ...rest } = args;
924
+ const flat = { ...rest };
925
+ for (const key of ["provider", "model", "settings"]) {
926
+ if (flat[key] === undefined && nested[key] !== undefined) {
927
+ flat[key] = nested[key];
928
+ }
929
+ }
930
+ const name = VOICE_NAME_KEYS.map((key) => nested[key]).find((v) => isString(v));
931
+ if (name !== undefined)
932
+ flat["voice"] = name;
933
+ return flat;
934
+ }
935
+ /** A provider/model/voice triple, all three or none — never a half-guess. */
936
+ function parseVoiceBinding(raw) {
937
+ const args = flattenVoiceArg(raw);
938
+ const provider = args["provider"];
939
+ const model = args["model"];
940
+ const voice = args["voice"];
941
+ const given = [provider, model, voice].filter((v) => isString(v));
942
+ if (given.length === 0)
943
+ return null;
944
+ if (given.length !== 3) {
945
+ const missing = [
946
+ ["provider", provider],
947
+ ["model", model],
948
+ ["voice", voice]
949
+ ]
950
+ .filter(([, value]) => !isString(value))
951
+ .map(([key]) => key);
952
+ throw new Error(`A voice needs provider, model and voice together; this one has no ${missing.join(" and no ")}. ` +
953
+ "`voice` is the voice's own name (e.g. \"Aoede\"), not a second model " +
954
+ "id — find_model with capability=text_to_speech lists the names a " +
955
+ "model takes.");
956
+ }
957
+ const binding = {
958
+ provider: String(provider),
959
+ model: String(model),
960
+ voice: String(voice)
961
+ };
962
+ if (isObjectLike(args["settings"])) {
963
+ binding.settings = args["settings"];
964
+ }
965
+ return binding;
966
+ }
967
+ /**
968
+ * The key an op's own vocabulary names its unit by. The editor's merge adapter
969
+ * reads `line_id` before `target` before `id`, so stamping every key on every
970
+ * op would file a speaker op under `section.lines`. One key per op, plus the
971
+ * canonical `id` every consumer can read.
972
+ */
973
+ const UNIT_KEY_BY_OP = {
974
+ set_speaker: "target",
975
+ set_speaker_voice: "target",
976
+ remove_speaker: "target",
977
+ set_line_text: "line_id",
978
+ set_line_speaker: "line_id",
979
+ remove_line: "line_id"
980
+ };
981
+ /** Apply one script operation. Returns its summary, or throws with the reason. */
982
+ function applyScriptOp(doc, { op, args }, scriptLines) {
983
+ // entity linkage — accept `entityId` or `entity_id`, string to link, null/"" to clear
984
+ const entityIdArg = (a) => {
985
+ const raw = a["entityId"] ?? a["entity_id"];
986
+ if (raw === undefined)
987
+ return undefined;
988
+ if (raw === null)
989
+ return null;
990
+ if (isString(raw)) {
991
+ const v = raw.trim();
992
+ return v.length > 0 ? v : null;
993
+ }
994
+ throw new Error("entityId must be a string (asset id from list_entities) or null to clear.");
995
+ };
996
+ switch (op) {
997
+ case "set_setup": {
998
+ const setup = doc.setup ?? { stage: "idea", brief: "" };
999
+ if (args["stage"] !== undefined) {
1000
+ const stage = String(args["stage"]);
1001
+ if (!SETUP_STAGES.includes(stage)) {
1002
+ throw new Error(`stage must be one of ${SETUP_STAGES.join(", ")}; got "${stage}".`);
1003
+ }
1004
+ setup.stage = stage;
1005
+ }
1006
+ if (args["brief"] !== undefined)
1007
+ setup.brief = String(args["brief"]);
1008
+ if (args["format"] !== undefined)
1009
+ setup.format = String(args["format"]);
1010
+ if (args["length_seconds"] !== undefined) {
1011
+ const seconds = Number(args["length_seconds"]);
1012
+ if (!Number.isFinite(seconds) || seconds <= 0) {
1013
+ throw new Error("length_seconds must be a positive number of seconds.");
1014
+ }
1015
+ setup.length_seconds = Math.round(seconds);
1016
+ }
1017
+ if (args["pace"] !== undefined) {
1018
+ const pace = String(args["pace"]);
1019
+ if (!SETUP_PACES.includes(pace)) {
1020
+ throw new Error(`pace must be one of ${SETUP_PACES.join(", ")}; got "${pace}".`);
1021
+ }
1022
+ setup.pace = pace;
1023
+ }
1024
+ if (args["language"] !== undefined) {
1025
+ setup.language = String(args["language"]);
1026
+ }
1027
+ doc.setup = setup;
1028
+ return { ...setup };
1029
+ }
1030
+ case "add_speaker": {
1031
+ const name = args["name"];
1032
+ if (!isNonBlankString(name)) {
1033
+ throw new Error("add_speaker needs a non-empty `name`.");
1034
+ }
1035
+ const speaker = {
1036
+ id: mintId("speaker", new Set(doc.cast.map((s) => s.id))),
1037
+ name: name.trim(),
1038
+ voice: parseVoiceBinding(args)
1039
+ };
1040
+ if (isString(args["color"]))
1041
+ speaker.color = args["color"];
1042
+ const eid = entityIdArg(args);
1043
+ if (eid !== undefined)
1044
+ speaker.entityId = eid;
1045
+ doc.cast.push(speaker);
1046
+ return {
1047
+ id: speaker.id,
1048
+ name: speaker.name,
1049
+ has_voice: !!speaker.voice,
1050
+ entityId: speaker.entityId ?? null
1051
+ };
1052
+ }
1053
+ case "set_speaker": {
1054
+ const index = findSpeakerIndex(doc, args["target"]);
1055
+ if (index < 0)
1056
+ throw noSpeaker(doc, args["target"]);
1057
+ const speaker = { ...doc.cast[index] };
1058
+ if (args["name"] !== undefined)
1059
+ speaker.name = String(args["name"]);
1060
+ if (args["color"] !== undefined)
1061
+ speaker.color = String(args["color"]);
1062
+ const eid = entityIdArg(args);
1063
+ if (eid !== undefined)
1064
+ speaker.entityId = eid;
1065
+ doc.cast[index] = speaker;
1066
+ return { id: speaker.id, name: speaker.name, entityId: speaker.entityId ?? null };
1067
+ }
1068
+ case "set_speaker_voice": {
1069
+ const index = findSpeakerIndex(doc, args["target"]);
1070
+ if (index < 0)
1071
+ throw noSpeaker(doc, args["target"]);
1072
+ const voice = parseVoiceBinding(args);
1073
+ if (!voice) {
1074
+ throw new Error("set_speaker_voice needs provider, model and voice (use find_model to pick one).");
1075
+ }
1076
+ // Every take voiced with the old binding is now stale — `needsVoicing`
1077
+ // reads that off the take's own `voiceSnapshot`, so nothing to write.
1078
+ doc.cast[index] = { ...doc.cast[index], voice };
1079
+ return { id: doc.cast[index].id, voice };
1080
+ }
1081
+ case "remove_speaker": {
1082
+ const index = findSpeakerIndex(doc, args["target"]);
1083
+ if (index < 0)
1084
+ throw noSpeaker(doc, args["target"]);
1085
+ const [removed] = doc.cast.splice(index, 1);
1086
+ for (const section of doc.sections) {
1087
+ section.lines = section.lines.map((line) => line.speakerId === removed.id ? { ...line, speakerId: null } : line);
1088
+ }
1089
+ return { removed: removed.id };
1090
+ }
1091
+ case "add_section": {
1092
+ const section = {
1093
+ id: mintId("section", new Set(doc.sections.map((s) => s.id))),
1094
+ lines: []
1095
+ };
1096
+ if (isString(args["title"]))
1097
+ section.title = args["title"];
1098
+ doc.sections.push(section);
1099
+ return { id: section.id, title: section.title };
1100
+ }
1101
+ case "add_line": {
1102
+ const text = args["text"];
1103
+ if (!isNonBlankString(text)) {
1104
+ throw new Error("add_line needs a non-empty `text`.");
1105
+ }
1106
+ const section = resolveSection(doc, args["section"]);
1107
+ let speakerId = null;
1108
+ if (args["speaker"] !== undefined) {
1109
+ const index = findSpeakerIndex(doc, args["speaker"]);
1110
+ if (index < 0)
1111
+ throw noSpeaker(doc, args["speaker"]);
1112
+ speakerId = doc.cast[index].id;
1113
+ }
1114
+ const used = new Set(scriptLines(doc.sections).map((line) => line.id));
1115
+ const line = {
1116
+ id: mintId("line", used),
1117
+ speakerId,
1118
+ text,
1119
+ takes: []
1120
+ };
1121
+ if (isString(args["direction"])) {
1122
+ line.direction = args["direction"];
1123
+ }
1124
+ if (isNumber(args["pause_after_ms"])) {
1125
+ line.pauseAfterMs = args["pause_after_ms"];
1126
+ }
1127
+ const at = isNumber(args["index"])
1128
+ ? Math.max(0, Math.min(Math.trunc(args["index"]), section.lines.length))
1129
+ : section.lines.length;
1130
+ section.lines.splice(at, 0, line);
1131
+ return { id: line.id, section_id: section.id, index: at };
1132
+ }
1133
+ case "set_line_text": {
1134
+ const target = String(args["target"] ?? "");
1135
+ const line = findLine(scriptLines(doc.sections), target);
1136
+ if (!line)
1137
+ throw new Error(`No line matches "${target}".`);
1138
+ const text = args["text"];
1139
+ if (!isNonBlankString(text)) {
1140
+ throw new Error("set_line_text needs a non-empty `text`.");
1141
+ }
1142
+ // The takes stay: each carries the text it was voiced from, so rewriting
1143
+ // the line makes them stale rather than gone, and `voice_script_lines`
1144
+ // re-records exactly those.
1145
+ line.text = text;
1146
+ return { id: line.id, text: line.text, status: "stale" };
1147
+ }
1148
+ case "set_line_speaker": {
1149
+ const target = String(args["target"] ?? "");
1150
+ const line = findLine(scriptLines(doc.sections), target);
1151
+ if (!line)
1152
+ throw new Error(`No line matches "${target}".`);
1153
+ const index = findSpeakerIndex(doc, args["speaker"]);
1154
+ if (index < 0)
1155
+ throw noSpeaker(doc, args["speaker"]);
1156
+ line.speakerId = doc.cast[index].id;
1157
+ return { id: line.id, speaker_id: line.speakerId };
1158
+ }
1159
+ case "remove_line": {
1160
+ const target = String(args["target"] ?? "");
1161
+ const line = findLine(scriptLines(doc.sections), target);
1162
+ if (!line)
1163
+ throw new Error(`No line matches "${target}".`);
1164
+ for (const section of doc.sections) {
1165
+ section.lines = section.lines.filter((l) => l.id !== line.id);
1166
+ }
1167
+ return { removed: line.id };
1168
+ }
1169
+ }
1170
+ }
1171
+ const editScript = {
1172
+ spec: editScriptSpec,
1173
+ impl: async (run, params) => {
1174
+ const ops = parseScriptOps(params["ops"]);
1175
+ if (isError(ops))
1176
+ return ops;
1177
+ const { Script } = await import("@nodetool-ai/models");
1178
+ const { scriptLines } = await import("@nodetool-ai/timeline");
1179
+ for (let attempt = 0; attempt < CAS_ATTEMPTS; attempt++) {
1180
+ const script = await loadScript(run, params["script_id"]);
1181
+ if (isError(script))
1182
+ return script;
1183
+ const { row, doc } = script;
1184
+ // A failing op is recorded and the script continues: stopping at the
1185
+ // first error hides every problem behind it.
1186
+ const records = [];
1187
+ const resolvedOps = [];
1188
+ for (const parsed of ops) {
1189
+ try {
1190
+ const result = applyScriptOp(doc, parsed, scriptLines);
1191
+ records.push({
1192
+ op: parsed.op,
1193
+ ok: true,
1194
+ result
1195
+ });
1196
+ const canonicalId = typeof result?.["id"] === "string"
1197
+ ? result["id"]
1198
+ : typeof result?.["removed"] === "string"
1199
+ ? result["removed"]
1200
+ : undefined;
1201
+ const key = UNIT_KEY_BY_OP[parsed.op];
1202
+ resolvedOps.push({
1203
+ tool: parsed.op,
1204
+ input: canonicalId && key
1205
+ ? { ...parsed.args, [key]: canonicalId, id: canonicalId }
1206
+ : parsed.args
1207
+ });
1208
+ }
1209
+ catch (e) {
1210
+ records.push({ op: parsed.op, ok: false, error: errorMessage(e) });
1211
+ resolvedOps.push({ tool: parsed.op, input: parsed.args });
1212
+ }
1213
+ }
1214
+ const saved = await Script.updateFieldsIfUnchanged(row.id, row.updated_at, {
1215
+ document: JSON.stringify(doc)
1216
+ },
1217
+ // The ops ride on the write so an open editor merges this change per
1218
+ // merge unit instead of treating the script as replaced.
1219
+ { ops: resolvedOps });
1220
+ if (!saved)
1221
+ continue;
1222
+ const failed = records.filter((record) => !record.ok);
1223
+ return {
1224
+ script_id: row.id,
1225
+ updated_at: saved.updated_at,
1226
+ applied: records.length - failed.length,
1227
+ failed: failed.length,
1228
+ ops: records,
1229
+ cast: doc.cast.map((speaker) => ({
1230
+ id: speaker.id,
1231
+ name: speaker.name,
1232
+ has_voice: !!speaker.voice,
1233
+ entityId: speaker.entityId ?? null
1234
+ })),
1235
+ lines: scriptLines(doc.sections).map((line, index) => ({
1236
+ id: line.id,
1237
+ index,
1238
+ speaker_id: line.speakerId ?? null,
1239
+ text: line.text,
1240
+ takes: line.takes.length
1241
+ }))
1242
+ };
1243
+ }
1244
+ return {
1245
+ error: `Script ${String(params["script_id"])} is being modified concurrently; nothing was saved. Retry the call.`
1246
+ };
1247
+ }
1248
+ };
1249
+ // ---------------------------------------------------------------------------
1250
+ // derive_storyboard_from_script
1251
+ // ---------------------------------------------------------------------------
1252
+ //
1253
+ // `deriveShotScaffold` pins linkage, order and the projected text
1254
+ // deterministically; shot *content* — action, slug, camera, motion — is the
1255
+ // director's job. The normalizer holds the line: a response that drops or
1256
+ // reassigns `script_line_ids` is refused and retried, and the scaffold is the
1257
+ // floor a failed director pass falls back to.
1258
+ /** Attempts at a director response that keeps every scaffold's line links. */
1259
+ const DIRECTOR_ATTEMPTS = 2;
1260
+ /**
1261
+ * The model the director pass runs on. Both fields absent means "no director" —
1262
+ * the scaffold ships as it is. One without the other is a mistake worth naming
1263
+ * rather than guessing at, the same posture the render tools take.
1264
+ */
1265
+ function resolveDirectorModel(params) {
1266
+ const provider = isString(params["provider"]) ? params["provider"].trim() : "";
1267
+ const model = isString(params["model"]) ? params["model"].trim() : "";
1268
+ if (!provider && !model)
1269
+ return null;
1270
+ if (!provider || !model) {
1271
+ return {
1272
+ error: "The director pass needs provider and model together (use find_model with capability=text_generation). Omit both for the deterministic scaffold."
1273
+ };
1274
+ }
1275
+ return { provider, model };
1276
+ }
1277
+ const DIRECTOR_SHOTS_SCHEMA = {
1278
+ type: "object",
1279
+ additionalProperties: false,
1280
+ required: ["shots"],
1281
+ properties: {
1282
+ style: { type: "string" },
1283
+ shots: {
1284
+ type: "array",
1285
+ items: {
1286
+ type: "object",
1287
+ additionalProperties: false,
1288
+ required: ["script_line_ids", "action"],
1289
+ properties: {
1290
+ script_line_ids: { type: "array", items: { type: "string" } },
1291
+ action: { type: "string" },
1292
+ slug: { type: "string" },
1293
+ motion: { type: "string" },
1294
+ duration_seconds: { type: "number" },
1295
+ camera: {
1296
+ type: "object",
1297
+ additionalProperties: false,
1298
+ properties: {
1299
+ framing: { type: "string" },
1300
+ lens: { type: "string" },
1301
+ angle: { type: "string" },
1302
+ movement: { type: "string" }
1303
+ }
1304
+ }
1305
+ }
1306
+ }
1307
+ }
1308
+ }
1309
+ };
1310
+ const DIRECTOR_SYSTEM_PROMPT = [
1311
+ "You are a film director turning a written script into a shot list.",
1312
+ "Each shot below already covers a fixed set of script lines. Keep every",
1313
+ "shot's `script_line_ids` exactly as given — same ids, same order, one entry",
1314
+ "per shot — and write what the camera sees: a concrete visual `action`, plus",
1315
+ "`slug`, `camera` and `motion` where they help. Call the shots tool once."
1316
+ ].join(" ");
1317
+ const optionalText = (value) => {
1318
+ const text = isString(value) ? value.trim() : "";
1319
+ return text.length > 0 ? text : undefined;
1320
+ };
1321
+ /**
1322
+ * Merge a director response onto the scaffold, or say why it cannot be trusted.
1323
+ * Shots are matched by the line ids they claim, so a response that drops a
1324
+ * shot, invents one, or moves a line between shots fails here rather than
1325
+ * producing a board whose links no longer describe the script.
1326
+ */
1327
+ function normalizeDirectedShots(raw, scaffoldShots) {
1328
+ const shots = isObjectLike(raw)
1329
+ ? raw.shots
1330
+ : undefined;
1331
+ if (!Array.isArray(shots)) {
1332
+ return { error: "the response carried no `shots` array" };
1333
+ }
1334
+ if (shots.length !== scaffoldShots.length) {
1335
+ return {
1336
+ error: `the response has ${shots.length} shots; the script's scaffold has ${scaffoldShots.length}`
1337
+ };
1338
+ }
1339
+ const key = (ids) => ids.join("\u0000");
1340
+ const byKey = new Map(scaffoldShots.map((shot) => [key(shot.script_line_ids ?? []), shot]));
1341
+ const directed = new Map();
1342
+ for (const [index, entry] of shots.entries()) {
1343
+ if (!isRecord(entry)) {
1344
+ return { error: `shots[${index}] is not an object` };
1345
+ }
1346
+ const args = entry;
1347
+ const lineIds = args["script_line_ids"];
1348
+ if (!Array.isArray(lineIds) || lineIds.some((id) => !isString(id))) {
1349
+ return { error: `shots[${index}] dropped its \`script_line_ids\`` };
1350
+ }
1351
+ const scaffold = byKey.get(key(lineIds));
1352
+ if (!scaffold) {
1353
+ return {
1354
+ error: `shots[${index}] reassigned its lines to [${lineIds.join(", ")}], which no scaffold shot covers`
1355
+ };
1356
+ }
1357
+ if (directed.has(scaffold.id)) {
1358
+ return {
1359
+ error: `shots[${index}] repeats the lines already covered by shot ${scaffold.id}`
1360
+ };
1361
+ }
1362
+ const action = optionalText(args["action"]);
1363
+ if (!action) {
1364
+ return { error: `shots[${index}] has no \`action\`` };
1365
+ }
1366
+ const shot = { ...scaffold, action };
1367
+ const slug = optionalText(args["slug"]);
1368
+ if (slug)
1369
+ shot.slug = slug;
1370
+ const motion = optionalText(args["motion"]);
1371
+ if (motion)
1372
+ shot.motion = motion;
1373
+ const camera = args["camera"];
1374
+ if (isRecord(camera)) {
1375
+ shot.camera = camera;
1376
+ }
1377
+ const seconds = Number(args["duration_seconds"]);
1378
+ if (Number.isFinite(seconds) && seconds > 0) {
1379
+ shot.duration_seconds = seconds;
1380
+ }
1381
+ directed.set(scaffold.id, shot);
1382
+ }
1383
+ const missing = scaffoldShots.filter((shot) => !directed.has(shot.id));
1384
+ if (missing.length > 0) {
1385
+ return {
1386
+ error: `the response covers no shot for lines [${(missing[0].script_line_ids ?? []).join(", ")}]`
1387
+ };
1388
+ }
1389
+ return scaffoldShots.map((shot) => directed.get(shot.id));
1390
+ }
1391
+ /** One director round-trip, returning whatever the provider answered with. */
1392
+ async function callDirector(context, model, userPrompt) {
1393
+ const provider = await context.getProvider(model.provider);
1394
+ const call = isFunction(provider.generateMessageTraced)
1395
+ ? provider.generateMessageTraced.bind(provider)
1396
+ : provider.generateMessage.bind(provider);
1397
+ const result = await call({
1398
+ model: model.model,
1399
+ messages: [
1400
+ { role: "system", content: DIRECTOR_SYSTEM_PROMPT },
1401
+ { role: "user", content: userPrompt }
1402
+ ],
1403
+ tools: [
1404
+ {
1405
+ name: "shots",
1406
+ description: "Submit the directed shots, one per scaffold entry, with the line ids unchanged.",
1407
+ inputSchema: DIRECTOR_SHOTS_SCHEMA
1408
+ }
1409
+ ],
1410
+ toolChoice: "shots"
1411
+ });
1412
+ const call0 = result.toolCalls?.[0];
1413
+ return call0?.name === "shots" ? call0.args : null;
1414
+ }
1415
+ const deriveStoryboardFromScript = {
1416
+ spec: deriveStoryboardFromScriptSpec,
1417
+ impl: async (run, params) => {
1418
+ const context = run.context;
1419
+ const handle = await loadScript(run, params["script_id"]);
1420
+ if (isError(handle))
1421
+ return handle;
1422
+ const { row, doc } = handle;
1423
+ const model = resolveDirectorModel(params);
1424
+ if (isError(model))
1425
+ return model;
1426
+ const { deriveShotScaffold, joinLineTexts, validateScriptLink } = await import("@nodetool-ai/protocol");
1427
+ const scaffolds = deriveShotScaffold({
1428
+ id: row.id,
1429
+ cast: doc.cast,
1430
+ sections: doc.sections
1431
+ });
1432
+ if (scaffolds.length === 0) {
1433
+ return {
1434
+ error: `Script ${row.id} has no line with text, so there is nothing to storyboard. Write the lines with edit_script first.`
1435
+ };
1436
+ }
1437
+ const textByLineId = new Map(doc.sections.flatMap((section) => section.lines.map((line) => [line.id, line.text])));
1438
+ const stamp = Date.now().toString(36);
1439
+ const scaffoldShots = scaffolds.map((scaffold, index) => {
1440
+ const shot = {
1441
+ type: "shot",
1442
+ id: `shot_${index + 1}_${stamp}`,
1443
+ index,
1444
+ // The floor a failed director pass falls back to: the words the shot
1445
+ // covers, standing in for the visual nobody has described yet.
1446
+ action: scaffold.dialogue ?? scaffold.narration ?? "",
1447
+ status: "planned",
1448
+ script_line_ids: scaffold.script_line_ids,
1449
+ script_text_snapshot: joinLineTexts(scaffold.script_line_ids.map((id) => textByLineId.get(id) ?? ""))
1450
+ };
1451
+ if (scaffold.dialogue)
1452
+ shot.dialogue = scaffold.dialogue;
1453
+ if (scaffold.narration)
1454
+ shot.narration = scaffold.narration;
1455
+ return shot;
1456
+ });
1457
+ let shots = scaffoldShots;
1458
+ let directorRounds = 0;
1459
+ let directorNote;
1460
+ if (model) {
1461
+ const brief = scaffolds
1462
+ .map((scaffold, index) => `${index + 1}. script_line_ids=${JSON.stringify(scaffold.script_line_ids)} ` +
1463
+ `words=${JSON.stringify(scaffold.dialogue ?? scaffold.narration ?? "")}`)
1464
+ .join("\n");
1465
+ let complaint = "";
1466
+ for (let attempt = 0; attempt < DIRECTOR_ATTEMPTS; attempt++) {
1467
+ directorRounds += 1;
1468
+ let normalized;
1469
+ try {
1470
+ const raw = await callDirector(context, model, `Script: ${row.name}\n\nShots to direct, in order:\n${brief}` +
1471
+ (complaint ? `\n\nYour last answer was rejected: ${complaint}` : ""));
1472
+ normalized = normalizeDirectedShots(raw, scaffoldShots);
1473
+ }
1474
+ catch (e) {
1475
+ normalized = { error: errorMessage(e) };
1476
+ }
1477
+ if (!isError(normalized)) {
1478
+ shots = normalized;
1479
+ directorNote = undefined;
1480
+ break;
1481
+ }
1482
+ complaint = normalized.error;
1483
+ directorNote = `The director pass was refused after ${directorRounds} attempt(s) (${complaint}); the shots are the deterministic scaffold.`;
1484
+ }
1485
+ }
1486
+ const screenplay = {
1487
+ type: "screenplay",
1488
+ id: `sp_${stamp}`,
1489
+ title: row.name,
1490
+ shots,
1491
+ script_id: row.id
1492
+ };
1493
+ const validation = validateScriptLink(screenplay, { sections: doc.sections });
1494
+ if (validation.errors.length > 0) {
1495
+ return {
1496
+ error: `The derived board would not validate, so nothing was created: ${validation.errors
1497
+ .map((issue) => issue.message)
1498
+ .join(" ")}`
1499
+ };
1500
+ }
1501
+ // The board is created already carrying `script_id` and every shot's line
1502
+ // references, so the forward link needs no second write. The script's
1503
+ // back-pointer does, and it is stamped after — a board that exists without
1504
+ // the pointer is consistent and navigable from the board side, while a
1505
+ // pointer written first could name a board that was never created.
1506
+ // Bound as a namespace so the `Storyboard` row type imported at the top of
1507
+ // this file stays visible here.
1508
+ const models = await import("@nodetool-ai/models");
1509
+ const name = isString(params["name"]) && params["name"]
1510
+ ? params["name"]
1511
+ : row.name;
1512
+ const board = await models.Storyboard.create({
1513
+ user_id: context.userId,
1514
+ project_id: row.project_id,
1515
+ name,
1516
+ document: JSON.stringify({
1517
+ screenplay,
1518
+ shots,
1519
+ brief: "",
1520
+ style: "",
1521
+ entityIds: [],
1522
+ aspectRatio: "16:9",
1523
+ directorModel: model
1524
+ ? { type: "language_model", provider: model.provider, id: model.model }
1525
+ : null,
1526
+ imageModel: null,
1527
+ videoModel: null
1528
+ })
1529
+ });
1530
+ const stamped = await stampScriptStoryboardId(row.id, board.id, context.userId);
1531
+ if (isError(stamped)) {
1532
+ return {
1533
+ error: `Storyboard ${board.id} was created and links script ${row.id}, but the script's back-pointer could not be written: ${stamped.error} The board is valid; the script reads as unlinked until this is retried.`,
1534
+ storyboard_id: board.id,
1535
+ script_id: row.id
1536
+ };
1537
+ }
1538
+ return {
1539
+ ok: true,
1540
+ storyboard_id: board.id,
1541
+ script_id: row.id,
1542
+ name: board.name,
1543
+ shot_count: shots.length,
1544
+ directed: shots !== scaffoldShots,
1545
+ director_rounds: directorRounds,
1546
+ note: directorNote,
1547
+ warnings: validation.warnings.map((issue) => issue.message),
1548
+ shots: shots.map((shot) => ({
1549
+ id: shot.id,
1550
+ index: shot.index,
1551
+ slug: shot.slug,
1552
+ action: shot.action,
1553
+ status: shot.status,
1554
+ script_line_ids: shot.script_line_ids ?? []
1555
+ }))
1556
+ };
1557
+ }
1558
+ };
1559
+ // ---------------------------------------------------------------------------
1560
+ // write_script
1561
+ // ---------------------------------------------------------------------------
1562
+ /**
1563
+ * The writer, headless. The browser's `useWriteScript` runs the same protocol
1564
+ * functions; keeping the prompt, the schema and the parse in
1565
+ * `@nodetool-ai/protocol` is what makes a script written here and one written
1566
+ * in the flow the same artifact.
1567
+ *
1568
+ * Imported words never reach the writer's schema. They are split by
1569
+ * `splitImportedText` and attributed by a call whose schema has no text field,
1570
+ * and every line's words come from the split — so an agent handed a user's own
1571
+ * script cannot quietly improve it (PRD § 9.7 criterion 4).
1572
+ */
1573
+ /**
1574
+ * Ids for one written script. `Date.now()` alone is not enough: two writes
1575
+ * inside the same millisecond mint the same prefix, so a rewrite's new line can
1576
+ * be handed the id of a line that rewrite dropped — and with it that line's
1577
+ * takes, which are paid-for audio of different words.
1578
+ */
1579
+ let writeSequence = 0;
1580
+ const nextIdPrefix = () => `w${Date.now().toString(36)}${(writeSequence++).toString(36)}`;
1581
+ const writeScript = {
1582
+ spec: writeScriptSpec,
1583
+ impl: async (run, params) => {
1584
+ const script = await loadScript(run, params["script_id"]);
1585
+ if (isError(script))
1586
+ return script;
1587
+ const { row, doc } = script;
1588
+ const setup = doc.setup;
1589
+ const brief = setup?.brief.trim() ?? "";
1590
+ const imported = isNonBlankString(params["imported_text"])
1591
+ ? params["imported_text"]
1592
+ : "";
1593
+ if (brief === "" && imported === "") {
1594
+ return {
1595
+ error: `Script ${row.id} has no brief, so there is nothing to write. Set one with edit_script's set_setup op, or pass imported_text.`
1596
+ };
1597
+ }
1598
+ const provider = isNonBlankString(params["provider"])
1599
+ ? params["provider"]
1600
+ : "";
1601
+ const model = isNonBlankString(params["model"]) ? params["model"] : "";
1602
+ if (!provider || !model) {
1603
+ return {
1604
+ error: "write_script needs provider + model for the writer (use find_model with capability=generate_text)."
1605
+ };
1606
+ }
1607
+ const { ATTRIBUTION_SYSTEM_PROMPT, ATTRIBUTION_TOOL_DESCRIPTION, ATTRIBUTION_TOOL_NAME, SCRIPT_TOOL_DESCRIPTION, SCRIPT_TOOL_NAME, SCRIPT_WRITER_SYSTEM_PROMPT, applyAttribution, buildAttributionPrompt, buildAttributionSchema, buildScriptSchema, buildScriptWriterPrompt, fallbackScript, parseWrittenScript, scriptFormatById, splitImportedText } = await import("@nodetool-ai/protocol");
1608
+ const { generateStructured } = await import("@nodetool-ai/runtime");
1609
+ const format = setup?.format ?? "";
1610
+ const sectionTitle = scriptFormatById(format)?.sections[0] ?? "Script";
1611
+ const idPrefix = nextIdPrefix();
1612
+ const heldLineIds = doc.sections.flatMap((section) => section.lines.map((line) => line.id));
1613
+ const existingCast = doc.cast.map((speaker) => ({
1614
+ id: speaker.id,
1615
+ name: speaker.name
1616
+ }));
1617
+ const llm = await run.context.getProvider(provider);
1618
+ let written;
1619
+ if (imported !== "") {
1620
+ const texts = splitImportedText(imported);
1621
+ const answer = await generateStructured(llm, {
1622
+ model,
1623
+ maxTokens: MAX_WRITER_TOKENS,
1624
+ messages: [
1625
+ { role: "system", content: ATTRIBUTION_SYSTEM_PROMPT },
1626
+ {
1627
+ role: "user",
1628
+ content: buildAttributionPrompt(texts, { brief, format })
1629
+ }
1630
+ ],
1631
+ toolName: ATTRIBUTION_TOOL_NAME,
1632
+ toolDescription: ATTRIBUTION_TOOL_DESCRIPTION,
1633
+ schema: buildAttributionSchema(texts.length)
1634
+ });
1635
+ written = applyAttribution(texts, answer, {
1636
+ idPrefix,
1637
+ lineIds: heldLineIds,
1638
+ sectionTitle,
1639
+ existingCast
1640
+ });
1641
+ }
1642
+ else {
1643
+ const rewrite = params["rewrite"] === true;
1644
+ const input = {
1645
+ brief,
1646
+ format,
1647
+ lengthSeconds: setup?.length_seconds ?? DEFAULT_SCRIPT_SECONDS,
1648
+ pace: setup?.pace,
1649
+ language: setup?.language,
1650
+ existing: rewrite
1651
+ ? {
1652
+ cast: existingCast,
1653
+ sections: doc.sections.map((section) => ({
1654
+ id: section.id,
1655
+ title: section.title ?? "",
1656
+ lines: section.lines.map((line) => ({
1657
+ id: line.id,
1658
+ speakerId: line.speakerId ?? null,
1659
+ text: line.text,
1660
+ direction: line.direction
1661
+ }))
1662
+ }))
1663
+ }
1664
+ : undefined
1665
+ };
1666
+ const answer = await generateStructured(llm, {
1667
+ model,
1668
+ maxTokens: MAX_WRITER_TOKENS,
1669
+ messages: [
1670
+ { role: "system", content: SCRIPT_WRITER_SYSTEM_PROMPT },
1671
+ { role: "user", content: buildScriptWriterPrompt(input) }
1672
+ ],
1673
+ toolName: SCRIPT_TOOL_NAME,
1674
+ toolDescription: SCRIPT_TOOL_DESCRIPTION,
1675
+ schema: buildScriptSchema({ retainIds: heldLineIds })
1676
+ });
1677
+ const parseOptions = { idPrefix, retainIds: heldLineIds, existingCast };
1678
+ const parsed = parseWrittenScript(answer, parseOptions);
1679
+ // A provider without tool support — or the fake one — falls back to the
1680
+ // brief split into lines, the same rule the Director and the editor
1681
+ // apply. Only a provider failure throws.
1682
+ written =
1683
+ parsed.sections.length > 0
1684
+ ? parsed
1685
+ : fallbackScript(input, parseOptions);
1686
+ }
1687
+ const { Script } = await import("@nodetool-ai/models");
1688
+ for (let attempt = 0; attempt < CAS_ATTEMPTS; attempt++) {
1689
+ const current = await loadScript(run, row.id);
1690
+ if (isError(current))
1691
+ return current;
1692
+ const next = current.doc;
1693
+ // A line that comes back with an id the script already carries keeps its
1694
+ // takes: re-voicing a line the writer did not touch would spend money to
1695
+ // produce the same audio.
1696
+ const heldLines = new Map(next.sections
1697
+ .flatMap((section) => section.lines)
1698
+ .map((line) => [line.id, line]));
1699
+ const heldSpeakers = new Map(next.cast.map((speaker) => [speaker.id, speaker]));
1700
+ next.cast = written.cast.map((speaker) => {
1701
+ const kept = heldSpeakers.get(speaker.id);
1702
+ return kept ? { ...kept, name: speaker.name } : { ...speaker };
1703
+ });
1704
+ next.sections = written.sections.map((section) => ({
1705
+ id: section.id,
1706
+ title: section.title,
1707
+ lines: section.lines.map((line) => {
1708
+ const kept = heldLines.get(line.id);
1709
+ const merged = {
1710
+ ...kept,
1711
+ id: line.id,
1712
+ speakerId: line.speakerId,
1713
+ text: line.text,
1714
+ takes: kept?.takes ?? []
1715
+ };
1716
+ if (line.direction !== undefined)
1717
+ merged.direction = line.direction;
1718
+ if (line.targetDurationMs !== undefined) {
1719
+ merged.targetDurationMs = line.targetDurationMs;
1720
+ }
1721
+ return merged;
1722
+ })
1723
+ }));
1724
+ if (next.setup) {
1725
+ next.setup.stage = next.setup.stage === "format" ? "review" : next.setup.stage;
1726
+ }
1727
+ const saved = await Script.updateFieldsIfUnchanged(row.id, current.row.updated_at, {
1728
+ document: JSON.stringify(next)
1729
+ });
1730
+ if (!saved)
1731
+ continue;
1732
+ return {
1733
+ script_id: row.id,
1734
+ updated_at: saved.updated_at,
1735
+ rewritten: params["rewrite"] === true,
1736
+ imported: imported !== "",
1737
+ cast: next.cast.map((speaker) => ({
1738
+ id: speaker.id,
1739
+ name: speaker.name
1740
+ })),
1741
+ lines: next.sections.flatMap((section) => section.lines.map((line) => ({
1742
+ id: line.id,
1743
+ section_id: section.id,
1744
+ speaker_id: line.speakerId ?? null,
1745
+ text: line.text,
1746
+ direction: line.direction,
1747
+ take_count: line.takes.length
1748
+ })))
1749
+ };
1750
+ }
1751
+ return {
1752
+ error: `Script ${row.id} was modified while it was being written. Read it again and retry.`
1753
+ };
1754
+ }
1755
+ };
1756
+ /** Every script capability, in the order the tool file declared them. */
1757
+ /**
1758
+ * Delete a script the caller owns.
1759
+ *
1760
+ * The ownership check and the version cascade are `Script.deleteOwned`, the
1761
+ * same function the tRPC route calls — a delete is not a place for two copies
1762
+ * of one rule, and version rows outliving their document would be unreachable
1763
+ * garbage. Missing and not-yours are one answer.
1764
+ */
1765
+ const deleteScript = {
1766
+ spec: deleteScriptSpec,
1767
+ impl: async (run, params) => {
1768
+ const userId = run.context.userId;
1769
+ if (!userId)
1770
+ return { error: "No user is bound to this session." };
1771
+ const { Script } = await import("@nodetool-ai/models");
1772
+ const id = String(params["script_id"]);
1773
+ const deleted = await Script.deleteOwned(userId, id);
1774
+ return deleted
1775
+ ? { script_id: id, deleted: true }
1776
+ : { error: `Script ${id} was not found, or it is not yours.` };
1777
+ }
1778
+ };
1779
+ export const SCRIPT_CAPABILITIES = [
1780
+ listScripts,
1781
+ createScript,
1782
+ getScript,
1783
+ voiceScriptLines,
1784
+ assembleScriptTimeline,
1785
+ editScript,
1786
+ writeScript,
1787
+ deriveStoryboardFromScript,
1788
+ deleteScript
1789
+ ];
1790
+ export const module = {
1791
+ module: "scripts",
1792
+ exports: SCRIPT_CAPABILITIES
1793
+ };
1794
+ export { listScripts, createScript, getScript, voiceScriptLines, assembleScriptTimeline, editScript, writeScript, deriveStoryboardFromScript, deleteScript };
1795
+ //# sourceMappingURL=scripts.js.map