From 2073515762d3d1ddd57cc5b782b91ae828a80474 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Tue, 6 Jan 2026 15:14:42 +0900 Subject: [PATCH] refactor(tools): update tool exports and main plugin entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update tool index exports and main plugin entry point after background-task tool removal. 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode) --- src/index.ts | 22 ++++++++++++++++++---- src/tools/call-omo-agent/tools.ts | 1 - src/tools/index.ts | 21 ++------------------- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/index.ts b/src/index.ts index 267f36bbc..97eae140c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -49,7 +49,6 @@ import { import { builtinTools, createCallOmoAgent, - createBackgroundTools, createLookAt, createSkillTool, createSkillMcpTool, @@ -202,7 +201,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => { const backgroundNotificationHook = isHookEnabled("background-notification") ? createBackgroundNotificationHook(backgroundManager) : null; - const backgroundTools = createBackgroundTools(backgroundManager, ctx.client); const callOmoAgent = createCallOmoAgent(ctx, backgroundManager); const lookAt = createLookAt(ctx); @@ -270,7 +268,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => { tool: { ...builtinTools, - ...backgroundTools, call_omo_agent: callOmoAgent, look_at: lookAt, skill: skillTool, @@ -440,7 +437,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => { args.tools = { ...(args.tools as Record | undefined), - background_task: false, ...(isExploreOrLibrarian ? { call_omo_agent: false } : {}), }; } @@ -488,6 +484,24 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => { await agentUsageReminder?.["tool.execute.after"](input, output); await interactiveBashSession?.["tool.execute.after"](input, output); await editErrorRecovery?.["tool.execute.after"](input, output); + + if (input.tool === "sisyphus_task") { + const result = output.output; + if (result && typeof result === "string") { + const taskIdMatch = result.match(/task[_\s-]?id[:\s]+["']?([a-z0-9_-]+)["']?/i); + const sessionIdMatch = result.match(/session[_\s-]?id[:\s]+["']?([a-z0-9_-]+)["']?/i); + const descriptionMatch = result.match(/description[:\s]+["']?([^"'\n]+)["']?/i); + + if (taskIdMatch?.[1] && sessionIdMatch?.[1]) { + backgroundManager.registerExternalTask({ + taskId: taskIdMatch[1], + sessionID: sessionIdMatch[1], + parentSessionID: input.sessionID, + description: descriptionMatch?.[1] || "Background task", + }); + } + } + } }, }; }; diff --git a/src/tools/call-omo-agent/tools.ts b/src/tools/call-omo-agent/tools.ts index 3004d33f7..a72c59fa5 100644 --- a/src/tools/call-omo-agent/tools.ts +++ b/src/tools/call-omo-agent/tools.ts @@ -142,7 +142,6 @@ async function executeSync( tools: { task: false, call_omo_agent: false, - background_task: false, }, parts: [{ type: "text", text: args.prompt }], }, diff --git a/src/tools/index.ts b/src/tools/index.ts index 9ad4ceab0..5e3992021 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -1,3 +1,5 @@ +import type { ToolDefinition } from "@opencode-ai/plugin" + import { lsp_hover, lsp_goto_definition, @@ -35,28 +37,9 @@ export { createSkillTool } from "./skill" export { getTmuxPath } from "./interactive-bash/utils" export { createSkillMcpTool } from "./skill-mcp" -import { - createBackgroundTask, - createBackgroundOutput, - createBackgroundCancel, -} from "./background-task" - -import type { PluginInput, ToolDefinition } from "@opencode-ai/plugin" -import type { BackgroundManager } from "../features/background-agent" - -type OpencodeClient = PluginInput["client"] - export { createCallOmoAgent } from "./call-omo-agent" export { createLookAt } from "./look-at" -export function createBackgroundTools(manager: BackgroundManager, client: OpencodeClient): Record { - return { - background_task: createBackgroundTask(manager), - background_output: createBackgroundOutput(manager, client), - background_cancel: createBackgroundCancel(manager, client), - } -} - export const builtinTools: Record = { lsp_hover, lsp_goto_definition,