feat(runtime): wire council command and routing integration

This commit is contained in:
William Valentin
2026-02-21 10:49:20 -08:00
parent 8e89c7ff5d
commit 54cbf17133
4 changed files with 92 additions and 4 deletions
+29 -1
View File
@@ -1,6 +1,6 @@
import { describe, it, expect, vi } from 'vitest';
import { createApproveCommand, createApprovalsCommand, createContextCommand, createDenyCommand, createElevateCommand, createModelCommand, createQueueCommand, createResearchCommand, createSkillCommand, createStopCommand, createTransferCommand } from './index.js';
import { createApproveCommand, createApprovalsCommand, createContextCommand, createCouncilCommand, createDenyCommand, createElevateCommand, createModelCommand, createQueueCommand, createResearchCommand, createSkillCommand, createStopCommand, createTransferCommand } from './index.js';
describe('builtin /model command', () => {
it('passes through the full argument string', async () => {
@@ -66,6 +66,34 @@ describe('builtin /research command', () => {
});
});
describe('builtin /council command', () => {
it('passes the full task to runCouncil', async () => {
const cmd = createCouncilCommand();
const runCouncil = vi.fn(() => 'council output');
const result = await cmd.execute(['design', 'a', 'backup', 'strategy'], {
channel: 'test',
senderId: 'user',
sessionId: 's1',
rawInput: '/council design a backup strategy',
services: { runCouncil },
});
expect(runCouncil).toHaveBeenCalledWith('design a backup strategy');
expect(result).toEqual({ handled: true, text: 'council output' });
});
it('returns usage when no task is provided', async () => {
const cmd = createCouncilCommand();
const result = await cmd.execute([], {
channel: 'test',
senderId: 'user',
sessionId: 's1',
rawInput: '/council',
services: {},
});
expect(result).toEqual({ handled: true, text: 'Usage: /council <question or task>' });
});
});
describe('builtin /elevate command', () => {
it('passes through the full argument string', async () => {
const cmd = createElevateCommand();
+24
View File
@@ -235,6 +235,29 @@ export function createResearchCommand(): CommandDefinition {
};
}
export function createCouncilCommand(): CommandDefinition {
return {
name: 'council',
description: 'Run the D/P councils pipeline for a task',
execute: async (args, ctx) => {
const task = args.join(' ').trim();
if (!task) {
return {
handled: true,
text: 'Usage: /council <question or task>',
};
}
if (!ctx.services?.runCouncil) {
return notAvailable('Council command');
}
return {
handled: true,
text: await ctx.services.runCouncil(task),
};
},
};
}
export function createTransferCommand(): CommandDefinition {
return {
name: 'transfer',
@@ -323,6 +346,7 @@ export function registerBuiltinCommands(registry: CommandRegistry): void {
registry.register(createUsageCommand());
registry.register(createContextCommand());
registry.register(createResearchCommand());
registry.register(createCouncilCommand());
registry.register(createModelCommand());
registry.register(createCompactCommand());
registry.register(createResetCommand());
+1
View File
@@ -27,6 +27,7 @@ export interface CommandServices {
compact?: () => Promise<string> | string;
reset?: () => Promise<string> | string;
delegateAgent?: (agentName: string, task: string) => Promise<string> | string;
runCouncil?: (task: string) => Promise<string> | string;
getElevation?: () => Promise<string> | string;
setElevation?: (input: string) => Promise<string> | string;