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)
This commit is contained in:
22
src/index.ts
22
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<string, boolean> | 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",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -142,7 +142,6 @@ async function executeSync(
|
||||
tools: {
|
||||
task: false,
|
||||
call_omo_agent: false,
|
||||
background_task: false,
|
||||
},
|
||||
parts: [{ type: "text", text: args.prompt }],
|
||||
},
|
||||
|
||||
@@ -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<string, ToolDefinition> {
|
||||
return {
|
||||
background_task: createBackgroundTask(manager),
|
||||
background_output: createBackgroundOutput(manager, client),
|
||||
background_cancel: createBackgroundCancel(manager, client),
|
||||
}
|
||||
}
|
||||
|
||||
export const builtinTools: Record<string, ToolDefinition> = {
|
||||
lsp_hover,
|
||||
lsp_goto_definition,
|
||||
|
||||
Reference in New Issue
Block a user