vibecodingmachine-core 2026.2.20-438 → 2026.2.26-1739

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.
Files changed (202) hide show
  1. package/README.md +240 -0
  2. package/package.json +10 -2
  3. package/src/agents/Agent.js +300 -0
  4. package/src/agents/AgentAdditionService.js +311 -0
  5. package/src/agents/AgentCheckService.js +690 -0
  6. package/src/agents/AgentInstallationService.js +140 -0
  7. package/src/agents/AgentSetupService.js +467 -0
  8. package/src/agents/AgentStatus.js +183 -0
  9. package/src/agents/AgentVerificationService.js +634 -0
  10. package/src/agents/ConfigurationSchemaValidator.js +543 -0
  11. package/src/agents/EnvironmentConfigurationManager.js +602 -0
  12. package/src/agents/InstallationErrorHandler.js +372 -0
  13. package/src/agents/InstallationLog.js +363 -0
  14. package/src/agents/InstallationMethod.js +510 -0
  15. package/src/agents/InstallationOrchestrator.js +352 -0
  16. package/src/agents/InstallationProgressReporter.js +372 -0
  17. package/src/agents/InstallationRetryManager.js +322 -0
  18. package/src/agents/InstallationType.js +254 -0
  19. package/src/agents/OperationTypes.js +310 -0
  20. package/src/agents/PerformanceMetricsCollector.js +493 -0
  21. package/src/agents/SecurityValidationService.js +534 -0
  22. package/src/agents/VerificationTest.js +354 -0
  23. package/src/agents/VerificationType.js +226 -0
  24. package/src/agents/WindowsPermissionHandler.js +518 -0
  25. package/src/agents/config/AgentConfigManager.js +393 -0
  26. package/src/agents/config/AgentDefaultsRegistry.js +373 -0
  27. package/src/agents/config/ConfigValidator.js +281 -0
  28. package/src/agents/discovery/AgentDiscoveryService.js +707 -0
  29. package/src/agents/logging/AgentLogger.js +511 -0
  30. package/src/agents/status/AgentStatusManager.js +481 -0
  31. package/src/agents/storage/FileManager.js +454 -0
  32. package/src/agents/verification/AgentCommunicationTester.js +474 -0
  33. package/src/agents/verification/BaseVerifier.js +430 -0
  34. package/src/agents/verification/CommandVerifier.js +480 -0
  35. package/src/agents/verification/FileOperationVerifier.js +453 -0
  36. package/src/agents/verification/ResultAnalyzer.js +707 -0
  37. package/src/agents/verification/TestRequirementManager.js +495 -0
  38. package/src/agents/verification/VerificationRunner.js +433 -0
  39. package/src/agents/windows/BaseWindowsInstaller.js +441 -0
  40. package/src/agents/windows/ChocolateyInstaller.js +509 -0
  41. package/src/agents/windows/DirectInstaller.js +443 -0
  42. package/src/agents/windows/InstallerFactory.js +391 -0
  43. package/src/agents/windows/NpmInstaller.js +505 -0
  44. package/src/agents/windows/PowerShellInstaller.js +458 -0
  45. package/src/agents/windows/WinGetInstaller.js +390 -0
  46. package/src/analysis/analysis-reporter.js +132 -0
  47. package/src/analysis/boundary-detector.js +712 -0
  48. package/src/analysis/categorizer.js +340 -0
  49. package/src/analysis/codebase-scanner.js +384 -0
  50. package/src/analysis/line-counter.js +513 -0
  51. package/src/analysis/priority-calculator.js +679 -0
  52. package/src/analysis/report/analysis-report.js +250 -0
  53. package/src/analysis/report/package-analyzer.js +278 -0
  54. package/src/analysis/report/recommendation-generator.js +382 -0
  55. package/src/analysis/report/statistics-generator.js +515 -0
  56. package/src/analysis/reports/analysis-report-model.js +101 -0
  57. package/src/analysis/reports/recommendation-generator.js +283 -0
  58. package/src/analysis/reports/report-generators.js +191 -0
  59. package/src/analysis/reports/statistics-calculator.js +231 -0
  60. package/src/analysis/reports/trend-analyzer.js +219 -0
  61. package/src/analysis/strategy-generator.js +814 -0
  62. package/src/auto-mode/AutoModeBusinessLogic.js +836 -0
  63. package/src/config/refactoring-config.js +307 -0
  64. package/src/health-tracking/json-storage.js +38 -2
  65. package/src/ide-integration/applescript-manager-core.js +233 -0
  66. package/src/ide-integration/applescript-manager.cjs +357 -28
  67. package/src/ide-integration/applescript-manager.js +89 -3599
  68. package/src/ide-integration/cdp-manager.js +306 -0
  69. package/src/ide-integration/claude-code-cli-manager.cjs +1 -1
  70. package/src/ide-integration/continuation-handler.js +337 -0
  71. package/src/ide-integration/ide-status-checker.js +292 -0
  72. package/src/ide-integration/macos-ide-manager.js +627 -0
  73. package/src/ide-integration/macos-text-sender.js +528 -0
  74. package/src/ide-integration/response-reader.js +548 -0
  75. package/src/ide-integration/windows-automation-manager.js +121 -0
  76. package/src/ide-integration/windows-ide-manager.js +373 -0
  77. package/src/index.cjs +25 -3
  78. package/src/index.js +15 -1
  79. package/src/llm/direct-llm-manager.cjs +90 -2
  80. package/src/models/compliance-report.js +538 -0
  81. package/src/models/file-analysis.js +681 -0
  82. package/src/models/refactoring-plan.js +770 -0
  83. package/src/monitoring/alert-system.js +834 -0
  84. package/src/monitoring/compliance-progress-tracker.js +437 -0
  85. package/src/monitoring/continuous-scan-notifications.js +661 -0
  86. package/src/monitoring/continuous-scanner.js +279 -0
  87. package/src/monitoring/file-monitor/file-analyzer.js +262 -0
  88. package/src/monitoring/file-monitor/file-monitor.js +237 -0
  89. package/src/monitoring/file-monitor/watcher.js +194 -0
  90. package/src/monitoring/file-monitor.js +17 -0
  91. package/src/monitoring/notification-manager.js +437 -0
  92. package/src/monitoring/scanner-core.js +368 -0
  93. package/src/monitoring/scanner-events.js +214 -0
  94. package/src/monitoring/violation-notification-system.js +515 -0
  95. package/src/refactoring/boundaries/cohesion-analyzer.js +316 -0
  96. package/src/refactoring/boundaries/extraction-result.js +285 -0
  97. package/src/refactoring/boundaries/extraction-strategies.js +392 -0
  98. package/src/refactoring/boundaries/module-boundary.js +209 -0
  99. package/src/refactoring/boundary/boundary-detector.js +741 -0
  100. package/src/refactoring/boundary/boundary-types.js +405 -0
  101. package/src/refactoring/boundary/extraction-strategies.js +554 -0
  102. package/src/refactoring/boundary-extraction-result.js +77 -0
  103. package/src/refactoring/boundary-extraction-strategies.js +330 -0
  104. package/src/refactoring/boundary-extractor.js +384 -0
  105. package/src/refactoring/boundary-types.js +46 -0
  106. package/src/refactoring/circular/circular-dependency.js +88 -0
  107. package/src/refactoring/circular/cycle-detection.js +147 -0
  108. package/src/refactoring/circular/dependency-node.js +82 -0
  109. package/src/refactoring/circular/dependency-result.js +107 -0
  110. package/src/refactoring/circular/dependency-types.js +58 -0
  111. package/src/refactoring/circular/graph-builder.js +213 -0
  112. package/src/refactoring/circular/resolution-strategy.js +72 -0
  113. package/src/refactoring/circular/strategy-generator.js +229 -0
  114. package/src/refactoring/circular-dependency-resolver-original.js +809 -0
  115. package/src/refactoring/circular-dependency-resolver.js +200 -0
  116. package/src/refactoring/code-mover.js +761 -0
  117. package/src/refactoring/file-splitter.js +696 -0
  118. package/src/refactoring/functionality-validator.js +816 -0
  119. package/src/refactoring/import-manager.js +774 -0
  120. package/src/refactoring/module-boundary.js +107 -0
  121. package/src/refactoring/refactoring-executor.js +672 -0
  122. package/src/refactoring/refactoring-rollback.js +614 -0
  123. package/src/refactoring/test-validator.js +631 -0
  124. package/src/requirement-management/default-requirement-manager.js +321 -0
  125. package/src/requirement-management/requirement-file-parser.js +159 -0
  126. package/src/requirement-management/requirement-sequencer.js +221 -0
  127. package/src/rui/commands/AgentCommandParser.js +600 -0
  128. package/src/rui/commands/AgentCommands.js +487 -0
  129. package/src/rui/commands/AgentResponseFormatter.js +832 -0
  130. package/src/scripts/verify-full-compliance.js +269 -0
  131. package/src/sync/sync-engine-core.js +1 -0
  132. package/src/sync/sync-engine-remote-handlers.js +135 -0
  133. package/src/task-generation/automated-task-generator.js +351 -0
  134. package/src/task-generation/prioritizer.js +287 -0
  135. package/src/task-generation/task-list-updater.js +215 -0
  136. package/src/task-generation/task-management-integration.js +480 -0
  137. package/src/task-generation/task-manager-integration.js +270 -0
  138. package/src/task-generation/violation-task-generator.js +474 -0
  139. package/src/task-management/continuous-scan-integration.js +342 -0
  140. package/src/timeout-management/index.js +12 -3
  141. package/src/timeout-management/response-time-tracker.js +167 -0
  142. package/src/timeout-management/timeout-calculator.js +159 -0
  143. package/src/timeout-management/timeout-config-manager.js +172 -0
  144. package/src/utils/ast-analyzer.js +417 -0
  145. package/src/utils/current-requirement-manager.js +276 -0
  146. package/src/utils/current-requirement-operations.js +472 -0
  147. package/src/utils/dependency-mapper.js +456 -0
  148. package/src/utils/download-with-progress.js +4 -2
  149. package/src/utils/electron-update-checker.js +4 -1
  150. package/src/utils/file-size-analyzer.js +272 -0
  151. package/src/utils/import-updater.js +280 -0
  152. package/src/utils/refactoring-tools.js +512 -0
  153. package/src/utils/report-generator.js +569 -0
  154. package/src/utils/reports/report-analysis.js +218 -0
  155. package/src/utils/reports/report-types.js +55 -0
  156. package/src/utils/reports/summary-generators.js +102 -0
  157. package/src/utils/requirement-file-management.js +157 -0
  158. package/src/utils/requirement-helpers/requirement-file-ops.js +392 -0
  159. package/src/utils/requirement-helpers/requirement-mover.js +414 -0
  160. package/src/utils/requirement-helpers/requirement-parser.js +326 -0
  161. package/src/utils/requirement-helpers/requirement-status.js +320 -0
  162. package/src/utils/requirement-helpers-new.js +55 -0
  163. package/src/utils/requirement-helpers-refactored.js +367 -0
  164. package/src/utils/requirement-helpers.js +291 -1191
  165. package/src/utils/requirement-movement-operations.js +450 -0
  166. package/src/utils/requirement-movement.js +312 -0
  167. package/src/utils/requirement-parsing-helpers.js +56 -0
  168. package/src/utils/requirement-statistics.js +200 -0
  169. package/src/utils/requirement-text-utils.js +58 -0
  170. package/src/utils/rollback/rollback-handlers.js +125 -0
  171. package/src/utils/rollback/rollback-operation.js +63 -0
  172. package/src/utils/rollback/rollback-recorder.js +166 -0
  173. package/src/utils/rollback/rollback-state-manager.js +175 -0
  174. package/src/utils/rollback/rollback-types.js +33 -0
  175. package/src/utils/rollback/rollback-utils.js +110 -0
  176. package/src/utils/rollback-manager-original.js +569 -0
  177. package/src/utils/rollback-manager.js +202 -0
  178. package/src/utils/smoke-test-cli.js +362 -0
  179. package/src/utils/smoke-test-gui.js +351 -0
  180. package/src/utils/smoke-test-orchestrator.js +321 -0
  181. package/src/utils/smoke-test-runner.js +60 -0
  182. package/src/utils/smoke-test-web.js +347 -0
  183. package/src/utils/specification-helpers.js +39 -13
  184. package/src/utils/specification-migration.js +97 -0
  185. package/src/utils/test-runner.js +579 -0
  186. package/src/utils/validation-framework.js +518 -0
  187. package/src/validation/compliance-analyzer.js +197 -0
  188. package/src/validation/compliance-report-generator.js +343 -0
  189. package/src/validation/compliance-reporter.js +711 -0
  190. package/src/validation/compliance-rules.js +127 -0
  191. package/src/validation/constitution-validator-new.js +196 -0
  192. package/src/validation/constitution-validator.js +17 -0
  193. package/src/validation/file-validators.js +170 -0
  194. package/src/validation/line-limit/file-analyzer.js +201 -0
  195. package/src/validation/line-limit/line-limit-validator.js +208 -0
  196. package/src/validation/line-limit/validation-result.js +144 -0
  197. package/src/validation/line-limit-core.js +225 -0
  198. package/src/validation/line-limit-reporter.js +134 -0
  199. package/src/validation/line-limit-result.js +125 -0
  200. package/src/validation/line-limit-validator.js +41 -0
  201. package/src/validation/metrics-calculator.js +660 -0
  202. package/src/sync/sync-engine-backup.js +0 -559
@@ -0,0 +1,354 @@
1
+ /**
2
+ * Verification Test Class
3
+ *
4
+ * Represents a test to verify agent functionality.
5
+ * Follows constitutional requirements: <555 lines, test-first approach.
6
+ */
7
+
8
+ const { VerificationType } = require('./VerificationType');
9
+
10
+ /**
11
+ * Verification test class for AI agents
12
+ */
13
+ class VerificationTest {
14
+ /**
15
+ * Create a new VerificationTest instance
16
+ * @param {Object} config - Test configuration
17
+ * @param {string} config.id - Unique test identifier
18
+ * @param {string} config.agentId - Reference to Agent
19
+ * @param {string} config.type - Verification type
20
+ * @param {string} config.description - What this test verifies
21
+ * @param {string} config.command - Test command template
22
+ * @param {string} config.expectedResult - Expected output or behavior
23
+ * @param {number} config.timeout - Test timeout in seconds
24
+ */
25
+ constructor(config = {}) {
26
+ this.id = config.id || '';
27
+ this.agentId = config.agentId || '';
28
+ this.type = config.type || '';
29
+ this.description = config.description || '';
30
+ this.command = config.command || '';
31
+ this.expectedResult = config.expectedResult || '';
32
+ this.timeout = config.timeout || 30; // Default 30 seconds
33
+
34
+ this.validate();
35
+ }
36
+
37
+ /**
38
+ * Validate verification test configuration
39
+ * @throws {Error} If configuration is invalid
40
+ */
41
+ validate() {
42
+ if (!this.id || typeof this.id !== 'string') {
43
+ throw new Error('Verification test must have a valid non-empty string id');
44
+ }
45
+
46
+ if (!this.agentId || typeof this.agentId !== 'string') {
47
+ throw new Error('Verification test must have a valid non-empty string agentId');
48
+ }
49
+
50
+ if (!this.type || typeof this.type !== 'string') {
51
+ throw new Error('Verification test must have a valid non-empty string type');
52
+ }
53
+
54
+ if (!Object.values(VerificationType).includes(this.type)) {
55
+ throw new Error(`Invalid verification type: ${this.type}`);
56
+ }
57
+
58
+ if (!this.description || typeof this.description !== 'string') {
59
+ throw new Error('Verification test must have a valid non-empty string description');
60
+ }
61
+
62
+ if (!this.command || typeof this.command !== 'string') {
63
+ throw new Error('Verification test must have a valid non-empty string command');
64
+ }
65
+
66
+ if (!this.expectedResult || typeof this.expectedResult !== 'string') {
67
+ throw new Error('Verification test must have a valid non-empty string expectedResult');
68
+ }
69
+
70
+ if (typeof this.timeout !== 'number' || this.timeout < 1 || this.timeout > 300) {
71
+ throw new Error('Timeout must be a number between 1 and 300 seconds');
72
+ }
73
+ }
74
+
75
+ /**
76
+ * Execute the verification test
77
+ * @param {Object} options - Test options
78
+ * @param {Object} options.context - Test context variables
79
+ * @returns {Promise<Object>} - Test result
80
+ */
81
+ async execute(options = {}) {
82
+ const { context = {} } = options;
83
+
84
+ const startTime = Date.now();
85
+
86
+ try {
87
+ const command = this.buildCommand(context);
88
+ const result = await this.runCommand(command);
89
+ const passed = this.evaluateResult(result);
90
+
91
+ return {
92
+ id: this.id,
93
+ agentId: this.agentId,
94
+ type: this.type,
95
+ description: this.description,
96
+ passed,
97
+ command,
98
+ result,
99
+ duration: Date.now() - startTime,
100
+ timeout: this.timeout * 1000,
101
+ timestamp: new Date().toISOString()
102
+ };
103
+ } catch (error) {
104
+ return {
105
+ id: this.id,
106
+ agentId: this.agentId,
107
+ type: this.type,
108
+ description: this.description,
109
+ passed: false,
110
+ error: error.message,
111
+ duration: Date.now() - startTime,
112
+ timeout: this.timeout * 1000,
113
+ timestamp: new Date().toISOString()
114
+ };
115
+ }
116
+ }
117
+
118
+ /**
119
+ * Build command with context variables
120
+ * @param {Object} context - Context variables
121
+ * @returns {string} - Resolved command
122
+ */
123
+ buildCommand(context) {
124
+ let command = this.command;
125
+
126
+ // Replace common placeholders
127
+ Object.entries(context).forEach(([key, value]) => {
128
+ const placeholder = `{${key}}`;
129
+ command = command.replace(new RegExp(placeholder, 'g'), value);
130
+ });
131
+
132
+ return command;
133
+ }
134
+
135
+ /**
136
+ * Run command with timeout
137
+ * @param {string} command - Command to run
138
+ * @returns {Promise<Object>} - Command result
139
+ */
140
+ async runCommand(command) {
141
+ return new Promise((resolve, reject) => {
142
+ const { spawn } = require('child_process');
143
+
144
+ const child = spawn(command, [], {
145
+ shell: true,
146
+ stdio: ['pipe', 'pipe', 'pipe']
147
+ });
148
+
149
+ let stdout = '';
150
+ let stderr = '';
151
+
152
+ child.stdout.on('data', (data) => {
153
+ stdout += data.toString();
154
+ });
155
+
156
+ child.stderr.on('data', (data) => {
157
+ stderr += data.toString();
158
+ });
159
+
160
+ const timeoutId = setTimeout(() => {
161
+ child.kill('SIGTERM');
162
+ reject(new Error(`Test command timed out after ${this.timeout} seconds`));
163
+ }, this.timeout * 1000);
164
+
165
+ child.on('close', (code) => {
166
+ clearTimeout(timeoutId);
167
+
168
+ resolve({
169
+ exitCode: code,
170
+ stdout: stdout.trim(),
171
+ stderr: stderr.trim(),
172
+ success: code === 0
173
+ });
174
+ });
175
+
176
+ child.on('error', (error) => {
177
+ clearTimeout(timeoutId);
178
+ reject(error);
179
+ });
180
+ });
181
+ }
182
+
183
+ /**
184
+ * Evaluate test result against expected outcome
185
+ * @param {Object} result - Command result
186
+ * @returns {boolean} - True if test passed
187
+ */
188
+ evaluateResult(result) {
189
+ switch (this.type) {
190
+ case VerificationType.FILE_OPERATION:
191
+ return this.evaluateFileOperation(result);
192
+ case VerificationType.API_CALL:
193
+ return this.evaluateApiCall(result);
194
+ case VerificationType.COMMAND_EXECUTION:
195
+ return this.evaluateCommandExecution(result);
196
+ case VerificationType.NETWORK_TEST:
197
+ return this.evaluateNetworkTest(result);
198
+ default:
199
+ return this.evaluateDefault(result);
200
+ }
201
+ }
202
+
203
+ /**
204
+ * Evaluate file operation test
205
+ * @param {Object} result - Command result
206
+ * @returns {boolean}
207
+ */
208
+ evaluateFileOperation(result) {
209
+ // For file operations, check if command succeeded and output contains expected result
210
+ return result.success && result.stdout.includes(this.expectedResult);
211
+ }
212
+
213
+ /**
214
+ * Evaluate API call test
215
+ * @param {Object} result - Command result
216
+ * @returns {boolean}
217
+ */
218
+ evaluateApiCall(result) {
219
+ // For API calls, check success and expected response
220
+ return result.success && result.stdout.includes(this.expectedResult);
221
+ }
222
+
223
+ /**
224
+ * Evaluate command execution test
225
+ * @param {Object} result - Command result
226
+ * @returns {boolean}
227
+ */
228
+ evaluateCommandExecution(result) {
229
+ // For command execution, check if command runs without error
230
+ return result.success;
231
+ }
232
+
233
+ /**
234
+ * Evaluate network test
235
+ * @param {Object} result - Command result
236
+ * @returns {boolean}
237
+ */
238
+ evaluateNetworkTest(result) {
239
+ // For network tests, check connectivity and response
240
+ return result.success && result.stdout.includes(this.expectedResult);
241
+ }
242
+
243
+ /**
244
+ * Default evaluation method
245
+ * @param {Object} result - Command result
246
+ * @returns {boolean}
247
+ */
248
+ evaluateDefault(result) {
249
+ return result.success && result.stdout.includes(this.expectedResult);
250
+ }
251
+
252
+ /**
253
+ * Convert verification test to plain object
254
+ * @returns {Object}
255
+ */
256
+ toJSON() {
257
+ return {
258
+ id: this.id,
259
+ agentId: this.agentId,
260
+ type: this.type,
261
+ description: this.description,
262
+ command: this.command,
263
+ expectedResult: this.expectedResult,
264
+ timeout: this.timeout
265
+ };
266
+ }
267
+
268
+ /**
269
+ * Create verification test from plain object
270
+ * @param {Object} data - Plain object data
271
+ * @returns {VerificationTest}
272
+ */
273
+ static fromJSON(data) {
274
+ return new VerificationTest(data);
275
+ }
276
+
277
+ /**
278
+ * Create common verification tests for agents
279
+ * @param {string} agentId - Agent identifier
280
+ * @param {string} type - Test type
281
+ * @returns {VerificationTest|null}
282
+ */
283
+ static createCommonTest(agentId, type) {
284
+ const tests = {
285
+ [VerificationType.FILE_OPERATION]: {
286
+ id: `${agentId}-file-op`,
287
+ description: 'Test file creation and deletion',
288
+ command: 'echo "test-requirement-{timestamp}" > test-requirement-{timestamp}.txt && cat test-requirement-{timestamp}.txt && rm test-requirement-{timestamp}.txt',
289
+ expectedResult: 'test-requirement-{timestamp}',
290
+ timeout: 10
291
+ },
292
+ [VerificationType.COMMAND_EXECUTION]: {
293
+ id: `${agentId}-cmd-exec`,
294
+ description: 'Test basic command execution',
295
+ command: '{agentCommand} --version',
296
+ expectedResult: 'version',
297
+ timeout: 15
298
+ },
299
+ [VerificationType.API_CALL]: {
300
+ id: `${agentId}-api-call`,
301
+ description: 'Test agent API functionality',
302
+ command: '{agentCommand} --help',
303
+ expectedResult: 'help',
304
+ timeout: 20
305
+ },
306
+ [VerificationType.NETWORK_TEST]: {
307
+ id: `${agentId}-network`,
308
+ description: 'Test network connectivity',
309
+ command: 'ping -c 1 google.com',
310
+ expectedResult: '1 received',
311
+ timeout: 30
312
+ }
313
+ };
314
+
315
+ const testConfig = tests[type];
316
+ if (!testConfig) {
317
+ return null;
318
+ }
319
+
320
+ return new VerificationTest({
321
+ agentId,
322
+ type,
323
+ ...testConfig
324
+ });
325
+ }
326
+
327
+ /**
328
+ * Create verification test suite for an agent
329
+ * @param {string} agentId - Agent identifier
330
+ * @param {string} agentCommand - Agent command to test
331
+ * @returns {VerificationTest[]} - Array of tests
332
+ */
333
+ static createTestSuite(agentId, agentCommand) {
334
+ const tests = [];
335
+
336
+ // File operation test
337
+ const fileTest = this.createCommonTest(agentId, VerificationType.FILE_OPERATION);
338
+ if (fileTest) {
339
+ fileTest.command = fileTest.command.replace('{timestamp}', Date.now());
340
+ tests.push(fileTest);
341
+ }
342
+
343
+ // Command execution test
344
+ const cmdTest = this.createCommonTest(agentId, VerificationType.COMMAND_EXECUTION);
345
+ if (cmdTest) {
346
+ cmdTest.command = cmdTest.command.replace('{agentCommand}', agentCommand);
347
+ tests.push(cmdTest);
348
+ }
349
+
350
+ return tests;
351
+ }
352
+ }
353
+
354
+ module.exports = VerificationTest;
@@ -0,0 +1,226 @@
1
+ /**
2
+ * Verification Type Enumeration
3
+ *
4
+ * Defines types of verification tests for agents.
5
+ * Follows constitutional requirements: <555 lines, test-first approach.
6
+ */
7
+
8
+ /**
9
+ * Verification type enumeration
10
+ * These represent different approaches to testing agent functionality
11
+ */
12
+ const VerificationType = {
13
+ // Create/read/delete test files
14
+ FILE_OPERATION: 'FILE_OPERATION',
15
+
16
+ // Test agent API functionality
17
+ API_CALL: 'API_CALL',
18
+
19
+ // Test basic command execution
20
+ COMMAND_EXECUTION: 'COMMAND_EXECUTION',
21
+
22
+ // Test network connectivity
23
+ NETWORK_TEST: 'NETWORK_TEST',
24
+
25
+ // Test agent communication with interactive setup
26
+ COMMUNICATION: 'COMMUNICATION'
27
+ };
28
+
29
+ /**
30
+ * Check if verification type requires file system access
31
+ * @param {string} type - Verification type to check
32
+ * @returns {boolean}
33
+ */
34
+ function requiresFileSystemAccess(type) {
35
+ return type === VerificationType.FILE_OPERATION;
36
+ }
37
+
38
+ /**
39
+ * Check if verification type requires network access
40
+ * @param {string} type - Verification type to check
41
+ * @returns {boolean}
42
+ */
43
+ function requiresNetworkAccess(type) {
44
+ return [VerificationType.NETWORK_TEST, VerificationType.COMMUNICATION].includes(type);
45
+ }
46
+
47
+ /**
48
+ * Check if verification type requires agent to be installed
49
+ * @param {string} type - Verification type to check
50
+ * @returns {boolean}
51
+ */
52
+ function requiresAgentInstallation(type) {
53
+ return [VerificationType.API_CALL, VerificationType.COMMAND_EXECUTION, VerificationType.COMMUNICATION].includes(type);
54
+ }
55
+
56
+ /**
57
+ * Get verification type priority (lower numbers = higher priority)
58
+ * @param {string} type - Verification type
59
+ * @returns {number} - Priority value
60
+ */
61
+ function getTypePriority(type) {
62
+ const priorities = {
63
+ [VerificationType.COMMAND_EXECUTION]: 1, // Basic functionality
64
+ [VerificationType.FILE_OPERATION]: 2, // File system interaction
65
+ [VerificationType.API_CALL]: 3, // Advanced functionality
66
+ [VerificationType.COMMUNICATION]: 3, // Communication testing
67
+ [VerificationType.NETWORK_TEST]: 4 // Network connectivity
68
+ };
69
+
70
+ return priorities[type] || 999;
71
+ }
72
+
73
+ /**
74
+ * Get verification type description
75
+ * @param {string} type - Verification type
76
+ * @returns {string} - Human-readable description
77
+ */
78
+ function getTypeDescription(type) {
79
+ const descriptions = {
80
+ [VerificationType.FILE_OPERATION]: 'File create/read/delete test',
81
+ [VerificationType.API_CALL]: 'Agent API functionality test',
82
+ [VerificationType.COMMAND_EXECUTION]: 'Basic command execution test',
83
+ [VerificationType.COMMUNICATION]: 'Interactive communication test',
84
+ [VerificationType.NETWORK_TEST]: 'Network connectivity test'
85
+ };
86
+
87
+ return descriptions[type] || 'Unknown verification type';
88
+ }
89
+
90
+ /**
91
+ * Get all possible verification types
92
+ * @returns {string[]} - Array of all type values
93
+ */
94
+ function getAllTypes() {
95
+ return Object.values(VerificationType);
96
+ }
97
+
98
+ /**
99
+ * Check if a value is a valid VerificationType
100
+ * @param {string} type - Type to validate
101
+ * @returns {boolean} - True if valid
102
+ */
103
+ function isValidType(type) {
104
+ return getAllTypes().includes(type);
105
+ }
106
+
107
+ /**
108
+ * Get preferred verification types in order of execution
109
+ * @returns {string[]} - Array of types in priority order
110
+ */
111
+ function getExecutionOrder() {
112
+ return getAllTypes().sort((a, b) => getTypePriority(a) - getTypePriority(b));
113
+ }
114
+
115
+ /**
116
+ * Get typical timeout values for each verification type
117
+ * @param {string} type - Verification type
118
+ * @returns {number} - Timeout in seconds
119
+ */
120
+ function getDefaultTimeout(type) {
121
+ const timeouts = {
122
+ [VerificationType.FILE_OPERATION]: 10, // Quick file operations
123
+ [VerificationType.COMMAND_EXECUTION]: 15, // Command should be fast
124
+ [VerificationType.API_CALL]: 20, // API calls may take time
125
+ [VerificationType.COMMUNICATION]: 60, // Communication tests need more time
126
+ [VerificationType.NETWORK_TEST]: 30 // Network tests can be slow
127
+ };
128
+
129
+ return timeouts[type] || 30;
130
+ }
131
+
132
+ /**
133
+ * Get expected success indicators for each verification type
134
+ * @param {string} type - Verification type
135
+ * @returns {string[]} - Array of success indicators
136
+ */
137
+ function getSuccessIndicators(type) {
138
+ const indicators = {
139
+ [VerificationType.FILE_OPERATION]: ['created', 'written', 'deleted', 'success'],
140
+ [VerificationType.API_CALL]: ['200', 'success', 'ok', 'completed'],
141
+ [VerificationType.COMMAND_EXECUTION]: ['version', 'help', 'ready', 'available'],
142
+ [VerificationType.COMMUNICATION]: ['hello', 'hi', 'greeting', 'response', 'received'],
143
+ [VerificationType.NETWORK_TEST]: ['received', 'reachable', 'connected', 'success']
144
+ };
145
+
146
+ return indicators[type] || ['success'];
147
+ }
148
+
149
+ /**
150
+ * Get common failure patterns for each verification type
151
+ * @param {string} type - Verification type
152
+ * @returns {string[]} - Array of failure patterns
153
+ */
154
+ function getFailurePatterns(type) {
155
+ const patterns = {
156
+ [VerificationType.FILE_OPERATION]: ['permission denied', 'no such file', 'access denied'],
157
+ [VerificationType.API_CALL]: ['401', '403', '404', '500', 'error', 'failed'],
158
+ [VerificationType.COMMAND_EXECUTION]: ['command not found', 'not recognized', 'not installed'],
159
+ [VerificationType.COMMUNICATION]: ['no response', 'timeout', 'connection failed', 'authentication required'],
160
+ [VerificationType.NETWORK_TEST]: ['unreachable', 'timeout', 'connection refused', 'dns']
161
+ };
162
+
163
+ return patterns[type] || ['error', 'failed'];
164
+ }
165
+
166
+ /**
167
+ * Check if verification type is safe to run in parallel
168
+ * @param {string} type - Verification type
169
+ * @returns {boolean} - True if safe for parallel execution
170
+ */
171
+ function isSafeForParallel(type) {
172
+ // File operations and communication tests may conflict, others are generally safe
173
+ return ![VerificationType.FILE_OPERATION, VerificationType.COMMUNICATION].includes(type);
174
+ }
175
+
176
+ /**
177
+ * Get verification type requirements
178
+ * @param {string} type - Verification type
179
+ * @returns {string[]} - Array of requirements
180
+ */
181
+ function getRequirements(type) {
182
+ const requirements = {
183
+ [VerificationType.FILE_OPERATION]: ['file system', 'write permissions'],
184
+ [VerificationType.API_CALL]: ['agent installation', 'api access'],
185
+ [VerificationType.COMMAND_EXECUTION]: ['agent installation', 'command line'],
186
+ [VerificationType.COMMUNICATION]: ['agent installation', 'network connection', 'authentication'],
187
+ [VerificationType.NETWORK_TEST]: ['internet connection']
188
+ };
189
+
190
+ return requirements[type] || [];
191
+ }
192
+
193
+ /**
194
+ * Get verification type cleanup requirements
195
+ * @param {string} type - Verification type
196
+ * @returns {string[]} - Array of cleanup actions
197
+ */
198
+ function getCleanupRequirements(type) {
199
+ const cleanup = {
200
+ [VerificationType.FILE_OPERATION]: ['remove test files', 'clean temporary directories'],
201
+ [VerificationType.API_CALL]: ['clear api sessions', 'reset authentication'],
202
+ [VerificationType.COMMAND_EXECUTION]: ['clear command history', 'reset environment'],
203
+ [VerificationType.COMMUNICATION]: ['close communication sessions', 'reset authentication state'],
204
+ [VerificationType.NETWORK_TEST]: ['close network connections', 'clear dns cache']
205
+ };
206
+
207
+ return cleanup[type] || [];
208
+ }
209
+
210
+ module.exports = {
211
+ VerificationType,
212
+ requiresFileSystemAccess,
213
+ requiresNetworkAccess,
214
+ requiresAgentInstallation,
215
+ getTypePriority,
216
+ getTypeDescription,
217
+ getAllTypes,
218
+ isValidType,
219
+ getExecutionOrder,
220
+ getDefaultTimeout,
221
+ getSuccessIndicators,
222
+ getFailurePatterns,
223
+ isSafeForParallel,
224
+ getRequirements,
225
+ getCleanupRequirements
226
+ };