agentic-qe 3.13.1 → 3.13.3

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 (339) hide show
  1. package/.claude/hooks/aqe-hook.cjs +24 -3
  2. package/.claude/skills/qe-court/SKILL.md +25 -3
  3. package/.claude/skills/qe-court/config.json +1 -1
  4. package/.claude/skills/skills-manifest.json +1 -1
  5. package/CHANGELOG.md +72 -0
  6. package/assets/skills/qe-court/SKILL.md +25 -3
  7. package/assets/skills/qe-court/config.json +1 -1
  8. package/assets/skills/skills-manifest.json +1 -1
  9. package/dist/cli/bundle.js +5 -5
  10. package/dist/cli/chunks/adapter-NIUFP6QX.js +2 -0
  11. package/dist/cli/chunks/{agent-booster-wasm-4VM3DE42.js → agent-booster-wasm-YIGGREZN.js} +2 -2
  12. package/dist/cli/chunks/{agent-handler-ZDLMZQQX.js → agent-handler-64O7R55A.js} +2 -2
  13. package/dist/cli/chunks/{agent-memory-branch-P72MDHHV.js → agent-memory-branch-2ZZBYUP3.js} +2 -2
  14. package/dist/cli/chunks/aqe-learning-engine-DC4DNCPB.js +2 -0
  15. package/dist/cli/chunks/{arena-55FZGKEV.js → arena-6YRNQNCX.js} +4 -4
  16. package/dist/cli/chunks/{arena-GCRBQ26R.js → arena-PF5WL2WM.js} +2 -2
  17. package/dist/cli/chunks/{audit-VYAYVLIV.js → audit-R53FOYCK.js} +3 -3
  18. package/dist/cli/chunks/base-EXD3ULZT.js +2 -0
  19. package/dist/cli/chunks/{hnswlib-node-GMRPPMDM.js → better-sqlite3-OW5HIPEN.js} +2 -2
  20. package/dist/cli/chunks/{brain-handler-IUKMRGWO.js → brain-handler-J4ICUOUX.js} +3 -3
  21. package/dist/cli/chunks/{branch-enumerator-TUI3RWLX.js → branch-enumerator-YVPD43TG.js} +2 -2
  22. package/dist/cli/chunks/{browser-NBQTZYX2.js → browser-TKVHX53S.js} +2 -2
  23. package/dist/cli/chunks/browser-workflow-KOMASCB7.js +2 -0
  24. package/dist/cli/chunks/{chunk-WINA3XUT.js → chunk-22WFXSXB.js} +2 -2
  25. package/dist/cli/chunks/chunk-2BYRQ5MV.js +4 -0
  26. package/dist/cli/chunks/{chunk-ZLCATRXI.js → chunk-2G2XD6EM.js} +2 -2
  27. package/dist/cli/chunks/{chunk-XN2CD5S6.js → chunk-2MLPO3RZ.js} +2 -2
  28. package/dist/cli/chunks/{chunk-2ISLQU3G.js → chunk-2QKSIHXO.js} +1 -1
  29. package/dist/cli/chunks/{chunk-PKMCZFET.js → chunk-33SPAMQZ.js} +2 -2
  30. package/dist/cli/chunks/{chunk-6C3MZLYW.js → chunk-37GCWGXT.js} +2 -2
  31. package/dist/cli/chunks/{chunk-FM272B4O.js → chunk-37I4AMCT.js} +2 -2
  32. package/dist/cli/chunks/{chunk-7D7XFZZI.js → chunk-3CFWNT3F.js} +2 -2
  33. package/dist/cli/chunks/{chunk-TDGE52HJ.js → chunk-3J2QITXC.js} +1 -1
  34. package/dist/cli/chunks/{chunk-YRVUYM62.js → chunk-3NML6POU.js} +2 -2
  35. package/dist/cli/chunks/chunk-46U73TST.js +2 -0
  36. package/dist/cli/chunks/{chunk-XOQQGZFY.js → chunk-4RYU4WMW.js} +1 -1
  37. package/dist/cli/chunks/{chunk-2XZ4BHWS.js → chunk-4Z2AKQP4.js} +1 -1
  38. package/dist/cli/chunks/{chunk-4QMWWYNU.js → chunk-5A5EC5RD.js} +2 -2
  39. package/dist/cli/chunks/{chunk-FRAGSKXQ.js → chunk-5IH22DLD.js} +3 -3
  40. package/dist/cli/chunks/{chunk-OCKTPTQ7.js → chunk-5IVOY76M.js} +2 -2
  41. package/dist/cli/chunks/{chunk-OE4B6LDZ.js → chunk-62F5M5OO.js} +1 -1
  42. package/dist/cli/chunks/{chunk-IBSBOHUX.js → chunk-64C4SS66.js} +2 -2
  43. package/dist/cli/chunks/{chunk-ELMUHNXN.js → chunk-66KIIH6V.js} +2 -2
  44. package/dist/cli/chunks/{chunk-N7WAZ2Y6.js → chunk-6C3PDY72.js} +1 -1
  45. package/dist/cli/chunks/{chunk-UMCEEXQN.js → chunk-6I2L22WS.js} +1 -1
  46. package/dist/cli/chunks/{chunk-MCIO7BDK.js → chunk-6R6QGQ7D.js} +1 -1
  47. package/dist/cli/chunks/{chunk-IJA4WS7B.js → chunk-764G7VK6.js} +1 -1
  48. package/dist/cli/chunks/{chunk-QG6BXSNJ.js → chunk-7AHQ7ROU.js} +2 -2
  49. package/dist/cli/chunks/{chunk-BF5BKSDU.js → chunk-7MBPKAQ3.js} +2 -2
  50. package/dist/cli/chunks/{chunk-MUFYDKVC.js → chunk-7TG7LJAB.js} +2 -2
  51. package/dist/cli/chunks/{chunk-PIOO2M4W.js → chunk-A22RTEJ3.js} +2 -2
  52. package/dist/cli/chunks/{chunk-SXADKQJN.js → chunk-A547LEUW.js} +2 -2
  53. package/dist/cli/chunks/{chunk-JOTNKZ7A.js → chunk-A6J5MAVO.js} +10 -10
  54. package/dist/cli/chunks/{chunk-XFUF654L.js → chunk-ADBTOUOX.js} +1 -1
  55. package/dist/cli/chunks/{chunk-3K4YC3GC.js → chunk-AJ45QR3K.js} +2 -2
  56. package/dist/cli/chunks/{chunk-WWCH5SSF.js → chunk-APXJJRU4.js} +2 -2
  57. package/dist/cli/chunks/{chunk-IJP42OGW.js → chunk-AXXFY7PX.js} +2 -2
  58. package/dist/cli/chunks/{chunk-ZYPESQ4M.js → chunk-B7XZJBMT.js} +2 -2
  59. package/dist/cli/chunks/{chunk-EGMGOWCE.js → chunk-BDOD534O.js} +2 -2
  60. package/dist/cli/chunks/{chunk-LTWT4GZD.js → chunk-C7AXBCMS.js} +4 -4
  61. package/dist/cli/chunks/{chunk-MX5ZDKRR.js → chunk-CBLKYGKT.js} +2 -2
  62. package/dist/cli/chunks/{chunk-NHV4PTG6.js → chunk-CVFUANMU.js} +2 -2
  63. package/dist/cli/chunks/{chunk-WWP2VXYJ.js → chunk-CW7BWFFF.js} +2 -2
  64. package/dist/cli/chunks/{chunk-S6VNPKHO.js → chunk-CXPMA7LY.js} +1 -1
  65. package/dist/cli/chunks/{chunk-UCQ66N6M.js → chunk-DPJLA7JW.js} +2 -2
  66. package/dist/cli/chunks/{chunk-ZH6ZBDVV.js → chunk-DSGKRXHF.js} +1 -1
  67. package/dist/cli/chunks/{chunk-2D2XFUKI.js → chunk-DSUEJK33.js} +2 -2
  68. package/dist/cli/chunks/{chunk-ARTLSAXO.js → chunk-DTOKJKSE.js} +2 -2
  69. package/dist/cli/chunks/{chunk-THFLRJT6.js → chunk-EEG4G5JG.js} +3 -3
  70. package/dist/cli/chunks/{chunk-LSKQUUUN.js → chunk-EMH54CO7.js} +2 -2
  71. package/dist/cli/chunks/{chunk-FDUSWM6O.js → chunk-F6V5POSK.js} +18 -18
  72. package/dist/cli/chunks/{chunk-ZIBW7CB4.js → chunk-FF53QW6C.js} +1 -1
  73. package/dist/cli/chunks/{chunk-ZHEKGB4A.js → chunk-FGIZVGIE.js} +2 -2
  74. package/dist/cli/chunks/{chunk-TQ2MA3SR.js → chunk-GNCGRDQ2.js} +1 -1
  75. package/dist/cli/chunks/{chunk-HFI5PHG5.js → chunk-GSG5FASF.js} +3 -3
  76. package/dist/cli/chunks/{chunk-UJ6TMZC6.js → chunk-GTURQ454.js} +2 -2
  77. package/dist/cli/chunks/{chunk-FQXQJMSF.js → chunk-H2BR5MCX.js} +2 -2
  78. package/dist/cli/chunks/{chunk-7WEHZCSK.js → chunk-H4XZOIV6.js} +2 -2
  79. package/dist/cli/chunks/{chunk-UHKXKWMD.js → chunk-HEF6XKA5.js} +2 -2
  80. package/dist/cli/chunks/{chunk-MPD7RR4P.js → chunk-HJNFXYX4.js} +1 -1
  81. package/dist/cli/chunks/{chunk-S6F3IJMK.js → chunk-HOIH542Y.js} +1 -1
  82. package/dist/cli/chunks/{chunk-GJEEPKAT.js → chunk-IH47VGC7.js} +2 -2
  83. package/dist/cli/chunks/{chunk-DTRFZD7N.js → chunk-IKPBQZQP.js} +2 -2
  84. package/dist/cli/chunks/{chunk-Y734CWHJ.js → chunk-IRX2THND.js} +2 -2
  85. package/dist/cli/chunks/{chunk-YVKMHXQK.js → chunk-IZIYFVAZ.js} +3 -3
  86. package/dist/cli/chunks/{chunk-4WGSMODQ.js → chunk-J5AIMM2J.js} +1 -1
  87. package/dist/cli/chunks/{chunk-KNWDXI3I.js → chunk-J65XQ6WE.js} +2 -2
  88. package/dist/cli/chunks/{chunk-L7IOTWWY.js → chunk-JBWXBDJX.js} +1 -1
  89. package/dist/cli/chunks/{chunk-JAPOMPFD.js → chunk-JG267MVB.js} +2 -2
  90. package/dist/cli/chunks/{chunk-3Y6CHW67.js → chunk-JHOJG5VO.js} +1 -1
  91. package/dist/cli/chunks/{chunk-J4T6D2OQ.js → chunk-JLFU5SCI.js} +2 -2
  92. package/dist/cli/chunks/{chunk-6XZXMEK4.js → chunk-JOHWWTJF.js} +2 -2
  93. package/dist/cli/chunks/{chunk-HUMQU4ES.js → chunk-JQTDNUHA.js} +2 -2
  94. package/dist/cli/chunks/{chunk-WZROSTQZ.js → chunk-K2D3YW2N.js} +1 -1
  95. package/dist/cli/chunks/{chunk-INYS35DV.js → chunk-KBQRYAHZ.js} +2 -2
  96. package/dist/cli/chunks/{chunk-GASOBSNB.js → chunk-KQ5GLUOB.js} +4 -4
  97. package/dist/cli/chunks/{chunk-3KGCBAUH.js → chunk-KQFMCVBH.js} +2 -2
  98. package/dist/cli/chunks/{chunk-A2MG3YXO.js → chunk-L4O2645U.js} +1 -1
  99. package/dist/cli/chunks/{chunk-ZCLFAOVT.js → chunk-LLQG3F4H.js} +2 -2
  100. package/dist/cli/chunks/{chunk-5BB5DUL4.js → chunk-LOZRBK2Z.js} +2 -2
  101. package/dist/cli/chunks/{chunk-YQCAXYBF.js → chunk-LWPCGOQM.js} +2 -2
  102. package/dist/cli/chunks/{chunk-RSCGBHLM.js → chunk-M7XDTQHX.js} +2 -2
  103. package/dist/cli/chunks/{chunk-23MT7OBY.js → chunk-MGKJFO57.js} +2 -2
  104. package/dist/cli/chunks/{chunk-YMMVCOPF.js → chunk-MNEQESQJ.js} +5 -5
  105. package/dist/cli/chunks/{chunk-ZXX2VFMA.js → chunk-MYR6CBXC.js} +2 -2
  106. package/dist/cli/chunks/{chunk-AY7S7AWN.js → chunk-N3KQRDTM.js} +1 -1
  107. package/dist/cli/chunks/{chunk-SS6K4FBH.js → chunk-N4OBRS6S.js} +2 -2
  108. package/dist/cli/chunks/{chunk-2CQAWYYE.js → chunk-N7IRBQ4D.js} +1 -1
  109. package/dist/cli/chunks/{chunk-UHGMS2PJ.js → chunk-NF2N2FIY.js} +1 -1
  110. package/dist/cli/chunks/{chunk-YBPCBFEE.js → chunk-NIA6VTIH.js} +2 -2
  111. package/dist/cli/chunks/{chunk-P4Y3G6OB.js → chunk-NUPAGPN6.js} +2 -2
  112. package/dist/cli/chunks/{chunk-J45DX3IK.js → chunk-OD5R7HRI.js} +1 -1
  113. package/dist/cli/chunks/{chunk-3F4XH4ZA.js → chunk-ORXDKBZC.js} +1 -1
  114. package/dist/cli/chunks/{chunk-MXKHIZVM.js → chunk-OU5CZFBG.js} +3 -3
  115. package/dist/cli/chunks/{chunk-QLOOW23R.js → chunk-OX6WPOGR.js} +3 -3
  116. package/dist/cli/chunks/{chunk-IZO6TPGX.js → chunk-P5CQMDFQ.js} +2 -2
  117. package/dist/cli/chunks/{chunk-DVPGQG4W.js → chunk-PHBGMXTR.js} +2 -2
  118. package/dist/cli/chunks/{chunk-55WDVSCM.js → chunk-PHGOMAIS.js} +2 -2
  119. package/dist/cli/chunks/{chunk-VAJT6QWX.js → chunk-PHNNAIFA.js} +1 -1
  120. package/dist/cli/chunks/{chunk-USUFTHHT.js → chunk-PS32DXYF.js} +3 -3
  121. package/dist/cli/chunks/{chunk-TBQTGQ75.js → chunk-PY55ZD2G.js} +2 -2
  122. package/dist/cli/chunks/{chunk-IMQKEFW6.js → chunk-QFANYWC5.js} +1 -1
  123. package/dist/cli/chunks/{chunk-LSZZQ7H6.js → chunk-QGJYKXUO.js} +1 -1
  124. package/dist/cli/chunks/{chunk-MY47CR27.js → chunk-QP4UKSUJ.js} +2 -2
  125. package/dist/cli/chunks/{chunk-CWXDL7AH.js → chunk-QZ3EIONO.js} +1 -1
  126. package/dist/cli/chunks/{chunk-V32MDID3.js → chunk-QZS3XCU5.js} +2 -2
  127. package/dist/cli/chunks/{chunk-UKBDH27A.js → chunk-RMQRSZB4.js} +1 -1
  128. package/dist/cli/chunks/{chunk-H7YZ2YF2.js → chunk-RRHIEG4Y.js} +2 -2
  129. package/dist/cli/chunks/{chunk-LVHMXGDI.js → chunk-RU23JXCG.js} +3 -3
  130. package/dist/cli/chunks/{chunk-LTKNCYMO.js → chunk-RWPWD5GG.js} +2 -2
  131. package/dist/cli/chunks/{chunk-KW5NBORV.js → chunk-SAMAYDVS.js} +2 -2
  132. package/dist/cli/chunks/{chunk-EAKHU5YX.js → chunk-SJWTNKPY.js} +3 -3
  133. package/dist/cli/chunks/{chunk-XSCOEY4C.js → chunk-SSXCHSVM.js} +2 -2
  134. package/dist/cli/chunks/chunk-T5L65R23.js +2 -0
  135. package/dist/cli/chunks/{chunk-CE6LYEHT.js → chunk-TGVDKSSS.js} +1 -1
  136. package/dist/cli/chunks/{chunk-VLUJWI56.js → chunk-TK6CHESH.js} +1 -1
  137. package/dist/cli/chunks/{chunk-HYIRFJDB.js → chunk-TNM7X2GD.js} +2 -2
  138. package/dist/cli/chunks/{chunk-GOV2MHLV.js → chunk-TRPRFW27.js} +2 -2
  139. package/dist/cli/chunks/{chunk-BOCEOLLJ.js → chunk-TW5QWNT4.js} +2 -2
  140. package/dist/cli/chunks/{chunk-6QKQFHS7.js → chunk-U7DGRHSB.js} +2 -2
  141. package/dist/cli/chunks/{chunk-M3T6FB54.js → chunk-UAXFRKR3.js} +2 -2
  142. package/dist/cli/chunks/{chunk-YLAEIS6F.js → chunk-UF7JKDWB.js} +1 -1
  143. package/dist/cli/chunks/{chunk-OPQY2333.js → chunk-UOJ26GXD.js} +2 -2
  144. package/dist/cli/chunks/{chunk-2OM3TDC4.js → chunk-UWBHR4EZ.js} +1 -1
  145. package/dist/cli/chunks/{chunk-NP4CP3LR.js → chunk-UX434RY5.js} +2 -2
  146. package/dist/cli/chunks/{chunk-CWP4RMOM.js → chunk-V6W4IHS5.js} +2 -2
  147. package/dist/cli/chunks/{chunk-2G2QWV7B.js → chunk-VFZNVJP2.js} +2 -2
  148. package/dist/cli/chunks/{chunk-IV2VCR75.js → chunk-VGWHFFK6.js} +5 -5
  149. package/dist/cli/chunks/{chunk-ORDH4VPL.js → chunk-VKUH57JE.js} +1 -1
  150. package/dist/cli/chunks/{chunk-RZ6CO3RZ.js → chunk-VRTNRI4H.js} +2 -2
  151. package/dist/cli/chunks/{chunk-FQUUMC57.js → chunk-W6OIDL4J.js} +2 -2
  152. package/dist/cli/chunks/{chunk-SHWXADCI.js → chunk-WHUQDBV7.js} +2 -2
  153. package/dist/cli/chunks/{chunk-JELNVHBF.js → chunk-WRC66JTK.js} +1 -1
  154. package/dist/cli/chunks/{chunk-AHTOWWSE.js → chunk-WVWWTRKT.js} +1 -1
  155. package/dist/cli/chunks/{chunk-LJQ27PUE.js → chunk-X737I4SO.js} +1 -1
  156. package/dist/cli/chunks/{chunk-AYYDO52G.js → chunk-XRF5MX4Q.js} +2 -2
  157. package/dist/cli/chunks/{chunk-MAYZTGJ2.js → chunk-XRQGWUDX.js} +2 -2
  158. package/dist/cli/chunks/{chunk-AOMXMFDH.js → chunk-ZI7BWJJW.js} +2 -2
  159. package/dist/cli/chunks/{chunk-SPJQJWGK.js → chunk-ZIYCZZYD.js} +2 -2
  160. package/dist/cli/chunks/{chunk-E4D47QTF.js → chunk-ZLTAAROU.js} +2 -2
  161. package/dist/cli/chunks/{chunk-GTPZVLL6.js → chunk-ZU3XUBDQ.js} +1 -1
  162. package/dist/cli/chunks/{ci-HHL5WQXQ.js → ci-G2NEYLVO.js} +2 -2
  163. package/dist/cli/chunks/{ci-output-HVOJC2KN.js → ci-output-SZFEXGBU.js} +2 -2
  164. package/dist/cli/chunks/{circuit-breaker-HRXMIY2G.js → circuit-breaker-ZD7PJY6N.js} +2 -2
  165. package/dist/cli/chunks/{claude-flow-setup-3I7WVMZN.js → claude-flow-setup-DAVANGUJ.js} +2 -2
  166. package/dist/cli/chunks/client-ZJQMJO5N.js +2 -0
  167. package/dist/cli/chunks/{cline-installer-NBREL4QT.js → cline-installer-WCPKWLY7.js} +2 -2
  168. package/dist/cli/chunks/{code-TX4E2RWU.js → code-324ZJR3V.js} +2 -2
  169. package/dist/cli/chunks/{code-index-extractor-YELOFLSL.js → code-index-extractor-EWVSXJHR.js} +2 -2
  170. package/dist/cli/chunks/{codex-installer-HEX3KFRB.js → codex-installer-HVSZBHH2.js} +2 -2
  171. package/dist/cli/chunks/{completions-72GGFRGG.js → completions-ZAWBZWYK.js} +2 -2
  172. package/dist/cli/chunks/{complexity-analyzer-WRAKDYUK.js → complexity-analyzer-S3H2IRON.js} +2 -2
  173. package/dist/cli/chunks/{continuedev-installer-UGYKSKTI.js → continuedev-installer-4DDFAJ26.js} +2 -2
  174. package/dist/cli/chunks/{copilot-installer-RPCRUKIJ.js → copilot-installer-KBBAL3G5.js} +2 -2
  175. package/dist/cli/chunks/core-handlers-U2YJLH6O.js +2 -0
  176. package/dist/cli/chunks/{cost-tracker-CNHJ7G4M.js → cost-tracker-2YM7SGBW.js} +2 -2
  177. package/dist/cli/chunks/{coverage-RHIQ4XEX.js → coverage-6CCBAORJ.js} +3 -3
  178. package/dist/cli/chunks/cross-domain-router-E7EMKZEK.js +2 -0
  179. package/dist/cli/chunks/{cursor-installer-KSRVA4V2.js → cursor-installer-24DKXNU5.js} +2 -2
  180. package/dist/cli/chunks/{daemon-QBXSJABV.js → daemon-JLF6CRBS.js} +4 -4
  181. package/dist/cli/chunks/{daemon-IT4AAFBW.js → daemon-M2PSDIZF.js} +3 -3
  182. package/dist/cli/chunks/{dag-attention-scheduler-F7WCQTLY.js → dag-attention-scheduler-Y5HSZDRV.js} +2 -2
  183. package/dist/cli/chunks/{detect-2IYU332U.js → detect-6Y227IJ6.js} +2 -2
  184. package/dist/cli/chunks/{dist-node-CIYNYCYN.js → dist-node-EGOJXGTA.js} +2 -2
  185. package/dist/cli/chunks/{domain-handler-QRYQO2QK.js → domain-handler-G3JEWRE5.js} +2 -2
  186. package/dist/cli/chunks/{domain-transfer-2OQDOD3G.js → domain-transfer-XOHI3EMJ.js} +2 -2
  187. package/dist/cli/chunks/dream-ZMNQYBJO.js +2 -0
  188. package/dist/cli/chunks/{embed-and-insert-pattern-P2IFC7JL.js → embed-and-insert-pattern-CSSA55L4.js} +2 -2
  189. package/dist/cli/chunks/{eval-SBPK37IB.js → eval-NHBXOXDV.js} +2 -2
  190. package/dist/cli/chunks/{experience-capture-middleware-3GMFND3F.js → experience-capture-middleware-B7ZDV5UY.js} +3 -3
  191. package/dist/cli/chunks/{fast-paths-4OYYII2F.js → fast-paths-XGKSBALA.js} +2 -2
  192. package/dist/cli/chunks/{feature-flags-BM6QTMMC.js → feature-flags-NBUDJSWJ.js} +2 -2
  193. package/dist/cli/chunks/{feature-flags-NFCAYUWO.js → feature-flags-ZVD73ZYK.js} +2 -2
  194. package/dist/cli/chunks/{file-discovery-2M3ZUAGC.js → file-discovery-C42TEUKT.js} +2 -2
  195. package/dist/cli/chunks/{fleet-QMGGVIDV.js → fleet-LF77P3BW.js} +3 -3
  196. package/dist/cli/chunks/{gnn-wrapper-WGMAGZMO.js → gnn-wrapper-UXNT7BEN.js} +2 -2
  197. package/dist/cli/chunks/{heartbeat-handler-5RSMEZGG.js → heartbeat-handler-C4LMU5LA.js} +4 -4
  198. package/dist/cli/chunks/heartbeat-scheduler-2JL4MAJR.js +2 -0
  199. package/dist/cli/chunks/hnsw-adapter-AZD6O35G.js +2 -0
  200. package/dist/cli/chunks/hnsw-index-WJLE4S5L.js +2 -0
  201. package/dist/cli/chunks/{hnsw-legacy-bridge-TYPQ2T6P.js → hnsw-legacy-bridge-EHHBIWS3.js} +2 -2
  202. package/dist/cli/chunks/{better-sqlite3-JDDFYVCX.js → hnswlib-node-QOULNHXS.js} +2 -2
  203. package/dist/cli/chunks/{hooks-NUC5P3OJ.js → hooks-AGE3HCFI.js} +37 -37
  204. package/dist/cli/chunks/hybrid-router-YTKJBAS2.js +2 -0
  205. package/dist/cli/chunks/{hypergraph-engine-OIB7WK54.js → hypergraph-engine-E5QX5MEB.js} +2 -2
  206. package/dist/cli/chunks/{hypergraph-handler-XX2N75QC.js → hypergraph-handler-ZZHBANYB.js} +3 -3
  207. package/dist/cli/chunks/impact-analyzer-CX56GZXA.js +2 -0
  208. package/dist/cli/chunks/{init-handler-AKSTJMZY.js → init-handler-PNVRBZZT.js} +6 -6
  209. package/dist/cli/chunks/init-wizard-WE6HIC66.js +2 -0
  210. package/dist/cli/chunks/kernel-MT55LNNI.js +2 -0
  211. package/dist/cli/chunks/{kilocode-installer-375V5ZZB.js → kilocode-installer-TR53QKPU.js} +2 -2
  212. package/dist/cli/chunks/{kiro-installer-GKY5GB5Q.js → kiro-installer-MJW6LCAX.js} +2 -2
  213. package/dist/cli/chunks/knowledge-graph-WN3LQ2W7.js +2 -0
  214. package/dist/cli/chunks/{learning-2CQE3QP6.js → learning-6LLGHP2Q.js} +3 -3
  215. package/dist/cli/chunks/{llm-router-FTQNRF45.js → llm-router-DBLV3VGG.js} +4 -4
  216. package/dist/cli/chunks/llm-router-service-NKHEQQMN.js +2 -0
  217. package/dist/cli/chunks/{load-3DBAO5ZG.js → load-LAZ3E5PE.js} +2 -2
  218. package/dist/cli/chunks/load-test-3WIQASDF.js +2 -0
  219. package/dist/cli/chunks/{mcp-AWR6TDXM.js → mcp-L5QXHSEY.js} +2 -2
  220. package/dist/cli/chunks/{memory-GI4LCNXY.js → memory-YR5PCMWA.js} +5 -5
  221. package/dist/cli/chunks/memory-backend-W6YSNT6O.js +2 -0
  222. package/dist/cli/chunks/{memory-handlers-MALKG7GP.js → memory-handlers-BSRTZQYR.js} +2 -2
  223. package/dist/cli/chunks/{multi-model-executor-SWFT5U72.js → multi-model-executor-RECZ3ACW.js} +2 -2
  224. package/dist/cli/chunks/{opencode-installer-EYXGYJX5.js → opencode-installer-4TDUB7HH.js} +2 -2
  225. package/dist/cli/chunks/{orchestrator-MP3EAZVC.js → orchestrator-PHDKJ5C4.js} +5 -5
  226. package/dist/cli/chunks/pattern-null-store-IV3ZESTR.js +2 -0
  227. package/dist/cli/chunks/{pattern-usage-recorder-25P3R3W7.js → pattern-usage-recorder-QK2FADRS.js} +2 -2
  228. package/dist/cli/chunks/{pipeline-LSAFL25D.js → pipeline-JQJYSN43.js} +2 -2
  229. package/dist/cli/chunks/{platform-IJ6DJ2PG.js → platform-FA5TOPTH.js} +2 -2
  230. package/dist/cli/chunks/{plugin-OXOZRZW2.js → plugin-766MBGK6.js} +2 -2
  231. package/dist/cli/chunks/{prime-radiant-advanced-wasm-HJNJQQ3R.js → prime-radiant-advanced-wasm-XQERZNSK.js} +2 -2
  232. package/dist/cli/chunks/protocol-executor-GFAG5G6K.js +2 -0
  233. package/dist/cli/chunks/{protocol-handler-TCMUH2HL.js → protocol-handler-FAK4MMNA.js} +2 -2
  234. package/dist/cli/chunks/{prove-ADXQ2GOX.js → prove-HYBVXOGW.js} +2 -2
  235. package/dist/cli/chunks/provider-manager-TIVIJIYH.js +2 -0
  236. package/dist/cli/chunks/qe-reasoning-bank-BYE7YF6Y.js +2 -0
  237. package/dist/cli/chunks/{quality-EWP36ORX.js → quality-EGSO2RAX.js} +2 -2
  238. package/dist/cli/chunks/{quality-gate-3BIG7PVU.js → quality-gate-RK32VMO7.js} +3 -3
  239. package/dist/cli/chunks/queen-coordinator-WOHYVV7A.js +2 -0
  240. package/dist/cli/chunks/{real-embeddings-D4NBT7W5.js → real-embeddings-GI7CRHE2.js} +2 -2
  241. package/dist/cli/chunks/{roocode-installer-DOPWH6YV.js → roocode-installer-BS3XWJJI.js} +2 -2
  242. package/dist/cli/chunks/router-VUW2UVCN.js +2 -0
  243. package/dist/cli/chunks/routing-feedback-WSUQMZAK.js +2 -0
  244. package/dist/cli/chunks/{routing-handler-5ADEFOHS.js → routing-handler-XMGRJDHH.js} +2 -2
  245. package/dist/cli/chunks/{ruvector-commands-PLMEIHSN.js → ruvector-commands-NDL3ONNC.js} +2 -2
  246. package/dist/cli/chunks/{rvf-dual-writer-EQWKVNQB.js → rvf-dual-writer-XAJOYGJ2.js} +2 -2
  247. package/dist/cli/chunks/{rvf-migration-adapter-2OWFUUCG.js → rvf-migration-adapter-WXFRZZ26.js} +2 -2
  248. package/dist/cli/chunks/{rvf-migration-coordinator-URAETAPU.js → rvf-migration-coordinator-WFXA2VUQ.js} +2 -2
  249. package/dist/cli/chunks/rvf-native-adapter-RHZCXVN6.js +2 -0
  250. package/dist/cli/chunks/{rvf-store-integrity-4AWPW4TF.js → rvf-store-integrity-I7PFJZCK.js} +2 -2
  251. package/dist/cli/chunks/safe-db-NTWEW7ZM.js +2 -0
  252. package/dist/cli/chunks/schedule-WEVC2GW2.js +2 -0
  253. package/dist/cli/chunks/scheduler-XHI5AJIS.js +2 -0
  254. package/dist/cli/chunks/{security-HDLZVM62.js → security-H3WY76GF.js} +3 -3
  255. package/dist/cli/chunks/{shared-rvf-adapter-YQT7PF7X.js → shared-rvf-adapter-GRTJCLW6.js} +2 -2
  256. package/dist/cli/chunks/{shared-rvf-dual-writer-N5D3NSJ7.js → shared-rvf-dual-writer-46XE5R2B.js} +2 -2
  257. package/dist/cli/chunks/sqlite-persistence-QZUPKMHP.js +2 -0
  258. package/dist/cli/chunks/{status-handler-KLYRJ2MR.js → status-handler-VUIFMY4F.js} +2 -2
  259. package/dist/cli/chunks/{structural-health-6LKVRP6Y.js → structural-health-I7HC477E.js} +2 -2
  260. package/dist/cli/chunks/{sync-YYOW6L6W.js → sync-M6LUV5R4.js} +2 -2
  261. package/dist/cli/chunks/{sync-7VMFPBVB.js → sync-RO2YGMBF.js} +2 -2
  262. package/dist/cli/chunks/{task-handler-RKQDGFN2.js → task-handler-BJJTZ7AU.js} +2 -2
  263. package/dist/cli/chunks/{task-handlers-6YJ4QTEP.js → task-handlers-B6S4NEN3.js} +3 -3
  264. package/dist/cli/chunks/{test-ASPUIUJH.js → test-BE7EM6Y6.js} +4 -4
  265. package/dist/cli/chunks/{test-scheduling-I7ABQBBU.js → test-scheduling-4ISKEFR6.js} +3 -3
  266. package/dist/cli/chunks/{token-bootstrap-2XZBTODN.js → token-bootstrap-BOIYBZHW.js} +2 -2
  267. package/dist/cli/chunks/{token-usage-TMUE6PTF.js → token-usage-6ZZC7RLT.js} +2 -2
  268. package/dist/cli/chunks/{transformers-FDHHH4SL.js → transformers-55VI4OGW.js} +2 -2
  269. package/dist/cli/chunks/{tree-sitter-wasm-parser-G7PGZA5C.js → tree-sitter-wasm-parser-6GRRGB3K.js} +2 -2
  270. package/dist/cli/chunks/{types-JGT57UFP.js → types-SXDF7QQT.js} +2 -2
  271. package/dist/cli/chunks/unified-memory-QKWUSEBV.js +2 -0
  272. package/dist/cli/chunks/unified-memory-hnsw-Z2UQZRTK.js +2 -0
  273. package/dist/cli/chunks/unified-persistence-AVK2NSMI.js +2 -0
  274. package/dist/cli/chunks/{upgrade-V6UQODJF.js → upgrade-PMPB7NGB.js} +2 -2
  275. package/dist/cli/chunks/{validate-UBZAE5RW.js → validate-G37QKKXK.js} +2 -2
  276. package/dist/cli/chunks/{validate-swarm-TSO2MI5X.js → validate-swarm-6X22J3VD.js} +2 -2
  277. package/dist/cli/chunks/{vibium-7G3VYSQA.js → vibium-SGBJKHQL.js} +2 -2
  278. package/dist/cli/chunks/visual-security-64UFH23G.js +2 -0
  279. package/dist/cli/chunks/{web-tree-sitter-MIYJSF2L.js → web-tree-sitter-S46Y5BUJ.js} +2 -2
  280. package/dist/cli/chunks/{windsurf-installer-5TLZSQIJ.js → windsurf-installer-PTYCETNM.js} +2 -2
  281. package/dist/cli/chunks/{witness-chain-LTV7H2HM.js → witness-chain-5SCRFT2K.js} +2 -2
  282. package/dist/cli/chunks/witness-chain-ZIVSDX6C.js +2 -0
  283. package/dist/cli/chunks/{witness-key-manager-PAJ2J4AL.js → witness-key-manager-XIAMRVUZ.js} +2 -2
  284. package/dist/cli/chunks/{workflow-DL3ESR2H.js → workflow-BPQA2NAI.js} +4 -4
  285. package/dist/cli/chunks/workflow-orchestrator-TYP4MI2V.js +2 -0
  286. package/dist/cli/chunks/{wrappers-5HSU665E.js → wrappers-IWZZZOAU.js} +2 -2
  287. package/dist/cli/commands/hooks-handlers/hooks-shared.d.ts +9 -0
  288. package/dist/cli/commands/hooks-handlers/hooks-shared.js +38 -0
  289. package/dist/cli/commands/hooks.d.ts +2 -2
  290. package/dist/cli/commands/hooks.js +8 -2
  291. package/dist/coordination/handlers/coverage-collection.js +6 -2
  292. package/dist/coordination/queen-coordinator.js +4 -3
  293. package/dist/integrations/ruvector/rvf-store-integrity.js +5 -1
  294. package/dist/integrations/ruvector/shared-rvf-adapter.js +5 -5
  295. package/dist/mcp/bundle.js +211 -209
  296. package/dist/shared/safe-db.js +60 -1
  297. package/dist/skills/qe-court/referee.d.ts +44 -0
  298. package/dist/skills/qe-court/referee.js +31 -2
  299. package/package.json +1 -1
  300. package/dist/cli/chunks/adapter-VRZNL53W.js +0 -2
  301. package/dist/cli/chunks/aqe-learning-engine-XCNMNERX.js +0 -2
  302. package/dist/cli/chunks/base-VZZNR4UR.js +0 -2
  303. package/dist/cli/chunks/browser-workflow-5DZNIFUY.js +0 -2
  304. package/dist/cli/chunks/chunk-BBLWZT5I.js +0 -2
  305. package/dist/cli/chunks/chunk-EVDYFGVH.js +0 -2
  306. package/dist/cli/chunks/chunk-QES4QHQW.js +0 -2
  307. package/dist/cli/chunks/client-EY2IYQDL.js +0 -2
  308. package/dist/cli/chunks/core-handlers-G4GLA4DT.js +0 -2
  309. package/dist/cli/chunks/cross-domain-router-P3K4IH5H.js +0 -2
  310. package/dist/cli/chunks/dream-IT4ZQGEO.js +0 -2
  311. package/dist/cli/chunks/heartbeat-scheduler-UUWSPHF2.js +0 -2
  312. package/dist/cli/chunks/hnsw-adapter-YUJVSFPD.js +0 -2
  313. package/dist/cli/chunks/hnsw-index-FQZ47RSJ.js +0 -2
  314. package/dist/cli/chunks/hybrid-router-T5MF73NF.js +0 -2
  315. package/dist/cli/chunks/impact-analyzer-AEGELYMD.js +0 -2
  316. package/dist/cli/chunks/init-wizard-WKX3OGWM.js +0 -2
  317. package/dist/cli/chunks/kernel-5CVWFIGR.js +0 -2
  318. package/dist/cli/chunks/knowledge-graph-EGPMNDMT.js +0 -2
  319. package/dist/cli/chunks/llm-router-service-H4LXOARB.js +0 -2
  320. package/dist/cli/chunks/load-test-OOOGITSN.js +0 -2
  321. package/dist/cli/chunks/memory-backend-O2YOT4LW.js +0 -2
  322. package/dist/cli/chunks/pattern-null-store-WBOHE2XL.js +0 -2
  323. package/dist/cli/chunks/protocol-executor-JCNTPW5J.js +0 -2
  324. package/dist/cli/chunks/provider-manager-LPGQ5GOO.js +0 -2
  325. package/dist/cli/chunks/qe-reasoning-bank-FWVYVSPP.js +0 -2
  326. package/dist/cli/chunks/queen-coordinator-UXNALRVD.js +0 -2
  327. package/dist/cli/chunks/router-C6LUIQYY.js +0 -2
  328. package/dist/cli/chunks/routing-feedback-KMSGGDVD.js +0 -2
  329. package/dist/cli/chunks/rvf-native-adapter-K54BELUE.js +0 -2
  330. package/dist/cli/chunks/safe-db-NGOZWF2D.js +0 -2
  331. package/dist/cli/chunks/schedule-B3Y5P64E.js +0 -2
  332. package/dist/cli/chunks/scheduler-Z6QVRMTB.js +0 -2
  333. package/dist/cli/chunks/sqlite-persistence-PLOUGATS.js +0 -2
  334. package/dist/cli/chunks/unified-memory-P5YVLMFI.js +0 -2
  335. package/dist/cli/chunks/unified-memory-hnsw-7HI43A2O.js +0 -2
  336. package/dist/cli/chunks/unified-persistence-U26YP3N3.js +0 -2
  337. package/dist/cli/chunks/visual-security-6FCDY5FF.js +0 -2
  338. package/dist/cli/chunks/witness-chain-I3K3WQID.js +0 -2
  339. package/dist/cli/chunks/workflow-orchestrator-MAALP4WA.js +0 -2
@@ -1,5 +1,5 @@
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.13.1");process.exit(0)}
2
- import{a as N,b as P,c as j,d as S,e as Y,f as T,g as V,h as C,i as J,j as Z,k as U,l as he,m as M,n as ee,o as we,p as _,q as W,r as z,s as H}from"./chunk-GJEEPKAT.js";import{h as be}from"./chunk-IBSBOHUX.js";import{b as ye}from"./chunk-KW5NBORV.js";import"./chunk-UCQ66N6M.js";import"./chunk-WWP2VXYJ.js";import"./chunk-SHWXADCI.js";import"./chunk-BBLWZT5I.js";import"./chunk-ELMUHNXN.js";import"./chunk-YBPCBFEE.js";import{b as x,d as X}from"./chunk-ZLCATRXI.js";import{a as ue,b as pe,c as ge,d as k,f as Ke}from"./chunk-55WDVSCM.js";import"./chunk-AYYDO52G.js";import{a as A,b as He}from"./chunk-EVDYFGVH.js";import"./chunk-IZO6TPGX.js";import"./chunk-CWP4RMOM.js";import"./chunk-3K4YC3GC.js";import"./chunk-NP4CP3LR.js";import"./chunk-DVPGQG4W.js";import"./chunk-7WEHZCSK.js";import"./chunk-UJ6TMZC6.js";import"./chunk-IJP42OGW.js";import"./chunk-OE4B6LDZ.js";import B from"path";import o from"chalk";He();X();import{existsSync as K,mkdirSync as Ge,writeFileSync as Qe,readFileSync as ne}from"fs";import{join as E,resolve as te}from"path";var Xe={rl_q_values:"includeQValues",dream_insights:"includeDreamInsights",dream_cycles:"includeDreamInsights",witness_chain:"includeWitnessChain",vectors:"includeVectors"};function Ye(e,n){let r=Xe[e.tableName];return!(r&&n[r]===!1)}var Ze=1e4;function en(e,n,r,t){if(!Ye(n,r))return ee(E(t,n.fileName),[]),{count:0,rows:[]};let[a,i]=n.domainColumn?M(r.domains,n.domainColumn):[void 0,[]];if(Z(e,n.tableName,a,i)>=Ze){let l=n.blobColumns,f=l&&l.length>0?y=>T(y,l):void 0;return{count:we(E(t,n.fileName),he(e,n.tableName,a,i),f)}}let s=U(e,n.tableName,a,i);return n.blobColumns&&n.blobColumns.length>0&&(s=s.map(l=>T(l,n.blobColumns))),ee(E(t,n.fileName),s),{count:s.length,rows:s}}function ve(e){let n=[];for(let r of S){let t=E(e,r.fileName);K(t)?n.push(C(ne(t,"utf-8"))):n.push(C(""))}return C(n.join(":"))}function Re(e,n,r="memory.db"){let t=te(n.outputPath);K(t)||Ge(t,{recursive:!0});let a=0,i={},d=new Set;for(let u of S){let y=en(e,u,n,t);if(i[u.tableName]=y.count,a+=y.count,u.tableName==="qe_patterns"){if(y.rows)for(let c of y.rows)c.qe_domain&&d.add(c.qe_domain);else if(y.count>0){let[c,w]=u.domainColumn?M(n.domains,u.domainColumn):[void 0,[]],p=`SELECT DISTINCT qe_domain FROM qe_patterns ${c?`WHERE ${c} AND qe_domain IS NOT NULL`:"WHERE qe_domain IS NOT NULL"}`;try{let g=e.prepare(p).all(...w||[]);for(let v of g)d.add(v.qe_domain)}catch{}}}}let s=n.includeVectors!==!1?Z(e,"vectors"):0,l=ve(t),f={version:"3.0",exportedAt:new Date().toISOString(),sourceDb:r,stats:{patternCount:i.qe_patterns||0,vectorCount:s,qValueCount:i.rl_q_values||0,dreamInsightCount:i.dream_insights||0,witnessChainLength:i.witness_chain||0,totalRecords:a},domains:[...d].sort(),checksum:l,tableRecordCounts:i};return Qe(E(t,"manifest.json"),JSON.stringify(f,null,2),"utf-8"),f}var nn=new Set(["qe_patterns","rl_q_values","dream_insights","witness_chain"]);function tn(e){return e==="1.0"?S.filter(n=>nn.has(n.tableName)):e==="3.0"?S:(console.warn(`[brain-import] Unknown manifest version '${e}'. Attempting full import \u2014 some files may be missing.`),S)}function Se(e,n,r){let t=te(n),a=E(t,"manifest.json");if(!K(a))throw new Error(`Manifest not found at ${a}`);let i=x(ne(a,"utf-8")),d=ve(t);if(d!==i.checksum)throw new Error(`Checksum mismatch: expected ${i.checksum}, got ${d}. The export may have been tampered with or corrupted.`);let s=tn(i.version);if(r.dryRun){let c=0;for(let w of s){let m=_(E(t,w.fileName),x);c+=m.length}return{imported:c,skipped:0,conflicts:0}}H(e);let l=0,f=0,u=0;return e.transaction(()=>{for(let c of s){let w=E(t,c.fileName),m=_(w,x);c.blobColumns&&c.blobColumns.length>0&&(m=m.map(p=>V(p,c.blobColumns)));for(let p of m){let g;if(c.dedupColumns&&c.dedupColumns.length>0)g=z(e,c.tableName,p,c.dedupColumns);else{let v=N[c.tableName]||"id",h=j[c.tableName],I=P[c.tableName];g=W(e,c.tableName,p,v,r.mergeStrategy,h,I)}l+=g.imported,f+=g.skipped,u+=g.conflicts}}})(),{imported:l,skipped:f,conflicts:u}}function xe(e){let n=te(e),r=E(n,"manifest.json");if(!K(r))throw new Error(`Manifest not found at ${r}`);return x(ne(r,"utf-8"))}Ke();import{existsSync as q,readdirSync as rn,renameSync as on,statSync as an,unlinkSync as re,writeFileSync as sn}from"fs";import{basename as ln,dirname as dn,join as cn,resolve as oe}from"path";var Ee=["",".idmap.json",".manifest.json"],fn=[...Ee,".lock"];function Ce(e){for(let n of fn)try{let r=`${e}${n}`;q(r)&&re(r)}catch{}}function mn(e){let n=dn(e),r=`${ln(e)}.tmp.`,t;try{t=rn(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&&un(i)))try{re(cn(n,a))}catch{}}}function un(e){try{return process.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function Be(e,n,r="memory.db"){if(!k())throw new Error("@ruvector/rvf-node is not available. Install it or use --format jsonl instead.");let t=oe(n.outputPath),a=n.dimension??384,i=`${t}.tmp.${process.pid}`;mn(t),Ce(i);let d=ue(i,a),s=!1;try{let l={},f=new Set,u=0;for(let R of S){let[b,O]=R.domainColumn?M(n.domains,R.domainColumn):[void 0,[]],$=U(e,R.tableName,b,O);if(R.tableName==="qe_patterns")for(let L of $)L.qe_domain&&f.add(L.qe_domain);let Q=Y[R.tableName];Q&&Q.length>0&&($=$.map(L=>T(L,Q))),l[R.tableName]=$,u+=$.length}let y=0,c=[];if(J(e,"qe_pattern_embeddings")){let R=e.prepare("SELECT pattern_id, embedding, dimension FROM qe_pattern_embeddings").all();for(let b of R)b.embedding&&b.dimension===a&&c.push({id:`pe:${b.pattern_id}`,vector:new Float32Array(b.embedding.buffer,b.embedding.byteOffset,a),metadata:{tableName:"qe_pattern_embeddings"}})}if(J(e,"captured_experiences")){let R=e.prepare("SELECT id, embedding, embedding_dimension, domain, quality FROM captured_experiences WHERE embedding IS NOT NULL").all();for(let b of R)b.embedding_dimension===a&&c.push({id:`exp:${b.id}`,vector:new Float32Array(b.embedding.buffer,b.embedding.byteOffset,a),metadata:{tableName:"captured_experiences",domain:b.domain,confidence:b.quality}})}if(J(e,"sona_patterns")){let R=e.prepare("SELECT id, state_embedding, domain, confidence FROM sona_patterns WHERE state_embedding IS NOT NULL").all();for(let b of R)b.state_embedding.byteLength/4===a&&c.push({id:`sona:${b.id}`,vector:new Float32Array(b.state_embedding.buffer,b.state_embedding.byteOffset,a),metadata:{tableName:"sona_patterns",domain:b.domain,confidence:b.confidence}})}c.length>0&&(y=d.ingest(c).accepted);let w={version:"3.0",format:"rvf",exportedAt:new Date().toISOString(),sourceDb:r,domains:[...f].sort(),tables:l},m=JSON.stringify(w),p=C(m),g=Buffer.from(m);d.embedKernel(g);let v=n.sign?d.sign(g)??void 0:void 0,h=v?n.signerKeyId??"default":void 0,I=d.fileId(),F=I?{fileId:I,parentId:d.parentId(),lineageDepth:d.lineageDepth()}:void 0,D=d.status(),me={version:"3.0",format:"rvf",exportedAt:w.exportedAt,sourceDb:r,stats:{patternCount:(l.qe_patterns||[]).length,embeddingCount:y,qValueCount:(l.rl_q_values||[]).length,dreamInsightCount:(l.dream_insights||[]).length,witnessChainLength:(l.witness_chain||[]).length,totalRecords:u},domains:w.domains,checksum:p,rvfStatus:{totalVectors:D.totalVectors,totalSegments:D.totalSegments,fileSizeBytes:D.fileSizeBytes},...v?{signature:v,signerKeyId:h}:{},...F?{lineage:F}:{}};if(v)try{d.freeze()}catch{}sn(`${i}.manifest.json`,JSON.stringify(me,null,2),"utf-8"),d.close(),s=!0;for(let R of[...Ee].reverse()){let b=`${i}${R}`,O=`${t}${R}`;q(b)?on(b,O):q(O)&&re(O)}return me}catch(l){if(!s)try{d.close()}catch{}throw Ce(i),l}}var pn={patterns:"qe_patterns",qValues:"rl_q_values",dreamInsights:"dream_insights",witnessChain:"witness_chain"};function _e(e,n,r){if(!k())throw new Error("@ruvector/rvf-node is not available. Install it or use JSONL format.");let t=oe(n);if(!q(t))throw new Error(`RVF file not found: ${t}`);let a=pe(t);try{let i=a.verifyWitness();if(!i.valid&&(i.totalEntries>0||i.errors.length>0)){let m=i.errors.length>0?i.errors.join("; "):"unknown integrity error";throw new Error(`RVF witness verification failed: ${m}`)}let d=a.extractKernel();if(!d||!d.image)throw new Error("No brain data found in RVF file (missing kernel segment)");let s;try{s=JSON.parse(d.image.toString("utf-8"))}catch(m){throw new Error(`Failed to parse brain kernel data as JSON: ${m instanceof Error?m.message:m}`)}if(r.dryRun){let m=0;if(s.tables)for(let p of Object.values(s.tables))m+=p?.length??0;else m=(s.patterns?.length??0)+(s.qValues?.length??0)+(s.dreamInsights?.length??0)+(s.witnessChain?.length??0);return{imported:m,skipped:0,conflicts:0,embeddingsRestored:0}}H(e);let l=0,f=0,u=0,y=0,c={};if(s.tables)Object.assign(c,s.tables);else for(let[m,p]of Object.entries(pn)){let g=s[m];Array.isArray(g)&&(c[p]=g)}if(e.transaction(()=>{for(let m of S){let p=c[m.tableName];if(!p||!Array.isArray(p))continue;let g=Y[m.tableName];if(g&&g.length>0){p=p.map(v=>V(v,g));for(let v of p)for(let h of g)v[h]instanceof Buffer&&y++}for(let v of p){let h;if(m.dedupColumns&&m.dedupColumns.length>0)h=z(e,m.tableName,v,m.dedupColumns);else{let I=N[m.tableName]||"id",F=j[m.tableName],D=P[m.tableName];h=W(e,m.tableName,v,I,r.mergeStrategy,F,D)}l+=h.imported,f+=h.skipped,u+=h.conflicts}}})(),u>0)try{a.compact()}catch{}return{imported:l,skipped:f,conflicts:u,embeddingsRestored:y}}finally{a.close()}}function G(e){if(!k())throw new Error("@ruvector/rvf-node is not available.");let n=oe(e);if(!q(n))throw new Error(`RVF file not found: ${n}`);let r=ge(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(w){throw new Error(`Failed to parse brain kernel data as JSON: ${w instanceof Error?w.message:w}`)}let d=r.status(),s=an(n).size,l=i.tables,f=l?l.qe_patterns?.length??0:i.patterns?.length??0,u=l?l.rl_q_values?.length??0:i.qValues?.length??0,y=l?l.dream_insights?.length??0:i.dreamInsights?.length??0,c=l?l.witness_chain?.length??0:i.witnessChain?.length??0;return{version:"3.0",format:"rvf",exportedAt:i.exportedAt??"unknown",sourceDb:i.sourceDb??"unknown",stats:{patternCount:f,embeddingCount:d.totalVectors,qValueCount:u,dreamInsightCount:y,witnessChainLength:c},domains:i.domains??[],checksum:C(a),rvfStatus:{totalVectors:d.totalVectors,totalSegments:d.totalSegments,fileSizeBytes:s}}}finally{r.close()}}function ae(){return k()}X();import{existsSync as se,readFileSync as gn,statSync as yn}from"fs";import{join as ie,resolve as Ie}from"path";function De(e,n,r={}){let t=Ie(e),a=Ie(n),i=Oe(t),d=Oe(a),s=Ae(t,i),l=Ae(a,d),f=i==="jsonl"&&d==="jsonl",u=wn({pathA:t,pathB:a,manifestA:s,manifestB:l,recordLevel:f,tableFilter:r.tableFilter,maxIdsPerBucket:r.maxIdsPerBucket??500}),y=new Set(s.domains),c=new Set(l.domains),w=s.domains.filter(h=>!c.has(h)),m=l.domains.filter(h=>!y.has(h)),p=s.checksum===l.checksum,g=s.version===l.version,v=p&&g&&u.every(h=>h.delta===0&&(h.added?.length??0)===0&&(h.removed?.length??0)===0&&(h.changed?.length??0)===0);return{pathA:t,pathB:a,formatA:i,formatB:d,manifestA:s,manifestB:l,checksumMatch:p,versionMatch:g,identical:v,recordLevel:f,tableDiffs:u,domainsOnlyInA:w,domainsOnlyInB:m}}function Oe(e){if(!se(e))throw new Error(`Path not found: ${e}`);if(e.endsWith(".rvf"))return"rvf";if(yn(e).isFile())throw new Error(`Unsupported brain export: ${e} (expected a .rvf file or a JSONL directory)`);return"jsonl"}function Ae(e,n){return n==="rvf"?hn(e):bn(e)}function bn(e){let n=ie(e,"manifest.json");if(!se(n))throw new Error(`Manifest not found at ${n}`);let r=x(gn(n,"utf-8"));return $e(r,"jsonl")}function hn(e){let n=G(e);return $e(n,"rvf")}function $e(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 wn(e){let n=e.tableFilter?S.filter(t=>t.tableName===e.tableFilter):S;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,d=i-a,s,l,f;if(e.recordLevel&&vn(t)){let u=Rn(ie(e.pathA,t.fileName),ie(e.pathB,t.fileName),t,e.maxIdsPerBucket);s=u.added,l=u.removed,f=u.changed}r.push({tableName:t.tableName,countA:a,countB:i,delta:d,...s!==void 0?{added:s}:{},...l!==void 0?{removed:l}:{},...f!==void 0?{changed:f}:{}})}return r}function vn(e){return!0}function Rn(e,n,r,t){let a=Ne(e,r),i=Ne(n,r),d=[],s=[],l=[];for(let[f,u]of a){let y=i.get(f);if(y===void 0)s.length<t&&s.push(f);else if(y!==u){if(r.dedupColumns&&r.dedupColumns.length>0)continue;l.length<t&&l.push(f)}}for(let f of i.keys())a.has(f)||d.length<t&&d.push(f);return d.sort(),s.sort(),l.sort(),{added:d,removed:s,changed:l}}function Ne(e,n){let r=new Map;if(!se(e))return r;let t=_(e,x);for(let a of t){let i=Sn(a,n);if(i===void 0)continue;let d=xn(a);r.set(i,Cn(d))}return r}function Sn(e,n){if(n.dedupColumns&&n.dedupColumns.length>0){let a=[];for(let i of n.dedupColumns){let d=e[i];if(d==null)return;a.push(String(d))}return a.join("")}let r=N[n.tableName]??"id",t=e[r];if(t!=null)return String(t)}function xn(e){let n=Object.keys(e).sort(),r={};for(let t of n)r[t]=e[t];return JSON.stringify(r)}function Cn(e){return C(e)}X();import{existsSync as le,statSync as En}from"fs";import{join as ke,resolve as Bn}from"path";var _n=20,In="qe_patterns";function Te(e,n={}){let r=Bn(e);Nn(r);let t=n.table??In,a=S.find(g=>g.tableName===t);if(!a)throw new Error(`Unknown table: ${t}`);let i=ke(r,a.fileName);if(!le(i))throw new Error(`Table file not found: ${a.fileName} (expected in ${r}). Was this export generated with --format jsonl?`);let d=_(i,x),s=a.domainColumn,l=Math.max(1,n.limit??_n),f=n.query?n.query.toLowerCase():void 0,u=n.domains&&n.domains.length>0?new Set(n.domains):void 0,y=n.since,c=n.until,w=n.patternType,m=0,p=[];for(let g of d)On(g,{domainColumn:s,domains:u,patternType:w,since:y,until:c,queryLower:f})&&(m++,p.length<l&&p.push(An(g,a.tableName,s)));return{table:t,inputPath:r,totalScanned:d.length,totalMatched:m,limit:l,hits:p,truncated:m>l}}function On(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=Me(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 Me(e){for(let n of["updated_at","created_at","timestamp"]){let r=e[n];if(typeof r=="string"&&r.length>0)return r}}function An(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:Me(e)};return{id:t,display:a,row:e}}function Nn(e){if(!le(e))throw new Error(`Path not found: ${e}`);if(En(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=ke(e,"manifest.json");if(!le(r))throw new Error(`Manifest not found at ${r}. Is this a brain export directory?`)}function qe(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(`
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.13.3");process.exit(0)}
2
+ import{a as N,b as P,c as j,d as S,e as Y,f as T,g as V,h as C,i as J,j as Z,k as U,l as he,m as M,n as ee,o as we,p as _,q as W,r as z,s as H}from"./chunk-IH47VGC7.js";import{h as be}from"./chunk-64C4SS66.js";import{b as ye}from"./chunk-SAMAYDVS.js";import"./chunk-DPJLA7JW.js";import"./chunk-CW7BWFFF.js";import"./chunk-WHUQDBV7.js";import"./chunk-T5L65R23.js";import"./chunk-66KIIH6V.js";import"./chunk-NIA6VTIH.js";import{b as x,d as X}from"./chunk-2G2XD6EM.js";import{a as ue,b as pe,c as ge,d as k,f as Ke}from"./chunk-PHGOMAIS.js";import"./chunk-XRF5MX4Q.js";import{a as A,b as He}from"./chunk-2BYRQ5MV.js";import"./chunk-P5CQMDFQ.js";import"./chunk-V6W4IHS5.js";import"./chunk-AJ45QR3K.js";import"./chunk-UX434RY5.js";import"./chunk-PHBGMXTR.js";import"./chunk-H4XZOIV6.js";import"./chunk-GTURQ454.js";import"./chunk-AXXFY7PX.js";import"./chunk-62F5M5OO.js";import B from"path";import o from"chalk";He();X();import{existsSync as K,mkdirSync as Ge,writeFileSync as Qe,readFileSync as ne}from"fs";import{join as E,resolve as te}from"path";var Xe={rl_q_values:"includeQValues",dream_insights:"includeDreamInsights",dream_cycles:"includeDreamInsights",witness_chain:"includeWitnessChain",vectors:"includeVectors"};function Ye(e,n){let r=Xe[e.tableName];return!(r&&n[r]===!1)}var Ze=1e4;function en(e,n,r,t){if(!Ye(n,r))return ee(E(t,n.fileName),[]),{count:0,rows:[]};let[a,i]=n.domainColumn?M(r.domains,n.domainColumn):[void 0,[]];if(Z(e,n.tableName,a,i)>=Ze){let l=n.blobColumns,f=l&&l.length>0?y=>T(y,l):void 0;return{count:we(E(t,n.fileName),he(e,n.tableName,a,i),f)}}let s=U(e,n.tableName,a,i);return n.blobColumns&&n.blobColumns.length>0&&(s=s.map(l=>T(l,n.blobColumns))),ee(E(t,n.fileName),s),{count:s.length,rows:s}}function ve(e){let n=[];for(let r of S){let t=E(e,r.fileName);K(t)?n.push(C(ne(t,"utf-8"))):n.push(C(""))}return C(n.join(":"))}function Re(e,n,r="memory.db"){let t=te(n.outputPath);K(t)||Ge(t,{recursive:!0});let a=0,i={},d=new Set;for(let u of S){let y=en(e,u,n,t);if(i[u.tableName]=y.count,a+=y.count,u.tableName==="qe_patterns"){if(y.rows)for(let c of y.rows)c.qe_domain&&d.add(c.qe_domain);else if(y.count>0){let[c,w]=u.domainColumn?M(n.domains,u.domainColumn):[void 0,[]],p=`SELECT DISTINCT qe_domain FROM qe_patterns ${c?`WHERE ${c} AND qe_domain IS NOT NULL`:"WHERE qe_domain IS NOT NULL"}`;try{let g=e.prepare(p).all(...w||[]);for(let v of g)d.add(v.qe_domain)}catch{}}}}let s=n.includeVectors!==!1?Z(e,"vectors"):0,l=ve(t),f={version:"3.0",exportedAt:new Date().toISOString(),sourceDb:r,stats:{patternCount:i.qe_patterns||0,vectorCount:s,qValueCount:i.rl_q_values||0,dreamInsightCount:i.dream_insights||0,witnessChainLength:i.witness_chain||0,totalRecords:a},domains:[...d].sort(),checksum:l,tableRecordCounts:i};return Qe(E(t,"manifest.json"),JSON.stringify(f,null,2),"utf-8"),f}var nn=new Set(["qe_patterns","rl_q_values","dream_insights","witness_chain"]);function tn(e){return e==="1.0"?S.filter(n=>nn.has(n.tableName)):e==="3.0"?S:(console.warn(`[brain-import] Unknown manifest version '${e}'. Attempting full import \u2014 some files may be missing.`),S)}function Se(e,n,r){let t=te(n),a=E(t,"manifest.json");if(!K(a))throw new Error(`Manifest not found at ${a}`);let i=x(ne(a,"utf-8")),d=ve(t);if(d!==i.checksum)throw new Error(`Checksum mismatch: expected ${i.checksum}, got ${d}. The export may have been tampered with or corrupted.`);let s=tn(i.version);if(r.dryRun){let c=0;for(let w of s){let m=_(E(t,w.fileName),x);c+=m.length}return{imported:c,skipped:0,conflicts:0}}H(e);let l=0,f=0,u=0;return e.transaction(()=>{for(let c of s){let w=E(t,c.fileName),m=_(w,x);c.blobColumns&&c.blobColumns.length>0&&(m=m.map(p=>V(p,c.blobColumns)));for(let p of m){let g;if(c.dedupColumns&&c.dedupColumns.length>0)g=z(e,c.tableName,p,c.dedupColumns);else{let v=N[c.tableName]||"id",h=j[c.tableName],I=P[c.tableName];g=W(e,c.tableName,p,v,r.mergeStrategy,h,I)}l+=g.imported,f+=g.skipped,u+=g.conflicts}}})(),{imported:l,skipped:f,conflicts:u}}function xe(e){let n=te(e),r=E(n,"manifest.json");if(!K(r))throw new Error(`Manifest not found at ${r}`);return x(ne(r,"utf-8"))}Ke();import{existsSync as q,readdirSync as rn,renameSync as on,statSync as an,unlinkSync as re,writeFileSync as sn}from"fs";import{basename as ln,dirname as dn,join as cn,resolve as oe}from"path";var Ee=["",".idmap.json",".manifest.json"],fn=[...Ee,".lock"];function Ce(e){for(let n of fn)try{let r=`${e}${n}`;q(r)&&re(r)}catch{}}function mn(e){let n=dn(e),r=`${ln(e)}.tmp.`,t;try{t=rn(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&&un(i)))try{re(cn(n,a))}catch{}}}function un(e){try{return process.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function Be(e,n,r="memory.db"){if(!k())throw new Error("@ruvector/rvf-node is not available. Install it or use --format jsonl instead.");let t=oe(n.outputPath),a=n.dimension??384,i=`${t}.tmp.${process.pid}`;mn(t),Ce(i);let d=ue(i,a),s=!1;try{let l={},f=new Set,u=0;for(let R of S){let[b,O]=R.domainColumn?M(n.domains,R.domainColumn):[void 0,[]],$=U(e,R.tableName,b,O);if(R.tableName==="qe_patterns")for(let L of $)L.qe_domain&&f.add(L.qe_domain);let Q=Y[R.tableName];Q&&Q.length>0&&($=$.map(L=>T(L,Q))),l[R.tableName]=$,u+=$.length}let y=0,c=[];if(J(e,"qe_pattern_embeddings")){let R=e.prepare("SELECT pattern_id, embedding, dimension FROM qe_pattern_embeddings").all();for(let b of R)b.embedding&&b.dimension===a&&c.push({id:`pe:${b.pattern_id}`,vector:new Float32Array(b.embedding.buffer,b.embedding.byteOffset,a),metadata:{tableName:"qe_pattern_embeddings"}})}if(J(e,"captured_experiences")){let R=e.prepare("SELECT id, embedding, embedding_dimension, domain, quality FROM captured_experiences WHERE embedding IS NOT NULL").all();for(let b of R)b.embedding_dimension===a&&c.push({id:`exp:${b.id}`,vector:new Float32Array(b.embedding.buffer,b.embedding.byteOffset,a),metadata:{tableName:"captured_experiences",domain:b.domain,confidence:b.quality}})}if(J(e,"sona_patterns")){let R=e.prepare("SELECT id, state_embedding, domain, confidence FROM sona_patterns WHERE state_embedding IS NOT NULL").all();for(let b of R)b.state_embedding.byteLength/4===a&&c.push({id:`sona:${b.id}`,vector:new Float32Array(b.state_embedding.buffer,b.state_embedding.byteOffset,a),metadata:{tableName:"sona_patterns",domain:b.domain,confidence:b.confidence}})}c.length>0&&(y=d.ingest(c).accepted);let w={version:"3.0",format:"rvf",exportedAt:new Date().toISOString(),sourceDb:r,domains:[...f].sort(),tables:l},m=JSON.stringify(w),p=C(m),g=Buffer.from(m);d.embedKernel(g);let v=n.sign?d.sign(g)??void 0:void 0,h=v?n.signerKeyId??"default":void 0,I=d.fileId(),F=I?{fileId:I,parentId:d.parentId(),lineageDepth:d.lineageDepth()}:void 0,D=d.status(),me={version:"3.0",format:"rvf",exportedAt:w.exportedAt,sourceDb:r,stats:{patternCount:(l.qe_patterns||[]).length,embeddingCount:y,qValueCount:(l.rl_q_values||[]).length,dreamInsightCount:(l.dream_insights||[]).length,witnessChainLength:(l.witness_chain||[]).length,totalRecords:u},domains:w.domains,checksum:p,rvfStatus:{totalVectors:D.totalVectors,totalSegments:D.totalSegments,fileSizeBytes:D.fileSizeBytes},...v?{signature:v,signerKeyId:h}:{},...F?{lineage:F}:{}};if(v)try{d.freeze()}catch{}sn(`${i}.manifest.json`,JSON.stringify(me,null,2),"utf-8"),d.close(),s=!0;for(let R of[...Ee].reverse()){let b=`${i}${R}`,O=`${t}${R}`;q(b)?on(b,O):q(O)&&re(O)}return me}catch(l){if(!s)try{d.close()}catch{}throw Ce(i),l}}var pn={patterns:"qe_patterns",qValues:"rl_q_values",dreamInsights:"dream_insights",witnessChain:"witness_chain"};function _e(e,n,r){if(!k())throw new Error("@ruvector/rvf-node is not available. Install it or use JSONL format.");let t=oe(n);if(!q(t))throw new Error(`RVF file not found: ${t}`);let a=pe(t);try{let i=a.verifyWitness();if(!i.valid&&(i.totalEntries>0||i.errors.length>0)){let m=i.errors.length>0?i.errors.join("; "):"unknown integrity error";throw new Error(`RVF witness verification failed: ${m}`)}let d=a.extractKernel();if(!d||!d.image)throw new Error("No brain data found in RVF file (missing kernel segment)");let s;try{s=JSON.parse(d.image.toString("utf-8"))}catch(m){throw new Error(`Failed to parse brain kernel data as JSON: ${m instanceof Error?m.message:m}`)}if(r.dryRun){let m=0;if(s.tables)for(let p of Object.values(s.tables))m+=p?.length??0;else m=(s.patterns?.length??0)+(s.qValues?.length??0)+(s.dreamInsights?.length??0)+(s.witnessChain?.length??0);return{imported:m,skipped:0,conflicts:0,embeddingsRestored:0}}H(e);let l=0,f=0,u=0,y=0,c={};if(s.tables)Object.assign(c,s.tables);else for(let[m,p]of Object.entries(pn)){let g=s[m];Array.isArray(g)&&(c[p]=g)}if(e.transaction(()=>{for(let m of S){let p=c[m.tableName];if(!p||!Array.isArray(p))continue;let g=Y[m.tableName];if(g&&g.length>0){p=p.map(v=>V(v,g));for(let v of p)for(let h of g)v[h]instanceof Buffer&&y++}for(let v of p){let h;if(m.dedupColumns&&m.dedupColumns.length>0)h=z(e,m.tableName,v,m.dedupColumns);else{let I=N[m.tableName]||"id",F=j[m.tableName],D=P[m.tableName];h=W(e,m.tableName,v,I,r.mergeStrategy,F,D)}l+=h.imported,f+=h.skipped,u+=h.conflicts}}})(),u>0)try{a.compact()}catch{}return{imported:l,skipped:f,conflicts:u,embeddingsRestored:y}}finally{a.close()}}function G(e){if(!k())throw new Error("@ruvector/rvf-node is not available.");let n=oe(e);if(!q(n))throw new Error(`RVF file not found: ${n}`);let r=ge(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(w){throw new Error(`Failed to parse brain kernel data as JSON: ${w instanceof Error?w.message:w}`)}let d=r.status(),s=an(n).size,l=i.tables,f=l?l.qe_patterns?.length??0:i.patterns?.length??0,u=l?l.rl_q_values?.length??0:i.qValues?.length??0,y=l?l.dream_insights?.length??0:i.dreamInsights?.length??0,c=l?l.witness_chain?.length??0:i.witnessChain?.length??0;return{version:"3.0",format:"rvf",exportedAt:i.exportedAt??"unknown",sourceDb:i.sourceDb??"unknown",stats:{patternCount:f,embeddingCount:d.totalVectors,qValueCount:u,dreamInsightCount:y,witnessChainLength:c},domains:i.domains??[],checksum:C(a),rvfStatus:{totalVectors:d.totalVectors,totalSegments:d.totalSegments,fileSizeBytes:s}}}finally{r.close()}}function ae(){return k()}X();import{existsSync as se,readFileSync as gn,statSync as yn}from"fs";import{join as ie,resolve as Ie}from"path";function De(e,n,r={}){let t=Ie(e),a=Ie(n),i=Oe(t),d=Oe(a),s=Ae(t,i),l=Ae(a,d),f=i==="jsonl"&&d==="jsonl",u=wn({pathA:t,pathB:a,manifestA:s,manifestB:l,recordLevel:f,tableFilter:r.tableFilter,maxIdsPerBucket:r.maxIdsPerBucket??500}),y=new Set(s.domains),c=new Set(l.domains),w=s.domains.filter(h=>!c.has(h)),m=l.domains.filter(h=>!y.has(h)),p=s.checksum===l.checksum,g=s.version===l.version,v=p&&g&&u.every(h=>h.delta===0&&(h.added?.length??0)===0&&(h.removed?.length??0)===0&&(h.changed?.length??0)===0);return{pathA:t,pathB:a,formatA:i,formatB:d,manifestA:s,manifestB:l,checksumMatch:p,versionMatch:g,identical:v,recordLevel:f,tableDiffs:u,domainsOnlyInA:w,domainsOnlyInB:m}}function Oe(e){if(!se(e))throw new Error(`Path not found: ${e}`);if(e.endsWith(".rvf"))return"rvf";if(yn(e).isFile())throw new Error(`Unsupported brain export: ${e} (expected a .rvf file or a JSONL directory)`);return"jsonl"}function Ae(e,n){return n==="rvf"?hn(e):bn(e)}function bn(e){let n=ie(e,"manifest.json");if(!se(n))throw new Error(`Manifest not found at ${n}`);let r=x(gn(n,"utf-8"));return $e(r,"jsonl")}function hn(e){let n=G(e);return $e(n,"rvf")}function $e(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 wn(e){let n=e.tableFilter?S.filter(t=>t.tableName===e.tableFilter):S;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,d=i-a,s,l,f;if(e.recordLevel&&vn(t)){let u=Rn(ie(e.pathA,t.fileName),ie(e.pathB,t.fileName),t,e.maxIdsPerBucket);s=u.added,l=u.removed,f=u.changed}r.push({tableName:t.tableName,countA:a,countB:i,delta:d,...s!==void 0?{added:s}:{},...l!==void 0?{removed:l}:{},...f!==void 0?{changed:f}:{}})}return r}function vn(e){return!0}function Rn(e,n,r,t){let a=Ne(e,r),i=Ne(n,r),d=[],s=[],l=[];for(let[f,u]of a){let y=i.get(f);if(y===void 0)s.length<t&&s.push(f);else if(y!==u){if(r.dedupColumns&&r.dedupColumns.length>0)continue;l.length<t&&l.push(f)}}for(let f of i.keys())a.has(f)||d.length<t&&d.push(f);return d.sort(),s.sort(),l.sort(),{added:d,removed:s,changed:l}}function Ne(e,n){let r=new Map;if(!se(e))return r;let t=_(e,x);for(let a of t){let i=Sn(a,n);if(i===void 0)continue;let d=xn(a);r.set(i,Cn(d))}return r}function Sn(e,n){if(n.dedupColumns&&n.dedupColumns.length>0){let a=[];for(let i of n.dedupColumns){let d=e[i];if(d==null)return;a.push(String(d))}return a.join("")}let r=N[n.tableName]??"id",t=e[r];if(t!=null)return String(t)}function xn(e){let n=Object.keys(e).sort(),r={};for(let t of n)r[t]=e[t];return JSON.stringify(r)}function Cn(e){return C(e)}X();import{existsSync as le,statSync as En}from"fs";import{join as ke,resolve as Bn}from"path";var _n=20,In="qe_patterns";function Te(e,n={}){let r=Bn(e);Nn(r);let t=n.table??In,a=S.find(g=>g.tableName===t);if(!a)throw new Error(`Unknown table: ${t}`);let i=ke(r,a.fileName);if(!le(i))throw new Error(`Table file not found: ${a.fileName} (expected in ${r}). Was this export generated with --format jsonl?`);let d=_(i,x),s=a.domainColumn,l=Math.max(1,n.limit??_n),f=n.query?n.query.toLowerCase():void 0,u=n.domains&&n.domains.length>0?new Set(n.domains):void 0,y=n.since,c=n.until,w=n.patternType,m=0,p=[];for(let g of d)On(g,{domainColumn:s,domains:u,patternType:w,since:y,until:c,queryLower:f})&&(m++,p.length<l&&p.push(An(g,a.tableName,s)));return{table:t,inputPath:r,totalScanned:d.length,totalMatched:m,limit:l,hits:p,truncated:m>l}}function On(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=Me(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 Me(e){for(let n of["updated_at","created_at","timestamp"]){let r=e[n];if(typeof r=="string"&&r.length>0)return r}}function An(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:Me(e)};return{id:t,display:a,row:e}}function Nn(e){if(!le(e))throw new Error(`Path not found: ${e}`);if(En(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=ke(e,"manifest.json");if(!le(r))throw new Error(`Manifest not found at ${r}. Is this a brain export directory?`)}function qe(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(`
3
3
  CREATE TEMP TABLE IF NOT EXISTS _covered_patterns (
4
4
  pattern_id TEXT PRIMARY KEY
5
5
  )
@@ -74,7 +74,7 @@ Examples:
74
74
  aqe brain diff ./brain-a ./brain-b --verbose
75
75
  aqe brain search -i ./brain-export --query oauth --domain test-generation
76
76
  aqe brain search -i ./brain-export --since 2026-03-01 --limit 50 --json
77
- `}};async function de(e){if(e)return e;let{findProjectRoot:n}=await import("./unified-memory-P5YVLMFI.js");return B.join(n(),".agentic-qe","memory.db")}function We(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function $n(e){let n=Number.parseInt(e,10);return!Number.isFinite(n)||n<1?20:n}function kn(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 Tn(e,n){console.log(o.blue(`
77
+ `}};async function de(e){if(e)return e;let{findProjectRoot:n}=await import("./unified-memory-QKWUSEBV.js");return B.join(n(),".agentic-qe","memory.db")}function We(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function $n(e){let n=Number.parseInt(e,10);return!Number.isFinite(n)||n<1?20:n}function kn(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 Tn(e,n){console.log(o.blue(`
78
78
  Brain Diff
79
79
  `)),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)} `+ze(e.manifestB.totalRecords-e.manifestA.totalRecords)),(e.domainsOnlyInA.length>0||e.domainsOnlyInB.length>0)&&(console.log(o.blue(`
80
80
  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(`
@@ -1,5 +1,5 @@
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.13.1");process.exit(0)}
2
- import"./chunk-OE4B6LDZ.js";var f=class{language;constructor(e="typescript"){this.language=e}enumerate(e,s){let r=[],n=e.split(`
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.13.3");process.exit(0)}
2
+ import"./chunk-62F5M5OO.js";var f=class{language;constructor(e="typescript"){this.language=e}enumerate(e,s){let r=[],n=e.split(`
3
3
  `),l=!1;for(let i=0;i<n.length;i++){let d=n[i],t=d.trim(),c=i+1,u=d.length-d.trimStart().length+1;if(l){t.includes("*/")&&(l=!1);continue}if(t.startsWith("/*")){l=!t.includes("*/");continue}if(t.startsWith("//"))continue;if(/^\s*if\s*\(/.test(d)&&(this.findMatchingElse(n,i)||r.push({file:s,line:c,column:u,language:this.language,construct:"if-without-else",triggerCondition:"when condition is false",currentHandling:"falls through \u2014 no else branch",suggestedGuard:"Add else branch or document why falsy path is safe",severity:"medium"})),/^\s*switch\s*\(/.test(d)){let a=this.extractBlock(n,i);if(a&&!a.includes("default:")&&!a.includes("default :")&&r.push({file:s,line:c,column:u,language:this.language,construct:"switch-no-default",triggerCondition:"when value matches no case",currentHandling:"falls through \u2014 no default case",suggestedGuard:"Add default case with error handling or exhaustive check",severity:"high"}),a){let g=a.match(/case\s+[^:]+:/g)||[],h=a.match(/\b(break|return|throw|continue)\b/g)||[];g.length>0&&h.length<g.length&&r.push({file:s,line:c,column:u,language:this.language,construct:"switch-missing-break",triggerCondition:"when case falls through to next case",currentHandling:"fall-through \u2014 may execute unintended cases",suggestedGuard:"Add break/return to each case or add explicit // falls through comment",severity:"medium"})}}if(/\bcatch\s*\(/.test(t)||/\bcatch\s*\{/.test(t)){let a=this.extractBlock(n,i);if(a!==null){let g=a.replace(/[{}]/g,"").trim();(g.length===0||/^\s*\/\//.test(g))&&r.push({file:s,line:c,column:u,language:this.language,construct:"try-empty-catch",triggerCondition:"when exception is thrown",currentHandling:"exception silently swallowed",suggestedGuard:"Log the error or rethrow with context",severity:"high"})}}if(/\btry\s*\{/.test(t)&&this.extractBlock(n,i)&&(n.slice(i,Math.min(i+30,n.length)).join(`
4
4
  `).includes("finally")||r.push({file:s,line:c,column:u,language:this.language,construct:"try-no-finally",triggerCondition:"when cleanup is needed regardless of success/failure",currentHandling:"no finally block \u2014 cleanup may be skipped on exception",suggestedGuard:"Add finally block for resource cleanup if applicable",severity:"low"})),t.includes("?.")){let a=t.match(/(\w+(?:\.\w+)*)\?\./g)||[];for(let g of a)if(!t.includes("??")&&!t.includes("|| ")&&!t.includes("if")){r.push({file:s,line:c,column:u,language:this.language,construct:"optional-chaining-null-path",triggerCondition:`when ${g.replace("?.","")} is null/undefined`,currentHandling:"returns undefined \u2014 may propagate",suggestedGuard:"Add ?? fallback or explicit null check",severity:"low"});break}}if(t.includes("??")&&!t.includes("?.")&&r.push({file:s,line:c,column:u,language:this.language,construct:"nullish-coalescing-fallback",triggerCondition:"when left side is null/undefined",currentHandling:"uses fallback value",suggestedGuard:"Verify fallback value is appropriate for all null cases",severity:"low"}),/\.\s*then\s*\(/.test(t)&&!t.includes(".catch")&&!t.includes("await")){let a=n.slice(i,Math.min(i+5,n.length)).join(" ");!a.includes(".catch")&&!a.includes("try")&&r.push({file:s,line:c,column:u,language:this.language,construct:"promise-no-catch",triggerCondition:"when promise rejects",currentHandling:"unhandled rejection \u2014 may crash process",suggestedGuard:"Add .catch() handler or use try/catch with await",severity:"high"})}let p=["map","filter","reduce","forEach","find","some","every","flatMap"];for(let a of p)if(new RegExp(`\\.${a}\\s*\\(`).test(t)){let h=n.slice(Math.max(0,i-3),i).join(" ");if(!h.includes(".length")&&!h.includes("if (")&&!h.includes("?.")){r.push({file:s,line:c,column:u,language:this.language,construct:"array-callback-empty",triggerCondition:`when array is empty before .${a}()`,currentHandling:a==="reduce"?"may throw without initial value":"returns empty result \u2014 may cause downstream issues",suggestedGuard:a==="reduce"?"Provide initial value or check array length":"Check array length or handle empty result",severity:a==="reduce"?"high":"low"});break}}/\|\|\s*['"`\d]/.test(t)&&!t.includes("??")&&r.push({file:s,line:c,column:u,language:this.language,construct:"logical-or-falsy",triggerCondition:'when left side is falsy (0, "", false, null, undefined)',currentHandling:'uses fallback \u2014 may unintentionally override 0, "", or false',suggestedGuard:"Use ?? instead of || if only null/undefined should trigger fallback",severity:"medium"}),/&&\s*\w+\s*\(/.test(t)&&!t.includes("if")&&!t.includes("while")&&r.push({file:s,line:c,column:u,language:this.language,construct:"logical-and-short-circuit",triggerCondition:"when left side is falsy \u2014 right side never executes",currentHandling:"short-circuits \u2014 function call skipped silently",suggestedGuard:"Use explicit if-statement for clarity when side effects matter",severity:"low"}),(t.match(/\?/g)||[]).length>=2&&t.includes(":")&&r.push({file:s,line:c,column:u,language:this.language,construct:"ternary-complex",triggerCondition:"when nested ternary conditions interact",currentHandling:"nested ternary \u2014 hard to read and maintain",suggestedGuard:"Refactor to if/else or switch for readability",severity:"medium"}),(/\btypeof\s+\w+\s*===?\s*['"]/.test(t)||/\binstanceof\b/.test(t))&&!t.includes("else")&&!this.findMatchingElse(n,i)&&r.push({file:s,line:c,column:u,language:this.language,construct:"type-guard-unhandled",triggerCondition:"when value does not match the guarded type",currentHandling:"unguarded type path \u2014 may cause runtime type errors",suggestedGuard:"Add else branch or exhaustive type checking",severity:"medium"})}return r}findMatchingElse(e,s){let r={depth:0};for(let n=s;n<Math.min(s+30,e.length);n++){let l=e[n];for(let i of l)i==="{"&&r.depth++,i==="}"&&r.depth--;if(r.depth===0&&n>s){if((e[n+1]?.trim()||"").startsWith("else")||e[n].trim().endsWith("else")||e[n].trim().endsWith("else {")||e[n].includes("} else"))return!0;break}}return!1}extractBlock(e,s){let r=0,n=!1,l=[];for(let i=s;i<Math.min(s+50,e.length);i++){let d=e[i];for(let t of d)t==="{"&&(r++,n=!0),t==="}"&&r--;if(n&&(l.push(d),r===0))return l.join(`
5
5
  `)}return null}};function y(o,e,s){let r=Date.now(),n=s||(e.endsWith(".ts")||e.endsWith(".tsx")?"typescript":"javascript"),i=new f(n).enumerate(o,e);return{file:e,language:n,branches:i,totalConstructs:i.length,unhandledCount:i.length,duration:Date.now()-r}}function b(o){let e=[];if(e.push(`# Branch Enumeration Report: ${o.file}`),e.push(""),e.push(`**Language**: ${o.language} | **Branches**: ${o.unhandledCount} | **Duration**: ${o.duration}ms`),e.push(""),o.branches.length===0)return e.push("No unhandled branches detected."),e.join(`
@@ -1,4 +1,4 @@
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.13.1");process.exit(0)}
2
- import{a as p}from"./chunk-UKBDH27A.js";import"./chunk-OE4B6LDZ.js";import{readFile as m,readdir as k}from"fs/promises";import{join as c,basename as y,dirname as W}from"path";import{fileURLToPath as v}from"url";import{parse as d}from"yaml";var b=v(import.meta.url),E=W(b),l=class{templatesDir;cache=new Map;constructor(r){this.templatesDir=r||c(E,"templates")}async load(r){if(this.cache.has(r))return this.cache.get(r);try{let e=c(this.templatesDir,`${r}.yaml`),n=await m(e,"utf-8"),o=d(n),i=await this.validate(o);if(!i.valid)throw new Error(`Invalid workflow template ${r}:
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.13.3");process.exit(0)}
2
+ import{a as p}from"./chunk-RMQRSZB4.js";import"./chunk-62F5M5OO.js";import{readFile as m,readdir as k}from"fs/promises";import{join as c,basename as y,dirname as W}from"path";import{fileURLToPath as v}from"url";import{parse as d}from"yaml";var b=v(import.meta.url),E=W(b),l=class{templatesDir;cache=new Map;constructor(r){this.templatesDir=r||c(E,"templates")}async load(r){if(this.cache.has(r))return this.cache.get(r);try{let e=c(this.templatesDir,`${r}.yaml`),n=await m(e,"utf-8"),o=d(n),i=await this.validate(o);if(!i.valid)throw new Error(`Invalid workflow template ${r}:
3
3
  ${i.errors.join(`
4
4
  `)}`);return this.cache.set(r,o),o}catch(e){throw e.code==="ENOENT"?new Error(`Workflow template not found: ${r}`):e}}async list(){try{return(await k(this.templatesDir)).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).map(e=>y(e,e.endsWith(".yaml")?".yaml":".yml")).sort()}catch(r){if(r.code==="ENOENT")return[];throw r}}async validate(r){let e=[],n=[];if(r.name||e.push("Workflow must have a name"),r.version||e.push("Workflow must have a version"),r.description||n.push("Workflow should have a description"),Array.isArray(r.variables)?r.variables.forEach((o,i)=>{o.name||e.push(`Variable at index ${i} must have a name`),o.type||e.push(`Variable ${o.name} must have a type`),o.required===void 0&&n.push(`Variable ${o.name} should specify if it's required`)}):e.push("Workflow must have a variables array"),!Array.isArray(r.steps))e.push("Workflow must have a steps array");else if(r.steps.length===0)e.push("Workflow must have at least one step");else{r.steps.forEach((t,s)=>{t.name||e.push(`Step at index ${s} must have a name`),t.action||e.push(`Step ${t.name||s} must have an action`),(!t.config||typeof t.config!="object")&&e.push(`Step ${t.name||s} must have a config object`),t.assertions&&Array.isArray(t.assertions)&&t.assertions.forEach((f,u)=>{f.condition||e.push(`Assertion ${u} in step ${t.name||s} must have a condition`),f.message||n.push(`Assertion ${u} in step ${t.name||s} should have a message`)})});let o=r.steps.map(t=>t.name),i=o.filter((t,s)=>o.indexOf(t)!==s);i.length>0&&e.push(`Duplicate step names found: ${i.join(", ")}`)}return{valid:e.length===0,errors:e,warnings:n}}async createContext(r,e){let n=await this.load(r),o=n.variables.filter(t=>t.required&&!(t.name in e)).map(t=>t.name);if(o.length>0)throw new Error(`Missing required variables: ${o.join(", ")}`);let i={};return n.variables.forEach(t=>{t.name in e?i[t.name]=e[t.name]:"default"in t&&(i[t.name]=t.default)}),{variables:i,results:new Map,metadata:{startTime:Date.now(),workflow:n.name,templateName:r}}}async getMetadata(r){try{let e=c(this.templatesDir,`${r}.yaml`),n=await m(e,"utf-8"),o=d(n);return{name:o.name,version:o.version,description:o.description}}catch(e){throw e.code==="ENOENT"?new Error(`Workflow template not found: ${r}`):e}}clearCache(){this.cache.clear()}async reload(r){return this.cache.delete(r),this.load(r)}},x=new l;function w(a,r){return a.replace(/\{\{([^}]+)\}\}/g,(e,n)=>{let i=n.trim().split("."),t=r;for(let s of i)if(t&&typeof t=="object"&&s in t)t=t[s];else return e;return t!=null?String(t):e})}function T(a,r){let e={...r.variables,result:r.results.get("__last_result__")},n=w(a,e);return p(n,e,!1)}var g=["login-flow","oauth-flow","scraping-workflow","visual-regression","form-validation","navigation-flow","api-integration","performance-audit","accessibility-audit"],A={"login-flow":"Authentication testing workflow for login forms with credential validation","oauth-flow":"OAuth2/OIDC authentication testing workflow with provider integration","scraping-workflow":"Data extraction workflow for web scraping with pagination and structured output","visual-regression":"Screenshot comparison workflow for visual regression testing across breakpoints","form-validation":"Input validation testing workflow for form fields with error handling","navigation-flow":"Multi-page navigation workflow for testing user journeys and state persistence","api-integration":"Browser-API hybrid testing workflow for validating frontend-backend integration","performance-audit":"Lighthouse-style performance audit workflow with Core Web Vitals","accessibility-audit":"WCAG 2.1 Level AA compliance audit workflow with automated accessibility testing"},h={authentication:["login-flow","oauth-flow"],testing:["form-validation","navigation-flow","api-integration"],quality:["visual-regression","performance-audit","accessibility-audit"],automation:["scraping-workflow"]};function _(a){return h[a]}function P(a){return g.includes(a)}function L(){return g.map(a=>{let r=Object.entries(h).find(([e,n])=>n.includes(a))?.[0]||"other";return{name:a,description:A[a],category:r}})}export{h as WORKFLOW_CATEGORIES,A as WORKFLOW_DESCRIPTIONS,g as WORKFLOW_TEMPLATES,l as WorkflowLoader,x as defaultWorkflowLoader,T as evaluateCondition,L as getAllWorkflowTemplates,_ as getWorkflowsByCategory,w as interpolateVariables,P as isValidWorkflowTemplate};
@@ -0,0 +1,2 @@
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.13.3");process.exit(0)}
2
+ import{a}from"./chunk-MYR6CBXC.js";import"./chunk-M7XDTQHX.js";import"./chunk-7AHQ7ROU.js";import"./chunk-DPJLA7JW.js";import"./chunk-CW7BWFFF.js";import"./chunk-WHUQDBV7.js";import"./chunk-T5L65R23.js";import"./chunk-66KIIH6V.js";import"./chunk-NIA6VTIH.js";import"./chunk-2G2XD6EM.js";import"./chunk-XRF5MX4Q.js";import"./chunk-FF53QW6C.js";import"./chunk-3CFWNT3F.js";import"./chunk-2BYRQ5MV.js";import"./chunk-P5CQMDFQ.js";import"./chunk-V6W4IHS5.js";import"./chunk-AJ45QR3K.js";import"./chunk-UX434RY5.js";import"./chunk-PHBGMXTR.js";import"./chunk-H4XZOIV6.js";import"./chunk-GTURQ454.js";import"./chunk-AXXFY7PX.js";import"./chunk-62F5M5OO.js";export{a as BrowserWorkflowTool};
@@ -1,2 +1,2 @@
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.13.1");process.exit(0)}
2
- import{g}from"./chunk-MXKHIZVM.js";import{b as p,c as d}from"./chunk-GTPZVLL6.js";import{b as m,c as f}from"./chunk-AYYDO52G.js";import{i as h}from"./chunk-ZIBW7CB4.js";f();var I={maxDepth:5,riskWeights:{directImpact:.4,transitiveImpact:.2,testCoverage:.2,criticalPath:.15,dependencyCount:.05},testPatterns:["**/*.test.ts","**/*.test.tsx","**/*.spec.ts","**/*.spec.tsx","**/test_*.py","**/*_test.py","**/*_test.go"],criticalPaths:["**/auth/**","**/security/**","**/payment/**","**/api/**","**/core/**"],namespace:"code-intelligence:impact"},u=class{constructor(e,t,i={}){this.memory=e;this.config={...I,...i},this.knowledgeGraph=t||new g(e)}memory;config;knowledgeGraph;async analyzeImpact(e){try{let{changedFiles:t,depth:i=this.config.maxDepth,includeTests:r=!0}=e;if(t.length===0)return p({directImpact:[],transitiveImpact:[],impactedTests:[],riskLevel:"info",recommendations:[]});let n=await this.analyzeDirectImpact(t),l=await this.analyzeTransitiveImpact(t,n,i),s=[];if(r){let a=await this.getImpactedTests(t);a.success&&(s=a.value)}let c={directImpact:n,transitiveImpact:l,impactedTests:s,riskLevel:"info",recommendations:[]};return c.riskLevel=this.calculateRiskLevel(c),c.recommendations=this.getRecommendations(c),await this.storeAnalysis(t,c),p(c)}catch(t){return d(m(t))}}async getImpactedTests(e){try{let t=new Set;for(let i of e){if(this.isTestFile(i)){t.add(i);continue}let r=await this.knowledgeGraph.mapDependencies({files:[i],direction:"incoming",depth:3});if(r.success)for(let s of r.value.nodes)this.isTestFile(s.path)&&t.add(s.path);let n=this.getBaseName(i),l=[`${n}.test`,`${n}.spec`,`test_${n}`,`${n}_test`];for(let s of l){let c=await this.memory.search(`code-intelligence:kg:node:*${s}*`,10,{namespace:"code-intelligence:kg"});for(let a of c){let o=await this.memory.get(a,{namespace:"code-intelligence:kg"});o?.properties?.path&&this.isTestFile(o.properties.path)&&t.add(o.properties.path)}}}return p(Array.from(t))}catch(t){return d(m(t))}}calculateRiskLevel(e){let t=this.config.riskWeights,i=0,r=Math.min(1,e.directImpact.length/10);i+=r*t.directImpact;let n=Math.min(1,e.transitiveImpact.length/20);i+=n*t.transitiveImpact;let l=e.impactedTests.length>0?Math.max(0,1-e.impactedTests.length/(e.directImpact.length||1)):1;i+=l*t.testCoverage;let s=this.countCriticalFiles([...e.directImpact.map(o=>o.file),...e.transitiveImpact.map(o=>o.file)]),c=Math.min(1,s/5);i+=c*t.criticalPath;let a=this.calculateAverageRiskScore([...e.directImpact,...e.transitiveImpact]);return i+=a*t.dependencyCount,i>=.8?"critical":i>=.6?"high":i>=.4?"medium":i>=.2?"low":"info"}getRecommendations(e){let t=[];(e.riskLevel==="critical"||e.riskLevel==="high")&&t.push("This change has significant impact - consider peer review before merging"),e.impactedTests.length===0&&e.directImpact.length>0?t.push("No tests found for impacted files - add test coverage"):e.impactedTests.length<e.directImpact.length/2&&t.push("Test coverage appears low for impacted files"),e.impactedTests.length>0&&(e.impactedTests.length<=10?t.push(`Run these ${e.impactedTests.length} tests: ${e.impactedTests.slice(0,3).join(", ")}${e.impactedTests.length>3?"...":""}`):t.push(`Run all ${e.impactedTests.length} impacted tests before deployment`));let i=[...e.directImpact,...e.transitiveImpact].filter(n=>this.isCriticalPath(n.file));i.length>0&&t.push(`${i.length} critical path files affected - extra scrutiny recommended`),e.transitiveImpact.length>10&&t.push("Large transitive impact - consider breaking down into smaller changes");let r=[...e.directImpact,...e.transitiveImpact].filter(n=>n.riskScore>=.7);return r.length>0&&t.push(`${r.length} high-risk files impacted: ${r.slice(0,2).map(n=>this.getFileName(n.file)).join(", ")}`),t}async analyzeDirectImpact(e){let t=[];for(let i of e){let r=await this.knowledgeGraph.mapDependencies({files:[i],direction:"incoming",depth:1});if(r.success){let{nodes:n,edges:l}=r.value;for(let s of n){if(s.path===i)continue;let c=l.find(o=>o.target===s.id||o.source===s.id),a=this.calculateFileRiskScore(s.path,s.inDegree,s.outDegree);t.push({file:s.path,reason:`Directly ${c?.type||"depends on"} ${this.getFileName(i)}`,distance:1,riskScore:a})}}}return this.deduplicateImpact(t)}async analyzeTransitiveImpact(e,t,i){let r=[],n=new Set([...e,...t.map(s=>s.file)]),l=t.map(s=>({file:s.file,distance:1}));for(;l.length>0;){let s=l.shift();if(s.distance>=i)continue;let c=await this.knowledgeGraph.mapDependencies({files:[s.file],direction:"incoming",depth:1});if(c.success)for(let a of c.value.nodes){if(n.has(a.path)||a.path===s.file)continue;n.add(a.path);let o=this.calculateFileRiskScore(a.path,a.inDegree,a.outDegree,s.distance+1);r.push({file:a.path,reason:`Transitively depends via ${this.getFileName(s.file)}`,distance:s.distance+1,riskScore:o}),l.push({file:a.path,distance:s.distance+1})}}return this.deduplicateImpact(r)}calculateFileRiskScore(e,t,i,r=1){let n=0;return n+=Math.min(.3,t/20),n+=Math.min(.2,i/30),this.isCriticalPath(e)&&(n+=.3),this.isEntryPoint(e)&&(n+=.2),n=n*Math.pow(.8,r-1),Math.min(1,Math.max(0,n))}calculateAverageRiskScore(e){return e.length===0?0:e.reduce((i,r)=>i+r.riskScore,0)/e.length}countCriticalFiles(e){return e.filter(t=>this.isCriticalPath(t)).length}isTestFile(e){return[/\.test\.[tj]sx?$/,/\.spec\.[tj]sx?$/,/_test\.[tj]sx?$/,/test_.*\.py$/,/.*_test\.py$/,/.*_test\.go$/].some(i=>i.test(e))}isCriticalPath(e){return this.config.criticalPaths.map(i=>i.replace(/\*\*/g,".*").replace(/\*/g,"[^/]*")).some(i=>new RegExp(i).test(e))}isEntryPoint(e){return[/\/index\.[tj]sx?$/,/\/main\.[tj]sx?$/,/\/app\.[tj]sx?$/,/^src\/[^/]+\.[tj]sx?$/,/\/server\.[tj]sx?$/,/\/__init__\.py$/,/\/main\.go$/].some(i=>i.test(e))}getBaseName(e){return this.getFileName(e).replace(/\.[^.]+$/,"")}getFileName(e){return e.split(/[/\\]/).pop()||e}deduplicateImpact(e){let t=new Map;for(let i of e){let r=t.get(i.file);(!r||i.distance<r.distance)&&t.set(i.file,i)}return Array.from(t.values()).sort((i,r)=>r.riskScore!==i.riskScore?r.riskScore-i.riskScore:i.distance-r.distance)}async storeAnalysis(e,t){let i=h();await this.memory.set(`${this.config.namespace}:analysis:${i}`,{id:i,changedFiles:e,analysis:t,timestamp:new Date().toISOString()},{namespace:this.config.namespace,persist:!0})}};export{u as a};
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.13.3");process.exit(0)}
2
+ import{g}from"./chunk-OU5CZFBG.js";import{b as p,c as d}from"./chunk-ZU3XUBDQ.js";import{b as m,c as f}from"./chunk-XRF5MX4Q.js";import{i as h}from"./chunk-FF53QW6C.js";f();var I={maxDepth:5,riskWeights:{directImpact:.4,transitiveImpact:.2,testCoverage:.2,criticalPath:.15,dependencyCount:.05},testPatterns:["**/*.test.ts","**/*.test.tsx","**/*.spec.ts","**/*.spec.tsx","**/test_*.py","**/*_test.py","**/*_test.go"],criticalPaths:["**/auth/**","**/security/**","**/payment/**","**/api/**","**/core/**"],namespace:"code-intelligence:impact"},u=class{constructor(e,t,i={}){this.memory=e;this.config={...I,...i},this.knowledgeGraph=t||new g(e)}memory;config;knowledgeGraph;async analyzeImpact(e){try{let{changedFiles:t,depth:i=this.config.maxDepth,includeTests:r=!0}=e;if(t.length===0)return p({directImpact:[],transitiveImpact:[],impactedTests:[],riskLevel:"info",recommendations:[]});let n=await this.analyzeDirectImpact(t),l=await this.analyzeTransitiveImpact(t,n,i),s=[];if(r){let a=await this.getImpactedTests(t);a.success&&(s=a.value)}let c={directImpact:n,transitiveImpact:l,impactedTests:s,riskLevel:"info",recommendations:[]};return c.riskLevel=this.calculateRiskLevel(c),c.recommendations=this.getRecommendations(c),await this.storeAnalysis(t,c),p(c)}catch(t){return d(m(t))}}async getImpactedTests(e){try{let t=new Set;for(let i of e){if(this.isTestFile(i)){t.add(i);continue}let r=await this.knowledgeGraph.mapDependencies({files:[i],direction:"incoming",depth:3});if(r.success)for(let s of r.value.nodes)this.isTestFile(s.path)&&t.add(s.path);let n=this.getBaseName(i),l=[`${n}.test`,`${n}.spec`,`test_${n}`,`${n}_test`];for(let s of l){let c=await this.memory.search(`code-intelligence:kg:node:*${s}*`,10,{namespace:"code-intelligence:kg"});for(let a of c){let o=await this.memory.get(a,{namespace:"code-intelligence:kg"});o?.properties?.path&&this.isTestFile(o.properties.path)&&t.add(o.properties.path)}}}return p(Array.from(t))}catch(t){return d(m(t))}}calculateRiskLevel(e){let t=this.config.riskWeights,i=0,r=Math.min(1,e.directImpact.length/10);i+=r*t.directImpact;let n=Math.min(1,e.transitiveImpact.length/20);i+=n*t.transitiveImpact;let l=e.impactedTests.length>0?Math.max(0,1-e.impactedTests.length/(e.directImpact.length||1)):1;i+=l*t.testCoverage;let s=this.countCriticalFiles([...e.directImpact.map(o=>o.file),...e.transitiveImpact.map(o=>o.file)]),c=Math.min(1,s/5);i+=c*t.criticalPath;let a=this.calculateAverageRiskScore([...e.directImpact,...e.transitiveImpact]);return i+=a*t.dependencyCount,i>=.8?"critical":i>=.6?"high":i>=.4?"medium":i>=.2?"low":"info"}getRecommendations(e){let t=[];(e.riskLevel==="critical"||e.riskLevel==="high")&&t.push("This change has significant impact - consider peer review before merging"),e.impactedTests.length===0&&e.directImpact.length>0?t.push("No tests found for impacted files - add test coverage"):e.impactedTests.length<e.directImpact.length/2&&t.push("Test coverage appears low for impacted files"),e.impactedTests.length>0&&(e.impactedTests.length<=10?t.push(`Run these ${e.impactedTests.length} tests: ${e.impactedTests.slice(0,3).join(", ")}${e.impactedTests.length>3?"...":""}`):t.push(`Run all ${e.impactedTests.length} impacted tests before deployment`));let i=[...e.directImpact,...e.transitiveImpact].filter(n=>this.isCriticalPath(n.file));i.length>0&&t.push(`${i.length} critical path files affected - extra scrutiny recommended`),e.transitiveImpact.length>10&&t.push("Large transitive impact - consider breaking down into smaller changes");let r=[...e.directImpact,...e.transitiveImpact].filter(n=>n.riskScore>=.7);return r.length>0&&t.push(`${r.length} high-risk files impacted: ${r.slice(0,2).map(n=>this.getFileName(n.file)).join(", ")}`),t}async analyzeDirectImpact(e){let t=[];for(let i of e){let r=await this.knowledgeGraph.mapDependencies({files:[i],direction:"incoming",depth:1});if(r.success){let{nodes:n,edges:l}=r.value;for(let s of n){if(s.path===i)continue;let c=l.find(o=>o.target===s.id||o.source===s.id),a=this.calculateFileRiskScore(s.path,s.inDegree,s.outDegree);t.push({file:s.path,reason:`Directly ${c?.type||"depends on"} ${this.getFileName(i)}`,distance:1,riskScore:a})}}}return this.deduplicateImpact(t)}async analyzeTransitiveImpact(e,t,i){let r=[],n=new Set([...e,...t.map(s=>s.file)]),l=t.map(s=>({file:s.file,distance:1}));for(;l.length>0;){let s=l.shift();if(s.distance>=i)continue;let c=await this.knowledgeGraph.mapDependencies({files:[s.file],direction:"incoming",depth:1});if(c.success)for(let a of c.value.nodes){if(n.has(a.path)||a.path===s.file)continue;n.add(a.path);let o=this.calculateFileRiskScore(a.path,a.inDegree,a.outDegree,s.distance+1);r.push({file:a.path,reason:`Transitively depends via ${this.getFileName(s.file)}`,distance:s.distance+1,riskScore:o}),l.push({file:a.path,distance:s.distance+1})}}return this.deduplicateImpact(r)}calculateFileRiskScore(e,t,i,r=1){let n=0;return n+=Math.min(.3,t/20),n+=Math.min(.2,i/30),this.isCriticalPath(e)&&(n+=.3),this.isEntryPoint(e)&&(n+=.2),n=n*Math.pow(.8,r-1),Math.min(1,Math.max(0,n))}calculateAverageRiskScore(e){return e.length===0?0:e.reduce((i,r)=>i+r.riskScore,0)/e.length}countCriticalFiles(e){return e.filter(t=>this.isCriticalPath(t)).length}isTestFile(e){return[/\.test\.[tj]sx?$/,/\.spec\.[tj]sx?$/,/_test\.[tj]sx?$/,/test_.*\.py$/,/.*_test\.py$/,/.*_test\.go$/].some(i=>i.test(e))}isCriticalPath(e){return this.config.criticalPaths.map(i=>i.replace(/\*\*/g,".*").replace(/\*/g,"[^/]*")).some(i=>new RegExp(i).test(e))}isEntryPoint(e){return[/\/index\.[tj]sx?$/,/\/main\.[tj]sx?$/,/\/app\.[tj]sx?$/,/^src\/[^/]+\.[tj]sx?$/,/\/server\.[tj]sx?$/,/\/__init__\.py$/,/\/main\.go$/].some(i=>i.test(e))}getBaseName(e){return this.getFileName(e).replace(/\.[^.]+$/,"")}getFileName(e){return e.split(/[/\\]/).pop()||e}deduplicateImpact(e){let t=new Map;for(let i of e){let r=t.get(i.file);(!r||i.distance<r.distance)&&t.set(i.file,i)}return Array.from(t.values()).sort((i,r)=>r.riskScore!==i.riskScore?r.riskScore-i.riskScore:i.distance-r.distance)}async storeAnalysis(e,t){let i=h();await this.memory.set(`${this.config.namespace}:analysis:${i}`,{id:i,changedFiles:e,analysis:t,timestamp:new Date().toISOString()},{namespace:this.config.namespace,persist:!0})}};export{u as a};
@@ -0,0 +1,4 @@
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.13.3");process.exit(0)}
2
+ import{a as u,q as E}from"./chunk-P5CQMDFQ.js";import{c as k}from"./chunk-62F5M5OO.js";import{existsSync as i,renameSync as p,copyFileSync as T,readdirSync as x,statSync as h,openSync as R,readSync as v,closeSync as B,writeFileSync as O,rmSync as $}from"node:fs";import{join as w,dirname as M}from"node:path";function D(e){if(!i(e))return!0;let t;try{t=h(e).size}catch{return!1}if(t===0)return!0;if(t<d.length)return!1;let r;try{r=R(e,"r");let o=Buffer.alloc(d.length);return v(r,o,0,d.length,0),o.equals(d)}catch{return!1}finally{if(r!==void 0)try{B(r)}catch{}}}function U(e){let t;try{return t=new u(e,{readonly:!0,fileMustExist:!0}),t.pragma("integrity_check",{simple:!0})==="ok"}catch{return!1}finally{try{t?.close()}catch{}}}function Q(e){return w(M(e),"backups","verified")}function C(e){if(!i(e))return null;let t=x(e).filter(r=>r.startsWith("memory-")&&r.endsWith(".db")).map(r=>{let o=w(e,r);return{path:o,mtime:h(o).mtimeMs}}).sort((r,o)=>o.mtime-r.mtime);for(let r of t)if(U(r.path))return r.path;return null}function S(e,t){if(D(e))return{restored:!1,reason:"healthy"};let r=t?.backupDir??Q(e),o=C(r);if(!o)return{restored:!1,reason:"no-verified-backup"};let f=`${e}.restore.lock`;try{O(f,String(process.pid),{flag:"wx"})}catch{return{restored:!1,reason:"restore-in-progress"}}try{if(D(e))return{restored:!1,reason:"healthy"};let l=t?.now??Date.now(),s=`${e}.corrupt-${l}`;try{i(e)&&p(e,s);for(let n of["-wal","-shm"])i(e+n)&&p(e+n,s+n)}catch{return{restored:!1,reason:"park-failed"}}let c=`${e}.restoring-${l}`;try{T(o,c),p(c,e)}catch{try{i(c)&&$(c,{force:!0}),!i(e)&&i(s)&&p(s,e)}catch{}return{restored:!1,reason:"copy-failed"}}return{restored:!0,reason:"restored-from-backup",backupUsed:o,parkedTo:s}}finally{try{$(f,{force:!0})}catch{}}}var d,_=k(()=>{"use strict";E();d=Buffer.concat([Buffer.from("SQLite format 3","latin1"),Buffer.from([0])])});import{basename as I}from"node:path";function H(e,t){let r=t?.readonly??!1,o=t?.fileMustExist??!1,f=t?.busyTimeout??5e3,l=t?.walMode??!r;if(t?.autoRestore&&!r){let a=S(e,{backupDir:t.backupDir});a.restored?console.warn(`[safe-db] memory DB at ${e} was malformed; auto-restored from ${a.backupUsed}. Corrupt original parked at ${a.parkedTo}.`):a.reason==="no-verified-backup"&&console.error(`[safe-db] memory DB at ${e} appears malformed and NO verified backup was found to restore from. Leaving it in place for manual inspection.`)}let s=(process.env.AQE_JOURNAL_MODE??"").trim().toUpperCase(),c=process.env.AQE_DISABLE_WAL==="1"||s==="DELETE"||s==="TRUNCATE",n=new u(e,{readonly:r,fileMustExist:o});if(n.pragma(`busy_timeout = ${f}`),c){if(!r){let a=(s||"DELETE").toUpperCase(),m=String(n.pragma("journal_mode",{simple:!0})??"").toUpperCase();if(m!==a){try{n.pragma(`journal_mode = ${a}`)}catch(y){let b=y?.code;if(n.close(),b!=="SQLITE_BUSY"&&b!=="SQLITE_LOCKED")throw y;let A=I(e),L=process.env.AQE_DISABLE_WAL==="1"?"AQE_DISABLE_WAL=1":`AQE_JOURNAL_MODE=${s}`;throw new Error(`[safe-db] cannot switch ${e} from '${m}' to '${a}' \u2014 another process holds the database open. ${L} declares WAL unsafe on this filesystem, so writing in '${m}' is NOT safe and this open is refused. Find the holder with:
3
+ for p in /proc/[0-9]*; do for f in $p/fd/*; do readlink "$f" 2>/dev/null | grep -q ${JSON.stringify(A)} && echo "$(basename $p) $(tr '\\0' ' ' < $p/cmdline)"; done; done | sort -u
4
+ then stop it and retry. Original error: ${y.message}`)}let g=String(n.pragma("journal_mode",{simple:!0})??"").toUpperCase();if(g!==a)throw n.close(),new Error(`[safe-db] journal_mode switch to '${a}' silently did not take on ${e} (still '${g}'). Refusing to write in an unsafe mode.`)}}}else l&&n.pragma("journal_mode = WAL");return n}var W=k(()=>{E();_()});export{H as a,W as b};
@@ -1,2 +1,2 @@
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.13.1");process.exit(0)}
2
- import{c as w,d as E,f as T}from"./chunk-OE4B6LDZ.js";var d=E((b,u)=>{"use strict";var _=typeof Buffer<"u",a=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,l=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function p(r,t,e){e==null&&t!==null&&typeof t=="object"&&(e=t,t=void 0),_&&Buffer.isBuffer(r)&&(r=r.toString()),r&&r.charCodeAt(0)===65279&&(r=r.slice(1));let o=JSON.parse(r,t);if(o===null||typeof o!="object")return o;let n=e&&e.protoAction||"error",c=e&&e.constructorAction||"error";if(n==="ignore"&&c==="ignore")return o;if(n!=="ignore"&&c!=="ignore"){if(a.test(r)===!1&&l.test(r)===!1)return o}else if(n!=="ignore"&&c==="ignore"){if(a.test(r)===!1)return o}else if(l.test(r)===!1)return o;return y(o,{protoAction:n,constructorAction:c,safe:e&&e.safe})}function y(r,{protoAction:t="error",constructorAction:e="error",safe:o}={}){let n=[r];for(;n.length;){let c=n;n=[];for(let s of c){if(t!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"__proto__")){if(o===!0)return null;if(t==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.__proto__}if(e!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"constructor")&&s.constructor!==null&&typeof s.constructor=="object"&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype")){if(o===!0)return null;if(e==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.constructor}for(let h in s){let f=s[h];f&&typeof f=="object"&&n.push(f)}}}return r}function i(r,t,e){let{stackTraceLimit:o}=Error;Error.stackTraceLimit=0;try{return p(r,t,e)}finally{Error.stackTraceLimit=o}}function m(r,t){let{stackTraceLimit:e}=Error;Error.stackTraceLimit=0;try{return p(r,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=e}}u.exports=i;u.exports.default=i;u.exports.parse=i;u.exports.safeParse=m;u.exports.scan=y});function F(r){return g.default.parse(r,void 0,{protoAction:"remove",constructorAction:"remove"})}function j(r,t){try{return F(r)}catch(e){throw new Error(`Invalid JSON in --${t}: ${e instanceof Error?e.message:"Parse error"}`)}}var g,O=w(()=>{"use strict";g=T(d(),1)});export{d as a,F as b,j as c,O as d};
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.13.3");process.exit(0)}
2
+ import{c as w,d as E,f as T}from"./chunk-62F5M5OO.js";var d=E((b,u)=>{"use strict";var _=typeof Buffer<"u",a=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,l=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function p(r,t,e){e==null&&t!==null&&typeof t=="object"&&(e=t,t=void 0),_&&Buffer.isBuffer(r)&&(r=r.toString()),r&&r.charCodeAt(0)===65279&&(r=r.slice(1));let o=JSON.parse(r,t);if(o===null||typeof o!="object")return o;let n=e&&e.protoAction||"error",c=e&&e.constructorAction||"error";if(n==="ignore"&&c==="ignore")return o;if(n!=="ignore"&&c!=="ignore"){if(a.test(r)===!1&&l.test(r)===!1)return o}else if(n!=="ignore"&&c==="ignore"){if(a.test(r)===!1)return o}else if(l.test(r)===!1)return o;return y(o,{protoAction:n,constructorAction:c,safe:e&&e.safe})}function y(r,{protoAction:t="error",constructorAction:e="error",safe:o}={}){let n=[r];for(;n.length;){let c=n;n=[];for(let s of c){if(t!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"__proto__")){if(o===!0)return null;if(t==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.__proto__}if(e!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"constructor")&&s.constructor!==null&&typeof s.constructor=="object"&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype")){if(o===!0)return null;if(e==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.constructor}for(let h in s){let f=s[h];f&&typeof f=="object"&&n.push(f)}}}return r}function i(r,t,e){let{stackTraceLimit:o}=Error;Error.stackTraceLimit=0;try{return p(r,t,e)}finally{Error.stackTraceLimit=o}}function m(r,t){let{stackTraceLimit:e}=Error;Error.stackTraceLimit=0;try{return p(r,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=e}}u.exports=i;u.exports.default=i;u.exports.parse=i;u.exports.safeParse=m;u.exports.scan=y});function F(r){return g.default.parse(r,void 0,{protoAction:"remove",constructorAction:"remove"})}function j(r,t){try{return F(r)}catch(e){throw new Error(`Invalid JSON in --${t}: ${e instanceof Error?e.message:"Parse error"}`)}}var g,O=w(()=>{"use strict";g=T(d(),1)});export{d as a,F as b,j as c,O as d};
@@ -1,5 +1,5 @@
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.13.1");process.exit(0)}
2
- import{a as I}from"./chunk-LTKNCYMO.js";import{l as F,m as q}from"./chunk-UCQ66N6M.js";import{a as A,b as m,c as d}from"./chunk-GTPZVLL6.js";import{a as b,b as W,c as O}from"./chunk-AYYDO52G.js";import{i as D}from"./chunk-ZIBW7CB4.js";import{g as T}from"./chunk-OE4B6LDZ.js";O();var w={WorkflowStarted:"workflow.WorkflowStarted",WorkflowCompleted:"workflow.WorkflowCompleted",WorkflowFailed:"workflow.WorkflowFailed",WorkflowCancelled:"workflow.WorkflowCancelled",StepStarted:"workflow.StepStarted",StepCompleted:"workflow.StepCompleted",StepFailed:"workflow.StepFailed",StepSkipped:"workflow.StepSkipped",StepAwaitingApproval:"workflow.StepAwaitingApproval",StepApproved:"workflow.StepApproved",StepRejected:"workflow.StepRejected"},E={maxConcurrentWorkflows:10,defaultStepTimeout:6e4,defaultWorkflowTimeout:6e5,enableEventTriggers:!0,persistExecutions:!0};function S(){try{let{getUnifiedMemory:s}=(q(),T(F)),e=s();return e.isInitialized()?e.getDatabase():null}catch{return null}}var N={id:"quality-gate-check",domain:"quality-assessment",action:"gate-check",async execute(s){let e=typeof s.coverageMin=="number"?s.coverageMin:80,t=typeof s.testsPassingMin=="number"?s.testsPassingMin:90,i=typeof s.maxBugs=="number"?s.maxBugs:5,r=typeof s.currentCoverage=="number"?s.currentCoverage:null,n=typeof s.currentTestsPassingRate=="number"?s.currentTestsPassingRate:null,o=typeof s.currentBugs=="number"?s.currentBugs:null;if(r===null||n===null||o===null){let p=S();if(p)try{if(r===null&&(r=p.prepare("SELECT after_lines FROM coverage_sessions ORDER BY created_at DESC LIMIT 1").get()?.after_lines??0),n===null){let y=p.prepare(`SELECT COUNT(*) as total,
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.13.3");process.exit(0)}
2
+ import{a as I}from"./chunk-RWPWD5GG.js";import{l as F,m as q}from"./chunk-DPJLA7JW.js";import{a as A,b as m,c as d}from"./chunk-ZU3XUBDQ.js";import{a as b,b as W,c as O}from"./chunk-XRF5MX4Q.js";import{i as D}from"./chunk-FF53QW6C.js";import{g as T}from"./chunk-62F5M5OO.js";O();var w={WorkflowStarted:"workflow.WorkflowStarted",WorkflowCompleted:"workflow.WorkflowCompleted",WorkflowFailed:"workflow.WorkflowFailed",WorkflowCancelled:"workflow.WorkflowCancelled",StepStarted:"workflow.StepStarted",StepCompleted:"workflow.StepCompleted",StepFailed:"workflow.StepFailed",StepSkipped:"workflow.StepSkipped",StepAwaitingApproval:"workflow.StepAwaitingApproval",StepApproved:"workflow.StepApproved",StepRejected:"workflow.StepRejected"},E={maxConcurrentWorkflows:10,defaultStepTimeout:6e4,defaultWorkflowTimeout:6e5,enableEventTriggers:!0,persistExecutions:!0};function S(){try{let{getUnifiedMemory:s}=(q(),T(F)),e=s();return e.isInitialized()?e.getDatabase():null}catch{return null}}var N={id:"quality-gate-check",domain:"quality-assessment",action:"gate-check",async execute(s){let e=typeof s.coverageMin=="number"?s.coverageMin:80,t=typeof s.testsPassingMin=="number"?s.testsPassingMin:90,i=typeof s.maxBugs=="number"?s.maxBugs:5,r=typeof s.currentCoverage=="number"?s.currentCoverage:null,n=typeof s.currentTestsPassingRate=="number"?s.currentTestsPassingRate:null,o=typeof s.currentBugs=="number"?s.currentBugs:null;if(r===null||n===null||o===null){let p=S();if(p)try{if(r===null&&(r=p.prepare("SELECT after_lines FROM coverage_sessions ORDER BY created_at DESC LIMIT 1").get()?.after_lines??0),n===null){let y=p.prepare(`SELECT COUNT(*) as total,
3
3
  SUM(CASE WHEN passed = 1 THEN 1 ELSE 0 END) as passed
4
4
  FROM test_outcomes
5
5
  WHERE created_at > datetime('now', '-7 days')`).get();n=y&&y.total>0?y.passed/y.total*100:0}o===null&&(o=p.prepare(`SELECT COUNT(*) as bugs FROM test_outcomes
@@ -1,2 +1,2 @@
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.13.1");process.exit(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.13.3");process.exit(0)}
2
2
  function r(e,f){if(e==null)return e;let n={...e};for(let t of f){let o=n[t];typeof o=="string"&&(n[t]=new Date(o))}return n}export{r as a};
@@ -1,5 +1,5 @@
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.13.1");process.exit(0)}
2
- import{a as w,b as A,c as O,e as D,f as z}from"./chunk-WWP2VXYJ.js";import{b as S,d as $}from"./chunk-ZLCATRXI.js";import{a as N,c as F}from"./chunk-AYYDO52G.js";import{i as v}from"./chunk-ZIBW7CB4.js";import*as I from"node:path";z();$();var P=["function","module","test","file","class"],L=["calls","imports","tests","depends_on","covers"],b=class{ensureSchema(e){e.transaction(()=>{e.exec(w),e.exec(A),e.exec(O)})()}schemaExists(e){return D(e)}getNodeTypes(){return P}getEdgeTypes(){return L}isValidNodeType(e){return P.includes(e)}isValidEdgeType(e){return L.includes(e)}getStats(e){if(!this.schemaExists(e))return{nodeCount:0,edgeCount:0};let t=e.prepare("SELECT COUNT(*) as count FROM hypergraph_nodes").get().count,r=e.prepare("SELECT COUNT(*) as count FROM hypergraph_edges").get().count;return{nodeCount:t,edgeCount:r}}dropSchema(e){let t=e.prepare("SELECT COUNT(*) as cnt FROM hypergraph_nodes").get()?.cnt??0,r=e.prepare("SELECT COUNT(*) as cnt FROM hypergraph_edges").get()?.cnt??0;if(t>0||r>0)throw new Error(`REFUSING to drop hypergraph schema: tables contain data (${t} nodes, ${r} edges). Backup and manually drop if needed.`);e.transaction(()=>{e.exec("DROP TABLE IF EXISTS hypergraph_edges"),e.exec("DROP TABLE IF EXISTS hypergraph_nodes")})()}};function C(n){return{id:n.id,type:n.type,name:n.name,file_path:n.filePath??null,line_start:n.lineStart??null,line_end:n.lineEnd??null,complexity:n.complexity??null,coverage:n.coverage??null,metadata:n.metadata?JSON.stringify(n.metadata):null,embedding:n.embedding?U(n.embedding):null}}function T(n){return{id:n.id,type:n.type,name:n.name,filePath:n.file_path??void 0,lineStart:n.line_start??void 0,lineEnd:n.line_end??void 0,complexity:n.complexity??void 0,coverage:n.coverage??void 0,metadata:n.metadata?S(n.metadata):void 0,embedding:n.embedding?W(n.embedding):void 0,createdAt:n.created_at,updatedAt:n.updated_at}}function M(n){return{id:n.id,source_id:n.sourceId,target_id:n.targetId,type:n.type,weight:n.weight??1,properties:n.properties?JSON.stringify(n.properties):null}}function H(n){return{id:n.id,sourceId:n.source_id,targetId:n.target_id,type:n.type,weight:n.weight,properties:n.properties?S(n.properties):void 0,createdAt:n.created_at}}function x(n,e,t){return`${n}--${t}-->${e}`}function U(n){let e=Buffer.alloc(n.length*4);for(let t=0;t<n.length;t++)e.writeFloatLE(n[t],t*4);return e}function W(n){let e=[],t=n.length/4;for(let r=0;r<t;r++)e.push(n.readFloatLE(r*4));return e}F();var B={maxTraversalDepth:10,maxQueryResults:1e3,enableVectorSearch:!1},R=class{config;schemaManager;initialized=!1;constructor(e){this.config={...B,...e},this.schemaManager=new b}async initialize(){this.initialized||(this.schemaManager.ensureSchema(this.config.db),this.initialized=!0)}isInitialized(){return this.initialized}async addNode(e){this.ensureInitialized();let t=v(),r={id:t,...e},s=C(r);return this.config.db.prepare(`
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.13.3");process.exit(0)}
2
+ import{a as w,b as A,c as O,e as D,f as z}from"./chunk-CW7BWFFF.js";import{b as S,d as $}from"./chunk-2G2XD6EM.js";import{a as N,c as F}from"./chunk-XRF5MX4Q.js";import{i as v}from"./chunk-FF53QW6C.js";import*as I from"node:path";z();$();var P=["function","module","test","file","class"],L=["calls","imports","tests","depends_on","covers"],b=class{ensureSchema(e){e.transaction(()=>{e.exec(w),e.exec(A),e.exec(O)})()}schemaExists(e){return D(e)}getNodeTypes(){return P}getEdgeTypes(){return L}isValidNodeType(e){return P.includes(e)}isValidEdgeType(e){return L.includes(e)}getStats(e){if(!this.schemaExists(e))return{nodeCount:0,edgeCount:0};let t=e.prepare("SELECT COUNT(*) as count FROM hypergraph_nodes").get().count,r=e.prepare("SELECT COUNT(*) as count FROM hypergraph_edges").get().count;return{nodeCount:t,edgeCount:r}}dropSchema(e){let t=e.prepare("SELECT COUNT(*) as cnt FROM hypergraph_nodes").get()?.cnt??0,r=e.prepare("SELECT COUNT(*) as cnt FROM hypergraph_edges").get()?.cnt??0;if(t>0||r>0)throw new Error(`REFUSING to drop hypergraph schema: tables contain data (${t} nodes, ${r} edges). Backup and manually drop if needed.`);e.transaction(()=>{e.exec("DROP TABLE IF EXISTS hypergraph_edges"),e.exec("DROP TABLE IF EXISTS hypergraph_nodes")})()}};function C(n){return{id:n.id,type:n.type,name:n.name,file_path:n.filePath??null,line_start:n.lineStart??null,line_end:n.lineEnd??null,complexity:n.complexity??null,coverage:n.coverage??null,metadata:n.metadata?JSON.stringify(n.metadata):null,embedding:n.embedding?U(n.embedding):null}}function T(n){return{id:n.id,type:n.type,name:n.name,filePath:n.file_path??void 0,lineStart:n.line_start??void 0,lineEnd:n.line_end??void 0,complexity:n.complexity??void 0,coverage:n.coverage??void 0,metadata:n.metadata?S(n.metadata):void 0,embedding:n.embedding?W(n.embedding):void 0,createdAt:n.created_at,updatedAt:n.updated_at}}function M(n){return{id:n.id,source_id:n.sourceId,target_id:n.targetId,type:n.type,weight:n.weight??1,properties:n.properties?JSON.stringify(n.properties):null}}function H(n){return{id:n.id,sourceId:n.source_id,targetId:n.target_id,type:n.type,weight:n.weight,properties:n.properties?S(n.properties):void 0,createdAt:n.created_at}}function x(n,e,t){return`${n}--${t}-->${e}`}function U(n){let e=Buffer.alloc(n.length*4);for(let t=0;t<n.length;t++)e.writeFloatLE(n[t],t*4);return e}function W(n){let e=[],t=n.length/4;for(let r=0;r<t;r++)e.push(n.readFloatLE(r*4));return e}F();var B={maxTraversalDepth:10,maxQueryResults:1e3,enableVectorSearch:!1},R=class{config;schemaManager;initialized=!1;constructor(e){this.config={...B,...e},this.schemaManager=new b}async initialize(){this.initialized||(this.schemaManager.ensureSchema(this.config.db),this.initialized=!0)}isInitialized(){return this.initialized}async addNode(e){this.ensureInitialized();let t=v(),r={id:t,...e},s=C(r);return this.config.db.prepare(`
3
3
  INSERT INTO hypergraph_nodes (id, type, name, file_path, line_start, line_end, complexity, coverage, metadata, embedding)
4
4
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
5
5
  `).run(s.id,s.type,s.name,s.file_path,s.line_start,s.line_end,s.complexity,s.coverage,s.metadata,s.embedding),t}async addEdge(e){this.ensureInitialized();let t=x(e.sourceId,e.targetId,e.type),r={id:t,...e},s=M(r);return this.config.db.prepare(`
@@ -1,3 +1,3 @@
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.13.1");process.exit(0)}
2
- import{a as L}from"./chunk-GTPZVLL6.js";import*as w from"fs";var R={"aqe test generate":{domain:"test-generation",action:"generateTests"},"aqe test execute":{domain:"test-execution",action:"execute"},"aqe coverage analyze":{domain:"coverage-analysis",action:"analyze"},"aqe coverage gaps":{domain:"coverage-analysis",action:"detectGaps"},"aqe quality gate":{domain:"quality-assessment",action:"evaluateGate"},"aqe quality assess":{domain:"quality-assessment",action:"analyzeQuality"},"aqe security scan":{domain:"security-compliance",action:"runSASTScan"},"aqe security audit":{domain:"security-compliance",action:"runAudit"},"aqe defect predict":{domain:"defect-intelligence",action:"predictDefects"},"aqe code index":{domain:"code-intelligence",action:"index"},"aqe code impact":{domain:"code-intelligence",action:"analyzeImpact"},"aqe contract validate":{domain:"contract-testing",action:"validateContract"},"aqe chaos test":{domain:"chaos-resilience",action:"runChaosTest"},"aqe requirements validate":{domain:"requirements-validation",action:"validateRequirements"},"aqe visual test":{domain:"visual-accessibility",action:"runVisualTest"},"aqe accessibility test":{domain:"visual-accessibility",action:"runAccessibilityTest"},"aqe learn optimize":{domain:"learning-optimization",action:"optimizeAllStrategies"}},D={daily:"0 0 * * *",weekly:"0 0 * * 0",hourly:"0 * * * *",minutely:"* * * * *"},x=1e4,M=20,S=1e4,W=["__proto__","constructor","prototype"];function v(t){return!W.includes(t)}function C(t){let n=t.split(`
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.13.3");process.exit(0)}
2
+ import{a as L}from"./chunk-ZU3XUBDQ.js";import*as w from"fs";var R={"aqe test generate":{domain:"test-generation",action:"generateTests"},"aqe test execute":{domain:"test-execution",action:"execute"},"aqe coverage analyze":{domain:"coverage-analysis",action:"analyze"},"aqe coverage gaps":{domain:"coverage-analysis",action:"detectGaps"},"aqe quality gate":{domain:"quality-assessment",action:"evaluateGate"},"aqe quality assess":{domain:"quality-assessment",action:"analyzeQuality"},"aqe security scan":{domain:"security-compliance",action:"runSASTScan"},"aqe security audit":{domain:"security-compliance",action:"runAudit"},"aqe defect predict":{domain:"defect-intelligence",action:"predictDefects"},"aqe code index":{domain:"code-intelligence",action:"index"},"aqe code impact":{domain:"code-intelligence",action:"analyzeImpact"},"aqe contract validate":{domain:"contract-testing",action:"validateContract"},"aqe chaos test":{domain:"chaos-resilience",action:"runChaosTest"},"aqe requirements validate":{domain:"requirements-validation",action:"validateRequirements"},"aqe visual test":{domain:"visual-accessibility",action:"runVisualTest"},"aqe accessibility test":{domain:"visual-accessibility",action:"runAccessibilityTest"},"aqe learn optimize":{domain:"learning-optimization",action:"optimizeAllStrategies"}},D={daily:"0 0 * * *",weekly:"0 0 * * 0",hourly:"0 * * * *",minutely:"* * * * *"},x=1e4,M=20,S=1e4,W=["__proto__","constructor","prototype"];function v(t){return!W.includes(t)}function C(t){let n=t.split(`
3
3
  `);if(n.length>x)throw new Error(`YAML content exceeds maximum allowed lines (${x}). File has ${n.length} lines.`);for(let i=0;i<n.length;i++)if(n[i].length>S)throw new Error(`YAML line ${i+1} exceeds maximum allowed length (${S} characters).`);let a={};for(let i=0;i<n.length;i++){let e=n[i];if(e.trim()===""||e.trim().startsWith("#")||e.search(/\S/)!==0)continue;let o=e.match(/^([\w_-]+):\s*(.+)$/);if(o){let[,c,u]=o;v(c)&&(a[c]=f(u))}}let r=["tags","stages","triggers"];for(let i of r){let e=new RegExp(`^${i}:\\s*$`),s=-1;for(let l=0;l<n.length;l++){let d=n[l];if(!(d.trim()===""||d.trim().startsWith("#"))&&e.test(d.trim())){s=l;break}}if(s===-1)continue;let o=[];a[i]=o;let c=n[s].search(/\S/),u=s+1;for(;u<n.length;){let l=n[u];if(l.trim()===""||l.trim().startsWith("#")){u++;continue}let d=l.search(/\S/),p=l.trim();if(d<=c&&!p.startsWith("-"))break;if(p.startsWith("- ")){let m=p.slice(2).trim();if(!m.includes(":")){o.push(f(m)),u++;continue}let g={},k=m.match(/^([\w_-]+):\s*(.*)$/);if(k){let[,h,y]=k;g[h]=f(y)}let T=d;for(u++;u<n.length;){let h=n[u];if(h.trim()===""||h.trim().startsWith("#")){u++;continue}let y=h.search(/\S/),q=h.trim();if(y<=T)break;let _=q.match(/^([\w_-]+):\s*(.*)$/);if(_){let[,A,$]=_;if($===""){let b=E(n,u+1,y,1);g[A]=b.value,u=b.nextLine;continue}else g[A]=f($)}u++}o.push(g)}else u++}}return a}function E(t,n,a,r=0){if(r>M)throw new Error(`YAML nesting exceeds maximum allowed depth (${M}).`);let i={},e=null,s=null,o=n;for(;o<t.length;){let u=t[o];if(u.trim()===""||u.trim().startsWith("#")){o++;continue}let l=u.search(/\S/),d=u.trim();if(l<=a)break;if(d.startsWith("- ")){let m=d.slice(2).trim();s&&!Array.isArray(i[s])&&(i[s]=[]),s?i[s].push(f(m)):(e||(e=[]),e.push(f(m))),o++;continue}let p=d.match(/^([\w_-]+):\s*(.*)$/);if(p){let[,m,g]=p;if(!v(m)){o++;continue}g===""?(s=m,i[m]=[]):(i[m]=f(g),s=null)}o++}if(e&&Object.keys(i).length===0)return{value:e,nextLine:o};let c=Object.keys(i);return c.length===1&&Array.isArray(i[c[0]])?{value:i[c[0]],nextLine:o}:{value:i,nextLine:o}}function f(t){if(t==="")return"";if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t==="true")return!0;if(t==="false")return!1;if(t==="null"||t==="~")return null;let n=Number(t);return!isNaN(n)&&t!==""?n:t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1).split(",").map(r=>f(r.trim())):t}function K(t){let n=[];if(!w.existsSync(t))return{success:!1,errors:[`File not found: ${t}`]};let a;try{a=w.readFileSync(t,"utf-8")}catch(r){return{success:!1,errors:[`Failed to read file: ${r}`]}}return Y(a,t)}function Y(t,n){let a=[],r;try{r=C(t)}catch(s){return{success:!1,errors:[`Invalid YAML syntax: ${s}`]}}if((!r.name||typeof r.name!="string")&&a.push('Pipeline must have a "name" field'),(!r.stages||!Array.isArray(r.stages))&&a.push('Pipeline must have a "stages" array'),a.length>0)return{success:!1,errors:a};let i={name:r.name,description:r.description,version:r.version||"1.0.0",schedule:r.schedule,stages:r.stages.map((s,o)=>{let c=s;return{name:c.name||`stage-${o}`,command:c.command,params:c.params,depends_on:c.depends_on,condition:c.condition,timeout:c.timeout,retry:c.retry,continue_on_failure:c.continue_on_failure}}),triggers:r.triggers,tags:r.tags,timeout:r.timeout};for(let s=0;s<i.stages.length;s++){let o=i.stages[s];o.command||a.push(`Stage ${s+1} (${o.name}) must have a "command" field`)}if(a.length>0)return{success:!1,pipeline:i,errors:a};let e=O(i,n);return{success:!0,pipeline:i,workflow:e,errors:[]}}function O(t,n){let a=`pipeline-${t.name.replace(/\s+/g,"-").toLowerCase()}`,r=t.stages.map((e,s)=>{let o=P(e.command),c={};if(e.params)for(let[l,d]of Object.entries(e.params))v(l)&&(c[l]=`input.${l}`);let u={id:`stage-${e.name.replace(/\s+/g,"-").toLowerCase()}`,name:e.name,domain:o.domain,action:o.action,inputMapping:Object.keys(c).length>0?c:void 0,dependsOn:e.depends_on?.map(l=>`stage-${l.replace(/\s+/g,"-").toLowerCase()}`),timeout:e.timeout?e.timeout*1e3:void 0,continueOnFailure:e.continue_on_failure};return e.condition&&(u.condition={path:e.condition.path,operator:e.condition.operator,value:e.condition.value}),e.retry&&(u.retry={maxAttempts:e.retry.max_attempts||3,backoffMs:(e.retry.backoff_seconds||1)*1e3}),u}),i=t.triggers?.map(e=>{let s={eventType:I(e),sourceDomain:e.source_domain};return e.condition&&(s.condition={path:e.condition.path,operator:e.condition.operator,value:e.condition.value}),s});return{id:a,name:t.name,description:t.description||`Pipeline from ${n||"inline YAML"}`,version:t.version||"1.0.0",steps:r,triggers:i,tags:t.tags,timeout:t.timeout?t.timeout*1e3:void 0}}function P(t){let n=t.trim().replace(/\s+/g," ").toLowerCase();for(let[a,r]of Object.entries(R))if(n.startsWith(a.toLowerCase()))return r;return n.includes("test")&&n.includes("generate")?{domain:"test-generation",action:"generateTests"}:n.includes("test")&&(n.includes("execute")||n.includes("run"))?{domain:"test-execution",action:"execute"}:n.includes("coverage")?{domain:"coverage-analysis",action:"analyze"}:n.includes("quality")||n.includes("gate")?{domain:"quality-assessment",action:"evaluateGate"}:n.includes("security")||n.includes("scan")?{domain:"security-compliance",action:"runSASTScan"}:n.includes("defect")||n.includes("predict")?{domain:"defect-intelligence",action:"predictDefects"}:{domain:"learning-optimization",action:"runLearningCycle"}}function I(t){let n=t.event.toLowerCase();return n==="push"?"code-intelligence.CodePushed":n==="pull_request"||n==="pr"?"code-intelligence.PullRequestOpened":n==="schedule"?"workflow.ScheduleTrigger":n==="quality_gate"?"quality-assessment.QualityGateEvaluated":n==="test_complete"?"test-execution.TestRunCompleted":n}function F(t){let n=[],a=[];if(t.name||n.push({path:"name",message:"Pipeline name is required",severity:"error"}),!t.stages||t.stages.length===0)n.push({path:"stages",message:"Pipeline must have at least one stage",severity:"error"});else{let r=new Set;for(let e=0;e<t.stages.length;e++){let s=t.stages[e],o=`stages[${e}]`;if(r.has(s.name)&&n.push({path:`${o}.name`,message:`Duplicate stage name: ${s.name}`,severity:"error"}),r.add(s.name),s.command?P(s.command).domain==="learning-optimization"&&!s.command.toLowerCase().includes("learn")&&a.push({path:`${o}.command`,message:`Command "${s.command}" not recognized, will default to learning-optimization domain`,severity:"warning"}):n.push({path:`${o}.command`,message:"Stage must have a command",severity:"error"}),s.depends_on)for(let c of s.depends_on)t.stages.some(u=>u.name===c)||n.push({path:`${o}.depends_on`,message:`Unknown dependency: ${c}`,severity:"error"});s.timeout!==void 0&&s.timeout<=0&&n.push({path:`${o}.timeout`,message:"Timeout must be a positive number",severity:"error"}),s.retry&&s.retry.max_attempts!==void 0&&s.retry.max_attempts<1&&n.push({path:`${o}.retry.max_attempts`,message:"max_attempts must be at least 1",severity:"error"})}let i=N(t.stages);i&&n.push({path:"stages",message:`Circular dependency detected: ${i}`,severity:"error"})}if(t.schedule&&(z(t.schedule)||n.push({path:"schedule",message:`Invalid cron expression: ${t.schedule}`,severity:"error"})),t.triggers)for(let r=0;r<t.triggers.length;r++){let i=t.triggers[r],e=`triggers[${r}]`;i.event||n.push({path:`${e}.event`,message:"Trigger must have an event type",severity:"error"}),i.source_domain&&!L.includes(i.source_domain)&&a.push({path:`${e}.source_domain`,message:`Unknown domain: ${i.source_domain}`,severity:"warning"})}return{valid:n.length===0,errors:n,warnings:a}}function N(t){let n=new Set,a=new Set,r=(i,e)=>{if(a.has(i))return[...e,i].join(" -> ");if(n.has(i))return null;n.add(i),a.add(i);let s=t.find(o=>o.name===i);if(s?.depends_on)for(let o of s.depends_on){let c=r(o,[...e,i]);if(c)return c}return a.delete(i),null};for(let i of t){let e=r(i.name,[]);if(e)return e}return null}function z(t){if(Object.keys(D).includes(t))return!0;let n=t.trim().split(/\s+/);if(n.length!==5)return!1;let a=[/^(\*|[0-5]?\d)(-[0-5]?\d)?(\/\d+)?$/,/^(\*|1?\d|2[0-3])(-\d+)?(\/\d+)?$/,/^(\*|[1-9]|[12]\d|3[01])(-\d+)?(\/\d+)?$/,/^(\*|[1-9]|1[0-2])(-\d+)?(\/\d+)?$/,/^(\*|[0-7])(-[0-7])?(\/\d+)?$/];for(let r=0;r<5;r++){let i=n[r].split(",");for(let e of i)if(!a[r].test(e)&&e!=="*")return!1}return!0}function G(t){let n={"@daily":"Daily at midnight","@weekly":"Weekly on Sunday at midnight","@hourly":"Every hour","@minutely":"Every minute"};if(n[t])return n[t];if(Object.keys(D).includes(t))return{daily:"Daily at midnight",weekly:"Weekly on Sunday at midnight",hourly:"Every hour",minutely:"Every minute"}[t]||t;let a=t.trim().split(/\s+/);if(a.length!==5)return t;let[r,i,e,s,o]=a;return r==="0"&&i==="0"&&e==="*"&&s==="*"&&o==="*"?"Daily at midnight":r==="0"&&e==="*"&&s==="*"&&o==="*"?`Daily at ${i}:00`:r!=="*"&&i!=="*"&&e==="*"&&s==="*"?`Daily at ${i}:${r.padStart(2,"0")}`:i==="*"&&r==="0"?"Every hour":r!=="*"&&i==="*"?`Every hour at minute ${r}`:t}function H(t,n=new Date){let a=t.trim().split(/\s+/);if(a.length!==5)return new Date(n.getTime()+1440*60*1e3);let[r,i]=a,e=new Date(n);return i!=="*"&&r!=="*"?(e.setHours(parseInt(i,10),parseInt(r,10),0,0),e<=n&&e.setDate(e.getDate()+1)):i!=="*"?(e.setHours(parseInt(i,10),0,0,0),e<=n&&e.setDate(e.getDate()+1)):r!=="*"?(e.setMinutes(parseInt(r,10),0,0),e<=n&&e.setHours(e.getHours()+1)):(e.setSeconds(0,0),e.setMinutes(e.getMinutes()+1)),e}export{C as a,K as b,F as c,G as d,H as e};
@@ -1,2 +1,2 @@
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.13.1");process.exit(0)}
2
- import{a as v,b as k}from"./chunk-HUMQU4ES.js";import{i as g,m as P}from"./chunk-UCQ66N6M.js";import{a as d,b as y,c as R}from"./chunk-AYYDO52G.js";R();import{randomUUID as M}from"crypto";var p=class{constructor(e){this.config=e}config;_status="idle";_lastResult;_lastRunAt;_nextRunAt;_totalExecutions=0;_successfulExecutions=0;_failedExecutions=0;_executionDurations=[];_recentResults=[];get status(){return this._status}get lastResult(){return this._lastResult}get lastRunAt(){return this._lastRunAt}get nextRunAt(){return this._nextRunAt}async initialize(){this._status="idle",this._nextRunAt=new Date(Date.now()+this.config.intervalMs)}async execute(e){let r=Date.now();this._status="running",this._lastRunAt=new Date,this._totalExecutions++;let n,t;for(let a=0;a<=this.config.retryCount;a++)try{if(e.signal.aborted)throw new Error("Worker execution aborted");t=await this.executeWithTimeout(()=>this.doExecute(e),this.config.timeoutMs,e.signal);break}catch(u){n=y(u),e.logger.warn(`Worker ${this.config.id} attempt ${a+1} failed: ${n.message}`),a<this.config.retryCount&&await this.delay(this.config.retryDelayMs)}let o=Date.now()-r;return t?(this._successfulExecutions++,this._lastResult=t):(this._failedExecutions++,t=this.createErrorResult(n,o),this._lastResult=t),this._executionDurations.push(o),this._executionDurations.length>100&&this._executionDurations.shift(),this._recentResults.push({timestamp:new Date,success:t.success,durationMs:o}),this._recentResults.length>5&&this._recentResults.shift(),this._nextRunAt=new Date(Date.now()+this.config.intervalMs),this._status=t.success?"idle":"error",await e.eventBus.publish({type:"worker.executed",workerId:this.config.id,timestamp:new Date,payload:{success:t.success,durationMs:o,findingsCount:t.findings.length,healthScore:t.metrics.healthScore}}),t}pause(){this._status!=="stopped"&&(this._status="paused")}resume(){this._status==="paused"&&(this._status="idle")}async stop(){this._status="stopped"}getHealth(){let e=this._executionDurations.length>0?this._executionDurations.reduce((n,t)=>n+t,0)/this._executionDurations.length:0,r=this._totalExecutions>0?this._successfulExecutions/this._totalExecutions:1;return{status:this._status,healthScore:Math.round(r*100),totalExecutions:this._totalExecutions,successfulExecutions:this._successfulExecutions,failedExecutions:this._failedExecutions,avgDurationMs:Math.round(e),recentResults:[...this._recentResults]}}async executeWithTimeout(e,r,n){return new Promise((t,o)=>{let a=setTimeout(()=>{o(new Error(`Worker execution timed out after ${r}ms`))},r),u=()=>{clearTimeout(a),o(new Error("Worker execution aborted"))};n.addEventListener("abort",u,{once:!0}),e().then(c=>{clearTimeout(a),n.removeEventListener("abort",u),t(c)}).catch(c=>{clearTimeout(a),n.removeEventListener("abort",u),o(c)})})}createErrorResult(e,r){return{workerId:this.config.id,timestamp:new Date,durationMs:r,success:!1,error:e.message,metrics:{itemsAnalyzed:0,issuesFound:0,healthScore:0,trend:"degrading",domainMetrics:{}},findings:[],recommendations:[]}}createResult(e,r,n,t){return{workerId:this.config.id,timestamp:new Date,durationMs:e,success:!0,metrics:r,findings:n,recommendations:t}}delay(e){return new Promise(r=>setTimeout(r,e))}generateId(){return`${Date.now()}-${M().slice(0,9)}`}};P();R();var W={id:"heartbeat-scheduler",name:"Heartbeat Scheduler",description:"Token-free maintenance: pattern promotion, stale detection, experience buffer monitoring",intervalMs:1800*1e3,priority:"normal",targetDomains:["learning-optimization"],enabled:!0,timeoutMs:6e4,retryCount:1,retryDelayMs:5e3},b=class extends p{lifecycleManager=null;dailyLogger;lastRunTimestamp=0;constructor(){super(W),this.dailyLogger=new k}async getLifecycleManager(){if(this.lifecycleManager)return this.lifecycleManager;try{let e=g();await e.initialize();let r=e.getDatabase();return this.lifecycleManager=v(r,{promotionRewardThreshold:.7,promotionMinOccurrences:2,promotionMinSuccessRate:.7,deprecationFailureThreshold:3,staleDaysThreshold:30,confidenceDecayRate:.01,minActiveConfidence:.3}),this.lifecycleManager}catch{return null}}getPendingExperienceCount(){try{return g().getDatabase().prepare("SELECT COUNT(*) as pending FROM qe_pattern_usage WHERE created_at > datetime('now', '-1 day')").get()?.pending??0}catch{return 0}}async doExecute(e){let r=Date.now();e.logger.info("Heartbeat scheduler running (token-free maintenance)");let n=[],t=[],o=await this.getLifecycleManager();if(!o)return e.logger.warn("Unified memory unavailable \u2014 returning zero-metric heartbeat"),this.createResult(Date.now()-r,{itemsAnalyzed:0,issuesFound:0,healthScore:50,trend:"stable",domainMetrics:{promoted:0,deprecated:0,decayed:0,stalePatterns:0,pendingExperiences:0,avgConfidence:0,avgSuccessRate:0}},[],[]);let a=0,u=0;try{let s=o.promoteEligiblePatterns();a=s.promoted,u=s.checked,a>0&&n.push({type:"heartbeat-promotion",severity:"info",domain:"learning-optimization",title:"Patterns Promoted",description:`${a} of ${u} short-term patterns promoted to long-term`})}catch(s){e.logger.warn("Pattern promotion failed",{error:d(s)})}let c=0,h=0;try{let s=o.deprecateStalePatterns();c=s.deprecated,h=s.checked,c>0&&n.push({type:"heartbeat-deprecation",severity:"low",domain:"learning-optimization",title:"Stale Patterns Deprecated",description:`${c} of ${h} patterns deprecated (stale, failed, or low confidence)`})}catch(s){e.logger.warn("Stale pattern detection failed",{error:d(s)})}let l=0;try{let s=this.lastRunTimestamp>0?(Date.now()-this.lastRunTimestamp)/864e5:1;l=o.applyConfidenceDecay(Math.min(s,7)).decayed}catch(s){e.logger.warn("Confidence decay failed",{error:d(s)})}let m=this.getPendingExperienceCount(),i={totalPatterns:0,activePatterns:0,deprecatedPatterns:0,promotedPatterns:0,shortTermPatterns:0,longTermPatterns:0,avgConfidence:0,avgSuccessRate:0,patternsNearDeprecation:0};try{i=o.getStats()}catch(s){e.logger.warn("Stats retrieval failed",{error:d(s)})}try{this.dailyLogger.log({timestamp:new Date,type:"pattern-promoted",summary:`Heartbeat: ${a} promoted, ${c} deprecated, ${l} decayed, ${m} pending exp, ${i.activePatterns} active patterns (avg conf: ${i.avgConfidence.toFixed(2)})`,details:{promoted:a,deprecated:c,decayed:l,pendingExperiences:m,totalPatterns:i.totalPatterns,activePatterns:i.activePatterns,avgConfidence:i.avgConfidence,avgSuccessRate:i.avgSuccessRate}}),this.dailyLogger.flush()}catch(s){e.logger.warn("Daily log write failed",{error:d(s)})}this.lastRunTimestamp=Date.now(),i.activePatterns>0&&i.patternsNearDeprecation/i.activePatterns>.5&&t.push({priority:"p2",domain:"learning-optimization",action:"Review At-Risk Patterns",description:`${i.patternsNearDeprecation} of ${i.activePatterns} active patterns are near deprecation. Manual review recommended.`,estimatedImpact:"medium",effort:"low",autoFixable:!1});let f=this.calculateHealthScore(i,a,c),D=this.determineTrend(a,c,i.activePatterns),_=Math.max(u,h),x=a+c+i.patternsNearDeprecation;return e.logger.info("Heartbeat complete",{promoted:a,deprecated:c,decayed:l,pendingExperiences:m,healthScore:f}),this.createResult(Date.now()-r,{itemsAnalyzed:_,issuesFound:x,healthScore:f,trend:D,domainMetrics:{promoted:a,deprecated:c,decayed:l,stalePatterns:i.patternsNearDeprecation,pendingExperiences:m,avgConfidence:Number(i.avgConfidence.toFixed(3)),avgSuccessRate:Number(i.avgSuccessRate.toFixed(3))}},n,t)}calculateHealthScore(e,r,n){let t=70;if(t+=Math.min(15,r*5),e.avgConfidence>0&&(t+=Math.round((e.avgConfidence-.5)*30)),e.activePatterns>0){let o=n/e.activePatterns;t-=Math.round(o*20)}return e.activePatterns>0&&e.patternsNearDeprecation/e.activePatterns>.5&&(t-=10),Math.max(0,Math.min(100,Math.round(t)))}determineTrend(e,r,n){return n===0?"stable":e>r?"improving":r>e&&r/n>.1?"degrading":"stable"}};export{p as a,b};
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.13.3");process.exit(0)}
2
+ import{a as v,b as k}from"./chunk-JQTDNUHA.js";import{i as g,m as P}from"./chunk-DPJLA7JW.js";import{a as d,b as y,c as R}from"./chunk-XRF5MX4Q.js";R();import{randomUUID as M}from"crypto";var p=class{constructor(e){this.config=e}config;_status="idle";_lastResult;_lastRunAt;_nextRunAt;_totalExecutions=0;_successfulExecutions=0;_failedExecutions=0;_executionDurations=[];_recentResults=[];get status(){return this._status}get lastResult(){return this._lastResult}get lastRunAt(){return this._lastRunAt}get nextRunAt(){return this._nextRunAt}async initialize(){this._status="idle",this._nextRunAt=new Date(Date.now()+this.config.intervalMs)}async execute(e){let r=Date.now();this._status="running",this._lastRunAt=new Date,this._totalExecutions++;let n,t;for(let a=0;a<=this.config.retryCount;a++)try{if(e.signal.aborted)throw new Error("Worker execution aborted");t=await this.executeWithTimeout(()=>this.doExecute(e),this.config.timeoutMs,e.signal);break}catch(u){n=y(u),e.logger.warn(`Worker ${this.config.id} attempt ${a+1} failed: ${n.message}`),a<this.config.retryCount&&await this.delay(this.config.retryDelayMs)}let o=Date.now()-r;return t?(this._successfulExecutions++,this._lastResult=t):(this._failedExecutions++,t=this.createErrorResult(n,o),this._lastResult=t),this._executionDurations.push(o),this._executionDurations.length>100&&this._executionDurations.shift(),this._recentResults.push({timestamp:new Date,success:t.success,durationMs:o}),this._recentResults.length>5&&this._recentResults.shift(),this._nextRunAt=new Date(Date.now()+this.config.intervalMs),this._status=t.success?"idle":"error",await e.eventBus.publish({type:"worker.executed",workerId:this.config.id,timestamp:new Date,payload:{success:t.success,durationMs:o,findingsCount:t.findings.length,healthScore:t.metrics.healthScore}}),t}pause(){this._status!=="stopped"&&(this._status="paused")}resume(){this._status==="paused"&&(this._status="idle")}async stop(){this._status="stopped"}getHealth(){let e=this._executionDurations.length>0?this._executionDurations.reduce((n,t)=>n+t,0)/this._executionDurations.length:0,r=this._totalExecutions>0?this._successfulExecutions/this._totalExecutions:1;return{status:this._status,healthScore:Math.round(r*100),totalExecutions:this._totalExecutions,successfulExecutions:this._successfulExecutions,failedExecutions:this._failedExecutions,avgDurationMs:Math.round(e),recentResults:[...this._recentResults]}}async executeWithTimeout(e,r,n){return new Promise((t,o)=>{let a=setTimeout(()=>{o(new Error(`Worker execution timed out after ${r}ms`))},r),u=()=>{clearTimeout(a),o(new Error("Worker execution aborted"))};n.addEventListener("abort",u,{once:!0}),e().then(c=>{clearTimeout(a),n.removeEventListener("abort",u),t(c)}).catch(c=>{clearTimeout(a),n.removeEventListener("abort",u),o(c)})})}createErrorResult(e,r){return{workerId:this.config.id,timestamp:new Date,durationMs:r,success:!1,error:e.message,metrics:{itemsAnalyzed:0,issuesFound:0,healthScore:0,trend:"degrading",domainMetrics:{}},findings:[],recommendations:[]}}createResult(e,r,n,t){return{workerId:this.config.id,timestamp:new Date,durationMs:e,success:!0,metrics:r,findings:n,recommendations:t}}delay(e){return new Promise(r=>setTimeout(r,e))}generateId(){return`${Date.now()}-${M().slice(0,9)}`}};P();R();var W={id:"heartbeat-scheduler",name:"Heartbeat Scheduler",description:"Token-free maintenance: pattern promotion, stale detection, experience buffer monitoring",intervalMs:1800*1e3,priority:"normal",targetDomains:["learning-optimization"],enabled:!0,timeoutMs:6e4,retryCount:1,retryDelayMs:5e3},b=class extends p{lifecycleManager=null;dailyLogger;lastRunTimestamp=0;constructor(){super(W),this.dailyLogger=new k}async getLifecycleManager(){if(this.lifecycleManager)return this.lifecycleManager;try{let e=g();await e.initialize();let r=e.getDatabase();return this.lifecycleManager=v(r,{promotionRewardThreshold:.7,promotionMinOccurrences:2,promotionMinSuccessRate:.7,deprecationFailureThreshold:3,staleDaysThreshold:30,confidenceDecayRate:.01,minActiveConfidence:.3}),this.lifecycleManager}catch{return null}}getPendingExperienceCount(){try{return g().getDatabase().prepare("SELECT COUNT(*) as pending FROM qe_pattern_usage WHERE created_at > datetime('now', '-1 day')").get()?.pending??0}catch{return 0}}async doExecute(e){let r=Date.now();e.logger.info("Heartbeat scheduler running (token-free maintenance)");let n=[],t=[],o=await this.getLifecycleManager();if(!o)return e.logger.warn("Unified memory unavailable \u2014 returning zero-metric heartbeat"),this.createResult(Date.now()-r,{itemsAnalyzed:0,issuesFound:0,healthScore:50,trend:"stable",domainMetrics:{promoted:0,deprecated:0,decayed:0,stalePatterns:0,pendingExperiences:0,avgConfidence:0,avgSuccessRate:0}},[],[]);let a=0,u=0;try{let s=o.promoteEligiblePatterns();a=s.promoted,u=s.checked,a>0&&n.push({type:"heartbeat-promotion",severity:"info",domain:"learning-optimization",title:"Patterns Promoted",description:`${a} of ${u} short-term patterns promoted to long-term`})}catch(s){e.logger.warn("Pattern promotion failed",{error:d(s)})}let c=0,h=0;try{let s=o.deprecateStalePatterns();c=s.deprecated,h=s.checked,c>0&&n.push({type:"heartbeat-deprecation",severity:"low",domain:"learning-optimization",title:"Stale Patterns Deprecated",description:`${c} of ${h} patterns deprecated (stale, failed, or low confidence)`})}catch(s){e.logger.warn("Stale pattern detection failed",{error:d(s)})}let l=0;try{let s=this.lastRunTimestamp>0?(Date.now()-this.lastRunTimestamp)/864e5:1;l=o.applyConfidenceDecay(Math.min(s,7)).decayed}catch(s){e.logger.warn("Confidence decay failed",{error:d(s)})}let m=this.getPendingExperienceCount(),i={totalPatterns:0,activePatterns:0,deprecatedPatterns:0,promotedPatterns:0,shortTermPatterns:0,longTermPatterns:0,avgConfidence:0,avgSuccessRate:0,patternsNearDeprecation:0};try{i=o.getStats()}catch(s){e.logger.warn("Stats retrieval failed",{error:d(s)})}try{this.dailyLogger.log({timestamp:new Date,type:"pattern-promoted",summary:`Heartbeat: ${a} promoted, ${c} deprecated, ${l} decayed, ${m} pending exp, ${i.activePatterns} active patterns (avg conf: ${i.avgConfidence.toFixed(2)})`,details:{promoted:a,deprecated:c,decayed:l,pendingExperiences:m,totalPatterns:i.totalPatterns,activePatterns:i.activePatterns,avgConfidence:i.avgConfidence,avgSuccessRate:i.avgSuccessRate}}),this.dailyLogger.flush()}catch(s){e.logger.warn("Daily log write failed",{error:d(s)})}this.lastRunTimestamp=Date.now(),i.activePatterns>0&&i.patternsNearDeprecation/i.activePatterns>.5&&t.push({priority:"p2",domain:"learning-optimization",action:"Review At-Risk Patterns",description:`${i.patternsNearDeprecation} of ${i.activePatterns} active patterns are near deprecation. Manual review recommended.`,estimatedImpact:"medium",effort:"low",autoFixable:!1});let f=this.calculateHealthScore(i,a,c),D=this.determineTrend(a,c,i.activePatterns),_=Math.max(u,h),x=a+c+i.patternsNearDeprecation;return e.logger.info("Heartbeat complete",{promoted:a,deprecated:c,decayed:l,pendingExperiences:m,healthScore:f}),this.createResult(Date.now()-r,{itemsAnalyzed:_,issuesFound:x,healthScore:f,trend:D,domainMetrics:{promoted:a,deprecated:c,decayed:l,stalePatterns:i.patternsNearDeprecation,pendingExperiences:m,avgConfidence:Number(i.avgConfidence.toFixed(3)),avgSuccessRate:Number(i.avgSuccessRate.toFixed(3))}},n,t)}calculateHealthScore(e,r,n){let t=70;if(t+=Math.min(15,r*5),e.avgConfidence>0&&(t+=Math.round((e.avgConfidence-.5)*30)),e.activePatterns>0){let o=n/e.activePatterns;t-=Math.round(o*20)}return e.activePatterns>0&&e.patternsNearDeprecation/e.activePatterns>.5&&(t-=10),Math.max(0,Math.min(100,Math.round(t)))}determineTrend(e,r,n){return n===0?"stable":e>r?"improving":r>e&&r/n>.1?"degrading":"stable"}};export{p as a,b};
@@ -1,2 +1,2 @@
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.13.1");process.exit(0)}
2
- import{a as o,e as p}from"./chunk-NP4CP3LR.js";import{a as l,d}from"./chunk-DVPGQG4W.js";d();p();var u=class{store=new Map;vectors=new Map;cleanupInterval;async initialize(){this.cleanupInterval=setInterval(()=>this.cleanup(),o.CLEANUP_INTERVAL_MS),this.cleanupInterval.unref&&this.cleanupInterval.unref()}async dispose(){this.cleanupInterval&&clearInterval(this.cleanupInterval),this.store.clear(),this.vectors.clear()}async set(t,r,e){let s={value:r,namespace:e?.namespace??"default",createdAt:Date.now()};e?.ttl&&(s.expiresAt=Date.now()+e.ttl*o.TTL_MULTIPLIER_MS);let n=this.buildKey(t,e?.namespace);this.store.set(n,s)}async get(t,r){let e=this.buildKey(t,r?.namespace),s=this.store.get(e);if(s){if(s.expiresAt&&Date.now()>s.expiresAt){this.store.delete(e);return}return s.value}}async delete(t,r){let e=this.buildKey(t,r?.namespace);return this.store.delete(e)}async has(t,r){return await this.get(t,r)!==void 0}async search(t,r=o.DEFAULT_SEARCH_LIMIT,e){let s=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(s.replace(/\*/g,".*")),i=[],c=e?.namespace?`${e.namespace}:`:void 0;for(let a of this.store.keys())if(!(c&&!a.startsWith(c))&&n.test(a)&&(i.push(a),i.length>=r))break;return i}async vectorSearch(t,r){let e=[];for(let[s,n]of this.vectors.entries()){let i=l(t,n.embedding);e.push({key:s,score:i,metadata:n.metadata})}return e.sort((s,n)=>n.score-s.score).slice(0,r)}async storeVector(t,r,e){this.vectors.set(t,{embedding:r,metadata:e})}buildKey(t,r){return r?`${r}:${t}`:t}cleanup(){let t=Date.now();for(let[r,e]of this.store.entries())e.expiresAt&&t>e.expiresAt&&this.store.delete(r)}getStats(){return{entries:this.store.size,vectors:this.vectors.size}}async clear(t){if(t){let r=`${t}:`;for(let e of this.store.keys())e.startsWith(r)&&this.store.delete(e)}else this.store.clear()}async count(t){let r=0,e=`${t}:`;for(let s of this.store.keys())if(s.startsWith(e)){let n=this.store.get(s);n&&(!n.expiresAt||Date.now()<=n.expiresAt)&&r++}return r}async hasCodeIntelligenceIndex(){return await this.count("code-intelligence:kg")>0}};export{u as a};
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.13.3");process.exit(0)}
2
+ import{a as o,e as p}from"./chunk-UX434RY5.js";import{a as l,d}from"./chunk-PHBGMXTR.js";d();p();var u=class{store=new Map;vectors=new Map;cleanupInterval;async initialize(){this.cleanupInterval=setInterval(()=>this.cleanup(),o.CLEANUP_INTERVAL_MS),this.cleanupInterval.unref&&this.cleanupInterval.unref()}async dispose(){this.cleanupInterval&&clearInterval(this.cleanupInterval),this.store.clear(),this.vectors.clear()}async set(t,r,e){let s={value:r,namespace:e?.namespace??"default",createdAt:Date.now()};e?.ttl&&(s.expiresAt=Date.now()+e.ttl*o.TTL_MULTIPLIER_MS);let n=this.buildKey(t,e?.namespace);this.store.set(n,s)}async get(t,r){let e=this.buildKey(t,r?.namespace),s=this.store.get(e);if(s){if(s.expiresAt&&Date.now()>s.expiresAt){this.store.delete(e);return}return s.value}}async delete(t,r){let e=this.buildKey(t,r?.namespace);return this.store.delete(e)}async has(t,r){return await this.get(t,r)!==void 0}async search(t,r=o.DEFAULT_SEARCH_LIMIT,e){let s=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(s.replace(/\*/g,".*")),i=[],c=e?.namespace?`${e.namespace}:`:void 0;for(let a of this.store.keys())if(!(c&&!a.startsWith(c))&&n.test(a)&&(i.push(a),i.length>=r))break;return i}async vectorSearch(t,r){let e=[];for(let[s,n]of this.vectors.entries()){let i=l(t,n.embedding);e.push({key:s,score:i,metadata:n.metadata})}return e.sort((s,n)=>n.score-s.score).slice(0,r)}async storeVector(t,r,e){this.vectors.set(t,{embedding:r,metadata:e})}buildKey(t,r){return r?`${r}:${t}`:t}cleanup(){let t=Date.now();for(let[r,e]of this.store.entries())e.expiresAt&&t>e.expiresAt&&this.store.delete(r)}getStats(){return{entries:this.store.size,vectors:this.vectors.size}}async clear(t){if(t){let r=`${t}:`;for(let e of this.store.keys())e.startsWith(r)&&this.store.delete(e)}else this.store.clear()}async count(t){let r=0,e=`${t}:`;for(let s of this.store.keys())if(s.startsWith(e)){let n=this.store.get(s);n&&(!n.expiresAt||Date.now()<=n.expiresAt)&&r++}return r}async hasCodeIntelligenceIndex(){return await this.count("code-intelligence:kg")>0}};export{u as a};
@@ -1,3 +1,3 @@
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.13.1");process.exit(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.13.3");process.exit(0)}
2
2
  import{readFileSync as R,existsSync as v,readdirSync as y}from"fs";import{join as S}from"path";var M=100*1024,b=/mcp__([a-z][a-z0-9-]*)__([a-z][a-z0-9_]*)/g,x=/^```/;function w(e,r){let n=e.length>M?e.slice(0,M):e,o=[],i=n.split(`
3
3
  `),a=!1;for(let s=0;s<i.length;s++){let p=i[s];if(x.test(p.trim())){a=!a;continue}let l,c=new RegExp(b.source,"g");for(;(l=c.exec(p))!==null;){let t=l[1],g=l[2],f=l[0],d=a?"code-block":"prose",u=d==="prose"?.9:.5;o.push({toolName:f,serverName:t,actionName:g,confidence:u,context:d,lineNumber:s+1})}}return o}function E(e){let r=new Map;for(let n of e)r.has(n.serverName)||r.set(n.serverName,[]),r.get(n.serverName).push(n);return r}function N(e){let r=[],n=[S(e,".claude","mcp.json"),S(e,".mcp.json")],o=process.env.HOME||process.env.USERPROFILE||"";o&&n.push(S(o,".claude","mcp.json"));for(let i of n)if(v(i))try{let a=R(i,"utf-8"),s=JSON.parse(a);s.mcpServers&&typeof s.mcpServers=="object"&&r.push(...Object.keys(s.mcpServers))}catch{}return[...new Set(r)]}function h(e,r,n){if(!v(e))return{agentName:r,references:[],requiredServers:[],availableServers:n,missingServers:[],warnings:[`Agent file not found: ${e}`],allSatisfied:!0};let o;try{o=R(e,"utf-8")}catch{return{agentName:r,references:[],requiredServers:[],availableServers:n,missingServers:[],warnings:[`Failed to read agent file: ${e}`],allSatisfied:!0}}let i=w(o,r),a=E(i),s=[...a.keys()],p=new Set(n),l=s.filter(t=>!p.has(t)),c=[];for(let t of l){let g=a.get(t)||[],f=Math.max(...g.map(m=>m.confidence)),d=g.length,u=[...new Set(g.map(m=>m.context))].join(", ");c.push(`[advisory] Agent "${r}" references MCP server "${t}" (${d} tool ref${d>1?"s":""}, confidence: ${f}, context: ${u}) but server is not configured. Agent may have reduced capabilities.`)}return{agentName:r,references:i,requiredServers:s,availableServers:n,missingServers:l,warnings:c,allSatisfied:l.length===0}}function C(e,r){let n=Date.now(),o=[],i=[],a=N(r);if(!v(e))return{agents:[],totalServersReferenced:0,globalMissingServers:[],agentsWithMissingDeps:[],warnings:[`Agents directory not found: ${e}`],durationMs:Date.now()-n};try{let c=y(e);for(let g of c){if(!g.endsWith(".md"))continue;let f=g.replace(".md",""),d=S(e,g),u=h(d,f,a);o.push(u),i.push(...u.warnings)}let t=S(e,"subagents");if(v(t)){let g=y(t);for(let f of g){if(!f.endsWith(".md"))continue;let d=f.replace(".md",""),u=S(t,f),m=h(u,d,a);o.push(m),i.push(...m.warnings)}}}catch(c){i.push(`Error scanning agents directory: ${c.message}`)}let s=new Set,p=new Set,l=[];for(let c of o){for(let t of c.requiredServers)s.add(t);for(let t of c.missingServers)p.add(t);c.missingServers.length>0&&l.push(c.agentName)}return{agents:o,totalServersReferenced:s.size,globalMissingServers:[...p],agentsWithMissingDeps:l,warnings:i,durationMs:Date.now()-n}}export{N as a,C as b};