import { type APIConnectOptions } from '../types.js';
import type { ChatContext } from './chat_context.js';
import { LLM, LLMStream } from './llm.js';
import type { ToolChoice, ToolContextLike } from './tool_context.js';
/**
 * Internal status tracking for each LLM instance.
 */
interface LLMStatus {
    available: boolean;
    recoveringTask: Promise<void> | null;
}
/**
 * Event emitted when an LLM's availability changes.
 */
export interface AvailabilityChangedEvent {
    llm: LLM;
    available: boolean;
}
/**
 * Options for creating a FallbackAdapter.
 */
export interface FallbackAdapterOptions {
    /** List of LLM instances to fallback to (in order). */
    llms: LLM[];
    /** Timeout for each LLM attempt in seconds. Defaults to 5.0. */
    attemptTimeout?: number;
    /** Internal retries per LLM before moving to next. Defaults to 0. */
    maxRetryPerLLM?: number;
    /** Interval between retries in seconds. Defaults to 0.5. */
    retryInterval?: number;
    /** Whether to retry when LLM fails after chunks are sent. Defaults to false. */
    retryOnChunkSent?: boolean;
}
/**
 * Agent Fallback Adapter for LLM. Manages multiple LLM instances with automatic fallback when the current LLM fails.
 *
 * @example
 * ```typescript
 * const fallbackLLM = new FallbackAdapter({
 *   llms: [primaryLLM, secondaryLLM, tertiaryLLM],
 *   attemptTimeout: 5.0,
 *   maxRetryPerLLM: 1,
 * });
 * ```
 */
export declare class FallbackAdapter extends LLM {
    readonly llms: LLM[];
    readonly attemptTimeout: number;
    readonly maxRetryPerLLM: number;
    readonly retryInterval: number;
    readonly retryOnChunkSent: boolean;
    /** @internal */
    _status: LLMStatus[];
    private logger;
    constructor(options: FallbackAdapterOptions);
    get model(): string;
    label(): string;
    chat(opts: {
        chatCtx: ChatContext;
        toolCtx?: ToolContextLike;
        connOptions?: APIConnectOptions;
        parallelToolCalls?: boolean;
        toolChoice?: ToolChoice;
        extraKwargs?: Record<string, unknown>;
    }): LLMStream;
    /**
     * Emit availability changed event.
     * @internal
     */
    _emitAvailabilityChanged(llm: LLM, available: boolean): void;
}
export {};
//# sourceMappingURL=fallback_adapter.d.ts.map