import { type UIMessage, type UIDataTypes, type UITools } from "ai"; import { type LanguageModelItem } from "@kernl-sdk/protocol"; /** * Converter for transforming Vercel AI SDK UIMessage format (used by useChat hook) * to kernl's LanguageModelItem format. * * @example * ```typescript * import { UIMessageCodec } from '@kernl-sdk/ai'; * * // Validate and convert incoming UI message to kernl format * const items = await UIMessageCodec.decode(uiMessage); * ``` */ export declare const UIMessageCodec: AsyncCodec; /** * Async codec for converting between two formats. * Similar to Codec but decode is async and returns an array. */ type AsyncCodec = { encode: (item: From) => To; decode: (message: To extends UIMessage ? UIMessage : To) => Promise; }; /** * Convert thread history events to AI SDK UIMessages for useChat hook. * * Groups tool calls with their results and attaches them to the preceding * assistant message as parts. * * @example * ```ts * import { historyToUIMessages } from '@kernl-sdk/ai'; * * const thread = await kernl.threads.get("thread_123"); * const messages = historyToUIMessages(thread.history); * ``` */ export declare function historyToUIMessages(items: LanguageModelItem[]): UIMessage[]; export {}; //# sourceMappingURL=ui-message.d.ts.map