/** * OAuth types for authentication providers */ export interface OAuthCredentials { refresh: string; access: string; expires: number; [key: string]: unknown; } export type OAuthProviderId = string; export interface OAuthAuthInfo { url: string; instructions?: string; } export interface OAuthPrompt { message: string; placeholder?: string; allowEmpty?: boolean; } /** * A selectable authentication mode for an OAuth provider. * Providers that support multiple flows (e.g. browser callback vs. device code) * advertise them via `OAuthProviderInterface.authModes`. The TUI shows a * sub-selector when more than one mode is available so users don't need to * discover the flow through environment variables. */ export interface AuthMode { id: string; name: string; description?: string; } export interface OAuthLoginCallbacks { onAuth: (info: OAuthAuthInfo) => void; onPrompt: (prompt: OAuthPrompt) => Promise; onProgress?: (message: string) => void; onManualCodeInput?: () => Promise; signal?: AbortSignal; /** Selected authentication mode id (matches one of `OAuthProviderInterface.authModes`). */ authMode?: string; } export interface OAuthProviderInterface { readonly id: OAuthProviderId; readonly name: string; /** Whether this provider uses a local callback server (vs manual code paste) */ readonly usesCallbackServer?: boolean; /** * Optional list of selectable auth flows. When set with two or more entries, * the TUI prompts the user to pick a mode before starting the login flow and * forwards the choice via `OAuthLoginCallbacks.authMode`. */ readonly authModes?: ReadonlyArray; /** Run the login flow, return credentials to persist */ login(callbacks: OAuthLoginCallbacks): Promise; /** Refresh expired credentials, return updated credentials to persist */ refreshToken(credentials: OAuthCredentials): Promise; /** Convert credentials to API key string for the provider */ getApiKey(credentials: OAuthCredentials): string; } export type ApiKeyCredential = { type: 'api_key'; key: string; }; export type OAuthCredential = { type: 'oauth'; } & OAuthCredentials; export type AuthCredential = ApiKeyCredential | OAuthCredential; export type AuthStorageData = Record; //# sourceMappingURL=types.d.ts.map