eve 0.80.0 → 0.81.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 (177) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/src/channel/channel-address.d.ts +1 -0
  3. package/dist/src/channel/channel-address.js +1 -1
  4. package/dist/src/channel/inactive-prompt.d.ts +46 -0
  5. package/dist/src/channel/inactive-prompt.js +1 -0
  6. package/dist/src/channel/principal-identity.d.ts +2 -0
  7. package/dist/src/channel/principal-identity.js +1 -1
  8. package/dist/src/channel/session-not-active-error.d.ts +16 -0
  9. package/dist/src/channel/session-not-active-error.js +1 -0
  10. package/dist/src/chunks/{use-eve-agent-Vsl-S0yI.js → use-eve-agent-Bp6nbhfV.js} +6 -0
  11. package/dist/src/chunks/{use-eve-agent-Ch-Q-s12.js → use-eve-agent-DLkjJIm3.js} +6 -0
  12. package/dist/src/compiled/.vendor-stamp.json +3 -3
  13. package/dist/src/compiled/@ai-sdk/mcp/index.js +1 -1
  14. package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/adapters/ai-sdk-telemetry.d.ts +2 -2
  15. package/dist/src/compiled/{@eve/tracing/agent-tracing.d.ts → @vercel/agent-runs/agent-run.d.ts} +3 -3
  16. package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/index.d.ts +1 -1
  17. package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/index.js +1 -1
  18. package/dist/src/compiled/@workflow/world-vercel/index.js +3 -3
  19. package/dist/src/compiler/extension-compatibility.d.ts +18 -18
  20. package/dist/src/compiler/extension-compatibility.js +1 -1
  21. package/dist/src/context/provider.d.ts +5 -0
  22. package/dist/src/context/providers/connection.js +1 -1
  23. package/dist/src/context/run-step.js +1 -1
  24. package/dist/src/eve-channel/support.js +1 -1
  25. package/dist/src/execution/agent-sessions/steps.js +1 -1
  26. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  27. package/dist/src/execution/sandbox/bindings/vercel-lookup.d.ts +6 -0
  28. package/dist/src/execution/sandbox/bindings/vercel-lookup.js +1 -1
  29. package/dist/src/execution/sandbox/bindings/vercel.js +2 -2
  30. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  31. package/dist/src/execution/workflow-runtime.js +1 -1
  32. package/dist/src/extensions/code/extension/extension.d.ts +2 -0
  33. package/dist/src/extensions/code/extension/extension.js +1 -1
  34. package/dist/src/extensions/git/extension/extension.d.ts +3 -0
  35. package/dist/src/extensions/git/extension/extension.js +1 -1
  36. package/dist/src/extensions/git/extension/lib/attribution.d.ts +22 -0
  37. package/dist/src/extensions/git/extension/lib/attribution.js +4 -0
  38. package/dist/src/extensions/git/extension/lib/gh-tool.js +1 -1
  39. package/dist/src/extensions/git/extension/lib/github-shell.d.ts +13 -1
  40. package/dist/src/extensions/git/extension/lib/github-shell.js +1 -1
  41. package/dist/src/extensions/git/extension/lib/sandbox.d.ts +1 -1
  42. package/dist/src/harness/authorization-event-fields.d.ts +3 -0
  43. package/dist/src/harness/authorization-event-fields.js +1 -1
  44. package/dist/src/harness/compaction/engine.js +2 -2
  45. package/dist/src/harness/compaction/prompt.d.ts +6 -0
  46. package/dist/src/harness/compaction/prompt.js +1 -1
  47. package/dist/src/harness/hitl/approvals.d.ts +9 -9
  48. package/dist/src/harness/hitl/approvals.js +1 -1
  49. package/dist/src/harness/hitl/approved-calls.d.ts +4 -4
  50. package/dist/src/harness/hitl/approved-calls.js +1 -1
  51. package/dist/src/harness/hitl/candidates.d.ts +7 -1
  52. package/dist/src/harness/hitl/candidates.js +1 -1
  53. package/dist/src/harness/hitl/coordinator.d.ts +2 -2
  54. package/dist/src/harness/hitl/coordinator.js +1 -1
  55. package/dist/src/harness/hitl/index.d.ts +2 -2
  56. package/dist/src/harness/hitl/index.js +1 -1
  57. package/dist/src/harness/hitl/intake.js +1 -1
  58. package/dist/src/harness/hitl/sign-ins.d.ts +10 -0
  59. package/dist/src/harness/hitl/sign-ins.js +1 -1
  60. package/dist/src/harness/inline-tool-authorization.d.ts +10 -11
  61. package/dist/src/harness/inline-tool-authorization.js +1 -1
  62. package/dist/src/harness/session-machine/current.d.ts +5 -0
  63. package/dist/src/harness/session-machine/current.js +1 -1
  64. package/dist/src/harness/session-machine/state.d.ts +15 -3
  65. package/dist/src/harness/session-machine/transitions.d.ts +23 -5
  66. package/dist/src/harness/session-machine/transitions.js +1 -1
  67. package/dist/src/harness/step/after-model.js +1 -1
  68. package/dist/src/instrumentation/ai-sdk-hook-bridge.js +1 -1
  69. package/dist/src/instrumentation/principal-summary.js +1 -1
  70. package/dist/src/instrumentation/runtime.d.ts +1 -1
  71. package/dist/src/instrumentation/runtime.js +1 -1
  72. package/dist/src/instrumentation/session-init.js +1 -1
  73. package/dist/src/internal/application/stamped-package-version.js +1 -1
  74. package/dist/src/internal/authored-definition/source-identity.js +1 -1
  75. package/dist/src/internal/authored-package-boundary.d.ts +4 -0
  76. package/dist/src/internal/authored-package-boundary.js +1 -1
  77. package/dist/src/internal/bundler/nitro-rolldown.d.ts +2 -2
  78. package/dist/src/internal/logging.js +1 -1
  79. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  80. package/dist/src/internal/nitro/host/external-dependency-output-check-plugin.d.ts +23 -0
  81. package/dist/src/internal/nitro/host/external-dependency-output-check-plugin.js +3 -0
  82. package/dist/src/internal/nitro/routes/channel-request-instrumentation.js +1 -1
  83. package/dist/src/protocol/message.d.ts +30 -0
  84. package/dist/src/protocol/message.js +1 -1
  85. package/dist/src/protocol/session-projection.d.ts +8 -1
  86. package/dist/src/protocol/session-projection.js +1 -1
  87. package/dist/src/public/channels/auth.js +1 -1
  88. package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +1 -1
  89. package/dist/src/public/channels/chat-sdk/input-actions.d.ts +5 -0
  90. package/dist/src/public/channels/chat-sdk/input-actions.js +2 -2
  91. package/dist/src/public/channels/discord/defaults.d.ts +6 -1
  92. package/dist/src/public/channels/discord/defaults.js +2 -2
  93. package/dist/src/public/channels/discord/discordChannel.js +1 -1
  94. package/dist/src/public/channels/slack/approval-cards.js +2 -2
  95. package/dist/src/public/channels/slack/interaction-cards.d.ts +19 -6
  96. package/dist/src/public/channels/slack/interaction-cards.js +1 -1
  97. package/dist/src/public/channels/slack/interactions.js +1 -1
  98. package/dist/src/public/channels/teams/hitl.d.ts +7 -0
  99. package/dist/src/public/channels/teams/hitl.js +1 -1
  100. package/dist/src/public/channels/teams/teamsChannel.js +1 -1
  101. package/dist/src/public/channels/telegram/hitl.d.ts +2 -0
  102. package/dist/src/public/channels/telegram/hitl.js +2 -2
  103. package/dist/src/public/channels/telegram/inbound.d.ts +2 -0
  104. package/dist/src/public/channels/telegram/inbound.js +1 -1
  105. package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
  106. package/dist/src/public/definitions/channel.js +1 -1
  107. package/dist/src/runtime/connections/mcp-client.d.ts +1 -1
  108. package/dist/src/runtime/connections/mcp-client.js +1 -1
  109. package/dist/src/runtime/connections/openapi-client.js +1 -1
  110. package/dist/src/runtime/connections/registry-types.d.ts +4 -1
  111. package/dist/src/runtime/connections/registry.d.ts +3 -2
  112. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  113. package/dist/src/setup/scaffold/create/project.js +1 -1
  114. package/dist/src/svelte/index.js +1 -1
  115. package/dist/src/svelte/use-eve-agent.js +1 -1
  116. package/dist/src/tools/provided/ask-question-workflow.js +1 -1
  117. package/dist/src/tools/provided/sleep-workflow.js +1 -1
  118. package/dist/src/tracing/eve/agent-approval-instrumentation.d.ts +2 -2
  119. package/dist/src/tracing/eve/agent-channel-delivery-instrumentation.js +1 -1
  120. package/dist/src/tracing/eve/agent-memory-instrumentation.d.ts +2 -2
  121. package/dist/src/tracing/eve/agent-memory-instrumentation.js +1 -1
  122. package/dist/src/tracing/eve/agent-otel-provider.d.ts +1 -1
  123. package/dist/src/tracing/eve/agent-tool-instrumentation.d.ts +3 -3
  124. package/dist/src/tracing/eve/agent-trace-context.js +1 -1
  125. package/dist/src/tracing/eve/agent-trace-state.d.ts +1 -1
  126. package/dist/src/tracing/eve/connection-events.js +1 -1
  127. package/dist/src/tracing/eve/content-span-processor.js +1 -1
  128. package/dist/src/tracing/eve/delegation.js +1 -1
  129. package/dist/src/tracing/eve/gateway.d.ts +1 -1
  130. package/dist/src/tracing/eve/install-instrumentation-runtime.js +1 -1
  131. package/dist/src/tracing/eve/invoke-tool-span.js +1 -1
  132. package/dist/src/tracing/eve/mcp.d.ts +1 -1
  133. package/dist/src/tracing/eve/mcp.js +1 -1
  134. package/dist/src/tracing/eve/metadata.d.ts +1 -1
  135. package/dist/src/tracing/eve/operation-input.d.ts +2 -2
  136. package/dist/src/tracing/eve/operation-input.js +1 -1
  137. package/dist/src/tracing/eve/otel-registration.d.ts +2 -2
  138. package/dist/src/tracing/eve/otel-registration.js +1 -1
  139. package/dist/src/tracing/eve/profile.d.ts +1 -1
  140. package/dist/src/tracing/eve/session.d.ts +2 -2
  141. package/dist/src/tracing/local/trace-summary.js +1 -1
  142. package/dist/src/vue/index.js +1 -1
  143. package/dist/src/vue/use-eve-agent.js +1 -1
  144. package/docs/channels/slack.mdx +2 -0
  145. package/docs/channels/teams.mdx +1 -1
  146. package/docs/channels/telegram.mdx +1 -1
  147. package/docs/code-extension.mdx +20 -6
  148. package/docs/connections/mcp.mdx +4 -0
  149. package/docs/connections/openapi.mdx +2 -0
  150. package/docs/connections/overview.mdx +2 -2
  151. package/docs/evals/assertions.mdx +21 -0
  152. package/package.json +2 -2
  153. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/adapters/agent-transport.d.ts +0 -0
  154. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/adapters/ai-sdk-payload.d.ts +0 -0
  155. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/adapters/otel-error.d.ts +0 -0
  156. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/adapters/otel-ids.d.ts +0 -0
  157. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/adapters/otel.d.ts +0 -0
  158. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/adapters/serialization.d.ts +0 -0
  159. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/ai-sdk.d.ts +0 -0
  160. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/ai-sdk.js +0 -0
  161. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/capture.d.ts +0 -0
  162. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/activation.d.ts +0 -0
  163. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/attributes.d.ts +0 -0
  164. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/content-policy.d.ts +0 -0
  165. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/context.d.ts +0 -0
  166. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/delegation.d.ts +0 -0
  167. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/mcp.d.ts +0 -0
  168. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/scopes.d.ts +0 -0
  169. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/snapshot.d.ts +0 -0
  170. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/span-kinds.d.ts +0 -0
  171. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/types.d.ts +0 -0
  172. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/writer.d.ts +0 -0
  173. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/delegation.d.ts +0 -0
  174. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/delegation.js +0 -0
  175. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/operations.d.ts +0 -0
  176. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/otel.d.ts +0 -0
  177. /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/otel.js +0 -0
@@ -1 +1 @@
1
- import{createLogger,formatError}from"#internal/logging.js";import{contextStorage}from"#context/container.js";import{ConversationIdKey}from"#context/keys.js";import{resolveInstrumentationEnvironment}from"#internal/application/dev-environment.js";import{readConversationId}from"#shared/conversation-identity.js";import{ContextAgentTraceStateStore}from"#tracing/eve/agent-trace-context-store.js";import{registerInstrumentationRuntime}from"#instrumentation/runtime.js";import{createInstrumentationHooks}from"#instrumentation/lifecycle.js";import{AgentSpanIdGenerator,otelTelemetry}from"#compiled/@eve/tracing/index.js";import{hasConversationRelease}from"#tracing/local/traces.js";import{eveOutputMapping}from"#tracing/eve/profile.js";import{createAgentOtelInstrumentation}from"#tracing/eve/agent-otel-provider.js";import{registerOtel}from"#tracing/eve/otel-registration.js";const log=createLogger(`tracing.install-instrumentation-runtime`);function installInstrumentationRuntime(e){let t=[],n=[],r,i,a,runInContext=(e,t)=>t(),o;if(e.collected.declared){r=registerOtel({serviceName:e.serviceName,otel:e.collected.configuration}),o=r.idGenerator;let s=createAgentOtelInstrumentation({environment:resolveInstrumentationEnvironment(),frameworkVersion:e.frameworkVersion,telemetry:otelTelemetry({provider:r.provider,tracerName:`eve.agent`,tracerVersion:e.frameworkVersion,idGenerator:o,samplesTrace:r.samplesTrace,mapping:eveOutputMapping()}),idGenerator:o,recordInputs:e.collected.settings.recordInputs,recordOutputs:e.collected.settings.recordOutputs,stateStore:new ContextAgentTraceStateStore,tracePolicy:e.collected.settings.tracePolicy});t.push({...s.hook,stateNamespace:`internal:otel`}),i=s.prepareSessionTrace,a=s.prepareTurnTrace,runInContext=s.runInContext;let c=e.collected.configuration.spanProcessors.filter(isSpanProcessor).filter(hasConversationRelease);c.length>0&&n.push(sessionReleaseProvider(c))}else o=new AgentSpanIdGenerator;let s=[...t,...e.providers,...n],c;return registerInstrumentationRuntime({forceFlush:async()=>{await settleAll(s.map(e=>()=>e.flush?.())),await settleAll(r===void 0?[]:[r.forceFlush])},hooks:createInstrumentationHooks({parallel:e.providers,serialAfter:n,serialBefore:t}),idGenerator:o,memoryOperations:r!==void 0||e.providers.some(hasMemoryOperationHandler),otelSettings:e.collected.declared?e.collected.settings:void 0,ownsAgentSpans:r!==void 0,prepareSessionTrace:i,prepareTurnTrace:a,runtimeContextResolvers:e.runtimeContextResolvers,runInContext,samplesTrace:r?.samplesTrace,shutdown:()=>(c??=(async()=>{await settleAll(s.map(e=>()=>e.shutdown?.())),await settleAll(r===void 0?[]:[r.shutdown])})(),c)})}function hasMemoryOperationHandler(e){return e.events?.[`memory.operation.started`]!==void 0||e.events?.[`memory.operation.completed`]!==void 0||e.events?.[`memory.operation.failed`]!==void 0}function isSpanProcessor(e){return e!==`auto`}function sessionReleaseProvider(e){let release=async t=>{let n=readConversationId(contextStorage.getStore()?.get(ConversationIdKey))??t.sessionId;n===t.sessionId&&await Promise.all(e.map(e=>e.releaseConversation(n)))};return{events:{"session.completed":release,"session.failed":release},name:`eve.conversation-release`,stateNamespace:`internal:conversation-release`}}async function settleAll(e){let t=await Promise.allSettled(e.map(async e=>e()));for(let e of t)e.status===`rejected`&&log.warn(`instrumentation drain failed`,{error:formatError(e.reason)})}export{installInstrumentationRuntime};
1
+ import{createLogger,formatError}from"#internal/logging.js";import{contextStorage}from"#context/container.js";import{ConversationIdKey}from"#context/keys.js";import{resolveInstrumentationEnvironment}from"#internal/application/dev-environment.js";import{readConversationId}from"#shared/conversation-identity.js";import{ContextAgentTraceStateStore}from"#tracing/eve/agent-trace-context-store.js";import{registerInstrumentationRuntime}from"#instrumentation/runtime.js";import{createInstrumentationHooks}from"#instrumentation/lifecycle.js";import{AgentSpanIdGenerator,otelTelemetry}from"#compiled/@vercel/agent-runs/index.js";import{hasConversationRelease}from"#tracing/local/traces.js";import{eveOutputMapping}from"#tracing/eve/profile.js";import{createAgentOtelInstrumentation}from"#tracing/eve/agent-otel-provider.js";import{registerOtel}from"#tracing/eve/otel-registration.js";const log=createLogger(`tracing.install-instrumentation-runtime`);function installInstrumentationRuntime(e){let t=[],n=[],r,i,a,runInContext=(e,t)=>t(),o;if(e.collected.declared){r=registerOtel({serviceName:e.serviceName,otel:e.collected.configuration}),o=r.idGenerator;let s=createAgentOtelInstrumentation({environment:resolveInstrumentationEnvironment(),frameworkVersion:e.frameworkVersion,telemetry:otelTelemetry({provider:r.provider,tracerName:`eve.agent`,tracerVersion:e.frameworkVersion,idGenerator:o,samplesTrace:r.samplesTrace,mapping:eveOutputMapping()}),idGenerator:o,recordInputs:e.collected.settings.recordInputs,recordOutputs:e.collected.settings.recordOutputs,stateStore:new ContextAgentTraceStateStore,tracePolicy:e.collected.settings.tracePolicy});t.push({...s.hook,stateNamespace:`internal:otel`}),i=s.prepareSessionTrace,a=s.prepareTurnTrace,runInContext=s.runInContext;let c=e.collected.configuration.spanProcessors.filter(isSpanProcessor).filter(hasConversationRelease);c.length>0&&n.push(sessionReleaseProvider(c))}else o=new AgentSpanIdGenerator;let s=[...t,...e.providers,...n],c;return registerInstrumentationRuntime({forceFlush:async()=>{await settleAll(s.map(e=>()=>e.flush?.())),await settleAll(r===void 0?[]:[r.forceFlush])},hooks:createInstrumentationHooks({parallel:e.providers,serialAfter:n,serialBefore:t}),idGenerator:o,memoryOperations:r!==void 0||e.providers.some(hasMemoryOperationHandler),otelSettings:e.collected.declared?e.collected.settings:void 0,ownsAgentSpans:r!==void 0,prepareSessionTrace:i,prepareTurnTrace:a,runtimeContextResolvers:e.runtimeContextResolvers,runInContext,samplesTrace:r?.samplesTrace,shutdown:()=>(c??=(async()=>{await settleAll(s.map(e=>()=>e.shutdown?.())),await settleAll(r===void 0?[]:[r.shutdown])})(),c)})}function hasMemoryOperationHandler(e){return e.events?.[`memory.operation.started`]!==void 0||e.events?.[`memory.operation.completed`]!==void 0||e.events?.[`memory.operation.failed`]!==void 0}function isSpanProcessor(e){return e!==`auto`}function sessionReleaseProvider(e){let release=async t=>{let n=readConversationId(contextStorage.getStore()?.get(ConversationIdKey))??t.sessionId;n===t.sessionId&&await Promise.all(e.map(e=>e.releaseConversation(n)))};return{events:{"session.completed":release,"session.failed":release},name:`eve.conversation-release`,stateNamespace:`internal:conversation-release`}}async function settleAll(e){let t=await Promise.allSettled(e.map(async e=>e()));for(let e of t)e.status===`rejected`&&log.warn(`instrumentation drain failed`,{error:formatError(e.reason)})}export{installInstrumentationRuntime};
@@ -1 +1 @@
1
- import{createLogger,formatError}from"#internal/logging.js";import{applyLiveDeliveryAudienceCeiling}from"#shared/forwarded-trace-policy.js";import{DIRECT_TOOL_CALL_ATTRIBUTE,DIRECT_TOOL_CALL_VALUE}from"#tracing/local/inspection.js";import{resolveInstrumentationEnvironment}from"#internal/application/dev-environment.js";import{operationConversationId}from"#tracing/eve/conversation-context.js";import{resolveTracePolicy}from"#shared/trace-policy.js";import{context}from"#compiled/@opentelemetry/api/index.js";import{buildConversationContext}from"#channel/conversation-context.js";import{markAgentTraceContext}from"#tracing/eve/agent-trace-context.js";import{toolCallIdempotencyKey}from"#instrumentation/lifecycle.js";import{contentAttribute,mcpLifecycle,withErrorContent}from"#compiled/@eve/tracing/otel.js";import{otelTelemetry}from"#compiled/@eve/tracing/index.js";import{getInstrumentationRuntime}from"#instrumentation/runtime-global.js";import{MCP_SERIALIZER}from"#tracing/eve/mcp.js";import{withChannelAudience}from"#tracing/eve/channel-audience-context.js";import{eveOutputMapping}from"#tracing/eve/profile.js";const log=createLogger(`invoke-tool`),agentTelemetry=()=>otelTelemetry({tracerName:`eve.agent`,mapping:eveOutputMapping()});async function withInvokeToolSpan(e,t){let n=withErrorContent(context.active(),!1);return await context.with(n,()=>traced(e,n,t))}async function traced(e,t,n){let r=getInstrumentationRuntime();if(r===void 0)return await n(silentObserver);let i=agentTelemetry(),a=buildConversationContext({adapter:e.origin?.adapter??{kind:`channel`},auth:e.auth,channelName:e.origin?.channelName},resolveInstrumentationEnvironment()),o=toolCallEvents(r.hooks.forTrace?.({agentName:e.agentName,...a})??r.hooks,{attemptId:e.callId,attemptIndex:0,channelAudience:a.audience,functionId:e.agentName,rootSessionId:e.sessionId,sessionId:e.sessionId,stepIndex:0,traceSessionId:e.sessionId,turnId:e.callId},e),s=r.otelSettings;if(s===void 0)return await n(o.observer(void 0));let c=resolveTracePolicy(s.tracePolicy,{agentName:e.agentName,...a},e=>log.warn(`tracePolicy threw; dropping the tool call's trace`,{error:formatError(e)}));if(c.action===`drop`)return await i.suppressed(()=>n(o.observer(void 0)));let l=applyLiveDeliveryAudienceCeiling({...c,recordInputs:s.recordInputs&&c.recordInputs,recordOutputs:s.recordOutputs&&c.recordOutputs},a.audience,void 0,a.environment),u=l.action===`record`&&l.recordInputs,d=l.action===`record`&&l.recordOutputs,f=`execute_tool ${e.toolName}`,p=withChannelAudience(t,a.audience),m={"agent.tool.is_framework":!1,"gen_ai.agent.name":e.agentName,"gen_ai.operation.name":`execute_tool`,"gen_ai.tool.call.id":e.callId,"gen_ai.tool.name":e.toolName,"gen_ai.tool.type":`function`,[DIRECT_TOOL_CALL_ATTRIBUTE]:DIRECT_TOOL_CALL_VALUE,"operation.name":`execute_tool`,"resource.name":f,"agent.run.id":e.sessionId,"agent.trace.schema.version":4,"gen_ai.conversation.id":operationConversationId({sessionId:e.sessionId})};process.env.VERCEL_ENV!==void 0&&(m[`vercel.session_id`]=e.sessionId),e.origin!==void 0&&(m[`eve.channel.kind`]=a.channel.kind,m[`eve.channel.name`]=e.origin.channelName);let h=i.startSpan({type:`tool`,operationId:e.callId,name:f,kind:`INTERNAL`,attributes:m},{context:p}),g={emit:!0,recordInputs:u,recordOutputs:d},_=markAgentTraceContext(withErrorContent(p,d)),v=mcpLifecycle({serializer:MCP_SERIALIZER,...g,write:e=>setDefined(h,e),error:(e,t)=>h.fail(d?e:void 0,t)}),y,b=o.observer({failedWith:e=>{y={error:e}},recordInputs:u,span:h});try{let e=await i.run({type:`tool`,reference:h.reference,capture:g,mcp:v},()=>n(b),_);if(h.setAttribute(`eve.tool.outcome`,e.status),e.status===`completed`&&d){let t=contentAttribute(e.output);t!==void 0&&h.setAttribute(`gen_ai.tool.call.result`,t)}return e.status===`invalid-input`?h.fail(void 0,e.status):e.status===`failed`&&h.fail(d?y?.error:void 0,y===void 0?e.status:void 0),e}catch(e){throw h.fail(d?e:void 0),e}finally{h.end(),await r.forceFlush().catch(e=>{log.warn(`flushing a tool call's trace failed`,{error:formatError(e)})})}}const silentObserver={executed:async()=>{},executing:async()=>{},failedWith:()=>{}};function toolCallEvents(e,t,n){let r=e.capturesInputs??e.capturesContent,i=e.capturesOutputs??e.capturesContent,a=toolCallIdempotencyKey(t,n.callId,0);return{observer(o){return{async executing(i){if(o?.recordInputs){let e=contentAttribute(i);e!==void 0&&o.span.setAttribute(`gen_ai.tool.call.arguments`,e)}await e.publish(Object.freeze({callId:n.callId,idempotencyKey:a,input:r?i:void 0,scope:t,toolName:n.toolName,type:`tool.call.started`}))},async executed(n){o?.span.setAttribute(`gen_ai.execute_tool.duration`,n.durationMs/1e3);let r=n.type===`result`?i?{output:n.output,type:`result`}:{type:`result`}:i?{error:n.error,type:`error`}:{type:`error`};await e.publish(Object.freeze({durationMs:n.durationMs,idempotencyKey:a,output:Object.freeze(r),scope:t,type:`tool.call.completed`,outcome:n.type===`result`?`completed`:`failed`}))},failedWith(e){o?.failedWith(e)}}}}}function setDefined(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&e.setAttribute(n,r)}export{withInvokeToolSpan};
1
+ import{createLogger,formatError}from"#internal/logging.js";import{applyLiveDeliveryAudienceCeiling}from"#shared/forwarded-trace-policy.js";import{DIRECT_TOOL_CALL_ATTRIBUTE,DIRECT_TOOL_CALL_VALUE}from"#tracing/local/inspection.js";import{resolveInstrumentationEnvironment}from"#internal/application/dev-environment.js";import{operationConversationId}from"#tracing/eve/conversation-context.js";import{resolveTracePolicy}from"#shared/trace-policy.js";import{context}from"#compiled/@opentelemetry/api/index.js";import{buildConversationContext}from"#channel/conversation-context.js";import{markAgentTraceContext}from"#tracing/eve/agent-trace-context.js";import{toolCallIdempotencyKey}from"#instrumentation/lifecycle.js";import{contentAttribute,mcpLifecycle,withErrorContent}from"#compiled/@vercel/agent-runs/otel.js";import{otelTelemetry}from"#compiled/@vercel/agent-runs/index.js";import{getInstrumentationRuntime}from"#instrumentation/runtime-global.js";import{MCP_SERIALIZER}from"#tracing/eve/mcp.js";import{withChannelAudience}from"#tracing/eve/channel-audience-context.js";import{eveOutputMapping}from"#tracing/eve/profile.js";const log=createLogger(`invoke-tool`),agentTelemetry=()=>otelTelemetry({tracerName:`eve.agent`,mapping:eveOutputMapping()});async function withInvokeToolSpan(e,t){let n=withErrorContent(context.active(),!1);return await context.with(n,()=>traced(e,n,t))}async function traced(e,t,n){let r=getInstrumentationRuntime();if(r===void 0)return await n(silentObserver);let i=agentTelemetry(),a=buildConversationContext({adapter:e.origin?.adapter??{kind:`channel`},auth:e.auth,channelName:e.origin?.channelName},resolveInstrumentationEnvironment()),o=toolCallEvents(r.hooks.forTrace?.({agentName:e.agentName,...a})??r.hooks,{attemptId:e.callId,attemptIndex:0,channelAudience:a.audience,functionId:e.agentName,rootSessionId:e.sessionId,sessionId:e.sessionId,stepIndex:0,traceSessionId:e.sessionId,turnId:e.callId},e),s=r.otelSettings;if(s===void 0)return await n(o.observer(void 0));let c=resolveTracePolicy(s.tracePolicy,{agentName:e.agentName,...a},e=>log.warn(`tracePolicy threw; dropping the tool call's trace`,{error:formatError(e)}));if(c.action===`drop`)return await i.suppressed(()=>n(o.observer(void 0)));let l=applyLiveDeliveryAudienceCeiling({...c,recordInputs:s.recordInputs&&c.recordInputs,recordOutputs:s.recordOutputs&&c.recordOutputs},a.audience,void 0,a.environment),u=l.action===`record`&&l.recordInputs,d=l.action===`record`&&l.recordOutputs,f=`execute_tool ${e.toolName}`,p=withChannelAudience(t,a.audience),m={"agent.tool.is_framework":!1,"gen_ai.agent.name":e.agentName,"gen_ai.operation.name":`execute_tool`,"gen_ai.tool.call.id":e.callId,"gen_ai.tool.name":e.toolName,"gen_ai.tool.type":`function`,[DIRECT_TOOL_CALL_ATTRIBUTE]:DIRECT_TOOL_CALL_VALUE,"operation.name":`execute_tool`,"resource.name":f,"agent.run.id":e.sessionId,"agent.trace.schema.version":4,"gen_ai.conversation.id":operationConversationId({sessionId:e.sessionId})};process.env.VERCEL_ENV!==void 0&&(m[`vercel.session_id`]=e.sessionId),e.origin!==void 0&&(m[`eve.channel.kind`]=a.channel.kind,m[`eve.channel.name`]=e.origin.channelName);let h=i.startSpan({type:`tool`,operationId:e.callId,name:f,kind:`INTERNAL`,attributes:m},{context:p}),g={emit:!0,recordInputs:u,recordOutputs:d},_=markAgentTraceContext(withErrorContent(p,d)),v=mcpLifecycle({serializer:MCP_SERIALIZER,...g,write:e=>setDefined(h,e),error:(e,t)=>h.fail(d?e:void 0,t)}),y,b=o.observer({failedWith:e=>{y={error:e}},recordInputs:u,span:h});try{let e=await i.run({type:`tool`,reference:h.reference,capture:g,mcp:v},()=>n(b),_);if(h.setAttribute(`eve.tool.outcome`,e.status),e.status===`completed`&&d){let t=contentAttribute(e.output);t!==void 0&&h.setAttribute(`gen_ai.tool.call.result`,t)}return e.status===`invalid-input`?h.fail(void 0,e.status):e.status===`failed`&&h.fail(d?y?.error:void 0,y===void 0?e.status:void 0),e}catch(e){throw h.fail(d?e:void 0),e}finally{h.end(),await r.forceFlush().catch(e=>{log.warn(`flushing a tool call's trace failed`,{error:formatError(e)})})}}const silentObserver={executed:async()=>{},executing:async()=>{},failedWith:()=>{}};function toolCallEvents(e,t,n){let r=e.capturesInputs??e.capturesContent,i=e.capturesOutputs??e.capturesContent,a=toolCallIdempotencyKey(t,n.callId,0);return{observer(o){return{async executing(i){if(o?.recordInputs){let e=contentAttribute(i);e!==void 0&&o.span.setAttribute(`gen_ai.tool.call.arguments`,e)}await e.publish(Object.freeze({callId:n.callId,idempotencyKey:a,input:r?i:void 0,scope:t,toolName:n.toolName,type:`tool.call.started`}))},async executed(n){o?.span.setAttribute(`gen_ai.execute_tool.duration`,n.durationMs/1e3);let r=n.type===`result`?i?{output:n.output,type:`result`}:{type:`result`}:i?{error:n.error,type:`error`}:{type:`error`};await e.publish(Object.freeze({durationMs:n.durationMs,idempotencyKey:a,output:Object.freeze(r),scope:t,type:`tool.call.completed`,outcome:n.type===`result`?`completed`:`failed`}))},failedWith(e){o?.failedWith(e)}}}}}function setDefined(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&e.setAttribute(n,r)}export{withInvokeToolSpan};
@@ -1,5 +1,5 @@
1
1
  import { type Context as OtelContext } from "#compiled/@opentelemetry/api/index.js";
2
- import { type ContentSerializer } from "#compiled/@eve/tracing/index.js";
2
+ import { type ContentSerializer } from "#compiled/@vercel/agent-runs/index.js";
3
3
  type Context = Pick<OtelContext, "getValue">;
4
4
  export declare function createMcpTraceFetch(input: {
5
5
  readonly connectionName: string;
@@ -1 +1 @@
1
- import{eveOutputMapping}from"./profile.js";import{context,propagation,trace}from"#compiled/@opentelemetry/api/index.js";import{activeTraceOperation,contentAttribute,mcpLifecycle,truncateTelemetryText}from"#compiled/@eve/tracing/otel.js";import{otelTelemetry}from"#compiled/@eve/tracing/index.js";function isObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const MAX_MCP_TRACE_REQUEST_BYTES=1048576,MAX_MCP_TRACE_CONTEXT_BYTES=8192,utf8Encoder=new TextEncoder,traceContextSetter={set(e,t,n){e[t]=n}};function createMcpTraceFetch(e){let t=e.fetcher??((e,t)=>globalThis.fetch(e,t)),n=e.getActiveContext??(()=>context.active()),r=e.injectContext??injectOpenTelemetryTraceContext;return async(i,a)=>{let o=readJsonRpcRequest(a?.body);if(o===void 0)return await t(i,a);let s=n(),c=injectMcpTraceContext(o,s,r,e.filterCarrier),l=o.method===`tools/call`||(o.method===`tools/list`||o.method===`events/list`)&&activeTraceOperation(s)?.type===`mcp`;l&&activeTraceOperation(s)?.mcp?.update(mcpRequestMetadata({connectionName:e.connectionName,message:o,params:isObject(o.params)?o.params:{},protocolVersion:headerValue(a?.headers,`mcp-protocol-version`)??e.getProtocolVersion()}));let u=await t(i,c===void 0?a:{...a,body:JSON.stringify(c)});if(l){let e=u.headers.get(`mcp-session-id`);e!==null&&activeTraceOperation(s)?.mcp?.update({sessionId:truncateTelemetryText(e,512)})}return u}}function injectMcpTraceContext(e,t,n=injectOpenTelemetryTraceContext,r){if(!withinTraceRequestLimit(JSON.stringify(e))||e.params!==void 0&&!isObject(e.params))return;let i={};if(n(t,i),!withinTraceContextLimit(i))return;r?.(i);let a=isObject(e.params)?e.params:{},o=isObject(a._meta)?a._meta:{};return{...e,params:{...a,_meta:{...o,...i}}}}const noContent=()=>void 0,MCP_SERIALIZER={json:contentAttribute,text:noContent,inputMessages:noContent,instructions:noContent,toolDefinitions:noContent,outputMessages:noContent,toolResults:noContent};function createMcpTracing(){let e=otelTelemetry({tracerName:`eve.mcp`,mapping:eveOutputMapping()});function start(t){let n=e.startSpan({type:`mcp`,operationId:`${t.connectionName}:${t.method}`,name:t.method===`tools/call`?`tools/call ${t.toolName??`unknown`}`:t.method,kind:`CLIENT`,parent:trace.getSpan(t.executionContext)?.spanContext(),attributes:{"agent.connection.name":t.connectionName,"mcp.method.name":t.method,"network.protocol.name":`http`,"network.transport":`tcp`,"mcp.protocol.version":t.protocolVersion,"gen_ai.operation.name":t.method===`tools/call`?`execute_tool`:void 0,"gen_ai.tool.name":t.toolName}},{context:t.executionContext}),r=mcpLifecycle({serializer:MCP_SERIALIZER,...t.capture,write(e){for(let[t,r]of Object.entries(e))r!==void 0&&n.setAttribute(t,r)},error:n.fail});return{...r,end:n.end,run(i){return e.run({type:`mcp`,reference:n.reference,capture:t.capture,mcp:r},i,t.executionContext)}}}return{async list(e){let t=context.active(),n=start({method:e.method??`tools/list`,connectionName:e.connectionName,protocolVersion:e.protocolVersion,executionContext:t,capture:activeTraceOperation()?.capture??{emit:!0,recordInputs:!1,recordOutputs:!1}});try{return await n.run(async()=>{try{return await e.execute()}catch(e){let t=jsonRpcErrorCode(e);throw t!==void 0&&n.update({statusCode:t}),n.error(e,errorType(e,t)),e}})}finally{n.end()}},async call(e){let t=context.active(),n=activeTraceOperation();if(n?.type===`tool`&&n.mcp!==void 0)return n.mcp.update({...e,method:`tools/call`}),await runMcpToolCall(e,void 0);let r=start({method:`tools/call`,connectionName:e.connectionName,toolName:truncateTelemetryText(e.toolName,128),protocolVersion:e.protocolVersion,executionContext:t,capture:n?.capture??{emit:!0,recordInputs:!1,recordOutputs:!1}});try{return await r.run(()=>runMcpToolCall(e,r))}finally{r.end()}}}}function runMcpToolCall(e,t){return t!==void 0&&t.arguments(e.arguments),e.execute().then(e=>(isToolErrorResult(e)&&activeTraceOperation()?.mcp?.error(void 0,`tool_error`),t!==void 0&&t.result(e),e)).catch(e=>{let n=jsonRpcErrorCode(e);throw n!==void 0&&activeTraceOperation()?.mcp?.update({statusCode:n}),t!==void 0&&activeTraceOperation()?.mcp?.error(e,errorType(e,n)),e})}function mcpRequestMetadata(e){let t=e.method??e.message?.method,n=e.params??(isObject(e.message?.params)?e.message.params:{}),r=e.toolName??(typeof n.name==`string`?n.name:void 0),i=e.message?.id,a=n._meta,o=e.protocolVersion??(isObject(a)&&typeof a[`io.modelcontextprotocol/protocolVersion`]==`string`?a[`io.modelcontextprotocol/protocolVersion`]:void 0);return{connectionName:e.connectionName,method:t??`unknown`,toolName:r,protocolVersion:o,requestId:typeof i==`number`||typeof i==`string`?String(i):void 0}}function injectOpenTelemetryTraceContext(e,t){propagation.inject(e,t,traceContextSetter)}function readJsonRpcRequest(e){if(typeof e==`string`&&withinTraceRequestLimit(e))try{let t=JSON.parse(e);return isObject(t)&&typeof t.method==`string`?t:void 0}catch{return}}function withinTraceRequestLimit(e){return e.length<=MAX_MCP_TRACE_REQUEST_BYTES&&utf8Encoder.encode(e).byteLength<=MAX_MCP_TRACE_REQUEST_BYTES}function withinTraceContextLimit(e){let t=0;for(let[n,r]of Object.entries(e))if(n.length+r.length>MAX_MCP_TRACE_CONTEXT_BYTES||(t+=utf8Encoder.encode(n).byteLength+utf8Encoder.encode(r).byteLength+2,t>MAX_MCP_TRACE_CONTEXT_BYTES))return!1;return t>0}function headerValue(e,t){if(e!==void 0)try{return new Headers(e).get(t)??void 0}catch{return}}function isToolErrorResult(e){return isObject(e)&&e.isError===!0}function jsonRpcErrorCode(e){if(!isObject(e))return;let t=e.code;return typeof t==`number`||typeof t==`string`?String(t):void 0}function errorType(e,t){return t===void 0?e instanceof Error?e.name||`Error`:void 0:t}export{MCP_SERIALIZER,createMcpTraceFetch,createMcpTracing};
1
+ import{eveOutputMapping}from"./profile.js";import{context,propagation,trace}from"#compiled/@opentelemetry/api/index.js";import{activeTraceOperation,contentAttribute,mcpLifecycle,truncateTelemetryText}from"#compiled/@vercel/agent-runs/otel.js";import{otelTelemetry}from"#compiled/@vercel/agent-runs/index.js";function isObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const MAX_MCP_TRACE_REQUEST_BYTES=1048576,MAX_MCP_TRACE_CONTEXT_BYTES=8192,utf8Encoder=new TextEncoder,traceContextSetter={set(e,t,n){e[t]=n}};function createMcpTraceFetch(e){let t=e.fetcher??((e,t)=>globalThis.fetch(e,t)),n=e.getActiveContext??(()=>context.active()),r=e.injectContext??injectOpenTelemetryTraceContext;return async(i,a)=>{let o=readJsonRpcRequest(a?.body);if(o===void 0)return await t(i,a);let s=n(),c=injectMcpTraceContext(o,s,r,e.filterCarrier),l=o.method===`tools/call`||(o.method===`tools/list`||o.method===`events/list`)&&activeTraceOperation(s)?.type===`mcp`;l&&activeTraceOperation(s)?.mcp?.update(mcpRequestMetadata({connectionName:e.connectionName,message:o,params:isObject(o.params)?o.params:{},protocolVersion:headerValue(a?.headers,`mcp-protocol-version`)??e.getProtocolVersion()}));let u=await t(i,c===void 0?a:{...a,body:JSON.stringify(c)});if(l){let e=u.headers.get(`mcp-session-id`);e!==null&&activeTraceOperation(s)?.mcp?.update({sessionId:truncateTelemetryText(e,512)})}return u}}function injectMcpTraceContext(e,t,n=injectOpenTelemetryTraceContext,r){if(!withinTraceRequestLimit(JSON.stringify(e))||e.params!==void 0&&!isObject(e.params))return;let i={};if(n(t,i),!withinTraceContextLimit(i))return;r?.(i);let a=isObject(e.params)?e.params:{},o=isObject(a._meta)?a._meta:{};return{...e,params:{...a,_meta:{...o,...i}}}}const noContent=()=>void 0,MCP_SERIALIZER={json:contentAttribute,text:noContent,inputMessages:noContent,instructions:noContent,toolDefinitions:noContent,outputMessages:noContent,toolResults:noContent};function createMcpTracing(){let e=otelTelemetry({tracerName:`eve.mcp`,mapping:eveOutputMapping()});function start(t){let n=e.startSpan({type:`mcp`,operationId:`${t.connectionName}:${t.method}`,name:t.method===`tools/call`?`tools/call ${t.toolName??`unknown`}`:t.method,kind:`CLIENT`,parent:trace.getSpan(t.executionContext)?.spanContext(),attributes:{"agent.connection.name":t.connectionName,"mcp.method.name":t.method,"network.protocol.name":`http`,"network.transport":`tcp`,"mcp.protocol.version":t.protocolVersion,"gen_ai.operation.name":t.method===`tools/call`?`execute_tool`:void 0,"gen_ai.tool.name":t.toolName}},{context:t.executionContext}),r=mcpLifecycle({serializer:MCP_SERIALIZER,...t.capture,write(e){for(let[t,r]of Object.entries(e))r!==void 0&&n.setAttribute(t,r)},error:n.fail});return{...r,end:n.end,run(i){return e.run({type:`mcp`,reference:n.reference,capture:t.capture,mcp:r},i,t.executionContext)}}}return{async list(e){let t=context.active(),n=start({method:e.method??`tools/list`,connectionName:e.connectionName,protocolVersion:e.protocolVersion,executionContext:t,capture:activeTraceOperation()?.capture??{emit:!0,recordInputs:!1,recordOutputs:!1}});try{return await n.run(async()=>{try{return await e.execute()}catch(e){let t=jsonRpcErrorCode(e);throw t!==void 0&&n.update({statusCode:t}),n.error(e,errorType(e,t)),e}})}finally{n.end()}},async call(e){let t=context.active(),n=activeTraceOperation();if(n?.type===`tool`&&n.mcp!==void 0)return n.mcp.update({...e,method:`tools/call`}),await runMcpToolCall(e,void 0);let r=start({method:`tools/call`,connectionName:e.connectionName,toolName:truncateTelemetryText(e.toolName,128),protocolVersion:e.protocolVersion,executionContext:t,capture:n?.capture??{emit:!0,recordInputs:!1,recordOutputs:!1}});try{return await r.run(()=>runMcpToolCall(e,r))}finally{r.end()}}}}function runMcpToolCall(e,t){return t!==void 0&&t.arguments(e.arguments),e.execute().then(e=>(isToolErrorResult(e)&&activeTraceOperation()?.mcp?.error(void 0,`tool_error`),t!==void 0&&t.result(e),e)).catch(e=>{let n=jsonRpcErrorCode(e);throw n!==void 0&&activeTraceOperation()?.mcp?.update({statusCode:n}),t!==void 0&&activeTraceOperation()?.mcp?.error(e,errorType(e,n)),e})}function mcpRequestMetadata(e){let t=e.method??e.message?.method,n=e.params??(isObject(e.message?.params)?e.message.params:{}),r=e.toolName??(typeof n.name==`string`?n.name:void 0),i=e.message?.id,a=n._meta,o=e.protocolVersion??(isObject(a)&&typeof a[`io.modelcontextprotocol/protocolVersion`]==`string`?a[`io.modelcontextprotocol/protocolVersion`]:void 0);return{connectionName:e.connectionName,method:t??`unknown`,toolName:r,protocolVersion:o,requestId:typeof i==`number`||typeof i==`string`?String(i):void 0}}function injectOpenTelemetryTraceContext(e,t){propagation.inject(e,t,traceContextSetter)}function readJsonRpcRequest(e){if(typeof e==`string`&&withinTraceRequestLimit(e))try{let t=JSON.parse(e);return isObject(t)&&typeof t.method==`string`?t:void 0}catch{return}}function withinTraceRequestLimit(e){return e.length<=MAX_MCP_TRACE_REQUEST_BYTES&&utf8Encoder.encode(e).byteLength<=MAX_MCP_TRACE_REQUEST_BYTES}function withinTraceContextLimit(e){let t=0;for(let[n,r]of Object.entries(e))if(n.length+r.length>MAX_MCP_TRACE_CONTEXT_BYTES||(t+=utf8Encoder.encode(n).byteLength+utf8Encoder.encode(r).byteLength+2,t>MAX_MCP_TRACE_CONTEXT_BYTES))return!1;return t>0}function headerValue(e,t){if(e!==void 0)try{return new Headers(e).get(t)??void 0}catch{return}}function isToolErrorResult(e){return isObject(e)&&e.isError===!0}function jsonRpcErrorCode(e){if(!isObject(e))return;let t=e.code;return typeof t==`number`||typeof t==`string`?String(t):void 0}function errorType(e,t){return t===void 0?e instanceof Error?e.name||`Error`:void 0:t}export{MCP_SERIALIZER,createMcpTraceFetch,createMcpTracing};
@@ -1,5 +1,5 @@
1
1
  import type { AgentSessionTraceState, AgentTurnTraceState } from "#tracing/eve/agent-trace-state.js";
2
- import type { TurnInput } from "#compiled/@eve/tracing/index.js";
2
+ import type { TurnInput } from "#compiled/@vercel/agent-runs/index.js";
3
3
  export declare function eveActivationMetadata(input: {
4
4
  readonly session?: AgentSessionTraceState;
5
5
  readonly turn: AgentTurnTraceState;
@@ -1,6 +1,6 @@
1
1
  import type { SpanContext } from "#compiled/@opentelemetry/api/index.js";
2
2
  import type { AgentTraceStateStore } from "#tracing/eve/agent-trace-state.js";
3
- import { type AgentTelemetry, type AgentTracing } from "#compiled/@eve/tracing/index.js";
3
+ import { type AgentTelemetry, type AgentRun } from "#compiled/@vercel/agent-runs/index.js";
4
4
  export declare function traceSessionIdOf(scope: {
5
5
  readonly traceSessionId?: string;
6
6
  readonly rootSessionId?: string;
@@ -27,4 +27,4 @@ export declare function eveCapture(reference: SpanContext | undefined): {
27
27
  export declare function createEveTracing(input: {
28
28
  readonly telemetry: AgentTelemetry;
29
29
  readonly stateStore: AgentTraceStateStore;
30
- }): AgentTracing;
30
+ }): AgentRun;
@@ -1 +1 @@
1
- import{resolveConversationId}from"#shared/conversation-identity.js";import{createAgentTracing}from"#compiled/@eve/tracing/index.js";function traceSessionIdOf(e){return e.traceSessionId??e.rootSessionId??e.sessionId}function checkpointContent(e){if(e!==void 0)try{return JSON.parse(e)}catch{return}}function eveTurnIdentity(e){return{conversationId:resolveConversationId(e.rootSessionId??e.sessionId),runId:e.sessionId,turnId:e.turnId}}function eveCapture(e){return{emit:!!((e?.traceFlags??1)&1),recordInputs:!0,recordOutputs:!0}}function createEveTracing(e){return createAgentTracing({telemetry:e.telemetry,checkpointer:{get:t=>e.stateStore.get(`checkpoint`,t),set:(t,n)=>e.stateStore.set(`checkpoint`,t,n),delete:t=>e.stateStore.delete(`checkpoint`,t)}})}export{checkpointContent,createEveTracing,eveCapture,eveTurnIdentity,traceSessionIdOf};
1
+ import{resolveConversationId}from"#shared/conversation-identity.js";import{createAgentRun}from"#compiled/@vercel/agent-runs/index.js";function traceSessionIdOf(e){return e.traceSessionId??e.rootSessionId??e.sessionId}function checkpointContent(e){if(e!==void 0)try{return JSON.parse(e)}catch{return}}function eveTurnIdentity(e){return{conversationId:resolveConversationId(e.rootSessionId??e.sessionId),runId:e.sessionId,turnId:e.turnId}}function eveCapture(e){return{emit:!!((e?.traceFlags??1)&1),recordInputs:!0,recordOutputs:!0}}function createEveTracing(e){return createAgentRun({telemetry:e.telemetry,checkpointer:{get:t=>e.stateStore.get(`checkpoint`,t),set:(t,n)=>e.stateStore.set(`checkpoint`,t,n),delete:t=>e.stateStore.delete(`checkpoint`,t)}})}export{checkpointContent,createEveTracing,eveCapture,eveTurnIdentity,traceSessionIdOf};
@@ -1,7 +1,7 @@
1
1
  import { type TracerProvider } from "#compiled/@opentelemetry/api/index.js";
2
- import { AgentSpanIdGenerator } from "#compiled/@eve/tracing/index.js";
2
+ import { AgentSpanIdGenerator } from "#compiled/@vercel/agent-runs/index.js";
3
3
  import type { OtelConfiguration } from "./otel-configuration.js";
4
- import { type Attributes } from "#compiled/@eve/tracing/index.js";
4
+ import { type Attributes } from "#compiled/@vercel/agent-runs/index.js";
5
5
  export type SamplingOperation = {
6
6
  readonly name: string;
7
7
  readonly attributes?: Attributes;
@@ -1 +1 @@
1
- import{createRequire}from"node:module";import{conversationIdFromContext}from"#tracing/eve/conversation-context.js";import{SpanKind,context,metrics,propagation,trace}from"#compiled/@opentelemetry/api/index.js";import{invocationName}from"#compiled/@eve/tracing/otel.js";import{AgentSpanIdGenerator}from"#compiled/@eve/tracing/index.js";import{registerOTel}from"#compiled/@vercel/otel/index.js";const REGISTRATION_SPAN_NAME=`eve.otel.registration`,REPLAY_DEDUPLICATION_LIMIT=1e5,REPLAY_DEDUPLICATION_KEY=Symbol.for(`eve.otel.replay-deduplication`),require=createRequire(import.meta.url),replayDeduplicationGlobal=globalThis;var RegistrationMarkerPropagator=class{#e=!1;extract(e){return e}fields(){return[]}inject(){this.#e=!0}isInstalled(){return this.#e=!1,propagation.inject(context.active(),{},{set:()=>{}}),this.#e}},PrivateSpanFilteringProcessor=class{endedSpans;forwardedSpans=new Set;pendingByParent=new Map;pendingSpanCount=0;processors;startedSpans=new Set;constructor(e,t){this.processors=e,this.endedSpans=t}async forceFlush(){this.drainPendingSpans(),await Promise.all(this.processors.map(e=>e.forceFlush()))}onEnd(e){if(isRegistrationSpan(e))return;let t=spanIdentity(e);if(t!==void 0){if(this.endedSpans.has(t))return;if(this.endedSpans.size>=REPLAY_DEDUPLICATION_LIMIT){let e=this.endedSpans.values().next().value;e!==void 0&&this.endedSpans.delete(e)}this.endedSpans.add(t)}let n=parentIdentity(e);if(n!==void 0&&this.startedSpans.has(n)&&!this.forwardedSpans.has(n)){let t=this.pendingByParent.get(n)??[];t.push(e),this.pendingByParent.set(n,t),this.pendingSpanCount+=1,this.pendingSpanCount>1e4&&this.releaseOldestPendingParent();return}this.forward(e,t)}onStart(e,t){if(isRegistrationSpan(e))return;let n=conversationIdFromContext(t);n!==void 0&&e.attributes?.[`gen_ai.conversation.id`]===void 0&&e.setAttribute(`gen_ai.conversation.id`,n);let r=spanIdentity(e);r!==void 0&&addBounded(this.startedSpans,r);for(let n of this.processors)n.onStart(e,t)}async shutdown(){this.drainPendingSpans(),await Promise.all(this.processors.map(e=>e.shutdown()))}drainPendingSpans(){for(;this.pendingByParent.size>0;)this.releaseOldestPendingParent()}releaseOldestPendingParent(){let e=this.pendingByParent.keys().next().value;e!==void 0&&this.releaseChildren(e)}releaseChildren(e){let t=this.pendingByParent.get(e);if(t!==void 0){this.pendingByParent.delete(e),this.pendingSpanCount-=t.length;for(let e of t)this.forward(e,spanIdentity(e))}}forward(e,t){for(let t of this.processors)t.onEnd(e);t!==void 0&&(addBounded(this.forwardedSpans,t),this.releaseChildren(t))}};function registerOtelPipeline(e){let t=e.otel,n=captureOptionalPeerTracerProxy(),r=new AgentSpanIdGenerator,i=new RegistrationMarkerPropagator,a=privateSpanProcessors(t.spanProcessors),o={attributes:t.resource,autoDetectResources:!1,idGenerator:r,instrumentations:t.instrumentations??[],metricReaders:t.metricReaders,propagators:[...t.propagators??[`auto`],i],serviceName:e.serviceName,spanProcessors:a};registerOTel(t.sampler===void 0?o:{...o,traceSampler:t.sampler});let s=globalTracerUses(r),c=i.isInstalled();if((!s||!c)&&rollbackRegistration({ownsPropagator:c,ownsTracer:s}),!s)throw Error("eve could not register OpenTelemetry because another runtime already owns the global tracer provider. Remove the other `registerOTel` call, or move its exporters into eve's `otelIntegration({ spanProcessors: [...] })`.");if(!c)throw Error("eve could not register OpenTelemetry because another runtime already owns the global propagator. Remove the other global propagator registration and declare propagators through eve's `otel()` instead.");let l=runtimeTracerProvider();if(typeof l.forceFlush!=`function`||typeof l.shutdown!=`function`)throw rollbackRegistration({ownsPropagator:c,ownsTracer:s}),Error(`The registered OpenTelemetry tracer provider has no lifecycle methods.`);n?.setDelegate(l);let u=runtimeMeterProvider();return{provider:trace.getTracerProvider(),forceFlush:async()=>{await Promise.all([l.forceFlush(),u.forceFlush?.()])},idGenerator:r,samplesTrace:(e,t)=>samplerAdmitsTrace(r,e,t),shutdown:async()=>{disableInstrumentations(t.instrumentations),await Promise.all([l.shutdown(),u.shutdown?.()])}}}function privateSpanProcessors(e){let t=e.filter(isSpanProcessor);if(t.length===0)return[...e];let n=new PrivateSpanFilteringProcessor(t,replayDeduplicationRegistry()),r=[],i=!1;for(let t of e){if(!isSpanProcessor(t)){r.push(t);continue}i||(i=!0,r.push(n))}return r}function replayDeduplicationRegistry(){let e=replayDeduplicationGlobal[REPLAY_DEDUPLICATION_KEY];if(e!==void 0)return e;let t=new Set;return replayDeduplicationGlobal[REPLAY_DEDUPLICATION_KEY]=t,t}const registerOtel=registerOtelPipeline;function samplerAdmitsTrace(e,t,n={name:invocationName(void 0)}){return(e.withTraceId(t,()=>trace.getTracer(`eve.registration`).startSpan(n.name,{attributes:n.attributes,kind:SpanKind.INTERNAL,root:!0})).spanContext().traceFlags&1)==1}function rollbackRegistration(e){if(e.ownsPropagator&&propagation.disable(),!e.ownsTracer)return;let t=runtimeTracerProvider();if(typeof t.shutdown==`function`)try{t.shutdown().catch(()=>{})}catch{}trace.disable()}function runtimeTracerProvider(){let e=trace.getTracerProvider();return e.getDelegate?.()??e}function runtimeMeterProvider(){let e=metrics.getMeterProvider();return{forceFlush:typeof e?.forceFlush==`function`?()=>e.forceFlush():void 0,shutdown:typeof e?.shutdown==`function`?()=>e.shutdown():void 0}}function disableInstrumentations(e){for(let t of e??[]){let e=t?.disable;if(typeof e==`function`)try{e.call(t)}catch{}}}function globalTracerUses(e){let t=e.allocateSpanId();return e.withSpanId(t,()=>trace.getTracer(`eve.registration`).startSpan(REGISTRATION_SPAN_NAME)).spanContext().spanId===t}function isRegistrationSpan(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===REGISTRATION_SPAN_NAME||`instrumentationScope`in e&&e.instrumentationScope?.name===`eve.registration`)}function spanIdentity(e){if(typeof e!=`object`||!e||!(`spanContext`in e)||typeof e.spanContext!=`function`)return;let t=e.spanContext();return typeof t.traceId==`string`&&typeof t.spanId==`string`?`${t.traceId}:${t.spanId}`:void 0}function parentIdentity(e){if(typeof e!=`object`||!e||!(`parentSpanContext`in e))return;let t=e.parentSpanContext;return typeof t?.traceId==`string`&&typeof t.spanId==`string`?`${t.traceId}:${t.spanId}`:void 0}function addBounded(e,t){if(e.size>=REPLAY_DEDUPLICATION_LIMIT){let t=e.values().next().value;t!==void 0&&e.delete(t)}e.add(t)}function isSpanProcessor(e){return e!==`auto`}function captureOptionalPeerTracerProxy(){try{let e=require("@opentelemetry/api"),t=e.trace.getTracerProvider();return t instanceof e.ProxyTracerProvider?t:void 0}catch{return}}export{registerOtel,registerOtelPipeline};
1
+ import{createRequire}from"node:module";import{conversationIdFromContext}from"#tracing/eve/conversation-context.js";import{SpanKind,context,metrics,propagation,trace}from"#compiled/@opentelemetry/api/index.js";import{invocationName}from"#compiled/@vercel/agent-runs/otel.js";import{AgentSpanIdGenerator}from"#compiled/@vercel/agent-runs/index.js";import{registerOTel}from"#compiled/@vercel/otel/index.js";const REGISTRATION_SPAN_NAME=`eve.otel.registration`,REPLAY_DEDUPLICATION_LIMIT=1e5,REPLAY_DEDUPLICATION_KEY=Symbol.for(`eve.otel.replay-deduplication`),require=createRequire(import.meta.url),replayDeduplicationGlobal=globalThis;var RegistrationMarkerPropagator=class{#e=!1;extract(e){return e}fields(){return[]}inject(){this.#e=!0}isInstalled(){return this.#e=!1,propagation.inject(context.active(),{},{set:()=>{}}),this.#e}},PrivateSpanFilteringProcessor=class{endedSpans;forwardedSpans=new Set;pendingByParent=new Map;pendingSpanCount=0;processors;startedSpans=new Set;constructor(e,t){this.processors=e,this.endedSpans=t}async forceFlush(){this.drainPendingSpans(),await Promise.all(this.processors.map(e=>e.forceFlush()))}onEnd(e){if(isRegistrationSpan(e))return;let t=spanIdentity(e);if(t!==void 0){if(this.endedSpans.has(t))return;if(this.endedSpans.size>=REPLAY_DEDUPLICATION_LIMIT){let e=this.endedSpans.values().next().value;e!==void 0&&this.endedSpans.delete(e)}this.endedSpans.add(t)}let n=parentIdentity(e);if(n!==void 0&&this.startedSpans.has(n)&&!this.forwardedSpans.has(n)){let t=this.pendingByParent.get(n)??[];t.push(e),this.pendingByParent.set(n,t),this.pendingSpanCount+=1,this.pendingSpanCount>1e4&&this.releaseOldestPendingParent();return}this.forward(e,t)}onStart(e,t){if(isRegistrationSpan(e))return;let n=conversationIdFromContext(t);n!==void 0&&e.attributes?.[`gen_ai.conversation.id`]===void 0&&e.setAttribute(`gen_ai.conversation.id`,n);let r=spanIdentity(e);r!==void 0&&addBounded(this.startedSpans,r);for(let n of this.processors)n.onStart(e,t)}async shutdown(){this.drainPendingSpans(),await Promise.all(this.processors.map(e=>e.shutdown()))}drainPendingSpans(){for(;this.pendingByParent.size>0;)this.releaseOldestPendingParent()}releaseOldestPendingParent(){let e=this.pendingByParent.keys().next().value;e!==void 0&&this.releaseChildren(e)}releaseChildren(e){let t=this.pendingByParent.get(e);if(t!==void 0){this.pendingByParent.delete(e),this.pendingSpanCount-=t.length;for(let e of t)this.forward(e,spanIdentity(e))}}forward(e,t){for(let t of this.processors)t.onEnd(e);t!==void 0&&(addBounded(this.forwardedSpans,t),this.releaseChildren(t))}};function registerOtelPipeline(e){let t=e.otel,n=captureOptionalPeerTracerProxy(),r=new AgentSpanIdGenerator,i=new RegistrationMarkerPropagator,a=privateSpanProcessors(t.spanProcessors),o={attributes:t.resource,autoDetectResources:!1,idGenerator:r,instrumentations:t.instrumentations??[],metricReaders:t.metricReaders,propagators:[...t.propagators??[`auto`],i],serviceName:e.serviceName,spanProcessors:a};registerOTel(t.sampler===void 0?o:{...o,traceSampler:t.sampler});let s=globalTracerUses(r),c=i.isInstalled();if((!s||!c)&&rollbackRegistration({ownsPropagator:c,ownsTracer:s}),!s)throw Error("eve could not register OpenTelemetry because another runtime already owns the global tracer provider. Remove the other `registerOTel` call, or move its exporters into eve's `otelIntegration({ spanProcessors: [...] })`.");if(!c)throw Error("eve could not register OpenTelemetry because another runtime already owns the global propagator. Remove the other global propagator registration and declare propagators through eve's `otel()` instead.");let l=runtimeTracerProvider();if(typeof l.forceFlush!=`function`||typeof l.shutdown!=`function`)throw rollbackRegistration({ownsPropagator:c,ownsTracer:s}),Error(`The registered OpenTelemetry tracer provider has no lifecycle methods.`);n?.setDelegate(l);let u=runtimeMeterProvider();return{provider:trace.getTracerProvider(),forceFlush:async()=>{await Promise.all([l.forceFlush(),u.forceFlush?.()])},idGenerator:r,samplesTrace:(e,t)=>samplerAdmitsTrace(r,e,t),shutdown:async()=>{disableInstrumentations(t.instrumentations),await Promise.all([l.shutdown(),u.shutdown?.()])}}}function privateSpanProcessors(e){let t=e.filter(isSpanProcessor);if(t.length===0)return[...e];let n=new PrivateSpanFilteringProcessor(t,replayDeduplicationRegistry()),r=[],i=!1;for(let t of e){if(!isSpanProcessor(t)){r.push(t);continue}i||(i=!0,r.push(n))}return r}function replayDeduplicationRegistry(){let e=replayDeduplicationGlobal[REPLAY_DEDUPLICATION_KEY];if(e!==void 0)return e;let t=new Set;return replayDeduplicationGlobal[REPLAY_DEDUPLICATION_KEY]=t,t}const registerOtel=registerOtelPipeline;function samplerAdmitsTrace(e,t,n={name:invocationName(void 0)}){return(e.withTraceId(t,()=>trace.getTracer(`eve.registration`).startSpan(n.name,{attributes:n.attributes,kind:SpanKind.INTERNAL,root:!0})).spanContext().traceFlags&1)==1}function rollbackRegistration(e){if(e.ownsPropagator&&propagation.disable(),!e.ownsTracer)return;let t=runtimeTracerProvider();if(typeof t.shutdown==`function`)try{t.shutdown().catch(()=>{})}catch{}trace.disable()}function runtimeTracerProvider(){let e=trace.getTracerProvider();return e.getDelegate?.()??e}function runtimeMeterProvider(){let e=metrics.getMeterProvider();return{forceFlush:typeof e?.forceFlush==`function`?()=>e.forceFlush():void 0,shutdown:typeof e?.shutdown==`function`?()=>e.shutdown():void 0}}function disableInstrumentations(e){for(let t of e??[]){let e=t?.disable;if(typeof e==`function`)try{e.call(t)}catch{}}}function globalTracerUses(e){let t=e.allocateSpanId();return e.withSpanId(t,()=>trace.getTracer(`eve.registration`).startSpan(REGISTRATION_SPAN_NAME)).spanContext().spanId===t}function isRegistrationSpan(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===REGISTRATION_SPAN_NAME||`instrumentationScope`in e&&e.instrumentationScope?.name===`eve.registration`)}function spanIdentity(e){if(typeof e!=`object`||!e||!(`spanContext`in e)||typeof e.spanContext!=`function`)return;let t=e.spanContext();return typeof t.traceId==`string`&&typeof t.spanId==`string`?`${t.traceId}:${t.spanId}`:void 0}function parentIdentity(e){if(typeof e!=`object`||!e||!(`parentSpanContext`in e))return;let t=e.parentSpanContext;return typeof t?.traceId==`string`&&typeof t.spanId==`string`?`${t.traceId}:${t.spanId}`:void 0}function addBounded(e,t){if(e.size>=REPLAY_DEDUPLICATION_LIMIT){let t=e.values().next().value;t!==void 0&&e.delete(t)}e.add(t)}function isSpanProcessor(e){return e!==`auto`}function captureOptionalPeerTracerProxy(){try{let e=require("@opentelemetry/api"),t=e.trace.getTracerProvider();return t instanceof e.ProxyTracerProvider?t:void 0}catch{return}}export{registerOtel,registerOtelPipeline};
@@ -1,4 +1,4 @@
1
- import type { MappingContext, OutputMapping } from "#compiled/@eve/tracing/index.js";
1
+ import type { MappingContext, OutputMapping } from "#compiled/@vercel/agent-runs/index.js";
2
2
  export declare function eveOutputMapping(options?: {
3
3
  readonly resolve: (span: MappingContext) => {
4
4
  readonly traceSessionId?: string;
@@ -2,9 +2,9 @@ import { type InstrumentationSessionStartedEvent, type InstrumentationTraceSeed,
2
2
  import type { TraceCapturePolicy } from "#tracing/eve/otel-declaration.js";
3
3
  import type { AgentSessionTraceState, AgentTraceStateStore } from "#tracing/eve/agent-trace-state.js";
4
4
  import type { ConversationEnvironment } from "#shared/conversation-context.js";
5
- import type { AgentSpanIdGenerator, AgentTracing, ExecutionContext, TurnOperation } from "#compiled/@eve/tracing/index.js";
5
+ import type { AgentSpanIdGenerator, AgentRun, ExecutionContext, TurnOperation } from "#compiled/@vercel/agent-runs/index.js";
6
6
  interface EveSessionTracingInput {
7
- readonly tracing: AgentTracing;
7
+ readonly tracing: AgentRun;
8
8
  readonly idGenerator: AgentSpanIdGenerator;
9
9
  readonly environment: ConversationEnvironment;
10
10
  readonly frameworkVersion: string;
@@ -1 +1 @@
1
- import{localTraceOperations,traceModelName,traceSessionId,traceStringAttribute,traceToolName,uniqueLocalTraceSpans}from"#tracing/local/trace-operations.js";import{USAGE_FIELDS}from"#compiled/@eve/tracing/otel.js";function summarizeLocalTrace(e,t){let n=uniqueLocalTraceSpans(t),r=new Set,i=new Set,a=new Set,o=new Set,s=n[0]?.startTimeNs??0n,c=s,l=0,u=0,d,f=0,p=0,m=0;for(let e of n){if(e.startTimeNs<s&&(s=e.startTimeNs),e.endTimeNs>c&&(c=e.endTimeNs),add(r,traceModelName(e)),add(i,traceStringAttribute(e,`agent.name`)),add(a,traceStringAttribute(e,`gen_ai.conversation.id`)),add(o,traceSessionId(e)),e.statusCode===2&&(f+=1),e.name!==`agent.step`)continue;p+=numberAttribute(e,`agent.usage.input_tokens`)??0,m+=numberAttribute(e,`agent.usage.output_tokens`)??0,l+=numberAttribute(e,USAGE_FIELDS.cacheReadTokens)??numberAttribute(e,`gen_ai.usage.cache_read.input_tokens`)??0,u+=numberAttribute(e,USAGE_FIELDS.cacheWriteTokens)??numberAttribute(e,`gen_ai.usage.cache_creation.input_tokens`)??0;let t=localTraceSpanCostUsd(e);t!==void 0&&(d=(d??0)+t)}let h=new Set,g=0,_=0;for(let e of localTraceOperations(n))e.category===`model`&&(g+=1),e.category===`tool`&&(_+=1,add(h,traceToolName(e.span)));return{traceId:e,startedAt:new Date(Number(s/1000000n)).toISOString(),durationMs:Number(c-s)/1e6,spanCount:n.length,agentNames:[...i].sort(),conversationIds:[...a].sort(),sessionIds:[...o].sort(),models:[...r].sort(),toolNames:[...h].sort(),modelCalls:g,toolCalls:_,errorSpanCount:f,cacheReadTokens:l,cacheWriteTokens:u,costUsd:d,inputTokens:p,outputTokens:m}}function localTraceSpanCostUsd(e){return numberAttribute(e,`gen_ai.usage.gateway_cost`)??numberAttribute(e,`gen_ai.usage.cost`)}function numberAttribute(e,t){let n=e.attributes[t];if(typeof n==`number`)return Number.isFinite(n)&&n>=0?n:void 0;if(typeof n==`string`&&n.trim()!==``){let e=Number(n);return Number.isFinite(e)&&e>=0?e:void 0}}function add(e,t){t!==void 0&&e.add(t)}export{localTraceSpanCostUsd,summarizeLocalTrace};
1
+ import{localTraceOperations,traceModelName,traceSessionId,traceStringAttribute,traceToolName,uniqueLocalTraceSpans}from"#tracing/local/trace-operations.js";import{USAGE_FIELDS}from"#compiled/@vercel/agent-runs/otel.js";function summarizeLocalTrace(e,t){let n=uniqueLocalTraceSpans(t),r=new Set,i=new Set,a=new Set,o=new Set,s=n[0]?.startTimeNs??0n,c=s,l=0,u=0,d,f=0,p=0,m=0;for(let e of n){if(e.startTimeNs<s&&(s=e.startTimeNs),e.endTimeNs>c&&(c=e.endTimeNs),add(r,traceModelName(e)),add(i,traceStringAttribute(e,`agent.name`)),add(a,traceStringAttribute(e,`gen_ai.conversation.id`)),add(o,traceSessionId(e)),e.statusCode===2&&(f+=1),e.name!==`agent.step`)continue;p+=numberAttribute(e,`agent.usage.input_tokens`)??0,m+=numberAttribute(e,`agent.usage.output_tokens`)??0,l+=numberAttribute(e,USAGE_FIELDS.cacheReadTokens)??numberAttribute(e,`gen_ai.usage.cache_read.input_tokens`)??0,u+=numberAttribute(e,USAGE_FIELDS.cacheWriteTokens)??numberAttribute(e,`gen_ai.usage.cache_creation.input_tokens`)??0;let t=localTraceSpanCostUsd(e);t!==void 0&&(d=(d??0)+t)}let h=new Set,g=0,_=0;for(let e of localTraceOperations(n))e.category===`model`&&(g+=1),e.category===`tool`&&(_+=1,add(h,traceToolName(e.span)));return{traceId:e,startedAt:new Date(Number(s/1000000n)).toISOString(),durationMs:Number(c-s)/1e6,spanCount:n.length,agentNames:[...i].sort(),conversationIds:[...a].sort(),sessionIds:[...o].sort(),models:[...r].sort(),toolNames:[...h].sort(),modelCalls:g,toolCalls:_,errorSpanCount:f,cacheReadTokens:l,cacheWriteTokens:u,costUsd:d,inputTokens:p,outputTokens:m}}function localTraceSpanCostUsd(e){return numberAttribute(e,`gen_ai.usage.gateway_cost`)??numberAttribute(e,`gen_ai.usage.cost`)}function numberAttribute(e,t){let n=e.attributes[t];if(typeof n==`number`)return Number.isFinite(n)&&n>=0?n:void 0;if(typeof n==`string`&&n.trim()!==``){let e=Number(n);return Number.isFinite(e)&&e>=0?e:void 0}}function add(e,t){t!==void 0&&e.add(t)}export{localTraceSpanCostUsd,summarizeLocalTrace};
@@ -1,4 +1,4 @@
1
- import { a as conversationProjection, i as openConversationInputs, n as conversationReducer, o as callStatus, r as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-Vsl-S0yI.js";
1
+ import { a as conversationProjection, i as openConversationInputs, n as conversationReducer, o as callStatus, r as defaultMessageReducer, t as useEveAgent } from "../chunks/use-eve-agent-Bp6nbhfV.js";
2
2
 
3
3
  //#region src/client/tool-call-state.ts
4
4
  function toolCallState(conversation, callId, options = {}) {
@@ -1,3 +1,3 @@
1
- import { t as useEveAgent } from "../chunks/use-eve-agent-Vsl-S0yI.js";
1
+ import { t as useEveAgent } from "../chunks/use-eve-agent-Bp6nbhfV.js";
2
2
 
3
3
  export { useEveAgent };
@@ -645,6 +645,8 @@ The callback receives the `InputRequest` and current `SessionContext`, so it can
645
645
 
646
646
  When a tool approval resolves, eve retires the messages it posted for it. The card loses its buttons and shows the answer and who gave it, the separate tool-input post is deleted, and a direct-message request's `Waiting on approval` note in the thread changes to the outcome. This also happens when the approval ends without a click, for example when the person replies in the thread instead, in which case the card reads `No longer needed`.
647
647
 
648
+ A click on any request whose session is no longer active, for example because its run was cancelled outside eve, can never be answered. eve removes the card's buttons, marks it `No longer active`, and tells the person who clicked, in an ephemeral message, to send a new message.
649
+
648
650
  A renderer's `input.requested` handler can extend delivery and then hand the requests on to eve with `next()`. For example, an application can add non-sensitive context to the Slack thread before eve renders the actionable controls. The configured `approvalChannel` still sends sensitive reviews to a DM and keeps ordinary requests in the thread:
649
651
 
650
652
  ```ts title="agent/channels/slack.ts"
@@ -85,7 +85,7 @@ A human-in-the-loop (HITL) `input.requested` event renders as an Adaptive Card.
85
85
 
86
86
  By default, submissions use the Teams identity of the user who clicked the card. If you customize `onMessage` for an allowlist, configure the same policy in `onInputResponse`; eve otherwise rejects HITL submissions rather than bypassing the message gate.
87
87
 
88
- When a tool approval settles, eve replaces its Adaptive Card with the outcome and responder name. A response rejected by an approval policy leaves the shared card unchanged.
88
+ When a tool approval settles, eve replaces its Adaptive Card with the outcome and responder name. A response rejected by an approval policy leaves the shared card unchanged. A submission to a card whose session is no longer active, for example because its run was cancelled outside eve, replaces the card with its prompt and `No longer active`, and the invoke response tells the person who submitted to send a new message.
89
89
 
90
90
  ### Connection sign-ins
91
91
 
@@ -49,7 +49,7 @@ The default `message.completed` handler sends plain text via `sendMessage`. It p
49
49
 
50
50
  ### Human-in-the-loop (HITL)
51
51
 
52
- Human-in-the-loop (HITL) turns option requests into inline-keyboard buttons and freeform requests into `ForceReply`. Telegram caps `callback_data` at 64 bytes, so eve keeps compact callback ids in channel state instead. It acknowledges its own callbacks with `answerCallbackQuery`; anything it doesn't recognize goes to `onCallbackQuery`.
52
+ Human-in-the-loop (HITL) turns option requests into inline-keyboard buttons and freeform requests into `ForceReply`. Telegram caps `callback_data` at 64 bytes, so eve keeps compact callback ids in channel state instead. It acknowledges its own callbacks with `answerCallbackQuery`; anything it doesn't recognize goes to `onCallbackQuery`. A press on a prompt whose session is no longer active replaces the keyboard with `No longer active`, and the acknowledgement tells the person to send a new message.
53
53
 
54
54
  A text reply to a bot message is sent as a normal message, with the replied-to message id in `state.replyToBotMessageId`. When that id matches a pending `ForceReply` prompt, the channel's `deliver` hook turns the reply into the answer. Otherwise the reply reaches the agent as a message, and starts a new session when none owns the thread.
55
55
 
@@ -98,12 +98,13 @@ export default git({});
98
98
 
99
99
  Configure `github` to broker GitHub access through Connect instead. The extension then adds the authenticated `git__gh` tool, tells the agent to use it for every authenticated GitHub operation, and switches `git__pr` to `gh-signed-commit` for repositories that require verified signatures.
100
100
 
101
- | Option | Required | Effect |
102
- | ------------------ | ------------- | ------------------------------------------------------------------------------------------ |
103
- | `github.connector` | With `github` | Connector that mints a GitHub token |
104
- | `github.org` | With `github` | Organization whose repositories the `gh` tool can access |
105
- | `github.broker` | With `github` | `broker(sandbox, rules)` callback that installs, then removes, the GitHub credential rules |
106
- | `github.authorize` | No | `authorize({ auth, repository, token })` callback that allows or denies each `gh` tool invocation |
101
+ | Option | Required | Effect |
102
+ | -------------------- | ------------- | ------------------------------------------------------------------------------------------------- |
103
+ | `github.connector` | With `github` | Connector that mints a GitHub token |
104
+ | `github.org` | With `github` | Organization whose repositories the `gh` tool can access |
105
+ | `github.broker` | With `github` | `broker(sandbox, rules)` callback that installs, then removes, the GitHub credential rules |
106
+ | `github.authorize` | No | `authorize({ auth, repository, token })` callback that allows or denies each `gh` tool invocation |
107
+ | `github.attribution` | No | `attribution(ctx)` callback that returns the `{ name, email }` co-author for this turn |
107
108
 
108
109
  The `gh` tool requests a token scoped to exactly one repository in `github.org` for each invocation. The sandbox process receives a placeholder `GH_TOKEN`, and the firewall exchanges it on matching GitHub requests. Your `github.broker` callback receives the header-transform rules for the command, then `null` to remove the lease. The callback must preserve your other network rules. GitHub authentication has no command-delivery option.
109
110
 
@@ -134,6 +135,19 @@ export default git({
134
135
  });
135
136
  ```
136
137
 
138
+ Commits made by the `gh` tool are authored by the GitHub App. To credit the person a turn works for, return them from `github.attribution`. The callback receives the tool's context, so it can read the verified caller from `ctx.session.auth.current` or resolve their linked accounts with `ctx.getToken`. The `gh` tool then ends every `gh-signed-commit` message, and every `gh pr create` body passed with `--body` or `--body-file`, with `Co-authored-by: <name> <email>`. Return `null` to publish without a co-author. `Co-authored-by` lines the agent writes itself are kept, and the trailer joins their block so they still count. Pull requests created without a body flag, such as with `--fill` or `--template`, and other paths, such as `gh api`, are not attributed.
139
+
140
+ ```ts
141
+ git({
142
+ github: {
143
+ connector: "github",
144
+ org: "acme",
145
+ broker,
146
+ attribution: (ctx) => coAuthorFor(ctx.session.auth.current),
147
+ },
148
+ });
149
+ ```
150
+
137
151
  ### Migrate from `code({ github })`
138
152
 
139
153
  `code({ github })` is deprecated. While it is set, the code extension still contributes `code__gh`, its GitHub instructions, and the signed-commit `code__pr` skill. Without it, the code extension contributes no GitHub tool, instructions, or pull request skill. Move the `github` option to `git({ github })`, and import `gh` and the GitHub sandbox helpers from `eve/extensions/git/tools` and `eve/extensions/git/sandbox`.
@@ -53,6 +53,10 @@ eve asks the user to sign in only when the MCP server asks for it. When a connec
53
53
 
54
54
  After the user signs in, the turn resumes and the model makes the call again. eve reconnects with the token and reloads the tool list, which may now include tools the server hides from anonymous callers. A connection that already has a token sends it on every request, as before.
55
55
 
56
+ eve resolves credentials before each MCP HTTP request, including requests on an existing client. When the cached token's `expiresAt` has passed, eve calls the token provider again. If the server rejects a bearer with HTTP `401`, eve evicts the cached token, asks the provider for another token, and retries the request once before asking for sign-in.
57
+
58
+ Eviction clears eve's cached access token and calls the provider's optional `evict` hook. The provider controls whether it retains a refresh grant for silent renewal. Missing grants and rejected replacement tokens still use the normal authorization flow; HTTP `403` permission failures do not trigger token refresh or retries.
59
+
56
60
  A server that leaves protected tools out of its anonymous `tools/list` never triggers sign-in, because the model cannot find those tools. Servers that support anonymous use should list every tool and refuse the protected calls.
57
61
 
58
62
  ## Static tokens and headers
@@ -119,6 +119,8 @@ Filters match `operationId`. If an operation does not declare one, use the deter
119
119
 
120
120
  When an operation path contains dynamic segments, the spec must declare matching OpenAPI path parameters. eve exposes path, query, header, and cookie parameters as top-level tool inputs, then substitutes `in: "path"` values into the matching `{name}` placeholder before making the request.
121
121
 
122
+ Path parameter values must not be exactly `.` or `..`. eve rejects these values before URL parsing can normalize them and change the route, including values resolved through `toolCall.providedArguments`. Other values remain URL-encoded during substitution, including embedded slashes.
123
+
122
124
  ```ts title="agent/connections/cart.ts"
123
125
  import { defineOpenAPIConnection } from "eve/connections";
124
126
 
@@ -99,7 +99,7 @@ export default defineMcpClientConnection({
99
99
  });
100
100
  ```
101
101
 
102
- If the token has a known TTL, set `expiresAt` (milliseconds since epoch) and eve refreshes ahead of time rather than waiting for a `401`.
102
+ If the token has a known TTL, set `expiresAt` (milliseconds since epoch). Once it expires, eve calls `getToken` again before the next request, including requests on an existing MCP client.
103
103
 
104
104
  When `getToken` is the only auth, `credentialOwner` defaults to `"app"`: one shared credential keyed across all sessions. Set `credentialOwner: "user"` when each end-user carries their own token.
105
105
 
@@ -332,7 +332,7 @@ channels fall back to title-casing the connection name when neither is set.
332
332
  Two error classes drive the consent flow. Throw them from `getToken` or `completeAuthorization`; both are exported from `eve/connections`.
333
333
 
334
334
  - `ConnectionAuthorizationRequiredError(connectionName)`: the user must authorize. Throw it from `getToken` to emit `authorization.required` and kick off the flow.
335
- - `ConnectionAuthorizationFailedError(connectionName, { reason?, retryable? })`: authorization failed. `reason` is a stable machine-readable code (e.g. `"access_denied"`) that shows up on the `authorization.completed` event and the failed tool result. `retryable` defaults to `true`; set it to `false` for terminal cases like user denial so the runtime stops re-prompting.
335
+ - `ConnectionAuthorizationFailedError(connectionName, { reason?, retryable? })`: authorization failed. `reason` is a stable machine-readable code (e.g. `"access_denied"`) that shows up on the `authorization.completed` event and the failed tool result. `retryable` defaults to `true`; set it to `false` for terminal cases like user denial. The `authorization.completed` event then carries `retryable: false`, and a later tool call in the same turn that needs the same grant for the same principal fails with that failure instead of asking the user to sign in again. The next turn asks again.
336
336
 
337
337
  ```ts
338
338
  import { ConnectionAuthorizationFailedError } from "eve/connections";
@@ -187,6 +187,27 @@ t.eventsSatisfy("assistant reply includes the marker", (events) =>
187
187
  );
188
188
  ```
189
189
 
190
+ ### Assert and score reasoning
191
+
192
+ When the provider exposes reasoning, eve captures each completed block as a `reasoning.completed` event. Assert on its text with `turn.event(...)`, or join the blocks and pass them to a judge:
193
+
194
+ ```ts
195
+ turn.event("reasoning.completed", {
196
+ data: { reasoning: /checks? the units/i },
197
+ });
198
+
199
+ const reasoning = turn.events
200
+ .filter((event) => event.type === "reasoning.completed")
201
+ .map((event) => event.data.reasoning)
202
+ .join("\n\n");
203
+
204
+ t.judge("The reasoning checks its assumptions before concluding.", {
205
+ on: reasoning,
206
+ }).atLeast(0.8);
207
+ ```
208
+
209
+ A provider that does not expose reasoning emits no `reasoning.completed` event, so the `turn.event` gate fails and the judge grades an empty string. Reasoning the provider keeps hidden cannot be graded. The default judge input and `session.transcript` exclude reasoning, which is why the example passes it with `on`.
210
+
190
211
  ## Required preconditions
191
212
 
192
213
  Recorded assertions never throw and are not awaitable. When later control flow depends on a value, use `await t.require(value, assertion)`. It records a gate, returns the original value when it passes, and stops the test body without adding a duplicate execution error when it fails:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eve",
3
- "version": "0.80.0",
3
+ "version": "0.81.0",
4
4
  "private": false,
5
5
  "description": "Filesystem-first framework for durable backend AI agents that run anywhere.",
6
6
  "keywords": [
@@ -574,7 +574,6 @@
574
574
  "@chat-adapter/twilio": "4.42.0",
575
575
  "@clack/core": "1.3.1",
576
576
  "@eve/catalog": "0.0.1",
577
- "@eve/tracing": "0.0.0",
578
577
  "@linqapp/chat-sdk-adapter": "^0.5.1",
579
578
  "@modelcontextprotocol/server": "2.0.0",
580
579
  "@nuxt/kit": "^4.0.0",
@@ -591,6 +590,7 @@
591
590
  "@types/json-schema": "7.0.15",
592
591
  "@types/react": "19.2.15",
593
592
  "@types/react-test-renderer": "19.1.0",
593
+ "@vercel/agent-runs": "0.0.1",
594
594
  "@vercel/blob": "2.8.0",
595
595
  "@vercel/connect": "2.5.2",
596
596
  "@vercel/detect-agent": "1.2.3",