export interface GlobalPrefs { /** Foreground-fetch usage when the menu opens. Default: true. */ refreshUsageOnEntry: boolean; /** Show the alt-buffer (full-screen menu) vs scroll-back render. Default: true. */ useAltBuffer: boolean; /** Default for `autoLaunchOnSwitch` when an account has no per-account override. */ defaultAutoLaunchOnSwitch: boolean; /** Default for `autoFlipFallback` when an account has no per-account override. */ defaultAutoFlipFallback: boolean; /** Hide the legacy "Create profile / Import as profile" rows from the profiles screen. Default: true. */ hideManualProfileOps: boolean; } export declare const DEFAULT_GLOBAL_PREFS: GlobalPrefs; export declare function readGlobalPrefs(accountsDirPath: string): GlobalPrefs; export declare function writeGlobalPrefs(accountsDirPath: string, partial: Partial): GlobalPrefs; /** Auth mode for the local fallback proxy. * * - `auto` (default): pick at startup based on token health + saved key. * OAuth healthy AND key saved → effective `oauth-first`. * OAuth healthy AND no key → effective `oauth-only`. * OAuth broken AND key saved → effective `api-first` (token dead, no point probing). * OAuth broken AND no key → error: no auth available. * * - `oauth-first`: explicit. OAuth-first proxy with live retry on * 429/error envelopes; after N consecutive failures it enters a * temporary `api-burst` sub-state and probes OAuth periodically; * when probe returns OK it drops back to oauth-first. This gives * symmetric live recovery in both directions within one `claude` * session. * * - `api-first`: explicit. Always uses the API key, never probes OAuth. * For users who want to bill API credits deliberately, or whose * OAuth subscription is unavailable. * * Note: `oauth-only` exists as a runtime resolution in `auto` mode but * is not exposed as a stored preference — choosing it explicitly is * equivalent to `auto` with no saved API key. */ export type AuthMode = 'auto' | 'oauth-first' | 'api-first'; export interface AccountPrefs { /** Spawn `claude` automatically right after switching to this account. */ autoLaunchOnSwitch: boolean; /** Reset the global fallback flag to match `hasApiKey` when this account becomes active. */ autoFlipFallback: boolean; /** Always launch in isolated mode (per-terminal profile) instead of swapping the global account. */ defaultIsolated: boolean; /** How the local fallback proxy should authenticate this account's traffic. */ authMode: AuthMode; } /** Resolve the effective preferences by composing globals + per-account overrides. */ export declare function resolveAccountPrefs(email: string, accountsDirPath: string): AccountPrefs; /** Stored per-account overrides only — `undefined` means "use global default". */ export interface StoredAccountPrefs { autoLaunchOnSwitch?: boolean; autoFlipFallback?: boolean; defaultIsolated?: boolean; authMode?: AuthMode; } export declare function readStoredAccountPrefs(email: string, accountsDirPath: string): StoredAccountPrefs; /** Effective authentication mode at proxy startup. Same set as `AuthMode` * plus `oauth-only` (proxy uses OAuth, no key fallback) and `error` (no * working auth at all — caller should refuse to start). */ type EffectiveAuthMode = 'oauth-first' | 'oauth-only' | 'api-first' | 'error'; /** Resolve the effective auth mode from the stored preference + the current * token + key state. Pure function — easy to unit-test the matrix. */ export declare function resolveEffectiveAuthMode(input: { authMode: AuthMode; oauthHealthy: boolean; hasApiKey: boolean; }): EffectiveAuthMode; export declare function writeStoredAccountPrefs(email: string, accountsDirPath: string, partial: StoredAccountPrefs): StoredAccountPrefs; export {};