agentic-qe 3.15.14 → 3.15.16
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.
- package/.claude/agents/v3/templates/qx-report-template.html +1 -1
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +136 -0
- package/assets/agents/v3/templates/qx-report-template.html +1 -1
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/audit/witness-chain.d.ts +7 -0
- package/dist/audit/witness-chain.js +10 -0
- package/dist/cli/bundle.js +6 -6
- package/dist/cli/chunks/adapter-6CQ2PIP5.js +2 -0
- package/dist/cli/chunks/agent-booster-wasm-45NWEKVS.js +2 -0
- package/dist/cli/chunks/{agent-handler-P3IY7XEE.js → agent-handler-LVHMYFEF.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-WWKC2H3G.js → agent-memory-branch-YDWOJFEQ.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-73RR52VS.js +2 -0
- package/dist/cli/chunks/{arena-EIV5OALF.js → arena-CZKHXDDS.js} +2 -2
- package/dist/cli/chunks/{arena-4BMFF6BS.js → arena-ELDZH3CZ.js} +4 -4
- package/dist/cli/chunks/{audit-DNTI453H.js → audit-5MT4T47Z.js} +3 -3
- package/dist/cli/chunks/base-SMCMMVGP.js +2 -0
- package/dist/cli/chunks/{better-sqlite3-TQBQGNC6.js → better-sqlite3-6TGYPC2B.js} +2 -2
- package/dist/cli/chunks/{brain-handler-HY57CNAO.js → brain-handler-HQWZFO52.js} +3 -3
- package/dist/cli/chunks/{branch-enumerator-THPMZPHQ.js → branch-enumerator-WVILM4SO.js} +2 -2
- package/dist/cli/chunks/{browser-O6JJOZCK.js → browser-RX5ALU3H.js} +2 -2
- package/dist/cli/chunks/browser-workflow-A2MEZ66K.js +2 -0
- package/dist/cli/chunks/{chunk-CIINJHOX.js → chunk-24OX5TQJ.js} +1 -1
- package/dist/cli/chunks/{chunk-6P4Q4RTC.js → chunk-24QHCVX6.js} +1 -1
- package/dist/cli/chunks/{chunk-U6IOQKCT.js → chunk-2H4XH6FT.js} +2 -2
- package/dist/cli/chunks/{chunk-OGEIHS76.js → chunk-2YZ4G6NW.js} +1 -1
- package/dist/cli/chunks/chunk-32BPDLRZ.js +27 -0
- package/dist/cli/chunks/{chunk-5PLBQZ5J.js → chunk-32GN3JKR.js} +1 -1
- package/dist/cli/chunks/{chunk-AJVLVF7V.js → chunk-3HD7E6HN.js} +2 -2
- package/dist/cli/chunks/{chunk-X7CUI7KH.js → chunk-4D4DENG6.js} +2 -2
- package/dist/cli/chunks/{chunk-E2JLAW3U.js → chunk-4LQFBY5L.js} +6 -6
- package/dist/cli/chunks/{chunk-E3QIQMMN.js → chunk-4NFQLP6R.js} +1 -1
- package/dist/cli/chunks/{chunk-7Y3LXH57.js → chunk-525CFDUE.js} +2 -2
- package/dist/cli/chunks/chunk-5B5QPCNU.js +65 -0
- package/dist/cli/chunks/{chunk-X6Q2N5S5.js → chunk-5JZRZI4S.js} +2 -2
- package/dist/cli/chunks/{chunk-MB4UKUBV.js → chunk-5LAVKGLH.js} +2 -2
- package/dist/cli/chunks/chunk-5NNNEWLS.js +755 -0
- package/dist/cli/chunks/{chunk-NKOLILT7.js → chunk-5PBLPQ5T.js} +2 -2
- package/dist/cli/chunks/chunk-5QO3R3TU.js +6 -0
- package/dist/cli/chunks/{chunk-7T6L3LFN.js → chunk-5SPCGMBB.js} +2 -2
- package/dist/cli/chunks/{chunk-2QLE6NDW.js → chunk-5V3TI2LG.js} +1 -1
- package/dist/cli/chunks/{chunk-A2T56XVL.js → chunk-5VZL4UVN.js} +2 -2
- package/dist/cli/chunks/{chunk-TWOV3I3A.js → chunk-63GMRQ25.js} +1 -1
- package/dist/cli/chunks/{chunk-YGOSSVY5.js → chunk-63ZKI4PX.js} +6 -6
- package/dist/cli/chunks/{chunk-FHPNWHY7.js → chunk-67Z5R7RJ.js} +2 -2
- package/dist/cli/chunks/{chunk-PCQZIAXB.js → chunk-6DPYNAOK.js} +2 -2
- package/dist/cli/chunks/{chunk-WCM6WE7G.js → chunk-6ICX3FEG.js} +3 -3
- package/dist/cli/chunks/{chunk-JB7R77SH.js → chunk-6XXZDV2C.js} +2 -2
- package/dist/cli/chunks/{chunk-FJOIBZUB.js → chunk-6ZBXSOX6.js} +2 -2
- package/dist/cli/chunks/{chunk-WZQADC5R.js → chunk-72XSEQMW.js} +2 -2
- package/dist/cli/chunks/{chunk-AYLEH2UF.js → chunk-7TE5ONQQ.js} +1 -1
- package/dist/cli/chunks/{chunk-7QUSNBAA.js → chunk-A5GBXCP5.js} +2 -2
- package/dist/cli/chunks/{chunk-7724KXM2.js → chunk-AAMLQ2LF.js} +3 -3
- package/dist/cli/chunks/chunk-AG2EWGXS.js +21 -0
- package/dist/cli/chunks/{chunk-2UZBLC5H.js → chunk-AGRV5B3T.js} +2 -2
- package/dist/cli/chunks/{chunk-V6SE2ZU2.js → chunk-AJMJNQMP.js} +1 -1
- package/dist/cli/chunks/{chunk-2HPNGK7A.js → chunk-AR67RJPY.js} +2 -2
- package/dist/cli/chunks/{chunk-G7HGUQAE.js → chunk-ASEOFRIG.js} +2 -2
- package/dist/cli/chunks/{chunk-7TH4PJSU.js → chunk-BEKDKVQT.js} +2 -2
- package/dist/cli/chunks/{chunk-M5JEA6ZY.js → chunk-BY5OF7OH.js} +2 -2
- package/dist/cli/chunks/{chunk-OLUOVNUF.js → chunk-C5FP5GW3.js} +2 -2
- package/dist/cli/chunks/{chunk-R5RRWLRI.js → chunk-C6D5AHBO.js} +2 -2
- package/dist/cli/chunks/{chunk-K7GFYFBO.js → chunk-CAKMOVZ6.js} +2 -2
- package/dist/cli/chunks/{chunk-6NIGSY5L.js → chunk-CEYSYSK5.js} +2 -2
- package/dist/cli/chunks/{chunk-U4TML2VD.js → chunk-CGGUM2YJ.js} +2 -2
- package/dist/cli/chunks/{chunk-YE54T2NQ.js → chunk-CJSHWQXP.js} +2 -2
- package/dist/cli/chunks/{chunk-7SQTLUEN.js → chunk-CRPIYUTJ.js} +2 -2
- package/dist/cli/chunks/{chunk-65EE2EST.js → chunk-D6COXLYE.js} +2 -2
- package/dist/cli/chunks/{chunk-4WLIOPHX.js → chunk-DTMAS2GB.js} +2 -2
- package/dist/cli/chunks/{chunk-E7QTWGPI.js → chunk-DVYHMDFR.js} +470 -411
- package/dist/cli/chunks/chunk-DXD6K2ZP.js +3 -0
- package/dist/cli/chunks/{chunk-HSDWPQQY.js → chunk-E3D4GPLP.js} +3 -3
- package/dist/cli/chunks/{chunk-JJHLGGPP.js → chunk-EA4YQVKS.js} +1 -1
- package/dist/cli/chunks/{chunk-EIEEST4T.js → chunk-EGYE5UPQ.js} +2 -2
- package/dist/cli/chunks/{chunk-O756AOUX.js → chunk-EK7OLYOZ.js} +2 -2
- package/dist/cli/chunks/{chunk-57DRT6UA.js → chunk-F742SZAX.js} +2 -2
- package/dist/cli/chunks/{chunk-6OI5SK7M.js → chunk-FBDVGRSC.js} +1 -1
- package/dist/cli/chunks/{chunk-H3C5FJRH.js → chunk-FDDC72IA.js} +2 -2
- package/dist/cli/chunks/{chunk-IQRPR4KB.js → chunk-FL64OUBA.js} +2 -2
- package/dist/cli/chunks/{chunk-BNG4J3CE.js → chunk-FLNAW7C4.js} +2 -2
- package/dist/cli/chunks/{chunk-C3OIBFAA.js → chunk-G5RHFBAY.js} +2 -2
- package/dist/cli/chunks/{chunk-NPCXGX7N.js → chunk-GAHNO6JJ.js} +2 -2
- package/dist/cli/chunks/{chunk-PNRPVQGI.js → chunk-GFWHUQSF.js} +2 -2
- package/dist/cli/chunks/{chunk-OCN53CCK.js → chunk-GJYHWYXR.js} +2 -2
- package/dist/cli/chunks/{chunk-5Z4MO2F3.js → chunk-GQ6TUIKY.js} +1 -1
- package/dist/cli/chunks/{chunk-N736GLWZ.js → chunk-GSKMOPL7.js} +2 -2
- package/dist/cli/chunks/{chunk-43XHGWYH.js → chunk-HCH4Y6XX.js} +2 -2
- package/dist/cli/chunks/{chunk-QP6GL3O5.js → chunk-HGWXF45W.js} +1 -1
- package/dist/cli/chunks/{chunk-PGN4TARY.js → chunk-HJ6ZGVTB.js} +2 -2
- package/dist/cli/chunks/{chunk-M2TG7VDK.js → chunk-HLUXXCHF.js} +1 -1
- package/dist/cli/chunks/{chunk-UMHFTQTR.js → chunk-HVRRLYX6.js} +4 -4
- package/dist/cli/chunks/{chunk-L7PC675Y.js → chunk-I7MQIM2U.js} +1 -1
- package/dist/cli/chunks/{chunk-JSSU4RIK.js → chunk-IESR7TNB.js} +2 -2
- package/dist/cli/chunks/{chunk-H4LYXLAT.js → chunk-IHRXZZQM.js} +1 -1
- package/dist/cli/chunks/{chunk-HV43NX4A.js → chunk-IOKYCMTJ.js} +6 -6
- package/dist/cli/chunks/{chunk-NZQYJCO6.js → chunk-IOQ6ZQ5W.js} +1 -1
- package/dist/cli/chunks/{chunk-JO26SG47.js → chunk-IOYG4VFL.js} +2 -2
- package/dist/cli/chunks/{chunk-6O63ZTVX.js → chunk-IUBJVHNB.js} +2 -2
- package/dist/cli/chunks/{chunk-XSPMLJCQ.js → chunk-J442IZLE.js} +1 -1
- package/dist/cli/chunks/{chunk-LTGQJYYO.js → chunk-J4ELZNLY.js} +2 -2
- package/dist/cli/chunks/chunk-J7I6PABJ.js +153 -0
- package/dist/cli/chunks/chunk-JDIYMZCQ.js +2 -0
- package/dist/cli/chunks/{chunk-TOJF3ZG4.js → chunk-JHQCRRJI.js} +2 -2
- package/dist/cli/chunks/{chunk-QUZ745UQ.js → chunk-JQ3DYUMS.js} +2 -2
- package/dist/cli/chunks/{chunk-P2TPH3TC.js → chunk-KITOPKRG.js} +2 -2
- package/dist/cli/chunks/{chunk-QNQE3EOH.js → chunk-KKU2QGSJ.js} +2 -2
- package/dist/cli/chunks/chunk-KL7OKSU2.js +4 -0
- package/dist/cli/chunks/{chunk-L5VSLPMW.js → chunk-KNSRL6NO.js} +2 -2
- package/dist/cli/chunks/{chunk-INGXD5IX.js → chunk-KPRCB5LT.js} +2 -2
- package/dist/cli/chunks/{chunk-GY4P7KAI.js → chunk-KQYJ4VQ5.js} +1 -1
- package/dist/cli/chunks/{chunk-Z2S7DNFP.js → chunk-KU2AUFGX.js} +2 -2
- package/dist/cli/chunks/{chunk-O5CEL447.js → chunk-KVF4NXGQ.js} +2 -2
- package/dist/cli/chunks/{chunk-2IJO3657.js → chunk-KXCLACFG.js} +2 -2
- package/dist/cli/chunks/{chunk-ZJGFQK27.js → chunk-L2DWPVNJ.js} +1 -1
- package/dist/cli/chunks/{chunk-E7OR6V3V.js → chunk-L6QSTQME.js} +2 -2
- package/dist/cli/chunks/{chunk-RE6JTSDM.js → chunk-LE4QJREF.js} +1 -1
- package/dist/cli/chunks/{chunk-DSQESXL4.js → chunk-LKTTUHLF.js} +2 -2
- package/dist/cli/chunks/{chunk-YGC5QKQ4.js → chunk-LQLPB2T6.js} +2 -2
- package/dist/cli/chunks/{chunk-VGZOPQQY.js → chunk-LRSX2FJM.js} +1 -1
- package/dist/cli/chunks/chunk-M4FRQ4TE.js +12 -0
- package/dist/cli/chunks/chunk-M7WJCTG3.js +2 -0
- package/dist/cli/chunks/{chunk-56NSE3LJ.js → chunk-MAFQV4U4.js} +2 -2
- package/dist/cli/chunks/{chunk-MKYOE7NE.js → chunk-MD43XRX5.js} +1 -1
- package/dist/cli/chunks/{chunk-3TF27MG5.js → chunk-MI5MFHRA.js} +2 -2
- package/dist/cli/chunks/{chunk-JK6PMLQQ.js → chunk-MO55CVMT.js} +32 -32
- package/dist/cli/chunks/{chunk-X6NJOT3V.js → chunk-N7HL5PHH.js} +1 -1
- package/dist/cli/chunks/chunk-NAEWCFQT.js +14 -0
- package/dist/cli/chunks/{chunk-WUGXXNK4.js → chunk-NDJ7P2EP.js} +1 -1
- package/dist/cli/chunks/{chunk-D5GB5PUU.js → chunk-NO3IV5Q5.js} +1 -1
- package/dist/cli/chunks/{chunk-3XACRXBY.js → chunk-NQXXI77K.js} +2 -2
- package/dist/cli/chunks/{chunk-EC65UZ77.js → chunk-NVEWF4JV.js} +1 -1
- package/dist/cli/chunks/{chunk-JI67T6Q2.js → chunk-NZU4ACBZ.js} +2 -2
- package/dist/cli/chunks/chunk-O5W3FIO6.js +63 -0
- package/dist/cli/chunks/{chunk-YEFTK4HD.js → chunk-OAEE6JWQ.js} +2 -2
- package/dist/cli/chunks/{chunk-JAOCHPYX.js → chunk-OCV2XEWQ.js} +2 -2
- package/dist/cli/chunks/{chunk-IDBA5GK2.js → chunk-P3EYRILV.js} +2 -2
- package/dist/cli/chunks/{chunk-4RPBODN5.js → chunk-PEQDY4BO.js} +2 -2
- package/dist/cli/chunks/{chunk-CPPYZYXC.js → chunk-PF7RBAYL.js} +2 -2
- package/dist/cli/chunks/{chunk-WCPSR4MJ.js → chunk-PHT5N7SC.js} +2 -2
- package/dist/cli/chunks/{chunk-O2AAYJUV.js → chunk-PINSJCM3.js} +1 -1
- package/dist/cli/chunks/{chunk-HEDGFKC5.js → chunk-PPUZWYUG.js} +2 -2
- package/dist/cli/chunks/{chunk-XMCSKYDE.js → chunk-QPEOLAAS.js} +1 -1
- package/dist/cli/chunks/{chunk-7MUO4DEH.js → chunk-QQWBWEJS.js} +18 -18
- package/dist/cli/chunks/{chunk-UFP7SN5V.js → chunk-QVDCVD5D.js} +2 -2
- package/dist/cli/chunks/{chunk-NHEG2DLN.js → chunk-RJIEG3NA.js} +2 -2
- package/dist/cli/chunks/{chunk-KJ5A54ZH.js → chunk-RV74I3YO.js} +2 -2
- package/dist/cli/chunks/{chunk-UDSB3XCG.js → chunk-S75SOOZL.js} +2 -2
- package/dist/cli/chunks/{chunk-BPDAQB3F.js → chunk-SASBO5Y5.js} +2 -2
- package/dist/cli/chunks/{chunk-VJBJRFUO.js → chunk-SDLWKRVL.js} +9 -9
- package/dist/cli/chunks/{chunk-J6ASX536.js → chunk-SHKOCGNK.js} +2 -2
- package/dist/cli/chunks/{chunk-J35JWDJE.js → chunk-SI6DPU5D.js} +1 -1
- package/dist/cli/chunks/{chunk-V3MGY76S.js → chunk-SJ6Y4725.js} +2 -2
- package/dist/cli/chunks/{chunk-FTYRPEJS.js → chunk-SR52XP5F.js} +1 -1
- package/dist/cli/chunks/{chunk-ZUE524JL.js → chunk-SSUAAX3F.js} +2 -2
- package/dist/cli/chunks/{chunk-VG32EEUG.js → chunk-SSYAQZXA.js} +2 -2
- package/dist/cli/chunks/{chunk-HTVGHHX2.js → chunk-SUDMM5SO.js} +2 -2
- package/dist/cli/chunks/{chunk-K2SMP4OD.js → chunk-TIUKLYAI.js} +1 -1
- package/dist/cli/chunks/{chunk-VCVRZD4Y.js → chunk-TVGI32MB.js} +33 -33
- package/dist/cli/chunks/{chunk-CAZM63TP.js → chunk-U2A7NHZA.js} +2 -2
- package/dist/cli/chunks/{chunk-WBC6WB32.js → chunk-UE5ZOZR2.js} +2 -2
- package/dist/cli/chunks/{chunk-BQJ7CV53.js → chunk-UHEOGZLX.js} +12 -12
- package/dist/cli/chunks/chunk-UNGBRZDK.js +12 -0
- package/dist/cli/chunks/{chunk-XN3KCKAM.js → chunk-V5NHZV7S.js} +2 -2
- package/dist/cli/chunks/{chunk-UNYTHZDZ.js → chunk-VJCIEHEF.js} +1 -1
- package/dist/cli/chunks/{chunk-5Y7UFHJD.js → chunk-VMDFFTCK.js} +1 -1
- package/dist/cli/chunks/chunk-VSIKHWZ4.js +29 -0
- package/dist/cli/chunks/{chunk-UPWLMIDY.js → chunk-VWPM27GU.js} +2 -2
- package/dist/cli/chunks/{chunk-USAKCGHC.js → chunk-VXFLJNCA.js} +2 -2
- package/dist/cli/chunks/{chunk-WKI46WWN.js → chunk-W5HQUIML.js} +2 -2
- package/dist/cli/chunks/{chunk-Z54G2YOL.js → chunk-WP4RETKG.js} +2 -2
- package/dist/cli/chunks/{chunk-IRPNEXOU.js → chunk-XIIQ5QTT.js} +2 -2
- package/dist/cli/chunks/{chunk-O32BFQV4.js → chunk-XIQW7EFL.js} +2 -2
- package/dist/cli/chunks/{chunk-TW6Z6W4X.js → chunk-XWUWX7BV.js} +13 -13
- package/dist/cli/chunks/{chunk-57FX3GP6.js → chunk-Y4PFUMOU.js} +1 -1
- package/dist/cli/chunks/chunk-YAPLJR7K.js +2 -0
- package/dist/cli/chunks/{chunk-4T7XV5KQ.js → chunk-YLMNVLDK.js} +1 -1
- package/dist/cli/chunks/{chunk-TSP6SU5V.js → chunk-YNMJEDN5.js} +2 -2
- package/dist/cli/chunks/{chunk-PWQWKYBG.js → chunk-YPBSUGMI.js} +1 -1
- package/dist/cli/chunks/{chunk-QP2HLKTS.js → chunk-YRAX7SFJ.js} +2 -2
- package/dist/cli/chunks/{chunk-O3ERGUXH.js → chunk-YTHTQPWR.js} +1 -1
- package/dist/cli/chunks/{chunk-MR2OPUSA.js → chunk-YU2BDRSD.js} +1 -1
- package/dist/cli/chunks/chunk-ZB3LEFYG.js +2 -0
- package/dist/cli/chunks/{chunk-2W5MQDHM.js → chunk-ZFL436FN.js} +2 -2
- package/dist/cli/chunks/{chunk-7MISCSL5.js → chunk-ZJH5MU2I.js} +2 -2
- package/dist/cli/chunks/{chunk-52KOPIMI.js → chunk-ZQ2XW3IP.js} +2 -2
- package/dist/cli/chunks/chunk-ZR2TKVXQ.js +14 -0
- package/dist/cli/chunks/{ci-UMA2SMNW.js → ci-MFUR4CWV.js} +2 -2
- package/dist/cli/chunks/{ci-config-UQSILJFQ.js → ci-config-PNDLQ6XV.js} +2 -2
- package/dist/cli/chunks/{ci-output-U6YZLLKH.js → ci-output-PFZ4M7NC.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-ATYQP6X2.js → circuit-breaker-5HH6NLZN.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-6YHFD7AN.js → claude-flow-setup-QCKYLGLC.js} +2 -2
- package/dist/cli/chunks/client-MHQRTZM4.js +2 -0
- package/dist/cli/chunks/{cline-installer-EPE7IOZE.js → cline-installer-EASVPFXR.js} +2 -2
- package/dist/cli/chunks/{code-NUEJ4XYO.js → code-UJXDVYRK.js} +4 -3
- package/dist/cli/chunks/{code-index-extractor-D4DBT6OL.js → code-index-extractor-BZJ3UDP4.js} +2 -2
- package/dist/cli/chunks/{codex-installer-633SM4LR.js → codex-installer-XSQZUVOZ.js} +4 -4
- package/dist/cli/chunks/{completions-WUKVIW3L.js → completions-OWOOJFI2.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-F73ACR5H.js → complexity-analyzer-KP5TOHDT.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-QH42TKMS.js → continuedev-installer-IFKQXLHM.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-Y3XC7BTT.js → copilot-installer-IGJ6KGQY.js} +2 -2
- package/dist/cli/chunks/core-handlers-UAK3LLJE.js +2 -0
- package/dist/cli/chunks/{cost-tracker-57QPV7E3.js → cost-tracker-MMDDNKZB.js} +2 -2
- package/dist/cli/chunks/{coverage-IBCHMBCR.js → coverage-LUH2B7NT.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-WTRZQPNQ.js +2 -0
- package/dist/cli/chunks/{cursor-installer-F4UYQHIN.js → cursor-installer-4YLM5GWM.js} +2 -2
- package/dist/cli/chunks/daemon-CAVZ7OFV.js +18 -0
- package/dist/cli/chunks/{daemon-XR4Q6YZF.js → daemon-MZKVM4CJ.js} +3 -3
- package/dist/cli/chunks/{dag-attention-scheduler-ZR5ZD3TW.js → dag-attention-scheduler-X4CYW665.js} +2 -2
- package/dist/cli/chunks/{detect-GEGYURLL.js → detect-7BM2XINO.js} +2 -2
- package/dist/cli/chunks/{dist-node-JU3KT2JO.js → dist-node-Y5APLEYB.js} +2 -2
- package/dist/cli/chunks/{domain-handler-7QI3FJGE.js → domain-handler-X3ZRJNAH.js} +2 -2
- package/dist/cli/chunks/{domain-plugins-O2YRM2PD.js → domain-plugins-2UW5KQJB.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-7J3S2OS6.js → domain-transfer-35W4CIBV.js} +2 -2
- package/dist/cli/chunks/dream-EJY24JN6.js +2 -0
- package/dist/cli/chunks/embed-and-insert-pattern-COG4C7ZI.js +3 -0
- package/dist/cli/chunks/embedding-space-SBM2MZD2.js +2 -0
- package/dist/cli/chunks/{eval-RVMCIUOR.js → eval-4QA2SROK.js} +2 -2
- package/dist/cli/chunks/experience-capture-middleware-Z6BF6KYM.js +40 -0
- package/dist/cli/chunks/{fast-paths-QUKPKWKZ.js → fast-paths-FIORX6GN.js} +2 -2
- package/dist/cli/chunks/{feature-flags-K7JXNKJI.js → feature-flags-6LYI2T4G.js} +2 -2
- package/dist/cli/chunks/{feature-flags-5JCSKL2P.js → feature-flags-ZOO7LMIC.js} +2 -2
- package/dist/cli/chunks/file-discovery-UZSFSS4V.js +2 -0
- package/dist/cli/chunks/{fleet-II4Q6HXK.js → fleet-7WF53H4F.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-M7VO2EMS.js → gnn-wrapper-KJ6B7BRM.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-ND5CY26N.js → heartbeat-handler-DEKKMOVW.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-NVR356I7.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-LFMPLUJU.js +2 -0
- package/dist/cli/chunks/hnsw-index-POCPMVJH.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-N3AUUUU7.js → hnsw-legacy-bridge-L27WS27N.js} +2 -2
- package/dist/cli/chunks/{hnswlib-node-NZY3E5EN.js → hnswlib-node-4YOQC6L4.js} +2 -2
- package/dist/cli/chunks/{hooks-QVJDTII5.js → hooks-TAOKV4EJ.js} +23 -22
- package/dist/cli/chunks/hybrid-backend-4STAO7CV.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-ZRY6MTDV.js → hypergraph-engine-BODRJLHL.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-56DO4XZQ.js → hypergraph-handler-RKMYJNTU.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-3VIIISBQ.js +2 -0
- package/dist/cli/chunks/{init-guard-DTF4EVUY.js → init-guard-MXHSLSB2.js} +2 -2
- package/dist/cli/chunks/{init-handler-M6CNQHMX.js → init-handler-HUE57IFW.js} +6 -6
- package/dist/cli/chunks/init-wizard-PL6QN6RQ.js +2 -0
- package/dist/cli/chunks/kernel-CCDWT7KS.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-IJN7XKBH.js → kilocode-installer-S333IKYQ.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-UKKPGPDC.js → kiro-installer-WM5DLQWC.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-KFOMEN3H.js +2 -0
- package/dist/cli/chunks/{learning-W2HETWQ4.js → learning-LNHMQLH5.js} +3 -3
- package/dist/cli/chunks/{llm-router-Y546K4VX.js → llm-router-EWFXYZZR.js} +4 -4
- package/dist/cli/chunks/llm-router-service-7NBE2EX6.js +2 -0
- package/dist/cli/chunks/{load-MKAB2AXE.js → load-FGYGWVDK.js} +2 -2
- package/dist/cli/chunks/load-test-UNZUWY3F.js +2 -0
- package/dist/cli/chunks/{mcp-AZKUS6K3.js → mcp-2FHNAAOM.js} +2 -2
- package/dist/cli/chunks/{memory-ZDOQN2KU.js → memory-DZMQ73AB.js} +5 -5
- package/dist/cli/chunks/memory-backend-DFGKWA2Q.js +2 -0
- package/dist/cli/chunks/memory-handlers-MP426XRJ.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-WWVXDHG4.js → multi-model-executor-6F2UAEUW.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-YUJNXXWS.js → opencode-installer-XY3BGOTZ.js} +2 -2
- package/dist/cli/chunks/{orchestrator-Z6PWPLRE.js → orchestrator-B4CNKUOS.js} +17 -17
- package/dist/cli/chunks/pattern-null-store-SSVF5TE5.js +2 -0
- package/dist/cli/chunks/{pattern-usage-recorder-TPWPX32U.js → pattern-usage-recorder-R4GUFNMD.js} +2 -2
- package/dist/cli/chunks/{pipeline-4BBGTE4M.js → pipeline-FG5RKVRO.js} +2 -2
- package/dist/cli/chunks/{platform-5GSHXCV5.js → platform-3BT4KEVJ.js} +2 -2
- package/dist/cli/chunks/{plugin-OFDVF5HS.js → plugin-WI4RIN7O.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-NC6MUYGJ.js → prime-radiant-advanced-wasm-7ECDNQFS.js} +2 -2
- package/dist/cli/chunks/project-root-BEANNYWU.js +2 -0
- package/dist/cli/chunks/protocol-executor-FQVIHXZ7.js +2 -0
- package/dist/cli/chunks/{protocol-handler-MPOAAEPA.js → protocol-handler-WNODKPGW.js} +2 -2
- package/dist/cli/chunks/{prove-CDKMAIVM.js → prove-5RHAEPYZ.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-5TFYSE24.js +2 -0
- package/dist/cli/chunks/{quality-ZH4F7R7R.js → quality-WPHR7BGQ.js} +2 -2
- package/dist/cli/chunks/{quality-gate-IDRMW6OE.js → quality-gate-4RKTEZMX.js} +3 -3
- package/dist/cli/chunks/queen-coordinator-Y2OUL7IN.js +2 -0
- package/dist/cli/chunks/real-embeddings-OXLYU7JW.js +2 -0
- package/dist/cli/chunks/{ref-validation-Z5GCGVXK.js → ref-validation-TPAWHOHH.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-IZ2S7PH2.js → roocode-installer-7AVHFNDI.js} +2 -2
- package/dist/cli/chunks/router-EP34O3KB.js +2 -0
- package/dist/cli/chunks/routing-feedback-FJCRKXNG.js +2 -0
- package/dist/cli/chunks/{routing-handler-NAX35VUW.js → routing-handler-YKEDVJSH.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-5YW2SOFF.js → ruvector-commands-JUAMM354.js} +2 -2
- package/dist/cli/chunks/rvf-dual-writer-ILITJSFG.js +2 -0
- package/dist/cli/chunks/rvf-migration-adapter-XF6W4C2N.js +2 -0
- package/dist/cli/chunks/rvf-migration-coordinator-CMKG56AR.js +2 -0
- package/dist/cli/chunks/rvf-native-adapter-7YFW6S4Y.js +2 -0
- package/dist/cli/chunks/{rvf-store-integrity-IPGCAT6C.js → rvf-store-integrity-VJDUIRTX.js} +2 -2
- package/dist/cli/chunks/safe-db-TCAU4FUT.js +2 -0
- package/dist/cli/chunks/schedule-NB5KV435.js +2 -0
- package/dist/cli/chunks/scheduler-JKXGKVK6.js +2 -0
- package/dist/cli/chunks/{security-3IH4BO5Z.js → security-ORDN3RD2.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-ABY7PAY2.js → shared-rvf-adapter-CF4BCIO7.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-6KENLN2W.js → shared-rvf-dual-writer-C32UBR6D.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-IXCNZRTW.js +2 -0
- package/dist/cli/chunks/{standalone-memory-RLFAUGOW.js → standalone-memory-OXRJYZXN.js} +2 -2
- package/dist/cli/chunks/{status-handler-FCOZBPE5.js → status-handler-BCX5D4HY.js} +2 -2
- package/dist/cli/chunks/{structural-health-4RDA5UUM.js → structural-health-LFG7RUU6.js} +2 -2
- package/dist/cli/chunks/sync-OSF7C2NL.js +2 -0
- package/dist/cli/chunks/{sync-KGEEXXCC.js → sync-YJEE2K2L.js} +2 -2
- package/dist/cli/chunks/task-handler-6LXKPTXJ.js +64 -0
- package/dist/cli/chunks/{task-handlers-6H7L2UT4.js → task-handlers-CILP36I7.js} +4 -4
- package/dist/cli/chunks/{test-S7IG6EIX.js → test-SD457QJ6.js} +4 -4
- package/dist/cli/chunks/test-runner-process-VKD65QQU.js +2 -0
- package/dist/cli/chunks/{test-scheduling-7XYXI4L2.js → test-scheduling-ISI2O4Q5.js} +3 -3
- package/dist/cli/chunks/token-bootstrap-VUELSBOS.js +2 -0
- package/dist/cli/chunks/{token-usage-Y2YTPOFE.js → token-usage-XOC5KG7S.js} +2 -2
- package/dist/cli/chunks/{transformers-UCJ3HHHC.js → transformers-LSLQAARK.js} +2 -2
- package/dist/cli/chunks/tree-sitter-wasm-parser-YAIPHRIL.js +2 -0
- package/dist/cli/chunks/{types-6CMFPETH.js → types-5BLCGLCR.js} +2 -2
- package/dist/cli/chunks/unified-memory-GI76TXFV.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-GXJ5BTZO.js +2 -0
- package/dist/cli/chunks/unified-persistence-OP7FDQPD.js +2 -0
- package/dist/cli/chunks/{upgrade-K25DN6WU.js → upgrade-RQJYLK3J.js} +2 -2
- package/dist/cli/chunks/{validate-T4V3TBY3.js → validate-QBHWXXCK.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-XSRC576T.js → validate-swarm-IKXBKFB5.js} +2 -2
- package/dist/cli/chunks/visual-security-GZ2MOKWB.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-YOZXHRTN.js → web-tree-sitter-ZF6FIE5R.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-ITPU2IYL.js → windsurf-installer-HQGDZT5D.js} +2 -2
- package/dist/cli/chunks/witness-chain-DCHCAMSQ.js +2 -0
- package/dist/cli/chunks/witness-chain-P3XXXA62.js +2 -0
- package/dist/cli/chunks/witness-chain-repair-PUX2NFDL.js +2 -0
- package/dist/cli/chunks/{witness-chain-verifier-DTDSVKOG.js → witness-chain-verifier-PX2OQ6XT.js} +2 -2
- package/dist/cli/chunks/{witness-key-manager-EWACWGAW.js → witness-key-manager-RXYQNFJB.js} +2 -2
- package/dist/cli/chunks/{workflow-ZIQ4FV42.js → workflow-FBKCA4H6.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-P2APAJAA.js +2 -0
- package/dist/cli/chunks/wrappers-TWSKBTWD.js +2 -0
- package/dist/cli/commands/code.js +4 -0
- package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +10 -2
- package/dist/cli/handlers/task-handler.d.ts +5 -0
- package/dist/cli/handlers/task-handler.js +21 -1
- package/dist/cli/utils/task-result.d.ts +11 -0
- package/dist/cli/utils/task-result.js +39 -0
- package/dist/coordination/handlers/test-execution-handlers.js +92 -58
- package/dist/coordination/mincut/mincut-persistence.js +29 -25
- package/dist/domains/code-intelligence/coordinator.d.ts +4 -0
- package/dist/domains/code-intelligence/coordinator.js +46 -13
- package/dist/domains/code-intelligence/interfaces.d.ts +10 -1
- package/dist/domains/code-intelligence/services/semantic-analyzer.d.ts +32 -7
- package/dist/domains/code-intelligence/services/semantic-analyzer.js +112 -53
- package/dist/domains/learning-optimization/services/learning-coordinator.js +1 -1
- package/dist/domains/quality-assessment/coordinator.js +2 -1
- package/dist/domains/test-execution/coordinator.js +10 -5
- package/dist/domains/test-execution/interfaces.d.ts +12 -0
- package/dist/domains/test-execution/plugin.js +6 -2
- package/dist/domains/test-execution/services/retry-handler.d.ts +2 -0
- package/dist/domains/test-execution/services/retry-handler.js +14 -9
- package/dist/domains/test-execution/services/test-executor.d.ts +1 -0
- package/dist/domains/test-execution/services/test-executor.js +28 -9
- package/dist/domains/visual-accessibility/coordinator.d.ts +15 -7
- package/dist/domains/visual-accessibility/coordinator.js +15 -7
- package/dist/domains/visual-accessibility/interfaces.d.ts +27 -3
- package/dist/domains/visual-accessibility/services/accessibility-contrast.d.ts +39 -0
- package/dist/domains/visual-accessibility/services/accessibility-contrast.js +93 -0
- package/dist/domains/visual-accessibility/services/accessibility-tester-browser.d.ts +18 -3
- package/dist/domains/visual-accessibility/services/accessibility-tester-browser.js +50 -40
- package/dist/domains/visual-accessibility/services/accessibility-tester-checks.d.ts +27 -0
- package/dist/domains/visual-accessibility/services/accessibility-tester-checks.js +137 -0
- package/dist/domains/visual-accessibility/services/accessibility-tester.d.ts +5 -0
- package/dist/domains/visual-accessibility/services/accessibility-tester.js +43 -24
- package/dist/domains/visual-accessibility/services/browser-swarm-coordinator.d.ts +2 -3
- package/dist/domains/visual-accessibility/services/browser-swarm-coordinator.js +8 -14
- package/dist/feedback/coverage-learner.js +13 -9
- package/dist/feedback/test-outcome-tracker.js +13 -9
- package/dist/governance/witness-chain.d.ts +5 -0
- package/dist/governance/witness-chain.js +22 -6
- package/dist/init/init-wizard-hooks.d.ts +1 -1
- package/dist/init/init-wizard-hooks.js +7 -8
- package/dist/init/phases/08-mcp.js +9 -0
- package/dist/init/settings-merge.d.ts +13 -0
- package/dist/init/settings-merge.js +49 -2
- package/dist/integrations/agent-booster-wasm/agent_booster_wasm.js +849 -0
- package/dist/integrations/agent-booster-wasm/agent_booster_wasm_bg.wasm +0 -0
- package/dist/integrations/agent-booster-wasm/index.d.ts +8 -0
- package/dist/integrations/agent-booster-wasm/index.js +25 -2
- package/dist/integrations/agent-booster-wasm/package.json +16 -0
- package/dist/integrations/agentic-flow/reasoning-bank/experience-replay.d.ts +22 -0
- package/dist/integrations/agentic-flow/reasoning-bank/experience-replay.js +115 -45
- package/dist/integrations/agentic-flow/reasoning-bank/pattern-evolution.d.ts +6 -0
- package/dist/integrations/agentic-flow/reasoning-bank/pattern-evolution.js +51 -33
- package/dist/integrations/agentic-flow/reasoning-bank/trajectory-tracker.js +17 -9
- package/dist/integrations/embeddings/cache/EmbeddingCache.d.ts +8 -0
- package/dist/integrations/embeddings/cache/EmbeddingCache.js +24 -10
- package/dist/integrations/ruvector/delta-tracker.d.ts +11 -0
- package/dist/integrations/ruvector/delta-tracker.js +16 -0
- package/dist/integrations/ruvector/sona-persistence.d.ts +10 -0
- package/dist/integrations/ruvector/sona-persistence.js +49 -24
- package/dist/kernel/unified-memory.d.ts +24 -0
- package/dist/kernel/unified-memory.js +63 -8
- package/dist/learning/aqe-learning-engine.js +1 -1
- package/dist/learning/dream/dream-engine.d.ts +3 -2
- package/dist/learning/dream/dream-engine.js +42 -24
- package/dist/learning/dream/dream-lock-retry.d.ts +38 -0
- package/dist/learning/dream/dream-lock-retry.js +66 -0
- package/dist/learning/dream/speculative-dreamer.js +1 -1
- package/dist/learning/embed-and-insert-pattern.js +4 -2
- package/dist/learning/embedder-endpoint-client.d.ts +31 -0
- package/dist/learning/embedder-endpoint-client.js +103 -10
- package/dist/learning/embedding-space.d.ts +12 -0
- package/dist/learning/embedding-space.js +17 -0
- package/dist/learning/experience-capture-middleware.js +25 -13
- package/dist/learning/experience-capture.js +1 -1
- package/dist/learning/experience-consolidation.d.ts +18 -0
- package/dist/learning/experience-consolidation.js +55 -8
- package/dist/learning/experience-space-verification.d.ts +71 -0
- package/dist/learning/experience-space-verification.js +147 -0
- package/dist/learning/pattern-lifecycle.d.ts +40 -4
- package/dist/learning/pattern-lifecycle.js +153 -76
- package/dist/learning/pattern-null-store.d.ts +5 -0
- package/dist/learning/pattern-null-store.js +8 -0
- package/dist/learning/pattern-promotion.js +6 -3
- package/dist/learning/pattern-store.d.ts +6 -0
- package/dist/learning/pattern-store.js +19 -6
- package/dist/learning/qe-reasoning-bank.js +2 -2
- package/dist/learning/real-embeddings.js +3 -1
- package/dist/learning/real-qe-reasoning-bank.d.ts +5 -0
- package/dist/learning/real-qe-reasoning-bank.js +77 -47
- package/dist/learning/rvf-pattern-store.js +6 -2
- package/dist/learning/sqlite-persistence.d.ts +6 -0
- package/dist/learning/sqlite-persistence.js +10 -0
- package/dist/mcp/bundle.js +642 -571
- package/dist/mcp/entry.js +4 -0
- package/dist/mcp/handlers/domain-handler-configs.js +2 -0
- package/dist/mcp/handlers/trajectory-judge.js +1 -1
- package/dist/mcp/protocol-server.js +1 -0
- package/dist/mcp/tools/visual-accessibility/index.js +8 -2
- package/dist/mcp/types.d.ts +6 -0
- package/dist/optimization/session-cache.d.ts +17 -1
- package/dist/optimization/session-cache.js +40 -36
- package/dist/planning/goap-planner.d.ts +6 -0
- package/dist/planning/goap-planner.js +35 -19
- package/dist/planning/plan-executor.js +24 -15
- package/dist/routing/co-execution-repository.js +12 -9
- package/dist/routing/routing-feedback.d.ts +8 -0
- package/dist/routing/routing-feedback.js +46 -24
- package/dist/routing/routing-outcomes-migration.js +7 -2
- package/dist/shared/llm/spend-ledger.d.ts +9 -0
- package/dist/shared/llm/spend-ledger.js +64 -39
- package/dist/shared/sqlite-lock-wait.d.ts +27 -0
- package/dist/shared/sqlite-lock-wait.js +37 -0
- package/dist/shared/sqlite-write-queue.d.ts +28 -0
- package/dist/shared/sqlite-write-queue.js +38 -0
- package/dist/shared/test-runner-project.d.ts +69 -0
- package/dist/shared/test-runner-project.js +186 -0
- package/dist/skills/security-visual-testing/index.d.ts +3 -1
- package/dist/skills/security-visual-testing/index.js +49 -35
- package/dist/skills/security-visual-testing/types.d.ts +19 -3
- package/dist/workers/workers/heartbeat-scheduler.js +5 -5
- package/dist/workers/workers/learning-consolidation.js +8 -7
- package/package.json +4 -2
- package/dist/cli/chunks/adapter-23KA2YW7.js +0 -2
- package/dist/cli/chunks/agent-booster-wasm-2DLAEZK6.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-MUICAXW5.js +0 -2
- package/dist/cli/chunks/base-XPWGYDKD.js +0 -2
- package/dist/cli/chunks/browser-workflow-UMQVBVGK.js +0 -2
- package/dist/cli/chunks/chunk-3FITMWWJ.js +0 -21
- package/dist/cli/chunks/chunk-ARRBXCII.js +0 -4
- package/dist/cli/chunks/chunk-BBYJBZHG.js +0 -14
- package/dist/cli/chunks/chunk-BM3EJLMV.js +0 -153
- package/dist/cli/chunks/chunk-D3ZZ2NLL.js +0 -62
- package/dist/cli/chunks/chunk-DLTB5KCR.js +0 -2
- package/dist/cli/chunks/chunk-DRLSJJIC.js +0 -6
- package/dist/cli/chunks/chunk-HAYKLXCT.js +0 -744
- package/dist/cli/chunks/chunk-HHBF2BZC.js +0 -65
- package/dist/cli/chunks/chunk-K7RT6ITZ.js +0 -2
- package/dist/cli/chunks/chunk-L752CNG3.js +0 -13
- package/dist/cli/chunks/chunk-MQXWG55U.js +0 -12
- package/dist/cli/chunks/chunk-WM2QRIRD.js +0 -14
- package/dist/cli/chunks/chunk-WRC3HLUY.js +0 -29
- package/dist/cli/chunks/chunk-XTZGAG6P.js +0 -27
- package/dist/cli/chunks/chunk-YKQWIXUY.js +0 -2
- package/dist/cli/chunks/client-E43GWLQH.js +0 -2
- package/dist/cli/chunks/core-handlers-R5A3SQDY.js +0 -2
- package/dist/cli/chunks/cross-domain-router-LLYVPZF6.js +0 -2
- package/dist/cli/chunks/daemon-BYYPIJ7G.js +0 -18
- package/dist/cli/chunks/dream-6C4NURSE.js +0 -2
- package/dist/cli/chunks/embed-and-insert-pattern-URES5Q6J.js +0 -3
- package/dist/cli/chunks/experience-capture-middleware-SYJQSBKE.js +0 -40
- package/dist/cli/chunks/file-discovery-J5IE5KP7.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-FC5PBTMN.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-47UIVOBG.js +0 -2
- package/dist/cli/chunks/hnsw-index-3AKVLOZQ.js +0 -2
- package/dist/cli/chunks/hybrid-backend-YAOSNX47.js +0 -2
- package/dist/cli/chunks/impact-analyzer-4FMJXM4M.js +0 -2
- package/dist/cli/chunks/init-wizard-RTLCRWDT.js +0 -2
- package/dist/cli/chunks/kernel-2OWIGGGT.js +0 -2
- package/dist/cli/chunks/knowledge-graph-25XXKDJN.js +0 -2
- package/dist/cli/chunks/llm-router-service-G3EIN4UB.js +0 -2
- package/dist/cli/chunks/load-test-D6QYNIVT.js +0 -2
- package/dist/cli/chunks/memory-backend-LDFFZMEQ.js +0 -2
- package/dist/cli/chunks/memory-handlers-3SQVY7FE.js +0 -2
- package/dist/cli/chunks/pattern-null-store-KDVRM7PW.js +0 -2
- package/dist/cli/chunks/project-root-DDGBWDP6.js +0 -2
- package/dist/cli/chunks/protocol-executor-KBOLLCWA.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-GRXBT7FC.js +0 -2
- package/dist/cli/chunks/queen-coordinator-L2QWMJ5Q.js +0 -2
- package/dist/cli/chunks/real-embeddings-I2UVNNB3.js +0 -2
- package/dist/cli/chunks/router-FT5WJPUH.js +0 -2
- package/dist/cli/chunks/routing-feedback-EO2MKOUX.js +0 -2
- package/dist/cli/chunks/rvf-dual-writer-WHBFQJVU.js +0 -2
- package/dist/cli/chunks/rvf-migration-adapter-YT3APF2I.js +0 -2
- package/dist/cli/chunks/rvf-migration-coordinator-VUIZHTVG.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-37PUFKQD.js +0 -2
- package/dist/cli/chunks/safe-db-TDZKUOZJ.js +0 -2
- package/dist/cli/chunks/schedule-CRKTRY2A.js +0 -2
- package/dist/cli/chunks/scheduler-6ZBDVQWN.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-FFJQAIKW.js +0 -2
- package/dist/cli/chunks/sync-54LUAUTK.js +0 -2
- package/dist/cli/chunks/task-handler-K3OXHYKU.js +0 -62
- package/dist/cli/chunks/test-runner-process-OTQDAJLN.js +0 -2
- package/dist/cli/chunks/token-bootstrap-3QMABE45.js +0 -2
- package/dist/cli/chunks/tree-sitter-wasm-parser-D6JTTHTP.js +0 -2
- package/dist/cli/chunks/unified-memory-QARWQKJ2.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-LHY3DXCP.js +0 -2
- package/dist/cli/chunks/unified-persistence-WEYYGLHM.js +0 -2
- package/dist/cli/chunks/visual-security-O4ALMCXQ.js +0 -2
- package/dist/cli/chunks/witness-chain-B3YW5NMS.js +0 -2
- package/dist/cli/chunks/witness-chain-PIYR72HJ.js +0 -2
- package/dist/cli/chunks/witness-chain-repair-YUG7E3UX.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-3ZN2BCGY.js +0 -2
- package/dist/cli/chunks/wrappers-PW2O27LL.js +0 -2
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.16");process.exit(0)}
|
|
2
|
+
import{d as G,e as X,g as oe,h as Y}from"./chunk-EA4YQVKS.js";import{a as ce}from"./chunk-GQ6TUIKY.js";import{a as le}from"./chunk-HVRRLYX6.js";import{i as F}from"./chunk-HGWXF45W.js";import{c as U,d as qe}from"./chunk-JDIYMZCQ.js";import{n as x,o as V}from"./chunk-M4FRQ4TE.js";import{i as Qe,j as $e,n as ze}from"./chunk-DXD6K2ZP.js";import{c as P,d as w}from"./chunk-LE4QJREF.js";import{B as z,D as k,G as se,P as L,S as _,b as O}from"./chunk-L6QSTQME.js";import{c as Ue}from"./chunk-EK7OLYOZ.js";import{c as Ne,d as pt}from"./chunk-AGRV5B3T.js";import{c as W,e as Me,f as He}from"./chunk-I7MQIM2U.js";import{a as ae,b as ke,d as Le,f as gt}from"./chunk-ZFL436FN.js";import{a as b,b as Fe,e as _e}from"./chunk-KNSRL6NO.js";import{c as j,e as mt}from"./chunk-AJMJNQMP.js";var ee=j(R=>{var Tt=R&&R.__extends||(function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)i.hasOwnProperty(s)&&(r[s]=i[s])},n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}})();Object.defineProperty(R,"__esModule",{value:!0});var Rt=Object.prototype.hasOwnProperty;function ge(n,e){return Rt.call(n,e)}R.hasOwnProperty=ge;function Ke(n){if(Array.isArray(n)){for(var e=new Array(n.length),t=0;t<e.length;t++)e[t]=""+t;return e}if(Object.keys)return Object.keys(n);var r=[];for(var i in n)ge(n,i)&&r.push(i);return r}R._objectKeys=Ke;function xt(n){switch(typeof n){case"object":return JSON.parse(JSON.stringify(n));case"undefined":return null;default:return n}}R._deepClone=xt;function Ct(n){for(var e=0,t=n.length,r;e<t;){if(r=n.charCodeAt(e),r>=48&&r<=57){e++;continue}return!1}return!0}R.isInteger=Ct;function me(n){return n.indexOf("/")===-1&&n.indexOf("~")===-1?n:n.replace(/~/g,"~0").replace(/\//g,"~1")}R.escapePathComponent=me;function It(n){return n.replace(/~1/g,"/").replace(/~0/g,"~")}R.unescapePathComponent=It;function ye(n,e){var t;for(var r in n)if(ge(n,r)){if(n[r]===e)return me(r)+"/";if(typeof n[r]=="object"&&(t=ye(n[r],e),t!=""))return me(r)+"/"+t}return""}R._getPathRecursive=ye;function Dt(n,e){if(n===e)return"/";var t=ye(n,e);if(t==="")throw new Error("Object not found in root");return"/"+t}R.getPath=Dt;function pe(n){if(n===void 0)return!0;if(n){if(Array.isArray(n)){for(var e=0,t=n.length;e<t;e++)if(pe(n[e]))return!0}else if(typeof n=="object"){for(var r=Ke(n),i=r.length,s=0;s<i;s++)if(pe(n[r[s]]))return!0}}return!1}R.hasUndefined=pe;function Ye(n,e){var t=[n];for(var r in e){var i=typeof e[r]=="object"?JSON.stringify(e[r],null,2):e[r];typeof i<"u"&&t.push(r+": "+i)}return t.join(`
|
|
3
|
+
`)}var Ot=(function(n){Tt(e,n);function e(t,r,i,s,a){var l=this.constructor,d=n.call(this,Ye(t,{name:r,index:i,operation:s,tree:a}))||this;return d.name=r,d.index=i,d.operation=s,d.tree=a,Object.setPrototypeOf(d,l.prototype),d.message=Ye(t,{name:r,index:i,operation:s,tree:a}),d}return e})(Error);R.PatchError=Ot});var ve=j(v=>{Object.defineProperty(v,"__esModule",{value:!0});var C=ee();v.JsonPatchError=C.PatchError;v.deepClone=C._deepClone;var q={add:function(n,e,t){return n[e]=this.value,{newDocument:t}},remove:function(n,e,t){var r=n[e];return delete n[e],{newDocument:t,removed:r}},replace:function(n,e,t){var r=n[e];return n[e]=this.value,{newDocument:t,removed:r}},move:function(n,e,t){var r=te(t,this.path);r&&(r=C._deepClone(r));var i=N(t,{op:"remove",path:this.from}).removed;return N(t,{op:"add",path:this.path,value:i}),{newDocument:t,removed:r}},copy:function(n,e,t){var r=te(t,this.from);return N(t,{op:"add",path:this.path,value:C._deepClone(r)}),{newDocument:t}},test:function(n,e,t){return{newDocument:t,test:B(n[e],this.value)}},_get:function(n,e,t){return this.value=n[e],{newDocument:t}}},Ft={add:function(n,e,t){return C.isInteger(e)?n.splice(e,0,this.value):n[e]=this.value,{newDocument:t,index:e}},remove:function(n,e,t){var r=n.splice(e,1);return{newDocument:t,removed:r[0]}},replace:function(n,e,t){var r=n[e];return n[e]=this.value,{newDocument:t,removed:r}},move:q.move,copy:q.copy,test:q.test,_get:q._get};function te(n,e){if(e=="")return n;var t={op:"_get",path:e};return N(n,t),t.value}v.getValueByPointer=te;function N(n,e,t,r,i,s){if(t===void 0&&(t=!1),r===void 0&&(r=!0),i===void 0&&(i=!0),s===void 0&&(s=0),t&&(typeof t=="function"?t(e,0,n,e.path):re(e,0)),e.path===""){var a={newDocument:n};if(e.op==="add")return a.newDocument=e.value,a;if(e.op==="replace")return a.newDocument=e.value,a.removed=n,a;if(e.op==="move"||e.op==="copy")return a.newDocument=te(n,e.from),e.op==="move"&&(a.removed=n),a;if(e.op==="test"){if(a.test=B(n,e.value),a.test===!1)throw new v.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",s,e,n);return a.newDocument=n,a}else{if(e.op==="remove")return a.removed=n,a.newDocument=null,a;if(e.op==="_get")return e.value=n,a;if(t)throw new v.JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,e,n);return a}}else{r||(n=C._deepClone(n));var l=e.path||"",d=l.split("/"),o=n,c=1,h=d.length,m=void 0,u=void 0,f=void 0;for(typeof t=="function"?f=t:f=re;;){if(u=d[c],u&&u.indexOf("~")!=-1&&(u=C.unescapePathComponent(u)),i&&(u=="__proto__"||u=="prototype"&&c>0&&d[c-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(t&&m===void 0&&(o[u]===void 0?m=d.slice(0,c).join("/"):c==h-1&&(m=e.path),m!==void 0&&f(e,0,n,m)),c++,Array.isArray(o)){if(u==="-")u=o.length;else{if(t&&!C.isInteger(u))throw new v.JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s,e,n);C.isInteger(u)&&(u=~~u)}if(c>=h){if(t&&e.op==="add"&&u>o.length)throw new v.JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,e,n);var a=Ft[e.op].call(e,o,u,n);if(a.test===!1)throw new v.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",s,e,n);return a}}else if(c>=h){var a=q[e.op].call(e,o,u,n);if(a.test===!1)throw new v.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",s,e,n);return a}if(o=o[u],t&&c<h&&(!o||typeof o!="object"))throw new v.JsonPatchError("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,e,n)}}}v.applyOperation=N;function Ze(n,e,t,r,i){if(r===void 0&&(r=!0),i===void 0&&(i=!0),t&&!Array.isArray(e))throw new v.JsonPatchError("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");r||(n=C._deepClone(n));for(var s=new Array(e.length),a=0,l=e.length;a<l;a++)s[a]=N(n,e[a],t,!0,i,a),n=s[a].newDocument;return s.newDocument=n,s}v.applyPatch=Ze;function _t(n,e,t){var r=N(n,e);if(r.test===!1)throw new v.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",t,e,n);return r.newDocument}v.applyReducer=_t;function re(n,e,t,r){if(typeof n!="object"||n===null||Array.isArray(n))throw new v.JsonPatchError("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,n,t);if(q[n.op]){if(typeof n.path!="string")throw new v.JsonPatchError("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,n,t);if(n.path.indexOf("/")!==0&&n.path.length>0)throw new v.JsonPatchError('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,n,t);if((n.op==="move"||n.op==="copy")&&typeof n.from!="string")throw new v.JsonPatchError("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,n,t);if((n.op==="add"||n.op==="replace"||n.op==="test")&&n.value===void 0)throw new v.JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,n,t);if((n.op==="add"||n.op==="replace"||n.op==="test")&&C.hasUndefined(n.value))throw new v.JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,n,t);if(t){if(n.op=="add"){var i=n.path.split("/").length,s=r.split("/").length;if(i!==s+1&&i!==s)throw new v.JsonPatchError("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,n,t)}else if(n.op==="replace"||n.op==="remove"||n.op==="_get"){if(n.path!==r)throw new v.JsonPatchError("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,n,t)}else if(n.op==="move"||n.op==="copy"){var a={op:"_get",path:n.from,value:void 0},l=et([a],t);if(l&&l.name==="OPERATION_PATH_UNRESOLVABLE")throw new v.JsonPatchError("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,n,t)}}}else throw new v.JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,n,t)}v.validator=re;function et(n,e,t){try{if(!Array.isArray(n))throw new v.JsonPatchError("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)Ze(C._deepClone(e),C._deepClone(n),t||!0);else{t=t||re;for(var r=0;r<n.length;r++)t(n[r],r,e,void 0)}}catch(i){if(i instanceof v.JsonPatchError)return i;throw i}}v.validate=et;function B(n,e){if(n===e)return!0;if(n&&e&&typeof n=="object"&&typeof e=="object"){var t=Array.isArray(n),r=Array.isArray(e),i,s,a;if(t&&r){if(s=n.length,s!=e.length)return!1;for(i=s;i--!==0;)if(!B(n[i],e[i]))return!1;return!0}if(t!=r)return!1;var l=Object.keys(n);if(s=l.length,s!==Object.keys(e).length)return!1;for(i=s;i--!==0;)if(!e.hasOwnProperty(l[i]))return!1;for(i=s;i--!==0;)if(a=l[i],!B(n[a],e[a]))return!1;return!0}return n!==n&&e!==e}v._areEquals=B});var tt=j(Q=>{Object.defineProperty(Q,"__esModule",{value:!0});var A=ee(),Nt=ve(),Se=new WeakMap,Mt=(function(){function n(e){this.observers=new Map,this.obj=e}return n})(),Ht=(function(){function n(e,t){this.callback=e,this.observer=t}return n})();function kt(n){return Se.get(n)}function Lt(n,e){return n.observers.get(e)}function Ut(n,e){n.observers.delete(e.callback)}function qt(n,e){e.unobserve()}Q.unobserve=qt;function Qt(n,e){var t=[],r,i=kt(n);if(!i)i=new Mt(n),Se.set(n,i);else{var s=Lt(i,e);r=s&&s.observer}if(r)return r;if(r={},i.value=A._deepClone(n),e){r.callback=e,r.next=null;var a=function(){we(r)},l=function(){clearTimeout(r.next),r.next=setTimeout(a)};typeof window<"u"&&(window.addEventListener("mouseup",l),window.addEventListener("keyup",l),window.addEventListener("mousedown",l),window.addEventListener("keydown",l),window.addEventListener("change",l))}return r.patches=t,r.object=n,r.unobserve=function(){we(r),clearTimeout(r.next),Ut(i,r),typeof window<"u"&&(window.removeEventListener("mouseup",l),window.removeEventListener("keyup",l),window.removeEventListener("mousedown",l),window.removeEventListener("keydown",l),window.removeEventListener("change",l))},i.observers.set(e,new Ht(e,r)),r}Q.observe=Qt;function we(n,e){e===void 0&&(e=!1);var t=Se.get(n.object);be(t.value,n.object,n.patches,"",e),n.patches.length&&Nt.applyPatch(t.value,n.patches);var r=n.patches;return r.length>0&&(n.patches=[],n.callback&&n.callback(r)),r}Q.generate=we;function be(n,e,t,r,i){if(e!==n){typeof e.toJSON=="function"&&(e=e.toJSON());for(var s=A._objectKeys(e),a=A._objectKeys(n),l=!1,d=!1,o=a.length-1;o>=0;o--){var c=a[o],h=n[c];if(A.hasOwnProperty(e,c)&&!(e[c]===void 0&&h!==void 0&&Array.isArray(e)===!1)){var m=e[c];typeof h=="object"&&h!=null&&typeof m=="object"&&m!=null&&Array.isArray(h)===Array.isArray(m)?be(h,m,t,r+"/"+A.escapePathComponent(c),i):h!==m&&(l=!0,i&&t.push({op:"test",path:r+"/"+A.escapePathComponent(c),value:A._deepClone(h)}),t.push({op:"replace",path:r+"/"+A.escapePathComponent(c),value:A._deepClone(m)}))}else Array.isArray(n)===Array.isArray(e)?(i&&t.push({op:"test",path:r+"/"+A.escapePathComponent(c),value:A._deepClone(h)}),t.push({op:"remove",path:r+"/"+A.escapePathComponent(c)}),d=!0):(i&&t.push({op:"test",path:r,value:n}),t.push({op:"replace",path:r,value:e}),l=!0)}if(!(!d&&s.length==a.length))for(var o=0;o<s.length;o++){var c=s[o];!A.hasOwnProperty(n,c)&&e[c]!==void 0&&t.push({op:"add",path:r+"/"+A.escapePathComponent(c),value:A._deepClone(e[c])})}}}function $t(n,e,t){t===void 0&&(t=!1);var r=[];return be(n,e,r,"",t),r}Q.compare=$t});var rt=j(M=>{var zt=ve();Object.assign(M,zt);var Jt=tt();Object.assign(M,Jt);var ne=ee();M.JsonPatchError=ne.PatchError;M.deepClone=ne._deepClone;M.escapePathComponent=ne.escapePathComponent;M.unescapePathComponent=ne.unescapePathComponent});var T=class extends Error{patternId;disposition;cause;constructor(e,t,r){super(`${t}: pattern ${e}: ${r instanceof Error?r.message:String(r)}`),this.name="PatternMutationError",this.patternId=e,this.disposition=t,this.cause=r}};function ir(n){return n instanceof T&&n.disposition==="COMMITTED_PENDING_INDEX"?n.patternId:null}pt();import{existsSync as tr}from"node:fs";import{join as dt}from"node:path";_e();qe();var J=class{constructor(e,t){this.createAdapter=e;this.config=t?.base??K,this.rvfPath=t?.rvfPath??".agentic-qe/patterns.rvf",this.skipCloseOnDispose=t?.skipCloseOnDispose??!1,this.embeddingSpaceId=t?.embeddingSpaceId}createAdapter;config;rvfPath;skipCloseOnDispose;embeddingSpaceId;adapter=null;sqliteStore=null;initialized=!1;rvfInitError=null;searchOps=0;totalSearchMs=0;setSqliteStore(e){this.sqliteStore=e}getAdapter(){return this.adapter}async initialize(){if(!this.initialized){if(this.rvfInitError=null,process.env.AQE_MEMORY_BACKEND==="memory"){this.adapter=null,this.initialized=!0;return}try{!this.embeddingSpaceId&&!x()&&await V();let e=x()?.spaceId??this.embeddingSpaceId??null;e?(this.adapter=this.createAdapter(this.rvfPath,this.config.embeddingDimension),ze(this.rvfPath,e,this.adapter.status()?.totalVectors??0),this.initialized=!0,console.log(`[RvfPatternStore] Initialized: ${this.rvfPath} (dim=${this.config.embeddingDimension})`)):(this.rvfInitError=Qe,this.adapter=null,this.initialized=!0,$e())}catch(e){this.rvfInitError=b(e);try{this.adapter?.close()}catch{}console.error(`[RvfPatternStore] ERROR: RVF initialization failed \u2014 vector search is DISABLED. Cause: ${this.rvfInitError}. Fix: check the embedder endpoint and @ruvector/rvf-node binding, or set RUVECTOR_USE_RVF_PATTERN_STORE=false to use SQLite HNSW.`),this.adapter=null,this.initialized=!0}if(!this.sqliteStore)try{let{createSQLitePatternStore:e}=await import("./sqlite-persistence-IXCNZRTW.js"),t=e();await t.initialize(),this.sqliteStore=t}catch{}await this.purgeOrphanedVectors()}}async purgeOrphanedVectors(){if(!(!this.adapter||!this.sqliteStore))try{let e=this.adapter.status()?.totalVectors??0,t=this.sqliteStore.getStats()?.totalPatterns??0;if(e<=t)return;let{readFileSync:r,existsSync:i}=await import("node:fs"),s=`${this.rvfPath}.idmap.json`;if(!i(s))return;let a=JSON.parse(r(s,"utf-8")),l=new Set((a.entries??[]).map(c=>Array.isArray(c)?c[0]:void 0).filter(c=>typeof c=="string")),d=new Set(this.sqliteStore.getPatterns({limit:1e4}).map(c=>c.id)),o=[...l].filter(c=>!d.has(c));if(o.length===0)return;this.adapter.delete(o),console.log(`[RvfPatternStore] Removed ${o.length} ghost vectors (index ${e} > DB ${t})`)}catch(e){console.warn(`[RvfPatternStore] orphan purge skipped: ${b(e)}`)}}async dispose(){if(this.adapter&&!this.skipCloseOnDispose)try{this.adapter.close()}catch{}this.adapter=null,this.initialized=!1}async store(e){await this.ensureInitialized();let t=Y(e);if(!t.valid)return w(new Error(`Invalid pattern: ${t.errors.join(", ")}`));if(e.confidence<this.config.minConfidence)return w(new Error(`Pattern confidence ${e.confidence} below threshold ${this.config.minConfidence}`));if(!this.sqliteStore)return w(new T(e.id,"FAILED",new Error("authoritative SQLite pattern store is unavailable")));let r=x()?.spaceId??this.embeddingSpaceId;if(e.embedding&&!r)return w(new Error("VECTOR_SPACE_UNVERIFIED: refusing to persist or index an embedding without runtime provenance"));let i=!1;if(this.sqliteStore)try{let s=this.sqliteStore.storePattern(e,e.embedding,r);s&&s!==e.id&&(e.id=s),i=!0}catch(s){return w(new T(e.id,"FAILED",s))}if(e.embedding&&!this.adapter&&this.rvfInitError)return w(new T(e.id,i?"COMMITTED_PENDING_INDEX":"FAILED",new Error(`RVF unavailable ${i?"after":"before"} authoritative pattern commit: ${this.rvfInitError}`)));if(e.embedding&&this.adapter)try{let s=e.embedding instanceof Float32Array?e.embedding:new Float32Array(e.embedding),a=this.adapter.ingest([{id:e.id,vector:s}]);if(a.accepted!==1||a.rejected!==0)throw new Error(`RVF rejected pattern vector (accepted=${a.accepted}, rejected=${a.rejected})`)}catch(s){return w(new T(e.id,i?"COMMITTED_PENDING_INDEX":"FAILED",s))}return P(e.id)}async create(e){let t=e.confidence??.5,r=e.qeDomain??"test-generation",i={id:F(),patternType:e.patternType,qeDomain:r,domain:r,name:e.name,description:e.description,confidence:t,usageCount:0,successRate:0,qualityScore:G({confidence:t,usageCount:0,successRate:0}),context:{tags:[],...e.context},template:{example:"",...e.template},embedding:e.embedding,tier:"short-term",createdAt:new Date,lastUsedAt:new Date,successfulUses:0,reusable:!1,reuseCount:0,averageTokenSavings:0},s=await this.store(i);return s.success?P(i):w(s.error)}async get(e){if(this.sqliteStore)try{return this.sqliteStore.getPattern(e)??null}catch{return null}return null}async search(e,t={}){await this.ensureInitialized();let r=performance.now(),i=t.limit??10,s=[];if(Array.isArray(e)){let d=x()?.spaceId??this.embeddingSpaceId;if(!d||t.embeddingSpaceId!==d)return w(new Error("VECTOR_SPACE_UNVERIFIED: pre-computed query vectors require the active embeddingSpaceId"))}if(Array.isArray(e)&&this.adapter)try{let d=e instanceof Float32Array?e:new Float32Array(e),o=this.adapter.search(d,i*2);for(let c of o){let h=await this.get(c.id);if(h&&this.matchesFilters(h,t)){let m=this.calculateReuseInfo(h,c.score);s.push({pattern:h,score:c.score,matchType:"vector",similarity:c.score,canReuse:m.canReuse,estimatedTokenSavings:m.estimatedTokenSavings,reuseConfidence:m.reuseConfidence})}}}catch(d){console.warn("[RvfPatternStore] RVF search failed:",b(d))}if(Array.isArray(e)&&!this.adapter&&this.sqliteStore&&s.length===0)try{let d=x()?.spaceId??this.embeddingSpaceId,o=this.sqliteStore.getAllEmbeddings(),c=e,h=Math.sqrt(c.reduce((m,u)=>m+u*u,0));if(h>0)for(let m of o){if(!d||m.spaceId!==d)continue;let u=this.sqliteStore.getPattern(m.patternId);if(!u||!this.matchesFilters(u,t))continue;let f=m.embedding;if(!f||f.length!==c.length)continue;let y=0,p=0;for(let E=0;E<c.length;E++)y+=c[E]*f[E],p+=f[E]*f[E];if(p=Math.sqrt(p),p===0)continue;let g=y/(h*p),S=this.calculateReuseInfo(u,g);s.push({pattern:u,score:g,matchType:"vector",similarity:g,canReuse:S.canReuse,estimatedTokenSavings:S.estimatedTokenSavings,reuseConfidence:S.reuseConfidence})}}catch{}if(typeof e=="string"&&!e.trim()&&this.sqliteStore)try{let d=this.sqliteStore.getPatterns({limit:i*2}),o=new Set(s.map(c=>c.pattern.id));for(let c of d)o.has(c.id)||this.matchesFilters(c,t)&&s.push({pattern:c,score:c.confidence,matchType:"context",similarity:0,canReuse:!1,estimatedTokenSavings:0,reuseConfidence:0})}catch{}let a=typeof e=="string"?e:t.textQuery;if(a?.trim()&&this.sqliteStore)try{let d=this.sqliteStore.searchFTS(a,i*2),o=new Set(s.map(h=>h.pattern.id)),c=new Map(d.map(h=>[h.id,h.ftsScore*h.coverage]));for(let h of s){let m=c.get(h.pattern.id);m!==void 0&&(h.score=de(h.score,m))}for(let h of d){if(o.has(h.id))continue;let m=await this.get(h.id);if(m&&this.matchesFilters(m,t)){let u=.5*h.ftsScore*h.coverage;s.push({pattern:m,score:u,matchType:"lexical",similarity:0,canReuse:!1,estimatedTokenSavings:0,reuseConfidence:0})}}}catch{}s.sort((d,o)=>o.score-d.score);let l=performance.now()-r;return this.searchOps++,this.totalSearchMs+=l,P(s.slice(0,i))}async recordUsage(e,t,r,i){if(!this.sqliteStore)return w(new Error("No SQLite store attached"));try{let s=this.sqliteStore;return await U(s.getDatabase(),()=>s.recordUsage(e,t,r,i)),P(void 0)}catch(s){return w(new Error(`recordUsage failed: ${b(s)}`))}}async promote(e){if(!this.sqliteStore)return w(new Error("No SQLite store attached"));try{let t=this.sqliteStore;return await U(t.getDatabase(),()=>t.promotePattern(e)),P(void 0)}catch(t){return w(new Error(`promote failed: ${b(t)}`))}}async delete(e){if(this.adapter)try{this.adapter.delete([e])}catch(t){console.warn(`[RvfPatternStore] RVF delete failed for ${e}:`,b(t))}if(this.sqliteStore)try{this.sqliteStore.deletePattern(e)}catch(t){return w(new Error(`SQLite delete failed: ${b(t)}`))}return P(void 0)}async getStats(){let e=this.adapter?.status(),t=0,r={},i={shortTerm:0,longTerm:0};if(this.sqliteStore)try{let s=this.sqliteStore.getStats();t=s.totalPatterns,r=s.byDomain,i={shortTerm:s.byTier["short-term"]??0,longTerm:s.byTier["long-term"]??0}}catch{}return{totalPatterns:t,byTier:i,byDomain:r,byType:{},avgConfidence:0,avgQualityScore:0,avgSuccessRate:0,searchOperations:this.searchOps,avgSearchLatencyMs:this.searchOps>0?this.totalSearchMs/this.searchOps:0,hnswStats:{nativeAvailable:this.adapter!==null,vectorCount:e?.totalVectors??0,indexSizeBytes:e?.fileSizeBytes??0,...this.rvfInitError?{rvfInitError:this.rvfInitError}:{}}}}async cleanup(){if(!this.sqliteStore)return{removed:0,promoted:0};let e=0,t=0;try{let r=this.sqliteStore.getPatterns({limit:1e4});for(let i of r)i.confidence<this.config.minConfidence&&i.usageCount>3?(await this.delete(i.id),e++):i.tier==="short-term"&&i.successfulUses>=X&&(await this.promote(i.id),t++)}catch(r){console.warn("[RvfPatternStore] Cleanup error:",b(r))}return{removed:e,promoted:t}}async ensureInitialized(){this.initialized||await this.initialize()}matchesFilters(e,t){return!(t.patternType&&e.patternType!==t.patternType||t.domain&&e.qeDomain!==t.domain||t.tier&&e.tier!==t.tier||t.minConfidence&&e.confidence<t.minConfidence||t.minQualityScore&&e.qualityScore<t.minQualityScore)}calculateReuseInfo(e,t){let r=this.config.reuseOptimization,i=r.enabled&&t>=r.minSimilarityForReuse&&e.successRate>=r.minSuccessRateForReuse;return{canReuse:i,estimatedTokenSavings:i?500:0,reuseConfidence:i?t*e.successRate:0}}};gt();_e();_();function vt(n,e){let r=[n.pattern,n];for(let i of r){let s=e.split("."),a=i;for(let l of s){if(a==null)break;if(typeof a=="object"&&Object.hasOwn(a,l))a=a[l];else{a=void 0;break}}if(a!==void 0)return a}}function wt(n,e,t){switch(e){case"eq":return n===t;case"gt":return typeof n=="number"&&typeof t=="number"&&n>t;case"lt":return typeof n=="number"&&typeof t=="number"&&n<t;case"gte":return typeof n=="number"&&typeof t=="number"&&n>=t;case"lte":return typeof n=="number"&&typeof t=="number"&&n<=t;case"in":return Array.isArray(t)?t.includes(n):!1;case"contains":return Array.isArray(n)||typeof n=="string"&&typeof t=="string"?n.includes(t):!1;case"between":{if(typeof n!="number"||!Array.isArray(t)||t.length!==2){if(n instanceof Date&&Array.isArray(t)&&t.length===2){let s=n.getTime(),a=t[0]instanceof Date?t[0].getTime():Number(t[0]),l=t[1]instanceof Date?t[1].getTime():Number(t[1]);return s>=a&&s<=l}return!1}let[r,i]=t;return n>=r&&n<=i}default:return!1}}function Z(n,e){switch(e.type){case"AND":return(e.children??[]).every(r=>Z(n,r));case"OR":{let t=e.children??[];return t.length===0?!0:t.some(r=>Z(n,r))}case"NOT":return e.child?!Z(n,e.child):!0;case"FIELD":{if(!e.field||!e.operator)return!0;let t=vt(n,e.field);return wt(t,e.operator,e.value)}default:return!0}}function Je(n,e){return e?n.filter(t=>Z(t,e)):n}_();_();var je=1e4,We=2166136261;function Ve(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}var fe=new Uint8Array(256);for(let n=0;n<256;n++){let e=0,t=n;for(;t;)e++,t&=t-1;fe[n]=e}var Be="0123456789abcdef";function St(n){let e=Math.min(n.length,16),t="";for(let r=0;r<e;r++){let i=n[r];t+=Be[i>>4]+Be[i&15]}return t}function bt(n,e){if(n.length!==e.length)throw new Error(`Cannot bind vectors of different lengths: ${n.length} vs ${e.length}`);let t=new Uint8Array(n.length);for(let r=0;r<n.length;r++)t[r]=n[r]^e[r];return t}function Pt(n){if(n.length===0)throw new Error("Cannot bundle zero vectors");let e=n[0].length;for(let i=1;i<n.length;i++)if(n[i].length!==e)throw new Error(`Vector length mismatch at index ${i}: expected ${e}, got ${n[i].length}`);let t=new Uint8Array(e),r=n.length/2;for(let i=0;i<e;i++){let s=0;for(let a=0;a<8;a++){let l=0,d=1<<a;for(let o=0;o<n.length;o++)n[o][i]&d&&l++;l>=r&&(s|=d)}t[i]=s}return t}function Et(n,e,t){if(n.length!==e.length)throw new Error(`Cannot compute Hamming distance for vectors of different lengths: ${n.length} vs ${e.length}`);let r=0;for(let s=0;s<n.length;s++)r+=fe[n[s]^e[s]];let i=t??n.length*8;return i>0?r/i:0}function At(n,e,t){return 1-Et(n,e,t)}var ue=class{dimensions;baseSeed;byteLen;tokenCache=new Map;constructor(e){if(this.dimensions=e?.dimensions??je,this.baseSeed=e?.seed??We,this.byteLen=Math.ceil(this.dimensions/8),this.dimensions<=0)throw new Error(`HDC dimensions must be positive, got ${this.dimensions}`)}tokenToHypervector(e){let t=this.tokenCache.get(e);if(t)return new Uint8Array(t);let r=Ve(e)^this.baseSeed,i=this.generateSeededVector(r);return this.tokenCache.set(e,i),new Uint8Array(i)}fingerprintPattern(e){if(e.length===0)return new Uint8Array(this.byteLen);let t=this.tokenToHypervector(e[0]);for(let r=1;r<e.length;r++)t=bt(t,this.tokenToHypervector(e[r]));return t}fingerprintWithContext(e,t){let r=this.fingerprintPattern(e);if(t.length===0)return r;let i=this.fingerprintPattern(t);return Pt([r,i])}similarity(e,t){return At(e,t,this.dimensions)}generateSeededVector(e){let t=new Uint8Array(this.byteLen),r=new ce(e),i=0;for(;i<this.byteLen;){let a=r.next(),l=Math.min(4,this.byteLen-i);for(let d=0;d<l;d++)t[i++]=a>>>d*8&255}let s=this.dimensions%8;return s>0&&(t[this.byteLen-1]&=(1<<s)-1),t}},he=class{dimensions;baseSeed;constructor(e){if(this.dimensions=e?.dimensions??je,this.baseSeed=e?.seed??We,this.dimensions<=0)throw new Error(`HDC dimensions must be positive, got ${this.dimensions}`)}fingerprint(e){let t=`${e.id}|${e.domain}|${e.type}|${e.content??""}`,r=Ve(t)^this.baseSeed,i=this.generateVector(r);return{vector:i,dimensions:this.dimensions,hash:St(i)}}compositionalBind(e,t){if(e.length!==t.length)throw new Error(`Cannot bind vectors of different lengths: ${e.length} vs ${t.length}`);let r=new Uint8Array(e.length);for(let i=0;i<e.length;i++)r[i]=e[i]^t[i];return r}hammingDistance(e,t){if(e.length!==t.length)throw new Error(`Cannot compute Hamming distance for vectors of different lengths: ${e.length} vs ${t.length}`);let r=0;for(let i=0;i<e.length;i++)r+=fe[e[i]^t[i]];return r}similarity(e,t){return 1-this.hammingDistance(e,t)/this.dimensions}batchFingerprint(e){return e.map(t=>this.fingerprint(t))}generateVector(e){let t=Math.ceil(this.dimensions/8),r=new Uint8Array(t),i=new ce(e),s=0;for(;s<t;){let l=i.next(),d=t-s,o=d<4?d:4;for(let c=0;c<o;c++)r[s++]=l>>>c*8&255}let a=this.dimensions%8;return a>0&&(r[t-1]&=(1<<a)-1),r}};function Ge(n){return new he(n)}function Xe(n){return z()?new ue(n):null}qe();var Ee=mt(rt(),1),Pe=Ee.default??Ee,Bt=`
|
|
4
|
+
CREATE TABLE IF NOT EXISTS pattern_deltas (
|
|
5
|
+
id TEXT PRIMARY KEY,
|
|
6
|
+
pattern_id TEXT NOT NULL,
|
|
7
|
+
version INTEGER NOT NULL,
|
|
8
|
+
timestamp INTEGER NOT NULL,
|
|
9
|
+
type TEXT NOT NULL CHECK (type IN ('genesis', 'update', 'rollback')),
|
|
10
|
+
patch TEXT NOT NULL DEFAULT '[]',
|
|
11
|
+
reverse_patch TEXT NOT NULL DEFAULT '[]',
|
|
12
|
+
metadata TEXT
|
|
13
|
+
);
|
|
14
|
+
CREATE INDEX IF NOT EXISTS idx_pattern_deltas_pid_version
|
|
15
|
+
ON pattern_deltas (pattern_id, version);
|
|
16
|
+
CREATE INDEX IF NOT EXISTS idx_pattern_deltas_timestamp
|
|
17
|
+
ON pattern_deltas (timestamp);
|
|
18
|
+
`;function nt(n,e){let t=Pe.compare(n,e),r=Pe.compare(e,n);return{forward:t,reverse:r}}function jt(n,e){let t=JSON.parse(JSON.stringify(n));return Pe.applyPatch(t,e).newDocument}function it(n){return{id:n.id,patternId:n.pattern_id,version:n.version,timestamp:n.timestamp,type:n.type,patch:JSON.parse(n.patch),reversePatch:JSON.parse(n.reverse_patch),metadata:n.metadata?JSON.parse(n.metadata):void 0}}var ie=class{db;config;prepared=new Map;initialized=!1;constructor(e,t){this.db=e,this.config={maxVersionsPerPattern:t?.maxVersionsPerPattern??100,compressDeltas:t?.compressDeltas??!1}}initialize(){this.initialized||(this.db.exec(Bt),this.prepareStatements(),this.initialized=!0)}prepareStatements(){this.prepared.set("insert",this.db.prepare(`
|
|
19
|
+
INSERT INTO pattern_deltas (id, pattern_id, version, timestamp, type, patch, reverse_patch, metadata)
|
|
20
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
21
|
+
`)),this.prepared.set("getHistory",this.db.prepare(`
|
|
22
|
+
SELECT * FROM pattern_deltas
|
|
23
|
+
WHERE pattern_id = ?
|
|
24
|
+
ORDER BY version ASC
|
|
25
|
+
`)),this.prepared.set("currentVersion",this.db.prepare(`
|
|
26
|
+
SELECT MAX(version) as max_version FROM pattern_deltas
|
|
27
|
+
WHERE pattern_id = ?
|
|
28
|
+
`)),this.prepared.set("incrementalSync",this.db.prepare(`
|
|
29
|
+
SELECT * FROM pattern_deltas
|
|
30
|
+
WHERE timestamp > ?
|
|
31
|
+
ORDER BY timestamp ASC
|
|
32
|
+
`)),this.prepared.set("countForPattern",this.db.prepare(`
|
|
33
|
+
SELECT COUNT(*) as cnt FROM pattern_deltas
|
|
34
|
+
WHERE pattern_id = ?
|
|
35
|
+
`)),this.prepared.set("deleteOldest",this.db.prepare(`
|
|
36
|
+
DELETE FROM pattern_deltas
|
|
37
|
+
WHERE pattern_id = ? AND version IN (
|
|
38
|
+
SELECT version FROM pattern_deltas
|
|
39
|
+
WHERE pattern_id = ?
|
|
40
|
+
ORDER BY version ASC
|
|
41
|
+
LIMIT ?
|
|
42
|
+
)
|
|
43
|
+
`))}ensureInitialized(){if(!this.initialized)throw new Error("DeltaTracker not initialized. Call initialize() first.")}createGenesisWhenUnlocked(e,t,r){return U(this.db,()=>this.createGenesis(e,t,r))}recordDeltaWhenUnlocked(e,t,r,i){return U(this.db,()=>this.recordDelta(e,t,r,i))}createGenesis(e,t,r){this.ensureInitialized();let i=this.getCurrentVersion(e);if(i>=0)throw new Error(`Genesis already exists for pattern ${e} (current version: ${i})`);let s={id:F(),patternId:e,version:0,timestamp:Date.now(),type:"genesis",patch:[],reversePatch:[],metadata:{...r,snapshot:t}};return this.insertEvent(s),s}recordDelta(e,t,r,i){this.ensureInitialized();let s=this.getCurrentVersion(e);if(s<0)throw new Error(`No genesis found for pattern ${e}. Call createGenesis() first.`);let{forward:a,reverse:l}=nt(t,r),d={id:F(),patternId:e,version:s+1,timestamp:Date.now(),type:"update",patch:a,reversePatch:l,metadata:i};return this.insertEvent(d),this.enforceRetention(e),d}rollback(e,t){this.ensureInitialized();let r=this.getHistory(e);if(r.length===0)throw new Error(`No history found for pattern ${e}`);let i=r[r.length-1].version;if(t<0||t>i)throw new Error(`Invalid rollback version ${t}. Valid range: 0-${i}`);if(t===i)return this.reconstructState(r,i);let s=this.reconstructState(r,t),a=this.reconstructState(r,i),{forward:l,reverse:d}=nt(a,s),o={id:F(),patternId:e,version:i+1,timestamp:Date.now(),type:"rollback",patch:l,reversePatch:d,metadata:{rolledBackTo:t}};return this.insertEvent(o),this.enforceRetention(e),s}getHistory(e){return this.ensureInitialized(),this.prepared.get("getHistory").all(e).map(it)}incrementalSync(e){return this.ensureInitialized(),this.prepared.get("incrementalSync").all(e).map(it)}getCurrentVersion(e){return this.ensureInitialized(),this.prepared.get("currentVersion").get(e).max_version??-1}insertEvent(e){this.prepared.get("insert").run(e.id,e.patternId,e.version,e.timestamp,e.type,JSON.stringify(e.patch),JSON.stringify(e.reversePatch),e.metadata?JSON.stringify(e.metadata):null)}reconstructState(e,t){let r=e.find(s=>s.type==="genesis");if(!r||!r.metadata?.snapshot)throw new Error("Cannot reconstruct state: no genesis snapshot found");let i=JSON.parse(JSON.stringify(r.metadata.snapshot));for(let s of e)if(s.version!==0){if(s.version>t)break;i=jt(i,s.patch)}return i}enforceRetention(e){let{maxVersionsPerPattern:t}=this.config,i=this.prepared.get("countForPattern").get(e).cnt;if(i>t){let s=i-t;this.db.prepare(`DELETE FROM pattern_deltas
|
|
44
|
+
WHERE pattern_id = ? AND version != 0 AND id IN (
|
|
45
|
+
SELECT id FROM pattern_deltas
|
|
46
|
+
WHERE pattern_id = ? AND version != 0
|
|
47
|
+
ORDER BY version ASC
|
|
48
|
+
LIMIT ?
|
|
49
|
+
)`).run(e,e,s)}}};_();var Wt={maxHistoryPerPattern:50,snapshotInterval:10,batchSize:20,epsilon:1e-7},Ae=class{config;history=new Map;snapshots=new Map;versions=new Map;buffer=[];constructor(e){this.config={...Wt,...e}}recordGenesis(e,t,r){if(this.versions.has(e))throw new Error(`Genesis already exists for pattern ${e} (version ${this.versions.get(e)})`);let i=this.computeSparseChanges(new Array(t.length).fill(0),t),s={patternId:e,version:0,timestamp:Date.now(),deltaType:"genesis",sparseChanges:i,metadata:r,compressedSize:i.length},a={patternId:e,version:0,fullVector:[...t],timestamp:s.timestamp};return this.versions.set(e,0),this.getOrCreate(this.history,e).push(s),this.getOrCreate(this.snapshots,e).push(a),this.buffer.push(s),s}recordDelta(e,t,r,i){let s=this.versions.get(e);if(s===void 0)throw new Error(`No genesis found for pattern ${e}. Call recordGenesis() first.`);let a=s+1,l=this.computeSparseChanges(t,r),d={patternId:e,version:a,timestamp:Date.now(),deltaType:"update",sparseChanges:l,metadata:i,compressedSize:l.length};return this.versions.set(e,a),this.getOrCreate(this.history,e).push(d),this.buffer.push(d),a%this.config.snapshotInterval===0&&this.getOrCreate(this.snapshots,e).push({patternId:e,version:a,fullVector:[...r],timestamp:d.timestamp}),this.enforceRetention(e),d}getHistory(e,t){let r=this.history.get(e);if(!r||r.length===0)return[];let i=[...r].reverse();return t!==void 0&&t>0?i.slice(0,t):i}rollback(e,t){let r=this.reconstructAtVersion(e,t);return r===null?null:{patternId:e,version:t,fullVector:r,timestamp:Date.now()}}getVersion(e){return this.versions.get(e)??-1}reconstructAtVersion(e,t){let r=this.history.get(e);if(!r||r.length===0)return null;let i=this.versions.get(e);if(t<0||t>i)return null;let s=this.snapshots.get(e)||[],a=null;for(let o=s.length-1;o>=0;o--)if(s[o].version<=t){a=s[o];break}if(!a)return null;let l=[...a.fullVector],d=a.version+1;for(let o of r)if(!(o.version<d)){if(o.version>t)break;this.applySparseForward(l,o.sparseChanges)}return l}pruneHistory(e,t){let r=t??this.config.maxHistoryPerPattern,i=this.history.get(e);if(!i||i.length<=r)return 0;let s=i.length-r,a=i.slice(0,s),l=i.slice(s),d=a.findIndex(h=>h.deltaType==="genesis");d>=0&&(l.unshift(a[d]),a.splice(d,1)),this.history.set(e,l);let o=l[0]?.version??0,c=this.snapshots.get(e);return c&&this.snapshots.set(e,c.filter(h=>h.version===0||h.version>=o)),a.length}getStats(){let e=0;for(let r of this.history.values())e+=r.length;let t=this.history.size;return{totalPatterns:t,totalDeltas:e,avgDeltasPerPattern:t>0?e/t:0}}flush(){let e=[...this.buffer];return this.buffer.length=0,e}getBufferSize(){return this.buffer.length}clear(){this.history.clear(),this.snapshots.clear(),this.versions.clear(),this.buffer.length=0}computeSparseChanges(e,t){let r=[],i=Math.max(e.length,t.length);for(let s=0;s<i;s++){let a=s<e.length?e[s]:0,l=s<t.length?t[s]:0;Math.abs(a-l)>this.config.epsilon&&r.push({index:s,oldValue:a,newValue:l})}return r}applySparseForward(e,t){for(let r of t){for(;e.length<=r.index;)e.push(0);e[r.index]=r.newValue}}enforceRetention(e){this.pruneHistory(e,this.config.maxHistoryPerPattern)}getOrCreate(e,t){let r=e.get(t);return r||(r=[],e.set(t,r)),r}};function st(n){return k()?new Ae(n):null}_();var Vt=128,Gt=8,Xt=1e4,Te=class{dimension;beta;maxPatterns;patterns;constructor(e){if(this.dimension=e?.dimension??Vt,this.beta=e?.beta??Gt,this.maxPatterns=e?.maxPatterns??Xt,this.patterns=[],this.dimension<=0)throw new Error(`Hopfield dimension must be positive, got ${this.dimension}`);if(this.beta<=0)throw new Error(`Hopfield beta must be positive, got ${this.beta}`);if(this.maxPatterns<=0)throw new Error(`Hopfield maxPatterns must be positive, got ${this.maxPatterns}`)}store(e,t){if(this.assertEnabled(),e.length!==this.dimension)throw new Error(`Pattern dimension mismatch: expected ${this.dimension}, got ${e.length}`);if(this.dotProduct(e,e)===0)throw new Error("Cannot store zero-magnitude pattern in Hopfield memory");let i=this.normalize(e);this.patterns.length>=this.maxPatterns&&this.patterns.shift(),this.patterns.push({pattern:i,metadata:t??{},storedAt:Date.now()})}recall(e){if(this.assertEnabled(),e.length!==this.dimension)throw new Error(`Query dimension mismatch: expected ${this.dimension}, got ${e.length}`);if(this.patterns.length===0)return null;let t=this.normalize(e),r=new Float32Array(this.patterns.length);for(let c=0;c<this.patterns.length;c++)r[c]=this.beta*this.dotProduct(this.patterns[c].pattern,t);let i=this.softmax(r),s=0,a=i[0];for(let c=1;c<i.length;c++)i[c]>a&&(a=i[c],s=c);let l=this.patterns[s],d=this.getEnergy(t),o=this.cosineSimilarity(t,l.pattern);return{pattern:new Float32Array(l.pattern),metadata:{...l.metadata},energy:d,similarity:o}}batchRecall(e){return this.assertEnabled(),e.map(t=>this.recall(t))}getPatternCount(){return this.patterns.length}clear(){this.patterns.length=0}getEnergy(e){if(e.length!==this.dimension)throw new Error(`State dimension mismatch: expected ${this.dimension}, got ${e.length}`);let t=this.normalize(e);if(this.patterns.length===0)return .5*this.dotProduct(t,t);let r=new Float32Array(this.patterns.length);for(let o=0;o<this.patterns.length;o++)r[o]=this.dotProduct(this.patterns[o].pattern,t);let i=new Float32Array(this.patterns.length),s=-1/0;for(let o=0;o<this.patterns.length;o++)i[o]=this.beta*r[o],i[o]>s&&(s=i[o]);let a=0;for(let o=0;o<this.patterns.length;o++)a+=Math.exp(i[o]-s);let l=1/this.beta*(s+Math.log(a)),d=this.dotProduct(t,t);return-l+.5*d}softmax(e){let t=new Float32Array(e.length),r=-1/0;for(let s=0;s<e.length;s++)e[s]>r&&(r=e[s]);let i=0;for(let s=0;s<e.length;s++)t[s]=Math.exp(e[s]-r),i+=t[s];if(i>0)for(let s=0;s<t.length;s++)t[s]/=i;return t}dotProduct(e,t){let r=0;for(let i=0;i<e.length;i++)r+=e[i]*t[i];return r}cosineSimilarity(e,t){let r=this.dotProduct(e,t),i=Math.sqrt(this.dotProduct(e,e)),s=Math.sqrt(this.dotProduct(t,t));return i===0||s===0?0:r/(i*s)}normalize(e){let t=Math.sqrt(this.dotProduct(e,e)),r=new Float32Array(e.length);if(t>0)for(let i=0;i<e.length;i++)r[i]=e[i]/t;return r}assertEnabled(){if(!O().useHopfieldMemory)throw new Error("Hopfield memory is disabled (useHopfieldMemory feature flag is false)")}};function at(n){return new Te(n)}_();var Yt={dimensions:32,curvature:-1,maxElements:1e4,efConstruction:200,M:16},H=1e-5,ot=1-H;function Kt(n,e){let t=0;for(let r=0;r<n.length;r++)t+=n[r]*e[r];return t}function I(n){let e=0;for(let t=0;t<n.length;t++)e+=n[t]*n[t];return e}function Zt(n,e){let t=new Float32Array(n.length);for(let r=0;r<n.length;r++)t[r]=n[r]-e[r];return t}var D=class n{static poincareDistance(e,t){let r=I(Zt(e,t)),i=Math.max(H,1-I(e)),s=Math.max(H,1-I(t));return Math.acosh(Math.max(1,1+2*r/(i*s)))}static mobiusAdd(e,t){let r=Kt(e,t),i=I(e),s=I(t),a=Math.max(H,1+2*r+i*s),l=1+2*r+s,d=1-i,o=new Float32Array(e.length);for(let c=0;c<e.length;c++)o[c]=(l*e[c]+d*t[c])/a;return n.project(o)}static expMap(e,t){let r=2/Math.max(H,1-I(e)),i=Math.sqrt(I(t));if(i<H)return new Float32Array(e);let s=Math.tanh(r*i/2),a=new Float32Array(t.length);for(let l=0;l<t.length;l++)a[l]=s/i*t[l];return n.mobiusAdd(e,a)}static project(e){let t=Math.sqrt(I(e));if(t<=ot)return new Float32Array(e);let r=ot/t,i=new Float32Array(e.length);for(let s=0;s<e.length;s++)i[s]=e[s]*r;return i}static euclideanToHyperbolic(e){let t=Math.sqrt(I(e));if(t<H)return new Float32Array(e.length);let r=Math.tanh(t)/t,i=new Float32Array(e.length);for(let s=0;s<e.length;s++)i[s]=e[s]*r;return n.project(i)}},Re=class{config;points=new Map;constructor(e){if(this.config={...Yt,...e},this.config.dimensions<=0)throw new Error(`dimensions must be positive, got ${this.config.dimensions}`);if(this.config.curvature>=0)throw new Error(`curvature must be negative for hyperbolic space, got ${this.config.curvature}`);if(this.config.maxElements<=0)throw new Error(`maxElements must be positive, got ${this.config.maxElements}`)}insert(e,t,r){if(t.length!==this.config.dimensions)throw new Error(`Dimension mismatch: expected ${this.config.dimensions}, got ${t.length}`);if(this.points.size>=this.config.maxElements)throw new Error(`Maximum elements (${this.config.maxElements}) reached`);this.points.set(e,{id:e,coordinates:D.project(t),metadata:r?{...r}:void 0})}search(e,t){if(e.length!==this.config.dimensions)throw new Error(`Query dimension mismatch: expected ${this.config.dimensions}, got ${e.length}`);let r=D.project(e),i=[];for(let s of this.points.values())i.push({id:s.id,distance:D.poincareDistance(r,s.coordinates),point:s});return i.sort((s,a)=>s.distance-a.distance),i.slice(0,Math.max(0,t))}embedHierarchy(e){let t=new Map;if(e.length===0)return t;let r=this.config.dimensions,i=new Map,s=new Map,a=[];for(let d of e)if(s.set(d.id,d),!d.parentId)a.push(d.id);else{let o=i.get(d.parentId);o||(o=[],i.set(d.parentId,o)),o.push(d.id)}let l=a.map((d,o)=>({id:d,depth:0,angOff:2*Math.PI*o/Math.max(1,a.length),angSpan:2*Math.PI/Math.max(1,a.length)}));for(;l.length>0;){let{id:d,depth:o,angOff:c,angSpan:h}=l.shift(),m=Math.tanh(.3*(o+.1)),u=c+h/2,f=new Float32Array(r);f[0]=m*Math.cos(u),f[1]=m*Math.sin(u);let y=s.get(d);if(y&&y.features.length>0){let S=m*.1;for(let E=2;E<r&&E-2<y.features.length;E++)f[E]=y.features[E-2]*S}let p=D.project(f);t.set(d,p),this.points.set(d,{id:d,coordinates:p,metadata:{depth:o,parentId:y?.parentId}});let g=i.get(d)??[];for(let S=0;S<g.length;S++){let E=h/Math.max(1,g.length);l.push({id:g[S],depth:o+1,angOff:c+S*E,angSpan:E})}}return t}getStats(){return{elementCount:this.points.size,dimensions:this.config.dimensions,curvature:this.config.curvature}}};function ct(n){return er()?new Re(n):null}function er(){return O().useHyperbolicHnsw}_();var xe=class{index=null;initialized=!1;config;constructor(e){this.config=e??{}}ensureInitialized(){if(this.initialized)return this.index!==null;if(this.initialized=!0,!L())return!1;try{return this.index=ct(this.config),this.index!==null}catch(e){return console.warn("[HyperbolicPatternIndex] Failed to create HyperbolicHNSW:",e instanceof Error?e.message:e),this.index=null,!1}}get isAvailable(){return this.index!==null}indexPattern(e,t,r){if(!(!this.ensureInitialized()||!this.index))try{let i=t instanceof Float32Array?t:new Float32Array(t),s=D.euclideanToHyperbolic(i);this.index.insert(e,s,r)}catch(i){console.debug(`[HyperbolicPatternIndex] Failed to index pattern ${e}:`,i instanceof Error?i.message:i)}}search(e,t){if(!this.ensureInitialized()||!this.index)return[];try{let r=e instanceof Float32Array?e:new Float32Array(e),i=D.euclideanToHyperbolic(r);return this.index.search(i,t).map(a=>({patternId:a.id,distance:a.distance,metadata:a.point.metadata}))}catch(r){return console.warn("[HyperbolicPatternIndex] Search failed:",r instanceof Error?r.message:r),[]}}getStats(){return this.index?this.index.getStats():null}reset(){this.index=null,this.initialized=!1}};function lt(n){return new xe(n)}var Ce=null;function ut(){return Ce||(Ce=Ge({dimensions:1e4})),Ce}var Ie;function rr(){return Ie===void 0&&(Ie=Xe()),Ie}var $=null,De=0,ht;function ft(n,e){return(!$||De!==n||ht!==e)&&($=at({dimension:n,maxPatterns:1e4}),De=n,ht=e),$}var K={namespace:"qe-patterns",embeddingDimension:384,hnsw:{M:16,efConstruction:200,efSearch:100,maxElements:5e4},promotionThreshold:X,minConfidence:.3,maxPatternsPerDomain:5e3,autoCleanup:!0,cleanupIntervalMs:36e5,tokenTracking:{enabled:!0,trackInputOutput:!0,estimateCosts:!0,costPerInputToken:3e-6,costPerOutputToken:15e-6},reuseOptimization:{enabled:!0,minSimilarityForReuse:.85,minSuccessRateForReuse:.9,maxAgeForReuse:7}},Oe=class{constructor(e,t={}){this.memory=e;this.config={...K,...t}}memory;config;initialized=!1;cleanupTimer;sqliteStore=null;nullStore=null;loadingPromise=null;patternCache=new Map;domainIndex=new Map;typeIndex=new Map;tierIndex=new Map;hnswIndex=null;hnswSpaceId=null;hnswAvailable=!1;hnswInitPromise=null;hdcCache=new Map;hdcTokenCache=new Map;deltaTracker=null;vectorDeltaTracker=void 0;hyperbolicIndex=null;stats={searchOperations:0,searchLatencies:[]};setSqliteStore(e){if(this.sqliteStore=e,k()&&!this.deltaTracker)try{let t=e.getDb();this.deltaTracker=new ie(t),this.deltaTracker.initialize(),console.log("[PatternStore] Delta event sourcing initialized")}catch(t){console.warn("[PatternStore] Delta tracker init failed:",t instanceof Error?t.message:t)}this.initialized&&(this.loadingPromise=this.loadPatterns().catch(t=>console.warn("[PatternStore] Failed to load patterns after setSqliteStore:",t)).finally(()=>{this.loadingPromise=null}))}async initialize(){this.initialized||(this.tierIndex.set("short-term",new Set),this.tierIndex.set("long-term",new Set),await this.loadPatterns(),this.config.autoCleanup&&(this.cleanupTimer=setInterval(()=>this.cleanup(),this.config.cleanupIntervalMs)),this.initialized=!0)}async ensureHNSW(){if(this.hnswIndex!==null){let e=x()?.spaceId??this.config.embeddingSpaceId??null;return this.hnswSpaceId!==e?(console.warn("[PatternStore] VECTOR_SPACE_MISMATCH: active embedder changed; semantic index disabled"),null):this.hnswIndex}return this.hnswAvailable===!1&&this.hnswInitPromise===null&&!(this.hnswIndex===null&&this.hnswAvailable===!1)?null:this.hnswInitPromise?(await this.hnswInitPromise,this.hnswIndex):(this.hnswInitPromise=this.initializeHNSWInternal(),await this.hnswInitPromise,this.hnswInitPromise=null,this.hnswIndex)}async initializeHNSWInternal(){try{if(!x()&&!this.config.embeddingSpaceId&&await V(),this.hnswSpaceId=x()?.spaceId??this.config.embeddingSpaceId??null,!this.hnswSpaceId)throw new Error("VECTOR_SPACE_UNVERIFIED: cannot initialize HNSW without runtime provenance");if(O().useUnifiedHnsw)try{let{HnswLegacyBridge:a}=await import("./hnsw-legacy-bridge-L27WS27N.js"),{HnswAdapter:l}=await import("./hnsw-adapter-LFMPLUJU.js"),d=new l("patterns",{dimensions:this.config.embeddingDimension,M:this.config.hnsw.M,efConstruction:this.config.hnsw.efConstruction,efSearch:this.config.hnsw.efSearch,metric:"cosine"});this.hnswIndex=new a(d),this.hnswAvailable=!0,console.log("[PatternStore] Using unified HNSW via HnswLegacyBridge (ADR-071)"),await this.loadEmbeddingsIntoHNSW();return}catch(a){console.warn("[PatternStore] Unified HNSW bridge failed, falling back:",a)}let{HNSWIndex:t}=await import("./hnsw-index-POCPMVJH.js");this.hnswIndex=new t(this.memory,{dimensions:this.config.embeddingDimension,M:this.config.hnsw.M,efConstruction:this.config.hnsw.efConstruction,efSearch:this.config.hnsw.efSearch,maxElements:this.config.hnsw.maxElements,namespace:`${this.config.namespace}:hnsw`,metric:"cosine"});let r=5e3,i=this.hnswIndex.initialize(),s=new Promise((a,l)=>setTimeout(()=>l(new Error("HNSW init timeout")),r));await Promise.race([i,s]),this.hnswAvailable=this.hnswIndex.isNativeAvailable(),await this.loadEmbeddingsIntoHNSW(),console.log(`[PatternStore] HNSW lazy-initialized (native: ${this.hnswAvailable})`)}catch(e){console.warn("[PatternStore] HNSW not available, using memory backend search:",b(e)),this.hnswIndex=null,this.hnswAvailable=!1}}async loadEmbeddingsIntoHNSW(){if(!(!this.hnswIndex||!this.sqliteStore))try{let e=this.sqliteStore.getAllEmbeddings(),t=this.config.hnsw.maxElements,r=0,i=0,s=x()?.spaceId??this.config.embeddingSpaceId;for(let{patternId:a,embedding:l,spaceId:d}of e){if(r>=t)break;if(!s||d!==s||!l||l.length!==this.config.embeddingDimension){i++;continue}let o=this.patternCache.get(a);if(!o){i++;continue}try{await this.hnswIndex.insert(a,l,{filePath:o.patternType,lineCoverage:o.confidence*100,branchCoverage:o.qualityScore*100,functionCoverage:0,statementCoverage:0,uncoveredLineCount:0,uncoveredBranchCount:0,riskScore:1-o.confidence,lastUpdated:Date.now(),totalLines:0}),r++}catch{i++}}r>0&&console.log(`[PatternStore] Loaded ${r} embeddings into HNSW (skipped ${i})`)}catch(e){console.warn("[PatternStore] Failed to load SQLite embeddings into HNSW:",b(e))}}getVectorDeltaTracker(){return this.vectorDeltaTracker===void 0&&(this.vectorDeltaTracker=st()),this.vectorDeltaTracker}async loadPatterns(){if(this.sqliteStore)try{let e=this.sqliteStore.getPatterns({limit:5e4});for(let t of e)this.indexPattern(t);e.length>0&&console.log(`[PatternStore] Loaded ${e.length} patterns from SQLite into memory cache`)}catch(e){console.warn("[PatternStore] Failed to load patterns from SQLite:",b(e))}}indexPattern(e){this.patternCache.set(e.id,e),this.domainIndex.has(e.qeDomain)||this.domainIndex.set(e.qeDomain,new Set),this.domainIndex.get(e.qeDomain).add(e.id),this.typeIndex.has(e.patternType)||this.typeIndex.set(e.patternType,new Set),this.typeIndex.get(e.patternType).add(e.id);let t=e.tier==="long-term"?"long-term":"short-term";e.tier!==t&&(e.tier=t),this.tierIndex.get(t).add(e.id)}unindexPattern(e){this.patternCache.delete(e.id),this.domainIndex.get(e.qeDomain)?.delete(e.id),this.typeIndex.get(e.patternType)?.delete(e.id),this.tierIndex.get(e.tier)?.delete(e.id),this.hdcCache.delete(e.id),this.hdcTokenCache.delete(e.id)}async store(e){this.initialized||await this.initialize(),this.loadingPromise&&await this.loadingPromise;let t=Y(e);if(!t.valid)return w(new Error(`Invalid pattern: ${t.errors.join(", ")}`));if(e.confidence<this.config.minConfidence)return w(new Error(`Pattern confidence ${e.confidence} below threshold ${this.config.minConfidence}`));let r=(process.env.AQE_MEMORY_BACKEND??"memory")!=="memory";if(r&&!this.sqliteStore)return w(new T(e.id,"FAILED",new Error("authoritative SQLite pattern store is unavailable")));let i=x()?.spaceId??this.config.embeddingSpaceId;if(e.embedding&&!i)return w(new Error("VECTOR_SPACE_UNVERIFIED: refusing to persist or index an embedding without runtime provenance"));(this.domainIndex.get(e.qeDomain)?.size||0)>=this.config.maxPatternsPerDomain&&await this.cleanupDomain(e.qeDomain);let a=this.patternCache.get(e.id)??null,l=!1,d=()=>{this.unindexPattern(e),a&&this.indexPattern(a)};if(this.indexPattern(e),this.sqliteStore)try{let o=await this.persistToSqlite(c=>c.storePattern(e,e.embedding,i));o&&o!==e.id&&(this.unindexPattern(e),e.id=o,this.indexPattern(e)),l=!0}catch(o){return d(),w(new T(e.id,"FAILED",o))}if(e.embedding){let o=await this.ensureHNSW();if(!o&&l)return w(new T(e.id,"COMMITTED_PENDING_INDEX",new Error("HNSW unavailable after authoritative pattern commit")));if(!o&&r)return d(),w(new T(e.id,"FAILED",new Error("HNSW unavailable before an authoritative pattern commit")));if(o)try{await o.insert(e.id,e.embedding,{filePath:e.patternType,lineCoverage:e.confidence*100,branchCoverage:e.qualityScore*100,functionCoverage:0,statementCoverage:0,uncoveredLineCount:0,uncoveredBranchCount:0,riskScore:1-e.confidence,lastUpdated:Date.now(),totalLines:0})}catch(c){return l||d(),w(new T(e.id,l?"COMMITTED_PENDING_INDEX":"FAILED",c))}}if(z())try{let c=ut().fingerprint({id:e.id,domain:e.qeDomain,type:e.patternType,content:e.description});this.hdcCache.set(e.id,c.vector)}catch(o){console.debug(`[PatternStore] HDC fingerprint failed for ${e.id}:`,b(o))}try{let o=rr();if(o){let c=[e.patternType,e.qeDomain];e.context?.tags&&c.push(...e.context.tags),e.name&&c.push(e.name);let h=o.fingerprintPattern(c);this.hdcTokenCache.set(e.id,h)}}catch(o){console.debug(`[PatternStore] HDC token fingerprint failed for ${e.id}:`,b(o))}if(se()&&e.embedding&&i)try{ft(e.embedding.length,i).store(new Float32Array(e.embedding),{id:e.id,name:e.name,domain:e.qeDomain})}catch(o){console.debug(`[PatternStore] Hopfield store failed for ${e.id}:`,b(o))}if(k()&&this.deltaTracker)try{let o={id:e.id,name:e.name,confidence:e.confidence,qualityScore:e.qualityScore,usageCount:e.usageCount,successRate:e.successRate,tier:e.tier};await this.deltaTracker.createGenesisWhenUnlocked(e.id,o)}catch(o){console.debug(`[PatternStore] Delta genesis for ${e.id}:`,b(o))}if(e.embedding)try{let o=this.getVectorDeltaTracker();o&&(a?.embedding?o.recordDelta(e.id,a.embedding,e.embedding):o.getVersion(e.id)<0&&o.recordGenesis(e.id,e.embedding))}catch(o){console.debug(`[PatternStore] VectorDeltaTracker for ${e.id}:`,b(o))}try{L()&&e.embedding&&this.indexHyperbolic(e.id,e.embedding,{domain:e.qeDomain,type:e.patternType,name:e.name})}catch{}return P(e.id)}async create(e){let t=new Date,r=e.qeDomain||this.detectDomainFromType(e.patternType),i={id:F(),patternType:e.patternType,qeDomain:r,domain:r,name:e.name,description:e.description,confidence:e.confidence??.5,usageCount:0,successRate:0,qualityScore:.25,context:{...e.context,tags:e.context?.tags||[]},template:{...e.template,example:void 0},embedding:e.embedding,tier:"short-term",createdAt:t,lastUsedAt:t,successfulUses:0,reusable:!1,reuseCount:0,averageTokenSavings:0},s=await this.store(i);return s.success?P(i):w(s.error)}detectDomainFromType(e){return{"test-template":"test-generation","assertion-pattern":"test-generation","mock-pattern":"test-generation","coverage-strategy":"coverage-analysis","mutation-strategy":"test-generation","api-contract":"contract-testing","visual-baseline":"visual-accessibility","a11y-check":"visual-accessibility","perf-benchmark":"chaos-resilience","flaky-fix":"test-execution","refactor-safe":"code-intelligence","error-handling":"test-generation","meta-optimization":"learning-optimization"}[e]||"test-generation"}async get(e){return this.initialized||await this.initialize(),this.loadingPromise&&await this.loadingPromise,this.patternCache.get(e)??null}async search(e,t={}){this.initialized||await this.initialize(),this.loadingPromise&&await this.loadingPromise;let r=performance.now(),i=t.limit||10,s=[];try{let a=x()?.spaceId??this.config.embeddingSpaceId;if(Array.isArray(e)&&(!a||t.embeddingSpaceId!==a))throw new Error("VECTOR_SPACE_UNVERIFIED: pre-computed query vectors require the active embeddingSpaceId");if(Array.isArray(e)&&t.useVectorSearch!==!1&&a&&se())try{let f=ft(e.length,a);if(f.getPatternCount()>0){let y=f.recall(new Float32Array(e));if(y&&y.similarity>.98){let p=y.metadata.id,g=await this.get(p);if(g&&this.matchesFilters(g,t)){let S=this.calculateReuseInfo(g,y.similarity);s.push({pattern:g,score:y.similarity,matchType:"vector",similarity:y.similarity,canReuse:S.canReuse,estimatedTokenSavings:S.estimatedTokenSavings,reuseConfidence:S.reuseConfidence})}}}}catch(f){console.debug("[PatternStore] Hopfield recall failed:",b(f))}if(Array.isArray(e)&&t.useVectorSearch!==!1){let f=await this.ensureHNSW();if(f){let y=await f.search(e,i*2);for(let p of y){let g=await this.get(p.key);if(g&&this.matchesFilters(g,t)){let S=this.calculateReuseInfo(g,p.score);s.push({pattern:g,score:p.score,matchType:"vector",similarity:p.score,canReuse:S.canReuse,estimatedTokenSavings:S.estimatedTokenSavings,reuseConfidence:S.reuseConfidence})}}}}let l=typeof e=="string"?e:t.textQuery;if(l?.trim()&&this.sqliteStore)try{let f=this.sqliteStore.searchFTS(l,i*2);if(f.length>0){let y=new Map(f.map(g=>[g.id,g.ftsScore*g.coverage])),p=new Set(s.map(g=>g.pattern.id));for(let g of s){let S=y.get(g.pattern.id);S!==void 0&&(g.score=de(g.score,S))}for(let g of f){if(p.has(g.id))continue;let S=await this.get(g.id);if(S&&this.matchesFilters(S,t)){let E=.5*g.ftsScore*g.coverage;s.push({pattern:S,score:E,matchType:"lexical",similarity:0,canReuse:!1,estimatedTokenSavings:0,reuseConfidence:0})}}}}catch{}if(typeof e=="string"||s.length<i){let f=await this.searchByText(l??"",t,i-s.length),y=new Set(s.map(p=>p.pattern.id));for(let p of f)y.has(p.pattern.id)||s.push(p)}let d=720*60*60*1e3,o=Date.now();for(let f of s){let y=f.pattern.lastUsedAt?.getTime()??f.pattern.createdAt.getTime(),p=o-y,g=Math.pow(.5,p/d),S=f.pattern.usageCount>0?g:.5;f.score=f.score*(.7+.3*S)}let c=this.sqliteStore?.getDatabase();if(c&&s.length>0)try{this.nullStore||(this.nullStore=new le(c));let f=this.nullStore.getNullSummaries(s.map(y=>y.pattern.id));for(let y of s){let p=f.get(y.pattern.id);p&&(y.nullSummary=p,y.score=le.applyNullDiscount(y.score,p,t.contextFingerprint))}}catch(f){console.debug("[PatternStore] null discount skipped:",b(f))}s.sort((f,y)=>y.score-f.score);let h=s;t.filter&&(h=Je(s,t.filter));let m=h.slice(0,i),u=performance.now()-r;return this.recordSearchLatency(u),P(m)}catch(a){return w(Fe(a))}}async searchByText(e,t,r){let i=[],s=e.toLowerCase(),a;t.domain?a=this.domainIndex.get(t.domain)||new Set:t.patternType?a=this.typeIndex.get(t.patternType)||new Set:t.tier?a=this.tierIndex.get(t.tier)||new Set:a=new Set(this.patternCache.keys());let l=[...a];if(z()&&s&&this.hdcCache.size>0)try{let d=ut(),o=d.fingerprint({id:"query",domain:t.domain??"unknown",type:t.patternType??"unknown",content:e}),c=l.filter(u=>this.hdcCache.has(u)).map(u=>({id:u,similarity:d.similarity(o.vector,this.hdcCache.get(u))}));c.sort((u,f)=>f.similarity-u.similarity);let h=c.map(u=>u.id),m=l.filter(u=>!this.hdcCache.has(u));l=[...h,...m]}catch{}for(let d of l){if(i.length>=r)break;let o=this.patternCache.get(d);if(!o||!this.matchesFilters(o,t))continue;let c=0;if(s){let h=o.name.toLowerCase(),m=o.description.toLowerCase();h.includes(s)&&(c+=.5),m.includes(s)&&(s.length/m.length>.3?c+=.5:c+=.3);for(let u of o.context.tags)if(u.toLowerCase().includes(s)){c+=.2;break}c=Math.min(c,1)}else c=o.qualityScore;(c>0||!s)&&i.push({pattern:o,score:s?.5*c:o.qualityScore,matchType:s?"lexical":"context",similarity:0,canReuse:!1,estimatedTokenSavings:0,reuseConfidence:0})}return i}calculateReuseInfo(e,t){let{reuseOptimization:r}=this.config,i=t>=r.minSimilarityForReuse,s=e.successRate>=r.minSuccessRateForReuse,a=e.lastUsedAt instanceof Date?e.lastUsedAt.getTime():new Date(e.lastUsedAt).getTime(),d=(Date.now()-a)/(1e3*60*60*24)<=r.maxAgeForReuse,o=r.enabled&&e.reusable&&i&&s&&d,c=o?e.averageTokenSavings>0?e.averageTokenSavings:e.tokensUsed||0:0,h=t,m=e.successRate,u=Math.min(e.reuseCount/10,1),f=o?h*.4+m*.4+u*.2:0;return{canReuse:o,estimatedTokenSavings:c,reuseConfidence:f}}matchesFilters(e,t){if(t.patternType&&e.patternType!==t.patternType||t.domain&&e.qeDomain!==t.domain||t.tier&&e.tier!==t.tier||t.minConfidence!==void 0&&e.confidence<t.minConfidence||t.minQualityScore!==void 0&&e.qualityScore<t.minQualityScore)return!1;if(t.context){let r=t.context;if(r.language&&e.context.language!==r.language||r.framework&&e.context.framework!==r.framework||r.testType&&e.context.testType!==r.testType)return!1}return!0}async recordUsage(e,t,r,i){let s=await this.get(e);if(!s)return w(new Error(`Pattern not found: ${e}`));let a=new Date,l=s.usageCount+1,d=s.successfulUses+(t?1:0),o=d/l,c=t?.02:-.01,h=Math.max(.1,Math.min(1,s.confidence+c)),m=G({confidence:h,usageCount:l,successRate:o}),u={...s,usageCount:l,successfulUses:d,successRate:o,confidence:h,qualityScore:m,lastUsedAt:a};if(this.sqliteStore)try{await this.persistToSqlite(p=>p.recordUsage(e,t,r,i))}catch(p){console.warn(`[PatternStore] SQLite recordUsage failed for ${e}:`,b(p))}if(k()&&this.deltaTracker)try{let p={id:s.id,name:s.name,confidence:s.confidence,qualityScore:s.qualityScore,usageCount:s.usageCount,successRate:s.successRate,tier:s.tier},g={id:u.id,name:u.name,confidence:u.confidence,qualityScore:u.qualityScore,usageCount:u.usageCount,successRate:u.successRate,tier:u.tier};await this.deltaTracker.recordDeltaWhenUnlocked(e,p,g,{success:t})}catch(p){console.debug(`[PatternStore] Delta recordDelta for ${e}:`,b(p))}let f=oe(u);return f.meetsUsageCriteria&&f.meetsQualityCriteria&&f.meetsCoherenceCriteria&&u.tier==="short-term"?await this.promote(e):this.patternCache.set(e,u),P(void 0)}persistToSqlite(e){let t=this.sqliteStore,r=()=>e(t);return typeof t.writeWhenUnlocked=="function"?t.writeWhenUnlocked(r):new Promise(i=>i(r()))}async promote(e){let t=await this.get(e);if(!t)return w(new Error(`Pattern not found: ${e}`));if(t.tier==="long-term")return P(void 0);let r={...t,tier:"long-term",confidence:Math.min(1,t.confidence+.1)};if(this.tierIndex.get("short-term")?.delete(e),this.tierIndex.get("long-term")?.add(e),this.patternCache.set(e,r),this.sqliteStore)try{await this.persistToSqlite(i=>i.promotePattern(e))}catch(i){console.debug("[PatternStore] SQLite promotion error:",i instanceof Error?i.message:i)}return console.log(`[PatternStore] Promoted pattern ${e} (${t.name}) to long-term storage`),P(void 0)}async delete(e){let t=this.patternCache.get(e);if(!t)return w(new Error(`Pattern not found: ${e}`));if(this.unindexPattern(t),this.sqliteStore)try{await this.persistToSqlite(r=>r.deletePattern(e))}catch(r){console.debug("[PatternStore] SQLite deletion error:",r instanceof Error?r.message:r)}if(this.hnswIndex!==null)try{await this.hnswIndex.delete(e)}catch(r){console.debug("[PatternStore] HNSW deletion error:",r instanceof Error?r.message:r)}return P(void 0)}async getStats(){let e={},t={};for(let[o,c]of this.domainIndex)e[o]=c.size;for(let[o,c]of this.typeIndex)t[o]=c.size;let r=0,i=0,s=0,a=0;for(let o of this.patternCache.values())r+=o.confidence,i+=o.qualityScore,s+=o.successRate,a++;let l=await this.ensureHNSW(),d=l!==null?await l.getStats():{nativeHNSW:!1,vectorCount:0,indexSizeBytes:0,lazyLoaded:!0};return{totalPatterns:this.patternCache.size,byTier:{shortTerm:this.tierIndex.get("short-term")?.size||0,longTerm:this.tierIndex.get("long-term")?.size||0},byDomain:e,byType:t,avgConfidence:a>0?r/a:0,avgQualityScore:a>0?i/a:0,avgSuccessRate:a>0?s/a:0,searchOperations:this.stats.searchOperations,avgSearchLatencyMs:this.calculateAvgLatency(),hnswStats:{nativeAvailable:d.nativeHNSW,vectorCount:d.vectorCount,indexSizeBytes:d.indexSizeBytes}}}async cleanup(){let e=0,t=0,r=[],i=[];for(let s of this.patternCache.values()){let a=oe(s);if(a.meetsUsageCriteria&&a.meetsQualityCriteria&&a.meetsCoherenceCriteria){i.push(s.id);continue}if(s.tier==="short-term"){let d=s.createdAt instanceof Date?s.createdAt.getTime():new Date(s.createdAt).getTime(),o=Date.now()-d,c=o>10080*60*1e3,h=s.qualityScore<.2,m=s.usageCount===0&&o>1440*60*1e3;(c&&h||m)&&r.push(s.id)}}for(let s of i)(await this.promote(s)).success&&t++;for(let s of r)(await this.delete(s)).success&&e++;return console.log(`[PatternStore] Cleanup: removed ${e}, promoted ${t}`),{removed:e,promoted:t}}async cleanupDomain(e){let t=this.domainIndex.get(e);if(!t||t.size<this.config.maxPatternsPerDomain)return;let r=[];for(let a of t){let l=this.patternCache.get(a);l&&r.push(l)}r.sort((a,l)=>a.qualityScore-l.qualityScore);let i=Math.ceil(r.length*.1),s=0;for(let a of r){if(s>=i)break;a.tier==="short-term"&&(await this.delete(a.id),s++)}}recordSearchLatency(e){this.stats.searchOperations++,this.stats.searchLatencies.push(e),this.stats.searchLatencies.length>1e3&&(this.stats.searchLatencies=this.stats.searchLatencies.slice(-1e3))}calculateAvgLatency(){return this.stats.searchLatencies.length===0?0:this.stats.searchLatencies.reduce((t,r)=>t+r,0)/this.stats.searchLatencies.length}async dispose(){this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=void 0),this.patternCache.clear(),this.domainIndex.clear(),this.typeIndex.clear(),this.tierIndex.clear(),this.hdcCache.clear(),this.deltaTracker=null,this.hyperbolicIndex&&(this.hyperbolicIndex.reset(),this.hyperbolicIndex=null),$&&($.clear(),$=null,De=0),this.initialized=!1}indexHyperbolic(e,t,r){if(L())try{this.hyperbolicIndex||(this.hyperbolicIndex=lt({dimensions:this.config.embeddingDimension,maxElements:this.config.hnsw.maxElements})),this.hyperbolicIndex.indexPattern(e,t,r)}catch(i){console.debug(`[PatternStore] Hyperbolic indexing failed for ${e}:`,i instanceof Error?i.message:i)}}async searchHyperbolic(e,t=10){if(!L()||!this.hyperbolicIndex)return P([]);try{let r=this.hyperbolicIndex.search(e,t),i=[];for(let s of r){let a=await this.get(s.patternId);if(!a)continue;let l=Math.exp(-s.distance),d=this.calculateReuseInfo(a,l);i.push({pattern:a,score:l,matchType:"vector",similarity:l,canReuse:d.canReuse,estimatedTokenSavings:d.estimatedTokenSavings,reuseConfidence:d.reuseConfidence})}return P(i)}catch(r){return console.warn("[PatternStore] Hyperbolic search failed, returning empty results:",r instanceof Error?r.message:r),P([])}}};function de(n,e){return Math.max(n,.75*n+.25*e)}function gn(n,e){try{if(O().useRVFPatternStore&&Le()){let r=process.env.AQE_PROJECT_ROOT??Ne(),i=dt(r,".agentic-qe"),s=dt(i,"patterns.rvf");if(tr(i)){let a={...K,...e},l=!1;try{let d=Ue(i,a.embeddingDimension);if(d){l=!0;let o=new J(()=>d,{rvfPath:s,base:a,skipCloseOnDispose:!0,embeddingSpaceId:a.embeddingSpaceId});return console.log("[PatternStore] Using RVF-backed store (ADR-066)"),o}}catch{}if(!l){let d=new J((o,c)=>{let h,m=()=>{try{return ke(o)}catch(f){return h=f,null}},u=m();if(!u&&W(h)&&(!Me(o)||(u=m(),!u&&W(h))))throw h;if(u){let f=u.dimension();if(f!==c){try{u.close()}catch{}throw new Error(`RVF dimension mismatch (file=${f}, requested=${c})`)}return u}try{return ae(o,c)}catch(f){if(u=m(),u){if(u.dimension()!==c){let y=u.dimension();try{u.close()}catch{}throw new Error(`RVF dimension mismatch (file=${y}, requested=${c})`)}return u}if(W(h))throw h;if(He(o,f instanceof Error?f.message:String(f),h))return ae(o,c);throw f}},{rvfPath:s,base:a,embeddingSpaceId:a.embeddingSpaceId});return console.log("[PatternStore] Using RVF-backed store (ADR-066)"),d}}}}catch(t){console.warn("[PatternStore] RVF store unavailable, using in-memory HNSW:",t instanceof Error?t.message:t)}return new Oe(n,e)}export{T as a,ir as b,K as c,de as d,gn as e};
|
|
50
|
+
/*! Bundled license information:
|
|
51
|
+
|
|
52
|
+
fast-json-patch/commonjs/helpers.js:
|
|
53
|
+
(*!
|
|
54
|
+
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
55
|
+
* (c) 2017-2022 Joachim Wester
|
|
56
|
+
* MIT licensed
|
|
57
|
+
*)
|
|
58
|
+
|
|
59
|
+
fast-json-patch/commonjs/duplex.js:
|
|
60
|
+
(*!
|
|
61
|
+
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
62
|
+
* (c) 2017-2021 Joachim Wester
|
|
63
|
+
* MIT license
|
|
64
|
+
*)
|
|
65
|
+
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.
|
|
2
|
-
import{a as y}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.16");process.exit(0)}
|
|
2
|
+
import{a as y}from"./chunk-VMDFFTCK.js";import{a as g,c as h}from"./chunk-N7HL5PHH.js";import{S as b,b as p}from"./chunk-L6QSTQME.js";b();var m=class{calculator;constructor(){this.calculator=new h}computeLambda(t){let n=this.maybeSparsify(t),e=this.toSwarmGraph(n);return this.calculator.getMinCutValue(e)}computeRoutingTier(t,n){let e=this.buildTaskGraphFromTopology(n),o=this.toSwarmGraph(e),s=this.calculator.getMinCutValue(o),r=Math.max(n.length-1,1),a=Math.min(s/r,1),{tier:i,label:d}=this.lambdaToTier(a),c=this.computeConfidence(o,a),l=this.buildRationale(t,a,i,n.length);return{tier:i,label:d,lambda:s,normalizedLambda:a,confidence:c,rationale:l}}getStructuralHealth(t){let n=this.maybeSparsify(t),e=this.toSwarmGraph(n);if(e.isEmpty())return this.emptyHealthReport();let o=this.calculator.getMinCutValue(e),s=e.getStats(),r=Math.max(s.vertexCount-1,1),a=Math.min(o/r,1),i=this.calculator.findWeakVertices(e),d=i.map(f=>f.vertexId),c=1-a,l=a>=.4,u=this.generateHealthSuggestions(a,i.length,s);return{lambda:o,normalizedLambda:a,healthy:l,weakPoints:d,riskScore:c,componentCount:s.componentCount,isConnected:s.isConnected,suggestions:u,analyzedAt:new Date}}maybeSparsify(t){if(!p().useSpectralSparsification||t.edges.length<=100)return t;let n=new Map;t.nodes.forEach((i,d)=>n.set(i.id,d));let e=[];for(let i of t.edges){let d=n.get(i.source),c=n.get(i.target);d!==void 0&&c!==void 0&&e.push([d,c,i.weight])}let o={nodeCount:t.nodes.length,edges:e},r=new y({epsilon:.3}).sparsify(o),a=[];for(let[i,d,c]of r.edges){let l=t.nodes[i],u=t.nodes[d];l&&u&&a.push({source:l.id,target:u.id,weight:c,edgeType:"coordination"})}return{nodes:t.nodes,edges:a}}toSwarmGraph(t){let n=new g;for(let e of t.nodes){let o={id:e.id,type:e.type==="task"||e.type==="agent"?"agent":"domain",domain:e.domain,weight:e.weight,createdAt:new Date,metadata:e.metadata};n.addVertex(o)}for(let e of t.edges)if(n.hasVertex(e.source)&&n.hasVertex(e.target)){let o={source:e.source,target:e.target,weight:e.weight,type:e.edgeType==="dependency"?"dependency":e.edgeType==="communication"?"communication":e.edgeType==="workflow"?"workflow":"coordination",bidirectional:e.edgeType!=="dependency"};n.addEdge(o)}return n}buildTaskGraphFromTopology(t){let n=t.map(r=>({id:r.id,label:r.name,type:"agent",domain:r.domain,weight:r.weight})),e=[],o=new Set(t.map(r=>r.id));for(let r of t)for(let a of r.dependsOn)o.has(a)&&e.push({source:r.id,target:a,weight:1,edgeType:"dependency"});let s=new Map;for(let r of t){let a=s.get(r.domain)||[];a.push(r.id),s.set(r.domain,a)}for(let[,r]of s)for(let a=0;a<r.length;a++)for(let i=a+1;i<r.length;i++)e.push({source:r[a],target:r[i],weight:.5,edgeType:"coordination"});return{nodes:n,edges:e}}lambdaToTier(t){return t>=.8?{tier:1,label:"Haiku"}:t>=.4?{tier:2,label:"Sonnet"}:{tier:3,label:"Opus"}}computeConfidence(t,n){let e=t.getStats();if(e.vertexCount<3)return .4;let o=Math.min(Math.abs(n-.4),Math.abs(n-.8)),s=Math.min(.95,.5+o*2.25),r=Math.min(1,e.density*2);return Math.min(.99,s*(.7+.3*r))}buildRationale(t,n,e,o){let s=t.slice(0,80),r=n>=.8?"highly connected":n>=.4?"moderately connected":"fragmented";return`Task "${s}" routed to ${e===1?"Haiku":e===2?"Sonnet":"Opus"} (Tier ${e}). Fleet topology is ${r} (lambda=${n.toFixed(3)}) across ${o} agents.`}generateHealthSuggestions(t,n,e){let o=[];return e.isConnected||o.push(`Graph has ${e.componentCount} disconnected components. Add cross-domain coordination edges to improve connectivity.`),t<.2?o.push("Critical: Fleet connectivity is very low. Consider spawning coordination agents."):t<.4&&o.push("Warning: Fleet connectivity is below healthy threshold. Reinforce weak connections."),n>0&&o.push(`${n} weak point(s) detected. Add redundant connections to these agents.`),e.vertexCount<3&&o.push("Fleet has fewer than 3 agents. MinCut analysis is most useful with larger topologies."),o}emptyHealthReport(){return{lambda:0,normalizedLambda:0,healthy:!1,weakPoints:[],riskScore:1,componentCount:0,isConnected:!0,suggestions:["No agents in fleet. Spawn agents to build a topology."],analyzedAt:new Date}}};function C(){return new m}export{C as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.
|
|
2
|
-
import{c as k,d as p}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.16");process.exit(0)}
|
|
2
|
+
import{c as k,d as p}from"./chunk-AGRV5B3T.js";p();import{generateKeyPairSync as g,createPrivateKey as v,createPublicKey as I,sign as m,verify as D,createHash as b}from"crypto";import{existsSync as d,mkdirSync as P,writeFileSync as y,readFileSync as o,readdirSync as w}from"fs";import{join as n}from"path";var f=class{keys=new Map;activeKeyId=null;keyDir;constructor(e={}){this.keyDir=e.keyDir??null,this.keyDir&&this.loadFromDisk(),e.autoGenerate!==!1&&this.keys.size===0&&this.generateKeyPair()}generateKeyPair(){let{publicKey:e,privateKey:i}=g("ed25519"),r=e.export({type:"spki",format:"der"}),t=b("sha256").update(r).digest("hex").slice(0,16),s={keyId:t,publicKey:e,privateKey:i,createdAt:new Date().toISOString(),retired:!1};return this.keys.set(t,s),this.activeKeyId=t,this.keyDir&&(this.saveKeyPairToDisk(s),this.saveActiveKeyId()),{keyId:t,publicKey:r}}sign(e,i){let r=i??this.activeKeyId;if(!r)throw new Error("No active key available for signing");let t=this.keys.get(r);if(!t)throw new Error(`Key not found: ${r}`);return{signature:m(null,e,t.privateKey),keyId:r}}verify(e,i,r){let t=this.keys.get(r);if(!t)return!1;try{return D(null,e,t.publicKey,i)}catch{return!1}}rotateKey(){let e=this.activeKeyId;if(!e)throw new Error("No active key to rotate");let i=this.keys.get(e);i&&(i.retired=!0,this.keyDir&&this.saveKeyPairToDisk(i));let{keyId:r}=this.generateKeyPair();return{oldKeyId:e,newKeyId:r}}getActiveKeyId(){if(!this.activeKeyId)throw new Error("No active key");return this.activeKeyId}hasKey(e){return this.keys.has(e)}getKeyCount(){return this.keys.size}saveKeyPairToDisk(e){if(!this.keyDir)return;d(this.keyDir)||P(this.keyDir,{recursive:!0});let i=n(this.keyDir,e.keyId);y(`${i}.pub.pem`,e.publicKey.export({type:"spki",format:"pem"}),"utf-8"),y(`${i}.key.pem`,e.privateKey.export({type:"pkcs8",format:"pem"}),{encoding:"utf-8",mode:384}),y(`${i}.meta.json`,JSON.stringify({keyId:e.keyId,createdAt:e.createdAt,retired:e.retired}),"utf-8")}saveActiveKeyId(){!this.keyDir||!this.activeKeyId||y(n(this.keyDir,"active-key-id"),this.activeKeyId,"utf-8")}loadFromDisk(){if(!this.keyDir||!d(this.keyDir))return;let i=w(this.keyDir).filter(t=>t.endsWith(".meta.json"));for(let t of i)try{let s=JSON.parse(o(n(this.keyDir,t),"utf-8")),a=n(this.keyDir,s.keyId),l=o(`${a}.pub.pem`,"utf-8"),K=o(`${a}.key.pem`,"utf-8"),h={keyId:s.keyId,publicKey:I(l),privateKey:v(K),createdAt:s.createdAt,retired:s.retired};this.keys.set(s.keyId,h)}catch{}let r=n(this.keyDir,"active-key-id");if(d(r)){let t=o(r,"utf-8").trim();this.keys.has(t)&&(this.activeKeyId=t)}if(!this.activeKeyId){let t=[...this.keys.values()].filter(s=>!s.retired).sort((s,a)=>a.createdAt.localeCompare(s.createdAt));t.length>0&&(this.activeKeyId=t[0].keyId)}}},c=null;function F(){if(!c){let u=n(k(),".agentic-qe","witness-keys");c=new f({keyDir:u})}return c}function O(){c=null}export{f as a,F as b,O as c};
|