import type { AgentContinuationOptions } from "@earendil-works/pi-agent-core";
import type { AssistantMessage } from "@earendil-works/pi-ai/compat";
export interface ProviderTimeoutRetryPlan {
    options: AgentContinuationOptions;
    watchdogTimeoutMs: number | undefined;
}
export interface ProviderTimeoutRetryPlanInput {
    message: AssistantMessage;
    streamRetryTimeoutMs: number | undefined;
    timeoutMs: number | undefined;
    streamStartTimeoutMs: number | undefined;
}
export interface BoundedRetryContinuation {
    continueRun(): Promise<void>;
    getActiveSignal(): AbortSignal | undefined;
    abortActive(): void;
    timeoutMs: number | undefined;
    /**
     * Subscribes to the retried request's first stream event (its assistant `message_start`); returns
     * the unsubscribe. Once the request streams, the provider's own idle and stall guards govern the rest
     * of the run, so the watchdog is cleared (senpi#2804).
     */
    onStreamStarted?(listener: () => void): () => void;
}
export declare function createProviderTimeoutRetryPlan({ message, streamRetryTimeoutMs, timeoutMs, streamStartTimeoutMs, }: ProviderTimeoutRetryPlanInput): ProviderTimeoutRetryPlan;
export declare function runBoundedRetryContinuation({ continueRun, getActiveSignal, abortActive, timeoutMs, onStreamStarted, }: BoundedRetryContinuation): Promise<void>;
//# sourceMappingURL=provider-timeout-retry.d.ts.map