eve 0.66.3 → 0.67.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 (287) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/src/channel/channel-address.d.ts +0 -2
  3. package/dist/src/channel/channel-address.js +1 -1
  4. package/dist/src/channel/channel-operations.d.ts +0 -5
  5. package/dist/src/channel/channel-operations.js +1 -1
  6. package/dist/src/channel/compiled-channel.d.ts +8 -0
  7. package/dist/src/channel/compiled-channel.js +2 -2
  8. package/dist/src/channel/conversation-context.js +1 -1
  9. package/dist/src/channel/routes.d.ts +1 -2
  10. package/dist/src/channel/schedule.d.ts +2 -2
  11. package/dist/src/channel/schedule.js +1 -1
  12. package/dist/src/channel/types.d.ts +8 -13
  13. package/dist/src/chunks/{use-eve-agent-PbSMyJ6e.js → use-eve-agent-DzdyI97Z.js} +0 -5
  14. package/dist/src/chunks/{use-eve-agent-Di1u2zKu.js → use-eve-agent-OCHP4s0z.js} +0 -5
  15. package/dist/src/cli/acp/command.js +3 -3
  16. package/dist/src/cli/commands/logs.d.ts +3 -3
  17. package/dist/src/cli/commands/logs.js +1 -1
  18. package/dist/src/cli/commands/register-integration-commands.js +1 -1
  19. package/dist/src/cli/commands/trace.js +1 -1
  20. package/dist/src/cli/dev/command.d.ts +9 -5
  21. package/dist/src/cli/dev/command.js +1 -3
  22. package/dist/src/cli/dev/run-interactive-ui.d.ts +0 -1
  23. package/dist/src/cli/dev/run-interactive-ui.js +1 -1
  24. package/dist/src/cli/dev/tui/blocks.js +1 -1
  25. package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
  26. package/dist/src/cli/dev/tui/question-panel.d.ts +4 -4
  27. package/dist/src/cli/dev/tui/question-panel.js +1 -1
  28. package/dist/src/cli/dev/tui/runner.js +2 -2
  29. package/dist/src/cli/dev/tui/terminal-renderer.js +8 -9
  30. package/dist/src/cli/dev/tui/theme.d.ts +1 -1
  31. package/dist/src/cli/dev/url-target.js +1 -1
  32. package/dist/src/cli/invoke/command.d.ts +2 -5
  33. package/dist/src/cli/invoke/command.js +1 -1
  34. package/dist/src/cli/invoke/invoke.d.ts +2 -2
  35. package/dist/src/cli/invoke/invoke.js +1 -1
  36. package/dist/src/cli/invoke/result.d.ts +14 -194
  37. package/dist/src/cli/invoke/result.js +1 -1
  38. package/dist/src/cli/run.d.ts +0 -4
  39. package/dist/src/cli/run.js +2 -2
  40. package/dist/src/cli/telemetry/index.js +1 -1
  41. package/dist/src/client/message-reducer.js +1 -1
  42. package/dist/src/compiled/.vendor-stamp.json +1 -1
  43. package/dist/src/compiler/compile-from-memory.d.ts +0 -1
  44. package/dist/src/compiler/compile-from-memory.js +1 -1
  45. package/dist/src/compiler/extension-compatibility.d.ts +25 -18
  46. package/dist/src/compiler/extension-compatibility.js +1 -1
  47. package/dist/src/compiler/manifest.d.ts +48 -14
  48. package/dist/src/compiler/manifest.js +1 -1
  49. package/dist/src/compiler/normalize-agent-config.js +1 -1
  50. package/dist/src/compiler/normalize-channel.js +1 -1
  51. package/dist/src/compiler/normalize-connection.js +1 -1
  52. package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
  53. package/dist/src/compiler/normalize-subagent.d.ts +0 -2
  54. package/dist/src/compiler/normalize-subagent.js +1 -1
  55. package/dist/src/compiler/remote-agent-node.d.ts +0 -2
  56. package/dist/src/compiler/remote-agent-node.js +1 -1
  57. package/dist/src/compiler/workspace-resources.js +1 -1
  58. package/dist/src/context/dynamic-subagent-lifecycle.js +1 -1
  59. package/dist/src/context/keys.d.ts +0 -3
  60. package/dist/src/context/keys.js +1 -1
  61. package/dist/src/context/memory-lifecycle.d.ts +1 -0
  62. package/dist/src/context/memory-lifecycle.js +1 -1
  63. package/dist/src/discover/project.js +1 -1
  64. package/dist/src/eve-channel/create-request.d.ts +0 -3
  65. package/dist/src/eve-channel/create-request.js +1 -1
  66. package/dist/src/eve-channel/index.js +1 -1
  67. package/dist/src/eve-channel/request.js +1 -1
  68. package/dist/src/eve-channel/types.d.ts +1 -1
  69. package/dist/src/execution/delegated-session-context.d.ts +2 -0
  70. package/dist/src/execution/delegated-session-context.js +1 -0
  71. package/dist/src/execution/dynamic-connections.d.ts +4 -1
  72. package/dist/src/execution/dynamic-connections.js +1 -1
  73. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  74. package/dist/src/execution/effective-agent-config.js +1 -1
  75. package/dist/src/execution/legacy-session/input.d.ts +0 -2
  76. package/dist/src/execution/legacy-session/input.js +1 -1
  77. package/dist/src/execution/legacy-session/prepare-step.d.ts +0 -1
  78. package/dist/src/execution/legacy-session/turn-workflow.js +1 -1
  79. package/dist/src/execution/node-step.d.ts +4 -2
  80. package/dist/src/execution/node-step.js +1 -1
  81. package/dist/src/execution/proxied-deliver-step.js +1 -1
  82. package/dist/src/execution/publish-channel-event.d.ts +23 -0
  83. package/dist/src/execution/publish-channel-event.js +1 -0
  84. package/dist/src/execution/runtime-context.js +1 -1
  85. package/dist/src/execution/session/entry.js +1 -1
  86. package/dist/src/execution/session/event-sink.d.ts +1 -1
  87. package/dist/src/execution/session/event-sink.js +1 -1
  88. package/dist/src/execution/session/finalization.d.ts +1 -4
  89. package/dist/src/execution/session/finalization.js +1 -1
  90. package/dist/src/execution/session/handoff.d.ts +1 -3
  91. package/dist/src/execution/session/handoff.js +1 -1
  92. package/dist/src/execution/session/input-queue.d.ts +0 -1
  93. package/dist/src/execution/session/input-queue.js +1 -1
  94. package/dist/src/execution/session/next-input.d.ts +0 -1
  95. package/dist/src/execution/session/next-input.js +1 -1
  96. package/dist/src/execution/session/program.d.ts +0 -3
  97. package/dist/src/execution/session/program.js +1 -1
  98. package/dist/src/execution/session/turn-step-result.d.ts +1 -2
  99. package/dist/src/execution/session/turn-step-result.js +1 -1
  100. package/dist/src/execution/session/turn-step.js +1 -1
  101. package/dist/src/execution/session/turn.d.ts +2 -2
  102. package/dist/src/execution/session/turn.js +1 -1
  103. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  104. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
  105. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  106. package/dist/src/execution/tools/agent-router.d.ts +0 -2
  107. package/dist/src/execution/tools/agent-router.js +1 -1
  108. package/dist/src/execution/tools/ask-question-workflow.js +1 -1
  109. package/dist/src/execution/tools/connection-search.d.ts +1 -0
  110. package/dist/src/execution/tools/connection-search.js +1 -1
  111. package/dist/src/execution/tools/sleep-workflow.js +1 -1
  112. package/dist/src/execution/tools/subagent/invoke-preparation.js +1 -1
  113. package/dist/src/extensions/code/extension/lib/connect-authentication.js +1 -1
  114. package/dist/src/extensions/code/extension/lib/github-shell.js +1 -1
  115. package/dist/src/extensions/code/extension/lib/prwatch-github.js +1 -1
  116. package/dist/src/framework/sources/registry.js +1 -1
  117. package/dist/src/harness/approval-delivery-coordinator.d.ts +3 -13
  118. package/dist/src/harness/approval-delivery-coordinator.js +1 -1
  119. package/dist/src/harness/emission.d.ts +2 -3
  120. package/dist/src/harness/emission.js +1 -1
  121. package/dist/src/harness/input-request-resolution.d.ts +2 -0
  122. package/dist/src/harness/input-request-resolution.js +1 -1
  123. package/dist/src/harness/input-requests.d.ts +3 -3
  124. package/dist/src/harness/input-requests.js +1 -1
  125. package/dist/src/harness/pending-input-batches.d.ts +3 -3
  126. package/dist/src/harness/pending-input-batches.js +1 -1
  127. package/dist/src/harness/proxy-input-requests.d.ts +2 -0
  128. package/dist/src/harness/proxy-input-requests.js +1 -1
  129. package/dist/src/harness/session-limit-enforcement.d.ts +2 -3
  130. package/dist/src/harness/session-limit-enforcement.js +1 -1
  131. package/dist/src/harness/tool-loop.js +2 -2
  132. package/dist/src/harness/tools.js +1 -1
  133. package/dist/src/harness/types.d.ts +11 -13
  134. package/dist/src/instrumentation/session-context.js +1 -1
  135. package/dist/src/instrumentation/session-init.js +1 -1
  136. package/dist/src/internal/application/package.js +1 -1
  137. package/dist/src/internal/authored-definition/core.js +1 -1
  138. package/dist/src/internal/authored-module-loader.js +1 -2
  139. package/dist/src/internal/authored-package-boundary.d.ts +0 -1
  140. package/dist/src/internal/authored-package-boundary.js +1 -1
  141. package/dist/src/internal/authored-relative-extension-resolver.js +1 -1
  142. package/dist/src/internal/external-resources-snapshot.d.ts +46 -0
  143. package/dist/src/internal/external-resources-snapshot.js +1 -0
  144. package/dist/src/internal/external-resources.d.ts +20 -0
  145. package/dist/src/internal/external-resources.js +1 -0
  146. package/dist/src/internal/invocation/workflow-execution.d.ts +0 -2
  147. package/dist/src/internal/invocation/workflow-execution.js +1 -1
  148. package/dist/src/internal/nitro/host/build-application.js +1 -1
  149. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  150. package/dist/src/internal/nitro/host/instrumentation-entry.d.ts +3 -0
  151. package/dist/src/internal/nitro/host/instrumentation-entry.js +2 -0
  152. package/dist/src/internal/nitro/host/start-development-server.d.ts +0 -8
  153. package/dist/src/internal/nitro/host/start-development-server.js +2 -2
  154. package/dist/src/internal/nitro/host.d.ts +1 -1
  155. package/dist/src/internal/nitro/host.js +1 -1
  156. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
  157. package/dist/src/internal/nitro/routes/index.js +72 -3
  158. package/dist/src/node_modules/.pnpm/{@vercel_cli-config@0.2.7 → @vercel_cli-config@0.3.0}/node_modules/@vercel/cli-config/dist/index.js +1 -1
  159. package/dist/src/node_modules/.pnpm/{@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff → @vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494}/node_modules/@vercel/connect/dist/authorization.js +1 -1
  160. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/connector.js +1 -0
  161. package/dist/src/node_modules/.pnpm/{@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff → @vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494}/node_modules/@vercel/connect/dist/installation.js +1 -1
  162. package/dist/src/node_modules/.pnpm/{@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff → @vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494}/node_modules/@vercel/connect/dist/token.js +1 -1
  163. package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/token-util.js +1 -1
  164. package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/token.js +1 -1
  165. package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/version.js +1 -1
  166. package/dist/src/protocol/message.d.ts +4 -0
  167. package/dist/src/protocol/message.js +1 -1
  168. package/dist/src/public/channels/chat-sdk/chatSdkChannel.d.ts +0 -1
  169. package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +1 -1
  170. package/dist/src/public/channels/mcp.js +1 -1
  171. package/dist/src/public/channels/slack/app-manifest.d.ts +9 -0
  172. package/dist/src/public/channels/slack/app-manifest.js +1 -0
  173. package/dist/src/public/channels/slack/inbound-content.js +6 -3
  174. package/dist/src/public/channels/slack/slackChannel.d.ts +4 -1
  175. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  176. package/dist/src/public/definitions/remote-agent.d.ts +0 -9
  177. package/dist/src/public/definitions/workspace-agent.d.ts +0 -3
  178. package/dist/src/public/definitions/workspace-agent.js +1 -1
  179. package/dist/src/runtime/agent/bootstrap.d.ts +0 -1
  180. package/dist/src/runtime/agent/bootstrap.js +1 -1
  181. package/dist/src/runtime/connections/mcp-client.js +1 -1
  182. package/dist/src/runtime/connections/mcp-tracing.d.ts +27 -0
  183. package/dist/src/runtime/connections/mcp-tracing.js +1 -0
  184. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  185. package/dist/src/runtime/resolve-agent.js +1 -1
  186. package/dist/src/runtime/subagents/dynamic-agent-config.d.ts +0 -2
  187. package/dist/src/runtime/subagents/dynamic-agent-config.js +1 -1
  188. package/dist/src/runtime/subagents/dynamic-remote-agent-config.d.ts +0 -2
  189. package/dist/src/runtime/subagents/dynamic-remote-agent-config.js +1 -1
  190. package/dist/src/runtime/types.d.ts +1 -2
  191. package/dist/src/services/dev-client/vercel-auth-error.d.ts +1 -1
  192. package/dist/src/setup/scaffold/create/project.js +1 -1
  193. package/dist/src/setup/verified-remote-agent.d.ts +1 -0
  194. package/dist/src/setup/verified-remote-agent.js +1 -1
  195. package/dist/src/shared/action-types.d.ts +2 -2
  196. package/dist/src/shared/agent-definition.d.ts +0 -9
  197. package/dist/src/shared/agent-turn-outcome.d.ts +1 -1
  198. package/dist/src/shared/channel-definition.d.ts +2 -2
  199. package/dist/src/shared/conversation-context.d.ts +0 -4
  200. package/dist/src/shared/conversation-context.js +1 -1
  201. package/dist/src/shared/validate-authorization.js +1 -1
  202. package/dist/src/shared/vercel-connect-metadata.d.ts +12 -0
  203. package/dist/src/shared/vercel-connect-metadata.js +1 -0
  204. package/dist/src/subagents/agent-handle-errors.d.ts +0 -4
  205. package/dist/src/subagents/agent-handle-errors.js +1 -1
  206. package/dist/src/subagents/callback-route.js +1 -1
  207. package/dist/src/subagents/callback-step.d.ts +0 -22
  208. package/dist/src/subagents/callback-step.js +1 -1
  209. package/dist/src/subagents/event-proxy-step.js +1 -1
  210. package/dist/src/subagents/hitl-proxy.d.ts +3 -5
  211. package/dist/src/subagents/hitl-proxy.js +1 -1
  212. package/dist/src/subagents/invocation.d.ts +5 -6
  213. package/dist/src/subagents/parent-notification.d.ts +1 -18
  214. package/dist/src/subagents/parent-notification.js +1 -1
  215. package/dist/src/subagents/remote-dispatch.js +1 -1
  216. package/dist/src/subagents/tool.d.ts +0 -3
  217. package/dist/src/subagents/tool.js +1 -1
  218. package/dist/src/svelte/index.js +1 -1
  219. package/dist/src/svelte/use-eve-agent.js +1 -1
  220. package/dist/src/tools/framework/agent-contract.d.ts +0 -2
  221. package/dist/src/tools/framework/agent-contract.js +1 -1
  222. package/dist/src/tracing/agent-action-instrumentation.js +1 -1
  223. package/dist/src/tracing/agent-approval-instrumentation.js +1 -1
  224. package/dist/src/tracing/agent-memory-instrumentation.js +1 -1
  225. package/dist/src/tracing/agent-otel-provider.js +2 -2
  226. package/dist/src/tracing/agent-otel-session-context.js +1 -1
  227. package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
  228. package/dist/src/tracing/agent-tool-span-context.d.ts +15 -0
  229. package/dist/src/tracing/agent-tool-span-context.js +1 -0
  230. package/dist/src/tracing/otel-declaration.d.ts +4 -9
  231. package/dist/src/vue/index.js +1 -1
  232. package/dist/src/vue/use-eve-agent.js +1 -1
  233. package/docs/agent-config.md +12 -13
  234. package/docs/channels/chat-sdk.mdx +1 -1
  235. package/docs/channels/custom.mdx +1 -1
  236. package/docs/channels/eve.mdx +4 -4
  237. package/docs/channels/mcp.mdx +10 -10
  238. package/docs/channels/slack.mdx +1 -1
  239. package/docs/concepts/sessions-runs-and-streaming.md +5 -6
  240. package/docs/connections/overview.mdx +22 -0
  241. package/docs/guides/deployment/overview.md +1 -1
  242. package/docs/guides/deployment/self-hosting.md +1 -1
  243. package/docs/guides/deployment/vercel.mdx +2 -2
  244. package/docs/guides/dev-tui.md +6 -6
  245. package/docs/guides/dynamic-capabilities.md +2 -2
  246. package/docs/guides/frontend/overview.mdx +5 -3
  247. package/docs/guides/hooks.md +4 -2
  248. package/docs/guides/instrumentation/agent-runs.mdx +7 -7
  249. package/docs/guides/instrumentation/instrumentation.mdx +22 -5
  250. package/docs/guides/instrumentation/otel.mdx +30 -0
  251. package/docs/guides/remote-agents.md +3 -4
  252. package/docs/guides/self-modification.md +1 -1
  253. package/docs/memory/custom-provider.md +1 -1
  254. package/docs/protocols/acp.md +1 -1
  255. package/docs/reference/cli.md +91 -97
  256. package/docs/schedules.mdx +4 -5
  257. package/docs/subagents/index.mdx +5 -7
  258. package/docs/tools/human-in-the-loop.md +4 -0
  259. package/docs/tools/overview.mdx +2 -0
  260. package/docs/tools/workflows.mdx +1 -1
  261. package/docs/tutorial/remember-definitions.mdx +1 -1
  262. package/docs/tutorial/ship-it.mdx +1 -1
  263. package/package.json +3 -2
  264. package/dist/src/cli/commands/channels.d.ts +0 -9
  265. package/dist/src/cli/commands/channels.js +0 -1
  266. package/dist/src/execution/effective-output-schema.d.ts +0 -22
  267. package/dist/src/execution/effective-output-schema.js +0 -1
  268. package/dist/src/node_modules/.pnpm/@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff/node_modules/@vercel/connect/dist/connector.js +0 -1
  269. package/dist/src/shared/run-mode.d.ts +0 -7
  270. package/dist/src/shared/run-mode.js +0 -1
  271. package/dist/src/subagents/parent-result.d.ts +0 -14
  272. package/dist/src/subagents/parent-result.js +0 -1
  273. /package/dist/src/node_modules/.pnpm/{@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff → @vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494}/node_modules/@vercel/connect/dist/index.js +0 -0
  274. /package/dist/src/node_modules/.pnpm/{@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff → @vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494}/node_modules/@vercel/connect/dist/internal/base-url.js +0 -0
  275. /package/dist/src/node_modules/.pnpm/{@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff → @vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494}/node_modules/@vercel/connect/dist/internal/default-scopes.js +0 -0
  276. /package/dist/src/node_modules/.pnpm/{@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff → @vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494}/node_modules/@vercel/connect/dist/internal/env.js +0 -0
  277. /package/dist/src/node_modules/.pnpm/{@vercel_connect@2.2.0_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_3fe44d656b2dcd93a04011e80966afff → @vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494}/node_modules/@vercel/connect/dist/internal/url-validation.js +0 -0
  278. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/auth-errors.js +0 -0
  279. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/exchange-vercel-oidc-token.js +0 -0
  280. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/get-context.js +0 -0
  281. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-sync.js +0 -0
  282. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-with-refresh.js +0 -0
  283. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/index.js +0 -0
  284. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/oauth.js +0 -0
  285. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/token-error.js +0 -0
  286. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/token-io.js +0 -0
  287. /package/dist/src/node_modules/.pnpm/{@vercel_oidc@3.8.8 → @vercel_oidc@3.8.9}/node_modules/@vercel/oidc/dist/verify-vercel-oidc-token.js +0 -0
@@ -1,2 +1,2 @@
1
- import{normalizeChannelAudience}from"#shared/channel-audience.js";import{applyLiveDeliveryAudienceCeiling,resolveForwardedTraceSeed}from"#shared/forwarded-trace-policy.js";import{contextStorage}from"#context/container.js";import{SessionTraceSeedKey}from"#context/keys.js";import{AGENT_SPAN_NAMES,agentInvocationSpanName,modelSpanName}from"#tracing/agent-span-contract.js";import{resolveInstrumentationEnvironment}from"#internal/application/dev-environment.js";import{isSampledTrace,resolveTracePolicyDecision}from"#tracing/sampled-trace.js";import{ROOT_CONTEXT,SpanKind,context,trace}from"#compiled/@opentelemetry/api/index.js";import{markAgentTraceContext}from"#tracing/agent-trace-context.js";import{attemptIdempotencyKey}from"#instrumentation/lifecycle.js";import{withoutInstrumentationContent}from"#instrumentation/content.js";import{withErrorContent}from"#tracing/error-content-context.js";import{readInstrumentationDecision}from"#shared/instrumentation-decision.js";import{agentSpanNamingAttributes}from"#tracing/agent-span-naming.js";import{agentTraceIdentityAttributes}from"#tracing/agent-otel-attributes.js";import{contentAttribute,genAiInputMessagesAttribute,genAiOutputMessagesAttribute,genAiSystemInstructionsAttribute,systemPromptAttribute,textContentAttribute,toolResultsContentAttribute}from"#tracing/agent-otel-content.js";import{readGatewayCost,setAgentInvocationUsage,setAgentUsage,setGenAiUsage}from"#tracing/agent-otel-usage.js";import{withChannelAudience}from"#tracing/channel-audience-context.js";import{recordAgentSpanError}from"#tracing/agent-span-error.js";import{suppressTracing}from"#tracing/suppress-tracing.js";import{instrumentationEventForTraceDecision}from"#instrumentation/content-policy.js";import{createAgentActionInstrumentation}from"#tracing/agent-action-instrumentation.js";import{createAgentApprovalInstrumentation}from"#tracing/agent-approval-instrumentation.js";import{createAgentChannelDeliveryInstrumentation}from"#tracing/agent-channel-delivery-instrumentation.js";import{createAgentToolInstrumentation}from"#tracing/agent-tool-instrumentation.js";import*as runtimeAttributes from"#tracing/agent-otel-runtime-context.js";import{createAgentMemoryInstrumentation}from"#tracing/agent-memory-instrumentation.js";import{createAgentOtelSessionContext}from"#tracing/agent-otel-session-context.js";function createAgentOtelInstrumentation(e){let t=e.environment??resolveInstrumentationEnvironment(),n=e.recordInputs??!1,r=e.recordOutputs??!1,i=new WeakMap,a=new Map,o=new WeakMap,s=new WeakMap,c=createAgentActionInstrumentation({frameworkVersion:e.frameworkVersion,idGenerator:e.idGenerator,recordInputs:n,recordOutputs:r,resolveTraceContext:async t=>(await e.stateStore.getTurn(t.scope.sessionId,t.scope.turnId))?.context,stateStore:e.stateStore,tracer:e.tracer}),l=createAgentApprovalInstrumentation({actionContextFor:c.contextFor,frameworkVersion:e.frameworkVersion,idGenerator:e.idGenerator,tracer:e.tracer}),u=createAgentToolInstrumentation({actionContextFor:c.contextFor,idGenerator:e.idGenerator,recordInputs:n,recordOutputs:r,resolveFallback:e=>{let t=a.get(e.scope.attemptId)??e.scope,n=o.get(t);return n===void 0?void 0:{context:n.context,spanContext:n.span.spanContext()}},tracer:e.tracer}),d=createAgentMemoryInstrumentation({...e,environment:t}),{prepareSessionTrace:f,prepareTurnTrace:p}=createAgentOtelSessionContext({...e,environment:t}),projectEvent=async i=>{let a=await e.stateStore.getSession(sessionIdForEvent(i)),o=audienceForEvent(i,a?.channelAudience),s=`traceSeed`in i?i.traceSeed:void 0,c=contextStorage.getStore()?.get(SessionTraceSeedKey),l=resolveForwardedTraceSeed(c),u=resolveForwardedTraceSeed(s,l?.forwardedTracePolicy),decisionForTrace=e=>e===void 0?void 0:resolveTracePolicyDecision(isSampledTrace(e),{audience:o,environment:t}),d=u?.decision??l?.decision??readInstrumentationDecision(a?.decision)??decisionForTrace(s)??decisionForTrace(c)??decisionForTrace(a?.context);if(d===void 0)return withoutInstrumentationContent(i);let f=u===void 0||!(`traceSeed`in i)||i.traceSeed===void 0?i:{...i,traceSeed:{...i.traceSeed,decision:u.decision,traceFlags:u.traceFlags}};return instrumentationEventForTraceDecision(f,applyLiveDeliveryAudienceCeiling(d.action===`drop`?d:{action:`record`,recordInputs:n&&d.recordInputs,recordOutputs:r&&d.recordOutputs},o,u?.forwardedTracePolicy??l?.forwardedTracePolicy,t),{audience:o,environment:t},{applyAudienceCeiling:!1})},onSessionStarted=async e=>{await f(e)},onTurnStarted=async e=>{await p(e)},onStepStarted=async t=>{let n=await e.stateStore.getTurn(t.scope.sessionId,t.scope.turnId);if(n===void 0||!isSampledTrace(n.context))return;let r=withChannelAudience(contextFromSpanContext(n.context),t.scope.channelAudience),i=trace.getSpan(context.active())?.spanContext(),s=e.idGenerator.withSpanId(e.idGenerator.deriveSpanId(attemptIdempotencyKey(t.scope)),()=>e.tracer.startSpan(AGENT_SPAN_NAMES.step,{attributes:{"agent.framework.name":`eve`,"agent.framework.version":e.frameworkVersion,"agent.step.attempt":t.scope.attemptIndex,"agent.step.index":t.scope.stepIndex,"agent.turn.id":t.scope.turnId,"agent.name":t.scope.functionId,...agentSpanNamingAttributes(`agent.step`),...agentTraceIdentityAttributes({rootSessionId:t.scope.rootSessionId??t.scope.sessionId,sessionId:t.scope.sessionId}),...runtimeAttributes.runtimeContextAttributes(t.runtimeContext)},links:i===void 0||i.traceId===n.context.traceId?void 0:[{attributes:{"eve.link.type":`workflow.delivery`},context:i}]},r));s.addEvent(`step.started`);let c=trace.setSpan(r,s);o.set(t.scope,{context:c,span:s}),a.set(t.scope.attemptId,t.scope)},onStepTerminal=async e=>{let t=a.get(e.scope.attemptId)??e.scope;i.delete(t),drainOpenSpans({...e,scope:t}),u.drain(e.scope.attemptId,e.type===`step.attempt.failed`?{error:e.error}:void 0),e.type===`step.attempt.failed`&&await c.failForAttempt(t,e.error),a.delete(e.scope.attemptId);let n=o.get(t);n!==void 0&&(n.span.addEvent(e.type===`step.attempt.completed`?`step.completed`:`step.failed`),e.type===`step.attempt.failed`&&recordAgentSpanError(n.span,e.error),n.span.end(),o.delete(t))},onTurnTerminal=async t=>{await e.stateStore.updateTurn(t.sessionId,t.turnId,e=>({...e,terminal:t.type===`turn.failed`?{error:t.error,type:t.type}:{type:t.type}}))},onSessionTransition=async t=>{if(await c.flushForSessionTransition(t),t.type===`session.failed`&&t.turnId!==void 0&&await e.stateStore.updateTurn(t.sessionId,t.turnId,e=>({...e,terminal:e.terminal??{error:t.error,type:`turn.failed`}})),t.turnId!==void 0){let n=await e.stateStore.getTurn(t.sessionId,t.turnId);if(n!==void 0){let r=await e.stateStore.getSession(t.sessionId);if(isSampledTrace(n.context)){let i=r?.agentName??n.subagentName,a=withChannelAudience(ROOT_CONTEXT,r?.channelAudience),startSpan=()=>e.tracer.startSpan(agentInvocationSpanName(i),{attributes:runtimeAttributes.agentActivationAttributes({agentName:i,frameworkVersion:e.frameworkVersion,session:r,sessionId:t.sessionId,turnId:t.turnId,turn:n}),kind:SpanKind.INTERNAL,links:agentActivationLinks(n),root:!0,startTime:n.startTimeMs},a),o=e.idGenerator.withSpanId(n.context.spanId,()=>e.idGenerator.withTraceId(n.context.traceId,startSpan));setAgentInvocationUsage(o,n.modelUsage),o.addEvent(`turn.started`,void 0,n.startTimeMs),n.terminal!==void 0&&(o.setAttribute(`agent.turn.outcome`,n.terminal.type===`turn.completed`?`completed`:n.terminal.type===`turn.cancelled`?`cancelled`:`failed`),o.addEvent(n.terminal.type),n.terminal.type===`turn.failed`&&recordAgentSpanError(o,n.terminal.error)),o.end()}await e.stateStore.deleteTurn(t.sessionId,t.turnId)}}(t.type===`session.completed`||t.type===`session.failed`)&&(await c.deleteForSession(t.sessionId),await e.stateStore.deleteSession(t.sessionId))},onModelCallStarted=t=>{let r=o.get(t.scope);if(r===void 0)return;r.span.setAttribute(`agent.model.id`,t.model.modelId),r.span.setAttribute(`agent.model.provider`,t.model.provider);let i=e.tracer.startSpan(modelSpanName(t.model.modelId),{attributes:{"gen_ai.agent.name":t.scope.functionId,"gen_ai.operation.name":`chat`,"gen_ai.provider.name":t.model.provider,"gen_ai.request.model":t.model.modelId,...agentSpanNamingAttributes(modelSpanName(t.model.modelId),`chat`),...agentTraceIdentityAttributes({rootSessionId:t.scope.rootSessionId??t.scope.sessionId,sessionId:t.scope.sessionId}),...runtimeAttributes.runtimeContextAttributes(t.runtimeContext)},kind:SpanKind.CLIENT},r.context);if(n&&t.input!==void 0){let e=genAiInputMessagesAttribute(t.input.messages);e!==void 0&&i.setAttribute(`gen_ai.input.messages`,e);let n=systemPromptAttribute(t.input.instructions);n!==void 0&&i.setAttribute(`ai.prompt.system`,n);let r=genAiSystemInstructionsAttribute(t.input.instructions);r!==void 0&&i.setAttribute(`gen_ai.system_instructions`,r)}let a={context:trace.setSpan(r.context,i),span:i};getExecutionContexts(t.scope).set(t.idempotencyKey,a.context),getSpanStates(s,t.scope).set(t.idempotencyKey,a)},onModelCallTerminal=async e=>{i.get(e.scope)?.delete(e.idempotencyKey);let t=takeSpanState(s,e.scope,e.idempotencyKey);if(t!==void 0){if(e.type===`model.call.failed`)recordAgentSpanError(t.span,e.error);else{await recordTurnUsage(e),setGenAiUsage(t.span,e.usage),e.responseId!==void 0&&t.span.setAttribute(`gen_ai.response.id`,e.responseId),e.responseModelId!==void 0&&t.span.setAttribute(`gen_ai.response.model`,e.responseModelId),t.span.setAttribute(`gen_ai.response.finish_reasons`,[e.finishReason]);let n=o.get(e.scope);if(n!==void 0&&setAgentUsage(n.span,e.usage),r){t.span.setAttribute(`ai.response.finish_reason`,e.finishReason);let n=e.content;if(n===void 0){t.span.end();return}let r=genAiOutputMessagesAttribute(n,e.finishReason);r!==void 0&&t.span.setAttribute(`gen_ai.output.messages`,r);let i=textContentAttribute(n.filter(e=>e.type===`reasoning`).map(e=>e.text).filter(e=>e.trim().length>0).join(`
2
- `));i!==void 0&&t.span.setAttribute(`ai.response.reasoning`,i);let a=textContentAttribute(n.filter(e=>e.type===`text`).map(e=>e.text).join(``));a!==void 0&&t.span.setAttribute(`ai.response.text`,a);let o=n.filter(e=>e.type===`tool-call`).map(e=>({callId:e.callId,input:e.input,toolName:e.toolName}));if(o.length>0){let e=contentAttribute(o);e!==void 0&&t.span.setAttribute(`ai.response.tool_calls`,e)}let s=n.filter(e=>e.type===`tool-result`||e.type===`tool-error`).map(e=>e.type===`tool-result`?{callId:e.callId,input:e.input,output:e.output,toolName:e.toolName}:{callId:e.callId,error:errorText(e.error),input:e.input,toolName:e.toolName});if(s.length>0){let e=toolResultsContentAttribute(s);e!==void 0&&t.span.setAttribute(`ai.response.tool_results`,e)}}}t.span.end()}},recordTurnUsage=async t=>{(t.usage.inputTokens!==void 0||t.usage.outputTokens!==void 0)&&await e.stateStore.updateTurn(t.scope.sessionId,t.scope.turnId,e=>({...e,modelUsage:{inputTokens:t.usage.inputTokens===void 0?e.modelUsage?.inputTokens:(e.modelUsage?.inputTokens??0)+t.usage.inputTokens,outputTokens:t.usage.outputTokens===void 0?e.modelUsage?.outputTokens:(e.modelUsage?.outputTokens??0)+t.usage.outputTokens}}))},m=createAgentChannelDeliveryInstrumentation({recordInputs:n,stateStore:e.stateStore}),onStepMetadata=e=>{let t=o.get(e.scope);if(t===void 0)return;let n=readGatewayCost(e.providerMetadata);if(n!==void 0)for(let[e,r]of Object.entries(n))t.span.setAttribute(e,r)};return{hook:{flush:c.flushSettledInvocations,events:{...m,"action.completed":c.events[`action.completed`],"action.failed":c.events[`action.failed`],async"action.started"(e,t){await c.events[`action.started`](e,t),await u.actionStarted(e)},...l,...d.events,"step.attempt.completed":onStepTerminal,"step.attempt.failed":onStepTerminal,"step.attempt.metadata":onStepMetadata,"step.attempt.started":onStepStarted,"model.call.completed":onModelCallTerminal,"model.call.failed":onModelCallTerminal,"model.call.started":onModelCallStarted,"session.completed":onSessionTransition,"session.failed":onSessionTransition,"session.started":onSessionStarted,"session.waiting":onSessionTransition,...u.events,"turn.cancelled":onTurnTerminal,"turn.completed":onTurnTerminal,"turn.failed":onTurnTerminal,"turn.started":onTurnStarted},name:`eve.otel`,projectEvent,tracePolicy:()=>({emit:!0,recordInputs:n,recordOutputs:r})},prepareSessionTrace:f,prepareTurnTrace:p,async runInContext(n,o){if(n.type===`memory.operation`)return d.runInContext(n,o);let s=a.get(n.scope.attemptId)??n.scope,c=i.get(s),l=n.type===`model.call`?c?.get(n.idempotencyKey):u.contextFor(n.scope.attemptId,n.idempotencyKey);if(l===void 0){let t=await e.stateStore.getTurn(n.scope.sessionId,n.scope.turnId);t!==void 0&&(l=withChannelAudience(contextFromSpanContext(t.context),n.scope.channelAudience),isSampledTrace(t.context)||(l=suppressTracing(l)))}let f=await e.stateStore.getSession(n.scope.sessionId),p=resolveForwardedTraceSeed(contextStorage.getStore()?.get(SessionTraceSeedKey)),m=p?.decision??f?.decision,h=m===void 0?void 0:applyLiveDeliveryAudienceCeiling(m,normalizeChannelAudience(n.scope.channelAudience),p?.forwardedTracePolicy,t);return l===void 0?o():context.with(markAgentTraceContext(withErrorContent(l,r&&h?.action===`record`&&h.recordOutputs)),o)}};function getExecutionContexts(e){let t=i.get(e);return t===void 0&&(t=new Map,i.set(e,t)),t}function drainOpenSpans(e){for(let t of s.get(e.scope)?.values()??[])e.type===`step.attempt.failed`&&recordAgentSpanError(t.span,e.error),t.span.end();s.delete(e.scope)}}function agentActivationLinks(e){let t=[];return e.caller!==void 0&&t.push({context:e.caller,attributes:{"eve.link.type":`agent.dispatch`}}),e.channelDelivery?.requestTraceContext!==void 0&&t.push({context:e.channelDelivery.requestTraceContext,attributes:{"eve.link.type":`channel.request`}}),t.length===0?void 0:t}function sessionIdForEvent(e){return`scope`in e?e.scope.sessionId:e.sessionId}function audienceForEvent(e,t){return`delivery`in e?normalizeChannelAudience(e.delivery.channelAudience):`scope`in e&&e.scope.channelAudience!==void 0?normalizeChannelAudience(e.scope.channelAudience):e.type===`session.started`?normalizeChannelAudience(e.channelAudience):normalizeChannelAudience(t)}function getSpanStates(e,t){let n=e.get(t);return n===void 0&&(n=new Map,e.set(t,n)),n}function takeSpanState(e,t,n){let r=e.get(t),i=r?.get(n);if(r!==void 0)return r.delete(n),r.size===0&&e.delete(t),i}function contextFromSpanContext(e){return trace.setSpan(ROOT_CONTEXT,trace.wrapSpanContext(e))}const errorText=e=>e instanceof Error?e.message:e;export{createAgentOtelInstrumentation};
1
+ import{normalizeChannelAudience}from"#shared/channel-audience.js";import{applyLiveDeliveryAudienceCeiling,resolveForwardedTraceSeed}from"#shared/forwarded-trace-policy.js";import{contextStorage}from"#context/container.js";import{SessionTraceSeedKey}from"#context/keys.js";import{AGENT_SPAN_NAMES,agentInvocationSpanName,modelSpanName}from"#tracing/agent-span-contract.js";import{resolveInstrumentationEnvironment}from"#internal/application/dev-environment.js";import{isSampledTrace,resolveTracePolicyDecision}from"#tracing/sampled-trace.js";import{ROOT_CONTEXT,SpanKind,context,trace}from"#compiled/@opentelemetry/api/index.js";import{markAgentTraceContext}from"#tracing/agent-trace-context.js";import{attemptIdempotencyKey}from"#instrumentation/lifecycle.js";import{withoutInstrumentationContent}from"#instrumentation/content.js";import{withErrorContent}from"#tracing/error-content-context.js";import{readInstrumentationDecision}from"#shared/instrumentation-decision.js";import{agentSpanNamingAttributes}from"#tracing/agent-span-naming.js";import{contentAttribute,genAiInputMessagesAttribute,genAiOutputMessagesAttribute,genAiSystemInstructionsAttribute,systemPromptAttribute,textContentAttribute,toolResultsContentAttribute}from"#tracing/agent-otel-content.js";import{recordAgentSpanError}from"#tracing/agent-span-error.js";import{withAgentToolContentPolicy}from"#tracing/agent-tool-span-context.js";import{agentTraceIdentityAttributes}from"#tracing/agent-otel-attributes.js";import{readGatewayCost,setAgentInvocationUsage,setAgentUsage,setGenAiUsage}from"#tracing/agent-otel-usage.js";import{withChannelAudience}from"#tracing/channel-audience-context.js";import{suppressTracing}from"#tracing/suppress-tracing.js";import{instrumentationEventForTraceDecision}from"#instrumentation/content-policy.js";import{createAgentActionInstrumentation}from"#tracing/agent-action-instrumentation.js";import{createAgentApprovalInstrumentation}from"#tracing/agent-approval-instrumentation.js";import{createAgentChannelDeliveryInstrumentation}from"#tracing/agent-channel-delivery-instrumentation.js";import{createAgentToolInstrumentation}from"#tracing/agent-tool-instrumentation.js";import*as runtimeAttributes from"#tracing/agent-otel-runtime-context.js";import{createAgentMemoryInstrumentation}from"#tracing/agent-memory-instrumentation.js";import{createAgentOtelSessionContext}from"#tracing/agent-otel-session-context.js";function createAgentOtelInstrumentation(e){let t=e.environment??resolveInstrumentationEnvironment(),n=e.recordInputs??!1,r=e.recordOutputs??!1,i=new WeakMap,a=new Map,o=new WeakMap,s=new WeakMap,c=createAgentActionInstrumentation({frameworkVersion:e.frameworkVersion,idGenerator:e.idGenerator,recordInputs:n,recordOutputs:r,resolveTraceContext:async t=>(await e.stateStore.getTurn(t.scope.sessionId,t.scope.turnId))?.context,stateStore:e.stateStore,tracer:e.tracer}),l=createAgentApprovalInstrumentation({actionContextFor:c.contextFor,frameworkVersion:e.frameworkVersion,idGenerator:e.idGenerator,tracer:e.tracer}),u=createAgentToolInstrumentation({actionContextFor:c.contextFor,idGenerator:e.idGenerator,recordInputs:n,recordOutputs:r,resolveFallback:e=>{let t=a.get(e.scope.attemptId)??e.scope,n=o.get(t);return n===void 0?void 0:{context:n.context,spanContext:n.span.spanContext()}},tracer:e.tracer}),d=createAgentMemoryInstrumentation({...e,environment:t}),{prepareSessionTrace:f,prepareTurnTrace:p}=createAgentOtelSessionContext({...e,environment:t}),projectEvent=async i=>{let a=await e.stateStore.getSession(sessionIdForEvent(i)),o=audienceForEvent(i,a?.channelAudience),s=`traceSeed`in i?i.traceSeed:void 0,c=contextStorage.getStore()?.get(SessionTraceSeedKey),l=resolveForwardedTraceSeed(c),u=resolveForwardedTraceSeed(s,l?.forwardedTracePolicy),decisionForTrace=e=>e===void 0?void 0:resolveTracePolicyDecision(isSampledTrace(e),{audience:o,environment:t}),d=u?.decision??l?.decision??readInstrumentationDecision(a?.decision)??decisionForTrace(s)??decisionForTrace(c)??decisionForTrace(a?.context);if(d===void 0)return withoutInstrumentationContent(i);let f=u===void 0||!(`traceSeed`in i)||i.traceSeed===void 0?i:{...i,traceSeed:{...i.traceSeed,decision:u.decision,traceFlags:u.traceFlags}};return instrumentationEventForTraceDecision(f,applyLiveDeliveryAudienceCeiling(d.action===`drop`?d:{action:`record`,recordInputs:n&&d.recordInputs,recordOutputs:r&&d.recordOutputs},o,u?.forwardedTracePolicy??l?.forwardedTracePolicy,t),{audience:o,environment:t},{applyAudienceCeiling:!1})},onSessionStarted=async e=>{await f(e)},onTurnStarted=async e=>{await p(e)},onStepStarted=async t=>{let n=await e.stateStore.getTurn(t.scope.sessionId,t.scope.turnId);if(n===void 0||!isSampledTrace(n.context))return;let r=withChannelAudience(contextFromSpanContext(n.context),t.scope.channelAudience),i=trace.getSpan(context.active())?.spanContext(),s=e.idGenerator.withSpanId(e.idGenerator.deriveSpanId(attemptIdempotencyKey(t.scope)),()=>e.tracer.startSpan(AGENT_SPAN_NAMES.step,{attributes:{"agent.framework.name":`eve`,"agent.framework.version":e.frameworkVersion,"agent.step.attempt":t.scope.attemptIndex,"agent.step.index":t.scope.stepIndex,"agent.turn.id":t.scope.turnId,"agent.name":t.scope.functionId,...agentSpanNamingAttributes(`agent.step`),...agentTraceIdentityAttributes({rootSessionId:t.scope.rootSessionId??t.scope.sessionId,sessionId:t.scope.sessionId}),...runtimeAttributes.runtimeContextAttributes(t.runtimeContext)},links:i===void 0||i.traceId===n.context.traceId?void 0:[{attributes:{"eve.link.type":`workflow.delivery`},context:i}]},r));s.addEvent(`step.started`);let c=trace.setSpan(r,s);o.set(t.scope,{context:c,span:s}),a.set(t.scope.attemptId,t.scope)},onStepTerminal=async e=>{let t=a.get(e.scope.attemptId)??e.scope;i.delete(t),drainOpenSpans({...e,scope:t}),u.drain(e.scope.attemptId,e.type===`step.attempt.failed`?{error:e.error}:void 0),e.type===`step.attempt.failed`&&await c.failForAttempt(t,e.error),a.delete(e.scope.attemptId);let n=o.get(t);n!==void 0&&(n.span.addEvent(e.type===`step.attempt.completed`?`step.completed`:`step.failed`),e.type===`step.attempt.failed`&&recordAgentSpanError(n.span,e.error),n.span.end(),o.delete(t))},onTurnTerminal=async t=>{await e.stateStore.updateTurn(t.sessionId,t.turnId,e=>({...e,terminal:t.type===`turn.failed`?{error:t.error,type:t.type}:{type:t.type}}))},onSessionTransition=async t=>{if(await c.flushForSessionTransition(t),t.type===`session.failed`&&t.turnId!==void 0&&await e.stateStore.updateTurn(t.sessionId,t.turnId,e=>({...e,terminal:e.terminal??{error:t.error,type:`turn.failed`}})),t.turnId!==void 0){let n=await e.stateStore.getTurn(t.sessionId,t.turnId);if(n!==void 0){let r=await e.stateStore.getSession(t.sessionId);if(isSampledTrace(n.context)){let i=r?.agentName??n.subagentName,a=withChannelAudience(ROOT_CONTEXT,r?.channelAudience),startSpan=()=>e.tracer.startSpan(agentInvocationSpanName(i),{attributes:runtimeAttributes.agentActivationAttributes({agentName:i,frameworkVersion:e.frameworkVersion,session:r,sessionId:t.sessionId,turnId:t.turnId,turn:n}),kind:SpanKind.INTERNAL,links:agentActivationLinks(n),root:!0,startTime:n.startTimeMs},a),o=e.idGenerator.withSpanId(n.context.spanId,()=>e.idGenerator.withTraceId(n.context.traceId,startSpan));setAgentInvocationUsage(o,n.modelUsage),o.addEvent(`turn.started`,void 0,n.startTimeMs),n.terminal!==void 0&&(o.setAttribute(`agent.turn.outcome`,n.terminal.type===`turn.completed`?`completed`:n.terminal.type===`turn.cancelled`?`cancelled`:`failed`),o.addEvent(n.terminal.type),n.terminal.type===`turn.failed`&&recordAgentSpanError(o,n.terminal.error)),o.end()}await e.stateStore.deleteTurn(t.sessionId,t.turnId)}}(t.type===`session.completed`||t.type===`session.failed`)&&(await c.deleteForSession(t.sessionId),await e.stateStore.deleteSession(t.sessionId))},onModelCallStarted=t=>{let r=o.get(t.scope);if(r===void 0)return;r.span.setAttribute(`agent.model.id`,t.model.modelId),r.span.setAttribute(`agent.model.provider`,t.model.provider);let i=e.tracer.startSpan(modelSpanName(t.model.modelId),{attributes:{"gen_ai.agent.name":t.scope.functionId,"gen_ai.operation.name":`chat`,"gen_ai.provider.name":t.model.provider,"gen_ai.request.model":t.model.modelId,...agentSpanNamingAttributes(modelSpanName(t.model.modelId),`chat`),...agentTraceIdentityAttributes({rootSessionId:t.scope.rootSessionId??t.scope.sessionId,sessionId:t.scope.sessionId}),...runtimeAttributes.runtimeContextAttributes(t.runtimeContext)},kind:SpanKind.CLIENT},r.context);if(n&&t.input!==void 0){let e=genAiInputMessagesAttribute(t.input.messages);e!==void 0&&i.setAttribute(`gen_ai.input.messages`,e);let n=systemPromptAttribute(t.input.instructions);n!==void 0&&i.setAttribute(`ai.prompt.system`,n);let r=genAiSystemInstructionsAttribute(t.input.instructions);r!==void 0&&i.setAttribute(`gen_ai.system_instructions`,r)}let a={context:trace.setSpan(r.context,i),span:i};getExecutionContexts(t.scope).set(t.idempotencyKey,a.context),getSpanStates(s,t.scope).set(t.idempotencyKey,a)},onModelCallTerminal=async e=>{i.get(e.scope)?.delete(e.idempotencyKey);let t=takeSpanState(s,e.scope,e.idempotencyKey);if(t!==void 0){if(e.type===`model.call.failed`)recordAgentSpanError(t.span,e.error);else{await recordTurnUsage(e),setGenAiUsage(t.span,e.usage),e.responseId!==void 0&&t.span.setAttribute(`gen_ai.response.id`,e.responseId),e.responseModelId!==void 0&&t.span.setAttribute(`gen_ai.response.model`,e.responseModelId),t.span.setAttribute(`gen_ai.response.finish_reasons`,[e.finishReason]);let n=o.get(e.scope);if(n!==void 0&&setAgentUsage(n.span,e.usage),r){t.span.setAttribute(`ai.response.finish_reason`,e.finishReason);let n=e.content;if(n===void 0){t.span.end();return}let r=genAiOutputMessagesAttribute(n,e.finishReason);r!==void 0&&t.span.setAttribute(`gen_ai.output.messages`,r);let i=textContentAttribute(n.filter(e=>e.type===`reasoning`).map(e=>e.text).filter(e=>e.trim().length>0).join(`
2
+ `));i!==void 0&&t.span.setAttribute(`ai.response.reasoning`,i);let a=textContentAttribute(n.filter(e=>e.type===`text`).map(e=>e.text).join(``));a!==void 0&&t.span.setAttribute(`ai.response.text`,a);let o=n.filter(e=>e.type===`tool-call`).map(e=>({callId:e.callId,input:e.input,toolName:e.toolName}));if(o.length>0){let e=contentAttribute(o);e!==void 0&&t.span.setAttribute(`ai.response.tool_calls`,e)}let s=n.filter(e=>e.type===`tool-result`||e.type===`tool-error`).map(e=>e.type===`tool-result`?{callId:e.callId,input:e.input,output:e.output,toolName:e.toolName}:{callId:e.callId,error:errorText(e.error),input:e.input,toolName:e.toolName});if(s.length>0){let e=toolResultsContentAttribute(s);e!==void 0&&t.span.setAttribute(`ai.response.tool_results`,e)}}}t.span.end()}},recordTurnUsage=async t=>{(t.usage.inputTokens!==void 0||t.usage.outputTokens!==void 0)&&await e.stateStore.updateTurn(t.scope.sessionId,t.scope.turnId,e=>({...e,modelUsage:{inputTokens:t.usage.inputTokens===void 0?e.modelUsage?.inputTokens:(e.modelUsage?.inputTokens??0)+t.usage.inputTokens,outputTokens:t.usage.outputTokens===void 0?e.modelUsage?.outputTokens:(e.modelUsage?.outputTokens??0)+t.usage.outputTokens}}))},m=createAgentChannelDeliveryInstrumentation({recordInputs:n,stateStore:e.stateStore}),onStepMetadata=e=>{let t=o.get(e.scope);if(t===void 0)return;let n=readGatewayCost(e.providerMetadata);if(n!==void 0)for(let[e,r]of Object.entries(n))t.span.setAttribute(e,r)};return{hook:{flush:c.flushSettledInvocations,events:{...m,"action.completed":c.events[`action.completed`],"action.failed":c.events[`action.failed`],async"action.started"(e,t){await c.events[`action.started`](e,t),await u.actionStarted(e)},...l,...d.events,"step.attempt.completed":onStepTerminal,"step.attempt.failed":onStepTerminal,"step.attempt.metadata":onStepMetadata,"step.attempt.started":onStepStarted,"model.call.completed":onModelCallTerminal,"model.call.failed":onModelCallTerminal,"model.call.started":onModelCallStarted,"session.completed":onSessionTransition,"session.failed":onSessionTransition,"session.started":onSessionStarted,"session.waiting":onSessionTransition,...u.events,"turn.cancelled":onTurnTerminal,"turn.completed":onTurnTerminal,"turn.failed":onTurnTerminal,"turn.started":onTurnStarted},name:`eve.otel`,projectEvent,tracePolicy:()=>({emit:!0,recordInputs:n,recordOutputs:r})},prepareSessionTrace:f,prepareTurnTrace:p,async runInContext(o,s){if(o.type===`memory.operation`)return d.runInContext(o,s);let c=a.get(o.scope.attemptId)??o.scope,l=i.get(c),f=o.type===`model.call`?l?.get(o.idempotencyKey):u.contextFor(o.scope.attemptId,o.idempotencyKey);if(f===void 0){let t=await e.stateStore.getTurn(o.scope.sessionId,o.scope.turnId);t!==void 0&&(f=withChannelAudience(contextFromSpanContext(t.context),o.scope.channelAudience),isSampledTrace(t.context)||(f=suppressTracing(f)))}let p=await e.stateStore.getSession(o.scope.sessionId),m=resolveForwardedTraceSeed(contextStorage.getStore()?.get(SessionTraceSeedKey)),h=m?.decision??p?.decision,g=h===void 0?void 0:applyLiveDeliveryAudienceCeiling(h,normalizeChannelAudience(o.scope.channelAudience),m?.forwardedTracePolicy,t),_={recordInputs:n&&g?.action===`record`&&g.recordInputs,recordOutputs:r&&g?.action===`record`&&g.recordOutputs};if(f===void 0)return s();let v=withErrorContent(f,_.recordOutputs),y=o.type===`tool.call`?withAgentToolContentPolicy(v,_):v;return context.with(markAgentTraceContext(y),s)}};function getExecutionContexts(e){let t=i.get(e);return t===void 0&&(t=new Map,i.set(e,t)),t}function drainOpenSpans(e){for(let t of s.get(e.scope)?.values()??[])e.type===`step.attempt.failed`&&recordAgentSpanError(t.span,e.error),t.span.end();s.delete(e.scope)}}function agentActivationLinks(e){let t=[];return e.caller!==void 0&&t.push({context:e.caller,attributes:{"eve.link.type":`agent.dispatch`}}),e.channelDelivery?.requestTraceContext!==void 0&&t.push({context:e.channelDelivery.requestTraceContext,attributes:{"eve.link.type":`channel.request`}}),t.length===0?void 0:t}function sessionIdForEvent(e){return`scope`in e?e.scope.sessionId:e.sessionId}function audienceForEvent(e,t){return`delivery`in e?normalizeChannelAudience(e.delivery.channelAudience):`scope`in e&&e.scope.channelAudience!==void 0?normalizeChannelAudience(e.scope.channelAudience):e.type===`session.started`?normalizeChannelAudience(e.channelAudience):normalizeChannelAudience(t)}function getSpanStates(e,t){let n=e.get(t);return n===void 0&&(n=new Map,e.set(t,n)),n}function takeSpanState(e,t,n){let r=e.get(t),i=r?.get(n);if(r!==void 0)return r.delete(n),r.size===0&&e.delete(t),i}function contextFromSpanContext(e){return trace.setSpan(ROOT_CONTEXT,trace.wrapSpanContext(e))}const errorText=e=>e instanceof Error?e.message:e;export{createAgentOtelInstrumentation};
@@ -1 +1 @@
1
- import{normalizeChannelAudience}from"#shared/channel-audience.js";import{normalizeInstrumentationChannelKind}from"#internal/instrumentation.js";import{agentInvocationSpanName}from"#tracing/agent-span-contract.js";import{isSampledTrace,resolveTracePolicy,resolveTracePolicyDecision}from"#tracing/sampled-trace.js";import"#instrumentation/lifecycle.js";import{readInstrumentationDecision}from"#shared/instrumentation-decision.js";import{applyPrincipalTraceDecision}from"#instrumentation/principal-summary.js";import{agentActivationAttributes}from"#tracing/agent-otel-runtime-context.js";function createAgentOtelSessionContext(e){let ensureSessionContext=async t=>{let n=await e.stateStore.getSession(t.sessionId);if(n===void 0){let r=normalizeChannelAudience(t.channelAudience),i=resolveSessionTraceDecision(t,r,e.environment,e.tracePolicy);n={agentName:t.agentName,channelAudience:r,channelKind:t.channelKind,channelType:t.channelType,decision:i,context:initialSessionContext(e,t,i),parentLineage:t.parentLineage,rootSessionId:t.rootSessionId,scheduleId:t.scheduleId,title:t.title},await e.stateStore.setSession(t.sessionId,n)}return n};return{ensureSessionContext,prepareSessionTrace:async e=>{let t=await ensureSessionContext(e);return portableSpanContext(t.context,t.decision)},prepareTurnTrace:async t=>{let n=await e.stateStore.getTurn(t.sessionId,t.turnId);if(n!==void 0){let r=await e.stateStore.getSession(t.sessionId);return portableSpanContext(n.context,r?.decision)}let r=await ensureSessionContext(t),i=t.sequence===0,a=i?t.parentTraceContext:void 0,o=i?{...r.context,isRemote:!1}:freshTurnContext(e,t.idempotencyKey,r.decision),s={caller:a===void 0?void 0:adoptedSpanContext(a),context:o,currentPrincipal:applyPrincipalTraceDecision(t.currentPrincipal,r.decision),initiatorPrincipal:applyPrincipalTraceDecision(t.initiatorPrincipal,r.decision),parentLineage:t.parentLineage??r.parentLineage,rootSessionId:t.rootSessionId,sequence:t.sequence,startTimeMs:Date.now(),subagentName:(t.parentLineage??r.parentLineage)?.subagentName};if(isSampledTrace(s.context)){let n=r.agentName??s.subagentName,i=e.samplesTrace?.(s.context.traceId,{name:agentInvocationSpanName(n),attributes:agentActivationAttributes({agentName:n,frameworkVersion:e.frameworkVersion,session:r,sessionId:t.sessionId,turnId:t.turnId,turn:s})})??!0;o={...o,traceFlags:+!!i}}return await e.stateStore.setTurn(t.sessionId,t.turnId,{...s,context:o}),portableSpanContext(o,r.decision)}}}function portableSpanContext(e,t){return{decision:t,spanId:e.spanId,traceFlags:e.traceFlags,traceId:e.traceId}}function adoptedSpanContext(e){return{isRemote:`isRemote`in e&&e.isRemote===!0,spanId:e.spanId,traceFlags:e.traceFlags,traceId:e.traceId}}function initialSessionContext(e,t,n){let r=t.traceSeed;if(r!==void 0)return{...adoptedSpanContext(r),traceFlags:n.action===`drop`?0:r.traceFlags};let i=e.idGenerator.deriveTraceId(`session:${t.sessionId}`),a=n.action===`record`;return{isRemote:!1,spanId:e.idGenerator.deriveSpanId(`session:${t.sessionId}`),traceFlags:+!!a,traceId:i}}function freshTurnContext(e,t,n){let r=e.idGenerator.deriveTraceId(`turn:${t}`),i=n?.action===`record`;return{isRemote:!1,spanId:e.idGenerator.deriveSpanId(`turn:${t}`),traceFlags:+!!i,traceId:r}}function resolveSessionTraceDecision(e,t,n,r){let i={audience:t,environment:n};return e.parentTraceContext!==void 0&&!isSampledTrace(e.parentTraceContext)?{action:`drop`}:e.traceSeed?.decision===void 0?e.traceSeed===void 0?e.parentTraceContext===void 0?e.agentName===void 0?r===void 0?resolveTracePolicyDecision(!0,i):{action:`drop`}:resolveTracePolicy(r,{agentName:e.agentName,audience:t,channel:{kind:normalizeInstrumentationChannelKind(e.channelKind??e.channelType)},environment:n,mode:`conversation`,principalType:`unknown`}):resolveTracePolicyDecision(isSampledTrace(e.parentTraceContext),i):resolveTracePolicyDecision(isSampledTrace(e.traceSeed),i):readInstrumentationDecision(e.traceSeed.decision)??{action:`drop`}}export{createAgentOtelSessionContext};
1
+ import{normalizeChannelAudience}from"#shared/channel-audience.js";import{normalizeInstrumentationChannelKind}from"#internal/instrumentation.js";import{agentInvocationSpanName}from"#tracing/agent-span-contract.js";import{isSampledTrace,resolveTracePolicy,resolveTracePolicyDecision}from"#tracing/sampled-trace.js";import"#instrumentation/lifecycle.js";import{readInstrumentationDecision}from"#shared/instrumentation-decision.js";import{applyPrincipalTraceDecision}from"#instrumentation/principal-summary.js";import{agentActivationAttributes}from"#tracing/agent-otel-runtime-context.js";function createAgentOtelSessionContext(e){let ensureSessionContext=async t=>{let n=await e.stateStore.getSession(t.sessionId);if(n===void 0){let r=normalizeChannelAudience(t.channelAudience),i=resolveSessionTraceDecision(t,r,e.environment,e.tracePolicy);n={agentName:t.agentName,channelAudience:r,channelKind:t.channelKind,channelType:t.channelType,decision:i,context:initialSessionContext(e,t,i),parentLineage:t.parentLineage,rootSessionId:t.rootSessionId,scheduleId:t.scheduleId,title:t.title},await e.stateStore.setSession(t.sessionId,n)}return n};return{ensureSessionContext,prepareSessionTrace:async e=>{let t=await ensureSessionContext(e);return portableSpanContext(t.context,t.decision)},prepareTurnTrace:async t=>{let n=await e.stateStore.getTurn(t.sessionId,t.turnId);if(n!==void 0){let r=await e.stateStore.getSession(t.sessionId);return portableSpanContext(n.context,r?.decision)}let r=await ensureSessionContext(t),i=t.sequence===0,a=i?t.parentTraceContext:void 0,o=i?{...r.context,isRemote:!1}:freshTurnContext(e,t.idempotencyKey,r.decision),s={caller:a===void 0?void 0:adoptedSpanContext(a),context:o,currentPrincipal:applyPrincipalTraceDecision(t.currentPrincipal,r.decision),initiatorPrincipal:applyPrincipalTraceDecision(t.initiatorPrincipal,r.decision),parentLineage:t.parentLineage??r.parentLineage,rootSessionId:t.rootSessionId,sequence:t.sequence,startTimeMs:Date.now(),subagentName:(t.parentLineage??r.parentLineage)?.subagentName};if(isSampledTrace(s.context)){let n=r.agentName??s.subagentName,i=e.samplesTrace?.(s.context.traceId,{name:agentInvocationSpanName(n),attributes:agentActivationAttributes({agentName:n,frameworkVersion:e.frameworkVersion,session:r,sessionId:t.sessionId,turnId:t.turnId,turn:s})})??!0;o={...o,traceFlags:+!!i}}return await e.stateStore.setTurn(t.sessionId,t.turnId,{...s,context:o}),portableSpanContext(o,r.decision)}}}function portableSpanContext(e,t){return{decision:t,spanId:e.spanId,traceFlags:e.traceFlags,traceId:e.traceId}}function adoptedSpanContext(e){return{isRemote:`isRemote`in e&&e.isRemote===!0,spanId:e.spanId,traceFlags:e.traceFlags,traceId:e.traceId}}function initialSessionContext(e,t,n){let r=t.traceSeed;if(r!==void 0)return{...adoptedSpanContext(r),traceFlags:n.action===`drop`?0:r.traceFlags};let i=e.idGenerator.deriveTraceId(`session:${t.sessionId}`),a=n.action===`record`;return{isRemote:!1,spanId:e.idGenerator.deriveSpanId(`session:${t.sessionId}`),traceFlags:+!!a,traceId:i}}function freshTurnContext(e,t,n){let r=e.idGenerator.deriveTraceId(`turn:${t}`),i=n?.action===`record`;return{isRemote:!1,spanId:e.idGenerator.deriveSpanId(`turn:${t}`),traceFlags:+!!i,traceId:r}}function resolveSessionTraceDecision(e,t,n,r){let i={audience:t,environment:n};return e.parentTraceContext!==void 0&&!isSampledTrace(e.parentTraceContext)?{action:`drop`}:e.traceSeed?.decision===void 0?e.traceSeed===void 0?e.parentTraceContext===void 0?e.agentName===void 0?r===void 0?resolveTracePolicyDecision(!0,i):{action:`drop`}:resolveTracePolicy(r,{agentName:e.agentName,audience:t,channel:{kind:normalizeInstrumentationChannelKind(e.channelKind??e.channelType)},environment:n,principalType:`unknown`}):resolveTracePolicyDecision(isSampledTrace(e.parentTraceContext),i):resolveTracePolicyDecision(isSampledTrace(e.traceSeed),i):readInstrumentationDecision(e.traceSeed.decision)??{action:`drop`}}export{createAgentOtelSessionContext};
@@ -1 +1 @@
1
- import{ROOT_CONTEXT,SpanKind,trace}from"#compiled/@opentelemetry/api/index.js";import{actionIdempotencyKey}from"#instrumentation/lifecycle.js";import{agentSpanNamingAttributes}from"#tracing/agent-span-naming.js";import{agentTraceIdentityAttributes}from"#tracing/agent-otel-attributes.js";import{contentAttribute}from"#tracing/agent-otel-content.js";import{withChannelAudience}from"#tracing/channel-audience-context.js";import{recordAgentSpanError}from"#tracing/agent-span-error.js";function createAgentToolInstrumentation(e){let t=new Map,n=new Map,onStarted=async t=>{let n=actionIdempotencyKey(t.scope.sessionId,t.scope.turnId,t.callId),r=e.resolveFallback(t),i=r===void 0?void 0:reserve(t,n,r),a=await e.actionContextFor(t.scope.sessionId,t.scope.turnId,t.callId);if(i===void 0){if(a===void 0)return;i=reserve(t,n,a)}a!==void 0&&startSpan(i,a.context)},onTerminal=async t=>{let r=n.get(t.scope.attemptId)?.get(t.idempotencyKey);if(r!==void 0){if(r.terminal=t,r.span===void 0){let t=await e.actionContextFor(r.event.scope.sessionId,r.event.scope.turnId,r.event.callId);t!==void 0&&startSpan(r,t.context)}finishIfReady(r)}};return{async actionStarted(n){let r=t.get(n.idempotencyKey);if(r===void 0||r.span!==void 0||r.finished===!0)return;let i=await e.actionContextFor(n.scope.sessionId,n.scope.turnId,n.callId);i!==void 0&&(startSpan(r,i.context),finishIfReady(r))},contextFor:(e,t)=>n.get(e)?.get(t)?.context,drain(e,t){let r=n.get(e);if(r!==void 0){for(let e of r.values())e.finished!==!0&&(e.span===void 0&&startSpan(e,e.fallbackParent),finish(e,t));n.delete(e)}},events:{"tool.call.completed":onTerminal,"tool.call.failed":onTerminal,"tool.call.started":onStarted}};function getAttemptStates(e){let t=n.get(e);return t===void 0&&(t=new Map,n.set(e,t)),t}function reserve(n,r,i){let a=e.idGenerator.deriveSpanId(`tool:${n.idempotencyKey}`),o={actionKey:r,attemptId:n.scope.attemptId,context:withChannelAudience(contextFromSpanContext({isRemote:!1,spanId:a,traceFlags:i.spanContext.traceFlags,traceId:i.spanContext.traceId}),n.scope.channelAudience),event:n,fallbackParent:i.context,idempotencyKey:n.idempotencyKey,spanId:a,startTimeMs:Date.now()};return getAttemptStates(n.scope.attemptId).set(n.idempotencyKey,o),t.set(r,o),o}function startSpan(t,n){if(t.span===void 0&&t.finished!==!0&&(t.span=e.idGenerator.withSpanId(t.spanId,()=>e.tracer.startSpan(`execute_tool ${t.event.toolName}`,{attributes:toolAttributes(t.event),kind:SpanKind.INTERNAL,startTime:t.startTimeMs},n)),e.recordInputs)){let e=contentAttribute(t.event.input);e!==void 0&&t.span.setAttribute(`gen_ai.tool.call.arguments`,e)}}function finishIfReady(e){e.span!==void 0&&e.terminal!==void 0&&finish(e)}function finish(r,i){let a=r.span;if(a===void 0||r.finished===!0)return;r.finished=!0;let o=r.terminal;if(i!==void 0)recordAgentSpanError(a,i.error);else if(o?.type===`tool.call.failed`)recordAgentSpanError(a,o.error);else if(o?.output.type===`error`)recordAgentSpanError(a,o.output.error);else if(o!==void 0&&e.recordOutputs){let e=contentAttribute(o.output.output);e!==void 0&&a.setAttribute(`gen_ai.tool.call.result`,e)}a.end(),t.delete(r.actionKey);let s=n.get(r.attemptId);s?.delete(r.idempotencyKey),s?.size===0&&n.delete(r.attemptId)}}function toolAttributes(e){return{...e.scope.functionId===void 0?{}:{"gen_ai.agent.name":e.scope.functionId},"gen_ai.operation.name":`execute_tool`,"gen_ai.tool.call.id":e.callId,"gen_ai.tool.name":e.toolName,"gen_ai.tool.type":`function`,...agentSpanNamingAttributes(`execute_tool ${e.toolName}`,`execute_tool`),...agentTraceIdentityAttributes({rootSessionId:e.scope.rootSessionId??e.scope.sessionId,sessionId:e.scope.sessionId})}}function contextFromSpanContext(e){return trace.setSpan(ROOT_CONTEXT,trace.wrapSpanContext(e))}export{createAgentToolInstrumentation};
1
+ import{ROOT_CONTEXT,SpanKind,trace}from"#compiled/@opentelemetry/api/index.js";import{actionIdempotencyKey}from"#instrumentation/lifecycle.js";import{agentSpanNamingAttributes}from"#tracing/agent-span-naming.js";import{contentAttribute}from"#tracing/agent-otel-content.js";import{recordAgentSpanError}from"#tracing/agent-span-error.js";import{withAgentToolSpanContext}from"#tracing/agent-tool-span-context.js";import{agentTraceIdentityAttributes}from"#tracing/agent-otel-attributes.js";import{withChannelAudience}from"#tracing/channel-audience-context.js";function createAgentToolInstrumentation(e){let t=new Map,n=new Map,onStarted=async t=>{let n=actionIdempotencyKey(t.scope.sessionId,t.scope.turnId,t.callId),r=e.resolveFallback(t),i=r===void 0?void 0:reserve(t,n,r),a=await e.actionContextFor(t.scope.sessionId,t.scope.turnId,t.callId);if(i===void 0){if(a===void 0)return;i=reserve(t,n,a)}a!==void 0&&startSpan(i,a.context)},onTerminal=async t=>{let r=n.get(t.scope.attemptId)?.get(t.idempotencyKey);if(r!==void 0){if(r.terminal=t,r.span===void 0){let t=await e.actionContextFor(r.event.scope.sessionId,r.event.scope.turnId,r.event.callId);t!==void 0&&startSpan(r,t.context)}finishIfReady(r)}};return{async actionStarted(n){let r=t.get(n.idempotencyKey);if(r===void 0||r.span!==void 0||r.finished===!0)return;let i=await e.actionContextFor(n.scope.sessionId,n.scope.turnId,n.callId);i!==void 0&&(startSpan(r,i.context),finishIfReady(r))},contextFor:(e,t)=>n.get(e)?.get(t)?.context,drain(e,t){let r=n.get(e);if(r!==void 0){for(let e of r.values())e.finished!==!0&&(e.span===void 0&&startSpan(e,e.fallbackParent),finish(e,t));n.delete(e)}},events:{"tool.call.completed":onTerminal,"tool.call.failed":onTerminal,"tool.call.started":onStarted}};function getAttemptStates(e){let t=n.get(e);return t===void 0&&(t=new Map,n.set(e,t)),t}function reserve(n,r,i){let a=e.idGenerator.deriveSpanId(`tool:${n.idempotencyKey}`),o={actionKey:r,attemptId:n.scope.attemptId,additionalAttributes:{},context:withChannelAudience(contextFromSpanContext({isRemote:!1,spanId:a,traceFlags:i.spanContext.traceFlags,traceId:i.spanContext.traceId}),n.scope.channelAudience),event:n,fallbackParent:i.context,idempotencyKey:n.idempotencyKey,spanId:a,startTimeMs:Date.now()};return o.context=withAgentToolSpanContext(o.context,{recordInputs:e.recordInputs,recordOutputs:e.recordOutputs,setAttributes(e){if(Object.assign(o.additionalAttributes,e),o.span!==void 0)for(let[t,n]of Object.entries(e))n!==void 0&&o.span.setAttribute(t,n)},recordError(e,t){o.pendingError={error:e,errorType:t},o.span!==void 0&&recordAgentSpanError(o.span,e,t)}}),getAttemptStates(n.scope.attemptId).set(n.idempotencyKey,o),t.set(r,o),o}function startSpan(t,n){if(t.span===void 0&&t.finished!==!0&&(t.span=e.idGenerator.withSpanId(t.spanId,()=>e.tracer.startSpan(`execute_tool ${t.event.toolName}`,{attributes:{...toolAttributes(t.event),...t.additionalAttributes},kind:SpanKind.INTERNAL,startTime:t.startTimeMs},n)),t.pendingError!==void 0&&recordAgentSpanError(t.span,t.pendingError.error,t.pendingError.errorType),e.recordInputs)){let e=contentAttribute(t.event.input);e!==void 0&&t.span.setAttribute(`gen_ai.tool.call.arguments`,e)}}function finishIfReady(e){e.span!==void 0&&e.terminal!==void 0&&finish(e)}function finish(r,i){let a=r.span;if(a===void 0||r.finished===!0)return;r.finished=!0;let o=r.terminal;if(i!==void 0)recordAgentSpanError(a,i.error);else if(o?.type===`tool.call.failed`)recordAgentSpanError(a,o.error);else if(o?.output.type===`error`)recordAgentSpanError(a,o.output.error);else if(o!==void 0&&e.recordOutputs){let e=contentAttribute(o.output.output);e!==void 0&&a.setAttribute(`gen_ai.tool.call.result`,e)}a.end(),t.delete(r.actionKey);let s=n.get(r.attemptId);s?.delete(r.idempotencyKey),s?.size===0&&n.delete(r.attemptId)}}function toolAttributes(e){return{...e.scope.functionId===void 0?{}:{"gen_ai.agent.name":e.scope.functionId},"gen_ai.operation.name":`execute_tool`,"gen_ai.tool.call.id":e.callId,"gen_ai.tool.name":e.toolName,"gen_ai.tool.type":`function`,...agentSpanNamingAttributes(`execute_tool ${e.toolName}`,`execute_tool`),...agentTraceIdentityAttributes({rootSessionId:e.scope.rootSessionId??e.scope.sessionId,sessionId:e.scope.sessionId})}}function contextFromSpanContext(e){return trace.setSpan(ROOT_CONTEXT,trace.wrapSpanContext(e))}export{createAgentToolInstrumentation};
@@ -0,0 +1,15 @@
1
+ import { type Attributes, type Context } from "#compiled/@opentelemetry/api/index.js";
2
+ export interface AgentToolContentPolicy {
3
+ readonly recordInputs: boolean;
4
+ readonly recordOutputs: boolean;
5
+ }
6
+ export interface AgentToolSpanContext extends AgentToolContentPolicy {
7
+ readonly recordError?: (error: unknown, errorType?: string) => void;
8
+ readonly setAttributes?: (attributes: Attributes) => void;
9
+ }
10
+ export declare function withAgentToolSpanContext(context: Context, value: AgentToolSpanContext): Context;
11
+ export declare function withAgentToolContentPolicy(context: Context, policy: AgentToolContentPolicy): Context;
12
+ export declare function agentToolSpanContext(context?: Context): AgentToolSpanContext | undefined;
13
+ export declare function agentToolContentPolicy(context?: Context): AgentToolContentPolicy;
14
+ export declare function annotateAgentToolSpan(attributes: Attributes, context?: Context): boolean;
15
+ export declare function recordAgentToolSpanError(error: unknown, errorType?: string, context?: Context): boolean;
@@ -0,0 +1 @@
1
+ import{context,createContextKey}from"#compiled/@opentelemetry/api/index.js";const AGENT_TOOL_SPAN_CONTEXT_KEY=createContextKey(`eve.agent.tool-span-context`),NO_CONTENT_POLICY={recordInputs:!1,recordOutputs:!1};function withAgentToolSpanContext(e,t){return e.setValue(AGENT_TOOL_SPAN_CONTEXT_KEY,t)}function withAgentToolContentPolicy(e,t){let n=agentToolSpanContext(e);return e.setValue(AGENT_TOOL_SPAN_CONTEXT_KEY,{...n,...t})}function agentToolSpanContext(e=context.active()){return e.getValue(AGENT_TOOL_SPAN_CONTEXT_KEY)}function agentToolContentPolicy(e=context.active()){let t=agentToolSpanContext(e);return t===void 0?NO_CONTENT_POLICY:{recordInputs:t.recordInputs,recordOutputs:t.recordOutputs}}function annotateAgentToolSpan(e,t=context.active()){let n=agentToolSpanContext(t)?.setAttributes;return n!==void 0&&(n(e),!0)}function recordAgentToolSpanError(e,t,n=context.active()){let r=agentToolSpanContext(n);return r?.recordError!==void 0&&(r.recordError(r.recordOutputs?e:void 0,t),!0)}export{agentToolContentPolicy,agentToolSpanContext,annotateAgentToolSpan,recordAgentToolSpanError,withAgentToolContentPolicy,withAgentToolSpanContext};
@@ -14,10 +14,6 @@ export type { SpanAttributeDecision, SpanExportAttributeValue, SpanExportContext
14
14
  * set. Destinations are the plural half and live in `otelIntegration()`.
15
15
  *
16
16
  * `contextManager` is deliberately absent: eve's span nesting depends on it.
17
- * `instrumentations` is accepted so providers can opt into Node auto-
18
- * instrumentations (e.g. `@opentelemetry/auto-instrumentations-node`); the
19
- * packages patch modules eve already imported, so their effects are limited
20
- * to code loaded after registration.
21
17
  */
22
18
  export interface OtelOptions {
23
19
  /**
@@ -64,11 +60,10 @@ export interface OtelOptions {
64
60
  readonly propagators?: readonly PropagatorOrName[];
65
61
  /**
66
62
  * OpenTelemetry `Instrumentation` instances passed through to
67
- * `registerOTel`. Use them to patch Node.js built-ins (HTTP, DNS, fs, etc.)
68
- * for automatic spans around outbound work. Disabled by default because eve
69
- * already imports the model SDK before registration, so patching cannot
70
- * reach it — but code loaded after registration (tool modules, connection
71
- * clients) will be instrumented.
63
+ * `registerOTel` before the server entry loads. Disabled by default.
64
+ * Keep packages that rely on Node.js module hooks in
65
+ * `build.externalDependencies` and out of instrumentation modules' import
66
+ * graphs so they load after registration.
72
67
  */
73
68
  readonly instrumentations?: readonly unknown[];
74
69
  }
@@ -1,3 +1,3 @@
1
- import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-Di1u2zKu.js";
1
+ import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-OCHP4s0z.js";
2
2
 
3
3
  export { defaultMessageReducer, useEveAgent };
@@ -1,3 +1,3 @@
1
- import { t as useEveAgent } from "../chunks/use-eve-agent-Di1u2zKu.js";
1
+ import { t as useEveAgent } from "../chunks/use-eve-agent-OCHP4s0z.js";
2
2
 
3
3
  export { useEveAgent };
@@ -18,7 +18,7 @@ export default defineAgent({
18
18
  ```
19
19
 
20
20
  For a static AI Gateway model ID, you can make the same source change from the
21
- project root with `eve set --model anthropic/claude-opus-5.5` or from the local
21
+ project root with `eve set model anthropic/claude-opus-5.5` or from the local
22
22
  dev TUI with `/model anthropic/claude-opus-5.5`.
23
23
 
24
24
  The root `agent.ts` can be omitted when no runtime config is needed. eve then selects its default `agent.ts` source at the same slot, configured with `spacexai/grok-4.7`; authoring the file replaces that source.
@@ -133,7 +133,7 @@ A dynamic model selection can return `reasoning` alongside `model` to override
133
133
  the agent-level setting for that selection. Omitting it inherits the agent setting;
134
134
  `"provider-default"` explicitly uses the provider's default.
135
135
 
136
- Run `eve set --reasoning high` to update this field from the command line.
136
+ Run `eve set model --reasoning high` to update this field from the command line.
137
137
 
138
138
  ## Compaction
139
139
 
@@ -191,8 +191,8 @@ could retry against a fresh quota share. A reply that answers neither option
191
191
  is queued while the existing prompt stays pending; eve does not raise another
192
192
  copy. The reply is processed once the budget is granted.
193
193
 
194
- Sessions that cannot reach a human — task-mode runs such as schedules and
195
- delegated runs without input proxying — skip the prompt and fail the next model
194
+ Sessions that cannot request input from a human, such as markdown schedules and
195
+ delegated runs without input proxying, skip the prompt and fail the next model
196
196
  call with `SESSION_TOKEN_LIMIT_REACHED` for token budgets or
197
197
  `SESSION_TOKEN_COST_LIMIT_REACHED` for model token cost. A delegated task with
198
198
  no inherited quota also fails instead of raising a continuation prompt that
@@ -328,15 +328,14 @@ it falls back to the World's default retention period.
328
328
 
329
329
  `defineAgent` takes a few more fields, all optional. For the exported types, see the [TypeScript API Reference](./reference/typescript-api).
330
330
 
331
- | Field | Type | Default | Description |
332
- | -------------- | --------------------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
333
- | `reasoning` | `AgentReasoningDefinition` | provider default | Provider-agnostic reasoning effort forwarded to the agent's turn model calls. |
334
- | `modelOptions` | `AgentModelOptionsDefinition` | none | Provider option overrides forwarded to the model call. |
335
- | `limits` | `AgentLimitsDefinition` | field-specific | Framework-owned runtime limits. Sessions complete after 30 days by default; usage-limit defaults and inheritance are described above. Set a limit to `false` to disable it. |
336
- | `experimental` | `AgentExperimentalDefinition` | unset | Unstable opt-ins. `workflow.world` selects the Workflow world package on the root agent; `workflow.modelCallsPerStep` batches sequential model calls into a wider replay unit; `workflow.retention` controls how long the durable runtime keeps run data. |
337
- | `outputSchema` | Standard Schema or a JSON Schema object | none | Structured return type for function-like invocations such as a subagent turn, schedule, or remote job. Ordinary interactive turns ignore it unless the client supplies a per-message schema. |
338
- | `build` | `{ externalDependencies?: string[] }` | none | Hosted-build packaging controls. `externalDependencies` keeps listed packages external while eve compiles authored modules such as tools and channels, and traces those packages into the hosted output. |
339
- | `tool` | `boolean` | `true` | Exposes this agent to its parent model as a tool. On the root agent, controls the built-in `agent` tool. A subagent with `tool: false` remains callable from authored workflow tools through `ctx.agent()`. |
331
+ | Field | Type | Default | Description |
332
+ | -------------- | ------------------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
333
+ | `reasoning` | `AgentReasoningDefinition` | provider default | Provider-agnostic reasoning effort forwarded to the agent's turn model calls. |
334
+ | `modelOptions` | `AgentModelOptionsDefinition` | none | Provider option overrides forwarded to the model call. |
335
+ | `limits` | `AgentLimitsDefinition` | field-specific | Framework-owned runtime limits. Sessions complete after 30 days by default; usage-limit defaults and inheritance are described above. Set a limit to `false` to disable it. |
336
+ | `experimental` | `AgentExperimentalDefinition` | unset | Unstable opt-ins. `workflow.world` selects the Workflow world package on the root agent; `workflow.modelCallsPerStep` batches sequential model calls into a wider replay unit; `workflow.retention` controls how long the durable runtime keeps run data. |
337
+ | `build` | `{ externalDependencies?: string[] }` | none | Hosted-build packaging controls. `externalDependencies` keeps listed packages external while eve compiles authored modules such as tools and channels, and traces those packages into the hosted output. |
338
+ | `tool` | `boolean` | `true` | Exposes this agent to its parent model as a tool. On the root agent, controls the built-in `agent` tool. A subagent with `tool: false` remains callable from authored workflow tools through `ctx.agent()`. |
340
339
 
341
340
  `externalDependencies` is a packaging control only. It keeps selected packages as runtime dependencies in the hosted output; it does not authorize, configure, or review any third-party service those packages may call.
342
341
 
@@ -104,7 +104,7 @@ bot.onNewMention(async (thread, message) => {
104
104
  });
105
105
  ```
106
106
 
107
- `options` accepts `{ thread, auth?, title?, mode?, callback?, adapterName?, turnPolicy? }`. `title` sets the eve session's display title without changing the model message; `auth` attaches an authenticated principal to the turn.
107
+ `options` accepts `{ thread, auth?, title?, callback?, adapterName?, turnPolicy? }`. `title` sets the eve session's display title without changing the model message; `auth` attaches an authenticated principal to the turn.
108
108
 
109
109
  ### Steering
110
110
 
@@ -334,7 +334,7 @@ export default defineChannel({
334
334
  });
335
335
  ```
336
336
 
337
- The input contains the channel's `state`, `caller`, `channel`, `mode`, and `environment`. A principal caller omits `principalId`, `issuer`, and `subject`, but its `attributes` come from route auth and can still contain identifying values. Return `"public"`, `"private"`, or `"unknown"`. Return `"unknown"` when the channel does not have enough evidence to classify confidently; consumers treat it as non-public. A missing, throwing, asynchronous, or malformed classifier also fails closed to `"unknown"`.
337
+ The input contains the channel's `state`, `caller`, `channel`, and `environment`. A principal caller omits `principalId`, `issuer`, and `subject`, but its `attributes` come from route auth and can still contain identifying values. Return `"public"`, `"private"`, or `"unknown"`. Return `"unknown"` when the channel does not have enough evidence to classify confidently; consumers treat it as non-public. A missing, throwing, asynchronous, or malformed classifier also fails closed to `"unknown"`.
338
338
 
339
339
  When you explicitly annotate a callback, use `AudienceContext<TState>`. `AudienceInput<TState>` remains supported for existing callbacks while you migrate.
340
340
 
@@ -49,8 +49,8 @@ See [Start a session](../concepts/sessions-runs-and-streaming#start-a-session) f
49
49
  initialization boundary, first-turn identity, readiness response, and retry behavior.
50
50
 
51
51
  The create request still requires route auth. Session audience and the timeout are selected
52
- at creation; they do not change when the first message arrives. Task mode and turn-scoped
53
- fields such as `clientContext` and `outputSchema` require a message on the create request.
52
+ at creation; they do not change when the first message arrives. Turn-scoped fields such as
53
+ `clientContext` and `outputSchema` require a message on the create request.
54
54
 
55
55
  Include an initial message to create the session and start its first turn in one request:
56
56
 
@@ -200,8 +200,8 @@ call the endpoint. `auth` still controls access. For a classification that
200
200
  depends on channel state or application-specific verified data, use a [custom
201
201
  channel audience](./custom#conversation-audience).
202
202
 
203
- You can also pass a function that receives `caller`, channel, run mode, and
204
- deployment environment. Classification is fixed at session creation, so a later
203
+ You can also pass a function that receives `caller`, channel, and deployment
204
+ environment. Classification is fixed at session creation, so a later
205
205
  turn from a different caller does not reclassify the session.
206
206
 
207
207
  For a remote agent, a trusted dispatch can forward the original audience and
@@ -168,7 +168,7 @@ MCP clients receive four tools:
168
168
 
169
169
  | Tool | Input | Purpose |
170
170
  | -------------- | ----------------------------- | ----------------------------------------------------------- |
171
- | `agent_start` | `{ message, outputSchema? }` | Start durable work and immediately return an invocation ID. |
171
+ | `agent_start` | `{ message }` | Start durable work and immediately return an invocation ID. |
172
172
  | `agent_get` | `{ invocationId }` | Read the invocation's complete current state. |
173
173
  | `agent_update` | `{ invocationId, responses }` | Answer the complete pending human-input batch. |
174
174
  | `agent_cancel` | `{ invocationId }` | Request cooperative cancellation of non-terminal work. |
@@ -177,7 +177,7 @@ The server also returns `instructions` from `initialize` and `server/discover` t
177
177
  protocol for the connecting model, so a hosted client does not have to infer it from the tool
178
178
  schemas alone.
179
179
 
180
- `agent_start` creates one task-mode eve session and returns after durable acceptance without
180
+ `agent_start` creates one eve session and returns after durable acceptance without
181
181
  waiting for the session continuation hook to become readable. Keep its `invocationId`, then call
182
182
  `agent_get` until the invocation reaches a terminal state. While the status is `working`, wait at
183
183
  least `pollAfterMs` before polling again.
@@ -187,22 +187,22 @@ The invocation response is discriminated by `status`:
187
187
  - `working`: work is active; continue polling according to `pollAfterMs`.
188
188
  - `input_required`: present `inputRequests`, then send the complete answer batch through `agent_update`. A successful update returns the current invocation state.
189
189
  - `authorization_required`: present the returned sign-in URL, user code, or instructions. The connection callback resumes the invocation automatically; continue polling.
190
- - `completed`: consume the optional `result`.
190
+ - `completed`: the agent's turn settled. Consume the optional `result`: the final assistant message.
191
191
  - `failed`: inspect the structured `error`.
192
192
  - `cancelled`: cancellation reached a terminal state.
193
193
 
194
194
  A tool result with `isError: true` means the call itself was rejected. A `failed` status means the call succeeded and the task itself failed. Handle them differently: correct the call in the first case, report the task failure in the second. Rejected calls carry `structuredContent.error` with a stable `code`, a short `message`, and `retryable`:
195
195
 
196
- | `code` | Meaning | `retryable` |
197
- | --------------- | ------------------------------------------------------------------------------ | ----------- |
198
- | `invalid_input` | An argument was rejected, for example an oversized or external `outputSchema`. | `false` |
199
- | `not_found` | The invocation does not exist, has expired, or belongs to another caller. | `false` |
200
- | `conflict` | The invocation is not in the expected state; read it with `agent_get` first. | `true` |
201
- | `internal` | eve failed; `errorId` correlates with server logs. No details are exposed. | `false` |
196
+ | `code` | Meaning | `retryable` |
197
+ | --------------- | ---------------------------------------------------------------------------- | ----------- |
198
+ | `invalid_input` | An argument was rejected, for example an oversized `message`. | `false` |
199
+ | `not_found` | The invocation does not exist, has expired, or belongs to another caller. | `false` |
200
+ | `conflict` | The invocation is not in the expected state; read it with `agent_get` first. | `true` |
201
+ | `internal` | eve failed; `errorId` correlates with server logs. No details are exposed. | `false` |
202
202
 
203
203
  Cancellation is cooperative, so call `agent_get` after `agent_cancel` until the state becomes terminal.
204
204
 
205
- Requests are bounded: the whole MCP request body is limited to 1 MiB, `message` to 64 KiB, each input-response `text` to 16 KiB (both measured as UTF-8 bytes, not characters), and one `agent_update` to 64 responses. Optional output schemas are limited to 64 KiB, 32 levels, and 2,048 nodes, and external `$ref` values are rejected. Oversized bodies receive a JSON-RPC `413`; oversized fields fail input validation before any work starts.
205
+ Requests are bounded: the whole MCP request body is limited to 1 MiB, `message` to 64 KiB, each input-response `text` to 16 KiB (both measured as UTF-8 bytes, not characters), and one `agent_update` to 64 responses. Oversized bodies receive a JSON-RPC `413`; oversized fields fail input validation before any work starts.
206
206
 
207
207
  ### Durability guarantees
208
208
 
@@ -187,7 +187,7 @@ export default slackChannel({
187
187
 
188
188
  The model-visible `<slack_message>` includes `sender_id`, `bot_user_id` when available, and the `is_mentioned` value from `ctx.isBotMentioned()`. Its `<content>` keeps `<@USER_ID>` intact while converting other mrkdwn to Markdown; routing is unchanged.
189
189
 
190
- When a Slack message shares another Slack message, eve extracts the forwarded message body from Slack's message-unfurl attachment and includes it in `<content>`. The original top-level comment, when present, remains alongside the forwarded content.
190
+ When a Slack message includes a link preview, eve includes its attachment text in `<content>` alongside the sender's message, including when the link has words around it. Shared Slack messages work the same way: eve extracts the forwarded message body from Slack's message-unfurl attachment and keeps any top-level comment.
191
191
 
192
192
  #### Restrict who can invoke the agent
193
193
 
@@ -41,8 +41,8 @@ curl -X POST http://127.0.0.1:2000/eve/v1/session
41
41
 
42
42
  eve starts the durable workflow, establishes its inbox, and waits for the first message before
43
43
  running session-scoped initialization or emitting `session.started`. The first message sent to the returned
44
- `sessionId` remains `turn_0`. Message-free creation supports conversation mode only and does not
45
- accept turn-scoped `clientContext`, `outputSchema`, callbacks, or activity observers.
44
+ `sessionId` remains `turn_0`. Message-free creation does not accept turn-scoped `clientContext`,
45
+ `outputSchema`, callbacks, or activity observers.
46
46
 
47
47
  To create the session and start its first turn in one request, include the message:
48
48
 
@@ -86,8 +86,8 @@ The stream is newline-delimited JSON (NDJSON), one event per line:
86
86
  | `message.appended` | An assistant text delta. |
87
87
  | `message.completed` | A finalized assistant text block. |
88
88
  | `result.completed` | The finalized structured result for a turn that requested an output schema; carries `result`. |
89
- | `compaction.requested` | Context-window compaction began; carries `modelId`, `sessionId`, `turnId`, `usageInputTokens`. |
90
- | `compaction.completed` | A compaction checkpoint was written to durable history. |
89
+ | `compaction.requested` | Context-window compaction began; carries `modelId`, `sessionId`, `turnId`, `stepIndex`, and `usageInputTokens`. |
90
+ | `compaction.completed` | A compaction checkpoint was written to durable history; carries the same model, session, turn, and step identity. |
91
91
  | `authorization.required` | A connection needs OAuth; carries `name`, `description`, and an `authorization` challenge. |
92
92
  | `authorization.completed` | A connection's authorization resolved; carries `outcome`. |
93
93
  | `step.completed` | A model step finished; carries `finishReason` and usage. |
@@ -128,8 +128,7 @@ A provider response ending with `content-filter` fails with `MODEL_CALL_FAILED`,
128
128
  `details.finishReason: "content-filter"`. Details also include the Gateway
129
129
  `generationId` when available. eve does not retry the filtered response or emit
130
130
  `message.completed` for its partial text; deltas already streamed remain visible.
131
- Conversation sessions wait for another user message, while task-mode runs return
132
- a failed result.
131
+ The session then waits for another user message.
133
132
 
134
133
  ## The event envelope
135
134
 
@@ -58,6 +58,28 @@ must also set `instanceKey` to a stable, non-secret account or tenant identifier
58
58
  See [Dynamic capabilities](/docs/guides/dynamic-capabilities#dynamic-connections)
59
59
  for event scope, naming, conflicts, and durable recovery behavior.
60
60
 
61
+ Tools from a `turn.started` connection can require approval, including an
62
+ `approval.response` policy. When an approval resumes between turns, eve rebuilds
63
+ the connection callbacks before checking the response policy, even in a fresh
64
+ process. This restoration uses the pending request's turn coordinates and the
65
+ current authenticated session context; it does not emit another public
66
+ `turn.started` event. The response policy still receives the authenticated
67
+ responder separately. When one delivery answers requests from different turns,
68
+ eve restores each candidate's originating connection scope before its policy
69
+ check, then prepares the complete batch selected for tool replay. Keep connection
70
+ resolvers idempotent because restoration can run them again.
71
+
72
+ Restoration uses current resolver results, not a historical connection snapshot.
73
+ If the tool is absent from the persisted tool metadata, or its required response
74
+ policy is unavailable, eve refuses the response and leaves the request pending.
75
+ eve does not reconstruct missing tool metadata from earlier turns. Before replay, eve checks that the
76
+ approved tool is still available and that its connection identity has not
77
+ changed since the call requested approval. A missing or changed connection
78
+ fails the replay rather than sending the call to a replacement destination.
79
+ Request a new tool call and approval after correcting the connection. Identity
80
+ includes the endpoint and `instanceKey`; use a distinct `instanceKey` for each
81
+ account or tenant even when they share an endpoint.
82
+
61
83
  ## Static-token auth
62
84
 
63
85
  `getToken` returns a `TokenResult` (`{ token, expiresAt? }`), and eve sends it as `Authorization: Bearer <token>` on every request. Because it runs on each connection attempt, you can mint a fresh token from wherever you keep secrets, including an env var, a secrets manager, an internal vault, or your own OAuth exchange:
@@ -47,7 +47,7 @@ curl https://your_agent.example.com/eve/v1/health
47
47
  Then connect the development terminal user interface (TUI) to the deployment and send a real message:
48
48
 
49
49
  ```bash
50
- eve dev https://your_agent.example.com
50
+ eve remote connect --url https://your_agent.example.com
51
51
  ```
52
52
 
53
53
  Set `VERCEL_AUTOMATION_BYPASS_SECRET` locally first if a Vercel deployment uses Deployment Protection.
@@ -116,7 +116,7 @@ curl https://your_agent.example.com/eve/v1/health
116
116
  Then connect the development TUI and complete a real turn:
117
117
 
118
118
  ```bash
119
- eve dev https://your_agent.example.com
119
+ eve remote connect --url https://your_agent.example.com
120
120
  ```
121
121
 
122
122
  ## Continue configuring production
@@ -143,14 +143,14 @@ For a single unnamed agent, check the health route and connect the development T
143
143
 
144
144
  ```bash
145
145
  curl https://your_agent.vercel.app/eve/v1/health
146
- eve dev https://your_agent.vercel.app
146
+ eve remote connect --url https://your_agent.vercel.app
147
147
  ```
148
148
 
149
149
  For a workspace agent, include its public `/eve/<name>` mount. For example:
150
150
 
151
151
  ```bash
152
152
  curl https://your_agent.vercel.app/eve/support/v1/health
153
- eve dev https://your_agent.vercel.app/eve/support
153
+ eve remote connect --url https://your_agent.vercel.app/eve/support
154
154
  ```
155
155
 
156
156
  Set `VERCEL_AUTOMATION_BYPASS_SECRET` locally before connecting if the deployment uses Deployment Protection.
@@ -31,7 +31,7 @@ The transcript remains in your terminal scrollback after you exit. Run `/help` i
31
31
  | `/help` | List available commands. |
32
32
  | `/exit` | Quit the UI. |
33
33
 
34
- `/login`, `/model`, `/add`, `/deploy`, `/info`, and `/traces` are available when `eve dev` runs locally. They are unavailable when the UI connects to a server with `--url`.
34
+ `/login`, `/model`, `/add`, `/deploy`, `/info`, and `/traces` are available when `eve dev` runs locally. They are unavailable when the UI connects through `eve remote connect`.
35
35
 
36
36
  ## Set up a new agent
37
37
 
@@ -131,19 +131,19 @@ Use `--host` and `--port` to bind the local server, or `--no-ui` to run without
131
131
  Pass a URL to use the terminal UI with an existing eve server instead of starting one locally:
132
132
 
133
133
  ```bash
134
- eve dev https://your-app.vercel.app
134
+ eve remote connect --url https://your-app.vercel.app
135
135
  ```
136
136
 
137
- The URL form is shorthand for `--url`. To send credentials or custom request headers, use a URL with HTTP Basic credentials or repeat `-H, --header`:
137
+ Use `eve remote connect` for an existing agent. To send credentials or custom request headers, use a URL with HTTP Basic credentials or repeat `-H, --header`:
138
138
 
139
139
  ```bash
140
- eve dev https://user:pass@your-app.example.com
141
- eve dev https://your-app.example.com -H 'Authorization: Bearer your_token_here'
140
+ eve remote connect --url https://user:pass@your-app.example.com
141
+ eve remote connect --url https://your-app.example.com -H 'Authorization: Bearer your_token_here'
142
142
  ```
143
143
 
144
144
  Remote Vercel sessions reuse an existing authorized CLI session. They do not open an account login flow or modify the local project's Vercel link or `.env.local`.
145
145
 
146
- When Deployment Protection blocks startup, eve verifies the target project and asks before adding a Trusted Sources rule for development access to that deployment's environment. After approval, eve applies the rule and checks access again before returning to chat. Cancelling preserves your draft; restart `eve dev <url>` to try again. If you cannot change the project's policy, provide `VERCEL_AUTOMATION_BYPASS_SECRET` or ask a project administrator to configure access in Deployment Protection settings.
146
+ When Deployment Protection blocks startup, eve verifies the target project and asks before adding a Trusted Sources rule for development access to that deployment's environment. After approval, eve applies the rule and checks access again before returning to chat. Cancelling preserves your draft; restart `eve remote connect --url <url>` to try again. If you cannot change the project's policy, provide `VERCEL_AUTOMATION_BYPASS_SECRET` or ask a project administrator to configure access in Deployment Protection settings.
147
147
 
148
148
  ## What to read next
149
149
 
@@ -126,8 +126,8 @@ export default defineDynamic({
126
126
  });
127
127
  ```
128
128
 
129
- The returned remote definition can change its URL, path, headers, auth,
130
- principal forwarding, and output schema. Function-valued URLs resolve when the
129
+ The returned remote definition can change its URL, path, headers, auth, and
130
+ principal forwarding. Function-valued URLs resolve when the
131
131
  dynamic event runs. Auth and headers remain lazy and resolve before each
132
132
  outbound request without entering durable workflow state.
133
133
 
@@ -229,8 +229,10 @@ const pendingRequests = agent.data.messages
229
229
  return request ? [request] : [];
230
230
  });
231
231
 
232
+ const inputDisabled = ["submitted", "streaming", "resuming"].includes(agent.status);
233
+
232
234
  return pendingRequests.map((request) => (
233
- <fieldset key={request.requestId}>
235
+ <fieldset disabled={inputDisabled} key={request.requestId}>
234
236
  <legend>
235
237
  {request.kind === "tool-approval"
236
238
  ? "Approval required"
@@ -252,7 +254,7 @@ return pendingRequests.map((request) => (
252
254
  ));
253
255
  ```
254
256
 
255
- For a question with `allowFreeform`, render a text input and send `{ requestId, text }`. The default reducer marks each matching part as responded immediately. Approved tools update again when eve streams their result.
257
+ For a question with `allowFreeform`, render a text input and send `{ requestId, text }`. The default reducer keeps each request pending until the server confirms its resolution through `input.resolved` or `approval.settled`. Disable input controls while the response is being processed; a refused approval attempt leaves the request answerable. Approved tools update again when eve streams their result.
256
258
 
257
259
  ## Authorization prompts
258
260
 
@@ -348,7 +350,7 @@ const agent = useEveAgent({ reducer: toolCounter });
348
350
  // agent.data is ToolLog
349
351
  ```
350
352
 
351
- `reduce(data, event)` receives both authoritative eve stream events and client projection events (`client.message.submitted`, `client.message.failed`, `client.input.responded`). `client.input.responded` updates the submitting UI immediately; the durable `input.resolved` event later confirms the server-accepted outcome and lets replayed history rebuild the same HITL state. Return `data` unchanged for events your reducer does not handle.
353
+ `reduce(data, event)` receives both authoritative eve stream events and client projection events (`client.message.submitted`, `client.message.failed`, `client.input.responded`). `client.input.responded` notifies custom reducers that an answer was submitted, not that it was accepted. The default reducer waits for server settlement; the durable `input.resolved` event records the server-accepted outcome and lets replayed history rebuild the same HITL state. Return `data` unchanged for events your reducer does not handle.
352
354
 
353
355
  ## Resumable sessions
354
356
 
@@ -181,14 +181,16 @@ Hooks always run after the event is durably recorded, so if a hook throws, the s
181
181
 
182
182
  ## What happens when a hook throws
183
183
 
184
- A thrown handler during a model turn propagates through turn execution and surfaces as `turn.failed`. In a conversation session, this includes handlers for `turn.started` and the first `step.started` of a model call: the failed turn ends with `session.waiting`, and the next message can start another turn. Task-mode boundary failures remain terminal. If a hook subscribed to a failure-cascade event also throws, it escalates to `session.failed`. For belt-and-suspenders semantics inside a hook, wrap the body in `try`/`catch`. eve treats a thrown hook as a real failure.
184
+ A thrown handler during a model turn propagates through turn execution and surfaces as `turn.failed`. This includes handlers for `turn.started` and the first `step.started` of a model call: the failed turn ends with `session.waiting`, and the next message can start another turn. If a hook subscribed to a failure-cascade event also throws, it escalates to `session.failed`. For belt-and-suspenders semantics inside a hook, wrap the body in `try`/`catch`. eve treats a thrown hook as a real failure.
185
185
 
186
- For `subagent.called` and `subagent.completed`, a thrown handler fails the notification step and follows the workflow runtime's step retry policy. A retry can publish the event again before rerunning its hooks. Parent execution waits for the notification step to finish or exhaust its retries.
186
+ For `subagent.called`, `subagent.completed`, and events proxied from a child, a thrown handler fails the publishing step and follows the workflow runtime's step retry policy. A retry can publish the event again before rerunning its hooks. Parent execution waits for the publishing step to finish or exhaust its retries. Exhausting retries fails the session.
187
187
 
188
188
  ## Subagent isolation
189
189
 
190
190
  Subagents may carry their own `agent/hooks/` directory. Subagent hooks fire only inside the subagent scope. Parent-agent hooks do not fire for subagent turns, and subagent hooks see only the subagent's own context.
191
191
 
192
+ Interactive events such as `input.requested` and `authorization.required` are also published on the parent stream. Parent hooks observe these events after the parent channel handler and stream write, with the parent's session, agent, and channel context. The event retains the child's turn coordinates, so `event.data.turnId` can differ from `ctx.session.turn.id`. The accompanying parent `turn.completed` and `session.waiting` events also invoke parent hooks; they do not resolve pending input requests.
193
+
192
194
  ## Hook vs tool vs provider
193
195
 
194
196
  | Need | Use |
@@ -19,13 +19,6 @@ Agent Runs usage is billed at
19
19
  [Always-on Tracing rates](https://vercel.com/docs/tracing/always-on-tracing#usage-and-pricing)
20
20
  during beta. All plans include 30-day Agent Runs retention during beta.
21
21
 
22
- ## Configure Agent Runs
23
-
24
- Preview and production deployments export to Vercel Agent Runs by default.
25
- Omitting `agent/instrumentation/agent-runs.ts` preserves that default. Export
26
- `agentRuns(...)` from that file to reconfigure it, or export
27
- `disableInstrumentation()` to disable it.
28
-
29
22
  ## Enable tracing on Vercel
30
23
 
31
24
  When `eve deploy` creates a new Vercel project, it configures 100% trace
@@ -47,6 +40,13 @@ Tracing starts as soon as you save the rule. You can also manage sampling
47
40
  rules with [`vercel traces config`](https://vercel.com/docs/cli/traces#manage-trace-sampling-rules).
48
41
  The CLI accepts rates from 1 to 100%; add a 0% rule from the dashboard.
49
42
 
43
+ ## Configure Agent Runs
44
+
45
+ Preview and production deployments export to Vercel Agent Runs by default.
46
+ Omit `agent/instrumentation/agent-runs.ts` to keep that default. To change it,
47
+ default-export `agentRuns(...)` from that file, or default-export
48
+ `disableInstrumentation()` to turn off Agent Runs export.
49
+
50
50
  ## Filter Agent Runs exports
51
51
 
52
52
  `agentRuns()` accepts one `exportPolicy` object or an array applied in order.