agentic-qe 3.3.3 → 3.3.5

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 (553) hide show
  1. package/.claude/agents/v3/README.md +100 -0
  2. package/.claude/agents/v3/qe-accessibility-auditor.md +112 -11
  3. package/.claude/agents/v3/qe-bdd-generator.md +40 -0
  4. package/.claude/agents/v3/qe-coverage-specialist.md +39 -0
  5. package/.claude/agents/v3/qe-defect-predictor.md +36 -0
  6. package/.claude/agents/v3/qe-gap-detector.md +39 -0
  7. package/.claude/agents/v3/qe-pattern-learner.md +31 -0
  8. package/.claude/agents/v3/qe-product-factors-assessor.md +34 -0
  9. package/.claude/agents/v3/qe-quality-criteria-recommender.md +32 -0
  10. package/.claude/agents/v3/qe-quality-gate.md +39 -0
  11. package/.claude/agents/v3/qe-queen-coordinator.md +332 -166
  12. package/.claude/agents/v3/qe-requirements-validator.md +37 -0
  13. package/.claude/agents/v3/qe-risk-assessor.md +33 -0
  14. package/.claude/agents/v3/qe-tdd-specialist.md +33 -0
  15. package/.claude/agents/v3/qe-test-architect.md +36 -0
  16. package/.claude/helpers/statusline-v3.cjs +38 -42
  17. package/.claude/skills/README.md +30 -104
  18. package/.claude/skills/a11y-ally/SKILL.md +1658 -0
  19. package/.claude/skills/qcsd-ideation-swarm/SKILL.md +1750 -0
  20. package/.claude/skills/skills-manifest.json +78 -8
  21. package/README.md +18 -4
  22. package/package.json +1 -1
  23. package/scripts/cloud-db-config.json +10 -5
  24. package/scripts/demo-warmup.sh +45 -0
  25. package/scripts/fetch-content.js +460 -0
  26. package/scripts/merge-v3-to-root.sql +48 -0
  27. package/v3/CHANGELOG.md +166 -0
  28. package/v3/README.md +11 -6
  29. package/v3/assets/agents/v3/README.md +100 -0
  30. package/v3/assets/agents/v3/qe-accessibility-auditor.md +112 -11
  31. package/v3/assets/agents/v3/qe-bdd-generator.md +40 -0
  32. package/v3/assets/agents/v3/qe-coverage-specialist.md +39 -0
  33. package/v3/assets/agents/v3/qe-defect-predictor.md +36 -0
  34. package/v3/assets/agents/v3/qe-gap-detector.md +39 -0
  35. package/v3/assets/agents/v3/qe-pattern-learner.md +31 -0
  36. package/v3/assets/agents/v3/qe-product-factors-assessor.md +34 -0
  37. package/v3/assets/agents/v3/qe-quality-criteria-recommender.md +32 -0
  38. package/v3/assets/agents/v3/qe-quality-gate.md +39 -0
  39. package/v3/assets/agents/v3/qe-queen-coordinator.md +332 -166
  40. package/v3/assets/agents/v3/qe-requirements-validator.md +37 -0
  41. package/v3/assets/agents/v3/qe-risk-assessor.md +33 -0
  42. package/v3/assets/agents/v3/qe-tdd-specialist.md +33 -0
  43. package/v3/assets/agents/v3/qe-test-architect.md +36 -0
  44. package/v3/assets/hooks/cross-phase-memory.yaml +253 -0
  45. package/v3/assets/skills/a11y-ally/SKILL.md +1658 -0
  46. package/v3/assets/skills/qcsd-ideation-swarm/SKILL.md +1750 -0
  47. package/v3/assets/skills/skills-manifest.json +753 -0
  48. package/v3/dist/adapters/claude-flow/model-router-bridge.d.ts.map +1 -1
  49. package/v3/dist/adapters/claude-flow/model-router-bridge.js +6 -4
  50. package/v3/dist/adapters/claude-flow/model-router-bridge.js.map +1 -1
  51. package/v3/dist/adapters/claude-flow/pretrain-bridge.d.ts.map +1 -1
  52. package/v3/dist/adapters/claude-flow/pretrain-bridge.js +13 -8
  53. package/v3/dist/adapters/claude-flow/pretrain-bridge.js.map +1 -1
  54. package/v3/dist/adapters/claude-flow/trajectory-bridge.d.ts.map +1 -1
  55. package/v3/dist/adapters/claude-flow/trajectory-bridge.js +9 -6
  56. package/v3/dist/adapters/claude-flow/trajectory-bridge.js.map +1 -1
  57. package/v3/dist/benchmarks/performance-benchmarks.d.ts.map +1 -1
  58. package/v3/dist/benchmarks/performance-benchmarks.js +5 -3
  59. package/v3/dist/benchmarks/performance-benchmarks.js.map +1 -1
  60. package/v3/dist/cli/bundle.js +27646 -23204
  61. package/v3/dist/cli/commands/hooks.d.ts.map +1 -1
  62. package/v3/dist/cli/commands/hooks.js +288 -0
  63. package/v3/dist/cli/commands/hooks.js.map +1 -1
  64. package/v3/dist/cli/commands/sync.d.ts.map +1 -1
  65. package/v3/dist/cli/commands/sync.js +0 -6
  66. package/v3/dist/cli/commands/sync.js.map +1 -1
  67. package/v3/dist/cli/handlers/init-handler.d.ts.map +1 -1
  68. package/v3/dist/cli/handlers/init-handler.js +11 -0
  69. package/v3/dist/cli/handlers/init-handler.js.map +1 -1
  70. package/v3/dist/cli/index.js +14 -2
  71. package/v3/dist/cli/index.js.map +1 -1
  72. package/v3/dist/cli/scheduler/persistent-scheduler.d.ts.map +1 -1
  73. package/v3/dist/cli/scheduler/persistent-scheduler.js +3 -2
  74. package/v3/dist/cli/scheduler/persistent-scheduler.js.map +1 -1
  75. package/v3/dist/cli/wizards/test-wizard.d.ts.map +1 -1
  76. package/v3/dist/cli/wizards/test-wizard.js +6 -4
  77. package/v3/dist/cli/wizards/test-wizard.js.map +1 -1
  78. package/v3/dist/coordination/consensus/providers/claude-provider.js +1 -1
  79. package/v3/dist/coordination/consensus/providers/gemini-provider.js +1 -1
  80. package/v3/dist/coordination/consensus/providers/native-learning-provider.d.ts.map +1 -1
  81. package/v3/dist/coordination/consensus/providers/native-learning-provider.js +10 -8
  82. package/v3/dist/coordination/consensus/providers/native-learning-provider.js.map +1 -1
  83. package/v3/dist/coordination/consensus/providers/ollama-provider.d.ts.map +1 -1
  84. package/v3/dist/coordination/consensus/providers/ollama-provider.js +5 -4
  85. package/v3/dist/coordination/consensus/providers/ollama-provider.js.map +1 -1
  86. package/v3/dist/coordination/consensus/providers/openai-provider.d.ts.map +1 -1
  87. package/v3/dist/coordination/consensus/providers/openai-provider.js +5 -4
  88. package/v3/dist/coordination/consensus/providers/openai-provider.js.map +1 -1
  89. package/v3/dist/coordination/constants.d.ts +198 -0
  90. package/v3/dist/coordination/constants.d.ts.map +1 -0
  91. package/v3/dist/coordination/constants.js +210 -0
  92. package/v3/dist/coordination/constants.js.map +1 -0
  93. package/v3/dist/coordination/mincut/dream-integration.d.ts.map +1 -1
  94. package/v3/dist/coordination/mincut/dream-integration.js +5 -1
  95. package/v3/dist/coordination/mincut/dream-integration.js.map +1 -1
  96. package/v3/dist/coordination/queen-coordinator.d.ts +9 -1
  97. package/v3/dist/coordination/queen-coordinator.d.ts.map +1 -1
  98. package/v3/dist/coordination/queen-coordinator.js +49 -9
  99. package/v3/dist/coordination/queen-coordinator.js.map +1 -1
  100. package/v3/dist/coordination/task-executor.d.ts.map +1 -1
  101. package/v3/dist/coordination/task-executor.js +7 -8
  102. package/v3/dist/coordination/task-executor.js.map +1 -1
  103. package/v3/dist/coordination/workflow-orchestrator.d.ts.map +1 -1
  104. package/v3/dist/coordination/workflow-orchestrator.js +261 -0
  105. package/v3/dist/coordination/workflow-orchestrator.js.map +1 -1
  106. package/v3/dist/domains/chaos-resilience/plugin.d.ts +14 -3
  107. package/v3/dist/domains/chaos-resilience/plugin.d.ts.map +1 -1
  108. package/v3/dist/domains/chaos-resilience/plugin.js +96 -0
  109. package/v3/dist/domains/chaos-resilience/plugin.js.map +1 -1
  110. package/v3/dist/domains/chaos-resilience/services/performance-profiler.d.ts.map +1 -1
  111. package/v3/dist/domains/chaos-resilience/services/performance-profiler.js +12 -8
  112. package/v3/dist/domains/chaos-resilience/services/performance-profiler.js.map +1 -1
  113. package/v3/dist/domains/code-intelligence/plugin.d.ts +13 -3
  114. package/v3/dist/domains/code-intelligence/plugin.d.ts.map +1 -1
  115. package/v3/dist/domains/code-intelligence/plugin.js +85 -0
  116. package/v3/dist/domains/code-intelligence/plugin.js.map +1 -1
  117. package/v3/dist/domains/code-intelligence/services/product-factors-bridge.d.ts.map +1 -1
  118. package/v3/dist/domains/code-intelligence/services/product-factors-bridge.js +3 -2
  119. package/v3/dist/domains/code-intelligence/services/product-factors-bridge.js.map +1 -1
  120. package/v3/dist/domains/constants.d.ts +481 -0
  121. package/v3/dist/domains/constants.d.ts.map +1 -0
  122. package/v3/dist/domains/constants.js +503 -0
  123. package/v3/dist/domains/constants.js.map +1 -0
  124. package/v3/dist/domains/contract-testing/plugin.d.ts +6 -1
  125. package/v3/dist/domains/contract-testing/plugin.d.ts.map +1 -1
  126. package/v3/dist/domains/contract-testing/plugin.js +80 -1
  127. package/v3/dist/domains/contract-testing/plugin.js.map +1 -1
  128. package/v3/dist/domains/contract-testing/services/contract-validator.d.ts.map +1 -1
  129. package/v3/dist/domains/contract-testing/services/contract-validator.js +5 -4
  130. package/v3/dist/domains/contract-testing/services/contract-validator.js.map +1 -1
  131. package/v3/dist/domains/coverage-analysis/services/hnsw-index.d.ts.map +1 -1
  132. package/v3/dist/domains/coverage-analysis/services/hnsw-index.js +1 -0
  133. package/v3/dist/domains/coverage-analysis/services/hnsw-index.js.map +1 -1
  134. package/v3/dist/domains/defect-intelligence/coordinator.d.ts +2 -2
  135. package/v3/dist/domains/defect-intelligence/coordinator.d.ts.map +1 -1
  136. package/v3/dist/domains/defect-intelligence/coordinator.js.map +1 -1
  137. package/v3/dist/domains/defect-intelligence/plugin.d.ts +6 -1
  138. package/v3/dist/domains/defect-intelligence/plugin.d.ts.map +1 -1
  139. package/v3/dist/domains/defect-intelligence/plugin.js +101 -0
  140. package/v3/dist/domains/defect-intelligence/plugin.js.map +1 -1
  141. package/v3/dist/domains/defect-intelligence/services/defect-predictor.d.ts.map +1 -1
  142. package/v3/dist/domains/defect-intelligence/services/defect-predictor.js +3 -2
  143. package/v3/dist/domains/defect-intelligence/services/defect-predictor.js.map +1 -1
  144. package/v3/dist/domains/domain-interface.d.ts.map +1 -1
  145. package/v3/dist/domains/domain-interface.js +24 -9
  146. package/v3/dist/domains/domain-interface.js.map +1 -1
  147. package/v3/dist/domains/learning-optimization/plugin.d.ts +2 -1
  148. package/v3/dist/domains/learning-optimization/plugin.d.ts.map +1 -1
  149. package/v3/dist/domains/learning-optimization/plugin.js +49 -0
  150. package/v3/dist/domains/learning-optimization/plugin.js.map +1 -1
  151. package/v3/dist/domains/quality-assessment/coordinator.d.ts +90 -1
  152. package/v3/dist/domains/quality-assessment/coordinator.d.ts.map +1 -1
  153. package/v3/dist/domains/quality-assessment/coordinator.js +310 -0
  154. package/v3/dist/domains/quality-assessment/coordinator.js.map +1 -1
  155. package/v3/dist/domains/requirements-validation/index.d.ts +1 -0
  156. package/v3/dist/domains/requirements-validation/index.d.ts.map +1 -1
  157. package/v3/dist/domains/requirements-validation/index.js +2 -0
  158. package/v3/dist/domains/requirements-validation/index.js.map +1 -1
  159. package/v3/dist/domains/requirements-validation/plugin.d.ts +13 -1
  160. package/v3/dist/domains/requirements-validation/plugin.d.ts.map +1 -1
  161. package/v3/dist/domains/requirements-validation/plugin.js +94 -0
  162. package/v3/dist/domains/requirements-validation/plugin.js.map +1 -1
  163. package/v3/dist/domains/requirements-validation/qcsd-ideation-plugin.d.ts +245 -0
  164. package/v3/dist/domains/requirements-validation/qcsd-ideation-plugin.d.ts.map +1 -0
  165. package/v3/dist/domains/requirements-validation/qcsd-ideation-plugin.js +1143 -0
  166. package/v3/dist/domains/requirements-validation/qcsd-ideation-plugin.js.map +1 -0
  167. package/v3/dist/domains/requirements-validation/services/product-factors-assessment/code-intelligence/codebase-analyzer.d.ts.map +1 -1
  168. package/v3/dist/domains/requirements-validation/services/product-factors-assessment/code-intelligence/codebase-analyzer.js +3 -2
  169. package/v3/dist/domains/requirements-validation/services/product-factors-assessment/code-intelligence/codebase-analyzer.js.map +1 -1
  170. package/v3/dist/domains/security-compliance/plugin.d.ts +3 -2
  171. package/v3/dist/domains/security-compliance/plugin.d.ts.map +1 -1
  172. package/v3/dist/domains/security-compliance/plugin.js +64 -0
  173. package/v3/dist/domains/security-compliance/plugin.js.map +1 -1
  174. package/v3/dist/domains/security-compliance/services/scanners/dast-auth-testing.d.ts +25 -0
  175. package/v3/dist/domains/security-compliance/services/scanners/dast-auth-testing.d.ts.map +1 -0
  176. package/v3/dist/domains/security-compliance/services/scanners/dast-auth-testing.js +160 -0
  177. package/v3/dist/domains/security-compliance/services/scanners/dast-auth-testing.js.map +1 -0
  178. package/v3/dist/domains/security-compliance/services/scanners/dast-helpers.d.ts +48 -0
  179. package/v3/dist/domains/security-compliance/services/scanners/dast-helpers.d.ts.map +1 -0
  180. package/v3/dist/domains/security-compliance/services/scanners/dast-helpers.js +385 -0
  181. package/v3/dist/domains/security-compliance/services/scanners/dast-helpers.js.map +1 -0
  182. package/v3/dist/domains/security-compliance/services/scanners/dast-injection-testing.d.ts +20 -0
  183. package/v3/dist/domains/security-compliance/services/scanners/dast-injection-testing.d.ts.map +1 -0
  184. package/v3/dist/domains/security-compliance/services/scanners/dast-injection-testing.js +99 -0
  185. package/v3/dist/domains/security-compliance/services/scanners/dast-injection-testing.js.map +1 -0
  186. package/v3/dist/domains/security-compliance/services/scanners/dast-scanner.d.ts +62 -0
  187. package/v3/dist/domains/security-compliance/services/scanners/dast-scanner.d.ts.map +1 -0
  188. package/v3/dist/domains/security-compliance/services/scanners/dast-scanner.js +329 -0
  189. package/v3/dist/domains/security-compliance/services/scanners/dast-scanner.js.map +1 -0
  190. package/v3/dist/domains/security-compliance/services/scanners/dependency-scanner.d.ts +46 -0
  191. package/v3/dist/domains/security-compliance/services/scanners/dependency-scanner.d.ts.map +1 -0
  192. package/v3/dist/domains/security-compliance/services/scanners/dependency-scanner.js +180 -0
  193. package/v3/dist/domains/security-compliance/services/scanners/dependency-scanner.js.map +1 -0
  194. package/v3/dist/domains/security-compliance/services/scanners/index.d.ts +14 -0
  195. package/v3/dist/domains/security-compliance/services/scanners/index.d.ts.map +1 -0
  196. package/v3/dist/domains/security-compliance/services/scanners/index.js +16 -0
  197. package/v3/dist/domains/security-compliance/services/scanners/index.js.map +1 -0
  198. package/v3/dist/domains/security-compliance/services/scanners/sast-scanner.d.ts +92 -0
  199. package/v3/dist/domains/security-compliance/services/scanners/sast-scanner.d.ts.map +1 -0
  200. package/v3/dist/domains/security-compliance/services/scanners/sast-scanner.js +440 -0
  201. package/v3/dist/domains/security-compliance/services/scanners/sast-scanner.js.map +1 -0
  202. package/v3/dist/domains/security-compliance/services/scanners/scanner-orchestrator.d.ts +78 -0
  203. package/v3/dist/domains/security-compliance/services/scanners/scanner-orchestrator.d.ts.map +1 -0
  204. package/v3/dist/domains/security-compliance/services/scanners/scanner-orchestrator.js +179 -0
  205. package/v3/dist/domains/security-compliance/services/scanners/scanner-orchestrator.js.map +1 -0
  206. package/v3/dist/domains/security-compliance/services/scanners/scanner-types.d.ts +91 -0
  207. package/v3/dist/domains/security-compliance/services/scanners/scanner-types.d.ts.map +1 -0
  208. package/v3/dist/domains/security-compliance/services/scanners/scanner-types.js +15 -0
  209. package/v3/dist/domains/security-compliance/services/scanners/scanner-types.js.map +1 -0
  210. package/v3/dist/domains/security-compliance/services/scanners/security-patterns.d.ts +16 -0
  211. package/v3/dist/domains/security-compliance/services/scanners/security-patterns.d.ts.map +1 -0
  212. package/v3/dist/domains/security-compliance/services/scanners/security-patterns.js +507 -0
  213. package/v3/dist/domains/security-compliance/services/scanners/security-patterns.js.map +1 -0
  214. package/v3/dist/domains/security-compliance/services/security-auditor.d.ts.map +1 -1
  215. package/v3/dist/domains/security-compliance/services/security-auditor.js +2 -1
  216. package/v3/dist/domains/security-compliance/services/security-auditor.js.map +1 -1
  217. package/v3/dist/domains/security-compliance/services/security-scanner.d.ts +20 -213
  218. package/v3/dist/domains/security-compliance/services/security-scanner.d.ts.map +1 -1
  219. package/v3/dist/domains/security-compliance/services/security-scanner.js +37 -2013
  220. package/v3/dist/domains/security-compliance/services/security-scanner.js.map +1 -1
  221. package/v3/dist/domains/security-compliance/services/semgrep-integration.d.ts.map +1 -1
  222. package/v3/dist/domains/security-compliance/services/semgrep-integration.js +7 -6
  223. package/v3/dist/domains/security-compliance/services/semgrep-integration.js.map +1 -1
  224. package/v3/dist/domains/test-execution/services/auth-state-manager.d.ts.map +1 -1
  225. package/v3/dist/domains/test-execution/services/auth-state-manager.js +6 -4
  226. package/v3/dist/domains/test-execution/services/auth-state-manager.js.map +1 -1
  227. package/v3/dist/domains/test-execution/services/e2e/assertion-handlers.d.ts +55 -0
  228. package/v3/dist/domains/test-execution/services/e2e/assertion-handlers.d.ts.map +1 -0
  229. package/v3/dist/domains/test-execution/services/e2e/assertion-handlers.js +407 -0
  230. package/v3/dist/domains/test-execution/services/e2e/assertion-handlers.js.map +1 -0
  231. package/v3/dist/domains/test-execution/services/e2e/browser-orchestrator.d.ts +122 -0
  232. package/v3/dist/domains/test-execution/services/e2e/browser-orchestrator.d.ts.map +1 -0
  233. package/v3/dist/domains/test-execution/services/e2e/browser-orchestrator.js +325 -0
  234. package/v3/dist/domains/test-execution/services/e2e/browser-orchestrator.js.map +1 -0
  235. package/v3/dist/domains/test-execution/services/e2e/e2e-coordinator.d.ts +97 -0
  236. package/v3/dist/domains/test-execution/services/e2e/e2e-coordinator.d.ts.map +1 -0
  237. package/v3/dist/domains/test-execution/services/e2e/e2e-coordinator.js +297 -0
  238. package/v3/dist/domains/test-execution/services/e2e/e2e-coordinator.js.map +1 -0
  239. package/v3/dist/domains/test-execution/services/e2e/index.d.ts +22 -0
  240. package/v3/dist/domains/test-execution/services/e2e/index.d.ts.map +1 -0
  241. package/v3/dist/domains/test-execution/services/e2e/index.js +52 -0
  242. package/v3/dist/domains/test-execution/services/e2e/index.js.map +1 -0
  243. package/v3/dist/domains/test-execution/services/e2e/result-collector.d.ts +51 -0
  244. package/v3/dist/domains/test-execution/services/e2e/result-collector.d.ts.map +1 -0
  245. package/v3/dist/domains/test-execution/services/e2e/result-collector.js +133 -0
  246. package/v3/dist/domains/test-execution/services/e2e/result-collector.js.map +1 -0
  247. package/v3/dist/domains/test-execution/services/e2e/step-executors.d.ts +48 -0
  248. package/v3/dist/domains/test-execution/services/e2e/step-executors.d.ts.map +1 -0
  249. package/v3/dist/domains/test-execution/services/e2e/step-executors.js +422 -0
  250. package/v3/dist/domains/test-execution/services/e2e/step-executors.js.map +1 -0
  251. package/v3/dist/domains/test-execution/services/e2e/step-retry-handler.d.ts +49 -0
  252. package/v3/dist/domains/test-execution/services/e2e/step-retry-handler.d.ts.map +1 -0
  253. package/v3/dist/domains/test-execution/services/e2e/step-retry-handler.js +146 -0
  254. package/v3/dist/domains/test-execution/services/e2e/step-retry-handler.js.map +1 -0
  255. package/v3/dist/domains/test-execution/services/e2e/types.d.ts +138 -0
  256. package/v3/dist/domains/test-execution/services/e2e/types.d.ts.map +1 -0
  257. package/v3/dist/domains/test-execution/services/e2e/types.js +65 -0
  258. package/v3/dist/domains/test-execution/services/e2e/types.js.map +1 -0
  259. package/v3/dist/domains/test-execution/services/e2e/wait-condition-handler.d.ts +33 -0
  260. package/v3/dist/domains/test-execution/services/e2e/wait-condition-handler.d.ts.map +1 -0
  261. package/v3/dist/domains/test-execution/services/e2e/wait-condition-handler.js +114 -0
  262. package/v3/dist/domains/test-execution/services/e2e/wait-condition-handler.js.map +1 -0
  263. package/v3/dist/domains/test-execution/services/e2e-runner.d.ts +18 -392
  264. package/v3/dist/domains/test-execution/services/e2e-runner.d.ts.map +1 -1
  265. package/v3/dist/domains/test-execution/services/e2e-runner.js +25 -1757
  266. package/v3/dist/domains/test-execution/services/e2e-runner.js.map +1 -1
  267. package/v3/dist/domains/test-execution/services/flaky-detector.d.ts.map +1 -1
  268. package/v3/dist/domains/test-execution/services/flaky-detector.js +12 -9
  269. package/v3/dist/domains/test-execution/services/flaky-detector.js.map +1 -1
  270. package/v3/dist/domains/test-execution/services/retry-handler.d.ts.map +1 -1
  271. package/v3/dist/domains/test-execution/services/retry-handler.js +7 -5
  272. package/v3/dist/domains/test-execution/services/retry-handler.js.map +1 -1
  273. package/v3/dist/domains/test-execution/services/test-executor.d.ts.map +1 -1
  274. package/v3/dist/domains/test-execution/services/test-executor.js +4 -3
  275. package/v3/dist/domains/test-execution/services/test-executor.js.map +1 -1
  276. package/v3/dist/domains/visual-accessibility/coordinator.d.ts +70 -0
  277. package/v3/dist/domains/visual-accessibility/coordinator.d.ts.map +1 -1
  278. package/v3/dist/domains/visual-accessibility/coordinator.js +172 -0
  279. package/v3/dist/domains/visual-accessibility/coordinator.js.map +1 -1
  280. package/v3/dist/domains/visual-accessibility/plugin.d.ts +2 -1
  281. package/v3/dist/domains/visual-accessibility/plugin.d.ts.map +1 -1
  282. package/v3/dist/domains/visual-accessibility/plugin.js +63 -0
  283. package/v3/dist/domains/visual-accessibility/plugin.js.map +1 -1
  284. package/v3/dist/domains/visual-accessibility/services/accessibility-tester.d.ts.map +1 -1
  285. package/v3/dist/domains/visual-accessibility/services/accessibility-tester.js +3 -2
  286. package/v3/dist/domains/visual-accessibility/services/accessibility-tester.js.map +1 -1
  287. package/v3/dist/domains/visual-accessibility/services/browser-security-scanner.d.ts.map +1 -1
  288. package/v3/dist/domains/visual-accessibility/services/browser-security-scanner.js +22 -12
  289. package/v3/dist/domains/visual-accessibility/services/browser-security-scanner.js.map +1 -1
  290. package/v3/dist/domains/visual-accessibility/services/viewport-capture.d.ts.map +1 -1
  291. package/v3/dist/domains/visual-accessibility/services/viewport-capture.js +3 -2
  292. package/v3/dist/domains/visual-accessibility/services/viewport-capture.js.map +1 -1
  293. package/v3/dist/domains/visual-accessibility/services/visual-regression.d.ts.map +1 -1
  294. package/v3/dist/domains/visual-accessibility/services/visual-regression.js +3 -2
  295. package/v3/dist/domains/visual-accessibility/services/visual-regression.js.map +1 -1
  296. package/v3/dist/hooks/cross-phase-hooks.d.ts +42 -0
  297. package/v3/dist/hooks/cross-phase-hooks.d.ts.map +1 -0
  298. package/v3/dist/hooks/cross-phase-hooks.js +338 -0
  299. package/v3/dist/hooks/cross-phase-hooks.js.map +1 -0
  300. package/v3/dist/hooks/index.d.ts +9 -0
  301. package/v3/dist/hooks/index.d.ts.map +1 -0
  302. package/v3/dist/hooks/index.js +9 -0
  303. package/v3/dist/hooks/index.js.map +1 -0
  304. package/v3/dist/init/agents-installer.d.ts.map +1 -1
  305. package/v3/dist/init/agents-installer.js +6 -4
  306. package/v3/dist/init/agents-installer.js.map +1 -1
  307. package/v3/dist/init/enhancements/claude-flow-adapter.d.ts.map +1 -1
  308. package/v3/dist/init/enhancements/claude-flow-adapter.js +15 -9
  309. package/v3/dist/init/enhancements/claude-flow-adapter.js.map +1 -1
  310. package/v3/dist/init/enhancements/detector.js +6 -4
  311. package/v3/dist/init/enhancements/detector.js.map +1 -1
  312. package/v3/dist/init/init-wizard.d.ts +5 -0
  313. package/v3/dist/init/init-wizard.d.ts.map +1 -1
  314. package/v3/dist/init/init-wizard.js +77 -14
  315. package/v3/dist/init/init-wizard.js.map +1 -1
  316. package/v3/dist/init/migration/data-migrator.d.ts.map +1 -1
  317. package/v3/dist/init/migration/data-migrator.js +6 -4
  318. package/v3/dist/init/migration/data-migrator.js.map +1 -1
  319. package/v3/dist/init/phases/02-analysis.js +2 -2
  320. package/v3/dist/init/phases/02-analysis.js.map +1 -1
  321. package/v3/dist/init/phases/04-database.d.ts.map +1 -1
  322. package/v3/dist/init/phases/04-database.js +0 -1
  323. package/v3/dist/init/phases/04-database.js.map +1 -1
  324. package/v3/dist/init/phases/05-learning.js +1 -1
  325. package/v3/dist/init/phases/05-learning.js.map +1 -1
  326. package/v3/dist/init/phases/11-claude-md.d.ts.map +1 -1
  327. package/v3/dist/init/phases/11-claude-md.js +25 -0
  328. package/v3/dist/init/phases/11-claude-md.js.map +1 -1
  329. package/v3/dist/init/phases/12-verification.d.ts.map +1 -1
  330. package/v3/dist/init/phases/12-verification.js +2 -1
  331. package/v3/dist/init/phases/12-verification.js.map +1 -1
  332. package/v3/dist/init/project-analyzer.d.ts.map +1 -1
  333. package/v3/dist/init/project-analyzer.js +12 -8
  334. package/v3/dist/init/project-analyzer.js.map +1 -1
  335. package/v3/dist/init/skills-installer.d.ts.map +1 -1
  336. package/v3/dist/init/skills-installer.js +6 -4
  337. package/v3/dist/init/skills-installer.js.map +1 -1
  338. package/v3/dist/init/token-bootstrap.d.ts.map +1 -1
  339. package/v3/dist/init/token-bootstrap.js +2 -1
  340. package/v3/dist/init/token-bootstrap.js.map +1 -1
  341. package/v3/dist/integrations/agent-booster-wasm/index.d.ts.map +1 -1
  342. package/v3/dist/integrations/agent-booster-wasm/index.js +8 -4
  343. package/v3/dist/integrations/agent-booster-wasm/index.js.map +1 -1
  344. package/v3/dist/integrations/agentic-flow/model-router/signal-collector.d.ts.map +1 -1
  345. package/v3/dist/integrations/agentic-flow/model-router/signal-collector.js +3 -2
  346. package/v3/dist/integrations/agentic-flow/model-router/signal-collector.js.map +1 -1
  347. package/v3/dist/integrations/agentic-flow/reasoning-bank/experience-replay.d.ts.map +1 -1
  348. package/v3/dist/integrations/agentic-flow/reasoning-bank/experience-replay.js.map +1 -1
  349. package/v3/dist/integrations/agentic-flow/reasoning-bank/trajectory-tracker.d.ts.map +1 -1
  350. package/v3/dist/integrations/agentic-flow/reasoning-bank/trajectory-tracker.js.map +1 -1
  351. package/v3/dist/integrations/browser/agent-browser/client.d.ts.map +1 -1
  352. package/v3/dist/integrations/browser/agent-browser/client.js +9 -6
  353. package/v3/dist/integrations/browser/agent-browser/client.js.map +1 -1
  354. package/v3/dist/integrations/browser/agent-browser/command-executor.d.ts.map +1 -1
  355. package/v3/dist/integrations/browser/agent-browser/command-executor.js +3 -2
  356. package/v3/dist/integrations/browser/agent-browser/command-executor.js.map +1 -1
  357. package/v3/dist/integrations/browser/index.d.ts +1 -0
  358. package/v3/dist/integrations/browser/index.d.ts.map +1 -1
  359. package/v3/dist/integrations/browser/index.js +6 -0
  360. package/v3/dist/integrations/browser/index.js.map +1 -1
  361. package/v3/dist/integrations/browser/web-content-fetcher.d.ts +154 -0
  362. package/v3/dist/integrations/browser/web-content-fetcher.d.ts.map +1 -0
  363. package/v3/dist/integrations/browser/web-content-fetcher.js +529 -0
  364. package/v3/dist/integrations/browser/web-content-fetcher.js.map +1 -0
  365. package/v3/dist/integrations/coherence/threshold-tuner.d.ts.map +1 -1
  366. package/v3/dist/integrations/coherence/threshold-tuner.js +3 -2
  367. package/v3/dist/integrations/coherence/threshold-tuner.js.map +1 -1
  368. package/v3/dist/integrations/coherence/wasm-loader.d.ts.map +1 -1
  369. package/v3/dist/integrations/coherence/wasm-loader.js +3 -2
  370. package/v3/dist/integrations/coherence/wasm-loader.js.map +1 -1
  371. package/v3/dist/integrations/n8n/agent-factory.d.ts.map +1 -1
  372. package/v3/dist/integrations/n8n/agent-factory.js +6 -4
  373. package/v3/dist/integrations/n8n/agent-factory.js.map +1 -1
  374. package/v3/dist/integrations/rl-suite/persistence/q-value-store.d.ts.map +1 -1
  375. package/v3/dist/integrations/rl-suite/persistence/q-value-store.js.map +1 -1
  376. package/v3/dist/integrations/ruvector/interfaces.js +1 -1
  377. package/v3/dist/integrations/ruvector/interfaces.js.map +1 -1
  378. package/v3/dist/integrations/ruvector/sona-persistence.d.ts.map +1 -1
  379. package/v3/dist/integrations/ruvector/sona-persistence.js +6 -4
  380. package/v3/dist/integrations/ruvector/sona-persistence.js.map +1 -1
  381. package/v3/dist/integrations/vibium/client.d.ts.map +1 -1
  382. package/v3/dist/integrations/vibium/client.js +3 -2
  383. package/v3/dist/integrations/vibium/client.js.map +1 -1
  384. package/v3/dist/kernel/agent-coordinator.d.ts +1 -1
  385. package/v3/dist/kernel/agent-coordinator.d.ts.map +1 -1
  386. package/v3/dist/kernel/agent-coordinator.js +4 -4
  387. package/v3/dist/kernel/agent-coordinator.js.map +1 -1
  388. package/v3/dist/kernel/constants.d.ts +155 -0
  389. package/v3/dist/kernel/constants.d.ts.map +1 -0
  390. package/v3/dist/kernel/constants.js +169 -0
  391. package/v3/dist/kernel/constants.js.map +1 -0
  392. package/v3/dist/kernel/event-bus.d.ts +8 -0
  393. package/v3/dist/kernel/event-bus.d.ts.map +1 -1
  394. package/v3/dist/kernel/event-bus.js +79 -17
  395. package/v3/dist/kernel/event-bus.js.map +1 -1
  396. package/v3/dist/kernel/hybrid-backend.d.ts.map +1 -1
  397. package/v3/dist/kernel/hybrid-backend.js +4 -3
  398. package/v3/dist/kernel/hybrid-backend.js.map +1 -1
  399. package/v3/dist/kernel/index.d.ts +1 -1
  400. package/v3/dist/kernel/index.d.ts.map +1 -1
  401. package/v3/dist/kernel/index.js +3 -1
  402. package/v3/dist/kernel/index.js.map +1 -1
  403. package/v3/dist/kernel/kernel.d.ts.map +1 -1
  404. package/v3/dist/kernel/kernel.js +3 -2
  405. package/v3/dist/kernel/kernel.js.map +1 -1
  406. package/v3/dist/kernel/memory-backend.d.ts.map +1 -1
  407. package/v3/dist/kernel/memory-backend.js +4 -3
  408. package/v3/dist/kernel/memory-backend.js.map +1 -1
  409. package/v3/dist/kernel/unified-memory.d.ts +26 -0
  410. package/v3/dist/kernel/unified-memory.d.ts.map +1 -1
  411. package/v3/dist/kernel/unified-memory.js +68 -13
  412. package/v3/dist/kernel/unified-memory.js.map +1 -1
  413. package/v3/dist/kernel/unified-persistence.js +3 -2
  414. package/v3/dist/kernel/unified-persistence.js.map +1 -1
  415. package/v3/dist/learning/aqe-learning-engine.d.ts.map +1 -1
  416. package/v3/dist/learning/aqe-learning-engine.js +12 -8
  417. package/v3/dist/learning/aqe-learning-engine.js.map +1 -1
  418. package/v3/dist/learning/dream/index.d.ts +1 -1
  419. package/v3/dist/learning/dream/index.d.ts.map +1 -1
  420. package/v3/dist/learning/dream/index.js +3 -1
  421. package/v3/dist/learning/dream/index.js.map +1 -1
  422. package/v3/dist/learning/dream/spreading-activation.d.ts +41 -0
  423. package/v3/dist/learning/dream/spreading-activation.d.ts.map +1 -1
  424. package/v3/dist/learning/dream/spreading-activation.js +79 -0
  425. package/v3/dist/learning/dream/spreading-activation.js.map +1 -1
  426. package/v3/dist/learning/pattern-store.d.ts.map +1 -1
  427. package/v3/dist/learning/pattern-store.js +16 -6
  428. package/v3/dist/learning/pattern-store.js.map +1 -1
  429. package/v3/dist/learning/qe-unified-memory.js +1 -1
  430. package/v3/dist/learning/qe-unified-memory.js.map +1 -1
  431. package/v3/dist/learning/real-embeddings.d.ts.map +1 -1
  432. package/v3/dist/learning/real-embeddings.js +7 -1
  433. package/v3/dist/learning/real-embeddings.js.map +1 -1
  434. package/v3/dist/learning/real-qe-reasoning-bank.js +2 -2
  435. package/v3/dist/learning/real-qe-reasoning-bank.js.map +1 -1
  436. package/v3/dist/learning/sqlite-persistence.d.ts +2 -2
  437. package/v3/dist/learning/sqlite-persistence.d.ts.map +1 -1
  438. package/v3/dist/learning/sqlite-persistence.js +1 -1
  439. package/v3/dist/learning/sqlite-persistence.js.map +1 -1
  440. package/v3/dist/learning/v2-to-v3-migration.d.ts +2 -2
  441. package/v3/dist/learning/v2-to-v3-migration.d.ts.map +1 -1
  442. package/v3/dist/learning/v2-to-v3-migration.js +2 -2
  443. package/v3/dist/learning/v2-to-v3-migration.js.map +1 -1
  444. package/v3/dist/logging/console-logger.d.ts +96 -0
  445. package/v3/dist/logging/console-logger.d.ts.map +1 -0
  446. package/v3/dist/logging/console-logger.js +247 -0
  447. package/v3/dist/logging/console-logger.js.map +1 -0
  448. package/v3/dist/logging/index.d.ts +42 -0
  449. package/v3/dist/logging/index.d.ts.map +1 -0
  450. package/v3/dist/logging/index.js +39 -0
  451. package/v3/dist/logging/index.js.map +1 -0
  452. package/v3/dist/logging/logger-factory.d.ts +145 -0
  453. package/v3/dist/logging/logger-factory.d.ts.map +1 -0
  454. package/v3/dist/logging/logger-factory.js +218 -0
  455. package/v3/dist/logging/logger-factory.js.map +1 -0
  456. package/v3/dist/logging/logger.d.ts +89 -0
  457. package/v3/dist/logging/logger.d.ts.map +1 -0
  458. package/v3/dist/logging/logger.js +74 -0
  459. package/v3/dist/logging/logger.js.map +1 -0
  460. package/v3/dist/mcp/bundle.js +11385 -7526
  461. package/v3/dist/mcp/handlers/agent-handlers.js +2 -2
  462. package/v3/dist/mcp/handlers/agent-handlers.js.map +1 -1
  463. package/v3/dist/mcp/handlers/core-handlers.d.ts +2 -0
  464. package/v3/dist/mcp/handlers/core-handlers.d.ts.map +1 -1
  465. package/v3/dist/mcp/handlers/core-handlers.js +33 -0
  466. package/v3/dist/mcp/handlers/core-handlers.js.map +1 -1
  467. package/v3/dist/mcp/handlers/cross-phase-handlers.d.ts +110 -0
  468. package/v3/dist/mcp/handlers/cross-phase-handlers.d.ts.map +1 -0
  469. package/v3/dist/mcp/handlers/cross-phase-handlers.js +216 -0
  470. package/v3/dist/mcp/handlers/cross-phase-handlers.js.map +1 -0
  471. package/v3/dist/mcp/handlers/domain-handler-configs.d.ts +151 -0
  472. package/v3/dist/mcp/handlers/domain-handler-configs.d.ts.map +1 -0
  473. package/v3/dist/mcp/handlers/domain-handler-configs.js +486 -0
  474. package/v3/dist/mcp/handlers/domain-handler-configs.js.map +1 -0
  475. package/v3/dist/mcp/handlers/domain-handlers.d.ts +174 -120
  476. package/v3/dist/mcp/handlers/domain-handlers.d.ts.map +1 -1
  477. package/v3/dist/mcp/handlers/domain-handlers.js +178 -1049
  478. package/v3/dist/mcp/handlers/domain-handlers.js.map +1 -1
  479. package/v3/dist/mcp/handlers/handler-factory.d.ts +182 -0
  480. package/v3/dist/mcp/handlers/handler-factory.d.ts.map +1 -0
  481. package/v3/dist/mcp/handlers/handler-factory.js +327 -0
  482. package/v3/dist/mcp/handlers/handler-factory.js.map +1 -0
  483. package/v3/dist/mcp/handlers/index.d.ts +1 -0
  484. package/v3/dist/mcp/handlers/index.d.ts.map +1 -1
  485. package/v3/dist/mcp/handlers/index.js +2 -0
  486. package/v3/dist/mcp/handlers/index.js.map +1 -1
  487. package/v3/dist/mcp/handlers/task-handlers.d.ts +1 -0
  488. package/v3/dist/mcp/handlers/task-handlers.d.ts.map +1 -1
  489. package/v3/dist/mcp/handlers/task-handlers.js +91 -7
  490. package/v3/dist/mcp/handlers/task-handlers.js.map +1 -1
  491. package/v3/dist/mcp/server.d.ts.map +1 -1
  492. package/v3/dist/mcp/server.js +107 -1
  493. package/v3/dist/mcp/server.js.map +1 -1
  494. package/v3/dist/mcp/types.d.ts +5 -3
  495. package/v3/dist/mcp/types.d.ts.map +1 -1
  496. package/v3/dist/memory/cross-phase-memory.d.ts +55 -0
  497. package/v3/dist/memory/cross-phase-memory.d.ts.map +1 -0
  498. package/v3/dist/memory/cross-phase-memory.js +265 -0
  499. package/v3/dist/memory/cross-phase-memory.js.map +1 -0
  500. package/v3/dist/memory/index.d.ts +9 -0
  501. package/v3/dist/memory/index.d.ts.map +1 -0
  502. package/v3/dist/memory/index.js +9 -0
  503. package/v3/dist/memory/index.js.map +1 -0
  504. package/v3/dist/shared/io/file-reader.d.ts.map +1 -1
  505. package/v3/dist/shared/io/file-reader.js +3 -2
  506. package/v3/dist/shared/io/file-reader.js.map +1 -1
  507. package/v3/dist/shared/utils/binary-insert.d.ts +85 -0
  508. package/v3/dist/shared/utils/binary-insert.d.ts.map +1 -0
  509. package/v3/dist/shared/utils/binary-insert.js +122 -0
  510. package/v3/dist/shared/utils/binary-insert.js.map +1 -0
  511. package/v3/dist/shared/utils/index.d.ts +1 -0
  512. package/v3/dist/shared/utils/index.d.ts.map +1 -1
  513. package/v3/dist/shared/utils/index.js +1 -0
  514. package/v3/dist/shared/utils/index.js.map +1 -1
  515. package/v3/dist/strange-loop/belief-reconciler.d.ts.map +1 -1
  516. package/v3/dist/strange-loop/belief-reconciler.js +3 -2
  517. package/v3/dist/strange-loop/belief-reconciler.js.map +1 -1
  518. package/v3/dist/sync/claude-flow-bridge.d.ts +1 -1
  519. package/v3/dist/sync/claude-flow-bridge.d.ts.map +1 -1
  520. package/v3/dist/sync/claude-flow-bridge.js +7 -5
  521. package/v3/dist/sync/claude-flow-bridge.js.map +1 -1
  522. package/v3/dist/sync/cloud/postgres-writer.d.ts.map +1 -1
  523. package/v3/dist/sync/cloud/postgres-writer.js +0 -1
  524. package/v3/dist/sync/cloud/postgres-writer.js.map +1 -1
  525. package/v3/dist/sync/interfaces.d.ts +6 -0
  526. package/v3/dist/sync/interfaces.d.ts.map +1 -1
  527. package/v3/dist/sync/interfaces.js +34 -47
  528. package/v3/dist/sync/interfaces.js.map +1 -1
  529. package/v3/dist/sync/readers/sqlite-reader.d.ts +1 -1
  530. package/v3/dist/sync/readers/sqlite-reader.d.ts.map +1 -1
  531. package/v3/dist/sync/readers/sqlite-reader.js +4 -3
  532. package/v3/dist/sync/readers/sqlite-reader.js.map +1 -1
  533. package/v3/dist/test-scheduling/flaky-tracking/flaky-tracker.d.ts.map +1 -1
  534. package/v3/dist/test-scheduling/flaky-tracking/flaky-tracker.js +3 -2
  535. package/v3/dist/test-scheduling/flaky-tracking/flaky-tracker.js.map +1 -1
  536. package/v3/dist/test-scheduling/git-aware/test-selector.d.ts.map +1 -1
  537. package/v3/dist/test-scheduling/git-aware/test-selector.js +3 -2
  538. package/v3/dist/test-scheduling/git-aware/test-selector.js.map +1 -1
  539. package/v3/dist/types/cross-phase-signals.d.ts +119 -0
  540. package/v3/dist/types/cross-phase-signals.d.ts.map +1 -0
  541. package/v3/dist/types/cross-phase-signals.js +33 -0
  542. package/v3/dist/types/cross-phase-signals.js.map +1 -0
  543. package/v3/dist/types/index.d.ts +9 -0
  544. package/v3/dist/types/index.d.ts.map +1 -0
  545. package/v3/dist/types/index.js +9 -0
  546. package/v3/dist/types/index.js.map +1 -0
  547. package/v3/dist/workers/worker-manager.d.ts.map +1 -1
  548. package/v3/dist/workers/worker-manager.js +3 -2
  549. package/v3/dist/workers/worker-manager.js.map +1 -1
  550. package/v3/dist/workflows/browser/workflow-loader.d.ts +3 -3
  551. package/v3/dist/workflows/browser/workflow-loader.d.ts.map +1 -1
  552. package/v3/dist/workflows/browser/workflow-loader.js.map +1 -1
  553. package/v3/package.json +4 -1
@@ -8,1066 +8,195 @@
8
8
  * - Learning feedback confirming pattern updates
9
9
  * - Worker efficiency and load balance stats
10
10
  * - Complexity analysis
11
+ *
12
+ * Refactored in Milestone 1.3 to use the handler factory pattern,
13
+ * reducing code from ~1,578 lines to ~400 lines.
14
+ *
15
+ * @module mcp/handlers/domain-handlers
11
16
  */
12
- import { randomUUID } from 'crypto';
13
- import { getFleetState, isFleetInitialized } from './core-handlers';
14
- import { createTaskExecutor } from '../../coordination/task-executor';
15
- import { MetricsCollector } from '../metrics';
16
- import { getTaskRouter } from '../services/task-router';
17
- // ============================================================================
18
- // V2-Compatible Response Helpers
19
- // ============================================================================
20
- function generateTestId() {
21
- // Use crypto.randomUUID() for cryptographically secure unique IDs
22
- return `test-${randomUUID()}`;
23
- }
24
- function generateAgentId(type) {
25
- // Use crypto.randomUUID() for cryptographically secure unique IDs
26
- return `${type}-${randomUUID()}`;
27
- }
17
+ import { createDomainHandler, resetTaskExecutor as resetExecutor } from './handler-factory';
18
+ import { testGenerateConfig, testExecuteConfig, coverageAnalyzeConfig, qualityAssessConfig, securityScanConfig, contractValidateConfig, accessibilityTestConfig, chaosTestConfig, defectPredictConfig, requirementsValidateConfig, codeIndexConfig, } from './domain-handler-configs';
28
19
  // ============================================================================
29
- // ADR-051: Task Routing Integration
20
+ // Task Executor Management
30
21
  // ============================================================================
31
22
  /**
32
- * Route a domain task through the Model Router
33
- * Returns routing decision with model tier recommendation
23
+ * Reset executor when fleet is reinitialized
34
24
  */
35
- async function routeDomainTask(taskDescription, domain, codeContext) {
36
- try {
37
- const router = await getTaskRouter();
38
- const result = await router.routeTask({
39
- task: taskDescription,
40
- domain,
41
- codeContext,
42
- agentType: `qe-${domain}`,
43
- });
44
- return result;
45
- }
46
- catch (error) {
47
- // Log but don't fail - routing is advisory
48
- console.error(`[DomainHandlers] Routing failed for ${domain}: ${error}`);
49
- return null;
50
- }
51
- }
52
- // ============================================================================
53
- // V2-Compatible Response Helpers
54
- // ============================================================================
55
- function analyzeComplexity(sourceCode) {
56
- const lines = sourceCode.split('\n').length;
57
- const branches = (sourceCode.match(/if|switch|for|while|catch/g) || []).length;
58
- const score = lines + branches * 2;
59
- return {
60
- score,
61
- level: branches > 5 ? 'high' : branches > 2 ? 'medium' : 'low'
62
- };
63
- }
64
- function generateV2Tests(sourceCode, testType, language, count) {
65
- const tests = [];
66
- const funcRegex = /(?:function\s+(\w+)|const\s+(\w+)\s*=|def\s+(\w+)|func\s+(\w+))/g;
67
- const functions = [];
68
- let match;
69
- while ((match = funcRegex.exec(sourceCode)) !== null) {
70
- const funcName = match[1] || match[2] || match[3] || match[4];
71
- if (funcName)
72
- functions.push(funcName);
73
- }
74
- // Generate tests for each function
75
- for (let i = 0; i < Math.min(functions.length, count); i++) {
76
- const funcName = functions[i] || `exampleFunction`;
77
- tests.push({
78
- id: generateTestId(),
79
- name: `test_${funcName}_${i}`,
80
- type: testType,
81
- parameters: [],
82
- assertions: [`${funcName}() === null`],
83
- expectedResult: null,
84
- estimatedDuration: testType === 'integration' ? 2000 : 1000,
85
- aiGenerated: true,
86
- });
87
- }
88
- // Add integration test if needed
89
- if (testType === 'integration' || count > functions.length) {
90
- tests.push({
91
- id: generateTestId(),
92
- name: `integration_ComponentA_${tests.length}`,
93
- type: 'integration',
94
- parameters: [],
95
- assertions: ['ComponentA integration test passes'],
96
- expectedResult: null,
97
- estimatedDuration: 2000,
98
- aiGenerated: true,
99
- });
100
- }
101
- // Add edge case tests
102
- const edgeCases = ['high-complexity', 'deep-nesting', 'null-handling', 'empty-input'];
103
- for (let i = tests.length; i < count && i - tests.length < edgeCases.length; i++) {
104
- tests.push({
105
- id: generateTestId(),
106
- name: `edge_case_${edgeCases[i - tests.length]}_${i}`,
107
- type: 'unit',
108
- parameters: [],
109
- assertions: [`${edgeCases[i - tests.length]} edge case handled`],
110
- expectedResult: null,
111
- estimatedDuration: 1500,
112
- aiGenerated: true,
113
- });
114
- }
115
- return tests;
116
- }
117
- function generateV2AIInsights(complexity, testType) {
118
- const recommendations = [];
119
- if (complexity.level === 'high') {
120
- recommendations.push('Consider refactoring complex functions');
121
- recommendations.push('Add unit tests for each branch');
122
- }
123
- recommendations.push('Consider adding edge case tests');
124
- recommendations.push('Add error handling tests');
125
- if (testType === 'integration') {
126
- recommendations.push('Add mock external dependencies');
127
- recommendations.push('Test API contract boundaries');
128
- }
129
- return {
130
- recommendations,
131
- estimatedTime: `${Math.round(complexity.score * 0.5)} minutes`,
132
- confidence: 0.85
133
- };
134
- }
135
- function generateV2LearningFeedback(agentType) {
136
- return {
137
- enabled: true,
138
- agentId: generateAgentId(agentType),
139
- message: 'Agent learned from this execution - patterns and Q-values updated'
140
- };
141
- }
142
- function detectAntiPatterns(sourceCode, language) {
143
- const antiPatterns = [];
144
- const lines = sourceCode.split('\n');
145
- if (sourceCode.includes('eval(')) {
146
- antiPatterns.push({
147
- type: 'dangerous-eval',
148
- line: lines.findIndex(l => l.includes('eval(')) + 1,
149
- severity: 'critical',
150
- suggestion: 'Replace eval() with safer alternatives'
151
- });
152
- }
153
- if (sourceCode.includes('var ') && (language === 'javascript' || language === 'typescript')) {
154
- antiPatterns.push({
155
- type: 'var-usage',
156
- line: lines.findIndex(l => l.includes('var ')) + 1,
157
- severity: 'low',
158
- suggestion: 'Use const or let instead of var'
159
- });
160
- }
161
- if (sourceCode.includes('any') && language === 'typescript') {
162
- antiPatterns.push({
163
- type: 'any-type',
164
- line: lines.findIndex(l => l.includes('any')) + 1,
165
- severity: 'medium',
166
- suggestion: 'Replace any with specific types'
167
- });
168
- }
169
- return antiPatterns;
170
- }
171
- // Cached task executor
172
- let taskExecutor = null;
173
- function getTaskExecutor() {
174
- if (!taskExecutor) {
175
- const { kernel } = getFleetState();
176
- if (!kernel) {
177
- throw new Error('Kernel not initialized');
178
- }
179
- taskExecutor = createTaskExecutor(kernel);
180
- }
181
- return taskExecutor;
182
- }
183
- // Reset executor when fleet is reinitialized
184
25
  export function resetTaskExecutor() {
185
- taskExecutor = null;
26
+ resetExecutor();
186
27
  }
187
28
  // ============================================================================
188
- // Test Generation Handler
29
+ // Domain Handlers - Created via Factory Pattern
189
30
  // ============================================================================
190
- export async function handleTestGenerate(params) {
191
- if (!isFleetInitialized()) {
192
- return {
193
- success: false,
194
- error: 'Fleet not initialized. Call fleet_init first.',
195
- };
196
- }
197
- const { queen } = getFleetState();
198
- try {
199
- // ADR-051: Route task to optimal model tier
200
- const routingResult = await routeDomainTask(`Generate ${params.testType || 'unit'} tests for ${params.language || 'typescript'} code`, 'test-generation', params.sourceCode);
201
- // Submit task for tracking
202
- const submitResult = await queen.submitTask({
203
- type: 'generate-tests',
204
- priority: 'p1',
205
- targetDomains: ['test-generation'],
206
- payload: {
207
- sourceCode: params.sourceCode,
208
- filePath: params.filePath,
209
- language: params.language || 'typescript',
210
- framework: params.framework || 'vitest',
211
- testType: params.testType || 'unit',
212
- coverageGoal: params.coverageGoal || 80,
213
- aiEnhancement: params.aiEnhancement !== false,
214
- detectAntiPatterns: params.detectAntiPatterns || false,
215
- // ADR-051: Include routing decision
216
- routingTier: routingResult?.decision.tier,
217
- useAgentBooster: routingResult?.useAgentBooster,
218
- },
219
- timeout: 120000,
220
- });
221
- if (!submitResult.success) {
222
- return {
223
- success: false,
224
- error: submitResult.error.message,
225
- };
226
- }
227
- // Execute the task and get real results
228
- const executor = getTaskExecutor();
229
- const task = queen.getTaskStatus(submitResult.value);
230
- if (!task) {
231
- return {
232
- success: false,
233
- error: 'Task not found after submission',
234
- };
235
- }
236
- const result = await executor.execute(task.task);
237
- if (!result.success) {
238
- return {
239
- success: false,
240
- error: result.error || 'Task execution failed',
241
- };
242
- }
243
- const data = result.data;
244
- // Generate V2-compatible detailed response
245
- const sourceCode = params.sourceCode || '';
246
- const language = params.language || 'typescript';
247
- const testType = params.testType || 'unit';
248
- const testsCount = data.testsGenerated || 6;
249
- const complexity = analyzeComplexity(sourceCode);
250
- const v2Tests = generateV2Tests(sourceCode, testType, language, testsCount);
251
- const aiInsights = params.aiEnhancement !== false
252
- ? generateV2AIInsights(complexity, testType)
253
- : { recommendations: [], estimatedTime: '0 minutes', confidence: 0 };
254
- const antiPatterns = params.detectAntiPatterns
255
- ? detectAntiPatterns(sourceCode, language)
256
- : [];
257
- const learning = generateV2LearningFeedback('test-generator');
258
- return {
259
- success: true,
260
- data: {
261
- // V2-compatible fields
262
- tests: v2Tests,
263
- antiPatterns,
264
- suggestions: antiPatterns.map(ap => `Fix: ${ap.type} - ${ap.suggestion}`),
265
- aiInsights,
266
- coverage: {
267
- predicted: data.coverageEstimate || params.coverageGoal || 80,
268
- confidence: 0.9,
269
- achievable: true,
270
- },
271
- properties: v2Tests.filter(t => t.type === 'property').map(t => ({
272
- name: t.name,
273
- invariant: 'output_matches_expectation'
274
- })),
275
- language,
276
- complexity,
277
- learning,
278
- // V3 fields
279
- taskId: submitResult.value,
280
- testsGenerated: v2Tests.length,
281
- coverageEstimate: data.coverageEstimate || params.coverageGoal || 80,
282
- patternsUsed: data.patternsUsed || ['assertion-patterns', 'mock-generation', 'edge-case-detection'],
283
- duration: result.duration,
284
- savedFiles: result.savedFiles,
285
- },
286
- };
287
- }
288
- catch (error) {
289
- return {
290
- success: false,
291
- error: `Failed to generate tests: ${error instanceof Error ? error.message : String(error)}`,
292
- };
293
- }
294
- }
295
- export async function handleTestExecute(params) {
296
- if (!isFleetInitialized()) {
297
- return {
298
- success: false,
299
- error: 'Fleet not initialized. Call fleet_init first.',
300
- };
301
- }
302
- const { queen } = getFleetState();
303
- try {
304
- // ADR-051: Route task to optimal model tier
305
- const routingResult = await routeDomainTask(`Execute ${params.testFiles?.length || 0} test files with ${params.parallel !== false ? 'parallel' : 'sequential'} execution`, 'test-execution');
306
- const submitResult = await queen.submitTask({
307
- type: 'execute-tests',
308
- priority: 'p1',
309
- targetDomains: ['test-execution'],
310
- payload: {
311
- testFiles: params.testFiles || [],
312
- testSuites: params.testSuites || [],
313
- parallel: params.parallel !== false,
314
- parallelism: params.parallelism || 4,
315
- retryCount: params.retryCount || 3,
316
- timeout: params.timeout || 60000,
317
- collectCoverage: params.collectCoverage || false,
318
- reportFormat: params.reportFormat || 'json',
319
- // ADR-051: Include routing decision
320
- routingTier: routingResult?.decision.tier,
321
- useAgentBooster: routingResult?.useAgentBooster,
322
- },
323
- timeout: params.timeout || 300000,
324
- });
325
- if (!submitResult.success) {
326
- return {
327
- success: false,
328
- error: submitResult.error.message,
329
- };
330
- }
331
- const executor = getTaskExecutor();
332
- const task = queen.getTaskStatus(submitResult.value);
333
- if (!task) {
334
- return {
335
- success: false,
336
- error: 'Task not found after submission',
337
- };
338
- }
339
- const result = await executor.execute(task.task);
340
- if (!result.success) {
341
- return {
342
- success: false,
343
- error: result.error || 'Task execution failed',
344
- };
345
- }
346
- const data = result.data;
347
- // Generate V2-compatible worker stats and retry stats using real metrics
348
- const parallelism = params.parallelism || 4;
349
- const realRetryStats = MetricsCollector.getRetryStats();
350
- const workersUsed = MetricsCollector.getWorkersUsed();
351
- const workerStats = {
352
- workersUsed: workersUsed > 0 ? workersUsed : Math.min(parallelism, data.total || 1),
353
- efficiency: MetricsCollector.getWorkerEfficiency(),
354
- loadBalance: MetricsCollector.getLoadBalanceScore(),
355
- avgExecutionTime: data.duration / Math.max(data.total, 1),
356
- };
357
- const retryStats = {
358
- totalRetries: realRetryStats.totalRetries,
359
- successfulRetries: realRetryStats.successfulRetries,
360
- maxRetriesReached: realRetryStats.maxRetriesReached,
361
- };
362
- const learning = generateV2LearningFeedback('test-executor');
363
- return {
364
- success: true,
365
- data: {
366
- // V2-compatible fields
367
- workerStats,
368
- retryStats,
369
- results: (() => {
370
- const testDurations = MetricsCollector.getTestDurations(data.total || 0);
371
- return Array.from({ length: data.total || 0 }, (_, i) => ({
372
- id: generateTestId(),
373
- name: `test_case_${i}`,
374
- status: i < (data.passed || 0) ? 'passed' : 'failed',
375
- duration: testDurations[i] || 200,
376
- retries: 0,
377
- }));
378
- })(),
379
- summary: {
380
- totalTests: data.total,
381
- passRate: data.total > 0 ? (data.passed / data.total) * 100 : 0,
382
- avgDuration: data.duration / Math.max(data.total, 1),
383
- parallelEfficiency: workerStats.efficiency,
384
- },
385
- learning,
386
- // V3 fields
387
- taskId: submitResult.value,
388
- status: 'completed',
389
- total: data.total,
390
- passed: data.passed,
391
- failed: data.failed,
392
- duration: data.duration,
393
- coverage: data.coverage,
394
- },
395
- };
396
- }
397
- catch (error) {
398
- return {
399
- success: false,
400
- error: `Failed to execute tests: ${error instanceof Error ? error.message : String(error)}`,
401
- };
402
- }
403
- }
31
+ /**
32
+ * Handle test generation tasks
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * const result = await handleTestGenerate({
37
+ * sourceCode: 'function add(a, b) { return a + b; }',
38
+ * language: 'typescript',
39
+ * testType: 'unit',
40
+ * });
41
+ * ```
42
+ */
43
+ export const handleTestGenerate = createDomainHandler(testGenerateConfig);
44
+ /**
45
+ * Handle test execution tasks
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * const result = await handleTestExecute({
50
+ * testFiles: ['tests/unit/*.test.ts'],
51
+ * parallel: true,
52
+ * parallelism: 4,
53
+ * });
54
+ * ```
55
+ */
56
+ export const handleTestExecute = createDomainHandler(testExecuteConfig);
57
+ /**
58
+ * Handle coverage analysis tasks
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const result = await handleCoverageAnalyze({
63
+ * target: 'src/',
64
+ * detectGaps: true,
65
+ * mlPowered: true,
66
+ * });
67
+ * ```
68
+ */
69
+ export const handleCoverageAnalyze = createDomainHandler(coverageAnalyzeConfig);
70
+ /**
71
+ * Handle quality assessment tasks
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const result = await handleQualityAssess({
76
+ * runGate: true,
77
+ * threshold: 80,
78
+ * metrics: ['coverage', 'complexity'],
79
+ * });
80
+ * ```
81
+ */
82
+ export const handleQualityAssess = createDomainHandler(qualityAssessConfig);
83
+ /**
84
+ * Handle security scan tasks
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * const result = await handleSecurityScan({
89
+ * sast: true,
90
+ * dast: false,
91
+ * target: 'src/',
92
+ * });
93
+ * ```
94
+ */
95
+ export const handleSecurityScan = createDomainHandler(securityScanConfig);
96
+ /**
97
+ * Handle contract validation tasks
98
+ *
99
+ * @example
100
+ * ```typescript
101
+ * const result = await handleContractValidate({
102
+ * contractPath: 'contracts/api.yaml',
103
+ * checkBreakingChanges: true,
104
+ * });
105
+ * ```
106
+ */
107
+ export const handleContractValidate = createDomainHandler(contractValidateConfig);
108
+ /**
109
+ * Handle accessibility test tasks
110
+ *
111
+ * @example
112
+ * ```typescript
113
+ * const result = await handleAccessibilityTest({
114
+ * url: 'https://example.com',
115
+ * standard: 'wcag21-aa',
116
+ * });
117
+ * ```
118
+ */
119
+ export const handleAccessibilityTest = createDomainHandler(accessibilityTestConfig);
120
+ /**
121
+ * Handle chaos test tasks
122
+ *
123
+ * @example
124
+ * ```typescript
125
+ * const result = await handleChaosTest({
126
+ * faultType: 'latency',
127
+ * target: 'api-service',
128
+ * duration: 30000,
129
+ * dryRun: true,
130
+ * });
131
+ * ```
132
+ */
133
+ export const handleChaosTest = createDomainHandler(chaosTestConfig);
134
+ /**
135
+ * Handle defect prediction tasks
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * const result = await handleDefectPredict({
140
+ * target: 'src/',
141
+ * lookback: 30,
142
+ * minConfidence: 0.7,
143
+ * });
144
+ * ```
145
+ */
146
+ export const handleDefectPredict = createDomainHandler(defectPredictConfig);
147
+ /**
148
+ * Handle requirements validation tasks
149
+ *
150
+ * @example
151
+ * ```typescript
152
+ * const result = await handleRequirementsValidate({
153
+ * requirementsPath: 'docs/requirements.md',
154
+ * generateBDD: true,
155
+ * });
156
+ * ```
157
+ */
158
+ export const handleRequirementsValidate = createDomainHandler(requirementsValidateConfig);
159
+ /**
160
+ * Handle code indexing tasks
161
+ *
162
+ * @example
163
+ * ```typescript
164
+ * const result = await handleCodeIndex({
165
+ * target: 'src/',
166
+ * incremental: true,
167
+ * });
168
+ * ```
169
+ */
170
+ export const handleCodeIndex = createDomainHandler(codeIndexConfig);
404
171
  // ============================================================================
405
- // Coverage Analysis Handler
172
+ // Handler Registry (for dynamic dispatch)
406
173
  // ============================================================================
407
- export async function handleCoverageAnalyze(params) {
408
- if (!isFleetInitialized()) {
409
- return {
410
- success: false,
411
- error: 'Fleet not initialized. Call fleet_init first.',
412
- };
413
- }
414
- const { queen } = getFleetState();
415
- try {
416
- // ADR-051: Route task to optimal model tier
417
- const routingResult = await routeDomainTask(`Analyze coverage for ${params.target || 'project'} with gap detection`, 'coverage-analysis');
418
- const submitResult = await queen.submitTask({
419
- type: 'analyze-coverage',
420
- priority: 'p1',
421
- targetDomains: ['coverage-analysis'],
422
- payload: {
423
- target: params.target || '.',
424
- includeRisk: params.includeRisk || false,
425
- detectGaps: params.detectGaps !== false,
426
- mlPowered: params.mlPowered || false,
427
- prioritization: params.prioritization || 'complexity',
428
- // ADR-051: Include routing decision
429
- routingTier: routingResult?.decision.tier,
430
- useAgentBooster: routingResult?.useAgentBooster,
431
- },
432
- timeout: 180000,
433
- });
434
- if (!submitResult.success) {
435
- return {
436
- success: false,
437
- error: submitResult.error.message,
438
- };
439
- }
440
- const executor = getTaskExecutor();
441
- const task = queen.getTaskStatus(submitResult.value);
442
- if (!task) {
443
- return {
444
- success: false,
445
- error: 'Task not found after submission',
446
- };
447
- }
448
- const result = await executor.execute(task.task);
449
- if (!result.success) {
450
- return {
451
- success: false,
452
- error: result.error || 'Task execution failed',
453
- };
454
- }
455
- const data = result.data;
456
- // Generate V2-compatible detailed coverage response
457
- const learning = generateV2LearningFeedback('coverage-analyzer');
458
- // Generate detailed gap analysis
459
- const detailedGaps = (data.gaps || []).map((gap, i) => ({
460
- id: `gap-${Date.now()}-${i}`,
461
- file: gap?.file || `src/module${i}.ts`,
462
- line: gap?.lines?.[0] || (10 + i * 5),
463
- uncoveredLines: gap?.lines || [10 + i * 5, 20 + i * 5],
464
- type: (gap?.type || 'uncovered-line'),
465
- severity: (gap?.severity || (i < 2 ? 'high' : 'medium')),
466
- reason: gap?.reason || 'Missing test case',
467
- priority: gap?.priority || (i < 2 ? 'high' : 'medium'),
468
- suggestion: gap?.suggestedTest || `Add test for line ${10 + i * 5}`,
469
- suggestedTest: gap?.suggestedTest || `Add test for line ${10 + i * 5}`,
470
- riskScore: gap?.riskScore || (0.8 - i * 0.1),
471
- confidence: gap?.confidence || 0.85,
472
- }));
473
- return {
474
- success: true,
475
- data: {
476
- // V2-compatible fields
477
- // Use deterministic variations based on file index instead of random
478
- coverageByFile: Array.from({ length: data.totalFiles || 5 }, (_, i) => {
479
- // Create predictable variation: alternating +/- based on index
480
- const variation = ((i % 3) - 1) * 5; // -5, 0, +5 pattern
481
- return {
482
- file: `src/module${i}.ts`,
483
- lineCoverage: Math.max(0, Math.min(100, data.lineCoverage + variation)),
484
- branchCoverage: Math.max(0, Math.min(100, data.branchCoverage + variation - 2)),
485
- functionCoverage: Math.max(0, Math.min(100, data.functionCoverage + variation + 2)),
486
- };
487
- }),
488
- gapAnalysis: {
489
- totalGaps: detailedGaps.length,
490
- highPriority: detailedGaps.filter((g) => g.priority === 'high').length,
491
- gaps: detailedGaps,
492
- },
493
- trends: {
494
- lineCoverageTrend: 'stable',
495
- branchCoverageTrend: 'improving',
496
- weeklyChange: 2.5,
497
- },
498
- aiInsights: {
499
- recommendations: [
500
- 'Focus on uncovered branches in authentication module',
501
- 'Add edge case tests for error handling paths',
502
- 'Consider property-based testing for utility functions',
503
- ],
504
- riskAssessment: data.lineCoverage < 70 ? 'high' : data.lineCoverage < 85 ? 'medium' : 'low',
505
- confidence: 0.88,
506
- },
507
- learning,
508
- // V3 fields
509
- taskId: submitResult.value,
510
- lineCoverage: data.lineCoverage,
511
- branchCoverage: data.branchCoverage,
512
- functionCoverage: data.functionCoverage,
513
- statementCoverage: data.statementCoverage || data.lineCoverage,
514
- totalFiles: data.totalFiles || 5,
515
- gaps: detailedGaps,
516
- duration: result.duration,
517
- savedFiles: result.savedFiles,
518
- },
519
- };
520
- }
521
- catch (error) {
522
- return {
523
- success: false,
524
- error: `Failed to analyze coverage: ${error instanceof Error ? error.message : String(error)}`,
525
- };
526
- }
527
- }
528
- export async function handleQualityAssess(params) {
529
- if (!isFleetInitialized()) {
530
- return {
531
- success: false,
532
- error: 'Fleet not initialized. Call fleet_init first.',
533
- };
534
- }
535
- const { queen } = getFleetState();
536
- try {
537
- // ADR-051: Route task to optimal model tier
538
- const routingResult = await routeDomainTask(`Assess quality with ${params.runGate ? 'quality gate' : 'metrics analysis'}`, 'quality-assessment');
539
- const submitResult = await queen.submitTask({
540
- type: 'assess-quality',
541
- priority: 'p0',
542
- targetDomains: ['quality-assessment'],
543
- payload: {
544
- runGate: params.runGate || false,
545
- threshold: params.threshold || 80,
546
- metrics: params.metrics || ['coverage', 'complexity', 'maintainability'],
547
- // ADR-051: Include routing decision
548
- routingTier: routingResult?.decision.tier,
549
- useAgentBooster: routingResult?.useAgentBooster,
550
- },
551
- timeout: 180000,
552
- });
553
- if (!submitResult.success) {
554
- return {
555
- success: false,
556
- error: submitResult.error.message,
557
- };
558
- }
559
- const executor = getTaskExecutor();
560
- const task = queen.getTaskStatus(submitResult.value);
561
- if (!task) {
562
- return {
563
- success: false,
564
- error: 'Task not found after submission',
565
- };
566
- }
567
- const result = await executor.execute(task.task);
568
- if (!result.success) {
569
- return {
570
- success: false,
571
- error: result.error || 'Task execution failed',
572
- };
573
- }
574
- const data = result.data;
575
- return {
576
- success: true,
577
- data: {
578
- taskId: submitResult.value,
579
- status: 'completed',
580
- qualityScore: data.qualityScore,
581
- passed: data.passed,
582
- metrics: data.metrics,
583
- recommendations: data.recommendations,
584
- duration: result.duration,
585
- savedFiles: result.savedFiles,
586
- },
587
- };
588
- }
589
- catch (error) {
590
- return {
591
- success: false,
592
- error: `Failed to assess quality: ${error instanceof Error ? error.message : String(error)}`,
593
- };
594
- }
595
- }
596
- export async function handleSecurityScan(params) {
597
- if (!isFleetInitialized()) {
598
- return {
599
- success: false,
600
- error: 'Fleet not initialized. Call fleet_init first.',
601
- };
602
- }
603
- const { queen } = getFleetState();
604
- try {
605
- const scanTypes = [];
606
- if (params.sast !== false)
607
- scanTypes.push('SAST');
608
- if (params.dast)
609
- scanTypes.push('DAST');
610
- // ADR-051: Route task to optimal model tier
611
- const routingResult = await routeDomainTask(`Security scan (${scanTypes.join(', ')}) for ${params.target || 'project'}`, 'security-compliance');
612
- const submitResult = await queen.submitTask({
613
- type: 'scan-security',
614
- priority: 'p0',
615
- targetDomains: ['security-compliance'],
616
- payload: {
617
- sast: params.sast !== false,
618
- dast: params.dast || false,
619
- compliance: params.compliance || [],
620
- target: params.target || '.',
621
- // ADR-051: Include routing decision
622
- routingTier: routingResult?.decision.tier,
623
- useAgentBooster: routingResult?.useAgentBooster,
624
- },
625
- timeout: 600000,
626
- });
627
- if (!submitResult.success) {
628
- return {
629
- success: false,
630
- error: submitResult.error.message,
631
- };
632
- }
633
- const executor = getTaskExecutor();
634
- const task = queen.getTaskStatus(submitResult.value);
635
- if (!task) {
636
- return {
637
- success: false,
638
- error: 'Task not found after submission',
639
- };
640
- }
641
- const result = await executor.execute(task.task);
642
- if (!result.success) {
643
- return {
644
- success: false,
645
- error: result.error || 'Task execution failed',
646
- };
647
- }
648
- const data = result.data;
649
- return {
650
- success: true,
651
- data: {
652
- taskId: submitResult.value,
653
- status: 'completed',
654
- vulnerabilities: data.vulnerabilities,
655
- critical: data.critical,
656
- high: data.high,
657
- medium: data.medium,
658
- low: data.low,
659
- topVulnerabilities: data.topVulnerabilities,
660
- recommendations: data.recommendations,
661
- duration: result.duration,
662
- savedFiles: result.savedFiles,
663
- },
664
- };
665
- }
666
- catch (error) {
667
- return {
668
- success: false,
669
- error: `Failed to scan security: ${error instanceof Error ? error.message : String(error)}`,
670
- };
671
- }
672
- }
673
- export async function handleContractValidate(params) {
674
- if (!isFleetInitialized()) {
675
- return {
676
- success: false,
677
- error: 'Fleet not initialized. Call fleet_init first.',
678
- };
679
- }
680
- const { queen } = getFleetState();
681
- try {
682
- // ADR-051: Route task to optimal model tier
683
- const routingResult = await routeDomainTask(`Validate API contract at ${params.contractPath}`, 'contract-testing');
684
- const submitResult = await queen.submitTask({
685
- type: 'validate-contracts',
686
- priority: 'p1',
687
- targetDomains: ['contract-testing'],
688
- payload: {
689
- contractPath: params.contractPath,
690
- providerUrl: params.providerUrl,
691
- consumerName: params.consumerName,
692
- checkBreakingChanges: params.checkBreakingChanges !== false,
693
- // ADR-051: Include routing decision
694
- routingTier: routingResult?.decision.tier,
695
- useAgentBooster: routingResult?.useAgentBooster,
696
- },
697
- timeout: 180000,
698
- });
699
- if (!submitResult.success) {
700
- return {
701
- success: false,
702
- error: submitResult.error.message,
703
- };
704
- }
705
- const executor = getTaskExecutor();
706
- const task = queen.getTaskStatus(submitResult.value);
707
- if (!task) {
708
- return {
709
- success: false,
710
- error: 'Task not found after submission',
711
- };
712
- }
713
- const result = await executor.execute(task.task);
714
- if (!result.success) {
715
- return {
716
- success: false,
717
- error: result.error || 'Task execution failed',
718
- };
719
- }
720
- const data = result.data;
721
- return {
722
- success: true,
723
- data: {
724
- taskId: submitResult.value,
725
- status: 'completed',
726
- valid: data.valid,
727
- breakingChanges: data.breakingChanges,
728
- warnings: data.warnings,
729
- duration: result.duration,
730
- },
731
- };
732
- }
733
- catch (error) {
734
- return {
735
- success: false,
736
- error: `Failed to validate contract: ${error instanceof Error ? error.message : String(error)}`,
737
- };
738
- }
739
- }
740
- export async function handleAccessibilityTest(params) {
741
- if (!isFleetInitialized()) {
742
- return {
743
- success: false,
744
- error: 'Fleet not initialized. Call fleet_init first.',
745
- };
746
- }
747
- const { queen } = getFleetState();
748
- try {
749
- // ADR-051: Route task to optimal model tier
750
- const routingResult = await routeDomainTask(`Test accessibility for ${params.url} against ${params.standard || 'WCAG 2.1 AA'} standard`, 'visual-accessibility');
751
- const submitResult = await queen.submitTask({
752
- type: 'test-accessibility',
753
- priority: 'p1',
754
- targetDomains: ['visual-accessibility'],
755
- payload: {
756
- url: params.url,
757
- standard: params.standard || 'wcag21-aa',
758
- includeScreenReader: params.includeScreenReader || false,
759
- // ADR-051: Include routing decision
760
- routingTier: routingResult?.decision.tier,
761
- useAgentBooster: routingResult?.useAgentBooster,
762
- },
763
- timeout: 180000,
764
- });
765
- if (!submitResult.success) {
766
- return {
767
- success: false,
768
- error: submitResult.error.message,
769
- };
770
- }
771
- const executor = getTaskExecutor();
772
- const task = queen.getTaskStatus(submitResult.value);
773
- if (!task) {
774
- return {
775
- success: false,
776
- error: 'Task not found after submission',
777
- };
778
- }
779
- const result = await executor.execute(task.task);
780
- if (!result.success) {
781
- return {
782
- success: false,
783
- error: result.error || 'Task execution failed',
784
- };
785
- }
786
- const data = result.data;
787
- return {
788
- success: true,
789
- data: {
790
- taskId: submitResult.value,
791
- status: 'completed',
792
- passed: data.passed,
793
- score: data.score,
794
- violations: data.violations,
795
- warnings: data.warnings,
796
- duration: result.duration,
797
- },
798
- };
799
- }
800
- catch (error) {
801
- return {
802
- success: false,
803
- error: `Failed to test accessibility: ${error instanceof Error ? error.message : String(error)}`,
804
- };
805
- }
806
- }
807
- export async function handleChaosTest(params) {
808
- if (!isFleetInitialized()) {
809
- return {
810
- success: false,
811
- error: 'Fleet not initialized. Call fleet_init first.',
812
- };
813
- }
814
- const { queen } = getFleetState();
815
- try {
816
- // ADR-051: Route task to optimal model tier
817
- const routingResult = await routeDomainTask(`Run chaos test with ${params.faultType || 'latency'} fault injection on ${params.target}`, 'chaos-resilience');
818
- const submitResult = await queen.submitTask({
819
- type: 'run-chaos',
820
- priority: 'p2',
821
- targetDomains: ['chaos-resilience'],
822
- payload: {
823
- faultType: params.faultType || 'latency',
824
- target: params.target,
825
- duration: params.duration || 30000,
826
- intensity: params.intensity || 50,
827
- dryRun: params.dryRun !== false,
828
- // ADR-051: Include routing decision
829
- routingTier: routingResult?.decision.tier,
830
- useAgentBooster: routingResult?.useAgentBooster,
831
- },
832
- timeout: (params.duration || 30000) + 60000,
833
- });
834
- if (!submitResult.success) {
835
- return {
836
- success: false,
837
- error: submitResult.error.message,
838
- };
839
- }
840
- const executor = getTaskExecutor();
841
- const task = queen.getTaskStatus(submitResult.value);
842
- if (!task) {
843
- return {
844
- success: false,
845
- error: 'Task not found after submission',
846
- };
847
- }
848
- const result = await executor.execute(task.task);
849
- if (!result.success) {
850
- return {
851
- success: false,
852
- error: result.error || 'Task execution failed',
853
- };
854
- }
855
- const data = result.data;
856
- return {
857
- success: true,
858
- data: {
859
- taskId: submitResult.value,
860
- status: 'completed',
861
- faultType: data.faultType,
862
- resilience: data.resilience,
863
- duration: result.duration,
864
- },
865
- };
866
- }
867
- catch (error) {
868
- return {
869
- success: false,
870
- error: `Failed to run chaos test: ${error instanceof Error ? error.message : String(error)}`,
871
- };
872
- }
873
- }
874
- export async function handleDefectPredict(params) {
875
- if (!isFleetInitialized()) {
876
- return {
877
- success: false,
878
- error: 'Fleet not initialized. Call fleet_init first.',
879
- };
880
- }
881
- const { queen } = getFleetState();
882
- try {
883
- // ADR-051: Route task to optimal model tier
884
- const routingResult = await routeDomainTask(`Predict defects in ${params.target || 'codebase'} with ${params.lookback || 30} day lookback`, 'defect-intelligence');
885
- const submitResult = await queen.submitTask({
886
- type: 'predict-defects',
887
- priority: 'p1',
888
- targetDomains: ['defect-intelligence'],
889
- payload: {
890
- target: params.target || '.',
891
- lookback: params.lookback || 30,
892
- minConfidence: params.minConfidence || 0.7,
893
- // ADR-051: Include routing decision
894
- routingTier: routingResult?.decision.tier,
895
- useAgentBooster: routingResult?.useAgentBooster,
896
- },
897
- timeout: 180000,
898
- });
899
- if (!submitResult.success) {
900
- return {
901
- success: false,
902
- error: submitResult.error.message,
903
- };
904
- }
905
- const executor = getTaskExecutor();
906
- const task = queen.getTaskStatus(submitResult.value);
907
- if (!task) {
908
- return {
909
- success: false,
910
- error: 'Task not found after submission',
911
- };
912
- }
913
- const result = await executor.execute(task.task);
914
- if (!result.success) {
915
- return {
916
- success: false,
917
- error: result.error || 'Task execution failed',
918
- };
919
- }
920
- const data = result.data;
921
- return {
922
- success: true,
923
- data: {
924
- taskId: submitResult.value,
925
- status: 'completed',
926
- predictedDefects: data.predictedDefects,
927
- riskScore: data.riskScore,
928
- recommendations: data.recommendations,
929
- duration: result.duration,
930
- },
931
- };
932
- }
933
- catch (error) {
934
- return {
935
- success: false,
936
- error: `Failed to predict defects: ${error instanceof Error ? error.message : String(error)}`,
937
- };
938
- }
939
- }
940
- export async function handleRequirementsValidate(params) {
941
- if (!isFleetInitialized()) {
942
- return {
943
- success: false,
944
- error: 'Fleet not initialized. Call fleet_init first.',
945
- };
946
- }
947
- const { queen } = getFleetState();
948
- try {
949
- // ADR-051: Route task to optimal model tier
950
- const routingResult = await routeDomainTask(`Validate requirements${params.generateBDD ? ' and generate BDD scenarios' : ''}`, 'requirements-validation');
951
- const submitResult = await queen.submitTask({
952
- type: 'validate-requirements',
953
- priority: 'p1',
954
- targetDomains: ['requirements-validation'],
955
- payload: {
956
- requirementsPath: params.requirementsPath,
957
- testPath: params.testPath,
958
- generateBDD: params.generateBDD || false,
959
- // ADR-051: Include routing decision
960
- routingTier: routingResult?.decision.tier,
961
- useAgentBooster: routingResult?.useAgentBooster,
962
- },
963
- timeout: 180000,
964
- });
965
- if (!submitResult.success) {
966
- return {
967
- success: false,
968
- error: submitResult.error.message,
969
- };
970
- }
971
- const executor = getTaskExecutor();
972
- const task = queen.getTaskStatus(submitResult.value);
973
- if (!task) {
974
- return {
975
- success: false,
976
- error: 'Task not found after submission',
977
- };
978
- }
979
- const result = await executor.execute(task.task);
980
- if (!result.success) {
981
- return {
982
- success: false,
983
- error: result.error || 'Task execution failed',
984
- };
985
- }
986
- const data = result.data;
987
- return {
988
- success: true,
989
- data: {
990
- taskId: submitResult.value,
991
- status: 'completed',
992
- requirementsAnalyzed: data.requirementsAnalyzed,
993
- testable: data.testable,
994
- coverage: data.coverage,
995
- bddScenarios: data.bddScenarios,
996
- duration: result.duration,
997
- },
998
- };
999
- }
1000
- catch (error) {
1001
- return {
1002
- success: false,
1003
- error: `Failed to validate requirements: ${error instanceof Error ? error.message : String(error)}`,
1004
- };
1005
- }
174
+ /**
175
+ * Registry of all domain handlers for dynamic dispatch
176
+ */
177
+ export const domainHandlers = {
178
+ 'test-generation': handleTestGenerate,
179
+ 'test-execution': handleTestExecute,
180
+ 'coverage-analysis': handleCoverageAnalyze,
181
+ 'quality-assessment': handleQualityAssess,
182
+ 'security-compliance': handleSecurityScan,
183
+ 'contract-testing': handleContractValidate,
184
+ 'visual-accessibility': handleAccessibilityTest,
185
+ 'chaos-resilience': handleChaosTest,
186
+ 'defect-intelligence': handleDefectPredict,
187
+ 'requirements-validation': handleRequirementsValidate,
188
+ 'code-intelligence': handleCodeIndex,
189
+ };
190
+ /**
191
+ * Get a handler by domain name
192
+ */
193
+ export function getHandlerByDomain(domain) {
194
+ return domainHandlers[domain];
1006
195
  }
1007
- export async function handleCodeIndex(params) {
1008
- if (!isFleetInitialized()) {
1009
- return {
1010
- success: false,
1011
- error: 'Fleet not initialized. Call fleet_init first.',
1012
- };
1013
- }
1014
- const { queen } = getFleetState();
1015
- try {
1016
- // ADR-051: Route task to optimal model tier
1017
- const routingResult = await routeDomainTask(`Index code in ${params.target || 'codebase'}${params.incremental ? ' incrementally' : ''}`, 'code-intelligence');
1018
- const submitResult = await queen.submitTask({
1019
- type: 'index-code',
1020
- priority: 'p2',
1021
- targetDomains: ['code-intelligence'],
1022
- payload: {
1023
- target: params.target || '.',
1024
- incremental: params.incremental || false,
1025
- gitSince: params.gitSince,
1026
- // ADR-051: Include routing decision
1027
- routingTier: routingResult?.decision.tier,
1028
- useAgentBooster: routingResult?.useAgentBooster,
1029
- },
1030
- timeout: 300000,
1031
- });
1032
- if (!submitResult.success) {
1033
- return {
1034
- success: false,
1035
- error: submitResult.error.message,
1036
- };
1037
- }
1038
- const executor = getTaskExecutor();
1039
- const task = queen.getTaskStatus(submitResult.value);
1040
- if (!task) {
1041
- return {
1042
- success: false,
1043
- error: 'Task not found after submission',
1044
- };
1045
- }
1046
- const result = await executor.execute(task.task);
1047
- if (!result.success) {
1048
- return {
1049
- success: false,
1050
- error: result.error || 'Task execution failed',
1051
- };
1052
- }
1053
- const data = result.data;
1054
- return {
1055
- success: true,
1056
- data: {
1057
- taskId: submitResult.value,
1058
- status: 'completed',
1059
- filesIndexed: data.filesIndexed,
1060
- symbolsExtracted: data.symbolsExtracted,
1061
- relationsFound: data.relationsFound,
1062
- duration: result.duration,
1063
- },
1064
- };
1065
- }
1066
- catch (error) {
1067
- return {
1068
- success: false,
1069
- error: `Failed to index code: ${error instanceof Error ? error.message : String(error)}`,
1070
- };
1071
- }
196
+ /**
197
+ * Check if a domain has a registered handler
198
+ */
199
+ export function hasHandler(domain) {
200
+ return domain in domainHandlers;
1072
201
  }
1073
202
  //# sourceMappingURL=domain-handlers.js.map