import z, { ZodObject, ZodType, z as z$1 } from 'zod';
import { Readable } from 'node:stream';
import { EventEmitter as EventEmitter$1 } from 'node:events';
import { ChildProcessWithoutNullStreams } from 'node:child_process';
import Anthropic, { ClientOptions } from '@anthropic-ai/sdk';
import OpenAI from 'openai';

declare const RequestUsageData: z.ZodObject<{
    inputTokens: z.ZodNumber;
    outputTokens: z.ZodNumber;
    totalTokens: z.ZodNumber;
    inputTokensDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
    outputTokensDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
    endpoint: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
type RequestUsageData = z.infer<typeof RequestUsageData>;
declare const UsageData: z.ZodObject<{
    requests: z.ZodOptional<z.ZodNumber>;
    inputTokens: z.ZodNumber;
    outputTokens: z.ZodNumber;
    totalTokens: z.ZodNumber;
    inputTokensDetails: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodNumber>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodNumber>>]>>;
    outputTokensDetails: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodNumber>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodNumber>>]>>;
    requestUsageEntries: z.ZodOptional<z.ZodArray<z.ZodObject<{
        inputTokens: z.ZodNumber;
        outputTokens: z.ZodNumber;
        totalTokens: z.ZodNumber;
        inputTokensDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
        outputTokensDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
        endpoint: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>>;
}, z.core.$strip>;
type UsageData = z.infer<typeof UsageData>;
declare const FunctionCallItem: z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodLiteral<"function_call">;
    callId: z.ZodString;
    name: z.ZodString;
    namespace: z.ZodOptional<z.ZodString>;
    status: z.ZodOptional<z.ZodEnum<{
        in_progress: "in_progress";
        completed: "completed";
        incomplete: "incomplete";
    }>>;
    arguments: z.ZodString;
}, z.core.$strip>;
type FunctionCallItem = z.infer<typeof FunctionCallItem>;
/**
 * This is a fallback item type used to hold anything that does not belong to the
 * current protocol.
 *
 * For example, a model may use this type to return an item outside the scope of
 * the protocol.
 *
 * In that case, all data returned by the model should be passed via the
 * `providerData` field.
 *
 * This lets model providers add new features without breaking the protocol.
 */
declare const UnknownItem: z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodLiteral<"unknown">;
}, z.core.$strip>;
type UnknownItem = z.infer<typeof UnknownItem>;
declare const HostedToolCallItem: z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodLiteral<"hosted_tool_call">;
    name: z.ZodString;
    arguments: z.ZodOptional<z.ZodString>;
    status: z.ZodOptional<z.ZodString>;
    output: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
type HostedToolCallItem = z.infer<typeof HostedToolCallItem>;
declare const ToolCallItem: z.ZodDiscriminatedUnion<[z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodLiteral<"function_call">;
    callId: z.ZodString;
    name: z.ZodString;
    namespace: z.ZodOptional<z.ZodString>;
    status: z.ZodOptional<z.ZodEnum<{
        in_progress: "in_progress";
        completed: "completed";
        incomplete: "incomplete";
    }>>;
    arguments: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodLiteral<"hosted_tool_call">;
    name: z.ZodString;
    arguments: z.ZodOptional<z.ZodString>;
    status: z.ZodOptional<z.ZodString>;
    output: z.ZodOptional<z.ZodString>;
}, z.core.$strip>], "type">;
type ToolCallItem = z.infer<typeof ToolCallItem>;
declare const UserMessageItem: z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodOptional<z.ZodLiteral<"message">>;
    role: z.ZodLiteral<"user">;
    content: z.ZodUnion<[z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"input_text">;
        text: z.ZodString;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"input_image">;
        image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
            id: z.ZodString;
        }, z.core.$strip>]>>;
        detail: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"input_file">;
        file: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
            id: z.ZodString;
        }, z.core.$strip>]>, z.ZodObject<{
            url: z.ZodString;
        }, z.core.$strip>]>>;
        filename: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>], "type">>, z.ZodString]>;
}, z.core.$strip>;
type UserMessageItem = z.infer<typeof UserMessageItem>;
declare const ReasoningItem: z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodLiteral<"reasoning">;
    content: z.ZodArray<z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"input_text">;
        text: z.ZodString;
    }, z.core.$strip>>;
    rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"reasoning_text">;
        text: z.ZodString;
    }, z.core.$strip>>>;
}, z.core.$strip>;
type ReasoningItem = z.infer<typeof ReasoningItem>;
declare const AssistantMessageItem: z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodOptional<z.ZodLiteral<"message">>;
    role: z.ZodLiteral<"assistant">;
    status: z.ZodEnum<{
        in_progress: "in_progress";
        completed: "completed";
        incomplete: "incomplete";
    }>;
    content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"output_text">;
        text: z.ZodString;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"refusal">;
        refusal: z.ZodString;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"image">;
        image: z.ZodString;
    }, z.core.$strip>], "type">>;
}, z.core.$strip>;
type AssistantMessageItem = z.infer<typeof AssistantMessageItem>;
declare const StreamEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    type: z.ZodLiteral<"output_text_delta">;
    delta: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    type: z.ZodLiteral<"reasoning_delta">;
    delta: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    type: z.ZodLiteral<"output_part_started">;
    partId: z.ZodString;
    part: z.ZodDiscriminatedUnion<[z.ZodObject<{
        type: z.ZodLiteral<"output_text">;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<"reasoning">;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<"function_call">;
        callId: z.ZodString;
        name: z.ZodString;
    }, z.core.$strip>], "type">;
}, z.core.$strip>, z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    type: z.ZodLiteral<"tool_input_delta">;
    partId: z.ZodString;
    delta: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    type: z.ZodLiteral<"output_part_done">;
    partId: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    type: z.ZodLiteral<"response_done">;
    response: z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        id: z.ZodString;
        requestId: z.ZodOptional<z.ZodString>;
        usage: z.ZodObject<{
            requests: z.ZodOptional<z.ZodNumber>;
            inputTokens: z.ZodNumber;
            outputTokens: z.ZodNumber;
            totalTokens: z.ZodNumber;
            inputTokensDetails: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodNumber>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodNumber>>]>>;
            outputTokensDetails: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodNumber>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodNumber>>]>>;
            requestUsageEntries: z.ZodOptional<z.ZodArray<z.ZodObject<{
                inputTokens: z.ZodNumber;
                outputTokens: z.ZodNumber;
                totalTokens: z.ZodNumber;
                inputTokensDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
                outputTokensDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
                endpoint: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>>>;
        }, z.core.$strip>;
        output: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodOptional<z.ZodLiteral<"message">>;
            role: z.ZodLiteral<"assistant">;
            status: z.ZodEnum<{
                in_progress: "in_progress";
                completed: "completed";
                incomplete: "incomplete";
            }>;
            content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"output_text">;
                text: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"refusal">;
                refusal: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"image">;
                image: z.ZodString;
            }, z.core.$strip>], "type">>;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"function_call">;
            callId: z.ZodString;
            name: z.ZodString;
            namespace: z.ZodOptional<z.ZodString>;
            status: z.ZodOptional<z.ZodEnum<{
                in_progress: "in_progress";
                completed: "completed";
                incomplete: "incomplete";
            }>>;
            arguments: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"reasoning">;
            content: z.ZodArray<z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_text">;
                text: z.ZodString;
            }, z.core.$strip>>;
            rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"reasoning_text">;
                text: z.ZodString;
            }, z.core.$strip>>>;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"unknown">;
        }, z.core.$strip>], "type">>;
    }, z.core.$strip>;
}, z.core.$strip>, z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    type: z.ZodLiteral<"response_started">;
}, z.core.$strip>, z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    type: z.ZodLiteral<"model">;
    event: z.ZodAny;
}, z.core.$strip>], "type">;
type StreamEvent = z.infer<typeof StreamEvent>;
declare const ToolOutputImage: z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    type: z.ZodLiteral<"image">;
    image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
        data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
        mediaType: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>, z.ZodObject<{
        url: z.ZodString;
    }, z.core.$strip>, z.ZodObject<{
        fileId: z.ZodString;
    }, z.core.$strip>]>]>>;
    detail: z.ZodOptional<z.ZodType<"low" | "high" | "auto" | (string & {}), unknown, z.core.$ZodTypeInternals<"low" | "high" | "auto" | (string & {}), unknown>>>;
}, z.core.$strip>;
type ToolOutputImage = z.infer<typeof ToolOutputImage>;
declare const FunctionCallResultItem: z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodLiteral<"function_call_result">;
    name: z.ZodString;
    namespace: z.ZodOptional<z.ZodString>;
    callId: z.ZodString;
    status: z.ZodEnum<{
        in_progress: "in_progress";
        completed: "completed";
        incomplete: "incomplete";
    }>;
    output: z.ZodUnion<readonly [z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"text">;
        text: z.ZodString;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"image">;
        image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
            data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
            mediaType: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>, z.ZodObject<{
            url: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            fileId: z.ZodString;
        }, z.core.$strip>]>]>>;
        detail: z.ZodOptional<z.ZodType<"low" | "high" | "auto" | (string & {}), unknown, z.core.$ZodTypeInternals<"low" | "high" | "auto" | (string & {}), unknown>>>;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"file">;
        file: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
            data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
            mediaType: z.ZodString;
            filename: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            url: z.ZodString;
            filename: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>, z.ZodObject<{
            id: z.ZodString;
            filename: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>]>;
    }, z.core.$strip>], "type">, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"input_text">;
        text: z.ZodString;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"input_image">;
        image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
            id: z.ZodString;
        }, z.core.$strip>]>>;
        detail: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"input_file">;
        file: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
            id: z.ZodString;
        }, z.core.$strip>]>, z.ZodObject<{
            url: z.ZodString;
        }, z.core.$strip>]>>;
        filename: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>], "type">>]>;
    display: z.ZodOptional<z.ZodUnknown>;
}, z.core.$strip>;
type FunctionCallResultItem = z.infer<typeof FunctionCallResultItem>;
declare const SystemMessageItem: z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodOptional<z.ZodLiteral<"message">>;
    role: z.ZodLiteral<"system">;
    content: z.ZodString;
}, z.core.$strip>;
type SystemMessageItem = z.infer<typeof SystemMessageItem>;
declare const ModelItem: z.ZodUnion<readonly [z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodOptional<z.ZodLiteral<"message">>;
    role: z.ZodLiteral<"user">;
    content: z.ZodUnion<[z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"input_text">;
        text: z.ZodString;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"input_image">;
        image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
            id: z.ZodString;
        }, z.core.$strip>]>>;
        detail: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"input_file">;
        file: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
            id: z.ZodString;
        }, z.core.$strip>]>, z.ZodObject<{
            url: z.ZodString;
        }, z.core.$strip>]>>;
        filename: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>], "type">>, z.ZodString]>;
}, z.core.$strip>, z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodOptional<z.ZodLiteral<"message">>;
    role: z.ZodLiteral<"assistant">;
    status: z.ZodEnum<{
        in_progress: "in_progress";
        completed: "completed";
        incomplete: "incomplete";
    }>;
    content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"output_text">;
        text: z.ZodString;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"refusal">;
        refusal: z.ZodString;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"image">;
        image: z.ZodString;
    }, z.core.$strip>], "type">>;
}, z.core.$strip>, z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodOptional<z.ZodLiteral<"message">>;
    role: z.ZodLiteral<"system">;
    content: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodLiteral<"hosted_tool_call">;
    name: z.ZodString;
    arguments: z.ZodOptional<z.ZodString>;
    status: z.ZodOptional<z.ZodString>;
    output: z.ZodOptional<z.ZodString>;
}, z.core.$strip>, z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodLiteral<"function_call">;
    callId: z.ZodString;
    name: z.ZodString;
    namespace: z.ZodOptional<z.ZodString>;
    status: z.ZodOptional<z.ZodEnum<{
        in_progress: "in_progress";
        completed: "completed";
        incomplete: "incomplete";
    }>>;
    arguments: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodLiteral<"function_call_result">;
    name: z.ZodString;
    namespace: z.ZodOptional<z.ZodString>;
    callId: z.ZodString;
    status: z.ZodEnum<{
        in_progress: "in_progress";
        completed: "completed";
        incomplete: "incomplete";
    }>;
    output: z.ZodUnion<readonly [z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"text">;
        text: z.ZodString;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"image">;
        image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
            data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
            mediaType: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>, z.ZodObject<{
            url: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            fileId: z.ZodString;
        }, z.core.$strip>]>]>>;
        detail: z.ZodOptional<z.ZodType<"low" | "high" | "auto" | (string & {}), unknown, z.core.$ZodTypeInternals<"low" | "high" | "auto" | (string & {}), unknown>>>;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"file">;
        file: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
            data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
            mediaType: z.ZodString;
            filename: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            url: z.ZodString;
            filename: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>, z.ZodObject<{
            id: z.ZodString;
            filename: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>]>;
    }, z.core.$strip>], "type">, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"input_text">;
        text: z.ZodString;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"input_image">;
        image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
            id: z.ZodString;
        }, z.core.$strip>]>>;
        detail: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"input_file">;
        file: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
            id: z.ZodString;
        }, z.core.$strip>]>, z.ZodObject<{
            url: z.ZodString;
        }, z.core.$strip>]>>;
        filename: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>], "type">>]>;
    display: z.ZodOptional<z.ZodUnknown>;
}, z.core.$strip>, z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodLiteral<"reasoning">;
    content: z.ZodArray<z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"input_text">;
        text: z.ZodString;
    }, z.core.$strip>>;
    rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        type: z.ZodLiteral<"reasoning_text">;
        text: z.ZodString;
    }, z.core.$strip>>>;
}, z.core.$strip>, z.ZodObject<{
    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    id: z.ZodOptional<z.ZodString>;
    type: z.ZodLiteral<"unknown">;
}, z.core.$strip>]>;
type ModelItem = z.infer<typeof ModelItem>;

type UnknownContext = unknown;
type TextOutput = 'text';
/**
 * Agent input
 */
type AgentInputItem = UserMessageItem | AssistantMessageItem | SystemMessageItem | HostedToolCallItem | FunctionCallItem | FunctionCallResultItem | ReasoningItem | UnknownItem;
type AgentOutputItem = UserMessageItem | AssistantMessageItem | SystemMessageItem | HostedToolCallItem | FunctionCallItem | FunctionCallResultItem | ReasoningItem | UnknownItem;

type ZodTypeAny = ZodType<any, any, any>;
type ZodTypeLike = ZodTypeAny;
type ZodObjectLike = ZodObject<any, any>;
type ZodInfer<T extends ZodTypeLike> = T extends {
    _output: infer Output;
} ? Output : never;

type ResponseStreamEvent = StreamEvent;
type ResolvedAgentOutput<T extends AgentOutputType<H>, H = unknown> = T extends TextOutput ? string : T extends ZodObjectLike ? ZodInfer<T> : T extends HandoffsOutput<infer H> ? HandoffsOutput<H> : unknown extends T ? any : T extends Record<string, any> ? unknown : never;
type JsonSchemaDefinitionEntry = Record<string, any>;
type JsonObjectSchemaStrict<Properties extends Record<string, JsonSchemaDefinitionEntry>> = {
    type: 'object';
    properties: Properties;
    required: (keyof Properties)[];
    additionalProperties: false;
    description?: string;
};
type JsonObjectSchemaNonStrict<Properties extends Record<string, JsonSchemaDefinitionEntry>> = {
    type: 'object';
    properties: Properties;
    required: (keyof Properties)[];
    additionalProperties: true;
    description?: string;
};
type JsonObjectSchema<P extends Record<string, JsonSchemaDefinitionEntry>> = JsonObjectSchemaStrict<P> | JsonObjectSchemaNonStrict<P>;
/**
 * A wrapper around the JSON Schema used to describe tool parameters.
 */
type JsonSchemaDefinition = {
    type: 'json_schema';
    name: string;
    strict: boolean;
    schema: JsonObjectSchema<Record<string, JsonSchemaDefinitionEntry>>;
};
type ExtractAgentOutput$1<T> = T extends Agent<any, any> ? ResolvedAgentOutput<T['outputType']> : never;
type ExtractHandoffOutput$1<T> = T extends Handoff<any> ? unknown : never;
type HandoffsOutput<H> = H extends Array<infer U> ? ExtractAgentOutput$1<U> | ExtractHandoffOutput$1<U> : never;
/**
 * Expands a type to include all properties of the type.
 */
type Expand<T> = T extends infer O ? {
    [K in keyof O]: O[K];
} : never;

type CompactTrigger = 'auto' | 'manual' | 'reactive' | 'session_memory';
type CompactSource = 'model_summary' | 'session_memory';
declare const CompactBoundaryRecordSchema: z.ZodObject<{
    type: z.ZodLiteral<"compact_boundary">;
    id: z.ZodString;
    summaryItemId: z.ZodString;
    compactedRange: z.ZodObject<{
        fromItemId: z.ZodString;
        toItemId: z.ZodString;
    }, z.core.$strip>;
    insertAfterItemId: z.ZodString;
    supersedesBoundaryId: z.ZodOptional<z.ZodString>;
    trigger: z.ZodEnum<{
        auto: "auto";
        manual: "manual";
        reactive: "reactive";
        session_memory: "session_memory";
    }>;
    source: z.ZodEnum<{
        session_memory: "session_memory";
        model_summary: "model_summary";
    }>;
    createdAt: z.ZodString;
    status: z.ZodLiteral<"completed">;
    preCompactTokenCount: z.ZodOptional<z.ZodNumber>;
    postCompactTokenCount: z.ZodOptional<z.ZodNumber>;
    summarizedItemCount: z.ZodOptional<z.ZodNumber>;
    preservedItemCount: z.ZodOptional<z.ZodNumber>;
    summaryTokenCount: z.ZodOptional<z.ZodNumber>;
    model: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
declare const CompactSummaryRecordSchema: z.ZodObject<{
    type: z.ZodLiteral<"compact_summary">;
    id: z.ZodString;
    boundaryId: z.ZodString;
    content: z.ZodString;
    source: z.ZodEnum<{
        session_memory: "session_memory";
        model_summary: "model_summary";
    }>;
    createdAt: z.ZodString;
}, z.core.$strip>;
declare const CompactionRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
    type: z.ZodLiteral<"compact_boundary">;
    id: z.ZodString;
    summaryItemId: z.ZodString;
    compactedRange: z.ZodObject<{
        fromItemId: z.ZodString;
        toItemId: z.ZodString;
    }, z.core.$strip>;
    insertAfterItemId: z.ZodString;
    supersedesBoundaryId: z.ZodOptional<z.ZodString>;
    trigger: z.ZodEnum<{
        auto: "auto";
        manual: "manual";
        reactive: "reactive";
        session_memory: "session_memory";
    }>;
    source: z.ZodEnum<{
        session_memory: "session_memory";
        model_summary: "model_summary";
    }>;
    createdAt: z.ZodString;
    status: z.ZodLiteral<"completed">;
    preCompactTokenCount: z.ZodOptional<z.ZodNumber>;
    postCompactTokenCount: z.ZodOptional<z.ZodNumber>;
    summarizedItemCount: z.ZodOptional<z.ZodNumber>;
    preservedItemCount: z.ZodOptional<z.ZodNumber>;
    summaryTokenCount: z.ZodOptional<z.ZodNumber>;
    model: z.ZodOptional<z.ZodString>;
}, z.core.$strip>, z.ZodObject<{
    type: z.ZodLiteral<"compact_summary">;
    id: z.ZodString;
    boundaryId: z.ZodString;
    content: z.ZodString;
    source: z.ZodEnum<{
        session_memory: "session_memory";
        model_summary: "model_summary";
    }>;
    createdAt: z.ZodString;
}, z.core.$strip>], "type">;
type CompactBoundaryRecord = z.infer<typeof CompactBoundaryRecordSchema>;
type CompactSummaryRecord = z.infer<typeof CompactSummaryRecordSchema>;
type CompactionRecord = z.infer<typeof CompactionRecordSchema>;
interface CompactionStore {
    getRecords(sessionId: string): Promise<CompactionRecord[]>;
    appendRecords(sessionId: string, records: CompactionRecord[]): Promise<void>;
}
type SessionMemorySnapshot = {
    content: string;
    lastSummarizedItemId?: string;
    updatedAt?: string;
    tokenCountAtUpdate?: number;
};
interface SessionMemoryStore {
    read(sessionId: string): Promise<SessionMemorySnapshot | null>;
    write(sessionId: string, snapshot: SessionMemorySnapshot): Promise<void>;
}
type SessionMemoryConfig = {
    store?: SessionMemoryStore;
    backgroundUpdate?: SessionMemoryBackgroundUpdateConfig;
} | SessionMemoryStore;
type SessionMemoryBackgroundUpdateConfig = false | {
    minimumTokensToInit?: number;
    minimumTokensBetweenUpdate?: number;
    waitForUpdateMs?: number;
    maxMemoryTokens?: number;
    model?: string | Model;
    modelSettings?: ModelSettings;
};
type MicrocompactConfig = boolean | {
    enabled?: boolean;
    maxToolResultBytes?: number;
    keepRecentToolResults?: number;
    replacementText?: string;
};
type LocalCompactionConfig = {
    /**
     * Enable local compaction.
     * @default false
     */
    enabled?: boolean;
    /**
     * Automatically decide whether compaction is needed before the main model
     * call; when false, no automatic compaction happens.
     *
     * @default true
     */
    auto?: boolean;
    /**
     * description
     *
     */
    thresholdTokens?: number;
    /**
     * The automatic compaction threshold ratio, used when no explicit
     * thresholdTokens is given.
     * threshold = (contextWindowTokens - reserveOutputTokens) * thresholdRatio
     * e.g. context window 128000, reserved output 20000, so the threshold is about
     * (128000 - 20000) * 0.85 = 91800
     *
     * @default 0.85
     */
    thresholdRatio?: number;
    /**
     * The token space reserved for model output, so the input does not fill the
     * entire context window.
     * 20_000
     * @default 0
     */
    reserveOutputTokens?: number;
    /**
     * description
     *
     */
    contextWindowTokens?: number;
    /**
     * The target number of recent-context tokens to keep after compaction. Note
     * this is a "keep at least this many tokens" of recent messages that are
     * excluded from compaction.
     *
     * @default 12_000
     */
    preservedTailTokens?: number;
    /**
     * Keep at least n of the most recent non-system messages after compaction.
     * @default 8
     */
    preservedTailMessages?: number;
    /**
     * Keep at least n text messages after compaction.
     *
     * @default 4
     */
    minTextMessagesToKeep?: number;
    /**
     * The maximum number of tokens the summary model may output.
     * @default 20_000
     */
    maxSummaryTokens?: number;
    model?: string | Model;
    modelSettings?: ModelSettings;
    store?: CompactionStore;
    sessionMemory?: false | SessionMemoryConfig;
    microcompact?: MicrocompactConfig;
};
type LocalCompactionOption = false | true | LocalCompactionConfig;
type ManualCompactRunOption = false | {
    force?: boolean;
    instructions?: string;
};

type ReasoningItemIdPolicy = 'preserve' | 'omit';

declare class RunItemBase<TRawItem = ModelItem> {
    readonly type: string;
    rawItem?: TRawItem;
    toJSON(): {
        type: string;
        rawItem: TRawItem | undefined;
    };
}
declare class RunToolApprovalItem extends RunItemBase {
    rawItem: FunctionCallItem | HostedToolCallItem;
    agent: Agent<any, any>;
    /**
     * Explicit tool name to use for approval tracking when not present on the raw item.
     */
    toolName?: string | undefined;
    readonly type: "tool_approval_item";
    constructor(rawItem: FunctionCallItem | HostedToolCallItem, agent: Agent<any, any>, 
    /**
     * Explicit tool name to use for approval tracking when not present on the raw item.
     */
    toolName?: string | undefined);
    /**
     * Returns the tool name if available on the raw item or provided explicitly.
     * Kept for backwards compatibility with code that previously relied on `rawItem.name`.
     */
    get name(): string | undefined;
    /**
     * Returns the arguments if the raw item has an arguments property otherwise this will be undefined.
     */
    get arguments(): string | undefined;
    toJSON(): {
        agent: {
            name: string;
        };
        toolName: string | undefined;
        type: string;
        rawItem: {
            type: "function_call";
            callId: string;
            name: string;
            arguments: string;
            providerData?: Record<string, any> | undefined;
            id?: string | undefined;
            namespace?: string | undefined;
            status?: "in_progress" | "completed" | "incomplete" | undefined;
        } | {
            type: "unknown";
            providerData?: Record<string, any> | undefined;
            id?: string | undefined;
        } | {
            type: "hosted_tool_call";
            name: string;
            providerData?: Record<string, any> | undefined;
            id?: string | undefined;
            arguments?: string | undefined;
            status?: string | undefined;
            output?: string | undefined;
        } | {
            role: "user";
            content: string | ({
                type: "input_text";
                text: string;
                providerData?: Record<string, any> | undefined;
            } | {
                type: "input_image";
                providerData?: Record<string, any> | undefined;
                image?: string | {
                    id: string;
                } | undefined;
                detail?: string | undefined;
            } | {
                type: "input_file";
                providerData?: Record<string, any> | undefined;
                file?: string | {
                    id: string;
                } | {
                    url: string;
                } | undefined;
                filename?: string | undefined;
            })[];
            providerData?: Record<string, any> | undefined;
            id?: string | undefined;
            type?: "message" | undefined;
        } | {
            type: "reasoning";
            content: {
                type: "input_text";
                text: string;
                providerData?: Record<string, any> | undefined;
            }[];
            providerData?: Record<string, any> | undefined;
            id?: string | undefined;
            rawContent?: {
                type: "reasoning_text";
                text: string;
                providerData?: Record<string, any> | undefined;
            }[] | undefined;
        } | {
            role: "assistant";
            status: "in_progress" | "completed" | "incomplete";
            content: ({
                type: "refusal";
                refusal: string;
                providerData?: Record<string, any> | undefined;
            } | {
                type: "output_text";
                text: string;
                providerData?: Record<string, any> | undefined;
            } | {
                type: "image";
                image: string;
                providerData?: Record<string, any> | undefined;
            })[];
            providerData?: Record<string, any> | undefined;
            id?: string | undefined;
            type?: "message" | undefined;
        } | {
            type: "function_call_result";
            name: string;
            callId: string;
            status: "in_progress" | "completed" | "incomplete";
            output: string | {
                type: "text";
                text: string;
                providerData?: Record<string, any> | undefined;
            } | {
                type: "image";
                providerData?: Record<string, any> | undefined;
                image?: string | {
                    data: string | Uint8Array<ArrayBuffer>;
                    mediaType?: string | undefined;
                } | {
                    url: string;
                } | {
                    fileId: string;
                } | undefined;
                detail?: "low" | "high" | "auto" | (string & {}) | undefined;
            } | {
                type: "file";
                file: string | {
                    data: string | Uint8Array<ArrayBuffer>;
                    mediaType: string;
                    filename: string;
                } | {
                    url: string;
                    filename?: string | undefined;
                } | {
                    id: string;
                    filename?: string | undefined;
                };
                providerData?: Record<string, any> | undefined;
            } | ({
                type: "input_text";
                text: string;
                providerData?: Record<string, any> | undefined;
            } | {
                type: "input_image";
                providerData?: Record<string, any> | undefined;
                image?: string | {
                    id: string;
                } | undefined;
                detail?: string | undefined;
            } | {
                type: "input_file";
                providerData?: Record<string, any> | undefined;
                file?: string | {
                    id: string;
                } | {
                    url: string;
                } | undefined;
                filename?: string | undefined;
            })[];
            providerData?: Record<string, any> | undefined;
            id?: string | undefined;
            namespace?: string | undefined;
            display?: unknown;
        } | {
            role: "system";
            content: string;
            providerData?: Record<string, any> | undefined;
            id?: string | undefined;
            type?: "message" | undefined;
        } | undefined;
    };
}
declare class RunToolCallOutputItem extends RunItemBase<FunctionCallResultItem> {
    rawItem: FunctionCallResultItem;
    agent: Agent<any, any>;
    output: string | unknown;
    readonly type: "tool_call_output_item";
    constructor(rawItem: FunctionCallResultItem, agent: Agent<any, any>, output: string | unknown);
    toJSON(): {
        agent: {
            name: string;
        };
        output: string;
        type: string;
        rawItem: {
            type: "function_call_result";
            name: string;
            callId: string;
            status: "in_progress" | "completed" | "incomplete";
            output: string | {
                type: "text";
                text: string;
                providerData?: Record<string, any> | undefined;
            } | {
                type: "image";
                providerData?: Record<string, any> | undefined;
                image?: string | {
                    data: string | Uint8Array<ArrayBuffer>;
                    mediaType?: string | undefined;
                } | {
                    url: string;
                } | {
                    fileId: string;
                } | undefined;
                detail?: "low" | "high" | "auto" | (string & {}) | undefined;
            } | {
                type: "file";
                file: string | {
                    data: string | Uint8Array<ArrayBuffer>;
                    mediaType: string;
                    filename: string;
                } | {
                    url: string;
                    filename?: string | undefined;
                } | {
                    id: string;
                    filename?: string | undefined;
                };
                providerData?: Record<string, any> | undefined;
            } | ({
                type: "input_text";
                text: string;
                providerData?: Record<string, any> | undefined;
            } | {
                type: "input_image";
                providerData?: Record<string, any> | undefined;
                image?: string | {
                    id: string;
                } | undefined;
                detail?: string | undefined;
            } | {
                type: "input_file";
                providerData?: Record<string, any> | undefined;
                file?: string | {
                    id: string;
                } | {
                    url: string;
                } | undefined;
                filename?: string | undefined;
            })[];
            providerData?: Record<string, any> | undefined;
            id?: string | undefined;
            namespace?: string | undefined;
            display?: unknown;
        } | undefined;
    };
    get callId(): string | undefined;
}
declare class RunReasoningItem extends RunItemBase<ReasoningItem> {
    rawItem: ReasoningItem;
    agent: Agent;
    readonly type: "reasoning_item";
    constructor(rawItem: ReasoningItem, agent: Agent);
    toJSON(): {
        agent: {
            name: string;
        };
        type: string;
        rawItem: {
            type: "reasoning";
            content: {
                type: "input_text";
                text: string;
                providerData?: Record<string, any> | undefined;
            }[];
            providerData?: Record<string, any> | undefined;
            id?: string | undefined;
            rawContent?: {
                type: "reasoning_text";
                text: string;
                providerData?: Record<string, any> | undefined;
            }[] | undefined;
        } | undefined;
    };
}
declare class RunHandoffCallItem extends RunItemBase<FunctionCallItem> {
    rawItem: FunctionCallItem;
    agent: Agent;
    readonly type: "handoff_call_item";
    constructor(rawItem: FunctionCallItem, agent: Agent);
    toJSON(): {
        agent: {
            name: string;
        };
        type: string;
        rawItem: {
            type: "function_call";
            callId: string;
            name: string;
            arguments: string;
            providerData?: Record<string, any> | undefined;
            id?: string | undefined;
            namespace?: string | undefined;
            status?: "in_progress" | "completed" | "incomplete" | undefined;
        } | undefined;
    };
}
declare class RunHandoffOutputItem extends RunItemBase<FunctionCallResultItem> {
    rawItem: FunctionCallResultItem;
    sourceAgent: Agent<any, any>;
    targetAgent: Agent<any, any>;
    readonly type: "handoff_output_item";
    constructor(rawItem: FunctionCallResultItem, sourceAgent: Agent<any, any>, targetAgent: Agent<any, any>);
    toJSON(): {
        sourceAgent: {
            name: string;
        };
        targetAgent: {
            name: string;
        };
        type: string;
        rawItem: {
            type: "function_call_result";
            name: string;
            callId: string;
            status: "in_progress" | "completed" | "incomplete";
            output: string | {
                type: "text";
                text: string;
                providerData?: Record<string, any> | undefined;
            } | {
                type: "image";
                providerData?: Record<string, any> | undefined;
                image?: string | {
                    data: string | Uint8Array<ArrayBuffer>;
                    mediaType?: string | undefined;
                } | {
                    url: string;
                } | {
                    fileId: string;
                } | undefined;
                detail?: "low" | "high" | "auto" | (string & {}) | undefined;
            } | {
                type: "file";
                file: string | {
                    data: string | Uint8Array<ArrayBuffer>;
                    mediaType: string;
                    filename: string;
                } | {
                    url: string;
                    filename?: string | undefined;
                } | {
                    id: string;
                    filename?: string | undefined;
                };
                providerData?: Record<string, any> | undefined;
            } | ({
                type: "input_text";
                text: string;
                providerData?: Record<string, any> | undefined;
            } | {
                type: "input_image";
                providerData?: Record<string, any> | undefined;
                image?: string | {
                    id: string;
                } | undefined;
                detail?: string | undefined;
            } | {
                type: "input_file";
                providerData?: Record<string, any> | undefined;
                file?: string | {
                    id: string;
                } | {
                    url: string;
                } | undefined;
                filename?: string | undefined;
            })[];
            providerData?: Record<string, any> | undefined;
            id?: string | undefined;
            namespace?: string | undefined;
            display?: unknown;
        } | undefined;
    };
}
declare class RunToolCallItem extends RunItemBase<ToolCallItem> {
    rawItem: ToolCallItem;
    agent: Agent;
    readonly type: "tool_call_item";
    constructor(rawItem: ToolCallItem, agent: Agent);
    toJSON(): {
        agent: {
            name: string;
        };
        type: string;
        rawItem: {
            type: "function_call";
            callId: string;
            name: string;
            arguments: string;
            providerData?: Record<string, any> | undefined;
            id?: string | undefined;
            namespace?: string | undefined;
            status?: "in_progress" | "completed" | "incomplete" | undefined;
        } | {
            type: "hosted_tool_call";
            name: string;
            providerData?: Record<string, any> | undefined;
            id?: string | undefined;
            arguments?: string | undefined;
            status?: string | undefined;
            output?: string | undefined;
        } | undefined;
    };
    get toolName(): string | undefined;
    get callId(): string | undefined;
}
declare class RunMessageOutputItem extends RunItemBase<AssistantMessageItem> {
    rawItem: AssistantMessageItem;
    agent: Agent;
    readonly type: "message_output_item";
    constructor(rawItem: AssistantMessageItem, agent: Agent);
    toJSON(): {
        agent: {
            name: string;
        };
        type: string;
        rawItem: {
            role: "assistant";
            status: "in_progress" | "completed" | "incomplete";
            content: ({
                type: "refusal";
                refusal: string;
                providerData?: Record<string, any> | undefined;
            } | {
                type: "output_text";
                text: string;
                providerData?: Record<string, any> | undefined;
            } | {
                type: "image";
                image: string;
                providerData?: Record<string, any> | undefined;
            })[];
            providerData?: Record<string, any> | undefined;
            id?: string | undefined;
            type?: "message" | undefined;
        } | undefined;
    };
    get content(): string;
}
declare class RunCompactBoundaryItem extends RunItemBase<CompactBoundaryRecord> {
    rawItem: CompactBoundaryRecord;
    agent: Agent;
    readonly type: "compact_boundary_item";
    constructor(rawItem: CompactBoundaryRecord, agent: Agent);
    toJSON(): {
        agent: {
            name: string;
        };
        type: string;
        rawItem: {
            type: "compact_boundary";
            id: string;
            summaryItemId: string;
            compactedRange: {
                fromItemId: string;
                toItemId: string;
            };
            insertAfterItemId: string;
            trigger: "auto" | "manual" | "reactive" | "session_memory";
            source: "session_memory" | "model_summary";
            createdAt: string;
            status: "completed";
            supersedesBoundaryId?: string | undefined;
            preCompactTokenCount?: number | undefined;
            postCompactTokenCount?: number | undefined;
            summarizedItemCount?: number | undefined;
            preservedItemCount?: number | undefined;
            summaryTokenCount?: number | undefined;
            model?: string | undefined;
        } | undefined;
    };
}
declare class RunCompactSummaryItem extends RunItemBase<CompactSummaryRecord> {
    rawItem: CompactSummaryRecord;
    agent: Agent;
    readonly type: "compact_summary_item";
    constructor(rawItem: CompactSummaryRecord, agent: Agent);
    toJSON(): {
        agent: {
            name: string;
        };
        type: string;
        rawItem: {
            type: "compact_summary";
            id: string;
            boundaryId: string;
            content: string;
            source: "session_memory" | "model_summary";
            createdAt: string;
        } | undefined;
    };
}
type RunItem = RunMessageOutputItem | RunToolCallItem | RunReasoningItem | RunHandoffCallItem | RunToolCallOutputItem | RunHandoffOutputItem | RunToolApprovalItem | RunCompactBoundaryItem | RunCompactSummaryItem;

type RequestUsageInput = Partial<RequestUsageData & {
    input_tokens: number;
    output_tokens: number;
    total_tokens: number;
    input_tokens_details: object;
    output_tokens_details: object;
    endpoint?: string;
}>;
type UsageInput = Partial<UsageData & {
    input_tokens: number;
    output_tokens: number;
    total_tokens: number;
    input_tokens_details: Record<string, number> | Array<Record<string, number>> | object;
    output_tokens_details: Record<string, number> | Array<Record<string, number>> | object;
    request_usage_entries: RequestUsageInput[];
}> & {
    requests?: number;
    requestUsageEntries?: RequestUsageInput[];
};
/**
 * Tracks token usage and request counts during an agent run.
 */
declare class Usage {
    /**
     * The number of requests made to the LLM API.
     */
    requests: number;
    /**
     * The total number of input tokens used across all requests.
     */
    inputTokens: number;
    /**
     * The total number of output tokens used across all requests.
     */
    outputTokens: number;
    /**
     * The total number of tokens sent and received across all requests.
     */
    totalTokens: number;
    /**
     * The detailed breakdown of input tokens across all requests.
     */
    inputTokensDetails: Array<Record<string, number>>;
    /**
     * The detailed breakdown of output tokens across all requests.
     */
    outputTokensDetails: Array<Record<string, number>>;
    /**
     * The list of per-request usage entries, used for detailed cost calculation.
     */
    requestUsageEntries: RequestUsage[] | undefined;
    constructor(input?: UsageInput);
    add(newUsage: Usage): void;
}
declare class RequestUsage {
    /**
     * The number of input tokens used for this request.
     */
    inputTokens: number;
    /**
     * The number of output tokens used for this request.
     */
    outputTokens: number;
    /**
     * The total number of tokens sent and received for this request.
     */
    totalTokens: number;
    /**
     * Details about the input tokens used for this request.
     */
    inputTokensDetails: Record<string, number>;
    /**
     * Details about the output tokens used for this request.
     */
    outputTokensDetails: Record<string, number>;
    /**
     * The endpoint that produced this usage entry (e.g., responses.create, responses.compact).
     */
    endpoint?: 'responses.create' | 'responses.compact' | (string & {});
    constructor(input?: RequestUsageInput);
}

type ApprovalRecord = {
    approved: boolean | string[];
    rejected: boolean | string[];
    messages?: Record<string, string>;
    stickyRejectMessage?: string;
    updatedInput?: Record<string, unknown>;
};
type RunContextJson = {
    context: any;
    usage: Usage;
    approvals: Record<string, ApprovalRecord>;
    toolInput?: unknown;
};
/**
 * A context object that is passed to the `Runner.run()` method.
 */
declare class RunContext<TContext = UnknownContext> {
    #private;
    /**
     * The context object passed to the `Runner.run()` method.
     */
    context: TContext;
    /**
     * Usage statistics for the agent run so far. For streaming responses, usage is
     * updated in real time.
     */
    usage: Usage;
    /**
     * The structured input for the current agent tool run, if available.
     */
    toolInput?: unknown;
    constructor(context?: TContext);
    /**
     * Create a child context instance for a forked run.
     * Subclasses should override this to safely preserve custom instance state.
     * @internal
     */
    protected _createFork(): RunContext<TContext>;
    /**
     * Copy the shared runtime state into a child context.
     * @internal
     */
    protected _cloneSharedState<TTarget extends RunContext<TContext>>(target: TTarget): TTarget;
    /**
     * Get the ephemeral state shared within the current run's lifecycle.
     *
     * This state is shared across forked tool contexts, but is not serialized into
     * the run state.
     *
     * @internal
     */
    _getEphemeralSharedState<T>(key: symbol, create: () => T): T;
    /**
     * Rebuild the approvals map from serialized state.
     * @internal
     *
     * @param approvals - The approvals map to rebuild.
     */
    _rebuildApprovals(approvals: Record<string, ApprovalRecord>): void;
    /**
     * Merge approval records from serialized state without discarding existing
     * entries.
     * @internal
     *
     * @param approvals - The approvals map to merge.
     */
    _mergeApprovals(approvals: Record<string, ApprovalRecord>): void;
    /**
     * Get the rejection message the caller provided for a specific tool call.
     *
     * @param toolName - The tool name.
     * @param callId - The call ID of the tool call.
     * @returns The string if a message was provided, otherwise `undefined`.
     */
    getRejectionMessage(toolName: string, callId: string): string | undefined;
    getApprovalUpdatedInput(toolName: string, callId: string): unknown;
    /**
     * Check whether a tool call has been approved.
     *
     * @param approval - Details of the tool call being evaluated.
     * @returns `true` if the tool call is approved, `false` if it is blocked, or `undefined` if not yet approved or rejected.
     */
    isToolApproved(approval: {
        toolName: string;
        callId: string;
    }): boolean | undefined;
    /**
     * Approve a tool call.
     *
     * @param approvalItem - The tool approval item to approve.
     * @param options - Additional approval behavior options.
     */
    approveTool(approvalItem: RunToolApprovalItem, { alwaysApprove, updatedInput, }?: {
        alwaysApprove?: boolean;
        updatedInput?: unknown;
    }): void;
    /**
     * Reject a tool call.
     *
     * @param approvalItem - The tool approval item to reject.
     */
    rejectTool(approvalItem: RunToolApprovalItem, { alwaysReject, message, }?: {
        alwaysReject?: boolean;
        message?: string;
    }): void;
    /**
     * Create a child context that shares approval state and usage statistics, with
     * the tool input set.
     * @internal
     */
    _forkWithToolInput(toolInput: unknown): RunContext<TContext>;
    /**
     * Create a child context that shares approval state and usage statistics, but
     * with no tool input set.
     * @internal
     */
    _forkWithoutToolInput(): RunContext<TContext>;
    toJSON(): RunContextJson;
}

type HandoffEnabledFunction<TContext = UnknownContext> = (args: {
    runContext: RunContext<TContext>;
    agent: Agent<any, any>;
}) => Promise<boolean>;
declare class Handoff<TContext = UnknownContext, TOutput extends AgentOutputType = TextOutput> {
    /**
     * The name of the tool that represents this handoff.
     */
    toolName: string;
    /**
     * The description of the tool that represents this handoff.
     */
    toolDescription: string;
    /**
     * The JSON Schema for the handoff input. Can be empty if the handoff does not
     * need to receive input.
     */
    inputJsonSchema: JsonObjectSchema<any>;
    /**
     * Whether the input JSON Schema is in strict mode. We **strongly** recommend
     * setting this to true, as it improves the likelihood of generating correct
     * JSON input.
     */
    strictJsonSchema: boolean;
    /**
     * The function that invokes the handoff. It receives:
     * 1. The run context of the handoff
     * 2. The arguments from the LLM, as a JSON string. Empty string if
     *    inputJsonSchema is empty.
     *
     * Must return an agent.
     */
    onInvokeHandoff: (context: RunContext<TContext>, args: string) => Promise<Agent<TContext, TOutput>> | Agent<TContext, TOutput>;
    /**
     * The name of the agent being handed off to.
     */
    agentName: string;
    /**
     * A function that filters the input passed to the next agent. By default, the
     * new agent sees the full conversation history. In some cases you may want to
     * filter the input, for example to remove earlier input or remove tools from
     * existing input.
     *
     * The function receives the full conversation history so far, including the
     * input item that triggered the handoff and a tool call output item
     * representing the handoff tool's output.
     *
     * You are free to modify the input history or add items as needed. The next
     * agent to run will receive `handoffInputData.allItems`.
     */
    inputFilter?: HandoffInputFilter;
    /**
     * The agent being handed off to.
     */
    agent: Agent<TContext, TOutput>;
    /**
     * Returns a function tool definition that can be used to invoke the handoff.
     */
    getHandoffAsFunctionTool(): {
        type: "function";
        name: string;
        description: string;
        parameters: JsonObjectSchema<any>;
        strict: boolean;
    };
    /**
     * The function that determines whether the handoff is enabled; defaults to
     * always enabled.
     */
    isEnabled: HandoffEnabledFunction<TContext>;
    constructor(agent: Agent<TContext, TOutput>, onInvokeHandoff: (context: RunContext<TContext>, args: string) => Promise<Agent<TContext, TOutput>> | Agent<TContext, TOutput>);
}
/**
 * Data passed to the handoff function.
 */
type HandoffInputData = {
    /**
     * The input history before `Runner.run()` was called.
     */
    inputHistory: string | AgentInputItem[];
    /**
     * The items generated before the agent turn where the handoff was invoked.
     */
    preHandoffItems: RunItem[];
    /**
     * The new items generated during the current agent turn, including the item that triggered the
     * handoff and the tool output message representing the response from the handoff output.
     */
    newItems: RunItem[];
    /**
     * The context of the handoff.
     * Note that, since this property was added later on, it's optional to pass from users.
     */
    runContext?: RunContext<any>;
};
type HandoffInputFilter = (input: HandoffInputData) => HandoffInputData;

type ModelTracing = boolean | 'enabled_without_data';
type SerializedOutputType = JsonSchemaDefinition | TextOutput;
type ModelSettingsToolChoice = 'auto' | 'required' | 'none' | (string & {});
type SerializedFunctionTool = {
    /**
     * The type of the tool.
     */
    type: FunctionTool['type'];
    /**
     * The name of the tool.
     */
    name: FunctionTool['name'];
    /**
     * The description of the tool that helps the model to understand when to use the tool
     */
    description: FunctionTool['description'];
    /**
     * A JSON schema describing the parameters of the tool.
     */
    parameters: FunctionTool['parameters'];
    /**
     * Whether the tool is strict. If true, the model must try to strictly follow the schema
     * (might result in slower response times).
     */
    strict: FunctionTool['strict'];
    /**
     * Responses API only. Explicit namespace used to group related function tools.
     */
    namespace?: string;
    /**
     * Responses API only. Description shared by all tools in the namespace. Required when namespace is set.
     */
    namespaceDescription?: string;
};
type SerializedHostedTool = {
    type: HostedTool['type'];
    name: HostedTool['name'];
    providerData?: HostedTool['providerData'];
};
type SerializedTool = SerializedFunctionTool | SerializedHostedTool;
type ModelRetryBackoffSettings = {
    /**
     * Delay for the first retry in milliseconds.
     */
    initialDelayMs?: number;
    /**
     * Maximum delay between retries in milliseconds.
     */
    maxDelayMs?: number;
    /**
     * Multiplier applied after each retry attempt.
     */
    multiplier?: number;
    /**
     * Whether to apply jitter to the computed backoff delay.
     */
    jitter?: boolean;
};
type RetryPolicyContext = {
    /**
     * The error thrown by the failed model attempt.
     */
    error: unknown;
    /**
     * The 1-based number of the failed attempt.
     */
    attempt: number;
    /**
     * The configured number of retries allowed after the initial attempt.
     */
    maxRetries: number;
    /**
     * Whether the failed request was streaming.
     */
    stream: boolean;
    /**
     * Optional provider guidance for the failure.
     */
    providerAdvice?: ModelRetryAdvice;
    /**
     * Generic normalized facts extracted from the error and provider advice.
     */
    normalized: ModelRetryNormalizedError;
};
type RetryDecision = boolean | {
    /**
     * Whether the failed request should be retried.
     */
    retry: boolean;
    /**
     * Optional delay override in milliseconds before the next retry attempt.
     */
    delayMs?: number;
    /**
     * Optional explanation for logging or debugging.
     */
    reason?: string;
};
type RetryPolicy = (context: RetryPolicyContext) => RetryDecision | Promise<RetryDecision>;
type ModelRetrySettings = {
    streamOnly?: boolean;
    diagnostics?: {
        provider: string;
        model: string;
    };
    /**
     * Number of retries allowed after the initial model request.
     * Retries remain opt-in; no retries occur unless `policy` returns `true`.
     */
    maxRetries?: number;
    /**
     * Backoff configuration used when the retry policy requests a retry without returning an explicit delay.
     */
    backoff?: ModelRetryBackoffSettings;
    /**
     * Runtime-only retry policy. This callback is not serialized into persisted run state.
     */
    policy?: RetryPolicy;
};
type ModelRetryLifecycleEvent = {
    name: 'retry_scheduled' | 'retry_started' | 'retry_recovered' | 'retry_exhausted';
    attempt: number;
    maxAttempts: number;
    delayMs?: number;
    retryAt?: number;
    errorCategory?: string;
    reason?: string;
};
/**
 * The base interface for calling an LLM.
 */
interface Model {
    /**
     * Get a response from the model.
     *
     * @param request - The request to get a response for.
     */
    getResponse(request: ModelRequest): Promise<ModelResponse>;
    /**
     * Get a streamed response from the model.
     *
     */
    getStreamedResponse(request: ModelRequest): AsyncIterable<StreamEvent>;
    /**
     * Provide optional retry advice for a failed request.
     */
    getRetryAdvice?(args: ModelRetryAdviceRequest): Promise<ModelRetryAdvice | undefined> | ModelRetryAdvice | undefined;
    /**
     * Provider/model capability metadata used by SDK features such as local compaction.
     */
    metadata?: ModelMetadata;
}
type ModelSettings = {
    temperature?: number;
    topP?: number;
    frequencyPenalty?: number;
    presencePenalty?: number;
    toolChoice?: ModelSettingsToolChoice;
    parallelToolCalls?: boolean;
    truncation?: 'auto' | 'disabled';
    maxTokens?: number;
    store?: boolean;
    promptCacheRetention?: 'in_memory' | '24h' | null;
    reasoning?: ModelSettingsReasoning;
    providerData?: Record<string, any>;
    retry?: ModelRetrySettings;
};
type ModelSettingsReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | null;
type ModelSettingsReasoning = {
    effort?: ModelSettingsReasoningEffort | null;
    summary?: 'auto' | 'concise' | 'detailed' | null;
};
type ModelResponse = {
    /**
     * The usage information for response.
     */
    usage: Usage;
    /**
     * A list of outputs (messages, tool calls, etc.) generated by the model.
     */
    output: AgentOutputItem[];
    /**
     * An ID for the response which can be used to refer to the response in subsequent calls to the
     * model. Not supported by all model providers.
     */
    responseId?: string;
    /**
     * The transport request ID for this model call, if provided by the model SDK or transport.
     */
    requestId?: string;
    /**
     * Raw response data from the underlying model provider.
     */
    providerData?: Record<string, any>;
};
interface ModelProvider {
    /**
     * Returns the provider-specific default model name when one is available.
     */
    getDefaultModelName?(): string | undefined;
    /**
     * Returns provider-known capability metadata for a model name when available.
     * User supplied run configuration may still override these values.
     */
    getModelMetadata?(modelName?: string): Promise<ModelMetadata | undefined> | ModelMetadata | undefined;
    /**
     * Get a model by name
     *
     * @param modelName - The name of the model to get.
     */
    getModel(modelName?: string): Promise<Model> | Model;
}
type ModelMetadata = {
    /**
     * Maximum total context window accepted by the model, measured in tokens.
     */
    contextWindowTokens?: number;
    /**
     * Maximum output tokens the model can generate in one response.
     */
    maxOutputTokens?: number;
    /**
     * Multimodal capabilities that affect transport-level projection and local
     * tools such as `view_image`.
     */
    multimodal?: {
        /**
         * Whether this model can accept image inputs.
         */
        imageInput?: boolean;
        /**
         * How image outputs from tools can be returned to the model.
         *
         * `native` means the provider supports image content inside tool result
         * messages. `synthetic-user` means the adapter must send a textual tool
         * result and then project images through a synthetic user image message.
         */
        imageToolResult?: 'native' | 'synthetic-user' | false;
        /**
         * Optional image dimension limits enforced before sending images to the
         * provider.
         */
        maxImageWidth?: number;
        maxImageHeight?: number;
        maxImagePixels?: number;
        /**
         * Optional transport safety guard for inline payload size. Visual APIs
         * typically limit by dimensions rather than bytes.
         */
        maxImageBytes?: number;
    };
};
type SerializedHandoff = {
    /**
     * The name of the tool that represents the handoff.
     */
    toolName: Handoff['toolName'];
    /**
     * The tool description for the handoff
     */
    toolDescription: Handoff['toolDescription'];
    /**
     * The JSON schema for the handoff input. Can be empty if the handoff does not take an input
     */
    inputJsonSchema: Handoff['inputJsonSchema'];
    /**
     * Whether the input JSON schema is in strict mode. We strongly recommend setting this to true,
     * as it increases the likelihood of correct JSON input.
     */
    strictJsonSchema: Handoff['strictJsonSchema'];
};
type ModelRequest = {
    /**
     * The system instructions to use for the model.
     */
    systemInstructions?: string;
    /**
     * The input to the model.
     */
    input: string | AgentInputItem[];
    /**
     * The ID of the previous response to use for the model.
     */
    previousResponseId?: string;
    /**
     * The ID of stored conversation to use for the model.
     *
     * see https://platform.openai.com/docs/guides/conversation-state?api-mode=responses#openai-apis-for-conversation-state
     * see https://platform.openai.com/docs/api-reference/conversations/create
     */
    conversationId?: string;
    /**
     * The model settings to use for the model.
     */
    modelSettings: ModelSettings;
    /**
     * The tools to use for the model.
     */
    tools: SerializedTool[];
    /**
     * When true, the caller explicitly configured the tools list (even if empty).
     * Providers can use this to avoid overwriting prompt-defined tools when an agent
     * does not specify its own tools.
     */
    toolsExplicitlyProvided?: boolean;
    /**
     * The type of the output to use for the model.
     */
    outputType: SerializedOutputType;
    /**
     * The handoffs to use for the model.
     */
    handoffs: SerializedHandoff[];
    /**
     * Whether to enable tracing for the model.
     */
    tracing: ModelTracing;
    /**
     * An optional signal to abort the model request.
     */
    signal?: AbortSignal;
    /**
     * The prompt template to use for the model, if any.
     */
    /**
     * When true, the resolved model should override the model configured in the prompt template.
     * Providers that support prompt templates should include the explicit model name in the request
     * even when a prompt is supplied.
     */
    overridePromptModel?: boolean;
    /**
     * @internal
     */
    _internal?: {
        runnerManagedRetry?: boolean;
        onRetryEvent?: (event: ModelRetryLifecycleEvent) => void;
    };
};
type ModelRetryAdviceRequest = {
    /**
     * The failed request that is being evaluated for replay.
     */
    request: ModelRequest;
    /**
     * The error thrown by the failed attempt.
     */
    error: unknown;
    /**
     * Whether the failed request used streaming.
     */
    stream: boolean;
    /**
     * The 1-based number of the failed attempt.
     */
    attempt: number;
};
type ModelRetryAdvice = {
    /**
     * Optional provider recommendation for whether this error is retryable.
     * The runner still applies safety vetoes first and user policy remains the final authority.
     */
    suggested?: boolean;
    /**
     * Optional delay hint in milliseconds from the provider or transport layer.
     */
    retryAfterMs?: number;
    /**
     * Optional explanation for why the provider suggested or vetoed a retry.
     */
    reason?: string;
    /**
     * Provider confidence about whether replaying the request is safe.
     * Omit this field when replay safety is unknown.
     */
    replaySafety?: 'unsafe' | 'safe';
    /**
     * Provider-supplied normalized facts that should override generic extraction when present.
     */
    normalized?: Partial<ModelRetryNormalizedError>;
};
type ModelRetryNormalizedError = {
    /**
     * HTTP status code when the provider exposes one.
     */
    statusCode?: number;
    /**
     * Suggested delay in milliseconds derived from retry-after style headers.
     */
    retryAfterMs?: number;
    /**
     * Provider or transport-specific error code when exposed.
     */
    errorCode?: string;
    /**
     * Whether the error appears to come from a transient transport or connectivity problem.
     */
    isNetworkError: boolean;
    /**
     * Whether the error was caused by an abort signal or abort exception.
     */
    isAbort: boolean;
};

interface InputGuardrailMetadata {
    type: 'input';
    name: string;
}
interface InputGuardrailResult {
    /**
     * The metadata of the guardrail.
     */
    guardrail: InputGuardrailMetadata;
    /**
     * The output of the guardrail.
     */
    output: GuardrailFunctionOutput;
}
interface GuardrailFunctionOutput {
    /**
     * Whether the tripwire was triggered. If triggered, the agent's execution will be halted.
     */
    tripwireTriggered: boolean;
    /**
     * Optional information about the guardrail's output.
     * For example, the guardrail could include information about the checks it performed and granular results.
     */
    outputInfo: any;
}
interface OutputGuardrailMetadata {
    type: 'output';
    name: string;
}
/**
 * The result of an output guardrail execution.
 */
interface OutputGuardrailResult<TMeta = OutputGuardrailMetadata, TOutput extends AgentOutputType = TextOutput> {
    /**
     * The metadata of the guardrail.
     */
    guardrail: TMeta;
    /**
     * The output of the agent that ran.
     */
    agentOutput: ResolvedAgentOutput<TOutput>;
    /**
     * The agent that ran.
     */
    agent: Agent<UnknownContext, TOutput>;
    /**
     * The output of the guardrail.
     */
    output: GuardrailFunctionOutput;
}
interface OutputGuardrailFunctionArgs<TContext = UnknownContext, TOutput extends AgentOutputType = TextOutput> {
    agent: Agent<any, any>;
    agentOutput: ResolvedAgentOutput<TOutput>;
    context: RunContext<TContext>;
    /**
     * Additional details about the agent output.
     */
    details?: {
        /** Model response associated with the output if available. */
        modelResponse?: ModelResponse;
        /** Model output items generated during the run (excluding approvals). */
        output?: AgentOutputItem[];
    };
}
/**
 * A function that takes an output guardrail function arguments and returns a `GuardrailFunctionOutput`.
 */
type OutputGuardrailFunction<TOutput extends AgentOutputType = TextOutput, TContext = UnknownContext> = (args: OutputGuardrailFunctionArgs<TContext, TOutput>) => Promise<GuardrailFunctionOutput>;
/**
 * A guardrail that checks the input to the agent.
 */
interface InputGuardrail {
    /**
     * The name of the guardrail.
     */
    name: string;
    /**
     * The function that performs the guardrail check
     */
    execute: InputGuardrailFunction;
    /**
     * Whether the guardrail should execute alongside the agent (true, default) or block the
     * agent until it completes (false).
     */
    runInParallel?: boolean;
}
/**
 * The function that performs the actual input guardrail check and returns the decision on whether
 * a guardrail was triggered.
 */
type InputGuardrailFunction = (args: InputGuardrailFunctionArgs) => Promise<GuardrailFunctionOutput>;
/**
 * Arguments for an input guardrail function.
 */
interface InputGuardrailFunctionArgs<TContext = UnknownContext> {
    /**
     * The agent that is being run.
     */
    agent: Agent<any, any>;
    /**
     * The input to the agent.
     */
    input: string | ModelItem[];
    /**
     * The context of the agent run.
     */
    context: RunContext<TContext>;
}
/**
 * A guardrail that checks the output of the agent.
 */
interface OutputGuardrail<TOutput extends AgentOutputType = TextOutput, TContext = UnknownContext> {
    /**
     * The name of the guardrail.
     */
    name: string;
    /**
     * The function that performs the guardrail check.
     */
    execute: OutputGuardrailFunction<TOutput, TContext>;
}

type AgentToolInvocation = Readonly<{
    toolName: string;
    toolCallId?: string;
    toolArguments?: string;
}>;

declare const nextStepSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
    type: z.ZodLiteral<"next_step_handoff">;
    newAgent: z.ZodAny;
}, z.core.$strip>, z.ZodObject<{
    type: z.ZodLiteral<"next_step_final_output">;
    output: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
    type: z.ZodLiteral<"next_step_run_again">;
}, z.core.$strip>, z.ZodObject<{
    type: z.ZodLiteral<"next_step_interruption">;
    data: z.ZodRecord<z.ZodString, z.ZodAny>;
}, z.core.$strip>], "type">;
type NextStep = z.infer<typeof nextStepSchema>;

declare class AgentToolUseTracker {
    #private;
    addToolUse(agent: Agent<any, any>, toolNames: string[], options?: {
        allowEmpty?: boolean;
    }): void;
    hasUsedTools(agent: Agent<any, any>): boolean;
    toJSON(options?: {
        agentIdentityKeys?: ReadonlyMap<Agent<any, any>, string>;
    }): Record<string, string[]>;
}

type ToolRunHandoff = {
    toolCall: FunctionCallItem;
    handoff: Handoff<any, any>;
};
type ToolRunFunction<TContext = UnknownContext> = {
    toolCall: FunctionCallItem;
    tool: FunctionTool<TContext>;
};
type ProcessedResponse<TContext = UnknownContext> = {
    newItems: RunItem[];
    handoffs: ToolRunHandoff[];
    functions: ToolRunFunction<TContext>[];
    toolsUsed: string[];
    mcpApprovalRequests: ToolRunMCPApprovalRequest[];
    hasToolsOrApprovalsToRun(): boolean;
};
type ModelInputData = {
    input: AgentInputItem[];
    instructions?: string;
};
type CallModelInputFilterArgs<TContext = unknown> = {
    modelData: ModelInputData;
    agent: Agent<TContext, AgentOutputType>;
    context: TContext | undefined;
};
type CallModelInputFilter<TContext = unknown> = (args: CallModelInputFilterArgs<TContext>) => ModelInputData | Promise<ModelInputData>;
type ToolRunMCPApprovalRequest = {
    requestItem: RunToolApprovalItem;
    mcpTool: HostedMCPTool;
};

interface ToolGuardrailBase {
    name: string;
}
/**
 * The action a tool guardrail should take after evaluation.
 *
 * - `allow`: continue to the next guardrail or tool execution/output handling.
 * - `rejectContent`: treat the guardrail as rejecting the call/output and
 *   short-circuit with a message.
 * - `throwException`: immediately escalate to a tripwire exception, to fail fast
 *   and surface diagnostic information.
 */
type ToolGuardrailBehavior = {
    type: 'allow';
} | {
    type: 'rejectContent';
    message: string;
} | {
    type: 'throwException';
};
/**
 * Input data passed to a tool input guardrail function.
 */
interface ToolInputGuardrailData<TContext = UnknownContext> {
    context: RunContext<TContext>;
    agent: Agent<any, any>;
    toolCall: FunctionCallItem;
}
interface ToolOutputGuardrailData<TContext = UnknownContext> extends ToolInputGuardrailData<TContext> {
    output: unknown;
}
/**
 * The output of a tool guardrail function.
 *
 * `behavior` drives runner control flow; `outputInfo` is optional, structured metadata for tracing or debugging.
 */
interface ToolGuardrailFunctionOutput {
    /**
     * Additional data about the guardrail evaluation.
     */
    outputInfo?: any;
    /**
     * The behavior the runner should take in response to this guardrail.
     */
    behavior: ToolGuardrailBehavior;
}
type ToolInputGuardrailFunction<TContext = UnknownContext> = (data: ToolInputGuardrailData<TContext>) => Promise<ToolGuardrailFunctionOutput>;
interface ToolInputGuardrailDefinition<T = UnknownContext> extends ToolGuardrailBase {
    type: 'tool_input';
    run: ToolInputGuardrailFunction<T>;
}
type ToolOutputGuardrailFunction<TContext = UnknownContext> = (data: ToolOutputGuardrailData<TContext>) => Promise<ToolGuardrailFunctionOutput>;
interface ToolOutputGuardrailDefinition<TContext = UnknownContext> extends ToolGuardrailBase {
    type: 'tool_output';
    run: ToolOutputGuardrailFunction<TContext>;
}
interface ToolGuardrailMetadata {
    type: 'tool_input' | 'tool_output';
    name: string;
}
interface ToolInputGuardrailResult {
    guardrail: ToolGuardrailMetadata & {
        type: 'tool_input';
    };
    output: ToolGuardrailFunctionOutput;
}
interface ToolOutputGuardrailResult {
    guardrail: ToolGuardrailMetadata & {
        type: 'tool_output';
    };
    output: ToolGuardrailFunctionOutput;
}
type ToolInputGuardrailInit<TContext = UnknownContext> = ToolInputGuardrailDefinition<TContext> | {
    name: string;
    run: ToolInputGuardrailFunction<TContext>;
};
type ToolOutputGuardrailInit<TContext = UnknownContext> = ToolOutputGuardrailDefinition<TContext> | {
    name: string;
    run: ToolOutputGuardrailFunction<TContext>;
};
declare function resolveToolInputGuardrails<TContext = UnknownContext>(guardrails?: ToolInputGuardrailInit<TContext>[]): ToolInputGuardrailDefinition<TContext>[];
declare function resolveToolOutputGuardrails<TContext = UnknownContext>(guardrails?: ToolOutputGuardrailInit<TContext>[]): ToolOutputGuardrailDefinition<TContext>[];
declare function defineToolInputGuardrail<TContext = UnknownContext>(args: {
    name: string;
    run: ToolInputGuardrailFunction<TContext>;
}): ToolInputGuardrailDefinition<TContext>;
declare function defineToolOutputGuardrail<TContext = UnknownContext>(args: {
    name: string;
    run: ToolOutputGuardrailFunction<TContext>;
}): ToolOutputGuardrailDefinition<TContext>;
declare const ToolGuardrailFunctionOutputFactory: {
    allow(outputInfo?: any): ToolGuardrailFunctionOutput;
    rejectContent(message: string, outputInfo?: any): ToolGuardrailFunctionOutput;
    throwException(outputInfo?: any): ToolGuardrailFunctionOutput;
};

type TraceOptions = {
    traceId?: string;
    name?: string;
    groupId?: string;
    metadata?: Record<string, any>;
    started?: boolean;
    tracingApiKey?: string;
};
declare class Trace {
    #private;
    type: "trace";
    traceId: string;
    name: string;
    groupId: string | null;
    metadata?: Record<string, any>;
    tracingApiKey?: string;
    constructor(options: TraceOptions, processor?: TracingProcessor);
    start(): Promise<void>;
    end(): Promise<void>;
    clone(): Trace;
    /**
     * Serializes the trace for export or persistence.
     * Set `includeTracingApiKey` to true only when you intentionally need to persist the
     * exporter credentials (for example, when handing off a run to another process that
     * cannot access the original environment). Defaults to false to avoid leaking secrets.
     */
    toJSON(options?: {
        includeTracingApiKey?: boolean;
    }): object | null;
}

type Span$1 = Span<any>;
/**
 * Exports traces and spans. For example, could log them or send them to a backend.
 */
interface TracingExporter {
    /**
     * Export the given traces and spans
     * @param items - The traces and spans to export
     */
    export(items: (Trace | Span$1)[], signal?: AbortSignal): Promise<void>;
}
/**
 * The interface for processing traces.
 */
interface TracingProcessor {
    /**
     * Called when the tracing processor should start processing traces.
     * Only needs to start the loop if the processor needs to perform tasks such as
     * exporting traces on a loop.
     */
    start?(): void;
    /***
     * Called when a trace starts.
     */
    onTraceStart(trace: Trace): Promise<void>;
    /**
     * Called when a trace ends.
     */
    onTraceEnd(trace: Trace): Promise<void>;
    /**
     * Called when a span starts.
     */
    onSpanStart(span: Span$1): Promise<void>;
    /**
     * Called when a span ends.
     */
    onSpanEnd(span: Span$1): Promise<void>;
    /**
     * Called when the tracing processor is shutting down.
     */
    shutdown(timeout?: number): Promise<void>;
    /**
     * Called when traces are being flushed.
     */
    forceFlush(): Promise<void>;
}
type BatchTraceProcessorOptions = {
    /**
     * The maximum number of spans to store in the queue. After this, we will start dropping spans.
     */
    maxQueueSize?: number;
    /**
     * The maximum number of spans to export in a single batch.
     */
    maxBatchSize?: number;
    /**
     * The delay between checks for new spans to export in milliseconds.
     */
    scheduleDelay?: number;
    /**
     * The ratio of the queue size at which we will trigger an export.
     */
    exportTriggerRatio?: number;
};
declare class BatchTraceProcessor implements TracingProcessor {
    #private;
    constructor(exporter: TracingExporter, { maxQueueSize, maxBatchSize, scheduleDelay, // 5 seconds
    exportTriggerRatio, }?: BatchTraceProcessorOptions);
    start(): void;
    onTraceStart(trace: Trace): Promise<void>;
    onTraceEnd(_trace: Trace): Promise<void>;
    onSpanStart(_span: Span$1): Promise<void>;
    onSpanEnd(span: Span$1): Promise<void>;
    shutdown(timeout?: number): Promise<void>;
    forceFlush(): Promise<void>;
}
/**
 * Prints the traces and spans to the console
 */
declare class ConsoleSpanExporter implements TracingExporter {
    export(items: (Trace | Span$1)[]): Promise<void>;
}
declare function defaultProcessor(): TracingProcessor;

type SpanError = {
    message: string;
    data?: Record<string, any>;
};
type SpanDataBase = {
    type: string;
};
type AgentSpanData = SpanDataBase & {
    type: 'agent';
    name: string;
    handoffs?: string[];
    tools?: string[];
    output_type?: string;
};
type FunctionSpanData = SpanDataBase & {
    type: 'function';
    name: string;
    input: string;
    output: string;
    mcp_data?: string;
};
type GenerationUsageData = {
    input_tokens?: number;
    output_tokens?: number;
    details?: Record<string, unknown> | null;
    [key: string]: unknown;
};
type GenerationSpanData = SpanDataBase & {
    type: 'generation';
    input?: Array<Record<string, any>>;
    output?: Array<Record<string, any>>;
    model?: string;
    model_config?: Record<string, any>;
    /**
     * Usage fields are intentionally flexible in agents-core tracing.
     *
     * Exporters are responsible for backend-specific mapping and validation.
     * For example, the OpenAI tracing exporter in `@openai/agents-openai` keeps
     * top-level generation usage to `input_tokens` and `output_tokens` for OpenAI
     * traces ingest, and maps additional usage fields under `usage.details`.
     * Third-party exporters can choose their own usage schema and transformation
     * strategy.
     */
    usage?: GenerationUsageData;
};
type ResponseSpanData = SpanDataBase & {
    type: 'response';
    response_id?: string;
    /**
     * Not used by the OpenAI tracing provider but helpful for other tracing providers.
     */
    _input?: string | Record<string, any>[];
    _response?: Record<string, any>;
};
type SpanOptions<TData extends SpanData> = {
    traceId: string;
    spanId?: string;
    parentId?: string;
    data: TData;
    traceMetadata?: Record<string, any>;
    startedAt?: string;
    endedAt?: string;
    error?: SpanError;
    tracingApiKey?: string;
};
type HandoffSpanData = SpanDataBase & {
    type: 'handoff';
    from_agent?: string;
    to_agent?: string;
};
type CustomSpanData = SpanDataBase & {
    type: 'custom';
    name: string;
    data: Record<string, any>;
};
type GuardrailSpanData = SpanDataBase & {
    type: 'guardrail';
    name: string;
    triggered: boolean;
};
type TranscriptionSpanData = SpanDataBase & {
    type: 'transcription';
    input: {
        data: string;
        format: 'pcm' | (string & {});
    };
    output?: string;
    model?: string;
    model_config?: Record<string, any>;
};
type SpeechSpanData = SpanDataBase & {
    type: 'speech';
    input?: string;
    output: {
        data: string;
        format: 'pcm' | (string & {});
    };
    model?: string;
    model_config?: Record<string, any>;
};
type SpeechGroupSpanData = SpanDataBase & {
    type: 'speech_group';
    input?: string;
};
type MCPListToolsSpanData = SpanDataBase & {
    type: 'mcp_tools';
    server?: string;
    result?: string[];
};
type SpanData = AgentSpanData | FunctionSpanData | GenerationSpanData | ResponseSpanData | HandoffSpanData | CustomSpanData | GuardrailSpanData | TranscriptionSpanData | SpeechSpanData | SpeechGroupSpanData | MCPListToolsSpanData;
declare class Span<TData extends SpanData> {
    #private;
    type: "trace.span";
    constructor(options: SpanOptions<TData>, processor: TracingProcessor);
    get traceId(): string;
    get spanData(): TData;
    get traceMetadata(): Record<string, any> | undefined;
    get spanId(): string;
    get parentId(): string | null;
    get previousSpan(): Span<any> | undefined;
    set previousSpan(span: Span<any> | undefined);
    start(): void;
    end(): void;
    setError(error: SpanError): void;
    get error(): SpanError | null;
    get startedAt(): string | null;
    get endedAt(): string | null;
    get tracingApiKey(): string | undefined;
    clone(): Span<TData>;
    toJSON(): object | null;
}

type FinalOutputSource = 'error_handler' | 'turn_resolution';
type ActiveLocalCompactionState = {
    boundaryId: string;
    summaryItemId: string;
    baseModelContext: AgentInputItem[];
    generatedItemStartIndex: number;
};
declare const serializedSpanBase: z.ZodObject<{
    object: z.ZodLiteral<"trace.span">;
    id: z.ZodString;
    trace_id: z.ZodString;
    parent_id: z.ZodNullable<z.ZodString>;
    started_at: z.ZodNullable<z.ZodString>;
    ended_at: z.ZodNullable<z.ZodString>;
    error: z.ZodNullable<z.ZodObject<{
        message: z.ZodString;
        data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    }, z.core.$strip>>;
    span_data: z.ZodRecord<z.ZodString, z.ZodAny>;
}, z.core.$strip>;
type SerializedSpanType = z.infer<typeof serializedSpanBase> & {
    previous_span?: SerializedSpanType;
};
declare const sandboxStateSchema: z.ZodObject<{
    backendId: z.ZodString;
    currentAgentKey: z.ZodString;
    currentAgentName: z.ZodString;
    sessionState: z.ZodObject<{
        version: z.ZodLiteral<1>;
        backendId: z.ZodString;
        manifest: z.ZodRecord<z.ZodString, z.ZodAny>;
        snapshot: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
        snapshotFingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
        snapshotFingerprintVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
        workspaceReady: z.ZodBoolean;
        exposedPorts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        providerState: z.ZodRecord<z.ZodString, z.ZodAny>;
    }, z.core.$strip>;
    sessionsByAgent: z.ZodRecord<z.ZodString, z.ZodObject<{
        backendId: z.ZodString;
        currentAgentKey: z.ZodString;
        currentAgentName: z.ZodString;
        sessionState: z.ZodObject<{
            version: z.ZodLiteral<1>;
            backendId: z.ZodString;
            manifest: z.ZodRecord<z.ZodString, z.ZodAny>;
            snapshot: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
            snapshotFingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
            snapshotFingerprintVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
            workspaceReady: z.ZodBoolean;
            exposedPorts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            providerState: z.ZodRecord<z.ZodString, z.ZodAny>;
        }, z.core.$strip>;
        preservedOwnedSession: z.ZodOptional<z.ZodBoolean>;
        reuseLiveSession: z.ZodOptional<z.ZodBoolean>;
    }, z.core.$strip>>;
}, z.core.$strip>;
declare const SerializedRunState: z.ZodObject<{
    $schemaVersion: z.ZodEnum<{
        "1.0": "1.0";
        1.1: "1.1";
        1.2: "1.2";
        1.3: "1.3";
        1.4: "1.4";
        1.5: "1.5";
        1.6: "1.6";
        1.7: "1.7";
        1.8: "1.8";
        1.9: "1.9";
        "1.10": "1.10";
        1.11: "1.11";
    }>;
    currentTurn: z.ZodNumber;
    currentAgent: z.ZodObject<{
        name: z.ZodString;
        identity: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>;
    originalInput: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        id: z.ZodOptional<z.ZodString>;
        type: z.ZodOptional<z.ZodLiteral<"message">>;
        role: z.ZodLiteral<"user">;
        content: z.ZodUnion<[z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            type: z.ZodLiteral<"input_text">;
            text: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            type: z.ZodLiteral<"input_image">;
            image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
                id: z.ZodString;
            }, z.core.$strip>]>>;
            detail: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            type: z.ZodLiteral<"input_file">;
            file: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
                id: z.ZodString;
            }, z.core.$strip>]>, z.ZodObject<{
                url: z.ZodString;
            }, z.core.$strip>]>>;
            filename: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>], "type">>, z.ZodString]>;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        id: z.ZodOptional<z.ZodString>;
        type: z.ZodOptional<z.ZodLiteral<"message">>;
        role: z.ZodLiteral<"assistant">;
        status: z.ZodEnum<{
            in_progress: "in_progress";
            completed: "completed";
            incomplete: "incomplete";
        }>;
        content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            type: z.ZodLiteral<"output_text">;
            text: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            type: z.ZodLiteral<"refusal">;
            refusal: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            type: z.ZodLiteral<"image">;
            image: z.ZodString;
        }, z.core.$strip>], "type">>;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        id: z.ZodOptional<z.ZodString>;
        type: z.ZodOptional<z.ZodLiteral<"message">>;
        role: z.ZodLiteral<"system">;
        content: z.ZodString;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        id: z.ZodOptional<z.ZodString>;
        type: z.ZodLiteral<"hosted_tool_call">;
        name: z.ZodString;
        arguments: z.ZodOptional<z.ZodString>;
        status: z.ZodOptional<z.ZodString>;
        output: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        id: z.ZodOptional<z.ZodString>;
        type: z.ZodLiteral<"function_call">;
        callId: z.ZodString;
        name: z.ZodString;
        namespace: z.ZodOptional<z.ZodString>;
        status: z.ZodOptional<z.ZodEnum<{
            in_progress: "in_progress";
            completed: "completed";
            incomplete: "incomplete";
        }>>;
        arguments: z.ZodString;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        id: z.ZodOptional<z.ZodString>;
        type: z.ZodLiteral<"function_call_result">;
        name: z.ZodString;
        namespace: z.ZodOptional<z.ZodString>;
        callId: z.ZodString;
        status: z.ZodEnum<{
            in_progress: "in_progress";
            completed: "completed";
            incomplete: "incomplete";
        }>;
        output: z.ZodUnion<readonly [z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            type: z.ZodLiteral<"text">;
            text: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            type: z.ZodLiteral<"image">;
            image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
                data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
                mediaType: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>, z.ZodObject<{
                url: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                fileId: z.ZodString;
            }, z.core.$strip>]>]>>;
            detail: z.ZodOptional<z.ZodType<"low" | "high" | "auto" | (string & {}), unknown, z.core.$ZodTypeInternals<"low" | "high" | "auto" | (string & {}), unknown>>>;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            type: z.ZodLiteral<"file">;
            file: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
                data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
                mediaType: z.ZodString;
                filename: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                url: z.ZodString;
                filename: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>, z.ZodObject<{
                id: z.ZodString;
                filename: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>]>;
        }, z.core.$strip>], "type">, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            type: z.ZodLiteral<"input_text">;
            text: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            type: z.ZodLiteral<"input_image">;
            image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
                id: z.ZodString;
            }, z.core.$strip>]>>;
            detail: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            type: z.ZodLiteral<"input_file">;
            file: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
                id: z.ZodString;
            }, z.core.$strip>]>, z.ZodObject<{
                url: z.ZodString;
            }, z.core.$strip>]>>;
            filename: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>], "type">>]>;
        display: z.ZodOptional<z.ZodUnknown>;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        id: z.ZodOptional<z.ZodString>;
        type: z.ZodLiteral<"reasoning">;
        content: z.ZodArray<z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            type: z.ZodLiteral<"input_text">;
            text: z.ZodString;
        }, z.core.$strip>>;
        rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            type: z.ZodLiteral<"reasoning_text">;
            text: z.ZodString;
        }, z.core.$strip>>>;
    }, z.core.$strip>, z.ZodObject<{
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        id: z.ZodOptional<z.ZodString>;
        type: z.ZodLiteral<"unknown">;
    }, z.core.$strip>]>>]>;
    modelResponses: z.ZodArray<z.ZodObject<{
        usage: z.ZodObject<{
            requests: z.ZodNumber;
            inputTokens: z.ZodNumber;
            outputTokens: z.ZodNumber;
            totalTokens: z.ZodNumber;
            inputTokensDetails: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodNumber>>>;
            outputTokensDetails: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodNumber>>>;
            requestUsageEntries: z.ZodOptional<z.ZodArray<z.ZodObject<{
                inputTokens: z.ZodNumber;
                outputTokens: z.ZodNumber;
                totalTokens: z.ZodNumber;
                inputTokensDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
                outputTokensDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
                endpoint: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>>>;
        }, z.core.$strip>;
        output: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodOptional<z.ZodLiteral<"message">>;
            role: z.ZodLiteral<"assistant">;
            status: z.ZodEnum<{
                in_progress: "in_progress";
                completed: "completed";
                incomplete: "incomplete";
            }>;
            content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"output_text">;
                text: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"refusal">;
                refusal: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"image">;
                image: z.ZodString;
            }, z.core.$strip>], "type">>;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"function_call">;
            callId: z.ZodString;
            name: z.ZodString;
            namespace: z.ZodOptional<z.ZodString>;
            status: z.ZodOptional<z.ZodEnum<{
                in_progress: "in_progress";
                completed: "completed";
                incomplete: "incomplete";
            }>>;
            arguments: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"reasoning">;
            content: z.ZodArray<z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_text">;
                text: z.ZodString;
            }, z.core.$strip>>;
            rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"reasoning_text">;
                text: z.ZodString;
            }, z.core.$strip>>>;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"unknown">;
        }, z.core.$strip>], "type">>;
        responseId: z.ZodOptional<z.ZodString>;
        requestId: z.ZodOptional<z.ZodString>;
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    }, z.core.$strip>>;
    context: z.ZodObject<{
        usage: z.ZodObject<{
            requests: z.ZodNumber;
            inputTokens: z.ZodNumber;
            outputTokens: z.ZodNumber;
            totalTokens: z.ZodNumber;
            inputTokensDetails: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodNumber>>>;
            outputTokensDetails: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodNumber>>>;
            requestUsageEntries: z.ZodOptional<z.ZodArray<z.ZodObject<{
                inputTokens: z.ZodNumber;
                outputTokens: z.ZodNumber;
                totalTokens: z.ZodNumber;
                inputTokensDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
                outputTokensDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
                endpoint: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>>>;
        }, z.core.$strip>;
        approvals: z.ZodRecord<z.ZodString, z.ZodObject<{
            approved: z.ZodUnion<[z.ZodArray<z.ZodString>, z.ZodBoolean]>;
            rejected: z.ZodUnion<[z.ZodArray<z.ZodString>, z.ZodBoolean]>;
            messages: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
            stickyRejectMessage: z.ZodOptional<z.ZodString>;
            updatedInput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
        }, z.core.$strip>>;
        context: z.ZodRecord<z.ZodString, z.ZodAny>;
        toolInput: z.ZodOptional<z.ZodAny>;
    }, z.core.$strip>;
    toolUseTracker: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
    maxTurns: z.ZodNullable<z.ZodNumber>;
    currentAgentSpan: z.ZodOptional<z.ZodNullable<z.ZodType<SerializedSpanType, unknown, z.core.$ZodTypeInternals<SerializedSpanType, unknown>>>>;
    noActiveAgentRun: z.ZodBoolean;
    inputGuardrailResults: z.ZodArray<z.ZodObject<{
        guardrail: z.ZodObject<{
            type: z.ZodLiteral<"input">;
            name: z.ZodString;
        }, z.core.$strip>;
        output: z.ZodObject<{
            tripwireTriggered: z.ZodBoolean;
            outputInfo: z.ZodAny;
        }, z.core.$strip>;
    }, z.core.$strip>>;
    outputGuardrailResults: z.ZodArray<z.ZodObject<{
        guardrail: z.ZodObject<{
            type: z.ZodLiteral<"output">;
            name: z.ZodString;
        }, z.core.$strip>;
        agentOutput: z.ZodAny;
        agent: z.ZodObject<{
            name: z.ZodString;
            identity: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>;
        output: z.ZodObject<{
            tripwireTriggered: z.ZodBoolean;
            outputInfo: z.ZodAny;
        }, z.core.$strip>;
    }, z.core.$strip>>;
    toolInputGuardrailResults: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
        guardrail: z.ZodObject<{
            name: z.ZodString;
            type: z.ZodLiteral<"tool_input">;
        }, z.core.$strip>;
        output: z.ZodObject<{
            outputInfo: z.ZodOptional<z.ZodAny>;
            behavior: z.ZodDiscriminatedUnion<[z.ZodObject<{
                type: z.ZodLiteral<"allow">;
            }, z.core.$strip>, z.ZodObject<{
                type: z.ZodLiteral<"rejectContent">;
                message: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                type: z.ZodLiteral<"throwException">;
            }, z.core.$strip>], "type">;
        }, z.core.$strip>;
    }, z.core.$strip>>>>;
    toolOutputGuardrailResults: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
        guardrail: z.ZodObject<{
            name: z.ZodString;
            type: z.ZodLiteral<"tool_output">;
        }, z.core.$strip>;
        output: z.ZodObject<{
            outputInfo: z.ZodOptional<z.ZodAny>;
            behavior: z.ZodDiscriminatedUnion<[z.ZodObject<{
                type: z.ZodLiteral<"allow">;
            }, z.core.$strip>, z.ZodObject<{
                type: z.ZodLiteral<"rejectContent">;
                message: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                type: z.ZodLiteral<"throwException">;
            }, z.core.$strip>], "type">;
        }, z.core.$strip>;
    }, z.core.$strip>>>>;
    currentTurnInProgress: z.ZodOptional<z.ZodBoolean>;
    currentStep: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
        type: z.ZodLiteral<"next_step_handoff">;
        newAgent: z.ZodAny;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<"next_step_final_output">;
        output: z.ZodString;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<"next_step_run_again">;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<"next_step_interruption">;
        data: z.ZodRecord<z.ZodString, z.ZodAny>;
    }, z.core.$strip>], "type">>;
    lastModelResponse: z.ZodOptional<z.ZodObject<{
        usage: z.ZodObject<{
            requests: z.ZodNumber;
            inputTokens: z.ZodNumber;
            outputTokens: z.ZodNumber;
            totalTokens: z.ZodNumber;
            inputTokensDetails: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodNumber>>>;
            outputTokensDetails: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodNumber>>>;
            requestUsageEntries: z.ZodOptional<z.ZodArray<z.ZodObject<{
                inputTokens: z.ZodNumber;
                outputTokens: z.ZodNumber;
                totalTokens: z.ZodNumber;
                inputTokensDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
                outputTokensDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
                endpoint: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>>>;
        }, z.core.$strip>;
        output: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodOptional<z.ZodLiteral<"message">>;
            role: z.ZodLiteral<"assistant">;
            status: z.ZodEnum<{
                in_progress: "in_progress";
                completed: "completed";
                incomplete: "incomplete";
            }>;
            content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"output_text">;
                text: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"refusal">;
                refusal: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"image">;
                image: z.ZodString;
            }, z.core.$strip>], "type">>;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"function_call">;
            callId: z.ZodString;
            name: z.ZodString;
            namespace: z.ZodOptional<z.ZodString>;
            status: z.ZodOptional<z.ZodEnum<{
                in_progress: "in_progress";
                completed: "completed";
                incomplete: "incomplete";
            }>>;
            arguments: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"reasoning">;
            content: z.ZodArray<z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_text">;
                text: z.ZodString;
            }, z.core.$strip>>;
            rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"reasoning_text">;
                text: z.ZodString;
            }, z.core.$strip>>>;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"unknown">;
        }, z.core.$strip>], "type">>;
        responseId: z.ZodOptional<z.ZodString>;
        requestId: z.ZodOptional<z.ZodString>;
        providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
    }, z.core.$strip>>;
    generatedItems: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
        type: z.ZodLiteral<"message_output_item">;
        rawItem: z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodOptional<z.ZodLiteral<"message">>;
            role: z.ZodLiteral<"assistant">;
            status: z.ZodEnum<{
                in_progress: "in_progress";
                completed: "completed";
                incomplete: "incomplete";
            }>;
            content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"output_text">;
                text: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"refusal">;
                refusal: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"image">;
                image: z.ZodString;
            }, z.core.$strip>], "type">>;
        }, z.core.$strip>;
        agent: z.ZodObject<{
            name: z.ZodString;
            identity: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<"tool_call_item">;
        rawItem: z.ZodUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"function_call">;
            callId: z.ZodString;
            name: z.ZodString;
            namespace: z.ZodOptional<z.ZodString>;
            status: z.ZodOptional<z.ZodEnum<{
                in_progress: "in_progress";
                completed: "completed";
                incomplete: "incomplete";
            }>>;
            arguments: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"hosted_tool_call">;
            name: z.ZodString;
            arguments: z.ZodOptional<z.ZodString>;
            status: z.ZodOptional<z.ZodString>;
            output: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>], "type">, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"hosted_tool_call">;
            name: z.ZodString;
            arguments: z.ZodOptional<z.ZodString>;
            status: z.ZodOptional<z.ZodString>;
            output: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>]>;
        agent: z.ZodObject<{
            name: z.ZodString;
            identity: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<"tool_call_output_item">;
        rawItem: z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"function_call_result">;
            name: z.ZodString;
            namespace: z.ZodOptional<z.ZodString>;
            callId: z.ZodString;
            status: z.ZodEnum<{
                in_progress: "in_progress";
                completed: "completed";
                incomplete: "incomplete";
            }>;
            output: z.ZodUnion<readonly [z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"text">;
                text: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"image">;
                image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
                    data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
                    mediaType: z.ZodOptional<z.ZodString>;
                }, z.core.$strip>, z.ZodObject<{
                    url: z.ZodString;
                }, z.core.$strip>, z.ZodObject<{
                    fileId: z.ZodString;
                }, z.core.$strip>]>]>>;
                detail: z.ZodOptional<z.ZodType<"low" | "high" | "auto" | (string & {}), unknown, z.core.$ZodTypeInternals<"low" | "high" | "auto" | (string & {}), unknown>>>;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"file">;
                file: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
                    data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
                    mediaType: z.ZodString;
                    filename: z.ZodString;
                }, z.core.$strip>, z.ZodObject<{
                    url: z.ZodString;
                    filename: z.ZodOptional<z.ZodString>;
                }, z.core.$strip>, z.ZodObject<{
                    id: z.ZodString;
                    filename: z.ZodOptional<z.ZodString>;
                }, z.core.$strip>]>;
            }, z.core.$strip>], "type">, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_text">;
                text: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_image">;
                image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
                    id: z.ZodString;
                }, z.core.$strip>]>>;
                detail: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_file">;
                file: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
                    id: z.ZodString;
                }, z.core.$strip>]>, z.ZodObject<{
                    url: z.ZodString;
                }, z.core.$strip>]>>;
                filename: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>], "type">>]>;
            display: z.ZodOptional<z.ZodUnknown>;
        }, z.core.$strip>;
        agent: z.ZodObject<{
            name: z.ZodString;
            identity: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>;
        output: z.ZodString;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<"reasoning_item">;
        rawItem: z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"reasoning">;
            content: z.ZodArray<z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_text">;
                text: z.ZodString;
            }, z.core.$strip>>;
            rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"reasoning_text">;
                text: z.ZodString;
            }, z.core.$strip>>>;
        }, z.core.$strip>;
        agent: z.ZodObject<{
            name: z.ZodString;
            identity: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<"handoff_call_item">;
        rawItem: z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"function_call">;
            callId: z.ZodString;
            name: z.ZodString;
            namespace: z.ZodOptional<z.ZodString>;
            status: z.ZodOptional<z.ZodEnum<{
                in_progress: "in_progress";
                completed: "completed";
                incomplete: "incomplete";
            }>>;
            arguments: z.ZodString;
        }, z.core.$strip>;
        agent: z.ZodObject<{
            name: z.ZodString;
            identity: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<"handoff_output_item">;
        rawItem: z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"function_call_result">;
            name: z.ZodString;
            namespace: z.ZodOptional<z.ZodString>;
            callId: z.ZodString;
            status: z.ZodEnum<{
                in_progress: "in_progress";
                completed: "completed";
                incomplete: "incomplete";
            }>;
            output: z.ZodUnion<readonly [z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"text">;
                text: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"image">;
                image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
                    data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
                    mediaType: z.ZodOptional<z.ZodString>;
                }, z.core.$strip>, z.ZodObject<{
                    url: z.ZodString;
                }, z.core.$strip>, z.ZodObject<{
                    fileId: z.ZodString;
                }, z.core.$strip>]>]>>;
                detail: z.ZodOptional<z.ZodType<"low" | "high" | "auto" | (string & {}), unknown, z.core.$ZodTypeInternals<"low" | "high" | "auto" | (string & {}), unknown>>>;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"file">;
                file: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
                    data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
                    mediaType: z.ZodString;
                    filename: z.ZodString;
                }, z.core.$strip>, z.ZodObject<{
                    url: z.ZodString;
                    filename: z.ZodOptional<z.ZodString>;
                }, z.core.$strip>, z.ZodObject<{
                    id: z.ZodString;
                    filename: z.ZodOptional<z.ZodString>;
                }, z.core.$strip>]>;
            }, z.core.$strip>], "type">, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_text">;
                text: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_image">;
                image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
                    id: z.ZodString;
                }, z.core.$strip>]>>;
                detail: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_file">;
                file: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
                    id: z.ZodString;
                }, z.core.$strip>]>, z.ZodObject<{
                    url: z.ZodString;
                }, z.core.$strip>]>>;
                filename: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>], "type">>]>;
            display: z.ZodOptional<z.ZodUnknown>;
        }, z.core.$strip>;
        sourceAgent: z.ZodObject<{
            name: z.ZodString;
            identity: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>;
        targetAgent: z.ZodObject<{
            name: z.ZodString;
            identity: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<"tool_approval_item">;
        rawItem: z.ZodUnion<[z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"function_call">;
            callId: z.ZodString;
            name: z.ZodString;
            namespace: z.ZodOptional<z.ZodString>;
            status: z.ZodOptional<z.ZodEnum<{
                in_progress: "in_progress";
                completed: "completed";
                incomplete: "incomplete";
            }>>;
            arguments: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"hosted_tool_call">;
            name: z.ZodString;
            arguments: z.ZodOptional<z.ZodString>;
            status: z.ZodOptional<z.ZodString>;
            output: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>]>;
        agent: z.ZodObject<{
            name: z.ZodString;
            identity: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>;
        toolName: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<"compact_boundary_item">;
        rawItem: z.ZodObject<{
            type: z.ZodLiteral<"compact_boundary">;
            id: z.ZodString;
            summaryItemId: z.ZodString;
            compactedRange: z.ZodObject<{
                fromItemId: z.ZodString;
                toItemId: z.ZodString;
            }, z.core.$strip>;
            insertAfterItemId: z.ZodString;
            supersedesBoundaryId: z.ZodOptional<z.ZodString>;
            trigger: z.ZodEnum<{
                auto: "auto";
                manual: "manual";
                reactive: "reactive";
                session_memory: "session_memory";
            }>;
            source: z.ZodEnum<{
                session_memory: "session_memory";
                model_summary: "model_summary";
            }>;
            createdAt: z.ZodString;
            status: z.ZodLiteral<"completed">;
            preCompactTokenCount: z.ZodOptional<z.ZodNumber>;
            postCompactTokenCount: z.ZodOptional<z.ZodNumber>;
            summarizedItemCount: z.ZodOptional<z.ZodNumber>;
            preservedItemCount: z.ZodOptional<z.ZodNumber>;
            summaryTokenCount: z.ZodOptional<z.ZodNumber>;
            model: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>;
        agent: z.ZodObject<{
            name: z.ZodString;
            identity: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>;
    }, z.core.$strip>, z.ZodObject<{
        type: z.ZodLiteral<"compact_summary_item">;
        rawItem: z.ZodObject<{
            type: z.ZodLiteral<"compact_summary">;
            id: z.ZodString;
            boundaryId: z.ZodString;
            content: z.ZodString;
            source: z.ZodEnum<{
                session_memory: "session_memory";
                model_summary: "model_summary";
            }>;
            createdAt: z.ZodString;
        }, z.core.$strip>;
        agent: z.ZodObject<{
            name: z.ZodString;
            identity: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>;
    }, z.core.$strip>], "type">>;
    activeLocalCompaction: z.ZodOptional<z.ZodObject<{
        boundaryId: z.ZodString;
        summaryItemId: z.ZodString;
        baseModelContext: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodOptional<z.ZodLiteral<"message">>;
            role: z.ZodLiteral<"user">;
            content: z.ZodUnion<[z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_text">;
                text: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_image">;
                image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
                    id: z.ZodString;
                }, z.core.$strip>]>>;
                detail: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_file">;
                file: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
                    id: z.ZodString;
                }, z.core.$strip>]>, z.ZodObject<{
                    url: z.ZodString;
                }, z.core.$strip>]>>;
                filename: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>], "type">>, z.ZodString]>;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodOptional<z.ZodLiteral<"message">>;
            role: z.ZodLiteral<"assistant">;
            status: z.ZodEnum<{
                in_progress: "in_progress";
                completed: "completed";
                incomplete: "incomplete";
            }>;
            content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"output_text">;
                text: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"refusal">;
                refusal: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"image">;
                image: z.ZodString;
            }, z.core.$strip>], "type">>;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodOptional<z.ZodLiteral<"message">>;
            role: z.ZodLiteral<"system">;
            content: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"hosted_tool_call">;
            name: z.ZodString;
            arguments: z.ZodOptional<z.ZodString>;
            status: z.ZodOptional<z.ZodString>;
            output: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"function_call">;
            callId: z.ZodString;
            name: z.ZodString;
            namespace: z.ZodOptional<z.ZodString>;
            status: z.ZodOptional<z.ZodEnum<{
                in_progress: "in_progress";
                completed: "completed";
                incomplete: "incomplete";
            }>>;
            arguments: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"function_call_result">;
            name: z.ZodString;
            namespace: z.ZodOptional<z.ZodString>;
            callId: z.ZodString;
            status: z.ZodEnum<{
                in_progress: "in_progress";
                completed: "completed";
                incomplete: "incomplete";
            }>;
            output: z.ZodUnion<readonly [z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"text">;
                text: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"image">;
                image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
                    data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
                    mediaType: z.ZodOptional<z.ZodString>;
                }, z.core.$strip>, z.ZodObject<{
                    url: z.ZodString;
                }, z.core.$strip>, z.ZodObject<{
                    fileId: z.ZodString;
                }, z.core.$strip>]>]>>;
                detail: z.ZodOptional<z.ZodType<"low" | "high" | "auto" | (string & {}), unknown, z.core.$ZodTypeInternals<"low" | "high" | "auto" | (string & {}), unknown>>>;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"file">;
                file: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
                    data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
                    mediaType: z.ZodString;
                    filename: z.ZodString;
                }, z.core.$strip>, z.ZodObject<{
                    url: z.ZodString;
                    filename: z.ZodOptional<z.ZodString>;
                }, z.core.$strip>, z.ZodObject<{
                    id: z.ZodString;
                    filename: z.ZodOptional<z.ZodString>;
                }, z.core.$strip>]>;
            }, z.core.$strip>], "type">, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_text">;
                text: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_image">;
                image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
                    id: z.ZodString;
                }, z.core.$strip>]>>;
                detail: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_file">;
                file: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
                    id: z.ZodString;
                }, z.core.$strip>]>, z.ZodObject<{
                    url: z.ZodString;
                }, z.core.$strip>]>>;
                filename: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>], "type">>]>;
            display: z.ZodOptional<z.ZodUnknown>;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"reasoning">;
            content: z.ZodArray<z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"input_text">;
                text: z.ZodString;
            }, z.core.$strip>>;
            rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                type: z.ZodLiteral<"reasoning_text">;
                text: z.ZodString;
            }, z.core.$strip>>>;
        }, z.core.$strip>, z.ZodObject<{
            providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            id: z.ZodOptional<z.ZodString>;
            type: z.ZodLiteral<"unknown">;
        }, z.core.$strip>]>>;
        generatedItemStartIndex: z.ZodNumber;
    }, z.core.$strip>>;
    pendingAgentToolRuns: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
    lastProcessedResponse: z.ZodOptional<z.ZodObject<{
        newItems: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
            type: z.ZodLiteral<"message_output_item">;
            rawItem: z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                id: z.ZodOptional<z.ZodString>;
                type: z.ZodOptional<z.ZodLiteral<"message">>;
                role: z.ZodLiteral<"assistant">;
                status: z.ZodEnum<{
                    in_progress: "in_progress";
                    completed: "completed";
                    incomplete: "incomplete";
                }>;
                content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"output_text">;
                    text: z.ZodString;
                }, z.core.$strip>, z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"refusal">;
                    refusal: z.ZodString;
                }, z.core.$strip>, z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"image">;
                    image: z.ZodString;
                }, z.core.$strip>], "type">>;
            }, z.core.$strip>;
            agent: z.ZodObject<{
                name: z.ZodString;
                identity: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>;
        }, z.core.$strip>, z.ZodObject<{
            type: z.ZodLiteral<"tool_call_item">;
            rawItem: z.ZodUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                id: z.ZodOptional<z.ZodString>;
                type: z.ZodLiteral<"function_call">;
                callId: z.ZodString;
                name: z.ZodString;
                namespace: z.ZodOptional<z.ZodString>;
                status: z.ZodOptional<z.ZodEnum<{
                    in_progress: "in_progress";
                    completed: "completed";
                    incomplete: "incomplete";
                }>>;
                arguments: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                id: z.ZodOptional<z.ZodString>;
                type: z.ZodLiteral<"hosted_tool_call">;
                name: z.ZodString;
                arguments: z.ZodOptional<z.ZodString>;
                status: z.ZodOptional<z.ZodString>;
                output: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>], "type">, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                id: z.ZodOptional<z.ZodString>;
                type: z.ZodLiteral<"hosted_tool_call">;
                name: z.ZodString;
                arguments: z.ZodOptional<z.ZodString>;
                status: z.ZodOptional<z.ZodString>;
                output: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>]>;
            agent: z.ZodObject<{
                name: z.ZodString;
                identity: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>;
        }, z.core.$strip>, z.ZodObject<{
            type: z.ZodLiteral<"tool_call_output_item">;
            rawItem: z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                id: z.ZodOptional<z.ZodString>;
                type: z.ZodLiteral<"function_call_result">;
                name: z.ZodString;
                namespace: z.ZodOptional<z.ZodString>;
                callId: z.ZodString;
                status: z.ZodEnum<{
                    in_progress: "in_progress";
                    completed: "completed";
                    incomplete: "incomplete";
                }>;
                output: z.ZodUnion<readonly [z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"text">;
                    text: z.ZodString;
                }, z.core.$strip>, z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"image">;
                    image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
                        data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
                        mediaType: z.ZodOptional<z.ZodString>;
                    }, z.core.$strip>, z.ZodObject<{
                        url: z.ZodString;
                    }, z.core.$strip>, z.ZodObject<{
                        fileId: z.ZodString;
                    }, z.core.$strip>]>]>>;
                    detail: z.ZodOptional<z.ZodType<"low" | "high" | "auto" | (string & {}), unknown, z.core.$ZodTypeInternals<"low" | "high" | "auto" | (string & {}), unknown>>>;
                }, z.core.$strip>, z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"file">;
                    file: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
                        data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
                        mediaType: z.ZodString;
                        filename: z.ZodString;
                    }, z.core.$strip>, z.ZodObject<{
                        url: z.ZodString;
                        filename: z.ZodOptional<z.ZodString>;
                    }, z.core.$strip>, z.ZodObject<{
                        id: z.ZodString;
                        filename: z.ZodOptional<z.ZodString>;
                    }, z.core.$strip>]>;
                }, z.core.$strip>], "type">, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"input_text">;
                    text: z.ZodString;
                }, z.core.$strip>, z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"input_image">;
                    image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
                        id: z.ZodString;
                    }, z.core.$strip>]>>;
                    detail: z.ZodOptional<z.ZodString>;
                }, z.core.$strip>, z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"input_file">;
                    file: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
                        id: z.ZodString;
                    }, z.core.$strip>]>, z.ZodObject<{
                        url: z.ZodString;
                    }, z.core.$strip>]>>;
                    filename: z.ZodOptional<z.ZodString>;
                }, z.core.$strip>], "type">>]>;
                display: z.ZodOptional<z.ZodUnknown>;
            }, z.core.$strip>;
            agent: z.ZodObject<{
                name: z.ZodString;
                identity: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>;
            output: z.ZodString;
        }, z.core.$strip>, z.ZodObject<{
            type: z.ZodLiteral<"reasoning_item">;
            rawItem: z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                id: z.ZodOptional<z.ZodString>;
                type: z.ZodLiteral<"reasoning">;
                content: z.ZodArray<z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"input_text">;
                    text: z.ZodString;
                }, z.core.$strip>>;
                rawContent: z.ZodOptional<z.ZodArray<z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"reasoning_text">;
                    text: z.ZodString;
                }, z.core.$strip>>>;
            }, z.core.$strip>;
            agent: z.ZodObject<{
                name: z.ZodString;
                identity: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>;
        }, z.core.$strip>, z.ZodObject<{
            type: z.ZodLiteral<"handoff_call_item">;
            rawItem: z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                id: z.ZodOptional<z.ZodString>;
                type: z.ZodLiteral<"function_call">;
                callId: z.ZodString;
                name: z.ZodString;
                namespace: z.ZodOptional<z.ZodString>;
                status: z.ZodOptional<z.ZodEnum<{
                    in_progress: "in_progress";
                    completed: "completed";
                    incomplete: "incomplete";
                }>>;
                arguments: z.ZodString;
            }, z.core.$strip>;
            agent: z.ZodObject<{
                name: z.ZodString;
                identity: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>;
        }, z.core.$strip>, z.ZodObject<{
            type: z.ZodLiteral<"handoff_output_item">;
            rawItem: z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                id: z.ZodOptional<z.ZodString>;
                type: z.ZodLiteral<"function_call_result">;
                name: z.ZodString;
                namespace: z.ZodOptional<z.ZodString>;
                callId: z.ZodString;
                status: z.ZodEnum<{
                    in_progress: "in_progress";
                    completed: "completed";
                    incomplete: "incomplete";
                }>;
                output: z.ZodUnion<readonly [z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"text">;
                    text: z.ZodString;
                }, z.core.$strip>, z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"image">;
                    image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
                        data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
                        mediaType: z.ZodOptional<z.ZodString>;
                    }, z.core.$strip>, z.ZodObject<{
                        url: z.ZodString;
                    }, z.core.$strip>, z.ZodObject<{
                        fileId: z.ZodString;
                    }, z.core.$strip>]>]>>;
                    detail: z.ZodOptional<z.ZodType<"low" | "high" | "auto" | (string & {}), unknown, z.core.$ZodTypeInternals<"low" | "high" | "auto" | (string & {}), unknown>>>;
                }, z.core.$strip>, z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"file">;
                    file: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
                        data: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>;
                        mediaType: z.ZodString;
                        filename: z.ZodString;
                    }, z.core.$strip>, z.ZodObject<{
                        url: z.ZodString;
                        filename: z.ZodOptional<z.ZodString>;
                    }, z.core.$strip>, z.ZodObject<{
                        id: z.ZodString;
                        filename: z.ZodOptional<z.ZodString>;
                    }, z.core.$strip>]>;
                }, z.core.$strip>], "type">, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"input_text">;
                    text: z.ZodString;
                }, z.core.$strip>, z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"input_image">;
                    image: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
                        id: z.ZodString;
                    }, z.core.$strip>]>>;
                    detail: z.ZodOptional<z.ZodString>;
                }, z.core.$strip>, z.ZodObject<{
                    providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                    type: z.ZodLiteral<"input_file">;
                    file: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
                        id: z.ZodString;
                    }, z.core.$strip>]>, z.ZodObject<{
                        url: z.ZodString;
                    }, z.core.$strip>]>>;
                    filename: z.ZodOptional<z.ZodString>;
                }, z.core.$strip>], "type">>]>;
                display: z.ZodOptional<z.ZodUnknown>;
            }, z.core.$strip>;
            sourceAgent: z.ZodObject<{
                name: z.ZodString;
                identity: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>;
            targetAgent: z.ZodObject<{
                name: z.ZodString;
                identity: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>;
        }, z.core.$strip>, z.ZodObject<{
            type: z.ZodLiteral<"tool_approval_item">;
            rawItem: z.ZodUnion<[z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                id: z.ZodOptional<z.ZodString>;
                type: z.ZodLiteral<"function_call">;
                callId: z.ZodString;
                name: z.ZodString;
                namespace: z.ZodOptional<z.ZodString>;
                status: z.ZodOptional<z.ZodEnum<{
                    in_progress: "in_progress";
                    completed: "completed";
                    incomplete: "incomplete";
                }>>;
                arguments: z.ZodString;
            }, z.core.$strip>, z.ZodObject<{
                providerData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                id: z.ZodOptional<z.ZodString>;
                type: z.ZodLiteral<"hosted_tool_call">;
                name: z.ZodString;
                arguments: z.ZodOptional<z.ZodString>;
                status: z.ZodOptional<z.ZodString>;
                output: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>]>;
            agent: z.ZodObject<{
                name: z.ZodString;
                identity: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>;
            toolName: z.ZodOptional<z.ZodString>;
        }, z.core.$strip>, z.ZodObject<{
            type: z.ZodLiteral<"compact_boundary_item">;
            rawItem: z.ZodObject<{
                type: z.ZodLiteral<"compact_boundary">;
                id: z.ZodString;
                summaryItemId: z.ZodString;
                compactedRange: z.ZodObject<{
                    fromItemId: z.ZodString;
                    toItemId: z.ZodString;
                }, z.core.$strip>;
                insertAfterItemId: z.ZodString;
                supersedesBoundaryId: z.ZodOptional<z.ZodString>;
                trigger: z.ZodEnum<{
                    auto: "auto";
                    manual: "manual";
                    reactive: "reactive";
                    session_memory: "session_memory";
                }>;
                source: z.ZodEnum<{
                    session_memory: "session_memory";
                    model_summary: "model_summary";
                }>;
                createdAt: z.ZodString;
                status: z.ZodLiteral<"completed">;
                preCompactTokenCount: z.ZodOptional<z.ZodNumber>;
                postCompactTokenCount: z.ZodOptional<z.ZodNumber>;
                summarizedItemCount: z.ZodOptional<z.ZodNumber>;
                preservedItemCount: z.ZodOptional<z.ZodNumber>;
                summaryTokenCount: z.ZodOptional<z.ZodNumber>;
                model: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>;
            agent: z.ZodObject<{
                name: z.ZodString;
                identity: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>;
        }, z.core.$strip>, z.ZodObject<{
            type: z.ZodLiteral<"compact_summary_item">;
            rawItem: z.ZodObject<{
                type: z.ZodLiteral<"compact_summary">;
                id: z.ZodString;
                boundaryId: z.ZodString;
                content: z.ZodString;
                source: z.ZodEnum<{
                    session_memory: "session_memory";
                    model_summary: "model_summary";
                }>;
                createdAt: z.ZodString;
            }, z.core.$strip>;
            agent: z.ZodObject<{
                name: z.ZodString;
                identity: z.ZodOptional<z.ZodString>;
            }, z.core.$strip>;
        }, z.core.$strip>], "type">>;
        toolsUsed: z.ZodArray<z.ZodString>;
        handoffs: z.ZodArray<z.ZodObject<{
            toolCall: z.ZodAny;
            handoff: z.ZodAny;
        }, z.core.$strip>>;
        functions: z.ZodArray<z.ZodObject<{
            toolCall: z.ZodAny;
            tool: z.ZodAny;
        }, z.core.$strip>>;
        mcpApprovalRequests: z.ZodOptional<z.ZodArray<z.ZodObject<{
            requestItem: z.ZodObject<{
                rawItem: z.ZodObject<{
                    type: z.ZodLiteral<"hosted_tool_call">;
                    name: z.ZodString;
                    arguments: z.ZodOptional<z.ZodString>;
                    status: z.ZodOptional<z.ZodString>;
                    output: z.ZodOptional<z.ZodString>;
                    providerData: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
                }, z.core.$strip>;
            }, z.core.$strip>;
            mcpTool: z.ZodObject<{
                type: z.ZodLiteral<"hosted_tool">;
                name: z.ZodLiteral<"hosted_mcp">;
                providerData: z.ZodRecord<z.ZodString, z.ZodAny>;
            }, z.core.$strip>;
        }, z.core.$strip>>>;
    }, z.core.$strip>>;
    currentTurnPersistedItemCount: z.ZodOptional<z.ZodNumber>;
    conversationId: z.ZodOptional<z.ZodString>;
    previousResponseId: z.ZodOptional<z.ZodString>;
    reasoningItemIdPolicy: z.ZodOptional<z.ZodEnum<{
        omit: "omit";
        preserve: "preserve";
    }>>;
    trace: z.ZodNullable<z.ZodObject<{
        object: z.ZodLiteral<"trace">;
        id: z.ZodString;
        workflow_name: z.ZodString;
        group_id: z.ZodNullable<z.ZodString>;
        metadata: z.ZodRecord<z.ZodString, z.ZodAny>;
        tracing_api_key: z.ZodNullable<z.ZodOptional<z.ZodString>>;
    }, z.core.$strip>>;
    sandbox: z.ZodOptional<z.ZodObject<{
        backendId: z.ZodString;
        currentAgentKey: z.ZodString;
        currentAgentName: z.ZodString;
        sessionState: z.ZodObject<{
            version: z.ZodLiteral<1>;
            backendId: z.ZodString;
            manifest: z.ZodRecord<z.ZodString, z.ZodAny>;
            snapshot: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
            snapshotFingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
            snapshotFingerprintVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
            workspaceReady: z.ZodBoolean;
            exposedPorts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
            providerState: z.ZodRecord<z.ZodString, z.ZodAny>;
        }, z.core.$strip>;
        sessionsByAgent: z.ZodRecord<z.ZodString, z.ZodObject<{
            backendId: z.ZodString;
            currentAgentKey: z.ZodString;
            currentAgentName: z.ZodString;
            sessionState: z.ZodObject<{
                version: z.ZodLiteral<1>;
                backendId: z.ZodString;
                manifest: z.ZodRecord<z.ZodString, z.ZodAny>;
                snapshot: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
                snapshotFingerprint: z.ZodOptional<z.ZodNullable<z.ZodString>>;
                snapshotFingerprintVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
                workspaceReady: z.ZodBoolean;
                exposedPorts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
                providerState: z.ZodRecord<z.ZodString, z.ZodAny>;
            }, z.core.$strip>;
            preservedOwnedSession: z.ZodOptional<z.ZodBoolean>;
            reuseLiveSession: z.ZodOptional<z.ZodBoolean>;
        }, z.core.$strip>>;
    }, z.core.$strip>>;
}, z.core.$strip>;
/**
 * A serializable snapshot of an agent run, including context, usage, and tracing
 * information. Although this class has public writable properties (prefixed with
 * an underscore `_`), they are not meant to be used directly. To read these
 * properties, use `RunResult` instead.
 *
 * Manipulating the state directly can lead to unexpected behavior and should be
 * avoided. Interact with the state via the `approve` and `reject` methods
 * instead.
 */
declare class RunState<TContext, TAgent extends Agent<any, any>> {
    #private;
    /**
     * The current turn number in the conversation.
     */
    _currentTurn: number;
    /**
     * Whether the current turn has already been counted (useful when resuming
     * mid-turn).
     */
    _currentTurnInProgress: boolean;
    /**
     * The agent currently processing the conversation.
     */
    _currentAgent: TAgent;
    /**
     * The original user input before any processing.
     */
    _originalInput: string | AgentInputItem[];
    /**
     * The responses from the model so far.
     */
    _modelResponses: ModelResponse[];
    /**
     * The conversation identifier when the server manages conversation history.
     */
    _conversationId: string | undefined;
    /**
     * For server-managed conversations, the latest response identifier returned by
     * the server.
     */
    _previousResponseId: string | undefined;
    _reasoningItemIdPolicy: ReasoningItemIdPolicy | undefined;
    /**
     * The effective model settings used for the most recent model call.
     */
    _lastModelSettings: ModelSettings | undefined;
    /**
     * The active tracing span for the current agent, if tracing is enabled.
     */
    _currentAgentSpan: Span<AgentSpanData> | undefined;
    /**
     * The run context that tracks approvals, usage, and other metadata.
     */
    _context: RunContext<TContext>;
    /**
     * Runtime-only metadata for the current nested agent tool invocation.
     */
    _agentToolInvocation: AgentToolInvocation | undefined;
    /**
     * The aggregated usage information for this run. Includes per-request
     * breakdowns when available.
     */
    get usage(): Usage;
    /**
     * Tracks which tools each agent has used.
     */
    _toolUseTracker: AgentToolUseTracker;
    /**
     * Serialized pending nested agent runs, keyed by tool name and call ID.
     */
    _pendingAgentToolRuns: Map<string, string>;
    /**
     * The items generated by the agent during the run.
     */
    _generatedItems: RunItem[];
    /**
     * The local compaction context in effect within the current run. It only
     * affects subsequent model input; it does not trim `_generatedItems`, so the
     * full transcript/result is preserved.
     */
    _activeLocalCompaction: ActiveLocalCompactionState | undefined;
    /**
     * The number of `_generatedItems` already flushed to the session store for the
     * current turn.
     *
     * Persisting the whole turn on every save would duplicate responses and tool
     * outputs. So `saveToSession` only appends the delta since the last write.
     * This counter tracks how many generated run items *in this turn* have already
     * been written, so the next save can slice out only the new entries. When a
     * turn is interrupted (e.g. waiting for tool approval) and later resumed, we
     * rewind this counter before continuing so pending tool outputs can still be
     * stored.
     */
    _currentTurnPersistedItemCount: number;
    /**
     * The maximum number of turns allowed before forced termination.
     */
    _maxTurns: number | null;
    /**
     * Whether the run has an active agent step in progress.
     */
    _noActiveAgentRun: boolean;
    /**
     * The last model response from the previous turn.
     */
    _lastTurnResponse: ModelResponse | undefined;
    /**
     * The input guardrail results applied to this run.
     */
    _inputGuardrailResults: InputGuardrailResult[];
    /**
     * The output guardrail results applied to this run.
     */
    _outputGuardrailResults: OutputGuardrailResult<any, any>[];
    /**
     * The tool input guardrail results applied during tool execution.
     */
    _toolInputGuardrailResults: ToolInputGuardrailResult[];
    /**
     * The tool output guardrail results applied during tool execution.
     */
    _toolOutputGuardrailResults: ToolOutputGuardrailResult[];
    /**
     * The next step computed for the agent.
     */
    _currentStep: NextStep | undefined;
    /**
     * Indicates how the current run's final output was produced.
     * This value is not serialized.
     */
    _finalOutputSource: FinalOutputSource | undefined;
    /**
     * The model response resolved after applying guardrails and tools.
     */
    _lastProcessedResponse: ProcessedResponse<TContext> | undefined;
    /**
     * The trace associated with this run, if tracing is enabled.
     */
    _trace: Trace | null;
    /**
     * The persisted sandbox session metadata used to resume a sandbox agent.
     */
    _sandbox: z.infer<typeof sandboxStateSchema> | undefined;
    constructor(context: RunContext<TContext>, originalInput: string | AgentInputItem[], startingAgent: TAgent, maxTurns: number | null);
    /**
     * Update the server-managed conversation identifiers as a single atomic
     * operation.
     */
    setConversationContext(conversationId?: string, previousResponseId?: string): void;
    /**
     * Update the runtime option used to convert run items into turn input.
     */
    setReasoningItemIdPolicy(policy?: ReasoningItemIdPolicy): void;
    /**
     * Update the agent span associated with the current run.
     */
    setCurrentAgentSpan(span?: Span<AgentSpanData>): void;
    /**
     * Switch the active agent processing the run.
     */
    setCurrentAgent(agent: TAgent): void;
    /**
     * Returns the agent currently processing the run.
     */
    get currentAgent(): TAgent;
    /**
     * Reset the counter that tracks how many items of the current turn have been
     * persisted.
     */
    resetTurnPersistence(): void;
    /**
     * Rewind the persisted-item counter when a pending approval needs to rewrite
     * output.
     */
    rewindTurnPersistence(count: number): void;
    /**
     * The history of the agent run. Includes the input items and the new items
     * generated during the run.
     *
     * This can be used as the input for the next agent run.
     */
    get history(): AgentInputItem[];
    /**
     * If the current step is an interruption, returns all interruptions;
     * otherwise returns an empty array.
     */
    getInterruptions(): RunToolApprovalItem[];
    private getPendingAgentToolRunKey;
    getPendingAgentToolRun(toolName: string, callId: string): string | undefined;
    hasPendingAgentToolRun(toolName: string, callId: string): boolean;
    setPendingAgentToolRun(toolName: string, callId: string, serializedState: string): void;
    clearPendingAgentToolRun(toolName: string, callId: string): void;
    /**
     * Approve a tool call requested by the agent via an interruption and approval
     * item.
     *
     * To approve the request, use this method and then run the agent again with
     * the same state object to continue execution.
     *
     * By default, it only approves this single tool call. To allow the tool to be
     * used multiple times throughout this run, set the `alwaysApprove` option to
     * `true`.
     *
     * @param approvalItem - The tool call approval item to approve.
     * @param options - The approval options.
     * @param options.alwaysApprove - Approve this tool for all subsequent calls in this run.
     */
    approve(approvalItem: RunToolApprovalItem, options?: {
        alwaysApprove?: boolean;
        updatedInput?: unknown;
    }): void;
    /**
     * Reject a tool call requested by the agent via an interruption and approval
     * item.
     *
     * To reject the request, use this method and then run the agent again with
     * the same state object to continue execution.
     *
     * By default, it only rejects this single tool call. To reject the tool for
     * all subsequent calls in this run, set the `alwaysReject` option to `true`.
     *
     * When `message` is provided, it is used as the rejection text sent to the
     * model. Otherwise the `toolErrorFormatter` (if configured) or the SDK default
     * is used.
     *
     * @param approvalItem - The tool call approval item to reject.
     * @param options - The rejection options.
     * @param options.alwaysReject - Reject this tool for all subsequent calls in this run.
     * @param options.message - The rejection text sent to the model.
     *   If not provided, the `toolErrorFormatter` (if configured) or the SDK default is used.
     */
    reject(approvalItem: RunToolApprovalItem, options?: {
        alwaysReject?: boolean;
        message?: string;
    }): void;
    /**
     * Serialize the run state into a JSON object.
     *
     * This method serializes the run state into a JSON object that can be used to
     * resume the run later.
     *
     * @returns The serialized run state.
     */
    /**
     * Serialize the run state. By default, the tracing API key is omitted to
     * prevent secrets from being persisted accidentally. Only pass
     * `includeTracingApiKey: true` when you deliberately need to migrate a run
     * along with its tracing credentials (e.g. restoring in a standalone process
     * that lacks the original environment variables).
     */
    toJSON(options?: {
        includeTracingApiKey?: boolean;
    }): z.infer<typeof SerializedRunState>;
    /**
     * Serialize the run state into a string.
     *
     * This method serializes the run state into a string that can be used to
     * resume the run later.
     *
     * @returns The serialized run state.
     */
    toString(options?: {
        includeTracingApiKey?: boolean;
    }): string;
    /**
     * Deserialize a run state from a string.
     *
     * This method deserializes a run state from a string serialized with the
     * `toString` method.
     */
    static fromString<TContext, TAgent extends Agent<any, any>>(initialAgent: TAgent, str: string): Promise<RunState<TContext, TAgent>>;
    static fromStringWithContext<TContext, TAgent extends Agent<any, any>>(initialAgent: TAgent, str: string, context: RunContext<TContext>, options?: {
        contextStrategy?: ContextOverrideStrategy;
    }): Promise<RunState<TContext, TAgent>>;
}
type ContextOverrideStrategy = 'merge' | 'replace';

/**
 * Base class for all errors thrown by the library.
 */
declare abstract class AgentsError extends Error {
    state?: RunState<any, Agent<any, any>>;
    constructor(message: string, state?: RunState<any, Agent<any, any>>);
}
declare class ModelRetryExhaustedError extends AgentsError {
    readonly maxAttempts: number;
    constructor(maxAttempts: number);
}
declare class ModelRequestError extends AgentsError {
}
/**
 * Error thrown when a function tool invocation exceeds its timeout.
 */
declare class ToolTimeoutError extends AgentsError {
    toolName: string;
    timeoutMs: number;
    constructor({ toolName, timeoutMs, state, }: {
        toolName: string;
        timeoutMs: number;
        state?: RunState<any, Agent<any, any>>;
    });
}
/**
 * Error thrown when the maximum number of turns is exceeded.
 */
declare class MaxTurnsExceededError extends AgentsError {
}
/**
 * Error thrown when the model refuses to produce output.
 */
declare class ModelRefusalError extends AgentsError {
    /**
     * The refusal text returned by the model.
     */
    refusal: string;
    constructor(refusal: string, state?: RunState<any, Agent<any, any>>);
}

/**
 * The names of the events that can be generated by the agent.
 */
type RunItemStreamEventName = 'message_output_created' | 'handoff_requested' | 'handoff_occurred' | 'tool_search_called' | 'tool_search_output_created' | 'tool_called' | 'tool_output' | 'reasoning_item_created' | 'tool_approval_requested' | 'compact_boundary_created' | 'compact_summary_created';
/**
 * Streaming event from the LLM. These are `raw` events, i.e. they are directly passed through from
 * the LLM.
 */
declare class RunRawModelStreamEvent {
    data: ResponseStreamEvent;
    readonly source: string | undefined;
    /**
     * The type of the event.
     */
    readonly type = "raw_model_stream_event";
    /**
     * @param data The raw responses stream events from the LLM.
     */
    constructor(data: ResponseStreamEvent, source?: string | undefined);
}
/**
 * Streaming events that wrap a `RunItem`. As the agent processes the LLM response, it will generate
 * these events from new messages, tool calls, tool outputs, handoffs, etc.
 */
declare class RunItemStreamEvent {
    name: RunItemStreamEventName;
    item: RunItem;
    readonly type = "run_item_stream_event";
    /**
     * @param name The name of the event.
     * @param item The item that was created.
     */
    constructor(name: RunItemStreamEventName, item: RunItem);
}
/**
 * Event that notifies that there is a new agent running.
 */
declare class RunAgentUpdatedStreamEvent {
    agent: Agent<any, any>;
    readonly type = "agent_updated_stream_event";
    /**
     * @param agent The new agent
     */
    constructor(agent: Agent<any, any>);
}
type RunCompactionStreamEventName = 'compact_started' | 'compact_completed' | 'compact_failed';
type RunCompactionStreamEventData = {
    id: string;
    trigger: CompactTrigger;
    source?: CompactSource;
    reason?: 'threshold' | 'manual' | 'context_length_exceeded';
    thresholdTokens?: number;
    preCompactTokenCount?: number;
    postCompactTokenCount?: number;
    summarizedItemCount?: number;
    preservedItemCount?: number;
    boundaryItem?: CompactBoundaryRecord;
    summaryItem?: CompactSummaryRecord;
    error?: string;
};
declare class RunCompactionStreamEvent {
    name: RunCompactionStreamEventName;
    data: RunCompactionStreamEventData;
    readonly type = "compaction_stream_event";
    constructor(name: RunCompactionStreamEventName, data: RunCompactionStreamEventData);
}
declare class RunModelRetryStreamEvent {
    name: ModelRetryLifecycleEvent['name'];
    data: Omit<ModelRetryLifecycleEvent, 'name'>;
    readonly type = "model_retry_stream_event";
    constructor(name: ModelRetryLifecycleEvent['name'], data: Omit<ModelRetryLifecycleEvent, 'name'>);
}
/**
 * A streaming event from an agent run.
 */
type RunStreamEvent = RunRawModelStreamEvent | RunItemStreamEvent | RunAgentUpdatedStreamEvent | RunCompactionStreamEvent | RunModelRetryStreamEvent;

type EventEmitterEvents = Record<string, any[]>;
interface EventEmitter<EventTypes extends EventEmitterEvents = Record<string, any[]>> {
    on<K extends keyof EventTypes>(type: K, listener: (...args: EventTypes[K]) => void): EventEmitter<EventTypes>;
    off<K extends keyof EventTypes>(type: K, listener: (...args: EventTypes[K]) => void): EventEmitter<EventTypes>;
    emit<K extends keyof EventTypes>(type: K, ...args: EventTypes[K]): boolean;
    once<K extends keyof EventTypes>(type: K, listener: (...args: EventTypes[K]) => void): EventEmitter<EventTypes>;
}
interface ReadableStreamAsyncIterator<T> extends AsyncIterator<T, unknown, unknown> {
    [Symbol.asyncIterator](): ReadableStreamAsyncIterator<T>;
}
interface ReadableStream<R = any> {
    values(options?: {
        preventCancel?: boolean;
    }): ReadableStreamAsyncIterator<R>;
    [Symbol.asyncIterator](): ReadableStreamAsyncIterator<R>;
}

/**
 * The data returned by an Agent's run() method.
 */
interface RunResultData<TAgent extends Agent<any, any>, THandoffs extends (Agent<any, any> | Handoff<any>)[] = any[]> {
    /**
     * The original input items, i.e. the input before run() was called. If a
     * handoff input filter modified the input, this may be the modified version.
     */
    input: string | AgentInputItem[];
    /**
     * The new items generated during the Agent run. Includes new messages, tool
     * calls and their outputs, etc.
     */
    newItems: RunItem[];
    /**
     * The raw LLM responses generated by the model during the Agent run.
     */
    rawResponses: ModelResponse[];
    /**
     * The last response ID generated by the model during the Agent run.
     */
    lastResponseId: string | undefined;
    /**
     * The last Agent that ran.
     */
    lastAgent: TAgent | undefined;
    /**
     * The guardrail check results for the input messages.
     */
    inputGuardrailResults: InputGuardrailResult[];
    /**
     * The guardrail check results for the Agent's final output.
     */
    outputGuardrailResults: OutputGuardrailResult[];
    /**
     * The guardrail check results for tool inputs during the run.
     */
    toolInputGuardrailResults: ToolInputGuardrailResult[];
    /**
     * The guardrail check results for tool outputs during the run.
     */
    toolOutputGuardrailResults: ToolOutputGuardrailResult[];
    /**
     * The output of the last Agent or any handoff Agent.
     */
    finalOutput?: ResolvedAgentOutput<TAgent['outputType']> | HandoffsOutput<THandoffs>;
    /**
     * The interruptions that occurred during the Agent run.
     */
    interruptions?: RunToolApprovalItem[];
    /**
     * The state of the run.
     */
    state: RunState<any, TAgent>;
    /**
     * The public run context for this run.
     */
    runContext: RunContext<any>;
    /**
     * Metadata about the nested `Agent.asTool()` call that produced this result,
     * if applicable.
     */
    agentToolInvocation?: AgentToolInvocation;
}
declare class RunResultBase<TContext, TAgent extends Agent<TContext, any>> implements RunResultData<TAgent> {
    readonly state: RunState<TContext, TAgent>;
    constructor(state: RunState<TContext, TAgent>);
    /**
     * The history of the Agent run. Includes the input items and the new items
     * generated during the Agent run.
     *
     * Can be used as the input for the next Agent run.
     */
    get history(): AgentInputItem[];
    /**
     * The new items generated during the Agent run. Includes new messages, tool
     * calls and their outputs, etc.
     *
     * Does not include Agent-related information, only model data.
     *
     * For output that includes Agent information, use the `newItems` property.
     */
    get output(): AgentOutputItem[];
    /**
     * A copy of the original input items.
     */
    get input(): string | AgentInputItem[];
    /**
     * The public run context for this run.
     */
    get runContext(): RunContext<TContext>;
    /**
     * Metadata about the nested `Agent.asTool()` call that produced this result,
     * if applicable.
     */
    get agentToolInvocation(): AgentToolInvocation | undefined;
    /**
     * The run items generated during the Agent run. Associates model data with the
     * Agent.
     *
     * For model data that can be used as the input for the next Agent run, use the
     * `output` property.
     */
    get newItems(): RunItem[];
    /**
     * The raw LLM responses generated by the model during the Agent run.
     */
    get rawResponses(): ModelResponse[];
    /**
     * The last response ID generated by the model during the Agent run.
     */
    get lastResponseId(): string | undefined;
    /**
     * The last Agent that ran.
     */
    get lastAgent(): TAgent | undefined;
    /**
     * The Agent that should handle the next turn.
     * This is an alias for the last Agent that completed the previous turn.
     */
    get activeAgent(): TAgent | undefined;
    /**
     * The guardrail check results for the input messages.
     */
    get inputGuardrailResults(): InputGuardrailResult[];
    /**
     * The guardrail check results for the Agent's final output.
     */
    get outputGuardrailResults(): OutputGuardrailResult[];
    /**
     * The guardrail check results for tool inputs.
     */
    get toolInputGuardrailResults(): ToolInputGuardrailResult[];
    /**
     * The guardrail check results for tool outputs.
     */
    get toolOutputGuardrailResults(): ToolOutputGuardrailResult[];
    /**
     * All interruptions that occurred during the Agent run, such as those raised
     * by tool approvals.
     */
    get interruptions(): RunToolApprovalItem[];
    /**
     * The Agent's final output. If the output type is set to something other than
     * `text`, this property is parsed as JSON, or parsed using the Zod Schema you
     * provided.
     */
    get finalOutput(): ResolvedAgentOutput<TAgent['outputType']> | undefined;
}
/**
 * The result of an agent run.
 */
declare class RunResult<T, P extends Agent<T, AgentOutputType>> extends RunResultBase<T, P> {
    constructor(state: RunState<T, P>);
}
/**
 * The result of an agent run in streaming mode.
 */
declare class StreamedRunResult<TContext, TAgent extends Agent<TContext, AgentOutputType>> extends RunResultBase<TContext, TAgent> implements AsyncIterable<RunStreamEvent> {
    #private;
    /**
     * The current agent that is running
     */
    get currentAgent(): TAgent | undefined;
    /**
     * The current turn number
     */
    currentTurn: number;
    /**
     * The maximum number of turns that can be run
     */
    maxTurns: number | null | undefined;
    constructor(result?: {
        state: RunState<TContext, TAgent>;
        signal?: AbortSignal;
    });
    /**
     * @internal
     * Adds an item to the stream of output items
     */
    _addItem(item: RunStreamEvent): void;
    /**
     * @internal
     * Indicates that the stream has been completed
     */
    _done(): void;
    /**
     * @internal
     * Handles an error in the stream loop.
     */
    _raiseError(err: unknown): void;
    /**
     * Returns true if the stream has been cancelled.
     */
    get cancelled(): boolean;
    /**
     * Returns the underlying readable stream.
     * @returns A readable stream of the agent run.
     */
    toStream(): ReadableStream<RunStreamEvent>;
    /**
     * Await this promise to ensure that the stream has been completed if you are not consuming the
     * stream directly.
     */
    get completed(): Promise<void>;
    /**
     * Error thrown during the run, if any.
     */
    get error(): unknown;
    /**
     * Returns a readable stream of the final text output of the agent run.
     *
     * @returns A readable stream of the final output of the agent run.
     * @remarks Pass `{ compatibleWithNodeStreams: true }` to receive a Node.js compatible stream
     * instance.
     */
    toTextStream(): ReadableStream<string>;
    toTextStream(options?: {
        compatibleWithNodeStreams: true;
    }): Readable;
    toTextStream(options?: {
        compatibleWithNodeStreams?: false;
    }): ReadableStream<string>;
    [Symbol.asyncIterator](): AsyncIterator<RunStreamEvent>;
    /**
     * @internal
     * Sets the stream loop promise that completes when the internal stream loop finishes.
     * This is used to defer trace end until all agent work is complete.
     */
    _setStreamLoopPromise(promise: Promise<void>): void;
    /**
     * @internal
     * Returns a promise that resolves when the stream loop completes.
     * This is used by the tracing system to wait for all agent work before ending the trace.
     */
    _getStreamLoopPromise(): Promise<void> | undefined;
    /**
     * @internal
     * Returns the abort signal that should be used to cancel the streaming run.
     */
    _getAbortSignal(): AbortSignal | undefined;
    /**
     * @internal
     * Returns whether the caller-provided signal was aborted, even if stream consumption was also
     * cancelled locally.
     */
    _isExternalSignalAborted(): boolean;
}

type LocalCompactionResult = {
    didCompact: boolean;
    id?: string;
    source?: CompactSource;
    boundaryItem?: CompactBoundaryRecord;
    summaryItem?: CompactSummaryRecord;
    modelInput?: AgentInputItem[];
    runItems: (RunCompactBoundaryItem | RunCompactSummaryItem)[];
    usage: Usage;
    preCompactTokenCount?: number;
    postCompactTokenCount?: number;
    summarizedItemCount?: number;
    preservedItemCount?: number;
};

type PermissionsValue = {
    owner?: number;
    group?: number;
    other?: number;
    directory?: boolean;
};
type PermissionsInit = PermissionsValue | string | number | Permissions;
declare class Permissions {
    readonly owner: number;
    readonly group: number;
    readonly other: number;
    readonly directory: boolean;
    constructor(init?: PermissionsInit);
    static fromMode(mode: number): Permissions;
    static fromString(value: string): Permissions;
    toMode(): number;
    normalized(): Required<PermissionsValue>;
    toString(): string;
}

type SandboxUser = {
    name: string;
};
type SandboxGroup = {
    name: string;
    users?: SandboxUser[];
};
type SandboxUserInit = string | SandboxUser;
type SandboxGroupInit = {
    name: string;
    users?: SandboxUserInit[];
};
type SandboxEntryGroup = SandboxUser | SandboxGroup;

type EntryBase = {
    description?: string;
    ephemeral?: boolean;
    group?: SandboxEntryGroup;
    permissions?: PermissionsInit | PermissionsValue;
};
type Dir = EntryBase & {
    type: 'dir';
    children?: Record<string, Entry>;
};
type File = EntryBase & {
    type: 'file';
    content: string | Uint8Array;
};
type LocalFile = EntryBase & {
    type: 'local_file';
    src: string;
};
type LocalDir = EntryBase & {
    type: 'local_dir';
    src: string;
};
type GitRepo = EntryBase & {
    type: 'git_repo';
    host?: string;
    repo: string;
    ref?: string;
    subpath?: string;
};
type MountPattern = {
    type: string;
    [key: string]: unknown;
};
type InContainerMountStrategy = {
    type: 'in_container';
    pattern?: MountPattern;
};
type DockerVolumeMountStrategy = {
    type: 'docker_volume';
    driver?: string;
    driverOptions?: Record<string, string>;
};
type LocalBindMountStrategy = {
    type: 'local_bind';
};
type MountStrategy = InContainerMountStrategy | DockerVolumeMountStrategy | LocalBindMountStrategy | {
    type: string;
    [key: string]: unknown;
};
type MountProvider = 's3' | 'gcs' | 'r2' | 'azure_blob' | 'box' | 's3_files' | (string & {});
type MountBase = EntryBase & {
    source?: string;
    mountPath?: string;
    readOnly?: boolean;
    mountStrategy?: MountStrategy;
    provider?: MountProvider;
    config?: Record<string, unknown>;
    [key: string]: unknown;
};
type Mount = MountBase & {
    type: 'mount';
};
type S3Mount = MountBase & {
    type: 's3_mount';
    bucket: string;
    prefix?: string;
    region?: string;
    endpointUrl?: string;
    s3Provider?: string;
    accessKeyId?: string;
    secretAccessKey?: string;
    sessionToken?: string;
};
type GCSMount = MountBase & {
    type: 'gcs_mount';
    bucket: string;
    prefix?: string;
    region?: string;
    endpointUrl?: string;
    accessId?: string;
    secretAccessKey?: string;
    serviceAccountCredentials?: string;
    serviceAccountFile?: string;
    accessToken?: string;
};
type R2Mount = MountBase & {
    type: 'r2_mount';
    bucket: string;
    prefix?: string;
    accountId: string;
    customDomain?: string;
    accessKeyId?: string;
    secretAccessKey?: string;
};
type AzureBlobMount = MountBase & {
    type: 'azure_blob_mount';
    container: string;
    prefix?: string;
    account?: string;
    accountName?: string;
    endpoint?: string;
    endpointUrl?: string;
    identityClientId?: string;
    accountKey?: string;
};
type BoxMount = MountBase & {
    type: 'box_mount';
    path?: string;
    clientId?: string;
    clientSecret?: string;
    accessToken?: string;
    token?: string;
    boxConfigFile?: string;
    configCredentials?: string;
    boxSubType?: 'user' | 'enterprise';
    rootFolderId?: string;
    impersonate?: string;
    ownedBy?: string;
};
type S3FilesMount = MountBase & {
    type: 's3_files_mount';
    fileSystemId: string;
    subpath?: string;
    mountTargetIp?: string;
    accessPoint?: string;
    region?: string;
    extraOptions?: Record<string, string | null>;
};
type TypedMount = S3Mount | GCSMount | R2Mount | AzureBlobMount | BoxMount | S3FilesMount;
type Entry = Dir | File | LocalFile | LocalDir | GitRepo | Mount | TypedMount;

type SandboxPathGrant = {
    path: string;
    readOnly: boolean;
    description?: string;
};
type SandboxPathGrantInit = {
    path: string;
    readOnly?: boolean;
    description?: string;
};

type IterEntry = {
    logicalPath: string;
    absolutePath: string;
    entry: Entry;
    depth: number;
};
type ManifestMountTarget = IterEntry & {
    entry: Mount | TypedMount;
    mountPath: string;
};
type EnvResolver = () => string | Promise<string>;
type EnvValue = {
    value: string;
    resolve?: EnvResolver;
    ephemeral?: boolean;
    description?: string;
};
type EnvEntry = string | EnvResolver | EnvValue | Environment;
type ManifestEntries = Record<string, Entry>;
type ManifestEnvironment = Record<string, EnvEntry>;
type ManifestInit<TEntries extends ManifestEntries = ManifestEntries, TEnvironment extends ManifestEnvironment = ManifestEnvironment> = {
    version?: number;
    root?: string;
    entries?: TEntries;
    environment?: TEnvironment;
    users?: SandboxUserInit[];
    groups?: SandboxGroupInit[];
    extraPathGrants?: SandboxPathGrantInit[];
    remoteMountCommandAllowlist?: string[];
};
declare class Manifest<TEntries extends ManifestEntries = ManifestEntries, TEnvironment extends ManifestEnvironment = ManifestEnvironment> {
    readonly version: number;
    readonly root: string;
    readonly entries: TEntries;
    readonly environment: ManifestEnvironmentValues<TEnvironment>;
    readonly users: SandboxUser[];
    readonly groups: SandboxGroup[];
    readonly extraPathGrants: SandboxPathGrant[];
    readonly remoteMountCommandAllowlist: string[];
    constructor(init?: ManifestInit<TEntries, TEnvironment>);
    validatedEntries(): Record<string, Entry>;
    iterEntries(): Generator<IterEntry>;
    ephemeralEntryPaths(): Set<string>;
    /**
     * Returns mount targets in most-specific-first order for path resolution.
     */
    mountTargets(): ManifestMountTarget[];
    /**
     * Returns mount targets in parent-first order for filesystem materializers.
     */
    mountTargetsForMaterialization(): ManifestMountTarget[];
    ephemeralMountTargets(): ManifestMountTarget[];
    ephemeralPersistencePaths(): Set<string>;
    resolveEnvironment(overrides?: Record<string, string>): Promise<Record<string, string>>;
    describe(depth?: number): string;
}
type ManifestEnvironmentValues<TEnvironment extends ManifestEnvironment> = {
    [Key in keyof TEnvironment]: Environment;
};
declare class Environment {
    readonly value: string;
    readonly resolver?: EnvResolver;
    readonly ephemeral: boolean;
    readonly description?: string;
    constructor(entry: EnvEntry);
    resolve(): Promise<string>;
    init(): EnvValue;
    normalized(): EnvValue;
}
type ManifestInput<T extends ManifestEntries = ManifestEntries, P extends ManifestEnvironment = ManifestEnvironment> = Manifest<T, P> | ManifestInit<T, P>;

interface Snapshot {
    id: string;
    type: string;
    [key: string]: unknown;
}
interface SnapshotSpec {
    type: string;
    [key: string]: unknown;
}
type RemoteSnapshotSaveArgs = {
    id?: string;
    data: Uint8Array;
    metadata?: Record<string, unknown>;
};
type RemoteSnapshotLoadArgs = {
    id: string;
};
type RemoteSnapshotDeleteArgs = {
    id: string;
};
interface RemoteSnapshotStore {
    save(args: RemoteSnapshotSaveArgs): Promise<{
        id: string;
        metadata?: Record<string, unknown>;
    }>;
    load(args: RemoteSnapshotLoadArgs): Promise<{
        data: Uint8Array;
        metadata?: Record<string, unknown>;
    }>;
    delete?(args: RemoteSnapshotDeleteArgs): Promise<void>;
    exists?(args: RemoteSnapshotLoadArgs): Promise<boolean>;
}
interface RemoteSnapshotSpec extends SnapshotSpec {
    type: 'remote';
    id?: string;
    store: RemoteSnapshotStore;
    metadata?: Record<string, unknown>;
}
declare class NoopSnapshotSpec implements SnapshotSpec {
    readonly type = "noop";
    readonly [key: string]: unknown;
}
interface RemoteSnapshot extends Snapshot {
    type: 'remote';
    metadata?: Record<string, unknown>;
}

type WorkspaceArchiveData = string | ArrayBuffer | Uint8Array;
type MaterializeEntryArgs = {
    path: string;
    entry: Entry;
    runAs?: string;
};
type SandboxDirectoryEntry = {
    name: string;
    path: string;
    type: 'file' | 'dir' | 'other';
};
type ListDirectoryArgs = {
    path: string;
    runAs?: string;
};
type ReadFileArgs = {
    path: string;
    runAs?: string;
    maxBytes?: number;
};
type ReadTextFileArgs = {
    path: string;
    runAs?: string;
    offset?: number;
    limit?: number;
    maxBytes?: number;
};
type ReadTextFileResult = {
    path: string;
    content: string;
    startLine: number;
    lineCount: number;
    totalLines: number;
    totalBytes: number;
    readBytes: number;
    mtimeMs: number;
};
type GrepOutputMode = 'content' | 'files_with_matches' | 'count';
type GrepFilesArgs = {
    pattern: string;
    path?: string;
    glob?: string;
    outputMode?: GrepOutputMode;
    beforeContext?: number;
    afterContext?: number;
    context?: number;
    showLineNumbers?: boolean;
    caseInsensitive?: boolean;
    type?: string;
    headLimit?: number;
    offset?: number;
    multiline?: boolean;
    runAs?: string;
};
type GrepFilesResult = {
    mode: GrepOutputMode;
    numFiles: number;
    filenames: string[];
    content?: string;
    numLines?: number;
    numMatches?: number;
    appliedLimit?: number;
    appliedOffset?: number;
};
type GlobFilesArgs = {
    pattern: string;
    path?: string;
    limit?: number;
    runAs?: string;
};
type GlobFilesResult = {
    durationMs: number;
    numFiles: number;
    filenames: string[];
    truncated: boolean;
};
type StatFileArgs = {
    path: string;
    runAs?: string;
};
type StatFileResult = {
    path: string;
    exists: boolean;
    isFile: boolean;
    size: number;
    mtimeMs: number;
};
type WriteFileArgs = {
    path: string;
    content: string;
    runAs?: string;
};
type WriteFileResult = {
    path: string;
    type: 'create' | 'update';
    bytesWritten: number;
};
type EditFileArgs = {
    path: string;
    oldString: string;
    newString: string;
    replaceAll?: boolean;
    runAs?: string;
};
type EditFileResult = {
    path: string;
    replacements: number;
};
type ViewImageArgs = {
    path: string;
    runAs?: string;
    maxBytes?: number;
};
type WriteStdinArgs = {
    sessionId: number;
    chars?: string;
    yieldTimeMs?: number;
    maxOutputTokens?: number;
};
type WriteStdinResult = {
    response: string;
    running: boolean;
    exitCode?: number | null;
    signal?: NodeJS.Signals | null;
};
type SandboxExecResult = {
    output: string;
    stdout: string;
    stderr: string;
    wallTimeSeconds: number;
    exitCode?: number | null;
    sessionId?: number;
    originalTokenCount?: number;
    outputFilePath?: string;
    outputMetadataPath?: string;
    outputFileSizeBytes?: number;
    outputPreviewBytes?: number;
    outputTruncated?: boolean;
};
type ExecCommandArgs = {
    cmd: string;
    workdir?: string;
    shell?: string;
    login?: boolean;
    tty?: boolean;
    yieldTimeMs?: number;
    maxOutputTokens?: number;
    runAs?: string;
};
type ExecForegroundArgs = {
    cmd: string;
    workdir?: string;
    shell?: string;
    login?: boolean;
    timeoutMs?: number;
    maxOutputTokens?: number;
    outputPreviewBytes?: number;
    outputId?: string;
    runAs?: string;
};
/**
 * Declares that a certain index in args is a path argument that must be resolved
 * and constrained inside the workspace (escaping throws an error).
 * forWrite marks the path as a write target (used to decide read-only path grants).
 */
type ExecForegroundArgvPathArg = {
    index: number;
    forWrite?: boolean;
};
/**
 * Execute a single binary directly in argv form, **without a shell** (no word
 * splitting, no expansion, no metacharacters). This is the execution channel for
 * the restricted whitelist executor (run_command): security relies on the caller
 * validating command/args one by one; this method only resolves the declared path
 * arguments and constrains them inside the workspace, then spawns.
 */
type ExecForegroundArgvArgs = {
    command: string;
    args: string[];
    pathArgs?: ExecForegroundArgvPathArg[];
    workdir?: string;
    timeoutMs?: number;
    maxOutputTokens?: number;
    outputPreviewBytes?: number;
    outputId?: string;
    runAs?: string;
};
type ExposedPortEndpoint = {
    host: string;
    port: number;
    tls?: boolean;
    query?: string;
    protocol?: string;
    url?: string;
    [key: string]: unknown;
};
interface SandboxSessionState {
    manifest: Manifest;
    snapshot?: Snapshot | null;
    snapshotFingerprint?: string | null;
    snapshotFingerprintVersion?: string | null;
    workspaceReady?: boolean;
    environment?: Record<string, string>;
    exposedPorts?: Record<string, ExposedPortEndpoint>;
    [key: string]: unknown;
}
type SandboxSessionLifecycleOptions = {
    reason?: string;
    [key: string]: unknown;
};
type SandboxPreStopHook = () => Promise<void> | void;
interface SandboxSession<TState extends SandboxSessionState = SandboxSessionState> {
    state: TState;
    start?(options?: SandboxSessionLifecycleOptions): Promise<void>;
    running?(): Promise<boolean>;
    registerPreStopHook?(hook: SandboxPreStopHook): (() => void) | void;
    runPreStopHooks?(): Promise<void>;
    preStop?(options?: SandboxSessionLifecycleOptions): Promise<void>;
    stop?(options?: SandboxSessionLifecycleOptions): Promise<void>;
    shutdown?(options?: SandboxSessionLifecycleOptions): Promise<void>;
    delete?(options?: SandboxSessionLifecycleOptions): Promise<void>;
    exec?(args: ExecCommandArgs): Promise<SandboxExecResult>;
    execCommand?(args: ExecCommandArgs): Promise<string>;
    /**
     * Translate a model-facing shell command before it is written into a
     * persistent shell. Unix-local sessions map logical manifest paths to their
     * host workspace; container sessions return the command unchanged.
     */
    translateCommandInput?(command: string): string;
    execForeground?(args: ExecForegroundArgs): Promise<SandboxExecResult>;
    execForegroundArgv?(args: ExecForegroundArgvArgs): Promise<SandboxExecResult>;
    writeStdin?(args: WriteStdinArgs): Promise<string>;
    writeStdinDetailed?(args: WriteStdinArgs): Promise<WriteStdinResult>;
    terminateExecSession?(sessionId: number): Promise<void>;
    viewImage?(args: ViewImageArgs): Promise<ToolOutputImage>;
    readFile?(args: ReadFileArgs): Promise<string | Uint8Array>;
    readTextFile?(args: ReadTextFileArgs): Promise<ReadTextFileResult>;
    grepFiles?(args: GrepFilesArgs): Promise<GrepFilesResult>;
    globFiles?(args: GlobFilesArgs): Promise<GlobFilesResult>;
    statFile?(args: StatFileArgs): Promise<StatFileResult>;
    writeFile?(args: WriteFileArgs): Promise<WriteFileResult>;
    editFile?(args: EditFileArgs): Promise<EditFileResult>;
    listDir?(args: ListDirectoryArgs): Promise<SandboxDirectoryEntry[]>;
    pathExists?(path: string, runAs?: string): Promise<boolean>;
    materializeEntry?(args: MaterializeEntryArgs): Promise<void>;
    applyManifest?(manifest: Manifest, runAs?: string): Promise<void>;
    persistWorkspace?(): Promise<Uint8Array>;
    hydrateWorkspace?(data: WorkspaceArchiveData): Promise<void>;
    resolveExposedPort?(port: number): Promise<ExposedPortEndpoint>;
    supportsPty?(): boolean;
    close?(): Promise<void>;
}
type SandboxSessionLike<TState extends SandboxSessionState = SandboxSessionState> = SandboxSession<TState>;

declare class FileCompactionStore implements CompactionStore {
    #private;
    private readonly rootDir;
    constructor(rootDir?: string);
    getRecords(sessionId: string): Promise<CompactionRecord[]>;
    appendRecords(sessionId: string, records: CompactionRecord[]): Promise<void>;
}

declare abstract class EventEmitterDelegate<EventTypes extends EventEmitterEvents = Record<string, any[]>> implements EventEmitter<EventTypes> {
    protected abstract eventEmitter: EventEmitter<EventTypes>;
    on<K extends keyof EventTypes>(type: K, listener: (...args: EventTypes[K]) => void): EventEmitter<EventTypes>;
    off<K extends keyof EventTypes>(type: K, listener: (...args: EventTypes[K]) => void): EventEmitter<EventTypes>;
    emit<K extends keyof EventTypes>(type: K, ...args: EventTypes[K]): boolean;
    once<K extends keyof EventTypes>(type: K, listener: (...args: EventTypes[K]) => void): EventEmitter<EventTypes>;
}
type AgentHookEvents<TContext = UnknownContext, TOutput extends AgentOutputType = TextOutput> = {
    /**
     * @param context - The run context
     * @param agent - The agent that is starting
     * @param turnInput - The input items for the current turn
     */
    agent_start: [
        context: RunContext<TContext>,
        agent: Agent<TContext, TOutput>,
        turnInput?: AgentInputItem[]
    ];
    /**
     * Note that the second argument here is inconsistent with the run hooks.
     * Changing this argument list is a breaking change, so we won't change it in
     * the short term. If we revisit the argument data structure (e.g. migrating to
     * a single object), it will be easier to add more properties later.
     *
     * @param context - The run context
     * @param output - The agent's output
     */
    agent_end: [context: RunContext<TContext>, output: string];
    /**
     * @param context - The run context
     * @param agent - The agent performing the handoff
     * @param nextAgent - The next agent to run
     */
    agent_handoff: [context: RunContext<TContext>, nextAgent: Agent<any, any>];
    /**
     * @param context - The run context
     * @param agent - The agent starting a tool
     * @param tool - The tool that is starting
     */
    agent_tool_start: [
        context: RunContext<TContext>,
        tool: Tool<any>,
        details: {
            toolCall: ToolCallItem;
        }
    ];
    /**
     * @param context - The run context
     * @param agent - The agent ending a tool
     * @param tool - The tool that is ending
     * @param result - The result of the tool
     */
    agent_tool_end: [
        context: RunContext<TContext>,
        tool: Tool<any>,
        result: string,
        details: {
            toolCall: ToolCallItem;
        }
    ];
};
/**
 * The event emitter that every Agent instance inherits from, used to emit events
 * during the agent's lifecycle.
 */
declare class AgentHooks<TContext = UnknownContext, TOutput extends AgentOutputType = TextOutput> extends EventEmitterDelegate<AgentHookEvents<TContext, TOutput>> {
    protected eventEmitter: EventEmitter$1<AgentHookEvents<TContext, TOutput>>;
}
type RunHookEvents<T = UnknownContext, P extends AgentOutputType = TextOutput> = {
    /**
     * @param context - The context of the run
     * @param agent - The agent that is starting
     */
    agent_start: [
        context: RunContext<T>,
        agent: Agent<T, P>,
        turnInput?: AgentInputItem[]
    ];
    /**
     * @param context - The context of the run
     * @param agent - The agent that is ending
     * @param output - The output of the agent
     */
    agent_end: [context: RunContext<T>, agent: Agent<T, P>, output: string];
    /**
     * @param context - The context of the run
     * @param fromAgent - The agent that is handing off
     * @param toAgent - The next agent to run
     */
    agent_handoff: [
        context: RunContext<T>,
        fromAgent: Agent<any, any>,
        toAgent: Agent<any, any>
    ];
    /**
     * @param context - The context of the run
     * @param agent - The agent that is starting a tool
     * @param tool - The tool that is starting
     */
    agent_tool_start: [
        context: RunContext<T>,
        agent: Agent<T, P>,
        tool: Tool,
        details: {
            toolCall: ToolCallItem;
        }
    ];
    /**
     * @param context - The context of the run
     * @param agent - The agent that is ending a tool
     * @param tool - The tool that is ending
     * @param result - The result of the tool
     */
    agent_tool_end: [
        context: RunContext<T>,
        agent: Agent<T, P>,
        tool: Tool,
        result: string,
        details: {
            toolCall: ToolCallItem;
        }
    ];
};
/**
 * The event emitter that every Runner instance inherits from, used to emit
 * events throughout the run's lifecycle.
 */
declare class RunHooks<TContext = UnknownContext, TOutput extends AgentOutputType = TextOutput> extends EventEmitterDelegate<RunHookEvents<TContext, TOutput>> {
    protected eventEmitter: EventEmitter$1<RunHookEvents<TContext, TOutput>>;
}

/**
 * A function that merges the conversation history with new input items before a
 * model call.
 */
type SessionInputCallback = (historyItems: AgentInputItem[], newItems: AgentInputItem[]) => AgentInputItem[] | Promise<AgentInputItem[]>;
/**
 * The interface for a persistent session store used to store conversation
 * history.
 */
interface Session {
    /**
     * Ensure and return this session's identifier.
     */
    getSessionId(): Promise<string>;
    /**
     * Retrieve items from the conversation history.
     *
     * @param limit - The maximum number of items to return. When provided, the most recent {@link limit} records should be returned in chronological order.
     */
    getItems(limit?: number): Promise<AgentInputItem[]>;
    /**
     * Optionally rewrite stored history items before sending them back to the
     * model.
     *
     * Session implementations can use this to strip provider-managed replay
     * metadata while preserving their public `getItems()` structure for UI display
     * and deletion workflows.
     */
    prepareHistoryItemForModelInput?(item: AgentInputItem): AgentInputItem;
    /**
     * Append new items to the conversation history.
     *
     * @param items - The items to add to the session history.
     */
    addItems(items: AgentInputItem[]): Promise<void>;
    /**
     * Remove and return the most recent record from the conversation history, if
     * any.
     */
    popItem(): Promise<AgentInputItem | undefined>;
    /**
     * Clear all items belonging to this session and reset its state.
     */
    clearSession(): Promise<void>;
}

type RunErrorKind = 'maxTurns' | 'modelRefusal';
type RunErrorHandlerResult<TAgent extends Agent<any, any>> = {
    /**
     * The final output to return for the run.
     */
    finalOutput: ResolvedAgentOutput<TAgent['outputType']>;
    /**
     * Whether to append the synthesized output to history for subsequent runs.
     */
    includeInHistory?: boolean;
};
type RunErrorData<TContext, TAgent extends Agent<any, any>> = {
    input: string | AgentInputItem[];
    newItems: RunItem[];
    history: AgentInputItem[];
    output: AgentOutputItem[];
    rawResponses: ModelResponse[];
    lastAgent?: TAgent;
    state?: RunState<TContext, TAgent>;
};
type RunErrorHandlerInput<TContext, TAgent extends Agent<any, any>> = {
    error: MaxTurnsExceededError | ModelRefusalError;
    context: RunContext<TContext>;
    runData: RunErrorData<TContext, TAgent>;
};
type RunErrorHandler<TContext, TAgent extends Agent<any, any>> = (input: RunErrorHandlerInput<TContext, TAgent>) => RunErrorHandlerResult<TAgent> | void | Promise<RunErrorHandlerResult<TAgent> | void>;
type RunErrorHandlers<TContext, TAgent extends Agent<any, any>> = Partial<Record<RunErrorKind, RunErrorHandler<TContext, TAgent>>> & {
    /**
     * Fallback handler for supported error kinds.
     */
    default?: RunErrorHandler<TContext, TAgent>;
};

type SandboxClientOptions = Record<string, unknown>;
type SandboxRunConfig<TOptions extends SandboxClientOptions = SandboxClientOptions, TSessionState extends SandboxSessionState = SandboxSessionState> = {
    client?: SandboxClient<TOptions, TSessionState>;
    options?: TOptions;
    session?: SandboxSessionLike<TSessionState>;
    sessionState?: TSessionState;
    manifest?: ManifestInput;
    snapshot?: SnapshotSpec;
    concurrencyLimits?: SandboxConcurrencyLimits;
};
type SandboxConcurrencyLimits = {
    manifestEntries?: number;
    localDirFiles?: number;
};
type SandboxClientCreateArgs<TOptions extends SandboxClientOptions = SandboxClientOptions> = {
    snapshot?: SnapshotSpec;
    manifest?: ManifestInput;
    options?: TOptions;
    concurrencyLimits?: SandboxConcurrencyLimits;
};
type SandboxClientCreate<TOptions extends SandboxClientOptions = SandboxClientOptions, TSessionState extends SandboxSessionState = SandboxSessionState> = {
    (args?: SandboxClientCreateArgs<TOptions>): Promise<SandboxSessionLike<TSessionState>>;
    (manifest: Manifest, options?: TOptions): Promise<SandboxSessionLike<TSessionState>>;
};
type SandboxSessionSerializationOptions = {
    preserveOwnedSession?: boolean;
    reuseLiveSession?: boolean;
    /**
     * The runtime will close the owned session after serialization.
     */
    willCloseAfterSerialize?: boolean;
};
interface SandboxClient<TOptions extends SandboxClientOptions = SandboxClientOptions, TSessionState extends SandboxSessionState = SandboxSessionState> {
    backendId: string;
    supportsDefaultOptions?: boolean;
    create?: SandboxClientCreate<TOptions, TSessionState>;
    delete?(state: TSessionState): Promise<void>;
    serializeSessionState?(state: TSessionState, options?: SandboxSessionSerializationOptions): Promise<Record<string, unknown>>;
    canPersistOwnedSessionState?(state: TSessionState): Promise<boolean> | boolean;
    canReusePreservedOwnedSession?(state: TSessionState): Promise<boolean> | boolean;
    deserializeSessionState?(state: Record<string, unknown>): Promise<TSessionState>;
    resume?(state: TSessionState): Promise<SandboxSessionLike<TSessionState>>;
}

type TracingConfig = {
    apiKey?: string;
};

/**
 * Common run options shared between streaming and non-streaming execution pathways.
 */
type SharedRunOptions<TContext = undefined, TAgent extends Agent<any, any> = Agent<any, any>> = {
    context?: TContext | RunContext<TContext>;
    maxTurns?: number | null;
    signal?: AbortSignal;
    previousResponseId?: string;
    conversationId?: string;
    session?: Session;
    sessionInputCallback?: SessionInputCallback;
    callModelInputFilter?: CallModelInputFilter;
    toolErrorFormatter?: ToolErrorFormatter;
    reasoningItemIdPolicy?: ReasoningItemIdPolicy;
    tracing?: TracingConfig;
    sandbox?: SandboxRunConfig;
    compaction?: LocalCompactionOption;
    compact?: ManualCompactRunOption;
    /**
     * Error handlers keyed by error kind.
     */
    errorHandlers?: RunErrorHandlers<TContext, TAgent>;
};
/**
 * Options for runs that stream incremental events as the model responds.
 */
type StreamRunOptions<TContext = undefined, TAgent extends Agent<any, any> = Agent<any, any>> = SharedRunOptions<TContext, TAgent> & {
    /**
     * Whether to stream the run. If true, the run will emit events as the model responds.
     */
    stream: true;
};
/**
 * Options for runs that collect the full model response before returning.
 */
type NonStreamRunOptions<TContext = undefined, TAgent extends Agent<any, any> = Agent<any, any>> = SharedRunOptions<TContext, TAgent> & {
    /**
     * Run to completion without streaming incremental events; leave undefined or set to `false`.
     */
    stream?: false;
};
/**
 * Settings for configuring an entire Agent run.
 */
type RunConfig = {
    /**
     * The model used for the entire Agent run. If set, it overrides the model set
     * on each Agent. The modelProvider passed below must be able to resolve this
     * model name.
     */
    model?: string | Model;
    /**
     * The model provider used to look up string model names. Defaults to OpenAI.
     */
    modelProvider: ModelProvider;
    /**
     * Configures global model settings. Any non-null value overrides the
     * Agent-level model settings.
     */
    modelSettings?: ModelSettings;
    /**
     * A global input filter applied to all handoffs. If `Handoff.inputFilter` is
     * set, the latter takes precedence. Input filters let you edit the input sent
     * to the new Agent. See the `Handoff.inputFilter` documentation for details.
     */
    handoffInputFilter?: HandoffInputFilter;
    /**
     * A list of input guardrails run on the initial run input.
     */
    inputGuardrails?: InputGuardrail[];
    /**
     * A list of output guardrails run on the run's final output.
     */
    outputGuardrails?: OutputGuardrail<AgentOutputType<unknown>>[];
    /**
     * Whether to disable tracing for this Agent run. If disabled, this run is not
     * traced.
     */
    tracingDisabled: boolean;
    /**
     * Whether to include potentially sensitive data in traces (e.g. the
     * inputs/outputs of tool calls or LLM generations). If false, we still create
     * spans for these events but do not include sensitive data.
     */
    traceIncludeSensitiveData: boolean;
    /**
     * The name of the run, used for tracing. Should be a meaningful logical name,
     * e.g. "Code generation workflow" or "Customer support agent".
     */
    workflowName?: string;
    /**
     * A custom trace ID for tracing. If not provided, a new trace ID is generated
     * automatically.
     */
    traceId?: string;
    /**
     * A grouping identifier for tracing that can associate multiple traces from the
     * same conversation or flow. For example, you can use a chat thread ID.
     */
    groupId?: string;
    /**
     * An optional dictionary of additional metadata to include with the trace.
     */
    traceMetadata?: Record<string, string>;
    /**
     * The tracing configuration for this run. Can be used to override the API key
     * used when exporting traces.
     */
    tracing?: TracingConfig;
    /**
     * The sandbox runtime configuration used when execution reaches a sandbox
     * Agent.
     */
    sandbox?: SandboxRunConfig;
    compaction?: LocalCompactionOption;
    /**
     * Customizes how the session history is merged with the current turn's input.
     * If unspecified, history items are appended before the new input.
     */
    sessionInputCallback?: SessionInputCallback;
    /**
     * Called immediately before the model is called, allowing the caller to edit
     * the system instructions or input items sent to the model.
     */
    callModelInputFilter?: CallModelInputFilter;
    /**
     * Formats the tool error message returned to the model.
     * When it returns `undefined`, the SDK's default message is used.
     */
    toolErrorFormatter?: ToolErrorFormatter;
    /**
     * Controls how run items are converted into model input for subsequent turns.
     */
    reasoningItemIdPolicy?: ReasoningItemIdPolicy;
};
/**
 * Orchestrates the agent's execution, including guardrails, tool calls, session
 * persistence, and tracing. Reuse the same `Runner` instance when you want a
 * consistent configuration across multiple runs.
 */
declare class Runner extends RunHooks<any, AgentOutputType<unknown>> {
    #private;
    readonly config: RunConfig;
    private readonly traceOverrides;
    private readonly localCompactionFailures;
    private readonly sessionMemoryUpdateQueue;
    constructor(config?: Partial<RunConfig>);
    flushSessionMemoryUpdates(): Promise<void>;
    /**
     * Run a workflow starting from the given agent. The agent runs in a loop until
     * it produces a final output. The loop proceeds as follows:
     * 1. Call the agent with the given input.
     * 2. If a final output is produced (i.e. the agent generates content of type
     *    `agent.outputType`), the loop terminates.
     * 3. If a handoff occurs, re-run the loop with the new agent.
     * 4. Otherwise, execute the tool calls (if any) and re-run the loop.
     *
     * The agent may throw an exception in two cases:
     * 1. If maxTurns is exceeded, a MaxTurnsExceeded exception is thrown unless
     *    caught.
     * 2. If a guardrail tripwire is triggered, a GuardrailTripwireTriggered
     *    exception is thrown.
     *
     * Note that only the first agent's input guardrails are run.
     *
     * @param agent - The starting agent to run.
     * @param input - The initial input for the agent. Can be a string or an array of `AgentInputItem`.
     * @param options - The run options, including streaming behavior, execution context, and max turns.
     * @returns The run result.
     */
    run<T extends Agent<any, any>, C = undefined>(agent: T, input: string | AgentInputItem[] | RunState<C, T>, options?: NonStreamRunOptions<C, T>): Promise<RunResult<C, T>>;
    run<T extends Agent<any, any>, C = undefined>(agent: T, input: string | AgentInputItem[] | RunState<C, T>, options?: StreamRunOptions<C, T>): Promise<StreamedRunResult<C, T>>;
    compactSession<TAgent extends Agent<any, any>>(agent: TAgent, options: {
        session: Session;
        context?: unknown | RunContext<unknown>;
        instructions?: string;
        trigger?: CompactTrigger;
        compaction?: LocalCompactionOption;
        signal?: AbortSignal;
    }): Promise<LocalCompactionResult>;
    private readonly inputGuardrailDefs;
    private readonly outputGuardrailDefs;
}
/**
 * Run an agent workflow using the shared default `Runner` instance.
 *
 * @param agent - The entry agent to invoke.
 * @param input - A string statement, structured input items, or a `RunState` to resume a run.
 * @param options - Controls streaming mode, context, session handling, and the max turns.
 * @returns A `RunResult` when `stream` is false, otherwise a `StreamedRunResult`.
 */
declare function run<TAgent extends Agent<any, any>, TContext = undefined>(agent: TAgent, input: string | AgentInputItem[] | RunState<TContext, TAgent>, options?: NonStreamRunOptions<TContext, TAgent>): Promise<RunResult<TContext, TAgent>>;
declare function run<TAgent extends Agent<any, any>, TContext = undefined>(agent: TAgent, input: string | AgentInputItem[] | RunState<TContext, TAgent>, options?: StreamRunOptions<TContext, TAgent>): Promise<StreamedRunResult<TContext, TAgent>>;
type ToolErrorFormatterArgs<TContext = unknown, TKind extends 'approval_rejected' = 'approval_rejected'> = {
    /**
     * The category of tool error being formatted.
     */
    kind: TKind;
    /**
     * The tool runtime that produced the error.
     */
    toolType: 'function' | 'computer' | 'shell';
    /**
     * The name of the tool that produced the error.
     */
    toolName: string;
    /**
     * The unique tool call identifier.
     */
    callId: string;
    /**
     * The SDK's default message for this error kind.
     */
    defaultMessage: string;
    /**
     * The active run context for the current execution.
     */
    runContext: RunContext<TContext>;
};
type ToolErrorFormatter<TContext = unknown> = (args: ToolErrorFormatterArgs<TContext>) => Promise<string | undefined> | string | undefined;

/**
 * OpenAI providerData type definition
 */
type HostedMCPTool$1<Context = UnknownContext> = {
    type: 'mcp';
    allowed_tools?: string[] | {
        tool_names: string[];
    };
    defer_loading?: boolean;
    server_description?: string;
} & ({
    server_label: string;
    server_url?: string;
    authorization?: string;
    headers?: Record<string, string>;
} | {
    server_label: string;
    connector_id: string;
    authorization?: string;
    headers?: Record<string, string>;
}) & ({
    require_approval?: 'never';
    on_approval?: never;
} | {
    require_approval: 'always' | {
        never?: {
            tool_names: string[];
        };
        always?: {
            tool_names: string[];
        };
    };
    on_approval?: HostedMCPApprovalFunction<Context>;
});

type ToolOutputCustomData = Record<string, unknown>;
type MaybePromise<T> = T | Promise<T>;
type ToolOutputCustomDataExtractor<TContext> = (context: TContext) => MaybePromise<ToolOutputCustomData | null | undefined>;

type FunctionToolTimeoutBehavior = 'error_as_result' | 'raise_exception';
type ToolErrorResult<Output = unknown> = {
    is_error: true;
    output: Output;
    display?: unknown;
};
declare const TOOL_RESULT_BRAND: unique symbol;
type ToolDualResult<Output = unknown> = {
    [TOOL_RESULT_BRAND]: true;
    is_error?: true;
    output: Output;
    display?: unknown;
};
/**
 * Wraps a tool's return value, distinguishing two channels: `output` feeds back
 * to the model (the existing semantics), and `display` is only for UI rendering.
 *
 * `display` must be JSON-serializable (otherwise a `UserError` is thrown at the
 * call site); if the serialized form exceeds 256KB, display is dropped and a
 * warning is logged, without affecting the tool result itself.
 */
declare function toolResult<Output = unknown>(fields: {
    output: Output;
    display?: unknown;
}): ToolDualResult<Output>;
declare function toolError<Output = unknown>(output: Output, options?: {
    display?: unknown;
}): ToolErrorResult<Output> & ToolDualResult<Output>;
type ToolTimeoutErrorFunction<Context = UnknownContext> = (context: RunContext<Context>, error: ToolTimeoutError) => Promise<string> | string;
/**
 * A function that determines whether a tool call should be approved.
 *
 * @param runContext The current run context
 * @param input The tool's input parameters
 * @param callId The ID of the tool call
 * @returns true if the tool call should be approved, false otherwise
 */
type ToolApprovalFunction<T extends ToolInputParameters> = (runContext: RunContext, input: ToolExecuteArgument<T>, callId?: string) => Promise<boolean>;
/**
 * The tool's argument type.
 *
 * The argument type is inferred from the parameters schema passed in the tool
 * definition. If the parameters are passed as a JSON schema, the type is
 * `unknown`. If a Zod schema, the type matches the inferred Zod type. Otherwise,
 * the type is `string`.
 */
type ToolExecuteArgument<T extends ToolInputParameters> = T extends ZodObjectLike ? ZodInfer<T> : T extends JsonObjectSchema<any> ? unknown : string;
type FunctionToolCustomDataContext<Context = UnknownContext, TParameters extends ToolInputParameters = ToolInputParameters, Result = unknown> = {
    runContext: RunContext<Context>;
    tool: FunctionTool<Context, TParameters, Result>;
    toolCall: FunctionCallItem;
    input: unknown;
    output: unknown;
    rawItem: FunctionCallResultItem;
};
type FunctionToolCustomDataExtractor<Context = UnknownContext, TParameters extends ToolInputParameters = ToolInputParameters, Result = unknown> = ToolOutputCustomDataExtractor<FunctionToolCustomDataContext<Context, TParameters, Result>>;
type ToolCallDetails = {
    toolCall?: FunctionCallItem;
    resumeState?: string;
    signal?: AbortSignal;
    /**
     * Internal use: the parent runner config for nested agent tool runs
     * (Agent.asTool).
     */
    parentRunConfig?: Partial<RunConfig>;
};
/**
 * The tool's parameter definition.
 * Can be a Zod schema, a JSON schema, or undefined.
 * If a Zod schema is provided, the tool's input is automatically parsed and
 * validated against that schema.
 * If a JSON schema is provided, the tool's input is passed through as-is.
 * If undefined is provided, the tool's input is passed as a string.
 */
type ToolInputParameters = undefined | ZodObjectLike | JsonObjectSchema<any>;
/**
 * Exposes a function as a tool for the agent to call.
 *
 * @param Context The context of this tool
 * @param Result The result of this tool
 */
type FunctionTool<Context = UnknownContext, TParameters extends ToolInputParameters = undefined, Result = unknown> = {
    type: 'function';
    /** SDK-only custom data is persisted in Lyra's display channel, after output guardrails. */
    customDataExtractor?: FunctionToolCustomDataExtractor<Context, any, any>;
    name: string;
    description: string;
    parameters: JsonObjectSchema<any>;
    /**
     * Controls how this tool is scheduled relative to other calls from the same model turn.
     */
    execution?: FunctionToolExecutionOptions;
    /**
     * Whether the tool enables strict mode. If true, the model must follow the
     * schema as strictly as possible (which may slow down response time).
     */
    strict: boolean;
    /**
     * The function to execute when the tool is called.
     */
    invoke: (runContext: RunContext<Context>, input: string, details?: ToolCallDetails) => Promise<string | Result | ToolErrorResult>;
    /**
     * @internal
     * Parses and validates tool input without executing the tool.
     */
    parseInput?: (runContext: RunContext<Context>, input: string, details?: ToolCallDetails) => Promise<unknown>;
    /**
     * @internal
     * Formats a tool error as a model-visible error result.
     */
    handleError?: (runContext: RunContext<Context>, error: unknown, details?: ToolCallDetails) => Promise<ToolErrorResult>;
    /**
     * @internal
     * True only for literal needsApproval: true. Dynamic approval functions own their input validation.
     */
    requiresApprovalValidation?: boolean;
    /**
     * Whether this tool requires human approval before it is called. If true, the
     * run produces an `interruption` that the program must resolve by approving or
     * rejecting the tool call.
     */
    needsApproval: ToolApprovalFunction<TParameters>;
    timeoutMs?: number;
    /**
     * Defines how timeout errors are handled.
     *
     * - `error_as_result`: return a model-visible timeout message.
     * - `raise_exception`: throw a `ToolTimeoutError` and fail the run.
     */
    timeoutBehavior?: FunctionToolTimeoutBehavior;
    /**
     * An optional function to format the timeout error when timeoutBehavior is
     * `error_as_result`.
     */
    timeoutErrorFunction?: ToolTimeoutErrorFunction<Context>;
    /**
     * Determines whether this tool should be available to the model for the
     * current run.
     */
    isEnabled: ToolEnabledFunction<Context>;
    /**
     * Guardrail rules that run before tool execution.
     */
    inputGuardrails?: ToolInputGuardrailDefinition<Context>[];
    /**
     * Guardrail rules that run after tool execution.
     */
    outputGuardrails?: ToolOutputGuardrailDefinition<Context>[];
};
type FunctionToolExecutionOptions = {
    /**
     * `serial` tools with the same `concurrencyKey` run in model output order.
     * Tools without execution options continue to run in parallel.
     */
    mode: 'serial';
    concurrencyKey: string;
};
/**
 * A tool that can be called by the model.
 * @template Context The context passed to the tool
 */
type Tool<Context = unknown> = FunctionTool<Context, any, any> | HostedTool;
type FunctionToolResult<Context = UnknownContext, TParameters extends ToolInputParameters = any, Result = any> = {
    type: 'function_output';
    /**
     * The tool that was called.
     */
    tool: FunctionTool<Context, TParameters, Result>;
    /**
     * The output of the tool call. Can be a string or something stringifiable.
     */
    output: string | unknown;
    /**
     * The run item representing the tool call output.
     */
    runItem: RunToolCallOutputItem;
    /**
     * The result returned when running another agent during tool execution.
     * Populated when the call originates from {@link Agent.asTool} and the
     * nested agent completed a run.
     */
    agentRunResult?: RunResult<Context, Agent<Context, any>>;
    /**
     * All interruptions collected during the nested agent's execution. These
     * are exposed so callers can pause and resume workflows that require
     * approval.
     */
    interruptions?: RunToolApprovalItem[];
} | {
    /**
     * Indicates that this tool requires approval before it is called.
     */
    type: 'function_approval';
    /**
     * The tool that requires approval.
     */
    tool: FunctionTool<Context, TParameters, Result>;
    /**
     * The run item representing the tool call that requires approval.
     */
    runItem: RunToolApprovalItem;
} | {
    /**
     * Indicates that the tool requires approval before it can be called.
     */
    type: 'hosted_mcp_tool_approval';
    /**
     * The tool that is requiring to be approved.
     */
    tool: HostedMCPTool<Context>;
    /**
     * The item representing the tool call that is requiring approval.
     */
    runItem: RunToolApprovalItem;
};
type ToolEnabledFunction<Context = UnknownContext> = (runContext: RunContext<Context>, agent: Agent<any, any>) => Promise<boolean>;
/**
 * A built-in hosted tool that will be executed directly by the model during the request and won't result in local code executions.
 * Examples of these are `web_search_call` or `file_search_call`.
 *
 * @param Context The context of the tool
 * @param Result The result of the tool
 */
type HostedTool = {
    type: 'hosted_tool';
    /**
     * A unique name for the tool.
     */
    name: string;
    /**
     * Additional configuration data that gets passed to the tool
     */
    providerData?: Record<string, any>;
};
/**
 * A hosted MCP tool that lets the model call a remote MCP server directly
 * without a round trip back to your code.
 */
type HostedMCPTool<Context = UnknownContext> = HostedTool & {
    name: 'hosted_mcp';
    providerData: HostedMCPTool$1<Context>;
};
type HostedMCPApprovalFunction<Context = UnknownContext> = (context: RunContext<Context>, data: RunToolApprovalItem) => Promise<{
    approve: boolean;
    reason?: string;
}>;
/**
 * The parameters of a tool that has strict mode enabled.
 *
 * This can be a Zod schema, a JSON schema or undefined.
 *
 * If a Zod schema is provided, the arguments to the tool will automatically be parsed and validated
 * against the schema.
 *
 * If a JSON schema is provided, the arguments to the tool will be parsed as JSON but not validated.
 *
 * If undefined is provided, the arguments to the tool will be passed as a string.
 */
type ToolInputParametersStrict = undefined | ZodObjectLike | JsonObjectSchemaStrict<any>;
/**
 * The parameters of a tool that has strict mode disabled.
 *
 * If a JSON schema is provided, the arguments to the tool will be parsed as JSON but not validated.
 *
 * Zod schemas are not supported without strict: true.
 */
type ToolInputParametersNonStrict = undefined | JsonObjectSchemaNonStrict<any>;
type ToolGuardrailOptions<Context = UnknownContext> = {
    customDataExtractor?: FunctionToolCustomDataExtractor<Context, any, any>;
    /**
     * Guardrails that validate or block tool invocation before it runs.
     */
    inputGuardrails?: ToolInputGuardrailDefinition<Context>[] | {
        name: string;
        run: ToolInputGuardrailFunction<Context>;
    }[];
    /**
     * Guardrails that validate or alter tool output after it runs.
     */
    outputGuardrails?: ToolOutputGuardrailDefinition<Context>[] | {
        name: string;
        run: ToolOutputGuardrailFunction<Context>;
    }[];
};
/**
 * The function to invoke when the tool is called.
 *
 * @param input The arguments to the tool (see ToolExecuteArgument)
 * @param context An instance of the current RunContext
 */
type ToolExecuteFunction<TParameters extends ToolInputParameters, Context = UnknownContext> = (input: ToolExecuteArgument<TParameters>, context?: RunContext<Context>, details?: ToolCallDetails) => Promise<unknown> | unknown;
type ToolEnabledPredicate<Context = UnknownContext> = (args: {
    runContext: RunContext<Context>;
    agent: Agent<any, any>;
}) => boolean | Promise<boolean>;
type ToolEnabledOption<Context = UnknownContext> = boolean | ToolEnabledPredicate<Context>;
/**
 * The function to invoke when an error occurs while running the tool. This can be used to define
 * what the model should receive as tool output in case of an error. It can be used to provide
 * for example additional context or a fallback value.
 *
 * @param context An instance of the current RunContext
 * @param error The error that occurred
 */
type ToolErrorFunction = (context: RunContext, error: Error | unknown) => Promise<string> | string;
/**
 * The options for a tool that has strict mode enabled.
 *
 * @param TParameters The parameters of the tool
 * @param Context The context of the tool
 */
type StrictToolOptions<TParameters extends ToolInputParametersStrict, Context = UnknownContext> = ToolGuardrailOptions<Context> & {
    /**
     * The name of the tool. Must be unique within the agent.
     */
    name?: string;
    /**
     * The description of the tool. This is used to help the model understand when to use the tool.
     */
    description: string;
    /**
     * Controls how this tool is scheduled relative to other calls from the same model turn.
     */
    execution?: FunctionToolExecutionOptions;
    /**
     * A Zod schema or JSON schema describing the parameters of the tool.
     * If a Zod schema is provided, the arguments to the tool will automatically be parsed and validated
     * against the schema.
     */
    parameters: TParameters;
    /**
     * Whether the tool is strict. If true, the model must try to strictly follow the schema (might result in slower response times).
     */
    strict?: true;
    /**
     * The function to invoke when the tool is called.
     */
    execute: ToolExecuteFunction<TParameters, Context>;
    /**
     * The function to invoke when an error occurs while running the tool.
     */
    errorFunction?: ToolErrorFunction | null;
    /**
     * Whether the tool needs human approval before it can be called. If this is true, the run will result in an `interruption` that the
     * program has to resolve by approving or rejecting the tool call.
     */
    needsApproval?: boolean | ToolApprovalFunction<TParameters>;
    /**
     * Determines whether the tool should be exposed to the model for the current run.
     */
    isEnabled?: ToolEnabledOption<Context>;
    /**
     * Optional timeout in milliseconds for each tool call.
     */
    timeoutMs?: number;
    /**
     * Timeout handling mode. `error_as_result` returns a model-visible message and
     * `raise_exception` throws `ToolTimeoutError`.
     */
    timeoutBehavior?: FunctionToolTimeoutBehavior;
    /**
     * Optional formatter used for timeout messages when timeoutBehavior is `error_as_result`.
     */
    timeoutErrorFunction?: ToolTimeoutErrorFunction<Context>;
};
/**
 * The options for a tool that has strict mode disabled.
 *
 * @param TParameters The parameters of the tool
 * @param Context The context of the tool
 */
type NonStrictToolOptions<TParameters extends ToolInputParametersNonStrict, Context = UnknownContext> = ToolGuardrailOptions<Context> & {
    /**
     * The name of the tool. Must be unique within the agent.
     */
    name?: string;
    /**
     * The description of the tool. This is used to help the model understand when to use the tool.
     */
    description: string;
    /**
     * Controls how this tool is scheduled relative to other calls from the same model turn.
     */
    execution?: FunctionToolExecutionOptions;
    /**
     * A JSON schema of the tool. To use a Zod schema, you need to use a `strict` schema.
     */
    parameters: TParameters;
    /**
     * Whether the tool is strict  If true, the model must try to strictly follow the schema (might result in slower response times).
     */
    strict: false;
    /**
     * The function to invoke when the tool is called.
     */
    execute: ToolExecuteFunction<TParameters, Context>;
    /**
     * The function to invoke when an error occurs while running the tool.
     */
    errorFunction?: ToolErrorFunction | null;
    /**
     * Whether the tool needs human approval before it can be called. If this is true, the run will result in an `interruption` that the
     * program has to resolve by approving or rejecting the tool call.
     */
    needsApproval?: boolean | ToolApprovalFunction<TParameters>;
    /**
     * Determines whether the tool should be exposed to the model for the current run.
     */
    isEnabled?: ToolEnabledOption<Context>;
    /**
     * Optional timeout in milliseconds for each tool call.
     */
    timeoutMs?: number;
    /**
     * Timeout handling mode. `error_as_result` returns a model-visible message and
     * `raise_exception` throws `ToolTimeoutError`.
     */
    timeoutBehavior?: FunctionToolTimeoutBehavior;
    /**
     * Optional formatter used for timeout messages when timeoutBehavior is `error_as_result`.
     */
    timeoutErrorFunction?: ToolTimeoutErrorFunction<Context>;
};
/**
 * The options for a tool.
 *
 * @param TParameters The parameters of the tool
 * @param Context The context of the tool
 */
type ToolOptions<TParameters extends ToolInputParameters, Context = UnknownContext> = StrictToolOptions<Extract<TParameters, ToolInputParametersStrict>, Context> | NonStrictToolOptions<Extract<TParameters, ToolInputParametersNonStrict>, Context>;
/**
 * Exposes a function to the agent as a tool to be called
 *
 * @param options The options for the tool
 * @returns A new tool
 */
declare function tool<TParameters extends ToolInputParameters = undefined, Context = UnknownContext, Result = string>(options: ToolOptions<TParameters, Context>): FunctionTool<Context, TParameters, Result>;

type StructuredToolInputBuilderOptions<TParams = unknown> = {
    params: TParams;
    summary?: string;
    jsonSchema?: JsonObjectSchema<any>;
};
type StructuredToolInputBuilder<TParams = unknown> = (options: StructuredToolInputBuilderOptions<TParams>) => string | AgentInputItem[] | Promise<string | AgentInputItem[]>;
declare const AgentAsToolInputSchema: z.ZodObject<{
    input: z.ZodString;
}, z.core.$strip>;

/**
 * A logger instance with debug, error, warn, and dontLogModelData and dontLogToolData methods.
 */
type Logger = {
    /**
     * The namespace used for the debug logger.
     */
    namespace: string;
    /**
     * Log a debug message when debug logging is enabled.
     * @param message - The message to log.
     * @param args - The arguments to log.
     */
    debug: (message: string, ...args: any[]) => void;
    /**
     * Log an error message.
     * @param message - The message to log.
     * @param args - The arguments to log.
     */
    error: (message: string, ...args: any[]) => void;
    /**
     * Log a warning message.
     * @param message - The message to log.
     * @param args - The arguments to log.
     */
    warn: (message: string, ...args: any[]) => void;
    /**
     * Whether to log model data.
     */
    dontLogModelData: boolean;
    /**
     * Whether to log tool data.
     */
    dontLogToolData: boolean;
};
/**
 * Get a logger for a given package.
 *
 * @param namespace - the namespace to use for the logger.
 * @returns A logger object with `debug` and `error` methods.
 */
declare function getLogger(namespace?: string): Logger;

/** Context information available to tool filter functions. */
interface MCPToolFilterContext<TContext = UnknownContext> {
    /** The current run context. */
    runContext: RunContext<TContext>;
    /** The agent requesting the tools. */
    agent: Agent<TContext, any>;
    /** Name of the MCP server providing the tools. */
    serverName: string;
}
/** Context information available to MCP tool meta resolver functions. */
interface MCPToolMetaContext<TContext = UnknownContext> {
    /** The current run context. */
    runContext: RunContext<TContext>;
    /** Name of the MCP server. */
    serverName: string;
    /** Name of the tool being invoked. */
    toolName: string;
    /** Parsed tool arguments. */
    arguments: Record<string, unknown> | null;
}
/** A function that produces MCP request metadata (`_meta`) for tool calls. */
type MCPToolMetaResolver<TContext = UnknownContext> = (context: MCPToolMetaContext<TContext>) => Promise<Record<string, unknown> | null | undefined> | Record<string, unknown> | null | undefined;
/** Context information available to MCP tool custom data extractors. */
interface MCPToolCustomDataContext<TContext = UnknownContext> {
    /** The current run context. */
    runContext: RunContext<TContext>;
    /** Name of the MCP server. */
    serverName: string;
    /** Original name of the tool on the MCP server. */
    toolName: string;
    /** Public function-tool name exposed through the Agents SDK. */
    toolDisplayName: string;
    /** Parsed tool arguments. */
    arguments: Record<string, unknown> | null;
    /** MCP tool result `_meta`, if present. */
    resultMeta?: Record<string, unknown>;
    /** MCP tool result `structuredContent`, if present. */
    structuredContent?: Record<string, unknown>;
    /** MCP tool result `isError`, if present. */
    isError?: boolean;
    /** The model-visible output produced from the MCP tool result. */
    toolOutput: unknown;
}
/** A function that produces SDK-only custom data for MCP tool output items. */
type MCPToolCustomDataExtractor<TContext = UnknownContext> = ToolOutputCustomDataExtractor<MCPToolCustomDataContext<TContext>>;
/** A function that determines whether a tool should be available. */
type MCPToolFilterCallable<TContext = UnknownContext> = (context: MCPToolFilterContext<TContext>, tool: MCPTool) => Promise<boolean>;
/** Static tool filter configuration using allow and block lists. */
interface MCPToolFilterStatic {
    /** Optional list of tool names to allow. */
    allowedToolNames?: string[];
    /** Optional list of tool names to block. */
    blockedToolNames?: string[];
}
/** Convenience helper to create a static tool filter. */
declare function createMCPToolStaticFilter(options?: {
    allowed?: string[];
    blocked?: string[];
}): MCPToolFilterStatic | undefined;

declare const DEFAULT_STDIO_MCP_CLIENT_LOGGER_NAME = "openai-agents:stdio-mcp-client";
declare const DEFAULT_STREAMABLE_HTTP_MCP_CLIENT_LOGGER_NAME = "openai-agents:streamable-http-mcp-client";
declare const DEFAULT_SSE_MCP_CLIENT_LOGGER_NAME = "openai-agents:sse-mcp-client";
declare abstract class BaseMCPServerStdio implements MCPServer {
    cacheToolsList: boolean;
    protected _cachedTools: any[] | undefined;
    toolFilter?: MCPToolFilterCallable | MCPToolFilterStatic;
    toolMetaResolver?: MCPToolMetaResolver;
    customDataExtractor?: MCPToolCustomDataExtractor;
    toolInputGuardrails?: ToolInputGuardrailDefinition<any>[];
    toolOutputGuardrails?: ToolOutputGuardrailDefinition<any>[];
    useStructuredContent?: boolean;
    errorFunction?: MCPToolErrorFunction | null;
    protected logger: Logger;
    constructor(options: MCPServerStdioOptions);
    abstract get name(): string;
    abstract connect(): Promise<void>;
    abstract close(): Promise<void>;
    abstract listTools(): Promise<any[]>;
    abstract callTool(_toolName: string, _args: Record<string, unknown> | null, _meta?: Record<string, unknown> | null): Promise<CallToolResultContent>;
    abstract callToolResult(_toolName: string, _args: Record<string, unknown> | null, _meta?: Record<string, unknown> | null): Promise<CallToolResult>;
    abstract listResources(_params?: MCPListResourcesParams): Promise<MCPListResourcesResult>;
    abstract listResourceTemplates(_params?: MCPListResourcesParams): Promise<MCPListResourceTemplatesResult>;
    abstract readResource(_uri: string): Promise<MCPReadResourceResult>;
    abstract invalidateToolsCache(): Promise<void>;
    /**
     * Logs a debug message when debug logging is enabled.
     * @param buildMessage A function that returns the message to log.
     */
    protected debugLog(buildMessage: () => string): void;
}
declare abstract class BaseMCPServerStreamableHttp implements MCPServer {
    cacheToolsList: boolean;
    protected _cachedTools: any[] | undefined;
    toolFilter?: MCPToolFilterCallable | MCPToolFilterStatic;
    toolMetaResolver?: MCPToolMetaResolver;
    customDataExtractor?: MCPToolCustomDataExtractor;
    toolInputGuardrails?: ToolInputGuardrailDefinition<any>[];
    toolOutputGuardrails?: ToolOutputGuardrailDefinition<any>[];
    useStructuredContent?: boolean;
    errorFunction?: MCPToolErrorFunction | null;
    protected logger: Logger;
    constructor(options: MCPServerStreamableHttpOptions);
    abstract get name(): string;
    abstract connect(): Promise<void>;
    abstract close(): Promise<void>;
    abstract listTools(): Promise<any[]>;
    abstract callTool(_toolName: string, _args: Record<string, unknown> | null, _meta?: Record<string, unknown> | null): Promise<CallToolResultContent>;
    abstract callToolResult(_toolName: string, _args: Record<string, unknown> | null, _meta?: Record<string, unknown> | null): Promise<CallToolResult>;
    abstract listResources(_params?: MCPListResourcesParams): Promise<MCPListResourcesResult>;
    abstract listResourceTemplates(_params?: MCPListResourcesParams): Promise<MCPListResourceTemplatesResult>;
    abstract readResource(_uri: string): Promise<MCPReadResourceResult>;
    abstract get sessionId(): string | undefined;
    abstract invalidateToolsCache(): Promise<void>;
    /**
     * Logs a debug message when debug logging is enabled.
     * @param buildMessage A function that returns the message to log.
     */
    protected debugLog(buildMessage: () => string): void;
}
declare abstract class BaseMCPServerSSE implements MCPServer {
    cacheToolsList: boolean;
    protected _cachedTools: any[] | undefined;
    toolFilter?: MCPToolFilterCallable | MCPToolFilterStatic;
    toolMetaResolver?: MCPToolMetaResolver;
    customDataExtractor?: MCPToolCustomDataExtractor;
    toolInputGuardrails?: ToolInputGuardrailDefinition<any>[];
    toolOutputGuardrails?: ToolOutputGuardrailDefinition<any>[];
    useStructuredContent?: boolean;
    errorFunction?: MCPToolErrorFunction | null;
    protected logger: Logger;
    constructor(options: MCPServerSSEOptions);
    abstract get name(): string;
    abstract connect(): Promise<void>;
    abstract close(): Promise<void>;
    abstract listTools(): Promise<any[]>;
    abstract callTool(_toolName: string, _args: Record<string, unknown> | null, _meta?: Record<string, unknown> | null): Promise<CallToolResultContent>;
    abstract callToolResult(_toolName: string, _args: Record<string, unknown> | null, _meta?: Record<string, unknown> | null): Promise<CallToolResult>;
    abstract listResources(_params?: MCPListResourcesParams): Promise<MCPListResourcesResult>;
    abstract listResourceTemplates(_params?: MCPListResourcesParams): Promise<MCPListResourceTemplatesResult>;
    abstract readResource(_uri: string): Promise<MCPReadResourceResult>;
    abstract invalidateToolsCache(): Promise<void>;
    /**
     * Logs a debug message when debug logging is enabled.
     * @param buildMessage A function that returns the message to log.
     */
    protected debugLog(buildMessage: () => string): void;
}
/**
 * Minimum MCP tool data definition.
 * This type definition does not intend to cover all possible properties.
 * It supports the properties that are used in this SDK.
 */
declare const MCPTool: z$1.ZodObject<{
    name: z$1.ZodString;
    description: z$1.ZodOptional<z$1.ZodString>;
    inputSchema: z$1.ZodObject<{
        type: z$1.ZodLiteral<"object">;
        properties: z$1.ZodRecord<z$1.ZodString, z$1.ZodAny>;
        required: z$1.ZodArray<z$1.ZodString>;
        additionalProperties: z$1.ZodBoolean;
    }, z$1.core.$strip>;
}, z$1.core.$strip>;
type MCPTool = z$1.infer<typeof MCPTool>;
declare function attachCallToolResultMetadata(content: CallToolResult['content'], metadata: CallToolResultMetadata): CallToolResultContent;

/**
 * Remove cached tools for the given server so the next lookup fetches fresh data.
 *
 * @param serverName - Name of the MCP server whose cache should be cleared.
 */
declare function invalidateServerToolsCache(serverName: string): Promise<void>;

type MCPToolErrorFunction = (args: {
    context: RunContext;
    error: Error | unknown;
}) => Promise<string> | string;
interface MCPCallToolOptions {
    signal?: AbortSignal;
}
/**
 * Interface for MCP server implementations.
 * Provides methods for connecting, listing tools, calling tools, and cleanup.
 */
interface MCPServer {
    cacheToolsList: boolean;
    toolFilter?: MCPToolFilterCallable | MCPToolFilterStatic;
    toolMetaResolver?: MCPToolMetaResolver;
    customDataExtractor?: MCPToolCustomDataExtractor;
    /** Guardrails applied before every tool on this server is invoked. */
    toolInputGuardrails?: ToolInputGuardrailDefinition<any>[];
    /** Guardrails applied after every tool on this server returns. */
    toolOutputGuardrails?: ToolOutputGuardrailDefinition<any>[];
    /**
     * Whether to use MCP `structuredContent` as the model-visible tool output when available.
     * Defaults to false to preserve the existing content-based output behavior.
     */
    useStructuredContent?: boolean;
    /**
     * Optional function to convert MCP tool failures into model-visible messages.
     * Set to null to rethrow errors instead of converting them.
     */
    errorFunction?: MCPToolErrorFunction | null;
    connect(): Promise<void>;
    readonly name: string;
    close(): Promise<void>;
    listTools(): Promise<MCPTool[]>;
    callTool(toolName: string, args: Record<string, unknown> | null, meta?: Record<string, unknown> | null, options?: MCPCallToolOptions): Promise<CallToolResultContent>;
    /**
     * Invoke a tool and return the full serializable MCP result.
     */
    callToolResult?(toolName: string, args: Record<string, unknown> | null, meta?: Record<string, unknown> | null, options?: MCPCallToolOptions): Promise<CallToolResult>;
    invalidateToolsCache(): Promise<void>;
}
/**
 * Minimal params accepted by MCP resource-listing methods.
 */
interface MCPListResourcesParams {
    cursor?: string;
    [key: string]: unknown;
}
/**
 * Minimal MCP resource definition used by this SDK.
 */
interface MCPResource {
    uri: string;
    name?: string;
    title?: string;
    description?: string;
    mimeType?: string;
    size?: number;
    annotations?: Record<string, unknown>;
    [key: string]: unknown;
}
/**
 * Minimal MCP resource template definition used by this SDK.
 */
interface MCPResourceTemplate {
    uriTemplate: string;
    name?: string;
    title?: string;
    description?: string;
    mimeType?: string;
    annotations?: Record<string, unknown>;
    [key: string]: unknown;
}
/**
 * Text resource content returned by `readResource`.
 */
interface MCPTextResourceContent {
    uri: string;
    mimeType?: string;
    text: string;
    [key: string]: unknown;
}
/**
 * Binary resource content returned by `readResource`.
 */
interface MCPBlobResourceContent {
    uri: string;
    mimeType?: string;
    blob: string;
    [key: string]: unknown;
}
type MCPResourceContent = MCPTextResourceContent | MCPBlobResourceContent;
/**
 * Result returned by `listResources`.
 */
interface MCPListResourcesResult {
    resources: MCPResource[];
    nextCursor?: string;
    [key: string]: unknown;
}
/**
 * Result returned by `listResourceTemplates`.
 */
interface MCPListResourceTemplatesResult {
    resourceTemplates: MCPResourceTemplate[];
    nextCursor?: string;
    [key: string]: unknown;
}
/**
 * Result returned by `readResource`.
 */
interface MCPReadResourceResult {
    contents: MCPResourceContent[];
    [key: string]: unknown;
}
/**
 * Extended MCP server surface for servers that expose resources.
 */
interface MCPServerWithResources extends MCPServer {
    listResources(params?: MCPListResourcesParams): Promise<MCPListResourcesResult>;
    listResourceTemplates(params?: MCPListResourcesParams): Promise<MCPListResourceTemplatesResult>;
    readResource(uri: string): Promise<MCPReadResourceResult>;
}
/**
 * Public interface of an MCP server that provides tools.
 * You can use this class to pass MCP server settings to your agent.
 */
declare class MCPServerStdio extends BaseMCPServerStdio implements MCPServerWithResources {
    private underlying;
    private readonly toolsLifecycle;
    constructor(options: MCPServerStdioOptions);
    get name(): string;
    private invalidateToolsCaches;
    connect(): Promise<void>;
    close(): Promise<void>;
    listTools(): Promise<MCPTool[]>;
    callTool(toolName: string, args: Record<string, unknown> | null, meta?: Record<string, unknown> | null, options?: MCPCallToolOptions): Promise<CallToolResultContent>;
    callToolResult(toolName: string, args: Record<string, unknown> | null, meta?: Record<string, unknown> | null, options?: MCPCallToolOptions): Promise<CallToolResult>;
    listResources(params?: MCPListResourcesParams): Promise<MCPListResourcesResult>;
    listResourceTemplates(params?: MCPListResourcesParams): Promise<MCPListResourceTemplatesResult>;
    readResource(uri: string): Promise<MCPReadResourceResult>;
    invalidateToolsCache(): Promise<void>;
}
declare class MCPServerStreamableHttp extends BaseMCPServerStreamableHttp implements MCPServerWithResources {
    private underlying;
    private _cachedToolsSessionId;
    private readonly toolsLifecycle;
    constructor(options: MCPServerStreamableHttpOptions);
    private clearLocalToolsCache;
    private invalidateToolsCaches;
    get name(): string;
    get sessionId(): string | undefined;
    connect(): Promise<void>;
    close(): Promise<void>;
    listTools(): Promise<MCPTool[]>;
    callTool(toolName: string, args: Record<string, unknown> | null, meta?: Record<string, unknown> | null, options?: MCPCallToolOptions): Promise<CallToolResultContent>;
    callToolResult(toolName: string, args: Record<string, unknown> | null, meta?: Record<string, unknown> | null, options?: MCPCallToolOptions): Promise<CallToolResult>;
    listResources(params?: MCPListResourcesParams): Promise<MCPListResourcesResult>;
    listResourceTemplates(params?: MCPListResourcesParams): Promise<MCPListResourceTemplatesResult>;
    readResource(uri: string): Promise<MCPReadResourceResult>;
    invalidateToolsCache(): Promise<void>;
}
declare class MCPServerSSE extends BaseMCPServerSSE implements MCPServerWithResources {
    private underlying;
    private readonly toolsLifecycle;
    constructor(options: MCPServerSSEOptions);
    get name(): string;
    private invalidateToolsCaches;
    connect(): Promise<void>;
    close(): Promise<void>;
    listTools(): Promise<MCPTool[]>;
    callTool(toolName: string, args: Record<string, unknown> | null, meta?: Record<string, unknown> | null, options?: MCPCallToolOptions): Promise<CallToolResultContent>;
    callToolResult(toolName: string, args: Record<string, unknown> | null, meta?: Record<string, unknown> | null, options?: MCPCallToolOptions): Promise<CallToolResult>;
    listResources(params?: MCPListResourcesParams): Promise<MCPListResourcesResult>;
    listResourceTemplates(params?: MCPListResourcesParams): Promise<MCPListResourceTemplatesResult>;
    readResource(uri: string): Promise<MCPReadResourceResult>;
    invalidateToolsCache(): Promise<void>;
}
/**
 * Fetches and flattens all tools from multiple MCP servers.
 * Logs and skips any servers that fail to respond.
 */
/**
 * Function signature for generating the MCP tool cache key.
 * Customizable so the cache key can depend on any context—server, agent, runContext, etc.
 */
type MCPToolCacheKeyGenerator = (params: {
    server: MCPServer;
    agent?: Agent<any, any>;
    runContext?: RunContext<any>;
}) => string;
/**
 * Default cache key generator for MCP tools.
 * Uses server name, or server+agent if using callable filter.
 */
declare const defaultMCPToolCacheKey: MCPToolCacheKeyGenerator;
/**
 * Options for fetching MCP tools.
 */
type GetAllMcpToolsOptions<TContext> = {
    mcpServers: MCPServer[];
    convertSchemasToStrict?: boolean;
    runContext?: RunContext<TContext>;
    agent?: Agent<TContext, any>;
    generateMCPToolCacheKey?: MCPToolCacheKeyGenerator;
    errorFunction?: MCPToolErrorFunction | null;
    includeServerInToolNames?: boolean;
    reservedToolNames?: Set<string>;
    tracingParent?: Span<any>;
};
/**
 * Returns all MCP tools from the provided servers, using the function tool conversion.
 * If runContext and agent are provided, callable tool filters will be applied.
 */
declare function getAllMcpTools<TContext = UnknownContext>(mcpServersOrOpts: MCPServer[] | GetAllMcpToolsOptions<TContext>, runContext?: RunContext<TContext>, agent?: Agent<TContext, any>, convertSchemasToStrict?: boolean): Promise<Tool<TContext>[]>;
/**
 * Converts an MCP tool definition to a function tool for the Agents SDK.
 */
type MCPFunctionToolConversionOptions = {
    toolNameOverride?: string;
    errorFunction?: MCPToolErrorFunction | null;
};
declare function mcpToFunctionTool(mcpTool: MCPTool, server: MCPServer, convertSchemasToStrict: boolean, options?: MCPFunctionToolConversionOptions): FunctionTool<any, JsonObjectSchemaStrict<any>, string> | FunctionTool<any, JsonObjectSchemaNonStrict<any>, string>;
/**
 * Abstract base class for MCP servers that use a ClientSession for communication.
 * Handles session management, tool listing, tool calling, and cleanup.
 */
interface BaseMCPServerStdioOptions {
    env?: Record<string, string>;
    cwd?: string;
    cacheToolsList?: boolean;
    clientSessionTimeoutSeconds?: number;
    name?: string;
    encoding?: string;
    encodingErrorHandler?: 'strict' | 'ignore' | 'replace';
    logger?: Logger;
    toolFilter?: MCPToolFilterCallable | MCPToolFilterStatic;
    /**
     * Optional resolver for MCP request metadata (`_meta`) on tool calls.
     * Invoked before calling `callTool`.
     */
    toolMetaResolver?: MCPToolMetaResolver;
    /**
     * Whether to use MCP `structuredContent` as model-visible output when available.
     */
    useStructuredContent?: boolean;
    /**
     * Optional callback that attaches SDK-only custom data to local MCP tool output items.
     */
    customDataExtractor?: MCPToolCustomDataExtractor;
    /** Guardrails applied before every tool on this server is invoked. */
    toolInputGuardrails?: ToolInputGuardrailDefinition<any>[];
    /** Guardrails applied after every tool on this server returns. */
    toolOutputGuardrails?: ToolOutputGuardrailDefinition<any>[];
    /**
     * Optional function to convert MCP tool failures into model-visible messages.
     * Set to null to rethrow errors instead of converting them.
     */
    errorFunction?: MCPToolErrorFunction | null;
    timeout?: number;
}
interface DefaultMCPServerStdioOptions extends BaseMCPServerStdioOptions {
    command: string;
    args?: string[];
}
interface FullCommandMCPServerStdioOptions extends BaseMCPServerStdioOptions {
    fullCommand: string;
}
type MCPServerStdioOptions = DefaultMCPServerStdioOptions | FullCommandMCPServerStdioOptions;
interface MCPServerStreamableHttpOptions {
    url: string;
    cacheToolsList?: boolean;
    clientSessionTimeoutSeconds?: number;
    name?: string;
    logger?: Logger;
    toolFilter?: MCPToolFilterCallable | MCPToolFilterStatic;
    /**
     * Optional resolver for MCP request metadata (`_meta`) on tool calls.
     * Invoked before calling `callTool`.
     */
    toolMetaResolver?: MCPToolMetaResolver;
    /**
     * Whether to use MCP `structuredContent` as model-visible output when available.
     */
    useStructuredContent?: boolean;
    /**
     * Optional callback that attaches SDK-only custom data to local MCP tool output items.
     */
    customDataExtractor?: MCPToolCustomDataExtractor;
    /** Guardrails applied before every tool on this server is invoked. */
    toolInputGuardrails?: ToolInputGuardrailDefinition<any>[];
    /** Guardrails applied after every tool on this server returns. */
    toolOutputGuardrails?: ToolOutputGuardrailDefinition<any>[];
    /**
     * Optional function to convert MCP tool failures into model-visible messages.
     * Set to null to rethrow errors instead of converting them.
     */
    errorFunction?: MCPToolErrorFunction | null;
    timeout?: number;
    authProvider?: any;
    requestInit?: any;
    fetch?: any;
    reconnectionOptions?: any;
    sessionId?: string;
}
interface MCPServerSSEOptions {
    url: string;
    cacheToolsList?: boolean;
    clientSessionTimeoutSeconds?: number;
    name?: string;
    logger?: Logger;
    toolFilter?: MCPToolFilterCallable | MCPToolFilterStatic;
    /**
     * Optional resolver for MCP request metadata (`_meta`) on tool calls.
     * Invoked before calling `callTool`.
     */
    toolMetaResolver?: MCPToolMetaResolver;
    /**
     * Whether to use MCP `structuredContent` as model-visible output when available.
     */
    useStructuredContent?: boolean;
    /**
     * Optional callback that attaches SDK-only custom data to local MCP tool output items.
     */
    customDataExtractor?: MCPToolCustomDataExtractor;
    /** Guardrails applied before every tool on this server is invoked. */
    toolInputGuardrails?: ToolInputGuardrailDefinition<any>[];
    /** Guardrails applied after every tool on this server returns. */
    toolOutputGuardrails?: ToolOutputGuardrailDefinition<any>[];
    /**
     * Optional function to convert MCP tool failures into model-visible messages.
     * Set to null to rethrow errors instead of converting them.
     */
    errorFunction?: MCPToolErrorFunction | null;
    timeout?: number;
    authProvider?: any;
    requestInit?: any;
    fetch?: any;
    eventSourceInit?: any;
}
/**
 * Represents a JSON-RPC request message.
 */
interface JsonRpcRequest {
    jsonrpc: '2.0';
    id: number;
    method: string;
    params?: Record<string, unknown>;
}
/**
 * Represents a JSON-RPC notification message (no response expected).
 */
interface JsonRpcNotification {
    jsonrpc: '2.0';
    method: string;
    params?: Record<string, unknown>;
}
/**
 * Represents a JSON-RPC response message.
 */
interface JsonRpcResponse {
    jsonrpc: '2.0';
    id: number;
    result?: any;
    error?: any;
}
interface CallToolResponse extends JsonRpcResponse {
    result: {
        content: Array<{
            type: string;
            [key: string]: unknown;
        }>;
        _meta?: Record<string, unknown>;
        structuredContent?: Record<string, unknown>;
        isError?: boolean;
    };
}
type CallToolResult = CallToolResponse['result'];
type CallToolResultMetadata = Pick<CallToolResult, '_meta' | 'structuredContent' | 'isError'>;
type CallToolResultContent = CallToolResult['content'] & CallToolResultMetadata;
interface InitializeResponse extends JsonRpcResponse {
    result: {
        protocolVersion: string;
        capabilities: {
            tools: Record<string, unknown>;
        };
        serverInfo: {
            name: string;
            version: string;
        };
    };
}
type InitializeResult = InitializeResponse['result'];

type AgentToolStreamEvent<TAgent extends Agent<any, any>> = {
    event: RunStreamEvent;
    agent: TAgent;
    toolCall?: FunctionCallItem;
};
type AgentToolResumeContextStrategy = 'merge' | 'replace' | 'preferSerialized';
type AgentToolResumeStateOptions = {
    contextStrategy?: AgentToolResumeContextStrategy;
};
type AgentToolRunOptions<TContext, TAgent extends Agent<TContext, any>> = Omit<StreamRunOptions<TContext, TAgent>, 'stream'>;
type AgentToolInputParameters = Exclude<ToolInputParametersStrict, undefined>;
type CompletedRunResult<TContext, TAgent extends Agent<TContext, any>> = (RunResult<TContext, TAgent> | StreamedRunResult<TContext, TAgent>) & {
    finalOutput: ResolvedAgentOutput<TAgent['outputType']>;
};
type CompletedAgentToolInvocationRunResult<TContext, TAgent extends Agent<TContext, any>> = CompletedRunResult<TContext, TAgent> & {
    agentToolInvocation: AgentToolInvocation;
};
type AgentToolInputBuilder<TParameters extends AgentToolInputParameters> = StructuredToolInputBuilder<ToolExecuteArgument<TParameters>>;
type AgentToolOptions<TContext, TAgent extends Agent<TContext, any>, TParameters extends AgentToolInputParameters> = {
    /**
     * The name of the tool. If not provided, the name of the agent will be used.
     */
    toolName?: string;
    /**
     * The description of the tool, which should indicate what the tool does and when to use it.
     */
    toolDescription?: string;
    /**
     * A function that extracts the output text from the agent. If not provided, the last message
     * from the agent will be used.
     */
    customOutputExtractor?: (output: CompletedAgentToolInvocationRunResult<TContext, TAgent>) => string | Promise<string>;
    /**
     * Whether invoking this tool requires approval, matching the behavior of {@link tool} helpers.
     * When provided as a function it receives the tool arguments and can implement custom approval
     * logic.
     */
    needsApproval?: boolean | ToolApprovalFunction<TParameters>;
    /**
     * The schema used to validate tool input. Defaults to `{ input: string }`.
     */
    parameters?: TParameters;
    /**
     * Builds the nested agent input from structured tool input data.
     */
    inputBuilder?: AgentToolInputBuilder<TParameters>;
    /**
     * Include the full JSON Schema for the structured tool input when invoking the agent.
     */
    includeInputSchema?: boolean;
    /**
     * Run configuration for initializing the internal agent runner.
     */
    runConfig?: Partial<RunConfig>;
    /**
     * Additional run options for the agent (as tool) execution.
     */
    runOptions?: AgentToolRunOptions<TContext, TAgent>;
    /**
     * Controls how context is applied when resuming from serialized run state.
     */
    resumeState?: AgentToolResumeStateOptions;
    /**
     * Determines whether this tool should be exposed to the model for the current run.
     */
    isEnabled?: boolean | ((args: {
        runContext: RunContext<TContext>;
        agent: Agent<any, any>;
    }) => boolean | Promise<boolean>);
    /**
     * Optional hook to receive streamed events from the nested agent run.
     */
    onStream?: (event: AgentToolStreamEvent<TAgent>) => void | Promise<void>;
};
type AgentToolOptionsWithDefault<TContext, TAgent extends Agent<TContext, any>> = Omit<AgentToolOptions<TContext, TAgent, typeof AgentAsToolInputSchema>, 'parameters'> & {
    parameters?: undefined;
};
type AgentToolEventName = RunStreamEvent['type'] | '*';
type AgentToolEventHandler<TAgent extends Agent<any, any>> = (event: AgentToolStreamEvent<TAgent>) => void | Promise<void>;
type AgentTool<TContext, TAgent extends Agent<TContext, any>, TParameters extends AgentToolInputParameters> = FunctionTool<TContext, TParameters> & {
    on: (name: AgentToolEventName, handler: AgentToolEventHandler<TAgent>) => AgentTool<TContext, TAgent, TParameters>;
};
type AgentToolOptionsWithParameters<TContext, TAgent extends Agent<TContext, any>, TParameters extends AgentToolInputParameters> = AgentToolOptions<TContext, TAgent, TParameters> & {
    parameters: TParameters;
};
/**
 * The type of the output object. If not provided, the output will be a string.
 * 'text' is a special type indicating that the output will be a string.
 *
 * @template T The type of the handoff output.
 */
type AgentOutputType<T = UnknownContext> = TextOutput | ZodObjectLike | JsonSchemaDefinition | HandoffsOutput<T>;
/**
 * The configuration of an Agent.
 *
 * @template TContext The type of the context object.
 * @template TOutput The type of the output object.
 */
interface AgentConfiguration<TContext = UnknownContext, TOutput extends AgentOutputType = TextOutput> {
    name: string;
    /**
     * The instructions for the Agent. Used as the "system prompt" when this Agent
     * is invoked. Describes what the Agent should do and how it responds.
     *
     * Can be a string, or a function that dynamically generates the Agent's
     * instructions. If you provide a function, it is called with the run context
     * and the Agent instance. It must return a string.
     */
    instructions: string | ((runContext: RunContext<TContext>, agent: Agent<TContext, TOutput>) => Promise<string> | string);
    /**
     * The description of the Agent. Used when the Agent is a handoff target, so
     * that the LLM knows what it does and when to invoke it.
     */
    handoffDescription: string;
    /**
     * Handoffs are sub-agents the Agent can delegate to. You can provide a list of
     * handoffs, and the Agent may choose to delegate to them when relevant. This
     * helps with separation of concerns and modularity.
     */
    handoffs: (Agent<any, any> | Handoff<any, TOutput>)[];
    /**
     * Enables warning logs when handoff agents are detected to have multiple
     * output types.
     */
    handoffOutputTypeWarningEnabled?: boolean;
    /**
     * The model implementation to use when calling the LLM.
     *
     * By default, if unset, the Agent uses the default model returned by
     * getDefaultModel (currently "gpt-5.4-mini").
     */
    model: string | Model;
    /**
     * Configures model-specific tuning parameters (e.g. temperature, top_p, etc.).
     */
    modelSettings: ModelSettings;
    /**
     * The list of tools the Agent can use.
     */
    tools: Tool<TContext>[];
    /**
     * The list of [Model Context Protocol](https://modelcontextprotocol.io/)
     * servers the Agent can use. On each Agent run, it includes the tools provided
     * by these servers in the list of available tools.
     *
     * Note: you are responsible for managing the lifecycle of these servers.
     * Specifically, you must call `server.connect()` before passing a server to
     * the Agent, and call `server.close()` when the server is no longer needed.
     * Consider using `connectMcpServers` or `MCPServers` to manage
     * connecting/closing in one place.
     */
    mcpServers: MCPServer[];
    mcpConfig: {
        convertSchemasToStrict?: boolean;
        errorFunction?: MCPToolErrorFunction | null;
        includeServerInToolNames?: boolean;
    };
    /**
     * A list of checks that run in parallel with the Agent by default; set
     * `runInParallel` to false to block the LLM/tool calls until the guardrail
     * completes. Only runs when the Agent is the first Agent in the chain.
     */
    inputGuardrails: InputGuardrail[];
    /**
     * A list of checks that run on the Agent's final output after it generates a
     * response. Only runs when the Agent produces a final output.
     */
    outputGuardrails: OutputGuardrail<TOutput, TContext>[];
    /**
     * The type of the output object. If not provided, the output will be a string.
     */
    outputType: TOutput;
    /**
     * This lets you configure how tool use is handled.
     * - run_llm_again: the default behavior. After a tool runs, the LLM receives
     *   the result and responds.
     * - stop_on_first_tool: the output of the first tool call is used as the final
     *   output. This means the LLM does not process the tool call results.
     * - A list of tool names: if any tool in the list is called, the Agent stops
     *   running. The final output is the output of the first matching tool call.
     *   The LLM does not process the tool call results.
     * - A function: if you pass a function, it is called with the run context and
     *   the list of tool results. It must return a `ToolsToFinalOutputResult`,
     *   which decides whether the tool calls produce a final output.
     *
     * Note: this configuration is specific to `FunctionTools`. Hosted tools, such
     * as file search, web search, etc., are always handled by the LLM.
     */
    toolUseBehavior: ToolUseBehavior;
    /**
     * Whether to reset tool choice to the default after a tool is called. Defaults
     * to `true`. This ensures the Agent does not get stuck in an infinite loop of
     * tool use.
     */
    resetToolChoice: boolean;
}
type AgentOptions<TContext = UnknownContext, TOutput extends AgentOutputType = TextOutput> = Expand<Pick<AgentConfiguration<TContext, TOutput>, 'name'> & Partial<AgentConfiguration<TContext, TOutput>>>;
/**
 * An agent is an AI model configured with instructions, tools, guardrails, handoffs and more.
 *
 * We strongly recommend passing `instructions`, which is the "system prompt" for the agent. In
 * addition, you can pass `handoffDescription`, which is a human-readable description of the
 * agent, used when the agent is used inside tools/handoffs.
 *
 * Agents are generic on the context type. The context is a (mutable) object you create. It is
 * passed to tool functions, handoffs, guardrails, etc.
 */
type ExtractAgentOutput<T> = T extends Agent<any, infer O> ? O : never;
type ExtractHandoffOutput<T> = T extends Handoff<any, infer O> ? O : never;
type HandoffsOutputUnion<Handoffs extends readonly (Agent<any, any> | Handoff<any, any>)[]> = ExtractAgentOutput<Handoffs[number]> | ExtractHandoffOutput<Handoffs[number]>;
/**
 * Helper type for config with handoffs
 *
 * @template TOutput The type of the output object.
 * @template Handoffs The type of the handoffs.
 */
type AgentConfigWithHandoffs<TOutput extends AgentOutputType, Handoffs extends readonly (Agent<any, any> | Handoff<any, any>)[]> = {
    name: string;
    handoffs?: Handoffs;
    outputType?: TOutput;
} & Partial<Omit<AgentConfiguration<UnknownContext, TOutput | HandoffsOutputUnion<Handoffs>>, 'name' | 'handoffs' | 'outputType'>>;
/**
 * A class representing an AI Agent, configurable with instructions, tools,
 * guardrails, handoffs, and more.
 *
 * We strongly recommend passing `instructions`, which is the agent's "system
 * prompt". In addition, you can pass `handoffDescription`, a human-readable
 * description of the agent, used when the agent is used inside tools/handoffs.
 *
 * Agents are generic on the context type. The context is a (mutable) object you
 * create. It is passed to tool functions, handoffs, guardrails, etc.
 */
declare class Agent<TContext = UnknownContext, TOutput extends AgentOutputType = TextOutput> extends AgentHooks<TContext, TOutput> implements AgentConfiguration<TContext, TOutput> {
    /**
     * Create an Agent with handoffs, automatically inferring the TOutput union type
     * from the output types of the handoff agents.
     */
    static create<TOutput extends AgentOutputType = TextOutput, Handoffs extends readonly (Agent<any, any> | Handoff<any, any>)[] = []>(config: AgentConfigWithHandoffs<TOutput, Handoffs>): Agent<UnknownContext, TOutput | HandoffsOutputUnion<Handoffs>>;
    static DEFAULT_MODEL_PLACEHOLDER: string;
    name: string;
    instructions: string | ((runContext: RunContext<TContext>, agent: Agent<TContext, TOutput>) => Promise<string> | string);
    handoffDescription: string;
    handoffs: (Agent<any, TOutput> | Handoff<any, TOutput>)[];
    model: string | Model;
    modelSettings: ModelSettings;
    tools: Tool<TContext>[];
    mcpServers: MCPServer[];
    mcpConfig: AgentConfiguration<TContext, TOutput>['mcpConfig'];
    inputGuardrails: InputGuardrail[];
    outputGuardrails: OutputGuardrail<AgentOutputType, TContext>[];
    outputType: TOutput;
    toolUseBehavior: ToolUseBehavior;
    resetToolChoice: boolean;
    private readonly _toolsExplicitlyConfigured;
    private readonly _modelSettingsExplicitlyConfigured;
    constructor(config: AgentOptions<TContext, TOutput>);
    /** @internal */
    hasExplicitModelSettings(): boolean;
    /**
     * Output schema name.
     */
    get outputSchemaName(): string;
    /**
     * Create a copy of the agent with the specified parameters modified. For
     * example, you can do:
     *
     * ```
     * const newAgent = agent.clone({ instructions: 'New instructions' })
     * ```
     *
     * @param config - The partial configuration to modify.
     * @returns A new agent with the specified modifications applied.
     */
    clone(config: Partial<AgentConfiguration<TContext, TOutput>>): Agent<TContext, TOutput>;
    /**
     * Convert this Agent into a tool, so it can be called by other Agents.
     *
     * This differs from handoffs in two ways:
     *
     * - In handoffs, the new agent receives the conversation history. In this
     *   tool, the new agent receives the generated input.
     * - In handoffs, the new agent takes over the entire conversation. In this
     *   tool, the new agent is called as a tool, and the conversation continues
     *   with the original agent.
     *
     * @param options - The options for the tool.
     * @returns A tool that runs the agent and returns the output text.
     */
    asTool<TAgent extends Agent<TContext, TOutput> = Agent<TContext, TOutput>>(this: TAgent, options: AgentToolOptionsWithDefault<TContext, TAgent>): AgentTool<TContext, TAgent, typeof AgentAsToolInputSchema>;
    asTool<TAgent extends Agent<TContext, TOutput> = Agent<TContext, TOutput>, TParameters extends AgentToolInputParameters = typeof AgentAsToolInputSchema>(this: TAgent, options: AgentToolOptionsWithParameters<TContext, TAgent, TParameters>): AgentTool<TContext, TAgent, TParameters>;
    /**
     * Returns the Agent's system prompt.
     *
     * If the agent's instructions are a function, it is called with the runContext
     * and the agent instance.
     */
    getSystemPrompt(runContext: RunContext<TContext>): Promise<string | undefined>;
    /**
     * Fetch the available tools from the MCP servers.
     *
     * @returns The MCP-powered tools.
     */
    getMcpTools(runContext: RunContext<TContext>, tracingParent?: Span<any>): Promise<Tool<TContext>[]>;
    private getMcpToolReservedNames;
    /**
     * Get all of the agent's tools, including MCP tools and function tools.
     *
     * @returns All configured tools.
     */
    getAllTools(runContext: RunContext<TContext>, tracingParent?: Span<any>): Promise<Tool<TContext>[]>;
    hasExplicitToolConfig(): boolean;
    /**
     * Returns the handoffs that should be exposed to the model for the current
     * run.
     *
     * Handoffs that provide an isEnabled function returning false are ignored.
     */
    getEnabledHandoffs(runContext: RunContext<TContext>): Promise<Handoff<any, any>[]>;
    /**
     * Process the agent's final output.
     *
     * @param output - The agent's output.
     * @returns The parsed output.
     */
    processFinalOutput(output: string): ResolvedAgentOutput<TOutput>;
    /**
     * Returns a serializable JSON representation of the agent.
     *
     * @returns A JSON object containing the agent's name.
     */
    toJSON(): {
        name: string;
    };
}
type ToolUseBehaviorFlags = 'run_llm_again' | 'stop_on_first_tool';
type ToolsToFinalOutputResult = {
    /**
     * Whether this is the final output. If `false`, the LLM runs again and
     * receives the tool call output.
     */
    isFinalOutput: false;
    /**
     * Whether the agent was interrupted by a tool approval. If `true`, the LLM
     * runs again and receives the tool call output.
     */
    isInterrupted: undefined;
} | {
    isFinalOutput: false;
    /**
     * Whether the agent was interrupted by a tool approval. If `true`, the LLM
     * runs again and receives the tool call output.
     */
    isInterrupted: true;
    interruptions: RunToolApprovalItem[];
} | {
    /**
     * Whether this is the final output. If `false`, the LLM runs again and
     * receives the tool call output.
     */
    isFinalOutput: true;
    /**
     * Whether the agent was interrupted by a tool approval. If `true`, the LLM
     * runs again and receives the tool call output.
     */
    isInterrupted: undefined;
    /**
     * The final output. May be undefined if `isFinalOutput` is `false`;
     * otherwise it must be a string, which is processed according to the
     * agent's `outputType`.
     */
    finalOutput: string;
};
/**
 * A function that receives the run context and a list of tool results and
 * returns a `ToolsToFinalOutputResult`.
 */
type ToolToFinalOutputFunction = (context: RunContext, toolResults: FunctionToolResult[]) => ToolsToFinalOutputResult | Promise<ToolsToFinalOutputResult>;
/**
 * The agent's behavior when a tool is called.
 */
type ToolUseBehavior = ToolUseBehaviorFlags | {
    /**
     * A list of tool names that stop the agent from continuing to run. The
     * final output is the output of the first tool in the list that is called.
     */
    stopAtToolNames: string[];
} | ToolToFinalOutputFunction;

type MCPServersOptions = {
    connectTimeoutMs?: number | null;
    closeTimeoutMs?: number | null;
    dropFailed?: boolean;
    strict?: boolean;
    suppressAbortError?: boolean;
    connectInParallel?: boolean;
};
type MCPServersReconnectOptions = {
    failedOnly?: boolean;
};
/**
 * Manages MCP server lifecycle and exposes only connected servers.
 */
declare class MCPServers {
    private readonly allServers;
    private connectedServerSet;
    private failedServers;
    private failedServerSet;
    private errorsByServer;
    private suppressedAbortFailures;
    private workers;
    private serialCloseTasks;
    private lifecycleTail;
    private readonly connectTimeoutMs;
    private readonly closeTimeoutMs;
    private readonly dropFailed;
    private readonly strict;
    private readonly suppressAbortError;
    private readonly connectInParallel;
    [Symbol.asyncDispose]: () => Promise<void>;
    private constructor();
    static open(servers: MCPServer[], options?: MCPServersOptions): Promise<MCPServers>;
    get all(): MCPServer[];
    get active(): MCPServer[];
    get failed(): MCPServer[];
    get errors(): ReadonlyMap<MCPServer, Error>;
    reconnect(options?: MCPServersReconnectOptions): Promise<MCPServer[]>;
    private reconnectNow;
    close(): Promise<void>;
    private enqueueLifecycle;
    private connectAll;
    private closeAll;
    private attemptConnect;
    private refreshActiveServers;
    private recordFailure;
    private storeFailure;
    private runConnect;
    private closeServer;
    private runClose;
    private closeServers;
    private connectAllParallel;
    private getWorker;
    private removeFailedServer;
}
/**
 * Connect to multiple MCP servers and return a managed MCPServers instance.
 */
declare function connectMcpServers(servers: MCPServer[], options?: MCPServersOptions): Promise<MCPServers>;

type ModelParameterContext = {
    provider: string;
    model: string;
    baseURL?: string;
};
type ParameterEvidence = {
    url: string;
    checkedAt: string;
};
type ModelParameterSupport = {
    temperature: {
        status: 'supported' | 'unsupported' | 'unknown';
        min: number | null;
        max: number | null;
    };
    reasoning: {
        status: 'supported' | 'unsupported' | 'unknown';
        efforts: string[];
    };
    contextWindowTokens: number | null;
    maxOutputTokens: number | null;
    recommendedMaxOutputTokens: number | null;
    recommendationBasis: string | null;
    sources: ParameterEvidence[];
};
type ModelParameterValues = {
    temperature?: number;
    effort?: string | null;
    maxTokens?: number;
};
type ModelParameterIssue = {
    parameter: 'temperature' | 'effort' | 'maxTokens';
    code: 'UNKNOWN' | 'UNSUPPORTED' | 'OUT_OF_RANGE';
};
declare function describeModelParameters(context: ModelParameterContext): ModelParameterSupport;
declare function validateModelParameters(context: ModelParameterContext, values: ModelParameterValues, limits?: {
    maxOutputTokens: number;
}): ModelParameterIssue[];

type AnthropicFetch = NonNullable<ConstructorParameters<typeof Anthropic>[0]>['fetch'];
type AnthropicClient = Anthropic;
type AnthropicThinkingBudgetMap = Partial<Record<Exclude<ModelSettingsReasoningEffort, null>, number>>;
type AnthropicMessagesModelOptions = {
    defaultMaxTokens?: number | ((model: string) => number);
    maxOutputTokens?: number | ((model: string) => number | undefined);
    thinkingBudgetTokens?: AnthropicThinkingBudgetMap;
};

type AnthropicModelMetadataResolver = Record<string, ModelMetadata> | ((modelName: string) => ModelMetadata | undefined);
type AnthropicProviderOptions = AnthropicMessagesModelOptions & {
    apiKey?: string;
    baseURL?: string;
    defaultModel?: string;
    maxRetries?: number;
    fetch?: AnthropicFetch;
    anthropicClient?: AnthropicClient;
    modelMetadata?: AnthropicModelMetadataResolver;
};
declare class AnthropicProvider implements ModelProvider {
    #private;
    constructor(options?: AnthropicProviderOptions);
    getDefaultModelName(): string;
    getModelMetadata(modelName?: string): ModelMetadata | undefined;
    getModel(modelName?: string): Promise<Model>;
    close(): Promise<void>;
}

type AnthropicCompatibleFetch = NonNullable<ClientOptions['fetch']>;
type AnthropicCompatibleClient = Anthropic;

type DashScopeModelMetadataResolver = Record<string, ModelMetadata> | ((modelName: string) => ModelMetadata | undefined);
type DashScopeProviderOptions = {
    apiKey?: string;
    baseURL?: string;
    defaultModel?: string;
    fetch?: AnthropicCompatibleFetch;
    anthropicClient?: AnthropicCompatibleClient;
    modelMetadata?: DashScopeModelMetadataResolver;
};
declare class DashScopeProvider implements ModelProvider {
    #private;
    constructor(options?: DashScopeProviderOptions);
    getDefaultModelName(): string;
    getModelMetadata(modelName?: string): ModelMetadata | undefined;
    getModel(modelName?: string): Promise<Model>;
    close(): Promise<void>;
}

type DeepSeekAnthropicFetch = AnthropicCompatibleFetch;
type DeepSeekAnthropicClient = AnthropicCompatibleClient;

type DeepSeekProviderOptions = {
    apiKey?: string;
    baseURL?: string;
    defaultModel?: string;
    maxRetries?: number;
    fetch?: DeepSeekAnthropicFetch;
    anthropicClient?: DeepSeekAnthropicClient;
    modelMetadata?: Record<string, ModelMetadata> | ((modelName: string) => ModelMetadata | undefined);
};
declare class DeepSeekProvider implements ModelProvider {
    #private;
    constructor(options?: DeepSeekProviderOptions);
    getDefaultModelName(): string;
    getModelMetadata(modelName?: string): ModelMetadata | undefined;
    getModel(modelName?: string | undefined): Promise<Model>;
    /**
     * Closes cached model wrappers and clears cache.
     */
    close(): Promise<void>;
}

type GLMModelMetadataResolver = Record<string, ModelMetadata> | ((modelName: string) => ModelMetadata | undefined);
type GLMProviderOptions = {
    apiKey?: string;
    baseURL?: string;
    defaultModel?: string;
    fetch?: AnthropicCompatibleFetch;
    anthropicClient?: AnthropicCompatibleClient;
    modelMetadata?: GLMModelMetadataResolver;
};
declare class GLMProvider implements ModelProvider {
    #private;
    constructor(options?: GLMProviderOptions);
    getDefaultModelName(): string;
    getModelMetadata(modelName?: string): ModelMetadata | undefined;
    getModel(modelName?: string): Promise<Model>;
    close(): Promise<void>;
}

type HepAIModelMetadataResolver = Record<string, ModelMetadata> | ((modelName: string) => ModelMetadata | undefined);
type HepAIProviderOptions = {
    apiKey?: string;
    baseURL?: string;
    defaultModel?: string;
    openAIClient?: OpenAI;
    modelMetadata?: HepAIModelMetadataResolver;
};
declare class HepAIProvider implements ModelProvider {
    #private;
    constructor(options?: HepAIProviderOptions);
    getDefaultModelName(): string;
    getModelMetadata(modelName?: string): ModelMetadata | undefined;
    getModel(modelName?: string | undefined): Promise<Model>;
    /**
     * Closes cached model wrappers and clears cache.
     */
    close(): Promise<void>;
}

declare const KIMI_MODELS: {
    readonly 'kimi-k3': {
        readonly defaultMaxTokens: 131072;
        readonly metadata: {
            readonly contextWindowTokens: 1048576;
            readonly maxOutputTokens: 1048576;
            readonly multimodal: {
                readonly imageInput: true;
                readonly imageToolResult: "native";
            };
        };
    };
    readonly 'kimi-k2.6': {
        readonly defaultMaxTokens: 32768;
        readonly metadata: {
            readonly contextWindowTokens: 262144;
            readonly maxOutputTokens: 262144;
            readonly multimodal: {
                readonly imageInput: true;
                readonly imageToolResult: "native";
            };
        };
    };
};
type KimiModelName = keyof typeof KIMI_MODELS;
type KimiProviderOptions = {
    apiKey?: string;
    baseURL?: string;
    defaultModel?: KimiModelName;
    anthropicClient?: Anthropic;
};
declare class KimiProvider implements ModelProvider {
    #private;
    constructor(options?: KimiProviderOptions);
    getDefaultModelName(): KimiModelName;
    getModelMetadata(modelName?: string): ModelMetadata | undefined;
    getModel(modelName?: string): Promise<Model>;
    close(): Promise<void>;
}

type MiniMaxAnthropicFetch = AnthropicCompatibleFetch;
type MiniMaxAnthropicClient = AnthropicCompatibleClient;
type MiniMaxProviderOptions = {
    apiKey?: string;
    baseURL?: string;
    defaultModel?: string;
    fetch?: MiniMaxAnthropicFetch;
    anthropicClient?: MiniMaxAnthropicClient;
    modelMetadata?: Record<string, ModelMetadata> | ((modelName: string) => ModelMetadata | undefined);
};
declare class MiniMaxProvider implements ModelProvider {
    #private;
    constructor(options?: MiniMaxProviderOptions);
    getDefaultModelName(): string;
    getModelMetadata(modelName?: string): ModelMetadata | undefined;
    getModel(modelName?: string | undefined): Promise<Model>;
    /**
     * Closes cached model wrappers and clears cache.
     */
    close(): Promise<void>;
}

type OpenAIChatCompletionsModelMetadataResolver = Record<string, ModelMetadata> | ((modelName: string) => ModelMetadata | undefined);
type OpenAIChatCompletionsProviderOptions = {
    apiKey?: string;
    baseURL?: string;
    organization?: string;
    project?: string;
    openAIClient?: OpenAI;
    modelMetadata?: OpenAIChatCompletionsModelMetadataResolver;
};
declare class OpenAIChatCompletionsProvider implements ModelProvider {
    #private;
    constructor(options?: OpenAIChatCompletionsProviderOptions);
    getDefaultModelName(): string;
    getModelMetadata(modelName?: string): ModelMetadata | undefined;
    getModel(modelName?: string | undefined): Promise<Model>;
    /**
     * Closes cached model wrappers and clears cache.
     */
    close(): Promise<void>;
}

type OpenAIModelMetadataResolver = Record<string, ModelMetadata> | ((modelName: string) => ModelMetadata | undefined);
type OpenAIProviderOptions = {
    apiKey?: string;
    baseURL?: string;
    organization?: string;
    project?: string;
    openAIClient?: OpenAI;
    modelMetadata?: OpenAIModelMetadataResolver;
};
declare class OpenAIProvider implements ModelProvider {
    #private;
    constructor(options?: OpenAIProviderOptions);
    getDefaultModelName(): string;
    getModelMetadata(modelName?: string): ModelMetadata | undefined;
    getModel(modelName?: string): Promise<Model>;
    close(): Promise<void>;
}

declare class OpenRouterError extends Error {
    readonly status?: number;
    readonly errorType?: string;
    readonly providerCode?: string;
    readonly unsafeToReplay: boolean;
    readonly providerData?: Record<string, unknown>;
    constructor(args: {
        message: string;
        status?: number;
        errorType?: string;
        providerCode?: string;
        unsafeToReplay: boolean;
        providerData?: Record<string, unknown>;
    });
}

type OpenRouterReasoningOptions = {
    effort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
    max_tokens?: number;
    exclude?: boolean;
    enabled?: boolean;
};
type OpenRouterProviderRouting = {
    order?: string[];
    only?: string[];
    ignore?: string[];
    allow_fallbacks?: boolean;
    require_parameters?: boolean;
    data_collection?: 'allow' | 'deny';
    zdr?: boolean;
    enforce_distillable_text?: boolean;
    quantizations?: string[];
    max_price?: Partial<Record<'audio' | 'completion' | 'image' | 'prompt' | 'request', string>>;
    sort?: 'price' | 'throughput' | 'latency' | 'exacto' | {
        by?: 'price' | 'throughput' | 'latency' | 'exacto' | null;
        partition?: 'model' | 'none' | null;
    } | null;
    preferred_max_latency?: number | OpenRouterPercentileCutoffs | null;
    preferred_min_throughput?: number | OpenRouterPercentileCutoffs | null;
};
type OpenRouterPercentileCutoffs = Partial<Record<'p50' | 'p75' | 'p90' | 'p99', number | null>>;
type OpenRouterPlugin = {
    id: string;
    enabled?: boolean;
    [key: string]: unknown;
};
type OpenRouterRequestOptions = {
    provider?: OpenRouterProviderRouting;
    models?: string[];
    plugins?: OpenRouterPlugin[];
    reasoning?: OpenRouterReasoningOptions;
    session_id?: string;
};
type OpenRouterModelMetadataResolver = Record<string, ModelMetadata> | ((modelName: string) => ModelMetadata | undefined);
type OpenRouterProviderOptions = {
    apiKey?: string;
    baseURL?: string;
    defaultModel?: string;
    openAIClient?: OpenAI;
    maxRetries?: number;
    fetch?: typeof fetch;
    httpReferer?: string;
    appTitle?: string;
    appCategories?: string[] | string;
    routerMetadata?: boolean;
    defaultRequest?: OpenRouterRequestOptions;
    modelMetadata?: OpenRouterModelMetadataResolver;
};
declare class OpenRouterProvider implements ModelProvider {
    #private;
    constructor(options?: OpenRouterProviderOptions);
    getDefaultModelName(): string;
    getModelMetadata(modelName?: string): ModelMetadata | undefined;
    getModel(modelName?: string): Promise<Model>;
    close(): Promise<void>;
}

declare function setDefaultModelProvider(provider: ModelProvider): void;

declare const retryPolicies: {
    readonly never: () => RetryPolicy;
    readonly providerSuggested: () => RetryPolicy;
    readonly networkError: () => RetryPolicy;
    readonly httpStatus: (statuses: number[]) => RetryPolicy;
    readonly vetoHttpStatusUnlessProviderApproved: (statuses: number[]) => RetryPolicy;
    readonly retryAfter: () => RetryPolicy;
    readonly any: (...policies: RetryPolicy[]) => RetryPolicy;
    readonly all: (...policies: RetryPolicy[]) => RetryPolicy;
};

declare const SANDBOX_AGENT_BRAND: unique symbol;

type CapabilityInstructionsResult = string | null | Promise<string | null>;
type CapabilityProcessContextOptions = {
    runState?: RunState<any, Agent<any, AgentOutputType>>;
};
declare abstract class Capability {
    abstract readonly type: string;
    protected _session?: SandboxSessionLike;
    protected _runAs?: string;
    protected _modelInstance?: Model;
    clone(): this;
    bind(session: SandboxSessionLike): this;
    bindRunAs(runAs?: string | SandboxUser): this;
    bindModel(_model: string, modelInstance?: Model): this;
    requiredCapabilityTypes(): Set<string>;
    tools(): Tool<any>[];
    processManifest(manifest: Manifest): Manifest;
    instructions(_manifest: Manifest): CapabilityInstructionsResult;
    samplingParams(_samplingParams: Record<string, unknown>): Record<string, unknown>;
    processContext(context: AgentInputItem[], _options?: CapabilityProcessContextOptions): AgentInputItem[] | Promise<AgentInputItem[]>;
}
type ConfigureCapabilityTools = (tools: Tool<any>[]) => Tool<any>[];

declare class AskUserQuestionCapability extends Capability {
    readonly type = "askUserQuestion";
    tools(): Tool<any>[];
    instructions(): string;
}
type AskUserQuestion = AskUserQuestionCapability;
declare function askUserQuestion(): AskUserQuestion;

/**
 * The validated product of a whitelisted command: the binary to spawn + argv
 * (excluding the binary name), plus which indices in argv are paths (that must be
 * constrained inside the workspace). Flags / `--` already inserted into argv are
 * preserved as-is.
 */
type BuiltCommand = {
    command: string;
    args: string[];
    pathArgs: {
        index: number;
        forWrite: boolean;
    }[];
};
type CommandSpec = {
    /** The usage shown to the model, used for the tool description. */
    usage: string;
    /** Per-command hardcoded validation: validate the rawArgs the model gave and build a BuiltCommand, throwing UserError if invalid. */
    build: (rawArgs: string[]) => BuiltCommand;
};
declare const ALLOWED_COMMANDS: Record<string, CommandSpec>;
type RestrictedShellArgs = {
    configureTools?: ConfigureCapabilityTools;
    outputPreviewBytes?: number;
    commands?: ReadonlyArray<keyof typeof ALLOWED_COMMANDS>;
};
declare class RestrictedShellCapability extends Capability {
    readonly type = "restrictedShell";
    private readonly configureTools?;
    private readonly outputPreviewBytes;
    private readonly commandNames;
    constructor(args?: RestrictedShellArgs);
    tools(): Tool<any>[];
    instructions(): string;
}
type RestrictedShell = RestrictedShellCapability;
declare function restrictedShell(args?: RestrictedShellArgs): RestrictedShell;

declare const TaskRecordSchema: z$1.ZodObject<{
    id: z$1.ZodString;
    subject: z$1.ZodString;
    description: z$1.ZodString;
    activeForm: z$1.ZodOptional<z$1.ZodString>;
    status: z$1.ZodEnum<{
        in_progress: "in_progress";
        completed: "completed";
        pending: "pending";
    }>;
    blocks: z$1.ZodArray<z$1.ZodString>;
    blockedBy: z$1.ZodArray<z$1.ZodString>;
    metadata: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
}, z$1.core.$strict>;
type TaskRecord = z$1.infer<typeof TaskRecordSchema>;
type CreateTaskInput = {
    subject: string;
    description: string;
    activeForm?: string;
    metadata?: Record<string, unknown>;
};
type TaskListState = {
    list(): TaskRecord[];
    get(id: string): TaskRecord | undefined;
    create(input: CreateTaskInput): TaskRecord;
    save(task: TaskRecord): TaskRecord;
    delete(id: string): boolean;
};
type TaskListStore = {
    transaction<T>(taskListId: string, fn: (state: TaskListState) => T | Promise<T>): Promise<T>;
};
type TaskLifecycleHook = (task: TaskRecord) => void | string | Promise<void | string>;

type TaskListArgs = {
    id?: string;
    rootDir?: string;
    store?: TaskListStore;
    reminder?: boolean;
    onTaskCreated?: TaskLifecycleHook;
    onTaskCompleted?: TaskLifecycleHook;
};
declare class TaskListCapability extends Capability {
    readonly type = "taskList";
    private readonly id?;
    private readonly store;
    private readonly reminder;
    private readonly onTaskCreated?;
    private readonly onTaskCompleted?;
    constructor(args?: TaskListArgs);
    tools(): Tool<any>[];
    instructions(_manifest: Manifest): string;
    processContext(context: AgentInputItem[], options?: CapabilityProcessContextOptions): Promise<AgentInputItem[]>;
}
type TaskList = TaskListCapability;
declare function taskList(args?: TaskListArgs): TaskList;

type SandboxBaseInstructions<T = UnknownContext, P extends AgentOutputType = TextOutput> = string | ((runContext: RunContext<T>, agent: SandboxAgent<T, P>) => Promise<string> | string);
type SandboxSystemPromptMode = 'composed' | 'complete';
type SandboxAgentOptions<TContext = UnknownContext, TOutput extends AgentOutputType = TextOutput> = AgentOptions<TContext, TOutput> & {
    defaultManifest?: ManifestInput;
    baseInstructions?: SandboxBaseInstructions<TContext, TOutput>;
    systemPromptMode?: SandboxSystemPromptMode;
    capabilities?: Capability[];
    runAs?: string | SandboxUser;
};
declare class SandboxAgent<TContext = UnknownContext, TOutput extends AgentOutputType = TextOutput> extends Agent<TContext, TOutput> {
    readonly [SANDBOX_AGENT_BRAND] = true;
    defaultManifest?: Manifest;
    baseInstructions?: SandboxBaseInstructions<TContext, TOutput>;
    systemPromptMode: SandboxSystemPromptMode;
    capabilities: Capability[];
    runAs?: string | SandboxUser;
    runtimeManifest: Manifest;
    constructor(config: SandboxAgentOptions<TContext, TOutput>);
    clone(config: Partial<SandboxAgentOptions<TContext, TOutput>>): SandboxAgent<TContext, TOutput>;
}

declare class DeepSeekHarnessFilesystemCapability extends Capability {
    readonly type = "deepseekHarnessFilesystem";
    tools(): Tool<any>[];
}
type DeepSeekHarnessFilesystem = DeepSeekHarnessFilesystemCapability;
declare function deepseekHarnessFilesystem(): DeepSeekHarnessFilesystem;
declare class DeepSeekHarnessBashCapability extends Capability {
    readonly type = "deepseekHarnessBash";
    tools(): Tool<any>[];
}
type DeepSeekHarnessBash = DeepSeekHarnessBashCapability;
declare function deepseekHarnessBash(): DeepSeekHarnessBash;

type ViewImageCaptionerArgs = {
    /**
     * The vision fallback model instance. When the text main model calls
     * view_image, it generates image information text per the focus. The caller is
     * responsible for instantiation; the capability does no provider/name resolution.
     */
    model: Model;
    /** The captioner model call settings. Defaults to maxTokens 1000, temperature 0, no reasoning. */
    modelSettings?: ModelSettings;
    /** The captioner per-call timeout (ms). Defaults to 60s. */
    timeoutMs?: number;
};
type FilesystemArgs = {
    configureTools?: ConfigureCapabilityTools;
    maxReadBytes?: number;
    maxGlobResults?: number;
    /**
     * The vision fallback captioner for view_image. Only takes effect when the main
     * model's tool-result channel cannot deliver images: view_image's schema becomes
     * { path, focus } (focus required), the image is handed to this vision model to
     * extract information per the focus, and the result is written back to the tool
     * result as text. Native vision models are unaffected; unconfigured by default
     * (a text model calling view_image reports unsupported).
     */
    viewImageCaptioner?: ViewImageCaptionerArgs;
    /** Opt in to same-size JPEG quality 90 compression for view_image. Defaults to false. */
    viewImageCompression?: boolean;
    /**
     * Allow the Read tool to read .xlsx/.xlsm spreadsheets: parsed and returned as
     * CSV text. This is a compromise fallback path for sandboxes without a Bash
     * tool; disabled by default.
     */
    readXlsx?: boolean;
    /**
     * Allow the Read tool to read PDFs with a text layer: parsed and returned as
     * plain text with page markers. Scanned/OCR documents are not supported in the
     * first version; disabled by default.
     */
    readPdf?: boolean;
    /**
     * Allow the Read tool to read .docx documents: extracted to Markdown-style text
     * using Mammoth. Images/OCR/embedded objects are not supported in the first
     * version; disabled by default.
     */
    readDocx?: boolean;
    /**
     * Allow the Read tool to read .pptx presentations: extracts slide body and notes
     * text. Masters, comments, images/OCR, and charts/SmartArt are not supported in
     * the first version; disabled by default.
     */
    readPptx?: boolean;
    /** The maximum input size for Office document extraction. Defaults to 30MB. */
    officeMaxInputBytes?: number;
    /** The PDF extraction subprocess timeout, in milliseconds. Defaults to 30s. */
    pdfTimeoutMs?: number;
    /** The Python executable path. Defaults to LYRA_PDF_PYTHON, or python3 if unset. */
    pdfPythonCommand?: string;
    /** @internal Test injection point. */
    pdfExtractor?: PdfTextExtractor;
    /** @internal Test injection point. */
    docxExtractor?: OfficeTextExtractor;
    /** @internal Test injection point. */
    pptxExtractor?: OfficeTextExtractor;
};
type PdfTextExtractor = (args: {
    bytes: Buffer;
    pythonCommand: string;
    timeoutMs: number;
}) => Promise<string>;
type OfficeTextExtractor = (args: {
    bytes: Buffer;
}) => Promise<ExtractedDocumentText>;
type ExtractedDocumentText = {
    text: string;
    warnings?: string[];
};
declare class FilesystemCapability extends Capability {
    readonly type = "filesystem";
    private readonly configureTools?;
    private readonly maxReadBytes;
    private readonly maxGlobResults;
    private readonly viewImageCaptioner?;
    private readonly viewImageCompression;
    private readonly readXlsx;
    private readonly readPdf;
    private readonly readDocx;
    private readonly readPptx;
    private readonly officeMaxInputBytes;
    private readonly pdfTimeoutMs;
    private readonly pdfPythonCommand;
    private readonly pdfExtractor;
    private readonly docxExtractor;
    private readonly pptxExtractor;
    private exposedToolNames?;
    constructor(args?: FilesystemArgs);
    /**
     * Read an .xlsx/.xlsm spreadsheet and parse it into CSV text.
     * - Multiple worksheets are concatenated into a single CSV, fenced by
     *   `===SHEET: name===`.
     * - When the rendered result does not exceed maxReadBytes, it is returned inline.
     * - When it exceeds, it is spilled to the workspace under `.tmp/sheets/`,
     *   returning only a preview of the first few rows + a reminder, so the agent can
     *   read the full content on demand with Read/Grep.
     * - Deliberately does not write read-state: xlsx is read-only and cannot be
     *   Edited/Written.
     */
    private readSpreadsheetAsCsv;
    /**
     * Read a PDF with a text layer and render it as the Read tool's line-numbered
     * text.
     * - Each page is converted to plain text by Python/PyMuPDF, with a `=== Page N ===`
     *   page marker inserted.
     * - offset/limit continue to denote the line window of the extracted text.
     * - When offset/limit are not passed and the text exceeds maxReadBytes, it is
     *   spilled to `.tmp/documents/`.
     * - Deliberately does not write read-state: a PDF is a read-only extraction
     *   result and cannot be Edited/Written.
     */
    private readPdfAsText;
    /**
     * Read an OOXML Office document and render it as the Read tool's line-numbered
     * text.
     * - docx uses Mammoth to convert to HTML and then to Markdown-style text.
     * - pptx extracts only slide body and notes text, without parsing
     *   media/masters/comments.
     * - offset/limit continue to denote the line window of the extracted text.
     * - When offset/limit are not passed and the text exceeds maxReadBytes, it is
     *   spilled to `.tmp/documents/`.
     * - Deliberately does not write read-state: the original Office file is a
     *   read-only extraction result and cannot be Edited/Written.
     */
    private readOfficeDocumentAsText;
    tools(): Tool<any>[];
    /**
     * view_image is generated in three branches based on the main model's
     * capability and the captioner configuration (bindModel completes before
     * tools(), so the branch is determined at this point):
     * - The tool-result channel can deliver images (native/synthetic-user): the
     *   existing native path, schema without focus.
     * - Cannot deliver images but a captioner is configured: the schema is
     *   { path, focus } (focus required), and the vision fallback model generates a
     *   text description that is written back.
     * - Neither: keep the { path } schema, and a call returns an explicit
     *   unsupported toolError, giving the user definite feedback that "the UI can
     *   upload images but the current model/config cannot read them".
     */
    private createViewImageTool;
    private createNativeViewImageTool;
    private createCaptionerViewImageTool;
    /**
     * Directly call the captioner model to generate an image description (finalized
     * in grill: no internal Agent, no tools, no reading conversation history; it
     * only receives focus + image + image metadata).
     * Usage is not merged into the run usage; it is only written to the sandbox span
     * attributes (spanData is re-expanded when the end event is emitted, so
     * backfilling after the call takes effect).
     */
    private generateViewImageCaption;
    instructions(): string;
}
type Filesystem = FilesystemCapability;
declare function filesystem(args?: FilesystemArgs): Filesystem;

interface MemoryStore {
    read(path: string): Promise<Uint8Array | null>;
    write(path: string, data: Uint8Array): Promise<void>;
    delete?(path: string): Promise<void>;
    list?(prefix: string): Promise<string[]>;
}

type MemoryReadConfig = {
    enabled?: boolean;
    liveUpdate?: boolean;
    /**
     * A custom source for the memory summary. When provided, the summary injected
     * into the system prompt is taken from here instead of reading
     * `memoriesDir/summaryFile` in the sandbox. Typical use: the caller pins a
     * snapshot per session, guaranteeing the system prompt is byte-for-byte stable
     * throughout the session (prompt-cache friendly), so background consolidation
     * rewriting the shared summary does not affect in-progress sessions.
     * Returning null/empty string = no memory to inject this time.
     */
    summarySource?: () => Promise<string | null> | string | null;
};
type MemoryFlushMode = 'preStop' | 'manual';
type MemoryGenerateConfig = {
    enabled?: boolean;
    /**
     * When extraction happens. 'preStop' (default): run Phase 1/2 synchronously on
     * sandbox pre-stop/cleanup, preserving existing behavior. 'manual': run wrap-up
     * only writes rollout JSONL (enqueue) and does not register a pre-stop hook;
     * Phase 1/2 are triggered independently by the caller at an appropriate time via
     * `runMemoryExtraction` (pending is derived from file comparison, naturally
     * idempotent).
     */
    flush?: MemoryFlushMode;
    maxRawMemoriesForConsolidation?: number;
    phaseOneModel?: string | Model;
    phaseOneModelSettings?: ModelSettings;
    phaseTwoModel?: string | Model;
    phaseTwoModelSettings?: ModelSettings;
    extraPrompt?: string;
    model?: string | Model;
    instructions?: string;
};
type MemoryLayoutConfig = {
    memoriesDir?: string;
    sessionsDir?: string;
    directory?: string;
    summaryFile?: string;
};
type MemoryArgs = {
    read?: boolean | MemoryReadConfig | null;
    generate?: boolean | MemoryGenerateConfig | null;
    layout?: MemoryLayoutConfig;
    store?: MemoryStore;
};
declare class MemoryCapability extends Capability {
    readonly type = "memory";
    readonly read: MemoryReadConfig | null;
    readonly generate: MemoryGenerateConfig | null;
    readonly layout: {
        memoriesDir: string;
        sessionsDir: string;
        summaryFile: string;
    };
    readonly store?: MemoryStore;
    constructor(args?: MemoryArgs);
    requiredCapabilityTypes(): Set<string>;
    processManifest(manifest: Manifest): Manifest;
    instructions(_manifest: Manifest): Promise<string | null>;
    private resolveMemorySummary;
    private readMemorySummary;
    private readStoredText;
}
type Memory = MemoryCapability;
declare function memory(args?: MemoryArgs): Memory;

type ShellArgs = {
    configureTools?: ConfigureCapabilityTools;
    outputPreviewBytes?: number;
};
declare class ShellCapability extends Capability {
    readonly type = "shell";
    private readonly configureTools?;
    private readonly outputPreviewBytes;
    constructor(args?: ShellArgs);
    tools(): Tool<any>[];
    instructions(): string;
}
type Shell = ShellCapability;
declare function shell(args?: ShellArgs): Shell;

type SkillIndexEntry = {
    name: string;
    description: string;
    path?: string;
};
type LocalDirLazySkillSource = {
    source: Dir | LocalDir | GitRepo;
    index?: SkillIndexEntry[];
};
type SkillDescriptor = {
    name: string;
    description: string;
    content: string | Uint8Array | File | LocalFile;
    scripts?: Record<string, Entry>;
    references?: Record<string, Entry>;
    assets?: Record<string, Entry>;
    compatibility?: string[];
    deferred?: boolean;
};
type SkillsArgs = {
    skills?: SkillDescriptor[];
    from?: Entry;
    lazyFrom?: LocalDirLazySkillSource;
    index?: SkillIndexEntry[];
    skillsPath?: string;
};
declare class SkillsCapability extends Capability {
    readonly type = "skills";
    readonly skills: SkillDescriptor[];
    readonly from?: Entry;
    readonly lazyFrom?: LocalDirLazySkillSource;
    readonly index?: SkillIndexEntry[];
    readonly skillsPath: string;
    constructor(args: SkillsArgs);
    tools(): Tool<any>[];
    processManifest(manifest: Manifest): Manifest;
    instructions(manifest: Manifest): Promise<string | null>;
    private resolveRuntimeMetadata;
}
type Skills = SkillsCapability;
declare function skills(args: SkillsArgs): Skills;

type SandboxMemoryAgentRunner = (agent: Agent<any, any>, input: string, options: {
    sandbox: {
        session: SandboxSessionLike<SandboxSessionState>;
        manifest?: Manifest;
    };
    maxTurns?: number;
}) => Promise<{
    finalOutput: unknown;
    output: unknown;
}>;
type MemoryExtractionResult = {
    /** The rollouts this scan judged as pending (sorted by id). */
    pendingRolloutIds: string[];
    /** The rollouts Phase 1 successfully produced and persisted. */
    extractedRolloutIds: string[];
    /** Whether Phase 2 consolidation ran successfully to completion. */
    consolidated: boolean;
};
/**
 * The public entry point for detached extraction: given a sandbox session that
 * can access the memory layout, it scans pending on its own (derived from file
 * comparison) → runs Phase 1 one by one → runs Phase 2 if there is output.
 *
 * Unlike the pre-stop flush, it depends on no in-memory state and can be called
 * repeatedly on the same memory directory from any process/sandbox: missed
 * rollouts are caught up on the next scan, and failures are retried automatically.
 * The caller is responsible for concurrency control (only one extraction should
 * run on the same memory directory at a time).
 */
declare function runMemoryExtraction(args: {
    session: SandboxSessionLike<SandboxSessionState>;
    memory: Memory;
    runAgent: SandboxMemoryAgentRunner;
    runAs?: string;
}): Promise<MemoryExtractionResult>;

declare function prompt(strings: TemplateStringsArray, ...values: Array<string | number | boolean | null | undefined>): string;

type ResolveSandboxPathOptions = {
    forWrite?: boolean;
};

interface LocalSnapshot extends Snapshot {
    type: 'local';
    path: string;
}
interface LocalSnapshotSpec extends SnapshotSpec {
    type: 'local';
    baseDir?: string;
}
type LocalSandboxSnapshotSpec = LocalSnapshotSpec | RemoteSnapshotSpec | NoopSnapshotSpec;
type LocalSandboxSnapshot = LocalSnapshot | RemoteSnapshot;

type UnixRunAsIdentity = {
    username: string;
    uid: number;
    gid: number;
    isCurrentUser: boolean;
};
interface UnixLocalSandboxClientOptions extends SandboxClientOptions {
    /**
     * The parent directory for new sandbox working directories. Each create()
     * creates a temporary directory here; when unset, the system temp directory is
     * used.
     */
    workspaceBaseDir?: string;
    /**
     * The snapshot strategy used for session serialization and restore. local
     * writes the workspace snapshot to a local directory, remote saves/reads
     * snapshots via a configured store, and noop means snapshots are not persisted.
     */
    snapshot?: LocalSandboxSnapshotSpec;
    /**
     * The default shell used when a command does not explicitly pass a shell. A
     * shell passed to a single exec/execForeground takes higher precedence; when
     * this is also unset, it falls back to environment variables and the system
     * default shell.
     */
    defaultShell?: string;
    /**
     * The whitelist of ports allowed to be exposed via resolveExposedPort(). Ports
     * are validated and deduplicated; when unset or an empty array, resolvable ports
     * are not restricted.
     */
    exposedPorts?: number[];
    /**
     * Concurrency limits when materializing the manifest. manifestEntries controls
     * the concurrency of top-level manifest entries, and localDirFiles controls the
     * file concurrency when copying local_dir contents.
     */
    concurrencyLimits?: SandboxConcurrencyLimits;
}
interface UnixLocalSandboxSessionState extends SandboxSessionState {
    workspaceRootPath: string;
    workspaceRootOwned: boolean;
    environment: Record<string, string>;
    snapshotSpec?: LocalSandboxSnapshotSpec | null;
    snapshot?: LocalSandboxSnapshot | null;
    snapshotFingerprint?: string | null;
    snapshotFingerprintVersion?: string | null;
    configuredExposedPorts?: number[];
}
declare class UnixLocalSandboxSession<TState extends UnixLocalSandboxSessionState = UnixLocalSandboxSessionState> implements SandboxSession<TState> {
    readonly state: TState;
    protected readonly defaultShell?: string;
    private readonly activeProcesses;
    private nextSessionId;
    private closed;
    constructor(args: {
        state: TState;
        defaultShell?: string;
    });
    supportsPty(): boolean;
    resolveExposedPort(port: number): Promise<ExposedPortEndpoint>;
    execCommand(args: ExecCommandArgs): Promise<string>;
    execForeground(args: ExecForegroundArgs): Promise<SandboxExecResult>;
    /**
     * Spawn a single binary directly in argv form, **without a shell**. Each
     * argument declared as a path is first resolved and constrained inside the
     * workspace via resolveSandboxPath (escaping throws an error), then the resolved
     * host absolute path is substituted back into argv. The remaining tokens
     * (command name, whitelisted flags, `--`) are passed through as-is.
     */
    execForegroundArgv(args: ExecForegroundArgvArgs): Promise<SandboxExecResult>;
    private runForegroundProcess;
    exec(args: ExecCommandArgs): Promise<SandboxExecResult>;
    writeStdin(args: WriteStdinArgs): Promise<string>;
    writeStdinDetailed(args: WriteStdinArgs): Promise<WriteStdinResult>;
    terminateExecSession(sessionId: number): Promise<void>;
    viewImage(args: ViewImageArgs): Promise<ToolOutputImage>;
    pathExists(path: string, runAs?: string): Promise<boolean>;
    readFile(args: ReadFileArgs): Promise<Uint8Array>;
    statFile(args: StatFileArgs): Promise<StatFileResult>;
    readTextFile(args: ReadTextFileArgs): Promise<ReadTextFileResult>;
    grepFiles(args: GrepFilesArgs): Promise<GrepFilesResult>;
    globFiles(args: GlobFilesArgs): Promise<GlobFilesResult>;
    writeFile(args: WriteFileArgs): Promise<WriteFileResult>;
    editFile(args: EditFileArgs): Promise<EditFileResult>;
    listDir(args: ListDirectoryArgs): Promise<SandboxDirectoryEntry[]>;
    materializeEntry(args: MaterializeEntryArgs): Promise<void>;
    applyManifest(manifest: Manifest, runAs?: string): Promise<void>;
    persistWorkspace(): Promise<Uint8Array>;
    hydrateWorkspace(data: string | ArrayBuffer | Uint8Array): Promise<void>;
    stop(): Promise<void>;
    shutdown(): Promise<void>;
    delete(): Promise<void>;
    close(): Promise<void>;
    private stopActiveProcesses;
    private terminateActiveProcess;
    private signalActiveProcess;
    resolveSandboxPath(path?: string, options?: ResolveSandboxPathOptions): string;
    protected resolveCommandWorkdir(path?: string): string;
    private grepDisplayPathFormatter;
    private sortGrepFileMatches;
    private globDisplayPathFormatter;
    private safeLogicalPath;
    private resolveSandboxPathTarget;
    private resolveLocalBindMountPath;
    private resolveLocalBindMountTarget;
    protected resolveLogicalPath(path?: string): string;
    protected spawnShellCommand(command: string, args: {
        cwd: string;
        logicalCwd: string;
        shell?: string;
        login: boolean;
        runAs?: string;
        tty?: boolean;
        processGroup?: boolean;
    }): Promise<ChildProcessWithoutNullStreams>;
    /**
     * Spawn the binary + argv directly, **without launching a shell** (spawn
     * defaults to shell:false). So there are no rc/profile/BASH_ENV startup hooks,
     * no word splitting/expansion/metacharacters — argv reaches execvp as-is.
     * PATH comes from buildCommandEnvironment's DEFAULT_SANDBOX_COMMAND_PATH.
     */
    protected spawnDirectCommand(command: string, commandArgs: string[], args: {
        cwd: string;
        logicalCwd: string;
        runAs?: string;
        processGroup?: boolean;
    }): Promise<ChildProcessWithoutNullStreams>;
    translateCommandInput(command: string): string;
    protected translateCommandOutput(output: string): string;
    protected commandOutputTranslationCarryChars(): number;
    protected materializeRestoredWorkspaceMounts(): Promise<void>;
    protected logicalWorkdirForPath(path?: string): string;
    protected resolveCommandRunAs(runAs?: string): Promise<UnixRunAsIdentity | undefined>;
    resolveFilesystemRunAs(runAs?: string): Promise<UnixRunAsIdentity | undefined>;
    protected resolveRunAsIdentity(runAs?: string): Promise<UnixRunAsIdentity | undefined>;
    private trackChildProcess;
    private createForegroundOutputCapture;
    private allocateProcessId;
}
declare class UnixLocalSandboxClient implements SandboxClient<UnixLocalSandboxClientOptions, UnixLocalSandboxSessionState> {
    readonly backendId = "unix_local";
    readonly supportsDefaultOptions = true;
    private readonly options;
    constructor(options?: UnixLocalSandboxClientOptions);
    create(args?: SandboxClientCreateArgs<UnixLocalSandboxClientOptions> | Manifest, manifestOptions?: UnixLocalSandboxClientOptions): Promise<UnixLocalSandboxSession>;
    resume(state: UnixLocalSandboxSessionState): Promise<UnixLocalSandboxSession>;
    serializeSessionState(state: UnixLocalSandboxSessionState): Promise<Record<string, unknown>>;
    deserializeSessionState(state: Record<string, unknown>): Promise<UnixLocalSandboxSessionState>;
    private restoreIfNeeded;
}

declare class DockerSandboxSession extends UnixLocalSandboxSession<DockerSandboxSessionState> {
    private containerClosed;
    resolveFilesystemRunAs(runAs?: string): Promise<undefined>;
    viewImage(args: ViewImageArgs): Promise<ToolOutputImage>;
    pathExists(path: string, runAs?: string): Promise<boolean>;
    statFile(args: StatFileArgs): Promise<StatFileResult>;
    readFile(args: ReadFileArgs): Promise<Uint8Array>;
    readTextFile(args: ReadTextFileArgs): Promise<ReadTextFileResult>;
    grepFiles(args: GrepFilesArgs): Promise<GrepFilesResult>;
    globFiles(args: GlobFilesArgs): Promise<GlobFilesResult>;
    writeFile(args: WriteFileArgs): Promise<WriteFileResult>;
    editFile(args: EditFileArgs): Promise<EditFileResult>;
    listDir(args: ListDirectoryArgs): Promise<SandboxDirectoryEntry[]>;
    private pathRequiresDockerFilesystem;
    private containerGrepDisplayPathFormatter;
    private containerGlobDisplayPathFormatter;
    private safeContainerLogicalPath;
    materializeEntry(args: MaterializeEntryArgs): Promise<void>;
    applyManifest(manifest: Manifest, runAs?: string): Promise<void>;
    resolveExposedPort(port: number): Promise<ExposedPortEndpoint>;
    protected resolveCommandWorkdir(path?: string): string;
    protected spawnShellCommand(command: string, args: {
        cwd: string;
        logicalCwd: string;
        shell?: string;
        login: boolean;
        runAs?: string;
        tty?: boolean;
        processGroup?: boolean;
    }): Promise<ChildProcessWithoutNullStreams>;
    translateCommandInput(command: string): string;
    protected translateCommandOutput(output: string): string;
    protected materializeRestoredWorkspaceMounts(): Promise<void>;
    resolveSandboxPath(path?: string, options?: ResolveSandboxPathOptions): string;
    resolveContainerFilesystemPath(path?: string, options?: ResolveSandboxPathOptions): string;
    readDockerFileAs(path: string, runAs?: string): Promise<Uint8Array>;
    writeDockerTextFileAs(path: string, content: string, runAs?: string): Promise<void>;
    deleteDockerPathAs(path: string, runAs: string): Promise<void>;
    mkdirDockerPathAs(path: string, runAs: string): Promise<void>;
    runDockerMountCommand(command: string, action: string, options?: {
        input?: string | Uint8Array;
    }): Promise<string>;
    private chownContainerPath;
    private runCheckedDockerFilesystemCommand;
    private runDockerFilesystemCommand;
    close(): Promise<void>;
}
interface DockerResourceLimits {
    /** `docker run --memory`, e.g. `"2g"`. */
    memory?: string;
    /** `docker run --cpus`. */
    cpus?: number;
    /** `docker run --pids-limit`. */
    pidsLimit?: number;
}
interface DockerSandboxClientOptions extends SandboxClientOptions {
    image?: string;
    exposedPorts?: number[];
    workspaceBaseDir?: string;
    snapshot?: LocalSandboxSnapshotSpec;
    concurrencyLimits?: SandboxConcurrencyLimits;
    /** `docker run --network`, e.g. `"none"` to fully isolate the container. */
    network?: string;
    resourceLimits?: DockerResourceLimits;
}
interface DockerSandboxSessionState extends UnixLocalSandboxSessionState {
    containerId: string;
    image: string;
    defaultUser?: string;
    configuredExposedPorts?: number[];
    dockerVolumeNames?: string[];
    snapshotExcludedPaths?: string[];
}
declare class DockerSandboxClient implements SandboxClient<DockerSandboxClientOptions, DockerSandboxSessionState> {
    readonly backendId = "docker";
    readonly supportsDefaultOptions = true;
    private readonly options;
    constructor(options?: DockerSandboxClientOptions);
    create(args?: SandboxClientCreateArgs<DockerSandboxClientOptions> | Manifest, manifestOptions?: DockerSandboxClientOptions): Promise<DockerSandboxSession>;
    resume(state: DockerSandboxSessionState): Promise<DockerSandboxSession>;
    serializeSessionState(state: DockerSandboxSessionState): Promise<Record<string, unknown>>;
    deserializeSessionState(state: Record<string, unknown>): Promise<DockerSandboxSessionState>;
    private restoreIfNeeded;
    private cleanupDockerResources;
    private restartContainer;
}

declare const ASK_USER_QUESTION_TOOL_NAME = "AskUserQuestion";

declare function setTraceProcessors(processors: TracingProcessor[]): void;
declare function setTracingDisabled(disabled: boolean): void;

declare function getTracingExportApiKey(): string | undefined;
declare const DEFAULT_TRACING_EXPORTER_ENDPOINT = "http://192.168.8.88:32282/v1/traces/ingest";
declare const DEFAULT_TRACING_EXPORTER_API_KEY = "dev-token";
declare function getTracingExportEndpoint(): string;
/**
 * Options for OpenAITracingExporter.
 */
type OpenAITracingExporterOptions = {
    apiKey?: string;
    organization: string;
    project: string;
    endpoint: string;
    maxRetries: number;
    baseDelay: number;
    maxDelay: number;
};
/**
 * A tracing exporter that exports traces to OpenAI's tracing API.
 */
declare class OpenAITracingExporter implements TracingExporter {
    #private;
    constructor(options?: Partial<OpenAITracingExporterOptions>);
    export(items: (Trace | Span<any>)[], signal?: AbortSignal): Promise<void>;
}
/**
 * Sets the OpenAI Tracing exporter as the default exporter with a BatchTraceProcessor handling the
 * traces
 */
declare function configureOpenAITracing(options?: Partial<OpenAITracingExporterOptions>): void;

export { ASK_USER_QUESTION_TOOL_NAME, Agent, type AgentInputItem, AnthropicProvider, AssistantMessageItem, BaseMCPServerSSE, BaseMCPServerStdio, type BaseMCPServerStdioOptions, BaseMCPServerStreamableHttp, BatchTraceProcessor, type CallToolResponse, type CallToolResult, type CallToolResultContent, type CallToolResultMetadata, Capability, ConsoleSpanExporter, DEFAULT_SSE_MCP_CLIENT_LOGGER_NAME, DEFAULT_STDIO_MCP_CLIENT_LOGGER_NAME, DEFAULT_STREAMABLE_HTTP_MCP_CLIENT_LOGGER_NAME, DEFAULT_TRACING_EXPORTER_API_KEY, DEFAULT_TRACING_EXPORTER_ENDPOINT, DashScopeProvider, type DeepSeekHarnessBash, type DeepSeekHarnessFilesystem, DeepSeekProvider, type DefaultMCPServerStdioOptions, type DockerResourceLimits, DockerSandboxClient, type DockerSandboxClientOptions, DockerSandboxSession, type DockerSandboxSessionState, FileCompactionStore, type FullCommandMCPServerStdioOptions, FunctionCallItem, FunctionCallResultItem, type FunctionTool, type FunctionToolCustomDataContext, type FunctionToolCustomDataExtractor, GLMProvider, type GetAllMcpToolsOptions, HepAIProvider, type InitializeResponse, type InitializeResult, type JsonRpcNotification, type JsonRpcRequest, type JsonRpcResponse, KimiProvider, type Logger, type MCPBlobResourceContent, type MCPCallToolOptions, type MCPFunctionToolConversionOptions, type MCPListResourceTemplatesResult, type MCPListResourcesParams, type MCPListResourcesResult, type MCPReadResourceResult, type MCPResource, type MCPResourceContent, type MCPResourceTemplate, type MCPServer, MCPServerSSE, type MCPServerSSEOptions, MCPServerStdio, type MCPServerStdioOptions, MCPServerStreamableHttp, type MCPServerStreamableHttpOptions, type MCPServerWithResources, MCPServers, type MCPServersOptions, type MCPServersReconnectOptions, type MCPTextResourceContent, MCPTool, type MCPToolCacheKeyGenerator, type MCPToolCustomDataContext, type MCPToolCustomDataExtractor, type MCPToolErrorFunction, type MCPToolFilterCallable, type MCPToolFilterContext, type MCPToolFilterStatic, type MCPToolMetaContext, type MCPToolMetaResolver, Manifest, type Memory, type MemoryArgs, type MemoryExtractionResult, type MemoryFlushMode, type MemoryGenerateConfig, type MemoryLayoutConfig, type MemoryReadConfig, MiniMaxProvider, type Model, type ModelParameterContext, type ModelParameterIssue, type ModelParameterSupport, type ModelParameterValues, type ModelProvider, ModelRequestError, ModelRetryExhaustedError, OpenAIChatCompletionsProvider, OpenAIProvider, OpenAITracingExporter, type OpenAITracingExporterOptions, OpenRouterError, type OpenRouterModelMetadataResolver, type OpenRouterPercentileCutoffs, type OpenRouterPlugin, OpenRouterProvider, type OpenRouterProviderOptions, type OpenRouterProviderRouting, type OpenRouterReasoningOptions, type OpenRouterRequestOptions, type ParameterEvidence, ReasoningItem, type ResponseStreamEvent, RunContext, RunItemStreamEvent, RunModelRetryStreamEvent, RunRawModelStreamEvent, RunState, type RunStreamEvent, RunToolApprovalItem, RunToolCallOutputItem, Runner, SandboxAgent, type SandboxMemoryAgentRunner, type SandboxSystemPromptMode, type Session, type Tool, type ToolDualResult, type ToolErrorResult, type ToolGuardrailBase, type ToolGuardrailBehavior, type ToolGuardrailFunctionOutput, ToolGuardrailFunctionOutputFactory, type ToolGuardrailMetadata, type ToolInputGuardrailData, type ToolInputGuardrailDefinition, type ToolInputGuardrailFunction, type ToolInputGuardrailResult, type ToolOutputGuardrailData, type ToolOutputGuardrailDefinition, type ToolOutputGuardrailFunction, type ToolOutputGuardrailResult, type TracingExporter, type TracingProcessor, UnixLocalSandboxClient, UnixLocalSandboxSession, UserMessageItem, askUserQuestion, attachCallToolResultMetadata, configureOpenAITracing, connectMcpServers, createMCPToolStaticFilter, deepseekHarnessBash, deepseekHarnessFilesystem, defaultMCPToolCacheKey, defaultProcessor, defineToolInputGuardrail, defineToolOutputGuardrail, describeModelParameters, filesystem, getAllMcpTools, getLogger, getTracingExportApiKey, getTracingExportEndpoint, invalidateServerToolsCache, mcpToFunctionTool, memory, prompt, resolveToolInputGuardrails, resolveToolOutputGuardrails, restrictedShell, retryPolicies, run, runMemoryExtraction, setDefaultModelProvider, setTraceProcessors, setTracingDisabled, shell, skills, taskList, tool, toolError, toolResult, validateModelParameters };
