agentic-qe 3.14.5 → 3.14.7

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 (494) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +150 -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 +16 -106
  13. package/dist/audit/witness-findings.js +4 -1
  14. package/dist/cli/bundle.js +8 -8
  15. package/dist/cli/chunks/adapter-TVQKH65T.js +2 -0
  16. package/dist/cli/chunks/agent-booster-wasm-AK2W76RG.js +2 -0
  17. package/dist/cli/chunks/{agent-handler-V6CZ7Q6S.js → agent-handler-MGZCWHIY.js} +2 -2
  18. package/dist/cli/chunks/{agent-memory-branch-ZMD6ULC3.js → agent-memory-branch-JZ54MCSP.js} +2 -2
  19. package/dist/cli/chunks/aqe-learning-engine-ULGTVVWE.js +2 -0
  20. package/dist/cli/chunks/{arena-QLSBESC7.js → arena-CUVH3V7H.js} +2 -2
  21. package/dist/cli/chunks/{arena-4UPAEHFT.js → arena-YSWTKBCL.js} +4 -4
  22. package/dist/cli/chunks/audit-LVU76QGA.js +4 -0
  23. package/dist/cli/chunks/base-W42BURDL.js +2 -0
  24. package/dist/cli/chunks/{better-sqlite3-4DSBPDRH.js → better-sqlite3-DB3LOJQU.js} +2 -2
  25. package/dist/cli/chunks/{brain-handler-GBY4EZ4P.js → brain-handler-SD63KOQ6.js} +3 -3
  26. package/dist/cli/chunks/{branch-enumerator-XYBVXCNO.js → branch-enumerator-4MNOPUC7.js} +2 -2
  27. package/dist/cli/chunks/{browser-32F6MREU.js → browser-OLPNTWQE.js} +2 -2
  28. package/dist/cli/chunks/browser-workflow-HKGHFFFT.js +2 -0
  29. package/dist/cli/chunks/{chunk-WLXK2KNU.js → chunk-23CX7JNL.js} +2 -2
  30. package/dist/cli/chunks/{chunk-O3JTQ7N4.js → chunk-25P6JA6V.js} +1 -1
  31. package/dist/cli/chunks/{chunk-DO6EI5KB.js → chunk-2G63VIJE.js} +1 -1
  32. package/dist/cli/chunks/{chunk-G3L5L6YQ.js → chunk-2IMSJ7IO.js} +1 -1
  33. package/dist/cli/chunks/{chunk-RD6TEZ64.js → chunk-36VKMAMN.js} +2 -2
  34. package/dist/cli/chunks/{chunk-KIP6WZGV.js → chunk-3M7J4U74.js} +3 -3
  35. package/dist/cli/chunks/chunk-3QJU4Q4R.js +5 -0
  36. package/dist/cli/chunks/{chunk-2JGEZHWY.js → chunk-4EKV7PHB.js} +2 -2
  37. package/dist/cli/chunks/chunk-4INST4ZL.js +4 -0
  38. package/dist/cli/chunks/{chunk-DPBRWP4J.js → chunk-53BXTTRO.js} +3 -3
  39. package/dist/cli/chunks/chunk-5D7ZFWDS.js +2 -0
  40. package/dist/cli/chunks/{chunk-XLAUGSW7.js → chunk-5FSLMYAC.js} +2 -2
  41. package/dist/cli/chunks/chunk-5GFKTJ65.js +4 -0
  42. package/dist/cli/chunks/{chunk-WOIGKU2N.js → chunk-5U6N4V5M.js} +11 -11
  43. package/dist/cli/chunks/{chunk-PSPKSUF6.js → chunk-6EGS77BB.js} +1 -1
  44. package/dist/cli/chunks/{chunk-QIRL6B3C.js → chunk-6PJPQGF4.js} +2 -2
  45. package/dist/cli/chunks/{chunk-I6X3EGJI.js → chunk-6RD44SCE.js} +1 -1
  46. package/dist/cli/chunks/{chunk-IGBEJ4UJ.js → chunk-74IOEOMH.js} +2 -2
  47. package/dist/cli/chunks/{chunk-E3W6XQ57.js → chunk-77QZHIVX.js} +2 -2
  48. package/dist/cli/chunks/{chunk-R74ZKREV.js → chunk-7EZ2Z2CK.js} +1 -1
  49. package/dist/cli/chunks/{chunk-UTBYJ4RF.js → chunk-7MIOK72I.js} +18 -35
  50. package/dist/cli/chunks/{chunk-URVHZPWY.js → chunk-7QYOTUOX.js} +2 -2
  51. package/dist/cli/chunks/{chunk-K27SU3RE.js → chunk-A2VUCUTT.js} +2 -2
  52. package/dist/cli/chunks/{chunk-2KJQ2UQE.js → chunk-A3DK3XNZ.js} +1 -1
  53. package/dist/cli/chunks/{chunk-5D36YHS3.js → chunk-A5MA7A23.js} +4 -4
  54. package/dist/cli/chunks/{chunk-WJHWH5D2.js → chunk-AEUEMVJK.js} +2 -2
  55. package/dist/cli/chunks/{chunk-6CR4VQBQ.js → chunk-AJUBT4NP.js} +2 -2
  56. package/dist/cli/chunks/chunk-B2YGVSOP.js +27 -0
  57. package/dist/cli/chunks/{chunk-D6OUCB2H.js → chunk-B4I43GE2.js} +2 -2
  58. package/dist/cli/chunks/{chunk-WK7B4B6Y.js → chunk-BD7FEUN3.js} +2 -2
  59. package/dist/cli/chunks/{chunk-OEIQTWQP.js → chunk-BE4KALTE.js} +1 -1
  60. package/dist/cli/chunks/{chunk-JROVR6YS.js → chunk-BEFTQVEW.js} +2 -2
  61. package/dist/cli/chunks/{chunk-HBCGYMQU.js → chunk-BLG7SH4A.js} +1 -1
  62. package/dist/cli/chunks/{chunk-2OMLTYQK.js → chunk-C3FXFU2T.js} +1 -1
  63. package/dist/cli/chunks/{chunk-6A44AOGN.js → chunk-CBONQM5D.js} +2 -2
  64. package/dist/cli/chunks/{chunk-73EI4C2E.js → chunk-CQNMGK6Y.js} +2 -2
  65. package/dist/cli/chunks/{chunk-IIAR5S7Q.js → chunk-CVOQ6ESD.js} +2 -2
  66. package/dist/cli/chunks/{chunk-6TU7FEMD.js → chunk-DOBKEXMJ.js} +1 -1
  67. package/dist/cli/chunks/{chunk-BHFR2EXL.js → chunk-DYTQHRUS.js} +1 -1
  68. package/dist/cli/chunks/{chunk-E4AZXCT5.js → chunk-EADSQN5T.js} +1 -1
  69. package/dist/cli/chunks/{chunk-CYE2TJFV.js → chunk-EGOIIUBD.js} +2 -2
  70. package/dist/cli/chunks/{chunk-DKUBQQFG.js → chunk-EIGRV3J6.js} +2 -2
  71. package/dist/cli/chunks/{chunk-RP2ZKPYV.js → chunk-EJ6MMYLK.js} +1 -1
  72. package/dist/cli/chunks/{chunk-HSVKZ5KI.js → chunk-ENK44A6Q.js} +2 -2
  73. package/dist/cli/chunks/{chunk-67YV75XP.js → chunk-EYXE2XKP.js} +2 -2
  74. package/dist/cli/chunks/{chunk-HYEJJJY3.js → chunk-F2OPFVQH.js} +1 -1
  75. package/dist/cli/chunks/{chunk-XUR2M2WB.js → chunk-FBZC4IGB.js} +2 -2
  76. package/dist/cli/chunks/{chunk-BXVAVFGU.js → chunk-FSSR6WBE.js} +2 -2
  77. package/dist/cli/chunks/{chunk-W2XCZU62.js → chunk-FW4DJ4FJ.js} +1 -1
  78. package/dist/cli/chunks/{chunk-KKHYJF5U.js → chunk-FYPX5WBJ.js} +1 -1
  79. package/dist/cli/chunks/{chunk-K7NJHFLZ.js → chunk-G367W7XR.js} +3 -3
  80. package/dist/cli/chunks/{chunk-IUDWEOLX.js → chunk-GLGKQX2V.js} +2 -2
  81. package/dist/cli/chunks/{chunk-JVQBWYHW.js → chunk-GV4DYPJP.js} +2 -2
  82. package/dist/cli/chunks/{chunk-GTKCGPJZ.js → chunk-GVVFTFMB.js} +2 -2
  83. package/dist/cli/chunks/{chunk-AFEDJ3RU.js → chunk-H5RQPO3X.js} +2 -2
  84. package/dist/cli/chunks/{chunk-4FWTLJEP.js → chunk-HPWWYT67.js} +2 -2
  85. package/dist/cli/chunks/{chunk-G3W6BMVJ.js → chunk-HXXHMLJ5.js} +1 -1
  86. package/dist/cli/chunks/{chunk-NU7UTXMP.js → chunk-HYFQUWNB.js} +2 -2
  87. package/dist/cli/chunks/chunk-HYOPJHHW.js +2 -0
  88. package/dist/cli/chunks/{chunk-6LKDHEBY.js → chunk-HZY42OVU.js} +2 -2
  89. package/dist/cli/chunks/{chunk-C3HQL6S4.js → chunk-IAENZ2DR.js} +2 -2
  90. package/dist/cli/chunks/{chunk-M23ZOZVY.js → chunk-IEJ7ZV3M.js} +1 -1
  91. package/dist/cli/chunks/{chunk-RIZVC4XY.js → chunk-IWFFO6VT.js} +2 -2
  92. package/dist/cli/chunks/chunk-J7AQZLIH.js +21 -0
  93. package/dist/cli/chunks/{chunk-3KDL6QDK.js → chunk-JHJUSSAU.js} +2 -2
  94. package/dist/cli/chunks/{chunk-DLF5BOJD.js → chunk-JOZ47MV6.js} +1 -1
  95. package/dist/cli/chunks/{chunk-ELBZON4V.js → chunk-JZT7BU44.js} +2 -2
  96. package/dist/cli/chunks/{chunk-3DDXWYMO.js → chunk-KD2BLA5Y.js} +1 -1
  97. package/dist/cli/chunks/{chunk-VD5IO5EO.js → chunk-KUHLTVWC.js} +1 -1
  98. package/dist/cli/chunks/{chunk-YDFL445W.js → chunk-LU2EDWQK.js} +2 -2
  99. package/dist/cli/chunks/chunk-LXZMP3VX.js +736 -0
  100. package/dist/cli/chunks/{chunk-3YUB5HER.js → chunk-LY7MFGBD.js} +196 -187
  101. package/dist/cli/chunks/chunk-MM56VPNE.js +180 -0
  102. package/dist/cli/chunks/{chunk-37TUN44F.js → chunk-MNQN7UZX.js} +2 -2
  103. package/dist/cli/chunks/{chunk-7DETTOPZ.js → chunk-MQZ53OR3.js} +2 -2
  104. package/dist/cli/chunks/{chunk-BYG36QC5.js → chunk-MT7UNBZ7.js} +2 -2
  105. package/dist/cli/chunks/{chunk-JES6R5KP.js → chunk-MZB2UV2O.js} +1 -1
  106. package/dist/cli/chunks/{chunk-QZMUXJHZ.js → chunk-MZMG6CUJ.js} +2 -2
  107. package/dist/cli/chunks/chunk-N5XOXPHZ.js +4 -0
  108. package/dist/cli/chunks/{chunk-RD2VGOUH.js → chunk-NBLDBVAW.js} +1 -1
  109. package/dist/cli/chunks/{chunk-HVU64GP5.js → chunk-ND4QTZOL.js} +2 -2
  110. package/dist/cli/chunks/{chunk-SQF6HRXR.js → chunk-NHUGHAY6.js} +1 -1
  111. package/dist/cli/chunks/{chunk-TUSSPKRM.js → chunk-NOHWJOBS.js} +1 -1
  112. package/dist/cli/chunks/{chunk-NVYBM3R4.js → chunk-O5V7RHVG.js} +2 -2
  113. package/dist/cli/chunks/{chunk-6VAZAHQG.js → chunk-O6MO5KMR.js} +2 -2
  114. package/dist/cli/chunks/{chunk-IUHB5GVS.js → chunk-OAZX6WFU.js} +2 -2
  115. package/dist/cli/chunks/{chunk-LSUILON7.js → chunk-OEPNNLR4.js} +1 -1
  116. package/dist/cli/chunks/{chunk-IJHCIXJC.js → chunk-OIDWDGLG.js} +2 -2
  117. package/dist/cli/chunks/{chunk-CPC7FN52.js → chunk-ON2UTP2U.js} +2 -2
  118. package/dist/cli/chunks/{chunk-UJWAWIRV.js → chunk-ONR2NXXD.js} +7 -7
  119. package/dist/cli/chunks/{chunk-7VFY7TUR.js → chunk-OXHF3L2T.js} +2 -2
  120. package/dist/cli/chunks/{chunk-QYOGD2VW.js → chunk-OZGIOKEA.js} +1 -1
  121. package/dist/cli/chunks/{chunk-WJTSY5MC.js → chunk-P2UPYSDJ.js} +1 -1
  122. package/dist/cli/chunks/{chunk-52L77RMG.js → chunk-P7XSPP5D.js} +2 -2
  123. package/dist/cli/chunks/{chunk-M5AEL7IS.js → chunk-PCJQCEBA.js} +2 -2
  124. package/dist/cli/chunks/chunk-PELENDDQ.js +2 -0
  125. package/dist/cli/chunks/{chunk-C3Z4VVHP.js → chunk-PYKY22GC.js} +5 -5
  126. package/dist/cli/chunks/{chunk-AF4XKLXO.js → chunk-Q3NSU24F.js} +2 -2
  127. package/dist/cli/chunks/chunk-Q6NTEICT.js +2 -0
  128. package/dist/cli/chunks/chunk-QFETNCNN.js +12 -0
  129. package/dist/cli/chunks/{chunk-KYA5LARK.js → chunk-QGOWNVVG.js} +1 -1
  130. package/dist/cli/chunks/{chunk-Y5L3ES4L.js → chunk-QPLSYEWJ.js} +2 -2
  131. package/dist/cli/chunks/{chunk-F34OAHOM.js → chunk-QQFQDEUE.js} +2 -2
  132. package/dist/cli/chunks/{chunk-EFV4ADMO.js → chunk-QUORH2MG.js} +55 -79
  133. package/dist/cli/chunks/{chunk-QWUXCG2L.js → chunk-QVH5Y7AP.js} +1 -1
  134. package/dist/cli/chunks/{chunk-I2NENQ44.js → chunk-RC2A4JZ5.js} +2 -2
  135. package/dist/cli/chunks/{chunk-XZSMZHM2.js → chunk-RDGPXENG.js} +2 -2
  136. package/dist/cli/chunks/{chunk-N7H767TP.js → chunk-RKI3IQKQ.js} +2 -2
  137. package/dist/cli/chunks/{chunk-LULD4JV2.js → chunk-RKUAWQOF.js} +2 -2
  138. package/dist/cli/chunks/chunk-RLW25X66.js +2 -0
  139. package/dist/cli/chunks/{chunk-UKGXWW64.js → chunk-ROVZSZCS.js} +3 -3
  140. package/dist/cli/chunks/{chunk-EOR2UT72.js → chunk-RT6O2HW2.js} +2 -2
  141. package/dist/cli/chunks/{chunk-75QJ5HWE.js → chunk-SM2YJ2AL.js} +2 -2
  142. package/dist/cli/chunks/{chunk-KO4FNAUR.js → chunk-SRPLERER.js} +3 -3
  143. package/dist/cli/chunks/{chunk-NRE4NAVA.js → chunk-T77GZF4B.js} +1 -1
  144. package/dist/cli/chunks/{chunk-R6IU3EWP.js → chunk-TFK2AYIN.js} +2 -2
  145. package/dist/cli/chunks/chunk-TW3SR4TS.js +2 -0
  146. package/dist/cli/chunks/{chunk-IYTLXUBO.js → chunk-TXSPBLBT.js} +2 -2
  147. package/dist/cli/chunks/chunk-UA7TDVL7.js +12 -0
  148. package/dist/cli/chunks/{chunk-WX6RRIGW.js → chunk-UBJG3IHT.js} +2 -2
  149. package/dist/cli/chunks/{chunk-NQI7FWCS.js → chunk-UFSVUBTR.js} +2 -2
  150. package/dist/cli/chunks/{chunk-FUNGTIF2.js → chunk-UOI6ULCH.js} +2 -2
  151. package/dist/cli/chunks/{chunk-HVXJC3OC.js → chunk-UYUJT6QO.js} +2 -2
  152. package/dist/cli/chunks/{chunk-KEY43ANX.js → chunk-V5AK56DA.js} +2 -2
  153. package/dist/cli/chunks/{chunk-XFPPERA2.js → chunk-V6RE4YRQ.js} +2 -2
  154. package/dist/cli/chunks/{chunk-DDCIYOGT.js → chunk-VW6FRMLW.js} +2 -2
  155. package/dist/cli/chunks/chunk-VXKWNRGA.js +2 -0
  156. package/dist/cli/chunks/{chunk-CVMNJSCB.js → chunk-VYDVI6FZ.js} +2 -2
  157. package/dist/cli/chunks/{chunk-7JZJJA7U.js → chunk-WF6UISKW.js} +3 -3
  158. package/dist/cli/chunks/{chunk-SQKW3B6B.js → chunk-WIH522AP.js} +1 -1
  159. package/dist/cli/chunks/{chunk-KLTP5IDB.js → chunk-WOV6XI3A.js} +1 -1
  160. package/dist/cli/chunks/{chunk-VTOVWHEM.js → chunk-X7ADKL7T.js} +2 -2
  161. package/dist/cli/chunks/{chunk-SX4JLSLV.js → chunk-XBYQ2BS4.js} +2 -2
  162. package/dist/cli/chunks/{chunk-E4EYPYR3.js → chunk-XL5KIYE3.js} +2 -2
  163. package/dist/cli/chunks/{chunk-3VIXOHMS.js → chunk-XWYELBZS.js} +1 -1
  164. package/dist/cli/chunks/{chunk-YQGPQBCX.js → chunk-XYLQZWF6.js} +2 -2
  165. package/dist/cli/chunks/{chunk-XEZIIQYJ.js → chunk-Y6AKKQIQ.js} +1 -1
  166. package/dist/cli/chunks/{chunk-BJPL6THQ.js → chunk-YMW57PEL.js} +1 -1
  167. package/dist/cli/chunks/{chunk-JSZ663MU.js → chunk-YO4ESCB4.js} +1 -1
  168. package/dist/cli/chunks/{chunk-AMMQOV35.js → chunk-YRHTQZU4.js} +2 -2
  169. package/dist/cli/chunks/chunk-Z4Q5PCRZ.js +65 -0
  170. package/dist/cli/chunks/{chunk-RKOUXVZZ.js → chunk-ZELWDJXT.js} +2 -2
  171. package/dist/cli/chunks/{chunk-QRCIZFNK.js → chunk-ZQZD55MN.js} +2 -2
  172. package/dist/cli/chunks/{chunk-UMGFMKDW.js → chunk-ZS4XVJGV.js} +2 -2
  173. package/dist/cli/chunks/{chunk-6ITZZIQX.js → chunk-ZUB5YOCM.js} +2 -2
  174. package/dist/cli/chunks/chunk-ZUOVNFXK.js +2 -0
  175. package/dist/cli/chunks/{chunk-RGGK6VZ7.js → chunk-ZWEKAEEV.js} +1 -1
  176. package/dist/cli/chunks/{ci-RACDAJMR.js → ci-J3TDK5RA.js} +8 -8
  177. package/dist/cli/chunks/{ci-output-EHRSZBKG.js → ci-output-RLS32FUY.js} +2 -2
  178. package/dist/cli/chunks/{circuit-breaker-GBV7M5XG.js → circuit-breaker-MRCC7WCM.js} +2 -2
  179. package/dist/cli/chunks/claude-flow-setup-LIZCEKDF.js +2 -0
  180. package/dist/cli/chunks/client-3BD2DI4N.js +2 -0
  181. package/dist/cli/chunks/{cline-installer-W4NMXJSG.js → cline-installer-T7H6R2RC.js} +2 -2
  182. package/dist/cli/chunks/{code-JWXJMYXB.js → code-XMBLI7OF.js} +3 -3
  183. package/dist/cli/chunks/{code-index-extractor-RVI2IFTM.js → code-index-extractor-QS7BYLEX.js} +2 -2
  184. package/dist/cli/chunks/{codex-installer-3BORJINH.js → codex-installer-6PGT5FM6.js} +6 -6
  185. package/dist/cli/chunks/{completions-A55NCTAO.js → completions-2A3WRXY2.js} +2 -2
  186. package/dist/cli/chunks/{complexity-analyzer-JCXHGGLY.js → complexity-analyzer-23HOOGJ7.js} +2 -2
  187. package/dist/cli/chunks/{continuedev-installer-PUVFMGYW.js → continuedev-installer-4FSF7B3N.js} +2 -2
  188. package/dist/cli/chunks/{copilot-installer-4DCMYWHB.js → copilot-installer-A5GRQQUU.js} +2 -2
  189. package/dist/cli/chunks/core-handlers-C3H2ZCS2.js +2 -0
  190. package/dist/cli/chunks/{cost-tracker-5TV2GGKY.js → cost-tracker-Z4STQ5VB.js} +2 -2
  191. package/dist/cli/chunks/{coverage-NNWM7TX3.js → coverage-NUPP6KZZ.js} +3 -3
  192. package/dist/cli/chunks/cross-domain-router-JCQ7SWDP.js +2 -0
  193. package/dist/cli/chunks/{cursor-installer-4NCHGJGK.js → cursor-installer-FVJ7ROPJ.js} +2 -2
  194. package/dist/cli/chunks/{daemon-QIKCXKWO.js → daemon-7ZZA2MMN.js} +4 -4
  195. package/dist/cli/chunks/{daemon-T4JO4IXP.js → daemon-D662EX5N.js} +3 -3
  196. package/dist/cli/chunks/{dag-attention-scheduler-RPAAIDAD.js → dag-attention-scheduler-IB4TQ2KA.js} +2 -2
  197. package/dist/cli/chunks/{detect-SBEEVDSN.js → detect-LGLBZN4I.js} +2 -2
  198. package/dist/cli/chunks/{dist-node-ZHI6NCSU.js → dist-node-Z3OL42YE.js} +2 -2
  199. package/dist/cli/chunks/{domain-handler-LBC3GJ7Z.js → domain-handler-L3CLNL7U.js} +2 -2
  200. package/dist/cli/chunks/{domain-plugins-H6IZ5USZ.js → domain-plugins-GQ3V5X6L.js} +2 -2
  201. package/dist/cli/chunks/domain-transfer-MFCI76IY.js +2 -0
  202. package/dist/cli/chunks/dream-FTP33IJB.js +2 -0
  203. package/dist/cli/chunks/{embed-and-insert-pattern-AHTR7CRU.js → embed-and-insert-pattern-UGD6USYH.js} +2 -2
  204. package/dist/cli/chunks/{eval-DZU2KISM.js → eval-3B7UIYGY.js} +2 -2
  205. package/dist/cli/chunks/{experience-capture-middleware-5IQCWKSL.js → experience-capture-middleware-3RQ4NYY3.js} +3 -3
  206. package/dist/cli/chunks/{fast-paths-2KLDUWCY.js → fast-paths-QOSAEPYD.js} +2 -2
  207. package/dist/cli/chunks/{feature-flags-7AC3XDZA.js → feature-flags-3S5TH6P4.js} +2 -2
  208. package/dist/cli/chunks/{feature-flags-N6UAEZY4.js → feature-flags-TLF4NKOH.js} +2 -2
  209. package/dist/cli/chunks/{file-discovery-5SDIW4V2.js → file-discovery-AEVMJRNB.js} +2 -2
  210. package/dist/cli/chunks/{fleet-ZIQCAZ2Y.js → fleet-E6WTXWFL.js} +3 -3
  211. package/dist/cli/chunks/{gnn-wrapper-DUMBZJEV.js → gnn-wrapper-MCKH3AUU.js} +2 -2
  212. package/dist/cli/chunks/{heartbeat-handler-6HVM6ZMR.js → heartbeat-handler-U7XENHRR.js} +4 -4
  213. package/dist/cli/chunks/heartbeat-scheduler-HXBJVJL2.js +2 -0
  214. package/dist/cli/chunks/hnsw-adapter-TU6WG2ME.js +2 -0
  215. package/dist/cli/chunks/hnsw-index-MS5KODD7.js +2 -0
  216. package/dist/cli/chunks/{hnsw-legacy-bridge-5DRL5FLX.js → hnsw-legacy-bridge-5GW4SAEI.js} +2 -2
  217. package/dist/cli/chunks/{hnswlib-node-GW67GTCL.js → hnswlib-node-7BLZBK5T.js} +2 -2
  218. package/dist/cli/chunks/{hooks-QHH6FVO4.js → hooks-F3O2SB6H.js} +10 -10
  219. package/dist/cli/chunks/hybrid-backend-HT45LBHC.js +2 -0
  220. package/dist/cli/chunks/{hypergraph-engine-7XDCCVG2.js → hypergraph-engine-PV4EKXHB.js} +2 -2
  221. package/dist/cli/chunks/{hypergraph-handler-QHF7NOU5.js → hypergraph-handler-VOWO5ZTW.js} +3 -3
  222. package/dist/cli/chunks/impact-analyzer-AP4AGTG5.js +2 -0
  223. package/dist/cli/chunks/{init-handler-5UIVOM7K.js → init-handler-ENJ5ONJX.js} +16 -14
  224. package/dist/cli/chunks/init-wizard-I5DFZUQL.js +2 -0
  225. package/dist/cli/chunks/kernel-MISPSPPA.js +2 -0
  226. package/dist/cli/chunks/{kilocode-installer-TGGV6K5Q.js → kilocode-installer-HNNJOOPE.js} +2 -2
  227. package/dist/cli/chunks/{kiro-installer-4XYBHZWW.js → kiro-installer-UZBIQ3IC.js} +2 -2
  228. package/dist/cli/chunks/knowledge-graph-L26JESGE.js +2 -0
  229. package/dist/cli/chunks/{learning-STE5W6BS.js → learning-YMLCVFUT.js} +3 -3
  230. package/dist/cli/chunks/{llm-router-NKF7J3RI.js → llm-router-YWTARCCT.js} +4 -4
  231. package/dist/cli/chunks/llm-router-service-MWGC43ZA.js +2 -0
  232. package/dist/cli/chunks/{load-B2T77UJQ.js → load-DKE3F3IP.js} +2 -2
  233. package/dist/cli/chunks/load-test-H5ISNNM5.js +2 -0
  234. package/dist/cli/chunks/mcp-5PSGIUCW.js +2 -0
  235. package/dist/cli/chunks/{memory-WRFZKG56.js → memory-3L3O6JMM.js} +5 -5
  236. package/dist/cli/chunks/memory-backend-HWDNOBKW.js +2 -0
  237. package/dist/cli/chunks/memory-handlers-ZFDVQZM5.js +2 -0
  238. package/dist/cli/chunks/multi-model-executor-AEEO7IA4.js +14 -0
  239. package/dist/cli/chunks/{opencode-installer-J36EMQU7.js → opencode-installer-ABBO355U.js} +2 -2
  240. package/dist/cli/chunks/orchestrator-E36Q7MKE.js +393 -0
  241. package/dist/cli/chunks/pattern-null-store-GQP6ICWK.js +2 -0
  242. package/dist/cli/chunks/{pattern-usage-recorder-BVMTWI3E.js → pattern-usage-recorder-H4XKSID4.js} +2 -2
  243. package/dist/cli/chunks/{pipeline-OWAHDUAQ.js → pipeline-BGFEHXIN.js} +2 -2
  244. package/dist/cli/chunks/{platform-ANGBFWBV.js → platform-GK7ZVDJI.js} +2 -2
  245. package/dist/cli/chunks/{plugin-OO7ON2YW.js → plugin-CAH2CKI6.js} +2 -2
  246. package/dist/cli/chunks/{prime-radiant-advanced-wasm-HFG3BXWU.js → prime-radiant-advanced-wasm-M5EYRONA.js} +2 -2
  247. package/dist/cli/chunks/{project-root-LNOYVTYY.js → project-root-BSNZC243.js} +2 -2
  248. package/dist/cli/chunks/protocol-executor-AD5A4DAI.js +2 -0
  249. package/dist/cli/chunks/{protocol-handler-CE3Q6LY4.js → protocol-handler-JDSSC2SF.js} +2 -2
  250. package/dist/cli/chunks/{prove-7XPN53PY.js → prove-ANPTOZJE.js} +2 -2
  251. package/dist/cli/chunks/qe-reasoning-bank-W3Z2PKTR.js +2 -0
  252. package/dist/cli/chunks/{quality-TT23JRFX.js → quality-SXWGYRQR.js} +2 -2
  253. package/dist/cli/chunks/{quality-gate-PPPRP255.js → quality-gate-GYNCA4ZY.js} +3 -3
  254. package/dist/cli/chunks/queen-coordinator-HQRHLIJX.js +2 -0
  255. package/dist/cli/chunks/{real-embeddings-EYNZIFJE.js → real-embeddings-WSRYAOZM.js} +2 -2
  256. package/dist/cli/chunks/{ref-validation-QQR64ZXD.js → ref-validation-AZ3LRWEK.js} +2 -2
  257. package/dist/cli/chunks/{roocode-installer-UIGS7ZJD.js → roocode-installer-2QKGFIEU.js} +2 -2
  258. package/dist/cli/chunks/router-MTP5LH4H.js +2 -0
  259. package/dist/cli/chunks/routing-feedback-GWETVB4L.js +2 -0
  260. package/dist/cli/chunks/{routing-handler-6AENUIRG.js → routing-handler-UYDC5MMD.js} +2 -2
  261. package/dist/cli/chunks/{ruvector-commands-5AWMEV34.js → ruvector-commands-QXADPVEY.js} +2 -2
  262. package/dist/cli/chunks/rvf-dual-writer-4UE5S7WP.js +2 -0
  263. package/dist/cli/chunks/rvf-migration-adapter-PHH3HF4Q.js +2 -0
  264. package/dist/cli/chunks/{rvf-migration-coordinator-NWRJ7C22.js → rvf-migration-coordinator-GD4NBFKT.js} +2 -2
  265. package/dist/cli/chunks/rvf-native-adapter-KTLZBUWV.js +2 -0
  266. package/dist/cli/chunks/{rvf-store-integrity-ISKRP563.js → rvf-store-integrity-7SXG66IL.js} +2 -2
  267. package/dist/cli/chunks/safe-db-FWWGAPVE.js +2 -0
  268. package/dist/cli/chunks/schedule-TPA4V4D5.js +2 -0
  269. package/dist/cli/chunks/scheduler-5ZTEPNDD.js +2 -0
  270. package/dist/cli/chunks/{security-325A7FMB.js → security-YKB622PK.js} +3 -3
  271. package/dist/cli/chunks/shared-rvf-adapter-KMLAV7JK.js +2 -0
  272. package/dist/cli/chunks/{shared-rvf-dual-writer-THFDYS2Z.js → shared-rvf-dual-writer-OYY27DFV.js} +2 -2
  273. package/dist/cli/chunks/sqlite-persistence-HPTT624C.js +2 -0
  274. package/dist/cli/chunks/{standalone-memory-UD4MJ6GZ.js → standalone-memory-2DOABVLC.js} +2 -2
  275. package/dist/cli/chunks/{status-handler-CPFTN4XL.js → status-handler-EXRKETV7.js} +2 -2
  276. package/dist/cli/chunks/{structural-health-2MG2IVBL.js → structural-health-2SKK6DU6.js} +2 -2
  277. package/dist/cli/chunks/sync-DQ2YUNI6.js +2 -0
  278. package/dist/cli/chunks/{sync-EE4VVKOW.js → sync-UW7SX7GO.js} +2 -2
  279. package/dist/cli/chunks/{task-handler-7H5OYJG4.js → task-handler-LYQ6WYUY.js} +2 -2
  280. package/dist/cli/chunks/task-handlers-DIJO232S.js +9 -0
  281. package/dist/cli/chunks/test-WRHZMUCW.js +33 -0
  282. package/dist/cli/chunks/{test-scheduling-CHQ4ZLLJ.js → test-scheduling-HI23RXFK.js} +3 -3
  283. package/dist/cli/chunks/token-bootstrap-23SA6SWZ.js +2 -0
  284. package/dist/cli/chunks/{token-usage-EBXUJNRB.js → token-usage-M7RRDPXO.js} +2 -2
  285. package/dist/cli/chunks/{transformers-ZEKS2OJZ.js → transformers-4TC35KKS.js} +2 -2
  286. package/dist/cli/chunks/tree-sitter-wasm-parser-F4LTKAWD.js +2 -0
  287. package/dist/cli/chunks/{types-KYAA5VLV.js → types-NBXV6LXQ.js} +2 -2
  288. package/dist/cli/chunks/unified-memory-OVFEPRPS.js +2 -0
  289. package/dist/cli/chunks/unified-memory-hnsw-KKRSCZHR.js +2 -0
  290. package/dist/cli/chunks/unified-persistence-7GLR4RI3.js +2 -0
  291. package/dist/cli/chunks/{upgrade-UJBJ5AYM.js → upgrade-4BGOU5RM.js} +2 -2
  292. package/dist/cli/chunks/{validate-RUV6YMWS.js → validate-EDWAR63H.js} +2 -2
  293. package/dist/cli/chunks/{validate-swarm-IVEVMGVM.js → validate-swarm-VI72CPR7.js} +2 -2
  294. package/dist/cli/chunks/visual-security-2FUM5GLI.js +2 -0
  295. package/dist/cli/chunks/{web-tree-sitter-AVWA6HKE.js → web-tree-sitter-Y5XBRQXF.js} +2 -2
  296. package/dist/cli/chunks/{windsurf-installer-DAH7HI2W.js → windsurf-installer-VEX23WAF.js} +2 -2
  297. package/dist/cli/chunks/witness-chain-3YNL6YGY.js +2 -0
  298. package/dist/cli/chunks/witness-chain-MH6GA5L6.js +2 -0
  299. package/dist/cli/chunks/witness-chain-repair-MJZGZRWT.js +2 -0
  300. package/dist/cli/chunks/witness-chain-verifier-TTJYXTBE.js +2 -0
  301. package/dist/cli/chunks/{witness-key-manager-JSTBMG43.js → witness-key-manager-EM6YXYOY.js} +2 -2
  302. package/dist/cli/chunks/{workflow-TWOIA6LZ.js → workflow-2RBDOM7V.js} +4 -4
  303. package/dist/cli/chunks/workflow-orchestrator-H6G65YKU.js +2 -0
  304. package/dist/cli/chunks/wrappers-5OTAVVOV.js +2 -0
  305. package/dist/cli/commands/audit.d.ts +20 -2
  306. package/dist/cli/commands/audit.js +158 -16
  307. package/dist/cli/commands/ci.js +1 -1
  308. package/dist/cli/commands/claude-flow-setup.js +5 -4
  309. package/dist/cli/commands/test.js +18 -3
  310. package/dist/cli/handlers/init-handler.d.ts +2 -0
  311. package/dist/cli/handlers/init-handler.js +8 -2
  312. package/dist/cli/index.js +10 -1
  313. package/dist/coordination/handlers/test-execution-handlers.js +13 -8
  314. package/dist/coordination/index.d.ts +1 -1
  315. package/dist/coordination/queen-event-handlers.js +9 -6
  316. package/dist/coordination/result-saver.js +1 -1
  317. package/dist/coordination/services/index.d.ts +1 -1
  318. package/dist/coordination/services/task-audit-logger.d.ts +38 -13
  319. package/dist/coordination/services/task-audit-logger.js +33 -5
  320. package/dist/coordination/task-executor.d.ts +5 -0
  321. package/dist/coordination/task-executor.js +10 -5
  322. package/dist/domains/test-generation/coordinator.js +6 -5
  323. package/dist/domains/test-generation/interfaces.d.ts +11 -1
  324. package/dist/domains/test-generation/services/behavior-example-validation.d.ts +36 -0
  325. package/dist/domains/test-generation/services/behavior-example-validation.js +89 -0
  326. package/dist/domains/test-generation/services/behavior-examples.d.ts +8 -0
  327. package/dist/domains/test-generation/services/behavior-examples.js +65 -0
  328. package/dist/domains/test-generation/services/test-generator.d.ts +1 -1
  329. package/dist/domains/test-generation/services/test-generator.js +59 -30
  330. package/dist/domains/visual-accessibility/services/axe-core-audit.d.ts +0 -15
  331. package/dist/domains/visual-accessibility/services/axe-core-audit.js +12 -10
  332. package/dist/init/agents-installer.d.ts +4 -0
  333. package/dist/init/agents-installer.js +24 -11
  334. package/dist/init/browser-engine-installer.d.ts +5 -5
  335. package/dist/init/browser-engine-installer.js +28 -6
  336. package/dist/init/codex-installer.js +4 -2
  337. package/dist/init/idempotent-write.d.ts +53 -0
  338. package/dist/init/idempotent-write.js +160 -0
  339. package/dist/init/init-wizard.d.ts +2 -0
  340. package/dist/init/orchestrator.js +1 -0
  341. package/dist/init/phases/05-learning.js +3 -1
  342. package/dist/init/phases/07-hooks.js +32 -16
  343. package/dist/init/phases/08-mcp.js +4 -2
  344. package/dist/init/phases/09-assets.js +8 -18
  345. package/dist/init/phases/10-workers.js +7 -5
  346. package/dist/init/phases/12-verification.js +7 -2
  347. package/dist/init/phases/phase-interface.d.ts +2 -0
  348. package/dist/init/project-analyzer.d.ts +9 -0
  349. package/dist/init/project-analyzer.js +20 -1
  350. package/dist/init/self-configurator.d.ts +5 -3
  351. package/dist/init/self-configurator.js +18 -29
  352. package/dist/init/skills-installer.js +4 -2
  353. package/dist/init/types.d.ts +6 -0
  354. package/dist/init/types.js +20 -24
  355. package/dist/integrations/agentic-flow/reasoning-bank/index.d.ts +2 -5
  356. package/dist/integrations/coherence/coherence-service.js +84 -24
  357. package/dist/integrations/coherence/vote-tally.d.ts +38 -0
  358. package/dist/integrations/coherence/vote-tally.js +39 -0
  359. package/dist/integrations/ruvector/shared-rvf-adapter.d.ts +23 -0
  360. package/dist/integrations/ruvector/shared-rvf-adapter.js +24 -0
  361. package/dist/integrations/vibium/client.d.ts +1 -0
  362. package/dist/integrations/vibium/client.js +24 -11
  363. package/dist/integrations/vibium/runtime.d.ts +14 -0
  364. package/dist/integrations/vibium/runtime.js +94 -0
  365. package/dist/kernel/kernel.js +3 -2
  366. package/dist/kernel/pattern-fts-self-heal.d.ts +63 -0
  367. package/dist/kernel/pattern-fts-self-heal.js +193 -0
  368. package/dist/kernel/process-lifecycle.d.ts +60 -0
  369. package/dist/kernel/process-lifecycle.js +91 -0
  370. package/dist/kernel/unified-memory-schemas.d.ts +15 -1
  371. package/dist/kernel/unified-memory-schemas.js +53 -25
  372. package/dist/kernel/unified-memory.js +31 -34
  373. package/dist/kernel/unified-persistence.js +12 -6
  374. package/dist/learning/experience-capture.d.ts +2 -1
  375. package/dist/learning/experience-capture.js +23 -8
  376. package/dist/learning/pattern-store.d.ts +12 -1
  377. package/dist/learning/pattern-store.js +45 -30
  378. package/dist/learning/qe-patterns.d.ts +12 -0
  379. package/dist/learning/qe-patterns.js +7 -1
  380. package/dist/learning/qe-reasoning-bank.d.ts +1 -0
  381. package/dist/learning/qe-reasoning-bank.js +17 -4
  382. package/dist/learning/real-qe-reasoning-bank.d.ts +9 -4
  383. package/dist/learning/real-qe-reasoning-bank.js +28 -4
  384. package/dist/learning/rvf-pattern-store.js +36 -23
  385. package/dist/learning/sqlite-persistence.d.ts +8 -1
  386. package/dist/learning/sqlite-persistence.js +58 -33
  387. package/dist/logging/console-logger.d.ts +2 -5
  388. package/dist/logging/console-logger.js +10 -46
  389. package/dist/logging/index.d.ts +2 -0
  390. package/dist/logging/index.js +1 -0
  391. package/dist/logging/redaction.d.ts +27 -0
  392. package/dist/logging/redaction.js +170 -0
  393. package/dist/mcp/bundle.js +522 -545
  394. package/dist/mcp/entry.js +52 -6
  395. package/dist/mcp/handlers/core-handlers.js +5 -4
  396. package/dist/mcp/handlers/domain-handler-configs.js +12 -4
  397. package/dist/mcp/handlers/task-handlers.js +11 -7
  398. package/dist/mcp/protocol-server.js +20 -4
  399. package/dist/mcp/services/reasoning-bank-service.d.ts +6 -1
  400. package/dist/mcp/services/reasoning-bank-service.js +5 -1
  401. package/dist/mcp/tools/base.d.ts +9 -2
  402. package/dist/mcp/tools/base.js +7 -0
  403. package/dist/mcp/tools/coherence/consensus.js +51 -2
  404. package/dist/mcp/tools/planning/goap-plan.d.ts +20 -7
  405. package/dist/mcp/tools/planning/goap-plan.js +92 -20
  406. package/dist/mcp/tools/planning/goap-status.d.ts +37 -12
  407. package/dist/mcp/tools/planning/goap-status.js +52 -23
  408. package/dist/mcp/tools/planning/world-state.d.ts +101 -0
  409. package/dist/mcp/tools/planning/world-state.js +274 -0
  410. package/dist/mcp/tools/test-execution/e2e-execute.js +9 -1
  411. package/dist/mcp/tools/test-generation/generate.d.ts +6 -1
  412. package/dist/mcp/tools/test-generation/generate.js +8 -0
  413. package/dist/mcp/types.d.ts +10 -4
  414. package/dist/planning/goap-planner.d.ts +60 -4
  415. package/dist/planning/goap-planner.js +218 -60
  416. package/dist/planning/index.d.ts +1 -1
  417. package/dist/planning/index.js +1 -1
  418. package/dist/planning/plan-executor.d.ts +20 -1
  419. package/dist/planning/plan-executor.js +209 -100
  420. package/dist/planning/types.d.ts +16 -0
  421. package/dist/planning/types.js +17 -0
  422. package/dist/shared/error-utils.d.ts +15 -0
  423. package/dist/shared/error-utils.js +21 -0
  424. package/dist/shared/events/domain-events.d.ts +2 -1
  425. package/package.json +10 -6
  426. package/dist/cli/chunks/adapter-IYC62SXA.js +0 -2
  427. package/dist/cli/chunks/agent-booster-wasm-EDNKP3SP.js +0 -2
  428. package/dist/cli/chunks/aqe-learning-engine-LLOU2IXD.js +0 -2
  429. package/dist/cli/chunks/audit-CVZQMF55.js +0 -3
  430. package/dist/cli/chunks/base-P3Z4IKCT.js +0 -2
  431. package/dist/cli/chunks/browser-workflow-YYHQQ25X.js +0 -2
  432. package/dist/cli/chunks/chunk-3EZ5DR2R.js +0 -21
  433. package/dist/cli/chunks/chunk-5WOSWNDN.js +0 -2
  434. package/dist/cli/chunks/chunk-7CD7PBHY.js +0 -3
  435. package/dist/cli/chunks/chunk-7X7JYWT4.js +0 -27
  436. package/dist/cli/chunks/chunk-CZO4BJG5.js +0 -2
  437. package/dist/cli/chunks/chunk-J27F4NSB.js +0 -2
  438. package/dist/cli/chunks/chunk-J5UNP6W3.js +0 -2
  439. package/dist/cli/chunks/chunk-MI5Q55DG.js +0 -65
  440. package/dist/cli/chunks/chunk-TY5WC3FT.js +0 -12
  441. package/dist/cli/chunks/chunk-UDHVCKGA.js +0 -5
  442. package/dist/cli/chunks/chunk-XQSIRBKT.js +0 -180
  443. package/dist/cli/chunks/chunk-YXP6BKGS.js +0 -730
  444. package/dist/cli/chunks/chunk-ZBABIZ2D.js +0 -2
  445. package/dist/cli/chunks/chunk-ZCWERUYB.js +0 -12
  446. package/dist/cli/chunks/claude-flow-setup-5LVJOFKP.js +0 -2
  447. package/dist/cli/chunks/client-HUVFA5PF.js +0 -2
  448. package/dist/cli/chunks/core-handlers-UEXO3VAA.js +0 -2
  449. package/dist/cli/chunks/cross-domain-router-ODU5IZD6.js +0 -2
  450. package/dist/cli/chunks/domain-transfer-JZA5TMW3.js +0 -2
  451. package/dist/cli/chunks/dream-HE3OX42F.js +0 -2
  452. package/dist/cli/chunks/heartbeat-scheduler-QUIFGGLX.js +0 -2
  453. package/dist/cli/chunks/hnsw-adapter-42KB37KP.js +0 -2
  454. package/dist/cli/chunks/hnsw-index-T2PGO77J.js +0 -2
  455. package/dist/cli/chunks/hybrid-backend-FRNWYRKH.js +0 -2
  456. package/dist/cli/chunks/impact-analyzer-A5QYOYBR.js +0 -2
  457. package/dist/cli/chunks/init-wizard-XBU674YH.js +0 -2
  458. package/dist/cli/chunks/kernel-DV5MTNZD.js +0 -2
  459. package/dist/cli/chunks/knowledge-graph-4ACGVJQK.js +0 -2
  460. package/dist/cli/chunks/llm-router-service-PSMASERT.js +0 -2
  461. package/dist/cli/chunks/load-test-MRUO2VPF.js +0 -2
  462. package/dist/cli/chunks/mcp-JGSFCEMH.js +0 -2
  463. package/dist/cli/chunks/memory-backend-2MPGI6JW.js +0 -2
  464. package/dist/cli/chunks/memory-handlers-XT4HMITB.js +0 -2
  465. package/dist/cli/chunks/multi-model-executor-26Q5BSVG.js +0 -14
  466. package/dist/cli/chunks/orchestrator-D5IFV65I.js +0 -393
  467. package/dist/cli/chunks/pattern-null-store-TGWUL237.js +0 -2
  468. package/dist/cli/chunks/protocol-executor-GEVH5KD6.js +0 -2
  469. package/dist/cli/chunks/qe-reasoning-bank-DJ2JL6QB.js +0 -2
  470. package/dist/cli/chunks/queen-coordinator-F7E3AS26.js +0 -2
  471. package/dist/cli/chunks/router-OZH3QSAU.js +0 -2
  472. package/dist/cli/chunks/routing-feedback-J2E3ADZB.js +0 -2
  473. package/dist/cli/chunks/rvf-dual-writer-HK525Y5Y.js +0 -2
  474. package/dist/cli/chunks/rvf-migration-adapter-Q7FB3BKR.js +0 -2
  475. package/dist/cli/chunks/rvf-native-adapter-5ZRCGUI6.js +0 -2
  476. package/dist/cli/chunks/safe-db-3OYEPVEH.js +0 -2
  477. package/dist/cli/chunks/schedule-AG4C2EIQ.js +0 -2
  478. package/dist/cli/chunks/scheduler-SQS2CZFZ.js +0 -2
  479. package/dist/cli/chunks/shared-rvf-adapter-NFL6QSZ6.js +0 -2
  480. package/dist/cli/chunks/sqlite-persistence-MAKDFSHC.js +0 -2
  481. package/dist/cli/chunks/sync-MBTW5XBF.js +0 -2
  482. package/dist/cli/chunks/task-handlers-NH4GJHCJ.js +0 -9
  483. package/dist/cli/chunks/test-MPHGT4T6.js +0 -33
  484. package/dist/cli/chunks/token-bootstrap-SSDCYEKK.js +0 -2
  485. package/dist/cli/chunks/tree-sitter-wasm-parser-J6ZMAK37.js +0 -2
  486. package/dist/cli/chunks/unified-memory-DDWMC435.js +0 -2
  487. package/dist/cli/chunks/unified-memory-hnsw-4JA7SGBK.js +0 -2
  488. package/dist/cli/chunks/unified-persistence-F6OSNTXY.js +0 -2
  489. package/dist/cli/chunks/vibium-HOGMFJ2Z.js +0 -2
  490. package/dist/cli/chunks/visual-security-25SMBIYT.js +0 -2
  491. package/dist/cli/chunks/witness-chain-PJOQPFUX.js +0 -2
  492. package/dist/cli/chunks/witness-chain-ZW6KKUZU.js +0 -2
  493. package/dist/cli/chunks/workflow-orchestrator-UKSIDM7Q.js +0 -2
  494. package/dist/cli/chunks/wrappers-UR7BLXKV.js +0 -2
@@ -0,0 +1,94 @@
1
+ /** Resolve the opt-in Vibium runtime for both local and global AQE installs. */
2
+ import { createRequire } from 'node:module';
3
+ import { execFileSync } from 'node:child_process';
4
+ import { existsSync } from 'node:fs';
5
+ import { dirname, join } from 'node:path';
6
+ export const VIBIUM_SETUP = 'aqe init --browser-engine (or npm install vibium@^26.8.21)';
7
+ const requireFromHere = createRequire(import.meta.url);
8
+ /**
9
+ * How to run npm without a shell. On Windows `npm` is an `npm.cmd` shim, which
10
+ * execFile cannot start without `shell: true` (EINVAL/ENOENT since the
11
+ * CVE-2024-27980 fix), so run the npm CLI bundled next to node.exe instead.
12
+ * Falls back to plain `npm` when that layout is absent.
13
+ */
14
+ export function npmInvocation(platform = process.platform, execPath = process.execPath, exists = existsSync) {
15
+ if (platform === 'win32') {
16
+ const npmCli = join(dirname(execPath), 'node_modules', 'npm', 'bin', 'npm-cli.js');
17
+ if (exists(npmCli))
18
+ return [execPath, [npmCli]];
19
+ }
20
+ return ['npm', []];
21
+ }
22
+ /** Never install or download anything while probing availability. */
23
+ function resolveRuntime() {
24
+ try {
25
+ return requireFromHere.resolve('vibium');
26
+ }
27
+ catch {
28
+ try {
29
+ return createRequire(join(process.cwd(), 'package.json')).resolve('vibium');
30
+ }
31
+ catch { /* No project-local opt-in runtime. Try global setup below. */ }
32
+ // A global CLI installation is not on Node's normal module search path.
33
+ // npm root is read-only and honors the same npm prefix as explicit setup.
34
+ const [npmBin, npmPrefixArgs] = npmInvocation();
35
+ const root = execFileSync(npmBin, [...npmPrefixArgs, 'root', '-g'], {
36
+ encoding: 'utf8', timeout: 5000, stdio: ['ignore', 'pipe', 'pipe'],
37
+ }).trim();
38
+ return requireFromHere.resolve(join(root, 'vibium'));
39
+ }
40
+ }
41
+ /**
42
+ * Accept the modern API from the namespace itself or from its `default`
43
+ * export. CJS interop and bundler createRequire shims expose the package
44
+ * object only as `default`, so checking the namespace alone rejects a
45
+ * correctly installed runtime.
46
+ */
47
+ function selectBrowserApi(loaded) {
48
+ if (typeof loaded?.browser?.start === 'function')
49
+ return loaded;
50
+ if (typeof loaded?.default?.browser?.start === 'function')
51
+ return loaded.default;
52
+ return null;
53
+ }
54
+ export async function loadVibium() {
55
+ let loaded;
56
+ try {
57
+ loaded = await import('vibium');
58
+ }
59
+ catch (error) {
60
+ // Only a missing local package permits global resolution. A broken local
61
+ // installation must not be silently replaced by an unrelated runtime.
62
+ if (error.code !== 'ERR_MODULE_NOT_FOUND' &&
63
+ error.code !== 'MODULE_NOT_FOUND')
64
+ throw error;
65
+ let entry;
66
+ try {
67
+ entry = resolveRuntime();
68
+ }
69
+ catch (cause) {
70
+ throw new Error(`Vibium is not installed; run ${VIBIUM_SETUP}`, { cause });
71
+ }
72
+ loaded = requireFromHere(entry);
73
+ }
74
+ const runtime = selectBrowserApi(loaded);
75
+ if (!runtime) {
76
+ throw new Error('Unsupported Vibium API: the installed package exposes no browser.start() ' +
77
+ `(neither as a named nor a default export); run ${VIBIUM_SETUP}`);
78
+ }
79
+ return runtime;
80
+ }
81
+ /** Check the payload belonging to the resolved library, not a different PATH CLI. */
82
+ export function isVibiumReady() {
83
+ try {
84
+ const cli = join(dirname(resolveRuntime()), '..', 'bin', 'cli.js');
85
+ execFileSync(process.execPath, [cli, 'is-installed'], {
86
+ timeout: 5000, stdio: 'ignore',
87
+ });
88
+ return true;
89
+ }
90
+ catch {
91
+ return false;
92
+ }
93
+ }
94
+ //# sourceMappingURL=runtime.js.map
@@ -7,6 +7,7 @@ import { ALL_DOMAINS } from '../shared/types/index.js';
7
7
  import { InMemoryEventBus } from './event-bus.js';
8
8
  import { DefaultAgentCoordinator } from './agent-coordinator.js';
9
9
  import { DefaultPluginLoader } from './plugin-loader.js';
10
+ import { formatErrorForLog } from '../logging/redaction.js';
10
11
  import { InMemoryBackend } from './memory-backend.js';
11
12
  import { createKernelMemoryBackend } from './hybrid-backend.js';
12
13
  import { SemanticAntiDriftMiddleware, ToolCallSignatureTracker } from './anti-drift-middleware.js';
@@ -488,7 +489,7 @@ export class QEKernelImpl {
488
489
  plugin = await this._plugins.load(domain);
489
490
  }
490
491
  catch (error) {
491
- console.error(`[QEKernel] Failed to lazy load domain ${domain}:`, error);
492
+ console.error(`[QEKernel] Failed to lazy load domain ${domain}:`, formatErrorForLog(error));
492
493
  return undefined;
493
494
  }
494
495
  }
@@ -511,7 +512,7 @@ export class QEKernelImpl {
511
512
  return true;
512
513
  }
513
514
  catch (error) {
514
- console.error(`[QEKernel] Failed to load domain ${domain}:`, error);
515
+ console.error(`[QEKernel] Failed to load domain ${domain}:`, formatErrorForLog(error));
515
516
  return false;
516
517
  }
517
518
  }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * qe_patterns FTS5 self-heal (runs on every open, not gated on schema version)
3
+ *
4
+ * `qe_patterns_fts` is an FTS5 *external-content* table: it stores only the
5
+ * inverted index, and the three AFTER INSERT/UPDATE/DELETE triggers on
6
+ * qe_patterns are the ONLY thing keeping it in sync. Migration v9 creates them
7
+ * once (`currentVersion < 9`), so a database whose triggers were lost later
8
+ * (older code, a `.recover`, a copy/restore, a manual drop...) never heals:
9
+ * new patterns are invisible to keyword search and deleted ones linger as
10
+ * stale entries that skew BM25. Since hybrid FTS5+vector retrieval (#780/#796)
11
+ * keyword search is part of production ranking, so drift silently degrades
12
+ * retrieval and anything that locates a pattern through FTS.
13
+ *
14
+ * This module detects that state cheaply and repairs it idempotently:
15
+ * 1. qe_patterns exists but qe_patterns_fts doesn't -> create the table
16
+ * 2. any sync trigger missing -> recreate it (shared DDL)
17
+ * 3. a sync trigger whose body differs from the shared DDL -> drop + recreate
18
+ * (CREATE TRIGGER IF NOT EXISTS never replaces a same-named trigger)
19
+ * 4. any of the above OR index rowids != content rowids -> FTS5 'rebuild'
20
+ *
21
+ * Detection is read-only (counts + one anti-join on the docsize PK); the write
22
+ * transaction (BEGIN IMMEDIATE) is taken only when a repair is needed. It never
23
+ * throws: failures are logged and the caller continues (FTS search already
24
+ * degrades to vector-only). Read-only connections are skipped entirely.
25
+ *
26
+ * The 'rebuild' command reconstructs the index from the content table and
27
+ * never modifies qe_patterns rows.
28
+ */
29
+ import type { Database as DatabaseType } from 'better-sqlite3';
30
+ /** Names of the triggers that keep qe_patterns_fts in sync. */
31
+ export declare const QE_PATTERNS_FTS_TRIGGERS: string[];
32
+ export type PatternFtsHealStatus = 'healthy' | 'healed' | 'no-patterns' | 'readonly' | 'failed';
33
+ export interface PatternFtsHealResult {
34
+ status: PatternFtsHealStatus;
35
+ /** True when qe_patterns_fts had to be created. */
36
+ createdTable: boolean;
37
+ /** Triggers that were missing and have been recreated. */
38
+ recreatedTriggers: string[];
39
+ /** Triggers whose body differed from the shared DDL and have been replaced. */
40
+ replacedTriggers: string[];
41
+ /** True when the FTS5 'rebuild' command ran. */
42
+ rebuilt: boolean;
43
+ /** qe_patterns row count observed before repair (-1 if unknown). */
44
+ patternsBefore: number;
45
+ /** Indexed document count before repair (-1 if unknown / no table). */
46
+ indexedBefore: number;
47
+ /** Indexed document count after repair (-1 if not repaired). */
48
+ indexedAfter: number;
49
+ error?: string;
50
+ }
51
+ export interface PatternFtsHealOptions {
52
+ /** Log sink for the single heal/failure line. Defaults to console.warn. */
53
+ log?: (message: string) => void;
54
+ /** Prefix for the log line, e.g. "[UnifiedMemory]". */
55
+ logPrefix?: string;
56
+ }
57
+ /**
58
+ * Ensure qe_patterns_fts exists, has its three sync triggers, and indexes
59
+ * exactly the rows of qe_patterns. Idempotent and silent when healthy; logs
60
+ * one line when it repairs something; never throws.
61
+ */
62
+ export declare function ensurePatternFtsInSync(db: DatabaseType, options?: PatternFtsHealOptions): PatternFtsHealResult;
63
+ //# sourceMappingURL=pattern-fts-self-heal.d.ts.map
@@ -0,0 +1,193 @@
1
+ /**
2
+ * qe_patterns FTS5 self-heal (runs on every open, not gated on schema version)
3
+ *
4
+ * `qe_patterns_fts` is an FTS5 *external-content* table: it stores only the
5
+ * inverted index, and the three AFTER INSERT/UPDATE/DELETE triggers on
6
+ * qe_patterns are the ONLY thing keeping it in sync. Migration v9 creates them
7
+ * once (`currentVersion < 9`), so a database whose triggers were lost later
8
+ * (older code, a `.recover`, a copy/restore, a manual drop...) never heals:
9
+ * new patterns are invisible to keyword search and deleted ones linger as
10
+ * stale entries that skew BM25. Since hybrid FTS5+vector retrieval (#780/#796)
11
+ * keyword search is part of production ranking, so drift silently degrades
12
+ * retrieval and anything that locates a pattern through FTS.
13
+ *
14
+ * This module detects that state cheaply and repairs it idempotently:
15
+ * 1. qe_patterns exists but qe_patterns_fts doesn't -> create the table
16
+ * 2. any sync trigger missing -> recreate it (shared DDL)
17
+ * 3. a sync trigger whose body differs from the shared DDL -> drop + recreate
18
+ * (CREATE TRIGGER IF NOT EXISTS never replaces a same-named trigger)
19
+ * 4. any of the above OR index rowids != content rowids -> FTS5 'rebuild'
20
+ *
21
+ * Detection is read-only (counts + one anti-join on the docsize PK); the write
22
+ * transaction (BEGIN IMMEDIATE) is taken only when a repair is needed. It never
23
+ * throws: failures are logged and the caller continues (FTS search already
24
+ * degrades to vector-only). Read-only connections are skipped entirely.
25
+ *
26
+ * The 'rebuild' command reconstructs the index from the content table and
27
+ * never modifies qe_patterns rows.
28
+ */
29
+ import { toErrorMessage } from '../shared/error-utils.js';
30
+ import { QE_PATTERNS_FTS_TABLE_DDL, QE_PATTERNS_FTS_TRIGGER_DDL, } from './unified-memory-schemas.js';
31
+ /** Names of the triggers that keep qe_patterns_fts in sync. */
32
+ export const QE_PATTERNS_FTS_TRIGGERS = Object.keys(QE_PATTERNS_FTS_TRIGGER_DDL);
33
+ function objectExists(db, type, name) {
34
+ return db.prepare('SELECT 1 FROM sqlite_master WHERE type = ? AND name = ?').get(type, name) !== undefined;
35
+ }
36
+ /**
37
+ * Canonical form of a CREATE TRIGGER statement for comparison: sqlite_master
38
+ * stores the text as written minus IF NOT EXISTS, and older code paths used
39
+ * different indentation, so collapse whitespace and drop the clause/semicolon.
40
+ */
41
+ function normalizeTriggerSql(sql) {
42
+ return sql
43
+ .replace(/\s+/g, ' ')
44
+ .trim()
45
+ .replace(/^CREATE TRIGGER IF NOT EXISTS /i, 'CREATE TRIGGER ')
46
+ .replace(/ ?;$/, '')
47
+ .toLowerCase();
48
+ }
49
+ const CANONICAL_TRIGGER_SQL = Object.freeze(Object.fromEntries(Object.entries(QE_PATTERNS_FTS_TRIGGER_DDL).map(([name, ddl]) => [name, normalizeTriggerSql(ddl)])));
50
+ function count(db, sql) {
51
+ const row = db.prepare(sql).get();
52
+ return row?.n ?? 0;
53
+ }
54
+ /**
55
+ * Read-only inspection. `qe_patterns_fts_docsize` holds exactly one row per
56
+ * indexed document (id = content rowid; columnsize defaults to on), so
57
+ * comparing it with qe_patterns detects both unindexed and stale entries
58
+ * without scanning the index itself. `SELECT count(*) FROM qe_patterns_fts`
59
+ * is NOT usable: for an external-content table it reads the content table.
60
+ */
61
+ function inspect(db) {
62
+ const hasTable = objectExists(db, 'table', 'qe_patterns_fts');
63
+ const hasDocsize = hasTable && objectExists(db, 'table', 'qe_patterns_fts_docsize');
64
+ const missingTriggers = [];
65
+ const mismatchedTriggers = [];
66
+ const triggerSql = db.prepare("SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = ?");
67
+ for (const name of QE_PATTERNS_FTS_TRIGGERS) {
68
+ const row = triggerSql.get(name);
69
+ if (row === undefined)
70
+ missingTriggers.push(name);
71
+ else if (normalizeTriggerSql(row.sql ?? '') !== CANONICAL_TRIGGER_SQL[name])
72
+ mismatchedTriggers.push(name);
73
+ }
74
+ const patterns = count(db, 'SELECT count(*) AS n FROM qe_patterns');
75
+ const indexed = hasDocsize ? count(db, 'SELECT count(*) AS n FROM qe_patterns_fts_docsize') : -1;
76
+ // Equal counts + every content rowid indexed => identical rowid sets (both
77
+ // sides are unique), so one anti-join over the docsize PK suffices.
78
+ const unindexed = hasDocsize && indexed === patterns
79
+ ? count(db, `SELECT count(*) AS n FROM qe_patterns p
80
+ WHERE NOT EXISTS (SELECT 1 FROM qe_patterns_fts_docsize d WHERE d.id = p.rowid)`)
81
+ : 0;
82
+ return { hasTable, hasDocsize, missingTriggers, mismatchedTriggers, patterns, indexed, unindexed };
83
+ }
84
+ function needsRepair(s) {
85
+ if (!s.hasTable || s.missingTriggers.length > 0 || s.mismatchedTriggers.length > 0)
86
+ return true;
87
+ // Without a docsize table (non-default FTS options) drift can't be measured
88
+ // cheaply; trust the triggers rather than rebuilding on every open.
89
+ if (!s.hasDocsize)
90
+ return false;
91
+ return s.indexed !== s.patterns || s.unindexed > 0;
92
+ }
93
+ function isReadOnly(db) {
94
+ if (db.readonly)
95
+ return true;
96
+ try {
97
+ return Number(db.pragma('query_only', { simple: true })) === 1;
98
+ }
99
+ catch {
100
+ return false;
101
+ }
102
+ }
103
+ /**
104
+ * Ensure qe_patterns_fts exists, has its three sync triggers, and indexes
105
+ * exactly the rows of qe_patterns. Idempotent and silent when healthy; logs
106
+ * one line when it repairs something; never throws.
107
+ */
108
+ export function ensurePatternFtsInSync(db, options = {}) {
109
+ const log = options.log ?? ((m) => console.warn(m));
110
+ const prefix = options.logPrefix ?? '[PatternFTS]';
111
+ const result = {
112
+ status: 'healthy',
113
+ createdTable: false,
114
+ recreatedTriggers: [],
115
+ replacedTriggers: [],
116
+ rebuilt: false,
117
+ patternsBefore: -1,
118
+ indexedBefore: -1,
119
+ indexedAfter: -1,
120
+ };
121
+ try {
122
+ if (!objectExists(db, 'table', 'qe_patterns')) {
123
+ result.status = 'no-patterns';
124
+ return result;
125
+ }
126
+ if (isReadOnly(db)) {
127
+ result.status = 'readonly';
128
+ return result;
129
+ }
130
+ const before = inspect(db);
131
+ result.patternsBefore = before.patterns;
132
+ result.indexedBefore = before.indexed;
133
+ if (!needsRepair(before))
134
+ return result;
135
+ // Re-inspect inside BEGIN IMMEDIATE so a concurrent opener that already
136
+ // healed (or is mid-write) is observed under the write lock. Results are
137
+ // only published after COMMIT succeeds: a failed commit rolls everything
138
+ // back and must not be reported as a repair.
139
+ const repaired = db.transaction(() => {
140
+ const s = inspect(db);
141
+ if (!needsRepair(s))
142
+ return null;
143
+ if (!s.hasTable)
144
+ db.exec(QE_PATTERNS_FTS_TABLE_DDL);
145
+ for (const name of s.missingTriggers)
146
+ db.exec(QE_PATTERNS_FTS_TRIGGER_DDL[name]);
147
+ for (const name of s.mismatchedTriggers) {
148
+ db.exec(`DROP TRIGGER IF EXISTS ${name}`);
149
+ db.exec(QE_PATTERNS_FTS_TRIGGER_DDL[name]);
150
+ }
151
+ // Rebuild from the content table: clears stale entries and indexes rows
152
+ // inserted/updated while triggers were absent. Never touches qe_patterns.
153
+ db.exec("INSERT INTO qe_patterns_fts(qe_patterns_fts) VALUES('rebuild')");
154
+ return { s, indexedAfter: count(db, 'SELECT count(*) AS n FROM qe_patterns_fts_docsize') };
155
+ }).immediate();
156
+ if (repaired) {
157
+ const { s } = repaired;
158
+ result.createdTable = !s.hasTable;
159
+ result.recreatedTriggers = [...s.missingTriggers];
160
+ result.replacedTriggers = [...s.mismatchedTriggers];
161
+ result.patternsBefore = s.patterns;
162
+ result.indexedBefore = s.indexed;
163
+ result.indexedAfter = repaired.indexedAfter;
164
+ result.rebuilt = true;
165
+ }
166
+ if (result.rebuilt) {
167
+ result.status = 'healed';
168
+ const parts = [];
169
+ if (result.createdTable)
170
+ parts.push('created qe_patterns_fts');
171
+ if (result.recreatedTriggers.length > 0) {
172
+ parts.push(`recreated triggers [${result.recreatedTriggers.join(', ')}]`);
173
+ }
174
+ if (result.replacedTriggers.length > 0) {
175
+ parts.push(`replaced triggers [${result.replacedTriggers.join(', ')}]`);
176
+ }
177
+ const indexedBefore = result.indexedBefore < 0 ? 'n/a' : String(result.indexedBefore);
178
+ parts.push(`rebuilt index (indexed ${indexedBefore} -> ${result.indexedAfter}, qe_patterns ${result.patternsBefore})`);
179
+ log(`${prefix} Healed qe_patterns FTS5 index: ${parts.join('; ')}`);
180
+ }
181
+ return result;
182
+ }
183
+ catch (error) {
184
+ result.status = 'failed';
185
+ result.error = toErrorMessage(error);
186
+ try {
187
+ log(`${prefix} qe_patterns FTS5 self-heal skipped: ${result.error} (keyword search may be degraded; vector search unaffected)`);
188
+ }
189
+ catch { /* logging must never break open */ }
190
+ return result;
191
+ }
192
+ }
193
+ //# sourceMappingURL=pattern-fts-self-heal.js.map
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Agentic QE v3 - Process lifecycle ownership (#801)
3
+ *
4
+ * A long-running entry point (the MCP server) owns process shutdown: before it
5
+ * exits it must drain in-flight work and release native handles. The shared
6
+ * patterns RVF adapter, for example, holds a `patterns.rvf.lock` marker that
7
+ * only its own close() removes.
8
+ *
9
+ * Module-level signal handlers elsewhere (the kernel stores, the CLI wrapper)
10
+ * used to call `process.exit(0)` synchronously. Node runs signal listeners one
11
+ * after another in the same tick, so that exit pre-empted the owner's async
12
+ * graceful shutdown and leaked the marker. Those handlers now route the
13
+ * request to the claimed owner and do not exit themselves.
14
+ *
15
+ * With no owner claimed (every non-MCP CLI command), nothing changes and
16
+ * callers keep their own exit behaviour.
17
+ *
18
+ * The owner lives on `globalThis` under a registry symbol because `aqe mcp`
19
+ * loads the MCP bundle into the CLI bundle's process. Each bundle has its own
20
+ * copy of this module, and both copies must see the same owner.
21
+ */
22
+ export interface ProcessLifecycleOwner {
23
+ /** Diagnostic name, e.g. `mcp`. */
24
+ readonly name: string;
25
+ /**
26
+ * Start the owner's graceful shutdown. Must be idempotent, must not throw,
27
+ * and must eventually exit the process (e.g. guarded by a watchdog). Before
28
+ * exiting, on every path, it must call `closeRegisteredStores()`.
29
+ */
30
+ shutdown(reason: string): void;
31
+ }
32
+ /**
33
+ * Register a synchronous, idempotent close for a process-wide store (the
34
+ * kernel's unified memory/persistence singletons). A claimed owner closes
35
+ * every registered store at the end of its shutdown, so stores are closed on
36
+ * every termination path, not only the signal ones. Returns an unregister
37
+ * function. Shared across bundle copies through the registry symbol.
38
+ */
39
+ export declare function registerStoreCloser(close: () => void): () => void;
40
+ /**
41
+ * Close every registered store, most recently registered first (a facade is
42
+ * registered after the store it wraps, so it closes first). Synchronous so it
43
+ * also works from a process 'exit' listener; never throws. Closers must be
44
+ * idempotent: this may run from both the shutdown and an exit backstop.
45
+ */
46
+ export declare function closeRegisteredStores(): void;
47
+ /** Make `owner` responsible for every graceful shutdown in this process. */
48
+ export declare function claimProcessLifecycle(owner: ProcessLifecycleOwner): void;
49
+ /** Remove the current owner (only if it is still `owner`, when given). Test seam. */
50
+ export declare function releaseProcessLifecycle(owner?: ProcessLifecycleOwner): void;
51
+ export declare function getProcessLifecycleOwner(): ProcessLifecycleOwner | undefined;
52
+ /**
53
+ * Hand a termination request to the claimed owner.
54
+ *
55
+ * Returns true when an owner accepted it: the caller must then NOT exit the
56
+ * process itself. Returns false when no owner is claimed: the caller keeps its
57
+ * own behaviour.
58
+ */
59
+ export declare function requestOwnedShutdown(reason: string): boolean;
60
+ //# sourceMappingURL=process-lifecycle.d.ts.map
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Agentic QE v3 - Process lifecycle ownership (#801)
3
+ *
4
+ * A long-running entry point (the MCP server) owns process shutdown: before it
5
+ * exits it must drain in-flight work and release native handles. The shared
6
+ * patterns RVF adapter, for example, holds a `patterns.rvf.lock` marker that
7
+ * only its own close() removes.
8
+ *
9
+ * Module-level signal handlers elsewhere (the kernel stores, the CLI wrapper)
10
+ * used to call `process.exit(0)` synchronously. Node runs signal listeners one
11
+ * after another in the same tick, so that exit pre-empted the owner's async
12
+ * graceful shutdown and leaked the marker. Those handlers now route the
13
+ * request to the claimed owner and do not exit themselves.
14
+ *
15
+ * With no owner claimed (every non-MCP CLI command), nothing changes and
16
+ * callers keep their own exit behaviour.
17
+ *
18
+ * The owner lives on `globalThis` under a registry symbol because `aqe mcp`
19
+ * loads the MCP bundle into the CLI bundle's process. Each bundle has its own
20
+ * copy of this module, and both copies must see the same owner.
21
+ */
22
+ const OWNER_KEY = Symbol.for('agentic-qe.process-lifecycle-owner');
23
+ const CLOSERS_KEY = Symbol.for('agentic-qe.process-lifecycle-store-closers');
24
+ function closers() {
25
+ const g = globalThis;
26
+ return (g[CLOSERS_KEY] ??= []);
27
+ }
28
+ /**
29
+ * Register a synchronous, idempotent close for a process-wide store (the
30
+ * kernel's unified memory/persistence singletons). A claimed owner closes
31
+ * every registered store at the end of its shutdown, so stores are closed on
32
+ * every termination path, not only the signal ones. Returns an unregister
33
+ * function. Shared across bundle copies through the registry symbol.
34
+ */
35
+ export function registerStoreCloser(close) {
36
+ closers().push(close);
37
+ return () => {
38
+ const list = closers();
39
+ const at = list.indexOf(close);
40
+ if (at >= 0)
41
+ list.splice(at, 1);
42
+ };
43
+ }
44
+ /**
45
+ * Close every registered store, most recently registered first (a facade is
46
+ * registered after the store it wraps, so it closes first). Synchronous so it
47
+ * also works from a process 'exit' listener; never throws. Closers must be
48
+ * idempotent: this may run from both the shutdown and an exit backstop.
49
+ */
50
+ export function closeRegisteredStores() {
51
+ for (const close of [...closers()].reverse()) {
52
+ try {
53
+ close();
54
+ }
55
+ catch { /* best effort: keep closing the rest */ }
56
+ }
57
+ }
58
+ /** Make `owner` responsible for every graceful shutdown in this process. */
59
+ export function claimProcessLifecycle(owner) {
60
+ globalThis[OWNER_KEY] = owner;
61
+ }
62
+ /** Remove the current owner (only if it is still `owner`, when given). Test seam. */
63
+ export function releaseProcessLifecycle(owner) {
64
+ const g = globalThis;
65
+ if (!owner || g[OWNER_KEY] === owner)
66
+ delete g[OWNER_KEY];
67
+ }
68
+ export function getProcessLifecycleOwner() {
69
+ return globalThis[OWNER_KEY];
70
+ }
71
+ /**
72
+ * Hand a termination request to the claimed owner.
73
+ *
74
+ * Returns true when an owner accepted it: the caller must then NOT exit the
75
+ * process itself. Returns false when no owner is claimed: the caller keeps its
76
+ * own behaviour.
77
+ */
78
+ export function requestOwnedShutdown(reason) {
79
+ const owner = getProcessLifecycleOwner();
80
+ if (!owner)
81
+ return false;
82
+ try {
83
+ owner.shutdown(reason);
84
+ return true;
85
+ }
86
+ catch {
87
+ // A broken owner must not leave the process running: let the caller exit.
88
+ return false;
89
+ }
90
+ }
91
+ //# sourceMappingURL=process-lifecycle.js.map
@@ -15,7 +15,21 @@ export declare const VECTORS_SCHEMA = "\n -- Vector Embeddings (new in v3 - rep
15
15
  export declare const RL_QVALUES_SCHEMA = "\n -- Q-Values for RL algorithms (ADR-046)\n CREATE TABLE IF NOT EXISTS rl_q_values (\n id TEXT PRIMARY KEY,\n algorithm TEXT NOT NULL,\n agent_id TEXT NOT NULL,\n state_key TEXT NOT NULL,\n action_key TEXT NOT NULL,\n q_value REAL NOT NULL DEFAULT 0.0,\n visits INTEGER NOT NULL DEFAULT 0,\n last_reward REAL,\n domain TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n updated_at TEXT DEFAULT (datetime('now')),\n UNIQUE(algorithm, agent_id, state_key, action_key)\n );\n CREATE INDEX IF NOT EXISTS idx_qvalues_agent ON rl_q_values(agent_id);\n CREATE INDEX IF NOT EXISTS idx_qvalues_algorithm ON rl_q_values(algorithm);\n CREATE INDEX IF NOT EXISTS idx_qvalues_state ON rl_q_values(agent_id, state_key);\n CREATE INDEX IF NOT EXISTS idx_qvalues_domain ON rl_q_values(domain);\n CREATE INDEX IF NOT EXISTS idx_qvalues_updated ON rl_q_values(updated_at);\n";
16
16
  export declare const GOAP_SCHEMA = "\n -- GOAP Goals\n CREATE TABLE IF NOT EXISTS goap_goals (\n id TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n description TEXT,\n conditions TEXT NOT NULL,\n priority INTEGER DEFAULT 3,\n qe_domain TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- GOAP Actions\n CREATE TABLE IF NOT EXISTS goap_actions (\n id TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n description TEXT,\n agent_type TEXT NOT NULL,\n preconditions TEXT NOT NULL,\n effects TEXT NOT NULL,\n cost REAL DEFAULT 1.0,\n estimated_duration_ms INTEGER,\n success_rate REAL DEFAULT 1.0,\n execution_count INTEGER DEFAULT 0,\n category TEXT NOT NULL,\n qe_domain TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n updated_at TEXT DEFAULT (datetime('now')),\n -- A14: real domain API method binding (kernel.getDomainAPI(qe_domain)[method](params)).\n -- method/implemented are NULL/0 for actions with no real backing yet \u2014\n -- GOAPExecutor must report those as \"not implemented\", never simulate them.\n method TEXT,\n params TEXT,\n implemented INTEGER DEFAULT 0\n );\n\n -- GOAP Plans\n CREATE TABLE IF NOT EXISTS goap_plans (\n id TEXT PRIMARY KEY,\n goal_id TEXT,\n initial_state TEXT NOT NULL,\n goal_state TEXT NOT NULL,\n action_sequence TEXT NOT NULL,\n total_cost REAL,\n estimated_duration_ms INTEGER,\n status TEXT DEFAULT 'pending',\n reused_from TEXT,\n similarity_score REAL,\n created_at TEXT DEFAULT (datetime('now')),\n executed_at TEXT,\n completed_at TEXT,\n FOREIGN KEY (goal_id) REFERENCES goap_goals(id)\n );\n\n -- Plan Signatures (for similarity matching)\n CREATE TABLE IF NOT EXISTS goap_plan_signatures (\n id TEXT PRIMARY KEY,\n plan_id TEXT NOT NULL UNIQUE,\n goal_hash TEXT NOT NULL,\n state_vector TEXT NOT NULL,\n action_sequence TEXT NOT NULL,\n total_cost REAL NOT NULL,\n success_rate REAL DEFAULT 1.0,\n usage_count INTEGER DEFAULT 0,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- A14: canonical per-step execution history (was previously undefined in\n -- this schema \u2014 plan-executor.ts invented its own parallel\n -- execution_results/executed_steps tables instead). One row per action\n -- step per execution attempt (execution_id groups steps from the same\n -- plan.execute() call, since a plan can be executed/retried more than\n -- once). Aggregate per-execution stats (steps completed/failed, total\n -- duration, final world state) are derived by querying this table rather\n -- than maintained in a separate denormalized summary table.\n CREATE TABLE IF NOT EXISTS goap_execution_steps (\n id TEXT PRIMARY KEY,\n plan_id TEXT NOT NULL,\n execution_id TEXT NOT NULL,\n action_id TEXT NOT NULL,\n step_order INTEGER NOT NULL,\n world_state_before TEXT,\n world_state_after TEXT,\n status TEXT NOT NULL DEFAULT 'pending',\n retries INTEGER DEFAULT 0,\n started_at TEXT,\n duration_ms INTEGER,\n agent_id TEXT,\n agent_output TEXT,\n error_message TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n -- Deliberately no FK to goap_plans/goap_actions: PlanExecutor.execute()\n -- can legitimately run an ad-hoc GOAPPlan/GOAPAction that was never\n -- saved via savePlan()/addAction() (e.g. programmatic orchestration\n -- bypassing the A* planner). unified-memory.ts enables the\n -- foreign_keys pragma, so an enforced FK here would reject that\n -- entirely legitimate usage, not just catch real corruption.\n );\n\n -- GOAP Indexes\n CREATE INDEX IF NOT EXISTS idx_goap_actions_category ON goap_actions(category);\n CREATE INDEX IF NOT EXISTS idx_goap_actions_agent ON goap_actions(agent_type);\n CREATE INDEX IF NOT EXISTS idx_goap_plans_status ON goap_plans(status);\n CREATE INDEX IF NOT EXISTS idx_goap_sig_goal ON goap_plan_signatures(goal_hash);\n CREATE INDEX IF NOT EXISTS idx_goap_exec_steps_plan ON goap_execution_steps(plan_id);\n CREATE INDEX IF NOT EXISTS idx_goap_exec_steps_action ON goap_execution_steps(action_id);\n -- idx_goap_exec_steps_execution is NOT created here: databases with a\n -- pre-existing narrower goap_execution_steps table (missing execution_id)\n -- would fail on \"no such column\" since CREATE TABLE IF NOT EXISTS above\n -- silently no-ops against them. unified-memory.ts's v11 migration creates\n -- this index only after confirming/backfilling the column.\n";
17
17
  export declare const DREAM_SCHEMA = "\n -- Concept Graph Nodes (Dream Engine)\n CREATE TABLE IF NOT EXISTS concept_nodes (\n id TEXT PRIMARY KEY,\n concept_type TEXT NOT NULL,\n content TEXT NOT NULL,\n embedding BLOB,\n activation_level REAL DEFAULT 0.0,\n last_activated TEXT,\n pattern_id TEXT,\n metadata TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- Concept Edges\n CREATE TABLE IF NOT EXISTS concept_edges (\n id TEXT PRIMARY KEY,\n source TEXT NOT NULL,\n target TEXT NOT NULL,\n weight REAL NOT NULL DEFAULT 1.0,\n edge_type TEXT NOT NULL,\n evidence INTEGER DEFAULT 1,\n created_at TEXT DEFAULT (datetime('now')),\n updated_at TEXT DEFAULT (datetime('now')),\n FOREIGN KEY (source) REFERENCES concept_nodes(id) ON DELETE CASCADE,\n FOREIGN KEY (target) REFERENCES concept_nodes(id) ON DELETE CASCADE\n );\n\n -- Dream Cycles\n CREATE TABLE IF NOT EXISTS dream_cycles (\n id TEXT PRIMARY KEY,\n start_time TEXT NOT NULL,\n end_time TEXT,\n duration_ms INTEGER,\n concepts_processed INTEGER DEFAULT 0,\n associations_found INTEGER DEFAULT 0,\n insights_generated INTEGER DEFAULT 0,\n status TEXT DEFAULT 'running',\n error TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- Dream Insights\n CREATE TABLE IF NOT EXISTS dream_insights (\n id TEXT PRIMARY KEY,\n cycle_id TEXT NOT NULL,\n insight_type TEXT NOT NULL,\n source_concepts TEXT NOT NULL,\n description TEXT NOT NULL,\n novelty_score REAL DEFAULT 0.5,\n confidence_score REAL DEFAULT 0.5,\n actionable INTEGER DEFAULT 0,\n applied INTEGER DEFAULT 0,\n suggested_action TEXT,\n pattern_id TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n FOREIGN KEY (cycle_id) REFERENCES dream_cycles(id) ON DELETE CASCADE\n );\n\n -- Dream Indexes\n CREATE INDEX IF NOT EXISTS idx_concept_type ON concept_nodes(concept_type);\n CREATE INDEX IF NOT EXISTS idx_concept_activation ON concept_nodes(activation_level);\n CREATE INDEX IF NOT EXISTS idx_concept_pattern ON concept_nodes(pattern_id);\n CREATE INDEX IF NOT EXISTS idx_edge_source ON concept_edges(source);\n CREATE INDEX IF NOT EXISTS idx_edge_target ON concept_edges(target);\n CREATE INDEX IF NOT EXISTS idx_edge_type ON concept_edges(edge_type);\n CREATE INDEX IF NOT EXISTS idx_edge_weight ON concept_edges(weight DESC);\n CREATE INDEX IF NOT EXISTS idx_insight_cycle ON dream_insights(cycle_id);\n CREATE INDEX IF NOT EXISTS idx_dream_status ON dream_cycles(status);\n";
18
- export declare const QE_PATTERNS_SCHEMA = "\n -- QE Patterns table (unified from sqlite-persistence.ts)\n CREATE TABLE IF NOT EXISTS qe_patterns (\n id TEXT PRIMARY KEY,\n pattern_type TEXT NOT NULL,\n qe_domain TEXT NOT NULL,\n domain TEXT NOT NULL,\n name TEXT NOT NULL,\n description TEXT,\n confidence REAL DEFAULT 0.5,\n usage_count INTEGER DEFAULT 0,\n success_rate REAL DEFAULT 0.0,\n quality_score REAL DEFAULT 0.0,\n tier TEXT DEFAULT 'short-term',\n template_json TEXT,\n context_json TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n updated_at TEXT DEFAULT (datetime('now')),\n last_used_at TEXT,\n successful_uses INTEGER DEFAULT 0,\n tokens_used INTEGER,\n input_tokens INTEGER,\n output_tokens INTEGER,\n latency_ms REAL,\n reusable INTEGER DEFAULT 0,\n reuse_count INTEGER DEFAULT 0,\n average_token_savings REAL DEFAULT 0,\n total_tokens_saved INTEGER\n );\n\n -- Pattern embeddings table (BLOB storage for vectors)\n CREATE TABLE IF NOT EXISTS qe_pattern_embeddings (\n pattern_id TEXT PRIMARY KEY,\n embedding BLOB NOT NULL,\n dimension INTEGER NOT NULL,\n model TEXT DEFAULT 'all-MiniLM-L6-v2',\n space_id TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n FOREIGN KEY (pattern_id) REFERENCES qe_patterns(id) ON DELETE CASCADE\n );\n\n -- Pattern usage history (no FK -- used as analytics log by hooks with synthetic IDs)\n CREATE TABLE IF NOT EXISTS qe_pattern_usage (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n pattern_id TEXT NOT NULL,\n success INTEGER NOT NULL,\n metrics_json TEXT,\n feedback TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- Learning trajectories\n CREATE TABLE IF NOT EXISTS qe_trajectories (\n id TEXT PRIMARY KEY,\n task TEXT NOT NULL,\n agent TEXT,\n domain TEXT,\n started_at TEXT DEFAULT (datetime('now')),\n ended_at TEXT,\n success INTEGER,\n steps_json TEXT,\n metadata_json TEXT\n );\n\n -- Embeddings table (unified from EmbeddingCache.ts)\n -- Renamed from 'embedding_cache' to 'embeddings' to match existing code\n CREATE TABLE IF NOT EXISTS embeddings (\n key TEXT NOT NULL,\n namespace TEXT NOT NULL,\n vector BLOB NOT NULL,\n dimension INTEGER NOT NULL,\n text TEXT NOT NULL,\n timestamp INTEGER NOT NULL,\n quantization TEXT NOT NULL,\n metadata TEXT,\n access_count INTEGER DEFAULT 1,\n last_access INTEGER NOT NULL,\n PRIMARY KEY (key, namespace)\n );\n\n -- Execution results table (unified from plan-executor.ts)\n CREATE TABLE IF NOT EXISTS execution_results (\n id TEXT PRIMARY KEY,\n plan_id TEXT NOT NULL,\n status TEXT NOT NULL,\n steps_completed INTEGER DEFAULT 0,\n steps_failed INTEGER DEFAULT 0,\n total_duration_ms INTEGER DEFAULT 0,\n final_world_state TEXT,\n error_message TEXT,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- Executed steps table (unified from plan-executor.ts)\n CREATE TABLE IF NOT EXISTS executed_steps (\n id TEXT PRIMARY KEY,\n execution_id TEXT NOT NULL,\n plan_id TEXT NOT NULL,\n action_id TEXT NOT NULL,\n step_order INTEGER NOT NULL,\n status TEXT NOT NULL,\n retries INTEGER DEFAULT 0,\n started_at TEXT NOT NULL,\n completed_at TEXT,\n duration_ms INTEGER,\n agent_id TEXT,\n agent_output TEXT,\n world_state_before TEXT,\n world_state_after TEXT,\n error_message TEXT,\n FOREIGN KEY (execution_id) REFERENCES execution_results(id)\n );\n\n -- FTS5 full-text search index for hybrid vector/text search\n CREATE VIRTUAL TABLE IF NOT EXISTS qe_patterns_fts USING fts5(\n name, description, pattern_type, qe_domain,\n content='qe_patterns',\n content_rowid='rowid'\n );\n\n -- FTS5 triggers to keep index in sync\n CREATE TRIGGER IF NOT EXISTS qe_patterns_fts_insert AFTER INSERT ON qe_patterns BEGIN\n INSERT INTO qe_patterns_fts(rowid, name, description, pattern_type, qe_domain)\n VALUES (new.rowid, new.name, new.description, new.pattern_type, new.qe_domain);\n END;\n\n CREATE TRIGGER IF NOT EXISTS qe_patterns_fts_delete AFTER DELETE ON qe_patterns BEGIN\n INSERT INTO qe_patterns_fts(qe_patterns_fts, rowid, name, description, pattern_type, qe_domain)\n VALUES ('delete', old.rowid, old.name, old.description, old.pattern_type, old.qe_domain);\n END;\n\n CREATE TRIGGER IF NOT EXISTS qe_patterns_fts_update AFTER UPDATE ON qe_patterns BEGIN\n INSERT INTO qe_patterns_fts(qe_patterns_fts, rowid, name, description, pattern_type, qe_domain)\n VALUES ('delete', old.rowid, old.name, old.description, old.pattern_type, old.qe_domain);\n INSERT INTO qe_patterns_fts(rowid, name, description, pattern_type, qe_domain)\n VALUES (new.rowid, new.name, new.description, new.pattern_type, new.qe_domain);\n END;\n\n -- QE Patterns indexes\n CREATE INDEX IF NOT EXISTS idx_qe_patterns_domain ON qe_patterns(qe_domain);\n CREATE INDEX IF NOT EXISTS idx_qe_patterns_type ON qe_patterns(pattern_type);\n CREATE INDEX IF NOT EXISTS idx_qe_patterns_tier ON qe_patterns(tier);\n CREATE INDEX IF NOT EXISTS idx_qe_patterns_quality ON qe_patterns(quality_score DESC);\n CREATE INDEX IF NOT EXISTS idx_qe_pattern_embeddings_space ON qe_pattern_embeddings(space_id);\n CREATE INDEX IF NOT EXISTS idx_qe_usage_pattern ON qe_pattern_usage(pattern_id);\n CREATE INDEX IF NOT EXISTS idx_qe_trajectories_domain ON qe_trajectories(domain);\n CREATE INDEX IF NOT EXISTS idx_embeddings_namespace ON embeddings(namespace);\n CREATE INDEX IF NOT EXISTS idx_embeddings_timestamp ON embeddings(timestamp);\n CREATE INDEX IF NOT EXISTS idx_execution_results_plan ON execution_results(plan_id);\n CREATE INDEX IF NOT EXISTS idx_execution_results_status ON execution_results(status);\n CREATE INDEX IF NOT EXISTS idx_executed_steps_execution ON executed_steps(execution_id);\n CREATE INDEX IF NOT EXISTS idx_executed_steps_action ON executed_steps(action_id);\n";
18
+ /** FTS5 external-content index over qe_patterns (hybrid vector/text search). */
19
+ export declare const QE_PATTERNS_FTS_TABLE_DDL = "\n CREATE VIRTUAL TABLE IF NOT EXISTS qe_patterns_fts USING fts5(\n name, description, pattern_type, qe_domain,\n content='qe_patterns',\n content_rowid='rowid'\n );\n";
20
+ /** Sync triggers keeping qe_patterns_fts in step with qe_patterns, keyed by name. */
21
+ export declare const QE_PATTERNS_FTS_TRIGGER_DDL: Readonly<Record<string, string>>;
22
+ /** FTS5 table plus all sync triggers (idempotent). Requires qe_patterns to exist. */
23
+ export declare const QE_PATTERNS_FTS_SCHEMA: string;
24
+ export declare const QE_PATTERNS_SCHEMA: string;
25
+ /**
26
+ * QE_PATTERNS_SCHEMA without the FTS5 table/triggers, for migrations that run
27
+ * after v9 on an existing DB. Re-creating the sync triggers there (with
28
+ * CREATE TRIGGER IF NOT EXISTS, no rebuild) would hide "triggers were missing"
29
+ * from the on-open self-heal, leaving UPDATE-only drift unrepaired; the heal
30
+ * creates any missing FTS objects and rebuilds instead.
31
+ */
32
+ export declare const QE_PATTERNS_SCHEMA_WITHOUT_FTS: string;
19
33
  export declare const MINCUT_SCHEMA = "\n -- MinCut Graph Snapshots (ADR-047)\n CREATE TABLE IF NOT EXISTS mincut_snapshots (\n id TEXT PRIMARY KEY,\n timestamp TEXT NOT NULL DEFAULT (datetime('now')),\n vertex_count INTEGER NOT NULL,\n edge_count INTEGER NOT NULL,\n total_weight REAL NOT NULL DEFAULT 0.0,\n is_connected INTEGER NOT NULL DEFAULT 1,\n component_count INTEGER NOT NULL DEFAULT 1,\n vertices_json TEXT NOT NULL,\n edges_json TEXT NOT NULL,\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- MinCut History (time-series MinCut values)\n CREATE TABLE IF NOT EXISTS mincut_history (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n timestamp TEXT NOT NULL DEFAULT (datetime('now')),\n mincut_value REAL NOT NULL,\n vertex_count INTEGER NOT NULL,\n edge_count INTEGER NOT NULL,\n algorithm TEXT NOT NULL DEFAULT 'weighted-degree',\n duration_ms INTEGER,\n snapshot_id TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n FOREIGN KEY (snapshot_id) REFERENCES mincut_snapshots(id) ON DELETE SET NULL\n );\n\n -- MinCut Weak Vertices (detected bottlenecks)\n CREATE TABLE IF NOT EXISTS mincut_weak_vertices (\n id TEXT PRIMARY KEY,\n vertex_id TEXT NOT NULL,\n weighted_degree REAL NOT NULL,\n risk_score REAL NOT NULL,\n reason TEXT NOT NULL,\n domain TEXT,\n vertex_type TEXT NOT NULL,\n suggestions_json TEXT,\n detected_at TEXT NOT NULL DEFAULT (datetime('now')),\n resolved_at TEXT,\n snapshot_id TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n FOREIGN KEY (snapshot_id) REFERENCES mincut_snapshots(id) ON DELETE SET NULL\n );\n\n -- MinCut Alerts\n CREATE TABLE IF NOT EXISTS mincut_alerts (\n id TEXT PRIMARY KEY,\n severity TEXT NOT NULL,\n message TEXT NOT NULL,\n mincut_value REAL NOT NULL,\n threshold REAL NOT NULL,\n affected_vertices_json TEXT,\n remediations_json TEXT,\n acknowledged INTEGER DEFAULT 0,\n acknowledged_at TEXT,\n acknowledged_by TEXT,\n timestamp TEXT NOT NULL DEFAULT (datetime('now')),\n created_at TEXT DEFAULT (datetime('now'))\n );\n\n -- MinCut Healing Actions (self-healing history)\n CREATE TABLE IF NOT EXISTS mincut_healing_actions (\n id TEXT PRIMARY KEY,\n action_type TEXT NOT NULL,\n action_params_json TEXT NOT NULL,\n success INTEGER NOT NULL,\n mincut_before REAL NOT NULL,\n mincut_after REAL NOT NULL,\n improvement REAL NOT NULL DEFAULT 0.0,\n error_message TEXT,\n duration_ms INTEGER NOT NULL,\n triggered_by TEXT,\n snapshot_before_id TEXT,\n snapshot_after_id TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n FOREIGN KEY (snapshot_before_id) REFERENCES mincut_snapshots(id) ON DELETE SET NULL,\n FOREIGN KEY (snapshot_after_id) REFERENCES mincut_snapshots(id) ON DELETE SET NULL\n );\n\n -- MinCut Strange Loop Observations (P1: self-organizing)\n CREATE TABLE IF NOT EXISTS mincut_observations (\n id TEXT PRIMARY KEY,\n iteration INTEGER NOT NULL,\n mincut_value REAL NOT NULL,\n weak_vertex_count INTEGER NOT NULL DEFAULT 0,\n weak_vertices_json TEXT,\n snapshot_id TEXT,\n prediction_json TEXT,\n actual_vs_predicted_diff REAL,\n timestamp TEXT NOT NULL DEFAULT (datetime('now')),\n FOREIGN KEY (snapshot_id) REFERENCES mincut_snapshots(id) ON DELETE SET NULL\n );\n\n -- MinCut Indexes\n CREATE INDEX IF NOT EXISTS idx_mincut_history_timestamp ON mincut_history(timestamp DESC);\n CREATE INDEX IF NOT EXISTS idx_mincut_history_value ON mincut_history(mincut_value);\n CREATE INDEX IF NOT EXISTS idx_mincut_weak_vertex ON mincut_weak_vertices(vertex_id);\n CREATE INDEX IF NOT EXISTS idx_mincut_weak_risk ON mincut_weak_vertices(risk_score DESC);\n CREATE INDEX IF NOT EXISTS idx_mincut_weak_resolved ON mincut_weak_vertices(resolved_at);\n CREATE INDEX IF NOT EXISTS idx_mincut_alerts_severity ON mincut_alerts(severity);\n CREATE INDEX IF NOT EXISTS idx_mincut_alerts_ack ON mincut_alerts(acknowledged);\n CREATE INDEX IF NOT EXISTS idx_mincut_healing_type ON mincut_healing_actions(action_type);\n CREATE INDEX IF NOT EXISTS idx_mincut_healing_success ON mincut_healing_actions(success);\n CREATE INDEX IF NOT EXISTS idx_mincut_observations_iter ON mincut_observations(iteration);\n";
20
34
  export declare const SONA_PATTERNS_SCHEMA = "\n -- SONA Patterns table (ADR-046: Pattern Persistence for Neural Backbone)\n CREATE TABLE IF NOT EXISTS sona_patterns (\n id TEXT PRIMARY KEY,\n type TEXT NOT NULL,\n domain TEXT NOT NULL,\n state_embedding BLOB,\n action_embedding BLOB,\n action_type TEXT NOT NULL,\n action_value TEXT,\n outcome_reward REAL NOT NULL DEFAULT 0.0,\n outcome_success INTEGER NOT NULL DEFAULT 0,\n outcome_quality REAL NOT NULL DEFAULT 0.0,\n confidence REAL DEFAULT 0.5,\n usage_count INTEGER DEFAULT 0,\n success_count INTEGER DEFAULT 0,\n failure_count INTEGER DEFAULT 0,\n metadata TEXT,\n created_at TEXT DEFAULT (datetime('now')),\n updated_at TEXT DEFAULT (datetime('now')),\n last_used_at TEXT\n );\n CREATE INDEX IF NOT EXISTS idx_sona_patterns_type ON sona_patterns(type);\n CREATE INDEX IF NOT EXISTS idx_sona_patterns_domain ON sona_patterns(domain);\n CREATE INDEX IF NOT EXISTS idx_sona_patterns_confidence ON sona_patterns(confidence DESC);\n CREATE INDEX IF NOT EXISTS idx_sona_patterns_updated ON sona_patterns(updated_at DESC);\n";
21
35
  export declare const WITNESS_CHAIN_SCHEMA = "\n -- Witness Chain (ADR-070: Cryptographic audit trail for QE decisions)\n CREATE TABLE IF NOT EXISTS witness_chain (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n prev_hash TEXT NOT NULL,\n action_hash TEXT NOT NULL,\n action_type TEXT NOT NULL,\n action_data TEXT,\n timestamp TEXT NOT NULL,\n actor TEXT NOT NULL\n );\n CREATE INDEX IF NOT EXISTS idx_witness_action_type ON witness_chain(action_type);\n CREATE INDEX IF NOT EXISTS idx_witness_timestamp ON witness_chain(timestamp);\n";