@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,1293 @@
1
+ /**
2
+ * The interpreter half of the QuickJS sandbox: everything that happens *inside*
3
+ * one `runSandboxed` call.
4
+ *
5
+ * `runInSandbox` (../js-sandbox.ts) owns the host half — building the bridge
6
+ * record, the WASM/host/capability dispatchers, the cancellation race, the
7
+ * unhandled-rejection guard, and the result shape callers see. This module owns
8
+ * what runs against the guest context: the interrupt handler, the never-reject
9
+ * wrap layer, the init prelude, the entry module, and the sync-back extractor.
10
+ *
11
+ * The split exists so the guest can run on a `worker_threads` worker without a
12
+ * second copy of any of it. Both hosts call {@link runInterpreter}; the pieces
13
+ * that must live next to the guest (the module loader's closures, the
14
+ * serializers, the interrupt handler) live here, and the pieces that need live
15
+ * host objects reach this module as plain functions — {@link
16
+ * InterpreterParams.isAborted} and {@link InterpreterParams.suspendedMs} stand
17
+ * in for the `AbortSignal` and the `SandboxClock`, neither of which can cross a
18
+ * thread.
19
+ *
20
+ * Browser-safe: nothing here imports a Node builtin, statically or otherwise.
21
+ */
22
+ import { addSerializer, expose, getModuleLoader as createDefaultModuleLoader, modulePathNormalizer as defaultModulePathNormalizer } from "@sebastianwessel/quickjs";
23
+ import * as acorn from "acorn";
24
+ import { captureTimelineScenes } from "../timeline-capture.js";
25
+ import { Scope } from "quickjs-emscripten-core";
26
+ import { SANDBOX_CAPABILITY_BRIDGE_SOURCE, SANDBOX_CAPABILITY_BRIDGE_SPECIFIER, SANDBOX_CAPABILITY_DISPATCH_GLOBAL } from "@nodetool-ai/protocol/sandbox-capability";
27
+ import { generateSandboxHostFacade, sandboxHostModule, SANDBOX_HOST_BRIDGE_SOURCE, SANDBOX_HOST_BRIDGE_SPECIFIER, SANDBOX_HOST_DISPATCH_GLOBAL } from "@nodetool-ai/protocol/sandbox-host";
28
+ import { generateSandboxWasmFacade, SANDBOX_WASM_BRIDGE_SOURCE, SANDBOX_WASM_BRIDGE_SPECIFIER, SANDBOX_WASM_DISPATCH_GLOBAL } from "@nodetool-ai/protocol/sandbox-wasm";
29
+ import { CANVAS_GRADIENT_FACTORIES, CANVAS_GRADIENT_MARKER, CANVAS_METHODS, CANVAS_PROPERTIES } from "../sandbox-canvas-api.js";
30
+ import { BASE64_ALPHABET, SANDBOX_BYTES_MARKER } from "../sandbox-bytes.js";
31
+ import { MEDIA_REF_MEMBERS } from "../sandbox-constants.js";
32
+ import { BOOTSTRAP_MODULE_SOURCES, normalizeBootstrapModuleId } from "../sandbox-bootstrap-modules.js";
33
+ import { decodeGuestPayload, encodeHostRecord, GUEST_GLOBALS_JSON_BINDING, GUEST_GLOBALS_SIDECAR_BINDING, GUEST_JSON_TRANSPORT_SOURCE, GUEST_MARSHAL_GLOBAL } from "../sandbox-json-transport.js";
34
+ import { isFunction, isObjectLike } from "../utils/type-guards.js";
35
+ /**
36
+ * The engine's wall-clock abort is a `setTimeout`, and Node fires a delay past
37
+ * this immediately instead of never — so this is the practical "no backstop".
38
+ */
39
+ export const MAX_ENGINE_TIMEOUT_MS = 2_147_483_647;
40
+ /**
41
+ * What the guest is told when it calls `stream` in a run that has no input
42
+ * stream behind it. Shared by the host bridge and the guest prelude so both
43
+ * paths say the same thing.
44
+ */
45
+ export const NO_INPUT_STREAM_MESSAGE = "stream() requires streaming-input mode; this run has no input stream";
46
+ let serializersRegistered = false;
47
+ /**
48
+ * The library's serializer table is module-global, so this registers once —
49
+ * and a worker, holding its own module instance, registers its own.
50
+ */
51
+ export function registerTypedArraySerializers() {
52
+ if (serializersRegistered)
53
+ return;
54
+ serializersRegistered = true;
55
+ // Map every typed-array class to a native Uint8Array on the host side.
56
+ // The guest returns `new Uint8Array([...])` (or friends); without this,
57
+ // the library's generic object serializer produces a plain object with
58
+ // numeric keys, which downstream code (CodeNode's normalizeOutput) would
59
+ // miss when detecting binary values.
60
+ const typedArrayNames = [
61
+ "Uint8Array",
62
+ "Int8Array",
63
+ "Uint8ClampedArray",
64
+ "Int16Array",
65
+ "Uint16Array",
66
+ "Int32Array",
67
+ "Uint32Array",
68
+ "Float32Array",
69
+ "Float64Array"
70
+ ];
71
+ for (const name of typedArrayNames) {
72
+ addSerializer(name, (ctx, handle) => {
73
+ const bufferHandle = ctx.getProp(handle, "buffer");
74
+ try {
75
+ // `getArrayBuffer` hands back a Lifetime that owns a view into the
76
+ // guest heap, not a plain value. Dropping it leaks the underlying
77
+ // object, and enough leaks trip `list_empty(&rt->gc_obj_list)` in
78
+ // JS_FreeRuntime — an Emscripten abort that kills the run *after* it
79
+ // produced its answer. Copy out, then release.
80
+ const ab = ctx.getArrayBuffer(bufferHandle);
81
+ try {
82
+ return Uint8Array.from(ab.value);
83
+ }
84
+ finally {
85
+ ab.dispose();
86
+ }
87
+ }
88
+ finally {
89
+ bufferHandle.dispose();
90
+ }
91
+ });
92
+ }
93
+ }
94
+ // ---------------------------------------------------------------------------
95
+ // The never-reject convention
96
+ // ---------------------------------------------------------------------------
97
+ /**
98
+ * Marker key placed on an object to signal a sandboxed error. A host async
99
+ * function that would normally `throw` instead resolves with one of these
100
+ * objects; a prelude inside the guest rewraps them as real guest-side errors.
101
+ *
102
+ * This indirection exists because the current `@sebastianwessel/quickjs`
103
+ * runtime leaks handles whenever a host-backed guest Promise is *rejected*,
104
+ * tripping an internal assertion (`list_empty(&rt->gc_obj_list)`) in
105
+ * quickjs-ng when the runtime is freed. Routing failures through a resolved
106
+ * tagged value sidesteps the leak while preserving the guest-visible
107
+ * behaviour (the user still gets a thrown Error with name + message).
108
+ */
109
+ export const SANDBOX_ERROR_MARKER = "__nodetool_sandbox_error__";
110
+ function neverReject(fn) {
111
+ return async (...args) => {
112
+ try {
113
+ return await fn(...args);
114
+ }
115
+ catch (e) {
116
+ return {
117
+ [SANDBOX_ERROR_MARKER]: true,
118
+ name: e instanceof Error ? e.name : "Error",
119
+ message: e instanceof Error ? e.message : String(e)
120
+ };
121
+ }
122
+ };
123
+ }
124
+ /**
125
+ * Compose with {@link neverReject}: once the run is cancelled, every subsequent
126
+ * host bridge call fails fast instead of doing work. The guest prelude rewraps
127
+ * the marker into a real `throw`, so an awaiting script unwinds on its next
128
+ * bridge call rather than running to completion after the user cancelled.
129
+ *
130
+ * Without an `isAborted` probe — a run the caller gave no cancellation source —
131
+ * the bridge is handed back untouched, exactly as when there is no signal.
132
+ */
133
+ function guardAbort(fn, isAborted) {
134
+ if (!isAborted)
135
+ return fn;
136
+ return async (...args) => {
137
+ if (isAborted()) {
138
+ return {
139
+ [SANDBOX_ERROR_MARKER]: true,
140
+ name: "ExecutionCancelled",
141
+ message: "Execution cancelled"
142
+ };
143
+ }
144
+ return fn(...args);
145
+ };
146
+ }
147
+ /**
148
+ * Replace every function reachable inside a caller-supplied data global with
149
+ * `wrap(fn)`, shallow-cloning the plain objects/arrays that hold them.
150
+ *
151
+ * A caller-supplied global is often a stub object nested a level or two deep
152
+ * — `{ nodetool: { timelines: { edit(id, ops) { ... } } } }` is exactly the
153
+ * shape `bakeTimelineCode`'s hermetic stub uses. Only the top-level `globals`
154
+ * entries were ever routed through the never-reject convention; a function
155
+ * found deeper than that reached the guest through the wrapper's own generic
156
+ * marshaling (see the call site), where a host throw or promise rejection is
157
+ * the exact shape `SANDBOX_ERROR_MARKER` exists to avoid. Running every
158
+ * nested function through the same `wrap` the top-level ones get — before the
159
+ * value is even classified as JSON-representable or not — means no host
160
+ * function this run exposes, at any depth, can ever throw or reject across
161
+ * the boundary; the guest-side deep-unwrap at the call site turns the
162
+ * resulting tagged value back into an ordinary guest `throw`.
163
+ */
164
+ function wrapNestedFunctionsDeep(value, wrap, seen = new Set()) {
165
+ if (isFunction(value)) {
166
+ return wrap(value);
167
+ }
168
+ if (value === null || typeof value !== "object")
169
+ return value;
170
+ if (seen.has(value))
171
+ return value;
172
+ seen.add(value);
173
+ if (Array.isArray(value)) {
174
+ return value.map((entry) => wrapNestedFunctionsDeep(entry, wrap, seen));
175
+ }
176
+ // Only plain records can hold a bridge function. Rebuilding anything else
177
+ // (Uint8Array, Date, Map) as a record strips the type the guest relies on.
178
+ const proto = Object.getPrototypeOf(value);
179
+ if (proto !== Object.prototype && proto !== null)
180
+ return value;
181
+ const out = {};
182
+ for (const [key, entry] of Object.entries(value)) {
183
+ out[key] = wrapNestedFunctionsDeep(entry, wrap, seen);
184
+ }
185
+ return out;
186
+ }
187
+ // ---------------------------------------------------------------------------
188
+ // Guest surface tables
189
+ // ---------------------------------------------------------------------------
190
+ /**
191
+ * Names injected as bridge bindings into the QuickJS guest. The rest of the
192
+ * `buildSandbox` record (JSON, Math, Date, URL, etc.) is deliberately NOT
193
+ * marshaled — QuickJS already provides native implementations, and re-exposing
194
+ * host versions creates thousands of handles that slow execution and leak on
195
+ * teardown.
196
+ */
197
+ export const EXPOSED_BRIDGE_NAMES = [
198
+ "console",
199
+ "fetch",
200
+ "crypto",
201
+ "sleep",
202
+ "getSecret",
203
+ "workspace",
204
+ "assetToSandbox",
205
+ "sandboxToAsset",
206
+ "progress",
207
+ "emit",
208
+ "output",
209
+ "format",
210
+ "image",
211
+ "audio",
212
+ "video",
213
+ "canvas",
214
+ "media",
215
+ "__maxIter",
216
+ "__secretScope"
217
+ ];
218
+ /**
219
+ * Globals the init prelude removes. `eval` and `Function` go so the guest
220
+ * cannot re-enter code generation. The rest are stubs
221
+ * `@sebastianwessel/quickjs` installs unconditionally (its node-compatibility
222
+ * layer and `provideEnv` have no off switch): `Buffer`, `process`, `env`,
223
+ * `Headers`, `Request`, `Response`, `performance`. Nothing in the sandbox's
224
+ * own machinery uses them — the fetch bridge returns plain objects and the
225
+ * guest-to-host serializers dispatch on constructor names no guest code can
226
+ * reach once the classes are gone — so they are deleted to keep the guest
227
+ * surface minimal instead of documented as stubs.
228
+ */
229
+ export const DELETED_GUEST_GLOBALS = [
230
+ "eval",
231
+ "Function",
232
+ "Buffer",
233
+ "process",
234
+ "env",
235
+ "Headers",
236
+ "Request",
237
+ "Response",
238
+ "performance"
239
+ ];
240
+ /** Name the host parks the raw (never-rejecting) dispatcher bridge on. */
241
+ export const SANDBOX_WASM_BRIDGE_BINDING = "__wasmCall";
242
+ /** Name the host parks the raw (never-rejecting) host dispatcher bridge on. */
243
+ export const SANDBOX_HOST_BRIDGE_BINDING = "__hostCall";
244
+ /** Name the host parks the raw (never-rejecting) capability dispatcher on. */
245
+ export const SANDBOX_CAPABILITY_BRIDGE_BINDING = "__capabilityCall";
246
+ /**
247
+ * Names the host parks the input bridges on, which the prelude captures and
248
+ * then deletes — the guest reaches them only through `stream`.
249
+ */
250
+ export const SANDBOX_INPUT_TAKE_BINDING = "__takeInput";
251
+ export const SANDBOX_STREAM_OPEN_BINDING = "__streamOpen";
252
+ // ---------------------------------------------------------------------------
253
+ // User code wrapping
254
+ // ---------------------------------------------------------------------------
255
+ /**
256
+ * Timer globals the guest must not see. The documented contract has always
257
+ * been "`sleep` is the only timer", but `@sebastianwessel/quickjs` installs
258
+ * host-backed `setTimeout`/`setInterval`/`setImmediate` into the context on
259
+ * every `evalCode` call — *after* the init prelude runs — so a prelude-time
260
+ * `delete` does not stick. {@link wrapCode} deletes them inside the user-code
261
+ * module itself, which evaluates after the library's re-install. They are
262
+ * blocked deliberately: their callbacks fire through `ctx.callFunction` with
263
+ * errors silently discarded, outside the never-reject and abort-guard
264
+ * conventions every bridge follows. Concurrency does not need them —
265
+ * bridge calls run in parallel under `Promise.all`/`parallelMap`.
266
+ */
267
+ export const BLOCKED_TIMER_GLOBALS = [
268
+ "setTimeout",
269
+ "clearTimeout",
270
+ "setInterval",
271
+ "clearInterval",
272
+ "setImmediate",
273
+ "clearImmediate"
274
+ ];
275
+ /**
276
+ * Wrap user code as the default export of an ES module with a top-level-awaited
277
+ * async IIFE body, so `return <value>` inside the snippet becomes the module's
278
+ * default export and `await` at the top level works. The module first drops
279
+ * the timer globals the engine re-installs per evaluation (see
280
+ * {@link BLOCKED_TIMER_GLOBALS}).
281
+ */
282
+ export function wrapCode(code, prelude = "", encodeResult = false) {
283
+ const [open, close] = resultEncoding(encodeResult);
284
+ return `${dropTimersStatement()}${prelude}
285
+ export default ${open}await (async () => {
286
+ ${code}
287
+ })()${close};`;
288
+ }
289
+ /**
290
+ * Wrap the module's default export in the guest's JSON encoder, or leave it
291
+ * alone. Both halves sit on the lines the IIFE already occupies, so
292
+ * {@link entryBodyLineOffset} — and every stack trace mapped through it — is
293
+ * unchanged either way.
294
+ */
295
+ function resultEncoding(encodeResult) {
296
+ return encodeResult
297
+ ? [`globalThis.${GUEST_MARSHAL_GLOBAL}(`, ")"]
298
+ : ["", ""];
299
+ }
300
+ function dropTimersStatement() {
301
+ return BLOCKED_TIMER_GLOBALS.map((n) => `delete globalThis.${n};`).join(" ");
302
+ }
303
+ /**
304
+ * Build the entry module for user code, hoisting static `import` declarations
305
+ * out of the async IIFE {@link wrapCode} wraps the body in.
306
+ *
307
+ * An `import` is only legal at module top level, so the IIFE body cannot hold
308
+ * one. The imports are spliced out by source range and re-emitted on a single
309
+ * line above the wrapper; the ranges they vacate are blanked with spaces (never
310
+ * with fewer newlines), so every remaining line of user code keeps its content
311
+ * and its offset from the body's start. The whole body shifts down by exactly
312
+ * one line relative to {@link wrapCode}'s output.
313
+ *
314
+ * Import-free code takes the {@link wrapCode} path unchanged, and so does code
315
+ * acorn cannot parse — a syntax error must reach the guest exactly as the user
316
+ * wrote it, not as this transform's complaint about it.
317
+ *
318
+ * Dynamic `import()` expressions are left where they are. The module loader
319
+ * denies them at runtime (see {@link createGuestModuleHost}); rewriting them
320
+ * here would only move a runtime denial into a confusing compile-time one.
321
+ */
322
+ export function buildEntryModule(source, prelude = "", encodeResult = false) {
323
+ // Timeline code gets its scene capture records here, the one step every
324
+ // guest run passes (docs/timeline-code-capture.md). The records add no
325
+ // line breaks, so line offsets below stay correct.
326
+ const code = captureTimelineScenes(source);
327
+ let program;
328
+ try {
329
+ program = acorn.parse(code, {
330
+ ecmaVersion: "latest",
331
+ sourceType: "module",
332
+ allowAwaitOutsideFunction: true,
333
+ allowReturnOutsideFunction: true
334
+ });
335
+ }
336
+ catch {
337
+ return wrapCode(code, prelude, encodeResult);
338
+ }
339
+ const imports = program.body.filter((node) => node.type === "ImportDeclaration");
340
+ if (imports.length === 0)
341
+ return wrapCode(code, prelude, encodeResult);
342
+ const hoisted = [];
343
+ let body = "";
344
+ let cursor = 0;
345
+ for (const declaration of imports) {
346
+ const text = code.slice(declaration.start, declaration.end);
347
+ hoisted.push(text.endsWith(";") ? text : `${text};`);
348
+ body += code.slice(cursor, declaration.start);
349
+ body += text.replace(/[^\n]/g, " ");
350
+ cursor = declaration.end;
351
+ }
352
+ body += code.slice(cursor);
353
+ const [open, close] = resultEncoding(encodeResult);
354
+ return `${hoisted.join(" ")}
355
+ ${dropTimersStatement()}${prelude}
356
+ export default ${open}await (async () => {
357
+ ${body}
358
+ })()${close};`;
359
+ }
360
+ /**
361
+ * How many module lines {@link buildEntryModule} (or {@link wrapCode}) place
362
+ * before the first line of the code it was given.
363
+ *
364
+ * QuickJS reports stack positions in the wrapped entry module, so an error on
365
+ * the guest's line N sits at `N + offset` in the source the user wrote. The
366
+ * hoisted-import path spends one extra leading line (the joined imports) over
367
+ * the plain wrapper, and which path applied is decided by the same acorn parse
368
+ * {@link buildEntryModule} runs — so the offset must come from here, not be
369
+ * guessed by callers.
370
+ */
371
+ export function entryBodyLineOffset(code) {
372
+ try {
373
+ const program = acorn.parse(code, {
374
+ ecmaVersion: "latest",
375
+ sourceType: "module",
376
+ allowAwaitOutsideFunction: true,
377
+ allowReturnOutsideFunction: true
378
+ });
379
+ const hasImports = program.body.some((node) => node.type === "ImportDeclaration");
380
+ return hasImports ? 3 : 2;
381
+ }
382
+ catch {
383
+ // Unparsable code takes the wrapCode path — the same path its syntax
384
+ // error will be reported against.
385
+ return 2;
386
+ }
387
+ }
388
+ // ---------------------------------------------------------------------------
389
+ // Guest module loading
390
+ // ---------------------------------------------------------------------------
391
+ /** Prefix of every module id this host resolves. Not a path — nothing mounts it. */
392
+ const GUEST_MODULE_PREFIX = "nodetool-sandbox:";
393
+ /**
394
+ * The module id every denial normalizes to. QuickJS never caches a module whose
395
+ * load failed, so one constant id serves every denial in a run: the normalizer
396
+ * records the reason, the loader immediately turns it into a guest-side Error.
397
+ */
398
+ const DENIED_MODULE_ID = `${GUEST_MODULE_PREFIX}denied`;
399
+ /** Separator between a pack name and a file id inside a module id. */
400
+ const GUEST_MODULE_SEPARATOR = "|";
401
+ /**
402
+ * The private bridge module's guest id.
403
+ *
404
+ * Only a generated WASM facade may import it. The denial is decided by the
405
+ * importing module, so neither user code nor a pack's authored JavaScript can
406
+ * reach it by name — and a module that reaches the dispatcher some other way
407
+ * gains nothing beyond the run's declared WASM surface, because the
408
+ * dispatcher's own checks are the boundary.
409
+ */
410
+ const WASM_BRIDGE_MODULE_ID = `${GUEST_MODULE_PREFIX}wasm-bridge`;
411
+ /**
412
+ * The private host-bridge module's guest id.
413
+ *
414
+ * Only a generated host facade may import it, decided by the importing module —
415
+ * so neither user code nor a pack's authored JavaScript can reach it by name.
416
+ * A module that reaches the dispatcher some other way gains nothing beyond the
417
+ * run's declared host surface, because the dispatcher's checks are the boundary.
418
+ */
419
+ const HOST_BRIDGE_MODULE_ID = `${GUEST_MODULE_PREFIX}host-bridge`;
420
+ /**
421
+ * The private capability-bridge module's guest id.
422
+ *
423
+ * Same rule as the host bridge: only a generated capability facade may import
424
+ * it. What differs is who mounts a capability module — the host, per session,
425
+ * never a pack's manifest and never the model's consent allowlist.
426
+ */
427
+ const CAPABILITY_BRIDGE_MODULE_ID = `${GUEST_MODULE_PREFIX}capability-bridge`;
428
+ function guestModuleId(packName, fileId) {
429
+ return `${GUEST_MODULE_PREFIX}${packName}${GUEST_MODULE_SEPARATOR}${fileId}`;
430
+ }
431
+ /** Resolve a `./`-relative specifier against a pack-relative file id. */
432
+ function resolveRelativeFileId(fromFileId, specifier) {
433
+ const parts = fromFileId.split("/").slice(0, -1);
434
+ for (const segment of specifier.split("/")) {
435
+ if (segment === "" || segment === ".")
436
+ continue;
437
+ if (segment === "..")
438
+ parts.pop();
439
+ else
440
+ parts.push(segment);
441
+ }
442
+ return parts.join("/");
443
+ }
444
+ /**
445
+ * Install the run's declared sandbox modules as the *only* importable modules.
446
+ *
447
+ * The enforcement point is the **normalizer**, not the loader: QuickJS resolves
448
+ * an already-loaded module straight out of its cache without consulting the
449
+ * loader, but it normalizes every specifier first. A denial decided in the
450
+ * normalizer therefore also holds for `node:buffer` and friends, which the
451
+ * wrapper imports into the cache during its own bootstrap
452
+ * (`prepareNodeCompatibility`) before guest code exists.
453
+ *
454
+ * Three phases, in order:
455
+ *
456
+ * 1. **bootstrap** — the wrapper's `import 'node:buffer'` and the rest of its
457
+ * compat preamble run before our sandboxed function is called. They resolve
458
+ * through the library's own normalizer, and through its loader for anything
459
+ * {@link BOOTSTRAP_MODULE_SOURCES} does not serve a cheaper source for, or
460
+ * the runtime never starts.
461
+ * 2. **guest, linking** — only the run's declared specifiers and their
462
+ * intra-pack siblings resolve. Everything else — `node:*`, the compat
463
+ * modules the bootstrap warmed, absolute paths, `../` escapes, encoded
464
+ * traversals, another pack's internal files — is denied by name.
465
+ * 3. **guest, locked** — the entry module's static graph is linked, so any
466
+ * further resolution is a dynamic `import()`, and every one of those is
467
+ * denied. A computed specifier is unknowable ahead of the call, and the
468
+ * declaration is the whole contract, so the stricter rule is the honest one.
469
+ *
470
+ * Loaded module sources are prefixed with the timer deletions
471
+ * ({@link BLOCKED_TIMER_GLOBALS}) on the same line as their first statement:
472
+ * dependencies evaluate *before* the entry body, so the entry's own deletions
473
+ * come too late to harden them. `eval`/`Function` need no such treatment — the
474
+ * init prelude deletes them for the whole context before any user `evalCode`.
475
+ */
476
+ export function createGuestModuleHost(modules, capabilityFacades) {
477
+ const sources = new Map();
478
+ const specifiers = new Map();
479
+ const facades = new Set();
480
+ const hostFacades = new Set();
481
+ const platformFacades = new Set();
482
+ for (const [specifier, source] of capabilityFacades ?? []) {
483
+ // A platform module has no pack behind it, so its guest id is derived from
484
+ // the specifier rather than from a pack/file pair.
485
+ const entryId = `${GUEST_MODULE_PREFIX}capability${GUEST_MODULE_SEPARATOR}${specifier}`;
486
+ specifiers.set(specifier, entryId);
487
+ sources.set(entryId, source);
488
+ platformFacades.add(entryId);
489
+ }
490
+ for (const module of modules?.modules ?? []) {
491
+ const entryId = guestModuleId(module.packName, module.moduleId);
492
+ if (module.kind === "host") {
493
+ // A host entry has no guest source of its own either: its specifier
494
+ // resolves to a facade generated from the protocol registry, so the guest
495
+ // surface of a host module is decided by NodeTool, never by the pack.
496
+ const spec = sandboxHostModule(module.hostId);
497
+ if (spec === undefined) {
498
+ throw new Error(`${module.specifier}: "${module.hostId}" is not a host module NodeTool implements`);
499
+ }
500
+ specifiers.set(module.specifier, entryId);
501
+ sources.set(entryId, generateSandboxHostFacade(module.specifier, spec));
502
+ hostFacades.add(entryId);
503
+ continue;
504
+ }
505
+ if (module.kind === "wasm") {
506
+ // A WASM entry has no guest source of its own: its specifier resolves to
507
+ // a generated facade over the per-run dispatcher. An authored sibling
508
+ // importing "./thing.wasm" lands on the same id, so it gets the same
509
+ // facade.
510
+ specifiers.set(module.specifier, entryId);
511
+ sources.set(entryId, generateSandboxWasmFacade(module.specifier, module.wasm));
512
+ facades.add(entryId);
513
+ continue;
514
+ }
515
+ specifiers.set(module.specifier, entryId);
516
+ sources.set(entryId, module.source);
517
+ for (const file of module.graph) {
518
+ if (file.kind !== "js")
519
+ continue;
520
+ sources.set(guestModuleId(module.packName, file.id), file.source);
521
+ }
522
+ }
523
+ if (facades.size > 0)
524
+ sources.set(WASM_BRIDGE_MODULE_ID, SANDBOX_WASM_BRIDGE_SOURCE);
525
+ if (hostFacades.size > 0) {
526
+ sources.set(HOST_BRIDGE_MODULE_ID, SANDBOX_HOST_BRIDGE_SOURCE);
527
+ }
528
+ if (platformFacades.size > 0) {
529
+ sources.set(CAPABILITY_BRIDGE_MODULE_ID, SANDBOX_CAPABILITY_BRIDGE_SOURCE);
530
+ }
531
+ const hardening = dropTimersStatement();
532
+ let phase = "bootstrap";
533
+ let locked = false;
534
+ let denial = "";
535
+ const deny = (message) => {
536
+ denial = message;
537
+ return DENIED_MODULE_ID;
538
+ };
539
+ const resolve = (baseName, requested) => {
540
+ if (locked) {
541
+ return deny(`dynamic import() is not allowed in the sandbox (requested "${requested}")` +
542
+ ` — declare it as a static \`import\` at the top of the code instead`);
543
+ }
544
+ if (requested === SANDBOX_HOST_BRIDGE_SPECIFIER) {
545
+ if (hostFacades.has(baseName))
546
+ return HOST_BRIDGE_MODULE_ID;
547
+ return deny(`"${SANDBOX_HOST_BRIDGE_SPECIFIER}" is private to the sandbox's generated host facades and cannot be imported`);
548
+ }
549
+ if (requested === SANDBOX_CAPABILITY_BRIDGE_SPECIFIER) {
550
+ if (platformFacades.has(baseName))
551
+ return CAPABILITY_BRIDGE_MODULE_ID;
552
+ return deny(`"${SANDBOX_CAPABILITY_BRIDGE_SPECIFIER}" is private to the sandbox's generated capability facades and cannot be imported`);
553
+ }
554
+ if (requested === SANDBOX_WASM_BRIDGE_SPECIFIER) {
555
+ if (facades.has(baseName))
556
+ return WASM_BRIDGE_MODULE_ID;
557
+ return deny(`"${SANDBOX_WASM_BRIDGE_SPECIFIER}" is private to the sandbox's generated WASM facades and cannot be imported`);
558
+ }
559
+ const declared = specifiers.get(requested);
560
+ if (declared !== undefined)
561
+ return declared;
562
+ if (requested.startsWith(".") && baseName.startsWith(GUEST_MODULE_PREFIX)) {
563
+ const separator = baseName.indexOf(GUEST_MODULE_SEPARATOR);
564
+ const pack = baseName.slice(GUEST_MODULE_PREFIX.length, separator);
565
+ const fileId = baseName.slice(separator + 1);
566
+ const target = resolveRelativeFileId(fileId, requested);
567
+ for (const candidate of [target, `${target}.js`, `${target}/index.js`]) {
568
+ const id = guestModuleId(pack, candidate);
569
+ if (sources.has(id))
570
+ return id;
571
+ }
572
+ return deny(`"${requested}" is not a file of the ${pack} sandbox package`);
573
+ }
574
+ return deny(`"${requested}" is not a sandbox package this run serves — only an installed pack the code imports resolves`);
575
+ };
576
+ return {
577
+ options: {
578
+ modulePathNormalizer: (baseName, requestedName, context) => phase === "bootstrap"
579
+ ? defaultModulePathNormalizer(baseName, requestedName, context)
580
+ : resolve(baseName, requestedName),
581
+ getModuleLoader: (fs, runtimeOptions) => {
582
+ const fallback = createDefaultModuleLoader(fs, runtimeOptions);
583
+ return (moduleName, context) => {
584
+ if (moduleName === DENIED_MODULE_ID) {
585
+ return { error: new Error(denial) };
586
+ }
587
+ const source = sources.get(moduleName);
588
+ if (source !== undefined)
589
+ return { value: `${hardening}${source}` };
590
+ if (phase === "bootstrap") {
591
+ // The wrapper's own compat preamble. Most of what it compiles into
592
+ // every fresh runtime, the init prelude deletes a moment later, so
593
+ // it is served something cheaper — see BOOTSTRAP_MODULE_SOURCES.
594
+ const stub = BOOTSTRAP_MODULE_SOURCES.get(normalizeBootstrapModuleId(moduleName));
595
+ if (stub !== undefined)
596
+ return { value: stub };
597
+ return fallback(moduleName, context);
598
+ }
599
+ return {
600
+ error: new Error(`Module "${moduleName}" is not available`)
601
+ };
602
+ };
603
+ }
604
+ },
605
+ enterGuestPhase() {
606
+ phase = "guest";
607
+ },
608
+ lockStaticGraph() {
609
+ locked = true;
610
+ }
611
+ };
612
+ }
613
+ /**
614
+ * Run one piece of user code against a fresh guest context.
615
+ *
616
+ * Resolves with the guest's verdict — including a guest-side error, which is a
617
+ * result and not a failure. It rejects only when the engine itself fails
618
+ * (an Emscripten abort, a marshaling error, a module host that could not be
619
+ * built), which the caller translates.
620
+ */
621
+ export async function runInterpreter(params) {
622
+ const { runSandboxed, code, sandbox, globals, syncTargetNames, wasmCall, hostCall, capabilityCall, modules, capabilityFacades, timeoutMs, limits, suspendAllowanceMs, hasClock, isAborted, suspendedMs, onTiming } = params;
623
+ const interpreterStartedAt = performance.now();
624
+ let callbackEnteredAt = interpreterStartedAt;
625
+ let callbackFinishedAt = interpreterStartedAt;
626
+ let initMs = 0;
627
+ let userCodeMs = 0;
628
+ let syncMs = 0;
629
+ // Built for every run, including one that resolved nothing. An empty host
630
+ // serves no specifier and denies each by name; skipping it would leave the
631
+ // wrapper's own Node-compat modules (`node:buffer` and friends) reachable
632
+ // from guest code, which is the one thing the normalizer exists to stop.
633
+ const moduleHost = createGuestModuleHost(modules, capabilityFacades);
634
+ const outcome = await runSandboxed(async ({ ctx, evalCode }) => {
635
+ callbackEnteredAt = performance.now();
636
+ // Past this point the wrapper's own Node-compat bootstrap has run, so
637
+ // nothing else may resolve outside the run's declared modules.
638
+ moduleHost.enterGuestPhase();
639
+ // A CPU-bound guest never yields to the host event loop, so an abort
640
+ // listener can't fire and Promise.race can't help. QuickJS polls this
641
+ // interrupt handler from inside the interpreter, which is the only
642
+ // mechanism that can stop a spinning loop. Compose cancellation with
643
+ // the library's own wall-clock deadline (it installed one before
644
+ // calling us; replacing it means re-implementing the deadline here).
645
+ // Suspended time is added back, so a program parked on a permission
646
+ // prompt resumes with the budget it had when it asked.
647
+ const deadline = Date.now() + timeoutMs;
648
+ ctx.runtime.setInterruptHandler(() => isAborted?.() === true ||
649
+ Date.now() > deadline + (suspendedMs?.() ?? 0));
650
+ const bridges = {};
651
+ for (const name of EXPOSED_BRIDGE_NAMES) {
652
+ bridges[name] = sandbox[name];
653
+ }
654
+ // Wrap every async bridge in a never-reject adapter (see
655
+ // SANDBOX_ERROR_MARKER above). The guest prelude rewraps them back into
656
+ // throwing functions before user code runs.
657
+ // guardAbort short-circuits each bridge once the run is cancelled;
658
+ // neverReject keeps the QuickJS handle-leak convention intact.
659
+ const wrap = (fn) => guardAbort(neverReject(fn), isAborted);
660
+ bridges.fetch = wrap(bridges.fetch);
661
+ bridges.sleep = wrap(bridges.sleep);
662
+ bridges.getSecret = wrap(bridges.getSecret);
663
+ bridges.assetToSandbox = wrap(bridges.assetToSandbox);
664
+ bridges.sandboxToAsset = wrap(bridges.sandboxToAsset);
665
+ // The guest hands these an encoded payload (see the prelude): decode it
666
+ // back into a value before the host sink ever sees it.
667
+ const decodeValueArg = (fn) => async (name, payload) => fn(name, decodeGuestPayload(payload));
668
+ bridges.emit = wrap(decodeValueArg(bridges.emit));
669
+ bridges.output = wrap(decodeValueArg(bridges.output));
670
+ // The input bridges are not in EXPOSED_BRIDGE_NAMES — the prelude
671
+ // captures them, builds `stream` on top, and deletes them. The take is
672
+ // async like every other host call; the open probe is synchronous and
673
+ // never throws, so it stays unwrapped (the `crypto.randomUUID` rule).
674
+ bridges[SANDBOX_INPUT_TAKE_BINDING] = wrap(sandbox[SANDBOX_INPUT_TAKE_BINDING]);
675
+ bridges[SANDBOX_STREAM_OPEN_BINDING] =
676
+ sandbox[SANDBOX_STREAM_OPEN_BINDING];
677
+ // Object bridges whose members are all async: wrap each member.
678
+ const wrapAllMembers = (bridge) => {
679
+ const out = {};
680
+ const members = bridge;
681
+ for (const [name, fn] of Object.entries(members)) {
682
+ out[name] = wrap(fn);
683
+ }
684
+ return out;
685
+ };
686
+ bridges.workspace = wrapAllMembers(bridges.workspace);
687
+ bridges.format = wrapAllMembers(bridges.format);
688
+ bridges.image = wrapAllMembers(bridges.image);
689
+ bridges.audio = wrapAllMembers(bridges.audio);
690
+ bridges.video = wrapAllMembers(bridges.video);
691
+ bridges.canvas = wrapAllMembers(bridges.canvas);
692
+ bridges.media = wrapAllMembers(bridges.media);
693
+ const hostCrypto = bridges.crypto;
694
+ bridges.crypto = {
695
+ // randomUUID/getRandomValues are synchronous and never throw, so they
696
+ // stay unwrapped; the async pair follows the never-reject convention.
697
+ randomUUID: hostCrypto.randomUUID,
698
+ getRandomValues: hostCrypto.getRandomValues,
699
+ digest: wrap(hostCrypto.digest),
700
+ hmac: wrap(hostCrypto.hmac)
701
+ };
702
+ // The WASM dispatcher rides the same never-reject convention as every
703
+ // other async bridge. It is exposed only when the run declares WASM
704
+ // modules, so a run without them has no such binding at any point.
705
+ if (wasmCall !== undefined) {
706
+ const dispatch = wasmCall;
707
+ bridges[SANDBOX_WASM_BRIDGE_BINDING] = wrap(async (moduleKey, exportName, args) => dispatch(moduleKey, exportName, args));
708
+ }
709
+ // Same treatment for host modules, exposed only when the run declares
710
+ // one, so a run without them has no such binding at any point.
711
+ if (hostCall !== undefined) {
712
+ const dispatch = hostCall;
713
+ bridges[SANDBOX_HOST_BRIDGE_BINDING] = wrap(async (moduleKey, exportName, args) => dispatch(moduleKey, exportName, args));
714
+ }
715
+ // And for the platform's own modules, exposed only when the host
716
+ // mounted some — a session with no capability run has no such binding.
717
+ if (capabilityCall !== undefined) {
718
+ const dispatch = capabilityCall;
719
+ bridges[SANDBOX_CAPABILITY_BRIDGE_BINDING] = wrap(async (moduleKey, exportName, args) => dispatch(moduleKey, exportName, args));
720
+ }
721
+ // Caller-injected globals are host functions too — guard the async
722
+ // ones or a cancelled run keeps driving real work through them after
723
+ // runInSandbox has returned. A caller-supplied global must follow the
724
+ // byte-tagging contract itself (`toGuestBytesDeep`): a raw `Uint8Array`
725
+ // returned to the guest is marshaled property-by-property, which OOMs
726
+ // the guest and throws inside the library's detached marshaling
727
+ // continuation. `guardHostProcess` on the caller's side keeps that from
728
+ // killing the process, but the run still fails.
729
+ // Data globals cross as one JSON string the prelude parses, because the
730
+ // wrapper installs an object property-by-property — ~400 µs per object
731
+ // node, which a Code node fed a few thousand rows pays before its first
732
+ // statement. A value JSON plus the transport's markers cannot carry
733
+ // (a function, a cycle, a class instance) keeps the wrapper's own path.
734
+ const dataGlobals = {};
735
+ for (const [name, value] of Object.entries(globals)) {
736
+ if (isFunction(value)) {
737
+ bridges[name] = wrap(value);
738
+ }
739
+ else if (value === null || typeof value !== "object") {
740
+ // A primitive crosses as a primitive: `newString` is one copy, while
741
+ // JSON would escape the text only to parse it back again.
742
+ bridges[name] = value;
743
+ }
744
+ else {
745
+ // A function reachable at any depth inside this object (a stub
746
+ // like `{ nodetool: { timelines: { edit() {...} } } }`) makes the
747
+ // whole tree UNREPRESENTABLE below and falls through to the
748
+ // wrapper's own generic marshaling (`encoded.skipped`). That path
749
+ // calls a *nested* host function the way the wrapper calls any
750
+ // host function — no never-reject convention applied — so a host
751
+ // implementation that throws (or whose returned promise rejects)
752
+ // crosses the FFI boundary as a genuine QuickJS exception/rejection
753
+ // rather than the tagged, always-resolved value the top-level
754
+ // bridges above are wrapped to produce. That is exactly the
755
+ // handle-leak shape documented on `SANDBOX_ERROR_MARKER`: replacing
756
+ // every nested function with `wrap(fn)` here, before the tree is
757
+ // even classified, means every host function this run exposes —
758
+ // top-level or nested — follows the same never-reject contract, and
759
+ // the guest-side deep-unwrap below turns the tagged value back into
760
+ // a plain guest `throw`.
761
+ dataGlobals[name] = wrapNestedFunctionsDeep(value, wrap);
762
+ }
763
+ }
764
+ const skippedGlobalNames = [];
765
+ if (Object.keys(dataGlobals).length > 0) {
766
+ const encoded = encodeHostRecord(dataGlobals);
767
+ if (encoded.cyclic.length > 0) {
768
+ // The fallback cannot take these: the wrapper's marshaler follows a
769
+ // cycle until the runtime aborts, which fails the run with an
770
+ // assertion instead of saying what was wrong with the input.
771
+ throw new Error(`Cannot pass ${encoded.cyclic
772
+ .map((name) => `"${name}"`)
773
+ .join(", ")} into the sandbox: the value refers back to itself`);
774
+ }
775
+ bridges[GUEST_GLOBALS_JSON_BINDING] = encoded.json;
776
+ if (encoded.sidecar.length > 0) {
777
+ bridges[GUEST_GLOBALS_SIDECAR_BINDING] = encoded.sidecar;
778
+ }
779
+ for (const name of encoded.skipped) {
780
+ bridges[name] = dataGlobals[name];
781
+ skippedGlobalNames.push(name);
782
+ }
783
+ }
784
+ // `expose` manages its own internal Scope; the second arg is unused.
785
+ const disposable = new Scope();
786
+ try {
787
+ expose(ctx, disposable, bridges);
788
+ }
789
+ finally {
790
+ disposable.dispose();
791
+ }
792
+ // Block dynamic code generation and re-wrap the never-reject bridges as
793
+ // throwing guest-side functions. Direct eval in QuickJS can't be neutered
794
+ // by overwriting `globalThis.eval` (QuickJS still resolves the builtin),
795
+ // but a plain `delete` removes the binding entirely so any reference
796
+ // throws ReferenceError — same for `Function`.
797
+ const initStartedAt = performance.now();
798
+ await evalCode(`const __marker = "${SANDBOX_ERROR_MARKER}";
799
+ const __bytesMarker = "${SANDBOX_BYTES_MARKER}";
800
+ const __b64chars = "${BASE64_ALPHABET}";
801
+ const __asBytes = (input, where) => {
802
+ if (typeof input === "string") return new TextEncoder().encode(input);
803
+ // Anything without a byte length silently encoded to "" here, and the empty
804
+ // string travelled on to whatever was going to save it. The call that
805
+ // produces this most often is an un-awaited async one — every media op and
806
+ // canvas.toBytes() is async — so say that rather than "invalid input".
807
+ if (!input || typeof input.length !== "number") {
808
+ const kind = input && typeof input.then === "function"
809
+ ? "a Promise — await it first"
810
+ : "a " + (input === null ? "null" : typeof input);
811
+ throw new TypeError(where + ": expected a Uint8Array or string, got " + kind);
812
+ }
813
+ return input;
814
+ };
815
+ globalThis.toBase64 = (input) => {
816
+ const b = __asBytes(input, "toBase64");
817
+ let out = "";
818
+ for (let i = 0; i < b.length; i += 3) {
819
+ const c = (b[i] << 16) | ((b[i + 1] || 0) << 8) | (b[i + 2] || 0);
820
+ out += __b64chars[(c >> 18) & 63] + __b64chars[(c >> 12) & 63] +
821
+ (i + 1 < b.length ? __b64chars[(c >> 6) & 63] : "=") +
822
+ (i + 2 < b.length ? __b64chars[c & 63] : "=");
823
+ }
824
+ return out;
825
+ };
826
+ globalThis.fromBase64 = (s) => {
827
+ const clean = String(s).replace(/-/g, "+").replace(/_/g, "/").replace(/[^A-Za-z0-9+/]/g, "");
828
+ const out = new Uint8Array((clean.length * 6) >> 3);
829
+ let acc = 0, bits = 0, o = 0;
830
+ for (let i = 0; i < clean.length; i++) {
831
+ acc = (acc << 6) | __b64chars.indexOf(clean[i]);
832
+ bits += 6;
833
+ if (bits >= 8) { bits -= 8; out[o++] = (acc >> bits) & 255; }
834
+ }
835
+ return out;
836
+ };
837
+ // Format console arguments guest-side, so only strings cross the boundary.
838
+ // The wrapper's marshaler walks an argument property by property, and a
839
+ // function has a prototype chain that leads back to itself: logging one — or
840
+ // a module namespace holding one, which is what \`import * as ns\` gives —
841
+ // recursed until the host stack blew, leaving handles alive and aborting the
842
+ // runtime on free with "list_empty(&rt->gc_obj_list)". That killed the whole
843
+ // run, after its real work was done, for a debug print.
844
+ {
845
+ const __hostConsole = globalThis.console;
846
+ const __fnLabel = (v) => "[Function: " + (v.name || "anonymous") + "]";
847
+ const __fmtConsoleArg = (value) => {
848
+ if (value === null) return "null";
849
+ if (value === undefined) return "undefined";
850
+ if (typeof value === "string") return value;
851
+ if (typeof value === "function") return __fnLabel(value);
852
+ if (typeof value === "symbol" || typeof value === "bigint") {
853
+ return String(value);
854
+ }
855
+ try {
856
+ const seen = new WeakSet();
857
+ const text = JSON.stringify(value, function (key, v) {
858
+ if (typeof v === "function") return __fnLabel(v);
859
+ if (typeof v === "bigint" || typeof v === "symbol") return String(v);
860
+ if (v !== null && typeof v === "object") {
861
+ if (seen.has(v)) return "[Circular]";
862
+ seen.add(v);
863
+ }
864
+ return v;
865
+ }, 2);
866
+ return text === undefined ? String(value) : text;
867
+ } catch {
868
+ try { return String(value); } catch { return "[unprintable]"; }
869
+ }
870
+ };
871
+ const __level = (name) => (...args) => {
872
+ __hostConsole[name](...args.map(__fmtConsoleArg));
873
+ };
874
+ globalThis.console = {
875
+ log: __level("log"),
876
+ warn: __level("warn"),
877
+ error: __level("error"),
878
+ info: __level("info")
879
+ };
880
+ }
881
+ globalThis.toHex = (input) => {
882
+ const b = __asBytes(input, "toHex");
883
+ let s = "";
884
+ for (let i = 0; i < b.length; i++) s += (b[i] < 16 ? "0" : "") + b[i].toString(16);
885
+ return s;
886
+ };
887
+ globalThis.fromHex = (s) => {
888
+ const t = String(s).replace(/[^0-9a-fA-F]/g, "");
889
+ const out = new Uint8Array(t.length >> 1);
890
+ for (let i = 0; i < out.length; i++) out[i] = parseInt(t.substr(i * 2, 2), 16);
891
+ return out;
892
+ };
893
+ globalThis.parallelMap = async (items, fn, concurrency) => {
894
+ if (typeof fn !== "function") {
895
+ throw new TypeError("parallelMap: fn must be a function");
896
+ }
897
+ const list = Array.from(items);
898
+ const raw = Number(concurrency === undefined ? 5 : concurrency);
899
+ const limit = Number.isFinite(raw)
900
+ ? Math.min(Math.max(Math.floor(raw), 1), 32)
901
+ : 5;
902
+ const results = new Array(list.length);
903
+ let next = 0;
904
+ const worker = async () => {
905
+ while (next < list.length) {
906
+ const i = next++;
907
+ results[i] = await fn(list[i], i);
908
+ }
909
+ };
910
+ const workers = [];
911
+ for (let w = 0; w < Math.min(limit, list.length); w++) workers.push(worker());
912
+ await Promise.all(workers);
913
+ return results;
914
+ };
915
+ const __revive = (v) => (v && typeof v === "object" && typeof v[__bytesMarker] === "string")
916
+ ? globalThis.fromBase64(v[__bytesMarker])
917
+ : v;
918
+ const __wrap = (fn) => async (...args) => {
919
+ const r = await fn(...args);
920
+ if (r && r[__marker]) {
921
+ const e = new Error(r.message);
922
+ e.name = r.name;
923
+ throw e;
924
+ }
925
+ return __revive(r);
926
+ };
927
+ const __rawFetch = __wrap(globalThis.fetch);
928
+ globalThis.fetch = async (...args) => {
929
+ const r = await __rawFetch(...args);
930
+ if (r && typeof r === "object") {
931
+ const bb = r.bodyBytes;
932
+ delete r.bodyBytes;
933
+ r.text = async () => r.body;
934
+ r.bytes = async () => __revive(bb);
935
+ r.arrayBuffer = async () => __revive(bb).buffer;
936
+ }
937
+ return r;
938
+ };
939
+ // progress is fire-and-forget and returns undefined by contract. Behind a
940
+ // worker its bridge is an RPC proxy that answers with a promise, so the
941
+ // wrapper swallows the return value on both paths rather than leak the
942
+ // difference to the guest.
943
+ const __rawProgress = globalThis.progress;
944
+ globalThis.progress = (percent, message) => {
945
+ void __rawProgress(percent, message);
946
+ };
947
+ globalThis.sleep = __wrap(globalThis.sleep);
948
+ globalThis.getSecret = __wrap(globalThis.getSecret);
949
+ globalThis.assetToSandbox = __wrap(globalThis.assetToSandbox);
950
+ globalThis.sandboxToAsset = __wrap(globalThis.sandboxToAsset);
951
+ // emit and output carry the run's data, so their argument takes the same
952
+ // JSON transport the result does — a single \`emit(rows)\` otherwise pays the
953
+ // wrapper's per-object marshal on the way out.
954
+ const __rawEmit = __wrap(globalThis.emit);
955
+ const __rawOutput = __wrap(globalThis.output);
956
+ globalThis.emit = (name, value) =>
957
+ __rawEmit(name, globalThis.${GUEST_MARSHAL_GLOBAL}(value));
958
+ globalThis.output = (name, value) =>
959
+ __rawOutput(name, globalThis.${GUEST_MARSHAL_GLOBAL}(value));
960
+ const __ws = globalThis.workspace;
961
+ globalThis.workspace = {
962
+ read: __wrap(__ws.read),
963
+ write: __wrap(__ws.write),
964
+ list: __wrap(__ws.list),
965
+ readBytes: __wrap(__ws.readBytes),
966
+ writeBytes: __wrap(__ws.writeBytes),
967
+ stat: __wrap(__ws.stat),
968
+ root: __wrap(__ws.root),
969
+ copy: __wrap(__ws.copy),
970
+ move: __wrap(__ws.move),
971
+ mkdir: __wrap(__ws.mkdir),
972
+ remove: __wrap(__ws.remove)
973
+ };
974
+ const __fmt = globalThis.format;
975
+ globalThis.format = {
976
+ number: __wrap(__fmt.number),
977
+ date: __wrap(__fmt.date),
978
+ relativeTime: __wrap(__fmt.relativeTime),
979
+ list: __wrap(__fmt.list)
980
+ };
981
+ const __reviveDeep = (v) => {
982
+ const r = __revive(v);
983
+ if (r !== v) return r;
984
+ // Revived bytes are already final. Walking a typed array key by key makes
985
+ // one string per byte and exhausts the guest heap on a large image.
986
+ if (ArrayBuffer.isView(v)) return v;
987
+ if (Array.isArray(v)) {
988
+ for (let i = 0; i < v.length; i++) v[i] = __reviveDeep(v[i]);
989
+ return v;
990
+ }
991
+ if (v && typeof v === "object") {
992
+ for (const k of Object.keys(v)) v[k] = __reviveDeep(v[k]);
993
+ return v;
994
+ }
995
+ return v;
996
+ };
997
+ const __wrapDeep = (fn) => {
998
+ const wrapped = __wrap(fn);
999
+ return async (...args) => __reviveDeep(await wrapped(...args));
1000
+ };
1001
+ const __image = globalThis.image;
1002
+ globalThis.image = {
1003
+ bytes: __wrapDeep(__image.bytes),
1004
+ toAsset: __wrapDeep(__image.toAsset),
1005
+ info: __wrapDeep(__image.info),
1006
+ decode: __wrapDeep(__image.decode),
1007
+ stats: __wrapDeep(__image.stats),
1008
+ blank: __wrapDeep(__image.blank),
1009
+ pad: __wrapDeep(__image.pad),
1010
+ grid: __wrapDeep(__image.grid),
1011
+ resize: __wrapDeep(__image.resize),
1012
+ crop: __wrapDeep(__image.crop),
1013
+ rotate: __wrapDeep(__image.rotate),
1014
+ flip: __wrapDeep(__image.flip),
1015
+ adjust: __wrapDeep(__image.adjust),
1016
+ composite: __wrapDeep(__image.composite),
1017
+ convert: __wrapDeep(__image.convert)
1018
+ };
1019
+ const __wrapMediaNamespace = (bridge) => {
1020
+ const out = {};
1021
+ for (const name of Object.keys(bridge)) out[name] = __wrapDeep(bridge[name]);
1022
+ return out;
1023
+ };
1024
+ globalThis.audio = __wrapMediaNamespace(globalThis.audio);
1025
+ globalThis.video = __wrapMediaNamespace(globalThis.video);
1026
+ const __canvasBridge = globalThis.canvas;
1027
+ globalThis.canvas = {
1028
+ render: __wrapDeep(__canvasBridge.render),
1029
+ measureText: __wrapDeep(__canvasBridge.measureText)
1030
+ };
1031
+ const __mediaBridge = globalThis.media;
1032
+ const __mediaOut = {};
1033
+ for (const __m of ${JSON.stringify(MEDIA_REF_MEMBERS)}) {
1034
+ __mediaOut[__m] = __wrapDeep(__mediaBridge[__m]);
1035
+ }
1036
+ globalThis.media = __mediaOut;
1037
+ // The input side of emit. An async iterable cannot cross the bridge, so the
1038
+ // guest builds one over a take-one-value host call: the body pulls, and an item
1039
+ // it has not asked for stays in the host's inbox. The raw bindings are captured
1040
+ // and deleted, so \`stream\` is the only way to reach them.
1041
+ const __takeInput = __wrapDeep(globalThis.${SANDBOX_INPUT_TAKE_BINDING});
1042
+ const __streamOpen = globalThis.${SANDBOX_STREAM_OPEN_BINDING};
1043
+ delete globalThis.${SANDBOX_INPUT_TAKE_BINDING};
1044
+ delete globalThis.${SANDBOX_STREAM_OPEN_BINDING};
1045
+ const __streamName = (fn, name) => {
1046
+ if (typeof name !== "string") {
1047
+ throw new TypeError(fn + ": name must be a string");
1048
+ }
1049
+ return name;
1050
+ };
1051
+ // \`handle\` is null for stream.any(), which yields [handle, value] pairs.
1052
+ const __streamIterable = (handle) => ({
1053
+ [Symbol.asyncIterator]: () => ({
1054
+ next: async () => {
1055
+ const take = await __takeInput(handle);
1056
+ if (take.done) return { done: true, value: undefined };
1057
+ return {
1058
+ done: false,
1059
+ value: handle === null ? [take.handle, take.value] : take.value
1060
+ };
1061
+ }
1062
+ })
1063
+ });
1064
+ globalThis.stream = (name) => __streamIterable(__streamName("stream", name));
1065
+ globalThis.stream.any = () => __streamIterable(null);
1066
+ globalThis.stream.first = async (name) => {
1067
+ const take = await __takeInput(__streamName("stream.first", name));
1068
+ return take.done ? undefined : take.value;
1069
+ };
1070
+ globalThis.stream.open = (name) => {
1071
+ const open = __streamOpen(__streamName("stream.open", name));
1072
+ // null is the host saying this run has no input stream at all. Every other
1073
+ // stream verb reports that by throwing; this one has to do it here, because
1074
+ // a synchronous bridge cannot.
1075
+ if (open === null) {
1076
+ throw new Error(${JSON.stringify(NO_INPUT_STREAM_MESSAGE)});
1077
+ }
1078
+ return open;
1079
+ };
1080
+ const __canvasProps = ${JSON.stringify(CANVAS_PROPERTIES)};
1081
+ const __canvasMethods = ${JSON.stringify(CANVAS_METHODS)};
1082
+ const __canvasGradients = ${JSON.stringify(CANVAS_GRADIENT_FACTORIES)};
1083
+ const __gradMarker = "${CANVAS_GRADIENT_MARKER}";
1084
+ // A canvas context is a host object with methods, which the bridge contract
1085
+ // cannot carry. So this records the ordinary Canvas 2D calls synchronously and
1086
+ // ships the whole draw list in one canvas.render() when toBytes() is awaited.
1087
+ globalThis.createCanvas = (width, height) => {
1088
+ const ops = [];
1089
+ const gradients = {};
1090
+ let gradientSeq = 0;
1091
+ const asStyle = (value) =>
1092
+ value && typeof value === "object" && typeof value[__gradMarker] === "string"
1093
+ ? { [__gradMarker]: value[__gradMarker] }
1094
+ : value;
1095
+ const ctx = {};
1096
+ for (const name of __canvasMethods) {
1097
+ ctx[name] = (...args) => {
1098
+ ops.push({ op: name, args });
1099
+ return ctx;
1100
+ };
1101
+ }
1102
+ ctx.drawImage = (source, ...rest) => {
1103
+ ops.push({ op: "drawImage", args: [source, ...rest] });
1104
+ return ctx;
1105
+ };
1106
+ const values = {};
1107
+ for (const prop of __canvasProps) {
1108
+ Object.defineProperty(ctx, prop, {
1109
+ enumerable: true,
1110
+ get: () => values[prop],
1111
+ set: (value) => {
1112
+ values[prop] = value;
1113
+ ops.push({ op: "set", args: [prop, asStyle(value)] });
1114
+ }
1115
+ });
1116
+ }
1117
+ for (const factory of Object.keys(__canvasGradients)) {
1118
+ ctx[factory] = (...coords) => {
1119
+ const id = "g" + gradientSeq++;
1120
+ const spec = { type: __canvasGradients[factory], coords, stops: [] };
1121
+ gradients[id] = spec;
1122
+ const handle = {
1123
+ [__gradMarker]: id,
1124
+ addColorStop: (offset, color) => {
1125
+ spec.stops.push([offset, color]);
1126
+ return handle;
1127
+ }
1128
+ };
1129
+ return handle;
1130
+ };
1131
+ }
1132
+ const surface = {
1133
+ width,
1134
+ height,
1135
+ getContext: (kind) => {
1136
+ if (kind !== undefined && kind !== "2d") {
1137
+ throw new Error('createCanvas: only the "2d" context exists');
1138
+ }
1139
+ return ctx;
1140
+ },
1141
+ toSpec: (options) => ({
1142
+ width,
1143
+ height,
1144
+ gradients,
1145
+ ops,
1146
+ ...(options || {})
1147
+ }),
1148
+ // render answers with a handle, like every other image producer, so a
1149
+ // drawing that goes straight into image.* never crosses the boundary.
1150
+ // toBytes keeps its name's promise and pays for the bytes explicitly.
1151
+ toImage: (options) => globalThis.canvas.render(surface.toSpec(options)),
1152
+ toBytes: async (options) =>
1153
+ globalThis.image.bytes(
1154
+ await globalThis.canvas.render(surface.toSpec(options))
1155
+ )
1156
+ };
1157
+ return surface;
1158
+ };
1159
+ const __crypto = globalThis.crypto;
1160
+ globalThis.crypto = {
1161
+ randomUUID: () => __crypto.randomUUID(),
1162
+ getRandomValues: (n) => {
1163
+ const len = Number(n);
1164
+ if (!Number.isFinite(len) || len < 0) {
1165
+ throw new TypeError("crypto.getRandomValues: length must be a non-negative number");
1166
+ }
1167
+ return __revive(__crypto.getRandomValues(Math.floor(len)));
1168
+ },
1169
+ digest: __wrap(__crypto.digest),
1170
+ hmac: __wrap(__crypto.hmac)
1171
+ };
1172
+ ${GUEST_JSON_TRANSPORT_SOURCE}
1173
+ ${skippedGlobalNames.length === 0
1174
+ ? ""
1175
+ : `// A global whose JSON tree held a function anywhere (\`encoded.skipped\`
1176
+ // on the host side) crossed via the wrapper's own generic marshaling, with
1177
+ // every nested function already replaced host-side by \`wrap(fn)\` — see
1178
+ // \`wrapNestedFunctionsDeep\`. Each one now resolves instead of throwing or
1179
+ // rejecting; this walks the same tree guest-side and turns every one of
1180
+ // those resolved, possibly-tagged values back into a normal guest function
1181
+ // that throws a real Error on failure, the same contract every named bridge
1182
+ // above already has.
1183
+ const __wrapGlobalFnsDeep = (v, seen) => {
1184
+ if (typeof v === "function") return __wrap(v);
1185
+ if (v && typeof v === "object") {
1186
+ if (seen.has(v)) return v;
1187
+ seen.add(v);
1188
+ if (Array.isArray(v)) {
1189
+ for (let i = 0; i < v.length; i++) v[i] = __wrapGlobalFnsDeep(v[i], seen);
1190
+ } else {
1191
+ for (const k of Object.keys(v)) v[k] = __wrapGlobalFnsDeep(v[k], seen);
1192
+ }
1193
+ }
1194
+ return v;
1195
+ };
1196
+ ${skippedGlobalNames
1197
+ .map((n) => `globalThis.${n} = __wrapGlobalFnsDeep(globalThis.${n}, new Set());`)
1198
+ .join("\n")}`}
1199
+ ${DELETED_GUEST_GLOBALS.map((n) => `delete globalThis.${n};`).join("\n")}
1200
+ ${wasmCall === undefined
1201
+ ? ""
1202
+ : `globalThis.${SANDBOX_WASM_DISPATCH_GLOBAL} = __wrap(globalThis.${SANDBOX_WASM_BRIDGE_BINDING});
1203
+ delete globalThis.${SANDBOX_WASM_BRIDGE_BINDING};`}
1204
+ ${hostCall === undefined
1205
+ ? ""
1206
+ : `globalThis.${SANDBOX_HOST_DISPATCH_GLOBAL} = __wrapDeep(globalThis.${SANDBOX_HOST_BRIDGE_BINDING});
1207
+ delete globalThis.${SANDBOX_HOST_BRIDGE_BINDING};`}
1208
+ ${capabilityCall === undefined
1209
+ ? ""
1210
+ : `globalThis.${SANDBOX_CAPABILITY_DISPATCH_GLOBAL} = __wrapDeep(globalThis.${SANDBOX_CAPABILITY_BRIDGE_BINDING});
1211
+ delete globalThis.${SANDBOX_CAPABILITY_BRIDGE_BINDING};`}
1212
+ export default true;`, "sandbox-init");
1213
+ initMs = performance.now() - initStartedAt;
1214
+ // `evalCode` compiles and links the module — resolving its whole static
1215
+ // import graph — before its first await, so a resolution that arrives
1216
+ // after this call has returned can only come from a dynamic `import()`.
1217
+ // The dispatcher binding lives only long enough for the bridge module
1218
+ // to capture it while the entry's static graph links. This deletion is
1219
+ // the entry module's first statement, so it runs after every imported
1220
+ // module has evaluated and before the user IIFE starts.
1221
+ const userCodeStartedAt = performance.now();
1222
+ const pendingUserResult = evalCode(buildEntryModule(code, `${wasmCall === undefined
1223
+ ? ""
1224
+ : ` delete globalThis.${SANDBOX_WASM_DISPATCH_GLOBAL};`}${hostCall === undefined
1225
+ ? ""
1226
+ : ` delete globalThis.${SANDBOX_HOST_DISPATCH_GLOBAL};`}${capabilityCall === undefined
1227
+ ? ""
1228
+ : ` delete globalThis.${SANDBOX_CAPABILITY_DISPATCH_GLOBAL};`}`, true), "user-code");
1229
+ moduleHost.lockStaticGraph();
1230
+ const userResult = await pendingUserResult;
1231
+ userCodeMs = performance.now() - userCodeStartedAt;
1232
+ // Read mutable globals back out. node:vm shared the host heap, so
1233
+ // `state.counter++` in user code mutated the caller's object directly.
1234
+ // With QuickJS the guest heap is isolated, so after user code runs we
1235
+ // extract the current values of the object-typed user globals and hand
1236
+ // them to the caller, which replaces the contents of its own objects in
1237
+ // place. CodeNode relies on this to make its `state` object persist
1238
+ // across invocations.
1239
+ let syncedGlobals;
1240
+ if (syncTargetNames.length > 0) {
1241
+ const syncStartedAt = performance.now();
1242
+ const extractor = `export default globalThis.${GUEST_MARSHAL_GLOBAL}({${syncTargetNames
1243
+ .map((n) => `${n}: (typeof ${n} !== 'undefined' && ${n} !== null) ? ${n} : null`)
1244
+ .join(", ")}});`;
1245
+ const syncResp = await evalCode(extractor, "sandbox-sync");
1246
+ if (syncResp.ok) {
1247
+ const decoded = decodeGuestPayload(syncResp.data);
1248
+ if (isObjectLike(decoded)) {
1249
+ syncedGlobals = decoded;
1250
+ }
1251
+ }
1252
+ syncMs = performance.now() - syncStartedAt;
1253
+ }
1254
+ const result = userResult.ok
1255
+ ? {
1256
+ ok: true,
1257
+ data: decodeGuestPayload(userResult.data),
1258
+ syncedGlobals
1259
+ }
1260
+ : { ok: false, error: userResult.error, syncedGlobals };
1261
+ callbackFinishedAt = performance.now();
1262
+ return result;
1263
+ }, {
1264
+ // The engine's own abort is a plain `setTimeout` armed when evaluation
1265
+ // starts — it cannot be paused. With a clock in play it becomes the
1266
+ // backstop for a run that stays suspended forever, while the interrupt
1267
+ // handler above keeps the exact bound on guest execution.
1268
+ executionTimeout: hasClock
1269
+ ? Math.min(timeoutMs + Math.max(0, suspendAllowanceMs), MAX_ENGINE_TIMEOUT_MS)
1270
+ : timeoutMs,
1271
+ memoryLimit: limits.memoryLimitBytes,
1272
+ maxStackSize: limits.stackLimitBytes,
1273
+ // The library defaults this to `{NODE_DEBUG: "true"}`, which reaches
1274
+ // the guest as `process.env` and can flip debug paths in its `node:util`
1275
+ // polyfill. Guest code has no business reading host-shaped environment
1276
+ // variables, so the stub carries nothing.
1277
+ env: {},
1278
+ ...moduleHost.options
1279
+ });
1280
+ const interpreterFinishedAt = performance.now();
1281
+ const callbackMs = callbackFinishedAt - callbackEnteredAt;
1282
+ onTiming?.({
1283
+ wrapperSetupMs: callbackEnteredAt - interpreterStartedAt,
1284
+ initMs,
1285
+ userCodeMs,
1286
+ syncMs,
1287
+ callbackRemainderMs: Math.max(0, callbackMs - initMs - userCodeMs - syncMs),
1288
+ wrapperCleanupMs: Math.max(0, interpreterFinishedAt - callbackFinishedAt),
1289
+ totalMs: interpreterFinishedAt - interpreterStartedAt
1290
+ });
1291
+ return outcome;
1292
+ }
1293
+ //# sourceMappingURL=interpreter.js.map