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:
YeonGyu-Kim
2025-12-15 19:02:31 +09:00
parent e8e10b9683
commit c2e96f1ffe

View File

@@ -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,