import type { JSONSchema7 } from 'json-schema';
import type { UnknownUserData } from '../voice/run_context.js';
import type { ChatContext } from './chat_context.js';
import { FunctionCall, FunctionCallOutput, type ImageContent } from './chat_context.js';
import type { ToolContext, ToolInputSchema, ToolOptions } from './tool_context.js';
export interface SerializedImage {
    inferenceDetail: 'auto' | 'high' | 'low';
    mimeType?: string;
    base64Data?: string;
    externalUrl?: string;
}
export declare function serializeImage(image: ImageContent): Promise<SerializedImage>;
/** Raw OpenAI-adherent function parameters. */
export type OpenAIFunctionParameters = {
    type: 'object';
    properties: {
        [id: string]: any;
    };
    required: string[];
    additionalProperties?: boolean;
};
export declare const createToolOptions: <UserData extends UnknownUserData>(toolCallId: string, userData?: UserData) => ToolOptions<UserData>;
/** @internal */
export declare const oaiParams: (schema: any, isOpenai?: boolean) => OpenAIFunctionParameters;
/** @internal */
export declare const oaiBuildFunctionInfo: (toolCtx: ToolContext, toolCallId: string, toolName: string, rawArgs: string) => FunctionCall;
export declare function parseFunctionArguments(rawArgs: string | Record<string, unknown>): Record<string, unknown>;
export declare function executeToolCall(toolCall: FunctionCall, toolCtx: ToolContext): Promise<FunctionCallOutput>;
export interface FormatChatHistoryOptions {
    includeIds?: boolean;
    includeTimestamps?: boolean;
}
export type ChatContextValidationSeverity = 'error' | 'warning';
export interface ChatContextValidationIssue {
    severity: ChatContextValidationSeverity;
    code: 'duplicate_id' | 'timestamp_order' | 'empty_message_content' | 'empty_text_term' | 'missing_image_term' | 'invalid_audio_term' | 'invalid_function_call' | 'invalid_function_call_args' | 'invalid_function_call_output' | 'orphan_function_call_output';
    index: number;
    itemId: string;
    message: string;
}
export interface ChatContextValidationResult {
    valid: boolean;
    errors: number;
    warnings: number;
    issues: ChatContextValidationIssue[];
}
/**
 * Render a chat context into a readable multiline string for debugging and logging.
 */
export declare function formatChatHistory(chatCtx: ChatContext, options?: FormatChatHistoryOptions): string;
/**
 * Validate structural integrity of chat context items/terms for realtime usage.
 */
export declare function validateChatContextStructure(chatCtx: ChatContext): ChatContextValidationResult;
interface DiffOps {
    toRemove: string[];
    toCreate: Array<[string | null, string]>;
}
/**
 * Compute the minimal list of create/remove operations to transform oldCtx into newCtx.
 *
 * @param oldCtx - The old chat context.
 * @param newCtx - The new chat context.
 * @returns The minimal list of create/remove operations to transform oldCtx into newCtx.
 */
export declare function computeChatCtxDiff(oldCtx: ChatContext, newCtx: ChatContext): DiffOps;
export declare function toJsonSchema(schema: ToolInputSchema<any>, isOpenai?: boolean, strict?: boolean): JSONSchema7;
export {};
//# sourceMappingURL=utils.d.ts.map