import { StreamTool, StreamToolCall } from "./streamTool.js";
/**
 * The Operation types wraps a StreamToolCall with metadata on whether
 * it's an update to an existing and / or or a possibly partial (i.e.: incomplete, streaming in progress) operation
 */
type Operation<T extends StreamTool<any>[] | StreamTool<any>> = {
    /**
     * The StreamToolCall (parameters representing a StreamTool invocation)
     */
    operation: StreamToolCall<T>;
    /**
     * Whether this operation is an update to the previous operation
     * (i.e.: the previous operation was a partial operation for which we now have additional data)
     */
    isUpdateToPreviousOperation: boolean;
    /**
     * Whether this operation is a partial operation
     * (i.e.: incomplete, streaming in progress)
     */
    isPossiblyPartial: boolean;
    metadata: any;
};
/**
 * The StreamToolExecutor can apply StreamToolCalls to an editor.
 *
 * It accepts StreamToolCalls as JSON strings or already parsed and validated Operations.
 * Note: When passing JSON strings, the executor will parse and validate them into Operations.
 *       When passing Operations, they're expected to have been validated by the StreamTool instances already.
 *       (StreamTool.validate)
 *
 * Applying the operations is delegated to the StreamTool instances.
 *
 * @example see the `manual-execution` example
 */
export declare class StreamToolExecutor<T extends StreamTool<any>[]> {
    private streamTools;
    private abortSignal?;
    private readonly stream;
    /**
     * @param streamTools - The StreamTools to use to apply the StreamToolCalls
     * @param abortSignal - Optional AbortSignal to cancel ongoing operations
     */
    constructor(streamTools: T, abortSignal?: AbortSignal | undefined);
    private createStream;
    private createExecutor;
    /**
     * Returns a WritableStream that can be used to write StreamToolCalls to the executor.
     *
     * The WriteableStream accepts JSON strings or Operation objects.
     *
     * Make sure to call `close` on the StreamToolExecutor instead of on the writable returned here!
     */
    get writable(): WritableStream<string | Operation<T>>;
    /**
     * Returns a ReadableStream that can be used to read the results of the executor.
     */
    get readable(): ReadableStream<{
        status: "ok";
        chunk: Operation<T>;
    }>;
    finish(): Promise<void>;
    executeOperationsArray(source: AsyncIterable<string>): Promise<undefined>;
    /**
     * Accepts an async iterable and writes each chunk to the internal stream.
     *
     * (alternative to writing to the writable stream using {@link writable})
     */
    execute(source: AsyncIterable<string | Operation<T>>): Promise<void>;
    /**
     * Accepts a single chunk and processes it using the same logic.
     *
     * (alternative to writing to the writable stream using {@link writable})
     */
    executeOne(chunk: StreamToolCall<T>): Promise<void>;
}
export {};
