eve 0.78.0 → 0.79.1

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 (397) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/src/approval/definition.d.ts +42 -0
  3. package/dist/src/chunks/{use-eve-agent-BSYe_Re7.js → use-eve-agent-Ch-Q-s12.js} +43 -13
  4. package/dist/src/chunks/{use-eve-agent-B8brxCk-.js → use-eve-agent-Vsl-S0yI.js} +43 -13
  5. package/dist/src/cli/commands/trace-detail.d.ts +2 -2
  6. package/dist/src/cli/commands/trace-detail.js +1 -1
  7. package/dist/src/cli/commands/trace.d.ts +1 -1
  8. package/dist/src/cli/commands/trace.js +1 -1
  9. package/dist/src/cli/dev/tui/traces/trace-conversation.d.ts +1 -1
  10. package/dist/src/cli/dev/tui/traces/trace-conversation.js +1 -1
  11. package/dist/src/cli/dev/tui/traces/trace-store.d.ts +1 -1
  12. package/dist/src/cli/dev/tui/traces/trace-store.js +1 -1
  13. package/dist/src/cli/dev/tui/traces/trace-view.d.ts +1 -1
  14. package/dist/src/cli/dev/tui/traces/trace-view.js +1 -1
  15. package/dist/src/cli/dev/tui/traces/trace-viewer-state.d.ts +1 -1
  16. package/dist/src/client/abort-signal.d.ts +2 -0
  17. package/dist/src/client/abort-signal.js +1 -0
  18. package/dist/src/client/conversation-client.d.ts +2 -0
  19. package/dist/src/client/conversation-client.js +1 -1
  20. package/dist/src/client/eve-agent-store-state.d.ts +9 -0
  21. package/dist/src/client/eve-agent-store.js +1 -1
  22. package/dist/src/client/ndjson.js +1 -1
  23. package/dist/src/client/open-stream.js +1 -1
  24. package/dist/src/client/session-turn-dispatch.js +1 -1
  25. package/dist/src/client/session-utils.js +1 -1
  26. package/dist/src/client/session.js +1 -1
  27. package/dist/src/compiled/.vendor-stamp.json +3 -1
  28. package/dist/src/compiled/@eve/tracing/adapters/agent-transport.d.ts +8 -0
  29. package/dist/src/compiled/@eve/tracing/adapters/ai-sdk-payload.d.ts +15 -0
  30. package/dist/src/compiled/@eve/tracing/adapters/ai-sdk-telemetry.d.ts +14 -0
  31. package/dist/src/{tracing/agent-span-id-generator.d.ts → compiled/@eve/tracing/adapters/otel-ids.d.ts} +1 -1
  32. package/dist/src/compiled/@eve/tracing/adapters/otel.d.ts +33 -0
  33. package/dist/src/{tracing/agent-otel-content.d.ts → compiled/@eve/tracing/adapters/serialization.d.ts} +9 -3
  34. package/dist/src/compiled/@eve/tracing/agent-tracing.d.ts +84 -0
  35. package/dist/src/compiled/@eve/tracing/ai-sdk.d.ts +7 -0
  36. package/dist/src/compiled/@eve/tracing/ai-sdk.js +1 -0
  37. package/dist/src/compiled/@eve/tracing/capture.d.ts +5 -0
  38. package/dist/src/compiled/@eve/tracing/core/activation.d.ts +3 -0
  39. package/dist/src/compiled/@eve/tracing/core/attributes.d.ts +14 -0
  40. package/dist/src/{tracing/content-attributes.d.ts → compiled/@eve/tracing/core/content-policy.d.ts} +1 -1
  41. package/dist/src/compiled/@eve/tracing/core/context.d.ts +3 -0
  42. package/dist/src/compiled/@eve/tracing/core/delegation.d.ts +13 -0
  43. package/dist/src/compiled/@eve/tracing/core/mcp.d.ts +24 -0
  44. package/dist/src/compiled/@eve/tracing/core/scopes.d.ts +59 -0
  45. package/dist/src/compiled/@eve/tracing/core/snapshot.d.ts +7 -0
  46. package/dist/src/compiled/@eve/tracing/core/span-kinds.d.ts +12 -0
  47. package/dist/src/compiled/@eve/tracing/core/types.d.ts +297 -0
  48. package/dist/src/compiled/@eve/tracing/core/writer.d.ts +15 -0
  49. package/dist/src/compiled/@eve/tracing/delegation.d.ts +2 -0
  50. package/dist/src/compiled/@eve/tracing/delegation.js +1 -0
  51. package/dist/src/compiled/@eve/tracing/index.d.ts +6 -0
  52. package/dist/src/compiled/@eve/tracing/index.js +1 -0
  53. package/dist/src/compiled/@eve/tracing/operations.d.ts +96 -0
  54. package/dist/src/compiled/@eve/tracing/otel.d.ts +12 -0
  55. package/dist/src/compiled/@eve/tracing/otel.js +1 -0
  56. package/dist/src/compiled/@opentelemetry/api/index.d.ts +4 -0
  57. package/dist/src/compiled/@workflow/world-vercel/index.js +7 -7
  58. package/dist/src/compiled/_chunks/workflow/delegation-BqhZ398D.js +1 -0
  59. package/dist/src/compiled/_chunks/workflow/mcp-C01bDEX-.js +5 -0
  60. package/dist/src/compiler/extension-compatibility.d.ts +6 -6
  61. package/dist/src/compiler/extension-compatibility.js +1 -1
  62. package/dist/src/compiler/project-sources.js +1 -1
  63. package/dist/src/context/build-dynamic-tools.js +1 -1
  64. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  65. package/dist/src/context/memory-tools.js +1 -1
  66. package/dist/src/evals/assertions/collector.d.ts +4 -1
  67. package/dist/src/evals/assertions/collector.js +1 -1
  68. package/dist/src/evals/context.js +1 -1
  69. package/dist/src/evals/index.d.ts +1 -1
  70. package/dist/src/evals/runner/artifacts.js +1 -1
  71. package/dist/src/evals/runner/reporters/assertion-diagnostics.js +2 -2
  72. package/dist/src/evals/runner/reporters/assertion-scores.d.ts +13 -2
  73. package/dist/src/evals/runner/reporters/assertion-scores.js +1 -1
  74. package/dist/src/evals/runner/reporters/braintrust.js +1 -1
  75. package/dist/src/evals/runner/reporters/console.js +1 -1
  76. package/dist/src/evals/runner/reporters/datadog.js +2 -2
  77. package/dist/src/evals/runner/reporters/junit.js +1 -1
  78. package/dist/src/evals/runner/verdict.d.ts +2 -2
  79. package/dist/src/evals/runner/verdict.js +1 -1
  80. package/dist/src/evals/types.d.ts +22 -6
  81. package/dist/src/eve-channel/index.js +1 -1
  82. package/dist/src/eve-channel/request.js +1 -1
  83. package/dist/src/eve-channel/stream-headers.d.ts +1 -0
  84. package/dist/src/eve-channel/stream-headers.js +1 -0
  85. package/dist/src/execution/agent-sessions/context.d.ts +1 -1
  86. package/dist/src/execution/agent-sessions/context.js +1 -1
  87. package/dist/src/execution/agent-sessions/remote.js +1 -1
  88. package/dist/src/execution/agent-sessions/steps.js +1 -1
  89. package/dist/src/execution/authorization-callback-match.d.ts +2 -2
  90. package/dist/src/execution/authorization-callback-match.js +1 -1
  91. package/dist/src/execution/cancelled-model-call-batch.js +1 -1
  92. package/dist/src/execution/catalog/connection-entry.js +1 -1
  93. package/dist/src/execution/durable-session-store.js +1 -1
  94. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  95. package/dist/src/execution/eve-workflow-attributes.js +1 -1
  96. package/dist/src/execution/forward-session-input.js +1 -1
  97. package/dist/src/execution/invoke-tool.d.ts +1 -1
  98. package/dist/src/execution/invoke-tool.js +1 -1
  99. package/dist/src/execution/proxied-deliver-step.js +1 -1
  100. package/dist/src/execution/publish-session-events.d.ts +13 -2
  101. package/dist/src/execution/publish-session-events.js +1 -1
  102. package/dist/src/execution/sandbox/bindings/vercel-create-sdk.js +1 -1
  103. package/dist/src/execution/sandbox/bindings/vercel-credentials.d.ts +2 -0
  104. package/dist/src/execution/sandbox/bindings/vercel-credentials.js +1 -1
  105. package/dist/src/execution/sandbox/bindings/vercel-lifecycle.js +1 -1
  106. package/dist/src/execution/sandbox/bindings/vercel-lookup.js +1 -1
  107. package/dist/src/execution/sandbox/bindings/vercel.d.ts +3 -6
  108. package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
  109. package/dist/src/execution/session/checkpoint-migrations.js +1 -1
  110. package/dist/src/execution/session/handoff-steps.js +1 -1
  111. package/dist/src/execution/session/handoff.d.ts +1 -1
  112. package/dist/src/execution/session/handoff.js +1 -1
  113. package/dist/src/execution/session/input-queue.d.ts +13 -6
  114. package/dist/src/execution/session/input-queue.js +1 -1
  115. package/dist/src/execution/session/pending-turn-state.js +1 -1
  116. package/dist/src/execution/session/turn-step.js +1 -1
  117. package/dist/src/execution/session/turn.d.ts +4 -1
  118. package/dist/src/execution/session/turn.js +1 -1
  119. package/dist/src/execution/tasks/steps.d.ts +1 -1
  120. package/dist/src/execution/tasks/steps.js +1 -1
  121. package/dist/src/execution/tool-auth.js +1 -1
  122. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  123. package/dist/src/execution/tools/workflow/answer.d.ts +1 -1
  124. package/dist/src/execution/tools/workflow/withdraw-step.d.ts +2 -2
  125. package/dist/src/execution/tools/workflow/withdraw-step.js +1 -1
  126. package/dist/src/execution/workflow-callback-url.d.ts +10 -1
  127. package/dist/src/execution/workflow-callback-url.js +1 -1
  128. package/dist/src/execution/workflow-runtime.js +1 -1
  129. package/dist/src/harness/authorization.d.ts +3 -13
  130. package/dist/src/harness/authorization.js +1 -1
  131. package/dist/src/harness/compaction/step.d.ts +1 -0
  132. package/dist/src/harness/compaction/step.js +1 -1
  133. package/dist/src/harness/coordination.js +1 -1
  134. package/dist/src/harness/execute-tool.d.ts +2 -2
  135. package/dist/src/harness/hitl/approvals.d.ts +1 -1
  136. package/dist/src/harness/hitl/approvals.js +1 -1
  137. package/dist/src/harness/hitl/approved-calls.d.ts +3 -0
  138. package/dist/src/harness/hitl/approved-calls.js +1 -1
  139. package/dist/src/harness/hitl/candidates.d.ts +13 -0
  140. package/dist/src/harness/hitl/candidates.js +1 -1
  141. package/dist/src/harness/hitl/coordinator.js +1 -1
  142. package/dist/src/harness/hitl/index.d.ts +2 -5
  143. package/dist/src/harness/hitl/index.js +1 -1
  144. package/dist/src/harness/hitl/intake.js +1 -1
  145. package/dist/src/harness/{proxy-input-requests.d.ts → hitl/relays.d.ts} +3 -39
  146. package/dist/src/harness/hitl/relays.js +1 -0
  147. package/dist/src/harness/hitl/requests.d.ts +64 -0
  148. package/dist/src/harness/hitl/requests.js +1 -0
  149. package/dist/src/harness/hitl/sign-ins.d.ts +9 -0
  150. package/dist/src/harness/hitl/sign-ins.js +1 -0
  151. package/dist/src/harness/inline-tool-authorization.js +1 -1
  152. package/dist/src/harness/input-extraction.js +1 -1
  153. package/dist/src/harness/model-call/call.js +1 -1
  154. package/dist/src/harness/model-call/model.d.ts +3 -1
  155. package/dist/src/harness/model-call/model.js +1 -1
  156. package/dist/src/harness/session-machine/commit.d.ts +14 -3
  157. package/dist/src/harness/session-machine/commit.js +1 -1
  158. package/dist/src/harness/session-machine/transitions.d.ts +16 -0
  159. package/dist/src/harness/session-machine/transitions.js +1 -1
  160. package/dist/src/instrumentation/ai-sdk-hook-bridge.js +1 -1
  161. package/dist/src/instrumentation/dispatch.js +1 -1
  162. package/dist/src/instrumentation/memory.d.ts +1 -4
  163. package/dist/src/instrumentation/memory.js +1 -1
  164. package/dist/src/instrumentation/principal-summary.js +1 -1
  165. package/dist/src/instrumentation/providers.js +1 -1
  166. package/dist/src/instrumentation/runtime-context.d.ts +1 -1
  167. package/dist/src/instrumentation/runtime.d.ts +4 -3
  168. package/dist/src/instrumentation/runtime.js +1 -1
  169. package/dist/src/instrumentation/session-init.js +1 -1
  170. package/dist/src/internal/application/stamped-package-version.js +1 -1
  171. package/dist/src/internal/authored-definition/approval.d.ts +3 -1
  172. package/dist/src/internal/authored-definition/approval.js +1 -1
  173. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  174. package/dist/src/internal/authored-definition/source-identity.d.ts +6 -0
  175. package/dist/src/internal/authored-definition/source-identity.js +1 -1
  176. package/dist/src/internal/authored-module-map-loader.js +1 -1
  177. package/dist/src/internal/helpers/markdown.js +1 -1
  178. package/dist/src/internal/logging.js +1 -1
  179. package/dist/src/internal/nitro/host/local-tracing-runtime-plugin.js +1 -1
  180. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  181. package/dist/src/internal/nitro/routes/channel-request-instrumentation.d.ts +10 -31
  182. package/dist/src/internal/nitro/routes/channel-request-instrumentation.js +1 -1
  183. package/dist/src/internal/nitro/routes/route-invoke-tool.d.ts +1 -1
  184. package/dist/src/internal/workflow/is-inactive-workflow-run-error.d.ts +2 -0
  185. package/dist/src/internal/workflow/is-inactive-workflow-run-error.js +1 -1
  186. package/dist/src/internal/workflow-bundle/dynamic-tool-transform.js +1 -1
  187. package/dist/src/protocol/baggage.d.ts +1 -0
  188. package/dist/src/protocol/baggage.js +1 -1
  189. package/dist/src/public/channels/slack/hitl.js +1 -1
  190. package/dist/src/public/definitions/approval.d.ts +1 -1
  191. package/dist/src/public/definitions/connections/mcp.js +1 -1
  192. package/dist/src/public/definitions/connections/openapi.js +1 -1
  193. package/dist/src/public/instrumentation/otel.d.ts +2 -2
  194. package/dist/src/public/instrumentation/otel.js +1 -1
  195. package/dist/src/public/sandbox/vercel.d.ts +2 -0
  196. package/dist/src/public/tools/approval/index.d.ts +1 -1
  197. package/dist/src/public/tools/index.d.ts +1 -1
  198. package/dist/src/public/tools/result.d.ts +10 -7
  199. package/dist/src/react/use-eve-agent.d.ts +6 -0
  200. package/dist/src/react/use-eve-agent.js +1 -1
  201. package/dist/src/runtime/authorization-context.d.ts +5 -0
  202. package/dist/src/runtime/authorization-context.js +1 -1
  203. package/dist/src/runtime/connections/mcp-tracing.d.ts +10 -18
  204. package/dist/src/runtime/connections/mcp-tracing.js +1 -1
  205. package/dist/src/runtime/connections/openapi-operations.js +1 -1
  206. package/dist/src/runtime/connections/scoped-authorization.d.ts +6 -0
  207. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  208. package/dist/src/runtime/resolve-connection.js +1 -1
  209. package/dist/src/runtime/resolve-tool.js +1 -1
  210. package/dist/src/runtime/types.d.ts +2 -2
  211. package/dist/src/self-modification/extension/subagents/agent/tools/inspect_trace.d.ts +12 -12
  212. package/dist/src/self-modification/extension/subagents/agent/tools/inspect_trace.js +1 -1
  213. package/dist/src/self-modification/extension/subagents/agent/tools/search_traces.d.ts +1 -1
  214. package/dist/src/self-modification/extension/subagents/agent/tools/search_traces.js +1 -1
  215. package/dist/src/self-modification/extension/trace-inspection.d.ts +1 -1
  216. package/dist/src/self-modification/extension/trace-inspection.js +1 -1
  217. package/dist/src/setup/scaffold/create/project.js +1 -1
  218. package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
  219. package/dist/src/setup/scaffold/create/web-template.js +18 -10
  220. package/dist/src/shared/git.js +1 -1
  221. package/dist/src/shared/instrumentation-content.d.ts +1 -1
  222. package/dist/src/shared/instrumentation-content.js +1 -1
  223. package/dist/src/shared/instrumentation-decision.d.ts +3 -0
  224. package/dist/src/shared/instrumentation-decision.js +1 -1
  225. package/dist/src/shared/skill-package.js +1 -1
  226. package/dist/src/shared/trace-policy.d.ts +3 -0
  227. package/dist/src/shared/trace-policy.js +1 -1
  228. package/dist/src/subagents/adapter.js +1 -1
  229. package/dist/src/subagents/event-proxy-step.d.ts +1 -1
  230. package/dist/src/subagents/event-proxy-step.js +1 -1
  231. package/dist/src/subagents/hitl-proxy.d.ts +1 -1
  232. package/dist/src/subagents/hitl-proxy.js +1 -1
  233. package/dist/src/svelte/index.js +1 -1
  234. package/dist/src/svelte/use-eve-agent.d.ts +6 -0
  235. package/dist/src/svelte/use-eve-agent.js +1 -1
  236. package/dist/src/tools/definition.d.ts +41 -4
  237. package/dist/src/tools/durable-callbacks.d.ts +5 -3
  238. package/dist/src/tools/durable-callbacks.js +1 -1
  239. package/dist/src/tools/dynamic.d.ts +2 -2
  240. package/dist/src/tools/provided/ask-question-workflow.js +1 -1
  241. package/dist/src/tools/provided/sleep-workflow.js +1 -1
  242. package/dist/src/tools/workflow-definition.d.ts +2 -2
  243. package/dist/src/tracing/eve/agent-approval-instrumentation.d.ts +8 -0
  244. package/dist/src/tracing/eve/agent-approval-instrumentation.js +1 -0
  245. package/dist/src/tracing/{agent-channel-delivery-instrumentation.d.ts → eve/agent-channel-delivery-instrumentation.d.ts} +1 -1
  246. package/dist/src/tracing/{agent-channel-delivery-instrumentation.js → eve/agent-channel-delivery-instrumentation.js} +1 -1
  247. package/dist/src/tracing/eve/agent-invocation-coordinator.js +1 -0
  248. package/dist/src/tracing/eve/agent-memory-instrumentation.d.ts +12 -0
  249. package/dist/src/tracing/eve/agent-memory-instrumentation.js +1 -0
  250. package/dist/src/tracing/{agent-otel-provider.d.ts → eve/agent-otel-provider.d.ts} +6 -8
  251. package/dist/src/tracing/eve/agent-otel-provider.js +1 -0
  252. package/dist/src/tracing/eve/agent-tool-instrumentation.d.ts +44 -0
  253. package/dist/src/tracing/eve/agent-tool-instrumentation.js +1 -0
  254. package/dist/src/tracing/{agent-trace-context-store.d.ts → eve/agent-trace-context-store.d.ts} +8 -16
  255. package/dist/src/tracing/eve/agent-trace-context-store.js +1 -0
  256. package/dist/src/tracing/eve/agent-trace-context.js +1 -0
  257. package/dist/src/tracing/eve/agent-trace-state.d.ts +75 -0
  258. package/dist/src/tracing/{batch-span-processor.d.ts → eve/batch-span-processor.d.ts} +5 -1
  259. package/dist/src/tracing/eve/batch-span-processor.js +1 -0
  260. package/dist/src/tracing/{content-span-processor.d.ts → eve/content-span-processor.d.ts} +1 -1
  261. package/dist/src/tracing/eve/content-span-processor.js +1 -0
  262. package/dist/src/tracing/eve/delegation.d.ts +20 -0
  263. package/dist/src/tracing/eve/delegation.js +1 -0
  264. package/dist/src/tracing/eve/gateway.d.ts +17 -0
  265. package/dist/src/tracing/eve/gateway.js +1 -0
  266. package/dist/src/tracing/{install-instrumentation-runtime.d.ts → eve/install-instrumentation-runtime.d.ts} +1 -1
  267. package/dist/src/tracing/eve/install-instrumentation-runtime.js +1 -0
  268. package/dist/src/tracing/eve/invoke-tool-span.js +1 -0
  269. package/dist/src/tracing/eve/mcp.d.ts +29 -0
  270. package/dist/src/tracing/eve/mcp.js +1 -0
  271. package/dist/src/tracing/eve/metadata.d.ts +7 -0
  272. package/dist/src/tracing/eve/metadata.js +1 -0
  273. package/dist/src/tracing/eve/operation-input.d.ts +30 -0
  274. package/dist/src/tracing/eve/operation-input.js +1 -0
  275. package/dist/src/tracing/eve/otel-configuration.d.ts +70 -0
  276. package/dist/src/tracing/eve/otel-configuration.js +1 -0
  277. package/dist/src/tracing/{otel-declaration.d.ts → eve/otel-declaration.d.ts} +13 -19
  278. package/dist/src/tracing/eve/otel-declaration.js +1 -0
  279. package/dist/src/tracing/{otel-registration.d.ts → eve/otel-registration.d.ts} +12 -5
  280. package/dist/src/tracing/eve/otel-registration.js +1 -0
  281. package/dist/src/tracing/eve/policy.d.ts +15 -0
  282. package/dist/src/tracing/eve/policy.js +1 -0
  283. package/dist/src/tracing/eve/profile.d.ts +7 -0
  284. package/dist/src/tracing/eve/profile.js +1 -0
  285. package/dist/src/tracing/eve/session.d.ts +27 -0
  286. package/dist/src/tracing/eve/session.js +1 -0
  287. package/dist/src/tracing/{vercel-runtime-span-exporter.d.ts → eve/vercel-runtime-span-exporter.d.ts} +1 -1
  288. package/dist/src/tracing/local/agent-trace-span-processor.js +1 -0
  289. package/dist/src/tracing/local/inspection.d.ts +15 -0
  290. package/dist/src/tracing/local/inspection.js +1 -0
  291. package/dist/src/tracing/{local-instrumentation-runtime.d.ts → local/instrumentation-runtime.d.ts} +1 -1
  292. package/dist/src/tracing/local/instrumentation-runtime.js +1 -0
  293. package/dist/src/tracing/{local-trace-analysis.d.ts → local/trace-analysis.d.ts} +2 -2
  294. package/dist/src/tracing/{local-trace-analysis.js → local/trace-analysis.js} +1 -1
  295. package/dist/src/tracing/{local-trace-operations.d.ts → local/trace-operations.d.ts} +1 -1
  296. package/dist/src/tracing/{local-trace-query.d.ts → local/trace-query.d.ts} +1 -1
  297. package/dist/src/tracing/local/trace-reader.js +1 -0
  298. package/dist/src/tracing/{local-trace-retention.js → local/trace-retention.js} +1 -1
  299. package/dist/src/tracing/{local-trace-span-processor.js → local/trace-span-processor.js} +1 -1
  300. package/dist/src/tracing/{local-trace-summary.d.ts → local/trace-summary.d.ts} +1 -1
  301. package/dist/src/tracing/local/trace-summary.js +1 -0
  302. package/dist/src/tracing/{local-traces.d.ts → local/traces.d.ts} +1 -1
  303. package/dist/src/tracing/local/traces.js +1 -0
  304. package/dist/src/vue/index.js +1 -1
  305. package/dist/src/vue/use-eve-agent.d.ts +6 -0
  306. package/dist/src/vue/use-eve-agent.js +1 -1
  307. package/docs/agent-config.md +48 -0
  308. package/docs/channels/eve.mdx +2 -0
  309. package/docs/connections/mcp.mdx +22 -1
  310. package/docs/connections/overview.mdx +9 -6
  311. package/docs/evals/assertions.mdx +50 -3
  312. package/docs/evals/overview.mdx +2 -1
  313. package/docs/evals/reporters.mdx +3 -1
  314. package/docs/guides/frontend/overview.mdx +10 -1
  315. package/docs/guides/hooks.md +2 -2
  316. package/docs/guides/instrumentation/otel.mdx +3 -0
  317. package/docs/reference/cli.md +1 -1
  318. package/docs/reference/typescript-api.md +7 -6
  319. package/docs/sandbox/vercel.mdx +9 -0
  320. package/docs/skills.mdx +1 -1
  321. package/docs/tools/human-in-the-loop.md +44 -1
  322. package/package.json +2 -1
  323. package/dist/src/harness/proxy-input-requests.js +0 -1
  324. package/dist/src/tracing/agent-approval-instrumentation.d.ts +0 -11
  325. package/dist/src/tracing/agent-approval-instrumentation.js +0 -1
  326. package/dist/src/tracing/agent-invocation-coordinator.js +0 -1
  327. package/dist/src/tracing/agent-memory-instrumentation.d.ts +0 -16
  328. package/dist/src/tracing/agent-memory-instrumentation.js +0 -1
  329. package/dist/src/tracing/agent-otel-attributes.d.ts +0 -10
  330. package/dist/src/tracing/agent-otel-attributes.js +0 -1
  331. package/dist/src/tracing/agent-otel-content.js +0 -4
  332. package/dist/src/tracing/agent-otel-provider.js +0 -2
  333. package/dist/src/tracing/agent-otel-runtime-context.d.ts +0 -36
  334. package/dist/src/tracing/agent-otel-runtime-context.js +0 -1
  335. package/dist/src/tracing/agent-otel-session-context.d.ts +0 -22
  336. package/dist/src/tracing/agent-otel-session-context.js +0 -1
  337. package/dist/src/tracing/agent-otel-turn-state.d.ts +0 -6
  338. package/dist/src/tracing/agent-otel-turn-state.js +0 -1
  339. package/dist/src/tracing/agent-otel-usage.d.ts +0 -10
  340. package/dist/src/tracing/agent-otel-usage.js +0 -1
  341. package/dist/src/tracing/agent-span-contract.d.ts +0 -34
  342. package/dist/src/tracing/agent-span-contract.js +0 -1
  343. package/dist/src/tracing/agent-span-error.js +0 -1
  344. package/dist/src/tracing/agent-span-id-generator.js +0 -1
  345. package/dist/src/tracing/agent-span-naming.d.ts +0 -1
  346. package/dist/src/tracing/agent-span-naming.js +0 -1
  347. package/dist/src/tracing/agent-tool-instrumentation.d.ts +0 -40
  348. package/dist/src/tracing/agent-tool-instrumentation.js +0 -1
  349. package/dist/src/tracing/agent-tool-span-context.d.ts +0 -16
  350. package/dist/src/tracing/agent-tool-span-context.js +0 -1
  351. package/dist/src/tracing/agent-trace-context-codec.d.ts +0 -15
  352. package/dist/src/tracing/agent-trace-context-codec.js +0 -1
  353. package/dist/src/tracing/agent-trace-context-store.js +0 -1
  354. package/dist/src/tracing/agent-trace-context.js +0 -1
  355. package/dist/src/tracing/agent-trace-span-processor.js +0 -1
  356. package/dist/src/tracing/agent-trace-state.d.ts +0 -91
  357. package/dist/src/tracing/batch-span-processor.js +0 -1
  358. package/dist/src/tracing/bounded-error.d.ts +0 -1
  359. package/dist/src/tracing/bounded-error.js +0 -1
  360. package/dist/src/tracing/content-attributes.js +0 -1
  361. package/dist/src/tracing/content-span-processor.js +0 -1
  362. package/dist/src/tracing/error-content-context.d.ts +0 -3
  363. package/dist/src/tracing/error-content-context.js +0 -1
  364. package/dist/src/tracing/install-instrumentation-runtime.js +0 -1
  365. package/dist/src/tracing/invoke-tool-span.js +0 -1
  366. package/dist/src/tracing/local-instrumentation-runtime.js +0 -1
  367. package/dist/src/tracing/local-trace-reader.js +0 -1
  368. package/dist/src/tracing/local-trace-summary.js +0 -1
  369. package/dist/src/tracing/local-traces.js +0 -1
  370. package/dist/src/tracing/otel-declaration.js +0 -1
  371. package/dist/src/tracing/otel-registration.js +0 -1
  372. package/dist/src/tracing/sampled-trace.d.ts +0 -4
  373. package/dist/src/tracing/sampled-trace.js +0 -1
  374. package/dist/src/tracing/suppress-tracing.d.ts +0 -2
  375. package/dist/src/tracing/suppress-tracing.js +0 -1
  376. package/dist/src/tracing/telemetry-budget.d.ts +0 -3
  377. package/dist/src/tracing/telemetry-budget.js +0 -1
  378. /package/dist/src/{tracing/agent-span-error.d.ts → compiled/@eve/tracing/adapters/otel-error.d.ts} +0 -0
  379. /package/dist/src/tracing/{agent-invocation-coordinator.d.ts → eve/agent-invocation-coordinator.d.ts} +0 -0
  380. /package/dist/src/tracing/{agent-trace-context.d.ts → eve/agent-trace-context.d.ts} +0 -0
  381. /package/dist/src/tracing/{agent-trace-state.js → eve/agent-trace-state.js} +0 -0
  382. /package/dist/src/tracing/{channel-audience-context.d.ts → eve/channel-audience-context.d.ts} +0 -0
  383. /package/dist/src/tracing/{channel-audience-context.js → eve/channel-audience-context.js} +0 -0
  384. /package/dist/src/tracing/{conversation-context.d.ts → eve/conversation-context.d.ts} +0 -0
  385. /package/dist/src/tracing/{conversation-context.js → eve/conversation-context.js} +0 -0
  386. /package/dist/src/tracing/{invoke-tool-span.d.ts → eve/invoke-tool-span.d.ts} +0 -0
  387. /package/dist/src/tracing/{span-export-policy.d.ts → eve/span-export-policy.d.ts} +0 -0
  388. /package/dist/src/tracing/{span-export-policy.js → eve/span-export-policy.js} +0 -0
  389. /package/dist/src/tracing/{vercel-runtime-span-exporter.js → eve/vercel-runtime-span-exporter.js} +0 -0
  390. /package/dist/src/tracing/{agent-trace-span-processor.d.ts → local/agent-trace-span-processor.d.ts} +0 -0
  391. /package/dist/src/tracing/{local-trace-discovery-index.d.ts → local/trace-discovery-index.d.ts} +0 -0
  392. /package/dist/src/tracing/{local-trace-discovery-index.js → local/trace-discovery-index.js} +0 -0
  393. /package/dist/src/tracing/{local-trace-operations.js → local/trace-operations.js} +0 -0
  394. /package/dist/src/tracing/{local-trace-query.js → local/trace-query.js} +0 -0
  395. /package/dist/src/tracing/{local-trace-reader.d.ts → local/trace-reader.d.ts} +0 -0
  396. /package/dist/src/tracing/{local-trace-retention.d.ts → local/trace-retention.d.ts} +0 -0
  397. /package/dist/src/tracing/{local-trace-span-processor.d.ts → local/trace-span-processor.d.ts} +0 -0
@@ -104,6 +104,12 @@ export interface UseEveAgentOptions<TData> extends EveAgentStoreCallbacks<TData>
104
104
  readonly optimistic?: boolean;
105
105
  /** Follow each subagent call's session into `conversation.agents` while mounted. @default false */
106
106
  readonly followSubagents?: boolean;
107
+ /**
108
+ * Keep the session stream open between turns to show events that arrive from schedules,
109
+ * channels, or other clients. Set to false to close it once the session is idle and reopen it
110
+ * on the next send, answer, or resume. @default true
111
+ */
112
+ readonly followIdle?: boolean;
107
113
  /** Prewarm an owned session on mount and after reset. @default false */
108
114
  readonly prewarm?: boolean;
109
115
  /**
@@ -1,3 +1,3 @@
1
- import { t as useEveAgent } from "../chunks/use-eve-agent-B8brxCk-.js";
1
+ import { t as useEveAgent } from "../chunks/use-eve-agent-Vsl-S0yI.js";
2
2
 
3
3
  export { useEveAgent };
@@ -75,6 +75,54 @@ prefix. Each subagent session gets its own key. An authored
75
75
  in the `session-id` header, which the Codex backend uses for cache routing.
76
76
  Gateway-routed calls do not receive the option.
77
77
 
78
+ ### Use a local model
79
+
80
+ To test against a model running on your own machine, point the AI SDK
81
+ [OpenAI-compatible provider](https://ai-sdk.dev/providers/openai-compatible-providers)
82
+ at a local server. This works with any server that implements the OpenAI Chat
83
+ Completions API, such as Ollama, LM Studio, llama.cpp, or vLLM. With
84
+ [Ollama](https://docs.ollama.com/api/openai-compatibility):
85
+
86
+ ```bash
87
+ pnpm add @ai-sdk/openai-compatible
88
+ ollama pull gpt-oss:20b
89
+ OLLAMA_CONTEXT_LENGTH=64000 ollama serve
90
+ ```
91
+
92
+ ```ts title="agent/agent.ts"
93
+ import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
94
+ import { defineAgent } from "eve";
95
+
96
+ const ollama = createOpenAICompatible({
97
+ name: "ollama",
98
+ baseURL: "http://localhost:11434/v1",
99
+ includeUsage: true, // report token usage while streaming
100
+ });
101
+
102
+ export default defineAgent({
103
+ model: ollama("gpt-oss:20b"),
104
+ modelContextWindowTokens: 64_000,
105
+ });
106
+ ```
107
+
108
+ - **Context window.** AI Gateway has no metadata for local models, so set
109
+ `modelContextWindowTokens` to the context length your server allocates, not
110
+ the model's maximum. eve uses it to decide when to compact. Ollama allocates
111
+ as little as 4K tokens by default; raise it to at least 64K for agents, as
112
+ above.
113
+ - **Tool calling.** eve agents call tools on most turns, so pick a model with
114
+ native tool-calling support. `gpt-oss:20b`, `qwen3`, and `gemma4` are good
115
+ starting points on Ollama.
116
+ - **Usage.** `includeUsage: true` lets token usage reach eve's
117
+ [session limits](#runtime-limits). Local models report no cost, so
118
+ `maxTokenCostUsdPerSession` does not apply.
119
+ - **Other servers.** Change `baseURL`, for example to
120
+ `http://localhost:1234/v1` for LM Studio. Pass `apiKey` for a remote
121
+ OpenAI-compatible server that requires one.
122
+
123
+ A deployment cannot reach a server on your machine, so use a Gateway or hosted
124
+ provider model when you deploy.
125
+
78
126
  ### Choose the model dynamically
79
127
 
80
128
  To select a model from the incoming prompt with an AI SDK decision model, use
@@ -203,6 +203,8 @@ Stream a session as newline-delimited JSON from `GET /eve/v1/session/:sessionId/
203
203
 
204
204
  Following a stranded session's stream returns `409 session_stranded`, just like a send. The TypeScript client reports `ClientSessionStrandedError` without retrying. Pass `follow=false` to read the recorded history instead: the response ends at the durable tail, carries the `x-eve-stream-tail-index` header, and never inspects or changes the session, so it works before a reset. A reset attempts to append `session.failed` with code `session_stranded` and close the stream. Existing readers finish when they receive that terminal event.
205
205
 
206
+ After a session ends, the World keeps its stream only for its retention period. Reading a stream past that point returns `410 session_expired`. The history is gone, so the TypeScript client fails on the first response with a `ClientError` whose `code` is `"session_expired"`, without retrying.
207
+
206
208
  ### Cancel a turn
207
209
 
208
210
  Post to `/eve/v1/session/:sessionId/cancel` to request cancellation of the active turn. You can include the observed `turnId` to keep a late request from cancelling a newer turn. Cancellation is asynchronous; confirm the turn boundary on the stream as `turn.cancelled` followed by `session.waiting`.
@@ -115,7 +115,7 @@ Use the shared `approval` option to gate every tool served by an MCP connection.
115
115
 
116
116
  ### Gate specific tools by name or input
117
117
 
118
- A remote MCP server usually mixes read tools with destructive or publishing ones, so a blanket `always()` would prompt on every harmless call. Pass a custom policy instead — the same [`Approval`](/docs/human-in-the-loop#approvals) shape authored tools use — to gate only the calls that matter. The policy receives `{ session, toolName, toolInput, approvedTools, callId, abortSignal }` and returns an approval status, synchronously or as a promise.
118
+ A remote MCP server usually mixes read tools with destructive or publishing ones, so a blanket `always()` would prompt on every harmless call. Pass a custom policy instead — the same [`Approval`](/docs/human-in-the-loop#approvals) shape authored tools use — to gate only the calls that matter. The policy receives `{ session, toolName, toolInput, toolAnnotations, approvedTools, callId, abortSignal }` and returns an approval status, synchronously or as a promise.
119
119
 
120
120
  This connection always gates deletes, gates a publish only when the call actually schedules a post, and lets everything else through:
121
121
 
@@ -157,6 +157,27 @@ Two details are specific to connection tools:
157
157
 
158
158
  Return `"user-approval"` (or `true`) to pause for a person and `"not-applicable"` (or `false`) to run without a prompt; return `"approved"` or `"denied"` to decide automatically without involving anyone.
159
159
 
160
+ ### Gate by the server's tool annotations
161
+
162
+ Many MCP servers declare [tool annotations](https://modelcontextprotocol.io/specification/2025-06-18/server/tools#tool) such as `readOnlyHint` and `destructiveHint` for each tool. eve passes what the server declared for the called tool as `toolAnnotations`, typed as `ConnectionToolAnnotations` from `eve/tools/approval`. It is `undefined` when the server declares none, so keep a fallback:
163
+
164
+ ```ts title="agent/connections/linear.ts"
165
+ import { connect } from "@vercel/connect/eve";
166
+ import { defineMcpClientConnection } from "eve/connections";
167
+
168
+ export default defineMcpClientConnection({
169
+ url: "https://mcp.linear.app/mcp",
170
+ description: "Linear issues and projects.",
171
+ auth: connect("mcp.linear.app/linear"),
172
+ approval: ({ toolAnnotations }) => {
173
+ if (toolAnnotations?.readOnlyHint === true) return "not-applicable";
174
+ return "user-approval";
175
+ },
176
+ });
177
+ ```
178
+
179
+ Annotations are hints from the server, not guarantees. Trust them only as far as you trust the server that sent them.
180
+
160
181
  [Human-in-the-loop](/docs/human-in-the-loop#approvals) covers the full set of statuses, how `approvedTools` and `session.auth` factor in, and how a gated call pauses and resumes durably.
161
182
 
162
183
  ## Forward the caller to an eve agent
@@ -254,12 +254,13 @@ App-scoped Connect auth is non-interactive. eve asks Vercel Connect for an app t
254
254
 
255
255
  ### Troubleshooting Vercel Connect auth
256
256
 
257
- | Symptom | What it means | Fix |
258
- | -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
259
- | `reason: "principal_required"` | A user-scoped connection ran without an authenticated user on the active session. | Return `principalType: "user"` from the channel's route auth, or use `connect({ connector, principalType: "app" })` if the Connect credential should be shared. |
260
- | `authorization.required` appears but no UI | eve parked the turn for OAuth, but the channel or frontend is not rendering the challenge. | Render the challenge from the stream event and continue the same session after the callback. |
261
- | OAuth works locally but fails after deploy | The project may not be linked to the Connect client, or the deployed runtime may not have the expected Vercel OIDC/project scope. | Run Connect setup from the consuming project directory, link the project, deploy again, and verify the connector UID in `connect("...")`. |
262
- | A scheduled or internal run needs user OAuth | Schedules and runtime callers do not automatically carry an end-user principal. | Dispatch through a user-authenticated channel when work is user-owned, or use app-scoped auth for agent-owned background work. |
257
+ | Symptom | What it means | Fix |
258
+ | ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
259
+ | `reason: "principal_required"` | A user-scoped connection ran without an authenticated user on the active session. | Return `principalType: "user"` from the channel's route auth, or use `connect({ connector, principalType: "app" })` if the Connect credential should be shared. |
260
+ | `authorization.required` appears but no UI | eve parked the turn for OAuth, but the channel or frontend is not rendering the challenge. | Render the challenge from the stream event and continue the same session after the callback. |
261
+ | OAuth works locally but fails after deploy | The project may not be linked to the Connect client, or the deployed runtime may not have the expected Vercel OIDC/project scope. | Run Connect setup from the consuming project directory, link the project, deploy again, and verify the connector UID in `connect("...")`. |
262
+ | A scheduled or internal run needs user OAuth | Schedules and runtime callers do not automatically carry an end-user principal. | Dispatch through a user-authenticated channel when work is user-owned, or use app-scoped auth for agent-owned background work. |
263
+ | Sign-in ends on a Vercel login or protection page | The deployment is behind Deployment Protection, and sign-in callback URLs never carry the automation bypass secret. | Have the user sign in to Vercel with access to the project, or add a Deployment Protection Exception for the domain. |
263
264
 
264
265
  ## Self-hosted interactive OAuth
265
266
 
@@ -316,6 +317,8 @@ export default defineMcpClientConnection({
316
317
 
317
318
  Drop `resume` when the provider keeps flow state server-side, so nothing has to cross the step boundary.
318
319
 
320
+ The callback URL never carries `VERCEL_AUTOMATION_BYPASS_SECRET`, because the user's browser and the provider both see it. On a deployment behind [Deployment Protection](https://vercel.com/docs/deployment-protection), the person signing in must pass protection on their own, for example through Vercel Authentication or a [Deployment Protection Exception](https://vercel.com/docs/deployment-protection/methods-to-bypass-deployment-protection/deployment-protection-exceptions).
321
+
319
322
  `displayName` is presentation-only. The connection's resolved name still keys
320
323
  the callback URL, while eve scopes token caching and authorization completion
321
324
  to the opaque resolved instance identity. You can also set `displayName` on the
@@ -3,7 +3,7 @@ title: "Assertions"
3
3
  description: "Scoped methods, value assertions, the matcher mini-language, and gate vs soft severity."
4
4
  ---
5
5
 
6
- Assertions are how an eval grades what its `test(t)` function produced. Each one records a result and returns a chainable handle. The runner reads every recorded result to compute the verdict, so a single run reports every failing assertion rather than dying on the first. There are two deterministic surfaces: scoped methods and `t.check` for grading a specific value. For model-graded assertions, see [Judge](./judge).
6
+ Assertions are how an eval grades what its `test(t)` function produced. Each one records a result and returns a chainable handle. The runner reads every recorded result to compute the verdict, so a single run reports every failing assertion rather than dying on the first. There are three deterministic surfaces: scoped methods, `t.check` for grading a specific value, and `t.score` for recording a measurement you computed yourself. For model-graded assertions, see [Judge](./judge).
7
7
 
8
8
  ## Scoped assertions
9
9
 
@@ -83,6 +83,53 @@ For example, a failed labeled equality check prints:
83
83
 
84
84
  Pick the cheapest builder that captures what "correct" means. When exact match is too strict but a judge model is overkill, `similarity` is the middle ground. For nuanced grading, reach for the [judge](./judge).
85
85
 
86
+ ## Scores with `t.score`
87
+
88
+ `t.score(evaluation)` records a score from 0 to 1. The evaluation is the number or `{ score, message?, metadata? }`, or a promise of either. Chain `.label(key)` to name it; reporters and artifacts expose the label as `key`. Without a label the score reports as `score`, and several unlabeled scores share that name.
89
+
90
+ ```ts
91
+ const reply = turn.message ?? "";
92
+ t.score({
93
+ score: Math.max(0, 1 - reply.length / 400),
94
+ metadata: { length: reply.length },
95
+ }).label("reply-brevity");
96
+ t.score(gradeFaithfulness(reply, reference)).label("faithfulness"); // async
97
+ ```
98
+
99
+ On its own a score has no verdict and does not affect the eval's outcome. Chain a rule when it should:
100
+
101
+ ```ts
102
+ t.score(gradeFaithfulness(reply, reference)).label("faithfulness").gate(0.9); // fails below 0.9
103
+ t.score(brevity).label("reply-brevity").atLeast(0.5); // marks the eval `scored`, fatal under --strict
104
+ ```
105
+
106
+ The score is reported as measured. A `0.82` gated at `0.9` is reported as `score: 0.82`, `threshold: 0.9`, `passed: false`. An evaluator that throws or returns a score outside 0 to 1 records an errored outcome with the error message and no score, and fails the eval.
107
+
108
+ Every [reporter](./reporters#custom-reporters) receives the entries in `onEvalComplete` and can read them by `key`:
109
+
110
+ ```ts
111
+ onEvalComplete(result) {
112
+ for (const { key, score, threshold, passed } of result.assertions) {
113
+ if (key === undefined) continue;
114
+ store.write({ evalId: result.id, key, score, threshold, passed });
115
+ }
116
+ }
117
+ ```
118
+
119
+ The same entries land in the [run artifacts](./running#artifacts) under `.eve/evals/`, in `summary.json` and one line per eval in `results.jsonl`:
120
+
121
+ ```json
122
+ {
123
+ "name": "score [reply-brevity]",
124
+ "key": "reply-brevity",
125
+ "score": 0.84,
126
+ "severity": "soft",
127
+ "errored": false
128
+ }
129
+ ```
130
+
131
+ `threshold` and `passed` are present only when a rule was chained.
132
+
86
133
  ## The matcher mini-language
87
134
 
88
135
  `t.calledTool` and `t.calledSubagent` take matcher objects. Tools accept `{ input, output, status, count }`; subagents accept `{ callId, childSessionId, remoteUrl, output, status, count }`. Calls match `status: "completed"` by default. Tool lifecycle checks also accept `"pending"`, `"failed"`, and `"rejected"`. Subagent checks accept `"working"`, `"completed"`, `"failed"`, and `"cancelled"`. A numeric `count` requires an exact number of calls matching every supplied constraint. Use a predicate for ranges or other custom count requirements; it receives the observed number of matching calls.
@@ -164,9 +211,9 @@ const request = session.requireInputRequest({ toolName: "guarded" });
164
211
  Every assertion returns a chainable handle. Severity rides on the assertion, so there is no separate thresholds map to keep in sync.
165
212
 
166
213
  - `.gate(threshold?)` is hard. A miss marks the eval `failed` and `eve eval` exits non-zero.
167
- - `.soft(threshold?)` is tracked data. A below-threshold miss marks the eval `scored`, fatal only under `--strict`. With no threshold, it is tracked-only and never fails.
214
+ - `.soft(threshold?)` is tracked data. A below-threshold miss marks the eval `scored`, fatal only under `--strict`. With no threshold it records no verdict and never fails.
168
215
  - `.atLeast(threshold)` is soft with a bar (equivalent to `.soft(threshold)`).
169
- - `.label(name)` adds a stable name when an eval records several assertions from the same family.
216
+ - `.label(key)` adds a stable name when an eval records several assertions from the same family. Reporters and artifacts expose it as `key`. Braintrust and Datadog keep one score per name, so `eve eval` warns when soft assertions in one eval share a name with different scores.
170
217
 
171
218
  The defaults are chosen so you rarely set severity. Run-level methods and `includes`/`equals`/`matches` are gates; `similarity` and every `t.judge(...)` assertion are soft. Annotate only when you deviate:
172
219
 
@@ -154,6 +154,7 @@ Each surface matches a genuinely different kind of judgment:
154
154
 
155
155
  - **Scoped methods** read the final whole run on `t`, snapshot one independent session when invoked there, or inspect one immutable `EveEvalTurn`. See [Assertions](./assertions).
156
156
  - **`t.check(value, assertion)`** grades an explicit value with a deterministic builder from `eve/evals/expect`, such as `t.check(turn.message, includes("sunny"))`. Grade `turn.message`, an intermediate draft, parsed JSON, or anything else. See [Assertions](./assertions).
157
+ - **`t.score(evaluation)`** records a score, such as a length ratio or an evaluator's result. Chain `.label(key)` to name it, and `.gate(threshold)` or `.atLeast(threshold)` to let it decide the eval. See [Assertions](./assertions#scores-with-tscore).
157
158
  - **`t.judge(...)`** is the LLM-as-judge surface, like `t.judge("cites a source")`. It grades the most recently settled turn’s assistant message by default; pass `{ on: turn.session.transcript }` to grade a multi-turn conversation. The judge uses the configured judge model, never the agent under test. See [Judge](./judge).
158
159
 
159
160
  ## Gate vs soft
@@ -161,7 +162,7 @@ Each surface matches a genuinely different kind of judgment:
161
162
  Every assertion returns a chainable handle, so severity rides on the assertion itself. There is no separate thresholds map.
162
163
 
163
164
  - **Gates** are hard. A failed gate marks the eval `failed` and `eve eval` exits non-zero. Run-level methods, `includes`, `equals`, and `matches` are gates by default.
164
- - **Soft** assertions are tracked data. They land in reports and artifacts, and a below-threshold soft assertion marks the eval `scored` (visible but not fatal, unless you pass `--strict`). `similarity` and every `t.judge(...)` assertion are soft by default. A soft assertion with no threshold is tracked-only and never fails.
165
+ - **Soft** assertions are tracked data. They land in reports and artifacts, and a below-threshold soft assertion marks the eval `scored` (visible but not fatal, unless you pass `--strict`). `similarity`, every `t.judge(...)` assertion, and every `t.score(...)` are soft by default. A soft assertion with no threshold records no verdict and never fails.
165
166
 
166
167
  Override per assertion: `.gate(threshold?)` promotes to a hard gate, `.soft(threshold?)` demotes to tracked, and `.atLeast(threshold)` is a soft assertion with a bar.
167
168
 
@@ -38,7 +38,7 @@ export default defineEval({
38
38
  });
39
39
  ```
40
40
 
41
- The reporter config takes an optional `projectName` and `experimentName`, plus a base experiment (by name or id) to diff against. Gate assertions log as binary scores under a `gate:` prefix so experiments diff gate regressions the same way they diff soft-score regressions. Assertions that share a name, such as several unlabeled judges, log one score: the lowest. Use `.label(name)` to group or separate them. Each assertion's score is stored in the Braintrust metadata under `eveAssertionScores` and failed assertion details under `eveFailedAssertions`; observed traces are stored under `eveTraceIds` and `eveTraceContexts`.
41
+ The reporter config takes an optional `projectName` and `experimentName`, plus a base experiment (by name or id) to diff against. Gate assertions log as binary scores under a `gate:` prefix so experiments diff gate regressions the same way they diff soft-score regressions. Assertions that share a name, such as several unlabeled judges, log one score: the lowest. The console warns under the eval when merged soft scores differ; use `.label(name)` to group or separate them. Errored assertions log no score. Each assertion's score is stored in the Braintrust metadata under `eveAssertionScores` and failed assertion details under `eveFailedAssertions`; observed traces are stored under `eveTraceIds` and `eveTraceContexts`.
42
42
 
43
43
  A reporter instance observes the evals that reference it. Share one instance across several evals (the config, a `shared.ts` export, or every entry of a dataset array) and their results land in a single experiment. Listing the same config reporter on an eval too does not double-report it.
44
44
 
@@ -97,6 +97,8 @@ interface EvalReporter {
97
97
  - `onSessionStart` fires once for each session after eve receives its first trace context. It includes `sessionId`, `primary`, and `traceContext` with `traceId`, `spanId`, and `traceFlags`.
98
98
  - `onEvalComplete` fires with the checks, scores, and verdict. The runner also supplies `context`, including every distinct trace context collected across the eval's sessions. The same list is available as `result.result.traceContexts`.
99
99
 
100
+ Each entry in `result.assertions` is an `AssertionResult`. `name` is the display label, `key` the identifier set by `.label(key)`, and `score` the measurement. `threshold` and `passed` describe the rule and are absent when no rule applies. When a scorer threw, `errored` is `true`, `message` carries the error, and `score` is absent. The `.eve/evals/` artifacts write the same fields.
101
+
100
102
  An eval can create several sessions, and a long session can produce several traces, so completion exposes a list instead of a single trace id. `onEvalStart` does not include a trace because the agent session has not started yet. If the target has no tracing configured, `onSessionStart` does not fire and the completed trace list is empty.
101
103
 
102
104
  `result.result.derived` holds the facts the runner derived from the eval's sessions, such as tool calls and `models`: the distinct ids of the models the steps started with, in session order. Each entry in `result.result.sessions` holds the same facts for one session, in first-use order, so a reporter can tell the primary session's models from those of the other sessions the eval created or attached. A delegated subagent runs in its own session, so its models appear only when the eval attaches that session with `t.target.attachSession`. Compaction and `auto` routing calls are not included.
@@ -165,6 +165,15 @@ its cursor after a disconnect or the
165
165
  server's renewable 60-second lease; lease renewal does not start a turn or clear UI state.
166
166
  Unmounting or resetting closes the local stream without cancelling the old durable session.
167
167
 
168
+ An open stream reconnects for as long as the chat stays mounted, even when nothing happens. If
169
+ your UI only shows replies to its own messages, such as a help sidebar that stays mounted across
170
+ pages, pass `followIdle: false`. The binding then closes the stream once the session is idle: no
171
+ turn is running or parked, no task is working, and no sign-in is pending. A prewarmed session
172
+ opens no stream until its first message. The next `send()`, `respond()`, or `resume()` reopens
173
+ the stream from the session cursor, so events that arrived in between are applied then. Leave
174
+ `followIdle` on when other sources, such as schedules, channels, or another tab, can start turns
175
+ in the session while your UI is idle.
176
+
168
177
  `reset()` reuses the hook instance and clears the conversation. When `prewarm` is true after
169
178
  the reset, it prepares the next owned session; otherwise, the next send creates it. An explicitly
170
179
  supplied `session` remains externally owned and is never replaced by prewarming or reset. Use
@@ -399,7 +408,7 @@ then save a final snapshot in `onFinish`.
399
408
 
400
409
  `initialEvents` must be an ordered prefix of the same session's stream, but its endpoint does not have to line up exactly with where the stream resumes. When the event count matches `initialSession.streamIndex`, catch-up continues from that cursor. A partial or overlapping saved log falls back to index `0`. Every event carries a stable [`meta.id`](/docs/concepts/sessions-runs-and-streaming#the-event-envelope), and the store drops any event whose id it has already applied, so an overlapping replay renders once and `onEvent` only fires for events your UI has not seen.
401
410
 
402
- For multiple chat threads, keep one saved event log and session cursor per thread. `agent`, `host`, `reducer`, `session`, `initialEvents`, `initialSession`, `auth`, `headers`, `optimistic`, and `resume` are read when the hook creates its store, so remount the chat component when switching threads, for example with `key={chat.id}`. React reads `prewarm` on every render.
411
+ For multiple chat threads, keep one saved event log and session cursor per thread. `agent`, `host`, `reducer`, `session`, `initialEvents`, `initialSession`, `auth`, `headers`, `optimistic`, `followIdle`, and `resume` are read when the hook creates its store, so remount the chat component when switching threads, for example with `key={chat.id}`. React reads `prewarm` on every render.
403
412
 
404
413
  Pass `resume: true` with `initialSession` to rebuild the projection from the durable stream after mount. While `status` is `"resuming"`, render hydrated `data` but disable message and HITL submission; do not present cancellation or active-turn progress controls. If catch-up finds an in-flight turn, `status` changes to `"streaming"` before the binding follows it to a boundary. The stream reports its initial durable tail so catch-up can finish without closing the connection or waiting for an idle timeout. A settled tail changes directly to `"ready"`; a newer turn or pending authorization remains `"streaming"`. The connection stays open to receive later events. A terminal session failure changes to `"error"`.
405
414
 
@@ -97,7 +97,7 @@ when the parent's current model step ends if one is running.
97
97
 
98
98
  ### Narrowing tool results
99
99
 
100
- `toolResultFrom` narrows an `action.result` event to a specific authored tool or MCP connection and returns typed output. Import it from `eve/tools`:
100
+ `toolResultFrom` narrows an `action.result` event to a specific authored tool or connection (MCP or OpenAPI) and returns typed output. Import it from `eve/tools`:
101
101
 
102
102
  ```ts
103
103
  import { defineHook } from "eve/hooks";
@@ -114,7 +114,7 @@ export default defineHook({
114
114
  console.log(weather.output.temperature);
115
115
  }
116
116
 
117
- // MCP connection: output is unknown, toolName is qualified
117
+ // Connection: output is unknown, toolName is qualified
118
118
  const linearResult = toolResultFrom(event.data.result, linear);
119
119
  if (linearResult) {
120
120
  console.log(linearResult.connectionToolName, linearResult.output);
@@ -174,6 +174,9 @@ each turn. Remote requests carry the conversation ID in W3C Baggage.
174
174
  `trustedForwarders` controls whether the receiver accepts parent session data
175
175
  and the trace-content policy. See
176
176
  [Remote agents](../guides/remote-agents#preserving-trace-content).
177
+ Gateway-routed model calls propagate the configured OpenTelemetry context at
178
+ each provider request. Eve-owned baggage is removed before forwarding. Gateway
179
+ controls whether its spans are sampled and which destinations receive them.
177
180
 
178
181
  ## Local traces
179
182
 
@@ -403,7 +403,7 @@ Each root agent turn starts a new trace. With local caller trace context, that t
403
403
 
404
404
  Every span carries a real duration. A turn's root `invoke_agent` span is written when the turn settles, so a running turn shows only its steps.
405
405
 
406
- Model, `execute_tool`, and memory spans retain their content by default. Set `EVE_TRACES_CONTENT=off` to omit system prompts, prompt messages, and response text for models; call arguments and results for tools; and recalled memory records. Each captured value is capped at 32 KB.
406
+ Model, `execute_tool`, and memory spans retain their content by default. Set `EVE_TRACES_CONTENT=off` to omit system prompts, prompt messages, and response text for models; call arguments and results for tools; and recalled memory records. Each captured value is capped at 32 KB. When a model call's prompt messages exceed the cap, the oldest are dropped first and `agent.input.messages.omitted` records how many.
407
407
 
408
408
  Step spans carry token counts under `agent.usage.*`, and cost when Vercel AI Gateway served the call. Model spans also expose `gen_ai.usage.*` token counters. The CLI sums step-level counters only, so model and delegated-call totals are not counted twice.
409
409
 
@@ -103,12 +103,13 @@ import template from "../../prompts/template.txt?raw";
103
103
 
104
104
  `ctx` is passed to your tool `execute`, hook handlers, channel event handlers, and connection auth/header resolvers. It is live only while authored code is running, so reaching for it at module top level throws. See [Session context](../guides/session-context) for the full model.
105
105
 
106
- | Member | Use |
107
- | --------------------------- | ---------------------------------------------------------------------------- |
108
- | `ctx.session` | Current session, turn, auth, and optional parent lineage (read-only) |
109
- | `ctx.getSandbox()` | Live sandbox handle; `stop()` releases compute but preserves durable state |
110
- | `ctx.getToken(provider)` | Resolve a bearer token for an inline auth provider such as `connect("...")` |
111
- | `ctx.requireAuth(provider)` | Evict and re-authorize an inline provider, commonly after a downstream `401` |
106
+ | Member | Use |
107
+ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
108
+ | `ctx.session` | Current session, turn, auth, and optional parent lineage (read-only) |
109
+ | `ctx.getSandbox()` | Live sandbox handle; `stop()` releases compute but preserves durable state |
110
+ | `ctx.getToken(provider)` | Resolve a bearer token for an inline auth provider such as `connect("...")` |
111
+ | `ctx.requireAuth(provider)` | Evict and re-authorize an inline provider, commonly after a downstream `401` |
112
+ | `ctx.approval` | Present only while a call runs after a person approved it: `responder` is who approved it and `responder.getToken(provider)` resolves their token. The call still runs as `ctx.session.auth.current`; see [Human-in-the-loop](/docs/human-in-the-loop) |
112
113
 
113
114
  Tool definitions accept `availableInSubagents: false` to restrict the tool to top-level root sessions, and `deferred: true` to keep the tool out of the model's tool list so the model finds it with `eve__search` and calls it with `eve__tool`; see [Tools](../tools#keep-a-tool-out-of-the-tool-list). `defineTool` definitions accept `endsTurn: true`, or a function that receives the `execute` output, to end the turn without a reply after a successful call; see [Tools](../tools#end-the-turn-after-a-tool-call). Authored workflow bodies also receive `ctx.agents`, a replay-stable map of callable-agent metadata, and `ctx.agent(name)`, which returns an `AgentSession` whose `send(message, options?)` resolves to a response with `result()`. A `"use step"` helper that receives the context directly should type it as `WorkflowStepToolContext`, which excludes `agents`, `agent`, and `ask`. The root-copy `agent` entry has an empty description when the root omits `description`. See [Workflows as tools](../tools/workflows#delegate-work-ctxagent) for the workflow-only context.
114
115
 
@@ -95,6 +95,15 @@ await sandbox.setNetworkPolicy("deny-all");
95
95
  return sandbox;
96
96
  ```
97
97
 
98
+ ## Live sandbox name
99
+
100
+ Sessions returned by `environment.open()` and `ctx.getSandbox(environment)` expose a read-only `name` property. The name identifies the live Vercel Sandbox and stays stable across stop/resume for the session. Use it as `sandboxName` when creating Vercel git-credential-broker grants scoped to that sandbox:
101
+
102
+ ```ts
103
+ const sandbox = await ctx.getSandbox(environment);
104
+ const sandboxName = sandbox.name;
105
+ ```
106
+
98
107
  ## Live sandbox options
99
108
 
100
109
  `open()` also accepts Vercel compute resources, timeout, and Drive mounts. Configure project credentials and custom fetch behavior on the environment, not in `open()`, because resume does not reconstruct start-only options.
package/docs/skills.mdx CHANGED
@@ -44,7 +44,7 @@ A skill's name comes from its path and must use only ASCII letters, digits, unde
44
44
 
45
45
  A flat markdown skill can skip the `description` frontmatter. When it does, eve advertises the first non-empty, non-code-fence line of the body with any leading `#`, `>`, `*`, or `-` marker stripped. If the body has no such line, eve falls back to the literal `Instructions for the <name> skill.`, which is a weak routing hint, so add a `description` when you want the model to route on intent.
46
46
 
47
- A packaged skill is a directory with a `SKILL.md` plus sibling files like `references/`, `assets/`, and `scripts/`. The packaged `SKILL.md` must carry `description` frontmatter; it has no filename slug to fall back on.
47
+ A packaged skill is a directory with a `SKILL.md` plus sibling files like `references/`, `assets/`, and `scripts/`. The packaged `SKILL.md` must carry `description` frontmatter; it has no filename slug to fall back on. eve ignores frontmatter it does not use so skills authored for other Agent Skills clients remain importable.
48
48
 
49
49
  ```md title="agent/skills/research/SKILL.md"
50
50
  ---
@@ -64,7 +64,29 @@ approval: auto({
64
64
 
65
65
  A reusable approval grant applies only after every matching request that is already pending has been resolved. If several calls to a `once()`-gated tool have each produced an approval prompt, approving one does not authorize the others; each visible prompt remains an independent decision. After those pending requests are resolved, later calls in the session are allowed automatically.
66
66
 
67
- When the decision depends on the input, pass your own policy instead of a helper. It receives the same session context as tool execution, plus `{ toolName, toolInput, approvedTools, callId, abortSignal }`, and returns an AI SDK 7 approval status synchronously or as a promise. Use `abortSignal` for asynchronous policy work so cancellation stops it with the turn. Use `ctx.session.auth.current` to guard by the caller of the current turn and `ctx.session.auth.initiator` to guard by the caller that created the session. Return `"user-approval"` to pause for a person or `"not-applicable"` to continue without a prompt. `toolInput` can be undefined, so guard the access. This policy denies cross-tenant calls, then requires approval only when an amount crosses a threshold:
67
+ Use the object form of `approval` to replace the default `Approve <tool label>?` text with a tool-specific summary. The `prompt` callback receives the validated `input`, final `toolName`, and `callId`:
68
+
69
+ ```ts title="agent/tools/refund_charge.ts"
70
+ import { defineTool } from "eve/tools";
71
+ import { always } from "eve/tools/approval";
72
+ import { z } from "zod";
73
+
74
+ export default defineTool({
75
+ description: "Refund a charge.",
76
+ inputSchema: z.object({ chargeId: z.string(), amount: z.number() }),
77
+ approval: {
78
+ request: always(),
79
+ prompt: ({ input }) => `Refund $${input.amount.toFixed(2)} for charge ${input.chargeId}?`,
80
+ },
81
+ async execute(input) {
82
+ return refund(input);
83
+ },
84
+ });
85
+ ```
86
+
87
+ Channels render this prompt in their approval UI. Slack also includes the complete tool input in a collapsed **Tool input** block so an approver can inspect the original structured value.
88
+
89
+ When the decision depends on the input, pass your own policy instead of a helper. It receives the same session context as tool execution, plus `{ toolName, toolInput, approvedTools, callId, abortSignal }` (connection tools also get `toolAnnotations`), and returns an AI SDK 7 approval status synchronously or as a promise. Use `abortSignal` for asynchronous policy work so cancellation stops it with the turn. Use `ctx.session.auth.current` to guard by the caller of the current turn and `ctx.session.auth.initiator` to guard by the caller that created the session. Return `"user-approval"` to pause for a person or `"not-applicable"` to continue without a prompt. `toolInput` can be undefined, so guard the access. This policy denies cross-tenant calls, then requires approval only when an amount crosses a threshold:
68
90
 
69
91
  ```ts
70
92
  approval: ({ session, toolInput }) => {
@@ -234,6 +256,27 @@ When a subagent requests input, eve emits the same `input.requested` event on it
234
256
 
235
257
  Approval is consent only. An approved tool call runs with the requesting user's identity, connections, and credentials, including its policy recheck. The approver's access is never lent to the call. Subsequent tool calls in the turn also stay with the original owner.
236
258
 
259
+ A `defineTool` tool can still act on the approver's behalf when it chooses to. While an approved `defineTool` call runs, `ctx.approval.responder` is the principal who approved it, and `ctx.approval.responder.getToken(provider)` resolves that person's token for an inline provider, as `ctx.getToken(provider)` does for the requester. `ctx.session.auth.current` stays the requester. `ctx.approval` is absent for calls that needed no approval, and workflow tools don't receive it. `ctx.approval.responder.getToken(provider)` never starts a sign-in: when the approver has no token, it throws a `ConnectionAuthorizationFailedError` with `reason: "approver_authorization_required"`.
260
+
261
+ ```ts
262
+ export default defineTool({
263
+ description: "Grant the requester access to a repository.",
264
+ inputSchema: z.object({ repo: z.string() }),
265
+ approval: {
266
+ request: always(),
267
+ response: ({ response }) =>
268
+ itAdmins.includes(response.principal.principalId)
269
+ ? { status: "allowed" }
270
+ : { status: "rejected" },
271
+ },
272
+ async execute({ repo }, ctx) {
273
+ const admin = await ctx.approval?.responder.getToken(github);
274
+ if (admin === undefined) throw new Error("An IT admin must approve this grant.");
275
+ return await grantAccess(repo, ctx.session.auth.current, admin.token);
276
+ },
277
+ });
278
+ ```
279
+
237
280
  For approval requests, a follow-up message that doesn't match an option steers the turn instead of answering it. eve cancels the turn's pending approval, so the call doesn't run and `input.resolved` reports `outcome: "ignored"`, and the model reads the message next. This happens even when the message is sent with `turnPolicy: "queue"`, because a turn held on a person can't end until they act. Calls the person already approved in the same batch still run. A message from someone other than the person the turn serves waits until the turn ends. Cancelling the turn withdraws its approval: the call doesn't run, `input.resolved` reports `outcome: "cancelled"`, and a later answer to it approves nothing.
238
281
 
239
282
  ### Several requests at once
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eve",
3
- "version": "0.78.0",
3
+ "version": "0.79.1",
4
4
  "private": false,
5
5
  "description": "Filesystem-first framework for durable backend AI agents that run anywhere.",
6
6
  "keywords": [
@@ -574,6 +574,7 @@
574
574
  "@chat-adapter/twilio": "4.41.0",
575
575
  "@clack/core": "1.3.1",
576
576
  "@eve/catalog": "0.0.1",
577
+ "@eve/tracing": "0.0.0",
577
578
  "@linqapp/chat-sdk-adapter": "^0.5.1",
578
579
  "@modelcontextprotocol/server": "2.0.0",
579
580
  "@nuxt/kit": "^4.0.0",
@@ -1 +0,0 @@
1
- import{isSessionInboxAddress}from"#execution/session-inbox/address.js";import{inputOptionSchema}from"#shared/input.js";const PROXY_INPUT_REQUESTS_KEY=`eve.runtime.proxyInputRequests`,PROXY_INPUT_REQUEST_KINDS={question:!0,"session-limit":!0,"tool-approval":!0};function resolvedByChild(e){return e===`tool-approval`}function resolvedForParent(e){let t=e.resolutions.filter(({kind:e})=>resolvedByChild(e));return t.length===0?void 0:{...e,resolutions:t}}function getProxyInputRequests(e){return new Map(Object.entries(readMap(e)))}function hasProxyInputRequests(e){for(let t of Object.keys(readMap(e)))return!0;return!1}function upsertProxyInputRequests(e){return{...e.session,state:upsertProxyInputRequestState({entries:e.entries,forChildContinuationToken:e.forChildContinuationToken,inputSource:e.inputSource,state:e.session.state})}}function upsertProxyInputRequestState(e){let t={};for(let[n,r]of Object.entries(readMap(e.state)))(r.childContinuationToken!==e.forChildContinuationToken||r.inputSource!==e.inputSource)&&(t[n]=r);for(let[n,r]of e.entries)t[n]=r;let n={...e.state};return Object.keys(t).length===0?delete n[PROXY_INPUT_REQUESTS_KEY]:n[PROXY_INPUT_REQUESTS_KEY]=t,Object.keys(n).length>0?n:void 0}function clearProxyInputRequestsWhere(e,t){return retireProxyInputRequests(e,Object.entries(readMap(e.state)).filter(([e,n])=>t(n,e)).map(([e])=>e))}function retireProxyInputRequests(e,t){let n={...readMap(e.state)},r=!1;for(let e of t)Object.hasOwn(n,e)&&(delete n[e],r=!0);return r?writeMap(e,n):e}function toProxyInputRequestEntries(e){let t={approvalRequestIds:e.event.requests.flatMap(e=>e.kind===`tool-approval`?[e.requestId]:[]),requestIds:e.event.requests.map(e=>e.requestId)},n={sequence:e.event.sequence,stepIndex:e.event.stepIndex,turnId:e.event.turnId};return e.event.requests.map(r=>{let i={batch:t,childContinuationToken:e.childContinuationToken,...e.inputSource!==void 0&&{inputSource:e.inputSource},...e.remote!==void 0&&{remote:e.remote},event:n,kind:r.kind,reply:{...r.allowFreeform!==void 0&&{allowFreeform:r.allowFreeform},...r.options!==void 0&&{options:[...r.options]}}};return e.childSessionInbox?.sessionId===e.childSessionId&&(i.childSessionInbox=e.childSessionInbox),[r.requestId,i]})}function readMap(e){let t=e?.[PROXY_INPUT_REQUESTS_KEY];if(typeof t!=`object`||!t||Array.isArray(t))return{};let n={};for(let[e,r]of Object.entries(t)){let t=parseProxyInputRequest(r,e);t!==void 0&&(n[e]=t)}return n}function writeMap(e,t){let n={...e.state};return Object.keys(t).length===0?(delete n[PROXY_INPUT_REQUESTS_KEY],{...e,state:Object.keys(n).length>0?n:void 0}):(n[PROXY_INPUT_REQUESTS_KEY]=t,{...e,state:n})}function parseProxyInputRequest(e,t){if(typeof e!=`object`||!e||Array.isArray(e)||!(`childContinuationToken`in e)||!(`kind`in e)||typeof e.childContinuationToken!=`string`||!isInputRequestKind(e.kind))return;let n=`remote`in e?parseRemoteAgentBinding(e.remote):void 0;if(`remote`in e&&n===void 0)return;let r=`inputSource`in e?e.inputSource:void 0;if(r!==void 0&&(typeof r!=`string`||r.length===0))return;let i=`event`in e?parseInputRequestEvent(e.event):void 0;if(i===void 0)return;let a=`batch`in e?parseProxyInputRequestBatch(e.batch):void 0,o=`workflowAsk`in e?parseWorkflowAskRoute(e.workflowAsk):void 0;if(`workflowAsk`in e&&o===void 0)return;let s=`runId`in e?e.runId:void 0;if(s!==void 0&&(typeof s!=`string`||s.length===0))return;let c=`reply`in e?parseProxyInputReply(e.reply):void 0;if(`reply`in e&&c===void 0)return;let l=`childSessionInbox`in e?e.childSessionInbox:void 0;if(l!==void 0&&!isSessionInboxAddress(l))return;let u={childContinuationToken:e.childContinuationToken,event:i,kind:e.kind};return typeof r==`string`&&(u.inputSource=r),n!==void 0&&(u.remote=n),o!==void 0&&(u.workflowAsk=o),typeof s==`string`&&(u.runId=s),l!==void 0&&(u.childSessionInbox=l),a!==void 0&&a.requestIds.includes(t)&&(u.batch=a),c!==void 0&&(u.reply=c),u}function parseInputRequestEvent(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Reflect.get(e,`sequence`),n=Reflect.get(e,`stepIndex`),r=Reflect.get(e,`turnId`);if(typeof t==`number`&&typeof n==`number`&&typeof r==`string`)return{sequence:t,stepIndex:n,turnId:r}}function parseWorkflowAskRoute(e){if(typeof e!=`object`||!e)return;let t=Reflect.get(e,`control`);if(typeof t==`string`&&t.length!==0)return{control:t}}function parseRemoteAgentBinding(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Reflect.get(e,`name`),n=Reflect.get(e,`url`),r=Reflect.get(e,`resolverId`),i=Reflect.get(e,`forwardPrincipal`),a=Reflect.get(e,`sessionId`);if(typeof t==`string`&&t&&typeof n==`string`&&n&&typeof a==`string`&&a&&(r===void 0||typeof r==`string`&&r)&&(i===void 0||typeof i==`boolean`))return{name:t,url:n,sessionId:a,...r!==void 0&&{resolverId:r},...i!==void 0&&{forwardPrincipal:i}}}function parseProxyInputReply(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t={},n=Reflect.get(e,`allowFreeform`);if(n!==void 0){if(typeof n!=`boolean`)return;t.allowFreeform=n}let r=Reflect.get(e,`options`);if(r!==void 0){let e=inputOptionSchema.array().safeParse(r);if(!e.success)return;t.options=e.data}return t}function parseProxyInputRequestBatch(e){if(typeof e!=`object`||!e||Array.isArray(e)||!(`approvalRequestIds`in e)||!(`requestIds`in e)||!isStringArray(e.approvalRequestIds)||!isStringArray(e.requestIds))return;let t=new Set(e.requestIds);if(!(t.size!==e.requestIds.length||e.approvalRequestIds.some(e=>!t.has(e))))return{approvalRequestIds:e.approvalRequestIds,requestIds:e.requestIds}}function isStringArray(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function isInputRequestKind(e){return typeof e==`string`&&Object.hasOwn(PROXY_INPUT_REQUEST_KINDS,e)}export{clearProxyInputRequestsWhere,getProxyInputRequests,hasProxyInputRequests,resolvedByChild,resolvedForParent,retireProxyInputRequests,toProxyInputRequestEntries,upsertProxyInputRequestState,upsertProxyInputRequests};
@@ -1,11 +0,0 @@
1
- import { type Tracer } from "#compiled/@opentelemetry/api/index.js";
2
- import type { InstrumentationProviderDefinition } from "#instrumentation/lifecycle.js";
3
- import type { AgentToolContext } from "#tracing/agent-tool-instrumentation.js";
4
- import type { AgentSpanIdGenerator } from "#tracing/agent-span-id-generator.js";
5
- /** Builds durable approval wait spans under their originating runtime action. */
6
- export declare function createAgentApprovalInstrumentation(input: {
7
- readonly actionContextFor: (sessionId: string, turnId: string, callId: string) => Promise<AgentToolContext | undefined>;
8
- readonly frameworkVersion: string;
9
- readonly idGenerator: AgentSpanIdGenerator;
10
- readonly tracer: Tracer;
11
- }): Pick<NonNullable<InstrumentationProviderDefinition["events"]>, "input.requested" | "input.resolved">;
@@ -1 +0,0 @@
1
- import{normalizeChannelAudience}from"#shared/channel-audience.js";import{AGENT_SPAN_NAMES}from"#tracing/agent-span-contract.js";import{ROOT_CONTEXT,trace}from"#compiled/@opentelemetry/api/index.js";import{agentSpanNamingAttributes}from"#tracing/agent-span-naming.js";import{contentAttribute}from"#tracing/agent-otel-content.js";import{recordAgentSpanError}from"#tracing/agent-span-error.js";import{agentTraceIdentityAttributes,traceSessionIdOf}from"#tracing/agent-otel-attributes.js";import{decodeTraceSessionId}from"#tracing/agent-trace-context-codec.js";import{withChannelAudience}from"#tracing/channel-audience-context.js";function createAgentApprovalInstrumentation(e){return{"input.requested":async(t,n)=>{if(t.kind!==`tool-approval`||readState(n.state.get())!==void 0)return;let r=await e.actionContextFor(t.scope.sessionId,t.scope.turnId,t.action.callId);if(r===void 0)return;let i={actionCallId:t.action.callId,actionName:t.action.name,attemptIndex:t.scope.attemptIndex,channelAudience:normalizeChannelAudience(t.scope.channelAudience),parent:{spanId:r.spanContext.spanId,traceFlags:r.spanContext.traceFlags,traceId:r.spanContext.traceId},requestId:t.requestId,rootSessionId:t.scope.rootSessionId??t.scope.sessionId,traceSessionId:traceSessionIdOf(t.scope),sessionId:t.scope.sessionId,startTimeMs:Date.now(),stepIndex:t.scope.stepIndex,turnId:t.scope.turnId},a=contentAttribute(t.request);a!==void 0&&(i.requestAttribute=a),n.state.set(i)},"input.resolved":(t,n)=>{let r=readState(n.state.get());if(r===void 0)return;let i=e.idGenerator.withSpanId(e.idGenerator.deriveSpanId(`approval:${t.idempotencyKey}`),()=>e.tracer.startSpan(AGENT_SPAN_NAMES.approval,{attributes:{"gen_ai.tool.call.id":r.actionCallId,"agent.action.name":r.actionName,"agent.approval.kind":`tool-approval`,"agent.approval.outcome":t.outcome,"agent.approval.request_id":r.requestId,"agent.framework.name":`eve`,"agent.framework.version":e.frameworkVersion,"agent.step.attempt":r.attemptIndex,"agent.step.index":r.stepIndex,"agent.turn.id":r.turnId,"gen_ai.operation.name":`workflow`,...agentSpanNamingAttributes(`agent.approval`,`workflow`),...agentTraceIdentityAttributes({rootSessionId:r.rootSessionId,traceSessionId:r.traceSessionId,sessionId:r.sessionId})},startTime:r.startTimeMs},withChannelAudience(trace.setSpan(ROOT_CONTEXT,trace.wrapSpanContext({...r.parent,isRemote:!1})),r.channelAudience)));if(r.requestAttribute!==void 0&&i.setAttribute(`agent.approval.request`,r.requestAttribute),t.response!==void 0){let e=contentAttribute(t.response);e!==void 0&&i.setAttribute(`agent.approval.response`,e)}t.outcome===`failed`&&recordAgentSpanError(i,t.error),i.end()}}}function readState(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e,n=t.parent;if(typeof n!=`object`||!n||Array.isArray(n))return;let r=n;if(typeof t.actionCallId!=`string`||typeof t.actionName!=`string`||typeof t.attemptIndex!=`number`||typeof r.spanId!=`string`||typeof r.traceFlags!=`number`||typeof r.traceId!=`string`||typeof t.requestId!=`string`||typeof t.rootSessionId!=`string`||typeof t.sessionId!=`string`||typeof t.startTimeMs!=`number`||typeof t.stepIndex!=`number`||typeof t.turnId!=`string`)return;let i=t.requestAttribute;if(i===void 0||typeof i==`string`)return{actionCallId:t.actionCallId,actionName:t.actionName,attemptIndex:t.attemptIndex,channelAudience:normalizeChannelAudience(t.channelAudience),parent:{isRemote:!1,spanId:r.spanId,traceFlags:r.traceFlags,traceId:r.traceId},requestAttribute:i,requestId:t.requestId,rootSessionId:t.rootSessionId,traceSessionId:decodeTraceSessionId(t),sessionId:t.sessionId,startTimeMs:t.startTimeMs,stepIndex:t.stepIndex,turnId:t.turnId}}export{createAgentApprovalInstrumentation};
@@ -1 +0,0 @@
1
- import{applyLiveDeliveryAudienceCeiling,readForwardedTraceAssertion}from"#shared/forwarded-trace-policy.js";import{ConversationIdKey}from"#context/keys.js";import{readConversationId}from"#shared/conversation-identity.js";import{readActionTraceContext,readTurnTraceContext}from"#tracing/agent-trace-context-store.js";function resolveToolCallAgentTrace(e){let{serializedContext:t,sessionId:n,turnId:r}=e;return toChildTraceDispatch({conversation:e.conversation,conversationId:readConversationId(t[ConversationIdKey.name]),stored:readActionTraceContext(t,n,r,e.callId)??readTurnTraceContext(t,n,r)})}function toChildTraceDispatch(e){let{stored:t}=e,n=e.conversation?.audience??`unknown`,r=e.conversation?.environment??`production`,i=readForwardedTraceAssertion(t?.forwardedTracePolicy),a=t?.decision===void 0?t:{...t,decision:applyLiveDeliveryAudienceCeiling(t.decision,n,i,r)};return{conversationId:e.conversationId,originAudience:i?.originAudience??n,parentTraceContext:a}}export{resolveToolCallAgentTrace};
@@ -1,16 +0,0 @@
1
- import { type Tracer } from "#compiled/@opentelemetry/api/index.js";
2
- import type { InstrumentationProviderDefinition } from "#instrumentation/lifecycle.js";
3
- import type { InstrumentationMemoryExecutionOperation } from "#instrumentation/memory.js";
4
- import type { AgentTraceStateStore } from "#tracing/agent-trace-state.js";
5
- import type { ConversationEnvironment } from "#shared/conversation-context.js";
6
- interface AgentMemoryInstrumentation {
7
- readonly events: Pick<NonNullable<InstrumentationProviderDefinition["events"]>, "memory.operation.completed" | "memory.operation.failed" | "memory.operation.started">;
8
- runInContext<T>(operation: InstrumentationMemoryExecutionOperation, execute: () => PromiseLike<T>): Promise<T>;
9
- }
10
- export declare function createAgentMemoryInstrumentation(input: {
11
- readonly environment: ConversationEnvironment;
12
- readonly recordOutputs?: boolean;
13
- readonly stateStore: AgentTraceStateStore;
14
- readonly tracer: Tracer;
15
- }): AgentMemoryInstrumentation;
16
- export {};
@@ -1 +0,0 @@
1
- import{normalizeChannelAudience}from"#shared/channel-audience.js";import{applyLiveDeliveryAudienceCeiling,resolveForwardedTraceSeed}from"#shared/forwarded-trace-policy.js";import{contextStorage}from"#context/container.js";import{SessionTraceSeedKey}from"#context/keys.js";import{withOperationConversation}from"#tracing/conversation-context.js";import{isSampledTrace}from"#tracing/sampled-trace.js";import{ROOT_CONTEXT,SpanKind,context,trace}from"#compiled/@opentelemetry/api/index.js";import{isAgentTraceContext,markAgentTraceContext}from"#tracing/agent-trace-context.js";import{withErrorContent}from"#tracing/error-content-context.js";import{agentSpanNamingAttributes}from"#tracing/agent-span-naming.js";import{genAiMemoryRecordsAttribute}from"#tracing/agent-otel-content.js";import{recordAgentSpanError}from"#tracing/agent-span-error.js";import{agentTraceIdentityAttributes,traceSessionIdOf}from"#tracing/agent-otel-attributes.js";import{withChannelAudience}from"#tracing/channel-audience-context.js";import{suppressTracing}from"#tracing/suppress-tracing.js";function createAgentMemoryInstrumentation(e){let t=e.recordOutputs??!1,n=new Map,parentContext=async t=>{let n=context.active();if(isAgentTraceContext(n))return n;let r=await e.stateStore.getSession(t.sessionId);if(t.turnId!==void 0){let n=await e.stateStore.getTurn(t.sessionId,t.turnId);if(n!==void 0)return withChannelAudience(contextFromSpanContext(n.context),r?.channelAudience)}return r===void 0?void 0:withChannelAudience(contextFromSpanContext(r.context),r.channelAudience)},onStarted=async t=>{if(n.has(t.idempotencyKey))return;let r=await parentContext(t),i=r===void 0?void 0:trace.getSpan(r)?.spanContext();if(r===void 0||i===void 0||!isSampledTrace(i))return;let a=e.tracer.startSpan(t.operationName,{attributes:memorySpanAttributes(t),kind:SpanKind.CLIENT},r);n.set(t.idempotencyKey,{context:trace.setSpan(r,a),span:a})},onTerminal=e=>{let t=n.get(e.idempotencyKey);t!==void 0&&(n.delete(e.idempotencyKey),updateMemorySpan(t.span,e),t.span.end())};return{events:{"memory.operation.completed":onTerminal,"memory.operation.failed":onTerminal,"memory.operation.started":onStarted},async runInContext(r,i){let a=await e.stateStore.getSession(r.sessionId),o=n.get(r.idempotencyKey)?.context;if(o===void 0&&r.turnId!==void 0){let t=await e.stateStore.getTurn(r.sessionId,r.turnId);t!==void 0&&(o=withChannelAudience(contextFromSpanContext(t.context),a?.channelAudience),isSampledTrace(t.context)||(o=suppressTracing(o)))}o===void 0&&a!==void 0&&(o=withChannelAudience(contextFromSpanContext(a.context),a.channelAudience),isSampledTrace(a.context)||(o=suppressTracing(o)));let s=resolveForwardedTraceSeed(contextStorage.getStore()?.get(SessionTraceSeedKey)),c=s?.decision??a?.decision,l=c===void 0?void 0:applyLiveDeliveryAudienceCeiling(c,normalizeChannelAudience(a?.channelAudience),s?.forwardedTracePolicy,e.environment);return o===void 0?await i():await context.with(markAgentTraceContext(withErrorContent(withOperationConversation(o,{rootSessionId:a?.rootSessionId,sessionId:r.sessionId}),t&&l?.action===`record`&&l.recordOutputs)),i)}}}function memorySpanAttributes(e){let t={"agent.memory.phase":e.phase,"agent.memory.slot":e.slot,"gen_ai.memory.store.id":e.storeId,"gen_ai.operation.name":e.operationName,...agentSpanNamingAttributes(e.operationName,e.operationName),...agentTraceIdentityAttributes({rootSessionId:e.rootSessionId,traceSessionId:traceSessionIdOf(e),sessionId:e.sessionId})};return e.turnId!==void 0&&(t[`agent.turn.id`]=e.turnId),t}function updateMemorySpan(e,t){if(t.type===`memory.operation.failed`)recordAgentSpanError(e,t.error);else{t.recordCount!==void 0&&e.setAttribute(`gen_ai.memory.record.count`,t.recordCount);let n=genAiMemoryRecordsAttribute(t.outputRecords??[]);n!==void 0&&t.outputRecords!==void 0&&e.setAttribute(`gen_ai.memory.records`,n)}}function contextFromSpanContext(e){return trace.setSpan(ROOT_CONTEXT,trace.wrapSpanContext(e))}export{createAgentMemoryInstrumentation};
@@ -1,10 +0,0 @@
1
- export declare function traceSessionIdOf(scope: {
2
- readonly traceSessionId?: string;
3
- readonly rootSessionId?: string;
4
- readonly sessionId: string;
5
- }): string;
6
- export declare function agentTraceIdentityAttributes(input: {
7
- readonly rootSessionId: string;
8
- readonly sessionId: string;
9
- readonly traceSessionId: string;
10
- }): Record<string, string | number>;
@@ -1 +0,0 @@
1
- import{AGENT_TRACE_SCHEMA_VERSION}from"#tracing/agent-span-contract.js";import{operationConversationId}from"#tracing/conversation-context.js";function traceSessionIdOf(e){return e.traceSessionId??e.rootSessionId??e.sessionId}function agentTraceIdentityAttributes(e){let t=operationConversationId(e),n={"agent.run.id":e.sessionId,"agent.trace.schema.version":AGENT_TRACE_SCHEMA_VERSION,"gen_ai.conversation.id":t};return process.env.VERCEL_ENV!==void 0&&(n[`vercel.session_id`]=e.traceSessionId),n}export{agentTraceIdentityAttributes,traceSessionIdOf};
@@ -1,4 +0,0 @@
1
- import{isUserMessageKind}from"#harness/messages.js";const CONTENT_ATTRIBUTE_LIMIT=32768;function contentAttribute(e){if(e===void 0)return;let t;try{t=JSON.stringify(e)}catch{return}if(t!==void 0)return textContentAttribute(t)}function genAiInputMessagesAttribute(e){if(!Array.isArray(e))return;let t=e.flatMap(e=>{if(!isRecord(e)||e.role===`system`||typeof e.role!=`string`)return[];let t=semanticParts(e.content);if(t.length===0)return[];let n=e.role===`user`&&isUserMessageKind(e.kind)?e.kind:void 0;return[n===void 0?{parts:t,role:e.role}:{kind:n,parts:t,role:e.role}]});for(let e=0;e<t.length;e+=1){let n=semanticJsonAttribute(t.slice(e));if(n!==void 0)return n}return truncateSingleSemanticMessage(t)??semanticJsonAttribute([])}function genAiSystemInstructionsAttribute(e){let t=systemPromptText(e);if(t!==void 0)return fitSemanticText(t,e=>[{content:e,type:`text`}])}function genAiToolDefinitionsAttribute(e){if(!Array.isArray(e))return;let t=e.flatMap(e=>{if(!isRecord(e)||typeof e.name!=`string`)return[];let t={name:e.name};return typeof e.description==`string`&&(t.description=e.description),e.inputSchema!==void 0&&(t.parameters=e.inputSchema),[t]});if(t.length===0)return;let n=[],r=2;for(let e of t){let t=stringifyContent(e);if(t===void 0)break;let i=r+(n.length===0?0:1)+t.length;if(i>32768)break;n.push(t),r=i}return`[${n.join(`,`)}]`}function genAiOutputMessagesAttribute(e,t){let n=semanticParts(e);return semanticJsonAttribute([{finish_reason:t===`tool-calls`?`tool_call`:t,parts:n,role:`assistant`}])}function genAiMemoryRecordsAttribute(e){return semanticJsonAttribute(e)}function toolResultsContentAttribute(e){if(e.length===0)return;let t=stringifyContent(e);if(t!==void 0&&t.length<=32768)return t;for(let t=CONTENT_ATTRIBUTE_LIMIT;t>=0;t=t>=256?Math.floor(t/2):-1){let n=stringifyContent(e.map(e=>cappedToolResult(e,t)));if(n!==void 0&&n.length<=32768)return n}}function cappedToolResult(e,t){let n={toolName:e.toolName};for(let r of[`input`,`output`,`error`]){if(!(r in e))continue;let i=e[r],a=typeof i==`string`?i:stringifyContent(i)??``;n[r]=a.length<=t?a:`${a.slice(0,t)}… [truncated]`}return n}function systemPromptText(e){if(typeof e==`string`)return e.length===0?void 0:e;if(!isRecord(e)&&!Array.isArray(e))return;let t=Array.isArray(e)?e:[e],n=[];for(let e of t)if(isRecord(e)){if(typeof e.content==`string`)n.push(e.content);else if(Array.isArray(e.content))for(let t of e.content)isRecord(t)&&t.type===`text`&&typeof t.text==`string`&&n.push(t.text)}let r=n.join(`
2
-
3
- `).trim();return r.length===0?void 0:r}function textContentAttribute(e){if(e.length!==0)return e.length<=32768?e:`${e.slice(0,CONTENT_ATTRIBUTE_LIMIT)}… [truncated]`}function stringifyContent(e){try{return JSON.stringify(e)}catch{return}}function semanticJsonAttribute(e){let t=stringifyContent(e);return t!==void 0&&t.length<=32768?t:void 0}function truncateSingleSemanticMessage(e){let t=e.at(-1);if(t===void 0||typeof t.role!=`string`)return;let n=semanticMessageText(t.parts),r=typeof t.kind==`string`?{kind:t.kind,role:t.role}:{role:t.role};return fitSemanticText(n,e=>[{...r,parts:[{content:e,type:`text`}]}],!0)}function fitSemanticText(e,t,n=!1){if(!n&&e.length<=32768){let n=semanticJsonAttribute(t(e));if(n!==void 0)return n}for(let n=Math.min(e.length,CONTENT_ATTRIBUTE_LIMIT);n>0;n-=256){let r=semanticJsonAttribute(t(`${e.slice(0,n)}… [truncated]`));if(r!==void 0)return r}return semanticJsonAttribute(t(`… [truncated]`))}function semanticMessageText(e){if(!Array.isArray(e))return``;let t=``;for(let n of e){if(!isRecord(n)||n.type!==`text`||typeof n.content!=`string`)continue;let e=t.length===0?``:`
4
- `,r=32769-t.length-e.length;if(r<=0)break;t+=e+n.content.slice(0,r)}return t}function semanticParts(e){if(typeof e==`string`)return[{content:e,type:`text`}];if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=semanticPart(n);e!==void 0&&t.push(e)}return t}function semanticPart(e){if(isRecord(e)&&typeof e.type==`string`)switch(e.type){case`text`:case`reasoning`:{let t=typeof e.text==`string`?e.text:e.content;return typeof t==`string`?{content:t,type:e.type}:void 0}case`tool-call`:return{arguments:e.input,id:stringValue(e.toolCallId)??stringValue(e.callId)??null,name:e.toolName,type:`tool_call`};case`tool-result`:return{id:stringValue(e.toolCallId)??stringValue(e.callId)??null,response:toolResponse(e.output),type:`tool_call_response`};case`tool-error`:return{id:stringValue(e.toolCallId)??stringValue(e.callId)??null,response:e.error instanceof Error?e.error.message:e.error,type:`tool_call_response`};default:return{type:e.type}}}function toolResponse(e){return isRecord(e)?(e.type===`text`||e.type===`error-text`||e.type===`json`||e.type===`error-json`)&&`value`in e?e.value:e.type===`execution-denied`?{denied:!0,reason:e.reason}:e:e}function stringValue(e){return typeof e==`string`?e:void 0}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{CONTENT_ATTRIBUTE_LIMIT,contentAttribute,genAiInputMessagesAttribute,genAiMemoryRecordsAttribute,genAiOutputMessagesAttribute,genAiSystemInstructionsAttribute,genAiToolDefinitionsAttribute,textContentAttribute,toolResultsContentAttribute};