eve 0.44.3 → 0.45.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 (821) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +13 -12
  3. package/dist/src/acp/adapter.d.ts +1 -1
  4. package/dist/src/approval/definition.d.ts +84 -0
  5. package/dist/src/approval/definition.js +1 -0
  6. package/dist/src/channel/adapter.d.ts +2 -2
  7. package/dist/src/{runtime/governance → channel}/auth/http-basic.d.ts +1 -1
  8. package/dist/src/{runtime/governance → channel}/auth/jwt-ecdsa.d.ts +1 -1
  9. package/dist/src/channel/auth/jwt-ecdsa.js +1 -0
  10. package/dist/src/{runtime/governance → channel}/auth/jwt-hmac.d.ts +1 -1
  11. package/dist/src/channel/auth/jwt-hmac.js +1 -0
  12. package/dist/src/{runtime/governance → channel}/auth/oidc.d.ts +1 -1
  13. package/dist/src/channel/auth/oidc.js +1 -0
  14. package/dist/src/{runtime/governance → channel}/auth/token-claims.d.ts +1 -1
  15. package/dist/src/{runtime/governance → channel}/auth/types.d.ts +1 -1
  16. package/dist/src/{runtime/governance → channel}/auth/vercel-oidc-project.d.ts +1 -1
  17. package/dist/src/channel/channel-operations.d.ts +1 -1
  18. package/dist/src/channel/channel-operations.js +1 -1
  19. package/dist/src/channel/instrumentation.d.ts +1 -0
  20. package/dist/src/channel/instrumentation.js +1 -1
  21. package/dist/src/channel/resolve-text.d.ts +1 -1
  22. package/dist/src/channel/routes.d.ts +1 -1
  23. package/dist/src/channel/session.d.ts +1 -1
  24. package/dist/src/channel/session.js +1 -1
  25. package/dist/src/channel/types.d.ts +2 -2
  26. package/dist/src/chunks/{use-eve-agent-DpUEwS23.js → use-eve-agent-C46Kan_I.js} +390 -107
  27. package/dist/src/chunks/{use-eve-agent-BsLJiIbc.js → use-eve-agent-OtHRoxIS.js} +390 -107
  28. package/dist/src/cli/banner.js +1 -1
  29. package/dist/src/cli/commands/agent-instructions.js +2 -2
  30. package/dist/src/cli/commands/channel-add-conflicts.js +1 -1
  31. package/dist/src/cli/commands/extension-build.js +1 -1
  32. package/dist/src/cli/commands/extension-init.js +1 -1
  33. package/dist/src/cli/commands/info.js +1 -1
  34. package/dist/src/cli/commands/init.js +1 -1
  35. package/dist/src/cli/commands/trace.js +1 -1
  36. package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
  37. package/dist/src/cli/dev/tui/prompt-commands.d.ts +1 -1
  38. package/dist/src/cli/dev/tui/prompt-commands.js +1 -1
  39. package/dist/src/cli/dev/tui/remote-auth.js +1 -1
  40. package/dist/src/cli/dev/tui/setup-commands.d.ts +2 -0
  41. package/dist/src/cli/dev/tui/setup-commands.js +1 -1
  42. package/dist/src/cli/dev/tui/setup-selection-input.d.ts +3 -1
  43. package/dist/src/cli/dev/tui/setup-selection-input.js +2 -2
  44. package/dist/src/cli/dev/tui/terminal-renderer.js +2 -2
  45. package/dist/src/cli/dev/tui/traces/trace-conversation.d.ts +1 -1
  46. package/dist/src/cli/dev/tui/traces/trace-conversation.js +1 -1
  47. package/dist/src/cli/dev/tui/traces/trace-viewer-state.js +1 -1
  48. package/dist/src/cli/invoke/result.d.ts +1 -1
  49. package/dist/src/cli/ui/live-row.js +1 -1
  50. package/dist/src/cli/ui/output.js +1 -1
  51. package/dist/src/client/agent-info-schema.d.ts +1757 -302
  52. package/dist/src/client/agent-info-schema.js +1 -1
  53. package/dist/src/client/client.js +1 -1
  54. package/dist/src/client/eve-agent-store.d.ts +6 -5
  55. package/dist/src/client/eve-agent-store.js +1 -1
  56. package/dist/src/client/health-response-error.d.ts +5 -0
  57. package/dist/src/client/health-response-error.js +1 -0
  58. package/dist/src/client/health-schema.d.ts +7 -0
  59. package/dist/src/client/health-schema.js +1 -0
  60. package/dist/src/client/index.d.ts +6 -3
  61. package/dist/src/client/index.js +1 -1
  62. package/dist/src/client/message-action-parts.d.ts +2 -2
  63. package/dist/src/client/message-reducer-types.d.ts +1 -1
  64. package/dist/src/client/reducer.d.ts +1 -1
  65. package/dist/src/client/session-utils.d.ts +1 -1
  66. package/dist/src/client/session.d.ts +1 -1
  67. package/dist/src/client/session.js +1 -1
  68. package/dist/src/client/types.d.ts +3 -7
  69. package/dist/src/compiler/artifacts.d.ts +37 -11
  70. package/dist/src/compiler/artifacts.js +1 -1
  71. package/dist/src/compiler/channel-route-plan.d.ts +10 -0
  72. package/dist/src/compiler/channel-route-plan.js +1 -0
  73. package/dist/src/compiler/compile-agent.d.ts +2 -2
  74. package/dist/src/compiler/compile-agent.js +2 -2
  75. package/dist/src/compiler/compile-from-memory.d.ts +13 -52
  76. package/dist/src/compiler/compile-from-memory.js +1 -1
  77. package/dist/src/compiler/diagnostics.d.ts +38 -0
  78. package/dist/src/compiler/diagnostics.js +1 -0
  79. package/dist/src/compiler/extension-compatibility.d.ts +14 -11
  80. package/dist/src/compiler/extension-compatibility.js +1 -1
  81. package/dist/src/compiler/load-binding-namespace.d.ts +9 -0
  82. package/dist/src/compiler/load-binding-namespace.js +1 -0
  83. package/dist/src/compiler/manifest.d.ts +172 -51
  84. package/dist/src/compiler/manifest.js +1 -1
  85. package/dist/src/compiler/module-map.d.ts +12 -30
  86. package/dist/src/compiler/module-map.js +3 -3
  87. package/dist/src/compiler/node-source-state.d.ts +24 -0
  88. package/dist/src/compiler/node-source-state.js +1 -0
  89. package/dist/src/compiler/normalize-agent-config.d.ts +5 -1
  90. package/dist/src/compiler/normalize-agent-config.js +1 -1
  91. package/dist/src/compiler/normalize-channel.d.ts +8 -2
  92. package/dist/src/compiler/normalize-channel.js +1 -1
  93. package/dist/src/compiler/normalize-connection.d.ts +1 -1
  94. package/dist/src/compiler/normalize-connection.js +1 -1
  95. package/dist/src/compiler/normalize-helpers.d.ts +13 -4
  96. package/dist/src/compiler/normalize-helpers.js +1 -1
  97. package/dist/src/compiler/normalize-hook.d.ts +4 -11
  98. package/dist/src/compiler/normalize-hook.js +1 -1
  99. package/dist/src/compiler/normalize-instructions.d.ts +3 -3
  100. package/dist/src/compiler/normalize-instructions.js +1 -1
  101. package/dist/src/compiler/normalize-manifest-helpers.d.ts +29 -0
  102. package/dist/src/compiler/normalize-manifest-helpers.js +1 -0
  103. package/dist/src/compiler/normalize-manifest.d.ts +8 -4
  104. package/dist/src/compiler/normalize-manifest.js +1 -1
  105. package/dist/src/compiler/normalize-sandbox.d.ts +1 -1
  106. package/dist/src/compiler/normalize-sandbox.js +1 -1
  107. package/dist/src/compiler/normalize-schedule.d.ts +2 -2
  108. package/dist/src/compiler/normalize-schedule.js +1 -1
  109. package/dist/src/compiler/normalize-skill.d.ts +2 -2
  110. package/dist/src/compiler/normalize-skill.js +1 -1
  111. package/dist/src/compiler/normalize-subagent.d.ts +21 -39
  112. package/dist/src/compiler/normalize-subagent.js +1 -1
  113. package/dist/src/compiler/normalize-tool.d.ts +2 -1
  114. package/dist/src/compiler/normalize-tool.js +1 -1
  115. package/dist/src/compiler/project-sources.d.ts +71 -0
  116. package/dist/src/compiler/project-sources.js +1 -0
  117. package/dist/src/compiler/remote-agent-node.d.ts +8 -0
  118. package/dist/src/compiler/remote-agent-node.js +1 -1
  119. package/dist/src/compiler/source-graph.d.ts +153 -0
  120. package/dist/src/compiler/source-graph.js +1 -0
  121. package/dist/src/compiler/validate-artifact.d.ts +17 -0
  122. package/dist/src/compiler/validate-artifact.js +1 -0
  123. package/dist/src/compiler/workspace-resources.js +1 -1
  124. package/dist/src/connections/errors.d.ts +125 -0
  125. package/dist/src/connections/errors.js +1 -0
  126. package/dist/src/context/build-base-tool-context.d.ts +2 -2
  127. package/dist/src/context/build-callback-context.d.ts +1 -1
  128. package/dist/src/context/build-dynamic-tools.js +1 -1
  129. package/dist/src/context/dynamic-instruction-lifecycle.js +1 -1
  130. package/dist/src/context/dynamic-resolve-context.d.ts +1 -1
  131. package/dist/src/context/dynamic-skill-lifecycle.js +1 -1
  132. package/dist/src/context/dynamic-subagent-lifecycle.d.ts +0 -2
  133. package/dist/src/context/dynamic-subagent-lifecycle.js +1 -1
  134. package/dist/src/context/dynamic-tool-lifecycle.d.ts +2 -2
  135. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  136. package/dist/src/context/key-names.d.ts +12 -0
  137. package/dist/src/context/key-names.js +1 -0
  138. package/dist/src/context/keys.d.ts +8 -1
  139. package/dist/src/context/keys.js +1 -1
  140. package/dist/src/context/providers/connection-key.d.ts +1 -1
  141. package/dist/src/context/providers/connection.d.ts +1 -1
  142. package/dist/src/context/session-context.d.ts +32 -0
  143. package/dist/src/discover/discover-agent.d.ts +0 -13
  144. package/dist/src/discover/discover-agent.js +1 -1
  145. package/dist/src/discover/discover-subagent.js +1 -1
  146. package/dist/src/discover/extensions.d.ts +0 -6
  147. package/dist/src/discover/extensions.js +1 -1
  148. package/dist/src/discover/manifest.d.ts +4 -1
  149. package/dist/src/discover/manifest.js +1 -1
  150. package/dist/src/dynamic/definition.d.ts +117 -0
  151. package/dist/src/dynamic/definition.js +1 -0
  152. package/dist/src/evals/autoevals-client.js +1 -1
  153. package/dist/src/evals/index.d.ts +1 -1
  154. package/dist/src/evals/match.d.ts +1 -1
  155. package/dist/src/evals/runner/reporters/console.js +1 -1
  156. package/dist/src/evals/session.d.ts +1 -1
  157. package/dist/src/evals/target.js +1 -1
  158. package/dist/src/evals/types.d.ts +1 -1
  159. package/dist/src/eve-channel/index.d.ts +12 -0
  160. package/dist/src/eve-channel/index.js +1 -0
  161. package/dist/src/eve-channel/request.d.ts +49 -0
  162. package/dist/src/eve-channel/request.js +3 -0
  163. package/dist/src/eve-channel/support.d.ts +34 -0
  164. package/dist/src/eve-channel/support.js +1 -0
  165. package/dist/src/eve-channel/types.d.ts +128 -0
  166. package/dist/src/eve-channel/types.js +1 -0
  167. package/dist/src/execution/agent-handle-dispatch.d.ts +1 -1
  168. package/dist/src/execution/agent-handle-dispatch.js +1 -1
  169. package/dist/src/execution/authorization-callback-match.d.ts +1 -1
  170. package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
  171. package/dist/src/execution/compaction.js +1 -1
  172. package/dist/src/execution/connection-auth-tool-result.d.ts +1 -1
  173. package/dist/src/{runtime → execution}/connections/callback-route.d.ts +2 -20
  174. package/dist/src/execution/connections/callback-route.js +1 -0
  175. package/dist/src/execution/create-session-step.js +1 -1
  176. package/dist/src/execution/delegated-parent-notification.d.ts +2 -2
  177. package/dist/src/execution/delegated-parent-notification.js +1 -1
  178. package/dist/src/execution/delegated-parent-result.d.ts +1 -1
  179. package/dist/src/execution/delegated-parent-result.js +1 -1
  180. package/dist/src/execution/delegation-tool.d.ts +1 -1
  181. package/dist/src/execution/delegation-tool.js +1 -1
  182. package/dist/src/execution/dispatch-action-failures.d.ts +1 -1
  183. package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +1 -2
  184. package/dist/src/execution/dispatch-runtime-actions-shared.js +1 -1
  185. package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
  186. package/dist/src/execution/dispatch-workflow-runtime-actions-step.d.ts +1 -1
  187. package/dist/src/execution/durable-session-migrations/turn-workflow.d.ts +1 -1
  188. package/dist/src/execution/durable-session-store.js +1 -1
  189. package/dist/src/execution/effective-output-schema.d.ts +2 -1
  190. package/dist/src/execution/eve-workflow-attributes.d.ts +6 -0
  191. package/dist/src/execution/eve-workflow-attributes.js +1 -1
  192. package/dist/src/execution/forward-turn-cancellation-step.js +1 -1
  193. package/dist/src/execution/node-step.js +1 -1
  194. package/dist/src/execution/remote-agent-dispatch.d.ts +10 -8
  195. package/dist/src/execution/remote-agent-dispatch.js +1 -1
  196. package/dist/src/execution/runtime-context.js +1 -1
  197. package/dist/src/execution/sandbox/{bash-tool.d.ts → bash.d.ts} +2 -2
  198. package/dist/src/execution/sandbox/bindings/just-bash-runtime.d.ts +1 -0
  199. package/dist/src/execution/sandbox/bindings/just-bash-runtime.js +1 -1
  200. package/dist/src/execution/sandbox/bindings/just-bash.js +1 -1
  201. package/dist/src/execution/sandbox/bindings/vercel-credentials.js +1 -1
  202. package/dist/src/execution/sandbox/glob-tool.js +1 -1
  203. package/dist/src/execution/sandbox/grep-tool.js +1 -1
  204. package/dist/src/execution/sandbox/{read-file-tool.d.ts → read-file.d.ts} +2 -2
  205. package/dist/src/execution/sandbox/{read-file-tool.js → read-file.js} +1 -1
  206. package/dist/src/execution/sandbox/{write-file-tool.d.ts → write-file.d.ts} +2 -2
  207. package/dist/src/execution/sandbox/write-file.js +1 -0
  208. package/dist/src/execution/session-callback-route.d.ts +2 -0
  209. package/dist/src/execution/session-callback-route.js +1 -0
  210. package/dist/src/execution/session-callback-step.js +1 -1
  211. package/dist/src/execution/session-timeout-steps.js +1 -1
  212. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  213. package/dist/src/execution/subagent-adapter.js +1 -1
  214. package/dist/src/execution/subagent-hitl-proxy.d.ts +1 -1
  215. package/dist/src/execution/subagent-invocation.d.ts +0 -3
  216. package/dist/src/execution/subagent-invocation.js +1 -1
  217. package/dist/src/execution/subagent-start-local.d.ts +1 -2
  218. package/dist/src/execution/subagent-start-local.js +1 -1
  219. package/dist/src/execution/subagent-start-remote.d.ts +1 -2
  220. package/dist/src/execution/subagent-start-remote.js +1 -1
  221. package/dist/src/execution/subagent-tool.d.ts +4 -8
  222. package/dist/src/execution/subagent-tool.js +1 -1
  223. package/dist/src/execution/subagent-usage-span.d.ts +1 -1
  224. package/dist/src/execution/task-input-response-route.d.ts +2 -0
  225. package/dist/src/execution/task-input-response-route.js +1 -0
  226. package/dist/src/execution/tasks/child/instructions.js +1 -1
  227. package/dist/src/execution/tasks/child/update.d.ts +1 -1
  228. package/dist/src/execution/tasks/child/update.js +1 -1
  229. package/dist/src/execution/tasks/parent/continuation-dispatch.d.ts +1 -1
  230. package/dist/src/execution/tasks/parent/control-shared.d.ts +1 -1
  231. package/dist/src/execution/tasks/parent/delegate.d.ts +2 -2
  232. package/dist/src/execution/tasks/parent/delegate.js +1 -1
  233. package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -1
  234. package/dist/src/execution/tasks/parent/dispatch.d.ts +3 -1
  235. package/dist/src/execution/tasks/parent/dispatch.js +1 -1
  236. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
  237. package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
  238. package/dist/src/execution/terminate-child-sessions-step.d.ts +4 -5
  239. package/dist/src/execution/terminate-child-sessions-step.js +1 -1
  240. package/dist/src/execution/tool-auth.d.ts +5 -6
  241. package/dist/src/execution/tool-auth.js +1 -1
  242. package/dist/src/execution/tools/connection-search.d.ts +1 -0
  243. package/dist/src/execution/tools/connection-search.js +2 -0
  244. package/dist/src/{runtime/framework-tools → execution/tools}/file-state.d.ts +2 -2
  245. package/dist/src/execution/tools/load-skill.d.ts +6 -0
  246. package/dist/src/execution/tools/load-skill.js +1 -0
  247. package/dist/src/{runtime/framework-tools → execution/tools}/subagent/local.d.ts +7 -7
  248. package/dist/src/execution/tools/subagent/local.js +1 -0
  249. package/dist/src/{runtime/framework-tools → execution/tools}/subagent/remote.d.ts +5 -5
  250. package/dist/src/execution/tools/subagent/remote.js +1 -0
  251. package/dist/src/execution/tools/tasks.d.ts +18 -0
  252. package/dist/src/execution/tools/tasks.js +1 -0
  253. package/dist/src/{runtime/framework-tools → execution/tools}/todo.d.ts +0 -2
  254. package/dist/src/{runtime/framework-tools → execution/tools}/todo.js +1 -2
  255. package/dist/src/execution/turn-control-protocol.js +1 -1
  256. package/dist/src/execution/web-fetch/execute.js +1 -0
  257. package/dist/src/execution/web-fetch/request.js +1 -1
  258. package/dist/src/execution/wire/session-inbox-resume.js +1 -1
  259. package/dist/src/execution/wire/session-inbox-wire.v1.js +1 -1
  260. package/dist/src/execution/workflow-entry.js +1 -1
  261. package/dist/src/execution/workflow-runtime.js +1 -1
  262. package/dist/src/execution/workflow-steps.js +1 -1
  263. package/dist/src/execution/workflow-trace-context.js +1 -1
  264. package/dist/src/framework/host-inventory.d.ts +8 -0
  265. package/dist/src/framework/host-inventory.js +1 -0
  266. package/dist/src/framework/sources/modules/agent.d.ts +4 -0
  267. package/dist/src/framework/sources/modules/agent.js +1 -0
  268. package/dist/src/framework/sources/modules/eve-channel.d.ts +1 -0
  269. package/dist/src/framework/sources/modules/eve-channel.js +1 -0
  270. package/dist/src/framework/sources/modules/home-channel.d.ts +2 -0
  271. package/dist/src/framework/sources/modules/home-channel.js +1 -0
  272. package/dist/src/framework/sources/modules/sandbox.d.ts +2 -0
  273. package/dist/src/framework/sources/modules/sandbox.js +1 -0
  274. package/dist/src/framework/sources/registry.d.ts +5 -0
  275. package/dist/src/framework/sources/registry.js +1 -0
  276. package/dist/src/harness/action-result-helpers.d.ts +1 -1
  277. package/dist/src/harness/advertised-tools.js +1 -1
  278. package/dist/src/harness/attachment-staging.js +1 -1
  279. package/dist/src/harness/authorization.d.ts +3 -3
  280. package/dist/src/harness/background-tools.d.ts +2 -2
  281. package/dist/src/harness/channel-delivery-instrumentation.js +1 -1
  282. package/dist/src/harness/compaction.js +1 -1
  283. package/dist/src/harness/execute-tool.d.ts +3 -3
  284. package/dist/src/{runtime/framework-tools → harness}/final-output.d.ts +1 -1
  285. package/dist/src/harness/final-output.js +1 -0
  286. package/dist/src/harness/handles/query.d.ts +1 -1
  287. package/dist/src/harness/handles/store.d.ts +8 -0
  288. package/dist/src/harness/handles/store.js +1 -1
  289. package/dist/src/harness/hitl/approval-input-requests.d.ts +1 -1
  290. package/dist/src/harness/hitl/approval-prompt.d.ts +1 -1
  291. package/dist/src/harness/hitl/pending-input-resolution.d.ts +2 -2
  292. package/dist/src/harness/hitl/question-input-requests.d.ts +1 -1
  293. package/dist/src/harness/input-extraction.d.ts +1 -1
  294. package/dist/src/harness/input-extraction.js +1 -1
  295. package/dist/src/harness/input-request-class.d.ts +1 -1
  296. package/dist/src/harness/input-request-resolution.d.ts +1 -1
  297. package/dist/src/harness/input-requests.d.ts +2 -2
  298. package/dist/src/harness/instrumentation/lifecycle.d.ts +3 -0
  299. package/dist/src/harness/instrumentation/providers.js +1 -1
  300. package/dist/src/harness/instrumentation/runtime.d.ts +2 -1
  301. package/dist/src/harness/pending-input-batches.d.ts +1 -1
  302. package/dist/src/harness/prepare-trace-context.d.ts +3 -0
  303. package/dist/src/harness/prepare-trace-context.js +1 -1
  304. package/dist/src/harness/provider-safety.d.ts +7 -0
  305. package/dist/src/harness/provider-safety.js +1 -0
  306. package/dist/src/{runtime/framework-tools/web-search.d.ts → harness/provider-tool-schemas.d.ts} +1 -9
  307. package/dist/src/harness/provider-tool-schemas.js +1 -0
  308. package/dist/src/harness/provider-tools.js +1 -1
  309. package/dist/src/harness/proxy-input-requests.d.ts +1 -1
  310. package/dist/src/harness/request-input-tool.d.ts +4 -0
  311. package/dist/src/harness/request-input-tool.js +1 -0
  312. package/dist/src/harness/runtime-actions.d.ts +1 -1
  313. package/dist/src/harness/session-limit-continuation.d.ts +1 -1
  314. package/dist/src/harness/step-hooks.d.ts +2 -0
  315. package/dist/src/harness/step-hooks.js +1 -1
  316. package/dist/src/harness/stream-actions.d.ts +1 -1
  317. package/dist/src/harness/subagent-depth.d.ts +1 -1
  318. package/dist/src/harness/tool-call-action.d.ts +1 -1
  319. package/dist/src/harness/tool-call-input-errors.d.ts +1 -1
  320. package/dist/src/harness/tool-loop.js +2 -2
  321. package/dist/src/harness/tool-model-output.d.ts +1 -1
  322. package/dist/src/harness/tools.d.ts +1 -1
  323. package/dist/src/harness/tools.js +1 -1
  324. package/dist/src/harness/types.d.ts +3 -9
  325. package/dist/src/harness/workflow-runtime-action-state.d.ts +1 -1
  326. package/dist/src/harness/workflow-subagent-limit.d.ts +1 -1
  327. package/dist/src/instrumentation/provider.d.ts +117 -0
  328. package/dist/src/instrumentation/provider.js +1 -0
  329. package/dist/src/internal/application/compiled-artifacts.js +5 -4
  330. package/dist/src/internal/application/package.js +1 -1
  331. package/dist/src/internal/authored-definition/approval.d.ts +1 -1
  332. package/dist/src/internal/authored-definition/connection.js +1 -1
  333. package/dist/src/internal/authored-definition/core.js +1 -1
  334. package/dist/src/internal/authored-definition/schema-backed.d.ts +6 -3
  335. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  336. package/dist/src/internal/authored-definition/source-identity.d.ts +17 -0
  337. package/dist/src/internal/authored-definition/source-identity.js +1 -0
  338. package/dist/src/internal/authored-module-map-loader.d.ts +1 -5
  339. package/dist/src/internal/authored-module-map-loader.js +1 -1
  340. package/dist/src/internal/helpers/markdown.js +1 -1
  341. package/dist/src/internal/invocation/agent-invocation.d.ts +2 -2
  342. package/dist/src/internal/invocation/workflow-execution.d.ts +1 -1
  343. package/dist/src/internal/invocation/workflow-execution.js +1 -1
  344. package/dist/src/internal/materialized-authored-modules.js +1 -1
  345. package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
  346. package/dist/src/internal/nitro/host/application-route-registry.d.ts +2 -41
  347. package/dist/src/internal/nitro/host/application-route-registry.js +1 -1
  348. package/dist/src/internal/nitro/host/build-extension.js +1 -1
  349. package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
  350. package/dist/src/internal/nitro/host/configure-nitro-routes.js +3 -4
  351. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  352. package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
  353. package/dist/src/internal/nitro/host/extension-capability-requirements.d.ts +2 -0
  354. package/dist/src/internal/nitro/host/extension-capability-requirements.js +1 -1
  355. package/dist/src/internal/nitro/host/start-development-server.js +2 -2
  356. package/dist/src/internal/nitro/host/start-production-server.js +3 -3
  357. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.d.ts +9 -215
  358. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
  359. package/dist/src/internal/nitro/routes/agent-info/load-agent-info-data.d.ts +2 -13
  360. package/dist/src/internal/nitro/routes/agent-info/load-agent-info-data.js +1 -1
  361. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  362. package/dist/src/internal/nitro/routes/channel-route-context.d.ts +5 -0
  363. package/dist/src/internal/nitro/routes/channel-route-context.js +1 -1
  364. package/dist/src/internal/nitro/routes/index.d.ts +0 -9
  365. package/dist/src/internal/nitro/routes/index.js +1 -1
  366. package/dist/src/internal/nitro/routes/info.js +1 -1
  367. package/dist/src/internal/nitro/routes/runtime-stack.d.ts +5 -5
  368. package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
  369. package/dist/src/internal/programmatic-source-loader.d.ts +1 -0
  370. package/dist/src/internal/programmatic-source-loader.js +1 -0
  371. package/dist/src/internal/runtime-registry.d.ts +3 -4
  372. package/dist/src/protocol/message.d.ts +3 -3
  373. package/dist/src/protocol/routes.d.ts +2 -0
  374. package/dist/src/protocol/routes.js +1 -1
  375. package/dist/src/public/agents/auth.d.ts +10 -6
  376. package/dist/src/public/agents/auth.js +1 -1
  377. package/dist/src/public/channels/auth.d.ts +1 -1
  378. package/dist/src/public/channels/auth.js +1 -1
  379. package/dist/src/public/channels/chat-sdk/authorization.d.ts +3 -0
  380. package/dist/src/public/channels/chat-sdk/authorization.js +3 -0
  381. package/dist/src/public/channels/chat-sdk/chatSdkChannel.d.ts +2 -0
  382. package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +2 -2
  383. package/dist/src/public/channels/discord/discordChannel.js +1 -1
  384. package/dist/src/public/channels/discord/hitl.d.ts +1 -1
  385. package/dist/src/public/channels/discord/hitl.js +1 -1
  386. package/dist/src/public/channels/discord/inbound.d.ts +1 -0
  387. package/dist/src/public/channels/discord/inbound.js +1 -1
  388. package/dist/src/public/channels/eve.d.ts +1 -139
  389. package/dist/src/public/channels/eve.js +1 -3
  390. package/dist/src/public/channels/github/dispatch.d.ts +5 -0
  391. package/dist/src/public/channels/github/dispatch.js +1 -1
  392. package/dist/src/public/channels/github/githubChannel.js +1 -1
  393. package/dist/src/public/channels/github/inbound.d.ts +2 -0
  394. package/dist/src/public/channels/github/inbound.js +1 -1
  395. package/dist/src/public/channels/index.d.ts +1 -1
  396. package/dist/src/public/channels/index.js +1 -1
  397. package/dist/src/public/channels/linear/hitl.d.ts +1 -1
  398. package/dist/src/public/channels/linear/inbound.js +1 -1
  399. package/dist/src/public/channels/linq/index.d.ts +1 -1
  400. package/dist/src/public/channels/linq/index.js +1 -1
  401. package/dist/src/public/channels/linq/linqChannel.d.ts +3 -1
  402. package/dist/src/public/channels/linq/linqChannel.js +1 -1
  403. package/dist/src/public/channels/mcp.js +1 -1
  404. package/dist/src/public/channels/photon/index.d.ts +1 -1
  405. package/dist/src/public/channels/photon/index.js +1 -1
  406. package/dist/src/public/channels/photon/photonIMessageChannel.d.ts +3 -1
  407. package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
  408. package/dist/src/public/channels/slack/action-status.d.ts +1 -1
  409. package/dist/src/public/channels/slack/api.d.ts +15 -5
  410. package/dist/src/public/channels/slack/api.js +1 -1
  411. package/dist/src/public/channels/slack/attachments.d.ts +2 -2
  412. package/dist/src/public/channels/slack/attachments.js +1 -1
  413. package/dist/src/public/channels/slack/hitl.d.ts +3 -1
  414. package/dist/src/public/channels/slack/hitl.js +1 -1
  415. package/dist/src/public/channels/slack/inbound-content.d.ts +4 -0
  416. package/dist/src/public/channels/slack/inbound-content.js +4 -0
  417. package/dist/src/public/channels/slack/inbound.d.ts +17 -1
  418. package/dist/src/public/channels/slack/inbound.js +1 -1
  419. package/dist/src/public/channels/slack/index.d.ts +1 -1
  420. package/dist/src/public/channels/slack/input-response.d.ts +1 -0
  421. package/dist/src/public/channels/slack/input-response.js +1 -1
  422. package/dist/src/public/channels/slack/interaction-cards.d.ts +10 -0
  423. package/dist/src/public/channels/slack/interaction-cards.js +1 -0
  424. package/dist/src/public/channels/slack/interactions.d.ts +1 -0
  425. package/dist/src/public/channels/slack/interactions.js +1 -1
  426. package/dist/src/public/channels/slack/model-context.d.ts +3 -1
  427. package/dist/src/public/channels/slack/model-context.js +2 -2
  428. package/dist/src/public/channels/slack/session-operations.d.ts +1 -1
  429. package/dist/src/public/channels/slack/slackChannel.d.ts +7 -2
  430. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  431. package/dist/src/public/channels/teams/hitl.d.ts +1 -1
  432. package/dist/src/public/channels/teams/hitl.js +1 -1
  433. package/dist/src/public/channels/teams/inbound.d.ts +2 -0
  434. package/dist/src/public/channels/teams/inbound.js +1 -1
  435. package/dist/src/public/channels/teams/teamsChannel.js +1 -1
  436. package/dist/src/public/channels/teams/verify.js +1 -1
  437. package/dist/src/public/channels/telegram/api.d.ts +15 -0
  438. package/dist/src/public/channels/telegram/api.js +2 -2
  439. package/dist/src/public/channels/telegram/authorization-callback.d.ts +10 -0
  440. package/dist/src/public/channels/telegram/authorization-callback.js +1 -0
  441. package/dist/src/public/channels/telegram/authorization.d.ts +19 -0
  442. package/dist/src/public/channels/telegram/authorization.js +3 -0
  443. package/dist/src/public/channels/telegram/defaults.d.ts +1 -0
  444. package/dist/src/public/channels/telegram/defaults.js +3 -3
  445. package/dist/src/public/channels/telegram/hitl.d.ts +1 -1
  446. package/dist/src/public/channels/telegram/hitl.js +1 -1
  447. package/dist/src/public/channels/telegram/inbound.d.ts +1 -0
  448. package/dist/src/public/channels/telegram/inbound.js +1 -1
  449. package/dist/src/public/channels/telegram/index.d.ts +1 -1
  450. package/dist/src/public/channels/telegram/index.js +1 -1
  451. package/dist/src/public/channels/telegram/state.d.ts +6 -0
  452. package/dist/src/public/channels/telegram/state.js +1 -0
  453. package/dist/src/public/channels/telegram/telegramChannel.d.ts +11 -0
  454. package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
  455. package/dist/src/public/connections/errors.d.ts +1 -125
  456. package/dist/src/public/connections/errors.js +1 -1
  457. package/dist/src/public/connections/index.d.ts +2 -2
  458. package/dist/src/public/connections/index.js +1 -1
  459. package/dist/src/public/definitions/agent.d.ts +1 -1
  460. package/dist/src/public/definitions/agent.js +1 -1
  461. package/dist/src/public/definitions/approval.d.ts +2 -84
  462. package/dist/src/public/definitions/approval.js +1 -1
  463. package/dist/src/public/definitions/callback-context.d.ts +1 -32
  464. package/dist/src/public/definitions/connections/mcp.d.ts +1 -1
  465. package/dist/src/public/definitions/connections/mcp.js +1 -1
  466. package/dist/src/public/definitions/connections/openapi.d.ts +1 -1
  467. package/dist/src/public/definitions/connections/openapi.js +1 -1
  468. package/dist/src/public/definitions/connections/protocol.d.ts +1 -1
  469. package/dist/src/public/definitions/instructions.d.ts +2 -2
  470. package/dist/src/public/definitions/instructions.js +1 -1
  471. package/dist/src/public/definitions/skill.js +1 -1
  472. package/dist/src/public/index.d.ts +1 -1
  473. package/dist/src/public/instructions/index.d.ts +1 -1
  474. package/dist/src/public/instrumentation/provider.d.ts +1 -117
  475. package/dist/src/public/instrumentation/provider.js +1 -1
  476. package/dist/src/public/models/openai/chatgpt/auth.js +1 -1
  477. package/dist/src/public/next/server.js +1 -1
  478. package/dist/src/public/nuxt/dev-server.js +1 -1
  479. package/dist/src/public/sandbox/backends/default.d.ts +1 -49
  480. package/dist/src/public/sandbox/backends/default.js +1 -1
  481. package/dist/src/public/sandbox/backends/docker.d.ts +1 -14
  482. package/dist/src/public/sandbox/backends/docker.js +1 -1
  483. package/dist/src/public/sandbox/backends/just-bash.d.ts +1 -17
  484. package/dist/src/public/sandbox/backends/just-bash.js +1 -1
  485. package/dist/src/public/sandbox/backends/microsandbox.d.ts +1 -17
  486. package/dist/src/public/sandbox/backends/microsandbox.js +1 -1
  487. package/dist/src/public/sandbox/backends/vercel.d.ts +1 -30
  488. package/dist/src/public/sandbox/backends/vercel.js +1 -1
  489. package/dist/src/public/sandbox/just-bash-sandbox.d.ts +12 -1
  490. package/dist/src/public/skills/index.d.ts +3 -3
  491. package/dist/src/public/skills/index.js +1 -1
  492. package/dist/src/public/sveltekit/dev-server.js +1 -1
  493. package/dist/src/public/tools/approval/index.d.ts +2 -2
  494. package/dist/src/public/tools/approval/index.js +1 -1
  495. package/dist/src/public/tools/bash.d.ts +3 -0
  496. package/dist/src/public/tools/bash.js +1 -0
  497. package/dist/src/public/tools/glob.d.ts +3 -0
  498. package/dist/src/public/tools/glob.js +1 -0
  499. package/dist/src/public/tools/grep.d.ts +3 -0
  500. package/dist/src/public/tools/grep.js +1 -0
  501. package/dist/src/public/tools/index.d.ts +6 -11
  502. package/dist/src/public/tools/index.js +1 -1
  503. package/dist/src/public/tools/load-skill.d.ts +3 -0
  504. package/dist/src/public/tools/load-skill.js +1 -0
  505. package/dist/src/public/tools/read-file.d.ts +3 -0
  506. package/dist/src/public/tools/read-file.js +1 -0
  507. package/dist/src/public/{tool-result-narrowing.d.ts → tools/result.d.ts} +2 -28
  508. package/dist/src/public/tools/result.js +1 -0
  509. package/dist/src/public/tools/sleep.d.ts +1 -0
  510. package/dist/src/public/tools/sleep.js +1 -0
  511. package/dist/src/public/tools/todo.d.ts +3 -0
  512. package/dist/src/public/tools/todo.js +1 -0
  513. package/dist/src/public/tools/web-fetch.d.ts +3 -0
  514. package/dist/src/public/tools/web-fetch.js +1 -0
  515. package/dist/src/public/tools/web-search.d.ts +3 -36
  516. package/dist/src/public/tools/web-search.js +1 -1
  517. package/dist/src/public/tools/workflow.d.ts +4 -0
  518. package/dist/src/public/tools/workflow.js +1 -0
  519. package/dist/src/public/tools/write-file.d.ts +3 -0
  520. package/dist/src/public/tools/write-file.js +1 -0
  521. package/dist/src/public/types/json.d.ts +1 -28
  522. package/dist/src/react/use-eve-agent.d.ts +1 -0
  523. package/dist/src/react/use-eve-agent.js +1 -1
  524. package/dist/src/runtime/actions/keys.d.ts +1 -1
  525. package/dist/src/runtime/actions/results.d.ts +1 -1
  526. package/dist/src/runtime/agent/bootstrap.js +1 -1
  527. package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
  528. package/dist/src/runtime/connections/authorization-tokens.d.ts +1 -1
  529. package/dist/src/runtime/connections/mcp-client.d.ts +1 -1
  530. package/dist/src/runtime/connections/mcp-client.js +1 -1
  531. package/dist/src/runtime/connections/openapi-client.d.ts +1 -1
  532. package/dist/src/runtime/connections/openapi-client.js +1 -1
  533. package/dist/src/runtime/connections/principal.d.ts +1 -1
  534. package/dist/src/runtime/connections/principal.js +1 -1
  535. package/dist/src/runtime/connections/registry-types.d.ts +11 -0
  536. package/dist/src/runtime/connections/registry.d.ts +3 -2
  537. package/dist/src/runtime/connections/resolve-authorization.d.ts +2 -2
  538. package/dist/src/runtime/connections/resolve-authorization.js +1 -1
  539. package/dist/src/runtime/connections/scoped-authorization.d.ts +2 -2
  540. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  541. package/dist/src/runtime/loaders/compile-metadata.js +1 -1
  542. package/dist/src/runtime/loaders/manifest.js +1 -1
  543. package/dist/src/runtime/prompt/compose.d.ts +0 -6
  544. package/dist/src/runtime/prompt/compose.js +1 -1
  545. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  546. package/dist/src/runtime/resolve-agent.js +1 -1
  547. package/dist/src/runtime/resolve-connection.js +1 -1
  548. package/dist/src/runtime/resolve-dynamic-tool.js +1 -1
  549. package/dist/src/runtime/resolve-tool.d.ts +2 -1
  550. package/dist/src/runtime/resolve-tool.js +1 -1
  551. package/dist/src/runtime/sandbox/keys.js +1 -1
  552. package/dist/src/runtime/sandbox/registry.d.ts +4 -20
  553. package/dist/src/runtime/sandbox/registry.js +1 -1
  554. package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
  555. package/dist/src/runtime/sessions/runtime-context-keys.js +1 -1
  556. package/dist/src/runtime/sessions/turn.d.ts +3 -1
  557. package/dist/src/runtime/skills/sandbox-access.d.ts +1 -1
  558. package/dist/src/runtime/subagents/dynamic-agent-config.js +1 -1
  559. package/dist/src/runtime/subagents/dynamic-remote-agent-config.js +1 -1
  560. package/dist/src/runtime/subagents/registry.d.ts +0 -27
  561. package/dist/src/runtime/subagents/registry.js +1 -1
  562. package/dist/src/runtime/tools/registry.js +1 -1
  563. package/dist/src/runtime/types.d.ts +11 -27
  564. package/dist/src/sandbox/backends/default.d.ts +49 -0
  565. package/dist/src/sandbox/backends/default.js +1 -0
  566. package/dist/src/sandbox/backends/docker.d.ts +14 -0
  567. package/dist/src/sandbox/backends/docker.js +1 -0
  568. package/dist/src/sandbox/backends/just-bash.d.ts +17 -0
  569. package/dist/src/sandbox/backends/just-bash.js +1 -0
  570. package/dist/src/sandbox/backends/microsandbox.d.ts +17 -0
  571. package/dist/src/sandbox/backends/microsandbox.js +1 -0
  572. package/dist/src/sandbox/backends/vercel.d.ts +30 -0
  573. package/dist/src/sandbox/backends/vercel.js +1 -0
  574. package/dist/src/services/dev-client/runtime-artifacts.d.ts +2 -0
  575. package/dist/src/services/dev-client/runtime-artifacts.js +1 -1
  576. package/dist/src/services/dev-client.d.ts +1 -1
  577. package/dist/src/setup/channel-add-conflicts.js +1 -1
  578. package/dist/src/setup/cli/select-component.js +1 -1
  579. package/dist/src/setup/flows/link.js +1 -1
  580. package/dist/src/setup/flows/model-source-change.js +1 -1
  581. package/dist/src/setup/flows/model.js +1 -1
  582. package/dist/src/setup/flows/registry.d.ts +7 -1
  583. package/dist/src/setup/flows/registry.js +1 -1
  584. package/dist/src/setup/integrations/runner.js +1 -1
  585. package/dist/src/setup/prompter.js +1 -1
  586. package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
  587. package/dist/src/setup/scaffold/create/project.js +40 -3
  588. package/dist/src/setup/scaffold/create/web-template.d.ts +8 -8
  589. package/dist/src/setup/scaffold/create/web-template.js +336 -120
  590. package/dist/src/setup/scaffold/update/channels.js +1 -1
  591. package/dist/src/setup/scaffold/update/connections.js +1 -1
  592. package/dist/src/setup/vercel-project.js +0 -0
  593. package/dist/src/{runtime/actions/types.d.ts → shared/action-types.d.ts} +12 -12
  594. package/dist/src/{runtime/actions/types.js → shared/action-types.js} +1 -1
  595. package/dist/src/shared/agent-definition.d.ts +3 -10
  596. package/dist/src/shared/agent-definition.js +1 -1
  597. package/dist/src/shared/channel-definition.d.ts +5 -1
  598. package/dist/src/{runtime/connections/types.d.ts → shared/connection-types.d.ts} +3 -13
  599. package/dist/src/{runtime/input/types.d.ts → shared/input.d.ts} +1 -1
  600. package/dist/src/shared/input.js +1 -0
  601. package/dist/src/shared/instructions-definition.d.ts +2 -0
  602. package/dist/src/shared/instructions-definition.js +1 -1
  603. package/dist/src/shared/objects.d.ts +5 -0
  604. package/dist/src/shared/objects.js +1 -0
  605. package/dist/src/shared/sandbox-definition.d.ts +1 -1
  606. package/dist/src/shared/skill-definition.d.ts +2 -0
  607. package/dist/src/shared/skill-definition.js +1 -1
  608. package/dist/src/{execution/skills/types.d.ts → shared/skill-types.d.ts} +1 -1
  609. package/dist/src/shared/skill-types.js +1 -0
  610. package/dist/src/{runtime/connections → shared}/validate-authorization.d.ts +1 -1
  611. package/dist/src/shared/vercel-project.d.ts +1 -0
  612. package/dist/src/shared/vercel-project.js +1 -1
  613. package/dist/src/svelte/index.js +1 -1
  614. package/dist/src/svelte/use-eve-agent.d.ts +8 -4
  615. package/dist/src/svelte/use-eve-agent.js +1 -1
  616. package/dist/src/tasks/json.d.ts +4 -89
  617. package/dist/src/tasks/json.js +1 -1
  618. package/dist/src/tasks/session-index.d.ts +1 -1
  619. package/dist/src/tasks/task-id.d.ts +0 -1
  620. package/dist/src/tasks/task-id.js +1 -1
  621. package/dist/src/tasks/types.d.ts +1 -1
  622. package/dist/src/tasks/types.js +1 -1
  623. package/dist/src/{public/tools/approval/approval-helpers.d.ts → tools/approval/policies.d.ts} +1 -1
  624. package/dist/src/tools/approval/policies.js +1 -0
  625. package/dist/src/tools/auth.d.ts +35 -0
  626. package/dist/src/tools/auth.js +1 -0
  627. package/dist/src/{public/definitions/tool.d.ts → tools/definition.d.ts} +42 -138
  628. package/dist/src/tools/definition.js +1 -0
  629. package/dist/src/{shared/durable-dynamic-tool-callbacks.d.ts → tools/durable-callbacks.d.ts} +1 -1
  630. package/dist/src/tools/durable-callbacks.js +1 -0
  631. package/dist/src/tools/dynamic.d.ts +68 -0
  632. package/dist/src/tools/dynamic.js +1 -0
  633. package/dist/src/tools/framework/agent-contract.d.ts +8 -0
  634. package/dist/src/tools/framework/agent-contract.js +1 -0
  635. package/dist/src/tools/framework/agent.d.ts +17 -0
  636. package/dist/src/tools/framework/agent.js +1 -0
  637. package/dist/src/tools/framework/ask-question.d.ts +50 -0
  638. package/dist/src/tools/framework/ask-question.js +1 -0
  639. package/dist/src/tools/framework/connection-search.d.ts +3 -0
  640. package/dist/src/tools/framework/connection-search.js +1 -0
  641. package/dist/src/tools/framework/task-cancel.d.ts +29 -0
  642. package/dist/src/tools/framework/task-cancel.js +1 -0
  643. package/dist/src/tools/framework/task-contract.d.ts +167 -0
  644. package/dist/src/tools/framework/task-contract.js +1 -0
  645. package/dist/src/tools/framework/task-update.d.ts +9 -0
  646. package/dist/src/tools/framework/task-update.js +1 -0
  647. package/dist/src/{public/tools/output-builders.d.ts → tools/model-output.d.ts} +41 -1
  648. package/dist/src/tools/provided/bash.d.ts +29 -0
  649. package/dist/src/tools/provided/bash.js +1 -0
  650. package/dist/src/tools/provided/glob.d.ts +26 -0
  651. package/dist/src/tools/provided/glob.js +2 -0
  652. package/dist/src/{runtime/framework-tools → tools/provided}/grep.d.ts +10 -10
  653. package/dist/src/tools/provided/grep.js +2 -0
  654. package/dist/src/tools/provided/load-skill.d.ts +2 -0
  655. package/dist/src/tools/provided/load-skill.js +1 -0
  656. package/dist/src/tools/provided/read-file.d.ts +27 -0
  657. package/dist/src/tools/provided/read-file.js +2 -0
  658. package/dist/src/{public/tools/sleep/index.d.ts → tools/provided/sleep.d.ts} +3 -3
  659. package/dist/src/tools/provided/sleep.js +1 -0
  660. package/dist/src/tools/provided/todo.d.ts +8 -0
  661. package/dist/src/tools/provided/todo.js +2 -0
  662. package/dist/src/{runtime/framework-tools → tools/provided}/web-fetch.d.ts +5 -2
  663. package/dist/src/tools/provided/web-fetch.js +2 -0
  664. package/dist/src/tools/provided/web-search.d.ts +39 -0
  665. package/dist/src/tools/provided/web-search.js +1 -0
  666. package/dist/src/tools/provided/write-file.d.ts +23 -0
  667. package/dist/src/tools/provided/write-file.js +2 -0
  668. package/dist/src/tools/workflow.d.ts +37 -0
  669. package/dist/src/tools/workflow.js +1 -0
  670. package/dist/src/tracing/agent-action-instrumentation.js +1 -1
  671. package/dist/src/tracing/agent-approval-instrumentation.js +1 -1
  672. package/dist/src/tracing/agent-channel-delivery-instrumentation.js +1 -1
  673. package/dist/src/tracing/agent-otel-provider.js +2 -2
  674. package/dist/src/tracing/agent-otel-session-context.d.ts +1 -1
  675. package/dist/src/tracing/agent-otel-session-context.js +1 -1
  676. package/dist/src/tracing/agent-span-id-generator.d.ts +1 -0
  677. package/dist/src/tracing/agent-span-id-generator.js +1 -1
  678. package/dist/src/tracing/agent-trace-context-store.d.ts +1 -1
  679. package/dist/src/tracing/agent-trace-context-store.js +1 -1
  680. package/dist/src/tracing/agent-trace-span-processor.js +1 -1
  681. package/dist/src/tracing/agent-trace-state.d.ts +2 -6
  682. package/dist/src/tracing/agent-trace-state.js +1 -1
  683. package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
  684. package/dist/src/tracing/local-trace-reader.d.ts +1 -3
  685. package/dist/src/tracing/local-trace-reader.js +1 -1
  686. package/dist/src/tracing/otel-declaration.d.ts +1 -2
  687. package/dist/src/tracing/otel-registration.js +1 -1
  688. package/dist/src/tracing/sampled-trace.d.ts +10 -2
  689. package/dist/src/tracing/sampled-trace.js +1 -1
  690. package/dist/src/vue/index.js +1 -1
  691. package/dist/src/vue/use-eve-agent.d.ts +8 -4
  692. package/dist/src/vue/use-eve-agent.js +1 -1
  693. package/docs/agent-config.md +16 -4
  694. package/docs/channels/chat-sdk.mdx +1 -1
  695. package/docs/channels/discord.mdx +5 -1
  696. package/docs/channels/eve.mdx +19 -3
  697. package/docs/channels/github.mdx +2 -0
  698. package/docs/channels/linear.mdx +1 -1
  699. package/docs/channels/linq.mdx +1 -1
  700. package/docs/channels/overview.mdx +1 -1
  701. package/docs/channels/photon.mdx +4 -4
  702. package/docs/channels/slack.mdx +20 -3
  703. package/docs/channels/teams.mdx +1 -1
  704. package/docs/channels/telegram.mdx +2 -0
  705. package/docs/concepts/built-in-tools.md +31 -21
  706. package/docs/concepts/sessions-runs-and-streaming.md +3 -1
  707. package/docs/connections/overview.mdx +1 -1
  708. package/docs/extensions.md +2 -2
  709. package/docs/getting-started.mdx +10 -9
  710. package/docs/guides/auth-and-route-protection.md +3 -3
  711. package/docs/guides/client/output-schema.mdx +2 -2
  712. package/docs/guides/client/overview.mdx +4 -2
  713. package/docs/guides/dev-tui.md +26 -15
  714. package/docs/guides/frontend/nuxt.mdx +4 -3
  715. package/docs/guides/frontend/overview.mdx +21 -18
  716. package/docs/guides/frontend/sveltekit.mdx +4 -3
  717. package/docs/guides/frontend/use-eve-agent-svelte.mdx +5 -4
  718. package/docs/guides/frontend/use-eve-agent-vue.mdx +5 -4
  719. package/docs/guides/instrumentation.md +1 -0
  720. package/docs/guides/remote-agents.md +37 -18
  721. package/docs/meta.json +1 -1
  722. package/docs/patterns/multi-tenant-approvals.md +1 -1
  723. package/docs/reference/cli.md +2 -4
  724. package/docs/reference/typescript-api.md +35 -31
  725. package/docs/sandbox.mdx +21 -1
  726. package/docs/subagents/index.mdx +11 -28
  727. package/docs/tools/human-in-the-loop.md +43 -2
  728. package/docs/tools/overview.mdx +1 -1
  729. package/package.json +59 -9
  730. package/dist/src/compiler/normalize-extension.d.ts +0 -80
  731. package/dist/src/compiler/normalize-extension.js +0 -1
  732. package/dist/src/execution/sandbox/write-file-tool.js +0 -1
  733. package/dist/src/execution/web-fetch/tool.js +0 -1
  734. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.d.ts +0 -9
  735. package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +0 -1
  736. package/dist/src/internal/nitro/routes/health.d.ts +0 -14
  737. package/dist/src/internal/nitro/routes/health.js +0 -1
  738. package/dist/src/node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js +0 -1
  739. package/dist/src/public/definitions/tool.js +0 -1
  740. package/dist/src/public/tool-result-narrowing.js +0 -1
  741. package/dist/src/public/tools/approval/approval-helpers.js +0 -1
  742. package/dist/src/public/tools/defaults.d.ts +0 -46
  743. package/dist/src/public/tools/defaults.js +0 -1
  744. package/dist/src/public/tools/define-bash-tool.d.ts +0 -21
  745. package/dist/src/public/tools/define-bash-tool.js +0 -1
  746. package/dist/src/public/tools/define-glob-tool.d.ts +0 -22
  747. package/dist/src/public/tools/define-glob-tool.js +0 -1
  748. package/dist/src/public/tools/define-grep-tool.d.ts +0 -22
  749. package/dist/src/public/tools/define-grep-tool.js +0 -1
  750. package/dist/src/public/tools/define-read-file-tool.d.ts +0 -21
  751. package/dist/src/public/tools/define-read-file-tool.js +0 -1
  752. package/dist/src/public/tools/define-write-file-tool.d.ts +0 -22
  753. package/dist/src/public/tools/define-write-file-tool.js +0 -1
  754. package/dist/src/public/tools/internal.d.ts +0 -13
  755. package/dist/src/public/tools/internal.js +0 -1
  756. package/dist/src/public/tools/sleep/index.js +0 -1
  757. package/dist/src/runtime/connections/callback-route.js +0 -1
  758. package/dist/src/runtime/framework-channels/index.d.ts +0 -6
  759. package/dist/src/runtime/framework-channels/index.js +0 -1
  760. package/dist/src/runtime/framework-tools/agent.d.ts +0 -29
  761. package/dist/src/runtime/framework-tools/agent.js +0 -1
  762. package/dist/src/runtime/framework-tools/ask-question.d.ts +0 -35
  763. package/dist/src/runtime/framework-tools/ask-question.js +0 -1
  764. package/dist/src/runtime/framework-tools/bash.d.ts +0 -24
  765. package/dist/src/runtime/framework-tools/bash.js +0 -1
  766. package/dist/src/runtime/framework-tools/connection-search-dynamic.d.ts +0 -19
  767. package/dist/src/runtime/framework-tools/connection-search-dynamic.js +0 -2
  768. package/dist/src/runtime/framework-tools/final-output.js +0 -1
  769. package/dist/src/runtime/framework-tools/glob.d.ts +0 -26
  770. package/dist/src/runtime/framework-tools/glob.js +0 -2
  771. package/dist/src/runtime/framework-tools/grep.js +0 -2
  772. package/dist/src/runtime/framework-tools/index.d.ts +0 -39
  773. package/dist/src/runtime/framework-tools/index.js +0 -1
  774. package/dist/src/runtime/framework-tools/read-file.d.ts +0 -27
  775. package/dist/src/runtime/framework-tools/read-file.js +0 -2
  776. package/dist/src/runtime/framework-tools/skill.d.ts +0 -12
  777. package/dist/src/runtime/framework-tools/skill.js +0 -1
  778. package/dist/src/runtime/framework-tools/subagent/local.js +0 -1
  779. package/dist/src/runtime/framework-tools/subagent/remote.js +0 -1
  780. package/dist/src/runtime/framework-tools/tasks.d.ts +0 -91
  781. package/dist/src/runtime/framework-tools/tasks.js +0 -1
  782. package/dist/src/runtime/framework-tools/web-fetch.js +0 -2
  783. package/dist/src/runtime/framework-tools/web-search.js +0 -1
  784. package/dist/src/runtime/framework-tools/write-file.d.ts +0 -23
  785. package/dist/src/runtime/framework-tools/write-file.js +0 -2
  786. package/dist/src/runtime/governance/auth/jwt-ecdsa.js +0 -1
  787. package/dist/src/runtime/governance/auth/jwt-hmac.js +0 -1
  788. package/dist/src/runtime/governance/auth/oidc.js +0 -1
  789. package/dist/src/runtime/input/types.js +0 -1
  790. package/dist/src/runtime/session-callback-route.d.ts +0 -6
  791. package/dist/src/runtime/session-callback-route.js +0 -1
  792. package/dist/src/runtime/task-input-response-route.d.ts +0 -5
  793. package/dist/src/runtime/task-input-response-route.js +0 -1
  794. package/dist/src/shared/durable-dynamic-tool-callbacks.js +0 -1
  795. package/dist/src/shared/dynamic-tool-definition.d.ts +0 -154
  796. package/dist/src/shared/dynamic-tool-definition.js +0 -1
  797. package/dist/src/shared/eve-server-health.d.ts +0 -5
  798. package/dist/src/shared/eve-server-health.js +0 -1
  799. package/dist/src/shared/tool-definition.d.ts +0 -89
  800. /package/dist/src/{runtime/governance → channel}/auth/http-basic.js +0 -0
  801. /package/dist/src/{runtime/governance → channel}/auth/token-claims.js +0 -0
  802. /package/dist/src/{runtime/governance → channel}/auth/types.js +0 -0
  803. /package/dist/src/{runtime/governance → channel}/auth/vercel-oidc-project.js +0 -0
  804. /package/dist/src/{runtime/governance/network → channel}/ip-allow-list.d.ts +0 -0
  805. /package/dist/src/{runtime/governance/network → channel}/ip-allow-list.js +0 -0
  806. /package/dist/src/{execution/skills/types.js → context/session-context.js} +0 -0
  807. /package/dist/src/execution/sandbox/{bash-tool.js → bash.js} +0 -0
  808. /package/dist/src/{runtime/framework-tools → execution/tools}/file-state.js +0 -0
  809. /package/dist/src/{runtime/framework-tools → execution/tools}/sleep.d.ts +0 -0
  810. /package/dist/src/{runtime/framework-tools → execution/tools}/sleep.js +0 -0
  811. /package/dist/src/execution/web-fetch/{tool.d.ts → execute.d.ts} +0 -0
  812. /package/dist/src/{shared/tool-definition.js → runtime/connections/registry-types.js} +0 -0
  813. /package/dist/src/{runtime/connections/types.js → shared/connection-types.js} +0 -0
  814. /package/dist/src/{runtime/sessions/auth.d.ts → shared/session-auth.d.ts} +0 -0
  815. /package/dist/src/{runtime/sessions/auth.js → shared/session-auth.js} +0 -0
  816. /package/dist/src/{runtime/connections → shared}/validate-authorization.js +0 -0
  817. /package/dist/src/{public/tools/output-builders.js → tools/model-output.js} +0 -0
  818. /package/dist/src/{shared/tool-schema.d.ts → tools/schema.d.ts} +0 -0
  819. /package/dist/src/{shared/tool-schema.js → tools/schema.js} +0 -0
  820. /package/dist/src/{shared/tool-task.d.ts → tools/task.d.ts} +0 -0
  821. /package/dist/src/{shared/tool-task.js → tools/task.js} +0 -0
@@ -1,4 +1,44 @@
1
- import type { ToolModelOutput, ToolModelOutputPart } from "#shared/tool-definition.js";
1
+ /**
2
+ * eve-owned shape for the model-facing tool result produced by
3
+ * `toModelOutput`. Structurally compatible with the AI SDK's
4
+ * `ToolResultOutput` so the harness can forward it without conversion.
5
+ *
6
+ * The `content` variant carries an ordered list of
7
+ * {@link ToolModelOutputPart} entries, letting a tool hand the model
8
+ * text alongside inline files (e.g. a screenshot as vision input).
9
+ */
10
+ export type ToolModelOutput = {
11
+ readonly type: "text";
12
+ readonly value: string;
13
+ } | {
14
+ readonly type: "json";
15
+ readonly value: unknown;
16
+ } | {
17
+ readonly type: "content";
18
+ readonly value: readonly ToolModelOutputPart[];
19
+ };
20
+ /**
21
+ * One part of a `content` {@link ToolModelOutput}. Mirrors the AI SDK's
22
+ * `ToolResultOutput` content parts narrowed to the JSON-safe subset:
23
+ * file data is the SDK's tagged `FileData` union restricted to
24
+ * `{ type: "data" }` with a base64 string, so persisted tool results
25
+ * survive the durable JSON boundary. Use the `toolOutputPart` builders
26
+ * from `eve/tools` to construct parts without hand-writing the nesting.
27
+ */
28
+ export type ToolModelOutputPart = {
29
+ readonly type: "text";
30
+ readonly text: string;
31
+ } | {
32
+ readonly type: "file";
33
+ /** Tagged file data; only JSON-safe base64 payloads are accepted. */
34
+ readonly data: {
35
+ readonly type: "data";
36
+ readonly data: string;
37
+ };
38
+ /** IANA media type, e.g. `image/png`. */
39
+ readonly mediaType: string;
40
+ readonly filename?: string;
41
+ };
2
42
  /**
3
43
  * Builders for the model-facing {@link ToolModelOutput} returned by
4
44
  * `toModelOutput`. Pure sugar over the union — each returns the
@@ -0,0 +1,29 @@
1
+ import { z } from "#compiled/zod/index.js";
2
+ import { type ToolDefinition } from "#tools/definition.js";
3
+ /**
4
+ * Input schema for the provided `bash` tool.
5
+ */
6
+ export declare const BASH_INPUT_SCHEMA: z.ZodObject<{
7
+ command: z.ZodString;
8
+ }, z.core.$strict>;
9
+ /**
10
+ * Output schema for the provided `bash` tool.
11
+ */
12
+ export declare const BASH_OUTPUT_SCHEMA: z.ZodObject<{
13
+ exitCode: z.ZodNumber;
14
+ stderr: z.ZodString;
15
+ stdout: z.ZodString;
16
+ truncated: z.ZodBoolean;
17
+ }, z.core.$strict>;
18
+ export type BashToolInput = z.infer<typeof BASH_INPUT_SCHEMA>;
19
+ export type BashToolOutput = z.infer<typeof BASH_OUTPUT_SCHEMA>;
20
+ /**
21
+ * Framework-owned executors stay statically imported so hosted server bundles
22
+ * can trace and rewrite them into deployable output chunks.
23
+ *
24
+ * These modules are only used by the Nitro-hosted runtime path. Their deeper
25
+ * sandbox dependencies remain lazily loaded inside the execution layer, so the
26
+ * top-level import here does not force those backends to initialize eagerly.
27
+ */
28
+ export declare const bash: ToolDefinition<BashToolInput, BashToolOutput>;
29
+ export default bash;
@@ -0,0 +1 @@
1
+ import{z}from"#compiled/zod/index.js";import{defineTool}from"#tools/definition.js";import{executeBashOnSandbox}from"#execution/sandbox/bash.js";const BASH_INPUT_SCHEMA=z.strictObject({command:z.string().describe(`The shell command to execute.`)}),BASH_OUTPUT_SCHEMA=z.strictObject({exitCode:z.number(),stderr:z.string(),stdout:z.string(),truncated:z.boolean()}),bash=defineTool({description:`Execute a shell command in the shared workspace environment.`,async execute(e,t){return await executeBashOnSandbox(await t.getSandbox(),e)},inputSchema:BASH_INPUT_SCHEMA,outputSchema:BASH_OUTPUT_SCHEMA});export{BASH_INPUT_SCHEMA,BASH_OUTPUT_SCHEMA,bash,bash as default};
@@ -0,0 +1,26 @@
1
+ import { z } from "#compiled/zod/index.js";
2
+ import { type ToolDefinition } from "#tools/definition.js";
3
+ /**
4
+ * Input schema for the provided `glob` tool.
5
+ */
6
+ export declare const GLOB_INPUT_SCHEMA: z.ZodObject<{
7
+ limit: z.ZodOptional<z.ZodNumber>;
8
+ path: z.ZodOptional<z.ZodString>;
9
+ pattern: z.ZodString;
10
+ }, z.core.$strict>;
11
+ /**
12
+ * Output schema for the provided `glob` tool.
13
+ */
14
+ export declare const GLOB_OUTPUT_SCHEMA: z.ZodObject<{
15
+ content: z.ZodString;
16
+ count: z.ZodNumber;
17
+ path: z.ZodString;
18
+ truncated: z.ZodBoolean;
19
+ }, z.core.$strict>;
20
+ export type GlobToolInput = z.infer<typeof GLOB_INPUT_SCHEMA>;
21
+ export type GlobToolOutput = z.infer<typeof GLOB_OUTPUT_SCHEMA>;
22
+ /**
23
+ * Framework-owned executor that delegates to the default sandbox.
24
+ */
25
+ export declare const glob: ToolDefinition<GlobToolInput, GlobToolOutput>;
26
+ export default glob;
@@ -0,0 +1,2 @@
1
+ import{z}from"#compiled/zod/index.js";import{defineTool}from"#tools/definition.js";import{executeGlobOnSandbox}from"#execution/sandbox/glob-tool.js";const GLOB_INPUT_SCHEMA=z.strictObject({limit:z.number().int().min(1).max(1e3).describe(`Maximum number of results to return. Defaults to 100.`).optional(),path:z.string().describe(`The directory to search in. Defaults to /workspace. Must be an absolute path or begin with $HOME/. Omit to use the default.`).optional(),pattern:z.string().describe(`The glob pattern to match files against (e.g. "**/*.ts", "src/**/*.js").`)}),GLOB_OUTPUT_SCHEMA=z.strictObject({content:z.string(),count:z.number().int(),path:z.string(),truncated:z.boolean()}),glob=defineTool({description:[`Fast file pattern matching tool that works with any codebase size.`,``,`Usage:`,`- Supports glob patterns like "**/*.js" or "src/**/*.ts".`,`- Returns matching file paths.`,`- Call this tool in parallel when you know there are multiple patterns to search for.`].join(`
2
+ `),async execute(e,t){return await executeGlobOnSandbox(await t.getSandbox(),e)},inputSchema:GLOB_INPUT_SCHEMA,outputSchema:GLOB_OUTPUT_SCHEMA});export{GLOB_INPUT_SCHEMA,GLOB_OUTPUT_SCHEMA,glob as default,glob};
@@ -1,12 +1,7 @@
1
1
  import { z } from "#compiled/zod/index.js";
2
- import type { ResolvedToolDefinition } from "#runtime/types.js";
2
+ import { type ToolDefinition } from "#tools/definition.js";
3
3
  /**
4
- * Shared input schema used by the framework `grep` tool and any author tool
5
- * constructed via {@link defineGrepTool}.
6
- *
7
- * Exported so the public `defineGrepTool` factory and the framework
8
- * `GREP_TOOL_DEFINITION` use the exact same schema object — keeping model
9
- * input contracts in sync without duplication.
4
+ * Input schema for the provided `grep` tool.
10
5
  */
11
6
  export declare const GREP_INPUT_SCHEMA: z.ZodObject<{
12
7
  context: z.ZodOptional<z.ZodNumber>;
@@ -18,8 +13,7 @@ export declare const GREP_INPUT_SCHEMA: z.ZodObject<{
18
13
  pattern: z.ZodString;
19
14
  }, z.core.$strict>;
20
15
  /**
21
- * Shared output schema used by the framework `grep` tool and any author tool
22
- * constructed via {@link defineGrepTool}.
16
+ * Output schema for the provided `grep` tool.
23
17
  */
24
18
  export declare const GREP_OUTPUT_SCHEMA: z.ZodObject<{
25
19
  content: z.ZodString;
@@ -27,4 +21,10 @@ export declare const GREP_OUTPUT_SCHEMA: z.ZodObject<{
27
21
  path: z.ZodString;
28
22
  truncated: z.ZodBoolean;
29
23
  }, z.core.$strict>;
30
- export declare const GREP_TOOL_DEFINITION: ResolvedToolDefinition;
24
+ export type GrepToolInput = z.infer<typeof GREP_INPUT_SCHEMA>;
25
+ export type GrepToolOutput = z.infer<typeof GREP_OUTPUT_SCHEMA>;
26
+ /**
27
+ * Framework-owned executor that delegates to the default sandbox.
28
+ */
29
+ export declare const grep: ToolDefinition<GrepToolInput, GrepToolOutput>;
30
+ export default grep;
@@ -0,0 +1,2 @@
1
+ import{z}from"#compiled/zod/index.js";import{defineTool}from"#tools/definition.js";import{executeGrepOnSandbox}from"#execution/sandbox/grep-tool.js";const GREP_INPUT_SCHEMA=z.strictObject({context:z.number().int().min(0).describe(`Number of surrounding context lines to include before and after each match. Defaults to 0.`).optional(),glob:z.string().describe(`Filter files by glob pattern (e.g. "*.ts", "*.{ts,tsx}").`).optional(),ignoreCase:z.boolean().describe(`Perform case-insensitive search. Defaults to false.`).optional(),limit:z.number().int().min(1).max(1e3).describe(`Maximum number of matches to return per file. Defaults to 100.`).optional(),literal:z.boolean().describe(`Treat the pattern as a literal string instead of a regular expression. Defaults to false.`).optional(),path:z.string().describe(`The directory or file to search in. Defaults to /workspace. Must be an absolute path or begin with $HOME/. Omit to use the default.`).optional(),pattern:z.string().describe(`The regex pattern to search for in file contents (e.g. "log.*Error", "function\\s+\\w+").`)}),GREP_OUTPUT_SCHEMA=z.strictObject({content:z.string(),matchCount:z.number().int(),path:z.string(),truncated:z.boolean()}),grep=defineTool({description:[`Fast content search tool that works with any codebase size.`,``,`Usage:`,`- Searches file contents using regular expressions.`,`- Supports full regex syntax (e.g. "log.*Error", "function\\s+\\w+").`,`- Filter files by pattern with the glob parameter (e.g. "*.js", "*.{ts,tsx}").`,`- Returns matching lines with file paths and line numbers.`,`- Call this tool in parallel when you have multiple independent searches.`,`- Any line longer than 2000 characters is truncated.`].join(`
2
+ `),async execute(e,t){return await executeGrepOnSandbox(await t.getSandbox(),e)},inputSchema:GREP_INPUT_SCHEMA,outputSchema:GREP_OUTPUT_SCHEMA});export{GREP_INPUT_SCHEMA,GREP_OUTPUT_SCHEMA,grep as default,grep};
@@ -0,0 +1,2 @@
1
+ export declare const loadSkill: import("#tools/definition.js").ToolDefinition<unknown, unknown>;
2
+ export default loadSkill;
@@ -0,0 +1 @@
1
+ import{defineTool}from"#tools/definition.js";import{SKILL_INPUT_SCHEMA,SKILL_OUTPUT_SCHEMA,executeLoadSkill}from"#execution/tools/load-skill.js";const loadSkill=defineTool({description:[`Load the full instructions for one available skill by name or id.`,`Use this tool when the request clearly matches a listed skill description or when the user explicitly asks for that skill.`,`Loading adds the skill instructions to the current turn.`,`Choose the "skill" value from the Available skills block.`].join(` `),execute:executeLoadSkill,inputSchema:SKILL_INPUT_SCHEMA,outputSchema:SKILL_OUTPUT_SCHEMA});export{loadSkill as default,loadSkill};
@@ -0,0 +1,27 @@
1
+ import { z } from "#compiled/zod/index.js";
2
+ import { type ToolDefinition } from "#tools/definition.js";
3
+ /**
4
+ * Input schema for the provided `read_file` tool.
5
+ */
6
+ export declare const READ_FILE_INPUT_SCHEMA: z.ZodObject<{
7
+ filePath: z.ZodString;
8
+ limit: z.ZodOptional<z.ZodNumber>;
9
+ offset: z.ZodOptional<z.ZodNumber>;
10
+ }, z.core.$strict>;
11
+ /**
12
+ * Output schema for the provided `read_file` tool.
13
+ */
14
+ export declare const READ_FILE_OUTPUT_SCHEMA: z.ZodObject<{
15
+ content: z.ZodString;
16
+ nextOffset: z.ZodOptional<z.ZodNumber>;
17
+ path: z.ZodString;
18
+ totalLines: z.ZodNumber;
19
+ truncated: z.ZodBoolean;
20
+ }, z.core.$strict>;
21
+ export type ReadFileToolInput = z.infer<typeof READ_FILE_INPUT_SCHEMA>;
22
+ export type ReadFileToolOutput = z.infer<typeof READ_FILE_OUTPUT_SCHEMA>;
23
+ /**
24
+ * Framework-owned executor that delegates to the default sandbox.
25
+ */
26
+ export declare const readFile: ToolDefinition<ReadFileToolInput, ReadFileToolOutput>;
27
+ export default readFile;
@@ -0,0 +1,2 @@
1
+ import{z}from"#compiled/zod/index.js";import{defineTool}from"#tools/definition.js";import{executeReadFileOnSandbox}from"#execution/sandbox/read-file.js";const READ_FILE_INPUT_SCHEMA=z.strictObject({filePath:z.string().describe(`The absolute path to the file to read. A leading $HOME is supported.`),limit:z.number().int().min(1).describe(`Maximum number of lines to return. Defaults to 2000.`).optional(),offset:z.number().int().min(1).describe(`1-based line number to start from. Defaults to 1.`).optional()}),READ_FILE_OUTPUT_SCHEMA=z.strictObject({content:z.string(),nextOffset:z.number().int().min(1).optional(),path:z.string(),totalLines:z.number().int().min(0),truncated:z.boolean()}),readFile=defineTool({description:[`Read a file from the local filesystem. If the path does not exist, an error is returned.`,``,`Usage:`,`- The filePath parameter should be an absolute path or begin with $HOME/.`,`- By default, this tool returns up to 2000 lines from the start of the file.`,`- The offset parameter is the line number to start from (1-indexed).`,`- To read later sections, call this tool again with a larger offset.`,'- Contents are returned with each line prefixed by its line number as `<line>: <content>`. For example, if a file has contents "foo\\n", you will receive "1: foo\\n".',`- Any line longer than 2000 characters is truncated.`,`- Call this tool in parallel when you know there are multiple files you want to read.`,`- Avoid tiny repeated slices (30 line chunks). If you need more context, read a larger window.`].join(`
2
+ `),async execute(e,t){return await executeReadFileOnSandbox(await t.getSandbox(),e)},inputSchema:READ_FILE_INPUT_SCHEMA,outputSchema:READ_FILE_OUTPUT_SCHEMA});export{READ_FILE_INPUT_SCHEMA,READ_FILE_OUTPUT_SCHEMA,readFile as default,readFile};
@@ -1,8 +1,8 @@
1
- import { type ToolDefinition } from "#public/definitions/tool.js";
2
- import { type SleepToolInput, type SleepToolOutput } from "#runtime/framework-tools/sleep.js";
1
+ import { type ToolDefinition } from "#tools/definition.js";
2
+ import { type SleepToolInput, type SleepToolOutput } from "#execution/tools/sleep.js";
3
3
  export type { SleepToolInput, SleepToolOutput };
4
4
  /**
5
- * Defines eve's opt-in durable `sleep` tool.
5
+ * Defines the opt-in durable `sleep` tool.
6
6
  *
7
7
  * Export it from `agent/tools/sleep.ts`:
8
8
  *
@@ -0,0 +1 @@
1
+ import{defineTool}from"#tools/definition.js";import{SLEEP_INPUT_SCHEMA,SLEEP_OUTPUT_SCHEMA,SLEEP_TOOL_DESCRIPTION,executeSleepTool}from"#execution/tools/sleep.js";function sleep(){return defineTool({description:SLEEP_TOOL_DESCRIPTION,execute:executeSleepTool,inputSchema:SLEEP_INPUT_SCHEMA,outputSchema:SLEEP_OUTPUT_SCHEMA})}export{sleep};
@@ -0,0 +1,8 @@
1
+ export declare const todo: import("#tools/definition.js").ToolDefinition<{
2
+ todos?: {
3
+ content: string;
4
+ priority: "high" | "low" | "medium";
5
+ status: "cancelled" | "completed" | "in_progress" | "pending";
6
+ }[] | undefined;
7
+ }, unknown>;
8
+ export default todo;
@@ -0,0 +1,2 @@
1
+ import{defineTool}from"#tools/definition.js";import{TODO_INPUT_SCHEMA,TODO_OUTPUT_SCHEMA,executeTodoTool}from"#execution/tools/todo.js";const todo=defineTool({description:[`Use this tool to create and manage a structured task list for the current session.`,`This helps you track progress, organize complex tasks, and demonstrate thoroughness.`,``,`When to use:`,`- Complex multistep tasks requiring 3 or more distinct steps`,`- When the user provides multiple tasks or a numbered list`,`- After receiving new instructions, to capture requirements`,`- After completing a task, to mark it complete and add follow-ups`,``,`When NOT to use:`,`- Single, straightforward tasks that need no tracking`,`- Purely conversational or informational requests`,``,`Usage:`,"- Call with `todos` to replace the entire list (full replacement write)","- Call without `todos` to read the current list",`- Both return the full current list with status counts`,`- Mark tasks in_progress when you start, completed when done`,`- Only have ONE task in_progress at a time`].join(`
2
+ `),execute:async e=>executeTodoTool(e??{}),inputSchema:TODO_INPUT_SCHEMA,outputSchema:TODO_OUTPUT_SCHEMA});export{todo as default,todo};
@@ -1,5 +1,5 @@
1
1
  import { z } from "#compiled/zod/index.js";
2
- import type { ResolvedToolDefinition } from "#runtime/types.js";
2
+ import { type ToolDefinition } from "#tools/definition.js";
3
3
  export declare const WEB_FETCH_INPUT_SCHEMA: z.ZodObject<{
4
4
  format: z.ZodOptional<z.ZodEnum<{
5
5
  html: "html";
@@ -15,4 +15,7 @@ export declare const WEB_FETCH_OUTPUT_SCHEMA: z.ZodObject<{
15
15
  truncated: z.ZodBoolean;
16
16
  url: z.ZodString;
17
17
  }, z.core.$strict>;
18
- export declare const WEB_FETCH_TOOL_DEFINITION: ResolvedToolDefinition;
18
+ export type WebFetchToolInput = z.infer<typeof WEB_FETCH_INPUT_SCHEMA>;
19
+ export type WebFetchToolOutput = z.infer<typeof WEB_FETCH_OUTPUT_SCHEMA>;
20
+ export declare const webFetch: ToolDefinition<WebFetchToolInput, WebFetchToolOutput>;
21
+ export default webFetch;
@@ -0,0 +1,2 @@
1
+ import{z}from"#compiled/zod/index.js";import{defineTool}from"#tools/definition.js";import{executeWebFetchTool}from"#execution/web-fetch/execute.js";const WEB_FETCH_INPUT_SCHEMA=z.strictObject({format:z.enum([`markdown`,`text`,`html`]).describe(`The format to return the content in (text, markdown, or html). HTML responses are automatically converted to the requested format. Defaults to "markdown".`).optional(),timeout:z.number().describe(`Optional timeout in seconds. Defaults to 30, max 120.`).optional(),url:z.string().describe(`The fully-formed URL to fetch content from. Must start with https://.`)}),WEB_FETCH_OUTPUT_SCHEMA=z.strictObject({content:z.string(),contentType:z.string(),truncated:z.boolean(),url:z.string()}),webFetch=defineTool({description:[`Fetch a webpage and return its content in the requested format. Use this to retrieve and analyze content from URLs.`,``,`Usage notes:`,`- The URL must be a fully-formed valid URL starting with https://`,`- HTML responses are automatically converted to markdown or plain text based on the requested format`,`- Format options: "markdown" (default), "text", or "html"`,`- Default timeout is 30 seconds (max 120 seconds)`,`- Maximum response size is 5 MB; content is further capped at the shared tool-output budget (50 KB / 2000 lines)`,`- This tool is read-only and does not modify any files`].join(`
2
+ `),async execute(e,t){return await executeWebFetchTool(e,{abortSignal:t.abortSignal})},inputSchema:WEB_FETCH_INPUT_SCHEMA,outputSchema:WEB_FETCH_OUTPUT_SCHEMA});export{WEB_FETCH_INPUT_SCHEMA,WEB_FETCH_OUTPUT_SCHEMA,webFetch as default,webFetch};
@@ -0,0 +1,39 @@
1
+ import type { WebSearchProvider } from "#shared/web-search.js";
2
+ export type { WebSearchProvider };
3
+ declare const WEB_SEARCH_TOOL_KIND = "eve:web-search-tool";
4
+ /** Configuration accepted by {@link webSearch}. */
5
+ export interface WebSearchToolInput {
6
+ /** Provider to use when the agent model is routed through AI Gateway. */
7
+ readonly provider: WebSearchProvider;
8
+ }
9
+ /**
10
+ * Provider-managed web search configuration.
11
+ *
12
+ * Export this from `agent/tools/web_search.ts` to select the AI Gateway
13
+ * search provider for that agent. Direct provider models continue to use
14
+ * their native web search implementation.
15
+ */
16
+ export interface WebSearchToolDefinition {
17
+ readonly kind: typeof WEB_SEARCH_TOOL_KIND;
18
+ readonly provider: WebSearchProvider;
19
+ }
20
+ /**
21
+ * Configures the framework-provided `web_search` tool.
22
+ *
23
+ * When no configuration file is present, eve uses Exa for AI Gateway
24
+ * models.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * // agent/tools/web_search.ts
29
+ * import { webSearch } from "eve/tools/web_search";
30
+ *
31
+ * export default webSearch({ provider: "parallel" });
32
+ * ```
33
+ */
34
+ export declare function webSearch(input: WebSearchToolInput): WebSearchToolDefinition;
35
+ /** Default provider-managed web search configuration. */
36
+ export declare const defaultWebSearch: WebSearchToolDefinition;
37
+ export default defaultWebSearch;
38
+ /** Returns whether a value is a provider-managed web search definition. */
39
+ export declare function isWebSearchToolDefinition(value: unknown): value is WebSearchToolDefinition;
@@ -0,0 +1 @@
1
+ const WEB_SEARCH_TOOL_KIND=`eve:web-search-tool`;function webSearch(e){return{kind:WEB_SEARCH_TOOL_KIND,provider:e.provider}}const defaultWebSearch=webSearch({provider:`exa`});function isWebSearchToolDefinition(e){return typeof e==`object`&&!!e&&e.kind===WEB_SEARCH_TOOL_KIND}export{defaultWebSearch as default,defaultWebSearch,isWebSearchToolDefinition,webSearch};
@@ -0,0 +1,23 @@
1
+ import { z } from "#compiled/zod/index.js";
2
+ import { type ToolDefinition } from "#tools/definition.js";
3
+ /**
4
+ * Input schema for the provided `write_file` tool.
5
+ */
6
+ export declare const WRITE_FILE_INPUT_SCHEMA: z.ZodObject<{
7
+ content: z.ZodString;
8
+ filePath: z.ZodString;
9
+ }, z.core.$strict>;
10
+ /**
11
+ * Output schema for the provided `write_file` tool.
12
+ */
13
+ export declare const WRITE_FILE_OUTPUT_SCHEMA: z.ZodObject<{
14
+ existed: z.ZodBoolean;
15
+ path: z.ZodString;
16
+ }, z.core.$strict>;
17
+ export type WriteFileToolInput = z.infer<typeof WRITE_FILE_INPUT_SCHEMA>;
18
+ export type WriteFileToolOutput = z.infer<typeof WRITE_FILE_OUTPUT_SCHEMA>;
19
+ /**
20
+ * Framework-owned executor that delegates to the default sandbox.
21
+ */
22
+ export declare const writeFile: ToolDefinition<WriteFileToolInput, WriteFileToolOutput>;
23
+ export default writeFile;
@@ -0,0 +1,2 @@
1
+ import{z}from"#compiled/zod/index.js";import{defineTool}from"#tools/definition.js";import{executeWriteFileOnSandbox}from"#execution/sandbox/write-file.js";const WRITE_FILE_INPUT_SCHEMA=z.strictObject({content:z.string().describe(`Complete replacement file contents.`),filePath:z.string().describe(`The absolute path to the file to write. A leading $HOME is supported.`)}),WRITE_FILE_OUTPUT_SCHEMA=z.strictObject({existed:z.boolean(),path:z.string()}),writeFile=defineTool({description:[`Writes a file to the local filesystem.`,``,`Usage:`,`- This tool will overwrite the existing file if there is one at the provided path.`,`- If this is an existing file, you MUST use the read_file tool first to read the file's contents. This tool will fail if you did not read the file first.`,`- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.`,`- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.`,`- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.`].join(`
2
+ `),async execute(e,t){return await executeWriteFileOnSandbox(await t.getSandbox(),e)},inputSchema:WRITE_FILE_INPUT_SCHEMA,outputSchema:WRITE_FILE_OUTPUT_SCHEMA});export{WRITE_FILE_INPUT_SCHEMA,WRITE_FILE_OUTPUT_SCHEMA,writeFile as default,writeFile};
@@ -0,0 +1,37 @@
1
+ declare const EXPERIMENTAL_WORKFLOW_TOOL_KIND = "eve:enable-workflow-tool";
2
+ /** Configuration accepted by {@link experimental_workflow}. */
3
+ export interface ExperimentalWorkflowToolInput {
4
+ /**
5
+ * Maximum number of subagent or remote-agent calls one `Workflow` program
6
+ * may dispatch, counted across sequential and parallel calls alike.
7
+ *
8
+ * Calls beyond the limit fail with a `WORKFLOW_SUBAGENT_LIMIT_REACHED`
9
+ * result instead of starting a child session.
10
+ *
11
+ * @default 100
12
+ */
13
+ readonly maxSubagents?: number;
14
+ }
15
+ /** Framework `Workflow` tool definition returned by {@link experimental_workflow}. */
16
+ export interface ExperimentalWorkflowToolDefinition extends ExperimentalWorkflowToolInput {
17
+ readonly kind: typeof EXPERIMENTAL_WORKFLOW_TOOL_KIND;
18
+ }
19
+ /**
20
+ * Enables and configures the experimental framework `Workflow` tool, an
21
+ * isolated JavaScript sandbox whose only callable operations are this agent's
22
+ * subagents and remote agents. Export the result from
23
+ * `agent/tools/workflow.ts`:
24
+ *
25
+ * ```ts
26
+ * import { experimental_workflow } from "eve/tools";
27
+ *
28
+ * export default experimental_workflow({ maxSubagents: 25 });
29
+ * ```
30
+ *
31
+ * Only the root session sees the tool. The resulting model-facing tool is
32
+ * still called `Workflow`.
33
+ */
34
+ export declare function experimental_workflow(input?: ExperimentalWorkflowToolInput): ExperimentalWorkflowToolDefinition;
35
+ /** Type guard for a definition returned by {@link experimental_workflow}. */
36
+ export declare function isExperimentalWorkflowToolDefinition(value: unknown): value is ExperimentalWorkflowToolDefinition;
37
+ export {};
@@ -0,0 +1 @@
1
+ const EXPERIMENTAL_WORKFLOW_TOOL_KIND=`eve:enable-workflow-tool`;function experimental_workflow(e={}){let t={kind:EXPERIMENTAL_WORKFLOW_TOOL_KIND};return e.maxSubagents!==void 0&&(t.maxSubagents=e.maxSubagents),t}function isExperimentalWorkflowToolDefinition(e){return typeof e==`object`&&!!e&&e.kind===EXPERIMENTAL_WORKFLOW_TOOL_KIND}export{experimental_workflow,isExperimentalWorkflowToolDefinition};
@@ -1 +1 @@
1
- import{normalizeChannelAudience}from"#shared/channel-audience.js";import{ROOT_CONTEXT,SpanStatusCode,trace}from"#compiled/@opentelemetry/api/index.js";import{actionIdempotencyKey,attemptIdempotencyKey}from"#harness/instrumentation/lifecycle.js";import{contentAttribute}from"#tracing/agent-otel-content.js";import{setAgentUsage}from"#tracing/agent-otel-usage.js";import{isSampledTrace}from"#tracing/sampled-trace.js";import{withChannelAudience}from"#tracing/channel-audience-context.js";function createAgentActionInstrumentation(t){let n=new Map,onStarted=async r=>{let i=await t.resolveTraceContext(r);if(i===void 0||!isSampledTrace(i))return;let s=await t.stateStore.getAction(r.idempotencyKey)??{attemptIndex:r.scope.attemptIndex,callId:r.callId,channelAudience:normalizeChannelAudience(r.scope.channelAudience),inputAttribute:t.recordInputs?contentAttribute(r.input,!1):void 0,kind:r.kind,name:r.name,parent:{spanId:t.idGenerator.deriveSpanId(attemptIdempotencyKey(r.scope)),traceFlags:i.traceFlags,traceId:i.traceId},rootSessionId:r.scope.rootSessionId??r.scope.sessionId,sessionId:r.scope.sessionId,spanId:t.idGenerator.deriveSpanId(`action:${r.idempotencyKey}`),startTimeMs:Date.now(),stepIndex:r.scope.stepIndex,turnId:r.scope.turnId};await t.stateStore.setAction(r.idempotencyKey,s);let c=n.get(r.scope.attemptId)??new Set;c.add(r.idempotencyKey),n.set(r.scope.attemptId,c)},onTerminal=async e=>{let n=await t.stateStore.getAction(e.idempotencyKey);if(n!==void 0)try{let r=startSpan(n);if(r.setAttribute(`agent.action.outcome`,e.outcome),e.type===`action.failed`)e.errorCode!==void 0&&(r.setAttribute(`agent.action.error.code`,e.errorCode),r.setAttribute(`error.type`,e.errorCode)),recordError(r,e.error);else if(e.output.type===`error`)recordError(r,e.output.error);else if(e.usage!==void 0&&setAgentUsage(r,e.usage),t.recordOutputs){let t=contentAttribute(e.output.output,!1);t!==void 0&&r.setAttribute(`gen_ai.tool.call.result`,t)}r.end(e.acceptedAtMs)}finally{await t.stateStore.deleteAction(e.idempotencyKey),forget(e.idempotencyKey)}},startSpan=e=>{let n=t.idGenerator.withSpanId(e.spanId,()=>t.tracer.startSpan(`agent.action`,{attributes:{"agent.action.call_id":e.callId,"agent.action.kind":e.kind,"agent.action.name":e.name,"agent.framework.name":`eve`,"agent.framework.version":t.frameworkVersion,"agent.root.session.id":e.rootSessionId,"agent.session.id":e.sessionId,"agent.step.attempt":e.attemptIndex,"agent.step.index":e.stepIndex,"agent.turn.id":e.turnId},startTime:e.startTimeMs},contextFromActionState(e)));return e.inputAttribute!==void 0&&n.setAttribute(`gen_ai.tool.call.arguments`,e.inputAttribute),n};return{async contextFor(e,n,r){let a=actionIdempotencyKey(e,n,r),o=await t.stateStore.getAction(a);if(o!==void 0)return actionContext(o);let s=await t.stateStore.findAction(e,r);return s===void 0?void 0:actionContext(s)},deleteForSession:e=>t.stateStore.deleteActions(e),deleteForTurn:(e,n)=>t.stateStore.deleteActions(e,n),async failForAttempt(e,r){let i=n.get(e.attemptId);if(i!==void 0){n.delete(e.attemptId);for(let e of i){let n=await t.stateStore.getAction(e);if(n===void 0)continue;let i=startSpan(n);recordError(i,r),i.end(),await t.stateStore.deleteAction(e)}}},events:{"action.completed":onTerminal,"action.failed":onTerminal,"action.started":onStarted}};function forget(e){for(let[t,r]of n)r.delete(e),r.size===0&&n.delete(t)}}function actionContext(e){let n={isRemote:!1,spanId:e.spanId,traceFlags:e.parent.traceFlags,traceId:e.parent.traceId};return{context:withChannelAudience(trace.setSpan(ROOT_CONTEXT,trace.wrapSpanContext(n)),e.channelAudience),spanContext:n}}function contextFromActionState(e){return withChannelAudience(trace.setSpan(ROOT_CONTEXT,trace.wrapSpanContext({...e.parent,isRemote:!1})),e.channelAudience)}function recordError(e,t){t instanceof Error?(e.recordException(t),e.setStatus({code:SpanStatusCode.ERROR,message:t.message})):e.setStatus({code:SpanStatusCode.ERROR})}export{createAgentActionInstrumentation};
1
+ import{normalizeChannelAudience}from"#shared/channel-audience.js";import{isSampledTrace}from"#tracing/sampled-trace.js";import{ROOT_CONTEXT,SpanStatusCode,trace}from"#compiled/@opentelemetry/api/index.js";import{actionIdempotencyKey,attemptIdempotencyKey}from"#harness/instrumentation/lifecycle.js";import{contentAttribute}from"#tracing/agent-otel-content.js";import{setAgentUsage}from"#tracing/agent-otel-usage.js";import{withChannelAudience}from"#tracing/channel-audience-context.js";function createAgentActionInstrumentation(n){let r=new Map,onStarted=async i=>{let a=await n.resolveTraceContext(i);if(a===void 0||!isSampledTrace(a))return;let c=await n.stateStore.getAction(i.idempotencyKey)??{attemptIndex:i.scope.attemptIndex,callId:i.callId,channelAudience:normalizeChannelAudience(i.scope.channelAudience),inputAttribute:n.recordInputs?contentAttribute(i.input,!1):void 0,kind:i.kind,name:i.name,parent:{spanId:n.idGenerator.deriveSpanId(attemptIdempotencyKey(i.scope)),traceFlags:a.traceFlags,traceId:a.traceId},rootSessionId:i.scope.rootSessionId??i.scope.sessionId,sessionId:i.scope.sessionId,spanId:n.idGenerator.deriveSpanId(`action:${i.idempotencyKey}`),startTimeMs:Date.now(),stepIndex:i.scope.stepIndex,turnId:i.scope.turnId};await n.stateStore.setAction(i.idempotencyKey,c);let l=r.get(i.scope.attemptId)??new Set;l.add(i.idempotencyKey),r.set(i.scope.attemptId,l)},onTerminal=async e=>{let t=await n.stateStore.getAction(e.idempotencyKey);if(t!==void 0)try{let r=startSpan(t);if(r.setAttribute(`agent.action.outcome`,e.outcome),e.type===`action.failed`)e.errorCode!==void 0&&(r.setAttribute(`agent.action.error.code`,e.errorCode),r.setAttribute(`error.type`,e.errorCode)),recordError(r,e.error);else if(e.output.type===`error`)recordError(r,e.output.error);else if(e.usage!==void 0&&setAgentUsage(r,e.usage),n.recordOutputs){let t=contentAttribute(e.output.output,!1);t!==void 0&&r.setAttribute(`gen_ai.tool.call.result`,t)}r.end(e.acceptedAtMs)}finally{await n.stateStore.deleteAction(e.idempotencyKey),forget(e.idempotencyKey)}},startSpan=e=>{let t=n.idGenerator.withSpanId(e.spanId,()=>n.tracer.startSpan(`agent.action`,{attributes:{"agent.action.call_id":e.callId,"agent.action.kind":e.kind,"agent.action.name":e.name,"agent.framework.name":`eve`,"agent.framework.version":n.frameworkVersion,"agent.session.id":e.sessionId,"agent.step.attempt":e.attemptIndex,"agent.step.index":e.stepIndex,"agent.turn.id":e.turnId},startTime:e.startTimeMs},contextFromActionState(e)));return e.inputAttribute!==void 0&&t.setAttribute(`gen_ai.tool.call.arguments`,e.inputAttribute),t};return{async contextFor(e,t,r){let i=actionIdempotencyKey(e,t,r),o=await n.stateStore.getAction(i);if(o!==void 0)return actionContext(o);let s=await n.stateStore.findAction(e,r);return s===void 0?void 0:actionContext(s)},deleteForSession:e=>n.stateStore.deleteActions(e),deleteForTurn:(e,t)=>n.stateStore.deleteActions(e,t),async failForAttempt(e,t){let i=r.get(e.attemptId);if(i!==void 0){r.delete(e.attemptId);for(let e of i){let r=await n.stateStore.getAction(e);if(r===void 0)continue;let i=startSpan(r);recordError(i,t),i.end(),await n.stateStore.deleteAction(e)}}},events:{"action.completed":onTerminal,"action.failed":onTerminal,"action.started":onStarted}};function forget(e){for(let[t,n]of r)n.delete(e),n.size===0&&r.delete(t)}}function actionContext(e){let t={isRemote:!1,spanId:e.spanId,traceFlags:e.parent.traceFlags,traceId:e.parent.traceId};return{context:withChannelAudience(trace.setSpan(ROOT_CONTEXT,trace.wrapSpanContext(t)),e.channelAudience),spanContext:t}}function contextFromActionState(e){return withChannelAudience(trace.setSpan(ROOT_CONTEXT,trace.wrapSpanContext({...e.parent,isRemote:!1})),e.channelAudience)}function recordError(e,t){t instanceof Error?(e.recordException(t),e.setStatus({code:SpanStatusCode.ERROR,message:t.message})):e.setStatus({code:SpanStatusCode.ERROR})}export{createAgentActionInstrumentation};
@@ -1 +1 @@
1
- import{normalizeChannelAudience}from"#shared/channel-audience.js";import{ROOT_CONTEXT,SpanStatusCode,trace}from"#compiled/@opentelemetry/api/index.js";import{contentAttribute}from"#tracing/agent-otel-content.js";function createAgentApprovalInstrumentation(n){return{"input.requested":async(t,r)=>{if(t.kind!==`tool-approval`||readState(r.state.get())!==void 0)return;let a=await n.actionContextFor(t.scope.sessionId,t.scope.turnId,t.action.callId);if(a===void 0)return;let o={actionCallId:t.action.callId,actionName:t.action.name,attemptIndex:t.scope.attemptIndex,channelAudience:normalizeChannelAudience(t.scope.channelAudience),parent:{spanId:a.spanContext.spanId,traceFlags:a.spanContext.traceFlags,traceId:a.spanContext.traceId},requestId:t.requestId,rootSessionId:t.scope.rootSessionId??t.scope.sessionId,sessionId:t.scope.sessionId,startTimeMs:Date.now(),stepIndex:t.scope.stepIndex,turnId:t.scope.turnId},s=n.recordInputs?contentAttribute(t.request,!1):void 0;s!==void 0&&(o.requestAttribute=s),r.state.set(o)},"input.resolved":(e,a)=>{let o=readState(a.state.get());if(o===void 0)return;let s=n.idGenerator.withSpanId(n.idGenerator.deriveSpanId(`approval:${e.idempotencyKey}`),()=>n.tracer.startSpan(`agent.approval`,{attributes:{"agent.action.call_id":o.actionCallId,"agent.action.name":o.actionName,"agent.approval.kind":`tool-approval`,"agent.approval.outcome":e.outcome,"agent.approval.request_id":o.requestId,"agent.framework.name":`eve`,"agent.framework.version":n.frameworkVersion,"agent.root.session.id":o.rootSessionId,"agent.session.id":o.sessionId,"agent.step.attempt":o.attemptIndex,"agent.step.index":o.stepIndex,"agent.turn.id":o.turnId},startTime:o.startTimeMs},trace.setSpan(ROOT_CONTEXT,trace.wrapSpanContext({...o.parent,isRemote:!1}))));if(o.requestAttribute!==void 0&&s.setAttribute(`agent.approval.request`,o.requestAttribute),n.recordOutputs&&e.response!==void 0){let t=contentAttribute(e.response,!1);t!==void 0&&s.setAttribute(`agent.approval.response`,t)}e.outcome===`failed`&&recordError(s,e.error),s.end()}}}function readState(t){if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t,r=n.parent;if(typeof r!=`object`||!r||Array.isArray(r))return;let i=r;if(typeof n.actionCallId!=`string`||typeof n.actionName!=`string`||typeof n.attemptIndex!=`number`||typeof i.spanId!=`string`||typeof i.traceFlags!=`number`||typeof i.traceId!=`string`||typeof n.requestId!=`string`||typeof n.rootSessionId!=`string`||typeof n.sessionId!=`string`||typeof n.startTimeMs!=`number`||typeof n.stepIndex!=`number`||typeof n.turnId!=`string`)return;let a=n.requestAttribute;if(!(a!==void 0&&typeof a!=`string`))return{actionCallId:n.actionCallId,actionName:n.actionName,attemptIndex:n.attemptIndex,channelAudience:normalizeChannelAudience(n.channelAudience),parent:{isRemote:!1,spanId:i.spanId,traceFlags:i.traceFlags,traceId:i.traceId},requestAttribute:a,requestId:n.requestId,rootSessionId:n.rootSessionId,sessionId:n.sessionId,startTimeMs:n.startTimeMs,stepIndex:n.stepIndex,turnId:n.turnId}}function recordError(e,t){t instanceof Error?(e.recordException(t),e.setStatus({code:SpanStatusCode.ERROR,message:t.message})):e.setStatus({code:SpanStatusCode.ERROR})}export{createAgentApprovalInstrumentation};
1
+ import{normalizeChannelAudience}from"#shared/channel-audience.js";import{ROOT_CONTEXT,SpanStatusCode,trace}from"#compiled/@opentelemetry/api/index.js";import{contentAttribute}from"#tracing/agent-otel-content.js";function createAgentApprovalInstrumentation(n){return{"input.requested":async(t,r)=>{if(t.kind!==`tool-approval`||readState(r.state.get())!==void 0)return;let a=await n.actionContextFor(t.scope.sessionId,t.scope.turnId,t.action.callId);if(a===void 0)return;let o={actionCallId:t.action.callId,actionName:t.action.name,attemptIndex:t.scope.attemptIndex,channelAudience:normalizeChannelAudience(t.scope.channelAudience),parent:{spanId:a.spanContext.spanId,traceFlags:a.spanContext.traceFlags,traceId:a.spanContext.traceId},requestId:t.requestId,rootSessionId:t.scope.rootSessionId??t.scope.sessionId,sessionId:t.scope.sessionId,startTimeMs:Date.now(),stepIndex:t.scope.stepIndex,turnId:t.scope.turnId},s=n.recordInputs?contentAttribute(t.request,!1):void 0;s!==void 0&&(o.requestAttribute=s),r.state.set(o)},"input.resolved":(e,a)=>{let o=readState(a.state.get());if(o===void 0)return;let s=n.idGenerator.withSpanId(n.idGenerator.deriveSpanId(`approval:${e.idempotencyKey}`),()=>n.tracer.startSpan(`agent.approval`,{attributes:{"agent.action.call_id":o.actionCallId,"agent.action.name":o.actionName,"agent.approval.kind":`tool-approval`,"agent.approval.outcome":e.outcome,"agent.approval.request_id":o.requestId,"agent.framework.name":`eve`,"agent.framework.version":n.frameworkVersion,"agent.session.id":o.sessionId,"agent.step.attempt":o.attemptIndex,"agent.step.index":o.stepIndex,"agent.turn.id":o.turnId},startTime:o.startTimeMs},trace.setSpan(ROOT_CONTEXT,trace.wrapSpanContext({...o.parent,isRemote:!1}))));if(o.requestAttribute!==void 0&&s.setAttribute(`agent.approval.request`,o.requestAttribute),n.recordOutputs&&e.response!==void 0){let t=contentAttribute(e.response,!1);t!==void 0&&s.setAttribute(`agent.approval.response`,t)}e.outcome===`failed`&&recordError(s,e.error),s.end()}}}function readState(t){if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t,r=n.parent;if(typeof r!=`object`||!r||Array.isArray(r))return;let i=r;if(typeof n.actionCallId!=`string`||typeof n.actionName!=`string`||typeof n.attemptIndex!=`number`||typeof i.spanId!=`string`||typeof i.traceFlags!=`number`||typeof i.traceId!=`string`||typeof n.requestId!=`string`||typeof n.rootSessionId!=`string`||typeof n.sessionId!=`string`||typeof n.startTimeMs!=`number`||typeof n.stepIndex!=`number`||typeof n.turnId!=`string`)return;let a=n.requestAttribute;if(!(a!==void 0&&typeof a!=`string`))return{actionCallId:n.actionCallId,actionName:n.actionName,attemptIndex:n.attemptIndex,channelAudience:normalizeChannelAudience(n.channelAudience),parent:{isRemote:!1,spanId:i.spanId,traceFlags:i.traceFlags,traceId:i.traceId},requestAttribute:a,requestId:n.requestId,rootSessionId:n.rootSessionId,sessionId:n.sessionId,startTimeMs:n.startTimeMs,stepIndex:n.stepIndex,turnId:n.turnId}}function recordError(e,t){t instanceof Error?(e.recordException(t),e.setStatus({code:SpanStatusCode.ERROR,message:t.message})):e.setStatus({code:SpanStatusCode.ERROR})}export{createAgentApprovalInstrumentation};
@@ -1 +1 @@
1
- import{normalizeChannelAudience}from"#shared/channel-audience.js";import{ROOT_CONTEXT,SpanKind,SpanStatusCode,trace}from"#compiled/@opentelemetry/api/index.js";import{sessionIdempotencyKey}from"#harness/instrumentation/lifecycle.js";import{contentAttribute}from"#tracing/agent-otel-content.js";import{isSampledTrace}from"#tracing/sampled-trace.js";function createAgentChannelDeliveryInstrumentation(t){let onStarted=async(n,r)=>{let i=await t.ensureSessionContext({agentName:n.agentName,channelAudience:n.delivery.channelAudience,channelKind:n.delivery.channelKind,idempotencyKey:sessionIdempotencyKey(n.sessionId),parentTraceContext:n.parentTraceContext,rootSessionId:n.rootSessionId,sessionId:n.sessionId,type:`session.started`});if(!isSampledTrace(i.context))return;let c=t.recordInputs?contentAttribute(n.input,!1):void 0,l={channelAudience:normalizeChannelAudience(n.delivery.channelAudience),parent:{isRemote:i.context.isRemote??!1,spanId:i.context.spanId,traceFlags:i.context.traceFlags,traceId:i.context.traceId},spanId:t.idGenerator.deriveSpanId(`channel-delivery:${n.idempotencyKey}`),startTimeMs:Date.now(),window:i.window};c!==void 0&&(l.inputAttribute=c),n.delivery.requestTraceContext!==void 0&&(l.requestTraceContext={spanId:n.delivery.requestTraceContext.spanId,traceFlags:n.delivery.requestTraceContext.traceFlags,traceId:n.delivery.requestTraceContext.traceId}),r.state.set(l)},onTerminal=async(e,r)=>{let i=readState(r.state.get());if(i===void 0)return;let a=e.turnId===void 0?void 0:await t.stateStore.getTurn(e.sessionId,e.turnId),o=await t.stateStore.getSession(e.sessionId),s=a===void 0?i.parent:{isRemote:a.parentIsRemote??!1,spanId:a.parentSpanId,traceFlags:a.context.traceFlags,traceId:a.context.traceId},c=a===void 0?i.startTimeMs:Math.max(i.startTimeMs,a.startTimeMs),l=i.requestTraceContext,u=t.idGenerator.withSpanId(i.spanId,()=>t.tracer.startSpan(`agent.channel.delivery`,{attributes:{"agent.channel.delivery.id":e.delivery.deliveryId,"agent.channel.delivery.outcome":e.outcome,"agent.channel.kind":e.delivery.channelKind,"agent.channel.name":e.delivery.channelName,"agent.channel.request.id":e.delivery.requestId,"agent.framework.name":`eve`,"agent.framework.version":t.frameworkVersion,"agent.name":e.agentName,"agent.root.session.id":e.rootSessionId,"agent.session.id":e.sessionId,"agent.session.window":o?.window??i.window,"agent.turn.id":e.turnId,"agent.turn.sequence":e.sequence},kind:SpanKind.CONSUMER,links:l===void 0?void 0:[{attributes:{"eve.link.type":`channel.request`},context:l}],startTime:c},contextFromSpanContext(s)));if(u.addEvent(`channel.delivery.started`,void 0,c),u.addEvent(e.type),i.inputAttribute!==void 0&&u.setAttribute(`agent.channel.delivery.input`,i.inputAttribute),e.outcome===`failed`){let t=e.errorCode??(e.error instanceof Error?e.error.name:`Error`);u.setAttribute(`error.type`,t),e.errorCode!==void 0&&u.setAttribute(`agent.channel.delivery.error.code`,e.errorCode),recordError(u,e.error)}u.end()};return{"channel.delivery.cancelled":onTerminal,"channel.delivery.completed":onTerminal,"channel.delivery.failed":onTerminal,"channel.delivery.started":onStarted}}function readState(t){if(!isRecord(t)||!isSpanContext(t.parent)||typeof t.spanId!=`string`||typeof t.startTimeMs!=`number`||typeof t.window!=`number`)return;let n=isSpanContext(t.requestTraceContext)?t.requestTraceContext:void 0;return{channelAudience:normalizeChannelAudience(t.channelAudience),inputAttribute:typeof t.inputAttribute==`string`?t.inputAttribute:void 0,parent:t.parent,requestTraceContext:n,spanId:t.spanId,startTimeMs:t.startTimeMs,window:t.window}}function isSpanContext(e){return isRecord(e)&&typeof e.spanId==`string`&&typeof e.traceFlags==`number`&&typeof e.traceId==`string`}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function contextFromSpanContext(e){return trace.setSpan(ROOT_CONTEXT,trace.wrapSpanContext(e))}function recordError(e,t){t instanceof Error?(e.recordException(t),e.setStatus({code:SpanStatusCode.ERROR,message:t.message})):e.setStatus({code:SpanStatusCode.ERROR})}export{createAgentChannelDeliveryInstrumentation};
1
+ import{normalizeChannelAudience}from"#shared/channel-audience.js";import{isSampledTrace}from"#tracing/sampled-trace.js";import{ROOT_CONTEXT,SpanKind,SpanStatusCode,trace}from"#compiled/@opentelemetry/api/index.js";import{sessionIdempotencyKey}from"#harness/instrumentation/lifecycle.js";import{contentAttribute}from"#tracing/agent-otel-content.js";function createAgentChannelDeliveryInstrumentation(n){let onStarted=async(r,i)=>{let a=await n.ensureSessionContext({agentName:r.agentName,channelAudience:r.delivery.channelAudience,channelKind:r.delivery.channelKind,idempotencyKey:sessionIdempotencyKey(r.sessionId),parentTraceContext:r.parentTraceContext,rootSessionId:r.rootSessionId,sessionId:r.sessionId,traceSeed:r.traceSeed,type:`session.started`});if(!isSampledTrace(a.context))return;let c=n.recordInputs?contentAttribute(r.input,!1):void 0,l={channelAudience:normalizeChannelAudience(r.delivery.channelAudience),parent:{isRemote:a.context.isRemote??!1,spanId:a.context.spanId,traceFlags:a.context.traceFlags,traceId:a.context.traceId},spanId:n.idGenerator.deriveSpanId(`channel-delivery:${r.idempotencyKey}`),startTimeMs:Date.now()};c!==void 0&&(l.inputAttribute=c),r.delivery.requestTraceContext!==void 0&&(l.requestTraceContext={spanId:r.delivery.requestTraceContext.spanId,traceFlags:r.delivery.requestTraceContext.traceFlags,traceId:r.delivery.requestTraceContext.traceId}),i.state.set(l)},onTerminal=async(e,t)=>{let i=readState(t.state.get());if(i===void 0)return;let a=e.turnId===void 0?void 0:await n.stateStore.getTurn(e.sessionId,e.turnId),o=a===void 0?i.parent:{isRemote:a.parentIsRemote??!1,spanId:a.parentSpanId,traceFlags:a.context.traceFlags,traceId:a.context.traceId},s=a===void 0?i.startTimeMs:Math.max(i.startTimeMs,a.startTimeMs),c=i.requestTraceContext,l=n.idGenerator.withSpanId(i.spanId,()=>n.tracer.startSpan(`agent.channel.delivery`,{attributes:{"agent.channel.delivery.id":e.delivery.deliveryId,"agent.channel.delivery.outcome":e.outcome,"agent.channel.kind":e.delivery.channelKind,"agent.channel.name":e.delivery.channelName,"agent.channel.request.id":e.delivery.requestId,"agent.framework.name":`eve`,"agent.framework.version":n.frameworkVersion,"agent.name":e.agentName,"agent.session.id":e.sessionId,"agent.turn.id":e.turnId,"agent.turn.sequence":e.sequence},kind:SpanKind.CONSUMER,links:c===void 0?void 0:[{attributes:{"eve.link.type":`channel.request`},context:c}],startTime:s},contextFromSpanContext(o)));if(l.addEvent(`channel.delivery.started`,void 0,s),l.addEvent(e.type),i.inputAttribute!==void 0&&l.setAttribute(`agent.channel.delivery.input`,i.inputAttribute),e.outcome===`failed`){let t=e.errorCode??(e.error instanceof Error?e.error.name:`Error`);l.setAttribute(`error.type`,t),e.errorCode!==void 0&&l.setAttribute(`agent.channel.delivery.error.code`,e.errorCode),recordError(l,e.error)}l.end()};return{"channel.delivery.cancelled":onTerminal,"channel.delivery.completed":onTerminal,"channel.delivery.failed":onTerminal,"channel.delivery.started":onStarted}}function readState(t){if(!isRecord(t)||!isSpanContext(t.parent)||typeof t.spanId!=`string`||typeof t.startTimeMs!=`number`)return;let n=isSpanContext(t.requestTraceContext)?t.requestTraceContext:void 0;return{channelAudience:normalizeChannelAudience(t.channelAudience),inputAttribute:typeof t.inputAttribute==`string`?t.inputAttribute:void 0,parent:t.parent,requestTraceContext:n,spanId:t.spanId,startTimeMs:t.startTimeMs}}function isSpanContext(e){return isRecord(e)&&typeof e.spanId==`string`&&typeof e.traceFlags==`number`&&typeof e.traceId==`string`}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function contextFromSpanContext(e){return trace.setSpan(ROOT_CONTEXT,trace.wrapSpanContext(e))}function recordError(e,t){t instanceof Error?(e.recordException(t),e.setStatus({code:SpanStatusCode.ERROR,message:t.message})):e.setStatus({code:SpanStatusCode.ERROR})}export{createAgentChannelDeliveryInstrumentation};
@@ -1,2 +1,2 @@
1
- import{ROOT_CONTEXT,SpanStatusCode,context,trace}from"#compiled/@opentelemetry/api/index.js";import{attemptIdempotencyKey}from"#harness/instrumentation/lifecycle.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{isSampledTrace}from"#tracing/sampled-trace.js";import{withChannelAudience}from"#tracing/channel-audience-context.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{createAgentOtelSessionContext}from"#tracing/agent-otel-session-context.js";import{suppressTracing}from"#tracing/suppress-tracing.js";function createAgentOtelInstrumentation(e){let t=e.recordInputs??!1,f=e.recordOutputs??!1,p=new WeakMap,m=new Map,h=new WeakMap,g=new WeakMap,_=createAgentActionInstrumentation({frameworkVersion:e.frameworkVersion,idGenerator:e.idGenerator,recordInputs:t,recordOutputs:f,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,recordInputs:t,recordOutputs:f,tracer:e.tracer}),y=createAgentToolInstrumentation({actionContextFor:_.contextFor,idGenerator:e.idGenerator,recordInputs:t,recordOutputs:f,resolveFallback:e=>{let t=m.get(e.scope.attemptId)??e.scope,n=h.get(t)?.step;return n===void 0?void 0:{context:n.context,spanContext:n.span.spanContext()}},tracer:e.tracer}),{ensureSessionContext:b,prepareSessionTrace:x,prepareTurnTrace:S}=createAgentOtelSessionContext(e),onSessionStarted=async e=>{await x(e)},onTurnStarted=async e=>{await S(e)},onStepStarted=async t=>{let a=await e.stateStore.getTurn(t.scope.sessionId,t.scope.turnId);if(a===void 0||!isSampledTrace(a.context))return;let o=withChannelAudience(contextFromSpanContext(a.context),t.scope.channelAudience),s=trace.getSpan(context.active())?.spanContext(),c=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.root.session.id":t.scope.rootSessionId??t.scope.sessionId,"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:s===void 0||s.traceId===a.context.traceId?void 0:[{attributes:{"eve.link.type":`workflow.delivery`},context:s}]},o));c.addEvent(`step.started`);let l=trace.setSpan(o,c),u=t.operation.operationId,d=e.tracer.startSpan(u,{attributes:{"ai.operation.name":u,"ai.provider.name":t.operation.provider,"ai.request.model":t.operation.modelId,...runtimeContextAttributes(t.runtimeContext)}},l);h.set(t.scope,{operation:{context:trace.setSpan(l,d),name:u,span:d},step:{context:l,span:c}}),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.step.span.addEvent(e.type===`step.attempt.completed`?`step.completed`:`step.failed`),e.type===`step.attempt.failed`&&(recordError(n.operation.span,e.error),recordError(n.step.span,e.error)),n.operation.span.end(),n.step.span.end(),h.delete(t))},onTurnTerminal=async t=>{(t.type===`turn.cancelled`||t.type===`turn.failed`)&&await _.deleteForTurn(t.sessionId,t.turnId);let n=await e.stateStore.getTurn(t.sessionId,t.turnId);n!==void 0&&await e.stateStore.setTurn(t.sessionId,t.turnId,{...n,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 r=await e.stateStore.getSession(t.sessionId);if(isSampledTrace(n.context)){let i=e.idGenerator.withSpanId(n.context.spanId,()=>e.tracer.startSpan(`agent.turn`,{attributes:{"agent.framework.name":`eve`,"agent.framework.version":e.frameworkVersion,"agent.name":r?.agentName,...parentLineageAttributes(n.lineage),"agent.root.session.id":n.rootSessionId,"agent.session.id":t.sessionId,"agent.session.window":r?.window,"agent.turn.id":t.turnId,"agent.turn.sequence":n.sequence},startTime:n.startTimeMs},contextFromSpanContext({isRemote:n.parentIsRemote??!1,spanId:n.parentSpanId,traceFlags:n.context.traceFlags,traceId:n.context.traceId})));i.addEvent(`turn.started`,void 0,n.startTimeMs),n.terminal!==void 0&&(i.addEvent(n.terminal.type),n.terminal.type===`turn.failed`&&recordError(i,n.terminal.error)),i.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=n=>{let i=h.get(n.scope);if(i===void 0)return;i.step.span.setAttribute(`agent.model.id`,n.model.modelId),i.step.span.setAttribute(`agent.model.provider`,n.model.provider);let a=e.tracer.startSpan(modelSpanName(n.model.modelId),{attributes:{"gen_ai.agent.name":n.scope.functionId,"gen_ai.operation.name":`chat`,"gen_ai.provider.name":n.model.provider,"gen_ai.request.model":n.model.modelId,...runtimeContextAttributes(n.runtimeContext)}},i.operation.context);if(t&&n.input!==void 0){let e=messagesContentAttribute(n.input.messages);e!==void 0&&a.setAttribute(`ai.prompt.messages`,e);let t=genAiInputMessagesAttribute(n.input.messages);t!==void 0&&a.setAttribute(`gen_ai.input.messages`,t);let r=systemPromptAttribute(n.input.instructions);r!==void 0&&a.setAttribute(`ai.prompt.system`,r);let i=genAiSystemInstructionsAttribute(n.input.instructions);i!==void 0&&a.setAttribute(`gen_ai.system_instructions`,i)}let s={context:trace.setSpan(i.operation.context,a),span:a};getExecutionContexts(n.scope).set(n.idempotencyKey,s.context),getSpanStates(g,n.scope).set(n.idempotencyKey,s)},onModelCallTerminal=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{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.step.span,e.usage),f){t.span.setAttribute(`ai.response.finish_reason`,e.finishReason);let n=e.content??[],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 o=textContentAttribute(n.filter(e=>e.type===`text`).map(e=>e.text).join(``));o!==void 0&&t.span.setAttribute(`ai.response.text`,o);let c=n.filter(e=>e.type===`tool-call`).map(e=>({callId:e.callId,input:e.input,toolName:e.toolName}));if(c.length>0){let e=contentAttribute(c,!1);e!==void 0&&t.span.setAttribute(`ai.response.tool_calls`,e)}let l=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(l.length>0){let e=toolResultsContentAttribute(l);e!==void 0&&t.span.setAttribute(`ai.response.tool_results`,e)}}}t.span.end()}},C=createAgentChannelDeliveryInstrumentation({ensureSessionContext:b,frameworkVersion:e.frameworkVersion,idGenerator:e.idGenerator,recordInputs:t,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.step.span.setAttribute(e,r)};return{hook:{capture:t||f?`content`:`metadata`,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`},prepareSessionTrace:x,prepareTurnTrace:S,async runInContext(t,r){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?r():context.with(o,r)}};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 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 parentLineageAttributes(e){if(e===void 0)return{};let t={"agent.parent.call_id":e.callId,"agent.parent.session.id":e.sessionId,"agent.parent.turn.id":e.turnId};return e.subagentName!==void 0&&(t[`agent.subagent.name`]=e.subagentName),t}function contextFromSpanContext(t){return trace.setSpan(ROOT_CONTEXT,trace.wrapSpanContext(t))}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 runtimeContextAttributes(e){let t={};if(e===void 0)return t;for(let[n,r]of Object.entries(e))flattenContextAttribute(t,`ai.settings.context.${n}`,r);return t}function flattenContextAttribute(e,t,n){if(n!=null){if(typeof n==`string`||typeof n==`number`||typeof n==`boolean`){e[t]=n;return}if(Array.isArray(n)){let r=n.filter(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`);if(r.length!==n.length||new Set(r.map(e=>typeof e)).size!==1)return;e[t]=r;return}if(typeof n==`object`)for(let[r,i]of Object.entries(n))flattenContextAttribute(e,`${t}.${r}`,i)}}function errorText(e){return e instanceof Error?e.message:e}function recordError(e,n){n instanceof Error?(e.recordException(n),e.setStatus({code:SpanStatusCode.ERROR,message:n.message})):e.setStatus({code:SpanStatusCode.ERROR})}export{createAgentOtelInstrumentation};
1
+ import{isSampledTrace}from"#tracing/sampled-trace.js";import{ROOT_CONTEXT,SpanStatusCode,context,trace}from"#compiled/@opentelemetry/api/index.js";import{attemptIdempotencyKey}from"#harness/instrumentation/lifecycle.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{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{createAgentOtelSessionContext}from"#tracing/agent-otel-session-context.js";import{suppressTracing}from"#tracing/suppress-tracing.js";function createAgentOtelInstrumentation(t){let n=t.recordInputs??!1,p=t.recordOutputs??!1,m=new WeakMap,h=new Map,g=new WeakMap,_=new WeakMap,v=createAgentActionInstrumentation({frameworkVersion:t.frameworkVersion,idGenerator:t.idGenerator,recordInputs:n,recordOutputs:p,resolveTraceContext:async e=>(await t.stateStore.getTurn(e.scope.sessionId,e.scope.turnId))?.context,stateStore:t.stateStore,tracer:t.tracer}),y=createAgentApprovalInstrumentation({actionContextFor:v.contextFor,frameworkVersion:t.frameworkVersion,idGenerator:t.idGenerator,recordInputs:n,recordOutputs:p,tracer:t.tracer}),b=createAgentToolInstrumentation({actionContextFor:v.contextFor,idGenerator:t.idGenerator,recordInputs:n,recordOutputs:p,resolveFallback:e=>{let t=h.get(e.scope.attemptId)??e.scope,n=g.get(t)?.step;return n===void 0?void 0:{context:n.context,spanContext:n.span.spanContext()}},tracer:t.tracer}),{ensureSessionContext:x,prepareSessionTrace:S,prepareTurnTrace:C}=createAgentOtelSessionContext(t),onSessionStarted=async e=>{await S(e)},onTurnStarted=async e=>{await C(e)},onStepStarted=async n=>{let o=await t.stateStore.getTurn(n.scope.sessionId,n.scope.turnId);if(o===void 0||!isSampledTrace(o.context))return;let s=withChannelAudience(contextFromSpanContext(o.context),n.scope.channelAudience),c=trace.getSpan(context.active())?.spanContext(),l=t.idGenerator.withSpanId(t.idGenerator.deriveSpanId(attemptIdempotencyKey(n.scope)),()=>t.tracer.startSpan(`agent.step`,{attributes:{"agent.session.id":n.scope.sessionId,"agent.framework.name":`eve`,"agent.framework.version":t.frameworkVersion,"agent.step.attempt":n.scope.attemptIndex,"agent.step.index":n.scope.stepIndex,"agent.turn.id":n.scope.turnId,"agent.name":n.scope.functionId,...runtimeContextAttributes(n.runtimeContext)},links:c===void 0||c.traceId===o.context.traceId?void 0:[{attributes:{"eve.link.type":`workflow.delivery`},context:c}]},s));l.addEvent(`step.started`);let u=trace.setSpan(s,l),d=n.operation.operationId,f=t.tracer.startSpan(d,{attributes:{"ai.operation.name":d,"ai.provider.name":n.operation.provider,"ai.request.model":n.operation.modelId,...runtimeContextAttributes(n.runtimeContext)}},u);g.set(n.scope,{operation:{context:trace.setSpan(u,f),name:d,span:f},step:{context:u,span:l}}),h.set(n.scope.attemptId,n.scope)},onStepTerminal=async e=>{let t=h.get(e.scope.attemptId)??e.scope;m.delete(t),drainOpenSpans({...e,scope:t}),b.drain(e.scope.attemptId,e.type===`step.attempt.failed`?{error:e.error}:void 0),e.type===`step.attempt.failed`&&await v.failForAttempt(t,e.error),h.delete(e.scope.attemptId);let n=g.get(t);n!==void 0&&(n.step.span.addEvent(e.type===`step.attempt.completed`?`step.completed`:`step.failed`),e.type===`step.attempt.failed`&&(recordError(n.operation.span,e.error),recordError(n.step.span,e.error)),n.operation.span.end(),n.step.span.end(),g.delete(t))},onTurnTerminal=async e=>{(e.type===`turn.cancelled`||e.type===`turn.failed`)&&await v.deleteForTurn(e.sessionId,e.turnId);let n=await t.stateStore.getTurn(e.sessionId,e.turnId);n!==void 0&&await t.stateStore.setTurn(e.sessionId,e.turnId,{...n,terminal:e.type===`turn.failed`?{error:e.error,type:e.type}:{type:e.type}})},onSessionTransition=async n=>{if(n.turnId!==void 0){let r=await t.stateStore.getTurn(n.sessionId,n.turnId);if(r!==void 0){let i=await t.stateStore.getSession(n.sessionId);if(isSampledTrace(r.context)){let e=t.idGenerator.withSpanId(r.context.spanId,()=>t.tracer.startSpan(`agent.turn`,{attributes:{"agent.framework.name":`eve`,"agent.framework.version":t.frameworkVersion,"agent.name":i?.agentName,"agent.session.id":n.sessionId,"agent.subagent.name":r.subagentName,"agent.turn.id":n.turnId,"agent.turn.sequence":r.sequence},startTime:r.startTimeMs},contextFromSpanContext({isRemote:r.parentIsRemote??!1,spanId:r.parentSpanId,traceFlags:r.context.traceFlags,traceId:r.context.traceId})));e.addEvent(`turn.started`,void 0,r.startTimeMs),r.terminal!==void 0&&(e.addEvent(r.terminal.type),r.terminal.type===`turn.failed`&&recordError(e,r.terminal.error)),e.end()}await t.stateStore.deleteTurn(n.sessionId,n.turnId)}}(n.type===`session.completed`||n.type===`session.failed`)&&(await v.deleteForSession(n.sessionId),await t.stateStore.deleteSession(n.sessionId))},onModelCallStarted=e=>{let r=g.get(e.scope);if(r===void 0)return;r.step.span.setAttribute(`agent.model.id`,e.model.modelId),r.step.span.setAttribute(`agent.model.provider`,e.model.provider);let a=t.tracer.startSpan(modelSpanName(e.model.modelId),{attributes:{"gen_ai.agent.name":e.scope.functionId,"gen_ai.operation.name":`chat`,"gen_ai.provider.name":e.model.provider,"gen_ai.request.model":e.model.modelId,...runtimeContextAttributes(e.runtimeContext)}},r.operation.context);if(n&&e.input!==void 0){let t=messagesContentAttribute(e.input.messages);t!==void 0&&a.setAttribute(`ai.prompt.messages`,t);let n=genAiInputMessagesAttribute(e.input.messages);n!==void 0&&a.setAttribute(`gen_ai.input.messages`,n);let r=systemPromptAttribute(e.input.instructions);r!==void 0&&a.setAttribute(`ai.prompt.system`,r);let i=genAiSystemInstructionsAttribute(e.input.instructions);i!==void 0&&a.setAttribute(`gen_ai.system_instructions`,i)}let o={context:trace.setSpan(r.operation.context,a),span:a};getExecutionContexts(e.scope).set(e.idempotencyKey,o.context),getSpanStates(_,e.scope).set(e.idempotencyKey,o)},onModelCallTerminal=e=>{m.get(e.scope)?.delete(e.idempotencyKey);let t=takeSpanState(_,e.scope,e.idempotencyKey);if(t!==void 0){if(e.type===`model.call.failed`)recordError(t.span,e.error);else{setAgentUsage(t.span,e.usage),t.span.setAttribute(`gen_ai.response.finish_reasons`,[e.finishReason]);let n=g.get(e.scope);if(n!==void 0&&setAgentUsage(n.step.span,e.usage),p){t.span.setAttribute(`ai.response.finish_reason`,e.finishReason);let n=e.content??[],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 s=n.filter(e=>e.type===`tool-call`).map(e=>({callId:e.callId,input:e.input,toolName:e.toolName}));if(s.length>0){let e=contentAttribute(s,!1);e!==void 0&&t.span.setAttribute(`ai.response.tool_calls`,e)}let l=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(l.length>0){let e=toolResultsContentAttribute(l);e!==void 0&&t.span.setAttribute(`ai.response.tool_results`,e)}}}t.span.end()}},w=createAgentChannelDeliveryInstrumentation({ensureSessionContext:x,frameworkVersion:t.frameworkVersion,idGenerator:t.idGenerator,recordInputs:n,stateStore:t.stateStore,tracer:t.tracer}),onStepMetadata=e=>{let t=g.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.step.span.setAttribute(e,r)};return{hook:{capture:n||p?`content`:`metadata`,events:{...w,"action.completed":v.events[`action.completed`],"action.failed":v.events[`action.failed`],async"action.started"(e,t){await v.events[`action.started`](e,t),await b.actionStarted(e)},...y,"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,...b.events,"turn.cancelled":onTurnTerminal,"turn.completed":onTurnTerminal,"turn.failed":onTurnTerminal,"turn.started":onTurnStarted},name:`eve.otel`},prepareSessionTrace:S,prepareTurnTrace:C,async runInContext(n,i){let a=h.get(n.scope.attemptId)??n.scope,o=m.get(a),s=n.type===`model.call`?o?.get(n.idempotencyKey):b.contextFor(n.scope.attemptId,n.idempotencyKey);if(s===void 0){let r=await t.stateStore.getTurn(n.scope.sessionId,n.scope.turnId);r!==void 0&&(s=withChannelAudience(contextFromSpanContext(r.context),n.scope.channelAudience),isSampledTrace(r.context)||(s=suppressTracing(s)))}return s===void 0?i():context.with(s,i)}};function getExecutionContexts(e){let t=m.get(e);return t===void 0&&(t=new Map,m.set(e,t)),t}function drainOpenSpans(e){for(let t of _.get(e.scope)?.values()??[])e.type===`step.attempt.failed`&&recordError(t.span,e.error),t.span.end();_.delete(e.scope)}}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 runtimeContextAttributes(e){let t={};if(e===void 0)return t;for(let[n,r]of Object.entries(e))flattenContextAttribute(t,`ai.settings.context.${n}`,r);return t}function flattenContextAttribute(e,t,n){if(n!=null){if(typeof n==`string`||typeof n==`number`||typeof n==`boolean`){e[t]=n;return}if(Array.isArray(n)){let r=n.filter(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`);if(r.length!==n.length||new Set(r.map(e=>typeof e)).size!==1)return;e[t]=r;return}if(typeof n==`object`)for(let[r,i]of Object.entries(n))flattenContextAttribute(e,`${t}.${r}`,i)}}function errorText(e){return e instanceof Error?e.message:e}function recordError(e,t){t instanceof Error?(e.recordException(t),e.setStatus({code:SpanStatusCode.ERROR,message:t.message})):e.setStatus({code:SpanStatusCode.ERROR})}export{createAgentOtelInstrumentation};
@@ -2,7 +2,7 @@ import type { Tracer } from "#compiled/@opentelemetry/api/index.js";
2
2
  import { type InstrumentationSessionStartedEvent, type InstrumentationTraceContext, type InstrumentationTurnStartedEvent } from "#harness/instrumentation/lifecycle.js";
3
3
  import type { AgentSpanIdGenerator } from "#tracing/agent-span-id-generator.js";
4
4
  import type { TraceCapturePolicy } from "#tracing/otel-declaration.js";
5
- import { type AgentSessionTraceState, type AgentTraceStateStore } from "#tracing/agent-trace-state.js";
5
+ import type { AgentSessionTraceState, AgentTraceStateStore } from "#tracing/agent-trace-state.js";
6
6
  interface AgentOtelSessionContextInput {
7
7
  readonly frameworkVersion: string;
8
8
  readonly idGenerator: AgentSpanIdGenerator;
@@ -1 +1 @@
1
- import{normalizeChannelAudience}from"#shared/channel-audience.js";import{sessionIdempotencyKey}from"#harness/instrumentation/lifecycle.js";import{SESSION_WINDOW_TURN_LIMIT}from"#tracing/agent-trace-state.js";function createAgentOtelSessionContext(r){let openSessionWindow=e=>{if(!shouldTrace(r.tracePolicy,e))return{isRemote:!1,spanId:r.idGenerator.deriveSpanId(`session:${e.sessionId}:${e.index}`),traceFlags:0,traceId:r.idGenerator.generateTraceId()};let t=r.tracer.startSpan(`agent.session`,{attributes:{"agent.framework.name":`eve`,"agent.framework.version":r.frameworkVersion,"agent.channel.audience":e.channelAudience,"agent.name":e.agentName,"agent.root.session.id":e.rootSessionId,"agent.session.id":e.sessionId,"agent.session.window":e.index,"agent.trace.schema.version":1,...e.previousTraceId===void 0?{}:{"agent.session.window.previous.trace.id":e.previousTraceId}},root:!0});return t.addEvent(e.index===0?`session.started`:`session.window.opened`),t.end(),t.spanContext()},ensureSessionContext=async t=>{let n=await r.stateStore.getSession(t.sessionId);return n===void 0&&(n={agentName:t.agentName,channelAudience:normalizeChannelAudience(t.channelAudience),channelKind:t.channelKind,context:t.parentTraceContext===void 0?openSessionWindow({agentName:t.agentName,channelAudience:normalizeChannelAudience(t.channelAudience),index:0,rootSessionId:t.rootSessionId,sessionId:t.sessionId}):adoptedSpanContext(t.parentTraceContext,shouldTrace(r.tracePolicy,{agentName:t.agentName,channelAudience:normalizeChannelAudience(t.channelAudience),rootSessionId:t.rootSessionId,sessionId:t.sessionId})),rootSessionId:t.rootSessionId,turnsInWindow:0,window:0},await r.stateStore.setSession(t.sessionId,n)),n},advanceSessionWindow=(t,r)=>{if(r.turnsInWindow<SESSION_WINDOW_TURN_LIMIT)return r;let i=r.window+1;return{...r,context:openSessionWindow({agentName:r.agentName,channelAudience:normalizeChannelAudience(r.channelAudience),index:i,previousTraceId:r.context.traceId,rootSessionId:r.rootSessionId,sessionId:t}),turnsInWindow:0,window:i}};return{ensureSessionContext,prepareSessionTrace:async e=>portableSpanContext((await ensureSessionContext(e)).context),prepareTurnTrace:async e=>{let n=await r.stateStore.getTurn(e.sessionId,e.turnId);if(n!==void 0)return{spanId:n.parentSpanId,traceFlags:n.context.traceFlags,traceId:n.context.traceId};let i=advanceSessionWindow(e.sessionId,await ensureSessionContext({agentName:void 0,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:r.idGenerator.deriveSpanId(`turn:${e.idempotencyKey}`),traceFlags:i.context.traceFlags,traceId:i.context.traceId};return await r.stateStore.setSession(e.sessionId,{...i,turnsInWindow:i.turnsInWindow+1}),await r.stateStore.setTurn(e.sessionId,e.turnId,{context:a,lineage:e.parentLineage,parentIsRemote:i.context.isRemote,parentSpanId:i.context.spanId,rootSessionId:e.rootSessionId,sequence:e.sequence,startTimeMs:Date.now()}),portableSpanContext(i.context)}}}function shouldTrace(e,t){try{return e?.({agentName:t.agentName,audience:t.channelAudience,rootSessionId:t.rootSessionId,sessionId:t.sessionId})??t.channelAudience===`public`}catch{return!1}}function portableSpanContext(e){return{spanId:e.spanId,traceFlags:e.traceFlags,traceId:e.traceId}}function adoptedSpanContext(e,t=!0){return{isRemote:`isRemote`in e&&e.isRemote===!0,spanId:e.spanId,traceFlags:t?e.traceFlags:0,traceId:e.traceId}}export{createAgentOtelSessionContext};
1
+ import{normalizeChannelAudience}from"#shared/channel-audience.js";import{evaluateTracePolicy,isSampledTrace}from"#tracing/sampled-trace.js";import{sessionIdempotencyKey}from"#harness/instrumentation/lifecycle.js";function createAgentOtelSessionContext(i){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=()=>i.tracer.startSpan(`agent.session`,{attributes:{"agent.framework.name":`eve`,"agent.framework.version":i.frameworkVersion,"agent.channel.audience":e.channelAudience,"agent.name":e.agentName,"agent.session.id":e.sessionId,"agent.trace.schema.version":2},root:!0}),t=i.idGenerator.withSpanId(e.traceSeed.spanId,()=>i.idGenerator.withTraceId(e.traceSeed.traceId,startSpan));return t.addEvent(`session.started`),t.end(),t.spanContext()}if(!evaluateTracePolicy(i.tracePolicy,{agentName:e.agentName,audience:e.channelAudience,channelType:e.channelType}))return{isRemote:!1,spanId:i.idGenerator.deriveSpanId(`session:${e.sessionId}`),traceFlags:0,traceId:i.idGenerator.generateTraceId()};let r=i.tracer.startSpan(`agent.session`,{attributes:{"agent.framework.name":`eve`,"agent.framework.version":i.frameworkVersion,"agent.channel.audience":e.channelAudience,"agent.name":e.agentName,"agent.session.id":e.sessionId,"agent.trace.schema.version":2},root:!0});return r.addEvent(`session.started`),r.end(),r.spanContext()},ensureSessionContext=async t=>{let n=await i.stateStore.getSession(t.sessionId);return n===void 0&&(n={agentName:t.agentName,channelAudience:normalizeChannelAudience(t.channelAudience),channelKind:t.channelKind,context:t.parentTraceContext===void 0?openSessionTrace({agentName:t.agentName,channelAudience:normalizeChannelAudience(t.channelAudience),channelType:t.channelType,rootSessionId:t.rootSessionId,sessionId:t.sessionId,traceSeed:t.traceSeed}):adoptedSpanContext(t.parentTraceContext),rootSessionId:t.rootSessionId},await i.stateStore.setSession(t.sessionId,n)),n};return{ensureSessionContext,prepareSessionTrace:async e=>portableSpanContext((await ensureSessionContext(e)).context),prepareTurnTrace:async e=>{let t=await i.stateStore.getTurn(e.sessionId,e.turnId);if(t!==void 0)return{spanId:t.parentSpanId,traceFlags:t.context.traceFlags,traceId:t.context.traceId};let n=await ensureSessionContext({agentName:void 0,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:i.idGenerator.deriveSpanId(`turn:${e.idempotencyKey}`),traceFlags:n.context.traceFlags,traceId:n.context.traceId};return await i.stateStore.setTurn(e.sessionId,e.turnId,{context:a,parentIsRemote:n.context.isRemote,parentSpanId:n.context.spanId,rootSessionId:e.rootSessionId,sequence:e.sequence,startTimeMs:Date.now(),subagentName:e.parentLineage?.subagentName}),portableSpanContext(n.context)}}}function portableSpanContext(e){return{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}}export{createAgentOtelSessionContext};
@@ -14,4 +14,5 @@ export declare class AgentSpanIdGenerator {
14
14
  generateTraceId(): string;
15
15
  /** Runs `startSpan` so the next span started carries `spanId`. */
16
16
  withSpanId<T>(spanId: string, startSpan: () => T): T;
17
+ withTraceId<T>(traceId: string, startSpan: () => T): T;
17
18
  }
@@ -1 +1 @@
1
- import{createHash}from"node:crypto";var AgentSpanIdGenerator=class{#e;allocateSpanId(){return randomHexId(16)}deriveSpanId(t){let n=createHash(`sha256`).update(t).digest(`hex`).slice(0,16);return/^0+$/u.test(n)?`0000000000000001`:n}generateSpanId(){let e=this.#e;return e===void 0?randomHexId(16):(this.#e=void 0,e)}generateTraceId(){return randomHexId(32)}withSpanId(e,t){this.#e=e;try{return t()}finally{this.#e=void 0}}};function randomHexId(e){let t;do{t=``;for(let n=0;n<e;n+=1)t+=`0123456789abcdef`[Math.trunc(Math.random()*16)]}while(!/[1-9a-f]/u.test(t));return t}export{AgentSpanIdGenerator};
1
+ import{createHash}from"node:crypto";var AgentSpanIdGenerator=class{#e;#t;allocateSpanId(){return randomHexId(16)}deriveSpanId(t){let n=createHash(`sha256`).update(t).digest(`hex`).slice(0,16);return/^0+$/u.test(n)?`0000000000000001`:n}generateSpanId(){let e=this.#e;return e===void 0?randomHexId(16):(this.#e=void 0,e)}generateTraceId(){let e=this.#t;return e===void 0?randomHexId(32):(this.#t=void 0,e)}withSpanId(e,t){this.#e=e;try{return t()}finally{this.#e=void 0}}withTraceId(e,t){this.#t=e;try{return t()}finally{this.#t=void 0}}};function randomHexId(e){let t;do{t=``;for(let n=0;n<e;n+=1)t+=`0123456789abcdef`[Math.trunc(Math.random()*16)]}while(!/[1-9a-f]/u.test(t));return t}export{AgentSpanIdGenerator};
@@ -3,7 +3,7 @@ import type { AgentActionTraceState, AgentSessionTraceState, AgentTraceStateStor
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
  /**
6
- * Reads a named session's trace window straight out of a serialized context,
6
+ * Reads a named session's trace context straight out of a serialized context,
7
7
  * which {@link ContextAgentTraceStateStore} cannot do — its reads are scoped
8
8
  * to the ambient session.
9
9
  */