vibecodingmachine-core 2026.2.26-1739 → 2026.3.9-850
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/package.json +1 -1
- package/src/agents/AgentCheckDiscoveryService.js +180 -0
- package/src/agents/AgentCheckService.js +18 -261
- package/src/agents/AgentCheckStatisticsService.js +195 -0
- package/src/agents/EnvironmentConfigurationManager.js +31 -380
- package/src/agents/InstallationType.js +19 -6
- package/src/agents/SimpleAgentCheckService.js +472 -0
- package/src/agents/config-managers/ConfigUtils.js +72 -0
- package/src/agents/config-managers/DefaultConfig.js +58 -0
- package/src/agents/config-managers/EnvVarLoader.js +66 -0
- package/src/agents/config-managers/FileConfigLoader.js +124 -0
- package/src/agents/config-managers/TypeConverters.js +61 -0
- package/src/agents/config-managers/VariableMappings.js +92 -0
- package/src/agents/discovery/AgentDiscoveryService-refactored.js +272 -0
- package/src/agents/discovery/AgentDiscoveryService.js +29 -403
- package/src/agents/discovery/agent-validator.js +262 -0
- package/src/agents/discovery/discovery-results.js +176 -0
- package/src/agents/discovery/discovery-scanner.js +268 -0
- package/src/agents/discovery/discovery-utils.js +161 -0
- package/src/agents/discovery/executable-analyzer.js +290 -0
- package/src/agents/discovery/history-manager.js +310 -0
- package/src/agents/verification/ResultAnalyzer-refactored.js +341 -0
- package/src/agents/verification/ResultAnalyzer.js +30 -431
- package/src/agents/verification/analysis-utils.js +310 -0
- package/src/agents/verification/batch-analyzer.js +440 -0
- package/src/agents/verification/pattern-recognizer.js +369 -0
- package/src/agents/verification/report-generator.js +320 -0
- package/src/agents/verification/test-analyzer.js +290 -0
- package/src/agents/windows/InstallerFactory.js +4 -0
- package/src/agents/windows/VSCodeExtensionInstaller.js +404 -0
- package/src/analysis/analysis-engine.js +314 -0
- package/src/analysis/ast-analyzer.js +342 -0
- package/src/analysis/boundary-detector-refactored.js +378 -0
- package/src/analysis/boundary-detector.js +200 -603
- package/src/analysis/boundary-scanner.js +609 -0
- package/src/analysis/boundary-types.js +118 -0
- package/src/analysis/boundary-utils.js +293 -0
- package/src/analysis/deadline-priority-calculator.js +18 -0
- package/src/analysis/detection-methods.js +347 -0
- package/src/analysis/importance-priority-calculator.js +18 -0
- package/src/analysis/priority/factor-calculators.js +204 -0
- package/src/analysis/priority/factor-helpers.js +71 -0
- package/src/analysis/priority/priority-constants.js +73 -0
- package/src/analysis/priority/priority-factor-calculators.js +301 -0
- package/src/analysis/priority/reasons-generator.js +44 -0
- package/src/analysis/priority-calculator.js +15 -580
- package/src/analysis/strategy-generator.js +16 -66
- package/src/analysis/type-priority-calculator.js +18 -0
- package/src/analysis/urgency-priority-calculator.js +18 -0
- package/src/auto-mode/AutoModeBusinessLogic.js +2 -40
- package/src/commands/disable-requirement.js +60 -0
- package/src/commands/disable-spec.js +60 -0
- package/src/commands/enable-requirement.js +60 -0
- package/src/commands/enable-spec.js +60 -0
- package/src/commands/registry.js +1 -6
- package/src/commands/requirements.js +8 -2
- package/src/ide-integration/applescript-manager.cjs +9 -24
- package/src/ide-integration/cdp-handlers/chat-reader.js +44 -0
- package/src/ide-integration/cdp-handlers/connection-handler.js +88 -0
- package/src/ide-integration/cdp-handlers/continuation-handler.js +314 -0
- package/src/ide-integration/cdp-handlers/message-submitter.js +75 -0
- package/src/ide-integration/cdp-handlers/text-sender.js +138 -0
- package/src/ide-integration/cdp-manager.js +28 -573
- package/src/ide-integration/claude-code-cli-manager.cjs +48 -12
- package/src/ide-integration/ide-openers/claude-opener.js +171 -0
- package/src/ide-integration/ide-openers/cursor-opener.js +53 -0
- package/src/ide-integration/ide-openers/other-ides-opener.js +230 -0
- package/src/ide-integration/ide-openers/vscode-opener.js +147 -0
- package/src/ide-integration/macos-ide-manager.js +20 -582
- package/src/ide-integration/macos-quota-checker.js +164 -0
- package/src/ide-integration/macos-text-sender.js +19 -38
- package/src/ide-integration/provider-manager.cjs +52 -7
- package/src/index.cjs +6 -0
- package/src/index.js +10 -0
- package/src/llm/direct-llm-manager.cjs +501 -0
- package/src/localization/translations/en-part1.js +363 -0
- package/src/localization/translations/en-part2.js +320 -0
- package/src/localization/translations/en.js +4 -687
- package/src/localization/translations/es-part1.js +363 -0
- package/src/localization/translations/es-part2.js +320 -0
- package/src/localization/translations/es.js +4 -688
- package/src/models/file-analysis-collection.js +139 -0
- package/src/models/file-analysis-metrics.js +50 -0
- package/src/models/file-analysis.js +15 -262
- package/src/models/plan-manager.js +410 -0
- package/src/models/refactoring-models.js +380 -0
- package/src/models/refactoring-plan-refactored.js +81 -0
- package/src/models/refactoring-plan.js +2 -663
- package/src/monitoring/alert-system.js +4 -45
- package/src/monitoring/continuous-scan-notifications.js +37 -191
- package/src/monitoring/notification-handlers/base-handler.js +58 -0
- package/src/monitoring/notification-handlers/error-handler.js +36 -0
- package/src/monitoring/notification-handlers/index.js +21 -0
- package/src/monitoring/notification-handlers/new-violation-handler.js +91 -0
- package/src/monitoring/notification-handlers/progress-handler.js +48 -0
- package/src/monitoring/notification-handlers/resolved-violation-handler.js +54 -0
- package/src/monitoring/notification-handlers/threshold-handler.js +36 -0
- package/src/provider-registry.js +8 -0
- package/src/refactoring/boundary/boundary-detector-refactored.js +58 -0
- package/src/refactoring/boundary/boundary-detector.js +26 -596
- package/src/refactoring/boundary/detectors/boundary-analyzers.js +281 -0
- package/src/refactoring/boundary/detectors/boundary-core.js +167 -0
- package/src/refactoring/boundary/detectors/class-detector.js +247 -0
- package/src/refactoring/boundary/detectors/config-detector.js +270 -0
- package/src/refactoring/boundary/detectors/constant-detector.js +269 -0
- package/src/refactoring/boundary/detectors/function-detector.js +248 -0
- package/src/refactoring/boundary/detectors/module-detector.js +249 -0
- package/src/refactoring/boundary/detectors/object-detector.js +247 -0
- package/src/refactoring/boundary/detectors/type-detectors.js +338 -0
- package/src/refactoring/boundary/detectors/utility-detector.js +270 -0
- package/src/refactoring/circular-dependency-resolver-original.js +16 -76
- package/src/refactoring/code-mover-refactored.js +309 -0
- package/src/refactoring/code-mover.js +48 -355
- package/src/refactoring/execution-status.js +18 -0
- package/src/refactoring/execution-strategies.js +172 -0
- package/src/refactoring/file-splitter-core.js +568 -0
- package/src/refactoring/file-splitter-types.js +136 -0
- package/src/refactoring/file-splitter.js +2 -682
- package/src/refactoring/functionality-validator.js +11 -51
- package/src/refactoring/import-manager-refactored.js +385 -0
- package/src/refactoring/import-manager.js +112 -487
- package/src/refactoring/import-models.js +189 -0
- package/src/refactoring/import-parser.js +306 -0
- package/src/refactoring/move-executor.js +431 -0
- package/src/refactoring/move-utils.js +368 -0
- package/src/refactoring/operation-executor.js +76 -0
- package/src/refactoring/plan-creator.js +36 -0
- package/src/refactoring/plan-executor.js +143 -0
- package/src/refactoring/plan-validator.js +68 -0
- package/src/refactoring/refactoring-executor-result.js +70 -0
- package/src/refactoring/refactoring-executor.js +34 -569
- package/src/refactoring/refactoring-operation.js +94 -0
- package/src/refactoring/refactoring-plan.js +69 -0
- package/src/refactoring/refactoring-rollback.js +22 -527
- package/src/refactoring/rollback-handlers/RollbackExecutor.js +107 -0
- package/src/refactoring/rollback-handlers/RollbackManager.js +265 -0
- package/src/refactoring/rollback-handlers/RollbackOperation.js +105 -0
- package/src/refactoring/rollback-handlers/RollbackResult.js +109 -0
- package/src/refactoring/rollback-handlers/RollbackStatistics.js +77 -0
- package/src/refactoring/test-validator.js +32 -448
- package/src/refactoring/validation/baseline-runner.js +71 -0
- package/src/refactoring/validation/report-generator.js +136 -0
- package/src/refactoring/validation/result-comparator.js +92 -0
- package/src/refactoring/validation/test-suite.js +59 -0
- package/src/refactoring/validation/test-validation-result.js +83 -0
- package/src/refactoring/validation/validation-runner.js +95 -0
- package/src/refactoring/validation/validation-status.js +18 -0
- package/src/rui/commands/AgentCommandParser.js +60 -369
- package/src/rui/commands/AgentResponseFormatter.js +7 -47
- package/src/rui/commands/parsers/CommandMapper.js +148 -0
- package/src/rui/commands/parsers/CommandValidator.js +228 -0
- package/src/rui/commands/parsers/ComponentExtractor.js +100 -0
- package/src/rui/commands/parsers/TokenParser.js +69 -0
- package/src/rui/commands/parsers/tokenizer.js +153 -0
- package/src/utils/current-requirement-operations.js +50 -1
- package/src/utils/report-generator.js +18 -514
- package/src/utils/report-generators/analysis-generator.js +115 -0
- package/src/utils/report-generators/base-generator.js +141 -0
- package/src/utils/report-generators/compliance-generator.js +41 -0
- package/src/utils/report-generators/format-handlers.js +185 -0
- package/src/utils/report-generators/refactoring-generator.js +46 -0
- package/src/utils/report-generators/validation-generator.js +63 -0
- package/src/utils/requirement-enable-disable.js +265 -0
- package/src/utils/requirement-helpers/requirement-file-ops.js +69 -1
- package/src/utils/requirement-helpers/requirement-mover.js +88 -1
- package/src/utils/requirement-helpers.js +5 -2
- package/src/utils/smoke-test-cli.js +45 -8
- package/src/utils/specification-enable-disable.js +122 -0
- package/src/utils/specification-helpers.js +30 -4
- package/src/utils/specification-migration.js +5 -5
- package/src/utils/test-comparator.js +118 -0
- package/src/utils/test-config.js +54 -0
- package/src/utils/test-executor.js +133 -0
- package/src/utils/test-parser.js +215 -0
- package/src/utils/test-runner-baseline.js +63 -0
- package/src/utils/test-runner-core.js +98 -0
- package/src/utils/test-runner-report.js +39 -0
- package/src/utils/test-runner-validation.js +71 -0
- package/src/utils/test-runner.js +11 -535
- package/src/validation/comparison-analyzer.js +333 -0
- package/src/validation/compliance-reporter-new.js +282 -0
- package/src/validation/compliance-reporter-refactored.js +344 -0
- package/src/validation/compliance-reporter.js +278 -591
- package/src/validation/compliance-utils.js +278 -0
- package/src/validation/html-generator.js +446 -0
- package/src/validation/metrics/category-calculator.js +137 -0
- package/src/validation/metrics/metrics-helpers.js +155 -0
- package/src/validation/metrics/overview-calculator.js +85 -0
- package/src/validation/metrics/overview-metrics.js +41 -0
- package/src/validation/metrics/quality-calculator.js +166 -0
- package/src/validation/metrics/size-calculator.js +69 -0
- package/src/validation/metrics-calculator.js +27 -551
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verification Result - Batch Analyzer
|
|
3
|
+
*
|
|
4
|
+
* Analyzes batch verification results and agent summaries.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { AgentStatus } = require('../AgentStatus');
|
|
8
|
+
const { analyzeTestResult } = require('./test-analyzer');
|
|
9
|
+
const { identifyBatchPatterns, calculateRiskScore } = require('./pattern-recognizer');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Determine agent status from verification result
|
|
13
|
+
* @param {Object} verificationResult - Agent verification result
|
|
14
|
+
* @returns {string} - Agent status
|
|
15
|
+
*/
|
|
16
|
+
function determineAgentStatus(verificationResult) {
|
|
17
|
+
if (!verificationResult.success) {
|
|
18
|
+
if (verificationResult.error) {
|
|
19
|
+
const error = verificationResult.error.toLowerCase();
|
|
20
|
+
|
|
21
|
+
if (error.includes('timeout') || error.includes('hang')) {
|
|
22
|
+
return AgentStatus.TIMEOUT;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (error.includes('permission') || error.includes('access')) {
|
|
26
|
+
return AgentStatus.PERMISSION_DENIED;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (error.includes('not found')) {
|
|
30
|
+
return AgentStatus.NOT_FOUND;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return AgentStatus.FAILED;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Check individual test results
|
|
38
|
+
if (verificationResult.results) {
|
|
39
|
+
const failedTests = verificationResult.results.filter(r => !r.success);
|
|
40
|
+
const totalTests = verificationResult.results.length;
|
|
41
|
+
|
|
42
|
+
if (failedTests.length === 0) {
|
|
43
|
+
return AgentStatus.VERIFIED;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (failedTests.length / totalTests > 0.5) {
|
|
47
|
+
return AgentStatus.FAILED;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (failedTests.length / totalTests > 0.2) {
|
|
51
|
+
return AgentStatus.WARNING;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return AgentStatus.PARTIAL;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return AgentStatus.VERIFIED;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Create summary for agent verification result
|
|
62
|
+
* @param {Object} verificationResult - Agent verification result
|
|
63
|
+
* @returns {Object} - Summary
|
|
64
|
+
*/
|
|
65
|
+
function createSummary(verificationResult) {
|
|
66
|
+
const summary = {
|
|
67
|
+
totalTests: 0,
|
|
68
|
+
passedTests: 0,
|
|
69
|
+
failedTests: 0,
|
|
70
|
+
skippedTests: 0,
|
|
71
|
+
duration: verificationResult.duration || 0,
|
|
72
|
+
timestamp: verificationResult.timestamp || new Date().toISOString()
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
if (verificationResult.results) {
|
|
76
|
+
summary.totalTests = verificationResult.results.length;
|
|
77
|
+
summary.passedTests = verificationResult.results.filter(r => r.success).length;
|
|
78
|
+
summary.failedTests = verificationResult.results.filter(r => !r.success).length;
|
|
79
|
+
summary.skippedTests = verificationResult.results.filter(r => r.skipped).length;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Calculate success rate
|
|
83
|
+
if (summary.totalTests > 0) {
|
|
84
|
+
summary.successRate = Math.round((summary.passedTests / summary.totalTests) * 100);
|
|
85
|
+
} else {
|
|
86
|
+
summary.successRate = 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return summary;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Identify issues in verification result
|
|
94
|
+
* @param {Object} verificationResult - Agent verification result
|
|
95
|
+
* @returns {Array} - Identified issues
|
|
96
|
+
*/
|
|
97
|
+
function identifyIssues(verificationResult) {
|
|
98
|
+
const issues = [];
|
|
99
|
+
|
|
100
|
+
if (!verificationResult.success) {
|
|
101
|
+
issues.push({
|
|
102
|
+
type: 'verification-failure',
|
|
103
|
+
severity: 'high',
|
|
104
|
+
message: verificationResult.error || 'Unknown verification error',
|
|
105
|
+
timestamp: new Date().toISOString()
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (verificationResult.results) {
|
|
110
|
+
verificationResult.results.forEach((result, index) => {
|
|
111
|
+
if (!result.success) {
|
|
112
|
+
issues.push({
|
|
113
|
+
type: 'test-failure',
|
|
114
|
+
severity: 'medium',
|
|
115
|
+
testId: result.testId,
|
|
116
|
+
message: result.error || 'Test failed',
|
|
117
|
+
index,
|
|
118
|
+
timestamp: result.timestamp || new Date().toISOString()
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (result.duration && result.duration > 30000) {
|
|
123
|
+
issues.push({
|
|
124
|
+
type: 'performance-issue',
|
|
125
|
+
severity: 'low',
|
|
126
|
+
testId: result.testId,
|
|
127
|
+
message: `Test took ${result.duration}ms to execute`,
|
|
128
|
+
index,
|
|
129
|
+
timestamp: result.timestamp || new Date().toISOString()
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return issues;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Generate recommendations for agent
|
|
140
|
+
* @param {Object} verificationResult - Agent verification result
|
|
141
|
+
* @returns {Array} - Recommendations
|
|
142
|
+
*/
|
|
143
|
+
function generateAgentRecommendations(verificationResult) {
|
|
144
|
+
const recommendations = [];
|
|
145
|
+
|
|
146
|
+
if (!verificationResult.success) {
|
|
147
|
+
if (verificationResult.error) {
|
|
148
|
+
const error = verificationResult.error.toLowerCase();
|
|
149
|
+
|
|
150
|
+
if (error.includes('timeout')) {
|
|
151
|
+
recommendations.push({
|
|
152
|
+
type: 'configuration',
|
|
153
|
+
message: 'Increase timeout settings for agent verification',
|
|
154
|
+
priority: 'medium'
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (error.includes('permission')) {
|
|
159
|
+
recommendations.push({
|
|
160
|
+
type: 'permissions',
|
|
161
|
+
message: 'Check and fix agent file permissions',
|
|
162
|
+
priority: 'high'
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (error.includes('not found')) {
|
|
167
|
+
recommendations.push({
|
|
168
|
+
type: 'installation',
|
|
169
|
+
message: 'Verify agent installation and dependencies',
|
|
170
|
+
priority: 'high'
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (verificationResult.results) {
|
|
177
|
+
const failedTests = verificationResult.results.filter(r => !r.success);
|
|
178
|
+
|
|
179
|
+
if (failedTests.length > 0) {
|
|
180
|
+
// Analyze failure patterns
|
|
181
|
+
const errorTypes = new Set();
|
|
182
|
+
failedTests.forEach(test => {
|
|
183
|
+
if (test.error) {
|
|
184
|
+
errorTypes.add(test.error.split(':')[0]);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
if (errorTypes.size > 3) {
|
|
189
|
+
recommendations.push({
|
|
190
|
+
type: 'systematic',
|
|
191
|
+
message: 'Multiple different failure types detected - investigate environment',
|
|
192
|
+
priority: 'high'
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Performance recommendations
|
|
197
|
+
const slowTests = failedTests.filter(t => t.duration && t.duration > 20000);
|
|
198
|
+
if (slowTests.length > 0) {
|
|
199
|
+
recommendations.push({
|
|
200
|
+
type: 'performance',
|
|
201
|
+
message: 'Optimize test performance and resource usage',
|
|
202
|
+
priority: 'medium'
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return recommendations;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Calculate confidence for agent result
|
|
213
|
+
* @param {Object} verificationResult - Agent verification result
|
|
214
|
+
* @returns {number} - Confidence score (0-100)
|
|
215
|
+
*/
|
|
216
|
+
function calculateAgentConfidence(verificationResult) {
|
|
217
|
+
if (!verificationResult.success) {
|
|
218
|
+
return 20; // Low confidence for failed verification
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (!verificationResult.results || verificationResult.results.length === 0) {
|
|
222
|
+
return 50; // Medium confidence for no test results
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const results = verificationResult.results;
|
|
226
|
+
const successfulTests = results.filter(r => r.success);
|
|
227
|
+
const successRate = successfulTests.length / results.length;
|
|
228
|
+
|
|
229
|
+
// Base confidence from success rate
|
|
230
|
+
let confidence = successRate * 80;
|
|
231
|
+
|
|
232
|
+
// Adjust for test count
|
|
233
|
+
if (results.length >= 5) {
|
|
234
|
+
confidence += 10; // More tests = higher confidence
|
|
235
|
+
} else if (results.length < 3) {
|
|
236
|
+
confidence -= 10; // Fewer tests = lower confidence
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Adjust for performance consistency
|
|
240
|
+
const durations = results.filter(r => r.duration).map(r => r.duration);
|
|
241
|
+
if (durations.length > 1) {
|
|
242
|
+
const avgDuration = durations.reduce((sum, d) => sum + d, 0) / durations.length;
|
|
243
|
+
const variance = durations.reduce((sum, d) => sum + Math.pow(d - avgDuration, 2), 0) / durations.length;
|
|
244
|
+
const stdDev = Math.sqrt(variance);
|
|
245
|
+
|
|
246
|
+
if (stdDev < avgDuration * 0.3) {
|
|
247
|
+
confidence += 5; // Consistent performance
|
|
248
|
+
} else if (stdDev > avgDuration) {
|
|
249
|
+
confidence -= 5; // Inconsistent performance
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return Math.min(100, Math.max(0, Math.round(confidence)));
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Create summary for batch verification
|
|
258
|
+
* @param {Object} batchResult - Batch verification result
|
|
259
|
+
* @returns {Object} - Batch summary
|
|
260
|
+
*/
|
|
261
|
+
function createBatchSummary(batchResult) {
|
|
262
|
+
const summary = {
|
|
263
|
+
totalAgents: 0,
|
|
264
|
+
successfulAgents: 0,
|
|
265
|
+
failedAgents: 0,
|
|
266
|
+
totalTests: 0,
|
|
267
|
+
passedTests: 0,
|
|
268
|
+
failedTests: 0,
|
|
269
|
+
duration: batchResult.duration || 0,
|
|
270
|
+
timestamp: batchResult.timestamp || new Date().toISOString()
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
if (batchResult.results) {
|
|
274
|
+
summary.totalAgents = batchResult.results.length;
|
|
275
|
+
summary.successfulAgents = batchResult.results.filter(r => r.success).length;
|
|
276
|
+
summary.failedAgents = batchResult.results.filter(r => !r.success).length;
|
|
277
|
+
|
|
278
|
+
// Aggregate test counts
|
|
279
|
+
batchResult.results.forEach(agentResult => {
|
|
280
|
+
if (agentResult.results) {
|
|
281
|
+
summary.totalTests += agentResult.results.length;
|
|
282
|
+
summary.passedTests += agentResult.results.filter(t => t.success).length;
|
|
283
|
+
summary.failedTests += agentResult.results.filter(t => !t.success).length;
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// Calculate rates
|
|
289
|
+
if (summary.totalAgents > 0) {
|
|
290
|
+
summary.agentSuccessRate = Math.round((summary.successfulAgents / summary.totalAgents) * 100);
|
|
291
|
+
} else {
|
|
292
|
+
summary.agentSuccessRate = 0;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (summary.totalTests > 0) {
|
|
296
|
+
summary.testSuccessRate = Math.round((summary.passedTests / summary.totalTests) * 100);
|
|
297
|
+
} else {
|
|
298
|
+
summary.testSuccessRate = 0;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return summary;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Generate recommendations for batch
|
|
306
|
+
* @param {Object} batchResult - Batch verification result
|
|
307
|
+
* @returns {Array} - Recommendations
|
|
308
|
+
*/
|
|
309
|
+
function generateBatchRecommendations(batchResult) {
|
|
310
|
+
const recommendations = [];
|
|
311
|
+
|
|
312
|
+
if (!batchResult.success) {
|
|
313
|
+
recommendations.push({
|
|
314
|
+
type: 'batch-failure',
|
|
315
|
+
message: 'Batch verification failed - check system resources',
|
|
316
|
+
priority: 'high'
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (batchResult.results) {
|
|
321
|
+
const agentFailureRate = batchResult.results.filter(r => !r.success).length / batchResult.results.length;
|
|
322
|
+
|
|
323
|
+
if (agentFailureRate > 0.5) {
|
|
324
|
+
recommendations.push({
|
|
325
|
+
type: 'systematic',
|
|
326
|
+
message: 'High agent failure rate - investigate environment issues',
|
|
327
|
+
priority: 'high'
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (agentFailureRate > 0.2) {
|
|
332
|
+
recommendations.push({
|
|
333
|
+
type: 'quality',
|
|
334
|
+
message: 'Review agent quality and compatibility',
|
|
335
|
+
priority: 'medium'
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Performance recommendations
|
|
340
|
+
const slowAgents = batchResult.results.filter(r => r.duration && r.duration > 60000);
|
|
341
|
+
if (slowAgents.length > 0) {
|
|
342
|
+
recommendations.push({
|
|
343
|
+
type: 'performance',
|
|
344
|
+
message: 'Optimize verification performance for slow agents',
|
|
345
|
+
priority: 'medium'
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
return recommendations;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Calculate confidence for batch result
|
|
355
|
+
* @param {Object} batchResult - Batch verification result
|
|
356
|
+
* @returns {number} - Confidence score (0-100)
|
|
357
|
+
*/
|
|
358
|
+
function calculateBatchConfidence(batchResult) {
|
|
359
|
+
if (!batchResult.success) {
|
|
360
|
+
return 10; // Very low confidence for failed batch
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (!batchResult.results || batchResult.results.length === 0) {
|
|
364
|
+
return 30; // Low confidence for empty results
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
const results = batchResult.results;
|
|
368
|
+
const successfulAgents = results.filter(r => r.success);
|
|
369
|
+
const agentSuccessRate = successfulAgents.length / results.length;
|
|
370
|
+
|
|
371
|
+
// Base confidence from agent success rate
|
|
372
|
+
let confidence = agentSuccessRate * 70;
|
|
373
|
+
|
|
374
|
+
// Adjust for batch size
|
|
375
|
+
if (results.length >= 10) {
|
|
376
|
+
confidence += 10; // Larger batch = higher confidence
|
|
377
|
+
} else if (results.length < 5) {
|
|
378
|
+
confidence -= 10; // Smaller batch = lower confidence
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
return Math.min(100, Math.max(0, Math.round(confidence)));
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Aggregate test analyses
|
|
386
|
+
* @param {Array} testAnalyses - Test analysis results
|
|
387
|
+
* @returns {Object} - Aggregated analysis
|
|
388
|
+
*/
|
|
389
|
+
function aggregateTestAnalyses(testAnalyses) {
|
|
390
|
+
if (!testAnalyses || testAnalyses.length === 0) {
|
|
391
|
+
return {
|
|
392
|
+
totalTests: 0,
|
|
393
|
+
severityDistribution: {},
|
|
394
|
+
categoryDistribution: {},
|
|
395
|
+
averageConfidence: 0,
|
|
396
|
+
commonPatterns: [],
|
|
397
|
+
riskScore: 0
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
const aggregation = {
|
|
402
|
+
totalTests: testAnalyses.length,
|
|
403
|
+
severityDistribution: {},
|
|
404
|
+
categoryDistribution: {},
|
|
405
|
+
averageConfidence: 0,
|
|
406
|
+
commonPatterns: [],
|
|
407
|
+
riskScore: 0
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
// Calculate distributions
|
|
411
|
+
testAnalyses.forEach(analysis => {
|
|
412
|
+
// Severity distribution
|
|
413
|
+
const severity = analysis.severity;
|
|
414
|
+
aggregation.severityDistribution[severity] = (aggregation.severityDistribution[severity] || 0) + 1;
|
|
415
|
+
|
|
416
|
+
// Category distribution
|
|
417
|
+
const category = analysis.category;
|
|
418
|
+
aggregation.categoryDistribution[category] = (aggregation.categoryDistribution[category] || 0) + 1;
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
// Calculate average confidence
|
|
422
|
+
const confidences = testAnalyses.map(a => a.confidence).filter(c => c > 0);
|
|
423
|
+
if (confidences.length > 0) {
|
|
424
|
+
aggregation.averageConfidence = Math.round(confidences.reduce((sum, conf) => sum + conf, 0) / confidences.length);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
return aggregation;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
module.exports = {
|
|
431
|
+
determineAgentStatus,
|
|
432
|
+
createSummary,
|
|
433
|
+
identifyIssues,
|
|
434
|
+
generateAgentRecommendations,
|
|
435
|
+
calculateAgentConfidence,
|
|
436
|
+
createBatchSummary,
|
|
437
|
+
generateBatchRecommendations,
|
|
438
|
+
calculateBatchConfidence,
|
|
439
|
+
aggregateTestAnalyses
|
|
440
|
+
};
|