agentic-qe 3.9.7 → 3.9.9

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 (335) hide show
  1. package/.claude/skills/README.md +4 -3
  2. package/.claude/skills/a11y-ally/SKILL.md +40 -18
  3. package/.claude/skills/accessibility-testing/SKILL.md +4 -0
  4. package/.claude/skills/compatibility-testing/SKILL.md +23 -0
  5. package/.claude/skills/e2e-flow-verifier/SKILL.md +87 -52
  6. package/.claude/skills/enterprise-integration-testing/SKILL.md +4 -0
  7. package/.claude/skills/localization-testing/SKILL.md +14 -0
  8. package/.claude/skills/observability-testing-patterns/SKILL.md +16 -0
  9. package/.claude/skills/qe-browser/SKILL.md +409 -0
  10. package/.claude/skills/qe-browser/evals/qe-browser.yaml +291 -0
  11. package/.claude/skills/qe-browser/fixtures/package.json +7 -0
  12. package/.claude/skills/qe-browser/fixtures/serve-skills.js +130 -0
  13. package/.claude/skills/qe-browser/references/assertion-kinds.md +132 -0
  14. package/.claude/skills/qe-browser/references/migration-from-playwright.md +195 -0
  15. package/.claude/skills/qe-browser/schemas/output.json +188 -0
  16. package/.claude/skills/qe-browser/scripts/assert.js +378 -0
  17. package/.claude/skills/qe-browser/scripts/batch.js +292 -0
  18. package/.claude/skills/qe-browser/scripts/check-injection.js +267 -0
  19. package/.claude/skills/qe-browser/scripts/intent-score.js +325 -0
  20. package/.claude/skills/qe-browser/scripts/lib/vibium.js +330 -0
  21. package/.claude/skills/qe-browser/scripts/package.json +7 -0
  22. package/.claude/skills/qe-browser/scripts/smoke-test.sh +212 -0
  23. package/.claude/skills/qe-browser/scripts/validate-config.json +46 -0
  24. package/.claude/skills/qe-browser/scripts/visual-diff.js +276 -0
  25. package/.claude/skills/qe-visual-accessibility/SKILL.md +31 -1
  26. package/.claude/skills/security-visual-testing/SKILL.md +18 -0
  27. package/.claude/skills/skills-manifest.json +20 -13
  28. package/.claude/skills/testability-scoring/SKILL.md +23 -0
  29. package/.claude/skills/trust-tier-manifest.json +14 -3
  30. package/.claude/skills/visual-testing-advanced/SKILL.md +41 -1
  31. package/CHANGELOG.md +79 -0
  32. package/README.md +5 -3
  33. package/assets/skills/README.md +4 -3
  34. package/assets/skills/a11y-ally/SKILL.md +40 -18
  35. package/assets/skills/accessibility-testing/SKILL.md +4 -0
  36. package/assets/skills/compatibility-testing/SKILL.md +23 -0
  37. package/assets/skills/e2e-flow-verifier/SKILL.md +87 -52
  38. package/assets/skills/enterprise-integration-testing/SKILL.md +4 -0
  39. package/assets/skills/localization-testing/SKILL.md +14 -0
  40. package/assets/skills/observability-testing-patterns/SKILL.md +16 -0
  41. package/assets/skills/qe-browser/SKILL.md +409 -0
  42. package/assets/skills/qe-browser/evals/qe-browser.yaml +291 -0
  43. package/assets/skills/qe-browser/fixtures/package.json +7 -0
  44. package/assets/skills/qe-browser/fixtures/serve-skills.js +130 -0
  45. package/assets/skills/qe-browser/references/assertion-kinds.md +132 -0
  46. package/assets/skills/qe-browser/references/migration-from-playwright.md +195 -0
  47. package/assets/skills/qe-browser/schemas/output.json +188 -0
  48. package/assets/skills/qe-browser/scripts/assert.js +378 -0
  49. package/assets/skills/qe-browser/scripts/batch.js +292 -0
  50. package/assets/skills/qe-browser/scripts/check-injection.js +267 -0
  51. package/assets/skills/qe-browser/scripts/intent-score.js +325 -0
  52. package/assets/skills/qe-browser/scripts/lib/vibium.js +330 -0
  53. package/assets/skills/qe-browser/scripts/package.json +7 -0
  54. package/assets/skills/qe-browser/scripts/smoke-test.sh +212 -0
  55. package/assets/skills/qe-browser/scripts/validate-config.json +46 -0
  56. package/assets/skills/qe-browser/scripts/visual-diff.js +276 -0
  57. package/assets/skills/qe-visual-accessibility/SKILL.md +31 -1
  58. package/assets/skills/security-visual-testing/SKILL.md +18 -0
  59. package/assets/skills/skills-manifest.json +211 -15
  60. package/assets/skills/testability-scoring/SKILL.md +23 -0
  61. package/assets/skills/trust-tier-manifest.json +14 -3
  62. package/assets/skills/visual-testing-advanced/SKILL.md +41 -1
  63. package/dist/cli/bundle.js +5 -5
  64. package/dist/cli/chunks/adapter-XKXEZEMM.js +2 -0
  65. package/dist/cli/chunks/{agent-booster-wasm-MXTWTD4D.js → agent-booster-wasm-QEN7W6VC.js} +2 -2
  66. package/dist/cli/chunks/{agent-handler-6NEP2BOA.js → agent-handler-F3RLG42J.js} +2 -2
  67. package/dist/cli/chunks/{agent-memory-branch-SAPEIGE2.js → agent-memory-branch-U3PZ3CPL.js} +2 -2
  68. package/dist/cli/chunks/aqe-learning-engine-K7XGBDMZ.js +2 -0
  69. package/dist/cli/chunks/{audit-53LCI6R3.js → audit-FF6SP7Q2.js} +2 -2
  70. package/dist/cli/chunks/base-NUF35LIJ.js +2 -0
  71. package/dist/cli/chunks/{better-sqlite3-UZSKFGCK.js → better-sqlite3-CVXRDGQX.js} +2 -2
  72. package/dist/cli/chunks/{brain-handler-67NDDXVO.js → brain-handler-AMTRZ35W.js} +3 -3
  73. package/dist/cli/chunks/{branch-enumerator-IUIGYEK5.js → branch-enumerator-Y4A34YFT.js} +2 -2
  74. package/dist/cli/chunks/{browser-UFUF65LQ.js → browser-ETSF5GZR.js} +2 -2
  75. package/dist/cli/chunks/browser-workflow-MWPELXFA.js +2 -0
  76. package/dist/cli/chunks/{chunk-XD4UFF2Y.js → chunk-22HQFULR.js} +1 -1
  77. package/dist/cli/chunks/{chunk-W4Y4GFRB.js → chunk-2BSVGL35.js} +1 -1
  78. package/dist/cli/chunks/{chunk-KHH5UJXY.js → chunk-2HFPJPQW.js} +2 -2
  79. package/dist/cli/chunks/{chunk-LPLCT2HH.js → chunk-2JAYDTSE.js} +2 -2
  80. package/dist/cli/chunks/{chunk-RGJ4RMUR.js → chunk-2KY5B4ON.js} +8 -8
  81. package/dist/cli/chunks/{chunk-XB2GVTY6.js → chunk-2O3WZ6E3.js} +1 -1
  82. package/dist/cli/chunks/{chunk-5EOM3W6Q.js → chunk-2UP3DYNH.js} +2 -2
  83. package/dist/cli/chunks/{chunk-DS3XAGGL.js → chunk-2X7LDTVD.js} +2 -2
  84. package/dist/cli/chunks/{chunk-NJ5IC6ZR.js → chunk-2ZHA6ORO.js} +1 -1
  85. package/dist/cli/chunks/{chunk-FKJ4XZ6E.js → chunk-3F666FYP.js} +2 -2
  86. package/dist/cli/chunks/{chunk-7TKZ6LK6.js → chunk-3FAEM5M7.js} +1 -1
  87. package/dist/cli/chunks/{chunk-TLTRL32T.js → chunk-3JCZTTFY.js} +1 -1
  88. package/dist/cli/chunks/{chunk-BPYWDM2Y.js → chunk-3NU4C62D.js} +3 -3
  89. package/dist/cli/chunks/{chunk-ZETZATNY.js → chunk-3XR7ARS6.js} +2 -2
  90. package/dist/cli/chunks/{chunk-FHBIJBZ3.js → chunk-4CDSEZD6.js} +2 -2
  91. package/dist/cli/chunks/{chunk-OURDPRGM.js → chunk-4CSINHCB.js} +1 -1
  92. package/dist/cli/chunks/{chunk-YTF5G3RQ.js → chunk-4HDG7OS4.js} +2 -2
  93. package/dist/cli/chunks/{chunk-PMZJ54WX.js → chunk-52RZZV4M.js} +3 -3
  94. package/dist/cli/chunks/{chunk-GOG6L2F7.js → chunk-5DU4YW2S.js} +2 -2
  95. package/dist/cli/chunks/{chunk-6MMRZYYS.js → chunk-5HM66R4W.js} +3 -3
  96. package/dist/cli/chunks/{chunk-BTZEKSWH.js → chunk-5L3EUZJA.js} +2 -2
  97. package/dist/cli/chunks/{chunk-TD2WOW75.js → chunk-5SWY75MJ.js} +2 -2
  98. package/dist/cli/chunks/{chunk-3DXO5CWI.js → chunk-65XCVUP7.js} +1 -1
  99. package/dist/cli/chunks/{chunk-VMWLVRJO.js → chunk-6KQLF3ZO.js} +2 -2
  100. package/dist/cli/chunks/{chunk-HVJXXGB4.js → chunk-6LTJP3DO.js} +4 -4
  101. package/dist/cli/chunks/{chunk-FJEIX3IS.js → chunk-6PJUDLCT.js} +2 -2
  102. package/dist/cli/chunks/{chunk-2TRWUJWG.js → chunk-74FBSJVC.js} +2 -2
  103. package/dist/cli/chunks/{chunk-D3KORDD5.js → chunk-A6GYFTIA.js} +1 -1
  104. package/dist/cli/chunks/{chunk-3KX7CQEM.js → chunk-ADJGMTIW.js} +1 -1
  105. package/dist/cli/chunks/{chunk-TT2YXNHH.js → chunk-AHOP227C.js} +4 -4
  106. package/dist/cli/chunks/{chunk-UXCEJ3AV.js → chunk-ANLFEGDG.js} +2 -2
  107. package/dist/cli/chunks/{chunk-SQQ57TSJ.js → chunk-AT2VD2ZP.js} +2 -2
  108. package/dist/cli/chunks/{chunk-KLLHSXIC.js → chunk-AYMIF4W5.js} +2 -2
  109. package/dist/cli/chunks/{chunk-JJSJSQNJ.js → chunk-B3DA4SCL.js} +1 -1
  110. package/dist/cli/chunks/{chunk-FBVEHGNE.js → chunk-BSES27JE.js} +3 -3
  111. package/dist/cli/chunks/{chunk-MUEFXLGX.js → chunk-BVKS3X2I.js} +1 -1
  112. package/dist/cli/chunks/{chunk-MR7V7QVL.js → chunk-BVOGMK6N.js} +2 -2
  113. package/dist/cli/chunks/{chunk-PHBE2VBN.js → chunk-BYJEK6LX.js} +2 -2
  114. package/dist/cli/chunks/{chunk-YV2PVXJE.js → chunk-BYPBKVTC.js} +1 -1
  115. package/dist/cli/chunks/{chunk-IQLFWO5U.js → chunk-C7YD7O74.js} +2 -2
  116. package/dist/cli/chunks/{chunk-ZEFDSMF4.js → chunk-CCCBGKVY.js} +2 -2
  117. package/dist/cli/chunks/{chunk-SIIYQLKH.js → chunk-CJQLJEO4.js} +2 -2
  118. package/dist/cli/chunks/{chunk-AT6LBLUV.js → chunk-CXWA34RL.js} +2 -2
  119. package/dist/cli/chunks/{chunk-HFPT7QXQ.js → chunk-CZYTPNUI.js} +2 -2
  120. package/dist/cli/chunks/{chunk-YIVZ5Z4V.js → chunk-DI6R2AVP.js} +1 -1
  121. package/dist/cli/chunks/{chunk-JNEG6DKU.js → chunk-DNS7DP2O.js} +1 -1
  122. package/dist/cli/chunks/{chunk-DKBXIBRS.js → chunk-ECNPBD4Y.js} +2 -2
  123. package/dist/cli/chunks/{chunk-7OPVTN5W.js → chunk-ENG5UF7M.js} +2 -2
  124. package/dist/cli/chunks/{chunk-EIGXGMOR.js → chunk-EV2NMWJV.js} +1 -1
  125. package/dist/cli/chunks/{chunk-426OO3RH.js → chunk-FGW5W3YK.js} +2 -2
  126. package/dist/cli/chunks/{chunk-SMKRBNO7.js → chunk-FTF34UME.js} +1 -1
  127. package/dist/cli/chunks/{chunk-VAKJOTGU.js → chunk-GYNGJHYF.js} +2 -2
  128. package/dist/cli/chunks/{chunk-AHB2F42G.js → chunk-HDM43P7H.js} +1 -1
  129. package/dist/cli/chunks/{chunk-ZWAJV4SN.js → chunk-HOWZFW7G.js} +2 -2
  130. package/dist/cli/chunks/{chunk-INJPS7RF.js → chunk-IZC5NPHD.js} +1 -1
  131. package/dist/cli/chunks/{chunk-HEENVPYF.js → chunk-J2DNMVB5.js} +3 -3
  132. package/dist/cli/chunks/{chunk-SP3X35XC.js → chunk-J62N66ZH.js} +1 -1
  133. package/dist/cli/chunks/{chunk-QKJ4LUAM.js → chunk-JIPU4YQK.js} +2 -2
  134. package/dist/cli/chunks/{chunk-4B5IYFKE.js → chunk-JK4K4EH3.js} +2 -2
  135. package/dist/cli/chunks/{chunk-LP6EQI2P.js → chunk-JQJHRQRX.js} +2 -2
  136. package/dist/cli/chunks/{chunk-FOCGOVIM.js → chunk-KSJCMXAJ.js} +2 -2
  137. package/dist/cli/chunks/{chunk-EFHR7LML.js → chunk-MDTF7LE6.js} +2 -2
  138. package/dist/cli/chunks/{chunk-PFTR6XAO.js → chunk-MUCFC3YG.js} +2 -2
  139. package/dist/cli/chunks/{chunk-JRHKFRUB.js → chunk-MUIJVPGB.js} +2 -2
  140. package/dist/cli/chunks/{chunk-WLYSZV5U.js → chunk-MWZN4PYF.js} +2 -2
  141. package/dist/cli/chunks/{chunk-JZYCZMHN.js → chunk-MXMKHI2I.js} +2 -2
  142. package/dist/cli/chunks/{chunk-XOHRM3M7.js → chunk-MZOYBHJ3.js} +3 -3
  143. package/dist/cli/chunks/{chunk-WV3R5JFE.js → chunk-NLKJI73E.js} +2 -2
  144. package/dist/cli/chunks/{chunk-D2C4XNF5.js → chunk-NQ3WHTLT.js} +4 -4
  145. package/dist/cli/chunks/{chunk-BJKRAFS2.js → chunk-NVVF5ROM.js} +2 -2
  146. package/dist/cli/chunks/{chunk-STASZVMY.js → chunk-OEZA7Q2Z.js} +2 -2
  147. package/dist/cli/chunks/{chunk-LHGZRKPO.js → chunk-OFOFXJ3M.js} +2 -2
  148. package/dist/cli/chunks/{chunk-2SJQ3CYN.js → chunk-OMRZUYXN.js} +9 -9
  149. package/dist/cli/chunks/{chunk-KHEAWN23.js → chunk-P6YMECV2.js} +2 -2
  150. package/dist/cli/chunks/{chunk-ZSXSUUBS.js → chunk-PEEN4AAK.js} +1 -1
  151. package/dist/cli/chunks/{chunk-6ULPQTIE.js → chunk-PRJUO2OQ.js} +2 -2
  152. package/dist/cli/chunks/{chunk-ECRYU5XG.js → chunk-PYTXZMXR.js} +2 -2
  153. package/dist/cli/chunks/{chunk-4NHE7AJE.js → chunk-Q2ZBPOUX.js} +1 -1
  154. package/dist/cli/chunks/{chunk-XY5FMZRA.js → chunk-QHATTMJC.js} +2 -2
  155. package/dist/cli/chunks/{chunk-HE5VY2BI.js → chunk-QMNAELZG.js} +2 -2
  156. package/dist/cli/chunks/{chunk-KZSZHP32.js → chunk-QQLQEQJM.js} +2 -2
  157. package/dist/cli/chunks/{chunk-7GPYOMVY.js → chunk-QSA23PJ6.js} +1 -1
  158. package/dist/cli/chunks/{chunk-GGPGY5QT.js → chunk-QTYTM7C7.js} +2 -2
  159. package/dist/cli/chunks/{chunk-YR5ZNQT2.js → chunk-QZMBJ67L.js} +2 -2
  160. package/dist/cli/chunks/{chunk-URBXUDY3.js → chunk-R23PJGH7.js} +2 -2
  161. package/dist/cli/chunks/{chunk-NKX2Z546.js → chunk-R5ZKFJ3H.js} +1 -1
  162. package/dist/cli/chunks/{chunk-KO5HO6MY.js → chunk-RLLDZNLF.js} +2 -2
  163. package/dist/cli/chunks/{chunk-ZLQYGO6N.js → chunk-RZYTJSQT.js} +1 -1
  164. package/dist/cli/chunks/{chunk-ZV7FGZNJ.js → chunk-S6VT7VAO.js} +2 -2
  165. package/dist/cli/chunks/{chunk-QI5VGEKC.js → chunk-SVLO2DVL.js} +2 -2
  166. package/dist/cli/chunks/{chunk-SURZYSSL.js → chunk-TTENF6AH.js} +1 -1
  167. package/dist/cli/chunks/{chunk-6OKXGDT3.js → chunk-UEKDDUGV.js} +2 -2
  168. package/dist/cli/chunks/{chunk-UEFAPTBV.js → chunk-UYKIPSRX.js} +1 -1
  169. package/dist/cli/chunks/{chunk-WS4OVAWU.js → chunk-VIIUJRKA.js} +2 -2
  170. package/dist/cli/chunks/chunk-VRH3YLO2.js +2 -0
  171. package/dist/cli/chunks/{chunk-YHZWNT45.js → chunk-VTX4NAWB.js} +2 -2
  172. package/dist/cli/chunks/{chunk-APPVAGD5.js → chunk-VWHALAEO.js} +1 -1
  173. package/dist/cli/chunks/{chunk-BWNH22V2.js → chunk-W4VDPHWC.js} +1 -1
  174. package/dist/cli/chunks/{chunk-CDFYF33M.js → chunk-W57I57M4.js} +2 -2
  175. package/dist/cli/chunks/{chunk-LZ34CKYE.js → chunk-WDWIJDQR.js} +2 -2
  176. package/dist/cli/chunks/{chunk-W4HUWBPK.js → chunk-WEJJWJ5M.js} +2 -2
  177. package/dist/cli/chunks/{chunk-A5VULTCD.js → chunk-WZR4CKR4.js} +1 -1
  178. package/dist/cli/chunks/{chunk-DL46KSFX.js → chunk-XZ2JYMFT.js} +2 -2
  179. package/dist/cli/chunks/{chunk-WAP7ROO5.js → chunk-YISXT54V.js} +2 -2
  180. package/dist/cli/chunks/{chunk-HWDE4RB3.js → chunk-YRORPSPA.js} +2 -2
  181. package/dist/cli/chunks/{chunk-T7R5NXJW.js → chunk-YXE67VME.js} +6 -6
  182. package/dist/cli/chunks/{chunk-UDBSEFUT.js → chunk-Z7AFNZMI.js} +2 -2
  183. package/dist/cli/chunks/{chunk-52MUZGZF.js → chunk-ZEUORIH2.js} +2 -2
  184. package/dist/cli/chunks/{chunk-SQZ3H6WR.js → chunk-ZKXA4VBK.js} +3 -3
  185. package/dist/cli/chunks/{chunk-EL2WLSUI.js → chunk-ZTI3BATG.js} +2 -2
  186. package/dist/cli/chunks/{ci-F4F3SDHP.js → ci-4QYE6JBM.js} +2 -2
  187. package/dist/cli/chunks/{ci-output-4SUMOQGO.js → ci-output-MV75HUK7.js} +2 -2
  188. package/dist/cli/chunks/{claude-flow-setup-NKXPDFMJ.js → claude-flow-setup-CZITY7SG.js} +2 -2
  189. package/dist/cli/chunks/client-VXVVUQDV.js +2 -0
  190. package/dist/cli/chunks/{cline-installer-3FMNXEKM.js → cline-installer-ZLQKCPFF.js} +2 -2
  191. package/dist/cli/chunks/{code-5QEDZNKI.js → code-NYEXOJVP.js} +2 -2
  192. package/dist/cli/chunks/{code-index-extractor-RD5EAOLE.js → code-index-extractor-TITXUC44.js} +2 -2
  193. package/dist/cli/chunks/{codex-installer-UU4O2FIE.js → codex-installer-TWT4LIL2.js} +2 -2
  194. package/dist/cli/chunks/{completions-CS6RJLYZ.js → completions-2KNV2MZG.js} +2 -2
  195. package/dist/cli/chunks/{complexity-analyzer-U4DE2QTP.js → complexity-analyzer-2U3OVRDX.js} +2 -2
  196. package/dist/cli/chunks/{continuedev-installer-E55EG2TB.js → continuedev-installer-BWQBRVTC.js} +2 -2
  197. package/dist/cli/chunks/{copilot-installer-TVJUX3AZ.js → copilot-installer-CYN33NMG.js} +2 -2
  198. package/dist/cli/chunks/{cost-tracker-IAKDLDJH.js → cost-tracker-2GUCBYLK.js} +2 -2
  199. package/dist/cli/chunks/{coverage-LX7UIEKV.js → coverage-BAVD66VL.js} +3 -3
  200. package/dist/cli/chunks/cross-domain-router-HUJG6CFC.js +2 -0
  201. package/dist/cli/chunks/{cursor-installer-2NJ7MK23.js → cursor-installer-ZQAUD47B.js} +2 -2
  202. package/dist/cli/chunks/{daemon-T4CPOFHM.js → daemon-VY2LZPIM.js} +3 -3
  203. package/dist/cli/chunks/{dag-attention-scheduler-GAPYYUHZ.js → dag-attention-scheduler-JNQWWXSW.js} +2 -2
  204. package/dist/cli/chunks/{detect-RU5LBCCI.js → detect-Y7BBW4LI.js} +2 -2
  205. package/dist/cli/chunks/{domain-handler-LKPDVPF6.js → domain-handler-473WNSR2.js} +2 -2
  206. package/dist/cli/chunks/{domain-transfer-Q76ITWBK.js → domain-transfer-R4VK7CRR.js} +2 -2
  207. package/dist/cli/chunks/dream-QQDRI2EQ.js +2 -0
  208. package/dist/cli/chunks/esm-node-Y3HIFLTX.js +2 -0
  209. package/dist/cli/chunks/{eval-TFFIZGTW.js → eval-TJAZGRCM.js} +2 -2
  210. package/dist/cli/chunks/{fast-paths-V6KA3VWH.js → fast-paths-LMN542IB.js} +2 -2
  211. package/dist/cli/chunks/{feature-flags-MYSY53UU.js → feature-flags-IMFZ7KED.js} +2 -2
  212. package/dist/cli/chunks/{feature-flags-DWS4XL2P.js → feature-flags-WMXIDTXL.js} +2 -2
  213. package/dist/cli/chunks/{file-discovery-AMKZRFLT.js → file-discovery-GXXWQJV3.js} +2 -2
  214. package/dist/cli/chunks/{fleet-B2BJFKEV.js → fleet-WIC7RHJV.js} +3 -3
  215. package/dist/cli/chunks/{gnn-wrapper-SOJHQ7VC.js → gnn-wrapper-PVKCXV25.js} +2 -2
  216. package/dist/cli/chunks/{heartbeat-handler-O7FF6NRE.js → heartbeat-handler-BJ6ZZP7Q.js} +4 -4
  217. package/dist/cli/chunks/{heartbeat-scheduler-WOGW5R7J.js → heartbeat-scheduler-3SQXTFYU.js} +2 -2
  218. package/dist/cli/chunks/hnsw-adapter-VKS7ORL2.js +2 -0
  219. package/dist/cli/chunks/hnsw-index-GPUBY6EQ.js +2 -0
  220. package/dist/cli/chunks/{hnsw-legacy-bridge-CC5YS47X.js → hnsw-legacy-bridge-23HFWIPK.js} +2 -2
  221. package/dist/cli/chunks/{hnswlib-node-FTWYRETS.js → hnswlib-node-4GRFMUPD.js} +2 -2
  222. package/dist/cli/chunks/{hooks-ETOFFBMV.js → hooks-IXH5454I.js} +6 -6
  223. package/dist/cli/chunks/{hypergraph-engine-FGAHFWFO.js → hypergraph-engine-TEQMJFJJ.js} +2 -2
  224. package/dist/cli/chunks/{hypergraph-handler-GNWJD7E3.js → hypergraph-handler-3ECUWIG3.js} +3 -3
  225. package/dist/cli/chunks/impact-analyzer-D6MBGRKX.js +2 -0
  226. package/dist/cli/chunks/{init-handler-BEYOLKQO.js → init-handler-TZRKW3NZ.js} +6 -6
  227. package/dist/cli/chunks/init-wizard-S6P2MFJF.js +2 -0
  228. package/dist/cli/chunks/kernel-EFDDMNXJ.js +2 -0
  229. package/dist/cli/chunks/{kilocode-installer-ED6LYSEM.js → kilocode-installer-IPH3O3ZS.js} +2 -2
  230. package/dist/cli/chunks/{kiro-installer-NG77T5YR.js → kiro-installer-VROMOOQO.js} +2 -2
  231. package/dist/cli/chunks/knowledge-graph-4PM4DFH3.js +2 -0
  232. package/dist/cli/chunks/{learning-P3WY3LTI.js → learning-JYQLD66S.js} +3 -3
  233. package/dist/cli/chunks/{llm-router-ETSFMOWS.js → llm-router-CIICNICY.js} +2 -2
  234. package/dist/cli/chunks/{load-PP3GVQT7.js → load-DMAQB4NC.js} +2 -2
  235. package/dist/cli/chunks/load-test-PPSWF3TO.js +2 -0
  236. package/dist/cli/chunks/{mcp-B2VX7EKL.js → mcp-K6CSUBMU.js} +2 -2
  237. package/dist/cli/chunks/{memory-SBZQ6MZ4.js → memory-5BSXKHSK.js} +5 -5
  238. package/dist/cli/chunks/memory-backend-3E6BA2JU.js +2 -0
  239. package/dist/cli/chunks/{memory-handlers-5RMGG2CR.js → memory-handlers-APOLXPNH.js} +2 -2
  240. package/dist/cli/chunks/{opencode-installer-PIDIFO2L.js → opencode-installer-IUWO2QV6.js} +2 -2
  241. package/dist/cli/chunks/{orchestrator-FSGUODZI.js → orchestrator-Z2EM76CR.js} +22 -19
  242. package/dist/cli/chunks/{pipeline-BQ5MWZPT.js → pipeline-OL5SI2RI.js} +2 -2
  243. package/dist/cli/chunks/{platform-6EJK4QMD.js → platform-VNJIKIHZ.js} +2 -2
  244. package/dist/cli/chunks/{plugin-EDGOMUJY.js → plugin-SJJUE47D.js} +2 -2
  245. package/dist/cli/chunks/{prime-radiant-advanced-wasm-4S6FYKPP.js → prime-radiant-advanced-wasm-ZLVTCNSH.js} +2 -2
  246. package/dist/cli/chunks/protocol-executor-2RD52J5J.js +2 -0
  247. package/dist/cli/chunks/{protocol-handler-ETM7PMQU.js → protocol-handler-HTX44YTW.js} +2 -2
  248. package/dist/cli/chunks/{prove-YUBORZAP.js → prove-MGFLVZNS.js} +2 -2
  249. package/dist/cli/chunks/qe-reasoning-bank-OGKT52EN.js +2 -0
  250. package/dist/cli/chunks/{quality-XPZDC5FJ.js → quality-FMFKPICZ.js} +2 -2
  251. package/dist/cli/chunks/queen-coordinator-B63YXNI6.js +2 -0
  252. package/dist/cli/chunks/{real-embeddings-KTDUTUJL.js → real-embeddings-2BMEEOA2.js} +2 -2
  253. package/dist/cli/chunks/{roocode-installer-WADVKI3P.js → roocode-installer-2PA3B5JI.js} +2 -2
  254. package/dist/cli/chunks/router-NDQCJQC6.js +2 -0
  255. package/dist/cli/chunks/routing-feedback-PSN2RLDO.js +2 -0
  256. package/dist/cli/chunks/{routing-handler-OOPOYHEV.js → routing-handler-SNGSQ757.js} +2 -2
  257. package/dist/cli/chunks/{ruvector-commands-UPEZL4OK.js → ruvector-commands-54MYLF63.js} +2 -2
  258. package/dist/cli/chunks/{rvf-dual-writer-TOBBCJ7K.js → rvf-dual-writer-6Q44XJOJ.js} +2 -2
  259. package/dist/cli/chunks/{rvf-migration-adapter-U7UM2U36.js → rvf-migration-adapter-JECN625C.js} +2 -2
  260. package/dist/cli/chunks/{rvf-migration-coordinator-CUX3EU2X.js → rvf-migration-coordinator-MEAVIHQY.js} +2 -2
  261. package/dist/cli/chunks/rvf-native-adapter-F56HQKLS.js +2 -0
  262. package/dist/cli/chunks/safe-db-LMRMNROL.js +2 -0
  263. package/dist/cli/chunks/schedule-OZSUYPPC.js +2 -0
  264. package/dist/cli/chunks/scheduler-GFXCQ6ZA.js +2 -0
  265. package/dist/cli/chunks/{security-AQ4N5YKV.js → security-CXLXTNIV.js} +3 -3
  266. package/dist/cli/chunks/shared-rvf-adapter-RZPF4WWK.js +2 -0
  267. package/dist/cli/chunks/{shared-rvf-dual-writer-OKRIHVSY.js → shared-rvf-dual-writer-SOQDKE6S.js} +2 -2
  268. package/dist/cli/chunks/sqlite-persistence-VP67CJPK.js +2 -0
  269. package/dist/cli/chunks/{status-handler-HSJLJPNG.js → status-handler-NNEF4SQV.js} +2 -2
  270. package/dist/cli/chunks/{structural-health-KWZAS7ON.js → structural-health-FY6QIA55.js} +2 -2
  271. package/dist/cli/chunks/{sync-6L5Z4IWH.js → sync-2QMSZ67Q.js} +2 -2
  272. package/dist/cli/chunks/{task-handler-KEAIPB6G.js → task-handler-GZJPE2QW.js} +2 -2
  273. package/dist/cli/chunks/{task-handlers-BPDN6OSM.js → task-handlers-AHM37D4I.js} +2 -2
  274. package/dist/cli/chunks/{test-PICO6RLU.js → test-JVA2S2R2.js} +4 -4
  275. package/dist/cli/chunks/{test-scheduling-BI3R3DX5.js → test-scheduling-PRMP4H6X.js} +3 -3
  276. package/dist/cli/chunks/{token-bootstrap-KMQC6ALU.js → token-bootstrap-YJEHCBV2.js} +2 -2
  277. package/dist/cli/chunks/{token-usage-QGDX7MLB.js → token-usage-G73L32OF.js} +2 -2
  278. package/dist/cli/chunks/{transformers-UNRYJSIU.js → transformers-U3TSLEGO.js} +2 -2
  279. package/dist/cli/chunks/{tree-sitter-wasm-parser-U22JYPOG.js → tree-sitter-wasm-parser-QXP2MNSX.js} +2 -2
  280. package/dist/cli/chunks/{types-CYXAGOY5.js → types-BIQ7O5VR.js} +2 -2
  281. package/dist/cli/chunks/unified-memory-JB4KPMPI.js +2 -0
  282. package/dist/cli/chunks/unified-memory-hnsw-RPSZZIWP.js +2 -0
  283. package/dist/cli/chunks/unified-persistence-L23T4C5C.js +2 -0
  284. package/dist/cli/chunks/{validate-IUY5BWAV.js → validate-CTBEA4BZ.js} +2 -2
  285. package/dist/cli/chunks/{validate-swarm-FXFKSEOI.js → validate-swarm-PHT6XW3A.js} +2 -2
  286. package/dist/cli/chunks/{vibium-DKZ64NR3.js → vibium-CRCYAH3V.js} +2 -2
  287. package/dist/cli/chunks/visual-security-F2I524IQ.js +2 -0
  288. package/dist/cli/chunks/{web-tree-sitter-WQDTN5CV.js → web-tree-sitter-2MH3G7K7.js} +2 -2
  289. package/dist/cli/chunks/{windsurf-installer-O5WOBFOQ.js → windsurf-installer-LBRNYFSI.js} +2 -2
  290. package/dist/cli/chunks/witness-chain-CN6FCWRY.js +2 -0
  291. package/dist/cli/chunks/{witness-chain-F7WXEVJA.js → witness-chain-HNFQLO7Q.js} +2 -2
  292. package/dist/cli/chunks/{workflow-47524I5G.js → workflow-DNAF6BQ2.js} +4 -4
  293. package/dist/cli/chunks/workflow-orchestrator-JJBCCNYI.js +2 -0
  294. package/dist/cli/chunks/{wrappers-MP2HWQD7.js → wrappers-U7AO6ZZN.js} +2 -2
  295. package/dist/init/browser-engine-installer.d.ts +60 -0
  296. package/dist/init/browser-engine-installer.js +92 -0
  297. package/dist/init/phases/09-assets.d.ts +2 -0
  298. package/dist/init/phases/09-assets.js +65 -0
  299. package/dist/init/skills-installer.js +1 -0
  300. package/dist/mcp/bundle.js +1 -1
  301. package/package.json +1 -1
  302. package/dist/cli/chunks/adapter-GE3RSG32.js +0 -2
  303. package/dist/cli/chunks/aqe-learning-engine-IYL6TK6E.js +0 -2
  304. package/dist/cli/chunks/base-L3G3GEZY.js +0 -2
  305. package/dist/cli/chunks/browser-workflow-7KTCY5FI.js +0 -2
  306. package/dist/cli/chunks/chunk-N5SLJOBK.js +0 -2
  307. package/dist/cli/chunks/client-3DPPDO2H.js +0 -2
  308. package/dist/cli/chunks/cross-domain-router-JOYTUBFT.js +0 -2
  309. package/dist/cli/chunks/dream-IF2HCRW4.js +0 -2
  310. package/dist/cli/chunks/esm-node-LNRP5BNU.js +0 -2
  311. package/dist/cli/chunks/hnsw-adapter-UPX4AXOQ.js +0 -2
  312. package/dist/cli/chunks/hnsw-index-CSI2EXXR.js +0 -2
  313. package/dist/cli/chunks/impact-analyzer-2YVBHMES.js +0 -2
  314. package/dist/cli/chunks/init-wizard-V6GZQMMR.js +0 -2
  315. package/dist/cli/chunks/kernel-EHJ4SP2Y.js +0 -2
  316. package/dist/cli/chunks/knowledge-graph-ZYXBWGKL.js +0 -2
  317. package/dist/cli/chunks/load-test-VDZEYGKV.js +0 -2
  318. package/dist/cli/chunks/memory-backend-IB3BU4VM.js +0 -2
  319. package/dist/cli/chunks/protocol-executor-H2ZG7JBJ.js +0 -2
  320. package/dist/cli/chunks/qe-reasoning-bank-ZCSHSKZU.js +0 -2
  321. package/dist/cli/chunks/queen-coordinator-NEC373VS.js +0 -2
  322. package/dist/cli/chunks/router-3PP5XRTD.js +0 -2
  323. package/dist/cli/chunks/routing-feedback-JNUFV2X3.js +0 -2
  324. package/dist/cli/chunks/rvf-native-adapter-PTOZXG4W.js +0 -2
  325. package/dist/cli/chunks/safe-db-CGYNYUES.js +0 -2
  326. package/dist/cli/chunks/schedule-NRN4WOHX.js +0 -2
  327. package/dist/cli/chunks/scheduler-DRAQGYLL.js +0 -2
  328. package/dist/cli/chunks/shared-rvf-adapter-6UVVDOHK.js +0 -2
  329. package/dist/cli/chunks/sqlite-persistence-3WG7PBPL.js +0 -2
  330. package/dist/cli/chunks/unified-memory-EXRANFUS.js +0 -2
  331. package/dist/cli/chunks/unified-memory-hnsw-GB752D44.js +0 -2
  332. package/dist/cli/chunks/unified-persistence-V2B3YWFD.js +0 -2
  333. package/dist/cli/chunks/visual-security-YMPI7X7V.js +0 -2
  334. package/dist/cli/chunks/witness-chain-7LIPUVMI.js +0 -2
  335. package/dist/cli/chunks/workflow-orchestrator-QPIAR4LI.js +0 -2
@@ -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.9.7");process.exit(0)}
2
- import{a as L}from"./chunk-ZSXSUUBS.js";import*as w from"fs";var R={"aqe test generate":{domain:"test-generation",action:"generateTests"},"aqe test execute":{domain:"test-execution",action:"execute"},"aqe coverage analyze":{domain:"coverage-analysis",action:"analyze"},"aqe coverage gaps":{domain:"coverage-analysis",action:"detectGaps"},"aqe quality gate":{domain:"quality-assessment",action:"evaluateGate"},"aqe quality assess":{domain:"quality-assessment",action:"analyzeQuality"},"aqe security scan":{domain:"security-compliance",action:"runSASTScan"},"aqe security audit":{domain:"security-compliance",action:"runAudit"},"aqe defect predict":{domain:"defect-intelligence",action:"predictDefects"},"aqe code index":{domain:"code-intelligence",action:"index"},"aqe code impact":{domain:"code-intelligence",action:"analyzeImpact"},"aqe contract validate":{domain:"contract-testing",action:"validateContract"},"aqe chaos test":{domain:"chaos-resilience",action:"runChaosTest"},"aqe requirements validate":{domain:"requirements-validation",action:"validateRequirements"},"aqe visual test":{domain:"visual-accessibility",action:"runVisualTest"},"aqe accessibility test":{domain:"visual-accessibility",action:"runAccessibilityTest"},"aqe learn optimize":{domain:"learning-optimization",action:"optimizeAllStrategies"}},D={daily:"0 0 * * *",weekly:"0 0 * * 0",hourly:"0 * * * *",minutely:"* * * * *"},S=1e4,x=20,M=1e4,W=["__proto__","constructor","prototype"];function v(t){return!W.includes(t)}function C(t){let n=t.split(`
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.9");process.exit(0)}
2
+ import{a as L}from"./chunk-PEEN4AAK.js";import*as w from"fs";var R={"aqe test generate":{domain:"test-generation",action:"generateTests"},"aqe test execute":{domain:"test-execution",action:"execute"},"aqe coverage analyze":{domain:"coverage-analysis",action:"analyze"},"aqe coverage gaps":{domain:"coverage-analysis",action:"detectGaps"},"aqe quality gate":{domain:"quality-assessment",action:"evaluateGate"},"aqe quality assess":{domain:"quality-assessment",action:"analyzeQuality"},"aqe security scan":{domain:"security-compliance",action:"runSASTScan"},"aqe security audit":{domain:"security-compliance",action:"runAudit"},"aqe defect predict":{domain:"defect-intelligence",action:"predictDefects"},"aqe code index":{domain:"code-intelligence",action:"index"},"aqe code impact":{domain:"code-intelligence",action:"analyzeImpact"},"aqe contract validate":{domain:"contract-testing",action:"validateContract"},"aqe chaos test":{domain:"chaos-resilience",action:"runChaosTest"},"aqe requirements validate":{domain:"requirements-validation",action:"validateRequirements"},"aqe visual test":{domain:"visual-accessibility",action:"runVisualTest"},"aqe accessibility test":{domain:"visual-accessibility",action:"runAccessibilityTest"},"aqe learn optimize":{domain:"learning-optimization",action:"optimizeAllStrategies"}},D={daily:"0 0 * * *",weekly:"0 0 * * 0",hourly:"0 * * * *",minutely:"* * * * *"},S=1e4,x=20,M=1e4,W=["__proto__","constructor","prototype"];function v(t){return!W.includes(t)}function C(t){let n=t.split(`
3
3
  `);if(n.length>S)throw new Error(`YAML content exceeds maximum allowed lines (${S}). File has ${n.length} lines.`);for(let i=0;i<n.length;i++)if(n[i].length>M)throw new Error(`YAML line ${i+1} exceeds maximum allowed length (${M} characters).`);let a={};for(let i=0;i<n.length;i++){let e=n[i];if(e.trim()===""||e.trim().startsWith("#")||e.search(/\S/)!==0)continue;let o=e.match(/^([\w_-]+):\s*(.+)$/);if(o){let[,c,u]=o;v(c)&&(a[c]=f(u))}}let r=["tags","stages","triggers"];for(let i of r){let e=new RegExp(`^${i}:\\s*$`),s=-1;for(let l=0;l<n.length;l++){let d=n[l];if(!(d.trim()===""||d.trim().startsWith("#"))&&e.test(d.trim())){s=l;break}}if(s===-1)continue;let o=[];a[i]=o;let c=n[s].search(/\S/),u=s+1;for(;u<n.length;){let l=n[u];if(l.trim()===""||l.trim().startsWith("#")){u++;continue}let d=l.search(/\S/),p=l.trim();if(d<=c&&!p.startsWith("-"))break;if(p.startsWith("- ")){let m=p.slice(2).trim();if(!m.includes(":")){o.push(f(m)),u++;continue}let g={},k=m.match(/^([\w_-]+):\s*(.*)$/);if(k){let[,h,y]=k;g[h]=f(y)}let T=d;for(u++;u<n.length;){let h=n[u];if(h.trim()===""||h.trim().startsWith("#")){u++;continue}let y=h.search(/\S/),q=h.trim();if(y<=T)break;let _=q.match(/^([\w_-]+):\s*(.*)$/);if(_){let[,A,$]=_;if($===""){let b=E(n,u+1,y,1);g[A]=b.value,u=b.nextLine;continue}else g[A]=f($)}u++}o.push(g)}else u++}}return a}function E(t,n,a,r=0){if(r>x)throw new Error(`YAML nesting exceeds maximum allowed depth (${x}).`);let i={},e=null,s=null,o=n;for(;o<t.length;){let u=t[o];if(u.trim()===""||u.trim().startsWith("#")){o++;continue}let l=u.search(/\S/),d=u.trim();if(l<=a)break;if(d.startsWith("- ")){let m=d.slice(2).trim();s&&!Array.isArray(i[s])&&(i[s]=[]),s?i[s].push(f(m)):(e||(e=[]),e.push(f(m))),o++;continue}let p=d.match(/^([\w_-]+):\s*(.*)$/);if(p){let[,m,g]=p;if(!v(m)){o++;continue}g===""?(s=m,i[m]=[]):(i[m]=f(g),s=null)}o++}if(e&&Object.keys(i).length===0)return{value:e,nextLine:o};let c=Object.keys(i);return c.length===1&&Array.isArray(i[c[0]])?{value:i[c[0]],nextLine:o}:{value:i,nextLine:o}}function f(t){if(t==="")return"";if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t==="true")return!0;if(t==="false")return!1;if(t==="null"||t==="~")return null;let n=Number(t);return!isNaN(n)&&t!==""?n:t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1).split(",").map(r=>f(r.trim())):t}function K(t){let n=[];if(!w.existsSync(t))return{success:!1,errors:[`File not found: ${t}`]};let a;try{a=w.readFileSync(t,"utf-8")}catch(r){return{success:!1,errors:[`Failed to read file: ${r}`]}}return Y(a,t)}function Y(t,n){let a=[],r;try{r=C(t)}catch(s){return{success:!1,errors:[`Invalid YAML syntax: ${s}`]}}if((!r.name||typeof r.name!="string")&&a.push('Pipeline must have a "name" field'),(!r.stages||!Array.isArray(r.stages))&&a.push('Pipeline must have a "stages" array'),a.length>0)return{success:!1,errors:a};let i={name:r.name,description:r.description,version:r.version||"1.0.0",schedule:r.schedule,stages:r.stages.map((s,o)=>{let c=s;return{name:c.name||`stage-${o}`,command:c.command,params:c.params,depends_on:c.depends_on,condition:c.condition,timeout:c.timeout,retry:c.retry,continue_on_failure:c.continue_on_failure}}),triggers:r.triggers,tags:r.tags,timeout:r.timeout};for(let s=0;s<i.stages.length;s++){let o=i.stages[s];o.command||a.push(`Stage ${s+1} (${o.name}) must have a "command" field`)}if(a.length>0)return{success:!1,pipeline:i,errors:a};let e=O(i,n);return{success:!0,pipeline:i,workflow:e,errors:[]}}function O(t,n){let a=`pipeline-${t.name.replace(/\s+/g,"-").toLowerCase()}`,r=t.stages.map((e,s)=>{let o=P(e.command),c={};if(e.params)for(let[l,d]of Object.entries(e.params))v(l)&&(c[l]=`input.${l}`);let u={id:`stage-${e.name.replace(/\s+/g,"-").toLowerCase()}`,name:e.name,domain:o.domain,action:o.action,inputMapping:Object.keys(c).length>0?c:void 0,dependsOn:e.depends_on?.map(l=>`stage-${l.replace(/\s+/g,"-").toLowerCase()}`),timeout:e.timeout?e.timeout*1e3:void 0,continueOnFailure:e.continue_on_failure};return e.condition&&(u.condition={path:e.condition.path,operator:e.condition.operator,value:e.condition.value}),e.retry&&(u.retry={maxAttempts:e.retry.max_attempts||3,backoffMs:(e.retry.backoff_seconds||1)*1e3}),u}),i=t.triggers?.map(e=>{let s={eventType:I(e),sourceDomain:e.source_domain};return e.condition&&(s.condition={path:e.condition.path,operator:e.condition.operator,value:e.condition.value}),s});return{id:a,name:t.name,description:t.description||`Pipeline from ${n||"inline YAML"}`,version:t.version||"1.0.0",steps:r,triggers:i,tags:t.tags,timeout:t.timeout?t.timeout*1e3:void 0}}function P(t){let n=t.trim().replace(/\s+/g," ").toLowerCase();for(let[a,r]of Object.entries(R))if(n.startsWith(a.toLowerCase()))return r;return n.includes("test")&&n.includes("generate")?{domain:"test-generation",action:"generateTests"}:n.includes("test")&&(n.includes("execute")||n.includes("run"))?{domain:"test-execution",action:"execute"}:n.includes("coverage")?{domain:"coverage-analysis",action:"analyze"}:n.includes("quality")||n.includes("gate")?{domain:"quality-assessment",action:"evaluateGate"}:n.includes("security")||n.includes("scan")?{domain:"security-compliance",action:"runSASTScan"}:n.includes("defect")||n.includes("predict")?{domain:"defect-intelligence",action:"predictDefects"}:{domain:"learning-optimization",action:"runLearningCycle"}}function I(t){let n=t.event.toLowerCase();return n==="push"?"code-intelligence.CodePushed":n==="pull_request"||n==="pr"?"code-intelligence.PullRequestOpened":n==="schedule"?"workflow.ScheduleTrigger":n==="quality_gate"?"quality-assessment.QualityGateEvaluated":n==="test_complete"?"test-execution.TestRunCompleted":n}function F(t){let n=[],a=[];if(t.name||n.push({path:"name",message:"Pipeline name is required",severity:"error"}),!t.stages||t.stages.length===0)n.push({path:"stages",message:"Pipeline must have at least one stage",severity:"error"});else{let r=new Set;for(let e=0;e<t.stages.length;e++){let s=t.stages[e],o=`stages[${e}]`;if(r.has(s.name)&&n.push({path:`${o}.name`,message:`Duplicate stage name: ${s.name}`,severity:"error"}),r.add(s.name),s.command?P(s.command).domain==="learning-optimization"&&!s.command.toLowerCase().includes("learn")&&a.push({path:`${o}.command`,message:`Command "${s.command}" not recognized, will default to learning-optimization domain`,severity:"warning"}):n.push({path:`${o}.command`,message:"Stage must have a command",severity:"error"}),s.depends_on)for(let c of s.depends_on)t.stages.some(u=>u.name===c)||n.push({path:`${o}.depends_on`,message:`Unknown dependency: ${c}`,severity:"error"});s.timeout!==void 0&&s.timeout<=0&&n.push({path:`${o}.timeout`,message:"Timeout must be a positive number",severity:"error"}),s.retry&&s.retry.max_attempts!==void 0&&s.retry.max_attempts<1&&n.push({path:`${o}.retry.max_attempts`,message:"max_attempts must be at least 1",severity:"error"})}let i=N(t.stages);i&&n.push({path:"stages",message:`Circular dependency detected: ${i}`,severity:"error"})}if(t.schedule&&(z(t.schedule)||n.push({path:"schedule",message:`Invalid cron expression: ${t.schedule}`,severity:"error"})),t.triggers)for(let r=0;r<t.triggers.length;r++){let i=t.triggers[r],e=`triggers[${r}]`;i.event||n.push({path:`${e}.event`,message:"Trigger must have an event type",severity:"error"}),i.source_domain&&!L.includes(i.source_domain)&&a.push({path:`${e}.source_domain`,message:`Unknown domain: ${i.source_domain}`,severity:"warning"})}return{valid:n.length===0,errors:n,warnings:a}}function N(t){let n=new Set,a=new Set,r=(i,e)=>{if(a.has(i))return[...e,i].join(" -> ");if(n.has(i))return null;n.add(i),a.add(i);let s=t.find(o=>o.name===i);if(s?.depends_on)for(let o of s.depends_on){let c=r(o,[...e,i]);if(c)return c}return a.delete(i),null};for(let i of t){let e=r(i.name,[]);if(e)return e}return null}function z(t){if(Object.keys(D).includes(t))return!0;let n=t.trim().split(/\s+/);if(n.length!==5)return!1;let a=[/^(\*|[0-5]?\d)(-[0-5]?\d)?(\/\d+)?$/,/^(\*|1?\d|2[0-3])(-\d+)?(\/\d+)?$/,/^(\*|[1-9]|[12]\d|3[01])(-\d+)?(\/\d+)?$/,/^(\*|[1-9]|1[0-2])(-\d+)?(\/\d+)?$/,/^(\*|[0-7])(-[0-7])?(\/\d+)?$/];for(let r=0;r<5;r++){let i=n[r].split(",");for(let e of i)if(!a[r].test(e)&&e!=="*")return!1}return!0}function G(t){let n={"@daily":"Daily at midnight","@weekly":"Weekly on Sunday at midnight","@hourly":"Every hour","@minutely":"Every minute"};if(n[t])return n[t];if(Object.keys(D).includes(t))return{daily:"Daily at midnight",weekly:"Weekly on Sunday at midnight",hourly:"Every hour",minutely:"Every minute"}[t]||t;let a=t.trim().split(/\s+/);if(a.length!==5)return t;let[r,i,e,s,o]=a;return r==="0"&&i==="0"&&e==="*"&&s==="*"&&o==="*"?"Daily at midnight":r==="0"&&e==="*"&&s==="*"&&o==="*"?`Daily at ${i}:00`:r!=="*"&&i!=="*"&&e==="*"&&s==="*"?`Daily at ${i}:${r.padStart(2,"0")}`:i==="*"&&r==="0"?"Every hour":r!=="*"&&i==="*"?`Every hour at minute ${r}`:t}function H(t,n=new Date){let a=t.trim().split(/\s+/);if(a.length!==5)return new Date(n.getTime()+1440*60*1e3);let[r,i]=a,e=new Date(n);return i!=="*"&&r!=="*"?(e.setHours(parseInt(i,10),parseInt(r,10),0,0),e<=n&&e.setDate(e.getDate()+1)):i!=="*"?(e.setHours(parseInt(i,10),0,0,0),e<=n&&e.setDate(e.getDate()+1)):r!=="*"?(e.setMinutes(parseInt(r,10),0,0),e<=n&&e.setHours(e.getHours()+1)):(e.setSeconds(0,0),e.setMinutes(e.getMinutes()+1)),e}export{C as a,K as b,F as c,G as d,H as e};
@@ -1,4 +1,4 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.7");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.9.9");process.exit(0)}
2
2
  import*as h from"fs";import*as M from"path";var S=["coverage/coverage-final.json","coverage/coverage-summary.json",".coverage/coverage-final.json"];function x(s){for(let v of S){let i=M.join(s,v);if(h.existsSync(i))try{let n=JSON.parse(h.readFileSync(i,"utf-8"));if(n.total&&n.total.lines)return L(n,s);let o=new Map;for(let[r,C]of Object.entries(n)){let c=C,g=Object.keys(c.s),u=g.filter(a=>c.s[a]>0).length,b=Object.keys(c.b),p=0,m=0;for(let a of b)for(let y of c.b[a])p++,y>0&&m++;let e=Object.keys(c.f),t=e.filter(a=>c.f[a]>0).length,f=new Set,d=new Set;for(let a of g){let y=c.statementMap[a];for(let F=y.start.line;F<=y.end.line;F++)d.add(F),c.s[a]>0&&f.add(F)}let l=[...d].filter(a=>!f.has(a)).sort((a,y)=>a-y);o.set(r,{path:r,lines:{covered:f.size,total:d.size},branches:{covered:m,total:p},functions:{covered:t,total:e.length},statements:{covered:u,total:g.length},uncoveredLines:l,uncoveredBranches:l.slice(0,Math.floor(l.length/2))})}return o.size>0?o:null}catch{continue}}return null}function L(s,v){let i=new Map;for(let[n,o]of Object.entries(s)){if(n==="total")continue;let r=o;i.set(n,{path:n,lines:{covered:r.lines.covered,total:r.lines.total},branches:{covered:r.branches.covered,total:r.branches.total},functions:{covered:r.functions.covered,total:r.functions.total},statements:{covered:r.statements.covered,total:r.statements.total},uncoveredLines:[],uncoveredBranches:[]})}return i.size>0?i:null}function B(s,v){let n=v.split(`
3
3
  `).length,r=[s.replace(".ts",".test.ts").replace("/src/","/tests/"),s.replace(".ts",".spec.ts").replace("/src/","/tests/"),s.replace(".ts",".test.ts"),s.replace("/src/","/test/").replace(".ts",".test.ts")].some(d=>h.existsSync(d)),C=(v.match(/\bexport\b/g)||[]).length,c=(v.match(/\b(function|=>)\b/g)||[]).length,g=(v.match(/\b(if|switch|case|\?\?|\|\|)\b/g)||[]).length,u;if(r){let d=Math.min(g*.005,.15),l=Math.min(n*1e-4,.1);u=.85-d-l}else u=.2+(C>5?.1:0);u=Math.max(.05,Math.min(.95,u));let b=Math.floor(n*u),p=Math.max(c,1),m=Math.max(g,1),e=Math.floor(b*.7),t=Math.floor(p*u*.9),f=Array.from({length:n-b},(d,l)=>l+b+1);return{path:s,lines:{covered:b,total:n},branches:{covered:Math.min(e,m),total:m},functions:{covered:Math.min(t,p),total:p},statements:{covered:b,total:n},uncoveredLines:f,uncoveredBranches:f.slice(0,Math.floor(f.length/2))}}function j(s,v){let i=v||process.cwd(),n=x(i),o=[],r=!1;if(n&&n.size>0){r=!0;for(let e of s){let t=M.resolve(e),f=n.get(t)||n.get(e)||n.get(M.relative(i,t));if(f)o.push({...f,path:e});else{let l=(h.existsSync(e)?h.readFileSync(e,"utf-8"):"").split(`
4
4
  `).length;o.push({path:e,lines:{covered:0,total:l},branches:{covered:0,total:1},functions:{covered:0,total:1},statements:{covered:0,total:l},uncoveredLines:Array.from({length:l},(a,y)=>y+1),uncoveredBranches:[]})}}}else for(let e of s){let t=h.existsSync(e)?h.readFileSync(e,"utf-8"):"";o.push(B(e,t))}let C=o.reduce((e,t)=>e+t.lines.total,0),c=o.reduce((e,t)=>e+t.lines.covered,0),g=o.reduce((e,t)=>e+t.branches.total,0),u=o.reduce((e,t)=>e+t.branches.covered,0),b=o.reduce((e,t)=>e+t.functions.total,0),p=o.reduce((e,t)=>e+t.functions.covered,0),m=(e,t)=>t>0?Math.round(e/t*100):0;return{files:o,summary:{line:m(c,C),branch:m(u,g),function:m(p,b),statement:m(c,C),files:o.length},instrumented:r}}export{j 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.9.7");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.9.9");process.exit(0)}
2
2
  var l=["var-to-const","add-types","remove-console","promise-to-async","cjs-to-esm","func-to-arrow"],p={"var-to-const":{type:"var-to-const",name:"Var to Const/Let",description:"Convert var declarations to const (if not reassigned) or let (if reassigned)",complexity:"simple",wasmAvailable:!0,typicalLatencyMs:1},"add-types":{type:"add-types",name:"Add TypeScript Types",description:"Add TypeScript type annotations to function parameters and return types",complexity:"moderate",wasmAvailable:!0,typicalLatencyMs:5},"remove-console":{type:"remove-console",name:"Remove Console Statements",description:"Remove all console.log, console.warn, console.error, etc. statements",complexity:"simple",wasmAvailable:!0,typicalLatencyMs:1},"promise-to-async":{type:"promise-to-async",name:"Promise to Async/Await",description:"Convert Promise .then()/.catch() chains to async/await syntax",complexity:"complex",wasmAvailable:!0,typicalLatencyMs:10},"cjs-to-esm":{type:"cjs-to-esm",name:"CommonJS to ES Modules",description:"Convert require() calls to import statements and module.exports to export",complexity:"moderate",wasmAvailable:!0,typicalLatencyMs:5},"func-to-arrow":{type:"func-to-arrow",name:"Function to Arrow",description:"Convert function declarations and expressions to arrow functions",complexity:"moderate",wasmAvailable:!0,typicalLatencyMs:3}},u={enabled:!0,fallbackToLLM:!0,confidenceThreshold:.7,transforms:[],maxFileSizeBytes:1024*1024,timeoutMs:5e3,cacheEnabled:!0,cacheTtlMs:300*1e3},t=class extends Error{constructor(e,s,o){super(e);this.code=s;this.cause=o;this.name="AgentBoosterError"}},a=class extends t{constructor(e,s,o){super(e,"TRANSFORM_ERROR",o);this.transformType=s;this.name="TransformError"}},i=class extends t{constructor(r="WASM module is not available",e){super(r,"WASM_UNAVAILABLE",e),this.name="WasmUnavailableError"}},c=class extends t{constructor(e,s,o){super(e,"TRANSFORM_TIMEOUT");this.transformType=s;this.timeoutMs=o;this.name="TransformTimeoutError"}},m=class extends t{constructor(e,s,o){super(`File ${e} is too large (${s} bytes, max ${o} bytes)`,"FILE_TOO_LARGE");this.filePath=e;this.sizeBytes=s;this.maxSizeBytes=o;this.name="FileTooLargeError"}};export{l as a,p as b,u as c,a as d,i as e,c as f,m 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.9.7");process.exit(0)}
2
- import{a as M}from"./chunk-KHH5UJXY.js";import{f as y,o as T}from"./chunk-JRHKFRUB.js";import{a as p,c as S}from"./chunk-MR7V7QVL.js";import{f as b}from"./chunk-SMKRBNO7.js";T();S();import*as c from"path";import*as d from"fs";var m=null,u=null,l=null;function R(o){l=o}async function P(){return m||u||(u=(async()=>{let o=y(),e=c.join(o,".agentic-qe");d.existsSync(e)||d.mkdirSync(e,{recursive:!0});let r=new M({sqlite:{path:c.join(e,"memory.db"),walMode:!0,poolSize:3,busyTimeout:5e3},enableFallback:!0,defaultNamespace:"mcp-tools"});return await r.initialize(),m=r,r})(),u)}function $(){if(l)try{l()}catch{}m&&(m.dispose().catch(()=>{}),m=null),u=null}async function D(o){return o?.memory?o.memory:P()}var C={info:(o,e)=>console.log(`[MCP-TOOL] ${o}`,e||""),warn:(o,e)=>console.warn(`[MCP-TOOL] \u26A0\uFE0F ${o}`,e||""),error:(o,e)=>console.error(`[MCP-TOOL] \u274C ${o}`,e||"")},h=class{logger=C;currentDataSource="real";setLogger(e){this.logger=e}markAsDemoData(e,r){this.currentDataSource=e.demoMode?"demo":"fallback",this.logger.warn(`${this.config.name} returning ${this.currentDataSource} data`,{reason:r,requestId:e.requestId,demoMode:e.demoMode})}markAsRealData(){this.currentDataSource="real"}isDemoMode(e){return e.demoMode===!0}validate(e){let r=[];if(typeof e!="object"||e===null)return{valid:!1,errors:["Parameters must be an object"]};let t=e,{properties:a,required:n}=this.config.schema;if(n)for(let i of n)i in t||r.push(`Missing required field: ${i}`);for(let[i,s]of Object.entries(t)){let g=a[i];if(!g)continue;let f=this.validateType(i,s,g);f&&r.push(f)}return{valid:r.length===0,errors:r}}validateType(e,r,t){if(r==null)return null;let a=Array.isArray(r)?"array":typeof r;if(t.type==="array"&&!Array.isArray(r))return`${e} must be an array`;if(t.type!=="array"&&a!==t.type)return`${e} must be of type ${t.type}, got ${a}`;if(t.enum&&!t.enum.includes(r))return`${e} must be one of: ${t.enum.join(", ")}`;if(t.type==="number"){let n=r;if(t.minimum!==void 0&&n<t.minimum)return`${e} must be >= ${t.minimum}`;if(t.maximum!==void 0&&n>t.maximum)return`${e} must be <= ${t.maximum}`}if(t.type==="string"){let n=r;if(t.minLength!==void 0&&n.length<t.minLength)return`${e} must be at least ${t.minLength} characters`;if(t.maxLength!==void 0&&n.length>t.maxLength)return`${e} must be at most ${t.maxLength} characters`}return null}async invoke(e,r={}){let t=Date.now(),a=b();this.currentDataSource="real";let n=this.validate(e);if(!n.valid)return{success:!1,error:`Validation failed: ${n.errors.join("; ")}`,metadata:this.createMetadata(t,a)};let i={requestId:a,startTime:t,streaming:r.streaming,onStream:r.onStream,abortSignal:r.abortSignal,demoMode:r.demoMode};try{let s=await this.execute(e,i);return{...s,metadata:{...s.metadata,...this.createMetadata(t,a)}}}catch(s){return{success:!1,error:p(s),metadata:this.createMetadata(t,a)}}}createMetadata(e,r){return{executionTime:Date.now()-e,timestamp:new Date().toISOString(),requestId:r,domain:this.config.domain,toolName:this.config.name,dataSource:this.currentDataSource}}emitStream(e,r){e.streaming&&e.onStream&&e.onStream(r)}isAborted(e){return e.abortSignal?.aborted??!1}get name(){return this.config.name}get description(){return this.config.description}get domain(){return this.config.domain}getSchema(){return this.config.schema}get timeout(){return this.config.timeout??6e4}get supportsStreaming(){return this.config.streaming??!1}resetInstanceCache(){}};export{R as a,P as b,$ as c,D as d,C as e,h as f};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.9");process.exit(0)}
2
+ import{a as M}from"./chunk-2HFPJPQW.js";import{f as y,o as T}from"./chunk-MUIJVPGB.js";import{a as p,c as S}from"./chunk-BVOGMK6N.js";import{f as b}from"./chunk-FTF34UME.js";T();S();import*as c from"path";import*as d from"fs";var m=null,u=null,l=null;function R(o){l=o}async function P(){return m||u||(u=(async()=>{let o=y(),e=c.join(o,".agentic-qe");d.existsSync(e)||d.mkdirSync(e,{recursive:!0});let r=new M({sqlite:{path:c.join(e,"memory.db"),walMode:!0,poolSize:3,busyTimeout:5e3},enableFallback:!0,defaultNamespace:"mcp-tools"});return await r.initialize(),m=r,r})(),u)}function $(){if(l)try{l()}catch{}m&&(m.dispose().catch(()=>{}),m=null),u=null}async function D(o){return o?.memory?o.memory:P()}var C={info:(o,e)=>console.log(`[MCP-TOOL] ${o}`,e||""),warn:(o,e)=>console.warn(`[MCP-TOOL] \u26A0\uFE0F ${o}`,e||""),error:(o,e)=>console.error(`[MCP-TOOL] \u274C ${o}`,e||"")},h=class{logger=C;currentDataSource="real";setLogger(e){this.logger=e}markAsDemoData(e,r){this.currentDataSource=e.demoMode?"demo":"fallback",this.logger.warn(`${this.config.name} returning ${this.currentDataSource} data`,{reason:r,requestId:e.requestId,demoMode:e.demoMode})}markAsRealData(){this.currentDataSource="real"}isDemoMode(e){return e.demoMode===!0}validate(e){let r=[];if(typeof e!="object"||e===null)return{valid:!1,errors:["Parameters must be an object"]};let t=e,{properties:a,required:n}=this.config.schema;if(n)for(let i of n)i in t||r.push(`Missing required field: ${i}`);for(let[i,s]of Object.entries(t)){let g=a[i];if(!g)continue;let f=this.validateType(i,s,g);f&&r.push(f)}return{valid:r.length===0,errors:r}}validateType(e,r,t){if(r==null)return null;let a=Array.isArray(r)?"array":typeof r;if(t.type==="array"&&!Array.isArray(r))return`${e} must be an array`;if(t.type!=="array"&&a!==t.type)return`${e} must be of type ${t.type}, got ${a}`;if(t.enum&&!t.enum.includes(r))return`${e} must be one of: ${t.enum.join(", ")}`;if(t.type==="number"){let n=r;if(t.minimum!==void 0&&n<t.minimum)return`${e} must be >= ${t.minimum}`;if(t.maximum!==void 0&&n>t.maximum)return`${e} must be <= ${t.maximum}`}if(t.type==="string"){let n=r;if(t.minLength!==void 0&&n.length<t.minLength)return`${e} must be at least ${t.minLength} characters`;if(t.maxLength!==void 0&&n.length>t.maxLength)return`${e} must be at most ${t.maxLength} characters`}return null}async invoke(e,r={}){let t=Date.now(),a=b();this.currentDataSource="real";let n=this.validate(e);if(!n.valid)return{success:!1,error:`Validation failed: ${n.errors.join("; ")}`,metadata:this.createMetadata(t,a)};let i={requestId:a,startTime:t,streaming:r.streaming,onStream:r.onStream,abortSignal:r.abortSignal,demoMode:r.demoMode};try{let s=await this.execute(e,i);return{...s,metadata:{...s.metadata,...this.createMetadata(t,a)}}}catch(s){return{success:!1,error:p(s),metadata:this.createMetadata(t,a)}}}createMetadata(e,r){return{executionTime:Date.now()-e,timestamp:new Date().toISOString(),requestId:r,domain:this.config.domain,toolName:this.config.name,dataSource:this.currentDataSource}}emitStream(e,r){e.streaming&&e.onStream&&e.onStream(r)}isAborted(e){return e.abortSignal?.aborted??!1}get name(){return this.config.name}get description(){return this.config.description}get domain(){return this.config.domain}getSchema(){return this.config.schema}get timeout(){return this.config.timeout??6e4}get supportsStreaming(){return this.config.streaming??!1}resetInstanceCache(){}};export{R as a,P as b,$ as c,D as d,C as e,h as f};
@@ -1,5 +1,5 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.7");process.exit(0)}
2
- import{a as A}from"./chunk-D2C4XNF5.js";import{a as z}from"./chunk-7TKZ6LK6.js";import{k as _,n as Q,o as U}from"./chunk-JRHKFRUB.js";import{d as P,e as B}from"./chunk-6OKXGDT3.js";import{b as w,d as K}from"./chunk-WLYSZV5U.js";import{a as p,c as R}from"./chunk-MR7V7QVL.js";import{g as N}from"./chunk-UEFAPTBV.js";U();R();K();B();import{randomUUID as I}from"crypto";var D=P("TokenTracker"),O={costPerInputToken:.003/1e3,costPerOutputToken:.015/1e3},j={filePath:".agentic-qe/token-metrics.json",autoSaveIntervalMs:6e4,maxMetricsInMemory:1e4},S=class c{taskMetrics=[];agentMetrics=new Map;domainMetrics=new Map;sessionId;sessionStartTime;costConfig;cacheHits=0;earlyExits=0;totalTokensSaved=0;totalPatternsReused=0;initialized=!1;persistenceConfig=j;autoSaveTimer=null;isDirty=!1;db=null;kvPersistCount=0;static KV_NAMESPACE="token-usage-metrics";static KV_KEY="token-tracker-snapshot";static KV_TTL=604800;static KV_PERSIST_INTERVAL=10;constructor(){this.sessionId=`session-${Date.now()}-${I().substring(0,8)}`,this.sessionStartTime=Date.now(),this.costConfig=O}initialize(e){this.initialized||(this.initialized=!0,e&&(this.costConfig={...O,...e}),this.initializeDb().catch(t=>{D.warn("DB initialization failed",{error:t instanceof Error?t.message:String(t)})}),this.startAutoSave())}setCostConfig(e){this.costConfig={...this.costConfig,...e}}recordTokenUsage(e,t,n,i,s,o){this.ensureInitialized();let l,u,r,a,m,d;typeof t=="object"?(l="default",u="unknown",r="unknown",a=t,m=!1,d=0):(l=t,u=n??"unknown",r=i??"unknown",a=s,m=o?.patternReused??!1,d=o?.tokensSaved??0),a.estimatedCostUsd===void 0&&(a.estimatedCostUsd=this.calculateCost(a));let h={taskId:e,agentId:l,domain:u,operation:r,timestamp:Date.now(),usage:a,patternReused:m,tokensSaved:d};this.taskMetrics.push(h),this.updateAgentMetrics(l,a,m,d),this.updateDomainMetrics(u,a),m&&this.totalPatternsReused++,d>0&&(this.totalTokensSaved+=d),this.isDirty=!0,this.maybePersistToKv()}recordPatternReuse(e,t){this.ensureInitialized(),this.totalPatternsReused++,this.totalTokensSaved+=t;let n={taskId:e,agentId:"pattern-cache",domain:"optimization",operation:"pattern-reuse",timestamp:Date.now(),usage:{inputTokens:0,outputTokens:0,totalTokens:0,estimatedCostUsd:0},patternReused:!0,tokensSaved:t};this.taskMetrics.push(n),this.isDirty=!0}recordCacheHit(e){this.cacheHits++,this.totalTokensSaved+=e,this.isDirty=!0}recordEarlyExit(e){this.earlyExits++,this.totalTokensSaved+=e,this.isDirty=!0}getSessionSummary(e){this.ensureInitialized();let t=this.filterByTimeframe(this.taskMetrics,e),n=this.aggregateTokenUsage(t),i=new Map;for(let r of t){let a=i.get(r.agentId);a?(a.totalInputTokens+=r.usage.inputTokens,a.totalOutputTokens+=r.usage.outputTokens,a.totalTokens+=r.usage.totalTokens,a.totalCost+=r.usage.estimatedCostUsd||0,a.tasksExecuted++,r.patternReused&&a.patternsReused++,a.estimatedTokensSaved+=r.tokensSaved||0):i.set(r.agentId,{agentId:r.agentId,totalInputTokens:r.usage.inputTokens,totalOutputTokens:r.usage.outputTokens,totalTokens:r.usage.totalTokens,totalCost:r.usage.estimatedCostUsd||0,tasksExecuted:1,patternsReused:r.patternReused?1:0,estimatedTokensSaved:r.tokensSaved||0})}let s=new Map;for(let r of t){let a=s.get(r.domain);a?(a.inputTokens+=r.usage.inputTokens,a.outputTokens+=r.usage.outputTokens,a.totalTokens+=r.usage.totalTokens,a.estimatedCostUsd=(a.estimatedCostUsd||0)+(r.usage.estimatedCostUsd||0)):s.set(r.domain,{...r.usage})}let o=n.totalTokens,l=this.totalTokensSaved,u=o+l>0?l/(o+l)*100:0;return{sessionId:this.sessionId,startTime:this.sessionStartTime,endTime:Date.now(),byAgent:i,byDomain:s,totalUsage:n,optimizationStats:{patternsReused:this.totalPatternsReused,cacheHits:this.cacheHits,earlyExits:this.earlyExits,tokensSaved:this.totalTokensSaved,savingsPercentage:Math.round(u*100)/100}}}getAgentMetrics(e,t){this.ensureInitialized();let n=this.filterByTimeframe(this.taskMetrics,t);if(e){let s=n.filter(o=>o.agentId===e);return this.aggregateAgentMetrics(e,s)}let i=new Map;for(let s of n){let o=i.get(s.agentId)||[];o.push(s),i.set(s.agentId,o)}return Array.from(i.entries()).map(([s,o])=>this.aggregateAgentMetrics(s,o))}getDomainMetrics(e,t){this.ensureInitialized();let n=this.filterByTimeframe(this.taskMetrics,t);if(e){let s=n.filter(o=>o.domain===e);return this.aggregateTokenUsage(s)}let i=new Map;for(let s of n){let o=i.get(s.domain);o?(o.inputTokens+=s.usage.inputTokens,o.outputTokens+=s.usage.outputTokens,o.totalTokens+=s.usage.totalTokens,o.estimatedCostUsd=(o.estimatedCostUsd||0)+(s.usage.estimatedCostUsd||0)):i.set(s.domain,{...s.usage})}return i}getTaskMetrics(e){return this.ensureInitialized(),this.filterByTimeframe(this.taskMetrics,e)}getEfficiencyReport(e){return this.getTokenEfficiency(e)}getTokenEfficiency(e){this.ensureInitialized();let t=this.filterByTimeframe(this.taskMetrics,e),i=this.aggregateTokenUsage(t).totalTokens,s=this.totalTokensSaved,o=i+s>0?s/(i+s)*100:0,l=t.length,u=l>0?t.filter(m=>m.patternReused).length/l:0,r=l>0?i/l:0,a=this.generateRecommendations(t);return{totalTokensUsed:i,totalTokensSaved:s,savingsPercentage:Math.round(o*100)/100,patternReuseRate:Math.round(u*100)/100,averageTokensPerTask:Math.round(r),recommendations:a}}reset(){this.stopAutoSave(),this.taskMetrics=[],this.agentMetrics.clear(),this.domainMetrics.clear(),this.sessionId=`session-${Date.now()}-${I().substring(0,8)}`,this.sessionStartTime=Date.now(),this.cacheHits=0,this.earlyExits=0,this.totalTokensSaved=0,this.totalPatternsReused=0,this.isDirty=!1}configurePersistence(e){this.persistenceConfig={...this.persistenceConfig,...e},e.autoSaveIntervalMs!==void 0&&(this.stopAutoSave(),e.autoSaveIntervalMs>0&&this.startAutoSave())}startAutoSave(){this.autoSaveTimer||this.persistenceConfig.autoSaveIntervalMs>0&&(this.autoSaveTimer=setInterval(()=>{this.isDirty&&this.save().catch(e=>{console.warn("[TokenMetricsCollector] Auto-save failed:",e)})},this.persistenceConfig.autoSaveIntervalMs))}stopAutoSave(){this.autoSaveTimer&&(clearInterval(this.autoSaveTimer),this.autoSaveTimer=null)}async save(){let e=await import("fs"),t=await import("path"),n={version:"1.0.0",sessionId:this.sessionId,sessionStartTime:this.sessionStartTime,taskMetrics:this.taskMetrics.slice(-this.persistenceConfig.maxMetricsInMemory),optimizationStats:{cacheHits:this.cacheHits,earlyExits:this.earlyExits,totalTokensSaved:this.totalTokensSaved,totalPatternsReused:this.totalPatternsReused},lastSavedAt:Date.now()},i=t.resolve(this.persistenceConfig.filePath),s=t.dirname(i);e.existsSync(s)||e.mkdirSync(s,{recursive:!0}),e.writeFileSync(i,JSON.stringify(n,null,2)),this.isDirty=!1}async load(){let e=await import("fs"),n=(await import("path")).resolve(this.persistenceConfig.filePath);if(!e.existsSync(n))return!1;try{let i=e.readFileSync(n,"utf-8"),s=w(i);if(!s.version||!s.version.startsWith("1."))return console.warn("[TokenMetricsCollector] Incompatible data version, skipping load"),!1;let o=s.taskMetrics||[];this.taskMetrics=[...o,...this.taskMetrics],this.cacheHits+=s.optimizationStats?.cacheHits||0,this.earlyExits+=s.optimizationStats?.earlyExits||0,this.totalTokensSaved+=s.optimizationStats?.totalTokensSaved||0,this.totalPatternsReused+=s.optimizationStats?.totalPatternsReused||0;for(let l of o)this.updateAgentMetrics(l.agentId,l.usage,l.patternReused,l.tokensSaved||0),this.updateDomainMetrics(l.domain,l.usage);return this.taskMetrics.length>this.persistenceConfig.maxMetricsInMemory&&(this.taskMetrics=this.taskMetrics.slice(-this.persistenceConfig.maxMetricsInMemory)),!0}catch(i){return console.warn("[TokenMetricsCollector] Failed to load persisted data:",i),!1}}getPersistenceFilePath(){return this.persistenceConfig.filePath}hasUnsavedChanges(){return this.isDirty}async initializeDb(){try{this.db=_(),this.db.isInitialized()||await this.db.initialize(),await this.loadFromKv()}catch(e){console.warn("[TokenMetricsCollector] DB init failed, using memory-only:",p(e)),this.db=null}}async persistToKv(){if(!this.db)return;let e={version:"1.0.0",sessionId:this.sessionId,sessionStartTime:this.sessionStartTime,taskMetrics:this.taskMetrics.slice(-this.persistenceConfig.maxMetricsInMemory),optimizationStats:{cacheHits:this.cacheHits,earlyExits:this.earlyExits,totalTokensSaved:this.totalTokensSaved,totalPatternsReused:this.totalPatternsReused},lastSavedAt:Date.now()};await this.db.kvSet(c.KV_KEY,e,c.KV_NAMESPACE,c.KV_TTL)}async loadFromKv(){if(!this.db)return!1;let e=await this.db.kvGet(c.KV_KEY,c.KV_NAMESPACE);if(!e)return!1;if(!e.version||!e.version.startsWith("1."))return console.warn("[TokenMetricsCollector] Incompatible kv_store data version, skipping load"),!1;let t=e.taskMetrics||[];this.taskMetrics=[...t,...this.taskMetrics],this.cacheHits+=e.optimizationStats?.cacheHits||0,this.earlyExits+=e.optimizationStats?.earlyExits||0,this.totalTokensSaved+=e.optimizationStats?.totalTokensSaved||0,this.totalPatternsReused+=e.optimizationStats?.totalPatternsReused||0;for(let n of t)this.updateAgentMetrics(n.agentId,n.usage,n.patternReused,n.tokensSaved||0),this.updateDomainMetrics(n.domain,n.usage);return this.taskMetrics.length>this.persistenceConfig.maxMetricsInMemory&&(this.taskMetrics=this.taskMetrics.slice(-this.persistenceConfig.maxMetricsInMemory)),!0}maybePersistToKv(){this.kvPersistCount++,this.kvPersistCount>=c.KV_PERSIST_INTERVAL&&(this.kvPersistCount=0,this.persistToKv().catch(e=>{D.warn("KV persist failed",{error:e instanceof Error?e.message:String(e)})}))}ensureInitialized(){this.initialized||this.initialize()}calculateCost(e){let t=e.inputTokens*this.costConfig.costPerInputToken,n=e.outputTokens*this.costConfig.costPerOutputToken;return Math.round((t+n)*1e5)/1e5}filterByTimeframe(e,t){if(!t)return e;let n=Date.now(),i;switch(t){case"1h":i=n-3600*1e3;break;case"24h":i=n-1440*60*1e3;break;case"7d":i=n-10080*60*1e3;break;case"30d":i=n-720*60*60*1e3;break;default:return e}return e.filter(s=>s.timestamp>=i)}aggregateTokenUsage(e){let t=0,n=0,i=0,s=0;for(let o of e)t+=o.usage.inputTokens,n+=o.usage.outputTokens,i+=o.usage.totalTokens,s+=o.usage.estimatedCostUsd||0;return{inputTokens:t,outputTokens:n,totalTokens:i,estimatedCostUsd:Math.round(s*1e5)/1e5}}aggregateAgentMetrics(e,t){let n=0,i=0,s=0,o=0,l=0,u=0;for(let r of t)n+=r.usage.inputTokens,i+=r.usage.outputTokens,s+=r.usage.totalTokens,o+=r.usage.estimatedCostUsd||0,r.patternReused&&l++,u+=r.tokensSaved||0;return{agentId:e,totalInputTokens:n,totalOutputTokens:i,totalTokens:s,totalCost:Math.round(o*1e5)/1e5,tasksExecuted:t.length,patternsReused:l,estimatedTokensSaved:u}}updateAgentMetrics(e,t,n,i){let s=this.agentMetrics.get(e);s?(s.totalInputTokens+=t.inputTokens,s.totalOutputTokens+=t.outputTokens,s.totalTokens+=t.totalTokens,s.totalCost+=t.estimatedCostUsd||0,s.tasksExecuted++,n&&s.patternsReused++,s.estimatedTokensSaved+=i):this.agentMetrics.set(e,{agentId:e,totalInputTokens:t.inputTokens,totalOutputTokens:t.outputTokens,totalTokens:t.totalTokens,totalCost:t.estimatedCostUsd||0,tasksExecuted:1,patternsReused:n?1:0,estimatedTokensSaved:i})}updateDomainMetrics(e,t){let n=this.domainMetrics.get(e);n?(n.inputTokens+=t.inputTokens,n.outputTokens+=t.outputTokens,n.totalTokens+=t.totalTokens,n.estimatedCostUsd=(n.estimatedCostUsd||0)+(t.estimatedCostUsd||0)):this.domainMetrics.set(e,{...t})}generateRecommendations(e){let t=[];if(e.length===0)return["No token usage data available yet. Start executing tasks to track consumption."];let n=e.filter(r=>r.patternReused).length/e.length;n<.2?t.push("Low pattern reuse rate detected. Consider enabling pattern caching for similar tasks."):n>.5&&t.push("Good pattern reuse rate. Continue leveraging cached patterns for token savings.");let i=new Map;for(let r of e){let a=i.get(r.domain)||0;i.set(r.domain,a+r.usage.totalTokens)}let s=Array.from(i.entries()).sort((r,a)=>a[1]-r[1]);if(s.length>0){let r=s[0];t.push(`Highest token consumer: ${r[0]} (${r[1].toLocaleString()} tokens). Consider optimizing prompts or increasing caching.`)}let o=e.reduce((r,a)=>r+a.usage.inputTokens,0);return e.reduce((r,a)=>r+a.usage.outputTokens,0)/(o||1)>2&&t.push("High output-to-input token ratio. Consider requesting more concise responses."),this.cacheHits===0&&e.length>10&&t.push("No cache hits detected. Enable response caching to reduce duplicate API calls."),this.earlyExits===0&&e.length>20&&t.push("Early exit optimization not utilized. Enable high-confidence pattern matching to skip unnecessary LLM calls."),t}};function F(c){return c.toLocaleString("en-US")}function $(c){if(process.env.AQE_TOKEN_DASHBOARD_ENABLED==="false")return"Token dashboard disabled (AQE_TOKEN_DASHBOARD_ENABLED=false)";if(!c){let u=g.getSessionSummary(),r=u.totalUsage.totalTokens,a=u.totalUsage.estimatedCostUsd??0,m=u.optimizationStats.tokensSaved,d=r>0?a/r:0,h=m*d;c={totalTokens:r,totalCostUsd:a,savedTokens:m,savedCostUsd:h}}let e=c.totalTokens??0,t=c.totalCostUsd??0,n=c.savedTokens??0,i=c.savedCostUsd??0,s=c.budgetLimitUsd;if(e===0&&n===0)return"Token Dashboard: No data available";let o=`Token Usage: ${F(e)} tokens ($${t.toFixed(2)})`;n>0&&(o+=` | Saved: ${F(n)} tokens ($${i.toFixed(2)}) via pattern reuse`);let l=[];if(s!==void 0&&s>0){let u=Math.round(t/s*100);l.push(`Budget: $${t.toFixed(2)} / $${s.toFixed(2)} (${u}%)`)}if(c.tierSplit&&Object.keys(c.tierSplit).length>0){let u=Object.entries(c.tierSplit).sort((r,a)=>a[1]-r[1]).map(([r,a])=>`${r} ${a}%`);l.push(`Tier split: ${u.join(" | ")}`)}return l.length===0?o:`${o}
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.9");process.exit(0)}
2
+ import{a as A}from"./chunk-NQ3WHTLT.js";import{a as z}from"./chunk-3FAEM5M7.js";import{k as _,n as Q,o as U}from"./chunk-MUIJVPGB.js";import{d as P,e as B}from"./chunk-UEKDDUGV.js";import{b as w,d as K}from"./chunk-MWZN4PYF.js";import{a as p,c as R}from"./chunk-BVOGMK6N.js";import{g as N}from"./chunk-UYKIPSRX.js";U();R();K();B();import{randomUUID as I}from"crypto";var D=P("TokenTracker"),O={costPerInputToken:.003/1e3,costPerOutputToken:.015/1e3},j={filePath:".agentic-qe/token-metrics.json",autoSaveIntervalMs:6e4,maxMetricsInMemory:1e4},S=class c{taskMetrics=[];agentMetrics=new Map;domainMetrics=new Map;sessionId;sessionStartTime;costConfig;cacheHits=0;earlyExits=0;totalTokensSaved=0;totalPatternsReused=0;initialized=!1;persistenceConfig=j;autoSaveTimer=null;isDirty=!1;db=null;kvPersistCount=0;static KV_NAMESPACE="token-usage-metrics";static KV_KEY="token-tracker-snapshot";static KV_TTL=604800;static KV_PERSIST_INTERVAL=10;constructor(){this.sessionId=`session-${Date.now()}-${I().substring(0,8)}`,this.sessionStartTime=Date.now(),this.costConfig=O}initialize(e){this.initialized||(this.initialized=!0,e&&(this.costConfig={...O,...e}),this.initializeDb().catch(t=>{D.warn("DB initialization failed",{error:t instanceof Error?t.message:String(t)})}),this.startAutoSave())}setCostConfig(e){this.costConfig={...this.costConfig,...e}}recordTokenUsage(e,t,n,i,s,o){this.ensureInitialized();let l,u,r,a,m,d;typeof t=="object"?(l="default",u="unknown",r="unknown",a=t,m=!1,d=0):(l=t,u=n??"unknown",r=i??"unknown",a=s,m=o?.patternReused??!1,d=o?.tokensSaved??0),a.estimatedCostUsd===void 0&&(a.estimatedCostUsd=this.calculateCost(a));let h={taskId:e,agentId:l,domain:u,operation:r,timestamp:Date.now(),usage:a,patternReused:m,tokensSaved:d};this.taskMetrics.push(h),this.updateAgentMetrics(l,a,m,d),this.updateDomainMetrics(u,a),m&&this.totalPatternsReused++,d>0&&(this.totalTokensSaved+=d),this.isDirty=!0,this.maybePersistToKv()}recordPatternReuse(e,t){this.ensureInitialized(),this.totalPatternsReused++,this.totalTokensSaved+=t;let n={taskId:e,agentId:"pattern-cache",domain:"optimization",operation:"pattern-reuse",timestamp:Date.now(),usage:{inputTokens:0,outputTokens:0,totalTokens:0,estimatedCostUsd:0},patternReused:!0,tokensSaved:t};this.taskMetrics.push(n),this.isDirty=!0}recordCacheHit(e){this.cacheHits++,this.totalTokensSaved+=e,this.isDirty=!0}recordEarlyExit(e){this.earlyExits++,this.totalTokensSaved+=e,this.isDirty=!0}getSessionSummary(e){this.ensureInitialized();let t=this.filterByTimeframe(this.taskMetrics,e),n=this.aggregateTokenUsage(t),i=new Map;for(let r of t){let a=i.get(r.agentId);a?(a.totalInputTokens+=r.usage.inputTokens,a.totalOutputTokens+=r.usage.outputTokens,a.totalTokens+=r.usage.totalTokens,a.totalCost+=r.usage.estimatedCostUsd||0,a.tasksExecuted++,r.patternReused&&a.patternsReused++,a.estimatedTokensSaved+=r.tokensSaved||0):i.set(r.agentId,{agentId:r.agentId,totalInputTokens:r.usage.inputTokens,totalOutputTokens:r.usage.outputTokens,totalTokens:r.usage.totalTokens,totalCost:r.usage.estimatedCostUsd||0,tasksExecuted:1,patternsReused:r.patternReused?1:0,estimatedTokensSaved:r.tokensSaved||0})}let s=new Map;for(let r of t){let a=s.get(r.domain);a?(a.inputTokens+=r.usage.inputTokens,a.outputTokens+=r.usage.outputTokens,a.totalTokens+=r.usage.totalTokens,a.estimatedCostUsd=(a.estimatedCostUsd||0)+(r.usage.estimatedCostUsd||0)):s.set(r.domain,{...r.usage})}let o=n.totalTokens,l=this.totalTokensSaved,u=o+l>0?l/(o+l)*100:0;return{sessionId:this.sessionId,startTime:this.sessionStartTime,endTime:Date.now(),byAgent:i,byDomain:s,totalUsage:n,optimizationStats:{patternsReused:this.totalPatternsReused,cacheHits:this.cacheHits,earlyExits:this.earlyExits,tokensSaved:this.totalTokensSaved,savingsPercentage:Math.round(u*100)/100}}}getAgentMetrics(e,t){this.ensureInitialized();let n=this.filterByTimeframe(this.taskMetrics,t);if(e){let s=n.filter(o=>o.agentId===e);return this.aggregateAgentMetrics(e,s)}let i=new Map;for(let s of n){let o=i.get(s.agentId)||[];o.push(s),i.set(s.agentId,o)}return Array.from(i.entries()).map(([s,o])=>this.aggregateAgentMetrics(s,o))}getDomainMetrics(e,t){this.ensureInitialized();let n=this.filterByTimeframe(this.taskMetrics,t);if(e){let s=n.filter(o=>o.domain===e);return this.aggregateTokenUsage(s)}let i=new Map;for(let s of n){let o=i.get(s.domain);o?(o.inputTokens+=s.usage.inputTokens,o.outputTokens+=s.usage.outputTokens,o.totalTokens+=s.usage.totalTokens,o.estimatedCostUsd=(o.estimatedCostUsd||0)+(s.usage.estimatedCostUsd||0)):i.set(s.domain,{...s.usage})}return i}getTaskMetrics(e){return this.ensureInitialized(),this.filterByTimeframe(this.taskMetrics,e)}getEfficiencyReport(e){return this.getTokenEfficiency(e)}getTokenEfficiency(e){this.ensureInitialized();let t=this.filterByTimeframe(this.taskMetrics,e),i=this.aggregateTokenUsage(t).totalTokens,s=this.totalTokensSaved,o=i+s>0?s/(i+s)*100:0,l=t.length,u=l>0?t.filter(m=>m.patternReused).length/l:0,r=l>0?i/l:0,a=this.generateRecommendations(t);return{totalTokensUsed:i,totalTokensSaved:s,savingsPercentage:Math.round(o*100)/100,patternReuseRate:Math.round(u*100)/100,averageTokensPerTask:Math.round(r),recommendations:a}}reset(){this.stopAutoSave(),this.taskMetrics=[],this.agentMetrics.clear(),this.domainMetrics.clear(),this.sessionId=`session-${Date.now()}-${I().substring(0,8)}`,this.sessionStartTime=Date.now(),this.cacheHits=0,this.earlyExits=0,this.totalTokensSaved=0,this.totalPatternsReused=0,this.isDirty=!1}configurePersistence(e){this.persistenceConfig={...this.persistenceConfig,...e},e.autoSaveIntervalMs!==void 0&&(this.stopAutoSave(),e.autoSaveIntervalMs>0&&this.startAutoSave())}startAutoSave(){this.autoSaveTimer||this.persistenceConfig.autoSaveIntervalMs>0&&(this.autoSaveTimer=setInterval(()=>{this.isDirty&&this.save().catch(e=>{console.warn("[TokenMetricsCollector] Auto-save failed:",e)})},this.persistenceConfig.autoSaveIntervalMs))}stopAutoSave(){this.autoSaveTimer&&(clearInterval(this.autoSaveTimer),this.autoSaveTimer=null)}async save(){let e=await import("fs"),t=await import("path"),n={version:"1.0.0",sessionId:this.sessionId,sessionStartTime:this.sessionStartTime,taskMetrics:this.taskMetrics.slice(-this.persistenceConfig.maxMetricsInMemory),optimizationStats:{cacheHits:this.cacheHits,earlyExits:this.earlyExits,totalTokensSaved:this.totalTokensSaved,totalPatternsReused:this.totalPatternsReused},lastSavedAt:Date.now()},i=t.resolve(this.persistenceConfig.filePath),s=t.dirname(i);e.existsSync(s)||e.mkdirSync(s,{recursive:!0}),e.writeFileSync(i,JSON.stringify(n,null,2)),this.isDirty=!1}async load(){let e=await import("fs"),n=(await import("path")).resolve(this.persistenceConfig.filePath);if(!e.existsSync(n))return!1;try{let i=e.readFileSync(n,"utf-8"),s=w(i);if(!s.version||!s.version.startsWith("1."))return console.warn("[TokenMetricsCollector] Incompatible data version, skipping load"),!1;let o=s.taskMetrics||[];this.taskMetrics=[...o,...this.taskMetrics],this.cacheHits+=s.optimizationStats?.cacheHits||0,this.earlyExits+=s.optimizationStats?.earlyExits||0,this.totalTokensSaved+=s.optimizationStats?.totalTokensSaved||0,this.totalPatternsReused+=s.optimizationStats?.totalPatternsReused||0;for(let l of o)this.updateAgentMetrics(l.agentId,l.usage,l.patternReused,l.tokensSaved||0),this.updateDomainMetrics(l.domain,l.usage);return this.taskMetrics.length>this.persistenceConfig.maxMetricsInMemory&&(this.taskMetrics=this.taskMetrics.slice(-this.persistenceConfig.maxMetricsInMemory)),!0}catch(i){return console.warn("[TokenMetricsCollector] Failed to load persisted data:",i),!1}}getPersistenceFilePath(){return this.persistenceConfig.filePath}hasUnsavedChanges(){return this.isDirty}async initializeDb(){try{this.db=_(),this.db.isInitialized()||await this.db.initialize(),await this.loadFromKv()}catch(e){console.warn("[TokenMetricsCollector] DB init failed, using memory-only:",p(e)),this.db=null}}async persistToKv(){if(!this.db)return;let e={version:"1.0.0",sessionId:this.sessionId,sessionStartTime:this.sessionStartTime,taskMetrics:this.taskMetrics.slice(-this.persistenceConfig.maxMetricsInMemory),optimizationStats:{cacheHits:this.cacheHits,earlyExits:this.earlyExits,totalTokensSaved:this.totalTokensSaved,totalPatternsReused:this.totalPatternsReused},lastSavedAt:Date.now()};await this.db.kvSet(c.KV_KEY,e,c.KV_NAMESPACE,c.KV_TTL)}async loadFromKv(){if(!this.db)return!1;let e=await this.db.kvGet(c.KV_KEY,c.KV_NAMESPACE);if(!e)return!1;if(!e.version||!e.version.startsWith("1."))return console.warn("[TokenMetricsCollector] Incompatible kv_store data version, skipping load"),!1;let t=e.taskMetrics||[];this.taskMetrics=[...t,...this.taskMetrics],this.cacheHits+=e.optimizationStats?.cacheHits||0,this.earlyExits+=e.optimizationStats?.earlyExits||0,this.totalTokensSaved+=e.optimizationStats?.totalTokensSaved||0,this.totalPatternsReused+=e.optimizationStats?.totalPatternsReused||0;for(let n of t)this.updateAgentMetrics(n.agentId,n.usage,n.patternReused,n.tokensSaved||0),this.updateDomainMetrics(n.domain,n.usage);return this.taskMetrics.length>this.persistenceConfig.maxMetricsInMemory&&(this.taskMetrics=this.taskMetrics.slice(-this.persistenceConfig.maxMetricsInMemory)),!0}maybePersistToKv(){this.kvPersistCount++,this.kvPersistCount>=c.KV_PERSIST_INTERVAL&&(this.kvPersistCount=0,this.persistToKv().catch(e=>{D.warn("KV persist failed",{error:e instanceof Error?e.message:String(e)})}))}ensureInitialized(){this.initialized||this.initialize()}calculateCost(e){let t=e.inputTokens*this.costConfig.costPerInputToken,n=e.outputTokens*this.costConfig.costPerOutputToken;return Math.round((t+n)*1e5)/1e5}filterByTimeframe(e,t){if(!t)return e;let n=Date.now(),i;switch(t){case"1h":i=n-3600*1e3;break;case"24h":i=n-1440*60*1e3;break;case"7d":i=n-10080*60*1e3;break;case"30d":i=n-720*60*60*1e3;break;default:return e}return e.filter(s=>s.timestamp>=i)}aggregateTokenUsage(e){let t=0,n=0,i=0,s=0;for(let o of e)t+=o.usage.inputTokens,n+=o.usage.outputTokens,i+=o.usage.totalTokens,s+=o.usage.estimatedCostUsd||0;return{inputTokens:t,outputTokens:n,totalTokens:i,estimatedCostUsd:Math.round(s*1e5)/1e5}}aggregateAgentMetrics(e,t){let n=0,i=0,s=0,o=0,l=0,u=0;for(let r of t)n+=r.usage.inputTokens,i+=r.usage.outputTokens,s+=r.usage.totalTokens,o+=r.usage.estimatedCostUsd||0,r.patternReused&&l++,u+=r.tokensSaved||0;return{agentId:e,totalInputTokens:n,totalOutputTokens:i,totalTokens:s,totalCost:Math.round(o*1e5)/1e5,tasksExecuted:t.length,patternsReused:l,estimatedTokensSaved:u}}updateAgentMetrics(e,t,n,i){let s=this.agentMetrics.get(e);s?(s.totalInputTokens+=t.inputTokens,s.totalOutputTokens+=t.outputTokens,s.totalTokens+=t.totalTokens,s.totalCost+=t.estimatedCostUsd||0,s.tasksExecuted++,n&&s.patternsReused++,s.estimatedTokensSaved+=i):this.agentMetrics.set(e,{agentId:e,totalInputTokens:t.inputTokens,totalOutputTokens:t.outputTokens,totalTokens:t.totalTokens,totalCost:t.estimatedCostUsd||0,tasksExecuted:1,patternsReused:n?1:0,estimatedTokensSaved:i})}updateDomainMetrics(e,t){let n=this.domainMetrics.get(e);n?(n.inputTokens+=t.inputTokens,n.outputTokens+=t.outputTokens,n.totalTokens+=t.totalTokens,n.estimatedCostUsd=(n.estimatedCostUsd||0)+(t.estimatedCostUsd||0)):this.domainMetrics.set(e,{...t})}generateRecommendations(e){let t=[];if(e.length===0)return["No token usage data available yet. Start executing tasks to track consumption."];let n=e.filter(r=>r.patternReused).length/e.length;n<.2?t.push("Low pattern reuse rate detected. Consider enabling pattern caching for similar tasks."):n>.5&&t.push("Good pattern reuse rate. Continue leveraging cached patterns for token savings.");let i=new Map;for(let r of e){let a=i.get(r.domain)||0;i.set(r.domain,a+r.usage.totalTokens)}let s=Array.from(i.entries()).sort((r,a)=>a[1]-r[1]);if(s.length>0){let r=s[0];t.push(`Highest token consumer: ${r[0]} (${r[1].toLocaleString()} tokens). Consider optimizing prompts or increasing caching.`)}let o=e.reduce((r,a)=>r+a.usage.inputTokens,0);return e.reduce((r,a)=>r+a.usage.outputTokens,0)/(o||1)>2&&t.push("High output-to-input token ratio. Consider requesting more concise responses."),this.cacheHits===0&&e.length>10&&t.push("No cache hits detected. Enable response caching to reduce duplicate API calls."),this.earlyExits===0&&e.length>20&&t.push("Early exit optimization not utilized. Enable high-confidence pattern matching to skip unnecessary LLM calls."),t}};function F(c){return c.toLocaleString("en-US")}function $(c){if(process.env.AQE_TOKEN_DASHBOARD_ENABLED==="false")return"Token dashboard disabled (AQE_TOKEN_DASHBOARD_ENABLED=false)";if(!c){let u=g.getSessionSummary(),r=u.totalUsage.totalTokens,a=u.totalUsage.estimatedCostUsd??0,m=u.optimizationStats.tokensSaved,d=r>0?a/r:0,h=m*d;c={totalTokens:r,totalCostUsd:a,savedTokens:m,savedCostUsd:h}}let e=c.totalTokens??0,t=c.totalCostUsd??0,n=c.savedTokens??0,i=c.savedCostUsd??0,s=c.budgetLimitUsd;if(e===0&&n===0)return"Token Dashboard: No data available";let o=`Token Usage: ${F(e)} tokens ($${t.toFixed(2)})`;n>0&&(o+=` | Saved: ${F(n)} tokens ($${i.toFixed(2)}) via pattern reuse`);let l=[];if(s!==void 0&&s>0){let u=Math.round(t/s*100);l.push(`Budget: $${t.toFixed(2)} / $${s.toFixed(2)} (${u}%)`)}if(c.tierSplit&&Object.keys(c.tierSplit).length>0){let u=Object.entries(c.tierSplit).sort((r,a)=>a[1]-r[1]).map(([r,a])=>`${r} ${a}%`);l.push(`Tier split: ${u.join(" | ")}`)}return l.length===0?o:`${o}
3
3
  ${l.join(" | ")}`}var g=new S;function te(c){return`$${c.toFixed(2)}`}import{createHash as V}from"crypto";var G={enabled:!0,maxEntries:500,ttlMs:3600*1e3,persistToDb:!0};function E(c){if(c==null||typeof c!="object")return JSON.stringify(c);if(Array.isArray(c))return"["+c.map(i=>E(i)).join(",")+"]";let e=c;return"{"+Object.keys(e).sort().map(i=>JSON.stringify(i)+":"+E(e[i])).join(",")+"}"}var b=class{cache=new Map;config;hits=0;misses=0;constructor(e){this.config={...G,...e}}computeFingerprint(e,t,n){let i=E({action:t,domain:e,input:n});return V("sha256").update(i).digest("hex").slice(0,16)}get(e){if(!this.config.enabled)return null;let t=this.cache.get(e);return t?Date.now()-t.cachedAt>this.config.ttlMs?(this.cache.delete(e),this.misses++,null):(t.hitCount++,t.lastHitAt=Date.now(),this.hits++,t):(this.misses++,null)}set(e,t,n,i,s){if(!this.config.enabled)return;this.cache.size>=this.config.maxEntries&&this.evictOldest();let o={fingerprint:e,domain:t,action:n,result:i,tokensSaved:s,cachedAt:Date.now(),hitCount:0,lastHitAt:0};this.cache.set(e,o),this.config.persistToDb&&this.persistEntry(o)}loadFromDb(){try{let e=H();if(!e)return;let t=Date.now()-this.config.ttlMs,n=e.prepare(`SELECT key, value FROM kv_store
4
4
  WHERE namespace = 'session_cache'
5
5
  AND created_at > ?
@@ -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.9.7");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.9.9");process.exit(0)}
2
2
  var h=class{executionHistory=[];learnedDurations=new Map;runCount=0;lastPrunedCount=0;learningRate;maxHistorySize;constructor(t){this.learningRate=t?.learningRate??.3,this.maxHistorySize=t?.maxHistorySize??1e4}buildTestDAG(t){let e=new Map,n=new Map;for(let i of t){let s=this.applyLearnedDuration(i);e.set(s.id,s),n.set(s.id,[])}for(let i of t)for(let s of i.dependencies){if(!e.has(s))throw new Error(`Test '${i.id}' depends on '${s}' which does not exist in the test set`);n.get(s).push(i.id)}let o=this.computeCriticalPath(e,n),a=this.computeParallelGroups(e,n);return{nodes:e,edges:n,criticalPath:o,parallelGroups:a}}findCriticalPath(t){return t.criticalPath.map(e=>t.nodes.get(e)).filter(e=>e!==void 0)}findParallelBranches(t){return t.parallelGroups.map(e=>e.map(n=>t.nodes.get(n)).filter(n=>n!==void 0))}pruneByMinCut(t,e){let n=this.sumDurations(t.nodes);if(n<=e)return this.lastPrunedCount=0,t;let o=this.computeAttentionScores(t),a=Array.from(o.entries()).sort((r,l)=>r[1]-l[1]),i=new Set(t.criticalPath),s=new Set,c=n;for(let[r]of a){if(c<=e)break;if(i.has(r)||(t.edges.get(r)??[]).some(p=>!s.has(p)))continue;let d=t.nodes.get(r);d&&(s.add(r),c-=d.estimatedDuration)}this.lastPrunedCount=s.size;let u=Array.from(t.nodes.values()).filter(r=>!s.has(r.id));return this.buildTestDAG(u)}schedule(t){if(t.length===0)return{phases:[],totalEstimatedTime:0,criticalPathTime:0,parallelism:0};let e=this.buildTestDAG(t),o=this.findParallelBranches(e).map(u=>({tests:u,canRunInParallel:u.length>1})),a=this.computeCriticalPathDuration(e),i=this.sumDurations(e.nodes),s=o.reduce((u,r)=>r.canRunInParallel?u+Math.max(...r.tests.map(l=>l.estimatedDuration)):u+r.tests.reduce((l,d)=>l+d.estimatedDuration,0),0),c=s>0?i/s:1;return this.runCount++,{phases:o,totalEstimatedTime:s,criticalPathTime:a,parallelism:c}}getOptimizationStats(){return{totalTests:0,criticalPathLength:0,parallelGroupCount:0,prunedTests:this.lastPrunedCount,estimatedTimeSaved:0,historicalRuns:this.runCount,usingNativeBackend:!1}}recordExecution(t,e,n){this.executionHistory.push({testId:t,actualDuration:e,result:n,timestamp:Date.now()}),this.executionHistory.length>this.maxHistorySize&&(this.executionHistory=this.executionHistory.slice(-this.maxHistorySize));let o=this.learnedDurations.get(t);o!==void 0?this.learnedDurations.set(t,o*(1-this.learningRate)+e*this.learningRate):this.learnedDurations.set(t,e)}getLearnedDuration(t){return this.learnedDurations.get(t)}isNativeBackendAvailable(){return!1}computeCriticalPath(t,e){let n=this.topologicalSort(t,e);if(n.length===0)return[];let o=new Map,a=new Map;for(let r of n)o.set(r,t.get(r).estimatedDuration),a.set(r,null);for(let r of n){let l=o.get(r);for(let d of e.get(r)??[]){let p=t.get(d);if(!p)continue;let g=l+p.estimatedDuration;g>(o.get(d)??0)&&(o.set(d,g),a.set(d,r))}}let i=0,s=null;for(let[r,l]of o)l>i&&(i=l,s=r);if(!s)return[];let c=[],u=s;for(;u!==null;)c.unshift(u),u=a.get(u)??null;return c}computeCriticalPathDuration(t){return t.criticalPath.reduce((e,n)=>e+(t.nodes.get(n)?.estimatedDuration??0),0)}computeParallelGroups(t,e){let n=this.topologicalSort(t,e);if(n.length===0)return[];let o=new Map;for(let[u,r]of t)o.set(u,new Set(r.dependencies));let a=new Map;for(let u of n){let r=-1;for(let l of o.get(u)??new Set){let d=a.get(l);d!==void 0&&d>r&&(r=d)}a.set(u,r+1)}let i=new Map;for(let u of n){let r=a.get(u)??0;i.has(r)||i.set(r,[]),i.get(r).push(u)}let s=Math.max(...Array.from(i.keys()),-1),c=[];for(let u=0;u<=s;u++){let r=i.get(u);r&&r.length>0&&c.push(r)}return c}computeAttentionScores(t){let e=new Map,n=this.countTransitiveDependents(t);for(let[o,a]of t.nodes){let i=a.lastResult==="fail"?2:1,s=n.get(o)??0;e.set(o,a.priority*i*(1+s))}return e}countTransitiveDependents(t){let e=new Map,n=new Map,o=a=>{if(n.has(a))return n.get(a);let i=new Set;for(let s of t.edges.get(a)??[]){i.add(s);for(let c of o(s))i.add(c)}return n.set(a,i),i};for(let a of t.nodes.keys())e.set(a,o(a).size);return e}topologicalSort(t,e){let n=new Map;for(let i of t.keys())n.set(i,0);for(let i of e.values())for(let s of i)n.has(s)&&n.set(s,(n.get(s)??0)+1);let o=[];for(let[i,s]of n)s===0&&o.push(i);let a=[];for(;o.length>0;){let i=o.shift();a.push(i);for(let s of e.get(i)??[]){let c=(n.get(s)??0)-1;n.set(s,c),c===0&&o.push(s)}}if(a.length!==t.size)throw new Error(`Cycle detected in test DAG: sorted ${a.length} of ${t.size} nodes`);return a}applyLearnedDuration(t){let e=this.learnedDurations.get(t.id);return e!==void 0?{...t,estimatedDuration:Math.round(e)}:t}sumDurations(t){let e=0;for(let n of t.values())e+=n.estimatedDuration;return e}};function m(f){return new h(f)}export{h as a,m 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.9.7");process.exit(0)}
2
- import{a as F,c as D}from"./chunk-MR7V7QVL.js";import{d as $}from"./chunk-JZYCZMHN.js";$();D();var b=null,l=null,d=null,g=!1,f="",h={modelName:"Xenova/all-MiniLM-L6-v2",quantized:!0,enableCache:!0,maxCacheSize:1e4},o=new Map,P=36e5;function I(t){let e=t.trim();return!!(e.startsWith("{")&&/["']metrics["']/.test(e)||e.startsWith("[")&&e.endsWith("]")&&e.length>50||(e.match(/[a-zA-Z]/g)||[]).length/Math.max(e.length,1)<.3&&e.length>20)}async function A(t={}){if(g)throw new Error(`Transformer initialization previously failed: ${f}`);if(d)return d;let e={...h,...t};return d=(async()=>{try{b=(await import("./transformers-UNRYJSIU.js")).pipeline,console.log(`[RealEmbeddings] Loading model: ${e.modelName}`);let a=performance.now();l=await b("feature-extraction",e.modelName,{quantized:e.quantized});let s=performance.now()-a;console.log(`[RealEmbeddings] Model loaded in ${s.toFixed(0)}ms`)}catch(r){throw g=!0,f=F(r),new Error(`Failed to initialize transformer model: ${f}`)}})(),d}async function q(t,e={}){let r={...h,...e};if(I(t))return new Array(N()).fill(0);if(r.enableCache){let i=o.get(t);if(i&&Date.now()-i.timestamp<P)return i.embedding}if(l||await A(e),!l)throw new Error("Embedding model failed to initialize");let a=performance.now(),s=await l(t,{pooling:"mean",normalize:!0}),m=Array.from(s.data),n=performance.now()-a;if(n>500&&console.warn(`[RealEmbeddings] Slow embedding computation: ${n.toFixed(1)}ms for "${t.slice(0,50)}..."`),r.enableCache){if(o.size>=r.maxCacheSize){let i=o.keys().next().value;i&&o.delete(i)}o.set(t,{embedding:m,timestamp:Date.now()})}return m}async function B(t,e={}){let r={...h,...e},a=[],s=[],m=new Array(t.length).fill(null);if(r.enableCache)for(let n=0;n<t.length;n++){let i=o.get(t[n]);i&&Date.now()-i.timestamp<P?m[n]=i.embedding:(a.push(t[n]),s.push(n))}else{a.push(...t);for(let n=0;n<t.length;n++)s.push(n)}if(a.length>0){if(l||await A(e),!l)throw new Error("Embedding model failed to initialize");let n=performance.now(),i=32;for(let c=0;c<a.length;c+=i){let M=Math.min(c+i,a.length),p=a.slice(c,M),E=await l(p,{pooling:"mean",normalize:!0}),w=E.dims||[p.length,384],R=w[0],C=w[1];for(let u=0;u<R;u++){let z=u*C,x=Array.from(E.data.slice(z,z+C)),y=c+u,v=s[y];if(m[v]=x,r.enableCache){if(o.size>=r.maxCacheSize){let T=o.keys().next().value;T&&o.delete(T)}o.set(a[y],{embedding:x,timestamp:Date.now()})}}}let S=performance.now()-n;console.log(`[RealEmbeddings] Batch computed ${a.length} embeddings in ${S.toFixed(0)}ms`)}return m.filter(n=>n!==null)}function O(){o.clear(),console.log("[RealEmbeddings] Cache cleared")}function W(){return{size:o.size,hitRate:0}}function k(){return!g&&l!==null}function N(){return 384}function G(){b=null,l=null,d=null,g=!1,f="",o.clear()}export{h as a,q as b,B as c,O as d,W as e,k as f,N as g,G as h};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.9");process.exit(0)}
2
+ import{a as F,c as D}from"./chunk-BVOGMK6N.js";import{d as $}from"./chunk-MXMKHI2I.js";$();D();var b=null,l=null,d=null,g=!1,f="",h={modelName:"Xenova/all-MiniLM-L6-v2",quantized:!0,enableCache:!0,maxCacheSize:1e4},o=new Map,P=36e5;function I(t){let e=t.trim();return!!(e.startsWith("{")&&/["']metrics["']/.test(e)||e.startsWith("[")&&e.endsWith("]")&&e.length>50||(e.match(/[a-zA-Z]/g)||[]).length/Math.max(e.length,1)<.3&&e.length>20)}async function A(t={}){if(g)throw new Error(`Transformer initialization previously failed: ${f}`);if(d)return d;let e={...h,...t};return d=(async()=>{try{b=(await import("./transformers-U3TSLEGO.js")).pipeline,console.log(`[RealEmbeddings] Loading model: ${e.modelName}`);let a=performance.now();l=await b("feature-extraction",e.modelName,{quantized:e.quantized});let s=performance.now()-a;console.log(`[RealEmbeddings] Model loaded in ${s.toFixed(0)}ms`)}catch(r){throw g=!0,f=F(r),new Error(`Failed to initialize transformer model: ${f}`)}})(),d}async function q(t,e={}){let r={...h,...e};if(I(t))return new Array(N()).fill(0);if(r.enableCache){let i=o.get(t);if(i&&Date.now()-i.timestamp<P)return i.embedding}if(l||await A(e),!l)throw new Error("Embedding model failed to initialize");let a=performance.now(),s=await l(t,{pooling:"mean",normalize:!0}),m=Array.from(s.data),n=performance.now()-a;if(n>500&&console.warn(`[RealEmbeddings] Slow embedding computation: ${n.toFixed(1)}ms for "${t.slice(0,50)}..."`),r.enableCache){if(o.size>=r.maxCacheSize){let i=o.keys().next().value;i&&o.delete(i)}o.set(t,{embedding:m,timestamp:Date.now()})}return m}async function B(t,e={}){let r={...h,...e},a=[],s=[],m=new Array(t.length).fill(null);if(r.enableCache)for(let n=0;n<t.length;n++){let i=o.get(t[n]);i&&Date.now()-i.timestamp<P?m[n]=i.embedding:(a.push(t[n]),s.push(n))}else{a.push(...t);for(let n=0;n<t.length;n++)s.push(n)}if(a.length>0){if(l||await A(e),!l)throw new Error("Embedding model failed to initialize");let n=performance.now(),i=32;for(let c=0;c<a.length;c+=i){let M=Math.min(c+i,a.length),p=a.slice(c,M),E=await l(p,{pooling:"mean",normalize:!0}),w=E.dims||[p.length,384],R=w[0],C=w[1];for(let u=0;u<R;u++){let z=u*C,x=Array.from(E.data.slice(z,z+C)),y=c+u,v=s[y];if(m[v]=x,r.enableCache){if(o.size>=r.maxCacheSize){let T=o.keys().next().value;T&&o.delete(T)}o.set(a[y],{embedding:x,timestamp:Date.now()})}}}let S=performance.now()-n;console.log(`[RealEmbeddings] Batch computed ${a.length} embeddings in ${S.toFixed(0)}ms`)}return m.filter(n=>n!==null)}function O(){o.clear(),console.log("[RealEmbeddings] Cache cleared")}function W(){return{size:o.size,hitRate:0}}function k(){return!g&&l!==null}function N(){return 384}function G(){b=null,l=null,d=null,g=!1,f="",o.clear()}export{h as a,q as b,B as c,O as d,W as e,k as f,N as g,G as h};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.7");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.9.9");process.exit(0)}
2
2
  import T from"crypto";var h=new Uint8Array(256),y=h.length;function s(){return y>h.length-16&&(T.randomFillSync(h),y=0),h.slice(y,y+=16)}var A=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function q(r){return typeof r=="string"&&A.test(r)}var u=q;var o=[];for(let r=0;r<256;++r)o.push((r+256).toString(16).slice(1));function p(r,e=0){return o[r[e+0]]+o[r[e+1]]+o[r[e+2]]+o[r[e+3]]+"-"+o[r[e+4]]+o[r[e+5]]+"-"+o[r[e+6]]+o[r[e+7]]+"-"+o[r[e+8]]+o[r[e+9]]+"-"+o[r[e+10]]+o[r[e+11]]+o[r[e+12]]+o[r[e+13]]+o[r[e+14]]+o[r[e+15]]}function N(r,e=0){let t=p(r,e);if(!u(t))throw TypeError("Stringified UUID is invalid");return t}var _=N;var E,U,I=0,w=0;function R(r,e,t){let n=e&&t||0,f=e||new Array(16);r=r||{};let d=r.node||E,l=r.clockseq!==void 0?r.clockseq:U;if(d==null||l==null){let a=r.random||(r.rng||s)();d==null&&(d=E=[a[0]|1,a[1],a[2],a[3],a[4],a[5]]),l==null&&(l=U=(a[6]<<8|a[7])&16383)}let c=r.msecs!==void 0?r.msecs:Date.now(),x=r.nsecs!==void 0?r.nsecs:w+1,i=c-I+(x-w)/1e4;if(i<0&&r.clockseq===void 0&&(l=l+1&16383),(i<0||c>I)&&r.nsecs===void 0&&(x=0),x>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");I=c,w=x,U=l,c+=122192928e5;let m=((c&268435455)*1e4+x)%4294967296;f[n++]=m>>>24&255,f[n++]=m>>>16&255,f[n++]=m>>>8&255,f[n++]=m&255;let v=c/4294967296*1e4&268435455;f[n++]=v>>>8&255,f[n++]=v&255,f[n++]=v>>>24&15|16,f[n++]=v>>>16&255,f[n++]=l>>>8|128,f[n++]=l&255;for(let a=0;a<6;++a)f[n+a]=d[a];return e||p(f)}var C=R;function H(r){if(!u(r))throw TypeError("Invalid UUID");let e,t=new Uint8Array(16);return t[0]=(e=parseInt(r.slice(0,8),16))>>>24,t[1]=e>>>16&255,t[2]=e>>>8&255,t[3]=e&255,t[4]=(e=parseInt(r.slice(9,13),16))>>>8,t[5]=e&255,t[6]=(e=parseInt(r.slice(14,18),16))>>>8,t[7]=e&255,t[8]=(e=parseInt(r.slice(19,23),16))>>>8,t[9]=e&255,t[10]=(e=parseInt(r.slice(24,36),16))/1099511627776&255,t[11]=e/4294967296&255,t[12]=e>>>24&255,t[13]=e>>>16&255,t[14]=e>>>8&255,t[15]=e&255,t}var D=H;function L(r){r=unescape(encodeURIComponent(r));let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t));return e}var M="6ba7b810-9dad-11d1-80b4-00c04fd430c8",P="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function g(r,e,t){function n(f,d,l,c){var x;if(typeof f=="string"&&(f=L(f)),typeof d=="string"&&(d=D(d)),((x=d)===null||x===void 0?void 0:x.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let i=new Uint8Array(16+f.length);if(i.set(d),i.set(f,d.length),i=t(i),i[6]=i[6]&15|e,i[8]=i[8]&63|128,l){c=c||0;for(let m=0;m<16;++m)l[c+m]=i[m];return l}return p(i)}try{n.name=r}catch{}return n.DNS=M,n.URL=P,n}import F from"crypto";function G(r){return Array.isArray(r)?r=Buffer.from(r):typeof r=="string"&&(r=Buffer.from(r,"utf8")),F.createHash("md5").update(r).digest()}var k=G;var X=g("v3",48,k),$=X;import j from"crypto";var S={randomUUID:j.randomUUID};function z(r,e,t){if(S.randomUUID&&!e&&!r)return S.randomUUID();r=r||{};let n=r.random||(r.rng||s)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let f=0;f<16;++f)e[t+f]=n[f];return e}return p(n)}var J=z;import K from"crypto";function O(r){return Array.isArray(r)?r=Buffer.from(r):typeof r=="string"&&(r=Buffer.from(r,"utf8")),K.createHash("sha1").update(r).digest()}var B=O;var Q=g("v5",80,B),V=Q;var W="00000000-0000-0000-0000-000000000000";function Y(r){if(!u(r))throw TypeError("Invalid UUID");return parseInt(r.slice(14,15),16)}var Z=Y;export{u as a,_ as b,C as c,D as d,$ as e,J as f,V as g,W as h,Z as i};
@@ -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.9.7");process.exit(0)}
2
- import{d as s}from"./chunk-WLYSZV5U.js";s();
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.9.9");process.exit(0)}
2
+ import{d as s}from"./chunk-MWZN4PYF.js";s();
@@ -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.9.7");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.9.9");process.exit(0)}
2
2
  var p={"||":1,"&&":2,"===":3,"!==":3,"==":3,"!=":3,"<":4,">":4,"<=":4,">=":4,"+":5,"-":5,"*":6,"/":6,"%":6},l=new Set(Object.keys(p)),w=new Set(["!","-","+"]);function h(r){let n=[],e=0;for(;e<r.length;){let t=r[e];if(/\s/.test(t)){e++;continue}if(/\d/.test(t)||t==="."&&/\d/.test(r[e+1])){let s="";for(;e<r.length&&/[\d.]/.test(r[e]);)s+=r[e++];n.push({type:"NUMBER",value:parseFloat(s),raw:s});continue}if(t==='"'||t==="'"){let s=t,u="";for(e++;e<r.length&&r[e]!==s;){if(r[e]==="\\"&&e+1<r.length){e++;let c=r[e];switch(c){case"n":u+=`
3
3
  `;break;case"t":u+=" ";break;case"r":u+="\r";break;default:u+=c}}else u+=r[e];e++}e++,n.push({type:"STRING",value:u,raw:`${s}${u}${s}`});continue}if(/[a-zA-Z_$]/.test(t)){let s="";for(;e<r.length&&/[a-zA-Z0-9_$]/.test(r[e]);)s+=r[e++];s==="true"?n.push({type:"BOOLEAN",value:!0,raw:s}):s==="false"?n.push({type:"BOOLEAN",value:!1,raw:s}):s==="null"?n.push({type:"NULL",value:null,raw:s}):s==="undefined"?n.push({type:"UNDEFINED",value:void 0,raw:s}):n.push({type:"IDENTIFIER",value:s,raw:s});continue}let a=r.slice(e,e+2),o=r.slice(e,e+3);if(o==="==="||o==="!=="){n.push({type:"OPERATOR",value:o,raw:o}),e+=3;continue}if(a==="=="||a==="!="||a==="<="||a===">="||a==="&&"||a==="||"){n.push({type:"OPERATOR",value:a,raw:a}),e+=2;continue}if(t==="("){n.push({type:"LPAREN",value:"(",raw:"("}),e++;continue}if(t===")"){n.push({type:"RPAREN",value:")",raw:")"}),e++;continue}if(t==="."){n.push({type:"DOT",value:".",raw:"."}),e++;continue}if("+-*/%<>!".includes(t)){n.push({type:"OPERATOR",value:t,raw:t}),e++;continue}throw new Error(`Unexpected character at position ${e}: ${t}`)}return n.push({type:"EOF",value:"",raw:""}),n}var i=class{tokens;pos=0;context;constructor(n,e){this.tokens=n,this.context=e}current(){return this.tokens[this.pos]}advance(){return this.tokens[this.pos++]}expect(n){let e=this.current();if(e.type!==n)throw new Error(`Expected ${n}, got ${e.type}`);return this.advance()}parse(){let n=this.parseExpression(0);if(this.current().type!=="EOF")throw new Error(`Unexpected token: ${this.current().raw}`);return n}parseExpression(n){let e=this.parseUnary();for(;;){let t=this.current();if(t.type!=="OPERATOR"||!l.has(t.value))break;let a=p[t.value];if(a<n)break;let o=this.advance().value,s=this.parseExpression(a+1);e=this.applyBinaryOperator(o,e,s)}return e}parseUnary(){let n=this.current();if(n.type==="OPERATOR"&&w.has(n.value)){let e=this.advance().value,t=this.parseUnary();return this.applyUnaryOperator(e,t)}return this.parsePrimary()}parsePrimary(){let n=this.current();switch(n.type){case"NUMBER":case"STRING":case"BOOLEAN":case"NULL":case"UNDEFINED":return this.advance(),n.value;case"IDENTIFIER":return this.parseIdentifier();case"LPAREN":this.advance();let e=this.parseExpression(0);return this.expect("RPAREN"),e;default:throw new Error(`Unexpected token: ${n.raw}`)}}parseIdentifier(){let n=this.context,e=this.advance().value;for(typeof n=="object"&&n!==null&&(e in n)?n=n[e]:n=void 0;this.current().type==="DOT";){this.advance();let t=this.expect("IDENTIFIER").value;n!=null&&typeof n=="object"?n=n[t]:n=void 0}return n}applyBinaryOperator(n,e,t){switch(n){case"===":return e===t;case"!==":return e!==t;case"==":return e==t;case"!=":return e!=t;case"<":return e<t;case">":return e>t;case"<=":return e<=t;case">=":return e>=t;case"&&":return e&&t;case"||":return e||t;case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return e/t;case"%":return e%t;default:throw new Error(`Unknown operator: ${n}`)}}applyUnaryOperator(n,e){switch(n){case"!":return!e;case"-":return-e;case"+":return+e;default:throw new Error(`Unknown unary operator: ${n}`)}}};function E(r,n={}){if(!r||typeof r!="string")throw new Error("Expression must be a non-empty string");let e=[/\beval\b/i,/\bFunction\b/,/\bconstructor\b/,/\b__proto__\b/,/\bprototype\b/,/\bimport\b/,/\brequire\b/,/\bprocess\b/,/\bglobal\b/,/\bwindow\b/,/\bdocument\b/,/\[\s*['"`]/,/\[.*\]/];for(let o of e)if(o.test(r))throw new Error(`Expression contains potentially dangerous pattern: ${r}`);let t=h(r.trim());return new i(t,n).parse()}function b(r,n={},e=!1){try{return!!E(r,n)}catch(t){return console.warn(`[SafeEvaluator] Failed to evaluate expression: ${r}`,t),e}}export{b 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.9.7");process.exit(0)}
2
- import{b as A,d as M}from"./chunk-WLYSZV5U.js";import{a as S,b as D}from"./chunk-GGPGY5QT.js";import{S as Q,l as E}from"./chunk-WV3R5JFE.js";import{g as C}from"./chunk-UEFAPTBV.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.9.9");process.exit(0)}
2
+ import{b as A,d as M}from"./chunk-MWZN4PYF.js";import{a as S,b as D}from"./chunk-QTYTM7C7.js";import{S as Q,l as E}from"./chunk-NLKJI73E.js";import{g as C}from"./chunk-UYKIPSRX.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,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.9.7");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.9.9");process.exit(0)}
2
2
  import{createRequire as t}from"module";var o=t(import.meta.url),e=o("hnswlib-node"),i=e,{RuvectorLayer:r,TensorCompress:a,differentiableSearch:c,hierarchicalForward:l,getCompressionLevel:s,init:p,FlashAttention:d,DotProductAttention:m,MultiHeadAttention:u,HyperbolicAttention:A,LinearAttention:h,MoEAttention:f,SonaEngine:_,pipeline:b}=e||{};export{i as a,r as b,a as c,c as d,l as e,s as f,p as g,d as h,m as i,u as j,A as k,h as l,f as m,_ as n,b as o};