eve 0.37.0 → 0.38.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 (410) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/src/channel/routes.d.ts +13 -3
  3. package/dist/src/channel/routes.js +1 -1
  4. package/dist/src/channel/session-callback.js +1 -1
  5. package/dist/src/channel/session.d.ts +2 -1
  6. package/dist/src/channel/session.js +1 -1
  7. package/dist/src/channel/types.d.ts +41 -0
  8. package/dist/src/chunks/{use-eve-agent-COmP-H8R.js → use-eve-agent-BbSsu99c.js} +79 -32
  9. package/dist/src/chunks/{use-eve-agent-CnppTEFk.js → use-eve-agent-Dt8Y5QtW.js} +78 -31
  10. package/dist/src/cli/acp/command.d.ts +2 -1
  11. package/dist/src/cli/acp/command.js +2 -2
  12. package/dist/src/cli/application-command.d.ts +8 -0
  13. package/dist/src/cli/application-command.js +1 -0
  14. package/dist/src/cli/application-root.d.ts +8 -0
  15. package/dist/src/cli/application-root.js +1 -0
  16. package/dist/src/cli/commands/build.d.ts +2 -1
  17. package/dist/src/cli/commands/build.js +1 -1
  18. package/dist/src/cli/commands/init-git.js +1 -1
  19. package/dist/src/cli/commands/init-recovery.d.ts +3 -0
  20. package/dist/src/cli/commands/init-recovery.js +3 -0
  21. package/dist/src/cli/commands/init-repl.js +1 -1
  22. package/dist/src/cli/commands/init-target.d.ts +21 -0
  23. package/dist/src/cli/commands/init-target.js +1 -0
  24. package/dist/src/cli/commands/init.js +1 -1
  25. package/dist/src/cli/commands/register-integration-commands.d.ts +2 -1
  26. package/dist/src/cli/commands/register-integration-commands.js +1 -1
  27. package/dist/src/cli/commands/register-project-commands.d.ts +2 -1
  28. package/dist/src/cli/commands/register-project-commands.js +1 -1
  29. package/dist/src/cli/commands/register-registry-commands.d.ts +2 -1
  30. package/dist/src/cli/commands/register-registry-commands.js +4 -1
  31. package/dist/src/cli/commands/registry-recovery.d.ts +14 -0
  32. package/dist/src/cli/commands/registry-recovery.js +1 -0
  33. package/dist/src/cli/commands/registry.d.ts +2 -5
  34. package/dist/src/cli/commands/registry.js +1 -1
  35. package/dist/src/cli/dev/diagnostic-dump.js +1 -1
  36. package/dist/src/cli/dev/environment.js +1 -1
  37. package/dist/src/cli/dev/tui/runner.d.ts +8 -0
  38. package/dist/src/cli/dev/tui/runner.js +1 -1
  39. package/dist/src/cli/dev/tui/subagent-pump.d.ts +27 -22
  40. package/dist/src/cli/dev/tui/subagent-pump.js +1 -1
  41. package/dist/src/cli/dev/tui/terminal-renderer.d.ts +16 -0
  42. package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
  43. package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
  44. package/dist/src/cli/invoke/command.d.ts +3 -2
  45. package/dist/src/cli/invoke/command.js +1 -1
  46. package/dist/src/cli/run.d.ts +3 -2
  47. package/dist/src/cli/run.js +3 -3
  48. package/dist/src/client/eve-agent-store.d.ts +15 -3
  49. package/dist/src/client/eve-agent-store.js +2 -2
  50. package/dist/src/client/message-response.d.ts +10 -2
  51. package/dist/src/client/message-response.js +1 -1
  52. package/dist/src/client/open-stream.d.ts +2 -0
  53. package/dist/src/client/open-stream.js +1 -1
  54. package/dist/src/client/session.js +1 -1
  55. package/dist/src/compiled/.vendor-stamp.json +5 -1
  56. package/dist/src/compiled/@ai-sdk/otel/index.js +3 -3
  57. package/dist/src/compiled/@chat-adapter/slack/index.js +25 -25
  58. package/dist/src/compiled/@modelcontextprotocol/server/LICENSE +216 -0
  59. package/dist/src/compiled/@modelcontextprotocol/server/index.d.ts +98 -0
  60. package/dist/src/compiled/@modelcontextprotocol/server/index.js +80 -0
  61. package/dist/src/compiled/@opentelemetry/api/index.js +1 -1
  62. package/dist/src/compiled/@opentelemetry/otlp-transformer/index.js +1 -1
  63. package/dist/src/compiled/@photon-ai/chat-adapter-imessage/index.js +61 -61
  64. package/dist/src/compiled/@vercel/oidc/index.js +14 -14
  65. package/dist/src/compiled/@vercel/otel/index.js +1 -1
  66. package/dist/src/compiled/@vercel/sandbox/index.js +1 -1
  67. package/dist/src/compiled/@workflow/core/index.js +1 -1
  68. package/dist/src/compiled/@workflow/core/private.js +1 -1
  69. package/dist/src/compiled/@workflow/core/runtime.js +2 -2
  70. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  71. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  72. package/dist/src/compiled/@workflow/world-local/index.js +5 -5
  73. package/dist/src/compiled/@workflow/world-vercel/index.js +13 -13
  74. package/dist/src/compiled/_chunks/workflow/{attribute-changes-BoH7JsWp.js → attribute-changes-DZtQkszH.js} +1 -1
  75. package/dist/src/compiled/_chunks/workflow/chunk-5MU5Z6L3-B_3nkJFi.js +1 -0
  76. package/dist/src/compiled/_chunks/workflow/{chunk-NWCAEW5Y-Oxw40oRR.js → chunk-NWCAEW5Y-BgbcH0OK.js} +1 -1
  77. package/dist/src/compiled/_chunks/workflow/{dist-DlFv0aHY.js → dist-CPlyFOVo.js} +1 -1
  78. package/dist/src/compiled/_chunks/workflow/{dist-tJoQXAF6.js → dist-DpYyXbJv.js} +1 -1
  79. package/dist/src/compiled/_chunks/workflow/{dist-CRTn4Sg8.js → dist-xQXN70ED.js} +1 -1
  80. package/dist/src/compiled/_chunks/workflow/esm-seIr7a6j.js +1 -0
  81. package/dist/src/compiled/_chunks/workflow/{frames-CTpeJYEQ.js → frames-BBs-9k1d.js} +2 -2
  82. package/dist/src/compiled/_chunks/workflow/{functions-CeeNvKsq.js → functions-DAYiHNti.js} +1 -1
  83. package/dist/src/compiled/_chunks/workflow/{getMachineId-bsd-WEBNKY2R-CEYkx6Nv.js → getMachineId-bsd-WEBNKY2R-BTaxrQ52.js} +1 -1
  84. package/dist/src/compiled/_chunks/workflow/{getMachineId-darwin-LT47KAXP-DPwWlhif.js → getMachineId-darwin-LT47KAXP-DhYmwE_R.js} +1 -1
  85. package/dist/src/compiled/_chunks/workflow/{getMachineId-linux-LTVQO6VW-DAFXHwZp.js → getMachineId-linux-LTVQO6VW-Dru_L5ru.js} +1 -1
  86. package/dist/src/compiled/_chunks/workflow/{getMachineId-unsupported-UKWBA27G-BZKOI8mG.js → getMachineId-unsupported-UKWBA27G-DGfoqVW1.js} +1 -1
  87. package/dist/src/compiled/_chunks/workflow/{getMachineId-win-NLJKOPY6-r7_CJB5o.js → getMachineId-win-NLJKOPY6-CLM98q4X.js} +1 -1
  88. package/dist/src/compiled/_chunks/workflow/{private-tvMBynnC.js → private-UQtz8ZcW.js} +1 -1
  89. package/dist/src/compiled/_chunks/workflow/{resume-hook-BPQHjeY5.js → resume-hook-CYtSorp6.js} +1 -1
  90. package/dist/src/compiled/_chunks/workflow/{rolldown-runtime-DaDcL9Zw.js → rolldown-runtime-8V8biNmG.js} +1 -1
  91. package/dist/src/compiled/_chunks/workflow/{run-DQ5dOyjm.js → run-Cjo0A3NO.js} +1 -1
  92. package/dist/src/compiled/_chunks/workflow/{signal-exit-C8vsI6zj.js → signal-exit-o3IPQwwv.js} +1 -1
  93. package/dist/src/compiled/_chunks/workflow/sleep-C1P0OWBm.js +1 -0
  94. package/dist/src/compiled/_chunks/workflow/{token-DHD-q-fS.js → token-DGzfw-Vb.js} +1 -1
  95. package/dist/src/compiled/_chunks/workflow/{token-DtCUEpJs.js → token-DNbxVpeq.js} +1 -1
  96. package/dist/src/compiled/_chunks/workflow/token-util-BneBe0g5.js +27 -0
  97. package/dist/src/compiled/_chunks/workflow/{token-util-Ldar52H7.js → token-util-DjMgNdXS.js} +1 -1
  98. package/dist/src/compiled/_chunks/workflow/{undici-CUIybhQ2.js → undici-BBG5cZTy.js} +1 -1
  99. package/dist/src/compiled/_chunks/workflow/{wait-until-DK2lnH6U.js → wait-until-CT1ve8qB.js} +3 -3
  100. package/dist/src/compiled/_chunks/workflow/{wrapper-CMGju7QA.js → wrapper-CQNxP9mU.js} +3 -3
  101. package/dist/src/compiled/_chunks/workflow/{ws-transport-Csi6Cydc.js → ws-transport-beXxD0s_.js} +1 -1
  102. package/dist/src/compiled/env-runner/node-worker.js +1 -1
  103. package/dist/src/compiled/jose/index.js +1 -1
  104. package/dist/src/compiled/shadcn-registry/index.js +403 -403
  105. package/dist/src/compiler/artifacts.js +1 -1
  106. package/dist/src/compiler/compile-agent.js +2 -2
  107. package/dist/src/compiler/extension-compatibility.d.ts +20 -10
  108. package/dist/src/compiler/extension-compatibility.js +1 -1
  109. package/dist/src/compiler/manifest.js +1 -1
  110. package/dist/src/compiler/normalize-agent-config.js +1 -1
  111. package/dist/src/compiler/normalize-extension.d.ts +8 -5
  112. package/dist/src/compiler/normalize-extension.js +1 -1
  113. package/dist/src/compiler/normalize-manifest.js +1 -1
  114. package/dist/src/compiler/normalize-subagent.d.ts +1 -1
  115. package/dist/src/compiler/normalize-subagent.js +1 -1
  116. package/dist/src/context/serialized-dynamic-model-selection.d.ts +2 -0
  117. package/dist/src/context/serialized-dynamic-model-selection.js +1 -0
  118. package/dist/src/discover/discover-agent.js +1 -1
  119. package/dist/src/discover/extensions.d.ts +0 -6
  120. package/dist/src/discover/extensions.js +1 -1
  121. package/dist/src/evals/cli/eval.d.ts +1 -1
  122. package/dist/src/evals/cli/eval.js +1 -1
  123. package/dist/src/execution/agent-handle-dispatch.d.ts +15 -1
  124. package/dist/src/execution/agent-handle-dispatch.js +1 -1
  125. package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
  126. package/dist/src/execution/delegated-parent-notification.d.ts +17 -0
  127. package/dist/src/execution/delegated-parent-notification.js +1 -1
  128. package/dist/src/execution/deliver-payloads.js +1 -1
  129. package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +155 -0
  130. package/dist/src/execution/dispatch-runtime-actions-shared.js +1 -0
  131. package/dist/src/execution/dispatch-runtime-actions-step.d.ts +18 -14
  132. package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
  133. package/dist/src/execution/dispatch-workflow-runtime-actions-step.d.ts +7 -2
  134. package/dist/src/execution/dispatch-workflow-runtime-actions-step.js +1 -1
  135. package/dist/src/execution/effective-output-schema.d.ts +21 -0
  136. package/dist/src/execution/effective-output-schema.js +1 -0
  137. package/dist/src/execution/eve-workflow-attributes.d.ts +2 -0
  138. package/dist/src/execution/node-step.js +1 -1
  139. package/dist/src/execution/parked-delivery-wait.d.ts +8 -12
  140. package/dist/src/execution/parked-delivery-wait.js +1 -1
  141. package/dist/src/execution/{route-proxied-deliver-step.d.ts → proxied-deliver-step.d.ts} +7 -4
  142. package/dist/src/execution/proxied-deliver-step.js +1 -0
  143. package/dist/src/execution/remote-agent-dispatch.d.ts +32 -0
  144. package/dist/src/execution/remote-agent-dispatch.js +1 -1
  145. package/dist/src/execution/remote-agent-route-url.d.ts +2 -0
  146. package/dist/src/execution/remote-agent-route-url.js +1 -0
  147. package/dist/src/execution/route-child-delivery.d.ts +2 -1
  148. package/dist/src/execution/route-child-delivery.js +1 -1
  149. package/dist/src/execution/sandbox/bindings/docker-templates.js +1 -1
  150. package/dist/src/execution/sandbox/bindings/just-bash.js +1 -1
  151. package/dist/src/execution/sandbox/bindings/microsandbox-templates.js +1 -1
  152. package/dist/src/execution/sandbox/prewarm.js +1 -1
  153. package/dist/src/execution/session-callback-step.d.ts +11 -0
  154. package/dist/src/execution/session-callback-step.js +1 -1
  155. package/dist/src/execution/session-command-wire.js +1 -1
  156. package/dist/src/execution/session-state-cursor.d.ts +25 -0
  157. package/dist/src/execution/session-state-cursor.js +1 -0
  158. package/dist/src/execution/settle-cancelled-turn-step.d.ts +2 -0
  159. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  160. package/dist/src/execution/subagent-event-proxy-step.d.ts +15 -0
  161. package/dist/src/execution/subagent-event-proxy-step.js +1 -1
  162. package/dist/src/execution/subagent-hitl-proxy.d.ts +14 -7
  163. package/dist/src/execution/subagent-hitl-proxy.js +1 -1
  164. package/dist/src/execution/subagent-start-local.d.ts +29 -0
  165. package/dist/src/execution/subagent-start-local.js +1 -0
  166. package/dist/src/execution/subagent-start-remote.d.ts +23 -0
  167. package/dist/src/execution/subagent-start-remote.js +1 -0
  168. package/dist/src/execution/task-event-callback.d.ts +13 -0
  169. package/dist/src/execution/task-event-callback.js +1 -0
  170. package/dist/src/execution/task-input-capability.d.ts +4 -0
  171. package/dist/src/execution/task-input-capability.js +1 -0
  172. package/dist/src/execution/tasks/child/steps.d.ts +46 -0
  173. package/dist/src/execution/tasks/child/steps.js +1 -0
  174. package/dist/src/execution/tasks/child/workflow.d.ts +31 -0
  175. package/dist/src/execution/tasks/child/workflow.js +1 -0
  176. package/dist/src/execution/tasks/parent/agent-identity.d.ts +13 -0
  177. package/dist/src/execution/tasks/parent/agent-identity.js +1 -0
  178. package/dist/src/execution/tasks/parent/agent-views.d.ts +6 -0
  179. package/dist/src/execution/tasks/parent/agent-views.js +1 -0
  180. package/dist/src/execution/tasks/parent/continuation-dispatch.d.ts +37 -0
  181. package/dist/src/execution/tasks/parent/continuation-dispatch.js +1 -0
  182. package/dist/src/execution/tasks/parent/control-shared.d.ts +36 -0
  183. package/dist/src/execution/tasks/parent/control-shared.js +1 -0
  184. package/dist/src/execution/tasks/parent/delegate.d.ts +70 -0
  185. package/dist/src/execution/tasks/parent/delegate.js +1 -0
  186. package/dist/src/execution/tasks/parent/dispatch-task-step.d.ts +19 -0
  187. package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -0
  188. package/dist/src/execution/tasks/parent/dispatch.d.ts +33 -0
  189. package/dist/src/execution/tasks/parent/dispatch.js +1 -0
  190. package/dist/src/execution/tasks/parent/hitl-proxy-steps.d.ts +29 -0
  191. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -0
  192. package/dist/src/execution/tasks/parent/run-parent.d.ts +72 -0
  193. package/dist/src/execution/tasks/parent/run-parent.js +1 -0
  194. package/dist/src/execution/tasks/parent/send.d.ts +25 -0
  195. package/dist/src/execution/tasks/parent/send.js +1 -0
  196. package/dist/src/execution/tasks/workflow-target.d.ts +2 -0
  197. package/dist/src/execution/tasks/workflow-target.js +1 -0
  198. package/dist/src/execution/terminate-child-sessions-step.d.ts +1 -0
  199. package/dist/src/execution/terminate-child-sessions-step.js +1 -1
  200. package/dist/src/execution/turn-control-receiver.d.ts +10 -0
  201. package/dist/src/execution/turn-control-receiver.js +1 -1
  202. package/dist/src/execution/turn-dispatch.d.ts +2 -0
  203. package/dist/src/execution/turn-dispatch.js +1 -1
  204. package/dist/src/execution/turn-execution-cursor.d.ts +2 -8
  205. package/dist/src/execution/turn-execution-cursor.js +1 -1
  206. package/dist/src/execution/turn-workflow.js +1 -1
  207. package/dist/src/execution/workflow-callback-url.d.ts +5 -0
  208. package/dist/src/execution/workflow-callback-url.js +1 -1
  209. package/dist/src/execution/workflow-entry.js +1 -1
  210. package/dist/src/execution/workflow-runtime.d.ts +9 -0
  211. package/dist/src/execution/workflow-runtime.js +1 -1
  212. package/dist/src/execution/workflow-steps.d.ts +7 -21
  213. package/dist/src/execution/workflow-steps.js +1 -1
  214. package/dist/src/harness/advertised-tools.js +1 -1
  215. package/dist/src/harness/authorization.js +1 -1
  216. package/dist/src/harness/execute-tool.d.ts +7 -0
  217. package/dist/src/harness/handles/prompt.d.ts +12 -0
  218. package/dist/src/harness/handles/prompt.js +2 -1
  219. package/dist/src/harness/handles/query.js +1 -1
  220. package/dist/src/harness/handles/store.d.ts +9 -2
  221. package/dist/src/harness/handles/store.js +1 -1
  222. package/dist/src/harness/handles/transitions.d.ts +10 -1
  223. package/dist/src/harness/handles/transitions.js +1 -1
  224. package/dist/src/harness/instrumentation/providers.js +1 -1
  225. package/dist/src/harness/instrumentation/runtime-context.d.ts +2 -0
  226. package/dist/src/harness/instrumentation/runtime-context.js +1 -1
  227. package/dist/src/harness/instrumentation/runtime.d.ts +3 -1
  228. package/dist/src/harness/proxy-input-requests.d.ts +21 -4
  229. package/dist/src/harness/proxy-input-requests.js +1 -1
  230. package/dist/src/harness/runtime-actions.d.ts +2 -0
  231. package/dist/src/harness/runtime-actions.js +1 -1
  232. package/dist/src/harness/session-limit-enforcement.js +1 -1
  233. package/dist/src/harness/tool-loop.js +2 -2
  234. package/dist/src/harness/workflow-runtime-action-state.js +1 -1
  235. package/dist/src/internal/application/cache-metadata.js +1 -1
  236. package/dist/src/internal/application/compiled-artifacts.js +2 -2
  237. package/dist/src/internal/application/optional-package-install.js +1 -1
  238. package/dist/src/internal/application/output-publication-lock.js +1 -1
  239. package/dist/src/internal/application/package.js +1 -1
  240. package/dist/src/internal/application/paths.js +1 -1
  241. package/dist/src/internal/application/tsconfig-dependencies.js +1 -1
  242. package/dist/src/internal/authored-definition/core.js +1 -1
  243. package/dist/src/internal/authored-module-evaluation-error.js +4 -4
  244. package/dist/src/internal/authored-module-loader.js +3 -3
  245. package/dist/src/internal/authored-package-boundary.js +1 -1
  246. package/dist/src/internal/authored-relative-extension-resolver.js +1 -1
  247. package/dist/src/internal/bundler/extension-scope-plugin.js +1 -1
  248. package/dist/src/internal/bundler/nitro-rolldown.js +1 -1
  249. package/dist/src/internal/instrumentation-layout.js +1 -1
  250. package/dist/src/internal/invocation/agent-invocation.d.ts +54 -0
  251. package/dist/src/internal/invocation/agent-invocation.js +1 -0
  252. package/dist/src/internal/invocation/attributes.d.ts +2 -0
  253. package/dist/src/internal/invocation/attributes.js +1 -0
  254. package/dist/src/internal/invocation/metadata.d.ts +9 -0
  255. package/dist/src/internal/invocation/metadata.js +1 -0
  256. package/dist/src/internal/invocation/workflow-execution.d.ts +32 -0
  257. package/dist/src/internal/invocation/workflow-execution.js +1 -0
  258. package/dist/src/internal/materialized-authored-modules.js +1 -1
  259. package/dist/src/internal/mcp/http-security.d.ts +12 -0
  260. package/dist/src/internal/mcp/http-security.js +1 -0
  261. package/dist/src/internal/mcp/protected-resource.d.ts +9 -0
  262. package/dist/src/internal/mcp/protected-resource.js +1 -0
  263. package/dist/src/internal/mcp/streamable-http-server.d.ts +51 -0
  264. package/dist/src/internal/mcp/streamable-http-server.js +1 -0
  265. package/dist/src/internal/nitro/dev-runtime-artifacts-retention.js +1 -1
  266. package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
  267. package/dist/src/internal/nitro/dev-runtime-source-snapshot-copy.js +1 -1
  268. package/dist/src/internal/nitro/dev-runtime-source-snapshot-local-roots.js +1 -1
  269. package/dist/src/internal/nitro/dev-runtime-source-snapshot.js +1 -1
  270. package/dist/src/internal/nitro/host/application-route-registry.d.ts +88 -0
  271. package/dist/src/internal/nitro/host/application-route-registry.js +1 -0
  272. package/dist/src/internal/nitro/host/build-application.js +1 -1
  273. package/dist/src/internal/nitro/host/build-extension.js +1 -1
  274. package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
  275. package/dist/src/internal/nitro/host/channel-routes.d.ts +4 -11
  276. package/dist/src/internal/nitro/host/channel-routes.js +3 -3
  277. package/dist/src/internal/nitro/host/configure-nitro-routes.js +3 -3
  278. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  279. package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
  280. package/dist/src/internal/nitro/host/dev-runner.js +1 -1
  281. package/dist/src/internal/nitro/host/dev-workspace-extensions.js +1 -1
  282. package/dist/src/internal/nitro/host/extension-capability-requirements.js +1 -1
  283. package/dist/src/internal/nitro/host/local-tracing-runtime-plugin.js +1 -1
  284. package/dist/src/internal/nitro/host/nitro-bundler-config.js +1 -1
  285. package/dist/src/internal/nitro/host/start-development-server.js +2 -2
  286. package/dist/src/internal/nitro/host/start-production-server.js +2 -2
  287. package/dist/src/internal/nitro/host/vercel-build-output-config.js +1 -1
  288. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  289. package/dist/src/internal/nitro/routes/channel-route-context.d.ts +14 -0
  290. package/dist/src/internal/nitro/routes/channel-route-context.js +1 -1
  291. package/dist/src/internal/nitro/routes/runtime-stack.d.ts +2 -0
  292. package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
  293. package/dist/src/internal/process/pnpm.js +1 -1
  294. package/dist/src/internal/vercel-agent-summary.d.ts +1 -1
  295. package/dist/src/internal/workflow/development-world-client.js +1 -1
  296. package/dist/src/internal/workflow/development-world-server.js +1 -1
  297. package/dist/src/internal/workflow-bundle/builder-support.d.ts +12 -8
  298. package/dist/src/internal/workflow-bundle/builder-support.js +8 -7
  299. package/dist/src/internal/workflow-bundle/builder.d.ts +1 -1
  300. package/dist/src/internal/workflow-bundle/builder.js +2 -3
  301. package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
  302. package/dist/src/protocol/message.d.ts +28 -0
  303. package/dist/src/protocol/message.js +2 -2
  304. package/dist/src/protocol/routes.d.ts +14 -0
  305. package/dist/src/protocol/routes.js +1 -1
  306. package/dist/src/public/channels/auth.d.ts +36 -0
  307. package/dist/src/public/channels/auth.js +1 -1
  308. package/dist/src/public/channels/discord/discordChannel.d.ts +2 -0
  309. package/dist/src/public/channels/discord/discordChannel.js +1 -1
  310. package/dist/src/public/channels/eve.d.ts +2 -0
  311. package/dist/src/public/channels/eve.js +1 -1
  312. package/dist/src/public/channels/github/dispatch.js +1 -1
  313. package/dist/src/public/channels/github/githubChannel.d.ts +2 -0
  314. package/dist/src/public/channels/linear/linearChannel.d.ts +2 -0
  315. package/dist/src/public/channels/linear/linearChannel.js +1 -1
  316. package/dist/src/public/channels/mcp.d.ts +19 -0
  317. package/dist/src/public/channels/mcp.js +1 -0
  318. package/dist/src/public/channels/photon/photonIMessageChannel.d.ts +2 -0
  319. package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
  320. package/dist/src/public/channels/slack/slackChannel.d.ts +3 -1
  321. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  322. package/dist/src/public/channels/teams/teamsChannel.d.ts +2 -0
  323. package/dist/src/public/channels/teams/teamsChannel.js +1 -1
  324. package/dist/src/public/channels/telegram/telegramChannel.d.ts +2 -0
  325. package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
  326. package/dist/src/public/channels/twilio/twilioChannel.d.ts +2 -0
  327. package/dist/src/public/channels/twilio/twilioChannel.js +1 -1
  328. package/dist/src/public/definitions/channel.d.ts +2 -2
  329. package/dist/src/public/definitions/channel.js +1 -1
  330. package/dist/src/public/instrumentation/index.d.ts +9 -3
  331. package/dist/src/public/next/server.js +1 -1
  332. package/dist/src/public/nuxt/dev-server.js +1 -1
  333. package/dist/src/public/sveltekit/dev-server.js +1 -1
  334. package/dist/src/react/use-eve-agent.d.ts +4 -4
  335. package/dist/src/react/use-eve-agent.js +1 -1
  336. package/dist/src/runtime/actions/types.d.ts +9 -0
  337. package/dist/src/runtime/actions/types.js +1 -1
  338. package/dist/src/runtime/agent/bootstrap.js +1 -1
  339. package/dist/src/runtime/connections/authorization-complete-page.js +70 -28
  340. package/dist/src/runtime/framework-channels/index.js +1 -1
  341. package/dist/src/runtime/framework-tools/index.js +1 -1
  342. package/dist/src/runtime/framework-tools/tasks.d.ts +95 -0
  343. package/dist/src/runtime/framework-tools/tasks.js +1 -0
  344. package/dist/src/runtime/prompt/compose.d.ts +1 -0
  345. package/dist/src/runtime/prompt/compose.js +1 -1
  346. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  347. package/dist/src/runtime/resolve-agent.js +1 -1
  348. package/dist/src/runtime/session-callback-route.js +1 -1
  349. package/dist/src/runtime/task-input-response-route.d.ts +5 -0
  350. package/dist/src/runtime/task-input-response-route.js +1 -0
  351. package/dist/src/services/inspect-application.js +1 -1
  352. package/dist/src/setup/primitives/pm/pnpm.js +2 -2
  353. package/dist/src/setup/primitives/run-vercel.js +1 -1
  354. package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
  355. package/dist/src/setup/scaffold/create/extension.js +1 -1
  356. package/dist/src/setup/scaffold/create/project.js +1 -1
  357. package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
  358. package/dist/src/setup/scaffold/create/web-template.js +8 -86
  359. package/dist/src/setup/scaffold/version-tokens.js +1 -1
  360. package/dist/src/setup/scaffold/workspace-root.js +1 -1
  361. package/dist/src/shared/agent-definition.d.ts +7 -0
  362. package/dist/src/svelte/index.js +1 -1
  363. package/dist/src/svelte/use-eve-agent.d.ts +3 -3
  364. package/dist/src/svelte/use-eve-agent.js +1 -1
  365. package/dist/src/tasks/json.d.ts +88 -0
  366. package/dist/src/tasks/json.js +1 -0
  367. package/dist/src/tasks/session-index.d.ts +48 -0
  368. package/dist/src/tasks/session-index.js +1 -0
  369. package/dist/src/tasks/task-id.d.ts +34 -0
  370. package/dist/src/tasks/task-id.js +1 -0
  371. package/dist/src/tasks/transitions.d.ts +23 -0
  372. package/dist/src/tasks/transitions.js +1 -0
  373. package/dist/src/tasks/types.d.ts +295 -0
  374. package/dist/src/tasks/types.js +1 -0
  375. package/dist/src/tasks/wire.d.ts +26 -0
  376. package/dist/src/tasks/wire.js +1 -0
  377. package/dist/src/tracing/install-instrumentation-runtime.d.ts +2 -1
  378. package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
  379. package/dist/src/tracing/otel-declaration.d.ts +32 -3
  380. package/dist/src/tracing/otel-declaration.js +1 -1
  381. package/dist/src/tracing/otel-registration.js +1 -1
  382. package/dist/src/vue/index.js +1 -1
  383. package/dist/src/vue/use-eve-agent.d.ts +3 -3
  384. package/dist/src/vue/use-eve-agent.js +1 -1
  385. package/docs/channels/custom.mdx +1 -1
  386. package/docs/channels/discord.mdx +1 -1
  387. package/docs/channels/eve.mdx +15 -2
  388. package/docs/channels/github.mdx +1 -1
  389. package/docs/channels/linear.mdx +1 -1
  390. package/docs/channels/overview.mdx +1 -1
  391. package/docs/channels/photon.mdx +1 -1
  392. package/docs/channels/slack.mdx +1 -1
  393. package/docs/channels/teams.mdx +1 -1
  394. package/docs/channels/telegram.mdx +1 -1
  395. package/docs/channels/twilio.mdx +1 -1
  396. package/docs/extensions.md +10 -6
  397. package/docs/guides/client/streaming.mdx +7 -6
  398. package/docs/guides/frontend/overview.mdx +10 -8
  399. package/docs/guides/frontend/use-eve-agent-svelte.mdx +10 -10
  400. package/docs/guides/frontend/use-eve-agent-vue.mdx +10 -10
  401. package/docs/install-integrations.mdx +4 -0
  402. package/docs/reference/cli.md +1 -1
  403. package/docs/schedules.mdx +2 -2
  404. package/docs/tools/human-in-the-loop.md +3 -1
  405. package/package.json +7 -1
  406. package/dist/src/compiled/_chunks/workflow/chunk-5MU5Z6L3-CaJgXkVg.js +0 -1
  407. package/dist/src/compiled/_chunks/workflow/sleep-CzdoBiqy.js +0 -1
  408. package/dist/src/compiled/_chunks/workflow/src-Cj3P1ChQ.js +0 -1
  409. package/dist/src/compiled/_chunks/workflow/token-util-DNwIAn_u.js +0 -27
  410. package/dist/src/execution/route-proxied-deliver-step.js +0 -1
@@ -0,0 +1,48 @@
1
+ import type { HarnessSession, SessionStateMap } from "#harness/types.js";
2
+ import type { TaskMetadata, TaskView } from "#tasks/types.js";
3
+ /**
4
+ * Session-state key for the parent's live-task index.
5
+ *
6
+ * The parent session stores only this index; the mutable task record
7
+ * lives in the dedicated durable task run. The PR #1190 spike found the
8
+ * session-state boundary unworkable for task state itself: session state
9
+ * threads through step results, while callback routes and child
10
+ * executors must update tasks without holding the current snapshot.
11
+ */
12
+ export declare const SESSION_TASKS_STATE_KEY = "eve.tasks";
13
+ /**
14
+ * One task owned by this session. Immutable model-safe metadata keeps the
15
+ * task-to-agent join available before the task run publishes its first view.
16
+ *
17
+ * `taskInboxToken` is the private routing credential for the task run's
18
+ * inbound hook. It must never render into model context, history, task
19
+ * views, or compaction summaries — the model addresses tasks by
20
+ * `taskId` only, and lookup verifies ownership through this index.
21
+ */
22
+ export interface SessionTaskIndexEntry {
23
+ readonly taskId: string;
24
+ readonly taskRunId: string;
25
+ /** Immutable fallback once the owning workflow run expires. */
26
+ readonly terminalView?: TaskView;
27
+ readonly taskInboxToken: string;
28
+ readonly createdByStepIndex?: number;
29
+ readonly createdByTurnId: string;
30
+ readonly metadata: TaskMetadata;
31
+ readonly operationId: string;
32
+ }
33
+ /**
34
+ * Reads and validates the task index from session state.
35
+ *
36
+ * A present but invalid index throws: treating corruption as absence
37
+ * would silently orphan every live task's routing credential.
38
+ */
39
+ export declare function getSessionTaskIndex(state: SessionStateMap | undefined): readonly SessionTaskIndexEntry[];
40
+ /** Caches one terminal view beside its task-run address. */
41
+ export declare function cacheTerminalTaskView(state: SessionStateMap | undefined, view: TaskView): SessionStateMap | undefined;
42
+ /** Finds one owned task; `undefined` enforces parent-session ownership. */
43
+ export declare function findSessionTaskEntry(state: SessionStateMap | undefined, taskId: string): SessionTaskIndexEntry | undefined;
44
+ /**
45
+ * Records one task, replacing any entry with the same id so replayed
46
+ * creation for the same originating call stays idempotent.
47
+ */
48
+ export declare function recordSessionTask(session: HarnessSession, entry: SessionTaskIndexEntry): HarnessSession;
@@ -0,0 +1 @@
1
+ import{z}from"#compiled/zod/index.js";const SESSION_TASKS_STATE_KEY=`eve.tasks`,taskMetadataSchema=z.strictObject({agentId:z.string().min(1),kind:z.literal(`subagent`),mode:z.enum([`local`,`remote`]),name:z.string().min(1)}),taskViewBaseShape={executor:z.strictObject({childSessionId:z.string().min(1).optional(),childTurnId:z.string().min(1).optional(),lifecycle:z.enum([`parked`,`terminal`]).optional()}).optional(),metadata:taskMetadataSchema,taskId:z.string().min(1),usage:z.strictObject({cacheReadTokens:z.number().nonnegative(),cacheWriteTokens:z.number().nonnegative(),inputTokens:z.number().nonnegative(),outputTokens:z.number().nonnegative()}).optional()},taskViewSchema=z.discriminatedUnion(`status`,[z.strictObject({...taskViewBaseShape,lastOutput:z.strictObject({data:z.custom(),type:z.literal(`result`)}),status:z.literal(`completed`)}),z.strictObject({...taskViewBaseShape,lastOutput:z.strictObject({data:z.custom(),type:z.literal(`error`)}),status:z.literal(`failed`)}),z.strictObject({...taskViewBaseShape,status:z.literal(`cancelled`)})]),sessionTaskIndexEntrySchema=z.strictObject({taskInboxToken:z.string().min(1),createdByStepIndex:z.number().int().nonnegative().optional(),createdByTurnId:z.string().min(1),metadata:taskMetadataSchema,operationId:z.string().min(1),taskId:z.string().min(1),taskRunId:z.string().min(1),terminalView:taskViewSchema.optional()}),sessionTaskIndexSchema=z.strictObject({tasks:z.array(sessionTaskIndexEntrySchema)}).refine(e=>new Set(e.tasks.map(e=>e.taskId)).size===e.tasks.length,{message:`Task ids must be unique.`}).refine(e=>e.tasks.every(e=>e.terminalView===void 0||e.terminalView.taskId===e.taskId&&sameTaskMetadata(e.terminalView.metadata,e.metadata)),{message:`Cached terminal views must match their task index entry.`});function getSessionTaskIndex(e){let n=e?.[SESSION_TASKS_STATE_KEY];if(n===void 0)return[];let r=sessionTaskIndexSchema.safeParse(n);if(!r.success)throw Error(`Corrupt task index under session state key "${SESSION_TASKS_STATE_KEY}": ${r.error.message}`);return r.data.tasks}function cacheTerminalTaskView(e,n){if(!isValidTerminalView(n))throw Error(`Cannot cache invalid terminal task "${n.taskId}".`);let r=getSessionTaskIndex(e),i=r.findIndex(e=>e.taskId===n.taskId);if(i<0)return e;if(!sameTaskMetadata(r[i].metadata,n.metadata))throw Error(`Task view metadata does not match index entry "${n.taskId}".`);let a=[...r];return a[i]={...a[i],terminalView:n},{...e,[SESSION_TASKS_STATE_KEY]:{tasks:a}}}function isValidTerminalView(e){if(e.inputRequests!==void 0)return!1;switch(e.status){case`completed`:return e.lastOutput?.type===`result`;case`failed`:return e.lastOutput?.type===`error`;case`cancelled`:return e.lastOutput===void 0;case`working`:return!1}}function sameTaskMetadata(e,t){return e.agentId===t.agentId&&e.kind===t.kind&&e.mode===t.mode&&e.name===t.name}function findSessionTaskEntry(e,t){return getSessionTaskIndex(e).find(e=>e.taskId===t)}function recordSessionTask(e,n){let r=[...getSessionTaskIndex(e.state).filter(e=>e.taskId!==n.taskId),n];return{...e,state:{...e.state,[SESSION_TASKS_STATE_KEY]:{tasks:r}}}}export{SESSION_TASKS_STATE_KEY,cacheTerminalTaskView,findSessionTaskEntry,getSessionTaskIndex,recordSessionTask};
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Derives the stable task id for one originating subagent call.
3
+ *
4
+ * Reuses the agent-handle operation-id derivation —
5
+ * `hash(parentSessionId, parentTurnId, callId)` — so replayed creation
6
+ * for the same call yields the same task without new machinery, and a
7
+ * task can never be confused with a child session id or continuation
8
+ * token.
9
+ *
10
+ * Lives apart from the pure task modules because the derivation needs
11
+ * `node:crypto`, which workflow bodies reject; ids are only ever minted
12
+ * inside dispatch steps.
13
+ */
14
+ export declare function deriveTaskId(input: {
15
+ readonly callId: string;
16
+ readonly parentSessionId: string;
17
+ readonly parentTurnId: string;
18
+ }): string;
19
+ /**
20
+ * Derives the task run's private inbox token.
21
+ *
22
+ * Deterministic on purpose: a durable replay of the dispatch step must
23
+ * re-derive the same token so the duplicate task run loses the hook
24
+ * claim and exits instead of splitting the lifecycle across two runs.
25
+ * Unguessable in practice: the parent session's continuation token is
26
+ * itself a private capability, and the derived token never renders to
27
+ * the model.
28
+ */
29
+ export declare function deriveTaskInboxToken(input: {
30
+ readonly parentContinuationToken: string;
31
+ readonly taskId: string;
32
+ }): string;
33
+ /** Reads the non-secret task id embedded in a private task inbox token. */
34
+ export declare function readTaskIdFromInboxToken(token: string): string | undefined;
@@ -0,0 +1 @@
1
+ import{createHash}from"node:crypto";import{deriveAgentOperationId}from"#harness/handles/operation-id.js";function deriveTaskId(e){return`task_${deriveAgentOperationId(e).slice(0,24)}`}function deriveTaskInboxToken(t){return`task:${t.taskId}:${createHash(`sha256`).update(`${t.taskId}\0${t.parentContinuationToken}`).digest(`hex`).slice(0,32)}`}function readTaskIdFromInboxToken(e){return/^task:(task_[^:]+):[a-f0-9]{32}$/.exec(e)?.[1]}export{deriveTaskId,deriveTaskInboxToken,readTaskIdFromInboxToken};
@@ -0,0 +1,23 @@
1
+ import type { TaskCommand, TaskView } from "#tasks/types.js";
2
+ /**
3
+ * Outcome of applying one command to a task view.
4
+ *
5
+ * - `accepted`: the state changed; the new view must be appended.
6
+ * - `noop`: the command is recognized and benign (idempotent cancel,
7
+ * stale answer); nothing changed and nothing is appended.
8
+ * - `rejected`: the command is invalid for the current status; the
9
+ * reason is diagnostic only.
10
+ */
11
+ type TaskTransitionResult = {
12
+ readonly outcome: "accepted";
13
+ readonly view: TaskView;
14
+ } | {
15
+ readonly outcome: "noop";
16
+ readonly view: TaskView;
17
+ } | {
18
+ readonly outcome: "rejected";
19
+ readonly view: TaskView;
20
+ readonly reason: string;
21
+ };
22
+ export declare function applyTaskTransition(view: TaskView, command: TaskCommand): TaskTransitionResult;
23
+ export {};
@@ -0,0 +1 @@
1
+ import{isTerminalTaskStatus,readTaskInputRequestId}from"#tasks/types.js";function terminalView(e,t,n){let r={executor:t.lifecycle===void 0?e.executor:{...e.executor,lifecycle:t.lifecycle},metadata:e.metadata,taskId:e.taskId};switch(t.usage!==void 0&&(r.usage=t.usage),n.status){case`completed`:return{...r,lastOutput:n.lastOutput,status:`completed`};case`failed`:return{...r,lastOutput:n.lastOutput,status:`failed`};case`cancelled`:return{...r,status:`cancelled`}}}function applyTaskTransition(n,r){if(isTerminalTaskStatus(n.status)){if(r.kind===`settle-executor`){let e={...n.executor,lifecycle:`terminal`};if(sameUsage(n.usage,r.usage)&&n.executor?.lifecycle===`terminal`)return{outcome:`noop`,view:n};let t={...n,executor:e};return{outcome:`accepted`,view:r.usage===void 0?t:{...t,usage:r.usage}}}return r.kind===`cancel`&&n.status===`cancelled`?{outcome:`noop`,view:n}:{outcome:`rejected`,reason:`Task "${n.taskId}" is already ${n.status}; "${r.kind}" cannot change a terminal task.`,view:n}}switch(r.kind){case`complete`:return{outcome:`accepted`,view:terminalView(n,r,{lastOutput:{data:r.data,type:`result`},status:`completed`})};case`fail`:case`reject-dispatch`:return{outcome:`accepted`,view:terminalView(n,r,{lastOutput:{data:r.data,type:`error`},status:`failed`})};case`cancel`:return{outcome:`accepted`,view:terminalView(n,r,{status:`cancelled`})};case`settle-executor`:return{outcome:`rejected`,reason:`Task "${n.taskId}" is not terminal; usage settles with its terminal command.`,view:n};case`require-authorization`:{let e={blockedOn:`authorization`,requestId:r.requestId};return n.status===`input_required`?n.inputRequests.some(e=>readTaskInputRequestId(e)===r.requestId)?{outcome:`noop`,view:n}:{outcome:`accepted`,view:{...n,inputRequests:[...n.inputRequests,e]}}:{outcome:`accepted`,view:{inputRequests:[e],executor:n.executor,metadata:n.metadata,status:`input_required`,taskId:n.taskId}}}case`require-input`:return isValidInputRequestBatch(r.inputRequests)?{outcome:`accepted`,view:{inputRequests:r.inputRequests,executor:n.executor,metadata:n.metadata,status:`input_required`,taskId:n.taskId}}:{outcome:`rejected`,reason:`Task "${n.taskId}" received an invalid input request batch.`,view:n};case`ready`:return{outcome:`accepted`,view:n};case`answered`:{if(n.status!==`input_required`)return{outcome:`noop`,view:n};let e=new Set(r.requestIds),i=n.inputRequests,a=i.filter(n=>{let r=readTaskInputRequestId(n);return r===void 0||!e.has(r)});return a.length===i.length?{outcome:`noop`,view:n}:a.length>0?{outcome:`accepted`,view:{inputRequests:a,executor:n.executor,metadata:n.metadata,status:`input_required`,taskId:n.taskId}}:{outcome:`accepted`,view:{executor:n.executor,metadata:n.metadata,status:`working`,taskId:n.taskId}}}case`start-turn`:return r.taskId===n.taskId?n.executor?.childSessionId!==void 0&&n.executor.childSessionId!==r.childSessionId?{outcome:`rejected`,reason:`Task child session "${r.childSessionId}" does not match "${n.executor.childSessionId}".`,view:n}:n.executor?.childSessionId===r.childSessionId&&n.executor.childTurnId===r.childTurnId?{outcome:`noop`,view:n}:{outcome:`accepted`,view:{...n,executor:{...n.executor,childSessionId:r.childSessionId,childTurnId:r.childTurnId}}}:{outcome:`rejected`,reason:`Task turn identity "${r.taskId}" does not match "${n.taskId}".`,view:n}}}function isValidInputRequestBatch(e){if(e.length===0)return!1;let n=e.map(readTaskInputRequestId);return n.every(e=>e!==void 0&&e.length>0)&&new Set(n).size===n.length}function sameUsage(e,t){return e===void 0||t===void 0?e===t:e?.cacheReadTokens===t.cacheReadTokens&&e.cacheWriteTokens===t.cacheWriteTokens&&e.inputTokens===t.inputTokens&&e.outputTokens===t.outputTokens}export{applyTaskTransition};
@@ -0,0 +1,295 @@
1
+ import type { JsonValue } from "#shared/json.js";
2
+ import type { SubagentAuthorizationEvent } from "#channel/types.js";
3
+ /**
4
+ * Task lifecycle contract for `experimental.tasks`.
5
+ *
6
+ * A task is one durable unit of delegated work owned by a parent session.
7
+ * The durable task run is the single writer for lifecycle transitions
8
+ * (see `#execution/tasks/child/workflow.js`); every other path submits
9
+ * commands and reads views. This module is dependency-free on
10
+ * purpose: it is bundled into workflow bodies, which reject Node.js
11
+ * builtins and heavyweight validators.
12
+ */
13
+ /**
14
+ * Task lifecycle status.
15
+ *
16
+ * `completed`, `failed`, and `cancelled` are terminal and final.
17
+ * `input_required` is not terminal but is ready for parent action; the
18
+ * child must wake its parent rather than deadlock while waiting for input.
19
+ */
20
+ export type TaskStatus = "working" | "input_required" | "completed" | "failed" | "cancelled";
21
+ /**
22
+ * Immutable identity of the delegated work behind a task.
23
+ *
24
+ * `agentId` is parent-controlled and exists before the child acknowledges its
25
+ * private address, so the durable task can bind to persistent identity before
26
+ * the dispatch side effect runs.
27
+ */
28
+ export interface TaskMetadata {
29
+ /** Stable model-visible identity of the persistent child session. */
30
+ readonly agentId: string;
31
+ readonly kind: "subagent";
32
+ readonly mode: "local" | "remote";
33
+ /** Authored subagent name the parent dispatched. */
34
+ readonly name: string;
35
+ }
36
+ /** Private executor state retained for cancellation and address reconciliation. */
37
+ export interface TaskExecutorState {
38
+ readonly childSessionId?: string;
39
+ readonly childTurnId?: string;
40
+ readonly lifecycle?: "parked" | "terminal";
41
+ }
42
+ /**
43
+ * Terminal task output. Failure is the state (`failed`); the `error`
44
+ * output is its consequence — a `failed` task always carries one.
45
+ * This intentionally diverges from MCP, which reserves `failed` for
46
+ * protocol-level errors.
47
+ */
48
+ export type TaskOutput = {
49
+ readonly type: "result";
50
+ readonly data: JsonValue;
51
+ } | {
52
+ readonly type: "error";
53
+ readonly data: JsonValue;
54
+ };
55
+ /**
56
+ * One outstanding request forwarded from a blocked child. Carried
57
+ * opaquely: the task layer routes the batch, the input contract owns
58
+ * its shape.
59
+ */
60
+ export type TaskInputRequest = JsonValue;
61
+ /**
62
+ * Provider token usage a child turn reported. Structural on purpose: it
63
+ * mirrors `TokenUsage` (#shared/token-usage.js) without importing its
64
+ * zod-backed module into a workflow-bundled file.
65
+ */
66
+ export interface TaskUsage {
67
+ readonly cacheReadTokens: number;
68
+ readonly cacheWriteTokens: number;
69
+ readonly inputTokens: number;
70
+ readonly outputTokens: number;
71
+ }
72
+ /**
73
+ * Validates one wire-carried usage value into {@link TaskUsage}.
74
+ * Anything malformed is dropped rather than rejected: retention is
75
+ * best-effort and must never fail a lifecycle transition.
76
+ */
77
+ export declare function readTaskUsage(value: unknown): TaskUsage | undefined;
78
+ /**
79
+ * One human answer to an outstanding request. Structural on purpose: it
80
+ * mirrors the input contract's `InputResponse` without importing its
81
+ * zod-backed module into a workflow-bundled file.
82
+ */
83
+ export interface TaskInputResponse {
84
+ readonly optionId?: string;
85
+ readonly requestId: string;
86
+ readonly text?: string;
87
+ }
88
+ /** Stable task blocker id shared by one authorization attempt's events. */
89
+ export declare function taskAuthorizationRequestId(event: SubagentAuthorizationEvent): string;
90
+ /** Reads the `requestId` of one opaque outstanding request. */
91
+ export declare function readTaskInputRequestId(request: TaskInputRequest): string | undefined;
92
+ /** Fields shared by every durable task view. */
93
+ interface TaskViewBase {
94
+ readonly taskId: string;
95
+ readonly metadata: TaskMetadata;
96
+ /** Private executor state; deliberately excluded from model-visible JSON. */
97
+ readonly executor?: TaskExecutorState;
98
+ /**
99
+ * Provider usage the child reported at settlement; present when the
100
+ * terminal command carried it. Retained for later accounting only —
101
+ * budgets stay best-effort until a reservation model lands — and
102
+ * deliberately excluded from model-visible task views (tasks/json.ts).
103
+ */
104
+ readonly usage?: TaskUsage;
105
+ }
106
+ /**
107
+ * Full durable task view discriminated by lifecycle status.
108
+ *
109
+ * The task run appends one per accepted command; readers always observe a
110
+ * complete view, never a delta. A view never contains routing credentials,
111
+ * continuation tokens, or authorization capabilities.
112
+ *
113
+ * Completed and failed tasks carry their corresponding output, cancelled
114
+ * tasks carry no output, and only input-required tasks carry requests.
115
+ */
116
+ export type TaskView = TaskViewBase & ({
117
+ readonly status: "working";
118
+ readonly inputRequests?: never;
119
+ readonly lastOutput?: never;
120
+ } | {
121
+ readonly status: "input_required";
122
+ readonly inputRequests: readonly TaskInputRequest[];
123
+ readonly lastOutput?: never;
124
+ } | {
125
+ readonly status: "completed";
126
+ readonly inputRequests?: never;
127
+ readonly lastOutput: Extract<TaskOutput, {
128
+ type: "result";
129
+ }>;
130
+ } | {
131
+ readonly status: "failed";
132
+ readonly inputRequests?: never;
133
+ readonly lastOutput: Extract<TaskOutput, {
134
+ type: "error";
135
+ }>;
136
+ } | {
137
+ readonly status: "cancelled";
138
+ readonly inputRequests?: never;
139
+ readonly lastOutput?: never;
140
+ });
141
+ /** Commands accepted by the durable task run's transition function. */
142
+ export type TaskCommand = {
143
+ readonly kind: "complete";
144
+ readonly data: JsonValue;
145
+ readonly lifecycle?: "parked" | "terminal";
146
+ readonly usage?: TaskUsage;
147
+ } | {
148
+ readonly kind: "fail";
149
+ readonly data: JsonValue;
150
+ readonly lifecycle?: "parked" | "terminal";
151
+ readonly usage?: TaskUsage;
152
+ }
153
+ /** Terminal dispatch rejection for a task that was never indexed by its parent. */
154
+ | {
155
+ readonly kind: "reject-dispatch";
156
+ readonly data: JsonValue;
157
+ readonly lifecycle?: never;
158
+ readonly usage?: never;
159
+ } | {
160
+ readonly kind: "cancel";
161
+ readonly lifecycle?: "parked" | "terminal";
162
+ readonly usage?: TaskUsage;
163
+ }
164
+ /** Retains a late executor settlement without changing task terminal status. */
165
+ | {
166
+ readonly kind: "settle-executor";
167
+ readonly usage?: TaskUsage;
168
+ } | {
169
+ readonly kind: "require-authorization";
170
+ readonly requestId: string;
171
+ } | {
172
+ readonly kind: "require-input";
173
+ readonly inputRequests: readonly TaskInputRequest[];
174
+ } | {
175
+ readonly kind: "ready";
176
+ }
177
+ /**
178
+ * Clears the listed requests from the outstanding batch. Bound to
179
+ * ids rather than unbound like the former `resume`, so an answer can
180
+ * only ever release the batch it was written against.
181
+ */
182
+ | {
183
+ readonly kind: "answered";
184
+ readonly requestIds: readonly string[];
185
+ } | {
186
+ readonly kind: "start-turn";
187
+ readonly childSessionId: string;
188
+ readonly childTurnId: string;
189
+ readonly taskId: string;
190
+ };
191
+ /** Hook payload envelope commanding a durable task run. */
192
+ export interface TaskCommandHookPayload {
193
+ readonly kind: "task-command";
194
+ readonly command: TaskCommand;
195
+ }
196
+ /**
197
+ * Structural shapes of the child wire payloads a task run consumes.
198
+ *
199
+ * These mirror the existing parent-notification contracts (the local
200
+ * `notifyDelegatedParentStep`, the subagent adapter's HITL forwarding,
201
+ * and the remote callback route) without importing their zod-backed
202
+ * modules: this file is bundled into workflow bodies. The wire itself
203
+ * is unchanged — delegated dispatch only points it at the task run's
204
+ * hook instead of the parent turn's inbox.
205
+ */
206
+ export interface TaskInboundChildResult {
207
+ readonly kind: "runtime-action-result";
208
+ readonly results: readonly {
209
+ readonly isError?: boolean;
210
+ readonly outcome?: {
211
+ readonly kind: "parked" | "terminal";
212
+ readonly result: {
213
+ readonly kind: "succeeded";
214
+ readonly output: JsonValue;
215
+ } | {
216
+ readonly error: JsonValue;
217
+ readonly kind: "failed";
218
+ } | {
219
+ readonly kind: "cancelled";
220
+ };
221
+ /**
222
+ * Provider usage this turn added. Retained on the terminal task
223
+ * view ({@link TaskView.usage}); folding it into parent
224
+ * budgets is deferred until a reservation model lands.
225
+ */
226
+ readonly usageDelta?: unknown;
227
+ };
228
+ readonly output: JsonValue;
229
+ }[];
230
+ }
231
+ /**
232
+ * Arrives when the delegated child emits `input.requested`. After dispatch is
233
+ * acknowledged, the task run exposes the batch in an `input_required`
234
+ * view and forwards the request to the parent session.
235
+ */
236
+ export interface TaskInboundInputRequest {
237
+ readonly callId: string;
238
+ readonly childContinuationToken: string;
239
+ readonly childSessionId: string;
240
+ readonly kind: "subagent-input-request";
241
+ readonly event: {
242
+ readonly requests: readonly TaskInputRequest[];
243
+ readonly sequence: number;
244
+ readonly stepIndex: number;
245
+ readonly turnId: string;
246
+ };
247
+ readonly subagentName: string;
248
+ }
249
+ /**
250
+ * Arrives when a delegated child turn starts and its session and turn ids are
251
+ * known. The task run records those ids for executor addressing; this payload
252
+ * does not itself make the task ready or wake the parent.
253
+ */
254
+ export interface TaskInboundTurnStarted {
255
+ readonly childSessionId: string;
256
+ readonly childTurnId: string;
257
+ readonly kind: "turn-started";
258
+ readonly taskId: string;
259
+ }
260
+ /**
261
+ * Arrives when the delegated child emits `authorization.required` or
262
+ * `authorization.completed`. The former exposes an authorization blocker in
263
+ * the task view; the latter clears it. The event is forwarded separately
264
+ * to the parent and is never copied into the view.
265
+ */
266
+ export interface TaskInboundAuthorizationEvent {
267
+ readonly callId: string;
268
+ readonly childSessionId: string;
269
+ readonly kind: "authorization-event";
270
+ readonly event: SubagentAuthorizationEvent;
271
+ readonly subagentName: string;
272
+ }
273
+ /**
274
+ * Human answers routed to the task run rather than straight to the
275
+ * child. The run owns both the delivery and the state change, so the
276
+ * batch it clears is exactly the batch it forwarded — the parent can no
277
+ * longer unblock the child while the run still believes it is blocked.
278
+ */
279
+ export interface TaskInboundAnswerInput {
280
+ readonly auth?: unknown;
281
+ readonly childContinuationToken: string;
282
+ readonly childResponseUrl?: string;
283
+ readonly inputResponses: readonly TaskInputResponse[];
284
+ readonly kind: "input-response";
285
+ readonly taskId: string;
286
+ }
287
+ /** Everything a task run's inbound continuation hook may receive. */
288
+ export type TaskRunInboundPayload = TaskCommandHookPayload | TaskInboundChildResult | TaskInboundInputRequest | TaskInboundTurnStarted | TaskInboundAuthorizationEvent | TaskInboundAnswerInput;
289
+ /** Namespaced run stream carrying appended `TaskView` records. */
290
+ export declare const TASK_VIEW_STREAM_NAMESPACE = "eve.task";
291
+ /** True when the status can never change again. */
292
+ export declare function isTerminalTaskStatus(status: TaskStatus): boolean;
293
+ /** True when a transition into this status should wake the parent. */
294
+ export declare function isReadyTaskStatus(status: TaskStatus): boolean;
295
+ export {};
@@ -0,0 +1 @@
1
+ function readTaskUsage(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=readUsageAxis(e,`cacheReadTokens`),n=readUsageAxis(e,`cacheWriteTokens`),r=readUsageAxis(e,`inputTokens`),i=readUsageAxis(e,`outputTokens`);if(!(t===void 0||n===void 0||r===void 0||i===void 0))return{cacheReadTokens:t,cacheWriteTokens:n,inputTokens:r,outputTokens:i}}function readUsageAxis(e,t){let n=Reflect.get(e,t);return typeof n==`number`&&Number.isFinite(n)&&n>=0?n:void 0}const TASK_AUTHORIZATION_REQUEST_ID_PREFIX=`task:authorization`;function taskAuthorizationRequestId(t){return t.type===`approval.candidate`||t.type===`approval.settled`?`${TASK_AUTHORIZATION_REQUEST_ID_PREFIX}:${t.data.requestId}`:`${TASK_AUTHORIZATION_REQUEST_ID_PREFIX}:${t.data.attemptId??t.data.name}`}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_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_VIEW_STREAM_NAMESPACE,isReadyTaskStatus,isTerminalTaskStatus,readTaskInputRequestId,readTaskUsage,taskAuthorizationRequestId};
@@ -0,0 +1,26 @@
1
+ import type { TaskCommand, TaskRunInboundPayload } from "#tasks/types.js";
2
+ /**
3
+ * Translates one inbound hook payload into a lifecycle command.
4
+ *
5
+ * The child wire is unchanged by `experimental.tasks`; delegated
6
+ * dispatch hands children the task run's hook token, so the payloads
7
+ * that used to resume the parent turn arrive here instead:
8
+ *
9
+ * - a settled child turn (local notification or remote callback)
10
+ * carries an explicit outcome — its result status decides
11
+ * `complete`, `fail`, or `cancel`;
12
+ * - a forwarded HITL batch marks the task `input_required` with the
13
+ * outstanding requests;
14
+ * - `authorization.required` also blocks the task (the child cannot
15
+ * proceed without the parent's user) under a reserved request id, and
16
+ * `authorization.completed` clears exactly that id. Authorization
17
+ * payloads never enter the view — only the fact that the child is
18
+ * blocked does.
19
+ *
20
+ * `input-response` is deliberately absent: the run must forward the
21
+ * answers to the child before it may record them, so it builds that
22
+ * command itself rather than translating one here.
23
+ *
24
+ * Returns `undefined` for unrecognized payloads, which the run ignores.
25
+ */
26
+ export declare function translateTaskInboundPayload(payload: TaskRunInboundPayload): TaskCommand | undefined;
@@ -0,0 +1 @@
1
+ import{readTaskUsage,taskAuthorizationRequestId}from"#tasks/types.js";function translateTaskInboundPayload(n){switch(n.kind){case`task-command`:return n.command;case`runtime-action-result`:{let t=n.results[0];if(t===void 0)return;if(t.outcome!==void 0){let n=readTaskUsage(t.outcome.usageDelta);switch(t.outcome.result.kind){case`succeeded`:return withUsage({data:t.output,kind:`complete`,lifecycle:t.outcome.kind},n);case`failed`:return withUsage({data:t.output,kind:`fail`,lifecycle:t.outcome.kind},n);case`cancelled`:return withUsage({kind:`cancel`,lifecycle:t.outcome.kind},n)}}return}case`subagent-input-request`:return{inputRequests:n.event.requests,kind:`require-input`};case`turn-started`:return{childSessionId:n.childSessionId,childTurnId:n.childTurnId,kind:`start-turn`,taskId:n.taskId};case`authorization-event`:{let e=taskAuthorizationRequestId(n.event);return n.event.type===`authorization.required`?{kind:`require-authorization`,requestId:e}:{kind:`answered`,requestIds:[e]}}default:return}}function withUsage(e,t){return t===void 0?e:{...e,usage:t}}export{translateTaskInboundPayload};
@@ -1,6 +1,6 @@
1
1
  import { type InstrumentationProviderDefinition } from "#harness/instrumentation/lifecycle.js";
2
2
  import { type InstrumentationRuntime } from "#harness/instrumentation/runtime.js";
3
- import type { CollectedOtel } from "#tracing/otel-declaration.js";
3
+ import type { CollectedOtel, RuntimeContextResolver } from "#tracing/otel-declaration.js";
4
4
  /**
5
5
  * Installs the process instrumentation runtime around a collected pipeline.
6
6
  *
@@ -15,5 +15,6 @@ export declare function installInstrumentationRuntime(input: {
15
15
  readonly collected: CollectedOtel;
16
16
  readonly frameworkVersion: string;
17
17
  readonly providers: readonly InstrumentationProviderDefinition[];
18
+ readonly runtimeContextResolvers?: readonly RuntimeContextResolver[];
18
19
  readonly serviceName: string;
19
20
  }): InstrumentationRuntime;
@@ -1 +1 @@
1
- import{createLogger,formatError}from"#internal/logging.js";import{ContextAgentTraceStateStore}from"#tracing/agent-trace-context-store.js";import{registerInstrumentationRuntime}from"#harness/instrumentation/runtime.js";import{trace}from"#compiled/@opentelemetry/api/index.js";import{createInstrumentationHooks}from"#harness/instrumentation/lifecycle.js";import{hasSessionRelease}from"#tracing/local-traces.js";import{createAgentOtelInstrumentation}from"#tracing/agent-otel-provider.js";import{registerOtelPipeline}from"#tracing/otel-registration.js";const log=createLogger(`tracing.install-instrumentation-runtime`);function installInstrumentationRuntime(e){let t=[],a=[],o,s,c,runInContext=(e,t)=>t();if(e.collected.declared){o=registerOtelPipeline({pipeline:e.collected.pipeline,serviceName:e.serviceName});let r=createAgentOtelInstrumentation({frameworkVersion:e.frameworkVersion,idGenerator:o.idGenerator,recordInputs:e.collected.settings.recordInputs,recordOutputs:e.collected.settings.recordOutputs,stateStore:new ContextAgentTraceStateStore,tracer:trace.getTracer(`eve.agent`,e.frameworkVersion)});t.push({...r.hook,stateNamespace:`internal:otel`}),s=r.prepareSessionTrace,c=r.prepareTurnTrace,runInContext=r.runInContext;let i=e.collected.pipeline.spanProcessors.filter(isSpanProcessor).filter(hasSessionRelease);i.length>0&&a.push(sessionReleaseProvider(i))}let l=[...t,...e.providers,...a],u;return registerInstrumentationRuntime({forceFlush:()=>settleAll([...o===void 0?[]:[o.forceFlush],...l.map(e=>()=>e.flush?.())]),hooks:createInstrumentationHooks({parallel:e.providers,serialAfter:a,serialBefore:t}),otelSettings:e.collected.declared?e.collected.settings:void 0,prepareSessionTrace:s,prepareTurnTrace:c,runInContext,shutdown:()=>(u??=settleAll([...o===void 0?[]:[o.shutdown],...l.map(e=>()=>e.shutdown?.())]),u)})}function isSpanProcessor(e){return e!==`auto`}function sessionReleaseProvider(e){let release=async t=>{await Promise.all(e.map(e=>e.releaseSession(t.sessionId)))};return{events:{"session.completed":release,"session.failed":release},name:`eve.session-release`,stateNamespace:`internal:session-release`}}async function settleAll(e){let n=await Promise.allSettled(e.map(async e=>e()));for(let e of n)e.status===`rejected`&&log.warn(`instrumentation drain failed`,{error:formatError(e.reason)})}export{installInstrumentationRuntime};
1
+ import{createLogger,formatError}from"#internal/logging.js";import{ContextAgentTraceStateStore}from"#tracing/agent-trace-context-store.js";import{registerInstrumentationRuntime}from"#harness/instrumentation/runtime.js";import{trace}from"#compiled/@opentelemetry/api/index.js";import{createInstrumentationHooks}from"#harness/instrumentation/lifecycle.js";import{hasSessionRelease}from"#tracing/local-traces.js";import{createAgentOtelInstrumentation}from"#tracing/agent-otel-provider.js";import{registerOtelPipeline}from"#tracing/otel-registration.js";const log=createLogger(`tracing.install-instrumentation-runtime`);function installInstrumentationRuntime(e){let t=[],a=[],o,s,c,runInContext=(e,t)=>t();if(e.collected.declared){o=registerOtelPipeline({pipeline:e.collected.pipeline,serviceName:e.serviceName});let r=createAgentOtelInstrumentation({frameworkVersion:e.frameworkVersion,idGenerator:o.idGenerator,recordInputs:e.collected.settings.recordInputs,recordOutputs:e.collected.settings.recordOutputs,stateStore:new ContextAgentTraceStateStore,tracer:trace.getTracer(`eve.agent`,e.frameworkVersion)});t.push({...r.hook,stateNamespace:`internal:otel`}),s=r.prepareSessionTrace,c=r.prepareTurnTrace,runInContext=r.runInContext;let i=e.collected.pipeline.spanProcessors.filter(isSpanProcessor).filter(hasSessionRelease);i.length>0&&a.push(sessionReleaseProvider(i))}let l=[...t,...e.providers,...a],u;return registerInstrumentationRuntime({forceFlush:()=>settleAll([...o===void 0?[]:[o.forceFlush],...l.map(e=>()=>e.flush?.())]),hooks:createInstrumentationHooks({parallel:e.providers,serialAfter:a,serialBefore:t}),otelSettings:e.collected.declared?e.collected.settings:void 0,prepareSessionTrace:s,prepareTurnTrace:c,runtimeContextResolvers:e.runtimeContextResolvers,runInContext,shutdown:()=>(u??=settleAll([...o===void 0?[]:[o.shutdown],...l.map(e=>()=>e.shutdown?.())]),u)})}function isSpanProcessor(e){return e!==`auto`}function sessionReleaseProvider(e){let release=async t=>{await Promise.all(e.map(e=>e.releaseSession(t.sessionId)))};return{events:{"session.completed":release,"session.failed":release},name:`eve.session-release`,stateNamespace:`internal:session-release`}}async function settleAll(e){let n=await Promise.allSettled(e.map(async e=>e()));for(let e of n)e.status===`rejected`&&log.warn(`instrumentation drain failed`,{error:formatError(e.reason)})}export{installInstrumentationRuntime};
@@ -1,5 +1,7 @@
1
1
  import type { PropagatorOrName, SamplerOrName, SpanExporter, SpanProcessor, SpanProcessorOrName } from "#compiled/@vercel/otel/index.js";
2
2
  import { type InstrumentationProvider } from "#public/instrumentation/provider.js";
3
+ import type { InstrumentationRuntimeContextInput } from "#public/instrumentation/index.js";
4
+ import type { JsonObject } from "#shared/json.js";
3
5
  import type { ResolvedContentOptions } from "#tracing/content-attributes.js";
4
6
  /**
5
7
  * The process-wide OpenTelemetry settings, declared by `otel()`.
@@ -8,9 +10,11 @@ import type { ResolvedContentOptions } from "#tracing/content-attributes.js";
8
10
  * one tracer provider, so it has one resource, one sampler, and one propagator
9
11
  * set. Destinations are the plural half and live in `otelIntegration()`.
10
12
  *
11
- * `contextManager` and `instrumentations` are deliberately absent: eve's span
12
- * nesting depends on the former, and the latter cannot reach anything eve
13
- * imported before setup ran.
13
+ * `contextManager` is deliberately absent: eve's span nesting depends on it.
14
+ * `instrumentations` is accepted so providers can opt into Node auto-
15
+ * instrumentations (e.g. `@opentelemetry/auto-instrumentations-node`); the
16
+ * packages patch modules eve already imported, so their effects are limited
17
+ * to code loaded after registration.
14
18
  */
15
19
  export interface OtelOptions {
16
20
  /**
@@ -38,6 +42,15 @@ export interface OtelOptions {
38
42
  readonly sampler?: SamplerOrName;
39
43
  /** Composed into one propagator. All inject; the first to extract wins. */
40
44
  readonly propagators?: readonly PropagatorOrName[];
45
+ /**
46
+ * OpenTelemetry `Instrumentation` instances passed through to
47
+ * `registerOTel`. Use them to patch Node.js built-ins (HTTP, DNS, fs, etc.)
48
+ * for automatic spans around outbound work. Disabled by default because eve
49
+ * already imports the model SDK before registration, so patching cannot
50
+ * reach it — but code loaded after registration (tool modules, connection
51
+ * clients) will be instrumented.
52
+ */
53
+ readonly instrumentations?: readonly unknown[];
41
54
  }
42
55
  /**
43
56
  * What one destination records of the conversation itself.
@@ -60,6 +73,17 @@ export interface OtelIntegrationOptions extends ContentOptions {
60
73
  readonly spanProcessors?: readonly SpanProcessor[];
61
74
  /** Wrapped in eve's batching processor and appended after `spanProcessors`. */
62
75
  readonly traceExporter?: SpanExporter;
76
+ /**
77
+ * Contributes runtime context that the AI SDK merges into telemetry spans
78
+ * for each model call. Child spans inherit the values, so a destination can
79
+ * stamp channel or auth identity onto every span in the turn.
80
+ *
81
+ * Synchronous: the harness collects from every destination before the model
82
+ * call, so a return that is not a plain object is dropped (warning-only).
83
+ * Keys beginning with `eve.` are reserved and dropped. Return `undefined`
84
+ * to contribute nothing.
85
+ */
86
+ readonly runtimeContext?: (input: InstrumentationRuntimeContextInput) => JsonObject | undefined;
63
87
  }
64
88
  declare const OTEL_DECLARATION: unique symbol;
65
89
  declare const OTEL_INTEGRATION: unique symbol;
@@ -76,6 +100,7 @@ export interface OtelIntegration extends InstrumentationProvider {
76
100
  readonly [OTEL_INTEGRATION]: true;
77
101
  /** Resolved from `ContentOptions`, so the union does not re-apply defaults. */
78
102
  readonly content: ResolvedContentOptions;
103
+ readonly runtimeContext?: (input: InstrumentationRuntimeContextInput) => JsonObject | undefined;
79
104
  readonly spanProcessors: readonly SpanProcessorOrName[];
80
105
  }
81
106
  /**
@@ -105,6 +130,7 @@ export declare function isOtelDeclaration(value: unknown): value is OtelDeclarat
105
130
  export declare function isOtelIntegration(value: unknown): value is OtelIntegration;
106
131
  /** The one pipeline a process can register. @internal */
107
132
  export interface OtelPipeline {
133
+ readonly instrumentations?: readonly unknown[];
108
134
  readonly propagators?: readonly PropagatorOrName[];
109
135
  readonly resource?: Readonly<Record<string, unknown>>;
110
136
  readonly sampler?: SamplerOrName;
@@ -123,6 +149,8 @@ export interface OtelHarnessSettings {
123
149
  readonly recordOutputs?: boolean;
124
150
  }
125
151
  /** @internal */
152
+ export type RuntimeContextResolver = (input: InstrumentationRuntimeContextInput) => JsonObject | undefined;
153
+ /** @internal */
126
154
  export interface CollectedOtel {
127
155
  /**
128
156
  * Whether anything declared OpenTelemetry. False means eve should leave the
@@ -130,6 +158,7 @@ export interface CollectedOtel {
130
158
  */
131
159
  readonly declared: boolean;
132
160
  readonly pipeline: OtelPipeline;
161
+ readonly runtimeContextResolvers: readonly RuntimeContextResolver[];
133
162
  readonly settings: OtelHarnessSettings;
134
163
  }
135
164
  /**
@@ -1 +1 @@
1
- import{PROVIDER}from"#public/instrumentation/provider.js";import{batchSpanProcessor}from"#tracing/batch-span-processor.js";import{contentFilteringProcessor}from"#tracing/content-span-processor.js";import{vercelRuntimeSpanProcessor}from"#tracing/vercel-runtime-span-exporter.js";const OTEL_DECLARATION=Symbol.for(`eve.instrumentation.otel`),OTEL_INTEGRATION=Symbol.for(`eve.instrumentation.otel-integration`);function otel(t={}){return{[OTEL_DECLARATION]:!0,[PROVIDER]:!0,options:t}}function otelIntegration(r={}){let i={recordInputs:r.recordInputs===!0,recordOutputs:r.recordOutputs===!0},o=r.spanProcessors??[],s=r.traceExporter===void 0?o:[...o,batchSpanProcessor(r.traceExporter)];return{[OTEL_INTEGRATION]:!0,[PROVIDER]:!0,content:i,spanProcessors:i.recordInputs&&i.recordOutputs?s:s.map(e=>contentFilteringProcessor(e,i))}}function agentRunsIntegration(t={}){let i=resolveContentOptions(t);return{[OTEL_INTEGRATION]:!0,[PROVIDER]:!0,content:i,spanProcessors:i.recordInputs&&i.recordOutputs?[`auto`]:[contentFilteringProcessor(vercelRuntimeSpanProcessor(),i)]}}function resolveContentOptions(e){return{recordInputs:e.recordInputs===!0,recordOutputs:e.recordOutputs===!0}}function isOtelDeclaration(e){return typeof e==`object`&&!!e&&e[OTEL_DECLARATION]===!0}function isOtelIntegration(e){return typeof e==`object`&&!!e&&e[OTEL_INTEGRATION]===!0}function collectOtelPipeline(e){let t=[],n,r=!1,i=!1,a=!1;for(let o of e){if(isOtelIntegration(o)){r=!0,i||=o.content.recordInputs,a||=o.content.recordOutputs,t.push(...o.spanProcessors);continue}if(isOtelDeclaration(o)){if(n!==void 0)throw Error("Instrumentation declares `otel()` more than once. One process has one OpenTelemetry tracer provider, so it has one resource, one sampler, and one propagator set — declare them in a single `otel()`.");r=!0,n=o}}let o=n?.options??{};return{declared:r,pipeline:{propagators:o.propagators,resource:o.resource,sampler:o.sampler,spanProcessors:t},settings:{functionId:o.functionId,recordInputs:i,recordOutputs:a,traceChannelRequests:o.traceChannelRequests===!0}}}export{agentRunsIntegration,collectOtelPipeline,isOtelDeclaration,isOtelIntegration,otel,otelIntegration,resolveContentOptions};
1
+ import{PROVIDER}from"#public/instrumentation/provider.js";import{batchSpanProcessor}from"#tracing/batch-span-processor.js";import{contentFilteringProcessor}from"#tracing/content-span-processor.js";import{vercelRuntimeSpanProcessor}from"#tracing/vercel-runtime-span-exporter.js";const OTEL_DECLARATION=Symbol.for(`eve.instrumentation.otel`),OTEL_INTEGRATION=Symbol.for(`eve.instrumentation.otel-integration`);function otel(t={}){return{[OTEL_DECLARATION]:!0,[PROVIDER]:!0,options:t}}function otelIntegration(r={}){let i={recordInputs:r.recordInputs===!0,recordOutputs:r.recordOutputs===!0},o=r.spanProcessors??[],s=r.traceExporter===void 0?o:[...o,batchSpanProcessor(r.traceExporter)];return{[OTEL_INTEGRATION]:!0,[PROVIDER]:!0,content:i,runtimeContext:r.runtimeContext,spanProcessors:i.recordInputs&&i.recordOutputs?s:s.map(e=>contentFilteringProcessor(e,i))}}function agentRunsIntegration(t={}){let i=resolveContentOptions(t);return{[OTEL_INTEGRATION]:!0,[PROVIDER]:!0,content:i,spanProcessors:i.recordInputs&&i.recordOutputs?[`auto`]:[contentFilteringProcessor(vercelRuntimeSpanProcessor(),i)]}}function resolveContentOptions(e){return{recordInputs:e.recordInputs===!0,recordOutputs:e.recordOutputs===!0}}function isOtelDeclaration(e){return typeof e==`object`&&!!e&&e[OTEL_DECLARATION]===!0}function isOtelIntegration(e){return typeof e==`object`&&!!e&&e[OTEL_INTEGRATION]===!0}function collectOtelPipeline(e){let t=[],n=[],r,i=!1,a=!1,o=!1;for(let s of e){if(isOtelIntegration(s)){i=!0,a||=s.content.recordInputs,o||=s.content.recordOutputs,t.push(...s.spanProcessors),s.runtimeContext!==void 0&&n.push(s.runtimeContext);continue}if(isOtelDeclaration(s)){if(r!==void 0)throw Error("Instrumentation declares `otel()` more than once. One process has one OpenTelemetry tracer provider, so it has one resource, one sampler, and one propagator set — declare them in a single `otel()`.");i=!0,r=s}}let s=r?.options??{};return{declared:i,pipeline:{instrumentations:s.instrumentations,propagators:s.propagators,resource:s.resource,sampler:s.sampler,spanProcessors:t},runtimeContextResolvers:n,settings:{functionId:s.functionId,recordInputs:a,recordOutputs:o,traceChannelRequests:s.traceChannelRequests===!0}}}export{agentRunsIntegration,collectOtelPipeline,isOtelDeclaration,isOtelIntegration,otel,otelIntegration,resolveContentOptions};
@@ -1 +1 @@
1
- import{context,propagation,trace}from"#compiled/@opentelemetry/api/index.js";import{registerOTel}from"#compiled/@vercel/otel/index.js";import{AgentSpanIdGenerator}from"#tracing/agent-span-id-generator.js";const REGISTRATION_SPAN_NAME=`eve.otel.registration`,REPLAY_DEDUPLICATION_LIMIT=1e5;var RegistrationMarkerPropagator=class{#e=!1;extract(e){return e}fields(){return[]}inject(){this.#e=!0}isInstalled(){return this.#e=!1,propagation.inject(context.active(),{},{set:()=>{}}),this.#e}},PrivateSpanFilteringProcessor=class{endedSpans=new Set;forwardedSpans=new Set;pendingByParent=new Map;processors;startedSpans=new Set;constructor(e){this.processors=e}async forceFlush(){await Promise.all(this.processors.map(e=>e.forceFlush()))}onEnd(e){if(isRegistrationSpan(e))return;let t=spanIdentity(e);if(t!==void 0){if(this.endedSpans.has(t))return;if(this.endedSpans.size>=REPLAY_DEDUPLICATION_LIMIT){let e=this.endedSpans.values().next().value;e!==void 0&&this.endedSpans.delete(e)}this.endedSpans.add(t)}let n=parentIdentity(e);if(n!==void 0&&this.startedSpans.has(n)&&!this.forwardedSpans.has(n)){let t=this.pendingByParent.get(n)??[];t.push(e),this.pendingByParent.set(n,t);return}this.forward(e,t)}onStart(e,t){if(isRegistrationSpan(e))return;let n=spanIdentity(e);n!==void 0&&addBounded(this.startedSpans,n);for(let n of this.processors)n.onStart(e,t)}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}forward(e,t){for(let t of this.processors)t.onEnd(e);if(t===void 0)return;addBounded(this.forwardedSpans,t);let n=this.pendingByParent.get(t);if(n!==void 0){this.pendingByParent.delete(t);for(let e of n)this.forward(e,spanIdentity(e))}}};function registerOtelPipeline(e){let{pipeline:t}=e,n=new AgentSpanIdGenerator,i=new RegistrationMarkerPropagator,a={attributes:t.resource,autoDetectResources:!1,idGenerator:n,instrumentations:[],propagators:[...t.propagators??[`none`],i],serviceName:e.serviceName,spanProcessors:t.spanProcessors.map(e=>isSpanProcessor(e)?new PrivateSpanFilteringProcessor([e]):e)};registerOTel(t.sampler===void 0?a:{...a,traceSampler:t.sampler});let o=globalTracerUses(n),s=i.isInstalled();if((!o||!s)&&rollbackRegistration({ownsPropagator:s,ownsTracer:o}),!o)throw Error("eve could not register OpenTelemetry because another runtime already owns the global tracer provider. Remove the other `registerOTel` call, or move its exporters into eve's `otelIntegration({ spanProcessors: [...] })`.");if(!s)throw Error("eve could not register OpenTelemetry because another runtime already owns the global propagator. Remove the other global propagator registration and declare propagators through eve's `otel()` instead.");let c=runtimeTracerProvider();if(typeof c.forceFlush!=`function`||typeof c.shutdown!=`function`)throw rollbackRegistration({ownsPropagator:s,ownsTracer:o}),Error(`The registered OpenTelemetry tracer provider has no lifecycle methods.`);return{forceFlush:()=>c.forceFlush(),idGenerator:n,shutdown:()=>c.shutdown()}}function rollbackRegistration(e){if(e.ownsPropagator&&propagation.disable(),!e.ownsTracer)return;let r=runtimeTracerProvider();if(typeof r.shutdown==`function`)try{r.shutdown().catch(()=>{})}catch{}trace.disable()}function runtimeTracerProvider(){let e=trace.getTracerProvider();return e.getDelegate?.()??e}function globalTracerUses(e){let t=e.allocateSpanId();return e.withSpanId(t,()=>trace.getTracer(`eve.registration`).startSpan(REGISTRATION_SPAN_NAME)).spanContext().spanId===t}function isRegistrationSpan(e){return typeof e==`object`&&!!e&&`name`in e&&e.name===REGISTRATION_SPAN_NAME}function spanIdentity(e){if(typeof e!=`object`||!e||!(`spanContext`in e)||typeof e.spanContext!=`function`)return;let t=e.spanContext();return typeof t.traceId==`string`&&typeof t.spanId==`string`?`${t.traceId}:${t.spanId}`:void 0}function parentIdentity(e){if(typeof e!=`object`||!e||!(`parentSpanContext`in e))return;let t=e.parentSpanContext;return typeof t?.traceId==`string`&&typeof t.spanId==`string`?`${t.traceId}:${t.spanId}`:void 0}function addBounded(e,t){if(e.size>=REPLAY_DEDUPLICATION_LIMIT){let t=e.values().next().value;t!==void 0&&e.delete(t)}e.add(t)}function isSpanProcessor(e){return e!==`auto`}export{registerOtelPipeline};
1
+ import{createRequire}from"node:module";import{context,propagation,trace}from"#compiled/@opentelemetry/api/index.js";import{registerOTel}from"#compiled/@vercel/otel/index.js";import{AgentSpanIdGenerator}from"#tracing/agent-span-id-generator.js";const REGISTRATION_SPAN_NAME=`eve.otel.registration`,REPLAY_DEDUPLICATION_LIMIT=1e5,require=createRequire(import.meta.url);var RegistrationMarkerPropagator=class{#e=!1;extract(e){return e}fields(){return[]}inject(){this.#e=!0}isInstalled(){return this.#e=!1,propagation.inject(context.active(),{},{set:()=>{}}),this.#e}},PrivateSpanFilteringProcessor=class{endedSpans=new Set;forwardedSpans=new Set;pendingByParent=new Map;processors;startedSpans=new Set;constructor(e){this.processors=e}async forceFlush(){await Promise.all(this.processors.map(e=>e.forceFlush()))}onEnd(e){if(isRegistrationSpan(e))return;let t=spanIdentity(e);if(t!==void 0){if(this.endedSpans.has(t))return;if(this.endedSpans.size>=REPLAY_DEDUPLICATION_LIMIT){let e=this.endedSpans.values().next().value;e!==void 0&&this.endedSpans.delete(e)}this.endedSpans.add(t)}let n=parentIdentity(e);if(n!==void 0&&this.startedSpans.has(n)&&!this.forwardedSpans.has(n)){let t=this.pendingByParent.get(n)??[];t.push(e),this.pendingByParent.set(n,t);return}this.forward(e,t)}onStart(e,t){if(isRegistrationSpan(e))return;let n=spanIdentity(e);n!==void 0&&addBounded(this.startedSpans,n);for(let n of this.processors)n.onStart(e,t)}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}forward(e,t){for(let t of this.processors)t.onEnd(e);if(t===void 0)return;addBounded(this.forwardedSpans,t);let n=this.pendingByParent.get(t);if(n!==void 0){this.pendingByParent.delete(t);for(let e of n)this.forward(e,spanIdentity(e))}}};function registerOtelPipeline(e){let{pipeline:t}=e,n=captureOptionalPeerTracerProxy(),r=new AgentSpanIdGenerator,i=new RegistrationMarkerPropagator,a={attributes:t.resource,autoDetectResources:!1,idGenerator:r,instrumentations:t.instrumentations??[],propagators:[...t.propagators??[`none`],i],serviceName:e.serviceName,spanProcessors:t.spanProcessors.map(e=>isSpanProcessor(e)?new PrivateSpanFilteringProcessor([e]):e)};registerOTel(t.sampler===void 0?a:{...a,traceSampler:t.sampler});let o=globalTracerUses(r),s=i.isInstalled();if((!o||!s)&&rollbackRegistration({ownsPropagator:s,ownsTracer:o}),!o)throw Error("eve could not register OpenTelemetry because another runtime already owns the global tracer provider. Remove the other `registerOTel` call, or move its exporters into eve's `otelIntegration({ spanProcessors: [...] })`.");if(!s)throw Error("eve could not register OpenTelemetry because another runtime already owns the global propagator. Remove the other global propagator registration and declare propagators through eve's `otel()` instead.");let c=runtimeTracerProvider();if(typeof c.forceFlush!=`function`||typeof c.shutdown!=`function`)throw rollbackRegistration({ownsPropagator:s,ownsTracer:o}),Error(`The registered OpenTelemetry tracer provider has no lifecycle methods.`);return n?.setDelegate(c),{forceFlush:()=>c.forceFlush(),idGenerator:r,shutdown:()=>c.shutdown()}}function captureOptionalPeerTracerProxy(){try{let e=require("@opentelemetry/api"),t=e.trace.getTracerProvider();return t instanceof e.ProxyTracerProvider?t:void 0}catch{return}}function rollbackRegistration(e){if(e.ownsPropagator&&propagation.disable(),!e.ownsTracer)return;let t=runtimeTracerProvider();if(typeof t.shutdown==`function`)try{t.shutdown().catch(()=>{})}catch{}trace.disable()}function runtimeTracerProvider(){let e=trace.getTracerProvider();return e.getDelegate?.()??e}function globalTracerUses(e){let t=e.allocateSpanId();return e.withSpanId(t,()=>trace.getTracer(`eve.registration`).startSpan(REGISTRATION_SPAN_NAME)).spanContext().spanId===t}function isRegistrationSpan(e){return typeof e==`object`&&!!e&&`name`in e&&e.name===REGISTRATION_SPAN_NAME}function spanIdentity(e){if(typeof e!=`object`||!e||!(`spanContext`in e)||typeof e.spanContext!=`function`)return;let t=e.spanContext();return typeof t.traceId==`string`&&typeof t.spanId==`string`?`${t.traceId}:${t.spanId}`:void 0}function parentIdentity(e){if(typeof e!=`object`||!e||!(`parentSpanContext`in e))return;let t=e.parentSpanContext;return typeof t?.traceId==`string`&&typeof t.spanId==`string`?`${t.traceId}:${t.spanId}`:void 0}function addBounded(e,t){if(e.size>=REPLAY_DEDUPLICATION_LIMIT){let t=e.values().next().value;t!==void 0&&e.delete(t)}e.add(t)}function isSpanProcessor(e){return e!==`auto`}export{registerOtelPipeline};
@@ -1,3 +1,3 @@
1
- import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-CnppTEFk.js";
1
+ import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-Dt8Y5QtW.js";
2
2
 
3
3
  export { defaultMessageReducer, useEveAgent };
@@ -5,7 +5,7 @@ import type { EveAgentReducer } from "#client/reducer.js";
5
5
  import type { ClientSession } from "#client/session.js";
6
6
  import { type EveMessageData } from "#client/message-reducer.js";
7
7
  import type { MessageStreamEvent } from "#protocol/message.js";
8
- import type { ClientAuth, HeadersValue, RespondTurnOptions, SendTurnOptions, ClientSessionState } from "#client/types.js";
8
+ import type { CancelSessionResult, ClientAuth, HeadersValue, RespondTurnOptions, SendTurnOptions, ClientSessionState } from "#client/types.js";
9
9
  export type { PrepareSend };
10
10
  /**
11
11
  * Lifecycle phase of a `useEveAgent` session: `"ready"` (idle), `"submitted"`
@@ -25,6 +25,8 @@ export type UseEveAgentSnapshot<TData> = EveAgentStoreSnapshot<TData>;
25
25
  * Reactive return value from `useEveAgent`.
26
26
  */
27
27
  export interface UseEveAgentReturn<TData> {
28
+ /** Request durable cancellation of the active turn while continuing to receive its events. */
29
+ readonly cancel: () => Promise<CancelSessionResult>;
28
30
  /** Projected state: the reducer folds every stream event into this value. */
29
31
  readonly data: ComputedRef<TData>;
30
32
  /** Last transport-level error, or `undefined` when healthy. */
@@ -41,8 +43,6 @@ export interface UseEveAgentReturn<TData> {
41
43
  readonly session: ComputedRef<ClientSessionState | undefined>;
42
44
  /** Lifecycle phase: `"ready"` (idle), `"submitted"` (request sent, awaiting first event), `"streaming"` (events arriving), or `"error"`. */
43
45
  readonly status: ComputedRef<UseEveAgentStatus>;
44
- /** Abort the in-flight request. */
45
- readonly stop: () => void;
46
46
  }
47
47
  /**
48
48
  * Configuration for creating or binding a Vue eve agent session.