feat(subagents): complete queue, budgets, audit, and inspection controls
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
|
||||
import { createApproveCommand, createApprovalsCommand, createBackendCommand, createContextCommand, createCouncilCommand, createDenyCommand, createElevateCommand, createModelCommand, createQueueCommand, createResearchCommand, createSkillCommand, createStopCommand, createToolsCommand, createTransferCommand } from './index.js';
|
||||
import { createApproveCommand, createApprovalsCommand, createBackendCommand, createContextCommand, createCouncilCommand, createDenyCommand, createElevateCommand, createModelCommand, createQueueCommand, createResearchCommand, createSkillCommand, createStopCommand, createSubagentsCommand, createToolsCommand, createTransferCommand } from './index.js';
|
||||
|
||||
describe('builtin /model command', () => {
|
||||
it('passes through the full argument string', async () => {
|
||||
@@ -94,6 +94,34 @@ describe('builtin /council command', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('builtin /subagents command', () => {
|
||||
it('passes through raw subcommands', async () => {
|
||||
const cmd = createSubagentsCommand();
|
||||
const subagentsCommand = vi.fn(() => 'subagents listed');
|
||||
const result = await cmd.execute(['summary', 'planner', '10'], {
|
||||
channel: 'test',
|
||||
senderId: 'user',
|
||||
sessionId: 's1',
|
||||
rawInput: '/subagents summary planner 10',
|
||||
services: { subagentsCommand },
|
||||
});
|
||||
expect(subagentsCommand).toHaveBeenCalledWith('summary planner 10');
|
||||
expect(result).toEqual({ handled: true, text: 'subagents listed' });
|
||||
});
|
||||
|
||||
it('returns not-available when service is missing', async () => {
|
||||
const cmd = createSubagentsCommand();
|
||||
const result = await cmd.execute([], {
|
||||
channel: 'test',
|
||||
senderId: 'user',
|
||||
sessionId: 's1',
|
||||
rawInput: '/subagents',
|
||||
services: {},
|
||||
});
|
||||
expect(result).toEqual({ handled: true, text: 'Subagents command is not available in this session.' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('builtin /elevate command', () => {
|
||||
it('passes through the full argument string', async () => {
|
||||
const cmd = createElevateCommand();
|
||||
|
||||
@@ -274,6 +274,22 @@ export function createCouncilCommand(): CommandDefinition {
|
||||
};
|
||||
}
|
||||
|
||||
export function createSubagentsCommand(): CommandDefinition {
|
||||
return {
|
||||
name: 'subagents',
|
||||
description: 'Inspect subagent sessions (list/summary/cancel/delete)',
|
||||
execute: async (args, ctx) => {
|
||||
if (!ctx.services?.subagentsCommand) {
|
||||
return notAvailable('Subagents command');
|
||||
}
|
||||
return {
|
||||
handled: true,
|
||||
text: await ctx.services.subagentsCommand(args.join(' ').trim()),
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function createTransferCommand(): CommandDefinition {
|
||||
return {
|
||||
name: 'transfer',
|
||||
@@ -381,6 +397,7 @@ export function registerBuiltinCommands(registry: CommandRegistry): void {
|
||||
registry.register(createContextCommand());
|
||||
registry.register(createResearchCommand());
|
||||
registry.register(createCouncilCommand());
|
||||
registry.register(createSubagentsCommand());
|
||||
registry.register(createModelCommand());
|
||||
registry.register(createCompactCommand());
|
||||
registry.register(createResetCommand());
|
||||
|
||||
@@ -29,6 +29,7 @@ export interface CommandServices {
|
||||
reset?: () => Promise<string> | string;
|
||||
delegateAgent?: (agentName: string, task: string) => Promise<string> | string;
|
||||
runCouncil?: (task: string) => Promise<string> | string;
|
||||
subagentsCommand?: (input: string) => Promise<string> | string;
|
||||
|
||||
getElevation?: () => Promise<string> | string;
|
||||
setElevation?: (input: string) => Promise<string> | string;
|
||||
|
||||
Reference in New Issue
Block a user