import { type GeneratedMedia, type MediaBudgetState } from "./media"; /** * Sanitizes unpaired/lone Unicode surrogates in text content. * * Lone surrogates (high surrogates without matching low surrogates, or vice versa) * can cause JSON serialization issues and downstream processing errors when sending * text to LLM providers. This function replaces them with the Unicode replacement * character (U+FFFD). * * @param content - The string to sanitize * @returns The string with lone surrogates replaced by U+FFFD */ export declare function sanitizeSurrogates(content: string): string; export type AiSdkFormatterMessageRole = "user" | "assistant" | "tool"; export type AiSdkFormatterPart = { type: "text"; text: string; providerOptions?: Record>; } | { type: "reasoning"; text: string; providerOptions?: Record>; } | { type: "image"; image: string | Uint8Array | ArrayBuffer | URL; mediaType?: string; } | { type: "media"; media: GeneratedMedia; } | { type: "file"; path: string; content: string; } | { type: "tool-call"; toolCallId: string; toolName: string; input: unknown; providerOptions?: Record>; } | { type: "tool-result"; toolCallId: string; toolName: string; output: unknown; isError?: boolean; }; export interface AiSdkFormatterMessage { role: AiSdkFormatterMessageRole; content: string | AiSdkFormatterPart[]; } export declare const EMPTY_CONTENT_TEXT = "ERROR: EMPTY CONTENT"; export type AiSdkMessagePart = Record; export type AiSdkMessage = { role: "system" | "user" | "assistant" | "tool"; content: string | AiSdkMessagePart[]; }; export declare function toAiSdkToolResultOutput(output: unknown, isError?: boolean, mediaState?: MediaBudgetState, options?: { supportsImages?: boolean; }): Record; export declare function formatMessagesForAiSdk(systemContent: string | AiSdkMessagePart[] | undefined, messages: readonly AiSdkFormatterMessage[], options?: { assistantToolCallArgKey?: "args" | "input"; /** * Whether the target model advertises image input. When false, image * parts (user-attached and inside tool results) are substituted with * `IMAGE_UNSUPPORTED_PLACEHOLDER` text so the request stays valid for * text-only models while the model still learns an image was there. * Defaults to true. The substitution happens here at request-build * time only — stored conversation history is never mutated. */ supportedInputModalities?: readonly string[]; }): AiSdkMessage[];