eve 0.80.0 → 0.80.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.
- package/CHANGELOG.md +9 -0
- package/dist/src/compiled/.vendor-stamp.json +3 -3
- package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/adapters/ai-sdk-telemetry.d.ts +2 -2
- package/dist/src/compiled/{@eve/tracing/agent-tracing.d.ts → @vercel/agent-runs/agent-run.d.ts} +3 -3
- package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/index.d.ts +1 -1
- package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/index.js +1 -1
- package/dist/src/compiled/@workflow/world-vercel/index.js +3 -3
- package/dist/src/execution/dynamic-workflow/tool.js +1 -1
- package/dist/src/execution/tools/agent-router-workflow.js +1 -1
- package/dist/src/harness/compaction/engine.js +2 -2
- package/dist/src/harness/compaction/prompt.d.ts +6 -0
- package/dist/src/harness/compaction/prompt.js +1 -1
- package/dist/src/instrumentation/ai-sdk-hook-bridge.js +1 -1
- package/dist/src/instrumentation/principal-summary.js +1 -1
- package/dist/src/instrumentation/runtime.d.ts +1 -1
- package/dist/src/instrumentation/runtime.js +1 -1
- package/dist/src/instrumentation/session-init.js +1 -1
- package/dist/src/internal/application/stamped-package-version.js +1 -1
- package/dist/src/internal/authored-package-boundary.d.ts +4 -0
- package/dist/src/internal/authored-package-boundary.js +1 -1
- package/dist/src/internal/bundler/nitro-rolldown.d.ts +2 -2
- package/dist/src/internal/logging.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/external-dependency-output-check-plugin.d.ts +23 -0
- package/dist/src/internal/nitro/host/external-dependency-output-check-plugin.js +3 -0
- package/dist/src/internal/nitro/routes/channel-request-instrumentation.js +1 -1
- package/dist/src/runtime/connections/openapi-client.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/tools/provided/ask-question-workflow.js +1 -1
- package/dist/src/tools/provided/sleep-workflow.js +1 -1
- package/dist/src/tracing/eve/agent-approval-instrumentation.d.ts +2 -2
- package/dist/src/tracing/eve/agent-channel-delivery-instrumentation.js +1 -1
- package/dist/src/tracing/eve/agent-memory-instrumentation.d.ts +2 -2
- package/dist/src/tracing/eve/agent-memory-instrumentation.js +1 -1
- package/dist/src/tracing/eve/agent-otel-provider.d.ts +1 -1
- package/dist/src/tracing/eve/agent-tool-instrumentation.d.ts +3 -3
- package/dist/src/tracing/eve/agent-trace-context.js +1 -1
- package/dist/src/tracing/eve/agent-trace-state.d.ts +1 -1
- package/dist/src/tracing/eve/connection-events.js +1 -1
- package/dist/src/tracing/eve/content-span-processor.js +1 -1
- package/dist/src/tracing/eve/delegation.js +1 -1
- package/dist/src/tracing/eve/gateway.d.ts +1 -1
- package/dist/src/tracing/eve/install-instrumentation-runtime.js +1 -1
- package/dist/src/tracing/eve/invoke-tool-span.js +1 -1
- package/dist/src/tracing/eve/mcp.d.ts +1 -1
- package/dist/src/tracing/eve/mcp.js +1 -1
- package/dist/src/tracing/eve/metadata.d.ts +1 -1
- package/dist/src/tracing/eve/operation-input.d.ts +2 -2
- package/dist/src/tracing/eve/operation-input.js +1 -1
- package/dist/src/tracing/eve/otel-registration.d.ts +2 -2
- package/dist/src/tracing/eve/otel-registration.js +1 -1
- package/dist/src/tracing/eve/profile.d.ts +1 -1
- package/dist/src/tracing/eve/session.d.ts +2 -2
- package/dist/src/tracing/local/trace-summary.js +1 -1
- package/docs/connections/openapi.mdx +2 -0
- package/package.json +2 -2
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/adapters/agent-transport.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/adapters/ai-sdk-payload.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/adapters/otel-error.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/adapters/otel-ids.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/adapters/otel.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/adapters/serialization.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/ai-sdk.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/ai-sdk.js +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/capture.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/activation.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/attributes.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/content-policy.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/context.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/delegation.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/mcp.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/scopes.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/snapshot.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/span-kinds.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/types.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/core/writer.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/delegation.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/delegation.js +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/operations.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/otel.d.ts +0 -0
- /package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/otel.js +0 -0
|
@@ -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/@
|
|
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/@
|
|
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/@
|
|
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/@
|
|
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
|
|
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
|
-
}):
|
|
30
|
+
}): AgentRun;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolveConversationId}from"#shared/conversation-identity.js";import{
|
|
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/@
|
|
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/@
|
|
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/@
|
|
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/@
|
|
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,
|
|
5
|
+
import type { AgentSpanIdGenerator, AgentRun, ExecutionContext, TurnOperation } from "#compiled/@vercel/agent-runs/index.js";
|
|
6
6
|
interface EveSessionTracingInput {
|
|
7
|
-
readonly tracing:
|
|
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/@
|
|
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};
|
|
@@ -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
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eve",
|
|
3
|
-
"version": "0.80.
|
|
3
|
+
"version": "0.80.1",
|
|
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",
|
/package/dist/src/compiled/{@eve/tracing → @vercel/agent-runs}/adapters/agent-transport.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|