import { TUNE_DEFAULTS } from '../types/config.js';
/**
 * Resolves tune configuration by merging layers:
 * hardcoded defaults → config top-level → config per-provider → preferences → session
 */
export function resolveTune(appConfig, providerConfig, preferences, sessionOverride) {
    // Start with hardcoded defaults
    let resolved = { ...TUNE_DEFAULTS };
    // Layer: config top-level
    if (appConfig?.tune) {
        resolved = { ...resolved, ...appConfig.tune };
    }
    // Layer: config per-provider
    if (providerConfig?.tune) {
        resolved = { ...resolved, ...providerConfig.tune };
    }
    // Layer: preferences (last-used settings)
    if (preferences?.tune) {
        resolved = { ...resolved, ...preferences.tune };
    }
    // Layer: session override (highest priority)
    if (sessionOverride) {
        resolved = { ...resolved, ...sessionOverride };
    }
    return resolved;
}
//# sourceMappingURL=tune.js.map