import type { ConfigRegistryView } from "../contracts/module-contract.js";
export type ConfigLayerId = "kit-default" | `module:${string}` | `module-file:${string}` | "user" | "project" | "env" | "invocation";
export type ConfigLayer = {
    id: ConfigLayerId;
    data: Record<string, unknown>;
};
/** Effective workspace config: domain keys + optional modules map (project file). */
export type EffectiveWorkspaceConfig = Record<string, unknown>;
export declare const PROJECT_CONFIG_REL = ".workspace-kit/config.json";
export declare function getProjectConfigPath(workspacePath: string): string;
/** Built-in defaults (lowest layer). */
export declare const KIT_CONFIG_DEFAULTS: Record<string, unknown>;
/**
 * Static module-level defaults keyed by module id (merged in registry startup order).
 * Keep true defaults in KIT_CONFIG_DEFAULTS as the canonical source; use this map
 * only when a module contributes additional non-default config structure.
 */
export declare const MODULE_CONFIG_CONTRIBUTIONS: Record<string, Record<string, unknown>>;
export declare function deepMerge(target: Record<string, unknown>, source: Record<string, unknown>): Record<string, unknown>;
export declare function getAtPath(root: Record<string, unknown>, dotted: string): unknown;
export declare function deepEqual(a: unknown, b: unknown): boolean;
/** Resolved home for user-level config (`~/.workspace-kit/config.json`). Override with `WORKSPACE_KIT_HOME` (tests). */
export declare function getUserConfigFilePath(): string;
/** Read `.workspace-kit/config.json` for mutation (validated). Returns `{}` when missing. */
export declare function readProjectConfigDocument(workspacePath: string): Promise<Record<string, unknown>>;
/** Atomically write project config after validation. */
export declare function writeProjectConfigDocument(workspacePath: string, doc: Record<string, unknown>): Promise<void>;
export declare function loadUserLayer(): Promise<ConfigLayer>;
/**
 * Parse WORKSPACE_KIT_* env into a nested object (double-underscore → path under domains).
 * Example: WORKSPACE_KIT_TASKS__STORE_PATH -> { tasks: { storeRelativePath: "..." } }
 * Uses segment after prefix; known domain prefix sets first key.
 */
export declare function envToConfigOverlay(env: NodeJS.ProcessEnv): Record<string, unknown>;
/** Kit defaults + module contributions (topological order). Project/env/invocation added separately. */
export declare function buildBaseConfigLayers(registry: ConfigRegistryView): ConfigLayer[];
export declare function loadProjectLayer(workspacePath: string): Promise<ConfigLayer>;
export declare function mergeConfigLayers(layers: ConfigLayer[]): Record<string, unknown>;
export type ResolveWorkspaceConfigOptions = {
    workspacePath: string;
    registry: ConfigRegistryView;
    env?: NodeJS.ProcessEnv;
    /** Merged last (from `workspace-kit run` top-level `config` key). */
    invocationConfig?: Record<string, unknown>;
};
export declare function resolveWorkspaceConfigWithLayers(options: ResolveWorkspaceConfigOptions): Promise<{
    effective: EffectiveWorkspaceConfig;
    layers: ConfigLayer[];
}>;
/** Atomic write for `.workspace-kit/modules/<moduleId>/config.json` (sorted JSON, trailing newline). */
export declare function writeModuleScopedConfigDocument(workspacePath: string, moduleId: string, doc: Record<string, unknown>): Promise<void>;
export declare function normalizeConfigForExport(value: unknown): unknown;
/** Deterministic JSON for agents and tests (sorted keys, trailing newline). */
export declare function stableStringifyConfig(value: unknown): string;
export type ExplainConfigResult = {
    path: string;
    effectiveValue: unknown;
    winningLayer: ConfigLayerId;
    alternates: {
        layer: ConfigLayerId;
        value: unknown;
    }[];
};
export declare function explainConfigPath(dottedPath: string, layers: ConfigLayer[]): ExplainConfigResult;
