fix: enforce disabled_tools filtering

This commit is contained in:
YeonGyu-Kim
2026-02-06 16:18:44 +09:00
parent 3424b16ea0
commit e10974ad50
2 changed files with 298 additions and 12 deletions
+25 -12
View File
@@ -115,6 +115,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
const pluginConfig = loadPluginConfig(ctx.directory, ctx);
const disabledHooks = new Set(pluginConfig.disabled_hooks ?? []);
const disabledTools = new Set(pluginConfig.disabled_tools ?? []);
const firstMessageVariantGate = createFirstMessageVariantGate();
const tmuxConfig = {
@@ -487,19 +488,31 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
}
: {};
const allTools: Record<string, ToolDefinition> = {
...builtinTools,
...backgroundTools,
call_omo_agent: callOmoAgent,
...(lookAt ? { look_at: lookAt } : {}),
delegate_task: delegateTask,
skill: skillTool,
skill_mcp: skillMcpTool,
slashcommand: slashcommandTool,
interactive_bash,
...taskToolsRecord,
};
const filteredTools: Record<string, ToolDefinition> =
disabledTools.size > 0 ? {} : allTools;
if (disabledTools.size > 0) {
for (const [toolName, toolDefinition] of Object.entries(allTools)) {
if (!disabledTools.has(toolName)) {
filteredTools[toolName] = toolDefinition;
}
}
}
return {
tool: {
...builtinTools,
...backgroundTools,
call_omo_agent: callOmoAgent,
...(lookAt ? { look_at: lookAt } : {}),
delegate_task: delegateTask,
skill: skillTool,
skill_mcp: skillMcpTool,
slashcommand: slashcommandTool,
interactive_bash,
...taskToolsRecord,
},
tool: filteredTools,
"chat.message": async (input, output) => {
if (input.agent) {