agentic-qe 3.14.4 → 3.14.6

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 (486) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +169 -0
  3. package/assets/skills/skills-manifest.json +1 -1
  4. package/dist/adapters/ag-ui/event-types.d.ts +1 -1
  5. package/dist/audit/witness-chain-hash.d.ts +18 -0
  6. package/dist/audit/witness-chain-hash.js +37 -0
  7. package/dist/audit/witness-chain-repair.d.ts +71 -0
  8. package/dist/audit/witness-chain-repair.js +203 -0
  9. package/dist/audit/witness-chain-verifier.d.ts +152 -0
  10. package/dist/audit/witness-chain-verifier.js +293 -0
  11. package/dist/audit/witness-chain.d.ts +10 -43
  12. package/dist/audit/witness-chain.js +43 -126
  13. package/dist/audit/witness-findings.js +4 -1
  14. package/dist/cli/bundle.js +13 -10
  15. package/dist/cli/chunks/adapter-UYOJPTOX.js +2 -0
  16. package/dist/cli/chunks/agent-booster-wasm-2YGML6OU.js +2 -0
  17. package/dist/cli/chunks/{agent-handler-RDNTK4CA.js → agent-handler-D5SSQYNU.js} +2 -2
  18. package/dist/cli/chunks/{agent-memory-branch-NAAMBWIR.js → agent-memory-branch-YHPLTITV.js} +2 -2
  19. package/dist/cli/chunks/aqe-learning-engine-JR5AVQXR.js +2 -0
  20. package/dist/cli/chunks/{arena-KXFHRWX4.js → arena-7BGOXGXO.js} +2 -2
  21. package/dist/cli/chunks/{arena-HXTWJ5YY.js → arena-MCE6EU7K.js} +4 -4
  22. package/dist/cli/chunks/audit-BMWTQECB.js +4 -0
  23. package/dist/cli/chunks/base-DRZ2LS6X.js +2 -0
  24. package/dist/cli/chunks/{better-sqlite3-UICJZIDG.js → better-sqlite3-PMUNGASU.js} +2 -2
  25. package/dist/cli/chunks/brain-handler-QPUFYX7F.js +94 -0
  26. package/dist/cli/chunks/{branch-enumerator-SS7UNVIA.js → branch-enumerator-WKFDGRN4.js} +2 -2
  27. package/dist/cli/chunks/{browser-77GI6KBE.js → browser-VY5HKH5X.js} +2 -2
  28. package/dist/cli/chunks/browser-workflow-CJ7T3MXF.js +2 -0
  29. package/dist/cli/chunks/{chunk-PZJOPURC.js → chunk-257E2A5M.js} +5 -5
  30. package/dist/cli/chunks/{chunk-55RWDRJD.js → chunk-2JVWITNK.js} +4 -4
  31. package/dist/cli/chunks/{chunk-BOARZKU3.js → chunk-2NPKIBAZ.js} +2 -2
  32. package/dist/cli/chunks/chunk-2TMWAQQ3.js +13 -0
  33. package/dist/cli/chunks/{chunk-M4WJKGVK.js → chunk-2YXGBZWV.js} +1 -1
  34. package/dist/cli/chunks/{chunk-3VOQRIQM.js → chunk-3EA536JF.js} +2 -2
  35. package/dist/cli/chunks/{chunk-ZZDIMOOV.js → chunk-3EZOZN25.js} +2 -2
  36. package/dist/cli/chunks/{chunk-MNW6QGNJ.js → chunk-3HZS4M3O.js} +2 -2
  37. package/dist/cli/chunks/{chunk-EKQ673SA.js → chunk-3NIG7S5W.js} +1 -1
  38. package/dist/cli/chunks/{chunk-7D777LTF.js → chunk-4N23RFDU.js} +2 -2
  39. package/dist/cli/chunks/{chunk-BOZZYWCR.js → chunk-5J6W7SIA.js} +1 -1
  40. package/dist/cli/chunks/{chunk-HIVA55CJ.js → chunk-5OOMJGFN.js} +1 -1
  41. package/dist/cli/chunks/{chunk-W7BWUTVV.js → chunk-5QQSIGUA.js} +2 -2
  42. package/dist/cli/chunks/{chunk-PAWXJ73E.js → chunk-5VFPCSK7.js} +1 -1
  43. package/dist/cli/chunks/{chunk-KPA7MZ6C.js → chunk-62N4NUJH.js} +2 -2
  44. package/dist/cli/chunks/chunk-64VGZQLB.js +2 -0
  45. package/dist/cli/chunks/{chunk-64PFWE2F.js → chunk-66VWCR67.js} +2 -2
  46. package/dist/cli/chunks/{chunk-XRT2WRMS.js → chunk-6LIHFV7O.js} +2 -2
  47. package/dist/cli/chunks/{chunk-STJCATGN.js → chunk-6OS76PHI.js} +2 -2
  48. package/dist/cli/chunks/{chunk-ZNPKDCZR.js → chunk-6RE3X4V5.js} +2 -2
  49. package/dist/cli/chunks/{chunk-BFP7KO7P.js → chunk-6SH5VZUD.js} +2 -2
  50. package/dist/cli/chunks/chunk-6SQM2MUX.js +4 -0
  51. package/dist/cli/chunks/{chunk-IPR4QP3H.js → chunk-6U7LNMWZ.js} +2 -2
  52. package/dist/cli/chunks/{chunk-MIQTXNBG.js → chunk-72KXSMWI.js} +1 -1
  53. package/dist/cli/chunks/chunk-7CUQCCMD.js +27 -0
  54. package/dist/cli/chunks/chunk-7D3V65N5.js +2 -0
  55. package/dist/cli/chunks/{chunk-JZ3ORVZ3.js → chunk-7J6QC567.js} +3 -3
  56. package/dist/cli/chunks/{chunk-4OYFXLBK.js → chunk-7LPR6HJG.js} +2 -2
  57. package/dist/cli/chunks/{chunk-4MHXCAG2.js → chunk-7NITCZWD.js} +1 -1
  58. package/dist/cli/chunks/{chunk-M5QUBZY6.js → chunk-7Z5LHRC3.js} +2 -2
  59. package/dist/cli/chunks/{chunk-CSU5NYOX.js → chunk-AHKELLIO.js} +4 -4
  60. package/dist/cli/chunks/{chunk-DHJPWQBR.js → chunk-AIRGNL55.js} +2 -2
  61. package/dist/cli/chunks/{chunk-C2WU3533.js → chunk-AJRUJAAK.js} +1 -1
  62. package/dist/cli/chunks/{chunk-HIYXCDEP.js → chunk-AVBJYI5I.js} +1 -1
  63. package/dist/cli/chunks/{chunk-U5K45TFH.js → chunk-B6D2CHEH.js} +1 -1
  64. package/dist/cli/chunks/{chunk-FRH6VAUS.js → chunk-B6MOJC3X.js} +1 -1
  65. package/dist/cli/chunks/{chunk-HUWNIPZ5.js → chunk-BAMN2CHI.js} +1 -1
  66. package/dist/cli/chunks/{chunk-ONII3572.js → chunk-BBT64TII.js} +3 -3
  67. package/dist/cli/chunks/{chunk-KSKEF7LZ.js → chunk-BJTJLJRZ.js} +3 -3
  68. package/dist/cli/chunks/chunk-BMAPORJ7.js +15 -0
  69. package/dist/cli/chunks/{chunk-CIZ5JPDC.js → chunk-BPEDWS6O.js} +3 -3
  70. package/dist/cli/chunks/{chunk-Z3RHREWF.js → chunk-BVR7RMC5.js} +1 -1
  71. package/dist/cli/chunks/{chunk-HDSAM2RE.js → chunk-C6KWXUFJ.js} +2 -2
  72. package/dist/cli/chunks/{chunk-ZBAKA4YB.js → chunk-CCK4BF76.js} +1 -1
  73. package/dist/cli/chunks/{chunk-IFCLB7FJ.js → chunk-CD542DNJ.js} +1 -1
  74. package/dist/cli/chunks/{chunk-6KJABXAR.js → chunk-CF2ISEOJ.js} +2 -2
  75. package/dist/cli/chunks/chunk-CM7U6TAX.js +5 -0
  76. package/dist/cli/chunks/{chunk-3X3DJZJJ.js → chunk-D45SG6CP.js} +1 -1
  77. package/dist/cli/chunks/{chunk-DAEFDCJ4.js → chunk-D6CJIGRU.js} +89 -83
  78. package/dist/cli/chunks/{chunk-MVPCNSPY.js → chunk-DBDPRORT.js} +2 -2
  79. package/dist/cli/chunks/{chunk-AUXFKCQL.js → chunk-DHVX5UB2.js} +2 -2
  80. package/dist/cli/chunks/{chunk-GPLQ6DOK.js → chunk-DK4XN4CU.js} +2 -2
  81. package/dist/cli/chunks/{chunk-SRKETSFF.js → chunk-DPYSUDAO.js} +1 -1
  82. package/dist/cli/chunks/{chunk-CNG6GQEZ.js → chunk-DUYOVM5I.js} +2 -2
  83. package/dist/cli/chunks/{chunk-VIHTL3U2.js → chunk-DZ3AUAAB.js} +2 -2
  84. package/dist/cli/chunks/{chunk-CU46J64M.js → chunk-E6G2RD5H.js} +2 -2
  85. package/dist/cli/chunks/{chunk-5YPYDPBJ.js → chunk-EAY2JMZG.js} +2 -2
  86. package/dist/cli/chunks/{chunk-V3QLFNA2.js → chunk-ELLBS5RP.js} +4 -4
  87. package/dist/cli/chunks/chunk-ENGZ4D5V.js +2 -0
  88. package/dist/cli/chunks/chunk-FBMN7B46.js +4 -0
  89. package/dist/cli/chunks/{chunk-EDJ3O7RH.js → chunk-FWASDOT2.js} +2 -2
  90. package/dist/cli/chunks/{chunk-MDWCE7YW.js → chunk-FZOBD67M.js} +1 -1
  91. package/dist/cli/chunks/{chunk-A4FYONNU.js → chunk-GDSXITFH.js} +2 -2
  92. package/dist/cli/chunks/{chunk-2JW3BCGG.js → chunk-GGRHV6D7.js} +1 -1
  93. package/dist/cli/chunks/{chunk-ISDMD6EU.js → chunk-GPYVDFB3.js} +90 -90
  94. package/dist/cli/chunks/{chunk-CDKG6EI7.js → chunk-GSF6MB64.js} +2 -2
  95. package/dist/cli/chunks/{chunk-WLG5AJ4N.js → chunk-H52HZ67P.js} +2 -2
  96. package/dist/cli/chunks/{chunk-FGYMFUE2.js → chunk-H5BS5VH7.js} +2 -2
  97. package/dist/cli/chunks/{chunk-34WO57CW.js → chunk-H6ZM3PUT.js} +1 -1
  98. package/dist/cli/chunks/{chunk-6CQN24ZK.js → chunk-HM6ZSCPI.js} +1 -1
  99. package/dist/cli/chunks/{chunk-DPFRKBOG.js → chunk-HNFVJP4I.js} +2 -2
  100. package/dist/cli/chunks/{chunk-TPGED2IF.js → chunk-I33ERSGB.js} +2 -2
  101. package/dist/cli/chunks/{chunk-UEM7ZF5K.js → chunk-IAF6T27S.js} +2 -2
  102. package/dist/cli/chunks/{chunk-KCZR45PA.js → chunk-IB27QACC.js} +2 -2
  103. package/dist/cli/chunks/{chunk-SGYJ4NFZ.js → chunk-ICTXTNQZ.js} +1 -1
  104. package/dist/cli/chunks/chunk-IG5GNEC6.js +4 -0
  105. package/dist/cli/chunks/{chunk-KHFNNVJA.js → chunk-IQO7UCFR.js} +2 -2
  106. package/dist/cli/chunks/{chunk-3TW5W5LX.js → chunk-IV5UZOHH.js} +2 -2
  107. package/dist/cli/chunks/{chunk-7ZIOFPL3.js → chunk-JBTPOIAC.js} +2 -2
  108. package/dist/cli/chunks/{chunk-ZNEMGX5O.js → chunk-JIXUMYKZ.js} +1 -1
  109. package/dist/cli/chunks/{chunk-MTZH7AHC.js → chunk-JMONHE4B.js} +1 -1
  110. package/dist/cli/chunks/{chunk-TDZ53WO2.js → chunk-JVNTSNWU.js} +2 -2
  111. package/dist/cli/chunks/{chunk-PFR4G3DJ.js → chunk-JXGFRBUO.js} +2 -2
  112. package/dist/cli/chunks/chunk-JZOS5FCX.js +2 -0
  113. package/dist/cli/chunks/{chunk-STM3UDNO.js → chunk-KNNISEDY.js} +2 -2
  114. package/dist/cli/chunks/{chunk-TWAWHOP7.js → chunk-L4RUBPLR.js} +2 -2
  115. package/dist/cli/chunks/chunk-LL3IGZBI.js +2 -0
  116. package/dist/cli/chunks/{chunk-CIKSHTEQ.js → chunk-MBRHSU6W.js} +10 -10
  117. package/dist/cli/chunks/{chunk-G6T45OIC.js → chunk-MJS53PRX.js} +2 -2
  118. package/dist/cli/chunks/{chunk-PO3IXGMQ.js → chunk-MQROI74N.js} +2 -2
  119. package/dist/cli/chunks/{chunk-DOTK76IJ.js → chunk-MUOG6QXR.js} +2 -2
  120. package/dist/cli/chunks/{chunk-MVNP7GIR.js → chunk-MW2GGZZ5.js} +1 -1
  121. package/dist/cli/chunks/{chunk-FWGOHAAB.js → chunk-NHWGMJAP.js} +2 -2
  122. package/dist/cli/chunks/{chunk-ZBJ4XOOV.js → chunk-NMAIY4PX.js} +4 -4
  123. package/dist/cli/chunks/{chunk-CDHQFHRP.js → chunk-NQZ5AR3D.js} +2 -2
  124. package/dist/cli/chunks/{chunk-FLYOJOKN.js → chunk-P6OYS755.js} +1 -1
  125. package/dist/cli/chunks/{chunk-BGE6FOLM.js → chunk-PI7TJS62.js} +2 -2
  126. package/dist/cli/chunks/chunk-PX5YDCRH.js +4 -0
  127. package/dist/cli/chunks/{chunk-Q5DO24IJ.js → chunk-PZPWRQ2M.js} +3 -3
  128. package/dist/cli/chunks/{chunk-R4VL6E65.js → chunk-Q5XTSMWR.js} +2 -2
  129. package/dist/cli/chunks/{chunk-JBNEE5UH.js → chunk-Q7EAGKAE.js} +2 -2
  130. package/dist/cli/chunks/{chunk-R5NE6B2M.js → chunk-QDFTT3RF.js} +2 -2
  131. package/dist/cli/chunks/{chunk-DFZCKIGY.js → chunk-QGA55PFM.js} +3 -3
  132. package/dist/cli/chunks/{chunk-RJCYCLZV.js → chunk-QW6VMTBR.js} +2 -2
  133. package/dist/cli/chunks/{chunk-6VRA2QGL.js → chunk-QZANMBIT.js} +1 -1
  134. package/dist/cli/chunks/{chunk-MEGDYJPV.js → chunk-RETBYIAC.js} +4 -4
  135. package/dist/cli/chunks/{chunk-XJ7QNVI5.js → chunk-RFNPJK6N.js} +3 -3
  136. package/dist/cli/chunks/{chunk-NJBGXDQ7.js → chunk-RG52OKAM.js} +1 -1
  137. package/dist/cli/chunks/{chunk-DA5K5754.js → chunk-RSXXCL4A.js} +1 -1
  138. package/dist/cli/chunks/{chunk-HV2J7KKQ.js → chunk-RTFO5UQH.js} +2 -2
  139. package/dist/cli/chunks/{chunk-6UWGMOND.js → chunk-RZZCUIAI.js} +2 -2
  140. package/dist/cli/chunks/chunk-SDRHUMJB.js +2 -0
  141. package/dist/cli/chunks/{chunk-TSRSV3LD.js → chunk-SE4WIB26.js} +1 -1
  142. package/dist/cli/chunks/{chunk-ODKLFVYC.js → chunk-SESK3ARK.js} +2 -2
  143. package/dist/cli/chunks/{chunk-AWWNB2T7.js → chunk-SJUXE4IC.js} +2 -2
  144. package/dist/cli/chunks/{chunk-QGIU2WRL.js → chunk-SMDN3BQZ.js} +1 -1
  145. package/dist/cli/chunks/{chunk-VD6QRULW.js → chunk-SNOBH4AZ.js} +2 -2
  146. package/dist/cli/chunks/{chunk-OSLYSG3B.js → chunk-SPV2VKC5.js} +2 -2
  147. package/dist/cli/chunks/chunk-TCHGOB2N.js +2 -0
  148. package/dist/cli/chunks/{chunk-MOBNBMFW.js → chunk-TVYY3OCX.js} +1 -1
  149. package/dist/cli/chunks/{chunk-UGVHCMUN.js → chunk-UCFQALXO.js} +3 -3
  150. package/dist/cli/chunks/{chunk-3QHGWY7T.js → chunk-UKA2KOXE.js} +2 -2
  151. package/dist/cli/chunks/{chunk-MCUJEZT6.js → chunk-UNFFDHER.js} +16 -11
  152. package/dist/cli/chunks/{chunk-6QYNWR7U.js → chunk-UQ32JHES.js} +2 -2
  153. package/dist/cli/chunks/{chunk-OULHKEVH.js → chunk-V4DM6ELU.js} +2 -2
  154. package/dist/cli/chunks/{chunk-M2JBBZQB.js → chunk-VGFFFKGK.js} +2 -2
  155. package/dist/cli/chunks/{chunk-OCWWP5PL.js → chunk-VMNWDJIZ.js} +2 -2
  156. package/dist/cli/chunks/chunk-W6HXLH5G.js +180 -0
  157. package/dist/cli/chunks/{chunk-AIHDEEJO.js → chunk-WCJBU2KI.js} +2 -2
  158. package/dist/cli/chunks/{chunk-ZBQY5GLF.js → chunk-WGM35YWL.js} +2 -2
  159. package/dist/cli/chunks/chunk-WO4QMXIG.js +3 -0
  160. package/dist/cli/chunks/{chunk-3UPAMMCB.js → chunk-XAS3XRYM.js} +1 -1
  161. package/dist/cli/chunks/chunk-Y3LZ35OG.js +2 -0
  162. package/dist/cli/chunks/{chunk-5R3QL7WN.js → chunk-Y3UOUNHM.js} +2 -2
  163. package/dist/cli/chunks/{chunk-ZJ26AQA5.js → chunk-YFBSPLJG.js} +1 -1
  164. package/dist/cli/chunks/{chunk-BDESSCVR.js → chunk-YHKEDEAA.js} +3 -3
  165. package/dist/cli/chunks/{chunk-CXQPR5MY.js → chunk-YS4FCTWF.js} +1 -1
  166. package/dist/cli/chunks/{chunk-CLTMDCSE.js → chunk-YSLL6VSL.js} +2 -2
  167. package/dist/cli/chunks/chunk-Z6GGIRQQ.js +65 -0
  168. package/dist/cli/chunks/{chunk-F3SBRQC6.js → chunk-Z7WODOTH.js} +2 -2
  169. package/dist/cli/chunks/chunk-ZCRTRYXK.js +14 -0
  170. package/dist/cli/chunks/{chunk-XRYF6JV7.js → chunk-ZEV3YTO7.js} +2 -2
  171. package/dist/cli/chunks/{chunk-YNXS6CGV.js → chunk-ZL6SYKUK.js} +1 -1
  172. package/dist/cli/chunks/{chunk-5SJHQ2CO.js → chunk-ZSPU4MOS.js} +2 -2
  173. package/dist/cli/chunks/{chunk-UDHKLT4C.js → chunk-ZVWVV4EX.js} +1 -1
  174. package/dist/cli/chunks/{ci-464KPQNP.js → ci-W6K6G2KZ.js} +2 -2
  175. package/dist/cli/chunks/{ci-output-I7FX2RSO.js → ci-output-LDT24TS3.js} +2 -2
  176. package/dist/cli/chunks/{circuit-breaker-3FW237WW.js → circuit-breaker-F5V4KITU.js} +2 -2
  177. package/dist/cli/chunks/claude-flow-setup-DT6WQQVD.js +2 -0
  178. package/dist/cli/chunks/client-KHWJT6FB.js +2 -0
  179. package/dist/cli/chunks/{cline-installer-UWFHT6VY.js → cline-installer-G7TJOAEX.js} +2 -2
  180. package/dist/cli/chunks/{code-KQSUT3FS.js → code-PGE6A42V.js} +3 -3
  181. package/dist/cli/chunks/{code-index-extractor-PABBNUSC.js → code-index-extractor-RNITH372.js} +2 -2
  182. package/dist/cli/chunks/codex-installer-LBX77AI3.js +14 -0
  183. package/dist/cli/chunks/{completions-7RWHAUAR.js → completions-4AWLAARX.js} +2 -2
  184. package/dist/cli/chunks/{complexity-analyzer-XPOAF33E.js → complexity-analyzer-ZPNSS476.js} +2 -2
  185. package/dist/cli/chunks/{continuedev-installer-V4F2FIZP.js → continuedev-installer-UAPWX6OA.js} +2 -2
  186. package/dist/cli/chunks/{copilot-installer-JMICURQB.js → copilot-installer-BJN2YJGI.js} +2 -2
  187. package/dist/cli/chunks/core-handlers-HING5RRG.js +2 -0
  188. package/dist/cli/chunks/{cost-tracker-5OFHEYFJ.js → cost-tracker-MHP2VJ63.js} +2 -2
  189. package/dist/cli/chunks/{coverage-QKN57JDS.js → coverage-PQB4IEFG.js} +3 -3
  190. package/dist/cli/chunks/cross-domain-router-PQTD6AZN.js +2 -0
  191. package/dist/cli/chunks/{cursor-installer-GBJ7YXSM.js → cursor-installer-ZXBWYAS3.js} +2 -2
  192. package/dist/cli/chunks/{daemon-GKP7CMEK.js → daemon-64C7R6OJ.js} +3 -3
  193. package/dist/cli/chunks/{daemon-IAVSO6HK.js → daemon-N2BEGEFY.js} +4 -4
  194. package/dist/cli/chunks/{dag-attention-scheduler-S225TCI7.js → dag-attention-scheduler-SPZDAPNL.js} +2 -2
  195. package/dist/cli/chunks/{detect-IUYH422U.js → detect-LXJBSSZW.js} +2 -2
  196. package/dist/cli/chunks/{dist-node-2YRE6A7C.js → dist-node-U3TKZ2IZ.js} +2 -2
  197. package/dist/cli/chunks/{domain-handler-PL2TZC6H.js → domain-handler-3DDWUVSR.js} +2 -2
  198. package/dist/cli/chunks/{domain-plugins-HCGLXKIT.js → domain-plugins-JJVWI4OQ.js} +2 -2
  199. package/dist/cli/chunks/domain-transfer-M36KUJ2U.js +2 -0
  200. package/dist/cli/chunks/dream-WUGRSNCV.js +2 -0
  201. package/dist/cli/chunks/embed-and-insert-pattern-JPAR7TXX.js +3 -0
  202. package/dist/cli/chunks/{eval-WCK7KNFN.js → eval-SOLG23EA.js} +2 -2
  203. package/dist/cli/chunks/{experience-capture-middleware-2MSQWSAR.js → experience-capture-middleware-T7G2VOOD.js} +4 -4
  204. package/dist/cli/chunks/{fast-paths-VYOSIBKF.js → fast-paths-32N3ELI4.js} +2 -2
  205. package/dist/cli/chunks/{feature-flags-WCFUKHNQ.js → feature-flags-APJDQ4N7.js} +2 -2
  206. package/dist/cli/chunks/{feature-flags-UJRHFBRX.js → feature-flags-NAHKLDRN.js} +2 -2
  207. package/dist/cli/chunks/{file-discovery-JDGL4ZWS.js → file-discovery-YKVM3MDB.js} +2 -2
  208. package/dist/cli/chunks/{fleet-ROXVMZ2F.js → fleet-55M5CJS4.js} +3 -3
  209. package/dist/cli/chunks/{gnn-wrapper-NIO4ZCO3.js → gnn-wrapper-UD6E6S6Z.js} +2 -2
  210. package/dist/cli/chunks/{heartbeat-handler-PI42WD3C.js → heartbeat-handler-OYVW3VSC.js} +4 -4
  211. package/dist/cli/chunks/heartbeat-scheduler-33XX5XNQ.js +2 -0
  212. package/dist/cli/chunks/hnsw-adapter-XQPERX3H.js +2 -0
  213. package/dist/cli/chunks/hnsw-index-2GNXTWHH.js +2 -0
  214. package/dist/cli/chunks/{hnsw-legacy-bridge-YLC7SPK2.js → hnsw-legacy-bridge-HBYIS3ZW.js} +2 -2
  215. package/dist/cli/chunks/{hnswlib-node-LG6OS3B7.js → hnswlib-node-EQPM42OU.js} +2 -2
  216. package/dist/cli/chunks/{hooks-WVALP5GX.js → hooks-5ZSSJWO6.js} +10 -10
  217. package/dist/cli/chunks/hybrid-backend-CCF7URKI.js +2 -0
  218. package/dist/cli/chunks/{hypergraph-engine-GJEMW3EG.js → hypergraph-engine-XBGVQ4PD.js} +2 -2
  219. package/dist/cli/chunks/{hypergraph-handler-BLF6LXEV.js → hypergraph-handler-CAWAQ673.js} +3 -3
  220. package/dist/cli/chunks/impact-analyzer-HGKAZWIG.js +2 -0
  221. package/dist/cli/chunks/{init-handler-K25RWRYY.js → init-handler-PRHXSARK.js} +6 -6
  222. package/dist/cli/chunks/init-wizard-72MFBI3G.js +2 -0
  223. package/dist/cli/chunks/kernel-BRCBVMSK.js +2 -0
  224. package/dist/cli/chunks/{kilocode-installer-BXN6WZ7G.js → kilocode-installer-F7LXBM7I.js} +2 -2
  225. package/dist/cli/chunks/{kiro-installer-PM362DLN.js → kiro-installer-NM723ZRG.js} +2 -2
  226. package/dist/cli/chunks/knowledge-graph-DG44IPEI.js +2 -0
  227. package/dist/cli/chunks/{learning-CPERDDRG.js → learning-5QYIDHH3.js} +3 -3
  228. package/dist/cli/chunks/{llm-router-GOAV5FPI.js → llm-router-43HKWPSX.js} +4 -4
  229. package/dist/cli/chunks/llm-router-service-24KXFX32.js +2 -0
  230. package/dist/cli/chunks/{load-2BG6SHAK.js → load-5YDBWSCS.js} +2 -2
  231. package/dist/cli/chunks/load-test-N4TAYJY3.js +2 -0
  232. package/dist/cli/chunks/mcp-UMAPMNMY.js +2 -0
  233. package/dist/cli/chunks/{memory-4NHBYT6S.js → memory-FWCPCQFP.js} +6 -6
  234. package/dist/cli/chunks/memory-backend-NVYFYVAU.js +2 -0
  235. package/dist/cli/chunks/memory-handlers-UTWCNCHL.js +2 -0
  236. package/dist/cli/chunks/multi-model-executor-2XTBGLE4.js +14 -0
  237. package/dist/cli/chunks/{opencode-installer-ATZLLK74.js → opencode-installer-GIXOJ6NS.js} +2 -2
  238. package/dist/cli/chunks/orchestrator-VW6BKHLI.js +393 -0
  239. package/dist/cli/chunks/pattern-null-store-SBPNYDBR.js +2 -0
  240. package/dist/cli/chunks/{pattern-usage-recorder-7VE4XDAI.js → pattern-usage-recorder-7CEUC3J7.js} +2 -2
  241. package/dist/cli/chunks/{pipeline-LQZSNDD2.js → pipeline-IGUQPPPO.js} +2 -2
  242. package/dist/cli/chunks/platform-2P636I7B.js +2 -0
  243. package/dist/cli/chunks/{plugin-EJ6K2MGU.js → plugin-NY6SWDPE.js} +2 -2
  244. package/dist/cli/chunks/{prime-radiant-advanced-wasm-OIHTKJMN.js → prime-radiant-advanced-wasm-2UUDTIO2.js} +2 -2
  245. package/dist/cli/chunks/project-root-IOISG5KX.js +2 -0
  246. package/dist/cli/chunks/protocol-executor-IBYEII5Q.js +2 -0
  247. package/dist/cli/chunks/{protocol-handler-NRBROAU7.js → protocol-handler-ZTPCRQ5W.js} +2 -2
  248. package/dist/cli/chunks/{prove-EJOGEGD3.js → prove-SQX5A3IG.js} +2 -2
  249. package/dist/cli/chunks/qe-reasoning-bank-7IETWW6W.js +2 -0
  250. package/dist/cli/chunks/{quality-E55UC73D.js → quality-DROILKRY.js} +2 -2
  251. package/dist/cli/chunks/{quality-gate-OIQATNT3.js → quality-gate-PWKWDJY2.js} +3 -3
  252. package/dist/cli/chunks/queen-coordinator-NHUK2MWJ.js +2 -0
  253. package/dist/cli/chunks/real-embeddings-P5U3MGYC.js +2 -0
  254. package/dist/cli/chunks/{ref-validation-OPO6J7OL.js → ref-validation-KY73NQXD.js} +2 -2
  255. package/dist/cli/chunks/{roocode-installer-ODY5KRWU.js → roocode-installer-6JPPRB3W.js} +2 -2
  256. package/dist/cli/chunks/router-SRSO3IHF.js +2 -0
  257. package/dist/cli/chunks/routing-feedback-PASRE5HY.js +2 -0
  258. package/dist/cli/chunks/{routing-handler-KQM6VWLC.js → routing-handler-VTJIVFUO.js} +2 -2
  259. package/dist/cli/chunks/{ruvector-commands-U2GVV6PF.js → ruvector-commands-C6RPSJJO.js} +2 -2
  260. package/dist/cli/chunks/rvf-dual-writer-4M4J67OU.js +2 -0
  261. package/dist/cli/chunks/rvf-migration-adapter-TSXGT5LF.js +2 -0
  262. package/dist/cli/chunks/rvf-migration-coordinator-R53URRIO.js +2 -0
  263. package/dist/cli/chunks/rvf-native-adapter-MOF3E7BR.js +2 -0
  264. package/dist/cli/chunks/{rvf-store-integrity-KMIHD3LP.js → rvf-store-integrity-MMXN5TEJ.js} +2 -2
  265. package/dist/cli/chunks/safe-db-QJLFO33B.js +2 -0
  266. package/dist/cli/chunks/schedule-YIVXW5O2.js +2 -0
  267. package/dist/cli/chunks/scheduler-AON7DWSJ.js +2 -0
  268. package/dist/cli/chunks/{security-P5NM353C.js → security-3B3R2NL4.js} +3 -3
  269. package/dist/cli/chunks/shared-rvf-adapter-VIJB7JUS.js +2 -0
  270. package/dist/cli/chunks/{shared-rvf-dual-writer-2CSG7C4W.js → shared-rvf-dual-writer-UVWGDUWC.js} +2 -2
  271. package/dist/cli/chunks/sqlite-persistence-75VHKKQB.js +2 -0
  272. package/dist/cli/chunks/standalone-memory-M4LWAAYZ.js +2 -0
  273. package/dist/cli/chunks/{status-handler-6TU6O37R.js → status-handler-YYFV6OZL.js} +2 -2
  274. package/dist/cli/chunks/{structural-health-KBIJSTXJ.js → structural-health-27E6LLKB.js} +2 -2
  275. package/dist/cli/chunks/sync-26CEGSTC.js +2 -0
  276. package/dist/cli/chunks/{sync-LNHI5SB7.js → sync-J3LJ56WN.js} +2 -2
  277. package/dist/cli/chunks/task-handler-4MCEBQZL.js +54 -0
  278. package/dist/cli/chunks/task-handlers-GYBAWKE2.js +9 -0
  279. package/dist/cli/chunks/{test-DHAAI3DU.js → test-MPC5HRH5.js} +4 -4
  280. package/dist/cli/chunks/{test-scheduling-XDBZ3QC2.js → test-scheduling-ZJBFRZ3J.js} +3 -3
  281. package/dist/cli/chunks/token-bootstrap-2Y2XITBX.js +2 -0
  282. package/dist/cli/chunks/{token-usage-Q2YG5YQN.js → token-usage-3X5WMTG2.js} +2 -2
  283. package/dist/cli/chunks/{transformers-F5UQTQCY.js → transformers-MVL4C5IX.js} +2 -2
  284. package/dist/cli/chunks/tree-sitter-wasm-parser-SLW65ZFO.js +2 -0
  285. package/dist/cli/chunks/{types-JQ7EQO5Q.js → types-TG5P3CRS.js} +2 -2
  286. package/dist/cli/chunks/unified-memory-UCQ6AB32.js +2 -0
  287. package/dist/cli/chunks/unified-memory-hnsw-IXYUMKRR.js +2 -0
  288. package/dist/cli/chunks/unified-persistence-7E6JQ4FZ.js +2 -0
  289. package/dist/cli/chunks/{upgrade-TJRVGHGD.js → upgrade-ETBHDEPY.js} +2 -2
  290. package/dist/cli/chunks/{validate-BWPCVHBN.js → validate-C2A73LZK.js} +2 -2
  291. package/dist/cli/chunks/{validate-swarm-QVVKCQLP.js → validate-swarm-67XN42ML.js} +2 -2
  292. package/dist/cli/chunks/{vibium-ZFATIWHO.js → vibium-NILGKHLN.js} +2 -2
  293. package/dist/cli/chunks/visual-security-4VZXPEVG.js +2 -0
  294. package/dist/cli/chunks/{web-tree-sitter-KPLY7ONR.js → web-tree-sitter-USJN77P4.js} +2 -2
  295. package/dist/cli/chunks/{windsurf-installer-H7XM7ISA.js → windsurf-installer-5GGZXGJW.js} +2 -2
  296. package/dist/cli/chunks/witness-chain-IWS5ZHHL.js +2 -0
  297. package/dist/cli/chunks/witness-chain-JQA2VPZI.js +2 -0
  298. package/dist/cli/chunks/witness-chain-repair-4UA7IPS3.js +2 -0
  299. package/dist/cli/chunks/witness-chain-verifier-3GEADWPE.js +2 -0
  300. package/dist/cli/chunks/{witness-key-manager-DFRL42GE.js → witness-key-manager-ZWEIK3VJ.js} +2 -2
  301. package/dist/cli/chunks/{workflow-2ZQO6WYI.js → workflow-KHMVVBBA.js} +4 -4
  302. package/dist/cli/chunks/workflow-orchestrator-GI5NQH7C.js +2 -0
  303. package/dist/cli/chunks/wrappers-N6XIK5PT.js +2 -0
  304. package/dist/cli/commands/audit.d.ts +20 -2
  305. package/dist/cli/commands/audit.js +158 -16
  306. package/dist/cli/commands/claude-flow-setup.js +5 -4
  307. package/dist/cli/commands/mcp.js +6 -0
  308. package/dist/cli/commands/memory.d.ts +1 -1
  309. package/dist/cli/commands/memory.js +8 -8
  310. package/dist/cli/commands/platform.js +15 -2
  311. package/dist/cli/commands/upgrade.d.ts +3 -3
  312. package/dist/cli/commands/upgrade.js +3 -3
  313. package/dist/cli/handlers/init-handler.d.ts +10 -0
  314. package/dist/cli/handlers/task-handler.js +24 -3
  315. package/dist/cli/helpers/standalone-memory.d.ts +12 -0
  316. package/dist/cli/helpers/standalone-memory.js +46 -0
  317. package/dist/cli/index.js +39 -42
  318. package/dist/cli/log-gate.d.ts +66 -0
  319. package/dist/cli/log-gate.js +170 -0
  320. package/dist/init/agents-installer.d.ts +4 -0
  321. package/dist/init/agents-installer.js +24 -11
  322. package/dist/init/codex-installer.js +22 -8
  323. package/dist/init/idempotent-write.d.ts +53 -0
  324. package/dist/init/idempotent-write.js +160 -0
  325. package/dist/init/orchestrator.js +1 -0
  326. package/dist/init/phases/05-learning.js +3 -1
  327. package/dist/init/phases/07-hooks.js +32 -16
  328. package/dist/init/phases/08-mcp.js +4 -2
  329. package/dist/init/phases/09-assets.d.ts +10 -0
  330. package/dist/init/phases/09-assets.js +3 -0
  331. package/dist/init/phases/10-workers.js +7 -5
  332. package/dist/init/phases/12-verification.js +7 -2
  333. package/dist/init/project-analyzer.d.ts +9 -0
  334. package/dist/init/project-analyzer.js +20 -1
  335. package/dist/init/self-configurator.d.ts +5 -3
  336. package/dist/init/self-configurator.js +18 -29
  337. package/dist/init/skills-installer.js +4 -2
  338. package/dist/init/token-bootstrap.d.ts +1 -1
  339. package/dist/init/token-bootstrap.js +12 -2
  340. package/dist/init/types.d.ts +16 -0
  341. package/dist/init/types.js +20 -24
  342. package/dist/integrations/coherence/coherence-service.js +84 -24
  343. package/dist/integrations/coherence/vote-tally.d.ts +38 -0
  344. package/dist/integrations/coherence/vote-tally.js +39 -0
  345. package/dist/integrations/ruvector/brain-exporter.js +17 -0
  346. package/dist/integrations/ruvector/brain-import-audit.d.ts +20 -0
  347. package/dist/integrations/ruvector/brain-import-audit.js +22 -0
  348. package/dist/integrations/ruvector/brain-rvf-exporter.js +16 -0
  349. package/dist/integrations/ruvector/brain-shared.js +1 -1
  350. package/dist/integrations/ruvector/rvf-dual-writer.js +6 -1
  351. package/dist/integrations/ruvector/shared-rvf-adapter.d.ts +23 -0
  352. package/dist/integrations/ruvector/shared-rvf-adapter.js +24 -0
  353. package/dist/kernel/hybrid-backend.d.ts +6 -0
  354. package/dist/kernel/hybrid-backend.js +18 -0
  355. package/dist/kernel/kernel.js +12 -16
  356. package/dist/kernel/project-root.d.ts +1 -1
  357. package/dist/kernel/project-root.js +24 -3
  358. package/dist/learning/embedder-identity-store.js +4 -3
  359. package/dist/learning/pattern-store.d.ts +11 -0
  360. package/dist/learning/pattern-store.js +31 -9
  361. package/dist/learning/qe-patterns.d.ts +6 -0
  362. package/dist/learning/qe-patterns.js +7 -1
  363. package/dist/learning/qe-reasoning-bank.js +3 -0
  364. package/dist/learning/real-embeddings.d.ts +8 -0
  365. package/dist/learning/real-embeddings.js +16 -0
  366. package/dist/learning/rvf-pattern-store.js +30 -10
  367. package/dist/learning/sqlite-persistence.d.ts +8 -1
  368. package/dist/learning/sqlite-persistence.js +49 -9
  369. package/dist/logging/console-logger.d.ts +2 -5
  370. package/dist/logging/console-logger.js +10 -46
  371. package/dist/logging/index.d.ts +2 -0
  372. package/dist/logging/index.js +1 -0
  373. package/dist/logging/redaction.d.ts +27 -0
  374. package/dist/logging/redaction.js +170 -0
  375. package/dist/mcp/bundle.js +463 -449
  376. package/dist/mcp/entry.js +2 -0
  377. package/dist/mcp/handlers/core-handlers.js +5 -4
  378. package/dist/mcp/handlers/memory-handlers.d.ts +6 -1
  379. package/dist/mcp/handlers/memory-handlers.js +44 -22
  380. package/dist/mcp/handlers/task-handlers.js +14 -1
  381. package/dist/mcp/protocol-server.js +3 -1
  382. package/dist/mcp/services/session-store.js +5 -1
  383. package/dist/mcp/tools/base.d.ts +9 -2
  384. package/dist/mcp/tools/base.js +7 -0
  385. package/dist/mcp/tools/coherence/consensus.js +51 -2
  386. package/dist/mcp/tools/planning/goap-plan.d.ts +20 -7
  387. package/dist/mcp/tools/planning/goap-plan.js +92 -20
  388. package/dist/mcp/tools/planning/goap-status.d.ts +37 -12
  389. package/dist/mcp/tools/planning/goap-status.js +52 -23
  390. package/dist/mcp/tools/planning/world-state.d.ts +101 -0
  391. package/dist/mcp/tools/planning/world-state.js +274 -0
  392. package/dist/mcp/types.d.ts +4 -2
  393. package/dist/planning/goap-planner.d.ts +60 -4
  394. package/dist/planning/goap-planner.js +218 -60
  395. package/dist/planning/index.d.ts +1 -1
  396. package/dist/planning/index.js +1 -1
  397. package/dist/planning/plan-executor.d.ts +20 -1
  398. package/dist/planning/plan-executor.js +209 -100
  399. package/dist/planning/types.d.ts +16 -0
  400. package/dist/planning/types.js +17 -0
  401. package/dist/plugins/cache.d.ts +2 -0
  402. package/dist/plugins/cache.js +15 -2
  403. package/dist/plugins/lifecycle.js +15 -2
  404. package/dist/plugins/manifest.js +7 -5
  405. package/dist/plugins/resolver.d.ts +13 -22
  406. package/dist/plugins/resolver.js +169 -61
  407. package/dist/plugins/version-policy.d.ts +13 -0
  408. package/dist/plugins/version-policy.js +18 -0
  409. package/dist/shared/types/index.d.ts +6 -0
  410. package/dist/shared/types/index.js +8 -0
  411. package/package.json +2 -1
  412. package/dist/cli/chunks/adapter-TNNNJRDG.js +0 -2
  413. package/dist/cli/chunks/agent-booster-wasm-5PC7D2FW.js +0 -2
  414. package/dist/cli/chunks/aqe-learning-engine-5ZRMYJLB.js +0 -2
  415. package/dist/cli/chunks/audit-YSGA7UWT.js +0 -3
  416. package/dist/cli/chunks/base-KWZHOPSH.js +0 -2
  417. package/dist/cli/chunks/brain-handler-ET6YAP4B.js +0 -90
  418. package/dist/cli/chunks/browser-workflow-2FZTKDUL.js +0 -2
  419. package/dist/cli/chunks/chunk-33YYYWBQ.js +0 -4
  420. package/dist/cli/chunks/chunk-5Z6XZV7K.js +0 -65
  421. package/dist/cli/chunks/chunk-6J62K3SW.js +0 -2
  422. package/dist/cli/chunks/chunk-6TPKK7LD.js +0 -15
  423. package/dist/cli/chunks/chunk-DEYLEDJN.js +0 -27
  424. package/dist/cli/chunks/chunk-J6GNQS62.js +0 -5
  425. package/dist/cli/chunks/chunk-KGT36Z42.js +0 -14
  426. package/dist/cli/chunks/chunk-NA7B2QYB.js +0 -2
  427. package/dist/cli/chunks/chunk-NDPFGIMJ.js +0 -13
  428. package/dist/cli/chunks/chunk-OBAP2TXZ.js +0 -2
  429. package/dist/cli/chunks/chunk-PEPFCPES.js +0 -2
  430. package/dist/cli/chunks/chunk-T6BVLVI5.js +0 -2
  431. package/dist/cli/chunks/chunk-TT23RRB7.js +0 -2
  432. package/dist/cli/chunks/chunk-XC7DYDSY.js +0 -180
  433. package/dist/cli/chunks/chunk-XWMZ6D6N.js +0 -2
  434. package/dist/cli/chunks/chunk-Y3MW3YBC.js +0 -3
  435. package/dist/cli/chunks/claude-flow-setup-6JKMBPGU.js +0 -2
  436. package/dist/cli/chunks/client-7E4LM2WW.js +0 -2
  437. package/dist/cli/chunks/codex-installer-CQ24DTP5.js +0 -14
  438. package/dist/cli/chunks/core-handlers-IFG3757P.js +0 -2
  439. package/dist/cli/chunks/cross-domain-router-EK7W4PGP.js +0 -2
  440. package/dist/cli/chunks/domain-transfer-KQJRUPXA.js +0 -2
  441. package/dist/cli/chunks/dream-NFSCSLY7.js +0 -2
  442. package/dist/cli/chunks/embed-and-insert-pattern-ZPAG7235.js +0 -3
  443. package/dist/cli/chunks/heartbeat-scheduler-ZATCDJDK.js +0 -2
  444. package/dist/cli/chunks/hnsw-adapter-WXQABRCA.js +0 -2
  445. package/dist/cli/chunks/hnsw-index-TPSWLEA5.js +0 -2
  446. package/dist/cli/chunks/impact-analyzer-HNIU45P5.js +0 -2
  447. package/dist/cli/chunks/init-wizard-JUIPBMHG.js +0 -2
  448. package/dist/cli/chunks/kernel-5BOZQ754.js +0 -2
  449. package/dist/cli/chunks/knowledge-graph-EWDAENWM.js +0 -2
  450. package/dist/cli/chunks/llm-router-service-3YT7JGBS.js +0 -2
  451. package/dist/cli/chunks/load-test-BP2CPLIV.js +0 -2
  452. package/dist/cli/chunks/mcp-5TTB37DC.js +0 -2
  453. package/dist/cli/chunks/memory-backend-4PYQBPRM.js +0 -2
  454. package/dist/cli/chunks/memory-handlers-2B27NITS.js +0 -2
  455. package/dist/cli/chunks/multi-model-executor-KCWSGCDT.js +0 -14
  456. package/dist/cli/chunks/orchestrator-RKB7XJRG.js +0 -393
  457. package/dist/cli/chunks/pattern-null-store-OYOQOV2O.js +0 -2
  458. package/dist/cli/chunks/platform-OD5H5U6G.js +0 -2
  459. package/dist/cli/chunks/protocol-executor-3ATJTXWG.js +0 -2
  460. package/dist/cli/chunks/qe-reasoning-bank-LLMYZT4X.js +0 -2
  461. package/dist/cli/chunks/queen-coordinator-RN7L6KG5.js +0 -2
  462. package/dist/cli/chunks/real-embeddings-FPFFNOSZ.js +0 -2
  463. package/dist/cli/chunks/router-MDHITQ2V.js +0 -2
  464. package/dist/cli/chunks/routing-feedback-5XLNJ3Y3.js +0 -2
  465. package/dist/cli/chunks/rvf-dual-writer-JBW4O3II.js +0 -2
  466. package/dist/cli/chunks/rvf-migration-adapter-BPPQL4XJ.js +0 -2
  467. package/dist/cli/chunks/rvf-migration-coordinator-V2GHCJKN.js +0 -2
  468. package/dist/cli/chunks/rvf-native-adapter-S4562CG5.js +0 -2
  469. package/dist/cli/chunks/safe-db-FIRHSXVF.js +0 -2
  470. package/dist/cli/chunks/schedule-RVXFB4HK.js +0 -2
  471. package/dist/cli/chunks/scheduler-IKKAMAOO.js +0 -2
  472. package/dist/cli/chunks/shared-rvf-adapter-LVIUOO4S.js +0 -2
  473. package/dist/cli/chunks/sqlite-persistence-SQ3HCUQ7.js +0 -2
  474. package/dist/cli/chunks/sync-UHOX6RJW.js +0 -2
  475. package/dist/cli/chunks/task-handler-AVDHMLGI.js +0 -49
  476. package/dist/cli/chunks/task-handlers-KYK4VTRA.js +0 -9
  477. package/dist/cli/chunks/token-bootstrap-GUTTLPZX.js +0 -2
  478. package/dist/cli/chunks/tree-sitter-wasm-parser-DEGOHS6F.js +0 -2
  479. package/dist/cli/chunks/unified-memory-CXHLHB5I.js +0 -2
  480. package/dist/cli/chunks/unified-memory-hnsw-I7WAE54M.js +0 -2
  481. package/dist/cli/chunks/unified-persistence-6CPF65WI.js +0 -2
  482. package/dist/cli/chunks/visual-security-GNPHME5H.js +0 -2
  483. package/dist/cli/chunks/witness-chain-RRN6NDCH.js +0 -2
  484. package/dist/cli/chunks/witness-chain-VT4UHHBR.js +0 -2
  485. package/dist/cli/chunks/workflow-orchestrator-DB3HIECD.js +0 -2
  486. package/dist/cli/chunks/wrappers-SUS6XEJD.js +0 -2
@@ -12,10 +12,11 @@ import * as fs from 'fs';
12
12
  import { initializeTokenOptimizer, TokenOptimizerService } from '../optimization/token-optimizer-service.js';
13
13
  import { TokenMetricsCollector } from '../learning/token-tracker.js';
14
14
  import { createDefaultMemoryBackend } from '../kernel/memory-factory.js';
15
+ import { findProjectRoot } from '../kernel/project-root.js';
15
16
  const DEFAULT_CONFIG = {
16
17
  enableOptimization: true,
17
18
  enablePersistence: true,
18
- storagePath: process.env.AQE_STORAGE_PATH ?? '.agentic-qe',
19
+ storagePath: '.agentic-qe',
19
20
  autoSaveIntervalMs: 60000,
20
21
  verbose: process.env.AQE_VERBOSE === 'true',
21
22
  };
@@ -36,7 +37,16 @@ export async function bootstrapTokenTracking(config) {
36
37
  if (initialized) {
37
38
  return;
38
39
  }
39
- const cfg = { ...DEFAULT_CONFIG, ...config };
40
+ // Resolve the project before creating any directory: a new cwd-local store
41
+ // would otherwise become the nearest AQE root and split project memory.
42
+ // A relative AQE_STORAGE_PATH is anchored at the project root too, so it
43
+ // cannot recreate a cwd-local store from a subdirectory.
44
+ const envStorage = process.env.AQE_STORAGE_PATH;
45
+ const cfg = {
46
+ ...DEFAULT_CONFIG, ...config,
47
+ storagePath: config?.storagePath
48
+ ?? (envStorage ? path.resolve(findProjectRoot(), envStorage) : path.join(findProjectRoot(), '.agentic-qe')),
49
+ };
40
50
  if (cfg.verbose) {
41
51
  console.log('[TokenBootstrap] Initializing token tracking...');
42
52
  }
@@ -227,6 +227,16 @@ export interface InitResult {
227
227
  policy: 'full' | 'compact' | 'none';
228
228
  ownedBytes: number;
229
229
  };
230
+ codexComponents?: {
231
+ hooks: {
232
+ status: string;
233
+ error?: string;
234
+ };
235
+ skills: {
236
+ status: string;
237
+ error?: string;
238
+ };
239
+ };
230
240
  };
231
241
  totalDurationMs: number;
232
242
  timestamp: Date;
@@ -304,6 +314,12 @@ export declare const DEFAULT_HOOKS_CONFIG: HooksConfig;
304
314
  export declare const DEFAULT_SKILLS_CONFIG: SkillsConfig;
305
315
  export declare const DEFAULT_AUTO_TUNING_CONFIG: AutoTuningConfig;
306
316
  export declare const DEFAULT_N8N_PLATFORM_CONFIG: N8nPlatformConfig;
317
+ /**
318
+ * The QE domains `aqe init` enables by default: every loadable DDD domain
319
+ * plugin, i.e. the canonical shared ALL_DOMAINS minus the cross-domain
320
+ * `coordination` context (the Queen, not a domain plugin). Derived — never
321
+ * hand-maintained — so fresh and existing installs cannot drift (#778).
322
+ */
307
323
  export declare const ALL_DOMAINS: string[];
308
324
  /**
309
325
  * Get the current AQE version from build-time constant
@@ -4,6 +4,8 @@
4
4
  *
5
5
  * Types for project analysis, self-configuration, and initialization.
6
6
  */
7
+ import { ALL_DOMAINS as CANONICAL_DOMAINS } from '../shared/types/index.js';
8
+ import { PROMOTION_MIN_SUCCESS_RATE, PROMOTION_THRESHOLD, } from '../learning/qe-patterns.js';
7
9
  // ============================================================================
8
10
  // Default Configurations
9
11
  // ============================================================================
@@ -16,8 +18,9 @@ export const DEFAULT_LEARNING_CONFIG = {
16
18
  enabled: true,
17
19
  pretrainedPatterns: true,
18
20
  hnswConfig: DEFAULT_HNSW_CONFIG,
19
- promotionThreshold: 3,
20
- qualityThreshold: 0.7,
21
+ // Single source of truth: the values the learning runtime enforces (#778).
22
+ promotionThreshold: PROMOTION_THRESHOLD,
23
+ qualityThreshold: PROMOTION_MIN_SUCCESS_RATE,
21
24
  embeddingModel: 'auto',
22
25
  };
23
26
  export const DEFAULT_ROUTING_CONFIG = {
@@ -71,21 +74,13 @@ export const DEFAULT_N8N_PLATFORM_CONFIG = {
71
74
  installSkills: true,
72
75
  installTypeScriptAgents: false,
73
76
  };
74
- export const ALL_DOMAINS = [
75
- 'test-generation',
76
- 'test-execution',
77
- 'coverage-analysis',
78
- 'quality-assessment',
79
- 'defect-intelligence',
80
- 'requirements-validation',
81
- 'code-intelligence',
82
- 'security-compliance',
83
- 'contract-testing',
84
- 'visual-accessibility',
85
- 'chaos-resilience',
86
- 'learning-optimization',
87
- 'enterprise-integration',
88
- ];
77
+ /**
78
+ * The QE domains `aqe init` enables by default: every loadable DDD domain
79
+ * plugin, i.e. the canonical shared ALL_DOMAINS minus the cross-domain
80
+ * `coordination` context (the Queen, not a domain plugin). Derived — never
81
+ * hand-maintained — so fresh and existing installs cannot drift (#778).
82
+ */
83
+ export const ALL_DOMAINS = CANONICAL_DOMAINS.filter((d) => d !== 'coordination');
89
84
  /**
90
85
  * Get the current AQE version from build-time constant
91
86
  */
@@ -103,14 +98,15 @@ export function createDefaultConfig(projectName, projectRoot) {
103
98
  root: projectRoot,
104
99
  type: 'single',
105
100
  },
106
- learning: DEFAULT_LEARNING_CONFIG,
107
- routing: DEFAULT_ROUTING_CONFIG,
108
- workers: DEFAULT_WORKERS_CONFIG,
109
- hooks: DEFAULT_HOOKS_CONFIG,
110
- skills: DEFAULT_SKILLS_CONFIG,
111
- autoTuning: DEFAULT_AUTO_TUNING_CONFIG,
101
+ // Cloned so callers that mutate the config cannot corrupt the shared defaults.
102
+ learning: structuredClone(DEFAULT_LEARNING_CONFIG),
103
+ routing: structuredClone(DEFAULT_ROUTING_CONFIG),
104
+ workers: structuredClone(DEFAULT_WORKERS_CONFIG),
105
+ hooks: structuredClone(DEFAULT_HOOKS_CONFIG),
106
+ skills: structuredClone(DEFAULT_SKILLS_CONFIG),
107
+ autoTuning: structuredClone(DEFAULT_AUTO_TUNING_CONFIG),
112
108
  domains: {
113
- enabled: ALL_DOMAINS,
109
+ enabled: [...ALL_DOMAINS],
114
110
  disabled: [],
115
111
  },
116
112
  agents: {
@@ -31,6 +31,31 @@
31
31
  import { DEFAULT_COHERENCE_CONFIG, DEFAULT_COHERENCE_LOGGER, WasmNotLoadedError, CoherenceError, } from './types.js';
32
32
  import { toErrorMessage, toError } from '../../shared/error-utils.js';
33
33
  import { CohomologyAdapter, SpectralAdapter, CausalAdapter, CategoryAdapter, HomotopyAdapter, WitnessAdapter, } from './engines/index.js';
34
+ import { tallyVotes, describeLeader, describeBreakdown } from './vote-tally.js';
35
+ /** Fallback consensus is valid only when more than this share of votes agree */
36
+ const FALLBACK_MAJORITY_THRESHOLD = 0.6;
37
+ /**
38
+ * Minimum number of voters for unanimity to be flagged as possible false
39
+ * consensus. Two agreeing agents are too few to call it groupthink.
40
+ */
41
+ const MIN_VOTERS_FOR_FALSE_CONSENSUS = 3;
42
+ /**
43
+ * False consensus means votes that *appear* unified but may not be
44
+ * (tool contract: "appears unified but isn't"). From verdicts alone the only
45
+ * observable "appears unified" signal is unanimity, so both the spectral and
46
+ * the fallback path flag unanimity among at least three voters as a risk.
47
+ * A split vote (e.g. 2 pass / 1 fail) shows its disagreement openly: it is a
48
+ * majority or an unverified consensus, never a false one (issue #535).
49
+ */
50
+ function appearsFalselyUnified(tally) {
51
+ return tally.isUnanimous && tally.total >= MIN_VOTERS_FOR_FALSE_CONSENSUS;
52
+ }
53
+ /** e.g. "3 of 3 votes 'pass'" or "2 of 3 votes 'pass'; 2 'pass' / 1 'fail'" */
54
+ function describeTally(tally) {
55
+ return tally.isUnanimous
56
+ ? describeLeader(tally)
57
+ : `${describeLeader(tally)}; ${describeBreakdown(tally)}`;
58
+ }
34
59
  // ============================================================================
35
60
  // Coherence Service Implementation
36
61
  // ============================================================================
@@ -557,15 +582,44 @@ export class CoherenceService {
557
582
  }
558
583
  const collapseRisk = this.spectralAdapter.predictCollapseRisk();
559
584
  const fiedlerValue = this.spectralAdapter.computeFiedlerValue();
585
+ const tally = tallyVotes(votes);
586
+ // When every vote agrees and carries positive confidence, the agreement
587
+ // graph is complete with positive edge weights, so its algebraic
588
+ // connectivity is necessarily > 0. A non-positive value here means the
589
+ // engine's eigen-solver result cannot be trusted; count votes instead
590
+ // of reporting a unanimous vote as a collapsed one.
591
+ if (tally.isUnanimous && votes.every(v => v.confidence > 0) && !(fiedlerValue > 0)) {
592
+ this.logger.warn('Spectral engine returned a zero Fiedler value for a connected agreement graph, using fallback', {
593
+ fiedlerValue,
594
+ voteCount: votes.length,
595
+ });
596
+ return this.verifyConsensusWithFallback(votes, startTime);
597
+ }
598
+ // Agents are connected only when they share a verdict, so any split
599
+ // vote disconnects the graph (λ2 = 0) and fails verification here.
600
+ const isValid = collapseRisk < 0.3 && fiedlerValue > 0.1;
601
+ const isFalseConsensus = appearsFalselyUnified(tally);
602
+ let recommendation;
603
+ if (!isValid) {
604
+ recommendation =
605
+ `No verified consensus (${describeTally(tally)}): agreement-graph Fiedler value ` +
606
+ `${fiedlerValue.toFixed(3)}, collapse risk ${collapseRisk.toFixed(2)}. Spawn independent reviewer.`;
607
+ }
608
+ else if (isFalseConsensus) {
609
+ recommendation =
610
+ `Consensus verified (${describeTally(tally)}), but unanimous agreement may indicate ` +
611
+ 'false consensus. Consider adding diversity.';
612
+ }
613
+ else {
614
+ recommendation = `Consensus verified (${describeTally(tally)}).`;
615
+ }
560
616
  return {
561
- isValid: collapseRisk < 0.3 && fiedlerValue > 0.1,
617
+ isValid,
562
618
  confidence: 1 - collapseRisk,
563
- isFalseConsensus: fiedlerValue < 0.05,
619
+ isFalseConsensus,
564
620
  fiedlerValue,
565
621
  collapseRisk,
566
- recommendation: collapseRisk > 0.3
567
- ? 'Spawn independent reviewer'
568
- : 'Consensus verified',
622
+ recommendation,
569
623
  durationMs: Date.now() - startTime,
570
624
  usedFallback: false,
571
625
  };
@@ -586,30 +640,36 @@ export class CoherenceService {
586
640
  * Fallback consensus verification
587
641
  */
588
642
  verifyConsensusWithFallback(votes, startTime) {
589
- // Count verdicts
590
- const verdictCounts = new Map();
591
- for (const vote of votes) {
592
- const key = String(vote.verdict);
593
- verdictCounts.set(key, (verdictCounts.get(key) || 0) + 1);
594
- }
595
- // Find majority
596
- let maxCount = 0;
597
- verdictCounts.forEach(count => {
598
- maxCount = Math.max(maxCount, count);
599
- });
600
- const majorityRatio = maxCount / votes.length;
643
+ const tally = tallyVotes(votes);
644
+ const { majorityRatio } = tally;
601
645
  const avgConfidence = votes.reduce((sum, v) => sum + v.confidence, 0) / votes.length;
646
+ // Flags and text are derived from the same predicates so the
647
+ // recommendation can never contradict them (issue #535).
648
+ const isValid = majorityRatio > FALLBACK_MAJORITY_THRESHOLD;
649
+ const isFalseConsensus = appearsFalselyUnified(tally);
650
+ let recommendation;
651
+ if (!isValid) {
652
+ recommendation =
653
+ `No clear majority: ${describeBreakdown(tally)} across ${tally.total} votes ` +
654
+ `(needs more than ${Math.round(FALLBACK_MAJORITY_THRESHOLD * 100)}% agreeing). Consider spawning additional agents.`;
655
+ }
656
+ else if (isFalseConsensus) {
657
+ recommendation =
658
+ `Unanimous consensus (${describeLeader(tally)}) may indicate false consensus. Consider adding diversity.`;
659
+ }
660
+ else if (tally.isUnanimous) {
661
+ recommendation = `Unanimous consensus achieved (${describeLeader(tally)}).`;
662
+ }
663
+ else {
664
+ recommendation = `Majority consensus achieved (${describeTally(tally)}).`;
665
+ }
602
666
  return {
603
- isValid: majorityRatio > 0.6,
667
+ isValid,
604
668
  confidence: majorityRatio * avgConfidence,
605
- isFalseConsensus: verdictCounts.size === 1 && votes.length > 2,
669
+ isFalseConsensus,
606
670
  fiedlerValue: majorityRatio, // Approximation
607
671
  collapseRisk: 1 - majorityRatio,
608
- recommendation: majorityRatio < 0.6
609
- ? 'No clear majority. Consider spawning additional agents.'
610
- : majorityRatio === 1 && verdictCounts.size === 1
611
- ? 'Unanimous consensus may indicate false consensus. Consider adding diversity.'
612
- : 'Majority consensus achieved.',
672
+ recommendation,
613
673
  durationMs: Date.now() - startTime,
614
674
  usedFallback: true,
615
675
  };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Agentic QE v3 - Consensus vote tally
3
+ *
4
+ * Counts verdicts once so that every consensus flag and every
5
+ * recommendation string is derived from the same numbers (issue #535).
6
+ */
7
+ /** Minimal vote shape needed to tally verdicts */
8
+ export interface TallyableVote {
9
+ verdict: string | number | boolean;
10
+ }
11
+ /** Verdict counts for a set of votes */
12
+ export interface VoteTally {
13
+ /** Total number of votes */
14
+ total: number;
15
+ /** Verdicts with counts, most votes first (ties ordered by verdict) */
16
+ counts: Array<{
17
+ verdict: string;
18
+ count: number;
19
+ }>;
20
+ /** Verdict with the most votes (first in `counts`) */
21
+ topVerdict: string;
22
+ /** Number of votes for `topVerdict` */
23
+ topCount: number;
24
+ /** topCount / total (0 when there are no votes) */
25
+ majorityRatio: number;
26
+ /** True when every vote has the same verdict */
27
+ isUnanimous: boolean;
28
+ }
29
+ /**
30
+ * Tally votes by verdict. Verdicts are compared by their string form,
31
+ * matching how consensus has always grouped them.
32
+ */
33
+ export declare function tallyVotes(votes: readonly TallyableVote[]): VoteTally;
34
+ /** e.g. "2 of 3 votes 'pass'" */
35
+ export declare function describeLeader(tally: VoteTally): string;
36
+ /** e.g. "2 'pass' / 1 'fail'" */
37
+ export declare function describeBreakdown(tally: VoteTally): string;
38
+ //# sourceMappingURL=vote-tally.d.ts.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Agentic QE v3 - Consensus vote tally
3
+ *
4
+ * Counts verdicts once so that every consensus flag and every
5
+ * recommendation string is derived from the same numbers (issue #535).
6
+ */
7
+ /**
8
+ * Tally votes by verdict. Verdicts are compared by their string form,
9
+ * matching how consensus has always grouped them.
10
+ */
11
+ export function tallyVotes(votes) {
12
+ const byVerdict = new Map();
13
+ for (const vote of votes) {
14
+ const key = String(vote.verdict);
15
+ byVerdict.set(key, (byVerdict.get(key) ?? 0) + 1);
16
+ }
17
+ const counts = [...byVerdict.entries()]
18
+ .map(([verdict, count]) => ({ verdict, count }))
19
+ .sort((a, b) => b.count - a.count || a.verdict.localeCompare(b.verdict));
20
+ const top = counts[0] ?? { verdict: '', count: 0 };
21
+ const total = votes.length;
22
+ return {
23
+ total,
24
+ counts,
25
+ topVerdict: top.verdict,
26
+ topCount: top.count,
27
+ majorityRatio: total > 0 ? top.count / total : 0,
28
+ isUnanimous: counts.length === 1,
29
+ };
30
+ }
31
+ /** e.g. "2 of 3 votes 'pass'" */
32
+ export function describeLeader(tally) {
33
+ return `${tally.topCount} of ${tally.total} votes '${tally.topVerdict}'`;
34
+ }
35
+ /** e.g. "2 'pass' / 1 'fail'" */
36
+ export function describeBreakdown(tally) {
37
+ return tally.counts.map(({ verdict, count }) => `${count} '${verdict}'`).join(' / ');
38
+ }
39
+ //# sourceMappingURL=vote-tally.js.map
@@ -21,6 +21,7 @@ import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
21
21
  import { join, resolve } from 'path';
22
22
  import { safeJsonParse } from '../../shared/safe-json.js';
23
23
  import { sha256, queryAll, queryIterator, countRows, domainFilterForColumn, writeJsonl, writeJsonlStreaming, readJsonl, runImportTransaction, serializeRowBlobs, deserializeRowBlobs, mergeGenericRow, remapPatternReferences, mergeAppendOnlyRow, TABLE_CONFIGS, PK_COLUMNS, CONFIDENCE_COLUMNS, TIMESTAMP_COLUMNS, } from './brain-shared.js';
24
+ import { appendBrainImportWitness } from './brain-import-audit.js';
24
25
  // ============================================================================
25
26
  // Internal helpers
26
27
  // ============================================================================
@@ -226,9 +227,17 @@ export function importBrain(db, containerPath, options) {
226
227
  const importAll = () => {
227
228
  const patternIds = new Map();
228
229
  const patternWinners = new Map();
230
+ let sourceWitnessRows = 0;
229
231
  for (const config of configs) {
230
232
  const filePath = join(dir, config.fileName);
231
233
  let rows = readJsonl(filePath, safeJsonParse);
234
+ if (config.tableName === 'witness_chain') {
235
+ // Source rows are signed/linked to a different store. Copying them into
236
+ // this live chain would make the first imported predecessor invalid.
237
+ sourceWitnessRows += rows.length;
238
+ skipped += rows.length;
239
+ continue;
240
+ }
232
241
  // Deserialize BLOBs from Base64
233
242
  if (config.blobColumns && config.blobColumns.length > 0) {
234
243
  rows = rows.map(r => deserializeRowBlobs(r, config.blobColumns));
@@ -252,6 +261,14 @@ export function importBrain(db, containerPath, options) {
252
261
  conflicts += result.conflicts;
253
262
  }
254
263
  }
264
+ appendBrainImportWitness(db, {
265
+ sourceChecksum: manifest.checksum,
266
+ sourceWitnessRows,
267
+ importedRecords: imported,
268
+ skippedRecords: skipped,
269
+ conflicts,
270
+ });
271
+ imported += 1;
255
272
  };
256
273
  runImportTransaction(db, options.dryRun ?? false, importAll);
257
274
  return { imported, skipped, conflicts };
@@ -0,0 +1,20 @@
1
+ /** Record a brain import without grafting another store's witness history. */
2
+ import type Database from 'better-sqlite3';
3
+ interface BrainImportAuditDetails {
4
+ sourceChecksum: string;
5
+ sourceWitnessRows: number;
6
+ importedRecords: number;
7
+ skippedRecords: number;
8
+ conflicts: number;
9
+ }
10
+ /**
11
+ * Call inside the import transaction, after merging all non-witness tables.
12
+ *
13
+ * Reuses WitnessChain's own hashing/serialization so the link format cannot
14
+ * drift from what WitnessChain.verify() checks. The row is intentionally left
15
+ * unsigned: the target DB may belong to a different project than the CWD, so
16
+ * the process-default signing key is not necessarily the target's key.
17
+ */
18
+ export declare function appendBrainImportWitness(db: Database.Database, details: BrainImportAuditDetails): void;
19
+ export {};
20
+ //# sourceMappingURL=brain-import-audit.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { GENESIS_PREV_HASH, hashWith, serializeEntry, } from '../../audit/witness-chain.js';
2
+ /**
3
+ * Call inside the import transaction, after merging all non-witness tables.
4
+ *
5
+ * Reuses WitnessChain's own hashing/serialization so the link format cannot
6
+ * drift from what WitnessChain.verify() checks. The row is intentionally left
7
+ * unsigned: the target DB may belong to a different project than the CWD, so
8
+ * the process-default signing key is not necessarily the target's key.
9
+ */
10
+ export function appendBrainImportWitness(db, details) {
11
+ const algo = 'shake256';
12
+ const actionData = JSON.stringify(details);
13
+ const last = db.prepare('SELECT * FROM witness_chain ORDER BY id DESC LIMIT 1')
14
+ .get();
15
+ const previousHash = last ? hashWith(algo, serializeEntry(last)) : GENESIS_PREV_HASH;
16
+ db.prepare(`
17
+ INSERT INTO witness_chain
18
+ (prev_hash, action_hash, action_type, action_data, timestamp, actor, hash_algo)
19
+ VALUES (?, ?, 'BRAIN_IMPORT', ?, ?, 'brain-import', ?)
20
+ `).run(previousHash, hashWith(algo, actionData), actionData, new Date().toISOString(), algo);
21
+ }
22
+ //# sourceMappingURL=brain-import-audit.js.map
@@ -7,6 +7,7 @@ import { existsSync, readdirSync, renameSync, statSync, unlinkSync, writeFileSyn
7
7
  import { basename, dirname, join, resolve } from 'path';
8
8
  import { createRvfStore, openRvfStore, openRvfStoreReadonly, isRvfNativeAvailable, } from './rvf-native-adapter.js';
9
9
  import { sha256, tableExists, queryAll, domainFilterForColumn, runImportTransaction, mergeGenericRow, remapPatternReferences, mergeAppendOnlyRow, TABLE_CONFIGS, TABLE_BLOB_COLUMNS, PK_COLUMNS, CONFIDENCE_COLUMNS, TIMESTAMP_COLUMNS, serializeRowBlobs, deserializeRowBlobs, } from './brain-shared.js';
10
+ import { appendBrainImportWitness } from './brain-import-audit.js';
10
11
  // --- Export ---
11
12
  /**
12
13
  * Sidecar suffixes that make up a complete store on disk. `''` is the store
@@ -401,11 +402,18 @@ export function importBrainFromRvf(db, rvfPath, options) {
401
402
  const importAll = () => {
402
403
  const patternIds = new Map();
403
404
  const patternWinners = new Map();
405
+ let sourceWitnessRows = 0;
404
406
  // Import in TABLE_CONFIGS order (FK-aware)
405
407
  for (const config of TABLE_CONFIGS) {
406
408
  let rows = tablesMap[config.tableName];
407
409
  if (!rows || !Array.isArray(rows))
408
410
  continue;
411
+ if (config.tableName === 'witness_chain') {
412
+ // A source chain cannot be grafted into another store's live chain.
413
+ sourceWitnessRows += rows.length;
414
+ skipped += rows.length;
415
+ continue;
416
+ }
409
417
  // Deserialize BLOBs
410
418
  const blobCols = TABLE_BLOB_COLUMNS[config.tableName];
411
419
  if (blobCols && blobCols.length > 0) {
@@ -434,6 +442,14 @@ export function importBrainFromRvf(db, rvfPath, options) {
434
442
  conflicts += result.conflicts;
435
443
  }
436
444
  }
445
+ appendBrainImportWitness(db, {
446
+ sourceChecksum: sha256(kernel.image.toString('utf-8')),
447
+ sourceWitnessRows,
448
+ importedRecords: imported,
449
+ skippedRecords: skipped,
450
+ conflicts,
451
+ });
452
+ imported += 1;
437
453
  };
438
454
  runImportTransaction(db, options.dryRun ?? false, importAll);
439
455
  // Compact after conflict resolution (best-effort)
@@ -408,7 +408,7 @@ export function runImportTransaction(db, dryRun, importer) {
408
408
  throw rollback;
409
409
  });
410
410
  try {
411
- transaction();
411
+ transaction.immediate();
412
412
  }
413
413
  catch (error) {
414
414
  if (error !== rollback)
@@ -10,7 +10,7 @@
10
10
  * intercepting pattern embedding writes/deletes/searches and routing them
11
11
  * to one or both backends depending on the configured mode.
12
12
  */
13
- import { getActiveEmbeddingSpaceIdentity } from '../../learning/real-embeddings.js';
13
+ import { ensureEndpointEmbeddingSpaceIdentity, getActiveEmbeddingSpaceIdentity } from '../../learning/real-embeddings.js';
14
14
  import { verifyOrCreateEmbeddingSpaceManifest } from '../../learning/embedding-space.js';
15
15
  /**
16
16
  * Wraps the real RvfNativeAdapter to conform to the simpler RvfStore interface.
@@ -97,6 +97,11 @@ export class RvfDualWriter {
97
97
  this.rvfAvailable = false;
98
98
  return;
99
99
  }
100
+ // #754: a later process opens brain.rvf before any embed call has
101
+ // initialized the (lazy) endpoint runtime; resolve its identity first.
102
+ if (!this.activeSpaceId()) {
103
+ await ensureEndpointEmbeddingSpaceIdentity();
104
+ }
100
105
  const { isRvfLockHeldError, removeStaleRvfLock, quarantineUnusableStore } = await import('./rvf-store-integrity.js');
101
106
  const tryOpen = () => {
102
107
  try {
@@ -11,6 +11,14 @@
11
11
  * @module integrations/ruvector/shared-rvf-adapter
12
12
  */
13
13
  import type { RvfNativeAdapter, RvfCompactionResult, RvfStatus } from './rvf-native-adapter.js';
14
+ /**
15
+ * The store is locked by a live process. The open ladder has already logged
16
+ * why it is degrading, so callers should not log it again (#574).
17
+ */
18
+ export declare class RvfLiveLockError extends Error {
19
+ readonly lockError: unknown;
20
+ constructor(lockError: unknown);
21
+ }
14
22
  /** @internal test-only seam */
15
23
  export declare function __setSharedRvfAdapterForTests(adapter: RvfNativeAdapter | null): void;
16
24
  /**
@@ -21,6 +29,19 @@ export declare function __setSharedRvfAdapterForTests(adapter: RvfNativeAdapter
21
29
  * @returns The shared adapter, or null if native bindings are unavailable
22
30
  */
23
31
  export declare function getSharedRvfAdapter(dataDir?: string, dimensions?: number): RvfNativeAdapter | null;
32
+ /**
33
+ * Race-tolerant open-or-create.
34
+ * Tries open first (cheap, succeeds for the common case where init has
35
+ * already produced the file). On open failure we attempt create. On the
36
+ * concurrent-create loser, create itself fails with `FsyncFailed`; we
37
+ * retry open once more. Any final exception bubbles up to the caller.
38
+ *
39
+ * Also asserts `dim()` matches the caller-requested `dimensions` after
40
+ * open so silent dimension drift between releases / configs is detected
41
+ * — a bad-dim file is closed and create() is attempted (fail-loud rather
42
+ * than corrupt-silently, which would manifest as wrong vector hits later).
43
+ */
44
+ declare function openOrCreateRvf(openFn: (p: string) => RvfNativeAdapter, createFn: (p: string, dim: number) => RvfNativeAdapter, rvfPath: string, dimensions: number): RvfNativeAdapter;
24
45
  export interface CompactDecision {
25
46
  shouldCompact: boolean;
26
47
  trigger: 'force' | 'size-guard' | 'dead-ratio' | 'none';
@@ -64,6 +85,8 @@ export declare function compactSharedRvfAdapter(opts?: {
64
85
  * `getSharedRvfAdapter()` which invokes it internally.
65
86
  */
66
87
  export declare function runBootCompactGuard(adapter: RvfNativeAdapter, rvfPath: string): RvfCompactionResult | null;
88
+ /** @internal test-only seam: the open ladder with injectable open/create */
89
+ export { openOrCreateRvf as __openOrCreateRvfForTests };
67
90
  /** Close the shared adapter and reset the singleton. */
68
91
  export declare function resetSharedRvfAdapter(): void;
69
92
  //# sourceMappingURL=shared-rvf-adapter.d.ts.map
@@ -18,6 +18,18 @@ import { findProjectRoot } from '../../kernel/project-root.js';
18
18
  import { quarantineUnusableStore, isLockHeldByLiveProcess, isRvfLockHeldError, removeStaleRvfLock, readLockOwnerPid, } from './rvf-store-integrity.js';
19
19
  let sharedAdapter = null;
20
20
  let initAttempted = false;
21
+ /**
22
+ * The store is locked by a live process. The open ladder has already logged
23
+ * why it is degrading, so callers should not log it again (#574).
24
+ */
25
+ export class RvfLiveLockError extends Error {
26
+ lockError;
27
+ constructor(lockError) {
28
+ super(lockError instanceof Error ? lockError.message : String(lockError));
29
+ this.lockError = lockError;
30
+ this.name = 'RvfLiveLockError';
31
+ }
32
+ }
21
33
  // ---------------------------------------------------------------------------
22
34
  // Test seam: allow tests to install a fake adapter without going through the
23
35
  // native binding loader. NOT part of the public API — used by tests only.
@@ -97,6 +109,9 @@ export function getSharedRvfAdapter(dataDir = '.agentic-qe', dimensions = 384) {
97
109
  return sharedAdapter;
98
110
  }
99
111
  catch (error) {
112
+ // Already reported by the open ladder as "locked by a live process".
113
+ if (error instanceof RvfLiveLockError)
114
+ return null;
100
115
  console.warn('[RVF] Shared adapter init failed:', error instanceof Error ? error.message : error);
101
116
  return null;
102
117
  }
@@ -137,12 +152,14 @@ function openOrCreateRvf(openFn, createFn, rvfPath, dimensions) {
137
152
  // assumption. This includes a lock owned by the current PID: another
138
153
  // in-process adapter may still hold the store, so PID equality is not proof
139
154
  // that the lock can be removed safely.
155
+ let liveOwner = false;
140
156
  if (!opened && isRvfLockHeldError(openErr)) {
141
157
  try {
142
158
  // eslint-disable-next-line @typescript-eslint/no-require-imports
143
159
  const fs = require('fs');
144
160
  const lockPath = `${rvfPath}.lock`;
145
161
  if (fs.existsSync(lockPath) && isLockHeldByLiveProcess(rvfPath)) {
162
+ liveOwner = true;
146
163
  console.warn(`[RVF] ${rvfPath} is locked by a live process (pid ${readLockOwnerPid(rvfPath)}) — ` +
147
164
  'not breaking the lock; degrading to SQLite for this run.');
148
165
  }
@@ -159,6 +176,11 @@ function openOrCreateRvf(openFn, createFn, rvfPath, dimensions) {
159
176
  }
160
177
  }
161
178
  }
179
+ // #574: a live owner means the store is busy, not missing or broken. A
180
+ // create on an existing path always fails and a reopen hits the same lock,
181
+ // so stop at the warning above instead of running Passes 2 and 3.
182
+ if (liveOwner)
183
+ throw new RvfLiveLockError(openErr);
162
184
  if (opened) {
163
185
  const actualDim = opened.dimension();
164
186
  if (actualDim === dimensions)
@@ -312,6 +334,8 @@ function formatBytes(n) {
312
334
  }
313
335
  return `${v.toFixed(i === 0 ? 0 : 1)}${units[i]}`;
314
336
  }
337
+ /** @internal test-only seam: the open ladder with injectable open/create */
338
+ export { openOrCreateRvf as __openOrCreateRvfForTests };
315
339
  /** Close the shared adapter and reset the singleton. */
316
340
  export function resetSharedRvfAdapter() {
317
341
  if (sharedAdapter) {
@@ -175,5 +175,11 @@ export declare class HybridMemoryBackend implements MemoryBackend {
175
175
  private ensureInitialized;
176
176
  private cleanup;
177
177
  }
178
+ /**
179
+ * Create the project memory backend exactly as the QE kernel does
180
+ * (<dataDir>/memory.db, WAL, 'qe-kernel' default namespace). Shared with the
181
+ * CLI's lightweight memory path so both always open the same store.
182
+ */
183
+ export declare function createKernelMemoryBackend(dataDir: string): HybridMemoryBackend;
178
184
  export {};
179
185
  //# sourceMappingURL=hybrid-backend.d.ts.map
@@ -10,6 +10,7 @@
10
10
  * backward compatibility with existing MemoryBackend interface.
11
11
  */
12
12
  import { getUnifiedMemory, DEFAULT_UNIFIED_MEMORY_CONFIG } from './unified-memory.js';
13
+ import * as path from 'path';
13
14
  import { MEMORY_CONSTANTS } from './constants.js';
14
15
  import { LoggerFactory } from '../logging/index.js';
15
16
  const logger = LoggerFactory.create('hybrid-backend');
@@ -329,4 +330,21 @@ export class HybridMemoryBackend {
329
330
  }
330
331
  }
331
332
  }
333
+ /**
334
+ * Create the project memory backend exactly as the QE kernel does
335
+ * (<dataDir>/memory.db, WAL, 'qe-kernel' default namespace). Shared with the
336
+ * CLI's lightweight memory path so both always open the same store.
337
+ */
338
+ export function createKernelMemoryBackend(dataDir) {
339
+ return new HybridMemoryBackend({
340
+ sqlite: {
341
+ path: path.join(dataDir, 'memory.db'),
342
+ walMode: true,
343
+ poolSize: 3,
344
+ busyTimeout: MEMORY_CONSTANTS.BUSY_TIMEOUT_MS,
345
+ },
346
+ enableFallback: true,
347
+ defaultNamespace: 'qe-kernel',
348
+ });
349
+ }
332
350
  //# sourceMappingURL=hybrid-backend.js.map