import type { GoodVibesConfig, ConfigKey, ConfigValue, ConfigSetting } from '@pellux/goodvibes-sdk/platform/config/schema';
import type { HookDispatcher } from '../hooks/index.js';
/** Deep immutable type — prevents mutation of nested objects returned from getAll(). */
export type DeepReadonly<T> = {
    readonly [K in keyof T]: T[K] extends object ? DeepReadonly<T[K]> : T[K];
};
/** Constructor overrides for CLI args and programmatic instantiation. */
interface ConfigCliOverrides {
    model?: string;
    provider?: string;
    autoApprove?: boolean;
    systemPromptFile?: string;
    workingDir?: string;
    surfaceRoot?: string;
}
export type ConfigOverrides = ConfigCliOverrides & ({
    configDir: string;
    homeDir?: string;
    sharedConfigPath?: string;
} | {
    homeDir: string;
    configDir?: string;
    sharedConfigPath?: string;
});
export interface ConfigSetOptions {
    bypassManagedLock?: boolean;
}
/**
 * ConfigManager — Layered, mutable, persistent config system.
 *
 * Load order: defaults < global surface settings < project surface settings < CLI overrides
 * API keys are never persisted — loaded from env vars only.
 */
export declare class ConfigManager {
    private config;
    private readonly configDir;
    private readonly configPath;
    private readonly projectConfigPath;
    private readonly workingDirectory;
    private readonly homeDirectory;
    private hookDispatcher;
    constructor(overrides: ConfigOverrides);
    getControlPlaneConfigDir(): string;
    getWorkingDirectory(): string | null;
    getHomeDirectory(): string | null;
    attachHookDispatcher(hookDispatcher: Pick<HookDispatcher, 'fire'> | null): void;
    private resolvePath;
    /** Get a config value by dot-path key. */
    get<K extends ConfigKey>(key: K): ConfigValue<K>;
    /** Set a config value by dot-path key and auto-save to disk. */
    set<K extends ConfigKey>(key: K, value: ConfigValue<K>, options?: ConfigSetOptions): void;
    /**
     * Fire the Change:config hook for a config key change.
     * Best-effort: the hook dispatcher may not be initialised during startup.
     */
    private emitConfigHook;
    /**
     * Set a config value from a validated ConfigKey with unknown value type.
     * Used when iterating schema entries where the value type cannot be statically
     * inferred. Runtime validation is still applied by the underlying set() method.
     */
    setDynamic(key: ConfigKey, value: unknown, options?: ConfigSetOptions): void;
    /** Return a deep-readonly snapshot of the full config. Nested objects are immutable. */
    getAll(): DeepReadonly<GoodVibesConfig>;
    /** Return a deep-cloned snapshot of a config category. */
    getCategory<C extends keyof GoodVibesConfig>(category: C): Readonly<GoodVibesConfig[C]>;
    /** Return a deep-cloned snapshot of the live config. Safe for read-only external consumers. */
    getRaw(): Readonly<GoodVibesConfig>;
    /** Return the full schema. */
    getSchema(): ConfigSetting[];
    /** Persist current config to global TUI settings file. */
    save(): void;
    /** Persist current config to the project-level surface settings file. */
    saveProject(): void;
    /** Load config from disk: global then project (project wins). Deep-merges with defaults. */
    load(): void;
    /**
     * Merge a partial patch into a config category and auto-save.
     *
     * This is the correct way to update array or object fields within a category
     * that cannot be expressed as a scalar dot-path key (e.g. notifications.webhookUrls).
     * The patch is shallow-merged into the existing category value.
     */
    mergeCategory<C extends keyof GoodVibesConfig>(category: C, patch: Partial<GoodVibesConfig[C]>): void;
    /**
     * Reset a specific key to its default, or reset all config.
     * Saves to disk after reset.
     */
    reset(key?: ConfigKey): void;
}
export {};
//# sourceMappingURL=manager.d.ts.map