Skip to content

Commit 2073515

Browse files
committed
refactor(tools): update tool exports and main plugin entry
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)
1 parent 069626f commit 2073515

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

src/index.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ import {
4949
import {
5050
builtinTools,
5151
createCallOmoAgent,
52-
createBackgroundTools,
5352
createLookAt,
5453
createSkillTool,
5554
createSkillMcpTool,
@@ -202,7 +201,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
202201
const backgroundNotificationHook = isHookEnabled("background-notification")
203202
? createBackgroundNotificationHook(backgroundManager)
204203
: null;
205-
const backgroundTools = createBackgroundTools(backgroundManager, ctx.client);
206204

207205
const callOmoAgent = createCallOmoAgent(ctx, backgroundManager);
208206
const lookAt = createLookAt(ctx);
@@ -270,7 +268,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
270268

271269
tool: {
272270
...builtinTools,
273-
...backgroundTools,
274271
call_omo_agent: callOmoAgent,
275272
look_at: lookAt,
276273
skill: skillTool,
@@ -440,7 +437,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
440437

441438
args.tools = {
442439
...(args.tools as Record<string, boolean> | undefined),
443-
background_task: false,
444440
...(isExploreOrLibrarian ? { call_omo_agent: false } : {}),
445441
};
446442
}
@@ -488,6 +484,24 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
488484
await agentUsageReminder?.["tool.execute.after"](input, output);
489485
await interactiveBashSession?.["tool.execute.after"](input, output);
490486
await editErrorRecovery?.["tool.execute.after"](input, output);
487+
488+
if (input.tool === "sisyphus_task") {
489+
const result = output.output;
490+
if (result && typeof result === "string") {
491+
const taskIdMatch = result.match(/task[_\s-]?id[:\s]+["']?([a-z0-9_-]+)["']?/i);
492+
const sessionIdMatch = result.match(/session[_\s-]?id[:\s]+["']?([a-z0-9_-]+)["']?/i);
493+
const descriptionMatch = result.match(/description[:\s]+["']?([^"'\n]+)["']?/i);
494+
495+
if (taskIdMatch?.[1] && sessionIdMatch?.[1]) {
496+
backgroundManager.registerExternalTask({
497+
taskId: taskIdMatch[1],
498+
sessionID: sessionIdMatch[1],
499+
parentSessionID: input.sessionID,
500+
description: descriptionMatch?.[1] || "Background task",
501+
});
502+
}
503+
}
504+
}
491505
},
492506
};
493507
};

src/tools/call-omo-agent/tools.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ async function executeSync(
142142
tools: {
143143
task: false,
144144
call_omo_agent: false,
145-
background_task: false,
146145
},
147146
parts: [{ type: "text", text: args.prompt }],
148147
},

src/tools/index.ts

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { ToolDefinition } from "@opencode-ai/plugin"
2+
13
import {
24
lsp_hover,
35
lsp_goto_definition,
@@ -35,28 +37,9 @@ export { createSkillTool } from "./skill"
3537
export { getTmuxPath } from "./interactive-bash/utils"
3638
export { createSkillMcpTool } from "./skill-mcp"
3739

38-
import {
39-
createBackgroundTask,
40-
createBackgroundOutput,
41-
createBackgroundCancel,
42-
} from "./background-task"
43-
44-
import type { PluginInput, ToolDefinition } from "@opencode-ai/plugin"
45-
import type { BackgroundManager } from "../features/background-agent"
46-
47-
type OpencodeClient = PluginInput["client"]
48-
4940
export { createCallOmoAgent } from "./call-omo-agent"
5041
export { createLookAt } from "./look-at"
5142

52-
export function createBackgroundTools(manager: BackgroundManager, client: OpencodeClient): Record<string, ToolDefinition> {
53-
return {
54-
background_task: createBackgroundTask(manager),
55-
background_output: createBackgroundOutput(manager, client),
56-
background_cancel: createBackgroundCancel(manager, client),
57-
}
58-
}
59-
6043
export const builtinTools: Record<string, ToolDefinition> = {
6144
lsp_hover,
6245
lsp_goto_definition,

0 commit comments

Comments
 (0)