@nodetool-ai/agents 0.8.1 → 0.8.3

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 (477) hide show
  1. package/dist/.nodetool-build-stamp +1 -1
  2. package/dist/analysis/audio-dsp.d.ts +3 -2
  3. package/dist/analysis/audio-dsp.d.ts.map +1 -1
  4. package/dist/analysis/audio-dsp.js +11 -8
  5. package/dist/analysis/audio-dsp.js.map +1 -1
  6. package/dist/analysis/media-decode.d.ts +13 -0
  7. package/dist/analysis/media-decode.d.ts.map +1 -1
  8. package/dist/analysis/media-decode.js +33 -6
  9. package/dist/analysis/media-decode.js.map +1 -1
  10. package/dist/apify/assets.d.ts.map +1 -1
  11. package/dist/apify/assets.js +4 -0
  12. package/dist/apify/assets.js.map +1 -1
  13. package/dist/author-graph.d.ts +2 -3
  14. package/dist/author-graph.d.ts.map +1 -1
  15. package/dist/author-graph.js +3 -5
  16. package/dist/author-graph.js.map +1 -1
  17. package/dist/browser-gate.d.ts +2 -2
  18. package/dist/browser-gate.js +2 -2
  19. package/dist/capabilities/GamePublishRequest.d.ts +14 -0
  20. package/dist/capabilities/GamePublishRequest.d.ts.map +1 -0
  21. package/dist/capabilities/GamePublishRequest.js +2 -0
  22. package/dist/capabilities/GamePublishRequest.js.map +1 -0
  23. package/dist/capabilities/adapters.d.ts +4 -13
  24. package/dist/capabilities/adapters.d.ts.map +1 -1
  25. package/dist/capabilities/adapters.js +9 -14
  26. package/dist/capabilities/adapters.js.map +1 -1
  27. package/dist/capabilities/agent-activity.d.ts +27 -0
  28. package/dist/capabilities/agent-activity.d.ts.map +1 -0
  29. package/dist/capabilities/agent-activity.js +103 -0
  30. package/dist/capabilities/agent-activity.js.map +1 -0
  31. package/dist/capabilities/agentic-storyboard-finish.d.ts +67 -0
  32. package/dist/capabilities/agentic-storyboard-finish.d.ts.map +1 -0
  33. package/dist/capabilities/agentic-storyboard-finish.js +1321 -0
  34. package/dist/capabilities/agentic-storyboard-finish.js.map +1 -0
  35. package/dist/capabilities/agents.d.ts +5 -2
  36. package/dist/capabilities/agents.d.ts.map +1 -1
  37. package/dist/capabilities/agents.js +14 -4
  38. package/dist/capabilities/agents.js.map +1 -1
  39. package/dist/capabilities/agents.specs.d.ts +3 -0
  40. package/dist/capabilities/agents.specs.d.ts.map +1 -1
  41. package/dist/capabilities/agents.specs.js +71 -1
  42. package/dist/capabilities/agents.specs.js.map +1 -1
  43. package/dist/capabilities/analysis.d.ts.map +1 -1
  44. package/dist/capabilities/analysis.js +33 -22
  45. package/dist/capabilities/analysis.js.map +1 -1
  46. package/dist/capabilities/analysis.specs.js +2 -2
  47. package/dist/capabilities/analysis.specs.js.map +1 -1
  48. package/dist/capabilities/apps.d.ts.map +1 -1
  49. package/dist/capabilities/apps.js +5 -3
  50. package/dist/capabilities/apps.js.map +1 -1
  51. package/dist/capabilities/args.d.ts +2 -5
  52. package/dist/capabilities/args.d.ts.map +1 -1
  53. package/dist/capabilities/args.js +2 -5
  54. package/dist/capabilities/args.js.map +1 -1
  55. package/dist/capabilities/assets.d.ts.map +1 -1
  56. package/dist/capabilities/assets.js +40 -10
  57. package/dist/capabilities/assets.js.map +1 -1
  58. package/dist/capabilities/browser.d.ts +1 -1
  59. package/dist/capabilities/browser.js +1 -1
  60. package/dist/capabilities/browser.specs.d.ts +1 -1
  61. package/dist/capabilities/browser.specs.js +1 -1
  62. package/dist/capabilities/code.d.ts +5 -0
  63. package/dist/capabilities/code.d.ts.map +1 -1
  64. package/dist/capabilities/code.js +128 -89
  65. package/dist/capabilities/code.js.map +1 -1
  66. package/dist/capabilities/collections.d.ts +4 -6
  67. package/dist/capabilities/collections.d.ts.map +1 -1
  68. package/dist/capabilities/collections.js +16 -11
  69. package/dist/capabilities/collections.js.map +1 -1
  70. package/dist/capabilities/derive-shot.d.ts +45 -0
  71. package/dist/capabilities/derive-shot.d.ts.map +1 -0
  72. package/dist/capabilities/derive-shot.js +82 -0
  73. package/dist/capabilities/derive-shot.js.map +1 -0
  74. package/dist/capabilities/documents.d.ts +2 -1
  75. package/dist/capabilities/documents.d.ts.map +1 -1
  76. package/dist/capabilities/documents.js +12 -6
  77. package/dist/capabilities/documents.js.map +1 -1
  78. package/dist/capabilities/email.d.ts +2 -1
  79. package/dist/capabilities/email.d.ts.map +1 -1
  80. package/dist/capabilities/email.js +5 -3
  81. package/dist/capabilities/email.js.map +1 -1
  82. package/dist/capabilities/errors.d.ts +19 -0
  83. package/dist/capabilities/errors.d.ts.map +1 -0
  84. package/dist/capabilities/errors.js +109 -0
  85. package/dist/capabilities/errors.js.map +1 -0
  86. package/dist/capabilities/errors.specs.d.ts +11 -0
  87. package/dist/capabilities/errors.specs.d.ts.map +1 -0
  88. package/dist/capabilities/errors.specs.js +100 -0
  89. package/dist/capabilities/errors.specs.js.map +1 -0
  90. package/dist/capabilities/example-timelines.d.ts.map +1 -1
  91. package/dist/capabilities/example-timelines.js +52 -10
  92. package/dist/capabilities/example-timelines.js.map +1 -1
  93. package/dist/capabilities/example-timelines.specs.d.ts +1 -0
  94. package/dist/capabilities/example-timelines.specs.d.ts.map +1 -1
  95. package/dist/capabilities/example-timelines.specs.js +21 -3
  96. package/dist/capabilities/example-timelines.specs.js.map +1 -1
  97. package/dist/capabilities/finish-storyboard.d.ts +5 -0
  98. package/dist/capabilities/finish-storyboard.d.ts.map +1 -0
  99. package/dist/capabilities/finish-storyboard.js +278 -0
  100. package/dist/capabilities/finish-storyboard.js.map +1 -0
  101. package/dist/capabilities/game-asset-browser.d.ts +11 -0
  102. package/dist/capabilities/game-asset-browser.d.ts.map +1 -0
  103. package/dist/capabilities/game-asset-browser.js +152 -0
  104. package/dist/capabilities/game-asset-browser.js.map +1 -0
  105. package/dist/capabilities/game-asset-source.js +1 -1
  106. package/dist/capabilities/game-asset-source.js.map +1 -1
  107. package/dist/capabilities/game.d.ts +44 -2
  108. package/dist/capabilities/game.d.ts.map +1 -1
  109. package/dist/capabilities/game.js +408 -160
  110. package/dist/capabilities/game.js.map +1 -1
  111. package/dist/capabilities/game.specs.d.ts +4 -0
  112. package/dist/capabilities/game.specs.d.ts.map +1 -1
  113. package/dist/capabilities/game.specs.js +42 -13
  114. package/dist/capabilities/game.specs.js.map +1 -1
  115. package/dist/capabilities/game3d.d.ts +17 -0
  116. package/dist/capabilities/game3d.d.ts.map +1 -0
  117. package/dist/capabilities/game3d.js +434 -0
  118. package/dist/capabilities/game3d.js.map +1 -0
  119. package/dist/capabilities/gate-from-context.d.ts +1 -1
  120. package/dist/capabilities/gate-from-context.js +1 -1
  121. package/dist/capabilities/generations.d.ts +2 -0
  122. package/dist/capabilities/generations.d.ts.map +1 -1
  123. package/dist/capabilities/generations.js +14 -23
  124. package/dist/capabilities/generations.js.map +1 -1
  125. package/dist/capabilities/index.d.ts +2 -2
  126. package/dist/capabilities/index.d.ts.map +1 -1
  127. package/dist/capabilities/index.js +2 -2
  128. package/dist/capabilities/index.js.map +1 -1
  129. package/dist/capabilities/invoke.d.ts +14 -25
  130. package/dist/capabilities/invoke.d.ts.map +1 -1
  131. package/dist/capabilities/invoke.js +72 -35
  132. package/dist/capabilities/invoke.js.map +1 -1
  133. package/dist/capabilities/jobs.d.ts.map +1 -1
  134. package/dist/capabilities/jobs.js +47 -3
  135. package/dist/capabilities/jobs.js.map +1 -1
  136. package/dist/capabilities/jobs.specs.d.ts.map +1 -1
  137. package/dist/capabilities/jobs.specs.js +3 -1
  138. package/dist/capabilities/jobs.specs.js.map +1 -1
  139. package/dist/capabilities/js-scripts.d.ts +19 -1
  140. package/dist/capabilities/js-scripts.d.ts.map +1 -1
  141. package/dist/capabilities/js-scripts.js +109 -2
  142. package/dist/capabilities/js-scripts.js.map +1 -1
  143. package/dist/capabilities/js-scripts.specs.d.ts +2 -0
  144. package/dist/capabilities/js-scripts.specs.d.ts.map +1 -1
  145. package/dist/capabilities/js-scripts.specs.js +50 -0
  146. package/dist/capabilities/js-scripts.specs.js.map +1 -1
  147. package/dist/capabilities/lazy-tool-core.d.ts +23 -0
  148. package/dist/capabilities/lazy-tool-core.d.ts.map +1 -0
  149. package/dist/capabilities/lazy-tool-core.js +56 -0
  150. package/dist/capabilities/lazy-tool-core.js.map +1 -0
  151. package/dist/capabilities/lazy-tool.d.ts +3 -23
  152. package/dist/capabilities/lazy-tool.d.ts.map +1 -1
  153. package/dist/capabilities/lazy-tool.js +6 -64
  154. package/dist/capabilities/lazy-tool.js.map +1 -1
  155. package/dist/capabilities/legacy-tools.d.ts +15 -0
  156. package/dist/capabilities/legacy-tools.d.ts.map +1 -0
  157. package/dist/capabilities/legacy-tools.js +98 -0
  158. package/dist/capabilities/legacy-tools.js.map +1 -0
  159. package/dist/capabilities/media.d.ts +0 -9
  160. package/dist/capabilities/media.d.ts.map +1 -1
  161. package/dist/capabilities/media.js +314 -261
  162. package/dist/capabilities/media.js.map +1 -1
  163. package/dist/capabilities/media.specs.d.ts.map +1 -1
  164. package/dist/capabilities/media.specs.js +17 -0
  165. package/dist/capabilities/media.specs.js.map +1 -1
  166. package/dist/capabilities/metadata.d.ts +62 -0
  167. package/dist/capabilities/metadata.d.ts.map +1 -0
  168. package/dist/capabilities/metadata.js +114 -0
  169. package/dist/capabilities/metadata.js.map +1 -0
  170. package/dist/capabilities/model3d.d.ts.map +1 -1
  171. package/dist/capabilities/model3d.js +4 -0
  172. package/dist/capabilities/model3d.js.map +1 -1
  173. package/dist/capabilities/models.d.ts +2 -2
  174. package/dist/capabilities/models.d.ts.map +1 -1
  175. package/dist/capabilities/models.js +5 -3
  176. package/dist/capabilities/models.js.map +1 -1
  177. package/dist/capabilities/registry.d.ts +6 -19
  178. package/dist/capabilities/registry.d.ts.map +1 -1
  179. package/dist/capabilities/registry.js +72 -113
  180. package/dist/capabilities/registry.js.map +1 -1
  181. package/dist/capabilities/run-agent.d.ts +19 -0
  182. package/dist/capabilities/run-agent.d.ts.map +1 -0
  183. package/dist/capabilities/run-agent.js +183 -0
  184. package/dist/capabilities/run-agent.js.map +1 -0
  185. package/dist/capabilities/runs.d.ts +9 -0
  186. package/dist/capabilities/runs.d.ts.map +1 -0
  187. package/dist/capabilities/runs.js +46 -0
  188. package/dist/capabilities/runs.js.map +1 -0
  189. package/dist/capabilities/runs.specs.d.ts +39 -0
  190. package/dist/capabilities/runs.specs.d.ts.map +1 -0
  191. package/dist/capabilities/runs.specs.js +52 -0
  192. package/dist/capabilities/runs.specs.js.map +1 -0
  193. package/dist/capabilities/scripts.d.ts.map +1 -1
  194. package/dist/capabilities/scripts.js +11 -5
  195. package/dist/capabilities/scripts.js.map +1 -1
  196. package/dist/capabilities/settings.d.ts.map +1 -1
  197. package/dist/capabilities/settings.js +4 -2
  198. package/dist/capabilities/settings.js.map +1 -1
  199. package/dist/capabilities/sketches.d.ts.map +1 -1
  200. package/dist/capabilities/sketches.js +4 -2
  201. package/dist/capabilities/sketches.js.map +1 -1
  202. package/dist/capabilities/skills.d.ts.map +1 -1
  203. package/dist/capabilities/skills.js +22 -2
  204. package/dist/capabilities/skills.js.map +1 -1
  205. package/dist/capabilities/storyboard-layout-check.d.ts +33 -0
  206. package/dist/capabilities/storyboard-layout-check.d.ts.map +1 -0
  207. package/dist/capabilities/storyboard-layout-check.js +229 -0
  208. package/dist/capabilities/storyboard-layout-check.js.map +1 -0
  209. package/dist/capabilities/storyboard-measured-sources.d.ts +10 -0
  210. package/dist/capabilities/storyboard-measured-sources.d.ts.map +1 -0
  211. package/dist/capabilities/storyboard-measured-sources.js +67 -0
  212. package/dist/capabilities/storyboard-measured-sources.js.map +1 -0
  213. package/dist/capabilities/storyboard-review-times.d.ts +4 -0
  214. package/dist/capabilities/storyboard-review-times.d.ts.map +1 -0
  215. package/dist/capabilities/storyboard-review-times.js +39 -0
  216. package/dist/capabilities/storyboard-review-times.js.map +1 -0
  217. package/dist/capabilities/storyboards.d.ts +12 -18
  218. package/dist/capabilities/storyboards.d.ts.map +1 -1
  219. package/dist/capabilities/storyboards.js +779 -96
  220. package/dist/capabilities/storyboards.js.map +1 -1
  221. package/dist/capabilities/storyboards.specs.d.ts +9 -0
  222. package/dist/capabilities/storyboards.specs.d.ts.map +1 -1
  223. package/dist/capabilities/storyboards.specs.js +173 -5
  224. package/dist/capabilities/storyboards.specs.js.map +1 -1
  225. package/dist/capabilities/threads.js +1 -1
  226. package/dist/capabilities/threads.js.map +1 -1
  227. package/dist/capabilities/timeline-bridge.d.ts +368 -0
  228. package/dist/capabilities/timeline-bridge.d.ts.map +1 -0
  229. package/dist/capabilities/timeline-bridge.js +1008 -0
  230. package/dist/capabilities/timeline-bridge.js.map +1 -0
  231. package/dist/capabilities/timeline-clip-frames.d.ts +17 -0
  232. package/dist/capabilities/timeline-clip-frames.d.ts.map +1 -0
  233. package/dist/capabilities/timeline-clip-frames.js +84 -0
  234. package/dist/capabilities/timeline-clip-frames.js.map +1 -0
  235. package/dist/capabilities/timeline-media-edit.d.ts +8 -0
  236. package/dist/capabilities/timeline-media-edit.d.ts.map +1 -0
  237. package/dist/capabilities/timeline-media-edit.js +94 -0
  238. package/dist/capabilities/timeline-media-edit.js.map +1 -0
  239. package/dist/capabilities/timeline-native-media.d.ts.map +1 -1
  240. package/dist/capabilities/timeline-native-media.js +40 -0
  241. package/dist/capabilities/timeline-native-media.js.map +1 -1
  242. package/dist/capabilities/timeline-operations.d.ts +52 -0
  243. package/dist/capabilities/timeline-operations.d.ts.map +1 -0
  244. package/dist/capabilities/timeline-operations.js +413 -0
  245. package/dist/capabilities/timeline-operations.js.map +1 -0
  246. package/dist/capabilities/timelines.d.ts +28 -3
  247. package/dist/capabilities/timelines.d.ts.map +1 -1
  248. package/dist/capabilities/timelines.js +410 -294
  249. package/dist/capabilities/timelines.js.map +1 -1
  250. package/dist/capabilities/timelines.specs.d.ts +8 -0
  251. package/dist/capabilities/timelines.specs.d.ts.map +1 -1
  252. package/dist/capabilities/timelines.specs.js +178 -9
  253. package/dist/capabilities/timelines.specs.js.map +1 -1
  254. package/dist/capabilities/types.d.ts +3 -1
  255. package/dist/capabilities/types.d.ts.map +1 -1
  256. package/dist/capabilities/types.js.map +1 -1
  257. package/dist/capabilities/ui.d.ts.map +1 -1
  258. package/dist/capabilities/ui.js +24 -2
  259. package/dist/capabilities/ui.js.map +1 -1
  260. package/dist/capabilities/web.d.ts.map +1 -1
  261. package/dist/capabilities/web.js +4 -0
  262. package/dist/capabilities/web.js.map +1 -1
  263. package/dist/capabilities/workflows.d.ts +3 -1
  264. package/dist/capabilities/workflows.d.ts.map +1 -1
  265. package/dist/capabilities/workflows.js +244 -39
  266. package/dist/capabilities/workflows.js.map +1 -1
  267. package/dist/capabilities/workflows.specs.d.ts +2 -0
  268. package/dist/capabilities/workflows.specs.d.ts.map +1 -1
  269. package/dist/capabilities/workflows.specs.js +72 -2
  270. package/dist/capabilities/workflows.specs.js.map +1 -1
  271. package/dist/codeact/action-diagnostics.d.ts.map +1 -1
  272. package/dist/codeact/action-diagnostics.js +51 -1
  273. package/dist/codeact/action-diagnostics.js.map +1 -1
  274. package/dist/codeact/codeact-executor.d.ts.map +1 -1
  275. package/dist/codeact/codeact-executor.js +16 -8
  276. package/dist/codeact/codeact-executor.js.map +1 -1
  277. package/dist/codeact/compact-ids.d.ts.map +1 -1
  278. package/dist/codeact/compact-ids.js +5 -1
  279. package/dist/codeact/compact-ids.js.map +1 -1
  280. package/dist/codeact/graph-model.d.ts +1 -1
  281. package/dist/codeact/graph-model.d.ts.map +1 -1
  282. package/dist/codeact/graph-model.js +2 -3
  283. package/dist/codeact/graph-model.js.map +1 -1
  284. package/dist/codeact/nodetool-api.d.ts +1 -1
  285. package/dist/codeact/nodetool-api.d.ts.map +1 -1
  286. package/dist/codeact/nodetool-api.js +202 -284
  287. package/dist/codeact/nodetool-api.js.map +1 -1
  288. package/dist/codeact/sandbox-packages.d.ts +0 -7
  289. package/dist/codeact/sandbox-packages.d.ts.map +1 -1
  290. package/dist/codeact/sandbox-packages.js +1 -10
  291. package/dist/codeact/sandbox-packages.js.map +1 -1
  292. package/dist/codeact/tool-api.d.ts +6 -3
  293. package/dist/codeact/tool-api.d.ts.map +1 -1
  294. package/dist/codeact/tool-api.js +22 -15
  295. package/dist/codeact/tool-api.js.map +1 -1
  296. package/dist/evals/codeact-api-cases.d.ts.map +1 -1
  297. package/dist/evals/codeact-api-cases.js +2 -0
  298. package/dist/evals/codeact-api-cases.js.map +1 -1
  299. package/dist/evals/codeact-api-runs.d.ts +3 -0
  300. package/dist/evals/codeact-api-runs.d.ts.map +1 -0
  301. package/dist/evals/codeact-api-runs.js +33 -0
  302. package/dist/evals/codeact-api-runs.js.map +1 -0
  303. package/dist/evals/surfaces/game.d.ts +8 -2
  304. package/dist/evals/surfaces/game.d.ts.map +1 -1
  305. package/dist/evals/surfaces/game.js +460 -2
  306. package/dist/evals/surfaces/game.js.map +1 -1
  307. package/dist/evals/surfaces/sketch.d.ts +2 -0
  308. package/dist/evals/surfaces/sketch.d.ts.map +1 -1
  309. package/dist/evals/surfaces/sketch.js +11 -3
  310. package/dist/evals/surfaces/sketch.js.map +1 -1
  311. package/dist/evals/surfaces/timeline.d.ts +4 -357
  312. package/dist/evals/surfaces/timeline.d.ts.map +1 -1
  313. package/dist/evals/surfaces/timeline.js +9 -2621
  314. package/dist/evals/surfaces/timeline.js.map +1 -1
  315. package/dist/evals/tool-loop-bridge.d.ts +4 -0
  316. package/dist/evals/tool-loop-bridge.d.ts.map +1 -1
  317. package/dist/evals/tool-loop-bridge.js.map +1 -1
  318. package/dist/evals/tool-loop-eval.d.ts +2 -0
  319. package/dist/evals/tool-loop-eval.d.ts.map +1 -1
  320. package/dist/evals/tool-loop-eval.js +6 -1
  321. package/dist/evals/tool-loop-eval.js.map +1 -1
  322. package/dist/evals/tool-loop-permission.d.ts +1 -15
  323. package/dist/evals/tool-loop-permission.d.ts.map +1 -1
  324. package/dist/evals/tool-loop-permission.js +23 -41
  325. package/dist/evals/tool-loop-permission.js.map +1 -1
  326. package/dist/game-authoring.d.ts +9573 -0
  327. package/dist/game-authoring.d.ts.map +1 -0
  328. package/dist/game-authoring.js +146 -0
  329. package/dist/game-authoring.js.map +1 -0
  330. package/dist/game-build.d.ts +3 -0
  331. package/dist/game-build.d.ts.map +1 -0
  332. package/dist/game-build.js +3 -0
  333. package/dist/game-build.js.map +1 -0
  334. package/dist/game-code-bake.d.ts +26 -0
  335. package/dist/game-code-bake.d.ts.map +1 -0
  336. package/dist/game-code-bake.js +98 -0
  337. package/dist/game-code-bake.js.map +1 -0
  338. package/dist/game-examples.d.ts +2227 -18
  339. package/dist/game-examples.d.ts.map +1 -1
  340. package/dist/game-examples.js +5 -4
  341. package/dist/game-examples.js.map +1 -1
  342. package/dist/generation-cancel.d.ts +31 -0
  343. package/dist/generation-cancel.d.ts.map +1 -0
  344. package/dist/generation-cancel.js +28 -0
  345. package/dist/generation-cancel.js.map +1 -0
  346. package/dist/host-access-gate.d.ts +29 -0
  347. package/dist/host-access-gate.d.ts.map +1 -0
  348. package/dist/host-access-gate.js +39 -0
  349. package/dist/host-access-gate.js.map +1 -0
  350. package/dist/host-modules/dispatcher.d.ts +7 -1
  351. package/dist/host-modules/dispatcher.d.ts.map +1 -1
  352. package/dist/host-modules/dispatcher.js +13 -2
  353. package/dist/host-modules/dispatcher.js.map +1 -1
  354. package/dist/host-modules/docx.d.ts.map +1 -1
  355. package/dist/host-modules/docx.js +2 -2
  356. package/dist/host-modules/docx.js.map +1 -1
  357. package/dist/host-modules/epub.d.ts.map +1 -1
  358. package/dist/host-modules/epub.js +2 -2
  359. package/dist/host-modules/epub.js.map +1 -1
  360. package/dist/host-modules/fabric.d.ts.map +1 -1
  361. package/dist/host-modules/fabric.js +1 -1
  362. package/dist/host-modules/fabric.js.map +1 -1
  363. package/dist/host-modules/limits.d.ts +10 -8
  364. package/dist/host-modules/limits.d.ts.map +1 -1
  365. package/dist/host-modules/limits.js +14 -9
  366. package/dist/host-modules/limits.js.map +1 -1
  367. package/dist/host-modules/mammoth.d.ts.map +1 -1
  368. package/dist/host-modules/mammoth.js +2 -2
  369. package/dist/host-modules/mammoth.js.map +1 -1
  370. package/dist/host-modules/ocr.d.ts.map +1 -1
  371. package/dist/host-modules/ocr.js +1 -1
  372. package/dist/host-modules/ocr.js.map +1 -1
  373. package/dist/host-modules/pdf.d.ts.map +1 -1
  374. package/dist/host-modules/pdf.js +2 -2
  375. package/dist/host-modules/pdf.js.map +1 -1
  376. package/dist/host-modules/pdflib.d.ts.map +1 -1
  377. package/dist/host-modules/pdflib.js +2 -2
  378. package/dist/host-modules/pdflib.js.map +1 -1
  379. package/dist/host-modules/pptx.d.ts.map +1 -1
  380. package/dist/host-modules/pptx.js +2 -2
  381. package/dist/host-modules/pptx.js.map +1 -1
  382. package/dist/host-modules/pptxgen.d.ts.map +1 -1
  383. package/dist/host-modules/pptxgen.js +2 -2
  384. package/dist/host-modules/pptxgen.js.map +1 -1
  385. package/dist/host-modules/tfjs.d.ts.map +1 -1
  386. package/dist/host-modules/tfjs.js +4 -4
  387. package/dist/host-modules/tfjs.js.map +1 -1
  388. package/dist/host-modules/xlsx.d.ts.map +1 -1
  389. package/dist/host-modules/xlsx.js +2 -2
  390. package/dist/host-modules/xlsx.js.map +1 -1
  391. package/dist/index.d.ts +18 -4
  392. package/dist/index.d.ts.map +1 -1
  393. package/dist/index.js +17 -3
  394. package/dist/index.js.map +1 -1
  395. package/dist/js-sandbox-worker/engine.d.ts +4 -0
  396. package/dist/js-sandbox-worker/engine.d.ts.map +1 -0
  397. package/dist/js-sandbox-worker/engine.js +45 -0
  398. package/dist/js-sandbox-worker/engine.js.map +1 -0
  399. package/dist/js-sandbox-worker/host.js +1 -1
  400. package/dist/js-sandbox-worker/host.js.map +1 -1
  401. package/dist/js-sandbox-worker/interpreter.d.ts +1 -1
  402. package/dist/js-sandbox-worker/interpreter.d.ts.map +1 -1
  403. package/dist/js-sandbox-worker/interpreter.js +94 -2
  404. package/dist/js-sandbox-worker/interpreter.js.map +1 -1
  405. package/dist/js-sandbox-worker/worker-entry.d.ts.map +1 -1
  406. package/dist/js-sandbox-worker/worker-entry.js +3 -2
  407. package/dist/js-sandbox-worker/worker-entry.js.map +1 -1
  408. package/dist/js-sandbox.d.ts +9 -1
  409. package/dist/js-sandbox.d.ts.map +1 -1
  410. package/dist/js-sandbox.js +76 -15
  411. package/dist/js-sandbox.js.map +1 -1
  412. package/dist/js-script-app-runner.d.ts +2 -0
  413. package/dist/js-script-app-runner.d.ts.map +1 -1
  414. package/dist/js-script-app-runner.js +8 -3
  415. package/dist/js-script-app-runner.js.map +1 -1
  416. package/dist/js-script-sandbox.d.ts +12 -18
  417. package/dist/js-script-sandbox.d.ts.map +1 -1
  418. package/dist/js-script-sandbox.js +3 -49
  419. package/dist/js-script-sandbox.js.map +1 -1
  420. package/dist/prompts/product-knowledge.d.ts +1 -1
  421. package/dist/prompts/product-knowledge.d.ts.map +1 -1
  422. package/dist/prompts/product-knowledge.js +82 -41
  423. package/dist/prompts/product-knowledge.js.map +1 -1
  424. package/dist/sandbox-pack-resolution.d.ts +21 -0
  425. package/dist/sandbox-pack-resolution.d.ts.map +1 -0
  426. package/dist/sandbox-pack-resolution.js +42 -0
  427. package/dist/sandbox-pack-resolution.js.map +1 -0
  428. package/dist/sandbox-toolbelt.d.ts +3 -1
  429. package/dist/sandbox-toolbelt.d.ts.map +1 -1
  430. package/dist/sandbox-toolbelt.js +8 -2
  431. package/dist/sandbox-toolbelt.js.map +1 -1
  432. package/dist/skill-prompt.d.ts +11 -1
  433. package/dist/skill-prompt.d.ts.map +1 -1
  434. package/dist/skill-prompt.js +17 -6
  435. package/dist/skill-prompt.js.map +1 -1
  436. package/dist/system-skills.d.ts +7 -1
  437. package/dist/system-skills.d.ts.map +1 -1
  438. package/dist/system-skills.js +2 -2
  439. package/dist/system-skills.js.map +1 -1
  440. package/dist/timeline-capture.d.ts +21 -0
  441. package/dist/timeline-capture.d.ts.map +1 -0
  442. package/dist/timeline-capture.js +564 -0
  443. package/dist/timeline-capture.js.map +1 -0
  444. package/dist/timeline-code-bake.d.ts +75 -0
  445. package/dist/timeline-code-bake.d.ts.map +1 -0
  446. package/dist/timeline-code-bake.js +327 -0
  447. package/dist/timeline-code-bake.js.map +1 -0
  448. package/dist/timeline-preview/frames.d.ts +26 -0
  449. package/dist/timeline-preview/frames.d.ts.map +1 -1
  450. package/dist/timeline-preview/frames.js +155 -70
  451. package/dist/timeline-preview/frames.js.map +1 -1
  452. package/dist/tools/base-tool.d.ts +1 -0
  453. package/dist/tools/base-tool.d.ts.map +1 -1
  454. package/dist/tools/base-tool.js +1 -1
  455. package/dist/tools/base-tool.js.map +1 -1
  456. package/dist/tools/builtin-tools.d.ts +4 -3
  457. package/dist/tools/builtin-tools.d.ts.map +1 -1
  458. package/dist/tools/builtin-tools.js +24 -3
  459. package/dist/tools/builtin-tools.js.map +1 -1
  460. package/dist/tools/external-capability-tools.d.ts +1 -1
  461. package/dist/tools/external-capability-tools.js +1 -1
  462. package/dist/tools/mcp-tool-support.d.ts +10 -9
  463. package/dist/tools/mcp-tool-support.d.ts.map +1 -1
  464. package/dist/tools/mcp-tool-support.js +14 -13
  465. package/dist/tools/mcp-tool-support.js.map +1 -1
  466. package/dist/tools/mcp-tools.d.ts +6 -4
  467. package/dist/tools/mcp-tools.d.ts.map +1 -1
  468. package/dist/tools/mcp-tools.js +65 -62
  469. package/dist/tools/mcp-tools.js.map +1 -1
  470. package/dist/tools/tool-permissions.d.ts +1 -1
  471. package/dist/tools/tool-permissions.js +1 -1
  472. package/package.json +124 -41
  473. package/dist/capabilities/gate-tools.d.ts +0 -18
  474. package/dist/capabilities/gate-tools.d.ts.map +0 -1
  475. package/dist/capabilities/gate-tools.js +0 -66
  476. package/dist/capabilities/gate-tools.js.map +0 -1
  477. package/dist/tsconfig.tests.tmp.tsbuildinfo +0 -1
@@ -22,7 +22,7 @@ import { Buffer } from "node:buffer";
22
22
  import { randomInt, randomUUID } from "node:crypto";
23
23
  import { mkdir, readFile } from "node:fs/promises";
24
24
  import path from "node:path";
25
- import { loadMediaRefBytes } from "@nodetool-ai/runtime";
25
+ import { currentGenerationReceipt, loadMediaRefBytes } from "@nodetool-ai/runtime";
26
26
  import { getMaxLocalUploadBytes } from "@nodetool-ai/storage";
27
27
  import { backgroundGenerationLimitError, startBackgroundGeneration } from "./background-generation.js";
28
28
  import { HostBinaryMissingError, clampTimeoutSeconds, mimeFromFilename, runHostBinary } from "../host-binaries.js";
@@ -31,7 +31,7 @@ import { assertFetchUrlAllowed, assertResolvedHostAllowed } from "../network-gua
31
31
  import { encodeBase64 as encodeMediaBase64 } from "../sandbox-bytes.js";
32
32
  import { imagePixelSize, sniffImageFormat } from "../sandbox-media.js";
33
33
  import { DEFAULT_MIME, MAX_MEDIA_REF_BYTES, filesystemPathForUri, mimeForRef } from "../sandbox-media-ref.js";
34
- import { MIME_TO_EXT, inferImageMime, persistOutput } from "../tools/asset-persist.js";
34
+ import { MIME_TO_EXT, inferImageMime, persistOutput, timestampedName } from "../tools/asset-persist.js";
35
35
  import { persistBinaryOutput } from "../tools/binary-output.js";
36
36
  import { extractJSON, extractJSONAllowingTruncation } from "../utils/json-parser.js";
37
37
  import { isYtDlpEnabled } from "../yt-dlp-gate.js";
@@ -267,16 +267,6 @@ async function finishOutput(context, bytes, assets, opts) {
267
267
  }
268
268
  return result;
269
269
  }
270
- /**
271
- * The asset the seam saved for a generation, read off the registry's settled
272
- * outcome. The encoded-audio paths return the provider's result rather than
273
- * the seam's, so this is how a capability learns what was persisted.
274
- */
275
- async function seamAssetFor(id) {
276
- const { generationRegistry } = await import("@nodetool-ai/runtime");
277
- const outcome = generationRegistry.outcome(id);
278
- return outcome?.asset_ids[0] ?? null;
279
- }
280
270
  /** What a `background: true` call answers with. */
281
271
  function backgroundReceipt(id, spec) {
282
272
  return {
@@ -375,6 +365,8 @@ const generateImage = {
375
365
  negative_prompt: params["negative_prompt"],
376
366
  width: params["width"],
377
367
  height: params["height"],
368
+ aspect_ratio: aliased(params, "aspect_ratio", "aspectRatio", "aspect"),
369
+ resolution: aliased(params, "resolution"),
378
370
  quality: params["quality"]
379
371
  }
380
372
  });
@@ -418,6 +410,9 @@ const editImage = {
418
410
  negative_prompt: params["negative_prompt"],
419
411
  target_width: params["target_width"],
420
412
  target_height: params["target_height"],
413
+ aspect_ratio: aliased(params, "aspect_ratio", "aspectRatio", "aspect"),
414
+ resolution: aliased(params, "resolution"),
415
+ quality: params["quality"],
421
416
  strength: params["strength"]
422
417
  }
423
418
  });
@@ -742,6 +737,9 @@ const videoFromReferences = {
742
737
  });
743
738
  }
744
739
  };
740
+ // ---------------------------------------------------------------------------
741
+ // generate_speech
742
+ // ---------------------------------------------------------------------------
745
743
  function int16ToUint8(samples) {
746
744
  const bytes = new Uint8Array(samples.byteLength);
747
745
  const view = new DataView(bytes.buffer);
@@ -840,228 +838,244 @@ async function encodedSpeech(context, m, params, generation) {
840
838
  return await provider.textToSpeechEncoded({
841
839
  text: params.text,
842
840
  model: m.model,
843
- voice: params.voice,
844
- speed: params.speed,
841
+ voice: isString(params.voice) ? params.voice : undefined,
842
+ speed: typeof params.speed === "number" ? params.speed : undefined,
845
843
  audioFormat: params.audioFormat
846
844
  });
847
845
  }
848
846
  throw new Error("this runtime's context has no encoded text_to_speech path");
849
847
  }
850
- const generateSpeech = {
851
- spec: generateSpeechSpec,
852
- impl: async (run, params) => {
853
- const context = run.context;
854
- const m = parseModelArgs(params);
855
- if ("error" in m)
856
- return m;
857
- const text = params["text"];
858
- if (!isNonEmptyString(text))
859
- return { error: "text is required" };
860
- const outputFile = isString(params["output_file"])
861
- ? params["output_file"]
862
- : undefined;
863
- const desiredFormat = audioFormatFromOutputFile(outputFile) ?? "mp3";
864
- const generationId = randomUUID();
865
- const generation = {
866
- id: generationId,
867
- origin: { surface: "capability", tool_call_id: toolCallIdOf(params) },
868
- persist: outputFile ? { name: path.basename(outputFile) } : {}
869
- };
870
- const speechParams = {
871
- text,
872
- voice: params["voice"],
873
- speed: params["speed"],
874
- audioFormat: desiredFormat
875
- };
876
- if (params["background"] === true) {
877
- const spec = {
878
- capability: "text_to_speech",
879
- m,
880
- type: "audio",
881
- namePrefix: "generated-speech",
882
- params: speechParams
848
+ async function speechAudio(context, provider, m, params, signal, outputFile) {
849
+ signal.throwIfAborted();
850
+ const providerParams = {
851
+ text: params.text,
852
+ model: m.model,
853
+ voice: isString(params.voice) ? params.voice : undefined,
854
+ speed: typeof params.speed === "number" ? params.speed : undefined,
855
+ audioFormat: params.audioFormat,
856
+ signal
857
+ };
858
+ let encodedError;
859
+ try {
860
+ const encoded = provider
861
+ ? await provider.textToSpeechEncoded(providerParams)
862
+ : await encodedSpeech(context, m, params);
863
+ signal.throwIfAborted();
864
+ if (encoded?.data && encoded.data.length > 0) {
865
+ return {
866
+ data: encoded.data,
867
+ mimeType: encoded.mimeType ?? "audio/mpeg",
868
+ outputFile
883
869
  };
884
- const started = startBackgroundGeneration(context, () => encodedSpeech(context, m, speechParams, generation));
885
- if (!started) {
886
- return backgroundGenerationLimitError();
887
- }
888
- return backgroundReceipt(generationId, spec);
889
870
  }
890
- try {
891
- // Preferred path: ask the provider for fully-encoded audio in the
892
- // desired container (mp3/wav/flac/...). Returns null when the provider
893
- // doesn't support encoded TTS — we then fall through to streaming PCM.
894
- let audio = null;
895
- let mimeType;
896
- let outputFileFinal = outputFile;
897
- // The asset the seam saved on the encoded path, when it could.
898
- let seamAssetId = null;
899
- // Why the encoded path gave up, kept for the failure message. A provider
900
- // that only does encoded TTS (FAL, KIE) leaves the streaming method as
901
- // the base class's, which throws "<provider> does not support
902
- // textToSpeech" — so discarding this error reported the one thing that
903
- // was not wrong, and a session spent three rounds hunting for a TTS
904
- // model when the real answer was in the sentence thrown here.
905
- let encodedError;
906
- try {
907
- const encoded = await encodedSpeech(context, m, speechParams, generation);
908
- if (encoded && encoded.data) {
909
- audio = encoded.data;
910
- mimeType = encoded.mimeType;
911
- seamAssetId = await seamAssetFor(generationId);
912
- }
871
+ }
872
+ catch (error) {
873
+ if (signal.aborted || currentGenerationReceipt()?.provider_request_id) {
874
+ throw error;
875
+ }
876
+ encodedError = error;
877
+ }
878
+ if (currentGenerationReceipt()?.provider_request_id) {
879
+ throw new Error("The accepted speech request returned no audio; recover that request before submitting another.");
880
+ }
881
+ const parts = [];
882
+ let pcmOnly = true;
883
+ let mimeType;
884
+ let sampleRate;
885
+ try {
886
+ const stream = provider
887
+ ? provider.textToSpeech(providerParams)
888
+ : context.streamProviderPrediction({
889
+ provider: m.provider,
890
+ capability: "text_to_speech",
891
+ model: m.model,
892
+ params: { ...providerParams, signal }
893
+ });
894
+ for await (const item of stream) {
895
+ signal.throwIfAborted();
896
+ if (!isRecord(item)) {
897
+ continue;
913
898
  }
914
- catch (e) {
915
- encodedError = e instanceof Error ? e.message : String(e);
899
+ const chunk = item;
900
+ if (chunk.data instanceof Uint8Array || isString(chunk.data)) {
901
+ const data = chunk.data instanceof Uint8Array
902
+ ? chunk.data
903
+ : Buffer.from(chunk.data, "base64");
904
+ if (data.length > 0) {
905
+ parts.push(data);
906
+ }
907
+ if (isString(chunk.mimeType)) {
908
+ mimeType = chunk.mimeType;
909
+ }
910
+ pcmOnly = false;
916
911
  }
917
- if (!audio) {
918
- // Streaming path — provider returns either pre-encoded chunks
919
- // (carrying mimeType) or raw int16 PCM samples that we must wrap in
920
- // a WAV container before writing to disk so the file is playable.
921
- const parts = [];
922
- let pcmOnly = true;
923
- // Capture the PCM sample rate from the stream — providers emit non-24k
924
- // PCM (MiniMax 32000, Together varies). Hardcoding 24000 in the WAV
925
- // header makes those play back at the wrong speed/pitch.
926
- let pcmSampleRate;
927
- try {
928
- for await (const item of context.streamProviderPrediction({
929
- id: generationId,
930
- origin: generation.origin,
931
- provider: m.provider,
932
- capability: "text_to_speech",
933
- model: m.model,
934
- params: {
935
- text,
936
- voice: params["voice"],
937
- speed: params["speed"]
938
- }
939
- })) {
940
- const chunk = item;
941
- if (chunk.data instanceof Uint8Array) {
942
- parts.push(chunk.data);
943
- if (chunk.mimeType)
944
- mimeType = chunk.mimeType;
945
- pcmOnly = false;
946
- }
947
- else if (isString(chunk.data)) {
948
- parts.push(Buffer.from(chunk.data, "base64"));
949
- if (chunk.mimeType)
950
- mimeType = chunk.mimeType;
951
- pcmOnly = false;
952
- }
953
- else if (chunk.samples) {
954
- pcmSampleRate ??= chunk.sampleRate;
955
- parts.push(int16ToUint8(chunk.samples));
956
- }
912
+ else {
913
+ if (chunk.sampleRate !== undefined) {
914
+ if (typeof chunk.sampleRate !== "number" ||
915
+ !Number.isInteger(chunk.sampleRate) ||
916
+ chunk.sampleRate <= 0 ||
917
+ chunk.sampleRate > 0xffffffff / 2) {
918
+ throw new Error("TTS returned an invalid PCM sample rate");
957
919
  }
958
- }
959
- catch (e) {
960
- // Both paths failed. Report the encoded one first: on a provider
961
- // that only does encoded TTS the streaming error is the base class's
962
- // "does not support textToSpeech", which is true of the method and
963
- // false of the provider.
964
- if (encodedError) {
965
- throw new Error(`${encodedError} (the streaming fallback then failed too: ${e instanceof Error ? e.message : String(e)})`);
920
+ if (sampleRate !== undefined && sampleRate !== chunk.sampleRate) {
921
+ throw new Error("TTS changed PCM sample rate during the stream");
966
922
  }
967
- throw e;
923
+ sampleRate = chunk.sampleRate;
968
924
  }
969
- if (parts.length === 0) {
970
- return {
971
- error: encodedError
972
- ? `Provider returned no audio data: ${encodedError}`
973
- : "Provider returned no audio data"
974
- };
925
+ if (chunk.samples instanceof Int16Array && chunk.samples.length > 0) {
926
+ parts.push(int16ToUint8(chunk.samples));
975
927
  }
976
- const merged = concatUint8(parts);
977
- if (pcmOnly && !mimeType) {
978
- // Wrap raw PCM in WAV so the bytes are playable. Rename .mp3 →
979
- // .wav since the actual data is now WAV, not MP3. Honor the provider's
980
- // actual sample rate (defaulting to 24k only when unknown).
981
- audio = wrapPcmAsWav(merged, pcmSampleRate ?? 24000);
982
- mimeType = "audio/wav";
983
- if (outputFileFinal) {
984
- const dir = path.dirname(outputFileFinal);
985
- const base = path.basename(outputFileFinal, path.extname(outputFileFinal));
986
- outputFileFinal = path.join(dir === "." ? "" : dir, `${base}.wav`);
987
- }
928
+ }
929
+ }
930
+ }
931
+ catch (error) {
932
+ if (encodedError) {
933
+ throw new Error(`${encodedError instanceof Error ? encodedError.message : String(encodedError)} (the streaming fallback then failed too: ${error instanceof Error ? error.message : String(error)})`);
934
+ }
935
+ throw error;
936
+ }
937
+ signal.throwIfAborted();
938
+ const merged = concatUint8(parts);
939
+ if (merged.length === 0) {
940
+ throw new Error("Provider returned no audio data");
941
+ }
942
+ if (pcmOnly && !mimeType) {
943
+ if (merged.length < 2 || merged.length % 2 !== 0) {
944
+ throw new Error("TTS produced no complete audio samples");
945
+ }
946
+ const finalPath = outputFile
947
+ ? path.join(path.dirname(outputFile), `${path.basename(outputFile, path.extname(outputFile))}.wav`)
948
+ : undefined;
949
+ return {
950
+ data: wrapPcmAsWav(merged, sampleRate ?? 24000),
951
+ mimeType: "audio/wav",
952
+ outputFile: finalPath
953
+ };
954
+ }
955
+ return { data: merged, mimeType: mimeType ?? "audio/mpeg", outputFile };
956
+ }
957
+ function runAudioGeneration(context, req, spec, params, call) {
958
+ const work = async () => {
959
+ let saved;
960
+ const result = await context.runGenerationWith(req, async (provider, signal) => {
961
+ const audio = await call(provider, signal);
962
+ if (audio.outputFile && req.persist) {
963
+ req.persist.name = path.basename(audio.outputFile);
964
+ }
965
+ return audio;
966
+ }, {
967
+ finalizeOutput: async (output, assets) => {
968
+ if (!isRecord(output) ||
969
+ !(output.data instanceof Uint8Array) ||
970
+ !isString(output.mimeType)) {
971
+ throw new Error("Provider returned invalid audio output");
988
972
  }
989
- else {
990
- audio = merged;
973
+ const mime = output.mimeType;
974
+ const first = assets[0];
975
+ saved = { bytes: output.data.length, mime_type: mime };
976
+ if (first?.asset_id) {
977
+ saved.asset_id = first.asset_id;
978
+ saved.asset_uri = first.uri;
979
+ saved.url = first.uri;
991
980
  }
992
- }
993
- const mime = mimeType ?? "audio/mpeg";
994
- const persisted = await finishOutput(context, audio, seamAssetId
995
- ? [
996
- {
997
- asset_id: seamAssetId,
998
- uri: `asset://${seamAssetId}.${MIME_TO_EXT[mime] ?? "bin"}`
981
+ const outputFile = isString(output.outputFile)
982
+ ? output.outputFile
983
+ : undefined;
984
+ if (outputFile || !saved.asset_id) {
985
+ const destination = outputFile ??
986
+ timestampedName(spec.namePrefix, MIME_TO_EXT[mime] ?? "bin");
987
+ if (!context.workspace) {
988
+ return {
989
+ status: "failed",
990
+ path: destination,
991
+ error: `Could not deliver audio to "${destination}": no workspace is available.`
992
+ };
999
993
  }
1000
- ]
1001
- : [], {
1002
- namePrefix: "generated-speech",
1003
- mime,
1004
- outputFile: outputFileFinal
1005
- });
1006
- return {
1007
- type: "audio",
1008
- provider: m.provider,
1009
- model: m.model,
1010
- generation_id: generationId,
1011
- ...persisted
1012
- };
994
+ try {
995
+ await context.workspace.write(destination, output.data, mime);
996
+ }
997
+ catch (error) {
998
+ return {
999
+ status: "failed",
1000
+ path: destination,
1001
+ error: error instanceof Error ? error.message : String(error)
1002
+ };
1003
+ }
1004
+ saved.path = destination;
1005
+ return { status: "completed", path: destination };
1006
+ }
1007
+ return { status: "completed" };
1008
+ }
1009
+ });
1010
+ const response = {
1011
+ type: "audio",
1012
+ provider: spec.m.provider,
1013
+ model: spec.m.model,
1014
+ generation_id: result.id,
1015
+ ...saved
1016
+ };
1017
+ if (result.delivery) {
1018
+ response.delivery = result.delivery;
1013
1019
  }
1014
- catch (e) {
1015
- return {
1016
- ...predictionError("text_to_speech", m, e),
1017
- generation_id: generationId
1018
- };
1020
+ return response;
1021
+ };
1022
+ if (params.background === true) {
1023
+ if (!startBackgroundGeneration(context, work)) {
1024
+ return backgroundGenerationLimitError();
1019
1025
  }
1026
+ return backgroundReceipt(req.id ?? "", spec);
1027
+ }
1028
+ return work().catch((error) => ({
1029
+ ...predictionError(spec.capability, spec.m, error),
1030
+ generation_id: req.id
1031
+ }));
1032
+ }
1033
+ const generateSpeech = {
1034
+ spec: generateSpeechSpec,
1035
+ impl: async (run, params) => {
1036
+ const m = parseModelArgs(params);
1037
+ if ("error" in m) {
1038
+ return m;
1039
+ }
1040
+ const text = params.text;
1041
+ if (!isNonEmptyString(text)) {
1042
+ return { error: "text is required" };
1043
+ }
1044
+ const outputFile = outputFileOf(params);
1045
+ const speechParams = {
1046
+ text,
1047
+ voice: params.voice,
1048
+ speed: params.speed,
1049
+ audioFormat: audioFormatFromOutputFile(outputFile) ?? "mp3"
1050
+ };
1051
+ const spec = {
1052
+ capability: "text_to_speech",
1053
+ m,
1054
+ type: "audio",
1055
+ namePrefix: "generated-speech",
1056
+ params: { ...speechParams }
1057
+ };
1058
+ const req = generationRequest(randomUUID(), params, spec);
1059
+ return runAudioGeneration(run.context, req, spec, params, (provider, signal) => speechAudio(run.context, provider, m, speechParams, signal, outputFile));
1020
1060
  }
1021
1061
  };
1022
- /**
1023
- * Music from a prompt — the counterpart to {@link generateSpeech}, and the
1024
- * hole every other generation capability made conspicuous.
1025
- *
1026
- * Without it, scoring a cut meant running `nodetool.audio.TextToMusic` through
1027
- * `run_node`: a one-node graph, and therefore the graph validator, a typed
1028
- * `music_model` property and a model ref to satisfy before a single second of
1029
- * audio existed. A live session spent five rounds there and shipped silent.
1030
- */
1031
1062
  const generateMusic = {
1032
1063
  spec: generateMusicSpec,
1033
1064
  impl: async (run, params) => {
1034
- const context = run.context;
1035
1065
  const m = parseModelArgs(params);
1036
- if ("error" in m)
1066
+ if ("error" in m) {
1037
1067
  return m;
1038
- const prompt = params["prompt"];
1039
- if (!isNonEmptyString(prompt))
1068
+ }
1069
+ const prompt = params.prompt;
1070
+ if (!isNonEmptyString(prompt)) {
1040
1071
  return { error: "prompt is required" };
1041
- if (!isFunction(context.textToMusic)) {
1042
- return {
1043
- error: "this runtime's context has no text_to_music path"
1044
- };
1045
1072
  }
1046
- const outputFile = isString(params["output_file"])
1047
- ? params["output_file"]
1048
- : undefined;
1049
- const desiredFormat = audioFormatFromOutputFile(outputFile) ?? "mp3";
1050
- const generationId = randomUUID();
1073
+ const outputFile = outputFileOf(params);
1051
1074
  const musicParams = {
1052
1075
  prompt,
1053
- lyrics: params["lyrics"],
1076
+ lyrics: params.lyrics,
1054
1077
  duration_seconds: aliased(params, "duration_seconds", "durationSeconds", "duration"),
1055
- audioFormat: desiredFormat
1056
- };
1057
- const req = {
1058
- id: generationId,
1059
- provider: m.provider,
1060
- capability: "text_to_music",
1061
- model: m.model,
1062
- params: musicParams,
1063
- origin: { surface: "capability", tool_call_id: toolCallIdOf(params) },
1064
- persist: outputFile ? { name: path.basename(outputFile) } : {}
1078
+ audioFormat: audioFormatFromOutputFile(outputFile) ?? "mp3"
1065
1079
  };
1066
1080
  const spec = {
1067
1081
  capability: "text_to_music",
@@ -1070,45 +1084,31 @@ const generateMusic = {
1070
1084
  namePrefix: "generated-music",
1071
1085
  params: musicParams
1072
1086
  };
1073
- if (params["background"] === true) {
1074
- const started = startBackgroundGeneration(context, () => context.textToMusic(req));
1075
- if (!started) {
1076
- return backgroundGenerationLimitError();
1077
- }
1078
- return backgroundReceipt(generationId, spec);
1079
- }
1080
- try {
1081
- const encoded = await context.textToMusic(req);
1087
+ const req = generationRequest(randomUUID(), params, spec);
1088
+ return runAudioGeneration(run.context, req, spec, params, async (provider, signal) => {
1089
+ signal.throwIfAborted();
1090
+ const encoded = provider
1091
+ ? await provider.textToMusic({
1092
+ prompt,
1093
+ model: { id: m.model, name: m.model, provider: m.provider },
1094
+ lyrics: isString(params.lyrics) ? params.lyrics : undefined,
1095
+ durationSeconds: typeof musicParams.duration_seconds === "number"
1096
+ ? musicParams.duration_seconds
1097
+ : undefined,
1098
+ audioFormat: musicParams.audioFormat,
1099
+ signal
1100
+ })
1101
+ : await run.context.textToMusic(req);
1102
+ signal.throwIfAborted();
1082
1103
  if (!encoded?.data || encoded.data.length === 0) {
1083
- return {
1084
- error: "Provider returned no audio data",
1085
- generation_id: generationId
1086
- };
1104
+ throw new Error("Provider returned no audio data");
1087
1105
  }
1088
- const mime = encoded.mimeType ?? "audio/mpeg";
1089
- const seamAssetId = await seamAssetFor(generationId);
1090
- const persisted = await finishOutput(context, encoded.data, seamAssetId
1091
- ? [
1092
- {
1093
- asset_id: seamAssetId,
1094
- uri: `asset://${seamAssetId}.${MIME_TO_EXT[mime] ?? "bin"}`
1095
- }
1096
- ]
1097
- : [], { namePrefix: "generated-music", mime, outputFile });
1098
1106
  return {
1099
- type: "audio",
1100
- provider: m.provider,
1101
- model: m.model,
1102
- generation_id: generationId,
1103
- ...persisted
1107
+ data: encoded.data,
1108
+ mimeType: encoded.mimeType ?? "audio/mpeg",
1109
+ outputFile
1104
1110
  };
1105
- }
1106
- catch (e) {
1107
- return {
1108
- ...predictionError("text_to_music", m, e),
1109
- generation_id: generationId
1110
- };
1111
- }
1111
+ });
1112
1112
  }
1113
1113
  };
1114
1114
  const transcribeAudio = {
@@ -1244,7 +1244,7 @@ function messageText(message) {
1244
1244
  }
1245
1245
  return "";
1246
1246
  }
1247
- async function judgeCall(context, m, content, maxTokens = JUDGE_MAX_TOKENS) {
1247
+ async function judgeCall(context, m, content, maxTokens = JUDGE_MAX_TOKENS, requiredImages) {
1248
1248
  const result = (await context.runProviderPrediction({
1249
1249
  provider: m.provider,
1250
1250
  capability: "generate_message",
@@ -1252,7 +1252,10 @@ async function judgeCall(context, m, content, maxTokens = JUDGE_MAX_TOKENS) {
1252
1252
  params: {
1253
1253
  messages: [{ role: "user", content }],
1254
1254
  max_tokens: maxTokens,
1255
- temperature: 0
1255
+ temperature: 0,
1256
+ strict_image_evidence: content.some((part) => part.type === "image_url") ||
1257
+ Boolean(requiredImages?.length),
1258
+ required_images: requiredImages?.map(normalizeMediaSource)
1256
1259
  }
1257
1260
  }));
1258
1261
  return messageText(result);
@@ -1403,11 +1406,7 @@ const compareImages = {
1403
1406
  `\n\nRespond with JSON only: {"winner": 1 | 2, "reason": "one sentence"}`;
1404
1407
  const judgePair = async (a, b) => {
1405
1408
  const call = async (first, second) => {
1406
- const text = await judgeCall(context, m, [
1407
- textPart(prompt),
1408
- imagePart(first),
1409
- imagePart(second)
1410
- ]);
1409
+ const text = await judgeCall(context, m, [textPart(prompt), imagePart(first), imagePart(second)], JUDGE_MAX_TOKENS, images.map(String));
1411
1410
  const verdict = parsePairVerdict(text);
1412
1411
  if (!verdict) {
1413
1412
  throw new Error(`Judge did not return parseable JSON: ${text.slice(0, 200)}`);
@@ -1502,7 +1501,7 @@ const scoreImageAdherence = {
1502
1501
  ` visually checkable.` +
1503
1502
  `\n\nBrief:\n${brief}` +
1504
1503
  `\n\nRespond with JSON only: {"questions": ["..."]}`)
1505
- ]);
1504
+ ], JUDGE_MAX_TOKENS, [image]);
1506
1505
  const parsed = extractJSON(decomposeText);
1507
1506
  const list = isRecord(parsed) ? parsed["questions"] : parsed;
1508
1507
  questions = Array.isArray(list) ? list.map(String).filter(Boolean) : [];
@@ -1513,36 +1512,82 @@ const scoreImageAdherence = {
1513
1512
  }
1514
1513
  }
1515
1514
  questions = questions.slice(0, MAX_ADHERENCE_QUESTIONS);
1515
+ const checks = questions.map((question, i) => ({
1516
+ id: `q${i + 1}`,
1517
+ question
1518
+ }));
1516
1519
  const answerText = await judgeCall(context, m, [
1517
1520
  textPart(`Answer each question about the image with a strict yes or no. "yes" only if` +
1518
1521
  ` the image clearly satisfies it; when unsure, answer "no" and say why in the note.` +
1519
- `\n\nQuestions:\n${questions.map((q, i) => `${i + 1}. ${q}`).join("\n")}` +
1522
+ `\n\nQuestions:\n${checks.map((q) => `${q.id}: ${q.question}`).join("\n")}` +
1520
1523
  `\n\nRespond with JSON only:` +
1521
- `\n{"answers": [{"question": "...", "answer": "yes" | "no", "note": "..."}]}`),
1524
+ `\n{"answers": [{"id": "q1", "question": "...", "answer": "yes" | "no", "note": "..."}]}`),
1522
1525
  imagePart(image)
1523
1526
  ]);
1524
1527
  const parsed = extractJSON(answerText);
1525
1528
  const rawAnswers = isRecord(parsed) ? parsed["answers"] : null;
1526
1529
  if (!Array.isArray(rawAnswers) || rawAnswers.length === 0) {
1527
1530
  return {
1528
- error: `Judge did not return parseable answers: ${answerText.slice(0, 300)}`
1531
+ error: `Judge did not return parseable answers: ${answerText.slice(0, 300)}`,
1532
+ evidence_status: "invalid",
1533
+ total: checks.length,
1534
+ missing_ids: checks.map((check) => check.id)
1529
1535
  };
1530
1536
  }
1531
- const answers = rawAnswers
1532
- .filter(isObjectLike)
1533
- .map((a) => ({
1534
- question: String(a["question"] ?? ""),
1535
- answer: a["answer"] === "yes" ? "yes" : "no",
1536
- note: String(a["note"] ?? "")
1537
- }));
1537
+ const byId = new Map();
1538
+ const invalid = [];
1539
+ for (const raw of rawAnswers) {
1540
+ if (!isRecord(raw)) {
1541
+ invalid.push("answer must be an object");
1542
+ continue;
1543
+ }
1544
+ const id = String(raw["id"] ?? "");
1545
+ const check = checks.find((c) => c.id === id);
1546
+ if (!check || raw["question"] !== check.question) {
1547
+ invalid.push(`unrequested or substituted check: ${id}`);
1548
+ continue;
1549
+ }
1550
+ if (byId.has(id)) {
1551
+ invalid.push(`duplicate check: ${id}`);
1552
+ continue;
1553
+ }
1554
+ if (raw["answer"] !== "yes" && raw["answer"] !== "no") {
1555
+ invalid.push(`invalid answer: ${id}`);
1556
+ continue;
1557
+ }
1558
+ byId.set(id, {
1559
+ id,
1560
+ question: check.question,
1561
+ answer: raw["answer"],
1562
+ note: String(raw["note"] ?? "")
1563
+ });
1564
+ }
1565
+ const missingIds = checks.filter((c) => !byId.has(c.id)).map((c) => c.id);
1566
+ if (invalid.length || missingIds.length) {
1567
+ return {
1568
+ error: "Judge returned invalid or incomplete adherence evidence",
1569
+ evidence_status: "invalid",
1570
+ total: checks.length,
1571
+ missing_ids: missingIds,
1572
+ invalid
1573
+ };
1574
+ }
1575
+ const answers = [];
1576
+ for (const check of checks) {
1577
+ const answer = byId.get(check.id);
1578
+ if (answer) {
1579
+ answers.push(answer);
1580
+ }
1581
+ }
1538
1582
  const passed = answers.filter((a) => a.answer === "yes").length;
1539
1583
  return {
1540
1584
  type: "adherence",
1585
+ evidence_status: "complete",
1541
1586
  provider: m.provider,
1542
1587
  model: m.model,
1543
- score: answers.length ? passed / answers.length : 0,
1588
+ score: passed / checks.length,
1544
1589
  passed,
1545
- total: answers.length,
1590
+ total: checks.length,
1546
1591
  failed: answers.filter((a) => a.answer === "no"),
1547
1592
  answers
1548
1593
  };
@@ -1810,7 +1855,8 @@ async function stageInputs(context, workspace, cwd, raw) {
1810
1855
  const localAssetLimit = workspace.localDir
1811
1856
  ? getMaxLocalUploadBytes()
1812
1857
  : undefined;
1813
- const hasLocalAsset = localAssetLimit !== undefined && entries.some(([, ref]) => isNonBlankString(ref) && ref.trim().startsWith("asset://"));
1858
+ const hasLocalAsset = localAssetLimit !== undefined &&
1859
+ entries.some(([, ref]) => isNonBlankString(ref) && ref.trim().startsWith("asset://"));
1814
1860
  const totalLimit = hasLocalAsset
1815
1861
  ? Math.max(MAX_STAGED_TOTAL_BYTES, localAssetLimit ?? 0)
1816
1862
  : MAX_STAGED_TOTAL_BYTES;
@@ -1826,7 +1872,14 @@ async function stageInputs(context, workspace, cwd, raw) {
1826
1872
  let bytes = null;
1827
1873
  let readError;
1828
1874
  try {
1829
- bytes = await loadMediaRefBytes({ uri: ref.trim() }, context);
1875
+ // `loadMediaRefBytes` reads `file://` URIs and absolute paths straight
1876
+ // off the host disk. A filesystem-shaped ref resolves through the
1877
+ // storage adapter alone, which keeps it inside the storage root.
1878
+ const uri = ref.trim();
1879
+ bytes =
1880
+ filesystemPathForUri(uri) !== null
1881
+ ? ((await context.storage?.retrieve(uri)) ?? null)
1882
+ : await loadMediaRefBytes({ uri }, context);
1830
1883
  }
1831
1884
  catch (e) {
1832
1885
  // Keep why. Naming only the accepted forms is useless to a caller who