agentic-qe 3.11.1 → 3.11.2

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 (334) hide show
  1. package/.claude/skills/qe-code-intelligence/SKILL.md +3 -0
  2. package/.claude/skills/skills-manifest.json +1 -1
  3. package/CHANGELOG.md +35 -0
  4. package/README.md +1 -0
  5. package/assets/skills/qe-code-intelligence/SKILL.md +3 -0
  6. package/dist/cli/bundle.js +5 -5
  7. package/dist/cli/chunks/adapter-LDNYC4GH.js +2 -0
  8. package/dist/cli/chunks/{agent-booster-wasm-3OJAT664.js → agent-booster-wasm-FNCVODUJ.js} +2 -2
  9. package/dist/cli/chunks/{agent-handler-6TCTI5AT.js → agent-handler-JK7VK37B.js} +2 -2
  10. package/dist/cli/chunks/{agent-memory-branch-FAWCYEGJ.js → agent-memory-branch-EPVVJNNA.js} +2 -2
  11. package/dist/cli/chunks/aqe-learning-engine-CA4CT5Q7.js +2 -0
  12. package/dist/cli/chunks/{arena-O2TCUQBF.js → arena-EH2IMSRW.js} +4 -4
  13. package/dist/cli/chunks/{arena-UVYIGYUF.js → arena-NTHVDZTJ.js} +2 -2
  14. package/dist/cli/chunks/{audit-AYESKHAJ.js → audit-ODZV2T2B.js} +2 -2
  15. package/dist/cli/chunks/base-TSDAEMT4.js +2 -0
  16. package/dist/cli/chunks/{hnswlib-node-FUWQTM2D.js → better-sqlite3-5JTP47LA.js} +2 -2
  17. package/dist/cli/chunks/{brain-handler-KSJBVTHZ.js → brain-handler-NVB6OJ25.js} +3 -3
  18. package/dist/cli/chunks/{branch-enumerator-4O3S42EG.js → branch-enumerator-BIXSELMY.js} +2 -2
  19. package/dist/cli/chunks/{browser-5VXK323P.js → browser-S2Y2W33Z.js} +2 -2
  20. package/dist/cli/chunks/browser-workflow-3HCTJBLR.js +2 -0
  21. package/dist/cli/chunks/{chunk-XEVUW4QL.js → chunk-26ZMIYSK.js} +2 -2
  22. package/dist/cli/chunks/{chunk-7GP7ZG3K.js → chunk-27KNLVOY.js} +2 -2
  23. package/dist/cli/chunks/{chunk-5Y7GXQOM.js → chunk-2Q65LTJN.js} +2 -2
  24. package/dist/cli/chunks/{chunk-QOR4YAZY.js → chunk-3ATEYGVD.js} +2 -2
  25. package/dist/cli/chunks/{chunk-NVJIOCS5.js → chunk-3J3QXLWP.js} +2 -2
  26. package/dist/cli/chunks/{chunk-OUBYADPD.js → chunk-3KTOM7NN.js} +2 -2
  27. package/dist/cli/chunks/{chunk-EZBXCEBV.js → chunk-3NCVUFAL.js} +2 -2
  28. package/dist/cli/chunks/{chunk-2RE32VOF.js → chunk-42DCMEUM.js} +1 -1
  29. package/dist/cli/chunks/{chunk-ZRWAFMM7.js → chunk-4FTVTAMN.js} +2 -2
  30. package/dist/cli/chunks/{chunk-437XL5VZ.js → chunk-4PYJCIRO.js} +2 -2
  31. package/dist/cli/chunks/{chunk-4RUS5E3Q.js → chunk-527U4AHC.js} +2 -2
  32. package/dist/cli/chunks/{chunk-OX2PGDUM.js → chunk-5AFO7ZZG.js} +3 -3
  33. package/dist/cli/chunks/{chunk-S7IHSELP.js → chunk-5BDVFFYF.js} +2 -2
  34. package/dist/cli/chunks/{chunk-IAHJ62JS.js → chunk-5KMGG3QW.js} +4 -4
  35. package/dist/cli/chunks/{chunk-LNV76GGB.js → chunk-6LQIVIZB.js} +2 -2
  36. package/dist/cli/chunks/{chunk-FOD6JEEU.js → chunk-6SOGYNJG.js} +2 -2
  37. package/dist/cli/chunks/{chunk-5PSIKJL5.js → chunk-6VAFRS5N.js} +2 -2
  38. package/dist/cli/chunks/chunk-72VVTMEL.js +2 -0
  39. package/dist/cli/chunks/{chunk-SU4YXUVK.js → chunk-75C5GX7D.js} +2 -2
  40. package/dist/cli/chunks/{chunk-B6U56VWG.js → chunk-76RO2RHG.js} +1 -1
  41. package/dist/cli/chunks/{chunk-OUSD2RWO.js → chunk-7HYO76F2.js} +2 -2
  42. package/dist/cli/chunks/{chunk-PY4YQDBM.js → chunk-7KHZZVF2.js} +4 -4
  43. package/dist/cli/chunks/{chunk-NKCL6RAF.js → chunk-7MKF52GT.js} +2 -2
  44. package/dist/cli/chunks/{chunk-FK3XYV3A.js → chunk-7VM4ZUHT.js} +2 -2
  45. package/dist/cli/chunks/{chunk-VS2G6LX5.js → chunk-7XIQR6VU.js} +2 -2
  46. package/dist/cli/chunks/{chunk-OHBZON7T.js → chunk-A4ZDKF5F.js} +1 -1
  47. package/dist/cli/chunks/{chunk-K7XPKGOL.js → chunk-AAVUZVM6.js} +2 -2
  48. package/dist/cli/chunks/{chunk-44HXRFOP.js → chunk-AINAWVGD.js} +2 -2
  49. package/dist/cli/chunks/{chunk-P7CMWL7Y.js → chunk-AK5Q2WCJ.js} +2 -2
  50. package/dist/cli/chunks/{chunk-Z6ADE3KJ.js → chunk-AKZK46TQ.js} +2 -2
  51. package/dist/cli/chunks/{chunk-4UHWZ47M.js → chunk-ARUXFZDY.js} +1 -1
  52. package/dist/cli/chunks/{chunk-7DQLYWLR.js → chunk-AYXRT2ND.js} +1 -1
  53. package/dist/cli/chunks/{chunk-X2OVUBF6.js → chunk-AZQ6HDPM.js} +2 -2
  54. package/dist/cli/chunks/{chunk-CN2HMHIY.js → chunk-BGVEBYV4.js} +2 -2
  55. package/dist/cli/chunks/{chunk-LOPM3YIO.js → chunk-C6UTRG66.js} +2 -2
  56. package/dist/cli/chunks/{chunk-4OYC5TIZ.js → chunk-CAUTOCLZ.js} +2 -2
  57. package/dist/cli/chunks/{chunk-6WNYBIPS.js → chunk-CAVBEZV4.js} +2 -2
  58. package/dist/cli/chunks/{chunk-BOQNPFO5.js → chunk-CEMROADY.js} +1 -1
  59. package/dist/cli/chunks/{chunk-ATQTTGSE.js → chunk-CMVNYVKL.js} +2 -2
  60. package/dist/cli/chunks/{chunk-N52WQO3G.js → chunk-CUDGKSFX.js} +2 -2
  61. package/dist/cli/chunks/{chunk-X4GKYSOH.js → chunk-CZYSCUJ4.js} +2 -2
  62. package/dist/cli/chunks/{chunk-72UPBNVF.js → chunk-DMUQV2YU.js} +2 -2
  63. package/dist/cli/chunks/{chunk-BXLWERBR.js → chunk-DPFLJMEI.js} +3 -3
  64. package/dist/cli/chunks/{chunk-H5GCRC2D.js → chunk-DU4GQKTH.js} +2 -2
  65. package/dist/cli/chunks/{chunk-S7ZHD6VN.js → chunk-EDH4H55B.js} +2 -2
  66. package/dist/cli/chunks/{chunk-MILWEZSZ.js → chunk-EIWZDVMT.js} +3 -3
  67. package/dist/cli/chunks/{chunk-O5NF6BBD.js → chunk-FPZLOVEF.js} +1 -1
  68. package/dist/cli/chunks/{chunk-6CH7476R.js → chunk-FV53RMVB.js} +1 -1
  69. package/dist/cli/chunks/{chunk-QEDS3MOJ.js → chunk-FYY7OJ6Y.js} +2 -2
  70. package/dist/cli/chunks/{chunk-CXIFCN6G.js → chunk-G4CQBQBV.js} +1 -1
  71. package/dist/cli/chunks/{chunk-CZU5G6J4.js → chunk-G6LIQFT2.js} +1 -1
  72. package/dist/cli/chunks/{chunk-TUEDIQHY.js → chunk-H3LGBH4Y.js} +1 -1
  73. package/dist/cli/chunks/{chunk-BR4ERWVD.js → chunk-H4ZPPHOI.js} +2 -2
  74. package/dist/cli/chunks/{chunk-N6RSJGTW.js → chunk-H5TM4KIB.js} +2 -2
  75. package/dist/cli/chunks/{chunk-K3BBLIWW.js → chunk-H6MBRYA7.js} +2 -2
  76. package/dist/cli/chunks/{chunk-YFY35CSD.js → chunk-HDBJORV7.js} +2 -2
  77. package/dist/cli/chunks/{chunk-QXDZN2WX.js → chunk-I3AD523O.js} +1 -1
  78. package/dist/cli/chunks/{chunk-HOFEAA4R.js → chunk-I7UWFV6N.js} +1 -1
  79. package/dist/cli/chunks/{chunk-4BMPFEEG.js → chunk-IMPSB5WW.js} +2 -2
  80. package/dist/cli/chunks/{chunk-ILZHECWZ.js → chunk-IO7ZUP2G.js} +3 -3
  81. package/dist/cli/chunks/{chunk-QUTKELAS.js → chunk-IQOCTGA2.js} +2 -2
  82. package/dist/cli/chunks/{chunk-S456W64P.js → chunk-IXYF5BZY.js} +2 -2
  83. package/dist/cli/chunks/{chunk-B5EE63VE.js → chunk-JC4Z2ADP.js} +2 -2
  84. package/dist/cli/chunks/{chunk-IUVAWWQG.js → chunk-JCH2FHJ7.js} +2 -2
  85. package/dist/cli/chunks/{chunk-MX6M2VPB.js → chunk-JDFF2QMZ.js} +1 -1
  86. package/dist/cli/chunks/{chunk-EFRIMR74.js → chunk-JELN5XTK.js} +1 -1
  87. package/dist/cli/chunks/{chunk-3G25ZBQ6.js → chunk-JSZNI3AO.js} +1 -1
  88. package/dist/cli/chunks/{chunk-AEZMNFXM.js → chunk-K3YM2Z3E.js} +1 -1
  89. package/dist/cli/chunks/{chunk-QMN563LV.js → chunk-K426HTEQ.js} +44 -44
  90. package/dist/cli/chunks/{chunk-7OAKIXNM.js → chunk-K6IQBVD7.js} +2 -2
  91. package/dist/cli/chunks/{chunk-C7FYDE5F.js → chunk-KEJEZY2R.js} +125 -150
  92. package/dist/cli/chunks/{chunk-SZPTUV3B.js → chunk-KFE6LB4I.js} +2 -2
  93. package/dist/cli/chunks/{chunk-TOQJWLJV.js → chunk-KO3WB4SU.js} +2 -2
  94. package/dist/cli/chunks/{chunk-3IMEDZIS.js → chunk-LAY35POY.js} +3 -3
  95. package/dist/cli/chunks/{chunk-NYWK7ZSX.js → chunk-LFXXA325.js} +1 -1
  96. package/dist/cli/chunks/{chunk-IVZVVZZ3.js → chunk-LI3T5YNC.js} +3 -3
  97. package/dist/cli/chunks/{chunk-7SRSOZMP.js → chunk-LIEA5EON.js} +1 -1
  98. package/dist/cli/chunks/{chunk-76UVJLPM.js → chunk-LRJWKFGY.js} +2 -2
  99. package/dist/cli/chunks/{chunk-N6NSZG7Z.js → chunk-LY6PTRVL.js} +2 -2
  100. package/dist/cli/chunks/{chunk-L2QHZFC3.js → chunk-MAXOIEUG.js} +1 -1
  101. package/dist/cli/chunks/{chunk-7WQKKYYG.js → chunk-MN6W7ZNL.js} +1 -1
  102. package/dist/cli/chunks/{chunk-DZT4A7R3.js → chunk-NGE5YNKC.js} +2 -2
  103. package/dist/cli/chunks/{chunk-O75SVMMB.js → chunk-NIW4CLN2.js} +2 -2
  104. package/dist/cli/chunks/{chunk-BVFNF3RW.js → chunk-NPT7BYGF.js} +1 -1
  105. package/dist/cli/chunks/{chunk-CII57TME.js → chunk-NZNXEEZR.js} +1 -1
  106. package/dist/cli/chunks/{chunk-J2LAYCYZ.js → chunk-O3IIAIXB.js} +1 -1
  107. package/dist/cli/chunks/{chunk-3D4HNUZM.js → chunk-OC2W7KIW.js} +2 -2
  108. package/dist/cli/chunks/{chunk-ZKPOKMJZ.js → chunk-OFUF3APC.js} +2 -2
  109. package/dist/cli/chunks/{chunk-4G4GTF36.js → chunk-OU52V67H.js} +4 -4
  110. package/dist/cli/chunks/{chunk-5QFZEEJ2.js → chunk-P2RR4SW5.js} +3 -3
  111. package/dist/cli/chunks/{chunk-JGHEGMLD.js → chunk-P3VRXQ3H.js} +3 -3
  112. package/dist/cli/chunks/{chunk-KIBP3LGY.js → chunk-P5SGBQLY.js} +1 -1
  113. package/dist/cli/chunks/{chunk-5LDUW2FD.js → chunk-P7MIOTVP.js} +1 -1
  114. package/dist/cli/chunks/{chunk-VGR65B4Y.js → chunk-PFDILSVO.js} +1 -1
  115. package/dist/cli/chunks/{chunk-WIC5UZCQ.js → chunk-PPD5ZLNA.js} +2 -2
  116. package/dist/cli/chunks/{chunk-4565IIF6.js → chunk-QFJDR4HC.js} +2 -2
  117. package/dist/cli/chunks/{chunk-7QICU44H.js → chunk-QZ2GQGJX.js} +2 -2
  118. package/dist/cli/chunks/{chunk-EQYDPF52.js → chunk-QZLTIGLB.js} +1 -1
  119. package/dist/cli/chunks/{chunk-3V5DAM37.js → chunk-RHSUXQNF.js} +2 -2
  120. package/dist/cli/chunks/{chunk-HMVL55QX.js → chunk-S6BWEZKK.js} +2 -2
  121. package/dist/cli/chunks/{chunk-IIX5Y7BO.js → chunk-SE4S23C7.js} +1 -1
  122. package/dist/cli/chunks/{chunk-6ZAUNPAI.js → chunk-TOGZ37RL.js} +2 -2
  123. package/dist/cli/chunks/{chunk-D6MPGK7R.js → chunk-UCXW24HY.js} +2 -2
  124. package/dist/cli/chunks/{chunk-D4DAZ3P2.js → chunk-UQ6WB4N2.js} +2 -2
  125. package/dist/cli/chunks/{chunk-22FHOXEE.js → chunk-UQBGA4UA.js} +1 -1
  126. package/dist/cli/chunks/{chunk-UDLN2THT.js → chunk-VNFL2TPU.js} +1 -1
  127. package/dist/cli/chunks/{chunk-U5GCSSYX.js → chunk-WARFZ626.js} +1 -1
  128. package/dist/cli/chunks/{chunk-XMDZRULK.js → chunk-WEBHFIWS.js} +2 -2
  129. package/dist/cli/chunks/{chunk-N4OWZLH5.js → chunk-WKIYYF3G.js} +2 -2
  130. package/dist/cli/chunks/{chunk-3DS7ZHA7.js → chunk-WZC4HKGZ.js} +2 -2
  131. package/dist/cli/chunks/{chunk-T7PUM6OY.js → chunk-X36TZXDK.js} +1 -1
  132. package/dist/cli/chunks/{chunk-4S3UIY3G.js → chunk-XN4G3SRU.js} +2 -2
  133. package/dist/cli/chunks/{chunk-V6YDM37M.js → chunk-XNREA3FG.js} +1 -1
  134. package/dist/cli/chunks/{chunk-EJSDQQZH.js → chunk-XRDPGJNW.js} +2 -2
  135. package/dist/cli/chunks/{chunk-GUSW3OGX.js → chunk-XXCSJMSR.js} +1 -1
  136. package/dist/cli/chunks/{chunk-VRHLHGKR.js → chunk-XY2B2BEJ.js} +2 -2
  137. package/dist/cli/chunks/{chunk-CIDTFU3C.js → chunk-XY4JS3IZ.js} +2 -2
  138. package/dist/cli/chunks/{chunk-W6RS5S4Q.js → chunk-Y4M2HMPR.js} +2 -2
  139. package/dist/cli/chunks/{chunk-AG4BYKUV.js → chunk-YDPBCN7H.js} +2 -2
  140. package/dist/cli/chunks/{chunk-56PICCZN.js → chunk-YGR54EAA.js} +2 -2
  141. package/dist/cli/chunks/{chunk-6YNXH6H4.js → chunk-YGRY2TVI.js} +2 -2
  142. package/dist/cli/chunks/{chunk-H4V6WCF7.js → chunk-YJUJCLXV.js} +2 -2
  143. package/dist/cli/chunks/{chunk-KRUKMGPF.js → chunk-YWG4LHFU.js} +2 -2
  144. package/dist/cli/chunks/{chunk-FBOPSWF6.js → chunk-Z2QNTRUX.js} +2 -2
  145. package/dist/cli/chunks/{chunk-3XCEFSUK.js → chunk-ZBJMVWQR.js} +2 -2
  146. package/dist/cli/chunks/{chunk-C27UV6DO.js → chunk-ZH6HYT7C.js} +1 -1
  147. package/dist/cli/chunks/{chunk-WEPZOCN7.js → chunk-ZP2GE6DM.js} +1 -1
  148. package/dist/cli/chunks/{chunk-LSZLXLZA.js → chunk-ZQYEBLTL.js} +2 -2
  149. package/dist/cli/chunks/{chunk-AL54LED5.js → chunk-ZRU3OZEU.js} +2 -2
  150. package/dist/cli/chunks/{chunk-HYT5EMES.js → chunk-ZU3V4CJ4.js} +2 -2
  151. package/dist/cli/chunks/{chunk-TCKBICJ3.js → chunk-ZWMXF6AX.js} +2 -2
  152. package/dist/cli/chunks/{ci-KTWY7BZT.js → ci-SM3EVLZ4.js} +2 -2
  153. package/dist/cli/chunks/{ci-output-WOX6QBMS.js → ci-output-YYXICZBC.js} +2 -2
  154. package/dist/cli/chunks/{circuit-breaker-6XKOSFIF.js → circuit-breaker-CV5UGKXT.js} +2 -2
  155. package/dist/cli/chunks/{claude-flow-setup-5JA4MNE4.js → claude-flow-setup-BSBUZ4B7.js} +2 -2
  156. package/dist/cli/chunks/client-WRDYZGM2.js +2 -0
  157. package/dist/cli/chunks/{cline-installer-Z2ANHEKW.js → cline-installer-P2O6STIC.js} +2 -2
  158. package/dist/cli/chunks/code-M7DDLBGS.js +58 -0
  159. package/dist/cli/chunks/{code-index-extractor-VV4OEPG7.js → code-index-extractor-3QZIUYOG.js} +2 -2
  160. package/dist/cli/chunks/{codex-installer-BP7Y2NYR.js → codex-installer-5JVZCCTC.js} +2 -2
  161. package/dist/cli/chunks/{completions-YULJQUF4.js → completions-EM7IL2BJ.js} +8 -5
  162. package/dist/cli/chunks/{complexity-analyzer-D7XYPQ76.js → complexity-analyzer-VJXVB2CV.js} +2 -2
  163. package/dist/cli/chunks/{continuedev-installer-E3L7UF72.js → continuedev-installer-RCKJIAEC.js} +2 -2
  164. package/dist/cli/chunks/{copilot-installer-5TRUMJC5.js → copilot-installer-DZ7LTDOZ.js} +2 -2
  165. package/dist/cli/chunks/core-handlers-O6E5DNHT.js +2 -0
  166. package/dist/cli/chunks/{cost-tracker-QTYSJMSV.js → cost-tracker-QLOLXVAM.js} +2 -2
  167. package/dist/cli/chunks/{coverage-D5DKZ3XT.js → coverage-LYHTLWRV.js} +3 -3
  168. package/dist/cli/chunks/cross-domain-router-EV7LQMDO.js +2 -0
  169. package/dist/cli/chunks/{cursor-installer-UDBHGUIG.js → cursor-installer-PSIZ3Y53.js} +2 -2
  170. package/dist/cli/chunks/{daemon-IVWUMQKL.js → daemon-IYDTMA5M.js} +4 -4
  171. package/dist/cli/chunks/{daemon-2GXYN7F7.js → daemon-YLOAXM4X.js} +3 -3
  172. package/dist/cli/chunks/{dag-attention-scheduler-PWXR4QTU.js → dag-attention-scheduler-I2UIO3Z7.js} +2 -2
  173. package/dist/cli/chunks/{detect-C6P7ONFB.js → detect-ZXQ7X7GZ.js} +2 -2
  174. package/dist/cli/chunks/{dist-node-2BUFM2JK.js → dist-node-GK6OZX4H.js} +2 -2
  175. package/dist/cli/chunks/{domain-handler-Q2GWZLDM.js → domain-handler-NS3IBLRQ.js} +2 -2
  176. package/dist/cli/chunks/{domain-transfer-GMUBAM3J.js → domain-transfer-5G4RZEWF.js} +2 -2
  177. package/dist/cli/chunks/dream-E4C236UL.js +2 -0
  178. package/dist/cli/chunks/{embed-and-insert-pattern-EFUERRM2.js → embed-and-insert-pattern-V4JJUFR6.js} +2 -2
  179. package/dist/cli/chunks/{eval-24FIC43F.js → eval-7Q6PPYKR.js} +2 -2
  180. package/dist/cli/chunks/{experience-capture-middleware-R4UP2Q2M.js → experience-capture-middleware-DUBKSYFM.js} +3 -3
  181. package/dist/cli/chunks/{fast-paths-RQCGGTXB.js → fast-paths-IDPPMBUW.js} +2 -2
  182. package/dist/cli/chunks/{feature-flags-SOXVYIBN.js → feature-flags-EPTMAAKA.js} +2 -2
  183. package/dist/cli/chunks/{feature-flags-APTWWVNQ.js → feature-flags-KXI6FDY7.js} +2 -2
  184. package/dist/cli/chunks/{file-discovery-66KRMXVF.js → file-discovery-EDX2OJO7.js} +2 -2
  185. package/dist/cli/chunks/{fleet-EMBNKO5Q.js → fleet-67BO3LJ4.js} +3 -3
  186. package/dist/cli/chunks/{gnn-wrapper-6TKDWFJF.js → gnn-wrapper-YARORYT7.js} +2 -2
  187. package/dist/cli/chunks/{heartbeat-handler-4ODKJ75H.js → heartbeat-handler-K3JGPBYR.js} +4 -4
  188. package/dist/cli/chunks/heartbeat-scheduler-WMADLDKT.js +2 -0
  189. package/dist/cli/chunks/hnsw-adapter-STRDGJ65.js +2 -0
  190. package/dist/cli/chunks/hnsw-index-DBHX3TSC.js +2 -0
  191. package/dist/cli/chunks/{hnsw-legacy-bridge-25KFCLUC.js → hnsw-legacy-bridge-CDDRSV5E.js} +2 -2
  192. package/dist/cli/chunks/{better-sqlite3-MJNUEPYB.js → hnswlib-node-2KL54YUA.js} +2 -2
  193. package/dist/cli/chunks/{hooks-JIDA2COE.js → hooks-6SCAE6LC.js} +10 -10
  194. package/dist/cli/chunks/hybrid-router-L2K55I4T.js +2 -0
  195. package/dist/cli/chunks/{hypergraph-engine-3YDFDPE3.js → hypergraph-engine-I3LUMO7I.js} +2 -2
  196. package/dist/cli/chunks/{hypergraph-handler-VWZX2OJX.js → hypergraph-handler-YAKAIVCN.js} +3 -3
  197. package/dist/cli/chunks/impact-analyzer-WMO7ZGS7.js +2 -0
  198. package/dist/cli/chunks/{init-handler-DH7VQAMF.js → init-handler-NBKCZD7Q.js} +6 -6
  199. package/dist/cli/chunks/init-wizard-ZAB7UZZS.js +2 -0
  200. package/dist/cli/chunks/kernel-4MUFDEQI.js +2 -0
  201. package/dist/cli/chunks/{kilocode-installer-2W2KZCGH.js → kilocode-installer-YGPJCPU3.js} +2 -2
  202. package/dist/cli/chunks/{kiro-installer-E5KP7OMD.js → kiro-installer-JV3ONVMN.js} +2 -2
  203. package/dist/cli/chunks/knowledge-graph-GZRFGXLX.js +2 -0
  204. package/dist/cli/chunks/{learning-XJRUVPLF.js → learning-2FEZJ5CX.js} +3 -3
  205. package/dist/cli/chunks/{llm-router-AEEKEMF5.js → llm-router-SILI4KLU.js} +4 -4
  206. package/dist/cli/chunks/llm-router-service-5ODLU5U5.js +2 -0
  207. package/dist/cli/chunks/{load-PZ4YOTBJ.js → load-EGXLQVR3.js} +2 -2
  208. package/dist/cli/chunks/load-test-ZDQFS5XS.js +2 -0
  209. package/dist/cli/chunks/{mcp-IVA6LC2S.js → mcp-OJH775TL.js} +2 -2
  210. package/dist/cli/chunks/{memory-Y3DHXFQE.js → memory-FNEOK4FW.js} +5 -5
  211. package/dist/cli/chunks/memory-backend-UK7SQ6ZM.js +2 -0
  212. package/dist/cli/chunks/{memory-handlers-V5PXEJWL.js → memory-handlers-6LDUH3JZ.js} +2 -2
  213. package/dist/cli/chunks/{multi-model-executor-646G4S4Y.js → multi-model-executor-ORTFWLLE.js} +2 -2
  214. package/dist/cli/chunks/{opencode-installer-P6KOOTUS.js → opencode-installer-UAQLW6XX.js} +2 -2
  215. package/dist/cli/chunks/{orchestrator-T2GVKYMX.js → orchestrator-VE5KJ2V4.js} +5 -5
  216. package/dist/cli/chunks/pattern-null-store-LO2QTIBU.js +2 -0
  217. package/dist/cli/chunks/{pipeline-CK2ON45P.js → pipeline-FNMDRWTU.js} +2 -2
  218. package/dist/cli/chunks/{platform-OQNSD3A3.js → platform-MGAKRUQN.js} +2 -2
  219. package/dist/cli/chunks/{plugin-UOG6RNRM.js → plugin-YX7THX3I.js} +2 -2
  220. package/dist/cli/chunks/{prime-radiant-advanced-wasm-37UE6TG5.js → prime-radiant-advanced-wasm-XJV4RLMK.js} +2 -2
  221. package/dist/cli/chunks/protocol-executor-JWMYQEOI.js +2 -0
  222. package/dist/cli/chunks/{protocol-handler-V722S6YH.js → protocol-handler-QFET442Y.js} +2 -2
  223. package/dist/cli/chunks/{prove-ANGY6W3W.js → prove-QBAESCOC.js} +2 -2
  224. package/dist/cli/chunks/provider-manager-PEXOHGNB.js +2 -0
  225. package/dist/cli/chunks/qe-reasoning-bank-7B2G4UGQ.js +2 -0
  226. package/dist/cli/chunks/{quality-KG4ALI2L.js → quality-ZTNRL6EG.js} +2 -2
  227. package/dist/cli/chunks/queen-coordinator-6OF4HT3S.js +2 -0
  228. package/dist/cli/chunks/{real-embeddings-GUZDO5UN.js → real-embeddings-ZFFDV6HC.js} +2 -2
  229. package/dist/cli/chunks/{roocode-installer-WROAR6MJ.js → roocode-installer-J4LFL4AE.js} +2 -2
  230. package/dist/cli/chunks/router-GMWRF6DU.js +2 -0
  231. package/dist/cli/chunks/routing-feedback-XKJSQK3I.js +2 -0
  232. package/dist/cli/chunks/{routing-handler-UFPSSS5D.js → routing-handler-A5QG2TP2.js} +2 -2
  233. package/dist/cli/chunks/{ruvector-commands-XJQMKDRM.js → ruvector-commands-J5JL5WX5.js} +2 -2
  234. package/dist/cli/chunks/{rvf-dual-writer-QPRMDKYX.js → rvf-dual-writer-H7442GMO.js} +2 -2
  235. package/dist/cli/chunks/{rvf-migration-adapter-SOHBK23K.js → rvf-migration-adapter-PTFQUYKC.js} +2 -2
  236. package/dist/cli/chunks/{rvf-migration-coordinator-MTWUSPEJ.js → rvf-migration-coordinator-RSNROYRX.js} +2 -2
  237. package/dist/cli/chunks/rvf-native-adapter-YEA6TMXB.js +2 -0
  238. package/dist/cli/chunks/safe-db-5DOP2J3V.js +2 -0
  239. package/dist/cli/chunks/schedule-SUWTOBHP.js +2 -0
  240. package/dist/cli/chunks/scheduler-P4VTC5SQ.js +2 -0
  241. package/dist/cli/chunks/{security-5MAMQKP6.js → security-LHHLMCBA.js} +3 -3
  242. package/dist/cli/chunks/{shared-rvf-adapter-YEUBSRNN.js → shared-rvf-adapter-NPSHVUTM.js} +2 -2
  243. package/dist/cli/chunks/{shared-rvf-dual-writer-DBQJHG42.js → shared-rvf-dual-writer-INQDY5WE.js} +2 -2
  244. package/dist/cli/chunks/sqlite-persistence-5Z2RAXH7.js +2 -0
  245. package/dist/cli/chunks/{status-handler-ZUB2UKQZ.js → status-handler-R2KIAMAE.js} +2 -2
  246. package/dist/cli/chunks/{structural-health-B2GHENWX.js → structural-health-2VPPIOZX.js} +2 -2
  247. package/dist/cli/chunks/{sync-7VMXJTR2.js → sync-ASZ3T5GT.js} +2 -2
  248. package/dist/cli/chunks/{sync-YCUUW3IP.js → sync-NLASP7AK.js} +2 -2
  249. package/dist/cli/chunks/{task-handler-N7LJTXZM.js → task-handler-UV5R6LJG.js} +2 -2
  250. package/dist/cli/chunks/{task-handlers-GDHNJV2E.js → task-handlers-I6YJXPYP.js} +3 -3
  251. package/dist/cli/chunks/{test-6COGC5KI.js → test-TE43TNTI.js} +4 -4
  252. package/dist/cli/chunks/{test-scheduling-CUERHJMF.js → test-scheduling-WWWWF2TZ.js} +3 -3
  253. package/dist/cli/chunks/{token-bootstrap-JTGSL6PP.js → token-bootstrap-HEWP7KKS.js} +2 -2
  254. package/dist/cli/chunks/{token-usage-LSG3JYGX.js → token-usage-3FVHUAW6.js} +2 -2
  255. package/dist/cli/chunks/{transformers-ODIITRCT.js → transformers-O5OFM4XM.js} +2 -2
  256. package/dist/cli/chunks/{tree-sitter-wasm-parser-KSP7ZZ5H.js → tree-sitter-wasm-parser-YOYWFW63.js} +2 -2
  257. package/dist/cli/chunks/{types-6N6SUU2O.js → types-42GR6PLO.js} +2 -2
  258. package/dist/cli/chunks/unified-memory-HCKOPFAY.js +2 -0
  259. package/dist/cli/chunks/unified-memory-hnsw-6NQPYA5C.js +2 -0
  260. package/dist/cli/chunks/unified-persistence-NIMKNAFR.js +2 -0
  261. package/dist/cli/chunks/{upgrade-7SCVOCPS.js → upgrade-BU6DJ4LT.js} +2 -2
  262. package/dist/cli/chunks/{validate-762ISH2Y.js → validate-MPTBARGN.js} +2 -2
  263. package/dist/cli/chunks/{validate-swarm-R6WYYXGO.js → validate-swarm-5LUQYHPP.js} +2 -2
  264. package/dist/cli/chunks/{vibium-5GZYSUDQ.js → vibium-MJJDANDL.js} +2 -2
  265. package/dist/cli/chunks/visual-security-HFGHA57Z.js +2 -0
  266. package/dist/cli/chunks/{web-tree-sitter-VYYVAJTY.js → web-tree-sitter-5TF4UGB3.js} +2 -2
  267. package/dist/cli/chunks/{windsurf-installer-RRIOR3B6.js → windsurf-installer-NQAOSVCN.js} +2 -2
  268. package/dist/cli/chunks/{witness-chain-SRVBEKDB.js → witness-chain-23UWK2JT.js} +2 -2
  269. package/dist/cli/chunks/witness-chain-VZGGJ7TJ.js +2 -0
  270. package/dist/cli/chunks/{workflow-XNUDHGEC.js → workflow-3QOLXRJC.js} +4 -4
  271. package/dist/cli/chunks/workflow-orchestrator-45L7D4SN.js +2 -0
  272. package/dist/cli/chunks/{wrappers-3STST7QW.js → wrappers-S6EUZBCX.js} +2 -2
  273. package/dist/cli/commands/code.js +78 -2
  274. package/dist/cli/completions/index.js +4 -1
  275. package/dist/domains/code-intelligence/coordinator.js +8 -4
  276. package/dist/domains/code-intelligence/services/c4-model/from-detected.d.ts +41 -0
  277. package/dist/domains/code-intelligence/services/c4-model/from-detected.js +152 -0
  278. package/dist/domains/code-intelligence/services/c4-model/kg-relationships.d.ts +71 -0
  279. package/dist/domains/code-intelligence/services/c4-model/kg-relationships.js +87 -0
  280. package/dist/domains/code-intelligence/services/knowledge-graph.d.ts +6 -0
  281. package/dist/domains/code-intelligence/services/knowledge-graph.js +3 -3
  282. package/dist/domains/code-intelligence/services/product-factors-bridge.d.ts +26 -5
  283. package/dist/domains/code-intelligence/services/product-factors-bridge.js +72 -65
  284. package/dist/mcp/bundle.js +429 -454
  285. package/dist/mcp/tools/code-intelligence/c4.d.ts +56 -0
  286. package/dist/mcp/tools/code-intelligence/c4.js +145 -0
  287. package/dist/mcp/tools/index.d.ts +1 -0
  288. package/dist/mcp/tools/index.js +1 -0
  289. package/dist/mcp/tools/registry.d.ts +1 -0
  290. package/dist/mcp/tools/registry.js +3 -0
  291. package/dist/shared/c4-model/confidence.d.ts +38 -0
  292. package/dist/shared/c4-model/confidence.js +69 -0
  293. package/dist/shared/c4-model/index.d.ts +4 -0
  294. package/dist/shared/c4-model/index.js +1 -0
  295. package/package.json +1 -1
  296. package/dist/cli/chunks/adapter-A6GCBONS.js +0 -2
  297. package/dist/cli/chunks/aqe-learning-engine-FRCSXNMG.js +0 -2
  298. package/dist/cli/chunks/base-CZ3EHBU5.js +0 -2
  299. package/dist/cli/chunks/browser-workflow-EKTGQQBQ.js +0 -2
  300. package/dist/cli/chunks/chunk-57WGS6BI.js +0 -2
  301. package/dist/cli/chunks/client-X3KUJ6R5.js +0 -2
  302. package/dist/cli/chunks/code-NO4ZKNDU.js +0 -39
  303. package/dist/cli/chunks/core-handlers-A2EQB3UH.js +0 -2
  304. package/dist/cli/chunks/cross-domain-router-OKZ2PDHT.js +0 -2
  305. package/dist/cli/chunks/dream-ZBP4Z5C3.js +0 -2
  306. package/dist/cli/chunks/heartbeat-scheduler-6JUWQXWG.js +0 -2
  307. package/dist/cli/chunks/hnsw-adapter-JT4BU7XJ.js +0 -2
  308. package/dist/cli/chunks/hnsw-index-JC5YELJX.js +0 -2
  309. package/dist/cli/chunks/hybrid-router-SLTXHUFG.js +0 -2
  310. package/dist/cli/chunks/impact-analyzer-JXHCMZXY.js +0 -2
  311. package/dist/cli/chunks/init-wizard-EX37TYOG.js +0 -2
  312. package/dist/cli/chunks/kernel-JPHAG27D.js +0 -2
  313. package/dist/cli/chunks/knowledge-graph-5QJZIRYB.js +0 -2
  314. package/dist/cli/chunks/llm-router-service-SE2RO4P5.js +0 -2
  315. package/dist/cli/chunks/load-test-LOTBWIIS.js +0 -2
  316. package/dist/cli/chunks/memory-backend-BSDKTFAN.js +0 -2
  317. package/dist/cli/chunks/pattern-null-store-LRSXCZWM.js +0 -2
  318. package/dist/cli/chunks/protocol-executor-WPUVJEL7.js +0 -2
  319. package/dist/cli/chunks/provider-manager-EVPWSH3E.js +0 -2
  320. package/dist/cli/chunks/qe-reasoning-bank-IH63FG33.js +0 -2
  321. package/dist/cli/chunks/queen-coordinator-TTCAGYQO.js +0 -2
  322. package/dist/cli/chunks/router-64Q4ILOQ.js +0 -2
  323. package/dist/cli/chunks/routing-feedback-KCZV4XXC.js +0 -2
  324. package/dist/cli/chunks/rvf-native-adapter-GNJKMURU.js +0 -2
  325. package/dist/cli/chunks/safe-db-6VBZQIJI.js +0 -2
  326. package/dist/cli/chunks/schedule-4V7O5IPX.js +0 -2
  327. package/dist/cli/chunks/scheduler-CQDMHEHN.js +0 -2
  328. package/dist/cli/chunks/sqlite-persistence-7DHUFTHL.js +0 -2
  329. package/dist/cli/chunks/unified-memory-MQA72NLP.js +0 -2
  330. package/dist/cli/chunks/unified-memory-hnsw-K7HA3CWV.js +0 -2
  331. package/dist/cli/chunks/unified-persistence-2DXB4OE4.js +0 -2
  332. package/dist/cli/chunks/visual-security-UD6CARIJ.js +0 -2
  333. package/dist/cli/chunks/witness-chain-LWALPPMC.js +0 -2
  334. package/dist/cli/chunks/workflow-orchestrator-QU652FLH.js +0 -2
@@ -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.11.1");process.exit(0)}
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.11.2");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')}),n=a=>b=>{var c=a[b];if(c)return c();throw new Error("Module not found in bundle: "+b)};var o=(a,b,c)=>()=>{if(c)throw c[0];try{return a&&(b=a(a=0)),b}catch(d){throw c=[d],d}};var p=(a,b)=>()=>{try{return b||a((b={exports:{}}).exports,b),b.exports}catch(c){throw b=0,c}},q=(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 r=(a,b,c)=>(c=a!=null?h(k(a)):{},g(b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c,a)),s=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,s as g};
@@ -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.11.1");process.exit(0)}
2
- import{d as D,e as V}from"./chunk-S7IHSELP.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-VYYVAJTY.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.11.2");process.exit(0)}
2
+ import{d as D,e as V}from"./chunk-5BDVFFYF.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-5TF4UGB3.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.11.1");process.exit(0)}
2
- import{c as w,d as E,f as T}from"./chunk-7SRSOZMP.js";var d=E((b,u)=>{"use strict";var _=typeof Buffer<"u",a=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,l=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function p(r,t,e){e==null&&t!==null&&typeof t=="object"&&(e=t,t=void 0),_&&Buffer.isBuffer(r)&&(r=r.toString()),r&&r.charCodeAt(0)===65279&&(r=r.slice(1));let o=JSON.parse(r,t);if(o===null||typeof o!="object")return o;let n=e&&e.protoAction||"error",c=e&&e.constructorAction||"error";if(n==="ignore"&&c==="ignore")return o;if(n!=="ignore"&&c!=="ignore"){if(a.test(r)===!1&&l.test(r)===!1)return o}else if(n!=="ignore"&&c==="ignore"){if(a.test(r)===!1)return o}else if(l.test(r)===!1)return o;return y(o,{protoAction:n,constructorAction:c,safe:e&&e.safe})}function y(r,{protoAction:t="error",constructorAction:e="error",safe:o}={}){let n=[r];for(;n.length;){let c=n;n=[];for(let s of c){if(t!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"__proto__")){if(o===!0)return null;if(t==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.__proto__}if(e!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"constructor")&&s.constructor!==null&&typeof s.constructor=="object"&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype")){if(o===!0)return null;if(e==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.constructor}for(let h in s){let f=s[h];f&&typeof f=="object"&&n.push(f)}}}return r}function i(r,t,e){let{stackTraceLimit:o}=Error;Error.stackTraceLimit=0;try{return p(r,t,e)}finally{Error.stackTraceLimit=o}}function m(r,t){let{stackTraceLimit:e}=Error;Error.stackTraceLimit=0;try{return p(r,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=e}}u.exports=i;u.exports.default=i;u.exports.parse=i;u.exports.safeParse=m;u.exports.scan=y});function F(r){return g.default.parse(r,void 0,{protoAction:"remove",constructorAction:"remove"})}function j(r,t){try{return F(r)}catch(e){throw new Error(`Invalid JSON in --${t}: ${e instanceof Error?e.message:"Parse error"}`)}}var g,O=w(()=>{"use strict";g=T(d(),1)});export{d as a,F as b,j as c,O as d};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.11.2");process.exit(0)}
2
+ import{c as w,d as E,f as T}from"./chunk-LIEA5EON.js";var d=E((b,u)=>{"use strict";var _=typeof Buffer<"u",a=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,l=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function p(r,t,e){e==null&&t!==null&&typeof t=="object"&&(e=t,t=void 0),_&&Buffer.isBuffer(r)&&(r=r.toString()),r&&r.charCodeAt(0)===65279&&(r=r.slice(1));let o=JSON.parse(r,t);if(o===null||typeof o!="object")return o;let n=e&&e.protoAction||"error",c=e&&e.constructorAction||"error";if(n==="ignore"&&c==="ignore")return o;if(n!=="ignore"&&c!=="ignore"){if(a.test(r)===!1&&l.test(r)===!1)return o}else if(n!=="ignore"&&c==="ignore"){if(a.test(r)===!1)return o}else if(l.test(r)===!1)return o;return y(o,{protoAction:n,constructorAction:c,safe:e&&e.safe})}function y(r,{protoAction:t="error",constructorAction:e="error",safe:o}={}){let n=[r];for(;n.length;){let c=n;n=[];for(let s of c){if(t!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"__proto__")){if(o===!0)return null;if(t==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.__proto__}if(e!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"constructor")&&s.constructor!==null&&typeof s.constructor=="object"&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype")){if(o===!0)return null;if(e==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.constructor}for(let h in s){let f=s[h];f&&typeof f=="object"&&n.push(f)}}}return r}function i(r,t,e){let{stackTraceLimit:o}=Error;Error.stackTraceLimit=0;try{return p(r,t,e)}finally{Error.stackTraceLimit=o}}function m(r,t){let{stackTraceLimit:e}=Error;Error.stackTraceLimit=0;try{return p(r,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=e}}u.exports=i;u.exports.default=i;u.exports.parse=i;u.exports.safeParse=m;u.exports.scan=y});function F(r){return g.default.parse(r,void 0,{protoAction:"remove",constructorAction:"remove"})}function j(r,t){try{return F(r)}catch(e){throw new Error(`Invalid JSON in --${t}: ${e instanceof Error?e.message:"Parse error"}`)}}var g,O=w(()=>{"use strict";g=T(d(),1)});export{d as a,F as b,j as c,O as d};
@@ -1,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.11.1");process.exit(0)}
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.11.2");process.exit(0)}
2
2
  var o=!1;function r(t){if(!o){for(let e of["ALTER TABLE routing_outcomes ADD COLUMN exploration INTEGER NOT NULL DEFAULT 0","ALTER TABLE routing_outcomes ADD COLUMN criticality REAL","ALTER TABLE routing_outcomes ADD COLUMN q_weight REAL"])try{t.prepare(e).run()}catch{}try{t.prepare("CREATE INDEX IF NOT EXISTS idx_routing_outcomes_exploration ON routing_outcomes(exploration)").run()}catch{}o=!0}}export{r 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.11.1");process.exit(0)}
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.11.2");process.exit(0)}
2
2
  import{readFileSync as R,existsSync as v,readdirSync as y}from"fs";import{join as S}from"path";var M=100*1024,b=/mcp__([a-z][a-z0-9-]*)__([a-z][a-z0-9_]*)/g,x=/^```/;function w(e,r){let n=e.length>M?e.slice(0,M):e,o=[],i=n.split(`
3
3
  `),a=!1;for(let s=0;s<i.length;s++){let p=i[s];if(x.test(p.trim())){a=!a;continue}let l,c=new RegExp(b.source,"g");for(;(l=c.exec(p))!==null;){let t=l[1],g=l[2],f=l[0],d=a?"code-block":"prose",u=d==="prose"?.9:.5;o.push({toolName:f,serverName:t,actionName:g,confidence:u,context:d,lineNumber:s+1})}}return o}function E(e){let r=new Map;for(let n of e)r.has(n.serverName)||r.set(n.serverName,[]),r.get(n.serverName).push(n);return r}function N(e){let r=[],n=[S(e,".claude","mcp.json"),S(e,".mcp.json")],o=process.env.HOME||process.env.USERPROFILE||"";o&&n.push(S(o,".claude","mcp.json"));for(let i of n)if(v(i))try{let a=R(i,"utf-8"),s=JSON.parse(a);s.mcpServers&&typeof s.mcpServers=="object"&&r.push(...Object.keys(s.mcpServers))}catch{}return[...new Set(r)]}function h(e,r,n){if(!v(e))return{agentName:r,references:[],requiredServers:[],availableServers:n,missingServers:[],warnings:[`Agent file not found: ${e}`],allSatisfied:!0};let o;try{o=R(e,"utf-8")}catch{return{agentName:r,references:[],requiredServers:[],availableServers:n,missingServers:[],warnings:[`Failed to read agent file: ${e}`],allSatisfied:!0}}let i=w(o,r),a=E(i),s=[...a.keys()],p=new Set(n),l=s.filter(t=>!p.has(t)),c=[];for(let t of l){let g=a.get(t)||[],f=Math.max(...g.map(m=>m.confidence)),d=g.length,u=[...new Set(g.map(m=>m.context))].join(", ");c.push(`[advisory] Agent "${r}" references MCP server "${t}" (${d} tool ref${d>1?"s":""}, confidence: ${f}, context: ${u}) but server is not configured. Agent may have reduced capabilities.`)}return{agentName:r,references:i,requiredServers:s,availableServers:n,missingServers:l,warnings:c,allSatisfied:l.length===0}}function C(e,r){let n=Date.now(),o=[],i=[],a=N(r);if(!v(e))return{agents:[],totalServersReferenced:0,globalMissingServers:[],agentsWithMissingDeps:[],warnings:[`Agents directory not found: ${e}`],durationMs:Date.now()-n};try{let c=y(e);for(let g of c){if(!g.endsWith(".md"))continue;let f=g.replace(".md",""),d=S(e,g),u=h(d,f,a);o.push(u),i.push(...u.warnings)}let t=S(e,"subagents");if(v(t)){let g=y(t);for(let f of g){if(!f.endsWith(".md"))continue;let d=f.replace(".md",""),u=S(t,f),m=h(u,d,a);o.push(m),i.push(...m.warnings)}}}catch(c){i.push(`Error scanning agents directory: ${c.message}`)}let s=new Set,p=new Set,l=[];for(let c of o){for(let t of c.requiredServers)s.add(t);for(let t of c.missingServers)p.add(t);c.missingServers.length>0&&l.push(c.agentName)}return{agents:o,totalServersReferenced:s.size,globalMissingServers:[...p],agentsWithMissingDeps:l,warnings:i,durationMs:Date.now()-n}}export{N as a,C as b};
@@ -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.11.1");process.exit(0)}
2
- var e=null,f=null,t=null,u=!1;async function W(){return u&&!t?e:t||(t=(async()=>{try{if(process.env.AQE_RVF_MODE==="sqlite-only"||process.env.AQE_MEMORY_BACKEND==="memory")return null;let{isRvfNativeAvailable:d}=await import("./rvf-native-adapter-GNJKMURU.js");if(!d())return null;let{getUnifiedMemory:v,findProjectRoot:p}=await import("./unified-memory-MQA72NLP.js"),o=v().getDatabase();if(!o)return null;let{join:m}=await import("node:path"),g=m(process.env.AQE_PROJECT_ROOT??p(),".agentic-qe","brain.rvf"),{RvfDualWriter:R}=await import("./rvf-dual-writer-QPRMDKYX.js"),l=new R(o,{rvfPath:g,mode:"dual-write",dimensions:384});await l.initialize(),e=l;try{let{getRvfMigrationStage:y}=await import("./feature-flags-SOXVYIBN.js"),a=y();if(a>=2){let{RvfMigrationAdapter:A}=await import("./rvf-migration-adapter-SOHBK23K.js"),s=new A({stage:a});s.setSqliteDb(o);let{getSharedRvfAdapter:D}=await import("./shared-rvf-adapter-YEUBSRNN.js"),i=D();if(i){let h={ingest:n=>i.ingest(n),search:(n,M)=>i.search(n,M).map(c=>({id:c.id,score:c.score})),delete:n=>i.delete(n),status:()=>i.status(),close:()=>{}};s.setRvfStore(h)}f=s,console.log(`[RVF] Migration adapter active at stage ${a} (${["sqlite-only","hybrid","dual-sqlite","dual-rvf","rvf-primary"][a]})`)}}catch{}return l}catch(r){return(process.env.DEBUG||process.env.AQE_VERBOSE)&&console.debug("[RVF] Dual-writer init failed, degrading to sqlite-only:",r instanceof Error?r.message:r),null}finally{u=!0,t=null,import("./base-CZ3EHBU5.js").then(({registerRvfResetFn:r})=>r(w)).catch(()=>{})}})(),t)}function S(){return e}function b(){return f}function w(){if(e){try{e.close()}catch{}e=null}f=null,t=null,u=!1}export{W as a,S as b,b as c,w as d};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.11.2");process.exit(0)}
2
+ var e=null,f=null,t=null,u=!1;async function W(){return u&&!t?e:t||(t=(async()=>{try{if(process.env.AQE_RVF_MODE==="sqlite-only"||process.env.AQE_MEMORY_BACKEND==="memory")return null;let{isRvfNativeAvailable:d}=await import("./rvf-native-adapter-YEA6TMXB.js");if(!d())return null;let{getUnifiedMemory:v,findProjectRoot:p}=await import("./unified-memory-HCKOPFAY.js"),o=v().getDatabase();if(!o)return null;let{join:m}=await import("node:path"),g=m(process.env.AQE_PROJECT_ROOT??p(),".agentic-qe","brain.rvf"),{RvfDualWriter:R}=await import("./rvf-dual-writer-H7442GMO.js"),l=new R(o,{rvfPath:g,mode:"dual-write",dimensions:384});await l.initialize(),e=l;try{let{getRvfMigrationStage:y}=await import("./feature-flags-EPTMAAKA.js"),a=y();if(a>=2){let{RvfMigrationAdapter:A}=await import("./rvf-migration-adapter-PTFQUYKC.js"),s=new A({stage:a});s.setSqliteDb(o);let{getSharedRvfAdapter:D}=await import("./shared-rvf-adapter-NPSHVUTM.js"),i=D();if(i){let h={ingest:n=>i.ingest(n),search:(n,M)=>i.search(n,M).map(c=>({id:c.id,score:c.score})),delete:n=>i.delete(n),status:()=>i.status(),close:()=>{}};s.setRvfStore(h)}f=s,console.log(`[RVF] Migration adapter active at stage ${a} (${["sqlite-only","hybrid","dual-sqlite","dual-rvf","rvf-primary"][a]})`)}}catch{}return l}catch(r){return(process.env.DEBUG||process.env.AQE_VERBOSE)&&console.debug("[RVF] Dual-writer init failed, degrading to sqlite-only:",r instanceof Error?r.message:r),null}finally{u=!0,t=null,import("./base-TSDAEMT4.js").then(({registerRvfResetFn:r})=>r(w)).catch(()=>{})}})(),t)}function S(){return e}function b(){return f}function w(){if(e){try{e.close()}catch{}e=null}f=null,t=null,u=!1}export{W as a,S as b,b as c,w 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.11.1");process.exit(0)}
2
- import{a as ie,b as ae}from"./chunk-D6MPGK7R.js";import{S as oe,i as j,p as q}from"./chunk-N4OWZLH5.js";import{c as g,e as D,g as $}from"./chunk-7SRSOZMP.js";var I,E=g(()=>{"use strict";I={dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"}});function se(){if(z)return A!==null;try{let i=(ae(),$(ie));if(A=i.differentiableSearch,P=i.init,P)try{P()}catch{}return z=!0,!0}catch{return z=!0,!1}}function B(i){let e=0;for(let r=0;r<i.length;r++)e+=i[r]*i[r];return Math.sqrt(e)}function ce(i,e,r,t){let n=r*t;if(n===0)return 0;let a=0,o=Math.min(i.length,e.length);for(let c=0;c<o;c++)a+=i[c]*e[c];return a/n}function U(i,e){let r=0,t=Math.min(i.length,e.length);for(let n=0;n<t;n++){let a=i[n]-e[n];r+=a*a}return Math.sqrt(r)}function le(i,e){if(i.length===e)return i;let r=new Float32Array(e);if(i.length>e){let t=i.length/e;for(let n=0;n<e;n++){let a=Math.floor(n*t),o=Math.floor((n+1)*t),c=0;for(let s=a;s<o;s++)c+=i[s];r[n]=c/(o-a)}}else for(let t=0;t<i.length;t++)r[t]=i[t];return r}var A,P,z,S,O=g(()=>{"use strict";E();A=null,P=null,z=!1;S=class{config;entries=[];idToIndex=new Map;hasRuvector=!1;loaded=!1;constructor(e){this.config={...I,...e}}ensureLoaded(){this.loaded||(this.hasRuvector=se(),this.loaded=!0)}normalizeVector(e){return e.length===this.config.dimensions?e:le(e,this.config.dimensions)}add(e,r,t){this.ensureLoaded();let n=this.normalizeVector(r),a=B(n);if(this.idToIndex.has(e)){let c=this.idToIndex.get(e);this.entries[c]={id:e,vector:n,norm:a,metadata:t};return}let o=this.entries.length;this.entries.push({id:e,vector:n,norm:a,metadata:t}),this.idToIndex.set(e,o)}search(e,r){if(this.ensureLoaded(),this.entries.length===0)return[];let t=this.normalizeVector(e),n=B(t),a=Math.min(r,this.entries.length),o=this.entries.length>0?this.entries[0].vector.length:0,c=t.length===o;if(this.config.metric==="cosine")return this.bruteForcSearch(t,n,a);if(this.hasRuvector&&c&&A)try{let s=this.entries.map(u=>u.vector),l=A(t,s,a,1).indices.map(u=>{let h=this.entries[u],m=-U(t,h.vector);return{id:h.id,score:m,metadata:h.metadata}});return l.sort((u,h)=>h.score-u.score),l}catch{}return this.bruteForcSearch(t,n,a)}bruteForcSearch(e,r,t){let n=[];for(let a of this.entries){let o;this.config.metric==="cosine"?o=ce(e,a.vector,r,a.norm):o=-U(e,a.vector),n.push({id:a.id,score:o,metadata:a.metadata})}return n.sort((a,o)=>o.score-a.score),n.slice(0,t)}remove(e){let r=this.idToIndex.get(e);if(r===void 0)return!1;let t=this.entries.length-1;if(r!==t){let n=this.entries[t];this.entries[r]=n,this.idToIndex.set(n.id,r)}return this.entries.pop(),this.idToIndex.delete(e),!0}size(){return this.entries.length}dimensions(){return this.config.dimensions}recall(){return this.hasRuvector,1}isRuvectorAvailable(){return this.ensureLoaded(),this.hasRuvector}getConfig(){return{...this.config}}clear(){this.entries=[],this.idToIndex.clear()}dispose(){this.clear()}}});import{createRequire as he}from"module";function de(){if(K){if(k)return k;throw new b(J??"Unknown load error")}K=!0;try{let i=ue("hnswlib-node");if(!i.HierarchicalNSW)throw new Error("hnswlib-node module missing HierarchicalNSW export");return k=i,k}catch(i){let e=i instanceof Error?i.message:String(i);throw J=e,new b(e)}}function me(i,e){if(i.length===e)return i;let r=new Float32Array(e);if(i.length>e){let t=i.length/e;for(let n=0;n<e;n++){let a=Math.floor(n*t),o=Math.floor((n+1)*t),c=0;for(let s=a;s<o;s++)c+=i[s];r[n]=c/(o-a)}}else for(let t=0;t<i.length;t++)r[t]=i[t];return r}function Q(i){let e=new Array(i.length);for(let r=0;r<i.length;r++)e[r]=i[r];return e}var ue,b,k,K,J,X,w,Y=g(()=>{"use strict";E();ue=he(import.meta.url),b=class extends Error{constructor(e){super(`Native HNSW backend unavailable: ${e}`),this.name="NativeHnswUnavailableError"}},k=null,K=!1,J=null;X=1e4,w=class{config;nativeIndex=null;currentMaxElements=X;liveIds=new Set;metadataStore=new Map;_metrics={totalSearches:0,totalAdds:0,totalRemoves:0,avgSearchLatencyMs:0,maxSearchLatencyMs:0,lastSearchLatencyMs:0,fallbackSearchCount:0,bruteForceSearchCount:0,nativeSearchCount:0,fallbackRate:0,allSearchesBruteForce:!1};constructor(e){this.config={...I,...e},this.nativeIndex=this.createFreshIndex()}createFreshIndex(){let e=de(),r=this.config.metric==="euclidean"?"l2":"cosine";try{let t=new e.HierarchicalNSW(r,this.config.dimensions);return t.initIndex(this.currentMaxElements,this.config.M,this.config.efConstruction,100,!0),t.setEf(this.config.efSearch),t}catch(t){let n=t instanceof Error?t.message:String(t);throw new b(`HierarchicalNSW init failed: ${n}`)}}add(e,r,t){if(!this.nativeIndex)throw new Error("NativeHnswBackend has been disposed");let n=this.normalizeVector(r);if(!this.liveIds.has(e)&&this.liveIds.size>=this.currentMaxElements){let a=this.currentMaxElements*2;this.nativeIndex.resizeIndex(a),this.currentMaxElements=a}this.nativeIndex.addPoint(Q(n),e,!0),this.liveIds.add(e),t?this.metadataStore.set(e,t):this.metadataStore.delete(e),this._metrics.totalAdds++}search(e,r){if(!this.nativeIndex)throw new Error("NativeHnswBackend has been disposed");if(this.liveIds.size===0||r<=0)return[];let t=performance.now(),n=this.normalizeVector(e),a=Math.min(r,this.liveIds.size),o=Math.min(a*2,this.liveIds.size),c=this.nativeIndex.searchKnn(Q(n),o),s=this.config.metric==="cosine",d=new Map;for(let h=0;h<c.neighbors.length;h++){let m=c.neighbors[h];if(!this.liveIds.has(m))continue;let x=c.distances[h],f=s?1-x:-x,W=d.get(m);(W===void 0||f>W.score)&&d.set(m,{id:m,score:f,metadata:this.metadataStore.get(m)})}let l=Array.from(d.values());l.sort((h,m)=>m.score-h.score),l.length>a&&(l.length=a);let u=performance.now()-t;return this.updateSearchMetrics(u),this._metrics.nativeSearchCount=this._metrics.totalSearches,u>50&&console.warn(`[NativeHNSW] search took ${u.toFixed(1)}ms (k=${r}, results=${l.length})`),l}remove(e){if(!this.nativeIndex||!this.liveIds.has(e))return!1;try{this.nativeIndex.markDelete(e)}catch{return!1}return this.liveIds.delete(e),this.metadataStore.delete(e),this._metrics.totalRemoves++,!0}size(){return this.liveIds.size}dimensions(){return this.config.dimensions}recall(){return .99}getMetrics(){return{...this._metrics}}get lastSearchLatencyMs(){return this._metrics.lastSearchLatencyMs}getConfig(){return{...this.config}}clear(){this.nativeIndex&&(this.liveIds.clear(),this.metadataStore.clear(),this.currentMaxElements=X,this.nativeIndex=this.createFreshIndex())}dispose(){this.liveIds.clear(),this.metadataStore.clear(),this.nativeIndex=null}isNativeAvailable(){return this.nativeIndex!==null}normalizeVector(e){return e.length===this.config.dimensions?e:me(e,this.config.dimensions)}updateSearchMetrics(e){this._metrics.totalSearches++,this._metrics.lastSearchLatencyMs=e,e>this._metrics.maxSearchLatencyMs&&(this._metrics.maxSearchLatencyMs=e);let r=this._metrics.totalSearches;this._metrics.avgSearchLatencyMs=this._metrics.avgSearchLatencyMs*((r-1)/r)+e/r}}});function Z(i,e){let r=Array.from({length:e},()=>new Float64Array(e));for(let t=0;t<e;t++){let n=i[t].length;r[t][t]=n;for(let a of i[t])r[t][a]=-1}return r}function N(i,e){let r=e.length,t=new Float64Array(r);for(let n=0;n<r;n++){let a=i[n].length;t[n]=a*e[n];for(let o of i[n])t[n]-=e[o]}return t}function H(i){let e=0;for(let r=0;r<i.length;r++)e+=i[r]*i[r];return Math.sqrt(e)}function R(i){let e=H(i);if(e>0)for(let r=0;r<i.length;r++)i[r]/=e}function v(i,e){let r=0;for(let t=0;t<i.length;t++)r+=i[t]*e[t];for(let t=0;t<i.length;t++)i[t]-=r*e[t]}function y(i,e,r=100,t=1e-6){if(e<=1)return 0;if(e===2)return i[0].includes(1)?2:0;let n=new Float64Array(e).fill(1/Math.sqrt(e)),a=new Float64Array(e);for(let l=0;l<e;l++)a[l]=Math.random()-.5;v(a,n),R(a);let o=0;for(let l=0;l<30;l++){let u=N(i,a);if(v(u,n),o=H(u),o>0)for(let h=0;h<e;h++)a[h]=u[h]/o}if(o<t)return 0;let c=new Float64Array(e);for(let l=0;l<e;l++)c[l]=Math.random()-.5;v(c,n),R(c);let s=0;for(let l=0;l<r;l++){let u=N(i,c),h=new Float64Array(e);for(let f=0;f<e;f++)h[f]=o*c[f]-u[f];v(h,n);let m=H(h);if(m<t)break;let x=m;for(let f=0;f<e;f++)c[f]=h[f]/m;if(Math.abs(x-s)<t)break;s=x}let d=o-s;return Math.max(0,d)}function F(i,e,r=100,t=1e-6){return y(i,e,r,t)}function C(i,e,r=50,t){if(e<=1)return 0;let n=t??y(i,e);if(n<1e-10)return 1/0;let o=2*Math.max(...i.map(d=>d.length),1),s=2*(Math.log(o/n)/(o-n));return Math.max(0,s)}function M(i,e,r){let t=1-Math.exp(-i/.05),n=1-Math.exp(-e/.5),a=r===1/0?0:1/(1+r/5),o=.4*t+.3*n+.3*a;return Math.max(0,Math.min(1,o))}var _=g(()=>{"use strict"});var re={};D(re,{ALERT_THRESHOLDS:()=>fe,DEFAULT_HNSW_HEALTH_CONFIG:()=>ee,HnswHealthMonitor:()=>L,_resetNativeLoader:()=>be,approximateFiedlerValue:()=>y,approximateSpectralGap:()=>F,buildAdjacencyFromIndex:()=>te,buildLaplacian:()=>Z,computeCoherenceScore:()=>M,createHnswHealthMonitor:()=>ge,deflateVector:()=>v,estimateEffectiveResistance:()=>C,laplacianMultiply:()=>N,normalizeInPlace:()=>R,vectorNorm:()=>H});function pe(){return V?T:(V=!0,T=null,null)}function be(){T=null,V=!1}function te(i,e=16,r){let t=i.size();if(t===0)return{adjacency:[],nodeCount:0,adjacencySource:"approximate"};let n=Array.from({length:t},()=>[]),a=Math.min(e,t-1);if(a===0)return{adjacency:n,nodeCount:t,adjacencySource:"approximate"};if(r&&r.size>0){let o=Array.from(r.keys()).slice(0,t),c=new Map;for(let s=0;s<o.length;s++)c.set(o[s],s);for(let s=0;s<o.length;s++){let d=r.get(o[s]);if(!d)continue;let l=i.search(d,a+1);for(let u of l){if(u.id===o[s])continue;let h=c.get(u.id);h!==void 0&&(n[s].includes(h)||n[s].push(h),n[h].includes(s)||n[h].push(s))}}return{adjacency:n,nodeCount:t,adjacencySource:"actual-search"}}console.warn("[HnswHealthMonitor] No stored vectors provided \u2014 using approximate circular adjacency. Pass stored vectors for accurate health metrics.");for(let o=0;o<t;o++)for(let c=0;c<a;c++){let s=(o+c+1)%t;n[o].includes(s)||n[o].push(s),n[s].includes(o)||n[s].push(o)}return{adjacency:n,nodeCount:t,adjacencySource:"approximate"}}function ge(i){return new L(i)}var ee,fe,T,V,L,ne=g(()=>{"use strict";_();_();ee={fiedlerThreshold:.01,spectralGapThreshold:.1,resistanceThreshold:10,coherenceThreshold:.3,maxPowerIterations:100,convergenceTolerance:1e-6,resistanceSampleSize:50,maxHistoryEntries:200,minIndexSize:3},fe={FragileIndex:.01,PoorExpansion:.1,HighResistance:10,LowCoherence:.3},T=null,V=!1;L=class{config;alerts=[];history=[];lastReport=null;useNative=!1;nativeChecked=!1;constructor(e){this.config={...ee,...e}}checkHealth(e){let r=performance.now(),t=e.size();if(t<this.config.minIndexSize)return this.createSmallIndexReport(t,performance.now()-r);this.nativeChecked||(this.nativeChecked=!0,this.useNative=pe()!==null);let{adjacency:n,nodeCount:a,adjacencySource:o}=te(e),c=this.useNative?this.computeNativeMetrics(n):this.computeApproximateMetrics(n,a),s=this.generateAlerts(c);this.alerts.length=0,this.alerts.push(...s);let d=performance.now()-r,l={healthy:s.length===0,metrics:c,alerts:s,indexSize:t,usedNativeBackend:this.useNative,adjacencySource:o,checkDurationMs:d,checkedAt:new Date};return this.addHistoryPoint({coherenceScore:c.coherenceScore,fiedlerValue:c.fiedlerValue,indexSize:t,healthy:l.healthy,timestamp:l.checkedAt}),this.lastReport=l,l}getAlerts(){return[...this.alerts]}getMetricsHistory(e){let r=[...this.history];return e!==void 0&&e<r.length?r.slice(-e):r}isHealthy(){return this.lastReport===null?!0:this.lastReport.healthy}getLastReport(){return this.lastReport}clearHistory(){this.history.length=0,this.alerts.length=0,this.lastReport=null}computeNativeMetrics(e){let r=T,t=r.computeFiedlerValue(e),n=r.computeSpectralGap(e),a=r.computeEffectiveResistance(e),o=M(t,n,a);return{fiedlerValue:t,spectralGap:n,effectiveResistance:a,coherenceScore:o}}computeApproximateMetrics(e,r){let t=y(e,r,this.config.maxPowerIterations,this.config.convergenceTolerance),n=F(e,r,this.config.maxPowerIterations,this.config.convergenceTolerance),a=C(e,r,this.config.resistanceSampleSize,t),o=M(t,n,a);return{fiedlerValue:t,spectralGap:n,effectiveResistance:a,coherenceScore:o}}generateAlerts(e){let r=[],t=new Date;return e.fiedlerValue<this.config.fiedlerThreshold&&r.push({type:"FragileIndex",message:`Fiedler value ${e.fiedlerValue.toFixed(6)} is below threshold ${this.config.fiedlerThreshold}. The index graph has weak algebraic connectivity.`,value:e.fiedlerValue,threshold:this.config.fiedlerThreshold,timestamp:t}),e.spectralGap<this.config.spectralGapThreshold&&r.push({type:"PoorExpansion",message:`Spectral gap ${e.spectralGap.toFixed(6)} is below threshold ${this.config.spectralGapThreshold}. The index graph has poor expansion properties.`,value:e.spectralGap,threshold:this.config.spectralGapThreshold,timestamp:t}),e.effectiveResistance>this.config.resistanceThreshold&&r.push({type:"HighResistance",message:`Average effective resistance ${e.effectiveResistance.toFixed(4)} exceeds threshold ${this.config.resistanceThreshold}. Nodes are poorly connected.`,value:e.effectiveResistance,threshold:this.config.resistanceThreshold,timestamp:t}),e.coherenceScore<this.config.coherenceThreshold&&r.push({type:"LowCoherence",message:`Coherence score ${e.coherenceScore.toFixed(4)} is below threshold ${this.config.coherenceThreshold}. Overall index health is degraded.`,value:e.coherenceScore,threshold:this.config.coherenceThreshold,timestamp:t}),r}createSmallIndexReport(e,r){let t={fiedlerValue:e>0?1:0,spectralGap:e>0?1:0,effectiveResistance:e>0?.5:0,coherenceScore:e>0?1:0},n={healthy:!0,metrics:t,alerts:[],indexSize:e,usedNativeBackend:!1,adjacencySource:"approximate",checkDurationMs:r,checkedAt:new Date};return this.addHistoryPoint({coherenceScore:t.coherenceScore,fiedlerValue:t.fiedlerValue,indexSize:e,healthy:!0,timestamp:n.checkedAt}),this.lastReport=n,n}addHistoryPoint(e){this.history.push(e),this.history.length>this.config.maxHistoryEntries&&this.history.splice(0,this.history.length-this.config.maxHistoryEntries)}}});var ye={};D(ye,{HnswAdapter:()=>G});var ve,p,G,xe=g(()=>{O();Y();oe();ve={patterns:{dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"},"qe-memory":{dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"},learning:{dimensions:384,M:16,efConstruction:200,efSearch:50,metric:"cosine"},coverage:{dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"}},p=new Map,G=class i{backend;_isNativeBackend;indexName;stringToNumericId=new Map;numericToStringId=new Map;nextAutoId=0;healthMonitor=null;healthMonitorLoaded=!1;operationsSinceLastCheck=0;healthCheckFrequency=100;lastHealthReport=null;constructor(e,r){this.indexName=e;let n={...ve[e]??{},...r},{backend:a,isNative:o}=i.createBackend(n);this.backend=a,this._isNativeBackend=o}add(e,r,t){this.backend.add(e,r,t),this.maybeRunHealthCheck()}search(e,r){let t=performance.now(),n=this.backend.search(e,r),a=performance.now()-t;return a>50&&console.warn(`[HNSW] search took ${a.toFixed(1)}ms (k=${r}, results=${n.length})`),this._lastSearchLatencyMs=a,n}_lastSearchLatencyMs=0;get lastSearchLatencyMs(){return this._lastSearchLatencyMs}remove(e){return this.backend.remove(e)}size(){return this.backend.size()}dimensions(){return this.backend.dimensions()}recall(){return this.backend.recall()}addByStringId(e,r){let t=this.stringToNumericId.get(e);t!==void 0?this.backend.remove(t):(t=this.nextAutoId++,this.stringToNumericId.set(e,t),this.numericToStringId.set(t,e)),this.backend.add(t,new Float32Array(r))}searchByArray(e,r){return this.backend.search(new Float32Array(e),r).map(n=>({id:this.numericToStringId.get(n.id)??String(n.id),score:n.score}))}removeByStringId(e){let r=this.stringToNumericId.get(e);if(r===void 0)return!1;let t=this.backend.remove(r);return t&&(this.stringToNumericId.delete(e),this.numericToStringId.delete(r)),t}clear(){this.backend.clear?.(),this.stringToNumericId.clear(),this.numericToStringId.clear(),this.nextAutoId=0}dispose(){try{this.backend.dispose?.()}catch{}this.stringToNumericId.clear(),this.numericToStringId.clear(),this.nextAutoId=0}isRuvectorAvailable(){return this.backend instanceof S?this.backend.isRuvectorAvailable():this.backend instanceof w?this.backend.isNativeAvailable():!1}isNativeBackend(){return this._isNativeBackend}getName(){return this.indexName}setHealthCheckFrequency(e){this.healthCheckFrequency=Math.max(1,e)}getHealthCheckFrequency(){return this.healthCheckFrequency}getLastHealthReport(){return this.lastHealthReport}getHealthMonitor(){return this.healthMonitor}maybeRunHealthCheck(){if(q()&&(this.operationsSinceLastCheck++,!(this.operationsSinceLastCheck<this.healthCheckFrequency)&&(this.operationsSinceLastCheck=0,this.ensureHealthMonitor(),this.healthMonitor)))try{this.lastHealthReport=this.healthMonitor.checkHealth(this.backend),this.lastHealthReport.healthy||console.warn(`[HNSW-Health] Index "${this.indexName}" health check failed: ${this.lastHealthReport.alerts.length} alert(s). Coherence: ${this.lastHealthReport.metrics.coherenceScore.toFixed(3)}`)}catch(e){console.warn(`[HNSW-Health] Health check error for "${this.indexName}":`,e)}}ensureHealthMonitor(){if(!this.healthMonitorLoaded){this.healthMonitorLoaded=!0;try{let e=(ne(),$(re));this.healthMonitor=e.createHnswHealthMonitor()}catch(e){process.env.DEBUG&&console.debug("[HNSW-Health] Monitor module unavailable:",e instanceof Error?e.message:e),this.healthMonitor=null}}}static createBackend(e){if(j())try{return{backend:new w(e),isNative:!0}}catch(r){r instanceof b?console.info(`[HNSW] Native backend unavailable, falling back to JS: ${r.message}`):console.warn("[HNSW] Unexpected error creating native backend, falling back to JS:",r)}return{backend:new S(e),isNative:!1}}static create(e,r){let t=p.get(e);if(t instanceof i)return t;let n=new i(e,r);return p.set(e,n),n}static get(e){let r=p.get(e);return r instanceof i?r:void 0}static close(e){let r=p.get(e);r instanceof i&&r.dispose(),p.delete(e)}static closeAll(){for(let[e]of p)i.close(e);p.clear()}static listIndexes(){return Array.from(p.keys())}}});export{G as a,ye as b,xe 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.11.2");process.exit(0)}
2
+ import{a as ie,b as ae}from"./chunk-UCXW24HY.js";import{S as oe,i as j,p as q}from"./chunk-WKIYYF3G.js";import{c as g,e as D,g as $}from"./chunk-LIEA5EON.js";var I,E=g(()=>{"use strict";I={dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"}});function se(){if(z)return A!==null;try{let i=(ae(),$(ie));if(A=i.differentiableSearch,P=i.init,P)try{P()}catch{}return z=!0,!0}catch{return z=!0,!1}}function B(i){let e=0;for(let r=0;r<i.length;r++)e+=i[r]*i[r];return Math.sqrt(e)}function ce(i,e,r,t){let n=r*t;if(n===0)return 0;let a=0,o=Math.min(i.length,e.length);for(let c=0;c<o;c++)a+=i[c]*e[c];return a/n}function U(i,e){let r=0,t=Math.min(i.length,e.length);for(let n=0;n<t;n++){let a=i[n]-e[n];r+=a*a}return Math.sqrt(r)}function le(i,e){if(i.length===e)return i;let r=new Float32Array(e);if(i.length>e){let t=i.length/e;for(let n=0;n<e;n++){let a=Math.floor(n*t),o=Math.floor((n+1)*t),c=0;for(let s=a;s<o;s++)c+=i[s];r[n]=c/(o-a)}}else for(let t=0;t<i.length;t++)r[t]=i[t];return r}var A,P,z,S,O=g(()=>{"use strict";E();A=null,P=null,z=!1;S=class{config;entries=[];idToIndex=new Map;hasRuvector=!1;loaded=!1;constructor(e){this.config={...I,...e}}ensureLoaded(){this.loaded||(this.hasRuvector=se(),this.loaded=!0)}normalizeVector(e){return e.length===this.config.dimensions?e:le(e,this.config.dimensions)}add(e,r,t){this.ensureLoaded();let n=this.normalizeVector(r),a=B(n);if(this.idToIndex.has(e)){let c=this.idToIndex.get(e);this.entries[c]={id:e,vector:n,norm:a,metadata:t};return}let o=this.entries.length;this.entries.push({id:e,vector:n,norm:a,metadata:t}),this.idToIndex.set(e,o)}search(e,r){if(this.ensureLoaded(),this.entries.length===0)return[];let t=this.normalizeVector(e),n=B(t),a=Math.min(r,this.entries.length),o=this.entries.length>0?this.entries[0].vector.length:0,c=t.length===o;if(this.config.metric==="cosine")return this.bruteForcSearch(t,n,a);if(this.hasRuvector&&c&&A)try{let s=this.entries.map(u=>u.vector),l=A(t,s,a,1).indices.map(u=>{let h=this.entries[u],m=-U(t,h.vector);return{id:h.id,score:m,metadata:h.metadata}});return l.sort((u,h)=>h.score-u.score),l}catch{}return this.bruteForcSearch(t,n,a)}bruteForcSearch(e,r,t){let n=[];for(let a of this.entries){let o;this.config.metric==="cosine"?o=ce(e,a.vector,r,a.norm):o=-U(e,a.vector),n.push({id:a.id,score:o,metadata:a.metadata})}return n.sort((a,o)=>o.score-a.score),n.slice(0,t)}remove(e){let r=this.idToIndex.get(e);if(r===void 0)return!1;let t=this.entries.length-1;if(r!==t){let n=this.entries[t];this.entries[r]=n,this.idToIndex.set(n.id,r)}return this.entries.pop(),this.idToIndex.delete(e),!0}size(){return this.entries.length}dimensions(){return this.config.dimensions}recall(){return this.hasRuvector,1}isRuvectorAvailable(){return this.ensureLoaded(),this.hasRuvector}getConfig(){return{...this.config}}clear(){this.entries=[],this.idToIndex.clear()}dispose(){this.clear()}}});import{createRequire as he}from"module";function de(){if(K){if(k)return k;throw new b(J??"Unknown load error")}K=!0;try{let i=ue("hnswlib-node");if(!i.HierarchicalNSW)throw new Error("hnswlib-node module missing HierarchicalNSW export");return k=i,k}catch(i){let e=i instanceof Error?i.message:String(i);throw J=e,new b(e)}}function me(i,e){if(i.length===e)return i;let r=new Float32Array(e);if(i.length>e){let t=i.length/e;for(let n=0;n<e;n++){let a=Math.floor(n*t),o=Math.floor((n+1)*t),c=0;for(let s=a;s<o;s++)c+=i[s];r[n]=c/(o-a)}}else for(let t=0;t<i.length;t++)r[t]=i[t];return r}function Q(i){let e=new Array(i.length);for(let r=0;r<i.length;r++)e[r]=i[r];return e}var ue,b,k,K,J,X,w,Y=g(()=>{"use strict";E();ue=he(import.meta.url),b=class extends Error{constructor(e){super(`Native HNSW backend unavailable: ${e}`),this.name="NativeHnswUnavailableError"}},k=null,K=!1,J=null;X=1e4,w=class{config;nativeIndex=null;currentMaxElements=X;liveIds=new Set;metadataStore=new Map;_metrics={totalSearches:0,totalAdds:0,totalRemoves:0,avgSearchLatencyMs:0,maxSearchLatencyMs:0,lastSearchLatencyMs:0,fallbackSearchCount:0,bruteForceSearchCount:0,nativeSearchCount:0,fallbackRate:0,allSearchesBruteForce:!1};constructor(e){this.config={...I,...e},this.nativeIndex=this.createFreshIndex()}createFreshIndex(){let e=de(),r=this.config.metric==="euclidean"?"l2":"cosine";try{let t=new e.HierarchicalNSW(r,this.config.dimensions);return t.initIndex(this.currentMaxElements,this.config.M,this.config.efConstruction,100,!0),t.setEf(this.config.efSearch),t}catch(t){let n=t instanceof Error?t.message:String(t);throw new b(`HierarchicalNSW init failed: ${n}`)}}add(e,r,t){if(!this.nativeIndex)throw new Error("NativeHnswBackend has been disposed");let n=this.normalizeVector(r);if(!this.liveIds.has(e)&&this.liveIds.size>=this.currentMaxElements){let a=this.currentMaxElements*2;this.nativeIndex.resizeIndex(a),this.currentMaxElements=a}this.nativeIndex.addPoint(Q(n),e,!0),this.liveIds.add(e),t?this.metadataStore.set(e,t):this.metadataStore.delete(e),this._metrics.totalAdds++}search(e,r){if(!this.nativeIndex)throw new Error("NativeHnswBackend has been disposed");if(this.liveIds.size===0||r<=0)return[];let t=performance.now(),n=this.normalizeVector(e),a=Math.min(r,this.liveIds.size),o=Math.min(a*2,this.liveIds.size),c=this.nativeIndex.searchKnn(Q(n),o),s=this.config.metric==="cosine",d=new Map;for(let h=0;h<c.neighbors.length;h++){let m=c.neighbors[h];if(!this.liveIds.has(m))continue;let x=c.distances[h],f=s?1-x:-x,W=d.get(m);(W===void 0||f>W.score)&&d.set(m,{id:m,score:f,metadata:this.metadataStore.get(m)})}let l=Array.from(d.values());l.sort((h,m)=>m.score-h.score),l.length>a&&(l.length=a);let u=performance.now()-t;return this.updateSearchMetrics(u),this._metrics.nativeSearchCount=this._metrics.totalSearches,u>50&&console.warn(`[NativeHNSW] search took ${u.toFixed(1)}ms (k=${r}, results=${l.length})`),l}remove(e){if(!this.nativeIndex||!this.liveIds.has(e))return!1;try{this.nativeIndex.markDelete(e)}catch{return!1}return this.liveIds.delete(e),this.metadataStore.delete(e),this._metrics.totalRemoves++,!0}size(){return this.liveIds.size}dimensions(){return this.config.dimensions}recall(){return .99}getMetrics(){return{...this._metrics}}get lastSearchLatencyMs(){return this._metrics.lastSearchLatencyMs}getConfig(){return{...this.config}}clear(){this.nativeIndex&&(this.liveIds.clear(),this.metadataStore.clear(),this.currentMaxElements=X,this.nativeIndex=this.createFreshIndex())}dispose(){this.liveIds.clear(),this.metadataStore.clear(),this.nativeIndex=null}isNativeAvailable(){return this.nativeIndex!==null}normalizeVector(e){return e.length===this.config.dimensions?e:me(e,this.config.dimensions)}updateSearchMetrics(e){this._metrics.totalSearches++,this._metrics.lastSearchLatencyMs=e,e>this._metrics.maxSearchLatencyMs&&(this._metrics.maxSearchLatencyMs=e);let r=this._metrics.totalSearches;this._metrics.avgSearchLatencyMs=this._metrics.avgSearchLatencyMs*((r-1)/r)+e/r}}});function Z(i,e){let r=Array.from({length:e},()=>new Float64Array(e));for(let t=0;t<e;t++){let n=i[t].length;r[t][t]=n;for(let a of i[t])r[t][a]=-1}return r}function N(i,e){let r=e.length,t=new Float64Array(r);for(let n=0;n<r;n++){let a=i[n].length;t[n]=a*e[n];for(let o of i[n])t[n]-=e[o]}return t}function H(i){let e=0;for(let r=0;r<i.length;r++)e+=i[r]*i[r];return Math.sqrt(e)}function R(i){let e=H(i);if(e>0)for(let r=0;r<i.length;r++)i[r]/=e}function v(i,e){let r=0;for(let t=0;t<i.length;t++)r+=i[t]*e[t];for(let t=0;t<i.length;t++)i[t]-=r*e[t]}function y(i,e,r=100,t=1e-6){if(e<=1)return 0;if(e===2)return i[0].includes(1)?2:0;let n=new Float64Array(e).fill(1/Math.sqrt(e)),a=new Float64Array(e);for(let l=0;l<e;l++)a[l]=Math.random()-.5;v(a,n),R(a);let o=0;for(let l=0;l<30;l++){let u=N(i,a);if(v(u,n),o=H(u),o>0)for(let h=0;h<e;h++)a[h]=u[h]/o}if(o<t)return 0;let c=new Float64Array(e);for(let l=0;l<e;l++)c[l]=Math.random()-.5;v(c,n),R(c);let s=0;for(let l=0;l<r;l++){let u=N(i,c),h=new Float64Array(e);for(let f=0;f<e;f++)h[f]=o*c[f]-u[f];v(h,n);let m=H(h);if(m<t)break;let x=m;for(let f=0;f<e;f++)c[f]=h[f]/m;if(Math.abs(x-s)<t)break;s=x}let d=o-s;return Math.max(0,d)}function F(i,e,r=100,t=1e-6){return y(i,e,r,t)}function C(i,e,r=50,t){if(e<=1)return 0;let n=t??y(i,e);if(n<1e-10)return 1/0;let o=2*Math.max(...i.map(d=>d.length),1),s=2*(Math.log(o/n)/(o-n));return Math.max(0,s)}function M(i,e,r){let t=1-Math.exp(-i/.05),n=1-Math.exp(-e/.5),a=r===1/0?0:1/(1+r/5),o=.4*t+.3*n+.3*a;return Math.max(0,Math.min(1,o))}var _=g(()=>{"use strict"});var re={};D(re,{ALERT_THRESHOLDS:()=>fe,DEFAULT_HNSW_HEALTH_CONFIG:()=>ee,HnswHealthMonitor:()=>L,_resetNativeLoader:()=>be,approximateFiedlerValue:()=>y,approximateSpectralGap:()=>F,buildAdjacencyFromIndex:()=>te,buildLaplacian:()=>Z,computeCoherenceScore:()=>M,createHnswHealthMonitor:()=>ge,deflateVector:()=>v,estimateEffectiveResistance:()=>C,laplacianMultiply:()=>N,normalizeInPlace:()=>R,vectorNorm:()=>H});function pe(){return V?T:(V=!0,T=null,null)}function be(){T=null,V=!1}function te(i,e=16,r){let t=i.size();if(t===0)return{adjacency:[],nodeCount:0,adjacencySource:"approximate"};let n=Array.from({length:t},()=>[]),a=Math.min(e,t-1);if(a===0)return{adjacency:n,nodeCount:t,adjacencySource:"approximate"};if(r&&r.size>0){let o=Array.from(r.keys()).slice(0,t),c=new Map;for(let s=0;s<o.length;s++)c.set(o[s],s);for(let s=0;s<o.length;s++){let d=r.get(o[s]);if(!d)continue;let l=i.search(d,a+1);for(let u of l){if(u.id===o[s])continue;let h=c.get(u.id);h!==void 0&&(n[s].includes(h)||n[s].push(h),n[h].includes(s)||n[h].push(s))}}return{adjacency:n,nodeCount:t,adjacencySource:"actual-search"}}console.warn("[HnswHealthMonitor] No stored vectors provided \u2014 using approximate circular adjacency. Pass stored vectors for accurate health metrics.");for(let o=0;o<t;o++)for(let c=0;c<a;c++){let s=(o+c+1)%t;n[o].includes(s)||n[o].push(s),n[s].includes(o)||n[s].push(o)}return{adjacency:n,nodeCount:t,adjacencySource:"approximate"}}function ge(i){return new L(i)}var ee,fe,T,V,L,ne=g(()=>{"use strict";_();_();ee={fiedlerThreshold:.01,spectralGapThreshold:.1,resistanceThreshold:10,coherenceThreshold:.3,maxPowerIterations:100,convergenceTolerance:1e-6,resistanceSampleSize:50,maxHistoryEntries:200,minIndexSize:3},fe={FragileIndex:.01,PoorExpansion:.1,HighResistance:10,LowCoherence:.3},T=null,V=!1;L=class{config;alerts=[];history=[];lastReport=null;useNative=!1;nativeChecked=!1;constructor(e){this.config={...ee,...e}}checkHealth(e){let r=performance.now(),t=e.size();if(t<this.config.minIndexSize)return this.createSmallIndexReport(t,performance.now()-r);this.nativeChecked||(this.nativeChecked=!0,this.useNative=pe()!==null);let{adjacency:n,nodeCount:a,adjacencySource:o}=te(e),c=this.useNative?this.computeNativeMetrics(n):this.computeApproximateMetrics(n,a),s=this.generateAlerts(c);this.alerts.length=0,this.alerts.push(...s);let d=performance.now()-r,l={healthy:s.length===0,metrics:c,alerts:s,indexSize:t,usedNativeBackend:this.useNative,adjacencySource:o,checkDurationMs:d,checkedAt:new Date};return this.addHistoryPoint({coherenceScore:c.coherenceScore,fiedlerValue:c.fiedlerValue,indexSize:t,healthy:l.healthy,timestamp:l.checkedAt}),this.lastReport=l,l}getAlerts(){return[...this.alerts]}getMetricsHistory(e){let r=[...this.history];return e!==void 0&&e<r.length?r.slice(-e):r}isHealthy(){return this.lastReport===null?!0:this.lastReport.healthy}getLastReport(){return this.lastReport}clearHistory(){this.history.length=0,this.alerts.length=0,this.lastReport=null}computeNativeMetrics(e){let r=T,t=r.computeFiedlerValue(e),n=r.computeSpectralGap(e),a=r.computeEffectiveResistance(e),o=M(t,n,a);return{fiedlerValue:t,spectralGap:n,effectiveResistance:a,coherenceScore:o}}computeApproximateMetrics(e,r){let t=y(e,r,this.config.maxPowerIterations,this.config.convergenceTolerance),n=F(e,r,this.config.maxPowerIterations,this.config.convergenceTolerance),a=C(e,r,this.config.resistanceSampleSize,t),o=M(t,n,a);return{fiedlerValue:t,spectralGap:n,effectiveResistance:a,coherenceScore:o}}generateAlerts(e){let r=[],t=new Date;return e.fiedlerValue<this.config.fiedlerThreshold&&r.push({type:"FragileIndex",message:`Fiedler value ${e.fiedlerValue.toFixed(6)} is below threshold ${this.config.fiedlerThreshold}. The index graph has weak algebraic connectivity.`,value:e.fiedlerValue,threshold:this.config.fiedlerThreshold,timestamp:t}),e.spectralGap<this.config.spectralGapThreshold&&r.push({type:"PoorExpansion",message:`Spectral gap ${e.spectralGap.toFixed(6)} is below threshold ${this.config.spectralGapThreshold}. The index graph has poor expansion properties.`,value:e.spectralGap,threshold:this.config.spectralGapThreshold,timestamp:t}),e.effectiveResistance>this.config.resistanceThreshold&&r.push({type:"HighResistance",message:`Average effective resistance ${e.effectiveResistance.toFixed(4)} exceeds threshold ${this.config.resistanceThreshold}. Nodes are poorly connected.`,value:e.effectiveResistance,threshold:this.config.resistanceThreshold,timestamp:t}),e.coherenceScore<this.config.coherenceThreshold&&r.push({type:"LowCoherence",message:`Coherence score ${e.coherenceScore.toFixed(4)} is below threshold ${this.config.coherenceThreshold}. Overall index health is degraded.`,value:e.coherenceScore,threshold:this.config.coherenceThreshold,timestamp:t}),r}createSmallIndexReport(e,r){let t={fiedlerValue:e>0?1:0,spectralGap:e>0?1:0,effectiveResistance:e>0?.5:0,coherenceScore:e>0?1:0},n={healthy:!0,metrics:t,alerts:[],indexSize:e,usedNativeBackend:!1,adjacencySource:"approximate",checkDurationMs:r,checkedAt:new Date};return this.addHistoryPoint({coherenceScore:t.coherenceScore,fiedlerValue:t.fiedlerValue,indexSize:e,healthy:!0,timestamp:n.checkedAt}),this.lastReport=n,n}addHistoryPoint(e){this.history.push(e),this.history.length>this.config.maxHistoryEntries&&this.history.splice(0,this.history.length-this.config.maxHistoryEntries)}}});var ye={};D(ye,{HnswAdapter:()=>G});var ve,p,G,xe=g(()=>{O();Y();oe();ve={patterns:{dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"},"qe-memory":{dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"},learning:{dimensions:384,M:16,efConstruction:200,efSearch:50,metric:"cosine"},coverage:{dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"}},p=new Map,G=class i{backend;_isNativeBackend;indexName;stringToNumericId=new Map;numericToStringId=new Map;nextAutoId=0;healthMonitor=null;healthMonitorLoaded=!1;operationsSinceLastCheck=0;healthCheckFrequency=100;lastHealthReport=null;constructor(e,r){this.indexName=e;let n={...ve[e]??{},...r},{backend:a,isNative:o}=i.createBackend(n);this.backend=a,this._isNativeBackend=o}add(e,r,t){this.backend.add(e,r,t),this.maybeRunHealthCheck()}search(e,r){let t=performance.now(),n=this.backend.search(e,r),a=performance.now()-t;return a>50&&console.warn(`[HNSW] search took ${a.toFixed(1)}ms (k=${r}, results=${n.length})`),this._lastSearchLatencyMs=a,n}_lastSearchLatencyMs=0;get lastSearchLatencyMs(){return this._lastSearchLatencyMs}remove(e){return this.backend.remove(e)}size(){return this.backend.size()}dimensions(){return this.backend.dimensions()}recall(){return this.backend.recall()}addByStringId(e,r){let t=this.stringToNumericId.get(e);t!==void 0?this.backend.remove(t):(t=this.nextAutoId++,this.stringToNumericId.set(e,t),this.numericToStringId.set(t,e)),this.backend.add(t,new Float32Array(r))}searchByArray(e,r){return this.backend.search(new Float32Array(e),r).map(n=>({id:this.numericToStringId.get(n.id)??String(n.id),score:n.score}))}removeByStringId(e){let r=this.stringToNumericId.get(e);if(r===void 0)return!1;let t=this.backend.remove(r);return t&&(this.stringToNumericId.delete(e),this.numericToStringId.delete(r)),t}clear(){this.backend.clear?.(),this.stringToNumericId.clear(),this.numericToStringId.clear(),this.nextAutoId=0}dispose(){try{this.backend.dispose?.()}catch{}this.stringToNumericId.clear(),this.numericToStringId.clear(),this.nextAutoId=0}isRuvectorAvailable(){return this.backend instanceof S?this.backend.isRuvectorAvailable():this.backend instanceof w?this.backend.isNativeAvailable():!1}isNativeBackend(){return this._isNativeBackend}getName(){return this.indexName}setHealthCheckFrequency(e){this.healthCheckFrequency=Math.max(1,e)}getHealthCheckFrequency(){return this.healthCheckFrequency}getLastHealthReport(){return this.lastHealthReport}getHealthMonitor(){return this.healthMonitor}maybeRunHealthCheck(){if(q()&&(this.operationsSinceLastCheck++,!(this.operationsSinceLastCheck<this.healthCheckFrequency)&&(this.operationsSinceLastCheck=0,this.ensureHealthMonitor(),this.healthMonitor)))try{this.lastHealthReport=this.healthMonitor.checkHealth(this.backend),this.lastHealthReport.healthy||console.warn(`[HNSW-Health] Index "${this.indexName}" health check failed: ${this.lastHealthReport.alerts.length} alert(s). Coherence: ${this.lastHealthReport.metrics.coherenceScore.toFixed(3)}`)}catch(e){console.warn(`[HNSW-Health] Health check error for "${this.indexName}":`,e)}}ensureHealthMonitor(){if(!this.healthMonitorLoaded){this.healthMonitorLoaded=!0;try{let e=(ne(),$(re));this.healthMonitor=e.createHnswHealthMonitor()}catch(e){process.env.DEBUG&&console.debug("[HNSW-Health] Monitor module unavailable:",e instanceof Error?e.message:e),this.healthMonitor=null}}}static createBackend(e){if(j())try{return{backend:new w(e),isNative:!0}}catch(r){r instanceof b?console.info(`[HNSW] Native backend unavailable, falling back to JS: ${r.message}`):console.warn("[HNSW] Unexpected error creating native backend, falling back to JS:",r)}return{backend:new S(e),isNative:!1}}static create(e,r){let t=p.get(e);if(t instanceof i)return t;let n=new i(e,r);return p.set(e,n),n}static get(e){let r=p.get(e);return r instanceof i?r:void 0}static close(e){let r=p.get(e);r instanceof i&&r.dispose(),p.delete(e)}static closeAll(){for(let[e]of p)i.close(e);p.clear()}static listIndexes(){return Array.from(p.keys())}}});export{G as a,ye as b,xe as c};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.11.1");process.exit(0)}
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.11.2");process.exit(0)}
2
2
  import{existsSync as _,readdirSync as d,statSync as w}from"fs";import{join as i,extname as E}from"path";var T=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".pyw",".go",".rs",".java",".kt",".kts",".rb",".cs",".php",".swift",".c",".h",".cpp",".hpp",".cc",".scala"]),v=[".test.",".spec.","_test.","_spec."],b=new Set(["node_modules","dist","build","coverage",".git","__pycache__",".venv","venv",".tox",".mypy_cache","target",".gradle","vendor",".bundle",".next",".nuxt",".output"]);function O(s,p={}){let{maxDepth:f=6,includeTests:m=!1,testsOnly:x=!1,extraExtensions:S=[]}=p;if(!_(s))return[];let o=w(s);if(o.isFile())return[s];if(!o.isDirectory())return[];let y=new Set(S.map(t=>t.startsWith(".")?t:`.${t}`)),n=[];function r(t,c){if(c>f)return;let a;try{a=d(t,{withFileTypes:!0})}catch{return}for(let e of a)if(e.isDirectory()){if(b.has(e.name))continue;r(i(t,e.name),c+1)}else if(e.isFile()){let u=E(e.name).toLowerCase();if(!(T.has(u)||y.has(u))||e.name.endsWith(".d.ts"))continue;let l=v.some(h=>e.name.includes(h))||e.name.startsWith("test_");x?l&&n.push(i(t,e.name)):(m||!l)&&n.push(i(t,e.name))}}return r(s,0),n}export{T as a,O 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.11.1");process.exit(0)}
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.11.2");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};
@@ -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.11.1");process.exit(0)}
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.11.2");process.exit(0)}
2
2
  import{createRequire as t}from"module";var o=t(import.meta.url),e=o("@huggingface/transformers"),n=e,{RuvectorLayer:i,TensorCompress:a,differentiableSearch:c,hierarchicalForward:s,getCompressionLevel:l,init:p,FlashAttention:m,DotProductAttention:u,MultiHeadAttention:d,HyperbolicAttention:f,LinearAttention:A,MoEAttention:g,SonaEngine:h,pipeline:_}=e||{};export{n as a,i as b,a as c,c as d,s as e,l as f,p as g,m as h,u as i,d as j,f as k,A as l,g as m,h as n,_ as o};
@@ -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.11.1");process.exit(0)}
2
- import{b as d,d as c}from"./chunk-N6NSZG7Z.js";import{a as l,c as g}from"./chunk-QEDS3MOJ.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.11.2");process.exit(0)}
2
+ import{b as d,d as c}from"./chunk-LY6PTRVL.js";import{a as l,c as g}from"./chunk-FYY7OJ6Y.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,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.11.1");process.exit(0)}
2
- import{b as A,d as M}from"./chunk-N6NSZG7Z.js";import{a as S,b as D}from"./chunk-D6MPGK7R.js";import{S as Q,l as E}from"./chunk-N4OWZLH5.js";import{g as C}from"./chunk-7SRSOZMP.js";M();Q();var v=(1+Math.sqrt(5))/2,R=1/v;function k(t,e=0){if(t<0||!Number.isFinite(t))throw new Error(`Invalid dither sequence length: ${t}`);if(!Number.isFinite(e))throw new Error(`Invalid dither seed: ${e}`);let n=new Float32Array(t),r=(e*R%1+1)%1;for(let i=0;i<t;i++)n[i]=((r+(i+1)*v)%1+1)%1;return n}function I(t,e,n=0){if(!(t instanceof Float32Array))throw new Error("Input vector must be a Float32Array");if(t.length===0)return{quantized:new Int32Array(0),dequantized:new Float32Array(0),bitDepth:e,seed:n,stepSize:0,minValue:0,maxValue:0};if(e<1||e>32||!Number.isInteger(e))throw new Error(`Invalid bit depth: ${e}. Must be an integer in [1, 32].`);let r=t[0],i=t[0];for(let d=1;d<t.length;d++)t[d]<r&&(r=t[d]),t[d]>i&&(i=t[d]);let s=(1<<e)-1,a=i-r,o=a===0?1:a/s,m=k(t.length,n),l=new Int32Array(t.length),u=new Float32Array(t.length);for(let d=0;d<t.length;d++){if(a===0)l[d]=Math.round(s/2);else{let L=(t[d]-r)/o+(m[d]-.5);l[d]=Math.max(0,Math.min(s,Math.round(L)))}u[d]=l[d]*o+r}return{quantized:l,dequantized:u,bitDepth:e,seed:n,stepSize:o,minValue:r,maxValue:i}}var h=null,b=null,p=null,g=null,f=null,w=null,x=!1;try{let t=(D(),C(S));h=t.RuvectorLayer,b=t.TensorCompress,p=t.differentiableSearch,g=t.hierarchicalForward,f=t.getCompressionLevel,w=t.init,x=!0}catch{}function H(){return x}function c(){if(!x)throw new Error("@ruvector/gnn native module is not available on this platform. Install the appropriate optional dependency for your platform, or use a platform where pre-built binaries are available.")}var F=!1;function V(){if(!F){c();let t=w();return F=!0,t}return"@ruvector/gnn already initialized"}var y=class{indexes;config;nextId;gnnLayers;compressor;constructor(e={}){this.config={M:e.M||16,efConstruction:e.efConstruction||200,efSearch:e.efSearch||50,dimension:e.dimension||384,metric:e.metric||"cosine",quantization:e.quantization||"none"},this.indexes=new Map,this.nextId=new Map,this.gnnLayers=new Map,c(),this.compressor=new b,V()}initializeIndex(e){this.indexes.has(e)||(this.indexes.set(e,new Map),this.nextId.set(e,0))}addEmbedding(e,n){let r=e.namespace;this.indexes.has(r)||this.initializeIndex(r);let i=this.indexes.get(r),s=n??this.nextId.get(r);return n===void 0&&this.nextId.set(r,s+1),i.set(s,e),s}addEmbeddingsBatch(e){let n=[];for(let r of e){let i=this.addEmbedding(r.embedding,r.id);n.push(i)}return n}search(e,n={}){let r=n.namespace||e.namespace;if(!this.indexes.has(r))return[];let i=this.indexes.get(r),s=n.limit||10,a=[];for(let[u,d]of i.entries())a.push({id:u,vector:Array.from(d.vector)});if(a.length===0)return[];let o=new Float32Array(e.vector),m=a.map(u=>new Float32Array(u.vector)),l=p(o,m,Math.min(s,a.length),1);return l.indices.map((u,d)=>({id:a[u]?.id??u,distance:1-l.weights[d]}))}differentiableSearchWithWeights(e,n,r,i=1){let s=new Float32Array(e.vector),a=n.map(m=>new Float32Array(m.embedding.vector)),o=p(s,a,Math.min(r,n.length),i);return{indices:o.indices.map(m=>n[m]?.id??m),weights:o.weights}}hierarchicalForward(e,n,r){let i=r.map(l=>`${l.inputDim}-${l.hiddenDim}`).join(",");if(!this.gnnLayers.has(i)){let l=[];for(let u of r){let d=new h(u.inputDim,u.hiddenDim,u.heads,u.dropout);l.push(d)}this.gnnLayers.set(i,l[0])}let a=this.gnnLayers.get(i).toJson(),o=new Float32Array(e),m=n.map(l=>l.map(u=>new Float32Array(u)));return Array.from(g(o,m,[a]))}compressEmbedding(e,n){let r=f(n),s={none:"none",half:"half",pq8:"pq8",pq4:"pq4",binary:"binary"}[r]??"none",a=new Float32Array(e.vector),o=this.compressor.compress(a,n);return{dimension:Array.from(e.vector).length,level:s,data:o,accessFreq:n}}decompressEmbedding(e){let n=this.compressor.decompress(e.data),r={none:"none",half:"fp16",pq8:"int8",pq4:"int8",binary:"binary"};return{vector:n,dimension:e.dimension,namespace:"code",text:"",timestamp:Date.now(),quantization:r[e.level]??"none"}}getCompressionLevelForFrequency(e){return c(),f(e)}getIndexStats(e){return this.indexes.has(e)?{size:this.indexes.get(e).size,maxElements:1e4,dimension:this.config.dimension,metric:this.config.metric}:null}clearIndex(e){this.indexes.delete(e),this.nextId.delete(e)}clearAll(){this.indexes.clear(),this.nextId.clear()}resizeIndex(e){}setEfSearch(e){this.config.efSearch=e}getConfig(){return{...this.config}}isInitialized(e){return this.indexes.has(e)}getInitializedNamespaces(){return Array.from(this.indexes.keys())}getSize(e){return this.indexes.get(e)?.size??0}async saveIndex(e,n){let r=this.indexes.get(e);if(!r)throw new Error(`Namespace ${e} not initialized`);let i=Array.from(r.entries()).map(([a,o])=>({id:a,vector:Array.from(o.vector),metadata:o.metadata}));await(await import("fs/promises")).writeFile(n,JSON.stringify(i,null,2))}async loadIndex(e,n){let i=await(await import("fs/promises")).readFile(n,"utf-8"),s=A(i);this.initializeIndex(e);for(let a of s){let o={vector:a.vector,dimension:a.vector.length,namespace:e,text:"",timestamp:Date.now(),quantization:"none",metadata:a.metadata};this.addEmbedding(o,a.id)}}},q=class{static instances=new Map;static getInstance(e,n){return this.instances.has(e)||this.instances.set(e,new y(n)),this.instances.get(e)}static closeInstance(e){let n=this.instances.get(e);n&&(n.clearAll(),this.instances.delete(e))}static closeAll(){for(let e of this.instances.values())e.clearAll();this.instances.clear()}},z=class{static layers=new Map;static getLayer(e){let n=`${e.inputDim}-${e.hiddenDim}-${e.heads}-${e.dropout}`;if(!this.layers.has(n)){c();let r=new h(e.inputDim,e.hiddenDim,e.heads,e.dropout);this.layers.set(n,r)}return this.layers.get(n)}static layerFromJson(e){return c(),h.fromJson(e)}static clearCache(){this.layers.clear()}},N=class{static _compressor=null;static get compressor(){return this._compressor||(c(),this._compressor=new b),this._compressor}static compressWithLevel(e,n){let r={levelType:n,scale:1,subvectors:n==="pq8"?8:n==="pq4"?16:void 0,centroids:n==="pq8"?256:void 0,outlierThreshold:n==="pq4"?3:void 0,threshold:n==="binary"?0:void 0},i=e instanceof Float32Array?e:new Float32Array(e);return this.compressor.compressWithLevel(i,r)}static decompress(e){return this.compressor.decompress(e)}static getLevel(e){return c(),f(e)}static compressWithDither(e,n,r){let i=e instanceof Float32Array?e:new Float32Array(e),s;if(E()){let o={none:32,half:16,pq8:8,pq4:4,binary:1},m=r?.bitDepth??o[n]??8,l=r?.seed??0;s=I(i,m,l)}return{compressed:this.compressWithLevel(s?s.dequantized:e,n),ditherResult:s}}};function G(){return c(),h}function J(){return c(),b}function O(){return c(),p}function j(){return c(),g}function B(){return c(),f}function K(){return c(),w}function U(t){return t instanceof Float32Array?t:"vector"in t?t.vector instanceof Float32Array?t.vector:new Float32Array(t.vector):new Float32Array(t)}function X(t){return"vector"in t?Array.from(t.vector):Array.from(t)}function Y(t,e="code"){return{vector:t,dimension:t.length,namespace:e,text:"",timestamp:Date.now(),quantization:"none"}}function Z(t,e,n,r=1){let i=[],s=e.map(a=>a instanceof Float32Array?a:new Float32Array(a));for(let a of t){let o=a instanceof Float32Array?a:new Float32Array(a),m=p(o,s,n,r);i.push({indices:m.indices,weights:m.weights})}return i}export{H as a,V as b,y as c,q as d,z as e,N as f,G as g,J as h,O as i,j,B as k,K as l,U as m,X as n,Y as o,Z as p};
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.11.2");process.exit(0)}
2
+ import{b as A,d as M}from"./chunk-LY6PTRVL.js";import{a as S,b as D}from"./chunk-UCXW24HY.js";import{S as Q,l as E}from"./chunk-WKIYYF3G.js";import{g as C}from"./chunk-LIEA5EON.js";M();Q();var v=(1+Math.sqrt(5))/2,R=1/v;function k(t,e=0){if(t<0||!Number.isFinite(t))throw new Error(`Invalid dither sequence length: ${t}`);if(!Number.isFinite(e))throw new Error(`Invalid dither seed: ${e}`);let n=new Float32Array(t),r=(e*R%1+1)%1;for(let i=0;i<t;i++)n[i]=((r+(i+1)*v)%1+1)%1;return n}function I(t,e,n=0){if(!(t instanceof Float32Array))throw new Error("Input vector must be a Float32Array");if(t.length===0)return{quantized:new Int32Array(0),dequantized:new Float32Array(0),bitDepth:e,seed:n,stepSize:0,minValue:0,maxValue:0};if(e<1||e>32||!Number.isInteger(e))throw new Error(`Invalid bit depth: ${e}. Must be an integer in [1, 32].`);let r=t[0],i=t[0];for(let d=1;d<t.length;d++)t[d]<r&&(r=t[d]),t[d]>i&&(i=t[d]);let s=(1<<e)-1,a=i-r,o=a===0?1:a/s,m=k(t.length,n),l=new Int32Array(t.length),u=new Float32Array(t.length);for(let d=0;d<t.length;d++){if(a===0)l[d]=Math.round(s/2);else{let L=(t[d]-r)/o+(m[d]-.5);l[d]=Math.max(0,Math.min(s,Math.round(L)))}u[d]=l[d]*o+r}return{quantized:l,dequantized:u,bitDepth:e,seed:n,stepSize:o,minValue:r,maxValue:i}}var h=null,b=null,p=null,g=null,f=null,w=null,x=!1;try{let t=(D(),C(S));h=t.RuvectorLayer,b=t.TensorCompress,p=t.differentiableSearch,g=t.hierarchicalForward,f=t.getCompressionLevel,w=t.init,x=!0}catch{}function H(){return x}function c(){if(!x)throw new Error("@ruvector/gnn native module is not available on this platform. Install the appropriate optional dependency for your platform, or use a platform where pre-built binaries are available.")}var F=!1;function V(){if(!F){c();let t=w();return F=!0,t}return"@ruvector/gnn already initialized"}var y=class{indexes;config;nextId;gnnLayers;compressor;constructor(e={}){this.config={M:e.M||16,efConstruction:e.efConstruction||200,efSearch:e.efSearch||50,dimension:e.dimension||384,metric:e.metric||"cosine",quantization:e.quantization||"none"},this.indexes=new Map,this.nextId=new Map,this.gnnLayers=new Map,c(),this.compressor=new b,V()}initializeIndex(e){this.indexes.has(e)||(this.indexes.set(e,new Map),this.nextId.set(e,0))}addEmbedding(e,n){let r=e.namespace;this.indexes.has(r)||this.initializeIndex(r);let i=this.indexes.get(r),s=n??this.nextId.get(r);return n===void 0&&this.nextId.set(r,s+1),i.set(s,e),s}addEmbeddingsBatch(e){let n=[];for(let r of e){let i=this.addEmbedding(r.embedding,r.id);n.push(i)}return n}search(e,n={}){let r=n.namespace||e.namespace;if(!this.indexes.has(r))return[];let i=this.indexes.get(r),s=n.limit||10,a=[];for(let[u,d]of i.entries())a.push({id:u,vector:Array.from(d.vector)});if(a.length===0)return[];let o=new Float32Array(e.vector),m=a.map(u=>new Float32Array(u.vector)),l=p(o,m,Math.min(s,a.length),1);return l.indices.map((u,d)=>({id:a[u]?.id??u,distance:1-l.weights[d]}))}differentiableSearchWithWeights(e,n,r,i=1){let s=new Float32Array(e.vector),a=n.map(m=>new Float32Array(m.embedding.vector)),o=p(s,a,Math.min(r,n.length),i);return{indices:o.indices.map(m=>n[m]?.id??m),weights:o.weights}}hierarchicalForward(e,n,r){let i=r.map(l=>`${l.inputDim}-${l.hiddenDim}`).join(",");if(!this.gnnLayers.has(i)){let l=[];for(let u of r){let d=new h(u.inputDim,u.hiddenDim,u.heads,u.dropout);l.push(d)}this.gnnLayers.set(i,l[0])}let a=this.gnnLayers.get(i).toJson(),o=new Float32Array(e),m=n.map(l=>l.map(u=>new Float32Array(u)));return Array.from(g(o,m,[a]))}compressEmbedding(e,n){let r=f(n),s={none:"none",half:"half",pq8:"pq8",pq4:"pq4",binary:"binary"}[r]??"none",a=new Float32Array(e.vector),o=this.compressor.compress(a,n);return{dimension:Array.from(e.vector).length,level:s,data:o,accessFreq:n}}decompressEmbedding(e){let n=this.compressor.decompress(e.data),r={none:"none",half:"fp16",pq8:"int8",pq4:"int8",binary:"binary"};return{vector:n,dimension:e.dimension,namespace:"code",text:"",timestamp:Date.now(),quantization:r[e.level]??"none"}}getCompressionLevelForFrequency(e){return c(),f(e)}getIndexStats(e){return this.indexes.has(e)?{size:this.indexes.get(e).size,maxElements:1e4,dimension:this.config.dimension,metric:this.config.metric}:null}clearIndex(e){this.indexes.delete(e),this.nextId.delete(e)}clearAll(){this.indexes.clear(),this.nextId.clear()}resizeIndex(e){}setEfSearch(e){this.config.efSearch=e}getConfig(){return{...this.config}}isInitialized(e){return this.indexes.has(e)}getInitializedNamespaces(){return Array.from(this.indexes.keys())}getSize(e){return this.indexes.get(e)?.size??0}async saveIndex(e,n){let r=this.indexes.get(e);if(!r)throw new Error(`Namespace ${e} not initialized`);let i=Array.from(r.entries()).map(([a,o])=>({id:a,vector:Array.from(o.vector),metadata:o.metadata}));await(await import("fs/promises")).writeFile(n,JSON.stringify(i,null,2))}async loadIndex(e,n){let i=await(await import("fs/promises")).readFile(n,"utf-8"),s=A(i);this.initializeIndex(e);for(let a of s){let o={vector:a.vector,dimension:a.vector.length,namespace:e,text:"",timestamp:Date.now(),quantization:"none",metadata:a.metadata};this.addEmbedding(o,a.id)}}},q=class{static instances=new Map;static getInstance(e,n){return this.instances.has(e)||this.instances.set(e,new y(n)),this.instances.get(e)}static closeInstance(e){let n=this.instances.get(e);n&&(n.clearAll(),this.instances.delete(e))}static closeAll(){for(let e of this.instances.values())e.clearAll();this.instances.clear()}},z=class{static layers=new Map;static getLayer(e){let n=`${e.inputDim}-${e.hiddenDim}-${e.heads}-${e.dropout}`;if(!this.layers.has(n)){c();let r=new h(e.inputDim,e.hiddenDim,e.heads,e.dropout);this.layers.set(n,r)}return this.layers.get(n)}static layerFromJson(e){return c(),h.fromJson(e)}static clearCache(){this.layers.clear()}},N=class{static _compressor=null;static get compressor(){return this._compressor||(c(),this._compressor=new b),this._compressor}static compressWithLevel(e,n){let r={levelType:n,scale:1,subvectors:n==="pq8"?8:n==="pq4"?16:void 0,centroids:n==="pq8"?256:void 0,outlierThreshold:n==="pq4"?3:void 0,threshold:n==="binary"?0:void 0},i=e instanceof Float32Array?e:new Float32Array(e);return this.compressor.compressWithLevel(i,r)}static decompress(e){return this.compressor.decompress(e)}static getLevel(e){return c(),f(e)}static compressWithDither(e,n,r){let i=e instanceof Float32Array?e:new Float32Array(e),s;if(E()){let o={none:32,half:16,pq8:8,pq4:4,binary:1},m=r?.bitDepth??o[n]??8,l=r?.seed??0;s=I(i,m,l)}return{compressed:this.compressWithLevel(s?s.dequantized:e,n),ditherResult:s}}};function G(){return c(),h}function J(){return c(),b}function O(){return c(),p}function j(){return c(),g}function B(){return c(),f}function K(){return c(),w}function U(t){return t instanceof Float32Array?t:"vector"in t?t.vector instanceof Float32Array?t.vector:new Float32Array(t.vector):new Float32Array(t)}function X(t){return"vector"in t?Array.from(t.vector):Array.from(t)}function Y(t,e="code"){return{vector:t,dimension:t.length,namespace:e,text:"",timestamp:Date.now(),quantization:"none"}}function Z(t,e,n,r=1){let i=[],s=e.map(a=>a instanceof Float32Array?a:new Float32Array(a));for(let a of t){let o=a instanceof Float32Array?a:new Float32Array(a),m=p(o,s,n,r);i.push({indices:m.indices,weights:m.weights})}return i}export{H as a,V as b,y as c,q as d,z as e,N as f,G as g,J as h,O as i,j,B as k,K as l,U as m,X as n,Y as o,Z as p};