eve 0.68.0 → 0.69.0

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 (1048) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/bin/eve.js +15 -0
  3. package/dist/src/_virtual/_rolldown/runtime.js +1 -1
  4. package/dist/src/approval/definition.d.ts +19 -5
  5. package/dist/src/channel/adapter.d.ts +2 -0
  6. package/dist/src/channel/auth/oidc.js +1 -1
  7. package/dist/src/channel/channel-address.d.ts +1 -4
  8. package/dist/src/channel/channel-address.js +1 -1
  9. package/dist/src/channel/channel-operations.d.ts +4 -11
  10. package/dist/src/channel/channel-operations.js +1 -1
  11. package/dist/src/channel/compiled-channel.d.ts +0 -2
  12. package/dist/src/channel/compiled-channel.js +2 -2
  13. package/dist/src/channel/cross-channel-receive.d.ts +1 -3
  14. package/dist/src/channel/cross-channel-receive.js +1 -1
  15. package/dist/src/channel/forwarded-principal.js +1 -1
  16. package/dist/src/channel/schedule-auth.d.ts +16 -0
  17. package/dist/src/channel/schedule-auth.js +1 -1
  18. package/dist/src/channel/session-callback.js +1 -1
  19. package/dist/src/channel/session.d.ts +3 -8
  20. package/dist/src/channel/session.js +1 -1
  21. package/dist/src/channel/task-card.d.ts +121 -0
  22. package/dist/src/channel/task-card.js +1 -0
  23. package/dist/src/channel/types.d.ts +12 -57
  24. package/dist/src/chunks/{use-eve-agent-DXcE_8Ja.js → use-eve-agent-D_5129A9.js} +295 -205
  25. package/dist/src/chunks/{use-eve-agent-D4HVZBjn.js → use-eve-agent-Dab2MnT2.js} +295 -205
  26. package/dist/src/cli/commands/info.d.ts +11 -0
  27. package/dist/src/cli/commands/info.js +1 -1
  28. package/dist/src/cli/commands/init-agent-workspace.js +1 -1
  29. package/dist/src/cli/commands/init.js +1 -1
  30. package/dist/src/cli/dev/command-options.d.ts +2 -2
  31. package/dist/src/cli/dev/command.js +1 -1
  32. package/dist/src/cli/dev/tui/blocks.d.ts +19 -18
  33. package/dist/src/cli/dev/tui/blocks.js +3 -3
  34. package/dist/src/cli/dev/tui/command-typeahead.d.ts +3 -6
  35. package/dist/src/cli/dev/tui/diagnostic-presentation.d.ts +10 -0
  36. package/dist/src/cli/dev/tui/diagnostic-presentation.js +3 -2
  37. package/dist/src/cli/dev/tui/prompt-placeholder.d.ts +2 -0
  38. package/dist/src/cli/dev/tui/prompt-placeholder.js +1 -0
  39. package/dist/src/cli/dev/tui/rail.d.ts +1 -1
  40. package/dist/src/cli/dev/tui/runner.d.ts +25 -2
  41. package/dist/src/cli/dev/tui/runner.js +3 -3
  42. package/dist/src/cli/dev/tui/status-line.d.ts +4 -2
  43. package/dist/src/cli/dev/tui/status-line.js +1 -1
  44. package/dist/src/cli/dev/tui/subagent-pump.d.ts +44 -52
  45. package/dist/src/cli/dev/tui/subagent-pump.js +1 -1
  46. package/dist/src/cli/dev/tui/task-activity.d.ts +55 -0
  47. package/dist/src/cli/dev/tui/task-activity.js +1 -0
  48. package/dist/src/cli/dev/tui/terminal-renderer.d.ts +13 -30
  49. package/dist/src/cli/dev/tui/terminal-renderer.js +11 -11
  50. package/dist/src/cli/dev/tui/theme.d.ts +1 -1
  51. package/dist/src/cli/dev/tui/theme.js +1 -1
  52. package/dist/src/cli/dev/tui/tool-block-groups.d.ts +6 -9
  53. package/dist/src/cli/dev/tui/tool-block-groups.js +1 -1
  54. package/dist/src/cli/dev/tui/tool-presentation.d.ts +16 -3
  55. package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
  56. package/dist/src/cli/dev/tui/traces/trace-conversation.js +3 -1
  57. package/dist/src/cli/dev/tui/traces/trace-view.js +1 -1
  58. package/dist/src/cli/dev/tui/types.d.ts +11 -5
  59. package/dist/src/cli/dev/ui-options.d.ts +2 -2
  60. package/dist/src/cli/option-parsers.d.ts +3 -1
  61. package/dist/src/cli/option-parsers.js +1 -1
  62. package/dist/src/cli/ui/terminal-text.js +1 -1
  63. package/dist/src/client/agent-info-schema.d.ts +150 -9
  64. package/dist/src/client/agent-info-schema.js +1 -1
  65. package/dist/src/client/agent-session.d.ts +28 -0
  66. package/dist/src/client/agent-session.js +1 -0
  67. package/dist/src/client/eve-agent-store-helpers.d.ts +1 -1
  68. package/dist/src/client/eve-agent-store-helpers.js +2 -2
  69. package/dist/src/client/eve-agent-store.js +1 -1
  70. package/dist/src/client/index.d.ts +2 -1
  71. package/dist/src/client/index.js +1 -1
  72. package/dist/src/client/message-action-parts.js +1 -1
  73. package/dist/src/client/message-reducer.js +1 -1
  74. package/dist/src/client/message-task-parts.d.ts +8 -0
  75. package/dist/src/client/message-task-parts.js +1 -0
  76. package/dist/src/client/optimistic-message-submissions.js +1 -1
  77. package/dist/src/client/session-controls.d.ts +0 -1
  78. package/dist/src/client/session-utils.d.ts +10 -0
  79. package/dist/src/client/session-utils.js +1 -1
  80. package/dist/src/client/session.d.ts +8 -16
  81. package/dist/src/client/session.js +1 -1
  82. package/dist/src/client/stream-version.js +1 -1
  83. package/dist/src/client/types.d.ts +2 -4
  84. package/dist/src/compiled/.vendor-stamp.json +3 -2
  85. package/dist/src/compiled/@eve/catalog/index.js +1 -1
  86. package/dist/src/compiled/@vercel/connect/LICENSE +202 -0
  87. package/dist/src/compiled/@vercel/connect/authorization-details.d.ts +11 -0
  88. package/dist/src/compiled/@vercel/connect/authorization.d.ts +47 -0
  89. package/dist/src/compiled/@vercel/connect/connector.d.ts +32 -0
  90. package/dist/src/compiled/@vercel/connect/index.d.ts +5 -0
  91. package/dist/src/compiled/@vercel/connect/index.js +26 -0
  92. package/dist/src/compiled/@vercel/connect/installation.d.ts +48 -0
  93. package/dist/src/compiled/@vercel/connect/token.d.ts +137 -0
  94. package/dist/src/compiled/@workflow/core/runtime.js +3 -3
  95. package/dist/src/compiler/bundled-extension.d.ts +7 -1
  96. package/dist/src/compiler/bundled-extension.js +1 -1
  97. package/dist/src/compiler/default-tool-policy.d.ts +2 -2
  98. package/dist/src/compiler/default-tool-policy.js +1 -1
  99. package/dist/src/compiler/development-extensions.js +1 -1
  100. package/dist/src/compiler/extension-compatibility.d.ts +54 -18
  101. package/dist/src/compiler/extension-compatibility.js +1 -1
  102. package/dist/src/compiler/extension-mount-bindings.d.ts +5 -0
  103. package/dist/src/compiler/extension-mount-bindings.js +1 -0
  104. package/dist/src/compiler/load-binding-namespace.d.ts +10 -2
  105. package/dist/src/compiler/load-binding-namespace.js +1 -1
  106. package/dist/src/compiler/manifest.d.ts +19 -17
  107. package/dist/src/compiler/manifest.js +1 -1
  108. package/dist/src/compiler/module-lifecycle.d.ts +2 -2
  109. package/dist/src/compiler/module-lifecycle.js +1 -1
  110. package/dist/src/compiler/module-map.d.ts +1 -1
  111. package/dist/src/compiler/module-map.js +3 -3
  112. package/dist/src/compiler/normalize-manifest-helpers.d.ts +18 -1
  113. package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
  114. package/dist/src/compiler/normalize-manifest-types.d.ts +2 -0
  115. package/dist/src/compiler/normalize-manifest.js +1 -1
  116. package/dist/src/compiler/normalize-subagent.js +1 -1
  117. package/dist/src/compiler/normalize-tool.js +1 -1
  118. package/dist/src/compiler/project-sources.d.ts +4 -0
  119. package/dist/src/compiler/project-sources.js +1 -1
  120. package/dist/src/compiler/remote-agent-node.js +1 -1
  121. package/dist/src/compiler/source-graph.d.ts +5 -0
  122. package/dist/src/compiler/source-graph.js +1 -1
  123. package/dist/src/computer-use/extension/lib/computer-use-sandbox.d.ts +8 -0
  124. package/dist/src/computer-use/extension/lib/computer-use-sandbox.js +3 -3
  125. package/dist/src/computer-use/extension/lib/computer-use.d.ts +2 -0
  126. package/dist/src/computer-use/extension/lib/computer-use.js +2 -1
  127. package/dist/src/computer-use/extension/tools/computer_use.js +1 -1
  128. package/dist/src/context/build-dynamic-tools.js +1 -1
  129. package/dist/src/context/dynamic-subagent-lifecycle.d.ts +5 -0
  130. package/dist/src/context/dynamic-subagent-lifecycle.js +1 -1
  131. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  132. package/dist/src/context/dynamic-tool-metadata.d.ts +1 -1
  133. package/dist/src/context/key-names.d.ts +0 -1
  134. package/dist/src/context/key-names.js +1 -1
  135. package/dist/src/context/keys.d.ts +8 -14
  136. package/dist/src/context/keys.js +1 -1
  137. package/dist/src/context/memory-lifecycle.js +1 -1
  138. package/dist/src/context/memory-tools.d.ts +0 -1
  139. package/dist/src/context/provider.d.ts +1 -3
  140. package/dist/src/context/run-step.d.ts +2 -3
  141. package/dist/src/context/run-step.js +1 -1
  142. package/dist/src/context/serialize.js +1 -1
  143. package/dist/src/discover/bundled-extension.js +1 -1
  144. package/dist/src/discover/discover-agent.js +1 -1
  145. package/dist/src/discover/extensions.d.ts +0 -7
  146. package/dist/src/discover/extensions.js +1 -1
  147. package/dist/src/discover/manifest.d.ts +4 -0
  148. package/dist/src/evals/assertions/run.d.ts +4 -3
  149. package/dist/src/evals/assertions/run.js +1 -1
  150. package/dist/src/evals/index.d.ts +1 -1
  151. package/dist/src/evals/match.d.ts +4 -4
  152. package/dist/src/evals/mock-model.js +1 -1
  153. package/dist/src/evals/runner/derive-run-facts.d.ts +3 -3
  154. package/dist/src/evals/runner/derive-run-facts.js +1 -1
  155. package/dist/src/evals/runner/reporters/assertion-scores.d.ts +19 -0
  156. package/dist/src/evals/runner/reporters/assertion-scores.js +1 -0
  157. package/dist/src/evals/runner/reporters/braintrust.js +1 -1
  158. package/dist/src/evals/runner/reporters/datadog-client.d.ts +123 -0
  159. package/dist/src/evals/runner/reporters/datadog-client.js +4 -0
  160. package/dist/src/evals/runner/reporters/datadog.d.ts +9 -98
  161. package/dist/src/evals/runner/reporters/datadog.js +2 -3
  162. package/dist/src/evals/session-content.js +1 -1
  163. package/dist/src/evals/session.d.ts +4 -4
  164. package/dist/src/evals/session.js +2 -2
  165. package/dist/src/evals/types.d.ts +18 -15
  166. package/dist/src/eve-channel/create-request.d.ts +5 -4
  167. package/dist/src/eve-channel/create-request.js +1 -1
  168. package/dist/src/eve-channel/index.d.ts +0 -9
  169. package/dist/src/eve-channel/index.js +1 -1
  170. package/dist/src/eve-channel/request.d.ts +3 -7
  171. package/dist/src/eve-channel/request.js +1 -1
  172. package/dist/src/eve-channel/support.d.ts +15 -5
  173. package/dist/src/eve-channel/support.js +1 -1
  174. package/dist/src/eve-channel/turn-policy-request.d.ts +2 -0
  175. package/dist/src/eve-channel/turn-policy-request.js +1 -0
  176. package/dist/src/eve-channel/types.d.ts +4 -0
  177. package/dist/src/execution/agent-sessions/context.d.ts +60 -0
  178. package/dist/src/execution/agent-sessions/context.js +1 -0
  179. package/dist/src/{subagents/remote-dispatch.d.ts → execution/agent-sessions/remote.d.ts} +17 -40
  180. package/dist/src/execution/agent-sessions/remote.js +1 -0
  181. package/dist/src/execution/agent-sessions/requests.d.ts +20 -0
  182. package/dist/src/execution/agent-sessions/requests.js +1 -0
  183. package/dist/src/execution/agent-sessions/session.d.ts +12 -0
  184. package/dist/src/execution/agent-sessions/session.js +1 -0
  185. package/dist/src/execution/agent-sessions/steps.d.ts +59 -0
  186. package/dist/src/execution/agent-sessions/steps.js +1 -0
  187. package/dist/src/execution/agent-sessions/target.d.ts +45 -0
  188. package/dist/src/execution/agent-sessions/target.js +1 -0
  189. package/dist/src/execution/agent-sessions/usage.d.ts +18 -0
  190. package/dist/src/execution/agent-sessions/usage.js +1 -0
  191. package/dist/src/execution/authorization-callback-match.d.ts +2 -4
  192. package/dist/src/execution/authorization-callback-match.js +1 -1
  193. package/dist/src/execution/cancel-descendant-turns-step.d.ts +1 -5
  194. package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
  195. package/dist/src/execution/cancelled-model-call-batch.js +1 -1
  196. package/dist/src/execution/connection-announcement.d.ts +7 -0
  197. package/dist/src/execution/connection-announcement.js +4 -0
  198. package/dist/src/execution/continuation-conflict-step.d.ts +2 -3
  199. package/dist/src/execution/continuation-conflict-step.js +1 -1
  200. package/dist/src/execution/coordination-dispatch-shared.d.ts +9 -27
  201. package/dist/src/execution/coordination-dispatch-shared.js +1 -1
  202. package/dist/src/execution/coordination-dispatch-step.d.ts +3 -2
  203. package/dist/src/execution/coordination-dispatch-step.js +1 -1
  204. package/dist/src/execution/create-session-step.d.ts +0 -1
  205. package/dist/src/execution/create-session-step.js +1 -1
  206. package/dist/src/execution/deliver-payloads.js +1 -1
  207. package/dist/src/execution/durable-session-store.d.ts +0 -1
  208. package/dist/src/execution/dynamic-connections.js +1 -1
  209. package/dist/src/execution/dynamic-workflow/program-step.js +1 -1
  210. package/dist/src/execution/dynamic-workflow/schema.d.ts +1 -3
  211. package/dist/src/execution/dynamic-workflow/schema.js +1 -1
  212. package/dist/src/execution/dynamic-workflow/tool.d.ts +1 -1
  213. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  214. package/dist/src/execution/dynamic-workflow/workflow.js +1 -1
  215. package/dist/src/execution/forward-session-input.d.ts +4 -0
  216. package/dist/src/execution/forward-session-input.js +1 -0
  217. package/dist/src/execution/legacy-remote-agent/protocol.d.ts +41 -0
  218. package/dist/src/execution/legacy-remote-agent/protocol.js +1 -0
  219. package/dist/src/execution/legacy-session/authorization.js +1 -1
  220. package/dist/src/execution/legacy-session/completion-step.js +1 -1
  221. package/dist/src/execution/legacy-session/inbox.js +1 -1
  222. package/dist/src/execution/legacy-session/input.js +1 -1
  223. package/dist/src/execution/legacy-session/interrupt-step.js +1 -1
  224. package/dist/src/execution/model-call-batching.js +1 -1
  225. package/dist/src/execution/node-step.d.ts +1 -1
  226. package/dist/src/execution/node-step.js +1 -1
  227. package/dist/src/execution/proxied-deliver-step.d.ts +9 -6
  228. package/dist/src/execution/proxied-deliver-step.js +1 -1
  229. package/dist/src/execution/publish-session-events.d.ts +130 -0
  230. package/dist/src/execution/publish-session-events.js +1 -0
  231. package/dist/src/execution/route-child-delivery.d.ts +5 -4
  232. package/dist/src/execution/route-child-delivery.js +1 -3
  233. package/dist/src/execution/runtime-context.js +1 -1
  234. package/dist/src/execution/sandbox/prewarm.js +1 -1
  235. package/dist/src/execution/session/admission.d.ts +1 -12
  236. package/dist/src/execution/session/admission.js +1 -1
  237. package/dist/src/execution/session/entry-input.d.ts +0 -2
  238. package/dist/src/execution/session/entry.js +1 -1
  239. package/dist/src/execution/session/finalization.js +1 -1
  240. package/dist/src/execution/session/handoff-steps.d.ts +13 -2
  241. package/dist/src/execution/session/handoff-steps.js +1 -1
  242. package/dist/src/execution/session/handoff.d.ts +17 -3
  243. package/dist/src/execution/session/handoff.js +1 -1
  244. package/dist/src/execution/session/input-queue.d.ts +27 -28
  245. package/dist/src/execution/session/input-queue.js +1 -1
  246. package/dist/src/execution/session/next-input.d.ts +5 -0
  247. package/dist/src/execution/session/next-input.js +1 -1
  248. package/dist/src/execution/session/pending-turn-state.d.ts +2 -0
  249. package/dist/src/execution/session/pending-turn-state.js +1 -1
  250. package/dist/src/execution/session/principal.d.ts +14 -0
  251. package/dist/src/execution/session/principal.js +1 -0
  252. package/dist/src/execution/session/program.js +1 -1
  253. package/dist/src/execution/session/route-selected-delivery.js +1 -1
  254. package/dist/src/execution/session/state-cursor.d.ts +17 -15
  255. package/dist/src/execution/session/state-cursor.js +1 -1
  256. package/dist/src/execution/session/state-delta.d.ts +33 -0
  257. package/dist/src/execution/session/state-delta.js +1 -0
  258. package/dist/src/execution/session/timeout-steps.js +1 -1
  259. package/dist/src/execution/session/turn-event-handler.d.ts +2 -2
  260. package/dist/src/execution/session/turn-event-handler.js +1 -1
  261. package/dist/src/execution/session/turn-step-result.d.ts +1 -3
  262. package/dist/src/execution/session/turn-step-result.js +1 -1
  263. package/dist/src/execution/session/turn-step-types.d.ts +24 -15
  264. package/dist/src/execution/session/turn-step.d.ts +2 -2
  265. package/dist/src/execution/session/turn-step.js +1 -1
  266. package/dist/src/execution/session/turn-waiting-step.d.ts +4 -0
  267. package/dist/src/execution/session/turn-waiting-step.js +1 -0
  268. package/dist/src/execution/session/turn.d.ts +33 -2
  269. package/dist/src/execution/session/turn.js +1 -1
  270. package/dist/src/execution/session-callback-request.js +1 -1
  271. package/dist/src/execution/session-event-stream.d.ts +33 -0
  272. package/dist/src/execution/session-event-stream.js +1 -0
  273. package/dist/src/execution/session-inbox/inbox.d.ts +2 -0
  274. package/dist/src/execution/session-inbox/inbox.js +1 -1
  275. package/dist/src/execution/session-inbox/protocol.js +1 -1
  276. package/dist/src/execution/session-inbox/release-step.js +1 -1
  277. package/dist/src/execution/session-inbox/resume.js +1 -1
  278. package/dist/src/execution/session-workflow-tool-run.d.ts +11 -2
  279. package/dist/src/execution/session-workflow-tool-run.js +1 -1
  280. package/dist/src/execution/session.d.ts +0 -1
  281. package/dist/src/execution/session.js +2 -2
  282. package/dist/src/execution/settle-cancelled-turn-step.d.ts +21 -9
  283. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  284. package/dist/src/execution/stable-workflow-names.d.ts +0 -1
  285. package/dist/src/execution/stable-workflow-names.js +1 -1
  286. package/dist/src/execution/tasks/calls.d.ts +42 -0
  287. package/dist/src/execution/tasks/calls.js +1 -0
  288. package/dist/src/execution/tasks/model-step.d.ts +58 -0
  289. package/dist/src/execution/tasks/model-step.js +1 -0
  290. package/dist/src/execution/tasks/render.d.ts +66 -0
  291. package/dist/src/execution/tasks/render.js +8 -0
  292. package/dist/src/execution/tasks/session.d.ts +19 -0
  293. package/dist/src/execution/tasks/session.js +1 -0
  294. package/dist/src/execution/tasks/start.d.ts +34 -0
  295. package/dist/src/execution/tasks/start.js +1 -0
  296. package/dist/src/execution/tasks/steps.d.ts +31 -0
  297. package/dist/src/execution/tasks/steps.js +1 -0
  298. package/dist/src/execution/tasks/table.d.ts +192 -0
  299. package/dist/src/execution/tasks/table.js +1 -0
  300. package/dist/src/execution/tasks/task-id-input.d.ts +19 -0
  301. package/dist/src/execution/tasks/task-id-input.js +1 -0
  302. package/dist/src/execution/tasks/tool-entry-point.d.ts +11 -0
  303. package/dist/src/execution/tasks/tool-entry-point.js +1 -0
  304. package/dist/src/execution/tasks/workflow-target.d.ts +2 -0
  305. package/dist/src/execution/tasks/workflow-target.js +1 -1
  306. package/dist/src/execution/terminal-session-completion-step.js +1 -1
  307. package/dist/src/execution/terminal-session-failure-step.js +1 -1
  308. package/dist/src/execution/terminate-child-sessions-step.d.ts +2 -9
  309. package/dist/src/execution/terminate-child-sessions-step.js +1 -1
  310. package/dist/src/execution/tool-auth.js +1 -1
  311. package/dist/src/execution/tools/agent-router-workflow.d.ts +1 -1
  312. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  313. package/dist/src/execution/tools/agent-router.d.ts +1 -1
  314. package/dist/src/execution/tools/agent-router.js +1 -1
  315. package/dist/src/execution/tools/connection-approval.d.ts +25 -0
  316. package/dist/src/execution/tools/connection-approval.js +1 -0
  317. package/dist/src/execution/tools/connection-search-rank.d.ts +21 -0
  318. package/dist/src/execution/tools/connection-search-rank.js +1 -0
  319. package/dist/src/execution/tools/connection-target.d.ts +13 -0
  320. package/dist/src/execution/tools/connection-target.js +1 -0
  321. package/dist/src/execution/tools/connection-tools.d.ts +10 -0
  322. package/dist/src/execution/tools/connection-tools.js +2 -0
  323. package/dist/src/execution/tools/load-skill.js +1 -1
  324. package/dist/src/execution/tools/workflow/answer.d.ts +7 -4
  325. package/dist/src/execution/tools/workflow/answer.js +1 -1
  326. package/dist/src/execution/tools/workflow/ask.d.ts +73 -10
  327. package/dist/src/execution/tools/workflow/ask.js +1 -1
  328. package/dist/src/execution/tools/workflow/body.d.ts +60 -19
  329. package/dist/src/execution/tools/workflow/body.js +1 -1
  330. package/dist/src/execution/tools/workflow/cancel.d.ts +7 -2
  331. package/dist/src/execution/tools/workflow/cancel.js +1 -1
  332. package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.d.ts +10 -4
  333. package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.js +1 -1
  334. package/dist/src/execution/tools/workflow/{background.d.ts → harness-definition.d.ts} +6 -6
  335. package/dist/src/execution/tools/workflow/harness-definition.js +1 -0
  336. package/dist/src/execution/tools/workflow/interrupt.d.ts +6 -0
  337. package/dist/src/execution/tools/workflow/interrupt.js +1 -0
  338. package/dist/src/execution/tools/workflow/messages.d.ts +135 -10
  339. package/dist/src/execution/tools/workflow/messages.js +1 -1
  340. package/dist/src/execution/tools/workflow/owner-inbox.js +1 -1
  341. package/dist/src/execution/tools/workflow/owner.d.ts +15 -4
  342. package/dist/src/execution/tools/workflow/owner.js +1 -1
  343. package/dist/src/execution/tools/workflow/serve.d.ts +3 -0
  344. package/dist/src/execution/tools/workflow/serve.js +1 -0
  345. package/dist/src/execution/tools/workflow/start.d.ts +18 -11
  346. package/dist/src/execution/tools/workflow/start.js +1 -1
  347. package/dist/src/execution/tools/workflow/step-execution.js +1 -1
  348. package/dist/src/execution/tools/workflow/step.js +1 -1
  349. package/dist/src/execution/tools/workflow/types.d.ts +0 -10
  350. package/dist/src/execution/tools/workflow/withdraw-step.d.ts +31 -0
  351. package/dist/src/execution/tools/workflow/withdraw-step.js +1 -0
  352. package/dist/src/execution/tools/workflow/workflow-owner-blocking.d.ts +3 -5
  353. package/dist/src/execution/tools/workflow/workflow-owner-blocking.js +1 -1
  354. package/dist/src/execution/tools/workflow/workflow.d.ts +3 -3
  355. package/dist/src/execution/tools/workflow/workflow.js +1 -1
  356. package/dist/src/execution/web-fetch/request.js +1 -1
  357. package/dist/src/execution/workflow-callback-url.d.ts +0 -5
  358. package/dist/src/execution/workflow-callback-url.js +1 -1
  359. package/dist/src/execution/workflow-runtime.d.ts +3 -5
  360. package/dist/src/execution/workflow-runtime.js +1 -1
  361. package/dist/src/execution/workflow-webhook-route.js +1 -1
  362. package/dist/src/extensions/code/extension/lib/connect-authentication.js +1 -1
  363. package/dist/src/extensions/code/extension/lib/github-shell.js +1 -1
  364. package/dist/src/extensions/code/extension/lib/prwatch-github.js +1 -1
  365. package/dist/src/framework/sources/modules/agent.d.ts +1 -0
  366. package/dist/src/framework/sources/modules/agent.js +1 -1
  367. package/dist/src/framework/sources/registry.js +1 -1
  368. package/dist/src/harness/action-presentation.js +1 -1
  369. package/dist/src/harness/action-result-helpers.d.ts +1 -0
  370. package/dist/src/harness/action-result-helpers.js +1 -1
  371. package/dist/src/harness/advertised-tools.d.ts +1 -1
  372. package/dist/src/harness/advertised-tools.js +1 -1
  373. package/dist/src/harness/announcements.d.ts +22 -0
  374. package/dist/src/harness/announcements.js +1 -0
  375. package/dist/src/harness/approval-candidates.d.ts +10 -2
  376. package/dist/src/harness/approval-candidates.js +1 -1
  377. package/dist/src/harness/approval-delivery-coordinator.d.ts +4 -5
  378. package/dist/src/harness/approval-delivery-coordinator.js +1 -1
  379. package/dist/src/harness/approval-recheck.d.ts +7 -0
  380. package/dist/src/harness/approval-recheck.js +1 -0
  381. package/dist/src/harness/authorization-event-fields.d.ts +13 -0
  382. package/dist/src/harness/authorization-event-fields.js +1 -0
  383. package/dist/src/harness/authorization.d.ts +2 -1
  384. package/dist/src/harness/authorization.js +1 -1
  385. package/dist/src/harness/coordination.d.ts +31 -27
  386. package/dist/src/harness/coordination.js +1 -1
  387. package/dist/src/harness/current-messages.d.ts +6 -1
  388. package/dist/src/harness/current-messages.js +1 -1
  389. package/dist/src/harness/emission.d.ts +7 -1
  390. package/dist/src/harness/emission.js +1 -1
  391. package/dist/src/harness/execute-tool.d.ts +4 -15
  392. package/dist/src/harness/hitl/session-limit-input-requests.d.ts +2 -0
  393. package/dist/src/harness/hitl/session-limit-input-requests.js +1 -1
  394. package/dist/src/harness/input-request-resolution.d.ts +5 -2
  395. package/dist/src/harness/input-request-resolution.js +1 -1
  396. package/dist/src/harness/input-requests.js +1 -1
  397. package/dist/src/harness/messages.d.ts +11 -3
  398. package/dist/src/harness/messages.js +1 -1
  399. package/dist/src/harness/nested-actions.d.ts +23 -0
  400. package/dist/src/harness/nested-actions.js +1 -0
  401. package/dist/src/harness/pending-input-batches.d.ts +8 -6
  402. package/dist/src/harness/pending-input-batches.js +1 -1
  403. package/dist/src/harness/provider-tool-history.d.ts +7 -2
  404. package/dist/src/harness/provider-tool-history.js +1 -1
  405. package/dist/src/harness/proxy-input-requests.d.ts +41 -36
  406. package/dist/src/harness/proxy-input-requests.js +1 -1
  407. package/dist/src/harness/session-limit-enforcement.js +1 -1
  408. package/dist/src/harness/stale-input-responses.js +1 -1
  409. package/dist/src/harness/step-hooks.js +1 -1
  410. package/dist/src/harness/tool-loop.js +2 -2
  411. package/dist/src/harness/tool-model-output.js +1 -1
  412. package/dist/src/harness/tool-presentation.js +1 -1
  413. package/dist/src/harness/tools.d.ts +1 -5
  414. package/dist/src/harness/tools.js +1 -1
  415. package/dist/src/harness/turn-tag-state.d.ts +6 -5
  416. package/dist/src/harness/types.d.ts +7 -15
  417. package/dist/src/harness/workflow-dispatch.d.ts +30 -0
  418. package/dist/src/harness/workflow-dispatch.js +1 -0
  419. package/dist/src/harness/workflow-tool-runs.d.ts +5 -65
  420. package/dist/src/harness/workflow-tool-runs.js +1 -1
  421. package/dist/src/instrumentation/lifecycle.d.ts +3 -0
  422. package/dist/src/instrumentation/native-events.d.ts +0 -7
  423. package/dist/src/instrumentation/native-events.js +1 -1
  424. package/dist/src/instrumentation/runtime.d.ts +1 -4
  425. package/dist/src/instrumentation/runtime.js +1 -1
  426. package/dist/src/instrumentation/state.d.ts +0 -6
  427. package/dist/src/instrumentation/state.js +1 -1
  428. package/dist/src/internal/application/package.js +1 -1
  429. package/dist/src/internal/authored-definition/schema-backed.d.ts +10 -0
  430. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  431. package/dist/src/internal/authored-module-loader.d.ts +12 -6
  432. package/dist/src/internal/authored-module-loader.js +2 -2
  433. package/dist/src/internal/authored-module-map-loader.js +1 -1
  434. package/dist/src/internal/authored-package-boundary.d.ts +3 -0
  435. package/dist/src/internal/authored-package-boundary.js +1 -1
  436. package/dist/src/internal/bundler/extension-mount-plugin.d.ts +14 -0
  437. package/dist/src/internal/bundler/extension-mount-plugin.js +1 -0
  438. package/dist/src/internal/bundler/extension-scope-plugin.d.ts +8 -11
  439. package/dist/src/internal/bundler/extension-scope-plugin.js +2 -3
  440. package/dist/src/internal/invocation/workflow-execution.d.ts +2 -2
  441. package/dist/src/internal/invocation/workflow-execution.js +1 -1
  442. package/dist/src/internal/mount-state.d.ts +1 -0
  443. package/dist/src/internal/mount-state.js +1 -0
  444. package/dist/src/internal/nitro/host/build-application.js +1 -1
  445. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  446. package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
  447. package/dist/src/internal/nitro/host/extension-capability-requirements.js +1 -1
  448. package/dist/src/internal/nitro/host/workspace-extensions.js +1 -1
  449. package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
  450. package/dist/src/internal/node-esm-compat-banner.js +1 -1
  451. package/dist/src/internal/workflow/development-world-client.js +1 -1
  452. package/dist/src/internal/workflow-bundle/authored-workflow-directives.d.ts +4 -3
  453. package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -1
  454. package/dist/src/internal/workflow-bundle/builder.js +1 -1
  455. package/dist/src/internal/workflow-bundle/dynamic-capability-transform-plugin.js +1 -1
  456. package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
  457. package/dist/src/models/auto.d.ts +6 -0
  458. package/dist/src/models/auto.js +2 -2
  459. package/dist/src/protocol/message-version.d.ts +1 -0
  460. package/dist/src/protocol/message-version.js +1 -1
  461. package/dist/src/protocol/message.d.ts +126 -67
  462. package/dist/src/protocol/message.js +2 -2
  463. package/dist/src/protocol/remote-agent-protocol.d.ts +16 -0
  464. package/dist/src/protocol/remote-agent-protocol.js +1 -0
  465. package/dist/src/protocol/routes.d.ts +0 -6
  466. package/dist/src/protocol/routes.js +1 -1
  467. package/dist/src/protocol/task-tools.d.ts +21 -0
  468. package/dist/src/protocol/task-tools.js +1 -0
  469. package/dist/src/public/channels/auth.js +1 -1
  470. package/dist/src/public/channels/chat-sdk/chatSdkChannel.d.ts +25 -16
  471. package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +2 -2
  472. package/dist/src/public/channels/chat-sdk/index.d.ts +1 -1
  473. package/dist/src/public/channels/chat-sdk/input-actions.d.ts +8 -0
  474. package/dist/src/public/channels/chat-sdk/input-actions.js +1 -0
  475. package/dist/src/public/channels/index.d.ts +1 -1
  476. package/dist/src/public/channels/linq/linqChannel.js +1 -1
  477. package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
  478. package/dist/src/public/channels/slack/action-status.d.ts +11 -12
  479. package/dist/src/public/channels/slack/action-status.js +1 -1
  480. package/dist/src/public/channels/slack/api.js +1 -1
  481. package/dist/src/public/channels/slack/attachments.js +1 -1
  482. package/dist/src/public/channels/slack/auth.d.ts +3 -0
  483. package/dist/src/public/channels/slack/auth.js +1 -1
  484. package/dist/src/public/channels/slack/connections.d.ts +6 -6
  485. package/dist/src/public/channels/slack/connections.js +1 -1
  486. package/dist/src/public/channels/slack/defaults.d.ts +13 -19
  487. package/dist/src/public/channels/slack/defaults.js +4 -4
  488. package/dist/src/public/channels/slack/hitl.d.ts +22 -13
  489. package/dist/src/public/channels/slack/hitl.js +2 -2
  490. package/dist/src/public/channels/slack/index.d.ts +4 -3
  491. package/dist/src/public/channels/slack/index.js +1 -1
  492. package/dist/src/public/channels/slack/input-response.d.ts +1 -5
  493. package/dist/src/public/channels/slack/input-response.js +1 -1
  494. package/dist/src/public/channels/slack/interaction-cards.js +1 -1
  495. package/dist/src/public/channels/slack/interactions.js +1 -1
  496. package/dist/src/public/channels/slack/renderers.d.ts +76 -0
  497. package/dist/src/public/channels/slack/renderers.js +1 -0
  498. package/dist/src/public/channels/slack/session-operations.d.ts +6 -0
  499. package/dist/src/public/channels/slack/session-operations.js +1 -1
  500. package/dist/src/public/channels/slack/slackChannel.d.ts +47 -103
  501. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  502. package/dist/src/public/channels/slack/task-card.d.ts +24 -0
  503. package/dist/src/public/channels/slack/task-card.js +1 -0
  504. package/dist/src/public/channels/telegram/hitl.d.ts +7 -1
  505. package/dist/src/public/channels/telegram/hitl.js +2 -1
  506. package/dist/src/public/channels/telegram/state.js +1 -1
  507. package/dist/src/public/channels/telegram/telegramChannel.d.ts +5 -0
  508. package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
  509. package/dist/src/public/definitions/channel.d.ts +6 -1
  510. package/dist/src/public/definitions/channel.js +1 -1
  511. package/dist/src/public/definitions/connections/mcp.d.ts +4 -6
  512. package/dist/src/public/definitions/connections/openapi.d.ts +7 -8
  513. package/dist/src/public/definitions/extension.d.ts +2 -2
  514. package/dist/src/public/definitions/extension.js +1 -1
  515. package/dist/src/public/definitions/hook.d.ts +4 -4
  516. package/dist/src/public/definitions/state.d.ts +4 -2
  517. package/dist/src/public/definitions/state.js +1 -1
  518. package/dist/src/public/memory/index.d.ts +0 -1
  519. package/dist/src/public/models/openai/index.d.ts +1 -1
  520. package/dist/src/public/models/openai/index.js +1 -1
  521. package/dist/src/public/schedules/index.d.ts +1 -0
  522. package/dist/src/public/schedules/index.js +1 -1
  523. package/dist/src/public/server/index.d.ts +28 -0
  524. package/dist/src/public/server/index.js +1 -0
  525. package/dist/src/public/tools/index.d.ts +3 -2
  526. package/dist/src/public/tools/index.js +1 -1
  527. package/dist/src/public/tools/no-reply.d.ts +1 -0
  528. package/dist/src/public/tools/no-reply.js +1 -0
  529. package/dist/src/runtime/agent/bootstrap-model-utils.d.ts +6 -7
  530. package/dist/src/runtime/agent/bootstrap-model-utils.js +1 -1
  531. package/dist/src/runtime/agent/bootstrap.d.ts +0 -1
  532. package/dist/src/runtime/agent/bootstrap.js +1 -1
  533. package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
  534. package/dist/src/runtime/agent/mock-model-fixtures.d.ts +1 -1
  535. package/dist/src/runtime/agent/mock-model-fixtures.js +2 -2
  536. package/dist/src/runtime/channels/registry.js +1 -1
  537. package/dist/src/runtime/connections/mcp-client.d.ts +1 -9
  538. package/dist/src/runtime/connections/mcp-client.js +1 -1
  539. package/dist/src/runtime/connections/openapi-client.js +1 -1
  540. package/dist/src/runtime/connections/scoped-authorization.d.ts +1 -1
  541. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  542. package/dist/src/runtime/connections/tool-result.d.ts +27 -0
  543. package/dist/src/runtime/connections/tool-result.js +2 -0
  544. package/dist/src/runtime/connections/tool-signature.d.ts +14 -0
  545. package/dist/src/runtime/connections/tool-signature.js +1 -0
  546. package/dist/src/runtime/local-dev-capability.js +1 -1
  547. package/dist/src/runtime/prompt/compose.d.ts +1 -3
  548. package/dist/src/runtime/prompt/compose.js +3 -3
  549. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  550. package/dist/src/runtime/resolve-tool.js +1 -1
  551. package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
  552. package/dist/src/runtime/sessions/runtime-context-keys.js +1 -1
  553. package/dist/src/runtime/sessions/turn.d.ts +1 -16
  554. package/dist/src/runtime/subagents/dynamic-remote-agent-config.js +1 -1
  555. package/dist/src/runtime/subagents/registry.js +1 -1
  556. package/dist/src/runtime/subagents/workflow-reference.d.ts +6 -3
  557. package/dist/src/runtime/subagents/workflow-reference.js +1 -1
  558. package/dist/src/runtime/subagents/workflow.d.ts +12 -6
  559. package/dist/src/runtime/subagents/workflow.js +1 -1
  560. package/dist/src/runtime/tools/registry.js +1 -1
  561. package/dist/src/self-modification/extension/classify-registry-item.d.ts +3 -0
  562. package/dist/src/self-modification/extension/classify-registry-item.js +1 -1
  563. package/dist/src/self-modification/extension/subagents/agent/agent.d.ts +1 -1
  564. package/dist/src/self-modification/extension/subagents/agent/agent.js +1 -1
  565. package/dist/src/self-modification/extension/subagents/agent/instructions.js +7 -7
  566. package/dist/src/self-modification/extension/subagents/agent/tools/registry_add.js +1 -1
  567. package/dist/src/self-modification/extension/subagents/agent/tools/search_registry.d.ts +2 -0
  568. package/dist/src/self-modification/extension/subagents/agent/tools/search_registry.js +1 -1
  569. package/dist/src/self-modification/scaffold.d.ts +2 -0
  570. package/dist/src/self-modification/scaffold.js +7 -0
  571. package/dist/src/self-modification/setup.js +1 -7
  572. package/dist/src/setup/boxes/select-model.js +1 -1
  573. package/dist/src/setup/integrations/shopify/templates.d.ts +1 -1
  574. package/dist/src/setup/integrations/shopify/templates.js +31 -19
  575. package/dist/src/setup/scaffold/create/agent-paths.d.ts +5 -0
  576. package/dist/src/setup/scaffold/create/agent-paths.js +1 -0
  577. package/dist/src/setup/scaffold/create/instructions-template.d.ts +1 -0
  578. package/dist/src/setup/scaffold/create/instructions-template.js +8 -0
  579. package/dist/src/setup/scaffold/create/project.js +3 -10
  580. package/dist/src/shared/action-request-name.d.ts +3 -0
  581. package/dist/src/shared/action-request-name.js +1 -0
  582. package/dist/src/shared/action-types.d.ts +49 -21
  583. package/dist/src/shared/action-types.js +1 -1
  584. package/dist/src/shared/agent-definition.d.ts +0 -7
  585. package/dist/src/shared/chatgpt-model.d.ts +1 -1
  586. package/dist/src/shared/chatgpt-model.js +1 -1
  587. package/dist/src/shared/connection-types.d.ts +2 -8
  588. package/dist/src/shared/default-agent-model.d.ts +10 -1
  589. package/dist/src/shared/default-agent-model.js +1 -1
  590. package/dist/src/shared/extension-mount.d.ts +2 -0
  591. package/dist/src/shared/extension-mount.js +1 -0
  592. package/dist/src/shared/format-duration.d.ts +2 -0
  593. package/dist/src/shared/format-duration.js +1 -0
  594. package/dist/src/shared/input.d.ts +1 -0
  595. package/dist/src/shared/memory-state.d.ts +1 -0
  596. package/dist/src/shared/memory-state.js +1 -1
  597. package/dist/src/shared/model-helper.d.ts +2 -2
  598. package/dist/src/shared/model-helper.js +1 -1
  599. package/dist/src/shared/model-summary.d.ts +2 -6
  600. package/dist/src/shared/model-summary.js +1 -1
  601. package/dist/src/shared/presentation-text.d.ts +5 -0
  602. package/dist/src/shared/presentation-text.js +1 -1
  603. package/dist/src/shared/serialized-observability-state.d.ts +0 -4
  604. package/dist/src/shared/serialized-observability-state.js +1 -1
  605. package/dist/src/shared/value-delta.d.ts +39 -0
  606. package/dist/src/shared/value-delta.js +1 -0
  607. package/dist/src/subagents/adapter-state.d.ts +0 -2
  608. package/dist/src/subagents/adapter-state.js +1 -1
  609. package/dist/src/subagents/adapter.js +1 -1
  610. package/dist/src/subagents/callback-route.js +1 -1
  611. package/dist/src/subagents/event-proxy-step.d.ts +16 -29
  612. package/dist/src/subagents/event-proxy-step.js +1 -1
  613. package/dist/src/subagents/hitl-proxy.d.ts +35 -17
  614. package/dist/src/subagents/hitl-proxy.js +1 -1
  615. package/dist/src/subagents/invocation.d.ts +1 -2
  616. package/dist/src/subagents/parent-notification.d.ts +2 -1
  617. package/dist/src/subagents/parent-notification.js +1 -1
  618. package/dist/src/subagents/token-budget.d.ts +8 -9
  619. package/dist/src/subagents/token-budget.js +1 -1
  620. package/dist/src/subagents/tool.d.ts +6 -12
  621. package/dist/src/subagents/tool.js +1 -1
  622. package/dist/src/svelte/index.js +1 -1
  623. package/dist/src/svelte/use-eve-agent.js +1 -1
  624. package/dist/src/tools/behavior.d.ts +5 -5
  625. package/dist/src/tools/definition.d.ts +50 -14
  626. package/dist/src/tools/definition.js +1 -1
  627. package/dist/src/tools/durable-callbacks.d.ts +1 -1
  628. package/dist/src/tools/dynamic.d.ts +6 -0
  629. package/dist/src/tools/framework/agent-contract.d.ts +2 -5
  630. package/dist/src/tools/framework/agent-contract.js +1 -1
  631. package/dist/src/tools/framework/agent.d.ts +2 -5
  632. package/dist/src/tools/framework/agent.js +1 -1
  633. package/dist/src/tools/framework/connection-tools.d.ts +3 -0
  634. package/dist/src/tools/framework/connection-tools.js +1 -0
  635. package/dist/src/tools/provided/agent-router.d.ts +6 -3
  636. package/dist/src/tools/provided/agent-router.js +1 -1
  637. package/dist/src/{execution/tools → tools/provided}/ask-question-workflow.d.ts +3 -4
  638. package/dist/src/tools/provided/ask-question-workflow.js +1 -0
  639. package/dist/src/tools/provided/ask-question.d.ts +20 -5
  640. package/dist/src/tools/provided/ask-question.js +2 -1
  641. package/dist/src/tools/provided/interrupted.d.ts +18 -0
  642. package/dist/src/tools/provided/interrupted.js +1 -0
  643. package/dist/src/tools/provided/no-reply.d.ts +19 -0
  644. package/dist/src/tools/provided/no-reply.js +1 -0
  645. package/dist/src/tools/provided/sleep-workflow.d.ts +4 -0
  646. package/dist/src/tools/provided/sleep-workflow.js +1 -0
  647. package/dist/src/tools/provided/sleep.d.ts +11 -5
  648. package/dist/src/tools/provided/sleep.js +1 -1
  649. package/dist/src/tools/provided/task-cancel.d.ts +6 -0
  650. package/dist/src/tools/provided/task-cancel.js +1 -0
  651. package/dist/src/tools/provided/task-wait.d.ts +9 -0
  652. package/dist/src/tools/provided/task-wait.js +1 -0
  653. package/dist/src/tools/provided/workflow.d.ts +2 -2
  654. package/dist/src/tools/provided/workflow.js +1 -1
  655. package/dist/src/tools/schema-emission.d.ts +23 -0
  656. package/dist/src/tools/schema-emission.js +1 -0
  657. package/dist/src/tools/schema.d.ts +22 -8
  658. package/dist/src/tools/schema.js +1 -1
  659. package/dist/src/tools/workflow-definition.d.ts +187 -85
  660. package/dist/src/tools/workflow-definition.js +1 -1
  661. package/dist/src/tools/workflow-entry-point.d.ts +3 -0
  662. package/dist/src/tools/workflow-entry-point.js +1 -0
  663. package/dist/src/tracing/agent-action-instrumentation.d.ts +1 -3
  664. package/dist/src/tracing/agent-action-instrumentation.js +1 -1
  665. package/dist/src/tracing/agent-invocation-coordinator.d.ts +9 -18
  666. package/dist/src/tracing/agent-invocation-coordinator.js +1 -1
  667. package/dist/src/tracing/agent-otel-content.d.ts +0 -2
  668. package/dist/src/tracing/agent-otel-content.js +3 -3
  669. package/dist/src/tracing/agent-otel-provider.js +2 -2
  670. package/dist/src/tracing/agent-otel-runtime-context.d.ts +20 -0
  671. package/dist/src/tracing/agent-otel-runtime-context.js +1 -1
  672. package/dist/src/tracing/agent-otel-usage.js +1 -1
  673. package/dist/src/tracing/agent-span-contract.d.ts +1 -1
  674. package/dist/src/tracing/agent-span-contract.js +1 -1
  675. package/dist/src/tracing/agent-span-id-generator.d.ts +0 -1
  676. package/dist/src/tracing/agent-span-id-generator.js +1 -1
  677. package/dist/src/tracing/agent-trace-context-codec.d.ts +1 -2
  678. package/dist/src/tracing/agent-trace-context-codec.js +1 -1
  679. package/dist/src/tracing/agent-trace-context-store.d.ts +2 -27
  680. package/dist/src/tracing/agent-trace-context-store.js +1 -1
  681. package/dist/src/tracing/agent-trace-state.d.ts +1 -19
  682. package/dist/src/tracing/content-attributes.js +1 -1
  683. package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
  684. package/dist/src/vue/index.js +1 -1
  685. package/dist/src/vue/use-eve-agent.js +1 -1
  686. package/docs/agent-config.md +36 -13
  687. package/docs/channels/chat-sdk.mdx +15 -4
  688. package/docs/channels/custom.mdx +89 -17
  689. package/docs/channels/eve.mdx +1 -1
  690. package/docs/channels/mcp.mdx +1 -1
  691. package/docs/channels/overview.mdx +14 -56
  692. package/docs/channels/slack.mdx +230 -35
  693. package/docs/channels/telegram.mdx +2 -0
  694. package/docs/concepts/built-in-tools.md +36 -28
  695. package/docs/concepts/context-control.md +2 -2
  696. package/docs/concepts/execution-model-and-durability.mdx +10 -11
  697. package/docs/concepts/sessions-runs-and-streaming.md +67 -47
  698. package/docs/connections/mcp.mdx +4 -4
  699. package/docs/connections/openapi.mdx +2 -2
  700. package/docs/connections/overview.mdx +2 -2
  701. package/docs/evals/assertions.mdx +5 -5
  702. package/docs/evals/cases.mdx +1 -1
  703. package/docs/evals/reporters.mdx +6 -4
  704. package/docs/extensions.md +11 -2
  705. package/docs/guides/client/streaming.mdx +31 -11
  706. package/docs/guides/dev-tui.md +13 -3
  707. package/docs/guides/dynamic-capabilities.md +5 -3
  708. package/docs/guides/evaluate.md +29 -2
  709. package/docs/guides/frontend/overview.mdx +5 -7
  710. package/docs/guides/hooks.md +16 -12
  711. package/docs/guides/instrumentation/instrumentation.mdx +2 -0
  712. package/docs/guides/remote-agents.md +12 -14
  713. package/docs/guides/self-modification.md +10 -0
  714. package/docs/instructions.mdx +1 -1
  715. package/docs/patterns/multi-tenant-approvals.md +1 -1
  716. package/docs/protocols/ucp.mdx +20 -16
  717. package/docs/reference/cli.md +61 -8
  718. package/docs/reference/typescript-api.md +43 -41
  719. package/docs/schedules.mdx +14 -34
  720. package/docs/subagents/index.mdx +24 -56
  721. package/docs/tools/human-in-the-loop.md +48 -13
  722. package/docs/tools/meta.json +1 -1
  723. package/docs/tools/overview.mdx +79 -59
  724. package/docs/tools/tasks-upgrade.md +201 -0
  725. package/docs/tools/tasks.md +315 -0
  726. package/docs/tools/workflows.mdx +368 -154
  727. package/package.json +18 -12
  728. package/dist/src/channel/activity-renderer.d.ts +0 -21
  729. package/dist/src/channel/activity-renderer.js +0 -1
  730. package/dist/src/channel/activity-sink.d.ts +0 -2
  731. package/dist/src/channel/activity-sink.js +0 -1
  732. package/dist/src/eve-channel/activity-observer-request.d.ts +0 -7
  733. package/dist/src/eve-channel/activity-observer-request.js +0 -1
  734. package/dist/src/eve-channel/delivery-policy-request.d.ts +0 -4
  735. package/dist/src/eve-channel/delivery-policy-request.js +0 -1
  736. package/dist/src/execution/activity-cohort.d.ts +0 -20
  737. package/dist/src/execution/activity-cohort.js +0 -1
  738. package/dist/src/execution/activity-collector.d.ts +0 -12
  739. package/dist/src/execution/activity-collector.js +0 -1
  740. package/dist/src/execution/activity-events.d.ts +0 -8
  741. package/dist/src/execution/activity-events.js +0 -1
  742. package/dist/src/execution/activity-route.d.ts +0 -2
  743. package/dist/src/execution/activity-route.js +0 -1
  744. package/dist/src/execution/activity-work-id.d.ts +0 -9
  745. package/dist/src/execution/activity-work-id.js +0 -1
  746. package/dist/src/execution/activity-work.d.ts +0 -30
  747. package/dist/src/execution/activity-work.js +0 -1
  748. package/dist/src/execution/cancel-indexed-session-tasks-step.d.ts +0 -7
  749. package/dist/src/execution/cancel-indexed-session-tasks-step.js +0 -1
  750. package/dist/src/execution/dispatch-action-failures.d.ts +0 -8
  751. package/dist/src/execution/dispatch-action-failures.js +0 -1
  752. package/dist/src/execution/dispatch-start-operation.d.ts +0 -15
  753. package/dist/src/execution/dispatch-start-operation.js +0 -1
  754. package/dist/src/execution/publish-channel-event.d.ts +0 -23
  755. package/dist/src/execution/publish-channel-event.js +0 -1
  756. package/dist/src/execution/scheduled-launch-delivery.d.ts +0 -7
  757. package/dist/src/execution/scheduled-launch-delivery.js +0 -1
  758. package/dist/src/execution/session/event-sink.d.ts +0 -26
  759. package/dist/src/execution/session/event-sink.js +0 -1
  760. package/dist/src/execution/session-activity-projection.d.ts +0 -16
  761. package/dist/src/execution/session-activity-projection.js +0 -1
  762. package/dist/src/execution/session-activity-renderer-step.d.ts +0 -15
  763. package/dist/src/execution/session-activity-renderer-step.js +0 -1
  764. package/dist/src/execution/session-activity.d.ts +0 -3
  765. package/dist/src/execution/session-activity.js +0 -1
  766. package/dist/src/execution/submit-activity.d.ts +0 -7
  767. package/dist/src/execution/submit-activity.js +0 -1
  768. package/dist/src/execution/task-event-callback.d.ts +0 -12
  769. package/dist/src/execution/task-event-callback.js +0 -1
  770. package/dist/src/execution/task-input-capability.d.ts +0 -4
  771. package/dist/src/execution/task-input-capability.js +0 -1
  772. package/dist/src/execution/task-input-response-route.d.ts +0 -2
  773. package/dist/src/execution/task-input-response-route.js +0 -1
  774. package/dist/src/execution/tasks/child/notify.d.ts +0 -44
  775. package/dist/src/execution/tasks/child/notify.js +0 -1
  776. package/dist/src/execution/tasks/parent/control-shared.d.ts +0 -23
  777. package/dist/src/execution/tasks/parent/control-shared.js +0 -1
  778. package/dist/src/execution/tasks/parent/delegate.d.ts +0 -35
  779. package/dist/src/execution/tasks/parent/delegate.js +0 -1
  780. package/dist/src/execution/tasks/parent/dispatch.d.ts +0 -22
  781. package/dist/src/execution/tasks/parent/dispatch.js +0 -1
  782. package/dist/src/execution/tasks/parent/hitl-proxy-steps.d.ts +0 -27
  783. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +0 -1
  784. package/dist/src/execution/tasks/parent/run-parent.d.ts +0 -58
  785. package/dist/src/execution/tasks/parent/run-parent.js +0 -1
  786. package/dist/src/execution/tasks/parent/subagent-task-projection.d.ts +0 -26
  787. package/dist/src/execution/tasks/parent/subagent-task-projection.js +0 -1
  788. package/dist/src/execution/tasks/parent/task-cancel.d.ts +0 -12
  789. package/dist/src/execution/tasks/parent/task-cancel.js +0 -1
  790. package/dist/src/execution/tasks/parent/tool-execution.d.ts +0 -45
  791. package/dist/src/execution/tasks/parent/tool-execution.js +0 -1
  792. package/dist/src/execution/terminal-session-event.d.ts +0 -13
  793. package/dist/src/execution/terminal-session-event.js +0 -1
  794. package/dist/src/execution/tools/ask-question-workflow.js +0 -1
  795. package/dist/src/execution/tools/ask-question.d.ts +0 -19
  796. package/dist/src/execution/tools/ask-question.js +0 -2
  797. package/dist/src/execution/tools/connection-search.d.ts +0 -2
  798. package/dist/src/execution/tools/connection-search.js +0 -2
  799. package/dist/src/execution/tools/sleep-workflow.d.ts +0 -3
  800. package/dist/src/execution/tools/sleep-workflow.js +0 -1
  801. package/dist/src/execution/tools/sleep.d.ts +0 -10
  802. package/dist/src/execution/tools/sleep.js +0 -1
  803. package/dist/src/execution/tools/subagent/accept-event-step.d.ts +0 -7
  804. package/dist/src/execution/tools/subagent/accept-event-step.js +0 -1
  805. package/dist/src/execution/tools/subagent/emit-event-step.d.ts +0 -12
  806. package/dist/src/execution/tools/subagent/emit-event-step.js +0 -1
  807. package/dist/src/execution/tools/subagent/invoke-agent.d.ts +0 -42
  808. package/dist/src/execution/tools/subagent/invoke-agent.js +0 -1
  809. package/dist/src/execution/tools/subagent/invoke-preparation.d.ts +0 -44
  810. package/dist/src/execution/tools/subagent/invoke-preparation.js +0 -1
  811. package/dist/src/execution/tools/subagent/invoke-step.d.ts +0 -64
  812. package/dist/src/execution/tools/subagent/invoke-step.js +0 -1
  813. package/dist/src/execution/tools/subagent/receipt-identity.d.ts +0 -11
  814. package/dist/src/execution/tools/subagent/receipt-identity.js +0 -1
  815. package/dist/src/execution/tools/subagent/start.d.ts +0 -51
  816. package/dist/src/execution/tools/subagent/start.js +0 -1
  817. package/dist/src/execution/tools/subagent/steer.d.ts +0 -13
  818. package/dist/src/execution/tools/subagent/steer.js +0 -1
  819. package/dist/src/execution/tools/subagent/task-agent-requests.d.ts +0 -24
  820. package/dist/src/execution/tools/subagent/task-agent-requests.js +0 -1
  821. package/dist/src/execution/tools/subagent/task-cancel.d.ts +0 -10
  822. package/dist/src/execution/tools/subagent/task-cancel.js +0 -1
  823. package/dist/src/execution/tools/tasks.d.ts +0 -3
  824. package/dist/src/execution/tools/tasks.js +0 -1
  825. package/dist/src/execution/tools/workflow/background.js +0 -1
  826. package/dist/src/execution/tools/workflow/workflow-owner-background.d.ts +0 -14
  827. package/dist/src/execution/tools/workflow/workflow-owner-background.js +0 -1
  828. package/dist/src/harness/background-tools.d.ts +0 -45
  829. package/dist/src/harness/background-tools.js +0 -1
  830. package/dist/src/instrumentation/background-task-runtime.d.ts +0 -18
  831. package/dist/src/instrumentation/background-task-runtime.js +0 -1
  832. package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.3.0/node_modules/@vercel/cli-config/dist/index.js +0 -21
  833. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/envpath.js +0 -1
  834. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/errors.js +0 -2
  835. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/errutils.js +0 -1
  836. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/exec.js +0 -1
  837. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/fsutils.js +0 -1
  838. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/index.js +0 -1
  839. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/lookup.js +0 -1
  840. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/safety.js +0 -1
  841. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/authorization.js +0 -1
  842. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/connector.js +0 -1
  843. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/index.js +0 -1
  844. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/installation.js +0 -1
  845. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/internal/base-url.js +0 -1
  846. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/internal/default-scopes.js +0 -1
  847. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/internal/env.js +0 -1
  848. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/internal/url-validation.js +0 -1
  849. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/token.js +0 -1
  850. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/auth-errors.js +0 -1
  851. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/exchange-vercel-oidc-token.js +0 -1
  852. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/get-context.js +0 -1
  853. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-sync.js +0 -1
  854. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-with-refresh.js +0 -2
  855. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/index.js +0 -1
  856. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/oauth.js +0 -1
  857. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token-error.js +0 -1
  858. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token-io.js +0 -1
  859. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token-util.js +0 -2
  860. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token.js +0 -1
  861. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/verify-vercel-oidc-token.js +0 -1
  862. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/version.js +0 -1
  863. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js +0 -1
  864. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js +0 -1
  865. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js +0 -1
  866. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js +0 -1
  867. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js +0 -1
  868. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js +0 -1
  869. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/index.js +0 -1
  870. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/command.js +0 -1
  871. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/error.js +0 -2
  872. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/kill.js +0 -1
  873. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/promise.js +0 -1
  874. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stdio.js +0 -1
  875. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stream.js +0 -1
  876. package/dist/src/node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js +0 -1
  877. package/dist/src/node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js +0 -1
  878. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/core.js +0 -1
  879. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/main.js +0 -1
  880. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/realtime.js +0 -1
  881. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/signals.js +0 -1
  882. package/dist/src/node_modules/.pnpm/is-stream@2.0.1/node_modules/is-stream/index.js +0 -1
  883. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js +0 -1
  884. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js +0 -1
  885. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js +0 -1
  886. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/index.js +0 -1
  887. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/compact/decrypt.js +0 -1
  888. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/compact/encrypt.js +0 -1
  889. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/flattened/decrypt.js +0 -1
  890. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/flattened/encrypt.js +0 -1
  891. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/general/decrypt.js +0 -1
  892. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/general/encrypt.js +0 -1
  893. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwk/embedded.js +0 -1
  894. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwk/thumbprint.js +0 -1
  895. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwks/local.js +0 -1
  896. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwks/remote.js +0 -1
  897. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/compact/sign.js +0 -1
  898. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/compact/verify.js +0 -1
  899. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/flattened/sign.js +0 -1
  900. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/flattened/verify.js +0 -1
  901. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/general/sign.js +0 -1
  902. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/general/verify.js +0 -1
  903. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/decrypt.js +0 -1
  904. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/encrypt.js +0 -1
  905. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/produce.js +0 -1
  906. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/sign.js +0 -1
  907. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/unsecured.js +0 -1
  908. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/verify.js +0 -1
  909. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/export.js +0 -1
  910. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/generate_key_pair.js +0 -1
  911. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/generate_secret.js +0 -1
  912. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/import.js +0 -1
  913. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/aesgcmkw.js +0 -1
  914. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/buffer_utils.js +0 -1
  915. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/cek.js +0 -1
  916. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_iv_length.js +0 -1
  917. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_key_type.js +0 -1
  918. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_p2s.js +0 -1
  919. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/crypto_key.js +0 -1
  920. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/decrypt_key_management.js +0 -1
  921. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/encrypt_key_management.js +0 -1
  922. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/epoch.js +0 -1
  923. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/invalid_key_input.js +0 -1
  924. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_disjoint.js +0 -1
  925. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_jwk.js +0 -1
  926. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_object.js +0 -1
  927. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/iv.js +0 -1
  928. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/jwt_claims_set.js +0 -1
  929. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/private_symbols.js +0 -1
  930. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/secs.js +0 -1
  931. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/validate_algorithms.js +0 -1
  932. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/validate_crit.js +0 -1
  933. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/aeskw.js +0 -1
  934. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/asn1.js +0 -1
  935. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/base64url.js +0 -1
  936. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/cbc_tag.js +0 -1
  937. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/check_cek_length.js +0 -1
  938. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/check_key_length.js +0 -1
  939. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/ciphers.js +0 -1
  940. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/decrypt.js +0 -1
  941. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/digest.js +0 -1
  942. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/dsa_digest.js +0 -1
  943. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/ecdhes.js +0 -1
  944. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/encrypt.js +0 -1
  945. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/fetch_jwks.js +0 -1
  946. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/generate.js +0 -1
  947. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/get_named_curve.js +0 -1
  948. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/get_sign_verify_key.js +0 -1
  949. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/hmac_digest.js +0 -1
  950. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/is_key_like.js +0 -1
  951. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/is_key_object.js +0 -1
  952. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/jwk_to_key.js +0 -1
  953. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/key_to_jwk.js +0 -1
  954. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/node_key.js +0 -1
  955. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/normalize_key.js +0 -1
  956. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/pbes2kw.js +0 -1
  957. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/random.js +0 -1
  958. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/rsaes.js +0 -1
  959. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/runtime.js +0 -1
  960. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/sign.js +0 -1
  961. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/timing_safe_equal.js +0 -1
  962. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/verify.js +0 -1
  963. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/webcrypto.js +0 -1
  964. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/base64url.js +0 -1
  965. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/decode_jwt.js +0 -1
  966. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/decode_protected_header.js +0 -1
  967. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/errors.js +0 -1
  968. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/runtime.js +0 -1
  969. package/dist/src/node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js +0 -1
  970. package/dist/src/node_modules/.pnpm/mimic-fn@2.1.0/node_modules/mimic-fn/index.js +0 -1
  971. package/dist/src/node_modules/.pnpm/npm-run-path@4.0.1/node_modules/npm-run-path/index.js +0 -1
  972. package/dist/src/node_modules/.pnpm/onetime@5.1.2/node_modules/onetime/index.js +0 -1
  973. package/dist/src/node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js +0 -1
  974. package/dist/src/node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js +0 -1
  975. package/dist/src/node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js +0 -1
  976. package/dist/src/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js +0 -1
  977. package/dist/src/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js +0 -1
  978. package/dist/src/node_modules/.pnpm/strip-final-newline@2.0.0/node_modules/strip-final-newline/index.js +0 -2
  979. package/dist/src/node_modules/.pnpm/which@2.0.2/node_modules/which/which.js +0 -1
  980. package/dist/src/protocol/activity.d.ts +0 -112
  981. package/dist/src/protocol/activity.js +0 -1
  982. package/dist/src/protocol/agent-handle-error.d.ts +0 -13
  983. package/dist/src/protocol/agent-handle-error.js +0 -1
  984. package/dist/src/public/channels/slack/activity-plan.d.ts +0 -5
  985. package/dist/src/public/channels/slack/activity-plan.js +0 -1
  986. package/dist/src/public/channels/slack/activity.d.ts +0 -63
  987. package/dist/src/public/channels/slack/activity.js +0 -2
  988. package/dist/src/public/tools/connection-search.d.ts +0 -1
  989. package/dist/src/public/tools/connection-search.js +0 -1
  990. package/dist/src/public/tools/task-cancel.d.ts +0 -1
  991. package/dist/src/public/tools/task-cancel.js +0 -1
  992. package/dist/src/runtime/prompt/connections.d.ts +0 -9
  993. package/dist/src/runtime/prompt/connections.js +0 -2
  994. package/dist/src/shared/empty-delivery.d.ts +0 -3
  995. package/dist/src/shared/empty-delivery.js +0 -1
  996. package/dist/src/subagents/agent-handle-errors.d.ts +0 -25
  997. package/dist/src/subagents/agent-handle-errors.js +0 -1
  998. package/dist/src/subagents/callback-step.d.ts +0 -11
  999. package/dist/src/subagents/callback-step.js +0 -1
  1000. package/dist/src/subagents/continuation-bundle.d.ts +0 -13
  1001. package/dist/src/subagents/continuation-bundle.js +0 -1
  1002. package/dist/src/subagents/handle-dispatch.d.ts +0 -65
  1003. package/dist/src/subagents/handle-dispatch.js +0 -1
  1004. package/dist/src/subagents/handles/operation-id.d.ts +0 -15
  1005. package/dist/src/subagents/handles/operation-id.js +0 -1
  1006. package/dist/src/subagents/handles/prompt.d.ts +0 -52
  1007. package/dist/src/subagents/handles/prompt.js +0 -3
  1008. package/dist/src/subagents/handles/query.d.ts +0 -41
  1009. package/dist/src/subagents/handles/query.js +0 -1
  1010. package/dist/src/subagents/handles/state-key.d.ts +0 -8
  1011. package/dist/src/subagents/handles/state-key.js +0 -1
  1012. package/dist/src/subagents/handles/store.d.ts +0 -217
  1013. package/dist/src/subagents/handles/store.js +0 -1
  1014. package/dist/src/subagents/handles/transitions.d.ts +0 -103
  1015. package/dist/src/subagents/handles/transitions.js +0 -1
  1016. package/dist/src/subagents/remote-dispatch.js +0 -1
  1017. package/dist/src/subagents/start-local.d.ts +0 -29
  1018. package/dist/src/subagents/start-local.js +0 -1
  1019. package/dist/src/subagents/start-remote.d.ts +0 -21
  1020. package/dist/src/subagents/start-remote.js +0 -1
  1021. package/dist/src/tasks/delivery-context.d.ts +0 -32
  1022. package/dist/src/tasks/delivery-context.js +0 -4
  1023. package/dist/src/tasks/delivery-policy.d.ts +0 -14
  1024. package/dist/src/tasks/delivery-policy.js +0 -1
  1025. package/dist/src/tasks/json.d.ts +0 -88
  1026. package/dist/src/tasks/json.js +0 -1
  1027. package/dist/src/tasks/notification.d.ts +0 -10
  1028. package/dist/src/tasks/notification.js +0 -1
  1029. package/dist/src/tasks/task-id.d.ts +0 -31
  1030. package/dist/src/tasks/task-id.js +0 -1
  1031. package/dist/src/tasks/task-inbox-token.d.ts +0 -2
  1032. package/dist/src/tasks/task-inbox-token.js +0 -1
  1033. package/dist/src/tasks/transitions.d.ts +0 -17
  1034. package/dist/src/tasks/transitions.js +0 -1
  1035. package/dist/src/tasks/types.d.ts +0 -138
  1036. package/dist/src/tasks/types.js +0 -1
  1037. package/dist/src/tools/framework/connection-search.d.ts +0 -3
  1038. package/dist/src/tools/framework/connection-search.js +0 -1
  1039. package/dist/src/tools/framework/task-cancel.d.ts +0 -4
  1040. package/dist/src/tools/framework/task-cancel.js +0 -1
  1041. package/dist/src/tools/framework/task-contract.d.ts +0 -19
  1042. package/dist/src/tools/framework/task-contract.js +0 -1
  1043. package/dist/src/tools/native-definition.d.ts +0 -7
  1044. package/dist/src/tools/native-definition.js +0 -1
  1045. package/dist/src/tracing/agent-invocation-terminal.d.ts +0 -18
  1046. package/dist/src/tracing/agent-invocation-terminal.js +0 -1
  1047. /package/dist/src/execution/{tools/subagent → agent-sessions}/metadata.d.ts +0 -0
  1048. /package/dist/src/execution/{tools/subagent → agent-sessions}/metadata.js +0 -0
@@ -1,4 +1,4 @@
1
- import{isInputResponse}from"#shared/input.js";import{hasInternalRefScheme}from"#internal/attachments/url-refs.js";import{parseJsonObject}from"#shared/json.js";import{EVE_MESSAGE_STREAM_CONTENT_TYPE,EVE_MESSAGE_STREAM_FORMAT,EVE_MESSAGE_STREAM_VERSION,EVE_SESSION_ID_HEADER,EVE_STREAM_CONTROL_VERSION,EVE_STREAM_CONTROL_VERSION_QUERY,EVE_STREAM_FORMAT_HEADER,EVE_STREAM_LEASE_ENDED_CONTROL,EVE_STREAM_TAIL_INDEX_HEADER,EVE_STREAM_VERSION_HEADER}from"#protocol/message.js";import{collectUploadPolicyViolations,formatUploadPolicyViolation}from"#public/channels/upload-policy.js";import{parseSessionCallback}from"#channel/session-callback.js";import{parseActivityObserverField,validateActivityObserverBinding}from"#eve-channel/activity-observer-request.js";import{parseTaskDeliveryPolicyField,parseTurnPolicyField}from"#eve-channel/delivery-policy-request.js";import{validateMessageFreeCreate}from"#eve-channel/create-request.js";async function deriveOperationContinuationToken(e){let t=JSON.stringify([`eve:create-session:v1`,e.auth.authenticator,e.auth.issuer??null,e.auth.principalType,e.auth.principalId,e.operationId]),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t));return`eve:op:${Array.from(new Uint8Array(n),e=>e.toString(16).padStart(2,`0`)).join(``).slice(0,32)}`}function parseCreateBody(e){if(e.inputResponses!==void 0)return Response.json({error:`'inputResponses' is only accepted for an existing session.`,ok:!1},{status:400});let t=parseMessageField(e.message);if(t instanceof Response)return t;let n=parseClientContextField(e.clientContext);if(n instanceof Response)return n;let r=parseCallbackField(e.callback);if(r instanceof Response)return r;let i=parseCapabilitiesField(e.capabilities);if(i instanceof Response)return i;let a=parseActivityObserverField(e.activityObserver);if(a instanceof Response)return a;if(a!==void 0){let e=validateActivityObserverBinding(a,r);if(e!==void 0)return e}let o=parseTaskDeliveryPolicyField(e.taskDeliveryPolicy,t);if(o instanceof Response)return o;let s=parseOutputSchemaField(e.outputSchema);if(s instanceof Response)return s;let c=validateMessageFreeCreate({activityObserver:a,callback:r,hasClientContext:e.clientContext!==void 0,hasMessageField:`message`in e,message:t,outputSchema:s});if(c!==void 0)return c;let l=e.operationId;if(l!==void 0&&(typeof l!=`string`||!l))return Response.json({error:`Expected 'operationId' to be a non-empty string.`,ok:!1},{status:400});let u={taskDeliveryPolicy:o,activityObserver:a,callback:r,capabilities:i,context:n,outputSchema:s};return t!==void 0&&(u.message=t),typeof l==`string`&&(u.operationId=l),u}function parseSessionMessageBody(e){let t=rejectSessionContinuationToken(e);if(t!==null)return t;let n=parseMessageField(e.message);if(n instanceof Response)return n;let r=parseCallbackField(e.callback);if(r instanceof Response)return r;let i=parseActivityObserverField(e.activityObserver);if(i instanceof Response)return i;if(i!==void 0){let e=validateActivityObserverBinding(i,r);if(e!==void 0)return e}let a=parseInputResponses$1(e.inputResponses);if(a instanceof Response)return a;let o=parseClientContextField(e.clientContext);if(o instanceof Response)return o;let s=parseTaskDeliveryPolicyField(e.taskDeliveryPolicy,n);if(s instanceof Response)return s;let c=parseOutputSchemaField(e.outputSchema);if(c instanceof Response)return c;let l=parseTurnPolicyField(e.turnPolicy);return l instanceof Response?l:n===void 0&&a===void 0?Response.json({error:`Expected a non-empty 'message' or a non-empty 'inputResponses' array.`,ok:!1},{status:400}):n!==void 0&&a!==void 0?Response.json({error:`'message' and 'inputResponses' are mutually exclusive.`,ok:!1},{status:400}):{activityObserver:i,callback:r,message:n,inputResponses:a,context:o,outputSchema:c,turnPolicy:l,taskDeliveryPolicy:s}}async function parseCancelTurnBody(e){let t=await parseOptionalJsonRequest(e);if(t instanceof Response)return t;let n=rejectSessionContinuationToken(t);if(n!==null)return n;let r=t.turnId,i=t.taskId,a=t.tasks;if(r!==void 0&&(typeof r!=`string`||r.length===0))return Response.json({error:`Expected 'turnId' to be a non-empty string.`,ok:!1},{status:400});if(a!==void 0&&typeof a!=`boolean`)return Response.json({error:`Expected 'tasks' to be a boolean.`,ok:!1},{status:400});if(i!==void 0&&(typeof i!=`string`||i.length===0))return Response.json({error:`Expected 'taskId' to be a non-empty string.`,ok:!1},{status:400});let o={};return typeof i==`string`&&(o.taskId=i),typeof a==`boolean`&&(o.tasks=a),typeof r==`string`&&(o.turnId=r),o}async function parseJsonRequest(e){let t;try{t=await e.json()}catch{return Response.json({error:`Invalid JSON body.`,ok:!1},{status:400})}return typeof t!=`object`||!t||Array.isArray(t)?Response.json({error:`Expected a JSON object.`,ok:!1},{status:400}):t}async function parseResetBody(e){let t=await parseOptionalJsonRequest(e);if(t instanceof Response)return t;let n=rejectSessionContinuationToken(t);if(n!==null)return n;let r=t.reason;return r!==void 0&&(typeof r!=`string`||r.length===0)?Response.json({error:`Expected 'reason' to be a non-empty string.`,ok:!1},{status:400}):r===void 0?{}:{reason:r}}async function parseSessionControlBody(e){let t=await parseOptionalJsonRequest(e);return t instanceof Response?t:rejectSessionContinuationToken(t)??t}async function parseOptionalJsonRequest(e){let t;try{t=await e.text()}catch{return Response.json({error:`Unreadable request body.`,ok:!1},{status:400})}if(t.trim().length===0)return{};let n;try{n=JSON.parse(t)}catch{return Response.json({error:`Invalid JSON body.`,ok:!1},{status:400})}return typeof n!=`object`||!n||Array.isArray(n)?Response.json({error:`Expected a JSON object.`,ok:!1},{status:400}):n}function rejectSessionContinuationToken(e){return`continuationToken`in e?Response.json({error:`Session-ID routes do not accept 'continuationToken'.`,ok:!1},{status:400}):null}function requireSessionId(e){return e.sessionId||Response.json({error:`Missing session id.`,ok:!1},{status:400})}async function createSessionStreamResponse(e,t){let n=parseStartIndex(e);if(n instanceof Response)return n;let r=parseIncludeTailIndex(e);try{let i=r?await t.getStreamTailIndex():void 0,a=await t.getEventStream({startIndex:n}),o=new URL(e.url).searchParams.get(EVE_STREAM_CONTROL_VERSION_QUERY)===EVE_STREAM_CONTROL_VERSION?EVE_STREAM_CONTROL_VERSION:void 0,s=new Headers({"cache-control":`no-store, no-transform`,"content-type":EVE_MESSAGE_STREAM_CONTENT_TYPE,"x-accel-buffering":`no`,[EVE_SESSION_ID_HEADER]:t.id,[EVE_STREAM_FORMAT_HEADER]:EVE_MESSAGE_STREAM_FORMAT,[EVE_STREAM_VERSION_HEADER]:EVE_MESSAGE_STREAM_VERSION});return i!==void 0&&s.set(EVE_STREAM_TAIL_INDEX_HEADER,String(i)),new Response(serializeAsNdjson(a,e.signal,streamEventLimit(n,i),o!==void 0),{headers:s})}catch{return Response.json({error:`Session not found.`,ok:!1},{status:404})}}function parseOutputSchemaField(e){if(e!==void 0)try{return parseJsonObject(e)}catch{return Response.json({error:`Expected 'outputSchema' to be a JSON-serializable object.`,ok:!1},{status:400})}}function parseCallbackField(e){if(e===void 0)return;let t=parseSessionCallback(e);return t.ok?t.callback:Response.json({error:t.message,ok:!1},{status:400})}function parseCapabilitiesField(e){if(e===void 0)return;if(typeof e!=`object`||!e||Array.isArray(e))return Response.json({error:`Expected 'capabilities' to be an object.`,ok:!1},{status:400});let t=Object.keys(e),n=Reflect.get(e,`requestInput`);return t.some(e=>e!==`requestInput`)||n!==void 0&&typeof n!=`boolean`?Response.json({error:`Expected 'capabilities.requestInput' to be a boolean when provided.`,ok:!1},{status:400}):n===void 0?{}:{requestInput:n}}function parseMessageField(e){if(e===void 0)return;if(typeof e==`string`)return e.length>0?e:void 0;if(!Array.isArray(e))return Response.json({error:`Expected 'message' to be a string or an array of text/file parts.`,ok:!1},{status:400});if(e.length===0)return;let t=[];for(let n of e){let e=parseMessagePart(n);if(e instanceof Response)return e;t.push(e)}return t}function parseMessagePart(e){if(typeof e!=`object`||!e)return Response.json({error:`Expected each message part to be an object.`,ok:!1},{status:400});let t=e;if(t.type===`text`)return typeof t.text!=`string`||t.text.length===0?Response.json({error:`Text parts require a non-empty 'text' string.`,ok:!1},{status:400}):{type:`text`,text:t.text};if(t.type===`file`){if(typeof t.mediaType!=`string`||t.mediaType.length===0)return Response.json({error:`File parts require a non-empty 'mediaType' string.`,ok:!1},{status:400});if(typeof t.data!=`string`)return Response.json({error:`File parts require a 'data' string (base64, data URL, or URL).`,ok:!1},{status:400});if(hasInternalRefScheme(t.data))return Response.json({error:`File part 'data' must not use a framework-internal ref scheme.`,ok:!1},{status:400});let e={type:`file`,mediaType:t.mediaType,data:t.data};return typeof t.filename==`string`&&t.filename.length>0&&(e.filename=t.filename),e}return Response.json({error:`Unsupported message part type "${String(t.type)}". Use 'text' or 'file'.`,ok:!1},{status:400})}function checkUploadPolicy(e,t){if(!e.message)return null;let n=collectUploadPolicyViolations(e.message,t);if(n.length===0)return null;let[r]=n;if(!r)return null;let i=r.kind===`too-large`?413:415;return Response.json({error:formatUploadPolicyViolation(r),ok:!1,violations:n.map(e=>e.kind===`too-large`?{byteLength:e.byteLength,filename:e.filename,kind:e.kind,limit:e.limit,mediaType:e.mediaType}:{allowedMediaTypes:e.allowedMediaTypes,filename:e.filename,kind:e.kind,mediaType:e.mediaType})},{status:i})}function parseInputResponses$1(e){if(e===void 0)return;if(!Array.isArray(e)||e.length===0)return Response.json({error:`Expected 'inputResponses' to be a non-empty array.`,ok:!1},{status:400});let t=e.filter(isInputResponse);return t.length===e.length?t:Response.json({error:`Expected every 'inputResponses' entry to match the HITL response schema.`,ok:!1},{status:400})}function parseClientContextField(e){if(e!==void 0){if(typeof e==`string`)return e.length>0?[toClientContextMessage(e)]:void 0;if(Array.isArray(e))return e.length===0?void 0:e.every(e=>typeof e==`string`&&e.length>0)?e.map(e=>toClientContextMessage(e)):Response.json({error:`Expected 'clientContext' array entries to be non-empty strings.`,ok:!1},{status:400});if(typeof e!=`object`||!e)return Response.json({error:`Expected 'clientContext' to be a string, string array, or JSON object.`,ok:!1},{status:400});try{let t=parseJsonObject(e);return[toClientContextMessage(JSON.stringify(t))]}catch{return Response.json({error:`Expected 'clientContext' to be a JSON-serializable object.`,ok:!1},{status:400})}}}function toClientContextMessage(e){return`Client context:
1
+ import{isInputResponse}from"#shared/input.js";import{hasInternalRefScheme}from"#internal/attachments/url-refs.js";import{EVE_MESSAGE_STREAM_CONTENT_TYPE,EVE_MESSAGE_STREAM_FORMAT,EVE_MESSAGE_STREAM_VERSION,EVE_SESSION_ID_HEADER,EVE_STREAM_CONTROL_VERSION,EVE_STREAM_CONTROL_VERSION_QUERY,EVE_STREAM_FORMAT_HEADER,EVE_STREAM_LEASE_ENDED_CONTROL,EVE_STREAM_TAIL_INDEX_HEADER,EVE_STREAM_VERSION_HEADER}from"#protocol/message.js";import{parseJsonObject}from"#shared/json.js";import{LEGACY_REMOTE_AGENT_PROTOCOL_VERSION,splitLegacyTaskFields}from"#execution/legacy-remote-agent/protocol.js";import{collectUploadPolicyViolations,formatUploadPolicyViolation}from"#public/channels/upload-policy.js";import{parseSessionCallback}from"#channel/session-callback.js";import{REMOTE_AGENT_PROTOCOL_MISMATCH,REMOTE_AGENT_PROTOCOL_VERSION,readRemoteAgentProtocolVersion}from"#protocol/remote-agent-protocol.js";import{parseTurnPolicyField}from"#eve-channel/turn-policy-request.js";import{validateMessageFreeCreate}from"#eve-channel/create-request.js";async function deriveOperationContinuationToken(e){let t=JSON.stringify([`eve:create-session:v1`,e.auth.authenticator,e.auth.issuer??null,e.auth.principalType,e.auth.principalId,e.operationId]),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t));return`eve:op:${Array.from(new Uint8Array(n),e=>e.toString(16).padStart(2,`0`)).join(``).slice(0,32)}`}function parseCreateBody(e){let t=splitLegacyTaskFields(e),{payload:n}=t;if(n.inputResponses!==void 0)return Response.json({error:`'inputResponses' is only accepted for an existing session.`,ok:!1},{status:400});let r=parseMessageField(n.message);if(r instanceof Response)return r;let i=parseClientContextField(n.clientContext);if(i instanceof Response)return i;let a=parseCallbackField(n.callback);if(a instanceof Response)return a;let o=a===void 0?void 0:parseProtocolVersionField(n.protocolVersion);if(o instanceof Response)return o;let s=parseCapabilitiesField(n.capabilities);if(s instanceof Response)return s;let c=parseOutputSchemaField(n.outputSchema);if(c instanceof Response)return c;let l=validateMessageFreeCreate({callback:a,hasClientContext:n.clientContext!==void 0,hasMessageField:`message`in n,message:r,outputSchema:c});if(l!==void 0)return l;let u=n.operationId;if(u!==void 0&&(typeof u!=`string`||!u))return Response.json({error:`Expected 'operationId' to be a non-empty string.`,ok:!1},{status:400});let d={callback:a,capabilities:s,context:i,outputSchema:c};return r!==void 0&&(d.message=r),typeof u==`string`&&(d.operationId=u),o!==void 0&&(d.protocolVersion=o),o===LEGACY_REMOTE_AGENT_PROTOCOL_VERSION&&(d.legacyRemoteAgentCaller=t.taskId===void 0?{}:{taskId:t.taskId}),d}function parseSessionMessageBody(e){let{payload:t}=splitLegacyTaskFields(e),n=rejectSessionContinuationToken(t);if(n!==null)return n;let r=parseMessageField(t.message);if(r instanceof Response)return r;let i=parseCallbackField(t.callback);if(i instanceof Response)return i;let a=parseInputResponses$1(t.inputResponses);if(a instanceof Response)return a;let o=parseClientContextField(t.clientContext);if(o instanceof Response)return o;let s=parseOutputSchemaField(t.outputSchema);if(s instanceof Response)return s;let c=parseTurnPolicyField(t.turnPolicy);return c instanceof Response?c:r===void 0&&a===void 0?Response.json({error:`Expected a non-empty 'message' or a non-empty 'inputResponses' array.`,ok:!1},{status:400}):r!==void 0&&a!==void 0?Response.json({error:`'message' and 'inputResponses' are mutually exclusive.`,ok:!1},{status:400}):{callback:i,message:r,inputResponses:a,context:o,outputSchema:s,turnPolicy:c}}async function parseCancelTurnBody(e){let t=await parseOptionalJsonRequest(e);if(t instanceof Response)return t;let n=rejectSessionContinuationToken(t);if(n!==null)return n;let r=t.turnId;return r!==void 0&&(typeof r!=`string`||r.length===0)?Response.json({error:`Expected 'turnId' to be a non-empty string.`,ok:!1},{status:400}):typeof r==`string`?{turnId:r}:{}}async function parseJsonRequest(e){let t;try{t=await e.json()}catch{return Response.json({error:`Invalid JSON body.`,ok:!1},{status:400})}return typeof t!=`object`||!t||Array.isArray(t)?Response.json({error:`Expected a JSON object.`,ok:!1},{status:400}):t}async function parseResetBody(e){let t=await parseOptionalJsonRequest(e);if(t instanceof Response)return t;let n=rejectSessionContinuationToken(t);if(n!==null)return n;let r=t.reason;return r!==void 0&&(typeof r!=`string`||r.length===0)?Response.json({error:`Expected 'reason' to be a non-empty string.`,ok:!1},{status:400}):r===void 0?{}:{reason:r}}async function parseSessionControlBody(e){let t=await parseOptionalJsonRequest(e);return t instanceof Response?t:rejectSessionContinuationToken(t)??t}async function parseOptionalJsonRequest(e){let t;try{t=await e.text()}catch{return Response.json({error:`Unreadable request body.`,ok:!1},{status:400})}if(t.trim().length===0)return{};let n;try{n=JSON.parse(t)}catch{return Response.json({error:`Invalid JSON body.`,ok:!1},{status:400})}return typeof n!=`object`||!n||Array.isArray(n)?Response.json({error:`Expected a JSON object.`,ok:!1},{status:400}):n}function rejectSessionContinuationToken(e){return`continuationToken`in e?Response.json({error:`Session-ID routes do not accept 'continuationToken'.`,ok:!1},{status:400}):null}function requireSessionId(e){return e.sessionId||Response.json({error:`Missing session id.`,ok:!1},{status:400})}async function createSessionStreamResponse(e,t){let n=parseStartIndex(e);if(n instanceof Response)return n;let r=parseIncludeTailIndex(e);try{let i=r?await t.getStreamTailIndex():void 0,a=await t.getEventStream({startIndex:n}),o=new URL(e.url).searchParams.get(EVE_STREAM_CONTROL_VERSION_QUERY)===EVE_STREAM_CONTROL_VERSION?EVE_STREAM_CONTROL_VERSION:void 0,s=new Headers({"cache-control":`no-store, no-transform`,"content-type":EVE_MESSAGE_STREAM_CONTENT_TYPE,"x-accel-buffering":`no`,[EVE_SESSION_ID_HEADER]:t.id,[EVE_STREAM_FORMAT_HEADER]:EVE_MESSAGE_STREAM_FORMAT,[EVE_STREAM_VERSION_HEADER]:EVE_MESSAGE_STREAM_VERSION});return i!==void 0&&s.set(EVE_STREAM_TAIL_INDEX_HEADER,String(i)),new Response(serializeAsNdjson(a,e.signal,streamEventLimit(n,i),o!==void 0),{headers:s})}catch{return Response.json({error:`Session not found.`,ok:!1},{status:404})}}function parseOutputSchemaField(e){if(e!==void 0)try{return parseJsonObject(e)}catch{return Response.json({error:`Expected 'outputSchema' to be a JSON-serializable object.`,ok:!1},{status:400})}}function parseCallbackField(e){if(e===void 0)return;let t=parseSessionCallback(e);return t.ok?t.callback:Response.json({error:t.message,ok:!1},{status:400})}function parseProtocolVersionField(e){if(e!==void 0&&typeof e!=`number`)return Response.json({error:`Expected 'protocolVersion' to be a number.`,ok:!1},{status:400});let t=readRemoteAgentProtocolVersion(e);return t===REMOTE_AGENT_PROTOCOL_VERSION||t===LEGACY_REMOTE_AGENT_PROTOCOL_VERSION?t:Response.json({code:REMOTE_AGENT_PROTOCOL_MISMATCH,error:`This deployment speaks eve remote agent protocol ${String(REMOTE_AGENT_PROTOCOL_VERSION)}, but the caller speaks protocol ${String(t)}. Upgrade both deployments to the same eve release.`,ok:!1,protocolVersion:REMOTE_AGENT_PROTOCOL_VERSION},{status:409})}function parseCapabilitiesField(e){if(e===void 0)return;if(typeof e!=`object`||!e||Array.isArray(e))return Response.json({error:`Expected 'capabilities' to be an object.`,ok:!1},{status:400});let t=Object.keys(e),n=Reflect.get(e,`requestInput`);return t.some(e=>e!==`requestInput`)||n!==void 0&&typeof n!=`boolean`?Response.json({error:`Expected 'capabilities.requestInput' to be a boolean when provided.`,ok:!1},{status:400}):n===void 0?{}:{requestInput:n}}function parseMessageField(e){if(e===void 0)return;if(typeof e==`string`)return e.length>0?e:void 0;if(!Array.isArray(e))return Response.json({error:`Expected 'message' to be a string or an array of text/file parts.`,ok:!1},{status:400});if(e.length===0)return;let t=[];for(let n of e){let e=parseMessagePart(n);if(e instanceof Response)return e;t.push(e)}return t}function parseMessagePart(e){if(typeof e!=`object`||!e)return Response.json({error:`Expected each message part to be an object.`,ok:!1},{status:400});let t=e;if(t.type===`text`)return typeof t.text!=`string`||t.text.length===0?Response.json({error:`Text parts require a non-empty 'text' string.`,ok:!1},{status:400}):{type:`text`,text:t.text};if(t.type===`file`){if(typeof t.mediaType!=`string`||t.mediaType.length===0)return Response.json({error:`File parts require a non-empty 'mediaType' string.`,ok:!1},{status:400});if(typeof t.data!=`string`)return Response.json({error:`File parts require a 'data' string (base64, data URL, or URL).`,ok:!1},{status:400});if(hasInternalRefScheme(t.data))return Response.json({error:`File part 'data' must not use a framework-internal ref scheme.`,ok:!1},{status:400});let e={type:`file`,mediaType:t.mediaType,data:t.data};return typeof t.filename==`string`&&t.filename.length>0&&(e.filename=t.filename),e}return Response.json({error:`Unsupported message part type "${String(t.type)}". Use 'text' or 'file'.`,ok:!1},{status:400})}function checkUploadPolicy(e,t){if(!e.message)return null;let n=collectUploadPolicyViolations(e.message,t);if(n.length===0)return null;let[r]=n;if(!r)return null;let i=r.kind===`too-large`?413:415;return Response.json({error:formatUploadPolicyViolation(r),ok:!1,violations:n.map(e=>e.kind===`too-large`?{byteLength:e.byteLength,filename:e.filename,kind:e.kind,limit:e.limit,mediaType:e.mediaType}:{allowedMediaTypes:e.allowedMediaTypes,filename:e.filename,kind:e.kind,mediaType:e.mediaType})},{status:i})}function parseInputResponses$1(e){if(e===void 0)return;if(!Array.isArray(e)||e.length===0)return Response.json({error:`Expected 'inputResponses' to be a non-empty array.`,ok:!1},{status:400});let t=e.filter(isInputResponse);return t.length===e.length?t:Response.json({error:`Expected every 'inputResponses' entry to match the HITL response schema.`,ok:!1},{status:400})}function parseClientContextField(e){if(e!==void 0){if(typeof e==`string`)return e.length>0?[toClientContextMessage(e)]:void 0;if(Array.isArray(e))return e.length===0?void 0:e.every(e=>typeof e==`string`&&e.length>0)?e.map(e=>toClientContextMessage(e)):Response.json({error:`Expected 'clientContext' array entries to be non-empty strings.`,ok:!1},{status:400});if(typeof e!=`object`||!e)return Response.json({error:`Expected 'clientContext' to be a string, string array, or JSON object.`,ok:!1},{status:400});try{let t=parseJsonObject(e);return[toClientContextMessage(JSON.stringify(t))]}catch{return Response.json({error:`Expected 'clientContext' to be a JSON-serializable object.`,ok:!1},{status:400})}}}function toClientContextMessage(e){return`Client context:
2
2
  ${e}`}function parseIncludeTailIndex(e){let t=new URL(e.url).searchParams.get(`includeTailIndex`);return t===`1`||t===`true`}function parseStartIndex(e){let t=new URL(e.url).searchParams.get(`startIndex`);if(t===null)return;let n=Number(t);return!/^-?\d+$/.test(t)||!Number.isSafeInteger(n)?Response.json({error:`Expected startIndex to be an integer.`,ok:!1},{status:400}):n}function streamEventLimit(e,t){if(t===void 0)return;let n=e===void 0?0:e<0?Math.max(0,t+1+e):e;return Math.max(0,t-n+1)}function serializeAsNdjson(e,t,n,r=!1){let i=new TextEncoder,a=0,o,s,clearTimers=()=>{clearTimeout(o),clearTimeout(s),o=void 0,s=void 0},scheduleHeartbeat=e=>{clearTimeout(o),o=setTimeout(()=>{try{e.enqueue(i.encode(`
3
3
  `)),scheduleHeartbeat(e)}catch{clearTimers()}},1e4)},startLease=e=>{scheduleHeartbeat(e),s=setTimeout(()=>{clearTimers();try{e.enqueue(i.encode(`${JSON.stringify(EVE_STREAM_LEASE_ENDED_CONTROL)}\n`)),e.terminate()}catch{}},6e4)},c=new TransformStream({start(e){e.enqueue(i.encode(`
4
4
  `)),n===0?e.terminate():r&&startLease(e)},transform(e,t){t.enqueue(i.encode(`${JSON.stringify(e)}\n`)),a+=1,a===n?(clearTimers(),t.terminate()):r&&scheduleHeartbeat(t)},flush(){clearTimers()}});return e.pipeTo(c.writable,{signal:t}).catch(()=>{}).finally(clearTimers),c.readable}export{checkUploadPolicy,createSessionStreamResponse,deriveOperationContinuationToken,parseCancelTurnBody,parseCreateBody,parseIncludeTailIndex,parseJsonRequest,parseOptionalJsonRequest,parseResetBody,parseSessionControlBody,parseSessionMessageBody,parseStartIndex,rejectSessionContinuationToken,requireSessionId};
@@ -1,21 +1,30 @@
1
1
  import type { UserContent } from "ai";
2
2
  import type { SessionAuthContext } from "#channel/types.js";
3
- import type { MessageStreamEvent, SubagentCalledStreamEvent } from "#protocol/message.js";
3
+ import type { MessageStreamEvent } from "#protocol/message.js";
4
4
  import type { ChannelCors } from "#public/definitions/channel.js";
5
- import { type EveChannelCors, type EveChannelInput } from "#eve-channel/types.js";
5
+ import { type EveChannelCors, type EveChannelInput, type EveHandle } from "#eve-channel/types.js";
6
6
  export declare function healthResponse(): Response;
7
- export declare function findRemoteSubagentBinding(input: {
7
+ /** Where a remote child the parent session recorded runs, and its credential key. */
8
+ export interface RemoteAgentBinding {
9
+ readonly forwardPrincipal?: boolean;
10
+ readonly name: string;
11
+ readonly resolverId?: string;
12
+ readonly url: string;
13
+ }
14
+ interface RemoteAgentStreamCoordinates {
8
15
  readonly callId: string;
9
16
  readonly childSessionId: string;
10
17
  readonly childStreamPath: string;
11
- readonly parentSessionId: string;
18
+ }
19
+ /** Finds the remote child the parent session recorded for one proxy route, from its `agent.started` event. */
20
+ export declare function findRemoteAgentBinding(input: RemoteAgentStreamCoordinates & {
12
21
  readonly parent: {
13
22
  getEventStream(options?: {
14
23
  startIndex?: number;
15
24
  }): Promise<ReadableStream<MessageStreamEvent>>;
16
25
  getStreamTailIndex(): Promise<number>;
17
26
  };
18
- }): Promise<SubagentCalledStreamEvent | undefined>;
27
+ }): Promise<RemoteAgentBinding | undefined>;
19
28
  export declare function normalizeEveCors(cors: EveChannelCors | undefined): ChannelCors;
20
29
  interface OnMessageOutcome {
21
30
  readonly auth: SessionAuthContext | null;
@@ -25,6 +34,7 @@ interface OnMessageOutcome {
25
34
  export declare function resolveOnMessage(input: {
26
35
  readonly auth: SessionAuthContext | null;
27
36
  readonly config: EveChannelInput;
37
+ readonly invocation?: EveHandle["invocation"];
28
38
  readonly message: string | UserContent;
29
39
  readonly request: Request;
30
40
  readonly sessionId?: string;
@@ -1 +1 @@
1
- import{createLogger,logError}from"#internal/logging.js";import{defaultEveAuth}from"#eve-channel/types.js";import{workflowEntryReference}from"#execution/workflow-runtime.js";const log=createLogger(`eve.channel`);function healthResponse(){return Response.json({ok:!0,status:`ready`,workflowId:workflowEntryReference.workflowId})}async function findRemoteSubagentBinding(e){let t=await e.parent.getStreamTailIndex();if(t<0)return;let n=(await e.parent.getEventStream({startIndex:0})).getReader(),r;try{for(let i=0;i<=t;i+=1){let t=await n.read();if(t.done)break;let i=t.value;i.type===`subagent.called`&&i.data.sessionId===e.parentSessionId&&i.data.callId===e.callId&&i.data.childSessionId===e.childSessionId&&i.data.childStreamPath===e.childStreamPath&&i.data.remote!==void 0&&(r=i)}}finally{await n.cancel().catch(()=>{})}return r}function normalizeEveCors(e){if(e===void 0||e===!1)return!1;if(e===!0)return!0;let t={};return e.origin!==void 0&&(t.origin=normalizeEveCorsOrigin(e.origin)),e.methods!==void 0&&(t.methods=e.methods),e.allowedHeaders!==void 0&&(t.allowHeaders=e.allowedHeaders),e.exposedHeaders!==void 0&&(t.exposeHeaders=e.exposedHeaders),e.credentials!==void 0&&(t.credentials=e.credentials),e.maxAge!==void 0&&(t.maxAge=e.maxAge),e.preflightStatus!==void 0&&(t.preflight={statusCode:e.preflightStatus}),t}function normalizeEveCorsOrigin(e){return e===`*`||e===`null`?e:typeof e==`string`?[e]:e}async function resolveOnMessage(e){let t=e.config.onMessage??defaultOnMessage,n;try{if(n=await t({eve:e.sessionId===void 0?{caller:e.auth,request:e.request}:{caller:e.auth,request:e.request,sessionId:e.sessionId}},e.message),n==null)throw TypeError(`eveChannel onMessage must return an auth result.`)}catch(t){let n=logError(log,`onMessage handler failed`,t,{sessionId:e.sessionId});return Response.json({error:`onMessage handler failed.`,errorId:n,ok:!1},{status:500})}return{auth:n.auth,context:n.context,title:n.title}}function defaultOnMessage(e){return{auth:defaultEveAuth(e)}}export{findRemoteSubagentBinding,healthResponse,normalizeEveCors,resolveOnMessage};
1
+ import{createLogger,logError}from"#internal/logging.js";import{defaultEveAuth}from"#eve-channel/types.js";import{workflowEntryReference}from"#execution/workflow-runtime.js";const log=createLogger(`eve.channel`);function healthResponse(){return Response.json({ok:!0,status:`ready`,workflowId:workflowEntryReference.workflowId})}async function findRemoteAgentBinding(e){let t=await e.parent.getStreamTailIndex();if(t<0)return;let n=(await e.parent.getEventStream({startIndex:0})).getReader(),r;try{for(let i=0;i<=t;i+=1){let t=await n.read();if(t.done)break;r=readRemoteAgentBinding(t.value,e)??r}}finally{await n.cancel().catch(()=>{})}return r}function readRemoteAgentBinding(e,t){if(e.type!==`agent.started`)return;let{data:n}=e;if(n.callId===t.callId&&n.sessionId===t.childSessionId&&n.streamPath===t.childStreamPath&&n.remote!==void 0)return{name:n.name,...n.remote}}function normalizeEveCors(e){if(e===void 0||e===!1)return!1;if(e===!0)return!0;let t={};return e.origin!==void 0&&(t.origin=normalizeEveCorsOrigin(e.origin)),e.methods!==void 0&&(t.methods=e.methods),e.allowedHeaders!==void 0&&(t.allowHeaders=e.allowedHeaders),e.exposedHeaders!==void 0&&(t.exposeHeaders=e.exposedHeaders),e.credentials!==void 0&&(t.credentials=e.credentials),e.maxAge!==void 0&&(t.maxAge=e.maxAge),e.preflightStatus!==void 0&&(t.preflight={statusCode:e.preflightStatus}),t}function normalizeEveCorsOrigin(e){return e===`*`||e===`null`?e:typeof e==`string`?[e]:e}async function resolveOnMessage(e){let t=e.config.onMessage??defaultOnMessage,n;try{let r={caller:e.auth,request:e.request};if(n=await t({eve:e.sessionId===void 0?e.invocation===void 0?r:{...r,invocation:e.invocation}:{...r,sessionId:e.sessionId}},e.message),n==null)throw TypeError(`eveChannel onMessage must return an auth result.`)}catch(t){let n=logError(log,`onMessage handler failed`,t,{sessionId:e.sessionId});return Response.json({error:`onMessage handler failed.`,errorId:n,ok:!1},{status:500})}return{auth:n.auth,context:n.context,title:n.title}}function defaultOnMessage(e){return{auth:defaultEveAuth(e)}}export{findRemoteAgentBinding,healthResponse,normalizeEveCors,resolveOnMessage};
@@ -0,0 +1,2 @@
1
+ import type { TurnPolicy } from "#channel/types.js";
2
+ export declare function parseTurnPolicyField(value: unknown): TurnPolicy | Response | undefined;
@@ -0,0 +1 @@
1
+ function parseTurnPolicyField(e){if(e!==void 0)return e===`queue`||e===`steer`?e:Response.json({error:`Expected 'turnPolicy' to be either 'queue' or 'steer'.`,ok:!1},{status:400})}export{parseTurnPolicyField};
@@ -42,6 +42,10 @@ export type EveChannelCors = boolean | EveChannelCorsOptions;
42
42
  export interface EveHandle {
43
43
  /** Route-auth result for the request; `onMessage` chooses session auth by returning `{ auth }`. */
44
44
  readonly caller: SessionAuthContext | null;
45
+ /** Replay-stable identity of a trusted remote-subagent create operation. */
46
+ readonly invocation?: {
47
+ readonly operationId: string;
48
+ };
45
49
  readonly request: Request;
46
50
  /** Existing runtime session id for follow-up requests. */
47
51
  readonly sessionId?: string;
@@ -0,0 +1,60 @@
1
+ import type { ChannelInstrumentationProjection, RunSessionLimits, SessionCapabilities, SessionParent } from "#channel/types.js";
2
+ import type { LocalDevRequestProvenance } from "#context/keys.js";
3
+ import type { DynamicSubagentSelections } from "#execution/agent-sessions/target.js";
4
+ import type { PreparedCoordinationDispatch } from "#execution/coordination-dispatch-shared.js";
5
+ import { type DurableCompiledArtifactsSource } from "#runtime/durable-compiled-artifacts-source.js";
6
+ import type { SandboxState } from "#sandbox/state.js";
7
+ import type { ConversationContext } from "#shared/conversation-context.js";
8
+ import type { WorkflowAgentMetadata } from "#tools/workflow-definition.js";
9
+ import { type AgentChildTraceDispatch } from "#tracing/agent-invocation-coordinator.js";
10
+ /**
11
+ * What a workflow run needs to open `ctx.agent` sessions for its caller,
12
+ * captured from the calling session for one call: the run's start input
13
+ * carries it for the call that started the run, and each later call to a
14
+ * `serve` task carries its own. The run never reads the session again:
15
+ * opening, sending to, and ending its sessions never pass through the caller.
16
+ *
17
+ * It is a session's lineage, bound when the session opens. Auth is not part
18
+ * of it: each message carries the auth of the call that sends it.
19
+ */
20
+ export interface AgentSessionContext {
21
+ /** The agents the call may open, by name, which `ctx.agents` lists. */
22
+ readonly agents: Readonly<Record<string, WorkflowAgentMetadata>>;
23
+ readonly bundle: AgentSessionBundle;
24
+ /** Forwarded unchanged, so a session asks a person only when its caller can. */
25
+ readonly capabilities?: SessionCapabilities;
26
+ readonly channelMetadata?: ChannelInstrumentationProjection;
27
+ readonly conversation?: ConversationContext;
28
+ /** Dynamic agents the calling turn selected, by node id. */
29
+ readonly dynamicSelections: DynamicSubagentSelections;
30
+ /** The token budget each session inherits: its share of the caller's remaining quota. */
31
+ readonly limits: RunSessionLimits;
32
+ readonly localDevRequest?: LocalDevRequestProvenance;
33
+ /** The calling session, turn, and tool call, recorded as each session's lineage. */
34
+ readonly parent: SessionParent;
35
+ readonly sandbox: AgentSessionSandbox;
36
+ readonly trace: AgentChildTraceDispatch;
37
+ }
38
+ /** The compiled agent that owns the tool, which resolves agent names. */
39
+ export interface AgentSessionBundle {
40
+ readonly nodeId?: string;
41
+ readonly source: DurableCompiledArtifactsSource;
42
+ }
43
+ /** The caller's sandbox, which agents declared with a parent sandbox share. */
44
+ export interface AgentSessionSandbox {
45
+ readonly sessionId: string;
46
+ readonly state?: SandboxState;
47
+ }
48
+ type CallerDispatch = Pick<PreparedCoordinationDispatch<unknown>, "batch" | "bundle" | "capabilities" | "channelMetadata" | "dynamicSubagentSelections" | "inheritedConversation" | "localDevRequest" | "sandboxSessionId" | "serializedContext" | "session" | "workflowAgents">;
49
+ /**
50
+ * The token budget every session a model step's calls open inherits: the
51
+ * caller's remaining quota split evenly across the agent tasks the step
52
+ * starts, local or remote, so those tasks are bounded by the remainder
53
+ * together. Sessions a workflow tool opens with `ctx.agent` get the same
54
+ * share without dividing it further. A call to a running task starts none,
55
+ * so it takes no share.
56
+ */
57
+ export declare function resolveStepAgentLimits(caller: Pick<PreparedCoordinationDispatch, "plan" | "session">): RunSessionLimits;
58
+ /** Captures the agent session context for one workflow tool call, in the step that admits it. */
59
+ export declare function captureAgentSessionContext(caller: CallerDispatch, callId: string, limits: RunSessionLimits): AgentSessionContext;
60
+ export {};
@@ -0,0 +1 @@
1
+ import{serializeDurableCompiledArtifactsSource}from"#runtime/durable-compiled-artifacts-source.js";import{findTask,readTaskTable}from"#execution/tasks/table.js";import{resolveRemainingSessionTokenLimits}from"#subagents/token-budget.js";import{resolveToolCallAgentTrace}from"#tracing/agent-invocation-coordinator.js";function resolveStepAgentLimits(e){let t=readTaskTable(e.session.state),n=e.plan.filter(({entry:e})=>e.entryPoint===`serve`&&findTask(t,e.taskId)?.kind===`agent`).length;return resolveRemainingSessionTokenLimits(e.session,n)}function captureAgentSessionContext(e,t,n){let{batch:r,session:i}=e;return{agents:e.workflowAgents,bundle:{nodeId:e.bundle.nodeId,source:serializeDurableCompiledArtifactsSource(e.bundle.compiledArtifactsSource)},capabilities:e.capabilities,channelMetadata:e.channelMetadata,conversation:e.inheritedConversation,dynamicSelections:e.dynamicSubagentSelections,limits:n,localDevRequest:e.localDevRequest,parent:{callId:t,rootSessionId:i.rootSessionId??i.sessionId,sessionId:i.sessionId,turn:{id:r.event.turnId,sequence:r.event.sequence}},sandbox:{sessionId:e.sandboxSessionId,state:i.sandboxState},trace:resolveToolCallAgentTrace({callId:t,conversation:e.inheritedConversation,serializedContext:e.serializedContext,sessionId:i.sessionId,turnId:r.event.turnId})}}export{captureAgentSessionContext,resolveStepAgentLimits};
@@ -1,5 +1,5 @@
1
1
  import { type ResetResponse } from "#protocol/reset-session.js";
2
- import type { ActivityObserverConfig, CancelTurnResult, SessionAuthContext } from "#channel/types.js";
2
+ import type { CancelTurnResult, SessionAuthContext, SessionCapabilities } from "#channel/types.js";
3
3
  import type { ChannelAudience } from "#shared/channel-audience.js";
4
4
  import { type SubagentParentContext } from "#subagents/invocation.js";
5
5
  import type { HarnessSession } from "#harness/types.js";
@@ -7,6 +7,8 @@ import type { RuntimeRemoteAgentDispatchRequest } from "#shared/action-types.js"
7
7
  import type { RuntimeSubagentRegistry } from "#runtime/subagents/registry.js";
8
8
  import type { DynamicRemoteAgentConfig } from "#runtime/subagents/dynamic-remote-agent-config.js";
9
9
  import type { CompiledRuntimeAgentBundle } from "#runtime/sessions/compiled-agent-cache.js";
10
+ import type { RemoteAgentBinding } from "#eve-channel/support.js";
11
+ import type { InputResponse } from "#shared/input.js";
10
12
  import type { ResolvedRuntimeRemoteAgentNode } from "#runtime/types.js";
11
13
  import type { JsonObject } from "#shared/json.js";
12
14
  type RemoteAgentSessionCoordinates = {
@@ -17,8 +19,8 @@ export declare function startRemoteAgentSession(input: {
17
19
  /** The dispatching turn's session principal, forwarded when `remote.forwardPrincipal` is set. */
18
20
  readonly auth?: SessionAuthContext | null;
19
21
  readonly callbackBaseUrl: string | undefined;
22
+ readonly capabilities?: SessionCapabilities;
20
23
  readonly originAudience?: ChannelAudience;
21
- readonly activityObserver?: ActivityObserverConfig;
22
24
  /** The root initiator's principal, forwarded alongside {@link auth}. */
23
25
  readonly initiatorAuth?: SessionAuthContext | null;
24
26
  /**
@@ -31,18 +33,23 @@ export declare function startRemoteAgentSession(input: {
31
33
  readonly lineage?: SubagentParentContext["lineage"];
32
34
  };
33
35
  readonly remote: ResolvedRuntimeRemoteAgentNode;
34
- readonly session: HarnessSession;
35
- readonly taskId?: string;
36
+ readonly session: Pick<HarnessSession, "continuationToken">;
36
37
  }): Promise<RemoteAgentSessionCoordinates>;
38
+ export declare function respondToRemoteAgentSession(input: {
39
+ readonly remote: RemoteAgentBinding & {
40
+ readonly sessionId: string;
41
+ };
42
+ readonly headers: Record<string, string>;
43
+ readonly auth: SessionAuthContext | null | undefined;
44
+ readonly responses: readonly InputResponse[];
45
+ }): Promise<void>;
37
46
  /** Continues one remote-agent session by its immutable session ID. */
38
47
  export declare function continueRemoteAgentSession(input: {
39
- readonly activityObserver?: ActivityObserverConfig;
40
48
  /** The dispatching turn's session principal, forwarded when `remote.forwardPrincipal` is set. */
41
49
  readonly auth: SessionAuthContext | null;
42
- readonly callback?: {
50
+ readonly callback: {
43
51
  readonly callId: string;
44
52
  readonly subagentName: string;
45
- readonly taskId?: string;
46
53
  readonly token: string;
47
54
  readonly url: string;
48
55
  };
@@ -51,46 +58,16 @@ export declare function continueRemoteAgentSession(input: {
51
58
  readonly remote: ResolvedRuntimeRemoteAgentNode;
52
59
  readonly sessionId: string;
53
60
  }): Promise<void>;
54
- /**
55
- * Failure of a continue-session request, classified at the HTTP boundary.
56
- * Exported so tests can exercise {@link isRetryableRemoteAgentContinueError}
57
- * with real instances instead of re-encoding the classification.
58
- */
59
- export declare class RemoteAgentContinueRequestError extends Error {
60
- readonly deliveryAmbiguous: boolean;
61
- readonly retryable: boolean;
62
- constructor(message: string, options: {
63
- readonly deliveryAmbiguous: boolean;
64
- readonly retryable: boolean;
65
- });
66
- }
67
- /**
68
- * Returns true when a failed continue request may be retried. Only a
69
- * session that no longer exists (404 / SESSION_NOT_RESUMABLE) is permanent;
70
- * transient HTTP and network failures stay retryable so the dispatch step
71
- * keeps the agent handle and surfaces a retryable error instead of
72
- * discarding it — the model decides whether to try the same agentId again
73
- * (the step itself never re-sends: the callee may have accepted a delivery
74
- * whose response was lost).
75
- */
76
- export declare function isRetryableRemoteAgentContinueError(error: unknown): boolean;
77
- /** Whether the callee may have accepted the continuation before delivery failed. */
78
- export declare function isAmbiguousRemoteAgentContinueError(error: unknown): boolean;
79
61
  export declare function cancelRemoteAgentTurn(input: {
80
- readonly headers?: Record<string, string>;
81
62
  readonly remote: Pick<ResolvedRuntimeRemoteAgentNode, "auth" | "headers" | "name" | "url">;
82
63
  readonly sessionId: string;
83
- readonly taskId?: string;
84
- readonly tasks?: boolean;
85
- readonly turnId?: string;
86
64
  }): Promise<CancelTurnResult>;
87
65
  /** Retires one exact remote child session through eve's authenticated reset route. */
88
66
  export declare function resetRemoteAgentSession(input: {
89
- readonly headers?: Record<string, string>;
67
+ readonly reason: string;
90
68
  readonly remote: Pick<ResolvedRuntimeRemoteAgentNode, "auth" | "headers" | "name" | "url">;
91
69
  readonly sessionId: string;
92
70
  }): Promise<ResetResponse>;
93
- export declare function isRetryableRemoteAgentCancelError(error: unknown): boolean;
94
71
  export declare function resolveRemoteAgentForAction(input: {
95
72
  readonly dynamicRemoteAgent?: DynamicRemoteAgentConfig;
96
73
  readonly nodeId: string;
@@ -100,8 +77,8 @@ export declare function resolveRemoteAgentForAction(input: {
100
77
  /**
101
78
  * Resolves authored outbound headers for a server-authored remote child event.
102
79
  *
103
- * `resolverId` is the key persisted on the `subagent.called` event (see
104
- * `SubagentCalledStreamEvent`): it identifies the authored credential
80
+ * `resolverId` is the key persisted on the `agent.started` event (see
81
+ * `AgentStartedStreamEvent`): it identifies the authored credential
105
82
  * functions, never their resolved values. Lookup order mirrors how dispatch
106
83
  * chose the key — first as a subagent node id (static remote definition),
107
84
  * then as a `credentialsStepId` in the step registry (dynamic remote
@@ -0,0 +1 @@
1
+ import{z}from"#compiled/zod/index.js";import{decisionToTraceContentCeiling}from"#shared/forwarded-trace-policy.js";import{expectFunction,expectObjectRecord}from"#internal/authored-module.js";import{createEveCallbackRoutePath,createEveSessionCancelRoutePath,createEveSessionResetRoutePath,createEveSessionRoutePath}from"#protocol/routes.js";import{CancelTurnResponseSchema}from"#protocol/cancel-turn.js";import{ResetResponseSchema}from"#protocol/reset-session.js";import{formatTraceparent,writeAgentDispatchTracestate}from"#protocol/traceparent.js";import{writeForwardedAudienceBaggage,writeForwardedParentSessionBaggage}from"#protocol/baggage.js";import{writeConversationBaggage}from"#tracing/conversation-context.js";import{REMOTE_AGENT_PROTOCOL_MISMATCH,REMOTE_AGENT_PROTOCOL_VERSION,formatRemoteAgentProtocolMismatch,readRemoteAgentProtocolVersion}from"#protocol/remote-agent-protocol.js";import{FatalError}from"#compiled/@workflow/core/index.js";import{createWorkflowCallbackUrl}from"#execution/workflow-callback-url.js";import{createRemoteAgentRouteUrl}from"#subagents/remote-route-url.js";import{formatSubagentInput}from"#subagents/invocation.js";const CreateSessionResponseSchema=z.object({ok:z.literal(!0),protocolVersion:z.number().optional(),sessionId:z.string().min(1),status:z.literal(`accepted`)});async function startRemoteAgentSession(e){let t=e.parent?.continuationToken??e.session.continuationToken;if(!t)throw Error(`Cannot dispatch remote agent without a parent continuation token.`);if(!e.callbackBaseUrl)throw Error(`Cannot dispatch remote agent without a callback base URL.`);let n=buildForwardedPrincipalField(e),r={capabilities:e.capabilities??{},callback:{callId:e.action.callId,subagentName:e.action.remoteAgentName,token:t,url:createWorkflowCallbackUrl(e.callbackBaseUrl,createEveCallbackRoutePath(t))},message:formatRemoteAgentCallInputMessage({action:e.action,remote:e.remote}),outputSchema:e.action.input.outputSchema,protocolVersion:REMOTE_AGENT_PROTOCOL_VERSION};n!==void 0&&(r.forwardedPrincipal=n),e.operationId!==void 0&&(r.operationId=e.operationId);let i=await resolveRemoteAgentRequestHeaders(e.remote),a=formatTraceparent(e.parent?.traceContext);a!==void 0&&setHeader(i,`traceparent`,a),setHeader(i,`tracestate`,writeAgentDispatchTracestate(readHeader(i,`tracestate`),e.parent?.traceContext));let o=writeForwardedAudienceBaggage(readHeader(i,`baggage`),buildForwardedTraceAssertion({forwardedPrincipal:n,originAudience:e.originAudience,parentTraceContext:e.parent?.traceContext,traceparent:a})),s=writeConversationBaggage(o,e.parent?.conversationId);setHeader(i,`baggage`,writeForwardedParentSessionBaggage(s,e.parent?.lineage));let c=await fetch(createRemoteAgentSessionUrl(e.remote),{body:JSON.stringify(r),headers:{"content-type":`application/json`,...i},method:`POST`});if(!c.ok)throw await throwIfRemoteAgentProtocolMismatch(c,e.action.remoteAgentName),Error(`Remote agent "${e.action.remoteAgentName}" create-session request failed with HTTP ${c.status}.`);let l;try{l=await c.json()}catch{throw Error(`Remote agent "${e.action.remoteAgentName}" create-session response was not valid JSON.`)}let u=CreateSessionResponseSchema.safeParse(l);if(!u.success)throw Error(`Remote agent "${e.action.remoteAgentName}" create-session response was invalid.`);let d=readRemoteAgentProtocolVersion(u.data.protocolVersion);if(d!==REMOTE_AGENT_PROTOCOL_VERSION)throw new FatalError(formatRemoteAgentProtocolMismatch({name:e.action.remoteAgentName,receiverVersion:d}));return{sessionId:u.data.sessionId}}async function throwIfRemoteAgentProtocolMismatch(e,t){let n;try{n=await e.json()}catch{return}if(typeof n!=`object`||!n||Reflect.get(n,`code`)!==REMOTE_AGENT_PROTOCOL_MISMATCH)return;let r=readRemoteAgentProtocolVersion(Reflect.get(n,`protocolVersion`));throw new FatalError(formatRemoteAgentProtocolMismatch({name:t,receiverVersion:r}))}function buildForwardedTraceAssertion(e){let t=decisionToTraceContentCeiling(e.parentTraceContext?.decision);if(e.forwardedPrincipal!==void 0&&e.parentTraceContext!==void 0&&(e.parentTraceContext.traceFlags&1)==1&&e.traceparent!==void 0&&t!==void 0)return{ceiling:t,originAudience:e.originAudience??`unknown`}}async function respondToRemoteAgentSession(e){let t=await fetch(createRemoteAgentRouteUrl(e.remote.url,createEveSessionRoutePath(e.remote.sessionId)),{body:JSON.stringify({inputResponses:e.responses,...e.remote.forwardPrincipal===!0&&e.auth!=null&&{forwardedPrincipal:{current:e.auth}}}),headers:{"content-type":`application/json`,...e.headers},method:`POST`,redirect:`error`});if(!t.ok)throw Error(`Remote agent "${e.remote.name}" input answer failed with HTTP ${t.status}.`)}async function continueRemoteAgentSession(e){let t=buildForwardedPrincipalField(e),n={callback:e.callback,message:e.message,outputSchema:e.outputSchema};t!==void 0&&(n.forwardedPrincipal=t);let r=await fetch(createRemoteAgentContinueUrl(e.remote,e.sessionId),{body:JSON.stringify(n),headers:{"content-type":`application/json`,...await resolveRemoteAgentRequestHeaders(e.remote)},method:`POST`});if(!r.ok){let n=r.status===400&&t!==void 0?` The receiver may support forwarded principals only on session creation; upgrade it before retrying.`:``;throw Error(`Remote agent "${e.remote.name}" continue-session request failed with HTTP ${r.status}.${n}`)}}function buildForwardedPrincipalField(e){if(e.remote.forwardPrincipal!==!0||e.auth===null||e.auth===void 0)return;let t={current:e.auth};return e.initiatorAuth!==null&&e.initiatorAuth!==void 0&&(t.initiator=e.initiatorAuth),t}async function cancelRemoteAgentTurn(e){let t=await fetch(createRemoteAgentCancelTurnUrl(e.remote,e.sessionId),{headers:await resolveRemoteAgentRequestHeaders(e.remote),method:`POST`});if(!t.ok)throw Error(`Remote agent "${e.remote.name}" cancel-turn request failed with HTTP ${t.status}.`);let n;try{n=await t.json()}catch{throw Error(`Remote agent "${e.remote.name}" cancel-turn response was not valid JSON.`)}let r=CancelTurnResponseSchema.safeParse(n);if(!r.success||r.data.status===`accepted`&&r.data.sessionId!==e.sessionId)throw Error(`Remote agent "${e.remote.name}" cancel-turn response was invalid.`);return r.data.status===`accepted`?{sessionId:r.data.sessionId,status:`accepted`}:{status:`no_active_turn`}}function readHeader(e,t){let n=Object.keys(e).find(e=>e.toLowerCase()===t);return n===void 0?void 0:e[n]}function setHeader(e,t,n){for(let n of Object.keys(e))n.toLowerCase()===t&&delete e[n];n!==void 0&&(e[t]=n)}async function resetRemoteAgentSession(e){let t=await resolveRemoteAgentRequestHeaders(e.remote),n=await fetch(createRemoteAgentRouteUrl(e.remote.url,createEveSessionResetRoutePath(e.sessionId)),{body:JSON.stringify({reason:e.reason}),headers:{"content-type":`application/json`,...t},method:`POST`});if(!n.ok)throw Error(`Remote agent "${e.remote.name}" reset-session request failed with HTTP ${n.status}.`);let r=ResetResponseSchema.safeParse(await n.json());if(!r.success||r.data.status===`reset`&&r.data.previousSessionId!==e.sessionId)throw Error(`Remote agent "${e.remote.name}" reset-session response was invalid.`);return r.data}function resolveRemoteAgentForAction(e){let t=e.registry.get(e.nodeId)?.definition;if(e.dynamicRemoteAgent!==void 0){if(t===void 0)throw new FatalError(`Missing remote agent "${e.remoteAgentName}" in runtime registry.`);let n=resolveDynamicRemoteAgentCredentials(e.dynamicRemoteAgent),r=e.dynamicRemoteAgent,i={description:r.description,kind:`remote`,logicalPath:t.logicalPath,name:e.remoteAgentName,nodeId:e.nodeId,path:r.path,sourceId:t.sourceId,sourceKind:`module`,url:r.url};return r.forwardPrincipal!==void 0&&(i.forwardPrincipal=r.forwardPrincipal),n.auth!==void 0&&(i.auth=n.auth),n.headers!==void 0&&(i.headers=n.headers),i}if(t?.kind!==`remote`)throw new FatalError(`Missing remote agent "${e.remoteAgentName}" in runtime registry.`);return t}async function resolveRemoteAgentStreamHeaders(e){if(e.resolverId===void 0)return{};let t=new Set([e.bundle.graph.root,...e.bundle.graph.nodesByNodeId.values()]);for(let n of t){let t=n.subagentRegistry.subagentsByNodeId.get(e.resolverId)?.definition;if(t!==void 0){if(t.kind!==`remote`||t.name!==e.name||t.url!==e.url)throw Error(`Remote child stream resolver does not match the authored remote agent.`);return await resolveRemoteAgentRequestHeaders(t)}}return await resolveRemoteAgentRequestHeaders(resolveDynamicRemoteAgentCredentials({credentialsStepId:e.resolverId,description:``,path:``,url:e.url}))}function resolveDynamicRemoteAgentCredentials(e){if(e.credentialsStepId===void 0)return{};let t=getStepRegistry().get(e.credentialsStepId);if(t===void 0)throw Error(`Dynamic remote subagent credentials function "${e.credentialsStepId}" is not registered.`);let n=expectObjectRecord(t(),`Dynamic remote subagent credentials are invalid.`),r={};return n.auth!==void 0&&(r.auth=expectFunction(n.auth,`Dynamic remote subagent auth is invalid.`)),n.headers!==void 0&&(r.headers=resolveDynamicRemoteAgentHeaders(n.headers)),r}function resolveDynamicRemoteAgentHeaders(e){if(typeof e==`function`)return e;let t=expectObjectRecord(e,`Dynamic remote subagent headers are invalid.`);for(let e of Object.values(t))if(typeof e!=`string`)throw Error(`Dynamic remote subagent headers are invalid.`);return t}function getStepRegistry(){let e=Symbol.for(`@workflow/core//registeredSteps`),t=globalThis,n=t[e];return n===void 0&&(n=new Map,t[e]=n),n}function createRemoteAgentSessionUrl(e){return createRemoteAgentRouteUrl(e.url,e.path)}function createRemoteAgentCancelTurnUrl(e,t){return createRemoteAgentRouteUrl(e.url,createEveSessionCancelRoutePath(t))}function createRemoteAgentContinueUrl(e,t){return createRemoteAgentRouteUrl(e.url,createEveSessionRoutePath(t))}async function resolveRemoteAgentRequestHeaders(e){let t={};return e.headers!==void 0&&Object.assign(t,typeof e.headers==`function`?await e.headers():e.headers),e.auth!==void 0&&Object.assign(t,(await e.auth()).headers),t}function formatRemoteAgentCallInputMessage(e){let t=typeof e.action.input.message==`string`?e.action.input.message:``;return formatSubagentInput({description:e.remote.description,message:t,name:e.action.remoteAgentName,type:`remote`}).message}export{cancelRemoteAgentTurn,continueRemoteAgentSession,resetRemoteAgentSession,resolveRemoteAgentForAction,resolveRemoteAgentStreamHeaders,respondToRemoteAgentSession,startRemoteAgentSession};
@@ -0,0 +1,20 @@
1
+ import type { SubagentAuthorizationEventHookPayload, SubagentInputRequestHookPayload } from "#channel/types.js";
2
+ import type { WorkflowToolRunRef } from "#execution/tools/workflow/messages.js";
3
+ import type { WorkflowToolRunInbox } from "#execution/tools/workflow/owner.js";
4
+ import type { RemoteAgentBinding } from "#eve-channel/support.js";
5
+ /** A child's question or sign-in, which only a person at the root can answer. */
6
+ export type AgentSessionRequest = SubagentAuthorizationEventHookPayload | SubagentInputRequestHookPayload;
7
+ /**
8
+ * Sends a child's question or sign-in to the session that owns the run, which
9
+ * proxies it up the owner chain to the root. Answers route back down to the
10
+ * child by request id.
11
+ */
12
+ export declare function forwardAgentSessionRequest(input: {
13
+ readonly from: WorkflowToolRunRef;
14
+ readonly owner: WorkflowToolRunInbox;
15
+ readonly replyTo: string;
16
+ readonly request: AgentSessionRequest;
17
+ readonly remote?: RemoteAgentBinding & {
18
+ readonly sessionId: string;
19
+ };
20
+ }): Promise<void>;
@@ -0,0 +1 @@
1
+ async function forwardAgentSessionRequest(e){let{from:t,request:n}=e;if(n.kind===`subagent-authorization-event`){await e.owner.send({from:t,kind:`request`,replyTo:e.replyTo,request:{event:n,kind:`authorization-request`}});return}await e.owner.send({from:t,inputSource:n.inputSource,remote:e.remote,kind:`request`,replyTo:n.childContinuationToken,childSessionInbox:n.childSessionInbox?.sessionId===n.childSessionId?n.childSessionInbox:void 0,request:{kind:`input-batch`,requests:n.event.requests},requestCoordinates:{sequence:n.event.sequence,stepIndex:n.event.stepIndex,turnId:n.event.turnId}})}export{forwardAgentSessionRequest};
@@ -0,0 +1,12 @@
1
+ import type { RunUsageTally } from "#execution/agent-sessions/usage.js";
2
+ import type { WorkflowToolRunContext } from "#execution/tools/workflow/ask.js";
3
+ import type { AgentSession } from "#tools/workflow-definition.js";
4
+ /**
5
+ * Opens `ctx.agent` sessions for a workflow run. A handle's position in the
6
+ * run names its session, so replay reaches the same one, and `close` ends
7
+ * every session the run opened, cancelling any turn still running.
8
+ */
9
+ export declare function createAgentSessions(run: WorkflowToolRunContext, usage: RunUsageTally): {
10
+ readonly close: () => Promise<void>;
11
+ readonly open: (name: string) => AgentSession;
12
+ };
@@ -0,0 +1 @@
1
+ import{toErrorMessage}from"#shared/errors.js";import{createHook}from"#compiled/@workflow/core/index.js";import{normalizeRequestedOutputSchema}from"#subagents/invocation.js";import{forwardAgentSessionRequest}from"#execution/agent-sessions/requests.js";import{cancelAgentSessionTurnStep,endAgentSessionsStep,openAgentSessionStep,sendAgentSessionMessageStep}from"#execution/agent-sessions/steps.js";import{disposeHook}from"#execution/hook-ownership.js";import{serializeOutputSchema}from"#tools/schema-emission.js";function createAgentSessions(e,t){let n=[],r=0;return{open:i=>{if(typeof i!=`string`||i.trim()===``)throw TypeError(`ctx.agent() requires a non-empty agent name.`);let a=`${e.from.runId}:${String(r)}`;return r+=1,new RunAgentSession({key:a,name:i,run:e,sessions:n,usage:t})},close:async()=>{n.length!==0&&await endAgentSessionsStep({sessions:n})}}}var RunAgentSession=class{#e;#t;#n;#r;#i;#a;#o=[];constructor(e){this.#e=e.key,this.#t=e.name,this.#n=e.run,this.#r=e.sessions,this.#i=e.usage}async send(e,t={}){if(typeof e!=`string`||e.trim()===``)throw TypeError(`ctx.agent("${this.#t}").send() requires a non-empty message.`);let n=normalizeRequestedOutputSchema(serializeOutputSchema(t.outputSchema)),r=this.#s(n!==void 0);try{await this.#u({auth:this.#n.auth,message:e,outputSchema:n,replyTo:r.hook.token})}catch(e){throw this.#o.splice(this.#o.indexOf(r),1),await releaseHook(r.hook),e}return t.signal!==void 0&&this.#f(r,t.signal),{result:()=>r.ended.then(unwrapTurnEnd)}}#s(e){let t=createHook(),settle=()=>{},n={ended:new Promise(e=>{settle=e}),hook:t,settle};return this.#o.push(n),this.#c(t,e).then(e=>this.#l(n,e)),n}async#c(e,t){try{for await(let n of e){if(n.kind!==`runtime-action-result`){await forwardAgentSessionRequest({from:this.#n.from,owner:this.#n.owner,replyTo:e.token,request:n,remote:this.#a===void 0?void 0:await this.#a.then(({address:e})=>e.kind===`remote`?{forwardPrincipal:e.forwardPrincipal,name:e.name,resolverId:e.resolverId,url:e.url,sessionId:e.sessionId}:void 0)});continue}let r=n.results.find(e=>e.kind===`subagent-result`);if(r!==void 0)return r.origin===`child`&&this.#i.record(r.outcome.usageDelta),{kind:`ended`,result:toAgentMessageResult(r,t)}}return{error:Error(`Agent "${this.#t}" stopped reporting before its turn ended.`),kind:`failed`}}catch(e){return{error:e,kind:`failed`}}}async#l(e,t){let n=this.#o.indexOf(e);if(!(n<0))for(let e of this.#o.splice(0,n+1))e.settle(t),await releaseHook(e.hook)}async#u(e){if(this.#a===void 0){this.#a=this.#d(e),await this.#a;return}let t=await this.#a;await sendAgentSessionMessageStep({...e,...t})}async#d(e){let{agentContext:t,from:n}=this.#n;try{let r=await openAgentSessionStep({...e,context:t,key:this.#e,name:this.#t}),i={address:r,context:t,key:this.#e};return this.#r.push(i),await this.#n.owner.send({from:n,kind:`agent-started`,session:r}),i}catch(e){throw this.#a=void 0,e}}#f(e,t){let cancel=()=>{this.#o.includes(e)&&this.#a!==void 0&&this.#a.then(e=>cancelAgentSessionTurnStep(e)).catch(()=>{})};if(t.aborted){cancel();return}t.addEventListener(`abort`,cancel,{once:!0})}};async function releaseHook(e){try{await disposeHook(e)}catch{}}function unwrapTurnEnd(e){if(e.kind===`failed`)throw e.error;return e.result}const NO_REPLY={data:void 0,message:void 0};function failedTurn(e){return{...NO_REPLY,error:{message:toErrorMessage(e)},status:`failed`}}function toAgentMessageResult(e,t){if(e.origin!==`child`)return failedTurn(e.output);let{outcome:n}=e;switch(n.result.kind){case`failed`:return failedTurn(n.result.error);case`cancelled`:return{...NO_REPLY,status:`waiting`};case`succeeded`:{let{output:e}=n.result,r=n.kind===`terminal`?`completed`:`waiting`;return t?{data:e,message:void 0,status:r}:{data:void 0,message:typeof e==`string`?e:void 0,status:r}}}}export{createAgentSessions};
@@ -0,0 +1,59 @@
1
+ import type { SessionAuth } from "#context/session-context.js";
2
+ import type { AgentSessionContext } from "#execution/agent-sessions/context.js";
3
+ import type { JsonObject } from "#shared/json.js";
4
+ /** Where a session a run opened lives, for its later sends, cancels, and end. */
5
+ export type AgentSessionAddress = {
6
+ readonly kind: "local";
7
+ readonly name: string;
8
+ readonly nodeId: string;
9
+ readonly sessionId: string;
10
+ } | {
11
+ readonly callbackBaseUrl: string;
12
+ readonly kind: "remote";
13
+ readonly forwardPrincipal?: boolean;
14
+ readonly name: string;
15
+ readonly nodeId: string;
16
+ /** Keys the authored credential functions, as on `agent.started`. */
17
+ readonly resolverId?: string;
18
+ readonly sessionId: string;
19
+ readonly url: string;
20
+ };
21
+ /** A session a run opened, with the context of the call that opened it: its lineage. */
22
+ export interface OpenedAgentSession {
23
+ readonly address: AgentSessionAddress;
24
+ readonly context: AgentSessionContext;
25
+ /** Names the session within its run, as when it opened. */
26
+ readonly key: string;
27
+ }
28
+ /**
29
+ * One message to a session, as the call that sends it: the session runs the
30
+ * message with that call's auth. Its turn's result and questions arrive on
31
+ * `replyTo`.
32
+ */
33
+ export interface AgentSessionMessage {
34
+ readonly auth: SessionAuth;
35
+ readonly message: string;
36
+ readonly outputSchema?: JsonObject;
37
+ readonly replyTo: string;
38
+ }
39
+ /**
40
+ * Opens a run's session with its first message, as a child of the call whose
41
+ * `context` it binds. `key` names the handle within the run, so a retried step
42
+ * reaches the same session instead of a second one.
43
+ */
44
+ export declare function openAgentSessionStep(input: AgentSessionMessage & {
45
+ readonly context: AgentSessionContext;
46
+ readonly key: string;
47
+ readonly name: string;
48
+ }): Promise<AgentSessionAddress>;
49
+ /**
50
+ * Sends a later message; it joins the session's running turn or starts the
51
+ * next. It keeps the session's lineage and carries its own auth.
52
+ */
53
+ export declare function sendAgentSessionMessageStep(input: AgentSessionMessage & OpenedAgentSession): Promise<void>;
54
+ /** Cancels a session's running turn; the turn still reports, as cancelled. */
55
+ export declare function cancelAgentSessionTurnStep(input: OpenedAgentSession): Promise<void>;
56
+ /** Ends a run's sessions when the run finishes, cancelling any turn still running. */
57
+ export declare function endAgentSessionsStep(input: {
58
+ readonly sessions: readonly OpenedAgentSession[];
59
+ }): Promise<void>;
@@ -0,0 +1 @@
1
+ import{createLogger,logError}from"#internal/logging.js";import{sessionInboxHookToken}from"#execution/session-inbox/address.js";import{ContextContainer,contextStorage}from"#context/container.js";import{createEveCallbackRoutePath}from"#protocol/routes.js";import{createWorkflowRuntime,dispatchWorkflowSessionCommand,requestWorkflowTurnCancellation,waitForCommandHookOwner}from"#execution/workflow-runtime.js";import{resolveDurableCompiledArtifactsSource}from"#runtime/durable-compiled-artifacts-source.js";import{getWorkflowMetadata}from"#compiled/@workflow/core/index.js";import{createWorkflowCallbackUrl,resolveWorkflowCallbackBaseUrl}from"#execution/workflow-callback-url.js";import{resolveAgentAction,resolveAgentStartTarget}from"#execution/agent-sessions/target.js";import{getCompiledRuntimeAgentBundle}from"#runtime/sessions/compiled-agent-cache.js";import{cancelRemoteAgentTurn,continueRemoteAgentSession,resetRemoteAgentSession,resolveRemoteAgentForAction,startRemoteAgentSession}from"#execution/agent-sessions/remote.js";import{buildSubagentRunInput}from"#subagents/tool.js";import{resolveConversationId}from"#shared/conversation-identity.js";const log=createLogger(`execution.agent-sessions`),RUN_FINISHED_REASON=`The workflow run that opened this session finished.`;async function openAgentSessionStep(e){"use step";let{context:t}=e,n=await loadAgentSessionBundle(t),r=resolveAgentAction({bundle:n,callId:t.parent.callId,dynamicSelections:t.dynamicSelections,input:{message:e.message,outputSchema:e.outputSchema,target:e.name}}),i=resolveAgentStartTarget({action:r,bundle:n,dynamicSelections:t.dynamicSelections,isRootSession:t.parent.rootSessionId===t.parent.sessionId}),a={auth:e.auth,bundle:n,context:t,key:e.key,replyTo:e.replyTo};return i.kind===`remote`?await startRemoteSession({...a,target:i}):await startLocalSession({...a,target:i})}async function sendAgentSessionMessageStep(e){"use step";let{address:t,context:n}=e;if(t.kind===`remote`){let r=await resolveSessionRemote(n,t);await continueRemoteAgentSession({auth:e.auth.current,callback:{callId:n.parent.callId,subagentName:t.name,token:e.replyTo,url:createWorkflowCallbackUrl(t.callbackBaseUrl,createEveCallbackRoutePath(e.replyTo))},message:e.message,outputSchema:e.outputSchema,remote:r,sessionId:t.sessionId});return}if((await dispatchWorkflowSessionCommand({command:{auth:e.auth.current,caller:{callId:n.parent.callId,replyTo:{kind:`hook`,token:e.replyTo},subagentName:t.name},kind:`send`,payload:{message:e.message,outputSchema:e.outputSchema}},sessionId:t.sessionId})).status!==`accepted`)throw Error(`Agent "${t.name}" can no longer receive messages; its session ended.`)}async function cancelAgentSessionTurnStep(e){"use step";let{address:t}=e;try{if(t.kind===`remote`){let n=await resolveSessionRemote(e.context,t);await cancelRemoteAgentTurn({remote:n,sessionId:t.sessionId});return}await requestWorkflowTurnCancellation({sessionId:t.sessionId})}catch(e){logError(log,`failed to cancel an agent session turn`,e,{name:t.name,sessionId:t.sessionId})}}async function endAgentSessionsStep(e){"use step";await Promise.all(e.sessions.map(endAgentSession))}async function endAgentSession({address:e,context:t}){try{if(e.kind===`remote`){let n=await resolveSessionRemote(t,e);await resetRemoteAgentSession({reason:RUN_FINISHED_REASON,remote:n,sessionId:e.sessionId});return}await dispatchWorkflowSessionCommand({command:{kind:`reset`,reason:RUN_FINISHED_REASON},sessionId:e.sessionId})}catch(t){logError(log,`failed to end an agent session`,t,{name:e.name,sessionId:e.sessionId})}}async function startLocalSession(e){let{auth:t,bundle:n,context:r,target:i}=e,{action:a}=i,{childContinuationToken:o,runInput:s}=buildSubagentRunInput({action:a,auth:t.current,capabilities:r.capabilities,channelMetadata:r.channelMetadata,continuationKey:e.key,graph:n.graph,inheritedConversation:r.conversation,initiatorAuth:t.initiator,limits:r.limits,parent:createParentContext(r,e.replyTo),sandboxSessionId:r.sandbox.sessionId,selfAgent:i.source.type===`runtime`,session:{continuationToken:e.replyTo,sandboxState:r.sandbox.state,sessionId:r.parent.sessionId},source:i.source}),c=createWorkflowRuntime({compiledArtifactsSource:n.compiledArtifactsSource,dynamicSubagentAgentConfig:i.dynamicSubagentAgentConfig,nodeId:a.nodeId});await contextStorage.run(new ContextContainer({localDevRequest:r.localDevRequest}),()=>c.createSession(s));let l=await waitForCommandHookOwner(sessionInboxHookToken(o));return{kind:`local`,name:a.name,nodeId:a.nodeId,sessionId:l.runId}}async function startRemoteSession(e){let{auth:t,bundle:n,context:r,target:i}=e,{action:a}=i,o=resolveRemoteAgentForAction({dynamicRemoteAgent:i.dynamicRemoteAgent,nodeId:a.nodeId,registry:n.subagentRegistry.subagentsByNodeId,remoteAgentName:a.remoteAgentName}),s=resolveWorkflowCallbackBaseUrl(getWorkflowMetadata().url),c=await startRemoteAgentSession({action:a,auth:t.current,callbackBaseUrl:s,capabilities:r.capabilities,initiatorAuth:t.initiator,operationId:`agent-session:${e.key}`,originAudience:r.trace.originAudience,parent:createParentContext(r,e.replyTo),remote:o,session:{continuationToken:e.replyTo}});return{callbackBaseUrl:s,kind:`remote`,forwardPrincipal:o.forwardPrincipal,name:a.remoteAgentName,nodeId:a.nodeId,resolverId:i.dynamicRemoteAgent?.credentialsStepId??a.nodeId,sessionId:c.sessionId,url:o.url}}function createParentContext(e,t){return{continuationToken:t,conversationId:e.trace.conversationId??resolveConversationId(e.parent.rootSessionId),lineage:e.parent,originAudience:e.trace.originAudience,traceContext:e.trace.parentTraceContext}}async function resolveSessionRemote(e,t){let n=await loadAgentSessionBundle(e),r=e.dynamicSelections[t.nodeId];return{...resolveRemoteAgentForAction({dynamicRemoteAgent:r?.kind===`remote`?r.remoteAgent:void 0,nodeId:t.nodeId,registry:n.subagentRegistry.subagentsByNodeId,remoteAgentName:t.name}),url:t.url}}async function loadAgentSessionBundle(e){return await getCompiledRuntimeAgentBundle({compiledArtifactsSource:resolveDurableCompiledArtifactsSource(e.bundle.source),nodeId:e.bundle.nodeId})}export{cancelAgentSessionTurnStep,endAgentSessionsStep,openAgentSessionStep,sendAgentSessionMessageStep};
@@ -0,0 +1,45 @@
1
+ import type { DurableDynamicSubagentSelection } from "#context/keys.js";
2
+ import type { CompiledBundle } from "#runtime/sessions/runtime-context-keys.js";
3
+ import type { DynamicSubagentAgentConfig } from "#runtime/subagents/dynamic-agent-config.js";
4
+ import type { DynamicRemoteAgentConfig } from "#runtime/subagents/dynamic-remote-agent-config.js";
5
+ import type { RuntimeAgentDispatchRequest, RuntimeRemoteAgentDispatchRequest, RuntimeSubagentDispatchRequest } from "#shared/action-types.js";
6
+ import type { JsonObject } from "#shared/json.js";
7
+ import type { SubagentInputSource } from "#subagents/tool.js";
8
+ export type DynamicSubagentSelections = Readonly<Record<string, DurableDynamicSubagentSelection>>;
9
+ /** One message to an agent, addressed by its invocation name. */
10
+ export interface AgentActionInput {
11
+ readonly message: string;
12
+ readonly outputSchema?: JsonObject;
13
+ readonly target: string;
14
+ }
15
+ /** Where a new session with an agent starts: in this deployment, or at a remote agent. */
16
+ export type SubagentStartTarget = {
17
+ readonly kind: "local";
18
+ readonly action: RuntimeSubagentDispatchRequest;
19
+ readonly dynamicSubagentAgentConfig?: DynamicSubagentAgentConfig;
20
+ readonly source: SubagentInputSource;
21
+ } | {
22
+ readonly kind: "remote";
23
+ readonly action: RuntimeRemoteAgentDispatchRequest;
24
+ readonly dynamicRemoteAgent?: DynamicRemoteAgentConfig;
25
+ };
26
+ /**
27
+ * Resolves an agent name against the calling agent's registry, its dynamic
28
+ * selections, and the built-in root copy, as a dispatch request.
29
+ */
30
+ export declare function resolveAgentAction(input: {
31
+ readonly bundle: CompiledBundle;
32
+ readonly callId: string;
33
+ readonly dynamicSelections: DynamicSubagentSelections;
34
+ readonly input: AgentActionInput;
35
+ }): RuntimeAgentDispatchRequest;
36
+ /**
37
+ * Plans a fresh child for a dispatch request. A dynamic agent whose selection
38
+ * changed and a root copy outside the root session can't start.
39
+ */
40
+ export declare function resolveAgentStartTarget(input: {
41
+ readonly action: RuntimeAgentDispatchRequest;
42
+ readonly bundle: CompiledBundle;
43
+ readonly dynamicSelections: DynamicSubagentSelections;
44
+ readonly isRootSession: boolean;
45
+ }): SubagentStartTarget;
@@ -0,0 +1 @@
1
+ import{createLogger}from"#internal/logging.js";import{AGENT_TOOL_DESCRIPTION,AGENT_TOOL_NAME}from"#tools/framework/agent-contract.js";import{FatalError}from"#compiled/@workflow/core/index.js";import{ROOT_RUNTIME_AGENT_NODE_ID}from"#runtime/graph.js";const log=createLogger(`execution.agent-target`);function resolveAgentAction(e){let t=findAgentDefinition(e.bundle,e.dynamicSelections,e.input.target);if(t===void 0)throw new FatalError(`Agent target "${e.input.target}" is not available to this agent.`);let n={message:e.input.message};e.input.outputSchema!==void 0&&(n.outputSchema=e.input.outputSchema);let r={callId:e.callId,description:t.description??``,input:n,name:t.name,nodeId:t.nodeId};return t.kind===`remote`?{...r,kind:`remote-agent-call`,remoteAgentName:t.name}:{...r,kind:`subagent-call`,subagentName:t.name}}function findAgentDefinition(e,t,n){let r=e.subagentRegistry.subagentsByName.get(n);if(r!==void 0)return r.definition;let i=Object.values(t).find(e=>e!==null&&e.prepared.name===n);if(i!=null)return i.prepared;if(n===AGENT_TOOL_NAME&&e.nodeId===void 0)return{description:AGENT_TOOL_DESCRIPTION,kind:`subagent`,name:AGENT_TOOL_NAME,nodeId:ROOT_RUNTIME_AGENT_NODE_ID}}function resolveAgentStartTarget(e){let{action:t}=e,n=e.bundle.subagentRegistry.subagentsByNodeId,r=e.bundle.subagentRegistry.dynamicNodeIds?.has(t.nodeId)===!0,i=r?e.dynamicSelections[t.nodeId]??void 0:void 0;if(r&&(i===void 0||t.kind===`subagent-call`&&i.kind!==`subagent`||t.kind===`remote-agent-call`&&i.kind!==`remote`))throw log.warn(`dynamic subagent call blocked after availability changed`,{callId:t.callId,nodeId:t.nodeId,subagentName:t.name}),new FatalError(`Subagent "${t.name}" is not available in the current session context.`);if(isRecursiveAgentAction(t,n)&&!e.isRootSession)throw log.warn(`recursive agent call blocked outside the root session`,{callId:t.callId,nodeId:t.nodeId,subagentName:t.subagentName}),new FatalError(`The built-in "agent" tool is only available to the root session.`);if(t.kind===`remote-agent-call`)return{action:t,dynamicRemoteAgent:i?.kind===`remote`?i.remoteAgent:void 0,kind:`remote`};let a=i?.kind===`subagent`?i.agentConfig:void 0,o=n.get(t.nodeId),s=a?.description??(o?.definition.kind===`subagent`?o.definition.description:void 0);return{action:t,dynamicSubagentAgentConfig:a,kind:`local`,source:s===void 0?{type:`runtime`}:{description:s,type:`local`}}}function isRecursiveAgentAction(e,t){return e.kind===`subagent-call`&&e.subagentName===AGENT_TOOL_NAME&&!t.has(e.nodeId)}export{resolveAgentAction,resolveAgentStartTarget};
@@ -0,0 +1,18 @@
1
+ import type { SessionStateMap } from "#harness/types.js";
2
+ import type { TokenUsage } from "#shared/token-usage.js";
3
+ /** What a run's `ctx.agent` sessions have spent, turn by turn. */
4
+ export interface RunUsageTally {
5
+ /** Adds one ended turn's usage. */
6
+ record(turnUsage: TokenUsage): void;
7
+ /** The running total, or `undefined` before any turn ended. */
8
+ total(): TokenUsage | undefined;
9
+ }
10
+ /** `onRecord` runs after each recorded turn, so the run can send a total no reply will carry. */
11
+ export declare function createRunUsageTally(onRecord?: () => void): RunUsageTally;
12
+ /**
13
+ * Adds a run's delegated spend to the session's totals: its running `total`,
14
+ * less the part of it `counted` earlier.
15
+ */
16
+ export declare function countRunUsage<T extends {
17
+ readonly state?: SessionStateMap;
18
+ }>(session: T, total: TokenUsage, counted?: TokenUsage): T;
@@ -0,0 +1 @@
1
+ import{accumulateSessionUsage,getTurnUsageState,setTurnUsageState,toUsage}from"#harness/turn-tag-state.js";function createRunUsageTally(e){let t;return{record(n){t=accumulateSessionUsage({previous:t,usage:n}),e?.()},total(){return t===void 0?void 0:toUsage(t.session)}}}function countRunUsage(e,t,n){return setTurnUsageState(e,accumulateSessionUsage({previous:getTurnUsageState(e.state),usage:usageSince(t,n)}))}function usageSince(e,t){return t===void 0?e:{cacheReadTokens:e.cacheReadTokens-t.cacheReadTokens,cacheWriteTokens:e.cacheWriteTokens-t.cacheWriteTokens,costUsd:e.costUsd===void 0?void 0:e.costUsd-(t.costUsd??0),inputTokens:e.inputTokens-t.inputTokens,outputTokens:e.outputTokens-t.outputTokens}}export{countRunUsage,createRunUsageTally};
@@ -1,9 +1,7 @@
1
1
  import type { DeliverPayload } from "#channel/types.js";
2
- import type { AuthorizationResult, PendingAuthorizationState } from "#harness/authorization.js";
3
- import type { ConnectionAuthorizationChallenge } from "#connections/errors.js";
2
+ import type { AuthorizationChallenge, AuthorizationResult, PendingAuthorizationState } from "#harness/authorization.js";
4
3
  export interface MatchedAuthorizationCallback {
5
- readonly authorization: ConnectionAuthorizationChallenge;
6
- readonly candidateId?: string;
4
+ readonly challenge: AuthorizationChallenge;
7
5
  readonly result: {
8
6
  readonly name: string;
9
7
  readonly attemptId: string;
@@ -1 +1 @@
1
- function matchAuthorizationCallbacks(e,t){let n=[],r=[],i=new Set;for(let a of t){let t=a.authorizationCallback;if(t===void 0){r.push(a);continue}let o=e.challenges.find(e=>e.name===t.connectionName&&typeof t.attemptId==`string`&&e.attemptId===t.attemptId),s=o?.attemptId;o===void 0||s===void 0||o.principal===void 0||i.has(s)||(i.add(s),n.push({authorization:o.challenge,candidateId:o.candidateId,result:{attemptId:s,callback:t.callback,hookUrl:o.hookUrl,instanceId:o.instanceId,name:o.name,principal:o.principal,resume:o.resume}}))}return{matches:n,remainingPayloads:r}}export{matchAuthorizationCallbacks};
1
+ function matchAuthorizationCallbacks(e,t){let n=[],r=[],i=new Set;for(let a of t){let t=a.authorizationCallback;if(t===void 0){r.push(a);continue}let o=e.challenges.find(e=>e.name===t.connectionName&&typeof t.attemptId==`string`&&e.attemptId===t.attemptId),s=o?.attemptId;o===void 0||s===void 0||o.principal===void 0||i.has(s)||(i.add(s),n.push({challenge:o,result:{attemptId:s,callback:t.callback,hookUrl:o.hookUrl,instanceId:o.instanceId,name:o.name,principal:o.principal,resume:o.resume}}))}return{matches:n,remainingPayloads:r}}export{matchAuthorizationCallbacks};
@@ -1,9 +1,5 @@
1
1
  import { type DurableSessionState } from "#execution/durable-session-store.js";
2
- /**
3
- * Cancels every running delegated child recorded in the agent handle store
4
- * and every workflow tool run the turn is waiting on.
5
- */
2
+ /** Cancels every workflow tool run the turn is waiting on. */
6
3
  export declare function cancelDescendantTurnsStep(input: {
7
- readonly serializedContext: Record<string, unknown>;
8
4
  readonly sessionState: DurableSessionState;
9
5
  }): Promise<void>;
@@ -1 +1 @@
1
- import{createLogger,logError}from"#internal/logging.js";import{BundleKey}from"#runtime/sessions/runtime-context-keys.js";import{requestWorkflowTurnCancellation}from"#execution/workflow-runtime.js";import{getPendingCoordinationBatch}from"#harness/coordination.js";import{deserializeContext}from"#context/serialize.js";import{readDurableSession}from"#execution/durable-session-store.js";import{cancelRemoteAgentTurn,isRetryableRemoteAgentCancelError,resolveRemoteAgentForAction}from"#subagents/remote-dispatch.js";import{cancelWorkflowToolRun}from"#execution/tools/workflow/cancel.js";import{getBlockingWorkflowToolRuns}from"#harness/workflow-tool-runs.js";import{getAgentHandleStore}from"#subagents/handles/store.js";import{getDynamicSubagentSelection}from"#context/dynamic-subagent-lifecycle.js";const log=createLogger(`execution.cancel-descendant-turns`);async function cancelDescendantTurnsStep(e){"use step";let t,n;try{let r=readDurableSession(e.sessionState);n=getBlockingWorkflowToolRuns(r.state,getPendingCoordinationBatch(r.state)?.event.turnId??e.sessionState.emissionState.turnId);let i=new Set(n.map(e=>e.address.runId));t=(getAgentHandleStore(r.state)?.handles??[]).filter(e=>e.phase===`running`||e.phase===`claimed`&&i.has(e.ownerId))}catch(t){logError(log,`failed to read pending descendants during cancellation`,t,{sessionId:e.sessionState.sessionId});return}let r,getRemoteContext=()=>r??=deserializeContext(e.serializedContext).then(e=>({ctx:e,registry:e.require(BundleKey).subagentRegistry.subagentsByNodeId}));await Promise.all([...n.map(e=>cancelWorkflowToolRun(e.address,`The turn that called the tool was cancelled.`)),...t.map(e=>e.address.kind===`agent/remote`?cancelRemoteDescendant({handle:e,remoteContext:getRemoteContext()}):cancelLocalDescendant({handle:e}))])}async function cancelLocalDescendant(e){let{handle:t}=e;try{let e=await requestCancellationWithRetry({request:()=>requestWorkflowTurnCancellation({sessionId:t.address.sessionId}),shouldRetryError:()=>!1});e.status!==`accepted`&&log.warn(`descendant cancel was never accepted; the child may run to completion`,{callId:readHandleCallId(t),childSessionId:t.address.sessionId,finalStatus:e.status,subagentName:t.identity.name})}catch(e){logError(log,`failed to cancel local descendant turn`,e,{callId:readHandleCallId(t),childSessionId:t.address.sessionId,subagentName:t.identity.name})}}async function cancelRemoteDescendant(e){let{handle:t}=e;if(t.address.kind!==`agent/remote`)return;let n=t.address.url;try{let{ctx:r,registry:i}=await e.remoteContext,a=getDynamicSubagentSelection(r,t.identity.nodeId),o={...await resolveRemoteAgentForAction({dynamicRemoteAgent:a?.kind===`remote`?a.remoteAgent:void 0,nodeId:t.identity.nodeId,remoteAgentName:t.identity.name,registry:i}),url:n},s=await requestCancellationWithRetry({request:()=>cancelRemoteAgentTurn({remote:o,sessionId:t.address.sessionId}),shouldRetryError:isRetryableRemoteAgentCancelError});s.status!==`accepted`&&log.warn(`remote descendant cancel was never accepted; the child may run to completion`,{callId:readHandleCallId(t),childSessionId:t.address.sessionId,finalStatus:s.status,remoteAgentName:t.identity.name})}catch(e){logError(log,`failed to cancel remote descendant turn`,e,{callId:readHandleCallId(t),childSessionId:t.address.sessionId,remoteAgentName:t.identity.name})}}function readHandleCallId(e){return e.phase===`running`?e.operation.callId:e.callId}async function requestCancellationWithRetry(e){let t=250,n={status:`no_active_turn`};for(let r=1;r<=8;r+=1){try{if(n=await e.request(),n.status===`accepted`||r===8)return n}catch(t){if(!e.shouldRetryError(t)||r===8)throw t}await new Promise(e=>setTimeout(e,t)),t=Math.min(t*2,1500)}return n}export{cancelDescendantTurnsStep};
1
+ import{createLogger,logError}from"#internal/logging.js";import{getPendingCoordinationBatch}from"#harness/coordination.js";import{readDurableSession}from"#execution/durable-session-store.js";import{cancelWorkflowToolRun}from"#execution/tools/workflow/cancel.js";import{getBlockingWorkflowToolRuns}from"#harness/workflow-tool-runs.js";const log=createLogger(`execution.cancel-descendant-turns`);async function cancelDescendantTurnsStep(e){"use step";let t;try{let n=readDurableSession(e.sessionState);t=getBlockingWorkflowToolRuns(n.state,getPendingCoordinationBatch(n.state)?.event.turnId??e.sessionState.emissionState.turnId)}catch(t){logError(log,`failed to read pending descendants during cancellation`,t,{sessionId:e.sessionState.sessionId});return}await Promise.all(t.map(e=>cancelWorkflowToolRun(e.address,{kind:`cancel`,reason:`The turn that called the tool was cancelled.`})))}export{cancelDescendantTurnsStep};
@@ -1 +1 @@
1
- import{contextStorage}from"#context/container.js";import{TurnDeliveryIdsKey}from"#context/keys.js";import{serializeContext}from"#context/serialize.js";import{createDurableSessionState}from"#execution/durable-session-store.js";import{preserveSerializedSessionDynamicModelSelection}from"#context/serialized-dynamic-model-selection.js";import{preserveCancelledTurnMessage}from"#execution/cancelled-turn-message.js";import{readRetainedBackgroundToolResult}from"#execution/tasks/parent/tool-execution.js";import{preserveSerializedInstrumentationState}from"#instrumentation/state.js";import{preserveSerializedBackgroundTaskObservabilityState}from"#shared/serialized-observability-state.js";import{preserveSerializedAgentTraceState}from"#tracing/agent-trace-context-store.js";async function createCancelledModelCallBatchResult(e){let t=serializeContext(e.ctx),n=readRetainedBackgroundToolResult(e.ctx),r=n?.backgroundTaskSession??e.checkpoint?.result.backgroundTaskSession,i=n?.backgroundTasks??e.checkpoint?.result.backgroundTasks,a=r??e.checkpoint?.result.session??e.initialSession,o=e.checkpoint===void 0?await contextStorage.run(e.ctx,()=>preserveCancelledTurnMessage(a,e.stepInput)):a,s={...e.checkpoint?.serializedContext??e.beforeBatchContext,[TurnDeliveryIdsKey.name]:t[TurnDeliveryIdsKey.name]};return{action:`cancelled`,...r===void 0||i===void 0?{}:{backgroundTaskContext:preserveSerializedBackgroundTaskObservabilityState(e.beforeBatchContext,t,i),backgroundTaskState:createDurableSessionState({session:o}),backgroundTasks:i},serializedContext:preserveSerializedInstrumentationState(preserveSerializedAgentTraceState(preserveSerializedSessionDynamicModelSelection(s,t),t),t),sessionState:createDurableSessionState({session:o})}}export{createCancelledModelCallBatchResult};
1
+ import{contextStorage}from"#context/container.js";import{TurnDeliveryIdsKey}from"#context/keys.js";import{createDurableSessionState}from"#execution/durable-session-store.js";import{preserveSerializedSessionDynamicModelSelection}from"#context/serialized-dynamic-model-selection.js";import{serializeContext}from"#context/serialize.js";import{preserveCancelledTurnMessage}from"#execution/cancelled-turn-message.js";import{preserveSerializedInstrumentationState}from"#instrumentation/state.js";import{preserveSerializedAgentTraceState}from"#tracing/agent-trace-context-store.js";async function createCancelledModelCallBatchResult(e){let t=serializeContext(e.ctx),n=e.checkpoint?.result.session??e.initialSession,r=e.checkpoint===void 0?await contextStorage.run(e.ctx,()=>preserveCancelledTurnMessage(n,e.stepInput)):n,i={...e.checkpoint?.serializedContext??e.beforeBatchContext,[TurnDeliveryIdsKey.name]:t[TurnDeliveryIdsKey.name]};return{action:`cancelled`,serializedContext:preserveSerializedInstrumentationState(preserveSerializedAgentTraceState(preserveSerializedSessionDynamicModelSelection(i,t),t),t),sessionState:createDurableSessionState({session:r})}}export{createCancelledModelCallBatchResult};
@@ -0,0 +1,7 @@
1
+ import type { ContextContainer } from "#context/container.js";
2
+ /**
3
+ * Announces the agent's connections for the current step: a baseline listing
4
+ * the first time, then only what changed. Tool names and signatures stay out
5
+ * of the listing; `connection_search` returns them.
6
+ */
7
+ export declare function announceConnections(ctx: ContextContainer): void;