feat(hooks): restrict background_task for task tool subagents
- All subagents: disable background_task to prevent recursive spawning - explore/librarian: additionally disable call_omo_agent - Ensures task-invoked subagents use call_omo_agent instead of background_task 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
12
src/index.ts
12
src/index.ts
@@ -492,6 +492,18 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
await nonInteractiveEnv?.["tool.execute.before"](input, output);
|
||||
await commentChecker?.["tool.execute.before"](input, output);
|
||||
|
||||
if (input.tool === "task") {
|
||||
const args = output.args as Record<string, unknown>;
|
||||
const subagentType = args.subagent_type as string;
|
||||
const isExploreOrLibrarian = ["explore", "librarian"].includes(subagentType);
|
||||
|
||||
args.tools = {
|
||||
...(args.tools as Record<string, boolean> | undefined),
|
||||
background_task: false,
|
||||
...(isExploreOrLibrarian ? { call_omo_agent: false } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
if (input.sessionID === getMainSessionID()) {
|
||||
updateTerminalTitle({
|
||||
sessionId: input.sessionID,
|
||||
|
||||
Reference in New Issue
Block a user