/**
 * Binary Manager for CLIProxyAPI
 *
 * Facade pattern wrapper for modular binary management.
 * Pattern: Mirrors npm install behavior (fast check, download only when needed)
 */
import { info, warn } from '../utils/ui';
import { BinaryInfo, BinaryManagerConfig } from './types';
import { stopProxy } from './services/proxy-lifecycle-service';
import { waitForPortFree } from '../utils/port-utils';
import { UpdateCheckResult, getPinnedVersion, savePinnedVersion, clearPinnedVersion, isVersionPinned, getVersionPinPath, migrateVersionPin } from './binary';
import type { CLIProxyBackend } from './types';
export declare const CLIPROXY_DELETED_PLUS_REPO = "router-for-me/CLIProxyAPIPlus";
export declare const CLIPROXY_PLUS_FALLBACK_TRACKING_URL = "https://github.com/kaitranntt/ccs/issues/1062";
export declare const CLIPROXY_PLUS_FORK_URL = "https://github.com/kaitranntt/CLIProxyAPIPlus";
export declare const CLIPROXY_PLUS_TRACKING_URL = "https://github.com/kaitranntt/ccs/issues/1065";
export declare function getPlusBackendUnavailableMessage(provider?: string): string;
interface ResolveLocalBackendOptions {
    notifyOnPlus?: boolean;
    warnOnFallback?: boolean;
}
export declare function syncPlusFallbackStateIfNeeded(configuredBackend: CLIProxyBackend): void;
export declare function resolveLocalBackend(backend?: CLIProxyBackend, options?: ResolveLocalBackendOptions): CLIProxyBackend;
export declare function getStoredConfiguredBackend(): CLIProxyBackend;
/**
 * Get backend from config. Plus remains opt-in and resolves to the CCS-maintained
 * community fork instead of degrading to original.
 */
export declare function getConfiguredBackend(options?: ResolveLocalBackendOptions): CLIProxyBackend;
/**
 * Binary Manager class for CLIProxyAPI binary lifecycle
 */
export declare class BinaryManager {
    private config;
    private backend;
    constructor(config?: Partial<BinaryManagerConfig>, backend?: CLIProxyBackend);
    /** Ensure binary is available (download if missing, update if outdated) */
    ensureBinary(): Promise<string>;
    /** Check for updates by comparing installed version with latest release */
    checkForUpdates(): Promise<UpdateCheckResult>;
    /** Get full path to binary executable */
    getBinaryPath(): string;
    /** Check if binary exists */
    isBinaryInstalled(): boolean;
    /** Get binary info if installed */
    getBinaryInfo(): Promise<BinaryInfo | null>;
    /** Delete binary (for cleanup or reinstall) */
    deleteBinary(): void;
}
export interface EnsureCLIProxyBinaryOptions {
    allowInstall?: boolean;
    skipAutoUpdate?: boolean;
}
/** Convenience function respecting version pin */
export declare function ensureCLIProxyBinary(verbose?: boolean, options?: EnsureCLIProxyBinaryOptions): Promise<string>;
/** Check if CLIProxyAPI binary is installed */
export declare function isCLIProxyInstalled(backend?: CLIProxyBackend): boolean;
/** Get CLIProxyAPI binary path (may not exist) */
export declare function getCLIProxyPath(backend?: CLIProxyBackend): string;
/** Get installed CLIProxyAPI version from .version file */
export declare function getInstalledCliproxyVersion(backend?: CLIProxyBackend): string;
interface InstallCliproxyVersionDeps {
    createManager?: (config: Partial<BinaryManagerConfig>, backend: CLIProxyBackend) => Pick<BinaryManager, 'isBinaryInstalled' | 'deleteBinary' | 'ensureBinary'>;
    stopProxyFn?: typeof stopProxy;
    waitForPortFreeFn?: typeof waitForPortFree;
    formatInfo?: typeof info;
    formatWarn?: typeof warn;
    getInstalledVersion?: typeof getInstalledCliproxyVersion;
}
/** Install a specific version of CLIProxyAPI */
export declare function installCliproxyVersion(version: string, verbose?: boolean, backend?: CLIProxyBackend, deps?: InstallCliproxyVersionDeps): Promise<void>;
/** Fetch the latest CLIProxyAPI version from GitHub API */
export declare function fetchLatestCliproxyVersion(backend?: CLIProxyBackend): Promise<string>;
/** Update check result for API response */
export interface CliproxyUpdateCheckResult {
    hasUpdate: boolean;
    currentVersion: string;
    latestVersion: string;
    fromCache: boolean;
    checkedAt: number;
    backend: CLIProxyBackend;
    backendLabel: string;
    isStable: boolean;
    maxStableVersion: string;
    stabilityMessage?: string;
}
/** Check for CLIProxyAPI binary updates */
export declare function checkCliproxyUpdate(backend?: CLIProxyBackend): Promise<CliproxyUpdateCheckResult>;
export { getVersionPinPath, getPinnedVersion, savePinnedVersion, clearPinnedVersion, isVersionPinned, migrateVersionPin, };
export default BinaryManager;
//# sourceMappingURL=binary-manager.d.ts.map