/** * loadConfigFromDisk — read /config.yaml (written by `init` / * writer.ts) and merge it over defaultConfig(). Until now the file was * write-only: init produced it but the daemon booted from defaults, so user * edits were silently ignored. * * The parser handles exactly the subset writer.ts emits — nested maps of * scalars (string/number/boolean, single-quoted strings), '#' comments, * blank lines. No lists, no multi-line strings, no anchors; if the file * grows past that, swap in a real YAML package (see writer.ts header). * Unknown keys are ignored; a malformed file logs a warning and falls back * to defaults rather than blocking daemon boot. * * FEAT-433: config is read exactly once per process (there is no live * reload — see resolve-runtime.ts). writer.ts's own writes are fully * torn-proof (tmp+rename), so the remaining race is an EXTERNAL, non-atomic * hand-edit (e.g. an editor that truncates-then-writes) whose save happens * to land mid-boot. Two guarded shapes: * - fully empty/whitespace read → `readConfigFileWithRetry` retries * briefly, then WARNs and falls back to defaults. * - non-empty read that parses to zero keys (cut off before any complete * `key: value` line landed) → WARNs and falls back to defaults. * A partial hand-edit that lands mid-write AFTER at least one complete * top-level line — losing some keys but not all — is NOT distinguishable * from an intentionally minimal config (e.g. a file containing only * `port: 7001`) and is applied without a warning, same as always. Stop the * service before hand-editing config.yaml to avoid that narrow window. * * FEAT-428 (Wave-3: generalized to ALL governance, not just fusion): the * exported `loadConfigFromDisk` is the single choke point for config * governance on the real boot path (serve.ts → resolveRuntimeConfig → * here). Every return value — defaults, a partial merge, or a full merge — * is funneled through `applyAllGovernance` (src/config/config.ts, the same * shared composition `loadConfig()` uses) before it reaches the caller, so a * hand-edited config.yaml with an over-ceiling fusion weight, an * unvalidated `eta > 0`, or any other out-of-union/out-of-range field any * `applyXGovernance` function guards is clamped/dropped exactly like an * in-process `loadConfig()` override would be. */ import { type Config } from './config.js'; type PlainObject = Record; /** Parse the writer.ts YAML subset into a nested plain object. */ export declare function parseConfigYaml(text: string): PlainObject; /** * defaultConfig() with config.yaml (if present and well-formed) merged over * it, then run through `applyAllGovernance` (src/config/config.ts) so every * real boot read gets a governed config — a single choke point, rather than * relying on every future caller to remember to apply it. Never throws — * daemon boot must not be blocked by a bad config file. * * Wave-3 config track: this used to hand-maintain its own copy of the * governance-composition chain, independently of `loadConfig()`'s copy in * config.ts — the two had drifted apart twice (this file's chain was * missing `applyExtractionPassesGovernance` and never governed `audio` at * all; see `applyAllGovernance`'s doc comment for the full incident * writeup). Both now call the one shared function, so this path and * `loadConfig()` can never again silently diverge on which governance * functions run. */ export declare function loadConfigFromDisk(configDir: string, reader?: (path: string) => string): Config; export {};