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.
Files changed (340) hide show
  1. package/.claude/agents/v3/qe-accessibility-auditor.md +90 -0
  2. package/README.md +43 -5
  3. package/package.json +3 -2
  4. package/scripts/cloud-db-config.json +37 -0
  5. package/scripts/cloud-db-connect.sh +37 -0
  6. package/scripts/cloud-db-tunnel.sh +23 -0
  7. package/v3/CHANGELOG.md +165 -0
  8. package/v3/README.md +59 -1
  9. package/v3/assets/agents/v3/qe-accessibility-auditor.md +90 -0
  10. package/v3/dist/adapters/claude-flow/index.d.ts +54 -0
  11. package/v3/dist/adapters/claude-flow/index.d.ts.map +1 -0
  12. package/v3/dist/adapters/claude-flow/index.js +79 -0
  13. package/v3/dist/adapters/claude-flow/index.js.map +1 -0
  14. package/v3/dist/adapters/claude-flow/model-router-bridge.d.ts +70 -0
  15. package/v3/dist/adapters/claude-flow/model-router-bridge.d.ts.map +1 -0
  16. package/v3/dist/adapters/claude-flow/model-router-bridge.js +203 -0
  17. package/v3/dist/adapters/claude-flow/model-router-bridge.js.map +1 -0
  18. package/v3/dist/adapters/claude-flow/pretrain-bridge.d.ts +73 -0
  19. package/v3/dist/adapters/claude-flow/pretrain-bridge.d.ts.map +1 -0
  20. package/v3/dist/adapters/claude-flow/pretrain-bridge.js +276 -0
  21. package/v3/dist/adapters/claude-flow/pretrain-bridge.js.map +1 -0
  22. package/v3/dist/adapters/claude-flow/trajectory-bridge.d.ts +70 -0
  23. package/v3/dist/adapters/claude-flow/trajectory-bridge.d.ts.map +1 -0
  24. package/v3/dist/adapters/claude-flow/trajectory-bridge.js +205 -0
  25. package/v3/dist/adapters/claude-flow/trajectory-bridge.js.map +1 -0
  26. package/v3/dist/adapters/claude-flow/types.d.ts +99 -0
  27. package/v3/dist/adapters/claude-flow/types.d.ts.map +1 -0
  28. package/v3/dist/adapters/claude-flow/types.js +6 -0
  29. package/v3/dist/adapters/claude-flow/types.js.map +1 -0
  30. package/v3/dist/causal-discovery/causal-graph.d.ts +80 -1
  31. package/v3/dist/causal-discovery/causal-graph.d.ts.map +1 -1
  32. package/v3/dist/causal-discovery/causal-graph.js +111 -1
  33. package/v3/dist/causal-discovery/causal-graph.js.map +1 -1
  34. package/v3/dist/cli/bundle.js +11612 -4929
  35. package/v3/dist/cli/commands/claude-flow-setup.d.ts +82 -0
  36. package/v3/dist/cli/commands/claude-flow-setup.d.ts.map +1 -0
  37. package/v3/dist/cli/commands/claude-flow-setup.js +334 -0
  38. package/v3/dist/cli/commands/claude-flow-setup.js.map +1 -0
  39. package/v3/dist/cli/commands/hooks.d.ts +2 -0
  40. package/v3/dist/cli/commands/hooks.d.ts.map +1 -1
  41. package/v3/dist/cli/commands/hooks.js +13 -2
  42. package/v3/dist/cli/commands/hooks.js.map +1 -1
  43. package/v3/dist/cli/commands/init.d.ts +19 -0
  44. package/v3/dist/cli/commands/init.d.ts.map +1 -0
  45. package/v3/dist/cli/commands/init.js +345 -0
  46. package/v3/dist/cli/commands/init.js.map +1 -0
  47. package/v3/dist/cli/index.js +110 -2
  48. package/v3/dist/cli/index.js.map +1 -1
  49. package/v3/dist/coordination/mincut/interfaces.d.ts +8 -2
  50. package/v3/dist/coordination/mincut/interfaces.d.ts.map +1 -1
  51. package/v3/dist/coordination/mincut/interfaces.js.map +1 -1
  52. package/v3/dist/coordination/mincut/mincut-health-monitor.d.ts +5 -0
  53. package/v3/dist/coordination/mincut/mincut-health-monitor.d.ts.map +1 -1
  54. package/v3/dist/coordination/mincut/mincut-health-monitor.js +22 -4
  55. package/v3/dist/coordination/mincut/mincut-health-monitor.js.map +1 -1
  56. package/v3/dist/coordination/mincut/queen-integration.d.ts +4 -0
  57. package/v3/dist/coordination/mincut/queen-integration.d.ts.map +1 -1
  58. package/v3/dist/coordination/mincut/queen-integration.js +14 -1
  59. package/v3/dist/coordination/mincut/queen-integration.js.map +1 -1
  60. package/v3/dist/coordination/queen-coordinator.d.ts +5 -0
  61. package/v3/dist/coordination/queen-coordinator.d.ts.map +1 -1
  62. package/v3/dist/coordination/queen-coordinator.js +45 -7
  63. package/v3/dist/coordination/queen-coordinator.js.map +1 -1
  64. package/v3/dist/domains/learning-optimization/coordinator.d.ts +5 -0
  65. package/v3/dist/domains/learning-optimization/coordinator.d.ts.map +1 -1
  66. package/v3/dist/domains/learning-optimization/coordinator.js +79 -0
  67. package/v3/dist/domains/learning-optimization/coordinator.js.map +1 -1
  68. package/v3/dist/domains/test-generation/coherence-gate.d.ts +245 -0
  69. package/v3/dist/domains/test-generation/coherence-gate.d.ts.map +1 -0
  70. package/v3/dist/domains/test-generation/coherence-gate.js +454 -0
  71. package/v3/dist/domains/test-generation/coherence-gate.js.map +1 -0
  72. package/v3/dist/domains/test-generation/coordinator.d.ts +32 -1
  73. package/v3/dist/domains/test-generation/coordinator.d.ts.map +1 -1
  74. package/v3/dist/domains/test-generation/coordinator.js +70 -1
  75. package/v3/dist/domains/test-generation/coordinator.js.map +1 -1
  76. package/v3/dist/domains/test-generation/index.d.ts +1 -0
  77. package/v3/dist/domains/test-generation/index.d.ts.map +1 -1
  78. package/v3/dist/domains/test-generation/index.js +4 -0
  79. package/v3/dist/domains/test-generation/index.js.map +1 -1
  80. package/v3/dist/domains/test-generation/services/index.d.ts +1 -0
  81. package/v3/dist/domains/test-generation/services/index.d.ts.map +1 -1
  82. package/v3/dist/domains/test-generation/services/index.js +2 -0
  83. package/v3/dist/domains/test-generation/services/index.js.map +1 -1
  84. package/v3/dist/domains/visual-accessibility/index.d.ts +2 -1
  85. package/v3/dist/domains/visual-accessibility/index.d.ts.map +1 -1
  86. package/v3/dist/domains/visual-accessibility/index.js +1 -0
  87. package/v3/dist/domains/visual-accessibility/index.js.map +1 -1
  88. package/v3/dist/domains/visual-accessibility/interfaces.d.ts +131 -0
  89. package/v3/dist/domains/visual-accessibility/interfaces.d.ts.map +1 -1
  90. package/v3/dist/domains/visual-accessibility/plugin.d.ts +26 -0
  91. package/v3/dist/domains/visual-accessibility/plugin.d.ts.map +1 -1
  92. package/v3/dist/domains/visual-accessibility/plugin.js +151 -0
  93. package/v3/dist/domains/visual-accessibility/plugin.js.map +1 -1
  94. package/v3/dist/domains/visual-accessibility/services/accessibility-tester.d.ts +42 -1
  95. package/v3/dist/domains/visual-accessibility/services/accessibility-tester.d.ts.map +1 -1
  96. package/v3/dist/domains/visual-accessibility/services/accessibility-tester.js +69 -0
  97. package/v3/dist/domains/visual-accessibility/services/accessibility-tester.js.map +1 -1
  98. package/v3/dist/domains/visual-accessibility/services/eu-compliance.d.ts +138 -0
  99. package/v3/dist/domains/visual-accessibility/services/eu-compliance.d.ts.map +1 -0
  100. package/v3/dist/domains/visual-accessibility/services/eu-compliance.js +830 -0
  101. package/v3/dist/domains/visual-accessibility/services/eu-compliance.js.map +1 -0
  102. package/v3/dist/domains/visual-accessibility/services/index.d.ts +1 -0
  103. package/v3/dist/domains/visual-accessibility/services/index.d.ts.map +1 -1
  104. package/v3/dist/domains/visual-accessibility/services/index.js +1 -0
  105. package/v3/dist/domains/visual-accessibility/services/index.js.map +1 -1
  106. package/v3/dist/init/enhancements/claude-flow-adapter.d.ts +84 -0
  107. package/v3/dist/init/enhancements/claude-flow-adapter.d.ts.map +1 -0
  108. package/v3/dist/init/enhancements/claude-flow-adapter.js +250 -0
  109. package/v3/dist/init/enhancements/claude-flow-adapter.js.map +1 -0
  110. package/v3/dist/init/enhancements/detector.d.ts +10 -0
  111. package/v3/dist/init/enhancements/detector.d.ts.map +1 -0
  112. package/v3/dist/init/enhancements/detector.js +87 -0
  113. package/v3/dist/init/enhancements/detector.js.map +1 -0
  114. package/v3/dist/init/enhancements/index.d.ts +13 -0
  115. package/v3/dist/init/enhancements/index.d.ts.map +1 -0
  116. package/v3/dist/init/enhancements/index.js +25 -0
  117. package/v3/dist/init/enhancements/index.js.map +1 -0
  118. package/v3/dist/init/enhancements/types.d.ts +93 -0
  119. package/v3/dist/init/enhancements/types.d.ts.map +1 -0
  120. package/v3/dist/init/enhancements/types.js +6 -0
  121. package/v3/dist/init/enhancements/types.js.map +1 -0
  122. package/v3/dist/init/index.d.ts +8 -0
  123. package/v3/dist/init/index.d.ts.map +1 -1
  124. package/v3/dist/init/index.js +4 -0
  125. package/v3/dist/init/index.js.map +1 -1
  126. package/v3/dist/init/migration/config-migrator.d.ts +31 -0
  127. package/v3/dist/init/migration/config-migrator.d.ts.map +1 -0
  128. package/v3/dist/init/migration/config-migrator.js +133 -0
  129. package/v3/dist/init/migration/config-migrator.js.map +1 -0
  130. package/v3/dist/init/migration/data-migrator.d.ts +72 -0
  131. package/v3/dist/init/migration/data-migrator.d.ts.map +1 -0
  132. package/v3/dist/init/migration/data-migrator.js +233 -0
  133. package/v3/dist/init/migration/data-migrator.js.map +1 -0
  134. package/v3/dist/init/migration/detector.d.ts +44 -0
  135. package/v3/dist/init/migration/detector.d.ts.map +1 -0
  136. package/v3/dist/init/migration/detector.js +106 -0
  137. package/v3/dist/init/migration/detector.js.map +1 -0
  138. package/v3/dist/init/migration/index.d.ts +8 -0
  139. package/v3/dist/init/migration/index.d.ts.map +1 -0
  140. package/v3/dist/init/migration/index.js +8 -0
  141. package/v3/dist/init/migration/index.js.map +1 -0
  142. package/v3/dist/init/orchestrator.d.ts +68 -0
  143. package/v3/dist/init/orchestrator.d.ts.map +1 -0
  144. package/v3/dist/init/orchestrator.js +239 -0
  145. package/v3/dist/init/orchestrator.js.map +1 -0
  146. package/v3/dist/init/phases/01-detection.d.ts +30 -0
  147. package/v3/dist/init/phases/01-detection.d.ts.map +1 -0
  148. package/v3/dist/init/phases/01-detection.js +143 -0
  149. package/v3/dist/init/phases/01-detection.js.map +1 -0
  150. package/v3/dist/init/phases/02-analysis.d.ts +18 -0
  151. package/v3/dist/init/phases/02-analysis.d.ts.map +1 -0
  152. package/v3/dist/init/phases/02-analysis.js +28 -0
  153. package/v3/dist/init/phases/02-analysis.js.map +1 -0
  154. package/v3/dist/init/phases/03-configuration.d.ts +26 -0
  155. package/v3/dist/init/phases/03-configuration.d.ts.map +1 -0
  156. package/v3/dist/init/phases/03-configuration.js +98 -0
  157. package/v3/dist/init/phases/03-configuration.js.map +1 -0
  158. package/v3/dist/init/phases/04-database.d.ts +22 -0
  159. package/v3/dist/init/phases/04-database.d.ts.map +1 -0
  160. package/v3/dist/init/phases/04-database.js +88 -0
  161. package/v3/dist/init/phases/04-database.js.map +1 -0
  162. package/v3/dist/init/phases/05-learning.d.ts +28 -0
  163. package/v3/dist/init/phases/05-learning.d.ts.map +1 -0
  164. package/v3/dist/init/phases/05-learning.js +98 -0
  165. package/v3/dist/init/phases/05-learning.js.map +1 -0
  166. package/v3/dist/init/phases/06-code-intelligence.d.ts +33 -0
  167. package/v3/dist/init/phases/06-code-intelligence.d.ts.map +1 -0
  168. package/v3/dist/init/phases/06-code-intelligence.js +115 -0
  169. package/v3/dist/init/phases/06-code-intelligence.js.map +1 -0
  170. package/v3/dist/init/phases/07-hooks.d.ts +27 -0
  171. package/v3/dist/init/phases/07-hooks.d.ts.map +1 -0
  172. package/v3/dist/init/phases/07-hooks.js +209 -0
  173. package/v3/dist/init/phases/07-hooks.js.map +1 -0
  174. package/v3/dist/init/phases/08-mcp.d.ts +22 -0
  175. package/v3/dist/init/phases/08-mcp.d.ts.map +1 -0
  176. package/v3/dist/init/phases/08-mcp.js +62 -0
  177. package/v3/dist/init/phases/08-mcp.js.map +1 -0
  178. package/v3/dist/init/phases/09-assets.d.ts +23 -0
  179. package/v3/dist/init/phases/09-assets.d.ts.map +1 -0
  180. package/v3/dist/init/phases/09-assets.js +82 -0
  181. package/v3/dist/init/phases/09-assets.js.map +1 -0
  182. package/v3/dist/init/phases/10-workers.d.ts +23 -0
  183. package/v3/dist/init/phases/10-workers.d.ts.map +1 -0
  184. package/v3/dist/init/phases/10-workers.js +111 -0
  185. package/v3/dist/init/phases/10-workers.js.map +1 -0
  186. package/v3/dist/init/phases/11-claude-md.d.ts +26 -0
  187. package/v3/dist/init/phases/11-claude-md.d.ts.map +1 -0
  188. package/v3/dist/init/phases/11-claude-md.js +121 -0
  189. package/v3/dist/init/phases/11-claude-md.js.map +1 -0
  190. package/v3/dist/init/phases/12-verification.d.ts +38 -0
  191. package/v3/dist/init/phases/12-verification.d.ts.map +1 -0
  192. package/v3/dist/init/phases/12-verification.js +187 -0
  193. package/v3/dist/init/phases/12-verification.js.map +1 -0
  194. package/v3/dist/init/phases/index.d.ts +46 -0
  195. package/v3/dist/init/phases/index.d.ts.map +1 -0
  196. package/v3/dist/init/phases/index.js +64 -0
  197. package/v3/dist/init/phases/index.js.map +1 -0
  198. package/v3/dist/init/phases/phase-interface.d.ts +193 -0
  199. package/v3/dist/init/phases/phase-interface.d.ts.map +1 -0
  200. package/v3/dist/init/phases/phase-interface.js +119 -0
  201. package/v3/dist/init/phases/phase-interface.js.map +1 -0
  202. package/v3/dist/integrations/coherence/coherence-service.d.ts +323 -0
  203. package/v3/dist/integrations/coherence/coherence-service.d.ts.map +1 -0
  204. package/v3/dist/integrations/coherence/coherence-service.js +799 -0
  205. package/v3/dist/integrations/coherence/coherence-service.js.map +1 -0
  206. package/v3/dist/integrations/coherence/engines/category-adapter.d.ts +170 -0
  207. package/v3/dist/integrations/coherence/engines/category-adapter.d.ts.map +1 -0
  208. package/v3/dist/integrations/coherence/engines/category-adapter.js +403 -0
  209. package/v3/dist/integrations/coherence/engines/category-adapter.js.map +1 -0
  210. package/v3/dist/integrations/coherence/engines/causal-adapter.d.ts +159 -0
  211. package/v3/dist/integrations/coherence/engines/causal-adapter.d.ts.map +1 -0
  212. package/v3/dist/integrations/coherence/engines/causal-adapter.js +348 -0
  213. package/v3/dist/integrations/coherence/engines/causal-adapter.js.map +1 -0
  214. package/v3/dist/integrations/coherence/engines/cohomology-adapter.d.ts +174 -0
  215. package/v3/dist/integrations/coherence/engines/cohomology-adapter.d.ts.map +1 -0
  216. package/v3/dist/integrations/coherence/engines/cohomology-adapter.js +401 -0
  217. package/v3/dist/integrations/coherence/engines/cohomology-adapter.js.map +1 -0
  218. package/v3/dist/integrations/coherence/engines/homotopy-adapter.d.ts +201 -0
  219. package/v3/dist/integrations/coherence/engines/homotopy-adapter.d.ts.map +1 -0
  220. package/v3/dist/integrations/coherence/engines/homotopy-adapter.js +324 -0
  221. package/v3/dist/integrations/coherence/engines/homotopy-adapter.js.map +1 -0
  222. package/v3/dist/integrations/coherence/engines/index.d.ts +20 -0
  223. package/v3/dist/integrations/coherence/engines/index.d.ts.map +1 -0
  224. package/v3/dist/integrations/coherence/engines/index.js +26 -0
  225. package/v3/dist/integrations/coherence/engines/index.js.map +1 -0
  226. package/v3/dist/integrations/coherence/engines/spectral-adapter.d.ts +193 -0
  227. package/v3/dist/integrations/coherence/engines/spectral-adapter.d.ts.map +1 -0
  228. package/v3/dist/integrations/coherence/engines/spectral-adapter.js +476 -0
  229. package/v3/dist/integrations/coherence/engines/spectral-adapter.js.map +1 -0
  230. package/v3/dist/integrations/coherence/engines/witness-adapter.d.ts +175 -0
  231. package/v3/dist/integrations/coherence/engines/witness-adapter.d.ts.map +1 -0
  232. package/v3/dist/integrations/coherence/engines/witness-adapter.js +377 -0
  233. package/v3/dist/integrations/coherence/engines/witness-adapter.js.map +1 -0
  234. package/v3/dist/integrations/coherence/index.d.ts +84 -0
  235. package/v3/dist/integrations/coherence/index.d.ts.map +1 -0
  236. package/v3/dist/integrations/coherence/index.js +114 -0
  237. package/v3/dist/integrations/coherence/index.js.map +1 -0
  238. package/v3/dist/integrations/coherence/threshold-tuner.d.ts +396 -0
  239. package/v3/dist/integrations/coherence/threshold-tuner.d.ts.map +1 -0
  240. package/v3/dist/integrations/coherence/threshold-tuner.js +538 -0
  241. package/v3/dist/integrations/coherence/threshold-tuner.js.map +1 -0
  242. package/v3/dist/integrations/coherence/types.d.ts +879 -0
  243. package/v3/dist/integrations/coherence/types.d.ts.map +1 -0
  244. package/v3/dist/integrations/coherence/types.js +134 -0
  245. package/v3/dist/integrations/coherence/types.js.map +1 -0
  246. package/v3/dist/integrations/coherence/wasm-loader.d.ts +351 -0
  247. package/v3/dist/integrations/coherence/wasm-loader.d.ts.map +1 -0
  248. package/v3/dist/integrations/coherence/wasm-loader.js +842 -0
  249. package/v3/dist/integrations/coherence/wasm-loader.js.map +1 -0
  250. package/v3/dist/integrations/embeddings/index/HNSWIndex.d.ts.map +1 -1
  251. package/v3/dist/integrations/embeddings/index/HNSWIndex.js +4 -1
  252. package/v3/dist/integrations/embeddings/index/HNSWIndex.js.map +1 -1
  253. package/v3/dist/kernel/interfaces.d.ts +8 -1
  254. package/v3/dist/kernel/interfaces.d.ts.map +1 -1
  255. package/v3/dist/learning/aqe-learning-engine.d.ts +272 -0
  256. package/v3/dist/learning/aqe-learning-engine.d.ts.map +1 -0
  257. package/v3/dist/learning/aqe-learning-engine.js +708 -0
  258. package/v3/dist/learning/aqe-learning-engine.js.map +1 -0
  259. package/v3/dist/learning/causal-verifier.d.ts +244 -0
  260. package/v3/dist/learning/causal-verifier.d.ts.map +1 -0
  261. package/v3/dist/learning/causal-verifier.js +300 -0
  262. package/v3/dist/learning/causal-verifier.js.map +1 -0
  263. package/v3/dist/learning/experience-capture.d.ts +266 -0
  264. package/v3/dist/learning/experience-capture.d.ts.map +1 -0
  265. package/v3/dist/learning/experience-capture.js +647 -0
  266. package/v3/dist/learning/experience-capture.js.map +1 -0
  267. package/v3/dist/learning/index.d.ts +8 -0
  268. package/v3/dist/learning/index.d.ts.map +1 -1
  269. package/v3/dist/learning/index.js +16 -0
  270. package/v3/dist/learning/index.js.map +1 -1
  271. package/v3/dist/learning/memory-auditor.d.ts +235 -0
  272. package/v3/dist/learning/memory-auditor.d.ts.map +1 -0
  273. package/v3/dist/learning/memory-auditor.js +478 -0
  274. package/v3/dist/learning/memory-auditor.js.map +1 -0
  275. package/v3/dist/learning/pattern-store.d.ts.map +1 -1
  276. package/v3/dist/learning/pattern-store.js +27 -6
  277. package/v3/dist/learning/pattern-store.js.map +1 -1
  278. package/v3/dist/learning/qe-patterns.d.ts +15 -1
  279. package/v3/dist/learning/qe-patterns.d.ts.map +1 -1
  280. package/v3/dist/learning/qe-patterns.js +26 -5
  281. package/v3/dist/learning/qe-patterns.js.map +1 -1
  282. package/v3/dist/learning/qe-reasoning-bank.d.ts +38 -2
  283. package/v3/dist/learning/qe-reasoning-bank.d.ts.map +1 -1
  284. package/v3/dist/learning/qe-reasoning-bank.js +86 -4
  285. package/v3/dist/learning/qe-reasoning-bank.js.map +1 -1
  286. package/v3/dist/learning/real-qe-reasoning-bank.d.ts +32 -2
  287. package/v3/dist/learning/real-qe-reasoning-bank.d.ts.map +1 -1
  288. package/v3/dist/learning/real-qe-reasoning-bank.js +61 -6
  289. package/v3/dist/learning/real-qe-reasoning-bank.js.map +1 -1
  290. package/v3/dist/mcp/bundle.js +6303 -266
  291. package/v3/dist/mcp/tools/coherence/audit.d.ts +107 -0
  292. package/v3/dist/mcp/tools/coherence/audit.d.ts.map +1 -0
  293. package/v3/dist/mcp/tools/coherence/audit.js +236 -0
  294. package/v3/dist/mcp/tools/coherence/audit.js.map +1 -0
  295. package/v3/dist/mcp/tools/coherence/check.d.ts +106 -0
  296. package/v3/dist/mcp/tools/coherence/check.d.ts.map +1 -0
  297. package/v3/dist/mcp/tools/coherence/check.js +205 -0
  298. package/v3/dist/mcp/tools/coherence/check.js.map +1 -0
  299. package/v3/dist/mcp/tools/coherence/collapse.d.ts +123 -0
  300. package/v3/dist/mcp/tools/coherence/collapse.d.ts.map +1 -0
  301. package/v3/dist/mcp/tools/coherence/collapse.js +279 -0
  302. package/v3/dist/mcp/tools/coherence/collapse.js.map +1 -0
  303. package/v3/dist/mcp/tools/coherence/consensus.d.ts +100 -0
  304. package/v3/dist/mcp/tools/coherence/consensus.d.ts.map +1 -0
  305. package/v3/dist/mcp/tools/coherence/consensus.js +201 -0
  306. package/v3/dist/mcp/tools/coherence/consensus.js.map +1 -0
  307. package/v3/dist/mcp/tools/coherence/index.d.ts +31 -0
  308. package/v3/dist/mcp/tools/coherence/index.d.ts.map +1 -0
  309. package/v3/dist/mcp/tools/coherence/index.js +42 -0
  310. package/v3/dist/mcp/tools/coherence/index.js.map +1 -0
  311. package/v3/dist/mcp/tools/index.d.ts +6 -1
  312. package/v3/dist/mcp/tools/index.d.ts.map +1 -1
  313. package/v3/dist/mcp/tools/index.js +9 -1
  314. package/v3/dist/mcp/tools/index.js.map +1 -1
  315. package/v3/dist/mcp/tools/mincut/index.d.ts +1 -1
  316. package/v3/dist/mcp/tools/mincut/index.d.ts.map +1 -1
  317. package/v3/dist/mcp/tools/mincut/index.js.map +1 -1
  318. package/v3/dist/mcp/tools/registry.d.ts +4 -0
  319. package/v3/dist/mcp/tools/registry.d.ts.map +1 -1
  320. package/v3/dist/mcp/tools/registry.js +5 -0
  321. package/v3/dist/mcp/tools/registry.js.map +1 -1
  322. package/v3/dist/mcp/types.d.ts +1 -1
  323. package/v3/dist/mcp/types.d.ts.map +1 -1
  324. package/v3/dist/strange-loop/belief-reconciler.d.ts +357 -0
  325. package/v3/dist/strange-loop/belief-reconciler.d.ts.map +1 -0
  326. package/v3/dist/strange-loop/belief-reconciler.js +696 -0
  327. package/v3/dist/strange-loop/belief-reconciler.js.map +1 -0
  328. package/v3/dist/strange-loop/index.d.ts +1 -0
  329. package/v3/dist/strange-loop/index.d.ts.map +1 -1
  330. package/v3/dist/strange-loop/index.js +2 -0
  331. package/v3/dist/strange-loop/index.js.map +1 -1
  332. package/v3/dist/strange-loop/strange-loop.d.ts +177 -5
  333. package/v3/dist/strange-loop/strange-loop.d.ts.map +1 -1
  334. package/v3/dist/strange-loop/strange-loop.js +452 -9
  335. package/v3/dist/strange-loop/strange-loop.js.map +1 -1
  336. package/v3/dist/strange-loop/types.d.ts +205 -1
  337. package/v3/dist/strange-loop/types.d.ts.map +1 -1
  338. package/v3/dist/strange-loop/types.js +5 -0
  339. package/v3/dist/strange-loop/types.js.map +1 -1
  340. package/v3/package.json +5 -1
@@ -0,0 +1,193 @@
1
+ /**
2
+ * Phase Interface - Modular Init System
3
+ * ADR-025: Enhanced Init with Self-Configuration
4
+ *
5
+ * Defines the contract for init phases that can be composed
6
+ * into a pipeline for flexible initialization.
7
+ */
8
+ import type { ProjectAnalysis, AQEInitConfig } from '../types.js';
9
+ /**
10
+ * Result of running an init phase
11
+ */
12
+ export interface PhaseResult<T = unknown> {
13
+ /** Whether the phase succeeded */
14
+ success: boolean;
15
+ /** Phase output data */
16
+ data?: T;
17
+ /** Error if phase failed */
18
+ error?: Error;
19
+ /** Execution duration in milliseconds */
20
+ durationMs: number;
21
+ /** Optional message for logging */
22
+ message?: string;
23
+ /** Whether to skip subsequent phases */
24
+ skipRemaining?: boolean;
25
+ }
26
+ /**
27
+ * Enhancement availability status
28
+ */
29
+ export interface EnhancementStatus {
30
+ claudeFlow: boolean;
31
+ claudeFlowVersion?: string;
32
+ ruvector: boolean;
33
+ ruvectorVersion?: string;
34
+ }
35
+ /**
36
+ * Context passed through init phases
37
+ */
38
+ export interface InitContext {
39
+ /** Project root directory */
40
+ projectRoot: string;
41
+ /** CLI options passed to init */
42
+ options: InitOptions;
43
+ /** Configuration being built up through phases */
44
+ config: Partial<AQEInitConfig>;
45
+ /** Project analysis result (set by analysis phase) */
46
+ analysis?: ProjectAnalysis;
47
+ /** Available enhancements detected */
48
+ enhancements: EnhancementStatus;
49
+ /** Results from completed phases */
50
+ results: Map<string, PhaseResult>;
51
+ /** V2 detection result (if applicable) */
52
+ v2Detection?: V2DetectionResult;
53
+ /** Shared services for phases */
54
+ services: {
55
+ /** Log a message */
56
+ log: (message: string) => void;
57
+ /** Log a warning */
58
+ warn: (message: string) => void;
59
+ /** Log an error */
60
+ error: (message: string) => void;
61
+ };
62
+ }
63
+ /**
64
+ * Options passed to aqe init command
65
+ */
66
+ export interface InitOptions {
67
+ /** Skip wizard and use auto-configuration */
68
+ autoMode?: boolean;
69
+ /** Skip pattern loading */
70
+ skipPatterns?: boolean;
71
+ /** Minimal configuration (no skills, patterns, workers) */
72
+ minimal?: boolean;
73
+ /** Automatically migrate from v2 if detected */
74
+ autoMigrate?: boolean;
75
+ /** Install n8n workflow testing platform */
76
+ withN8n?: boolean;
77
+ /** N8n API configuration */
78
+ n8nApiConfig?: {
79
+ baseUrl?: string;
80
+ apiKey?: string;
81
+ };
82
+ /** Custom wizard answers */
83
+ wizardAnswers?: Record<string, unknown>;
84
+ }
85
+ /**
86
+ * V2 installation detection result
87
+ */
88
+ export interface V2DetectionResult {
89
+ detected: boolean;
90
+ memoryDbPath?: string;
91
+ configPath?: string;
92
+ agentsPath?: string;
93
+ hasMemoryDb: boolean;
94
+ hasConfig: boolean;
95
+ hasAgents: boolean;
96
+ version?: string;
97
+ }
98
+ /**
99
+ * Init phase interface
100
+ * Each phase is a self-contained unit of initialization logic
101
+ */
102
+ export interface InitPhase<TResult = unknown> {
103
+ /** Unique phase name (used as key in results map) */
104
+ readonly name: string;
105
+ /** Human-readable description */
106
+ readonly description: string;
107
+ /** Execution order (lower runs first) */
108
+ readonly order: number;
109
+ /** If true, failure stops the entire init process */
110
+ readonly critical: boolean;
111
+ /** Phase names that must complete before this phase */
112
+ readonly requiresPhases?: readonly string[];
113
+ /** Enhancement names that this phase uses (optional) */
114
+ readonly requiresEnhancements?: readonly string[];
115
+ /**
116
+ * Determine if this phase should run
117
+ * @param context Current init context
118
+ * @returns true if phase should execute
119
+ */
120
+ shouldRun(context: InitContext): Promise<boolean>;
121
+ /**
122
+ * Execute the phase
123
+ * @param context Current init context
124
+ * @returns Phase result with data or error
125
+ */
126
+ execute(context: InitContext): Promise<PhaseResult<TResult>>;
127
+ /**
128
+ * Optional rollback if phase fails and cleanup is needed
129
+ * @param context Current init context
130
+ */
131
+ rollback?(context: InitContext): Promise<void>;
132
+ }
133
+ /**
134
+ * Base class for init phases with common functionality
135
+ */
136
+ export declare abstract class BasePhase<TResult = unknown> implements InitPhase<TResult> {
137
+ abstract readonly name: string;
138
+ abstract readonly description: string;
139
+ abstract readonly order: number;
140
+ abstract readonly critical: boolean;
141
+ readonly requiresPhases?: readonly string[];
142
+ readonly requiresEnhancements?: readonly string[];
143
+ /**
144
+ * Default shouldRun - always returns true
145
+ * Override in subclass for conditional execution
146
+ */
147
+ shouldRun(_context: InitContext): Promise<boolean>;
148
+ /**
149
+ * Execute with timing wrapper
150
+ */
151
+ execute(context: InitContext): Promise<PhaseResult<TResult>>;
152
+ /**
153
+ * Implement phase logic here
154
+ * @param context Init context
155
+ * @returns Phase result data
156
+ */
157
+ protected abstract run(context: InitContext): Promise<TResult>;
158
+ /**
159
+ * Check if required phases have completed successfully
160
+ */
161
+ protected checkDependencies(context: InitContext): boolean;
162
+ /**
163
+ * Check if required enhancements are available
164
+ */
165
+ protected checkEnhancements(context: InitContext): boolean;
166
+ }
167
+ /**
168
+ * Phase registry for managing available phases
169
+ */
170
+ export declare class PhaseRegistry {
171
+ private phases;
172
+ /**
173
+ * Register a phase
174
+ */
175
+ register(phase: InitPhase): void;
176
+ /**
177
+ * Get a phase by name
178
+ */
179
+ get(name: string): InitPhase | undefined;
180
+ /**
181
+ * Get all phases sorted by order
182
+ */
183
+ getOrdered(): InitPhase[];
184
+ /**
185
+ * Check if a phase is registered
186
+ */
187
+ has(name: string): boolean;
188
+ }
189
+ /**
190
+ * Create a new phase registry with default phases
191
+ */
192
+ export declare function createPhaseRegistry(): PhaseRegistry;
193
+ //# sourceMappingURL=phase-interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase-interface.d.ts","sourceRoot":"","sources":["../../../src/init/phases/phase-interface.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACtC,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,wBAAwB;IACxB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,4BAA4B;IAC5B,KAAK,CAAC,EAAE,KAAK,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EG;IACH,UAAU,IAAI,SAAS,EAAE;IAKzB;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAG3B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAEnD"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Phase Interface - Modular Init System
3
+ * ADR-025: Enhanced Init with Self-Configuration
4
+ *
5
+ * Defines the contract for init phases that can be composed
6
+ * into a pipeline for flexible initialization.
7
+ */
8
+ /**
9
+ * Base class for init phases with common functionality
10
+ */
11
+ export class BasePhase {
12
+ requiresPhases;
13
+ requiresEnhancements;
14
+ /**
15
+ * Default shouldRun - always returns true
16
+ * Override in subclass for conditional execution
17
+ */
18
+ async shouldRun(_context) {
19
+ return true;
20
+ }
21
+ /**
22
+ * Execute with timing wrapper
23
+ */
24
+ async execute(context) {
25
+ const startTime = Date.now();
26
+ try {
27
+ const data = await this.run(context);
28
+ return {
29
+ success: true,
30
+ data,
31
+ durationMs: Date.now() - startTime,
32
+ message: `${this.description} completed`,
33
+ };
34
+ }
35
+ catch (error) {
36
+ return {
37
+ success: false,
38
+ error: error instanceof Error ? error : new Error(String(error)),
39
+ durationMs: Date.now() - startTime,
40
+ message: `${this.description} failed: ${error instanceof Error ? error.message : String(error)}`,
41
+ };
42
+ }
43
+ }
44
+ /**
45
+ * Check if required phases have completed successfully
46
+ */
47
+ checkDependencies(context) {
48
+ if (!this.requiresPhases?.length)
49
+ return true;
50
+ for (const phaseName of this.requiresPhases) {
51
+ const result = context.results.get(phaseName);
52
+ if (!result?.success) {
53
+ context.services.warn(`Phase ${this.name} requires ${phaseName} which has not completed`);
54
+ return false;
55
+ }
56
+ }
57
+ return true;
58
+ }
59
+ /**
60
+ * Check if required enhancements are available
61
+ */
62
+ checkEnhancements(context) {
63
+ if (!this.requiresEnhancements?.length)
64
+ return true;
65
+ for (const enhancement of this.requiresEnhancements) {
66
+ const available = enhancement === 'claudeFlow'
67
+ ? context.enhancements.claudeFlow
68
+ : enhancement === 'ruvector'
69
+ ? context.enhancements.ruvector
70
+ : false;
71
+ if (!available) {
72
+ context.services.warn(`Phase ${this.name} requires ${enhancement} which is not available`);
73
+ return false;
74
+ }
75
+ }
76
+ return true;
77
+ }
78
+ }
79
+ /**
80
+ * Phase registry for managing available phases
81
+ */
82
+ export class PhaseRegistry {
83
+ phases = new Map();
84
+ /**
85
+ * Register a phase
86
+ */
87
+ register(phase) {
88
+ if (this.phases.has(phase.name)) {
89
+ throw new Error(`Phase ${phase.name} is already registered`);
90
+ }
91
+ this.phases.set(phase.name, phase);
92
+ }
93
+ /**
94
+ * Get a phase by name
95
+ */
96
+ get(name) {
97
+ return this.phases.get(name);
98
+ }
99
+ /**
100
+ * Get all phases sorted by order
101
+ */
102
+ getOrdered() {
103
+ return Array.from(this.phases.values())
104
+ .sort((a, b) => a.order - b.order);
105
+ }
106
+ /**
107
+ * Check if a phase is registered
108
+ */
109
+ has(name) {
110
+ return this.phases.has(name);
111
+ }
112
+ }
113
+ /**
114
+ * Create a new phase registry with default phases
115
+ */
116
+ export function createPhaseRegistry() {
117
+ return new PhaseRegistry();
118
+ }
119
+ //# sourceMappingURL=phase-interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phase-interface.js","sourceRoot":"","sources":["../../../src/init/phases/phase-interface.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqJH;;GAEG;AACH,MAAM,OAAgB,SAAS;IAMpB,cAAc,CAAqB;IACnC,oBAAoB,CAAqB;IAElD;;;OAGG;IACH,KAAK,CAAC,SAAS,CAAC,QAAqB;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,OAAoB;QAChC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE7B,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACrC,OAAO;gBACL,OAAO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AAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,IAAI,aAAa,EAAE,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,323 @@
1
+ /**
2
+ * Agentic QE v3 - Coherence Service
3
+ *
4
+ * Main facade that wraps all 6 Prime Radiant engines for coherence verification.
5
+ * Provides mathematical coherence gates for multi-agent coordination.
6
+ *
7
+ * **Architecture Overview:**
8
+ * ```
9
+ * ┌─────────────────────────────────────────────────────────────────────┐
10
+ * │ AQE v3 COHERENCE ARCHITECTURE │
11
+ * ├─────────────────────────────────────────────────────────────────────┤
12
+ * │ │
13
+ * │ ┌────────────────┐ ┌─────────────────────┐ ┌────────────┐ │
14
+ * │ │ QE Agent │────▶│ COHERENCE GATE │────▶│ Execution │ │
15
+ * │ │ Decision │ │ (Prime Radiant) │ │ Layer │ │
16
+ * │ └────────────────┘ └─────────────────────┘ └────────────┘ │
17
+ * │ │ │
18
+ * │ ┌───────────┼───────────┐ │
19
+ * │ ▼ ▼ ▼ │
20
+ * │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
21
+ * │ │ REFLEX │ │ RETRIEVAL│ │ ESCALATE │ │
22
+ * │ │ E < 0.1 │ │ E: 0.1-0.4│ │ E > 0.4 │ │
23
+ * │ │ <1ms │ │ ~10ms │ │ Queen │ │
24
+ * │ └──────────┘ └──────────┘ └──────────┘ │
25
+ * │ │
26
+ * └─────────────────────────────────────────────────────────────────────┘
27
+ * ```
28
+ *
29
+ * @module integrations/coherence/coherence-service
30
+ */
31
+ import type { CoherenceNode, CoherenceResult, CoherenceServiceConfig, CoherenceStats, Belief, Contradiction, SwarmState, AgentHealth, CollapseRisk, CausalData, CausalVerification, TypedPipeline, TypeVerification, Decision, WitnessRecord, ReplayResult, AgentVote, ConsensusResult, HasEmbedding, IWasmLoader, CoherenceLogger } from './types';
32
+ /**
33
+ * Interface for the main Coherence Service
34
+ */
35
+ export interface ICoherenceService {
36
+ /**
37
+ * Initialize the service (loads WASM modules)
38
+ */
39
+ initialize(): Promise<void>;
40
+ /**
41
+ * Check if the service is initialized
42
+ */
43
+ isInitialized(): boolean;
44
+ /**
45
+ * Core coherence checking for a set of nodes
46
+ *
47
+ * @param nodes - Nodes to check for coherence
48
+ * @returns Coherence result with energy, lane, and contradictions
49
+ */
50
+ checkCoherence(nodes: CoherenceNode[]): Promise<CoherenceResult>;
51
+ /**
52
+ * Detect contradictions in a set of beliefs
53
+ *
54
+ * @param beliefs - Beliefs to check for contradictions
55
+ * @returns Array of detected contradictions
56
+ */
57
+ detectContradictions(beliefs: Belief[]): Promise<Contradiction[]>;
58
+ /**
59
+ * Predict collapse risk for a swarm
60
+ *
61
+ * @param state - Current swarm state
62
+ * @returns Collapse risk assessment
63
+ */
64
+ predictCollapse(state: SwarmState): Promise<CollapseRisk>;
65
+ /**
66
+ * Verify a causal relationship
67
+ *
68
+ * @param cause - Name of the cause variable
69
+ * @param effect - Name of the effect variable
70
+ * @param data - Observation data
71
+ * @returns Causal verification result
72
+ */
73
+ verifyCausality(cause: string, effect: string, data: CausalData): Promise<CausalVerification>;
74
+ /**
75
+ * Verify type consistency in a pipeline
76
+ *
77
+ * @param pipeline - Typed pipeline to verify
78
+ * @returns Type verification result
79
+ */
80
+ verifyTypes(pipeline: TypedPipeline): Promise<TypeVerification>;
81
+ /**
82
+ * Create a witness record for a decision
83
+ *
84
+ * @param decision - Decision to witness
85
+ * @returns Witness record
86
+ */
87
+ createWitness(decision: Decision): Promise<WitnessRecord>;
88
+ /**
89
+ * Replay a decision from a witness
90
+ *
91
+ * @param witnessId - ID of the witness to replay from
92
+ * @returns Replay result
93
+ */
94
+ replayFromWitness(witnessId: string): Promise<ReplayResult>;
95
+ /**
96
+ * Check coherence of swarm agents
97
+ *
98
+ * @param agentHealth - Map of agent ID to health state
99
+ * @returns Coherence result for the swarm
100
+ */
101
+ checkSwarmCoherence(agentHealth: Map<string, AgentHealth>): Promise<CoherenceResult>;
102
+ /**
103
+ * Verify multi-agent consensus mathematically
104
+ *
105
+ * @param votes - Array of agent votes
106
+ * @returns Consensus verification result
107
+ */
108
+ verifyConsensus(votes: AgentVote[]): Promise<ConsensusResult>;
109
+ /**
110
+ * Filter items to only return coherent ones
111
+ *
112
+ * @param items - Items with embeddings to filter
113
+ * @param context - Context for coherence checking
114
+ * @returns Filtered items that are coherent with context
115
+ */
116
+ filterCoherent<T extends HasEmbedding>(items: T[], context: unknown): Promise<T[]>;
117
+ /**
118
+ * Get service statistics
119
+ */
120
+ getStats(): CoherenceStats;
121
+ /**
122
+ * Dispose of service resources
123
+ */
124
+ dispose(): Promise<void>;
125
+ }
126
+ /**
127
+ * Main Coherence Service implementation
128
+ *
129
+ * Provides a unified interface to all 6 Prime Radiant engines:
130
+ * 1. CohomologyEngine - Sheaf cohomology for contradiction detection
131
+ * 2. SpectralEngine - Spectral analysis for collapse prediction
132
+ * 3. CausalEngine - Causal inference for spurious correlation detection
133
+ * 4. CategoryEngine - Category theory for type verification
134
+ * 5. HomotopyEngine - HoTT for formal verification
135
+ * 6. WitnessEngine - Blake3 witness chains for audit trails
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * const service = new CoherenceService(wasmLoader);
140
+ * await service.initialize();
141
+ *
142
+ * // Check coherence
143
+ * const result = await service.checkCoherence(nodes);
144
+ * if (!result.isCoherent) {
145
+ * console.log('Contradictions found:', result.contradictions);
146
+ * }
147
+ *
148
+ * // Route based on lane
149
+ * switch (result.lane) {
150
+ * case 'reflex': return executeImmediately();
151
+ * case 'retrieval': return fetchContextAndRetry();
152
+ * case 'heavy': return deepAnalysis();
153
+ * case 'human': return escalateToQueen();
154
+ * }
155
+ * ```
156
+ */
157
+ export declare class CoherenceService implements ICoherenceService {
158
+ private readonly wasmLoader;
159
+ private readonly config;
160
+ private readonly logger;
161
+ private cohomologyAdapter;
162
+ private spectralAdapter;
163
+ private causalAdapter;
164
+ private categoryAdapter;
165
+ private homotopyAdapter;
166
+ private witnessAdapter;
167
+ private initialized;
168
+ private stats;
169
+ private totalEnergySum;
170
+ private totalDurationSum;
171
+ /**
172
+ * Create a new CoherenceService
173
+ *
174
+ * @param wasmLoader - WASM module loader (dependency injection)
175
+ * @param config - Optional service configuration
176
+ * @param logger - Optional logger for diagnostics
177
+ */
178
+ constructor(wasmLoader: IWasmLoader, config?: Partial<CoherenceServiceConfig>, logger?: CoherenceLogger);
179
+ /**
180
+ * Initialize the service by loading all WASM modules
181
+ */
182
+ initialize(): Promise<void>;
183
+ /**
184
+ * Check if the service is initialized
185
+ */
186
+ isInitialized(): boolean;
187
+ /**
188
+ * Ensure the service is initialized
189
+ */
190
+ private ensureInitialized;
191
+ /**
192
+ * Check coherence of a set of nodes
193
+ */
194
+ checkCoherence(nodes: CoherenceNode[]): Promise<CoherenceResult>;
195
+ /**
196
+ * Check coherence using WASM adapter
197
+ */
198
+ private checkCoherenceWithWasm;
199
+ /**
200
+ * Check coherence using TypeScript fallback
201
+ */
202
+ private checkCoherenceWithFallback;
203
+ /**
204
+ * Build edges between nodes based on similarity
205
+ */
206
+ private buildEdgesFromNodes;
207
+ /**
208
+ * Detect contradictions in beliefs
209
+ */
210
+ detectContradictions(beliefs: Belief[]): Promise<Contradiction[]>;
211
+ /**
212
+ * Predict collapse risk for a swarm
213
+ */
214
+ predictCollapse(state: SwarmState): Promise<CollapseRisk>;
215
+ /**
216
+ * Fallback collapse prediction using simple heuristics
217
+ */
218
+ private predictCollapseWithFallback;
219
+ /**
220
+ * Verify a causal relationship
221
+ */
222
+ verifyCausality(cause: string, effect: string, data: CausalData): Promise<CausalVerification>;
223
+ /**
224
+ * Fallback causality verification using correlation
225
+ */
226
+ private verifyCausalityWithFallback;
227
+ /**
228
+ * Verify type consistency in a pipeline
229
+ */
230
+ verifyTypes(pipeline: TypedPipeline): Promise<TypeVerification>;
231
+ /**
232
+ * Fallback type verification using simple matching
233
+ */
234
+ private verifyTypesWithFallback;
235
+ /**
236
+ * Create a witness for a decision
237
+ */
238
+ createWitness(decision: Decision): Promise<WitnessRecord>;
239
+ /**
240
+ * Replay a decision from a witness
241
+ */
242
+ replayFromWitness(witnessId: string): Promise<ReplayResult>;
243
+ /**
244
+ * Check coherence of swarm agents
245
+ */
246
+ checkSwarmCoherence(agentHealth: Map<string, AgentHealth>): Promise<CoherenceResult>;
247
+ /**
248
+ * Verify multi-agent consensus
249
+ */
250
+ verifyConsensus(votes: AgentVote[]): Promise<ConsensusResult>;
251
+ /**
252
+ * Fallback consensus verification
253
+ */
254
+ private verifyConsensusWithFallback;
255
+ /**
256
+ * Filter items to only return coherent ones
257
+ */
258
+ filterCoherent<T extends HasEmbedding>(items: T[], context: unknown): Promise<T[]>;
259
+ /**
260
+ * Get service statistics
261
+ */
262
+ getStats(): CoherenceStats;
263
+ /**
264
+ * Dispose of service resources
265
+ */
266
+ dispose(): Promise<void>;
267
+ /**
268
+ * Compute the appropriate compute lane based on energy
269
+ */
270
+ private computeLane;
271
+ /**
272
+ * Update statistics after a coherence check
273
+ */
274
+ private updateStats;
275
+ /**
276
+ * Generate recommendations based on coherence result
277
+ */
278
+ private generateRecommendations;
279
+ /**
280
+ * Convert agent health to a numerical embedding
281
+ */
282
+ private agentHealthToEmbedding;
283
+ /**
284
+ * Convert agent type to a number for embedding
285
+ */
286
+ private agentTypeToNumber;
287
+ /**
288
+ * Compute Euclidean distance between two vectors
289
+ */
290
+ private euclideanDistance;
291
+ /**
292
+ * Compute cosine similarity between two vectors
293
+ */
294
+ private cosineSimilarity;
295
+ /**
296
+ * Compute Pearson correlation coefficient
297
+ */
298
+ private computeCorrelation;
299
+ /**
300
+ * Simple hash function for fallback
301
+ */
302
+ private simpleHash;
303
+ }
304
+ /**
305
+ * Create and initialize a CoherenceService
306
+ *
307
+ * @param wasmLoader - WASM module loader
308
+ * @param config - Optional service configuration
309
+ * @param logger - Optional logger
310
+ * @returns Initialized service
311
+ *
312
+ * @example
313
+ * ```typescript
314
+ * const service = await createCoherenceService(wasmLoader);
315
+ *
316
+ * const result = await service.checkCoherence(nodes);
317
+ * if (!result.isCoherent) {
318
+ * console.log('Contradictions:', result.contradictions);
319
+ * }
320
+ * ```
321
+ */
322
+ export declare function createCoherenceService(wasmLoader: IWasmLoader, config?: Partial<CoherenceServiceConfig>, logger?: CoherenceLogger): Promise<CoherenceService>;
323
+ //# sourceMappingURL=coherence-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coherence-service.d.ts","sourceRoot":"","sources":["../../../src/integrations/coherence/coherence-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,cAAc,EAGd,MAAM,EACN,aAAa,EACb,UAAU,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,SAAS,EACT,eAAe,EACf,YAAY,EACZ,WAAW,EACX,eAAe,EAChB,MAAM,SAAS,CAAC;AAyBjB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B;;OAEG;IACH,aAAa,IAAI,OAAO,CAAC;IAEzB;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEjE;;;;;OAKG;IACH,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAElE;;;;;OAKG;IACH,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAE1D;;;;;;;OAOG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAA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