agentic-qe 3.15.15 → 3.15.17

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 (526) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +168 -0
  3. package/assets/skills/skills-manifest.json +1 -1
  4. package/dist/audit/witness-chain.d.ts +7 -0
  5. package/dist/audit/witness-chain.js +10 -0
  6. package/dist/cli/bundle.js +6 -6
  7. package/dist/cli/chunks/adapter-OMILP6KH.js +2 -0
  8. package/dist/cli/chunks/{agent-booster-wasm-EUF4XVUC.js → agent-booster-wasm-6BUOFQZA.js} +2 -2
  9. package/dist/cli/chunks/{agent-handler-MOX6PSIQ.js → agent-handler-HPDK3JI3.js} +2 -2
  10. package/dist/cli/chunks/{agent-memory-branch-AEXKIGDG.js → agent-memory-branch-5QKUTWK5.js} +2 -2
  11. package/dist/cli/chunks/aqe-learning-engine-OXH5CCOS.js +2 -0
  12. package/dist/cli/chunks/{arena-IQ5ZZDRF.js → arena-7OKPMNHD.js} +2 -2
  13. package/dist/cli/chunks/{arena-M7GA3CVG.js → arena-HZ35LESR.js} +4 -4
  14. package/dist/cli/chunks/{audit-4IPBMKWB.js → audit-XI575SVK.js} +3 -3
  15. package/dist/cli/chunks/base-MAK2BLTG.js +2 -0
  16. package/dist/cli/chunks/{better-sqlite3-IKDKJ2IE.js → better-sqlite3-YO5X7ZJS.js} +2 -2
  17. package/dist/cli/chunks/{brain-handler-5NQUDH4W.js → brain-handler-GCQZFZGQ.js} +3 -3
  18. package/dist/cli/chunks/{branch-enumerator-KSXELWRC.js → branch-enumerator-N6G44UU2.js} +2 -2
  19. package/dist/cli/chunks/{browser-6LACARWE.js → browser-EVKPTLOI.js} +2 -2
  20. package/dist/cli/chunks/browser-workflow-IR3VF2TL.js +2 -0
  21. package/dist/cli/chunks/{chunk-DKX4GNRU.js → chunk-2EQK7B5L.js} +2 -2
  22. package/dist/cli/chunks/chunk-2PCEMDIX.js +757 -0
  23. package/dist/cli/chunks/{chunk-JCQGJGGZ.js → chunk-2UUZCQSD.js} +7 -7
  24. package/dist/cli/chunks/chunk-2YWYW7NU.js +21 -0
  25. package/dist/cli/chunks/{chunk-PFQCV6YS.js → chunk-45223KK6.js} +6 -6
  26. package/dist/cli/chunks/chunk-4EJLHNER.js +12 -0
  27. package/dist/cli/chunks/{chunk-E5G4WZ2T.js → chunk-4L6WX5KC.js} +1 -1
  28. package/dist/cli/chunks/{chunk-UQPA33UK.js → chunk-4NKZU2JZ.js} +2 -2
  29. package/dist/cli/chunks/{chunk-OBDONJQM.js → chunk-4UKTIQDT.js} +2 -2
  30. package/dist/cli/chunks/{chunk-7BLZHFKD.js → chunk-4YM45Z5B.js} +1 -1
  31. package/dist/cli/chunks/{chunk-ZWBGYJ7K.js → chunk-5FSPELOG.js} +2 -2
  32. package/dist/cli/chunks/{chunk-NWIIYHT6.js → chunk-5WATBVU6.js} +2 -2
  33. package/dist/cli/chunks/{chunk-7ACCBHRB.js → chunk-5WYZVSL2.js} +1 -1
  34. package/dist/cli/chunks/{chunk-ZYJB6FML.js → chunk-6LSZCEW2.js} +1 -1
  35. package/dist/cli/chunks/{chunk-U62OUXBF.js → chunk-6V6BD6PH.js} +1 -1
  36. package/dist/cli/chunks/{chunk-MIA447GY.js → chunk-74MDUIAZ.js} +1 -1
  37. package/dist/cli/chunks/{chunk-AJPROCDW.js → chunk-776K4ZLE.js} +2 -2
  38. package/dist/cli/chunks/{chunk-CBK5CT6T.js → chunk-7BSOO3CY.js} +2 -2
  39. package/dist/cli/chunks/{chunk-ERN56H6S.js → chunk-7SNSI4VY.js} +1 -1
  40. package/dist/cli/chunks/{chunk-JKJOB65O.js → chunk-A4BVDYIL.js} +1 -1
  41. package/dist/cli/chunks/{chunk-MV55NXTD.js → chunk-AGCS5GSO.js} +2 -2
  42. package/dist/cli/chunks/{chunk-XIVVTYM2.js → chunk-AVHYJ3XP.js} +2 -2
  43. package/dist/cli/chunks/{chunk-KJBPB7P5.js → chunk-BE7ZHM34.js} +2 -2
  44. package/dist/cli/chunks/{chunk-GKSMRBHU.js → chunk-BHQ2DLJU.js} +1 -1
  45. package/dist/cli/chunks/{chunk-7XB3FCKM.js → chunk-BKHEQIRZ.js} +2 -2
  46. package/dist/cli/chunks/{chunk-G242G224.js → chunk-BSIWI4ES.js} +2 -2
  47. package/dist/cli/chunks/{chunk-NQS3BWS6.js → chunk-C7QLLMYI.js} +1 -1
  48. package/dist/cli/chunks/{chunk-XWIAZG3C.js → chunk-CMN7PU2H.js} +2 -2
  49. package/dist/cli/chunks/{chunk-4X3SWKBA.js → chunk-COTQ44YO.js} +2 -2
  50. package/dist/cli/chunks/{chunk-3J3RNJNX.js → chunk-CQER6IJ5.js} +1 -1
  51. package/dist/cli/chunks/{chunk-6KCSKGVY.js → chunk-CVPXHDQU.js} +1 -1
  52. package/dist/cli/chunks/{chunk-R6LHJ7ME.js → chunk-CVYPMGUM.js} +2 -2
  53. package/dist/cli/chunks/chunk-CXCMATZ6.js +3 -0
  54. package/dist/cli/chunks/{chunk-PYPS65P7.js → chunk-D75GLKEL.js} +2 -2
  55. package/dist/cli/chunks/chunk-DCDSN67A.js +2 -0
  56. package/dist/cli/chunks/{chunk-6RBTS3NF.js → chunk-DHKSPOUQ.js} +2 -2
  57. package/dist/cli/chunks/{chunk-JW74KRBC.js → chunk-DJDVD6RM.js} +2 -2
  58. package/dist/cli/chunks/{chunk-X33CWRDF.js → chunk-DNVRTJKB.js} +2 -2
  59. package/dist/cli/chunks/{chunk-BQ47GQPK.js → chunk-DS5IFRY6.js} +2 -2
  60. package/dist/cli/chunks/{chunk-AHMWD6JG.js → chunk-E7XIMOKW.js} +2 -2
  61. package/dist/cli/chunks/{chunk-SON6ZRH3.js → chunk-ECKHDHR2.js} +2 -2
  62. package/dist/cli/chunks/chunk-EPVPXHL7.js +2 -0
  63. package/dist/cli/chunks/{chunk-BP5T3OEV.js → chunk-ERYADKMZ.js} +4 -4
  64. package/dist/cli/chunks/{chunk-DUKE27HC.js → chunk-EUWG2JG4.js} +2 -2
  65. package/dist/cli/chunks/chunk-FAQ24UHB.js +29 -0
  66. package/dist/cli/chunks/{chunk-XG4F4XH4.js → chunk-FBBPRVNF.js} +2 -2
  67. package/dist/cli/chunks/{chunk-5PTAFGJT.js → chunk-FBSBXCZS.js} +2 -2
  68. package/dist/cli/chunks/chunk-G2X3OLMN.js +153 -0
  69. package/dist/cli/chunks/{chunk-IXL5ZHWJ.js → chunk-GG7PMTHD.js} +1 -1
  70. package/dist/cli/chunks/{chunk-6BRQPHMZ.js → chunk-GN6OE3JT.js} +1 -1
  71. package/dist/cli/chunks/{chunk-SZAZQZWI.js → chunk-GPPTRKEM.js} +2 -2
  72. package/dist/cli/chunks/{chunk-LTQVUAPH.js → chunk-H2LHWZRE.js} +2 -2
  73. package/dist/cli/chunks/{chunk-WVXJ2QIG.js → chunk-HAQJFUAQ.js} +2 -2
  74. package/dist/cli/chunks/{chunk-C5CXL3JP.js → chunk-HD6W6PHV.js} +2 -2
  75. package/dist/cli/chunks/{chunk-K3WZICFA.js → chunk-HFZD5KLR.js} +1 -1
  76. package/dist/cli/chunks/{chunk-VCXI4XC4.js → chunk-HRUHHHVR.js} +2 -2
  77. package/dist/cli/chunks/{chunk-GV2QE5TO.js → chunk-HVT7RMGV.js} +1 -1
  78. package/dist/cli/chunks/chunk-HWQPMUSN.js +2 -0
  79. package/dist/cli/chunks/{chunk-4ATQP3PR.js → chunk-HZ5O7G2P.js} +1 -1
  80. package/dist/cli/chunks/{chunk-XHHWABJV.js → chunk-IHQGNDMX.js} +2 -2
  81. package/dist/cli/chunks/{chunk-UUBIQR6A.js → chunk-IJSROBM6.js} +18 -18
  82. package/dist/cli/chunks/{chunk-PS6UMZVK.js → chunk-IJZFJPHS.js} +2 -2
  83. package/dist/cli/chunks/{chunk-C4KLXFJP.js → chunk-IKB3M7OF.js} +1 -1
  84. package/dist/cli/chunks/{chunk-SJCKCSN3.js → chunk-INI3Q4CN.js} +1 -1
  85. package/dist/cli/chunks/{chunk-LYJHUNBK.js → chunk-IOWEBPXJ.js} +2 -2
  86. package/dist/cli/chunks/{chunk-HTZSRMHW.js → chunk-IQL6XRF5.js} +2 -2
  87. package/dist/cli/chunks/{chunk-DEKR3CTS.js → chunk-IRHXGCQR.js} +2 -2
  88. package/dist/cli/chunks/{chunk-TODNOP7C.js → chunk-J3QFJI2Y.js} +6 -6
  89. package/dist/cli/chunks/{chunk-OLZH5LRT.js → chunk-J6QRNQJF.js} +11 -11
  90. package/dist/cli/chunks/{chunk-HL2ANKN3.js → chunk-J7Q5TXFZ.js} +2 -2
  91. package/dist/cli/chunks/{chunk-6YVMX2TC.js → chunk-JHKKIJT2.js} +2 -2
  92. package/dist/cli/chunks/{chunk-K3XBQC3R.js → chunk-JI33PMPZ.js} +1 -1
  93. package/dist/cli/chunks/{chunk-74YG72NQ.js → chunk-JRIJM4LE.js} +3 -3
  94. package/dist/cli/chunks/{chunk-TDQWTSBS.js → chunk-JVWZAE2H.js} +2 -2
  95. package/dist/cli/chunks/{chunk-RDMRY7CT.js → chunk-K7WAI662.js} +1 -1
  96. package/dist/cli/chunks/{chunk-C4RTAVC6.js → chunk-KB34MTFZ.js} +2 -2
  97. package/dist/cli/chunks/{chunk-2CKERSMB.js → chunk-KPIPVSIP.js} +2 -2
  98. package/dist/cli/chunks/{chunk-LNX74WHQ.js → chunk-KR2TAAF6.js} +1 -1
  99. package/dist/cli/chunks/{chunk-73PBAWAF.js → chunk-KT2QCXO6.js} +2 -2
  100. package/dist/cli/chunks/{chunk-BBRROA3Z.js → chunk-KTORRIX3.js} +2 -2
  101. package/dist/cli/chunks/{chunk-GCHYOPRZ.js → chunk-LCWEQRZI.js} +2 -2
  102. package/dist/cli/chunks/{chunk-M4WMSCAE.js → chunk-LG5PPJT7.js} +1 -1
  103. package/dist/cli/chunks/{chunk-UAQZI6N4.js → chunk-LIF6UWHV.js} +2 -2
  104. package/dist/cli/chunks/chunk-LN7NKE3N.js +27 -0
  105. package/dist/cli/chunks/chunk-LOLSZG5J.js +2 -0
  106. package/dist/cli/chunks/{chunk-BLL2XU7A.js → chunk-LOMT4UC2.js} +2 -2
  107. package/dist/cli/chunks/chunk-LRKLATSH.js +2 -0
  108. package/dist/cli/chunks/{chunk-EKP2SC77.js → chunk-LRY6UIRI.js} +2 -2
  109. package/dist/cli/chunks/{chunk-JCZCJE6X.js → chunk-LV7UIK4Q.js} +2 -2
  110. package/dist/cli/chunks/{chunk-LVABQNRF.js → chunk-M2YI5YUR.js} +2 -2
  111. package/dist/cli/chunks/{chunk-RIRZHOS2.js → chunk-MCXW3DKE.js} +2 -2
  112. package/dist/cli/chunks/{chunk-ZSOMUTNL.js → chunk-MGZ6XZHU.js} +1 -1
  113. package/dist/cli/chunks/{chunk-H5DER3JY.js → chunk-MLMD3I75.js} +1 -1
  114. package/dist/cli/chunks/{chunk-UXIY4IAI.js → chunk-MVVVGQJ6.js} +2 -2
  115. package/dist/cli/chunks/{chunk-WUOOX7UG.js → chunk-ND72UDVH.js} +2 -2
  116. package/dist/cli/chunks/{chunk-AKZO6GGG.js → chunk-NE3LRUNC.js} +4 -4
  117. package/dist/cli/chunks/{chunk-O6EWL5DQ.js → chunk-NKUHMA4T.js} +2 -2
  118. package/dist/cli/chunks/{chunk-L32JNNKL.js → chunk-NQFDJ6BT.js} +1 -1
  119. package/dist/cli/chunks/{chunk-T66PPF4D.js → chunk-NZJVDOUN.js} +31 -31
  120. package/dist/cli/chunks/{chunk-EBTNMQSS.js → chunk-O7VJ3VKD.js} +2 -2
  121. package/dist/cli/chunks/{chunk-76P32JVU.js → chunk-OJIUIEI4.js} +1 -1
  122. package/dist/cli/chunks/chunk-OO2M2QUV.js +12 -0
  123. package/dist/cli/chunks/{chunk-CAOUV5GZ.js → chunk-ORQ2YBRR.js} +2 -2
  124. package/dist/cli/chunks/chunk-OWIQR6N2.js +4 -0
  125. package/dist/cli/chunks/chunk-OWIZBZLN.js +14 -0
  126. package/dist/cli/chunks/{chunk-J3FP5UGL.js → chunk-P3D7SEHW.js} +1 -1
  127. package/dist/cli/chunks/{chunk-3CYNZFKH.js → chunk-P4OB6WDJ.js} +1 -1
  128. package/dist/cli/chunks/{chunk-LHMQIZ6B.js → chunk-PCL5JRKN.js} +2 -2
  129. package/dist/cli/chunks/{chunk-KLTMOXIK.js → chunk-PIWGKGWP.js} +2 -2
  130. package/dist/cli/chunks/{chunk-VMAM46HQ.js → chunk-PK34KJH7.js} +2 -2
  131. package/dist/cli/chunks/chunk-POPSZDI2.js +65 -0
  132. package/dist/cli/chunks/{chunk-JUDUBQHA.js → chunk-Q6F3DYZN.js} +2 -2
  133. package/dist/cli/chunks/{chunk-Y2OX6KGN.js → chunk-QJSSUBO3.js} +2 -2
  134. package/dist/cli/chunks/{chunk-XM6ZVFM5.js → chunk-QN7HP2UW.js} +235 -173
  135. package/dist/cli/chunks/{chunk-T4GE7MPI.js → chunk-QSQNXBD2.js} +2 -2
  136. package/dist/cli/chunks/{chunk-5C62XMJR.js → chunk-QTQDX4TZ.js} +33 -33
  137. package/dist/cli/chunks/{chunk-DURD37JZ.js → chunk-R3KBOQ3O.js} +2 -2
  138. package/dist/cli/chunks/{chunk-LJMYRTJ7.js → chunk-REY52O7J.js} +1 -1
  139. package/dist/cli/chunks/{chunk-W5ZJG2OU.js → chunk-RKCN4B26.js} +2 -2
  140. package/dist/cli/chunks/chunk-S3DT5TPR.js +14 -0
  141. package/dist/cli/chunks/{chunk-4HKAD25N.js → chunk-S3TBOKAZ.js} +22 -22
  142. package/dist/cli/chunks/{chunk-2IIXCEMS.js → chunk-SAEECT23.js} +2 -2
  143. package/dist/cli/chunks/{chunk-LB2LGEDP.js → chunk-SAZ4PJBR.js} +2 -2
  144. package/dist/cli/chunks/{chunk-FOOW4JVS.js → chunk-SFITYZLV.js} +2 -2
  145. package/dist/cli/chunks/{chunk-2ZFLULL4.js → chunk-SRBCBVSI.js} +2 -2
  146. package/dist/cli/chunks/chunk-SUAZ5Z47.js +63 -0
  147. package/dist/cli/chunks/{chunk-RBKUU7WF.js → chunk-TDZ6N43D.js} +2 -2
  148. package/dist/cli/chunks/chunk-TIVKDIF7.js +2 -0
  149. package/dist/cli/chunks/{chunk-MPFPWJTH.js → chunk-TM75GAXG.js} +2 -2
  150. package/dist/cli/chunks/{chunk-UJABDXST.js → chunk-TWBZONKT.js} +2 -2
  151. package/dist/cli/chunks/{chunk-AOKKUB5F.js → chunk-U4S74IIZ.js} +1 -1
  152. package/dist/cli/chunks/{chunk-W62OOK7A.js → chunk-U5SMBJ6F.js} +2 -2
  153. package/dist/cli/chunks/{chunk-6LE362LZ.js → chunk-UHJVZEQA.js} +2 -2
  154. package/dist/cli/chunks/{chunk-T67R2MUN.js → chunk-UOVCTK5L.js} +2 -2
  155. package/dist/cli/chunks/{chunk-FTRSS64D.js → chunk-VDEKVIP5.js} +2 -2
  156. package/dist/cli/chunks/{chunk-BDKEAGQ2.js → chunk-VITV7AEC.js} +2 -2
  157. package/dist/cli/chunks/{chunk-BU4UQR36.js → chunk-VKREKVFI.js} +2 -2
  158. package/dist/cli/chunks/{chunk-BZULJMGH.js → chunk-VLTDW7XJ.js} +2 -2
  159. package/dist/cli/chunks/{chunk-UE2J6MA5.js → chunk-VQFV2IPV.js} +1 -1
  160. package/dist/cli/chunks/{chunk-TZIHDJZD.js → chunk-VYPVU3JF.js} +2 -2
  161. package/dist/cli/chunks/{chunk-UORB2QDU.js → chunk-WAOEQA3W.js} +2 -2
  162. package/dist/cli/chunks/{chunk-GQABPCQE.js → chunk-WBDWHHKP.js} +2 -2
  163. package/dist/cli/chunks/{chunk-GGQGCT4Y.js → chunk-WX4PO65Q.js} +2 -2
  164. package/dist/cli/chunks/chunk-X2DWHGCC.js +6 -0
  165. package/dist/cli/chunks/{chunk-337Z52QM.js → chunk-X5QD76IU.js} +2 -2
  166. package/dist/cli/chunks/{chunk-E56PVVWC.js → chunk-XBTGEYED.js} +2 -2
  167. package/dist/cli/chunks/{chunk-5AFVEWMT.js → chunk-XEMCHGAJ.js} +2 -2
  168. package/dist/cli/chunks/{chunk-E3MRDIZF.js → chunk-XEYFZLIT.js} +1 -1
  169. package/dist/cli/chunks/{chunk-KCQNFBBR.js → chunk-XFTX3KLE.js} +1 -1
  170. package/dist/cli/chunks/{chunk-QFGYH6HD.js → chunk-XPTCQKVE.js} +1 -1
  171. package/dist/cli/chunks/{chunk-PXATBHWN.js → chunk-YAJOBZE5.js} +2 -2
  172. package/dist/cli/chunks/{chunk-27HE2BHC.js → chunk-YCVLKU6H.js} +2 -2
  173. package/dist/cli/chunks/{chunk-ZIPAB5J6.js → chunk-YD2C6EPN.js} +2 -2
  174. package/dist/cli/chunks/{chunk-5G4UFTV4.js → chunk-YKRLUTK7.js} +2 -2
  175. package/dist/cli/chunks/{chunk-YUS6TWAL.js → chunk-YMUY3TES.js} +6 -6
  176. package/dist/cli/chunks/chunk-YR5QBUHZ.js +6 -0
  177. package/dist/cli/chunks/{chunk-XH4JMX5O.js → chunk-Z7SKUC6P.js} +1 -1
  178. package/dist/cli/chunks/{chunk-EFUJDMNC.js → chunk-ZAQMRFBB.js} +2 -2
  179. package/dist/cli/chunks/{chunk-22UKJGGN.js → chunk-ZC3KDNJW.js} +3 -3
  180. package/dist/cli/chunks/{chunk-AP2W7Z3A.js → chunk-ZGV7L4MW.js} +1 -1
  181. package/dist/cli/chunks/{chunk-W27AJ5B4.js → chunk-ZN35XSKF.js} +2 -2
  182. package/dist/cli/chunks/{chunk-M4CJCPCQ.js → chunk-ZNXM6WVL.js} +2 -2
  183. package/dist/cli/chunks/{chunk-5I7357KS.js → chunk-ZP5AWQRO.js} +2 -2
  184. package/dist/cli/chunks/{chunk-OQG3UQQ7.js → chunk-ZTP3DQ5M.js} +1 -1
  185. package/dist/cli/chunks/{chunk-BFQTLF5X.js → chunk-ZVMSSCTH.js} +2 -2
  186. package/dist/cli/chunks/chunk-ZWUF27P4.js +2 -0
  187. package/dist/cli/chunks/{ci-UCUJOSBW.js → ci-3RTTTS2D.js} +2 -2
  188. package/dist/cli/chunks/{ci-config-2XILD3XG.js → ci-config-XRUR3I4K.js} +2 -2
  189. package/dist/cli/chunks/{ci-output-BL6KWOHW.js → ci-output-E5IAMU2U.js} +2 -2
  190. package/dist/cli/chunks/{circuit-breaker-5XLIOXE5.js → circuit-breaker-SHR2P44P.js} +2 -2
  191. package/dist/cli/chunks/{claude-flow-setup-4IMP6ACS.js → claude-flow-setup-ZDDILFMF.js} +2 -2
  192. package/dist/cli/chunks/client-NO5FOWT4.js +2 -0
  193. package/dist/cli/chunks/{cline-installer-RYLHCDK7.js → cline-installer-BGYVUM6G.js} +2 -2
  194. package/dist/cli/chunks/{code-WY3GJXHX.js → code-PJ4MC3MC.js} +4 -3
  195. package/dist/cli/chunks/{code-index-extractor-Y4MZBZCW.js → code-index-extractor-IW2P22YG.js} +2 -2
  196. package/dist/cli/chunks/{codex-installer-SCJ3T3DX.js → codex-installer-A7WZ6OGL.js} +2 -2
  197. package/dist/cli/chunks/{completions-CN2DXQFU.js → completions-KS23WD5J.js} +2 -2
  198. package/dist/cli/chunks/{complexity-analyzer-7MDPPIBH.js → complexity-analyzer-Q7GLSR2E.js} +2 -2
  199. package/dist/cli/chunks/{continuedev-installer-GCEJRK34.js → continuedev-installer-SK55BFW2.js} +2 -2
  200. package/dist/cli/chunks/copilot-installer-3N5J3WTM.js +3 -0
  201. package/dist/cli/chunks/core-handlers-JNAZPXE2.js +2 -0
  202. package/dist/cli/chunks/{cost-tracker-VO5MFWR6.js → cost-tracker-NENVSO4A.js} +2 -2
  203. package/dist/cli/chunks/{coverage-LYFQYNH6.js → coverage-5L7UQWDH.js} +3 -3
  204. package/dist/cli/chunks/cross-domain-router-HEBM767Z.js +2 -0
  205. package/dist/cli/chunks/{cursor-installer-KP4HA7TV.js → cursor-installer-XXBO2ZE6.js} +2 -2
  206. package/dist/cli/chunks/{daemon-7RC7TS57.js → daemon-CDCQU3LR.js} +3 -3
  207. package/dist/cli/chunks/daemon-JEBJGEUK.js +18 -0
  208. package/dist/cli/chunks/{dag-attention-scheduler-NKA44RSR.js → dag-attention-scheduler-HOMMF7FA.js} +2 -2
  209. package/dist/cli/chunks/{detect-CMYAJWYF.js → detect-FXCOUG6X.js} +2 -2
  210. package/dist/cli/chunks/{dist-node-EN3PYEGW.js → dist-node-GXQ7FMTY.js} +2 -2
  211. package/dist/cli/chunks/{domain-handler-EXSZCX7A.js → domain-handler-TI3JBAPC.js} +2 -2
  212. package/dist/cli/chunks/{domain-plugins-HCQFSNL7.js → domain-plugins-R7LTUM32.js} +2 -2
  213. package/dist/cli/chunks/{domain-transfer-3LGSNTPO.js → domain-transfer-LBIAFHIQ.js} +2 -2
  214. package/dist/cli/chunks/dream-GQDCEJMS.js +2 -0
  215. package/dist/cli/chunks/embed-and-insert-pattern-33KLHDD5.js +3 -0
  216. package/dist/cli/chunks/embedding-space-HHLWTBF5.js +2 -0
  217. package/dist/cli/chunks/{eval-OQELIWJK.js → eval-KDOZMAXJ.js} +2 -2
  218. package/dist/cli/chunks/experience-capture-middleware-X45PECQN.js +40 -0
  219. package/dist/cli/chunks/{fast-paths-UV4NDEWM.js → fast-paths-462V6UUB.js} +2 -2
  220. package/dist/cli/chunks/{feature-flags-H7H33B6C.js → feature-flags-G66OT3AS.js} +2 -2
  221. package/dist/cli/chunks/{feature-flags-CKTYX67J.js → feature-flags-NIRQ4YDM.js} +2 -2
  222. package/dist/cli/chunks/file-discovery-33USPLB5.js +2 -0
  223. package/dist/cli/chunks/{fleet-ZJBCAKRG.js → fleet-PXWGB7CU.js} +3 -3
  224. package/dist/cli/chunks/{gnn-wrapper-RUE2QZRG.js → gnn-wrapper-7MUW3M5M.js} +2 -2
  225. package/dist/cli/chunks/{heartbeat-handler-XRV327M7.js → heartbeat-handler-5237PB35.js} +4 -4
  226. package/dist/cli/chunks/heartbeat-scheduler-LIXLC5IH.js +2 -0
  227. package/dist/cli/chunks/hnsw-adapter-62D5UH27.js +2 -0
  228. package/dist/cli/chunks/hnsw-index-GSGUMQQC.js +2 -0
  229. package/dist/cli/chunks/{hnsw-legacy-bridge-UJID6ZZ4.js → hnsw-legacy-bridge-OSQPW7JP.js} +2 -2
  230. package/dist/cli/chunks/{hnswlib-node-WS43R4AX.js → hnswlib-node-GX6WG2GB.js} +2 -2
  231. package/dist/cli/chunks/{hooks-YZNJKXAJ.js → hooks-GUWHL7VC.js} +23 -22
  232. package/dist/cli/chunks/hybrid-backend-FRWP4BOY.js +2 -0
  233. package/dist/cli/chunks/{hypergraph-engine-XQJSIMTS.js → hypergraph-engine-SRWLLCU3.js} +2 -2
  234. package/dist/cli/chunks/{hypergraph-handler-ZD2NYXMR.js → hypergraph-handler-AVOPRHHO.js} +3 -3
  235. package/dist/cli/chunks/impact-analyzer-7KF3AQXV.js +2 -0
  236. package/dist/cli/chunks/{init-guard-DSRUAVRT.js → init-guard-P4N6EVZS.js} +2 -2
  237. package/dist/cli/chunks/{init-handler-RJU5QMAP.js → init-handler-LRGWOJMD.js} +6 -6
  238. package/dist/cli/chunks/init-wizard-XWWAXY25.js +2 -0
  239. package/dist/cli/chunks/kernel-ZEJPNDBW.js +2 -0
  240. package/dist/cli/chunks/{kilocode-installer-BCPOCVMC.js → kilocode-installer-7R2EPOQ6.js} +2 -2
  241. package/dist/cli/chunks/{kiro-installer-GFCWCB2S.js → kiro-installer-QNM7DPOB.js} +2 -2
  242. package/dist/cli/chunks/knowledge-graph-RRZQS7KY.js +2 -0
  243. package/dist/cli/chunks/{learning-FZTD72CF.js → learning-7OIZBPXZ.js} +3 -3
  244. package/dist/cli/chunks/{llm-router-GJVKGRJL.js → llm-router-SIDXES23.js} +4 -4
  245. package/dist/cli/chunks/llm-router-service-3OSW67LC.js +2 -0
  246. package/dist/cli/chunks/{load-YKTPOYBE.js → load-EI2E2C3S.js} +2 -2
  247. package/dist/cli/chunks/load-test-7TRIH2WJ.js +2 -0
  248. package/dist/cli/chunks/{mcp-LT6R2IKS.js → mcp-IOE5WOCS.js} +2 -2
  249. package/dist/cli/chunks/{memory-4HKKOLRY.js → memory-DLYGJAP7.js} +5 -5
  250. package/dist/cli/chunks/memory-backend-G7ZW6Q2B.js +2 -0
  251. package/dist/cli/chunks/memory-handlers-TPF3KCO5.js +2 -0
  252. package/dist/cli/chunks/{multi-model-executor-2YPM2WTK.js → multi-model-executor-WHH4YCHM.js} +2 -2
  253. package/dist/cli/chunks/{opencode-installer-WBAJMH5K.js → opencode-installer-63FDZAMS.js} +2 -2
  254. package/dist/cli/chunks/{orchestrator-5W5WVMVJ.js → orchestrator-3LA776KK.js} +5 -5
  255. package/dist/cli/chunks/pattern-null-store-OU3ZC3NR.js +2 -0
  256. package/dist/cli/chunks/{pattern-usage-recorder-GXRMNPAZ.js → pattern-usage-recorder-NW54QUGI.js} +2 -2
  257. package/dist/cli/chunks/{pipeline-2NA4DRDA.js → pipeline-P3TYX6J6.js} +2 -2
  258. package/dist/cli/chunks/{platform-BGERNQ5V.js → platform-FNA2WLI6.js} +2 -2
  259. package/dist/cli/chunks/{plugin-L4EPVENR.js → plugin-NJS7BC2S.js} +2 -2
  260. package/dist/cli/chunks/{prime-radiant-advanced-wasm-RTQRTPTM.js → prime-radiant-advanced-wasm-NIAVL2OT.js} +2 -2
  261. package/dist/cli/chunks/project-root-GMOFJEKD.js +2 -0
  262. package/dist/cli/chunks/protocol-executor-AD345XRO.js +2 -0
  263. package/dist/cli/chunks/{protocol-handler-SYQXM6JK.js → protocol-handler-JU5C4JHY.js} +2 -2
  264. package/dist/cli/chunks/{prove-5O7GPJCU.js → prove-35VOSLYP.js} +2 -2
  265. package/dist/cli/chunks/qe-reasoning-bank-NLTP26RC.js +2 -0
  266. package/dist/cli/chunks/{quality-KIIDHGNF.js → quality-ET74X7HN.js} +2 -2
  267. package/dist/cli/chunks/{quality-gate-H65VECD3.js → quality-gate-FEDQISNB.js} +3 -3
  268. package/dist/cli/chunks/queen-coordinator-2TB4FWS6.js +2 -0
  269. package/dist/cli/chunks/real-embeddings-II6CXTCI.js +2 -0
  270. package/dist/cli/chunks/{ref-validation-CSBJOMZM.js → ref-validation-DTBPYCEB.js} +2 -2
  271. package/dist/cli/chunks/{roocode-installer-G7OVYXEN.js → roocode-installer-LYQEMR4J.js} +2 -2
  272. package/dist/cli/chunks/router-PLM3MWME.js +2 -0
  273. package/dist/cli/chunks/routing-feedback-I7VOX2HU.js +2 -0
  274. package/dist/cli/chunks/{routing-handler-ZNZPPI5Y.js → routing-handler-DJOJFPII.js} +2 -2
  275. package/dist/cli/chunks/{ruvector-commands-C6IG3OY3.js → ruvector-commands-VXYGJDPW.js} +2 -2
  276. package/dist/cli/chunks/rvf-dual-writer-GQZHFWO2.js +2 -0
  277. package/dist/cli/chunks/rvf-migration-adapter-3TVKBCAM.js +2 -0
  278. package/dist/cli/chunks/rvf-migration-coordinator-XUHKLMT6.js +2 -0
  279. package/dist/cli/chunks/rvf-native-adapter-5GUTYOWS.js +2 -0
  280. package/dist/cli/chunks/{rvf-store-integrity-3G6LFLT3.js → rvf-store-integrity-GA2ZYOEG.js} +2 -2
  281. package/dist/cli/chunks/safe-db-RZPQGLGQ.js +2 -0
  282. package/dist/cli/chunks/schedule-G7JMQDUX.js +2 -0
  283. package/dist/cli/chunks/scheduler-4SEGPCKD.js +2 -0
  284. package/dist/cli/chunks/{security-A3IMVLFM.js → security-MM6YOECX.js} +3 -3
  285. package/dist/cli/chunks/{shared-rvf-adapter-VHWQ6US5.js → shared-rvf-adapter-6AHPA3V5.js} +2 -2
  286. package/dist/cli/chunks/{shared-rvf-dual-writer-JB3QS7IG.js → shared-rvf-dual-writer-EYAVY2GZ.js} +2 -2
  287. package/dist/cli/chunks/sqlite-persistence-IVE4SQXR.js +2 -0
  288. package/dist/cli/chunks/{standalone-memory-DDNXCSBD.js → standalone-memory-A3PLB4CZ.js} +2 -2
  289. package/dist/cli/chunks/{status-handler-2HK7XPEK.js → status-handler-OSSFAP4Z.js} +2 -2
  290. package/dist/cli/chunks/{structural-health-DSJVLEPV.js → structural-health-PGY5XUNO.js} +2 -2
  291. package/dist/cli/chunks/{sync-NTUR53PI.js → sync-CWEHYGNN.js} +2 -2
  292. package/dist/cli/chunks/sync-PM6D7EQF.js +2 -0
  293. package/dist/cli/chunks/task-handler-LHMQ75W4.js +64 -0
  294. package/dist/cli/chunks/{task-handlers-VJR6EHRZ.js → task-handlers-S2TX5FTR.js} +4 -4
  295. package/dist/cli/chunks/test-4EGZZ6NJ.js +34 -0
  296. package/dist/cli/chunks/test-runner-process-72YACW6M.js +2 -0
  297. package/dist/cli/chunks/{test-scheduling-Q6QEEOS6.js → test-scheduling-YJQHH3XE.js} +3 -3
  298. package/dist/cli/chunks/token-bootstrap-DJNETMVW.js +2 -0
  299. package/dist/cli/chunks/{token-usage-YEEFWSSI.js → token-usage-WPNOJR6H.js} +2 -2
  300. package/dist/cli/chunks/{transformers-BZCHJJJT.js → transformers-4MRPXCPU.js} +2 -2
  301. package/dist/cli/chunks/tree-sitter-wasm-parser-UVWSDXFR.js +2 -0
  302. package/dist/cli/chunks/{types-4AOKZYOX.js → types-6P5FB4EB.js} +2 -2
  303. package/dist/cli/chunks/unified-memory-2VMGSGQL.js +2 -0
  304. package/dist/cli/chunks/unified-memory-hnsw-3KULVD3N.js +2 -0
  305. package/dist/cli/chunks/unified-persistence-QCSLU2SV.js +2 -0
  306. package/dist/cli/chunks/{upgrade-2MWW6BT2.js → upgrade-4ICTN63Y.js} +2 -2
  307. package/dist/cli/chunks/{validate-PAEV3GT5.js → validate-HQF5GZ7L.js} +2 -2
  308. package/dist/cli/chunks/{validate-swarm-ZIXACK5K.js → validate-swarm-45JYG7VW.js} +2 -2
  309. package/dist/cli/chunks/visual-security-ZYP2KPH7.js +2 -0
  310. package/dist/cli/chunks/{web-tree-sitter-VLTXZFAB.js → web-tree-sitter-UOTWZLNH.js} +2 -2
  311. package/dist/cli/chunks/{windsurf-installer-VELMLOZF.js → windsurf-installer-WDWSBXGN.js} +2 -2
  312. package/dist/cli/chunks/witness-chain-5QRT7EMX.js +2 -0
  313. package/dist/cli/chunks/witness-chain-DOYMNPC7.js +2 -0
  314. package/dist/cli/chunks/witness-chain-repair-CUF2AFQB.js +2 -0
  315. package/dist/cli/chunks/{witness-chain-verifier-MIDWD4JS.js → witness-chain-verifier-JB42X62J.js} +2 -2
  316. package/dist/cli/chunks/{witness-key-manager-OSVCWOB2.js → witness-key-manager-LXXO6L2G.js} +2 -2
  317. package/dist/cli/chunks/{workflow-MK7A7QCX.js → workflow-6ARK47NF.js} +4 -4
  318. package/dist/cli/chunks/workflow-orchestrator-RYDDWIXN.js +2 -0
  319. package/dist/cli/chunks/wrappers-CYQBOMPL.js +2 -0
  320. package/dist/cli/commands/code.js +4 -0
  321. package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +10 -2
  322. package/dist/cli/commands/test.js +26 -4
  323. package/dist/cli/handlers/task-handler.d.ts +5 -0
  324. package/dist/cli/handlers/task-handler.js +21 -1
  325. package/dist/cli/utils/task-result.d.ts +11 -0
  326. package/dist/cli/utils/task-result.js +39 -0
  327. package/dist/coordination/handlers/test-execution-handlers.js +137 -59
  328. package/dist/coordination/mincut/mincut-persistence.js +29 -25
  329. package/dist/domains/code-intelligence/coordinator.d.ts +4 -0
  330. package/dist/domains/code-intelligence/coordinator.js +46 -13
  331. package/dist/domains/code-intelligence/interfaces.d.ts +10 -1
  332. package/dist/domains/code-intelligence/services/semantic-analyzer.d.ts +37 -7
  333. package/dist/domains/code-intelligence/services/semantic-analyzer.js +135 -62
  334. package/dist/domains/code-intelligence/services/text-relevance.d.ts +32 -0
  335. package/dist/domains/code-intelligence/services/text-relevance.js +63 -0
  336. package/dist/domains/learning-optimization/services/learning-coordinator.js +1 -1
  337. package/dist/domains/quality-assessment/coordinator.js +2 -1
  338. package/dist/domains/test-execution/coordinator.d.ts +3 -1
  339. package/dist/domains/test-execution/coordinator.js +21 -7
  340. package/dist/domains/test-execution/interfaces.d.ts +17 -0
  341. package/dist/domains/test-execution/plugin.js +8 -2
  342. package/dist/domains/test-execution/services/flaky-detector.d.ts +9 -1
  343. package/dist/domains/test-execution/services/flaky-detector.js +26 -8
  344. package/dist/domains/test-execution/services/retry-handler.d.ts +9 -1
  345. package/dist/domains/test-execution/services/retry-handler.js +56 -12
  346. package/dist/domains/test-execution/services/runner-test-cases.d.ts +2 -0
  347. package/dist/domains/test-execution/services/runner-test-cases.js +7 -3
  348. package/dist/domains/test-execution/services/test-executor.d.ts +6 -1
  349. package/dist/domains/test-execution/services/test-executor.js +97 -14
  350. package/dist/domains/visual-accessibility/coordinator.d.ts +15 -7
  351. package/dist/domains/visual-accessibility/coordinator.js +15 -7
  352. package/dist/domains/visual-accessibility/interfaces.d.ts +27 -3
  353. package/dist/domains/visual-accessibility/services/accessibility-contrast.d.ts +39 -0
  354. package/dist/domains/visual-accessibility/services/accessibility-contrast.js +93 -0
  355. package/dist/domains/visual-accessibility/services/accessibility-tester-browser.d.ts +18 -3
  356. package/dist/domains/visual-accessibility/services/accessibility-tester-browser.js +50 -40
  357. package/dist/domains/visual-accessibility/services/accessibility-tester-checks.d.ts +27 -0
  358. package/dist/domains/visual-accessibility/services/accessibility-tester-checks.js +137 -0
  359. package/dist/domains/visual-accessibility/services/accessibility-tester.d.ts +5 -0
  360. package/dist/domains/visual-accessibility/services/accessibility-tester.js +43 -24
  361. package/dist/domains/visual-accessibility/services/browser-swarm-coordinator.d.ts +2 -3
  362. package/dist/domains/visual-accessibility/services/browser-swarm-coordinator.js +8 -14
  363. package/dist/feedback/coverage-learner.js +13 -9
  364. package/dist/feedback/test-outcome-tracker.js +13 -9
  365. package/dist/governance/witness-chain.d.ts +5 -0
  366. package/dist/governance/witness-chain.js +22 -6
  367. package/dist/init/copilot-installer.d.ts +6 -0
  368. package/dist/init/copilot-installer.js +37 -17
  369. package/dist/init/platform-config-generator.d.ts +10 -0
  370. package/dist/init/platform-config-generator.js +26 -1
  371. package/dist/integrations/agentic-flow/reasoning-bank/experience-replay.d.ts +22 -0
  372. package/dist/integrations/agentic-flow/reasoning-bank/experience-replay.js +115 -45
  373. package/dist/integrations/agentic-flow/reasoning-bank/pattern-evolution.d.ts +6 -0
  374. package/dist/integrations/agentic-flow/reasoning-bank/pattern-evolution.js +51 -33
  375. package/dist/integrations/agentic-flow/reasoning-bank/trajectory-tracker.js +17 -9
  376. package/dist/integrations/embeddings/cache/EmbeddingCache.d.ts +8 -0
  377. package/dist/integrations/embeddings/cache/EmbeddingCache.js +24 -10
  378. package/dist/integrations/ruvector/delta-tracker.d.ts +11 -0
  379. package/dist/integrations/ruvector/delta-tracker.js +16 -0
  380. package/dist/integrations/ruvector/sona-persistence.d.ts +10 -0
  381. package/dist/integrations/ruvector/sona-persistence.js +49 -24
  382. package/dist/kernel/unified-memory.d.ts +32 -0
  383. package/dist/kernel/unified-memory.js +76 -8
  384. package/dist/learning/aqe-learning-engine.js +1 -1
  385. package/dist/learning/embed-and-insert-pattern.js +4 -2
  386. package/dist/learning/embedder-endpoint-client.d.ts +76 -0
  387. package/dist/learning/embedder-endpoint-client.js +201 -13
  388. package/dist/learning/embedding-space-registry.d.ts +75 -0
  389. package/dist/learning/embedding-space-registry.js +142 -0
  390. package/dist/learning/embedding-space.d.ts +12 -0
  391. package/dist/learning/embedding-space.js +17 -0
  392. package/dist/learning/experience-capture-middleware.js +25 -13
  393. package/dist/learning/experience-capture.js +1 -1
  394. package/dist/learning/experience-consolidation.d.ts +18 -0
  395. package/dist/learning/experience-consolidation.js +55 -8
  396. package/dist/learning/experience-space-verification.d.ts +71 -0
  397. package/dist/learning/experience-space-verification.js +147 -0
  398. package/dist/learning/pattern-lifecycle.d.ts +40 -4
  399. package/dist/learning/pattern-lifecycle.js +153 -76
  400. package/dist/learning/pattern-null-store.d.ts +5 -0
  401. package/dist/learning/pattern-null-store.js +8 -0
  402. package/dist/learning/pattern-promotion.js +6 -3
  403. package/dist/learning/pattern-store.d.ts +6 -0
  404. package/dist/learning/pattern-store.js +19 -6
  405. package/dist/learning/qe-reasoning-bank.js +2 -2
  406. package/dist/learning/real-embeddings.d.ts +3 -0
  407. package/dist/learning/real-embeddings.js +52 -12
  408. package/dist/learning/real-qe-reasoning-bank.d.ts +5 -0
  409. package/dist/learning/real-qe-reasoning-bank.js +77 -47
  410. package/dist/learning/rvf-pattern-store.js +6 -2
  411. package/dist/learning/sqlite-persistence.d.ts +6 -0
  412. package/dist/learning/sqlite-persistence.js +10 -0
  413. package/dist/mcp/bundle.js +699 -619
  414. package/dist/mcp/entry.js +4 -0
  415. package/dist/mcp/handlers/domain-handler-configs.js +2 -0
  416. package/dist/mcp/handlers/trajectory-judge.js +1 -1
  417. package/dist/mcp/protocol-server.js +1 -0
  418. package/dist/mcp/tools/visual-accessibility/index.js +8 -2
  419. package/dist/mcp/types.d.ts +6 -0
  420. package/dist/optimization/session-cache.d.ts +17 -1
  421. package/dist/optimization/session-cache.js +40 -36
  422. package/dist/planning/goap-planner.d.ts +6 -0
  423. package/dist/planning/goap-planner.js +35 -19
  424. package/dist/planning/plan-executor.js +24 -15
  425. package/dist/routing/co-execution-repository.js +12 -9
  426. package/dist/routing/routing-feedback.d.ts +8 -0
  427. package/dist/routing/routing-feedback.js +46 -24
  428. package/dist/routing/routing-outcomes-migration.js +7 -2
  429. package/dist/shared/embeddings/index.d.ts +2 -2
  430. package/dist/shared/embeddings/index.js +1 -1
  431. package/dist/shared/embeddings/nomic-embedder.d.ts +8 -2
  432. package/dist/shared/embeddings/nomic-embedder.js +19 -11
  433. package/dist/shared/embeddings/ollama-client.d.ts +28 -2
  434. package/dist/shared/embeddings/ollama-client.js +84 -22
  435. package/dist/shared/embeddings/types.d.ts +15 -0
  436. package/dist/shared/embeddings/types.js +4 -0
  437. package/dist/shared/llm/spend-ledger.d.ts +9 -0
  438. package/dist/shared/llm/spend-ledger.js +64 -39
  439. package/dist/shared/pytest-junit-report.d.ts +93 -0
  440. package/dist/shared/pytest-junit-report.js +241 -0
  441. package/dist/shared/sqlite-lock-wait.d.ts +27 -0
  442. package/dist/shared/sqlite-lock-wait.js +37 -0
  443. package/dist/shared/sqlite-write-queue.d.ts +28 -0
  444. package/dist/shared/sqlite-write-queue.js +38 -0
  445. package/dist/shared/test-runner-project.d.ts +119 -0
  446. package/dist/shared/test-runner-project.js +301 -0
  447. package/dist/skills/security-visual-testing/index.d.ts +3 -1
  448. package/dist/skills/security-visual-testing/index.js +49 -35
  449. package/dist/skills/security-visual-testing/types.d.ts +19 -3
  450. package/dist/workers/workers/heartbeat-scheduler.js +5 -5
  451. package/dist/workers/workers/learning-consolidation.js +8 -7
  452. package/package.json +1 -1
  453. package/dist/cli/chunks/adapter-QU6INSKP.js +0 -2
  454. package/dist/cli/chunks/aqe-learning-engine-PAJPENJD.js +0 -2
  455. package/dist/cli/chunks/base-OTGSN6IC.js +0 -2
  456. package/dist/cli/chunks/browser-workflow-WLZGR6SB.js +0 -2
  457. package/dist/cli/chunks/chunk-2LUTPMBO.js +0 -21
  458. package/dist/cli/chunks/chunk-3HVFIITW.js +0 -2
  459. package/dist/cli/chunks/chunk-4D4CWP72.js +0 -2
  460. package/dist/cli/chunks/chunk-5KA5TVPR.js +0 -6
  461. package/dist/cli/chunks/chunk-6NBRMD25.js +0 -13
  462. package/dist/cli/chunks/chunk-7O45RQHF.js +0 -153
  463. package/dist/cli/chunks/chunk-EMSZVUYA.js +0 -29
  464. package/dist/cli/chunks/chunk-G6RDCCFV.js +0 -4
  465. package/dist/cli/chunks/chunk-HH4ED4F7.js +0 -744
  466. package/dist/cli/chunks/chunk-Q6I4SIUU.js +0 -65
  467. package/dist/cli/chunks/chunk-QGBGSQ2E.js +0 -14
  468. package/dist/cli/chunks/chunk-QRKTBSZT.js +0 -27
  469. package/dist/cli/chunks/chunk-SHRI7TKJ.js +0 -62
  470. package/dist/cli/chunks/chunk-TX2CHQD7.js +0 -2
  471. package/dist/cli/chunks/chunk-UGYM4U44.js +0 -2
  472. package/dist/cli/chunks/chunk-VY4U6DPO.js +0 -12
  473. package/dist/cli/chunks/chunk-WNTA4YKE.js +0 -14
  474. package/dist/cli/chunks/chunk-XHLYGXYE.js +0 -2
  475. package/dist/cli/chunks/client-KKRNPX4F.js +0 -2
  476. package/dist/cli/chunks/copilot-installer-BHPDSELY.js +0 -3
  477. package/dist/cli/chunks/core-handlers-47MPMED7.js +0 -2
  478. package/dist/cli/chunks/cross-domain-router-U6MBFHEC.js +0 -2
  479. package/dist/cli/chunks/daemon-AXLVPKVO.js +0 -18
  480. package/dist/cli/chunks/dream-76L6EEN7.js +0 -2
  481. package/dist/cli/chunks/embed-and-insert-pattern-B6MNHICW.js +0 -3
  482. package/dist/cli/chunks/experience-capture-middleware-SUFILYPW.js +0 -40
  483. package/dist/cli/chunks/file-discovery-VSFKZ3LJ.js +0 -2
  484. package/dist/cli/chunks/heartbeat-scheduler-NIK3KKEH.js +0 -2
  485. package/dist/cli/chunks/hnsw-adapter-WJG7LUJJ.js +0 -2
  486. package/dist/cli/chunks/hnsw-index-D6PRI5HC.js +0 -2
  487. package/dist/cli/chunks/hybrid-backend-RIUR3I7F.js +0 -2
  488. package/dist/cli/chunks/impact-analyzer-C36YYTJ5.js +0 -2
  489. package/dist/cli/chunks/init-wizard-JCKNGIGT.js +0 -2
  490. package/dist/cli/chunks/kernel-F7ILJTYD.js +0 -2
  491. package/dist/cli/chunks/knowledge-graph-VTXDBHB2.js +0 -2
  492. package/dist/cli/chunks/llm-router-service-TNOWQINA.js +0 -2
  493. package/dist/cli/chunks/load-test-FPVBK2EV.js +0 -2
  494. package/dist/cli/chunks/memory-backend-2QE7O67A.js +0 -2
  495. package/dist/cli/chunks/memory-handlers-X4CMVBXB.js +0 -2
  496. package/dist/cli/chunks/pattern-null-store-UI35ORHW.js +0 -2
  497. package/dist/cli/chunks/project-root-S7WDFTMU.js +0 -2
  498. package/dist/cli/chunks/protocol-executor-OPANXQVB.js +0 -2
  499. package/dist/cli/chunks/qe-reasoning-bank-3OTF4DYQ.js +0 -2
  500. package/dist/cli/chunks/queen-coordinator-WTYH4TAN.js +0 -2
  501. package/dist/cli/chunks/real-embeddings-DYIOLKQ3.js +0 -2
  502. package/dist/cli/chunks/router-DBBW4NC2.js +0 -2
  503. package/dist/cli/chunks/routing-feedback-W35QHCL4.js +0 -2
  504. package/dist/cli/chunks/rvf-dual-writer-X3NSL25Z.js +0 -2
  505. package/dist/cli/chunks/rvf-migration-adapter-TZR7GDOK.js +0 -2
  506. package/dist/cli/chunks/rvf-migration-coordinator-4ATTHGHD.js +0 -2
  507. package/dist/cli/chunks/rvf-native-adapter-HD25ZYV5.js +0 -2
  508. package/dist/cli/chunks/safe-db-ZS2QKANY.js +0 -2
  509. package/dist/cli/chunks/schedule-ZH6VNA32.js +0 -2
  510. package/dist/cli/chunks/scheduler-T6CD74B6.js +0 -2
  511. package/dist/cli/chunks/sqlite-persistence-47WU5EKZ.js +0 -2
  512. package/dist/cli/chunks/sync-3MUV6S5E.js +0 -2
  513. package/dist/cli/chunks/task-handler-74MZN2EO.js +0 -62
  514. package/dist/cli/chunks/test-O6FK3FVF.js +0 -34
  515. package/dist/cli/chunks/test-runner-process-2NPW3UDQ.js +0 -2
  516. package/dist/cli/chunks/token-bootstrap-TTRCECLP.js +0 -2
  517. package/dist/cli/chunks/tree-sitter-wasm-parser-RZAND65G.js +0 -2
  518. package/dist/cli/chunks/unified-memory-FZ5K2C7W.js +0 -2
  519. package/dist/cli/chunks/unified-memory-hnsw-VREWX56M.js +0 -2
  520. package/dist/cli/chunks/unified-persistence-YZGMKX6B.js +0 -2
  521. package/dist/cli/chunks/visual-security-GXGSFBVA.js +0 -2
  522. package/dist/cli/chunks/witness-chain-MRJKVCOW.js +0 -2
  523. package/dist/cli/chunks/witness-chain-WWHJKITG.js +0 -2
  524. package/dist/cli/chunks/witness-chain-repair-5SAXPETG.js +0 -2
  525. package/dist/cli/chunks/workflow-orchestrator-SG7DV72E.js +0 -2
  526. package/dist/cli/chunks/wrappers-5QFMCKXL.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.15.15");process.exit(0)}
2
- import{d as W,f as lt}from"./chunk-337Z52QM.js";import{b as I,d as _e}from"./chunk-XWIAZG3C.js";import{a as K,b as $,c as V,d as he,e as pt}from"./chunk-5G4UFTV4.js";import{a as Y,c as gt}from"./chunk-DEKR3CTS.js";import{a as fe,d as x,e as Ne,f as Se}from"./chunk-4X3SWKBA.js";import{a as U,b as me,e as ut}from"./chunk-GCHYOPRZ.js";import{a as Re,c as Le,d as _t}from"./chunk-G242G224.js";import{a as Tt}from"./chunk-3HVFIITW.js";import{c as ge}from"./chunk-BQ47GQPK.js";import{a as z,c as X,d as Et}from"./chunk-SZAZQZWI.js";import{d as pe,e as dt}from"./chunk-FOOW4JVS.js";import{a as A,e as le}from"./chunk-HL2ANKN3.js";import{b as R,d as ct}from"./chunk-XH4JMX5O.js";import{createHash as Oe}from"node:crypto";function ft(n){let e=Buffer.alloc(8);return e.writeBigUInt64LE(BigInt(n)),e}function Nt(n){return typeof n=="string"?Buffer.from(n,"utf8"):n instanceof Uint8Array?Buffer.from(n):Buffer.from(Q(n),"utf8")}function Q(n){return n===null||typeof n!="object"?JSON.stringify(n)??"null":Array.isArray(n)?`[${n.map(Q).join(",")}]`:`{${Object.keys(n).sort().map(t=>`${JSON.stringify(t)}:${Q(n[t])}`).join(",")}}`}function Ae(...n){let e=Oe("sha256");for(let t of n)e.update(t);return e.digest()}function Ce(n,e,t){return Ae(mt,n,e,ft(t))}var mt,Ie,v,ve=R(()=>{"use strict";mt=Buffer.from("ruvector:chain:"),Ie=Oe("sha256").update("ruvector-proof-gate-v1").digest();v=class n{seq=0;prev=Ie;chain=[];payloadHashes=[];admit(e){let t=Ae(Nt(e)),s=Ce(this.prev,t,this.seq);this.prev=s,this.chain.push(s),this.payloadHashes.push(t);let r={sequence:this.seq,payloadHash:t.toString("hex"),chainCommitment:s.toString("hex")};return this.seq+=1,r}verifyReceipt(e){return e.sequence>=0&&e.sequence<this.chain.length&&this.chain[e.sequence].toString("hex")===e.chainCommitment}chainRoot(){return this.prev.toString("hex")}get length(){return this.seq}get isEmpty(){return this.seq===0}verifyIntegrity(){if(this.chain.length!==this.payloadHashes.length)return!1;let e=Ie;for(let t=0;t<this.chain.length;t++){if(!Ce(e,this.payloadHashes[t],t).equals(this.chain[t]))return!1;e=this.chain[t]}return e.equals(this.prev)}toJSON(){return{seq:this.seq,head:this.prev.toString("hex"),chain:this.chain.map(e=>e.toString("hex")),payloadHashes:this.payloadHashes.map(e=>e.toString("hex"))}}static fromJSON(e){let t=new n;t.seq=e.seq,t.prev=Buffer.from(e.head,"hex");for(let s of e.chain)t.chain.push(Buffer.from(s,"hex"));for(let s of e.payloadHashes)t.payloadHashes.push(Buffer.from(s,"hex"));return t}}});function b(n){if(!J.has(n))throw new Error(`Invalid table name: "${n}" is not in the allowlist`);return n}function Ft(n){let e=n.split(".");if(e.length>2)throw new Error(`Invalid SQL identifier: "${n}" has too many parts (max: schema.table)`);for(let t of e)if(!be.test(t))throw new Error(`Invalid SQL identifier: "${n}" \u2014 part "${t}" does not match pattern ${be}`);return n}var J,be,Z=R(()=>{"use strict";J=new Set(["schema_version","kv_store","vectors","rl_q_values","goap_goals","goap_actions","goap_plans","goap_plan_signatures","concept_nodes","concept_edges","dream_cycles","dream_insights","qe_patterns","qe_pattern_embeddings","qe_pattern_usage","qe_trajectories","embeddings","execution_results","executed_steps","mincut_snapshots","mincut_history","mincut_weak_vertices","mincut_alerts","mincut_healing_actions","mincut_observations","sona_patterns","sona_fisher_matrices","test_outcomes","routing_outcomes","coverage_sessions","patterns","hypergraph_nodes","hypergraph_edges","hypergraph_vertices","hypergraph_hyperedges","hypergraph_edge_vertices","hypergraph_vertex_properties","hypergraph_edge_properties","captured_experiences","experience_applications","witness_chain","witness_chain_receipts","witness_chain_archive","trajectories","trajectory_steps","pattern_evolution_events","pattern_relationships","pattern_versions","learning_daily_snapshots","metrics_outcomes","experience_consolidation_log","qe_pattern_reuse","learning_evidence_manifests","learning_evidence_segments","learning_segment_edges","learning_evidence_admissions","pattern_manifest_lineage","pattern_segment_lineage","qe_agent_co_execution"]);be=/^[a-z_][a-z0-9_]{0,62}$/});function ye(n){n.exec(De),n.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.15.17");process.exit(0)}
2
+ import{d as W,f as It}from"./chunk-X5QD76IU.js";import{a as Y,c as Ct}from"./chunk-IRHXGCQR.js";import{b as I,d as Ne}from"./chunk-CMN7PU2H.js";import{a as K,b as $,c as V,d as Ae,e as Ot}from"./chunk-YKRLUTK7.js";import{a as Ie,d as x,e as Ce,f as Oe}from"./chunk-COTQ44YO.js";import{a as U,b as Le,e as Lt}from"./chunk-LCWEQRZI.js";import{a as Se,b as he,c as Re,d as Rt}from"./chunk-LRKLATSH.js";import{a as be,c as ve,d as At}from"./chunk-BSIWI4ES.js";import{a as Nt}from"./chunk-TIVKDIF7.js";import{c as me}from"./chunk-DS5IFRY6.js";import{a as z,c as X,d as St}from"./chunk-GPPTRKEM.js";import{d as fe,e as ht}from"./chunk-SFITYZLV.js";import{a as b,e as _e}from"./chunk-J7Q5TXFZ.js";import{b as h,d as ft}from"./chunk-Z7SKUC6P.js";function Q(n){return ye===null?n:Math.min(n,ye)}var ye,De=h(()=>{"use strict";ye=null});function J(n){let e=n?.code;if(typeof e=="string"&&/^SQLITE_(BUSY|LOCKED)/.test(e))return!0;let t=n instanceof Error?n.message:String(n);return/database is locked|database table is locked|SQLITE_BUSY/i.test(t)}function Z(n,e,t){let s=n.pragma("busy_timeout",{simple:!0});n.pragma(`busy_timeout = ${e}`);try{return t()}finally{try{n.pragma(`busy_timeout = ${s}`)}catch{}}}async function Xe(n,e,t={}){let s=t.waitMs??200,r=t.budgetMs??6e4,c=t.sleep??(d=>new Promise(u=>setTimeout(u,d))),a=t.now??Date.now,T=a(),l=25;for(;;){if(t.shouldContinue&&!t.shouldContinue())throw t.cancelledError?.()??new Error("Cancelled while waiting for a locked database");try{return Z(n,s,e)}catch(d){if(!J(d)||a()-T+l>=r)throw d}await c(l),l=Math.min(l*2,1e3)}}var Wt,Ue=h(()=>{"use strict";Wt=1e3});import{createHash as Fe}from"node:crypto";function vt(n){let e=Buffer.alloc(8);return e.writeBigUInt64LE(BigInt(n)),e}function yt(n){return typeof n=="string"?Buffer.from(n,"utf8"):n instanceof Uint8Array?Buffer.from(n):Buffer.from(ee(n),"utf8")}function ee(n){return n===null||typeof n!="object"?JSON.stringify(n)??"null":Array.isArray(n)?`[${n.map(ee).join(",")}]`:`{${Object.keys(n).sort().map(t=>`${JSON.stringify(t)}:${ee(n[t])}`).join(",")}}`}function Me(...n){let e=Fe("sha256");for(let t of n)e.update(t);return e.digest()}function xe(n,e,t){return Me(bt,n,e,vt(t))}var bt,we,v,Ge=h(()=>{"use strict";bt=Buffer.from("ruvector:chain:"),we=Fe("sha256").update("ruvector-proof-gate-v1").digest();v=class n{seq=0;prev=we;chain=[];payloadHashes=[];admit(e){let t=Me(yt(e)),s=xe(this.prev,t,this.seq);this.prev=s,this.chain.push(s),this.payloadHashes.push(t);let r={sequence:this.seq,payloadHash:t.toString("hex"),chainCommitment:s.toString("hex")};return this.seq+=1,r}verifyReceipt(e){return e.sequence>=0&&e.sequence<this.chain.length&&this.chain[e.sequence].toString("hex")===e.chainCommitment}chainRoot(){return this.prev.toString("hex")}get length(){return this.seq}get isEmpty(){return this.seq===0}verifyIntegrity(){if(this.chain.length!==this.payloadHashes.length)return!1;let e=we;for(let t=0;t<this.chain.length;t++){if(!xe(e,this.payloadHashes[t],t).equals(this.chain[t]))return!1;e=this.chain[t]}return e.equals(this.prev)}toJSON(){return{seq:this.seq,head:this.prev.toString("hex"),chain:this.chain.map(e=>e.toString("hex")),payloadHashes:this.payloadHashes.map(e=>e.toString("hex"))}}static fromJSON(e){let t=new n;t.seq=e.seq,t.prev=Buffer.from(e.head,"hex");for(let s of e.chain)t.chain.push(Buffer.from(s,"hex"));for(let s of e.payloadHashes)t.payloadHashes.push(Buffer.from(s,"hex"));return t}}});function y(n){if(!te.has(n))throw new Error(`Invalid table name: "${n}" is not in the allowlist`);return n}function Vt(n){let e=n.split(".");if(e.length>2)throw new Error(`Invalid SQL identifier: "${n}" has too many parts (max: schema.table)`);for(let t of e)if(!Pe.test(t))throw new Error(`Invalid SQL identifier: "${n}" \u2014 part "${t}" does not match pattern ${Pe}`);return n}var te,Pe,ne=h(()=>{"use strict";te=new Set(["schema_version","kv_store","vectors","rl_q_values","goap_goals","goap_actions","goap_plans","goap_plan_signatures","concept_nodes","concept_edges","dream_cycles","dream_insights","qe_patterns","qe_pattern_embeddings","qe_pattern_usage","qe_trajectories","embeddings","execution_results","executed_steps","mincut_snapshots","mincut_history","mincut_weak_vertices","mincut_alerts","mincut_healing_actions","mincut_observations","sona_patterns","sona_fisher_matrices","test_outcomes","routing_outcomes","coverage_sessions","patterns","hypergraph_nodes","hypergraph_edges","hypergraph_vertices","hypergraph_hyperedges","hypergraph_edge_vertices","hypergraph_vertex_properties","hypergraph_edge_properties","captured_experiences","experience_applications","witness_chain","witness_chain_receipts","witness_chain_archive","trajectories","trajectory_steps","pattern_evolution_events","pattern_relationships","pattern_versions","learning_daily_snapshots","metrics_outcomes","experience_consolidation_log","qe_pattern_reuse","learning_evidence_manifests","learning_evidence_segments","learning_segment_edges","learning_evidence_admissions","pattern_manifest_lineage","pattern_segment_lineage","qe_agent_co_execution"]);Pe=/^[a-z_][a-z0-9_]{0,62}$/});function qe(n){n.exec(ke),n.exec(`
3
3
  INSERT OR IGNORE INTO learning_evidence_manifests (
4
4
  id, trajectory_id, trajectory_hash, manifest_hash, task_family,
5
5
  outcome, oracle_refs_json, source_kind, process_signals_json
@@ -23,7 +23,7 @@ import{d as W,f as lt}from"./chunk-337Z52QM.js";import{b as I,d as _e}from"./chu
23
23
  pattern_id, manifest_id, use_kind
24
24
  )
25
25
  SELECT id, 'legacy-pattern:' || id, 'legacy-context' FROM qe_patterns;
26
- `)}var De,ee=R(()=>{"use strict";De=`
26
+ `)}var ke,re=h(()=>{"use strict";ke=`
27
27
  CREATE TABLE IF NOT EXISTS learning_evidence_manifests (
28
28
  id TEXT PRIMARY KEY,
29
29
  trajectory_id TEXT,
@@ -131,8 +131,8 @@ import{d as W,f as lt}from"./chunk-337Z52QM.js";import{b as I,d as _e}from"./chu
131
131
  BEGIN SELECT RAISE(ABORT, 'learning evidence admissions are append-only'); END;
132
132
  CREATE TRIGGER IF NOT EXISTS learning_admissions_no_delete BEFORE DELETE ON learning_evidence_admissions
133
133
  BEGIN SELECT RAISE(ABORT, 'learning evidence admissions are append-only'); END;
134
- `});var Xe,St,te,Ue=R(()=>{"use strict";Xe="dream_insights_archive",St=`
135
- CREATE TABLE IF NOT EXISTS ${Xe} (
134
+ `});var Be,Dt,se,je=h(()=>{"use strict";Be="dream_insights_archive",Dt=`
135
+ CREATE TABLE IF NOT EXISTS ${Be} (
136
136
  archive_id INTEGER PRIMARY KEY AUTOINCREMENT,
137
137
  id TEXT NOT NULL,
138
138
  cycle_id TEXT,
@@ -148,17 +148,17 @@ import{d as W,f as lt}from"./chunk-337Z52QM.js";import{b as I,d as _e}from"./chu
148
148
  created_at TEXT,
149
149
  archived_at TEXT NOT NULL DEFAULT (datetime('now'))
150
150
  )
151
- `,te=`
152
- ${St};
151
+ `,se=`
152
+ ${Dt};
153
153
  -- The sweep's read-back looks copies up by insight id.
154
- CREATE INDEX IF NOT EXISTS idx_dream_insights_archive_id ON ${Xe}(id);
155
- `});var C,Fe,xe,we,Me,ne,Ge,re,D,se,Pe,ke,qe,Be,je,He,ze,ie=R(()=>{"use strict";lt();gt();ee();Ue();C=14,Fe=`
154
+ CREATE INDEX IF NOT EXISTS idx_dream_insights_archive_id ON ${Be}(id);
155
+ `});var C,He,ze,We,Ye,ie,Ke,oe,D,ae,$e,Ve,Qe,Je,Ze,et,tt,ce=h(()=>{"use strict";It();Ct();re();je();C=14,He=`
156
156
  CREATE TABLE IF NOT EXISTS schema_version (
157
157
  id INTEGER PRIMARY KEY CHECK (id = 1),
158
158
  version INTEGER NOT NULL,
159
159
  migrated_at TEXT DEFAULT (datetime('now'))
160
160
  );
161
- `,xe=`
161
+ `,ze=`
162
162
  -- Key-Value Store (v2 compatible - same schema as HybridBackend)
163
163
  CREATE TABLE IF NOT EXISTS kv_store (
164
164
  key TEXT NOT NULL,
@@ -170,7 +170,7 @@ import{d as W,f as lt}from"./chunk-337Z52QM.js";import{b as I,d as _e}from"./chu
170
170
  );
171
171
  CREATE INDEX IF NOT EXISTS idx_kv_namespace ON kv_store(namespace);
172
172
  CREATE INDEX IF NOT EXISTS idx_kv_expires ON kv_store(expires_at) WHERE expires_at IS NOT NULL;
173
- `,we=`
173
+ `,We=`
174
174
  -- Vector Embeddings (new in v3 - replaces in-memory AgentDB)
175
175
  CREATE TABLE IF NOT EXISTS vectors (
176
176
  id TEXT PRIMARY KEY,
@@ -183,7 +183,7 @@ import{d as W,f as lt}from"./chunk-337Z52QM.js";import{b as I,d as _e}from"./chu
183
183
  );
184
184
  CREATE INDEX IF NOT EXISTS idx_vectors_namespace ON vectors(namespace);
185
185
  CREATE INDEX IF NOT EXISTS idx_vectors_dimensions ON vectors(dimensions);
186
- `,Me=`
186
+ `,Ye=`
187
187
  -- Q-Values for RL algorithms (ADR-046)
188
188
  CREATE TABLE IF NOT EXISTS rl_q_values (
189
189
  id TEXT PRIMARY KEY,
@@ -204,7 +204,7 @@ import{d as W,f as lt}from"./chunk-337Z52QM.js";import{b as I,d as _e}from"./chu
204
204
  CREATE INDEX IF NOT EXISTS idx_qvalues_state ON rl_q_values(agent_id, state_key);
205
205
  CREATE INDEX IF NOT EXISTS idx_qvalues_domain ON rl_q_values(domain);
206
206
  CREATE INDEX IF NOT EXISTS idx_qvalues_updated ON rl_q_values(updated_at);
207
- `,ne=`
207
+ `,ie=`
208
208
  -- GOAP Goals
209
209
  CREATE TABLE IF NOT EXISTS goap_goals (
210
210
  id TEXT PRIMARY KEY,
@@ -315,7 +315,7 @@ import{d as W,f as lt}from"./chunk-337Z52QM.js";import{b as I,d as _e}from"./chu
315
315
  -- would fail on "no such column" since CREATE TABLE IF NOT EXISTS above
316
316
  -- silently no-ops against them. unified-memory.ts's v11 migration creates
317
317
  -- this index only after confirming/backfilling the column.
318
- `,Ge=`
318
+ `,Ke=`
319
319
  -- Concept Graph Nodes (Dream Engine)
320
320
  CREATE TABLE IF NOT EXISTS concept_nodes (
321
321
  id TEXT PRIMARY KEY,
@@ -384,7 +384,7 @@ import{d as W,f as lt}from"./chunk-337Z52QM.js";import{b as I,d as _e}from"./chu
384
384
  CREATE INDEX IF NOT EXISTS idx_edge_weight ON concept_edges(weight DESC);
385
385
  CREATE INDEX IF NOT EXISTS idx_insight_cycle ON dream_insights(cycle_id);
386
386
  CREATE INDEX IF NOT EXISTS idx_dream_status ON dream_cycles(status);
387
- `,re=`
387
+ `,oe=`
388
388
  CREATE VIRTUAL TABLE IF NOT EXISTS qe_patterns_fts USING fts5(
389
389
  name, description, pattern_type, qe_domain,
390
390
  content='qe_patterns',
@@ -407,7 +407,7 @@ import{d as W,f as lt}from"./chunk-337Z52QM.js";import{b as I,d as _e}from"./chu
407
407
  INSERT INTO qe_patterns_fts(rowid, name, description, pattern_type, qe_domain)
408
408
  VALUES (new.rowid, new.name, new.description, new.pattern_type, new.qe_domain);
409
409
  END;
410
- `}),se=re+Object.values(D).join(""),Pe=n=>`
410
+ `}),ae=oe+Object.values(D).join(""),$e=n=>`
411
411
  -- QE Patterns table (unified from sqlite-persistence.ts)
412
412
  CREATE TABLE IF NOT EXISTS qe_patterns (
413
413
  id TEXT PRIMARY KEY,
@@ -537,7 +537,7 @@ import{d as W,f as lt}from"./chunk-337Z52QM.js";import{b as I,d as _e}from"./chu
537
537
  CREATE INDEX IF NOT EXISTS idx_execution_results_status ON execution_results(status);
538
538
  CREATE INDEX IF NOT EXISTS idx_executed_steps_execution ON executed_steps(execution_id);
539
539
  CREATE INDEX IF NOT EXISTS idx_executed_steps_action ON executed_steps(action_id);
540
- `,ke=Pe(se),qe=Pe(""),Be=`
540
+ `,Ve=$e(ae),Qe=$e(""),Je=`
541
541
  -- MinCut Graph Snapshots (ADR-047)
542
542
  CREATE TABLE IF NOT EXISTS mincut_snapshots (
543
543
  id TEXT PRIMARY KEY,
@@ -643,7 +643,7 @@ import{d as W,f as lt}from"./chunk-337Z52QM.js";import{b as I,d as _e}from"./chu
643
643
  CREATE INDEX IF NOT EXISTS idx_mincut_healing_type ON mincut_healing_actions(action_type);
644
644
  CREATE INDEX IF NOT EXISTS idx_mincut_healing_success ON mincut_healing_actions(success);
645
645
  CREATE INDEX IF NOT EXISTS idx_mincut_observations_iter ON mincut_observations(iteration);
646
- `,je=`
646
+ `,Ze=`
647
647
  -- SONA Patterns table (ADR-046: Pattern Persistence for Neural Backbone)
648
648
  CREATE TABLE IF NOT EXISTS sona_patterns (
649
649
  id TEXT PRIMARY KEY,
@@ -669,7 +669,7 @@ import{d as W,f as lt}from"./chunk-337Z52QM.js";import{b as I,d as _e}from"./chu
669
669
  CREATE INDEX IF NOT EXISTS idx_sona_patterns_domain ON sona_patterns(domain);
670
670
  CREATE INDEX IF NOT EXISTS idx_sona_patterns_confidence ON sona_patterns(confidence DESC);
671
671
  CREATE INDEX IF NOT EXISTS idx_sona_patterns_updated ON sona_patterns(updated_at DESC);
672
- `,He=`
672
+ `,et=`
673
673
  -- Test outcomes (ADR-023: Quality Feedback Loop)
674
674
  CREATE TABLE IF NOT EXISTS test_outcomes (
675
675
  id TEXT PRIMARY KEY,
@@ -752,26 +752,26 @@ import{d as W,f as lt}from"./chunk-337Z52QM.js";import{b as I,d as _e}from"./chu
752
752
  CREATE INDEX IF NOT EXISTS idx_coverage_sessions_technique ON coverage_sessions(technique);
753
753
  CREATE INDEX IF NOT EXISTS idx_coverage_sessions_agent ON coverage_sessions(agent_id);
754
754
  CREATE INDEX IF NOT EXISTS idx_coverage_sessions_created ON coverage_sessions(created_at);
755
- `,ze=["kv_store","vectors","rl_q_values","goap_actions","goap_goals","goap_plans","goap_plan_signatures","goap_execution_steps","concept_nodes","concept_edges","dream_cycles","dream_insights","qe_patterns","qe_pattern_embeddings","qe_pattern_usage","qe_trajectories","embeddings","execution_results","executed_steps","mincut_snapshots","mincut_history","mincut_weak_vertices","mincut_alerts","mincut_healing_actions","mincut_observations","hypergraph_nodes","hypergraph_edges","sona_patterns","witness_chain","learning_evidence_manifests","learning_evidence_segments","learning_segment_edges","learning_evidence_admissions","pattern_manifest_lineage","pattern_segment_lineage"]});function oe(n,e,t){return n.prepare("SELECT 1 FROM sqlite_master WHERE type = ? AND name = ?").get(e,t)!==void 0}function Ke(n){return n.replace(/\s+/g," ").trim().replace(/^CREATE TRIGGER IF NOT EXISTS /i,"CREATE TRIGGER ").replace(/ ?;$/,"").toLowerCase()}function w(n,e){return n.prepare(e).get()?.n??0}function We(n){let e=oe(n,"table","qe_patterns_fts"),t=e&&oe(n,"table","qe_patterns_fts_docsize"),s=[],r=[],c=n.prepare("SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = ?");for(let u of ht){let d=c.get(u);d===void 0?s.push(u):Ke(d.sql??"")!==Rt[u]&&r.push(u)}let a=w(n,"SELECT count(*) AS n FROM qe_patterns"),T=t?w(n,"SELECT count(*) AS n FROM qe_patterns_fts_docsize"):-1,l=t&&T===a?w(n,`SELECT count(*) AS n FROM qe_patterns p
756
- WHERE NOT EXISTS (SELECT 1 FROM qe_patterns_fts_docsize d WHERE d.id = p.rowid)`):0;return{hasTable:e,hasDocsize:t,missingTriggers:s,mismatchedTriggers:r,patterns:a,indexed:T,unindexed:l}}function Ye(n){return!n.hasTable||n.missingTriggers.length>0||n.mismatchedTriggers.length>0?!0:n.hasDocsize?n.indexed!==n.patterns||n.unindexed>0:!1}function Lt(n){if(n.readonly)return!0;try{return Number(n.pragma("query_only",{simple:!0}))===1}catch{return!1}}function $e(n,e={}){let t=e.log??(c=>console.warn(c)),s=e.logPrefix??"[PatternFTS]",r={status:"healthy",createdTable:!1,recreatedTriggers:[],replacedTriggers:[],rebuilt:!1,patternsBefore:-1,indexedBefore:-1,indexedAfter:-1};try{if(!oe(n,"table","qe_patterns"))return r.status="no-patterns",r;if(Lt(n))return r.status="readonly",r;let c=We(n);if(r.patternsBefore=c.patterns,r.indexedBefore=c.indexed,!Ye(c))return r;let a=n.transaction(()=>{let T=We(n);if(!Ye(T))return null;T.hasTable||n.exec(re);for(let l of T.missingTriggers)n.exec(D[l]);for(let l of T.mismatchedTriggers)n.exec(`DROP TRIGGER IF EXISTS ${l}`),n.exec(D[l]);return n.exec("INSERT INTO qe_patterns_fts(qe_patterns_fts) VALUES('rebuild')"),{s:T,indexedAfter:w(n,"SELECT count(*) AS n FROM qe_patterns_fts_docsize")}}).immediate();if(a){let{s:T}=a;r.createdTable=!T.hasTable,r.recreatedTriggers=[...T.missingTriggers],r.replacedTriggers=[...T.mismatchedTriggers],r.patternsBefore=T.patterns,r.indexedBefore=T.indexed,r.indexedAfter=a.indexedAfter,r.rebuilt=!0}if(r.rebuilt){r.status="healed";let T=[];r.createdTable&&T.push("created qe_patterns_fts"),r.recreatedTriggers.length>0&&T.push(`recreated triggers [${r.recreatedTriggers.join(", ")}]`),r.replacedTriggers.length>0&&T.push(`replaced triggers [${r.replacedTriggers.join(", ")}]`);let l=r.indexedBefore<0?"n/a":String(r.indexedBefore);T.push(`rebuilt index (indexed ${l} -> ${r.indexedAfter}, qe_patterns ${r.patternsBefore})`),t(`${s} Healed qe_patterns FTS5 index: ${T.join("; ")}`)}return r}catch(c){r.status="failed",r.error=A(c);try{t(`${s} qe_patterns FTS5 self-heal skipped: ${r.error} (keyword search may be degraded; vector search unaffected)`)}catch{}return r}}var ht,Rt,Ve=R(()=>{"use strict";le();ie();ht=Object.keys(D);Rt=Object.freeze(Object.fromEntries(Object.entries(D).map(([n,e])=>[n,Ke(e)])))});function ae(n){if(!Number.isFinite(n))throw new RangeError("LWW register timestamp must be a finite number")}function M(n,e,t){let s=t??(e!==void 0?Date.now():0);ae(s);let r={value:e,timestamp:s,nodeId:e!==void 0?n:"",version:e!==void 0?1:0,lastUpdated:Date.now()};function c(a,T,l,u){return a!==l?a-l:T===u?0:T>u?1:-1}return{get(){return r.value},set(a,T){let l=T??Date.now();ae(l),T===void 0&&r.version>0&&r.nodeId===n&&l<=r.timestamp&&(l=r.timestamp+1),(r.version===0||c(l,n,r.timestamp,r.nodeId)>0)&&(r={value:a,timestamp:l,nodeId:n,version:r.version+1,lastUpdated:Date.now()})},merge(a){let T=a.getState();this.applyState(T)},getState(){return{value:r.value,timestamp:r.timestamp,nodeId:r.nodeId,version:r.version,lastUpdated:r.lastUpdated}},applyState(a){a.version!==0&&(ae(a.timestamp),(r.version===0||c(a.timestamp,a.nodeId,r.timestamp,r.nodeId)>0)&&(r={value:a.value,timestamp:a.timestamp,nodeId:a.nodeId,version:Math.max(r.version,a.version)+1,lastUpdated:Date.now()}))},getNodeId(){return n},getTimestamp(){return r.timestamp}}}function G(n,e){let t=M(n);return t.applyState(e),t}var ce=R(()=>{"use strict"});function O(n){let e={counts:K(),version:0,lastUpdated:Date.now()};return V(e.counts,n,0),{get(){return Object.values(e.counts).reduce((t,s)=>t+s,0)},increment(t=1){if(t<0)throw new Error("G-Counter can only increment by positive values");t!==0&&(he(e.counts,n,t),e.version++,e.lastUpdated=Date.now())},merge(t){let s=t.getState();this.applyState(s)},getState(){return{counts:Object.assign(K(),e.counts),version:e.version,lastUpdated:e.lastUpdated}},applyState(t){let s=!1;for(let[r,c]of Object.entries(t.counts)){let a=$(e.counts,r)??0;c>a&&(V(e.counts,r,c),s=!0)}s&&(e.version=Math.max(e.version,t.version)+1,e.lastUpdated=Date.now())},getNodeId(){return n},getLocalCount(){return $(e.counts,n)??0}}}function P(n,e){let t=O(n);return t.applyState(e),t}var k=R(()=>{"use strict";pt()});function q(n){let e=O(n),t=O(n),s=0,r=Date.now();return{get(){return e.get()-t.get()},increment(c=1){if(c<0)throw new Error("Use decrement() for negative values");c!==0&&(e.increment(c),s++,r=Date.now())},decrement(c=1){if(c<0)throw new Error("Use increment() for negative values");c!==0&&(t.increment(c),s++,r=Date.now())},merge(c){let a=c.getState();this.applyState(a)},getState(){return{positive:e.getState(),negative:t.getState(),version:s,lastUpdated:r}},applyState(c){let a=this.get();e.applyState(c.positive),t.applyState(c.negative);let T=this.get();a!==T&&(s=Math.max(s,c.version)+1,r=Date.now())},getNodeId(){return n}}}function B(n,e){let t=q(n);return t.applyState(e),t}var Te=R(()=>{"use strict";k()});function It(n,e){return`${n}:${Date.now()}:${e}`}function Ee(n){return typeof n=="string"?`s:${n}`:typeof n=="number"?`n:${n}`:typeof n=="boolean"?`b:${n}`:`j:${JSON.stringify(n)}`}function Ct(n){let e=n.substring(0,2),t=n.substring(2);switch(e){case"s:":return t;case"n:":return Number(t);case"b:":return t==="true";case"j:":return I(t);default:throw new Error(`Unknown serialization type: ${e}`)}}function j(n){let e=new Map,t=new Map,s=0,r=Date.now(),c=0;function a(u){let d=`${n}:`;if(!u.startsWith(d))return;let m=u.slice(d.length),p=/^(-?\d+):(\d+)$/.exec(m);if(!p)return;let g=Number(p[1]),_=Number(p[2]);Number.isSafeInteger(g)&&Number.isSafeInteger(_)&&_<Number.MAX_SAFE_INTEGER&&(c=Math.max(c,_+1))}function T(u){let d=e.get(u);if(!d||d.size===0)return!1;let m=t.get(u);if(!m||m.size===0)return!0;for(let p of d)if(!m.has(p))return!0;return!1}function l(u){let d=e.get(u);if(!d)return new Set;let m=t.get(u)||new Set,p=new Set;for(let g of d)m.has(g)||p.add(g);return p}return{has(u){let d=Ee(u);return T(d)},values(){let u=[];for(let[d]of e)T(d)&&u.push(Ct(d));return u},size(){let u=0;for(let[d]of e)T(d)&&u++;return u},add(u){let d=Ee(u),m=It(n,c++);e.has(d)||e.set(d,new Set),e.get(d).add(m),s++,r=Date.now()},remove(u){let d=Ee(u),m=e.get(d);if(!m||m.size===0)return;t.has(d)||t.set(d,new Set);let p=t.get(d);for(let g of m)p.add(g);s++,r=Date.now()},merge(u){let d=u.getState();this.applyState(d)},getState(){let u={};for(let[m,p]of e)u[m]=Array.from(p);let d={};for(let[m,p]of t)p.size>0&&(d[m]=Array.from(p));return{elements:u,tombstones:d,version:s,lastUpdated:r}},applyState(u){let d=!1;for(let[m,p]of Object.entries(u.elements)){e.has(m)||e.set(m,new Set);let g=e.get(m);for(let _ of p)a(_),g.has(_)||(g.add(_),d=!0)}for(let[m,p]of Object.entries(u.tombstones)){t.has(m)||t.set(m,new Set);let g=t.get(m);for(let _ of p)a(_),g.has(_)||(g.add(_),d=!0)}d&&(s=Math.max(s,u.version)+1,r=Date.now())},getNodeId(){return n},clear(){for(let[u,d]of e){t.has(u)||t.set(u,new Set);let m=t.get(u);for(let p of d)m.add(p)}s++,r=Date.now()}}}function H(n,e){let t=j(n);return t.applyState(e),t}var de=R(()=>{"use strict";_e()});function ue(n){let e={...Ot,...n},{nodeId:t,enableDeltaTracking:s,maxDeltaHistory:r}=e,c=new Map,a=new Map,T=new Map,l=new Map,u=0,d=[],m=new Set,p={registers:new Set,gCounters:new Set,pnCounters:new Set,sets:new Set};function g(o,i,E){let f={key:o,type:i,operation:E,timestamp:Date.now(),nodeId:t};for(let ot of m)try{ot(f)}catch(at){console.error("[CRDTStore] Error in change listener:",at)}}function _(o,i){u++,s&&p[o].add(i)}function L(){if(!s||!(p.registers.size>0||p.gCounters.size>0||p.pnCounters.size>0||p.sets.size>0))return;let i={fromVersion:d.length>0?d[d.length-1].toVersion:0,toVersion:u,timestamp:Date.now(),nodeId:t};if(p.registers.size>0){i.registers={};for(let E of p.registers){let f=c.get(E);f&&(i.registers[E]=f.getState())}p.registers.clear()}if(p.gCounters.size>0){i.gCounters={};for(let E of p.gCounters){let f=a.get(E);f&&(i.gCounters[E]=f.getState())}p.gCounters.clear()}if(p.pnCounters.size>0){i.pnCounters={};for(let E of p.pnCounters){let f=T.get(E);f&&(i.pnCounters[E]=f.getState())}p.pnCounters.clear()}if(p.sets.size>0){i.sets={};for(let E of p.sets){let f=l.get(E);f&&(i.sets[E]=f.getState())}p.sets.clear()}for(d.push(i);d.length>r;)d.shift()}let h={getRegister(o){return c.has(o)||c.set(o,M(t)),c.get(o)},setRegister(o,i){h.getRegister(o).set(i),_("registers",o),g(o,"lww-register","set")},hasRegister(o){return c.has(o)},deleteRegister(o){let i=c.delete(o);return i&&_("registers",o),i},getGCounter(o){return a.has(o)||a.set(o,O(t)),a.get(o)},incrementGCounter(o,i){h.getGCounter(o).increment(i),_("gCounters",o),g(o,"g-counter","increment")},hasGCounter(o){return a.has(o)},deleteGCounter(o){let i=a.delete(o);return i&&_("gCounters",o),i},getCounter(o){return T.has(o)||T.set(o,q(t)),T.get(o)},incrementCounter(o,i){h.getCounter(o).increment(i),_("pnCounters",o),g(o,"pn-counter","increment")},decrementCounter(o,i){h.getCounter(o).decrement(i),_("pnCounters",o),g(o,"pn-counter","decrement")},hasCounter(o){return T.has(o)},deleteCounter(o){let i=T.delete(o);return i&&_("pnCounters",o),i},getSet(o){return l.has(o)||l.set(o,j(t)),l.get(o)},addToSet(o,i){h.getSet(o).add(i),_("sets",o),g(o,"or-set","add")},removeFromSet(o,i){h.getSet(o).remove(i),_("sets",o),g(o,"or-set","remove")},hasSet(o){return l.has(o)},deleteSet(o){let i=l.delete(o);return i&&_("sets",o),i},merge(o){let i=o.getState();h.applyState(i)},getState(){L();let o={version:u,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let[i,E]of c)o.registers[i]=E.getState();for(let[i,E]of a)o.gCounters[i]=E.getState();for(let[i,E]of T)o.pnCounters[i]=E.getState();for(let[i,E]of l)o.sets[i]=E.getState();return o},applyState(o){for(let[i,E]of Object.entries(o.registers))typeof E?.timestamp!="number"||!Number.isFinite(E.timestamp)||(c.has(i)?c.get(i).applyState(E):c.set(i,G(t,E)),_("registers",i),g(i,"lww-register","merge"));for(let[i,E]of Object.entries(o.gCounters))a.has(i)?a.get(i).applyState(E):a.set(i,P(t,E)),_("gCounters",i),g(i,"g-counter","merge");for(let[i,E]of Object.entries(o.pnCounters))T.has(i)?T.get(i).applyState(E):T.set(i,B(t,E)),_("pnCounters",i),g(i,"pn-counter","merge");for(let[i,E]of Object.entries(o.sets))l.has(i)?l.get(i).applyState(E):l.set(i,H(t,E)),_("sets",i),g(i,"or-set","merge");u=Math.max(u,o.version)+1},getDelta(o){if(L(),d.length===0)return o>=u,null;if(o<d[0].fromVersion){let f=h.getState();return{fromVersion:o,toVersion:u,timestamp:Date.now(),nodeId:t,registers:f.registers,gCounters:f.gCounters,pnCounters:f.pnCounters,sets:f.sets}}let i=d.filter(f=>f.toVersion>o);if(i.length===0)return null;let E={fromVersion:o,toVersion:u,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let f of i)f.registers&&Object.assign(E.registers,f.registers),f.gCounters&&Object.assign(E.gCounters,f.gCounters),f.pnCounters&&Object.assign(E.pnCounters,f.pnCounters),f.sets&&Object.assign(E.sets,f.sets);return Object.keys(E.registers).length===0&&delete E.registers,Object.keys(E.gCounters).length===0&&delete E.gCounters,Object.keys(E.pnCounters).length===0&&delete E.pnCounters,Object.keys(E.sets).length===0&&delete E.sets,E},applyDelta(o){if(o.registers)for(let[i,E]of Object.entries(o.registers))typeof E?.timestamp!="number"||!Number.isFinite(E.timestamp)||(c.has(i)?c.get(i).applyState(E):c.set(i,G(t,E)),_("registers",i),g(i,"lww-register","merge"));if(o.gCounters)for(let[i,E]of Object.entries(o.gCounters))a.has(i)?a.get(i).applyState(E):a.set(i,P(t,E)),_("gCounters",i),g(i,"g-counter","merge");if(o.pnCounters)for(let[i,E]of Object.entries(o.pnCounters))T.has(i)?T.get(i).applyState(E):T.set(i,B(t,E)),_("pnCounters",i),g(i,"pn-counter","merge");if(o.sets)for(let[i,E]of Object.entries(o.sets))l.has(i)?l.get(i).applyState(E):l.set(i,H(t,E)),_("sets",i),g(i,"or-set","merge");u=Math.max(u,o.toVersion)+1},getVersion(){return u},getNodeId(){return t},on(o,i){if(o==="change")return m.add(i),()=>{m.delete(i)};throw new Error(`Unknown event type: ${o}`)},removeAllListeners(){m.clear()},keys(o){let i=[];return(!o||o==="lww-register")&&i.push(...Array.from(c.keys())),(!o||o==="g-counter")&&i.push(...Array.from(a.keys())),(!o||o==="pn-counter")&&i.push(...Array.from(T.keys())),(!o||o==="or-set")&&i.push(...Array.from(l.keys())),i},clear(){c.clear(),a.clear(),T.clear(),l.clear(),d.length=0,p.registers.clear(),p.gCounters.clear(),p.pnCounters.clear(),p.sets.clear(),u=0},getStats(){return{total:c.size+a.size+T.size+l.size,registers:c.size,gCounters:a.size,pnCounters:T.size,sets:l.size,version:u,nodeId:t,deltaHistorySize:d.length}}};return h}var Ot,Qe=R(()=>{"use strict";ce();k();Te();de();Ot={nodeId:"default-node",enableDeltaTracking:!0,maxDeltaHistory:100}});var Je=R(()=>{"use strict"});var Ze=R(()=>{"use strict";ce();k();Te();de();Qe();Je()});var Dt={};ct(Dt,{ALLOWED_TABLE_NAMES:()=>J,BinaryHeap:()=>fe,DEFAULT_UNIFIED_MEMORY_CONFIG:()=>rt,UnifiedHnswIndex:()=>x,UnifiedMemoryManager:()=>y,clearProjectRootCache:()=>z,createHnswIndex:()=>Ne,findProjectRoot:()=>X,getDefaultDbPath:()=>nt,getResolvedDefaultConfig:()=>st,getUnifiedMemory:()=>it,initializeUnifiedMemory:()=>At,resetUnifiedMemory:()=>vt,validateTableName:()=>b});import*as N from"fs";import*as tt from"os";import*as S from"path";function nt(){let n=X();return S.join(n,".agentic-qe","memory.db")}function st(){return{...rt,dbPath:nt()}}function it(n){return y.getInstance(n)}async function At(n){let e=it(n);return await e.initialize(),e}function vt(){y.resetInstance()}function bt(){if(et)return;et=!0;let n=()=>{try{let t=y.instance;t&&t.close()}catch(t){console.debug("[UnifiedMemory] Cleanup error:",t instanceof Error?t.message:t)}};process.on("beforeExit",n),Re(n);let e=t=>{Le(t)||(n(),process.exit(0))};process.on("SIGINT",e),process.on("SIGTERM",e)}var F,rt,y,et,yt=R(()=>{dt();_e();le();ut();Tt();ve();Z();Z();Se();Se();ie();Ve();ee();Ze();Et();_t();F=ge.create("unified-memory");rt={dbPath:".agentic-qe/memory.db",walMode:!0,mmapSize:U.MMAP_SIZE_BYTES,cacheSize:U.CACHE_SIZE_KB,busyTimeout:U.BUSY_TIMEOUT_MS,vectorDimensions:U.DEFAULT_VECTOR_DIMENSIONS};y=class n{static instance=null;static instancePromise=null;db=null;config;initialized=!1;vectorsLoaded=!1;initPromise=null;preparedStatements=new Map;vectorIndex=new x("qe-memory");crdtStore=null;proofGate=null;proofGateEnvChecked=!1;static PROOF_NS="__proofgate__";static PROOF_KEY="chain";constructor(e){let t=st();if(this.config={...t,...e},process.env.AQE_MEMORY_BACKEND==="memory"){this.config.dbPath=":memory:";return}if(this.config.dbPath!==":memory:"&&!S.isAbsolute(this.config.dbPath)){let s=X();this.config.dbPath=S.join(s,this.config.dbPath)}}static getInstance(e){return n.instance||(n.instance=new n(e)),n.instance}static async getInstanceAsync(e){return n.instance?.initialized?n.instance:(n.instancePromise||(n.instancePromise=(async()=>{let t=n.getInstance(e);return await t.initialize(),t})()),n.instancePromise)}static resetInstance(){n.instance&&(n.instance.close(),n.instance=null),n.instancePromise=null,z()}async initialize(e){if(!this.initialized)return this.initPromise||(this.initPromise=this._doInitialize(e?.signal)),this.initPromise}async _doInitialize(e){if(!this.initialized){e?.throwIfAborted();try{let t=this.config.dbPath===":memory:",s="",r=!1,c=0;if(!t){let a=process.env.AQE_PROJECT_ROOT;if(a){let T=S.resolve(this.config.dbPath),l=S.resolve(a);!T.startsWith(l)&&!T.startsWith(tt.tmpdir())&&T.includes(".agentic-qe")&&(console.error(`[UnifiedMemory] WARNING: DB path "${this.config.dbPath}" points to a production .agentic-qe/ while AQE_PROJECT_ROOT="${a}". Redirecting to test-safe path.`),this.config.dbPath=S.join(a,".agentic-qe","memory.db"))}if(s=S.dirname(this.config.dbPath),N.existsSync(s)||N.mkdirSync(s,{recursive:!0}),r=N.existsSync(this.config.dbPath),r)c=N.statSync(this.config.dbPath).size;else if(N.existsSync(s)){let T=this.findRecentBackups(s);if(T.length>0){let l=T[0];console.error(`[UnifiedMemory] CRITICAL: Database file missing but directory exists!
755
+ `,tt=["kv_store","vectors","rl_q_values","goap_actions","goap_goals","goap_plans","goap_plan_signatures","goap_execution_steps","concept_nodes","concept_edges","dream_cycles","dream_insights","qe_patterns","qe_pattern_embeddings","qe_pattern_usage","qe_trajectories","embeddings","execution_results","executed_steps","mincut_snapshots","mincut_history","mincut_weak_vertices","mincut_alerts","mincut_healing_actions","mincut_observations","hypergraph_nodes","hypergraph_edges","sona_patterns","witness_chain","learning_evidence_manifests","learning_evidence_segments","learning_segment_edges","learning_evidence_admissions","pattern_manifest_lineage","pattern_segment_lineage"]});function Te(n,e,t){return n.prepare("SELECT 1 FROM sqlite_master WHERE type = ? AND name = ?").get(e,t)!==void 0}function st(n){return n.replace(/\s+/g," ").trim().replace(/^CREATE TRIGGER IF NOT EXISTS /i,"CREATE TRIGGER ").replace(/ ?;$/,"").toLowerCase()}function F(n,e){return n.prepare(e).get()?.n??0}function nt(n){let e=Te(n,"table","qe_patterns_fts"),t=e&&Te(n,"table","qe_patterns_fts_docsize"),s=[],r=[],c=n.prepare("SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = ?");for(let d of Xt){let u=c.get(d);u===void 0?s.push(d):st(u.sql??"")!==Ut[d]&&r.push(d)}let a=F(n,"SELECT count(*) AS n FROM qe_patterns"),T=t?F(n,"SELECT count(*) AS n FROM qe_patterns_fts_docsize"):-1,l=t&&T===a?F(n,`SELECT count(*) AS n FROM qe_patterns p
756
+ WHERE NOT EXISTS (SELECT 1 FROM qe_patterns_fts_docsize d WHERE d.id = p.rowid)`):0;return{hasTable:e,hasDocsize:t,missingTriggers:s,mismatchedTriggers:r,patterns:a,indexed:T,unindexed:l}}function rt(n){return!n.hasTable||n.missingTriggers.length>0||n.mismatchedTriggers.length>0?!0:n.hasDocsize?n.indexed!==n.patterns||n.unindexed>0:!1}function wt(n){if(n.readonly)return!0;try{return Number(n.pragma("query_only",{simple:!0}))===1}catch{return!1}}function it(n,e={}){let t=e.log??(c=>console.warn(c)),s=e.logPrefix??"[PatternFTS]",r={status:"healthy",createdTable:!1,recreatedTriggers:[],replacedTriggers:[],rebuilt:!1,patternsBefore:-1,indexedBefore:-1,indexedAfter:-1};try{if(!Te(n,"table","qe_patterns"))return r.status="no-patterns",r;if(wt(n))return r.status="readonly",r;let c=nt(n);if(r.patternsBefore=c.patterns,r.indexedBefore=c.indexed,!rt(c))return r;let a=n.transaction(()=>{let T=nt(n);if(!rt(T))return null;T.hasTable||n.exec(oe);for(let l of T.missingTriggers)n.exec(D[l]);for(let l of T.mismatchedTriggers)n.exec(`DROP TRIGGER IF EXISTS ${l}`),n.exec(D[l]);return n.exec("INSERT INTO qe_patterns_fts(qe_patterns_fts) VALUES('rebuild')"),{s:T,indexedAfter:F(n,"SELECT count(*) AS n FROM qe_patterns_fts_docsize")}}).immediate();if(a){let{s:T}=a;r.createdTable=!T.hasTable,r.recreatedTriggers=[...T.missingTriggers],r.replacedTriggers=[...T.mismatchedTriggers],r.patternsBefore=T.patterns,r.indexedBefore=T.indexed,r.indexedAfter=a.indexedAfter,r.rebuilt=!0}if(r.rebuilt){r.status="healed";let T=[];r.createdTable&&T.push("created qe_patterns_fts"),r.recreatedTriggers.length>0&&T.push(`recreated triggers [${r.recreatedTriggers.join(", ")}]`),r.replacedTriggers.length>0&&T.push(`replaced triggers [${r.replacedTriggers.join(", ")}]`);let l=r.indexedBefore<0?"n/a":String(r.indexedBefore);T.push(`rebuilt index (indexed ${l} -> ${r.indexedAfter}, qe_patterns ${r.patternsBefore})`),t(`${s} Healed qe_patterns FTS5 index: ${T.join("; ")}`)}return r}catch(c){r.status="failed",r.error=b(c);try{t(`${s} qe_patterns FTS5 self-heal skipped: ${r.error} (keyword search may be degraded; vector search unaffected)`)}catch{}return r}}var Xt,Ut,ot=h(()=>{"use strict";_e();ce();Xt=Object.keys(D);Ut=Object.freeze(Object.fromEntries(Object.entries(D).map(([n,e])=>[n,st(e)])))});function Ee(n){if(!Number.isFinite(n))throw new RangeError("LWW register timestamp must be a finite number")}function M(n,e,t){let s=t??(e!==void 0?Date.now():0);Ee(s);let r={value:e,timestamp:s,nodeId:e!==void 0?n:"",version:e!==void 0?1:0,lastUpdated:Date.now()};function c(a,T,l,d){return a!==l?a-l:T===d?0:T>d?1:-1}return{get(){return r.value},set(a,T){let l=T??Date.now();Ee(l),T===void 0&&r.version>0&&r.nodeId===n&&l<=r.timestamp&&(l=r.timestamp+1),(r.version===0||c(l,n,r.timestamp,r.nodeId)>0)&&(r={value:a,timestamp:l,nodeId:n,version:r.version+1,lastUpdated:Date.now()})},merge(a){let T=a.getState();this.applyState(T)},getState(){return{value:r.value,timestamp:r.timestamp,nodeId:r.nodeId,version:r.version,lastUpdated:r.lastUpdated}},applyState(a){a.version!==0&&(Ee(a.timestamp),(r.version===0||c(a.timestamp,a.nodeId,r.timestamp,r.nodeId)>0)&&(r={value:a.value,timestamp:a.timestamp,nodeId:a.nodeId,version:Math.max(r.version,a.version)+1,lastUpdated:Date.now()}))},getNodeId(){return n},getTimestamp(){return r.timestamp}}}function G(n,e){let t=M(n);return t.applyState(e),t}var de=h(()=>{"use strict"});function O(n){let e={counts:K(),version:0,lastUpdated:Date.now()};return V(e.counts,n,0),{get(){return Object.values(e.counts).reduce((t,s)=>t+s,0)},increment(t=1){if(t<0)throw new Error("G-Counter can only increment by positive values");t!==0&&(Ae(e.counts,n,t),e.version++,e.lastUpdated=Date.now())},merge(t){let s=t.getState();this.applyState(s)},getState(){return{counts:Object.assign(K(),e.counts),version:e.version,lastUpdated:e.lastUpdated}},applyState(t){let s=!1;for(let[r,c]of Object.entries(t.counts)){let a=$(e.counts,r)??0;c>a&&(V(e.counts,r,c),s=!0)}s&&(e.version=Math.max(e.version,t.version)+1,e.lastUpdated=Date.now())},getNodeId(){return n},getLocalCount(){return $(e.counts,n)??0}}}function P(n,e){let t=O(n);return t.applyState(e),t}var k=h(()=>{"use strict";Ot()});function q(n){let e=O(n),t=O(n),s=0,r=Date.now();return{get(){return e.get()-t.get()},increment(c=1){if(c<0)throw new Error("Use decrement() for negative values");c!==0&&(e.increment(c),s++,r=Date.now())},decrement(c=1){if(c<0)throw new Error("Use increment() for negative values");c!==0&&(t.increment(c),s++,r=Date.now())},merge(c){let a=c.getState();this.applyState(a)},getState(){return{positive:e.getState(),negative:t.getState(),version:s,lastUpdated:r}},applyState(c){let a=this.get();e.applyState(c.positive),t.applyState(c.negative);let T=this.get();a!==T&&(s=Math.max(s,c.version)+1,r=Date.now())},getNodeId(){return n}}}function B(n,e){let t=q(n);return t.applyState(e),t}var ue=h(()=>{"use strict";k()});function xt(n,e){return`${n}:${Date.now()}:${e}`}function le(n){return typeof n=="string"?`s:${n}`:typeof n=="number"?`n:${n}`:typeof n=="boolean"?`b:${n}`:`j:${JSON.stringify(n)}`}function Ft(n){let e=n.substring(0,2),t=n.substring(2);switch(e){case"s:":return t;case"n:":return Number(t);case"b:":return t==="true";case"j:":return I(t);default:throw new Error(`Unknown serialization type: ${e}`)}}function j(n){let e=new Map,t=new Map,s=0,r=Date.now(),c=0;function a(d){let u=`${n}:`;if(!d.startsWith(u))return;let m=d.slice(u.length),p=/^(-?\d+):(\d+)$/.exec(m);if(!p)return;let g=Number(p[1]),_=Number(p[2]);Number.isSafeInteger(g)&&Number.isSafeInteger(_)&&_<Number.MAX_SAFE_INTEGER&&(c=Math.max(c,_+1))}function T(d){let u=e.get(d);if(!u||u.size===0)return!1;let m=t.get(d);if(!m||m.size===0)return!0;for(let p of u)if(!m.has(p))return!0;return!1}function l(d){let u=e.get(d);if(!u)return new Set;let m=t.get(d)||new Set,p=new Set;for(let g of u)m.has(g)||p.add(g);return p}return{has(d){let u=le(d);return T(u)},values(){let d=[];for(let[u]of e)T(u)&&d.push(Ft(u));return d},size(){let d=0;for(let[u]of e)T(u)&&d++;return d},add(d){let u=le(d),m=xt(n,c++);e.has(u)||e.set(u,new Set),e.get(u).add(m),s++,r=Date.now()},remove(d){let u=le(d),m=e.get(u);if(!m||m.size===0)return;t.has(u)||t.set(u,new Set);let p=t.get(u);for(let g of m)p.add(g);s++,r=Date.now()},merge(d){let u=d.getState();this.applyState(u)},getState(){let d={};for(let[m,p]of e)d[m]=Array.from(p);let u={};for(let[m,p]of t)p.size>0&&(u[m]=Array.from(p));return{elements:d,tombstones:u,version:s,lastUpdated:r}},applyState(d){let u=!1;for(let[m,p]of Object.entries(d.elements)){e.has(m)||e.set(m,new Set);let g=e.get(m);for(let _ of p)a(_),g.has(_)||(g.add(_),u=!0)}for(let[m,p]of Object.entries(d.tombstones)){t.has(m)||t.set(m,new Set);let g=t.get(m);for(let _ of p)a(_),g.has(_)||(g.add(_),u=!0)}u&&(s=Math.max(s,d.version)+1,r=Date.now())},getNodeId(){return n},clear(){for(let[d,u]of e){t.has(d)||t.set(d,new Set);let m=t.get(d);for(let p of u)m.add(p)}s++,r=Date.now()}}}function H(n,e){let t=j(n);return t.applyState(e),t}var ge=h(()=>{"use strict";Ne()});function pe(n){let e={...Mt,...n},{nodeId:t,enableDeltaTracking:s,maxDeltaHistory:r}=e,c=new Map,a=new Map,T=new Map,l=new Map,d=0,u=[],m=new Set,p={registers:new Set,gCounters:new Set,pnCounters:new Set,sets:new Set};function g(o,i,E){let f={key:o,type:i,operation:E,timestamp:Date.now(),nodeId:t};for(let _t of m)try{_t(f)}catch(mt){console.error("[CRDTStore] Error in change listener:",mt)}}function _(o,i){d++,s&&p[o].add(i)}function L(){if(!s||!(p.registers.size>0||p.gCounters.size>0||p.pnCounters.size>0||p.sets.size>0))return;let i={fromVersion:u.length>0?u[u.length-1].toVersion:0,toVersion:d,timestamp:Date.now(),nodeId:t};if(p.registers.size>0){i.registers={};for(let E of p.registers){let f=c.get(E);f&&(i.registers[E]=f.getState())}p.registers.clear()}if(p.gCounters.size>0){i.gCounters={};for(let E of p.gCounters){let f=a.get(E);f&&(i.gCounters[E]=f.getState())}p.gCounters.clear()}if(p.pnCounters.size>0){i.pnCounters={};for(let E of p.pnCounters){let f=T.get(E);f&&(i.pnCounters[E]=f.getState())}p.pnCounters.clear()}if(p.sets.size>0){i.sets={};for(let E of p.sets){let f=l.get(E);f&&(i.sets[E]=f.getState())}p.sets.clear()}for(u.push(i);u.length>r;)u.shift()}let R={getRegister(o){return c.has(o)||c.set(o,M(t)),c.get(o)},setRegister(o,i){R.getRegister(o).set(i),_("registers",o),g(o,"lww-register","set")},hasRegister(o){return c.has(o)},deleteRegister(o){let i=c.delete(o);return i&&_("registers",o),i},getGCounter(o){return a.has(o)||a.set(o,O(t)),a.get(o)},incrementGCounter(o,i){R.getGCounter(o).increment(i),_("gCounters",o),g(o,"g-counter","increment")},hasGCounter(o){return a.has(o)},deleteGCounter(o){let i=a.delete(o);return i&&_("gCounters",o),i},getCounter(o){return T.has(o)||T.set(o,q(t)),T.get(o)},incrementCounter(o,i){R.getCounter(o).increment(i),_("pnCounters",o),g(o,"pn-counter","increment")},decrementCounter(o,i){R.getCounter(o).decrement(i),_("pnCounters",o),g(o,"pn-counter","decrement")},hasCounter(o){return T.has(o)},deleteCounter(o){let i=T.delete(o);return i&&_("pnCounters",o),i},getSet(o){return l.has(o)||l.set(o,j(t)),l.get(o)},addToSet(o,i){R.getSet(o).add(i),_("sets",o),g(o,"or-set","add")},removeFromSet(o,i){R.getSet(o).remove(i),_("sets",o),g(o,"or-set","remove")},hasSet(o){return l.has(o)},deleteSet(o){let i=l.delete(o);return i&&_("sets",o),i},merge(o){let i=o.getState();R.applyState(i)},getState(){L();let o={version:d,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let[i,E]of c)o.registers[i]=E.getState();for(let[i,E]of a)o.gCounters[i]=E.getState();for(let[i,E]of T)o.pnCounters[i]=E.getState();for(let[i,E]of l)o.sets[i]=E.getState();return o},applyState(o){for(let[i,E]of Object.entries(o.registers))typeof E?.timestamp!="number"||!Number.isFinite(E.timestamp)||(c.has(i)?c.get(i).applyState(E):c.set(i,G(t,E)),_("registers",i),g(i,"lww-register","merge"));for(let[i,E]of Object.entries(o.gCounters))a.has(i)?a.get(i).applyState(E):a.set(i,P(t,E)),_("gCounters",i),g(i,"g-counter","merge");for(let[i,E]of Object.entries(o.pnCounters))T.has(i)?T.get(i).applyState(E):T.set(i,B(t,E)),_("pnCounters",i),g(i,"pn-counter","merge");for(let[i,E]of Object.entries(o.sets))l.has(i)?l.get(i).applyState(E):l.set(i,H(t,E)),_("sets",i),g(i,"or-set","merge");d=Math.max(d,o.version)+1},getDelta(o){if(L(),u.length===0)return o>=d,null;if(o<u[0].fromVersion){let f=R.getState();return{fromVersion:o,toVersion:d,timestamp:Date.now(),nodeId:t,registers:f.registers,gCounters:f.gCounters,pnCounters:f.pnCounters,sets:f.sets}}let i=u.filter(f=>f.toVersion>o);if(i.length===0)return null;let E={fromVersion:o,toVersion:d,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let f of i)f.registers&&Object.assign(E.registers,f.registers),f.gCounters&&Object.assign(E.gCounters,f.gCounters),f.pnCounters&&Object.assign(E.pnCounters,f.pnCounters),f.sets&&Object.assign(E.sets,f.sets);return Object.keys(E.registers).length===0&&delete E.registers,Object.keys(E.gCounters).length===0&&delete E.gCounters,Object.keys(E.pnCounters).length===0&&delete E.pnCounters,Object.keys(E.sets).length===0&&delete E.sets,E},applyDelta(o){if(o.registers)for(let[i,E]of Object.entries(o.registers))typeof E?.timestamp!="number"||!Number.isFinite(E.timestamp)||(c.has(i)?c.get(i).applyState(E):c.set(i,G(t,E)),_("registers",i),g(i,"lww-register","merge"));if(o.gCounters)for(let[i,E]of Object.entries(o.gCounters))a.has(i)?a.get(i).applyState(E):a.set(i,P(t,E)),_("gCounters",i),g(i,"g-counter","merge");if(o.pnCounters)for(let[i,E]of Object.entries(o.pnCounters))T.has(i)?T.get(i).applyState(E):T.set(i,B(t,E)),_("pnCounters",i),g(i,"pn-counter","merge");if(o.sets)for(let[i,E]of Object.entries(o.sets))l.has(i)?l.get(i).applyState(E):l.set(i,H(t,E)),_("sets",i),g(i,"or-set","merge");d=Math.max(d,o.toVersion)+1},getVersion(){return d},getNodeId(){return t},on(o,i){if(o==="change")return m.add(i),()=>{m.delete(i)};throw new Error(`Unknown event type: ${o}`)},removeAllListeners(){m.clear()},keys(o){let i=[];return(!o||o==="lww-register")&&i.push(...Array.from(c.keys())),(!o||o==="g-counter")&&i.push(...Array.from(a.keys())),(!o||o==="pn-counter")&&i.push(...Array.from(T.keys())),(!o||o==="or-set")&&i.push(...Array.from(l.keys())),i},clear(){c.clear(),a.clear(),T.clear(),l.clear(),u.length=0,p.registers.clear(),p.gCounters.clear(),p.pnCounters.clear(),p.sets.clear(),d=0},getStats(){return{total:c.size+a.size+T.size+l.size,registers:c.size,gCounters:a.size,pnCounters:T.size,sets:l.size,version:d,nodeId:t,deltaHistorySize:u.length}}};return R}var Mt,at=h(()=>{"use strict";de();k();ue();ge();Mt={nodeId:"default-node",enableDeltaTracking:!0,maxDeltaHistory:100}});var ct=h(()=>{"use strict"});var Tt=h(()=>{"use strict";de();k();ue();ge();at();ct()});var jt={};ft(jt,{ALLOWED_TABLE_NAMES:()=>te,BinaryHeap:()=>Ie,DEFAULT_UNIFIED_MEMORY_CONFIG:()=>lt,UnifiedHnswIndex:()=>x,UnifiedMemoryManager:()=>A,clearProjectRootCache:()=>z,createHnswIndex:()=>Ce,findProjectRoot:()=>X,getDefaultDbPath:()=>ut,getOpenUnifiedMemoryDatabase:()=>Pt,getResolvedDefaultConfig:()=>gt,getUnifiedMemory:()=>pt,initializeUnifiedMemory:()=>Gt,resetUnifiedMemory:()=>kt,validateTableName:()=>y,writeWhenUnlockedOn:()=>qt});import*as N from"fs";import*as dt from"os";import*as S from"path";function ut(){let n=X();return S.join(n,".agentic-qe","memory.db")}function gt(){return{...lt,dbPath:ut()}}function pt(n){return A.getInstance(n)}async function Gt(n){let e=pt(n);return await e.initialize(),e}function Pt(){return A.peekInitialized()?.getDatabase()??null}function kt(){A.resetInstance()}function qt(n,e){return Re(n,e)}function Bt(){if(Et)return;Et=!0;let n=()=>{try{let t=A.instance;t&&t.close()}catch(t){console.debug("[UnifiedMemory] Cleanup error:",t instanceof Error?t.message:t)}};process.on("beforeExit",n),be(n);let e=t=>{ve(t)||(n(),process.exit(0))};process.on("SIGINT",e),process.on("SIGTERM",e)}var w,lt,A,Et,Ht=h(()=>{ht();Ne();De();Rt();Ue();_e();Lt();Nt();Ge();ne();ne();Oe();Oe();ce();ot();re();Tt();St();At();w=me.create("unified-memory");lt={dbPath:".agentic-qe/memory.db",walMode:!0,mmapSize:U.MMAP_SIZE_BYTES,cacheSize:U.CACHE_SIZE_KB,busyTimeout:U.BUSY_TIMEOUT_MS,vectorDimensions:U.DEFAULT_VECTOR_DIMENSIONS};A=class n{static instance=null;static instancePromise=null;db=null;config;initialized=!1;vectorsLoaded=!1;initPromise=null;writeQueue=Promise.resolve();queuedWrites=0;preparedStatements=new Map;vectorIndex=new x("qe-memory");crdtStore=null;proofGate=null;proofGateEnvChecked=!1;static PROOF_NS="__proofgate__";static PROOF_KEY="chain";constructor(e){let t=gt();if(this.config={...t,...e},process.env.AQE_MEMORY_BACKEND==="memory"){this.config.dbPath=":memory:";return}if(this.config.dbPath!==":memory:"&&!S.isAbsolute(this.config.dbPath)){let s=X();this.config.dbPath=S.join(s,this.config.dbPath)}}static getInstance(e){return n.instance||(n.instance=new n(e)),n.instance}static async getInstanceAsync(e){return n.instance?.initialized?n.instance:(n.instancePromise||(n.instancePromise=(async()=>{let t=n.getInstance(e);return await t.initialize(),t})()),n.instancePromise)}static peekInitialized(){let e=n.instance;return e?.initialized?e:null}static resetInstance(){n.instance&&(n.instance.close(),n.instance=null),n.instancePromise=null,z()}async initialize(e){if(!this.initialized)return this.initPromise||(this.initPromise=this._doInitialize(e?.signal)),this.initPromise}async _doInitialize(e){if(!this.initialized){e?.throwIfAborted();try{let t=this.config.dbPath===":memory:",s="",r=!1,c=0;if(!t){let a=process.env.AQE_PROJECT_ROOT;if(a){let T=S.resolve(this.config.dbPath),l=S.resolve(a);!T.startsWith(l)&&!T.startsWith(dt.tmpdir())&&T.includes(".agentic-qe")&&(console.error(`[UnifiedMemory] WARNING: DB path "${this.config.dbPath}" points to a production .agentic-qe/ while AQE_PROJECT_ROOT="${a}". Redirecting to test-safe path.`),this.config.dbPath=S.join(a,".agentic-qe","memory.db"))}if(s=S.dirname(this.config.dbPath),N.existsSync(s)||N.mkdirSync(s,{recursive:!0}),r=N.existsSync(this.config.dbPath),r)c=N.statSync(this.config.dbPath).size;else if(N.existsSync(s)){let T=this.findRecentBackups(s);if(T.length>0){let l=T[0];console.error(`[UnifiedMemory] CRITICAL: Database file missing but directory exists!
757
757
  Expected: ${this.config.dbPath}
758
758
  Found ${T.length} backup(s), newest: ${l.path} (${(l.size/1024/1024).toFixed(1)}MB)
759
- Restoring from backup to prevent data loss...`),N.copyFileSync(l.path,this.config.dbPath);for(let u of["-wal","-shm"]){let d=this.config.dbPath+u;N.existsSync(d)&&N.unlinkSync(d)}c=l.size}}}if(e?.throwIfAborted(),this.db=pe(this.config.dbPath,{walMode:this.config.walMode,busyTimeout:this.config.busyTimeout,autoRestore:!0}),this.db.pragma(`mmap_size = ${this.config.mmapSize}`),this.db.pragma(`cache_size = ${this.config.cacheSize}`),this.db.pragma("foreign_keys = ON"),e?.aborted){try{this.db.close()}catch{}this.db=null,e.throwIfAborted()}if(await this.runMigrations(),$e(this.db,{logPrefix:"[UnifiedMemory]"}),e?.throwIfAborted(),r&&c>1e6)try{let a=this.db.prepare("SELECT COUNT(*) as cnt FROM qe_patterns").get();if(a&&a.cnt===0){let T=N.statSync(this.config.dbPath).size;T<c*.1&&console.error(`[UnifiedMemory] CRITICAL: Possible data loss detected!
759
+ Restoring from backup to prevent data loss...`),N.copyFileSync(l.path,this.config.dbPath);for(let d of["-wal","-shm"]){let u=this.config.dbPath+d;N.existsSync(u)&&N.unlinkSync(u)}c=l.size}}}if(e?.throwIfAborted(),this.db=fe(this.config.dbPath,{walMode:this.config.walMode,busyTimeout:this.config.busyTimeout,autoRestore:!0}),this.db.pragma(`mmap_size = ${this.config.mmapSize}`),this.db.pragma(`cache_size = ${this.config.cacheSize}`),this.db.pragma("foreign_keys = ON"),e?.aborted){try{this.db.close()}catch{}this.db=null,e.throwIfAborted()}if(await this.runMigrations(),it(this.db,{logPrefix:"[UnifiedMemory]"}),e?.throwIfAborted(),r&&c>1e6)try{let a=this.db.prepare("SELECT COUNT(*) as cnt FROM qe_patterns").get();if(a&&a.cnt===0){let T=N.statSync(this.config.dbPath).size;T<c*.1&&console.error(`[UnifiedMemory] CRITICAL: Possible data loss detected!
760
760
  DB was ${(c/1024/1024).toFixed(1)}MB, now ${(T/1024/1024).toFixed(1)}MB with 0 patterns.
761
761
  This looks like the DB was replaced with an empty schema.
762
- Check backups in ${s} and restore manually.`)}}catch{}this.vectorsLoaded=!1,this.initialized=!0,console.log(`[UnifiedMemory] Initialized: ${this.config.dbPath}`),this.warnIfDuplicateDatabases()}catch(t){throw this.initPromise=null,t instanceof Error&&(t.name==="AbortError"||(e?.aborted??!1))?t:new Error(`Failed to initialize UnifiedMemoryManager: ${A(t)}`)}}}findRecentBackups(e){try{let s=N.readdirSync(e).filter(c=>c.startsWith("memory")&&c.endsWith(".db")&&c!=="memory.db").map(c=>{let a=S.join(e,c),T=N.statSync(a);return{path:a,size:T.size,mtime:T.mtimeMs}}).filter(c=>c.size>1e6).sort((c,a)=>a.mtime-c.mtime),r=S.join(e,"backups");if(N.existsSync(r)){let c=N.readdirSync(r);for(let a of c)if(a.endsWith(".db")){let T=S.join(r,a),l=N.statSync(T);l.size>1e6&&s.push({path:T,size:l.size,mtime:l.mtimeMs})}s.sort((a,T)=>T.mtime-a.mtime)}return s}catch{return[]}}warnIfDuplicateDatabases(){if(this.config.dbPath!==":memory:")try{let e=X(),t=S.resolve(this.config.dbPath),r=[S.join(e,".agentic-qe","memory.db"),S.join(e,"v3",".agentic-qe","memory.db")].map(c=>S.resolve(c)).filter(c=>c!==t&&N.existsSync(c));r.length>0&&console.warn(`[UnifiedMemory] WARNING: Duplicate database(s) detected!
762
+ Check backups in ${s} and restore manually.`)}}catch{}this.vectorsLoaded=!1,this.initialized=!0,Se(this.db,a=>this.writeWhenUnlocked(a)),console.log(`[UnifiedMemory] Initialized: ${this.config.dbPath}`),this.warnIfDuplicateDatabases()}catch(t){throw this.initPromise=null,t instanceof Error&&(t.name==="AbortError"||(e?.aborted??!1))?t:new Error(`Failed to initialize UnifiedMemoryManager: ${b(t)}`)}}}findRecentBackups(e){try{let s=N.readdirSync(e).filter(c=>c.startsWith("memory")&&c.endsWith(".db")&&c!=="memory.db").map(c=>{let a=S.join(e,c),T=N.statSync(a);return{path:a,size:T.size,mtime:T.mtimeMs}}).filter(c=>c.size>1e6).sort((c,a)=>a.mtime-c.mtime),r=S.join(e,"backups");if(N.existsSync(r)){let c=N.readdirSync(r);for(let a of c)if(a.endsWith(".db")){let T=S.join(r,a),l=N.statSync(T);l.size>1e6&&s.push({path:T,size:l.size,mtime:l.mtimeMs})}s.sort((a,T)=>T.mtime-a.mtime)}return s}catch{return[]}}warnIfDuplicateDatabases(){if(this.config.dbPath!==":memory:")try{let e=X(),t=S.resolve(this.config.dbPath),r=[S.join(e,".agentic-qe","memory.db"),S.join(e,"v3",".agentic-qe","memory.db")].map(c=>S.resolve(c)).filter(c=>c!==t&&N.existsSync(c));r.length>0&&console.warn(`[UnifiedMemory] WARNING: Duplicate database(s) detected!
763
763
  Canonical: ${t}
764
764
  Duplicates: ${r.join(", ")}
765
- This can cause data splits. Remove duplicates or set AQE_PROJECT_ROOT.`)}catch(e){F.debug("Duplicate database check failed",{error:e instanceof Error?e.message:String(e)})}}columnExists(e,t){if(!this.db)return!1;try{let s=b(e);return this.db.prepare(`PRAGMA table_info(${s})`).all().some(c=>c.name===t)}catch(s){return F.debug("Column existence check failed",{table:e,column:t,error:s instanceof Error?s.message:String(s)}),!1}}handleV2SchemaIncompatibilities(){if(!this.db)return;let e=[{table:"goap_plans",requiredColumn:"status",columnDef:"TEXT DEFAULT 'pending'"},{table:"goap_actions",requiredColumn:"agent_type",columnDef:"TEXT DEFAULT 'unknown'"},{table:"concept_nodes",requiredColumn:"concept_type",columnDef:"TEXT DEFAULT 'general'"},{table:"concept_edges",requiredColumn:"edge_type",columnDef:"TEXT DEFAULT 'related'"},{table:"dream_insights",requiredColumn:"cycle_id",columnDef:"TEXT DEFAULT ''"},{table:"rl_q_values",requiredColumn:"algorithm",columnDef:"TEXT DEFAULT 'q-learning'"}];for(let{table:t,requiredColumn:s,columnDef:r}of e)if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(t)&&!this.columnExists(t,s)){let a=b(t);try{this.db.exec(`ALTER TABLE ${a} ADD COLUMN ${s} ${r}`),console.log(`[UnifiedMemory] Added column ${s} to ${t} (safe migration)`)}catch(T){console.log(`[UnifiedMemory] Column ${s} on ${t}: ${T instanceof Error?T.message:String(T)}`)}}}async runMigrations(){if(!this.db)throw new Error("Database not initialized");this.db.exec(Fe),this.handleV2SchemaIncompatibilities();let t=this.db.prepare("SELECT version FROM schema_version WHERE id = 1").get()?.version??0;t<C&&(console.log(`[UnifiedMemory] Migrating from v${t} to v${C}`),this.db.transaction(()=>{let a=this.db.prepare("SELECT version FROM schema_version WHERE id = 1").get()?.version??0;return a>=C||(a<1&&this.db.exec(xe),a<2&&this.db.exec(we),a<3&&(this.db.exec(Me),this.db.exec(ne),this.db.exec(Ge)),a<4&&this.db.exec(ke),a<5&&this.db.exec(Be),a<6&&this.db.exec(W),a<7&&this.db.exec(je),a<8&&this.db.exec(He),a<9&&(this.db.exec(se),this.db.exec("INSERT INTO qe_patterns_fts(qe_patterns_fts) VALUES('rebuild')")),a<10&&this.db.exec(Y),a<11&&this.migrateToV11GoapExecutionSteps(),a<12&&ye(this.db),a<13&&this.migrateToV13EmbeddingSpace(),a<14&&this.db.exec(te),this.db.prepare(`
765
+ This can cause data splits. Remove duplicates or set AQE_PROJECT_ROOT.`)}catch(e){w.debug("Duplicate database check failed",{error:e instanceof Error?e.message:String(e)})}}columnExists(e,t){if(!this.db)return!1;try{let s=y(e);return this.db.prepare(`PRAGMA table_info(${s})`).all().some(c=>c.name===t)}catch(s){return w.debug("Column existence check failed",{table:e,column:t,error:s instanceof Error?s.message:String(s)}),!1}}handleV2SchemaIncompatibilities(){if(!this.db)return;let e=[{table:"goap_plans",requiredColumn:"status",columnDef:"TEXT DEFAULT 'pending'"},{table:"goap_actions",requiredColumn:"agent_type",columnDef:"TEXT DEFAULT 'unknown'"},{table:"concept_nodes",requiredColumn:"concept_type",columnDef:"TEXT DEFAULT 'general'"},{table:"concept_edges",requiredColumn:"edge_type",columnDef:"TEXT DEFAULT 'related'"},{table:"dream_insights",requiredColumn:"cycle_id",columnDef:"TEXT DEFAULT ''"},{table:"rl_q_values",requiredColumn:"algorithm",columnDef:"TEXT DEFAULT 'q-learning'"}];for(let{table:t,requiredColumn:s,columnDef:r}of e)if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(t)&&!this.columnExists(t,s)){let a=y(t);try{this.db.exec(`ALTER TABLE ${a} ADD COLUMN ${s} ${r}`),console.log(`[UnifiedMemory] Added column ${s} to ${t} (safe migration)`)}catch(T){console.log(`[UnifiedMemory] Column ${s} on ${t}: ${T instanceof Error?T.message:String(T)}`)}}}async runMigrations(){if(!this.db)throw new Error("Database not initialized");this.db.exec(He),this.handleV2SchemaIncompatibilities();let t=this.db.prepare("SELECT version FROM schema_version WHERE id = 1").get()?.version??0;t<C&&(console.log(`[UnifiedMemory] Migrating from v${t} to v${C}`),this.db.transaction(()=>{let a=this.db.prepare("SELECT version FROM schema_version WHERE id = 1").get()?.version??0;return a>=C||(a<1&&this.db.exec(ze),a<2&&this.db.exec(We),a<3&&(this.db.exec(Ye),this.db.exec(ie),this.db.exec(Ke)),a<4&&this.db.exec(Ve),a<5&&this.db.exec(Je),a<6&&this.db.exec(W),a<7&&this.db.exec(Ze),a<8&&this.db.exec(et),a<9&&(this.db.exec(ae),this.db.exec("INSERT INTO qe_patterns_fts(qe_patterns_fts) VALUES('rebuild')")),a<10&&this.db.exec(Y),a<11&&this.migrateToV11GoapExecutionSteps(),a<12&&qe(this.db),a<13&&this.migrateToV13EmbeddingSpace(),a<14&&this.db.exec(se),this.db.prepare(`
766
766
  INSERT OR REPLACE INTO schema_version (id, version, migrated_at)
767
767
  VALUES (1, ?, datetime('now'))
768
- `).run(C)),a}).immediate()>=C?console.log(`[UnifiedMemory] Another process completed the migration to v${C}`):console.log("[UnifiedMemory] Migration complete"))}migrateToV11GoapExecutionSteps(){let e=this.db;e.exec(ne);let t=(s,r,c)=>{e.prepare(`SELECT name FROM pragma_table_info('${s}')`).all().some(T=>T.name===r)||e.exec(`ALTER TABLE ${s} ADD COLUMN ${r} ${c}`)};t("goap_execution_steps","execution_id","TEXT"),t("goap_execution_steps","retries","INTEGER DEFAULT 0"),t("goap_execution_steps","started_at","TEXT"),t("goap_execution_steps","agent_output","TEXT"),t("goap_actions","method","TEXT"),t("goap_actions","params","TEXT"),t("goap_actions","implemented","INTEGER DEFAULT 0"),e.exec("CREATE INDEX IF NOT EXISTS idx_goap_exec_steps_execution ON goap_execution_steps(execution_id)")}async loadVectorIndex(){if(this.vectorsLoaded)return;if(!this.db)throw new Error("Database not initialized");this.vectorIndex.clear();let e=this.db.prepare("SELECT id, embedding, dimensions FROM vectors").all();for(let t of e){let s=this.bufferToFloatArray(t.embedding,t.dimensions);this.vectorIndex.add(t.id,s)}this.vectorsLoaded=!0,console.log(`[UnifiedMemory] Loaded ${e.length} vectors into vector index (ruvector flat)`)}async kvSet(e,t,s="default",r){this.ensureInitialized();let c=r?Date.now()+r*1e3:null,a=JSON.stringify(t);this.db.prepare(`
768
+ `).run(C)),a}).immediate()>=C?console.log(`[UnifiedMemory] Another process completed the migration to v${C}`):console.log("[UnifiedMemory] Migration complete"))}migrateToV11GoapExecutionSteps(){let e=this.db;e.exec(ie);let t=(s,r,c)=>{e.prepare(`SELECT name FROM pragma_table_info('${s}')`).all().some(T=>T.name===r)||e.exec(`ALTER TABLE ${s} ADD COLUMN ${r} ${c}`)};t("goap_execution_steps","execution_id","TEXT"),t("goap_execution_steps","retries","INTEGER DEFAULT 0"),t("goap_execution_steps","started_at","TEXT"),t("goap_execution_steps","agent_output","TEXT"),t("goap_actions","method","TEXT"),t("goap_actions","params","TEXT"),t("goap_actions","implemented","INTEGER DEFAULT 0"),e.exec("CREATE INDEX IF NOT EXISTS idx_goap_exec_steps_execution ON goap_execution_steps(execution_id)")}async loadVectorIndex(){if(this.vectorsLoaded)return;if(!this.db)throw new Error("Database not initialized");this.vectorIndex.clear();let e=this.db.prepare("SELECT id, embedding, dimensions FROM vectors").all();for(let t of e){let s=this.bufferToFloatArray(t.embedding,t.dimensions);this.vectorIndex.add(t.id,s)}this.vectorsLoaded=!0,console.log(`[UnifiedMemory] Loaded ${e.length} vectors into vector index (ruvector flat)`)}writeWhenUnlocked(e){let t=()=>Xe(this.db,e,{waitMs:Q(this.config.busyTimeout),budgetMs:this.config.busyTimeout}),s=this.queuedWrites===0?t():this.writeQueue.then(()=>new Promise(c=>setImmediate(c))).then(t);this.queuedWrites++;let r=s.then(()=>{},()=>{});return this.writeQueue=r,r.then(()=>{this.queuedWrites--}),s}async kvSet(e,t,s="default",r){this.ensureInitialized();let c=r?Date.now()+r*1e3:null,a=JSON.stringify(t);await this.writeWhenUnlocked(()=>this.db.prepare(`
769
769
  INSERT OR REPLACE INTO kv_store (key, namespace, value, expires_at)
770
770
  VALUES (?, ?, ?, ?)
771
- `).run(e,s,a,c),this.auditWrite("kvSet",s,e,a)}async kvGet(e,t="default"){this.ensureInitialized();let s=this.db.prepare(`
771
+ `).run(e,s,a,c)),this.auditWrite("kvSet",s,e,a)}async kvGet(e,t="default"){this.ensureInitialized();let s=this.db.prepare(`
772
772
  SELECT value, expires_at FROM kv_store
773
773
  WHERE key = ? AND namespace = ?
774
- `).get(e,t);if(s){if(s.expires_at&&Date.now()>s.expires_at){this.db.prepare("DELETE FROM kv_store WHERE key = ? AND namespace = ?").run(e,t);return}return I(s.value)}}async kvDelete(e,t="default"){this.ensureInitialized();let s=this.db.prepare("DELETE FROM kv_store WHERE key = ? AND namespace = ?").run(e,t);return s.changes>0&&this.auditWrite("kvDelete",t,e,""),s.changes>0}async kvExists(e,t="default"){return this.ensureInitialized(),this.db.prepare(`
774
+ `).get(e,t);if(s){if(s.expires_at&&Date.now()>s.expires_at){try{Z(this.db,Q(this.config.busyTimeout),()=>this.db.prepare("DELETE FROM kv_store WHERE key = ? AND namespace = ?").run(e,t))}catch(r){if(!J(r))throw r}return}return I(s.value)}}async kvDelete(e,t="default"){this.ensureInitialized();let s=await this.writeWhenUnlocked(()=>this.db.prepare("DELETE FROM kv_store WHERE key = ? AND namespace = ?").run(e,t));return s.changes>0&&this.auditWrite("kvDelete",t,e,""),s.changes>0}async kvExists(e,t="default"){return this.ensureInitialized(),this.db.prepare(`
775
775
  SELECT 1 FROM kv_store
776
776
  WHERE key = ? AND namespace = ? AND (expires_at IS NULL OR expires_at > ?)
777
777
  `).get(e,t,Date.now())!==void 0}async kvSearch(e,t="default",s=100){this.ensureInitialized();let r=e.replace(/[!%_]/g,"!$&").replace(/\*/g,"%").replace(/\?/g,"_");return this.db.prepare(`
@@ -779,14 +779,14 @@ import{d as W,f as lt}from"./chunk-337Z52QM.js";import{b as I,d as _e}from"./chu
779
779
  WHERE namespace = ? AND key LIKE ? ESCAPE '!'
780
780
  AND (expires_at IS NULL OR expires_at > ?)
781
781
  LIMIT ?
782
- `).all(t,r,Date.now(),s).map(a=>a.key)}async kvCleanupExpired(){return this.ensureInitialized(),this.db.prepare("DELETE FROM kv_store WHERE expires_at IS NOT NULL AND expires_at < ?").run(Date.now()).changes}enableProofGate(){this.ensureInitialized(),this.proofGateEnvChecked=!0,!this.proofGate&&(this.proofGate=this.loadProofChain()??new v)}isProofGateEnabled(){return this.proofGate!==null}verifyMemoryIntegrity(){if(!this.proofGate)throw new Error("Proof-gate not enabled \u2014 call enableProofGate() or set AQE_PROOF_GATE=1");return this.proofGate.verifyIntegrity()}getProofChainRoot(){return this.proofGate?this.proofGate.chainRoot():null}getProofChainLength(){return this.proofGate?this.proofGate.length:0}auditWrite(e,t,s,r){if(!this.proofGate){if(this.proofGateEnvChecked||(this.proofGateEnvChecked=!0,process.env.AQE_PROOF_GATE!=="1"))return;this.proofGate=this.loadProofChain()??new v}if(t!==n.PROOF_NS)try{this.proofGate.admit({op:e,ns:t,key:s,value:r}),this.persistProofChain()}catch(c){F.warn(`proof-gate audit skipped for ${t}/${s}: ${A(c)}`)}}persistProofChain(){!this.proofGate||!this.db||this.db.prepare(`
782
+ `).all(t,r,Date.now(),s).map(a=>a.key)}async kvCleanupExpired(){return this.ensureInitialized(),(await this.writeWhenUnlocked(()=>this.db.prepare("DELETE FROM kv_store WHERE expires_at IS NOT NULL AND expires_at < ?").run(Date.now()))).changes}enableProofGate(){this.ensureInitialized(),this.proofGateEnvChecked=!0,!this.proofGate&&(this.proofGate=this.loadProofChain()??new v)}isProofGateEnabled(){return this.proofGate!==null}verifyMemoryIntegrity(){if(!this.proofGate)throw new Error("Proof-gate not enabled \u2014 call enableProofGate() or set AQE_PROOF_GATE=1");return this.proofGate.verifyIntegrity()}getProofChainRoot(){return this.proofGate?this.proofGate.chainRoot():null}getProofChainLength(){return this.proofGate?this.proofGate.length:0}auditWrite(e,t,s,r){if(!this.proofGate){if(this.proofGateEnvChecked||(this.proofGateEnvChecked=!0,process.env.AQE_PROOF_GATE!=="1"))return;this.proofGate=this.loadProofChain()??new v}if(t!==n.PROOF_NS)try{this.proofGate.admit({op:e,ns:t,key:s,value:r}),this.persistProofChain()}catch(c){w.warn(`proof-gate audit skipped for ${t}/${s}: ${b(c)}`)}}persistProofChain(){!this.proofGate||!this.db||this.db.prepare(`
783
783
  INSERT OR REPLACE INTO kv_store (key, namespace, value, expires_at)
784
784
  VALUES (?, ?, ?, NULL)
785
785
  `).run(n.PROOF_KEY,n.PROOF_NS,JSON.stringify(this.proofGate.toJSON()))}loadProofChain(){if(!this.db)return null;let e=this.db.prepare(`
786
786
  SELECT value FROM kv_store WHERE key = ? AND namespace = ?
787
- `).get(n.PROOF_KEY,n.PROOF_NS);if(!e)return null;try{return v.fromJSON(JSON.parse(e.value))}catch(t){return F.warn(`proof-gate chain failed to load (starting fresh): ${A(t)}`),null}}async vectorStore(e,t,s="default",r){this.ensureInitialized();let c=this.floatArrayToBuffer(t),a=r?JSON.stringify(r):null;this.db.prepare(`
787
+ `).get(n.PROOF_KEY,n.PROOF_NS);if(!e)return null;try{return v.fromJSON(JSON.parse(e.value))}catch(t){return w.warn(`proof-gate chain failed to load (starting fresh): ${b(t)}`),null}}async vectorStore(e,t,s="default",r){this.ensureInitialized();let c=this.floatArrayToBuffer(t),a=r?JSON.stringify(r):null;await this.writeWhenUnlocked(()=>this.db.prepare(`
788
788
  INSERT OR REPLACE INTO vectors (id, namespace, embedding, dimensions, metadata, updated_at)
789
789
  VALUES (?, ?, ?, ?, ?, datetime('now'))
790
- `).run(e,s,c,t.length,a),this.vectorIndex.add(e,t)}async vectorGet(e){this.ensureInitialized();let t=this.db.prepare(`
790
+ `).run(e,s,c,t.length,a)),this.vectorIndex.add(e,t)}async vectorGet(e){this.ensureInitialized();let t=this.db.prepare(`
791
791
  SELECT embedding, dimensions, metadata FROM vectors WHERE id = ?
792
- `).get(e);if(t)return{embedding:this.bufferToFloatArray(t.embedding,t.dimensions),metadata:t.metadata?I(t.metadata):void 0}}async vectorDelete(e){this.ensureInitialized();let t=this.db.prepare("DELETE FROM vectors WHERE id = ?").run(e);return this.vectorIndex.remove(e),t.changes>0}async vectorSearch(e,t=10,s,r){if(this.ensureInitialized(),!Number.isInteger(t)||t<=0)return[];this.vectorsLoaded||await this.loadVectorIndex();let c=this.vectorIndex.size(),a=!!(s||r),T=Math.min(c,Math.max(a?t*2:t,1)),l=s?this.db.prepare("SELECT id, namespace, metadata FROM vectors WHERE namespace = ?").all(s):void 0,u=l?new Map(l.map(g=>[g.id,g])):void 0,d=this.vectorIndex.search(e,T);for(;a&&d.filter(g=>(!r||g.id.startsWith(r))&&(!u||u.has(g.id))).length<t&&T<c;)T=Math.min(c,T*2),d=this.vectorIndex.search(e,T);if(d.length===0)return[];let m=u??(()=>{let g=d.map(h=>h.id),_=g.map(()=>"?").join(","),L=this.db.prepare(`SELECT id, namespace, metadata FROM vectors WHERE id IN (${_})`).all(...g);return new Map(L.map(h=>[h.id,h]))})();if(s){let g=[];for(let _ of d){let L=m.get(_.id);if(L&&L.namespace===s&&(!r||_.id.startsWith(r))&&(g.push({id:_.id,score:_.score,metadata:L.metadata?I(L.metadata):void 0}),g.length>=t))break}return g}return(r?d.filter(g=>g.id.startsWith(r)).slice(0,t):d.slice(0,t)).map(g=>{let _=m.get(g.id);return{id:g.id,score:g.score,metadata:_?.metadata?I(_.metadata):void 0}})}migrateToV13EmbeddingSpace(){let e=this.db;if(!e.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_pattern_embeddings'").get()){e.exec(qe);return}e.prepare("PRAGMA table_info('qe_pattern_embeddings')").all().some(r=>r.name==="space_id")||e.exec("ALTER TABLE qe_pattern_embeddings ADD COLUMN space_id TEXT"),e.exec("CREATE INDEX IF NOT EXISTS idx_qe_pattern_embeddings_space ON qe_pattern_embeddings(space_id)")}getVectorSearchProvenance(){return this.vectorIndex.getProvider().isNativeBackend()?{backend:"native-hnsw",indexType:"hnsw",approximate:!0,estimatedRecall:this.vectorIndex.recall(),qualifiedMaxK:me.EF_SEARCH}:{backend:"progressive-hnsw",indexType:"flat",approximate:!1,estimatedRecall:1}}async vectorCount(e){return this.ensureInitialized(),e?this.db.prepare("SELECT COUNT(*) as count FROM vectors WHERE namespace = ?").get(e).count:this.db.prepare("SELECT COUNT(*) as count FROM vectors").get().count}queryCount(e){this.ensureInitialized();let t=b(e);return this.db.prepare(`SELECT COUNT(*) as c FROM ${t}`).get().c}initializeCRDT(e){if(this.crdtStore){console.warn("[UnifiedMemory] CRDT store already initialized");return}this.crdtStore=ue({nodeId:e}),console.log(`[UnifiedMemory] CRDT store initialized for node: ${e}`)}getCRDTStore(){return this.crdtStore}isCRDTInitialized(){return this.crdtStore!==null}async crdtSet(e,t,s="crdt"){this.ensureInitialized(),this.crdtStore&&this.crdtStore.setRegister(e,t),await this.kvSet(e,t,s)}async crdtGet(e,t="crdt"){if(this.crdtStore){let s=this.crdtStore.getRegister(e);if(s)return s.get()}return this.kvGet(e,t)}crdtIncrement(e,t=1){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");let s=this.crdtStore.getCounter(e);s||(this.crdtStore.incrementCounter(e,0),s=this.crdtStore.getCounter(e));for(let r=0;r<t;r++)this.crdtStore.incrementCounter(e)}crdtGetCounter(e){return this.crdtStore?this.crdtStore.getCounter(e)?.get()??0:0}crdtAddToSet(e,t){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.addToSet(e,t)}crdtRemoveFromSet(e,t){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.removeFromSet(e,t)}crdtGetSet(e){if(!this.crdtStore)return new Set;let t=this.crdtStore.getSet(e);return new Set(t.values())}crdtGetState(){return this.crdtStore?this.crdtStore.getState():null}crdtGetDelta(e){return this.crdtStore?this.crdtStore.getDelta(e??0):null}crdtMerge(e){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.applyState(e)}crdtApplyDelta(e){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.applyDelta(e)}async crdtPersist(){if(!this.crdtStore)return;let e=this.crdtStore.getState();await this.kvSet("__crdt_state__",e,"crdt-internal")}async crdtRestore(){if(!this.crdtStore)return!1;let e=await this.kvGet("__crdt_state__","crdt-internal");return e?(this.crdtStore.applyState(e),!0):!1}getDatabase(){if(!this.db||!this.initialized)throw new Error("UnifiedMemoryManager not initialized");return this.db}isInitialized(){return this.initialized}getDbPath(){return this.config.dbPath}prepare(e,t){if(!this.db)throw new Error("Database not initialized");let s=this.preparedStatements.get(e);return s||(s=this.db.prepare(t),this.preparedStatements.set(e,s)),s}transaction(e){if(!this.db)throw new Error("Database not initialized");return this.db.transaction(e)()}getStats(){if(!this.db)throw new Error("Database not initialized");let e=ze.map(r=>{try{let c=this.db.prepare(`SELECT COUNT(*) as count FROM ${r}`).get();return{name:r,rowCount:c.count}}catch(c){return F.debug("Table row count query failed",{table:r,error:c instanceof Error?c.message:String(c)}),{name:r,rowCount:0}}}),t=0,s=0;try{N.existsSync(this.config.dbPath)&&(t=N.statSync(this.config.dbPath).size);let r=this.config.dbPath+"-wal";N.existsSync(r)&&(s=N.statSync(r).size)}catch(r){console.debug("[UnifiedMemory] File stat error:",r instanceof Error?r.message:r)}return{tables:e,fileSize:t,walSize:s,vectorIndexSize:this.vectorIndex.size()}}vacuum(){if(!this.db)throw new Error("Database not initialized");this.db.exec("VACUUM")}checkpoint(){if(!this.db)throw new Error("Database not initialized");this.db.pragma("wal_checkpoint(TRUNCATE)")}close(){this.db&&(this.preparedStatements.clear(),this.vectorIndex.clear(),this.db.close(),this.db=null,this.initialized=!1,console.log("[UnifiedMemory] Database closed"))}ensureInitialized(){if(!this.initialized||!this.db)throw new Error("UnifiedMemoryManager not initialized. Call initialize() first.")}floatArrayToBuffer(e){let t=Buffer.alloc(e.length*4);for(let s=0;s<e.length;s++)t.writeFloatLE(e[s],s*4);return t}bufferToFloatArray(e,t){let s=new Float32Array(e.buffer,e.byteOffset,t);return Array.from(s)}};et=!1;bt()});export{J as a,b,Ft as c,Z as d,De as e,ee as f,Xe as g,St as h,Ue as i,se as j,ie as k,$e as l,Ve as m,nt as n,rt as o,st as p,y as q,it as r,At as s,vt as t,Dt as u,yt as v};
792
+ `).get(e);if(t)return{embedding:this.bufferToFloatArray(t.embedding,t.dimensions),metadata:t.metadata?I(t.metadata):void 0}}async vectorDelete(e){this.ensureInitialized();let t=await this.writeWhenUnlocked(()=>this.db.prepare("DELETE FROM vectors WHERE id = ?").run(e));return this.vectorIndex.remove(e),t.changes>0}async vectorSearch(e,t=10,s,r){if(this.ensureInitialized(),!Number.isInteger(t)||t<=0)return[];this.vectorsLoaded||await this.loadVectorIndex();let c=this.vectorIndex.size(),a=!!(s||r),T=Math.min(c,Math.max(a?t*2:t,1)),l=s?this.db.prepare("SELECT id, namespace, metadata FROM vectors WHERE namespace = ?").all(s):void 0,d=l?new Map(l.map(g=>[g.id,g])):void 0,u=this.vectorIndex.search(e,T);for(;a&&u.filter(g=>(!r||g.id.startsWith(r))&&(!d||d.has(g.id))).length<t&&T<c;)T=Math.min(c,T*2),u=this.vectorIndex.search(e,T);if(u.length===0)return[];let m=d??(()=>{let g=u.map(R=>R.id),_=g.map(()=>"?").join(","),L=this.db.prepare(`SELECT id, namespace, metadata FROM vectors WHERE id IN (${_})`).all(...g);return new Map(L.map(R=>[R.id,R]))})();if(s){let g=[];for(let _ of u){let L=m.get(_.id);if(L&&L.namespace===s&&(!r||_.id.startsWith(r))&&(g.push({id:_.id,score:_.score,metadata:L.metadata?I(L.metadata):void 0}),g.length>=t))break}return g}return(r?u.filter(g=>g.id.startsWith(r)).slice(0,t):u.slice(0,t)).map(g=>{let _=m.get(g.id);return{id:g.id,score:g.score,metadata:_?.metadata?I(_.metadata):void 0}})}migrateToV13EmbeddingSpace(){let e=this.db;if(!e.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_pattern_embeddings'").get()){e.exec(Qe);return}e.prepare("PRAGMA table_info('qe_pattern_embeddings')").all().some(r=>r.name==="space_id")||e.exec("ALTER TABLE qe_pattern_embeddings ADD COLUMN space_id TEXT"),e.exec("CREATE INDEX IF NOT EXISTS idx_qe_pattern_embeddings_space ON qe_pattern_embeddings(space_id)")}getVectorSearchProvenance(){return this.vectorIndex.getProvider().isNativeBackend()?{backend:"native-hnsw",indexType:"hnsw",approximate:!0,estimatedRecall:this.vectorIndex.recall(),qualifiedMaxK:Le.EF_SEARCH}:{backend:"progressive-hnsw",indexType:"flat",approximate:!1,estimatedRecall:1}}async vectorCount(e){return this.ensureInitialized(),e?this.db.prepare("SELECT COUNT(*) as count FROM vectors WHERE namespace = ?").get(e).count:this.db.prepare("SELECT COUNT(*) as count FROM vectors").get().count}queryCount(e){this.ensureInitialized();let t=y(e);return this.db.prepare(`SELECT COUNT(*) as c FROM ${t}`).get().c}initializeCRDT(e){if(this.crdtStore){console.warn("[UnifiedMemory] CRDT store already initialized");return}this.crdtStore=pe({nodeId:e}),console.log(`[UnifiedMemory] CRDT store initialized for node: ${e}`)}getCRDTStore(){return this.crdtStore}isCRDTInitialized(){return this.crdtStore!==null}async crdtSet(e,t,s="crdt"){this.ensureInitialized(),this.crdtStore&&this.crdtStore.setRegister(e,t),await this.kvSet(e,t,s)}async crdtGet(e,t="crdt"){if(this.crdtStore){let s=this.crdtStore.getRegister(e);if(s)return s.get()}return this.kvGet(e,t)}crdtIncrement(e,t=1){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");let s=this.crdtStore.getCounter(e);s||(this.crdtStore.incrementCounter(e,0),s=this.crdtStore.getCounter(e));for(let r=0;r<t;r++)this.crdtStore.incrementCounter(e)}crdtGetCounter(e){return this.crdtStore?this.crdtStore.getCounter(e)?.get()??0:0}crdtAddToSet(e,t){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.addToSet(e,t)}crdtRemoveFromSet(e,t){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.removeFromSet(e,t)}crdtGetSet(e){if(!this.crdtStore)return new Set;let t=this.crdtStore.getSet(e);return new Set(t.values())}crdtGetState(){return this.crdtStore?this.crdtStore.getState():null}crdtGetDelta(e){return this.crdtStore?this.crdtStore.getDelta(e??0):null}crdtMerge(e){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.applyState(e)}crdtApplyDelta(e){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.applyDelta(e)}async crdtPersist(){if(!this.crdtStore)return;let e=this.crdtStore.getState();await this.kvSet("__crdt_state__",e,"crdt-internal")}async crdtRestore(){if(!this.crdtStore)return!1;let e=await this.kvGet("__crdt_state__","crdt-internal");return e?(this.crdtStore.applyState(e),!0):!1}getDatabase(){if(!this.db||!this.initialized)throw new Error("UnifiedMemoryManager not initialized");return this.db}isInitialized(){return this.initialized}getDbPath(){return this.config.dbPath}prepare(e,t){if(!this.db)throw new Error("Database not initialized");let s=this.preparedStatements.get(e);return s||(s=this.db.prepare(t),this.preparedStatements.set(e,s)),s}transaction(e){if(!this.db)throw new Error("Database not initialized");return this.db.transaction(e)()}getStats(){if(!this.db)throw new Error("Database not initialized");let e=tt.map(r=>{try{let c=this.db.prepare(`SELECT COUNT(*) as count FROM ${r}`).get();return{name:r,rowCount:c.count}}catch(c){return w.debug("Table row count query failed",{table:r,error:c instanceof Error?c.message:String(c)}),{name:r,rowCount:0}}}),t=0,s=0;try{N.existsSync(this.config.dbPath)&&(t=N.statSync(this.config.dbPath).size);let r=this.config.dbPath+"-wal";N.existsSync(r)&&(s=N.statSync(r).size)}catch(r){console.debug("[UnifiedMemory] File stat error:",r instanceof Error?r.message:r)}return{tables:e,fileSize:t,walSize:s,vectorIndexSize:this.vectorIndex.size()}}vacuum(){if(!this.db)throw new Error("Database not initialized");this.db.exec("VACUUM")}checkpoint(){if(!this.db)throw new Error("Database not initialized");this.db.pragma("wal_checkpoint(TRUNCATE)")}close(){this.db&&(this.preparedStatements.clear(),this.vectorIndex.clear(),he(this.db),this.db.close(),this.db=null,this.initialized=!1,console.log("[UnifiedMemory] Database closed"))}ensureInitialized(){if(!this.initialized||!this.db)throw new Error("UnifiedMemoryManager not initialized. Call initialize() first.")}floatArrayToBuffer(e){let t=Buffer.alloc(e.length*4);for(let s=0;s<e.length;s++)t.writeFloatLE(e[s],s*4);return t}bufferToFloatArray(e,t){let s=new Float32Array(e.buffer,e.byteOffset,t);return Array.from(s)}};Et=!1;Bt()});export{J as a,Z as b,Xe as c,Wt as d,Ue as e,te as f,y as g,Vt as h,ne as i,ke as j,re as k,Be as l,Dt as m,je as n,ae as o,ce as p,it as q,ot as r,ut as s,lt as t,gt as u,A as v,pt as w,Gt as x,Pt as y,kt as z,qt as A,jt as B,Ht as C};
@@ -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.15.15");process.exit(0)}
2
- import{c as w,d as N}from"./chunk-SZAZQZWI.js";import{c as x,e as E}from"./chunk-HL2ANKN3.js";N();E();import{constants as S}from"node:fs";import*as l from"node:fs";import*as p from"node:fs/promises";import*as u from"node:path";var v=128*1024*1024,m=class extends x{constructor(e,c,n){super(`Cannot read ${e}: ${c}`);this.filePath=e;this.reason=c;this.name="ConfinedReadError",this.code=n??c.toUpperCase().replace(/-/g,"_")}filePath;reason;code},O=S.O_RDONLY|(S.O_NOFOLLOW??0)|(S.O_NONBLOCK??0);function g(t,r){let e=u.relative(t,r);return e===""||e!==".."&&!e.startsWith(`..${u.sep}`)&&!u.isAbsolute(e)}async function B(t,r,e){let c=async i=>{let o=await p.stat(i).catch(()=>null);return o!==null&&o.dev===e.dev&&o.ino===e.ino},n=await p.realpath(`/proc/self/fd/${t}`).catch(()=>null);if(n&&u.isAbsolute(n)&&await c(n))return n;let a=await p.realpath(r).catch(()=>null);return a&&await c(a)?a:null}function F(t,r,e){let c=o=>{try{let y=l.statSync(o);return y.dev===e.dev&&y.ino===e.ino}catch{return!1}},n=o=>{try{return l.realpathSync(o)}catch{return null}},a=n(`/proc/self/fd/${t}`);if(a&&u.isAbsolute(a)&&c(a))return a;let i=n(r);return i&&c(i)?i:null}function R(t){let r=t?.code;return r==="ENOENT"||r==="ENOTDIR"?"not-found":r==="EISDIR"||r==="ELOOP"?"not-a-file":"unreadable"}function s(t,r,e){return new m(t,r,e?.code)}function b(t,r,e){if(typeof t!="string"||t===""||t.includes("\0"))throw s(String(t),"unreadable");let c=u.resolve(e.projectRoot??w()),n=u.resolve(t),a=g(c,n)||g(r,n);if(!a&&e.outsideRoot!=="allow")throw s(t,"outside-project-root");return{lexical:n,rootReal:r,inRoot:a,limit:e.maxBytes??v}}function C(t,r,e){if(!r.isFile())throw s(t,"not-a-file");if(r.size>e)throw s(t,"too-large")}async function j(t,r={}){let e=u.resolve(r.projectRoot??w()),c=await p.realpath(e).catch(()=>e),n=b(t,c,r),a;try{a=await p.realpath(n.lexical)}catch(o){throw s(t,R(o),o)}if(n.inRoot&&!g(n.rootReal,a))throw s(t,"outside-project-root");let i;try{i=await p.open(a,O)}catch(o){throw s(t,R(o),o)}try{let o=await i.stat();if(C(t,o,n.limit),n.inRoot){let f=await B(i.fd,a,o);if(!f||!g(n.rootReal,f))throw s(t,"outside-project-root")}let y=[],d=0;for(;;){let f=Buffer.allocUnsafe(Math.min(65536,n.limit+1-d)),{bytesRead:h}=await i.read(f,0,f.length,null);if(h===0)break;if(y.push(f.subarray(0,h)),d+=h,d>n.limit)throw s(t,"too-large")}return Buffer.concat(y,d)}catch(o){throw o instanceof m?o:s(t,R(o),o)}finally{await i.close().catch(()=>{})}}async function D(t,r={}){return(await j(t,r)).toString("utf-8")}function L(t,r={}){let e=u.resolve(r.projectRoot??w()),c=e;try{c=l.realpathSync(e)}catch{}let n=b(t,c,r),a;try{a=l.realpathSync(n.lexical)}catch(o){throw s(t,R(o),o)}if(n.inRoot&&!g(n.rootReal,a))throw s(t,"outside-project-root");let i;try{i=l.openSync(a,O)}catch(o){throw s(t,R(o),o)}try{let o=l.fstatSync(i);if(C(t,o,n.limit),n.inRoot){let f=F(i,a,o);if(!f||!g(n.rootReal,f))throw s(t,"outside-project-root")}let y=[],d=0;for(;;){let f=Buffer.allocUnsafe(Math.min(65536,n.limit+1-d)),h=l.readSync(i,f,0,f.length,null);if(h===0)break;if(y.push(f.subarray(0,h)),d+=h,d>n.limit)throw s(t,"too-large")}return Buffer.concat(y,d)}catch(o){throw o instanceof m?o:s(t,R(o),o)}finally{try{l.closeSync(i)}catch{}}}function I(t,r={}){return L(t,r).toString("utf-8")}export{m as a,j as b,D as c,I 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.15.17");process.exit(0)}
2
+ import{c as w,d as N}from"./chunk-GPPTRKEM.js";import{c as x,e as E}from"./chunk-J7Q5TXFZ.js";N();E();import{constants as S}from"node:fs";import*as l from"node:fs";import*as p from"node:fs/promises";import*as u from"node:path";var v=128*1024*1024,m=class extends x{constructor(e,c,n){super(`Cannot read ${e}: ${c}`);this.filePath=e;this.reason=c;this.name="ConfinedReadError",this.code=n??c.toUpperCase().replace(/-/g,"_")}filePath;reason;code},O=S.O_RDONLY|(S.O_NOFOLLOW??0)|(S.O_NONBLOCK??0);function g(t,r){let e=u.relative(t,r);return e===""||e!==".."&&!e.startsWith(`..${u.sep}`)&&!u.isAbsolute(e)}async function B(t,r,e){let c=async i=>{let o=await p.stat(i).catch(()=>null);return o!==null&&o.dev===e.dev&&o.ino===e.ino},n=await p.realpath(`/proc/self/fd/${t}`).catch(()=>null);if(n&&u.isAbsolute(n)&&await c(n))return n;let a=await p.realpath(r).catch(()=>null);return a&&await c(a)?a:null}function F(t,r,e){let c=o=>{try{let y=l.statSync(o);return y.dev===e.dev&&y.ino===e.ino}catch{return!1}},n=o=>{try{return l.realpathSync(o)}catch{return null}},a=n(`/proc/self/fd/${t}`);if(a&&u.isAbsolute(a)&&c(a))return a;let i=n(r);return i&&c(i)?i:null}function R(t){let r=t?.code;return r==="ENOENT"||r==="ENOTDIR"?"not-found":r==="EISDIR"||r==="ELOOP"?"not-a-file":"unreadable"}function s(t,r,e){return new m(t,r,e?.code)}function b(t,r,e){if(typeof t!="string"||t===""||t.includes("\0"))throw s(String(t),"unreadable");let c=u.resolve(e.projectRoot??w()),n=u.resolve(t),a=g(c,n)||g(r,n);if(!a&&e.outsideRoot!=="allow")throw s(t,"outside-project-root");return{lexical:n,rootReal:r,inRoot:a,limit:e.maxBytes??v}}function C(t,r,e){if(!r.isFile())throw s(t,"not-a-file");if(r.size>e)throw s(t,"too-large")}async function j(t,r={}){let e=u.resolve(r.projectRoot??w()),c=await p.realpath(e).catch(()=>e),n=b(t,c,r),a;try{a=await p.realpath(n.lexical)}catch(o){throw s(t,R(o),o)}if(n.inRoot&&!g(n.rootReal,a))throw s(t,"outside-project-root");let i;try{i=await p.open(a,O)}catch(o){throw s(t,R(o),o)}try{let o=await i.stat();if(C(t,o,n.limit),n.inRoot){let f=await B(i.fd,a,o);if(!f||!g(n.rootReal,f))throw s(t,"outside-project-root")}let y=[],d=0;for(;;){let f=Buffer.allocUnsafe(Math.min(65536,n.limit+1-d)),{bytesRead:h}=await i.read(f,0,f.length,null);if(h===0)break;if(y.push(f.subarray(0,h)),d+=h,d>n.limit)throw s(t,"too-large")}return Buffer.concat(y,d)}catch(o){throw o instanceof m?o:s(t,R(o),o)}finally{await i.close().catch(()=>{})}}async function D(t,r={}){return(await j(t,r)).toString("utf-8")}function L(t,r={}){let e=u.resolve(r.projectRoot??w()),c=e;try{c=l.realpathSync(e)}catch{}let n=b(t,c,r),a;try{a=l.realpathSync(n.lexical)}catch(o){throw s(t,R(o),o)}if(n.inRoot&&!g(n.rootReal,a))throw s(t,"outside-project-root");let i;try{i=l.openSync(a,O)}catch(o){throw s(t,R(o),o)}try{let o=l.fstatSync(i);if(C(t,o,n.limit),n.inRoot){let f=F(i,a,o);if(!f||!g(n.rootReal,f))throw s(t,"outside-project-root")}let y=[],d=0;for(;;){let f=Buffer.allocUnsafe(Math.min(65536,n.limit+1-d)),h=l.readSync(i,f,0,f.length,null);if(h===0)break;if(y.push(f.subarray(0,h)),d+=h,d>n.limit)throw s(t,"too-large")}return Buffer.concat(y,d)}catch(o){throw o instanceof m?o:s(t,R(o),o)}finally{try{l.closeSync(i)}catch{}}}function I(t,r={}){return L(t,r).toString("utf-8")}export{m as a,j as b,D as c,I as d};
@@ -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.15.15");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.15.17");process.exit(0)}
2
2
  import*as y from"node:fs/promises";import*as g from"node:path";var b=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".pyw",".go",".rs",".java",".kt",".kts",".rb",".cs",".php",".swift",".c",".h",".cpp",".hpp",".cc",".scala"]),R=new Set(["node_modules",".git","dist","build","coverage",".nyc_output","__pycache__",".venv","venv",".tox",".mypy_cache","target",".gradle","vendor",".bundle",".agentic-qe",".claude",".cache",".npm",".yarn",".next",".nuxt",".svelte-kit","out",".turbo","tmp","temp",".tmp"]);function x(e){return b.has(g.extname(e).toLowerCase())}async function $(e,c={}){let s=c.maxFiles??5e3,o=c.maxDepth??64;if(!Number.isSafeInteger(s)||s<1||!Number.isSafeInteger(o)||o<0)throw new Error("Security discovery requires a positive file limit and non-negative depth limit.");let n=[],a=[],p=[],t=g.resolve(e),k=!1,v=!1;function E(r,m){let d=m?.code;a.push({path:r,reason:typeof d=="string"&&/^[A-Z0-9_]{1,32}$/.test(d)?d:"DISCOVERY_FAILED"})}async function D(r,m){if(m>o){a.push({path:r,reason:"DEPTH_LIMIT"});return}let d;try{d=await y.readdir(r,{withFileTypes:!0})}catch(i){E(r,i),r===t&&(k=!0);return}d.sort((i,l)=>i.name<l.name?-1:i.name>l.name?1:0);for(let i of d){if(v)return;let l=g.join(r,i.name);if(i.isSymbolicLink())p.push(l);else if(i.isDirectory())R.has(i.name)?p.push(l):await D(l,m+1);else if(i.isFile()&&x(i.name)){if(n.length===s){a.push({path:l,reason:"FILE_LIMIT"}),v=!0;return}n.push(l)}}}try{let r=await y.lstat(t);r.isFile()?n.push(t):r.isDirectory()?await D(t,0):(k=!0,a.push({path:t,reason:r.isSymbolicLink()?"SYMLINK_TARGET":"NOT_REGULAR_INPUT"}))}catch(r){k=!0,E(t,r)}return{files:n,discovery:{status:k?"failed":a.length>0?"partial":"complete",policy:"aqe-security-source-files@1",issues:a,excludedPaths:p}}}import*as f from"fs/promises";import*as u from"path";var S="osv-dependency-advisories";async function w(e,c=process.env){let s=e;try{(await f.stat(e)).isDirectory()||(s=u.dirname(e))}catch{s=u.dirname(e)}let o=[s,c.AQE_PROJECT_ROOT?u.resolve(c.AQE_PROJECT_ROOT):null];for(let n of o){if(!n)continue;let a=u.join(n,"package.json");try{if((await f.stat(a)).isFile())return a}catch{}}return null}var O="direct dependencies of this package.json only; workspace members and transitive dependencies are not checked";function P(e){return`${_(e)} Scope: ${O}.`}function _(e){switch(e.status){case"complete":return e.packagesRequested===0?`No registry dependencies to check${e.localPackages.length?` (${e.localPackages.length} local package(s) excluded)`:" in package.json"}; nothing to check (complete).`:`Dependency advisories checked for all ${e.packagesChecked} package(s): ${e.vulnerabilities} advisory finding(s).`;case"incomplete":return(e.uncheckedPackages.length>0?`Dependency advisories could not be checked for ${e.uncheckedPackages.length} of ${e.packagesRequested} package(s); `:"")+(e.resolutionErrors.length>0?`${e.resolutionErrors.slice(0,3).join("; ")}; `:"")+`${e.vulnerabilities} finding(s) from the ${e.packagesChecked} checked package(s). Dependency scan is INCOMPLETE, not clean.`;case"failed":return`${e.error??`Dependency advisories could not be checked for ${e.uncheckedPackages.length} package(s)`}. Dependency vulnerabilities are UNMEASURED, not zero.`;default:return e.error??"Dependency advisory scan did not run."}}function h(e,c){let s={status:"not-run",measured:!1,...c?{manifest:c}:{},packagesRequested:0,packagesChecked:0,uncheckedPackages:[],localPackages:[],resolutionErrors:[],scope:"direct",vulnerabilities:0,error:e};return{engine:{id:S,requested:!0,required:!0,status:"failed",scope:"parent-directory",...c?{target:c}:{},analyzedFiles:0,ruleCoverage:"unknown",errors:[e],limitations:[]},vulnerabilities:[],report:{...s,message:P(s)}}}async function N(e,c){let s=await w(c);if(!s)return h("No package.json found for the dependency advisory scan.");let o;try{o=await e.scanPackageJson(s)}catch(t){return h(`Dependency advisory scan failed: ${t instanceof Error?t.message:String(t)}`,s)}if(!o.success)return h(`Dependency advisory scan did not run: ${o.error.message}`,s);let n=o.value,a=n.uncheckedPackages.map(t=>`${t.name}@${t.version}: ${t.reason}`),p={status:n.status,measured:n.measured,manifest:s,lockfile:n.lockfile??null,packagesRequested:n.packagesScanned,packagesChecked:n.packagesChecked,uncheckedPackages:n.uncheckedPackages,localPackages:n.localPackages??[],resolutionErrors:n.resolutionErrors??[],scope:"direct",vulnerabilities:n.vulnerabilities.length,scanId:n.scanId,...n.error?{error:n.error}:{}};return{engine:{id:S,requested:!0,required:!0,status:n.status==="complete"?"completed":n.status==="incomplete"?"partial":"failed",scope:"parent-directory",target:s,ruleCoverage:"unknown",errors:[...n.error?[n.error]:[],...n.resolutionErrors??[],...a.slice(0,20),...a.length>20?[`... and ${a.length-20} more unchecked package(s)`]:[]],limitations:[n.lockfile?`Direct dependencies are checked at the versions ${n.lockfile} resolves (when in sync with package.json); transitive dependencies are not checked.`:"No lockfile: only exact versions in package.json are checked; ranges are reported unchecked. Transitive dependencies are not checked.",...(n.localPackages??[]).length>0?[`${n.localPackages.length} local workspace/linked package(s) are not OSV subjects and were excluded.`]:[]]},vulnerabilities:n.vulnerabilities,report:{...p,message:P(p)}}}export{x as a,$ as b,N as c};
@@ -0,0 +1,12 @@
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.15.17");process.exit(0)}
2
+ import{c as H,d as J}from"./chunk-M2YI5YUR.js";import{h as G}from"./chunk-45223KK6.js";import{g as U}from"./chunk-TDZ6N43D.js";import{e as N}from"./chunk-POPSZDI2.js";import{e as T}from"./chunk-XFTX3KLE.js";import{b as v,c as C}from"./chunk-4NKZU2JZ.js";import{b as B}from"./chunk-YMUY3TES.js";import{i as W}from"./chunk-XPTCQKVE.js";import{b,d as _}from"./chunk-CMN7PU2H.js";import{c as k,d as E}from"./chunk-REY52O7J.js";import{a as oe}from"./chunk-TIVKDIF7.js";import{c as q}from"./chunk-DS5IFRY6.js";import{S as se,b as z}from"./chunk-JHKKIJT2.js";import{a as y,e as $}from"./chunk-J7Q5TXFZ.js";import{randomUUID as te}from"crypto";$();_();import{randomUUID as ce}from"node:crypto";var D=C(),P=class{constructor(e){this.options=e}options;claudeFlowAvailable=!1;localTrajectories=new Map;async initialize(){this.claudeFlowAvailable=await this.checkClaudeFlow()}async checkClaudeFlow(){return v(this.options.projectRoot).available}async startTrajectory(e,t){let i=`trajectory-${ce()}`;if(this.claudeFlowAvailable)try{let{execFileSync:n}=await import("child_process"),r=["--no-install",D,"hooks","intelligence","trajectory-start","--task",e];t&&r.push("--agent",t);let s=n("npx",r,{encoding:"utf-8",timeout:1e4,cwd:this.options.projectRoot}).match(/trajectoryId[:\s]+["']?([^"'\s,}]+)/i);if(s?.[1])return s[1]}catch(n){console.debug("[TrajectoryBridge] Claude Flow trajectory start failed:",n instanceof Error?n.message:n)}return this.localTrajectories.set(i,{id:i,task:e,agent:t,steps:[],startedAt:Date.now()}),i}async recordStep(e,t,i,n){if(this.claudeFlowAvailable)try{let{execFileSync:a}=await import("child_process"),s=["--no-install",D,"hooks","intelligence","trajectory-step","--trajectory-id",e,"--action",t];i&&s.push("--result",i),n!==void 0&&s.push("--quality",String(n)),a("npx",s,{encoding:"utf-8",timeout:1e4,cwd:this.options.projectRoot});return}catch(a){console.debug("[TrajectoryBridge] Claude Flow trajectory step failed:",a instanceof Error?a.message:a)}let r=this.localTrajectories.get(e);r&&r.steps.push({id:`step-${r.steps.length+1}`,action:t,result:i,quality:n,timestamp:Date.now()})}async endTrajectory(e,t,i){if(this.claudeFlowAvailable)try{let{execFileSync:r}=await import("child_process"),a=["--no-install",D,"hooks","intelligence","trajectory-end","--trajectory-id",e,"--success",String(t)];i&&a.push("--feedback",i),r("npx",a,{encoding:"utf-8",timeout:1e4,cwd:this.options.projectRoot})}catch{}let n=this.localTrajectories.get(e);if(n)return n.success=t,n.feedback=i,n.completedAt=Date.now(),await this.persistTrajectory(n),n}getTrajectory(e){return this.localTrajectories.get(e)}isClaudeFlowAvailable(){return this.claudeFlowAvailable}async persistTrajectory(e){try{let{getUnifiedMemory:t}=await import("./unified-memory-2VMGSGQL.js"),i=t();i.isInitialized()||await i.initialize();let n=i.getDatabase();try{n.prepare("PRAGMA table_info(qe_trajectories)").all().some(o=>o.name==="feedback")||n.exec("ALTER TABLE qe_trajectories ADD COLUMN feedback TEXT")}catch{}let r=new Date(e.startedAt).toISOString(),a=e.completedAt?new Date(e.completedAt).toISOString():null;n.prepare(`
3
+ INSERT OR REPLACE INTO qe_trajectories
4
+ (id, task, agent, domain, started_at, ended_at, success, steps_json, feedback)
5
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
6
+ `).run(e.id,e.task,e.agent||null,null,r,a,e.success?1:0,JSON.stringify(e.steps),e.feedback||null)}catch(t){console.debug("[TrajectoryBridge] Trajectory persistence failed:",t instanceof Error?t.message:t)}}};var V=C(),X={low:[/simple/i,/basic/i,/fix typo/i,/rename/i,/format/i,/add comment/i,/lint/i,/minor/i,/quick/i],high:[/architect/i,/design/i,/complex/i,/security/i,/performance/i,/refactor.*large/i,/critical/i,/analysis/i,/multi.*file/i,/database.*migration/i,/distributed/i,/concurrent/i]},R=class{constructor(e){this.options=e}options;claudeFlowAvailable=!1;routingHistory=[];async initialize(){this.claudeFlowAvailable=await this.checkClaudeFlow()}async checkClaudeFlow(){return v(this.options.projectRoot).available}async routeTask(e){if(this.claudeFlowAvailable)try{let{execFileSync:t}=await import("child_process"),i=t("npx",["--no-install",V,"hooks","model-route","--task",e],{encoding:"utf-8",timeout:1e4,cwd:this.options.projectRoot}),n=i.match(/model[:\s]+["']?(haiku|sonnet|opus)/i),r=i.match(/confidence[:\s]+([0-9.]+)/i),a=i.match(/reason(?:ing)?[:\s]+["']?([^"'\n]+)/i);if(n)return{model:n[1].toLowerCase(),confidence:r?parseFloat(r[1]):.7,reasoning:a?.[1]?.trim()}}catch(t){console.debug("[ModelRouterBridge] Claude Flow routing failed:",t instanceof Error?t.message:t)}return this.localRoute(e)}async recordOutcome(e){if(this.routingHistory.push(e),this.routingHistory.length>1e3&&(this.routingHistory=this.routingHistory.slice(-500)),this.claudeFlowAvailable)try{let{execFileSync:t}=await import("child_process");t("npx",["--no-install",V,"hooks","model-outcome","--task",e.task,"--model",e.model,"--outcome",e.outcome],{encoding:"utf-8",timeout:1e4,cwd:this.options.projectRoot})}catch(t){console.debug("[ModelRouterBridge] Outcome recording failed:",t instanceof Error?t.message:t)}}getStats(){let e={totalRoutings:this.routingHistory.length,modelDistribution:{haiku:0,sonnet:0,opus:0},successRate:{haiku:0,sonnet:0,opus:0}},t={haiku:0,sonnet:0,opus:0};for(let i of this.routingHistory)e.modelDistribution[i.model]++,i.outcome==="success"&&t[i.model]++;for(let i of["haiku","sonnet","opus"]){let n=e.modelDistribution[i];e.successRate[i]=n>0?t[i]/n:0}return e}isClaudeFlowAvailable(){return this.claudeFlowAvailable}localRoute(e){let t=e.toLowerCase();for(let i of X.low)if(i.test(t))return{model:"haiku",confidence:.75,reasoning:"Low complexity task detected - using haiku for speed"};for(let i of X.high)if(i.test(t))return{model:"opus",confidence:.8,reasoning:"High complexity task detected - using opus for capability"};return e.length>500?{model:"opus",confidence:.65,reasoning:"Long task description - using opus for complex reasoning"}:e.length<50?{model:"haiku",confidence:.6,reasoning:"Short task description - using haiku for efficiency"}:{model:"sonnet",confidence:.7,reasoning:"Medium complexity task - using sonnet for balance"}}};_();$();var M=C(),S=class{constructor(e){this.options=e}options;claudeFlowAvailable=!1;analysisCache=new Map;async initialize(){this.claudeFlowAvailable=await this.checkClaudeFlow()}async checkClaudeFlow(){return v(this.options.projectRoot).available}async analyze(e,t="medium"){let i=e||this.options.projectRoot,n=`${i}:${t}`,r=this.analysisCache.get(n);if(r)return r;if(this.claudeFlowAvailable)try{let{execFileSync:a}=await import("child_process"),s=a("npx",["--no-install",M,"hooks","pretrain","--path",i,"--depth",t],{encoding:"utf-8",timeout:12e4,cwd:this.options.projectRoot});try{let o=b(s),d={success:!0,repositoryPath:i,depth:t,analysis:o.analysis||void 0,agentConfigs:o.agentConfigs};return this.analysisCache.set(n,d),d}catch{return{success:!0,repositoryPath:i,depth:t}}}catch(a){console.debug("[PretrainBridge] Claude Flow analyze failed, using local:",a instanceof Error?a.message:a)}return this.localAnalyze(i,t)}async generateAgentConfigs(e="yaml"){if(this.claudeFlowAvailable)try{let{execFileSync:t}=await import("child_process"),i=t("npx",["--no-install",M,"hooks","build-agents","--format",e],{encoding:"utf-8",timeout:6e4,cwd:this.options.projectRoot});try{return b(i)}catch(n){return console.debug("[PretrainBridge] Agent config parse error:",n instanceof Error?n.message:n),[]}}catch(t){console.debug("[PretrainBridge] Claude Flow generateAgentConfigs failed:",t instanceof Error?t.message:t)}return this.generateLocalAgentConfigs()}async transferPatterns(e,t=.7){if(this.claudeFlowAvailable)try{let{execFileSync:i}=await import("child_process"),n=i("npx",["--no-install",M,"hooks","transfer","--source-path",e,"--min-confidence",String(t)],{encoding:"utf-8",timeout:6e4,cwd:this.options.projectRoot}),r=n.match(/transferred[:\s]+(\d+)/i),a=n.match(/skipped[:\s]+(\d+)/i);return{transferred:r?parseInt(r[1]):0,skipped:a?parseInt(a[1]):0}}catch(i){console.debug("[PretrainBridge] Claude Flow transferPatterns failed:",i instanceof Error?i.message:i)}return{transferred:0,skipped:0}}isClaudeFlowAvailable(){return this.claudeFlowAvailable}async localAnalyze(e,t){try{let{glob:i}=await import("tinyglobby"),{existsSync:n,readFileSync:r}=await import("fs"),{join:a}=await import("path"),d=await i(t==="shallow"?["*.ts","*.js","*.json"]:t==="medium"?["**/*.ts","**/*.js","**/*.json","**/*.py"]:["**/*"],{cwd:e,ignore:["node_modules/**","dist/**","coverage/**",".git/**"],expandDirectories:!1,onlyFiles:!0}),c=new Set,g=new Set;for(let p of d.slice(0,100))(p.endsWith(".ts")||p.endsWith(".tsx"))&&c.add("typescript"),(p.endsWith(".js")||p.endsWith(".jsx"))&&c.add("javascript"),p.endsWith(".py")&&c.add("python"),p.endsWith(".go")&&c.add("go"),p.endsWith(".rs")&&c.add("rust");let w=a(e,"package.json");if(n(w))try{let p=b(r(w,"utf-8")),f={...p.dependencies,...p.devDependencies};f.react&&g.add("react"),f.vue&&g.add("vue"),f.angular&&g.add("angular"),f.vitest&&g.add("vitest"),f.jest&&g.add("jest"),f.playwright&&g.add("playwright"),f.express&&g.add("express"),f.fastify&&g.add("fastify")}catch(p){console.debug("[PretrainBridge] package.json parse error:",p instanceof Error?p.message:p)}let m={success:!0,repositoryPath:e,depth:t,analysis:{languages:Array.from(c),frameworks:Array.from(g),patterns:[],complexity:d.length>500?3:d.length>100?2:1}};return this.analysisCache.set(`${e}:${t}`,m),m}catch(i){return{success:!1,repositoryPath:e,depth:t,error:y(i)}}}generateLocalAgentConfigs(){return[{name:"qe-test-architect",type:"worker",capabilities:["test-generation","test-design"],model:"sonnet"},{name:"qe-coverage-specialist",type:"worker",capabilities:["coverage-analysis","gap-detection"],model:"haiku"},{name:"qe-quality-gate",type:"worker",capabilities:["quality-assessment","risk-scoring"],model:"sonnet"},{name:"qe-security-scanner",type:"worker",capabilities:["security-scanning","vulnerability-detection"],model:"opus"}]}};var Q=class{constructor(e){this.options=e;this.trajectory=new P(e),this.modelRouter=new R(e),this.pretrain=new S(e)}options;trajectory;modelRouter;pretrain;initialized=!1;async initialize(){this.initialized||(await Promise.all([this.trajectory.initialize(),this.modelRouter.initialize(),this.pretrain.initialize()]),this.initialized=!0)}getStatus(){return{available:this.isAvailable(),features:{trajectories:this.trajectory.isClaudeFlowAvailable(),modelRouting:this.modelRouter.isClaudeFlowAvailable(),pretrain:this.pretrain.isClaudeFlowAvailable(),patternSearch:this.trajectory.isClaudeFlowAvailable()}}}isAvailable(){return this.trajectory.isClaudeFlowAvailable()||this.modelRouter.isClaudeFlowAvailable()||this.pretrain.isClaudeFlowAvailable()}};function K(u){return new Q(u)}import{createHash as le}from"node:crypto";oe();se();var F=q.create("experience-capture"),Z={"catches-bug":1,flaky:-1,"false-positive":-1,"new-coverage":.3,redundant:0,"code-smell":-.5,neutral:0},ue=new Set(Object.keys(Z));function Y(u){return typeof u=="string"&&ue.has(u)}function de(u){if(Y(u))return Z[u]}var pe={namespace:"qe-experiences",minQualityForPatternExtraction:.7,similarityThreshold:.85,promotionThreshold:T,maxExperiencesPerDomain:1e3,enableCrossDomainSharing:!0,autoCleanup:!0,cleanupIntervalMs:864e5},L=class{constructor(e,t,i,n={}){this.memory=e;this.patternStore=t;this.eventBus=i;this.config={...pe,...n}}memory;patternStore;eventBus;config;initialized=!1;cleanupTimer;activeExperiences=new Map;stats={totalCaptured:0,successfulCaptures:0,patternsExtracted:0,patternsPromoted:0,byDomain:new Map};sessionCaptureCount=0;witnessChain;nullRecorder;setWitnessChain(e){this.witnessChain=e}setNullRecorder(e){this.nullRecorder=e}async initialize(){this.initialized||(await this.loadStats(),this.config.autoCleanup&&(this.cleanupTimer=setInterval(()=>this.cleanup(),this.config.cleanupIntervalMs)),this.initialized=!0,console.log("[ExperienceCapture] Initialized"))}startCapture(e,t){let i=`exp-${Date.now()}-${W().slice(0,8)}`,n={id:i,task:e,agent:t?.agent,domain:t?.domain,model:t?.model,startedAt:Date.now(),completedAt:0,durationMs:0,steps:[],success:!1,quality:0,trajectoryId:t?.trajectoryId,metadata:t?.metadata,appliedPatterns:t?.appliedPatterns};return this.activeExperiences.set(i,n),i}recordStep(e,t){let i=this.activeExperiences.get(e);if(!i){console.warn(`[ExperienceCapture] Experience not found: ${e}`);return}i.steps.push({...t,timestamp:Date.now()})}async completeCapture(e,t){let i=this.activeExperiences.get(e);if(!i)return E(new Error(`Experience not found: ${e}`));let n=Date.now();i.completedAt=n,i.durationMs=n-i.startedAt,i.success=t.success,i.feedback=t.feedback,t.outcomeBasis&&(i.outcomeBasis=t.outcomeBasis),t.quality!==void 0?i.quality=t.quality:i.quality=this.calculateQuality(i);let r=t.testOutcome??i.metadata?.testOutcome;if(r&&Y(r)&&(i.testOutcome=r,i.reward=de(r)),this.witnessChain&&z().useWitnessChain)try{let o=this.witnessChain.appendWitness({type:"experience-capture",decision:i.success?"PASS":"FAIL",context:{experienceId:i.id,task:i.task,quality:i.quality,domain:i.domain,reward:i.reward},evidence:i.reward});i.witnessHash=o.hash}catch(o){F.warn("Failed to create witness receipt for experience",{experienceId:i.id,error:o instanceof Error?o.message:String(o)})}this.activeExperiences.delete(e),await this.storeExperience(i),this.updateStats(i);let a=i.reward!==void 0?i.reward<0:!i.success;if(this.nullRecorder&&a&&i.appliedPatterns?.length){let o=`${i.domain??"unknown"}:${i.agent??"unknown"}`;for(let d of i.appliedPatterns)try{await this.nullRecorder({patternId:d,contextFingerprint:o,failureMode:i.testOutcome??i.feedback??"task-failure",trajectoryRef:i.trajectoryId,evidenceClass:"EXECUTED"})}catch(c){F.warn("Failed to record pattern null",{patternId:d,error:c instanceof Error?c.message:String(c)})}}let s=i.reward===void 0||i.reward>0;if(i.outcomeBasis!==void 0||i.success&&i.quality>=this.config.minQualityForPatternExtraction&&s){let o=await this.extractPattern(i);(o.newPattern||o.reinforced)&&(i.patterns=[o.patternId])}return this.emitExperienceCaptured(i),k(i)}getActiveExperience(e){return this.activeExperiences.get(e)}getPendingCount(){return this.activeExperiences.size}async flushPending(){let e=Array.from(this.activeExperiences.entries());if(e.length===0)return 0;let t=0;for(let[i,n]of e){let r=Date.now();n.completedAt=r,n.durationMs=r-n.startedAt,n.quality=n.quality||this.calculateQuality(n),n.metadata={...n.metadata,flushedByCompaction:!0},await this.storeExperience(n),this.updateStats(n),this.activeExperiences.delete(i),t++}return F.info(`Flushed ${t} pending experiences before compaction`),t}async getExperience(e){let t=`${this.config.namespace}:experience:${e}`;return await this.memory.get(t)??null}async searchExperiences(e={}){let t=e.limit||100,i=[],n;e.domain?n=await this.memory.search(`${this.config.namespace}:index:domain:${e.domain}:*`,t*2):n=await this.memory.search(`${this.config.namespace}:experience:*`,t*2);for(let r of n){if(i.length>=t)break;let a=r.includes(":index:")?await this.memory.get(r):null,s=a?await this.getExperience(a):await this.memory.get(r);s&&(e.agent&&s.agent!==e.agent||e.success!==void 0&&s.success!==e.success||e.minQuality!==void 0&&s.quality<e.minQuality||i.push(s))}return i}async getStats(){let e={};for(let[t,i]of this.stats.byDomain)e[t]=i;return{totalExperiences:this.stats.totalCaptured,byDomain:e,successRate:this.stats.totalCaptured>0?this.stats.successfulCaptures/this.stats.totalCaptured:0,avgQuality:await this.calculateAvgQuality(),patternsExtracted:this.stats.patternsExtracted,patternsPromoted:this.stats.patternsPromoted}}async extractPattern(e){if(!this.patternStore)return{newPattern:!1,reinforced:!1,promoted:!1};let t=this.experienceIdentity(e),i=await this.patternStore.search(t,{limit:1,domain:e.domain,patternType:this.detectPatternType(e.task),useVectorSearch:!1});if(i.success&&i.value.length>0){let a=i.value[0],s=a.pattern.context?.experienceOrigin;if(s?.task===e.task&&s.domain===(e.domain??null)&&s.patternType===this.detectPatternType(e.task)&&a.pattern.patternType===s.patternType&&(!e.domain||a.pattern.qeDomain===e.domain)){let o=await this.patternStore.recordUsage(a.pattern.id,e.success,this.usageOutcomeTag(e)),d=await this.patternStore.get(a.pattern.id),c=!1;return d&&e.success&&d.tier==="short-term"&&d.usageCount>=this.config.promotionThreshold&&(await this.patternStore.promote(a.pattern.id)).success&&(c=!0,this.stats.patternsPromoted++,console.log(`[ExperienceCapture] Pattern promoted: ${a.pattern.id} (${d.usageCount} uses)`)),{newPattern:!1,patternId:a.pattern.id,reinforced:o.success,promoted:c}}}let n=this.experienceToPatternOptions(e),r=await this.patternStore.create(n);return r.success?(this.stats.patternsExtracted++,await this.patternStore.recordUsage(r.value.id,e.success,this.usageOutcomeTag(e)),{newPattern:!0,patternId:r.value.id,reinforced:!1,promoted:!1}):{newPattern:!1,reinforced:!1,promoted:!1}}async shareAcrossDomains(e){if(!this.config.enableCrossDomainSharing||!e.domain)return;let t=this.getRelatedDomains(e.domain);for(let i of t){let n=`${this.config.namespace}:shared:${i}:${e.id}`;await this.memory.set(n,{sourceExperience:e.id,sourceDomain:e.domain,sharedAt:Date.now()},{persist:!0})}}async cleanup(){let t=0;for(let i of this.stats.byDomain.keys()){let n=this.stats.byDomain.get(i)||0;if(n>this.config.maxExperiencesPerDomain){let r=await this.searchExperiences({domain:i,limit:n});r.sort((s,o)=>s.quality-o.quality||s.startedAt-o.startedAt);let a=n-this.config.maxExperiencesPerDomain;for(let s=0;s<Math.min(a,r.length);s++){let o=r[s];await this.softDeleteExperience(o.id),t++}}}return console.log(`[ExperienceCapture] Cleanup: ${t} archived (0 destroyed)`),{removed:0,consolidated:0,archived:t}}async dispose(){this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=void 0),await this.saveStats(),this.sessionCaptureCount===0&&console.warn("[ExperienceCapture] WARNING: Zero experiences captured this session. Learning cannot improve without experience data. Ensure tasks call startCapture()/completeCapture() to feed the learning loop."),this.activeExperiences.clear(),this.initialized=!1}async storeExperience(e){let t=`${this.config.namespace}:experience:${e.id}`;if(await this.memory.set(t,e,{persist:!0}),e.domain){let i=`${this.config.namespace}:index:domain:${e.domain}:${e.id}`;await this.memory.set(i,e.id,{persist:!0})}if(e.agent){let i=`${this.config.namespace}:index:agent:${e.agent}:${e.id}`;await this.memory.set(i,e.id,{persist:!0})}}async deleteExperience(e){await this.softDeleteExperience(e)}async softDeleteExperience(e){let t=await this.getExperience(e);if(!t)return;let i=`${this.config.namespace}:experience:${e}`,n={...t,_archived:!0};await this.memory.set(i,n,{persist:!0})}calculateQuality(e){if(e.steps.length===0)return e.success?.5:.2;let t=e.steps.filter(n=>n.quality!==void 0);if(t.length===0)return e.success?.6:.3;let i=t.reduce((n,r)=>n+(r.quality||0),0)/t.length;return e.success?Math.min(1,i+.1):Math.max(0,i-.2)}updateStats(e){if(this.stats.totalCaptured++,this.sessionCaptureCount++,e.success&&this.stats.successfulCaptures++,e.domain){let t=this.stats.byDomain.get(e.domain)||0;this.stats.byDomain.set(e.domain,t+1)}}async calculateAvgQuality(){let e=await this.searchExperiences({limit:100});return e.length===0?0:e.reduce((i,n)=>i+n.quality,0)/e.length}usageOutcomeTag(e){let t=typeof e.metadata?.runId=="string"?e.metadata.runId:void 0;return e.outcomeBasis!==void 0?B({measured:!0,success:e.success,basis:e.outcomeBasis},t):B({measured:!1,success:null,basis:"task-completed"},t)}experienceToPatternOptions(e){let t=this.detectPatternType(e.task),n=`Task: {{task}}
7
+
8
+ Steps:
9
+ ${e.steps.map((r,a)=>`${a+1}. ${r.action}${r.result?` \u2192 ${r.result}`:""}`).join(`
10
+ `)}
11
+
12
+ Duration: ${e.durationMs}ms`;return{patternType:t,qeDomain:e.domain,name:this.generatePatternName(e),description:`Pattern extracted from: ${e.task}`,context:{tags:[...this.extractTags(e),this.experienceIdentity(e)],experienceOrigin:{task:e.task,domain:e.domain??null,patternType:t},testType:this.detectTestType(e.task)},template:{type:"workflow",content:n,variables:[{name:"task",type:"string",description:"The task to execute",required:!0}]}}}detectPatternType(e){let t=e.toLowerCase();return t.includes("test")||t.includes("spec")?(t.includes("unit")||t.includes("integration")||t.includes("e2e"),"test-template"):t.includes("mock")||t.includes("stub")?"mock-pattern":t.includes("assert")||t.includes("expect")?"assertion-pattern":t.includes("coverage")?"coverage-strategy":t.includes("api")||t.includes("contract")?"api-contract":t.includes("visual")||t.includes("screenshot")?"visual-baseline":t.includes("accessibility")||t.includes("a11y")?"a11y-check":t.includes("performance")||t.includes("perf")?"perf-benchmark":t.includes("flaky")?"flaky-fix":t.includes("refactor")?"refactor-safe":t.includes("error")||t.includes("exception")?"error-handling":"test-template"}experienceIdentity(e){return le("sha256").update(JSON.stringify([e.task,e.domain??null,this.detectPatternType(e.task)])).digest("hex")}generatePatternName(e){let t=e.task.replace(/[^a-zA-Z0-9\s-]/g,"").slice(0,50).trim();return`${e.domain?`[${e.domain}] `:""}${t} ${this.experienceIdentity(e)}`}extractTags(e){let t=[];e.domain&&t.push(e.domain),e.agent&&t.push(e.agent),e.model&&t.push(`model:${e.model}`);let i=e.task.toLowerCase().split(/\s+/),n=["unit","integration","e2e","api","mock","coverage","security"];for(let r of n)i.some(a=>a.includes(r))&&t.push(r);return t}detectTestType(e){let t=e.toLowerCase();if(t.includes("unit"))return"unit";if(t.includes("integration"))return"integration";if(t.includes("e2e")||t.includes("end-to-end"))return"e2e";if(t.includes("contract")||t.includes("api"))return"contract";if(t.includes("smoke"))return"smoke"}getRelatedDomains(e){return{"test-generation":["test-execution","coverage-analysis"],"test-execution":["test-generation","coverage-analysis","quality-assessment"],"coverage-analysis":["test-generation","test-execution"],"quality-assessment":["test-execution","defect-intelligence"],"defect-intelligence":["quality-assessment","code-intelligence"],"requirements-validation":["test-generation","quality-assessment"],"code-intelligence":["defect-intelligence","security-compliance"],"security-compliance":["code-intelligence","quality-assessment"],"contract-testing":["test-generation","test-execution"],"visual-accessibility":["quality-assessment","test-execution"],"chaos-resilience":["test-execution","quality-assessment"],"learning-optimization":[]}[e]||[]}emitExperienceCaptured(e){this.eventBus&&this.eventBus.publish({id:`exp-captured-${e.id}`,type:"learning.ExperienceCaptured",source:"learning-optimization",timestamp:new Date,payload:{experience:e,reward:e.reward,testOutcome:e.testOutcome}})}async loadStats(){try{let e=await this.memory.get(`${this.config.namespace}:stats`);e&&(this.stats.totalCaptured=e.totalCaptured,this.stats.successfulCaptures=e.successfulCaptures,this.stats.patternsExtracted=e.patternsExtracted,this.stats.patternsPromoted=e.patternsPromoted,this.stats.byDomain=new Map(e.byDomain))}catch(e){F.debug("Stats restoration failed, starting fresh",{error:e instanceof Error?e.message:String(e)})}}async saveStats(){try{await this.memory.set(`${this.config.namespace}:stats`,{totalCaptured:this.stats.totalCaptured,successfulCaptures:this.stats.successfulCaptures,patternsExtracted:this.stats.patternsExtracted,patternsPromoted:this.stats.patternsPromoted,byDomain:Array.from(this.stats.byDomain.entries())},{persist:!0})}catch(e){console.error("[ExperienceCapture] Failed to save stats:",e)}}};function ee(u,e,t,i){return new L(u,e,t,i)}var ge={enableClaudeFlow:!0,enableExperienceCapture:!0,enablePatternPromotion:!0,promotionThreshold:T},I=class{constructor(e,t,i){this.memory=e;this.eventBus=i;this.config={...ge,...t}}memory;eventBus;config;reasoningBank;claudeFlowBridge;experienceCapture;patternStore;coherenceService;initialized=!1;_domainTransferEngine=null;_domainTransferInterval=null;activeTasks=new Map;completedTasks=0;claudeFlowErrors=0;async initialize(){if(!this.initialized){try{this.coherenceService=await H(J),this.coherenceService.isInitialized()&&console.log("[AQELearningEngine] CoherenceService initialized with WASM engines")}catch(e){console.log("[AQELearningEngine] CoherenceService WASM unavailable, using fallback:",y(e))}this.patternStore=N(this.memory,{promotionThreshold:this.config.promotionThreshold}),await this.patternStore.initialize(),this.reasoningBank=G(this.memory,this.eventBus,this.config.reasoningBank,this.coherenceService),await this.reasoningBank.initialize();try{let{getSharedRvfDualWriter:e}=await import("./shared-rvf-dual-writer-EYAVY2GZ.js"),t=await e();t&&this.reasoningBank.setRvfDualWriter(t)}catch(e){process.env.DEBUG&&console.debug("[AQELearningEngine] RVF wiring skipped:",e instanceof Error?e.message:e)}if(this.config.enableExperienceCapture){this.experienceCapture=ee(this.memory,this.patternStore,this.eventBus,{promotionThreshold:this.config.promotionThreshold}),await this.experienceCapture.initialize();try{let{isWitnessChainFeatureEnabled:e}=await import("./witness-chain-DOYMNPC7.js");if(e()){let{createPersistentWitnessChain:t,createWitnessChainSQLitePersistence:i}=await import("./witness-chain-DOYMNPC7.js"),{getUnifiedPersistence:n}=await import("./unified-persistence-QCSLU2SV.js"),r=n();if(r.isInitialized()){let a=r.getDatabase(),s=i(a),o=t(s);this.experienceCapture.setWitnessChain(o)}}}catch(e){process.env.DEBUG&&console.debug("[AQELearningEngine] Witness chain wiring skipped:",e instanceof Error?e.message:e)}try{let{getUnifiedPersistence:e}=await import("./unified-persistence-QCSLU2SV.js"),t=e();if(t.isInitialized()){let{PatternNullStore:i}=await import("./pattern-null-store-OU3ZC3NR.js"),n=new i(t.getDatabase());this.experienceCapture.setNullRecorder(r=>n.recordNullWhenUnlocked(r))}}catch(e){process.env.DEBUG&&console.debug("[AQELearningEngine] Null recorder wiring skipped:",e instanceof Error?e.message:e)}}try{let{isCrossDomainTransferEnabled:e}=await import("./feature-flags-G66OT3AS.js");if(e()&&this.patternStore){let{createDomainTransferEngine:t}=await import("./domain-transfer-LBIAFHIQ.js"),i=t(),n=this.patternStore,r=await n.getStats();this._domainTransferInterval=setInterval(async()=>{try{r=await n.getStats()}catch(a){process.env.DEBUG&&console.debug("[AQELearningEngine] Stats refresh failed:",a instanceof Error?a.message:a)}},6e4),this._domainTransferInterval.unref?.(),i.setPerformanceProvider(a=>{let s=r.byDomain?.[a]??0,o=r.totalPatterns??0;return{domain:a,successRate:o>0?s/o:.5,avgConfidence:r.avgConfidence??.5,patternCount:s,timestamp:Date.now()}}),this._domainTransferEngine=i}}catch(e){process.env.DEBUG&&console.debug("[AQELearningEngine] Domain transfer wiring skipped:",e instanceof Error?e.message:e)}if(this.config.enableClaudeFlow)try{this.claudeFlowBridge=K({projectRoot:this.config.projectRoot}),await this.claudeFlowBridge.initialize(),this.claudeFlowBridge.isAvailable()&&console.log("[AQELearningEngine] Claude Flow integration enabled")}catch(e){process.env.DEBUG&&console.log("[AQELearningEngine] Claude Flow not available, using standalone mode:",y(e))}this.initialized=!0,console.log("[AQELearningEngine] Initialized")}}getStatus(){let e=this.claudeFlowBridge?.getStatus();return{initialized:this.initialized,claudeFlowAvailable:e?.available??!1,features:{patternLearning:!0,vectorSearch:!0,taskRouting:!0,trajectories:e?.features.trajectories??!1,modelRouting:e?.features.modelRouting??!1,pretrain:e?.features.pretrain??!1}}}async getStats(){if(!this.initialized||!this.reasoningBank)throw new Error("Engine not initialized");let e=await this.reasoningBank.getStats(),t=this.experienceCapture?await this.experienceCapture.getStats():{totalExperiences:0,byDomain:{},successRate:0,avgQuality:0,patternsExtracted:0,patternsPromoted:0};return{...e,activeTasks:this.activeTasks.size,completedTasks:this.completedTasks,claudeFlowStatus:this.claudeFlowBridge?.getStatus()??{available:!1,features:{trajectories:!1,modelRouting:!1,pretrain:!1,patternSearch:!1}},claudeFlowErrors:this.claudeFlowErrors,experienceCapture:t}}async storePattern(e){return!this.initialized||!this.reasoningBank?E(new Error("Engine not initialized")):this.reasoningBank.storePattern(e)}async searchPatterns(e,t){return!this.initialized||!this.reasoningBank?E(new Error("Engine not initialized")):this.reasoningBank.searchPatterns(e,t)}async getPattern(e){return!this.initialized||!this.reasoningBank?null:this.reasoningBank.getPattern(e)}async recordOutcome(e){return!this.initialized||!this.reasoningBank?E(new Error("Engine not initialized")):this.reasoningBank.recordOutcome(e)}async routeTask(e){if(!this.initialized||!this.reasoningBank)return E(new Error("Engine not initialized"));let t=await this.searchPatternsForTask(e.task,{limit:5,minConfidence:.4,domain:e.domain,contextFingerprint:e.domain?`${e.domain}:router`:void 0});t.success&&t.value.length>0&&await this.trackPatternSearch(e.task,t.value);let i=await this.reasoningBank.routeTask(e);if(i.success&&this.claudeFlowBridge?.pretrain.isClaudeFlowAvailable(),i.success&&t.success){let n=U(i.value,t.value);return k(n)}return i}async route(e,t){let i=await this.routeTask({task:e,context:t});return i.success?i.value:null}async searchPatternsForTask(e,t={}){if(!this.reasoningBank)return k([]);try{return await this.reasoningBank.searchPatterns(e,{limit:t.limit||5,minConfidence:t.minConfidence||.4,domain:t.domain,contextFingerprint:t.contextFingerprint,useVectorSearch:!0})}catch(i){return console.warn("[AQELearningEngine] Pattern search failed:",y(i)),k([])}}async trackPatternSearch(e,t){let i={timestamp:Date.now(),task:e.slice(0,500),patternsFound:t.length,patternIds:t.map(n=>n.pattern.id),avgSimilarity:t.length>0?t.reduce((n,r)=>n+r.similarity,0)/t.length:0};try{let n=`pattern-usage:search:${Date.now()}-${te().slice(0,8)}`;await this.memory.set(n,i,{persist:!0,ttl:10080*60})}catch(n){console.debug("[AQELearningEngine] Failed to track pattern search:",y(n))}}async recommendModel(e){if(this.claudeFlowBridge?.modelRouter.isClaudeFlowAvailable())try{return await this.claudeFlowBridge.modelRouter.routeTask(e)}catch(t){console.debug("[AQELearningEngine] Claude Flow model routing failed:",t instanceof Error?t.message:t)}return this.localModelRoute(e)}async recordModelOutcome(e,t,i){this.claudeFlowBridge?.modelRouter.isClaudeFlowAvailable()&&await this.claudeFlowBridge.modelRouter.recordOutcome({task:e,model:t,outcome:i})}localModelRoute(e){let t=e.toLowerCase(),i=[/simple/i,/basic/i,/fix typo/i,/rename/i,/format/i,/add comment/i,/lint/i,/minor/i,/quick/i,/small/i];for(let r of i)if(r.test(t))return{model:"haiku",confidence:.75,reasoning:"Low complexity task - using haiku for speed"};let n=[/architect/i,/design/i,/complex/i,/security/i,/performance/i,/refactor.*large/i,/critical/i,/analysis/i,/multi.*file/i,/distributed/i,/concurrent/i,/migration/i];for(let r of n)if(r.test(t))return{model:"opus",confidence:.8,reasoning:"High complexity task - using opus for capability"};return e.length>500?{model:"opus",confidence:.65,reasoning:"Long task description - using opus for complex reasoning"}:e.length<50?{model:"haiku",confidence:.6,reasoning:"Short task - using haiku for efficiency"}:{model:"sonnet",confidence:.7,reasoning:"Medium complexity - using sonnet for balance"}}async startTask(e,t,i){let n=`task-${Date.now()}-${te().slice(0,8)}`,r=n;if(this.claudeFlowBridge?.trajectory.isClaudeFlowAvailable())try{r=await this.claudeFlowBridge.trajectory.startTrajectory(e,t)}catch(c){this.claudeFlowErrors++,console.warn(`[AQELearningEngine] Claude Flow startTrajectory failed (${this.claudeFlowErrors} total errors):`,y(c))}let a=`${i??"unknown"}:${t??"unknown"}`,s;try{let c=await this.searchPatternsForTask(e,{domain:i,contextFingerprint:a});c.success&&c.value.length>0&&(s=c.value.map(g=>g.pattern.id))}catch{}let o;this.experienceCapture&&(o=this.experienceCapture.startCapture(e,{agent:t,domain:i,trajectoryId:r!==n?r:void 0,appliedPatterns:s}));let d={id:o||r,task:e,agent:t,startedAt:Date.now(),steps:[]};return this.activeTasks.set(d.id,d),d.id}async recordStep(e,t,i,n){if(this.claudeFlowBridge?.trajectory.isClaudeFlowAvailable())try{await this.claudeFlowBridge.trajectory.recordStep(e,t,i,n)}catch(a){this.claudeFlowErrors++,console.warn(`[AQELearningEngine] Claude Flow recordStep failed (${this.claudeFlowErrors} total errors):`,y(a))}this.experienceCapture&&this.experienceCapture.recordStep(e,{action:t,result:i,quality:n});let r=this.activeTasks.get(e);r&&r.steps.push({action:t,result:i,quality:n,timestamp:Date.now()})}async endTask(e,t,i){if(this.claudeFlowBridge?.trajectory.isClaudeFlowAvailable())try{await this.claudeFlowBridge.trajectory.endTrajectory(e,t,i)}catch(r){this.claudeFlowErrors++,console.warn(`[AQELearningEngine] Claude Flow endTrajectory failed (${this.claudeFlowErrors} total errors):`,y(r))}let n=this.activeTasks.get(e);if(n)return this.activeTasks.delete(e),this.completedTasks++,this.config.enableExperienceCapture&&t&&await this.captureExperience(n),n}getTask(e){return this.activeTasks.get(e)}async analyzeCodebase(e,t="medium"){let i=e||this.config.projectRoot;if(this.claudeFlowBridge?.pretrain.isClaudeFlowAvailable())try{return await this.claudeFlowBridge.pretrain.analyze(i,t)}catch(n){console.debug("[AQELearningEngine] Claude Flow pretrain analyze failed:",n instanceof Error?n.message:n)}return this.localAnalyze(i,t)}async generateAgentConfigs(e="yaml"){if(this.claudeFlowBridge?.pretrain.isClaudeFlowAvailable())try{return await this.claudeFlowBridge.pretrain.generateAgentConfigs(e)}catch(t){console.debug("[AQELearningEngine] Claude Flow agent config failed:",t instanceof Error?t.message:t)}return[{name:"qe-test-architect",type:"worker",capabilities:["test-generation","test-design"],model:"sonnet"},{name:"qe-coverage-specialist",type:"worker",capabilities:["coverage-analysis","gap-detection"],model:"haiku"},{name:"qe-security-scanner",type:"worker",capabilities:["security-scanning","vulnerability-detection"],model:"opus"}]}async captureExperience(e){if(!this.experienceCapture||!this.config.enableExperienceCapture)return;let t=e.steps.length>0?e.steps.reduce((n,r)=>n+(r.quality??.5),0)/e.steps.length:.5;await this.experienceCapture.completeCapture(e.id,{success:!0,quality:t});let i=await this.experienceCapture.getExperience(e.id);i&&i.quality>=.7&&await this.experienceCapture.shareAcrossDomains(i)}startExperienceCapture(e,t){if(this.experienceCapture)return this.experienceCapture.startCapture(e,t)}getExperienceCaptureService(){return this.experienceCapture}async localAnalyze(e,t){try{let{glob:i}=await import("tinyglobby"),{existsSync:n,readFileSync:r}=await import("fs"),{join:a}=await import("path"),d=await i(t==="shallow"?["*.ts","*.js","*.json"]:t==="medium"?["**/*.ts","**/*.js","**/*.json","**/*.py"]:["**/*"],{cwd:e,ignore:["node_modules/**","dist/**","coverage/**",".git/**"],expandDirectories:!1,onlyFiles:!0}),c=new Set,g=new Set;for(let m of d.slice(0,100))(m.endsWith(".ts")||m.endsWith(".tsx"))&&c.add("typescript"),(m.endsWith(".js")||m.endsWith(".jsx"))&&c.add("javascript"),m.endsWith(".py")&&c.add("python"),m.endsWith(".go")&&c.add("go"),m.endsWith(".rs")&&c.add("rust");let w=a(e,"package.json");if(n(w))try{let m=b(r(w,"utf-8")),p={...m.dependencies,...m.devDependencies};p.react&&g.add("react"),p.vue&&g.add("vue"),p.vitest&&g.add("vitest"),p.jest&&g.add("jest"),p.playwright&&g.add("playwright")}catch(m){console.debug("[AQELearningEngine] package.json parse failed:",m instanceof Error?m.message:m)}return{success:!0,repositoryPath:e,depth:t,analysis:{languages:Array.from(c),frameworks:Array.from(g),patterns:[],complexity:d.length>500?3:d.length>100?2:1}}}catch(i){return{success:!1,repositoryPath:e,depth:t,error:y(i)}}}getGuidance(e,t){if(!this.reasoningBank)throw new Error("Engine not initialized");return this.reasoningBank.getGuidance(e,t)}generateContext(e,t){if(!this.reasoningBank)throw new Error("Engine not initialized");return this.reasoningBank.generateContext(e,t)}checkAntiPatterns(e,t){if(!this.reasoningBank)throw new Error("Engine not initialized");return this.reasoningBank.checkAntiPatterns(e,t)}async dispose(){this._domainTransferInterval&&(clearInterval(this._domainTransferInterval),this._domainTransferInterval=null),this._domainTransferEngine=null,this.experienceCapture&&await this.experienceCapture.dispose(),this.patternStore&&await this.patternStore.dispose(),this.reasoningBank&&await this.reasoningBank.dispose(),this.activeTasks.clear(),this.initialized=!1}},me={enabled:!1,snapshotIntervalMs:3e5,minSnapshotsForAnalysis:5,autoApplyThreshold:.8},ie=class{config;constructor(e){this.config={...me,...e}}runMetaLearningCycle(e){if(process.env.AQE_META_LEARNING_ENABLED!=="true")return[];if(!this.config.enabled)return[];if(e.length<this.config.minSnapshotsForAnalysis)return[];let t=Math.floor(e.length/2),i=e.slice(0,t),n=e.slice(t),r=[],a=Date.now(),s=h(i.map(l=>l.tokenMetrics.costUsd)),o=h(n.map(l=>l.tokenMetrics.costUsd)),d=h(i.map(l=>l.tokenMetrics.savingsUsd)),c=h(n.map(l=>l.tokenMetrics.savingsUsd));if(o>s*1.1&&c<=d*1.05){let l=Math.min(1,(o-s)/(s||1));r.push({id:`meta-tw-${a}`,type:"token-waste",description:`Token cost increased by ${((o/(s||1)-1)*100).toFixed(1)}% while savings remained flat`,confidence:A(l),suggestedAction:"Review cache configuration and increase pattern reuse thresholds",detectedAt:a})}let g=h(i.map(l=>l.qualityMetrics.gatePassRate)),w=h(n.map(l=>l.qualityMetrics.gatePassRate));Math.abs(w-g)<.02&&e.length>=this.config.minSnapshotsForAnalysis&&r.push({id:`meta-qp-${a}`,type:"quality-plateau",description:`Gate pass rate has been flat at ${(w*100).toFixed(1)}% across ${e.length} snapshots`,confidence:A(.6+(e.length-this.config.minSnapshotsForAnalysis)*.05),suggestedAction:"Consider reviewing quality thresholds or adding new test coverage domains",detectedAt:a});let p=h(i.map(l=>l.learningMetrics.patternCount)),f=h(n.map(l=>l.learningMetrics.patternCount)),ne=h(i.map(l=>l.learningMetrics.averageConfidence)),O=h(n.map(l=>l.learningMetrics.averageConfidence)),re=Math.abs(f-p),ae=Math.abs(O-ne);re<1&&ae<.02&&r.push({id:`meta-ls-${a}`,type:"learning-stall",description:`Pattern count (~${Math.round(f)}) and confidence (~${O.toFixed(2)}) have stagnated`,confidence:A(.65+(e.length-this.config.minSnapshotsForAnalysis)*.04),suggestedAction:"Expand to new QE domains or lower pattern creation thresholds to encourage exploration",detectedAt:a});let x=h(i.map(l=>l.performanceMetrics.p95LatencyMs)),j=h(n.map(l=>l.performanceMetrics.p95LatencyMs));if(j>x*1.2&&x>0){let l=Math.min(1,(j-x)/(x||1));r.push({id:`meta-pr-${a}`,type:"performance-regression",description:`P95 latency increased from ${x.toFixed(0)}ms to ${j.toFixed(0)}ms`,confidence:A(l),suggestedAction:"Profile hot paths and consider HNSW index tuning or batch size reduction",detectedAt:a})}return r}shouldAutoApply(e,t){let i=(t??this.config).autoApplyThreshold;return e.confidence>=i}};function h(u){return u.length===0?0:u.reduce((e,t)=>e+t,0)/u.length}function A(u){return Math.max(0,Math.min(1,u))}function he(u,e,t){return new I(u,e,t)}function st(u,e,t){return he(u,{projectRoot:e},t)}export{ge as a,I as b,me as c,ie as d,he as e,st as f};
@@ -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.15.15");process.exit(0)}
2
- import{a as w}from"./chunk-XHHWABJV.js";import{i as v}from"./chunk-QFGYH6HD.js";import{c as p,d as l}from"./chunk-LJMYRTJ7.js";import{a as g,b as x,e as y}from"./chunk-HL2ANKN3.js";y();var h=class extends Error{constructor(e){super(`Action timed out after ${e}ms; outcome is unknown`),this.name="ActionTimeoutError"}},m={ProtocolStarted:"coordination.ProtocolStarted",ProtocolCompleted:"coordination.ProtocolCompleted",ProtocolFailed:"coordination.ProtocolFailed",ProtocolOutcomeUnknown:"coordination.ProtocolOutcomeUnknown",ProtocolCancelled:"coordination.ProtocolCancelled",ActionStarted:"coordination.ActionStarted",ActionCompleted:"coordination.ActionCompleted",ActionFailed:"coordination.ActionFailed",ActionOutcomeUnknown:"coordination.ActionOutcomeUnknown"},E=class{constructor(e,t,o){this.eventBus=e;this.memory=t;this.getDomainAPI=o}eventBus;memory;getDomainAPI;protocols=new Map;executions=new Map;scheduledProtocols=new Map;schedulerRunning=!1;registerProtocol(e){this.protocols.set(e.id,e),e.schedule.type==="event"&&e.enabled&&this.setupEventTriggers(e),(e.schedule.type==="cron"||e.schedule.type==="interval")&&e.enabled&&this.scheduleProtocol(e)}unregisterProtocol(e){if(!this.protocols.get(e))return!1;let o=this.scheduledProtocols.get(e);return o?.intervalId&&clearInterval(o.intervalId),this.scheduledProtocols.delete(e),this.protocols.delete(e),!0}getProtocol(e){return this.protocols.get(e)}listProtocols(){return Array.from(this.protocols.values())}async execute(e,t){let o=this.protocols.get(e);return o?o.enabled?this.executeProtocol(o,t):l(new Error(`Protocol is disabled: ${e}`)):l(new Error(`Protocol not found: ${e}`))}async executeOnEvent(e,t){let o=this.protocols.get(e);return o?o.enabled?this.executeProtocol(o,void 0,t):l(new Error(`Protocol is disabled: ${e}`)):l(new Error(`Protocol not found: ${e}`))}getExecution(e){let t=this.executions.get(e);if(t)return this.toImmutableExecution(t.execution)}listActiveExecutions(){return Array.from(this.executions.values()).filter(e=>e.execution.status==="running"||e.execution.status==="paused").map(e=>this.toImmutableExecution(e.execution))}async cancelExecution(e){let t=this.executions.get(e);return t?t.execution.status!=="running"&&t.execution.status!=="paused"?l(new Error(`Cannot cancel execution in status: ${t.execution.status}`)):(t.cancelled=!0,t.execution.status="cancelled",t.execution.completedAt=new Date,await this.publishEvent(m.ProtocolCancelled,{executionId:e,protocolId:t.protocol.id}),p(void 0)):l(new Error(`Execution not found: ${e}`))}async pauseExecution(e){let t=this.executions.get(e);return t?t.execution.status!=="running"?l(new Error(`Cannot pause execution in status: ${t.execution.status}`)):(t.paused=!0,t.execution.status="paused",p(void 0)):l(new Error(`Execution not found: ${e}`))}async resumeExecution(e){let t=this.executions.get(e);return t?t.execution.status!=="paused"?l(new Error(`Cannot resume execution in status: ${t.execution.status}`)):(t.paused=!1,t.execution.status="running",p(void 0)):l(new Error(`Execution not found: ${e}`))}startScheduler(){if(!this.schedulerRunning){this.schedulerRunning=!0;for(let e of this.protocols.values())e.enabled&&(e.schedule.type==="interval"||e.schedule.type==="cron")&&this.scheduleProtocol(e)}}stopScheduler(){this.schedulerRunning=!1;for(let e of this.scheduledProtocols.values())e.intervalId&&(clearInterval(e.intervalId),e.intervalId=void 0)}async dispose(){this.stopScheduler(),this.protocols.clear(),this.executions.clear(),this.scheduledProtocols.clear()}async executeProtocol(e,t,o){let n=v(),a=o?.correlationId??n,i={executionId:n,protocolId:e.id,status:"running",participants:[...e.participants],results:new Map,startedAt:new Date,correlationId:a,triggeredBy:o},d={execution:i,protocol:e,params:t,actionResults:new Map,cancelled:!1,paused:!1};this.executions.set(n,d),await this.publishEvent(m.ProtocolStarted,{executionId:n,protocolId:e.id,participants:e.participants},a);try{await this.executeActions(d);let r=Array.from(d.actionResults.values()),s=r.filter(c=>c.status==="unknown").map(c=>c.actionId),u=r.filter(c=>c.status==="failed").map(c=>c.actionId);return d.cancelled?i.status="cancelled":s.length>0?(i.status="unknown",await this.publishEvent(m.ProtocolOutcomeUnknown,{executionId:n,protocolId:e.id,unknownActions:s,failedActions:u},a)):u.length>0?(i.status="failed",await this.publishEvent(m.ProtocolFailed,{executionId:n,protocolId:e.id,failedActions:u},a)):(i.status="completed",await this.publishEvent(m.ProtocolCompleted,{executionId:n,protocolId:e.id,duration:Date.now()-i.startedAt.getTime()},a)),i.completedAt=new Date,i.results=d.actionResults,await this.storeExecutionHistory(i),p(this.toImmutableExecution(i))}catch(r){return i.status="failed",i.completedAt=new Date,await this.publishEvent(m.ProtocolFailed,{executionId:n,protocolId:e.id,error:g(r)},a),l(x(r))}}async executeActions(e){let{protocol:t,actionResults:o}=e,n=new Set(t.actions.map(i=>i.id)),a=new Set;for(;n.size>0&&!e.cancelled;){for(;e.paused&&!e.cancelled;)await this.sleep(100);if(e.cancelled)break;let i=t.actions.filter(r=>n.has(r.id)&&this.dependenciesSatisfied(r,a));if(i.length===0&&n.size>0){let r=!1;for(let s of t.actions)n.has(s.id)&&s.dependsOn?.some(u=>{let c=o.get(u)?.status;return c!==void 0&&c!=="completed"})&&(o.set(s.id,{actionId:s.id,status:"skipped"}),n.delete(s.id),r=!0);if(r)continue;throw new Error(`Deadlock detected: actions ${Array.from(n).join(", ")} cannot proceed`)}let d=await Promise.allSettled(i.map(r=>this.executeAction(r,e)));for(let r=0;r<i.length;r++){let s=i[r],u=d[r],c;u.status==="fulfilled"?c=u.value:c={actionId:s.id,status:"failed",error:u.reason instanceof Error?u.reason.message:String(u.reason)},o.set(s.id,c),n.delete(s.id),c.status==="completed"&&a.add(s.id)}}for(let i of n)o.set(i,{actionId:i,status:e.cancelled?"cancelled":"skipped"})}async executeAction(e,t){let o=new Date;await this.publishEvent(m.ActionStarted,{executionId:t.execution.executionId,actionId:e.id,actionName:e.name,targetDomain:e.targetDomain},t.execution.correlationId);let n=0,a=e.retry?.maxAttempts??1,i;for(;n<a;){n++;try{let r=this.getDomainAPI(e.targetDomain);if(!r)throw new Error(`Domain API not available: ${e.targetDomain}`);let s=r[e.method];if(typeof s!="function")throw new Error(`Method ${e.method} not found on domain ${e.targetDomain}`);let u={...e.params,...t.params},c=await this.executeWithTimeout(s.bind(r)(u),e.timeout??3e4),P=new Date;return await this.publishEvent(m.ActionCompleted,{executionId:t.execution.executionId,actionId:e.id,duration:P.getTime()-o.getTime()},t.execution.correlationId),{actionId:e.id,status:"completed",startedAt:o,completedAt:P,duration:P.getTime()-o.getTime(),result:c,retryAttempts:n>1?n-1:void 0}}catch(r){if(i=x(r),r instanceof h){let s=new Date;return await this.publishEvent(m.ActionOutcomeUnknown,{executionId:t.execution.executionId,actionId:e.id,error:r.message,attempts:n},t.execution.correlationId),{actionId:e.id,status:"unknown",startedAt:o,completedAt:s,duration:s.getTime()-o.getTime(),error:r.message,retryAttempts:n>1?n-1:void 0}}if(n<a&&e.retry){let s=e.retry.backoffMs*Math.pow(e.retry.backoffMultiplier??2,n-1);await this.sleep(s)}}}let d=new Date;return await this.publishEvent(m.ActionFailed,{executionId:t.execution.executionId,actionId:e.id,error:i?.message??"Unknown error",attempts:n},t.execution.correlationId),{actionId:e.id,status:"failed",startedAt:o,completedAt:d,duration:d.getTime()-o.getTime(),error:i?.message??"Unknown error",retryAttempts:n>1?n-1:void 0}}dependenciesSatisfied(e,t){return!e.dependsOn||e.dependsOn.length===0?!0:e.dependsOn.every(o=>t.has(o))}async executeWithTimeout(e,t){let o;try{return await Promise.race([e,new Promise((n,a)=>{o=setTimeout(()=>a(new h(t)),t)})])}finally{o&&clearTimeout(o)}}setupEventTriggers(e){if(e.schedule.type==="event")for(let t of e.schedule.triggerEvents)this.eventBus.subscribe(t,async o=>{await this.executeOnEvent(e.id,o)})}scheduleProtocol(e){if(e.schedule.type==="interval"){let t={protocolId:e.id,schedule:e.schedule};t.intervalId=setInterval(async()=>{this.schedulerRunning&&await this.execute(e.id)},e.schedule.intervalMs),this.scheduledProtocols.set(e.id,t)}}async storeExecutionHistory(e){let t=`protocol-execution:${e.executionId}`;await this.memory.set(t,{...e,results:Object.fromEntries(e.results)},{namespace:"coordination",ttl:86400})}toImmutableExecution(e){return{executionId:e.executionId,protocolId:e.protocolId,status:e.status,participants:[...e.participants],results:new Map(e.results),startedAt:e.startedAt,completedAt:e.completedAt,correlationId:e.correlationId,triggeredBy:e.triggeredBy}}async publishEvent(e,t,o){let n=w(e,"learning-optimization",t,o);await this.eventBus.publish(n)}sleep(e){return new Promise(t=>setTimeout(t,e))}};function S(f,e,t){return new E(f,e,t)}export{E as a,S as 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.15.17");process.exit(0)}
2
+ import{a as w}from"./chunk-IHQGNDMX.js";import{i as v}from"./chunk-XPTCQKVE.js";import{c as p,d as l}from"./chunk-REY52O7J.js";import{a as g,b as x,e as y}from"./chunk-J7Q5TXFZ.js";y();var h=class extends Error{constructor(e){super(`Action timed out after ${e}ms; outcome is unknown`),this.name="ActionTimeoutError"}},m={ProtocolStarted:"coordination.ProtocolStarted",ProtocolCompleted:"coordination.ProtocolCompleted",ProtocolFailed:"coordination.ProtocolFailed",ProtocolOutcomeUnknown:"coordination.ProtocolOutcomeUnknown",ProtocolCancelled:"coordination.ProtocolCancelled",ActionStarted:"coordination.ActionStarted",ActionCompleted:"coordination.ActionCompleted",ActionFailed:"coordination.ActionFailed",ActionOutcomeUnknown:"coordination.ActionOutcomeUnknown"},E=class{constructor(e,t,o){this.eventBus=e;this.memory=t;this.getDomainAPI=o}eventBus;memory;getDomainAPI;protocols=new Map;executions=new Map;scheduledProtocols=new Map;schedulerRunning=!1;registerProtocol(e){this.protocols.set(e.id,e),e.schedule.type==="event"&&e.enabled&&this.setupEventTriggers(e),(e.schedule.type==="cron"||e.schedule.type==="interval")&&e.enabled&&this.scheduleProtocol(e)}unregisterProtocol(e){if(!this.protocols.get(e))return!1;let o=this.scheduledProtocols.get(e);return o?.intervalId&&clearInterval(o.intervalId),this.scheduledProtocols.delete(e),this.protocols.delete(e),!0}getProtocol(e){return this.protocols.get(e)}listProtocols(){return Array.from(this.protocols.values())}async execute(e,t){let o=this.protocols.get(e);return o?o.enabled?this.executeProtocol(o,t):l(new Error(`Protocol is disabled: ${e}`)):l(new Error(`Protocol not found: ${e}`))}async executeOnEvent(e,t){let o=this.protocols.get(e);return o?o.enabled?this.executeProtocol(o,void 0,t):l(new Error(`Protocol is disabled: ${e}`)):l(new Error(`Protocol not found: ${e}`))}getExecution(e){let t=this.executions.get(e);if(t)return this.toImmutableExecution(t.execution)}listActiveExecutions(){return Array.from(this.executions.values()).filter(e=>e.execution.status==="running"||e.execution.status==="paused").map(e=>this.toImmutableExecution(e.execution))}async cancelExecution(e){let t=this.executions.get(e);return t?t.execution.status!=="running"&&t.execution.status!=="paused"?l(new Error(`Cannot cancel execution in status: ${t.execution.status}`)):(t.cancelled=!0,t.execution.status="cancelled",t.execution.completedAt=new Date,await this.publishEvent(m.ProtocolCancelled,{executionId:e,protocolId:t.protocol.id}),p(void 0)):l(new Error(`Execution not found: ${e}`))}async pauseExecution(e){let t=this.executions.get(e);return t?t.execution.status!=="running"?l(new Error(`Cannot pause execution in status: ${t.execution.status}`)):(t.paused=!0,t.execution.status="paused",p(void 0)):l(new Error(`Execution not found: ${e}`))}async resumeExecution(e){let t=this.executions.get(e);return t?t.execution.status!=="paused"?l(new Error(`Cannot resume execution in status: ${t.execution.status}`)):(t.paused=!1,t.execution.status="running",p(void 0)):l(new Error(`Execution not found: ${e}`))}startScheduler(){if(!this.schedulerRunning){this.schedulerRunning=!0;for(let e of this.protocols.values())e.enabled&&(e.schedule.type==="interval"||e.schedule.type==="cron")&&this.scheduleProtocol(e)}}stopScheduler(){this.schedulerRunning=!1;for(let e of this.scheduledProtocols.values())e.intervalId&&(clearInterval(e.intervalId),e.intervalId=void 0)}async dispose(){this.stopScheduler(),this.protocols.clear(),this.executions.clear(),this.scheduledProtocols.clear()}async executeProtocol(e,t,o){let n=v(),a=o?.correlationId??n,i={executionId:n,protocolId:e.id,status:"running",participants:[...e.participants],results:new Map,startedAt:new Date,correlationId:a,triggeredBy:o},d={execution:i,protocol:e,params:t,actionResults:new Map,cancelled:!1,paused:!1};this.executions.set(n,d),await this.publishEvent(m.ProtocolStarted,{executionId:n,protocolId:e.id,participants:e.participants},a);try{await this.executeActions(d);let r=Array.from(d.actionResults.values()),s=r.filter(c=>c.status==="unknown").map(c=>c.actionId),u=r.filter(c=>c.status==="failed").map(c=>c.actionId);return d.cancelled?i.status="cancelled":s.length>0?(i.status="unknown",await this.publishEvent(m.ProtocolOutcomeUnknown,{executionId:n,protocolId:e.id,unknownActions:s,failedActions:u},a)):u.length>0?(i.status="failed",await this.publishEvent(m.ProtocolFailed,{executionId:n,protocolId:e.id,failedActions:u},a)):(i.status="completed",await this.publishEvent(m.ProtocolCompleted,{executionId:n,protocolId:e.id,duration:Date.now()-i.startedAt.getTime()},a)),i.completedAt=new Date,i.results=d.actionResults,await this.storeExecutionHistory(i),p(this.toImmutableExecution(i))}catch(r){return i.status="failed",i.completedAt=new Date,await this.publishEvent(m.ProtocolFailed,{executionId:n,protocolId:e.id,error:g(r)},a),l(x(r))}}async executeActions(e){let{protocol:t,actionResults:o}=e,n=new Set(t.actions.map(i=>i.id)),a=new Set;for(;n.size>0&&!e.cancelled;){for(;e.paused&&!e.cancelled;)await this.sleep(100);if(e.cancelled)break;let i=t.actions.filter(r=>n.has(r.id)&&this.dependenciesSatisfied(r,a));if(i.length===0&&n.size>0){let r=!1;for(let s of t.actions)n.has(s.id)&&s.dependsOn?.some(u=>{let c=o.get(u)?.status;return c!==void 0&&c!=="completed"})&&(o.set(s.id,{actionId:s.id,status:"skipped"}),n.delete(s.id),r=!0);if(r)continue;throw new Error(`Deadlock detected: actions ${Array.from(n).join(", ")} cannot proceed`)}let d=await Promise.allSettled(i.map(r=>this.executeAction(r,e)));for(let r=0;r<i.length;r++){let s=i[r],u=d[r],c;u.status==="fulfilled"?c=u.value:c={actionId:s.id,status:"failed",error:u.reason instanceof Error?u.reason.message:String(u.reason)},o.set(s.id,c),n.delete(s.id),c.status==="completed"&&a.add(s.id)}}for(let i of n)o.set(i,{actionId:i,status:e.cancelled?"cancelled":"skipped"})}async executeAction(e,t){let o=new Date;await this.publishEvent(m.ActionStarted,{executionId:t.execution.executionId,actionId:e.id,actionName:e.name,targetDomain:e.targetDomain},t.execution.correlationId);let n=0,a=e.retry?.maxAttempts??1,i;for(;n<a;){n++;try{let r=this.getDomainAPI(e.targetDomain);if(!r)throw new Error(`Domain API not available: ${e.targetDomain}`);let s=r[e.method];if(typeof s!="function")throw new Error(`Method ${e.method} not found on domain ${e.targetDomain}`);let u={...e.params,...t.params},c=await this.executeWithTimeout(s.bind(r)(u),e.timeout??3e4),P=new Date;return await this.publishEvent(m.ActionCompleted,{executionId:t.execution.executionId,actionId:e.id,duration:P.getTime()-o.getTime()},t.execution.correlationId),{actionId:e.id,status:"completed",startedAt:o,completedAt:P,duration:P.getTime()-o.getTime(),result:c,retryAttempts:n>1?n-1:void 0}}catch(r){if(i=x(r),r instanceof h){let s=new Date;return await this.publishEvent(m.ActionOutcomeUnknown,{executionId:t.execution.executionId,actionId:e.id,error:r.message,attempts:n},t.execution.correlationId),{actionId:e.id,status:"unknown",startedAt:o,completedAt:s,duration:s.getTime()-o.getTime(),error:r.message,retryAttempts:n>1?n-1:void 0}}if(n<a&&e.retry){let s=e.retry.backoffMs*Math.pow(e.retry.backoffMultiplier??2,n-1);await this.sleep(s)}}}let d=new Date;return await this.publishEvent(m.ActionFailed,{executionId:t.execution.executionId,actionId:e.id,error:i?.message??"Unknown error",attempts:n},t.execution.correlationId),{actionId:e.id,status:"failed",startedAt:o,completedAt:d,duration:d.getTime()-o.getTime(),error:i?.message??"Unknown error",retryAttempts:n>1?n-1:void 0}}dependenciesSatisfied(e,t){return!e.dependsOn||e.dependsOn.length===0?!0:e.dependsOn.every(o=>t.has(o))}async executeWithTimeout(e,t){let o;try{return await Promise.race([e,new Promise((n,a)=>{o=setTimeout(()=>a(new h(t)),t)})])}finally{o&&clearTimeout(o)}}setupEventTriggers(e){if(e.schedule.type==="event")for(let t of e.schedule.triggerEvents)this.eventBus.subscribe(t,async o=>{await this.executeOnEvent(e.id,o)})}scheduleProtocol(e){if(e.schedule.type==="interval"){let t={protocolId:e.id,schedule:e.schedule};t.intervalId=setInterval(async()=>{this.schedulerRunning&&await this.execute(e.id)},e.schedule.intervalMs),this.scheduledProtocols.set(e.id,t)}}async storeExecutionHistory(e){let t=`protocol-execution:${e.executionId}`;await this.memory.set(t,{...e,results:Object.fromEntries(e.results)},{namespace:"coordination",ttl:86400})}toImmutableExecution(e){return{executionId:e.executionId,protocolId:e.protocolId,status:e.status,participants:[...e.participants],results:new Map(e.results),startedAt:e.startedAt,completedAt:e.completedAt,correlationId:e.correlationId,triggeredBy:e.triggeredBy}}async publishEvent(e,t,o){let n=w(e,"learning-optimization",t,o);await this.eventBus.publish(n)}sleep(e){return new Promise(t=>setTimeout(t,e))}};function S(f,e,t){return new E(f,e,t)}export{E as a,S as b};
@@ -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.15.17");process.exit(0)}
2
+ import{a as u,d as f}from"./chunk-5FSPELOG.js";f();var c=class extends Error{constructor(t){super(u(t,Number.POSITIVE_INFINITY)),this.name="TestRunnerExecutionError"}};function x(e,t=4e3){return u(e,Number.POSITIVE_INFINITY).slice(0,t)}function F(e,t,r,n,a,o){let l=(o?.testResults??[]).filter(i=>i.status==="failed"&&(e==="vitest"&&i.message||!i.assertionResults?.some(d=>d.status==="failed"))),s;if(r===null?s="terminated without an exit code":n.passed+n.failed+n.skipped===0?s="reported zero tests":l.length>0||(o?.numRuntimeErrorTestSuites??0)>0||(o?.numFailedTestSuites??0)>0&&n.failed===0?s="reported a suite execution error":(r!==0||o?.success===!1)&&n.failed===0&&(s="failed without a failed assertion"),!s)return;let m=[...l.map(i=>i.message).filter(Boolean),a.trim()].filter(Boolean).join(`
3
+ `);return new c(`${e} ${s} for ${t} (exit code ${r??"unknown"}).`+(m?`
4
+ ${x(m)}`:""))}import{realpathSync as R,statSync as $}from"node:fs";import{basename as b,dirname as E,extname as T,resolve as g,sep as h}from"node:path";function p(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function y(e,t=process.cwd()){let r=g(t,e);try{return g(R(E(r)),b(r))}catch{return r}}function I(e){try{return $(e).isDirectory()}catch{return T(e)===""}}function k(e,t=process.cwd()){let r=y(e,t),n=r.split(h).join("/"),a=I(r)?"(?:/|$)":"$";return`^${p(n)}${a}`}function v(e,t){let r=`^${t.split(" ").map(p).join("(?: > | )")}$`;return e==="mocha"?`--grep=${r}`:`--testNamePattern=${r}`}function A(e){return e.some(t=>/(^|[\\/])jest(\.cmd|\.js|\.mjs)?$/i.test(t))}export{c as a,x as b,F as c,y as d,k as e,v as f,A as g};