import type { Codec } from "@kernl-sdk/shared/lib"; import { type LanguageModelStreamEvent } from "@kernl-sdk/protocol"; import { type ThreadStreamEvent } from "kernl"; import { type UIMessageChunk } from "ai"; /** * Convert kernl stream to AI SDK UIMessage stream. * * @example * ```typescript * import { toUIMessageStream } from '@kernl-sdk/ai'; * import { createUIMessageStreamResponse } from 'ai'; * * const stream = agent.stream(input); * const ui = toUIMessageStream(stream); * return createUIMessageStreamResponse({ stream: ui }); * ``` */ export declare function toUIMessageStream(stream: AsyncIterable): ReadableStream; /** * Convert kernl's LanguageModelStreamEvent to AI SDK's UIMessageChunk format. * * This enables streaming kernl agent responses to AI SDK's useChat hook. * * Note: We deliberately omit providerMetadata in the conversion because: * 1. It's optional provider-specific metadata not needed for UI rendering * 2. There's a type incompatibility between SharedProviderMetadata and SharedV2ProviderMetadata * 3. The UI stream is focused on presentation, not provider implementation details */ export declare const STREAM_UI_PART: Codec; //# sourceMappingURL=ui-stream.d.ts.map