experimental-ash 0.2.0-alpha.2 → 0.2.0-alpha.21

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 (585) hide show
  1. package/dist/src/channel/http-channel.d.ts +26 -0
  2. package/dist/src/channel/http-channel.d.ts.map +1 -0
  3. package/dist/src/channel/http-channel.js +24 -0
  4. package/dist/src/channel/http-channel.js.map +1 -0
  5. package/dist/src/channel/resolve-text.d.ts +20 -0
  6. package/dist/src/channel/resolve-text.d.ts.map +1 -0
  7. package/dist/src/channel/resolve-text.js +60 -0
  8. package/dist/src/channel/resolve-text.js.map +1 -0
  9. package/dist/src/channel/schedule-channel.d.ts +16 -0
  10. package/dist/src/channel/schedule-channel.d.ts.map +1 -0
  11. package/dist/src/channel/schedule-channel.js +20 -0
  12. package/dist/src/channel/schedule-channel.js.map +1 -0
  13. package/dist/src/channel/schedule.d.ts +4 -6
  14. package/dist/src/channel/schedule.d.ts.map +1 -1
  15. package/dist/src/channel/schedule.js +6 -9
  16. package/dist/src/channel/schedule.js.map +1 -1
  17. package/dist/src/channel/slack-channel.d.ts +125 -0
  18. package/dist/src/channel/slack-channel.d.ts.map +1 -0
  19. package/dist/src/channel/slack-channel.js +320 -0
  20. package/dist/src/channel/slack-channel.js.map +1 -0
  21. package/dist/src/channel/subagent-channel.d.ts +41 -0
  22. package/dist/src/channel/subagent-channel.d.ts.map +1 -0
  23. package/dist/src/channel/{subagent-emitter.js → subagent-channel.js} +15 -19
  24. package/dist/src/channel/subagent-channel.js.map +1 -0
  25. package/dist/src/channel/types.d.ts +157 -90
  26. package/dist/src/channel/types.d.ts.map +1 -1
  27. package/dist/src/channel/types.js +64 -1
  28. package/dist/src/channel/types.js.map +1 -1
  29. package/dist/src/cli/dev/input-requests.d.ts +4 -4
  30. package/dist/src/cli/dev/input-requests.d.ts.map +1 -1
  31. package/dist/src/cli/dev/input-requests.js +34 -65
  32. package/dist/src/cli/dev/input-requests.js.map +1 -1
  33. package/dist/src/cli/dev/repl.d.ts.map +1 -1
  34. package/dist/src/cli/dev/repl.js +41 -24
  35. package/dist/src/cli/dev/repl.js.map +1 -1
  36. package/dist/src/client/index.d.ts +3 -2
  37. package/dist/src/client/index.d.ts.map +1 -1
  38. package/dist/src/client/index.js +1 -0
  39. package/dist/src/client/index.js.map +1 -1
  40. package/dist/src/client/message-response.d.ts +5 -5
  41. package/dist/src/client/message-response.d.ts.map +1 -1
  42. package/dist/src/client/message-response.js +6 -6
  43. package/dist/src/client/message-response.js.map +1 -1
  44. package/dist/src/client/open-stream.d.ts +1 -1
  45. package/dist/src/client/open-stream.d.ts.map +1 -1
  46. package/dist/src/client/open-stream.js +1 -1
  47. package/dist/src/client/open-stream.js.map +1 -1
  48. package/dist/src/client/session-utils.d.ts +3 -3
  49. package/dist/src/client/session-utils.d.ts.map +1 -1
  50. package/dist/src/client/session-utils.js +4 -4
  51. package/dist/src/client/session-utils.js.map +1 -1
  52. package/dist/src/client/session.d.ts +5 -5
  53. package/dist/src/client/session.js +28 -28
  54. package/dist/src/client/session.js.map +1 -1
  55. package/dist/src/client/types.d.ts +8 -8
  56. package/dist/src/client/types.d.ts.map +1 -1
  57. package/dist/src/compiler/channel-url.d.ts +1 -1
  58. package/dist/src/compiler/channel-url.js +1 -1
  59. package/dist/src/compiler/manifest.d.ts +38 -5
  60. package/dist/src/compiler/manifest.d.ts.map +1 -1
  61. package/dist/src/compiler/manifest.js +15 -1
  62. package/dist/src/compiler/manifest.js.map +1 -1
  63. package/dist/src/compiler/module-map.js +8 -0
  64. package/dist/src/compiler/module-map.js.map +1 -1
  65. package/dist/src/compiler/normalize-channel.d.ts +1 -1
  66. package/dist/src/compiler/normalize-channel.js +3 -3
  67. package/dist/src/compiler/normalize-channel.js.map +1 -1
  68. package/dist/src/compiler/normalize-connection.d.ts +14 -0
  69. package/dist/src/compiler/normalize-connection.d.ts.map +1 -0
  70. package/dist/src/compiler/normalize-connection.js +29 -0
  71. package/dist/src/compiler/normalize-connection.js.map +1 -0
  72. package/dist/src/compiler/normalize-manifest.d.ts.map +1 -1
  73. package/dist/src/compiler/normalize-manifest.js +2 -0
  74. package/dist/src/compiler/normalize-manifest.js.map +1 -1
  75. package/dist/src/context/accessors.d.ts +13 -12
  76. package/dist/src/context/accessors.d.ts.map +1 -1
  77. package/dist/src/context/accessors.js +16 -17
  78. package/dist/src/context/accessors.js.map +1 -1
  79. package/dist/src/context/container.d.ts +17 -19
  80. package/dist/src/context/container.d.ts.map +1 -1
  81. package/dist/src/context/container.js +21 -14
  82. package/dist/src/context/container.js.map +1 -1
  83. package/dist/src/context/durable-context.d.ts +18 -0
  84. package/dist/src/context/durable-context.d.ts.map +1 -0
  85. package/dist/src/context/durable-context.js +49 -0
  86. package/dist/src/context/durable-context.js.map +1 -0
  87. package/dist/src/context/key.d.ts +43 -83
  88. package/dist/src/context/key.d.ts.map +1 -1
  89. package/dist/src/context/key.js +58 -80
  90. package/dist/src/context/key.js.map +1 -1
  91. package/dist/src/context/keys.d.ts +8 -20
  92. package/dist/src/context/keys.d.ts.map +1 -1
  93. package/dist/src/context/keys.js +20 -34
  94. package/dist/src/context/keys.js.map +1 -1
  95. package/dist/src/context/provider.d.ts +2 -2
  96. package/dist/src/context/provider.d.ts.map +1 -1
  97. package/dist/src/context/providers/connection.d.ts +4 -0
  98. package/dist/src/context/providers/connection.d.ts.map +1 -0
  99. package/dist/src/context/providers/connection.js +18 -0
  100. package/dist/src/context/providers/connection.js.map +1 -0
  101. package/dist/src/context/providers/session.d.ts.map +1 -1
  102. package/dist/src/context/providers/session.js +1 -2
  103. package/dist/src/context/providers/session.js.map +1 -1
  104. package/dist/src/context/providers/skill.d.ts.map +1 -1
  105. package/dist/src/context/providers/skill.js +2 -15
  106. package/dist/src/context/providers/skill.js.map +1 -1
  107. package/dist/src/context/run-step.d.ts +6 -8
  108. package/dist/src/context/run-step.d.ts.map +1 -1
  109. package/dist/src/context/run-step.js +15 -17
  110. package/dist/src/context/run-step.js.map +1 -1
  111. package/dist/src/context/seed-keys.d.ts +21 -0
  112. package/dist/src/context/seed-keys.d.ts.map +1 -0
  113. package/dist/src/context/seed-keys.js +31 -0
  114. package/dist/src/context/seed-keys.js.map +1 -0
  115. package/dist/src/context/serialize.d.ts +8 -9
  116. package/dist/src/context/serialize.d.ts.map +1 -1
  117. package/dist/src/context/serialize.js +38 -15
  118. package/dist/src/context/serialize.js.map +1 -1
  119. package/dist/src/discover/connections.d.ts +48 -0
  120. package/dist/src/discover/connections.d.ts.map +1 -0
  121. package/dist/src/discover/connections.js +169 -0
  122. package/dist/src/discover/connections.js.map +1 -0
  123. package/dist/src/discover/discover-agent.d.ts +1 -0
  124. package/dist/src/discover/discover-agent.d.ts.map +1 -1
  125. package/dist/src/discover/discover-agent.js +8 -0
  126. package/dist/src/discover/discover-agent.js.map +1 -1
  127. package/dist/src/discover/discover-subagent.js +7 -0
  128. package/dist/src/discover/discover-subagent.js.map +1 -1
  129. package/dist/src/discover/filesystem.d.ts +3 -3
  130. package/dist/src/discover/filesystem.d.ts.map +1 -1
  131. package/dist/src/discover/filesystem.js +7 -0
  132. package/dist/src/discover/filesystem.js.map +1 -1
  133. package/dist/src/discover/grammar.d.ts +20 -4
  134. package/dist/src/discover/grammar.d.ts.map +1 -1
  135. package/dist/src/discover/grammar.js +31 -5
  136. package/dist/src/discover/grammar.js.map +1 -1
  137. package/dist/src/discover/manifest.d.ts +28 -1
  138. package/dist/src/discover/manifest.d.ts.map +1 -1
  139. package/dist/src/discover/manifest.js +11 -1
  140. package/dist/src/discover/manifest.js.map +1 -1
  141. package/dist/src/evals/runner/artifacts.js +1 -1
  142. package/dist/src/evals/runner/artifacts.js.map +1 -1
  143. package/dist/src/evals/runner/derive-run-facts.js +5 -5
  144. package/dist/src/evals/runner/derive-run-facts.js.map +1 -1
  145. package/dist/src/evals/runner/execute-case.js +4 -4
  146. package/dist/src/evals/runner/execute-case.js.map +1 -1
  147. package/dist/src/evals/runner/execute-suite.js +1 -1
  148. package/dist/src/evals/runner/execute-suite.js.map +1 -1
  149. package/dist/src/evals/runner/reporters/braintrust.js +2 -2
  150. package/dist/src/evals/runner/reporters/braintrust.js.map +1 -1
  151. package/dist/src/evals/types.d.ts +4 -4
  152. package/dist/src/evals/types.d.ts.map +1 -1
  153. package/dist/src/execution/continuous-entry.d.ts +18 -9
  154. package/dist/src/execution/continuous-entry.d.ts.map +1 -1
  155. package/dist/src/execution/continuous-entry.js +62 -18
  156. package/dist/src/execution/continuous-entry.js.map +1 -1
  157. package/dist/src/execution/continuous-runtime.d.ts +1 -1
  158. package/dist/src/execution/continuous-runtime.d.ts.map +1 -1
  159. package/dist/src/execution/continuous-runtime.js +14 -10
  160. package/dist/src/execution/continuous-runtime.js.map +1 -1
  161. package/dist/src/execution/node-step.d.ts +1 -2
  162. package/dist/src/execution/node-step.d.ts.map +1 -1
  163. package/dist/src/execution/node-step.js +42 -55
  164. package/dist/src/execution/node-step.js.map +1 -1
  165. package/dist/src/execution/runtime-context.d.ts +3 -0
  166. package/dist/src/execution/runtime-context.d.ts.map +1 -1
  167. package/dist/src/execution/runtime-context.js +6 -4
  168. package/dist/src/execution/runtime-context.js.map +1 -1
  169. package/dist/src/execution/session.d.ts +2 -1
  170. package/dist/src/execution/session.d.ts.map +1 -1
  171. package/dist/src/execution/session.js +1 -0
  172. package/dist/src/execution/session.js.map +1 -1
  173. package/dist/src/execution/skills/access.d.ts.map +1 -1
  174. package/dist/src/execution/skills/instructions.d.ts +6 -6
  175. package/dist/src/execution/skills/instructions.d.ts.map +1 -1
  176. package/dist/src/execution/skills/instructions.js +15 -15
  177. package/dist/src/execution/skills/instructions.js.map +1 -1
  178. package/dist/src/execution/skills/types.d.ts +4 -4
  179. package/dist/src/execution/skills/types.d.ts.map +1 -1
  180. package/dist/src/execution/step-context.d.ts +27 -0
  181. package/dist/src/execution/step-context.d.ts.map +1 -0
  182. package/dist/src/execution/step-context.js +54 -0
  183. package/dist/src/execution/step-context.js.map +1 -0
  184. package/dist/src/execution/subagent-tool.d.ts +1 -1
  185. package/dist/src/execution/subagent-tool.d.ts.map +1 -1
  186. package/dist/src/execution/subagent-tool.js +3 -4
  187. package/dist/src/execution/subagent-tool.js.map +1 -1
  188. package/dist/src/execution/tool-compaction.d.ts +1 -3
  189. package/dist/src/execution/tool-compaction.d.ts.map +1 -1
  190. package/dist/src/execution/tool-compaction.js +6 -20
  191. package/dist/src/execution/tool-compaction.js.map +1 -1
  192. package/dist/src/execution/types.d.ts +1 -1
  193. package/dist/src/execution/types.d.ts.map +1 -1
  194. package/dist/src/execution/workflow-entry.d.ts +4 -5
  195. package/dist/src/execution/workflow-entry.d.ts.map +1 -1
  196. package/dist/src/execution/workflow-entry.js +7 -2
  197. package/dist/src/execution/workflow-entry.js.map +1 -1
  198. package/dist/src/execution/workflow-runtime.d.ts.map +1 -1
  199. package/dist/src/execution/workflow-runtime.js +10 -5
  200. package/dist/src/execution/workflow-runtime.js.map +1 -1
  201. package/dist/src/execution/workflow-steps.d.ts +13 -6
  202. package/dist/src/execution/workflow-steps.d.ts.map +1 -1
  203. package/dist/src/execution/workflow-steps.js +24 -19
  204. package/dist/src/execution/workflow-steps.js.map +1 -1
  205. package/dist/src/harness/emission.d.ts +36 -27
  206. package/dist/src/harness/emission.d.ts.map +1 -1
  207. package/dist/src/harness/emission.js +130 -84
  208. package/dist/src/harness/emission.js.map +1 -1
  209. package/dist/src/harness/execute-tool.d.ts +52 -0
  210. package/dist/src/harness/execute-tool.d.ts.map +1 -0
  211. package/dist/src/harness/execute-tool.js +59 -0
  212. package/dist/src/harness/execute-tool.js.map +1 -0
  213. package/dist/src/harness/input-extraction.d.ts +3 -3
  214. package/dist/src/harness/input-extraction.d.ts.map +1 -1
  215. package/dist/src/harness/input-extraction.js +15 -8
  216. package/dist/src/harness/input-extraction.js.map +1 -1
  217. package/dist/src/harness/input-requests.d.ts +46 -40
  218. package/dist/src/harness/input-requests.d.ts.map +1 -1
  219. package/dist/src/harness/input-requests.js +169 -245
  220. package/dist/src/harness/input-requests.js.map +1 -1
  221. package/dist/src/harness/messages.d.ts +10 -9
  222. package/dist/src/harness/messages.d.ts.map +1 -1
  223. package/dist/src/harness/messages.js +23 -20
  224. package/dist/src/harness/messages.js.map +1 -1
  225. package/dist/src/harness/provider-tools.d.ts +2 -2
  226. package/dist/src/harness/provider-tools.d.ts.map +1 -1
  227. package/dist/src/harness/provider-tools.js +7 -3
  228. package/dist/src/harness/provider-tools.js.map +1 -1
  229. package/dist/src/harness/step-hooks.d.ts +77 -0
  230. package/dist/src/harness/step-hooks.d.ts.map +1 -0
  231. package/dist/src/harness/step-hooks.js +192 -0
  232. package/dist/src/harness/step-hooks.js.map +1 -0
  233. package/dist/src/harness/tool-loop.d.ts +4 -2
  234. package/dist/src/harness/tool-loop.d.ts.map +1 -1
  235. package/dist/src/harness/tool-loop.js +130 -181
  236. package/dist/src/harness/tool-loop.js.map +1 -1
  237. package/dist/src/harness/tools.d.ts +12 -16
  238. package/dist/src/harness/tools.d.ts.map +1 -1
  239. package/dist/src/harness/tools.js +39 -33
  240. package/dist/src/harness/tools.js.map +1 -1
  241. package/dist/src/harness/types.d.ts +44 -28
  242. package/dist/src/harness/types.d.ts.map +1 -1
  243. package/dist/src/harness/types.js +6 -1
  244. package/dist/src/harness/types.js.map +1 -1
  245. package/dist/src/internal/application/compiled-artifacts.d.ts +5 -3
  246. package/dist/src/internal/application/compiled-artifacts.d.ts.map +1 -1
  247. package/dist/src/internal/application/compiled-artifacts.js +19 -40
  248. package/dist/src/internal/application/compiled-artifacts.js.map +1 -1
  249. package/dist/src/internal/application/package.js +1 -1
  250. package/dist/src/internal/authored-definition/channel.d.ts +3 -3
  251. package/dist/src/internal/authored-definition/channel.d.ts.map +1 -1
  252. package/dist/src/internal/authored-definition/channel.js +28 -4
  253. package/dist/src/internal/authored-definition/channel.js.map +1 -1
  254. package/dist/src/internal/authored-definition/connection.d.ts +10 -0
  255. package/dist/src/internal/authored-definition/connection.d.ts.map +1 -0
  256. package/dist/src/internal/authored-definition/connection.js +134 -0
  257. package/dist/src/internal/authored-definition/connection.js.map +1 -0
  258. package/dist/src/internal/authored-module.js +1 -1
  259. package/dist/src/internal/authored-module.js.map +1 -1
  260. package/dist/src/internal/message/builder.d.ts +1 -2
  261. package/dist/src/internal/message/builder.d.ts.map +1 -1
  262. package/dist/src/internal/message/builder.js +4 -12
  263. package/dist/src/internal/message/builder.js.map +1 -1
  264. package/dist/src/internal/nitro/host/configure-message-routes.d.ts +3 -1
  265. package/dist/src/internal/nitro/host/configure-message-routes.d.ts.map +1 -1
  266. package/dist/src/internal/nitro/host/configure-message-routes.js +124 -25
  267. package/dist/src/internal/nitro/host/configure-message-routes.js.map +1 -1
  268. package/dist/src/internal/nitro/host/create-application-nitro.d.ts.map +1 -1
  269. package/dist/src/internal/nitro/host/create-application-nitro.js +63 -21
  270. package/dist/src/internal/nitro/host/create-application-nitro.js.map +1 -1
  271. package/dist/src/internal/nitro/host/load-home-page-web-assets.d.ts +13 -0
  272. package/dist/src/internal/nitro/host/load-home-page-web-assets.d.ts.map +1 -0
  273. package/dist/src/internal/nitro/host/load-home-page-web-assets.js +35 -0
  274. package/dist/src/internal/nitro/host/load-home-page-web-assets.js.map +1 -0
  275. package/dist/src/internal/nitro/host/prepare-application-host.js +1 -1
  276. package/dist/src/internal/nitro/host/prepare-application-host.js.map +1 -1
  277. package/dist/src/internal/nitro/routes/channel-dispatch.d.ts +10 -18
  278. package/dist/src/internal/nitro/routes/channel-dispatch.d.ts.map +1 -1
  279. package/dist/src/internal/nitro/routes/channel-dispatch.js +16 -45
  280. package/dist/src/internal/nitro/routes/channel-dispatch.js.map +1 -1
  281. package/dist/src/internal/nitro/routes/home-page/build-home-page-response.d.ts +88 -0
  282. package/dist/src/internal/nitro/routes/home-page/build-home-page-response.d.ts.map +1 -0
  283. package/dist/src/internal/nitro/routes/home-page/build-home-page-response.js +175 -0
  284. package/dist/src/internal/nitro/routes/home-page/build-home-page-response.js.map +1 -0
  285. package/dist/src/internal/nitro/routes/home.d.ts +7 -0
  286. package/dist/src/internal/nitro/routes/home.d.ts.map +1 -0
  287. package/dist/src/internal/nitro/routes/home.js +22 -0
  288. package/dist/src/internal/nitro/routes/home.js.map +1 -0
  289. package/dist/src/internal/nitro/routes/index.d.ts +3 -8
  290. package/dist/src/internal/nitro/routes/index.d.ts.map +1 -1
  291. package/dist/src/internal/nitro/routes/index.js +18 -36
  292. package/dist/src/internal/nitro/routes/index.js.map +1 -1
  293. package/dist/src/internal/nitro/routes/runtime-artifacts.d.ts +10 -3
  294. package/dist/src/internal/nitro/routes/runtime-artifacts.d.ts.map +1 -1
  295. package/dist/src/internal/nitro/routes/runtime-artifacts.js +2 -9
  296. package/dist/src/internal/nitro/routes/runtime-artifacts.js.map +1 -1
  297. package/dist/src/internal/nitro/routes/runtime-stack.d.ts +8 -7
  298. package/dist/src/internal/nitro/routes/runtime-stack.d.ts.map +1 -1
  299. package/dist/src/internal/nitro/routes/runtime-stack.js +10 -10
  300. package/dist/src/internal/nitro/routes/runtime-stack.js.map +1 -1
  301. package/dist/src/internal/nitro/routes/schedule-task.d.ts +7 -7
  302. package/dist/src/internal/nitro/routes/schedule-task.d.ts.map +1 -1
  303. package/dist/src/internal/nitro/routes/schedule-task.js +22 -30
  304. package/dist/src/internal/nitro/routes/schedule-task.js.map +1 -1
  305. package/dist/src/internal/nitro/routes/web-ui/assets/index.js +10 -0
  306. package/dist/src/internal/nitro/routes/web-ui/assets/style.css +2 -0
  307. package/dist/src/internal/nitro/routes/web-ui/index.html +17 -0
  308. package/dist/src/internal/nitro/routes/workflow-data.d.ts +32 -0
  309. package/dist/src/internal/nitro/routes/workflow-data.d.ts.map +1 -0
  310. package/dist/src/internal/nitro/routes/workflow-data.js +142 -0
  311. package/dist/src/internal/nitro/routes/workflow-data.js.map +1 -0
  312. package/dist/src/internal/nitro/routes/workflow-route-helpers.d.ts +46 -0
  313. package/dist/src/internal/nitro/routes/workflow-route-helpers.d.ts.map +1 -0
  314. package/dist/src/internal/nitro/routes/workflow-route-helpers.js +137 -0
  315. package/dist/src/internal/nitro/routes/workflow-route-helpers.js.map +1 -0
  316. package/dist/src/internal/nitro/routes/workflow-run-events.d.ts +14 -0
  317. package/dist/src/internal/nitro/routes/workflow-run-events.d.ts.map +1 -0
  318. package/dist/src/internal/nitro/routes/workflow-run-events.js +42 -0
  319. package/dist/src/internal/nitro/routes/workflow-run-events.js.map +1 -0
  320. package/dist/src/internal/nitro/routes/workflow-run-steps.d.ts +14 -0
  321. package/dist/src/internal/nitro/routes/workflow-run-steps.d.ts.map +1 -0
  322. package/dist/src/internal/nitro/routes/workflow-run-steps.js +42 -0
  323. package/dist/src/internal/nitro/routes/workflow-run-steps.js.map +1 -0
  324. package/dist/src/internal/nitro/routes/workflow-run.d.ts +13 -0
  325. package/dist/src/internal/nitro/routes/workflow-run.d.ts.map +1 -0
  326. package/dist/src/internal/nitro/routes/workflow-run.js +35 -0
  327. package/dist/src/internal/nitro/routes/workflow-run.js.map +1 -0
  328. package/dist/src/internal/nitro/routes/workflow-runs.d.ts +11 -0
  329. package/dist/src/internal/nitro/routes/workflow-runs.d.ts.map +1 -0
  330. package/dist/src/internal/nitro/routes/workflow-runs.js +29 -0
  331. package/dist/src/internal/nitro/routes/workflow-runs.js.map +1 -0
  332. package/dist/src/protocol/message.d.ts +160 -76
  333. package/dist/src/protocol/message.d.ts.map +1 -1
  334. package/dist/src/protocol/message.js +92 -36
  335. package/dist/src/protocol/message.js.map +1 -1
  336. package/dist/src/protocol/routes.d.ts +11 -3
  337. package/dist/src/protocol/routes.d.ts.map +1 -1
  338. package/dist/src/protocol/routes.js +12 -4
  339. package/dist/src/protocol/routes.js.map +1 -1
  340. package/dist/src/public/channels/auth.d.ts +32 -81
  341. package/dist/src/public/channels/auth.d.ts.map +1 -1
  342. package/dist/src/public/channels/auth.js +23 -86
  343. package/dist/src/public/channels/auth.js.map +1 -1
  344. package/dist/src/public/channels/http.d.ts +66 -26
  345. package/dist/src/public/channels/http.d.ts.map +1 -1
  346. package/dist/src/public/channels/http.js +88 -78
  347. package/dist/src/public/channels/http.js.map +1 -1
  348. package/dist/src/public/channels/index.d.ts +9 -10
  349. package/dist/src/public/channels/index.d.ts.map +1 -1
  350. package/dist/src/public/channels/index.js +9 -9
  351. package/dist/src/public/channels/index.js.map +1 -1
  352. package/dist/src/public/channels/slack/index.d.ts +104 -37
  353. package/dist/src/public/channels/slack/index.d.ts.map +1 -1
  354. package/dist/src/public/channels/slack/index.js +168 -47
  355. package/dist/src/public/channels/slack/index.js.map +1 -1
  356. package/dist/src/public/channels/slack/lowlevel.d.ts +5 -5
  357. package/dist/src/public/channels/slack/lowlevel.d.ts.map +1 -1
  358. package/dist/src/public/channels/slack/lowlevel.js +4 -4
  359. package/dist/src/public/channels/slack/lowlevel.js.map +1 -1
  360. package/dist/src/public/connections/index.d.ts +25 -0
  361. package/dist/src/public/connections/index.d.ts.map +1 -0
  362. package/dist/src/public/connections/index.js +24 -0
  363. package/dist/src/public/connections/index.js.map +1 -0
  364. package/dist/src/public/definitions/channel.d.ts +89 -60
  365. package/dist/src/public/definitions/channel.d.ts.map +1 -1
  366. package/dist/src/public/definitions/channel.js +42 -24
  367. package/dist/src/public/definitions/channel.js.map +1 -1
  368. package/dist/src/public/definitions/connections/mcp.d.ts +60 -0
  369. package/dist/src/public/definitions/connections/mcp.d.ts.map +1 -0
  370. package/dist/src/public/definitions/connections/mcp.js +7 -0
  371. package/dist/src/public/definitions/connections/mcp.js.map +1 -0
  372. package/dist/src/public/definitions/tool.d.ts +14 -7
  373. package/dist/src/public/definitions/tool.d.ts.map +1 -1
  374. package/dist/src/public/definitions/tool.js.map +1 -1
  375. package/dist/src/public/index.d.ts +10 -9
  376. package/dist/src/public/index.d.ts.map +1 -1
  377. package/dist/src/public/index.js +7 -6
  378. package/dist/src/public/index.js.map +1 -1
  379. package/dist/src/public/sandboxes/internal.d.ts +1 -1
  380. package/dist/src/public/sandboxes/internal.js +1 -1
  381. package/dist/src/public/tools/defaults.d.ts +6 -6
  382. package/dist/src/public/tools/defaults.d.ts.map +1 -1
  383. package/dist/src/public/tools/defaults.js +6 -6
  384. package/dist/src/public/tools/defaults.js.map +1 -1
  385. package/dist/src/public/tools/internal.d.ts +1 -1
  386. package/dist/src/public/tools/internal.js +1 -1
  387. package/dist/src/runtime/actions/types.d.ts +21 -18
  388. package/dist/src/runtime/actions/types.d.ts.map +1 -1
  389. package/dist/src/runtime/actions/types.js +22 -19
  390. package/dist/src/runtime/actions/types.js.map +1 -1
  391. package/dist/src/runtime/agent/bootstrap-model-utils.d.ts +37 -0
  392. package/dist/src/runtime/agent/bootstrap-model-utils.d.ts.map +1 -0
  393. package/dist/src/runtime/agent/bootstrap-model-utils.js +149 -0
  394. package/dist/src/runtime/agent/bootstrap-model-utils.js.map +1 -0
  395. package/dist/src/runtime/agent/bootstrap-model.d.ts.map +1 -1
  396. package/dist/src/runtime/agent/bootstrap-model.js +11 -80
  397. package/dist/src/runtime/agent/bootstrap-model.js.map +1 -1
  398. package/dist/src/runtime/agent/bootstrap.d.ts.map +1 -1
  399. package/dist/src/runtime/agent/bootstrap.js +4 -1
  400. package/dist/src/runtime/agent/bootstrap.js.map +1 -1
  401. package/dist/src/runtime/agent/mock-model-adapter.d.ts.map +1 -1
  402. package/dist/src/runtime/agent/mock-model-adapter.js +72 -134
  403. package/dist/src/runtime/agent/mock-model-adapter.js.map +1 -1
  404. package/dist/src/runtime/channels/registry.d.ts +21 -0
  405. package/dist/src/runtime/channels/registry.d.ts.map +1 -0
  406. package/dist/src/runtime/channels/registry.js +65 -0
  407. package/dist/src/runtime/channels/registry.js.map +1 -0
  408. package/dist/src/runtime/connections/mcp-client.d.ts +48 -0
  409. package/dist/src/runtime/connections/mcp-client.d.ts.map +1 -0
  410. package/dist/src/runtime/connections/mcp-client.js +182 -0
  411. package/dist/src/runtime/connections/mcp-client.js.map +1 -0
  412. package/dist/src/runtime/connections/registry.d.ts +33 -0
  413. package/dist/src/runtime/connections/registry.d.ts.map +1 -0
  414. package/dist/src/runtime/connections/registry.js +54 -0
  415. package/dist/src/runtime/connections/registry.js.map +1 -0
  416. package/dist/src/runtime/connections/types.d.ts +75 -0
  417. package/dist/src/runtime/connections/types.d.ts.map +1 -0
  418. package/dist/src/runtime/connections/types.js +9 -0
  419. package/dist/src/runtime/connections/types.js.map +1 -0
  420. package/dist/src/runtime/framework-channels/index.d.ts +6 -6
  421. package/dist/src/runtime/framework-channels/index.d.ts.map +1 -1
  422. package/dist/src/runtime/framework-channels/index.js +16 -14
  423. package/dist/src/runtime/framework-channels/index.js.map +1 -1
  424. package/dist/src/runtime/framework-tools/ask-question.js +4 -4
  425. package/dist/src/runtime/framework-tools/ask-question.js.map +1 -1
  426. package/dist/src/runtime/framework-tools/connection-execute.d.ts +10 -0
  427. package/dist/src/runtime/framework-tools/connection-execute.d.ts.map +1 -0
  428. package/dist/src/runtime/framework-tools/connection-execute.js +50 -0
  429. package/dist/src/runtime/framework-tools/connection-execute.js.map +1 -0
  430. package/dist/src/runtime/framework-tools/connection-search.d.ts +43 -0
  431. package/dist/src/runtime/framework-tools/connection-search.d.ts.map +1 -0
  432. package/dist/src/runtime/framework-tools/connection-search.js +135 -0
  433. package/dist/src/runtime/framework-tools/connection-search.js.map +1 -0
  434. package/dist/src/runtime/framework-tools/file-state.d.ts +5 -5
  435. package/dist/src/runtime/framework-tools/file-state.d.ts.map +1 -1
  436. package/dist/src/runtime/framework-tools/file-state.js +6 -8
  437. package/dist/src/runtime/framework-tools/file-state.js.map +1 -1
  438. package/dist/src/runtime/framework-tools/index.d.ts +3 -1
  439. package/dist/src/runtime/framework-tools/index.d.ts.map +1 -1
  440. package/dist/src/runtime/framework-tools/index.js +10 -1
  441. package/dist/src/runtime/framework-tools/index.js.map +1 -1
  442. package/dist/src/runtime/framework-tools/skill.d.ts +4 -4
  443. package/dist/src/runtime/framework-tools/skill.d.ts.map +1 -1
  444. package/dist/src/runtime/framework-tools/skill.js +14 -11
  445. package/dist/src/runtime/framework-tools/skill.js.map +1 -1
  446. package/dist/src/runtime/framework-tools/todo.d.ts.map +1 -1
  447. package/dist/src/runtime/framework-tools/todo.js +2 -4
  448. package/dist/src/runtime/framework-tools/todo.js.map +1 -1
  449. package/dist/src/runtime/input/types.d.ts +40 -115
  450. package/dist/src/runtime/input/types.d.ts.map +1 -1
  451. package/dist/src/runtime/input/types.js +28 -66
  452. package/dist/src/runtime/input/types.js.map +1 -1
  453. package/dist/src/runtime/loaders/module-map.js +8 -0
  454. package/dist/src/runtime/loaders/module-map.js.map +1 -1
  455. package/dist/src/runtime/prompt/compose.d.ts +4 -1
  456. package/dist/src/runtime/prompt/compose.d.ts.map +1 -1
  457. package/dist/src/runtime/prompt/compose.js +18 -1
  458. package/dist/src/runtime/prompt/compose.js.map +1 -1
  459. package/dist/src/runtime/prompt/connections.d.ts +10 -0
  460. package/dist/src/runtime/prompt/connections.d.ts.map +1 -0
  461. package/dist/src/runtime/prompt/connections.js +25 -0
  462. package/dist/src/runtime/prompt/connections.js.map +1 -0
  463. package/dist/src/runtime/resolve-agent-graph.d.ts.map +1 -1
  464. package/dist/src/runtime/resolve-agent-graph.js +29 -7
  465. package/dist/src/runtime/resolve-agent-graph.js.map +1 -1
  466. package/dist/src/runtime/resolve-agent.d.ts.map +1 -1
  467. package/dist/src/runtime/resolve-agent.js +3 -0
  468. package/dist/src/runtime/resolve-agent.js.map +1 -1
  469. package/dist/src/runtime/resolve-channel.d.ts.map +1 -1
  470. package/dist/src/runtime/resolve-channel.js +1 -0
  471. package/dist/src/runtime/resolve-channel.js.map +1 -1
  472. package/dist/src/runtime/resolve-connection.d.ts +16 -0
  473. package/dist/src/runtime/resolve-connection.d.ts.map +1 -0
  474. package/dist/src/runtime/resolve-connection.js +69 -0
  475. package/dist/src/runtime/resolve-connection.js.map +1 -0
  476. package/dist/src/runtime/resolve-tool.d.ts.map +1 -1
  477. package/dist/src/runtime/resolve-tool.js +8 -0
  478. package/dist/src/runtime/resolve-tool.js.map +1 -1
  479. package/dist/src/runtime/sessions/auth.d.ts +1 -1
  480. package/dist/src/runtime/sessions/compiled-agent-cache.d.ts +2 -0
  481. package/dist/src/runtime/sessions/compiled-agent-cache.d.ts.map +1 -1
  482. package/dist/src/runtime/sessions/compiled-agent-cache.js +14 -0
  483. package/dist/src/runtime/sessions/compiled-agent-cache.js.map +1 -1
  484. package/dist/src/runtime/skills/fragment-context.d.ts +2 -2
  485. package/dist/src/runtime/skills/fragment-context.d.ts.map +1 -1
  486. package/dist/src/runtime/skills/fragment-context.js +2 -2
  487. package/dist/src/runtime/skills/fragment-context.js.map +1 -1
  488. package/dist/src/runtime/standard-schema.d.ts +28 -0
  489. package/dist/src/runtime/standard-schema.d.ts.map +1 -0
  490. package/dist/src/runtime/standard-schema.js +65 -0
  491. package/dist/src/runtime/standard-schema.js.map +1 -0
  492. package/dist/src/runtime/types.d.ts +29 -3
  493. package/dist/src/runtime/types.d.ts.map +1 -1
  494. package/dist/src/services/dev-client/send-message.d.ts +2 -2
  495. package/dist/src/services/dev-client/send-message.d.ts.map +1 -1
  496. package/dist/src/services/dev-client/send-message.js +21 -22
  497. package/dist/src/services/dev-client/send-message.js.map +1 -1
  498. package/dist/src/services/dev-client/session.d.ts +5 -5
  499. package/dist/src/services/dev-client/session.d.ts.map +1 -1
  500. package/dist/src/services/dev-client/session.js +2 -2
  501. package/dist/src/services/dev-client/session.js.map +1 -1
  502. package/dist/src/services/dev-client.d.ts +6 -6
  503. package/dist/src/services/dev-client.d.ts.map +1 -1
  504. package/dist/src/services/dev-client.js +3 -3
  505. package/dist/src/services/dev-client.js.map +1 -1
  506. package/docs/external-agent-protocol.md +37 -34
  507. package/docs/internals/channels.md +15 -12
  508. package/docs/internals/context.md +81 -161
  509. package/docs/internals/message-runtime.md +28 -26
  510. package/docs/public/README.md +22 -20
  511. package/docs/public/auth-and-route-protection.md +15 -12
  512. package/docs/public/channels/README.md +16 -11
  513. package/docs/public/cli-build-and-debugging.md +1 -1
  514. package/docs/public/context-control.md +7 -3
  515. package/docs/public/evals.md +3 -3
  516. package/docs/public/getting-started.md +15 -12
  517. package/docs/public/human-in-the-loop.md +45 -57
  518. package/docs/public/migration-guide.md +71 -0
  519. package/docs/public/project-layout.md +5 -0
  520. package/docs/public/runs-and-streaming.md +32 -25
  521. package/docs/public/schedules.md +4 -4
  522. package/docs/public/session-context.md +131 -15
  523. package/docs/public/skills.md +27 -3
  524. package/docs/public/subagents.md +2 -2
  525. package/docs/public/tools.md +23 -30
  526. package/docs/public/typescript-api.md +16 -12
  527. package/docs/public/vercel-deployment.md +3 -4
  528. package/docs/public/workspace.md +11 -11
  529. package/package.json +18 -11
  530. package/dist/src/channel/emitter-registry.d.ts +0 -34
  531. package/dist/src/channel/emitter-registry.d.ts.map +0 -1
  532. package/dist/src/channel/emitter-registry.js +0 -63
  533. package/dist/src/channel/emitter-registry.js.map +0 -1
  534. package/dist/src/channel/http-emitter.d.ts +0 -16
  535. package/dist/src/channel/http-emitter.d.ts.map +0 -1
  536. package/dist/src/channel/http-emitter.js +0 -22
  537. package/dist/src/channel/http-emitter.js.map +0 -1
  538. package/dist/src/channel/schedule-emitter.d.ts +0 -15
  539. package/dist/src/channel/schedule-emitter.d.ts.map +0 -1
  540. package/dist/src/channel/schedule-emitter.js +0 -21
  541. package/dist/src/channel/schedule-emitter.js.map +0 -1
  542. package/dist/src/channel/slack-emitter.d.ts +0 -56
  543. package/dist/src/channel/slack-emitter.d.ts.map +0 -1
  544. package/dist/src/channel/slack-emitter.js +0 -235
  545. package/dist/src/channel/slack-emitter.js.map +0 -1
  546. package/dist/src/channel/subagent-emitter.d.ts +0 -41
  547. package/dist/src/channel/subagent-emitter.d.ts.map +0 -1
  548. package/dist/src/channel/subagent-emitter.js.map +0 -1
  549. package/dist/src/context/state.d.ts +0 -27
  550. package/dist/src/context/state.d.ts.map +0 -1
  551. package/dist/src/context/state.js +0 -53
  552. package/dist/src/context/state.js.map +0 -1
  553. package/dist/src/internal/message/nitro-route-shims.d.ts +0 -6
  554. package/dist/src/internal/message/nitro-route-shims.d.ts.map +0 -1
  555. package/dist/src/internal/message/nitro-route-shims.js +0 -38
  556. package/dist/src/internal/message/nitro-route-shims.js.map +0 -1
  557. package/dist/src/internal/message/rewrite-generated-imports.d.ts +0 -15
  558. package/dist/src/internal/message/rewrite-generated-imports.d.ts.map +0 -1
  559. package/dist/src/internal/message/rewrite-generated-imports.js +0 -59
  560. package/dist/src/internal/message/rewrite-generated-imports.js.map +0 -1
  561. package/dist/src/internal/nitro/host/channel-url-matcher.d.ts +0 -35
  562. package/dist/src/internal/nitro/host/channel-url-matcher.d.ts.map +0 -1
  563. package/dist/src/internal/nitro/host/channel-url-matcher.js +0 -57
  564. package/dist/src/internal/nitro/host/channel-url-matcher.js.map +0 -1
  565. package/dist/src/internal/nitro/routes/home-page/build-home-page-view-model.d.ts +0 -11
  566. package/dist/src/internal/nitro/routes/home-page/build-home-page-view-model.d.ts.map +0 -1
  567. package/dist/src/internal/nitro/routes/home-page/build-home-page-view-model.js +0 -264
  568. package/dist/src/internal/nitro/routes/home-page/build-home-page-view-model.js.map +0 -1
  569. package/dist/src/internal/nitro/routes/home-page/render-home-page.d.ts +0 -9
  570. package/dist/src/internal/nitro/routes/home-page/render-home-page.d.ts.map +0 -1
  571. package/dist/src/internal/nitro/routes/home-page/render-home-page.js +0 -15
  572. package/dist/src/internal/nitro/routes/home-page/render-home-page.js.map +0 -1
  573. package/dist/src/internal/nitro/routes/index.html +0 -525
  574. package/dist/src/internal/nitro/runtime-configuration.d.ts +0 -16
  575. package/dist/src/internal/nitro/runtime-configuration.d.ts.map +0 -1
  576. package/dist/src/internal/nitro/runtime-configuration.js +0 -23
  577. package/dist/src/internal/nitro/runtime-configuration.js.map +0 -1
  578. package/dist/src/internal/nitro/shims/runtime-configuration-plugin.d.ts +0 -10
  579. package/dist/src/internal/nitro/shims/runtime-configuration-plugin.d.ts.map +0 -1
  580. package/dist/src/internal/nitro/shims/runtime-configuration-plugin.js +0 -17
  581. package/dist/src/internal/nitro/shims/runtime-configuration-plugin.js.map +0 -1
  582. package/dist/src/runtime/tools/execute-tool.d.ts +0 -20
  583. package/dist/src/runtime/tools/execute-tool.d.ts.map +0 -1
  584. package/dist/src/runtime/tools/execute-tool.js +0 -69
  585. package/dist/src/runtime/tools/execute-tool.js.map +0 -1
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * Lower-level Slack channel primitives for users who write their own
3
- * `fetch` handler instead of using the {@link slackChannel} convenience
3
+ * `fetch` handler instead of using the {@link slackRoute} convenience
4
4
  * factory.
5
5
  *
6
6
  * Today this just re-exports the framework's default
7
- * {@link SlackChannelEmitter} so handcrafted Slack channels can still rely
7
+ * {@link SlackChannel} so handcrafted Slack routes can still rely
8
8
  * on the standard reply behavior. Future additions
9
9
  * (`verifySlackSignature`, `parseSlackEvent`, typed `SlackEvent` unions)
10
- * will live alongside the emitter and remain Ash-owned implementations
10
+ * will live alongside the channel and remain Ash-owned implementations
11
11
  * rather than re-exports of `@chat-adapter/slack` (CLAUDE.md item 8).
12
12
  */
13
- export { SlackChannelEmitter } from "../../../channel/slack-emitter.js";
13
+ export { SlackChannel } from "../../../channel/slack-channel.js";
14
14
  //# sourceMappingURL=lowlevel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lowlevel.js","sourceRoot":"","sources":["../../../../../src/public/channels/slack/lowlevel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC"}
1
+ {"version":3,"file":"lowlevel.js","sourceRoot":"","sources":["../../../../../src/public/channels/slack/lowlevel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Connection authoring helpers used inside `agent/connections/*.ts` files.
3
+ *
4
+ * This subpath collects everything related to authoring connections to
5
+ * external services via the Model Context Protocol (MCP).
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * // agent/connections/linear.ts
10
+ * import { defineMcpClientConnection } from "experimental-ash/connections";
11
+ *
12
+ * export default defineMcpClientConnection({
13
+ * url: "https://mcp.linear.app/mcp",
14
+ * description:
15
+ * "Linear issue tracking and project management. Tools can find, create, " +
16
+ * "and update issues, projects, comments, and teams.",
17
+ * authorization: {
18
+ * token: () => process.env.LINEAR_API_KEY!,
19
+ * },
20
+ * });
21
+ * ```
22
+ */
23
+ export type { AuthorizationDefinition, HeadersDefinition, ToolFilterDefinition, } from "../../runtime/connections/types.js";
24
+ export { defineMcpClientConnection, type McpAuthorizationDefinition, type McpClientConnectionDefinition, } from "../definitions/connections/mcp.js";
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/public/connections/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,YAAY,EACV,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,yBAAyB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,GACnC,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Connection authoring helpers used inside `agent/connections/*.ts` files.
3
+ *
4
+ * This subpath collects everything related to authoring connections to
5
+ * external services via the Model Context Protocol (MCP).
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * // agent/connections/linear.ts
10
+ * import { defineMcpClientConnection } from "experimental-ash/connections";
11
+ *
12
+ * export default defineMcpClientConnection({
13
+ * url: "https://mcp.linear.app/mcp",
14
+ * description:
15
+ * "Linear issue tracking and project management. Tools can find, create, " +
16
+ * "and update issues, projects, comments, and teams.",
17
+ * authorization: {
18
+ * token: () => process.env.LINEAR_API_KEY!,
19
+ * },
20
+ * });
21
+ * ```
22
+ */
23
+ export { defineMcpClientConnection, } from "../definitions/connections/mcp.js";
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/public/connections/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAOH,OAAO,EACL,yBAAyB,GAG1B,MAAM,mCAAmC,CAAC"}
@@ -1,67 +1,68 @@
1
- import type { DeliverInput, GetEventStreamOptions, RunHandle, RunInput } from "../../channel/types.js";
1
+ import { type ChannelClass, type DeliverInput, type GetEventStreamOptions, type RunHandle, type RunInput } from "../../channel/types.js";
2
2
  import type { HandleMessageStreamEvent } from "../../protocol/message.js";
3
3
  export type { GetEventStreamOptions } from "../../channel/types.js";
4
4
  /**
5
- * HTTP method a channel handles. Defaults to `"POST"` — almost every channel
6
- * is a webhook. Override only when authoring a non-webhook channel such as a
5
+ * HTTP method a route handles. Defaults to `"POST"` — almost every route
6
+ * is a webhook. Override only when authoring a non-webhook route such as a
7
7
  * long-poll endpoint or an event-stream reader.
8
8
  */
9
9
  export type ChannelMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
10
10
  /**
11
- * Per-request surface exposed to a channel's `fetch` handler. The
11
+ * Per-request surface exposed to a route's `fetch` handler. The
12
12
  * framework constructs this per request and passes it as the second
13
13
  * argument.
14
14
  *
15
- * Channels call into the agent to start new sessions (`agent.run`),
15
+ * Routes call into the agent to start new sessions (`agent.run`),
16
16
  * deliver follow-up messages to existing sessions (`agent.deliver`), or
17
- * read events from a previously-started run (`agent.getEventStream`).
17
+ * read events from a previously-started session (`agent.getEventStream`).
18
18
  */
19
- export interface ChannelContext {
19
+ export interface RouteContext {
20
20
  /**
21
- * Handle to the agent that this channel routes inbound requests to.
22
- * Conceptually the runtime + harness combined: channels call `run`,
21
+ * Handle to the agent that this route sends inbound requests to.
22
+ * Conceptually the runtime + harness combined: routes call `run`,
23
23
  * `deliver`, and `getEventStream` to drive sessions of this agent
24
24
  * without knowing about the workflow runtime, the harness, or any
25
25
  * other execution-layer detail.
26
26
  *
27
- * Every channel speaks the same `RunInput` shape regardless of which
27
+ * Every route speaks the same `RunInput` shape regardless of which
28
28
  * webhook it serves — `agent` is platform-agnostic.
29
29
  */
30
30
  readonly agent: Agent;
31
31
  /**
32
32
  * Hands a background promise to the request host so the serverless
33
33
  * invocation stays alive until the promise resolves. Use this when the
34
- * channel responds to the platform immediately (e.g. a Slack `200 OK`
34
+ * route responds to the platform immediately (e.g. a Slack `200 OK`
35
35
  * acknowledgement) but still needs to drive an `agent.run()` call to
36
36
  * completion.
37
37
  */
38
38
  readonly waitUntil: (task: Promise<unknown>) => void;
39
39
  /**
40
- * Path parameter values extracted from `[name]` segments in the channel's
41
- * filesystem path. For `agent/channels/runs/[runId]/stream.ts` mounted at
42
- * `GET /runs/:runId/stream`, the matched value lives at `params.runId`.
43
- * Empty for channels with no path parameters.
40
+ * Path parameter values extracted from `[name]` segments in the route's
41
+ * filesystem path. For `agent/channels/sessions/[sessionId]/stream.ts`
42
+ * mounted at `GET /sessions/:sessionId/stream`, the matched value lives at
43
+ * `params.sessionId`.
44
+ * Empty for routes with no path parameters.
44
45
  */
45
46
  readonly params: Readonly<Record<string, string>>;
46
47
  /**
47
48
  * Trusted peer IP for this request, extracted by the host transport
48
- * before the channel handler runs. `null` when the host can't observe a
49
- * peer address (e.g. unit tests calling `channel.fetch` directly).
49
+ * before the route handler runs. `null` when the host can't observe a
50
+ * peer address (e.g. unit tests calling `route.fetch` directly).
50
51
  *
51
52
  * Pass this to {@link isIpAllowed} from `experimental-ash/channels/auth`
52
- * when implementing IP allowlisting in a channel.
53
+ * when implementing IP allowlisting in a route.
53
54
  */
54
55
  readonly requestIp: string | null;
55
56
  }
56
57
  /**
57
- * Channel-facing handle to the agent that owns this request.
58
+ * Route-facing handle to the agent that owns this request.
58
59
  *
59
60
  * `Agent` is conceptually the workflow runtime plus the tool-loop harness:
60
- * channels call `run` to start a new session of the agent, `deliver` to
61
+ * routes call `run` to start a new session of the agent, `deliver` to
61
62
  * send a follow-up to a parked session, and `getEventStream` to read events
62
- * from a previously-started run. The framework's internal `Runtime`
63
+ * from a previously-started session. The framework's internal `Runtime`
63
64
  * interface (in `channel/types.ts`) is the underlying primitive — `Agent`
64
- * is the *public* shape exposed on `ChannelContext` so channel authors
65
+ * is the *public* shape exposed on `RouteContext` so route authors
65
66
  * speak in terms of the agent rather than the runtime.
66
67
  */
67
68
  export interface Agent {
@@ -74,24 +75,24 @@ export interface Agent {
74
75
  /**
75
76
  * Sends a follow-up message to a session that is currently parked waiting
76
77
  * for input. Throws if no parked session exists for the supplied
77
- * `continuationToken` — channels typically catch the failure and fall back
78
+ * `continuationToken` — routes typically catch the failure and fall back
78
79
  * to `run()` to start a new session.
79
80
  */
80
81
  deliver(input: DeliverInput): Promise<void>;
81
82
  /**
82
83
  * Returns a readable NDJSON-style stream of lifecycle events for an
83
- * existing run. Used by the framework's HTTP run-stream channel and by
84
- * any user-authored channel that exposes an event-streaming endpoint.
84
+ * existing session. Used by the framework's HTTP session-stream route and by
85
+ * any user-authored route that exposes an event-streaming endpoint.
85
86
  *
86
87
  * Pass `options.startIndex` to skip events the caller has already
87
- * consumed — the framework HTTP run-stream channel uses this to forward
88
+ * consumed — the framework HTTP session-stream route uses this to forward
88
89
  * the `startIndex` query parameter so reconnecting clients resume from
89
- * the next unread event instead of replaying the run from the start.
90
+ * the next unread event instead of replaying the session from the start.
90
91
  */
91
- getEventStream(runId: string, options?: GetEventStreamOptions): Promise<ReadableStream<HandleMessageStreamEvent>>;
92
+ getEventStream(sessionId: string, options?: GetEventStreamOptions): Promise<ReadableStream<HandleMessageStreamEvent>>;
92
93
  }
93
94
  /**
94
- * Public authored channel definition. A channel is a Web-standard
95
+ * Public authored route definition. A route is a Web-standard
95
96
  * `(Request, ctx) => Response` handler whose URL path is derived from the
96
97
  * file's location under `agent/channels/`.
97
98
  *
@@ -99,14 +100,32 @@ export interface Agent {
99
100
  * Nested directories produce nested URL segments
100
101
  * (`agent/channels/api/inbound.ts` → `POST /api/inbound`). Path parameters
101
102
  * use the Nitro `[name]` convention
102
- * (`agent/channels/runs/[runId]/stream.ts` → `GET /runs/:runId/stream`).
103
+ * (`agent/channels/sessions/[sessionId]/stream.ts` → `GET /sessions/:sessionId/stream`).
103
104
  *
104
105
  * @example
105
106
  * ```ts
106
107
  * // agent/channels/slack.ts → POST /slack
107
- * import { defineChannel } from "experimental-ash";
108
+ * import { Channel, defineRoute } from "experimental-ash";
108
109
  *
109
- * export default defineChannel({
110
+ * class MyChannel extends Channel {
111
+ * static kind = "my-channel";
112
+ *
113
+ * constructor(state = {}) {
114
+ * super();
115
+ * }
116
+ * async onEvent(event) {
117
+ * return event;
118
+ * }
119
+ * async onDeliver(_ctx, payload) {
120
+ * return payload;
121
+ * }
122
+ * serialize() {
123
+ * return {};
124
+ * }
125
+ * }
126
+ *
127
+ * export default defineRoute({
128
+ * serializableChannels: [MyChannel],
110
129
  * async fetch(request, { agent, waitUntil }) {
111
130
  * const body = await request.json();
112
131
  * waitUntil(
@@ -115,7 +134,7 @@ export interface Agent {
115
134
  * input: { message: body.text },
116
135
  * mode: "conversation",
117
136
  * sessionId: crypto.randomUUID(),
118
- * channelEmitter: new MyEmitter(),
137
+ * channel: new MyChannel(),
119
138
  * }).then((handle) => handle.result),
120
139
  * );
121
140
  * return new Response("ok");
@@ -123,27 +142,37 @@ export interface Agent {
123
142
  * });
124
143
  * ```
125
144
  */
126
- export interface Channel {
145
+ export interface Route {
127
146
  /**
128
- * HTTP method this channel handles. Optional — defaults to `"POST"`.
147
+ * HTTP method this route handles. Optional — defaults to `"POST"`.
129
148
  */
130
149
  readonly method?: ChannelMethod;
150
+ /**
151
+ * Optional set of serializable channel classes this route may persist on a
152
+ * session it starts.
153
+ *
154
+ * Declare custom channel classes here so the runtime can rehydrate them
155
+ * after workflow step boundaries without relying on import-time global
156
+ * registration. Entries must extend {@link Channel}. Framework-built
157
+ * channels are already known to the runtime and do not need to be listed.
158
+ */
159
+ readonly serializableChannels?: readonly ChannelClass[];
131
160
  /**
132
161
  * The request handler. Receives the inbound `Request` and a
133
- * {@link ChannelContext} carrying the agent handle and host helpers.
162
+ * {@link RouteContext} carrying the agent handle and host helpers.
134
163
  */
135
- fetch(request: Request, ctx: ChannelContext): Promise<Response>;
164
+ fetch(request: Request, ctx: RouteContext): Promise<Response>;
136
165
  }
137
166
  /**
138
- * Defines an authored Ash channel. Validates the shape and returns the
167
+ * Defines an authored Ash route. Validates the shape and returns the
139
168
  * definition unchanged so the value can be exported as the file's default.
140
169
  *
141
170
  * @example
142
171
  * ```ts
143
172
  * // agent/channels/healthz.ts → GET /healthz
144
- * import { defineChannel } from "experimental-ash";
173
+ * import { defineRoute } from "experimental-ash";
145
174
  *
146
- * export default defineChannel({
175
+ * export default defineRoute({
147
176
  * method: "GET",
148
177
  * async fetch() {
149
178
  * return new Response("ok");
@@ -151,48 +180,48 @@ export interface Channel {
151
180
  * });
152
181
  * ```
153
182
  */
154
- export declare function defineChannel(channel: Channel): Channel;
183
+ export declare function defineRoute(route: Route): Route;
155
184
  /**
156
- * Marker discriminator written into every {@link DisabledChannelSentinel}.
185
+ * Marker discriminator written into every {@link DisabledRouteSentinel}.
157
186
  */
158
- export declare const DISABLED_CHANNEL_SENTINEL_KIND = "ash:disabled-channel";
187
+ export declare const DISABLED_ROUTE_SENTINEL_KIND = "ash:disabled-channel";
159
188
  /**
160
- * Marker value returned from {@link disableChannel}. Export this as the
189
+ * Marker value returned from {@link disableRoute}. Export this as the
161
190
  * default export of a file in `agent/channels/` to remove the framework
162
- * default channel whose logical name matches the file's slug path.
191
+ * default route whose logical name matches the file's slug path.
163
192
  */
164
- export interface DisabledChannelSentinel {
165
- readonly kind: typeof DISABLED_CHANNEL_SENTINEL_KIND;
193
+ export interface DisabledRouteSentinel {
194
+ readonly kind: typeof DISABLED_ROUTE_SENTINEL_KIND;
166
195
  }
167
196
  /**
168
- * Returns a sentinel that disables the framework channel whose logical name
197
+ * Returns a sentinel that disables the framework route whose logical name
169
198
  * matches the containing file's slug path.
170
199
  *
171
200
  * Export the result as the default export of a file in `agent/channels/`.
172
- * The compiler reads the filename to determine which framework channel the
201
+ * The compiler reads the filename to determine which framework route the
173
202
  * sentinel targets — there is no name argument because the file *is* the
174
203
  * name. It is an error to place this in a file whose slug does not match a
175
- * known framework channel name.
204
+ * known framework route name.
176
205
  *
177
206
  * @example
178
207
  * ```ts
179
208
  * // apps/my-agent/agent/channels/.well-known/ash/v1/message.ts
180
- * import { disableChannel } from "experimental-ash";
209
+ * import { disableRoute } from "experimental-ash";
181
210
  *
182
- * export default disableChannel();
211
+ * export default disableRoute();
183
212
  * ```
184
213
  */
185
- export declare function disableChannel(): DisabledChannelSentinel;
214
+ export declare function disableRoute(): DisabledRouteSentinel;
186
215
  /**
187
- * Type guard: returns whether `value` is a {@link DisabledChannelSentinel}
188
- * produced by {@link disableChannel}.
216
+ * Type guard: returns whether `value` is a {@link DisabledRouteSentinel}
217
+ * produced by {@link disableRoute}.
189
218
  */
190
- export declare function isDisabledChannelSentinel(value: unknown): value is DisabledChannelSentinel;
219
+ export declare function isDisabledRouteSentinel(value: unknown): value is DisabledRouteSentinel;
191
220
  /**
192
- * Type guard: returns whether `value` looks like a {@link Channel}.
221
+ * Type guard: returns whether `value` looks like a {@link Route}.
193
222
  *
194
- * Used by the compiler to distinguish authored `Channel` exports from
195
- * `DisabledChannelSentinel` exports.
223
+ * Used by the compiler to distinguish authored `Route` exports from
224
+ * `DisabledRouteSentinel` exports.
196
225
  */
197
- export declare function isChannelDefinition(value: unknown): value is Channel;
226
+ export declare function isRouteDefinition(value: unknown): value is Route;
198
227
  //# sourceMappingURL=channel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../../../src/public/definitions/channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACrB,SAAS,EACT,QAAQ,EACT,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE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F;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAMhE"}
@@ -1,13 +1,14 @@
1
+ import { CHANNEL_CLASS_BRAND, CHANNEL_PROTOTYPE_BRAND, Channel, } from "../../channel/types.js";
1
2
  /**
2
- * Defines an authored Ash channel. Validates the shape and returns the
3
+ * Defines an authored Ash route. Validates the shape and returns the
3
4
  * definition unchanged so the value can be exported as the file's default.
4
5
  *
5
6
  * @example
6
7
  * ```ts
7
8
  * // agent/channels/healthz.ts → GET /healthz
8
- * import { defineChannel } from "experimental-ash";
9
+ * import { defineRoute } from "experimental-ash";
9
10
  *
10
- * export default defineChannel({
11
+ * export default defineRoute({
11
12
  * method: "GET",
12
13
  * async fetch() {
13
14
  * return new Response("ok");
@@ -15,55 +16,72 @@
15
16
  * });
16
17
  * ```
17
18
  */
18
- export function defineChannel(channel) {
19
- if (typeof channel.fetch !== "function") {
20
- throw new TypeError("defineChannel: `fetch` must be a function.");
19
+ export function defineRoute(route) {
20
+ if (typeof route.fetch !== "function") {
21
+ throw new TypeError("defineRoute: `fetch` must be a function.");
21
22
  }
22
- return channel;
23
+ if (route.serializableChannels !== undefined) {
24
+ if (!Array.isArray(route.serializableChannels)) {
25
+ throw new TypeError("defineRoute: `serializableChannels` must be an array when provided.");
26
+ }
27
+ for (const channelClass of route.serializableChannels) {
28
+ if (typeof channelClass !== "function") {
29
+ throw new TypeError("defineRoute: each `serializableChannels` entry must be a channel class.");
30
+ }
31
+ if (channelClass[CHANNEL_CLASS_BRAND] !== true ||
32
+ channelClass.prototype[CHANNEL_PROTOTYPE_BRAND] !== true) {
33
+ throw new TypeError("defineRoute: each `serializableChannels` entry must extend `Channel`.");
34
+ }
35
+ if (typeof channelClass.kind !== "string" || channelClass.kind.length === 0) {
36
+ throw new TypeError("defineRoute: each `serializableChannels` entry must declare a non-empty static `kind` field.");
37
+ }
38
+ }
39
+ }
40
+ return route;
23
41
  }
24
42
  /**
25
- * Marker discriminator written into every {@link DisabledChannelSentinel}.
43
+ * Marker discriminator written into every {@link DisabledRouteSentinel}.
26
44
  */
27
- export const DISABLED_CHANNEL_SENTINEL_KIND = "ash:disabled-channel";
45
+ export const DISABLED_ROUTE_SENTINEL_KIND = "ash:disabled-channel";
28
46
  /**
29
- * Returns a sentinel that disables the framework channel whose logical name
47
+ * Returns a sentinel that disables the framework route whose logical name
30
48
  * matches the containing file's slug path.
31
49
  *
32
50
  * Export the result as the default export of a file in `agent/channels/`.
33
- * The compiler reads the filename to determine which framework channel the
51
+ * The compiler reads the filename to determine which framework route the
34
52
  * sentinel targets — there is no name argument because the file *is* the
35
53
  * name. It is an error to place this in a file whose slug does not match a
36
- * known framework channel name.
54
+ * known framework route name.
37
55
  *
38
56
  * @example
39
57
  * ```ts
40
58
  * // apps/my-agent/agent/channels/.well-known/ash/v1/message.ts
41
- * import { disableChannel } from "experimental-ash";
59
+ * import { disableRoute } from "experimental-ash";
42
60
  *
43
- * export default disableChannel();
61
+ * export default disableRoute();
44
62
  * ```
45
63
  */
46
- export function disableChannel() {
64
+ export function disableRoute() {
47
65
  return {
48
- kind: DISABLED_CHANNEL_SENTINEL_KIND,
66
+ kind: DISABLED_ROUTE_SENTINEL_KIND,
49
67
  };
50
68
  }
51
69
  /**
52
- * Type guard: returns whether `value` is a {@link DisabledChannelSentinel}
53
- * produced by {@link disableChannel}.
70
+ * Type guard: returns whether `value` is a {@link DisabledRouteSentinel}
71
+ * produced by {@link disableRoute}.
54
72
  */
55
- export function isDisabledChannelSentinel(value) {
73
+ export function isDisabledRouteSentinel(value) {
56
74
  return (typeof value === "object" &&
57
75
  value !== null &&
58
- value.kind === DISABLED_CHANNEL_SENTINEL_KIND);
76
+ value.kind === DISABLED_ROUTE_SENTINEL_KIND);
59
77
  }
60
78
  /**
61
- * Type guard: returns whether `value` looks like a {@link Channel}.
79
+ * Type guard: returns whether `value` looks like a {@link Route}.
62
80
  *
63
- * Used by the compiler to distinguish authored `Channel` exports from
64
- * `DisabledChannelSentinel` exports.
81
+ * Used by the compiler to distinguish authored `Route` exports from
82
+ * `DisabledRouteSentinel` exports.
65
83
  */
66
- export function isChannelDefinition(value) {
84
+ export function isRouteDefinition(value) {
67
85
  return (typeof value === "object" &&
68
86
  value !== null &&
69
87
  typeof value.fetch === "function");
@@ -1 +1 @@
1
- {"version":3,"file":"channel.js","sourceRoot":"","sources":["../../../../src/public/definitions/channel.ts"],"names":[],"mappings":"AAsJA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;QACxC,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,sBAAsB,CAAC;AAWrE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,IAAI,EAAE,8BAA8B;KACrC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAc;IACtD,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAA4B,CAAC,IAAI,KAAK,8BAA8B,CACtE,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAQ,KAA6B,CAAC,KAAK,KAAK,UAAU,CAC3D,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"channel.js","sourceRoot":"","sources":["../../../../src/public/definitions/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,OAAO,GAMR,MAAM,wBAAwB,CAAC;AA8Kh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AK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAA4B,CAAC,IAAI,KAAK,4BAA4B,CACpE,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAQ,KAA6B,CAAC,KAAK,KAAK,UAAU,CAC3D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,60 @@
1
+ import type { AuthorizationDefinition, HeadersDefinition, ToolFilterDefinition } from "../../../runtime/connections/types.js";
2
+ /**
3
+ * Re-export `AuthorizationDefinition` under the MCP-specific alias for
4
+ * backwards compatibility. New code should prefer `AuthorizationDefinition`.
5
+ */
6
+ export type McpAuthorizationDefinition = AuthorizationDefinition;
7
+ /**
8
+ * Public definition for an MCP client connection authored in
9
+ * `connections/*.ts`.
10
+ *
11
+ * The connection's runtime name is derived from its filename (the slug
12
+ * under `agent/connections/`, without the extension). A connection
13
+ * authored at `agent/connections/linear.ts` is registered as `"linear"`.
14
+ *
15
+ * Both `authorization` and `headers` are optional — omit both for
16
+ * servers that require no authentication (e.g. localhost).
17
+ */
18
+ export interface McpClientConnectionDefinition {
19
+ /**
20
+ * The MCP server's HTTP endpoint URL.
21
+ *
22
+ * Must support Streamable HTTP or SSE transport.
23
+ */
24
+ url: string;
25
+ /**
26
+ * Human-readable summary of the connection and the tools it provides.
27
+ *
28
+ * Used in the system prompt layer to describe the connection to the model,
29
+ * and in `connection_search` results so the model can choose which
30
+ * connection to query.
31
+ */
32
+ description: string;
33
+ /**
34
+ * Bearer token credentials for the MCP server. The `token` field is
35
+ * sent as `Authorization: Bearer <token>`.
36
+ *
37
+ * Optional when `headers` is provided for non-Bearer auth schemes.
38
+ */
39
+ authorization?: AuthorizationDefinition;
40
+ /**
41
+ * Arbitrary HTTP headers sent with every request to the MCP server.
42
+ *
43
+ * Use for non-Bearer auth (e.g. API key headers) or server-level
44
+ * configuration headers. Can be combined with `authorization`.
45
+ */
46
+ headers?: HeadersDefinition;
47
+ /**
48
+ * Client-side tool filter. When set, only tools whose names pass
49
+ * the filter are surfaced to the model. All other tools are silently
50
+ * excluded from `connection_search` and `connection_execute`.
51
+ *
52
+ * Specify exactly one of `allow` or `block`.
53
+ */
54
+ tools?: ToolFilterDefinition;
55
+ }
56
+ /**
57
+ * Defines an MCP client connection.
58
+ */
59
+ export declare function defineMcpClientConnection(definition: McpClientConnectionDefinition): McpClientConnectionDefinition;
60
+ //# sourceMappingURL=mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../../../src/public/definitions/connections/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,uCAAuC,CAAC;AAE/C;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG,uBAAuB,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,6BAA6B;IAC5C;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAC9B;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,6BAA6B,GACxC,6BAA6B,CAE/B"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Defines an MCP client connection.
3
+ */
4
+ export function defineMcpClientConnection(definition) {
5
+ return definition;
6
+ }
7
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../../../../src/public/definitions/connections/mcp.ts"],"names":[],"mappings":"AA8DA;;GAEG;AACH,MAAM,UAAU,yBAAyB,CACvC,UAAyC;IAEzC,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -19,13 +19,12 @@ export interface CompactionHookInput {
19
19
  * Result returned by a tool's {@link ToolDefinition.onCompact} hook.
20
20
  *
21
21
  * `messages` are appended to the compacted history in tool registration
22
- * order. `sessionPatch` is shallow-merged into `session.state`; later
23
- * tools overwrite earlier on key collision. Either or both may be
24
- * omitted; returning `void` is equivalent to returning `{}`.
22
+ * order. Hooks should mutate durable context directly through {@link ctx}
23
+ * when they need to preserve or reset context values. Returning `void` is
24
+ * equivalent to returning `{}`.
25
25
  */
26
26
  export interface CompactionHookResult {
27
27
  readonly messages?: readonly ModelMessage[];
28
- readonly sessionPatch?: Readonly<Record<string, unknown>>;
29
28
  }
30
29
  /**
31
30
  * Context passed to a tool's {@link ToolDefinition.needsApproval} function.
@@ -51,7 +50,15 @@ export interface NeedsApprovalContext {
51
50
  */
52
51
  export interface ToolDefinition<TInput = unknown, TResult = unknown> {
53
52
  description: string;
54
- inputSchema?: StandardJSONSchemaV1<TInput>;
53
+ /**
54
+ * Model-visible input schema for this tool.
55
+ *
56
+ * When the schema also exposes the Standard Schema `validate()` hook
57
+ * (for example a Zod schema), Ash validates raw tool-call arguments at
58
+ * runtime and passes the parsed/defaulted output into {@link execute}.
59
+ * Plain JSON Schema objects remain supported for declaration-only use.
60
+ */
61
+ inputSchema?: StandardJSONSchemaV1<unknown, TInput>;
55
62
  execute(input: TInput): Promise<TResult> | TResult;
56
63
  /**
57
64
  * Optional per-tool approval gate. When set, the function's return value
@@ -85,11 +92,11 @@ export interface ToolDefinition<TInput = unknown, TResult = unknown> {
85
92
  export declare function defineTool<TSchema extends StandardJSONSchemaV1<unknown, unknown>, TResult>(definition: {
86
93
  description: string;
87
94
  inputSchema: TSchema;
88
- execute(input: StandardJSONSchemaV1.InferInput<TSchema>): Promise<TResult> | TResult;
95
+ execute(input: StandardJSONSchemaV1.InferOutput<TSchema>): Promise<TResult> | TResult;
89
96
  needsApproval?: (ctx: NeedsApprovalContext) => boolean;
90
97
  name?: string;
91
98
  onCompact?(input: CompactionHookInput): CompactionHookResult | Promise<CompactionHookResult> | void | Promise<void>;
92
- }): ToolDefinition<StandardJSONSchemaV1.InferInput<TSchema>, TResult>;
99
+ }): ToolDefinition<StandardJSONSchemaV1.InferOutput<TSchema>, TResult>;
93
100
  export declare function defineTool<TInput = unknown, TResult = unknown>(definition: ToolDefinition<TInput, TResult>): ToolDefinition<TInput, TResult>;
94
101
  /**
95
102
  * Marker discriminator written into every {@link DisabledToolSentinel}.
@@ -1 +1 @@
1
- {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../../src/public/definitions/tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAC5C,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC3D;AAED;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM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