import yaml from "js-yaml"; import type { JinnConfig } from "./types.js"; type ClaudeEngineConfig = JinnConfig["engines"]["claude"]; export declare function normalizeClaudeEngineConfig(raw: ClaudeEngineConfig): Required> & ClaudeEngineConfig; /** * Shape validation for a config.yaml document, on the way in at startup and on * the way out of PUT /api/config. Returns a list of problems (empty = valid). * Near-minimal: the fields whose absence/wrong type would crash the gateway at * startup, plus the engine fallback chains — a chain naming an engine that does * not exist would otherwise fail silently, by never firing. Everything else is * left to downstream defaults. On the write path that line is exactly right — it * accepts everything the loader accepts, and nothing that would leave the * operator with a config.yaml the gateway can no longer boot from. */ export declare function validateConfigShape(config: unknown): string[]; export declare function loadConfig(): JinnConfig; /** The gateway keys JINN_HOST/JINN_PORT may name. */ export interface GatewayBinding { host?: string; port?: number; } /** * The binding the environment names. A container has to bind 0.0.0.0 — its own loopback is * not the published port — but that is a fact about this process, not a choice the user * recorded, and config.yaml outlives it on a volume. saveConfigAtomic keeps it out. */ export declare function gatewayEnvOverrides(env?: NodeJS.ProcessEnv): GatewayBinding; /** Resolve the environment's binding onto a loaded config, in place. */ export declare function applyGatewayEnvOverrides(config: JinnConfig, env?: NodeJS.ProcessEnv): void; /** The binding config.yaml itself records, ignoring the environment. Only well-typed * values are returned, so a hand-broken file cannot be written back verbatim. */ export declare function gatewayFileBinding(configPath?: string): GatewayBinding; /** * Replace any gateway value that came from JINN_HOST/JINN_PORT with what config.yaml * holds, so no writer can persist this process's binding. A value that differs from the * environment's is a deliberate edit and is left alone. */ export declare function withoutGatewayEnvValues(config: T, opts?: { env?: NodeJS.ProcessEnv; file?: GatewayBinding; }): T; export declare const CONFIG_TOP_LEVEL_KEYS: string[]; /** * Atomically persist a config object to config.yaml. The live gateway * hot-reloads config.yaml via a file watcher, so a torn write would be * consumed mid-write — write to a tmp file in the same directory, then rename. * `dumpOptions` is forwarded to yaml.dump so call sites keep their formatting. * * Every writer passes through withoutGatewayEnvValues here rather than remembering to * call it: the leak it prevents was found in two handlers and missed in a third. */ export declare function saveConfigAtomic(config: unknown, dumpOptions?: yaml.DumpOptions): void; export {}; //# sourceMappingURL=config.d.ts.map