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:
parent
069626f6c0
commit
2073515762
22
src/index.ts
22
src/index.ts
@ -49,7 +49,6 @@ import {
|
|||||||
import {
|
import {
|
||||||
builtinTools,
|
builtinTools,
|
||||||
createCallOmoAgent,
|
createCallOmoAgent,
|
||||||
createBackgroundTools,
|
|
||||||
createLookAt,
|
createLookAt,
|
||||||
createSkillTool,
|
createSkillTool,
|
||||||
createSkillMcpTool,
|
createSkillMcpTool,
|
||||||
@ -202,7 +201,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
const backgroundNotificationHook = isHookEnabled("background-notification")
|
const backgroundNotificationHook = isHookEnabled("background-notification")
|
||||||
? createBackgroundNotificationHook(backgroundManager)
|
? createBackgroundNotificationHook(backgroundManager)
|
||||||
: null;
|
: null;
|
||||||
const backgroundTools = createBackgroundTools(backgroundManager, ctx.client);
|
|
||||||
|
|
||||||
const callOmoAgent = createCallOmoAgent(ctx, backgroundManager);
|
const callOmoAgent = createCallOmoAgent(ctx, backgroundManager);
|
||||||
const lookAt = createLookAt(ctx);
|
const lookAt = createLookAt(ctx);
|
||||||
@ -270,7 +268,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
|
|
||||||
tool: {
|
tool: {
|
||||||
...builtinTools,
|
...builtinTools,
|
||||||
...backgroundTools,
|
|
||||||
call_omo_agent: callOmoAgent,
|
call_omo_agent: callOmoAgent,
|
||||||
look_at: lookAt,
|
look_at: lookAt,
|
||||||
skill: skillTool,
|
skill: skillTool,
|
||||||
@ -440,7 +437,6 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
|
|
||||||
args.tools = {
|
args.tools = {
|
||||||
...(args.tools as Record<string, boolean> | undefined),
|
...(args.tools as Record<string, boolean> | undefined),
|
||||||
background_task: false,
|
|
||||||
...(isExploreOrLibrarian ? { call_omo_agent: false } : {}),
|
...(isExploreOrLibrarian ? { call_omo_agent: false } : {}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -488,6 +484,24 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
await agentUsageReminder?.["tool.execute.after"](input, output);
|
await agentUsageReminder?.["tool.execute.after"](input, output);
|
||||||
await interactiveBashSession?.["tool.execute.after"](input, output);
|
await interactiveBashSession?.["tool.execute.after"](input, output);
|
||||||
await editErrorRecovery?.["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: {
|
tools: {
|
||||||
task: false,
|
task: false,
|
||||||
call_omo_agent: false,
|
call_omo_agent: false,
|
||||||
background_task: false,
|
|
||||||
},
|
},
|
||||||
parts: [{ type: "text", text: args.prompt }],
|
parts: [{ type: "text", text: args.prompt }],
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import type { ToolDefinition } from "@opencode-ai/plugin"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
lsp_hover,
|
lsp_hover,
|
||||||
lsp_goto_definition,
|
lsp_goto_definition,
|
||||||
@ -35,28 +37,9 @@ export { createSkillTool } from "./skill"
|
|||||||
export { getTmuxPath } from "./interactive-bash/utils"
|
export { getTmuxPath } from "./interactive-bash/utils"
|
||||||
export { createSkillMcpTool } from "./skill-mcp"
|
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 { createCallOmoAgent } from "./call-omo-agent"
|
||||||
export { createLookAt } from "./look-at"
|
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> = {
|
export const builtinTools: Record<string, ToolDefinition> = {
|
||||||
lsp_hover,
|
lsp_hover,
|
||||||
lsp_goto_definition,
|
lsp_goto_definition,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user