import type { AgentStreamEvent, RunResult } from "./types.js"; /** * A stream of agent events that also provides access to the final result. * * Supports two usage patterns: * * 1. **Iterate events** — observe progress, show UI, log: * ```typescript * const stream = agent.stream("What is 2+2?"); * for await (const event of stream) { * if (event.type === "text_delta") process.stdout.write(event.text); * } * ``` * * 2. **Iterate events, then get result**: * ```typescript * const stream = agent.stream("What is 2+2?"); * for await (const event of stream) { ... } * const result = await stream.result(); * console.log(result.output); * ``` */ export declare class AgentStream implements AsyncIterable { private generator; private resolvedResult; private resultPromise; private resolveResult; private rejectResult; private iterationStarted; constructor(generator: AsyncGenerator); [Symbol.asyncIterator](): AsyncIterableIterator; /** * Get the final result after the stream completes. * * If the stream hasn't been iterated yet, this will consume it fully. * If the stream has been iterated, returns the captured result. */ result(): Promise>; }