beth-copilot 1.0.18 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -28
- package/README.md +87 -247
- package/bin/cli.js +158 -358
- package/dist/__tests__/smoke.test.d.ts +8 -0
- package/dist/__tests__/smoke.test.d.ts.map +1 -0
- package/dist/__tests__/smoke.test.js +49 -0
- package/dist/__tests__/smoke.test.js.map +1 -0
- package/dist/cli/commands/beads.e2e.test.d.ts +13 -0
- package/dist/cli/commands/beads.e2e.test.d.ts.map +1 -0
- package/dist/cli/commands/beads.e2e.test.js +526 -0
- package/dist/cli/commands/beads.e2e.test.js.map +1 -0
- package/dist/cli/commands/cli-edge-cases.e2e.test.d.ts +32 -0
- package/dist/cli/commands/cli-edge-cases.e2e.test.d.ts.map +1 -0
- package/dist/cli/commands/cli-edge-cases.e2e.test.js +162 -0
- package/dist/cli/commands/cli-edge-cases.e2e.test.js.map +1 -0
- package/dist/cli/commands/close.d.ts +89 -0
- package/dist/cli/commands/close.d.ts.map +1 -0
- package/dist/cli/commands/close.e2e.test.d.ts +27 -0
- package/dist/cli/commands/close.e2e.test.d.ts.map +1 -0
- package/dist/cli/commands/close.e2e.test.js +252 -0
- package/dist/cli/commands/close.e2e.test.js.map +1 -0
- package/dist/cli/commands/close.js +309 -0
- package/dist/cli/commands/close.js.map +1 -0
- package/dist/cli/commands/close.test.d.ts +15 -0
- package/dist/cli/commands/close.test.d.ts.map +1 -0
- package/dist/cli/commands/close.test.js +634 -0
- package/dist/cli/commands/close.test.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +23 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +93 -0
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/doctor.test.js +209 -0
- package/dist/cli/commands/doctor.test.js.map +1 -1
- package/dist/cli/commands/framework-isolation.test.d.ts +30 -0
- package/dist/cli/commands/framework-isolation.test.d.ts.map +1 -0
- package/dist/cli/commands/framework-isolation.test.js +119 -0
- package/dist/cli/commands/framework-isolation.test.js.map +1 -0
- package/dist/cli/commands/help.e2e.test.js +4 -4
- package/dist/cli/commands/help.e2e.test.js.map +1 -1
- package/dist/cli/commands/init-logic.e2e.test.d.ts +37 -0
- package/dist/cli/commands/init-logic.e2e.test.d.ts.map +1 -0
- package/dist/cli/commands/init-logic.e2e.test.js +305 -0
- package/dist/cli/commands/init-logic.e2e.test.js.map +1 -0
- package/dist/cli/commands/land.d.ts +142 -0
- package/dist/cli/commands/land.d.ts.map +1 -0
- package/dist/cli/commands/land.js +647 -0
- package/dist/cli/commands/land.js.map +1 -0
- package/dist/cli/commands/land.test.d.ts +20 -0
- package/dist/cli/commands/land.test.d.ts.map +1 -0
- package/dist/cli/commands/land.test.js +622 -0
- package/dist/cli/commands/land.test.js.map +1 -0
- package/dist/cli/commands/mcp.e2e.test.js +22 -29
- package/dist/cli/commands/mcp.e2e.test.js.map +1 -1
- package/dist/cli/commands/pipeline.e2e.test.js +20 -20
- package/dist/cli/commands/pipeline.e2e.test.js.map +1 -1
- package/dist/cli/commands/pre-push-guard.d.ts +84 -0
- package/dist/cli/commands/pre-push-guard.d.ts.map +1 -0
- package/dist/cli/commands/pre-push-guard.e2e.test.d.ts +24 -0
- package/dist/cli/commands/pre-push-guard.e2e.test.d.ts.map +1 -0
- package/dist/cli/commands/pre-push-guard.e2e.test.js +171 -0
- package/dist/cli/commands/pre-push-guard.e2e.test.js.map +1 -0
- package/dist/cli/commands/pre-push-guard.js +257 -0
- package/dist/cli/commands/pre-push-guard.js.map +1 -0
- package/dist/cli/commands/pre-push-guard.test.d.ts +15 -0
- package/dist/cli/commands/pre-push-guard.test.d.ts.map +1 -0
- package/dist/cli/commands/pre-push-guard.test.js +397 -0
- package/dist/cli/commands/pre-push-guard.test.js.map +1 -0
- package/dist/cli/commands/quickstart-expanded.e2e.test.d.ts +23 -0
- package/dist/cli/commands/quickstart-expanded.e2e.test.d.ts.map +1 -0
- package/dist/cli/commands/quickstart-expanded.e2e.test.js +179 -0
- package/dist/cli/commands/quickstart-expanded.e2e.test.js.map +1 -0
- package/dist/cli/commands/quickstart.d.ts.map +1 -1
- package/dist/cli/commands/quickstart.js +7 -23
- package/dist/cli/commands/quickstart.js.map +1 -1
- package/dist/cli/commands/quickstart.test.js +40 -67
- package/dist/cli/commands/quickstart.test.js.map +1 -1
- package/dist/core/agents/suite.test.js +4 -2
- package/dist/core/agents/suite.test.js.map +1 -1
- package/dist/core/agents/tools.test.js +5 -1
- package/dist/core/agents/tools.test.js.map +1 -1
- package/dist/index.d.ts +3 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -10
- package/dist/index.js.map +1 -1
- package/package.json +15 -9
- package/sbom.json +2011 -819
- package/templates/.github/agents/beth.agent.md +220 -66
- package/templates/.github/agents/developer.agent.md +53 -90
- package/templates/.github/agents/product-manager.agent.md +15 -68
- package/templates/.github/agents/researcher.agent.md +20 -71
- package/templates/.github/agents/security-reviewer.agent.md +29 -81
- package/templates/.github/agents/tester.agent.md +40 -69
- package/templates/.github/agents/ux-designer.agent.md +20 -74
- package/templates/.github/copilot-instructions.md +217 -225
- package/templates/AGENTS.md +108 -20
- package/templates/mcp.json.example +0 -3
- package/dist/cli/commands/client-config.d.ts +0 -31
- package/dist/cli/commands/client-config.d.ts.map +0 -1
- package/dist/cli/commands/client-config.e2e.test.d.ts +0 -15
- package/dist/cli/commands/client-config.e2e.test.d.ts.map +0 -1
- package/dist/cli/commands/client-config.e2e.test.js +0 -556
- package/dist/cli/commands/client-config.e2e.test.js.map +0 -1
- package/dist/cli/commands/client-config.js +0 -73
- package/dist/cli/commands/client-config.js.map +0 -1
- package/dist/cli/commands/client-config.test.d.ts +0 -6
- package/dist/cli/commands/client-config.test.d.ts.map +0 -1
- package/dist/cli/commands/client-config.test.js +0 -133
- package/dist/cli/commands/client-config.test.js.map +0 -1
- package/dist/cli/commands/init-quickstart.e2e.test.d.ts +0 -11
- package/dist/cli/commands/init-quickstart.e2e.test.d.ts.map +0 -1
- package/dist/cli/commands/init-quickstart.e2e.test.js +0 -221
- package/dist/cli/commands/init-quickstart.e2e.test.js.map +0 -1
- package/dist/core/context.d.ts +0 -171
- package/dist/core/context.d.ts.map +0 -1
- package/dist/core/context.js +0 -353
- package/dist/core/context.js.map +0 -1
- package/dist/core/context.test.d.ts +0 -8
- package/dist/core/context.test.d.ts.map +0 -1
- package/dist/core/context.test.js +0 -253
- package/dist/core/context.test.js.map +0 -1
- package/dist/core/handoffs.d.ts +0 -151
- package/dist/core/handoffs.d.ts.map +0 -1
- package/dist/core/handoffs.js +0 -220
- package/dist/core/handoffs.js.map +0 -1
- package/dist/core/handoffs.test.d.ts +0 -8
- package/dist/core/handoffs.test.d.ts.map +0 -1
- package/dist/core/handoffs.test.js +0 -231
- package/dist/core/handoffs.test.js.map +0 -1
- package/dist/core/orchestrator.d.ts +0 -246
- package/dist/core/orchestrator.d.ts.map +0 -1
- package/dist/core/orchestrator.js +0 -514
- package/dist/core/orchestrator.js.map +0 -1
- package/dist/core/orchestrator.test.d.ts +0 -8
- package/dist/core/orchestrator.test.d.ts.map +0 -1
- package/dist/core/orchestrator.test.js +0 -517
- package/dist/core/orchestrator.test.js.map +0 -1
- package/dist/core/router.d.ts +0 -102
- package/dist/core/router.d.ts.map +0 -1
- package/dist/core/router.js +0 -178
- package/dist/core/router.js.map +0 -1
- package/dist/core/router.test.d.ts +0 -8
- package/dist/core/router.test.d.ts.map +0 -1
- package/dist/core/router.test.js +0 -215
- package/dist/core/router.test.js.map +0 -1
- package/dist/init.test.js +0 -288
- package/dist/providers/azure.d.ts +0 -147
- package/dist/providers/azure.d.ts.map +0 -1
- package/dist/providers/azure.js +0 -491
- package/dist/providers/azure.js.map +0 -1
- package/dist/providers/azure.test.d.ts +0 -11
- package/dist/providers/azure.test.d.ts.map +0 -1
- package/dist/providers/azure.test.js +0 -330
- package/dist/providers/azure.test.js.map +0 -1
- package/dist/providers/config.d.ts +0 -87
- package/dist/providers/config.d.ts.map +0 -1
- package/dist/providers/config.js +0 -193
- package/dist/providers/config.js.map +0 -1
- package/dist/providers/config.test.d.ts +0 -7
- package/dist/providers/config.test.d.ts.map +0 -1
- package/dist/providers/config.test.js +0 -370
- package/dist/providers/config.test.js.map +0 -1
- package/dist/providers/index.d.ts +0 -18
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js +0 -14
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/interface.d.ts +0 -191
- package/dist/providers/interface.d.ts.map +0 -1
- package/dist/providers/interface.js +0 -94
- package/dist/providers/interface.js.map +0 -1
- package/dist/providers/retry.d.ts +0 -128
- package/dist/providers/retry.d.ts.map +0 -1
- package/dist/providers/retry.js +0 -205
- package/dist/providers/retry.js.map +0 -1
- package/dist/providers/retry.test.d.ts +0 -7
- package/dist/providers/retry.test.d.ts.map +0 -1
- package/dist/providers/retry.test.js +0 -439
- package/dist/providers/retry.test.js.map +0 -1
- package/dist/providers/streaming.d.ts +0 -157
- package/dist/providers/streaming.d.ts.map +0 -1
- package/dist/providers/streaming.js +0 -233
- package/dist/providers/streaming.js.map +0 -1
- package/dist/providers/streaming.test.d.ts +0 -7
- package/dist/providers/streaming.test.d.ts.map +0 -1
- package/dist/providers/streaming.test.js +0 -372
- package/dist/providers/streaming.test.js.map +0 -1
- package/dist/providers/types.d.ts +0 -209
- package/dist/providers/types.d.ts.map +0 -1
- package/dist/providers/types.js +0 -53
- package/dist/providers/types.js.map +0 -1
- package/dist/providers/types.test.d.ts +0 -7
- package/dist/providers/types.test.d.ts.map +0 -1
- package/dist/providers/types.test.js +0 -141
- package/dist/providers/types.test.js.map +0 -1
- package/dist/tools/cli/beads.d.ts +0 -27
- package/dist/tools/cli/beads.d.ts.map +0 -1
- package/dist/tools/cli/beads.js +0 -172
- package/dist/tools/cli/beads.js.map +0 -1
- package/dist/tools/cli/beads.test.d.ts +0 -8
- package/dist/tools/cli/beads.test.d.ts.map +0 -1
- package/dist/tools/cli/beads.test.js +0 -264
- package/dist/tools/cli/beads.test.js.map +0 -1
- package/dist/tools/cli/editFile.d.ts +0 -17
- package/dist/tools/cli/editFile.d.ts.map +0 -1
- package/dist/tools/cli/editFile.js +0 -125
- package/dist/tools/cli/editFile.js.map +0 -1
- package/dist/tools/cli/editFile.test.d.ts +0 -8
- package/dist/tools/cli/editFile.test.d.ts.map +0 -1
- package/dist/tools/cli/editFile.test.js +0 -177
- package/dist/tools/cli/editFile.test.js.map +0 -1
- package/dist/tools/cli/readFile.d.ts +0 -25
- package/dist/tools/cli/readFile.d.ts.map +0 -1
- package/dist/tools/cli/readFile.js +0 -118
- package/dist/tools/cli/readFile.js.map +0 -1
- package/dist/tools/cli/readFile.test.d.ts +0 -8
- package/dist/tools/cli/readFile.test.d.ts.map +0 -1
- package/dist/tools/cli/readFile.test.js +0 -194
- package/dist/tools/cli/readFile.test.js.map +0 -1
- package/dist/tools/cli/search.d.ts +0 -16
- package/dist/tools/cli/search.d.ts.map +0 -1
- package/dist/tools/cli/search.js +0 -261
- package/dist/tools/cli/search.js.map +0 -1
- package/dist/tools/cli/search.test.d.ts +0 -8
- package/dist/tools/cli/search.test.d.ts.map +0 -1
- package/dist/tools/cli/search.test.js +0 -172
- package/dist/tools/cli/search.test.js.map +0 -1
- package/dist/tools/cli/subagent.d.ts +0 -43
- package/dist/tools/cli/subagent.d.ts.map +0 -1
- package/dist/tools/cli/subagent.js +0 -99
- package/dist/tools/cli/subagent.js.map +0 -1
- package/dist/tools/cli/subagent.test.d.ts +0 -8
- package/dist/tools/cli/subagent.test.d.ts.map +0 -1
- package/dist/tools/cli/subagent.test.js +0 -190
- package/dist/tools/cli/subagent.test.js.map +0 -1
- package/dist/tools/cli/terminal.d.ts +0 -19
- package/dist/tools/cli/terminal.d.ts.map +0 -1
- package/dist/tools/cli/terminal.js +0 -164
- package/dist/tools/cli/terminal.js.map +0 -1
- package/dist/tools/cli/terminal.test.d.ts +0 -8
- package/dist/tools/cli/terminal.test.d.ts.map +0 -1
- package/dist/tools/cli/terminal.test.js +0 -161
- package/dist/tools/cli/terminal.test.js.map +0 -1
- package/dist/tools/index.d.ts +0 -25
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -41
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/interface.d.ts +0 -64
- package/dist/tools/interface.d.ts.map +0 -1
- package/dist/tools/interface.js +0 -37
- package/dist/tools/interface.js.map +0 -1
- package/dist/tools/interface.test.d.ts +0 -7
- package/dist/tools/interface.test.d.ts.map +0 -1
- package/dist/tools/interface.test.js +0 -179
- package/dist/tools/interface.test.js.map +0 -1
- package/dist/tools/mcp/bridge.d.ts +0 -48
- package/dist/tools/mcp/bridge.d.ts.map +0 -1
- package/dist/tools/mcp/bridge.js +0 -128
- package/dist/tools/mcp/bridge.js.map +0 -1
- package/dist/tools/mcp/bridge.test.d.ts +0 -8
- package/dist/tools/mcp/bridge.test.d.ts.map +0 -1
- package/dist/tools/mcp/bridge.test.js +0 -300
- package/dist/tools/mcp/bridge.test.js.map +0 -1
- package/dist/tools/mcp/client.d.ts +0 -135
- package/dist/tools/mcp/client.d.ts.map +0 -1
- package/dist/tools/mcp/client.js +0 -263
- package/dist/tools/mcp/client.js.map +0 -1
- package/dist/tools/mcp/client.test.d.ts +0 -8
- package/dist/tools/mcp/client.test.d.ts.map +0 -1
- package/dist/tools/mcp/client.test.js +0 -390
- package/dist/tools/mcp/client.test.js.map +0 -1
- package/dist/tools/registry.d.ts +0 -82
- package/dist/tools/registry.d.ts.map +0 -1
- package/dist/tools/registry.js +0 -99
- package/dist/tools/registry.js.map +0 -1
- package/dist/tools/registry.test.d.ts +0 -7
- package/dist/tools/registry.test.d.ts.map +0 -1
- package/dist/tools/registry.test.js +0 -199
- package/dist/tools/registry.test.js.map +0 -1
- package/dist/tools/suite.test.d.ts +0 -11
- package/dist/tools/suite.test.d.ts.map +0 -1
- package/dist/tools/suite.test.js +0 -119
- package/dist/tools/suite.test.js.map +0 -1
- package/dist/tools/types.d.ts +0 -75
- package/dist/tools/types.d.ts.map +0 -1
- package/dist/tools/types.js +0 -30
- package/dist/tools/types.js.map +0 -1
- package/dist/tools/types.test.d.ts +0 -7
- package/dist/tools/types.test.d.ts.map +0 -1
- package/dist/tools/types.test.js +0 -178
- package/dist/tools/types.test.js.map +0 -1
- package/templates/.vscode/mcp.json +0 -20
- package/templates/CLAUDE.md +0 -129
|
@@ -1,517 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Orchestrator Tests
|
|
3
|
-
*
|
|
4
|
-
* Integration tests for the full agent loop: routing → LLM → tool calls → response.
|
|
5
|
-
* Uses mock LLM provider and tools to verify the orchestration flow.
|
|
6
|
-
*/
|
|
7
|
-
import { describe, it } from 'node:test';
|
|
8
|
-
import assert from 'node:assert';
|
|
9
|
-
import { Orchestrator } from './orchestrator.js';
|
|
10
|
-
import { LLMProviderBase } from '../providers/interface.js';
|
|
11
|
-
import { ToolRegistry } from '../tools/registry.js';
|
|
12
|
-
// =============================================================================
|
|
13
|
-
// Mock LLM Provider
|
|
14
|
-
// =============================================================================
|
|
15
|
-
/** Minimal TokenCredential stub for tests */
|
|
16
|
-
const mockCredential = { getToken: async () => ({ token: 'test', expiresOnTimestamp: Date.now() + 3600000 }) };
|
|
17
|
-
/**
|
|
18
|
-
* A mock LLM provider that returns predetermined responses.
|
|
19
|
-
* Extends LLMProviderBase so it satisfies the type hierarchy.
|
|
20
|
-
*/
|
|
21
|
-
class MockProvider extends LLMProviderBase {
|
|
22
|
-
responses = [];
|
|
23
|
-
callCount = 0;
|
|
24
|
-
chatCallCount = 0;
|
|
25
|
-
constructor() {
|
|
26
|
-
super({
|
|
27
|
-
provider: 'azure-openai',
|
|
28
|
-
model: 'test-model',
|
|
29
|
-
endpoint: 'https://test.openai.azure.com',
|
|
30
|
-
credential: mockCredential,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
get name() { return 'mock'; }
|
|
34
|
-
get isConfigured() { return true; }
|
|
35
|
-
/** Queue a text response */
|
|
36
|
-
addTextResponse(content) {
|
|
37
|
-
this.responses.push({ content });
|
|
38
|
-
}
|
|
39
|
-
/** Queue a tool call response */
|
|
40
|
-
addToolCallResponse(toolCalls, content) {
|
|
41
|
-
this.responses.push({ content: content ?? '', toolCalls });
|
|
42
|
-
}
|
|
43
|
-
async chat(_messages, _options) {
|
|
44
|
-
this.chatCallCount++;
|
|
45
|
-
const response = this.responses[this.callCount++];
|
|
46
|
-
if (!response) {
|
|
47
|
-
return {
|
|
48
|
-
id: `resp-${this.callCount}`,
|
|
49
|
-
choices: [{ index: 0, message: { role: 'assistant', content: 'No more responses queued.' }, finish_reason: 'stop' }],
|
|
50
|
-
usage: { prompt_tokens: 10, completion_tokens: 5, total_tokens: 15 },
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
const message = {
|
|
54
|
-
role: 'assistant',
|
|
55
|
-
content: response.content,
|
|
56
|
-
tool_calls: response.toolCalls,
|
|
57
|
-
};
|
|
58
|
-
return {
|
|
59
|
-
id: `resp-${this.callCount}`,
|
|
60
|
-
choices: [{ index: 0, message, finish_reason: response.toolCalls ? 'tool_calls' : 'stop' }],
|
|
61
|
-
usage: { prompt_tokens: 10, completion_tokens: 5, total_tokens: 15 },
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
async *chatStream(messages, options) {
|
|
65
|
-
const response = await this.chat(messages, options);
|
|
66
|
-
const choice = response.choices[0];
|
|
67
|
-
yield {
|
|
68
|
-
id: response.id,
|
|
69
|
-
content: choice.message.content,
|
|
70
|
-
role: 'assistant',
|
|
71
|
-
finish_reason: choice.finish_reason,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
async countTokens(_messages) {
|
|
75
|
-
return 100;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
// =============================================================================
|
|
79
|
-
// Test Fixtures
|
|
80
|
-
// =============================================================================
|
|
81
|
-
function createAgent(id, name, tools, infer) {
|
|
82
|
-
return {
|
|
83
|
-
id,
|
|
84
|
-
frontmatter: {
|
|
85
|
-
name,
|
|
86
|
-
description: `${name} agent`,
|
|
87
|
-
tools: tools ?? ['readFile', 'editFiles'],
|
|
88
|
-
infer: infer ?? true,
|
|
89
|
-
handoffs: [],
|
|
90
|
-
},
|
|
91
|
-
body: `# ${name}\n\nYou are ${name}.`,
|
|
92
|
-
sourcePath: `/agents/${id}.agent.md`,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
function createSkill(id, triggers) {
|
|
96
|
-
return {
|
|
97
|
-
id,
|
|
98
|
-
frontmatter: { name: id, description: `Triggers on: ${triggers.join(', ')}` },
|
|
99
|
-
body: `Skill content for ${id}`,
|
|
100
|
-
sourcePath: `/skills/${id}/SKILL.md`,
|
|
101
|
-
triggers,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
/** Create a simple echo tool for testing */
|
|
105
|
-
function createEchoTool() {
|
|
106
|
-
return {
|
|
107
|
-
name: 'echo',
|
|
108
|
-
description: 'Echoes input back',
|
|
109
|
-
inputSchema: {
|
|
110
|
-
type: 'object',
|
|
111
|
-
properties: { message: { type: 'string', description: 'Message to echo' } },
|
|
112
|
-
required: ['message'],
|
|
113
|
-
},
|
|
114
|
-
async execute(input) {
|
|
115
|
-
return { success: true, output: `Echo: ${input.message}` };
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
/** Create a readFile tool stub for testing */
|
|
120
|
-
function createReadFileTool() {
|
|
121
|
-
return {
|
|
122
|
-
name: 'readFile',
|
|
123
|
-
description: 'Read a file',
|
|
124
|
-
inputSchema: {
|
|
125
|
-
type: 'object',
|
|
126
|
-
properties: { path: { type: 'string', description: 'File path' } },
|
|
127
|
-
required: ['path'],
|
|
128
|
-
},
|
|
129
|
-
async execute(input) {
|
|
130
|
-
return { success: true, output: `Contents of ${input.path}` };
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
/** Create a subagent tool stub that returns pending metadata */
|
|
135
|
-
function createSubagentTool() {
|
|
136
|
-
return {
|
|
137
|
-
name: 'subagent',
|
|
138
|
-
description: 'Spawn a subagent',
|
|
139
|
-
inputSchema: {
|
|
140
|
-
type: 'object',
|
|
141
|
-
properties: {
|
|
142
|
-
agentName: { type: 'string' },
|
|
143
|
-
prompt: { type: 'string' },
|
|
144
|
-
description: { type: 'string' },
|
|
145
|
-
},
|
|
146
|
-
required: ['agentName', 'prompt'],
|
|
147
|
-
},
|
|
148
|
-
async execute(input) {
|
|
149
|
-
return {
|
|
150
|
-
success: true,
|
|
151
|
-
output: `Subagent request: ${input.agentName}`,
|
|
152
|
-
metadata: {
|
|
153
|
-
agentName: input.agentName,
|
|
154
|
-
prompt: input.prompt,
|
|
155
|
-
description: input.description,
|
|
156
|
-
status: 'pending',
|
|
157
|
-
},
|
|
158
|
-
};
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
function createToolContext() {
|
|
163
|
-
return {
|
|
164
|
-
workingDir: '/test',
|
|
165
|
-
permissions: {
|
|
166
|
-
allowFileRead: true,
|
|
167
|
-
allowFileWrite: true,
|
|
168
|
-
allowTerminal: true,
|
|
169
|
-
allowNetwork: true,
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
function createOrchestratorConfig(provider, registry, agents, skills) {
|
|
174
|
-
const agentList = agents ?? [
|
|
175
|
-
createAgent('beth', 'Beth'),
|
|
176
|
-
createAgent('developer', 'developer'),
|
|
177
|
-
createAgent('tester', 'tester'),
|
|
178
|
-
];
|
|
179
|
-
return {
|
|
180
|
-
agents: { agents: agentList, errors: [] },
|
|
181
|
-
skills: { skills: skills ?? [], errors: [] },
|
|
182
|
-
provider,
|
|
183
|
-
toolRegistry: registry ?? new ToolRegistry(),
|
|
184
|
-
toolContext: createToolContext(),
|
|
185
|
-
defaultAgentId: 'beth',
|
|
186
|
-
maxIterations: 10,
|
|
187
|
-
maxSubagentDepth: 2,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
// =============================================================================
|
|
191
|
-
// Tests
|
|
192
|
-
// =============================================================================
|
|
193
|
-
describe('Orchestrator', () => {
|
|
194
|
-
describe('Basic message processing', () => {
|
|
195
|
-
it('should process a simple text response', async () => {
|
|
196
|
-
const provider = new MockProvider();
|
|
197
|
-
provider.addTextResponse('Hello! How can I help?');
|
|
198
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider));
|
|
199
|
-
const result = await orchestrator.processMessage('Hello');
|
|
200
|
-
assert.strictEqual(result.response, 'Hello! How can I help?');
|
|
201
|
-
assert.strictEqual(result.agentId, 'beth');
|
|
202
|
-
assert.strictEqual(result.iterations, 1);
|
|
203
|
-
assert.strictEqual(result.toolCallsExecuted.length, 0);
|
|
204
|
-
});
|
|
205
|
-
it('should default to beth agent', async () => {
|
|
206
|
-
const provider = new MockProvider();
|
|
207
|
-
provider.addTextResponse('I am Beth.');
|
|
208
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider));
|
|
209
|
-
const result = await orchestrator.processMessage('Who are you?');
|
|
210
|
-
assert.strictEqual(result.agentId, 'beth');
|
|
211
|
-
assert.strictEqual(result.routeReason, 'default');
|
|
212
|
-
});
|
|
213
|
-
it('should route @developer mention to developer', async () => {
|
|
214
|
-
const provider = new MockProvider();
|
|
215
|
-
provider.addTextResponse('I will implement that.');
|
|
216
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider));
|
|
217
|
-
const result = await orchestrator.processMessage('@developer implement login');
|
|
218
|
-
assert.strictEqual(result.agentId, 'developer');
|
|
219
|
-
assert.strictEqual(result.routeReason, 'mention');
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
describe('Tool calling loop', () => {
|
|
223
|
-
it('should execute tool calls and return final response', async () => {
|
|
224
|
-
const provider = new MockProvider();
|
|
225
|
-
// First response: tool call
|
|
226
|
-
provider.addToolCallResponse([
|
|
227
|
-
{ id: 'tc1', type: 'function', function: { name: 'readFile', arguments: '{"path":"test.ts"}' } },
|
|
228
|
-
]);
|
|
229
|
-
// Second response: text (after seeing tool result)
|
|
230
|
-
provider.addTextResponse('The file contains test code.');
|
|
231
|
-
const registry = new ToolRegistry();
|
|
232
|
-
registry.register(createReadFileTool());
|
|
233
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider, registry));
|
|
234
|
-
const result = await orchestrator.processMessage('Read test.ts');
|
|
235
|
-
assert.strictEqual(result.response, 'The file contains test code.');
|
|
236
|
-
assert.strictEqual(result.iterations, 2);
|
|
237
|
-
assert.strictEqual(result.toolCallsExecuted.length, 1);
|
|
238
|
-
assert.strictEqual(result.toolCallsExecuted[0].name, 'readFile');
|
|
239
|
-
assert.strictEqual(result.toolCallsExecuted[0].success, true);
|
|
240
|
-
});
|
|
241
|
-
it('should handle multiple tool calls in one response', async () => {
|
|
242
|
-
const provider = new MockProvider();
|
|
243
|
-
// Two tool calls in one response
|
|
244
|
-
provider.addToolCallResponse([
|
|
245
|
-
{ id: 'tc1', type: 'function', function: { name: 'echo', arguments: '{"message":"hello"}' } },
|
|
246
|
-
{ id: 'tc2', type: 'function', function: { name: 'readFile', arguments: '{"path":"a.ts"}' } },
|
|
247
|
-
]);
|
|
248
|
-
provider.addTextResponse('Done with both.');
|
|
249
|
-
const registry = new ToolRegistry();
|
|
250
|
-
registry.register(createEchoTool());
|
|
251
|
-
registry.register(createReadFileTool());
|
|
252
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider, registry));
|
|
253
|
-
const result = await orchestrator.processMessage('Do two things');
|
|
254
|
-
assert.strictEqual(result.response, 'Done with both.');
|
|
255
|
-
assert.strictEqual(result.toolCallsExecuted.length, 2);
|
|
256
|
-
});
|
|
257
|
-
it('should handle unknown tool gracefully', async () => {
|
|
258
|
-
const provider = new MockProvider();
|
|
259
|
-
provider.addToolCallResponse([
|
|
260
|
-
{ id: 'tc1', type: 'function', function: { name: 'unknownTool', arguments: '{}' } },
|
|
261
|
-
]);
|
|
262
|
-
provider.addTextResponse('Could not find that tool.');
|
|
263
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider));
|
|
264
|
-
const result = await orchestrator.processMessage('Use unknown tool');
|
|
265
|
-
assert.strictEqual(result.toolCallsExecuted.length, 1);
|
|
266
|
-
assert.strictEqual(result.toolCallsExecuted[0].success, false);
|
|
267
|
-
assert.ok(result.toolCallsExecuted[0].output.includes('not found'));
|
|
268
|
-
});
|
|
269
|
-
it('should handle invalid JSON arguments gracefully', async () => {
|
|
270
|
-
const provider = new MockProvider();
|
|
271
|
-
provider.addToolCallResponse([
|
|
272
|
-
{ id: 'tc1', type: 'function', function: { name: 'echo', arguments: 'not json' } },
|
|
273
|
-
]);
|
|
274
|
-
provider.addTextResponse('That did not work.');
|
|
275
|
-
const registry = new ToolRegistry();
|
|
276
|
-
registry.register(createEchoTool());
|
|
277
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider, registry));
|
|
278
|
-
const result = await orchestrator.processMessage('Bad args');
|
|
279
|
-
assert.strictEqual(result.toolCallsExecuted[0].success, false);
|
|
280
|
-
assert.ok(result.toolCallsExecuted[0].output.includes('Invalid JSON'));
|
|
281
|
-
});
|
|
282
|
-
it('should respect max iterations', async () => {
|
|
283
|
-
const provider = new MockProvider();
|
|
284
|
-
// Keep returning tool calls forever
|
|
285
|
-
for (let i = 0; i < 15; i++) {
|
|
286
|
-
provider.addToolCallResponse([
|
|
287
|
-
{ id: `tc${i}`, type: 'function', function: { name: 'echo', arguments: `{"message":"loop ${i}"}` } },
|
|
288
|
-
]);
|
|
289
|
-
}
|
|
290
|
-
const registry = new ToolRegistry();
|
|
291
|
-
registry.register(createEchoTool());
|
|
292
|
-
const config = createOrchestratorConfig(provider, registry);
|
|
293
|
-
config.maxIterations = 5;
|
|
294
|
-
const orchestrator = new Orchestrator(config);
|
|
295
|
-
const result = await orchestrator.processMessage('Loop forever');
|
|
296
|
-
assert.strictEqual(result.iterations, 5);
|
|
297
|
-
assert.ok(result.response.includes('maximum iterations'));
|
|
298
|
-
});
|
|
299
|
-
});
|
|
300
|
-
describe('Skill injection', () => {
|
|
301
|
-
it('should inject matching skills into context', async () => {
|
|
302
|
-
const provider = new MockProvider();
|
|
303
|
-
provider.addTextResponse('I will create the PRD.');
|
|
304
|
-
const skills = [createSkill('prd', ['create a prd', 'product requirements'])];
|
|
305
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider, undefined, undefined, skills));
|
|
306
|
-
const result = await orchestrator.processMessage('create a prd for auth');
|
|
307
|
-
assert.strictEqual(result.injectedSkills.length, 1);
|
|
308
|
-
assert.strictEqual(result.injectedSkills[0], 'prd');
|
|
309
|
-
});
|
|
310
|
-
it('should not inject the same skill twice', async () => {
|
|
311
|
-
const provider = new MockProvider();
|
|
312
|
-
provider.addTextResponse('First response.');
|
|
313
|
-
provider.addTextResponse('Second response.');
|
|
314
|
-
const skills = [createSkill('prd', ['create a prd'])];
|
|
315
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider, undefined, undefined, skills));
|
|
316
|
-
const result1 = await orchestrator.processMessage('create a prd for auth');
|
|
317
|
-
assert.strictEqual(result1.injectedSkills.length, 1);
|
|
318
|
-
const result2 = await orchestrator.processMessage('create a prd for billing');
|
|
319
|
-
assert.strictEqual(result2.injectedSkills.length, 0);
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
|
-
describe('Subagent handling', () => {
|
|
323
|
-
it('should handle subagent tool calls', async () => {
|
|
324
|
-
const provider = new MockProvider();
|
|
325
|
-
// Main agent calls subagent
|
|
326
|
-
provider.addToolCallResponse([
|
|
327
|
-
{
|
|
328
|
-
id: 'tc1',
|
|
329
|
-
type: 'function',
|
|
330
|
-
function: {
|
|
331
|
-
name: 'subagent',
|
|
332
|
-
arguments: JSON.stringify({ agentName: 'developer', prompt: 'Build login' }),
|
|
333
|
-
},
|
|
334
|
-
},
|
|
335
|
-
]);
|
|
336
|
-
// Subagent's LLM response
|
|
337
|
-
provider.addTextResponse('Login component built successfully.');
|
|
338
|
-
// Main agent's final response
|
|
339
|
-
provider.addTextResponse('The developer has built the login component.');
|
|
340
|
-
const registry = new ToolRegistry();
|
|
341
|
-
registry.register(createSubagentTool());
|
|
342
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider, registry));
|
|
343
|
-
const result = await orchestrator.processMessage('Build a login page');
|
|
344
|
-
assert.strictEqual(result.subagentResults.length, 1);
|
|
345
|
-
assert.strictEqual(result.subagentResults[0].agentId, 'developer');
|
|
346
|
-
assert.strictEqual(result.subagentResults[0].success, true);
|
|
347
|
-
});
|
|
348
|
-
it('should fail gracefully for unknown subagent', async () => {
|
|
349
|
-
const provider = new MockProvider();
|
|
350
|
-
provider.addToolCallResponse([
|
|
351
|
-
{
|
|
352
|
-
id: 'tc1',
|
|
353
|
-
type: 'function',
|
|
354
|
-
function: {
|
|
355
|
-
name: 'subagent',
|
|
356
|
-
arguments: JSON.stringify({ agentName: 'nonexistent', prompt: 'Do stuff' }),
|
|
357
|
-
},
|
|
358
|
-
},
|
|
359
|
-
]);
|
|
360
|
-
provider.addTextResponse('That agent does not exist.');
|
|
361
|
-
const registry = new ToolRegistry();
|
|
362
|
-
registry.register(createSubagentTool());
|
|
363
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider, registry));
|
|
364
|
-
const result = await orchestrator.processMessage('Call nonexistent agent');
|
|
365
|
-
assert.strictEqual(result.subagentResults.length, 1);
|
|
366
|
-
assert.strictEqual(result.subagentResults[0].success, false);
|
|
367
|
-
assert.ok(result.subagentResults[0].response.includes('not found'));
|
|
368
|
-
});
|
|
369
|
-
it('should respect subagent depth limit', async () => {
|
|
370
|
-
const provider = new MockProvider();
|
|
371
|
-
// Keep requesting subagents
|
|
372
|
-
for (let i = 0; i < 5; i++) {
|
|
373
|
-
provider.addToolCallResponse([
|
|
374
|
-
{
|
|
375
|
-
id: `tc${i}`,
|
|
376
|
-
type: 'function',
|
|
377
|
-
function: {
|
|
378
|
-
name: 'subagent',
|
|
379
|
-
arguments: JSON.stringify({ agentName: 'developer', prompt: `Depth ${i}` }),
|
|
380
|
-
},
|
|
381
|
-
},
|
|
382
|
-
]);
|
|
383
|
-
}
|
|
384
|
-
// Subagent responses
|
|
385
|
-
for (let i = 0; i < 5; i++) {
|
|
386
|
-
provider.addTextResponse(`Done at depth ${i}`);
|
|
387
|
-
}
|
|
388
|
-
provider.addTextResponse('All done.');
|
|
389
|
-
const registry = new ToolRegistry();
|
|
390
|
-
registry.register(createSubagentTool());
|
|
391
|
-
const config = createOrchestratorConfig(provider, registry);
|
|
392
|
-
config.maxSubagentDepth = 1;
|
|
393
|
-
const orchestrator = new Orchestrator(config);
|
|
394
|
-
const result = await orchestrator.processMessage('Go deep');
|
|
395
|
-
// At least one subagent should have been depth-limited
|
|
396
|
-
const hasFailures = result.subagentResults.some((r) => !r.success);
|
|
397
|
-
// Depends on exact execution: first call succeeds (depth 0→1), nested would fail
|
|
398
|
-
assert.ok(result.subagentResults.length > 0 || hasFailures);
|
|
399
|
-
});
|
|
400
|
-
});
|
|
401
|
-
describe('Handoffs', () => {
|
|
402
|
-
it('should execute a handoff to another agent', async () => {
|
|
403
|
-
const provider = new MockProvider();
|
|
404
|
-
provider.addTextResponse('I am Beth.');
|
|
405
|
-
provider.addTextResponse('I am developer now.');
|
|
406
|
-
const agents = [
|
|
407
|
-
createAgent('beth', 'Beth'),
|
|
408
|
-
createAgent('developer', 'developer'),
|
|
409
|
-
];
|
|
410
|
-
agents[0].frontmatter.handoffs = [
|
|
411
|
-
{ label: 'Dev', agent: 'developer', prompt: 'code this', send: false },
|
|
412
|
-
];
|
|
413
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider, undefined, agents));
|
|
414
|
-
// First message goes to Beth
|
|
415
|
-
await orchestrator.processMessage('Hello Beth');
|
|
416
|
-
assert.strictEqual(orchestrator.getActiveAgentId(), 'beth');
|
|
417
|
-
// Execute a handoff
|
|
418
|
-
const { handoff } = await orchestrator.executeHandoff('developer', 'Build login');
|
|
419
|
-
assert.strictEqual(handoff.executed, true);
|
|
420
|
-
assert.strictEqual(orchestrator.getActiveAgentId(), 'developer');
|
|
421
|
-
});
|
|
422
|
-
it('should fail handoff to unknown agent', async () => {
|
|
423
|
-
const provider = new MockProvider();
|
|
424
|
-
provider.addTextResponse('I am Beth.');
|
|
425
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider));
|
|
426
|
-
await orchestrator.processMessage('Hello');
|
|
427
|
-
const { handoff } = await orchestrator.executeHandoff('nonexistent', 'Do stuff');
|
|
428
|
-
assert.strictEqual(handoff.executed, false);
|
|
429
|
-
});
|
|
430
|
-
});
|
|
431
|
-
describe('Observer callbacks', () => {
|
|
432
|
-
it('should call observer on route', async () => {
|
|
433
|
-
const provider = new MockProvider();
|
|
434
|
-
provider.addTextResponse('Done.');
|
|
435
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider));
|
|
436
|
-
let routeCalled = false;
|
|
437
|
-
orchestrator.setObserver({
|
|
438
|
-
onRoute: () => { routeCalled = true; },
|
|
439
|
-
});
|
|
440
|
-
await orchestrator.processMessage('Hello');
|
|
441
|
-
assert.strictEqual(routeCalled, true);
|
|
442
|
-
});
|
|
443
|
-
it('should call observer on LLM calls', async () => {
|
|
444
|
-
const provider = new MockProvider();
|
|
445
|
-
provider.addTextResponse('Response.');
|
|
446
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider));
|
|
447
|
-
let llmCallAgent = '';
|
|
448
|
-
orchestrator.setObserver({
|
|
449
|
-
onLLMCall: (agentId) => { llmCallAgent = agentId; },
|
|
450
|
-
});
|
|
451
|
-
await orchestrator.processMessage('Hello');
|
|
452
|
-
assert.strictEqual(llmCallAgent, 'beth');
|
|
453
|
-
});
|
|
454
|
-
it('should call observer on tool calls', async () => {
|
|
455
|
-
const provider = new MockProvider();
|
|
456
|
-
provider.addToolCallResponse([
|
|
457
|
-
{ id: 'tc1', type: 'function', function: { name: 'echo', arguments: '{"message":"hi"}' } },
|
|
458
|
-
]);
|
|
459
|
-
provider.addTextResponse('Done.');
|
|
460
|
-
const registry = new ToolRegistry();
|
|
461
|
-
registry.register(createEchoTool());
|
|
462
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider, registry));
|
|
463
|
-
const records = [];
|
|
464
|
-
orchestrator.setObserver({
|
|
465
|
-
onToolCallEnd: (record) => { records.push(record); },
|
|
466
|
-
});
|
|
467
|
-
await orchestrator.processMessage('Echo something');
|
|
468
|
-
assert.strictEqual(records.length, 1);
|
|
469
|
-
assert.strictEqual(records[0].name, 'echo');
|
|
470
|
-
});
|
|
471
|
-
});
|
|
472
|
-
describe('State management', () => {
|
|
473
|
-
it('should maintain conversation context across turns', async () => {
|
|
474
|
-
const provider = new MockProvider();
|
|
475
|
-
provider.addTextResponse('First response.');
|
|
476
|
-
provider.addTextResponse('Second response.');
|
|
477
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider));
|
|
478
|
-
await orchestrator.processMessage('First message');
|
|
479
|
-
await orchestrator.processMessage('Second message');
|
|
480
|
-
const context = orchestrator.getActiveContext();
|
|
481
|
-
assert.ok(context);
|
|
482
|
-
assert.strictEqual(context.getTurnCount(), 2);
|
|
483
|
-
});
|
|
484
|
-
it('should reset state', async () => {
|
|
485
|
-
const provider = new MockProvider();
|
|
486
|
-
provider.addTextResponse('Hello.');
|
|
487
|
-
provider.addTextResponse('After reset.');
|
|
488
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider));
|
|
489
|
-
await orchestrator.processMessage('Hello');
|
|
490
|
-
orchestrator.reset();
|
|
491
|
-
assert.strictEqual(orchestrator.getActiveAgentId(), 'beth');
|
|
492
|
-
const context = orchestrator.getActiveContext();
|
|
493
|
-
assert.strictEqual(context, undefined);
|
|
494
|
-
});
|
|
495
|
-
it('should expose router and handoff manager', () => {
|
|
496
|
-
const provider = new MockProvider();
|
|
497
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider));
|
|
498
|
-
assert.ok(orchestrator.getRouter());
|
|
499
|
-
assert.ok(orchestrator.getHandoffManager());
|
|
500
|
-
});
|
|
501
|
-
});
|
|
502
|
-
describe('Agent tool filtering', () => {
|
|
503
|
-
it('should send tool definitions to the LLM', async () => {
|
|
504
|
-
const provider = new MockProvider();
|
|
505
|
-
provider.addTextResponse('Done.');
|
|
506
|
-
const registry = new ToolRegistry();
|
|
507
|
-
registry.register(createEchoTool());
|
|
508
|
-
registry.register(createReadFileTool());
|
|
509
|
-
const orchestrator = new Orchestrator(createOrchestratorConfig(provider, registry));
|
|
510
|
-
const result = await orchestrator.processMessage('Hello');
|
|
511
|
-
// Just verify it completes without error — the LLM receives tool defs
|
|
512
|
-
assert.strictEqual(result.response, 'Done.');
|
|
513
|
-
assert.strictEqual(provider.chatCallCount, 1);
|
|
514
|
-
});
|
|
515
|
-
});
|
|
516
|
-
});
|
|
517
|
-
//# sourceMappingURL=orchestrator.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.test.js","sourceRoot":"","sources":["../../src/core/orchestrator.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKjD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAI5D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF,6CAA6C;AAC7C,MAAM,cAAc,GAAG,EAAE,QAAQ,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC,EAAE,CAAC;AAE/G;;;GAGG;AACH,MAAM,YAAa,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B,CAAC,QAAQ,CAAC,CACnC,CAAC;YAEF,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC;YACpC,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;QACpC,EAAE,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;YACvD,MAAM,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;YACpC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;YAElC,MAAM,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;YACpC,QAAQ,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC;YACpC,QAAQ,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,CAAC;YAExC,MAAM,YAAY,GAAG,IAAI,YAAY,CACnC,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAC7C,CAAC;YAEF,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YAC1D,sEAAsE;YACtE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC7C,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/core/router.d.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Router
|
|
3
|
-
*
|
|
4
|
-
* Routes user requests to the appropriate agent based on:
|
|
5
|
-
* 1. Explicit @agent mentions in user input
|
|
6
|
-
* 2. Active handoff targets from the current agent
|
|
7
|
-
* 3. Skill trigger matching
|
|
8
|
-
* 4. Default to the orchestrator (Beth)
|
|
9
|
-
*
|
|
10
|
-
* Also provides agent lookup utilities for the orchestrator.
|
|
11
|
-
*/
|
|
12
|
-
import type { AgentDefinition, AgentLoadResult } from './agents/types.js';
|
|
13
|
-
import type { SkillDefinition, SkillLoadResult } from './skills/types.js';
|
|
14
|
-
/**
|
|
15
|
-
* Result of routing a user request.
|
|
16
|
-
*/
|
|
17
|
-
export interface RouteResult {
|
|
18
|
-
/** The agent that should handle this request */
|
|
19
|
-
agent: AgentDefinition;
|
|
20
|
-
/** How the agent was selected */
|
|
21
|
-
reason: RouteReason;
|
|
22
|
-
/** Skills that should be injected for this request */
|
|
23
|
-
matchedSkills: SkillDefinition[];
|
|
24
|
-
/** If routed via @mention, the cleaned prompt without the @mention */
|
|
25
|
-
cleanedPrompt?: string;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Why a particular agent was selected.
|
|
29
|
-
*/
|
|
30
|
-
export type RouteReason = 'mention' | 'handoff' | 'skill-match' | 'default';
|
|
31
|
-
/**
|
|
32
|
-
* Routes requests to the appropriate agent.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```typescript
|
|
36
|
-
* const router = new AgentRouter(agentLoadResult, skillLoadResult, 'beth');
|
|
37
|
-
*
|
|
38
|
-
* const result = router.route('@developer implement login page');
|
|
39
|
-
* // result.agent.id === 'developer'
|
|
40
|
-
* // result.reason === 'mention'
|
|
41
|
-
* // result.cleanedPrompt === 'implement login page'
|
|
42
|
-
*
|
|
43
|
-
* const result2 = router.route('create a prd for auth');
|
|
44
|
-
* // result2.matchedSkills contains the PRD skill
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export declare class AgentRouter {
|
|
48
|
-
/** Map of agent ID → agent definition */
|
|
49
|
-
private readonly agents;
|
|
50
|
-
/** Map of agent name (lowercase) → agent ID for lookup */
|
|
51
|
-
private readonly nameToId;
|
|
52
|
-
/** Skill trigger map for matching */
|
|
53
|
-
private readonly triggerMap;
|
|
54
|
-
/** Default agent ID (typically 'beth') */
|
|
55
|
-
private readonly defaultAgentId;
|
|
56
|
-
constructor(agentResult: AgentLoadResult, skillResult: SkillLoadResult, defaultAgentId?: string);
|
|
57
|
-
/**
|
|
58
|
-
* Route a user message to the appropriate agent.
|
|
59
|
-
*
|
|
60
|
-
* @param userMessage - The user's input text
|
|
61
|
-
* @param currentAgentId - The currently active agent (for handoff context)
|
|
62
|
-
* @returns Routing result with selected agent and matched skills
|
|
63
|
-
*/
|
|
64
|
-
route(userMessage: string, currentAgentId?: string): RouteResult;
|
|
65
|
-
/**
|
|
66
|
-
* Route directly to a specific agent by ID or name.
|
|
67
|
-
*
|
|
68
|
-
* @param agentIdOrName - Agent ID or display name
|
|
69
|
-
* @returns The agent definition, or undefined if not found
|
|
70
|
-
*/
|
|
71
|
-
resolveAgent(agentIdOrName: string): AgentDefinition | undefined;
|
|
72
|
-
/**
|
|
73
|
-
* Get all registered agents.
|
|
74
|
-
*/
|
|
75
|
-
getAgents(): AgentDefinition[];
|
|
76
|
-
/**
|
|
77
|
-
* Get agents that can be invoked as subagents (infer: true).
|
|
78
|
-
*/
|
|
79
|
-
getInferableAgents(): AgentDefinition[];
|
|
80
|
-
/**
|
|
81
|
-
* Get the default orchestrator agent.
|
|
82
|
-
*/
|
|
83
|
-
getDefaultAgent(): AgentDefinition;
|
|
84
|
-
/**
|
|
85
|
-
* Check if a specific agent is registered.
|
|
86
|
-
*/
|
|
87
|
-
hasAgent(agentIdOrName: string): boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Check for @agent mention in user input.
|
|
90
|
-
*
|
|
91
|
-
* Matches patterns like:
|
|
92
|
-
* - "@developer implement the login page"
|
|
93
|
-
* - "@product-manager create a PRD"
|
|
94
|
-
* - "@Beth plan a feature"
|
|
95
|
-
*/
|
|
96
|
-
private checkMention;
|
|
97
|
-
/**
|
|
98
|
-
* Find skills whose triggers match the user message.
|
|
99
|
-
*/
|
|
100
|
-
private findSkills;
|
|
101
|
-
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