import type { AssistantMessage, AssistantMessageEvent } from "@earendil-works/pi-ai";
type EventSource = AsyncIterable<AssistantMessageEvent> & {
    result?: () => Promise<AssistantMessage>;
};
export type RejectableAttempt = {
    stream: EventSource;
    /** The stored OAuth access token this attempt authenticated with, when the provider can refuse it. */
    rejectableAccess?: string;
    /** HTTP statuses that prove `rejectableAccess` was refused (`OAuthAuth.rejectedTokenStatuses`). */
    rejectedTokenStatuses?: readonly number[];
};
/**
 * Runs one request attempt and, when the provider refuses the stored OAuth token
 * before any output reached the caller, runs it exactly once more with that token
 * named as rejected so auth resolution re-exchanges it. GitHub Copilot revokes its
 * short-lived tokens server-side while they still look valid (#2297); VS Code does
 * the same drop-and-refetch on 401/403. Pre-commit frames are held back so the
 * caller sees one stream, never a start from an attempt that was replaced. A
 * provider that declares no refusal statuses gets its own stream back untouched,
 * and `result()` always follows the attempt that ended the request.
 */
export declare function retryOnceOnRejectedToken(attempt: (rejectedAccess: string | undefined) => Promise<RejectableAttempt>): Promise<EventSource>;
export {};
//# sourceMappingURL=rejected-token-retry.d.ts.map