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,6 +1,14 @@
1
+ import type { ContextStoreKey } from "../context/key.js";
2
+ import type { StepInput } from "../harness/types.js";
1
3
  import type { HandleMessageStreamEvent } from "../protocol/message.js";
2
4
  import type { RunMode } from "../run-mode.js";
3
- import type { RuntimeInputRequest, RuntimeInputResult } from "../runtime/input/types.js";
5
+ import type { InputResponse } from "../runtime/input/types.js";
6
+ /**
7
+ * Global symbol brand used to recognize Ash channel classes across
8
+ * independently-loaded copies of the package during compile/runtime tests.
9
+ */
10
+ export declare const CHANNEL_CLASS_BRAND: unique symbol;
11
+ export declare const CHANNEL_PROTOTYPE_BRAND: unique symbol;
4
12
  /**
5
13
  * Identifies one turn within a session.
6
14
  */
@@ -13,16 +21,15 @@ export interface SessionTurn {
13
21
  * delegated the current session.
14
22
  */
15
23
  export interface SessionParent {
16
- readonly runId: string;
17
24
  readonly sessionId: string;
18
25
  readonly turn: SessionTurn;
19
26
  }
20
27
  /**
21
28
  * Authenticated caller principal attached to a request.
22
29
  *
23
- * Produced by the route-level auth strategies (JWT, OIDC, HTTP Basic, etc.)
24
- * and threaded through the channel into the runtime context via the
25
- * `AuthKey` seed on the {@link AshContext} handed to {@link Runtime.run}.
30
+ * Produced by route-level auth strategies (JWT, OIDC, HTTP Basic, etc.)
31
+ * and passed to the runtime on {@link RunInput.auth} and
32
+ * {@link DeliverInput.auth}.
26
33
  */
27
34
  export interface SessionAuthContext {
28
35
  readonly attributes: Readonly<Record<string, string | readonly string[]>>;
@@ -32,121 +39,183 @@ export interface SessionAuthContext {
32
39
  readonly principalType: string;
33
40
  readonly subject?: string;
34
41
  }
42
+ /**
43
+ * Narrow accessor passed to {@link Channel.onDeliver} callbacks. Exposes only
44
+ * typed context operations — keeps channel code workflow-agnostic and
45
+ * prevents channels from depending on {@link AshContext} internals such as
46
+ * `entries()`.
47
+ */
48
+ export interface ContextAccessor {
49
+ get<T>(key: ContextStoreKey<T>): T;
50
+ tryGet<T>(key: ContextStoreKey<T>): T | undefined;
51
+ has<T>(key: ContextStoreKey<T>): boolean;
52
+ set<T>(key: ContextStoreKey<T>, value: T): void;
53
+ ensure<T>(key: ContextStoreKey<T>, valueOrFactory: T | (() => T)): T;
54
+ }
35
55
  /**
36
56
  * Function provided by the runtime that writes one event to the event stream.
37
57
  *
38
58
  * Backed by `getWritable()` in the workflow runtime or a `TransformStream`
39
- * in the continuous loop runtime.
59
+ * in the continuous loop runtime. Not part of the {@link Channel} interface —
60
+ * the runtime always writes events to the stream itself.
40
61
  */
41
62
  export type EventEmitFn = (event: HandleMessageStreamEvent) => Promise<void>;
42
63
  /**
43
- * Channel-owned emitter invoked by the runtime for each event during step
44
- * execution.
64
+ * Raw payload from a channel deliver call.
65
+ *
66
+ * For interactive channels (Slack button callbacks, HTTP clients), the
67
+ * payload may carry structured {@link InputResponse} objects alongside
68
+ * or instead of a text message. For text-only channels (Slack thread
69
+ * replies), only `message` is set.
70
+ */
71
+ export interface DeliverPayload {
72
+ readonly inputResponses?: readonly InputResponse[];
73
+ readonly message?: string;
74
+ }
75
+ /**
76
+ * Serializable payload sent through the workflow `resumeHook` on deliver.
45
77
  *
46
- * The emitter receives the event and an `emit` function. Calling `emit`
47
- * writes the event to the runtime's event stream. The emitter may also
48
- * perform platform-specific side effects (e.g. posting a Slack thread reply)
49
- * or rewrite the event before writing it (e.g. wrapping every child event
50
- * in a `subagent.event` envelope, as {@link SubagentChannelEmitter} does).
78
+ * Wraps the raw {@link DeliverPayload} together with an optional auth
79
+ * update so deliver-time auth can cross the durable hook boundary
80
+ * without a process-local side-channel.
81
+ */
82
+ export interface HookPayload {
83
+ readonly auth?: SessionAuthContext | null;
84
+ readonly payload: DeliverPayload;
85
+ }
86
+ /**
87
+ * Serializable conduit that owns the full lifecycle of one platform
88
+ * integration.
89
+ *
90
+ * A channel carries auth, renders outbound events to the platform,
91
+ * transforms inbound deliver payloads, and optionally sets custom
92
+ * context keys. It is serialized across workflow step boundaries via
93
+ * {@link serialize} plus constructor-based rehydration performed by the
94
+ * runtime-owned channel registry.
51
95
  *
52
- * Each emitter implementation owns its own serialization across workflow
53
- * step boundaries via {@link serialize} and {@link ChannelEmitterClass.deserialize}.
54
- * The framework's `ChannelEmitterKey` codec calls these methods through a
55
- * process-global registry keyed by `kind` the registry is populated when
56
- * an emitter module is imported and calls `registerChannelEmitter`.
96
+ * Channels are class-based durable values. Authors define a concrete
97
+ * subclass, declare a unique static `kind`, and pass an instance on
98
+ * {@link RunInput.channel}. The runtime invokes {@link onEvent} /
99
+ * {@link onDeliver} during the step loop. Auth is separate from the
100
+ * channel it lives on {@link RunInput.auth} and
101
+ * {@link DeliverInput.auth}.
57
102
  */
58
- export interface ChannelEmitter {
103
+ export declare abstract class Channel {
59
104
  /**
60
- * Stable identifier for this emitter class. Must match the `kind` static
61
- * field on the corresponding {@link ChannelEmitterClass}.
105
+ * Runtime marker inherited by every channel subclass constructor.
106
+ * Used by route-definition validation without relying on `instanceof`
107
+ * across multiple loaded copies of the package.
62
108
  */
63
- readonly kind: string;
109
+ static readonly [CHANNEL_CLASS_BRAND] = true;
110
+ /**
111
+ * Runtime marker inherited by every channel subclass prototype.
112
+ * Route-definition validation reads this through the subclass prototype
113
+ * chain so authored channels from another loaded package copy still
114
+ * register correctly.
115
+ */
116
+ protected get [CHANNEL_PROTOTYPE_BRAND](): true;
64
117
  /**
65
- * Called by the runtime for every lifecycle event. Implementations must
66
- * call `emit(event)` to forward the event to the runtime stream and may
67
- * additionally perform platform-specific side effects.
118
+ * Nominal marker that prevents plain object literals from satisfying
119
+ * the channel contract. Durable channels must be real class instances.
68
120
  */
69
- onEvent(event: HandleMessageStreamEvent, emit: EventEmitFn): Promise<void>;
121
+ protected readonly __channelBrand: undefined;
70
122
  /**
71
- * Converts raw platform input into structured {@link RuntimeInputResult}s
72
- * when the session has pending input requests.
123
+ * Stable identifier for this channel instance, derived from the
124
+ * subclass's static {@link ChannelClass.kind} field.
125
+ */
126
+ get kind(): string;
127
+ /**
128
+ * Outbound: called by the runtime for every lifecycle event. Returns
129
+ * the event to write to the stream — usually the same event passed
130
+ * in, but channels may transform it (e.g. the subagent channel wraps
131
+ * events in `subagent.event` envelopes).
73
132
  *
74
- * Called by the harness just before resolving a pending input batch.
75
- * Emitters for platforms that cannot send structured input results
76
- * (e.g. Slack, where the user types "yes") implement this to map
77
- * freeform text to approval or question responses. Emitters for
78
- * platforms that already send structured results (e.g. HTTP) omit
79
- * this method.
133
+ * Platform-specific side effects (Slack typing indicators, message
134
+ * posting, etc.) happen inside this method before returning.
135
+ */
136
+ abstract onEvent(event: HandleMessageStreamEvent): Promise<HandleMessageStreamEvent>;
137
+ /**
138
+ * Called once per turn — both the initial `run()` and each
139
+ * `deliver()` — after auth keys have been seeded on the context.
80
140
  *
81
- * Return `undefined` to fall through to the default behavior (auto-
82
- * generated "ignored" responses for each unresolved request).
141
+ * The channel receives a context accessor and the inbound payload.
142
+ * It can set custom context keys (e.g. thread history for tools to
143
+ * read) and transform the payload (e.g. resolve text against pending
144
+ * input request options). Returns the resolved step input that the
145
+ * harness will see.
146
+ *
147
+ * Async so channels can fetch platform data (thread history, user
148
+ * profiles, etc.) before the step runs.
83
149
  */
84
- resolveInput?(input: {
85
- readonly message: string;
86
- readonly requests: readonly RuntimeInputRequest[];
87
- }): readonly RuntimeInputResult[] | undefined;
150
+ abstract onDeliver(ctx: ContextAccessor, payload: DeliverPayload): Promise<StepInput>;
88
151
  /**
89
- * Returns the JSON-serializable state needed to reconstruct this emitter
90
- * after a workflow step boundary. The framework wraps the result in
91
- * `{ kind, state }` and stores it on the durable workflow context.
152
+ * Returns the JSON-serializable state needed to reconstruct this
153
+ * channel after a workflow step boundary. The framework wraps the
154
+ * result in `{ kind, state }` and stores it on the durable workflow
155
+ * context.
92
156
  */
93
- serialize(): Record<string, unknown>;
157
+ abstract serialize(): Record<string, unknown>;
94
158
  }
95
159
  /**
96
- * Static interface implemented by every {@link ChannelEmitter} class. Used by
97
- * the channel emitter registry to look up a class by `kind` and rebuild an
98
- * instance from previously-serialized state.
160
+ * Static interface implemented by every {@link Channel} class. Used by
161
+ * the runtime-owned channel registry to look up a class by `kind` and
162
+ * rebuild an instance from previously-serialized state.
99
163
  */
100
- export interface ChannelEmitterClass<E extends ChannelEmitter = ChannelEmitter> {
164
+ export interface ChannelClass<C extends Channel = Channel> {
165
+ /**
166
+ * Stable durable identifier for the channel subclass. Must be unique
167
+ * across all serializable channel classes visible to one runtime bundle.
168
+ */
101
169
  readonly kind: string;
102
170
  /**
103
- * Reconstructs an emitter instance from state previously returned by
104
- * {@link ChannelEmitter.serialize}.
171
+ * Constructs a channel instance. Specific route helpers may constrain the
172
+ * constructor input shape further (for example Slack channel classes accept
173
+ * {@link import("./slack-channel.js").SlackChannelState}).
105
174
  */
106
- deserialize(state: Record<string, unknown>): E;
175
+ new (...args: never[]): C;
107
176
  }
177
+ /**
178
+ * Returns the static durable kind for a channel class.
179
+ */
180
+ export declare function getChannelClassKind(channelClass: ChannelClass): string;
108
181
  /**
109
182
  * Single input shape consumed by {@link Runtime.run} for both root runs
110
- * (started by channels) and delegated child runs (started by the
183
+ * (started by routes) and delegated child runs (started by the
111
184
  * subagent tool wrapper).
112
185
  *
113
- * Channels build the platform-facing fields (`auth`, `channelEmitter`,
186
+ * Routes build the platform-facing fields (`auth`, `channel`,
114
187
  * `continuationToken`, `input`, `mode`, `sessionId`) from inbound
115
188
  * platform input and call `runtime.run(input)` directly. The subagent
116
189
  * tool wrapper builds the same shape and additionally sets
117
190
  * `initiatorAuth` and `parent` to forward the audit chain and record
118
- * lineage. The runtime is the one place that knows how to turn this
119
- * into a fully-seeded {@link AshContext} — channels and the wrapper
120
- * stay free of any compiled-bundle or context-building knowledge.
191
+ * lineage.
121
192
  *
122
- * `input.message` is the first user-visible message for this run.
193
+ * `input.message` is the first user-visible message for this session.
123
194
  * Subsequent deliveries via {@link Runtime.deliver} carry their own
124
- * messages, so the field is per-call rather than run-wide state.
195
+ * messages, so the field is per-call rather than session-wide state.
125
196
  */
126
197
  export interface RunInput {
127
198
  /**
128
- * Authenticated caller principal for this run. `null` (or omitted)
129
- * means the request was accepted with no credentials. For delegated
130
- * runs this is the auth of whoever called the parent step that
131
- * triggered the delegation.
199
+ * Authenticated caller principal for this session. `null` means the
200
+ * request was accepted with no credentials.
132
201
  */
133
- readonly auth?: SessionAuthContext | null;
202
+ readonly auth: SessionAuthContext | null;
134
203
  /**
135
- * Serializable channel emitter that owns event delivery policy for
136
- * this run.
204
+ * The channel conduit for this session. Owns event delivery policy
205
+ * and is serialized across workflow step boundaries.
137
206
  */
138
- readonly channelEmitter: ChannelEmitter;
207
+ readonly channel: Channel;
139
208
  readonly continuationToken: string;
140
- readonly input: {
141
- readonly message: string;
142
- };
143
209
  /**
144
210
  * The original (top-level) caller's auth, forwarded down the
145
211
  * delegation chain so the child's `session.auth.initiator` always
146
- * resolves back to whoever started the root run. Defaults to `auth`
147
- * when omitted (root run behavior).
212
+ * resolves back to whoever started the root session. Defaults to
213
+ * {@link auth} when omitted (root session behavior).
148
214
  */
149
215
  readonly initiatorAuth?: SessionAuthContext | null;
216
+ readonly input: {
217
+ readonly message: string;
218
+ };
150
219
  /**
151
220
  * Execution mode for the run.
152
221
  *
@@ -157,7 +226,7 @@ export interface RunInput {
157
226
  readonly mode: RunMode;
158
227
  /**
159
228
  * Lineage metadata describing the immediate parent execution that
160
- * delegated this run. Absent on root runs started by channels.
229
+ * delegated this run. Absent on root runs started by routes.
161
230
  */
162
231
  readonly parent?: SessionParent;
163
232
  /**
@@ -173,15 +242,13 @@ export interface RunInput {
173
242
  export interface DeliverInput {
174
243
  /**
175
244
  * Authenticated caller principal for this follow-up message.
176
- * May differ from the session initiator when different users send messages
177
- * to the same session.
245
+ * May differ from the session initiator when different users send
246
+ * messages to the same session. The runtime updates `AuthKey` from
247
+ * this field before calling the channel's hooks.
178
248
  */
179
249
  readonly auth?: SessionAuthContext | null;
180
250
  readonly continuationToken: string;
181
- readonly payload: {
182
- readonly inputResults?: readonly RuntimeInputResult[];
183
- readonly message?: string;
184
- };
251
+ readonly payload: DeliverPayload;
185
252
  }
186
253
  /**
187
254
  * Terminal outcome of a runtime turn, resolved via `RunHandle.result`.
@@ -206,14 +273,14 @@ export interface RunHandle {
206
273
  readonly sessionId: string;
207
274
  }
208
275
  /**
209
- * Runtime interface consumed by channels and the subagent tool wrapper.
276
+ * Runtime interface consumed by routes and the subagent tool wrapper.
210
277
  *
211
278
  * The runtime owns the compiled-bundle source and an optional node
212
279
  * selector (both passed at construction time). It is the only place
213
280
  * that knows how to load the compiled bundle, build a fully-seeded
214
281
  * {@link AshContext}, and drive the step loop.
215
282
  *
216
- * Channels construct a root runtime (no node selector) and call
283
+ * Routes construct a root runtime (no node selector) and call
217
284
  * `runtime.run(input)` with flat platform-shape input. The subagent
218
285
  * tool wrapper creates a child runtime pre-configured for the target
219
286
  * node via the `createChildRuntime` factory, then calls
@@ -233,19 +300,19 @@ export interface Runtime {
233
300
  */
234
301
  deliver(input: DeliverInput): Promise<void>;
235
302
  /**
236
- * Returns a readable stream of lifecycle events for an existing run.
303
+ * Returns a readable stream of lifecycle events for an existing session.
237
304
  *
238
- * Used by the framework's HTTP run-stream channel and any user-authored
239
- * channel that exposes an event-streaming endpoint. Backed by the
240
- * workflow API's per-run durable stream.
305
+ * Used by the framework's HTTP session-stream route and any
306
+ * user-authored route that exposes an event-streaming endpoint.
307
+ * Backed by the workflow API's per-session durable stream.
241
308
  *
242
- * `options.startIndex` selects the zero-based position of the first event
243
- * to yield, dropping any earlier events. The framework HTTP run-stream
244
- * channel forwards the value from the `startIndex` query parameter so a
245
- * reconnecting client can resume after the events it has already
246
- * consumed without replaying the prior turn.
309
+ * `options.startIndex` selects the zero-based position of the first
310
+ * event to yield, dropping any earlier events. The framework HTTP
311
+ * session-stream route forwards the value from the `startIndex`
312
+ * query parameter so a reconnecting client can resume after the
313
+ * events it has already consumed without replaying the prior turn.
247
314
  */
248
- getEventStream(runId: string, options?: GetEventStreamOptions): Promise<ReadableStream<HandleMessageStreamEvent>>;
315
+ getEventStream(sessionId: string, options?: GetEventStreamOptions): Promise<ReadableStream<HandleMessageStreamEvent>>;
249
316
  }
250
317
  /**
251
318
  * Options accepted by {@link Runtime.getEventStream}.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/channel/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAMzF;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B;AAMD;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;IAC1E,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,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AAO,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC,CAAC;CACtD;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B"}
@@ -1,2 +1,65 @@
1
- export {};
1
+ /**
2
+ * Global symbol brand used to recognize Ash channel classes across
3
+ * independently-loaded copies of the package during compile/runtime tests.
4
+ */
5
+ export const CHANNEL_CLASS_BRAND = Symbol.for("ash.channel.class");
6
+ export const CHANNEL_PROTOTYPE_BRAND = Symbol.for("ash.channel.prototype");
7
+ // ---------------------------------------------------------------------------
8
+ // Channel
9
+ // ---------------------------------------------------------------------------
10
+ /**
11
+ * Serializable conduit that owns the full lifecycle of one platform
12
+ * integration.
13
+ *
14
+ * A channel carries auth, renders outbound events to the platform,
15
+ * transforms inbound deliver payloads, and optionally sets custom
16
+ * context keys. It is serialized across workflow step boundaries via
17
+ * {@link serialize} plus constructor-based rehydration performed by the
18
+ * runtime-owned channel registry.
19
+ *
20
+ * Channels are class-based durable values. Authors define a concrete
21
+ * subclass, declare a unique static `kind`, and pass an instance on
22
+ * {@link RunInput.channel}. The runtime invokes {@link onEvent} /
23
+ * {@link onDeliver} during the step loop. Auth is separate from the
24
+ * channel — it lives on {@link RunInput.auth} and
25
+ * {@link DeliverInput.auth}.
26
+ */
27
+ export class Channel {
28
+ /**
29
+ * Runtime marker inherited by every channel subclass constructor.
30
+ * Used by route-definition validation without relying on `instanceof`
31
+ * across multiple loaded copies of the package.
32
+ */
33
+ static [CHANNEL_CLASS_BRAND] = true;
34
+ /**
35
+ * Runtime marker inherited by every channel subclass prototype.
36
+ * Route-definition validation reads this through the subclass prototype
37
+ * chain so authored channels from another loaded package copy still
38
+ * register correctly.
39
+ */
40
+ get [CHANNEL_PROTOTYPE_BRAND]() {
41
+ return true;
42
+ }
43
+ /**
44
+ * Nominal marker that prevents plain object literals from satisfying
45
+ * the channel contract. Durable channels must be real class instances.
46
+ */
47
+ __channelBrand;
48
+ /**
49
+ * Stable identifier for this channel instance, derived from the
50
+ * subclass's static {@link ChannelClass.kind} field.
51
+ */
52
+ get kind() {
53
+ return getChannelClassKind(this.constructor);
54
+ }
55
+ }
56
+ /**
57
+ * Returns the static durable kind for a channel class.
58
+ */
59
+ export function getChannelClassKind(channelClass) {
60
+ if (typeof channelClass.kind !== "string" || channelClass.kind.length === 0) {
61
+ throw new TypeError("Channel classes must declare a non-empty static `kind` field.");
62
+ }
63
+ return channelClass.kind;
64
+ }
2
65
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/channel/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/channel/types.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAuG3E,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAgB,OAAO;IAC3B;;;;OAIG;IACH,MAAM,CAAU,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC;IAC7C;;;;;OAKG;IACH,IAAc,CAAC,uBAAuB,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IACD;;;OAGG;IACgB,cAAc,CAAa;IAE9C;;;OAGG;IACH,IAAI,IAAI;QACN,OAAO,mBAAmB,CAAC,IAAI,CAAC,WAA2B,CAAC,CAAC;IAC/D,CAAC;;AAqDH;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,YAA0B;IAC5D,IAAI,OAAO,YAAY,CAAC,IAAI,KAAK,QAAQ,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5E,MAAM,IAAI,SAAS,CAAC,+DAA+D,CAAC,CAAC;IACvF,CAAC;IAED,OAAO,YAAY,CAAC,IAAI,CAAC;AAC3B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { HandleMessageStreamEvent } from "../../protocol/message.js";
2
- import type { RuntimeInputRequest, RuntimeInputResult } from "../../runtime/input/types.js";
2
+ import type { InputRequest, InputResponse } from "../../runtime/input/types.js";
3
3
  import { type CliTheme } from "../ui/output.js";
4
4
  /**
5
5
  * Sentinel returned when the CLI user pressed Escape while responding to a
@@ -15,7 +15,7 @@ export type RuntimeInputPromptValue = string | typeof ESCAPED_RUNTIME_INPUT_PROM
15
15
  * Outcome of one interactive CLI prompt pass for pending runtime input.
16
16
  */
17
17
  export type RuntimeInputPromptResult = {
18
- readonly inputResults: readonly RuntimeInputResult[];
18
+ readonly inputResponses: readonly InputResponse[];
19
19
  readonly kind: "submitted";
20
20
  } | {
21
21
  readonly kind: "deferred";
@@ -25,7 +25,7 @@ export type RuntimeInputPromptResult = {
25
25
  /**
26
26
  * Returns the last pending runtime-input batch emitted in one turn, if any.
27
27
  */
28
- export declare function extractPendingRuntimeInputRequests(events: readonly HandleMessageStreamEvent[]): readonly RuntimeInputRequest[];
28
+ export declare function extractPendingRuntimeInputRequests(events: readonly HandleMessageStreamEvent[]): readonly InputRequest[];
29
29
  /**
30
30
  * Interactively collects CLI-native responses for pending runtime input
31
31
  * requests.
@@ -33,7 +33,7 @@ export declare function extractPendingRuntimeInputRequests(events: readonly Hand
33
33
  export declare function promptForRuntimeInputRequests(input: {
34
34
  ask(prompt: string): Promise<RuntimeInputPromptValue>;
35
35
  print(message: string): void;
36
- requests: readonly RuntimeInputRequest[];
36
+ requests: readonly InputRequest[];
37
37
  theme: CliTheme;
38
38
  }): Promise<RuntimeInputPromptResult>;
39
39
  //# sourceMappingURL=input-requests.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"input-requests.d.ts","sourceRoot":"","sources":["../../../../src/cli/dev/input-requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAGnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,KAAK,QAAQ,EAAuB,MAAM,iBAAiB,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,4BAA4B,eAA0C,CAAC;AAEpF;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,OAAO,4BAA4B,GAAG,SAAS,CAAC;AAE/F;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAChC;IACE,QAAQ,CAAC,YAAY,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACrD,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CAC1B,CAAC;AAEN;;GAEG;AACH,wBAAgB,kCAAkC,CAChD,MAAM,EAAE,SAAS,wBAAwB,EAAE,GAC1C,SAAS,mBAAmB,EAAE,CAUhC;AAED;;;GAGG;AACH,wBAAsB,6BAA6B,CAAC,KAAK,EAAE;IACzD,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACtD,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACzC,KAAK,EAAE,QAAQ,CAAC;CACjB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CA8BpC"}
1
+ {"version":3,"file":"input-requests.d.ts","sourceRoot":"","sources":["../../../../src/cli/dev/input-requests.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,KAAK,QAAQ,EAAuB,MAAM,iBAAiB,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,4BAA4B,eAA0C,CAAC;AAEpF;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,OAAO,4BAA4B,GAAG,SAAS,CAAC;AAE/F;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAChC;IACE,QAAQ,CAAC,cAAc,EAAE,SAAS,aAAa,EAAE,CAAC;IAClD,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CAC1B,CAAC;AAEN;;GAEG;AACH,wBAAgB,kCAAkC,CAChD,MAAM,EAAE,SAAS,wBAAwB,EAAE,GAC1C,SAAS,YAAY,EAAE,CAUzB;AAED;;;GAGG;AACH,wBAAsB,6BAA6B,CAAC,KAAK,EAAE;IACzD,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACtD,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAC;IAClC,KAAK,EAAE,QAAQ,CAAC;CACjB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CA8BpC"}
@@ -1,3 +1,4 @@
1
+ import { resolveTextToResponse } from "../../channel/resolve-text.js";
1
2
  import { renderCliTaggedLine } from "../ui/output.js";
2
3
  /**
3
4
  * Sentinel returned when the CLI user pressed Escape while responding to a
@@ -21,7 +22,7 @@ export function extractPendingRuntimeInputRequests(events) {
21
22
  * requests.
22
23
  */
23
24
  export async function promptForRuntimeInputRequests(input) {
24
- const results = [];
25
+ const responses = [];
25
26
  input.print(renderCliTaggedLine(input.theme, {
26
27
  message: `pending input request${input.requests.length === 1 ? "" : "s"}: reply now, press Escape, or type "skip" to return to the normal prompt`,
27
28
  tag: "input",
@@ -37,34 +38,38 @@ export async function promptForRuntimeInputRequests(input) {
37
38
  if (result.kind !== "submitted") {
38
39
  return result;
39
40
  }
40
- results.push(result.inputResult);
41
+ responses.push(result.inputResponse);
41
42
  }
42
43
  return {
43
- inputResults: results,
44
+ inputResponses: responses,
44
45
  kind: "submitted",
45
46
  };
46
47
  }
48
+ /**
49
+ * Returns true when the request represents a tool approval (confirmation).
50
+ */
51
+ function isApprovalRequest(request) {
52
+ return request.display === "confirmation";
53
+ }
47
54
  async function promptForRuntimeInputRequest(input) {
48
- switch (input.request.kind) {
49
- case "question":
50
- return await promptForQuestionInputRequest({
51
- ask: input.ask,
52
- print: input.print,
53
- request: input.request,
54
- theme: input.theme,
55
- });
56
- case "tool-approval":
57
- return await promptForToolApprovalInputRequest({
58
- ask: input.ask,
59
- print: input.print,
60
- request: input.request,
61
- theme: input.theme,
62
- });
55
+ if (isApprovalRequest(input.request)) {
56
+ return await promptForApprovalInputRequest({
57
+ ask: input.ask,
58
+ print: input.print,
59
+ request: input.request,
60
+ theme: input.theme,
61
+ });
63
62
  }
63
+ return await promptForQuestionInputRequest({
64
+ ask: input.ask,
65
+ print: input.print,
66
+ request: input.request,
67
+ theme: input.theme,
68
+ });
64
69
  }
65
- async function promptForToolApprovalInputRequest(input) {
70
+ async function promptForApprovalInputRequest(input) {
66
71
  input.print(renderCliTaggedLine(input.theme, {
67
- message: `approve tool "${input.request.toolName}"?`,
72
+ message: `approve tool "${input.request.action.toolName}"? (yes/no)`,
68
73
  tag: "approval",
69
74
  tone: "warning",
70
75
  }));
@@ -90,20 +95,18 @@ async function promptForToolApprovalInputRequest(input) {
90
95
  normalized === "y" ||
91
96
  normalized === "yes") {
92
97
  return {
93
- inputResult: {
94
- approvalId: input.request.approvalId,
95
- approved: true,
96
- kind: "tool-approval-result",
98
+ inputResponse: {
99
+ optionId: "approve",
100
+ requestId: input.request.requestId,
97
101
  },
98
102
  kind: "submitted",
99
103
  };
100
104
  }
101
105
  if (normalized === "d" || normalized === "deny" || normalized === "n" || normalized === "no") {
102
106
  return {
103
- inputResult: {
104
- approvalId: input.request.approvalId,
105
- approved: false,
106
- kind: "tool-approval-result",
107
+ inputResponse: {
108
+ optionId: "deny",
109
+ requestId: input.request.requestId,
107
110
  },
108
111
  kind: "submitted",
109
112
  };
@@ -141,33 +144,10 @@ async function promptForQuestionInputRequest(input) {
141
144
  if (trimmedValue === "skip" || trimmedValue === "/skip") {
142
145
  return { kind: "deferred" };
143
146
  }
144
- const selectedOption = resolveQuestionOption({
145
- options: input.request.options,
146
- value: trimmedValue,
147
- });
148
- if (selectedOption !== undefined) {
147
+ const response = resolveTextToResponse(trimmedValue, input.request);
148
+ if (response !== undefined) {
149
149
  return {
150
- inputResult: {
151
- callId: input.request.action.callId,
152
- kind: "question-result",
153
- output: {
154
- optionId: selectedOption.id,
155
- status: "answered",
156
- },
157
- },
158
- kind: "submitted",
159
- };
160
- }
161
- if (acceptsFreeform && trimmedValue.length > 0) {
162
- return {
163
- inputResult: {
164
- callId: input.request.action.callId,
165
- kind: "question-result",
166
- output: {
167
- status: "answered",
168
- text: trimmedValue,
169
- },
170
- },
150
+ inputResponse: response,
171
151
  kind: "submitted",
172
152
  };
173
153
  }
@@ -182,15 +162,4 @@ async function promptForQuestionInputRequest(input) {
182
162
  }));
183
163
  }
184
164
  }
185
- function resolveQuestionOption(input) {
186
- if (input.options === undefined || input.options.length === 0) {
187
- return undefined;
188
- }
189
- const numericIndex = Number(input.value);
190
- if (Number.isInteger(numericIndex) && numericIndex > 0) {
191
- return input.options[numericIndex - 1];
192
- }
193
- const normalizedValue = input.value.toLowerCase();
194
- return input.options.find((option) => option.id.toLowerCase() === normalizedValue || option.label.toLowerCase() === normalizedValue);
195
- }
196
165
  //# sourceMappingURL=input-requests.js.map