@defai.digital/ax-cli 2.7.0 → 2.8.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/.ax-cli/checkpoints/2025-11-20/checkpoint-2dd84869-e62d-46c8-9885-7e45f37f36e2.json +69 -0
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-484dc350-353f-4808-9ed1-ebb3cefdab37.json +24 -0
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-74a18b87-6172-4215-962b-44bb9f46a662.json +69 -0
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-870a5fb9-6e82-4ff2-8ec8-af4c251cc514.json +44 -0
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-93946601-0e83-456c-ba47-def9713124dd.json +24 -0
- package/.ax-cli/checkpoints/metadata.json +62 -0
- package/README.md +2 -2
- package/dist/agent/context-manager.d.ts +2 -2
- package/dist/agent/context-manager.js +28 -15
- package/dist/agent/context-manager.js.map +1 -1
- package/dist/agent/dependency-resolver.d.ts +83 -0
- package/dist/agent/dependency-resolver.js +302 -0
- package/dist/agent/dependency-resolver.js.map +1 -0
- package/dist/agent/llm-agent.d.ts +63 -0
- package/dist/agent/llm-agent.js +250 -0
- package/dist/agent/llm-agent.js.map +1 -1
- package/dist/agent/specialized/analysis-agent.d.ts +11 -0
- package/dist/agent/specialized/analysis-agent.js +33 -0
- package/dist/agent/specialized/analysis-agent.js.map +1 -0
- package/dist/agent/specialized/debug-agent.d.ts +11 -0
- package/dist/agent/specialized/debug-agent.js +33 -0
- package/dist/agent/specialized/debug-agent.js.map +1 -0
- package/dist/agent/specialized/documentation-agent.d.ts +11 -0
- package/dist/agent/specialized/documentation-agent.js +33 -0
- package/dist/agent/specialized/documentation-agent.js.map +1 -0
- package/dist/agent/specialized/index.d.ts +11 -0
- package/dist/agent/specialized/index.js +12 -0
- package/dist/agent/specialized/index.js.map +1 -0
- package/dist/agent/specialized/performance-agent.d.ts +11 -0
- package/dist/agent/specialized/performance-agent.js +33 -0
- package/dist/agent/specialized/performance-agent.js.map +1 -0
- package/dist/agent/specialized/refactoring-agent.d.ts +11 -0
- package/dist/agent/specialized/refactoring-agent.js +33 -0
- package/dist/agent/specialized/refactoring-agent.js.map +1 -0
- package/dist/agent/specialized/testing-agent.d.ts +11 -0
- package/dist/agent/specialized/testing-agent.js +33 -0
- package/dist/agent/specialized/testing-agent.js.map +1 -0
- package/dist/agent/subagent-orchestrator.d.ts +124 -0
- package/dist/agent/subagent-orchestrator.js +345 -0
- package/dist/agent/subagent-orchestrator.js.map +1 -0
- package/dist/agent/subagent-types.d.ts +262 -0
- package/dist/agent/subagent-types.js +152 -0
- package/dist/agent/subagent-types.js.map +1 -0
- package/dist/agent/subagent.d.ts +88 -0
- package/dist/agent/subagent.js +402 -0
- package/dist/agent/subagent.js.map +1 -0
- package/dist/checkpoint/index.d.ts +9 -0
- package/dist/checkpoint/index.js +11 -0
- package/dist/checkpoint/index.js.map +1 -0
- package/dist/checkpoint/manager.d.ts +99 -0
- package/dist/checkpoint/manager.js +281 -0
- package/dist/checkpoint/manager.js.map +1 -0
- package/dist/checkpoint/storage.d.ts +31 -0
- package/dist/checkpoint/storage.js +265 -0
- package/dist/checkpoint/storage.js.map +1 -0
- package/dist/checkpoint/types.d.ts +111 -0
- package/dist/checkpoint/types.js +17 -0
- package/dist/checkpoint/types.js.map +1 -0
- package/dist/commands/rewind.d.ts +19 -0
- package/dist/commands/rewind.js +221 -0
- package/dist/commands/rewind.js.map +1 -0
- package/dist/hooks/use-input-handler.js +24 -0
- package/dist/hooks/use-input-handler.js.map +1 -1
- package/dist/llm/client.js +2 -1
- package/dist/llm/client.js.map +1 -1
- package/dist/mcp/client.d.ts +1 -0
- package/dist/mcp/client.js +27 -12
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/transports.d.ts +0 -1
- package/dist/mcp/transports.js +10 -7
- package/dist/mcp/transports.js.map +1 -1
- package/dist/schemas/api-schemas.js +4 -0
- package/dist/schemas/api-schemas.js.map +1 -1
- package/dist/tools/bash.js +26 -1
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/search.js +21 -9
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/text-editor.d.ts +16 -0
- package/dist/tools/text-editor.js +33 -0
- package/dist/tools/text-editor.js.map +1 -1
- package/dist/ui/components/chat-interface.js +3 -2
- package/dist/ui/components/chat-interface.js.map +1 -1
- package/dist/ui/components/subagent-monitor.d.ts +29 -0
- package/dist/ui/components/subagent-monitor.js +150 -0
- package/dist/ui/components/subagent-monitor.js.map +1 -0
- package/dist/utils/history-manager.d.ts +1 -0
- package/dist/utils/history-manager.js +40 -5
- package/dist/utils/history-manager.js.map +1 -1
- package/dist/utils/json-utils.d.ts +7 -0
- package/dist/utils/json-utils.js +70 -2
- package/dist/utils/json-utils.js.map +1 -1
- package/dist/utils/settings-manager.js +12 -10
- package/dist/utils/settings-manager.js.map +1 -1
- package/dist/utils/text-utils.js +3 -3
- package/dist/utils/text-utils.js.map +1 -1
- package/dist/utils/token-counter.d.ts +5 -0
- package/dist/utils/token-counter.js +18 -3
- package/dist/utils/token-counter.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performance Agent
|
|
3
|
+
*
|
|
4
|
+
* Specialized subagent focused on performance optimization.
|
|
5
|
+
*/
|
|
6
|
+
import { Subagent } from '../subagent.js';
|
|
7
|
+
import { type SubagentConfig } from '../subagent-types.js';
|
|
8
|
+
export declare class PerformanceAgent extends Subagent {
|
|
9
|
+
constructor(configOverrides?: Partial<SubagentConfig>);
|
|
10
|
+
protected buildSystemPrompt(): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performance Agent
|
|
3
|
+
*
|
|
4
|
+
* Specialized subagent focused on performance optimization.
|
|
5
|
+
*/
|
|
6
|
+
import { Subagent } from '../subagent.js';
|
|
7
|
+
import { SubagentRole } from '../subagent-types.js';
|
|
8
|
+
export class PerformanceAgent extends Subagent {
|
|
9
|
+
constructor(configOverrides) {
|
|
10
|
+
super(SubagentRole.PERFORMANCE, configOverrides);
|
|
11
|
+
}
|
|
12
|
+
buildSystemPrompt() {
|
|
13
|
+
return `You are a specialized performance optimization agent. Your role is to:
|
|
14
|
+
- Profile and benchmark code
|
|
15
|
+
- Identify performance bottlenecks
|
|
16
|
+
- Optimize algorithms and data structures
|
|
17
|
+
- Reduce memory usage
|
|
18
|
+
- Improve execution speed
|
|
19
|
+
- Measure before and after performance
|
|
20
|
+
|
|
21
|
+
You have access to: bash, text_editor, search tools.
|
|
22
|
+
Focus ONLY on performance optimization tasks.
|
|
23
|
+
|
|
24
|
+
When optimizing performance:
|
|
25
|
+
1. Profile current performance (baseline)
|
|
26
|
+
2. Identify bottlenecks
|
|
27
|
+
3. Plan optimization strategy
|
|
28
|
+
4. Implement optimizations
|
|
29
|
+
5. Benchmark improvements
|
|
30
|
+
6. Document performance gains`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=performance-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performance-agent.js","sourceRoot":"","sources":["../../../src/agent/specialized/performance-agent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAuB,MAAM,sBAAsB,CAAC;AAEzE,MAAM,OAAO,gBAAiB,SAAQ,QAAQ;IAC5C,YAAY,eAAyC;QACnD,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IACnD,CAAC;IAES,iBAAiB;QACzB,OAAO;;;;;;;;;;;;;;;;;8BAiBmB,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refactoring Agent
|
|
3
|
+
*
|
|
4
|
+
* Specialized subagent focused on code refactoring and improvement.
|
|
5
|
+
*/
|
|
6
|
+
import { Subagent } from '../subagent.js';
|
|
7
|
+
import { type SubagentConfig } from '../subagent-types.js';
|
|
8
|
+
export declare class RefactoringAgent extends Subagent {
|
|
9
|
+
constructor(configOverrides?: Partial<SubagentConfig>);
|
|
10
|
+
protected buildSystemPrompt(): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refactoring Agent
|
|
3
|
+
*
|
|
4
|
+
* Specialized subagent focused on code refactoring and improvement.
|
|
5
|
+
*/
|
|
6
|
+
import { Subagent } from '../subagent.js';
|
|
7
|
+
import { SubagentRole } from '../subagent-types.js';
|
|
8
|
+
export class RefactoringAgent extends Subagent {
|
|
9
|
+
constructor(configOverrides) {
|
|
10
|
+
super(SubagentRole.REFACTORING, configOverrides);
|
|
11
|
+
}
|
|
12
|
+
buildSystemPrompt() {
|
|
13
|
+
return `You are a specialized refactoring agent. Your role is to:
|
|
14
|
+
- Improve code structure and organization
|
|
15
|
+
- Extract reusable functions and components
|
|
16
|
+
- Eliminate code duplication (DRY principle)
|
|
17
|
+
- Improve naming and readability
|
|
18
|
+
- Maintain behavior while improving design
|
|
19
|
+
- Run tests after refactoring to ensure correctness
|
|
20
|
+
|
|
21
|
+
You have access to: text_editor, search, bash tools.
|
|
22
|
+
Focus ONLY on refactoring tasks.
|
|
23
|
+
|
|
24
|
+
When refactoring code:
|
|
25
|
+
1. Analyze current code structure
|
|
26
|
+
2. Identify improvement opportunities
|
|
27
|
+
3. Plan refactoring steps
|
|
28
|
+
4. Apply changes incrementally
|
|
29
|
+
5. Run tests to verify behavior unchanged
|
|
30
|
+
6. Document changes made`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=refactoring-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refactoring-agent.js","sourceRoot":"","sources":["../../../src/agent/specialized/refactoring-agent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAuB,MAAM,sBAAsB,CAAC;AAEzE,MAAM,OAAO,gBAAiB,SAAQ,QAAQ;IAC5C,YAAY,eAAyC;QACnD,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IACnD,CAAC;IAES,iBAAiB;QACzB,OAAO;;;;;;;;;;;;;;;;;yBAiBc,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Testing Agent
|
|
3
|
+
*
|
|
4
|
+
* Specialized subagent focused on writing comprehensive tests.
|
|
5
|
+
*/
|
|
6
|
+
import { Subagent } from '../subagent.js';
|
|
7
|
+
import { type SubagentConfig } from '../subagent-types.js';
|
|
8
|
+
export declare class TestingAgent extends Subagent {
|
|
9
|
+
constructor(configOverrides?: Partial<SubagentConfig>);
|
|
10
|
+
protected buildSystemPrompt(): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Testing Agent
|
|
3
|
+
*
|
|
4
|
+
* Specialized subagent focused on writing comprehensive tests.
|
|
5
|
+
*/
|
|
6
|
+
import { Subagent } from '../subagent.js';
|
|
7
|
+
import { SubagentRole } from '../subagent-types.js';
|
|
8
|
+
export class TestingAgent extends Subagent {
|
|
9
|
+
constructor(configOverrides) {
|
|
10
|
+
super(SubagentRole.TESTING, configOverrides);
|
|
11
|
+
}
|
|
12
|
+
buildSystemPrompt() {
|
|
13
|
+
return `You are a specialized testing agent. Your role is to:
|
|
14
|
+
- Write comprehensive unit tests with high coverage
|
|
15
|
+
- Write integration tests for complex workflows
|
|
16
|
+
- Follow testing best practices (AAA pattern, clear test names)
|
|
17
|
+
- Use appropriate assertions and edge case testing
|
|
18
|
+
- Ensure tests are maintainable and well-documented
|
|
19
|
+
- Run tests to verify they pass
|
|
20
|
+
|
|
21
|
+
You have access to: bash, text_editor, search tools.
|
|
22
|
+
Focus ONLY on testing tasks.
|
|
23
|
+
|
|
24
|
+
When writing tests:
|
|
25
|
+
1. Analyze the code to understand functionality
|
|
26
|
+
2. Identify edge cases and scenarios
|
|
27
|
+
3. Write clear, descriptive test names
|
|
28
|
+
4. Use proper assertions
|
|
29
|
+
5. Run tests to verify they pass
|
|
30
|
+
6. Report coverage and results`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=testing-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing-agent.js","sourceRoot":"","sources":["../../../src/agent/specialized/testing-agent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAuB,MAAM,sBAAsB,CAAC;AAEzE,MAAM,OAAO,YAAa,SAAQ,QAAQ;IACxC,YAAY,eAAyC;QACnD,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC/C,CAAC;IAES,iBAAiB;QACzB,OAAO;;;;;;;;;;;;;;;;;+BAiBoB,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subagent Orchestrator
|
|
3
|
+
*
|
|
4
|
+
* Manages the lifecycle of subagents and coordinates parallel task execution.
|
|
5
|
+
* Handles spawning, delegation, dependency resolution, and result aggregation.
|
|
6
|
+
*/
|
|
7
|
+
import { EventEmitter } from 'events';
|
|
8
|
+
import { Subagent } from './subagent.js';
|
|
9
|
+
import type { SubagentConfig, SubagentTask, SubagentResult } from './subagent-types.js';
|
|
10
|
+
import { SubagentRole } from './subagent-types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Orchestrator configuration
|
|
13
|
+
*/
|
|
14
|
+
export interface OrchestratorConfig {
|
|
15
|
+
maxConcurrentAgents?: number;
|
|
16
|
+
defaultTimeout?: number;
|
|
17
|
+
autoCheckpoint?: boolean;
|
|
18
|
+
verbose?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* SubagentOrchestrator manages multiple subagents
|
|
22
|
+
*/
|
|
23
|
+
export declare class SubagentOrchestrator extends EventEmitter {
|
|
24
|
+
private subagents;
|
|
25
|
+
private taskQueue;
|
|
26
|
+
private results;
|
|
27
|
+
private dependencyResolver;
|
|
28
|
+
private activeCount;
|
|
29
|
+
private config;
|
|
30
|
+
constructor(config?: OrchestratorConfig);
|
|
31
|
+
/**
|
|
32
|
+
* Spawn a new subagent with the specified role
|
|
33
|
+
*/
|
|
34
|
+
spawn(role: SubagentRole, config?: Partial<SubagentConfig>): Promise<Subagent>;
|
|
35
|
+
/**
|
|
36
|
+
* Alias for spawn() for backward compatibility
|
|
37
|
+
*/
|
|
38
|
+
spawnSubagent(role: SubagentRole, config?: Partial<SubagentConfig>): Promise<Subagent>;
|
|
39
|
+
/**
|
|
40
|
+
* Forward events from subagent to orchestrator
|
|
41
|
+
*/
|
|
42
|
+
private forwardSubagentEvents;
|
|
43
|
+
/**
|
|
44
|
+
* Delegate a task to a subagent with the specified role
|
|
45
|
+
*/
|
|
46
|
+
delegateTask(task: SubagentTask, role?: SubagentRole): Promise<SubagentResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Execute multiple tasks in parallel
|
|
49
|
+
*/
|
|
50
|
+
executeParallel(tasks: SubagentTask[]): Promise<SubagentResult[]>;
|
|
51
|
+
/**
|
|
52
|
+
* Execute a batch of tasks in parallel
|
|
53
|
+
*/
|
|
54
|
+
private executeBatch;
|
|
55
|
+
/**
|
|
56
|
+
* Infer subagent role from task description
|
|
57
|
+
*/
|
|
58
|
+
private inferRoleFromTask;
|
|
59
|
+
/**
|
|
60
|
+
* Terminate a specific subagent by ID
|
|
61
|
+
*/
|
|
62
|
+
terminateSubagent(subagentId: string): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Terminate all subagents
|
|
65
|
+
*/
|
|
66
|
+
terminateAll(): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Get result for a specific task
|
|
69
|
+
*/
|
|
70
|
+
getResult(taskId: string): SubagentResult | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Get all results
|
|
73
|
+
*/
|
|
74
|
+
getAllResults(): Map<string, SubagentResult>;
|
|
75
|
+
/**
|
|
76
|
+
* Get orchestrator status
|
|
77
|
+
*/
|
|
78
|
+
getStatus(): {
|
|
79
|
+
totalSubagents: number;
|
|
80
|
+
activeSubagents: number;
|
|
81
|
+
completedTasks: number;
|
|
82
|
+
queuedTasks: number;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Get list of active subagents
|
|
86
|
+
*/
|
|
87
|
+
getActiveSubagents(): Array<{
|
|
88
|
+
id: string;
|
|
89
|
+
role: SubagentRole;
|
|
90
|
+
status: any;
|
|
91
|
+
}>;
|
|
92
|
+
/**
|
|
93
|
+
* Clear all results
|
|
94
|
+
*/
|
|
95
|
+
clearResults(): void;
|
|
96
|
+
/**
|
|
97
|
+
* Get all active subagents (alias for tests)
|
|
98
|
+
*/
|
|
99
|
+
getActive(): Subagent[];
|
|
100
|
+
/**
|
|
101
|
+
* Monitor a specific subagent's status
|
|
102
|
+
*/
|
|
103
|
+
monitor(subagentId: string): any;
|
|
104
|
+
/**
|
|
105
|
+
* Get orchestrator statistics
|
|
106
|
+
*/
|
|
107
|
+
getStats(): {
|
|
108
|
+
activeAgents: number;
|
|
109
|
+
totalResults: number;
|
|
110
|
+
successfulTasks: number;
|
|
111
|
+
failedTasks: number;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Spawn multiple subagents in parallel
|
|
115
|
+
*/
|
|
116
|
+
spawnParallel(configs: Array<{
|
|
117
|
+
role: SubagentRole;
|
|
118
|
+
config?: Partial<SubagentConfig>;
|
|
119
|
+
}>): Promise<Subagent[]>;
|
|
120
|
+
/**
|
|
121
|
+
* Send a message to a subagent
|
|
122
|
+
*/
|
|
123
|
+
sendMessage(subagentId: string, message: string): Promise<void>;
|
|
124
|
+
}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subagent Orchestrator
|
|
3
|
+
*
|
|
4
|
+
* Manages the lifecycle of subagents and coordinates parallel task execution.
|
|
5
|
+
* Handles spawning, delegation, dependency resolution, and result aggregation.
|
|
6
|
+
*/
|
|
7
|
+
import { EventEmitter } from 'events';
|
|
8
|
+
import { Subagent } from './subagent.js';
|
|
9
|
+
import { SubagentRole, SubagentState } from './subagent-types.js';
|
|
10
|
+
import { DependencyResolver } from './dependency-resolver.js';
|
|
11
|
+
// Import specialized agents
|
|
12
|
+
import { TestingAgent } from './specialized/testing-agent.js';
|
|
13
|
+
import { DocumentationAgent } from './specialized/documentation-agent.js';
|
|
14
|
+
import { RefactoringAgent } from './specialized/refactoring-agent.js';
|
|
15
|
+
import { AnalysisAgent } from './specialized/analysis-agent.js';
|
|
16
|
+
import { DebugAgent } from './specialized/debug-agent.js';
|
|
17
|
+
import { PerformanceAgent } from './specialized/performance-agent.js';
|
|
18
|
+
/**
|
|
19
|
+
* SubagentOrchestrator manages multiple subagents
|
|
20
|
+
*/
|
|
21
|
+
export class SubagentOrchestrator extends EventEmitter {
|
|
22
|
+
subagents;
|
|
23
|
+
taskQueue;
|
|
24
|
+
results;
|
|
25
|
+
dependencyResolver;
|
|
26
|
+
activeCount;
|
|
27
|
+
config;
|
|
28
|
+
constructor(config) {
|
|
29
|
+
super();
|
|
30
|
+
this.config = {
|
|
31
|
+
maxConcurrentAgents: 5,
|
|
32
|
+
defaultTimeout: 300000,
|
|
33
|
+
autoCheckpoint: false,
|
|
34
|
+
verbose: false,
|
|
35
|
+
...config,
|
|
36
|
+
};
|
|
37
|
+
this.subagents = new Map();
|
|
38
|
+
this.taskQueue = [];
|
|
39
|
+
this.results = new Map();
|
|
40
|
+
this.dependencyResolver = new DependencyResolver();
|
|
41
|
+
this.activeCount = 0;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Spawn a new subagent with the specified role
|
|
45
|
+
*/
|
|
46
|
+
async spawn(role, config) {
|
|
47
|
+
// Check max concurrent agents limit
|
|
48
|
+
if (this.subagents.size >= this.config.maxConcurrentAgents) {
|
|
49
|
+
throw new Error(`Maximum concurrent agents limit (${this.config.maxConcurrentAgents}) reached`);
|
|
50
|
+
}
|
|
51
|
+
let subagent;
|
|
52
|
+
// Create specialized subagent based on role
|
|
53
|
+
switch (role) {
|
|
54
|
+
case SubagentRole.TESTING:
|
|
55
|
+
subagent = new TestingAgent(config);
|
|
56
|
+
break;
|
|
57
|
+
case SubagentRole.DOCUMENTATION:
|
|
58
|
+
subagent = new DocumentationAgent(config);
|
|
59
|
+
break;
|
|
60
|
+
case SubagentRole.REFACTORING:
|
|
61
|
+
subagent = new RefactoringAgent(config);
|
|
62
|
+
break;
|
|
63
|
+
case SubagentRole.ANALYSIS:
|
|
64
|
+
subagent = new AnalysisAgent(config);
|
|
65
|
+
break;
|
|
66
|
+
case SubagentRole.DEBUG:
|
|
67
|
+
subagent = new DebugAgent(config);
|
|
68
|
+
break;
|
|
69
|
+
case SubagentRole.PERFORMANCE:
|
|
70
|
+
subagent = new PerformanceAgent(config);
|
|
71
|
+
break;
|
|
72
|
+
case SubagentRole.GENERAL:
|
|
73
|
+
default:
|
|
74
|
+
subagent = new Subagent(SubagentRole.GENERAL, config);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
// Register subagent using its own ID
|
|
78
|
+
this.subagents.set(subagent.id, subagent);
|
|
79
|
+
// Forward subagent events
|
|
80
|
+
this.forwardSubagentEvents(subagent.id, subagent);
|
|
81
|
+
this.emit('spawn', { id: subagent.id, role });
|
|
82
|
+
return subagent;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Alias for spawn() for backward compatibility
|
|
86
|
+
*/
|
|
87
|
+
async spawnSubagent(role, config) {
|
|
88
|
+
return this.spawn(role, config);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Forward events from subagent to orchestrator
|
|
92
|
+
*/
|
|
93
|
+
forwardSubagentEvents(id, subagent) {
|
|
94
|
+
subagent.on('task-started', (data) => {
|
|
95
|
+
this.activeCount++;
|
|
96
|
+
this.emit('subagent-start', { subagentId: id, ...data });
|
|
97
|
+
});
|
|
98
|
+
subagent.on('task-completed', (data) => {
|
|
99
|
+
this.activeCount--;
|
|
100
|
+
this.results.set(data.taskId, data.result);
|
|
101
|
+
this.emit('subagent-complete', { subagentId: id, ...data });
|
|
102
|
+
});
|
|
103
|
+
subagent.on('task-failed', (data) => {
|
|
104
|
+
this.activeCount--;
|
|
105
|
+
this.emit('subagent-error', { subagentId: id, ...data });
|
|
106
|
+
});
|
|
107
|
+
subagent.on('progress', (data) => {
|
|
108
|
+
this.emit('subagent-progress', { subagentId: id, ...data });
|
|
109
|
+
});
|
|
110
|
+
subagent.on('tool-executed', (data) => {
|
|
111
|
+
this.emit('subagent-tool', { subagentId: id, ...data });
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Delegate a task to a subagent with the specified role
|
|
116
|
+
*/
|
|
117
|
+
async delegateTask(task, role) {
|
|
118
|
+
// Determine role from task if not specified
|
|
119
|
+
const taskRole = role || this.inferRoleFromTask(task);
|
|
120
|
+
// Spawn subagent
|
|
121
|
+
const subagent = await this.spawnSubagent(taskRole);
|
|
122
|
+
try {
|
|
123
|
+
// Execute task
|
|
124
|
+
const result = await subagent.executeTask(task);
|
|
125
|
+
// Store result
|
|
126
|
+
this.results.set(task.id, result);
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
finally {
|
|
130
|
+
// Clean up subagent after task completion
|
|
131
|
+
await this.terminateSubagent(subagent.id);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Execute multiple tasks in parallel
|
|
136
|
+
*/
|
|
137
|
+
async executeParallel(tasks) {
|
|
138
|
+
// Validate dependencies
|
|
139
|
+
if (!this.dependencyResolver.validateDependencies(tasks)) {
|
|
140
|
+
throw new Error('Circular dependencies detected in tasks');
|
|
141
|
+
}
|
|
142
|
+
// Resolve dependencies and get execution batches
|
|
143
|
+
const batches = this.dependencyResolver.resolveDependencies(tasks);
|
|
144
|
+
const allResults = [];
|
|
145
|
+
// Execute batches sequentially, but tasks within each batch in parallel
|
|
146
|
+
for (const batch of batches) {
|
|
147
|
+
const batchTasks = batch.map(taskId => tasks.find(t => t.id === taskId));
|
|
148
|
+
// Execute batch in parallel
|
|
149
|
+
const batchResults = await this.executeBatch(batchTasks);
|
|
150
|
+
allResults.push(...batchResults);
|
|
151
|
+
}
|
|
152
|
+
return allResults;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Execute a batch of tasks in parallel
|
|
156
|
+
*/
|
|
157
|
+
async executeBatch(tasks) {
|
|
158
|
+
const promises = tasks.map(async (task) => {
|
|
159
|
+
// Infer role from task
|
|
160
|
+
const role = this.inferRoleFromTask(task);
|
|
161
|
+
// Spawn and execute
|
|
162
|
+
const subagent = await this.spawnSubagent(role);
|
|
163
|
+
try {
|
|
164
|
+
const result = await subagent.executeTask(task);
|
|
165
|
+
this.results.set(task.id, result);
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
finally {
|
|
169
|
+
await this.terminateSubagent(subagent.id);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
// Execute all in parallel with fail-safe
|
|
173
|
+
const results = await Promise.allSettled(promises);
|
|
174
|
+
return results.map((r, i) => {
|
|
175
|
+
if (r.status === 'fulfilled') {
|
|
176
|
+
return r.value;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
// Task failed - create a proper SubagentResult
|
|
180
|
+
const task = tasks[i];
|
|
181
|
+
const failedResult = {
|
|
182
|
+
id: `failed-${task.id}`,
|
|
183
|
+
taskId: task.id,
|
|
184
|
+
role: task.role,
|
|
185
|
+
success: false,
|
|
186
|
+
output: '',
|
|
187
|
+
error: r.reason?.message || 'Unknown error',
|
|
188
|
+
executionTime: 0,
|
|
189
|
+
status: {
|
|
190
|
+
id: `status-${task.id}`,
|
|
191
|
+
taskId: task.id,
|
|
192
|
+
role: task.role,
|
|
193
|
+
state: SubagentState.FAILED,
|
|
194
|
+
progress: 0,
|
|
195
|
+
startTime: new Date(),
|
|
196
|
+
endTime: new Date(),
|
|
197
|
+
error: r.reason?.message || 'Unknown error',
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
return failedResult;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Infer subagent role from task description
|
|
206
|
+
*/
|
|
207
|
+
inferRoleFromTask(task) {
|
|
208
|
+
const desc = task.description.toLowerCase();
|
|
209
|
+
if (desc.includes('test') || desc.includes('testing')) {
|
|
210
|
+
return SubagentRole.TESTING;
|
|
211
|
+
}
|
|
212
|
+
if (desc.includes('document') || desc.includes('readme') || desc.includes('docs')) {
|
|
213
|
+
return SubagentRole.DOCUMENTATION;
|
|
214
|
+
}
|
|
215
|
+
if (desc.includes('refactor') || desc.includes('restructure')) {
|
|
216
|
+
return SubagentRole.REFACTORING;
|
|
217
|
+
}
|
|
218
|
+
if (desc.includes('analyze') || desc.includes('review') || desc.includes('audit')) {
|
|
219
|
+
return SubagentRole.ANALYSIS;
|
|
220
|
+
}
|
|
221
|
+
if (desc.includes('debug') || desc.includes('fix') || desc.includes('bug')) {
|
|
222
|
+
return SubagentRole.DEBUG;
|
|
223
|
+
}
|
|
224
|
+
if (desc.includes('performance') || desc.includes('optimize') || desc.includes('speed')) {
|
|
225
|
+
return SubagentRole.PERFORMANCE;
|
|
226
|
+
}
|
|
227
|
+
return SubagentRole.GENERAL;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Terminate a specific subagent by ID
|
|
231
|
+
*/
|
|
232
|
+
async terminateSubagent(subagentId) {
|
|
233
|
+
const subagent = this.subagents.get(subagentId);
|
|
234
|
+
if (!subagent) {
|
|
235
|
+
return; // Gracefully handle non-existent subagent
|
|
236
|
+
}
|
|
237
|
+
await subagent.terminate();
|
|
238
|
+
this.subagents.delete(subagentId);
|
|
239
|
+
this.emit('terminate', { id: subagentId });
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Terminate all subagents
|
|
243
|
+
*/
|
|
244
|
+
async terminateAll() {
|
|
245
|
+
const terminatePromises = Array.from(this.subagents.values()).map((subagent) => subagent.terminate());
|
|
246
|
+
await Promise.all(terminatePromises);
|
|
247
|
+
this.subagents.clear();
|
|
248
|
+
this.activeCount = 0;
|
|
249
|
+
this.emit('all-terminated');
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Get result for a specific task
|
|
253
|
+
*/
|
|
254
|
+
getResult(taskId) {
|
|
255
|
+
return this.results.get(taskId);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Get all results
|
|
259
|
+
*/
|
|
260
|
+
getAllResults() {
|
|
261
|
+
return new Map(this.results);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Get orchestrator status
|
|
265
|
+
*/
|
|
266
|
+
getStatus() {
|
|
267
|
+
return {
|
|
268
|
+
totalSubagents: this.subagents.size,
|
|
269
|
+
activeSubagents: this.activeCount,
|
|
270
|
+
completedTasks: this.results.size,
|
|
271
|
+
queuedTasks: this.taskQueue.length,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Get list of active subagents
|
|
276
|
+
*/
|
|
277
|
+
getActiveSubagents() {
|
|
278
|
+
const active = [];
|
|
279
|
+
for (const [id, subagent] of this.subagents) {
|
|
280
|
+
const status = subagent.getStatus();
|
|
281
|
+
// Check if state is RUNNING (active)
|
|
282
|
+
if (status.state === SubagentState.RUNNING) {
|
|
283
|
+
active.push({
|
|
284
|
+
id,
|
|
285
|
+
role: status.role,
|
|
286
|
+
status: status,
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return active;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Clear all results
|
|
294
|
+
*/
|
|
295
|
+
clearResults() {
|
|
296
|
+
this.results.clear();
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Get all active subagents (alias for tests)
|
|
300
|
+
*/
|
|
301
|
+
getActive() {
|
|
302
|
+
return Array.from(this.subagents.values());
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Monitor a specific subagent's status
|
|
306
|
+
*/
|
|
307
|
+
monitor(subagentId) {
|
|
308
|
+
const subagent = this.subagents.get(subagentId);
|
|
309
|
+
if (!subagent) {
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
return subagent.getStatus();
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Get orchestrator statistics
|
|
316
|
+
*/
|
|
317
|
+
getStats() {
|
|
318
|
+
const results = Array.from(this.results.values());
|
|
319
|
+
return {
|
|
320
|
+
activeAgents: this.subagents.size,
|
|
321
|
+
totalResults: results.length,
|
|
322
|
+
successfulTasks: results.filter(r => r.success).length,
|
|
323
|
+
failedTasks: results.filter(r => !r.success).length,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Spawn multiple subagents in parallel
|
|
328
|
+
*/
|
|
329
|
+
async spawnParallel(configs) {
|
|
330
|
+
return Promise.all(configs.map(({ role, config }) => this.spawn(role, config)));
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Send a message to a subagent
|
|
334
|
+
*/
|
|
335
|
+
async sendMessage(subagentId, message) {
|
|
336
|
+
const subagent = this.subagents.get(subagentId);
|
|
337
|
+
if (!subagent) {
|
|
338
|
+
throw new Error(`Subagent ${subagentId} not found`);
|
|
339
|
+
}
|
|
340
|
+
// Subagent will handle the message via receiveMessage method
|
|
341
|
+
// For now, just emit an event
|
|
342
|
+
this.emit('message-sent', { subagentId, message });
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
//# sourceMappingURL=subagent-orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent-orchestrator.js","sourceRoot":"","sources":["../../src/agent/subagent-orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAMzC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,4BAA4B;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAYtE;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,YAAY;IAC5C,SAAS,CAAwB;IACjC,SAAS,CAAiB;IAC1B,OAAO,CAA8B;IACrC,kBAAkB,CAAqB;IACvC,WAAW,CAAS;IACpB,MAAM,CAAqB;IAEnC,YAAY,MAA2B;QACrC,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,MAAM,GAAG;YACZ,mBAAmB,EAAE,CAAC;YACtB,cAAc,EAAE,MAAM;YACtB,cAAc,EAAE,KAAK;YACrB,OAAO,EAAE,KAAK;YACd,GAAG,MAAM;SACV,CAAC;QAEF,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;QAC3B,IA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