import type { KlawConfig } from "./types.js";
export type RuntimeConfigSnapshotRefreshOptions = {
    includeAuthStoreRefs?: boolean;
};
export type RuntimeConfigSnapshotRefreshParams = RuntimeConfigSnapshotRefreshOptions & {
    sourceConfig: KlawConfig;
};
export type ConfigWriteAfterWrite = {
    mode: "auto";
} | {
    mode: "restart";
    reason: string;
} | {
    mode: "none";
    reason: string;
};
export type ConfigWriteFollowUp = {
    mode: "auto";
    requiresRestart: false;
} | {
    mode: "none";
    reason: string;
    requiresRestart: false;
} | {
    mode: "restart";
    reason: string;
    requiresRestart: true;
};
export declare function resolveConfigWriteAfterWrite(afterWrite?: ConfigWriteAfterWrite): ConfigWriteAfterWrite;
export declare function resolveConfigWriteFollowUp(afterWrite?: ConfigWriteAfterWrite): ConfigWriteFollowUp;
export type RuntimeConfigSnapshotRefreshHandler = {
    refresh: (params: RuntimeConfigSnapshotRefreshParams) => boolean | Promise<boolean>;
    clearOnRefreshFailure?: () => void;
};
export type RuntimeConfigWriteNotification = {
    configPath: string;
    sourceConfig: KlawConfig;
    runtimeConfig: KlawConfig;
    persistedHash: string;
    revision: number;
    fingerprint: string;
    sourceFingerprint: string | null;
    writtenAtMs: number;
    afterWrite?: ConfigWriteAfterWrite;
};
export type RuntimeConfigSnapshotMetadata = {
    revision: number;
    fingerprint: string;
    sourceFingerprint: string | null;
    updatedAtMs: number;
};
export declare function hashRuntimeConfigValue(value: KlawConfig): string;
export declare function setRuntimeConfigSnapshot(config: KlawConfig, sourceConfig?: KlawConfig): void;
export declare function resetConfigRuntimeState(): void;
export declare function clearRuntimeConfigSnapshot(): void;
export declare function getRuntimeConfigSnapshot(): KlawConfig | null;
export declare function getRuntimeConfigSourceSnapshot(): KlawConfig | null;
export declare function getRuntimeConfigSnapshotMetadata(): RuntimeConfigSnapshotMetadata | null;
export declare function resolveRuntimeConfigCacheKey(config: KlawConfig): string;
export declare function createRuntimeConfigWriteNotification(params: {
    configPath: string;
    sourceConfig: KlawConfig;
    runtimeConfig: KlawConfig;
    persistedHash: string;
    writtenAtMs?: number;
    afterWrite?: ConfigWriteAfterWrite;
}): RuntimeConfigWriteNotification;
export declare function selectApplicableRuntimeConfig(params: {
    inputConfig?: KlawConfig;
    runtimeConfig?: KlawConfig | null;
    runtimeSourceConfig?: KlawConfig | null;
}): KlawConfig | undefined;
export declare function setRuntimeConfigSnapshotRefreshHandler(refreshHandler: RuntimeConfigSnapshotRefreshHandler | null): void;
export declare function getRuntimeConfigSnapshotRefreshHandler(): RuntimeConfigSnapshotRefreshHandler | null;
export declare function registerRuntimeConfigWriteListener(listener: (event: RuntimeConfigWriteNotification) => void): () => void;
export declare function notifyRuntimeConfigWriteListeners(event: RuntimeConfigWriteNotification): void;
export declare function loadPinnedRuntimeConfig(loadFresh: () => KlawConfig): KlawConfig;
export declare function finalizeRuntimeSnapshotWrite(params: {
    nextSourceConfig: KlawConfig;
    refreshOptions?: RuntimeConfigSnapshotRefreshOptions;
    hadRuntimeSnapshot: boolean;
    hadBothSnapshots: boolean;
    loadFreshConfig: () => KlawConfig;
    notifyCommittedWrite: () => void;
    createRefreshError: (detail: string, cause: unknown) => Error;
    formatRefreshError: (error: unknown) => string;
}): Promise<void>;
