agentic-qe 3.14.4 → 3.14.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (403) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +93 -0
  3. package/assets/skills/skills-manifest.json +1 -1
  4. package/dist/audit/witness-chain.d.ts +1 -1
  5. package/dist/audit/witness-chain.js +29 -22
  6. package/dist/cli/bundle.js +13 -10
  7. package/dist/cli/chunks/adapter-IYC62SXA.js +2 -0
  8. package/dist/cli/chunks/{agent-booster-wasm-5PC7D2FW.js → agent-booster-wasm-EDNKP3SP.js} +2 -2
  9. package/dist/cli/chunks/{agent-handler-RDNTK4CA.js → agent-handler-V6CZ7Q6S.js} +2 -2
  10. package/dist/cli/chunks/{agent-memory-branch-NAAMBWIR.js → agent-memory-branch-ZMD6ULC3.js} +2 -2
  11. package/dist/cli/chunks/aqe-learning-engine-LLOU2IXD.js +2 -0
  12. package/dist/cli/chunks/{arena-HXTWJ5YY.js → arena-4UPAEHFT.js} +4 -4
  13. package/dist/cli/chunks/{arena-KXFHRWX4.js → arena-QLSBESC7.js} +2 -2
  14. package/dist/cli/chunks/{audit-YSGA7UWT.js → audit-CVZQMF55.js} +3 -3
  15. package/dist/cli/chunks/base-P3Z4IKCT.js +2 -0
  16. package/dist/cli/chunks/{better-sqlite3-UICJZIDG.js → better-sqlite3-4DSBPDRH.js} +2 -2
  17. package/dist/cli/chunks/brain-handler-GBY4EZ4P.js +94 -0
  18. package/dist/cli/chunks/{branch-enumerator-SS7UNVIA.js → branch-enumerator-XYBVXCNO.js} +2 -2
  19. package/dist/cli/chunks/{browser-77GI6KBE.js → browser-32F6MREU.js} +2 -2
  20. package/dist/cli/chunks/browser-workflow-YYHQQ25X.js +2 -0
  21. package/dist/cli/chunks/{chunk-FGYMFUE2.js → chunk-2JGEZHWY.js} +2 -2
  22. package/dist/cli/chunks/{chunk-MOBNBMFW.js → chunk-2KJQ2UQE.js} +1 -1
  23. package/dist/cli/chunks/{chunk-C2WU3533.js → chunk-2OMLTYQK.js} +1 -1
  24. package/dist/cli/chunks/{chunk-CU46J64M.js → chunk-37TUN44F.js} +2 -2
  25. package/dist/cli/chunks/{chunk-Z3RHREWF.js → chunk-3DDXWYMO.js} +1 -1
  26. package/dist/cli/chunks/{chunk-Q5DO24IJ.js → chunk-3EZ5DR2R.js} +3 -3
  27. package/dist/cli/chunks/{chunk-WLG5AJ4N.js → chunk-3KDL6QDK.js} +2 -2
  28. package/dist/cli/chunks/{chunk-MTZH7AHC.js → chunk-3VIXOHMS.js} +1 -1
  29. package/dist/cli/chunks/{chunk-ISDMD6EU.js → chunk-3YUB5HER.js} +96 -96
  30. package/dist/cli/chunks/{chunk-CDKG6EI7.js → chunk-4FWTLJEP.js} +2 -2
  31. package/dist/cli/chunks/{chunk-HDSAM2RE.js → chunk-52L77RMG.js} +2 -2
  32. package/dist/cli/chunks/{chunk-MEGDYJPV.js → chunk-5D36YHS3.js} +4 -4
  33. package/dist/cli/chunks/{chunk-T6BVLVI5.js → chunk-5WOSWNDN.js} +1 -1
  34. package/dist/cli/chunks/{chunk-M2JBBZQB.js → chunk-67YV75XP.js} +2 -2
  35. package/dist/cli/chunks/{chunk-KHFNNVJA.js → chunk-6A44AOGN.js} +2 -2
  36. package/dist/cli/chunks/{chunk-IPR4QP3H.js → chunk-6CR4VQBQ.js} +2 -2
  37. package/dist/cli/chunks/{chunk-XRT2WRMS.js → chunk-6ITZZIQX.js} +2 -2
  38. package/dist/cli/chunks/{chunk-4OYFXLBK.js → chunk-6LKDHEBY.js} +2 -2
  39. package/dist/cli/chunks/{chunk-FLYOJOKN.js → chunk-6TU7FEMD.js} +1 -1
  40. package/dist/cli/chunks/{chunk-6QYNWR7U.js → chunk-6VAZAHQG.js} +2 -2
  41. package/dist/cli/chunks/{chunk-TWAWHOP7.js → chunk-73EI4C2E.js} +2 -2
  42. package/dist/cli/chunks/{chunk-5R3QL7WN.js → chunk-75QJ5HWE.js} +2 -2
  43. package/dist/cli/chunks/{chunk-Y3MW3YBC.js → chunk-7CD7PBHY.js} +2 -2
  44. package/dist/cli/chunks/chunk-7DETTOPZ.js +14 -0
  45. package/dist/cli/chunks/{chunk-KSKEF7LZ.js → chunk-7JZJJA7U.js} +3 -3
  46. package/dist/cli/chunks/{chunk-AIHDEEJO.js → chunk-7VFY7TUR.js} +2 -2
  47. package/dist/cli/chunks/chunk-7X7JYWT4.js +27 -0
  48. package/dist/cli/chunks/chunk-AF4XKLXO.js +2 -0
  49. package/dist/cli/chunks/{chunk-6KJABXAR.js → chunk-AFEDJ3RU.js} +2 -2
  50. package/dist/cli/chunks/{chunk-5SJHQ2CO.js → chunk-AMMQOV35.js} +2 -2
  51. package/dist/cli/chunks/{chunk-6VRA2QGL.js → chunk-BHFR2EXL.js} +1 -1
  52. package/dist/cli/chunks/{chunk-ZBAKA4YB.js → chunk-BJPL6THQ.js} +1 -1
  53. package/dist/cli/chunks/{chunk-DOTK76IJ.js → chunk-BXVAVFGU.js} +2 -2
  54. package/dist/cli/chunks/{chunk-MNW6QGNJ.js → chunk-BYG36QC5.js} +2 -2
  55. package/dist/cli/chunks/chunk-C3HQL6S4.js +2 -0
  56. package/dist/cli/chunks/{chunk-PZJOPURC.js → chunk-C3Z4VVHP.js} +5 -5
  57. package/dist/cli/chunks/{chunk-OULHKEVH.js → chunk-CPC7FN52.js} +2 -2
  58. package/dist/cli/chunks/{chunk-BFP7KO7P.js → chunk-CVMNJSCB.js} +2 -2
  59. package/dist/cli/chunks/{chunk-AUXFKCQL.js → chunk-CYE2TJFV.js} +2 -2
  60. package/dist/cli/chunks/{chunk-7D777LTF.js → chunk-CZO4BJG5.js} +2 -2
  61. package/dist/cli/chunks/{chunk-VD6QRULW.js → chunk-D6OUCB2H.js} +2 -2
  62. package/dist/cli/chunks/{chunk-6UWGMOND.js → chunk-DDCIYOGT.js} +2 -2
  63. package/dist/cli/chunks/{chunk-STJCATGN.js → chunk-DKUBQQFG.js} +2 -2
  64. package/dist/cli/chunks/{chunk-M4WJKGVK.js → chunk-DLF5BOJD.js} +1 -1
  65. package/dist/cli/chunks/{chunk-DA5K5754.js → chunk-DO6EI5KB.js} +1 -1
  66. package/dist/cli/chunks/{chunk-BDESSCVR.js → chunk-DPBRWP4J.js} +3 -3
  67. package/dist/cli/chunks/{chunk-HV2J7KKQ.js → chunk-E3W6XQ57.js} +2 -2
  68. package/dist/cli/chunks/{chunk-MDWCE7YW.js → chunk-E4AZXCT5.js} +1 -1
  69. package/dist/cli/chunks/{chunk-F3SBRQC6.js → chunk-E4EYPYR3.js} +2 -2
  70. package/dist/cli/chunks/{chunk-55RWDRJD.js → chunk-EFV4ADMO.js} +4 -4
  71. package/dist/cli/chunks/{chunk-5YPYDPBJ.js → chunk-ELBZON4V.js} +2 -2
  72. package/dist/cli/chunks/{chunk-PO3IXGMQ.js → chunk-EOR2UT72.js} +2 -2
  73. package/dist/cli/chunks/{chunk-EDJ3O7RH.js → chunk-F34OAHOM.js} +2 -2
  74. package/dist/cli/chunks/{chunk-XRYF6JV7.js → chunk-FUNGTIF2.js} +2 -2
  75. package/dist/cli/chunks/{chunk-EKQ673SA.js → chunk-G3L5L6YQ.js} +1 -1
  76. package/dist/cli/chunks/{chunk-NJBGXDQ7.js → chunk-G3W6BMVJ.js} +1 -1
  77. package/dist/cli/chunks/{chunk-CIZ5JPDC.js → chunk-GTKCGPJZ.js} +3 -3
  78. package/dist/cli/chunks/{chunk-QGIU2WRL.js → chunk-HBCGYMQU.js} +1 -1
  79. package/dist/cli/chunks/{chunk-V3QLFNA2.js → chunk-HSVKZ5KI.js} +4 -4
  80. package/dist/cli/chunks/{chunk-BGE6FOLM.js → chunk-HVU64GP5.js} +2 -2
  81. package/dist/cli/chunks/chunk-HVXJC3OC.js +2 -0
  82. package/dist/cli/chunks/{chunk-MIQTXNBG.js → chunk-HYEJJJY3.js} +1 -1
  83. package/dist/cli/chunks/{chunk-CLTMDCSE.js → chunk-I2NENQ44.js} +2 -2
  84. package/dist/cli/chunks/{chunk-SGYJ4NFZ.js → chunk-I6X3EGJI.js} +1 -1
  85. package/dist/cli/chunks/{chunk-BOARZKU3.js → chunk-IGBEJ4UJ.js} +2 -2
  86. package/dist/cli/chunks/{chunk-FWGOHAAB.js → chunk-IIAR5S7Q.js} +2 -2
  87. package/dist/cli/chunks/{chunk-DHJPWQBR.js → chunk-IJHCIXJC.js} +2 -2
  88. package/dist/cli/chunks/{chunk-UEM7ZF5K.js → chunk-IUDWEOLX.js} +2 -2
  89. package/dist/cli/chunks/chunk-IUHB5GVS.js +3 -0
  90. package/dist/cli/chunks/{chunk-M5QUBZY6.js → chunk-IYTLXUBO.js} +2 -2
  91. package/dist/cli/chunks/chunk-J27F4NSB.js +2 -0
  92. package/dist/cli/chunks/{chunk-G6T45OIC.js → chunk-J5UNP6W3.js} +2 -2
  93. package/dist/cli/chunks/{chunk-3UPAMMCB.js → chunk-JES6R5KP.js} +1 -1
  94. package/dist/cli/chunks/{chunk-ZBQY5GLF.js → chunk-JROVR6YS.js} +2 -2
  95. package/dist/cli/chunks/chunk-JSZ663MU.js +2 -0
  96. package/dist/cli/chunks/{chunk-PFR4G3DJ.js → chunk-JVQBWYHW.js} +2 -2
  97. package/dist/cli/chunks/{chunk-JBNEE5UH.js → chunk-K27SU3RE.js} +2 -2
  98. package/dist/cli/chunks/{chunk-JZ3ORVZ3.js → chunk-K7NJHFLZ.js} +3 -3
  99. package/dist/cli/chunks/{chunk-3VOQRIQM.js → chunk-KEY43ANX.js} +2 -2
  100. package/dist/cli/chunks/chunk-KIP6WZGV.js +13 -0
  101. package/dist/cli/chunks/{chunk-UDHKLT4C.js → chunk-KKHYJF5U.js} +1 -1
  102. package/dist/cli/chunks/{chunk-ZNEMGX5O.js → chunk-KLTP5IDB.js} +1 -1
  103. package/dist/cli/chunks/{chunk-ONII3572.js → chunk-KO4FNAUR.js} +3 -3
  104. package/dist/cli/chunks/{chunk-TSRSV3LD.js → chunk-KYA5LARK.js} +1 -1
  105. package/dist/cli/chunks/{chunk-2JW3BCGG.js → chunk-LSUILON7.js} +1 -1
  106. package/dist/cli/chunks/chunk-LULD4JV2.js +15 -0
  107. package/dist/cli/chunks/{chunk-FRH6VAUS.js → chunk-M23ZOZVY.js} +1 -1
  108. package/dist/cli/chunks/{chunk-R5NE6B2M.js → chunk-M5AEL7IS.js} +2 -2
  109. package/dist/cli/chunks/chunk-MI5Q55DG.js +65 -0
  110. package/dist/cli/chunks/chunk-N7H767TP.js +4 -0
  111. package/dist/cli/chunks/{chunk-RJCYCLZV.js → chunk-NQI7FWCS.js} +2 -2
  112. package/dist/cli/chunks/{chunk-CXQPR5MY.js → chunk-NRE4NAVA.js} +1 -1
  113. package/dist/cli/chunks/{chunk-ODKLFVYC.js → chunk-NU7UTXMP.js} +2 -2
  114. package/dist/cli/chunks/{chunk-MVPCNSPY.js → chunk-NVYBM3R4.js} +2 -2
  115. package/dist/cli/chunks/{chunk-MVNP7GIR.js → chunk-O3JTQ7N4.js} +1 -1
  116. package/dist/cli/chunks/{chunk-6CQN24ZK.js → chunk-OEIQTWQP.js} +1 -1
  117. package/dist/cli/chunks/{chunk-U5K45TFH.js → chunk-PSPKSUF6.js} +1 -1
  118. package/dist/cli/chunks/{chunk-CDHQFHRP.js → chunk-QIRL6B3C.js} +2 -2
  119. package/dist/cli/chunks/{chunk-OSLYSG3B.js → chunk-QRCIZFNK.js} +2 -2
  120. package/dist/cli/chunks/{chunk-BOZZYWCR.js → chunk-QWUXCG2L.js} +1 -1
  121. package/dist/cli/chunks/{chunk-HIYXCDEP.js → chunk-QYOGD2VW.js} +1 -1
  122. package/dist/cli/chunks/{chunk-A4FYONNU.js → chunk-QZMUXJHZ.js} +2 -2
  123. package/dist/cli/chunks/{chunk-3TW5W5LX.js → chunk-R6IU3EWP.js} +2 -2
  124. package/dist/cli/chunks/{chunk-3X3DJZJJ.js → chunk-R74ZKREV.js} +1 -1
  125. package/dist/cli/chunks/{chunk-HIVA55CJ.js → chunk-RD2VGOUH.js} +1 -1
  126. package/dist/cli/chunks/{chunk-TPGED2IF.js → chunk-RD6TEZ64.js} +2 -2
  127. package/dist/cli/chunks/{chunk-4MHXCAG2.js → chunk-RGGK6VZ7.js} +1 -1
  128. package/dist/cli/chunks/{chunk-UGVHCMUN.js → chunk-RIZVC4XY.js} +3 -3
  129. package/dist/cli/chunks/{chunk-R4VL6E65.js → chunk-RKOUXVZZ.js} +2 -2
  130. package/dist/cli/chunks/{chunk-IFCLB7FJ.js → chunk-RP2ZKPYV.js} +1 -1
  131. package/dist/cli/chunks/{chunk-34WO57CW.js → chunk-SQF6HRXR.js} +1 -1
  132. package/dist/cli/chunks/{chunk-YNXS6CGV.js → chunk-SQKW3B6B.js} +1 -1
  133. package/dist/cli/chunks/{chunk-TDZ53WO2.js → chunk-SX4JLSLV.js} +2 -2
  134. package/dist/cli/chunks/{chunk-PAWXJ73E.js → chunk-TUSSPKRM.js} +1 -1
  135. package/dist/cli/chunks/{chunk-DFZCKIGY.js → chunk-TY5WC3FT.js} +3 -3
  136. package/dist/cli/chunks/{chunk-J6GNQS62.js → chunk-UDHVCKGA.js} +2 -2
  137. package/dist/cli/chunks/{chunk-CIKSHTEQ.js → chunk-UJWAWIRV.js} +4 -4
  138. package/dist/cli/chunks/{chunk-XJ7QNVI5.js → chunk-UKGXWW64.js} +3 -3
  139. package/dist/cli/chunks/{chunk-64PFWE2F.js → chunk-UMGFMKDW.js} +2 -2
  140. package/dist/cli/chunks/{chunk-DPFRKBOG.js → chunk-URVHZPWY.js} +2 -2
  141. package/dist/cli/chunks/{chunk-MCUJEZT6.js → chunk-UTBYJ4RF.js} +2 -2
  142. package/dist/cli/chunks/{chunk-HUWNIPZ5.js → chunk-VD5IO5EO.js} +1 -1
  143. package/dist/cli/chunks/{chunk-7ZIOFPL3.js → chunk-VTOVWHEM.js} +2 -2
  144. package/dist/cli/chunks/{chunk-SRKETSFF.js → chunk-W2XCZU62.js} +1 -1
  145. package/dist/cli/chunks/{chunk-CNG6GQEZ.js → chunk-WJHWH5D2.js} +2 -2
  146. package/dist/cli/chunks/{chunk-ZJ26AQA5.js → chunk-WJTSY5MC.js} +1 -1
  147. package/dist/cli/chunks/{chunk-OCWWP5PL.js → chunk-WK7B4B6Y.js} +2 -2
  148. package/dist/cli/chunks/{chunk-KPA7MZ6C.js → chunk-WLXK2KNU.js} +2 -2
  149. package/dist/cli/chunks/{chunk-ZBJ4XOOV.js → chunk-WOIGKU2N.js} +4 -4
  150. package/dist/cli/chunks/{chunk-ZZDIMOOV.js → chunk-WX6RRIGW.js} +2 -2
  151. package/dist/cli/chunks/{chunk-STM3UDNO.js → chunk-XEZIIQYJ.js} +2 -2
  152. package/dist/cli/chunks/{chunk-3QHGWY7T.js → chunk-XFPPERA2.js} +2 -2
  153. package/dist/cli/chunks/{chunk-VIHTL3U2.js → chunk-XLAUGSW7.js} +2 -2
  154. package/dist/cli/chunks/{chunk-XC7DYDSY.js → chunk-XQSIRBKT.js} +2 -2
  155. package/dist/cli/chunks/{chunk-GPLQ6DOK.js → chunk-XUR2M2WB.js} +2 -2
  156. package/dist/cli/chunks/{chunk-KCZR45PA.js → chunk-XZSMZHM2.js} +2 -2
  157. package/dist/cli/chunks/{chunk-ZNPKDCZR.js → chunk-Y5L3ES4L.js} +2 -2
  158. package/dist/cli/chunks/{chunk-W7BWUTVV.js → chunk-YDFL445W.js} +2 -2
  159. package/dist/cli/chunks/{chunk-AWWNB2T7.js → chunk-YQGPQBCX.js} +2 -2
  160. package/dist/cli/chunks/{chunk-DAEFDCJ4.js → chunk-YXP6BKGS.js} +17 -17
  161. package/dist/cli/chunks/{chunk-OBAP2TXZ.js → chunk-ZBABIZ2D.js} +2 -2
  162. package/dist/cli/chunks/{chunk-CSU5NYOX.js → chunk-ZCWERUYB.js} +4 -4
  163. package/dist/cli/chunks/{ci-464KPQNP.js → ci-RACDAJMR.js} +2 -2
  164. package/dist/cli/chunks/{ci-output-I7FX2RSO.js → ci-output-EHRSZBKG.js} +2 -2
  165. package/dist/cli/chunks/{circuit-breaker-3FW237WW.js → circuit-breaker-GBV7M5XG.js} +2 -2
  166. package/dist/cli/chunks/{claude-flow-setup-6JKMBPGU.js → claude-flow-setup-5LVJOFKP.js} +2 -2
  167. package/dist/cli/chunks/client-HUVFA5PF.js +2 -0
  168. package/dist/cli/chunks/{cline-installer-UWFHT6VY.js → cline-installer-W4NMXJSG.js} +2 -2
  169. package/dist/cli/chunks/{code-KQSUT3FS.js → code-JWXJMYXB.js} +3 -3
  170. package/dist/cli/chunks/{code-index-extractor-PABBNUSC.js → code-index-extractor-RVI2IFTM.js} +2 -2
  171. package/dist/cli/chunks/codex-installer-3BORJINH.js +14 -0
  172. package/dist/cli/chunks/{completions-7RWHAUAR.js → completions-A55NCTAO.js} +2 -2
  173. package/dist/cli/chunks/{complexity-analyzer-XPOAF33E.js → complexity-analyzer-JCXHGGLY.js} +2 -2
  174. package/dist/cli/chunks/{continuedev-installer-V4F2FIZP.js → continuedev-installer-PUVFMGYW.js} +2 -2
  175. package/dist/cli/chunks/{copilot-installer-JMICURQB.js → copilot-installer-4DCMYWHB.js} +2 -2
  176. package/dist/cli/chunks/core-handlers-UEXO3VAA.js +2 -0
  177. package/dist/cli/chunks/{cost-tracker-5OFHEYFJ.js → cost-tracker-5TV2GGKY.js} +2 -2
  178. package/dist/cli/chunks/{coverage-QKN57JDS.js → coverage-NNWM7TX3.js} +3 -3
  179. package/dist/cli/chunks/cross-domain-router-ODU5IZD6.js +2 -0
  180. package/dist/cli/chunks/{cursor-installer-GBJ7YXSM.js → cursor-installer-4NCHGJGK.js} +2 -2
  181. package/dist/cli/chunks/{daemon-IAVSO6HK.js → daemon-QIKCXKWO.js} +4 -4
  182. package/dist/cli/chunks/{daemon-GKP7CMEK.js → daemon-T4JO4IXP.js} +3 -3
  183. package/dist/cli/chunks/{dag-attention-scheduler-S225TCI7.js → dag-attention-scheduler-RPAAIDAD.js} +2 -2
  184. package/dist/cli/chunks/{detect-IUYH422U.js → detect-SBEEVDSN.js} +2 -2
  185. package/dist/cli/chunks/{dist-node-2YRE6A7C.js → dist-node-ZHI6NCSU.js} +2 -2
  186. package/dist/cli/chunks/{domain-handler-PL2TZC6H.js → domain-handler-LBC3GJ7Z.js} +2 -2
  187. package/dist/cli/chunks/{domain-plugins-HCGLXKIT.js → domain-plugins-H6IZ5USZ.js} +2 -2
  188. package/dist/cli/chunks/{domain-transfer-KQJRUPXA.js → domain-transfer-JZA5TMW3.js} +2 -2
  189. package/dist/cli/chunks/dream-HE3OX42F.js +2 -0
  190. package/dist/cli/chunks/embed-and-insert-pattern-AHTR7CRU.js +3 -0
  191. package/dist/cli/chunks/{eval-WCK7KNFN.js → eval-DZU2KISM.js} +2 -2
  192. package/dist/cli/chunks/{experience-capture-middleware-2MSQWSAR.js → experience-capture-middleware-5IQCWKSL.js} +4 -4
  193. package/dist/cli/chunks/{fast-paths-VYOSIBKF.js → fast-paths-2KLDUWCY.js} +2 -2
  194. package/dist/cli/chunks/{feature-flags-UJRHFBRX.js → feature-flags-7AC3XDZA.js} +2 -2
  195. package/dist/cli/chunks/{feature-flags-WCFUKHNQ.js → feature-flags-N6UAEZY4.js} +2 -2
  196. package/dist/cli/chunks/{file-discovery-JDGL4ZWS.js → file-discovery-5SDIW4V2.js} +2 -2
  197. package/dist/cli/chunks/{fleet-ROXVMZ2F.js → fleet-ZIQCAZ2Y.js} +3 -3
  198. package/dist/cli/chunks/{gnn-wrapper-NIO4ZCO3.js → gnn-wrapper-DUMBZJEV.js} +2 -2
  199. package/dist/cli/chunks/{heartbeat-handler-PI42WD3C.js → heartbeat-handler-6HVM6ZMR.js} +4 -4
  200. package/dist/cli/chunks/heartbeat-scheduler-QUIFGGLX.js +2 -0
  201. package/dist/cli/chunks/hnsw-adapter-42KB37KP.js +2 -0
  202. package/dist/cli/chunks/hnsw-index-T2PGO77J.js +2 -0
  203. package/dist/cli/chunks/{hnsw-legacy-bridge-YLC7SPK2.js → hnsw-legacy-bridge-5DRL5FLX.js} +2 -2
  204. package/dist/cli/chunks/{hnswlib-node-LG6OS3B7.js → hnswlib-node-GW67GTCL.js} +2 -2
  205. package/dist/cli/chunks/{hooks-WVALP5GX.js → hooks-QHH6FVO4.js} +10 -10
  206. package/dist/cli/chunks/hybrid-backend-FRNWYRKH.js +2 -0
  207. package/dist/cli/chunks/{hypergraph-engine-GJEMW3EG.js → hypergraph-engine-7XDCCVG2.js} +2 -2
  208. package/dist/cli/chunks/{hypergraph-handler-BLF6LXEV.js → hypergraph-handler-QHF7NOU5.js} +3 -3
  209. package/dist/cli/chunks/impact-analyzer-A5QYOYBR.js +2 -0
  210. package/dist/cli/chunks/{init-handler-K25RWRYY.js → init-handler-5UIVOM7K.js} +6 -6
  211. package/dist/cli/chunks/init-wizard-XBU674YH.js +2 -0
  212. package/dist/cli/chunks/kernel-DV5MTNZD.js +2 -0
  213. package/dist/cli/chunks/{kilocode-installer-BXN6WZ7G.js → kilocode-installer-TGGV6K5Q.js} +2 -2
  214. package/dist/cli/chunks/{kiro-installer-PM362DLN.js → kiro-installer-4XYBHZWW.js} +2 -2
  215. package/dist/cli/chunks/knowledge-graph-4ACGVJQK.js +2 -0
  216. package/dist/cli/chunks/{learning-CPERDDRG.js → learning-STE5W6BS.js} +3 -3
  217. package/dist/cli/chunks/{llm-router-GOAV5FPI.js → llm-router-NKF7J3RI.js} +4 -4
  218. package/dist/cli/chunks/llm-router-service-PSMASERT.js +2 -0
  219. package/dist/cli/chunks/{load-2BG6SHAK.js → load-B2T77UJQ.js} +2 -2
  220. package/dist/cli/chunks/load-test-MRUO2VPF.js +2 -0
  221. package/dist/cli/chunks/mcp-JGSFCEMH.js +2 -0
  222. package/dist/cli/chunks/{memory-4NHBYT6S.js → memory-WRFZKG56.js} +6 -6
  223. package/dist/cli/chunks/memory-backend-2MPGI6JW.js +2 -0
  224. package/dist/cli/chunks/memory-handlers-XT4HMITB.js +2 -0
  225. package/dist/cli/chunks/{multi-model-executor-KCWSGCDT.js → multi-model-executor-26Q5BSVG.js} +2 -2
  226. package/dist/cli/chunks/{opencode-installer-ATZLLK74.js → opencode-installer-J36EMQU7.js} +2 -2
  227. package/dist/cli/chunks/{orchestrator-RKB7XJRG.js → orchestrator-D5IFV65I.js} +18 -18
  228. package/dist/cli/chunks/pattern-null-store-TGWUL237.js +2 -0
  229. package/dist/cli/chunks/{pattern-usage-recorder-7VE4XDAI.js → pattern-usage-recorder-BVMTWI3E.js} +2 -2
  230. package/dist/cli/chunks/{pipeline-LQZSNDD2.js → pipeline-OWAHDUAQ.js} +2 -2
  231. package/dist/cli/chunks/platform-ANGBFWBV.js +2 -0
  232. package/dist/cli/chunks/{plugin-EJ6K2MGU.js → plugin-OO7ON2YW.js} +2 -2
  233. package/dist/cli/chunks/{prime-radiant-advanced-wasm-OIHTKJMN.js → prime-radiant-advanced-wasm-HFG3BXWU.js} +2 -2
  234. package/dist/cli/chunks/project-root-LNOYVTYY.js +2 -0
  235. package/dist/cli/chunks/protocol-executor-GEVH5KD6.js +2 -0
  236. package/dist/cli/chunks/{protocol-handler-NRBROAU7.js → protocol-handler-CE3Q6LY4.js} +2 -2
  237. package/dist/cli/chunks/{prove-EJOGEGD3.js → prove-7XPN53PY.js} +2 -2
  238. package/dist/cli/chunks/qe-reasoning-bank-DJ2JL6QB.js +2 -0
  239. package/dist/cli/chunks/{quality-E55UC73D.js → quality-TT23JRFX.js} +2 -2
  240. package/dist/cli/chunks/{quality-gate-OIQATNT3.js → quality-gate-PPPRP255.js} +3 -3
  241. package/dist/cli/chunks/queen-coordinator-F7E3AS26.js +2 -0
  242. package/dist/cli/chunks/real-embeddings-EYNZIFJE.js +2 -0
  243. package/dist/cli/chunks/{ref-validation-OPO6J7OL.js → ref-validation-QQR64ZXD.js} +2 -2
  244. package/dist/cli/chunks/{roocode-installer-ODY5KRWU.js → roocode-installer-UIGS7ZJD.js} +2 -2
  245. package/dist/cli/chunks/router-OZH3QSAU.js +2 -0
  246. package/dist/cli/chunks/routing-feedback-J2E3ADZB.js +2 -0
  247. package/dist/cli/chunks/{routing-handler-KQM6VWLC.js → routing-handler-6AENUIRG.js} +2 -2
  248. package/dist/cli/chunks/{ruvector-commands-U2GVV6PF.js → ruvector-commands-5AWMEV34.js} +2 -2
  249. package/dist/cli/chunks/rvf-dual-writer-HK525Y5Y.js +2 -0
  250. package/dist/cli/chunks/rvf-migration-adapter-Q7FB3BKR.js +2 -0
  251. package/dist/cli/chunks/rvf-migration-coordinator-NWRJ7C22.js +2 -0
  252. package/dist/cli/chunks/rvf-native-adapter-5ZRCGUI6.js +2 -0
  253. package/dist/cli/chunks/{rvf-store-integrity-KMIHD3LP.js → rvf-store-integrity-ISKRP563.js} +2 -2
  254. package/dist/cli/chunks/safe-db-3OYEPVEH.js +2 -0
  255. package/dist/cli/chunks/schedule-AG4C2EIQ.js +2 -0
  256. package/dist/cli/chunks/scheduler-SQS2CZFZ.js +2 -0
  257. package/dist/cli/chunks/{security-P5NM353C.js → security-325A7FMB.js} +3 -3
  258. package/dist/cli/chunks/{shared-rvf-adapter-LVIUOO4S.js → shared-rvf-adapter-NFL6QSZ6.js} +2 -2
  259. package/dist/cli/chunks/{shared-rvf-dual-writer-2CSG7C4W.js → shared-rvf-dual-writer-THFDYS2Z.js} +2 -2
  260. package/dist/cli/chunks/sqlite-persistence-MAKDFSHC.js +2 -0
  261. package/dist/cli/chunks/standalone-memory-UD4MJ6GZ.js +2 -0
  262. package/dist/cli/chunks/{status-handler-6TU6O37R.js → status-handler-CPFTN4XL.js} +2 -2
  263. package/dist/cli/chunks/{structural-health-KBIJSTXJ.js → structural-health-2MG2IVBL.js} +2 -2
  264. package/dist/cli/chunks/{sync-LNHI5SB7.js → sync-EE4VVKOW.js} +2 -2
  265. package/dist/cli/chunks/{sync-UHOX6RJW.js → sync-MBTW5XBF.js} +2 -2
  266. package/dist/cli/chunks/task-handler-7H5OYJG4.js +54 -0
  267. package/dist/cli/chunks/task-handlers-NH4GJHCJ.js +9 -0
  268. package/dist/cli/chunks/{test-DHAAI3DU.js → test-MPHGT4T6.js} +4 -4
  269. package/dist/cli/chunks/{test-scheduling-XDBZ3QC2.js → test-scheduling-CHQ4ZLLJ.js} +3 -3
  270. package/dist/cli/chunks/token-bootstrap-SSDCYEKK.js +2 -0
  271. package/dist/cli/chunks/{token-usage-Q2YG5YQN.js → token-usage-EBXUJNRB.js} +2 -2
  272. package/dist/cli/chunks/{transformers-F5UQTQCY.js → transformers-ZEKS2OJZ.js} +2 -2
  273. package/dist/cli/chunks/{tree-sitter-wasm-parser-DEGOHS6F.js → tree-sitter-wasm-parser-J6ZMAK37.js} +2 -2
  274. package/dist/cli/chunks/{types-JQ7EQO5Q.js → types-KYAA5VLV.js} +2 -2
  275. package/dist/cli/chunks/unified-memory-DDWMC435.js +2 -0
  276. package/dist/cli/chunks/unified-memory-hnsw-4JA7SGBK.js +2 -0
  277. package/dist/cli/chunks/unified-persistence-F6OSNTXY.js +2 -0
  278. package/dist/cli/chunks/{upgrade-TJRVGHGD.js → upgrade-UJBJ5AYM.js} +2 -2
  279. package/dist/cli/chunks/{validate-BWPCVHBN.js → validate-RUV6YMWS.js} +2 -2
  280. package/dist/cli/chunks/{validate-swarm-QVVKCQLP.js → validate-swarm-IVEVMGVM.js} +2 -2
  281. package/dist/cli/chunks/{vibium-ZFATIWHO.js → vibium-HOGMFJ2Z.js} +2 -2
  282. package/dist/cli/chunks/visual-security-25SMBIYT.js +2 -0
  283. package/dist/cli/chunks/{web-tree-sitter-KPLY7ONR.js → web-tree-sitter-AVWA6HKE.js} +2 -2
  284. package/dist/cli/chunks/{windsurf-installer-H7XM7ISA.js → windsurf-installer-DAH7HI2W.js} +2 -2
  285. package/dist/cli/chunks/{witness-chain-RRN6NDCH.js → witness-chain-PJOQPFUX.js} +2 -2
  286. package/dist/cli/chunks/witness-chain-ZW6KKUZU.js +2 -0
  287. package/dist/cli/chunks/{witness-key-manager-DFRL42GE.js → witness-key-manager-JSTBMG43.js} +2 -2
  288. package/dist/cli/chunks/{workflow-2ZQO6WYI.js → workflow-TWOIA6LZ.js} +4 -4
  289. package/dist/cli/chunks/workflow-orchestrator-UKSIDM7Q.js +2 -0
  290. package/dist/cli/chunks/{wrappers-SUS6XEJD.js → wrappers-UR7BLXKV.js} +2 -2
  291. package/dist/cli/commands/mcp.js +6 -0
  292. package/dist/cli/commands/memory.d.ts +1 -1
  293. package/dist/cli/commands/memory.js +8 -8
  294. package/dist/cli/commands/platform.js +15 -2
  295. package/dist/cli/commands/upgrade.d.ts +3 -3
  296. package/dist/cli/commands/upgrade.js +3 -3
  297. package/dist/cli/handlers/init-handler.d.ts +10 -0
  298. package/dist/cli/handlers/task-handler.js +24 -3
  299. package/dist/cli/helpers/standalone-memory.d.ts +12 -0
  300. package/dist/cli/helpers/standalone-memory.js +46 -0
  301. package/dist/cli/index.js +37 -41
  302. package/dist/cli/log-gate.d.ts +66 -0
  303. package/dist/cli/log-gate.js +170 -0
  304. package/dist/init/codex-installer.js +18 -6
  305. package/dist/init/orchestrator.js +1 -0
  306. package/dist/init/phases/09-assets.d.ts +10 -0
  307. package/dist/init/phases/09-assets.js +3 -0
  308. package/dist/init/token-bootstrap.d.ts +1 -1
  309. package/dist/init/token-bootstrap.js +12 -2
  310. package/dist/init/types.d.ts +10 -0
  311. package/dist/integrations/ruvector/brain-exporter.js +17 -0
  312. package/dist/integrations/ruvector/brain-import-audit.d.ts +20 -0
  313. package/dist/integrations/ruvector/brain-import-audit.js +22 -0
  314. package/dist/integrations/ruvector/brain-rvf-exporter.js +16 -0
  315. package/dist/integrations/ruvector/brain-shared.js +1 -1
  316. package/dist/integrations/ruvector/rvf-dual-writer.js +6 -1
  317. package/dist/kernel/hybrid-backend.d.ts +6 -0
  318. package/dist/kernel/hybrid-backend.js +18 -0
  319. package/dist/kernel/kernel.js +9 -14
  320. package/dist/kernel/project-root.d.ts +1 -1
  321. package/dist/kernel/project-root.js +24 -3
  322. package/dist/learning/embedder-identity-store.js +4 -3
  323. package/dist/learning/pattern-store.js +5 -1
  324. package/dist/learning/real-embeddings.d.ts +8 -0
  325. package/dist/learning/real-embeddings.js +16 -0
  326. package/dist/learning/rvf-pattern-store.js +10 -3
  327. package/dist/mcp/bundle.js +442 -442
  328. package/dist/mcp/entry.js +2 -0
  329. package/dist/mcp/handlers/memory-handlers.d.ts +6 -1
  330. package/dist/mcp/handlers/memory-handlers.js +44 -22
  331. package/dist/mcp/handlers/task-handlers.js +14 -1
  332. package/dist/mcp/protocol-server.js +1 -0
  333. package/dist/mcp/services/session-store.js +5 -1
  334. package/dist/plugins/cache.d.ts +2 -0
  335. package/dist/plugins/cache.js +15 -2
  336. package/dist/plugins/lifecycle.js +15 -2
  337. package/dist/plugins/manifest.js +7 -5
  338. package/dist/plugins/resolver.d.ts +13 -22
  339. package/dist/plugins/resolver.js +169 -61
  340. package/dist/plugins/version-policy.d.ts +13 -0
  341. package/dist/plugins/version-policy.js +18 -0
  342. package/dist/shared/types/index.d.ts +6 -0
  343. package/dist/shared/types/index.js +8 -0
  344. package/package.json +2 -1
  345. package/dist/cli/chunks/adapter-TNNNJRDG.js +0 -2
  346. package/dist/cli/chunks/aqe-learning-engine-5ZRMYJLB.js +0 -2
  347. package/dist/cli/chunks/base-KWZHOPSH.js +0 -2
  348. package/dist/cli/chunks/brain-handler-ET6YAP4B.js +0 -90
  349. package/dist/cli/chunks/browser-workflow-2FZTKDUL.js +0 -2
  350. package/dist/cli/chunks/chunk-33YYYWBQ.js +0 -4
  351. package/dist/cli/chunks/chunk-5Z6XZV7K.js +0 -65
  352. package/dist/cli/chunks/chunk-6J62K3SW.js +0 -2
  353. package/dist/cli/chunks/chunk-6TPKK7LD.js +0 -15
  354. package/dist/cli/chunks/chunk-DEYLEDJN.js +0 -27
  355. package/dist/cli/chunks/chunk-KGT36Z42.js +0 -14
  356. package/dist/cli/chunks/chunk-NA7B2QYB.js +0 -2
  357. package/dist/cli/chunks/chunk-NDPFGIMJ.js +0 -13
  358. package/dist/cli/chunks/chunk-PEPFCPES.js +0 -2
  359. package/dist/cli/chunks/chunk-TT23RRB7.js +0 -2
  360. package/dist/cli/chunks/chunk-XWMZ6D6N.js +0 -2
  361. package/dist/cli/chunks/client-7E4LM2WW.js +0 -2
  362. package/dist/cli/chunks/codex-installer-CQ24DTP5.js +0 -14
  363. package/dist/cli/chunks/core-handlers-IFG3757P.js +0 -2
  364. package/dist/cli/chunks/cross-domain-router-EK7W4PGP.js +0 -2
  365. package/dist/cli/chunks/dream-NFSCSLY7.js +0 -2
  366. package/dist/cli/chunks/embed-and-insert-pattern-ZPAG7235.js +0 -3
  367. package/dist/cli/chunks/heartbeat-scheduler-ZATCDJDK.js +0 -2
  368. package/dist/cli/chunks/hnsw-adapter-WXQABRCA.js +0 -2
  369. package/dist/cli/chunks/hnsw-index-TPSWLEA5.js +0 -2
  370. package/dist/cli/chunks/impact-analyzer-HNIU45P5.js +0 -2
  371. package/dist/cli/chunks/init-wizard-JUIPBMHG.js +0 -2
  372. package/dist/cli/chunks/kernel-5BOZQ754.js +0 -2
  373. package/dist/cli/chunks/knowledge-graph-EWDAENWM.js +0 -2
  374. package/dist/cli/chunks/llm-router-service-3YT7JGBS.js +0 -2
  375. package/dist/cli/chunks/load-test-BP2CPLIV.js +0 -2
  376. package/dist/cli/chunks/mcp-5TTB37DC.js +0 -2
  377. package/dist/cli/chunks/memory-backend-4PYQBPRM.js +0 -2
  378. package/dist/cli/chunks/memory-handlers-2B27NITS.js +0 -2
  379. package/dist/cli/chunks/pattern-null-store-OYOQOV2O.js +0 -2
  380. package/dist/cli/chunks/platform-OD5H5U6G.js +0 -2
  381. package/dist/cli/chunks/protocol-executor-3ATJTXWG.js +0 -2
  382. package/dist/cli/chunks/qe-reasoning-bank-LLMYZT4X.js +0 -2
  383. package/dist/cli/chunks/queen-coordinator-RN7L6KG5.js +0 -2
  384. package/dist/cli/chunks/real-embeddings-FPFFNOSZ.js +0 -2
  385. package/dist/cli/chunks/router-MDHITQ2V.js +0 -2
  386. package/dist/cli/chunks/routing-feedback-5XLNJ3Y3.js +0 -2
  387. package/dist/cli/chunks/rvf-dual-writer-JBW4O3II.js +0 -2
  388. package/dist/cli/chunks/rvf-migration-adapter-BPPQL4XJ.js +0 -2
  389. package/dist/cli/chunks/rvf-migration-coordinator-V2GHCJKN.js +0 -2
  390. package/dist/cli/chunks/rvf-native-adapter-S4562CG5.js +0 -2
  391. package/dist/cli/chunks/safe-db-FIRHSXVF.js +0 -2
  392. package/dist/cli/chunks/schedule-RVXFB4HK.js +0 -2
  393. package/dist/cli/chunks/scheduler-IKKAMAOO.js +0 -2
  394. package/dist/cli/chunks/sqlite-persistence-SQ3HCUQ7.js +0 -2
  395. package/dist/cli/chunks/task-handler-AVDHMLGI.js +0 -49
  396. package/dist/cli/chunks/task-handlers-KYK4VTRA.js +0 -9
  397. package/dist/cli/chunks/token-bootstrap-GUTTLPZX.js +0 -2
  398. package/dist/cli/chunks/unified-memory-CXHLHB5I.js +0 -2
  399. package/dist/cli/chunks/unified-memory-hnsw-I7WAE54M.js +0 -2
  400. package/dist/cli/chunks/unified-persistence-6CPF65WI.js +0 -2
  401. package/dist/cli/chunks/visual-security-GNPHME5H.js +0 -2
  402. package/dist/cli/chunks/witness-chain-VT4UHHBR.js +0 -2
  403. package/dist/cli/chunks/workflow-orchestrator-DB3HIECD.js +0 -2
@@ -1,80 +1,188 @@
1
- /**
2
- * Agentic QE v3 - Plugin Dependency Resolver (IMP-09)
3
- *
4
- * DFS dependency resolution with cycle detection.
5
- * Given a set of plugin manifests, produces a topologically-sorted
6
- * load order where dependencies are loaded before dependents.
7
- */
8
- // ============================================================================
9
- // PluginResolver
10
- // ============================================================================
1
+ import { AQE_VERSION, validVersion, validRange, compareVersions, newestVersionFirst, satisfiesVersion, } from './version-policy.js';
11
2
  export class PluginResolver {
12
- /**
13
- * Resolve plugin load order via DFS topological sort.
14
- *
15
- * @param manifests - All available plugin manifests
16
- * @returns Ordered list of plugins safe to load sequentially
17
- * @throws Error if a dependency cycle is detected
18
- */
19
- resolve(manifests) {
20
- const byName = new Map();
21
- for (const m of manifests) {
22
- byName.set(m.name, m);
3
+ aqeVersion;
4
+ constructor(aqeVersion = AQE_VERSION) {
5
+ this.aqeVersion = aqeVersion;
6
+ }
7
+ resolve(manifests, roots) {
8
+ const groups = new Map();
9
+ const rejected = new Map();
10
+ for (const manifest of manifests) {
11
+ const candidates = groups.get(manifest.name) ?? [];
12
+ groups.set(manifest.name, candidates);
13
+ const error = this.validateVersions(manifest);
14
+ if (error)
15
+ rejected.set(manifest.name, [...(rejected.get(manifest.name) ?? []), error]);
16
+ else
17
+ candidates.push(manifest);
18
+ }
19
+ for (const candidates of groups.values()) {
20
+ candidates.sort((a, b) => newestVersionFirst(a.version, b.version));
23
21
  }
24
- const ordered = [];
25
- const visited = new Set();
26
- const visiting = new Set(); // cycle detection (gray nodes)
27
22
  const missing = new Map();
28
- const visit = (name, path) => {
29
- if (visited.has(name))
30
- return;
31
- if (visiting.has(name)) {
32
- const cycle = [...path.slice(path.indexOf(name)), name];
33
- throw new Error(`Dependency cycle detected: ${cycle.join(' -> ')}`);
23
+ const errors = [];
24
+ const result = (ordered) => ({
25
+ ordered: ordered.map((manifest, order) => ({ manifest, order })), missing, errors,
26
+ selectedVersions: Object.fromEntries(ordered.map(m => [m.name, m.version])),
27
+ aqeVersion: this.aqeVersion,
28
+ });
29
+ const names = [...(roots ?? groups.keys())].sort();
30
+ const required = new Set(names);
31
+ const selected = new Map();
32
+ let attempts = 0;
33
+ let limited = false;
34
+ const compatible = () => {
35
+ for (const manifest of selected.values()) {
36
+ for (const [dep, range] of Object.entries(manifest.dependencies ?? {})) {
37
+ const chosen = selected.get(dep);
38
+ const candidates = chosen ? [chosen] : groups.get(dep) ?? [];
39
+ if (!candidates.some(candidate => satisfiesVersion(candidate.version, range)))
40
+ return false;
41
+ }
34
42
  }
35
- const manifest = byName.get(name);
36
- if (!manifest) {
37
- // Missing dependency — record it but don't fail the entire resolution
38
- return;
43
+ return true;
44
+ };
45
+ let cycle;
46
+ const findCycle = () => {
47
+ const visited = new Set();
48
+ const visiting = new Set();
49
+ const visit = (name, path) => {
50
+ if (visiting.has(name))
51
+ return [...path.slice(path.indexOf(name)), name];
52
+ if (visited.has(name))
53
+ return;
54
+ visiting.add(name);
55
+ for (const dependency of Object.keys(selected.get(name)?.dependencies ?? {})) {
56
+ const found = visit(dependency, [...path, name]);
57
+ if (found)
58
+ return found;
59
+ }
60
+ visiting.delete(name);
61
+ visited.add(name);
62
+ return undefined;
63
+ };
64
+ for (const name of selected.keys()) {
65
+ const found = visit(name, []);
66
+ if (found)
67
+ return found;
39
68
  }
40
- visiting.add(name);
41
- // Visit dependencies first
42
- const deps = Object.keys(manifest.dependencies ?? {});
43
- const missingDeps = [];
44
- for (const dep of deps) {
45
- if (!byName.has(dep)) {
46
- missingDeps.push(dep);
69
+ return undefined;
70
+ };
71
+ const choose = () => {
72
+ const pending = new Set(names);
73
+ for (const manifest of selected.values()) {
74
+ for (const name of Object.keys(manifest.dependencies ?? {}))
75
+ pending.add(name);
76
+ }
77
+ const name = [...pending].sort().find(name => !selected.has(name));
78
+ if (!name) {
79
+ const found = findCycle();
80
+ if (found) {
81
+ cycle = found;
82
+ return false;
47
83
  }
48
- else {
49
- visit(dep, [...path, name]);
84
+ return true;
85
+ }
86
+ required.add(name);
87
+ for (const candidate of groups.get(name) ?? []) {
88
+ if (++attempts > 10_000) {
89
+ limited = true;
90
+ return false;
50
91
  }
92
+ selected.set(name, candidate);
93
+ if (compatible() && choose())
94
+ return true;
95
+ selected.delete(name);
96
+ if (limited)
97
+ return false;
98
+ }
99
+ return false;
100
+ };
101
+ if (!choose()) {
102
+ if (cycle && !limited)
103
+ throw new Error(`Dependency cycle detected: ${cycle.join(' -> ')}`);
104
+ for (const name of required) {
105
+ if (!groups.get(name)?.length)
106
+ errors.push(...(rejected.get(name) ?? []));
51
107
  }
52
- if (missingDeps.length > 0) {
53
- missing.set(name, missingDeps);
108
+ for (const [name, candidates] of groups) {
109
+ const absent = [...new Set(candidates.flatMap(m => Object.keys(m.dependencies ?? {})))].filter(dep => !groups.has(dep));
110
+ if (absent.length)
111
+ missing.set(name, absent);
54
112
  }
113
+ errors.push({
114
+ code: limited ? 'RESOLUTION_LIMIT' : missing.size ? 'MISSING_DEPENDENCY' : 'UNSATISFIED_DEPENDENCY_RANGE',
115
+ plugin: names.join(', '),
116
+ message: limited ? 'Plugin dependency search exceeded 10000 candidates' : 'No cached plugin selection satisfies all dependency ranges',
117
+ });
118
+ return result([]);
119
+ }
120
+ const ordered = [];
121
+ const visited = new Set();
122
+ const visiting = new Set();
123
+ const visit = (name, path) => {
124
+ if (visited.has(name))
125
+ return;
126
+ if (visiting.has(name))
127
+ throw new Error(`Dependency cycle detected: ${[...path.slice(path.indexOf(name)), name].join(' -> ')}`);
128
+ visiting.add(name);
129
+ const manifest = selected.get(name);
130
+ for (const dep of Object.keys(manifest.dependencies ?? {}))
131
+ visit(dep, [...path, name]);
55
132
  visiting.delete(name);
56
133
  visited.add(name);
57
134
  ordered.push(manifest);
58
135
  };
59
- // Visit all plugins
60
- for (const m of manifests) {
61
- visit(m.name, []);
136
+ for (const name of [...selected.keys()].sort())
137
+ visit(name, []);
138
+ return result(ordered);
139
+ }
140
+ /** Startup is best-effort: retain admitted roots when another root fails. */
141
+ resolveAvailable(manifests) {
142
+ const accepted = [];
143
+ let result = this.resolve(manifests, []);
144
+ const errors = [];
145
+ const missing = new Map();
146
+ for (const name of [...new Set(manifests.map(m => m.name))].sort()) {
147
+ try {
148
+ // Re-solve together so shared dependency versions remain compatible.
149
+ // A failed candidate cannot invalidate the last successful selection.
150
+ const candidate = this.resolve(manifests, [...accepted, name]);
151
+ if (candidate.errors.length) {
152
+ errors.push(...candidate.errors.map(error => ({ ...error, plugin: name })));
153
+ for (const [plugin, dependencies] of candidate.missing)
154
+ missing.set(plugin, dependencies);
155
+ continue;
156
+ }
157
+ accepted.push(name);
158
+ result = candidate;
159
+ }
160
+ catch (error) {
161
+ errors.push({ code: 'DEPENDENCY_CYCLE', plugin: name,
162
+ message: error instanceof Error ? error.message : String(error) });
163
+ }
62
164
  }
63
- return {
64
- ordered: ordered.map((manifest, index) => ({ manifest, order: index })),
65
- missing,
66
- };
165
+ return { ...result, errors, missing };
67
166
  }
68
- /**
69
- * Check if a specific plugin can be loaded given the currently loaded set.
70
- */
167
+ /** Version-constrained dependencies require versions, not a legacy name-only Set. */
71
168
  canLoad(manifest, loaded) {
72
- const deps = Object.keys(manifest.dependencies ?? {});
73
- const missingDeps = deps.filter(d => !loaded.has(d));
74
- return {
75
- canLoad: missingDeps.length === 0,
76
- missingDeps,
77
- };
169
+ const missingDeps = Object.entries(manifest.dependencies ?? {}).filter(([name, range]) => {
170
+ const version = loaded instanceof Set ? undefined : loaded.get(name);
171
+ return !version || !validRange(range) || !satisfiesVersion(version, range);
172
+ }).map(([name]) => name);
173
+ return { canLoad: !this.validateVersions(manifest) && missingDeps.length === 0, missingDeps };
174
+ }
175
+ validateVersions(manifest) {
176
+ if (!validVersion(manifest.version))
177
+ return { code: 'INVALID_PLUGIN_VERSION', plugin: manifest.name, message: 'Invalid plugin version' };
178
+ for (const range of Object.values(manifest.dependencies ?? {})) {
179
+ if (!validRange(range))
180
+ return { code: 'INVALID_DEPENDENCY_RANGE', plugin: manifest.name, message: 'Invalid dependency range' };
181
+ }
182
+ if (manifest.minAqeVersion && (!validVersion(manifest.minAqeVersion) || !validVersion(this.aqeVersion) || compareVersions(this.aqeVersion, manifest.minAqeVersion) < 0)) {
183
+ return { code: 'AQE_VERSION_INCOMPATIBLE', plugin: manifest.name, message: `Requires AQE ${manifest.minAqeVersion}; running ${this.aqeVersion}` };
184
+ }
185
+ return undefined;
78
186
  }
79
187
  }
80
188
  //# sourceMappingURL=resolver.js.map
@@ -0,0 +1,13 @@
1
+ export declare const AQE_VERSION: string;
2
+ export declare const validVersion: (value: unknown) => boolean;
3
+ export declare const validRange: (value: string) => boolean;
4
+ export declare const satisfiesVersion: (version: string, range: string) => boolean;
5
+ export declare const compareVersions: (a: string, b: string) => number;
6
+ /** Equal-precedence build metadata has a stable lexical tie-break, not higher precedence. */
7
+ export declare const newestVersionFirst: (a: string, b: string) => number;
8
+ export interface PluginVersionFailure {
9
+ code: 'INVALID_PLUGIN_VERSION' | 'INVALID_DEPENDENCY_RANGE' | 'MISSING_DEPENDENCY' | 'DEPENDENCY_CYCLE' | 'UNSATISFIED_DEPENDENCY_RANGE' | 'AQE_VERSION_INCOMPATIBLE' | 'RESOLUTION_LIMIT';
10
+ plugin: string;
11
+ message: string;
12
+ }
13
+ //# sourceMappingURL=version-policy.d.ts.map
@@ -0,0 +1,18 @@
1
+ /** npm SemVer is the single oracle for plugin versions and ranges. */
2
+ import { createRequire } from 'node:module';
3
+ const require = createRequire(import.meta.url);
4
+ const semver = require('semver');
5
+ export const AQE_VERSION = typeof __CLI_VERSION__ !== 'undefined' ? __CLI_VERSION__
6
+ : typeof __MCP_VERSION__ !== 'undefined' ? __MCP_VERSION__
7
+ : require('../../package.json').version;
8
+ // semver.valid drops build metadata; retain valid metadata but reject normalized
9
+ // prefixes/whitespace so cache directory names remain canonical.
10
+ // Cached manifests are untrusted JSON (older releases admitted a non-string
11
+ // minAqeVersion), so a non-string must be rejected here rather than throw.
12
+ export const validVersion = (value) => typeof value === 'string' && semver.valid(value) === value.split('+')[0];
13
+ export const validRange = (value) => semver.validRange(value) !== null;
14
+ export const satisfiesVersion = (version, range) => semver.satisfies(version, range);
15
+ export const compareVersions = (a, b) => semver.compare(a, b);
16
+ /** Equal-precedence build metadata has a stable lexical tie-break, not higher precedence. */
17
+ export const newestVersionFirst = (a, b) => compareVersions(b, a) || a.localeCompare(b);
18
+ //# sourceMappingURL=version-policy.js.map
@@ -11,6 +11,12 @@ export interface AgentId {
11
11
  }
12
12
  export type DomainName = 'test-generation' | 'test-execution' | 'coverage-analysis' | 'quality-assessment' | 'defect-intelligence' | 'requirements-validation' | 'code-intelligence' | 'security-compliance' | 'contract-testing' | 'visual-accessibility' | 'chaos-resilience' | 'learning-optimization' | 'enterprise-integration' | 'coordination';
13
13
  export declare const ALL_DOMAINS: readonly DomainName[];
14
+ /**
15
+ * Type guard for user-supplied domain names (CLI flags, MCP arguments).
16
+ * Validate at the boundary so an unknown domain is rejected instead of being
17
+ * accepted as work no domain will ever run (#734).
18
+ */
19
+ export declare function isDomainName(value: unknown): value is DomainName;
14
20
  export interface DomainEvent<T = unknown> {
15
21
  readonly id: string;
16
22
  readonly type: string;
@@ -18,6 +18,14 @@ export const ALL_DOMAINS = [
18
18
  'enterprise-integration',
19
19
  'coordination',
20
20
  ];
21
+ /**
22
+ * Type guard for user-supplied domain names (CLI flags, MCP arguments).
23
+ * Validate at the boundary so an unknown domain is rejected instead of being
24
+ * accepted as work no domain will ever run (#734).
25
+ */
26
+ export function isDomainName(value) {
27
+ return typeof value === 'string' && ALL_DOMAINS.includes(value);
28
+ }
21
29
  export function ok(value) {
22
30
  return { success: true, value };
23
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-qe",
3
- "version": "3.14.4",
3
+ "version": "3.14.5",
4
4
  "description": "Agentic Quality Engineering V3 - Domain-Driven Design Architecture with 13 Bounded Contexts, O(log n) coverage analysis, ReasoningBank learning, 60 specialized QE agents, mathematical Coherence verification, deep Claude Flow integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -193,6 +193,7 @@
193
193
  "pg": "^8.17.2",
194
194
  "prime-radiant-advanced-wasm": "^0.1.3",
195
195
  "secure-json-parse": "^4.1.0",
196
+ "semver": "^7.8.5",
196
197
  "typescript": "^5.9.3",
197
198
  "uuid": "^14.0.0",
198
199
  "vibium": "^0.1.2",
@@ -1,2 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.4");process.exit(0)}
2
- import{a,b,c}from"./chunk-XJ7QNVI5.js";import"./chunk-CLTMDCSE.js";import"./chunk-M4WJKGVK.js";import"./chunk-DHJPWQBR.js";import"./chunk-G6T45OIC.js";import"./chunk-TT23RRB7.js";export{a as AgentBoosterAdapter,b as createAgentBoosterAdapter,c as createAgentBoosterAdapterSync};
@@ -1,2 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.4");process.exit(0)}
2
- import{a,b,c,d,e,f}from"./chunk-CSU5NYOX.js";import"./chunk-J6GNQS62.js";import"./chunk-CIKSHTEQ.js";import"./chunk-5Z6XZV7K.js";import"./chunk-IFCLB7FJ.js";import"./chunk-4OYFXLBK.js";import"./chunk-ZBAKA4YB.js";import"./chunk-T6BVLVI5.js";import"./chunk-ZJ26AQA5.js";import"./chunk-OBAP2TXZ.js";import"./chunk-IPR4QP3H.js";import"./chunk-DEYLEDJN.js";import"./chunk-TPGED2IF.js";import"./chunk-MNW6QGNJ.js";import"./chunk-MCUJEZT6.js";import"./chunk-NDPFGIMJ.js";import"./chunk-55RWDRJD.js";import"./chunk-R4VL6E65.js";import"./chunk-RJCYCLZV.js";import"./chunk-NA7B2QYB.js";import"./chunk-Y3MW3YBC.js";import"./chunk-PEPFCPES.js";import"./chunk-DHJPWQBR.js";import"./chunk-BOZZYWCR.js";import"./chunk-TDZ53WO2.js";import"./chunk-QGIU2WRL.js";import"./chunk-STM3UDNO.js";import"./chunk-G6T45OIC.js";import"./chunk-SRKETSFF.js";import"./chunk-BGE6FOLM.js";import"./chunk-5YPYDPBJ.js";import"./chunk-HDSAM2RE.js";import"./chunk-KCZR45PA.js";import"./chunk-BFP7KO7P.js";import"./chunk-ODKLFVYC.js";import"./chunk-VD6QRULW.js";import"./chunk-KHFNNVJA.js";import"./chunk-CNG6GQEZ.js";import"./chunk-TT23RRB7.js";export{b as AQELearningEngine,a as DEFAULT_ENGINE_CONFIG,c as DEFAULT_META_LEARNING_CONFIG,d as MetaLearningEngine,e as createAQELearningEngine,f as createDefaultLearningEngine};
@@ -1,2 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.4");process.exit(0)}
2
- import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-W7BWUTVV.js";import"./chunk-6TPKK7LD.js";import"./chunk-55RWDRJD.js";import"./chunk-R4VL6E65.js";import"./chunk-RJCYCLZV.js";import"./chunk-NA7B2QYB.js";import"./chunk-Y3MW3YBC.js";import"./chunk-PEPFCPES.js";import"./chunk-DHJPWQBR.js";import"./chunk-G6T45OIC.js";import"./chunk-SRKETSFF.js";import"./chunk-AIHDEEJO.js";import"./chunk-BGE6FOLM.js";import"./chunk-5YPYDPBJ.js";import"./chunk-HDSAM2RE.js";import"./chunk-KCZR45PA.js";import"./chunk-BFP7KO7P.js";import"./chunk-ODKLFVYC.js";import"./chunk-VD6QRULW.js";import"./chunk-KHFNNVJA.js";import"./chunk-CNG6GQEZ.js";import"./chunk-TT23RRB7.js";export{l as MCPToolBase,k as defaultToolLogger,j as getKernel,i as getLLMRouter,e as getMemoryBackend,g as getSharedLLMRouter,c as getSharedMemoryBackend,a as isMemoryOnlyMode,b as registerRvfResetFn,h as resetSharedLLMRouter,d as resetSharedMemoryBackend,f as setSharedLLMRouter};
@@ -1,90 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.4");process.exit(0)}
2
- import{a as L,b as K,c as z,d as x,e as oe,f as J,g as G,h as N,i as Re,j as ae,k as Q,l as Se,m as U,n as ie,o as xe,p as P,q as X,r as Y,s as Z,t as ee}from"./chunk-UGVHCMUN.js";import{h as ve}from"./chunk-DEYLEDJN.js";import{b as we}from"./chunk-TPGED2IF.js";import"./chunk-55RWDRJD.js";import"./chunk-R4VL6E65.js";import"./chunk-RJCYCLZV.js";import"./chunk-NA7B2QYB.js";import"./chunk-Y3MW3YBC.js";import"./chunk-PEPFCPES.js";import{b as A,d as re}from"./chunk-DHJPWQBR.js";import{a as be,b as he,c as H,d as V,f as Ye}from"./chunk-TDZ53WO2.js";import"./chunk-G6T45OIC.js";import{a as F,b as Xe}from"./chunk-BGE6FOLM.js";import"./chunk-5YPYDPBJ.js";import"./chunk-HDSAM2RE.js";import"./chunk-KCZR45PA.js";import"./chunk-BFP7KO7P.js";import"./chunk-ODKLFVYC.js";import"./chunk-VD6QRULW.js";import"./chunk-KHFNNVJA.js";import"./chunk-CNG6GQEZ.js";import"./chunk-TT23RRB7.js";import D from"path";import o from"chalk";Xe();re();import{existsSync as ne,mkdirSync as Ze,writeFileSync as en,readFileSync as se}from"fs";import{join as k,resolve as le}from"path";var nn={rl_q_values:"includeQValues",dream_insights:"includeDreamInsights",dream_cycles:"includeDreamInsights",witness_chain:"includeWitnessChain",vectors:"includeVectors"};function tn(e,n){let r=nn[e.tableName];return!(r&&n[r]===!1)}var rn=1e4;function on(e,n,r,t){if(!tn(n,r))return ie(k(t,n.fileName),[]),{count:0,rows:[]};let[a,i]=n.domainColumn?U(r.domains,n.domainColumn):[void 0,[]];if(r.domains&&r.domains.length>0&&!n.domainColumn){let s=r.domains.map(()=>"?").join(","),f=`manifest_id IN (SELECT id FROM learning_evidence_manifests WHERE task_family IN (${s}))`;["learning_evidence_segments","learning_segment_edges","learning_evidence_admissions"].includes(n.tableName)?(a=f,i=[...r.domains]):["pattern_manifest_lineage","pattern_segment_lineage"].includes(n.tableName)&&(a=`${f} AND pattern_id IN (SELECT id FROM qe_patterns WHERE qe_domain IN (${s}))`,i=[...r.domains,...r.domains])}if(ae(e,n.tableName,a,i)>=rn){let s=n.blobColumns,f=s&&s.length>0?p=>J(p,s):void 0;return{count:xe(k(t,n.fileName),Se(e,n.tableName,a,i),f)}}let l=Q(e,n.tableName,a,i);return n.blobColumns&&n.blobColumns.length>0&&(l=l.map(s=>J(s,n.blobColumns))),ie(k(t,n.fileName),l),{count:l.length,rows:l}}function Ce(e){let n=[];for(let r of x){let t=k(e,r.fileName);ne(t)?n.push(N(se(t,"utf-8"))):n.push(N(""))}return N(n.join(":"))}function _e(e,n,r="memory.db"){let t=le(n.outputPath);ne(t)||Ze(t,{recursive:!0});let a=0,i={},c=new Set;for(let m of x){let p=on(e,m,n,t);if(i[m.tableName]=p.count,a+=p.count,m.tableName==="qe_patterns"){if(p.rows)for(let g of p.rows)g.qe_domain&&c.add(g.qe_domain);else if(p.count>0){let[g,C]=m.domainColumn?U(n.domains,m.domainColumn):[void 0,[]],v=`SELECT DISTINCT qe_domain FROM qe_patterns ${g?`WHERE ${g} AND qe_domain IS NOT NULL`:"WHERE qe_domain IS NOT NULL"}`;try{let u=e.prepare(v).all(...C||[]);for(let h of u)c.add(h.qe_domain)}catch{}}}}let l=n.includeVectors!==!1?ae(e,"vectors"):0,s=Ce(t),f={version:"3.0",exportedAt:new Date().toISOString(),sourceDb:r,stats:{patternCount:i.qe_patterns||0,vectorCount:l,qValueCount:i.rl_q_values||0,dreamInsightCount:i.dream_insights||0,witnessChainLength:i.witness_chain||0,totalRecords:a},domains:[...c].sort(),checksum:s,tableRecordCounts:i};return en(k(t,"manifest.json"),JSON.stringify(f,null,2),"utf-8"),f}var an=new Set(["qe_patterns","rl_q_values","dream_insights","witness_chain"]);function sn(e){return e==="1.0"?x.filter(n=>an.has(n.tableName)):e==="3.0"?x:(console.warn(`[brain-import] Unknown manifest version '${e}'. Attempting full import \u2014 some files may be missing.`),x)}function Ee(e,n,r){let t=le(n),a=k(t,"manifest.json");if(!ne(a))throw new Error(`Manifest not found at ${a}`);let i=A(se(a,"utf-8")),c=Ce(t);if(c!==i.checksum)throw new Error(`Checksum mismatch: expected ${i.checksum}, got ${c}. The export may have been tampered with or corrupted.`);let l=sn(i.version),s=0,f=0,m=0,p=()=>{let g=new Map,C=new Map;for(let d of l){let v=k(t,d.fileName),u=P(v,A);d.blobColumns&&d.blobColumns.length>0&&(u=u.map(h=>G(h,d.blobColumns)));for(let h of u){let R=X(h,g),E;if(d.dedupColumns&&d.dedupColumns.length>0)E=Z(e,d.tableName,R,d.dedupColumns,d.preserveId);else{let $=L[d.tableName]||"id",B=z[d.tableName],O=K[d.tableName];E=Y(e,d.tableName,R,$,r.mergeStrategy,B,O,g,C,h.pattern_id)}s+=E.imported,f+=E.skipped,m+=E.conflicts}}};return ee(e,r.dryRun??!1,p),{imported:s,skipped:f,conflicts:m}}function Be(e){let n=le(e),r=k(n,"manifest.json");if(!ne(r))throw new Error(`Manifest not found at ${r}`);return A(se(r,"utf-8"))}Ye();import{existsSync as j,readdirSync as ln,renameSync as cn,statSync as dn,unlinkSync as ce,writeFileSync as fn}from"fs";import{basename as mn,dirname as un,join as pn,resolve as te}from"path";var Oe=["",".idmap.json",".manifest.json"],gn=[...Oe,".lock"];function Ie(e){for(let n of gn)try{let r=`${e}${n}`;j(r)&&ce(r)}catch{}}function yn(e){let n=un(e),r=`${mn(e)}.tmp.`,t;try{t=ln(n)}catch{return}for(let a of t){if(!a.startsWith(r))continue;let i=Number.parseInt(a.slice(r.length).split(".")[0],10);if(!(!Number.isInteger(i)||i<=0)&&!(i!==process.pid&&bn(i)))try{ce(pn(n,a))}catch{}}}function bn(e){try{return process.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function Ae(e,n,r="memory.db"){if(!V())throw new Error("@ruvector/rvf-node is not available. Install it or use --format jsonl instead.");let t=te(n.outputPath),a=n.dimension??384,i=`${t}.tmp.${process.pid}`;yn(t),Ie(i);let c=be(i,a),l=!1;try{let s={},f=new Set,m=0;for(let y of x){let[S,w]=y.domainColumn?U(n.domains,y.domainColumn):[void 0,[]],_=Q(e,y.tableName,S,w);if(n.domains&&n.domains.length>0){let b=new Set((s.learning_evidence_manifests??[]).map(I=>I.id)),q=new Set((s.qe_patterns??[]).map(I=>I.id));["learning_evidence_segments","learning_segment_edges","learning_evidence_admissions"].includes(y.tableName)?_=_.filter(I=>b.has(I.manifest_id)):y.tableName==="pattern_manifest_lineage"?_=_.filter(I=>{let T=I;return b.has(T.manifest_id)&&q.has(T.pattern_id)}):y.tableName==="pattern_segment_lineage"&&(_=_.filter(I=>{let T=I;return b.has(T.manifest_id)&&q.has(T.pattern_id)}))}if(y.tableName==="qe_patterns")for(let b of _)b.qe_domain&&f.add(b.qe_domain);let M=oe[y.tableName];M&&M.length>0&&(_=_.map(b=>J(b,M))),s[y.tableName]=_,m+=_.length}let p=0,g=[];if(Re(e,"qe_pattern_embeddings")){let y=e.prepare("PRAGMA table_info('qe_pattern_embeddings')").all().some(w=>w.name==="space_id"),S=e.prepare(`SELECT pattern_id, embedding, dimension, ${y?"space_id":"NULL"} AS space_id
3
- FROM qe_pattern_embeddings`).all();for(let w of S)w.embedding&&w.dimension===a&&w.space_id&&g.push({id:`pe:${w.pattern_id}`,vector:new Float32Array(w.embedding.buffer,w.embedding.byteOffset,a),metadata:{tableName:"qe_pattern_embeddings",spaceId:w.space_id}})}g.length>0&&(p=c.ingest(g).accepted);let C={version:"3.0",format:"rvf",exportedAt:new Date().toISOString(),sourceDb:r,domains:[...f].sort(),tables:s},d=JSON.stringify(C),v=N(d),u=Buffer.from(d);c.embedKernel(u);let h=n.sign?c.sign(u)??void 0:void 0,R=h?n.signerKeyId??"default":void 0,E=c.fileId(),$=E?{fileId:E,parentId:c.parentId(),lineageDepth:c.lineageDepth()}:void 0,B=c.status(),O={version:"3.0",format:"rvf",exportedAt:C.exportedAt,sourceDb:r,stats:{patternCount:(s.qe_patterns||[]).length,embeddingCount:p,qValueCount:(s.rl_q_values||[]).length,dreamInsightCount:(s.dream_insights||[]).length,witnessChainLength:(s.witness_chain||[]).length,totalRecords:m,tableCounts:Object.fromEntries(x.map(({tableName:y})=>[y,s[y]?.length??0]))},domains:C.domains,checksum:v,rvfStatus:{totalVectors:B.totalVectors,totalSegments:B.totalSegments,fileSizeBytes:B.fileSizeBytes},...h?{signature:h,signerKeyId:R}:{},...$?{lineage:$}:{}};if(h)try{c.freeze()}catch{}if(fn(`${i}.manifest.json`,JSON.stringify(O,null,2),"utf-8"),c.close(),l=!0,j(t)&&!n.allowOverwriteRicher){let y;try{y=W(t)}catch(S){if(hn(t)||!wn(S)){let w=S instanceof Error?S.message:String(S);throw new Error(`RVF_MIRROR_INSPECTION_AMBIGUOUS: the existing mirror is readable but its richness could not be established (${w}). Preserve/import it before retrying, or repeat with --force-overwrite-richer after preserving a backup.`)}}if(y){let S=y.stats.tableCounts,w=O.stats.tableCounts,_=x.map(({tableName:b})=>b).filter(b=>!S||!Number.isSafeInteger(S[b]));if(_.length>0)throw new Error(`RVF_MIRROR_INSPECTION_AMBIGUOUS: existing mirror lacks trustworthy counts for ${_.join(", ")}. Preserve/import it before retrying, or repeat with --force-overwrite-richer after preserving a backup.`);let M=x.map(({tableName:b})=>({tableName:b,existing:S[b],candidate:w[b]})).filter(({existing:b,candidate:q})=>b>q);if(M.length>0){let b=M.map(({tableName:q,existing:I,candidate:T})=>`${q} ${I} -> ${T}`).join(", ");throw new Error(`RVF_MIRROR_RICHER: refusing to replace richer mirrored tables: ${b}. Restore/import the mirror first, or repeat with --force-overwrite-richer after preserving a backup.`)}}}for(let y of[...Oe].reverse()){let S=`${i}${y}`,w=`${t}${y}`;j(S)?cn(S,w):j(w)&&ce(w)}return O}catch(s){if(!l)try{c.close()}catch{}throw Ie(i),s}}function hn(e){let n;try{return n=H(te(e)),!!n.extractKernel()?.image}catch{return!1}finally{try{n?.close()}catch{}}}function wn(e){let n=e instanceof Error?e.message:String(e);return/ManifestNotFound|InvalidMagic|ChecksumMismatch|CorruptStore/i.test(n)}var vn={patterns:"qe_patterns",qValues:"rl_q_values",dreamInsights:"dream_insights",witnessChain:"witness_chain"};function Ne(e,n,r){if(!V())throw new Error("@ruvector/rvf-node is not available. Install it or use JSONL format.");let t=te(n);if(!j(t))throw new Error(`RVF file not found: ${t}`);let a=r.dryRun?H(t):he(t);try{let i=a.verifyWitness();if(!i.valid&&(i.totalEntries>0||i.errors.length>0)){let d=i.errors.length>0?i.errors.join("; "):"unknown integrity error";throw new Error(`RVF witness verification failed: ${d}`)}let c=a.extractKernel();if(!c||!c.image)throw new Error("No brain data found in RVF file (missing kernel segment)");let l;try{l=JSON.parse(c.image.toString("utf-8"))}catch(d){throw new Error(`Failed to parse brain kernel data as JSON: ${d instanceof Error?d.message:d}`)}let s=0,f=0,m=0,p=0,g={};if(l.tables)Object.assign(g,l.tables);else for(let[d,v]of Object.entries(vn)){let u=l[d];Array.isArray(u)&&(g[v]=u)}let C=()=>{let d=new Map,v=new Map;for(let u of x){let h=g[u.tableName];if(!h||!Array.isArray(h))continue;let R=oe[u.tableName];R&&R.length>0&&(h=h.map(E=>G(E,R)));for(let E of h){let $=X(E,d),B;if(u.dedupColumns&&u.dedupColumns.length>0)B=Z(e,u.tableName,$,u.dedupColumns,u.preserveId);else{let O=L[u.tableName]||"id",y=z[u.tableName],S=K[u.tableName];B=Y(e,u.tableName,$,O,r.mergeStrategy,y,S,d,v,E.pattern_id)}if(B.imported)for(let O of R??[])$[O]instanceof Buffer&&p++;s+=B.imported,f+=B.skipped,m+=B.conflicts}}};if(ee(e,r.dryRun??!1,C),!r.dryRun&&m>0)try{a.compact()}catch{}return{imported:s,skipped:f,conflicts:m,embeddingsRestored:p}}finally{a.close()}}function W(e){if(!V())throw new Error("@ruvector/rvf-node is not available.");let n=te(e);if(!j(n))throw new Error(`RVF file not found: ${n}`);let r=H(n);try{let t=r.extractKernel();if(!t||!t.image)throw new Error("No brain data found in RVF file");let a=t.image.toString("utf-8"),i;try{i=JSON.parse(a)}catch(d){throw new Error(`Failed to parse brain kernel data as JSON: ${d instanceof Error?d.message:d}`)}let c=r.status(),l=dn(n).size,s=i.tables,f=s?s.qe_patterns?.length??0:i.patterns?.length??0,m=s?s.rl_q_values?.length??0:i.qValues?.length??0,p=s?s.dream_insights?.length??0:i.dreamInsights?.length??0,g=s?s.witness_chain?.length??0:i.witnessChain?.length??0,C=s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).filter(d=>Array.isArray(d[1])).map(([d,v])=>[d,v.length])):void 0;return{version:"3.0",format:"rvf",exportedAt:i.exportedAt??"unknown",sourceDb:i.sourceDb??"unknown",stats:{patternCount:f,embeddingCount:c.totalVectors,qValueCount:m,dreamInsightCount:p,witnessChainLength:g,...C?{tableCounts:C}:{}},domains:i.domains??[],checksum:N(a),rvfStatus:{totalVectors:c.totalVectors,totalSegments:c.totalSegments,fileSizeBytes:l}}}finally{r.close()}}function de(){return V()}re();import{existsSync as me,readFileSync as Rn,statSync as Sn}from"fs";import{join as fe,resolve as $e}from"path";function Me(e,n,r={}){let t=$e(e),a=$e(n),i=ke(t),c=ke(a),l=De(t,i),s=De(a,c),f=i==="jsonl"&&c==="jsonl",m=_n({pathA:t,pathB:a,manifestA:l,manifestB:s,recordLevel:f,tableFilter:r.tableFilter,maxIdsPerBucket:r.maxIdsPerBucket??500}),p=new Set(l.domains),g=new Set(s.domains),C=l.domains.filter(R=>!g.has(R)),d=s.domains.filter(R=>!p.has(R)),v=l.checksum===s.checksum,u=l.version===s.version,h=v&&u&&m.every(R=>R.delta===0&&(R.added?.length??0)===0&&(R.removed?.length??0)===0&&(R.changed?.length??0)===0);return{pathA:t,pathB:a,formatA:i,formatB:c,manifestA:l,manifestB:s,checksumMatch:v,versionMatch:u,identical:h,recordLevel:f,tableDiffs:m,domainsOnlyInA:C,domainsOnlyInB:d}}function ke(e){if(!me(e))throw new Error(`Path not found: ${e}`);if(e.endsWith(".rvf"))return"rvf";if(Sn(e).isFile())throw new Error(`Unsupported brain export: ${e} (expected a .rvf file or a JSONL directory)`);return"jsonl"}function De(e,n){return n==="rvf"?Cn(e):xn(e)}function xn(e){let n=fe(e,"manifest.json");if(!me(n))throw new Error(`Manifest not found at ${n}`);let r=A(Rn(n,"utf-8"));return qe(r,"jsonl")}function Cn(e){let n=W(e);return qe(n,"rvf")}function qe(e,n){return{format:n,version:e.version??"unknown",exportedAt:e.exportedAt??"unknown",sourceDb:e.sourceDb??"unknown",checksum:e.checksum??"",totalRecords:e.stats?.totalRecords??0,domains:e.domains??[],tableRecordCounts:e.tableRecordCounts??{}}}function _n(e){let n=e.tableFilter?x.filter(t=>t.tableName===e.tableFilter):x;if(e.tableFilter&&n.length===0)throw new Error(`Unknown table: ${e.tableFilter}`);let r=[];for(let t of n){let a=e.manifestA.tableRecordCounts[t.tableName]??0,i=e.manifestB.tableRecordCounts[t.tableName]??0,c=i-a,l,s,f;if(e.recordLevel&&En(t)){let m=Bn(fe(e.pathA,t.fileName),fe(e.pathB,t.fileName),t,e.maxIdsPerBucket);l=m.added,s=m.removed,f=m.changed}r.push({tableName:t.tableName,countA:a,countB:i,delta:c,...l!==void 0?{added:l}:{},...s!==void 0?{removed:s}:{},...f!==void 0?{changed:f}:{}})}return r}function En(e){return!0}function Bn(e,n,r,t){let a=Te(e,r),i=Te(n,r),c=[],l=[],s=[];for(let[f,m]of a){let p=i.get(f);if(p===void 0)l.length<t&&l.push(f);else if(p!==m){if(r.dedupColumns&&r.dedupColumns.length>0)continue;s.length<t&&s.push(f)}}for(let f of i.keys())a.has(f)||c.length<t&&c.push(f);return c.sort(),l.sort(),s.sort(),{added:c,removed:l,changed:s}}function Te(e,n){let r=new Map;if(!me(e))return r;let t=P(e,A);for(let a of t){let i=In(a,n);if(i===void 0)continue;let c=On(a);r.set(i,An(c))}return r}function In(e,n){if(n.dedupColumns&&n.dedupColumns.length>0){let a=[];for(let i of n.dedupColumns){let c=e[i];if(c==null)return;a.push(String(c))}return a.join("")}let r=L[n.tableName]??"id",t=e[r];if(t!=null)return String(t)}function On(e){let n=Object.keys(e).sort(),r={};for(let t of n)r[t]=e[t];return JSON.stringify(r)}function An(e){return N(e)}re();import{existsSync as ue,statSync as Nn}from"fs";import{join as Fe,resolve as $n}from"path";var kn=20,Dn="qe_patterns";function Le(e,n={}){let r=$n(e);qn(r);let t=n.table??Dn,a=x.find(u=>u.tableName===t);if(!a)throw new Error(`Unknown table: ${t}`);let i=Fe(r,a.fileName);if(!ue(i))throw new Error(`Table file not found: ${a.fileName} (expected in ${r}). Was this export generated with --format jsonl?`);let c=P(i,A),l=a.domainColumn,s=Math.max(1,n.limit??kn),f=n.query?n.query.toLowerCase():void 0,m=n.domains&&n.domains.length>0?new Set(n.domains):void 0,p=n.since,g=n.until,C=n.patternType,d=0,v=[];for(let u of c)Tn(u,{domainColumn:l,domains:m,patternType:C,since:p,until:g,queryLower:f})&&(d++,v.length<s&&v.push(Mn(u,a.tableName,l)));return{table:t,inputPath:r,totalScanned:c.length,totalMatched:d,limit:s,hits:v,truncated:d>s}}function Tn(e,n){if(n.domains){if(!n.domainColumn)return!1;let r=e[n.domainColumn];if(typeof r!="string"||!n.domains.has(r))return!1}if(n.patternType!==void 0&&e.pattern_type!==n.patternType)return!1;if(n.since!==void 0||n.until!==void 0){let r=Pe(e);if(r===void 0||n.since!==void 0&&r<n.since||n.until!==void 0&&r>n.until)return!1}if(n.queryLower!==void 0){let r=typeof e.name=="string"?e.name.toLowerCase():"",t=typeof e.description=="string"?e.description.toLowerCase():"";if(!r.includes(n.queryLower)&&!t.includes(n.queryLower))return!1}return!0}function Pe(e){for(let n of["updated_at","created_at","timestamp"]){let r=e[n];if(typeof r=="string"&&r.length>0)return r}}function Mn(e,n,r){let t=(typeof e.id=="string"||typeof e.id=="number"?String(e.id):void 0)??`${n}:?`,a={name:typeof e.name=="string"?e.name:void 0,description:typeof e.description=="string"?e.description:void 0,domain:r&&typeof e[r]=="string"?e[r]:void 0,patternType:typeof e.pattern_type=="string"?e.pattern_type:void 0,confidence:typeof e.confidence=="number"?e.confidence:void 0,updatedAt:Pe(e)};return{id:t,display:a,row:e}}function qn(e){if(!ue(e))throw new Error(`Path not found: ${e}`);if(Nn(e).isFile())throw e.endsWith(".rvf")?new Error("Brain search does not support RVF exports. Re-export with --format jsonl, or use `aqe brain info` for RVF summaries."):new Error(`Unsupported brain export: ${e} (expected a JSONL directory)`);let r=Fe(e,"manifest.json");if(!ue(r))throw new Error(`Manifest not found at ${r}. Is this a brain export directory?`)}function je(e,n){if(!e.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_patterns'").get())return{created:0,skipped:0};e.exec(`
4
- CREATE TEMP TABLE IF NOT EXISTS _covered_patterns (
5
- pattern_id TEXT PRIMARY KEY
6
- )
7
- `),e.exec("DELETE FROM _covered_patterns"),e.exec(`
8
- INSERT INTO _covered_patterns (pattern_id)
9
- SELECT DISTINCT json_extract(action_data, '$.patternId')
10
- FROM witness_chain
11
- WHERE action_type = 'PATTERN_CREATE'
12
- AND json_extract(action_data, '$.patternId') IS NOT NULL
13
- `),e.exec(`
14
- INSERT OR IGNORE INTO _covered_patterns (pattern_id)
15
- SELECT DISTINCT json_extract(action_data, '$.pattern_id')
16
- FROM witness_chain
17
- WHERE action_type = 'PATTERN_CREATE'
18
- AND json_extract(action_data, '$.pattern_id') IS NOT NULL
19
- `);let t=e.prepare(`SELECT p.id, p.pattern_type, p.qe_domain, p.name, p.created_at
20
- FROM qe_patterns p
21
- LEFT JOIN _covered_patterns c ON p.id = c.pattern_id
22
- WHERE c.pattern_id IS NULL
23
- ORDER BY p.created_at ASC`).all(),i=e.prepare("SELECT COUNT(*) as count FROM qe_patterns").get().count-t.length,c=0;for(let l of t)n.append("PATTERN_CREATE",{patternId:l.id,patternType:l.pattern_type,qeDomain:l.qe_domain,name:l.name,originalCreatedAt:l.created_at,backfilled:!0},"system:backfill"),c++;return e.exec("DROP TABLE IF EXISTS _covered_patterns"),{created:c,skipped:i}}async function Ve(e,n){if(Fn(n.format)==="rvf"){let a=F(e,{readonly:!0});try{return Ae(a,{outputPath:n.outputPath,domains:n.domains,allowOverwriteRicher:n.allowOverwriteRicher},e)}finally{a.close()}}let t=F(e,{readonly:!0});try{return _e(t,n,e)}finally{t.close()}}async function Je(e,n,r){if(ze(n,r.format)==="rvf"){let i=F(e);try{return Ne(i,n,{mergeStrategy:r.mergeStrategy,dryRun:r.dryRun})}finally{i.close()}}let a=F(e);try{return Ee(a,n,r)}finally{a.close()}}async function Ue(e,n){return ze(e,n)==="rvf"?W(e):Be(e)}async function We(e,n,r={}){return Me(e,n,r)}async function He(e,n={}){return Le(e,n)}async function Ke(e){let n=F(e);try{let r=ve(n,we());return await r.initialize(),je(n,r)}finally{n.close()}}function Fn(e){if(e==="jsonl")return"jsonl";if(e==="rvf"){if(!de())throw new Error("RVF format requested but @ruvector/rvf-node is not available on this platform. Use --format jsonl instead.");return"rvf"}return de()?"rvf":"jsonl"}function ze(e,n){return n==="rvf"?"rvf":n==="jsonl"?"jsonl":e.endsWith(".rvf")?"rvf":"jsonl"}var ye=class{name="brain";description="Export, import, and inspect QE brain state";cleanupAndExit;ensureInitialized;constructor(n,r){this.cleanupAndExit=n,this.ensureInitialized=r}register(n,r){let t=n.command("brain").description(this.description);t.command("export").description("Export brain state to a portable directory").requiredOption("-o, --output <path>","Output directory path").option("--format <format>","Export format: rvf (default) or jsonl","rvf").option("--db <path>","Source database path").option("--force-overwrite-richer","Allow replacing an existing RVF with fewer patterns",!1).action(async a=>{await this.executeExport(a)}),t.command("import").description("Import brain state from an export directory").requiredOption("-i, --input <path>","Path to brain export directory").option("--strategy <strategy>","Merge strategy","skip-conflicts").option("--dry-run","Preview import without writing",!1).option("--db <path>","Target database path").action(async a=>{await this.executeImport(a)}),t.command("info").description("Show manifest info for a brain export").requiredOption("-i, --input <path>","Path to brain export directory").action(async a=>{await this.executeInfo(a)}),t.command("witness-backfill").description("Create witness chain entries for patterns that predate the witness chain").option("--db <path>","Database path").action(async a=>{await this.executeWitnessBackfill(a)}),t.command("diff").description("Compare two brain exports (JSONL directory or .rvf file)").argument("<a>","Path to first brain export").argument("<b>","Path to second brain export").option("--table <name>","Restrict comparison to a single table").option("--verbose","Show the IDs of added/removed/changed records",!1).option("--json","Emit the diff as JSON to stdout",!1).action(async(a,i,c)=>{await this.executeDiff(a,i,c)}),t.command("search").description("Search a JSONL brain export with filters").requiredOption("-i, --input <path>","Path to brain export directory (JSONL)").option("--table <name>","Table to search (default: qe_patterns)").option("--domain <name...>","Restrict to one or more domains").option("--pattern-type <type>","Restrict to a specific pattern_type (qe_patterns only)").option("--since <iso>","Include rows with timestamp \u2265 <iso>").option("--until <iso>","Include rows with timestamp \u2264 <iso>").option("-q, --query <text>","Substring match across name + description (case-insensitive)").option("-l, --limit <n>","Maximum results to return","20").option("--json","Emit results as JSON to stdout",!1).action(async a=>{await this.executeSearch(a)})}async executeExport(n){try{console.log(o.blue(`
24
- Exporting brain state (format: ${n.format})...
25
- `));let r=await pe(n.db),t=await Ve(r,{outputPath:D.resolve(n.output),format:n.format,allowOverwriteRicher:n.forceOverwriteRicher});if(console.log(o.green(" Export complete.")),console.log(` Format: ${o.cyan("format"in t?t.format??"jsonl":"jsonl")}`),console.log(` Patterns: ${o.cyan(t.stats.patternCount)}`),"embeddingCount"in t.stats?console.log(` Vectors: ${o.cyan(t.stats.embeddingCount)}`):"vectorCount"in t.stats&&console.log(` Vectors: ${o.cyan(t.stats.vectorCount)}`),"rvfStatus"in t){let a=t.rvfStatus;console.log(` RVF Size: ${o.cyan(Ge(a.fileSizeBytes))}`),console.log(` Segments: ${o.cyan(a.totalSegments)}`)}console.log(` Checksum: ${o.gray(t.checksum)}`),console.log(` Output: ${o.cyan(D.resolve(n.output))}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
26
- Brain export failed:`),r),await this.cleanupAndExit(1)}}async executeImport(n){try{n.dryRun?console.log(o.yellow(`
27
- Dry-run mode \u2014 no data will be written.
28
- `)):console.log(o.blue(`
29
- Importing brain state...
30
- `));let r=await pe(n.db),t=await Je(r,D.resolve(n.input),{mergeStrategy:n.strategy,dryRun:n.dryRun});console.log(o.green(" Import complete.")),console.log(` Imported: ${o.cyan(t.imported)}`),console.log(` Skipped: ${o.yellow(t.skipped)}`),console.log(` Conflicts: ${o.red(t.conflicts)}`),"embeddingsRestored"in t&&console.log(` Embeddings: ${o.cyan(t.embeddingsRestored)}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
31
- Brain import failed:`),r),await this.cleanupAndExit(1)}}async executeInfo(n){try{console.log(o.blue(`
32
- Brain Export Info
33
- `));let r=D.resolve(n.input),t=await Ue(r),a="format"in t?t.format??"jsonl":"jsonl";if(console.log(` Version: ${o.cyan(t.version)}`),console.log(` Format: ${o.cyan(a)}`),console.log(` Exported: ${o.cyan(t.exportedAt)}`),console.log(` Source DB: ${o.cyan(t.sourceDb)}`),console.log(o.blue(`
34
- Learning Data:`)),console.log(` Patterns: ${o.cyan(t.stats.patternCount)}`),"qValueCount"in t.stats&&console.log(` Q-Values: ${o.cyan(t.stats.qValueCount)}`),"dreamInsightCount"in t.stats){let l=t.stats.dreamInsightCount,f=("tableRecordCounts"in t?t.tableRecordCounts:void 0)?.dream_cycles,m=f!==void 0?` (${f} cycles)`:"";console.log(` Dream Insights: ${o.cyan(l)}${o.gray(m)}`)}"witnessChainLength"in t.stats&&console.log(` Witness Chain: ${o.cyan(t.stats.witnessChainLength)} entries`),"embeddingCount"in t.stats?console.log(` Embeddings: ${o.cyan(t.stats.embeddingCount)}`):"vectorCount"in t.stats&&console.log(` Vectors: ${o.cyan(t.stats.vectorCount)}`);let i="tableRecordCounts"in t?t.tableRecordCounts:void 0;if(i){let l=Object.entries(i).filter(([s,f])=>f>0&&!["qe_patterns","rl_q_values","dream_insights","dream_cycles","witness_chain","vectors","qe_pattern_embeddings"].includes(s));if(l.length>0)for(let[s,f]of l){let p=`${s.replace(/_/g," ").replace(/\b\w/g,g=>g.toUpperCase())}:`.padEnd(15);console.log(` ${p}${o.cyan(f)}`)}}let c="totalRecords"in t.stats?t.stats.totalRecords:void 0;if(c!==void 0&&(console.log(o.blue(`
35
- Summary:`)),console.log(` Total Records: ${o.cyan(c)}`)),"domains"in t&&Array.isArray(t.domains)&&t.domains.length>0&&(c||console.log(o.blue(`
36
- Summary:`)),console.log(` Domains: ${o.cyan(t.domains.join(", "))}`)),"rvfStatus"in t){let l=t.rvfStatus;console.log(o.blue(`
37
- RVF Details:`)),console.log(` File Size: ${o.cyan(Ge(l.fileSizeBytes))}`),console.log(` Vectors: ${o.cyan(l.totalVectors)}`),console.log(` Segments: ${o.cyan(l.totalSegments)}`)}if("lineage"in t){let l=t.lineage;l&&(console.log(o.blue(`
38
- Lineage:`)),console.log(` File ID: ${o.cyan(l.fileId)}`),console.log(` Parent ID: ${o.cyan(l.parentId??"none (root)")}`),console.log(` Depth: ${o.cyan(l.lineageDepth)}`))}if("signature"in t){let l=t.signature,s=t.signerKeyId;console.log(o.blue(`
39
- Signature:`)),l?(console.log(` Status: ${o.green("Signed")}`),console.log(` Key ID: ${o.cyan(s??"unknown")}`),console.log(` Signature: ${o.gray(l.slice(0,32)+"...")}`)):console.log(` Status: ${o.yellow("Unsigned")}`)}console.log(`
40
- Checksum: ${o.gray(t.checksum)}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
41
- Failed to read brain info:`),r),await this.cleanupAndExit(1)}}async executeDiff(n,r,t){try{let a=await We(D.resolve(n),D.resolve(r),{tableFilter:t.table});if(t.json){process.stdout.write(JSON.stringify(a,null,2)+`
42
- `),await this.cleanupAndExit(a.identical?0:1);return}jn(a,t.verbose),await this.cleanupAndExit(a.identical?0:1)}catch(a){console.error(o.red(`
43
- Brain diff failed:`),a),await this.cleanupAndExit(2)}}async executeSearch(n){try{let r=Ln(n.limit),t=Pn(n.domain),a=await He(D.resolve(n.input),{table:n.table,domains:t,patternType:n.patternType,since:n.since,until:n.until,query:n.query,limit:r});if(n.json){process.stdout.write(JSON.stringify(a,null,2)+`
44
- `),await this.cleanupAndExit(a.totalMatched>0?0:3);return}Un(a),await this.cleanupAndExit(a.totalMatched>0?0:3)}catch(r){console.error(o.red(`
45
- Brain search failed:`),r),await this.cleanupAndExit(2)}}async executeWitnessBackfill(n){try{console.log(o.blue(`
46
- Running witness chain backfill...
47
- `));let r=await pe(n.db),t=await Ke(r);console.log(o.green(" Backfill complete.")),console.log(` Created: ${o.cyan(t.created)} new witness entries`),console.log(` Skipped: ${o.cyan(t.skipped)} (already witnessed)`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
48
- Witness backfill failed:`),r),await this.cleanupAndExit(1)}}getHelp(){return`
49
- Export, import, and inspect QE brain state.
50
-
51
- Formats:
52
- rvf \u2014 Single portable .rvf file (default, requires @ruvector/rvf-node)
53
- jsonl \u2014 JSONL directory format (fallback when native not available)
54
-
55
- Usage:
56
- aqe brain export -o brain.rvf [--format rvf] [--db <path>]
57
- aqe brain export -o ./brain-dir --format jsonl [--db <path>]
58
- aqe brain import -i brain.rvf [--strategy skip-conflicts] [--dry-run] [--db <path>]
59
- aqe brain info -i brain.rvf
60
-
61
- Subcommands:
62
- export Export brain state to a portable .rvf file or JSONL directory
63
- import Import a brain export into the local database
64
- info Show manifest metadata for an existing brain export
65
- diff Compare two brain exports (manifest always; record-level for JSONL)
66
- search Filtered search over a JSONL brain export
67
-
68
- Examples:
69
- aqe brain export -o .agentic-qe/brain.rvf
70
- aqe brain export -o .agentic-qe/brain.rvf --format rvf
71
- aqe brain export -o ./brain-export --format jsonl
72
- aqe brain import -i .agentic-qe/brain.rvf --strategy latest-wins
73
- aqe brain import -i .agentic-qe/brain.rvf --dry-run
74
- aqe brain info -i .agentic-qe/brain.rvf
75
- aqe brain diff ./brain-a ./brain-b --verbose
76
- aqe brain search -i ./brain-export --query oauth --domain test-generation
77
- aqe brain search -i ./brain-export --since 2026-03-01 --limit 50 --json
78
- `}};async function pe(e){if(e)return e;let{findProjectRoot:n}=await import("./unified-memory-CXHLHB5I.js");return D.join(n(),".agentic-qe","memory.db")}function Ge(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ln(e){let n=Number.parseInt(e,10);return!Number.isFinite(n)||n<1?20:n}function Pn(e){if(e===void 0)return;let n=Array.isArray(e)?e:[e],r=[];for(let t of n)for(let a of t.split(",")){let i=a.trim();i&&r.push(i)}return r.length>0?r:void 0}function jn(e,n){console.log(o.blue(`
79
- Brain Diff
80
- `)),console.log(` A: ${o.cyan(e.pathA)} (${e.formatA})`),console.log(` B: ${o.cyan(e.pathB)} (${e.formatB})`),console.log(` Versions: ${o.cyan(e.manifestA.version)} \u2192 ${o.cyan(e.manifestB.version)}`+(e.versionMatch?o.gray(" (match)"):o.yellow(" (differ)"))),console.log(` Checksums: ${o.gray(e.manifestA.checksum.slice(0,12))}\u2026 \u2192 ${o.gray(e.manifestB.checksum.slice(0,12))}\u2026`+(e.checksumMatch?o.gray(" (match)"):o.yellow(" (differ)"))),console.log(` Exported: ${o.gray(e.manifestA.exportedAt)} \u2192 ${o.gray(e.manifestB.exportedAt)}`),console.log(` Records: ${o.cyan(e.manifestA.totalRecords)} \u2192 ${o.cyan(e.manifestB.totalRecords)} `+Qe(e.manifestB.totalRecords-e.manifestA.totalRecords)),(e.domainsOnlyInA.length>0||e.domainsOnlyInB.length>0)&&(console.log(o.blue(`
81
- Domains:`)),e.domainsOnlyInA.length>0&&console.log(` Only in A: ${o.yellow(e.domainsOnlyInA.join(", "))}`),e.domainsOnlyInB.length>0&&console.log(` Only in B: ${o.yellow(e.domainsOnlyInB.join(", "))}`)),e.recordLevel||console.log(o.gray(`
82
- Note: record-level diff is only available when both sides are JSONL exports.
83
- Per-table counts shown below; re-export with --format jsonl for added/removed/changed IDs.`)),console.log(o.blue(`
84
- Tables:`));let r=e.tableDiffs.filter(Vn);if(r.length===0)console.log(o.gray(" (no differences)"));else for(let t of r)console.log(` ${t.tableName.padEnd(28)} ${o.cyan(String(t.countA).padStart(7))} \u2192 ${o.cyan(String(t.countB).padStart(7))} ${Qe(t.delta)}`+Jn(t,n)),n&&(t.added&&t.added.length>0&&ge("added",t.added),t.removed&&t.removed.length>0&&ge("removed",t.removed),t.changed&&t.changed.length>0&&ge("changed",t.changed));console.log(""),e.identical?console.log(o.green(` Result: identical
85
- `)):console.log(o.yellow(` Result: differences found
86
- `))}function Vn(e){return!!(e.delta!==0||e.added&&e.added.length>0||e.removed&&e.removed.length>0||e.changed&&e.changed.length>0)}function Qe(e){return e===0?o.gray("(\xB10)"):e>0?o.green(`(+${e})`):o.red(`(${e})`)}function Jn(e,n){let r=[];return e.added&&e.added.length>0&&r.push(o.green(`+${e.added.length}`)),e.removed&&e.removed.length>0&&r.push(o.red(`-${e.removed.length}`)),e.changed&&e.changed.length>0&&r.push(o.yellow(`~${e.changed.length}`)),r.length===0?"":n?" "+r.join(" "):" "+o.gray("[")+r.join(" ")+o.gray("]")}function ge(e,n){let r=n.slice(0,10).join(", "),t=n.length>10?o.gray(` \u2026(+${n.length-10} more)`):"";console.log(` ${o.gray(e+":")} ${r}${t}`)}function Un(e){if(console.log(o.blue(`
87
- Brain Search
88
- `)),console.log(` Input: ${o.cyan(e.inputPath)}`),console.log(` Table: ${o.cyan(e.table)}`),console.log(` Scanned: ${o.cyan(e.totalScanned)} Matched: ${o.cyan(e.totalMatched)} Shown: ${o.cyan(e.hits.length)}`+(e.truncated?o.yellow(` (truncated to limit ${e.limit})`):"")),e.hits.length===0){console.log(o.yellow(`
89
- No matching rows.
90
- `));return}console.log("");for(let n of e.hits){let r=o.cyan(n.id)+(n.display.patternType?o.gray(` ${n.display.patternType}`):"")+(n.display.domain?o.gray(` [${n.display.domain}]`):"")+(n.display.confidence!==void 0?o.gray(` conf=${n.display.confidence.toFixed(2)}`):"");if(console.log(` ${r}`),n.display.name&&console.log(` ${o.bold(n.display.name)}`),n.display.description){let t=n.display.description.length>200?n.display.description.slice(0,200)+"\u2026":n.display.description;console.log(` ${o.gray(t)}`)}n.display.updatedAt&&console.log(` ${o.gray(n.display.updatedAt)}`),console.log("")}}function _t(e,n){return new ye(e,n)}export{ye as BrainHandler,_t as createBrainHandler};
@@ -1,2 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.4");process.exit(0)}
2
- import{a}from"./chunk-HV2J7KKQ.js";import"./chunk-W7BWUTVV.js";import"./chunk-6TPKK7LD.js";import"./chunk-55RWDRJD.js";import"./chunk-R4VL6E65.js";import"./chunk-RJCYCLZV.js";import"./chunk-NA7B2QYB.js";import"./chunk-Y3MW3YBC.js";import"./chunk-PEPFCPES.js";import"./chunk-DHJPWQBR.js";import"./chunk-G6T45OIC.js";import"./chunk-SRKETSFF.js";import"./chunk-AIHDEEJO.js";import"./chunk-BGE6FOLM.js";import"./chunk-5YPYDPBJ.js";import"./chunk-HDSAM2RE.js";import"./chunk-KCZR45PA.js";import"./chunk-BFP7KO7P.js";import"./chunk-ODKLFVYC.js";import"./chunk-VD6QRULW.js";import"./chunk-KHFNNVJA.js";import"./chunk-CNG6GQEZ.js";import"./chunk-TT23RRB7.js";export{a as BrowserWorkflowTool};
@@ -1,4 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.4");process.exit(0)}
2
- import*as o from"fs";import*as l from"path";var m=class{cacheDir;keepVersions;constructor(e={}){this.cacheDir=e.cacheDir??l.join(process.cwd(),".agentic-qe","plugins"),this.keepVersions=e.keepVersions??2}has(e,t){let s=this.versionDir(e,t);return o.existsSync(s)&&o.existsSync(l.join(s,"qe-plugin.json"))}get(e,t){if(!this.has(e,t))return;let s=this.versionDir(e,t),i=o.readFileSync(l.join(s,"qe-plugin.json"),"utf-8"),r=JSON.parse(i),c=o.statSync(s);return{manifest:r,path:s,cachedAt:c.birthtime.toISOString()}}store(e,t){let s=this.versionDir(e.name,e.version);return o.existsSync(s)||(o.mkdirSync(s,{recursive:!0}),this.copyDir(t,s),o.writeFileSync(l.join(s,"qe-plugin.json"),JSON.stringify(e,null,2)),this.pruneOldVersions(e.name)),s}remove(e,t){let s=this.versionDir(e,t);return o.existsSync(s)?(o.rmSync(s,{recursive:!0,force:!0}),!0):!1}listVersions(e){let t=l.join(this.cacheDir,e);if(!o.existsSync(t))return[];let s=[],i=o.readdirSync(t);for(let r of i){let c=l.join(t,r),h=l.join(c,"qe-plugin.json");if(o.existsSync(h))try{let a=o.readFileSync(h,"utf-8"),f=JSON.parse(a),u=o.statSync(c);s.push({manifest:f,path:c,cachedAt:u.birthtime.toISOString()})}catch{}}return s}listAll(){if(!o.existsSync(this.cacheDir))return[];let e=[],t=o.readdirSync(this.cacheDir);for(let s of t){let i=this.listVersions(s);i.length>0&&(i.sort((r,c)=>c.manifest.version.localeCompare(r.manifest.version)),e.push(i[0]))}return e}versionDir(e,t){return l.join(this.cacheDir,e,t)}pruneOldVersions(e){let t=this.listVersions(e);if(t.length<=this.keepVersions)return;t.sort((i,r)=>i.cachedAt.localeCompare(r.cachedAt));let s=t.slice(0,t.length-this.keepVersions);for(let i of s)o.rmSync(i.path,{recursive:!0,force:!0})}copyDir(e,t){if(!o.existsSync(e))return;let s=o.readdirSync(e,{withFileTypes:!0});for(let i of s){let r=l.join(e,i.name),c=l.join(t,i.name);if(i.isDirectory()){if(i.name===".git"||i.name==="node_modules")continue;o.mkdirSync(c,{recursive:!0}),this.copyDir(r,c)}else o.copyFileSync(r,c)}}};var R=/^[a-z][a-z0-9-]*$/,S=/^\d+\.\d+\.\d+(-[a-zA-Z0-9.]+)?$/,j=["aqe-core-","agentic-qe-core-"];function E(n){let e=[],t=[];if(!n||typeof n!="object")return{valid:!1,errors:["Manifest must be a non-null object"],warnings:[]};let s=n;if(!s.name||typeof s.name!="string"?e.push("name is required and must be a string"):D(s.name,e,t),!s.version||typeof s.version!="string"?e.push("version is required and must be a string"):S.test(s.version)||e.push(`version "${s.version}" is not valid semver (expected: major.minor.patch)`),!s.description||typeof s.description!="string"?e.push("description is required and must be a string"):s.description.length>500&&t.push("description exceeds 500 characters"),(!s.author||typeof s.author!="string")&&e.push("author is required and must be a string"),!Array.isArray(s.domains)||s.domains.length===0)e.push("domains is required and must be a non-empty array");else for(let i of s.domains)if(typeof i!="string"){e.push("Each domain must be a string");break}if(!s.entryPoint||typeof s.entryPoint!="string"?e.push("entryPoint is required and must be a string"):V(s.entryPoint,e),s.dependencies!==void 0)if(typeof s.dependencies!="object"||s.dependencies===null||Array.isArray(s.dependencies))e.push("dependencies must be an object mapping plugin names to semver ranges");else for(let[i,r]of Object.entries(s.dependencies))typeof r!="string"&&e.push(`Dependency "${i}" must have a string version range`);if(s.hooks!==void 0)if(typeof s.hooks!="object"||s.hooks===null||Array.isArray(s.hooks))e.push("hooks must be an object mapping event names to handler paths");else for(let[,i]of Object.entries(s.hooks)){if(typeof i!="string"){e.push("Hook handler paths must be strings");break}i.includes("..")&&e.push(`Hook handler path "${i}" must not contain ".." (path traversal)`)}if(s.minAqeVersion!==void 0&&(typeof s.minAqeVersion!="string"||!S.test(s.minAqeVersion))&&t.push("minAqeVersion should be valid semver"),s.permissions!==void 0){if(!Array.isArray(s.permissions))e.push("permissions must be an array of strings");else for(let i of s.permissions)if(typeof i!="string"){e.push("Each permission must be a string");break}}return{valid:e.length===0,errors:e,warnings:t}}function b(n){let e=typeof n=="string"?JSON.parse(n):n,t=E(e);if(!t.valid)throw new Error(`Invalid plugin manifest:
3
- - ${t.errors.join(`
4
- - `)}`);return e}function D(n,e,t){n.length>64&&e.push("name must be 64 characters or fewer"),R.test(n)||e.push("name must be lowercase alphanumeric with hyphens, starting with a letter"),/[^\x00-\x7F]/.test(n)&&e.push("name must contain only ASCII characters");for(let s of j)n.startsWith(s)&&e.push(`name cannot start with reserved prefix "${s}"`);["plugin","test","tool"].includes(n)&&t.push(`name "${n}" is very generic \u2014 consider a more descriptive name`)}function V(n,e){n.includes("..")&&e.push('entryPoint must not contain ".." (path traversal)'),(n.startsWith("/")||n.startsWith("\\"))&&e.push("entryPoint must be a relative path"),!n.endsWith(".js")&&!n.endsWith(".ts")&&!n.endsWith(".mjs")&&e.push("entryPoint must end in .js, .ts, or .mjs")}var y=class{resolve(e){let t=new Map;for(let a of e)t.set(a.name,a);let s=[],i=new Set,r=new Set,c=new Map,h=(a,f)=>{if(i.has(a))return;if(r.has(a)){let g=[...f.slice(f.indexOf(a)),a];throw new Error(`Dependency cycle detected: ${g.join(" -> ")}`)}let u=t.get(a);if(!u)return;r.add(a);let k=Object.keys(u.dependencies??{}),P=[];for(let g of k)t.has(g)?h(g,[...f,a]):P.push(g);P.length>0&&c.set(a,P),r.delete(a),i.add(a),s.push(u)};for(let a of e)h(a.name,[]);return{ordered:s.map((a,f)=>({manifest:a,order:f})),missing:c}}canLoad(e,t){let i=Object.keys(e.dependencies??{}).filter(r=>!t.has(r));return{canLoad:i.length===0,missingDeps:i}}};var N=["aqe-core-","agentic-qe-core-","agentic-qe-internal-"],M=new Set(["aqe","agentic-qe","ruflo","claude-flow"]),_=["..","~","/etc/","/proc/","/dev/","node_modules/"];function A(n){let e=[];return $(n.name,e),q(n.entryPoint,e),C(n.hooks,e),I(n.permissions,e),{safe:e.length===0,violations:e}}function $(n,e){/[^\x20-\x7E]/.test(n)&&e.push(`Plugin name "${n}" contains non-ASCII characters`),M.has(n.toLowerCase())&&e.push(`Plugin name "${n}" is a reserved name`);for(let s of N)n.toLowerCase().startsWith(s)&&e.push(`Plugin name "${n}" uses reserved prefix "${s}"`);let t=n.toLowerCase().replace(/[0o]/g,"o").replace(/[1il]/g,"l").replace(/[-_]/g,"");M.has(t)&&e.push(`Plugin name "${n}" is visually similar to a reserved name`)}function q(n,e){w(n,"entryPoint",e),(n.startsWith("/")||n.startsWith("\\"))&&e.push("entryPoint must be a relative path, not absolute")}function C(n,e){if(n)for(let[t,s]of Object.entries(n))w(s,`hook[${t}]`,e)}function w(n,e,t){for(let s of _)n.includes(s)&&t.push(`${e} contains dangerous path pattern "${s}"`);n.includes("\0")&&t.push(`${e} contains null byte (path injection attempt)`)}function I(n,e){if(!n)return;let t=["fs:write-root","net:arbitrary","exec:shell"];for(let s of n)t.includes(s)&&e.push(`Plugin requests dangerous permission: ${s}`)}import*as p from"fs";import*as d from"path";var v=class{type="local";async resolve(e){let t=d.resolve(e),s=d.join(t,"qe-plugin.json");if(!p.existsSync(s))throw new Error(`No qe-plugin.json found at ${s}`);let i=p.readFileSync(s,"utf-8");return b(i)}async getPluginPath(e){let t=d.resolve(e);if(!p.existsSync(t))throw new Error(`Plugin directory does not exist: ${t}`);return t}};var x=class{cache;resolver;sources=new Map;constructor(e={}){this.cache=e.cache??new m,this.resolver=new y;let t=new v;if(this.sources.set("local",t),e.sources)for(let s of e.sources)this.sources.set(s.type,s)}async install(e,t="local"){if(process.env.AQE_PLUGINS_DISABLED==="true")return{success:!1,errors:["Plugin loading is disabled (AQE_PLUGINS_DISABLED=true)"],securityViolations:[]};let s=[],i=this.sources.get(t);if(!i)return{success:!1,errors:[`Unknown source type: ${t}. Available: ${[...this.sources.keys()].join(", ")}`],securityViolations:[]};let r;try{r=await i.resolve(e)}catch(u){return{success:!1,errors:[`Failed to resolve plugin: ${u instanceof Error?u.message:String(u)}`],securityViolations:[]}}let c=E(r);if(!c.valid)return{success:!1,manifest:r,errors:c.errors,securityViolations:[]};let h=A(r);if(!h.safe)return{success:!1,manifest:r,errors:["Plugin failed security checks"],securityViolations:h.violations};if(this.cache.has(r.name,r.version)){let u=this.cache.get(r.name,r.version);return{success:!0,manifest:r,cachePath:u.path,errors:[],securityViolations:[]}}let a;try{a=await i.getPluginPath(e)}catch(u){return{success:!1,manifest:r,errors:[`Failed to get plugin path: ${u instanceof Error?u.message:String(u)}`],securityViolations:[]}}let f=this.cache.store(r,a);return{success:!0,manifest:r,cachePath:f,errors:s,securityViolations:[]}}remove(e,t){if(t)return this.cache.remove(e,t);let s=this.cache.listVersions(e),i=!1;for(let r of s)this.cache.remove(e,r.manifest.version)&&(i=!0);return i}list(){return this.cache.listAll().map(t=>({name:t.manifest.name,version:t.manifest.version,description:t.manifest.description,domains:t.manifest.domains,source:"cached",cachePath:t.path}))}resolveLoadOrder(){let e=this.cache.listAll();return this.resolver.resolve(e.map(t=>t.manifest))}registerSource(e){this.sources.set(e.type,e)}};export{b as a,m as b,x as c};