fix(call-omo-agent): enforce disabled_agents config (#1716)
## Summary - Added disabled_agents parameter to createCallOmoAgent factory - Check runs after ALLOWED_AGENTS validation, before agent execution - Case-insensitive matching consistent with existing patterns - Clear error message distinguishes 'disabled' from 'invalid agent type' - Threaded disabledAgents config into tool factory from pluginConfig ## Changes - tools.ts: Add disabledAgents parameter and validation check - tool-registry.ts: Pass pluginConfig.disabled_agents to factory
This commit is contained in:
@@ -48,7 +48,7 @@ export function createToolRegistry(args: {
|
||||
const { ctx, pluginConfig, managers, skillContext, availableCategories } = args
|
||||
|
||||
const backgroundTools = createBackgroundTools(managers.backgroundManager, ctx.client)
|
||||
const callOmoAgent = createCallOmoAgent(ctx, managers.backgroundManager)
|
||||
const callOmoAgent = createCallOmoAgent(ctx, managers.backgroundManager, pluginConfig.disabled_agents ?? [])
|
||||
|
||||
const isMultimodalLookerEnabled = !(pluginConfig.disabled_agents ?? []).some(
|
||||
(agent) => agent.toLowerCase() === "multimodal-looker",
|
||||
|
||||
@@ -8,7 +8,8 @@ import { executeSync } from "./sync-executor"
|
||||
|
||||
export function createCallOmoAgent(
|
||||
ctx: PluginInput,
|
||||
backgroundManager: BackgroundManager
|
||||
backgroundManager: BackgroundManager,
|
||||
disabledAgents: string[] = []
|
||||
): ToolDefinition {
|
||||
const agentDescriptions = ALLOWED_AGENTS.map(
|
||||
(name) => `- ${name}: Specialized agent for ${name} tasks`
|
||||
@@ -44,6 +45,11 @@ export function createCallOmoAgent(
|
||||
const normalizedAgent = args.subagent_type.toLowerCase() as AllowedAgentType
|
||||
args = { ...args, subagent_type: normalizedAgent }
|
||||
|
||||
// Check if agent is disabled
|
||||
if (disabledAgents.some((disabled) => disabled.toLowerCase() === normalizedAgent)) {
|
||||
return `Error: Agent "${normalizedAgent}" is disabled via disabled_agents configuration. Remove it from disabled_agents in your oh-my-opencode.json to use it.`
|
||||
}
|
||||
|
||||
if (args.run_in_background) {
|
||||
if (args.session_id) {
|
||||
return `Error: session_id is not supported in background mode. Use run_in_background=false to continue an existing session.`
|
||||
|
||||
Reference in New Issue
Block a user