eve 0.62.0 → 0.64.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 (593) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/src/ai/evaluate.js +1 -1
  3. package/dist/src/channel/channel-address.d.ts +4 -1
  4. package/dist/src/channel/channel-address.js +1 -1
  5. package/dist/src/channel/channel-operations.d.ts +4 -1
  6. package/dist/src/channel/cross-channel-receive.d.ts +4 -1
  7. package/dist/src/channel/cross-channel-receive.js +1 -1
  8. package/dist/src/channel/session.d.ts +3 -1
  9. package/dist/src/channel/session.js +1 -1
  10. package/dist/src/channel/types.d.ts +7 -0
  11. package/dist/src/chunks/{use-eve-agent-C5-yqRuq.js → use-eve-agent-BdKlQF32.js} +8 -8
  12. package/dist/src/chunks/{use-eve-agent-CVWk5KKy.js → use-eve-agent-IIuxkn6y.js} +8 -8
  13. package/dist/src/cli/commands/build.js +1 -1
  14. package/dist/src/cli/commands/init-agent-workspace.d.ts +2 -0
  15. package/dist/src/cli/commands/init.js +1 -1
  16. package/dist/src/cli/dev/tui/line-editor.d.ts +11 -1
  17. package/dist/src/cli/dev/tui/line-editor.js +3 -3
  18. package/dist/src/cli/dev/tui/model-picker.d.ts +50 -0
  19. package/dist/src/cli/dev/tui/model-picker.js +1 -0
  20. package/dist/src/cli/dev/tui/prompt-commands.js +1 -1
  21. package/dist/src/cli/dev/tui/runner.js +2 -2
  22. package/dist/src/cli/dev/tui/setup-commands.d.ts +1 -1
  23. package/dist/src/cli/dev/tui/setup-commands.js +1 -1
  24. package/dist/src/cli/dev/tui/setup-flow.d.ts +2 -2
  25. package/dist/src/cli/dev/tui/setup-panel.d.ts +1 -26
  26. package/dist/src/cli/dev/tui/setup-panel.js +3 -3
  27. package/dist/src/cli/dev/tui/setup-selection-input.js +1 -1
  28. package/dist/src/cli/dev/tui/stream-format.d.ts +6 -7
  29. package/dist/src/cli/dev/tui/stream-format.js +2 -2
  30. package/dist/src/cli/dev/tui/subagent-pump.js +1 -1
  31. package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
  32. package/dist/src/cli/dev/tui/test/fake-setup-flow-renderer.js +1 -1
  33. package/dist/src/cli/dev/tui/test/mock-terminal.js +1 -1
  34. package/dist/src/cli/dev/tui/theme.d.ts +0 -8
  35. package/dist/src/cli/dev/tui/theme.js +1 -1
  36. package/dist/src/cli/run.js +1 -1
  37. package/dist/src/client/agent-info-schema.d.ts +8 -14
  38. package/dist/src/client/agent-info-schema.js +1 -1
  39. package/dist/src/client/eve-agent-store.js +1 -1
  40. package/dist/src/client/session.js +1 -1
  41. package/dist/src/client/types.d.ts +4 -2
  42. package/dist/src/compiled/.vendor-stamp.json +11 -11
  43. package/dist/src/compiled/@chat-adapter/slack/_chat-adapter-shared.d.ts +1 -0
  44. package/dist/src/compiled/@chat-adapter/slack/api.d.ts +3 -2
  45. package/dist/src/compiled/@chat-adapter/slack/api.js +1 -1
  46. package/dist/src/compiled/@chat-adapter/slack/blocks.js +1 -1
  47. package/dist/src/compiled/@chat-adapter/slack/format.js +1 -1
  48. package/dist/src/compiled/@chat-adapter/slack/index.d.ts +410 -63
  49. package/dist/src/compiled/@chat-adapter/slack/index.js +47 -25
  50. package/dist/src/compiled/@chat-adapter/twilio/api.d.ts +5 -1
  51. package/dist/src/compiled/@chat-adapter/twilio/api.js +1 -1
  52. package/dist/src/compiled/@chat-adapter/twilio/index.d.ts +37 -3
  53. package/dist/src/compiled/@chat-adapter/twilio/index.js +5 -1
  54. package/dist/src/compiled/@chat-adapter/twilio/webhook.d.ts +2 -2
  55. package/dist/src/compiled/@chat-adapter/twilio/webhook.js +1 -1
  56. package/dist/src/compiled/@linqapp/chat-sdk-adapter/index.js +6 -6
  57. package/dist/src/compiled/@photon-ai/chat-adapter-imessage/index.js +50 -50
  58. package/dist/src/compiled/@vercel/sandbox/index.js +4 -4
  59. package/dist/src/compiled/@workflow/core/attribute-changes.d.ts +2 -1
  60. package/dist/src/compiled/@workflow/core/events-consumer.d.ts +6 -3
  61. package/dist/src/compiled/@workflow/core/index.js +2 -2
  62. package/dist/src/compiled/@workflow/core/private.d.ts +37 -5
  63. package/dist/src/compiled/@workflow/core/private.js +1 -1
  64. package/dist/src/compiled/@workflow/core/runtime/deployment-guard.d.ts +2 -1
  65. package/dist/src/compiled/@workflow/core/runtime/helpers.js +1 -1
  66. package/dist/src/compiled/@workflow/core/runtime/invocations.d.ts +35 -0
  67. package/dist/src/compiled/@workflow/core/runtime/lifecycle-hooks.d.ts +90 -0
  68. package/dist/src/compiled/@workflow/core/runtime/quickjs-runtime.d.ts +2 -1
  69. package/dist/src/compiled/@workflow/core/runtime/resume-hook.d.ts +8 -6
  70. package/dist/src/compiled/@workflow/core/runtime/step-single-flight.d.ts +1 -1
  71. package/dist/src/compiled/@workflow/core/runtime.js +4 -4
  72. package/dist/src/compiled/@workflow/core/serialization.d.ts +5 -1
  73. package/dist/src/compiled/@workflow/core/serialization.js +1 -1
  74. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  75. package/dist/src/compiled/@workflow/core/workflow/set-attributes.d.ts +4 -0
  76. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  77. package/dist/src/compiled/@workflow/world/analytics.d.ts +1 -1
  78. package/dist/src/compiled/@workflow/world/attributes-validation.d.ts +5 -0
  79. package/dist/src/compiled/@workflow/world/events.d.ts +2 -2
  80. package/dist/src/compiled/@workflow/world/index.d.ts +2 -1
  81. package/dist/src/compiled/@workflow/world/interfaces.d.ts +12 -1
  82. package/dist/src/compiled/@workflow/world/invocation.d.ts +19 -0
  83. package/dist/src/compiled/@workflow/world/queue.d.ts +24 -3
  84. package/dist/src/compiled/@workflow/world-local/index.js +3 -3
  85. package/dist/src/compiled/@workflow/world-vercel/index.js +16 -16
  86. package/dist/src/compiled/_chunks/node/chunk-6QHBXN7B-gl4n6nmi.js +12 -0
  87. package/dist/src/compiled/_chunks/node/chunk-7WDLOIRP-B_IWkVtZ.js +1 -0
  88. package/dist/src/compiled/_chunks/node/chunk-KBOOTKHF-DJqFk2r1.js +1 -0
  89. package/dist/src/compiled/_chunks/node/chunk-TREVQR3E-CLsTAn-O.js +1 -0
  90. package/dist/src/compiled/_chunks/node/dist-DYDVZ-FS.js +98 -0
  91. package/dist/src/compiled/_chunks/node/dist-iEFkK9qw.js +6 -0
  92. package/dist/src/compiled/_chunks/workflow/attribute-changes-DFx4eluc.js +6 -0
  93. package/dist/src/compiled/_chunks/workflow/{dist-D38gP7YF.js → dist-DjECvUyK.js} +1 -1
  94. package/dist/src/compiled/_chunks/workflow/{frames-QcJfYHmh.js → frames-D_Q-7A1N.js} +2 -2
  95. package/dist/src/compiled/_chunks/workflow/{helpers-6kObVbfS.js → helpers-Bw52uyzw.js} +1 -1
  96. package/dist/src/compiled/_chunks/workflow/{logger-NN5YHpYy.js → logger-DFNCa8Nl.js} +1 -1
  97. package/dist/src/compiled/_chunks/workflow/resume-hook-BhA_nDEV.js +1 -0
  98. package/dist/src/compiled/_chunks/workflow/{run-DJevv8zz.js → run-BT6SQv5f.js} +1 -1
  99. package/dist/src/compiled/_chunks/workflow/{serialization-C5KgPESk.js → serialization-Cl0SYU0I.js} +3 -3
  100. package/dist/src/compiled/_chunks/workflow/sleep-DB4AH9-A.js +1 -0
  101. package/dist/src/compiled/_chunks/workflow/{wait-until-BMY_tOr-.js → wait-until-Dzhr6tzf.js} +1 -1
  102. package/dist/src/compiled/_chunks/workflow/{ws-transport-DSDcKH08.js → ws-transport-BpTMh40s.js} +1 -1
  103. package/dist/src/compiled/chat/index.d.ts +1 -725
  104. package/dist/src/compiled/chat/index.js +1 -1
  105. package/dist/src/compiler/artifacts.d.ts +1 -0
  106. package/dist/src/compiler/artifacts.js +1 -1
  107. package/dist/src/compiler/extension-compatibility.d.ts +42 -15
  108. package/dist/src/compiler/extension-compatibility.js +1 -1
  109. package/dist/src/compiler/manifest.d.ts +14 -18
  110. package/dist/src/compiler/manifest.js +1 -1
  111. package/dist/src/compiler/normalize-agent-config.js +1 -1
  112. package/dist/src/compiler/normalize-helpers.js +1 -1
  113. package/dist/src/compiler/normalize-sandbox.d.ts +2 -7
  114. package/dist/src/compiler/normalize-sandbox.js +1 -1
  115. package/dist/src/compiler/normalize-tool.js +1 -1
  116. package/dist/src/compiler/workspace-resources.js +1 -1
  117. package/dist/src/context/build-callback-context.d.ts +2 -0
  118. package/dist/src/context/build-callback-context.js +1 -1
  119. package/dist/src/context/build-dynamic-tools.js +1 -1
  120. package/dist/src/context/container.d.ts +1 -1
  121. package/dist/src/context/container.js +1 -1
  122. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  123. package/dist/src/context/key-names.d.ts +1 -0
  124. package/dist/src/context/key-names.js +1 -1
  125. package/dist/src/context/keys.d.ts +7 -2
  126. package/dist/src/context/keys.js +1 -1
  127. package/dist/src/context/providers/sandbox.js +1 -1
  128. package/dist/src/context/providers/session.d.ts +19 -2
  129. package/dist/src/context/session-context.d.ts +1 -1
  130. package/dist/src/discover/sandbox.js +1 -1
  131. package/dist/src/evals/cli/eval.js +1 -1
  132. package/dist/src/evals/context.d.ts +1 -0
  133. package/dist/src/evals/context.js +1 -1
  134. package/dist/src/evals/define-eval-config.d.ts +7 -7
  135. package/dist/src/evals/define-eval-config.js +1 -1
  136. package/dist/src/evals/define-eval.d.ts +5 -2
  137. package/dist/src/evals/index.d.ts +1 -1
  138. package/dist/src/evals/runner/derive-run-facts.js +1 -1
  139. package/dist/src/evals/runner/execute-eval.d.ts +2 -0
  140. package/dist/src/evals/runner/execute-eval.js +1 -1
  141. package/dist/src/evals/runner/execute-task.d.ts +2 -0
  142. package/dist/src/evals/runner/execute-task.js +1 -1
  143. package/dist/src/evals/runner/run-evals.d.ts +2 -0
  144. package/dist/src/evals/runner/run-evals.js +1 -1
  145. package/dist/src/evals/target.js +1 -1
  146. package/dist/src/evals/types.d.ts +26 -9
  147. package/dist/src/eve-channel/create-request.d.ts +2 -1
  148. package/dist/src/eve-channel/delivery-policy-request.d.ts +4 -0
  149. package/dist/src/eve-channel/delivery-policy-request.js +1 -0
  150. package/dist/src/eve-channel/index.js +1 -1
  151. package/dist/src/eve-channel/request.d.ts +2 -1
  152. package/dist/src/eve-channel/request.js +1 -1
  153. package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
  154. package/dist/src/execution/cancel-indexed-session-tasks-step.d.ts +2 -1
  155. package/dist/src/execution/cancel-indexed-session-tasks-step.js +1 -1
  156. package/dist/src/execution/coordination-dispatch-shared.d.ts +3 -7
  157. package/dist/src/execution/coordination-dispatch-shared.js +1 -1
  158. package/dist/src/execution/coordination-dispatch-step.js +1 -1
  159. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  160. package/dist/src/execution/legacy-session/interrupt-step.js +1 -1
  161. package/dist/src/execution/node-step.js +1 -1
  162. package/dist/src/execution/proxied-deliver-step.js +1 -1
  163. package/dist/src/execution/route-child-delivery.js +3 -1
  164. package/dist/src/execution/runtime-context.js +1 -1
  165. package/dist/src/execution/sandbox/active-handles.d.ts +7 -8
  166. package/dist/src/execution/sandbox/active-handles.js +1 -1
  167. package/dist/src/execution/sandbox/bash.js +1 -1
  168. package/dist/src/execution/sandbox/bindings/docker-cli.d.ts +1 -1
  169. package/dist/src/execution/sandbox/bindings/docker-cli.js +1 -1
  170. package/dist/src/execution/sandbox/bindings/docker-container.d.ts +2 -2
  171. package/dist/src/execution/sandbox/bindings/docker-container.js +1 -1
  172. package/dist/src/execution/sandbox/bindings/docker-network.d.ts +1 -1
  173. package/dist/src/execution/sandbox/bindings/docker-network.js +1 -1
  174. package/dist/src/execution/sandbox/bindings/docker-options.d.ts +4 -5
  175. package/dist/src/execution/sandbox/bindings/docker-options.js +1 -1
  176. package/dist/src/execution/sandbox/bindings/docker-session.d.ts +0 -1
  177. package/dist/src/execution/sandbox/bindings/docker-session.js +2 -2
  178. package/dist/src/execution/sandbox/bindings/docker.d.ts +16 -18
  179. package/dist/src/execution/sandbox/bindings/docker.js +1 -1
  180. package/dist/src/execution/sandbox/bindings/immutable-resources.d.ts +21 -0
  181. package/dist/src/execution/sandbox/bindings/immutable-resources.js +2 -0
  182. package/dist/src/execution/sandbox/bindings/just-bash-runtime.d.ts +9 -5
  183. package/dist/src/execution/sandbox/bindings/just-bash-runtime.js +1 -1
  184. package/dist/src/execution/sandbox/bindings/just-bash.d.ts +13 -26
  185. package/dist/src/execution/sandbox/bindings/just-bash.js +1 -1
  186. package/dist/src/execution/sandbox/bindings/{local-backend-utils.d.ts → local-provider-utils.d.ts} +7 -5
  187. package/dist/src/execution/sandbox/bindings/local-provider-utils.js +1 -0
  188. package/dist/src/execution/sandbox/bindings/local.d.ts +3 -3
  189. package/dist/src/execution/sandbox/bindings/local.js +1 -1
  190. package/dist/src/execution/sandbox/bindings/microsandbox-create.js +1 -1
  191. package/dist/src/execution/sandbox/bindings/microsandbox-lifecycle.d.ts +30 -8
  192. package/dist/src/execution/sandbox/bindings/microsandbox-lifecycle.js +1 -1
  193. package/dist/src/execution/sandbox/bindings/microsandbox-metadata.d.ts +9 -1
  194. package/dist/src/execution/sandbox/bindings/microsandbox-metadata.js +1 -1
  195. package/dist/src/execution/sandbox/bindings/microsandbox-network.js +1 -1
  196. package/dist/src/execution/sandbox/bindings/microsandbox-options.d.ts +10 -4
  197. package/dist/src/execution/sandbox/bindings/microsandbox-options.js +1 -1
  198. package/dist/src/execution/sandbox/bindings/microsandbox-platform.js +1 -1
  199. package/dist/src/execution/sandbox/bindings/microsandbox-runtime.d.ts +7 -5
  200. package/dist/src/execution/sandbox/bindings/microsandbox-runtime.js +1 -1
  201. package/dist/src/execution/sandbox/bindings/microsandbox-templates.js +1 -1
  202. package/dist/src/execution/sandbox/bindings/microsandbox.d.ts +11 -21
  203. package/dist/src/execution/sandbox/bindings/microsandbox.js +1 -1
  204. package/dist/src/execution/sandbox/bindings/vercel-base-runtime.js +2 -2
  205. package/dist/src/execution/sandbox/bindings/vercel-credentials.js +1 -1
  206. package/dist/src/execution/sandbox/bindings/vercel-errors.js +1 -1
  207. package/dist/src/execution/sandbox/bindings/vercel-lifecycle.d.ts +2 -2
  208. package/dist/src/execution/sandbox/bindings/vercel-lifecycle.js +1 -1
  209. package/dist/src/execution/sandbox/bindings/vercel-lookup.js +1 -1
  210. package/dist/src/execution/sandbox/bindings/vercel-options.d.ts +1 -2
  211. package/dist/src/execution/sandbox/bindings/vercel-options.js +1 -1
  212. package/dist/src/execution/sandbox/bindings/vercel.d.ts +20 -12
  213. package/dist/src/execution/sandbox/bindings/vercel.js +2 -2
  214. package/dist/src/execution/sandbox/development-cleanup.js +1 -1
  215. package/dist/src/execution/sandbox/development-prewarm.d.ts +5 -0
  216. package/dist/src/execution/sandbox/development-prewarm.js +1 -1
  217. package/dist/src/execution/sandbox/development-run.d.ts +2 -3
  218. package/dist/src/execution/sandbox/dockerfile.d.ts +25 -0
  219. package/dist/src/execution/sandbox/dockerfile.js +1 -0
  220. package/dist/src/execution/sandbox/ensure.d.ts +0 -17
  221. package/dist/src/execution/sandbox/ensure.js +1 -1
  222. package/dist/src/execution/sandbox/logging-session.js +1 -1
  223. package/dist/src/execution/sandbox/prewarm.d.ts +23 -27
  224. package/dist/src/execution/sandbox/prewarm.js +1 -2
  225. package/dist/src/execution/sandbox/provider-files.d.ts +2 -0
  226. package/dist/src/execution/sandbox/provider-files.js +1 -0
  227. package/dist/src/execution/sandbox/provider-host-development.d.ts +2 -0
  228. package/dist/src/execution/sandbox/provider-host-development.js +1 -0
  229. package/dist/src/execution/sandbox/provider-host.d.ts +2 -0
  230. package/dist/src/execution/sandbox/provider-host.js +1 -0
  231. package/dist/src/execution/sandbox/provider-identity.d.ts +1 -0
  232. package/dist/src/execution/sandbox/provider-identity.js +1 -0
  233. package/dist/src/execution/sandbox/ripgrep-probe.d.ts +0 -7
  234. package/dist/src/execution/sandbox/ripgrep-probe.js +1 -1
  235. package/dist/src/execution/sandbox/session.d.ts +8 -8
  236. package/dist/src/execution/sandbox/session.js +1 -1
  237. package/dist/src/execution/session/admission.js +1 -1
  238. package/dist/src/execution/session/handoff-steps.js +1 -1
  239. package/dist/src/execution/session/handoff.d.ts +2 -1
  240. package/dist/src/execution/session/handoff.js +1 -1
  241. package/dist/src/execution/session/input-queue.d.ts +4 -1
  242. package/dist/src/execution/session/input-queue.js +1 -1
  243. package/dist/src/execution/session/next-input.js +1 -1
  244. package/dist/src/execution/session/program.js +1 -1
  245. package/dist/src/execution/session/turn-step.js +1 -1
  246. package/dist/src/execution/session/turn.js +1 -1
  247. package/dist/src/execution/session-inbox/protocol.js +1 -1
  248. package/dist/src/execution/session-workflow-tool-run.js +1 -1
  249. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  250. package/dist/src/execution/stable-workflow-names.d.ts +0 -1
  251. package/dist/src/execution/stable-workflow-names.js +1 -1
  252. package/dist/src/execution/tasks/child/notify.d.ts +44 -0
  253. package/dist/src/execution/tasks/child/notify.js +1 -0
  254. package/dist/src/execution/tasks/parent/control-shared.d.ts +2 -5
  255. package/dist/src/execution/tasks/parent/control-shared.js +1 -1
  256. package/dist/src/execution/tasks/parent/delegate.d.ts +8 -36
  257. package/dist/src/execution/tasks/parent/delegate.js +1 -1
  258. package/dist/src/execution/tasks/parent/dispatch.d.ts +3 -5
  259. package/dist/src/execution/tasks/parent/dispatch.js +1 -1
  260. package/dist/src/execution/tasks/parent/hitl-proxy-steps.d.ts +4 -1
  261. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
  262. package/dist/src/execution/tasks/parent/run-parent.d.ts +5 -19
  263. package/dist/src/execution/tasks/parent/run-parent.js +1 -1
  264. package/dist/src/execution/tasks/parent/task-cancel.d.ts +6 -5
  265. package/dist/src/execution/tasks/parent/task-cancel.js +1 -1
  266. package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
  267. package/dist/src/execution/tool-auth.d.ts +3 -9
  268. package/dist/src/execution/tool-auth.js +1 -1
  269. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  270. package/dist/src/execution/tools/sleep-workflow.js +1 -1
  271. package/dist/src/execution/tools/subagent/accept-event-step.js +1 -1
  272. package/dist/src/execution/tools/subagent/emit-event-step.d.ts +11 -0
  273. package/dist/src/execution/tools/subagent/emit-event-step.js +1 -0
  274. package/dist/src/execution/tools/subagent/invoke-agent.d.ts +5 -7
  275. package/dist/src/execution/tools/subagent/invoke-agent.js +1 -1
  276. package/dist/src/execution/tools/subagent/invoke-preparation.js +1 -1
  277. package/dist/src/execution/tools/subagent/invoke-step.d.ts +3 -2
  278. package/dist/src/execution/tools/subagent/invoke-step.js +1 -1
  279. package/dist/src/execution/tools/subagent/start.d.ts +1 -0
  280. package/dist/src/execution/tools/subagent/task-agent-requests.d.ts +0 -1
  281. package/dist/src/execution/tools/subagent/task-agent-requests.js +1 -1
  282. package/dist/src/execution/tools/subagent/task-cancel.d.ts +1 -1
  283. package/dist/src/execution/tools/subagent/task-cancel.js +1 -1
  284. package/dist/src/execution/tools/workflow/background.d.ts +1 -1
  285. package/dist/src/execution/tools/workflow/background.js +1 -1
  286. package/dist/src/execution/tools/workflow/body.d.ts +0 -2
  287. package/dist/src/execution/tools/workflow/body.js +1 -1
  288. package/dist/src/execution/tools/workflow/cancel.d.ts +4 -3
  289. package/dist/src/execution/tools/workflow/cancel.js +1 -1
  290. package/dist/src/execution/tools/workflow/cancellation-policy.d.ts +2 -0
  291. package/dist/src/execution/tools/workflow/cancellation-policy.js +1 -0
  292. package/dist/src/execution/tools/workflow/messages.d.ts +0 -1
  293. package/dist/src/execution/tools/workflow/owner-channels.d.ts +6 -6
  294. package/dist/src/execution/tools/workflow/owner-inbox.d.ts +5 -9
  295. package/dist/src/execution/tools/workflow/owner-inbox.js +1 -1
  296. package/dist/src/execution/tools/workflow/owner.d.ts +6 -2
  297. package/dist/src/execution/tools/workflow/owner.js +1 -1
  298. package/dist/src/execution/tools/workflow/start.js +1 -1
  299. package/dist/src/execution/tools/workflow/types.d.ts +11 -19
  300. package/dist/src/execution/tools/workflow/types.js +1 -1
  301. package/dist/src/execution/tools/workflow/workflow-owner-background.d.ts +13 -0
  302. package/dist/src/execution/tools/workflow/workflow-owner-background.js +1 -0
  303. package/dist/src/execution/tools/workflow/workflow-owner-blocking.d.ts +12 -0
  304. package/dist/src/execution/tools/workflow/workflow-owner-blocking.js +1 -0
  305. package/dist/src/execution/tools/workflow/workflow.d.ts +3 -3
  306. package/dist/src/execution/tools/workflow/workflow.js +1 -1
  307. package/dist/src/execution/workflow-runtime.d.ts +0 -4
  308. package/dist/src/execution/workflow-runtime.js +1 -1
  309. package/dist/src/framework/sources/modules/sandbox.d.ts +2 -1
  310. package/dist/src/framework/sources/modules/sandbox.js +1 -1
  311. package/dist/src/harness/approval-delivery-coordinator.js +1 -1
  312. package/dist/src/harness/background-tools.d.ts +3 -5
  313. package/dist/src/harness/coordination.js +1 -1
  314. package/dist/src/harness/emission.js +1 -1
  315. package/dist/src/harness/execute-tool.d.ts +2 -29
  316. package/dist/src/harness/hitl/approval-input-requests.d.ts +1 -1
  317. package/dist/src/harness/hitl/approval-input-requests.js +1 -1
  318. package/dist/src/harness/input-requests.d.ts +6 -0
  319. package/dist/src/harness/input-requests.js +1 -1
  320. package/dist/src/harness/messages.d.ts +2 -1
  321. package/dist/src/harness/messages.js +1 -1
  322. package/dist/src/harness/pending-input-batches.d.ts +1 -0
  323. package/dist/src/harness/pending-input-batches.js +1 -1
  324. package/dist/src/harness/tool-loop.js +2 -2
  325. package/dist/src/harness/tool-model-output.js +1 -1
  326. package/dist/src/harness/tools.js +1 -1
  327. package/dist/src/harness/workflow-tool-runs.d.ts +53 -18
  328. package/dist/src/harness/workflow-tool-runs.js +1 -1
  329. package/dist/src/instrumentation/ai-sdk-warnings.d.ts +6 -0
  330. package/dist/src/instrumentation/ai-sdk-warnings.js +1 -0
  331. package/dist/src/instrumentation/runtime.d.ts +1 -0
  332. package/dist/src/instrumentation/runtime.js +1 -1
  333. package/dist/src/internal/application/compiled-artifacts.d.ts +2 -0
  334. package/dist/src/internal/application/compiled-artifacts.js +2 -2
  335. package/dist/src/internal/application/package.js +1 -1
  336. package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
  337. package/dist/src/internal/nitro/host/artifacts-config.d.ts +6 -1
  338. package/dist/src/internal/nitro/host/artifacts-config.js +1 -1
  339. package/dist/src/internal/nitro/host/build-application.js +1 -1
  340. package/dist/src/internal/nitro/host/compiled-sandbox-provider-prune-plugin.d.ts +16 -0
  341. package/dist/src/internal/nitro/host/compiled-sandbox-provider-prune-plugin.js +5 -0
  342. package/dist/src/internal/nitro/host/configure-nitro-routes.js +2 -2
  343. package/dist/src/internal/nitro/host/create-application-nitro.d.ts +3 -3
  344. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  345. package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.js +1 -1
  346. package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
  347. package/dist/src/internal/nitro/host/prepare-application-host.d.ts +1 -0
  348. package/dist/src/internal/nitro/host/prepare-application-host.js +1 -1
  349. package/dist/src/internal/nitro/host/sandbox-shutdown-plugin.js +1 -1
  350. package/dist/src/internal/nitro/host/start-development-server.js +2 -2
  351. package/dist/src/internal/nitro/host/start-production-server.js +2 -2
  352. package/dist/src/internal/nitro/host/types.d.ts +1 -1
  353. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
  354. package/dist/src/internal/nitro/routes/runtime-artifacts.d.ts +1 -0
  355. package/dist/src/internal/nitro/routes/runtime-artifacts.js +1 -1
  356. package/dist/src/internal/runtime-registry.d.ts +2 -2
  357. package/dist/src/internal/vercel/build-agent-workspace.d.ts +3 -1
  358. package/dist/src/internal/vercel/build-agent-workspace.js +1 -1
  359. package/dist/src/protocol/message.d.ts +4 -4
  360. package/dist/src/public/channels/chat-sdk/chatSdkChannel.d.ts +4 -5
  361. package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +2 -2
  362. package/dist/src/public/channels/github/checkout.js +1 -1
  363. package/dist/src/public/channels/index.d.ts +1 -1
  364. package/dist/src/public/channels/slack/slackChannel.d.ts +3 -1
  365. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  366. package/dist/src/public/definitions/channel.d.ts +1 -1
  367. package/dist/src/public/definitions/sandbox.d.ts +5 -43
  368. package/dist/src/public/definitions/sandbox.js +1 -1
  369. package/dist/src/public/local-dev.d.ts +4 -5
  370. package/dist/src/public/sandbox/docker-sandbox.d.ts +16 -40
  371. package/dist/src/public/sandbox/docker.d.ts +2 -2
  372. package/dist/src/public/sandbox/docker.js +1 -1
  373. package/dist/src/public/sandbox/index.d.ts +4 -9
  374. package/dist/src/public/sandbox/index.js +1 -1
  375. package/dist/src/public/sandbox/just-bash-sandbox.d.ts +11 -6
  376. package/dist/src/public/sandbox/just-bash.d.ts +2 -2
  377. package/dist/src/public/sandbox/just-bash.js +1 -1
  378. package/dist/src/public/sandbox/microsandbox-sandbox.d.ts +11 -17
  379. package/dist/src/public/sandbox/microsandbox.d.ts +2 -2
  380. package/dist/src/public/sandbox/microsandbox.js +1 -1
  381. package/dist/src/public/sandbox/provider.d.ts +1 -0
  382. package/dist/src/public/sandbox/provider.js +1 -0
  383. package/dist/src/public/sandbox/vercel-sandbox.d.ts +10 -41
  384. package/dist/src/public/sandbox/vercel.d.ts +2 -2
  385. package/dist/src/public/sandbox/vercel.js +1 -1
  386. package/dist/src/public/tools/index.d.ts +2 -2
  387. package/dist/src/runtime/agent/resolve-model.js +1 -1
  388. package/dist/src/runtime/cache-key.js +1 -1
  389. package/dist/src/runtime/compiled-artifacts-source.d.ts +6 -1
  390. package/dist/src/runtime/compiled-artifacts-source.js +1 -1
  391. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  392. package/dist/src/runtime/loaders/artifact-paths.d.ts +1 -0
  393. package/dist/src/runtime/loaders/artifact-paths.js +1 -1
  394. package/dist/src/runtime/loaders/bundled-artifacts.d.ts +3 -0
  395. package/dist/src/runtime/loaders/bundled-artifacts.js +1 -1
  396. package/dist/src/runtime/loaders/compile-metadata.js +1 -1
  397. package/dist/src/runtime/loaders/manifest.js +1 -1
  398. package/dist/src/runtime/loaders/module-map.js +1 -1
  399. package/dist/src/runtime/local-dev-capability.d.ts +14 -12
  400. package/dist/src/runtime/local-dev-capability.js +1 -1
  401. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  402. package/dist/src/runtime/resolve-sandbox.d.ts +1 -10
  403. package/dist/src/runtime/resolve-sandbox.js +1 -1
  404. package/dist/src/runtime/sandbox/prepared-artifacts.d.ts +13 -0
  405. package/dist/src/runtime/sandbox/prepared-artifacts.js +1 -0
  406. package/dist/src/runtime/sandbox/registry.d.ts +2 -9
  407. package/dist/src/runtime/sandbox/registry.js +1 -1
  408. package/dist/src/runtime/sessions/runtime-session.js +1 -1
  409. package/dist/src/runtime/sessions/turn.d.ts +10 -8
  410. package/dist/src/runtime/subagents/registry.js +1 -1
  411. package/dist/src/runtime/subagents/workflow.js +1 -1
  412. package/dist/src/runtime/tools/registry.js +1 -1
  413. package/dist/src/runtime/types.d.ts +13 -26
  414. package/dist/src/runtime/workspace/types.d.ts +1 -1
  415. package/dist/src/sandbox/providers/default.d.ts +27 -0
  416. package/dist/src/sandbox/providers/default.js +1 -0
  417. package/dist/src/sandbox/providers/docker.d.ts +11 -0
  418. package/dist/src/sandbox/providers/docker.js +1 -0
  419. package/dist/src/sandbox/providers/just-bash.d.ts +4 -0
  420. package/dist/src/sandbox/providers/just-bash.js +1 -0
  421. package/dist/src/sandbox/providers/microsandbox.d.ts +12 -0
  422. package/dist/src/sandbox/providers/microsandbox.js +1 -0
  423. package/dist/src/sandbox/providers/vercel.d.ts +12 -0
  424. package/dist/src/sandbox/providers/vercel.js +1 -0
  425. package/dist/src/sandbox/providers.d.ts +5 -0
  426. package/dist/src/sandbox/providers.js +1 -0
  427. package/dist/src/sandbox/state.d.ts +6 -25
  428. package/dist/src/self-modification/extension/subagents/agent/agent.d.ts +1 -1
  429. package/dist/src/self-modification/extension/subagents/agent/agent.js +1 -1
  430. package/dist/src/self-modification/extension/subagents/agent/sandbox.d.ts +2 -25
  431. package/dist/src/self-modification/extension/subagents/agent/sandbox.js +1 -1
  432. package/dist/src/self-modification/extension/subagents/agent/tools/publish.js +1 -1
  433. package/dist/src/self-modification/extension/subagents/agent/tools/registry_add.js +1 -1
  434. package/dist/src/self-modification/filesystem.d.ts +3 -1
  435. package/dist/src/self-modification/filesystem.js +1 -1
  436. package/dist/src/self-modification/git-workspace.d.ts +1 -1
  437. package/dist/src/self-modification/git.d.ts +1 -1
  438. package/dist/src/self-modification/sandbox.d.ts +14 -9
  439. package/dist/src/self-modification/sandbox.js +1 -1
  440. package/dist/src/setup/boxes/select-model.js +1 -1
  441. package/dist/src/setup/cli/select-state.d.ts +4 -2
  442. package/dist/src/setup/cli/select-state.js +1 -1
  443. package/dist/src/setup/flows/model-login.js +1 -1
  444. package/dist/src/setup/flows/model.d.ts +5 -5
  445. package/dist/src/setup/primitives/pm/pnpm.js +3 -2
  446. package/dist/src/setup/scaffold/create/project.js +1 -1
  447. package/dist/src/shared/action-types.d.ts +0 -4
  448. package/dist/src/shared/action-types.js +1 -1
  449. package/dist/src/shared/default-agent-model.d.ts +1 -1
  450. package/dist/src/shared/default-agent-model.js +1 -1
  451. package/dist/src/shared/sandbox-environment.d.ts +45 -0
  452. package/dist/src/shared/sandbox-environment.js +1 -0
  453. package/dist/src/shared/sandbox-network-policy.d.ts +8 -3
  454. package/dist/src/shared/sandbox-network-policy.js +1 -1
  455. package/dist/src/shared/sandbox-prepared-artifacts.d.ts +16 -0
  456. package/dist/src/shared/sandbox-prepared-artifacts.js +1 -0
  457. package/dist/src/shared/sandbox-provider.d.ts +110 -0
  458. package/dist/src/shared/sandbox-provider.js +1 -0
  459. package/dist/src/shared/sandbox-session.d.ts +18 -41
  460. package/dist/src/shared/sandbox-template-error.d.ts +9 -0
  461. package/dist/src/shared/sandbox-template-error.js +1 -0
  462. package/dist/src/subagents/tool.d.ts +1 -1
  463. package/dist/src/subagents/tool.js +1 -1
  464. package/dist/src/svelte/index.js +1 -1
  465. package/dist/src/svelte/use-eve-agent.js +1 -1
  466. package/dist/src/tasks/delivery-context.d.ts +6 -4
  467. package/dist/src/tasks/delivery-context.js +2 -2
  468. package/dist/src/tasks/delivery-policy.d.ts +2 -0
  469. package/dist/src/tasks/delivery-policy.js +1 -1
  470. package/dist/src/tasks/notification.d.ts +4 -0
  471. package/dist/src/tasks/notification.js +1 -0
  472. package/dist/src/tasks/session-task-cohorts.d.ts +1 -12
  473. package/dist/src/tasks/session-task-cohorts.js +1 -1
  474. package/dist/src/tasks/transitions.d.ts +5 -2
  475. package/dist/src/tasks/transitions.js +1 -1
  476. package/dist/src/tasks/types.d.ts +2 -52
  477. package/dist/src/tasks/types.js +1 -1
  478. package/dist/src/tools/definition.d.ts +1 -25
  479. package/dist/src/tools/definition.js +1 -1
  480. package/dist/src/tools/dynamic.d.ts +1 -3
  481. package/dist/src/tools/framework/agent-contract.js +1 -1
  482. package/dist/src/tools/framework/agent.d.ts +16 -22
  483. package/dist/src/tools/framework/agent.js +1 -1
  484. package/dist/src/tools/workflow-definition.d.ts +16 -5
  485. package/dist/src/tracing/agent-invocation-coordinator.js +1 -1
  486. package/dist/src/tracing/agent-trace-context-store.js +1 -1
  487. package/dist/src/vue/index.js +1 -1
  488. package/dist/src/vue/use-eve-agent.js +1 -1
  489. package/docs/README.md +40 -45
  490. package/docs/agent-config.md +2 -2
  491. package/docs/channels/eve.mdx +1 -1
  492. package/docs/channels/overview.mdx +48 -0
  493. package/docs/concepts/execution-model-and-durability.mdx +5 -6
  494. package/docs/concepts/sessions-runs-and-streaming.md +5 -5
  495. package/docs/dynamic-configuration/meta.json +5 -0
  496. package/docs/evals/assertions.mdx +5 -1
  497. package/docs/evals/overview.mdx +43 -0
  498. package/docs/getting-started.mdx +1 -1
  499. package/docs/guides/client/overview.mdx +1 -1
  500. package/docs/guides/deployment/overview.md +1 -1
  501. package/docs/guides/deployment/self-hosting.md +5 -5
  502. package/docs/guides/deployment/vercel.mdx +10 -12
  503. package/docs/guides/dev-tui.md +22 -10
  504. package/docs/guides/frontend/overview.mdx +1 -1
  505. package/docs/guides/hooks.md +4 -0
  506. package/docs/memory/meta.json +1 -1
  507. package/docs/memory/overview.mdx +4 -0
  508. package/docs/meta.json +13 -16
  509. package/docs/patterns/meta.json +2 -2
  510. package/docs/protocols/acp.md +1 -1
  511. package/docs/protocols/ucp.mdx +1 -1
  512. package/docs/reference/cli.md +10 -9
  513. package/docs/reference/meta.json +4 -1
  514. package/docs/reference/typescript-api.md +1 -24
  515. package/docs/sandbox/default.mdx +17 -0
  516. package/docs/sandbox/docker.mdx +29 -0
  517. package/docs/sandbox/index.mdx +216 -0
  518. package/docs/sandbox/just-bash.mdx +18 -0
  519. package/docs/sandbox/meta.json +5 -0
  520. package/docs/sandbox/microsandbox.mdx +31 -0
  521. package/docs/sandbox/vercel.mdx +106 -0
  522. package/docs/schedules.mdx +35 -1
  523. package/docs/subagents/index.mdx +27 -6
  524. package/docs/subagents/meta.json +1 -1
  525. package/docs/tools/overview.mdx +37 -37
  526. package/docs/tools/workflows.mdx +31 -24
  527. package/docs/tutorial/run-analysis.mdx +6 -5
  528. package/package.json +20 -11
  529. package/dist/src/cli/dev/tui/model-editor.d.ts +0 -103
  530. package/dist/src/cli/dev/tui/model-editor.js +0 -1
  531. package/dist/src/compiled/_chunks/node/chunk-5OX2R7AJ-CxVV-owP.js +0 -1
  532. package/dist/src/compiled/_chunks/node/chunk-AYN7QRWH-B__hKQV7.js +0 -1
  533. package/dist/src/compiled/_chunks/node/chunk-QZV7YRVM-Dzw4WEBv.js +0 -1
  534. package/dist/src/compiled/_chunks/node/dist-CweJdVFE.js +0 -6
  535. package/dist/src/compiled/_chunks/node/dist-Da54NuK8.js +0 -96
  536. package/dist/src/compiled/_chunks/workflow/attribute-changes-A6HfMNG3.js +0 -6
  537. package/dist/src/compiled/_chunks/workflow/resume-hook-CAqlhwic.js +0 -1
  538. package/dist/src/compiled/_chunks/workflow/sleep-CbUwdv6O.js +0 -1
  539. package/dist/src/compiled/chat/_mdast.d.ts +0 -24
  540. package/dist/src/compiled/chat/_workflow-serde.d.ts +0 -3
  541. package/dist/src/compiled/chat/jsx-runtime-_JEEAotp.d.ts +0 -907
  542. package/dist/src/execution/sandbox/bindings/local-backend-utils.js +0 -1
  543. package/dist/src/execution/sandbox/lazy-backend.d.ts +0 -15
  544. package/dist/src/execution/sandbox/lazy-backend.js +0 -1
  545. package/dist/src/execution/sandbox/template-prewarm-lock.d.ts +0 -8
  546. package/dist/src/execution/sandbox/template-prewarm-lock.js +0 -1
  547. package/dist/src/execution/tasks/child/steps.d.ts +0 -81
  548. package/dist/src/execution/tasks/child/steps.js +0 -1
  549. package/dist/src/execution/tasks/child/workflow.d.ts +0 -28
  550. package/dist/src/execution/tasks/child/workflow.js +0 -1
  551. package/dist/src/execution/tools/subagent/emit-called-step.d.ts +0 -9
  552. package/dist/src/execution/tools/subagent/emit-called-step.js +0 -1
  553. package/dist/src/execution/tools/workflow/run-control.d.ts +0 -14
  554. package/dist/src/execution/tools/workflow/run-control.js +0 -1
  555. package/dist/src/internal/authored-definition/sandbox.d.ts +0 -17
  556. package/dist/src/internal/authored-definition/sandbox.js +0 -1
  557. package/dist/src/internal/nitro/host/compiled-sandbox-backend-prune-plugin.d.ts +0 -16
  558. package/dist/src/internal/nitro/host/compiled-sandbox-backend-prune-plugin.js +0 -2
  559. package/dist/src/public/definitions/sandbox-backend.d.ts +0 -17
  560. package/dist/src/public/definitions/sandbox-backend.js +0 -1
  561. package/dist/src/public/sandbox/backends/default.d.ts +0 -1
  562. package/dist/src/public/sandbox/backends/default.js +0 -1
  563. package/dist/src/public/sandbox/backends/docker.d.ts +0 -1
  564. package/dist/src/public/sandbox/backends/docker.js +0 -1
  565. package/dist/src/public/sandbox/backends/just-bash.d.ts +0 -1
  566. package/dist/src/public/sandbox/backends/just-bash.js +0 -1
  567. package/dist/src/public/sandbox/backends/microsandbox.d.ts +0 -1
  568. package/dist/src/public/sandbox/backends/microsandbox.js +0 -1
  569. package/dist/src/public/sandbox/backends/vercel.d.ts +0 -1
  570. package/dist/src/public/sandbox/backends/vercel.js +0 -1
  571. package/dist/src/runtime/sandbox/keys.d.ts +0 -42
  572. package/dist/src/runtime/sandbox/keys.js +0 -1
  573. package/dist/src/runtime/sandbox/template-plan.d.ts +0 -24
  574. package/dist/src/runtime/sandbox/template-plan.js +0 -1
  575. package/dist/src/sandbox/backends/default.d.ts +0 -42
  576. package/dist/src/sandbox/backends/default.js +0 -1
  577. package/dist/src/sandbox/backends/docker.d.ts +0 -14
  578. package/dist/src/sandbox/backends/docker.js +0 -1
  579. package/dist/src/sandbox/backends/just-bash.d.ts +0 -17
  580. package/dist/src/sandbox/backends/just-bash.js +0 -1
  581. package/dist/src/sandbox/backends/microsandbox.d.ts +0 -17
  582. package/dist/src/sandbox/backends/microsandbox.js +0 -1
  583. package/dist/src/sandbox/backends/vercel.d.ts +0 -30
  584. package/dist/src/sandbox/backends/vercel.js +0 -1
  585. package/dist/src/shared/sandbox-backend.d.ts +0 -176
  586. package/dist/src/shared/sandbox-backend.js +0 -1
  587. package/dist/src/shared/sandbox-definition.d.ts +0 -112
  588. package/dist/src/shared/sandbox-definition.js +0 -1
  589. package/dist/src/tasks/session-index.d.ts +0 -65
  590. package/dist/src/tasks/session-index.js +0 -1
  591. package/dist/src/tools/task.d.ts +0 -55
  592. package/dist/src/tools/task.js +0 -1
  593. package/docs/sandbox.mdx +0 -342
@@ -0,0 +1 @@
1
+ var SandboxTemplateNotProvisionedError=class SandboxTemplateNotProvisionedError extends Error{providerName;templateKey;constructor(e){super(`Sandbox template "${e.templateKey}" is not provisioned for provider "${e.providerName}". Run \`eve build\` before serving traffic.`),this.name=`SandboxTemplateNotProvisionedError`,this.providerName=e.providerName,this.templateKey=e.templateKey}static is(e){return e instanceof SandboxTemplateNotProvisionedError||typeof e==`object`&&!!e&&Reflect.get(e,`name`)===`SandboxTemplateNotProvisionedError`&&typeof Reflect.get(e,`providerName`)==`string`&&typeof Reflect.get(e,`templateKey`)==`string`}};export{SandboxTemplateNotProvisionedError};
@@ -32,7 +32,7 @@ export interface SubagentSandboxGraph {
32
32
  readonly sandboxRegistry: {
33
33
  readonly sandbox: {
34
34
  readonly definition: {
35
- readonly inheritsParent?: boolean;
35
+ readonly kind: "independent" | "parent";
36
36
  };
37
37
  } | null;
38
38
  };
@@ -1 +1 @@
1
- import{mintSubagentContinuationToken}from"#execution/session.js";import{formatSubagentInput,normalizeRequestedOutputSchema}from"#subagents/invocation.js";import{SUBAGENT_ADAPTER_KIND}from"#subagents/adapter-state.js";import{resolveRemainingSessionTokenLimits}from"#subagents/token-budget.js";function buildSubagentRunInput(e){let{action:t,auth:n,capabilities:r,channelMetadata:i,inheritedConversation:a,initiatorAuth:o,session:s,source:c}=e,l=mintSubagentContinuationToken(`${s.sessionId}:${t.callId}`),u=resolveRemainingSessionTokenLimits(s,e.fanoutSize),d=normalizeRequestedOutputSchema(t.input.outputSchema),f={callId:t.callId,parentContinuationToken:e.parent.continuationToken??s.continuationToken,parentSessionId:s.sessionId,subagentName:t.subagentName};e.taskId!==void 0&&(f.taskId=e.taskId),(e.graph?.nodesByNodeId.get(t.nodeId)?.sandboxRegistry.sandbox?.definition.inheritsParent===!0||e.selfAgent)&&(s.sandboxState!==void 0&&(f.parentSandboxState=s.sandboxState),f.sandboxSessionId=e.sandboxSessionId??s.sessionId);let p={adapter:{kind:SUBAGENT_ADAPTER_KIND,state:f},auth:n,capabilities:r,channelMetadata:i,inheritedConversation:a,continuationToken:l,initiatorAuth:o,input:{message:formatSubagentCallInputMessage({action:t,source:c}),outputSchema:d??c.outputSchema},limits:u,mode:`conversation`,conversationId:e.parent.conversationId,parent:e.parent.lineage,parentTraceContext:e.parent.traceContext,activityObserver:e.activityObserver};return e.taskId!==void 0&&(p.taskId=e.taskId),{childContinuationToken:l,runInput:p}}function formatSubagentCallInputMessage(e){let{message:t}=e.action.input;switch(e.source.type){case`local`:return formatSubagentInput({description:e.source.description,message:t,name:e.action.subagentName,type:`local`}).message;case`runtime`:return formatSubagentInput({message:t,name:e.action.subagentName,type:`runtime`}).message;default:return e.source}}export{buildSubagentRunInput};
1
+ import{mintSubagentContinuationToken}from"#execution/session.js";import{formatSubagentInput,normalizeRequestedOutputSchema}from"#subagents/invocation.js";import{SUBAGENT_ADAPTER_KIND}from"#subagents/adapter-state.js";import{resolveRemainingSessionTokenLimits}from"#subagents/token-budget.js";function buildSubagentRunInput(e){let{action:t,auth:n,capabilities:r,channelMetadata:i,inheritedConversation:a,initiatorAuth:o,session:s,source:c}=e,l=mintSubagentContinuationToken(`${s.sessionId}:${t.callId}`),u=resolveRemainingSessionTokenLimits(s,e.fanoutSize),d=normalizeRequestedOutputSchema(t.input.outputSchema),f={callId:t.callId,parentContinuationToken:e.parent.continuationToken??s.continuationToken,parentSessionId:s.sessionId,subagentName:t.subagentName};e.taskId!==void 0&&(f.taskId=e.taskId),(e.graph?.nodesByNodeId.get(t.nodeId)?.sandboxRegistry.sandbox?.definition.kind===`parent`||e.selfAgent)&&(s.sandboxState!==void 0&&(f.parentSandboxState=s.sandboxState),f.sandboxSessionId=e.sandboxSessionId??s.sessionId);let p={adapter:{kind:SUBAGENT_ADAPTER_KIND,state:f},auth:n,capabilities:r,channelMetadata:i,inheritedConversation:a,continuationToken:l,initiatorAuth:o,input:{message:formatSubagentCallInputMessage({action:t,source:c}),outputSchema:d??c.outputSchema},limits:u,mode:`conversation`,conversationId:e.parent.conversationId,parent:e.parent.lineage,parentTraceContext:e.parent.traceContext,activityObserver:e.activityObserver};return e.taskId!==void 0&&(p.taskId=e.taskId),{childContinuationToken:l,runInput:p}}function formatSubagentCallInputMessage(e){let{message:t}=e.action.input;switch(e.source.type){case`local`:return formatSubagentInput({description:e.source.description,message:t,name:e.action.subagentName,type:`local`}).message;case`runtime`:return formatSubagentInput({message:t,name:e.action.subagentName,type:`runtime`}).message;default:return e.source}}export{buildSubagentRunInput};
@@ -1,3 +1,3 @@
1
- import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-CVWk5KKy.js";
1
+ import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-IIuxkn6y.js";
2
2
 
3
3
  export { defaultMessageReducer, useEveAgent };
@@ -1,3 +1,3 @@
1
- import { t as useEveAgent } from "../chunks/use-eve-agent-CVWk5KKy.js";
1
+ import { t as useEveAgent } from "../chunks/use-eve-agent-IIuxkn6y.js";
2
2
 
3
3
  export { useEveAgent };
@@ -1,8 +1,9 @@
1
- import type { DeliverHookPayload } from "#channel/types.js";
1
+ import type { TaskDeliveryPolicy, DeliverHookPayload } from "#channel/types.js";
2
2
  import type { SessionStateMap, StepInput } from "#harness/types.js";
3
3
  export declare const TASK_DELIVERY_CONTEXT_LABEL = "[Task state]";
4
4
  export declare const TASK_DELIVERY_INITIATING_INSTRUCTION = "Background task reporting: launch acknowledgement\nThe latest [Task state] message is runtime-authored and lists background tasks accepted so far from the current turn. They continue independently after this turn.\n\nContinue carrying out the user's request, including starting any remaining background work. When no further tool calls are needed in this turn, send one brief user-facing acknowledgement that the background work has started. Do not wait for results or report results that are not available yet. End the turn after the acknowledgement.";
5
- export declare const TASK_DELIVERY_SETTLED_INSTRUCTION = "Background task reporting\nThis turn was triggered by background task activity. The accompanying [Task state] message is runtime-authored and lists overlapping background tasks in the same cohort, potentially started across different user turns, all settled, with every available terminal output. Do not reply with <eve-empty-delivery/>. Send one user-facing response that combines their useful results.";
5
+ export declare const TASK_DELIVERY_SETTLED_INSTRUCTION = "Background task reporting\nFor this background-task update, the accompanying [Task state] message is runtime-authored and lists the settled tasks in this cohort and their available terminal outputs. Report their useful results together in one user-facing response without repeating results already reported. Do not reply with <eve-empty-delivery/>.";
6
+ export declare const TASK_DELIVERY_AUTO_INSTRUCTION = "Background task reporting\nFor this background-task update, the accompanying [Task state] message is runtime-authored and lists the whole cohort, including pending tasks and every available terminal output. A received result has not necessarily been reported to the user. Report new results only when they are useful independently of unfinished work. When that work settles, combine its results with any previously withheld results. If there is nothing new and useful to report, reply with exactly <eve-empty-delivery/>. Do not repeat results already reported or send an acknowledgement just to say you are waiting.";
6
7
  type BackgroundTaskDelivery = DeliverHookPayload & {
7
8
  readonly taskDeliveryId: string;
8
9
  };
@@ -10,10 +11,11 @@ type BackgroundTaskDelivery = DeliverHookPayload & {
10
11
  export declare function getBackgroundTaskDelivery(input: unknown): BackgroundTaskDelivery | undefined;
11
12
  /** Marks a task-produced user message before the harness coalesces delivery results. */
12
13
  export declare function markBackgroundTaskStepInput(input: StepInput): StepInput;
13
- /** Groups overlapping tasks without changing the delivered task's activity root. */
14
+ /** Projects the report group without changing the delivered task's activity root. */
14
15
  export declare function resolveTaskDeliveryContext(input: {
15
16
  readonly state: SessionStateMap | undefined;
16
- readonly taskDeliveryId: string;
17
+ readonly taskDeliveryIds: readonly string[];
18
+ readonly taskDeliveryPolicy: TaskDeliveryPolicy;
17
19
  }): {
18
20
  readonly context: string;
19
21
  readonly phase: "pending" | "settled";
@@ -1,4 +1,4 @@
1
- import{markFrameworkStepInput}from"#harness/messages.js";import{getSessionTaskIndex}from"#tasks/session-index.js";import{getTaskCohortId}from"#tasks/session-task-cohorts.js";import{EMPTY_DELIVERY_SENTINEL}from"#shared/empty-delivery.js";const TASK_DELIVERY_CONTEXT_LABEL=`[Task state]`,TASK_DELIVERY_INITIATING_INSTRUCTION=`Background task reporting: launch acknowledgement
1
+ import{markFrameworkStepInput}from"#harness/messages.js";import{getBackgroundWorkflowToolRuns,readWorkflowTaskView}from"#harness/workflow-tool-runs.js";import{getTaskCohortId}from"#tasks/session-task-cohorts.js";import{EMPTY_DELIVERY_SENTINEL}from"#shared/empty-delivery.js";const TASK_DELIVERY_CONTEXT_LABEL=`[Task state]`,TASK_DELIVERY_INITIATING_INSTRUCTION=`Background task reporting: launch acknowledgement
2
2
  The latest ${TASK_DELIVERY_CONTEXT_LABEL} message is runtime-authored and lists background tasks accepted so far from the current turn. They continue independently after this turn.
3
3
 
4
- Continue carrying out the user's request, including starting any remaining background work. When no further tool calls are needed in this turn, send one brief user-facing acknowledgement that the background work has started. Do not wait for results or report results that are not available yet. End the turn after the acknowledgement.`,TASK_DELIVERY_SETTLED_INSTRUCTION=`Background task reporting\nThis turn was triggered by background task activity. The accompanying ${TASK_DELIVERY_CONTEXT_LABEL} message is runtime-authored and lists overlapping background tasks in the same cohort, potentially started across different user turns, all settled, with every available terminal output. Do not reply with ${EMPTY_DELIVERY_SENTINEL}. Send one user-facing response that combines their useful results.`;function getBackgroundTaskDelivery(e){if(typeof e!=`object`||!e)return;let t=e;return t.kind===`deliver`&&typeof t.taskDeliveryId==`string`?e:void 0}function markBackgroundTaskStepInput(e){return e.message===void 0?e:markFrameworkStepInput(e,`execution.background_task`)}function resolveTaskDeliveryContext(e){let t=getSessionTaskIndex(e.state),n=t.find(t=>e.taskDeliveryId.startsWith(`${t.taskId}:`));return n===void 0?void 0:{...projectTaskCohort(t.filter(e=>getTaskCohortId(e)===getTaskCohortId(n))),rootTurnId:n.createdByTurnId}}function resolveInitiatingTaskContext(e){let t=getSessionTaskIndex(e.state).filter(t=>t.createdByTurnId===e.turnId);if(t.some(e=>e.executor!==void 0&&e.terminalView===void 0))return{...projectTaskCohort(t),phase:`initiating`}}function projectTaskCohort(e){let t=e.every(e=>e.terminalView!==void 0),n=e.map(e=>({name:e.metadata.name,output:t?e.terminalView?.lastOutput:void 0,status:e.terminalView?.status??`pending`,taskId:e.taskId}));return{context:`${TASK_DELIVERY_CONTEXT_LABEL}\n${JSON.stringify({tasks:n})}`,phase:t?`settled`:`pending`}}export{TASK_DELIVERY_CONTEXT_LABEL,TASK_DELIVERY_INITIATING_INSTRUCTION,TASK_DELIVERY_SETTLED_INSTRUCTION,getBackgroundTaskDelivery,markBackgroundTaskStepInput,resolveInitiatingTaskContext,resolveTaskDeliveryContext};
4
+ Continue carrying out the user's request, including starting any remaining background work. When no further tool calls are needed in this turn, send one brief user-facing acknowledgement that the background work has started. Do not wait for results or report results that are not available yet. End the turn after the acknowledgement.`,TASK_DELIVERY_SETTLED_INSTRUCTION=`Background task reporting\nFor this background-task update, the accompanying ${TASK_DELIVERY_CONTEXT_LABEL} message is runtime-authored and lists the settled tasks in this cohort and their available terminal outputs. Report their useful results together in one user-facing response without repeating results already reported. Do not reply with ${EMPTY_DELIVERY_SENTINEL}.`,TASK_DELIVERY_AUTO_INSTRUCTION=`Background task reporting\nFor this background-task update, the accompanying ${TASK_DELIVERY_CONTEXT_LABEL} message is runtime-authored and lists the whole cohort, including pending tasks and every available terminal output. A received result has not necessarily been reported to the user. Report new results only when they are useful independently of unfinished work. When that work settles, combine its results with any previously withheld results. If there is nothing new and useful to report, reply with exactly ${EMPTY_DELIVERY_SENTINEL}. Do not repeat results already reported or send an acknowledgement just to say you are waiting.`;function getBackgroundTaskDelivery(e){if(typeof e!=`object`||!e)return;let t=e;return t.kind===`deliver`&&typeof t.taskDeliveryId==`string`?e:void 0}function markBackgroundTaskStepInput(e){return e.message===void 0?e:markFrameworkStepInput(e,`execution.background_task`)}function resolveTaskDeliveryContext(e){let t=e.taskDeliveryIds[0];if(t===void 0)return;let n=getBackgroundWorkflowToolRuns(e.state),r=n.find(e=>t.startsWith(`${e.task.taskId}:`));return r===void 0?void 0:{...projectTaskCohort(n.filter(e=>getTaskCohortId(e.task)===getTaskCohortId(r.task)),e.taskDeliveryPolicy===`auto`),rootTurnId:r.origin.turnId}}function resolveInitiatingTaskContext(e){let t=getBackgroundWorkflowToolRuns(e.state).filter(t=>t.origin.turnId===e.turnId);if(t.some(e=>e.task.outcome===void 0))return{...projectTaskCohort(t,!1),phase:`initiating`}}function projectTaskCohort(e,t){let n=e.every(e=>e.task.outcome!==void 0),r=e.map(e=>{let r=readWorkflowTaskView(e.task);return{name:e.task.metadata.name,output:n||t?r?.lastOutput:void 0,status:r?.status??`pending`,taskId:e.task.taskId}});return{context:`${TASK_DELIVERY_CONTEXT_LABEL}\n${JSON.stringify({tasks:r})}`,phase:n?`settled`:`pending`}}export{TASK_DELIVERY_AUTO_INSTRUCTION,TASK_DELIVERY_CONTEXT_LABEL,TASK_DELIVERY_INITIATING_INSTRUCTION,TASK_DELIVERY_SETTLED_INSTRUCTION,getBackgroundTaskDelivery,markBackgroundTaskStepInput,resolveInitiatingTaskContext,resolveTaskDeliveryContext};
@@ -1,3 +1,4 @@
1
+ import type { TaskDeliveryPolicy } from "#channel/types.js";
1
2
  export interface DeliveryPolicy {
2
3
  readonly allowsEmptyDelivery: boolean;
3
4
  readonly instruction?: string;
@@ -8,5 +9,6 @@ export declare function resolveDeliveryPolicy(input: {
8
9
  readonly isChild: boolean;
9
10
  readonly isFirstTurn: boolean;
10
11
  readonly hasScheduleProvenance: boolean;
12
+ readonly taskDeliveryPolicy: TaskDeliveryPolicy | undefined;
11
13
  readonly taskDeliveryPhase: "none" | "initiating" | "pending" | "settled" | undefined;
12
14
  }): DeliveryPolicy;
@@ -1 +1 @@
1
- import{TASK_DELIVERY_INITIATING_INSTRUCTION,TASK_DELIVERY_SETTLED_INSTRUCTION}from"#tasks/delivery-context.js";import{CONDITIONAL_DELIVERY_INSTRUCTION}from"#shared/empty-delivery.js";const POLICIES={conditional:{allowsEmptyDelivery:!0,instruction:CONDITIONAL_DELIVERY_INSTRUCTION},initiating:{allowsEmptyDelivery:!1,instruction:TASK_DELIVERY_INITIATING_INSTRUCTION},normal:{allowsEmptyDelivery:!1},pending:{allowsEmptyDelivery:!0},settled:{allowsEmptyDelivery:!1,instruction:TASK_DELIVERY_SETTLED_INSTRUCTION}};function resolveDeliveryPolicy(e){return e.hasOutputSchema||e.isChild?POLICIES.normal:e.taskDeliveryPhase===`pending`?POLICIES.pending:e.taskDeliveryPhase===`settled`?POLICIES.settled:e.isFirstTurn&&e.hasScheduleProvenance?POLICIES.conditional:e.taskDeliveryPhase===`initiating`?POLICIES.initiating:POLICIES.normal}export{resolveDeliveryPolicy};
1
+ import{TASK_DELIVERY_AUTO_INSTRUCTION,TASK_DELIVERY_INITIATING_INSTRUCTION,TASK_DELIVERY_SETTLED_INSTRUCTION}from"#tasks/delivery-context.js";import{CONDITIONAL_DELIVERY_INSTRUCTION}from"#shared/empty-delivery.js";const POLICIES={auto:{allowsEmptyDelivery:!0,instruction:TASK_DELIVERY_AUTO_INSTRUCTION},conditional:{allowsEmptyDelivery:!0,instruction:CONDITIONAL_DELIVERY_INSTRUCTION},initiating:{allowsEmptyDelivery:!1,instruction:TASK_DELIVERY_INITIATING_INSTRUCTION},normal:{allowsEmptyDelivery:!1},pending:{allowsEmptyDelivery:!0},settled:{allowsEmptyDelivery:!1,instruction:TASK_DELIVERY_SETTLED_INSTRUCTION}};function resolveDeliveryPolicy(e){return e.hasOutputSchema||e.isChild?POLICIES.normal:e.taskDeliveryPolicy===`auto`&&(e.taskDeliveryPhase===`pending`||e.taskDeliveryPhase===`settled`)?POLICIES.auto:e.taskDeliveryPhase===`pending`?POLICIES.pending:e.taskDeliveryPhase===`settled`?POLICIES.settled:e.isFirstTurn&&e.hasScheduleProvenance?POLICIES.conditional:e.taskDeliveryPhase===`initiating`?POLICIES.initiating:POLICIES.normal}export{resolveDeliveryPolicy};
@@ -0,0 +1,4 @@
1
+ import type { JsonValue } from "#shared/json.js";
2
+ import type { TaskView } from "#tasks/types.js";
3
+ export declare function formatTaskNotification(view: TaskView): string;
4
+ export declare function formatTaskOutput(output: JsonValue): string;
@@ -0,0 +1 @@
1
+ function formatTaskNotification(e){let t=`Background task ${e.taskId} (${e.metadata.name})`;return e.status===`input_required`?`${t} needs input.`:e.status===`completed`?`${t} is completed.\n\nResult:\n${formatTaskOutput(e.lastOutput.data)}`:e.status===`failed`?`${t} failed.\n\nError:\n${formatTaskOutput(e.lastOutput.data)}`:`${t} is cancelled.`}function formatTaskOutput(e){return typeof e==`string`?e:JSON.stringify(e)??`null`}export{formatTaskNotification,formatTaskOutput};
@@ -1,18 +1,7 @@
1
1
  import type { SessionStateMap } from "#harness/types.js";
2
- /** Session-state key for the parent's task index; mutable task records live in task runs. */
3
- export declare const SESSION_TASKS_STATE_KEY = "eve.tasks";
4
- export declare const SESSION_TASKS_STATE_VERSION = 2;
5
2
  /** An entry without a join target starts its own cohort. */
6
3
  export declare function getTaskCohortId(task: {
7
4
  readonly taskId: string;
8
5
  readonly cohortId?: string;
9
6
  }): string;
10
- /**
11
- * Reads cohort identities and settlement for workflow-side completion batching.
12
- * Full task validation stays in getSessionTaskIndex on the step side, so
13
- * the workflow bundle does not retain the task schemas and their dependencies.
14
- */
15
- export declare function getSessionTaskCohorts(state: SessionStateMap | undefined): ReadonlyMap<string, {
16
- readonly cohortId: string;
17
- readonly settled: boolean;
18
- }>;
7
+ export declare function getSessionTaskCohorts(state: SessionStateMap | undefined): ReadonlyMap<string, string>;
@@ -1 +1 @@
1
- import{isNonEmptyString,isObject}from"#shared/guards.js";const SESSION_TASKS_STATE_KEY=`eve.tasks`,SESSION_TASKS_STATE_VERSION=2;function getTaskCohortId(e){return e.cohortId??e.taskId}function getSessionTaskCohorts(e){let t=new Map,n=e?.[SESSION_TASKS_STATE_KEY];if(n===void 0)return t;if(!isObject(n)||n.version!==2)throw Error(`Unsupported task index version under session state key "${SESSION_TASKS_STATE_KEY}".`);if(!Array.isArray(n.tasks))throw Error(`Corrupt task index under session state key "${SESSION_TASKS_STATE_KEY}": expected tasks array.`);for(let e of n.tasks){if(!isObject(e)||!isNonEmptyString(e.taskId)||!isNonEmptyString(e.createdByTurnId)||e.cohortId!==void 0&&!isNonEmptyString(e.cohortId)||t.has(e.taskId))throw Error(`Corrupt task index under session state key "${SESSION_TASKS_STATE_KEY}": invalid task cohort identity.`);t.set(e.taskId,{cohortId:getTaskCohortId({taskId:e.taskId,cohortId:e.cohortId}),settled:e.terminalView!==void 0})}return t}export{SESSION_TASKS_STATE_KEY,SESSION_TASKS_STATE_VERSION,getSessionTaskCohorts,getTaskCohortId};
1
+ import{getBackgroundWorkflowToolRuns}from"#harness/workflow-tool-runs.js";function getTaskCohortId(e){return e.cohortId??e.taskId}function getSessionTaskCohorts(e){return new Map(getBackgroundWorkflowToolRuns(e).map(({task:e})=>[e.taskId,getTaskCohortId(e)]))}export{getSessionTaskCohorts,getTaskCohortId};
@@ -1,3 +1,4 @@
1
+ import type { WorkflowToolRunOutcomeMessage } from "#execution/tools/workflow/messages.js";
1
2
  import { type TaskCommand, type TaskView } from "#tasks/types.js";
2
3
  export type TaskTransitionResult = {
3
4
  readonly action: "accepted";
@@ -10,5 +11,7 @@ export type TaskTransitionResult = {
10
11
  readonly view: TaskView;
11
12
  readonly reason: string;
12
13
  };
13
- /** Pure, executor-neutral transition function for one durable task. */
14
- export declare function applyTaskTransition(view: TaskView, command: TaskCommand): TaskTransitionResult;
14
+ /** Pure transition function for the background invocation view. */
15
+ export declare function applyTaskTransition(view: TaskView, command: TaskCommand | ({
16
+ readonly kind: "outcome";
17
+ } & WorkflowToolRunOutcomeMessage)): TaskTransitionResult;
@@ -1 +1 @@
1
- import{jsonValuesEqual}from"#shared/json.js";import{isTerminalTaskStatus,readTaskInputRequestId}from"#tasks/types.js";function terminalView(e,t,n){let r=`usage`in t?t.usage:void 0,i={executor:e.executor,metadata:e.metadata,taskId:e.taskId};switch(r!==void 0&&(i.usage=r),n.status){case`completed`:return{...i,lastOutput:n.lastOutput,status:`completed`};case`failed`:return{...i,lastOutput:n.lastOutput,status:`failed`};case`cancelled`:return{...i,status:`cancelled`}}}function applyTaskTransition(e,t){if(t.kind===`bind`){let n=e.executor?.binding;return n!==void 0&&n.kind===t.executor.kind&&jsonValuesEqual(n.data,t.executor.data)?{action:`noop`,view:e}:n===void 0?{action:`accepted`,view:{...e,executor:{...e.executor,binding:t.executor}}}:{action:`rejected`,reason:`Task "${e.taskId}" already has an executor binding.`,view:e}}if(isTerminalTaskStatus(e.status))return t.kind===`cancel`&&e.status===`cancelled`?{action:`noop`,view:e}:{action:`rejected`,reason:`Task "${e.taskId}" is already ${e.status}; "${t.kind}" cannot change a terminal task.`,view:e};switch(t.kind){case`complete`:return{action:`accepted`,view:terminalView(e,t,{lastOutput:{data:t.data,type:`result`},status:`completed`})};case`fail`:case`reject-dispatch`:return{action:`accepted`,view:terminalView(e,t,{lastOutput:{data:t.data,type:`error`},status:`failed`})};case`cancel`:return{action:`accepted`,view:terminalView(e,t,{status:`cancelled`})};case`require-input`:return isValidInputRequestBatch(t.inputRequests)?{action:`accepted`,view:{inputRequests:t.inputRequests,executor:e.executor,metadata:e.metadata,status:`input_required`,taskId:e.taskId}}:{action:`rejected`,reason:`Task "${e.taskId}" received an invalid input request batch.`,view:e};case`ready`:return{action:`accepted`,view:e};case`answered`:{if(e.status!==`input_required`)return{action:`noop`,view:e};let n=new Set(t.requestIds),r=e.inputRequests.filter(e=>{let t=readTaskInputRequestId(e);return t===void 0||!n.has(t)});return r.length===e.inputRequests.length?{action:`noop`,view:e}:r.length>0?{action:`accepted`,view:{...e,inputRequests:r}}:{action:`accepted`,view:{executor:e.executor,metadata:e.metadata,status:`working`,taskId:e.taskId}}}}}function isValidInputRequestBatch(e){if(e.length===0)return!1;let t=e.map(readTaskInputRequestId);return t.every(e=>e!==void 0&&e.length>0)&&new Set(t).size===t.length}export{applyTaskTransition};
1
+ import{workflowToolRunFailureOutput}from"#execution/tools/workflow/owner-inbox.js";import{isTerminalTaskStatus,readTaskInputRequestId}from"#tasks/types.js";function applyTaskTransition(e,t){if(isTerminalTaskStatus(e.status))return t.kind===`cancel`&&e.status===`cancelled`?{action:`noop`,view:e}:{action:`rejected`,reason:`Task "${e.taskId}" is already ${e.status}; "${t.kind}" cannot change a terminal task.`,view:e};let n={metadata:e.metadata,taskId:e.taskId};if(t.kind===`outcome`){let e=t.result;return{action:`accepted`,view:e.status===`completed`?{...n,status:`completed`,lastOutput:{type:`result`,data:e.output}}:e.status===`failed`?{...n,status:`failed`,lastOutput:{type:`error`,data:workflowToolRunFailureOutput(t)}}:{...n,status:`cancelled`}}}switch(t.kind){case`reject-dispatch`:return{action:`accepted`,view:{...n,lastOutput:{data:t.data,type:`error`},status:`failed`}};case`cancel`:return{action:`accepted`,view:t.usage===void 0?{...n,status:`cancelled`}:{...n,status:`cancelled`,usage:t.usage}};case`require-input`:return isValidInputRequestBatch(t.inputRequests)?{action:`accepted`,view:{inputRequests:t.inputRequests,metadata:e.metadata,status:`input_required`,taskId:e.taskId}}:{action:`rejected`,reason:`Task "${e.taskId}" received an invalid input request batch.`,view:e};case`ready`:return{action:`accepted`,view:e};case`answered`:{if(e.status!==`input_required`)return{action:`noop`,view:e};let n=new Set(t.requestIds),r=e.inputRequests.filter(e=>{let t=readTaskInputRequestId(e);return t===void 0||!n.has(t)});return r.length===e.inputRequests.length?{action:`noop`,view:e}:r.length>0?{action:`accepted`,view:{...e,inputRequests:r}}:{action:`accepted`,view:{metadata:e.metadata,status:`working`,taskId:e.taskId}}}}}function isValidInputRequestBatch(e){if(e.length===0)return!1;let t=e.map(readTaskInputRequestId);return t.every(e=>e!==void 0&&e.length>0)&&new Set(t).size===t.length}export{applyTaskTransition};
@@ -2,7 +2,6 @@ import type { SubagentAuthorizationEvent, SubagentAuthorizationEventHookPayload
2
2
  import type { WorkflowToolAgentRequest } from "#execution/tools/workflow/messages.js";
3
3
  import type { SessionInboxAddress } from "#execution/session-inbox/address.js";
4
4
  import { type JsonValue } from "#shared/json.js";
5
- import type { TaskExecutorBinding } from "#tools/task.js";
6
5
  /** Durable lifecycle status for one unit of background work. */
7
6
  export type TaskStatus = "working" | "input_required" | "completed" | "failed" | "cancelled";
8
7
  /** Executor-neutral identity shown for one task. */
@@ -35,10 +34,6 @@ export declare function readTaskInputRequestId(request: TaskInputRequest): strin
35
34
  interface TaskViewBase {
36
35
  readonly taskId: string;
37
36
  readonly metadata: TaskMetadata;
38
- /** Private executor state, excluded from model-visible JSON. */
39
- readonly executor?: {
40
- readonly binding?: TaskExecutorBinding;
41
- };
42
37
  /** Retained for accounting, excluded from model-visible JSON. */
43
38
  readonly usage?: TaskUsage;
44
39
  }
@@ -67,19 +62,8 @@ export type TaskView = TaskViewBase & ({
67
62
  readonly inputRequests?: never;
68
63
  readonly lastOutput?: never;
69
64
  });
70
- /** Executor-neutral commands accepted by the durable task run. */
65
+ /** Admission, cancellation, and input state changes for a background invocation. */
71
66
  export type TaskCommand = {
72
- readonly executor: TaskExecutorBinding;
73
- readonly kind: "bind";
74
- } | {
75
- readonly kind: "complete";
76
- readonly data: JsonValue;
77
- readonly usage?: TaskUsage;
78
- } | {
79
- readonly kind: "fail";
80
- readonly data: JsonValue;
81
- readonly usage?: TaskUsage;
82
- } | {
83
67
  readonly kind: "reject-dispatch";
84
68
  readonly data: JsonValue;
85
69
  } | {
@@ -98,31 +82,6 @@ export interface TaskCommandHookPayload {
98
82
  readonly kind: "task-command";
99
83
  readonly command: TaskCommand;
100
84
  }
101
- /** One authored message delivered to the parent as a new turn. */
102
- export interface TaskInboundMessage {
103
- readonly callId: string;
104
- readonly kind: "task-message";
105
- readonly message: string;
106
- readonly messageIndex: number;
107
- readonly messageEpoch: string;
108
- }
109
- /** Intermediate progress reported by an executor. */
110
- export interface TaskInboundUpdate {
111
- readonly callId: string;
112
- readonly updateIndex: number;
113
- readonly updateEpoch: string;
114
- readonly kind: "task-update";
115
- readonly message: string;
116
- }
117
- /** One workflow-executor request bound to its private answer hook. */
118
- export interface TaskInboundInputRequest {
119
- readonly kind: "task-input-request";
120
- readonly replyTo: string;
121
- readonly requests: readonly TaskInputRequest[];
122
- readonly sequence: number;
123
- readonly stepIndex: number;
124
- readonly turnId: string;
125
- }
126
85
  /** One human answer routed through the task that owns the blocked executor. */
127
86
  export interface TaskInboundAnswerInput {
128
87
  readonly auth?: unknown;
@@ -137,7 +96,7 @@ export interface TaskInboundAnswerInput {
137
96
  readonly kind: "input-response";
138
97
  readonly taskId: string;
139
98
  }
140
- export type TaskRunInboundPayload = TaskCommandHookPayload | TaskInboundAnswerInput | TaskInboundMessage | TaskInboundUpdate;
99
+ export type TaskRunInboundPayload = TaskCommandHookPayload | TaskInboundAnswerInput;
141
100
  /** Generic task-owned request sent through the parent session payload. */
142
101
  interface TaskInputRequestDeliveryBase {
143
102
  readonly replyTo: string;
@@ -172,15 +131,6 @@ export interface TaskAgentRequestDelivery {
172
131
  readonly request: WorkflowToolAgentRequest;
173
132
  readonly taskId: string;
174
133
  }
175
- export interface TaskProgress {
176
- readonly callId: string;
177
- readonly kind: "task-progress";
178
- readonly taskId: string;
179
- readonly update: JsonValue;
180
- readonly updateIndex: number;
181
- }
182
- export declare const TASK_PROGRESS_STREAM_NAMESPACE = "eve.task.progress";
183
- export declare const TASK_VIEW_STREAM_NAMESPACE = "eve.task";
184
134
  export declare function isTerminalTaskStatus(status: TaskStatus): boolean;
185
135
  export declare function isReadyTaskStatus(status: TaskStatus): boolean;
186
136
  export {};
@@ -1 +1 @@
1
- import{jsonValuesEqual}from"#shared/json.js";function sameTaskMetadata(e,t){return jsonValuesEqual(e,t)}function readTaskUsage(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=readUsageAxis(e,`cacheReadTokens`),n=readUsageAxis(e,`cacheWriteTokens`),r=readUsageAxis(e,`costUsd`),i=readUsageAxis(e,`inputTokens`),a=readUsageAxis(e,`outputTokens`);if(t===void 0||n===void 0||i===void 0||a===void 0)return;let o={cacheReadTokens:t,cacheWriteTokens:n,inputTokens:i,outputTokens:a};return r!==void 0&&(o.costUsd=r),o}function readUsageAxis(e,t){let n=Reflect.get(e,t);return typeof n==`number`&&Number.isFinite(n)&&n>=0?n:void 0}function readTaskInputRequestId(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Reflect.get(e,`requestId`);return typeof t==`string`?t:void 0}const TASK_AUTHORIZATION_REQUEST_ID_PREFIX=`task:authorization`;function taskAuthorizationRequestId(e){return e.type===`approval.candidate`||e.type===`approval.settled`?`${TASK_AUTHORIZATION_REQUEST_ID_PREFIX}:${e.data.requestId}`:`${TASK_AUTHORIZATION_REQUEST_ID_PREFIX}:${e.data.attemptId??e.data.name}`}const TASK_PROGRESS_STREAM_NAMESPACE=`eve.task.progress`,TASK_VIEW_STREAM_NAMESPACE=`eve.task`;function isTerminalTaskStatus(e){return e===`completed`||e===`failed`||e===`cancelled`}function isReadyTaskStatus(e){return e===`input_required`||isTerminalTaskStatus(e)}export{TASK_PROGRESS_STREAM_NAMESPACE,TASK_VIEW_STREAM_NAMESPACE,isReadyTaskStatus,isTerminalTaskStatus,readTaskInputRequestId,readTaskUsage,sameTaskMetadata,taskAuthorizationRequestId};
1
+ import{jsonValuesEqual}from"#shared/json.js";function sameTaskMetadata(e,t){return jsonValuesEqual(e,t)}function readTaskUsage(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=readUsageAxis(e,`cacheReadTokens`),n=readUsageAxis(e,`cacheWriteTokens`),r=readUsageAxis(e,`costUsd`),i=readUsageAxis(e,`inputTokens`),a=readUsageAxis(e,`outputTokens`);if(t===void 0||n===void 0||i===void 0||a===void 0)return;let o={cacheReadTokens:t,cacheWriteTokens:n,inputTokens:i,outputTokens:a};return r!==void 0&&(o.costUsd=r),o}function readUsageAxis(e,t){let n=Reflect.get(e,t);return typeof n==`number`&&Number.isFinite(n)&&n>=0?n:void 0}function readTaskInputRequestId(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Reflect.get(e,`requestId`);return typeof t==`string`?t:void 0}const TASK_AUTHORIZATION_REQUEST_ID_PREFIX=`task:authorization`;function taskAuthorizationRequestId(e){return e.type===`approval.candidate`||e.type===`approval.settled`?`${TASK_AUTHORIZATION_REQUEST_ID_PREFIX}:${e.data.requestId}`:`${TASK_AUTHORIZATION_REQUEST_ID_PREFIX}:${e.data.attemptId??e.data.name}`}function isTerminalTaskStatus(e){return e===`completed`||e===`failed`||e===`cancelled`}function isReadyTaskStatus(e){return e===`input_required`||isTerminalTaskStatus(e)}export{isReadyTaskStatus,isTerminalTaskStatus,readTaskInputRequestId,readTaskUsage,sameTaskMetadata,taskAuthorizationRequestId};
@@ -7,13 +7,11 @@ import type { TokenResult } from "#shared/connection-types.js";
7
7
  import type { ToolAuthOptions, ToolAuthProvider } from "#tools/auth.js";
8
8
  import type { InputOption } from "#shared/input.js";
9
9
  import type { ToolModelOutput } from "#tools/model-output.js";
10
- import type { TaskExec, TaskReceipt } from "#tools/task.js";
11
10
  type ApprovalContextInput<TInput> = unknown extends TInput ? Record<string, unknown> : TInput;
12
11
  export type { ToolAuthDefinition, ToolAuthOptions, ToolAuthProvider } from "#tools/auth.js";
13
12
  export type { ToolModelOutput, ToolModelOutputPart } from "#tools/model-output.js";
14
- export type { TaskExec, TaskExecutorBinding, TaskReceipt } from "#tools/task.js";
15
13
  export type ToolExecuteOptions = Omit<ToolExecutionOptions<unknown>, "context">;
16
- export type ToolExecuteFn<TInput = unknown, TOutput = unknown> = (input: TInput, options: ToolExecuteOptions, task?: TaskExec) => Promise<TOutput> | TOutput | AsyncIterable<TOutput>;
14
+ export type ToolExecuteFn<TInput = unknown, TOutput = unknown> = (input: TInput, options: ToolExecuteOptions) => Promise<TOutput> | TOutput | AsyncIterable<TOutput>;
17
15
  export type ToolExecution = "background";
18
16
  interface ToolDefinitionBase {
19
17
  /** Whether delegated agent sessions receive this tool. Defaults to `true`. */
@@ -168,21 +166,10 @@ export interface ToolDefinition<TInput = unknown, TOutput = unknown> extends Pub
168
166
  */
169
167
  toModelOutput?: (output: TOutput) => ToolModelOutput | Promise<ToolModelOutput>;
170
168
  }
171
- /** A tool whose executor can outlive the model tool-call phase as a durable task. */
172
- export interface BackgroundToolDefinition<TInput = unknown, TOutput = unknown> extends PublicToolDefinition<TInput, TaskReceipt> {
173
- readonly execution: "background";
174
- execute(input: TInput, ctx: ToolContext, task: TaskExec): Promise<TOutput> | TOutput | AsyncIterable<unknown>;
175
- approval?: Approval<ApprovalContextInput<TInput>>;
176
- toModelOutput?: (output: TaskReceipt) => ToolModelOutput | Promise<ToolModelOutput>;
177
- }
178
169
  type ToolOutputFromExecuteReturn<TReturn> = TReturn extends Promise<infer TOutput> ? TOutput : TReturn extends AsyncIterable<infer TOutput> ? TOutput : TReturn;
179
- type BackgroundToolOutputFromExecuteReturn<TReturn> = TReturn extends AsyncGenerator<unknown, infer TOutput> ? TOutput : TReturn extends AsyncIterable<unknown> ? null : Awaited<TReturn>;
180
170
  type ToolDefinitionWithExecuteReturn<TInput, TOutput, TReturn> = ToolDefinition<TInput, TOutput> & {
181
171
  execute(input: TInput, ctx: ToolContext): TReturn;
182
172
  };
183
- type BackgroundToolDefinitionWithExecuteReturn<TInput, TOutput, TReturn> = BackgroundToolDefinition<TInput, TOutput> & {
184
- execute(input: TInput, ctx: ToolContext, task: TaskExec): TReturn;
185
- };
186
173
  /**
187
174
  * Defines a tool configuration, used both for static tools (default export
188
175
  * from `agent/tools/*.ts`) and as the entry wrapper inside `defineDynamic`
@@ -191,17 +178,6 @@ type BackgroundToolDefinitionWithExecuteReturn<TInput, TOutput, TReturn> = Backg
191
178
  * For static tools, the runtime tool name is the filename slug. `defineTool`
192
179
  * stamps a brand that lifecycle code validates; it rejects raw object literals.
193
180
  */
194
- export declare function defineTool<TSchema extends StandardSchemaV1<unknown, unknown> | StandardJSONSchemaV1<unknown, unknown>, TReturn>(definition: {
195
- description: BackgroundToolDefinition<unknown, unknown>["description"];
196
- execution: "background";
197
- inputSchema: TSchema;
198
- outputSchema?: PublicToolDefinition<unknown, TaskReceipt>["outputSchema"];
199
- execute(input: StandardSchemaV1.InferOutput<TSchema>, ctx: ToolContext, task: TaskExec): TReturn;
200
- label?: BackgroundToolDefinition<StandardSchemaV1.InferOutput<TSchema>, BackgroundToolOutputFromExecuteReturn<TReturn>>["label"];
201
- approval?: BackgroundToolDefinition<StandardSchemaV1.InferOutput<TSchema>, unknown>["approval"];
202
- approvalKey?: BackgroundToolDefinition<StandardSchemaV1.InferOutput<TSchema>, unknown>["approvalKey"];
203
- toModelOutput?: BackgroundToolDefinition<unknown, BackgroundToolOutputFromExecuteReturn<TReturn>>["toModelOutput"];
204
- }): BackgroundToolDefinitionWithExecuteReturn<StandardSchemaV1.InferOutput<TSchema>, BackgroundToolOutputFromExecuteReturn<TReturn>, TReturn>;
205
181
  export declare function defineTool<TInputSchema extends StandardSchemaV1<unknown, unknown> | StandardJSONSchemaV1<unknown, unknown>, TOutputSchema extends StandardJSONSchemaV1<unknown, unknown>, TReturn extends Promise<StandardJSONSchemaV1.InferOutput<TOutputSchema>> | StandardJSONSchemaV1.InferOutput<TOutputSchema> | AsyncIterable<StandardJSONSchemaV1.InferOutput<TOutputSchema>>>(definition: {
206
182
  description: ToolDefinition<unknown, unknown>["description"];
207
183
  inputSchema: TInputSchema;
@@ -1 +1 @@
1
- import{collectDurableDynamicToolCallbacks,stampDurableDynamicToolCallbacks}from"#tools/durable-callbacks.js";import{TOOL_BRAND}from"#tools/dynamic.js";import{stampDefinitionKey}from"#internal/authored-definition/source-identity.js";function defineTool(e){return stampToolDefinition(e,`defineTool`)}function stampToolDefinition(e,t){if(e.auth!==void 0)throw Error(`${t}: The "auth" field is no longer supported. Pass auth providers inline to ctx.getToken(provider) or ctx.requireAuth(provider).`);return Object.assign(e,{[TOOL_BRAND]:!0}),stampDurableDynamicToolCallbacks(e,collectDurableDynamicToolCallbacks({inputSchema:e.inputSchema,outputSchema:e.outputSchema,label:e.label,approval:e.approval,approvalKey:e.approvalKey,execute:e.execute,toModelOutput:e.toModelOutput})),stampDefinitionKey(e,`tool:${e.description}`),e}const DISABLED_TOOL_SENTINEL_KIND=`eve:disabled-tool`;function disableTool(){return{kind:DISABLED_TOOL_SENTINEL_KIND}}function isDisabledToolSentinel(e){return typeof e==`object`&&!!e&&e.kind===DISABLED_TOOL_SENTINEL_KIND}export{defineTool,disableTool,isDisabledToolSentinel,stampToolDefinition};
1
+ import{collectDurableDynamicToolCallbacks,stampDurableDynamicToolCallbacks}from"#tools/durable-callbacks.js";import{TOOL_BRAND}from"#tools/dynamic.js";import{stampDefinitionKey}from"#internal/authored-definition/source-identity.js";function defineTool(e){if(`execution`in e&&e.execution!==void 0)throw Error(`defineTool: "execution" is not supported. Use defineWorkflowTool for background work.`);return stampToolDefinition(e,`defineTool`)}function stampToolDefinition(e,t){if(e.auth!==void 0)throw Error(`${t}: The "auth" field is no longer supported. Pass auth providers inline to ctx.getToken(provider) or ctx.requireAuth(provider).`);return Object.assign(e,{[TOOL_BRAND]:!0}),stampDurableDynamicToolCallbacks(e,collectDurableDynamicToolCallbacks({inputSchema:e.inputSchema,outputSchema:e.outputSchema,label:e.label,approval:e.approval,approvalKey:e.approvalKey,execute:e.execute,toModelOutput:e.toModelOutput})),stampDefinitionKey(e,`tool:${e.description}`),e}const DISABLED_TOOL_SENTINEL_KIND=`eve:disabled-tool`;function disableTool(){return{kind:DISABLED_TOOL_SENTINEL_KIND}}function isDisabledToolSentinel(e){return typeof e==`object`&&!!e&&e.kind===DISABLED_TOOL_SENTINEL_KIND}export{defineTool,disableTool,isDisabledToolSentinel,stampToolDefinition};
@@ -1,7 +1,6 @@
1
1
  import type { Approval } from "#approval/definition.js";
2
2
  import type { DynamicResolveContext, DynamicToolEventName } from "#dynamic/definition.js";
3
3
  import type { PublicToolInputSchema, PublicToolOutputSchema, ToolLabelDefinition, ToolContext } from "#tools/definition.js";
4
- import type { TaskExec } from "#tools/task.js";
5
4
  import type { ToolModelOutput } from "#tools/model-output.js";
6
5
  /**
7
6
  * A single tool entry within a resolved dynamic tool set.
@@ -21,8 +20,7 @@ export interface DynamicToolEntry<TInput = Record<string, unknown>, TOutput = an
21
20
  readonly description: string;
22
21
  readonly inputSchema: PublicToolInputSchema<TInput>;
23
22
  readonly outputSchema?: PublicToolOutputSchema<TOutput>;
24
- readonly execution?: "background";
25
- execute(input: TInput, ctx: ToolContext, task?: TaskExec): TOutput | Promise<TOutput>;
23
+ execute(input: TInput, ctx: ToolContext): TOutput | Promise<TOutput>;
26
24
  readonly toModelOutput?: (output: TOutput) => ToolModelOutput | Promise<ToolModelOutput>;
27
25
  /**
28
26
  * Optional per-call approval gate, mirroring the authored-tool
@@ -1 +1 @@
1
- import{z}from"#compiled/zod/index.js";const AGENT_TOOL_NAME=`agent`,AGENT_TOOL_DESCRIPTION=["Delegate a focused subtask to a copy of yourself, or continue or steer a previous delegation with `agentId`.",`Use it to isolate complex work or split a large task into independent pieces.`,"Issue multiple `agent` calls in one response to run a small fixed set in parallel.","A new child has fresh history and state but shares your tools and sandbox, so include essential context in `message` and give parallel writers non-overlapping scopes."].join(` `),SUBAGENT_TOOL_INPUT_SCHEMA=z.strictObject({agentId:z.string().nullable().describe(`The id of an existing agent from the <agents> list or a task receipt. A message to a busy agent steers it: its previous task is cancelled and the updated work runs in the same child session. Omit this field (or pass null or an empty string) to start a new agent.`).optional(),message:z.string().describe(`The message to send to the subagent. Provide all context the subagent needs to complete the task; the subagent does not see the parent's history.`),outputSchema:z.looseObject({}).describe(`Only provide a non-empty JSON Schema when the caller explicitly requests structured output; otherwise omit this field. The subagent must match a provided schema, and that structured output becomes the tool result.`).optional()});export{AGENT_TOOL_DESCRIPTION,AGENT_TOOL_NAME,SUBAGENT_TOOL_INPUT_SCHEMA};
1
+ import{z}from"#compiled/zod/index.js";const AGENT_TOOL_NAME=`agent`,AGENT_TOOL_DESCRIPTION=["Delegate a focused subtask to a copy of yourself, or continue or steer a previous delegation with `agentId`.",`Use it to isolate complex work or split a large task into independent pieces.`,"Issue multiple `agent` calls in one response to run a small fixed set in parallel.","A new child has fresh history and state but reuses your tools and sandbox, so include essential context in `message` and give parallel writers non-overlapping scopes."].join(` `),SUBAGENT_TOOL_INPUT_SCHEMA=z.strictObject({agentId:z.string().nullable().describe(`The id of an existing agent from the <agents> list or a task receipt. A message to a busy agent steers it: its previous task is cancelled and the updated work runs in the same child session. Omit this field (or pass null or an empty string) to start a new agent.`).optional(),message:z.string().describe(`The message to send to the subagent. Provide all context the subagent needs to complete the task; the subagent does not see the parent's history.`),outputSchema:z.looseObject({}).describe(`Only provide a non-empty JSON Schema when the caller explicitly requests structured output; otherwise omit this field. The subagent must match a provided schema, and that structured output becomes the tool result.`).optional()});export{AGENT_TOOL_DESCRIPTION,AGENT_TOOL_NAME,SUBAGENT_TOOL_INPUT_SCHEMA};
@@ -1,24 +1,18 @@
1
- export declare const agent: import("#tools/definition.js").BackgroundToolDefinition<{
2
- agentId?: string | null | undefined;
3
- message: string;
4
- outputSchema?: {
5
- [x: string]: unknown;
6
- } | undefined;
7
- }, {
8
- agentId: string;
9
- status: "working";
10
- taskId: string;
11
- }> & {
12
- execute(input: {
13
- agentId?: string | null | undefined;
14
- message: string;
15
- outputSchema?: {
16
- [x: string]: unknown;
17
- } | undefined;
18
- }, ctx: import("#tools/definition.js").ToolContext, task: import("#tools/definition.js").TaskExec): {
19
- agentId: string;
20
- status: "working";
21
- taskId: string;
22
- };
1
+ import type { z } from "#compiled/zod/index.js";
2
+ import { SUBAGENT_TASK_RECEIPT_OUTPUT_SCHEMA } from "#tools/framework/task-contract.js";
3
+ export declare const agent: {
4
+ description: string;
5
+ execution: string;
6
+ inputSchema: z.ZodObject<{
7
+ agentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
+ message: z.ZodString;
9
+ outputSchema: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
10
+ }, z.core.$strict>;
11
+ outputSchema: z.ZodObject<{
12
+ agentId: z.ZodString;
13
+ status: z.ZodLiteral<"working">;
14
+ taskId: z.ZodString;
15
+ }, z.core.$strict>;
16
+ execute(): z.infer<typeof SUBAGENT_TASK_RECEIPT_OUTPUT_SCHEMA>;
23
17
  };
24
18
  export default agent;
@@ -1 +1 @@
1
- import{defineTool}from"#tools/definition.js";import{SUBAGENT_TASK_RECEIPT_OUTPUT_SCHEMA}from"#tools/framework/task-contract.js";import{AGENT_TOOL_DESCRIPTION,SUBAGENT_TOOL_INPUT_SCHEMA}from"#tools/framework/agent-contract.js";import{attachToolBehavior}from"#tools/behavior.js";const agent=attachToolBehavior(defineTool({description:`${AGENT_TOOL_DESCRIPTION} This call starts a background task and returns a task receipt immediately.`,execution:`background`,inputSchema:SUBAGENT_TOOL_INPUT_SCHEMA,outputSchema:SUBAGENT_TASK_RECEIPT_OUTPUT_SCHEMA,execute(){"use workflow";throw Error(`The framework "agent" tool was executed directly. It must be resolved through the runtime tool registry, which dispatches it to the shared subagent workflow.`)}}),{availability:[`root-session`],handling:{action:`self-agent`,kind:`dispatch`}});export{agent,agent as default};
1
+ import{stampToolDefinition}from"#tools/definition.js";import{SUBAGENT_TASK_RECEIPT_OUTPUT_SCHEMA}from"#tools/framework/task-contract.js";import{AGENT_TOOL_DESCRIPTION,SUBAGENT_TOOL_INPUT_SCHEMA}from"#tools/framework/agent-contract.js";import{attachToolBehavior}from"#tools/behavior.js";const agent=attachToolBehavior(stampToolDefinition({description:`${AGENT_TOOL_DESCRIPTION} This call starts a background task and returns a task receipt immediately.`,execution:`background`,inputSchema:SUBAGENT_TOOL_INPUT_SCHEMA,outputSchema:SUBAGENT_TASK_RECEIPT_OUTPUT_SCHEMA,execute(){throw Error(`The framework "agent" tool was executed directly. It must be resolved through the runtime tool registry, which dispatches it to the shared subagent workflow.`)}},`defineTool`),{availability:[`root-session`],handling:{action:`self-agent`,kind:`dispatch`}});export{agent,agent as default};
@@ -1,9 +1,13 @@
1
1
  import type { StandardJSONSchemaV1, StandardSchemaV1 } from "#compiled/@standard-schema/spec/index.js";
2
2
  import type { Approval } from "#approval/definition.js";
3
3
  import type { JsonObject, JsonValue } from "#shared/json.js";
4
- import { type PublicToolDefinition, type BackgroundToolDefinition, type ToolContext, type ToolInputRequest, type ToolInputResponse } from "#tools/definition.js";
5
- import type { TaskExec } from "#tools/task.js";
4
+ import { type PublicToolDefinition, type ToolContext, type ToolInputRequest, type ToolInputResponse } from "#tools/definition.js";
6
5
  import type { ToolModelOutput } from "#tools/model-output.js";
6
+ /** Fixed acknowledgement returned when a background task is admitted. */
7
+ export interface TaskReceipt {
8
+ readonly status: "working";
9
+ readonly taskId: string;
10
+ }
7
11
  export interface AgentInput {
8
12
  readonly agentId?: string;
9
13
  readonly message: string;
@@ -71,22 +75,29 @@ export interface BlockingWorkflowToolDefinition<TInput = unknown, TOutput = unkn
71
75
  approval?: Approval<unknown extends TInput ? Record<string, unknown> : TInput>;
72
76
  toModelOutput?: (output: TOutput) => ToolModelOutput | Promise<ToolModelOutput>;
73
77
  }
74
- type BackgroundWorkflowToolDefinition<TInput, TOutput> = Omit<BackgroundToolDefinition<TInput, TOutput>, "execute"> & {
78
+ export type BackgroundWorkflowToolDefinition<TInput, TOutput> = PublicToolDefinition<TInput, TaskReceipt> & {
75
79
  readonly [WORKFLOW_TOOL_BRAND]: true;
76
- execute(input: TInput, ctx: WorkflowToolContext, task: TaskExec): Promise<TOutput> | AsyncIterable<unknown>;
80
+ readonly execution: "background";
81
+ execute(input: TInput, ctx: WorkflowToolContext): Promise<TOutput> | AsyncIterable<unknown>;
82
+ approval?: Approval<unknown extends TInput ? Record<string, unknown> : TInput>;
83
+ toModelOutput?: (output: TaskReceipt) => ToolModelOutput | Promise<ToolModelOutput>;
77
84
  };
78
85
  /** A static tool whose executor runs as a durable workflow. */
79
86
  export type WorkflowToolDefinition<TInput = unknown, TOutput = unknown> = BlockingWorkflowToolDefinition<TInput, TOutput> | BackgroundWorkflowToolDefinition<TInput, TOutput>;
80
87
  type Unbranded<T> = T extends unknown ? Omit<T, typeof WORKFLOW_TOOL_BRAND> : never;
81
88
  type BackgroundReturn<T> = T extends AsyncGenerator<unknown, infer Output> ? Output : T extends AsyncIterable<unknown> ? null : Awaited<T>;
82
89
  type BackgroundDefinition<TInput, TReturn> = Omit<BackgroundWorkflowToolDefinition<TInput, BackgroundReturn<TReturn>>, typeof WORKFLOW_TOOL_BRAND | "execute"> & {
83
- execute(input: TInput, ctx: WorkflowToolContext, task: TaskExec): TReturn;
90
+ execute(input: TInput, ctx: WorkflowToolContext): TReturn;
84
91
  };
85
92
  type WorkflowReturn<T> = T extends AsyncIterable<infer Output> ? Output : Awaited<T>;
86
93
  type Schema = StandardSchemaV1<unknown, unknown> | StandardJSONSchemaV1<unknown, unknown>;
87
94
  type Definition<TInput, TReturn> = Omit<BlockingWorkflowToolDefinition<TInput, WorkflowReturn<TReturn>>, typeof WORKFLOW_TOOL_BRAND | "execute"> & {
88
95
  execute(input: TInput, ctx: WorkflowToolContext): TReturn;
89
96
  };
97
+ export declare function defineWorkflowTool<TInputSchema extends Schema, TOutputSchema extends StandardJSONSchemaV1<unknown, unknown>, TReturn extends Promise<StandardJSONSchemaV1.InferOutput<TOutputSchema>> | AsyncIterable<StandardJSONSchemaV1.InferOutput<TOutputSchema>>>(definition: Omit<Definition<StandardSchemaV1.InferOutput<TInputSchema>, TReturn>, "inputSchema" | "outputSchema"> & {
98
+ inputSchema: TInputSchema;
99
+ outputSchema: TOutputSchema;
100
+ }): BlockingWorkflowToolDefinition<StandardSchemaV1.InferOutput<TInputSchema>, StandardJSONSchemaV1.InferOutput<TOutputSchema>>;
90
101
  export declare function defineWorkflowTool<TSchema extends Schema, TReturn extends Promise<unknown> | AsyncIterable<unknown>>(definition: Omit<BackgroundDefinition<StandardSchemaV1.InferOutput<TSchema>, TReturn>, "inputSchema"> & {
91
102
  inputSchema: TSchema;
92
103
  }): BackgroundWorkflowToolDefinition<StandardSchemaV1.InferOutput<TSchema>, BackgroundReturn<TReturn>>;
@@ -1 +1 @@
1
- import"#shared/channel-audience.js";import{applyLiveDeliveryAudienceCeiling,readForwardedTraceAssertion}from"#shared/forwarded-trace-policy.js";import{ConversationIdKey}from"#context/keys.js";import{readConversationId}from"#tracing/conversation-context.js";import{getWorkflowToolRuns}from"#harness/workflow-tool-runs.js";import{readActionTraceContext,readTaskActionTrace,readTurnTraceContext,recordActionInvocationKind,recordNestedAgentInvocation}from"#tracing/agent-trace-context-store.js";import{invocationError,recordNestedAgentInvocationTerminal}from"#tracing/agent-invocation-terminal.js";import{deriveAgentActionSpanId}from"#tracing/agent-span-id-generator.js";function prepareAgentInvocationTrace(e){let t=readConversationId(e.serializedContext[ConversationIdKey.name]),n=e.taskId===void 0?void 0:readTaskActionTrace(e.serializedContext,e.sessionId,e.taskId),r=e.taskId===void 0?getWorkflowToolRuns(e.sessionState).find(t=>t.runId===e.ownerId)?.callId:n?.callId,i=n?.turnId??e.turnId,a=readTurnTraceContext(e.serializedContext,e.sessionId,i),o=e.conversation,s=o?.audience??`unknown`,c=o?.environment??`production`,l=(r===void 0?void 0:readActionTraceContext(e.serializedContext,e.sessionId,i,r))??a,u=l?.decision===void 0?void 0:applyLiveDeliveryAudienceCeiling(l.decision,s,l.forwardedTracePolicy,c),d=r===void 0?e.serializedContext:r===e.invocation.callId?recordActionInvocationKind({callId:e.invocation.callId,kind:e.invocation.kind,serializedContext:e.serializedContext,sessionId:e.sessionId,turnId:i}):recordNestedAgentInvocation({callId:e.invocation.callId,kind:e.invocation.kind,name:e.invocation.name,outerCallId:r,recordOutputs:u?.action===`record`&&u.recordOutputs,serializedContext:e.serializedContext,sessionId:e.sessionId,spanId:deriveAgentActionSpanId(e.sessionId,i,e.invocation.callId),startTimeMs:e.startTimeMs,turnId:i}),f=readActionTraceContext(d,e.sessionId,i,e.invocation.callId)??l,p=readForwardedTraceAssertion(f?.forwardedTracePolicy),m=f?.decision===void 0?f:{...f,decision:applyLiveDeliveryAudienceCeiling(f.decision,s,p,c)};return{dispatch:{conversationId:t,originAudience:p?.originAudience??s,parentTraceContext:m},fail:t=>recordNestedAgentInvocationTerminal({callId:e.invocation.callId,serializedContext:d,sessionId:e.sessionId,terminal:{acceptedAtMs:Date.now(),error:invocationError(t.output),outcome:`failed`},turnId:i}),serializedContext:d}}export{prepareAgentInvocationTrace};
1
+ import"#shared/channel-audience.js";import{applyLiveDeliveryAudienceCeiling,readForwardedTraceAssertion}from"#shared/forwarded-trace-policy.js";import{ConversationIdKey}from"#context/keys.js";import{readConversationId}from"#tracing/conversation-context.js";import{getBlockingWorkflowToolRuns}from"#harness/workflow-tool-runs.js";import{readActionTraceContext,readTaskActionTrace,readTurnTraceContext,recordActionInvocationKind,recordNestedAgentInvocation}from"#tracing/agent-trace-context-store.js";import{invocationError,recordNestedAgentInvocationTerminal}from"#tracing/agent-invocation-terminal.js";import{deriveAgentActionSpanId}from"#tracing/agent-span-id-generator.js";function prepareAgentInvocationTrace(e){let t=readConversationId(e.serializedContext[ConversationIdKey.name]),n=e.taskId===void 0?void 0:readTaskActionTrace(e.serializedContext,e.sessionId,e.taskId),r=e.taskId===void 0?getBlockingWorkflowToolRuns(e.sessionState).find(t=>t.address.runId===e.ownerId)?.callId:n?.callId,i=n?.turnId??e.turnId,a=readTurnTraceContext(e.serializedContext,e.sessionId,i),o=e.conversation,s=o?.audience??`unknown`,c=o?.environment??`production`,l=(r===void 0?void 0:readActionTraceContext(e.serializedContext,e.sessionId,i,r))??a,u=l?.decision===void 0?void 0:applyLiveDeliveryAudienceCeiling(l.decision,s,l.forwardedTracePolicy,c),d=r===void 0?e.serializedContext:r===e.invocation.callId?recordActionInvocationKind({callId:e.invocation.callId,kind:e.invocation.kind,serializedContext:e.serializedContext,sessionId:e.sessionId,turnId:i}):recordNestedAgentInvocation({callId:e.invocation.callId,kind:e.invocation.kind,name:e.invocation.name,outerCallId:r,recordOutputs:u?.action===`record`&&u.recordOutputs,serializedContext:e.serializedContext,sessionId:e.sessionId,spanId:deriveAgentActionSpanId(e.sessionId,i,e.invocation.callId),startTimeMs:e.startTimeMs,turnId:i}),f=readActionTraceContext(d,e.sessionId,i,e.invocation.callId)??l,p=readForwardedTraceAssertion(f?.forwardedTracePolicy),m=f?.decision===void 0?f:{...f,decision:applyLiveDeliveryAudienceCeiling(f.decision,s,p,c)};return{dispatch:{conversationId:t,originAudience:p?.originAudience??s,parentTraceContext:m},fail:t=>recordNestedAgentInvocationTerminal({callId:e.invocation.callId,serializedContext:d,sessionId:e.sessionId,terminal:{acceptedAtMs:Date.now(),error:invocationError(t.output),outcome:`failed`},turnId:i}),serializedContext:d}}export{prepareAgentInvocationTrace};
@@ -1 +1 @@
1
- import{createLogger}from"#internal/logging.js";import{decisionToTraceContentCeiling,resolveForwardedTraceSeed}from"#shared/forwarded-trace-policy.js";import{contextStorage,loadContext}from"#context/container.js";import{SessionTraceSeedKey}from"#context/keys.js";import{ContextKey}from"#context/key.js";import{getWorkflowToolRuns}from"#harness/workflow-tool-runs.js";import{getSessionTaskIndex}from"#tasks/session-index.js";import{deriveTaskId}from"#tasks/task-id.js";import{actionIdempotencyKey}from"#instrumentation/lifecycle.js";import{AGENT_TRACE_CONTEXT_KEY,deserializeAgentTraceContextState,emptyAgentTraceContextState,serializeAgentTraceContextState}from"#tracing/agent-trace-context-codec.js";const AgentTraceContextKey=new ContextKey(AGENT_TRACE_CONTEXT_KEY,{codec:{deserialize:deserializeAgentTraceContextState,serialize:serializeAgentTraceContextState}});function pruneAgentTraceState(e,t,n){try{pruneTraceOwnership(e,t,n)}catch(e){createLogger(`tracing.retention`).warn(`could not reconcile trace ownership; preserving trace state`,{error:e})}}function pruneTraceOwnership(e,t,n){let r=e.get(AgentTraceContextKey);if(r===void 0)return;let i=new Set(getWorkflowToolRuns(n).map(e=>e.callId)),a=new Set(getSessionTaskIndex(n).filter(e=>e.terminalView===void 0).map(e=>e.taskId)),o=Object.fromEntries(Object.entries(r.actionAnchors).filter(([e,n])=>n.sessionId!==t||r.actions[e]!==void 0||i.has(n.callId)||a.has(deriveTaskId({callId:n.callId,parentSessionId:t,parentTurnId:n.turnId})))),s=new Set(Object.values(o).filter(e=>e.sessionId===t).map(e=>e.callId)),c=Object.fromEntries(Object.entries(r.invocations).filter(([,e])=>e.sessionId!==t||e.terminal!==void 0||s.has(e.parentActionCallId)));e.set(AgentTraceContextKey,{...r,actionAnchors:o,invocations:c})}function readCurrentSessionTraceDecision(e){let t=contextStorage.getStore();return t===void 0?void 0:readSessionTraceDecision(t,e)}function readSessionTraceDecision(e,t){return e.get(AgentTraceContextKey)?.sessions[t]?.decision}function preserveSerializedAgentTraceState(e,t){let n=t[AgentTraceContextKey.name];return n===void 0?e:{...e,[AgentTraceContextKey.name]:n}}function readTurnTraceContext(e,t,n){let r=e[AgentTraceContextKey.name];if(r===void 0)return;let i=deserializeAgentTraceContextState(r),a=i.turns[turnKey(t,n)];return a===void 0?void 0:withTraceDecision(e,a.context,i.sessions[t]?.decision)}function readActionTraceContext(e,t,n,r){let i=e[AgentTraceContextKey.name];if(i===void 0)return;let a=deserializeAgentTraceContextState(i),o=actionIdempotencyKey(t,n,r),s=a.invocations[o]??a.actions[o]??a.actionAnchors[o];if(s!==void 0)return withTraceDecision(e,{isRemote:!1,spanId:s.spanId,traceFlags:s.parent.traceFlags,traceId:s.parent.traceId},a.sessions[s.sessionId]?.decision)}function readTaskActionTrace(e,t,n){let r=deserializeAgentTraceContextState(e[AgentTraceContextKey.name]);return Object.values(r.actionAnchors).find(e=>e.sessionId===t&&deriveTaskId({callId:e.callId,parentSessionId:t,parentTurnId:e.turnId})===n)}function recordNestedAgentInvocation(e){let t=e.serializedContext[AgentTraceContextKey.name];if(t===void 0)return e.serializedContext;let n=deserializeAgentTraceContextState(t),r=actionIdempotencyKey(e.sessionId,e.turnId,e.outerCallId),i=n.actions[r]??n.actionAnchors[r];if(i===void 0)return e.serializedContext;let a=actionIdempotencyKey(e.sessionId,e.turnId,e.callId),promote=e=>e.isWorkflowTool===!0&&e.kind===`tool-call`?{...e,workflowName:e.name}:e,o=n.actions[r]===void 0?n.actions:{...n.actions,[r]:promote(n.actions[r])},s=n.actionAnchors[r]===void 0?n.actionAnchors:{...n.actionAnchors,[r]:promote(n.actionAnchors[r])};if(n.invocations[a]!==void 0)return{...e.serializedContext,[AgentTraceContextKey.name]:serializeAgentTraceContextState({...n,actionAnchors:s,actions:o})};let c={attemptIndex:i.attemptIndex,callId:e.callId,channelAudience:i.channelAudience,kind:e.kind,name:e.name,parent:{spanId:i.spanId,traceFlags:i.parent.traceFlags,traceId:i.parent.traceId},parentActionCallId:e.outerCallId,recordOutputs:e.recordOutputs===!0,rootSessionId:i.rootSessionId,sessionId:i.sessionId,spanId:e.spanId,startTimeMs:e.startTimeMs,stepIndex:i.stepIndex,turnId:i.turnId};return{...e.serializedContext,[AgentTraceContextKey.name]:serializeAgentTraceContextState({...n,actionAnchors:s,actions:o,invocations:{...n.invocations,[a]:c}})}}function recordActionInvocationKind(e){let t=e.serializedContext[AgentTraceContextKey.name];if(t===void 0)return e.serializedContext;let n=deserializeAgentTraceContextState(t),update=t=>t.sessionId===e.sessionId&&t.turnId===e.turnId&&t.callId===e.callId?{...t,isWorkflowTool:void 0,kind:e.kind,workflowName:void 0}:t;return{...e.serializedContext,[AgentTraceContextKey.name]:serializeAgentTraceContextState({...n,actionAnchors:Object.fromEntries(Object.entries(n.actionAnchors).map(([e,t])=>[e,update(t)])),actions:Object.fromEntries(Object.entries(n.actions).map(([e,t])=>[e,update(t)]))})}}function withTraceDecision(e,t,n){let r=e[SessionTraceSeedKey.name],i=resolveForwardedTraceSeed({decision:n??r?.decision,forwardedTracePolicy:r?.forwardedTracePolicy,traceFlags:t.traceFlags}),a=i.decision,o=i.forwardedTracePolicy,s=decisionToTraceContentCeiling(a),c={...t,traceFlags:i.traceFlags};if(o===void 0)return a===void 0?c:{...c,decision:a};let l=s===void 0?o:{...o,ceiling:s};return a===void 0?{...c,forwardedTracePolicy:l}:{...c,decision:a,forwardedTracePolicy:l}}var ContextAgentTraceStateStore=class{deleteAction(e){updateState(t=>{let n={...t.actions};return delete n[e],{...t,actions:n}})}deleteActionAnchors(e){updateState(t=>({...t,actionAnchors:Object.fromEntries(Object.entries(t.actionAnchors).filter(([,t])=>t.sessionId!==e))}))}deleteActions(e,t){updateState(n=>{let r={...n.actions};for(let[n,i]of Object.entries(r))i.sessionId===e&&(t===void 0||i.turnId===t)&&delete r[n];return{...n,actions:r}})}deleteInvocation(e){updateState(t=>{let n={...t.invocations};return delete n[e],{...t,invocations:n}})}deleteInvocations(e,t){updateState(n=>({...n,invocations:Object.fromEntries(Object.entries(n.invocations).filter(([,n])=>n.sessionId!==e||t!==void 0&&n.turnId!==t))}))}deleteSession(e){updateState(t=>{let n={...t.sessions};return delete n[e],{...t,sessions:n}})}deleteTurn(e,t){updateState(n=>{let r={...n.turns};return delete r[turnKey(e,t)],{...n,turns:r}})}findAction(e,t){return Object.values(contextStorage.getStore()?.get(AgentTraceContextKey)?.actions??{}).find(n=>n.sessionId===e&&n.callId===t)}findActionAnchor(e,t,n){return Object.values(contextStorage.getStore()?.get(AgentTraceContextKey)?.actionAnchors??{}).find(r=>r.sessionId===e&&r.turnId===t&&r.callId===n)}findInvocations(e,t,n){return Object.values(contextStorage.getStore()?.get(AgentTraceContextKey)?.invocations??{}).filter(r=>(e===void 0||r.sessionId===e)&&(t===void 0||r.turnId===t)&&(n===void 0||r.parentActionCallId===n))}getAction(e){return contextStorage.getStore()?.get(AgentTraceContextKey)?.actions[e]}getSession(e){return contextStorage.getStore()?.get(AgentTraceContextKey)?.sessions[e]}getTurn(e,t){return contextStorage.getStore()?.get(AgentTraceContextKey)?.turns[turnKey(e,t)]}setAction(e,t){updateState(n=>({...n,actions:{...n.actions,[e]:t}}))}setActionAnchor(e,t){updateState(n=>({...n,actionAnchors:{...n.actionAnchors,[e]:t}}))}setInvocation(e,t){updateState(n=>({...n,invocations:{...n.invocations,[e]:t}}))}setSession(e,t){updateState(n=>({...n,sessions:{...n.sessions,[e]:t}}))}setTurn(e,t,n){updateState(r=>({...r,turns:{...r.turns,[turnKey(e,t)]:n}}))}updateTurn(e,t,n){updateState(r=>{let i=turnKey(e,t),a=r.turns[i];return a===void 0?r:{...r,turns:{...r.turns,[i]:n(a)}}})}};function updateState(e){loadContext().set(AgentTraceContextKey,t=>e(t??emptyAgentTraceContextState()))}function turnKey(e,t){return`${e}\0${t}`}export{ContextAgentTraceStateStore,preserveSerializedAgentTraceState,pruneAgentTraceState,readActionTraceContext,readCurrentSessionTraceDecision,readSessionTraceDecision,readTaskActionTrace,readTurnTraceContext,recordActionInvocationKind,recordNestedAgentInvocation};
1
+ import{createLogger}from"#internal/logging.js";import{decisionToTraceContentCeiling,resolveForwardedTraceSeed}from"#shared/forwarded-trace-policy.js";import{contextStorage,loadContext}from"#context/container.js";import{SessionTraceSeedKey}from"#context/keys.js";import{ContextKey}from"#context/key.js";import{getBackgroundWorkflowToolRuns,getBlockingWorkflowToolRuns}from"#harness/workflow-tool-runs.js";import{deriveTaskId}from"#tasks/task-id.js";import{actionIdempotencyKey}from"#instrumentation/lifecycle.js";import{AGENT_TRACE_CONTEXT_KEY,deserializeAgentTraceContextState,emptyAgentTraceContextState,serializeAgentTraceContextState}from"#tracing/agent-trace-context-codec.js";const AgentTraceContextKey=new ContextKey(AGENT_TRACE_CONTEXT_KEY,{codec:{deserialize:deserializeAgentTraceContextState,serialize:serializeAgentTraceContextState}});function pruneAgentTraceState(e,t,n){try{pruneTraceOwnership(e,t,n)}catch(e){createLogger(`tracing.retention`).warn(`could not reconcile trace ownership; preserving trace state`,{error:e})}}function pruneTraceOwnership(e,t,n){let r=e.get(AgentTraceContextKey);if(r===void 0)return;let i=new Set(getBlockingWorkflowToolRuns(n).map(e=>e.callId)),a=new Set(getBackgroundWorkflowToolRuns(n).filter(e=>e.task.outcome===void 0).map(e=>e.task.taskId)),o=Object.fromEntries(Object.entries(r.actionAnchors).filter(([e,n])=>n.sessionId!==t||r.actions[e]!==void 0||i.has(n.callId)||a.has(deriveTaskId({callId:n.callId,parentSessionId:t,parentTurnId:n.turnId})))),s=new Set(Object.values(o).filter(e=>e.sessionId===t).map(e=>e.callId)),c=Object.fromEntries(Object.entries(r.invocations).filter(([,e])=>e.sessionId!==t||e.terminal!==void 0||s.has(e.parentActionCallId)));e.set(AgentTraceContextKey,{...r,actionAnchors:o,invocations:c})}function readCurrentSessionTraceDecision(e){let t=contextStorage.getStore();return t===void 0?void 0:readSessionTraceDecision(t,e)}function readSessionTraceDecision(e,t){return e.get(AgentTraceContextKey)?.sessions[t]?.decision}function preserveSerializedAgentTraceState(e,t){let n=t[AgentTraceContextKey.name];return n===void 0?e:{...e,[AgentTraceContextKey.name]:n}}function readTurnTraceContext(e,t,n){let r=e[AgentTraceContextKey.name];if(r===void 0)return;let i=deserializeAgentTraceContextState(r),a=i.turns[turnKey(t,n)];return a===void 0?void 0:withTraceDecision(e,a.context,i.sessions[t]?.decision)}function readActionTraceContext(e,t,n,r){let i=e[AgentTraceContextKey.name];if(i===void 0)return;let a=deserializeAgentTraceContextState(i),o=actionIdempotencyKey(t,n,r),s=a.invocations[o]??a.actions[o]??a.actionAnchors[o];if(s!==void 0)return withTraceDecision(e,{isRemote:!1,spanId:s.spanId,traceFlags:s.parent.traceFlags,traceId:s.parent.traceId},a.sessions[s.sessionId]?.decision)}function readTaskActionTrace(e,t,n){let r=deserializeAgentTraceContextState(e[AgentTraceContextKey.name]);return Object.values(r.actionAnchors).find(e=>e.sessionId===t&&deriveTaskId({callId:e.callId,parentSessionId:t,parentTurnId:e.turnId})===n)}function recordNestedAgentInvocation(e){let t=e.serializedContext[AgentTraceContextKey.name];if(t===void 0)return e.serializedContext;let n=deserializeAgentTraceContextState(t),r=actionIdempotencyKey(e.sessionId,e.turnId,e.outerCallId),i=n.actions[r]??n.actionAnchors[r];if(i===void 0)return e.serializedContext;let a=actionIdempotencyKey(e.sessionId,e.turnId,e.callId),promote=e=>e.isWorkflowTool===!0&&e.kind===`tool-call`?{...e,workflowName:e.name}:e,o=n.actions[r]===void 0?n.actions:{...n.actions,[r]:promote(n.actions[r])},s=n.actionAnchors[r]===void 0?n.actionAnchors:{...n.actionAnchors,[r]:promote(n.actionAnchors[r])};if(n.invocations[a]!==void 0)return{...e.serializedContext,[AgentTraceContextKey.name]:serializeAgentTraceContextState({...n,actionAnchors:s,actions:o})};let c={attemptIndex:i.attemptIndex,callId:e.callId,channelAudience:i.channelAudience,kind:e.kind,name:e.name,parent:{spanId:i.spanId,traceFlags:i.parent.traceFlags,traceId:i.parent.traceId},parentActionCallId:e.outerCallId,recordOutputs:e.recordOutputs===!0,rootSessionId:i.rootSessionId,sessionId:i.sessionId,spanId:e.spanId,startTimeMs:e.startTimeMs,stepIndex:i.stepIndex,turnId:i.turnId};return{...e.serializedContext,[AgentTraceContextKey.name]:serializeAgentTraceContextState({...n,actionAnchors:s,actions:o,invocations:{...n.invocations,[a]:c}})}}function recordActionInvocationKind(e){let t=e.serializedContext[AgentTraceContextKey.name];if(t===void 0)return e.serializedContext;let n=deserializeAgentTraceContextState(t),update=t=>t.sessionId===e.sessionId&&t.turnId===e.turnId&&t.callId===e.callId?{...t,isWorkflowTool:void 0,kind:e.kind,workflowName:void 0}:t;return{...e.serializedContext,[AgentTraceContextKey.name]:serializeAgentTraceContextState({...n,actionAnchors:Object.fromEntries(Object.entries(n.actionAnchors).map(([e,t])=>[e,update(t)])),actions:Object.fromEntries(Object.entries(n.actions).map(([e,t])=>[e,update(t)]))})}}function withTraceDecision(e,t,n){let r=e[SessionTraceSeedKey.name],i=resolveForwardedTraceSeed({decision:n??r?.decision,forwardedTracePolicy:r?.forwardedTracePolicy,traceFlags:t.traceFlags}),a=i.decision,o=i.forwardedTracePolicy,s=decisionToTraceContentCeiling(a),c={...t,traceFlags:i.traceFlags};if(o===void 0)return a===void 0?c:{...c,decision:a};let l=s===void 0?o:{...o,ceiling:s};return a===void 0?{...c,forwardedTracePolicy:l}:{...c,decision:a,forwardedTracePolicy:l}}var ContextAgentTraceStateStore=class{deleteAction(e){updateState(t=>{let n={...t.actions};return delete n[e],{...t,actions:n}})}deleteActionAnchors(e){updateState(t=>({...t,actionAnchors:Object.fromEntries(Object.entries(t.actionAnchors).filter(([,t])=>t.sessionId!==e))}))}deleteActions(e,t){updateState(n=>{let r={...n.actions};for(let[n,i]of Object.entries(r))i.sessionId===e&&(t===void 0||i.turnId===t)&&delete r[n];return{...n,actions:r}})}deleteInvocation(e){updateState(t=>{let n={...t.invocations};return delete n[e],{...t,invocations:n}})}deleteInvocations(e,t){updateState(n=>({...n,invocations:Object.fromEntries(Object.entries(n.invocations).filter(([,n])=>n.sessionId!==e||t!==void 0&&n.turnId!==t))}))}deleteSession(e){updateState(t=>{let n={...t.sessions};return delete n[e],{...t,sessions:n}})}deleteTurn(e,t){updateState(n=>{let r={...n.turns};return delete r[turnKey(e,t)],{...n,turns:r}})}findAction(e,t){return Object.values(contextStorage.getStore()?.get(AgentTraceContextKey)?.actions??{}).find(n=>n.sessionId===e&&n.callId===t)}findActionAnchor(e,t,n){return Object.values(contextStorage.getStore()?.get(AgentTraceContextKey)?.actionAnchors??{}).find(r=>r.sessionId===e&&r.turnId===t&&r.callId===n)}findInvocations(e,t,n){return Object.values(contextStorage.getStore()?.get(AgentTraceContextKey)?.invocations??{}).filter(r=>(e===void 0||r.sessionId===e)&&(t===void 0||r.turnId===t)&&(n===void 0||r.parentActionCallId===n))}getAction(e){return contextStorage.getStore()?.get(AgentTraceContextKey)?.actions[e]}getSession(e){return contextStorage.getStore()?.get(AgentTraceContextKey)?.sessions[e]}getTurn(e,t){return contextStorage.getStore()?.get(AgentTraceContextKey)?.turns[turnKey(e,t)]}setAction(e,t){updateState(n=>({...n,actions:{...n.actions,[e]:t}}))}setActionAnchor(e,t){updateState(n=>({...n,actionAnchors:{...n.actionAnchors,[e]:t}}))}setInvocation(e,t){updateState(n=>({...n,invocations:{...n.invocations,[e]:t}}))}setSession(e,t){updateState(n=>({...n,sessions:{...n.sessions,[e]:t}}))}setTurn(e,t,n){updateState(r=>({...r,turns:{...r.turns,[turnKey(e,t)]:n}}))}updateTurn(e,t,n){updateState(r=>{let i=turnKey(e,t),a=r.turns[i];return a===void 0?r:{...r,turns:{...r.turns,[i]:n(a)}}})}};function updateState(e){loadContext().set(AgentTraceContextKey,t=>e(t??emptyAgentTraceContextState()))}function turnKey(e,t){return`${e}\0${t}`}export{ContextAgentTraceStateStore,preserveSerializedAgentTraceState,pruneAgentTraceState,readActionTraceContext,readCurrentSessionTraceDecision,readSessionTraceDecision,readTaskActionTrace,readTurnTraceContext,recordActionInvocationKind,recordNestedAgentInvocation};
@@ -1,3 +1,3 @@
1
- import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-C5-yqRuq.js";
1
+ import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-BdKlQF32.js";
2
2
 
3
3
  export { defaultMessageReducer, useEveAgent };
@@ -1,3 +1,3 @@
1
- import { t as useEveAgent } from "../chunks/use-eve-agent-C5-yqRuq.js";
1
+ import { t as useEveAgent } from "../chunks/use-eve-agent-BdKlQF32.js";
2
2
 
3
3
  export { useEveAgent };