agentic-qe 3.2.3 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/v3/qe-accessibility-auditor.md +90 -0
- package/README.md +43 -5
- package/package.json +3 -2
- package/scripts/cloud-db-config.json +37 -0
- package/scripts/cloud-db-connect.sh +37 -0
- package/scripts/cloud-db-tunnel.sh +23 -0
- package/v3/CHANGELOG.md +165 -0
- package/v3/README.md +59 -1
- package/v3/assets/agents/v3/qe-accessibility-auditor.md +90 -0
- package/v3/dist/adapters/claude-flow/index.d.ts +54 -0
- package/v3/dist/adapters/claude-flow/index.d.ts.map +1 -0
- package/v3/dist/adapters/claude-flow/index.js +79 -0
- package/v3/dist/adapters/claude-flow/index.js.map +1 -0
- package/v3/dist/adapters/claude-flow/model-router-bridge.d.ts +70 -0
- package/v3/dist/adapters/claude-flow/model-router-bridge.d.ts.map +1 -0
- package/v3/dist/adapters/claude-flow/model-router-bridge.js +203 -0
- package/v3/dist/adapters/claude-flow/model-router-bridge.js.map +1 -0
- package/v3/dist/adapters/claude-flow/pretrain-bridge.d.ts +73 -0
- package/v3/dist/adapters/claude-flow/pretrain-bridge.d.ts.map +1 -0
- package/v3/dist/adapters/claude-flow/pretrain-bridge.js +276 -0
- package/v3/dist/adapters/claude-flow/pretrain-bridge.js.map +1 -0
- package/v3/dist/adapters/claude-flow/trajectory-bridge.d.ts +70 -0
- package/v3/dist/adapters/claude-flow/trajectory-bridge.d.ts.map +1 -0
- package/v3/dist/adapters/claude-flow/trajectory-bridge.js +205 -0
- package/v3/dist/adapters/claude-flow/trajectory-bridge.js.map +1 -0
- package/v3/dist/adapters/claude-flow/types.d.ts +99 -0
- package/v3/dist/adapters/claude-flow/types.d.ts.map +1 -0
- package/v3/dist/adapters/claude-flow/types.js +6 -0
- package/v3/dist/adapters/claude-flow/types.js.map +1 -0
- package/v3/dist/causal-discovery/causal-graph.d.ts +80 -1
- package/v3/dist/causal-discovery/causal-graph.d.ts.map +1 -1
- package/v3/dist/causal-discovery/causal-graph.js +111 -1
- package/v3/dist/causal-discovery/causal-graph.js.map +1 -1
- package/v3/dist/cli/bundle.js +11612 -4929
- package/v3/dist/cli/commands/claude-flow-setup.d.ts +82 -0
- package/v3/dist/cli/commands/claude-flow-setup.d.ts.map +1 -0
- package/v3/dist/cli/commands/claude-flow-setup.js +334 -0
- package/v3/dist/cli/commands/claude-flow-setup.js.map +1 -0
- package/v3/dist/cli/commands/hooks.d.ts +2 -0
- package/v3/dist/cli/commands/hooks.d.ts.map +1 -1
- package/v3/dist/cli/commands/hooks.js +13 -2
- package/v3/dist/cli/commands/hooks.js.map +1 -1
- package/v3/dist/cli/commands/init.d.ts +19 -0
- package/v3/dist/cli/commands/init.d.ts.map +1 -0
- package/v3/dist/cli/commands/init.js +345 -0
- package/v3/dist/cli/commands/init.js.map +1 -0
- package/v3/dist/cli/index.js +110 -2
- package/v3/dist/cli/index.js.map +1 -1
- package/v3/dist/coordination/mincut/interfaces.d.ts +8 -2
- package/v3/dist/coordination/mincut/interfaces.d.ts.map +1 -1
- package/v3/dist/coordination/mincut/interfaces.js.map +1 -1
- package/v3/dist/coordination/mincut/mincut-health-monitor.d.ts +5 -0
- package/v3/dist/coordination/mincut/mincut-health-monitor.d.ts.map +1 -1
- package/v3/dist/coordination/mincut/mincut-health-monitor.js +22 -4
- package/v3/dist/coordination/mincut/mincut-health-monitor.js.map +1 -1
- package/v3/dist/coordination/mincut/queen-integration.d.ts +4 -0
- package/v3/dist/coordination/mincut/queen-integration.d.ts.map +1 -1
- package/v3/dist/coordination/mincut/queen-integration.js +14 -1
- package/v3/dist/coordination/mincut/queen-integration.js.map +1 -1
- package/v3/dist/coordination/queen-coordinator.d.ts +5 -0
- package/v3/dist/coordination/queen-coordinator.d.ts.map +1 -1
- package/v3/dist/coordination/queen-coordinator.js +45 -7
- package/v3/dist/coordination/queen-coordinator.js.map +1 -1
- package/v3/dist/domains/learning-optimization/coordinator.d.ts +5 -0
- package/v3/dist/domains/learning-optimization/coordinator.d.ts.map +1 -1
- package/v3/dist/domains/learning-optimization/coordinator.js +79 -0
- package/v3/dist/domains/learning-optimization/coordinator.js.map +1 -1
- package/v3/dist/domains/test-generation/coherence-gate.d.ts +245 -0
- package/v3/dist/domains/test-generation/coherence-gate.d.ts.map +1 -0
- package/v3/dist/domains/test-generation/coherence-gate.js +454 -0
- package/v3/dist/domains/test-generation/coherence-gate.js.map +1 -0
- package/v3/dist/domains/test-generation/coordinator.d.ts +32 -1
- package/v3/dist/domains/test-generation/coordinator.d.ts.map +1 -1
- package/v3/dist/domains/test-generation/coordinator.js +70 -1
- package/v3/dist/domains/test-generation/coordinator.js.map +1 -1
- package/v3/dist/domains/test-generation/index.d.ts +1 -0
- package/v3/dist/domains/test-generation/index.d.ts.map +1 -1
- package/v3/dist/domains/test-generation/index.js +4 -0
- package/v3/dist/domains/test-generation/index.js.map +1 -1
- package/v3/dist/domains/test-generation/services/index.d.ts +1 -0
- package/v3/dist/domains/test-generation/services/index.d.ts.map +1 -1
- package/v3/dist/domains/test-generation/services/index.js +2 -0
- package/v3/dist/domains/test-generation/services/index.js.map +1 -1
- package/v3/dist/domains/visual-accessibility/index.d.ts +2 -1
- package/v3/dist/domains/visual-accessibility/index.d.ts.map +1 -1
- package/v3/dist/domains/visual-accessibility/index.js +1 -0
- package/v3/dist/domains/visual-accessibility/index.js.map +1 -1
- package/v3/dist/domains/visual-accessibility/interfaces.d.ts +131 -0
- package/v3/dist/domains/visual-accessibility/interfaces.d.ts.map +1 -1
- package/v3/dist/domains/visual-accessibility/plugin.d.ts +26 -0
- package/v3/dist/domains/visual-accessibility/plugin.d.ts.map +1 -1
- package/v3/dist/domains/visual-accessibility/plugin.js +151 -0
- package/v3/dist/domains/visual-accessibility/plugin.js.map +1 -1
- package/v3/dist/domains/visual-accessibility/services/accessibility-tester.d.ts +42 -1
- package/v3/dist/domains/visual-accessibility/services/accessibility-tester.d.ts.map +1 -1
- package/v3/dist/domains/visual-accessibility/services/accessibility-tester.js +69 -0
- package/v3/dist/domains/visual-accessibility/services/accessibility-tester.js.map +1 -1
- package/v3/dist/domains/visual-accessibility/services/eu-compliance.d.ts +138 -0
- package/v3/dist/domains/visual-accessibility/services/eu-compliance.d.ts.map +1 -0
- package/v3/dist/domains/visual-accessibility/services/eu-compliance.js +830 -0
- package/v3/dist/domains/visual-accessibility/services/eu-compliance.js.map +1 -0
- package/v3/dist/domains/visual-accessibility/services/index.d.ts +1 -0
- package/v3/dist/domains/visual-accessibility/services/index.d.ts.map +1 -1
- package/v3/dist/domains/visual-accessibility/services/index.js +1 -0
- package/v3/dist/domains/visual-accessibility/services/index.js.map +1 -1
- package/v3/dist/init/enhancements/claude-flow-adapter.d.ts +84 -0
- package/v3/dist/init/enhancements/claude-flow-adapter.d.ts.map +1 -0
- package/v3/dist/init/enhancements/claude-flow-adapter.js +250 -0
- package/v3/dist/init/enhancements/claude-flow-adapter.js.map +1 -0
- package/v3/dist/init/enhancements/detector.d.ts +10 -0
- package/v3/dist/init/enhancements/detector.d.ts.map +1 -0
- package/v3/dist/init/enhancements/detector.js +87 -0
- package/v3/dist/init/enhancements/detector.js.map +1 -0
- package/v3/dist/init/enhancements/index.d.ts +13 -0
- package/v3/dist/init/enhancements/index.d.ts.map +1 -0
- package/v3/dist/init/enhancements/index.js +25 -0
- package/v3/dist/init/enhancements/index.js.map +1 -0
- package/v3/dist/init/enhancements/types.d.ts +93 -0
- package/v3/dist/init/enhancements/types.d.ts.map +1 -0
- package/v3/dist/init/enhancements/types.js +6 -0
- package/v3/dist/init/enhancements/types.js.map +1 -0
- package/v3/dist/init/index.d.ts +8 -0
- package/v3/dist/init/index.d.ts.map +1 -1
- package/v3/dist/init/index.js +4 -0
- package/v3/dist/init/index.js.map +1 -1
- package/v3/dist/init/migration/config-migrator.d.ts +31 -0
- package/v3/dist/init/migration/config-migrator.d.ts.map +1 -0
- package/v3/dist/init/migration/config-migrator.js +133 -0
- package/v3/dist/init/migration/config-migrator.js.map +1 -0
- package/v3/dist/init/migration/data-migrator.d.ts +72 -0
- package/v3/dist/init/migration/data-migrator.d.ts.map +1 -0
- package/v3/dist/init/migration/data-migrator.js +233 -0
- package/v3/dist/init/migration/data-migrator.js.map +1 -0
- package/v3/dist/init/migration/detector.d.ts +44 -0
- package/v3/dist/init/migration/detector.d.ts.map +1 -0
- package/v3/dist/init/migration/detector.js +106 -0
- package/v3/dist/init/migration/detector.js.map +1 -0
- package/v3/dist/init/migration/index.d.ts +8 -0
- package/v3/dist/init/migration/index.d.ts.map +1 -0
- package/v3/dist/init/migration/index.js +8 -0
- package/v3/dist/init/migration/index.js.map +1 -0
- package/v3/dist/init/orchestrator.d.ts +68 -0
- package/v3/dist/init/orchestrator.d.ts.map +1 -0
- package/v3/dist/init/orchestrator.js +239 -0
- package/v3/dist/init/orchestrator.js.map +1 -0
- package/v3/dist/init/phases/01-detection.d.ts +30 -0
- package/v3/dist/init/phases/01-detection.d.ts.map +1 -0
- package/v3/dist/init/phases/01-detection.js +143 -0
- package/v3/dist/init/phases/01-detection.js.map +1 -0
- package/v3/dist/init/phases/02-analysis.d.ts +18 -0
- package/v3/dist/init/phases/02-analysis.d.ts.map +1 -0
- package/v3/dist/init/phases/02-analysis.js +28 -0
- package/v3/dist/init/phases/02-analysis.js.map +1 -0
- package/v3/dist/init/phases/03-configuration.d.ts +26 -0
- package/v3/dist/init/phases/03-configuration.d.ts.map +1 -0
- package/v3/dist/init/phases/03-configuration.js +98 -0
- package/v3/dist/init/phases/03-configuration.js.map +1 -0
- package/v3/dist/init/phases/04-database.d.ts +22 -0
- package/v3/dist/init/phases/04-database.d.ts.map +1 -0
- package/v3/dist/init/phases/04-database.js +88 -0
- package/v3/dist/init/phases/04-database.js.map +1 -0
- package/v3/dist/init/phases/05-learning.d.ts +28 -0
- package/v3/dist/init/phases/05-learning.d.ts.map +1 -0
- package/v3/dist/init/phases/05-learning.js +98 -0
- package/v3/dist/init/phases/05-learning.js.map +1 -0
- package/v3/dist/init/phases/06-code-intelligence.d.ts +33 -0
- package/v3/dist/init/phases/06-code-intelligence.d.ts.map +1 -0
- package/v3/dist/init/phases/06-code-intelligence.js +115 -0
- package/v3/dist/init/phases/06-code-intelligence.js.map +1 -0
- package/v3/dist/init/phases/07-hooks.d.ts +27 -0
- package/v3/dist/init/phases/07-hooks.d.ts.map +1 -0
- package/v3/dist/init/phases/07-hooks.js +209 -0
- package/v3/dist/init/phases/07-hooks.js.map +1 -0
- package/v3/dist/init/phases/08-mcp.d.ts +22 -0
- package/v3/dist/init/phases/08-mcp.d.ts.map +1 -0
- package/v3/dist/init/phases/08-mcp.js +62 -0
- package/v3/dist/init/phases/08-mcp.js.map +1 -0
- package/v3/dist/init/phases/09-assets.d.ts +23 -0
- package/v3/dist/init/phases/09-assets.d.ts.map +1 -0
- package/v3/dist/init/phases/09-assets.js +82 -0
- package/v3/dist/init/phases/09-assets.js.map +1 -0
- package/v3/dist/init/phases/10-workers.d.ts +23 -0
- package/v3/dist/init/phases/10-workers.d.ts.map +1 -0
- package/v3/dist/init/phases/10-workers.js +111 -0
- package/v3/dist/init/phases/10-workers.js.map +1 -0
- package/v3/dist/init/phases/11-claude-md.d.ts +26 -0
- package/v3/dist/init/phases/11-claude-md.d.ts.map +1 -0
- package/v3/dist/init/phases/11-claude-md.js +121 -0
- package/v3/dist/init/phases/11-claude-md.js.map +1 -0
- package/v3/dist/init/phases/12-verification.d.ts +38 -0
- package/v3/dist/init/phases/12-verification.d.ts.map +1 -0
- package/v3/dist/init/phases/12-verification.js +187 -0
- package/v3/dist/init/phases/12-verification.js.map +1 -0
- package/v3/dist/init/phases/index.d.ts +46 -0
- package/v3/dist/init/phases/index.d.ts.map +1 -0
- package/v3/dist/init/phases/index.js +64 -0
- package/v3/dist/init/phases/index.js.map +1 -0
- package/v3/dist/init/phases/phase-interface.d.ts +193 -0
- package/v3/dist/init/phases/phase-interface.d.ts.map +1 -0
- package/v3/dist/init/phases/phase-interface.js +119 -0
- package/v3/dist/init/phases/phase-interface.js.map +1 -0
- package/v3/dist/integrations/coherence/coherence-service.d.ts +323 -0
- package/v3/dist/integrations/coherence/coherence-service.d.ts.map +1 -0
- package/v3/dist/integrations/coherence/coherence-service.js +799 -0
- package/v3/dist/integrations/coherence/coherence-service.js.map +1 -0
- package/v3/dist/integrations/coherence/engines/category-adapter.d.ts +170 -0
- package/v3/dist/integrations/coherence/engines/category-adapter.d.ts.map +1 -0
- package/v3/dist/integrations/coherence/engines/category-adapter.js +403 -0
- package/v3/dist/integrations/coherence/engines/category-adapter.js.map +1 -0
- package/v3/dist/integrations/coherence/engines/causal-adapter.d.ts +159 -0
- package/v3/dist/integrations/coherence/engines/causal-adapter.d.ts.map +1 -0
- package/v3/dist/integrations/coherence/engines/causal-adapter.js +348 -0
- package/v3/dist/integrations/coherence/engines/causal-adapter.js.map +1 -0
- package/v3/dist/integrations/coherence/engines/cohomology-adapter.d.ts +174 -0
- package/v3/dist/integrations/coherence/engines/cohomology-adapter.d.ts.map +1 -0
- package/v3/dist/integrations/coherence/engines/cohomology-adapter.js +401 -0
- package/v3/dist/integrations/coherence/engines/cohomology-adapter.js.map +1 -0
- package/v3/dist/integrations/coherence/engines/homotopy-adapter.d.ts +201 -0
- package/v3/dist/integrations/coherence/engines/homotopy-adapter.d.ts.map +1 -0
- package/v3/dist/integrations/coherence/engines/homotopy-adapter.js +324 -0
- package/v3/dist/integrations/coherence/engines/homotopy-adapter.js.map +1 -0
- package/v3/dist/integrations/coherence/engines/index.d.ts +20 -0
- package/v3/dist/integrations/coherence/engines/index.d.ts.map +1 -0
- package/v3/dist/integrations/coherence/engines/index.js +26 -0
- package/v3/dist/integrations/coherence/engines/index.js.map +1 -0
- package/v3/dist/integrations/coherence/engines/spectral-adapter.d.ts +193 -0
- package/v3/dist/integrations/coherence/engines/spectral-adapter.d.ts.map +1 -0
- package/v3/dist/integrations/coherence/engines/spectral-adapter.js +476 -0
- package/v3/dist/integrations/coherence/engines/spectral-adapter.js.map +1 -0
- package/v3/dist/integrations/coherence/engines/witness-adapter.d.ts +175 -0
- package/v3/dist/integrations/coherence/engines/witness-adapter.d.ts.map +1 -0
- package/v3/dist/integrations/coherence/engines/witness-adapter.js +377 -0
- package/v3/dist/integrations/coherence/engines/witness-adapter.js.map +1 -0
- package/v3/dist/integrations/coherence/index.d.ts +84 -0
- package/v3/dist/integrations/coherence/index.d.ts.map +1 -0
- package/v3/dist/integrations/coherence/index.js +114 -0
- package/v3/dist/integrations/coherence/index.js.map +1 -0
- package/v3/dist/integrations/coherence/threshold-tuner.d.ts +396 -0
- package/v3/dist/integrations/coherence/threshold-tuner.d.ts.map +1 -0
- package/v3/dist/integrations/coherence/threshold-tuner.js +538 -0
- package/v3/dist/integrations/coherence/threshold-tuner.js.map +1 -0
- package/v3/dist/integrations/coherence/types.d.ts +879 -0
- package/v3/dist/integrations/coherence/types.d.ts.map +1 -0
- package/v3/dist/integrations/coherence/types.js +134 -0
- package/v3/dist/integrations/coherence/types.js.map +1 -0
- package/v3/dist/integrations/coherence/wasm-loader.d.ts +351 -0
- package/v3/dist/integrations/coherence/wasm-loader.d.ts.map +1 -0
- package/v3/dist/integrations/coherence/wasm-loader.js +842 -0
- package/v3/dist/integrations/coherence/wasm-loader.js.map +1 -0
- package/v3/dist/integrations/embeddings/index/HNSWIndex.d.ts.map +1 -1
- package/v3/dist/integrations/embeddings/index/HNSWIndex.js +4 -1
- package/v3/dist/integrations/embeddings/index/HNSWIndex.js.map +1 -1
- package/v3/dist/kernel/interfaces.d.ts +8 -1
- package/v3/dist/kernel/interfaces.d.ts.map +1 -1
- package/v3/dist/learning/aqe-learning-engine.d.ts +272 -0
- package/v3/dist/learning/aqe-learning-engine.d.ts.map +1 -0
- package/v3/dist/learning/aqe-learning-engine.js +708 -0
- package/v3/dist/learning/aqe-learning-engine.js.map +1 -0
- package/v3/dist/learning/causal-verifier.d.ts +244 -0
- package/v3/dist/learning/causal-verifier.d.ts.map +1 -0
- package/v3/dist/learning/causal-verifier.js +300 -0
- package/v3/dist/learning/causal-verifier.js.map +1 -0
- package/v3/dist/learning/experience-capture.d.ts +266 -0
- package/v3/dist/learning/experience-capture.d.ts.map +1 -0
- package/v3/dist/learning/experience-capture.js +647 -0
- package/v3/dist/learning/experience-capture.js.map +1 -0
- package/v3/dist/learning/index.d.ts +8 -0
- package/v3/dist/learning/index.d.ts.map +1 -1
- package/v3/dist/learning/index.js +16 -0
- package/v3/dist/learning/index.js.map +1 -1
- package/v3/dist/learning/memory-auditor.d.ts +235 -0
- package/v3/dist/learning/memory-auditor.d.ts.map +1 -0
- package/v3/dist/learning/memory-auditor.js +478 -0
- package/v3/dist/learning/memory-auditor.js.map +1 -0
- package/v3/dist/learning/pattern-store.d.ts.map +1 -1
- package/v3/dist/learning/pattern-store.js +27 -6
- package/v3/dist/learning/pattern-store.js.map +1 -1
- package/v3/dist/learning/qe-patterns.d.ts +15 -1
- package/v3/dist/learning/qe-patterns.d.ts.map +1 -1
- package/v3/dist/learning/qe-patterns.js +26 -5
- package/v3/dist/learning/qe-patterns.js.map +1 -1
- package/v3/dist/learning/qe-reasoning-bank.d.ts +38 -2
- package/v3/dist/learning/qe-reasoning-bank.d.ts.map +1 -1
- package/v3/dist/learning/qe-reasoning-bank.js +86 -4
- package/v3/dist/learning/qe-reasoning-bank.js.map +1 -1
- package/v3/dist/learning/real-qe-reasoning-bank.d.ts +32 -2
- package/v3/dist/learning/real-qe-reasoning-bank.d.ts.map +1 -1
- package/v3/dist/learning/real-qe-reasoning-bank.js +61 -6
- package/v3/dist/learning/real-qe-reasoning-bank.js.map +1 -1
- package/v3/dist/mcp/bundle.js +6303 -266
- package/v3/dist/mcp/tools/coherence/audit.d.ts +107 -0
- package/v3/dist/mcp/tools/coherence/audit.d.ts.map +1 -0
- package/v3/dist/mcp/tools/coherence/audit.js +236 -0
- package/v3/dist/mcp/tools/coherence/audit.js.map +1 -0
- package/v3/dist/mcp/tools/coherence/check.d.ts +106 -0
- package/v3/dist/mcp/tools/coherence/check.d.ts.map +1 -0
- package/v3/dist/mcp/tools/coherence/check.js +205 -0
- package/v3/dist/mcp/tools/coherence/check.js.map +1 -0
- package/v3/dist/mcp/tools/coherence/collapse.d.ts +123 -0
- package/v3/dist/mcp/tools/coherence/collapse.d.ts.map +1 -0
- package/v3/dist/mcp/tools/coherence/collapse.js +279 -0
- package/v3/dist/mcp/tools/coherence/collapse.js.map +1 -0
- package/v3/dist/mcp/tools/coherence/consensus.d.ts +100 -0
- package/v3/dist/mcp/tools/coherence/consensus.d.ts.map +1 -0
- package/v3/dist/mcp/tools/coherence/consensus.js +201 -0
- package/v3/dist/mcp/tools/coherence/consensus.js.map +1 -0
- package/v3/dist/mcp/tools/coherence/index.d.ts +31 -0
- package/v3/dist/mcp/tools/coherence/index.d.ts.map +1 -0
- package/v3/dist/mcp/tools/coherence/index.js +42 -0
- package/v3/dist/mcp/tools/coherence/index.js.map +1 -0
- package/v3/dist/mcp/tools/index.d.ts +6 -1
- package/v3/dist/mcp/tools/index.d.ts.map +1 -1
- package/v3/dist/mcp/tools/index.js +9 -1
- package/v3/dist/mcp/tools/index.js.map +1 -1
- package/v3/dist/mcp/tools/mincut/index.d.ts +1 -1
- package/v3/dist/mcp/tools/mincut/index.d.ts.map +1 -1
- package/v3/dist/mcp/tools/mincut/index.js.map +1 -1
- package/v3/dist/mcp/tools/registry.d.ts +4 -0
- package/v3/dist/mcp/tools/registry.d.ts.map +1 -1
- package/v3/dist/mcp/tools/registry.js +5 -0
- package/v3/dist/mcp/tools/registry.js.map +1 -1
- package/v3/dist/mcp/types.d.ts +1 -1
- package/v3/dist/mcp/types.d.ts.map +1 -1
- package/v3/dist/strange-loop/belief-reconciler.d.ts +357 -0
- package/v3/dist/strange-loop/belief-reconciler.d.ts.map +1 -0
- package/v3/dist/strange-loop/belief-reconciler.js +696 -0
- package/v3/dist/strange-loop/belief-reconciler.js.map +1 -0
- package/v3/dist/strange-loop/index.d.ts +1 -0
- package/v3/dist/strange-loop/index.d.ts.map +1 -1
- package/v3/dist/strange-loop/index.js +2 -0
- package/v3/dist/strange-loop/index.js.map +1 -1
- package/v3/dist/strange-loop/strange-loop.d.ts +177 -5
- package/v3/dist/strange-loop/strange-loop.d.ts.map +1 -1
- package/v3/dist/strange-loop/strange-loop.js +452 -9
- package/v3/dist/strange-loop/strange-loop.js.map +1 -1
- package/v3/dist/strange-loop/types.d.ts +205 -1
- package/v3/dist/strange-loop/types.d.ts.map +1 -1
- package/v3/dist/strange-loop/types.js +5 -0
- package/v3/dist/strange-loop/types.js.map +1 -1
- package/v3/package.json +5 -1
|
@@ -0,0 +1,708 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AQE Learning Engine
|
|
3
|
+
* Unified learning engine with graceful degradation
|
|
4
|
+
*
|
|
5
|
+
* This is the main entry point for AQE's learning capabilities.
|
|
6
|
+
* It works standalone and optionally integrates with Claude Flow
|
|
7
|
+
* for enhanced learning features.
|
|
8
|
+
*
|
|
9
|
+
* Features:
|
|
10
|
+
* - Pattern storage and retrieval (standalone)
|
|
11
|
+
* - HNSW vector search (standalone)
|
|
12
|
+
* - Task routing to agents (standalone)
|
|
13
|
+
* - SONA trajectory tracking (when Claude Flow available)
|
|
14
|
+
* - 3-tier model routing (when Claude Flow available)
|
|
15
|
+
* - Codebase pretrain analysis (when Claude Flow available)
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // Create engine (works standalone)
|
|
20
|
+
* const engine = createAQELearningEngine({
|
|
21
|
+
* projectRoot: process.cwd(),
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* // Initialize (auto-detects Claude Flow)
|
|
25
|
+
* await engine.initialize();
|
|
26
|
+
*
|
|
27
|
+
* // Use learning features
|
|
28
|
+
* const routing = await engine.routeTask('Generate unit tests for UserService');
|
|
29
|
+
*
|
|
30
|
+
* // Track task execution (uses SONA if available)
|
|
31
|
+
* const taskId = await engine.startTask('test-generation', 'qe-test-architect');
|
|
32
|
+
* await engine.recordStep(taskId, 'analyzed-code', 'Found 5 methods');
|
|
33
|
+
* await engine.endTask(taskId, true);
|
|
34
|
+
*
|
|
35
|
+
* // Get model recommendation (uses CF router if available)
|
|
36
|
+
* const model = await engine.recommendModel('complex security audit');
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
import { err } from '../shared/types/index.js';
|
|
40
|
+
import { createQEReasoningBank, } from './qe-reasoning-bank.js';
|
|
41
|
+
import { createClaudeFlowBridge, } from '../adapters/claude-flow/index.js';
|
|
42
|
+
import { createExperienceCaptureService, } from './experience-capture.js';
|
|
43
|
+
import { createPatternStore } from './pattern-store.js';
|
|
44
|
+
import { wasmLoader, createCoherenceService, } from '../integrations/coherence/index.js';
|
|
45
|
+
/**
|
|
46
|
+
* Default configuration
|
|
47
|
+
*/
|
|
48
|
+
export const DEFAULT_ENGINE_CONFIG = {
|
|
49
|
+
enableClaudeFlow: true,
|
|
50
|
+
enableExperienceCapture: true,
|
|
51
|
+
enablePatternPromotion: true,
|
|
52
|
+
promotionThreshold: 3,
|
|
53
|
+
};
|
|
54
|
+
// ============================================================================
|
|
55
|
+
// AQE Learning Engine
|
|
56
|
+
// ============================================================================
|
|
57
|
+
/**
|
|
58
|
+
* Unified AQE Learning Engine
|
|
59
|
+
*
|
|
60
|
+
* Works standalone with graceful Claude Flow enhancement.
|
|
61
|
+
*/
|
|
62
|
+
export class AQELearningEngine {
|
|
63
|
+
memory;
|
|
64
|
+
eventBus;
|
|
65
|
+
config;
|
|
66
|
+
reasoningBank;
|
|
67
|
+
claudeFlowBridge;
|
|
68
|
+
experienceCapture;
|
|
69
|
+
patternStore;
|
|
70
|
+
coherenceService;
|
|
71
|
+
initialized = false;
|
|
72
|
+
// Task tracking
|
|
73
|
+
activeTasks = new Map();
|
|
74
|
+
completedTasks = 0;
|
|
75
|
+
claudeFlowErrors = 0;
|
|
76
|
+
constructor(memory, config, eventBus) {
|
|
77
|
+
this.memory = memory;
|
|
78
|
+
this.eventBus = eventBus;
|
|
79
|
+
this.config = { ...DEFAULT_ENGINE_CONFIG, ...config };
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Initialize the learning engine
|
|
83
|
+
*/
|
|
84
|
+
async initialize() {
|
|
85
|
+
if (this.initialized)
|
|
86
|
+
return;
|
|
87
|
+
// Initialize CoherenceService (optional - falls back to TypeScript implementation)
|
|
88
|
+
try {
|
|
89
|
+
this.coherenceService = await createCoherenceService(wasmLoader);
|
|
90
|
+
if (this.coherenceService.isInitialized()) {
|
|
91
|
+
console.log('[AQELearningEngine] CoherenceService initialized with WASM engines');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
// WASM not available - coherence service will use fallback
|
|
96
|
+
console.log('[AQELearningEngine] CoherenceService WASM unavailable, using fallback:', error instanceof Error ? error.message : String(error));
|
|
97
|
+
}
|
|
98
|
+
// Initialize PatternStore (always available)
|
|
99
|
+
this.patternStore = createPatternStore(this.memory, {
|
|
100
|
+
promotionThreshold: this.config.promotionThreshold,
|
|
101
|
+
});
|
|
102
|
+
await this.patternStore.initialize();
|
|
103
|
+
// Initialize QEReasoningBank with CoherenceService for filtering
|
|
104
|
+
this.reasoningBank = createQEReasoningBank(this.memory, this.eventBus, this.config.reasoningBank, this.coherenceService // Pass coherence service for coherence-gated retrieval
|
|
105
|
+
);
|
|
106
|
+
await this.reasoningBank.initialize();
|
|
107
|
+
// Initialize ExperienceCaptureService (always available)
|
|
108
|
+
if (this.config.enableExperienceCapture) {
|
|
109
|
+
this.experienceCapture = createExperienceCaptureService(this.memory, this.patternStore, this.eventBus, {
|
|
110
|
+
promotionThreshold: this.config.promotionThreshold,
|
|
111
|
+
});
|
|
112
|
+
await this.experienceCapture.initialize();
|
|
113
|
+
}
|
|
114
|
+
// Try to initialize Claude Flow bridge (optional)
|
|
115
|
+
if (this.config.enableClaudeFlow) {
|
|
116
|
+
try {
|
|
117
|
+
this.claudeFlowBridge = createClaudeFlowBridge({
|
|
118
|
+
projectRoot: this.config.projectRoot,
|
|
119
|
+
});
|
|
120
|
+
await this.claudeFlowBridge.initialize();
|
|
121
|
+
if (this.claudeFlowBridge.isAvailable()) {
|
|
122
|
+
console.log('[AQELearningEngine] Claude Flow integration enabled');
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
// Claude Flow not available - continue without it
|
|
127
|
+
if (process.env.DEBUG) {
|
|
128
|
+
console.log('[AQELearningEngine] Claude Flow not available, using standalone mode:', error instanceof Error ? error.message : String(error));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
this.initialized = true;
|
|
133
|
+
console.log('[AQELearningEngine] Initialized');
|
|
134
|
+
}
|
|
135
|
+
// ==========================================================================
|
|
136
|
+
// Status & Info
|
|
137
|
+
// ==========================================================================
|
|
138
|
+
/**
|
|
139
|
+
* Get engine status
|
|
140
|
+
*/
|
|
141
|
+
getStatus() {
|
|
142
|
+
const cfStatus = this.claudeFlowBridge?.getStatus();
|
|
143
|
+
return {
|
|
144
|
+
initialized: this.initialized,
|
|
145
|
+
claudeFlowAvailable: cfStatus?.available ?? false,
|
|
146
|
+
features: {
|
|
147
|
+
patternLearning: true, // Always available
|
|
148
|
+
vectorSearch: true, // Always available (HNSW or hash fallback)
|
|
149
|
+
taskRouting: true, // Always available
|
|
150
|
+
trajectories: cfStatus?.features.trajectories ?? false,
|
|
151
|
+
modelRouting: cfStatus?.features.modelRouting ?? false,
|
|
152
|
+
pretrain: cfStatus?.features.pretrain ?? false,
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get engine statistics
|
|
158
|
+
*/
|
|
159
|
+
async getStats() {
|
|
160
|
+
if (!this.initialized || !this.reasoningBank) {
|
|
161
|
+
throw new Error('Engine not initialized');
|
|
162
|
+
}
|
|
163
|
+
const rbStats = await this.reasoningBank.getStats();
|
|
164
|
+
const ecStats = this.experienceCapture
|
|
165
|
+
? await this.experienceCapture.getStats()
|
|
166
|
+
: {
|
|
167
|
+
totalExperiences: 0,
|
|
168
|
+
byDomain: {},
|
|
169
|
+
successRate: 0,
|
|
170
|
+
avgQuality: 0,
|
|
171
|
+
patternsExtracted: 0,
|
|
172
|
+
patternsPromoted: 0,
|
|
173
|
+
};
|
|
174
|
+
return {
|
|
175
|
+
...rbStats,
|
|
176
|
+
activeTasks: this.activeTasks.size,
|
|
177
|
+
completedTasks: this.completedTasks,
|
|
178
|
+
claudeFlowStatus: this.claudeFlowBridge?.getStatus() ?? {
|
|
179
|
+
available: false,
|
|
180
|
+
features: {
|
|
181
|
+
trajectories: false,
|
|
182
|
+
modelRouting: false,
|
|
183
|
+
pretrain: false,
|
|
184
|
+
patternSearch: false,
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
claudeFlowErrors: this.claudeFlowErrors,
|
|
188
|
+
experienceCapture: ecStats,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
// ==========================================================================
|
|
192
|
+
// Pattern Learning (Standalone)
|
|
193
|
+
// ==========================================================================
|
|
194
|
+
/**
|
|
195
|
+
* Store a new pattern
|
|
196
|
+
*/
|
|
197
|
+
async storePattern(options) {
|
|
198
|
+
if (!this.initialized || !this.reasoningBank) {
|
|
199
|
+
return err(new Error('Engine not initialized'));
|
|
200
|
+
}
|
|
201
|
+
return this.reasoningBank.storePattern(options);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Search for patterns
|
|
205
|
+
*/
|
|
206
|
+
async searchPatterns(query, options) {
|
|
207
|
+
if (!this.initialized || !this.reasoningBank) {
|
|
208
|
+
return err(new Error('Engine not initialized'));
|
|
209
|
+
}
|
|
210
|
+
return this.reasoningBank.searchPatterns(query, options);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Get pattern by ID
|
|
214
|
+
*/
|
|
215
|
+
async getPattern(id) {
|
|
216
|
+
if (!this.initialized || !this.reasoningBank) {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
return this.reasoningBank.getPattern(id);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Record pattern usage outcome
|
|
223
|
+
*/
|
|
224
|
+
async recordOutcome(outcome) {
|
|
225
|
+
if (!this.initialized || !this.reasoningBank) {
|
|
226
|
+
return err(new Error('Engine not initialized'));
|
|
227
|
+
}
|
|
228
|
+
return this.reasoningBank.recordOutcome(outcome);
|
|
229
|
+
}
|
|
230
|
+
// ==========================================================================
|
|
231
|
+
// Task Routing (Standalone with CF Enhancement)
|
|
232
|
+
// ==========================================================================
|
|
233
|
+
/**
|
|
234
|
+
* Route a task to optimal agent
|
|
235
|
+
*
|
|
236
|
+
* When Claude Flow is available, combines local routing with CF patterns.
|
|
237
|
+
*/
|
|
238
|
+
async routeTask(request) {
|
|
239
|
+
if (!this.initialized || !this.reasoningBank) {
|
|
240
|
+
return err(new Error('Engine not initialized'));
|
|
241
|
+
}
|
|
242
|
+
// Use local routing
|
|
243
|
+
const localResult = await this.reasoningBank.routeTask(request);
|
|
244
|
+
// Enhance with Claude Flow if available
|
|
245
|
+
if (localResult.success &&
|
|
246
|
+
this.claudeFlowBridge?.pretrain.isClaudeFlowAvailable()) {
|
|
247
|
+
// Could enhance with pretrain patterns here
|
|
248
|
+
// For now, just return local result
|
|
249
|
+
}
|
|
250
|
+
return localResult;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Route a task (convenience method)
|
|
254
|
+
*/
|
|
255
|
+
async route(task, context) {
|
|
256
|
+
const result = await this.routeTask({ task, context });
|
|
257
|
+
return result.success ? result.value : null;
|
|
258
|
+
}
|
|
259
|
+
// ==========================================================================
|
|
260
|
+
// Model Routing (CF Enhanced)
|
|
261
|
+
// ==========================================================================
|
|
262
|
+
/**
|
|
263
|
+
* Get recommended model for a task
|
|
264
|
+
*
|
|
265
|
+
* Uses Claude Flow 3-tier routing when available,
|
|
266
|
+
* falls back to rule-based routing.
|
|
267
|
+
*/
|
|
268
|
+
async recommendModel(task) {
|
|
269
|
+
// Try Claude Flow model routing
|
|
270
|
+
if (this.claudeFlowBridge?.modelRouter.isClaudeFlowAvailable()) {
|
|
271
|
+
try {
|
|
272
|
+
return await this.claudeFlowBridge.modelRouter.routeTask(task);
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
// Fall through to local routing
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
// Local rule-based routing (fallback)
|
|
279
|
+
return this.localModelRoute(task);
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Record model routing outcome
|
|
283
|
+
*/
|
|
284
|
+
async recordModelOutcome(task, model, outcome) {
|
|
285
|
+
if (this.claudeFlowBridge?.modelRouter.isClaudeFlowAvailable()) {
|
|
286
|
+
await this.claudeFlowBridge.modelRouter.recordOutcome({ task, model, outcome });
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Local rule-based model routing
|
|
291
|
+
*/
|
|
292
|
+
localModelRoute(task) {
|
|
293
|
+
const taskLower = task.toLowerCase();
|
|
294
|
+
// Low complexity → Haiku
|
|
295
|
+
const lowComplexity = [
|
|
296
|
+
/simple/i, /basic/i, /fix typo/i, /rename/i, /format/i,
|
|
297
|
+
/add comment/i, /lint/i, /minor/i, /quick/i, /small/i,
|
|
298
|
+
];
|
|
299
|
+
for (const pattern of lowComplexity) {
|
|
300
|
+
if (pattern.test(taskLower)) {
|
|
301
|
+
return {
|
|
302
|
+
model: 'haiku',
|
|
303
|
+
confidence: 0.75,
|
|
304
|
+
reasoning: 'Low complexity task - using haiku for speed',
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
// High complexity → Opus
|
|
309
|
+
const highComplexity = [
|
|
310
|
+
/architect/i, /design/i, /complex/i, /security/i, /performance/i,
|
|
311
|
+
/refactor.*large/i, /critical/i, /analysis/i, /multi.*file/i,
|
|
312
|
+
/distributed/i, /concurrent/i, /migration/i,
|
|
313
|
+
];
|
|
314
|
+
for (const pattern of highComplexity) {
|
|
315
|
+
if (pattern.test(taskLower)) {
|
|
316
|
+
return {
|
|
317
|
+
model: 'opus',
|
|
318
|
+
confidence: 0.8,
|
|
319
|
+
reasoning: 'High complexity task - using opus for capability',
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
// Task length heuristic
|
|
324
|
+
if (task.length > 500) {
|
|
325
|
+
return {
|
|
326
|
+
model: 'opus',
|
|
327
|
+
confidence: 0.65,
|
|
328
|
+
reasoning: 'Long task description - using opus for complex reasoning',
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
if (task.length < 50) {
|
|
332
|
+
return {
|
|
333
|
+
model: 'haiku',
|
|
334
|
+
confidence: 0.6,
|
|
335
|
+
reasoning: 'Short task - using haiku for efficiency',
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
// Default → Sonnet
|
|
339
|
+
return {
|
|
340
|
+
model: 'sonnet',
|
|
341
|
+
confidence: 0.7,
|
|
342
|
+
reasoning: 'Medium complexity - using sonnet for balance',
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
// ==========================================================================
|
|
346
|
+
// Task Tracking (CF Enhanced with SONA)
|
|
347
|
+
// ==========================================================================
|
|
348
|
+
/**
|
|
349
|
+
* Start tracking a task execution
|
|
350
|
+
*
|
|
351
|
+
* When Claude Flow is available, creates a SONA trajectory.
|
|
352
|
+
* Also starts experience capture for pattern learning.
|
|
353
|
+
*/
|
|
354
|
+
async startTask(task, agent, domain) {
|
|
355
|
+
const id = `task-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
356
|
+
// Try to start SONA trajectory
|
|
357
|
+
let trajectoryId = id;
|
|
358
|
+
if (this.claudeFlowBridge?.trajectory.isClaudeFlowAvailable()) {
|
|
359
|
+
try {
|
|
360
|
+
trajectoryId = await this.claudeFlowBridge.trajectory.startTrajectory(task, agent);
|
|
361
|
+
}
|
|
362
|
+
catch (error) {
|
|
363
|
+
this.claudeFlowErrors++;
|
|
364
|
+
console.warn(`[AQELearningEngine] Claude Flow startTrajectory failed (${this.claudeFlowErrors} total errors):`, error instanceof Error ? error.message : String(error));
|
|
365
|
+
// Fall through to local tracking
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
// Start experience capture (linked to trajectory if available)
|
|
369
|
+
let experienceId;
|
|
370
|
+
if (this.experienceCapture) {
|
|
371
|
+
experienceId = this.experienceCapture.startCapture(task, {
|
|
372
|
+
agent,
|
|
373
|
+
domain,
|
|
374
|
+
trajectoryId: trajectoryId !== id ? trajectoryId : undefined,
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
// Local tracking
|
|
378
|
+
const execution = {
|
|
379
|
+
id: experienceId || trajectoryId,
|
|
380
|
+
task,
|
|
381
|
+
agent,
|
|
382
|
+
startedAt: Date.now(),
|
|
383
|
+
steps: [],
|
|
384
|
+
};
|
|
385
|
+
this.activeTasks.set(execution.id, execution);
|
|
386
|
+
return execution.id;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Record a step in task execution
|
|
390
|
+
*/
|
|
391
|
+
async recordStep(taskId, action, result, quality) {
|
|
392
|
+
// Try SONA trajectory step
|
|
393
|
+
if (this.claudeFlowBridge?.trajectory.isClaudeFlowAvailable()) {
|
|
394
|
+
try {
|
|
395
|
+
await this.claudeFlowBridge.trajectory.recordStep(taskId, action, result, quality);
|
|
396
|
+
}
|
|
397
|
+
catch (error) {
|
|
398
|
+
this.claudeFlowErrors++;
|
|
399
|
+
console.warn(`[AQELearningEngine] Claude Flow recordStep failed (${this.claudeFlowErrors} total errors):`, error instanceof Error ? error.message : String(error));
|
|
400
|
+
// Continue with local tracking
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
// Record in experience capture
|
|
404
|
+
if (this.experienceCapture) {
|
|
405
|
+
this.experienceCapture.recordStep(taskId, {
|
|
406
|
+
action,
|
|
407
|
+
result,
|
|
408
|
+
quality,
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
// Local tracking
|
|
412
|
+
const execution = this.activeTasks.get(taskId);
|
|
413
|
+
if (execution) {
|
|
414
|
+
execution.steps.push({
|
|
415
|
+
action,
|
|
416
|
+
result,
|
|
417
|
+
quality,
|
|
418
|
+
timestamp: Date.now(),
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* End task tracking
|
|
424
|
+
*/
|
|
425
|
+
async endTask(taskId, success, feedback) {
|
|
426
|
+
// Try to end SONA trajectory
|
|
427
|
+
if (this.claudeFlowBridge?.trajectory.isClaudeFlowAvailable()) {
|
|
428
|
+
try {
|
|
429
|
+
await this.claudeFlowBridge.trajectory.endTrajectory(taskId, success, feedback);
|
|
430
|
+
}
|
|
431
|
+
catch (error) {
|
|
432
|
+
this.claudeFlowErrors++;
|
|
433
|
+
console.warn(`[AQELearningEngine] Claude Flow endTrajectory failed (${this.claudeFlowErrors} total errors):`, error instanceof Error ? error.message : String(error));
|
|
434
|
+
// Continue with local completion
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
// Complete local tracking
|
|
438
|
+
const execution = this.activeTasks.get(taskId);
|
|
439
|
+
if (execution) {
|
|
440
|
+
this.activeTasks.delete(taskId);
|
|
441
|
+
this.completedTasks++;
|
|
442
|
+
// Experience capture for pattern learning
|
|
443
|
+
if (this.config.enableExperienceCapture && success) {
|
|
444
|
+
await this.captureExperience(execution);
|
|
445
|
+
}
|
|
446
|
+
return execution;
|
|
447
|
+
}
|
|
448
|
+
return undefined;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Get active task
|
|
452
|
+
*/
|
|
453
|
+
getTask(taskId) {
|
|
454
|
+
return this.activeTasks.get(taskId);
|
|
455
|
+
}
|
|
456
|
+
// ==========================================================================
|
|
457
|
+
// Codebase Analysis (CF Enhanced)
|
|
458
|
+
// ==========================================================================
|
|
459
|
+
/**
|
|
460
|
+
* Analyze codebase for optimal configuration
|
|
461
|
+
*
|
|
462
|
+
* Uses Claude Flow pretrain when available.
|
|
463
|
+
*/
|
|
464
|
+
async analyzeCodebase(path, depth = 'medium') {
|
|
465
|
+
const targetPath = path || this.config.projectRoot;
|
|
466
|
+
// Try Claude Flow pretrain
|
|
467
|
+
if (this.claudeFlowBridge?.pretrain.isClaudeFlowAvailable()) {
|
|
468
|
+
try {
|
|
469
|
+
return await this.claudeFlowBridge.pretrain.analyze(targetPath, depth);
|
|
470
|
+
}
|
|
471
|
+
catch {
|
|
472
|
+
// Fall through to local analysis
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
// Local analysis (always available)
|
|
476
|
+
return this.localAnalyze(targetPath, depth);
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Generate agent configurations
|
|
480
|
+
*/
|
|
481
|
+
async generateAgentConfigs(format = 'yaml') {
|
|
482
|
+
// Try Claude Flow
|
|
483
|
+
if (this.claudeFlowBridge?.pretrain.isClaudeFlowAvailable()) {
|
|
484
|
+
try {
|
|
485
|
+
return await this.claudeFlowBridge.pretrain.generateAgentConfigs(format);
|
|
486
|
+
}
|
|
487
|
+
catch {
|
|
488
|
+
// Fall through
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
// Return default QE agents
|
|
492
|
+
return [
|
|
493
|
+
{
|
|
494
|
+
name: 'qe-test-architect',
|
|
495
|
+
type: 'worker',
|
|
496
|
+
capabilities: ['test-generation', 'test-design'],
|
|
497
|
+
model: 'sonnet',
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
name: 'qe-coverage-specialist',
|
|
501
|
+
type: 'worker',
|
|
502
|
+
capabilities: ['coverage-analysis', 'gap-detection'],
|
|
503
|
+
model: 'haiku',
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
name: 'qe-security-scanner',
|
|
507
|
+
type: 'worker',
|
|
508
|
+
capabilities: ['security-scanning', 'vulnerability-detection'],
|
|
509
|
+
model: 'opus',
|
|
510
|
+
},
|
|
511
|
+
];
|
|
512
|
+
}
|
|
513
|
+
// ==========================================================================
|
|
514
|
+
// Experience Capture (Pattern Learning)
|
|
515
|
+
// ==========================================================================
|
|
516
|
+
/**
|
|
517
|
+
* Capture experience from completed task
|
|
518
|
+
*
|
|
519
|
+
* Uses ExperienceCaptureService for comprehensive experience tracking
|
|
520
|
+
* with pattern extraction and promotion.
|
|
521
|
+
*/
|
|
522
|
+
async captureExperience(execution) {
|
|
523
|
+
if (!this.experienceCapture || !this.config.enableExperienceCapture)
|
|
524
|
+
return;
|
|
525
|
+
// Calculate average quality from steps
|
|
526
|
+
const avgQuality = execution.steps.length > 0
|
|
527
|
+
? execution.steps.reduce((sum, s) => sum + (s.quality ?? 0.5), 0) / execution.steps.length
|
|
528
|
+
: 0.5;
|
|
529
|
+
// Complete capture using ExperienceCaptureService
|
|
530
|
+
// This handles pattern extraction and promotion automatically
|
|
531
|
+
await this.experienceCapture.completeCapture(execution.id, {
|
|
532
|
+
success: true,
|
|
533
|
+
quality: avgQuality,
|
|
534
|
+
});
|
|
535
|
+
// Also share across domains if quality is high
|
|
536
|
+
const experience = await this.experienceCapture.getExperience(execution.id);
|
|
537
|
+
if (experience && experience.quality >= 0.7) {
|
|
538
|
+
await this.experienceCapture.shareAcrossDomains(experience);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Start experience capture for a task
|
|
543
|
+
*
|
|
544
|
+
* Called automatically by startTask but can be used directly
|
|
545
|
+
* for more control over the capture process.
|
|
546
|
+
*/
|
|
547
|
+
startExperienceCapture(task, options) {
|
|
548
|
+
if (!this.experienceCapture)
|
|
549
|
+
return undefined;
|
|
550
|
+
return this.experienceCapture.startCapture(task, options);
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Get experience capture service (for advanced usage)
|
|
554
|
+
*/
|
|
555
|
+
getExperienceCaptureService() {
|
|
556
|
+
return this.experienceCapture;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Local codebase analysis
|
|
560
|
+
*/
|
|
561
|
+
async localAnalyze(targetPath, depth) {
|
|
562
|
+
try {
|
|
563
|
+
const glob = await import('fast-glob');
|
|
564
|
+
const { existsSync, readFileSync } = await import('fs');
|
|
565
|
+
const { join } = await import('path');
|
|
566
|
+
// Scan patterns based on depth
|
|
567
|
+
const patterns = depth === 'shallow'
|
|
568
|
+
? ['*.ts', '*.js', '*.json']
|
|
569
|
+
: depth === 'medium'
|
|
570
|
+
? ['**/*.ts', '**/*.js', '**/*.json', '**/*.py']
|
|
571
|
+
: ['**/*'];
|
|
572
|
+
const ignore = ['node_modules/**', 'dist/**', 'coverage/**', '.git/**'];
|
|
573
|
+
const files = await glob.default(patterns, {
|
|
574
|
+
cwd: targetPath,
|
|
575
|
+
ignore,
|
|
576
|
+
onlyFiles: true,
|
|
577
|
+
});
|
|
578
|
+
// Detect languages and frameworks
|
|
579
|
+
const languages = new Set();
|
|
580
|
+
const frameworks = new Set();
|
|
581
|
+
for (const file of files.slice(0, 100)) {
|
|
582
|
+
if (file.endsWith('.ts') || file.endsWith('.tsx'))
|
|
583
|
+
languages.add('typescript');
|
|
584
|
+
if (file.endsWith('.js') || file.endsWith('.jsx'))
|
|
585
|
+
languages.add('javascript');
|
|
586
|
+
if (file.endsWith('.py'))
|
|
587
|
+
languages.add('python');
|
|
588
|
+
if (file.endsWith('.go'))
|
|
589
|
+
languages.add('go');
|
|
590
|
+
if (file.endsWith('.rs'))
|
|
591
|
+
languages.add('rust');
|
|
592
|
+
}
|
|
593
|
+
// Check package.json for frameworks
|
|
594
|
+
const packageJsonPath = join(targetPath, 'package.json');
|
|
595
|
+
if (existsSync(packageJsonPath)) {
|
|
596
|
+
try {
|
|
597
|
+
const pkg = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
598
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
599
|
+
if (deps.react)
|
|
600
|
+
frameworks.add('react');
|
|
601
|
+
if (deps.vue)
|
|
602
|
+
frameworks.add('vue');
|
|
603
|
+
if (deps.vitest)
|
|
604
|
+
frameworks.add('vitest');
|
|
605
|
+
if (deps.jest)
|
|
606
|
+
frameworks.add('jest');
|
|
607
|
+
if (deps.playwright)
|
|
608
|
+
frameworks.add('playwright');
|
|
609
|
+
}
|
|
610
|
+
catch {
|
|
611
|
+
// Ignore parse errors
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
return {
|
|
615
|
+
success: true,
|
|
616
|
+
repositoryPath: targetPath,
|
|
617
|
+
depth,
|
|
618
|
+
analysis: {
|
|
619
|
+
languages: Array.from(languages),
|
|
620
|
+
frameworks: Array.from(frameworks),
|
|
621
|
+
patterns: [],
|
|
622
|
+
complexity: files.length > 500 ? 3 : files.length > 100 ? 2 : 1,
|
|
623
|
+
},
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
catch (error) {
|
|
627
|
+
return {
|
|
628
|
+
success: false,
|
|
629
|
+
repositoryPath: targetPath,
|
|
630
|
+
depth,
|
|
631
|
+
error: error instanceof Error ? error.message : String(error),
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
// ==========================================================================
|
|
636
|
+
// Guidance (Standalone)
|
|
637
|
+
// ==========================================================================
|
|
638
|
+
/**
|
|
639
|
+
* Get QE guidance for a domain
|
|
640
|
+
*/
|
|
641
|
+
getGuidance(domain, context) {
|
|
642
|
+
if (!this.reasoningBank) {
|
|
643
|
+
throw new Error('Engine not initialized');
|
|
644
|
+
}
|
|
645
|
+
return this.reasoningBank.getGuidance(domain, context);
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Generate guidance context for Claude
|
|
649
|
+
*/
|
|
650
|
+
generateContext(domain, context) {
|
|
651
|
+
if (!this.reasoningBank) {
|
|
652
|
+
throw new Error('Engine not initialized');
|
|
653
|
+
}
|
|
654
|
+
return this.reasoningBank.generateContext(domain, context);
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Check for anti-patterns
|
|
658
|
+
*/
|
|
659
|
+
checkAntiPatterns(domain, content) {
|
|
660
|
+
if (!this.reasoningBank) {
|
|
661
|
+
throw new Error('Engine not initialized');
|
|
662
|
+
}
|
|
663
|
+
return this.reasoningBank.checkAntiPatterns(domain, content);
|
|
664
|
+
}
|
|
665
|
+
// ==========================================================================
|
|
666
|
+
// Cleanup
|
|
667
|
+
// ==========================================================================
|
|
668
|
+
/**
|
|
669
|
+
* Dispose the engine
|
|
670
|
+
*/
|
|
671
|
+
async dispose() {
|
|
672
|
+
if (this.experienceCapture) {
|
|
673
|
+
await this.experienceCapture.dispose();
|
|
674
|
+
}
|
|
675
|
+
if (this.patternStore) {
|
|
676
|
+
await this.patternStore.dispose();
|
|
677
|
+
}
|
|
678
|
+
if (this.reasoningBank) {
|
|
679
|
+
await this.reasoningBank.dispose();
|
|
680
|
+
}
|
|
681
|
+
this.activeTasks.clear();
|
|
682
|
+
this.initialized = false;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
// ============================================================================
|
|
686
|
+
// Factory Functions
|
|
687
|
+
// ============================================================================
|
|
688
|
+
/**
|
|
689
|
+
* Create AQE Learning Engine
|
|
690
|
+
*
|
|
691
|
+
* @example
|
|
692
|
+
* ```typescript
|
|
693
|
+
* const engine = createAQELearningEngine(memory, {
|
|
694
|
+
* projectRoot: process.cwd(),
|
|
695
|
+
* });
|
|
696
|
+
* await engine.initialize();
|
|
697
|
+
* ```
|
|
698
|
+
*/
|
|
699
|
+
export function createAQELearningEngine(memory, config, eventBus) {
|
|
700
|
+
return new AQELearningEngine(memory, config, eventBus);
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Create AQE Learning Engine with defaults
|
|
704
|
+
*/
|
|
705
|
+
export function createDefaultLearningEngine(memory, projectRoot, eventBus) {
|
|
706
|
+
return createAQELearningEngine(memory, { projectRoot }, eventBus);
|
|
707
|
+
}
|
|
708
|
+
//# sourceMappingURL=aqe-learning-engine.js.map
|