import { type Logger } from "../../../util/logger.js";
import type { StreamConfig } from "./config.js";
import type { StreamObserver } from "./observer.js";
import type { Tool } from "../../agent/tools2/types.js";
import type { StreamTextProvider, StreamTextOptions, StreamTextResult } from "../interaction/provider.js";
export interface StreamOrchestratorOptions {
    provider: StreamTextProvider;
    config: StreamConfig;
    observers?: StreamObserver[];
    logger: Logger;
    organizationId?: string;
    applicationId?: string;
    getJwt?: () => string | undefined;
}
export type OrchestratorStreamTextOptions<TOOLS extends Record<string, Tool>> = StreamTextOptions<TOOLS> & {
    abortSignal?: AbortSignal;
};
/**
 * The main coordinator for stream operations.
 *
 * Brings together all components:
 * - StreamSession for state management
 * - RetryEngine for retry/fallback decisions
 * - ManagedStream for lifecycle tracking
 * - Observers for side effects
 *
 * @example
 * ```typescript
 * const orchestrator = new StreamOrchestrator({
 *   provider: createVercelProvider(),
 *   config: StreamConfig.create({ provider: "vertex", model: "claude-sonnet-4-5", retry: { maxAttempts: 3 } }),
 *   observers: [new LoggingObserver()],
 *   logger: getLogger(),
 * });
 *
 * const result = await orchestrator.execute({
 *   model,
 *   messages,
 *   tools,
 * });
 *
 * for await (const chunk of result.fullStream) {
 *   console.log(chunk);
 * }
 * ```
 */
export declare class StreamOrchestrator {
    private readonly provider;
    private readonly config;
    private readonly observers;
    private readonly logger;
    private readonly organizationId?;
    private readonly applicationId?;
    private readonly getJwt?;
    constructor(options: StreamOrchestratorOptions);
    execute<TOOLS extends Record<string, Tool>>(options: OrchestratorStreamTextOptions<TOOLS>): Promise<StreamTextResult<TOOLS>>;
    /**
     * Wraps a fullStream with retry logic. When an error occurs (either thrown or
     * as an error chunk), makes a retry decision and either creates a new stream
     * or throws the final error. It catches errors from the managed stream (inner)
     * and decides whether to retry or give up. Session finalization happens here,
     * not in the managed stream. If you add finalization to managed-stream.ts,
     * retries will silently fail (the new stream will close immediately because
     * session.isPending() returns false).
     */
    private wrapWithRetry;
    /**
     * Handle an error by making a retry decision. Returns either a new result to continue
     * with, or the final error to throw.
     */
    private handleRetryDecision;
    private startStreamWithRetry;
    private wrapFinalError;
    private startStream;
    private applyProvider;
    private getFallbackReason;
    private delay;
}
//# sourceMappingURL=orchestrator.d.ts.map