import type { ProviderMessage } from "./types.js"; import type { BaseMessage } from "../agents/types.js"; /** Attachment accepted by {@link convertMessagesToProvider}. */ export interface InspectorAttachment { /** Attachment kind. Files that are not images are ignored. */ type: "image" | "file"; /** Base64-encoded attachment bytes. */ data: string; /** MIME type for the encoded bytes. */ mimeType: string; } /** Text or completed tool invocation in an inspector message. */ export interface InspectorMessagePart { /** Message part kind. */ type: "text" | "tool-invocation"; /** Text content when `type` is `"text"`. */ text?: string; /** Invocation details when `type` is `"tool-invocation"`. */ toolInvocation?: { /** Tool name. */ toolName: string; /** Tool arguments. */ args: Record; /** Completed result. Omit while the invocation is pending. */ result?: unknown; }; } /** Structural inspector message accepted by {@link convertMessagesToProvider}. */ export interface InspectorMessageLike { /** Author of the message. */ role: "user" | "assistant"; /** Plain text or framework-specific content. */ content: unknown; /** Optional message attachments. */ attachments?: InspectorAttachment[]; /** Optional AI SDK-style message parts. */ parts?: InspectorMessagePart[]; } /** * Converts LangChain messages into provider-neutral history. * * @param messages - LangChain history in conversation order. * @returns Equivalent provider messages. * @throws TypeError if a message has an unsupported or unknown role. */ export declare function convertExternalHistoryToProvider(messages: BaseMessage[]): ProviderMessage[]; /** * Convert inspector chat `Message[]` to provider-neutral `ProviderMessage[]`. * * Assistant messages with completed tool invocations are expanded into an * assistant message (bearing `toolCalls`) followed by one `tool` message per * invocation carrying the serialized result. This mirrors what the inspector * previously built using LangChain's AIMessage + ToolMessage pair. * * @param messages - Inspector messages in conversation order. * @returns Provider-neutral messages, including completed tool call/result * pairs. */ export declare function convertMessagesToProvider(messages: InspectorMessageLike[]): ProviderMessage[]; /** * Extract the top-level `system` instruction (if any) from a ProviderMessage * list and return both the system text and the messages without it. * * Anthropic and Google do not accept a `system` role inside their `messages` * array; they take it as a top-level field instead. */ export declare function extractSystem(messages: ProviderMessage[]): { system?: string; rest: ProviderMessage[]; }; /** * Parses a base64 data URL. * * @param url - URL in `data:;base64,` form. * @returns The MIME type and base64 payload, or `null` for another URL form. */ export declare function parseDataUrl(url: string): { mimeType: string; data: string; } | null; //# sourceMappingURL=messageFormat.d.ts.map