agentic-qe 3.15.16 → 3.15.18

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 (539) hide show
  1. package/.claude/helpers/brain-checkpoint.cjs +107 -10
  2. package/.claude/skills/agentic-quality-engineering/SKILL.md +67 -44
  3. package/.claude/skills/brutal-honesty-review/SKILL.md +12 -7
  4. package/.claude/skills/brutal-honesty-review/evals/brutal-honesty-review.yaml +120 -0
  5. package/.claude/skills/brutal-honesty-review/schemas/output.json +9 -3
  6. package/.claude/skills/code-review-quality/SKILL.md +2 -2
  7. package/.claude/skills/holistic-testing-pact/SKILL.md +11 -11
  8. package/.claude/skills/sherlock-review/SKILL.md +4 -2
  9. package/.claude/skills/sherlock-review/evals/sherlock-review.yaml +124 -0
  10. package/.claude/skills/skills-manifest.json +1 -1
  11. package/.claude/skills/technical-writing/SKILL.md +12 -6
  12. package/.claude/skills/technical-writing/evals/technical-writing.yaml +96 -0
  13. package/.opencode/skills/qe-agentic-quality-engineering.yaml +2 -2
  14. package/.opencode/skills/qe-holistic-testing-pact.yaml +2 -2
  15. package/CHANGELOG.md +201 -0
  16. package/assets/skills/agentic-quality-engineering/SKILL.md +67 -44
  17. package/assets/skills/brutal-honesty-review/SKILL.md +12 -8
  18. package/assets/skills/brutal-honesty-review/evals/brutal-honesty-review.yaml +120 -0
  19. package/assets/skills/brutal-honesty-review/schemas/output.json +9 -3
  20. package/assets/skills/code-review-quality/SKILL.md +2 -2
  21. package/assets/skills/holistic-testing-pact/SKILL.md +11 -11
  22. package/assets/skills/sherlock-review/SKILL.md +4 -3
  23. package/assets/skills/sherlock-review/evals/sherlock-review.yaml +124 -0
  24. package/assets/skills/skills-manifest.json +1 -1
  25. package/assets/skills/technical-writing/SKILL.md +12 -6
  26. package/assets/skills/technical-writing/evals/technical-writing.yaml +96 -0
  27. package/dist/cli/brain-commands.d.ts +5 -0
  28. package/dist/cli/brain-commands.js +4 -0
  29. package/dist/cli/bundle.js +6 -6
  30. package/dist/cli/chunks/adapter-WRSDXLOT.js +2 -0
  31. package/dist/cli/chunks/{agent-booster-wasm-45NWEKVS.js → agent-booster-wasm-UFNJNF3M.js} +2 -2
  32. package/dist/cli/chunks/{agent-handler-LVHMYFEF.js → agent-handler-EAYVRJXN.js} +2 -2
  33. package/dist/cli/chunks/{agent-memory-branch-YDWOJFEQ.js → agent-memory-branch-M65C6WAQ.js} +2 -2
  34. package/dist/cli/chunks/aqe-learning-engine-O6NJBCCM.js +2 -0
  35. package/dist/cli/chunks/{arena-ELDZH3CZ.js → arena-2GDICP6R.js} +4 -4
  36. package/dist/cli/chunks/{arena-CZKHXDDS.js → arena-CG3X67OE.js} +2 -2
  37. package/dist/cli/chunks/{audit-5MT4T47Z.js → audit-F4FSPJPL.js} +3 -3
  38. package/dist/cli/chunks/base-J2FXOE77.js +2 -0
  39. package/dist/cli/chunks/{better-sqlite3-6TGYPC2B.js → better-sqlite3-2MCFXW4J.js} +2 -2
  40. package/dist/cli/chunks/brain-handler-WGTJNYNB.js +95 -0
  41. package/dist/cli/chunks/{branch-enumerator-WVILM4SO.js → branch-enumerator-KL7C535H.js} +2 -2
  42. package/dist/cli/chunks/{browser-RX5ALU3H.js → browser-SJEXDVHS.js} +2 -2
  43. package/dist/cli/chunks/browser-workflow-LXGER6ZD.js +2 -0
  44. package/dist/cli/chunks/{chunk-2H4XH6FT.js → chunk-244RKAEP.js} +2 -2
  45. package/dist/cli/chunks/{chunk-SI6DPU5D.js → chunk-27TUMXPD.js} +1 -1
  46. package/dist/cli/chunks/{chunk-YNMJEDN5.js → chunk-2MBYDPCP.js} +2 -2
  47. package/dist/cli/chunks/{chunk-24QHCVX6.js → chunk-2Q6DTBMT.js} +1 -1
  48. package/dist/cli/chunks/{chunk-XWUWX7BV.js → chunk-355MI7RV.js} +13 -13
  49. package/dist/cli/chunks/{chunk-NQXXI77K.js → chunk-3LX5OKBD.js} +2 -2
  50. package/dist/cli/chunks/{chunk-63GMRQ25.js → chunk-3RPDKJGV.js} +1 -1
  51. package/dist/cli/chunks/chunk-3YMIT73A.js +4 -0
  52. package/dist/cli/chunks/{chunk-P3EYRILV.js → chunk-43KUVBSU.js} +2 -2
  53. package/dist/cli/chunks/chunk-477FKXSS.js +2 -0
  54. package/dist/cli/chunks/{chunk-HGWXF45W.js → chunk-4BIMTRRX.js} +1 -1
  55. package/dist/cli/chunks/{chunk-SSUAAX3F.js → chunk-4CVNVBX5.js} +2 -2
  56. package/dist/cli/chunks/{chunk-5V3TI2LG.js → chunk-4HL3SD4A.js} +1 -1
  57. package/dist/cli/chunks/{chunk-KKU2QGSJ.js → chunk-4PEG4DU2.js} +2 -2
  58. package/dist/cli/chunks/{chunk-J4ELZNLY.js → chunk-4QSQKFED.js} +2 -2
  59. package/dist/cli/chunks/chunk-53ZBETYR.js +16 -0
  60. package/dist/cli/chunks/{chunk-7TE5ONQQ.js → chunk-544KDWL4.js} +1 -1
  61. package/dist/cli/chunks/chunk-54RCGMLB.js +8 -0
  62. package/dist/cli/chunks/{chunk-KU2AUFGX.js → chunk-5AGXIZQ5.js} +2 -2
  63. package/dist/cli/chunks/{chunk-LQLPB2T6.js → chunk-5M24X6W7.js} +2 -2
  64. package/dist/cli/chunks/{chunk-YU2BDRSD.js → chunk-5O5T4LEU.js} +1 -1
  65. package/dist/cli/chunks/{chunk-NAEWCFQT.js → chunk-5RFXX4IF.js} +2 -2
  66. package/dist/cli/chunks/{chunk-MD43XRX5.js → chunk-62MLAQRJ.js} +1 -1
  67. package/dist/cli/chunks/{chunk-PEQDY4BO.js → chunk-6D6TGL2E.js} +2 -2
  68. package/dist/cli/chunks/{chunk-IOYG4VFL.js → chunk-6IHZDSDL.js} +2 -2
  69. package/dist/cli/chunks/{chunk-C5FP5GW3.js → chunk-6P3Y45QL.js} +2 -2
  70. package/dist/cli/chunks/{chunk-4LQFBY5L.js → chunk-6TEVM3X3.js} +10 -10
  71. package/dist/cli/chunks/{chunk-YPBSUGMI.js → chunk-7XTUKKRA.js} +1 -1
  72. package/dist/cli/chunks/chunk-A3GDX6UF.js +2 -0
  73. package/dist/cli/chunks/{chunk-HLUXXCHF.js → chunk-A5YTKKNA.js} +1 -1
  74. package/dist/cli/chunks/{chunk-Y4PFUMOU.js → chunk-ADNGZAT2.js} +1 -1
  75. package/dist/cli/chunks/{chunk-KNSRL6NO.js → chunk-AWQAE3SW.js} +2 -2
  76. package/dist/cli/chunks/{chunk-BY5OF7OH.js → chunk-AXDBQFR4.js} +2 -2
  77. package/dist/cli/chunks/{chunk-525CFDUE.js → chunk-AXVD7O3F.js} +2 -2
  78. package/dist/cli/chunks/{chunk-JHQCRRJI.js → chunk-B52ULNYO.js} +2 -2
  79. package/dist/cli/chunks/chunk-B6S4FC7M.js +3 -0
  80. package/dist/cli/chunks/{chunk-AJMJNQMP.js → chunk-BDVFSMOQ.js} +1 -1
  81. package/dist/cli/chunks/{chunk-DXD6K2ZP.js → chunk-BGXXMX3Y.js} +2 -2
  82. package/dist/cli/chunks/{chunk-EK7OLYOZ.js → chunk-BKMQQY5T.js} +2 -2
  83. package/dist/cli/chunks/{chunk-VWPM27GU.js → chunk-BN2FROBQ.js} +2 -2
  84. package/dist/cli/chunks/{chunk-J7I6PABJ.js → chunk-BO6EQNOC.js} +2 -2
  85. package/dist/cli/chunks/{chunk-4D4DENG6.js → chunk-BOVAKCDC.js} +2 -2
  86. package/dist/cli/chunks/{chunk-ZFL436FN.js → chunk-BSXKZDKO.js} +2 -2
  87. package/dist/cli/chunks/{chunk-J442IZLE.js → chunk-C5QVJ5XQ.js} +1 -1
  88. package/dist/cli/chunks/{chunk-ZB3LEFYG.js → chunk-CFQLLF3D.js} +2 -2
  89. package/dist/cli/chunks/{chunk-UHEOGZLX.js → chunk-DUCVLT3F.js} +7 -7
  90. package/dist/cli/chunks/{chunk-TVGI32MB.js → chunk-E4RMJCGA.js} +3 -3
  91. package/dist/cli/chunks/{chunk-TIUKLYAI.js → chunk-EONDCWY4.js} +1 -1
  92. package/dist/cli/chunks/{chunk-ZJH5MU2I.js → chunk-F4AGNKL2.js} +2 -2
  93. package/dist/cli/chunks/{chunk-N7HL5PHH.js → chunk-F6YD3BOW.js} +1 -1
  94. package/dist/cli/chunks/{chunk-5VZL4UVN.js → chunk-FQRS7WVA.js} +2 -2
  95. package/dist/cli/chunks/{chunk-SHKOCGNK.js → chunk-FT24SSDG.js} +2 -2
  96. package/dist/cli/chunks/chunk-FV4YNSAJ.js +5 -0
  97. package/dist/cli/chunks/{chunk-KXCLACFG.js → chunk-FVDM3X42.js} +2 -2
  98. package/dist/cli/chunks/{chunk-32BPDLRZ.js → chunk-FVH7TXWU.js} +2 -2
  99. package/dist/cli/chunks/{chunk-72XSEQMW.js → chunk-FWR5QY37.js} +2 -2
  100. package/dist/cli/chunks/chunk-FYINK2B7.js +6 -0
  101. package/dist/cli/chunks/{chunk-5JZRZI4S.js → chunk-GGISVPOZ.js} +2 -2
  102. package/dist/cli/chunks/{chunk-5LAVKGLH.js → chunk-GPIJIZJQ.js} +2 -2
  103. package/dist/cli/chunks/{chunk-5QO3R3TU.js → chunk-GXEVOT5F.js} +2 -2
  104. package/dist/cli/chunks/{chunk-IHRXZZQM.js → chunk-GZ4VB5RI.js} +1 -1
  105. package/dist/cli/chunks/chunk-HBDSCYSK.js +2 -0
  106. package/dist/cli/chunks/{chunk-GSKMOPL7.js → chunk-HGG4HR7C.js} +2 -2
  107. package/dist/cli/chunks/{chunk-AR67RJPY.js → chunk-HSCKWWO2.js} +2 -2
  108. package/dist/cli/chunks/{chunk-6XXZDV2C.js → chunk-HSQ3GUYJ.js} +2 -2
  109. package/dist/cli/chunks/{chunk-AAMLQ2LF.js → chunk-HZQBW5EM.js} +3 -3
  110. package/dist/cli/chunks/{chunk-O5W3FIO6.js → chunk-IGIYANVT.js} +2 -2
  111. package/dist/cli/chunks/{chunk-C6D5AHBO.js → chunk-IPWMSXBF.js} +2 -2
  112. package/dist/cli/chunks/{chunk-NDJ7P2EP.js → chunk-IWVNC7VY.js} +1 -1
  113. package/dist/cli/chunks/{chunk-FDDC72IA.js → chunk-IZODXKZD.js} +2 -2
  114. package/dist/cli/chunks/{chunk-NO3IV5Q5.js → chunk-J2MT2OJV.js} +1 -1
  115. package/dist/cli/chunks/{chunk-GQ6TUIKY.js → chunk-JKIJVVSP.js} +1 -1
  116. package/dist/cli/chunks/{chunk-LE4QJREF.js → chunk-JMRDT2XK.js} +1 -1
  117. package/dist/cli/chunks/{chunk-2YZ4G6NW.js → chunk-JR2UMTKG.js} +1 -1
  118. package/dist/cli/chunks/{chunk-RJIEG3NA.js → chunk-K6CH4CFF.js} +2 -2
  119. package/dist/cli/chunks/{chunk-5NNNEWLS.js → chunk-K7KW5QB5.js} +81 -88
  120. package/dist/cli/chunks/chunk-KFCQP434.js +2 -0
  121. package/dist/cli/chunks/{chunk-A5GBXCP5.js → chunk-KH4T6STG.js} +2 -2
  122. package/dist/cli/chunks/{chunk-VMDFFTCK.js → chunk-KJBYZO57.js} +1 -1
  123. package/dist/cli/chunks/{chunk-GJYHWYXR.js → chunk-KP4OKOKV.js} +2 -2
  124. package/dist/cli/chunks/chunk-L2MBKVSE.js +2 -0
  125. package/dist/cli/chunks/{chunk-XIQW7EFL.js → chunk-L3IPUIT3.js} +2 -2
  126. package/dist/cli/chunks/{chunk-W5HQUIML.js → chunk-L7PSU2YN.js} +2 -2
  127. package/dist/cli/chunks/{chunk-6DPYNAOK.js → chunk-LA3JPGQA.js} +2 -2
  128. package/dist/cli/chunks/{chunk-5PBLPQ5T.js → chunk-LC2QRN7V.js} +14 -13
  129. package/dist/cli/chunks/{chunk-SSYAQZXA.js → chunk-LHY7TMTM.js} +2 -2
  130. package/dist/cli/chunks/{chunk-QQWBWEJS.js → chunk-LLQ2UMF6.js} +3 -3
  131. package/dist/cli/chunks/{chunk-DTMAS2GB.js → chunk-LOJ7OO6W.js} +2 -2
  132. package/dist/cli/chunks/{chunk-32GN3JKR.js → chunk-LPUSH3VF.js} +1 -1
  133. package/dist/cli/chunks/{chunk-SDLWKRVL.js → chunk-LSEC2BU7.js} +2 -2
  134. package/dist/cli/chunks/{chunk-IOKYCMTJ.js → chunk-LTGB7OIU.js} +2 -2
  135. package/dist/cli/chunks/{chunk-6ZBXSOX6.js → chunk-LUG7YNVZ.js} +2 -2
  136. package/dist/cli/chunks/{chunk-CAKMOVZ6.js → chunk-LWAFRYKE.js} +2 -2
  137. package/dist/cli/chunks/{chunk-FLNAW7C4.js → chunk-M24ZAZ4U.js} +2 -2
  138. package/dist/cli/chunks/{chunk-L2DWPVNJ.js → chunk-MKRKRXTX.js} +1 -1
  139. package/dist/cli/chunks/{chunk-YTHTQPWR.js → chunk-MNNLONAD.js} +1 -1
  140. package/dist/cli/chunks/{chunk-V5NHZV7S.js → chunk-MQM37KAR.js} +2 -2
  141. package/dist/cli/chunks/{chunk-PPUZWYUG.js → chunk-MSX2OHYT.js} +2 -2
  142. package/dist/cli/chunks/{chunk-YRAX7SFJ.js → chunk-MVYQRVLP.js} +2 -2
  143. package/dist/cli/chunks/{chunk-QVDCVD5D.js → chunk-MZC5WM2P.js} +2 -2
  144. package/dist/cli/chunks/{chunk-S75SOOZL.js → chunk-MZRBNBB3.js} +2 -2
  145. package/dist/cli/chunks/{chunk-FL64OUBA.js → chunk-N3KQU4UC.js} +2 -2
  146. package/dist/cli/chunks/{chunk-G5RHFBAY.js → chunk-NKU3FFM4.js} +2 -2
  147. package/dist/cli/chunks/chunk-O5EWFR76.js +2 -0
  148. package/dist/cli/chunks/{chunk-63ZKI4PX.js → chunk-O5RDHD5T.js} +2 -2
  149. package/dist/cli/chunks/chunk-O6UWIXME.js +3 -0
  150. package/dist/cli/chunks/{chunk-HCH4Y6XX.js → chunk-OA4EQDC4.js} +2 -2
  151. package/dist/cli/chunks/{chunk-QPEOLAAS.js → chunk-OBCXCRXK.js} +1 -1
  152. package/dist/cli/chunks/{chunk-6ICX3FEG.js → chunk-OHU5P25N.js} +22 -22
  153. package/dist/cli/chunks/{chunk-GFWHUQSF.js → chunk-OOSV2RIA.js} +2 -2
  154. package/dist/cli/chunks/{chunk-MO55CVMT.js → chunk-OW23N2Y5.js} +14 -14
  155. package/dist/cli/chunks/{chunk-M7WJCTG3.js → chunk-OXOO3YDL.js} +2 -2
  156. package/dist/cli/chunks/{chunk-KQYJ4VQ5.js → chunk-OYGKSSSI.js} +1 -1
  157. package/dist/cli/chunks/chunk-PGO46IIW.js +2 -0
  158. package/dist/cli/chunks/{chunk-NVEWF4JV.js → chunk-PZOYQHWS.js} +1 -1
  159. package/dist/cli/chunks/{chunk-IESR7TNB.js → chunk-Q2BZSG7Z.js} +2 -2
  160. package/dist/cli/chunks/{chunk-XIIQ5QTT.js → chunk-Q7V722K5.js} +2 -2
  161. package/dist/cli/chunks/{chunk-F742SZAX.js → chunk-QZU6M5IO.js} +2 -2
  162. package/dist/cli/chunks/{chunk-PINSJCM3.js → chunk-R55Y76SJ.js} +1 -1
  163. package/dist/cli/chunks/{chunk-5B5QPCNU.js → chunk-RMEQYJPU.js} +4 -4
  164. package/dist/cli/chunks/{chunk-ZQ2XW3IP.js → chunk-RTYXFXTI.js} +2 -2
  165. package/dist/cli/chunks/{chunk-DVYHMDFR.js → chunk-SJF3O4FX.js} +374 -371
  166. package/dist/cli/chunks/{chunk-AG2EWGXS.js → chunk-SOUS7Z2H.js} +2 -2
  167. package/dist/cli/chunks/{chunk-3HD7E6HN.js → chunk-SRVNR3R3.js} +2 -2
  168. package/dist/cli/chunks/{chunk-KITOPKRG.js → chunk-SU3SXMVG.js} +2 -2
  169. package/dist/cli/chunks/chunk-SWGPLXWW.js +32 -0
  170. package/dist/cli/chunks/{chunk-ZR2TKVXQ.js → chunk-TRB3EVH3.js} +2 -2
  171. package/dist/cli/chunks/{chunk-OCV2XEWQ.js → chunk-TVBDUMKT.js} +2 -2
  172. package/dist/cli/chunks/{chunk-IOQ6ZQ5W.js → chunk-TWTXPSFU.js} +1 -1
  173. package/dist/cli/chunks/{chunk-CJSHWQXP.js → chunk-ULYUVUL2.js} +2 -2
  174. package/dist/cli/chunks/{chunk-PHT5N7SC.js → chunk-UNTBVJ5X.js} +2 -2
  175. package/dist/cli/chunks/{chunk-LKTTUHLF.js → chunk-UQAA4PHU.js} +2 -2
  176. package/dist/cli/chunks/{chunk-SR52XP5F.js → chunk-UWSJVKTE.js} +1 -1
  177. package/dist/cli/chunks/{chunk-L6QSTQME.js → chunk-V2LJ54KP.js} +2 -2
  178. package/dist/cli/chunks/{chunk-FBDVGRSC.js → chunk-VCCTTKP3.js} +7 -7
  179. package/dist/cli/chunks/{chunk-YLMNVLDK.js → chunk-VEGUYUVS.js} +1 -1
  180. package/dist/cli/chunks/{chunk-ASEOFRIG.js → chunk-VUQPVWNK.js} +2 -2
  181. package/dist/cli/chunks/{chunk-VXFLJNCA.js → chunk-VVGUE2T2.js} +2 -2
  182. package/dist/cli/chunks/{chunk-4NFQLP6R.js → chunk-W5ASDHJQ.js} +1 -1
  183. package/dist/cli/chunks/{chunk-I7MQIM2U.js → chunk-WGXT5NWQ.js} +1 -1
  184. package/dist/cli/chunks/chunk-WJN3V7QB.js +7 -0
  185. package/dist/cli/chunks/chunk-WPCRQIIF.js +29 -0
  186. package/dist/cli/chunks/{chunk-SASBO5Y5.js → chunk-WQNLXUWA.js} +6 -6
  187. package/dist/cli/chunks/{chunk-5SPCGMBB.js → chunk-WZVRMKG2.js} +2 -2
  188. package/dist/cli/chunks/{chunk-MI5MFHRA.js → chunk-X27IUWTD.js} +2 -2
  189. package/dist/cli/chunks/{chunk-HJ6ZGVTB.js → chunk-X4B345B6.js} +2 -2
  190. package/dist/cli/chunks/{chunk-HVRRLYX6.js → chunk-X5I2Y4VO.js} +2 -2
  191. package/dist/cli/chunks/{chunk-SUDMM5SO.js → chunk-X7IQIFTS.js} +2 -2
  192. package/dist/cli/chunks/chunk-XJN3RKUD.js +3 -0
  193. package/dist/cli/chunks/{chunk-E3D4GPLP.js → chunk-XQMGXTHJ.js} +3 -3
  194. package/dist/cli/chunks/{chunk-67Z5R7RJ.js → chunk-XTSAMB2Q.js} +2 -2
  195. package/dist/cli/chunks/{chunk-KVF4NXGQ.js → chunk-XZLIF4O2.js} +2 -2
  196. package/dist/cli/chunks/{chunk-EA4YQVKS.js → chunk-Y4LSEOZ3.js} +1 -1
  197. package/dist/cli/chunks/{chunk-OAEE6JWQ.js → chunk-Y4YN2RXR.js} +2 -2
  198. package/dist/cli/chunks/{chunk-CEYSYSK5.js → chunk-YDI56L35.js} +2 -2
  199. package/dist/cli/chunks/{chunk-JDIYMZCQ.js → chunk-YFILS5D5.js} +2 -2
  200. package/dist/cli/chunks/{chunk-GAHNO6JJ.js → chunk-YISDX6WB.js} +2 -2
  201. package/dist/cli/chunks/{chunk-AGRV5B3T.js → chunk-YP2GHQSV.js} +2 -2
  202. package/dist/cli/chunks/{chunk-UNGBRZDK.js → chunk-YSX756AM.js} +4 -4
  203. package/dist/cli/chunks/{chunk-BEKDKVQT.js → chunk-YWANOASW.js} +2 -2
  204. package/dist/cli/chunks/{chunk-JQ3DYUMS.js → chunk-YYIJLG7S.js} +2 -2
  205. package/dist/cli/chunks/{chunk-CRPIYUTJ.js → chunk-Z7SD7LXM.js} +2 -2
  206. package/dist/cli/chunks/{chunk-U2A7NHZA.js → chunk-ZDWD73UF.js} +2 -2
  207. package/dist/cli/chunks/{chunk-WP4RETKG.js → chunk-ZFT3RLA4.js} +2 -2
  208. package/dist/cli/chunks/{chunk-VJCIEHEF.js → chunk-ZNTHX5G3.js} +1 -1
  209. package/dist/cli/chunks/{chunk-PF7RBAYL.js → chunk-ZS27R7VL.js} +2 -2
  210. package/dist/cli/chunks/{chunk-24OX5TQJ.js → chunk-ZXHHHR7K.js} +1 -1
  211. package/dist/cli/chunks/{ci-MFUR4CWV.js → ci-N5MOMNXH.js} +2 -2
  212. package/dist/cli/chunks/{ci-config-PNDLQ6XV.js → ci-config-6L2ROQCW.js} +2 -2
  213. package/dist/cli/chunks/{ci-output-PFZ4M7NC.js → ci-output-DSRBYEIK.js} +2 -2
  214. package/dist/cli/chunks/{circuit-breaker-5HH6NLZN.js → circuit-breaker-VRPTNBL7.js} +2 -2
  215. package/dist/cli/chunks/{claude-flow-setup-QCKYLGLC.js → claude-flow-setup-4YFG3FU5.js} +2 -2
  216. package/dist/cli/chunks/client-I3L6BKRQ.js +2 -0
  217. package/dist/cli/chunks/{cline-installer-EASVPFXR.js → cline-installer-7RGYJWGN.js} +2 -2
  218. package/dist/cli/chunks/{code-UJXDVYRK.js → code-ISC6NW2K.js} +3 -3
  219. package/dist/cli/chunks/{code-index-extractor-BZJ3UDP4.js → code-index-extractor-2FID75YV.js} +2 -2
  220. package/dist/cli/chunks/{codex-installer-XSQZUVOZ.js → codex-installer-DZ7OG6KM.js} +2 -2
  221. package/dist/cli/chunks/{completions-OWOOJFI2.js → completions-SM3LICWK.js} +2 -2
  222. package/dist/cli/chunks/{complexity-analyzer-KP5TOHDT.js → complexity-analyzer-ZWD2CTAD.js} +2 -2
  223. package/dist/cli/chunks/{continuedev-installer-IFKQXLHM.js → continuedev-installer-AGASOA26.js} +2 -2
  224. package/dist/cli/chunks/copilot-installer-CLPZYTQC.js +3 -0
  225. package/dist/cli/chunks/core-handlers-5EFOJ37H.js +2 -0
  226. package/dist/cli/chunks/{cost-tracker-MMDDNKZB.js → cost-tracker-7PIGQYDV.js} +2 -2
  227. package/dist/cli/chunks/{coverage-LUH2B7NT.js → coverage-T2GEBTYS.js} +9 -9
  228. package/dist/cli/chunks/cross-domain-router-65WJAKVD.js +2 -0
  229. package/dist/cli/chunks/{cursor-installer-4YLM5GWM.js → cursor-installer-KXBID4MB.js} +2 -2
  230. package/dist/cli/chunks/daemon-43MXIVH3.js +18 -0
  231. package/dist/cli/chunks/{daemon-MZKVM4CJ.js → daemon-VAMJLQJ5.js} +3 -3
  232. package/dist/cli/chunks/{dag-attention-scheduler-X4CYW665.js → dag-attention-scheduler-UBP4VHTA.js} +2 -2
  233. package/dist/cli/chunks/{detect-7BM2XINO.js → detect-QWFIQRKI.js} +2 -2
  234. package/dist/cli/chunks/{dist-node-Y5APLEYB.js → dist-node-I2GICS3W.js} +2 -2
  235. package/dist/cli/chunks/{domain-handler-X3ZRJNAH.js → domain-handler-Z66ISB2A.js} +2 -2
  236. package/dist/cli/chunks/{domain-plugins-2UW5KQJB.js → domain-plugins-KHMD3FKT.js} +2 -2
  237. package/dist/cli/chunks/{domain-transfer-35W4CIBV.js → domain-transfer-JWGNNA6K.js} +2 -2
  238. package/dist/cli/chunks/dream-VQ2PZCVR.js +2 -0
  239. package/dist/cli/chunks/embed-and-insert-pattern-F5P5B6JX.js +3 -0
  240. package/dist/cli/chunks/{embedding-space-SBM2MZD2.js → embedding-space-KHG6TITM.js} +2 -2
  241. package/dist/cli/chunks/{eval-4QA2SROK.js → eval-43OHU7EI.js} +2 -2
  242. package/dist/cli/chunks/{experience-capture-middleware-Z6BF6KYM.js → experience-capture-middleware-KXD47H6P.js} +3 -3
  243. package/dist/cli/chunks/{fast-paths-FIORX6GN.js → fast-paths-6D75D5KD.js} +2 -2
  244. package/dist/cli/chunks/{feature-flags-6LYI2T4G.js → feature-flags-IE35Y55N.js} +2 -2
  245. package/dist/cli/chunks/{feature-flags-ZOO7LMIC.js → feature-flags-OYYHY7LS.js} +2 -2
  246. package/dist/cli/chunks/file-discovery-LGBTY3ID.js +2 -0
  247. package/dist/cli/chunks/{fleet-7WF53H4F.js → fleet-AGVJMFGD.js} +16 -16
  248. package/dist/cli/chunks/{gnn-wrapper-KJ6B7BRM.js → gnn-wrapper-5L66A7LW.js} +2 -2
  249. package/dist/cli/chunks/{heartbeat-handler-DEKKMOVW.js → heartbeat-handler-2BY6YYOT.js} +5 -5
  250. package/dist/cli/chunks/heartbeat-scheduler-3DU3M5AT.js +2 -0
  251. package/dist/cli/chunks/hnsw-adapter-N2IMSRPV.js +2 -0
  252. package/dist/cli/chunks/hnsw-index-DVU7TTJE.js +2 -0
  253. package/dist/cli/chunks/{hnsw-legacy-bridge-L27WS27N.js → hnsw-legacy-bridge-RYMWFNAH.js} +2 -2
  254. package/dist/cli/chunks/{hnswlib-node-4YOQC6L4.js → hnswlib-node-GG47HP2P.js} +2 -2
  255. package/dist/cli/chunks/{hooks-TAOKV4EJ.js → hooks-FQNACS24.js} +10 -10
  256. package/dist/cli/chunks/hybrid-backend-AS2PNHOD.js +2 -0
  257. package/dist/cli/chunks/{hypergraph-engine-BODRJLHL.js → hypergraph-engine-6BYNJQEP.js} +2 -2
  258. package/dist/cli/chunks/{hypergraph-handler-RKMYJNTU.js → hypergraph-handler-CYTAXZKJ.js} +3 -3
  259. package/dist/cli/chunks/impact-analyzer-Y4OONLFP.js +2 -0
  260. package/dist/cli/chunks/{init-guard-MXHSLSB2.js → init-guard-METTAV5O.js} +2 -2
  261. package/dist/cli/chunks/{init-handler-HUE57IFW.js → init-handler-GFT74U5Y.js} +6 -6
  262. package/dist/cli/chunks/init-wizard-HLNUBJQN.js +2 -0
  263. package/dist/cli/chunks/kernel-XKFWCL7Y.js +2 -0
  264. package/dist/cli/chunks/{kilocode-installer-S333IKYQ.js → kilocode-installer-GZV2D3FF.js} +2 -2
  265. package/dist/cli/chunks/{kiro-installer-WM5DLQWC.js → kiro-installer-Q4ZXUFC7.js} +2 -2
  266. package/dist/cli/chunks/knowledge-graph-CNL77CSZ.js +2 -0
  267. package/dist/cli/chunks/{learning-LNHMQLH5.js → learning-WA2QEYL7.js} +35 -34
  268. package/dist/cli/chunks/{llm-router-EWFXYZZR.js → llm-router-GRTCHWH7.js} +4 -4
  269. package/dist/cli/chunks/llm-router-service-UIYTYKP6.js +2 -0
  270. package/dist/cli/chunks/{load-FGYGWVDK.js → load-WXN3Q7Y5.js} +2 -2
  271. package/dist/cli/chunks/load-test-PXLW4A5B.js +2 -0
  272. package/dist/cli/chunks/{mcp-2FHNAAOM.js → mcp-LIQCPSJN.js} +2 -2
  273. package/dist/cli/chunks/{memory-DZMQ73AB.js → memory-OP6CHRFH.js} +5 -5
  274. package/dist/cli/chunks/memory-backend-XYOSO73Q.js +2 -0
  275. package/dist/cli/chunks/memory-handlers-PQFYVNVG.js +2 -0
  276. package/dist/cli/chunks/{multi-model-executor-6F2UAEUW.js → multi-model-executor-H54DEVRZ.js} +2 -2
  277. package/dist/cli/chunks/{opencode-installer-XY3BGOTZ.js → opencode-installer-BSQV6UAT.js} +2 -2
  278. package/dist/cli/chunks/{orchestrator-B4CNKUOS.js → orchestrator-TJDPQ4VL.js} +122 -35
  279. package/dist/cli/chunks/pattern-null-store-BKGTQFNF.js +2 -0
  280. package/dist/cli/chunks/{pattern-usage-recorder-R4GUFNMD.js → pattern-usage-recorder-FOVS4M5L.js} +2 -2
  281. package/dist/cli/chunks/{pipeline-FG5RKVRO.js → pipeline-4AY2ZIC6.js} +2 -2
  282. package/dist/cli/chunks/{platform-3BT4KEVJ.js → platform-FCSITYMR.js} +2 -2
  283. package/dist/cli/chunks/{plugin-WI4RIN7O.js → plugin-E56TV5S2.js} +2 -2
  284. package/dist/cli/chunks/{prime-radiant-advanced-wasm-7ECDNQFS.js → prime-radiant-advanced-wasm-ACOPC533.js} +2 -2
  285. package/dist/cli/chunks/project-root-MPX7CN2C.js +2 -0
  286. package/dist/cli/chunks/protocol-executor-CRQOCC4A.js +2 -0
  287. package/dist/cli/chunks/{protocol-handler-WNODKPGW.js → protocol-handler-KRVXF4LS.js} +2 -2
  288. package/dist/cli/chunks/{prove-5RHAEPYZ.js → prove-KMFPSKGD.js} +2 -2
  289. package/dist/cli/chunks/qe-reasoning-bank-UEGQ3O7F.js +2 -0
  290. package/dist/cli/chunks/{quality-WPHR7BGQ.js → quality-6DBI3HLB.js} +2 -2
  291. package/dist/cli/chunks/{quality-gate-4RKTEZMX.js → quality-gate-3ROZMEIL.js} +3 -3
  292. package/dist/cli/chunks/queen-coordinator-32574XSG.js +2 -0
  293. package/dist/cli/chunks/real-embeddings-MIGZNKK3.js +2 -0
  294. package/dist/cli/chunks/{ref-validation-TPAWHOHH.js → ref-validation-EYIP7DHW.js} +2 -2
  295. package/dist/cli/chunks/{roocode-installer-7AVHFNDI.js → roocode-installer-IGGZHR2Y.js} +2 -2
  296. package/dist/cli/chunks/router-CZJY5WX6.js +2 -0
  297. package/dist/cli/chunks/routing-feedback-RC3UBNFX.js +2 -0
  298. package/dist/cli/chunks/{routing-handler-YKEDVJSH.js → routing-handler-BWNHBYDC.js} +2 -2
  299. package/dist/cli/chunks/{ruvector-commands-JUAMM354.js → ruvector-commands-PXIHF432.js} +2 -2
  300. package/dist/cli/chunks/rvf-dual-writer-OG7OV2AK.js +2 -0
  301. package/dist/cli/chunks/rvf-migration-adapter-THYMW7ZO.js +2 -0
  302. package/dist/cli/chunks/rvf-migration-coordinator-3H6CLFU7.js +2 -0
  303. package/dist/cli/chunks/rvf-native-adapter-6JQJIKKW.js +2 -0
  304. package/dist/cli/chunks/{rvf-store-integrity-VJDUIRTX.js → rvf-store-integrity-CVB3NMSL.js} +2 -2
  305. package/dist/cli/chunks/safe-db-QFKCVTIJ.js +2 -0
  306. package/dist/cli/chunks/schedule-6JLVMMYB.js +2 -0
  307. package/dist/cli/chunks/scheduler-3MPZRMJD.js +2 -0
  308. package/dist/cli/chunks/{security-ORDN3RD2.js → security-DCRGOTWU.js} +3 -3
  309. package/dist/cli/chunks/{shared-rvf-adapter-CF4BCIO7.js → shared-rvf-adapter-GKD74QUB.js} +2 -2
  310. package/dist/cli/chunks/{shared-rvf-dual-writer-C32UBR6D.js → shared-rvf-dual-writer-HVAAVEOH.js} +2 -2
  311. package/dist/cli/chunks/sqlite-persistence-LGTIKAEX.js +2 -0
  312. package/dist/cli/chunks/{standalone-memory-OXRJYZXN.js → standalone-memory-O7O2U5N4.js} +2 -2
  313. package/dist/cli/chunks/{status-handler-BCX5D4HY.js → status-handler-BQTPJJTL.js} +2 -2
  314. package/dist/cli/chunks/{structural-health-LFG7RUU6.js → structural-health-4H6J4OHK.js} +2 -2
  315. package/dist/cli/chunks/sync-DJ4TF6QX.js +2 -0
  316. package/dist/cli/chunks/{sync-YJEE2K2L.js → sync-WW5TAVYW.js} +2 -2
  317. package/dist/cli/chunks/{task-handler-6LXKPTXJ.js → task-handler-HEM4IEOW.js} +2 -2
  318. package/dist/cli/chunks/{task-handlers-CILP36I7.js → task-handlers-JRA3NXIR.js} +3 -3
  319. package/dist/cli/chunks/test-772ZXVG2.js +34 -0
  320. package/dist/cli/chunks/test-runner-process-XGF2U3NG.js +2 -0
  321. package/dist/cli/chunks/{test-scheduling-ISI2O4Q5.js → test-scheduling-4TRB7LZ7.js} +3 -3
  322. package/dist/cli/chunks/token-bootstrap-CICBIJ7T.js +2 -0
  323. package/dist/cli/chunks/{token-usage-XOC5KG7S.js → token-usage-B7PEKE2G.js} +2 -2
  324. package/dist/cli/chunks/{transformers-LSLQAARK.js → transformers-V7X7BDZX.js} +2 -2
  325. package/dist/cli/chunks/tree-sitter-wasm-parser-OXPFKFZS.js +2 -0
  326. package/dist/cli/chunks/{types-5BLCGLCR.js → types-AHHTUY3I.js} +2 -2
  327. package/dist/cli/chunks/unified-memory-GUR3IUI6.js +2 -0
  328. package/dist/cli/chunks/unified-memory-hnsw-NJP2F2RY.js +2 -0
  329. package/dist/cli/chunks/unified-persistence-NILBWXDP.js +2 -0
  330. package/dist/cli/chunks/{upgrade-RQJYLK3J.js → upgrade-DZ4DLUQ5.js} +2 -2
  331. package/dist/cli/chunks/{validate-QBHWXXCK.js → validate-4DTLIDJE.js} +2 -2
  332. package/dist/cli/chunks/{validate-swarm-IKXBKFB5.js → validate-swarm-A26UFVIS.js} +2 -2
  333. package/dist/cli/chunks/visual-security-YECYZ27X.js +2 -0
  334. package/dist/cli/chunks/{web-tree-sitter-ZF6FIE5R.js → web-tree-sitter-F2C7QRYT.js} +2 -2
  335. package/dist/cli/chunks/{windsurf-installer-HQGDZT5D.js → windsurf-installer-OOBTDA6W.js} +2 -2
  336. package/dist/cli/chunks/{witness-chain-DCHCAMSQ.js → witness-chain-KGFZJP32.js} +2 -2
  337. package/dist/cli/chunks/witness-chain-LYBXFLJB.js +2 -0
  338. package/dist/cli/chunks/witness-chain-repair-CNTXOGPN.js +2 -0
  339. package/dist/cli/chunks/{witness-chain-verifier-PX2OQ6XT.js → witness-chain-verifier-OB7ZZOI3.js} +2 -2
  340. package/dist/cli/chunks/{witness-key-manager-RXYQNFJB.js → witness-key-manager-YCKGKGQI.js} +2 -2
  341. package/dist/cli/chunks/{workflow-FBKCA4H6.js → workflow-PRERHWKY.js} +4 -4
  342. package/dist/cli/chunks/workflow-orchestrator-UIBGWCU3.js +2 -0
  343. package/dist/cli/chunks/wrappers-L4UY4V63.js +2 -0
  344. package/dist/cli/commands/coverage.js +4 -1
  345. package/dist/cli/commands/learning-prune.js +9 -1
  346. package/dist/cli/commands/test.js +26 -4
  347. package/dist/cli/handlers/brain-handler.js +32 -2
  348. package/dist/cli/handlers/heartbeat-handler.js +3 -1
  349. package/dist/cli/utils/coverage-data.js +5 -1
  350. package/dist/cli/utils/coverage-verdict.d.ts +10 -2
  351. package/dist/cli/utils/coverage-verdict.js +23 -8
  352. package/dist/cli/utils/fleet-operation.js +9 -3
  353. package/dist/coordination/handlers/code-intelligence-handlers.js +17 -3
  354. package/dist/coordination/handlers/coverage-handlers.js +22 -9
  355. package/dist/coordination/handlers/coverage-target.d.ts +22 -2
  356. package/dist/coordination/handlers/coverage-target.js +45 -9
  357. package/dist/coordination/handlers/handler-utils.d.ts +19 -0
  358. package/dist/coordination/handlers/handler-utils.js +22 -8
  359. package/dist/coordination/handlers/test-execution-handlers.js +64 -20
  360. package/dist/coordination/protocols/code-intelligence-index.js +6 -3
  361. package/dist/coordination/protocols/learning-consolidation-archive.d.ts +6 -3
  362. package/dist/coordination/protocols/learning-consolidation-archive.js +4 -3
  363. package/dist/coordination/workflow-builtin.js +1 -0
  364. package/dist/domains/code-intelligence/services/semantic-analyzer.d.ts +8 -3
  365. package/dist/domains/code-intelligence/services/semantic-analyzer.js +39 -25
  366. package/dist/domains/code-intelligence/services/text-relevance.d.ts +32 -0
  367. package/dist/domains/code-intelligence/services/text-relevance.js +63 -0
  368. package/dist/domains/defect-intelligence/interfaces.d.ts +2 -0
  369. package/dist/domains/defect-intelligence/prediction-history.d.ts +15 -1
  370. package/dist/domains/defect-intelligence/prediction-history.js +63 -7
  371. package/dist/domains/defect-intelligence/services/defect-predictor.d.ts +1 -0
  372. package/dist/domains/defect-intelligence/services/defect-predictor.js +33 -13
  373. package/dist/domains/learning-optimization/coordinator.js +17 -10
  374. package/dist/domains/learning-optimization/domain-ranking.d.ts +26 -0
  375. package/dist/domains/learning-optimization/domain-ranking.js +28 -0
  376. package/dist/domains/learning-optimization/interfaces.d.ts +5 -0
  377. package/dist/domains/learning-optimization/pattern-archive.d.ts +55 -8
  378. package/dist/domains/learning-optimization/pattern-archive.js +90 -17
  379. package/dist/domains/learning-optimization/pattern-consolidation.js +18 -2
  380. package/dist/domains/learning-optimization/pattern-merge.d.ts +26 -0
  381. package/dist/domains/learning-optimization/pattern-merge.js +127 -0
  382. package/dist/domains/learning-optimization/services/learning-coordinator.js +21 -35
  383. package/dist/domains/test-execution/coordinator.d.ts +3 -1
  384. package/dist/domains/test-execution/coordinator.js +13 -4
  385. package/dist/domains/test-execution/interfaces.d.ts +5 -0
  386. package/dist/domains/test-execution/plugin.js +2 -0
  387. package/dist/domains/test-execution/services/flaky-detector.d.ts +9 -1
  388. package/dist/domains/test-execution/services/flaky-detector.js +26 -8
  389. package/dist/domains/test-execution/services/retry-handler.d.ts +7 -1
  390. package/dist/domains/test-execution/services/retry-handler.js +44 -5
  391. package/dist/domains/test-execution/services/runner-test-cases.d.ts +2 -0
  392. package/dist/domains/test-execution/services/runner-test-cases.js +7 -3
  393. package/dist/domains/test-execution/services/test-executor.d.ts +5 -1
  394. package/dist/domains/test-execution/services/test-executor.js +85 -17
  395. package/dist/init/copilot-installer.d.ts +6 -0
  396. package/dist/init/copilot-installer.js +37 -17
  397. package/dist/init/init-wizard-steps.js +3 -1
  398. package/dist/init/phases/07-hooks.js +97 -10
  399. package/dist/init/platform-config-generator.d.ts +10 -0
  400. package/dist/init/platform-config-generator.js +26 -1
  401. package/dist/integrations/embeddings/cache/EmbeddingCache.js +1 -1
  402. package/dist/integrations/ruvector/brain-rvf-exporter.d.ts +16 -1
  403. package/dist/integrations/ruvector/brain-rvf-exporter.js +18 -32
  404. package/dist/integrations/ruvector/brain-rvf-richness.d.ts +75 -0
  405. package/dist/integrations/ruvector/brain-rvf-richness.js +127 -0
  406. package/dist/kernel/unified-memory-migration.js +1 -1
  407. package/dist/kernel/unified-memory.d.ts +8 -0
  408. package/dist/kernel/unified-memory.js +13 -0
  409. package/dist/learning/checkpoint-shrink-ack.d.ts +25 -0
  410. package/dist/learning/checkpoint-shrink-ack.js +57 -0
  411. package/dist/learning/dream/dream-engine.d.ts +44 -3
  412. package/dist/learning/dream/dream-engine.js +6 -2
  413. package/dist/learning/embedder-endpoint-client.d.ts +45 -0
  414. package/dist/learning/embedder-endpoint-client.js +98 -3
  415. package/dist/learning/embedder-identity-store.js +3 -1
  416. package/dist/learning/embedding-space-legacy-adoption.d.ts +53 -0
  417. package/dist/learning/embedding-space-legacy-adoption.js +115 -0
  418. package/dist/learning/embedding-space-registry.d.ts +90 -0
  419. package/dist/learning/embedding-space-registry.js +181 -0
  420. package/dist/learning/experience-capture.d.ts +3 -1
  421. package/dist/learning/experience-capture.js +15 -5
  422. package/dist/learning/experience-space-verification.d.ts +2 -0
  423. package/dist/learning/experience-space-verification.js +3 -2
  424. package/dist/learning/learning-retention.js +4 -0
  425. package/dist/learning/pattern-promotion.d.ts +7 -0
  426. package/dist/learning/pattern-promotion.js +64 -12
  427. package/dist/learning/real-embeddings.d.ts +3 -0
  428. package/dist/learning/real-embeddings.js +73 -11
  429. package/dist/learning/rvf-pattern-store.js +6 -1
  430. package/dist/mcp/bundle.js +558 -537
  431. package/dist/mcp/handlers/domain-handler-configs.d.ts +3 -0
  432. package/dist/mcp/handlers/domain-handler-configs.js +1 -0
  433. package/dist/mcp/handlers/heartbeat-handlers.d.ts +4 -2
  434. package/dist/mcp/protocol-server.js +1 -1
  435. package/dist/mcp/tools/learning-optimization/optimize.d.ts +6 -1
  436. package/dist/mcp/tools/learning-optimization/optimize.js +20 -11
  437. package/dist/planning/goap-planner.js +4 -0
  438. package/dist/planning/plan-executor.js +6 -2
  439. package/dist/shared/embeddings/index.d.ts +2 -2
  440. package/dist/shared/embeddings/index.js +1 -1
  441. package/dist/shared/embeddings/nomic-embedder.d.ts +8 -2
  442. package/dist/shared/embeddings/nomic-embedder.js +19 -11
  443. package/dist/shared/embeddings/ollama-client.d.ts +28 -2
  444. package/dist/shared/embeddings/ollama-client.js +84 -22
  445. package/dist/shared/embeddings/types.d.ts +15 -0
  446. package/dist/shared/embeddings/types.js +4 -0
  447. package/dist/shared/git/git-analyzer.d.ts +30 -11
  448. package/dist/shared/git/git-analyzer.js +95 -48
  449. package/dist/shared/io/confined-read.d.ts +32 -7
  450. package/dist/shared/io/confined-read.js +58 -25
  451. package/dist/shared/io/file-reader.js +4 -1
  452. package/dist/shared/pytest-junit-report.d.ts +93 -0
  453. package/dist/shared/pytest-junit-report.js +241 -0
  454. package/dist/shared/safe-db.d.ts +1 -1
  455. package/dist/shared/safe-db.js +20 -5
  456. package/dist/shared/sqlite-journal-mode.d.ts +39 -0
  457. package/dist/shared/sqlite-journal-mode.js +53 -0
  458. package/dist/shared/test-runner-project.d.ts +51 -1
  459. package/dist/shared/test-runner-project.js +140 -25
  460. package/dist/sync/claude-flow-bridge.js +1 -1
  461. package/dist/sync/readers/sqlite-reader.js +3 -4
  462. package/dist/sync/writers/sqlite-writer.js +1 -1
  463. package/dist/workers/interfaces.d.ts +2 -2
  464. package/dist/workers/quality-daemon/git-watcher.d.ts +8 -0
  465. package/dist/workers/quality-daemon/git-watcher.js +54 -12
  466. package/dist/workers/quality-daemon/index.js +1 -1
  467. package/dist/workers/quality-daemon/priority-queue.d.ts +2 -1
  468. package/dist/workers/workers/defect-predictor.d.ts +9 -4
  469. package/dist/workers/workers/defect-predictor.js +98 -37
  470. package/package.json +1 -1
  471. package/dist/cli/chunks/adapter-6CQ2PIP5.js +0 -2
  472. package/dist/cli/chunks/aqe-learning-engine-73RR52VS.js +0 -2
  473. package/dist/cli/chunks/base-SMCMMVGP.js +0 -2
  474. package/dist/cli/chunks/brain-handler-HQWZFO52.js +0 -95
  475. package/dist/cli/chunks/browser-workflow-A2MEZ66K.js +0 -2
  476. package/dist/cli/chunks/chunk-CGGUM2YJ.js +0 -3
  477. package/dist/cli/chunks/chunk-D6COXLYE.js +0 -8
  478. package/dist/cli/chunks/chunk-EGYE5UPQ.js +0 -2
  479. package/dist/cli/chunks/chunk-IUBJVHNB.js +0 -3
  480. package/dist/cli/chunks/chunk-KL7OKSU2.js +0 -4
  481. package/dist/cli/chunks/chunk-KPRCB5LT.js +0 -7
  482. package/dist/cli/chunks/chunk-LRSX2FJM.js +0 -2
  483. package/dist/cli/chunks/chunk-M4FRQ4TE.js +0 -12
  484. package/dist/cli/chunks/chunk-MAFQV4U4.js +0 -16
  485. package/dist/cli/chunks/chunk-NZU4ACBZ.js +0 -2
  486. package/dist/cli/chunks/chunk-RV74I3YO.js +0 -3
  487. package/dist/cli/chunks/chunk-SJ6Y4725.js +0 -5
  488. package/dist/cli/chunks/chunk-UE5ZOZR2.js +0 -2
  489. package/dist/cli/chunks/chunk-VSIKHWZ4.js +0 -29
  490. package/dist/cli/chunks/chunk-YAPLJR7K.js +0 -2
  491. package/dist/cli/chunks/client-MHQRTZM4.js +0 -2
  492. package/dist/cli/chunks/copilot-installer-IGJ6KGQY.js +0 -3
  493. package/dist/cli/chunks/core-handlers-UAK3LLJE.js +0 -2
  494. package/dist/cli/chunks/cross-domain-router-WTRZQPNQ.js +0 -2
  495. package/dist/cli/chunks/daemon-CAVZ7OFV.js +0 -18
  496. package/dist/cli/chunks/dream-EJY24JN6.js +0 -2
  497. package/dist/cli/chunks/embed-and-insert-pattern-COG4C7ZI.js +0 -3
  498. package/dist/cli/chunks/file-discovery-UZSFSS4V.js +0 -2
  499. package/dist/cli/chunks/heartbeat-scheduler-NVR356I7.js +0 -2
  500. package/dist/cli/chunks/hnsw-adapter-LFMPLUJU.js +0 -2
  501. package/dist/cli/chunks/hnsw-index-POCPMVJH.js +0 -2
  502. package/dist/cli/chunks/hybrid-backend-4STAO7CV.js +0 -2
  503. package/dist/cli/chunks/impact-analyzer-3VIIISBQ.js +0 -2
  504. package/dist/cli/chunks/init-wizard-PL6QN6RQ.js +0 -2
  505. package/dist/cli/chunks/kernel-CCDWT7KS.js +0 -2
  506. package/dist/cli/chunks/knowledge-graph-KFOMEN3H.js +0 -2
  507. package/dist/cli/chunks/llm-router-service-7NBE2EX6.js +0 -2
  508. package/dist/cli/chunks/load-test-UNZUWY3F.js +0 -2
  509. package/dist/cli/chunks/memory-backend-DFGKWA2Q.js +0 -2
  510. package/dist/cli/chunks/memory-handlers-MP426XRJ.js +0 -2
  511. package/dist/cli/chunks/pattern-null-store-SSVF5TE5.js +0 -2
  512. package/dist/cli/chunks/project-root-BEANNYWU.js +0 -2
  513. package/dist/cli/chunks/protocol-executor-FQVIHXZ7.js +0 -2
  514. package/dist/cli/chunks/qe-reasoning-bank-5TFYSE24.js +0 -2
  515. package/dist/cli/chunks/queen-coordinator-Y2OUL7IN.js +0 -2
  516. package/dist/cli/chunks/real-embeddings-OXLYU7JW.js +0 -2
  517. package/dist/cli/chunks/router-EP34O3KB.js +0 -2
  518. package/dist/cli/chunks/routing-feedback-FJCRKXNG.js +0 -2
  519. package/dist/cli/chunks/rvf-dual-writer-ILITJSFG.js +0 -2
  520. package/dist/cli/chunks/rvf-migration-adapter-XF6W4C2N.js +0 -2
  521. package/dist/cli/chunks/rvf-migration-coordinator-CMKG56AR.js +0 -2
  522. package/dist/cli/chunks/rvf-native-adapter-7YFW6S4Y.js +0 -2
  523. package/dist/cli/chunks/safe-db-TCAU4FUT.js +0 -2
  524. package/dist/cli/chunks/schedule-NB5KV435.js +0 -2
  525. package/dist/cli/chunks/scheduler-JKXGKVK6.js +0 -2
  526. package/dist/cli/chunks/sqlite-persistence-IXCNZRTW.js +0 -2
  527. package/dist/cli/chunks/sync-OSF7C2NL.js +0 -2
  528. package/dist/cli/chunks/test-SD457QJ6.js +0 -34
  529. package/dist/cli/chunks/test-runner-process-VKD65QQU.js +0 -2
  530. package/dist/cli/chunks/token-bootstrap-VUELSBOS.js +0 -2
  531. package/dist/cli/chunks/tree-sitter-wasm-parser-YAIPHRIL.js +0 -2
  532. package/dist/cli/chunks/unified-memory-GI76TXFV.js +0 -2
  533. package/dist/cli/chunks/unified-memory-hnsw-GXJ5BTZO.js +0 -2
  534. package/dist/cli/chunks/unified-persistence-OP7FDQPD.js +0 -2
  535. package/dist/cli/chunks/visual-security-GZ2MOKWB.js +0 -2
  536. package/dist/cli/chunks/witness-chain-P3XXXA62.js +0 -2
  537. package/dist/cli/chunks/witness-chain-repair-PUX2NFDL.js +0 -2
  538. package/dist/cli/chunks/workflow-orchestrator-P2APAJAA.js +0 -2
  539. package/dist/cli/chunks/wrappers-TWSKBTWD.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.16");process.exit(0)}
2
- import{a as _,b as M,c as K,d as N,f as te,h as oe}from"./chunk-KU2AUFGX.js";import{a as Y,e as ee}from"./chunk-5B5QPCNU.js";import{c as re,d as ne,e as ie,f as ae}from"./chunk-PHT5N7SC.js";import{b as I,g as H,j as X}from"./chunk-EA4YQVKS.js";import{b as k}from"./chunk-63ZKI4PX.js";import{c as J,i as Z}from"./chunk-IOKYCMTJ.js";import{B as Re,w as $}from"./chunk-MO55CVMT.js";import{c as D,d as Pe}from"./chunk-JDIYMZCQ.js";import{n as T}from"./chunk-M4FRQ4TE.js";import{c as C,d as E}from"./chunk-LE4QJREF.js";import{a as U}from"./chunk-YAPLJR7K.js";import{c as A}from"./chunk-G5RHFBAY.js";import{S as ve,b as G}from"./chunk-L6QSTQME.js";import{a as f,b as z,e as j}from"./chunk-KNSRL6NO.js";U();j();function se(i,e,r,t){let n={missing:0,ingested:0,rejected:0,capped:!1};if(typeof i.has!="function")return n;let a=d=>d.filter(h=>!i.has(h)),o=a(e.getEmbeddingIdsInSpace(r));if(o.length===0)return n;let s=Number.isFinite(t)&&t>0?Math.floor(t):1e3;o.length>s&&(o=a(e.getEmbeddingIdsInSpace(r,{ordered:!0})));let l=o.slice(0,s),u=e.getEmbeddingsByIds(l).filter(({embedding:d})=>d&&d.length>0).map(({patternId:d,embedding:h})=>({id:d,vector:new Float32Array(h)})),{accepted:c,rejected:g}=u.length>0?i.ingest(u):{accepted:0,rejected:0};return{missing:o.length,ingested:c,rejected:g,capped:o.length>s}}var O={enableLearning:!0,enableGuidance:!0,enableRouting:!0,embeddingDimension:384,useONNXEmbeddings:!0,maxRoutingCandidates:10,routingWeights:{similarity:.3,performance:.4,capabilities:.3},coherenceThreshold:.4};var q=[{patternType:"test-template",name:"AAA Unit Test",description:"Arrange-Act-Assert pattern for clear, maintainable unit tests",template:{type:"code",content:`describe('{{className}}', () => {
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.18");process.exit(0)}
2
+ import{a as M,b as N,c as K,d as O,f as te,h as oe}from"./chunk-5AGXIZQ5.js";import{a as Y,e as ee}from"./chunk-RMEQYJPU.js";import{c as re,d as ne,e as ie,f as ae}from"./chunk-UNTBVJ5X.js";import{b as _,g as H,j as X}from"./chunk-Y4LSEOZ3.js";import{b as k}from"./chunk-O5RDHD5T.js";import{c as J,i as Z}from"./chunk-LTGB7OIU.js";import{C as Se,w as $}from"./chunk-OW23N2Y5.js";import{r as T}from"./chunk-SWGPLXWW.js";import{c as I,d as Re}from"./chunk-YFILS5D5.js";import{c as D,d as E}from"./chunk-JMRDT2XK.js";import{a as U}from"./chunk-O5EWFR76.js";import{c as A}from"./chunk-NKU3FFM4.js";import{S as Pe,b as G}from"./chunk-V2LJ54KP.js";import{a as f,b as z,e as j}from"./chunk-AWQAE3SW.js";U();j();function se(i,e,r,t){let n={missing:0,ingested:0,rejected:0,capped:!1};if(typeof i.has!="function")return n;let a=m=>m.filter(b=>!i.has(b)),o=a(e.getEmbeddingIdsInSpace(r));if(o.length===0)return n;let s=Number.isFinite(t)&&t>0?Math.floor(t):1e3;o.length>s&&(o=a(e.getEmbeddingIdsInSpace(r,{ordered:!0})));let c=o.slice(0,s),u=e.getEmbeddingsByIds(c).filter(({embedding:m})=>m&&m.length>0).map(({patternId:m,embedding:b})=>({id:m,vector:new Float32Array(b)})),{accepted:l,rejected:p}=u.length>0?i.ingest(u):{accepted:0,rejected:0};return{missing:o.length,ingested:l,rejected:p,capped:o.length>s}}var Q={enableLearning:!0,enableGuidance:!0,enableRouting:!0,embeddingDimension:384,useONNXEmbeddings:!0,maxRoutingCandidates:10,routingWeights:{similarity:.3,performance:.4,capabilities:.3},coherenceThreshold:.4};var q=[{patternType:"test-template",name:"AAA Unit Test",description:"Arrange-Act-Assert pattern for clear, maintainable unit tests",template:{type:"code",content:`describe('{{className}}', () => {
3
3
  describe('{{methodName}}', () => {
4
4
  it('should {{expectedBehavior}}', {{async}} () => {
5
5
  // Arrange
@@ -278,7 +278,7 @@ On promotion:
278
278
  - Move from short-term to long-term tier
279
279
  - Boost confidence by 10%
280
280
  - Enable for cross-domain transfer to related domains
281
- - Mark as reusable for token savings optimization`,variables:[{name:"patternName",type:"string",required:!0,description:"Pattern to evaluate for promotion"}]},context:{tags:["promotion","learning","quality","pipeline"]},confidence:.6}];import{randomInt as ce}from"crypto";var x={"qe-test-generator":{domains:["test-generation"],capabilities:["test-generation","tdd","bdd","unit-test","integration-test"],performanceScore:.85,languages:["typescript","javascript","python","java","csharp","go","rust","swift","kotlin","dart"]},"qe-coverage-analyzer":{domains:["coverage-analysis"],capabilities:["coverage-analysis","gap-detection","risk-scoring"],performanceScore:.92,languages:["typescript","javascript","python","java","csharp","go","rust","swift","kotlin","dart"]},"qe-coverage-specialist":{domains:["coverage-analysis"],capabilities:["sublinear-analysis","branch-coverage","mutation-testing"],performanceScore:.88,languages:["typescript","javascript"]},"qe-test-architect":{domains:["test-generation","coverage-analysis"],capabilities:["test-strategy","test-pyramid","architecture"],performanceScore:.9,languages:["typescript","javascript","python","java","csharp","go","rust","swift","kotlin","dart"]},"qe-api-contract-validator":{domains:["contract-testing"],capabilities:["contract-testing","openapi","graphql","pact"],performanceScore:.87},"qe-security-auditor":{domains:["security-compliance"],capabilities:["sast","dast","vulnerability","owasp"],performanceScore:.82},"qe-visual-tester":{domains:["visual-accessibility"],capabilities:["screenshot","visual-regression","percy","chromatic"],performanceScore:.8},"qe-a11y-ally":{domains:["visual-accessibility"],capabilities:["wcag","aria","screen-reader","contrast"],performanceScore:.85},"qe-performance-tester":{domains:["chaos-resilience"],capabilities:["load-testing","stress-testing","k6","artillery"],performanceScore:.83},"qe-flaky-investigator":{domains:["test-execution"],capabilities:["flaky-detection","test-stability","retry"],performanceScore:.78},"qe-chaos-engineer":{domains:["chaos-resilience"],capabilities:["chaos-testing","resilience","fault-injection"],performanceScore:.75}},we=.4,Se=20,Ee=3;function ke(i){return 1/(1+Math.exp(-i))}function xe(i,e){if(!e||e.visits===0)return{score:i,qWeight:0,qValue:0,qVisits:0};let r=Math.min(e.visits/Se,1)*we,t=ke(e.qValue);return{score:i*(1-r)+t*r,qWeight:r,qValue:e.qValue,qVisits:e.visits}}function le(i){let e=i.envOverride,r=e!==void 0?Number.parseFloat(e):NaN,t=Number.isFinite(r)&&r>=0&&r<=1?r:.05,n=i.topologyCritical?.2:1;return{epsilon:Math.min(Math.max(t*n,0),1),baseEpsilon:t,safetyMultiplier:n}}function ue(i,e){if(e<=0||i.length<2)return;let r=Math.round(e*1e6);if(r<=0||ce(0,1e6)>=r)return;let t=Math.min(4,i.length),n=ce(1,t),a=i[n];i[n]=i[0],i[0]=a,i[0].exploration=!0,i[0].reasoning=[...i[0].reasoning,"(exploration)"]}function de(i){let e=i.toLowerCase();return/\bgenerate[- ]?test|\btest[- ]?gen|\bgenerate.+spec/.test(e)?"test-generation":/\bcoverage|\banalyze.+cover/.test(e)?"coverage-analysis":/\bquality|\bassess|\baudit/.test(e)?"quality-assessment":/\bsecurity|\bvulnerab|\bcompliance/.test(e)?"security-compliance":/\bdefect|\bbug|\bdiagnos/.test(e)?"defect-intelligence":/\brequirement|\bspec\b/.test(e)?"requirements-validation":/\brefactor|\brewrite|\boptim/.test(e)?"refactoring":/\btest|\brun.+test/.test(e)?"test-execution":"unknown"}function pe(i){return`${i.taskType}|${i.priority??"normal"}|${i.domain??"any"}`}function Q(i,e,r,t,n=x,a,o){let s=[];for(let[l,u]of Object.entries(n)){let c=0,g=[],d=i.filter(b=>u.domains.includes(b)).length,h=Math.min(i.length,Ee),y=d>0?Math.min(d/h,1)*.4:0;if(c+=y*t.similarity,y>0&&g.push(`Domain match: ${(y*100).toFixed(0)}%`),e&&e.length>0){let b=e.filter(v=>u.capabilities.some(P=>P.toLowerCase().includes(v.toLowerCase()))).length,p=b>0?b/e.length*.3:0;c+=p*t.capabilities,p>0&&g.push(`Capability match: ${(p*100).toFixed(0)}%`)}else c+=.15*t.capabilities;if(c+=u.performanceScore*.3*t.performance,g.push(`Performance score: ${(u.performanceScore*100).toFixed(0)}%`),a&&u.languages&&u.languages.length>0){let b=t.language??1,p=a.toLowerCase();if(u.languages.some(P=>P.toLowerCase()===p)){let P=.15*b;c+=P,g.push(`Language match: ${a}`)}}let w=r.get(l)||0;if(w>0){let b=Math.min(.1,w*.02);c+=b,g.push(`Pattern matches: ${w}`)}let S=c;if(o){let b=o(l),p=xe(S,b);c=p.score,p.qWeight>0&&g.push(`Q-bonus (w=${p.qWeight.toFixed(2)}, v=${p.qVisits})`),s.push({agent:l,score:c,reasoning:g,staticScore:S,qWeight:p.qWeight,qValue:p.qValue,qVisits:p.qVisits})}else s.push({agent:l,score:c,reasoning:g,staticScore:S})}return s.sort((l,u)=>u.score-l.score),s}var F={"test-generation":["test-execution","coverage-analysis","requirements-validation"],"test-execution":["test-generation","coverage-analysis","quality-assessment"],"coverage-analysis":["test-generation","test-execution","quality-assessment"],"quality-assessment":["test-execution","coverage-analysis","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"],"chaos-resilience":["test-execution","quality-assessment"],"learning-optimization":["test-generation","test-execution","coverage-analysis","quality-assessment","defect-intelligence"]};function me(){try{return!ae()||!ie()||re().getVerticesByType("agent").length===0?!1:ne().isCritical()}catch{return!1}}Re();function ge(i,e){if(i.length===e)return i;if(i.length>e){let r=i.length/e,t=new Array(e).fill(0);for(let n=0;n<e;n++){let a=Math.floor(n*r),o=Math.floor((n+1)*r),s=0;for(let l=a;l<o;l++)s+=i[l];t[n]=s/(o-a)}return L(t)}else{let r=new Array(e).fill(0),t=(i.length-1)/(e-1);for(let n=0;n<e;n++){let a=n*t,o=Math.floor(a),s=Math.min(o+1,i.length-1),l=a-o;r[n]=i[o]*(1-l)+i[s]*l}return L(r)}}function fe(i,e){let r=new Array(e).fill(0),t=i.toLowerCase().trim();for(let n=0;n<3;n++)for(let a=0;a<t.length;a++){let o=t.charCodeAt(a),s=o*(a+1)*(n+1)%e;r[s]+=Math.sin(o*(n+1))/(a+1)}return L(r)}function L(i){let e=Math.sqrt(i.reduce((r,t)=>r+t*t,0));if(e>0)for(let r=0;r<i.length;r++)i[r]/=e;return i}U();j();Pe();ve();var R=A.create("PatternPromotion");async function he(i,e){let r=H(i);if(!r.meetsUsageCriteria||!r.meetsQualityCriteria)return!1;if(e.coherenceService&&e.coherenceService.isInitialized()){let t=await e.searchPatterns("",{tier:"long-term",limit:1e3}),o=[...t.success?t.value.map(l=>l.pattern):[],i].map(l=>({id:l.id,embedding:l.embedding||[],weight:l.confidence,metadata:{name:l.name,domain:l.qeDomain}})),s=await e.coherenceService.checkCoherence(o);if(s.energy>=e.coherenceThreshold){let l={patternId:i.id,patternName:i.name,reason:"coherence_violation",energy:s.energy,existingPatternConflicts:s.contradictions?.map(u=>u.nodeIds).flat()};return e.eventBus&&await e.eventBus.publish({id:`pattern-promotion-blocked-${i.id}`,type:"pattern:promotion_blocked",timestamp:new Date,source:"learning-optimization",payload:l}),R.info("Pattern promotion blocked due to coherence violation",{name:i.name,energy:s.energy}),!1}}return!0}async function W(i,e){let r=await e.patternStore.promote(i);if(r.success){try{let t=e.getSqliteStore();await D(t.getDatabase(),()=>t.promotePattern(i))}catch(t){R.warn("SQLite pattern promotion persist failed",{error:f(t)})}if(G().useSublinearSolver)try{let t=e.getSqliteStore().getDatabase?.();if(t){let n=new V(t),a=await e.getPattern(i);if(a){let o=await e.searchPatterns("",{domain:a.qeDomain,tier:"long-term",limit:20});if(o.success)for(let{pattern:s}of o.value)s.id!==i&&await D(t,()=>n.recordCoOccurrence(i,s.id))}}}catch(t){R.warn("Citation graph update failed (non-fatal)",{error:f(t)})}if(e.rvfDualWriter)try{let t=await e.getPattern(i);t?.embedding&&t.embedding.length>0&&e.rvfDualWriter.writePattern(i,t.embedding)}catch(t){R.warn("RVF dual-write on promote failed (non-fatal)",{patternId:i,error:f(t)})}return k().then(t=>t.appendWhenUnlocked("PATTERN_PROMOTE",{patternId:i},"reasoning-bank")).catch(t=>{R.warn("Witness chain PATTERN_PROMOTE failed",{error:f(t)})}),R.info("Promoted pattern to long-term",{patternId:i}),e.eventBus&&await e.eventBus.publish({id:`pattern-promoted-${i}`,type:"pattern:promoted",timestamp:new Date,source:"learning-optimization",payload:{patternId:i,newTier:"long-term"}}),r}else return R.error("Failed to promote pattern",r.error,{patternId:i}),r}async function be(i){let{signal:e}=i;e?.throwIfAborted();let r=await i.patternStore.getStats(),t=0,n=0;for(let[a,o]of Object.entries(F)){e?.throwIfAborted();let s=a,l=r.byDomain[s]||0;if(l===0)continue;let u=await i.searchPatterns("",{domain:s,limit:50});if(u.success)for(let c of o){if(e?.throwIfAborted(),(r.byDomain[c]||0)>=l){n++;continue}for(let{pattern:d}of u.value){e?.throwIfAborted();let h=await i.searchPatterns(d.name,{domain:c,limit:1});if(h.success&&h.value.length>0&&h.value[0].score>.8){n++;continue}let y=Math.max(.3,(d.confidence||.5)*.8);(await i.storePattern({patternType:d.patternType,qeDomain:c,name:`${d.name} (from ${s})`,description:`${d.description} [Transferred from ${s} domain]`,template:d.template,context:{...d.context,relatedDomains:[s,c],tags:[...d.context.tags,"cross-domain-transfer",`source:${s}`]},confidence:y})).success?t++:n++}}}return R.info("Cross-domain transfer complete",{transferred:t,skipped:n}),{transferred:t,skipped:n}}var Ae=`
281
+ - Mark as reusable for token savings optimization`,variables:[{name:"patternName",type:"string",required:!0,description:"Pattern to evaluate for promotion"}]},context:{tags:["promotion","learning","quality","pipeline"]},confidence:.6}];import{randomInt as ce}from"crypto";var x={"qe-test-generator":{domains:["test-generation"],capabilities:["test-generation","tdd","bdd","unit-test","integration-test"],performanceScore:.85,languages:["typescript","javascript","python","java","csharp","go","rust","swift","kotlin","dart"]},"qe-coverage-analyzer":{domains:["coverage-analysis"],capabilities:["coverage-analysis","gap-detection","risk-scoring"],performanceScore:.92,languages:["typescript","javascript","python","java","csharp","go","rust","swift","kotlin","dart"]},"qe-coverage-specialist":{domains:["coverage-analysis"],capabilities:["sublinear-analysis","branch-coverage","mutation-testing"],performanceScore:.88,languages:["typescript","javascript"]},"qe-test-architect":{domains:["test-generation","coverage-analysis"],capabilities:["test-strategy","test-pyramid","architecture"],performanceScore:.9,languages:["typescript","javascript","python","java","csharp","go","rust","swift","kotlin","dart"]},"qe-api-contract-validator":{domains:["contract-testing"],capabilities:["contract-testing","openapi","graphql","pact"],performanceScore:.87},"qe-security-auditor":{domains:["security-compliance"],capabilities:["sast","dast","vulnerability","owasp"],performanceScore:.82},"qe-visual-tester":{domains:["visual-accessibility"],capabilities:["screenshot","visual-regression","percy","chromatic"],performanceScore:.8},"qe-a11y-ally":{domains:["visual-accessibility"],capabilities:["wcag","aria","screen-reader","contrast"],performanceScore:.85},"qe-performance-tester":{domains:["chaos-resilience"],capabilities:["load-testing","stress-testing","k6","artillery"],performanceScore:.83},"qe-flaky-investigator":{domains:["test-execution"],capabilities:["flaky-detection","test-stability","retry"],performanceScore:.78},"qe-chaos-engineer":{domains:["chaos-resilience"],capabilities:["chaos-testing","resilience","fault-injection"],performanceScore:.75}},we=.4,Ee=20,ke=3;function xe(i){return 1/(1+Math.exp(-i))}function Ae(i,e){if(!e||e.visits===0)return{score:i,qWeight:0,qValue:0,qVisits:0};let r=Math.min(e.visits/Ee,1)*we,t=xe(e.qValue);return{score:i*(1-r)+t*r,qWeight:r,qValue:e.qValue,qVisits:e.visits}}function le(i){let e=i.envOverride,r=e!==void 0?Number.parseFloat(e):NaN,t=Number.isFinite(r)&&r>=0&&r<=1?r:.05,n=i.topologyCritical?.2:1;return{epsilon:Math.min(Math.max(t*n,0),1),baseEpsilon:t,safetyMultiplier:n}}function ue(i,e){if(e<=0||i.length<2)return;let r=Math.round(e*1e6);if(r<=0||ce(0,1e6)>=r)return;let t=Math.min(4,i.length),n=ce(1,t),a=i[n];i[n]=i[0],i[0]=a,i[0].exploration=!0,i[0].reasoning=[...i[0].reasoning,"(exploration)"]}function de(i){let e=i.toLowerCase();return/\bgenerate[- ]?test|\btest[- ]?gen|\bgenerate.+spec/.test(e)?"test-generation":/\bcoverage|\banalyze.+cover/.test(e)?"coverage-analysis":/\bquality|\bassess|\baudit/.test(e)?"quality-assessment":/\bsecurity|\bvulnerab|\bcompliance/.test(e)?"security-compliance":/\bdefect|\bbug|\bdiagnos/.test(e)?"defect-intelligence":/\brequirement|\bspec\b/.test(e)?"requirements-validation":/\brefactor|\brewrite|\boptim/.test(e)?"refactoring":/\btest|\brun.+test/.test(e)?"test-execution":"unknown"}function pe(i){return`${i.taskType}|${i.priority??"normal"}|${i.domain??"any"}`}function F(i,e,r,t,n=x,a,o){let s=[];for(let[c,u]of Object.entries(n)){let l=0,p=[],m=i.filter(h=>u.domains.includes(h)).length,b=Math.min(i.length,ke),v=m>0?Math.min(m/b,1)*.4:0;if(l+=v*t.similarity,v>0&&p.push(`Domain match: ${(v*100).toFixed(0)}%`),e&&e.length>0){let h=e.filter(P=>u.capabilities.some(S=>S.toLowerCase().includes(P.toLowerCase()))).length,d=h>0?h/e.length*.3:0;l+=d*t.capabilities,d>0&&p.push(`Capability match: ${(d*100).toFixed(0)}%`)}else l+=.15*t.capabilities;if(l+=u.performanceScore*.3*t.performance,p.push(`Performance score: ${(u.performanceScore*100).toFixed(0)}%`),a&&u.languages&&u.languages.length>0){let h=t.language??1,d=a.toLowerCase();if(u.languages.some(S=>S.toLowerCase()===d)){let S=.15*h;l+=S,p.push(`Language match: ${a}`)}}let y=r.get(c)||0;if(y>0){let h=Math.min(.1,y*.02);l+=h,p.push(`Pattern matches: ${y}`)}let R=l;if(o){let h=o(c),d=Ae(R,h);l=d.score,d.qWeight>0&&p.push(`Q-bonus (w=${d.qWeight.toFixed(2)}, v=${d.qVisits})`),s.push({agent:c,score:l,reasoning:p,staticScore:R,qWeight:d.qWeight,qValue:d.qValue,qVisits:d.qVisits})}else s.push({agent:c,score:l,reasoning:p,staticScore:R})}return s.sort((c,u)=>u.score-c.score),s}var C={"test-generation":["test-execution","coverage-analysis","requirements-validation"],"test-execution":["test-generation","coverage-analysis","quality-assessment"],"coverage-analysis":["test-generation","test-execution","quality-assessment"],"quality-assessment":["test-execution","coverage-analysis","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"],"chaos-resilience":["test-execution","quality-assessment"],"learning-optimization":["test-generation","test-execution","coverage-analysis","quality-assessment","defect-intelligence"]};function me(){try{return!ae()||!ie()||re().getVerticesByType("agent").length===0?!1:ne().isCritical()}catch{return!1}}Se();function ge(i,e){if(i.length===e)return i;if(i.length>e){let r=i.length/e,t=new Array(e).fill(0);for(let n=0;n<e;n++){let a=Math.floor(n*r),o=Math.floor((n+1)*r),s=0;for(let c=a;c<o;c++)s+=i[c];t[n]=s/(o-a)}return L(t)}else{let r=new Array(e).fill(0),t=(i.length-1)/(e-1);for(let n=0;n<e;n++){let a=n*t,o=Math.floor(a),s=Math.min(o+1,i.length-1),c=a-o;r[n]=i[o]*(1-c)+i[s]*c}return L(r)}}function fe(i,e){let r=new Array(e).fill(0),t=i.toLowerCase().trim();for(let n=0;n<3;n++)for(let a=0;a<t.length;a++){let o=t.charCodeAt(a),s=o*(a+1)*(n+1)%e;r[s]+=Math.sin(o*(n+1))/(a+1)}return L(r)}function L(i){let e=Math.sqrt(i.reduce((r,t)=>r+t*t,0));if(e>0)for(let r=0;r<i.length;r++)i[r]/=e;return i}U();j();Re();Pe();var w=A.create("PatternPromotion");async function he(i,e){let r=H(i);if(!r.meetsUsageCriteria||!r.meetsQualityCriteria)return!1;if(e.coherenceService&&e.coherenceService.isInitialized()){let t=await e.searchPatterns("",{tier:"long-term",limit:1e3}),o=[...t.success?t.value.map(c=>c.pattern):[],i].map(c=>({id:c.id,embedding:c.embedding||[],weight:c.confidence,metadata:{name:c.name,domain:c.qeDomain}})),s=await e.coherenceService.checkCoherence(o);if(s.energy>=e.coherenceThreshold){let c={patternId:i.id,patternName:i.name,reason:"coherence_violation",energy:s.energy,existingPatternConflicts:s.contradictions?.map(u=>u.nodeIds).flat()};return e.eventBus&&await e.eventBus.publish({id:`pattern-promotion-blocked-${i.id}`,type:"pattern:promotion_blocked",timestamp:new Date,source:"learning-optimization",payload:c}),w.info("Pattern promotion blocked due to coherence violation",{name:i.name,energy:s.energy}),!1}}return!0}async function W(i,e){let r=await e.patternStore.promote(i);if(r.success){try{let t=e.getSqliteStore();await I(t.getDatabase(),()=>t.promotePattern(i))}catch(t){w.warn("SQLite pattern promotion persist failed",{error:f(t)})}if(G().useSublinearSolver)try{let t=e.getSqliteStore().getDatabase?.();if(t){let n=new V(t),a=await e.getPattern(i);if(a){let o=await e.searchPatterns("",{domain:a.qeDomain,tier:"long-term",limit:20});if(o.success)for(let{pattern:s}of o.value)s.id!==i&&await I(t,()=>n.recordCoOccurrence(i,s.id))}}}catch(t){w.warn("Citation graph update failed (non-fatal)",{error:f(t)})}if(e.rvfDualWriter)try{let t=await e.getPattern(i);t?.embedding&&t.embedding.length>0&&e.rvfDualWriter.writePattern(i,t.embedding)}catch(t){w.warn("RVF dual-write on promote failed (non-fatal)",{patternId:i,error:f(t)})}return k().then(t=>t.appendWhenUnlocked("PATTERN_PROMOTE",{patternId:i},"reasoning-bank")).catch(t=>{w.warn("Witness chain PATTERN_PROMOTE failed",{error:f(t)})}),w.info("Promoted pattern to long-term",{patternId:i}),e.eventBus&&await e.eventBus.publish({id:`pattern-promoted-${i}`,type:"pattern:promoted",timestamp:new Date,source:"learning-optimization",payload:{patternId:i,newTier:"long-term"}}),r}else return w.error("Failed to promote pattern",r.error,{patternId:i}),r}var be="cross-domain-transfer",Te=50;function qe(i){return i.context?.tags?.includes(be)??!1}async function Ce(i,e,r){if(r===0)return{originals:[],names:new Set};let t=await i.searchPatterns("",{domain:e,limit:r});if(!t.success)return null;let n=t.value.map(({pattern:a})=>a);return{originals:n.filter(a=>!qe(a)),names:new Set(n.map(a=>a.name))}}async function ye(i){let{signal:e}=i;e?.throwIfAborted();let r=await i.patternStore.getStats(),t=0,n=0,a=new Set;for(let[s,c]of Object.entries(C)){a.add(s);for(let u of c)a.add(u)}let o=new Map;for(let s of a)e?.throwIfAborted(),o.set(s,await Ce(i,s,r.byDomain[s]||0));for(let[s,c]of Object.entries(C)){e?.throwIfAborted();let u=s,l=o.get(u);if(!l)continue;let p=l.originals.length;if(p===0)continue;let m=l.originals.slice(0,Te);for(let b of c){e?.throwIfAborted();let v=o.get(b);if(!v){n++;continue}if(v.originals.length>=p){n++;continue}for(let y of m){e?.throwIfAborted();let R=`${y.name} (from ${u})`;if(v.names.has(R)){n++;continue}let h=await i.searchPatterns(y.name,{domain:b,limit:1});if(h.success&&h.value.length>0&&h.value[0].score>.8){n++;continue}let d=Math.max(.3,(y.confidence||.5)*.8);(await i.storePattern({patternType:y.patternType,qeDomain:b,name:R,description:`${y.description} [Transferred from ${u} domain]`,template:y.template,context:{...y.context,relatedDomains:[u,b],tags:[...y.context.tags,be,`source:${u}`]},confidence:d})).success?(v.names.add(R),t++):n++}}}return w.info("Cross-domain transfer complete",{transferred:t,skipped:n}),{transferred:t,skipped:n}}var De=`
282
282
  CREATE TABLE IF NOT EXISTS pattern_citations (
283
283
  source_pattern_id TEXT NOT NULL,
284
284
  target_pattern_id TEXT NOT NULL,
@@ -289,7 +289,7 @@ On promotion:
289
289
  );
290
290
  CREATE INDEX IF NOT EXISTS idx_citations_source ON pattern_citations(source_pattern_id);
291
291
  CREATE INDEX IF NOT EXISTS idx_citations_target ON pattern_citations(target_pattern_id);
292
- `,V=class{constructor(e){this.db=e}db;initialized=!1;ensureSchema(){this.initialized||(this.db.exec(Ae),this.initialized=!0)}recordCoOccurrence(e,r){this.ensureSchema();let[t,n]=e<r?[e,r]:[r,e];this.db.prepare(`
292
+ `,V=class{constructor(e){this.db=e}db;initialized=!1;ensureSchema(){this.initialized||(this.db.exec(De),this.initialized=!0)}recordCoOccurrence(e,r){this.ensureSchema();let[t,n]=e<r?[e,r]:[r,e];this.db.prepare(`
293
293
  INSERT INTO pattern_citations (source_pattern_id, target_pattern_id, weight, relationship)
294
294
  VALUES (?, ?, 1.0, 'co-occurrence')
295
295
  ON CONFLICT(source_pattern_id, target_pattern_id)
@@ -299,22 +299,22 @@ On promotion:
299
299
  VALUES (?, ?, 2.0, 'derivation')
300
300
  ON CONFLICT(source_pattern_id, target_pattern_id)
301
301
  DO UPDATE SET weight = MAX(weight, 2.0), relationship = 'derivation'
302
- `).run(e,r)}buildGraph(){this.ensureSchema();let e=this.db.prepare("SELECT source_pattern_id, target_pattern_id, weight, relationship FROM pattern_citations").all(),r=new Set;for(let o of e)r.add(o.source_pattern_id),r.add(o.target_pattern_id);let t=Array.from(r),n=new Map;t.forEach((o,s)=>n.set(o,s));let a=[];for(let o of e){let s=n.get(o.source_pattern_id),l=n.get(o.target_pattern_id);a.push([s,l,o.weight]),o.relationship==="co-occurrence"&&a.push([l,s,o.weight])}return{nodes:t,edges:a}}bootstrapFromExistingData(){this.ensureSchema();let e=0,r=this.db.prepare(`
302
+ `).run(e,r)}buildGraph(){this.ensureSchema();let e=this.db.prepare("SELECT source_pattern_id, target_pattern_id, weight, relationship FROM pattern_citations").all(),r=new Set;for(let o of e)r.add(o.source_pattern_id),r.add(o.target_pattern_id);let t=Array.from(r),n=new Map;t.forEach((o,s)=>n.set(o,s));let a=[];for(let o of e){let s=n.get(o.source_pattern_id),c=n.get(o.target_pattern_id);a.push([s,c,o.weight]),o.relationship==="co-occurrence"&&a.push([c,s,o.weight])}return{nodes:t,edges:a}}bootstrapFromExistingData(){this.ensureSchema();let e=0,r=this.db.prepare(`
303
303
  SELECT id, qe_domain FROM qe_patterns WHERE qe_domain IS NOT NULL ORDER BY qe_domain
304
- `).all(),t=new Map;for(let u of r){let c=t.get(u.qe_domain)??[];c.push(u.id),t.set(u.qe_domain,c)}let n=this.db.prepare(`
304
+ `).all(),t=new Map;for(let u of r){let l=t.get(u.qe_domain)??[];l.push(u.id),t.set(u.qe_domain,l)}let n=this.db.prepare(`
305
305
  INSERT OR IGNORE INTO pattern_citations (source_pattern_id, target_pattern_id, weight, relationship)
306
306
  VALUES (?, ?, 1.0, 'co-occurrence')
307
- `),a=this.db.transaction(u=>{for(let[c,g]of u)n.run(c,g).changes>0&&e++}),o=[];for(let[,u]of t){let c=u.slice(0,50);for(let g=0;g<c.length;g++)for(let d=g+1;d<c.length;d++){let[h,y]=c[g]<c[d]?[c[g],c[d]]:[c[d],c[g]];o.push([h,y])}}a(o);let s=this.db.prepare(`
307
+ `),a=this.db.transaction(u=>{for(let[l,p]of u)n.run(l,p).changes>0&&e++}),o=[];for(let[,u]of t){let l=u.slice(0,50);for(let p=0;p<l.length;p++)for(let m=p+1;m<l.length;m++){let[b,v]=l[p]<l[m]?[l[p],l[m]]:[l[m],l[p]];o.push([b,v])}}a(o);let s=this.db.prepare(`
308
308
  SELECT source_pattern_id, target_pattern_id, relationship_type
309
309
  FROM pattern_relationships
310
310
  WHERE relationship_type IN ('merged', 'derived', 'superseded')
311
- `).all(),l=this.db.prepare(`
311
+ `).all(),c=this.db.prepare(`
312
312
  INSERT OR IGNORE INTO pattern_citations (source_pattern_id, target_pattern_id, weight, relationship)
313
313
  VALUES (?, ?, 2.0, 'derivation')
314
- `);for(let u of s)l.run(u.source_pattern_id,u.target_pattern_id).changes>0&&e++;return e}getEdgeCount(){return this.ensureSchema(),this.db.prepare("SELECT COUNT(*) as cnt FROM pattern_citations").get().cnt}};var m=A.create("QEReasoningBank"),B=class{constructor(e,r,t={},n){this.memory=e;this.eventBus=r;this.coherenceService=n;this.config={...O,...t},this.embedderRecovery=new te({retryIntervalMs:this.config.embedderRetryIntervalMs,onRecovered:()=>m.info("Embedder available again: patterns are stored and searched with vectors"),onRetryFailed:a=>m.debug("Embedder still unavailable",{error:f(a)})}),t.rvfDualWriter&&(this.rvfDualWriter=t.rvfDualWriter),this.patternStore=ee(e,{embeddingDimension:this.config.embeddingDimension,...t.patternStore})}memory;eventBus;coherenceService;config;embeddingProvenance=new WeakMap;embedderRecovery;patternStore;initialized=!1;sqliteStore=null;rvfDualWriter=null;getSqliteStore(){return this.sqliteStore||(this.sqliteStore=Z(),this.sqliteStore.initialize().catch(e=>{m.warn("SQLitePatternStore init failed",{error:f(e)})})),this.sqliteStore}setRvfDualWriter(e){this.rvfDualWriter=e}stats={routingRequests:0,totalRoutingConfidence:0,learningOutcomes:0,measuredOutcomes:0,successfulOutcomes:0};async initialize(e){if(this.initialized)return;let r=e?.signal;r?.throwIfAborted(),await this.patternStore.initialize(),r?.throwIfAborted();try{let t=this.getSqliteStore();await t.initialize(),this.patternStore.setSqliteStore?.(t)}catch(t){m.warn("Failed to wire SQLitePatternStore into PatternStore",{error:f(t)})}r?.throwIfAborted(),this.initialized=!0,await this.loadPretrainedPatterns(r),r?.throwIfAborted();try{let t="reasoning-bank:cross-domain-seeded";if(!await this.memory.get(t))await this.memory.set(t,!0),await this.seedCrossDomainPatterns(r);else{let a=await this.patternStore.getStats();m.info("Cross-domain transfer already complete",{totalPatterns:a.totalPatterns})}}catch(t){if(r?.aborted)throw t;m.warn("Cross-domain seeding failed (non-fatal)",{error:t})}m.info("Initialized")}lastVectorReconcile=null;getLastVectorReconcile(){return this.lastVectorReconcile}reconcileVectorIndex(){let e=this.patternStore.getAdapter?.(),r=T()?.spaceId;if(!e||!r)return null;try{let t=Number(process.env.AQE_RVF_BACKFILL_LIMIT),n=Number.isFinite(t)&&t>0?Math.floor(t):1e3,a=se(e,this.getSqliteStore(),r,n);return a.missing>0&&m.info("Reconciled RVF index with SQLite vectors",{...a}),this.lastVectorReconcile=a,a}catch(t){return m.warn("RVF reconcile failed (non-fatal)",{error:f(t)}),null}}async loadPretrainedPatterns(e){e?.throwIfAborted();let r=await this.patternStore.getStats();if(r.totalPatterns>0){m.info("Found existing patterns",{totalPatterns:r.totalPatterns});let t=this.patternStore.getAdapter?.();if(t&&(t.status()?.totalVectors??0)===0)try{let n=(()=>{let s=process.env.AQE_RVF_BACKFILL_LIMIT,l=s?Number(s):NaN;return Number.isFinite(l)&&l>0?Math.floor(l):1e3})(),o=this.getSqliteStore().getRecentEmbeddings(n).filter(({embedding:s})=>s&&s.length>0).map(({patternId:s,embedding:l})=>({id:s,vector:l instanceof Float32Array?l:new Float32Array(l)}));if(o.length>0){let{accepted:s,rejected:l}=t.ingest(o);m.info("Backfilled RVF from SQLite",{requested:o.length,accepted:s,cap:n,truncated:o.length>=n}),l>0&&m.warn("RVF backfill partially rejected",{accepted:s,rejected:l})}}catch(n){m.warn("RVF backfill failed (non-fatal)",{error:f(n)})}else t&&this.reconcileVectorIndex();return}for(let t of q){e?.throwIfAborted();try{await this.storePattern(t)}catch(n){if(e?.aborted)throw n;m.warn("Failed to load pattern",{name:t.name,error:n})}}m.info("Loaded foundational patterns",{count:q.length})}async seedCrossDomainPatterns(e){return this.initialized||await this.initialize({signal:e}),be({searchPatterns:this.searchPatterns.bind(this),storePattern:this.storePattern.bind(this),patternStore:this.patternStore,signal:e})}async storePattern(e){if(this.initialized||await this.initialize(),!this.config.enableLearning)return E(new Error("Pattern learning is disabled"));if(!e.embedding){let n=await this.embedForPatterns(`${e.name} ${e.description} ${e.context?.tags?.join(" ")||""}`);n!==null&&(this.embeddingProvenance.has(n)||!!T()?.spaceId)?e={...e,embedding:n}:m.debug("No embedding runtime provenance; storing pattern without a vector",{name:e.name})}let r=await this.patternStore.create(e),t=r.success?r.value:null;if(!r.success&&r.error instanceof Y&&r.error.disposition==="COMMITTED_PENDING_INDEX")try{t=await this.patternStore.get(r.error.patternId)}catch(n){m.warn("Committed pattern lookup failed",{patternId:r.error.patternId,error:f(n)})}if(t){let n=t;if(k().then(a=>a.appendWhenUnlocked("PATTERN_CREATE",{patternId:n.id,domain:n.qeDomain,confidence:n.confidence,name:n.name},"reasoning-bank")).catch(a=>{m.warn("Witness chain PATTERN_CREATE failed",{error:f(a)})}),this.rvfDualWriter&&n.embedding&&n.embedding.length>0)try{this.rvfDualWriter.writePattern(n.id,n.embedding)}catch(a){m.warn("RVF dual-write failed (non-fatal)",{patternId:n.id,error:f(a)})}}return r}async searchPatterns(e,r){this.initialized||await this.initialize();let t=e,n=!0;if(typeof e=="string")if(e.trim()==="")n=!1,t="";else{let a=await this.embedForPatterns(e);t=a&&this.embeddingProvenance.has(a)?a:e,n=Array.isArray(t)}return this.patternStore.search(t,{...r,textQuery:typeof e=="string"&&e.trim()?e:r?.textQuery,useVectorSearch:n,embeddingSpaceId:typeof e=="string"?Array.isArray(t)?this.embeddingProvenance.get(t):void 0:r?.embeddingSpaceId})}async getPattern(e){return this.initialized||await this.initialize(),this.patternStore.get(e)}async recordOutcome(e){if(this.initialized||await this.initialize(),!this.config.enableLearning)return C(void 0);let r=await this.patternStore.recordUsage(e.patternId,e.success,e.metrics,e.feedback);if(r.success){this.stats.learningOutcomes++,J(e.metrics)==="measured"&&(this.stats.measuredOutcomes++,e.success&&this.stats.successfulOutcomes++),k().then(o=>o.appendWhenUnlocked("PATTERN_UPDATE",{patternId:e.patternId,success:e.success},"reasoning-bank")).catch(o=>{m.warn("Witness chain PATTERN_UPDATE failed",{error:f(o)})});let n=await this.getPattern(e.patternId),a=this.getPromotionDeps();n&&await he(n,a)&&(await W(e.patternId,a),m.info("Pattern promoted to long-term",{name:n.name}))}return r}async promotePattern(e){return this.initialized||await this.initialize(),await this.getPattern(e)?W(e,this.getPromotionDeps()):E(new Error(`Pattern not found: ${e}`))}getPromotionDeps(){return{patternStore:this.patternStore,coherenceService:this.coherenceService,eventBus:this.eventBus,coherenceThreshold:this.config.coherenceThreshold||.4,getSqliteStore:this.getSqliteStore.bind(this),rvfDualWriter:this.rvfDualWriter,searchPatterns:this.searchPatterns.bind(this),getPattern:this.getPattern.bind(this)}}async routeTask(e){if(this.initialized||await this.initialize(),!this.config.enableRouting)return E(new Error("Task routing is disabled"));this.stats.routingRequests++;try{let r=e.domain?[e.domain]:I(e.task);r.length===0&&r.push("test-generation");let t=await this.embedForPatterns(e.task),n=t?this.embeddingProvenance.get(t):void 0,a=await this.patternStore.search(t&&n?t:e.task,{limit:this.config.maxRoutingCandidates,domain:r[0],useVectorSearch:!!n,textQuery:e.task,embeddingSpaceId:n}),o=a.success?a.value.map(p=>p.pattern):[],s=new Map;for(let[p,v]of Object.entries(x)){let P=o.filter(ye=>v.domains.includes(ye.qeDomain)).length;P>0&&s.set(p,P)}let l=pe({taskType:de(e.task),priority:"normal",domain:r[0]}),u=this.buildQValueLookup(l),c=Q(r,e.capabilities,s,this.config.routingWeights,x,e.context?.language,u),g=1;try{let p=me(),v=le({envOverride:process.env.AQE_ROUTER_EXPLORATION_RATE,topologyCritical:p});g=v.safetyMultiplier,ue(c,v.epsilon)}catch{}let d=c[0],h=c.slice(1,4),y=[];if(this.config.enableGuidance&&r.length>0){let p=M(r[0],{framework:e.context?.framework,language:e.context?.language,includeAntiPatterns:!0});y.push(...p.slice(0,5))}this.stats.totalRoutingConfidence+=d.score;let w=c.reduce((p,v)=>p+(v.qWeight??0),0),S=c.length>0?w/c.length:0,b={recommendedAgent:d.agent,confidence:d.score,alternatives:h.map(p=>({agent:p.agent,score:p.score})),domains:r,patterns:o,guidance:y,reasoning:d.reasoning.join("; "),exploration:d.exploration===!0,criticality:g,qWeight:S};return C(oe(e.includePatternGuidance,b,a.success?a.value:[]))}catch(r){return E(z(r))}}buildQValueLookup(e){try{let r=$();if(!r.isInitialized())return()=>{};let t=r.getDatabase();if(!t.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='rl_q_values'").get())return()=>{};let a=t.prepare(`
314
+ `);for(let u of s)c.run(u.source_pattern_id,u.target_pattern_id).changes>0&&e++;return e}getEdgeCount(){return this.ensureSchema(),this.db.prepare("SELECT COUNT(*) as cnt FROM pattern_citations").get().cnt}};var g=A.create("QEReasoningBank"),B=class{constructor(e,r,t={},n){this.memory=e;this.eventBus=r;this.coherenceService=n;this.config={...Q,...t},this.embedderRecovery=new te({retryIntervalMs:this.config.embedderRetryIntervalMs,onRecovered:()=>g.info("Embedder available again: patterns are stored and searched with vectors"),onRetryFailed:a=>g.debug("Embedder still unavailable",{error:f(a)})}),t.rvfDualWriter&&(this.rvfDualWriter=t.rvfDualWriter),this.patternStore=ee(e,{embeddingDimension:this.config.embeddingDimension,...t.patternStore})}memory;eventBus;coherenceService;config;embeddingProvenance=new WeakMap;embedderRecovery;patternStore;initialized=!1;sqliteStore=null;rvfDualWriter=null;getSqliteStore(){return this.sqliteStore||(this.sqliteStore=Z(),this.sqliteStore.initialize().catch(e=>{g.warn("SQLitePatternStore init failed",{error:f(e)})})),this.sqliteStore}setRvfDualWriter(e){this.rvfDualWriter=e}stats={routingRequests:0,totalRoutingConfidence:0,learningOutcomes:0,measuredOutcomes:0,successfulOutcomes:0};async initialize(e){if(this.initialized)return;let r=e?.signal;r?.throwIfAborted(),await this.patternStore.initialize(),r?.throwIfAborted();try{let t=this.getSqliteStore();await t.initialize(),this.patternStore.setSqliteStore?.(t)}catch(t){g.warn("Failed to wire SQLitePatternStore into PatternStore",{error:f(t)})}r?.throwIfAborted(),this.initialized=!0,await this.loadPretrainedPatterns(r),r?.throwIfAborted();try{let t="reasoning-bank:cross-domain-seeded";if(!await this.memory.get(t))await this.memory.set(t,!0),await this.seedCrossDomainPatterns(r);else{let a=await this.patternStore.getStats();g.info("Cross-domain transfer already complete",{totalPatterns:a.totalPatterns})}}catch(t){if(r?.aborted)throw t;g.warn("Cross-domain seeding failed (non-fatal)",{error:t})}g.info("Initialized")}lastVectorReconcile=null;getLastVectorReconcile(){return this.lastVectorReconcile}reconcileVectorIndex(){let e=this.patternStore.getAdapter?.(),r=T()?.spaceId;if(!e||!r)return null;try{let t=Number(process.env.AQE_RVF_BACKFILL_LIMIT),n=Number.isFinite(t)&&t>0?Math.floor(t):1e3,a=se(e,this.getSqliteStore(),r,n);return a.missing>0&&g.info("Reconciled RVF index with SQLite vectors",{...a}),this.lastVectorReconcile=a,a}catch(t){return g.warn("RVF reconcile failed (non-fatal)",{error:f(t)}),null}}async loadPretrainedPatterns(e){e?.throwIfAborted();let r=await this.patternStore.getStats();if(r.totalPatterns>0){g.info("Found existing patterns",{totalPatterns:r.totalPatterns});let t=this.patternStore.getAdapter?.();if(t&&(t.status()?.totalVectors??0)===0)try{let n=(()=>{let s=process.env.AQE_RVF_BACKFILL_LIMIT,c=s?Number(s):NaN;return Number.isFinite(c)&&c>0?Math.floor(c):1e3})(),o=this.getSqliteStore().getRecentEmbeddings(n).filter(({embedding:s})=>s&&s.length>0).map(({patternId:s,embedding:c})=>({id:s,vector:c instanceof Float32Array?c:new Float32Array(c)}));if(o.length>0){let{accepted:s,rejected:c}=t.ingest(o);g.info("Backfilled RVF from SQLite",{requested:o.length,accepted:s,cap:n,truncated:o.length>=n}),c>0&&g.warn("RVF backfill partially rejected",{accepted:s,rejected:c})}}catch(n){g.warn("RVF backfill failed (non-fatal)",{error:f(n)})}else t&&this.reconcileVectorIndex();return}for(let t of q){e?.throwIfAborted();try{await this.storePattern(t)}catch(n){if(e?.aborted)throw n;g.warn("Failed to load pattern",{name:t.name,error:n})}}g.info("Loaded foundational patterns",{count:q.length})}async seedCrossDomainPatterns(e){return this.initialized||await this.initialize({signal:e}),ye({searchPatterns:this.searchPatterns.bind(this),storePattern:this.storePattern.bind(this),patternStore:this.patternStore,signal:e})}async storePattern(e){if(this.initialized||await this.initialize(),!this.config.enableLearning)return E(new Error("Pattern learning is disabled"));if(!e.embedding){let n=await this.embedForPatterns(`${e.name} ${e.description} ${e.context?.tags?.join(" ")||""}`);n!==null&&(this.embeddingProvenance.has(n)||!!T()?.spaceId)?e={...e,embedding:n}:g.debug("No embedding runtime provenance; storing pattern without a vector",{name:e.name})}let r=await this.patternStore.create(e),t=r.success?r.value:null;if(!r.success&&r.error instanceof Y&&r.error.disposition==="COMMITTED_PENDING_INDEX")try{t=await this.patternStore.get(r.error.patternId)}catch(n){g.warn("Committed pattern lookup failed",{patternId:r.error.patternId,error:f(n)})}if(t){let n=t;if(k().then(a=>a.appendWhenUnlocked("PATTERN_CREATE",{patternId:n.id,domain:n.qeDomain,confidence:n.confidence,name:n.name},"reasoning-bank")).catch(a=>{g.warn("Witness chain PATTERN_CREATE failed",{error:f(a)})}),this.rvfDualWriter&&n.embedding&&n.embedding.length>0)try{this.rvfDualWriter.writePattern(n.id,n.embedding)}catch(a){g.warn("RVF dual-write failed (non-fatal)",{patternId:n.id,error:f(a)})}}return r}async searchPatterns(e,r){this.initialized||await this.initialize();let t=e,n=!0;if(typeof e=="string")if(e.trim()==="")n=!1,t="";else{let a=await this.embedForPatterns(e);t=a&&this.embeddingProvenance.has(a)?a:e,n=Array.isArray(t)}return this.patternStore.search(t,{...r,textQuery:typeof e=="string"&&e.trim()?e:r?.textQuery,useVectorSearch:n,embeddingSpaceId:typeof e=="string"?Array.isArray(t)?this.embeddingProvenance.get(t):void 0:r?.embeddingSpaceId})}async getPattern(e){return this.initialized||await this.initialize(),this.patternStore.get(e)}async recordOutcome(e){if(this.initialized||await this.initialize(),!this.config.enableLearning)return D(void 0);let r=await this.patternStore.recordUsage(e.patternId,e.success,e.metrics,e.feedback);if(r.success){this.stats.learningOutcomes++,J(e.metrics)==="measured"&&(this.stats.measuredOutcomes++,e.success&&this.stats.successfulOutcomes++),k().then(o=>o.appendWhenUnlocked("PATTERN_UPDATE",{patternId:e.patternId,success:e.success},"reasoning-bank")).catch(o=>{g.warn("Witness chain PATTERN_UPDATE failed",{error:f(o)})});let n=await this.getPattern(e.patternId),a=this.getPromotionDeps();n&&await he(n,a)&&(await W(e.patternId,a),g.info("Pattern promoted to long-term",{name:n.name}))}return r}async promotePattern(e){return this.initialized||await this.initialize(),await this.getPattern(e)?W(e,this.getPromotionDeps()):E(new Error(`Pattern not found: ${e}`))}getPromotionDeps(){return{patternStore:this.patternStore,coherenceService:this.coherenceService,eventBus:this.eventBus,coherenceThreshold:this.config.coherenceThreshold||.4,getSqliteStore:this.getSqliteStore.bind(this),rvfDualWriter:this.rvfDualWriter,searchPatterns:this.searchPatterns.bind(this),getPattern:this.getPattern.bind(this)}}async routeTask(e){if(this.initialized||await this.initialize(),!this.config.enableRouting)return E(new Error("Task routing is disabled"));this.stats.routingRequests++;try{let r=e.domain?[e.domain]:_(e.task);r.length===0&&r.push("test-generation");let t=await this.embedForPatterns(e.task),n=t?this.embeddingProvenance.get(t):void 0,a=await this.patternStore.search(t&&n?t:e.task,{limit:this.config.maxRoutingCandidates,domain:r[0],useVectorSearch:!!n,textQuery:e.task,embeddingSpaceId:n}),o=a.success?a.value.map(d=>d.pattern):[],s=new Map;for(let[d,P]of Object.entries(x)){let S=o.filter(ve=>P.domains.includes(ve.qeDomain)).length;S>0&&s.set(d,S)}let c=pe({taskType:de(e.task),priority:"normal",domain:r[0]}),u=this.buildQValueLookup(c),l=F(r,e.capabilities,s,this.config.routingWeights,x,e.context?.language,u),p=1;try{let d=me(),P=le({envOverride:process.env.AQE_ROUTER_EXPLORATION_RATE,topologyCritical:d});p=P.safetyMultiplier,ue(l,P.epsilon)}catch{}let m=l[0],b=l.slice(1,4),v=[];if(this.config.enableGuidance&&r.length>0){let d=N(r[0],{framework:e.context?.framework,language:e.context?.language,includeAntiPatterns:!0});v.push(...d.slice(0,5))}this.stats.totalRoutingConfidence+=m.score;let y=l.reduce((d,P)=>d+(P.qWeight??0),0),R=l.length>0?y/l.length:0,h={recommendedAgent:m.agent,confidence:m.score,alternatives:b.map(d=>({agent:d.agent,score:d.score})),domains:r,patterns:o,guidance:v,reasoning:m.reasoning.join("; "),exploration:m.exploration===!0,criticality:p,qWeight:R};return D(oe(e.includePatternGuidance,h,a.success?a.value:[]))}catch(r){return E(z(r))}}buildQValueLookup(e){try{let r=$();if(!r.isInitialized())return()=>{};let t=r.getDatabase();if(!t.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='rl_q_values'").get())return()=>{};let a=t.prepare(`
315
315
  SELECT q_value, visits FROM rl_q_values
316
316
  WHERE algorithm = 'q-learning'
317
317
  AND agent_id = 'aqe-hook-router'
318
318
  AND state_key = ?
319
319
  AND action_key = ?
320
- `);return o=>{try{let s=a.get(e,o);return s?{qValue:s.q_value,visits:s.visits}:void 0}catch{return}}}catch{return()=>{}}}getGuidance(e,r){return _(e)}generateContext(e,r){return N(e,r||{})}checkAntiPatterns(e,r){return K(e,r)}async embed(e){if(this.config.useONNXEmbeddings)try{let{computeRealEmbedding:r}=await import("./real-embeddings-OXLYU7JW.js"),t=await r(e);if(t.length!==this.config.embeddingDimension)return ge(t,this.config.embeddingDimension);let n=T()?.spaceId;return n&&this.embeddingProvenance.set(t,n),t}catch(r){let{isUsingEndpoint:t}=await import("./real-embeddings-OXLYU7JW.js");if(t())throw r;process.env.DEBUG&&m.warn("ONNX embeddings unavailable, using hash fallback",{error:f(r)})}return fe(e,this.config.embeddingDimension)}async embedForPatterns(e){if(!this.embedderRecovery.isAvailable())return null;try{return await this.embed(e)}catch(r){let t=f(r),n="Embedder failed: storing and searching patterns by text only";return this.embedderRecovery.markUnavailable(t)?m.warn(n,{error:t}):m.debug(n,{error:t}),null}}getEmbedderFailure(){return this.embedderRecovery.unavailableReason}async getStats(){this.initialized||await this.initialize();let e=await this.patternStore.getStats(),r={};for(let c of X)r[c]=e.byDomain[c]||0;let t=this.stats.routingRequests,n=this.stats.routingRequests>0?this.stats.totalRoutingConfidence/this.stats.routingRequests:0,a=this.stats.learningOutcomes,o=this.stats.measuredOutcomes,s=this.stats.learningOutcomes-this.stats.measuredOutcomes,l=this.stats.successfulOutcomes;try{let c=this.getSqliteStore().getAggregateOutcomeStats();c.routingRequests>t&&(t=c.routingRequests,n=c.avgRoutingConfidence),c.learningOutcomes>a&&(a=c.learningOutcomes,o=c.measuredOutcomes,s=c.unmeasuredOutcomes,l=c.successfulOutcomes)}catch{}let u=o>0?l/o:null;return{totalPatterns:e.totalPatterns,byDomain:r,routingRequests:t,avgRoutingConfidence:n,learningOutcomes:a,measuredOutcomes:o,unmeasuredOutcomes:s,patternSuccessRate:u,...u===null?{evidenceStatus:"insufficient-evidence"}:{},patternStoreStats:e}}async dispose(){if(await this.patternStore.dispose(),this.sqliteStore&&(this.sqliteStore.close(),this.sqliteStore=null),this.rvfDualWriter){try{this.rvfDualWriter.close()}catch{}this.rvfDualWriter=null}this.initialized=!1}};function Mt(i,e,r,t){return new B(i,e,r,t)}export{O as a,q as b,x as c,de as d,Q as e,F as f,B as g,Mt as h};
320
+ `);return o=>{try{let s=a.get(e,o);return s?{qValue:s.q_value,visits:s.visits}:void 0}catch{return}}}catch{return()=>{}}}getGuidance(e,r){return M(e)}generateContext(e,r){return O(e,r||{})}checkAntiPatterns(e,r){return K(e,r)}async embed(e){if(this.config.useONNXEmbeddings)try{let{computeRealEmbedding:r}=await import("./real-embeddings-MIGZNKK3.js"),t=await r(e);if(t.length!==this.config.embeddingDimension)return ge(t,this.config.embeddingDimension);let n=T()?.spaceId;return n&&this.embeddingProvenance.set(t,n),t}catch(r){let{isUsingEndpoint:t}=await import("./real-embeddings-MIGZNKK3.js");if(t())throw r;process.env.DEBUG&&g.warn("ONNX embeddings unavailable, using hash fallback",{error:f(r)})}return fe(e,this.config.embeddingDimension)}async embedForPatterns(e){if(!this.embedderRecovery.isAvailable())return null;try{return await this.embed(e)}catch(r){let t=f(r),n="Embedder failed: storing and searching patterns by text only";return this.embedderRecovery.markUnavailable(t)?g.warn(n,{error:t}):g.debug(n,{error:t}),null}}getEmbedderFailure(){return this.embedderRecovery.unavailableReason}async getStats(){this.initialized||await this.initialize();let e=await this.patternStore.getStats(),r={};for(let l of X)r[l]=e.byDomain[l]||0;let t=this.stats.routingRequests,n=this.stats.routingRequests>0?this.stats.totalRoutingConfidence/this.stats.routingRequests:0,a=this.stats.learningOutcomes,o=this.stats.measuredOutcomes,s=this.stats.learningOutcomes-this.stats.measuredOutcomes,c=this.stats.successfulOutcomes;try{let l=this.getSqliteStore().getAggregateOutcomeStats();l.routingRequests>t&&(t=l.routingRequests,n=l.avgRoutingConfidence),l.learningOutcomes>a&&(a=l.learningOutcomes,o=l.measuredOutcomes,s=l.unmeasuredOutcomes,c=l.successfulOutcomes)}catch{}let u=o>0?c/o:null;return{totalPatterns:e.totalPatterns,byDomain:r,routingRequests:t,avgRoutingConfidence:n,learningOutcomes:a,measuredOutcomes:o,unmeasuredOutcomes:s,patternSuccessRate:u,...u===null?{evidenceStatus:"insufficient-evidence"}:{},patternStoreStats:e}}async dispose(){if(await this.patternStore.dispose(),this.sqliteStore&&(this.sqliteStore.close(),this.sqliteStore=null),this.rvfDualWriter){try{this.rvfDualWriter.close()}catch{}this.rvfDualWriter=null}this.initialized=!1}};function Ft(i,e,r,t){return new B(i,e,r,t)}export{Q as a,q as b,x as c,de as d,F as e,C as f,B as g,Ft as h};
@@ -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.16");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.18");process.exit(0)}
2
2
  var l=["ECONNREFUSED","ETIMEOUT","ENOMEM","ENOSPC"];var s={successRate:.1,failureRate:1,viabilityThreshold:.3,rehabilitationThreshold:10,maxQuarantineDurationMs:6048e5,domainOverrides:{"security-compliance":{successRate:.05,failureRate:1,viabilityThreshold:.5},"test-generation":{successRate:.15,failureRate:1,viabilityThreshold:.2},"quality-assessment":{successRate:.1,failureRate:1,viabilityThreshold:.4}}},a=class{config;_witnessChain=null;set witnessChain(e){this._witnessChain=e}constructor(e={}){this.config={...s,...e,domainOverrides:{...s.domainOverrides,...e.domainOverrides}}}computeConfidenceUpdate(e,r,i){let{successRate:u,failureRate:o}=this.getConfigForDomain(i),n=r==="success"?u:-o;if(r==="failure")try{this._witnessChain?.append("HEBBIAN_PENALTY",{previousConfidence:e,delta:n,domain:i},"asymmetric-learning")}catch{}return c(e+n,0,1)}shouldQuarantine(e,r){let{viabilityThreshold:i}=this.getConfigForDomain(r);return{shouldQuarantine:e<i,confidence:e,viabilityThreshold:i,domain:r}}classifyFailure(e){if(e.infrastructureHealthy===!1||e.durationMs!==void 0&&e.durationMs>3e4)return"infrastructure";if(e.errorMessage){let r=e.errorMessage.toUpperCase();for(let i of l)if(r.includes(i))return"infrastructure"}return e.failureCategory==="infrastructure"?"infrastructure":(e.failureCategory==="pattern","pattern")}checkRehabilitation(e,r){let i=this.config.rehabilitationThreshold;return{canRehabilitate:e>=i,consecutiveSuccesses:e,requiredSuccesses:i,domain:r}}getConfigForDomain(e){return e&&this.config.domainOverrides?.[e]?this.config.domainOverrides[e]:{successRate:this.config.successRate,failureRate:this.config.failureRate,viabilityThreshold:this.config.viabilityThreshold}}getAsymmetryRatio(e){let{successRate:r,failureRate:i}=this.getConfigForDomain(e);return r===0?1/0:i/r}};function c(t,e,r){return t<e?e:t>r?r:t}export{a};
@@ -0,0 +1,2 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.18");process.exit(0)}
2
+ import{c as m,d as E}from"./chunk-YP2GHQSV.js";import{c as O,e as k}from"./chunk-AWQAE3SW.js";E();k();import{constants as S}from"node:fs";import*as c from"node:fs";import*as d from"node:fs/promises";import*as u from"node:path";var v=128*1024*1024,R=class extends O{constructor(e,l,o){super(`Cannot read ${e}: ${l}`);this.filePath=e;this.reason=l;this.name="ConfinedReadError",this.code=o??l.toUpperCase().replace(/-/g,"_")}filePath;reason;code},b=S.O_RDONLY|(S.O_NOFOLLOW??0)|(S.O_NONBLOCK??0);function w(t,r){let e=u.relative(t,r);return e===""||e!==".."&&!e.startsWith(`..${u.sep}`)&&!u.isAbsolute(e)}async function N(t,r,e){let l=async i=>{let n=await d.stat(i).catch(()=>null);return n!==null&&n.dev===e.dev&&n.ino===e.ino},o=await d.readlink(`/proc/self/fd/${t}`).catch(()=>null);if(o!==null)return u.isAbsolute(o)&&await l(o)?o:null;let a=await d.realpath(r).catch(()=>null);return a&&await l(a)?a:null}function B(t,r,e){let l=i=>{try{let n=c.statSync(i);return n.dev===e.dev&&n.ino===e.ino}catch{return!1}},o=(()=>{try{return c.readlinkSync(`/proc/self/fd/${t}`)}catch{return null}})();if(o!==null)return u.isAbsolute(o)&&l(o)?o:null;let a=null;try{a=c.realpathSync.native(r)}catch{}return a&&l(a)?a:null}function y(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 R(t,r,e?.code)}function x(t,r,e){if(typeof t!="string"||t===""||t.includes("\0"))throw s(String(t),"unreadable");let l=u.resolve(e.projectRoot??m()),o=u.resolve(t),a=w(l,o)||w(r,o);if(!a&&e.outsideRoot!=="allow")throw s(t,"outside-project-root");let i=u.isAbsolute(t)?t:`${process.cwd()}${u.sep}${t}`;return{lexical:o,raw:i,rootReal:r,inRoot:a,limit:e.maxBytes??v,hardlinks:e.hardlinks??"allow"}}function C(t,r,e){if(!r.isFile())throw s(t,"not-a-file");if(r.size>e.limit)throw s(t,"too-large");if(e.hardlinks==="refuse"&&r.nlink>1)throw s(t,"hardlinked")}async function F(t,r={}){let e=u.resolve(r.projectRoot??m()),l=await d.realpath(e).catch(()=>e),o=x(t,l,r),a;try{a=await d.realpath(o.raw)}catch(n){throw s(t,y(n),n)}if(o.inRoot&&!w(o.rootReal,a))throw s(t,"outside-project-root");let i;try{i=await d.open(a,b)}catch(n){throw s(t,y(n),n)}try{let n=await i.stat();if(C(t,n,o),o.inRoot){let f=await N(i.fd,a,n);if(!f)throw s(t,"changed-during-read");if(!w(o.rootReal,f))throw s(t,"outside-project-root")}let g=[],p=0;for(;;){let f=Buffer.allocUnsafe(Math.min(65536,o.limit+1-p)),{bytesRead:h}=await i.read(f,0,f.length,null);if(h===0)break;if(g.push(f.subarray(0,h)),p+=h,p>o.limit)throw s(t,"too-large")}return Buffer.concat(g,p)}catch(n){throw n instanceof R?n:s(t,y(n),n)}finally{await i.close().catch(()=>{})}}async function $(t,r={}){return(await F(t,r)).toString("utf-8")}function j(t,r={}){let e=u.resolve(r.projectRoot??m()),l=e;try{l=c.realpathSync(e)}catch{}let o=x(t,l,r),a;try{a=c.realpathSync.native(o.raw)}catch(n){throw s(t,y(n),n)}if(o.inRoot&&!w(o.rootReal,a))throw s(t,"outside-project-root");let i;try{i=c.openSync(a,b)}catch(n){throw s(t,y(n),n)}try{let n=c.fstatSync(i);if(C(t,n,o),o.inRoot){let f=B(i,a,n);if(!f)throw s(t,"changed-during-read");if(!w(o.rootReal,f))throw s(t,"outside-project-root")}let g=[],p=0;for(;;){let f=Buffer.allocUnsafe(Math.min(65536,o.limit+1-p)),h=c.readSync(i,f,0,f.length,null);if(h===0)break;if(g.push(f.subarray(0,h)),p+=h,p>o.limit)throw s(t,"too-large")}return Buffer.concat(g,p)}catch(n){throw n instanceof R?n:s(t,y(n),n)}finally{try{c.closeSync(i)}catch{}}}function D(t,r={}){return j(t,r).toString("utf-8")}export{R as a,F as b,$ as c,D 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.16");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.18");process.exit(0)}
2
2
  async function o(n){await n.loadAll();let a=new Map;for(let i of n.getLoaded())a.set(i,await n.load(i));return a}export{o as a};
@@ -1,3 +1,3 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.16");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.18");process.exit(0)}
2
2
  var p={"||":1,"&&":2,"===":3,"!==":3,"==":3,"!=":3,"<":4,">":4,"<=":4,">=":4,"+":5,"-":5,"*":6,"/":6,"%":6},l=new Set(Object.keys(p)),w=new Set(["!","-","+"]);function h(r){let n=[],e=0;for(;e<r.length;){let t=r[e];if(/\s/.test(t)){e++;continue}if(/\d/.test(t)||t==="."&&/\d/.test(r[e+1])){let s="";for(;e<r.length&&/[\d.]/.test(r[e]);)s+=r[e++];n.push({type:"NUMBER",value:parseFloat(s),raw:s});continue}if(t==='"'||t==="'"){let s=t,u="";for(e++;e<r.length&&r[e]!==s;){if(r[e]==="\\"&&e+1<r.length){e++;let c=r[e];switch(c){case"n":u+=`
3
3
  `;break;case"t":u+=" ";break;case"r":u+="\r";break;default:u+=c}}else u+=r[e];e++}e++,n.push({type:"STRING",value:u,raw:`${s}${u}${s}`});continue}if(/[a-zA-Z_$]/.test(t)){let s="";for(;e<r.length&&/[a-zA-Z0-9_$]/.test(r[e]);)s+=r[e++];s==="true"?n.push({type:"BOOLEAN",value:!0,raw:s}):s==="false"?n.push({type:"BOOLEAN",value:!1,raw:s}):s==="null"?n.push({type:"NULL",value:null,raw:s}):s==="undefined"?n.push({type:"UNDEFINED",value:void 0,raw:s}):n.push({type:"IDENTIFIER",value:s,raw:s});continue}let a=r.slice(e,e+2),o=r.slice(e,e+3);if(o==="==="||o==="!=="){n.push({type:"OPERATOR",value:o,raw:o}),e+=3;continue}if(a==="=="||a==="!="||a==="<="||a===">="||a==="&&"||a==="||"){n.push({type:"OPERATOR",value:a,raw:a}),e+=2;continue}if(t==="("){n.push({type:"LPAREN",value:"(",raw:"("}),e++;continue}if(t===")"){n.push({type:"RPAREN",value:")",raw:")"}),e++;continue}if(t==="."){n.push({type:"DOT",value:".",raw:"."}),e++;continue}if("+-*/%<>!".includes(t)){n.push({type:"OPERATOR",value:t,raw:t}),e++;continue}throw new Error(`Unexpected character at position ${e}: ${t}`)}return n.push({type:"EOF",value:"",raw:""}),n}var i=class{tokens;pos=0;context;constructor(n,e){this.tokens=n,this.context=e}current(){return this.tokens[this.pos]}advance(){return this.tokens[this.pos++]}expect(n){let e=this.current();if(e.type!==n)throw new Error(`Expected ${n}, got ${e.type}`);return this.advance()}parse(){let n=this.parseExpression(0);if(this.current().type!=="EOF")throw new Error(`Unexpected token: ${this.current().raw}`);return n}parseExpression(n){let e=this.parseUnary();for(;;){let t=this.current();if(t.type!=="OPERATOR"||!l.has(t.value))break;let a=p[t.value];if(a<n)break;let o=this.advance().value,s=this.parseExpression(a+1);e=this.applyBinaryOperator(o,e,s)}return e}parseUnary(){let n=this.current();if(n.type==="OPERATOR"&&w.has(n.value)){let e=this.advance().value,t=this.parseUnary();return this.applyUnaryOperator(e,t)}return this.parsePrimary()}parsePrimary(){let n=this.current();switch(n.type){case"NUMBER":case"STRING":case"BOOLEAN":case"NULL":case"UNDEFINED":return this.advance(),n.value;case"IDENTIFIER":return this.parseIdentifier();case"LPAREN":{this.advance();let e=this.parseExpression(0);return this.expect("RPAREN"),e}default:throw new Error(`Unexpected token: ${n.raw}`)}}parseIdentifier(){let n=this.context,e=this.advance().value;for(typeof n=="object"&&n!==null&&Object.hasOwn(n,e)?n=n[e]:n=void 0;this.current().type==="DOT";){this.advance();let t=this.expect("IDENTIFIER").value;n!=null&&typeof n=="object"&&Object.hasOwn(n,t)?n=n[t]:n=void 0}return n}applyBinaryOperator(n,e,t){switch(n){case"===":return e===t;case"!==":return e!==t;case"==":return e==t;case"!=":return e!=t;case"<":return e<t;case">":return e>t;case"<=":return e<=t;case">=":return e>=t;case"&&":return e&&t;case"||":return e||t;case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return e/t;case"%":return e%t;default:throw new Error(`Unknown operator: ${n}`)}}applyUnaryOperator(n,e){switch(n){case"!":return!e;case"-":return-e;case"+":return+e;default:throw new Error(`Unknown unary operator: ${n}`)}}};function b(r,n={}){if(!r||typeof r!="string")throw new Error("Expression must be a non-empty string");let e=[/\beval\b/i,/\bFunction\b/,/\bconstructor\b/,/\b__proto__\b/,/\bprototype\b/,/\bimport\b/,/\brequire\b/,/\bprocess\b/,/\bglobal\b/,/\bwindow\b/,/\bdocument\b/,/\[\s*['"`]/,/\[.*\]/];for(let o of e)if(o.test(r))throw new Error(`Expression contains potentially dangerous pattern: ${r}`);let t=h(r.trim());return new i(t,n).parse()}function E(r,n={},e=!1){try{return!!b(r,n)}catch(t){return console.warn(`[SafeEvaluator] Failed to evaluate expression: ${r}`,t),e}}export{E as a};
@@ -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.16");process.exit(0)}
2
- import{b as o}from"./chunk-AJMJNQMP.js";function s(n){return n instanceof Error?n.message:String(n)}function u(n){return n instanceof Error?n:new Error(String(n))}function a(n){return n instanceof r||typeof n=="object"&&n!==null&&n.callerError===!0}var r,e=o(()=>{"use strict";r=class extends Error{callerError=!0;constructor(t){super(t),this.name="CallerInputError"}}});export{s as a,u as b,r as c,a as d,e};
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.18");process.exit(0)}
2
+ import{b as o}from"./chunk-BDVFSMOQ.js";function s(n){return n instanceof Error?n.message:String(n)}function u(n){return n instanceof Error?n:new Error(String(n))}function a(n){return n instanceof r||typeof n=="object"&&n!==null&&n.callerError===!0}var r,e=o(()=>{"use strict";r=class extends Error{callerError=!0;constructor(t){super(t),this.name="CallerInputError"}}});export{s as a,u as b,r as c,a as d,e};
@@ -1,3 +1,3 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.16");process.exit(0)}
2
- import{a as p}from"./chunk-YAPLJR7K.js";import{c as g}from"./chunk-G5RHFBAY.js";p();import{format as R}from"node:util";var c=2,E={debug:0,info:1,warn:2,warning:2,error:3,silent:4,none:4,off:4},C=new Set(["1","true","yes","on"]),b=/\x1b\[[0-9;]*m/g,N=/^\[(?:\d{2}:\d{2}:\d{2}\.\d{3}|\d{4}-\d{2}-\d{2}T[^\]]+)\]\s+\[(DEBUG|INFO|WARN|ERROR)\s*\]/,O=/^\[[A-Za-z][\w./:-]*\]\s/,S={debug:0,log:1,info:1,warn:2,error:3},d=c;function s(o){if(o)return E[o.trim().toLowerCase()]}function _(o=process.env,e=c){let t=s(o.AQE_LOG_LEVEL)??s(o.LOG_LEVEL);return t!==void 0?t:o.AQE_VERBOSE&&C.has(o.AQE_VERBOSE.trim().toLowerCase())?1:e}function x(o,e){if(typeof e!="string")return null;let t=e.replace(b,""),r=N.exec(t.trimStart());return r?E[r[1].toLowerCase()]:O.test(t)?S[o]:null}function I(o=process.env){return s(o.AQE_LOG_LEVEL)!==void 0||s(o.LOG_LEVEL)!==void 0}function m(o,e=process.env){return o.verbose!==!0||I(e)||a(1)?!1:(f(1),!0)}function a(o){return o>=d&&d!==4}function f(o){d=o,g.setLevel(o)}function k(o={}){let e=o.target??console,t=o.writeStderr??(n=>{process.stderr.write(n)});f(o.level??_());let r={log:e.log.bind(e),info:e.info.bind(e),debug:e.debug.bind(e),warn:e.warn.bind(e),error:e.error.bind(e)},l=n=>t(R(...n)+`
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.18");process.exit(0)}
2
+ import{a as p}from"./chunk-O5EWFR76.js";import{c as g}from"./chunk-NKU3FFM4.js";p();import{format as R}from"node:util";var c=2,E={debug:0,info:1,warn:2,warning:2,error:3,silent:4,none:4,off:4},C=new Set(["1","true","yes","on"]),b=/\x1b\[[0-9;]*m/g,N=/^\[(?:\d{2}:\d{2}:\d{2}\.\d{3}|\d{4}-\d{2}-\d{2}T[^\]]+)\]\s+\[(DEBUG|INFO|WARN|ERROR)\s*\]/,O=/^\[[A-Za-z][\w./:-]*\]\s/,S={debug:0,log:1,info:1,warn:2,error:3},d=c;function s(o){if(o)return E[o.trim().toLowerCase()]}function _(o=process.env,e=c){let t=s(o.AQE_LOG_LEVEL)??s(o.LOG_LEVEL);return t!==void 0?t:o.AQE_VERBOSE&&C.has(o.AQE_VERBOSE.trim().toLowerCase())?1:e}function x(o,e){if(typeof e!="string")return null;let t=e.replace(b,""),r=N.exec(t.trimStart());return r?E[r[1].toLowerCase()]:O.test(t)?S[o]:null}function I(o=process.env){return s(o.AQE_LOG_LEVEL)!==void 0||s(o.LOG_LEVEL)!==void 0}function m(o,e=process.env){return o.verbose!==!0||I(e)||a(1)?!1:(f(1),!0)}function a(o){return o>=d&&d!==4}function f(o){d=o,g.setLevel(o)}function k(o={}){let e=o.target??console,t=o.writeStderr??(n=>{process.stderr.write(n)});f(o.level??_());let r={log:e.log.bind(e),info:e.info.bind(e),debug:e.debug.bind(e),warn:e.warn.bind(e),error:e.error.bind(e)},l=n=>t(R(...n)+`
3
3
  `),i=(n,v,w)=>(...L)=>{let u=x(n,L[0]);u===null?v(L):a(u)&&w(L)};return e.log=i("log",n=>r.log(...n),l),e.debug=i("debug",n=>r.debug(...n),l),e.info=i("info",l,l),e.warn=i("warn",n=>r.warn(...n),n=>r.warn(...n)),e.error=i("error",n=>r.error(...n),n=>r.error(...n)),()=>{e.log=r.log,e.info=r.info,e.debug=r.debug,e.warn=r.warn,e.error=r.error}}export{_ as a,m as b,a as c,f as d,k as e};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.16");process.exit(0)}
2
- import{d as D,e as V}from"./chunk-G5RHFBAY.js";V();import*as A from"node:fs";import B from"node:module";import*as N from"node:path";import{fileURLToPath as J}from"node:url";var b=D("TreeSitterWASM"),O={python:{wasmFile:"tree-sitter-python.wasm",nodeTypes:{functionDecl:["function_definition"],classDecl:["class_definition"],importDecl:["import_statement","import_from_statement"]}},java:{wasmFile:"tree-sitter-java.wasm",nodeTypes:{functionDecl:["method_declaration","constructor_declaration"],classDecl:["class_declaration","interface_declaration"],importDecl:["import_declaration"]}},csharp:{wasmFile:"tree-sitter-c_sharp.wasm",nodeTypes:{functionDecl:["method_declaration","constructor_declaration"],classDecl:["class_declaration","interface_declaration"],importDecl:["using_directive"]}},rust:{wasmFile:"tree-sitter-rust.wasm",nodeTypes:{functionDecl:["function_item"],classDecl:[],importDecl:["use_declaration"],implBlock:"impl_item",structDecl:"struct_item"}},swift:{wasmFile:"tree-sitter-swift.wasm",nodeTypes:{functionDecl:["function_declaration"],classDecl:["class_declaration"],importDecl:["import_declaration"],structDecl:"struct_declaration",protocolDecl:"protocol_declaration"}}},y=null,g=null,F=0,P=3,w=new Map;function I(i){let e=J(new URL(".",import.meta.url)),t=[N.resolve(e,"..","..","..","assets","grammars",i),N.resolve(e,"..","..","assets","grammars",i),N.resolve(process.cwd(),"assets","grammars",i),N.resolve(e,"..","assets","grammars",i)];for(let n of t)if(A.existsSync(n))return n;throw new Error(`Grammar file ${i} not found. Searched: ${t.join(", ")}`)}async function E(){if(F>=P)throw new Error(`web-tree-sitter failed to initialize after ${P} attempts`);if(!y)return g||(g=(async()=>{try{let i=await import("./web-tree-sitter-ZF6FIE5R.js"),e=i.default??i;await(e.Parser?.init??e.init).call(e.Parser??e),y=e,F=0,b.info("web-tree-sitter WASM runtime initialized")}catch(i){F++,g=null;let e=i instanceof Error?i.message:String(i);throw b.warn(`web-tree-sitter WASM init failed (attempt ${F}/${P}): ${e}. `+(F<P?"Will retry on next parse.":"Falling back to regex permanently.")),i}})()),g}async function X(i){let e=w.get(i);if(e)return e;await E();let t=O[i];if(!t)throw new Error(`No WASM grammar config for ${i}`);try{let n=I(t.wasmFile),s=await y.Language.load(n);return w.set(i,s),b.info(`Loaded tree-sitter WASM grammar for ${i}`),s}catch(n){let s=n instanceof Error?n.message:String(n);throw b.warn(`Failed to load WASM grammar for ${i}: ${s}. Falling back to regex parser.`),n}}function u(i,e){let t=[];for(let n=0;n<i.childCount;n++){let s=i.child(n);e.includes(s.type)&&t.push(s)}return t}function h(i,e,t=10){let n=[];function s(r,o){if(!(o>t))for(let a=0;a<r.childCount;a++){let c=r.child(a);e.includes(c.type)&&n.push(c),s(c,o+1)}}return s(i,0),n}function x(i){let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);(n.type==="modifiers"||n.type==="modifier"||n.type==="visibility_modifier")&&e.push(n.text.trim())}return e}function C(i,e){return x(i).some(t=>t.includes(e))}var Y=new Set(["if_statement","if_expression","if_let_statement","while_statement","while_expression","for_statement","for_in_statement","for_expression","enhanced_for_statement","match_expression","switch_statement","switch_expression","case_clause","match_arm","switch_entry","catch_clause","except_clause","catch_block","binary_expression","conditional_expression","ternary_expression"]),q=new Set(["&&","||","and","or"]);function _(i){if(!i)return 1;let e=1;function t(n){if(Y.has(n.type))if(n.type==="binary_expression"){let s=n.childForFieldName("operator");s&&q.has(s.text)&&e++}else e++;for(let s=0;s<n.childCount;s++)t(n.child(s))}return t(i),e}function S(i,e){if(!i)return[];let t=[];for(let n=0;n<i.childCount;n++){let s=i.child(n);switch(e){case"java":if(s.type==="field_declaration"){let r=x(s),o=s.childForFieldName("type")?.text?.trim(),a=s.childForFieldName("declarator"),c=a?.childForFieldName("name")?.text??a?.text?.split(/[=;]/)[0]?.trim()??"";c&&t.push({name:c,type:o||void 0,isPublic:r.some(l=>l.includes("public")),isReadonly:r.some(l=>l.includes("final"))})}break;case"csharp":if(s.type==="field_declaration"||s.type==="property_declaration"){let r=x(s),o=s.childForFieldName("type")?.text?.trim(),a=s.childForFieldName("name")?.text??"";a&&t.push({name:a,type:o||void 0,isPublic:r.some(c=>c.includes("public")),isReadonly:r.some(c=>c.includes("readonly"))})}break;case"rust":if(s.type==="field_declaration"){let r=s.childForFieldName("name")?.text??"",o=s.childForFieldName("type")?.text?.trim(),a=C(s,"pub");r&&t.push({name:r,type:o||void 0,isPublic:a,isReadonly:!1})}break;case"swift":if(s.type==="property_declaration"){let r=L(s),o=s.childForFieldName("name")?.text??"",a=s.childForFieldName("type")?.text?.trim(),c=r.includes("public")||r.includes("open"),l=s.text.includes("let ");o&&t.push({name:o,type:a||void 0,isPublic:c,isReadonly:l})}break;case"python":if(s.type==="expression_statement"){let r=s.child(0);if(r?.type==="assignment"){let o=r.childForFieldName("left");if(o?.type==="attribute"||o?.type==="identifier"){let a=o.text.replace("self.","");t.push({name:a,type:void 0,isPublic:!a.startsWith("_"),isReadonly:!1})}}}break}}return t}function k(i){return i.map(e=>{let t=e.childForFieldName("name")?.text??"",n=e.childForFieldName("parameters"),s=e.childForFieldName("return_type"),r=e.childForFieldName("body"),o=e.text.trimStart().startsWith("async"),a=W(e);return{name:t,parameters:z(n),returnType:s?.text?.trim()||void 0,isAsync:o,isPublic:!t.startsWith("_"),complexity:_(r),decorators:a,genericParams:[],startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function z(i){if(!i)return[];let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="identifier"){let s=n.text;if(s==="self"||s==="cls")continue;e.push({name:s,type:void 0,isOptional:!1,defaultValue:void 0})}else if(n.type==="typed_parameter"){let s=n.child(0)?.text??"";if(s==="self"||s==="cls")continue;let r=n.childForFieldName("type")?.text?.trim();e.push({name:s,type:r||void 0,isOptional:!1,defaultValue:void 0})}else if(n.type==="default_parameter"||n.type==="typed_default_parameter"){let s=n.childForFieldName("name")?.text??n.child(0)?.text??"";if(s==="self"||s==="cls")continue;let r=n.childForFieldName("type")?.text?.trim(),o=n.childForFieldName("value")?.text?.trim();e.push({name:s,type:r||void 0,isOptional:!0,defaultValue:o||void 0})}else if(n.type==="list_splat_pattern"||n.type==="dictionary_splat_pattern"){let s=n.text;e.push({name:s,type:void 0,isOptional:!0,defaultValue:void 0})}}return e}function W(i){let e=[],t=i.parent;if(!t)return e;if(t.type==="decorated_definition")for(let n=0;n<t.childCount;n++){let s=t.child(n);s.type==="decorator"&&e.push(s.text.trim())}return e}function Q(i){return i.map(e=>{let t=e.childForFieldName("name")?.text??"",n=e.childForFieldName("body"),s=e.childForFieldName("superclasses"),r=[];if(s)for(let l=0;l<s.childCount;l++){let d=s.child(l);d.isNamed&&r.push(d.text)}let o=n?h(n,["function_definition"],2):[],a=k(o),c=W(e);return{name:t,methods:a,properties:S(n,"python"),isPublic:!t.startsWith("_"),implements:[],extends:r[0]||void 0,decorators:c,startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function H(i){return i.map(e=>{if(e.type==="import_from_statement"){let n=e.childForFieldName("module_name")?.text??"",s=[];for(let r=0;r<e.childCount;r++){let o=e.child(r);e.fieldNameForChild(r)==="name"&&o.isNamed&&s.push(o.text)}return{module:n,namedImports:s,isTypeOnly:!1}}return{module:e.childForFieldName("name")?.text??"",namedImports:[],isTypeOnly:!1}})}function T(i){return i.map(e=>{let t=e.childForFieldName("name")?.text??"",n=e.childForFieldName("type"),s=e.childForFieldName("parameters"),r=e.childForFieldName("body"),a=x(e).some(d=>d.includes("public")),c=n?.text?.includes("CompletableFuture")??!1,l=M(e);return{name:t,parameters:K(s),returnType:n?.text==="void"?void 0:n?.text?.trim(),isAsync:c,isPublic:a,complexity:_(r),decorators:l,genericParams:[],startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function K(i){if(!i)return[];let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="formal_parameter"||n.type==="spread_parameter"){let s=n.childForFieldName("name")?.text??"",r=n.childForFieldName("type")?.text?.trim();e.push({name:s,type:r||void 0,isOptional:!1,defaultValue:void 0})}}return e}function M(i){let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="modifiers")for(let s=0;s<n.childCount;s++){let r=n.child(s);(r.type==="marker_annotation"||r.type==="annotation")&&e.push(r.text.trim())}}return e}function Z(i){return i.map(e=>{let t=e.childForFieldName("name")?.text??"",n=e.childForFieldName("body"),r=x(e).some(p=>p.includes("public")),o=e.childForFieldName("superclass")?.text,a=e.childForFieldName("interfaces"),c=[];if(a)for(let p=0;p<a.childCount;p++){let f=a.child(p);f.isNamed&&c.push(f.text)}let l=n?u(n,["method_declaration","constructor_declaration"]):[],d=T(l),m=M(e);return{name:t,methods:d,properties:S(n,"java"),isPublic:r,implements:c,extends:o||void 0,decorators:m,startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function ee(i){return i.map(e=>{let t=e.text.replace(/^\s*import\s+(static\s+)?/,"").replace(/;\s*$/,"").trim(),n=t.split("."),s=n[n.length-1];return{module:t,namedImports:s==="*"?[]:[s],isTypeOnly:!1}})}function te(i){return h(i,["method_declaration","constructor_declaration"]).map(t=>{let n=t.childForFieldName("name")?.text??"",s=t.childForFieldName("type"),r=t.childForFieldName("parameters"),o=x(t),a=o.some(d=>d.includes("public")),c=o.some(d=>d.includes("async"))||s?.text?.includes("Task")||!1,l=j(t);return{name:n,parameters:ne(r),returnType:s?.text==="void"?void 0:s?.text?.trim(),isAsync:c,isPublic:a,complexity:_(t.childForFieldName("body")),decorators:l,genericParams:[],startLine:t.startPosition.row+1,endLine:t.endPosition.row+1}})}function ne(i){if(!i)return[];let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="parameter"){let s=n.childForFieldName("name")?.text??"",r=n.childForFieldName("type")?.text?.trim();e.push({name:s,type:r||void 0,isOptional:r?.endsWith("?")||!1,defaultValue:void 0})}}return e}function j(i){let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);n.type==="attribute_list"&&e.push(n.text.trim())}return e}function se(i){return h(i,["class_declaration","interface_declaration"]).map(t=>{let n=t.childForFieldName("name")?.text??"",s=t.childForFieldName("body"),o=x(t).some(p=>p.includes("public")),a=t.childForFieldName("bases"),c=[];if(a)for(let p=0;p<a.childCount;p++){let f=a.child(p);f.isNamed&&c.push(f.text)}let l=s?u(s,["method_declaration","constructor_declaration"]):[],d=T(l),m=j(t);return{name:n,methods:d,properties:S(s,"csharp"),isPublic:o,implements:c.slice(1),extends:c[0]||void 0,decorators:m,startLine:t.startPosition.row+1,endLine:t.endPosition.row+1}})}function ie(i){return h(i,["using_directive"]).map(t=>({module:t.text.replace(/^\s*using\s+(static\s+)?/,"").replace(/;\s*$/,"").trim(),namedImports:[],isTypeOnly:!1}))}function re(i,e){let t=[],n=u(i,e.nodeTypes.functionDecl);if(t.push(...n.map(U)),e.nodeTypes.implBlock){let s=u(i,[e.nodeTypes.implBlock]);for(let r of s){let o=r.childForFieldName("body");if(o){let a=u(o,e.nodeTypes.functionDecl);t.push(...a.map(U))}}}return t}function U(i){let e=i.childForFieldName("name")?.text??"",t=i.childForFieldName("parameters"),n=i.childForFieldName("return_type"),s=i.childForFieldName("body"),r=C(i,"pub"),o=i.text.trimStart().startsWith("pub async")||i.text.trimStart().startsWith("async"),a=G(i);return{name:e,parameters:oe(t),returnType:n?.text?.trim()||void 0,isAsync:o,isPublic:r,complexity:_(s),decorators:a,genericParams:[],startLine:i.startPosition.row+1,endLine:i.endPosition.row+1}}function oe(i){if(!i)return[];let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="parameter"){let s=n.childForFieldName("pattern"),r=n.childForFieldName("type"),o=s?.text??"",a=r?.text?.trim();e.push({name:o,type:a||void 0,isOptional:!1,defaultValue:void 0})}else if(n.type==="self_parameter")continue}return e}function G(i){let e=[],t=i.previousNamedSibling;for(;t&&t.type==="attribute_item";)e.unshift(t.text.trim()),t=t.previousNamedSibling;return e}function ae(i){let e=[],t=u(i,["struct_item","enum_item","trait_item"]);for(let n of t){let s=n.childForFieldName("name")?.text??"",r=C(n,"pub"),o=G(n),a=n.childForFieldName("body");e.push({name:s,methods:[],properties:S(a,"rust"),isPublic:r,implements:[],extends:void 0,decorators:o,startLine:n.startPosition.row+1,endLine:n.endPosition.row+1})}return e}function ce(i){return u(i,["use_declaration"]).map(t=>({module:t.childForFieldName("argument")?.text??t.text.replace(/^\s*use\s+/,"").replace(/;\s*$/,"").trim(),namedImports:[],isTypeOnly:!1}))}function $(i){return i.map(e=>{let t="",n=[],s,r=L(e),o=r.includes("public")||r.includes("open"),a=!1;for(let l=0;l<e.childCount;l++){let d=e.child(l);e.fieldNameForChild(l)==="name"&&(d.type==="simple_identifier"?t=d.text:t||(s=d.text)),d.type==="parameter"&&n.push(d),(d.type==="async"||d.text==="async")&&(a=!0)}if(!t){for(let l=0;l<e.childCount;l++)if(e.child(l).type==="simple_identifier"){t=e.child(l).text;break}}let c=null;for(let l=0;l<e.childCount;l++)if(e.child(l).type==="function_body"){c=e.child(l);break}return{name:t,parameters:le(n),returnType:s,isAsync:a,isPublic:o,complexity:_(c),decorators:[],genericParams:[],startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function L(i){let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="modifiers")for(let s=0;s<n.childCount;s++)e.push(n.child(s).text.trim())}return e}function le(i){return i.map(e=>{let n=e.text.split(":"),s=n[0]?.trim().split(/\s+/)??[],r=s[s.length-1]||"",o=n.slice(1).join(":").trim()||void 0;return{name:r,type:o,isOptional:o?.endsWith("?")||!1,defaultValue:void 0}})}function de(i){return u(i,["class_declaration","struct_declaration","protocol_declaration"]).map(n=>{let s=n.childForFieldName("name"),r=s?.text??"",o=L(n),a=o.includes("public")||o.includes("open"),c=[];for(let p=0;p<n.childCount;p++){let f=n.child(p);f.type==="type_identifier"&&f!==s&&c.push(f.text),(f.type==="inheritance_specifier"||f.type==="user_type")&&c.push(f.text)}let l=n.childForFieldName("body"),d=l?h(l,["function_declaration"],2):[],m=$(d);return{name:r,methods:m,properties:S(l,"swift"),isPublic:a,implements:c.slice(1),extends:c[0]||void 0,decorators:[],startLine:n.startPosition.row+1,endLine:n.endPosition.row+1}})}function ue(i){return u(i,["import_declaration"]).map(t=>{let n="";for(let s=0;s<t.childCount;s++){let r=t.child(s);(r.type==="identifier"||r.type==="simple_identifier")&&(n=r.text)}return{module:n,namedImports:[],isTypeOnly:!1}})}var v=class{language;supportedExtensions;constructor(e,t){this.language=e,this.supportedExtensions=t}async parseFile(e,t){let n=await X(this.language),s=y.Parser??y,r=new s;r.setLanguage(n);let o=r.parse(e),a=o.rootNode;try{return{...this.extractFromAST(a),language:this.language,filePath:t}}finally{o.delete(),r.delete()}}extractFromAST(e){let t=O[this.language];switch(this.language){case"python":{let n=u(e,t.nodeTypes.functionDecl),s=u(e,["decorated_definition"]).map(d=>{for(let m=0;m<d.childCount;m++)if(t.nodeTypes.functionDecl.includes(d.child(m).type))return d.child(m);return null}).filter(Boolean),r=[...n,...s],o=u(e,t.nodeTypes.classDecl),a=u(e,["decorated_definition"]).map(d=>{for(let m=0;m<d.childCount;m++)if(t.nodeTypes.classDecl.includes(d.child(m).type))return d.child(m);return null}).filter(Boolean),c=[...o,...a],l=u(e,t.nodeTypes.importDecl);return{functions:k(r),classes:Q(c),imports:H(l)}}case"java":{let n=h(e,t.nodeTypes.classDecl),s=u(e,t.nodeTypes.importDecl),o=[...u(e,t.nodeTypes.functionDecl)];for(let a of n){let c=a.childForFieldName("body");c&&o.push(...u(c,t.nodeTypes.functionDecl))}return{functions:T(o),classes:Z(n),imports:ee(s)}}case"csharp":return{functions:te(e),classes:se(e),imports:ie(e)};case"rust":return{functions:re(e,t),classes:ae(e),imports:ce(e)};case"swift":{let n=h(e,t.nodeTypes.functionDecl);return{functions:$(n),classes:de(e),imports:ue(e)}}default:return{functions:[],classes:[],imports:[]}}}},me={python:[".py"],java:[".java"],csharp:[".cs"],rust:[".rs"],swift:[".swift"]};function xe(){let i=new Map;for(let[e,t]of Object.entries(me))i.set(e,new v(e,t));return i}function pe(){if(process.env.AQE_PARSER_REGEX_ONLY==="1"||process.env.AQE_PARSER_REGEX_ONLY==="true")return!1;try{let{createRequire:i}=B;return i(import.meta.url).resolve("web-tree-sitter"),I("tree-sitter-python.wasm"),!0}catch{return!1}}var R=new Map;async function Fe(i){if(!pe())return null;try{await E();let e=R.get(i);return e||(e=await y.Language.load(I(i)),R.set(i,e)),{parse:t=>{let n=y.Parser??y,s=new n;s.setLanguage(e);let r=s.parse(t);return s.delete?.(),r}}}catch{return null}}function Ne(){y=null,g=null,F=0,w.clear()}export{v as a,xe as b,pe as c,Fe as d,Ne as e};
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.18");process.exit(0)}
2
+ import{d as D,e as V}from"./chunk-NKU3FFM4.js";V();import*as A from"node:fs";import B from"node:module";import*as N from"node:path";import{fileURLToPath as J}from"node:url";var b=D("TreeSitterWASM"),O={python:{wasmFile:"tree-sitter-python.wasm",nodeTypes:{functionDecl:["function_definition"],classDecl:["class_definition"],importDecl:["import_statement","import_from_statement"]}},java:{wasmFile:"tree-sitter-java.wasm",nodeTypes:{functionDecl:["method_declaration","constructor_declaration"],classDecl:["class_declaration","interface_declaration"],importDecl:["import_declaration"]}},csharp:{wasmFile:"tree-sitter-c_sharp.wasm",nodeTypes:{functionDecl:["method_declaration","constructor_declaration"],classDecl:["class_declaration","interface_declaration"],importDecl:["using_directive"]}},rust:{wasmFile:"tree-sitter-rust.wasm",nodeTypes:{functionDecl:["function_item"],classDecl:[],importDecl:["use_declaration"],implBlock:"impl_item",structDecl:"struct_item"}},swift:{wasmFile:"tree-sitter-swift.wasm",nodeTypes:{functionDecl:["function_declaration"],classDecl:["class_declaration"],importDecl:["import_declaration"],structDecl:"struct_declaration",protocolDecl:"protocol_declaration"}}},y=null,g=null,F=0,P=3,w=new Map;function I(i){let e=J(new URL(".",import.meta.url)),t=[N.resolve(e,"..","..","..","assets","grammars",i),N.resolve(e,"..","..","assets","grammars",i),N.resolve(process.cwd(),"assets","grammars",i),N.resolve(e,"..","assets","grammars",i)];for(let n of t)if(A.existsSync(n))return n;throw new Error(`Grammar file ${i} not found. Searched: ${t.join(", ")}`)}async function E(){if(F>=P)throw new Error(`web-tree-sitter failed to initialize after ${P} attempts`);if(!y)return g||(g=(async()=>{try{let i=await import("./web-tree-sitter-F2C7QRYT.js"),e=i.default??i;await(e.Parser?.init??e.init).call(e.Parser??e),y=e,F=0,b.info("web-tree-sitter WASM runtime initialized")}catch(i){F++,g=null;let e=i instanceof Error?i.message:String(i);throw b.warn(`web-tree-sitter WASM init failed (attempt ${F}/${P}): ${e}. `+(F<P?"Will retry on next parse.":"Falling back to regex permanently.")),i}})()),g}async function X(i){let e=w.get(i);if(e)return e;await E();let t=O[i];if(!t)throw new Error(`No WASM grammar config for ${i}`);try{let n=I(t.wasmFile),s=await y.Language.load(n);return w.set(i,s),b.info(`Loaded tree-sitter WASM grammar for ${i}`),s}catch(n){let s=n instanceof Error?n.message:String(n);throw b.warn(`Failed to load WASM grammar for ${i}: ${s}. Falling back to regex parser.`),n}}function u(i,e){let t=[];for(let n=0;n<i.childCount;n++){let s=i.child(n);e.includes(s.type)&&t.push(s)}return t}function h(i,e,t=10){let n=[];function s(r,o){if(!(o>t))for(let a=0;a<r.childCount;a++){let c=r.child(a);e.includes(c.type)&&n.push(c),s(c,o+1)}}return s(i,0),n}function x(i){let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);(n.type==="modifiers"||n.type==="modifier"||n.type==="visibility_modifier")&&e.push(n.text.trim())}return e}function C(i,e){return x(i).some(t=>t.includes(e))}var Y=new Set(["if_statement","if_expression","if_let_statement","while_statement","while_expression","for_statement","for_in_statement","for_expression","enhanced_for_statement","match_expression","switch_statement","switch_expression","case_clause","match_arm","switch_entry","catch_clause","except_clause","catch_block","binary_expression","conditional_expression","ternary_expression"]),q=new Set(["&&","||","and","or"]);function _(i){if(!i)return 1;let e=1;function t(n){if(Y.has(n.type))if(n.type==="binary_expression"){let s=n.childForFieldName("operator");s&&q.has(s.text)&&e++}else e++;for(let s=0;s<n.childCount;s++)t(n.child(s))}return t(i),e}function S(i,e){if(!i)return[];let t=[];for(let n=0;n<i.childCount;n++){let s=i.child(n);switch(e){case"java":if(s.type==="field_declaration"){let r=x(s),o=s.childForFieldName("type")?.text?.trim(),a=s.childForFieldName("declarator"),c=a?.childForFieldName("name")?.text??a?.text?.split(/[=;]/)[0]?.trim()??"";c&&t.push({name:c,type:o||void 0,isPublic:r.some(l=>l.includes("public")),isReadonly:r.some(l=>l.includes("final"))})}break;case"csharp":if(s.type==="field_declaration"||s.type==="property_declaration"){let r=x(s),o=s.childForFieldName("type")?.text?.trim(),a=s.childForFieldName("name")?.text??"";a&&t.push({name:a,type:o||void 0,isPublic:r.some(c=>c.includes("public")),isReadonly:r.some(c=>c.includes("readonly"))})}break;case"rust":if(s.type==="field_declaration"){let r=s.childForFieldName("name")?.text??"",o=s.childForFieldName("type")?.text?.trim(),a=C(s,"pub");r&&t.push({name:r,type:o||void 0,isPublic:a,isReadonly:!1})}break;case"swift":if(s.type==="property_declaration"){let r=L(s),o=s.childForFieldName("name")?.text??"",a=s.childForFieldName("type")?.text?.trim(),c=r.includes("public")||r.includes("open"),l=s.text.includes("let ");o&&t.push({name:o,type:a||void 0,isPublic:c,isReadonly:l})}break;case"python":if(s.type==="expression_statement"){let r=s.child(0);if(r?.type==="assignment"){let o=r.childForFieldName("left");if(o?.type==="attribute"||o?.type==="identifier"){let a=o.text.replace("self.","");t.push({name:a,type:void 0,isPublic:!a.startsWith("_"),isReadonly:!1})}}}break}}return t}function k(i){return i.map(e=>{let t=e.childForFieldName("name")?.text??"",n=e.childForFieldName("parameters"),s=e.childForFieldName("return_type"),r=e.childForFieldName("body"),o=e.text.trimStart().startsWith("async"),a=W(e);return{name:t,parameters:z(n),returnType:s?.text?.trim()||void 0,isAsync:o,isPublic:!t.startsWith("_"),complexity:_(r),decorators:a,genericParams:[],startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function z(i){if(!i)return[];let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="identifier"){let s=n.text;if(s==="self"||s==="cls")continue;e.push({name:s,type:void 0,isOptional:!1,defaultValue:void 0})}else if(n.type==="typed_parameter"){let s=n.child(0)?.text??"";if(s==="self"||s==="cls")continue;let r=n.childForFieldName("type")?.text?.trim();e.push({name:s,type:r||void 0,isOptional:!1,defaultValue:void 0})}else if(n.type==="default_parameter"||n.type==="typed_default_parameter"){let s=n.childForFieldName("name")?.text??n.child(0)?.text??"";if(s==="self"||s==="cls")continue;let r=n.childForFieldName("type")?.text?.trim(),o=n.childForFieldName("value")?.text?.trim();e.push({name:s,type:r||void 0,isOptional:!0,defaultValue:o||void 0})}else if(n.type==="list_splat_pattern"||n.type==="dictionary_splat_pattern"){let s=n.text;e.push({name:s,type:void 0,isOptional:!0,defaultValue:void 0})}}return e}function W(i){let e=[],t=i.parent;if(!t)return e;if(t.type==="decorated_definition")for(let n=0;n<t.childCount;n++){let s=t.child(n);s.type==="decorator"&&e.push(s.text.trim())}return e}function Q(i){return i.map(e=>{let t=e.childForFieldName("name")?.text??"",n=e.childForFieldName("body"),s=e.childForFieldName("superclasses"),r=[];if(s)for(let l=0;l<s.childCount;l++){let d=s.child(l);d.isNamed&&r.push(d.text)}let o=n?h(n,["function_definition"],2):[],a=k(o),c=W(e);return{name:t,methods:a,properties:S(n,"python"),isPublic:!t.startsWith("_"),implements:[],extends:r[0]||void 0,decorators:c,startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function H(i){return i.map(e=>{if(e.type==="import_from_statement"){let n=e.childForFieldName("module_name")?.text??"",s=[];for(let r=0;r<e.childCount;r++){let o=e.child(r);e.fieldNameForChild(r)==="name"&&o.isNamed&&s.push(o.text)}return{module:n,namedImports:s,isTypeOnly:!1}}return{module:e.childForFieldName("name")?.text??"",namedImports:[],isTypeOnly:!1}})}function T(i){return i.map(e=>{let t=e.childForFieldName("name")?.text??"",n=e.childForFieldName("type"),s=e.childForFieldName("parameters"),r=e.childForFieldName("body"),a=x(e).some(d=>d.includes("public")),c=n?.text?.includes("CompletableFuture")??!1,l=M(e);return{name:t,parameters:K(s),returnType:n?.text==="void"?void 0:n?.text?.trim(),isAsync:c,isPublic:a,complexity:_(r),decorators:l,genericParams:[],startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function K(i){if(!i)return[];let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="formal_parameter"||n.type==="spread_parameter"){let s=n.childForFieldName("name")?.text??"",r=n.childForFieldName("type")?.text?.trim();e.push({name:s,type:r||void 0,isOptional:!1,defaultValue:void 0})}}return e}function M(i){let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="modifiers")for(let s=0;s<n.childCount;s++){let r=n.child(s);(r.type==="marker_annotation"||r.type==="annotation")&&e.push(r.text.trim())}}return e}function Z(i){return i.map(e=>{let t=e.childForFieldName("name")?.text??"",n=e.childForFieldName("body"),r=x(e).some(p=>p.includes("public")),o=e.childForFieldName("superclass")?.text,a=e.childForFieldName("interfaces"),c=[];if(a)for(let p=0;p<a.childCount;p++){let f=a.child(p);f.isNamed&&c.push(f.text)}let l=n?u(n,["method_declaration","constructor_declaration"]):[],d=T(l),m=M(e);return{name:t,methods:d,properties:S(n,"java"),isPublic:r,implements:c,extends:o||void 0,decorators:m,startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function ee(i){return i.map(e=>{let t=e.text.replace(/^\s*import\s+(static\s+)?/,"").replace(/;\s*$/,"").trim(),n=t.split("."),s=n[n.length-1];return{module:t,namedImports:s==="*"?[]:[s],isTypeOnly:!1}})}function te(i){return h(i,["method_declaration","constructor_declaration"]).map(t=>{let n=t.childForFieldName("name")?.text??"",s=t.childForFieldName("type"),r=t.childForFieldName("parameters"),o=x(t),a=o.some(d=>d.includes("public")),c=o.some(d=>d.includes("async"))||s?.text?.includes("Task")||!1,l=j(t);return{name:n,parameters:ne(r),returnType:s?.text==="void"?void 0:s?.text?.trim(),isAsync:c,isPublic:a,complexity:_(t.childForFieldName("body")),decorators:l,genericParams:[],startLine:t.startPosition.row+1,endLine:t.endPosition.row+1}})}function ne(i){if(!i)return[];let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="parameter"){let s=n.childForFieldName("name")?.text??"",r=n.childForFieldName("type")?.text?.trim();e.push({name:s,type:r||void 0,isOptional:r?.endsWith("?")||!1,defaultValue:void 0})}}return e}function j(i){let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);n.type==="attribute_list"&&e.push(n.text.trim())}return e}function se(i){return h(i,["class_declaration","interface_declaration"]).map(t=>{let n=t.childForFieldName("name")?.text??"",s=t.childForFieldName("body"),o=x(t).some(p=>p.includes("public")),a=t.childForFieldName("bases"),c=[];if(a)for(let p=0;p<a.childCount;p++){let f=a.child(p);f.isNamed&&c.push(f.text)}let l=s?u(s,["method_declaration","constructor_declaration"]):[],d=T(l),m=j(t);return{name:n,methods:d,properties:S(s,"csharp"),isPublic:o,implements:c.slice(1),extends:c[0]||void 0,decorators:m,startLine:t.startPosition.row+1,endLine:t.endPosition.row+1}})}function ie(i){return h(i,["using_directive"]).map(t=>({module:t.text.replace(/^\s*using\s+(static\s+)?/,"").replace(/;\s*$/,"").trim(),namedImports:[],isTypeOnly:!1}))}function re(i,e){let t=[],n=u(i,e.nodeTypes.functionDecl);if(t.push(...n.map(U)),e.nodeTypes.implBlock){let s=u(i,[e.nodeTypes.implBlock]);for(let r of s){let o=r.childForFieldName("body");if(o){let a=u(o,e.nodeTypes.functionDecl);t.push(...a.map(U))}}}return t}function U(i){let e=i.childForFieldName("name")?.text??"",t=i.childForFieldName("parameters"),n=i.childForFieldName("return_type"),s=i.childForFieldName("body"),r=C(i,"pub"),o=i.text.trimStart().startsWith("pub async")||i.text.trimStart().startsWith("async"),a=G(i);return{name:e,parameters:oe(t),returnType:n?.text?.trim()||void 0,isAsync:o,isPublic:r,complexity:_(s),decorators:a,genericParams:[],startLine:i.startPosition.row+1,endLine:i.endPosition.row+1}}function oe(i){if(!i)return[];let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="parameter"){let s=n.childForFieldName("pattern"),r=n.childForFieldName("type"),o=s?.text??"",a=r?.text?.trim();e.push({name:o,type:a||void 0,isOptional:!1,defaultValue:void 0})}else if(n.type==="self_parameter")continue}return e}function G(i){let e=[],t=i.previousNamedSibling;for(;t&&t.type==="attribute_item";)e.unshift(t.text.trim()),t=t.previousNamedSibling;return e}function ae(i){let e=[],t=u(i,["struct_item","enum_item","trait_item"]);for(let n of t){let s=n.childForFieldName("name")?.text??"",r=C(n,"pub"),o=G(n),a=n.childForFieldName("body");e.push({name:s,methods:[],properties:S(a,"rust"),isPublic:r,implements:[],extends:void 0,decorators:o,startLine:n.startPosition.row+1,endLine:n.endPosition.row+1})}return e}function ce(i){return u(i,["use_declaration"]).map(t=>({module:t.childForFieldName("argument")?.text??t.text.replace(/^\s*use\s+/,"").replace(/;\s*$/,"").trim(),namedImports:[],isTypeOnly:!1}))}function $(i){return i.map(e=>{let t="",n=[],s,r=L(e),o=r.includes("public")||r.includes("open"),a=!1;for(let l=0;l<e.childCount;l++){let d=e.child(l);e.fieldNameForChild(l)==="name"&&(d.type==="simple_identifier"?t=d.text:t||(s=d.text)),d.type==="parameter"&&n.push(d),(d.type==="async"||d.text==="async")&&(a=!0)}if(!t){for(let l=0;l<e.childCount;l++)if(e.child(l).type==="simple_identifier"){t=e.child(l).text;break}}let c=null;for(let l=0;l<e.childCount;l++)if(e.child(l).type==="function_body"){c=e.child(l);break}return{name:t,parameters:le(n),returnType:s,isAsync:a,isPublic:o,complexity:_(c),decorators:[],genericParams:[],startLine:e.startPosition.row+1,endLine:e.endPosition.row+1}})}function L(i){let e=[];for(let t=0;t<i.childCount;t++){let n=i.child(t);if(n.type==="modifiers")for(let s=0;s<n.childCount;s++)e.push(n.child(s).text.trim())}return e}function le(i){return i.map(e=>{let n=e.text.split(":"),s=n[0]?.trim().split(/\s+/)??[],r=s[s.length-1]||"",o=n.slice(1).join(":").trim()||void 0;return{name:r,type:o,isOptional:o?.endsWith("?")||!1,defaultValue:void 0}})}function de(i){return u(i,["class_declaration","struct_declaration","protocol_declaration"]).map(n=>{let s=n.childForFieldName("name"),r=s?.text??"",o=L(n),a=o.includes("public")||o.includes("open"),c=[];for(let p=0;p<n.childCount;p++){let f=n.child(p);f.type==="type_identifier"&&f!==s&&c.push(f.text),(f.type==="inheritance_specifier"||f.type==="user_type")&&c.push(f.text)}let l=n.childForFieldName("body"),d=l?h(l,["function_declaration"],2):[],m=$(d);return{name:r,methods:m,properties:S(l,"swift"),isPublic:a,implements:c.slice(1),extends:c[0]||void 0,decorators:[],startLine:n.startPosition.row+1,endLine:n.endPosition.row+1}})}function ue(i){return u(i,["import_declaration"]).map(t=>{let n="";for(let s=0;s<t.childCount;s++){let r=t.child(s);(r.type==="identifier"||r.type==="simple_identifier")&&(n=r.text)}return{module:n,namedImports:[],isTypeOnly:!1}})}var v=class{language;supportedExtensions;constructor(e,t){this.language=e,this.supportedExtensions=t}async parseFile(e,t){let n=await X(this.language),s=y.Parser??y,r=new s;r.setLanguage(n);let o=r.parse(e),a=o.rootNode;try{return{...this.extractFromAST(a),language:this.language,filePath:t}}finally{o.delete(),r.delete()}}extractFromAST(e){let t=O[this.language];switch(this.language){case"python":{let n=u(e,t.nodeTypes.functionDecl),s=u(e,["decorated_definition"]).map(d=>{for(let m=0;m<d.childCount;m++)if(t.nodeTypes.functionDecl.includes(d.child(m).type))return d.child(m);return null}).filter(Boolean),r=[...n,...s],o=u(e,t.nodeTypes.classDecl),a=u(e,["decorated_definition"]).map(d=>{for(let m=0;m<d.childCount;m++)if(t.nodeTypes.classDecl.includes(d.child(m).type))return d.child(m);return null}).filter(Boolean),c=[...o,...a],l=u(e,t.nodeTypes.importDecl);return{functions:k(r),classes:Q(c),imports:H(l)}}case"java":{let n=h(e,t.nodeTypes.classDecl),s=u(e,t.nodeTypes.importDecl),o=[...u(e,t.nodeTypes.functionDecl)];for(let a of n){let c=a.childForFieldName("body");c&&o.push(...u(c,t.nodeTypes.functionDecl))}return{functions:T(o),classes:Z(n),imports:ee(s)}}case"csharp":return{functions:te(e),classes:se(e),imports:ie(e)};case"rust":return{functions:re(e,t),classes:ae(e),imports:ce(e)};case"swift":{let n=h(e,t.nodeTypes.functionDecl);return{functions:$(n),classes:de(e),imports:ue(e)}}default:return{functions:[],classes:[],imports:[]}}}},me={python:[".py"],java:[".java"],csharp:[".cs"],rust:[".rs"],swift:[".swift"]};function xe(){let i=new Map;for(let[e,t]of Object.entries(me))i.set(e,new v(e,t));return i}function pe(){if(process.env.AQE_PARSER_REGEX_ONLY==="1"||process.env.AQE_PARSER_REGEX_ONLY==="true")return!1;try{let{createRequire:i}=B;return i(import.meta.url).resolve("web-tree-sitter"),I("tree-sitter-python.wasm"),!0}catch{return!1}}var R=new Map;async function Fe(i){if(!pe())return null;try{await E();let e=R.get(i);return e||(e=await y.Language.load(I(i)),R.set(i,e)),{parse:t=>{let n=y.Parser??y,s=new n;s.setLanguage(e);let r=s.parse(t);return s.delete?.(),r}}}catch{return null}}function Ne(){y=null,g=null,F=0,w.clear()}export{v as a,xe as b,pe as c,Fe as d,Ne as e};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.16");process.exit(0)}
2
- import{a as r,h as n}from"./chunk-DTMAS2GB.js";var a={claude:"metered-api","claude-code":"subscription",codex:"subscription",openai:"metered-api",openrouter:"metered-api",gemini:"metered-api","azure-openai":"metered-api",bedrock:"metered-api",cognitum:"metered-capped",ollama:"local"};function o(e){return r(e)?a[e]:void 0}function p(e){return e.billingMode??o(e.type)??"metered-api"}function c(e){return o(e)??"metered-api"}function g(e,t){switch(t){case"metered-api":return`\u26A0\uFE0F LLM provider "${e}" bills a pay-per-token API key (not your Claude subscription) and has no server-side spend cap. Set a budget with --max-budget-usd / AQE_MAX_BUDGET_USD, or use AQE_LLM_PROVIDER=claude-code to run on your Claude Code subscription instead.`;case"metered-capped":return`\u2139\uFE0F LLM provider "${e}" bills per-token but enforces a server-side hard spend cap; it will pause at the cap rather than overspend.`;case"subscription":{let i=n(e);if(i){let d=i.detail?`declared by ${i.detail}`:`declared by ${i.source==="config"?"config":"the registering caller"}`;return`\u2139\uFE0F LLM provider "${e}" is an external provider that reports subscription billing (${d}) \u2014 AQE does not verify this. It draws on that host's own plan, not on your Claude Code or ChatGPT subscription.`}return`\u2139\uFE0F LLM provider "${e}" runs on your ${e==="codex"?"ChatGPT":"Claude Code"} subscription (shared plan usage). Worst case is hitting your plan's rate limit and pausing \u2014 no per-token API charges.`}case"local":return}}export{p as a,c as b,g as c};
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.18");process.exit(0)}
2
+ import{a as r,h as n}from"./chunk-LOJ7OO6W.js";var a={claude:"metered-api","claude-code":"subscription",codex:"subscription",openai:"metered-api",openrouter:"metered-api",gemini:"metered-api","azure-openai":"metered-api",bedrock:"metered-api",cognitum:"metered-capped",ollama:"local"};function o(e){return r(e)?a[e]:void 0}function p(e){return e.billingMode??o(e.type)??"metered-api"}function c(e){return o(e)??"metered-api"}function g(e,t){switch(t){case"metered-api":return`\u26A0\uFE0F LLM provider "${e}" bills a pay-per-token API key (not your Claude subscription) and has no server-side spend cap. Set a budget with --max-budget-usd / AQE_MAX_BUDGET_USD, or use AQE_LLM_PROVIDER=claude-code to run on your Claude Code subscription instead.`;case"metered-capped":return`\u2139\uFE0F LLM provider "${e}" bills per-token but enforces a server-side hard spend cap; it will pause at the cap rather than overspend.`;case"subscription":{let i=n(e);if(i){let d=i.detail?`declared by ${i.detail}`:`declared by ${i.source==="config"?"config":"the registering caller"}`;return`\u2139\uFE0F LLM provider "${e}" is an external provider that reports subscription billing (${d}) \u2014 AQE does not verify this. It draws on that host's own plan, not on your Claude Code or ChatGPT subscription.`}return`\u2139\uFE0F LLM provider "${e}" runs on your ${e==="codex"?"ChatGPT":"Claude Code"} subscription (shared plan usage). Worst case is hitting your plan's rate limit and pausing \u2014 no per-token API charges.`}case"local":return}}export{p as a,c as b,g as c};
@@ -0,0 +1,3 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.18");process.exit(0)}
2
+ import{c as C}from"./chunk-XJN3RKUD.js";import{d as p}from"./chunk-A3GDX6UF.js";import*as u from"fs";import*as m from"path";var x=["coverage/coverage-final.json","coverage/coverage-summary.json",".coverage/coverage-final.json"];function F(r){for(let o of x){let s=m.join(r,o);if(u.existsSync(s))try{let t=p(s,{projectRoot:r,outsideRoot:"allow"}),c=JSON.parse(t);if(c.total&&c.total.lines)return S(c,r);let n=new Map;for(let e of C(t).files)n.set(e.path,e);return n.size>0?n:null}catch{continue}}return null}function S(r,o){let s=new Map;for(let[t,c]of Object.entries(r)){if(t==="total")continue;let n=c;s.set(t,{path:t,lines:{covered:n.lines.covered,total:n.lines.total},branches:{covered:n.branches.covered,total:n.branches.total},functions:{covered:n.functions.covered,total:n.functions.total},statements:{covered:n.statements.covered,total:n.statements.total},uncoveredLines:[],uncoveredBranches:[]})}return s.size>0?s:null}function w(r,o){let t=o.split(`
3
+ `).length,n=[r.replace(".ts",".test.ts").replace("/src/","/tests/"),r.replace(".ts",".spec.ts").replace("/src/","/tests/"),r.replace(".ts",".test.ts"),r.replace("/src/","/test/").replace(".ts",".test.ts")].some(f=>u.existsSync(f)),e=(o.match(/\bexport\b/g)||[]).length,a=(o.match(/\b(function|=>)\b/g)||[]).length,i=(o.match(/\b(if|switch|case|\?\?|\|\|)\b/g)||[]).length,l;if(n){let f=Math.min(i*.005,.15),b=Math.min(t*1e-4,.1);l=.85-f-b}else l=.2+(e>5?.1:0);l=Math.max(.05,Math.min(.95,l));let v=Math.floor(t*l),g=Math.max(a,1),d=Math.max(i,1),M=Math.floor(v*.7),y=Math.floor(g*l*.9),h=Array.from({length:t-v},(f,b)=>b+v+1);return{path:r,lines:{covered:v,total:t},branches:{covered:Math.min(M,d),total:d},functions:{covered:Math.min(y,g),total:g},statements:{covered:v,total:t},uncoveredLines:h,uncoveredBranches:h.slice(0,Math.floor(h.length/2))}}function L(r){let o=e=>r.reduce((a,i)=>a+e(i),0),s=(e,a)=>a>0?Math.round(e/a*100):0,t=o(e=>e.lines.total),c=o(e=>e.lines.covered),n=o(e=>e.statements.total);return{line:s(c,t),branch:s(o(e=>e.branches.covered),o(e=>e.branches.total)),function:s(o(e=>e.functions.covered),o(e=>e.functions.total)),statement:n>0?s(o(e=>e.statements.covered),n):s(c,t),files:r.length}}function z(r,o){let s=o||process.cwd(),t=F(s),c=[],n=[],e=!1;if(t&&t.size>0){e=!0;for(let a of r){let i=m.resolve(a),l=t.get(i)||t.get(a)||t.get(m.relative(s,i));l?c.push({...l,path:a}):n.push(a)}}else for(let a of r){let i=u.existsSync(a)?u.readFileSync(a,"utf-8"):"";c.push(w(a,i))}return{files:c,summary:L(c),instrumented:e,...n.length>0?{unmeasuredFiles:n}:{}}}export{L as a,z as b};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.16");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.18");process.exit(0)}
2
2
  var h=Object.create;var f=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var m=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b,c)=>()=>{if(c)throw c[0];try{return a&&(b=a(a=0)),b}catch(d){throw c=[d],d}};var o=(a,b)=>()=>{try{return b||a((b={exports:{}}).exports,b),b.exports}catch(c){throw b=0,c}},p=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:!0})},g=(a,b,c,d)=>{if(b&&typeof b=="object"||typeof b=="function")for(let e of j(b))!l.call(a,e)&&e!==c&&f(a,e,{get:()=>b[e],enumerable:!(d=i(b,e))||d.enumerable});return a};var q=(a,b,c)=>(c=a!=null?h(k(a)):{},g(b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c,a)),r=a=>g(f({},"__esModule",{value:!0}),a);export{m as a,n as b,o as c,p as d,q as e,r as f};
@@ -1,3 +1,3 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.16");process.exit(0)}
2
- import{a as p,d as g}from"./chunk-FLNAW7C4.js";g();import{createHash as u}from"node:crypto";import{existsSync as l,readFileSync as E,renameSync as f,writeFileSync as b}from"node:fs";var m="aqe embedding-space compatibility canary v1",h=.999,a=class extends Error{constructor(i,t){super(`${i}: ${t}`);this.code=i;this.name="EmbeddingSpaceError"}code};function I(e){return JSON.stringify({provider:e.provider,model:e.model,dimensions:e.dimensions,pooling:e.pooling??null,normalized:e.normalized,preprocessingVersion:e.preprocessingVersion??null,implementation:e.implementation??null,runtimeFingerprint:e.runtimeFingerprint})}function R(e){let n=Buffer.alloc(e.length*2);for(let i=0;i<e.length;i++){let t=Math.max(-32768,Math.min(32767,Math.round(e[i]*32767)));n.writeInt16LE(t,i*2)}return u("sha256").update(n).digest("hex").slice(0,16)}function w(e){if(!e.runtimeFingerprint)throw new Error("Embedding space identity requires executable runtime evidence");let n=u("sha256").update("aqe:embedding-space:v1\0").update(I(e)).digest("hex");return{...e,spaceId:n}}async function C(e,n,i=h){let[t,o]=await Promise.all([e(m),n(m)]);if(t.length!==o.length)throw new a("VECTOR_SPACE_MISMATCH",`round-trip dimensions differ (${t.length} != ${o.length})`);let r=p(t,o);if(!Number.isFinite(r)||r<i)throw new a("VECTOR_SPACE_MISMATCH",`write/read canary cosine ${r.toFixed(6)} is below ${i}`);return r}function V(e,n){let i=[...new Set(e.flatMap(s=>s.spaceId?[s.spaceId]:[]))].sort(),t=e.filter(s=>!s.spaceId).length,o=n?e.filter(s=>s.spaceId===n).length:0,r=n?e.filter(s=>s.spaceId!==null&&s.spaceId!==n).length:e.length-t;return{status:t>0||!n?"unverified":r>0||i.length>1?"vector_space_mismatch":"healthy",activeSpaceId:n,storedSpaceIds:i,verifiedVectors:o,mismatchedVectors:r,unverifiedVectors:t}}var S="[VectorSearch] WARN: semantic vector search is not active: no embedding runtime was available when the ANN indexes were opened (set AQE_EMBEDDER_ENDPOINT, or install @huggingface/transformers). Any existing vectors in patterns.rvf and brain.rvf are kept and will be used once an embedder is available; until then pattern search uses SQLite text matching.",v="VECTOR_SPACE_UNVERIFIED: no embedding runtime was available when the RVF index was opened; index left unbound (existing vectors are kept)",c=!1;function M(){c||(c=!0,console.warn(S))}function y(){c=!1}function T(e,n,i){if(i)try{e.prepare("UPDATE captured_experiences SET embedding_space_id = ? WHERE id = ?").run(i,n)}catch{}}function _(e){return`${e}.space.json`}function D(e,n,i){if(!n)throw new a("VECTOR_SPACE_UNVERIFIED",`cannot open ANN index ${e} without runtime provenance`);let t=_(e);if(l(t)){let d;try{d=JSON.parse(E(t,"utf8"))}catch{throw new a("VECTOR_SPACE_UNVERIFIED",`ANN index manifest ${t} is unreadable`)}if(d.version!==1||!d.spaceId)throw new a("VECTOR_SPACE_UNVERIFIED",`ANN index manifest ${t} has no verified space`);if(d.spaceId!==n)throw new a("VECTOR_SPACE_MISMATCH",`ANN index space ${d.spaceId} != active space ${n}`);return}if(i>0)throw new a("VECTOR_SPACE_UNVERIFIED",`populated ANN index ${e} has no embedding-space manifest; rebuild required`);let o={version:1,spaceId:n},r=`${t}.${process.pid}.tmp`;b(r,`${JSON.stringify(o)}
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.18");process.exit(0)}
2
+ import{a as p,d as g}from"./chunk-M24ZAZ4U.js";g();import{createHash as u}from"node:crypto";import{existsSync as l,readFileSync as E,renameSync as f,writeFileSync as b}from"node:fs";var m="aqe embedding-space compatibility canary v1",h=.999,a=class extends Error{constructor(i,t){super(`${i}: ${t}`);this.code=i;this.name="EmbeddingSpaceError"}code};function I(e){return JSON.stringify({provider:e.provider,model:e.model,dimensions:e.dimensions,pooling:e.pooling??null,normalized:e.normalized,preprocessingVersion:e.preprocessingVersion??null,implementation:e.implementation??null,runtimeFingerprint:e.runtimeFingerprint})}function R(e){let n=Buffer.alloc(e.length*2);for(let i=0;i<e.length;i++){let t=Math.max(-32768,Math.min(32767,Math.round(e[i]*32767)));n.writeInt16LE(t,i*2)}return u("sha256").update(n).digest("hex").slice(0,16)}function w(e){if(!e.runtimeFingerprint)throw new Error("Embedding space identity requires executable runtime evidence");let n=u("sha256").update("aqe:embedding-space:v1\0").update(I(e)).digest("hex");return{...e,spaceId:n}}async function C(e,n,i=h){let[t,o]=await Promise.all([e(m),n(m)]);if(t.length!==o.length)throw new a("VECTOR_SPACE_MISMATCH",`round-trip dimensions differ (${t.length} != ${o.length})`);let r=p(t,o);if(!Number.isFinite(r)||r<i)throw new a("VECTOR_SPACE_MISMATCH",`write/read canary cosine ${r.toFixed(6)} is below ${i}`);return r}function V(e,n){let i=[...new Set(e.flatMap(s=>s.spaceId?[s.spaceId]:[]))].sort(),t=e.filter(s=>!s.spaceId).length,o=n?e.filter(s=>s.spaceId===n).length:0,r=n?e.filter(s=>s.spaceId!==null&&s.spaceId!==n).length:e.length-t;return{status:t>0||!n?"unverified":r>0||i.length>1?"vector_space_mismatch":"healthy",activeSpaceId:n,storedSpaceIds:i,verifiedVectors:o,mismatchedVectors:r,unverifiedVectors:t}}var S="[VectorSearch] WARN: semantic vector search is not active: no embedding runtime was available when the ANN indexes were opened (set AQE_EMBEDDER_ENDPOINT, or install @huggingface/transformers). Any existing vectors in patterns.rvf and brain.rvf are kept and will be used once an embedder is available; until then pattern search uses SQLite text matching.",v="VECTOR_SPACE_UNVERIFIED: no embedding runtime was available when the RVF index was opened; index left unbound (existing vectors are kept)",c=!1;function M(){c||(c=!0,console.warn(S))}function y(){c=!1}function T(e,n,i){if(i)try{e.prepare("UPDATE captured_experiences SET embedding_space_id = ? WHERE id = ?").run(i,n)}catch{}}function _(e){return`${e}.space.json`}function D(e,n,i){if(!n)throw new a("VECTOR_SPACE_UNVERIFIED",`cannot open ANN index ${e} without runtime provenance`);let t=_(e);if(l(t)){let d;try{d=JSON.parse(E(t,"utf8"))}catch{throw new a("VECTOR_SPACE_UNVERIFIED",`ANN index manifest ${t} is unreadable`)}if(d.version!==1||!d.spaceId)throw new a("VECTOR_SPACE_UNVERIFIED",`ANN index manifest ${t} has no verified space`);if(d.spaceId!==n)throw new a("VECTOR_SPACE_MISMATCH",`ANN index space ${d.spaceId} != active space ${n}`);return}if(i>0)throw new a("VECTOR_SPACE_UNVERIFIED",`populated ANN index ${e} has no embedding-space manifest; rebuild required`);let o={version:1,spaceId:n},r=`${t}.${process.pid}.tmp`;b(r,`${JSON.stringify(o)}
3
3
  `,{encoding:"utf8",mode:384}),f(r,t)}export{m as a,h as b,a as c,R as d,w as e,C as f,V as g,S as h,v as i,M as j,y as k,T as l,_ as m,D as n};
@@ -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.16");process.exit(0)}
2
- import{c as h,d as $}from"./chunk-AGRV5B3T.js";import{a as b,b as y,c as R,e as S,f as A}from"./chunk-I7MQIM2U.js";import{e as N,f as w}from"./chunk-ZFL436FN.js";import{a as g,f as C}from"./chunk-AJMJNQMP.js";$();var i=null,f=!1,p=class extends Error{constructor(e){super(e instanceof Error?e.message:String(e));this.lockError=e;this.name="RvfLiveLockError"}lockError};function V(r){i=r,f=r!==null}var B=(()=>{let r=process.env.AQE_RVF_SIZE_GUARD_BYTES,t=r?Number(r):NaN;return Number.isFinite(t)&&t>0?t:256*1024*1024})(),F=(()=>{let r=process.env.AQE_RVF_DEAD_RATIO_THRESHOLD,t=r?Number(r):NaN;return Number.isFinite(t)&&t>0&&t<=1?t:.3})();function k(r=".agentic-qe",t=384){if(f)return i;f=!0;try{let{isRvfNativeAvailable:e,createRvfStore:n,openRvfStore:o}=(w(),C(N));if(!e())return console.warn("[RVF] Native bindings unavailable \u2014 agent branching and dream COW disabled. Install @ruvector/rvf-node to enable."),null;let s=g("path"),l=s.isAbsolute(r)?r:s.join(process.env.AQE_PROJECT_ROOT??h(),r),u=s.join(l,"patterns.rvf");return i=_(o,n,u,t),T(i,u),i}catch(e){return e instanceof p||console.warn("[RVF] Shared adapter init failed:",e instanceof Error?e.message:e),null}}function _(r,t,e,n){let o=()=>{try{return{adapter:r(e),err:null}}catch(a){return{adapter:null,err:a}}},{adapter:s,err:l}=o(),u=!1;if(!s&&R(l))try{let a=g("fs"),c=`${e}.lock`;a.existsSync(c)&&y(e)?(u=!0,console.warn(`[RVF] ${e} is locked by a live process (pid ${b(e)}) \u2014 not breaking the lock; degrading to SQLite for this run.`)):S(e)&&(console.warn(`[RVF] Removed stale lock file at ${c} (prior process exited without closing). Retrying open. If you see this repeatedly under live concurrency, file an issue.`),{adapter:s,err:l}=o())}catch(a){process.env.DEBUG&&console.debug("[RVF] stale-lock recovery failed:",a instanceof Error?a.message:a)}if(u)throw new p(l);if(s){let a=s.dimension();if(a===n)return s;console.warn(`[RVF] patterns.rvf dimension mismatch: file=${a} requested=${n} \u2014 closing and degrading. Delete the .rvf file to recreate at the requested dim.`);try{s.close()}catch{}throw new Error(`RVF dimension mismatch (file=${a}, requested=${n})`)}try{return t(e,n)}catch(a){let c;try{c=r(e)}catch(m){if(R(m))throw m;if(A(e,a instanceof Error?a.message:String(a),m))return t(e,n);throw a instanceof Error?a:new Error(String(a))}let v=c.dimension();if(v!==n){try{c.close()}catch{}throw new Error(`RVF dimension mismatch after race (file=${v}, requested=${n})`)}return c}}function E(r,t){if(t?.force)return{shouldCompact:!0,trigger:"force"};let e=t?.sizeGuardBytes??B,n=t?.deadRatioThreshold??F;return r.fileSizeBytes>=e?{shouldCompact:!0,trigger:"size-guard"}:(r.deadSpaceRatio??0)>=n?{shouldCompact:!0,trigger:"dead-ratio"}:{shouldCompact:!1,trigger:"none"}}function q(r){if(!i)return null;let t;try{t=i.status()}catch{return null}let e=E(t,r);if(!e.shouldCompact)return null;let n=t.fileSizeBytes,o;try{o=i.compact()}catch{return null}return o?((o.bytesReclaimed>0||o.segmentsCompacted>0)&&console.log(`[RVF] compacted patterns.rvf: reclaimed ${d(o.bytesReclaimed)} (${o.segmentsCompacted} segments, fileSize ${d(n)} \u2192 ${d(Math.max(0,n-o.bytesReclaimed))}, trigger: ${e.trigger})`),o):null}function T(r,t){try{let e=r.status(),n=E(e);if(!n.shouldCompact)return null;let o=r.compact();return o&&(o.bytesReclaimed>0||o.segmentsCompacted>0)&&console.log(`[RVF] boot-time compact (${t}): reclaimed ${d(o.bytesReclaimed)} from ${o.segmentsCompacted} segments (trigger: ${n.trigger})`),o}catch(e){return process.env.DEBUG&&console.debug("[RVF] boot-time compact guard skipped:",e instanceof Error?e.message:e),null}}function d(r){if(!Number.isFinite(r)||r<0)return`${r}B`;let t=["B","KB","MB","GB","TB"],e=0,n=r;for(;n>=1024&&e<t.length-1;)n/=1024,e++;return`${n.toFixed(e===0?0:1)}${t[e]}`}function z(){if(i){try{i.close()}catch{}i=null}f=!1}export{p as a,V as b,k as c,_ as d,E as e,q as f,T as g,z as h};
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.18");process.exit(0)}
2
+ import{c as h,d as $}from"./chunk-YP2GHQSV.js";import{a as b,b as y,c as R,e as S,f as A}from"./chunk-WGXT5NWQ.js";import{e as N,f as w}from"./chunk-BSXKZDKO.js";import{a as g,f as C}from"./chunk-BDVFSMOQ.js";$();var i=null,f=!1,p=class extends Error{constructor(e){super(e instanceof Error?e.message:String(e));this.lockError=e;this.name="RvfLiveLockError"}lockError};function V(r){i=r,f=r!==null}var B=(()=>{let r=process.env.AQE_RVF_SIZE_GUARD_BYTES,t=r?Number(r):NaN;return Number.isFinite(t)&&t>0?t:256*1024*1024})(),F=(()=>{let r=process.env.AQE_RVF_DEAD_RATIO_THRESHOLD,t=r?Number(r):NaN;return Number.isFinite(t)&&t>0&&t<=1?t:.3})();function k(r=".agentic-qe",t=384){if(f)return i;f=!0;try{let{isRvfNativeAvailable:e,createRvfStore:n,openRvfStore:o}=(w(),C(N));if(!e())return console.warn("[RVF] Native bindings unavailable \u2014 agent branching and dream COW disabled. Install @ruvector/rvf-node to enable."),null;let s=g("path"),l=s.isAbsolute(r)?r:s.join(process.env.AQE_PROJECT_ROOT??h(),r),u=s.join(l,"patterns.rvf");return i=_(o,n,u,t),T(i,u),i}catch(e){return e instanceof p||console.warn("[RVF] Shared adapter init failed:",e instanceof Error?e.message:e),null}}function _(r,t,e,n){let o=()=>{try{return{adapter:r(e),err:null}}catch(a){return{adapter:null,err:a}}},{adapter:s,err:l}=o(),u=!1;if(!s&&R(l))try{let a=g("fs"),c=`${e}.lock`;a.existsSync(c)&&y(e)?(u=!0,console.warn(`[RVF] ${e} is locked by a live process (pid ${b(e)}) \u2014 not breaking the lock; degrading to SQLite for this run.`)):S(e)&&(console.warn(`[RVF] Removed stale lock file at ${c} (prior process exited without closing). Retrying open. If you see this repeatedly under live concurrency, file an issue.`),{adapter:s,err:l}=o())}catch(a){process.env.DEBUG&&console.debug("[RVF] stale-lock recovery failed:",a instanceof Error?a.message:a)}if(u)throw new p(l);if(s){let a=s.dimension();if(a===n)return s;console.warn(`[RVF] patterns.rvf dimension mismatch: file=${a} requested=${n} \u2014 closing and degrading. Delete the .rvf file to recreate at the requested dim.`);try{s.close()}catch{}throw new Error(`RVF dimension mismatch (file=${a}, requested=${n})`)}try{return t(e,n)}catch(a){let c;try{c=r(e)}catch(m){if(R(m))throw m;if(A(e,a instanceof Error?a.message:String(a),m))return t(e,n);throw a instanceof Error?a:new Error(String(a))}let v=c.dimension();if(v!==n){try{c.close()}catch{}throw new Error(`RVF dimension mismatch after race (file=${v}, requested=${n})`)}return c}}function E(r,t){if(t?.force)return{shouldCompact:!0,trigger:"force"};let e=t?.sizeGuardBytes??B,n=t?.deadRatioThreshold??F;return r.fileSizeBytes>=e?{shouldCompact:!0,trigger:"size-guard"}:(r.deadSpaceRatio??0)>=n?{shouldCompact:!0,trigger:"dead-ratio"}:{shouldCompact:!1,trigger:"none"}}function q(r){if(!i)return null;let t;try{t=i.status()}catch{return null}let e=E(t,r);if(!e.shouldCompact)return null;let n=t.fileSizeBytes,o;try{o=i.compact()}catch{return null}return o?((o.bytesReclaimed>0||o.segmentsCompacted>0)&&console.log(`[RVF] compacted patterns.rvf: reclaimed ${d(o.bytesReclaimed)} (${o.segmentsCompacted} segments, fileSize ${d(n)} \u2192 ${d(Math.max(0,n-o.bytesReclaimed))}, trigger: ${e.trigger})`),o):null}function T(r,t){try{let e=r.status(),n=E(e);if(!n.shouldCompact)return null;let o=r.compact();return o&&(o.bytesReclaimed>0||o.segmentsCompacted>0)&&console.log(`[RVF] boot-time compact (${t}): reclaimed ${d(o.bytesReclaimed)} from ${o.segmentsCompacted} segments (trigger: ${n.trigger})`),o}catch(e){return process.env.DEBUG&&console.debug("[RVF] boot-time compact guard skipped:",e instanceof Error?e.message:e),null}}function d(r){if(!Number.isFinite(r)||r<0)return`${r}B`;let t=["B","KB","MB","GB","TB"],e=0,n=r;for(;n>=1024&&e<t.length-1;)n/=1024,e++;return`${n.toFixed(e===0?0:1)}${t[e]}`}function z(){if(i){try{i.close()}catch{}i=null}f=!1}export{p as a,V as b,k as c,_ as d,E as e,q as f,T as g,z as h};
@@ -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.16");process.exit(0)}
2
- import{b as d,d as c}from"./chunk-V5NHZV7S.js";import{a as l,e as g}from"./chunk-KNSRL6NO.js";g();c();import{existsSync as y,readFileSync as p}from"node:fs";import{join as o,dirname as u}from"node:path";import{fileURLToPath as m}from"node:url";var i=class extends Error{constructor(t,n,r){super(t);this.code=n;this.cause=r;this.name="PatternLoaderError"}code;cause},s=class a{static instance=null;config;patterns;isLoading=!1;constructor(e={}){this.config={basePath:e.basePath??this.getDefaultBasePath(),throwOnMissing:e.throwOnMissing??!1,validatePatterns:e.validatePatterns??!0},this.patterns={index:null,booster:null,router:null,embedding:null,reasoning:null,loadedAt:null,errors:[]}}static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}static resetInstance(){a.instance=null}getDefaultBasePath(){try{let e=import.meta.url,t=m(e),n=u(t),r=o(n,"..","..","..");return o(r,"assets","patterns")}catch{return o(process.cwd(),"assets","patterns")}}async loadPatterns(){if(!this.isLoading){this.isLoading=!0,this.patterns.errors=[];try{this.patterns.index=this.loadJsonFile("index.json");let[e,t,n,r]=await Promise.all([Promise.resolve(this.loadJsonFile("adr-051-booster-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-router-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-embedding-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-reasoning-patterns.json"))]);this.patterns.booster=e,this.patterns.router=t,this.patterns.embedding=n,this.patterns.reasoning=r,this.patterns.loadedAt=new Date,this.config.validatePatterns&&this.validateLoadedPatterns()}finally{this.isLoading=!1}}}loadJsonFile(e){let t=o(this.config.basePath,e);try{if(!y(t)){let r=`Pattern file not found: ${t}`;if(this.patterns.errors.push(r),this.config.throwOnMissing)throw new i(r,"FILE_NOT_FOUND");return null}let n=p(t,"utf-8");return d(n)}catch(n){if(n instanceof i)throw n;let r=`Failed to load pattern file ${e}: ${l(n)}`;if(this.patterns.errors.push(r),this.config.throwOnMissing)throw new i(r,"PARSE_ERROR",n instanceof Error?n:void 0);return null}}validateLoadedPatterns(){this.patterns.booster&&(Array.isArray(this.patterns.booster.patterns)||this.patterns.errors.push("Booster patterns file missing patterns array")),this.patterns.router&&(Array.isArray(this.patterns.router.patterns)||this.patterns.errors.push("Router patterns file missing patterns array")),this.patterns.embedding&&(Array.isArray(this.patterns.embedding.patterns)||this.patterns.errors.push("Embedding patterns file missing patterns array")),this.patterns.reasoning&&(Array.isArray(this.patterns.reasoning.patterns)||this.patterns.errors.push("Reasoning patterns file missing patterns array"))}async ensureLoaded(){this.patterns.loadedAt||await this.loadPatterns()}async getIndex(){return await this.ensureLoaded(),this.patterns.index}async getBoosterPatterns(){return await this.ensureLoaded(),this.patterns.booster}async getRouterPatterns(){return await this.ensureLoaded(),this.patterns.router}async getEmbeddingPatterns(){return await this.ensureLoaded(),this.patterns.embedding}async getReasoningPatterns(){return await this.ensureLoaded(),this.patterns.reasoning}async getBoosterPatternByKey(e){let t=await this.getBoosterPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getRouterPatternByKey(e){let t=await this.getRouterPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getEmbeddingPatternByKey(e){let t=await this.getEmbeddingPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getReasoningPatternByKey(e){let t=await this.getReasoningPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getEligibleBoosterTransforms(){let e=await this.getBoosterPatternByKey("booster-transform-eligibility");return e?e.eligibility_criteria.simple_transforms:[]}async getTierHierarchy(){let e=await this.getRouterPatternByKey("router-5tier-complexity");return e?e.tier_hierarchy:null}async getQualityGateThresholds(){let e=await this.getReasoningPatternByKey("reasoning-pattern-quality-gates");return e?e.gate_thresholds:null}isLoaded(){return this.patterns.loadedAt!==null}getLoadedAt(){return this.patterns.loadedAt}getErrors(){return[...this.patterns.errors]}async getStatistics(){let e=await this.getIndex();return e?e.pattern_statistics:null}async reload(){this.patterns={index:null,booster:null,router:null,embedding:null,reasoning:null,loadedAt:null,errors:[]},await this.loadPatterns()}async getAllPatterns(){return await this.ensureLoaded(),{...this.patterns}}};function x(){return s.getInstance()}export{x as a};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.18");process.exit(0)}
2
+ import{b as d,d as c}from"./chunk-MQM37KAR.js";import{a as l,e as g}from"./chunk-AWQAE3SW.js";g();c();import{existsSync as y,readFileSync as p}from"node:fs";import{join as o,dirname as u}from"node:path";import{fileURLToPath as m}from"node:url";var i=class extends Error{constructor(t,n,r){super(t);this.code=n;this.cause=r;this.name="PatternLoaderError"}code;cause},s=class a{static instance=null;config;patterns;isLoading=!1;constructor(e={}){this.config={basePath:e.basePath??this.getDefaultBasePath(),throwOnMissing:e.throwOnMissing??!1,validatePatterns:e.validatePatterns??!0},this.patterns={index:null,booster:null,router:null,embedding:null,reasoning:null,loadedAt:null,errors:[]}}static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}static resetInstance(){a.instance=null}getDefaultBasePath(){try{let e=import.meta.url,t=m(e),n=u(t),r=o(n,"..","..","..");return o(r,"assets","patterns")}catch{return o(process.cwd(),"assets","patterns")}}async loadPatterns(){if(!this.isLoading){this.isLoading=!0,this.patterns.errors=[];try{this.patterns.index=this.loadJsonFile("index.json");let[e,t,n,r]=await Promise.all([Promise.resolve(this.loadJsonFile("adr-051-booster-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-router-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-embedding-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-reasoning-patterns.json"))]);this.patterns.booster=e,this.patterns.router=t,this.patterns.embedding=n,this.patterns.reasoning=r,this.patterns.loadedAt=new Date,this.config.validatePatterns&&this.validateLoadedPatterns()}finally{this.isLoading=!1}}}loadJsonFile(e){let t=o(this.config.basePath,e);try{if(!y(t)){let r=`Pattern file not found: ${t}`;if(this.patterns.errors.push(r),this.config.throwOnMissing)throw new i(r,"FILE_NOT_FOUND");return null}let n=p(t,"utf-8");return d(n)}catch(n){if(n instanceof i)throw n;let r=`Failed to load pattern file ${e}: ${l(n)}`;if(this.patterns.errors.push(r),this.config.throwOnMissing)throw new i(r,"PARSE_ERROR",n instanceof Error?n:void 0);return null}}validateLoadedPatterns(){this.patterns.booster&&(Array.isArray(this.patterns.booster.patterns)||this.patterns.errors.push("Booster patterns file missing patterns array")),this.patterns.router&&(Array.isArray(this.patterns.router.patterns)||this.patterns.errors.push("Router patterns file missing patterns array")),this.patterns.embedding&&(Array.isArray(this.patterns.embedding.patterns)||this.patterns.errors.push("Embedding patterns file missing patterns array")),this.patterns.reasoning&&(Array.isArray(this.patterns.reasoning.patterns)||this.patterns.errors.push("Reasoning patterns file missing patterns array"))}async ensureLoaded(){this.patterns.loadedAt||await this.loadPatterns()}async getIndex(){return await this.ensureLoaded(),this.patterns.index}async getBoosterPatterns(){return await this.ensureLoaded(),this.patterns.booster}async getRouterPatterns(){return await this.ensureLoaded(),this.patterns.router}async getEmbeddingPatterns(){return await this.ensureLoaded(),this.patterns.embedding}async getReasoningPatterns(){return await this.ensureLoaded(),this.patterns.reasoning}async getBoosterPatternByKey(e){let t=await this.getBoosterPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getRouterPatternByKey(e){let t=await this.getRouterPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getEmbeddingPatternByKey(e){let t=await this.getEmbeddingPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getReasoningPatternByKey(e){let t=await this.getReasoningPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getEligibleBoosterTransforms(){let e=await this.getBoosterPatternByKey("booster-transform-eligibility");return e?e.eligibility_criteria.simple_transforms:[]}async getTierHierarchy(){let e=await this.getRouterPatternByKey("router-5tier-complexity");return e?e.tier_hierarchy:null}async getQualityGateThresholds(){let e=await this.getReasoningPatternByKey("reasoning-pattern-quality-gates");return e?e.gate_thresholds:null}isLoaded(){return this.patterns.loadedAt!==null}getLoadedAt(){return this.patterns.loadedAt}getErrors(){return[...this.patterns.errors]}async getStatistics(){let e=await this.getIndex();return e?e.pattern_statistics:null}async reload(){this.patterns={index:null,booster:null,router:null,embedding:null,reasoning:null,loadedAt:null,errors:[]},await this.loadPatterns()}async getAllPatterns(){return await this.ensureLoaded(),{...this.patterns}}};function x(){return s.getInstance()}export{x as a};
@@ -1,5 +1,5 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.16");process.exit(0)}
2
- import{a as L}from"./chunk-YPBSUGMI.js";import{c as C}from"./chunk-L2DWPVNJ.js";import{e as D}from"./chunk-EA4YQVKS.js";import{c as f,d as G}from"./chunk-JDIYMZCQ.js";import{b as T,d as J}from"./chunk-V5NHZV7S.js";import{b as w,e as z}from"./chunk-S75SOOZL.js";import{a as V}from"./chunk-YAPLJR7K.js";import{c as A}from"./chunk-G5RHFBAY.js";import{S as j,j as E}from"./chunk-L6QSTQME.js";import{b as S,d as Q}from"./chunk-AGRV5B3T.js";J();var B=["oracle:test-exec","judge:llm","proxy:structural"],d="proxy:structural";function X(r){return r&&B.includes(r)?r:d}function m(r,e={}){switch(X(r)){case"oracle:test-exec":return!0;case"judge:llm":return e.allowJudgeTier===!0;default:return!1}}import{createHash as I}from"node:crypto";function x(r,e){let t=r.length;if(t===0)return-1/0;let n=e?.iters??2e3,a=e?.alpha??.05,o=(e?.seed??2654435761)>>>0,s=()=>(o=Math.imul(o,1664525)+1013904223>>>0,o/4294967296),c=new Array(n);for(let u=0;u<n;u++){let l=0;for(let h=0;h<t;h++)l+=r[Math.floor(s()*t)];c[u]=l/t}c.sort((u,l)=>u-l);let i=Math.min(Math.floor(a*n),n-1);return c[i]}function N(r,e){let t=Math.min(r.length,e.length),n=new Array(t);for(let a=0;a<t;a++)n[a]=r[a]-e[a];return n}z();var M=r=>m(r.provenanceTier,{allowJudgeTier:r.allowJudgeTier})?r.candidateHeldOut>r.baselineHeldOut?C(r.candidateAnchorMean,r.baselineAnchorMean,r.anchorTol)?{promote:!0,reason:"held-out gain, no anchor regression, oracle-tier evidence"}:{promote:!1,reason:`anchor regression: ${r.candidateAnchorMean} < ${r.baselineAnchorMean} - ${r.anchorTol}`}:{promote:!1,reason:`held-out ${r.candidateHeldOut} did not beat baseline ${r.baselineHeldOut}`}:{promote:!1,reason:`provenance tier '${r.provenanceTier}' not allowed to promote`},O=8,U=1e-6,k=r=>r.reduce((e,t)=>e+t,0)/r.length,Y=r=>{let e=M(r);if(!e.promote)return e;let t=r.candidateHeldOutSamples,n=r.baselineHeldOutSamples;if(!t||!n||t.length===0||t.length!==n.length)return{promote:!1,reason:"significance gate: missing/mismatched paired held-out samples (need equal-length candidate & baseline per-task vectors)"};if(t.length<O)return{promote:!1,reason:`significance gate: only ${t.length} paired samples (< ${O}) \u2014 a bootstrap CI is not meaningful; fail closed rather than certify noise`};if(Math.abs(k(t)-r.candidateHeldOut)>U||Math.abs(k(n)-r.baselineHeldOut)>U)return{promote:!1,reason:"significance gate: sealed sample means do not match the sealed held-out scalars \u2014 inconsistent/forged evaluation"};let a=x(N(t,n));return a>0?{promote:!0,reason:`${e.reason}; paired gain significant (CI low ${a.toFixed(4)} > 0)`}:{promote:!1,reason:`significance gate: paired held-out gain not significant (95% CI lower bound ${a.toFixed(4)} \u2264 0)`}},me=Object.freeze({"accept/v1":M,"accept/v1+sig":Y});function y(r){if(r===null||typeof r!="object")return JSON.stringify(r)??"null";if(Array.isArray(r))return`[${r.map(y).join(",")}]`;let e=r;return`{${Object.keys(e).filter(n=>e[n]!==void 0).sort().map(n=>`${JSON.stringify(n)}:${y(e[n])}`).join(",")}}`}var K="aqe:promotion-path-rule:v1+sig",Z=r=>m(r.provenanceTier,{allowJudgeTier:r.allowJudgeTier})?r.reward===void 0||r.rewardThreshold===void 0||!(r.reward>=r.rewardThreshold)?{promote:!1,reason:`reward ${r.reward} below threshold ${r.rewardThreshold}`}:r.occurrences===void 0||r.occurrenceThreshold===void 0||!(r.occurrences>=r.occurrenceThreshold)?{promote:!1,reason:`occurrences ${r.occurrences} below threshold ${r.occurrenceThreshold}`}:r.successRate===void 0||r.successRateThreshold===void 0||!(r.successRate>=r.successRateThreshold)?{promote:!1,reason:`success rate ${r.successRate} below threshold ${r.successRateThreshold}`}:r.withinActivityWindow!==!0?{promote:!1,reason:"pattern outside promotion activity window (stale)"}:{promote:!0,reason:"tier allowed; reward/occurrence/success-rate thresholds met; within activity window"}:{promote:!1,reason:`provenance tier '${r.provenanceTier}' not allowed to promote`},ee=r=>m(r.provenanceTier,{allowJudgeTier:r.allowJudgeTier})?r.insightConfidence===void 0||r.insightConfidenceThreshold===void 0||!(r.insightConfidence>=r.insightConfidenceThreshold)?{promote:!1,reason:`insight confidence ${r.insightConfidence} below threshold ${r.insightConfidenceThreshold}`}:r.insightActionable!==!0?{promote:!1,reason:"insight produced no actionable reorganization"}:{promote:!0,reason:"tier allowed; insight confidence meets threshold; actionable"}:{promote:!1,reason:`provenance tier '${r.provenanceTier}' not allowed to apply`},F=Object.freeze({"pattern-promote/v1":Z,"dream-apply/v1":ee});function b(r){return I("sha256").update(y(r)).digest("hex")}function _(r){if(!Object.hasOwn(F,r))throw new Error(`Unknown promotion-path rule version '${r}' \u2014 cannot fingerprint an unregistered rule.`);return I("sha256").update(K).update("\0").update(r).digest("hex")}function P(r,e){let t=w(F,r);if(!t)throw new Error(`Unknown promotion-path rule version '${r}' \u2014 refusing to re-execute an unregistered rule.`);return t(e)}function H(r,e={}){let t=[],n=b(r.sealed)===r.sealedHash;n||t.push("sealIntact");let a=!1;try{let c=_(r.ruleVersion);a=r.ruleFingerprint===c&&(e.pinnedRuleFingerprint===void 0||r.ruleFingerprint===e.pinnedRuleFingerprint)}catch{a=!1}a||t.push("gateUnchanged");let o=!1;n&&a&&(o=(P(r.ruleVersion,r.sealed).promote?"promote":"reject")===r.recordedVerdict),o||t.push("gateReExecutes");let s=t.length===0;return{valid:s,checks:{sealIntact:n,gateUnchanged:a,gateReExecutes:o},failures:t,reason:s?"promotion verified: sealed inputs intact, rule unchanged, frozen rule re-execution reproduces the recorded verdict":`promotion INVALID (failed: ${t.join(", ")}) \u2014 the recorded verdict is not reproducible under the frozen rule`}}V();j();G();var p=A.create("pattern-lifecycle"),te={promotionRewardThreshold:.7,promotionMinOccurrences:D,promotionMinSuccessRate:.7,deprecationFailureThreshold:3,staleDaysThreshold:30,confidenceDecayRate:.01,minActiveConfidence:.3,maxAgeForActivePatterns:90,promotionActivityWindowDays:30,asymmetricLearning:{},allowJudgeTierPromotion:!1},q=5,re=.9,ne=2;function ae(r,e){return e<q||!Number.isFinite(r)?0:Math.min(Math.max(r,0),1)}var R=class{constructor(e,t={}){this.db=e;this.config={...te,...t},this.asymmetricEngine=new L(this.config.asymmetricLearning),$(this.db)}db;config;asymmetricEngine;_witnessChain=null;set witnessChain(e){this._witnessChain=e}_compressionService=null;set compressionService(e){this._compressionService=e}getRecentExperiences(e={}){let t=e.minReward??this.config.promotionRewardThreshold,n=e.limit??100,a=e.sinceDays??7;if(!this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='captured_experiences'").get())return p.debug("captured_experiences table not found"),[];let s=new Date(Date.now()-a*864e5).toISOString().replace("T"," ").slice(0,19);return this.db.prepare(`
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.18");process.exit(0)}
2
+ import{a as L}from"./chunk-7XTUKKRA.js";import{c as C}from"./chunk-MKRKRXTX.js";import{e as D}from"./chunk-Y4LSEOZ3.js";import{b as w,e as z}from"./chunk-MZRBNBB3.js";import{c as f,d as G}from"./chunk-YFILS5D5.js";import{b as T,d as J}from"./chunk-MQM37KAR.js";import{a as V}from"./chunk-O5EWFR76.js";import{c as A}from"./chunk-NKU3FFM4.js";import{S as j,j as E}from"./chunk-V2LJ54KP.js";import{b as S,d as Q}from"./chunk-YP2GHQSV.js";J();var B=["oracle:test-exec","judge:llm","proxy:structural"],d="proxy:structural";function X(r){return r&&B.includes(r)?r:d}function m(r,e={}){switch(X(r)){case"oracle:test-exec":return!0;case"judge:llm":return e.allowJudgeTier===!0;default:return!1}}import{createHash as I}from"node:crypto";function x(r,e){let t=r.length;if(t===0)return-1/0;let n=e?.iters??2e3,a=e?.alpha??.05,o=(e?.seed??2654435761)>>>0,s=()=>(o=Math.imul(o,1664525)+1013904223>>>0,o/4294967296),c=new Array(n);for(let u=0;u<n;u++){let l=0;for(let h=0;h<t;h++)l+=r[Math.floor(s()*t)];c[u]=l/t}c.sort((u,l)=>u-l);let i=Math.min(Math.floor(a*n),n-1);return c[i]}function N(r,e){let t=Math.min(r.length,e.length),n=new Array(t);for(let a=0;a<t;a++)n[a]=r[a]-e[a];return n}z();var M=r=>m(r.provenanceTier,{allowJudgeTier:r.allowJudgeTier})?r.candidateHeldOut>r.baselineHeldOut?C(r.candidateAnchorMean,r.baselineAnchorMean,r.anchorTol)?{promote:!0,reason:"held-out gain, no anchor regression, oracle-tier evidence"}:{promote:!1,reason:`anchor regression: ${r.candidateAnchorMean} < ${r.baselineAnchorMean} - ${r.anchorTol}`}:{promote:!1,reason:`held-out ${r.candidateHeldOut} did not beat baseline ${r.baselineHeldOut}`}:{promote:!1,reason:`provenance tier '${r.provenanceTier}' not allowed to promote`},O=8,U=1e-6,k=r=>r.reduce((e,t)=>e+t,0)/r.length,Y=r=>{let e=M(r);if(!e.promote)return e;let t=r.candidateHeldOutSamples,n=r.baselineHeldOutSamples;if(!t||!n||t.length===0||t.length!==n.length)return{promote:!1,reason:"significance gate: missing/mismatched paired held-out samples (need equal-length candidate & baseline per-task vectors)"};if(t.length<O)return{promote:!1,reason:`significance gate: only ${t.length} paired samples (< ${O}) \u2014 a bootstrap CI is not meaningful; fail closed rather than certify noise`};if(Math.abs(k(t)-r.candidateHeldOut)>U||Math.abs(k(n)-r.baselineHeldOut)>U)return{promote:!1,reason:"significance gate: sealed sample means do not match the sealed held-out scalars \u2014 inconsistent/forged evaluation"};let a=x(N(t,n));return a>0?{promote:!0,reason:`${e.reason}; paired gain significant (CI low ${a.toFixed(4)} > 0)`}:{promote:!1,reason:`significance gate: paired held-out gain not significant (95% CI lower bound ${a.toFixed(4)} \u2264 0)`}},me=Object.freeze({"accept/v1":M,"accept/v1+sig":Y});function y(r){if(r===null||typeof r!="object")return JSON.stringify(r)??"null";if(Array.isArray(r))return`[${r.map(y).join(",")}]`;let e=r;return`{${Object.keys(e).filter(n=>e[n]!==void 0).sort().map(n=>`${JSON.stringify(n)}:${y(e[n])}`).join(",")}}`}var K="aqe:promotion-path-rule:v1+sig",Z=r=>m(r.provenanceTier,{allowJudgeTier:r.allowJudgeTier})?r.reward===void 0||r.rewardThreshold===void 0||!(r.reward>=r.rewardThreshold)?{promote:!1,reason:`reward ${r.reward} below threshold ${r.rewardThreshold}`}:r.occurrences===void 0||r.occurrenceThreshold===void 0||!(r.occurrences>=r.occurrenceThreshold)?{promote:!1,reason:`occurrences ${r.occurrences} below threshold ${r.occurrenceThreshold}`}:r.successRate===void 0||r.successRateThreshold===void 0||!(r.successRate>=r.successRateThreshold)?{promote:!1,reason:`success rate ${r.successRate} below threshold ${r.successRateThreshold}`}:r.withinActivityWindow!==!0?{promote:!1,reason:"pattern outside promotion activity window (stale)"}:{promote:!0,reason:"tier allowed; reward/occurrence/success-rate thresholds met; within activity window"}:{promote:!1,reason:`provenance tier '${r.provenanceTier}' not allowed to promote`},ee=r=>m(r.provenanceTier,{allowJudgeTier:r.allowJudgeTier})?r.insightConfidence===void 0||r.insightConfidenceThreshold===void 0||!(r.insightConfidence>=r.insightConfidenceThreshold)?{promote:!1,reason:`insight confidence ${r.insightConfidence} below threshold ${r.insightConfidenceThreshold}`}:r.insightActionable!==!0?{promote:!1,reason:"insight produced no actionable reorganization"}:{promote:!0,reason:"tier allowed; insight confidence meets threshold; actionable"}:{promote:!1,reason:`provenance tier '${r.provenanceTier}' not allowed to apply`},F=Object.freeze({"pattern-promote/v1":Z,"dream-apply/v1":ee});function b(r){return I("sha256").update(y(r)).digest("hex")}function _(r){if(!Object.hasOwn(F,r))throw new Error(`Unknown promotion-path rule version '${r}' \u2014 cannot fingerprint an unregistered rule.`);return I("sha256").update(K).update("\0").update(r).digest("hex")}function P(r,e){let t=w(F,r);if(!t)throw new Error(`Unknown promotion-path rule version '${r}' \u2014 refusing to re-execute an unregistered rule.`);return t(e)}function H(r,e={}){let t=[],n=b(r.sealed)===r.sealedHash;n||t.push("sealIntact");let a=!1;try{let c=_(r.ruleVersion);a=r.ruleFingerprint===c&&(e.pinnedRuleFingerprint===void 0||r.ruleFingerprint===e.pinnedRuleFingerprint)}catch{a=!1}a||t.push("gateUnchanged");let o=!1;n&&a&&(o=(P(r.ruleVersion,r.sealed).promote?"promote":"reject")===r.recordedVerdict),o||t.push("gateReExecutes");let s=t.length===0;return{valid:s,checks:{sealIntact:n,gateUnchanged:a,gateReExecutes:o},failures:t,reason:s?"promotion verified: sealed inputs intact, rule unchanged, frozen rule re-execution reproduces the recorded verdict":`promotion INVALID (failed: ${t.join(", ")}) \u2014 the recorded verdict is not reproducible under the frozen rule`}}V();j();G();var p=A.create("pattern-lifecycle"),te={promotionRewardThreshold:.7,promotionMinOccurrences:D,promotionMinSuccessRate:.7,deprecationFailureThreshold:3,staleDaysThreshold:30,confidenceDecayRate:.01,minActiveConfidence:.3,maxAgeForActivePatterns:90,promotionActivityWindowDays:30,asymmetricLearning:{},allowJudgeTierPromotion:!1},q=5,re=.9,ne=2;function ae(r,e){return e<q||!Number.isFinite(r)?0:Math.min(Math.max(r,0),1)}var R=class{constructor(e,t={}){this.db=e;this.config={...te,...t},this.asymmetricEngine=new L(this.config.asymmetricLearning),$(this.db)}db;config;asymmetricEngine;_witnessChain=null;set witnessChain(e){this._witnessChain=e}_compressionService=null;set compressionService(e){this._compressionService=e}getRecentExperiences(e={}){let t=e.minReward??this.config.promotionRewardThreshold,n=e.limit??100,a=e.sinceDays??7;if(!this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='captured_experiences'").get())return p.debug("captured_experiences table not found"),[];let s=new Date(Date.now()-a*864e5).toISOString().replace("T"," ").slice(0,19);return this.db.prepare(`
3
3
  SELECT
4
4
  domain as task_type,
5
5
  COUNT(*) as count,
@@ -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.16");process.exit(0)}
2
- import{S as f,b as p}from"./chunk-L6QSTQME.js";f();var y={predictionWindowSize:10,compressionThreshold:.3,maxConcurrentStreams:8,oscillationFrequencyMs:100};function d(s){try{return JSON.stringify(s).length}catch{return 0}}function w(s,t){let e={},n=!1;for(let r of Object.keys(t))JSON.stringify(s[r])!==JSON.stringify(t[r])&&(e[r]=t[r],n=!0);for(let r of Object.keys(s))r in t||(e[r]=void 0,n=!0);return n?e:null}function v(s,t){let e={...s};for(let[n,r]of Object.entries(t))r===void 0?delete e[n]:e[n]=r;return e}var l=class{windowSize;windows=new Map;constructor(t){this.windowSize=Math.max(1,t)}predict(t){let e=this.windows.get(t);if(!e||e.length===0)return null;let n=e[e.length-1];return typeof n!="object"||n===null||Array.isArray(n)?null:{...n}}record(t,e){let n=this.windows.get(t);n||(n=[],this.windows.set(t,n)),n.push(e),n.length>this.windowSize&&n.shift()}removeStream(t){this.windows.delete(t)}},h=class{maxStreams;cycleMs;streamIds=[];currentIndex=0;constructor(t,e){this.maxStreams=Math.max(1,t),this.cycleMs=Math.max(1,e)}addStream(t){return this.streamIds.includes(t)||this.streamIds.length>=this.maxStreams?!1:(this.streamIds.push(t),!0)}removeStream(t){let e=this.streamIds.indexOf(t);return e===-1?!1:(this.streamIds.splice(e,1),this.currentIndex>=this.streamIds.length&&(this.currentIndex=0),!0)}nextStream(){if(this.streamIds.length===0)return null;let t=this.streamIds[this.currentIndex];return this.currentIndex=(this.currentIndex+1)%this.streamIds.length,t}getActiveStreams(){return[...this.streamIds]}get activeCount(){return this.streamIds.length}},g=class{config;predictor;router;lastPayloads=new Map;totalMessages=0;compressedMessages=0;totalOriginalBytes=0;totalCompressedBytes=0;constructor(t){this.config={...y,...t},this.predictor=new l(this.config.predictionWindowSize),this.router=new h(this.config.maxConcurrentStreams,this.config.oscillationFrequencyMs)}send(t,e,n,r){this.totalMessages++;let i=d(r);this.totalOriginalBytes+=i;let c=!1,o=r,a=i;if(typeof r=="object"&&r!==null&&!Array.isArray(r)){let m=this.predictor.predict(t);if(m){let u=w(m,r);u?1-d(u)/Math.max(i,1)>=this.config.compressionThreshold&&(o={__delta:!0,__changes:u},a=d(o),c=!0,this.compressedMessages++):(o={__delta:!0,__changes:{}},a=d(o),c=!0,this.compressedMessages++)}}return this.totalCompressedBytes+=a,this.predictor.record(t,r),this.lastPayloads.set(t,r),{streamId:t,senderId:e,receiverId:n,payload:o,compressed:c,originalSize:i,compressedSize:a,timestamp:Date.now()}}receive(t){if(!t.compressed||typeof t.payload!="object"||t.payload===null)return this.lastPayloads.set(t.streamId,t.payload),this.predictor.record(t.streamId,t.payload),t.payload;let e=t.payload;if(!e.__delta)return this.lastPayloads.set(t.streamId,t.payload),this.predictor.record(t.streamId,t.payload),t.payload;let n=this.predictor.predict(t.streamId),r=e.__changes??{};if(!n)return r;let i=v(n,r);return this.predictor.record(t.streamId,i),this.lastPayloads.set(t.streamId,i),i}getStats(){let t=this.totalOriginalBytes-this.totalCompressedBytes;return{totalMessages:this.totalMessages,compressedMessages:this.compressedMessages,bandwidthSavedBytes:Math.max(0,t),bandwidthReductionPercent:this.totalOriginalBytes>0?Math.max(0,t)/this.totalOriginalBytes*100:0,activeStreams:this.router.activeCount}}addStream(t){this.router.addStream(t)}removeStream(t){this.router.removeStream(t),this.predictor.removeStream(t),this.lastPayloads.delete(t)}};function M(s){return S()?new g(s):null}function S(){return p().useCognitiveRouting}export{M 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.18");process.exit(0)}
2
+ import{S as f,b as p}from"./chunk-V2LJ54KP.js";f();var y={predictionWindowSize:10,compressionThreshold:.3,maxConcurrentStreams:8,oscillationFrequencyMs:100};function d(s){try{return JSON.stringify(s).length}catch{return 0}}function w(s,t){let e={},n=!1;for(let r of Object.keys(t))JSON.stringify(s[r])!==JSON.stringify(t[r])&&(e[r]=t[r],n=!0);for(let r of Object.keys(s))r in t||(e[r]=void 0,n=!0);return n?e:null}function v(s,t){let e={...s};for(let[n,r]of Object.entries(t))r===void 0?delete e[n]:e[n]=r;return e}var l=class{windowSize;windows=new Map;constructor(t){this.windowSize=Math.max(1,t)}predict(t){let e=this.windows.get(t);if(!e||e.length===0)return null;let n=e[e.length-1];return typeof n!="object"||n===null||Array.isArray(n)?null:{...n}}record(t,e){let n=this.windows.get(t);n||(n=[],this.windows.set(t,n)),n.push(e),n.length>this.windowSize&&n.shift()}removeStream(t){this.windows.delete(t)}},h=class{maxStreams;cycleMs;streamIds=[];currentIndex=0;constructor(t,e){this.maxStreams=Math.max(1,t),this.cycleMs=Math.max(1,e)}addStream(t){return this.streamIds.includes(t)||this.streamIds.length>=this.maxStreams?!1:(this.streamIds.push(t),!0)}removeStream(t){let e=this.streamIds.indexOf(t);return e===-1?!1:(this.streamIds.splice(e,1),this.currentIndex>=this.streamIds.length&&(this.currentIndex=0),!0)}nextStream(){if(this.streamIds.length===0)return null;let t=this.streamIds[this.currentIndex];return this.currentIndex=(this.currentIndex+1)%this.streamIds.length,t}getActiveStreams(){return[...this.streamIds]}get activeCount(){return this.streamIds.length}},g=class{config;predictor;router;lastPayloads=new Map;totalMessages=0;compressedMessages=0;totalOriginalBytes=0;totalCompressedBytes=0;constructor(t){this.config={...y,...t},this.predictor=new l(this.config.predictionWindowSize),this.router=new h(this.config.maxConcurrentStreams,this.config.oscillationFrequencyMs)}send(t,e,n,r){this.totalMessages++;let i=d(r);this.totalOriginalBytes+=i;let c=!1,o=r,a=i;if(typeof r=="object"&&r!==null&&!Array.isArray(r)){let m=this.predictor.predict(t);if(m){let u=w(m,r);u?1-d(u)/Math.max(i,1)>=this.config.compressionThreshold&&(o={__delta:!0,__changes:u},a=d(o),c=!0,this.compressedMessages++):(o={__delta:!0,__changes:{}},a=d(o),c=!0,this.compressedMessages++)}}return this.totalCompressedBytes+=a,this.predictor.record(t,r),this.lastPayloads.set(t,r),{streamId:t,senderId:e,receiverId:n,payload:o,compressed:c,originalSize:i,compressedSize:a,timestamp:Date.now()}}receive(t){if(!t.compressed||typeof t.payload!="object"||t.payload===null)return this.lastPayloads.set(t.streamId,t.payload),this.predictor.record(t.streamId,t.payload),t.payload;let e=t.payload;if(!e.__delta)return this.lastPayloads.set(t.streamId,t.payload),this.predictor.record(t.streamId,t.payload),t.payload;let n=this.predictor.predict(t.streamId),r=e.__changes??{};if(!n)return r;let i=v(n,r);return this.predictor.record(t.streamId,i),this.lastPayloads.set(t.streamId,i),i}getStats(){let t=this.totalOriginalBytes-this.totalCompressedBytes;return{totalMessages:this.totalMessages,compressedMessages:this.compressedMessages,bandwidthSavedBytes:Math.max(0,t),bandwidthReductionPercent:this.totalOriginalBytes>0?Math.max(0,t)/this.totalOriginalBytes*100:0,activeStreams:this.router.activeCount}}addStream(t){this.router.addStream(t)}removeStream(t){this.router.removeStream(t),this.predictor.removeStream(t),this.lastPayloads.delete(t)}};function M(s){return S()?new g(s):null}function S(){return p().useCognitiveRouting}export{M as a,S as b};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.16");process.exit(0)}
2
- import{b as h,d as v,f as T}from"./chunk-AJMJNQMP.js";var y={};v(y,{DotProductAttention:()=>z,FlashAttention:()=>k,HyperbolicAttention:()=>C,LinearAttention:()=>j,MoEAttention:()=>W,MultiHeadAttention:()=>F,RuvectorLayer:()=>I,SonaEngine:()=>K,TensorCompress:()=>E,default:()=>_,differentiableSearch:()=>L,getCompressionLevel:()=>B,hierarchicalForward:()=>V,init:()=>D,pipeline:()=>q});import{createRequire as A}from"module";var O,g,_,I,E,L,V,B,D,k,z,F,C,j,W,K,q,R=h(()=>{O=A(import.meta.url),g=O("@ruvector/rvf-node"),_=g,{RuvectorLayer:I,TensorCompress:E,differentiableSearch:L,hierarchicalForward:V,getCompressionLevel:B,init:D,FlashAttention:k,DotProductAttention:z,MultiHeadAttention:F,HyperbolicAttention:C,LinearAttention:j,MoEAttention:W,SonaEngine:K,pipeline:q}=g||{}});var Z={};v(Z,{createRvfStore:()=>$,isRvfNativeAvailable:()=>X,openRvfStore:()=>G,openRvfStoreReadonly:()=>U});import{readFileSync as J,writeFileSync as H,copyFileSync as Q,existsSync as Y}from"fs";function c(){if(S)return m;S=!0;try{let s=(R(),T(y));!s.RvfDatabase&&s.default&&s.default.RvfDatabase&&(s=s.default),m=s}catch{m=null}return m}function w(s){return`${s}.idmap.json`}function N(s){let e=w(s),t=new Map,n=new Map,i=1;if(Y(e))try{let r=JSON.parse(J(e,"utf-8"));i=r.nextLabel;for(let[a,p]of r.entries)t.set(a,p),n.set(p,a)}catch{}return{strToNum:t,numToStr:n,nextLabel:i}}function b(s,e,t){let n={nextLabel:t,entries:Array.from(e.entries())};H(w(s),JSON.stringify(n),"utf-8")}function $(s,e){let t=c();if(!t)throw new Error("@ruvector/rvf-node is not available \u2014 install the package or check platform compatibility");let n=t.RvfDatabase.create(s,{dimension:e}),i=n.dimension();return new d(n,s,i,new Map,new Map,1)}function G(s){let e=c();if(!e)throw new Error("@ruvector/rvf-node is not available \u2014 install the package or check platform compatibility");let t=e.RvfDatabase.open(s),n=t.dimension(),{strToNum:i,numToStr:r,nextLabel:a}=N(s);return new d(t,s,n,i,r,a)}function U(s){let e=c();if(!e)throw new Error("@ruvector/rvf-node is not available \u2014 install the package or check platform compatibility");let t=e.RvfDatabase.openReadonly(s),n=t.dimension(),{strToNum:i,numToStr:r,nextLabel:a}=N(s);return new d(t,s,n,i,r,a)}function X(){return process.env.AQE_MEMORY_BACKEND==="memory"?!1:c()!==null}var m,S,d,P=h(()=>{m=null,S=!1;d=class s{db;_path;_dimension;strToNum;numToStr;nextLabel;_open;constructor(e,t,n,i,r,a){this.db=e,this._path=t,this._dimension=n,this.strToNum=i,this.numToStr=r,this.nextLabel=a,this._open=!0}ingest(e){if(this.ensureOpen(),e.length===0)return{accepted:0,rejected:0};let t=this._dimension,n=new Float32Array(e.length*t),i=[],r=[];for(let o=0;o<e.length;o++){let{id:u,vector:f,metadata:x}=e[o],l=this.strToNum.get(u);l===void 0&&(l=this.nextLabel++,this.strToNum.set(u,l),this.numToStr.set(l,u)),i.push(l),r.push(x);let M=f instanceof Float32Array?f:new Float32Array(f);n.set(M.subarray(0,t),o*t)}let a;if(r.some(o=>o!==void 0)&&typeof this.db.ingestBatchWithMetadata=="function"){let o=r.map(u=>u?JSON.stringify(u):"");a=this.db.ingestBatchWithMetadata(n,i,o)}else a=this.db.ingestBatch(n,i);return this.persistIdMap(),{accepted:a.accepted,rejected:a.rejected}}has(e){return this.ensureOpen(),this.strToNum.has(e)}search(e,t){this.ensureOpen();let n=e instanceof Float32Array?e:new Float32Array(e);return this.db.query(n,t).map(r=>{let a=this.numToStr.get(r.id);return a===void 0?null:{id:a,distance:r.distance,score:1/(1+r.distance)}}).filter(r=>r!==null)}delete(e){this.ensureOpen();let t=[];for(let i of e){let r=this.strToNum.get(i);r!==void 0&&t.push(r)}if(t.length===0)return 0;let n=this.db.delete(t);for(let i of e){let r=this.strToNum.get(i);r!==void 0&&(this.strToNum.delete(i),this.numToStr.delete(r))}return this.persistIdMap(),n.deleted}fork(e){this.ensureOpen(),Q(this._path,e);let t=new Map(this.strToNum),n=new Map(this.numToStr);b(e,t,this.nextLabel);let r=c().RvfDatabase.open(e);return new s(r,e,this._dimension,t,n,this.nextLabel)}status(){this.ensureOpen();let e=this.db.status(),n=this.db.segments().filter(i=>i.segType==="witness");return{totalVectors:e.totalVectors,totalSegments:e.totalSegments,fileSizeBytes:e.fileSize,epoch:e.currentEpoch,witnessValid:n.length>0,witnessEntries:n.length,deadSpaceRatio:typeof e.deadSpaceRatio=="number"?e.deadSpaceRatio:0}}dimension(){return this._dimension}size(){return this.ensureOpen(),this.db.status().totalVectors}compact(){this.ensureOpen();try{let e=this.db.compact();return e&&typeof e=="object"?{segmentsCompacted:typeof e.segmentsCompacted=="number"?e.segmentsCompacted:0,bytesReclaimed:typeof e.bytesReclaimed=="number"?e.bytesReclaimed:0,epoch:typeof e.epoch=="number"?e.epoch:0}:{segmentsCompacted:0,bytesReclaimed:0,epoch:0}}catch{return null}}close(){this._open&&(this.db.close(),this._open=!1)}isOpen(){return this._open}path(){return this._path}embedKernel(e){return this.ensureOpen(),this.db.embedKernel(0,99,0,e,0,"")}extractKernel(){return this.ensureOpen(),this.db.extractKernel()}verifyWitness(){this.ensureOpen();let e=this.tryNative("verifyWitness");return e?{valid:e.valid??!0,totalEntries:e.totalEntries??0,errors:Array.isArray(e.errors)?e.errors:[]}:{valid:!0,totalEntries:0,errors:[]}}sign(e){this.ensureOpen();let t=this.tryNative("sign",e);return typeof t=="string"?t:null}fileId(){this.ensureOpen();let e=this.tryNative("fileId");return typeof e=="string"?e:null}parentId(){this.ensureOpen();let e=this.tryNative("parentId");return typeof e=="string"?e:null}lineageDepth(){this.ensureOpen();let e=this.tryNative("lineageDepth");return typeof e=="number"?e:0}indexStats(){let e=this.status();return{totalVectors:e.totalVectors,dimension:this._dimension,totalSegments:e.totalSegments,fileSizeBytes:e.fileSizeBytes,epoch:e.epoch,witnessValid:e.witnessValid,witnessEntries:e.witnessEntries,idMapSize:this.strToNum.size}}freeze(){this.ensureOpen();let e=this.tryNative("freeze");return typeof e=="number"?e:0}derive(e){this.ensureOpen();let t=c();if(typeof this.db.derive=="function")try{let n=this.db.derive(e),i=new Map(this.strToNum),r=new Map(this.numToStr);return b(e,i,this.nextLabel),new s(n,e,this._dimension,i,r,this.nextLabel)}catch{}return this.fork(e)}ensureOpen(){if(!this._open)throw new Error("RVF database is closed")}tryNative(e,...t){if(typeof this.db[e]!="function")return null;try{return this.db[e](...t)}catch{return null}}persistIdMap(){b(this._path,this.strToNum,this.nextLabel)}}});export{$ as a,G as b,U as c,X as d,Z as e,P as f};
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.18");process.exit(0)}
2
+ import{b as h,d as v,f as T}from"./chunk-BDVFSMOQ.js";var y={};v(y,{DotProductAttention:()=>z,FlashAttention:()=>k,HyperbolicAttention:()=>C,LinearAttention:()=>j,MoEAttention:()=>W,MultiHeadAttention:()=>F,RuvectorLayer:()=>I,SonaEngine:()=>K,TensorCompress:()=>E,default:()=>_,differentiableSearch:()=>L,getCompressionLevel:()=>B,hierarchicalForward:()=>V,init:()=>D,pipeline:()=>q});import{createRequire as A}from"module";var O,g,_,I,E,L,V,B,D,k,z,F,C,j,W,K,q,R=h(()=>{O=A(import.meta.url),g=O("@ruvector/rvf-node"),_=g,{RuvectorLayer:I,TensorCompress:E,differentiableSearch:L,hierarchicalForward:V,getCompressionLevel:B,init:D,FlashAttention:k,DotProductAttention:z,MultiHeadAttention:F,HyperbolicAttention:C,LinearAttention:j,MoEAttention:W,SonaEngine:K,pipeline:q}=g||{}});var Z={};v(Z,{createRvfStore:()=>$,isRvfNativeAvailable:()=>X,openRvfStore:()=>G,openRvfStoreReadonly:()=>U});import{readFileSync as J,writeFileSync as H,copyFileSync as Q,existsSync as Y}from"fs";function c(){if(S)return m;S=!0;try{let s=(R(),T(y));!s.RvfDatabase&&s.default&&s.default.RvfDatabase&&(s=s.default),m=s}catch{m=null}return m}function w(s){return`${s}.idmap.json`}function N(s){let e=w(s),t=new Map,n=new Map,i=1;if(Y(e))try{let r=JSON.parse(J(e,"utf-8"));i=r.nextLabel;for(let[a,p]of r.entries)t.set(a,p),n.set(p,a)}catch{}return{strToNum:t,numToStr:n,nextLabel:i}}function b(s,e,t){let n={nextLabel:t,entries:Array.from(e.entries())};H(w(s),JSON.stringify(n),"utf-8")}function $(s,e){let t=c();if(!t)throw new Error("@ruvector/rvf-node is not available \u2014 install the package or check platform compatibility");let n=t.RvfDatabase.create(s,{dimension:e}),i=n.dimension();return new d(n,s,i,new Map,new Map,1)}function G(s){let e=c();if(!e)throw new Error("@ruvector/rvf-node is not available \u2014 install the package or check platform compatibility");let t=e.RvfDatabase.open(s),n=t.dimension(),{strToNum:i,numToStr:r,nextLabel:a}=N(s);return new d(t,s,n,i,r,a)}function U(s){let e=c();if(!e)throw new Error("@ruvector/rvf-node is not available \u2014 install the package or check platform compatibility");let t=e.RvfDatabase.openReadonly(s),n=t.dimension(),{strToNum:i,numToStr:r,nextLabel:a}=N(s);return new d(t,s,n,i,r,a)}function X(){return process.env.AQE_MEMORY_BACKEND==="memory"?!1:c()!==null}var m,S,d,P=h(()=>{m=null,S=!1;d=class s{db;_path;_dimension;strToNum;numToStr;nextLabel;_open;constructor(e,t,n,i,r,a){this.db=e,this._path=t,this._dimension=n,this.strToNum=i,this.numToStr=r,this.nextLabel=a,this._open=!0}ingest(e){if(this.ensureOpen(),e.length===0)return{accepted:0,rejected:0};let t=this._dimension,n=new Float32Array(e.length*t),i=[],r=[];for(let o=0;o<e.length;o++){let{id:u,vector:f,metadata:x}=e[o],l=this.strToNum.get(u);l===void 0&&(l=this.nextLabel++,this.strToNum.set(u,l),this.numToStr.set(l,u)),i.push(l),r.push(x);let M=f instanceof Float32Array?f:new Float32Array(f);n.set(M.subarray(0,t),o*t)}let a;if(r.some(o=>o!==void 0)&&typeof this.db.ingestBatchWithMetadata=="function"){let o=r.map(u=>u?JSON.stringify(u):"");a=this.db.ingestBatchWithMetadata(n,i,o)}else a=this.db.ingestBatch(n,i);return this.persistIdMap(),{accepted:a.accepted,rejected:a.rejected}}has(e){return this.ensureOpen(),this.strToNum.has(e)}search(e,t){this.ensureOpen();let n=e instanceof Float32Array?e:new Float32Array(e);return this.db.query(n,t).map(r=>{let a=this.numToStr.get(r.id);return a===void 0?null:{id:a,distance:r.distance,score:1/(1+r.distance)}}).filter(r=>r!==null)}delete(e){this.ensureOpen();let t=[];for(let i of e){let r=this.strToNum.get(i);r!==void 0&&t.push(r)}if(t.length===0)return 0;let n=this.db.delete(t);for(let i of e){let r=this.strToNum.get(i);r!==void 0&&(this.strToNum.delete(i),this.numToStr.delete(r))}return this.persistIdMap(),n.deleted}fork(e){this.ensureOpen(),Q(this._path,e);let t=new Map(this.strToNum),n=new Map(this.numToStr);b(e,t,this.nextLabel);let r=c().RvfDatabase.open(e);return new s(r,e,this._dimension,t,n,this.nextLabel)}status(){this.ensureOpen();let e=this.db.status(),n=this.db.segments().filter(i=>i.segType==="witness");return{totalVectors:e.totalVectors,totalSegments:e.totalSegments,fileSizeBytes:e.fileSize,epoch:e.currentEpoch,witnessValid:n.length>0,witnessEntries:n.length,deadSpaceRatio:typeof e.deadSpaceRatio=="number"?e.deadSpaceRatio:0}}dimension(){return this._dimension}size(){return this.ensureOpen(),this.db.status().totalVectors}compact(){this.ensureOpen();try{let e=this.db.compact();return e&&typeof e=="object"?{segmentsCompacted:typeof e.segmentsCompacted=="number"?e.segmentsCompacted:0,bytesReclaimed:typeof e.bytesReclaimed=="number"?e.bytesReclaimed:0,epoch:typeof e.epoch=="number"?e.epoch:0}:{segmentsCompacted:0,bytesReclaimed:0,epoch:0}}catch{return null}}close(){this._open&&(this.db.close(),this._open=!1)}isOpen(){return this._open}path(){return this._path}embedKernel(e){return this.ensureOpen(),this.db.embedKernel(0,99,0,e,0,"")}extractKernel(){return this.ensureOpen(),this.db.extractKernel()}verifyWitness(){this.ensureOpen();let e=this.tryNative("verifyWitness");return e?{valid:e.valid??!0,totalEntries:e.totalEntries??0,errors:Array.isArray(e.errors)?e.errors:[]}:{valid:!0,totalEntries:0,errors:[]}}sign(e){this.ensureOpen();let t=this.tryNative("sign",e);return typeof t=="string"?t:null}fileId(){this.ensureOpen();let e=this.tryNative("fileId");return typeof e=="string"?e:null}parentId(){this.ensureOpen();let e=this.tryNative("parentId");return typeof e=="string"?e:null}lineageDepth(){this.ensureOpen();let e=this.tryNative("lineageDepth");return typeof e=="number"?e:0}indexStats(){let e=this.status();return{totalVectors:e.totalVectors,dimension:this._dimension,totalSegments:e.totalSegments,fileSizeBytes:e.fileSizeBytes,epoch:e.epoch,witnessValid:e.witnessValid,witnessEntries:e.witnessEntries,idMapSize:this.strToNum.size}}freeze(){this.ensureOpen();let e=this.tryNative("freeze");return typeof e=="number"?e:0}derive(e){this.ensureOpen();let t=c();if(typeof this.db.derive=="function")try{let n=this.db.derive(e),i=new Map(this.strToNum),r=new Map(this.numToStr);return b(e,i,this.nextLabel),new s(n,e,this._dimension,i,r,this.nextLabel)}catch{}return this.fork(e)}ensureOpen(){if(!this._open)throw new Error("RVF database is closed")}tryNative(e,...t){if(typeof this.db[e]!="function")return null;try{return this.db[e](...t)}catch{return null}}persistIdMap(){b(this._path,this.strToNum,this.nextLabel)}}});export{$ as a,G as b,U as c,X as d,Z as e,P 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.16");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.18");process.exit(0)}
2
2
  import{isIP as o}from"net";import{lookup as n}from"dns/promises";var f=[/^10\./,/^172\.(1[6-9]|2\d|3[01])\./,/^192\.168\./,/^127\./,/^0\./,/^169\.254\./,/^::1$/,/^fc00:/,/^fe80:/,/^fd[0-9a-f]{2}:/i];function t(r){return f.some(s=>s.test(r))}async function u(r){if(process.env.AQE_HOOKS_SSRF_DISABLED==="true")return{safe:!0};let s;try{s=new URL(r)}catch{return{safe:!1,reason:`Invalid URL: ${r}`}}let e=s.hostname.replace(/^\[|\]$/g,"");if(o(e))return t(e)?{safe:!1,reason:`Private IP blocked: ${e}`}:{safe:!0};try{let a=await n(e);if(t(a.address))return{safe:!1,reason:`DNS resolves to private IP: ${a.address}`}}catch(a){return{safe:!1,reason:`DNS lookup failed for ${e}: ${a.message}`}}return{safe:!0}}export{t as a,u as b};