(filePath: string, config: KimiConfig)
| 449 | /* ------------------------------------------------------------------ */ |
| 450 | |
| 451 | export async function writeConfigFile(filePath: string, config: KimiConfig): Promise<void> { |
| 452 | // Final guard: never persist the env-synthesized model/provider to disk, |
| 453 | // even if a caller passes back the runtime config as a patch (see |
| 454 | // stripEnvModelConfig / the getConfig -> setConfig round-trip). |
| 455 | const validated = validateConfig(stripEnvModelConfig(config)); |
| 456 | await mkdir(dirname(filePath), { recursive: true, mode: 0o700 }); |
| 457 | await atomicWrite(filePath, `${stringifyToml(configToTomlData(validated))}\n`); |
| 458 | } |
| 459 | |
| 460 | export function configToTomlData(config: KimiConfig): Record<string, unknown> { |
| 461 | const out = cloneRecord(config.raw); |
no test coverage detected