/**
 * Account Safety Guards
 *
 * Prevents Google account bans by:
 * 1. Cross-provider isolation (auto-pause conflicting accounts at launch, restore on exit)
 * 2. Ban/disable detection (auto-pauses affected accounts on error response)
 * 3. Crash recovery (restores stale auto-pauses from dead sessions)
 *
 * Ref: https://github.com/kaitranntt/ccs/issues/509
 */
import { CLIProxyProvider } from '../types';
/**
 * Detect same email registered under multiple Google OAuth providers.
 * This is the primary cause of account bans — Google sees concurrent
 * OAuth usage from different client IDs as suspicious activity.
 *
 * Returns map of email -> providers it appears in (only duplicates).
 */
export declare function detectCrossProviderDuplicates(): Map<string, CLIProxyProvider[]>;
/**
 * Check if a newly registered account creates a cross-provider conflict.
 * Returns the conflicting providers, or null if no conflict.
 */
export declare function checkNewAccountConflict(provider: CLIProxyProvider, email: string | undefined): CLIProxyProvider[] | null;
/**
 * Display cross-provider duplicate warning at session launch.
 * Returns true if warning was shown.
 */
export declare function warnCrossProviderDuplicates(provider: CLIProxyProvider): boolean;
/**
 * Warn about a specific new account conflict during OAuth registration.
 */
export declare function warnNewAccountConflict(email: string, conflictingProviders: CLIProxyProvider[]): void;
/**
 * Show one-time warning for known OAuth ban risk providers.
 */
export declare function warnOAuthBanRisk(provider: CLIProxyProvider): void;
/**
 * Detect whether an error message contains a likely 403/Forbidden ban signal.
 */
export declare function isPossible403BanSignal(errorMessage: string): boolean;
/**
 * Show targeted warning when OAuth provider errors include 403/Forbidden.
 * Returns true when warning was emitted.
 */
export declare function warnPossible403Ban(provider: CLIProxyProvider, errorMessage: string): boolean;
/**
 * Restore auto-paused accounts from crashed sessions (dead PIDs).
 * Call at launch BEFORE enforceProviderIsolation().
 */
export declare function cleanupStaleAutoPauses(): void;
/**
 * Resume quota-paused accounts whose cooldown windows have expired.
 * Auto-resume only applies to pauses created by CCS quota handling.
 */
export declare function restoreExpiredQuotaPauses(now?: number): number;
/**
 * Temporarily remove an exhausted account from CLIProxy rotation for the
 * configured cooldown window. Returns false when the account was already paused
 * or could not be paused, so callers can fall back to in-memory cooldown only.
 */
export declare function pauseAccountForQuotaCooldown(provider: CLIProxyProvider, accountId: string, cooldownMinutes: number, now?: number): boolean;
/**
 * Enforce provider isolation by auto-pausing conflicting accounts in other providers.
 * Records paused accounts for crash recovery and session exit restore.
 * Returns number of accounts paused.
 */
export declare function enforceProviderIsolation(provider: CLIProxyProvider): number;
/**
 * Restore accounts that were auto-paused by this session.
 * Called on session exit (process 'exit' event).
 * Skips accounts re-paused after enforcement (e.g., by ban handler).
 */
export declare function restoreAutoPausedAccounts(provider: CLIProxyProvider): void;
/**
 * Check if an error message indicates an account ban/disable.
 */
export declare function isBanResponse(errorMessage: string): boolean;
/**
 * Handle detected account ban by auto-pausing the affected account.
 * Returns true if account was paused.
 */
export declare function handleBanDetection(provider: CLIProxyProvider, accountId: string, errorMessage: string): boolean;
/** Mask email for privacy in terminal output */
export declare function maskEmail(email: string): string;
/**
 * Write boxed quota warning to stderr (20% threshold).
 * Uses process.stderr.write() to work alongside inherited stdio.
 * ASCII-only output (no emojis) per project constraints.
 */
export declare function writeQuotaWarning(accountId: string, quotaPercent: number): void;
/**
 * Handle quota exhaustion for an active session.
 * Applies cooldown to exhausted account, finds healthy alternative,
 * switches default, and alerts user via stderr.
 *
 * @returns switchedTo account ID or null if no alternatives
 */
export declare function handleQuotaExhaustion(provider: CLIProxyProvider, accountId: string, cooldownMinutes: number): Promise<{
    switchedTo: string | null;
    reason: string;
}>;
//# sourceMappingURL=account-safety.d.ts.map