import { Agent } from '../agent'; import { Usage } from '../usage'; import { Response, ResponseComputerToolCall, ResponseFileSearchToolCall, ResponseFunctionToolCall, ResponseFunctionWebSearch, ResponseOutputItem, ResponseOutputMessage, ResponseStreamEvent, ResponseReasoningItem, ResponseInputItem } from 'openai/resources/responses/responses'; type FunctionCallOutput = ResponseInputItem.FunctionCallOutput; type ComputerCallOutput = ResponseInputItem.ComputerCallOutput; /** * A type alias for the Response type from the OpenAI SDK. */ export type TResponse = Response; /** * A type alias for the ResponseInputItemParam type from the OpenAI SDK. */ export type TResponseInputItem = any; /** * A type alias for the ResponseOutputItem type from the OpenAI SDK. */ export type TResponseOutputItem = ResponseOutputItem; /** * A type alias for the ResponseStreamEvent type from the OpenAI SDK. */ export type TResponseStreamEvent = ResponseStreamEvent; /** * Base class for all run items */ export declare abstract class RunItemBase { /** * The agent whose run caused this item to be generated. */ agent: Agent; /** * The raw Responses item from the run. This will always be a either an output item * or an input item */ raw_item: T; /** * The type of this run item, used for type discrimination */ abstract type: string; constructor(agent: Agent, raw_item: T); /** * Converts this item into an input item suitable for passing to the model. */ toInputItem(): TResponseInputItem; } /** * Represents a message from the LLM. */ export declare class MessageOutputItem extends RunItemBase { /** * The type discriminator for this run item */ readonly type: "message_output_item"; constructor(agent: Agent, raw_item: ResponseOutputMessage); } /** * Represents a tool call for a handoff from one agent to another. */ export declare class HandoffCallItem extends RunItemBase { /** * The type discriminator for this run item */ readonly type: "handoff_call_item"; constructor(agent: Agent, raw_item: ResponseFunctionToolCall); } /** * Represents the output of a handoff. */ export declare class HandoffOutputItem extends RunItemBase { /** * The type discriminator for this run item */ readonly type: "handoff_output_item"; /** * The agent that made the handoff. */ source_agent: Agent; /** * The agent that is being handed off to. */ target_agent: Agent; constructor(agent: Agent, raw_item: TResponseInputItem, source_agent: Agent, target_agent: Agent); } /** * A type that represents a tool call item. */ export type ToolCallItemTypes = ResponseFunctionToolCall | ResponseComputerToolCall | ResponseFileSearchToolCall | ResponseFunctionWebSearch; /** * Represents a tool call e.g. a function call or computer action call. */ export declare class ToolCallItem extends RunItemBase { /** * The type discriminator for this run item */ readonly type: "tool_call_item"; constructor(agent: Agent, raw_item: ToolCallItemTypes); } /** * Represents the output of a tool call. */ export declare class ToolCallOutputItem extends RunItemBase { /** * The type discriminator for this run item */ readonly type: "tool_call_output_item"; /** * The output of the tool call. This is whatever the tool call returned; * the `raw_item` contains a string representation of the output. */ output: any; constructor(agent: Agent, raw_item: FunctionCallOutput | ComputerCallOutput, output: any); } /** * Represents a reasoning item. */ export declare class ReasoningItem extends RunItemBase { /** * The type discriminator for this run item */ readonly type: "reasoning_item"; constructor(agent: Agent, raw_item: ResponseReasoningItem); } /** * An item generated by an agent. */ export type RunItem = MessageOutputItem | HandoffCallItem | HandoffOutputItem | ToolCallItem | ToolCallOutputItem | ReasoningItem; /** * Model response wrapper */ export declare class ModelResponse { /** * A list of outputs (messages, tool calls, etc) generated by the model */ output: TResponseOutputItem[]; /** * The usage information for the response. */ usage: Usage; /** * 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. */ response_id: string | null; constructor(output: TResponseOutputItem[], usage: Usage, response_id?: string | null); /** * Convert the output into a list of input items suitable for passing to the model. */ toInputItems(): TResponseInputItem[]; } /** * Helper functions for working with response items */ export declare class ItemHelpers { /** * Extracts the last text content or refusal from a message. */ static extractLastContent(message: TResponseOutputItem): string; /** * Extracts the last text content from a message, if any. Ignores refusals. */ static extractLastText(message: TResponseOutputItem): string | null; /** * Converts a string or list of input items into a list of input items. */ static inputToNewInputList(input: string | TResponseInputItem[]): TResponseInputItem[]; /** * Concatenates all the text content from a list of message output items. */ static textMessageOutputs(items: RunItem[]): string; /** * Extracts all the text content from a single message output item. */ static textMessageOutput(message: MessageOutputItem): string; /** * Creates a tool call output item from a tool call and its output. */ static toolCallOutputItem(toolCall: ResponseFunctionToolCall, output: string): FunctionCallOutput; } export {};