import type * as models from '../models/index.js'; import type { ConversationState, ParsedToolCall, Tool, TurnContext, UnsentToolResult } from './tool-types.js'; /** * Generate a unique ID for a conversation * Uses crypto.randomUUID if available, falls back to timestamp + random */ export declare function generateConversationId(): string; /** * Create an initial conversation state * @param id - Optional custom ID, generates one if not provided */ export declare function createInitialState(id?: string): ConversationState; /** * Update a conversation state with new values * Automatically updates the updatedAt timestamp */ export declare function updateState(state: ConversationState, updates: Partial, 'id' | 'createdAt' | 'updatedAt'>>): ConversationState; /** * Append new items to the message history */ export declare function appendToMessages(current: models.InputsUnion, newItems: models.BaseInputsUnion[]): models.InputsUnion; /** * Check if a tool call requires approval * @param toolCall - The tool call to check * @param tools - Available tools * @param context - Turn context for the approval check * @param callLevelCheck - Optional call-level approval function (overrides tool-level), can be async */ export declare function toolRequiresApproval(toolCall: ParsedToolCall, tools: TTools, context: TurnContext, callLevelCheck?: (toolCall: ParsedToolCall, context: TurnContext) => boolean | Promise): Promise; /** * Partition tool calls into those requiring approval and those that can auto-execute * @param toolCalls - Tool calls to partition * @param tools - Available tools * @param context - Turn context for the approval check * @param callLevelCheck - Optional call-level approval function (overrides tool-level), can be async */ export declare function partitionToolCalls(toolCalls: ParsedToolCall[], tools: TTools, context: TurnContext, callLevelCheck?: (toolCall: ParsedToolCall, context: TurnContext) => boolean | Promise): Promise<{ requiresApproval: ParsedToolCall[]; autoExecute: ParsedToolCall[]; }>; /** * Create an unsent tool result from a successful execution */ export declare function createUnsentResult(callId: string, name: string, output: unknown): UnsentToolResult; /** * Create an unsent tool result from a rejection */ export declare function createRejectedResult(callId: string, name: string, reason?: string): UnsentToolResult; /** * Convert unsent tool results to API format for sending to the model */ export declare function unsentResultsToAPIFormat(results: UnsentToolResult[]): models.FunctionCallOutputItem[]; /** * Extract text content from a response */ export declare function extractTextFromResponse(response: models.OpenResponsesResult): string; /** * Extract tool calls from a response */ export declare function extractToolCallsFromResponse(response: models.OpenResponsesResult): ParsedToolCall[]; //# sourceMappingURL=conversation-state.d.ts.map