/**
 * Unified write-path for model config mutations.
 * Keeps all mutations on one path for model credentials/default/model binding.
 */
import type { ConfiguredModel, LocalRuntimeProtocol } from './config.js';
export interface ModelConfigMutatorOptions {
    configPath?: string;
    onInvalidate?: () => void;
    onWrite?: (models: ConfiguredModel[], rawConfig: Record<string, unknown>) => void;
}
export interface BindDiscoveredModelPatch {
    targetModelId?: string;
    id?: string;
    label?: string;
    aliases?: string[];
    provider?: string;
    role?: string;
    tier?: string;
    backendModel?: string;
    endpoint?: string;
    contextWindow?: number;
    timeoutMs?: number;
    headers?: Record<string, string>;
}
export interface CreateEndpointModelPatch {
    id: string;
    label?: string;
    aliases?: string[];
    provider?: string;
    backendModel?: string;
    endpoint: string;
    apiKey?: string;
    apiKeyEnv?: string;
    headers?: Record<string, string>;
    contextWindow?: number;
    role?: string;
    timeoutMs?: number;
}
export interface UpdateModelFieldsPatch {
    label?: string;
    aliases?: string[];
    provider?: string;
    backendModel?: string;
    endpoint?: string;
    headers?: Record<string, string>;
    contextWindow?: number;
    role?: string;
    timeoutMs?: number;
    default?: never;
    apiKey?: never;
    apiKeyEnv?: never;
    id?: never;
}
export interface UpdateRuntimeSettingsPatch {
    routerUrl?: string;
    localRuntimeProtocol?: LocalRuntimeProtocol;
}
export declare class ModelConfigMutator {
    private readonly configPath;
    private readonly onInvalidate?;
    private readonly onWrite?;
    constructor(options?: ModelConfigMutatorOptions);
    setApiKey(modelId: string, apiKey: string): Promise<void>;
    setApiKeyEnv(modelId: string, envName: string): Promise<void>;
    setDefaultModel(modelId: string): Promise<void>;
    bindDiscoveredModel(discoveredId: string, discoveredPatch?: BindDiscoveredModelPatch): Promise<void>;
    createEndpointModel(patch: CreateEndpointModelPatch): Promise<void>;
    removeModel(modelId: string): Promise<void>;
    updateModelFields(modelId: string, patch: UpdateModelFieldsPatch): Promise<void>;
    updateRuntimeSettings(patch: UpdateRuntimeSettingsPatch): Promise<void>;
    private writeMutatedConfig;
    private writeRawConfigMutation;
    private readConfigFile;
    private writeConfigFile;
}
export declare function normalizeConfigModels(models: ConfiguredModel[]): ConfiguredModel[];
