feat: wire agent.delegate tool with sub-agent configs
- Export createAgentDelegateTool through builtin/index.ts → tools/index.ts - Register agent.delegate in routing.ts with lazy orchestrator pattern - Add agent.delegate + agents.list to messaging and coding policy profiles - Add group:agents tool group to policy.ts - Add research/code/comms agent config examples to default.yaml - Add research/code/comms agent configs to user config.yaml - Add 11 tests for agent-delegate tool (all pass) - Typecheck clean, no regressions
This commit is contained in:
@@ -357,6 +357,7 @@ describe('configSchema — agent_configs', () => {
|
||||
assistant: {
|
||||
system_prompt: 'You are helpful.',
|
||||
model_tier: 'default',
|
||||
backend: 'codex',
|
||||
tool_profile: 'messaging',
|
||||
},
|
||||
coder: {
|
||||
@@ -367,11 +368,52 @@ describe('configSchema — agent_configs', () => {
|
||||
},
|
||||
});
|
||||
expect(result.agent_configs.assistant.system_prompt).toBe('You are helpful.');
|
||||
expect(result.agent_configs.assistant.backend).toBe('codex');
|
||||
expect(result.agent_configs.assistant.tool_profile).toBe('messaging');
|
||||
expect(result.agent_configs.coder.sandbox).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — backends', () => {
|
||||
const minimalConfig = {
|
||||
telegram: { bot_token: 'test', allowed_chat_ids: [1] },
|
||||
models: { default: { provider: 'anthropic', model: 'claude-3' } },
|
||||
};
|
||||
|
||||
it('defaults backend config fields', () => {
|
||||
const result = configSchema.parse(minimalConfig);
|
||||
expect(result.backends.claude_code.enabled).toBe(false);
|
||||
expect(result.backends.claude_code.args).toEqual([]);
|
||||
expect(result.backends.claude_code.timeout_ms).toBe(120000);
|
||||
expect(result.backends.opencode.enabled).toBe(false);
|
||||
expect(result.backends.opencode.args).toEqual([]);
|
||||
expect(result.backends.codex.enabled).toBe(false);
|
||||
expect(result.backends.gemini.enabled).toBe(false);
|
||||
expect(result.backends.native.enabled).toBe(true);
|
||||
});
|
||||
|
||||
it('accepts explicit codex/gemini backend config', () => {
|
||||
const result = configSchema.parse({
|
||||
...minimalConfig,
|
||||
backends: {
|
||||
default: 'codex',
|
||||
codex: { enabled: true, path: '/usr/local/bin/codex', args: ['run'], timeout_ms: 300000 },
|
||||
gemini: { enabled: true, path: '/usr/local/bin/gemini', args: ['chat'], timeout_ms: 60000 },
|
||||
},
|
||||
});
|
||||
|
||||
expect(result.backends.default).toBe('codex');
|
||||
expect(result.backends.codex.enabled).toBe(true);
|
||||
expect(result.backends.codex.path).toBe('/usr/local/bin/codex');
|
||||
expect(result.backends.codex.args).toEqual(['run']);
|
||||
expect(result.backends.codex.timeout_ms).toBe(300000);
|
||||
expect(result.backends.gemini.enabled).toBe(true);
|
||||
expect(result.backends.gemini.path).toBe('/usr/local/bin/gemini');
|
||||
expect(result.backends.gemini.args).toEqual(['chat']);
|
||||
expect(result.backends.gemini.timeout_ms).toBe(60000);
|
||||
});
|
||||
});
|
||||
|
||||
describe('configSchema — routing', () => {
|
||||
const minimalConfig = {
|
||||
telegram: { bot_token: 'test', allowed_chat_ids: [1] },
|
||||
|
||||
@@ -170,13 +170,30 @@ const modelsSchema = z.object({
|
||||
});
|
||||
|
||||
const backendsSchema = z.object({
|
||||
default: z.enum(['claude_code', 'opencode', 'codex', 'gemini']).optional(),
|
||||
claude_code: z.object({
|
||||
enabled: z.boolean().default(false),
|
||||
path: z.string().optional(),
|
||||
args: z.array(z.string()).default([]),
|
||||
timeout_ms: z.number().min(1_000).max(600_000).default(120_000),
|
||||
}).default({ enabled: false }),
|
||||
opencode: z.object({
|
||||
enabled: z.boolean().default(false),
|
||||
path: z.string().optional(),
|
||||
args: z.array(z.string()).default([]),
|
||||
timeout_ms: z.number().min(1_000).max(600_000).default(120_000),
|
||||
}).default({ enabled: false }),
|
||||
codex: z.object({
|
||||
enabled: z.boolean().default(false),
|
||||
path: z.string().optional(),
|
||||
args: z.array(z.string()).default([]),
|
||||
timeout_ms: z.number().min(1_000).max(600_000).default(120_000),
|
||||
}).default({ enabled: false }),
|
||||
gemini: z.object({
|
||||
enabled: z.boolean().default(false),
|
||||
path: z.string().optional(),
|
||||
args: z.array(z.string()).default([]),
|
||||
timeout_ms: z.number().min(1_000).max(600_000).default(120_000),
|
||||
}).default({ enabled: false }),
|
||||
native: z.object({
|
||||
enabled: z.boolean().default(true),
|
||||
@@ -691,6 +708,7 @@ const sandboxSchema = z.object({
|
||||
const agentConfigEntrySchema = z.object({
|
||||
system_prompt: z.string().optional(),
|
||||
model_tier: modelTierEnum.optional(),
|
||||
backend: z.enum(['native', 'claude_code', 'opencode', 'codex', 'gemini']).optional(),
|
||||
tool_profile: toolProfileEnum.optional(),
|
||||
tool_overrides: toolOverrideSchema.optional(),
|
||||
sandbox: z.boolean().default(false),
|
||||
|
||||
Reference in New Issue
Block a user