feat(omo-codex): link bundled component agents into codex home

Discover component .toml agent files and symlink (or copy on Windows)
them into the Codex agents dir during install, recording an installed
agent manifest and wiring agent config_file entries into config.toml.
Add CodexAgentConfig type and support local marketplace source.
This commit is contained in:
YeonGyu-Kim
2026-05-29 11:18:01 +09:00
parent bb8ef30bbe
commit a49acecc3a
12 changed files with 423 additions and 15 deletions
@@ -18,6 +18,7 @@ export async function updateCodexConfig({
marketplaceSource = defaultMarketplaceSource(marketplaceName, repoRoot),
pluginNames,
trustedHookStates = [],
agentConfigs = [],
}) {
await mkdir(dirname(configPath), { recursive: true });
let config = "";
@@ -39,6 +40,9 @@ export async function updateCodexConfig({
for (const state of trustedHookStates) {
config = ensureHookTrusted(config, state.key, state.trustedHash);
}
for (const agentConfig of agentConfigs) {
config = ensureAgentConfig(config, agentConfig);
}
await writeFile(configPath, config.trimEnd() + "\n");
}
@@ -119,6 +123,18 @@ function ensureHookTrusted(config, key, trustedHash) {
return replaceOrInsertSetting(config, section, "trusted_hash", JSON.stringify(trustedHash));
}
function ensureAgentConfig(config, agentConfig) {
const header = `agents.${tomlKeySegment(agentConfig.name)}`;
const section = findTomlSection(config, header);
const configFile = JSON.stringify(agentConfig.configFile);
if (!section) return appendBlock(config, `[${header}]\nconfig_file = ${configFile}\n`);
return replaceOrInsertSetting(config, section, "config_file", configFile);
}
function tomlKeySegment(value) {
return /^[A-Za-z0-9_-]+$/.test(value) ? value : JSON.stringify(value);
}
function removeTomlSections(config, shouldRemove) {
return splitTomlSections(config)
.filter((section) => section.header === null || !shouldRemove(section.header))