From 9ba001553023af751a69f59ad31d649db4ceca56 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Thu, 11 Dec 2025 15:02:41 +0900 Subject: [PATCH] feat(plugin): integrate omo_task tool and prevent recursion in subagents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Register omo_task tool in main plugin and disable it for explore/librarian agents to prevent infinite recursion. - Export createOmoTask from src/tools/index.ts - Initialize omo_task in main plugin with ctx - Spread omo_task into builtinTools export - Add recursion prevention: disable omo_task tool for explore agent config - Add recursion prevention: disable omo_task tool for librarian agent config 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode) --- src/index.ts | 22 ++++++++++++++++++++-- src/tools/index.ts | 2 ++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index c57da02..4278144 100644 --- a/src/index.ts +++ b/src/index.ts @@ -36,7 +36,7 @@ import { getCurrentSessionTitle, } from "./features/claude-code-session-state"; import { updateTerminalTitle } from "./features/terminal"; -import { builtinTools } from "./tools"; +import { builtinTools, createOmoTask } from "./tools"; import { createBuiltinMcps } from "./mcp"; import { OhMyOpenCodeConfigSchema, type OhMyOpenCodeConfig } from "./config"; import { log } from "./shared/logger"; @@ -162,8 +162,13 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => { updateTerminalTitle({ sessionId: "main" }); + const omoTask = createOmoTask(ctx); + return { - tool: builtinTools, + tool: { + ...builtinTools, + omo_task: omoTask, + }, "chat.message": async (input, output) => { await claudeCodeHooks["chat.message"]?.(input, output) @@ -188,6 +193,19 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => { ...config.tools, }; + if (config.agent.explore) { + config.agent.explore.tools = { + ...config.agent.explore.tools, + omo_task: false, + }; + } + if (config.agent.librarian) { + config.agent.librarian.tools = { + ...config.agent.librarian.tools, + omo_task: false, + }; + } + const mcpResult = (pluginConfig.claude_code?.mcp ?? true) ? await loadMcpConfigs() : { servers: {} }; diff --git a/src/tools/index.ts b/src/tools/index.ts index 3824739..34f54de 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -22,6 +22,8 @@ import { glob } from "./glob" import { slashcommand } from "./slashcommand" import { skill } from "./skill" +export { createOmoTask } from "./omo-task" + export const builtinTools = { lsp_hover, lsp_goto_definition,