import { type AgentProcessAsyncGenerator, type AgentResponseChunk, type AgentResponseStream, type Message } from "../agents/agent.js"; import { type PromiseOrValue } from "./type-utils.js"; import "./stream-polyfill.js"; export declare function objectToAgentResponseStream(json: T): AgentResponseStream; export declare function mergeAgentResponseChunk(output: T, chunk: AgentResponseChunk): T; export declare function agentResponseStreamToObject(stream: AgentResponseStream | AgentProcessAsyncGenerator): Promise; export declare function asyncGeneratorToReadableStream(generator: AgentProcessAsyncGenerator): AgentResponseStream; export declare function onAgentResponseStreamEnd(stream: AgentResponseStream, options?: { onChunk?: (chunk: AgentResponseChunk) => PromiseOrValue | undefined | void>; onResult?: (result: T) => PromiseOrValue | undefined | void>; onError?: (error: Error) => PromiseOrValue; }): AgentResponseStream; export declare function isAsyncGenerator(value: AsyncGenerator | unknown): value is T; export declare function arrayToAgentProcessAsyncGenerator(chunks: (AgentResponseChunk | Error)[], result?: Partial): AgentProcessAsyncGenerator; export declare function arrayToReadableStream(chunks: (T | Error)[]): ReadableStream; export declare function readableStreamToArray(stream: ReadableStream, options: { catchError: true; }): Promise<(T | Error)[]>; export declare function readableStreamToArray(stream: ReadableStream, options?: { catchError?: boolean; }): Promise; export declare function stringToAgentResponseStream(str: string, key?: "text" | string): AgentResponseStream; export declare function toReadableStream(stream: NodeJS.ReadStream): ReadableStream>; export declare function readAllString(stream: NodeJS.ReadStream | ReadableStream): Promise; export declare function mergeReadableStreams(s1: ReadableStream, s2: ReadableStream): ReadableStream; export declare function mergeReadableStreams(...streams: (ReadableStream | undefined)[]): ReadableStream;