fix(delegate-task): reject when both category and subagent_type provided (fixes #2847)
This commit is contained in:
@@ -102,20 +102,23 @@ export function createDelegateTask(options: DelegateTaskToolOptions): ToolDefini
|
||||
prompt: tool.schema.string().describe("Full detailed prompt for the agent"),
|
||||
run_in_background: tool.schema.boolean().describe("REQUIRED. true=async (returns task_id), false=sync (waits). Use false for task delegation, true ONLY for parallel exploration."),
|
||||
category: tool.schema.string().optional().describe(`REQUIRED if subagent_type not provided. Do NOT provide both category and subagent_type.`),
|
||||
subagent_type: tool.schema.string().optional().describe("REQUIRED if category not provided. Do NOT provide both category and subagent_type."),
|
||||
subagent_type: tool.schema.string().optional().describe("REQUIRED if category not provided. Do NOT provide both category and subagent_type. Valid values: explore, librarian, oracle, metis, momus"),
|
||||
session_id: tool.schema.string().optional().describe("Existing Task session to continue"),
|
||||
command: tool.schema.string().optional().describe("The command that triggered this task"),
|
||||
},
|
||||
async execute(args: DelegateTaskArgs, toolContext) {
|
||||
const ctx = toolContext as ToolContextWithMetadata
|
||||
|
||||
if (args.category && args.subagent_type) {
|
||||
throw new Error(
|
||||
`Invalid arguments: 'category' and 'subagent_type' are mutually exclusive. Provide EXACTLY ONE.\n` +
|
||||
` - You provided: category="${args.category}", subagent_type="${args.subagent_type}"\n` +
|
||||
` - Use category for task delegation (e.g., category="${categoryExamples.split(", ")[0]}")\n` +
|
||||
` - Use subagent_type for direct agent invocation (e.g., subagent_type="explore")\n` +
|
||||
` - Valid subagent_type values: explore, librarian, oracle, metis, momus`
|
||||
)
|
||||
}
|
||||
if (args.category) {
|
||||
if (args.subagent_type && args.subagent_type !== SISYPHUS_JUNIOR_AGENT) {
|
||||
log("[task] category provided - overriding subagent_type to sisyphus-junior", {
|
||||
category: args.category,
|
||||
subagent_type: args.subagent_type,
|
||||
})
|
||||
}
|
||||
args.subagent_type = SISYPHUS_JUNIOR_AGENT
|
||||
}
|
||||
await ctx.metadata?.({
|
||||
|
||||
Reference in New Issue
Block a user