import type { AuthType } from './auth-status.js'; export declare const LOGIN_FLOW_TTL_MS: number; export declare class LoginFlowError extends Error { readonly code: string; readonly name = "LoginFlowError"; constructor(code: string, message: string); } export declare function isLoginFlowError(error: unknown): error is LoginFlowError; export type LoginFlowStep = 'select_backend' | 'select_provider' | 'select_auth_type' | 'prompt' | 'running' | 'done' | 'failed' | 'cancelled'; export interface LoginPromptOption { id: string; label: string; description?: string; } export interface LoginPendingPrompt { kind: 'text' | 'secret' | 'select' | 'manual_code'; message: string; options?: LoginPromptOption[]; } export type LoginFlowNotice = { kind: 'info'; message: string; links?: Array<{ url: string; label?: string; }>; } | { kind: 'auth_url'; url: string; instructions?: string; } | { kind: 'device_code'; userCode: string; verificationUri: string; intervalSeconds?: number; expiresInSeconds?: number; } | { kind: 'progress'; message: string; }; export interface LoginOutcome { provider: string; authType: AuthType; expiresAt: string | null; /** Non-secret metadata only; never key or token fragments. */ detail?: string; } export interface LoginFlowState { flowId: string; backend: 'claude' | 'pi'; provider: string | null; authType: AuthType | null; step: LoginFlowStep; pendingPrompt: LoginPendingPrompt | null; notice: LoginFlowNotice | null; channel: string | null; sessionId: string | null; createdAt: string; expiresAt: string; outcome: LoginOutcome | null; error: string | null; errorCode: string | null; } export type AuthPrompt = { signal?: AbortSignal; } & ({ type: 'text'; message: string; placeholder?: string; } | { type: 'secret'; message: string; placeholder?: string; } | { type: 'select'; message: string; options: readonly LoginPromptOption[]; } | { type: 'manual_code'; message: string; placeholder?: string; }); export type AuthEvent = { type: 'info'; message: string; links?: readonly { url: string; label?: string; }[]; } | { type: 'auth_url'; url: string; instructions?: string; } | { type: 'device_code'; userCode: string; verificationUri: string; intervalSeconds?: number; expiresInSeconds?: number; } | { type: 'progress'; message: string; }; export interface AuthInteraction { signal?: AbortSignal; prompt(prompt: AuthPrompt): Promise; notify(event: AuthEvent): void; } export interface StartLoginFlowInput { backend: 'claude' | 'pi'; provider: string; authType: AuthType; channel: string | null; sessionId: string | null; } export type LoginFlowConsumer = (interaction: AuthInteraction) => Promise; export declare function startFlow(input: StartLoginFlowInput, consumer: LoginFlowConsumer): Promise; export declare function respondPrompt(flowId: string, value: string): Promise; export declare function cancelFlow(flowId: string): Promise; export declare function getFlowState(flowId: string): LoginFlowState | null;