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
|
@@ -7,6 +7,25 @@
|
|
|
7
7
|
|
|
8
8
|
const { AgentStatus } = require('../AgentStatus');
|
|
9
9
|
const { VerificationType } = require('../VerificationType');
|
|
10
|
+
const { analyzeTestResult } = require('./test-analyzer');
|
|
11
|
+
const {
|
|
12
|
+
determineAgentStatus,
|
|
13
|
+
createSummary,
|
|
14
|
+
identifyIssues,
|
|
15
|
+
generateAgentRecommendations,
|
|
16
|
+
calculateAgentConfidence,
|
|
17
|
+
createBatchSummary,
|
|
18
|
+
generateBatchRecommendations,
|
|
19
|
+
calculateBatchConfidence,
|
|
20
|
+
aggregateTestAnalyses
|
|
21
|
+
} = require('./batch-analyzer');
|
|
22
|
+
const {
|
|
23
|
+
identifyPatterns,
|
|
24
|
+
identifyRiskFactors,
|
|
25
|
+
identifyBatchPatterns,
|
|
26
|
+
calculateRiskScore,
|
|
27
|
+
generatePatternRecommendations
|
|
28
|
+
} = require('./pattern-recognizer');
|
|
10
29
|
|
|
11
30
|
/**
|
|
12
31
|
* Verification result analyzer class
|
|
@@ -28,20 +47,15 @@ class ResultAnalyzer {
|
|
|
28
47
|
* @returns {Object} - Analysis result
|
|
29
48
|
*/
|
|
30
49
|
analyzeTestResult(testResult) {
|
|
31
|
-
const analysis = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
severity: this.determineSeverity(testResult),
|
|
35
|
-
category: this.categorizeResult(testResult),
|
|
36
|
-
recommendations: this.generateRecommendations(testResult),
|
|
37
|
-
confidence: this.calculateConfidence(testResult)
|
|
38
|
-
};
|
|
50
|
+
const analysis = analyzeTestResult(testResult, {
|
|
51
|
+
detailedAnalysis: this.detailedAnalysis
|
|
52
|
+
});
|
|
39
53
|
|
|
40
54
|
// Add detailed analysis if enabled
|
|
41
55
|
if (this.detailedAnalysis) {
|
|
42
|
-
analysis.
|
|
43
|
-
analysis.
|
|
44
|
-
analysis.
|
|
56
|
+
analysis.patterns = identifyPatterns(testResult);
|
|
57
|
+
analysis.riskFactors = identifyRiskFactors(testResult);
|
|
58
|
+
analysis.riskScore = calculateRiskScore(analysis.riskFactors);
|
|
45
59
|
}
|
|
46
60
|
|
|
47
61
|
return analysis;
|
|
@@ -56,426 +70,11 @@ class ResultAnalyzer {
|
|
|
56
70
|
const analysis = {
|
|
57
71
|
agentId: verificationResult.agentId,
|
|
58
72
|
overallSuccess: verificationResult.success,
|
|
59
|
-
status:
|
|
60
|
-
summary:
|
|
61
|
-
issues:
|
|
62
|
-
recommendations:
|
|
63
|
-
confidence:
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// Analyze individual test results
|
|
67
|
-
if (verificationResult.results) {
|
|
68
|
-
analysis.testAnalyses = verificationResult.results.map(testResult =>
|
|
69
|
-
this.analyzeTestResult(testResult)
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
// Aggregate test analysis
|
|
73
|
-
analysis.testSummary = this.aggregateTestAnalyses(analysis.testAnalyses);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return analysis;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Analyze batch verification results
|
|
81
|
-
* @param {Object} batchResult - Batch verification result
|
|
82
|
-
* @returns {Object} - Analysis result
|
|
83
|
-
*/
|
|
84
|
-
analyzeBatchResult(batchResult) {
|
|
85
|
-
const analysis = {
|
|
86
|
-
batchId: batchResult.batchId || batchResult.testId,
|
|
87
|
-
overallSuccess: batchResult.success,
|
|
88
|
-
summary: this.createBatchSummary(batchResult),
|
|
89
|
-
agentAnalyses: [],
|
|
90
|
-
patterns: this.identifyBatchPatterns(batchResult),
|
|
91
|
-
recommendations: this.generateBatchRecommendations(batchResult),
|
|
92
|
-
confidence: this.calculateBatchConfidence(batchResult)
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
// Analyze individual agent results
|
|
96
|
-
if (batchResult.results) {
|
|
97
|
-
analysis.agentAnalyses = batchResult.results.map(agentResult =>
|
|
98
|
-
this.analyzeAgentResult(agentResult)
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
// Aggregate agent analyses
|
|
102
|
-
analysis.agentSummary = this.aggregateAgentAnalyses(analysis.agentAnalyses);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return analysis;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Determine result severity
|
|
110
|
-
* @param {Object} testResult - Test result
|
|
111
|
-
* @returns {string} - Severity level
|
|
112
|
-
*/
|
|
113
|
-
determineSeverity(testResult) {
|
|
114
|
-
if (!testResult.success) {
|
|
115
|
-
// Determine failure severity
|
|
116
|
-
if (testResult.error) {
|
|
117
|
-
const error = testResult.error.toLowerCase();
|
|
118
|
-
|
|
119
|
-
if (error.includes('timeout') || error.includes('network')) {
|
|
120
|
-
return 'medium';
|
|
121
|
-
} else if (error.includes('permission') || error.includes('access denied')) {
|
|
122
|
-
return 'high';
|
|
123
|
-
} else if (error.includes('not found') || error.includes('command not found')) {
|
|
124
|
-
return 'high';
|
|
125
|
-
} else {
|
|
126
|
-
return 'low';
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return 'none';
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Categorize test result
|
|
136
|
-
* @param {Object} testResult - Test result
|
|
137
|
-
* @returns {string} - Result category
|
|
138
|
-
*/
|
|
139
|
-
categorizeResult(testResult) {
|
|
140
|
-
if (!testResult.success) {
|
|
141
|
-
if (testResult.error) {
|
|
142
|
-
const error = testResult.error.toLowerCase();
|
|
143
|
-
|
|
144
|
-
if (error.includes('timeout')) {
|
|
145
|
-
return 'timeout';
|
|
146
|
-
} else if (error.includes('permission') || error.includes('access')) {
|
|
147
|
-
return 'permission';
|
|
148
|
-
} else if (error.includes('not found') || error.includes('missing')) {
|
|
149
|
-
return 'missing';
|
|
150
|
-
} else if (error.includes('network') || error.includes('connection')) {
|
|
151
|
-
return 'network';
|
|
152
|
-
} else {
|
|
153
|
-
return 'unknown';
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return 'success';
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Generate recommendations for test result
|
|
163
|
-
* @param {Object} testResult - Test result
|
|
164
|
-
* @returns {Array} - Recommendations
|
|
165
|
-
*/
|
|
166
|
-
generateRecommendations(testResult) {
|
|
167
|
-
const recommendations = [];
|
|
168
|
-
|
|
169
|
-
if (!testResult.success) {
|
|
170
|
-
const category = this.categorizeResult(testResult);
|
|
171
|
-
|
|
172
|
-
switch (category) {
|
|
173
|
-
case 'timeout':
|
|
174
|
-
recommendations.push('Increase timeout value for this test');
|
|
175
|
-
recommendations.push('Check system performance and resource availability');
|
|
176
|
-
break;
|
|
177
|
-
|
|
178
|
-
case 'permission':
|
|
179
|
-
recommendations.push('Check file/directory permissions');
|
|
180
|
-
recommendations.push('Run with appropriate user privileges');
|
|
181
|
-
break;
|
|
182
|
-
|
|
183
|
-
case 'missing':
|
|
184
|
-
recommendations.push('Verify agent installation');
|
|
185
|
-
recommendations.push('Check command availability in PATH');
|
|
186
|
-
break;
|
|
187
|
-
|
|
188
|
-
case 'network':
|
|
189
|
-
recommendations.push('Check network connectivity');
|
|
190
|
-
recommendations.push('Verify firewall settings');
|
|
191
|
-
break;
|
|
192
|
-
|
|
193
|
-
default:
|
|
194
|
-
recommendations.push('Review test configuration');
|
|
195
|
-
recommendations.push('Check system logs for detailed error information');
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return recommendations;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Calculate confidence score
|
|
204
|
-
* @param {Object} testResult - Test result
|
|
205
|
-
* @returns {number} - Confidence score (0-100)
|
|
206
|
-
*/
|
|
207
|
-
calculateConfidence(testResult) {
|
|
208
|
-
if (!testResult.success) {
|
|
209
|
-
return 0;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
let confidence = 80; // Base confidence for successful tests
|
|
213
|
-
|
|
214
|
-
// Adjust based on test duration
|
|
215
|
-
if (testResult.duration) {
|
|
216
|
-
if (testResult.duration < 1000) {
|
|
217
|
-
confidence += 10; // Very fast test
|
|
218
|
-
} else if (testResult.duration > 30000) {
|
|
219
|
-
confidence -= 10; // Very slow test
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// Adjust based on test type
|
|
224
|
-
if (testResult.type === VerificationType.FILE_OPERATION) {
|
|
225
|
-
confidence += 5; // File operations are more reliable
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return Math.min(100, Math.max(0, confidence));
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Analyze detailed test information
|
|
233
|
-
* @param {Object} testResult - Test result
|
|
234
|
-
* @returns {Object} - Detailed analysis
|
|
235
|
-
*/
|
|
236
|
-
analyzeDetails(testResult) {
|
|
237
|
-
const details = {};
|
|
238
|
-
|
|
239
|
-
if (testResult.duration) {
|
|
240
|
-
details.performance = {
|
|
241
|
-
duration: testResult.duration,
|
|
242
|
-
category: this.categorizePerformance(testResult.duration),
|
|
243
|
-
acceptable: testResult.duration < 30000
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if (testResult.type) {
|
|
248
|
-
details.testType = {
|
|
249
|
-
type: testResult.type,
|
|
250
|
-
reliability: this.getTestTypeReliability(testResult.type)
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
if (testResult.error) {
|
|
255
|
-
details.error = {
|
|
256
|
-
message: testResult.error,
|
|
257
|
-
type: this.categorizeResult(testResult),
|
|
258
|
-
recoverable: this.isRecoverableError(testResult.error)
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
return details;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Identify patterns in test result
|
|
267
|
-
* @param {Object} testResult - Test result
|
|
268
|
-
* @returns {Array} - Identified patterns
|
|
269
|
-
*/
|
|
270
|
-
identifyPatterns(testResult) {
|
|
271
|
-
const patterns = [];
|
|
272
|
-
|
|
273
|
-
if (testResult.error) {
|
|
274
|
-
const error = testResult.error.toLowerCase();
|
|
275
|
-
|
|
276
|
-
if (error.includes('timeout')) {
|
|
277
|
-
patterns.push('timeout-pattern');
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
if (error.includes('permission') || error.includes('access')) {
|
|
281
|
-
patterns.push('permission-pattern');
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
if (error.includes('not found')) {
|
|
285
|
-
patterns.push('missing-dependency-pattern');
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (testResult.duration && testResult.duration > 30000) {
|
|
290
|
-
patterns.push('slow-performance-pattern');
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
return patterns;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Identify risk factors
|
|
298
|
-
* @param {Object} testResult - Test result
|
|
299
|
-
* @returns {Array} - Risk factors
|
|
300
|
-
*/
|
|
301
|
-
identifyRiskFactors(testResult) {
|
|
302
|
-
const risks = [];
|
|
303
|
-
|
|
304
|
-
if (!testResult.success) {
|
|
305
|
-
const severity = this.determineSeverity(testResult);
|
|
306
|
-
|
|
307
|
-
if (severity === 'high') {
|
|
308
|
-
risks.push('critical-failure-risk');
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
if (this.categorizeResult(testResult) === 'permission') {
|
|
312
|
-
risks.push('security-risk');
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
if (testResult.type === VerificationType.COMMAND_EXECUTION && !testResult.success) {
|
|
316
|
-
risks.push('command-execution-risk');
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
return risks;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Determine agent status based on verification result
|
|
325
|
-
* @param {Object} verificationResult - Verification result
|
|
326
|
-
* @returns {string} - Agent status
|
|
327
|
-
*/
|
|
328
|
-
determineAgentStatus(verificationResult) {
|
|
329
|
-
if (!verificationResult.success) {
|
|
330
|
-
return AgentStatus.ERROR;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
if (verificationResult.summary) {
|
|
334
|
-
if (verificationResult.summary.allPassed) {
|
|
335
|
-
return AgentStatus.VERIFIED;
|
|
336
|
-
} else if (verificationResult.summary.passed > 0) {
|
|
337
|
-
return AgentStatus.INSTALLED; // Partial success
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
return AgentStatus.ERROR;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Create summary for agent result
|
|
346
|
-
* @param {Object} verificationResult - Verification result
|
|
347
|
-
* @returns {Object} - Summary
|
|
348
|
-
*/
|
|
349
|
-
createSummary(verificationResult) {
|
|
350
|
-
const summary = {
|
|
351
|
-
agentId: verificationResult.agentId,
|
|
352
|
-
success: verificationResult.success,
|
|
353
|
-
duration: verificationResult.duration || 0
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
if (verificationResult.summary) {
|
|
357
|
-
summary.tests = verificationResult.summary;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
if (verificationResult.results) {
|
|
361
|
-
summary.totalTests = verificationResult.results.length;
|
|
362
|
-
summary.passedTests = verificationResult.results.filter(r => r.success).length;
|
|
363
|
-
summary.failedTests = summary.totalTests - summary.passedTests;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
return summary;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* Identify issues in verification result
|
|
371
|
-
* @param {Object} verificationResult - Verification result
|
|
372
|
-
* @returns {Array} - Issues
|
|
373
|
-
*/
|
|
374
|
-
identifyIssues(verificationResult) {
|
|
375
|
-
const issues = [];
|
|
376
|
-
|
|
377
|
-
if (!verificationResult.success) {
|
|
378
|
-
if (verificationResult.error) {
|
|
379
|
-
issues.push({
|
|
380
|
-
type: 'verification-failure',
|
|
381
|
-
severity: 'high',
|
|
382
|
-
message: verificationResult.error
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
if (verificationResult.results) {
|
|
388
|
-
verificationResult.results.forEach((testResult, index) => {
|
|
389
|
-
if (!testResult.success) {
|
|
390
|
-
issues.push({
|
|
391
|
-
type: 'test-failure',
|
|
392
|
-
severity: this.determineSeverity(testResult),
|
|
393
|
-
testId: testResult.testId,
|
|
394
|
-
message: testResult.error || 'Test failed'
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
return issues;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Generate recommendations for agent
|
|
405
|
-
* @param {Object} verificationResult - Verification result
|
|
406
|
-
* @returns {Array} - Recommendations
|
|
407
|
-
*/
|
|
408
|
-
generateAgentRecommendations(verificationResult) {
|
|
409
|
-
const recommendations = [];
|
|
410
|
-
|
|
411
|
-
if (!verificationResult.success) {
|
|
412
|
-
recommendations.push('Review agent installation and configuration');
|
|
413
|
-
|
|
414
|
-
if (verificationResult.results) {
|
|
415
|
-
const failedTests = verificationResult.results.filter(r => !r.success);
|
|
416
|
-
const categories = [...new Set(failedTests.map(t => this.categorizeResult(t)))];
|
|
417
|
-
|
|
418
|
-
categories.forEach(category => {
|
|
419
|
-
switch (category) {
|
|
420
|
-
case 'permission':
|
|
421
|
-
recommendations.push('Check file and directory permissions');
|
|
422
|
-
break;
|
|
423
|
-
case 'missing':
|
|
424
|
-
recommendations.push('Verify agent dependencies are installed');
|
|
425
|
-
break;
|
|
426
|
-
case 'timeout':
|
|
427
|
-
recommendations.push('Increase timeout values or optimize performance');
|
|
428
|
-
break;
|
|
429
|
-
}
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
return recommendations;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* Calculate confidence for agent result
|
|
439
|
-
* @param {Object} verificationResult - Verification result
|
|
440
|
-
* @returns {number} - Confidence score
|
|
441
|
-
*/
|
|
442
|
-
calculateAgentConfidence(verificationResult) {
|
|
443
|
-
if (!verificationResult.success || !verificationResult.results) {
|
|
444
|
-
return 0;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
const testConfidences = verificationResult.results.map(testResult =>
|
|
448
|
-
this.calculateConfidence(testResult)
|
|
449
|
-
);
|
|
450
|
-
|
|
451
|
-
return Math.round(testConfidences.reduce((sum, conf) => sum + conf, 0) / testConfidences.length);
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
/**
|
|
455
|
-
* Aggregate test analyses
|
|
456
|
-
* @param {Array} testAnalyses - Test analyses
|
|
457
|
-
* @returns {Object} - Aggregated summary
|
|
458
|
-
*/
|
|
459
|
-
aggregateTestAnalyses(testAnalyses) {
|
|
460
|
-
const summary = {
|
|
461
|
-
totalTests: testAnalyses.length,
|
|
462
|
-
successfulTests: testAnalyses.filter(t => t.success).length,
|
|
463
|
-
severityDistribution: {},
|
|
464
|
-
categoryDistribution: {},
|
|
465
|
-
averageConfidence: 0
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
// Calculate distributions
|
|
469
|
-
testAnalyses.forEach(analysis => {
|
|
470
|
-
const severity = analysis.severity;
|
|
471
|
-
const category = analysis.category;
|
|
472
|
-
|
|
473
|
-
summary.severityDistribution[severity] = (summary.severityDistribution[severity] || 0) + 1;
|
|
474
|
-
summary.categoryDistribution[category] = (summary.categoryDistribution[category] || 0) + 1;
|
|
475
|
-
});
|
|
476
|
-
|
|
477
|
-
// Calculate average confidence
|
|
478
|
-
const confidences = testAnalyses.map(t => t.confidence).filter(c => c > 0);
|
|
73
|
+
status: determineAgentStatus(verificationResult),
|
|
74
|
+
summary: createSummary(verificationResult),
|
|
75
|
+
issues: identifyIssues(verificationResult),
|
|
76
|
+
recommendations: generateAgentRecommendations(verificationResult),
|
|
77
|
+
confidence: calculateAgentConfidence(verificationResult)
|
|
479
78
|
if (confidences.length > 0) {
|
|
480
79
|
summary.averageConfidence = Math.round(confidences.reduce((sum, conf) => sum + conf, 0) / confidences.length);
|
|
481
80
|
}
|