From 6c3ef65aed7c57686e6c2a6b21b5bc4e7e40e390 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Mon, 5 Jan 2026 04:56:47 +0900 Subject: [PATCH] fix: add runtime migration for user agent configs in config-handler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migrate tools/permission format in user/project/plugin agent configs based on detected OpenCode version at load time. 🤖 Generated with [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode) --- src/plugin-handlers/config-handler.ts | 41 +++++++++++++++++++++------ 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/src/plugin-handlers/config-handler.ts b/src/plugin-handlers/config-handler.ts index 9feb8ad..32b071a 100644 --- a/src/plugin-handlers/config-handler.ts +++ b/src/plugin-handlers/config-handler.ts @@ -21,6 +21,7 @@ import { loadAllPluginComponents } from "../features/claude-code-plugin-loader"; import { createBuiltinMcps } from "../mcp"; import type { OhMyOpenCodeConfig } from "../config"; import { log } from "../shared"; +import { migrateAgentConfig } from "../shared/permission-compat"; import { PLAN_SYSTEM_PROMPT, PLAN_PERMISSION } from "../agents/plan-prompt"; import type { ModelCacheState } from "../plugin-state"; @@ -95,13 +96,32 @@ export function createConfigHandler(deps: ConfigHandlerDeps) { config.model as string | undefined ); - const userAgents = (pluginConfig.claude_code?.agents ?? true) + const rawUserAgents = (pluginConfig.claude_code?.agents ?? true) ? loadUserAgents() : {}; - const projectAgents = (pluginConfig.claude_code?.agents ?? true) + const rawProjectAgents = (pluginConfig.claude_code?.agents ?? true) ? loadProjectAgents() : {}; - const pluginAgents = pluginComponents.agents; + const rawPluginAgents = pluginComponents.agents; + + const userAgents = Object.fromEntries( + Object.entries(rawUserAgents).map(([k, v]) => [ + k, + v ? migrateAgentConfig(v as Record) : v, + ]) + ); + const projectAgents = Object.fromEntries( + Object.entries(rawProjectAgents).map(([k, v]) => [ + k, + v ? migrateAgentConfig(v as Record) : v, + ]) + ); + const pluginAgents = Object.fromEntries( + Object.entries(rawPluginAgents).map(([k, v]) => [ + k, + v ? migrateAgentConfig(v as Record) : v, + ]) + ); const isSisyphusEnabled = pluginConfig.sisyphus_agent?.disabled !== true; const builderEnabled = @@ -162,15 +182,20 @@ export function createConfigHandler(deps: ConfigHandlerDeps) { : plannerSisyphusBase; } - const filteredConfigAgents = configAgent - ? Object.fromEntries( - Object.entries(configAgent).filter(([key]) => { + const filteredConfigAgents = configAgent + ? Object.fromEntries( + Object.entries(configAgent) + .filter(([key]) => { if (key === "build") return false; if (key === "plan" && replacePlan) return false; return true; }) - ) - : {}; + .map(([key, value]) => [ + key, + value ? migrateAgentConfig(value as Record) : value, + ]) + ) + : {}; config.agent = { ...agentConfig,