eve 0.33.3 → 0.35.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 (414) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +3 -3
  3. package/dist/src/channel/channel-address.d.ts +3 -6
  4. package/dist/src/channel/channel-address.js +1 -1
  5. package/dist/src/channel/channel-operations.d.ts +2 -3
  6. package/dist/src/channel/delivery-metadata.d.ts +9 -0
  7. package/dist/src/channel/delivery-metadata.js +1 -0
  8. package/dist/src/channel/routes.d.ts +1 -0
  9. package/dist/src/channel/session.d.ts +3 -4
  10. package/dist/src/channel/session.js +1 -1
  11. package/dist/src/channel/types.d.ts +20 -3
  12. package/dist/src/chunks/{use-eve-agent-B-Hky2f4.js → use-eve-agent-COmP-H8R.js} +39 -3
  13. package/dist/src/chunks/{use-eve-agent-3oBnxzhV.js → use-eve-agent-CnppTEFk.js} +39 -3
  14. package/dist/src/cli/commands/info.js +1 -1
  15. package/dist/src/cli/commands/trace-detail.d.ts +3 -2
  16. package/dist/src/cli/commands/trace-detail.js +1 -1
  17. package/dist/src/cli/dev/tui/traces/trace-conversation.d.ts +4 -6
  18. package/dist/src/cli/dev/tui/traces/trace-conversation.js +1 -2
  19. package/dist/src/client/agent-info-schema.d.ts +12 -4
  20. package/dist/src/client/agent-info-schema.js +1 -1
  21. package/dist/src/client/index.d.ts +1 -1
  22. package/dist/src/client/message-reducer.js +1 -1
  23. package/dist/src/compiled/.vendor-stamp.json +4 -4
  24. package/dist/src/compiled/@chat-adapter/slack/index.js +1 -1
  25. package/dist/src/compiled/@opentelemetry/api/index.d.ts +32 -3
  26. package/dist/src/compiled/@vercel/otel/index.d.ts +45 -2
  27. package/dist/src/compiled/@workflow/core/index.js +1 -1
  28. package/dist/src/compiled/@workflow/core/runtime.js +3 -3
  29. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  30. package/dist/src/compiled/@workflow/world/env-config.d.ts +1 -0
  31. package/dist/src/compiled/@workflow/world/events.d.ts +92 -35
  32. package/dist/src/compiled/@workflow/world/index.d.ts +3 -2
  33. package/dist/src/compiled/@workflow/world/interfaces.d.ts +25 -23
  34. package/dist/src/compiled/@workflow/world/queue.d.ts +4 -0
  35. package/dist/src/compiled/@workflow/world/runs.d.ts +4 -0
  36. package/dist/src/compiled/@workflow/world/slot-identity.d.ts +53 -0
  37. package/dist/src/compiled/@workflow/world/spec-version.d.ts +36 -1
  38. package/dist/src/compiled/@workflow/world/steps.d.ts +4 -0
  39. package/dist/src/compiled/@workflow/world/ulid.d.ts +6 -0
  40. package/dist/src/compiled/@workflow/world-local/index.js +4 -4
  41. package/dist/src/compiled/@workflow/world-vercel/index.js +13 -17
  42. package/dist/src/compiled/_chunks/workflow/{attribute-changes-6OqdYdi4.js → attribute-changes-BoH7JsWp.js} +3 -3
  43. package/dist/src/compiled/_chunks/workflow/dist-DlFv0aHY.js +40 -0
  44. package/dist/src/compiled/_chunks/workflow/env-config-DxamfI7T.js +1 -0
  45. package/dist/src/compiled/_chunks/workflow/frames-CTpeJYEQ.js +3 -0
  46. package/dist/src/compiled/_chunks/workflow/{functions-CXb61C6h.js → functions-CeeNvKsq.js} +1 -1
  47. package/dist/src/compiled/_chunks/workflow/resume-hook-BPQHjeY5.js +1 -0
  48. package/dist/src/compiled/_chunks/workflow/run-DQ5dOyjm.js +1 -0
  49. package/dist/src/compiled/_chunks/workflow/run-id-BdE0MZz9.js +1 -0
  50. package/dist/src/compiled/_chunks/workflow/sleep-CzdoBiqy.js +1 -0
  51. package/dist/src/compiled/_chunks/workflow/spec-version-DBUVfF_R.js +1 -0
  52. package/dist/src/compiled/_chunks/workflow/undici-CUIybhQ2.js +95 -0
  53. package/dist/src/compiled/_chunks/workflow/wait-until-DK2lnH6U.js +15 -0
  54. package/dist/src/compiled/_chunks/workflow/{wrapper-CDq65xJV.js → wrapper-CMGju7QA.js} +1 -1
  55. package/dist/src/compiled/_chunks/workflow/ws-transport-Csi6Cydc.js +1 -0
  56. package/dist/src/compiler/extension-compatibility.d.ts +14 -14
  57. package/dist/src/compiler/extension-compatibility.js +1 -1
  58. package/dist/src/compiler/manifest.d.ts +8 -8
  59. package/dist/src/compiler/manifest.js +1 -1
  60. package/dist/src/compiler/normalize-agent-config.js +1 -1
  61. package/dist/src/compiler/normalize-extension.d.ts +3 -3
  62. package/dist/src/compiler/normalize-extension.js +1 -1
  63. package/dist/src/compiler/normalize-instructions.d.ts +1 -1
  64. package/dist/src/compiler/normalize-instructions.js +1 -1
  65. package/dist/src/compiler/normalize-manifest.js +1 -3
  66. package/dist/src/context/build-dynamic-tools.d.ts +7 -0
  67. package/dist/src/context/build-dynamic-tools.js +1 -1
  68. package/dist/src/context/dynamic-instruction-lifecycle.d.ts +5 -1
  69. package/dist/src/context/dynamic-instruction-lifecycle.js +1 -1
  70. package/dist/src/context/dynamic-tool-lifecycle.d.ts +7 -0
  71. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  72. package/dist/src/context/keys.d.ts +18 -2
  73. package/dist/src/context/keys.js +1 -1
  74. package/dist/src/discover/filesystem.d.ts +1 -1
  75. package/dist/src/discover/filesystem.js +1 -1
  76. package/dist/src/discover/manifest.d.ts +1 -1
  77. package/dist/src/discover/manifest.js +1 -1
  78. package/dist/src/evals/cli/eval.js +2 -2
  79. package/dist/src/evals/index.d.ts +2 -2
  80. package/dist/src/evals/reporters/index.d.ts +1 -1
  81. package/dist/src/evals/runner/artifacts.js +1 -1
  82. package/dist/src/evals/runner/derive-run-facts.js +1 -1
  83. package/dist/src/evals/runner/execute-eval.d.ts +5 -0
  84. package/dist/src/evals/runner/execute-eval.js +1 -1
  85. package/dist/src/evals/runner/execute-task.d.ts +3 -0
  86. package/dist/src/evals/runner/execute-task.js +1 -1
  87. package/dist/src/evals/runner/reporters/braintrust.js +1 -1
  88. package/dist/src/evals/runner/reporters/types.d.ts +28 -2
  89. package/dist/src/evals/runner/run-evals.js +1 -1
  90. package/dist/src/evals/session.d.ts +11 -2
  91. package/dist/src/evals/session.js +1 -1
  92. package/dist/src/evals/target.js +1 -1
  93. package/dist/src/evals/types.d.ts +10 -1
  94. package/dist/src/execution/dispatch-runtime-actions-step.d.ts +1 -5
  95. package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
  96. package/dist/src/execution/dispatch-turn-step.d.ts +5 -0
  97. package/dist/src/execution/dispatch-turn-step.js +1 -0
  98. package/dist/src/execution/durable-session-migrations/turn-workflow.d.ts +1 -0
  99. package/dist/src/execution/node-step.js +1 -1
  100. package/dist/src/execution/parked-delivery-wait.d.ts +1 -1
  101. package/dist/src/execution/parked-delivery-wait.js +1 -1
  102. package/dist/src/execution/remote-agent-dispatch.d.ts +2 -1
  103. package/dist/src/execution/remote-agent-dispatch.js +1 -1
  104. package/dist/src/execution/route-child-delivery.d.ts +3 -4
  105. package/dist/src/execution/route-child-delivery.js +1 -1
  106. package/dist/src/execution/route-proxied-deliver-step.d.ts +34 -0
  107. package/dist/src/execution/route-proxied-deliver-step.js +1 -0
  108. package/dist/src/execution/runtime-context.js +1 -1
  109. package/dist/src/execution/session-command-inbox.d.ts +2 -2
  110. package/dist/src/execution/session-command-wire.js +1 -1
  111. package/dist/src/execution/session.js +1 -1
  112. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  113. package/dist/src/execution/subagent-adapter.js +1 -1
  114. package/dist/src/execution/subagent-event-proxy-step.js +1 -1
  115. package/dist/src/execution/tool-auth.d.ts +9 -0
  116. package/dist/src/execution/tool-auth.js +1 -1
  117. package/dist/src/execution/turn-control-receiver.js +1 -1
  118. package/dist/src/execution/turn-dispatch.js +1 -1
  119. package/dist/src/execution/turn-workflow.js +1 -1
  120. package/dist/src/execution/workflow-entry.js +1 -1
  121. package/dist/src/execution/workflow-runtime.js +1 -1
  122. package/dist/src/execution/workflow-steps.d.ts +1 -27
  123. package/dist/src/execution/workflow-steps.js +1 -1
  124. package/dist/src/execution/workflow-trace-context.d.ts +11 -0
  125. package/dist/src/execution/workflow-trace-context.js +1 -0
  126. package/dist/src/harness/ai-sdk-hook-bridge.d.ts +1 -1
  127. package/dist/src/harness/ai-sdk-hook-bridge.js +1 -1
  128. package/dist/src/harness/ai-sdk-telemetry.d.ts +19 -0
  129. package/dist/src/harness/ai-sdk-telemetry.js +1 -0
  130. package/dist/src/harness/approval-candidates.d.ts +109 -0
  131. package/dist/src/harness/approval-candidates.js +1 -0
  132. package/dist/src/harness/approval-delivery-coordinator.d.ts +39 -0
  133. package/dist/src/harness/approval-delivery-coordinator.js +1 -0
  134. package/dist/src/harness/authorization.d.ts +1 -0
  135. package/dist/src/harness/authorization.js +1 -1
  136. package/dist/src/harness/channel-delivery-instrumentation.d.ts +25 -0
  137. package/dist/src/harness/channel-delivery-instrumentation.js +1 -0
  138. package/dist/src/harness/emission.d.ts +2 -2
  139. package/dist/src/harness/emission.js +1 -1
  140. package/dist/src/harness/execute-tool.d.ts +1 -0
  141. package/dist/src/harness/hitl/approval-input-requests.js +1 -1
  142. package/dist/src/harness/hitl/pending-input-resolution.d.ts +3 -0
  143. package/dist/src/harness/hitl/pending-input-resolution.js +1 -1
  144. package/dist/src/harness/hitl/question-input-requests.js +1 -1
  145. package/dist/src/harness/hitl/session-limit-input-requests.js +1 -1
  146. package/dist/src/harness/input-extraction.js +1 -1
  147. package/dist/src/harness/input-request-resolution.d.ts +22 -0
  148. package/dist/src/harness/input-request-resolution.js +1 -0
  149. package/dist/src/harness/input-requests.d.ts +1 -0
  150. package/dist/src/harness/input-requests.js +1 -1
  151. package/dist/src/harness/{instrumentation-config.d.ts → instrumentation/config.d.ts} +9 -4
  152. package/dist/src/harness/instrumentation/config.js +1 -0
  153. package/dist/src/harness/instrumentation/content.d.ts +5 -0
  154. package/dist/src/harness/instrumentation/content.js +1 -0
  155. package/dist/src/harness/instrumentation/dispatch.d.ts +2 -0
  156. package/dist/src/harness/instrumentation/dispatch.js +1 -0
  157. package/dist/src/harness/instrumentation/lifecycle.d.ts +491 -0
  158. package/dist/src/harness/instrumentation/lifecycle.js +1 -0
  159. package/dist/src/harness/{instrumentation-native-events.d.ts → instrumentation/native-events.d.ts} +10 -1
  160. package/dist/src/harness/instrumentation/native-events.js +1 -0
  161. package/dist/src/harness/instrumentation/providers.d.ts +50 -0
  162. package/dist/src/harness/instrumentation/providers.js +1 -0
  163. package/dist/src/harness/{instrumentation-runtime.d.ts → instrumentation/runtime.d.ts} +7 -2
  164. package/dist/src/harness/{instrumentation-runtime.js → instrumentation/runtime.js} +1 -1
  165. package/dist/src/harness/instrumentation/setup-context.d.ts +12 -0
  166. package/dist/src/harness/instrumentation/setup-context.js +1 -0
  167. package/dist/src/harness/instrumentation/state.d.ts +59 -0
  168. package/dist/src/harness/instrumentation/state.js +1 -0
  169. package/dist/src/harness/messages.d.ts +2 -1
  170. package/dist/src/harness/messages.js +1 -1
  171. package/dist/src/harness/parent-lineage.d.ts +1 -1
  172. package/dist/src/harness/pending-input-batches.d.ts +2 -0
  173. package/dist/src/harness/pending-input-batches.js +1 -1
  174. package/dist/src/harness/prepare-trace-context.d.ts +16 -0
  175. package/dist/src/harness/prepare-trace-context.js +1 -0
  176. package/dist/src/harness/runtime-action-settlement-state.d.ts +3 -0
  177. package/dist/src/harness/runtime-action-settlement-state.js +1 -0
  178. package/dist/src/harness/runtime-actions.js +1 -1
  179. package/dist/src/harness/stale-input-responses.js +1 -1
  180. package/dist/src/harness/tool-call-action.d.ts +9 -0
  181. package/dist/src/harness/tool-call-action.js +1 -0
  182. package/dist/src/harness/tool-loop.js +2 -2
  183. package/dist/src/harness/tools.js +1 -1
  184. package/dist/src/harness/types.d.ts +16 -2
  185. package/dist/src/internal/application/compiled-artifacts.d.ts +13 -4
  186. package/dist/src/internal/application/compiled-artifacts.js +5 -4
  187. package/dist/src/internal/application/dev-environment.d.ts +12 -0
  188. package/dist/src/internal/application/dev-environment.js +1 -1
  189. package/dist/src/internal/application/package.js +1 -1
  190. package/dist/src/internal/authored-definition/approval.d.ts +3 -0
  191. package/dist/src/internal/authored-definition/approval.js +1 -0
  192. package/dist/src/internal/authored-definition/connection.js +1 -1
  193. package/dist/src/internal/authored-definition/core.d.ts +3 -3
  194. package/dist/src/internal/authored-definition/core.js +1 -1
  195. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  196. package/dist/src/internal/authored-package-boundary.js +1 -1
  197. package/dist/src/internal/helpers/markdown.js +1 -1
  198. package/dist/src/internal/instrumentation-layout.d.ts +28 -0
  199. package/dist/src/internal/instrumentation-layout.js +1 -0
  200. package/dist/src/internal/instrumentation.d.ts +1 -1
  201. package/dist/src/internal/materialized-authored-modules.d.ts +13 -2
  202. package/dist/src/internal/materialized-authored-modules.js +1 -1
  203. package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
  204. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  205. package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
  206. package/dist/src/internal/nitro/host/local-tracing-runtime-plugin.d.ts +5 -1
  207. package/dist/src/internal/nitro/host/local-tracing-runtime-plugin.js +1 -1
  208. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +1 -1
  209. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.d.ts +4 -3
  210. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
  211. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  212. package/dist/src/internal/nitro/routes/channel-request-instrumentation.d.ts +2 -3
  213. package/dist/src/internal/nitro/routes/channel-request-instrumentation.js +1 -1
  214. package/dist/src/internal/vercel/project-link.d.ts +1 -1
  215. package/dist/src/internal/vercel/project-link.js +1 -1
  216. package/dist/src/internal/vercel-agent-summary.d.ts +10 -9
  217. package/dist/src/internal/vercel-agent-summary.js +1 -1
  218. package/dist/src/internal/workflow/development-world-client.js +1 -1
  219. package/dist/src/packages/eve-catalog/src/index.js +1 -1
  220. package/dist/src/protocol/message.d.ts +51 -2
  221. package/dist/src/protocol/message.js +2 -2
  222. package/dist/src/protocol/traceparent.d.ts +10 -0
  223. package/dist/src/protocol/traceparent.js +1 -0
  224. package/dist/src/public/channels/eve.js +1 -1
  225. package/dist/src/public/channels/github/auth.d.ts +30 -0
  226. package/dist/src/public/channels/github/auth.js +2 -2
  227. package/dist/src/public/channels/github/defaults.d.ts +4 -3
  228. package/dist/src/public/channels/github/defaults.js +5 -2
  229. package/dist/src/public/channels/github/dispatch.d.ts +3 -2
  230. package/dist/src/public/channels/github/dispatch.js +1 -1
  231. package/dist/src/public/channels/github/githubChannel.d.ts +10 -5
  232. package/dist/src/public/channels/github/githubChannel.js +1 -1
  233. package/dist/src/public/channels/github/index.d.ts +1 -1
  234. package/dist/src/public/channels/slack/defaults.js +3 -3
  235. package/dist/src/public/channels/slack/interactions.js +1 -1
  236. package/dist/src/public/channels/slack/slackChannel.d.ts +11 -3
  237. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  238. package/dist/src/public/definitions/approval.d.ts +57 -16
  239. package/dist/src/public/definitions/approval.js +1 -1
  240. package/dist/src/public/definitions/channel.d.ts +2 -2
  241. package/dist/src/public/definitions/channel.js +1 -1
  242. package/dist/src/public/definitions/hook.d.ts +4 -2
  243. package/dist/src/public/definitions/instructions.d.ts +14 -4
  244. package/dist/src/public/definitions/instructions.js +1 -1
  245. package/dist/src/public/definitions/tool.d.ts +5 -8
  246. package/dist/src/public/instructions/index.d.ts +1 -2
  247. package/dist/src/public/instructions/index.js +1 -1
  248. package/dist/src/public/instrumentation/index.d.ts +36 -20
  249. package/dist/src/public/instrumentation/index.js +1 -1
  250. package/dist/src/public/instrumentation/otel.d.ts +32 -0
  251. package/dist/src/public/instrumentation/otel.js +1 -0
  252. package/dist/src/public/instrumentation/provider.d.ts +117 -0
  253. package/dist/src/public/instrumentation/provider.js +1 -0
  254. package/dist/src/public/tools/approval/approval-helpers.d.ts +4 -4
  255. package/dist/src/public/tools/index.d.ts +1 -1
  256. package/dist/src/runtime/actions/results.d.ts +3 -3
  257. package/dist/src/runtime/agent/bootstrap.d.ts +2 -0
  258. package/dist/src/runtime/agent/bootstrap.js +1 -1
  259. package/dist/src/runtime/attributes/emit.js +1 -1
  260. package/dist/src/runtime/connections/principal.d.ts +3 -0
  261. package/dist/src/runtime/connections/principal.js +1 -1
  262. package/dist/src/runtime/connections/scoped-authorization.d.ts +3 -5
  263. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  264. package/dist/src/runtime/connections/types.d.ts +5 -0
  265. package/dist/src/runtime/prompt/compose.d.ts +1 -1
  266. package/dist/src/runtime/prompt/compose.js +3 -1
  267. package/dist/src/runtime/resolve-agent.js +1 -1
  268. package/dist/src/runtime/resolve-tool.js +1 -1
  269. package/dist/src/runtime/types.d.ts +4 -3
  270. package/dist/src/setup/index.d.ts +1 -0
  271. package/dist/src/setup/index.js +1 -1
  272. package/dist/src/setup/project-resolution.d.ts +3 -3
  273. package/dist/src/setup/scaffold/create/project.js +1 -1
  274. package/dist/src/setup/scaffold/version-tokens.js +1 -1
  275. package/dist/src/setup/slack-connect-lifecycle.d.ts +0 -9
  276. package/dist/src/setup/slack-connect-lifecycle.js +1 -1
  277. package/dist/src/setup/slackbot.d.ts +2 -1
  278. package/dist/src/setup/slackbot.js +1 -1
  279. package/dist/src/setup/verified-remote-agent.d.ts +30 -0
  280. package/dist/src/setup/verified-remote-agent.js +1 -0
  281. package/dist/src/shared/agent-definition.d.ts +9 -0
  282. package/dist/src/shared/channel-definition.d.ts +3 -1
  283. package/dist/src/shared/dynamic-tool-definition.d.ts +3 -4
  284. package/dist/src/shared/instructions-definition.d.ts +15 -11
  285. package/dist/src/svelte/index.js +1 -1
  286. package/dist/src/svelte/use-eve-agent.js +1 -1
  287. package/dist/src/tracing/agent-action-instrumentation.d.ts +31 -0
  288. package/dist/src/tracing/agent-action-instrumentation.js +1 -0
  289. package/dist/src/tracing/agent-approval-instrumentation.d.ts +13 -0
  290. package/dist/src/tracing/agent-approval-instrumentation.js +1 -0
  291. package/dist/src/tracing/agent-channel-delivery-instrumentation.d.ts +13 -0
  292. package/dist/src/tracing/agent-channel-delivery-instrumentation.js +1 -0
  293. package/dist/src/tracing/agent-otel-content.d.ts +6 -0
  294. package/dist/src/tracing/agent-otel-content.js +2 -2
  295. package/dist/src/tracing/agent-otel-provider.d.ts +10 -8
  296. package/dist/src/tracing/agent-otel-provider.js +2 -2
  297. package/dist/src/tracing/agent-otel-session-context.d.ts +17 -0
  298. package/dist/src/tracing/agent-otel-session-context.js +1 -0
  299. package/dist/src/tracing/agent-otel-usage.d.ts +4 -0
  300. package/dist/src/tracing/agent-otel-usage.js +1 -0
  301. package/dist/src/tracing/agent-span-id-generator.d.ts +2 -0
  302. package/dist/src/tracing/agent-span-id-generator.js +1 -1
  303. package/dist/src/tracing/agent-tool-instrumentation.d.ts +28 -0
  304. package/dist/src/tracing/agent-tool-instrumentation.js +1 -0
  305. package/dist/src/tracing/agent-trace-context-store.d.ts +8 -1
  306. package/dist/src/tracing/agent-trace-context-store.js +1 -1
  307. package/dist/src/tracing/agent-trace-span-processor.d.ts +0 -1
  308. package/dist/src/tracing/agent-trace-span-processor.js +1 -1
  309. package/dist/src/tracing/agent-trace-state.d.ts +33 -3
  310. package/dist/src/tracing/agent-trace-state.js +1 -1
  311. package/dist/src/tracing/batch-span-processor.d.ts +20 -0
  312. package/dist/src/tracing/batch-span-processor.js +1 -0
  313. package/dist/src/tracing/content-attributes.d.ts +28 -0
  314. package/dist/src/tracing/content-attributes.js +1 -0
  315. package/dist/src/tracing/content-span-processor.d.ts +19 -0
  316. package/dist/src/tracing/content-span-processor.js +1 -0
  317. package/dist/src/tracing/install-instrumentation-runtime.d.ts +19 -0
  318. package/dist/src/tracing/install-instrumentation-runtime.js +1 -0
  319. package/dist/src/tracing/local-instrumentation-runtime.d.ts +1 -1
  320. package/dist/src/tracing/local-instrumentation-runtime.js +1 -1
  321. package/dist/src/tracing/local-traces.d.ts +56 -0
  322. package/dist/src/tracing/local-traces.js +1 -0
  323. package/dist/src/tracing/otel-declaration.d.ts +150 -0
  324. package/dist/src/tracing/otel-declaration.js +1 -0
  325. package/dist/src/tracing/otel-registration.d.ts +21 -0
  326. package/dist/src/tracing/otel-registration.js +1 -0
  327. package/dist/src/tracing/vercel-runtime-span-exporter.d.ts +5 -0
  328. package/dist/src/tracing/vercel-runtime-span-exporter.js +1 -0
  329. package/dist/src/vue/index.js +1 -1
  330. package/dist/src/vue/use-eve-agent.js +1 -1
  331. package/docs/README.md +18 -20
  332. package/docs/agent-config.md +5 -5
  333. package/docs/channels/eve.mdx +10 -56
  334. package/docs/channels/github.mdx +1 -1
  335. package/docs/channels/meta.json +1 -0
  336. package/docs/concepts/context-control.md +32 -56
  337. package/docs/concepts/default-harness.md +2 -2
  338. package/docs/concepts/execution-model-and-durability.mdx +4 -4
  339. package/docs/concepts/meta.json +3 -1
  340. package/docs/concepts/sessions-runs-and-streaming.md +22 -10
  341. package/docs/{guides → concepts}/state.md +3 -3
  342. package/docs/connections/mcp.mdx +6 -89
  343. package/docs/connections/meta.json +1 -0
  344. package/docs/connections/openapi.mdx +5 -69
  345. package/docs/connections/overview.mdx +29 -3
  346. package/docs/evals/meta.json +1 -0
  347. package/docs/evals/reporters.mdx +14 -4
  348. package/docs/extensions.md +1 -1
  349. package/docs/getting-started.mdx +175 -13
  350. package/docs/guides/auth-and-route-protection.md +3 -18
  351. package/docs/guides/client/meta.json +2 -1
  352. package/docs/guides/client/output-schema.mdx +2 -2
  353. package/docs/guides/client/overview.mdx +1 -1
  354. package/docs/guides/deployment/meta.json +1 -0
  355. package/docs/guides/deployment/overview.md +1 -1
  356. package/docs/guides/deployment/self-hosting.md +3 -3
  357. package/docs/guides/deployment/vercel.mdx +1 -1
  358. package/docs/guides/dev-tui.md +3 -13
  359. package/docs/guides/dynamic-capabilities.md +26 -4
  360. package/docs/guides/frontend/meta.json +2 -1
  361. package/docs/guides/frontend/nextjs.mdx +1 -10
  362. package/docs/guides/frontend/nuxt.mdx +1 -10
  363. package/docs/guides/frontend/overview.mdx +12 -3
  364. package/docs/guides/frontend/sveltekit.mdx +1 -10
  365. package/docs/guides/frontend/use-eve-agent-svelte.mdx +39 -126
  366. package/docs/guides/frontend/use-eve-agent-vue.mdx +40 -139
  367. package/docs/guides/instrumentation.md +37 -15
  368. package/docs/guides/meta.json +1 -5
  369. package/docs/guides/remote-agents.md +9 -9
  370. package/docs/guides/session-context.md +34 -103
  371. package/docs/install-integrations.mdx +1 -1
  372. package/docs/instructions.mdx +45 -12
  373. package/docs/meta.json +24 -13
  374. package/docs/patterns/dynamic-scheduling.md +1 -1
  375. package/docs/patterns/meta.json +1 -0
  376. package/docs/patterns/multi-tenant-approvals.md +1 -1
  377. package/docs/patterns/multi-tenant-auth.md +1 -1
  378. package/docs/patterns/multi-tenant-memory.md +4 -3
  379. package/docs/{guides → protocols}/acp.md +1 -1
  380. package/docs/protocols/meta.json +5 -0
  381. package/docs/reference/cli.md +34 -34
  382. package/docs/reference/meta.json +1 -1
  383. package/docs/reference/typescript-api.md +4 -2
  384. package/docs/{subagents.mdx → subagents/index.mdx} +2 -2
  385. package/docs/subagents/meta.json +5 -0
  386. package/docs/{guides/dynamic-workflows.md → subagents/workflow-tool.md} +6 -6
  387. package/docs/tools/human-in-the-loop.md +1 -1
  388. package/docs/tools/meta.json +1 -0
  389. package/docs/tools/overview.mdx +1 -1
  390. package/docs/tutorial/connect-a-warehouse.mdx +1 -1
  391. package/docs/tutorial/meta.json +1 -0
  392. package/docs/tutorial/remember-definitions.mdx +2 -2
  393. package/docs/tutorial/ship-it.mdx +2 -2
  394. package/package.json +10 -4
  395. package/dist/src/compiled/_chunks/workflow/dist-C8PhDW9B.js +0 -1
  396. package/dist/src/compiled/_chunks/workflow/functions-xMPAeWFr.js +0 -1
  397. package/dist/src/compiled/_chunks/workflow/node-Smb57EnG.js +0 -40
  398. package/dist/src/compiled/_chunks/workflow/resume-hook-BrduAuFX.js +0 -1
  399. package/dist/src/compiled/_chunks/workflow/run-CX7_sJnW.js +0 -1
  400. package/dist/src/compiled/_chunks/workflow/sleep-tsb2HjWK.js +0 -1
  401. package/dist/src/compiled/_chunks/workflow/undici-BNc_0O4m.js +0 -95
  402. package/dist/src/compiled/_chunks/workflow/wait-until-BYKVqrwc.js +0 -15
  403. package/dist/src/harness/instrumentation-config.js +0 -1
  404. package/dist/src/harness/instrumentation-lifecycle.d.ts +0 -171
  405. package/dist/src/harness/instrumentation-lifecycle.js +0 -1
  406. package/dist/src/harness/instrumentation-native-events.js +0 -1
  407. package/dist/src/harness/otel-integration.d.ts +0 -12
  408. package/dist/src/harness/otel-integration.js +0 -1
  409. package/docs/installation.mdx +0 -66
  410. package/docs/project-structure.mdx +0 -53
  411. package/docs/reference/project-layout.md +0 -123
  412. /package/dist/src/harness/{instrumentation-runtime-context.d.ts → instrumentation/runtime-context.d.ts} +0 -0
  413. /package/dist/src/harness/{instrumentation-runtime-context.js → instrumentation/runtime-context.js} +0 -0
  414. /package/docs/{guides → protocols}/ucp.mdx +0 -0
@@ -0,0 +1,28 @@
1
+ import { type Context, type SpanContext, type Tracer } from "#compiled/@opentelemetry/api/index.js";
2
+ import type { InstrumentationActionStartedEvent, InstrumentationToolCallStartedEvent, InstrumentationToolCallTerminalEvent } from "#harness/instrumentation/lifecycle.js";
3
+ import type { AgentSpanIdGenerator } from "#tracing/agent-span-id-generator.js";
4
+ import type { AgentActionContext } from "#tracing/agent-action-instrumentation.js";
5
+ export interface AgentToolInstrumentation {
6
+ actionStarted(event: InstrumentationActionStartedEvent): Promise<void>;
7
+ contextFor(attemptId: string, idempotencyKey: string): Context | undefined;
8
+ drain(attemptId: string, failure?: {
9
+ readonly error: unknown;
10
+ }): void;
11
+ readonly events: {
12
+ readonly "tool.call.completed": (event: InstrumentationToolCallTerminalEvent) => Promise<void>;
13
+ readonly "tool.call.failed": (event: InstrumentationToolCallTerminalEvent) => Promise<void>;
14
+ readonly "tool.call.started": (event: InstrumentationToolCallStartedEvent) => Promise<void>;
15
+ };
16
+ }
17
+ /** Keeps SDK tool spans parented to actions even when SDK telemetry wins the event race. */
18
+ export declare function createAgentToolInstrumentation(input: {
19
+ readonly actionContextFor: (sessionId: string, turnId: string, callId: string) => Promise<AgentActionContext | undefined>;
20
+ readonly idGenerator: AgentSpanIdGenerator;
21
+ readonly recordInputs: boolean;
22
+ readonly recordOutputs: boolean;
23
+ readonly resolveFallback: (event: InstrumentationToolCallStartedEvent) => {
24
+ readonly context: Context;
25
+ readonly spanContext: SpanContext;
26
+ } | undefined;
27
+ readonly tracer: Tracer;
28
+ }): AgentToolInstrumentation;
@@ -0,0 +1 @@
1
+ import{ROOT_CONTEXT,SpanStatusCode,trace}from"#compiled/@opentelemetry/api/index.js";import{actionIdempotencyKey}from"#harness/instrumentation/lifecycle.js";import{contentAttribute}from"#tracing/agent-otel-content.js";function createAgentToolInstrumentation(e){let t=new Map,n=new Map,onStarted=async t=>{let n=actionIdempotencyKey(t.scope.sessionId,t.scope.turnId,t.callId),i=e.resolveFallback(t),a=i===void 0?void 0:reserve(t,n,i),o=await e.actionContextFor(t.scope.sessionId,t.scope.turnId,t.callId);if(a===void 0){if(o===void 0)return;a=reserve(t,n,o)}o!==void 0&&startSpan(a,o.context)},onTerminal=async t=>{let r=n.get(t.scope.attemptId)?.get(t.idempotencyKey);if(r!==void 0){if(r.terminal=t,r.span===void 0){let t=await e.actionContextFor(r.event.scope.sessionId,r.event.scope.turnId,r.event.callId);t!==void 0&&startSpan(r,t.context)}finishIfReady(r)}};return{async actionStarted(n){let r=t.get(n.idempotencyKey);if(r===void 0||r.span!==void 0||r.finished===!0)return;let i=await e.actionContextFor(n.scope.sessionId,n.scope.turnId,n.callId);i!==void 0&&(startSpan(r,i.context),finishIfReady(r))},contextFor:(e,t)=>n.get(e)?.get(t)?.context,drain(e,t){let r=n.get(e);if(r!==void 0){for(let e of r.values())e.finished!==!0&&(e.span===void 0&&startSpan(e,e.fallbackParent),finish(e,t));n.delete(e)}},events:{"tool.call.completed":onTerminal,"tool.call.failed":onTerminal,"tool.call.started":onStarted}};function getAttemptStates(e){let t=n.get(e);return t===void 0&&(t=new Map,n.set(e,t)),t}function reserve(n,r,i){let a=e.idGenerator.deriveSpanId(`tool:${n.idempotencyKey}`),o={actionKey:r,attemptId:n.scope.attemptId,context:contextFromSpanContext({isRemote:!1,spanId:a,traceFlags:i.spanContext.traceFlags,traceId:i.spanContext.traceId}),event:n,fallbackParent:i.context,idempotencyKey:n.idempotencyKey,spanId:a,startTimeMs:Date.now()};return getAttemptStates(n.scope.attemptId).set(n.idempotencyKey,o),t.set(r,o),o}function startSpan(t,n){if(!(t.span!==void 0||t.finished===!0)&&(t.span=e.idGenerator.withSpanId(t.spanId,()=>e.tracer.startSpan(`ai.toolCall`,{attributes:toolAttributes(t.event),startTime:t.startTimeMs},n)),e.recordInputs)){let e=contentAttribute(t.event.input,!1);e!==void 0&&t.span.setAttribute(`gen_ai.tool.call.arguments`,e)}}function finishIfReady(e){e.span===void 0||e.terminal===void 0||finish(e)}function finish(r,a){let o=r.span;if(o===void 0||r.finished===!0)return;r.finished=!0;let s=r.terminal;if(a!==void 0)recordError(o,a.error);else if(s?.type===`tool.call.failed`)recordError(o,s.error);else if(s?.output.type===`error`)recordError(o,s.output.error);else if(s!==void 0&&e.recordOutputs){let e=contentAttribute(s.output.output,!1);e!==void 0&&o.setAttribute(`gen_ai.tool.call.result`,e)}o.end(),t.delete(r.actionKey);let c=n.get(r.attemptId);c?.delete(r.idempotencyKey),c?.size===0&&n.delete(r.attemptId)}}function toolAttributes(e){return{"gen_ai.operation.name":`execute_tool`,"gen_ai.tool.call.id":e.callId,"gen_ai.tool.name":e.toolName}}function contextFromSpanContext(t){return trace.setSpan(ROOT_CONTEXT,trace.wrapSpanContext(t))}function recordError(e,n){n instanceof Error?(e.recordException(n),e.setStatus({code:SpanStatusCode.ERROR,message:n.message})):e.setStatus({code:SpanStatusCode.ERROR})}export{createAgentToolInstrumentation};
@@ -1,5 +1,5 @@
1
1
  import type { SpanContext } from "#compiled/@opentelemetry/api/index.js";
2
- import type { AgentSessionTraceState, AgentTraceStateStore, AgentTurnTraceState } from "#tracing/agent-trace-state.js";
2
+ import type { AgentActionTraceState, AgentSessionTraceState, AgentTraceStateStore, AgentTurnTraceState } from "#tracing/agent-trace-state.js";
3
3
  /** Keeps only framework trace state from an interrupted step's context changes. */
4
4
  export declare function preserveSerializedAgentTraceState(original: Record<string, unknown>, interrupted: Record<string, unknown>): Record<string, unknown>;
5
5
  /**
@@ -8,12 +8,19 @@ export declare function preserveSerializedAgentTraceState(original: Record<strin
8
8
  * to the ambient session.
9
9
  */
10
10
  export declare function readSessionTraceContext(serializedContext: Readonly<Record<string, unknown>>, sessionId: string): SpanContext | undefined;
11
+ /** Reads the durable action span that should parent a dispatched child agent. */
12
+ export declare function readActionTraceContext(serializedContext: Readonly<Record<string, unknown>>, sessionId: string, turnId: string, callId: string): SpanContext | undefined;
11
13
  /** Durable trace state backed by eve's serialized Workflow context. */
12
14
  export declare class ContextAgentTraceStateStore implements AgentTraceStateStore {
15
+ deleteAction(idempotencyKey: string): void;
16
+ deleteActions(sessionId: string, turnId?: string): void;
13
17
  deleteSession(sessionId: string): void;
14
18
  deleteTurn(sessionId: string, turnId: string): void;
19
+ findAction(sessionId: string, callId: string): AgentActionTraceState | undefined;
20
+ getAction(idempotencyKey: string): AgentActionTraceState | undefined;
15
21
  getSession(sessionId: string): AgentSessionTraceState | undefined;
16
22
  getTurn(sessionId: string, turnId: string): AgentTurnTraceState | undefined;
23
+ setAction(idempotencyKey: string, value: AgentActionTraceState): void;
17
24
  setSession(sessionId: string, value: AgentSessionTraceState): void;
18
25
  setTurn(sessionId: string, turnId: string, value: AgentTurnTraceState): void;
19
26
  }
@@ -1 +1 @@
1
- import{contextStorage,loadContext}from"#context/container.js";import{ContextKey}from"#context/key.js";const AgentTraceContextKey=new ContextKey(`eve.harness.agentTrace`,{codec:{deserialize:deserializeState,serialize:serializeState}});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 deserializeState(n).sessions[t]?.context}var ContextAgentTraceStateStore=class{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}})}getSession(t){return contextStorage.getStore()?.get(AgentTraceContextKey)?.sessions[t]}getTurn(t,n){return contextStorage.getStore()?.get(AgentTraceContextKey)?.turns[turnKey(t,n)]}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}}))}};function updateState(e){loadContext().set(AgentTraceContextKey,t=>e(t??{sessions:{},turns:{}}))}function turnKey(e,t){return`${e}\0${t}`}function serializeState(e){return{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:{error:serializeError(t.terminal.error),type:t.terminal.type}}]))}}function deserializeState(e){return isRecord(e)?{sessions:deserializeRecord(e.sessions,e=>{if(!(!isRecord(e)||!isSpanContext(e.context)))return{agentName:typeof e.agentName==`string`?e.agentName:void 0,channelKind:typeof e.channelKind==`string`?e.channelKind:void 0,context:e.context,rootSessionId:typeof e.rootSessionId==`string`?e.rootSessionId:``,turnsInWindow:typeof e.turnsInWindow==`number`?e.turnsInWindow:0,window:typeof e.window==`number`?e.window:0}}),turns:deserializeRecord(e.turns,e=>{if(!(!isRecord(e)||!isSpanContext(e.context))&&!(typeof e.parentSpanId!=`string`||typeof e.startTimeMs!=`number`))return{context:e.context,lineage:deserializeLineage(e.lineage),parentSpanId:e.parentSpanId,rootSessionId:typeof e.rootSessionId==`string`?e.rootSessionId:``,sequence:typeof e.sequence==`number`?e.sequence:0,startTimeMs:e.startTimeMs,terminal:deserializeTerminal(e.terminal)}})}:{sessions:{},turns:{}}}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 deserializeLineage(e){if(!(!isRecord(e)||typeof e.callId!=`string`||typeof e.sessionId!=`string`||typeof e.turnId!=`string`))return{callId:e.callId,sessionId:e.sessionId,subagentName:typeof e.subagentName==`string`?e.subagentName:void 0,turnId:e.turnId}}function deserializeTerminal(e){if(!isRecord(e)||typeof e.type!=`string`)return;let t=e.type;if(isTurnTerminalType(t))return{error:deserializeError(e.error),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,readSessionTraceContext};
1
+ import{contextStorage,loadContext}from"#context/container.js";import{ContextKey}from"#context/key.js";const AgentTraceContextKey=new ContextKey(`eve.harness.agentTrace`,{codec:{deserialize:deserializeState,serialize:serializeState}});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 deserializeState(n).sessions[t]?.context}function readActionTraceContext(e,t,n,i){let a=e[AgentTraceContextKey.name];if(a===void 0)return;let o=Object.values(deserializeState(a).actions).find(e=>e.sessionId===t&&e.turnId===n&&e.callId===i);if(o!==void 0)return{isRemote:!1,spanId:o.spanId,traceFlags:o.parent.traceFlags,traceId:o.parent.traceId}}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(t,n){return Object.values(contextStorage.getStore()?.get(AgentTraceContextKey)?.actions??{}).find(e=>e.sessionId===t&&e.callId===n)}getAction(t){return contextStorage.getStore()?.get(AgentTraceContextKey)?.actions[t]}getSession(t){return contextStorage.getStore()?.get(AgentTraceContextKey)?.sessions[t]}getTurn(t,n){return contextStorage.getStore()?.get(AgentTraceContextKey)?.turns[turnKey(t,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}}))}};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(e){return isRecord(e)?{actions:deserializeRecord(e.actions,deserializeAction),sessions:deserializeRecord(e.sessions,e=>{if(!(!isRecord(e)||!isSpanContext(e.context)))return{agentName:typeof e.agentName==`string`?e.agentName:void 0,channelKind:typeof e.channelKind==`string`?e.channelKind:void 0,context:e.context,rootSessionId:typeof e.rootSessionId==`string`?e.rootSessionId:``,turnsInWindow:typeof e.turnsInWindow==`number`?e.turnsInWindow:0,window:typeof e.window==`number`?e.window:0}}),turns:deserializeRecord(e.turns,e=>{if(!(!isRecord(e)||!isSpanContext(e.context))&&!(typeof e.parentSpanId!=`string`||typeof e.startTimeMs!=`number`))return{context:e.context,lineage:deserializeLineage(e.lineage),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,terminal:deserializeTerminal(e.terminal)}})}:{actions:{},sessions:{},turns:{}}}function deserializeAction(e){if(!(!isRecord(e)||typeof e.attemptIndex!=`number`||typeof e.callId!=`string`||!isActionKind(e.kind)||typeof e.name!=`string`||!isSpanContext(e.parent)||typeof e.rootSessionId!=`string`||typeof e.sessionId!=`string`||typeof e.spanId!=`string`||typeof e.startTimeMs!=`number`||typeof e.stepIndex!=`number`||typeof e.turnId!=`string`))return{attemptIndex:e.attemptIndex,callId:e.callId,inputAttribute:typeof e.inputAttribute==`string`?e.inputAttribute:void 0,kind:e.kind,name:e.name,parent:e.parent,rootSessionId:e.rootSessionId,sessionId:e.sessionId,spanId:e.spanId,startTimeMs:e.startTimeMs,stepIndex:e.stepIndex,turnId:e.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 deserializeLineage(e){if(!(!isRecord(e)||typeof e.callId!=`string`||typeof e.sessionId!=`string`||typeof e.turnId!=`string`))return{callId:e.callId,sessionId:e.sessionId,subagentName:typeof e.subagentName==`string`?e.subagentName:void 0,turnId:e.turnId}}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,readSessionTraceContext};
@@ -4,7 +4,6 @@ export declare class AgentTraceSpanProcessor implements SpanProcessor {
4
4
  #private;
5
5
  constructor(children: readonly SpanProcessor[]);
6
6
  forceFlush(): Promise<void>;
7
- isAttached(): boolean;
8
7
  onStart(span: unknown, parentContext: unknown): void;
9
8
  onEnd(span: unknown): void;
10
9
  /** Trace ids whose session is still open, so retention never evicts them. */
@@ -1 +1 @@
1
- var AgentTraceSpanProcessor=class{#e;#t=new Set;#n=new Map;#r=!1;constructor(e){this.#e=e}async forceFlush(){await Promise.all(this.#e.map(e=>e.forceFlush()))}isAttached(){return this.#r}onStart(e,t){if(this.#r=!0,!isSpanLike(e))return;let n=e.attributes[`agent.session.id`];if(typeof n==`string`){let t=e.attributes[`agent.root.session.id`],r=typeof t==`string`?t:n,i=e.spanContext().traceId;this.#t.add(i);let a=this.#n.get(r)??new Set;a.add(i),this.#n.set(r,a)}if(this.#i(e))for(let n of this.#e)n.onStart(e,t)}onEnd(e){if(!(!isSpanLike(e)||!this.#i(e)))for(let t of this.#e)t.onEnd(e)}activeTraceIds(){return this.#t}releaseSession(e){let t=this.#n.get(e);if(t===void 0)return!1;for(let e of t)this.#t.delete(e);return this.#n.delete(e),!0}async shutdown(){await Promise.all(this.#e.map(e=>e.shutdown()))}#i(e){return e.instrumentationScope?.name!==`workflow`&&this.#t.has(e.spanContext().traceId)}};function isSpanLike(e){return typeof e==`object`&&!!e&&`attributes`in e&&`spanContext`in e&&typeof e.spanContext==`function`}export{AgentTraceSpanProcessor};
1
+ var AgentTraceSpanProcessor=class{#e;#t=new Set;#n=new Map;constructor(e){this.#e=e}async forceFlush(){await Promise.all(this.#e.map(e=>e.forceFlush()))}onStart(e,t){if(!isSpanLike(e))return;let n=e.attributes[`agent.session.id`];if(typeof n==`string`){let t=e.attributes[`agent.root.session.id`],r=typeof t==`string`?t:n,i=e.spanContext().traceId;this.#t.add(i);let a=this.#n.get(r)??new Set;a.add(i),this.#n.set(r,a)}if(this.#r(e))for(let n of this.#e)n.onStart(e,t)}onEnd(e){if(!(!isSpanLike(e)||!this.#r(e)))for(let t of this.#e)t.onEnd(e)}activeTraceIds(){return this.#t}releaseSession(e){let t=this.#n.get(e);if(t===void 0)return!1;for(let e of t)this.#t.delete(e);return this.#n.delete(e),!0}async shutdown(){await Promise.all(this.#e.map(e=>e.shutdown()))}#r(e){return e.instrumentationScope?.name!==`workflow`&&this.#t.has(e.spanContext().traceId)}};function isSpanLike(e){return typeof e==`object`&&!!e&&`attributes`in e&&`spanContext`in e&&typeof e.spanContext==`function`}export{AgentTraceSpanProcessor};
@@ -1,5 +1,7 @@
1
1
  import type { SpanContext } from "#compiled/@opentelemetry/api/index.js";
2
- import type { InstrumentationParentLineage, InstrumentationTurnTerminalEvent } from "#harness/instrumentation-lifecycle.js";
2
+ import type { InstrumentationActionKind, InstrumentationParentLineage, InstrumentationTraceContext, InstrumentationTurnFailedEvent, InstrumentationTurnSettledEvent } from "#harness/instrumentation/lifecycle.js";
3
+ /** Sized so an ordinary session stays one trace and only an outsized one rolls. */
4
+ export declare const SESSION_WINDOW_TURN_LIMIT = 200;
3
5
  export interface AgentSessionTraceState {
4
6
  readonly agentName?: string;
5
7
  readonly channelKind?: string;
@@ -11,31 +13,59 @@ export interface AgentSessionTraceState {
11
13
  export interface AgentTurnTraceState {
12
14
  readonly context: SpanContext;
13
15
  readonly lineage?: InstrumentationParentLineage;
16
+ readonly parentIsRemote?: boolean;
14
17
  readonly parentSpanId: string;
15
18
  readonly rootSessionId: string;
16
19
  readonly sequence: number;
17
20
  readonly startTimeMs: number;
18
21
  readonly terminal?: {
19
- readonly error?: unknown;
20
- readonly type: InstrumentationTurnTerminalEvent["type"];
22
+ readonly error: unknown;
23
+ readonly type: InstrumentationTurnFailedEvent["type"];
24
+ } | {
25
+ readonly type: InstrumentationTurnSettledEvent["type"];
21
26
  };
22
27
  }
28
+ export interface AgentActionTraceState {
29
+ readonly attemptIndex: number;
30
+ readonly callId: string;
31
+ readonly inputAttribute?: string;
32
+ readonly kind: InstrumentationActionKind;
33
+ readonly name: string;
34
+ readonly parent: InstrumentationTraceContext;
35
+ readonly rootSessionId: string;
36
+ readonly sessionId: string;
37
+ readonly spanId: string;
38
+ readonly startTimeMs: number;
39
+ readonly stepIndex: number;
40
+ readonly turnId: string;
41
+ }
23
42
  /** Provider-owned serializable storage for durable agent trace state. */
24
43
  export interface AgentTraceStateStore {
44
+ deleteAction(idempotencyKey: string): void | PromiseLike<void>;
45
+ deleteActions(sessionId: string, turnId?: string): void | PromiseLike<void>;
25
46
  deleteSession(sessionId: string): void | PromiseLike<void>;
26
47
  deleteTurn(sessionId: string, turnId: string): void | PromiseLike<void>;
48
+ findAction(sessionId: string, callId: string): AgentActionTraceState | undefined | PromiseLike<AgentActionTraceState | undefined>;
49
+ getAction(idempotencyKey: string): AgentActionTraceState | undefined | PromiseLike<AgentActionTraceState | undefined>;
27
50
  getSession(sessionId: string): AgentSessionTraceState | undefined | PromiseLike<AgentSessionTraceState | undefined>;
28
51
  getTurn(sessionId: string, turnId: string): AgentTurnTraceState | undefined | PromiseLike<AgentTurnTraceState | undefined>;
52
+ setAction(idempotencyKey: string, state: AgentActionTraceState): void | PromiseLike<void>;
29
53
  setSession(sessionId: string, state: AgentSessionTraceState): void | PromiseLike<void>;
30
54
  setTurn(sessionId: string, turnId: string, state: AgentTurnTraceState): void | PromiseLike<void>;
31
55
  }
32
56
  /** In-memory trace state used by tests and non-durable runtimes. */
33
57
  export declare class InMemoryAgentTraceStateStore implements AgentTraceStateStore {
34
58
  #private;
59
+ deleteAction(idempotencyKey: string): void;
60
+ deleteActions(sessionId: string, turnId?: string): void;
35
61
  deleteSession(sessionId: string): void;
36
62
  deleteTurn(sessionId: string, turnId: string): void;
63
+ findAction(sessionId: string, callId: string): AgentActionTraceState | undefined;
64
+ getAction(idempotencyKey: string): AgentActionTraceState | undefined;
37
65
  getSession(sessionId: string): AgentSessionTraceState | undefined;
38
66
  getTurn(sessionId: string, turnId: string): AgentTurnTraceState | undefined;
67
+ setAction(idempotencyKey: string, state: AgentActionTraceState): void;
39
68
  setSession(sessionId: string, state: AgentSessionTraceState): void;
40
69
  setTurn(sessionId: string, turnId: string, state: AgentTurnTraceState): void;
41
70
  }
71
+ export declare function turnKey(sessionId: string, turnId: string): string;
@@ -1 +1 @@
1
- var InMemoryAgentTraceStateStore=class{#e=new Map;#t=new Map;deleteSession(e){this.#e.delete(e)}deleteTurn(e,t){this.#t.delete(turnKey(e,t))}getSession(e){return this.#e.get(e)}getTurn(e,t){return this.#t.get(turnKey(e,t))}setSession(e,t){this.#e.set(e,t)}setTurn(e,t,n){this.#t.set(turnKey(e,t),n)}};function turnKey(e,t){return`${e}:${t}`}export{InMemoryAgentTraceStateStore};
1
+ const SESSION_WINDOW_TURN_LIMIT=200;var InMemoryAgentTraceStateStore=class{#e=new Map;#t=new Map;#n=new Map;deleteAction(e){this.#e.delete(e)}deleteActions(e,t){for(let[n,r]of this.#e)r.sessionId===e&&(t===void 0||r.turnId===t)&&this.#e.delete(n)}deleteSession(e){this.#t.delete(e)}deleteTurn(e,t){this.#n.delete(turnKey(e,t))}findAction(e,t){return[...this.#e.values()].find(n=>n.sessionId===e&&n.callId===t)}getAction(e){return this.#e.get(e)}getSession(e){return this.#t.get(e)}getTurn(e,t){return this.#n.get(turnKey(e,t))}setAction(e,t){this.#e.set(e,t)}setSession(e,t){this.#t.set(e,t)}setTurn(e,t,n){this.#n.set(turnKey(e,t),n)}};function turnKey(e,t){return`${e}:${t}`}export{InMemoryAgentTraceStateStore,SESSION_WINDOW_TURN_LIMIT,turnKey};
@@ -0,0 +1,20 @@
1
+ import type { SpanExporter, SpanProcessor } from "#compiled/@vercel/otel/index.js";
2
+ /** @internal — exposed for tests; authors get the defaults. */
3
+ export interface BatchSpanProcessorOptions {
4
+ readonly exportTimeoutMillis?: number;
5
+ readonly maxExportBatchSize?: number;
6
+ readonly maxQueueSize?: number;
7
+ readonly scheduledDelayMillis?: number;
8
+ }
9
+ /**
10
+ * Buffers ended spans and hands them to one exporter in batches.
11
+ *
12
+ * eve owns this rather than taking `@opentelemetry/sdk-trace-base` as a runtime
13
+ * dependency: an exporter needs exactly one thing done for it, and the
14
+ * dependency would arrive with the whole SDK behind it.
15
+ *
16
+ * A full queue drops the newest span rather than growing without bound. An
17
+ * exporter that has stopped draining is already losing telemetry; taking the
18
+ * agent's memory with it would turn that into an outage.
19
+ */
20
+ export declare function batchSpanProcessor(exporter: SpanExporter, options?: BatchSpanProcessorOptions): SpanProcessor;
@@ -0,0 +1 @@
1
+ import{createLogger,formatError}from"#internal/logging.js";import{TraceFlags,context,createContextKey}from"#compiled/@opentelemetry/api/index.js";const log=createLogger(`harness.batch-span-processor`),SUPPRESS_TRACING_KEY=createContextKey(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`),DEFAULTS={exportTimeoutMillis:3e4,maxExportBatchSize:512,maxQueueSize:2048,scheduledDelayMillis:5e3};function batchSpanProcessor(e,n={}){let i=n.exportTimeoutMillis??DEFAULTS.exportTimeoutMillis,o=n.maxExportBatchSize??DEFAULTS.maxExportBatchSize,s=n.maxQueueSize??DEFAULTS.maxQueueSize,c=n.scheduledDelayMillis??DEFAULTS.scheduledDelayMillis,l=[],u,d=Promise.resolve(),f=!1;function cancelTimer(){u!==void 0&&(clearTimeout(u),u=void 0)}function scheduleDrain(){u===void 0&&(u=setTimeout(()=>{u=void 0,drain()},c),u.unref?.())}function drain(){return waitForExporter(pendingDrain(),`span export`).then(()=>void 0)}async function exportBatch(n){try{await new Promise((t,i)=>{try{context.with(context.active().setValue(SUPPRESS_TRACING_KEY,!0),()=>{e.export(n,e=>{if(e.code===0){t();return}i(e.error??Error(`Span export failed.`))})})}catch(e){i(e instanceof Error?e:Error(String(e)))}})}catch(e){log.warn(`span export failed`,{error:formatError(e)})}}return{async forceFlush(){f||!await waitForExporter(pendingDrain(),`span export`)||e.forceFlush===void 0||await waitForExporter(settleExporter(`exporter flush`,e.forceFlush),`exporter flush`)},onEnd(e){if(!f&&isSampled(e)&&!(l.length>=s)){if(l.push(e),l.length>=o){drain();return}scheduleDrain()}},onStart(){},async shutdown(){f=!0;let t=pendingDrain();if(!await waitForExporter(t,`span export`)){t.then(()=>settleExporter(`exporter shutdown`,e.shutdown));return}await waitForExporter(settleExporter(`exporter shutdown`,e.shutdown),`exporter shutdown`)}};function pendingDrain(){return cancelTimer(),d=d.then(async()=>{for(;l.length>0;)await exportBatch(l.splice(0,o))}),d}async function waitForExporter(e,t){let n,r=new Promise(e=>{n=setTimeout(()=>{log.warn(`${t} timed out; preserving exporter serialization`,{timeoutMillis:i}),e(!1)},i),n.unref?.()}),a=e.then(()=>!0);try{return await Promise.race([a,r])}finally{clearTimeout(n)}}async function settleExporter(n,r){try{await r.call(e)}catch(e){log.warn(`${n} failed`,{error:formatError(e)})}}}function isSampled(e){if(typeof e!=`object`||!e||!(`spanContext`in e))return!1;let t=e.spanContext;if(typeof t!=`function`)return!1;let r=Reflect.apply(t,e,[]);return typeof r.traceFlags==`number`&&(r.traceFlags&TraceFlags.SAMPLED)===TraceFlags.SAMPLED}export{batchSpanProcessor};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Which span attributes carry conversation content, and in which direction.
3
+ *
4
+ * Two vocabularies land on the same spans: the ones eve sets on its own
5
+ * `agent.*` spans, and the ones the AI SDK's OpenTelemetry integration sets on
6
+ * the model-call spans beneath them. A destination that declined content has to
7
+ * be rid of both, so both are listed here rather than in the module that writes
8
+ * each.
9
+ *
10
+ * Listed by name rather than by prefix because the prefixes are shared with
11
+ * metadata that must survive: `ai.response.finish_reason` and
12
+ * `gen_ai.tool.name` say what happened, not what was said. The cost is that a
13
+ * new content attribute in a dependency is not covered until it is added here.
14
+ */
15
+ /** What one destination is willing to receive. */
16
+ export interface ResolvedContentOptions {
17
+ readonly recordInputs: boolean;
18
+ readonly recordOutputs: boolean;
19
+ }
20
+ /**
21
+ * The attributes with the declined content removed, or `undefined` when there
22
+ * was none to remove.
23
+ *
24
+ * The `undefined` return is what lets the caller forward the original span
25
+ * untouched in the common case, so a destination that declined a direction the
26
+ * span never carried costs one pass over its keys and no allocation.
27
+ */
28
+ export declare function withoutDeclinedContent(attributes: Readonly<Record<string, unknown>>, content: ResolvedContentOptions): Record<string, unknown> | undefined;
@@ -0,0 +1 @@
1
+ const INPUT_CONTENT_ATTRIBUTES=new Set([`agent.channel.delivery.input`,`ai.documents`,`ai.prompt`,`ai.prompt.messages`,`ai.prompt.system`,`ai.prompt.toolChoice`,`ai.prompt.tools`,`ai.value`,`ai.values`,`gen_ai.input.messages`,`gen_ai.system_instructions`,`gen_ai.tool.call.arguments`,`gen_ai.tool.definitions`]),OUTPUT_CONTENT_ATTRIBUTES=new Set([`ai.embedding`,`ai.embeddings`,`ai.ranking`,`ai.response.files`,`ai.response.object`,`ai.response.reasoning`,`ai.response.text`,`ai.response.toolCalls`,`ai.response.tool_calls`,`ai.response.tool_results`,`ai.toolCall.args`,`ai.toolCall.result`,`gen_ai.output.messages`,`gen_ai.tool.call.result`]);function isDeclined(n,r){return!r.recordInputs&&INPUT_CONTENT_ATTRIBUTES.has(n)?!0:!r.recordOutputs&&OUTPUT_CONTENT_ATTRIBUTES.has(n)}function withoutDeclinedContent(e,t){let n=Object.keys(e);if(!n.some(e=>isDeclined(e,t)))return;let r={};for(let i of n)isDeclined(i,t)||(r[i]=e[i]);return r}export{withoutDeclinedContent};
@@ -0,0 +1,19 @@
1
+ import type { SpanProcessor } from "#compiled/@vercel/otel/index.js";
2
+ import { type ResolvedContentOptions } from "#tracing/content-attributes.js";
3
+ /**
4
+ * Puts one destination's content policy in front of it.
5
+ *
6
+ * Content is written onto a span if any destination wants it, so the span
7
+ * reaching a destination that declined still carries it. This cannot strip the
8
+ * attribute in place: that span object is shared with every other processor in
9
+ * the pipeline, and editing it would strip the attribute everywhere. So it
10
+ * gives the destination a facade whose attributes omit what it declined.
11
+ *
12
+ * One facade follows the original from start through end. This preserves the
13
+ * object identity stateful processors key on without ever exposing the original
14
+ * span or its attribute map. Methods stay bound to the original, so private SDK
15
+ * state remains reachable without eve knowing that SDK's concrete span shape.
16
+ *
17
+ * @internal
18
+ */
19
+ export declare function contentFilteringProcessor(downstream: SpanProcessor, content: ResolvedContentOptions): SpanProcessor;
@@ -0,0 +1 @@
1
+ import{hasSessionRelease}from"#tracing/local-traces.js";import{withoutDeclinedContent}from"#tracing/content-attributes.js";function contentFilteringProcessor(t,n){if(n.recordInputs&&n.recordOutputs)return t;let r=new WeakMap,i={forceFlush:()=>t.forceFlush(),onEnd:e=>{if(typeof e!=`object`||!e){t.onEnd(e);return}let i=facadeFor(e,n,r);i.refresh();try{t.onEnd(i.value)}finally{r.delete(e)}},onStart:(e,i)=>{if(typeof e!=`object`||!e){t.onStart(e,i);return}t.onStart(facadeFor(e,n,r).value,i)},shutdown:()=>t.shutdown()};return hasSessionRelease(t)?{...i,releaseSession:e=>t.releaseSession(e)}:i}function facadeFor(e,t,n){let r=n.get(e);if(r!==void 0)return r;let i={},a=[],o={},s=Object.create(Reflect.getPrototypeOf(e)),c=new Map,refresh=()=>{refreshAttributes(i,e,t),refreshEvents(a,e,t),refreshStatus(o,e,t)},l,readOriginal=t=>{let n=Reflect.get(e,t,e);if(typeof n!=`function`||t===`constructor`)return n;let r=c.get(t);if(r!==void 0)return r;let created=(...t)=>{let r=Reflect.apply(n,e,t);return refresh(),r===e?l:r};return c.set(t,created),created};Object.defineProperty(s,"attributes",{configurable:!0,enumerable:!0,value:i}),Object.defineProperty(s,"events",{configurable:!0,enumerable:!0,value:a}),Object.defineProperty(s,"status",{configurable:!0,enumerable:!0,value:o});for(let t of Reflect.ownKeys(e)){if(t===`attributes`||t===`events`||t===`status`)continue;let n=Reflect.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,{configurable:!0,enumerable:n?.enumerable??!1,get:()=>readOriginal(t)})}l=new Proxy(s,{get:(e,t,n)=>Object.hasOwn(e,t)?Reflect.get(e,t,n):readOriginal(t)});let u={refresh,value:l};return u.refresh(),n.set(e,u),u}function refreshAttributes(e,n,r){for(let t of Object.keys(e))delete e[t];let i=n.attributes;if(typeof i!=`object`||!i)return;let a=withoutDeclinedContent(i,r);Object.assign(e,a??i)}function refreshEvents(e,t,n){e.length=0;let r=t.events;if(Array.isArray(r)){if(n.recordOutputs){e.push(...r);return}for(let t of r){if(typeof t!=`object`||!t)continue;let n=t;n.name!==`exception`&&e.push({...n,attributes:void 0})}}}function refreshStatus(e,t,n){for(let t of Object.keys(e))delete e[t];let r=t.status;if(typeof r!=`object`||!r)return;let i=r;i.code!==void 0&&(e.code=i.code),n.recordOutputs&&i.message!==void 0&&(e.message=i.message)}export{contentFilteringProcessor};
@@ -0,0 +1,19 @@
1
+ import { type InstrumentationProviderDefinition } from "#harness/instrumentation/lifecycle.js";
2
+ import { type InstrumentationRuntime } from "#harness/instrumentation/runtime.js";
3
+ import type { CollectedOtel } from "#tracing/otel-declaration.js";
4
+ /**
5
+ * Installs the process instrumentation runtime around a collected pipeline.
6
+ *
7
+ * Both layouts land here. `eve dev`'s zero-config default and an authored
8
+ * `agent/instrumentation/` directory differ only in where the declared values
9
+ * came from, so sharing the install keeps them on one runtime path.
10
+ *
11
+ * A directory that declared no OpenTelemetry still gets a bus: its providers
12
+ * see every event, they just have no spans to hang them on.
13
+ */
14
+ export declare function installInstrumentationRuntime(input: {
15
+ readonly collected: CollectedOtel;
16
+ readonly frameworkVersion: string;
17
+ readonly providers: readonly InstrumentationProviderDefinition[];
18
+ readonly serviceName: string;
19
+ }): InstrumentationRuntime;
@@ -0,0 +1 @@
1
+ import{createLogger,formatError}from"#internal/logging.js";import{ContextAgentTraceStateStore}from"#tracing/agent-trace-context-store.js";import{registerInstrumentationRuntime}from"#harness/instrumentation/runtime.js";import{trace}from"#compiled/@opentelemetry/api/index.js";import{createInstrumentationHooks}from"#harness/instrumentation/lifecycle.js";import{hasSessionRelease}from"#tracing/local-traces.js";import{createAgentOtelInstrumentation}from"#tracing/agent-otel-provider.js";import{registerOtelPipeline}from"#tracing/otel-registration.js";const log=createLogger(`tracing.install-instrumentation-runtime`);function installInstrumentationRuntime(e){let t=[],a=[],o,s,c,runInContext=(e,t)=>t();if(e.collected.declared){o=registerOtelPipeline({pipeline:e.collected.pipeline,serviceName:e.serviceName});let r=createAgentOtelInstrumentation({frameworkVersion:e.frameworkVersion,idGenerator:o.idGenerator,recordInputs:e.collected.settings.recordInputs,recordOutputs:e.collected.settings.recordOutputs,stateStore:new ContextAgentTraceStateStore,tracer:trace.getTracer(`eve.agent`,e.frameworkVersion)});t.push({...r.hook,stateNamespace:`internal:otel`}),s=r.prepareSessionTrace,c=r.prepareTurnTrace,runInContext=r.runInContext;let i=e.collected.pipeline.spanProcessors.filter(isSpanProcessor).filter(hasSessionRelease);i.length>0&&a.push(sessionReleaseProvider(i))}let l=[...t,...e.providers,...a],u;return registerInstrumentationRuntime({forceFlush:()=>settleAll([...o===void 0?[]:[o.forceFlush],...l.map(e=>()=>e.flush?.())]),hooks:createInstrumentationHooks({parallel:e.providers,serialAfter:a,serialBefore:t}),otelSettings:e.collected.declared?e.collected.settings:void 0,prepareSessionTrace:s,prepareTurnTrace:c,runInContext,shutdown:()=>(u??=settleAll([...o===void 0?[]:[o.shutdown],...l.map(e=>()=>e.shutdown?.())]),u)})}function isSpanProcessor(e){return e!==`auto`}function sessionReleaseProvider(e){let release=async t=>{await Promise.all(e.map(e=>e.releaseSession(t.sessionId)))};return{events:{"session.completed":release,"session.failed":release},name:`eve.session-release`,stateNamespace:`internal:session-release`}}async function settleAll(e){let n=await Promise.allSettled(e.map(async e=>e()));for(let e of n)e.status===`rejected`&&log.warn(`instrumentation drain failed`,{error:formatError(e.reason)})}export{installInstrumentationRuntime};
@@ -1,4 +1,4 @@
1
- import { type InstrumentationRuntime } from "#harness/instrumentation-runtime.js";
1
+ import { type InstrumentationRuntime } from "#harness/instrumentation/runtime.js";
2
2
  /** Installs the zero-config local OTel runtime once in an `eve dev` worker. */
3
3
  export declare function installLocalInstrumentationRuntime(input: {
4
4
  readonly appRoot: string;
@@ -1 +1 @@
1
- import{ContextAgentTraceStateStore}from"#tracing/agent-trace-context-store.js";import{getInstrumentationRuntime,registerInstrumentationRuntime}from"#harness/instrumentation-runtime.js";import{context,trace}from"#compiled/@opentelemetry/api/index.js";import{registerOTel}from"#compiled/@vercel/otel/index.js";import{createAgentOtelInstrumentation}from"#tracing/agent-otel-provider.js";import{AgentSpanIdGenerator}from"#tracing/agent-span-id-generator.js";import{AgentTraceSpanProcessor}from"#tracing/agent-trace-span-processor.js";import{createInstrumentationHooks}from"#harness/instrumentation-lifecycle.js";import{requestLocalTraceStorePrune,resolveLocalTraceRetentionSettings}from"#tracing/local-trace-retention.js";import{LocalTraceSpanProcessor}from"#tracing/local-trace-span-processor.js";function installLocalInstrumentationRuntime(t){let n=getInstrumentationRuntime();if(n!==void 0)return n;let r=resolveLocalTraceRetentionSettings(),i=new AgentTraceSpanProcessor(r.enabled?[new LocalTraceSpanProcessor(t.appRoot)]:[]),a=new AgentSpanIdGenerator;registerOTel({autoDetectResources:!1,idGenerator:a,instrumentations:[],propagators:[`none`],serviceName:t.serviceName,spanProcessors:[i]});let o=trace.getTracer(`eve.registration`).startSpan(`eve.otel.registration`),s=trace.setSpan(context.active(),o),c=context.with(s,()=>trace.getActiveSpan()===o);if(o.end(),!i.isAttached()||!c)throw Error(`eve could not register OpenTelemetry because another runtime already exists.`);let l=createAgentOtelInstrumentation({captureContent:process.env.EVE_TRACES_CONTENT!==`off`,frameworkVersion:t.frameworkVersion,idGenerator:a,stateStore:new ContextAgentTraceStateStore,tracer:trace.getTracer(`eve.agent`,t.frameworkVersion)}),u={events:{"session.completed":releaseSessionTrace,"session.failed":releaseSessionTrace}};return requestPrune(),registerInstrumentationRuntime({forceFlush:()=>i.forceFlush(),hooks:createInstrumentationHooks([l.hook,u]),runInContext:l.runInContext});async function releaseSessionTrace(e){await i.forceFlush(),i.releaseSession(e.sessionId)&&requestPrune()}function requestPrune(){r.enabled&&requestLocalTraceStorePrune({activeTraceIds:i.activeTraceIds(),appRoot:t.appRoot,maxAgeMs:r.maxAgeMs,maxTotalBytes:r.maxTotalBytes,retainCount:r.retainCount})}}export{installLocalInstrumentationRuntime};
1
+ import{getInstrumentationRuntime}from"#harness/instrumentation/runtime.js";import{installInstrumentationRuntime}from"#tracing/install-instrumentation-runtime.js";import{collectOtelPipeline,otel,otelIntegration}from"#tracing/otel-declaration.js";import{createLocalTracesProcessor,resolveLocalTracesContent}from"#tracing/local-traces.js";function installLocalInstrumentationRuntime(e){let t=getInstrumentationRuntime();if(t!==void 0)return t;let n=createLocalTracesProcessor({appRoot:e.appRoot});return installInstrumentationRuntime({collected:collectOtelPipeline([otel(),otelIntegration({...resolveLocalTracesContent(),spanProcessors:[n]})]),frameworkVersion:e.frameworkVersion,providers:[],serviceName:e.serviceName})}export{installLocalInstrumentationRuntime};
@@ -0,0 +1,56 @@
1
+ import type { SpanProcessor } from "#compiled/@vercel/otel/index.js";
2
+ /**
3
+ * The local spool, as a span processor.
4
+ *
5
+ * Session liveness and retention live in here rather than in the runtime that
6
+ * installs it, so nothing an author puts in the same `spanProcessors` list can
7
+ * see them — and eve's accept filter never reaches an author's exporters.
8
+ */
9
+ export interface LocalTracesProcessor extends SpanProcessor {
10
+ /**
11
+ * Settles pending writes and drops one root session's liveness, then bounds
12
+ * the store. A subagent child owns no traces, so releasing one is a no-op
13
+ * and leaves the shared trace pinned until its root finishes.
14
+ */
15
+ releaseSession(sessionId: string): Promise<boolean>;
16
+ }
17
+ /**
18
+ * Reports whether a processor tracks which session owns which trace, so eve can
19
+ * tell it when that session is done.
20
+ *
21
+ * Anything standing between eve and the spool has to answer for the spool, so
22
+ * this is the check a wrapper uses to decide whether it must forward the call.
23
+ *
24
+ * @internal
25
+ */
26
+ export declare function hasSessionRelease(processor: SpanProcessor): processor is LocalTracesProcessor;
27
+ /**
28
+ * Writes the OTLP/JSON spool under `.eve/traces/v1`.
29
+ *
30
+ * `EVE_TRACES=off` removes the writer but keeps the processor: eve still has
31
+ * to observe spans to track which session owns which trace.
32
+ *
33
+ * Internal because of `releaseSession`, which eve's runtime drives off session
34
+ * lifecycle. The authored surface is `localTraces()`, which wraps this in an
35
+ * `OtelIntegration`.
36
+ */
37
+ export declare function createLocalTracesProcessor(input?: {
38
+ readonly appRoot?: string;
39
+ }): LocalTracesProcessor;
40
+ /**
41
+ * The local spool's content policy: its options, intersected with
42
+ * `EVE_TRACES_CONTENT`.
43
+ *
44
+ * The variable applies to this destination only. `on` opts the zero-config
45
+ * spool into content, while `off` overrides authored local options without
46
+ * changing what a hosted backend beside it receives.
47
+ *
48
+ * @internal
49
+ */
50
+ export declare function resolveLocalTracesContent(options?: {
51
+ readonly recordInputs?: boolean;
52
+ readonly recordOutputs?: boolean;
53
+ }): {
54
+ readonly recordInputs: boolean;
55
+ readonly recordOutputs: boolean;
56
+ };
@@ -0,0 +1 @@
1
+ import{LocalTraceSpanProcessor}from"#tracing/local-trace-span-processor.js";import{AgentTraceSpanProcessor}from"#tracing/agent-trace-span-processor.js";import{requestLocalTraceStorePrune,resolveLocalTraceRetentionSettings}from"#tracing/local-trace-retention.js";function hasSessionRelease(e){return typeof e.releaseSession==`function`}function createLocalTracesProcessor(r={}){let i=r.appRoot??process.env.EVE_DEV_WORKER_APP_ROOT;if(i===void 0)return inertLocalTracesProcessor();let a=resolveLocalTraceRetentionSettings(),o=new AgentTraceSpanProcessor(a.enabled?[new LocalTraceSpanProcessor(i)]:[]),requestPrune=()=>{a.enabled&&requestLocalTraceStorePrune({activeTraceIds:o.activeTraceIds(),appRoot:i,maxAgeMs:a.maxAgeMs,maxTotalBytes:a.maxTotalBytes,retainCount:a.retainCount})};return requestPrune(),{forceFlush:()=>o.forceFlush(),onEnd:e=>o.onEnd(e),onStart:(e,t)=>o.onStart(e,t),async releaseSession(e){return await o.forceFlush(),o.releaseSession(e)?(requestPrune(),!0):!1},shutdown:()=>o.shutdown()}}function resolveLocalTracesContent(e={}){let t=process.env.EVE_TRACES_CONTENT===`on`,n=process.env.EVE_TRACES_CONTENT!==`off`;return{recordInputs:n&&(e.recordInputs??t),recordOutputs:n&&(e.recordOutputs??t)}}function inertLocalTracesProcessor(){return{forceFlush:async()=>void 0,onEnd:()=>void 0,onStart:()=>void 0,releaseSession:async()=>!1,shutdown:async()=>void 0}}export{createLocalTracesProcessor,hasSessionRelease,resolveLocalTracesContent};
@@ -0,0 +1,150 @@
1
+ import type { PropagatorOrName, SamplerOrName, SpanExporter, SpanProcessor, SpanProcessorOrName } from "#compiled/@vercel/otel/index.js";
2
+ import { type InstrumentationProvider } from "#public/instrumentation/provider.js";
3
+ import type { ResolvedContentOptions } from "#tracing/content-attributes.js";
4
+ /**
5
+ * The process-wide OpenTelemetry settings, declared by `otel()`.
6
+ *
7
+ * Everything here is a singleton, which is why it is one file: a process has
8
+ * one tracer provider, so it has one resource, one sampler, and one propagator
9
+ * set. Destinations are the plural half and live in `otelIntegration()`.
10
+ *
11
+ * `contextManager` and `instrumentations` are deliberately absent: eve's span
12
+ * nesting depends on the former, and the latter cannot reach anything eve
13
+ * imported before setup ran.
14
+ */
15
+ export interface OtelOptions {
16
+ /**
17
+ * The function identifier attached to telemetry spans
18
+ * (`ai.telemetry.functionId`). Defaults to the agent name.
19
+ */
20
+ readonly functionId?: string;
21
+ /**
22
+ * Whether to emit the inbound HTTP `SERVER` span that wraps each channel
23
+ * request — the parent of the turn trace and of any `hook.resume` or
24
+ * outgoing HTTP spans. Defaults to `false`.
25
+ */
26
+ readonly traceChannelRequests?: boolean;
27
+ /**
28
+ * Resource attributes merged into eve's own, which already carry the
29
+ * service name.
30
+ */
31
+ readonly resource?: Readonly<Record<string, unknown>>;
32
+ /**
33
+ * Head sampling, and it is global: it decides whether a span is created at
34
+ * all, so it thins eve's own sinks and the `traceparent` eve propagates
35
+ * along with your exporters. To thin one backend only, drop spans in a
36
+ * processor.
37
+ */
38
+ readonly sampler?: SamplerOrName;
39
+ /** Composed into one propagator. All inject; the first to extract wins. */
40
+ readonly propagators?: readonly PropagatorOrName[];
41
+ }
42
+ /**
43
+ * What one destination records of the conversation itself.
44
+ *
45
+ * Declining is per destination, not per process: content is written onto the
46
+ * span if any destination wants it, and one that declined never exports it. So
47
+ * an agent whose every destination declines still never materializes a prompt —
48
+ * the union of nothing is nothing — but a local spool and a hosted backend no
49
+ * longer have to agree.
50
+ */
51
+ export interface ContentOptions {
52
+ /** Record model prompts and tool call inputs. Defaults to `false`. */
53
+ readonly recordInputs?: boolean;
54
+ /** Record model responses and tool call outputs. Defaults to `false`. */
55
+ readonly recordOutputs?: boolean;
56
+ }
57
+ /** Where one `otelIntegration()` sends spans, and what it records. */
58
+ export interface OtelIntegrationOptions extends ContentOptions {
59
+ /** Merged into the pipeline in declaration order. */
60
+ readonly spanProcessors?: readonly SpanProcessor[];
61
+ /** Wrapped in eve's batching processor and appended after `spanProcessors`. */
62
+ readonly traceExporter?: SpanExporter;
63
+ }
64
+ declare const OTEL_DECLARATION: unique symbol;
65
+ declare const OTEL_INTEGRATION: unique symbol;
66
+ /**
67
+ * The declared OpenTelemetry pipeline settings. eve collects this before
68
+ * building the tracer provider, so it is a value rather than a side effect.
69
+ */
70
+ export interface OtelDeclaration extends InstrumentationProvider {
71
+ readonly [OTEL_DECLARATION]: true;
72
+ readonly options: OtelOptions;
73
+ }
74
+ /** One declared destination. A process may have as many as it has files. */
75
+ export interface OtelIntegration extends InstrumentationProvider {
76
+ readonly [OTEL_INTEGRATION]: true;
77
+ /** Resolved from `ContentOptions`, so the union does not re-apply defaults. */
78
+ readonly content: ResolvedContentOptions;
79
+ readonly spanProcessors: readonly SpanProcessorOrName[];
80
+ }
81
+ /**
82
+ * Declares the process-wide OpenTelemetry settings.
83
+ *
84
+ * Export it from `agent/instrumentation/otel.ts`. Omitting the file is the
85
+ * common case: eve registers the pipeline for whatever destinations are
86
+ * declared beside it, and this only names what those destinations share.
87
+ */
88
+ export declare function otel(options?: OtelOptions): OtelDeclaration;
89
+ /**
90
+ * Declares one destination for this agent's traces.
91
+ *
92
+ * A `traceExporter` is wrapped in eve's batching processor, which is what makes
93
+ * the one-line form of a hosted backend enough. Pass `spanProcessors` instead
94
+ * when the destination needs its own batching, sampling, or filtering.
95
+ *
96
+ * Declining content wraps every processor here, an author's included: they are
97
+ * this destination, and the point of declining is that nothing under it sees
98
+ * what was said.
99
+ */
100
+ export declare function otelIntegration(options?: OtelIntegrationOptions): OtelIntegration;
101
+ /** Vercel Agent Runs through the production request-context transport. @internal */
102
+ export declare function agentRunsIntegration(options?: ContentOptions): OtelIntegration;
103
+ export declare function resolveContentOptions(options: ContentOptions): ResolvedContentOptions;
104
+ export declare function isOtelDeclaration(value: unknown): value is OtelDeclaration;
105
+ export declare function isOtelIntegration(value: unknown): value is OtelIntegration;
106
+ /** The one pipeline a process can register. @internal */
107
+ export interface OtelPipeline {
108
+ readonly propagators?: readonly PropagatorOrName[];
109
+ readonly resource?: Readonly<Record<string, unknown>>;
110
+ readonly sampler?: SamplerOrName;
111
+ readonly spanProcessors: readonly SpanProcessorOrName[];
112
+ }
113
+ /** What the harness reads at turn time, as opposed to at registration. @internal */
114
+ export interface OtelHarnessSettings {
115
+ readonly functionId?: string;
116
+ readonly traceChannelRequests: boolean;
117
+ /**
118
+ * What to write onto a span at all, as opposed to what any one destination
119
+ * exports. `agent/instrumentation.ts` sets this directly; a provider
120
+ * directory arrives at it as the union of its destinations.
121
+ */
122
+ readonly recordInputs?: boolean;
123
+ readonly recordOutputs?: boolean;
124
+ }
125
+ /** @internal */
126
+ export interface CollectedOtel {
127
+ /**
128
+ * Whether anything declared OpenTelemetry. False means eve should leave the
129
+ * global tracer provider slot alone rather than register an empty pipeline.
130
+ */
131
+ readonly declared: boolean;
132
+ readonly pipeline: OtelPipeline;
133
+ readonly settings: OtelHarnessSettings;
134
+ }
135
+ /**
136
+ * Folds the declared values into the one pipeline a process can register.
137
+ *
138
+ * Destinations concatenate in declaration order. The singletons cannot: two
139
+ * `otel()` values is a boot error rather than a silent win for whichever eve
140
+ * happened to visit first. With one declaration per file that collision needs
141
+ * two files both exporting `otel()`, which is the only way to reach it.
142
+ *
143
+ * Content capture is the union of what the destinations asked for, because it
144
+ * governs what is written rather than what is exported. Each destination's own
145
+ * processors already drop what it declined.
146
+ *
147
+ * @internal
148
+ */
149
+ export declare function collectOtelPipeline(values: readonly unknown[]): CollectedOtel;
150
+ export {};
@@ -0,0 +1 @@
1
+ import{PROVIDER}from"#public/instrumentation/provider.js";import{batchSpanProcessor}from"#tracing/batch-span-processor.js";import{contentFilteringProcessor}from"#tracing/content-span-processor.js";import{vercelRuntimeSpanProcessor}from"#tracing/vercel-runtime-span-exporter.js";const OTEL_DECLARATION=Symbol.for(`eve.instrumentation.otel`),OTEL_INTEGRATION=Symbol.for(`eve.instrumentation.otel-integration`);function otel(t={}){return{[OTEL_DECLARATION]:!0,[PROVIDER]:!0,options:t}}function otelIntegration(r={}){let i={recordInputs:r.recordInputs===!0,recordOutputs:r.recordOutputs===!0},o=r.spanProcessors??[],s=r.traceExporter===void 0?o:[...o,batchSpanProcessor(r.traceExporter)];return{[OTEL_INTEGRATION]:!0,[PROVIDER]:!0,content:i,spanProcessors:i.recordInputs&&i.recordOutputs?s:s.map(e=>contentFilteringProcessor(e,i))}}function agentRunsIntegration(t={}){let i=resolveContentOptions(t);return{[OTEL_INTEGRATION]:!0,[PROVIDER]:!0,content:i,spanProcessors:i.recordInputs&&i.recordOutputs?[`auto`]:[contentFilteringProcessor(vercelRuntimeSpanProcessor(),i)]}}function resolveContentOptions(e){return{recordInputs:e.recordInputs===!0,recordOutputs:e.recordOutputs===!0}}function isOtelDeclaration(e){return typeof e==`object`&&!!e&&e[OTEL_DECLARATION]===!0}function isOtelIntegration(e){return typeof e==`object`&&!!e&&e[OTEL_INTEGRATION]===!0}function collectOtelPipeline(e){let t=[],n,r=!1,i=!1,a=!1;for(let o of e){if(isOtelIntegration(o)){r=!0,i||=o.content.recordInputs,a||=o.content.recordOutputs,t.push(...o.spanProcessors);continue}if(isOtelDeclaration(o)){if(n!==void 0)throw Error("Instrumentation declares `otel()` more than once. One process has one OpenTelemetry tracer provider, so it has one resource, one sampler, and one propagator set — declare them in a single `otel()`.");r=!0,n=o}}let o=n?.options??{};return{declared:r,pipeline:{propagators:o.propagators,resource:o.resource,sampler:o.sampler,spanProcessors:t},settings:{functionId:o.functionId,recordInputs:i,recordOutputs:a,traceChannelRequests:o.traceChannelRequests===!0}}}export{agentRunsIntegration,collectOtelPipeline,isOtelDeclaration,isOtelIntegration,otel,otelIntegration,resolveContentOptions};
@@ -0,0 +1,21 @@
1
+ import { AgentSpanIdGenerator } from "#tracing/agent-span-id-generator.js";
2
+ import type { OtelPipeline } from "#tracing/otel-declaration.js";
3
+ /**
4
+ * Builds the process's one OpenTelemetry tracer provider from a merged
5
+ * declaration, then proves it took the global slot.
6
+ *
7
+ * `registerOTel` reports a refused registration only through `diag`, which
8
+ * goes nowhere unless `OTEL_LOG_LEVEL` is set, so a second caller would export
9
+ * nothing and say nothing. eve primes its id generator and installs a private
10
+ * propagator, then verifies both through the global APIs.
11
+ */
12
+ export declare function registerOtelPipeline(input: {
13
+ readonly pipeline: OtelPipeline;
14
+ readonly serviceName: string;
15
+ }): RegisteredOtelPipeline;
16
+ /** Lifecycle retained from the tracer provider that owns every destination. */
17
+ export interface RegisteredOtelPipeline {
18
+ readonly forceFlush: () => Promise<void>;
19
+ readonly idGenerator: AgentSpanIdGenerator;
20
+ readonly shutdown: () => Promise<void>;
21
+ }
@@ -0,0 +1 @@
1
+ import{context,propagation,trace}from"#compiled/@opentelemetry/api/index.js";import{registerOTel}from"#compiled/@vercel/otel/index.js";import{AgentSpanIdGenerator}from"#tracing/agent-span-id-generator.js";const REGISTRATION_SPAN_NAME=`eve.otel.registration`,REPLAY_DEDUPLICATION_LIMIT=1e5;var RegistrationMarkerPropagator=class{#e=!1;extract(e){return e}fields(){return[]}inject(){this.#e=!0}isInstalled(){return this.#e=!1,propagation.inject(context.active(),{},{set:()=>{}}),this.#e}},PrivateSpanFilteringProcessor=class{endedSpans=new Set;forwardedSpans=new Set;pendingByParent=new Map;processors;startedSpans=new Set;constructor(e){this.processors=e}async forceFlush(){await Promise.all(this.processors.map(e=>e.forceFlush()))}onEnd(e){if(isRegistrationSpan(e))return;let t=spanIdentity(e);if(t!==void 0){if(this.endedSpans.has(t))return;if(this.endedSpans.size>=REPLAY_DEDUPLICATION_LIMIT){let e=this.endedSpans.values().next().value;e!==void 0&&this.endedSpans.delete(e)}this.endedSpans.add(t)}let n=parentIdentity(e);if(n!==void 0&&this.startedSpans.has(n)&&!this.forwardedSpans.has(n)){let t=this.pendingByParent.get(n)??[];t.push(e),this.pendingByParent.set(n,t);return}this.forward(e,t)}onStart(e,t){if(isRegistrationSpan(e))return;let n=spanIdentity(e);n!==void 0&&addBounded(this.startedSpans,n);for(let n of this.processors)n.onStart(e,t)}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}forward(e,t){for(let t of this.processors)t.onEnd(e);if(t===void 0)return;addBounded(this.forwardedSpans,t);let n=this.pendingByParent.get(t);if(n!==void 0){this.pendingByParent.delete(t);for(let e of n)this.forward(e,spanIdentity(e))}}};function registerOtelPipeline(e){let{pipeline:t}=e,n=new AgentSpanIdGenerator,i=new RegistrationMarkerPropagator,a={attributes:t.resource,autoDetectResources:!1,idGenerator:n,instrumentations:[],propagators:[...t.propagators??[`none`],i],serviceName:e.serviceName,spanProcessors:t.spanProcessors.map(e=>isSpanProcessor(e)?new PrivateSpanFilteringProcessor([e]):e)};registerOTel(t.sampler===void 0?a:{...a,traceSampler:t.sampler});let o=globalTracerUses(n),s=i.isInstalled();if((!o||!s)&&rollbackRegistration({ownsPropagator:s,ownsTracer:o}),!o)throw Error("eve could not register OpenTelemetry because another runtime already owns the global tracer provider. Remove the other `registerOTel` call, or move its exporters into eve's `otelIntegration({ spanProcessors: [...] })`.");if(!s)throw Error("eve could not register OpenTelemetry because another runtime already owns the global propagator. Remove the other global propagator registration and declare propagators through eve's `otel()` instead.");let c=runtimeTracerProvider();if(typeof c.forceFlush!=`function`||typeof c.shutdown!=`function`)throw rollbackRegistration({ownsPropagator:s,ownsTracer:o}),Error(`The registered OpenTelemetry tracer provider has no lifecycle methods.`);return{forceFlush:()=>c.forceFlush(),idGenerator:n,shutdown:()=>c.shutdown()}}function rollbackRegistration(e){if(e.ownsPropagator&&propagation.disable(),!e.ownsTracer)return;let r=runtimeTracerProvider();if(typeof r.shutdown==`function`)try{r.shutdown().catch(()=>{})}catch{}trace.disable()}function runtimeTracerProvider(){let e=trace.getTracerProvider();return e.getDelegate?.()??e}function globalTracerUses(e){let t=e.allocateSpanId();return e.withSpanId(t,()=>trace.getTracer(`eve.registration`).startSpan(REGISTRATION_SPAN_NAME)).spanContext().spanId===t}function isRegistrationSpan(e){return typeof e==`object`&&!!e&&`name`in e&&e.name===REGISTRATION_SPAN_NAME}function spanIdentity(e){if(typeof e!=`object`||!e||!(`spanContext`in e)||typeof e.spanContext!=`function`)return;let t=e.spanContext();return typeof t.traceId==`string`&&typeof t.spanId==`string`?`${t.traceId}:${t.spanId}`:void 0}function parentIdentity(e){if(typeof e!=`object`||!e||!(`parentSpanContext`in e))return;let t=e.parentSpanContext;return typeof t?.traceId==`string`&&typeof t.spanId==`string`?`${t.traceId}:${t.spanId}`:void 0}function addBounded(e,t){if(e.size>=REPLAY_DEDUPLICATION_LIMIT){let t=e.values().next().value;t!==void 0&&e.delete(t)}e.add(t)}function isSpanProcessor(e){return e!==`auto`}export{registerOtelPipeline};
@@ -0,0 +1,5 @@
1
+ import type { SpanExporter, SpanProcessor } from "#compiled/@vercel/otel/index.js";
2
+ /** The request-context transport behind @vercel/otel's automatic processor. */
3
+ export declare function vercelRuntimeSpanExporter(): SpanExporter;
4
+ /** Reports immediately so the span stays attached to its request context. */
5
+ export declare function vercelRuntimeSpanProcessor(): SpanProcessor;
@@ -0,0 +1 @@
1
+ import{createLogger,formatError}from"#internal/logging.js";import{TraceFlags}from"#compiled/@opentelemetry/api/index.js";import{JsonTraceSerializer}from"#compiled/@opentelemetry/otlp-transformer/index.js";const VERCEL_REQUEST_CONTEXT=Symbol.for(`@vercel/request-context`),log=createLogger(`tracing.vercel-runtime-span-exporter`);function vercelRuntimeSpanExporter(){return{export(e,t){let n=globalThis[VERCEL_REQUEST_CONTEXT]?.get()?.telemetry;if(n===void 0){t({code:0});return}try{let i=JsonTraceSerializer.serializeRequest([...e]);if(i===void 0)throw Error(`Failed to serialize spans.`);n.reportSpans(JSON.parse(new TextDecoder().decode(i))),t({code:0})}catch(e){t({code:1,error:e instanceof Error?e:Error(String(e))})}},forceFlush:async()=>void 0,shutdown:async()=>void 0}}function vercelRuntimeSpanProcessor(){let e=vercelRuntimeSpanExporter(),n=!1;return{forceFlush:()=>e.forceFlush?.()??Promise.resolve(),onEnd(r){n||!isSampled(r)||e.export([r],e=>{e.code!==0&&log.warn(`Agent Runs export failed`,{error:formatError(e.error??Error(`Span export failed.`))})})},onStart(){},async shutdown(){n=!0,await e.shutdown()}}}function isSampled(e){if(typeof e!=`object`||!e||!(`spanContext`in e))return!1;let t=e.spanContext;if(typeof t!=`function`)return!1;let r=Reflect.apply(t,e,[]);return typeof r.traceFlags==`number`&&(r.traceFlags&TraceFlags.SAMPLED)===TraceFlags.SAMPLED}export{vercelRuntimeSpanExporter,vercelRuntimeSpanProcessor};
@@ -1,3 +1,3 @@
1
- import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-3oBnxzhV.js";
1
+ import { n as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-CnppTEFk.js";
2
2
 
3
3
  export { defaultMessageReducer, useEveAgent };
@@ -1,3 +1,3 @@
1
- import { t as useEveAgent } from "../chunks/use-eve-agent-3oBnxzhV.js";
1
+ import { t as useEveAgent } from "../chunks/use-eve-agent-CnppTEFk.js";
2
2
 
3
3
  export { useEveAgent };