@gotza02/smartagent 1.2.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/LICENSE +21 -0
- package/README.md +422 -0
- package/dist/config/index.d.ts +72 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +329 -0
- package/dist/config/index.js.map +1 -0
- package/dist/core/agent-manager.d.ts +116 -0
- package/dist/core/agent-manager.d.ts.map +1 -0
- package/dist/core/agent-manager.js +460 -0
- package/dist/core/agent-manager.js.map +1 -0
- package/dist/core/context-manager.d.ts +107 -0
- package/dist/core/context-manager.d.ts.map +1 -0
- package/dist/core/context-manager.js +467 -0
- package/dist/core/context-manager.js.map +1 -0
- package/dist/core/database.d.ts +82 -0
- package/dist/core/database.d.ts.map +1 -0
- package/dist/core/database.js +751 -0
- package/dist/core/database.js.map +1 -0
- package/dist/core/event-emitter.d.ts +110 -0
- package/dist/core/event-emitter.d.ts.map +1 -0
- package/dist/core/event-emitter.js +240 -0
- package/dist/core/event-emitter.js.map +1 -0
- package/dist/core/metrics.d.ts +108 -0
- package/dist/core/metrics.d.ts.map +1 -0
- package/dist/core/metrics.js +281 -0
- package/dist/core/metrics.js.map +1 -0
- package/dist/core/middleware.d.ts +63 -0
- package/dist/core/middleware.d.ts.map +1 -0
- package/dist/core/middleware.js +194 -0
- package/dist/core/middleware.js.map +1 -0
- package/dist/core/plugin-system.d.ts +86 -0
- package/dist/core/plugin-system.d.ts.map +1 -0
- package/dist/core/plugin-system.js +251 -0
- package/dist/core/plugin-system.js.map +1 -0
- package/dist/core/task-scheduler.d.ts +130 -0
- package/dist/core/task-scheduler.d.ts.map +1 -0
- package/dist/core/task-scheduler.js +401 -0
- package/dist/core/task-scheduler.js.map +1 -0
- package/dist/engines/auto-router.d.ts +76 -0
- package/dist/engines/auto-router.d.ts.map +1 -0
- package/dist/engines/auto-router.js +445 -0
- package/dist/engines/auto-router.js.map +1 -0
- package/dist/engines/parallel-execution.d.ts +104 -0
- package/dist/engines/parallel-execution.d.ts.map +1 -0
- package/dist/engines/parallel-execution.js +591 -0
- package/dist/engines/parallel-execution.js.map +1 -0
- package/dist/engines/sequential-thinking.d.ts +88 -0
- package/dist/engines/sequential-thinking.d.ts.map +1 -0
- package/dist/engines/sequential-thinking.js +406 -0
- package/dist/engines/sequential-thinking.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1101 -0
- package/dist/index.js.map +1 -0
- package/dist/security/validation.d.ts +87 -0
- package/dist/security/validation.d.ts.map +1 -0
- package/dist/security/validation.js +465 -0
- package/dist/security/validation.js.map +1 -0
- package/dist/tools/filesystem.d.ts +90 -0
- package/dist/tools/filesystem.d.ts.map +1 -0
- package/dist/tools/filesystem.js +292 -0
- package/dist/tools/filesystem.js.map +1 -0
- package/dist/tools/terminal.d.ts +99 -0
- package/dist/tools/terminal.d.ts.map +1 -0
- package/dist/tools/terminal.js +363 -0
- package/dist/tools/terminal.js.map +1 -0
- package/dist/types/index.d.ts +306 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +54 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/logger.d.ts +22 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +189 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-Routing Engine
|
|
3
|
+
* Intent classification and intelligent agent selection
|
|
4
|
+
*/
|
|
5
|
+
import { logger, logRoutingDecision } from "../utils/logger.js";
|
|
6
|
+
const DEFAULT_CONFIG = {
|
|
7
|
+
minConfidence: 0.75,
|
|
8
|
+
enableFallback: true,
|
|
9
|
+
complexityThreshold: {
|
|
10
|
+
simple: 3,
|
|
11
|
+
medium: 7,
|
|
12
|
+
complex: 10,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
// Intent patterns for classification
|
|
16
|
+
const INTENT_PATTERNS = {
|
|
17
|
+
requirements: {
|
|
18
|
+
patterns: [
|
|
19
|
+
/requirement/i,
|
|
20
|
+
/spec/i,
|
|
21
|
+
/define.*feature/i,
|
|
22
|
+
/user story/i,
|
|
23
|
+
/acceptance criteria/i,
|
|
24
|
+
/prd/i,
|
|
25
|
+
/product.*doc/i,
|
|
26
|
+
],
|
|
27
|
+
category: "create",
|
|
28
|
+
},
|
|
29
|
+
architecture: {
|
|
30
|
+
patterns: [
|
|
31
|
+
/architect/i,
|
|
32
|
+
/design.*pattern/i,
|
|
33
|
+
/system.*design/i,
|
|
34
|
+
/tech.*stack/i,
|
|
35
|
+
/database.*schema/i,
|
|
36
|
+
/api.*design/i,
|
|
37
|
+
/microservice/i,
|
|
38
|
+
],
|
|
39
|
+
category: "create",
|
|
40
|
+
},
|
|
41
|
+
implementation: {
|
|
42
|
+
patterns: [
|
|
43
|
+
/implement/i,
|
|
44
|
+
/code/i,
|
|
45
|
+
/develop/i,
|
|
46
|
+
/write.*function/i,
|
|
47
|
+
/create.*component/i,
|
|
48
|
+
/build.*feature/i,
|
|
49
|
+
/refactor/i,
|
|
50
|
+
],
|
|
51
|
+
category: "modify",
|
|
52
|
+
},
|
|
53
|
+
testing: {
|
|
54
|
+
patterns: [
|
|
55
|
+
/test/i,
|
|
56
|
+
/unit.*test/i,
|
|
57
|
+
/integration.*test/i,
|
|
58
|
+
/e2e/i,
|
|
59
|
+
/qa/i,
|
|
60
|
+
/quality/i,
|
|
61
|
+
/bug.*fix/i,
|
|
62
|
+
/debug/i,
|
|
63
|
+
],
|
|
64
|
+
category: "analyze",
|
|
65
|
+
},
|
|
66
|
+
review: {
|
|
67
|
+
patterns: [
|
|
68
|
+
/review/i,
|
|
69
|
+
/audit/i,
|
|
70
|
+
/check.*code/i,
|
|
71
|
+
/code.*review/i,
|
|
72
|
+
/security.*audit/i,
|
|
73
|
+
/performance.*review/i,
|
|
74
|
+
],
|
|
75
|
+
category: "review",
|
|
76
|
+
},
|
|
77
|
+
execution: {
|
|
78
|
+
patterns: [
|
|
79
|
+
/run/i,
|
|
80
|
+
/execute/i,
|
|
81
|
+
/deploy/i,
|
|
82
|
+
/build.*project/i,
|
|
83
|
+
/start.*server/i,
|
|
84
|
+
/install/i,
|
|
85
|
+
/update/i,
|
|
86
|
+
],
|
|
87
|
+
category: "execute",
|
|
88
|
+
},
|
|
89
|
+
analysis: {
|
|
90
|
+
patterns: [
|
|
91
|
+
/analyze/i,
|
|
92
|
+
/investigate/i,
|
|
93
|
+
/research/i,
|
|
94
|
+
/explore/i,
|
|
95
|
+
/understand/i,
|
|
96
|
+
/document/i,
|
|
97
|
+
],
|
|
98
|
+
category: "analyze",
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
// Agent capabilities mapping
|
|
102
|
+
const AGENT_CAPABILITIES = {
|
|
103
|
+
product_manager: [
|
|
104
|
+
"requirements",
|
|
105
|
+
"specification",
|
|
106
|
+
"user-stories",
|
|
107
|
+
"acceptance-criteria",
|
|
108
|
+
"prd",
|
|
109
|
+
"roadmap",
|
|
110
|
+
"prioritization",
|
|
111
|
+
],
|
|
112
|
+
architect: [
|
|
113
|
+
"architecture",
|
|
114
|
+
"system-design",
|
|
115
|
+
"tech-stack",
|
|
116
|
+
"database-design",
|
|
117
|
+
"api-design",
|
|
118
|
+
"patterns",
|
|
119
|
+
"scalability",
|
|
120
|
+
],
|
|
121
|
+
engineer: [
|
|
122
|
+
"implementation",
|
|
123
|
+
"coding",
|
|
124
|
+
"refactoring",
|
|
125
|
+
"debugging",
|
|
126
|
+
"optimization",
|
|
127
|
+
"integration",
|
|
128
|
+
"testing",
|
|
129
|
+
],
|
|
130
|
+
qa: [
|
|
131
|
+
"testing",
|
|
132
|
+
"quality-assurance",
|
|
133
|
+
"bug-reporting",
|
|
134
|
+
"test-automation",
|
|
135
|
+
"performance-testing",
|
|
136
|
+
"security-testing",
|
|
137
|
+
],
|
|
138
|
+
reviewer: [
|
|
139
|
+
"code-review",
|
|
140
|
+
"security-audit",
|
|
141
|
+
"performance-review",
|
|
142
|
+
"best-practices",
|
|
143
|
+
"documentation-review",
|
|
144
|
+
],
|
|
145
|
+
};
|
|
146
|
+
// Mode recommendations based on intent
|
|
147
|
+
const MODE_RECOMMENDATIONS = {
|
|
148
|
+
create: "plan",
|
|
149
|
+
modify: "edit",
|
|
150
|
+
analyze: "plan",
|
|
151
|
+
review: "plan",
|
|
152
|
+
execute: "ralph",
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Auto-Routing Engine
|
|
156
|
+
* Classifies intent and routes to appropriate agent
|
|
157
|
+
*/
|
|
158
|
+
export class AutoRouter {
|
|
159
|
+
config;
|
|
160
|
+
constructor(config = {}) {
|
|
161
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Classify intent from input text
|
|
165
|
+
*/
|
|
166
|
+
classifyIntent(input) {
|
|
167
|
+
const normalizedInput = input.toLowerCase();
|
|
168
|
+
const scores = {};
|
|
169
|
+
// Score each intent category
|
|
170
|
+
for (const [intent, data] of Object.entries(INTENT_PATTERNS)) {
|
|
171
|
+
scores[intent] = 0;
|
|
172
|
+
for (const pattern of data.patterns) {
|
|
173
|
+
const matches = normalizedInput.match(pattern);
|
|
174
|
+
if (matches) {
|
|
175
|
+
scores[intent] += matches.length;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
// Find best matching intent
|
|
180
|
+
let bestIntent = "unknown";
|
|
181
|
+
let bestScore = 0;
|
|
182
|
+
let totalScore = 0;
|
|
183
|
+
for (const [intent, score] of Object.entries(scores)) {
|
|
184
|
+
totalScore += score;
|
|
185
|
+
if (score > bestScore) {
|
|
186
|
+
bestScore = score;
|
|
187
|
+
bestIntent = intent;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
// Calculate confidence
|
|
191
|
+
const confidence = totalScore > 0 ? bestScore / Math.max(1, totalScore * 0.5) : 0;
|
|
192
|
+
// Determine complexity
|
|
193
|
+
const complexity = this.assessComplexity(input);
|
|
194
|
+
// Get required capabilities
|
|
195
|
+
const requiredCapabilities = this.extractCapabilities(input);
|
|
196
|
+
const classification = {
|
|
197
|
+
intent: bestIntent,
|
|
198
|
+
confidence: Math.min(1, confidence),
|
|
199
|
+
category: INTENT_PATTERNS[bestIntent]?.category || "analyze",
|
|
200
|
+
complexity,
|
|
201
|
+
requiredCapabilities,
|
|
202
|
+
};
|
|
203
|
+
logger.debug("Intent classified", {
|
|
204
|
+
category: "routing",
|
|
205
|
+
input: input.substring(0, 100),
|
|
206
|
+
classification,
|
|
207
|
+
});
|
|
208
|
+
return classification;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Route to appropriate agent based on intent
|
|
212
|
+
*/
|
|
213
|
+
route(input, context) {
|
|
214
|
+
const intent = this.classifyIntent(input);
|
|
215
|
+
const availableAgents = context?.availableAgents || Object.keys(AGENT_CAPABILITIES);
|
|
216
|
+
// Score each available agent
|
|
217
|
+
const agentScores = [];
|
|
218
|
+
for (const agentType of availableAgents) {
|
|
219
|
+
const capabilities = AGENT_CAPABILITIES[agentType];
|
|
220
|
+
const score = this.calculateAgentScore(intent, capabilities);
|
|
221
|
+
agentScores.push({
|
|
222
|
+
type: agentType,
|
|
223
|
+
score,
|
|
224
|
+
confidence: score * intent.confidence,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
// Sort by confidence
|
|
228
|
+
agentScores.sort((a, b) => b.confidence - a.confidence);
|
|
229
|
+
// Get top agent
|
|
230
|
+
const topAgent = agentScores[0];
|
|
231
|
+
const alternativeAgents = agentScores.slice(1, 4);
|
|
232
|
+
// Check if preferred agent is specified
|
|
233
|
+
let targetAgent = topAgent?.type;
|
|
234
|
+
let routingConfidence = topAgent?.confidence || 0;
|
|
235
|
+
if (context?.preferredAgent && availableAgents.includes(context.preferredAgent)) {
|
|
236
|
+
const preferredScore = agentScores.find((a) => a.type === context.preferredAgent);
|
|
237
|
+
if (preferredScore && preferredScore.confidence >= this.config.minConfidence * 0.8) {
|
|
238
|
+
targetAgent = context.preferredAgent;
|
|
239
|
+
routingConfidence = preferredScore.confidence;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// Determine suggested mode
|
|
243
|
+
const suggestedMode = context?.currentMode || MODE_RECOMMENDATIONS[intent.category];
|
|
244
|
+
// Calculate estimated complexity
|
|
245
|
+
const estimatedComplexity = this.calculateComplexityScore(input, intent);
|
|
246
|
+
const decision = {
|
|
247
|
+
targetAgent: targetAgent || "engineer",
|
|
248
|
+
confidence: routingConfidence,
|
|
249
|
+
reasoning: this.generateReasoning(intent, targetAgent || "engineer"),
|
|
250
|
+
alternativeAgents: alternativeAgents.map((a) => ({
|
|
251
|
+
type: a.type,
|
|
252
|
+
confidence: a.confidence,
|
|
253
|
+
})),
|
|
254
|
+
suggestedMode,
|
|
255
|
+
estimatedComplexity,
|
|
256
|
+
};
|
|
257
|
+
logRoutingDecision(intent.intent, decision.targetAgent, decision.confidence, {
|
|
258
|
+
category: intent.category,
|
|
259
|
+
complexity: intent.complexity,
|
|
260
|
+
suggestedMode,
|
|
261
|
+
});
|
|
262
|
+
return decision;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Batch route multiple inputs
|
|
266
|
+
*/
|
|
267
|
+
batchRoute(inputs, context) {
|
|
268
|
+
return inputs.map((input) => ({
|
|
269
|
+
input,
|
|
270
|
+
decision: this.route(input, context),
|
|
271
|
+
}));
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Get agent recommendation with explanation
|
|
275
|
+
*/
|
|
276
|
+
getRecommendation(input, targetAgent) {
|
|
277
|
+
const intent = this.classifyIntent(input);
|
|
278
|
+
const capabilities = AGENT_CAPABILITIES[targetAgent];
|
|
279
|
+
const score = this.calculateAgentScore(intent, capabilities);
|
|
280
|
+
const confidence = score * intent.confidence;
|
|
281
|
+
const suitable = confidence >= this.config.minConfidence;
|
|
282
|
+
let explanation = "";
|
|
283
|
+
const suggestions = [];
|
|
284
|
+
if (suitable) {
|
|
285
|
+
explanation = `${targetAgent} is well-suited for this task with ${(confidence * 100).toFixed(1)}% confidence.`;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
explanation = `${targetAgent} may not be the best choice for this task (${(confidence * 100).toFixed(1)}% confidence).`;
|
|
289
|
+
// Suggest better alternatives
|
|
290
|
+
const allAgents = Object.keys(AGENT_CAPABILITIES);
|
|
291
|
+
const betterAgents = allAgents
|
|
292
|
+
.filter((a) => a !== targetAgent)
|
|
293
|
+
.map((a) => ({
|
|
294
|
+
type: a,
|
|
295
|
+
score: this.calculateAgentScore(intent, AGENT_CAPABILITIES[a]),
|
|
296
|
+
}))
|
|
297
|
+
.sort((a, b) => b.score - a.score)
|
|
298
|
+
.slice(0, 2);
|
|
299
|
+
suggestions.push(...betterAgents.map((a) => `Consider using ${a.type} instead (${(a.score * 100).toFixed(1)}% match)`));
|
|
300
|
+
}
|
|
301
|
+
return {
|
|
302
|
+
suitable,
|
|
303
|
+
confidence,
|
|
304
|
+
explanation,
|
|
305
|
+
suggestions,
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Assess complexity of input
|
|
310
|
+
*/
|
|
311
|
+
assessComplexity(input) {
|
|
312
|
+
const factors = [
|
|
313
|
+
input.length > 500,
|
|
314
|
+
input.includes("and") && input.split("and").length > 2,
|
|
315
|
+
/\b(design|architect|implement|integrate|deploy)\b/i.test(input),
|
|
316
|
+
/\b(multiple|several|various|complex|advanced)\b/i.test(input),
|
|
317
|
+
(input.match(/\b(test|validate|verify|check)\b/gi) || []).length > 2,
|
|
318
|
+
];
|
|
319
|
+
const score = factors.filter(Boolean).length;
|
|
320
|
+
if (score >= this.config.complexityThreshold.complex)
|
|
321
|
+
return "complex";
|
|
322
|
+
if (score >= this.config.complexityThreshold.medium)
|
|
323
|
+
return "medium";
|
|
324
|
+
return "simple";
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Extract required capabilities from input
|
|
328
|
+
*/
|
|
329
|
+
extractCapabilities(input) {
|
|
330
|
+
const capabilities = [];
|
|
331
|
+
const normalizedInput = input.toLowerCase();
|
|
332
|
+
for (const [_agentType, caps] of Object.entries(AGENT_CAPABILITIES)) {
|
|
333
|
+
for (const cap of caps) {
|
|
334
|
+
if (normalizedInput.includes(cap.toLowerCase().replace(/-/g, " "))) {
|
|
335
|
+
capabilities.push(cap);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return [...new Set(capabilities)];
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Calculate agent score based on intent and capabilities
|
|
343
|
+
*/
|
|
344
|
+
calculateAgentScore(intent, capabilities) {
|
|
345
|
+
let score = 0;
|
|
346
|
+
let maxScore = intent.requiredCapabilities.length || 1;
|
|
347
|
+
for (const required of intent.requiredCapabilities) {
|
|
348
|
+
if (capabilities.some((c) => c.toLowerCase() === required.toLowerCase())) {
|
|
349
|
+
score += 1;
|
|
350
|
+
}
|
|
351
|
+
else if (capabilities.some((c) => c.toLowerCase().includes(required.toLowerCase()))) {
|
|
352
|
+
score += 0.5;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
// Boost score for primary intent match
|
|
356
|
+
const primaryCapability = this.intentToCapability(intent.intent);
|
|
357
|
+
if (capabilities.includes(primaryCapability)) {
|
|
358
|
+
score += 0.5;
|
|
359
|
+
maxScore += 0.5;
|
|
360
|
+
}
|
|
361
|
+
return maxScore > 0 ? score / maxScore : 0;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Convert intent to primary capability
|
|
365
|
+
*/
|
|
366
|
+
intentToCapability(intent) {
|
|
367
|
+
const mapping = {
|
|
368
|
+
requirements: "requirements",
|
|
369
|
+
architecture: "architecture",
|
|
370
|
+
implementation: "implementation",
|
|
371
|
+
testing: "testing",
|
|
372
|
+
review: "code-review",
|
|
373
|
+
execution: "execution",
|
|
374
|
+
analysis: "analyze",
|
|
375
|
+
};
|
|
376
|
+
return mapping[intent] || intent;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Calculate complexity score (0-10)
|
|
380
|
+
*/
|
|
381
|
+
calculateComplexityScore(input, intent) {
|
|
382
|
+
let score = 0;
|
|
383
|
+
// Length factor
|
|
384
|
+
score += Math.min(3, input.length / 500);
|
|
385
|
+
// Complexity keywords
|
|
386
|
+
const complexityKeywords = [
|
|
387
|
+
"complex",
|
|
388
|
+
"advanced",
|
|
389
|
+
"sophisticated",
|
|
390
|
+
"enterprise",
|
|
391
|
+
"distributed",
|
|
392
|
+
"microservices",
|
|
393
|
+
"scalable",
|
|
394
|
+
"secure",
|
|
395
|
+
"high-performance",
|
|
396
|
+
];
|
|
397
|
+
for (const keyword of complexityKeywords) {
|
|
398
|
+
if (input.toLowerCase().includes(keyword))
|
|
399
|
+
score += 0.5;
|
|
400
|
+
}
|
|
401
|
+
// Intent complexity
|
|
402
|
+
const intentScores = {
|
|
403
|
+
requirements: 2,
|
|
404
|
+
architecture: 4,
|
|
405
|
+
implementation: 3,
|
|
406
|
+
testing: 2,
|
|
407
|
+
review: 2,
|
|
408
|
+
execution: 1,
|
|
409
|
+
analysis: 3,
|
|
410
|
+
};
|
|
411
|
+
score += intentScores[intent.intent] || 2;
|
|
412
|
+
// Complexity level
|
|
413
|
+
const complexityScores = { simple: 1, medium: 3, complex: 5 };
|
|
414
|
+
score += complexityScores[intent.complexity];
|
|
415
|
+
return Math.min(10, score);
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Generate reasoning for routing decision
|
|
419
|
+
*/
|
|
420
|
+
generateReasoning(intent, targetAgent) {
|
|
421
|
+
const reasons = [];
|
|
422
|
+
reasons.push(`Intent classified as "${intent.intent}" (${intent.category})`);
|
|
423
|
+
reasons.push(`Confidence: ${(intent.confidence * 100).toFixed(1)}%`);
|
|
424
|
+
reasons.push(`Complexity: ${intent.complexity}`);
|
|
425
|
+
if (intent.requiredCapabilities.length > 0) {
|
|
426
|
+
reasons.push(`Required capabilities: ${intent.requiredCapabilities.join(", ")}`);
|
|
427
|
+
}
|
|
428
|
+
reasons.push(`${targetAgent} has matching capabilities`);
|
|
429
|
+
return reasons.join("; ");
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Update router configuration
|
|
433
|
+
*/
|
|
434
|
+
updateConfig(config) {
|
|
435
|
+
this.config = { ...this.config, ...config };
|
|
436
|
+
logger.info("Auto-router config updated", { config: this.config });
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Get current configuration
|
|
440
|
+
*/
|
|
441
|
+
getConfig() {
|
|
442
|
+
return { ...this.config };
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
//# sourceMappingURL=auto-router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-router.js","sourceRoot":"","sources":["../../src/engines/auto-router.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAShE,MAAM,cAAc,GAAqB;IACvC,aAAa,EAAE,IAAI;IACnB,cAAc,EAAE,IAAI;IACpB,mBAAmB,EAAE;QACnB,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,EAAE;KACZ;CACF,CAAC;AAEF,qCAAqC;AACrC,MAAM,eAAe,GAGjB;IACF,YAAY,EAAE;QACZ,QAAQ,EAAE;YACR,cAAc;YACd,OAAO;YACP,kBAAkB;YAClB,aAAa;YACb,sBAAsB;YACtB,MAAM;YACN,eAAe;SAChB;QACD,QAAQ,EAAE,QAAQ;KACnB;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE;YACR,YAAY;YACZ,kBAAkB;YAClB,iBAAiB;YACjB,cAAc;YACd,mBAAmB;YACnB,cAAc;YACd,eAAe;SAChB;QACD,QAAQ,EAAE,QA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CAAC,CAAC;IAC7B,CAAC;IAED;;OAEG;IACK,iBAAiB,CACvB,MAA4B,EAC5B,WAAsB;QAEtB,MAAM,OAAO,GAAa,EAAE,CAAC;QAE7B,OAAO,CAAC,IAAI,CAAC,yBAAyB,MAAM,CAAC,MAAM,MAAM,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC;QAC7E,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrE,OAAO,CAAC,IAAI,CAAC,eAAe,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;QAEjD,IAAI,MAAM,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3C,OAAO,CAAC,IAAI,CACV,0BAA0B,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACnE,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,GAAG,WAAW,4BAA4B,CAAC,CAAC;QAEzD,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,MAAiC;QAC5C,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parallel Execution Engine
|
|
3
|
+
* Execute multiple tasks in parallel with real execution
|
|
4
|
+
*/
|
|
5
|
+
import type { AgentType, TaskConfig, ParallelExecution } from "../types/index.js";
|
|
6
|
+
interface ExecuteOptions {
|
|
7
|
+
maxConcurrency?: number;
|
|
8
|
+
aggregationStrategy?: "all" | "first" | "majority" | "custom";
|
|
9
|
+
timeout?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Parallel Execution Engine
|
|
13
|
+
* Handles concurrent task execution with real agent operations
|
|
14
|
+
*/
|
|
15
|
+
export declare class ParallelExecutionEngine {
|
|
16
|
+
private executions;
|
|
17
|
+
private get defaultMaxConcurrency();
|
|
18
|
+
private get defaultTimeout();
|
|
19
|
+
/**
|
|
20
|
+
* Execute tasks in parallel
|
|
21
|
+
*/
|
|
22
|
+
executeParallel(tasks: Array<Omit<TaskConfig, "agentId"> & {
|
|
23
|
+
agentType: AgentType;
|
|
24
|
+
}>, options?: ExecuteOptions): Promise<ParallelExecution>;
|
|
25
|
+
/**
|
|
26
|
+
* Run parallel execution
|
|
27
|
+
*/
|
|
28
|
+
private runExecution;
|
|
29
|
+
/**
|
|
30
|
+
* Execute a single task
|
|
31
|
+
*/
|
|
32
|
+
private executeTask;
|
|
33
|
+
/**
|
|
34
|
+
* Perform actual task execution
|
|
35
|
+
*/
|
|
36
|
+
private performTaskExecution;
|
|
37
|
+
/**
|
|
38
|
+
* Execute implementation task
|
|
39
|
+
*/
|
|
40
|
+
private executeImplementationTask;
|
|
41
|
+
/**
|
|
42
|
+
* Execute analysis task
|
|
43
|
+
*/
|
|
44
|
+
private executeAnalysisTask;
|
|
45
|
+
/**
|
|
46
|
+
* Execute review task
|
|
47
|
+
*/
|
|
48
|
+
private executeReviewTask;
|
|
49
|
+
/**
|
|
50
|
+
* Execute testing task
|
|
51
|
+
*/
|
|
52
|
+
private executeTestingTask;
|
|
53
|
+
/**
|
|
54
|
+
* Execute documentation task
|
|
55
|
+
*/
|
|
56
|
+
private executeDocumentationTask;
|
|
57
|
+
/**
|
|
58
|
+
* Execute refactoring task
|
|
59
|
+
*/
|
|
60
|
+
private executeRefactoringTask;
|
|
61
|
+
/**
|
|
62
|
+
* Aggregate results based on strategy
|
|
63
|
+
*/
|
|
64
|
+
private aggregateResults;
|
|
65
|
+
/**
|
|
66
|
+
* Generate execution report
|
|
67
|
+
*/
|
|
68
|
+
private generateReport;
|
|
69
|
+
/**
|
|
70
|
+
* Determine overall execution status
|
|
71
|
+
*/
|
|
72
|
+
private determineExecutionStatus;
|
|
73
|
+
/**
|
|
74
|
+
* Get execution by ID
|
|
75
|
+
*/
|
|
76
|
+
getExecution(executionId: string): Promise<ParallelExecution | null>;
|
|
77
|
+
/**
|
|
78
|
+
* Get all executions
|
|
79
|
+
*/
|
|
80
|
+
getAllExecutions(): ParallelExecution[];
|
|
81
|
+
/**
|
|
82
|
+
* Get execution statistics
|
|
83
|
+
*/
|
|
84
|
+
getStats(): {
|
|
85
|
+
totalExecutions: number;
|
|
86
|
+
completed: number;
|
|
87
|
+
failed: number;
|
|
88
|
+
partial: number;
|
|
89
|
+
totalTasks: number;
|
|
90
|
+
completedTasks: number;
|
|
91
|
+
failedTasks: number;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Cleanup old executions
|
|
95
|
+
*/
|
|
96
|
+
cleanup(maxAgeHours?: number): number;
|
|
97
|
+
/**
|
|
98
|
+
* Reset engine
|
|
99
|
+
*/
|
|
100
|
+
reset(): void;
|
|
101
|
+
}
|
|
102
|
+
export declare const parallelEngine: ParallelExecutionEngine;
|
|
103
|
+
export {};
|
|
104
|
+
//# sourceMappingURL=parallel-execution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parallel-execution.d.ts","sourceRoot":"","sources":["../../src/engines/parallel-execution.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EAEV,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAE3B,UAAU,cAAc;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,KAAK,GAAG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