import { type Context, type SpanContext, type Tracer } from "#compiled/@opentelemetry/api/index.js"; import type { InstrumentationAttemptScope, InstrumentationExecutionOperation, InstrumentationToolCallStartedEvent, InstrumentationToolCallTerminalEvent } from "#instrumentation/lifecycle.js"; import type { AgentSpanIdGenerator } from "#tracing/agent-span-id-generator.js"; import type { AgentTraceStateStore } from "#tracing/agent-trace-state.js"; export interface AgentToolContext { readonly context: Context; readonly spanContext: SpanContext; } interface AgentToolInstrumentation { deleteForSession(sessionId: string): Promise; failForAttempt(scope: InstrumentationAttemptScope, error: unknown): Promise; dispatchContextFor(sessionId: string, turnId: string, callId: string): Promise; contextFor(attemptId: string, idempotencyKey: string): Context | undefined; drain(attemptId: string, failure?: { readonly error: unknown; }): void; readonly events: { readonly "tool.call.completed": (event: InstrumentationToolCallTerminalEvent) => Promise; readonly "tool.call.failed": (event: InstrumentationToolCallTerminalEvent) => Promise; readonly "tool.call.started": (event: InstrumentationToolCallStartedEvent) => Promise; }; runInContext(operation: Extract, execute: (parent: Context | undefined) => PromiseLike, recordOutputs: boolean): Promise; } /** Enriches durable tool calls, exporting SDK-only calls under their step. */ export declare function createAgentToolInstrumentation(input: { readonly frameworkVersion: string; readonly resolveTraceContext: (event: InstrumentationToolCallStartedEvent) => SpanContext | undefined | PromiseLike; readonly idGenerator: AgentSpanIdGenerator; readonly recordInputs: boolean; readonly recordOutputs: boolean; readonly resolveFallback: (event: InstrumentationToolCallStartedEvent) => { readonly context: Context; readonly spanContext: SpanContext; } | undefined; readonly tracer: Tracer; readonly stateStore: AgentTraceStateStore; }): AgentToolInstrumentation; export {};