eve 0.47.7 → 0.49.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 (429) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/src/channel/channel-address.js +1 -1
  3. package/dist/src/channel/delivery-metadata.d.ts +1 -0
  4. package/dist/src/channel/delivery-metadata.js +1 -1
  5. package/dist/src/channel/types.d.ts +20 -8
  6. package/dist/src/chunks/{use-eve-agent-Dg5S44kG.js → use-eve-agent-BZnOzAVd.js} +25 -5
  7. package/dist/src/chunks/{use-eve-agent-B5zw1dwj.js → use-eve-agent-Bgp6INfi.js} +25 -5
  8. package/dist/src/cli/commands/init.js +1 -1
  9. package/dist/src/cli/commands/integration-connect.d.ts +2 -1
  10. package/dist/src/cli/commands/integration-connect.js +1 -1
  11. package/dist/src/cli/commands/register-integration-commands.d.ts +3 -1
  12. package/dist/src/cli/commands/register-integration-commands.js +1 -1
  13. package/dist/src/cli/commands/registry-metadata.d.ts +30 -0
  14. package/dist/src/cli/commands/registry-metadata.js +1 -1
  15. package/dist/src/cli/commands/registry-package.d.ts +6 -0
  16. package/dist/src/cli/commands/registry-package.js +1 -1
  17. package/dist/src/cli/commands/registry-pnpm-build-policy-flow.d.ts +30 -0
  18. package/dist/src/cli/commands/registry-pnpm-build-policy-flow.js +1 -0
  19. package/dist/src/cli/commands/registry-pnpm-build-policy.d.ts +12 -0
  20. package/dist/src/cli/commands/registry-pnpm-build-policy.js +6 -0
  21. package/dist/src/cli/commands/registry-recovery.d.ts +4 -0
  22. package/dist/src/cli/commands/registry-recovery.js +1 -1
  23. package/dist/src/cli/commands/registry.d.ts +1 -1
  24. package/dist/src/cli/commands/registry.js +1 -1
  25. package/dist/src/cli/dev/command-options.d.ts +2 -0
  26. package/dist/src/cli/dev/run-interactive-ui.js +1 -1
  27. package/dist/src/cli/dev/tui/blocks.js +1 -1
  28. package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
  29. package/dist/src/cli/dev/tui/registry-result-message.d.ts +17 -0
  30. package/dist/src/cli/dev/tui/registry-result-message.js +3 -0
  31. package/dist/src/cli/dev/tui/runner.d.ts +11 -4
  32. package/dist/src/cli/dev/tui/runner.js +1 -1
  33. package/dist/src/cli/dev/tui/setup-commands.d.ts +9 -3
  34. package/dist/src/cli/dev/tui/setup-commands.js +2 -3
  35. package/dist/src/cli/dev/tui/setup-flow.d.ts +15 -5
  36. package/dist/src/cli/dev/tui/setup-panel.d.ts +6 -1
  37. package/dist/src/cli/dev/tui/setup-panel.js +4 -4
  38. package/dist/src/cli/dev/tui/setup-selection-input.d.ts +1 -0
  39. package/dist/src/cli/dev/tui/setup-selection-input.js +1 -1
  40. package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
  41. package/dist/src/cli/dev/tui/tui-prompter.js +1 -1
  42. package/dist/src/cli/dev/tui/tui.d.ts +3 -4
  43. package/dist/src/cli/dev/tui/tui.js +1 -1
  44. package/dist/src/cli/run.js +2 -2
  45. package/dist/src/client/agent-info-schema.d.ts +1 -0
  46. package/dist/src/client/agent-info-schema.js +1 -1
  47. package/dist/src/client/open-stream.d.ts +1 -0
  48. package/dist/src/client/open-stream.js +1 -1
  49. package/dist/src/client/session.js +1 -1
  50. package/dist/src/compiled/.vendor-stamp.json +7 -6
  51. package/dist/src/compiled/@opentelemetry/api/index.d.ts +6 -0
  52. package/dist/src/compiled/@workflow/builders/LICENSE.md +201 -0
  53. package/dist/src/compiled/@workflow/builders/index.d.ts +62 -0
  54. package/dist/src/compiled/@workflow/builders/index.js +1 -0
  55. package/dist/src/compiled/@workflow/core/attribute-changes.d.ts +2 -4
  56. package/dist/src/compiled/@workflow/core/capabilities.d.ts +10 -9
  57. package/dist/src/compiled/@workflow/core/capture-stack.d.ts +1 -1
  58. package/dist/src/compiled/@workflow/core/class-serialization.d.ts +8 -8
  59. package/dist/src/compiled/@workflow/core/context-violation-error.d.ts +5 -5
  60. package/dist/src/compiled/@workflow/core/create-hook.d.ts +2 -2
  61. package/dist/src/compiled/@workflow/core/describe-error.d.ts +7 -7
  62. package/dist/src/compiled/@workflow/core/encryption.d.ts +5 -5
  63. package/dist/src/compiled/@workflow/core/events-consumer.d.ts +49 -14
  64. package/dist/src/compiled/@workflow/core/flushable-stream.d.ts +4 -4
  65. package/dist/src/compiled/@workflow/core/global.d.ts +4 -2
  66. package/dist/src/compiled/@workflow/core/index.d.ts +1 -1
  67. package/dist/src/compiled/@workflow/core/index.js +2 -2
  68. package/dist/src/compiled/@workflow/core/log-format.d.ts +2 -2
  69. package/dist/src/compiled/@workflow/core/private.d.ts +40 -78
  70. package/dist/src/compiled/@workflow/core/private.js +1 -1
  71. package/dist/src/compiled/@workflow/core/replay-payload-cache.d.ts +13 -17
  72. package/dist/src/compiled/@workflow/core/runtime/compute-instance.d.ts +4 -3
  73. package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +27 -27
  74. package/dist/src/compiled/@workflow/core/runtime/count-step-started-events.d.ts +7 -7
  75. package/dist/src/compiled/@workflow/core/runtime/deployment-guard.d.ts +7 -7
  76. package/dist/src/compiled/@workflow/core/runtime/get-port-lazy.d.ts +2 -2
  77. package/dist/src/compiled/@workflow/core/runtime/get-world-lazy.d.ts +2 -2
  78. package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +30 -49
  79. package/dist/src/compiled/@workflow/core/runtime/quickjs-entrypoint.d.ts +21 -10
  80. package/dist/src/compiled/@workflow/core/runtime/quickjs-runtime.d.ts +31 -15
  81. package/dist/src/compiled/@workflow/core/runtime/quickjs-serde.d.ts +10 -10
  82. package/dist/src/compiled/@workflow/core/runtime/replay-budget.d.ts +4 -4
  83. package/dist/src/compiled/@workflow/core/runtime/replay-recovery-reporter.d.ts +1 -1
  84. package/dist/src/compiled/@workflow/core/runtime/resume-hook.d.ts +20 -12
  85. package/dist/src/compiled/@workflow/core/runtime/resume-latency.d.ts +37 -30
  86. package/dist/src/compiled/@workflow/core/runtime/run-id-time.d.ts +2 -2
  87. package/dist/src/compiled/@workflow/core/runtime/run.d.ts +22 -5
  88. package/dist/src/compiled/@workflow/core/runtime/runs.d.ts +4 -4
  89. package/dist/src/compiled/@workflow/core/runtime/start.d.ts +3 -3
  90. package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +14 -14
  91. package/dist/src/compiled/@workflow/core/runtime/step-latency.d.ts +42 -25
  92. package/dist/src/compiled/@workflow/core/runtime/step-ownership.d.ts +6 -6
  93. package/dist/src/compiled/@workflow/core/runtime/step-single-flight.d.ts +1 -1
  94. package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +38 -24
  95. package/dist/src/compiled/@workflow/core/runtime/unserializable-step.d.ts +34 -0
  96. package/dist/src/compiled/@workflow/core/runtime/vm-mode.d.ts +2 -2
  97. package/dist/src/compiled/@workflow/core/runtime/wait-continuation.d.ts +31 -9
  98. package/dist/src/compiled/@workflow/core/runtime/wait-until.d.ts +1 -1
  99. package/dist/src/compiled/@workflow/core/runtime/world-compatibility.d.ts +20 -9
  100. package/dist/src/compiled/@workflow/core/runtime/world-init.d.ts +5 -5
  101. package/dist/src/compiled/@workflow/core/runtime.js +3 -3
  102. package/dist/src/compiled/@workflow/core/sealed-box.d.ts +7 -7
  103. package/dist/src/compiled/@workflow/core/serialization/codec-devalue-vm.d.ts +1 -1
  104. package/dist/src/compiled/@workflow/core/serialization/codec-devalue.d.ts +1 -1
  105. package/dist/src/compiled/@workflow/core/serialization/codec.d.ts +4 -4
  106. package/dist/src/compiled/@workflow/core/serialization/compression.d.ts +12 -11
  107. package/dist/src/compiled/@workflow/core/serialization/encryption.d.ts +7 -7
  108. package/dist/src/compiled/@workflow/core/serialization/format.d.ts +6 -6
  109. package/dist/src/compiled/@workflow/core/serialization/hardened.d.ts +23 -22
  110. package/dist/src/compiled/@workflow/core/serialization/index.d.ts +1 -1
  111. package/dist/src/compiled/@workflow/core/serialization/reducers/class-vm.d.ts +1 -1
  112. package/dist/src/compiled/@workflow/core/serialization/reducers/step-function-vm.d.ts +1 -1
  113. package/dist/src/compiled/@workflow/core/serialization/types.d.ts +5 -5
  114. package/dist/src/compiled/@workflow/core/serialization/workflow-vm.d.ts +1 -1
  115. package/dist/src/compiled/@workflow/core/serialization-format.d.ts +11 -11
  116. package/dist/src/compiled/@workflow/core/serialization.d.ts +18 -19
  117. package/dist/src/compiled/@workflow/core/source-map.d.ts +1 -1
  118. package/dist/src/compiled/@workflow/core/step/context-storage.d.ts +5 -5
  119. package/dist/src/compiled/@workflow/core/step/writable-stream.d.ts +3 -3
  120. package/dist/src/compiled/@workflow/core/symbols.d.ts +2 -2
  121. package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +71 -20
  122. package/dist/src/compiled/@workflow/core/telemetry.d.ts +15 -3
  123. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  124. package/dist/src/compiled/@workflow/core/vm/script-cache.d.ts +9 -11
  125. package/dist/src/compiled/@workflow/core/workflow/abort-controller.d.ts +1 -1
  126. package/dist/src/compiled/@workflow/core/workflow/set-attributes.d.ts +1 -1
  127. package/dist/src/compiled/@workflow/core/workflow/world-init-stub.d.ts +1 -1
  128. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  129. package/dist/src/compiled/@workflow/errors/index.d.ts +18 -18
  130. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  131. package/dist/src/compiled/@workflow/world/analytics.d.ts +3 -2
  132. package/dist/src/compiled/@workflow/world/attributes-validation.d.ts +28 -0
  133. package/dist/src/compiled/@workflow/world/attributes.d.ts +8 -107
  134. package/dist/src/compiled/@workflow/world/env-config.d.ts +5 -5
  135. package/dist/src/compiled/@workflow/world/event-metadata.d.ts +132 -0
  136. package/dist/src/compiled/@workflow/world/events.d.ts +42 -96
  137. package/dist/src/compiled/@workflow/world/hooks.d.ts +12 -11
  138. package/dist/src/compiled/@workflow/world/index.d.ts +3 -3
  139. package/dist/src/compiled/@workflow/world/interfaces.d.ts +94 -39
  140. package/dist/src/compiled/@workflow/world/queue.d.ts +29 -22
  141. package/dist/src/compiled/@workflow/world/runs.d.ts +20 -0
  142. package/dist/src/compiled/@workflow/world/slot-identity.d.ts +3 -3
  143. package/dist/src/compiled/@workflow/world/spec-version.d.ts +82 -15
  144. package/dist/src/compiled/@workflow/world/ulid.d.ts +2 -2
  145. package/dist/src/compiled/@workflow/world-local/index.js +5 -5
  146. package/dist/src/compiled/@workflow/world-vercel/index.js +12 -12
  147. package/dist/src/compiled/_chunks/workflow/{attribute-changes-DXbpwBdw.js → attribute-changes-BwAadFfB.js} +3 -3
  148. package/dist/src/compiled/_chunks/workflow/debug-log-CVPstO1D.js +1 -0
  149. package/dist/src/compiled/_chunks/workflow/dist-CgbVZs5l.js +40 -0
  150. package/dist/src/compiled/_chunks/workflow/dist-DjojkP5e.js +3 -0
  151. package/dist/src/compiled/_chunks/workflow/frames-CZ9eHShe.js +3 -0
  152. package/dist/src/compiled/_chunks/workflow/global-singleton-BNinwFrL.js +1 -0
  153. package/dist/src/compiled/_chunks/workflow/private-CZFMABEf.js +1 -0
  154. package/dist/src/compiled/_chunks/workflow/resume-hook-BToMtPbH.js +1 -0
  155. package/dist/src/compiled/_chunks/workflow/run-DzyAoGh4.js +1 -0
  156. package/dist/src/compiled/_chunks/workflow/sleep-3_A5uOp-.js +1 -0
  157. package/dist/src/compiled/_chunks/workflow/undici-DfxNX5og.js +95 -0
  158. package/dist/src/compiled/_chunks/workflow/wait-until-BtySPYD0.js +15 -0
  159. package/dist/src/compiled/_chunks/workflow/ws-transport-PnVVxT0R.js +1 -0
  160. package/dist/src/compiler/extension-compatibility.d.ts +2 -2
  161. package/dist/src/compiler/extension-compatibility.js +1 -1
  162. package/dist/src/compiler/manifest.d.ts +2 -2
  163. package/dist/src/compiler/manifest.js +1 -1
  164. package/dist/src/compiler/normalize-tool.js +1 -1
  165. package/dist/src/context/keys.d.ts +3 -8
  166. package/dist/src/eve-channel/index.js +1 -1
  167. package/dist/src/eve-channel/types.d.ts +7 -7
  168. package/dist/src/execution/accepted-delivery-deployment.d.ts +7 -0
  169. package/dist/src/execution/accepted-delivery-deployment.js +1 -0
  170. package/dist/src/execution/agent-handle-dispatch.js +1 -1
  171. package/dist/src/execution/cancel-descendant-turns-step.d.ts +4 -1
  172. package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
  173. package/dist/src/execution/continuation-conflict-step.d.ts +10 -0
  174. package/dist/src/execution/continuation-conflict-step.js +1 -0
  175. package/dist/src/execution/delegated-parent-notification.js +1 -1
  176. package/dist/src/execution/delegation-tool.js +1 -1
  177. package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +14 -31
  178. package/dist/src/execution/dispatch-runtime-actions-shared.js +1 -1
  179. package/dist/src/execution/dispatch-runtime-actions-start.d.ts +33 -0
  180. package/dist/src/execution/dispatch-runtime-actions-start.js +1 -0
  181. package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
  182. package/dist/src/execution/dispatch-turn-step.js +1 -1
  183. package/dist/src/execution/durable-session-migrations/turn-workflow-v1-to-v2.d.ts +2 -0
  184. package/dist/src/execution/durable-session-migrations/turn-workflow-v1-to-v2.js +1 -0
  185. package/dist/src/execution/durable-session-migrations/turn-workflow.d.ts +25 -3
  186. package/dist/src/execution/durable-session-migrations/turn-workflow.js +1 -1
  187. package/dist/src/execution/dynamic-connections.js +1 -1
  188. package/dist/src/execution/eve-workflow-attributes.js +1 -1
  189. package/dist/src/execution/finalize-terminal-session.d.ts +17 -0
  190. package/dist/src/execution/finalize-terminal-session.js +1 -0
  191. package/dist/src/execution/inline-turn.d.ts +29 -0
  192. package/dist/src/execution/inline-turn.js +1 -0
  193. package/dist/src/execution/next-driver-action.d.ts +9 -4
  194. package/dist/src/execution/node-step.js +1 -1
  195. package/dist/src/execution/parked-delivery-wait.js +1 -1
  196. package/dist/src/execution/pending-turn-state.d.ts +1 -0
  197. package/dist/src/execution/pending-turn-state.js +1 -1
  198. package/dist/src/execution/proxied-deliver-step.js +1 -1
  199. package/dist/src/execution/remote-agent-dispatch.d.ts +2 -0
  200. package/dist/src/execution/remote-agent-dispatch.js +1 -1
  201. package/dist/src/execution/runtime-errors.d.ts +0 -12
  202. package/dist/src/execution/runtime-errors.js +1 -1
  203. package/dist/src/execution/session-command-token.d.ts +2 -0
  204. package/dist/src/execution/session-command-token.js +1 -1
  205. package/dist/src/execution/session-timeout-steps.js +1 -1
  206. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  207. package/dist/src/execution/stable-workflow-names.d.ts +12 -0
  208. package/dist/src/execution/stable-workflow-names.js +1 -0
  209. package/dist/src/execution/subagent-event-proxy-step.d.ts +3 -0
  210. package/dist/src/execution/subagent-event-proxy-step.js +1 -1
  211. package/dist/src/execution/subagent-hitl-proxy.d.ts +2 -1
  212. package/dist/src/execution/subagent-hitl-proxy.js +1 -1
  213. package/dist/src/execution/subagent-start-local.js +1 -1
  214. package/dist/src/execution/subagent-start-remote.d.ts +2 -0
  215. package/dist/src/execution/subagent-start-remote.js +1 -1
  216. package/dist/src/execution/tasks/child/steps.d.ts +2 -0
  217. package/dist/src/execution/tasks/child/steps.js +1 -1
  218. package/dist/src/execution/tasks/child/workflow.js +1 -1
  219. package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -1
  220. package/dist/src/execution/tasks/parent/dispatch.js +1 -1
  221. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
  222. package/dist/src/execution/tasks/parent/run-parent.js +1 -1
  223. package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
  224. package/dist/src/execution/terminal-session-completion-step.js +1 -1
  225. package/dist/src/execution/terminal-session-event.d.ts +13 -0
  226. package/dist/src/execution/terminal-session-event.js +1 -0
  227. package/dist/src/execution/terminal-session-failure-step.d.ts +1 -0
  228. package/dist/src/execution/terminal-session-failure-step.js +1 -1
  229. package/dist/src/execution/tool-run/answer.d.ts +3 -0
  230. package/dist/src/execution/tool-run/answer.js +1 -0
  231. package/dist/src/execution/tool-run/background.d.ts +14 -0
  232. package/dist/src/execution/tool-run/background.js +1 -0
  233. package/dist/src/execution/tool-run/cancel.d.ts +7 -0
  234. package/dist/src/execution/tool-run/cancel.js +1 -0
  235. package/dist/src/execution/tool-run/dispatch.d.ts +24 -0
  236. package/dist/src/execution/tool-run/dispatch.js +1 -0
  237. package/dist/src/execution/tool-run/emit-run-report-step.d.ts +7 -0
  238. package/dist/src/execution/tool-run/emit-run-report-step.js +1 -0
  239. package/dist/src/execution/tool-run/messages.d.ts +70 -0
  240. package/dist/src/execution/tool-run/messages.js +1 -0
  241. package/dist/src/execution/tool-run/owner-channels.d.ts +29 -0
  242. package/dist/src/execution/tool-run/owner-channels.js +1 -0
  243. package/dist/src/execution/tool-run/owner-inbox.d.ts +11 -0
  244. package/dist/src/execution/tool-run/owner-inbox.js +1 -0
  245. package/dist/src/execution/tool-run/owner.d.ts +13 -0
  246. package/dist/src/execution/tool-run/owner.js +1 -0
  247. package/dist/src/execution/tool-run/resume-hook-step.d.ts +4 -0
  248. package/dist/src/execution/tool-run/resume-hook-step.js +1 -0
  249. package/dist/src/execution/tool-run/run-control.d.ts +18 -0
  250. package/dist/src/execution/tool-run/run-control.js +1 -0
  251. package/dist/src/execution/tool-run/start.d.ts +11 -0
  252. package/dist/src/execution/tool-run/start.js +1 -0
  253. package/dist/src/execution/tool-run/types.d.ts +21 -0
  254. package/dist/src/execution/tool-run/types.js +1 -0
  255. package/dist/src/execution/tool-run/workflow.d.ts +9 -0
  256. package/dist/src/execution/tool-run/workflow.js +1 -0
  257. package/dist/src/execution/tools/subagent/local.js +1 -1
  258. package/dist/src/execution/turn-cancellation-control.d.ts +2 -0
  259. package/dist/src/execution/turn-cancellation-control.js +1 -1
  260. package/dist/src/execution/turn-control-receiver.js +1 -1
  261. package/dist/src/execution/turn-dispatch.d.ts +4 -2
  262. package/dist/src/execution/turn-dispatch.js +1 -1
  263. package/dist/src/execution/turn-execution-cursor.js +1 -1
  264. package/dist/src/execution/turn-workflow.js +1 -1
  265. package/dist/src/execution/wire/session-inbox-contract.d.ts +2 -2
  266. package/dist/src/execution/wire/session-inbox-contract.js +1 -1
  267. package/dist/src/execution/wire/session-inbox-encoder.d.ts +6 -2
  268. package/dist/src/execution/wire/session-inbox-encoder.js +1 -1
  269. package/dist/src/execution/wire/session-inbox-resume.js +1 -1
  270. package/dist/src/execution/wire/session-inbox-wire.js +1 -1
  271. package/dist/src/execution/wire/session-inbox-wire.v1.js +1 -1
  272. package/dist/src/execution/wire/session-inbox-wire.v2-migration.d.ts +0 -2
  273. package/dist/src/execution/wire/session-inbox-wire.v2-migration.js +1 -1
  274. package/dist/src/execution/wire/session-inbox-wire.v2.migration.d.ts +3 -0
  275. package/dist/src/execution/wire/session-inbox-wire.v2.migration.js +1 -0
  276. package/dist/src/execution/wire/session-inbox-wire.v3.d.ts +480 -0
  277. package/dist/src/execution/wire/session-inbox-wire.v3.js +1 -0
  278. package/dist/src/execution/wire/session-inbox-wire.v3.migration.d.ts +3 -0
  279. package/dist/src/execution/wire/session-inbox-wire.v3.migration.js +1 -0
  280. package/dist/src/execution/workflow-entry-finalization.js +1 -1
  281. package/dist/src/execution/workflow-entry.d.ts +5 -1
  282. package/dist/src/execution/workflow-entry.js +1 -1
  283. package/dist/src/execution/workflow-registry.d.ts +5 -0
  284. package/dist/src/execution/workflow-registry.js +1 -0
  285. package/dist/src/execution/workflow-runtime.d.ts +17 -19
  286. package/dist/src/execution/workflow-runtime.js +1 -1
  287. package/dist/src/execution/workflow-steps.js +1 -1
  288. package/dist/src/execution/workflow-webhook-route.d.ts +4 -0
  289. package/dist/src/execution/workflow-webhook-route.js +1 -0
  290. package/dist/src/harness/attachment-staging.js +1 -1
  291. package/dist/src/harness/emission.js +1 -1
  292. package/dist/src/harness/proxy-input-requests.d.ts +10 -0
  293. package/dist/src/harness/proxy-input-requests.js +1 -1
  294. package/dist/src/harness/runtime-actions.d.ts +2 -0
  295. package/dist/src/harness/runtime-actions.js +1 -1
  296. package/dist/src/harness/session-limit-enforcement.js +1 -1
  297. package/dist/src/harness/tool-loop.js +2 -2
  298. package/dist/src/harness/tool-runs.d.ts +21 -0
  299. package/dist/src/harness/tool-runs.js +1 -0
  300. package/dist/src/harness/tools.js +1 -1
  301. package/dist/src/instrumentation/content-policy.d.ts +3 -1
  302. package/dist/src/instrumentation/content-policy.js +1 -1
  303. package/dist/src/instrumentation/runtime.d.ts +2 -2
  304. package/dist/src/instrumentation/runtime.js +1 -1
  305. package/dist/src/internal/application/package.js +1 -1
  306. package/dist/src/internal/attachments/errors.d.ts +3 -0
  307. package/dist/src/internal/authored-module-loader.d.ts +7 -1
  308. package/dist/src/internal/authored-module-loader.js +3 -3
  309. package/dist/src/internal/authored-package-boundary.js +1 -1
  310. package/dist/src/internal/authored-runtime-modules.d.ts +2 -0
  311. package/dist/src/internal/authored-runtime-modules.js +1 -1
  312. package/dist/src/internal/nitro/development-generation.d.ts +2 -0
  313. package/dist/src/internal/nitro/development-generation.js +1 -1
  314. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  315. package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
  316. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
  317. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  318. package/dist/src/internal/workflow/development-world-client.js +1 -1
  319. package/dist/src/internal/workflow-bundle/authored-workflow-directives.d.ts +17 -0
  320. package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -0
  321. package/dist/src/internal/workflow-bundle/authored-workflow-modules.d.ts +19 -0
  322. package/dist/src/internal/workflow-bundle/authored-workflow-modules.js +1 -0
  323. package/dist/src/internal/workflow-bundle/builder-support.d.ts +17 -2
  324. package/dist/src/internal/workflow-bundle/builder-support.js +4 -3
  325. package/dist/src/internal/workflow-bundle/builder.d.ts +2 -2
  326. package/dist/src/internal/workflow-bundle/builder.js +2 -2
  327. package/dist/src/internal/workflow-bundle/dynamic-capability-transform-plugin.d.ts +2 -0
  328. package/dist/src/internal/workflow-bundle/dynamic-capability-transform-plugin.js +1 -1
  329. package/dist/src/internal/workflow-bundle/dynamic-tool-ast-references.d.ts +3 -0
  330. package/dist/src/internal/workflow-bundle/dynamic-tool-transform.d.ts +1 -1
  331. package/dist/src/internal/workflow-bundle/dynamic-tool-transform.js +1 -1
  332. package/dist/src/internal/workflow-bundle/workflow-builders.d.ts +6 -2
  333. package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
  334. package/dist/src/internal/workflow-bundle/workflow-core-shim.d.ts +3 -0
  335. package/dist/src/internal/workflow-bundle/workflow-core-shim.js +1 -1
  336. package/dist/src/internal/workflow-bundle/workflow-directive-ast.d.ts +7 -0
  337. package/dist/src/internal/workflow-bundle/workflow-directive-ast.js +1 -0
  338. package/dist/src/internal/workflow-bundle/workflow-transformer.d.ts +15 -1
  339. package/dist/src/internal/workflow-bundle/workflow-transformer.js +4 -4
  340. package/dist/src/packages/eve-catalog/src/index.js +1 -1
  341. package/dist/src/protocol/baggage.d.ts +6 -0
  342. package/dist/src/protocol/baggage.js +1 -0
  343. package/dist/src/public/channels/slack/attachments.js +1 -1
  344. package/dist/src/public/channels/slack/slackChannel.d.ts +7 -1
  345. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  346. package/dist/src/public/channels/teams/attachments.d.ts +2 -2
  347. package/dist/src/public/channels/teams/attachments.js +1 -1
  348. package/dist/src/public/channels/teams/teamsChannel.js +1 -1
  349. package/dist/src/public/channels/telegram/attachments.js +1 -1
  350. package/dist/src/public/definitions/remote-agent.d.ts +6 -3
  351. package/dist/src/public/workflow/index.d.ts +3 -0
  352. package/dist/src/public/workflow/index.js +1 -0
  353. package/dist/src/public/workflow-modules.d.js +1 -0
  354. package/dist/src/public/workflow-modules.d.ts +11 -0
  355. package/dist/src/runtime/actions/keys.js +1 -1
  356. package/dist/src/runtime/tools/registry.js +1 -1
  357. package/dist/src/setup/connection-connector.d.ts +4 -2
  358. package/dist/src/setup/connection-connector.js +2 -2
  359. package/dist/src/setup/flows/login.js +1 -1
  360. package/dist/src/setup/flows/model.js +1 -1
  361. package/dist/src/setup/flows/provider.d.ts +5 -0
  362. package/dist/src/setup/flows/provider.js +4 -4
  363. package/dist/src/setup/flows/registry-session.d.ts +24 -7
  364. package/dist/src/setup/flows/registry-session.js +1 -1
  365. package/dist/src/setup/flows/registry.d.ts +35 -29
  366. package/dist/src/setup/flows/registry.js +2 -1
  367. package/dist/src/setup/integrations/web/setup.d.ts +0 -2
  368. package/dist/src/setup/integrations/web/setup.js +1 -1
  369. package/dist/src/setup/prompter.d.ts +24 -4
  370. package/dist/src/setup/prompter.js +1 -1
  371. package/dist/src/setup/scaffold/connections/catalog.js +1 -1
  372. package/dist/src/setup/scaffold/create/project.js +2 -2
  373. package/dist/src/setup/vercel-project.js +0 -0
  374. package/dist/src/shared/dispatch-action.d.ts +6 -0
  375. package/dist/src/shared/forwarded-trace-policy.d.ts +28 -0
  376. package/dist/src/shared/forwarded-trace-policy.js +1 -0
  377. package/dist/src/shared/instrumentation-decision.d.ts +3 -0
  378. package/dist/src/shared/instrumentation-decision.js +1 -1
  379. package/dist/src/svelte/index.js +1 -1
  380. package/dist/src/svelte/use-eve-agent.js +1 -1
  381. package/dist/src/tools/behavior.d.ts +6 -0
  382. package/dist/src/tools/definition.d.ts +39 -3
  383. package/dist/src/tracing/agent-otel-provider.js +2 -2
  384. package/dist/src/tracing/agent-otel-session-context.js +1 -1
  385. package/dist/src/tracing/agent-trace-context-store.d.ts +1 -1
  386. package/dist/src/tracing/agent-trace-context-store.js +1 -1
  387. package/dist/src/tracing/otel-declaration.d.ts +5 -3
  388. package/dist/src/tracing/otel-registration.d.ts +1 -1
  389. package/dist/src/tracing/otel-registration.js +1 -1
  390. package/dist/src/vue/index.js +1 -1
  391. package/dist/src/vue/use-eve-agent.js +1 -1
  392. package/docs/channels/custom.mdx +6 -0
  393. package/docs/channels/eve.mdx +14 -6
  394. package/docs/channels/mcp.mdx +4 -1
  395. package/docs/channels/teams.mdx +6 -1
  396. package/docs/concepts/sessions-runs-and-streaming.md +4 -2
  397. package/docs/guides/auth-and-route-protection.md +5 -1
  398. package/docs/guides/client/messages.mdx +6 -0
  399. package/docs/guides/dev-tui.md +30 -18
  400. package/docs/guides/instrumentation.md +1 -1
  401. package/docs/guides/remote-agents.md +25 -0
  402. package/docs/install-integrations.mdx +2 -0
  403. package/docs/instructions.mdx +1 -1
  404. package/docs/memory/custom-provider.md +214 -0
  405. package/docs/memory/file.md +129 -0
  406. package/docs/memory/meta.json +5 -0
  407. package/docs/memory/overview.mdx +282 -0
  408. package/docs/patterns/multi-tenant-memory.md +12 -20
  409. package/docs/reference/cli.md +2 -2
  410. package/docs/tools/meta.json +1 -1
  411. package/docs/tools/overview.mdx +7 -0
  412. package/docs/tools/workflows.mdx +288 -0
  413. package/package.json +18 -7
  414. package/dist/src/compiled/_chunks/workflow/dist-CqvWKNQv.js +0 -3
  415. package/dist/src/compiled/_chunks/workflow/dist-Dk0aQqFO.js +0 -40
  416. package/dist/src/compiled/_chunks/workflow/dist-DpYyXbJv.js +0 -1
  417. package/dist/src/compiled/_chunks/workflow/env-config-L94XftKz.js +0 -1
  418. package/dist/src/compiled/_chunks/workflow/frames-Dl2Hcma4.js +0 -3
  419. package/dist/src/compiled/_chunks/workflow/private-CuQ4HTFC.js +0 -1
  420. package/dist/src/compiled/_chunks/workflow/resume-hook-E-Nkx8q_.js +0 -1
  421. package/dist/src/compiled/_chunks/workflow/run-cIeex2KF.js +0 -1
  422. package/dist/src/compiled/_chunks/workflow/sleep-CxFsdxB_.js +0 -1
  423. package/dist/src/compiled/_chunks/workflow/spec-version-DBUVfF_R.js +0 -1
  424. package/dist/src/compiled/_chunks/workflow/undici-DznrXKcM.js +0 -95
  425. package/dist/src/compiled/_chunks/workflow/wait-until-BZHmJCAW.js +0 -15
  426. package/dist/src/compiled/_chunks/workflow/ws-transport-Ct6yyRWZ.js +0 -1
  427. package/dist/src/internal/authored-directive-prologue.d.ts +0 -4
  428. package/dist/src/internal/authored-directive-prologue.js +0 -1
  429. package/docs/memory.md +0 -408
@@ -1,2 +1,2 @@
1
- import{normalizeChannelAudience}from"#shared/channel-audience.js";import{contextStorage}from"#context/container.js";import{SessionTraceSeedKey}from"#context/keys.js";import{isSampledTrace,resolveTracePolicyDecision}from"#tracing/sampled-trace.js";import{ROOT_CONTEXT,SpanKind,SpanStatusCode,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{contentAttribute,genAiInputMessagesAttribute,genAiOutputMessagesAttribute,genAiSystemInstructionsAttribute,messagesContentAttribute,systemPromptAttribute,textContentAttribute,toolResultsContentAttribute}from"#tracing/agent-otel-content.js";import{setAgentUsage}from"#tracing/agent-otel-usage.js";import{withChannelAudience}from"#tracing/channel-audience-context.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{runtimeContextAttributes}from"#tracing/agent-otel-runtime-context.js";import{createAgentOtelSessionContext}from"#tracing/agent-otel-session-context.js";import{suppressTracing}from"#tracing/suppress-tracing.js";function createAgentOtelInstrumentation(e){let a=e.recordInputs??!1,s=e.recordOutputs??!1,p=new WeakMap,m=new Map,h=new WeakMap,g=new WeakMap,_=createAgentActionInstrumentation({frameworkVersion:e.frameworkVersion,idGenerator:e.idGenerator,recordInputs:a,recordOutputs:s,resolveTraceContext:async t=>(await e.stateStore.getTurn(t.scope.sessionId,t.scope.turnId))?.context,stateStore:e.stateStore,tracer:e.tracer}),v=createAgentApprovalInstrumentation({actionContextFor:_.contextFor,frameworkVersion:e.frameworkVersion,idGenerator:e.idGenerator,tracer:e.tracer}),y=createAgentToolInstrumentation({actionContextFor:_.contextFor,idGenerator:e.idGenerator,recordInputs:a,recordOutputs:s,resolveFallback:e=>{let t=m.get(e.scope.attemptId)??e.scope,n=h.get(t);return n===void 0?void 0:{context:n.context,spanContext:n.span.spanContext()}},tracer:e.tracer}),{ensureSessionContext:b,prepareSessionTrace:x,prepareTurnTrace:S}=createAgentOtelSessionContext(e),projectEvent=async o=>{let c=await e.stateStore.getSession(sessionIdForEvent(o)),l=audienceForEvent(o,c?.channelAudience),u=`traceSeed`in o?o.traceSeed:void 0,d=contextStorage.getStore()?.get(SessionTraceSeedKey),f=u?.decision??d?.decision??c?.decision??(u===void 0?d===void 0?c===void 0?void 0:resolveTracePolicyDecision(isSampledTrace(c.context),l):resolveTracePolicyDecision(isSampledTrace(d),l):resolveTracePolicyDecision(isSampledTrace(u),l));return f===void 0?withoutInstrumentationContent(o):instrumentationEventForTraceDecision(o,f.action===`drop`?f:{action:`record`,recordInputs:a&&f.recordInputs,recordOutputs:s&&f.recordOutputs},l)},onSessionStarted=async e=>{await x(e)},onTurnStarted=async e=>{await S(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 i=withChannelAudience(contextFromSpanContext(n.context),t.scope.channelAudience),a=trace.getSpan(context.active())?.spanContext(),o=e.idGenerator.withSpanId(e.idGenerator.deriveSpanId(attemptIdempotencyKey(t.scope)),()=>e.tracer.startSpan(`agent.step`,{attributes:{"agent.session.id":t.scope.sessionId,"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,...runtimeContextAttributes(t.runtimeContext)},links:a===void 0||a.traceId===n.context.traceId?void 0:[{attributes:{"eve.link.type":`workflow.delivery`},context:a}]},i));o.addEvent(`step.started`);let s=trace.setSpan(i,o);h.set(t.scope,{context:s,span:o}),m.set(t.scope.attemptId,t.scope)},onStepTerminal=async e=>{let t=m.get(e.scope.attemptId)??e.scope;p.delete(t),drainOpenSpans({...e,scope:t}),y.drain(e.scope.attemptId,e.type===`step.attempt.failed`?{error:e.error}:void 0),e.type===`step.attempt.failed`&&await _.failForAttempt(t,e.error),m.delete(e.scope.attemptId);let n=h.get(t);n!==void 0&&(n.span.addEvent(e.type===`step.attempt.completed`?`step.completed`:`step.failed`),e.type===`step.attempt.failed`&&recordError(n.span,e.error),n.span.end(),h.delete(t))},onTurnTerminal=async t=>{(t.type===`turn.cancelled`||t.type===`turn.failed`)&&await _.deleteForTurn(t.sessionId,t.turnId),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(t.turnId!==void 0){let n=await e.stateStore.getTurn(t.sessionId,t.turnId);if(n!==void 0){let i=await e.stateStore.getSession(t.sessionId);if(isSampledTrace(n.context)){let r=i?.agentName??n.subagentName,a=e.idGenerator.withSpanId(n.context.spanId,()=>e.tracer.startSpan(agentSpanName(r),{attributes:{"agent.framework.name":`eve`,"agent.framework.version":e.frameworkVersion,"agent.name":r,"agent.session.id":t.sessionId,"agent.subagent.name":n.subagentName,"agent.turn.id":t.turnId,"agent.turn.sequence":n.sequence,"gen_ai.agent.name":r,"gen_ai.conversation.id":t.sessionId,"gen_ai.operation.name":`invoke_agent`},kind:SpanKind.INTERNAL,startTime:n.startTimeMs},withChannelAudience(contextFromSpanContext({isRemote:n.parentIsRemote??!1,spanId:n.parentSpanId,traceFlags:n.context.traceFlags,traceId:n.context.traceId}),i?.channelAudience)));setAgentInvocationUsage(a,n.modelUsage),a.addEvent(`turn.started`,void 0,n.startTimeMs),n.terminal!==void 0&&(a.addEvent(n.terminal.type),n.terminal.type===`turn.failed`&&recordError(a,n.terminal.error)),a.end()}await e.stateStore.deleteTurn(t.sessionId,t.turnId)}}(t.type===`session.completed`||t.type===`session.failed`)&&(await _.deleteForSession(t.sessionId),await e.stateStore.deleteSession(t.sessionId))},onModelCallStarted=t=>{let n=h.get(t.scope);if(n===void 0)return;n.span.setAttribute(`agent.model.id`,t.model.modelId),n.span.setAttribute(`agent.model.provider`,t.model.provider);let r=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,...runtimeContextAttributes(t.runtimeContext)}},n.context);if(a&&t.input!==void 0){let e=messagesContentAttribute(t.input.messages);e!==void 0&&r.setAttribute(`ai.prompt.messages`,e);let n=genAiInputMessagesAttribute(t.input.messages);n!==void 0&&r.setAttribute(`gen_ai.input.messages`,n);let i=systemPromptAttribute(t.input.instructions);i!==void 0&&r.setAttribute(`ai.prompt.system`,i);let a=genAiSystemInstructionsAttribute(t.input.instructions);a!==void 0&&r.setAttribute(`gen_ai.system_instructions`,a)}let i={context:trace.setSpan(n.context,r),span:r};getExecutionContexts(t.scope).set(t.idempotencyKey,i.context),getSpanStates(g,t.scope).set(t.idempotencyKey,i)},onModelCallTerminal=async e=>{p.get(e.scope)?.delete(e.idempotencyKey);let t=takeSpanState(g,e.scope,e.idempotencyKey);if(t!==void 0){if(e.type===`model.call.failed`)recordError(t.span,e.error);else{await recordTurnUsage(e),setAgentUsage(t.span,e.usage),t.span.setAttribute(`gen_ai.response.finish_reasons`,[e.finishReason]);let n=h.get(e.scope);if(n!==void 0&&setAgentUsage(n.span,e.usage),s){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,!1);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}}))},C=createAgentChannelDeliveryInstrumentation({ensureSessionContext:b,frameworkVersion:e.frameworkVersion,idGenerator:e.idGenerator,recordInputs:a,stateStore:e.stateStore,tracer:e.tracer}),onStepMetadata=e=>{let t=h.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:{events:{...C,"action.completed":_.events[`action.completed`],"action.failed":_.events[`action.failed`],async"action.started"(e,t){await _.events[`action.started`](e,t),await y.actionStarted(e)},...v,"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,...y.events,"turn.cancelled":onTurnTerminal,"turn.completed":onTurnTerminal,"turn.failed":onTurnTerminal,"turn.started":onTurnStarted},name:`eve.otel`,projectEvent,tracePolicy:()=>({emit:!0,recordInputs:a,recordOutputs:s})},prepareSessionTrace:x,prepareTurnTrace:S,async runInContext(t,n){let i=m.get(t.scope.attemptId)??t.scope,a=p.get(i),o=t.type===`model.call`?a?.get(t.idempotencyKey):y.contextFor(t.scope.attemptId,t.idempotencyKey);if(o===void 0){let n=await e.stateStore.getTurn(t.scope.sessionId,t.scope.turnId);n!==void 0&&(o=withChannelAudience(contextFromSpanContext(n.context),t.scope.channelAudience),isSampledTrace(n.context)||(o=suppressTracing(o)))}return o===void 0?n():context.with(markAgentTraceContext(o),n)}};function getExecutionContexts(e){let t=p.get(e);return t===void 0&&(t=new Map,p.set(e,t)),t}function drainOpenSpans(e){for(let t of g.get(e.scope)?.values()??[])e.type===`step.attempt.failed`&&recordError(t.span,e.error),t.span.end();g.delete(e.scope)}}function sessionIdForEvent(e){return`scope`in e?e.scope.sessionId:e.sessionId}function audienceForEvent(t,n){return`delivery`in t?normalizeChannelAudience(t.delivery.channelAudience):`scope`in t&&t.scope.channelAudience!==void 0?normalizeChannelAudience(t.scope.channelAudience):t.type===`session.started`?normalizeChannelAudience(t.channelAudience):normalizeChannelAudience(n)}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))}function readGatewayCost(e){let t=e.gateway;if(!isRecord(t))return;let n={},r=readUsd(t.cost);r!==void 0&&(n[`gen_ai.usage.cost`]=r);let i=readUsd(t.gatewayCost);i!==void 0&&(n[`gen_ai.usage.gateway_cost`]=i);let a=readUsd(t.inputInferenceCost);a!==void 0&&(n[`gen_ai.usage.input_cost`]=a);let o=readUsd(t.outputInferenceCost);return o!==void 0&&(n[`gen_ai.usage.output_cost`]=o),typeof t.generationId==`string`&&t.generationId.length>0&&(n[`gen_ai.generation.id`]=t.generationId),Object.keys(n).length===0?void 0:n}function readUsd(e){if(typeof e!=`string`)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function modelSpanName(e){return`chat ${e}`}function agentSpanName(e){return e===void 0?`invoke_agent`:`invoke_agent ${e}`}function setAgentInvocationUsage(e,t){t!==void 0&&(t.inputTokens!==void 0&&e.setAttribute(`gen_ai.usage.input_tokens`,t.inputTokens),t.outputTokens!==void 0&&e.setAttribute(`gen_ai.usage.output_tokens`,t.outputTokens))}function errorText(e){return e instanceof Error?e.message:e}function recordError(e,t){e.setAttribute(`error.type`,t instanceof Error?t.name||`Error`:`_OTHER`),t instanceof Error?(e.recordException(t),e.setStatus({code:SpanStatusCode.ERROR,message:t.message})):e.setStatus({code:SpanStatusCode.ERROR})}export{createAgentOtelInstrumentation};
1
+ import{normalizeChannelAudience}from"#shared/channel-audience.js";import{contextStorage}from"#context/container.js";import{SessionTraceSeedKey}from"#context/keys.js";import{applyLiveDeliveryAudienceCeiling,resolveForwardedTraceSeed}from"#shared/forwarded-trace-policy.js";import{isSampledTrace,resolveTracePolicyDecision}from"#tracing/sampled-trace.js";import{ROOT_CONTEXT,SpanKind,SpanStatusCode,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{readInstrumentationDecision}from"#shared/instrumentation-decision.js";import{contentAttribute,genAiInputMessagesAttribute,genAiOutputMessagesAttribute,genAiSystemInstructionsAttribute,messagesContentAttribute,systemPromptAttribute,textContentAttribute,toolResultsContentAttribute}from"#tracing/agent-otel-content.js";import{setAgentUsage}from"#tracing/agent-otel-usage.js";import{withChannelAudience}from"#tracing/channel-audience-context.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{runtimeContextAttributes}from"#tracing/agent-otel-runtime-context.js";import{createAgentOtelSessionContext}from"#tracing/agent-otel-session-context.js";import{suppressTracing}from"#tracing/suppress-tracing.js";function createAgentOtelInstrumentation(e){let s=e.recordInputs??!1,l=e.recordOutputs??!1,_=new WeakMap,v=new Map,y=new WeakMap,b=new WeakMap,x=createAgentActionInstrumentation({frameworkVersion:e.frameworkVersion,idGenerator:e.idGenerator,recordInputs:s,recordOutputs:l,resolveTraceContext:async t=>(await e.stateStore.getTurn(t.scope.sessionId,t.scope.turnId))?.context,stateStore:e.stateStore,tracer:e.tracer}),S=createAgentApprovalInstrumentation({actionContextFor:x.contextFor,frameworkVersion:e.frameworkVersion,idGenerator:e.idGenerator,tracer:e.tracer}),C=createAgentToolInstrumentation({actionContextFor:x.contextFor,idGenerator:e.idGenerator,recordInputs:s,recordOutputs:l,resolveFallback:e=>{let t=v.get(e.scope.attemptId)??e.scope,n=y.get(t);return n===void 0?void 0:{context:n.context,spanContext:n.span.spanContext()}},tracer:e.tracer}),{ensureSessionContext:w,prepareSessionTrace:T,prepareTurnTrace:E}=createAgentOtelSessionContext(e),projectEvent=async c=>{let u=await e.stateStore.getSession(sessionIdForEvent(c)),d=audienceForEvent(c,u?.channelAudience),f=`traceSeed`in c?c.traceSeed:void 0,p=contextStorage.getStore()?.get(SessionTraceSeedKey),m=resolveForwardedTraceSeed(p),h=resolveForwardedTraceSeed(f,m?.forwardedTracePolicy),g=h?.decision??m?.decision??readInstrumentationDecision(u?.decision)??(f===void 0?p===void 0?u===void 0?void 0:resolveTracePolicyDecision(isSampledTrace(u.context),d):resolveTracePolicyDecision(isSampledTrace(p),d):resolveTracePolicyDecision(isSampledTrace(f),d));return g===void 0?withoutInstrumentationContent(c):instrumentationEventForTraceDecision(h===void 0||!(`traceSeed`in c)||c.traceSeed===void 0?c:{...c,traceSeed:{...c.traceSeed,decision:h.decision,traceFlags:h.traceFlags}},applyLiveDeliveryAudienceCeiling(g.action===`drop`?g:{action:`record`,recordInputs:s&&g.recordInputs,recordOutputs:l&&g.recordOutputs},d,h?.forwardedTracePolicy??m?.forwardedTracePolicy),d,{applyAudienceCeiling:!1})},onSessionStarted=async e=>{await T(e)},onTurnStarted=async e=>{await E(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(),o=e.idGenerator.withSpanId(e.idGenerator.deriveSpanId(attemptIdempotencyKey(t.scope)),()=>e.tracer.startSpan(`agent.step`,{attributes:{"agent.session.id":t.scope.sessionId,"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,...runtimeContextAttributes(t.runtimeContext)},links:i===void 0||i.traceId===n.context.traceId?void 0:[{attributes:{"eve.link.type":`workflow.delivery`},context:i}]},r));o.addEvent(`step.started`);let s=trace.setSpan(r,o);y.set(t.scope,{context:s,span:o}),v.set(t.scope.attemptId,t.scope)},onStepTerminal=async e=>{let t=v.get(e.scope.attemptId)??e.scope;_.delete(t),drainOpenSpans({...e,scope:t}),C.drain(e.scope.attemptId,e.type===`step.attempt.failed`?{error:e.error}:void 0),e.type===`step.attempt.failed`&&await x.failForAttempt(t,e.error),v.delete(e.scope.attemptId);let n=y.get(t);n!==void 0&&(n.span.addEvent(e.type===`step.attempt.completed`?`step.completed`:`step.failed`),e.type===`step.attempt.failed`&&recordError(n.span,e.error),n.span.end(),y.delete(t))},onTurnTerminal=async t=>{(t.type===`turn.cancelled`||t.type===`turn.failed`)&&await x.deleteForTurn(t.sessionId,t.turnId),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(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=e.idGenerator.withSpanId(n.context.spanId,()=>e.tracer.startSpan(agentSpanName(i),{attributes:{"agent.framework.name":`eve`,"agent.framework.version":e.frameworkVersion,"agent.name":i,"agent.session.id":t.sessionId,"agent.subagent.name":n.subagentName,"agent.turn.id":t.turnId,"agent.turn.sequence":n.sequence,"gen_ai.agent.name":i,"gen_ai.conversation.id":t.sessionId,"gen_ai.operation.name":`invoke_agent`},kind:SpanKind.INTERNAL,startTime:n.startTimeMs},withChannelAudience(contextFromSpanContext({isRemote:n.parentIsRemote??!1,spanId:n.parentSpanId,traceFlags:n.context.traceFlags,traceId:n.context.traceId}),r?.channelAudience)));setAgentInvocationUsage(a,n.modelUsage),a.addEvent(`turn.started`,void 0,n.startTimeMs),n.terminal!==void 0&&(a.addEvent(n.terminal.type),n.terminal.type===`turn.failed`&&recordError(a,n.terminal.error)),a.end()}await e.stateStore.deleteTurn(t.sessionId,t.turnId)}}(t.type===`session.completed`||t.type===`session.failed`)&&(await x.deleteForSession(t.sessionId),await e.stateStore.deleteSession(t.sessionId))},onModelCallStarted=t=>{let n=y.get(t.scope);if(n===void 0)return;n.span.setAttribute(`agent.model.id`,t.model.modelId),n.span.setAttribute(`agent.model.provider`,t.model.provider);let r=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,...runtimeContextAttributes(t.runtimeContext)}},n.context);if(s&&t.input!==void 0){let e=messagesContentAttribute(t.input.messages);e!==void 0&&r.setAttribute(`ai.prompt.messages`,e);let n=genAiInputMessagesAttribute(t.input.messages);n!==void 0&&r.setAttribute(`gen_ai.input.messages`,n);let i=systemPromptAttribute(t.input.instructions);i!==void 0&&r.setAttribute(`ai.prompt.system`,i);let a=genAiSystemInstructionsAttribute(t.input.instructions);a!==void 0&&r.setAttribute(`gen_ai.system_instructions`,a)}let i={context:trace.setSpan(n.context,r),span:r};getExecutionContexts(t.scope).set(t.idempotencyKey,i.context),getSpanStates(b,t.scope).set(t.idempotencyKey,i)},onModelCallTerminal=async e=>{_.get(e.scope)?.delete(e.idempotencyKey);let t=takeSpanState(b,e.scope,e.idempotencyKey);if(t!==void 0){if(e.type===`model.call.failed`)recordError(t.span,e.error);else{await recordTurnUsage(e),setAgentUsage(t.span,e.usage),t.span.setAttribute(`gen_ai.response.finish_reasons`,[e.finishReason]);let n=y.get(e.scope);if(n!==void 0&&setAgentUsage(n.span,e.usage),l){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,!1);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}}))},D=createAgentChannelDeliveryInstrumentation({ensureSessionContext:w,frameworkVersion:e.frameworkVersion,idGenerator:e.idGenerator,recordInputs:s,stateStore:e.stateStore,tracer:e.tracer}),onStepMetadata=e=>{let t=y.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:{events:{...D,"action.completed":x.events[`action.completed`],"action.failed":x.events[`action.failed`],async"action.started"(e,t){await x.events[`action.started`](e,t),await C.actionStarted(e)},...S,"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,...C.events,"turn.cancelled":onTurnTerminal,"turn.completed":onTurnTerminal,"turn.failed":onTurnTerminal,"turn.started":onTurnStarted},name:`eve.otel`,projectEvent,tracePolicy:()=>({emit:!0,recordInputs:s,recordOutputs:l})},prepareSessionTrace:T,prepareTurnTrace:E,async runInContext(t,n){let r=v.get(t.scope.attemptId)??t.scope,i=_.get(r),o=t.type===`model.call`?i?.get(t.idempotencyKey):C.contextFor(t.scope.attemptId,t.idempotencyKey);if(o===void 0){let n=await e.stateStore.getTurn(t.scope.sessionId,t.scope.turnId);n!==void 0&&(o=withChannelAudience(contextFromSpanContext(n.context),t.scope.channelAudience),isSampledTrace(n.context)||(o=suppressTracing(o)))}return o===void 0?n():context.with(markAgentTraceContext(o),n)}};function getExecutionContexts(e){let t=_.get(e);return t===void 0&&(t=new Map,_.set(e,t)),t}function drainOpenSpans(e){for(let t of b.get(e.scope)?.values()??[])e.type===`step.attempt.failed`&&recordError(t.span,e.error),t.span.end();b.delete(e.scope)}}function sessionIdForEvent(e){return`scope`in e?e.scope.sessionId:e.sessionId}function audienceForEvent(t,n){return`delivery`in t?normalizeChannelAudience(t.delivery.channelAudience):`scope`in t&&t.scope.channelAudience!==void 0?normalizeChannelAudience(t.scope.channelAudience):t.type===`session.started`?normalizeChannelAudience(t.channelAudience):normalizeChannelAudience(n)}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))}function readGatewayCost(e){let t=e.gateway;if(!isRecord(t))return;let n={},r=readUsd(t.cost);r!==void 0&&(n[`gen_ai.usage.cost`]=r);let i=readUsd(t.gatewayCost);i!==void 0&&(n[`gen_ai.usage.gateway_cost`]=i);let a=readUsd(t.inputInferenceCost);a!==void 0&&(n[`gen_ai.usage.input_cost`]=a);let o=readUsd(t.outputInferenceCost);return o!==void 0&&(n[`gen_ai.usage.output_cost`]=o),typeof t.generationId==`string`&&t.generationId.length>0&&(n[`gen_ai.generation.id`]=t.generationId),Object.keys(n).length===0?void 0:n}function readUsd(e){if(typeof e!=`string`)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function modelSpanName(e){return`chat ${e}`}function agentSpanName(e){return e===void 0?`invoke_agent`:`invoke_agent ${e}`}function setAgentInvocationUsage(e,t){t!==void 0&&(t.inputTokens!==void 0&&e.setAttribute(`gen_ai.usage.input_tokens`,t.inputTokens),t.outputTokens!==void 0&&e.setAttribute(`gen_ai.usage.output_tokens`,t.outputTokens))}function errorText(e){return e instanceof Error?e.message:e}function recordError(e,t){e.setAttribute(`error.type`,t instanceof Error?t.name||`Error`:`_OTHER`),t instanceof Error?(e.recordException(t),e.setStatus({code:SpanStatusCode.ERROR,message:t.message})):e.setStatus({code:SpanStatusCode.ERROR})}export{createAgentOtelInstrumentation};
@@ -1 +1 @@
1
- import{normalizeChannelAudience}from"#shared/channel-audience.js";import{isSampledTrace,resolveTracePolicy,resolveTracePolicyDecision}from"#tracing/sampled-trace.js";import{sessionIdempotencyKey}from"#instrumentation/lifecycle.js";function createAgentOtelSessionContext(n){let openSessionTrace=e=>{if(e.traceSeed!==void 0){if(!isSampledTrace(e.traceSeed))return{isRemote:!1,spanId:e.traceSeed.spanId,traceFlags:0,traceId:e.traceSeed.traceId};let startSpan=()=>n.tracer.startSpan(`agent.session`,{attributes:{"agent.framework.name":`eve`,"agent.framework.version":n.frameworkVersion,"agent.channel.audience":e.channelAudience,"agent.name":e.agentName,"agent.session.id":e.sessionId,"agent.trace.schema.version":3},root:!0}),r=n.idGenerator.withSpanId(e.traceSeed.spanId,()=>n.idGenerator.withTraceId(e.traceSeed.traceId,startSpan));return r.addEvent(`session.started`),r.end(),r.spanContext()}if(e.traceDecision.action===`drop`)return{isRemote:!1,spanId:n.idGenerator.deriveSpanId(`session:${e.sessionId}`),traceFlags:0,traceId:n.idGenerator.generateTraceId()};let r=n.tracer.startSpan(`agent.session`,{attributes:{"agent.framework.name":`eve`,"agent.framework.version":n.frameworkVersion,"agent.channel.audience":e.channelAudience,"agent.name":e.agentName,"agent.session.id":e.sessionId,"agent.trace.schema.version":3},root:!0});return r.addEvent(`session.started`),r.end(),r.spanContext()},ensureSessionContext=async t=>{let r=await n.stateStore.getSession(t.sessionId);if(r===void 0){let i=normalizeChannelAudience(t.channelAudience),a=resolveSessionTraceDecision(t,i,n.tracePolicy);r={agentName:t.agentName,channelAudience:i,channelKind:t.channelKind,decision:a,context:t.parentTraceContext===void 0?openSessionTrace({agentName:t.agentName,channelAudience:i,channelType:t.channelType,rootSessionId:t.rootSessionId,sessionId:t.sessionId,traceDecision:a,traceSeed:t.traceSeed}):adoptedSpanContext(t.parentTraceContext),rootSessionId:t.rootSessionId},await n.stateStore.setSession(t.sessionId,r)}return r};return{ensureSessionContext,prepareSessionTrace:async e=>{let t=await ensureSessionContext(e);return portableSpanContext(t.context,t.decision)},prepareTurnTrace:async e=>{let t=await n.stateStore.getTurn(e.sessionId,e.turnId);if(t!==void 0)return{decision:(await n.stateStore.getSession(e.sessionId))?.decision,spanId:t.parentSpanId,traceFlags:t.context.traceFlags,traceId:t.context.traceId};let r=await ensureSessionContext({agentName:e.agentName,channelAudience:`unknown`,channelKind:void 0,idempotencyKey:sessionIdempotencyKey(e.sessionId),parentTraceContext:e.parentTraceContext,rootSessionId:e.rootSessionId,sessionId:e.sessionId,type:`session.started`}),a={isRemote:!1,spanId:n.idGenerator.deriveSpanId(`turn:${e.idempotencyKey}`),traceFlags:r.context.traceFlags,traceId:r.context.traceId};return await n.stateStore.setTurn(e.sessionId,e.turnId,{context:a,parentIsRemote:r.context.isRemote,parentSpanId:r.context.spanId,rootSessionId:e.rootSessionId,sequence:e.sequence,startTimeMs:Date.now(),subagentName:e.parentLineage?.subagentName}),portableSpanContext(r.context,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 resolveSessionTraceDecision(e,i,a){return e.traceSeed?.decision===void 0?e.traceSeed===void 0?e.parentTraceContext===void 0?e.agentName===void 0?a===void 0?resolveTracePolicyDecision(!0,i):{action:`drop`}:resolveTracePolicy(a,{agentName:e.agentName,audience:i,channelType:e.channelType}):resolveTracePolicyDecision(isSampledTrace(e.parentTraceContext),i):resolveTracePolicyDecision(isSampledTrace(e.traceSeed),i):e.traceSeed.decision}export{createAgentOtelSessionContext};
1
+ import{normalizeChannelAudience}from"#shared/channel-audience.js";import{isSampledTrace,resolveTracePolicy,resolveTracePolicyDecision}from"#tracing/sampled-trace.js";import{sessionIdempotencyKey}from"#instrumentation/lifecycle.js";import{readInstrumentationDecision}from"#shared/instrumentation-decision.js";function createAgentOtelSessionContext(n){let openSessionTrace=e=>{if(e.traceSeed!==void 0){if(e.traceDecision.action===`drop`||!isSampledTrace(e.traceSeed))return{isRemote:!1,spanId:e.traceSeed.spanId,traceFlags:0,traceId:e.traceSeed.traceId};let startSpan=()=>n.tracer.startSpan(`agent.session`,{attributes:{"agent.framework.name":`eve`,"agent.framework.version":n.frameworkVersion,"agent.channel.audience":e.channelAudience,"agent.name":e.agentName,"agent.session.id":e.sessionId,"agent.trace.schema.version":3},root:!0}),r=n.idGenerator.withSpanId(e.traceSeed.spanId,()=>n.idGenerator.withTraceId(e.traceSeed.traceId,startSpan));return r.addEvent(`session.started`),r.end(),r.spanContext()}if(e.traceDecision.action===`drop`)return{isRemote:!1,spanId:n.idGenerator.deriveSpanId(`session:${e.sessionId}`),traceFlags:0,traceId:n.idGenerator.generateTraceId()};let r=n.tracer.startSpan(`agent.session`,{attributes:{"agent.framework.name":`eve`,"agent.framework.version":n.frameworkVersion,"agent.channel.audience":e.channelAudience,"agent.name":e.agentName,"agent.session.id":e.sessionId,"agent.trace.schema.version":3},root:!0});return r.addEvent(`session.started`),r.end(),r.spanContext()},ensureSessionContext=async t=>{let r=await n.stateStore.getSession(t.sessionId);if(r===void 0){let i=normalizeChannelAudience(t.channelAudience),a=resolveSessionTraceDecision(t,i,n.tracePolicy);r={agentName:t.agentName,channelAudience:i,channelKind:t.channelKind,decision:a,context:t.parentTraceContext===void 0?openSessionTrace({agentName:t.agentName,channelAudience:i,channelType:t.channelType,rootSessionId:t.rootSessionId,sessionId:t.sessionId,traceDecision:a,traceSeed:t.traceSeed}):adoptedSpanContext(t.parentTraceContext),rootSessionId:t.rootSessionId},await n.stateStore.setSession(t.sessionId,r)}return r};return{ensureSessionContext,prepareSessionTrace:async e=>{let t=await ensureSessionContext(e);return portableSpanContext(t.context,t.decision)},prepareTurnTrace:async e=>{let t=await n.stateStore.getTurn(e.sessionId,e.turnId);if(t!==void 0)return{decision:(await n.stateStore.getSession(e.sessionId))?.decision,spanId:t.parentSpanId,traceFlags:t.context.traceFlags,traceId:t.context.traceId};let r=await ensureSessionContext({agentName:e.agentName,channelAudience:`unknown`,channelKind:void 0,idempotencyKey:sessionIdempotencyKey(e.sessionId),parentTraceContext:e.parentTraceContext,rootSessionId:e.rootSessionId,sessionId:e.sessionId,type:`session.started`}),a={isRemote:!1,spanId:n.idGenerator.deriveSpanId(`turn:${e.idempotencyKey}`),traceFlags:r.context.traceFlags,traceId:r.context.traceId};return await n.stateStore.setTurn(e.sessionId,e.turnId,{context:a,parentIsRemote:r.context.isRemote,parentSpanId:r.context.spanId,rootSessionId:e.rootSessionId,sequence:e.sequence,startTimeMs:Date.now(),subagentName:e.parentLineage?.subagentName}),portableSpanContext(r.context,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 resolveSessionTraceDecision(e,i,o){return e.traceSeed?.decision===void 0?e.traceSeed===void 0?e.parentTraceContext===void 0?e.agentName===void 0?o===void 0?resolveTracePolicyDecision(!0,i):{action:`drop`}:resolveTracePolicy(o,{agentName:e.agentName,audience:i,channelType:e.channelType}):resolveTracePolicyDecision(isSampledTrace(e.parentTraceContext),i):resolveTracePolicyDecision(isSampledTrace(e.traceSeed),i):readInstrumentationDecision(e.traceSeed.decision)??{action:`drop`}}export{createAgentOtelSessionContext};
@@ -1,7 +1,7 @@
1
1
  import type { SessionTraceContext } from "#channel/types.js";
2
2
  import type { ContextAccessor } from "#context/key.js";
3
3
  import type { AgentActionTraceState, AgentSessionTraceState, AgentTraceStateStore, AgentTurnTraceState } from "#tracing/agent-trace-state.js";
4
- import type { InstrumentationDecision } from "#shared/instrumentation-decision.js";
4
+ import { type InstrumentationDecision } from "#shared/instrumentation-decision.js";
5
5
  /** Reads the decision already bound to a session in the current worker context. */
6
6
  export declare function readCurrentSessionTraceDecision(sessionId: string): InstrumentationDecision | undefined;
7
7
  export declare function readSessionTraceDecision(context: ContextAccessor, sessionId: string): InstrumentationDecision | undefined;
@@ -1 +1 @@
1
- import{normalizeChannelAudience}from"#shared/channel-audience.js";import{contextStorage,loadContext}from"#context/container.js";import{SessionTraceSeedKey}from"#context/keys.js";import{ContextKey}from"#context/key.js";const AgentTraceContextKey=new ContextKey(`eve.harness.agentTrace`,{codec:{deserialize:deserializeState,serialize:serializeState}});function readCurrentSessionTraceDecision(e){let n=contextStorage.getStore();return n===void 0?void 0:readSessionTraceDecision(n,e)}function readSessionTraceDecision(e,t){return e.get(AgentTraceContextKey)?.sessions[t]?.decision}function preserveSerializedAgentTraceState(e,t){let n=t[AgentTraceContextKey.name];return n===void 0?e:{...e,[AgentTraceContextKey.name]:n}}function readSessionTraceContext(e,t){let n=e[AgentTraceContextKey.name];if(n===void 0)return;let r=deserializeState(n).sessions[t];return r===void 0?void 0:withTraceDecision(e,r.context,r.decision)}function readActionTraceContext(e,t,n,r){let i=e[AgentTraceContextKey.name];if(i===void 0)return;let o=deserializeState(i),s=Object.values(o.actions).find(e=>e.sessionId===t&&e.turnId===n&&e.callId===r);if(s!==void 0)return withTraceDecision(e,{isRemote:!1,spanId:s.spanId,traceFlags:s.parent.traceFlags,traceId:s.parent.traceId},o.sessions[s.sessionId]?.decision)}function withTraceDecision(e,t,n){let i=e[SessionTraceSeedKey.name],a=n??i?.decision;return a===void 0?t:{...t,decision:a}}var ContextAgentTraceStateStore=class{deleteAction(e){updateState(t=>{let n={...t.actions};return delete n[e],{...t,actions:n}})}deleteActions(e,t){updateState(n=>{let r={...n.actions};for(let[n,i]of Object.entries(r))i.sessionId===e&&(t===void 0||i.turnId===t)&&delete r[n];return{...n,actions:r}})}deleteSession(e){updateState(t=>{let n={...t.sessions};return delete n[e],{...t,sessions:n}})}deleteTurn(e,t){updateState(n=>{let r={...n.turns};return delete r[turnKey(e,t)],{...n,turns:r}})}findAction(e,n){return Object.values(contextStorage.getStore()?.get(AgentTraceContextKey)?.actions??{}).find(t=>t.sessionId===e&&t.callId===n)}getAction(e){return contextStorage.getStore()?.get(AgentTraceContextKey)?.actions[e]}getSession(e){return contextStorage.getStore()?.get(AgentTraceContextKey)?.sessions[e]}getTurn(e,n){return contextStorage.getStore()?.get(AgentTraceContextKey)?.turns[turnKey(e,n)]}setAction(e,t){updateState(n=>({...n,actions:{...n.actions,[e]:t}}))}setSession(e,t){updateState(n=>({...n,sessions:{...n.sessions,[e]:t}}))}setTurn(e,t,n){updateState(r=>({...r,turns:{...r.turns,[turnKey(e,t)]:n}}))}updateTurn(e,t,n){updateState(r=>{let i=turnKey(e,t),a=r.turns[i];return a===void 0?r:{...r,turns:{...r.turns,[i]:n(a)}}})}};function updateState(e){loadContext().set(AgentTraceContextKey,t=>e(t??{actions:{},sessions:{},turns:{}}))}function turnKey(e,t){return`${e}\0${t}`}function serializeState(e){return{actions:e.actions,sessions:Object.fromEntries(Object.entries(e.sessions).map(([e,t])=>[e,{...t,context:serializeSpanContext(t.context)}])),turns:Object.fromEntries(Object.entries(e.turns).map(([e,t])=>[e,{...t,context:serializeSpanContext(t.context),terminal:t.terminal===void 0?void 0:t.terminal.type===`turn.failed`?{error:serializeError(t.terminal.error),type:t.terminal.type}:{type:t.terminal.type}}]))}}function deserializeState(t){return isRecord(t)?{actions:deserializeRecord(t.actions,deserializeAction),sessions:deserializeRecord(t.sessions,t=>{if(!(!isRecord(t)||!isSpanContext(t.context)))return{agentName:typeof t.agentName==`string`?t.agentName:void 0,channelAudience:normalizeChannelAudience(t.channelAudience),channelKind:typeof t.channelKind==`string`?t.channelKind:void 0,context:t.context,decision:deserializeInstrumentationDecision(t.decision),rootSessionId:typeof t.rootSessionId==`string`?t.rootSessionId:``}}),turns:deserializeRecord(t.turns,e=>{if(!(!isRecord(e)||!isSpanContext(e.context))&&!(typeof e.parentSpanId!=`string`||typeof e.startTimeMs!=`number`))return{context:e.context,modelUsage:deserializeModelUsage(e.modelUsage),parentIsRemote:typeof e.parentIsRemote==`boolean`?e.parentIsRemote:void 0,parentSpanId:e.parentSpanId,rootSessionId:typeof e.rootSessionId==`string`?e.rootSessionId:``,sequence:typeof e.sequence==`number`?e.sequence:0,startTimeMs:e.startTimeMs,subagentName:typeof e.subagentName==`string`?e.subagentName:void 0,terminal:deserializeTerminal(e.terminal)}})}:{actions:{},sessions:{},turns:{}}}function deserializeModelUsage(e){if(!isRecord(e))return;let t=typeof e.inputTokens==`number`?e.inputTokens:void 0,n=typeof e.outputTokens==`number`?e.outputTokens:void 0;return t===void 0&&n===void 0?void 0:{inputTokens:t,outputTokens:n}}function deserializeAction(t){if(!(!isRecord(t)||typeof t.attemptIndex!=`number`||typeof t.callId!=`string`||!isActionKind(t.kind)||typeof t.name!=`string`||!isSpanContext(t.parent)||typeof t.rootSessionId!=`string`||typeof t.sessionId!=`string`||typeof t.spanId!=`string`||typeof t.startTimeMs!=`number`||typeof t.stepIndex!=`number`||typeof t.turnId!=`string`))return{attemptIndex:t.attemptIndex,callId:t.callId,channelAudience:normalizeChannelAudience(t.channelAudience),inputAttribute:typeof t.inputAttribute==`string`?t.inputAttribute:void 0,kind:t.kind,name:t.name,parent:t.parent,rootSessionId:t.rootSessionId,sessionId:t.sessionId,spanId:t.spanId,startTimeMs:t.startTimeMs,stepIndex:t.stepIndex,turnId:t.turnId}}function isActionKind(e){return e===`load-skill`||e===`remote-agent-call`||e===`subagent-call`||e===`tool-call`}function deserializeRecord(e,t){if(!isRecord(e))return{};let n={};for(let[r,i]of Object.entries(e)){let e=t(i);e!==void 0&&(n[r]=e)}return n}function deserializeTerminal(e){if(!isRecord(e)||typeof e.type!=`string`)return;let t=e.type;if(isTurnTerminalType(t))return t===`turn.failed`?{error:deserializeError(e.error),type:t}:{type:t}}function serializeSpanContext(e){return{isRemote:e.isRemote,spanId:e.spanId,traceFlags:e.traceFlags,traceId:e.traceId}}function isSpanContext(e){return isRecord(e)&&typeof e.spanId==`string`&&typeof e.traceFlags==`number`&&typeof e.traceId==`string`}function serializeError(e){return e instanceof Error?{message:e.message,name:e.name,stack:e.stack}:void 0}function deserializeError(e){if(!isRecord(e)||typeof e.message!=`string`)return;let t=Error(e.message);return typeof e.name==`string`&&(t.name=e.name),typeof e.stack==`string`&&(t.stack=e.stack),t}function isTurnTerminalType(e){return e===`turn.cancelled`||e===`turn.completed`||e===`turn.failed`}function deserializeInstrumentationDecision(e){if(isRecord(e))return e.action===`drop`?{action:`drop`}:e.action===`record`&&typeof e.recordInputs==`boolean`&&typeof e.recordOutputs==`boolean`?{action:`record`,recordInputs:e.recordInputs,recordOutputs:e.recordOutputs}:void 0}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{ContextAgentTraceStateStore,preserveSerializedAgentTraceState,readActionTraceContext,readCurrentSessionTraceDecision,readSessionTraceContext,readSessionTraceDecision};
1
+ import{normalizeChannelAudience}from"#shared/channel-audience.js";import{contextStorage,loadContext}from"#context/container.js";import{SessionTraceSeedKey}from"#context/keys.js";import{ContextKey}from"#context/key.js";import{decisionToTraceContentCeiling,resolveForwardedTraceSeed}from"#shared/forwarded-trace-policy.js";import{readInstrumentationDecision}from"#shared/instrumentation-decision.js";const AgentTraceContextKey=new ContextKey(`eve.harness.agentTrace`,{codec:{deserialize:deserializeState,serialize:serializeState}});function readCurrentSessionTraceDecision(e){let n=contextStorage.getStore();return n===void 0?void 0:readSessionTraceDecision(n,e)}function readSessionTraceDecision(e,t){return e.get(AgentTraceContextKey)?.sessions[t]?.decision}function preserveSerializedAgentTraceState(e,t){let n=t[AgentTraceContextKey.name];return n===void 0?e:{...e,[AgentTraceContextKey.name]:n}}function readSessionTraceContext(e,t){let n=e[AgentTraceContextKey.name];if(n===void 0)return;let r=deserializeState(n).sessions[t];return r===void 0?void 0:withTraceDecision(e,r.context,r.decision)}function readActionTraceContext(e,t,n,r){let i=e[AgentTraceContextKey.name];if(i===void 0)return;let a=deserializeState(i),o=Object.values(a.actions).find(e=>e.sessionId===t&&e.turnId===n&&e.callId===r);if(o!==void 0)return withTraceDecision(e,{isRemote:!1,spanId:o.spanId,traceFlags:o.parent.traceFlags,traceId:o.parent.traceId},a.sessions[o.sessionId]?.decision)}function withTraceDecision(e,t,n){let i=e[SessionTraceSeedKey.name],s=resolveForwardedTraceSeed({decision:n??i?.decision,forwardedTracePolicy:i?.forwardedTracePolicy,traceFlags:t.traceFlags}),c=s.decision,l=s.forwardedTracePolicy,u=decisionToTraceContentCeiling(c),d={...t,traceFlags:s.traceFlags};if(l===void 0)return c===void 0?d:{...d,decision:c};let f=u===void 0?l:{...l,ceiling:u};return c===void 0?{...d,forwardedTracePolicy:f}:{...d,decision:c,forwardedTracePolicy:f}}var ContextAgentTraceStateStore=class{deleteAction(e){updateState(t=>{let n={...t.actions};return delete n[e],{...t,actions:n}})}deleteActions(e,t){updateState(n=>{let r={...n.actions};for(let[n,i]of Object.entries(r))i.sessionId===e&&(t===void 0||i.turnId===t)&&delete r[n];return{...n,actions:r}})}deleteSession(e){updateState(t=>{let n={...t.sessions};return delete n[e],{...t,sessions:n}})}deleteTurn(e,t){updateState(n=>{let r={...n.turns};return delete r[turnKey(e,t)],{...n,turns:r}})}findAction(e,n){return Object.values(contextStorage.getStore()?.get(AgentTraceContextKey)?.actions??{}).find(t=>t.sessionId===e&&t.callId===n)}getAction(e){return contextStorage.getStore()?.get(AgentTraceContextKey)?.actions[e]}getSession(e){return contextStorage.getStore()?.get(AgentTraceContextKey)?.sessions[e]}getTurn(e,n){return contextStorage.getStore()?.get(AgentTraceContextKey)?.turns[turnKey(e,n)]}setAction(e,t){updateState(n=>({...n,actions:{...n.actions,[e]:t}}))}setSession(e,t){updateState(n=>({...n,sessions:{...n.sessions,[e]:t}}))}setTurn(e,t,n){updateState(r=>({...r,turns:{...r.turns,[turnKey(e,t)]:n}}))}updateTurn(e,t,n){updateState(r=>{let i=turnKey(e,t),a=r.turns[i];return a===void 0?r:{...r,turns:{...r.turns,[i]:n(a)}}})}};function updateState(e){loadContext().set(AgentTraceContextKey,t=>e(t??{actions:{},sessions:{},turns:{}}))}function turnKey(e,t){return`${e}\0${t}`}function serializeState(e){return{actions:e.actions,sessions:Object.fromEntries(Object.entries(e.sessions).map(([e,t])=>[e,{...t,context:serializeSpanContext(t.context)}])),turns:Object.fromEntries(Object.entries(e.turns).map(([e,t])=>[e,{...t,context:serializeSpanContext(t.context),terminal:t.terminal===void 0?void 0:t.terminal.type===`turn.failed`?{error:serializeError(t.terminal.error),type:t.terminal.type}:{type:t.terminal.type}}]))}}function deserializeState(t){return isRecord(t)?{actions:deserializeRecord(t.actions,deserializeAction),sessions:deserializeRecord(t.sessions,t=>{if(!(!isRecord(t)||!isSpanContext(t.context)))return{agentName:typeof t.agentName==`string`?t.agentName:void 0,channelAudience:normalizeChannelAudience(t.channelAudience),channelKind:typeof t.channelKind==`string`?t.channelKind:void 0,context:t.context,decision:readInstrumentationDecision(t.decision),rootSessionId:typeof t.rootSessionId==`string`?t.rootSessionId:``}}),turns:deserializeRecord(t.turns,e=>{if(!(!isRecord(e)||!isSpanContext(e.context))&&!(typeof e.parentSpanId!=`string`||typeof e.startTimeMs!=`number`))return{context:e.context,modelUsage:deserializeModelUsage(e.modelUsage),parentIsRemote:typeof e.parentIsRemote==`boolean`?e.parentIsRemote:void 0,parentSpanId:e.parentSpanId,rootSessionId:typeof e.rootSessionId==`string`?e.rootSessionId:``,sequence:typeof e.sequence==`number`?e.sequence:0,startTimeMs:e.startTimeMs,subagentName:typeof e.subagentName==`string`?e.subagentName:void 0,terminal:deserializeTerminal(e.terminal)}})}:{actions:{},sessions:{},turns:{}}}function deserializeModelUsage(e){if(!isRecord(e))return;let t=typeof e.inputTokens==`number`?e.inputTokens:void 0,n=typeof e.outputTokens==`number`?e.outputTokens:void 0;return t===void 0&&n===void 0?void 0:{inputTokens:t,outputTokens:n}}function deserializeAction(t){if(!(!isRecord(t)||typeof t.attemptIndex!=`number`||typeof t.callId!=`string`||!isActionKind(t.kind)||typeof t.name!=`string`||!isSpanContext(t.parent)||typeof t.rootSessionId!=`string`||typeof t.sessionId!=`string`||typeof t.spanId!=`string`||typeof t.startTimeMs!=`number`||typeof t.stepIndex!=`number`||typeof t.turnId!=`string`))return{attemptIndex:t.attemptIndex,callId:t.callId,channelAudience:normalizeChannelAudience(t.channelAudience),inputAttribute:typeof t.inputAttribute==`string`?t.inputAttribute:void 0,kind:t.kind,name:t.name,parent:t.parent,rootSessionId:t.rootSessionId,sessionId:t.sessionId,spanId:t.spanId,startTimeMs:t.startTimeMs,stepIndex:t.stepIndex,turnId:t.turnId}}function isActionKind(e){return e===`load-skill`||e===`remote-agent-call`||e===`subagent-call`||e===`tool-call`}function deserializeRecord(e,t){if(!isRecord(e))return{};let n={};for(let[r,i]of Object.entries(e)){let e=t(i);e!==void 0&&(n[r]=e)}return n}function deserializeTerminal(e){if(!isRecord(e)||typeof e.type!=`string`)return;let t=e.type;if(isTurnTerminalType(t))return t===`turn.failed`?{error:deserializeError(e.error),type:t}:{type:t}}function serializeSpanContext(e){return{isRemote:e.isRemote,spanId:e.spanId,traceFlags:e.traceFlags,traceId:e.traceId}}function isSpanContext(e){return isRecord(e)&&typeof e.spanId==`string`&&typeof e.traceFlags==`number`&&typeof e.traceId==`string`}function serializeError(e){return e instanceof Error?{message:e.message,name:e.name,stack:e.stack}:void 0}function deserializeError(e){if(!isRecord(e)||typeof e.message!=`string`)return;let t=Error(e.message);return typeof e.name==`string`&&(t.name=e.name),typeof e.stack==`string`&&(t.stack=e.stack),t}function isTurnTerminalType(e){return e===`turn.cancelled`||e===`turn.completed`||e===`turn.failed`}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{ContextAgentTraceStateStore,preserveSerializedAgentTraceState,readActionTraceContext,readCurrentSessionTraceDecision,readSessionTraceContext,readSessionTraceDecision};
@@ -38,9 +38,11 @@ export interface OtelOptions {
38
38
  * existing audience-aware behavior; explicit decisions can disable emission
39
39
  * or select input and output capture independently. Defaults to emitting
40
40
  * every audience, with content only for public conversations. The result is
41
- * an OpenTelemetry capture ceiling: per-delivery audience and destination
42
- * settings can only narrow it. It never changes what authored instrumentation
43
- * providers receive. A thrown error rejects trace production without
41
+ * an OpenTelemetry capture ceiling: local delivery audience and destination
42
+ * settings can only narrow it. For a trusted remote trace, eve evaluates this
43
+ * policy against the immutable origin audience and intersects it with the
44
+ * parent's effective ceiling, so every hop can only narrow capture. It never
45
+ * changes what authored instrumentation providers receive. A thrown error rejects trace production without
44
46
  * silencing lifecycle providers. The policy may be invoked more than once
45
47
  * while a new session is being prepared, so it must be deterministic for
46
48
  * consistent results.
@@ -13,7 +13,7 @@ export declare function registerOtelPipeline(input: {
13
13
  readonly pipeline: OtelPipeline;
14
14
  readonly serviceName: string;
15
15
  }): RegisteredOtelPipeline;
16
- /** Lifecycle retained from the tracer provider that owns every destination. */
16
+ /** Lifecycle retained from the providers that own every destination. */
17
17
  export interface RegisteredOtelPipeline {
18
18
  readonly forceFlush: () => Promise<void>;
19
19
  readonly idGenerator: AgentSpanIdGenerator;
@@ -1 +1 @@
1
- import{createRequire}from"node:module";import{context,propagation,trace}from"#compiled/@opentelemetry/api/index.js";import{AgentSpanIdGenerator}from"#tracing/agent-span-id-generator.js";import{registerOTel}from"#compiled/@vercel/otel/index.js";const REGISTRATION_SPAN_NAME=`eve.otel.registration`,REPLAY_DEDUPLICATION_LIMIT=1e5,require=createRequire(import.meta.url);var RegistrationMarkerPropagator=class{#e=!1;extract(e){return e}fields(){return[]}inject(){this.#e=!0}isInstalled(){return this.#e=!1,propagation.inject(context.active(),{},{set:()=>{}}),this.#e}},PrivateSpanFilteringProcessor=class{endedSpans=new Set;forwardedSpans=new Set;pendingByParent=new Map;pendingSpanCount=0;processors;startedSpans=new Set;constructor(e){this.processors=e}async forceFlush(){this.drainPendingSpans(),await Promise.all(this.processors.map(e=>e.forceFlush()))}onEnd(e){if(isRegistrationSpan(e))return;let t=spanIdentity(e);if(t!==void 0){if(this.endedSpans.has(t))return;if(this.endedSpans.size>=REPLAY_DEDUPLICATION_LIMIT){let e=this.endedSpans.values().next().value;e!==void 0&&this.endedSpans.delete(e)}this.endedSpans.add(t)}let n=parentIdentity(e);if(n!==void 0&&this.startedSpans.has(n)&&!this.forwardedSpans.has(n)){let t=this.pendingByParent.get(n)??[];t.push(e),this.pendingByParent.set(n,t),this.pendingSpanCount+=1,this.pendingSpanCount>1e4&&this.releaseOldestPendingParent();return}this.forward(e,t)}onStart(e,t){if(isRegistrationSpan(e))return;let n=spanIdentity(e);n!==void 0&&addBounded(this.startedSpans,n);for(let n of this.processors)n.onStart(e,t)}async shutdown(){this.drainPendingSpans(),await Promise.all(this.processors.map(e=>e.shutdown()))}drainPendingSpans(){for(;this.pendingByParent.size>0;)this.releaseOldestPendingParent()}releaseOldestPendingParent(){let e=this.pendingByParent.keys().next().value;e!==void 0&&this.releaseChildren(e)}releaseChildren(e){let t=this.pendingByParent.get(e);if(t!==void 0){this.pendingByParent.delete(e),this.pendingSpanCount-=t.length;for(let e of t)this.forward(e,spanIdentity(e))}}forward(e,t){for(let t of this.processors)t.onEnd(e);t!==void 0&&(addBounded(this.forwardedSpans,t),this.releaseChildren(t))}};function registerOtelPipeline(e){let{pipeline:t}=e,n=captureOptionalPeerTracerProxy(),r=new AgentSpanIdGenerator,i=new RegistrationMarkerPropagator,a={attributes:t.resource,autoDetectResources:!1,idGenerator:r,instrumentations:t.instrumentations??[],metricReaders:t.metricReaders,propagators:[...t.propagators??[`auto`],i],serviceName:e.serviceName,spanProcessors:t.spanProcessors.map(e=>isSpanProcessor(e)?new PrivateSpanFilteringProcessor([e]):e)};registerOTel(t.sampler===void 0?a:{...a,traceSampler:t.sampler});let o=globalTracerUses(r),s=i.isInstalled();if((!o||!s)&&rollbackRegistration({ownsPropagator:s,ownsTracer:o}),!o)throw Error("eve could not register OpenTelemetry because another runtime already owns the global tracer provider. Remove the other `registerOTel` call, or move its exporters into eve's `otelIntegration({ spanProcessors: [...] })`.");if(!s)throw Error("eve could not register OpenTelemetry because another runtime already owns the global propagator. Remove the other global propagator registration and declare propagators through eve's `otel()` instead.");let c=runtimeTracerProvider();if(typeof c.forceFlush!=`function`||typeof c.shutdown!=`function`)throw rollbackRegistration({ownsPropagator:s,ownsTracer:o}),Error(`The registered OpenTelemetry tracer provider has no lifecycle methods.`);return n?.setDelegate(c),{forceFlush:()=>c.forceFlush(),idGenerator:r,samplesTrace:e=>samplerAdmitsTrace(r,e),shutdown:()=>c.shutdown()}}function samplerAdmitsTrace(e,t){return(e.withTraceId(t,()=>trace.getTracer(`eve.registration`).startSpan(REGISTRATION_SPAN_NAME,{root:!0})).spanContext().traceFlags&1)==1}function captureOptionalPeerTracerProxy(){try{let e=require("@opentelemetry/api"),t=e.trace.getTracerProvider();return t instanceof e.ProxyTracerProvider?t:void 0}catch{return}}function rollbackRegistration(e){if(e.ownsPropagator&&propagation.disable(),!e.ownsTracer)return;let t=runtimeTracerProvider();if(typeof t.shutdown==`function`)try{t.shutdown().catch(()=>{})}catch{}trace.disable()}function runtimeTracerProvider(){let e=trace.getTracerProvider();return e.getDelegate?.()??e}function globalTracerUses(e){let t=e.allocateSpanId();return e.withSpanId(t,()=>trace.getTracer(`eve.registration`).startSpan(REGISTRATION_SPAN_NAME)).spanContext().spanId===t}function isRegistrationSpan(e){return typeof e==`object`&&!!e&&`name`in e&&e.name===REGISTRATION_SPAN_NAME}function spanIdentity(e){if(typeof e!=`object`||!e||!(`spanContext`in e)||typeof e.spanContext!=`function`)return;let t=e.spanContext();return typeof t.traceId==`string`&&typeof t.spanId==`string`?`${t.traceId}:${t.spanId}`:void 0}function parentIdentity(e){if(typeof e!=`object`||!e||!(`parentSpanContext`in e))return;let t=e.parentSpanContext;return typeof t?.traceId==`string`&&typeof t.spanId==`string`?`${t.traceId}:${t.spanId}`:void 0}function addBounded(e,t){if(e.size>=REPLAY_DEDUPLICATION_LIMIT){let t=e.values().next().value;t!==void 0&&e.delete(t)}e.add(t)}function isSpanProcessor(e){return e!==`auto`}export{registerOtelPipeline};
1
+ import{createRequire}from"node:module";import{context,metrics,propagation,trace}from"#compiled/@opentelemetry/api/index.js";import{AgentSpanIdGenerator}from"#tracing/agent-span-id-generator.js";import{registerOTel}from"#compiled/@vercel/otel/index.js";const REGISTRATION_SPAN_NAME=`eve.otel.registration`,REPLAY_DEDUPLICATION_LIMIT=1e5,require=createRequire(import.meta.url);var RegistrationMarkerPropagator=class{#e=!1;extract(e){return e}fields(){return[]}inject(){this.#e=!0}isInstalled(){return this.#e=!1,propagation.inject(context.active(),{},{set:()=>{}}),this.#e}},PrivateSpanFilteringProcessor=class{endedSpans=new Set;forwardedSpans=new Set;pendingByParent=new Map;pendingSpanCount=0;processors;startedSpans=new Set;constructor(e){this.processors=e}async forceFlush(){this.drainPendingSpans(),await Promise.all(this.processors.map(e=>e.forceFlush()))}onEnd(e){if(isRegistrationSpan(e))return;let t=spanIdentity(e);if(t!==void 0){if(this.endedSpans.has(t))return;if(this.endedSpans.size>=REPLAY_DEDUPLICATION_LIMIT){let e=this.endedSpans.values().next().value;e!==void 0&&this.endedSpans.delete(e)}this.endedSpans.add(t)}let n=parentIdentity(e);if(n!==void 0&&this.startedSpans.has(n)&&!this.forwardedSpans.has(n)){let t=this.pendingByParent.get(n)??[];t.push(e),this.pendingByParent.set(n,t),this.pendingSpanCount+=1,this.pendingSpanCount>1e4&&this.releaseOldestPendingParent();return}this.forward(e,t)}onStart(e,t){if(isRegistrationSpan(e))return;let n=spanIdentity(e);n!==void 0&&addBounded(this.startedSpans,n);for(let n of this.processors)n.onStart(e,t)}async shutdown(){this.drainPendingSpans(),await Promise.all(this.processors.map(e=>e.shutdown()))}drainPendingSpans(){for(;this.pendingByParent.size>0;)this.releaseOldestPendingParent()}releaseOldestPendingParent(){let e=this.pendingByParent.keys().next().value;e!==void 0&&this.releaseChildren(e)}releaseChildren(e){let t=this.pendingByParent.get(e);if(t!==void 0){this.pendingByParent.delete(e),this.pendingSpanCount-=t.length;for(let e of t)this.forward(e,spanIdentity(e))}}forward(e,t){for(let t of this.processors)t.onEnd(e);t!==void 0&&(addBounded(this.forwardedSpans,t),this.releaseChildren(t))}};function registerOtelPipeline(e){let{pipeline:t}=e,n=captureOptionalPeerTracerProxy(),r=new AgentSpanIdGenerator,i=new RegistrationMarkerPropagator,a={attributes:t.resource,autoDetectResources:!1,idGenerator:r,instrumentations:t.instrumentations??[],metricReaders:t.metricReaders,propagators:[...t.propagators??[`auto`],i],serviceName:e.serviceName,spanProcessors:t.spanProcessors.map(e=>isSpanProcessor(e)?new PrivateSpanFilteringProcessor([e]):e)};registerOTel(t.sampler===void 0?a:{...a,traceSampler:t.sampler});let o=globalTracerUses(r),s=i.isInstalled();if((!o||!s)&&rollbackRegistration({ownsPropagator:s,ownsTracer:o}),!o)throw Error("eve could not register OpenTelemetry because another runtime already owns the global tracer provider. Remove the other `registerOTel` call, or move its exporters into eve's `otelIntegration({ spanProcessors: [...] })`.");if(!s)throw Error("eve could not register OpenTelemetry because another runtime already owns the global propagator. Remove the other global propagator registration and declare propagators through eve's `otel()` instead.");let c=runtimeTracerProvider();if(typeof c.forceFlush!=`function`||typeof c.shutdown!=`function`)throw rollbackRegistration({ownsPropagator:s,ownsTracer:o}),Error(`The registered OpenTelemetry tracer provider has no lifecycle methods.`);n?.setDelegate(c);let l=runtimeMeterProvider();return{forceFlush:async()=>{await Promise.all([c.forceFlush(),l.forceFlush?.()])},idGenerator:r,samplesTrace:e=>samplerAdmitsTrace(r,e),shutdown:async()=>{disableInstrumentations(t.instrumentations),await Promise.all([c.shutdown(),l.shutdown?.()])}}}function samplerAdmitsTrace(e,t){return(e.withTraceId(t,()=>trace.getTracer(`eve.registration`).startSpan(REGISTRATION_SPAN_NAME,{root:!0})).spanContext().traceFlags&1)==1}function captureOptionalPeerTracerProxy(){try{let e=require("@opentelemetry/api"),t=e.trace.getTracerProvider();return t instanceof e.ProxyTracerProvider?t:void 0}catch{return}}function rollbackRegistration(e){if(e.ownsPropagator&&propagation.disable(),!e.ownsTracer)return;let t=runtimeTracerProvider();if(typeof t.shutdown==`function`)try{t.shutdown().catch(()=>{})}catch{}trace.disable()}function runtimeTracerProvider(){let e=trace.getTracerProvider();return e.getDelegate?.()??e}function runtimeMeterProvider(){let e=metrics.getMeterProvider();return{forceFlush:typeof e?.forceFlush==`function`?()=>e.forceFlush():void 0,shutdown:typeof e?.shutdown==`function`?()=>e.shutdown():void 0}}function disableInstrumentations(e){for(let t of e??[]){let e=t?.disable;if(typeof e==`function`)try{e.call(t)}catch{}}}function globalTracerUses(e){let t=e.allocateSpanId();return e.withSpanId(t,()=>trace.getTracer(`eve.registration`).startSpan(REGISTRATION_SPAN_NAME)).spanContext().spanId===t}function isRegistrationSpan(e){return typeof e==`object`&&!!e&&`name`in e&&e.name===REGISTRATION_SPAN_NAME}function spanIdentity(e){if(typeof e!=`object`||!e||!(`spanContext`in e)||typeof e.spanContext!=`function`)return;let t=e.spanContext();return typeof t.traceId==`string`&&typeof t.spanId==`string`?`${t.traceId}:${t.spanId}`:void 0}function parentIdentity(e){if(typeof e!=`object`||!e||!(`parentSpanContext`in e))return;let t=e.parentSpanContext;return typeof t?.traceId==`string`&&typeof t.spanId==`string`?`${t.traceId}:${t.spanId}`:void 0}function addBounded(e,t){if(e.size>=REPLAY_DEDUPLICATION_LIMIT){let t=e.values().next().value;t!==void 0&&e.delete(t)}e.add(t)}function isSpanProcessor(e){return e!==`auto`}export{registerOtelPipeline};
@@ -1,3 +1,3 @@
1
- import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-B5zw1dwj.js";
1
+ import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-Bgp6INfi.js";
2
2
 
3
3
  export { defaultMessageReducer, useEveAgent };
@@ -1,3 +1,3 @@
1
- import { t as useEveAgent } from "../chunks/use-eve-agent-B5zw1dwj.js";
1
+ import { t as useEveAgent } from "../chunks/use-eve-agent-Bgp6INfi.js";
2
2
 
3
3
  export { useEveAgent };
@@ -82,6 +82,10 @@ part of the authored channel API.
82
82
 
83
83
  Channel operations are dynamic: every call targets whichever session currently
84
84
  owns the address. Only `send()` can create a session when the address is unowned.
85
+ Cold-start sends return their accepted candidate without waiting for address
86
+ ownership. If simultaneous sends race, eve forwards the losing candidate's
87
+ message to the winner; resolve the address after startup when you need a fixed
88
+ handle to the canonical owner.
85
89
 
86
90
  ```ts
87
91
  const source = from(threadId);
@@ -405,6 +409,8 @@ defineChannel({
405
409
  });
406
410
  ```
407
411
 
412
+ If `fetchFile` throws, eve replaces that attachment with a model-visible error note and continues the turn. Built-in channels include safe details such as the upstream HTTP status. Custom channel errors use a generic note, while eve keeps the original error in operator logs.
413
+
408
414
  The `URL` object survives the queue boundary as a string and is reconstituted inside the workflow step. The staging pipeline calls `fetchFile` with the URL serialized as a string (the URL's `href`), which is why the example matches on `url.startsWith(...)`. Return bytes to stage the file to the sandbox, or `null` to let the URL pass through to the model provider.
409
415
 
410
416
  The framework handles staging bytes to the sandbox, enforcing upload policy, hydrating files for the model call, and reconstituting `URL` objects after queue serialization. See [Inbound attachments](../sandbox#inbound-attachments) for the shared storage, size, and provider-input behavior.
@@ -47,18 +47,26 @@ curl -X POST https://<deployment>/eve/v1/session \
47
47
  # {"ok":true,"sessionId":"wrun_A","status":"accepted"}
48
48
  ```
49
49
 
50
+ The `202` response means Workflow accepted the durable run. The route does not wait for command
51
+ inbox or continuation-token ownership. The inbox may still be starting, so an immediate follow-up
52
+ or control request can report that the session is not active. The event-stream client retries the
53
+ brief window before the new run becomes readable.
54
+
50
55
  Authenticated callers that may retry a create request can pass their own `operationId` for
51
- create-once semantics. The same operation under the same authenticated principal returns the
52
- active session it already created instead of dispatching the input again. The first accepted
53
- payload wins; retries with different input still return that first session. Anonymous callers
54
- cannot use `operationId`, and operation ownership expires when the session is no longer resumable.
56
+ create-once semantics. Once the operation owner is active, the same operation under the same
57
+ authenticated principal returns that session instead of dispatching the input again. The create
58
+ route does not wait for a concurrently starting request to publish ownership: simultaneous
59
+ requests can receive different accepted candidate IDs, while only the candidate that claims the
60
+ operation runs its first turn. Retry the operation after startup when you need its canonical
61
+ session ID. Anonymous callers cannot use `operationId`, and operation ownership expires when the
62
+ session is no longer resumable.
55
63
 
56
64
  ```bash
57
65
  curl -X POST https://<deployment>/eve/v1/session \
58
66
  -H "Authorization: Bearer <token>" \
59
67
  -H "Content-Type: application/json" \
60
68
  -d '{"message":"What is the weather in Paris?","operationId":"order-4213-research"}'
61
- # {"ok":true,"sessionId":"wrun_A","status":"accepted"} — retries return the same sessionId
69
+ # {"ok":true,"sessionId":"wrun_A","status":"accepted"}
62
70
  ```
63
71
 
64
72
  The first request requires `message`. A follow-up request accepts exactly one of
@@ -72,7 +80,7 @@ curl -X POST https://<deployment>/eve/v1/session/wrun_A \
72
80
 
73
81
  Follow-up messages use `turnPolicy: "steer"` by default. If a turn is active, eve buffers the message before cooperatively cancelling that turn, then starts the follow-up as a replacement turn with a new turn ID. Set `turnPolicy: "queue"` on `eveChannel(...)` when follow-ups should wait for active turns to finish. `inputResponses` never steer.
74
82
 
75
- Sending a message to an unknown or terminal session ID returns `409` with
83
+ Sending a message to an unknown, terminal, or not-yet-active session ID returns `409` with
76
84
  `{"code":"session_not_active","error":"The session is no longer active.","ok":false}`.
77
85
  TypeScript clients expose the stable code as `ClientError.code`. The route never
78
86
  creates or follows a replacement session.
@@ -171,7 +171,10 @@ MCP clients receive four tools:
171
171
  | `agent_update` | `{ invocationId, responses }` | Answer the complete pending human-input batch. |
172
172
  | `agent_cancel` | `{ invocationId }` | Request cooperative cancellation of non-terminal work. |
173
173
 
174
- `agent_start` creates one task-mode eve session and returns after durable acceptance. Keep its `invocationId`, then call `agent_get` until the invocation reaches a terminal state. While the status is `working`, wait at least `pollAfterMs` before polling again.
174
+ `agent_start` creates one task-mode eve session and returns after durable acceptance without
175
+ waiting for the session continuation hook to become readable. Keep its `invocationId`, then call
176
+ `agent_get` until the invocation reaches a terminal state. While the status is `working`, wait at
177
+ least `pollAfterMs` before polling again.
175
178
 
176
179
  The invocation response is discriminated by `status`:
177
180
 
@@ -70,10 +70,15 @@ Inbound files are off by default. Opt in to allow personal-scope downloads and p
70
70
 
71
71
  ```ts
72
72
  export default teamsChannel({
73
- files: { enabled: true, allowedHosts: ["contoso.sharepoint.com"] },
73
+ files: {
74
+ enabled: true,
75
+ allowedHosts: ["smba.trafficmanager.net", "contoso.sharepoint.com"],
76
+ },
74
77
  });
75
78
  ```
76
79
 
80
+ eve authenticates downloads from Microsoft Bot Connector hosts with your bot credentials. Downloads from other allowlisted hosts remain unauthenticated.
81
+
77
82
  ## What to read next
78
83
 
79
84
  - [Channels overview](./overview): the channel contract and every built-in channel
@@ -32,8 +32,10 @@ curl -X POST http://127.0.0.1:2000/eve/v1/session \
32
32
  -d '{"message":"Summarize the latest forecast."}'
33
33
  ```
34
34
 
35
- eve responds right away with the durable `sessionId` in the JSON body and
36
- `x-eve-session-id` header.
35
+ eve responds with `202` and the durable `sessionId` in the JSON body and
36
+ `x-eve-session-id` header as soon as Workflow accepts the run. The command inbox can still be
37
+ starting at that point. An immediate follow-up can return `409 session_not_active`; wait for
38
+ `session.waiting` before sending the next message.
37
39
 
38
40
  ## Stream a session
39
41
 
@@ -239,7 +239,11 @@ export default eveChannel({
239
239
 
240
240
  The predicate authorizes the _forwarder_ (the verified route-auth principal — who is asserting), not the forwarded principal (what is asserted). Match it precisely: a permissive predicate like `() => true` lets any caller that passes route auth assert any principal, including preview deployments of your own project when `vercelOidc()` is in the walk. `trustedForwarders` exists only on your authored channel — the framework default channel never accepts a forwarded principal, so a receiving deployment must author `agent/channels/eve.ts`.
241
241
 
242
- When the predicate accepts a create request, `ctx.session.auth.current` and `.initiator` carry the forwarded user exactly as if they had called your deployment directly. On continuation, only `auth.current` is replaced; `auth.initiator` remains the session creator. User-scoped connections, local subagents, and further `forwardPrincipal` hops therefore see the active turn's caller. The forwarder is recorded on accepted contexts as the `eve:forwarded-by` attribute (always overwritten by the receiver, so a forwarder cannot falsify it). Rejections fail loud: a forwarded body without `trustedForwarders` configured or with a forwarder the predicate refuses is a `403`, and a malformed payload is a `400`. Only principal metadata is ever accepted — tokens and credentials never cross the hop.
242
+ When the predicate accepts a create request, `ctx.session.auth.current` and `.initiator` carry the forwarded user exactly as if they had called your deployment directly. On continuation, only `auth.current` is replaced; `auth.initiator` remains the session creator. User-scoped connections, local subagents, and further `forwardPrincipal` hops therefore see the active turn's caller.
243
+
244
+ The forwarder is recorded on accepted contexts as the `eve:forwarded-by` attribute (always overwritten by the receiver, so a forwarder cannot falsify it). Rejections fail loud: a forwarded body without `trustedForwarders` configured or with a forwarder the predicate refuses is a `403`, and a malformed payload is a `400`. Only principal metadata is ever accepted — tokens and credentials never cross the hop.
245
+
246
+ For requests marked as remote delegations by a callback body and valid sampled `traceparent`, the same accepted `trustedForwarders` result may admit an origin audience and directional content ceiling from one W3C Baggage member. The assertion is not an authorization grant: the receiver's trace policy independently decides against the immutable origin audience, and the two decisions are intersected. Every later hop forwards only that narrowed result. Malformed, partial, unsampled, or mixed-version assertions become metadata-only. The callback and headers are caller-supplied—the verified transport principal and `trustedForwarders` are the trust boundary. See [Preserving trace content](./remote-agents#preserving-trace-content).
243
247
 
244
248
  > ⚠️ Both deployments must support continuation forwarding before you resume persistent remote sessions. A create-only receiver rejects a forwarded continuation with HTTP 400; the sender does not fall back to service authority. See [Forwarding the caller identity](./remote-agents#forwarding-the-caller-identity) for the upgrade behavior.
245
249
 
@@ -36,6 +36,12 @@ console.log(result.status, result.message);
36
36
 
37
37
  When the stream includes `session.failed`, the turn returns `status: "failed"` rather than throwing. Transport and route errors throw `ClientError`.
38
38
 
39
+ `session.send()` retries `409 session_not_active` three times when a durable run has been accepted
40
+ but its command inbox is still starting. The retries wait 250 ms, 500 ms, and 1 second. Other
41
+ errors, `session.respond()`, control methods, and raw HTTP requests do not use this retry. An unknown
42
+ session still throws `ClientError` immediately, while a terminal session throws after the final
43
+ attempt. The client never creates a replacement session.
44
+
39
45
  ## Send a full turn payload
40
46
 
41
47
  Pass the full payload to `create()` for the first turn or `send()` for a follow-up:
@@ -13,35 +13,47 @@ The transcript remains in your terminal scrollback after you exit. Run `/help` i
13
13
 
14
14
  ## Commands
15
15
 
16
- | Command | Description |
17
- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
18
- | `/model` | Configure the model and its provider. Pass a model ID to set it directly: `/model provider/model-id`. |
19
- | `/add` | Browse and install channels, MCP connections, extensions, and observability integrations. Pass an item address to open it directly: `/add channel/slack`. |
20
- | `/deploy` | Deploy the agent to Vercel production. Links the directory first if needed. |
21
- | `/vc:install` | Install the Vercel CLI. |
22
- | `/vc:login` | Log in to Vercel or restore access to a remote deployment. |
23
- | `/info` | Show the resolved application, compiled artifacts, discovery diagnostics, and messaging routes. |
24
- | `/loglevel` | Choose which server and agent logs appear in the transcript. |
25
- | `/traces` | Open the local trace viewer. Pass a trace ID prefix to open a specific trace. |
26
- | `/reset` | Start a fresh session. |
27
- | `/cancel` | Cancel the current turn without discarding settled context. |
28
- | `/clear` | Clear the session's model-message history. `/new` is an alias. |
29
- | `/compact` | Compact the current session's context. |
30
- | `/exit` | Quit the UI. |
31
- | `/help` | List available commands. |
16
+ | Command | Description |
17
+ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
18
+ | `/model` | Configure the model and its provider. Pass a model ID to set it directly: `/model provider/model-id`. |
19
+ | `/add` | Select and install channels, MCP connections, extensions, and observability integrations. Pass an item address to confirm and install it directly: `/add channel/slack`. |
20
+ | `/deploy` | Deploy the agent to Vercel production. Links the directory first if needed. |
21
+ | `/vc:install` | Install the Vercel CLI. |
22
+ | `/vc:login` | Log in to Vercel or restore access to a remote deployment. |
23
+ | `/info` | Show the resolved application, compiled artifacts, discovery diagnostics, and messaging routes. |
24
+ | `/loglevel` | Choose which server and agent logs appear in the transcript. |
25
+ | `/traces` | Open the local trace viewer. Pass a trace ID prefix to open a specific trace. |
26
+ | `/reset` | Start a fresh session. |
27
+ | `/cancel` | Cancel the current turn without discarding settled context. |
28
+ | `/clear` | Clear the session's model-message history. `/new` is an alias. |
29
+ | `/compact` | Compact the current session's context. |
30
+ | `/exit` | Quit the UI. |
31
+ | `/help` | List available commands. |
32
32
 
33
33
  `/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
34
 
35
+ ## Set up a new agent
36
+
37
+ After `eve init`, the terminal UI guides you through **Model**, **Channels**, **Integrations**, and **Review** before the first chat prompt. The progress rail keeps the four steps visible throughout onboarding. Model setup can install or upgrade the Vercel CLI, open Vercel login, and resume project linking without leaving the flow.
38
+
39
+ Model and Vercel changes take effect when you complete Model, then onboarding continues to Channels. Channel and integration selections remain drafts until you finish Review. You can move back and forth between Channels, Integrations, and Review; use `/model` after onboarding to change the committed model configuration.
40
+
35
41
  ## Add an integration
36
42
 
37
- Bare `/add` opens the categorized registry browser. Pass an item address — `<category>/<name>`, where category is `channel`, `connection`, `extension`, or `instrumentation` — to skip the category and search screens and open that item directly:
43
+ Bare `/add` opens the standalone planner on **Channels**. It does not include model configuration. The progress rail shows selection counts as you move between **Channels**, **Integrations**, and **Review**.
44
+
45
+ Press `Space` or `Enter` to toggle the highlighted item. Press `Right Arrow` to preserve the current selections and continue, `Left Arrow` to preserve them and go back, or `Esc` to cancel. Installation requires `Enter` on **Install and set up** from Review. During installation, `Esc` cancels only the active item and continues with the remaining selections. The final summary reports installed, cancelled, and failed items separately.
46
+
47
+ Pass an item address to `/add` to confirm and install that exact address without opening the planner:
38
48
 
39
49
  ```text
40
50
  /add channel/slack
41
51
  /add extension/agent-browser
52
+ /add linear
53
+ /add @acme/analytics
42
54
  ```
43
55
 
44
- Either way the UI shows the item's details and asks to confirm before installing, then runs the same installation and setup prompts. Choosing **Back** on a directly addressed item returns to the registry browser.
56
+ The UI installs planner selections in order and offers deployment once after the batch when an installed item requires it.
45
57
 
46
58
  ## Work with the agent
47
59
 
@@ -58,7 +58,7 @@ You are responsible for ensuring any observability or eval provider is approved
58
58
 
59
59
  The third configurable surface, [runtime context events](#runtime-context), attaches per-model-call values to these spans.
60
60
 
61
- Built-in messaging channels classify their instrumentation metadata with an `audience`: `public`, `private`, or `unknown`. Slack public channels and Chat SDK workspace-visible threads are public; direct and private conversations are private; platform surfaces without enough visibility evidence remain unknown.
61
+ Built-in messaging channels classify their instrumentation metadata with an `audience`: `public`, `private`, or `unknown`. Slack public channels and Chat SDK workspace-visible threads are public; direct and private conversations are private; platform surfaces without enough visibility evidence remain unknown. Proactive Slack `receive` / `ctx.send` handoffs stay `unknown` unless the caller passes `audience` on the target, for example when a webhook or schedule already knows the destination channel is public.
62
62
 
63
63
  ## Channel delivery traces
64
64
 
@@ -143,6 +143,31 @@ Forwarding is explicit on both sides. The receiver names which forwarders it tru
143
143
 
144
144
  A receiver on an eve version that predates all principal forwarding may instead drop the unknown field and run the session as your app's service identity; per-user connections there fail with `principal_required`. On remote requests where the dispatching turn has no auth, the field is omitted and the call proceeds on transport trust alone.
145
145
 
146
+ ## Preserving trace content
147
+
148
+ With `forwardPrincipal: true`, a sampled trace carries its original audience and the maximum content the next hop may record. For example, `eve.audience=private;ceiling=i0o1` allows outputs but not inputs. eve sends this as [W3C Baggage](https://www.w3.org/TR/baggage/).
149
+
150
+ The receiver uses it only after `trustedForwarders` accepts the authenticated calling deployment:
151
+
152
+ ```ts title="agent/channels/eve.ts"
153
+ import { eveChannel } from "eve/channels/eve";
154
+ import { vercelOidc, vercelSubject } from "eve/channels/auth";
155
+
156
+ export default eveChannel({
157
+ auth: [vercelOidc()],
158
+ trustedForwarders: (forwarder) =>
159
+ forwarder.subject === vercelSubject({ teamSlug: "acme", projectName: "router" }),
160
+ });
161
+ ```
162
+
163
+ The request must also include a callback and a valid sampled `traceparent`. Those fields identify a remote call, but they do not establish trust. `trustedForwarders` is the authorization boundary.
164
+
165
+ The receiver combines the incoming ceiling with its own trace policy. Each hop may narrow the result, but it cannot restore inputs or outputs removed earlier. The original audience stays the same across remote and local subagent hops. Public origins may include content by default; private and unknown origins stay metadata-only unless both deployments explicitly allow them.
166
+
167
+ The live delivery audience still matters. An unknown callback delivery, or one matching the origin, uses the session decision. A different explicit audience applies its own hard ceiling, so a private delivery stays redacted even when the trace began in public.
168
+
169
+ Missing, malformed, duplicate, unsampled, untrusted, and mixed-version assertions fall back to metadata-only tracing. Dropped traces use only the unsampled trace flag. The decision is fixed when the remote session starts and reused by continuations. Agent Runs shows Workflow content only when both inputs and outputs are allowed.
170
+
146
171
  ## How remote dispatch and callbacks work
147
172
 
148
173
  A local subagent runs inline. A remote one runs in its own deployment, so dispatch is asynchronous:
@@ -26,6 +26,8 @@ Some integrations package several independently installable components. For exam
26
26
 
27
27
  When an official item declares an interactive setup flow or flows, eve asks whether to run them after installation and runs multiple flows in declaration order. Run the printed `eve add <item> --skip-install` command to resume a skipped or cancelled setup later; it reruns the selected components' declared flows from the beginning.
28
28
 
29
+ An official item may identify optional pnpm dependencies that have build scripts. Before installation, eve asks whether to skip those optional packages, allow their build scripts, or abort. Your choice updates `ignoredOptionalDependencies` or `allowBuilds` in the pnpm workspace that owns the project. Allow build scripts only when you trust the packages named in the prompt.
30
+
29
31
  ## Automate setup
30
32
 
31
33
  Use `eve add <item> --non-interactive` when a script or coding agent cannot answer terminal prompts. It prints NDJSON events and exits with a status you can branch on:
@@ -99,4 +99,4 @@ Where an eve agent communicates with people, you may be required to disclose tha
99
99
  - [Tools](./tools): typed actions, the next capability to add
100
100
  - [Context control](./concepts/context-control): all the levers for what the model sees
101
101
  - [Skills](./skills): on-demand procedures, the counterpart to always-on instructions
102
- - [Multi-tenant memory](./patterns/multi-tenant-memory): dynamic instructions that load per-tenant memories each turn
102
+ - [Memory](./memory): provider-backed context that outlives a session, recalled before each turn