import type { AuthCheck, AuthContext, AuthResult, CredentialStore, OAuthCredential, OAuthCredentials } from "@earendil-works/pi-ai";
import { type AnthropicSubscriptionCredential, type ClaudeCliAccountCheck } from "./accounts.ts";
import { type ClaudeCliAuthStatus } from "./claude-cli-auth-status.ts";
import { type ClaudeCliConnectionTestInput, type DefaultModelSelection } from "./claude-cli-connection-test.ts";
import type { ClaudeCliRun } from "./claude-cli-process.ts";
import type { AnthropicSubscriptionProviderSettings } from "./settings.ts";
export type OAuthLoginCallbacks = {
    signal?: AbortSignal;
    onAuth?: (event: {
        url: string;
        instructions?: string;
    }) => void | Promise<void>;
    onPrompt?: (prompt: {
        message: string;
        placeholder?: string;
        signal?: AbortSignal;
    }) => Promise<string>;
    onSelect?: (prompt: {
        message: string;
        options: readonly {
            id: string;
            label: string;
        }[];
        signal?: AbortSignal;
    }) => Promise<string | undefined>;
    onManualCodeInput?: () => Promise<string>;
    onProgress?: (message: string) => void;
};
/** The method select the desktop and remote clients answer by these exact labels. */
export declare const ANTHROPIC_LOGIN_METHOD_PROMPT: {
    readonly message: "Select Anthropic login method:";
    readonly options: readonly [{
        readonly id: "browser";
        readonly label: "Browser login (default)";
    }, {
        readonly id: "copy_code";
        readonly label: "Copy code login (headless)";
    }];
};
/** Everything the CLI sign-in touches, injectable for tests; defaults are the turn path's own boundary. */
export type ClaudeCliLoginDeps = {
    agentDir?: () => string;
    env?: () => NodeJS.ProcessEnv;
    store?: () => CredentialStore;
    executable?: (env: NodeJS.ProcessEnv) => string;
    defaultModel?: () => DefaultModelSelection | undefined;
    providerSettings?: () => AnthropicSubscriptionProviderSettings;
    cwd?: () => string;
    connectionTest?: (input: ClaudeCliConnectionTestInput) => Promise<ClaudeCliAccountCheck>;
    authStatus?: (run: ClaudeCliRun) => Promise<ClaudeCliAuthStatus>;
    now?: () => number;
};
export type CurrentCredentialReader = () => Promise<AnthropicSubscriptionCredential | undefined>;
export type OAuthConfigShape = {
    name: string;
    check(input: {
        ctx: AuthContext;
        credential?: OAuthCredential;
        signal?: AbortSignal;
    }): Promise<AuthCheck | undefined>;
    /**
     * Request auth for the ambient lane — an environment OAuth token or a
     * logged-in Claude CLI — used when auth.json holds no managed accounts.
     * The SDK subprocess authenticates itself in that lane, so the sentinel is
     * the whole credential; without this the provider passes `check` and then
     * fails every request with "Provider is not configured".
     */
    resolveAmbient(input: {
        ctx: AuthContext;
        env?: Record<string, string>;
        signal?: AbortSignal;
    }): Promise<AuthResult | undefined>;
    login(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials>;
    refreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials>;
    getApiKey(credentials: OAuthCredentials): string;
};
export declare const ANTHROPIC_SUBSCRIPTION_NAME = "Anthropic Subscription (Claude Pro/Max)";
export declare function createOAuthConfig(deps: {
    readCurrent: CurrentCredentialReader;
    readAmbientAuthStatus?: (signal?: AbortSignal) => Promise<boolean>;
    readSettings?: () => {
        tokenInjection?: "oauth-slots" | "config-dir" | "ambient";
        enabled?: boolean;
    } | undefined;
    claudeCli?: ClaudeCliLoginDeps;
}): OAuthConfigShape;
//# sourceMappingURL=oauth-login.d.ts.map