MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / configToTomlData

Function configToTomlData

packages/agent-core/src/config/toml.ts:460–497  ·  view source on GitHub ↗
(config: KimiConfig)

Source from the content-addressed store, hash-verified

458}
459
460export function configToTomlData(config: KimiConfig): Record<string, unknown> {
461 const out = cloneRecord(config.raw);
462
463 // Strip deprecated fields
464 delete out['default_yolo'];
465 delete out['defaultYolo'];
466 delete out['defaultPermissionMode'];
467 delete out['default_thinking'];
468 delete out['defaultThinking'];
469
470 // Top-level scalar fields
471 const scalarFields: (keyof KimiConfig)[] = [
472 'defaultProvider',
473 'defaultModel',
474 'planMode',
475 'yolo',
476 'defaultPermissionMode',
477 'defaultPlanMode',
478 'mergeAllAvailableSkills',
479 'extraSkillDirs',
480 'telemetry',
481 ];
482 for (const key of scalarFields) {
483 setDefined(out, camelToSnake(key), config[key]);
484 }
485
486 setRecordSection(out, 'providers', config.providers, providerToToml);
487 setRecordSection(out, 'models', config.models, modelToToml);
488 setSection(out, 'thinking', config.thinking, thinkingToToml);
489 setSection(out, 'services', config.services, servicesToToml);
490 setSection(out, 'loop_control', config.loopControl, loopControlToToml);
491 setSection(out, 'background', config.background, backgroundToToml);
492 setSection(out, 'experimental', config.experimental, experimentalToToml);
493 setSection(out, 'permission', config.permission, permissionToToml);
494 setHooks(out, config.hooks);
495
496 return out;
497}
498
499function setRecordSection<T>(
500 out: Record<string, unknown>,

Callers 2

configs.test.tsFile · 0.90
writeConfigFileFunction · 0.85

Calls 6

setDefinedFunction · 0.85
setRecordSectionFunction · 0.85
setSectionFunction · 0.85
setHooksFunction · 0.85
cloneRecordFunction · 0.70
camelToSnakeFunction · 0.70

Tested by

no test coverage detected