//#region src/observability/ai/options.d.ts
/** Opt-in span payload storage. Both flags default to `false`. */
type AISDKStorageOptions = {
  readonly storeMessages?: boolean;
  readonly storeTools?: boolean;
};
/** Instrumentation options for the AI SDK v6 adapter. */
type AISDKInstrumentationOptions = AISDKStorageOptions & {
  /**
   * Context keys to emit as `cloudflare.agents.runtime_context.{key}`, set
   * once for the wrapper rather than per call.
   *
   * Distinct from the AI SDK's own per-call `telemetry.includeRuntimeContext`,
   * which shares the name but selects keys that map onto the canonical
   * `cloudflare.agents.turn.*` / `cloudflare.agents.metadata.*` attributes.
   */
  readonly includeRuntimeContext?: readonly string[];
};
//#endregion
//#region src/observability/ai/v7/types.d.ts
/** Common AI SDK v7 telemetry callback options this adapter reads. */
type AISDKV7TelemetryOptions = {
  readonly functionId?: string | undefined;
};
/** AI SDK v7 operation lifecycle event shape consumed by this adapter. */
type AISDKV7OperationEvent = AISDKV7TelemetryOptions & {
  readonly callId: string;
  readonly finishReason?: unknown;
  readonly frequencyPenalty?: unknown;
  readonly maxOutputTokens?: unknown;
  readonly maxTokens?: unknown;
  readonly messages?: unknown;
  readonly modelId?: string | undefined;
  readonly object?: unknown;
  readonly operationId?: string | undefined;
  readonly presencePenalty?: unknown;
  readonly prompt?: unknown;
  readonly provider?: string | undefined;
  readonly response?: unknown;
  readonly responseId?: unknown;
  readonly responseModel?: unknown;
  readonly runtimeContext?: unknown;
  readonly seed?: unknown;
  readonly temperature?: unknown;
  readonly text?: unknown;
  readonly toolCalls?: unknown;
  readonly toolsContext?: unknown;
  readonly topK?: unknown;
  readonly topP?: unknown;
  readonly totalUsage?: unknown;
  readonly usage?: unknown;
};
/** AI SDK v7 language-model lifecycle event shape consumed by this adapter. */
type AISDKV7LanguageModelCallEvent = AISDKV7TelemetryOptions & {
  readonly callId: string;
  readonly content?: unknown;
  readonly finishReason?: unknown;
  readonly frequencyPenalty?: unknown;
  readonly headers?: unknown;
  readonly maxOutputTokens?: unknown;
  readonly maxTokens?: unknown;
  readonly messages?: unknown;
  readonly modelId?: string | undefined;
  readonly performance?: unknown;
  readonly presencePenalty?: unknown;
  readonly prompt?: unknown;
  readonly provider?: string | undefined;
  readonly providerMetadata?: unknown;
  readonly response?: unknown;
  readonly responseHeaders?: unknown;
  readonly responseId?: unknown;
  readonly responseModel?: unknown;
  readonly seed?: unknown;
  readonly temperature?: unknown;
  readonly topK?: unknown;
  readonly topP?: unknown;
  readonly totalUsage?: unknown;
  readonly usage?: unknown;
};
/** AI SDK v7 tool-call identity shape consumed by this adapter. */
type AISDKV7ToolCall = {
  readonly input?: unknown;
  readonly toolCallId?: string | undefined;
  readonly toolName?: string | undefined;
};
/** AI SDK v7 tool-output event shape consumed by this adapter. */
type AISDKV7ToolOutput = {
  readonly error?: unknown;
  readonly output?: unknown;
  readonly type?: string | undefined;
};
/** AI SDK v7 tool lifecycle event shape consumed by this adapter. */
type AISDKV7ToolExecutionEvent = AISDKV7TelemetryOptions & {
  readonly callId: string;
  readonly toolCall: AISDKV7ToolCall;
  readonly toolContext?: unknown;
  readonly toolOutput?: AISDKV7ToolOutput | undefined;
};
/** AI SDK v7 abort event shape consumed by this adapter. */
type AISDKV7AbortEvent = {
  readonly callId: string;
  readonly reason?: unknown;
};
/** AI SDK v7 model-call execution hook shape consumed by this adapter. */
type AISDKV7ExecuteLanguageModelOptions<T> = {
  readonly callId: string;
  readonly execute: () => PromiseLike<T>;
};
/** AI SDK v7 tool execution hook shape consumed by this adapter. */
type AISDKV7ExecuteToolOptions<T> = {
  readonly callId: string;
  readonly execute: () => PromiseLike<T>;
  readonly toolCallId: string;
};
/** Structural AI SDK v7 telemetry object returned by this package. */
type AISDKV7Telemetry = {
  readonly executeLanguageModelCall?: <T>(
    options: AISDKV7ExecuteLanguageModelOptions<T>
  ) => PromiseLike<T>;
  readonly executeTool?: <T>(
    options: AISDKV7ExecuteToolOptions<T>
  ) => PromiseLike<T>;
  readonly onAbort?: (event: AISDKV7AbortEvent) => void | PromiseLike<void>;
  readonly onEnd?: (event: AISDKV7OperationEvent) => void | PromiseLike<void>;
  readonly onError?: (event: unknown) => void | PromiseLike<void>;
  readonly onLanguageModelCallEnd?: (
    event: AISDKV7LanguageModelCallEvent
  ) => void | PromiseLike<void>;
  readonly onLanguageModelCallStart?: (
    event: AISDKV7LanguageModelCallEvent
  ) => void | PromiseLike<void>;
  readonly onStart?: (event: AISDKV7OperationEvent) => void | PromiseLike<void>;
  readonly onToolExecutionEnd?: (
    event: AISDKV7ToolExecutionEvent
  ) => void | PromiseLike<void>;
  readonly onToolExecutionStart?: (
    event: AISDKV7ToolExecutionEvent
  ) => void | PromiseLike<void>;
};
//#endregion
//#region src/observability/ai/index.d.ts
/**
 * Wraps an AI SDK namespace with tracing.
 */
declare function wrapAISDK<T extends Record<string, unknown>>(
  ai: T,
  options?: AISDKInstrumentationOptions
): T;
/**
 * Creates an AI SDK v7 telemetry adapter for use with `registerTelemetry` or
 * per-call telemetry configuration.
 */
declare function createAISDKTelemetry(
  options?: AISDKStorageOptions
): AISDKV7Telemetry;
//#endregion
export {
  type AISDKInstrumentationOptions,
  type AISDKStorageOptions,
  createAISDKTelemetry,
  wrapAISDK
};
//# sourceMappingURL=index.d.ts.map
