/**
 * OAuth Port Diagnostics Module
 *
 * Pre-flight checks for OAuth callback ports to detect conflicts
 * before users attempt authentication.
 *
 * OAuth flows require specific localhost ports for callbacks:
 * - Gemini: 8085
 * - Codex: 1455
 * - Agy: 51121
 * - iFlow: 11451
 * - Kiro: Device Code Flow (no port needed)
 * - Claude: 54545
 * - Qwen: Device Code Flow (no port needed)
 * - GHCP: Device Code Flow (no port needed)
 */
import { PortProcess } from '../utils/port-utils';
import { CLIProxyProvider } from '../cliproxy/types';
import { type OAuthFlowType as ProviderOAuthFlowType } from '../cliproxy/provider-capabilities';
export declare const OAUTH_CALLBACK_PORTS: Record<CLIProxyProvider, number | null>;
/**
 * OAuth flow types
 */
export type OAuthFlowType = ProviderOAuthFlowType;
/**
 * OAuth flow type per provider
 */
export declare const OAUTH_FLOW_TYPES: Record<CLIProxyProvider, OAuthFlowType>;
/**
 * Port diagnostic result
 */
export interface OAuthPortDiagnostic {
    /** Provider name */
    provider: CLIProxyProvider;
    /** OAuth flow type */
    flowType: OAuthFlowType;
    /** Callback port (null for device code flow) */
    port: number | null;
    /** Port status */
    status: 'free' | 'occupied' | 'cliproxy' | 'not_applicable';
    /** Process occupying the port (if any) */
    process: PortProcess | null;
    /** Human-readable status message */
    message: string;
    /** Recommendation for fixing (if issue detected) */
    recommendation: string | null;
}
/**
 * Check OAuth port availability for a single provider
 */
export declare function checkOAuthPort(provider: CLIProxyProvider): Promise<OAuthPortDiagnostic>;
/**
 * Check OAuth ports for all providers
 */
export declare function checkAllOAuthPorts(): Promise<OAuthPortDiagnostic[]>;
/**
 * Check OAuth ports for providers that use Authorization Code flow only
 */
export declare function checkAuthCodePorts(): Promise<OAuthPortDiagnostic[]>;
/**
 * Get providers with port conflicts
 */
export declare function getPortConflicts(): Promise<OAuthPortDiagnostic[]>;
/**
 * Format OAuth port diagnostics for display
 */
export declare function formatOAuthPortDiagnostics(diagnostics: OAuthPortDiagnostic[]): string[];
/**
 * Enhanced pre-flight check result with detailed diagnostics
 */
export interface EnhancedPreflightResult {
    ready: boolean;
    issues: string[];
    checks: PreflightCheck[];
    firewallWarning?: string;
    firewallFixCommand?: string;
}
/**
 * Individual pre-flight check result
 */
export interface PreflightCheck {
    name: string;
    status: 'ok' | 'warn' | 'fail';
    message: string;
    fixCommand?: string;
}
/**
 * Pre-flight check before OAuth - returns issues or empty array if OK
 * @deprecated Use enhancedPreflightOAuthCheck for more detailed diagnostics
 */
export declare function preflightOAuthCheck(provider: CLIProxyProvider): Promise<{
    ready: boolean;
    issues: string[];
}>;
/**
 * Enhanced pre-flight check with detailed step-by-step diagnostics
 * Returns structured results for real-time display
 */
export declare function enhancedPreflightOAuthCheck(provider: CLIProxyProvider): Promise<EnhancedPreflightResult>;
declare const _default: {
    OAUTH_CALLBACK_PORTS: Record<CLIProxyProvider, number | null>;
    OAUTH_FLOW_TYPES: Record<CLIProxyProvider, ProviderOAuthFlowType>;
    checkOAuthPort: typeof checkOAuthPort;
    checkAllOAuthPorts: typeof checkAllOAuthPorts;
    checkAuthCodePorts: typeof checkAuthCodePorts;
    getPortConflicts: typeof getPortConflicts;
    formatOAuthPortDiagnostics: typeof formatOAuthPortDiagnostics;
    preflightOAuthCheck: typeof preflightOAuthCheck;
    enhancedPreflightOAuthCheck: typeof enhancedPreflightOAuthCheck;
};
export default _default;
//# sourceMappingURL=oauth-port-diagnostics.d.ts.map