/**
 * Configuration Service
 *
 * Centralized service for loading, validating, and managing Wave configuration files.
 * Replaces distributed configuration logic previously embedded in hook.ts.
 */
import type { ConfigurationLoadResult, ValidationResult, ConfigurationPaths, WaveConfiguration, Scope } from "../types/configuration.js";
import { type EnvironmentValidationResult, type MergedEnvironmentContext, type EnvironmentMergeOptions } from "../types/environment.js";
import { GatewayConfig, ModelConfig, PermissionMode, AgentOptions } from "../types/index.js";
import { ClientOptions } from "openai";
/**
 * Default ConfigurationService implementation
 *
 * Provides centralized configuration loading, validation, and management.
 * Extracted from distributed logic in hook.ts with improved error handling.
 */
export declare class ConfigurationService {
    private currentConfiguration;
    private options;
    private _configuredEnvKeys;
    /**
     * Set agent options for configuration resolution
     */
    setOptions(options: AgentOptions): void;
    /**
     * Load and merge configuration with comprehensive validation
     */
    loadMergedConfiguration(workdir: string): Promise<ConfigurationLoadResult>;
    /**
     * Validate configuration object structure and values
     */
    validateConfiguration(config: WaveConfiguration): ValidationResult;
    /**
     * Validate configuration file without loading
     */
    validateConfigurationFile(filePath: string): ValidationResult;
    /**
     * Set environment variables from configuration
     * This replaces direct process.env modification
     */
    setEnvironmentVars(env: Record<string, string>): void;
    /**
     * Resolves gateway configuration from constructor args and environment
     * Resolution priority: options > env (from settings.json) > process.env > error
     * @param apiKey - API key override (optional)
     * @param baseURL - Base URL override (optional)
     * @param defaultHeaders - HTTP headers override (optional)
     * @param fetchOptions - Fetch options override (optional)
     * @param fetch - Custom fetch implementation override (optional)
     * @returns Resolved gateway configuration
     * @throws ConfigurationError if required configuration is missing after fallbacks
     */
    resolveGatewayConfig(apiKey?: string, baseURL?: string, defaultHeaders?: Record<string, string>, fetchOptions?: ClientOptions["fetchOptions"], fetch?: ClientOptions["fetch"]): GatewayConfig;
    /**
     * Resolves model configuration with fallbacks
     * Resolution priority: override > options > env (from settings.json) > process.env > default
     * @param model - Agent model override (optional)
     * @param fastModel - Fast model override (optional)
     * @param maxTokens - Max output tokens override (optional)
     * @param permissionMode - Permission mode override (optional)
     * @returns Resolved model configuration with defaults
     */
    resolveModelConfig(model?: string, fastModel?: string, maxTokens?: number, permissionMode?: PermissionMode): ModelConfig;
    /**
     * Resolves token limit with fallbacks
     * Resolution priority: override > options > env (from settings.json) > process.env > default
     * @param constructorLimit - Token limit override (optional)
     * @returns Resolved token limit
     */
    resolveMaxInputTokens(constructorLimit?: number): number;
    /**
     * Resolves preferred language with fallbacks
     * Resolution priority: override > options > settings.json > undefined
     * @param constructorLanguage - Language override (optional)
     * @returns Resolved language or undefined
     */
    resolveLanguage(constructorLanguage?: string): string | undefined;
    /**
     * Resolves auto-memory enabled state with fallbacks
     * Resolution priority: settings.json > WAVE_DISABLE_AUTO_MEMORY > default (true)
     * @returns Resolved auto-memory enabled state
     */
    resolveAutoMemoryEnabled(): boolean;
    /**
     * Resolves auto-memory extraction frequency with fallbacks
     * Resolution priority: settings.json > WAVE_AUTO_MEMORY_FREQUENCY > default (1)
     * @returns Resolved auto-memory extraction frequency (turns)
     */
    resolveAutoMemoryFrequency(): number;
    /**
     * Resolves max output tokens with fallbacks
     * Resolution priority: override > options > env (from settings.json) > process.env > default
     * @param constructorLimit - Max output tokens override (optional)
     * @returns Resolved max output tokens
     */
    resolveMaxOutputTokens(constructorLimit?: number): number;
    /**
     * Set the active model in the session
     */
    setModel(model: string): void;
    /**
     * Get all configured models from settings.json and environment
     */
    getConfiguredModels(): string[];
    /**
     * Resolve all configuration file paths
     */
    getConfigurationPaths(workdir: string): ConfigurationPaths;
    /**
     * Add a permission rule to the local settings.local.json
     */
    addAllowedRule(workdir: string, rule: string): Promise<void>;
    /**
     * Update the enabled state of a plugin in the specified scope
     */
    updateEnabledPlugin(workdir: string, scope: Scope, pluginId: string, enabled: boolean): Promise<void>;
    /**
     * Remove a plugin from the enabled plugins in the specified scope
     */
    removeEnabledPlugin(workdir: string, scope: Scope, pluginId: string): Promise<void>;
    /**
     * Get merged enabled plugins from all scopes
     */
    getMergedEnabledPlugins(workdir: string): Record<string, boolean>;
    /**
     * Load Wave configuration from a JSON file
     * Supports both hooks and environment variables with proper validation
     */
    loadWaveConfigFromFile(filePath: string): WaveConfiguration | null;
}
/**
 * Validate environment variable configuration
 */
export declare function validateEnvironmentConfig(env: unknown, configPath?: string): EnvironmentValidationResult;
/**
 * Merge environment configurations with project taking precedence over user
 */
export declare function mergeEnvironmentConfig(userEnv: Record<string, string> | undefined, projectEnv: Record<string, string> | undefined, options?: EnvironmentMergeOptions): MergedEnvironmentContext;
/**
 * Load Wave configuration from a JSON file
 * Supports both hooks and environment variables with proper validation
 */
export declare function loadWaveConfigFromFile(filePath: string): WaveConfiguration | null;
/**
 * Load and merge Wave configuration from both user and project sources
 * Project configuration takes precedence over user configuration
 * Checks .local.json files first, then falls back to .json files
 */
export declare function loadMergedWaveConfig(workdir: string): WaveConfiguration | null;
//# sourceMappingURL=configurationService.d.ts.map