/**
 * Profile Detector
 *
 * Determines profile type (settings-based vs account-based) for routing.
 * Priority: settings-based profiles (glm/km) checked FIRST for backward compatibility.
 *
 * Supports dual-mode configuration:
 * - Unified YAML format (config.yaml) when CCS_UNIFIED_CONFIG=1 or config.yaml exists
 * - Legacy JSON format (config.json, profiles.json) as fallback
 */
import { Settings, ProfileMetadata } from '../types';
import { CopilotConfig, CursorConfig, CompositeTierConfig } from '../config/unified-config-types';
import type { CLIProxyProvider } from '../cliproxy/types';
import type { TargetType } from '../targets/target-adapter';
import type { ProfileType } from '../types/profile';
export type { ProfileType } from '../types/profile';
/** CLIProxy profile names (OAuth-based, zero config) */
export declare const CLIPROXY_PROFILES: readonly CLIProxyProvider[];
export type CLIProxyProfileName = CLIProxyProvider;
export interface ProfileDetectionResult {
    type: ProfileType;
    name: string;
    target?: TargetType;
    settingsPath?: string;
    profile?: Settings | ProfileMetadata;
    message?: string;
    /** For cliproxy variants: the underlying provider (gemini, codex, agy, qwen) */
    provider?: CLIProxyProfileName;
    /** For cliproxy variants: dedicated port for isolation (8318-8417) */
    port?: number;
    /** For unified config profiles: merged env vars (config + secrets) */
    env?: Record<string, string>;
    /** For copilot profile: the copilot config */
    copilotConfig?: CopilotConfig;
    /** For cursor profile: the cursor config */
    cursorConfig?: CursorConfig;
    /** For composite variants: true when variant mixes providers per tier */
    isComposite?: boolean;
    /** For composite variants: which tier is the default */
    compositeDefaultTier?: 'opus' | 'sonnet' | 'haiku';
    /** For composite variants: per-tier provider+model mappings */
    compositeTiers?: {
        opus: CompositeTierConfig;
        sonnet: CompositeTierConfig;
        haiku: CompositeTierConfig;
    };
}
export interface AllProfiles {
    settings: string[];
    accounts: string[];
    default?: string;
}
export interface ProfileNotFoundError extends Error {
    profileName: string;
    suggestions: string[];
    availableProfiles: string;
}
/**
 * Profile Detector Class
 */
/**
 * Load env vars from a settings file (*.settings.json).
 * Uses expandPath() for consistent cross-platform path handling.
 * Returns empty object on error.
 */
export declare function loadSettingsFromFile(settingsPath: string): Record<string, string>;
declare class ProfileDetector {
    private readonly configPath;
    private readonly profilesPath;
    constructor();
    /**
     * Load unified config if available.
     * Returns null if not in unified mode or load fails.
     */
    private readUnifiedConfig;
    /**
     * Resolve profile from unified config format.
     * Returns null if profile not found in unified config.
     */
    private resolveFromUnifiedConfig;
    /**
     * Read settings-based config (config.json)
     */
    private readConfig;
    /**
     * Read account-based profiles (profiles.json)
     */
    private readProfiles;
    /**
     * Detect profile type and return routing information
     *
     * Priority order:
     * 0. Hardcoded special runtime profiles (copilot, cursor)
     * 0.5. Hardcoded CLIProxy profiles (gemini, codex, agy, qwen, ...)
     * 1. Unified config profiles (if config.yaml exists or CCS_UNIFIED_CONFIG=1)
     * 2. User-defined CLIProxy variants (config.cliproxy section) [legacy]
     * 3. Settings-based profiles (config.profiles section) [legacy]
     * 4. Account-based profiles (profiles.json) [legacy]
     */
    detectProfileType(profileName: string | null | undefined): ProfileDetectionResult;
    /**
     * Resolve default profile
     */
    private resolveDefaultProfile;
    /**
     * Public wrapper for diagnostics and tooling that need to inspect how
     * plain `ccs` resolves without duplicating the default-profile logic.
     */
    resolveDefaultProfileResult(): ProfileDetectionResult;
    /**
     * List available profiles (for error messages)
     */
    private listAvailableProfiles;
    /**
     * Check if profile exists (any type)
     */
    hasProfile(profileName: string): boolean;
    /**
     * Get all available profile names
     */
    getAllProfiles(): AllProfiles & {
        cliproxy: string[];
        cliproxyVariants: string[];
    };
}
export default ProfileDetector;
//# sourceMappingURL=profile-detector.d.ts.map