feat(plugin): integrate omo_task tool and prevent recursion in subagents
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)
This commit is contained in:
22
src/index.ts
22
src/index.ts
@@ -36,7 +36,7 @@ import {
|
|||||||
getCurrentSessionTitle,
|
getCurrentSessionTitle,
|
||||||
} from "./features/claude-code-session-state";
|
} from "./features/claude-code-session-state";
|
||||||
import { updateTerminalTitle } from "./features/terminal";
|
import { updateTerminalTitle } from "./features/terminal";
|
||||||
import { builtinTools } from "./tools";
|
import { builtinTools, createOmoTask } from "./tools";
|
||||||
import { createBuiltinMcps } from "./mcp";
|
import { createBuiltinMcps } from "./mcp";
|
||||||
import { OhMyOpenCodeConfigSchema, type OhMyOpenCodeConfig } from "./config";
|
import { OhMyOpenCodeConfigSchema, type OhMyOpenCodeConfig } from "./config";
|
||||||
import { log } from "./shared/logger";
|
import { log } from "./shared/logger";
|
||||||
@@ -162,8 +162,13 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
|
|
||||||
updateTerminalTitle({ sessionId: "main" });
|
updateTerminalTitle({ sessionId: "main" });
|
||||||
|
|
||||||
|
const omoTask = createOmoTask(ctx);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
tool: builtinTools,
|
tool: {
|
||||||
|
...builtinTools,
|
||||||
|
omo_task: omoTask,
|
||||||
|
},
|
||||||
|
|
||||||
"chat.message": async (input, output) => {
|
"chat.message": async (input, output) => {
|
||||||
await claudeCodeHooks["chat.message"]?.(input, output)
|
await claudeCodeHooks["chat.message"]?.(input, output)
|
||||||
@@ -188,6 +193,19 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
|||||||
...config.tools,
|
...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)
|
const mcpResult = (pluginConfig.claude_code?.mcp ?? true)
|
||||||
? await loadMcpConfigs()
|
? await loadMcpConfigs()
|
||||||
: { servers: {} };
|
: { servers: {} };
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import { glob } from "./glob"
|
|||||||
import { slashcommand } from "./slashcommand"
|
import { slashcommand } from "./slashcommand"
|
||||||
import { skill } from "./skill"
|
import { skill } from "./skill"
|
||||||
|
|
||||||
|
export { createOmoTask } from "./omo-task"
|
||||||
|
|
||||||
export const builtinTools = {
|
export const builtinTools = {
|
||||||
lsp_hover,
|
lsp_hover,
|
||||||
lsp_goto_definition,
|
lsp_goto_definition,
|
||||||
|
|||||||
Reference in New Issue
Block a user