agentic-qe 3.15.13 → 3.15.15
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/helpers/brain-checkpoint.cjs +124 -5
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +124 -0
- package/assets/agents/v3/templates/qx-report-template.html +1 -1
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/cli/bundle.js +6 -6
- package/dist/cli/chunks/adapter-QU6INSKP.js +2 -0
- package/dist/cli/chunks/agent-booster-wasm-EUF4XVUC.js +2 -0
- package/dist/cli/chunks/{agent-handler-AOH6TV7W.js → agent-handler-MOX6PSIQ.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-2P54SF5N.js → agent-memory-branch-AEXKIGDG.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-PAJPENJD.js +2 -0
- package/dist/cli/chunks/{arena-NSVFCAF5.js → arena-IQ5ZZDRF.js} +2 -2
- package/dist/cli/chunks/{arena-X6MOGQHA.js → arena-M7GA3CVG.js} +4 -4
- package/dist/cli/chunks/{audit-27DJLQNM.js → audit-4IPBMKWB.js} +3 -3
- package/dist/cli/chunks/base-OTGSN6IC.js +2 -0
- package/dist/cli/chunks/{better-sqlite3-BU5GXILS.js → better-sqlite3-IKDKJ2IE.js} +2 -2
- package/dist/cli/chunks/brain-handler-5NQUDH4W.js +95 -0
- package/dist/cli/chunks/{branch-enumerator-5CLULOCU.js → branch-enumerator-KSXELWRC.js} +2 -2
- package/dist/cli/chunks/{browser-R4DMU3LN.js → browser-6LACARWE.js} +2 -2
- package/dist/cli/chunks/browser-workflow-WLZGR6SB.js +2 -0
- package/dist/cli/chunks/{chunk-LUZNKJE6.js → chunk-22UKJGGN.js} +3 -3
- package/dist/cli/chunks/{chunk-BLSLEVDI.js → chunk-27HE2BHC.js} +2 -2
- package/dist/cli/chunks/{chunk-K4CZA77U.js → chunk-2CKERSMB.js} +2 -2
- package/dist/cli/chunks/{chunk-YSZ5OE3Z.js → chunk-2IIXCEMS.js} +2 -2
- package/dist/cli/chunks/{chunk-F3YS57NF.js → chunk-2LUTPMBO.js} +2 -2
- package/dist/cli/chunks/{chunk-GHM6MQNK.js → chunk-2ZFLULL4.js} +2 -2
- package/dist/cli/chunks/{chunk-7CMTY45A.js → chunk-337Z52QM.js} +2 -2
- package/dist/cli/chunks/{chunk-W26B7ERY.js → chunk-3CYNZFKH.js} +1 -1
- package/dist/cli/chunks/chunk-3HVFIITW.js +2 -0
- package/dist/cli/chunks/{chunk-K3TLLJMX.js → chunk-3J3RNJNX.js} +1 -1
- package/dist/cli/chunks/{chunk-MAMQA43L.js → chunk-4ATQP3PR.js} +1 -1
- package/dist/cli/chunks/{chunk-YXRASAPI.js → chunk-4D4CWP72.js} +2 -2
- package/dist/cli/chunks/{chunk-GHY6Z6KO.js → chunk-4HKAD25N.js} +3 -3
- package/dist/cli/chunks/{chunk-XNBOGCF3.js → chunk-4X3SWKBA.js} +2 -2
- package/dist/cli/chunks/{chunk-IJUHSJ2U.js → chunk-5AFVEWMT.js} +2 -2
- package/dist/cli/chunks/{chunk-SE4VNN4I.js → chunk-5C62XMJR.js} +3 -3
- package/dist/cli/chunks/{chunk-KDNJ4F3P.js → chunk-5G4UFTV4.js} +2 -2
- package/dist/cli/chunks/{chunk-DVGRPK7A.js → chunk-5I7357KS.js} +2 -2
- package/dist/cli/chunks/{chunk-YZWBNBTW.js → chunk-5KA5TVPR.js} +2 -2
- package/dist/cli/chunks/{chunk-JGZ722G3.js → chunk-5PTAFGJT.js} +2 -2
- package/dist/cli/chunks/{chunk-SVLQRAMF.js → chunk-6BRQPHMZ.js} +1 -1
- package/dist/cli/chunks/{chunk-KDVZND5Q.js → chunk-6KCSKGVY.js} +1 -1
- package/dist/cli/chunks/{chunk-LWR3FV3Y.js → chunk-6LE362LZ.js} +2 -2
- package/dist/cli/chunks/{chunk-WKGTGOYS.js → chunk-6NBRMD25.js} +3 -3
- package/dist/cli/chunks/{chunk-HQZGPJYG.js → chunk-6RBTS3NF.js} +2 -2
- package/dist/cli/chunks/{chunk-WOCGL4QP.js → chunk-6YVMX2TC.js} +2 -2
- package/dist/cli/chunks/{chunk-I3C7JOXC.js → chunk-73PBAWAF.js} +2 -2
- package/dist/cli/chunks/{chunk-75RDHBAX.js → chunk-74YG72NQ.js} +3 -3
- package/dist/cli/chunks/{chunk-O6FGXMHD.js → chunk-76P32JVU.js} +1 -1
- package/dist/cli/chunks/{chunk-LL7LDPXS.js → chunk-7ACCBHRB.js} +1 -1
- package/dist/cli/chunks/{chunk-3LJ7LQMV.js → chunk-7BLZHFKD.js} +1 -1
- package/dist/cli/chunks/{chunk-CM4LSLKR.js → chunk-7O45RQHF.js} +2 -2
- package/dist/cli/chunks/{chunk-NU3W5WFT.js → chunk-7XB3FCKM.js} +2 -2
- package/dist/cli/chunks/{chunk-E56B6IDX.js → chunk-AHMWD6JG.js} +2 -2
- package/dist/cli/chunks/{chunk-G2Q66Z23.js → chunk-AJPROCDW.js} +2 -2
- package/dist/cli/chunks/{chunk-NW7IBHJA.js → chunk-AKZO6GGG.js} +13 -13
- package/dist/cli/chunks/{chunk-IC3TQEOA.js → chunk-AOKKUB5F.js} +1 -1
- package/dist/cli/chunks/{chunk-4OVC4RIL.js → chunk-AP2W7Z3A.js} +1 -1
- package/dist/cli/chunks/{chunk-PHP5UBT4.js → chunk-BBRROA3Z.js} +2 -2
- package/dist/cli/chunks/{chunk-5FKWCZNF.js → chunk-BDKEAGQ2.js} +2 -2
- package/dist/cli/chunks/{chunk-BTVEYBW2.js → chunk-BFQTLF5X.js} +2 -2
- package/dist/cli/chunks/{chunk-HZ5NXFXH.js → chunk-BLL2XU7A.js} +2 -2
- package/dist/cli/chunks/{chunk-UTRV7T2N.js → chunk-BP5T3OEV.js} +2 -2
- package/dist/cli/chunks/{chunk-GB6HBNH2.js → chunk-BQ47GQPK.js} +2 -2
- package/dist/cli/chunks/{chunk-RFNW2LGD.js → chunk-BU4UQR36.js} +2 -2
- package/dist/cli/chunks/{chunk-WO274FRI.js → chunk-BZULJMGH.js} +2 -2
- package/dist/cli/chunks/{chunk-GU5HNCWI.js → chunk-C4KLXFJP.js} +1 -1
- package/dist/cli/chunks/{chunk-LFJALJOA.js → chunk-C4RTAVC6.js} +2 -2
- package/dist/cli/chunks/{chunk-WNQS4WTS.js → chunk-C5CXL3JP.js} +2 -2
- package/dist/cli/chunks/{chunk-MGZ5FJUW.js → chunk-CAOUV5GZ.js} +2 -2
- package/dist/cli/chunks/{chunk-XPRVF4YE.js → chunk-CBK5CT6T.js} +2 -2
- package/dist/cli/chunks/{chunk-JRRXCODW.js → chunk-DEKR3CTS.js} +2 -2
- package/dist/cli/chunks/{chunk-AQSVJNEH.js → chunk-DKX4GNRU.js} +2 -2
- package/dist/cli/chunks/{chunk-6KATY3KS.js → chunk-DUKE27HC.js} +2 -2
- package/dist/cli/chunks/{chunk-W2QWSQVE.js → chunk-DURD37JZ.js} +2 -2
- package/dist/cli/chunks/{chunk-KCW47QR5.js → chunk-E3MRDIZF.js} +1 -1
- package/dist/cli/chunks/{chunk-6Z7PRBSG.js → chunk-E56PVVWC.js} +2 -2
- package/dist/cli/chunks/{chunk-WQL7WCIZ.js → chunk-E5G4WZ2T.js} +1 -1
- package/dist/cli/chunks/{chunk-PB6J6HAA.js → chunk-EBTNMQSS.js} +2 -2
- package/dist/cli/chunks/{chunk-KADFXPPN.js → chunk-EFUJDMNC.js} +2 -2
- package/dist/cli/chunks/{chunk-QPNG5ZN2.js → chunk-EKP2SC77.js} +2 -2
- package/dist/cli/chunks/{chunk-U2FUXDDJ.js → chunk-EMSZVUYA.js} +3 -3
- package/dist/cli/chunks/{chunk-XEAEYC6Y.js → chunk-ERN56H6S.js} +1 -1
- package/dist/cli/chunks/{chunk-DNDL7SOS.js → chunk-FOOW4JVS.js} +2 -2
- package/dist/cli/chunks/{chunk-HOAJUIBQ.js → chunk-FTRSS64D.js} +2 -2
- package/dist/cli/chunks/{chunk-TOQWL2ZF.js → chunk-G242G224.js} +2 -2
- package/dist/cli/chunks/{chunk-VTDFVFST.js → chunk-G6RDCCFV.js} +2 -2
- package/dist/cli/chunks/{chunk-TWDW32W2.js → chunk-GCHYOPRZ.js} +2 -2
- package/dist/cli/chunks/{chunk-MFW5HSG4.js → chunk-GGQGCT4Y.js} +2 -2
- package/dist/cli/chunks/{chunk-G6WDYBLQ.js → chunk-GKSMRBHU.js} +1 -1
- package/dist/cli/chunks/{chunk-CCMKSHAT.js → chunk-GQABPCQE.js} +2 -2
- package/dist/cli/chunks/{chunk-G77ERMUD.js → chunk-GV2QE5TO.js} +1 -1
- package/dist/cli/chunks/{chunk-756CGMEH.js → chunk-H5DER3JY.js} +1 -1
- package/dist/cli/chunks/{chunk-W3PPFHI5.js → chunk-HH4ED4F7.js} +52 -50
- package/dist/cli/chunks/{chunk-3Y2ROSCL.js → chunk-HL2ANKN3.js} +2 -2
- package/dist/cli/chunks/{chunk-T3PGQFDI.js → chunk-HTZSRMHW.js} +2 -2
- package/dist/cli/chunks/{chunk-3QZEGE67.js → chunk-IXL5ZHWJ.js} +1 -1
- package/dist/cli/chunks/{chunk-5ZGM3RMH.js → chunk-J3FP5UGL.js} +1 -1
- package/dist/cli/chunks/{chunk-FZ76G4QJ.js → chunk-JCQGJGGZ.js} +1 -1
- package/dist/cli/chunks/chunk-JCZCJE6X.js +86 -0
- package/dist/cli/chunks/{chunk-YZEXYO4W.js → chunk-JKJOB65O.js} +1 -1
- package/dist/cli/chunks/{chunk-A64JFBWI.js → chunk-JUDUBQHA.js} +2 -2
- package/dist/cli/chunks/{chunk-PIDQVU3L.js → chunk-JW74KRBC.js} +2 -2
- package/dist/cli/chunks/{chunk-EXGMJFAT.js → chunk-K3WZICFA.js} +1 -1
- package/dist/cli/chunks/{chunk-ASQYASNV.js → chunk-K3XBQC3R.js} +1 -1
- package/dist/cli/chunks/{chunk-E7CLYGS7.js → chunk-KCQNFBBR.js} +1 -1
- package/dist/cli/chunks/chunk-KJBPB7P5.js +3 -0
- package/dist/cli/chunks/chunk-KLTMOXIK.js +3 -0
- package/dist/cli/chunks/{chunk-5MDERQH3.js → chunk-L32JNNKL.js} +1 -1
- package/dist/cli/chunks/{chunk-32ZMWEP3.js → chunk-LB2LGEDP.js} +2 -2
- package/dist/cli/chunks/{chunk-42J34YG4.js → chunk-LHMQIZ6B.js} +2 -2
- package/dist/cli/chunks/{chunk-NURIILUB.js → chunk-LJMYRTJ7.js} +1 -1
- package/dist/cli/chunks/{chunk-M6AAGIG7.js → chunk-LNX74WHQ.js} +1 -1
- package/dist/cli/chunks/{chunk-P7A4NKTZ.js → chunk-LTQVUAPH.js} +2 -2
- package/dist/cli/chunks/{chunk-3YNLWPBF.js → chunk-LVABQNRF.js} +2 -2
- package/dist/cli/chunks/{chunk-2G7TVT6W.js → chunk-LYJHUNBK.js} +2 -2
- package/dist/cli/chunks/{chunk-DLD7RUZ4.js → chunk-M4CJCPCQ.js} +2 -2
- package/dist/cli/chunks/{chunk-Q3UDLV5Z.js → chunk-M4WMSCAE.js} +1 -1
- package/dist/cli/chunks/{chunk-UDQSYWVF.js → chunk-MIA447GY.js} +1 -1
- package/dist/cli/chunks/{chunk-RF7HWBHN.js → chunk-MPFPWJTH.js} +2 -2
- package/dist/cli/chunks/{chunk-BK577VL7.js → chunk-MV55NXTD.js} +2 -2
- package/dist/cli/chunks/{chunk-JQGMW45H.js → chunk-NQS3BWS6.js} +1 -1
- package/dist/cli/chunks/{chunk-BEGR4D6N.js → chunk-NWIIYHT6.js} +2 -2
- package/dist/cli/chunks/{chunk-SSU73QAX.js → chunk-O6EWL5DQ.js} +2 -2
- package/dist/cli/chunks/chunk-OBDONJQM.js +2 -0
- package/dist/cli/chunks/chunk-OLZH5LRT.js +141 -0
- package/dist/cli/chunks/{chunk-W3INMZZ6.js → chunk-OQG3UQQ7.js} +1 -1
- package/dist/cli/chunks/{chunk-72ASBE35.js → chunk-PFQCV6YS.js} +3 -3
- package/dist/cli/chunks/{chunk-7YTGHGK4.js → chunk-PS6UMZVK.js} +2 -2
- package/dist/cli/chunks/{chunk-OCAEXYFA.js → chunk-PXATBHWN.js} +2 -2
- package/dist/cli/chunks/{chunk-ARJW4I2O.js → chunk-PYPS65P7.js} +2 -2
- package/dist/cli/chunks/{chunk-SYV2V3PL.js → chunk-Q6I4SIUU.js} +4 -4
- package/dist/cli/chunks/{chunk-H4H2YSFH.js → chunk-QFGYH6HD.js} +1 -1
- package/dist/cli/chunks/{chunk-526QYFJU.js → chunk-QGBGSQ2E.js} +2 -2
- package/dist/cli/chunks/{chunk-YBQH2VOP.js → chunk-QRKTBSZT.js} +2 -2
- package/dist/cli/chunks/{chunk-C7JM7CD3.js → chunk-R6LHJ7ME.js} +2 -2
- package/dist/cli/chunks/{chunk-TSQC2KKZ.js → chunk-RBKUU7WF.js} +2 -2
- package/dist/cli/chunks/{chunk-CE7B5LU7.js → chunk-RDMRY7CT.js} +1 -1
- package/dist/cli/chunks/chunk-RIRZHOS2.js +8 -0
- package/dist/cli/chunks/{chunk-CRWPZT74.js → chunk-SHRI7TKJ.js} +2 -2
- package/dist/cli/chunks/{chunk-KWYH3FI4.js → chunk-SJCKCSN3.js} +1 -1
- package/dist/cli/chunks/{chunk-DFUASIKA.js → chunk-SON6ZRH3.js} +2 -2
- package/dist/cli/chunks/{chunk-J2ZIFFM6.js → chunk-SZAZQZWI.js} +2 -2
- package/dist/cli/chunks/{chunk-HD7YIFOI.js → chunk-T4GE7MPI.js} +2 -2
- package/dist/cli/chunks/{chunk-3Y7TJFHU.js → chunk-T66PPF4D.js} +2 -2
- package/dist/cli/chunks/{chunk-3RZV5DGO.js → chunk-T67R2MUN.js} +2 -2
- package/dist/cli/chunks/{chunk-H4GG2NLO.js → chunk-TDQWTSBS.js} +2 -2
- package/dist/cli/chunks/{chunk-TWJTK4CC.js → chunk-TODNOP7C.js} +2 -2
- package/dist/cli/chunks/{chunk-NZ3GUMB2.js → chunk-TX2CHQD7.js} +2 -2
- package/dist/cli/chunks/{chunk-AL6FBH3E.js → chunk-TZIHDJZD.js} +2 -2
- package/dist/cli/chunks/{chunk-GII6UM3F.js → chunk-U62OUXBF.js} +1 -1
- package/dist/cli/chunks/{chunk-YQFLQE53.js → chunk-UAQZI6N4.js} +2 -2
- package/dist/cli/chunks/{chunk-R7SYRCRP.js → chunk-UE2J6MA5.js} +1 -1
- package/dist/cli/chunks/{chunk-VRHRBAEM.js → chunk-UGYM4U44.js} +1 -1
- package/dist/cli/chunks/{chunk-NT4DBXSX.js → chunk-UJABDXST.js} +2 -2
- package/dist/cli/chunks/{chunk-OFACHK5O.js → chunk-UORB2QDU.js} +9 -9
- package/dist/cli/chunks/{chunk-QDEJ4CI2.js → chunk-UQPA33UK.js} +2 -2
- package/dist/cli/chunks/{chunk-TCBBNUBP.js → chunk-UUBIQR6A.js} +3 -3
- package/dist/cli/chunks/{chunk-NZD4DPSU.js → chunk-UXIY4IAI.js} +2 -2
- package/dist/cli/chunks/{chunk-SG3NX7QE.js → chunk-VCXI4XC4.js} +2 -2
- package/dist/cli/chunks/{chunk-PSFSPGUD.js → chunk-VMAM46HQ.js} +2 -2
- package/dist/cli/chunks/{chunk-3AN5TNGD.js → chunk-VY4U6DPO.js} +3 -3
- package/dist/cli/chunks/{chunk-X7N2JF2X.js → chunk-W27AJ5B4.js} +2 -2
- package/dist/cli/chunks/{chunk-CT6SAVXQ.js → chunk-W5ZJG2OU.js} +2 -2
- package/dist/cli/chunks/{chunk-KV4T4MXK.js → chunk-W62OOK7A.js} +2 -2
- package/dist/cli/chunks/{chunk-5K26BEYB.js → chunk-WNTA4YKE.js} +2 -2
- package/dist/cli/chunks/{chunk-LZYQHVD4.js → chunk-WUOOX7UG.js} +2 -2
- package/dist/cli/chunks/{chunk-7NA7JXNB.js → chunk-WVXJ2QIG.js} +2 -2
- package/dist/cli/chunks/{chunk-KB56CPU4.js → chunk-X33CWRDF.js} +2 -2
- package/dist/cli/chunks/{chunk-7JUC2MVZ.js → chunk-XG4F4XH4.js} +2 -2
- package/dist/cli/chunks/{chunk-ZAKQLAHT.js → chunk-XH4JMX5O.js} +1 -1
- package/dist/cli/chunks/{chunk-X2Z7F4EU.js → chunk-XHHWABJV.js} +2 -2
- package/dist/cli/chunks/{chunk-7PLIEBY7.js → chunk-XHLYGXYE.js} +2 -2
- package/dist/cli/chunks/{chunk-UXZSUMEA.js → chunk-XIVVTYM2.js} +2 -2
- package/dist/cli/chunks/{chunk-MVVB7C2E.js → chunk-XM6ZVFM5.js} +156 -156
- package/dist/cli/chunks/{chunk-VTOBUZL6.js → chunk-XWIAZG3C.js} +2 -2
- package/dist/cli/chunks/{chunk-CV77DMDQ.js → chunk-Y2OX6KGN.js} +2 -2
- package/dist/cli/chunks/{chunk-VRVMIPTM.js → chunk-YUS6TWAL.js} +2 -2
- package/dist/cli/chunks/{chunk-VU5TBX2V.js → chunk-ZIPAB5J6.js} +2 -2
- package/dist/cli/chunks/{chunk-KUAKV3IW.js → chunk-ZSOMUTNL.js} +1 -1
- package/dist/cli/chunks/{chunk-UOC3O6RP.js → chunk-ZWBGYJ7K.js} +2 -2
- package/dist/cli/chunks/{chunk-5VMAV6T6.js → chunk-ZYJB6FML.js} +1 -1
- package/dist/cli/chunks/{ci-ENOASTYB.js → ci-UCUJOSBW.js} +2 -2
- package/dist/cli/chunks/{ci-config-B26OXHQM.js → ci-config-2XILD3XG.js} +2 -2
- package/dist/cli/chunks/{ci-output-JTCLLNOQ.js → ci-output-BL6KWOHW.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-23JMFNM5.js → circuit-breaker-5XLIOXE5.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-ON6L462G.js → claude-flow-setup-4IMP6ACS.js} +2 -2
- package/dist/cli/chunks/client-KKRNPX4F.js +2 -0
- package/dist/cli/chunks/{cline-installer-OWQ4D2FQ.js → cline-installer-RYLHCDK7.js} +2 -2
- package/dist/cli/chunks/{code-2ZRL7SEU.js → code-WY3GJXHX.js} +3 -3
- package/dist/cli/chunks/{code-index-extractor-JXSQVM67.js → code-index-extractor-Y4MZBZCW.js} +2 -2
- package/dist/cli/chunks/{codex-installer-7LXZYBSQ.js → codex-installer-SCJ3T3DX.js} +4 -4
- package/dist/cli/chunks/{completions-C2LR623C.js → completions-CN2DXQFU.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-TGQLHCYJ.js → complexity-analyzer-7MDPPIBH.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-RUGD24D2.js → continuedev-installer-GCEJRK34.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-ZLFVLEJP.js → copilot-installer-BHPDSELY.js} +2 -2
- package/dist/cli/chunks/core-handlers-47MPMED7.js +2 -0
- package/dist/cli/chunks/{cost-tracker-RT4QL745.js → cost-tracker-VO5MFWR6.js} +2 -2
- package/dist/cli/chunks/coverage-LYFQYNH6.js +51 -0
- package/dist/cli/chunks/cross-domain-router-U6MBFHEC.js +2 -0
- package/dist/cli/chunks/{cursor-installer-LJKLNFF6.js → cursor-installer-KP4HA7TV.js} +2 -2
- package/dist/cli/chunks/{daemon-BMDXCQT5.js → daemon-7RC7TS57.js} +3 -3
- package/dist/cli/chunks/{daemon-FBH3IRYN.js → daemon-AXLVPKVO.js} +4 -4
- package/dist/cli/chunks/{dag-attention-scheduler-JGDED55I.js → dag-attention-scheduler-NKA44RSR.js} +2 -2
- package/dist/cli/chunks/{detect-SZIHIVCJ.js → detect-CMYAJWYF.js} +2 -2
- package/dist/cli/chunks/{dist-node-FV3KWXQ6.js → dist-node-EN3PYEGW.js} +2 -2
- package/dist/cli/chunks/{domain-handler-GI5JWQOV.js → domain-handler-EXSZCX7A.js} +2 -2
- package/dist/cli/chunks/{domain-plugins-BUWY36TL.js → domain-plugins-HCQFSNL7.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-GCY7W5DA.js → domain-transfer-3LGSNTPO.js} +2 -2
- package/dist/cli/chunks/dream-76L6EEN7.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-GPRR3ZGD.js → embed-and-insert-pattern-B6MNHICW.js} +2 -2
- package/dist/cli/chunks/{eval-XPB3IGAP.js → eval-OQELIWJK.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-2E554UB3.js → experience-capture-middleware-SUFILYPW.js} +3 -3
- package/dist/cli/chunks/{fast-paths-ZSMWZPUC.js → fast-paths-UV4NDEWM.js} +2 -2
- package/dist/cli/chunks/{feature-flags-GIWVDVVC.js → feature-flags-CKTYX67J.js} +2 -2
- package/dist/cli/chunks/{feature-flags-N7EOGE5P.js → feature-flags-H7H33B6C.js} +2 -2
- package/dist/cli/chunks/file-discovery-VSFKZ3LJ.js +2 -0
- package/dist/cli/chunks/{fleet-HCHDOUCX.js → fleet-ZJBCAKRG.js} +3 -3
- package/dist/cli/chunks/{gnn-wrapper-CZNCNXXZ.js → gnn-wrapper-RUE2QZRG.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-6YUIF2YQ.js → heartbeat-handler-XRV327M7.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-NIK3KKEH.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-WJG7LUJJ.js +2 -0
- package/dist/cli/chunks/hnsw-index-D6PRI5HC.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-J3M3IK24.js → hnsw-legacy-bridge-UJID6ZZ4.js} +2 -2
- package/dist/cli/chunks/{hnswlib-node-ULGTGDZW.js → hnswlib-node-WS43R4AX.js} +2 -2
- package/dist/cli/chunks/{hooks-C4BUGYUQ.js → hooks-YZNJKXAJ.js} +10 -10
- package/dist/cli/chunks/hybrid-backend-RIUR3I7F.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-WINGVMPG.js → hypergraph-engine-XQJSIMTS.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-GADMWKAU.js → hypergraph-handler-ZD2NYXMR.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-C36YYTJ5.js +2 -0
- package/dist/cli/chunks/{init-guard-K2T4QWAO.js → init-guard-DSRUAVRT.js} +2 -2
- package/dist/cli/chunks/{init-handler-PCZTDZYI.js → init-handler-RJU5QMAP.js} +6 -6
- package/dist/cli/chunks/init-wizard-JCKNGIGT.js +2 -0
- package/dist/cli/chunks/kernel-F7ILJTYD.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-XENXNEIU.js → kilocode-installer-BCPOCVMC.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-3PG2TJ67.js → kiro-installer-GFCWCB2S.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-VTXDBHB2.js +2 -0
- package/dist/cli/chunks/learning-FZTD72CF.js +131 -0
- package/dist/cli/chunks/{llm-router-RKVDEWU2.js → llm-router-GJVKGRJL.js} +4 -4
- package/dist/cli/chunks/llm-router-service-TNOWQINA.js +2 -0
- package/dist/cli/chunks/{load-ITHC564X.js → load-YKTPOYBE.js} +2 -2
- package/dist/cli/chunks/load-test-FPVBK2EV.js +2 -0
- package/dist/cli/chunks/{mcp-TCL5UW3N.js → mcp-LT6R2IKS.js} +2 -2
- package/dist/cli/chunks/{memory-BKDAY2N2.js → memory-4HKKOLRY.js} +5 -5
- package/dist/cli/chunks/memory-backend-2QE7O67A.js +2 -0
- package/dist/cli/chunks/{memory-handlers-WN4FXFOA.js → memory-handlers-X4CMVBXB.js} +2 -2
- package/dist/cli/chunks/{multi-model-executor-VHAT7ZPF.js → multi-model-executor-2YPM2WTK.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-E3VM3EEY.js → opencode-installer-WBAJMH5K.js} +2 -2
- package/dist/cli/chunks/{orchestrator-BMQ6X762.js → orchestrator-5W5WVMVJ.js} +109 -25
- package/dist/cli/chunks/pattern-null-store-UI35ORHW.js +2 -0
- package/dist/cli/chunks/{pattern-usage-recorder-GOOR2BV5.js → pattern-usage-recorder-GXRMNPAZ.js} +2 -2
- package/dist/cli/chunks/{pipeline-5NSFQQIX.js → pipeline-2NA4DRDA.js} +2 -2
- package/dist/cli/chunks/{platform-SQM34J5G.js → platform-BGERNQ5V.js} +2 -2
- package/dist/cli/chunks/{plugin-UQJZRMZG.js → plugin-L4EPVENR.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-WMDJOL4S.js → prime-radiant-advanced-wasm-RTQRTPTM.js} +2 -2
- package/dist/cli/chunks/project-root-S7WDFTMU.js +2 -0
- package/dist/cli/chunks/protocol-executor-OPANXQVB.js +2 -0
- package/dist/cli/chunks/{protocol-handler-OBDCVY6X.js → protocol-handler-SYQXM6JK.js} +2 -2
- package/dist/cli/chunks/{prove-XDC7I4XT.js → prove-5O7GPJCU.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-3OTF4DYQ.js +2 -0
- package/dist/cli/chunks/{quality-L4GQ6WX4.js → quality-KIIDHGNF.js} +2 -2
- package/dist/cli/chunks/{quality-gate-MJG66LKN.js → quality-gate-H65VECD3.js} +3 -3
- package/dist/cli/chunks/queen-coordinator-WTYH4TAN.js +2 -0
- package/dist/cli/chunks/{real-embeddings-HW4G2LWL.js → real-embeddings-DYIOLKQ3.js} +2 -2
- package/dist/cli/chunks/{ref-validation-FC7JOJ2C.js → ref-validation-CSBJOMZM.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-KWS4CEIC.js → roocode-installer-G7OVYXEN.js} +2 -2
- package/dist/cli/chunks/router-DBBW4NC2.js +2 -0
- package/dist/cli/chunks/routing-feedback-W35QHCL4.js +2 -0
- package/dist/cli/chunks/{routing-handler-QF4WVB2S.js → routing-handler-ZNZPPI5Y.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-2MTCOUK6.js → ruvector-commands-C6IG3OY3.js} +2 -2
- package/dist/cli/chunks/rvf-dual-writer-X3NSL25Z.js +2 -0
- package/dist/cli/chunks/rvf-migration-adapter-TZR7GDOK.js +2 -0
- package/dist/cli/chunks/{rvf-migration-coordinator-BREJCXWN.js → rvf-migration-coordinator-4ATTHGHD.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-HD25ZYV5.js +2 -0
- package/dist/cli/chunks/{rvf-store-integrity-KKC6HOJD.js → rvf-store-integrity-3G6LFLT3.js} +2 -2
- package/dist/cli/chunks/safe-db-ZS2QKANY.js +2 -0
- package/dist/cli/chunks/schedule-ZH6VNA32.js +2 -0
- package/dist/cli/chunks/scheduler-T6CD74B6.js +2 -0
- package/dist/cli/chunks/{security-OSAE7VAP.js → security-A3IMVLFM.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-COUOS665.js → shared-rvf-adapter-VHWQ6US5.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-YXMPZKQE.js → shared-rvf-dual-writer-JB3QS7IG.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-47WU5EKZ.js +2 -0
- package/dist/cli/chunks/{standalone-memory-E6JBMOIL.js → standalone-memory-DDNXCSBD.js} +2 -2
- package/dist/cli/chunks/{status-handler-AFTCIYIX.js → status-handler-2HK7XPEK.js} +2 -2
- package/dist/cli/chunks/{structural-health-2FROCEI4.js → structural-health-DSJVLEPV.js} +2 -2
- package/dist/cli/chunks/{sync-VAYTOWDC.js → sync-3MUV6S5E.js} +2 -2
- package/dist/cli/chunks/{sync-YIQYOFGW.js → sync-NTUR53PI.js} +2 -2
- package/dist/cli/chunks/{task-handler-KVQHDEX3.js → task-handler-74MZN2EO.js} +2 -2
- package/dist/cli/chunks/{task-handlers-MVVECQA6.js → task-handlers-VJR6EHRZ.js} +3 -3
- package/dist/cli/chunks/{test-5JSVTOMY.js → test-O6FK3FVF.js} +4 -4
- package/dist/cli/chunks/test-runner-process-2NPW3UDQ.js +2 -0
- package/dist/cli/chunks/{test-scheduling-HBOHVLI3.js → test-scheduling-Q6QEEOS6.js} +3 -3
- package/dist/cli/chunks/{token-bootstrap-5VEPTPFA.js → token-bootstrap-TTRCECLP.js} +2 -2
- package/dist/cli/chunks/{token-usage-TBJHDLY6.js → token-usage-YEEFWSSI.js} +2 -2
- package/dist/cli/chunks/{transformers-VAWYMHMZ.js → transformers-BZCHJJJT.js} +2 -2
- package/dist/cli/chunks/tree-sitter-wasm-parser-RZAND65G.js +2 -0
- package/dist/cli/chunks/{types-R5SDZU2E.js → types-4AOKZYOX.js} +2 -2
- package/dist/cli/chunks/unified-memory-FZ5K2C7W.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-VREWX56M.js +2 -0
- package/dist/cli/chunks/unified-persistence-YZGMKX6B.js +2 -0
- package/dist/cli/chunks/{upgrade-K5PIHXRB.js → upgrade-2MWW6BT2.js} +2 -2
- package/dist/cli/chunks/{validate-RPTS7RYJ.js → validate-PAEV3GT5.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-B2ZL556X.js → validate-swarm-ZIXACK5K.js} +2 -2
- package/dist/cli/chunks/visual-security-GXGSFBVA.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-K4DUJC32.js → web-tree-sitter-VLTXZFAB.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-OK2AJN35.js → windsurf-installer-VELMLOZF.js} +2 -2
- package/dist/cli/chunks/witness-chain-MRJKVCOW.js +2 -0
- package/dist/cli/chunks/witness-chain-WWHJKITG.js +2 -0
- package/dist/cli/chunks/{witness-chain-repair-L6Y5RFXR.js → witness-chain-repair-5SAXPETG.js} +2 -2
- package/dist/cli/chunks/{witness-chain-verifier-N4CW7FZX.js → witness-chain-verifier-MIDWD4JS.js} +2 -2
- package/dist/cli/chunks/{witness-key-manager-TDNPS3WD.js → witness-key-manager-OSVCWOB2.js} +2 -2
- package/dist/cli/chunks/{workflow-XRZA3YCY.js → workflow-MK7A7QCX.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-SG7DV72E.js +2 -0
- package/dist/cli/chunks/{wrappers-5JIFWKN6.js → wrappers-5QFMCKXL.js} +2 -2
- package/dist/cli/commands/coverage.js +6 -0
- package/dist/cli/commands/learning-prune.d.ts +14 -0
- package/dist/cli/commands/learning-prune.js +105 -0
- package/dist/cli/commands/learning.js +9 -0
- package/dist/cli/handlers/brain-handler.js +12 -1
- package/dist/cli/utils/coverage-verdict.js +14 -3
- package/dist/context/compaction/index.d.ts +7 -0
- package/dist/context/compaction/index.js +30 -6
- package/dist/coordination/handlers/coverage-evidence.d.ts +19 -0
- package/dist/coordination/handlers/coverage-evidence.js +31 -2
- package/dist/coordination/handlers/coverage-handlers.js +5 -1
- package/dist/coordination/handlers/coverage-target.js +8 -1
- package/dist/coordination/handlers/quality-handlers.js +9 -1
- package/dist/coordination/result-saver-adapters.js +1 -0
- package/dist/coordination/result-saver.js +9 -5
- package/dist/domains/chaos-resilience/services/chaos-engineer.d.ts +1 -0
- package/dist/domains/chaos-resilience/services/chaos-engineer.js +23 -45
- package/dist/domains/coverage-analysis/collected-metrics.d.ts +22 -6
- package/dist/domains/coverage-analysis/collected-metrics.js +37 -12
- package/dist/domains/coverage-analysis/services/coverage-analyzer.js +2 -0
- package/dist/domains/defect-intelligence/services/defect-predictor.js +3 -6
- package/dist/domains/quality-assessment/coverage-report-event.d.ts +8 -0
- package/dist/domains/quality-assessment/coverage-report-event.js +22 -1
- package/dist/domains/quality-assessment/interfaces.d.ts +6 -0
- package/dist/domains/quality-assessment/services/quality-analyzer.d.ts +4 -0
- package/dist/domains/quality-assessment/services/quality-analyzer.js +63 -17
- package/dist/domains/test-execution/interfaces.d.ts +5 -0
- package/dist/domains/test-execution/services/test-executor.js +6 -0
- package/dist/init/init-wizard-hooks.d.ts +1 -1
- package/dist/init/init-wizard-hooks.js +7 -8
- package/dist/init/phases/07-hooks.js +90 -6
- 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/ruvector/brain-rvf-exporter.d.ts +25 -0
- package/dist/integrations/ruvector/brain-rvf-exporter.js +154 -61
- package/dist/learning/dream/dream-engine.d.ts +27 -3
- package/dist/learning/dream/dream-engine.js +97 -28
- 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/learning-retention.d.ts +103 -0
- package/dist/learning/learning-retention.js +213 -0
- package/dist/mcp/bundle.js +501 -496
- package/dist/mcp/handlers/domain-handler-configs.d.ts +9 -1
- package/dist/mcp/handlers/domain-handler-configs.js +24 -14
- package/dist/mcp/protocol-server.js +1 -1
- package/dist/mcp/tools/chaos-resilience/inject.d.ts +3 -4
- package/dist/mcp/tools/chaos-resilience/inject.js +11 -81
- package/dist/mcp/tools/learning-optimization/dream.d.ts +8 -0
- package/dist/mcp/tools/learning-optimization/dream.js +4 -0
- package/package.json +4 -2
- package/dist/cli/chunks/adapter-KCQDVYY2.js +0 -2
- package/dist/cli/chunks/agent-booster-wasm-6RRQWMNE.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-SAQOHSGN.js +0 -2
- package/dist/cli/chunks/base-WCACU3FN.js +0 -2
- package/dist/cli/chunks/brain-handler-GTQNHHZS.js +0 -94
- package/dist/cli/chunks/browser-workflow-G6IASEAP.js +0 -2
- package/dist/cli/chunks/chunk-C6JTLKG7.js +0 -141
- package/dist/cli/chunks/chunk-K65CGKLD.js +0 -8
- package/dist/cli/chunks/chunk-MB46UBGY.js +0 -3
- package/dist/cli/chunks/chunk-N4CYAKOX.js +0 -79
- package/dist/cli/chunks/chunk-PT4FMJPQ.js +0 -3
- package/dist/cli/chunks/chunk-S5AZCIZS.js +0 -2
- package/dist/cli/chunks/chunk-UT2VZ33P.js +0 -2
- package/dist/cli/chunks/client-TV3V2YZ5.js +0 -2
- package/dist/cli/chunks/core-handlers-PZT4OLWR.js +0 -2
- package/dist/cli/chunks/coverage-NV3C4IMM.js +0 -50
- package/dist/cli/chunks/cross-domain-router-QOFCZ7G4.js +0 -2
- package/dist/cli/chunks/dream-TRFBGDSQ.js +0 -2
- package/dist/cli/chunks/file-discovery-WCKGMSPZ.js +0 -2
- package/dist/cli/chunks/heartbeat-scheduler-P44A2OX3.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-ZJQIQJKC.js +0 -2
- package/dist/cli/chunks/hnsw-index-HMG2GH3Z.js +0 -2
- package/dist/cli/chunks/hybrid-backend-B7M74PZG.js +0 -2
- package/dist/cli/chunks/impact-analyzer-PZYOVKQO.js +0 -2
- package/dist/cli/chunks/init-wizard-TZDJQK3U.js +0 -2
- package/dist/cli/chunks/kernel-Y6RRIOKW.js +0 -2
- package/dist/cli/chunks/knowledge-graph-BVD5Z66M.js +0 -2
- package/dist/cli/chunks/learning-6KDH7FK4.js +0 -122
- package/dist/cli/chunks/llm-router-service-KHCAMSUU.js +0 -2
- package/dist/cli/chunks/load-test-RUF7DZA5.js +0 -2
- package/dist/cli/chunks/memory-backend-7ZLFOVGG.js +0 -2
- package/dist/cli/chunks/pattern-null-store-RY6CVYHP.js +0 -2
- package/dist/cli/chunks/project-root-IO5KRNGL.js +0 -2
- package/dist/cli/chunks/protocol-executor-U2CUDWDE.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-DQSSX2IP.js +0 -2
- package/dist/cli/chunks/queen-coordinator-6FN4BZIX.js +0 -2
- package/dist/cli/chunks/router-YUO3I7RU.js +0 -2
- package/dist/cli/chunks/routing-feedback-36SLQGJE.js +0 -2
- package/dist/cli/chunks/rvf-dual-writer-FRYZH3WZ.js +0 -2
- package/dist/cli/chunks/rvf-migration-adapter-XXNITL5I.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-D2WWKJIV.js +0 -2
- package/dist/cli/chunks/safe-db-4RRIGRXD.js +0 -2
- package/dist/cli/chunks/schedule-25RTO4DQ.js +0 -2
- package/dist/cli/chunks/scheduler-BPIOJZ5P.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-EDF47DDX.js +0 -2
- package/dist/cli/chunks/test-runner-process-LEPF2OSS.js +0 -2
- package/dist/cli/chunks/tree-sitter-wasm-parser-TSZTCMFV.js +0 -2
- package/dist/cli/chunks/unified-memory-TLGSSLMI.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-MSUR7ZOO.js +0 -2
- package/dist/cli/chunks/unified-persistence-VFFOTWK7.js +0 -2
- package/dist/cli/chunks/visual-security-6Q44XNLB.js +0 -2
- package/dist/cli/chunks/witness-chain-KDOMXDQX.js +0 -2
- package/dist/cli/chunks/witness-chain-N3OY2RMH.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-CVNNT2RJ.js +0 -2
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.13");process.exit(0)}
|
|
2
|
-
import{a as ie}from"./chunk-N4CYAKOX.js";import{c as te,d as ne}from"./chunk-3AN5TNGD.js";import{a as ee}from"./chunk-SYV2V3PL.js";import{c as R}from"./chunk-T3PGQFDI.js";import{b as A,d as Y}from"./chunk-VTOBUZL6.js";import{b as J,c as K,e as ue}from"./chunk-KDNJ4F3P.js";import{a as N,b as X,d as le}from"./chunk-KV4T4MXK.js";import{i as D}from"./chunk-H4H2YSFH.js";import{a as Z,d as he}from"./chunk-TOQWL2ZF.js";import{a as Q}from"./chunk-UT2VZ33P.js";import{c as _}from"./chunk-GB6HBNH2.js";import{a as C,e as F}from"./chunk-3Y2ROSCL.js";var k={dbPath:".agentic-qe/dream.db",similarityThreshold:.5,maxEdgesPerNode:20,walMode:!0,debug:!1};Y();F();var T=class d{config;db=null;persistence=null;prepared=new Map;initialized=!1;constructor(e){this.config={...k,...e}}async initialize(){if(!this.initialized)try{if(this.persistence=R(),this.persistence.isInitialized()||await this.persistence.initialize(),this.db=this.persistence.getDatabase(),this.prepareStatements(),this.initialized=!0,this.config.debug){let e=await this.getStats();console.log(`[ConceptGraph] Initialized: ${this.persistence.getDbPath()}`,e)}}catch(e){throw new Error(`Failed to initialize ConceptGraph: ${C(e)}`)}}prepareStatements(){if(!this.db)throw new Error("Database not initialized");this.prepared.set("insertNode",this.db.prepare(`
|
|
3
|
-
INSERT INTO concept_nodes
|
|
4
|
-
(id, concept_type, content, embedding, activation_level, last_activated, pattern_id, metadata)
|
|
5
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
6
|
-
`)),this.prepared.set("getNode",this.db.prepare(`
|
|
7
|
-
SELECT * FROM concept_nodes WHERE id = ?
|
|
8
|
-
`)),this.prepared.set("updateActivation",this.db.prepare(`
|
|
9
|
-
UPDATE concept_nodes
|
|
10
|
-
SET activation_level = ?, last_activated = datetime('now')
|
|
11
|
-
WHERE id = ?
|
|
12
|
-
`)),this.prepared.set("getActiveNodes",this.db.prepare(`
|
|
13
|
-
SELECT * FROM concept_nodes
|
|
14
|
-
WHERE activation_level >= ?
|
|
15
|
-
ORDER BY activation_level DESC
|
|
16
|
-
`)),this.prepared.set("getNodesByType",this.db.prepare(`
|
|
17
|
-
SELECT * FROM concept_nodes WHERE concept_type = ?
|
|
18
|
-
`)),this.prepared.set("getAllNodes",this.db.prepare(`
|
|
19
|
-
SELECT * FROM concept_nodes
|
|
20
|
-
`)),this.prepared.set("insertEdge",this.db.prepare(`
|
|
21
|
-
INSERT INTO concept_edges
|
|
22
|
-
(id, source, target, edge_type, weight, evidence)
|
|
23
|
-
VALUES (?, ?, ?, ?, ?, ?)
|
|
24
|
-
`)),this.prepared.set("getEdge",this.db.prepare(`
|
|
25
|
-
SELECT * FROM concept_edges WHERE source = ? AND target = ?
|
|
26
|
-
`)),this.prepared.set("updateEdge",this.db.prepare(`
|
|
27
|
-
UPDATE concept_edges
|
|
28
|
-
SET weight = ?, evidence = evidence + 1, updated_at = datetime('now')
|
|
29
|
-
WHERE source = ? AND target = ?
|
|
30
|
-
`)),this.prepared.set("getOutgoingEdges",this.db.prepare(`
|
|
31
|
-
SELECT * FROM concept_edges WHERE source = ?
|
|
32
|
-
`)),this.prepared.set("getIncomingEdges",this.db.prepare(`
|
|
33
|
-
SELECT * FROM concept_edges WHERE target = ?
|
|
34
|
-
`)),this.prepared.set("countNodes",this.db.prepare(`
|
|
35
|
-
SELECT COUNT(*) as count FROM concept_nodes
|
|
36
|
-
`)),this.prepared.set("countEdges",this.db.prepare(`
|
|
37
|
-
SELECT COUNT(*) as count FROM concept_edges
|
|
38
|
-
`)),this.prepared.set("countByType",this.db.prepare(`
|
|
39
|
-
SELECT concept_type, COUNT(*) as count FROM concept_nodes GROUP BY concept_type
|
|
40
|
-
`))}async addNode(e){this.ensureInitialized();let t=D(),n=new Date().toISOString(),i=this.prepared.get("insertNode");if(!i)throw new Error("Prepared statement not found: insertNode");let s=e.embedding?Buffer.from(new Float32Array(e.embedding).buffer):null;return i.run(t,e.conceptType,e.content,s,0,n,e.patternId||null,e.metadata?JSON.stringify(e.metadata):null),this.config.debug&&console.log(`[ConceptGraph] Added node: ${t} (${e.conceptType})`),t}async getNode(e){this.ensureInitialized();let t=this.prepared.get("getNode");if(!t)throw new Error("Prepared statement not found: getNode");let n=t.get(e);return n?this.rowToNode(n):null}async updateActivation(e,t){this.ensureInitialized();let n=this.prepared.get("updateActivation");if(!n)throw new Error("Prepared statement not found: updateActivation");let i=Math.max(0,Math.min(1,t));n.run(i,e)}async getActiveNodes(e=.1){this.ensureInitialized();let t=this.prepared.get("getActiveNodes");if(!t)throw new Error("Prepared statement not found: getActiveNodes");return t.all(e).map(i=>this.rowToNode(i))}async getNodesByType(e){this.ensureInitialized();let t=this.prepared.get("getNodesByType");if(!t)throw new Error("Prepared statement not found: getNodesByType");return t.all(e).map(i=>this.rowToNode(i))}async addEdge(e,t,n,i=1){this.ensureInitialized();let s=await this.getEdgeBetween(e,t);if(s)return await this.strengthenEdge(e,t,.1),s.id;let r=D(),o=this.prepared.get("insertEdge");if(!o)throw new Error("Prepared statement not found: insertEdge");return o.run(r,e,t,n,Math.max(0,Math.min(1,i)),1),this.config.debug&&console.log(`[ConceptGraph] Added edge: ${e} -> ${t} (${n})`),r}async strengthenEdge(e,t,n=.1){this.ensureInitialized();let i=await this.getEdgeBetween(e,t);if(!i)return;let s=Math.min(1,i.weight+n),r=this.prepared.get("updateEdge");if(!r)throw new Error("Prepared statement not found: updateEdge");r.run(s,e,t)}async getNeighbors(e){this.ensureInitialized();let t=[],n=this.prepared.get("getOutgoingEdges");if(!n)throw new Error("Prepared statement not found: getOutgoingEdges");let i=n.all(e);for(let o of i){let a=await this.getNode(o.target);a&&t.push({node:a,edge:this.rowToEdge(o)})}let s=this.prepared.get("getIncomingEdges");if(!s)throw new Error("Prepared statement not found: getIncomingEdges");let r=s.all(e);for(let o of r){let a=await this.getNode(o.source);a&&t.push({node:a,edge:this.rowToEdge(o)})}return t}async findPath(e,t,n=5){this.ensureInitialized();let i=new Set,s=[{nodeId:e,path:[e]}];for(;s.length>0;){let r=s.shift();if(r.nodeId===t){let a=[];for(let c of r.path){let p=await this.getNode(c);p&&a.push(p)}return a}if(r.path.length>n||i.has(r.nodeId))continue;i.add(r.nodeId);let o=await this.getNeighbors(r.nodeId);for(let{node:a}of o)i.has(a.id)||s.push({nodeId:a.id,path:[...r.path,a.id]})}return[]}async getCluster(e,t=2){this.ensureInitialized();let n=new Set,i=[],s=async(r,o)=>{if(n.has(r)||o>t)return;n.add(r);let a=await this.getNode(r);if(a&&(i.push(a),o<t)){let c=await this.getNeighbors(r);for(let{node:p}of c)await s(p.id,o+1)}};return await s(e,0),i}static TECHNIQUE_PATTERN_TYPES=new Set(["coverage-strategy","mutation-strategy","refactor-safe","error-handling","meta-optimization"]);async loadFromPatterns(e){this.ensureInitialized();let t=0,n=[],i=new Map;for(let s of e)try{if(await this.findNodeByPatternId(s.id))continue;let o=s.patternType&&d.TECHNIQUE_PATTERN_TYPES.has(s.patternType)?"technique":"pattern",a=await this.addNode({conceptType:o,content:`${s.name}: ${s.description}`,patternId:s.id,metadata:{domain:s.domain,patternType:s.patternType,confidence:s.confidence,successRate:s.successRate}});t++,n.push(a);let c=s.domain||"unknown";i.has(c)||i.set(c,[]),i.get(c).push(a);let p=await this.findDomainNode(s.domain);if(!p){let l=await this.addNode({conceptType:"domain",content:s.domain,metadata:{patternCount:1}});p=await this.getNode(l)}p&&await this.addEdge(a,p.id,"co_occurrence",.8)}catch(r){this.config.debug&&console.error(`[ConceptGraph] Failed to load pattern: ${s.id}`,r)}if(t>0){let s=await this.discoverSameDomainEdges(i),r=await this.pruneEdges();this.config.debug&&console.log(`[ConceptGraph] Discovered ${s} same-domain edges, pruned ${r}`)}return console.log(`[ConceptGraph] Loaded ${t} new patterns (${e.length-t} already existed)`),t}async discoverSameDomainEdges(e){if(this.ensureInitialized(),!this.db)return 0;let t=15,n=5e3,i=0;if(e&&e.size>0)for(let[s,r]of e){let o=this.countDomainSimilarityEdges(s);if(o>=n){console.log(`[ConceptGraph] Domain '${s}' already at edge cap (${o}/${n}), skipping`);continue}let a=new Set(r),c=n-o,l=this.db.prepare("SELECT id, metadata FROM concept_nodes WHERE concept_type IN ('pattern', 'technique')").all().filter(u=>{if(a.has(u.id))return!1;let g=u.metadata?A(u.metadata):{};return String(g.domain||"unknown")===s}),h=this.db.transaction(()=>{let u=0;for(let g of r){let f=0;for(let v of l){if(f>=t||u>=c)break;if(!this.prepared.get("getEdge")?.get(g,v.id)){let E=D();this.prepared.get("insertEdge").run(E,g,v.id,"similarity",.6,1),u++,f++}}if(u>=c)break}for(let g=0;g<r.length&&u<c;g++){let f=0;for(let v=g+1;v<r.length&&u<c&&!(f>=t);v++)if(!this.prepared.get("getEdge")?.get(r[g],r[v])){let E=D();this.prepared.get("insertEdge").run(E,r[g],r[v],"similarity",.6,1),u++,f++}}return u});i+=h()}else{let s=this.db.prepare("SELECT id, metadata FROM concept_nodes WHERE concept_type = 'pattern'").all(),r=new Map;for(let a of s){let c=a.metadata?A(a.metadata):{},p=String(c.domain||"unknown");r.has(p)||r.set(p,[]),r.get(p).push(a)}let o=this.db.transaction(()=>{let a=0;for(let[c,p]of r){let l=this.countDomainSimilarityEdges(c);if(l>=n)continue;let h=0,u=n-l;for(let g=0;g<p.length&&h<u;g++){let f=0;for(let v=g+1;v<p.length&&h<u&&!(f>=t);v++)if(!this.prepared.get("getEdge")?.get(p[g].id,p[v].id)){let E=D();this.prepared.get("insertEdge").run(E,p[g].id,p[v].id,"similarity",.6,1),a++,h++,f++}}}return a});i+=o()}return i}connectToDomainMates(e,t,n,i=10){if(!this.db)return;let s=this.db.prepare(`SELECT id FROM concept_nodes
|
|
41
|
-
WHERE concept_type IN ('pattern', 'technique')
|
|
42
|
-
AND json_extract(metadata, '$.domain') = ?
|
|
43
|
-
AND (pattern_id IS NULL OR pattern_id != ?)
|
|
44
|
-
LIMIT ?`).all(t,n,i);for(let r of s)this.prepared.get("getEdge")?.get(e,r.id)||this.prepared.get("insertEdge").run(D(),e,r.id,"co_occurrence",.4,1)}async loadFailuresAsErrors(e){this.ensureInitialized();let t=0;for(let n of e)try{let i=`error:${n.id}`;if(await this.findNodeByPatternId(i))continue;let r=await this.addNode({conceptType:"error",content:n.failureMode,patternId:i,metadata:{domain:n.domain,sourcePatternId:n.sourcePatternId}});t++,this.connectToDomainMates(r,n.domain,n.sourcePatternId)}catch(i){this.config.debug&&console.error(`[ConceptGraph] Failed to load failure: ${n.id}`,i)}return t}async loadSuccessesAsOutcomes(e){this.ensureInitialized();let t=0;for(let n of e)try{let i=`outcome:${n.id}`;if(await this.findNodeByPatternId(i))continue;let r=await this.addNode({conceptType:"outcome",content:n.description,patternId:i,metadata:{domain:n.domain,sourcePatternId:n.sourcePatternId}});t++,this.connectToDomainMates(r,n.domain,n.sourcePatternId)}catch(i){this.config.debug&&console.error(`[ConceptGraph] Failed to load success: ${n.id}`,i)}return t}countDomainSimilarityEdges(e){return this.db?this.db.prepare(`
|
|
45
|
-
SELECT COUNT(*) as count FROM concept_edges e
|
|
46
|
-
JOIN concept_nodes n ON e.source = n.id
|
|
47
|
-
WHERE e.edge_type = 'similarity'
|
|
48
|
-
AND n.concept_type IN ('pattern', 'technique')
|
|
49
|
-
AND json_extract(n.metadata, '$.domain') = ?
|
|
50
|
-
`).get(e).count:0}async pruneEdges(e=15,t=.3){if(this.ensureInitialized(),!this.db)return 0;let n=0;return n=this.db.transaction(()=>{let s=0,r=this.db.prepare(`
|
|
51
|
-
DELETE FROM concept_edges
|
|
52
|
-
WHERE edge_type = 'similarity' AND weight < ?
|
|
53
|
-
`).run(t);s+=r.changes;let o=this.db.prepare(`
|
|
54
|
-
SELECT source, COUNT(*) as cnt FROM concept_edges
|
|
55
|
-
WHERE edge_type = 'similarity'
|
|
56
|
-
GROUP BY source
|
|
57
|
-
HAVING cnt > ?
|
|
58
|
-
`).all(e);for(let{source:a}of o){let c=this.db.prepare(`
|
|
59
|
-
DELETE FROM concept_edges
|
|
60
|
-
WHERE id IN (
|
|
61
|
-
SELECT id FROM concept_edges
|
|
62
|
-
WHERE source = ? AND edge_type = 'similarity'
|
|
63
|
-
ORDER BY weight DESC
|
|
64
|
-
LIMIT -1 OFFSET ?
|
|
65
|
-
)
|
|
66
|
-
`).run(a,e);s+=c.changes}return s})(),n>0&&console.log(`[ConceptGraph] Pruned ${n} edges (maxPerNode=${e}, minWeight=${t})`),n}async getStats(){this.ensureInitialized();let e=this.prepared.get("countNodes"),t=this.prepared.get("countEdges"),n=this.prepared.get("countByType");if(!e||!t||!n)throw new Error("Prepared statements not found");let i=e.get().count,s=t.get().count,r={pattern:0,technique:0,domain:0,outcome:0,error:0},o=n.all();for(let c of o)r[c.concept_type]=c.count;let a=0;return i>0&&(a=this.db.prepare("SELECT AVG(activation_level) as avg FROM concept_nodes").get().avg||0),{nodeCount:i,edgeCount:s,byType:r,avgEdgesPerNode:i>0?s/i:0,avgActivation:a}}async close(){this.prepared.clear(),this.db=null,this.persistence=null,this.initialized=!1}ensureInitialized(){if(!this.initialized||!this.db)throw new Error("ConceptGraph not initialized. Call initialize() first.")}async getEdgeBetween(e,t){let n=this.prepared.get("getEdge");if(!n)throw new Error("Prepared statement not found: getEdge");let i=n.get(e,t);return i?this.rowToEdge(i):null}async findDomainNode(e){if(!this.db)return null;let n=this.db.prepare("SELECT * FROM concept_nodes WHERE concept_type = 'domain' AND content = ?").get(e);return n?this.rowToNode(n):null}async findNodeByPatternId(e){if(!this.db)return null;let n=this.db.prepare("SELECT * FROM concept_nodes WHERE pattern_id = ? LIMIT 1").get(e);return n?this.rowToNode(n):null}rowToNode(e){let t;if(e.embedding){let n=e.embedding,i=new Float32Array(n.buffer,n.byteOffset,n.byteLength/4);t=Array.from(i)}return{id:e.id,conceptType:e.concept_type,content:e.content,embedding:t,activationLevel:e.activation_level||0,lastActivated:e.last_activated?new Date(e.last_activated):void 0,patternId:e.pattern_id||void 0,metadata:e.metadata?A(e.metadata):void 0,createdAt:e.created_at?new Date(e.created_at):void 0}}rowToEdge(e){return{id:e.id,source:e.source,target:e.target,weight:e.weight,edgeType:e.edge_type,evidence:e.evidence,createdAt:e.created_at?new Date(e.created_at):void 0,updatedAt:e.updated_at?new Date(e.updated_at):void 0}}};function me(d){return new T(d)}le();function ge(d,e){if(e<0||e>=d.length)return d[0]??0;let t=0,n=d.length-1;for(;t<n;){let i=t+n>>1;if(d[i]<d[t]){let a=d[t];d[t]=d[i],d[i]=a}if(d[n]<d[t]){let a=d[t];d[t]=d[n],d[n]=a}if(d[i]<d[n]){let a=d[i];d[i]=d[n],d[n]=a}let s=d[n],r=t;for(let a=t;a<n;a++)if(d[a]<=s){let c=d[r];d[r]=d[a],d[a]=c,r++}let o=d[r];if(d[r]=d[n],d[n]=o,r===e)return d[r];r<e?t=r+1:n=r-1}return d[t]}var z=1e4,G=5e4,H=.8,re={decayRate:.1,spreadFactor:.5,threshold:.1,maxIterations:20,noiseLevel:.05},S=class{graph;config;activationHistory=new Map;coActivationCounts=new Map;constructor(e,t={}){this.graph=e,this.config={...re,...t}}async spread(e,t=1,n){let i=e.filter(l=>this.graph.getConcept(l)!==void 0);if(i.length===0)return{iterations:0,nodesActivated:0,peakActivation:0,activatedNodes:[],novelAssociations:[]};for(let l of i)this.graph.setActivation(l,t),this.recordActivation(l,t);let s=0,r=t,o=0,a=0;for(;s<this.config.maxIterations&&!(n!==void 0&&Date.now()>=n);){let l=await this.spreadIteration(),h=this.graph.getActiveNodes(this.config.threshold);for(let u of h)u.activationLevel>r&&(r=u.activationLevel);if(h.length===o&&l===0){if(a++,a>=3)break}else a=0;o=h.length,s++}let c=this.graph.getActiveNodes(this.config.threshold).map(l=>({nodeId:l.id,activation:l.activationLevel})).sort((l,h)=>h.activation-l.activation),p=await this.findNovelAssociations(this.config.threshold);return this.trimHistory(),{iterations:s,nodesActivated:c.length,peakActivation:r,activatedNodes:c,novelAssociations:p.map(l=>({source:l.source.id,target:l.target.id,strength:l.coActivation}))}}async dream(e,t){let n=Date.now(),i=[],s=0,r=0,o=new Set,a=this.graph.getAllConcepts(0);if(a.length===0)return{iterations:0,nodesActivated:0,peakActivation:0,activatedNodes:[],novelAssociations:[]};let c=n+e;for(;Date.now()<c&&!t?.aborted;){let h=X(0,a.length),u=a[h];if(u){let g=this.config.noiseLevel+N()*this.config.noiseLevel*2,f=u.activationLevel,v=Math.min(1,f+g+.3);this.graph.setActivation(u.id,v);let y=await this.spread([u.id],v,c);s+=y.iterations,y.peakActivation>r&&(r=y.peakActivation);for(let E of y.activatedNodes)o.add(E.nodeId);for(let E of y.novelAssociations)i.push(E)}if(Date.now()>=c||t?.aborted)break;await this.sleep(50+N()*50,t)}let p=this.deduplicateAssociations(i),l=Array.from(o).map(h=>{let u=this.graph.getConcept(h);return{nodeId:h,activation:u?.activationLevel??0}}).filter(h=>h.activation>0).sort((h,u)=>u.activation-h.activation);return this.trimHistory(),{iterations:s,nodesActivated:l.length,peakActivation:r,activatedNodes:l,novelAssociations:p.slice(0,20)}}async findNovelAssociations(e){let t=e??this.config.threshold,n=this.graph.getActiveNodes(t);if(n.length<2)return[];let i=200;n.length>i&&(n=n.sort((r,o)=>o.activationLevel-r.activationLevel).slice(0,i));let s=[];for(let r=0;r<n.length;r++)for(let o=r+1;o<n.length;o++){let a=n[r],c=n[o],p=Math.sqrt(a.activationLevel*c.activationLevel),l=this.graph.getEdge(a.id,c.id),h=this.graph.getEdge(c.id,a.id),u=l!==void 0||h!==void 0,g=l?.weight??h?.weight??0,f=!u||g<.3;p>.3&&(s.push({source:a,target:c,coActivation:p,isNovel:f}),this.trackCoActivation(a.id,c.id))}return s.sort((r,o)=>r.isNovel!==o.isNovel?r.isNovel?-1:1:o.coActivation-r.coActivation).slice(0,10)}async reset(){let e=this.graph.getAllConcepts(0);for(let t of e)this.graph.setActivation(t.id,0);this.activationHistory.clear(),this.coActivationCounts.clear()}getConfig(){return{...this.config}}trimActivationHistory(){if(this.activationHistory.size<=z)return;let e=Math.floor(z*H),t=this.activationHistory.size-e,n=Array.from(this.activationHistory.keys()).slice(0,t);for(let i of n)this.activationHistory.delete(i)}trimCoActivationCounts(){if(this.coActivationCounts.size<=G)return;let e=Math.floor(G*H),t=this.coActivationCounts.size-e,n=Array.from(this.coActivationCounts.values()),i=ge(n,t-1),s=[];for(let[r,o]of this.coActivationCounts){if(s.length>=t)break;o<=i&&s.push(r)}for(let r of s)this.coActivationCounts.delete(r)}trimHistory(){this.trimActivationHistory(),this.trimCoActivationCounts()}getHistorySizes(){return{activationHistorySize:this.activationHistory.size,coActivationCountsSize:this.coActivationCounts.size}}async spreadIteration(){let e=this.graph.getActiveNodes(this.config.threshold),t=0,n=[];for(let i of e){let s=this.graph.getEdges(i.id);for(let r of s){let o=this.graph.getConcept(r.target);if(!o)continue;let a=i.activationLevel*r.weight*this.config.spreadFactor;if(a>.01){let c=o.activationLevel,p=Math.min(1,c+a);n.push({nodeId:r.target,newActivation:p})}}}for(let i of n){let s=this.graph.getConcept(i.nodeId);s&&i.newActivation>s.activationLevel&&(this.graph.setActivation(i.nodeId,i.newActivation),this.recordActivation(i.nodeId,i.newActivation),t++)}return this.applyDecay(),this.injectNoise(),t}applyDecay(){let e=1-this.config.decayRate;this.graph.decayActivations(e)}injectNoise(){if(this.config.noiseLevel<=0)return;let e=this.graph.getAllConcepts(0);for(let t of e)if(t.activationLevel>0){let n=(N()-.5)*2*this.config.noiseLevel,i=Math.max(0,Math.min(1,t.activationLevel+n));this.graph.setActivation(t.id,i)}}recordActivation(e,t){let n=this.activationHistory.get(e)||[];n.push(t),n.length>50&&n.shift(),this.activationHistory.set(e,n)}trackCoActivation(e,t){let n=[e,t].sort().join(":"),i=this.coActivationCounts.get(n)||0;this.coActivationCounts.set(n,i+1)}deduplicateAssociations(e){let t=new Map;for(let n of e){let i=[n.source,n.target].sort().join(":"),s=t.get(i);(!s||n.strength>s.strength)&&t.set(i,n)}return Array.from(t.values()).sort((n,i)=>i.strength-n.strength)}sleep(e,t){return new Promise(n=>{let i=setTimeout(s,e);function s(){clearTimeout(i),t?.removeEventListener("abort",s),n()}t?.addEventListener("abort",s,{once:!0})})}};ue();import{randomUUID as fe}from"crypto";var se={minNoveltyScore:.3,minConfidence:.5,maxInsightsPerCycle:10},I=class{graph;config;constructor(e,t={}){this.graph=e,this.config={...se,...t}}async generateFromActivation(e,t){let n=[],i=t.activatedNodes.map(c=>this.graph.getConcept(c.nodeId)).filter(c=>c!==void 0);if(i.length<2)return[];let s=await this.detectPatternMerges(i);for(let c of s)c.cycleId=e,n.push(c);let r=await this.detectNovelAssociations(t.novelAssociations);for(let c of r)c.cycleId=e,n.push(c);let o=await this.detectOptimizations(i);for(let c of o)c.cycleId=e,n.push(c);let a=await this.detectGaps(i);for(let c of a)c.cycleId=e,n.push(c);return n.filter(c=>c.noveltyScore>=this.config.minNoveltyScore).sort((c,p)=>p.noveltyScore-c.noveltyScore).slice(0,this.config.maxInsightsPerCycle)}async detectPatternMerges(e){let t=[],n=e.filter(i=>i.conceptType==="pattern"||i.conceptType==="technique");if(n.length<2)return t;for(let i=0;i<n.length;i++)for(let s=i+1;s<n.length;s++){let r=n[i],o=n[s],a=this.graph.getEdge(r.id,o.id),c=this.graph.getEdge(o.id,r.id),p=Math.max(a?.weight??0,c?.weight??0),l=this.calculateContentSimilarity(r.content,o.content),h=Math.sqrt(r.activationLevel*o.activationLevel),u=p*.4+l*.3+h*.3;if(u>.5){let g=this.calculateNovelty({type:"pattern_merge",sourceConcepts:[r.id,o.id]}),f=this.calculateConfidence({type:"pattern_merge",sourceConcepts:[r.id,o.id],edgeWeight:p,contentSimilarity:l,coActivation:h});t.push({id:this.generateId(),cycleId:"",type:"pattern_merge",sourceConcepts:[r.id,o.id],description:this.generatePatternMergeDescription(r,o,u),noveltyScore:g,confidenceScore:f,actionable:f>=this.config.minConfidence,applied:!1,suggestedAction:f>=this.config.minConfidence?`Merge "${this.truncate(r.content,30)}" with "${this.truncate(o.content,30)}" into a unified pattern.`:void 0,createdAt:new Date})}}return t}async detectNovelAssociations(e){let t=[];for(let n of e){let i=this.graph.getConcept(n.source),s=this.graph.getConcept(n.target);if(!i||!s)continue;let r=this.graph.getEdge(n.source,n.target);if(r&&r.weight>.5)continue;let o=i.conceptType!==s.conceptType,a=this.calculateNovelty({type:"novel_association",sourceConcepts:[n.source,n.target],isCrossDomain:o,strength:n.strength}),c=this.calculateConfidence({type:"novel_association",sourceConcepts:[n.source,n.target],coActivation:n.strength,isCrossDomain:o});t.push({id:this.generateId(),cycleId:"",type:"novel_association",sourceConcepts:[n.source,n.target],description:this.generateNovelAssociationDescription(i,s,n.strength,o),noveltyScore:a,confidenceScore:c,actionable:c>=this.config.minConfidence,applied:!1,suggestedAction:c>=this.config.minConfidence?`Investigate connection between "${this.truncate(i.content,25)}" and "${this.truncate(s.content,25)}".`:void 0,createdAt:new Date})}return t}async detectOptimizations(e){let t=[];for(let n of e){if(n.conceptType!=="pattern"&&n.conceptType!=="technique")continue;let i=n.metadata??{},s=i.successRate,r=i.executionCount,o=i.confidence,a=s!==void 0&&s<.7,c=r!==void 0&&r>10,p=o!==void 0&&o<.6;if(a||c&&p){let l=this.calculateNovelty({type:"optimization",sourceConcepts:[n.id],hasLowSuccess:a,hasHighUsage:c}),h=this.calculateConfidence({type:"optimization",sourceConcepts:[n.id],hasLowSuccess:a,hasHighUsage:c,metadata:i});t.push({id:this.generateId(),cycleId:"",type:"optimization",sourceConcepts:[n.id],description:this.generateOptimizationDescription(n,s,r),noveltyScore:l,confidenceScore:h,actionable:h>=this.config.minConfidence,applied:!1,suggestedAction:h>=this.config.minConfidence?`Review and optimize "${this.truncate(n.content,40)}" to improve success rate.`:void 0,createdAt:new Date})}}return t}async detectGaps(e){let t=[],n={pattern:[],technique:[],domain:[],outcome:[],error:[]};for(let i of e){let s=i.conceptType??"pattern",r=J(n,s)??[];K(n,s,r),r.push(i)}for(let i of n.error??[])if(!this.graph.getEdges(i.id).some(o=>{let a=this.graph.getConcept(o.target);return a&&(a.conceptType==="pattern"||a.conceptType==="technique")})){let o=this.calculateNovelty({type:"gap_detection",sourceConcepts:[i.id],gapType:"missing_resolution"}),a=this.calculateConfidence({type:"gap_detection",sourceConcepts:[i.id],gapType:"missing_resolution"});t.push({id:this.generateId(),cycleId:"",type:"gap_detection",sourceConcepts:[i.id],description:`No resolution pattern found for error: "${this.truncate(i.content,50)}". Consider creating a fix pattern.`,noveltyScore:o,confidenceScore:a,actionable:!0,applied:!1,suggestedAction:`Create a resolution pattern for: "${this.truncate(i.content,40)}".`,createdAt:new Date})}for(let i of n.outcome??[])if(!this.graph.getEdges(i.id).some(o=>{let a=this.graph.getConcept(o.target);return a&&a.conceptType==="technique"})&&(n.technique?.length??0)===0){let o=this.calculateNovelty({type:"gap_detection",sourceConcepts:[i.id],gapType:"missing_technique"}),a=this.calculateConfidence({type:"gap_detection",sourceConcepts:[i.id],gapType:"missing_technique"});t.push({id:this.generateId(),cycleId:"",type:"gap_detection",sourceConcepts:[i.id],description:`Outcome "${this.truncate(i.content,40)}" has no associated technique. Document how this outcome is achieved.`,noveltyScore:o,confidenceScore:a,actionable:!0,applied:!1,suggestedAction:`Document the technique for achieving: "${this.truncate(i.content,35)}".`,createdAt:new Date})}return t}calculateNovelty(e){let t=.5;if(e.isCrossDomain&&(t+=.2),e.strength!==void 0&&e.strength>.5&&(t+=.15),e.type==="gap_detection"&&(t+=.2),e.hasHighUsage&&e.hasLowSuccess&&(t+=.15),e.sourceConcepts.length>=2){let n=this.graph.getEdge(e.sourceConcepts[0],e.sourceConcepts[1]);n?n.weight<.3&&(t+=.05):t+=.1}return Math.min(1,Math.max(0,t))}calculateConfidence(e){let t=.4;if(e.coActivation!==void 0&&(t+=e.coActivation*.3),e.edgeWeight!==void 0&&(t+=e.edgeWeight*.2),e.contentSimilarity!==void 0&&e.type==="pattern_merge"&&(t+=e.contentSimilarity*.2),e.isCrossDomain&&(t-=.1),e.hasHighUsage&&e.hasLowSuccess&&(t+=.15),e.metadata){let n=Math.min(Object.keys(e.metadata).length*.05,.15);t+=n}return e.gapType&&(t+=.1),Math.min(1,Math.max(0,t))}async insightToPattern(e){if(!e.actionable)return null;let t=e.sourceConcepts.map(n=>this.graph.getConcept(n)).filter(n=>n!==void 0);if(t.length===0)return null;switch(e.type){case"pattern_merge":{let[n,i]=t;return{name:`Merged: ${this.truncate(n?.content??"",20)} + ${this.truncate(i?.content??"",20)}`,description:e.description,template:{type:"merged_pattern",sourcePatterns:e.sourceConcepts,mergedContent:t.map(s=>s.content).join(" | "),metadata:{noveltyScore:e.noveltyScore,confidenceScore:e.confidenceScore,createdFrom:"dream_insight"}}}}case"novel_association":{let[n,i]=t;return{name:`Association: ${n?.conceptType} - ${i?.conceptType}`,description:e.description,template:{type:"association_pattern",source:{id:n?.id,type:n?.conceptType,content:n?.content},target:{id:i?.id,type:i?.conceptType,content:i?.content},metadata:{noveltyScore:e.noveltyScore,confidenceScore:e.confidenceScore,createdFrom:"dream_insight"}}}}case"optimization":{let[n]=t;return{name:`Optimized: ${this.truncate(n?.content??"",30)}`,description:e.description,template:{type:"optimization_pattern",originalPattern:n?.id,suggestedAction:e.suggestedAction,metadata:{noveltyScore:e.noveltyScore,confidenceScore:e.confidenceScore,createdFrom:"dream_insight"}}}}case"gap_detection":{let[n]=t;return{name:`Gap Fill: ${this.truncate(n?.content??"",30)}`,description:e.description,template:{type:"gap_fill_pattern",relatedConcept:n?.id,gapType:n?.conceptType==="error"?"missing_resolution":"missing_technique",suggestedAction:e.suggestedAction,metadata:{noveltyScore:e.noveltyScore,confidenceScore:e.confidenceScore,createdFrom:"dream_insight"}}}}default:return null}}generateId(){let e=Date.now(),t=fe().slice(0,8);return`insight-${e}-${t}`}calculateContentSimilarity(e,t){let n=e.toLowerCase().split(/\s+/),i=t.toLowerCase().split(/\s+/),s=new Set(n),r=new Set(i),o=n.filter(c=>r.has(c)),a=s.size+r.size-o.length;return a===0?0:o.length/a}truncate(e,t){return e.length<=t?e:e.substring(0,t-3)+"..."}generatePatternMergeDescription(e,t,n){return`Pattern merge opportunity (${Math.round(n*100)}% match): "${this.truncate(e.content,40)}" and "${this.truncate(t.content,40)}" share similar structure and could be combined.`}generateNovelAssociationDescription(e,t,n,i){let s=Math.round(n*100);return`Novel association discovered${i?" (cross-domain)":""}: [${e.conceptType}] "${this.truncate(e.content,30)}" is connected to [${t.conceptType}] "${this.truncate(t.content,30)}" with ${s}% co-activation strength.`}generateOptimizationDescription(e,t,n){let i=[`Optimization opportunity for "${this.truncate(e.content,40)}":`];return t!==void 0&&i.push(`Success rate is ${Math.round(t*100)}%.`),n!==void 0&&i.push(`Used ${n} times.`),i.push("Consider reviewing and improving this pattern."),i.join(" ")}getConfig(){return{...this.config}}};Y();F();Q();he();import{existsSync as ve,unlinkSync as ye}from"fs";var M={maxPatternCountDrop:.05,maxAvgConfidenceDrop:.02,maxHighConfidenceLoss:.05},$=class{constructor(e,t=M){this.db=e;this.thresholds=t}db;thresholds;activeBranches=new Map;listeners=[];rvfAdapter;useRvfFork=!1;_witnessChain=null;set witnessChain(e){this._witnessChain=e}setRvfAdapter(e,t=!0){this.rvfAdapter=e,this.useRvfFork=t,import("./feature-flags-N7EOGE5P.js").then(({isRVFPatternStoreEnabled:n})=>{this.useRvfFork=n()}).catch(()=>{})}createBranch(e){if(this.activeBranches.has(e))throw new Error(`Branch '${e}' already exists`);let t=this.sanitizeSavepointName(e),n=this.captureBaseline();this.db.exec(`SAVEPOINT "${t}"`);let i={name:e,createdAt:new Date,status:"active",baselineSnapshot:n};if(this.rvfAdapter&&this.useRvfFork)try{let s=`/tmp/dream-branch-${t}.rvf`,r=this.rvfAdapter.derive(s),o=i;o._rvfBranchPath=s,o._rvfChildAdapter=r}catch{}return this.activeBranches.set(e,i),this.emit("dream:branch_created",i),i}validateBranch(e,t){this.ensureBranchActive(e.name);let n=t??e.baselineSnapshot,i=this.captureBaseline(),s=i.patternCount-n.patternCount,r=i.avgConfidence-n.avgConfidence,o=n.highConfidenceCount-i.highConfidenceCount,a=[],c=!0;if(n.patternCount>0){let l=-s/n.patternCount;l>this.thresholds.maxPatternCountDrop&&(c=!1,a.push(`Pattern count dropped by ${(l*100).toFixed(1)}% (threshold: ${(this.thresholds.maxPatternCountDrop*100).toFixed(1)}%)`))}if(r<-this.thresholds.maxAvgConfidenceDrop&&(c=!1,a.push(`Avg confidence dropped by ${(-r).toFixed(4)} (threshold: ${this.thresholds.maxAvgConfidenceDrop})`)),n.highConfidenceCount>0&&o>0){let l=o/n.highConfidenceCount;l>this.thresholds.maxHighConfidenceLoss&&(c=!1,a.push(`${o} high-confidence patterns lost (${(l*100).toFixed(1)}%, threshold: ${(this.thresholds.maxHighConfidenceLoss*100).toFixed(1)}%)`))}if(this.rvfAdapter&&this.useRvfFork&&n.patternCount>0)try{let l=this.rvfAdapter.dimension?.()??384,h=new Float32Array(l);for(let g=0;g<l;g++)h[g]=Math.sin(g*.1);let u=this.rvfAdapter.search?.(h,10)??[];u.length<Math.min(5,n.patternCount)&&a.push(`Search recall degraded: only ${u.length} results returned (expected \u2265${Math.min(5,n.patternCount)})`)}catch{}let p=c?"All quality checks passed":`Validation failed: ${a.join("; ")}`;return{passed:c,reason:p,patternCountDelta:s,avgConfidenceDelta:r,highConfidenceLost:Math.max(0,o),postDreamMetrics:i}}mergeBranch(e){this.ensureBranchActive(e.name);let t=this.sanitizeSavepointName(e.name);this.db.exec(`RELEASE SAVEPOINT "${t}"`),e.status="merged",this.activeBranches.delete(e.name),this.cleanupRvfBranch(e),this.emit("dream:branch_merged",e);try{this._witnessChain?.append("BRANCH_MERGE",{branchName:e.name},"rvcow-branch-manager")}catch{}}discardBranch(e){this.ensureBranchActive(e.name);let t=this.sanitizeSavepointName(e.name);this.db.exec(`ROLLBACK TO SAVEPOINT "${t}"`),this.db.exec(`RELEASE SAVEPOINT "${t}"`),e.status="discarded",this.activeBranches.delete(e.name),this.cleanupRvfBranch(e),this.emit("dream:branch_discarded",e)}listBranches(){return Array.from(this.activeBranches.values())}onEvent(e){this.listeners.push(e)}offEvent(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}captureBaseline(){let e=this.db.prepare("SELECT COUNT(*) as cnt FROM qe_patterns").get(),t=this.db.prepare("SELECT AVG(confidence) as avg_conf FROM qe_patterns").get(),n=this.db.prepare("SELECT COUNT(*) as cnt FROM qe_patterns WHERE confidence >= 0.8").get();return{patternCount:e?.cnt??0,avgConfidence:t?.avg_conf??0,highConfidenceCount:n?.cnt??0,capturedAt:new Date}}ensureBranchActive(e){let t=this.activeBranches.get(e);if(!t)throw new Error(`Branch '${e}' not found or not active`);if(t.status!=="active")throw new Error(`Branch '${e}' is ${t.status}, not active`)}cleanupRvfBranch(e){let t=e;try{t._rvfChildAdapter?.close?.()}catch{}try{let n=t._rvfBranchPath;n&&ve(n)&&ye(n)}catch{}}sanitizeSavepointName(e){return e.replace(/[^a-zA-Z0-9_-]/g,"_")}emit(e,t,n){for(let i of this.listeners)try{i(e,t,n)}catch{}}};function U(d,e){let t=d.prepare(`
|
|
67
|
-
UPDATE concept_nodes
|
|
68
|
-
SET activation_level = ?, last_activated = datetime('now')
|
|
69
|
-
WHERE id = ? AND (? IS NULL OR COALESCE(activation_level, 0) = ?)
|
|
70
|
-
`),n=d.prepare(`
|
|
71
|
-
INSERT INTO dream_insights
|
|
72
|
-
(id, cycle_id, insight_type, source_concepts, description, novelty_score,
|
|
73
|
-
confidence_score, actionable, applied, suggested_action, pattern_id)
|
|
74
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, 0, ?, NULL)
|
|
75
|
-
`),i=d.prepare(`
|
|
76
|
-
INSERT INTO dream_cycles
|
|
77
|
-
(id, start_time, end_time, duration_ms, concepts_processed, associations_found,
|
|
78
|
-
insights_generated, status, error)
|
|
79
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
80
|
-
ON CONFLICT(id) DO UPDATE SET
|
|
81
|
-
end_time = excluded.end_time, duration_ms = excluded.duration_ms,
|
|
82
|
-
concepts_processed = excluded.concepts_processed,
|
|
83
|
-
associations_found = excluded.associations_found,
|
|
84
|
-
insights_generated = excluded.insights_generated,
|
|
85
|
-
status = excluded.status, error = excluded.error
|
|
86
|
-
`),s=d.transaction(()=>{let{cycle:a}=e;i.run(a.id,a.startTime.toISOString(),a.endTime?.toISOString()??null,a.durationMs??null,a.conceptsProcessed,a.associationsFound,a.insightsGenerated,a.status,a.error??null);let c=0;for(let[p,l,h]of e.activations){let u=h??null;c+=t.run(Math.max(0,Math.min(1,l)),p,u,u).changes}for(let p of e.insights)n.run(p.id,p.cycleId,p.type,JSON.stringify(p.sourceConcepts),p.description,p.noveltyScore,p.confidenceScore,p.actionable?1:0,p.suggestedAction??null);return{activationsWritten:c,activationsSkipped:e.activations.length-c,insightsWritten:e.insights.length}}),r=performance.now();return{...s.immediate(),commitDurationMs:performance.now()-r}}var x=600*1e3,Ce="abandoned: process exited";function q(d,e=x,t=Date.now()){let n=new Date(t-e).toISOString();return d.prepare(`
|
|
87
|
-
UPDATE dream_cycles
|
|
88
|
-
SET status = 'interrupted',
|
|
89
|
-
error = ?,
|
|
90
|
-
end_time = COALESCE(end_time, ?)
|
|
91
|
-
WHERE status = 'running' AND start_time < ?
|
|
92
|
-
`).run(Ce,new Date(t).toISOString(),n).changes}var b=_.create("dream-engine"),ae={maxDurationMs:3e4,minConceptsRequired:10,activationConfig:{decayRate:.1,spreadFactor:.5,threshold:.1,maxIterations:20,noiseLevel:.05},insightConfig:{minNoveltyScore:.3,minConfidence:.5,maxInsightsPerCycle:10},enableBranching:!1,branchValidationThresholds:{...M}},De=6e4,L=class extends Error{constructor(t){super(`A dream cycle is already running (cycle ${t}); wait for it to finish or cancel it`);this.cycleId=t;this.name="DreamAlreadyRunningError"}cycleId},W=class{constructor(e){this.graph=e}graph;nodeCache=new Map;edgeCache=new Map;activationLevels=new Map;loadedLevels=new Map;async loadIntoMemory(e){this.nodeCache.clear(),this.edgeCache.clear(),this.activationLevels.clear(),this.loadedLevels.clear();let t=await this.graph.getActiveNodes(0);e&&t.length>e&&(t=t.sort((n,i)=>i.activationLevel-n.activationLevel).slice(0,e));for(let n of t)this.nodeCache.set(n.id,n),this.activationLevels.set(n.id,n.activationLevel),this.loadedLevels.set(n.id,n.activationLevel);for(let n of t){let s=(await this.graph.getNeighbors(n.id)).map(r=>r.edge);this.edgeCache.set(n.id,s)}}activationEntries(){return Array.from(this.activationLevels.entries(),([e,t])=>[e,t,this.loadedLevels.get(e)])}getConcept(e){let t=this.nodeCache.get(e);if(t)return{...t,activationLevel:this.activationLevels.get(e)??t.activationLevel}}getAllConcepts(e){let t=e??0;return Array.from(this.nodeCache.values()).map(n=>({...n,activationLevel:this.activationLevels.get(n.id)??n.activationLevel})).filter(n=>n.activationLevel>=t)}getActiveNodes(e){return this.getAllConcepts(e)}getEdges(e){return this.edgeCache.get(e)??[]}getEdge(e,t){return(this.edgeCache.get(e)??[]).find(i=>i.target===t)}setActivation(e,t){this.activationLevels.set(e,Math.max(0,Math.min(1,t)))}decayActivations(e){let t=Array.from(this.activationLevels.entries());for(let[n,i]of t)this.activationLevels.set(n,i*e)}getStats(){let e=Array.from(this.nodeCache.values()),t={pattern:0,technique:0,domain:0,outcome:0,error:0},n=0;for(let r of e)t[r.conceptType]=(t[r.conceptType]??0)+1,n+=this.activationLevels.get(r.id)??r.activationLevel;let i=0,s=Array.from(this.edgeCache.values());for(let r of s)i+=r.length;return{nodeCount:e.length,edgeCount:i,byType:t,avgEdgesPerNode:e.length>0?i/e.length:0,avgActivation:e.length>0?n/e.length:0}}},w=class{config;persistence=null;graph=null;db=null;interruptActiveDream=null;activeDream=null;activeAbort=null;currentCycle=null;initialized=!1;cancelled=!1;cancelRequests=0;closing=!1;branchEventListeners=[];_witnessChain=null;set witnessChain(e){this._witnessChain=e}set rvfAdapter(e){}constructor(e){this.config={...ae,...e}}async initialize(){if(!this.initialized)try{this.persistence=R(),this.persistence.isInitialized()||await this.persistence.initialize(),this.db=this.persistence.getDatabase();try{this.db.pragma("busy_timeout = 60000")}catch{}this.migrateSchema(),this.graph=new T,await this.graph.initialize(),this.config.enableBranching&&b.warn("DreamConfig.enableBranching is deprecated and ignored (#1060): dream results are committed in one short transaction instead of a SAVEPOINT held across the dream");let e=q(this.db,Math.max(this.config.maxDurationMs,De)+x);e>0&&b.info("Marked abandoned dream cycles as interrupted",{abandoned:e}),this.initialized=!0,this.closing=!1,console.log(`[DreamEngine] Initialized: ${this.persistence.getDbPath()}`)}catch(e){throw new Error(`Failed to initialize DreamEngine: ${C(e)}`)}}migrateSchema(){if(this.db)try{let e=this.db.prepare("PRAGMA table_info(dream_cycles)").all(),t=e.some(a=>a.name==="duration_ms"),n=e.some(a=>a.name==="duration");!t&&n&&this.db.exec("ALTER TABLE dream_cycles RENAME COLUMN duration TO duration_ms");let i=this.db.prepare("PRAGMA table_info(dream_insights)").all(),s=new Set(i.map(a=>a.name)),r=s.has("insight_type"),o=s.has("source_concepts");if(!r)try{this.db.exec("ALTER TABLE dream_insights ADD COLUMN insight_type TEXT NOT NULL DEFAULT 'general'"),b.info("Added insight_type column to dream_insights (safe migration)")}catch{}if(!o)try{this.db.exec("ALTER TABLE dream_insights ADD COLUMN source_concepts TEXT NOT NULL DEFAULT '[]'"),b.info("Added source_concepts column to dream_insights (safe migration)")}catch{}this.db.exec("CREATE INDEX IF NOT EXISTS idx_insight_cycle ON dream_insights(cycle_id)"),this.db.exec("CREATE INDEX IF NOT EXISTS idx_insight_type ON dream_insights(insight_type)"),this.db.exec("CREATE INDEX IF NOT EXISTS idx_insight_novelty ON dream_insights(novelty_score DESC)")}catch(e){b.debug("Dream schema migration skipped",{error:e instanceof Error?e.message:String(e)})}}async dream(e,t={}){if(this.ensureInitialized(),this.closing)throw new Error("Dream engine is closing; no new dream is started");if(this.activeDream)throw new L(this.activeDream.cycleId);let n={id:D(),startTime:new Date,conceptsProcessed:0,associationsFound:0,insightsGenerated:0,status:"running"},i=this.runDream(n,e??this.config.maxDurationMs,t);this.activeDream={cycleId:n.id,done:i.catch(()=>{})};try{return await i}finally{this.activeDream?.cycleId===n.id&&(this.activeDream=null)}}async runDream(e,t,n){let i=this.db,s=this.graph,r=Date.now(),o=new AbortController;this.activeAbort=o,this.cancelled=!1,this.currentCycle=e;let a=n.commit!==!1,c=this.createCycleInterrupter(e,r,o);this.interruptActiveDream=c;let p=Z(c),l=()=>!this.cancelled&&!o.signal.aborted&&this.db===i,h=!1;try{if(a&&await this.saveCycle(e),!l())throw new Error("Dream cycle cancelled");let u=n.minConceptsRequired??this.config.minConceptsRequired,g=await s.getActiveNodes(0);if(g.length<u)throw new Error(`Insufficient concepts: ${g.length} < ${u}`);let f=new W(s);await f.loadIntoMemory(30);let y=await new S(f,{...this.config.activationConfig,...n.activationConfig}).dream(t,o.signal);if(!l())throw new Error("Dream cycle cancelled");e.conceptsProcessed=y.nodesActivated,e.associationsFound=y.novelAssociations.length;let O=await new I(f,this.config.insightConfig).generateFromActivation(e.id,y);if(!l())throw new Error("Dream cycle cancelled");e.insightsGenerated=O.length,e.endTime=new Date,e.durationMs=Date.now()-r,e.status="completed";let j={cycle:e,activations:f.activationEntries(),insights:O},B={cycle:{...e},insights:O,activationStats:{totalIterations:y.iterations,peakActivation:y.peakActivation,nodesActivated:y.nodesActivated},patternsCreated:0};return a?(B.commitDurationMs=this.commitComputed(i,j),h=!0,B):(h=!0,{...B,pending:j})}catch(u){if(!h&&e.status!=="interrupted"&&(e.status=this.cancelled?"interrupted":"failed",e.error=C(u),e.endTime=new Date,e.durationMs=Date.now()-r,a&&this.db===i))try{this.updateCycleSync(e)}catch{}if(!h&&a)try{this._witnessChain?.append("DREAM_DISCARD",{cycleId:e.id,reason:C(u)},"dream-engine")}catch{}throw u}finally{p(),this.interruptActiveDream===c&&(this.interruptActiveDream=null),this.currentCycle===e&&(this.currentCycle=null),this.activeAbort===o&&(this.activeAbort=null)}}commitDreamResult(e){if(this.ensureInitialized(),this.closing)throw new Error("Dream engine is closing; nothing is committed");if(!e.pending)throw new Error("Dream result has nothing pending to commit (it was already committed)");let t=this.commitComputed(this.db,e.pending);return e.pending=void 0,e.commitDurationMs=t,t}commitComputed(e,t){let n=U(e,t);try{this._witnessChain?.append("DREAM_COMMIT",{cycleId:t.cycle.id,insights:n.insightsWritten,activations:n.activationsWritten,commitDurationMs:n.commitDurationMs},"dream-engine")}catch{}return n.commitDurationMs}createCycleInterrupter(e,t,n){return()=>{if(n.abort(),!(e.status!=="running"||!this.db)){e.status="interrupted",e.error="Interrupted: engine closed or process shut down during the dream cycle",e.endTime=new Date,e.durationMs=Date.now()-t;try{this.updateCycleSync(e)}catch{}}}}async loadPatternsAsConcepts(e){return this.ensureInitialized(),this.graph.loadFromPatterns(e)}async loadFailuresAsConcepts(e){return this.ensureInitialized(),this.graph.loadFailuresAsErrors(e)}async loadSuccessesAsConcepts(e){return this.ensureInitialized(),this.graph.loadSuccessesAsOutcomes(e)}async ensureConceptsLoaded(){this.ensureInitialized();try{let n=this.db.prepare(`SELECT n.id as id, n.pattern_id as sourcePatternId, p.qe_domain as domain, n.failure_mode as failureMode
|
|
93
|
-
FROM qe_pattern_nulls n
|
|
94
|
-
JOIN qe_patterns p ON p.id = n.pattern_id
|
|
95
|
-
ORDER BY n.updated_at DESC
|
|
96
|
-
LIMIT 100`).all();n.length>0&&await this.graph.loadFailuresAsErrors(n);let i=this.db.prepare(`SELECT u.id as id, u.pattern_id as sourcePatternId, p.qe_domain as domain,
|
|
97
|
-
('Pattern "' || p.name || '" applied successfully') as description
|
|
98
|
-
FROM qe_pattern_usage u
|
|
99
|
-
JOIN qe_patterns p ON p.id = u.pattern_id
|
|
100
|
-
WHERE u.success = 1
|
|
101
|
-
ORDER BY u.created_at DESC
|
|
102
|
-
LIMIT 100`).all();i.length>0&&await this.graph.loadSuccessesAsOutcomes(i)}catch(n){process.env.DEBUG&&b.debug("Error/outcome concept loading skipped",{error:C(n)})}if((await this.graph.getActiveNodes(0)).length>=this.config.minConceptsRequired)return 0;let t=this.db.prepare(`SELECT * FROM (
|
|
103
|
-
SELECT id, name, description, qe_domain as domain, pattern_type as patternType,
|
|
104
|
-
confidence, success_rate as successRate
|
|
105
|
-
FROM qe_patterns
|
|
106
|
-
WHERE confidence >= 0.3
|
|
107
|
-
ORDER BY quality_score DESC
|
|
108
|
-
LIMIT 160
|
|
109
|
-
)
|
|
110
|
-
UNION
|
|
111
|
-
SELECT * FROM (
|
|
112
|
-
SELECT id, name, description, qe_domain as domain, pattern_type as patternType,
|
|
113
|
-
confidence, success_rate as successRate
|
|
114
|
-
FROM qe_patterns
|
|
115
|
-
WHERE confidence >= 0.3 AND success_rate < 0.7
|
|
116
|
-
ORDER BY usage_count DESC
|
|
117
|
-
LIMIT 40
|
|
118
|
-
)`).all();return t.length===0?0:this.graph.loadFromPatterns(t)}async applyInsight(e){this.ensureInitialized();try{let t=await this.getInsightRowById(e);if(!t)return{success:!1,error:`Insight not found: ${e}`};if(t.actionable!==1)return{success:!1,error:"Insight is not actionable"};if(t.applied===1)return{success:!0,patternId:t.pattern_id??void 0,error:"Insight already applied"};let{getSharedMemoryBackend:n}=await import("./base-WCACU3FN.js"),{createQEReasoningBank:i}=await import("./qe-reasoning-bank-DQSSX2IP.js"),s=await n(),r=i(s);await r.initialize();try{let{getSharedRvfDualWriter:h}=await import("./shared-rvf-dual-writer-YXMPZKQE.js"),u=await h();u&&r.setRvfDualWriter(u)}catch(h){process.env.DEBUG&&b.debug("RVF wiring skipped",{error:C(h)})}let o=[];try{o=A(t.source_concepts)}catch{}let a=await r.storePattern({patternType:Ee(t.insight_type),name:`Dream Insight: ${t.insight_type}`,description:`${t.description} (confidence: ${t.confidence_score.toFixed(2)})`,template:{type:"workflow",content:t.suggested_action||t.description,variables:[]},context:{tags:["dream-generated",t.insight_type,...o.slice(0,3)],complexity:"medium"}}),c=!a.success&&a.error instanceof ee&&a.error.disposition==="COMMITTED_PENDING_INDEX"?a.error:null;if(!a.success&&!c)return{success:!1,error:`Failed to create pattern: ${a.error?.message??"unknown error"}`};let p=a.success?a.value.id:c.patternId;return c&&b.warn("Insight applied; pattern committed with vector index pending",{insightId:e,patternId:p,cause:C(c.cause)}),this.db.prepare(`
|
|
119
|
-
UPDATE dream_insights
|
|
120
|
-
SET applied = 1, pattern_id = ?
|
|
121
|
-
WHERE id = ?
|
|
122
|
-
`).run(p,e),c?{success:!0,patternId:p,indexPending:!0}:{success:!0,patternId:p}}catch(t){return{success:!1,error:C(t)}}}async getPendingInsights(e){this.ensureInitialized();let t=e??20;return this.db.prepare(`
|
|
123
|
-
SELECT * FROM dream_insights
|
|
124
|
-
WHERE applied = 0 AND actionable = 1
|
|
125
|
-
ORDER BY novelty_score DESC, confidence_score DESC
|
|
126
|
-
LIMIT ?
|
|
127
|
-
`).all(t).map(s=>this.rowToInsight(s))}async getDreamHistory(e){this.ensureInitialized();let t=e??20;return this.db.prepare(`
|
|
128
|
-
SELECT * FROM dream_cycles
|
|
129
|
-
ORDER BY start_time DESC
|
|
130
|
-
LIMIT ?
|
|
131
|
-
`).all(t).map(s=>this.rowToCycle(s))}get cancelCount(){return this.cancelRequests}async cancelDream(){this.cancelled=!0,this.cancelRequests++,this.activeAbort?.abort()}isDreaming(){return this.currentCycle!==null&&this.currentCycle.status==="running"}getCurrentCycle(){return this.currentCycle?{...this.currentCycle}:null}async saveCycle(e){if(!this.db)return;this.db.prepare(`
|
|
132
|
-
INSERT INTO dream_cycles
|
|
133
|
-
(id, start_time, end_time, duration_ms, concepts_processed, associations_found,
|
|
134
|
-
insights_generated, status, error, created_at)
|
|
135
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
136
|
-
`).run(e.id,e.startTime.toISOString(),e.endTime?.toISOString()??null,e.durationMs??null,e.conceptsProcessed,e.associationsFound,e.insightsGenerated,e.status,e.error??null,e.startTime.toISOString())}updateCycleSync(e){if(!this.db)return;this.db.prepare(`
|
|
137
|
-
UPDATE dream_cycles
|
|
138
|
-
SET end_time = ?, duration_ms = ?, concepts_processed = ?, associations_found = ?,
|
|
139
|
-
insights_generated = ?, status = ?, error = ?
|
|
140
|
-
WHERE id = ?
|
|
141
|
-
`).run(e.endTime?.toISOString()??null,e.durationMs??null,e.conceptsProcessed,e.associationsFound,e.insightsGenerated,e.status,e.error??null,e.id)}async getInsightRowById(e){return this.db?this.db.prepare("SELECT * FROM dream_insights WHERE id = ?").get(e)??null:null}getBranchManager(){return null}onBranchEvent(e){this.branchEventListeners.push(e)}async close(){this.closing=!0,this.cancelRequests++,this.interruptActiveDream?.(),this.interruptActiveDream=null,this.activeAbort?.abort();let e=this.activeDream?.done;if(e){let t;await Promise.race([e,new Promise(n=>{t=setTimeout(n,2e3)})]),clearTimeout(t)}this.graph&&(await this.graph.close(),this.graph=null),this.db=null,this.persistence=null,this.initialized=!1,this.currentCycle=null}ensureInitialized(){if(!this.initialized||!this.graph||!this.db)throw new Error("DreamEngine not initialized. Call initialize() first.")}rowToCycle(e){return{id:e.id,startTime:new Date(e.start_time),endTime:e.end_time?new Date(e.end_time):void 0,durationMs:e.duration_ms??void 0,conceptsProcessed:e.concepts_processed,associationsFound:e.associations_found,insightsGenerated:e.insights_generated,status:e.status,error:e.error??void 0}}rowToInsight(e){return{id:e.id,cycleId:e.cycle_id,type:e.insight_type,sourceConcepts:A(e.source_concepts),description:e.description,noveltyScore:e.novelty_score,confidenceScore:e.confidence_score,actionable:e.actionable===1,applied:e.applied===1,patternId:e.pattern_id??void 0,suggestedAction:e.suggested_action??void 0,createdAt:new Date(e.created_at)}}};function Ee(d){return{"cross-domain":"coverage-strategy","novel-path":"test-template",cluster:"refactor-safe","high-activation":"assertion-pattern",bridge:"mock-pattern"}[d]||"test-template"}function be(d){let e=new w(d);return import("./feature-flags-N7EOGE5P.js").then(({isRVFPatternStoreEnabled:t})=>t()?import("./shared-rvf-adapter-COUOS665.js"):null).then(t=>{if(!t)return;let n=t.getSharedRvfAdapter();n&&(e.rvfAdapter=n)}).catch(()=>{}),e}var Ae=w;Q();var oe="learning:loop-health";async function ce(d,e,t){try{let n=new Date().toISOString(),i=await d.get(oe)??{overallLastSuccess:"",bootedAt:n,components:{}},s=i.components[e]??{lastSuccessAt:"",ticksSinceBoot:0,successesSinceBoot:0};if(s.ticksSinceBoot+=1,t.success)s.lastSuccessAt=n,s.successesSinceBoot+=1,delete s.lastError;else if(t.error){let o=t.error instanceof Error?t.error.message:String(t.error);s.lastError={message:o,at:n}}i.components[e]=s;let r=Object.values(i.components).map(o=>o?.lastSuccessAt??"").filter(o=>o!=="");i.overallLastSuccess=r.length>0?r.sort().pop():"",await d.set(oe,i)}catch{}}var m=_.create("DreamScheduler"),pe={autoScheduleIntervalMs:36e5,minTimeBetweenDreamsMs:3e5,experienceThreshold:20,enableExperienceTrigger:!0,enableQualityGateFailureTrigger:!0,enableDomainMilestoneTrigger:!1,defaultDreamDurationMs:1e4,quickDreamDurationMs:5e3,fullDreamDurationMs:3e4,autoApplyHighConfidenceInsights:!1,insightConfidenceThreshold:.8},de="dream-scheduler:hook-state",P=class d{config;dreamEngine;eventBus;memoryBackend;initialized=!1;running=!1;dreaming=!1;experienceBuffer=[];lastDreamTime=null;scheduledDreamTimer=null;totalDreamsCompleted=0;subscriptions=[];lastDreamResult=null;metaLearningEngine;metaLearningSnapshots=[];metricsTracker=null;static MAX_META_SNAPSHOTS=20;detectedInsights=[];static MAX_DETECTED_INSIGHTS=100;constructor(e,t){if(!e.dreamEngine)throw new Error("DreamScheduler requires dreamEngine dependency");if(!e.eventBus)throw new Error("DreamScheduler requires eventBus dependency");this.dreamEngine=e.dreamEngine,this.eventBus=e.eventBus,this.memoryBackend=e.memoryBackend,this.config={...pe,...t},this.metaLearningEngine=new ne}async initialize(){if(!this.initialized){if(this.config.enableQualityGateFailureTrigger){let e=this.eventBus.subscribe("quality-assessment:gate:completed",this.handleQualityGateEvent.bind(this));this.subscriptions.push(e)}if(this.config.enableDomainMilestoneTrigger){let e=this.eventBus.subscribe("coordination:milestone:reached",this.handleDomainMilestoneEvent.bind(this));this.subscriptions.push(e)}await this.restoreState(),this.initialized=!0,m.info("Initialized")}}start(){this.ensureInitialized(),!this.running&&(this.running=!0,this.scheduleNextDream(),m.info("Started"))}stop(){this.running&&(this.running=!1,this.clearScheduledDream(),m.info("Stopped"))}async dispose(){this.stop();for(let e of this.subscriptions)e.unsubscribe();this.subscriptions=[],this.metricsTracker&&(this.metricsTracker.close(),this.metricsTracker=null),await this.saveState(),this.initialized=!1,m.info("Disposed")}async triggerDream(e){if(this.ensureInitialized(),!this.canDream()){let t=this.getTimeUntilCanDream();throw new Error(`Cannot start dream: minimum interval not met. Wait ${Math.ceil(t/1e3)}s.`)}return this.executeDream(e??this.config.defaultDreamDurationMs)}async triggerQuickDream(){return this.triggerDream(this.config.quickDreamDurationMs)}async triggerFullDream(){return this.triggerDream(this.config.fullDreamDurationMs)}recordExperience(e){this.experienceBuffer.push(e),this.config.enableExperienceTrigger&&this.experienceBuffer.length>=this.config.experienceThreshold&&this.canDream()&&!this.dreaming&&(m.info("Experience threshold reached, triggering dream",{threshold:this.config.experienceThreshold}),this.executeDream(this.config.defaultDreamDurationMs).catch(t=>{m.error("Experience-triggered dream failed",t instanceof Error?t:void 0)}))}getExperienceBuffer(){return[...this.experienceBuffer]}clearExperienceBuffer(){this.experienceBuffer=[]}getStatus(){let e=this.scheduledDreamTimer?this.getTimeUntilScheduledDream():null;return{initialized:this.initialized,running:this.running,dreaming:this.dreaming,experienceCount:this.experienceBuffer.length,experienceThreshold:this.config.experienceThreshold,timeUntilNextDream:e,totalDreamsCompleted:this.totalDreamsCompleted,lastDreamTime:this.lastDreamTime,autoSchedulingEnabled:this.running}}getLastDreamResult(){return this.lastDreamResult}getMetaInsights(e){let t=[...this.detectedInsights].reverse();return e!==void 0?t.slice(0,e):t}async executeDream(e){if(this.dreaming)throw new Error("A dream is already in progress");this.dreaming=!0,m.info("Starting dream cycle",{durationMs:e});let t;try{let n=await this.dreamEngine.ensureConceptsLoaded();n>0&&m.info("Auto-loaded concepts for dream",{loaded:n});let i=await this.dreamEngine.dream(e);if(this.lastDreamTime=new Date,this.lastDreamResult=i,this.totalDreamsCompleted++,this.clearExperienceBuffer(),await this.reconcileHookState(),this.config.autoApplyHighConfidenceInsights&&await this.autoApplyInsights(i),await this.publishDreamCompletedEvent(i),await this.maybeCompactPatternsRvf(),process.env.AQE_META_LEARNING_ENABLED==="true")try{await this.runPostDreamMetaLearning()}catch(s){m.warn("Post-dream meta-learning failed (non-critical)",{error:s instanceof Error?s.message:String(s)})}return this.running&&this.scheduleNextDream(),m.info("Dream completed",{insightsGenerated:i.insights.length}),i}catch(n){throw t=n instanceof Error?n:new Error(String(n)),n}finally{this.dreaming=!1,this.memoryBackend&&await ce(this.memoryBackend,"dreamScheduler",{success:!t,error:t})}}async autoApplyInsights(e){let t=e.insights.filter(n=>n.actionable&&n.confidenceScore>=this.config.insightConfidenceThreshold);for(let n of t)try{let i=await this.dreamEngine.applyInsight(n.id);i.success&&m.info("Auto-applied insight",{insightId:n.id,patternId:i.patternId})}catch(i){m.error("Failed to auto-apply insight",i instanceof Error?i:void 0,{insightId:n.id})}}async maybeCompactPatternsRvf(){try{let t=(await import("./shared-rvf-adapter-COUOS665.js")).compactSharedRvfAdapter();t&&t.bytesReclaimed>0&&m.info("patterns.rvf compacted",{bytesReclaimed:t.bytesReclaimed,segmentsCompacted:t.segmentsCompacted})}catch(e){m.warn("patterns.rvf compaction skipped (non-critical)",{error:e instanceof Error?e.message:String(e)})}try{let t=(await import("./shared-rvf-dual-writer-YXMPZKQE.js")).getSharedRvfDualWriterSync();if(t){let n=t.compact();n&&n.bytesReclaimed>0&&m.info("brain.rvf compacted",{bytesReclaimed:n.bytesReclaimed,segmentsCompacted:n.segmentsCompacted})}}catch(e){m.warn("brain.rvf compaction skipped (non-critical)",{error:e instanceof Error?e.message:String(e)})}}async runPostDreamMetaLearning(){this.metricsTracker||(this.metricsTracker=new ie,await this.metricsTracker.initialize());let e=await this.metricsTracker.collectUnifiedSnapshot();for(this.metaLearningSnapshots.push(e);this.metaLearningSnapshots.length>d.MAX_META_SNAPSHOTS;)this.metaLearningSnapshots.shift();let t=te.minSnapshotsForAnalysis;if(this.metaLearningSnapshots.length>=t){let n=this.metaLearningEngine.runMetaLearningCycle(this.metaLearningSnapshots);if(n.length>0){m.info("Meta-learning insights detected",{count:n.length,types:n.map(i=>i.type)});for(let i of n)m.info(`Meta-insight [${i.type}]: ${i.description}`,{confidence:i.confidence.toFixed(2),suggestedAction:i.suggestedAction}),this.detectedInsights.push(i);for(;this.detectedInsights.length>d.MAX_DETECTED_INSIGHTS;)this.detectedInsights.shift();try{this.eventBus.publish({id:D(),type:"meta-learning.insight-detected",timestamp:new Date,source:"learning-optimization",payload:{count:n.length,insights:n.map(i=>({id:i.id,type:i.type,description:i.description,confidence:i.confidence,suggestedAction:i.suggestedAction,detectedAt:i.detectedAt}))}})}catch{m.debug("Failed to publish meta-learning insight event")}}}else m.debug("Meta-learning: accumulating snapshots",{current:this.metaLearningSnapshots.length,required:t})}scheduleNextDream(){if(this.clearScheduledDream(),!this.running)return;let e=this.calculateNextDreamDelay();this.scheduledDreamTimer=setTimeout(async()=>{if(!(!this.running||this.dreaming))try{await this.executeDream(this.config.defaultDreamDurationMs)}catch(t){m.error("Scheduled dream failed",t instanceof Error?t:void 0),this.running&&this.scheduleNextDream()}},e),m.info("Next dream scheduled",{delaySeconds:Math.ceil(e/1e3)})}clearScheduledDream(){this.scheduledDreamTimer&&(clearTimeout(this.scheduledDreamTimer),this.scheduledDreamTimer=null)}calculateNextDreamDelay(){if(!this.lastDreamTime)return this.config.autoScheduleIntervalMs;let e=Date.now()-this.lastDreamTime.getTime(),t=this.config.autoScheduleIntervalMs-e;return Math.max(t,this.config.minTimeBetweenDreamsMs)}getTimeUntilScheduledDream(){return this.calculateNextDreamDelay()}canDream(){return this.lastDreamTime?Date.now()-this.lastDreamTime.getTime()>=this.config.minTimeBetweenDreamsMs:!0}getTimeUntilCanDream(){if(!this.lastDreamTime)return 0;let e=Date.now()-this.lastDreamTime.getTime();return Math.max(0,this.config.minTimeBetweenDreamsMs-e)}async handleQualityGateEvent(e){if(!e.payload.passed){if(!this.canDream()||this.dreaming){m.info("Quality gate failed but cannot start dream yet");return}m.info("Quality gate failed, triggering analysis dream");try{await this.executeDream(this.config.quickDreamDurationMs)}catch(t){m.error("Quality gate triggered dream failed",t instanceof Error?t:void 0)}}}async handleDomainMilestoneEvent(e){if(!this.canDream()||this.dreaming){m.info("Milestone reached but cannot start dream yet");return}m.info("Domain milestone reached, triggering consolidation dream");try{await this.executeDream(this.config.defaultDreamDurationMs)}catch(t){m.error("Milestone triggered dream failed",t instanceof Error?t:void 0)}}async publishDreamCompletedEvent(e){try{await this.eventBus.publish({id:D(),type:"learning-optimization:dream:completed",timestamp:new Date,source:"learning-optimization",payload:{cycleId:e.cycle.id,insightsGenerated:e.insights.length,patternsCreated:e.patternsCreated,duration:e.cycle.durationMs}})}catch(t){m.error("Failed to publish dream completed event",t instanceof Error?t:void 0)}}async reconcileHookState(){if(this.memoryBackend)try{let e=await this.memoryBackend.get(de),t={lastDreamTime:(this.lastDreamTime??new Date).toISOString(),experienceCount:0,sessionStartTime:e?.sessionStartTime,totalDreamsThisSession:(e?.totalDreamsThisSession??0)+1};await this.memoryBackend.set(de,t)}catch(e){m.warn("Dream hook-state reconcile failed (non-critical)",{error:e instanceof Error?e.message:String(e)})}}async saveState(){if(this.memoryBackend)try{await this.memoryBackend.set("dream-scheduler:state",{lastDreamTime:this.lastDreamTime?.toISOString()??null,totalDreamsCompleted:this.totalDreamsCompleted,experienceBuffer:this.experienceBuffer},{namespace:"learning-optimization",persist:!0})}catch(e){m.error("Failed to save state",e instanceof Error?e:void 0)}}async restoreState(){if(this.memoryBackend)try{let e=await this.memoryBackend.get("dream-scheduler:state");e&&(this.lastDreamTime=e.lastDreamTime?new Date(e.lastDreamTime):null,this.totalDreamsCompleted=e.totalDreamsCompleted??0,this.experienceBuffer=e.experienceBuffer??[],m.info("Restored state",{totalDreamsCompleted:this.totalDreamsCompleted,experienceCount:this.experienceBuffer.length}))}catch(e){m.error("Failed to restore state",e instanceof Error?e:void 0)}}ensureInitialized(){if(!this.initialized)throw new Error("DreamScheduler not initialized. Call initialize() first.")}};function Te(d,e){return new P(d,e)}F();var Se=[{name:"aggressive-exploration",description:"High noise, fast decay -- explores widely but forgets quickly",activationConfig:{decayRate:.2,spreadFactor:.7,noiseLevel:.15,maxIterations:30}},{name:"conservative-consolidation",description:"Low noise, slow decay -- strengthens existing associations",activationConfig:{decayRate:.05,spreadFactor:.3,noiseLevel:.02,maxIterations:15}},{name:"balanced-discovery",description:"Moderate parameters -- balanced between exploration and consolidation",activationConfig:{decayRate:.1,spreadFactor:.5,noiseLevel:.05,maxIterations:20}}],V=class{constructor(e){this.engine=e}engine;async dream(e,t={}){if(e.length<1)throw new Error("At least one strategy is required");if(e.length>5)throw new Error("Maximum 5 strategies allowed to limit resource usage");let n=Date.now(),i=[],s=this.engine.cancelCount,r=()=>this.engine.cancelCount!==s;for(let c of e){if(r())break;i.push(await this.executeStrategy(c,t.durationMs))}if(r())return{strategies:i,winner:null,totalDurationMs:Date.now()-n,cancelled:!0};let o=null;for(let c of i)c.result&&(!o||c.score>o.score)&&(o=c);let a;if(o?.result)try{a=this.engine.commitDreamResult(o.result),o.selected=!0}catch(c){o.error=C(c),o=null}return{strategies:i,winner:o,totalDurationMs:Date.now()-n,commitDurationMs:a,cancelled:!1}}async executeStrategy(e,t){let n=Date.now();try{let i=await this.engine.dream(t,{activationConfig:e.activationConfig,commit:!1});return{strategy:e,result:i,score:this.scoreResult(i),selected:!1,durationMs:Date.now()-n}}catch(i){return{strategy:e,result:null,score:Number.NEGATIVE_INFINITY,error:C(i),selected:!1,durationMs:Date.now()-n}}}scoreResult(e){return e.insights.reduce((n,i)=>n+i.confidenceScore*i.noveltyScore,0)+e.cycle.associationsFound*.01}};export{ce as a,pe as b,P as c,Te as d,k as e,T as f,me as g,z as h,G as i,H as j,re as k,S as l,se as m,I as n,M as o,$ as p,U as q,x as r,q as s,ae as t,L as u,w as v,be as w,Ae as x,Se as y,V as z};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.13");process.exit(0)}
|
|
2
|
-
import{a as B,c as V,d as q,e as w,f as Y}from"./chunk-MB46UBGY.js";import{c as X,d as x}from"./chunk-PB6J6HAA.js";import{c as D,e as Te}from"./chunk-A64JFBWI.js";import{c as z,d as Fe}from"./chunk-J2ZIFFM6.js";import*as y from"fs";import*as m from"path";import*as g from"fs";import*as H from"os";import*as f from"path";Te();function $e(e=process.env){let n=(e.AQE_COVERAGE_NO_EXEC??"").trim().toLowerCase();return n?n!=="false"&&n!=="0"&&n!=="no"&&n!=="off":!1}var Ae=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".go",".rs",".java",".rb"]),Q=new Set(["node_modules","dist","build","coverage",".git",".claude",".agentic-qe","__pycache__",".venv","target","vendor"]),ee=new Set(["tests","test","__tests__","benches","examples","spec"]),De=[/\.test\./i,/\.spec\./i,/_test\./i,/_spec\./i,/^test_/i,/^test\./i,/^conftest\./i];function j(e,n){let t=e.split(f.sep).join("/"),r=f.basename(t);if(De.some(o=>o.test(r)))return!0;let s=t;if(n){let o=f.resolve(n).split(f.sep).join("/"),i=f.resolve(e).split(f.sep).join("/");(i===o||i.startsWith(`${o}/`))&&(s=i.slice(o.length).replace(/^\//,""))}return s.split("/").some(o=>ee.has(o))}function Pe(e){let n=e.split(""),t=e.length,r=0,s=(o,i)=>{for(let a=o;a<i&&a<t;a++)e[a]!==`
|
|
3
|
-
`&&(n[a]=" ")};for(;r<t;){let o=e[r];if(o==="/"&&e[r+1]==="/"){let a=e.indexOf(`
|
|
4
|
-
`,r),c=a===-1?t:a;s(r,c),r=c;continue}if(o==="/"&&e[r+1]==="*"){let a=0,c=r;for(;r<t;){if(e[r]==="/"&&e[r+1]==="*"){a++,r+=2;continue}if(e[r]==="*"&&e[r+1]==="/"){if(a--,r+=2,a===0)break;continue}r++}s(c,r);continue}let i=/^b?r(#*)"/.exec(e.slice(r,r+300));if(i){let a=`"${i[1]}`,c=r+i[0].length,u=e.indexOf(a,c),d=u===-1?t:u+a.length;s(r,d),r=d;continue}if(o==='"'){let a=r;for(r++;r<t;){if(e[r]==="\\"){r+=2;continue}if(e[r]==='"'){r++;break}r++}s(a,r);continue}if(o==="'"){let a=-1;if(e[r+1]==="\\"){let c=e.indexOf("'",r+2);c!==-1&&c<=r+5&&(a=c+1)}else e[r+2]==="'"&&(a=r+3);if(a!==-1){s(r,a),r=a;continue}}r++}return n.join("")}function _e(e,n){if(n!==".rs")return[];let t=Pe(e).split(`
|
|
5
|
-
`),r=[];for(let s=0;s<t.length;s++){if(!/#\s*\[\s*cfg\s*\(\s*test\s*\)\s*\]/.test(t[s]))continue;let o=-1;for(let c=s;c<Math.min(t.length,s+10);c++){let u=t[c],d=u.indexOf("{"),v=u.indexOf(";");if(v!==-1&&(d===-1||v<d))break;if(d!==-1){let F=t.slice(s,c+1).join(" ");/\bmod\s+\w+/.test(F)&&(o=c);break}}if(o===-1)continue;let i=0,a=-1;for(let c=o;c<t.length;c++){for(let u of t[c])u==="{"?i++:u==="}"&&i--;if(i<=0){a=c;break}}r.push([s+1,(a===-1?t.length-1:a)+1]),s=a===-1?t.length:a}return r}function Ne(e){if(e.length===0)return 0;let n=e.split(`
|
|
6
|
-
`);return n[n.length-1]===""&&n.pop(),n.length}function te(e,n=6){let t=f.resolve(e);try{if(!g.existsSync(t))return null;g.statSync(t).isDirectory()||(t=f.dirname(t))}catch{return null}for(let r=0;r<=n;r++){if(g.existsSync(f.join(t,"Cargo.toml")))return g.realpathSync(t);let s=f.dirname(t);if(s===t)break;t=s}return null}function ne(e,n=0){if(n>4)return!1;let t;try{t=g.readdirSync(e,{withFileTypes:!0})}catch{return!1}for(let r of t)if(r.isFile()&&f.extname(r.name)===".rs")return!0;for(let r of t)if(r.isDirectory()&&!Q.has(r.name)&&ne(f.join(e,r.name),n+1))return!0;return!1}function ht(e){let n=te(e);if(n===null)return!1;let t=f.resolve(e);return t===n||ne(t)}async function mt(e,n={}){if($e())return null;let t=n.timeoutMs??3e5,r=te(e);if(!r)return null;let s=await D("cargo",["llvm-cov","--version"],{cwd:r,timeout:3e4});if(s.error||s.status!==0)return null;let o=f.join(g.mkdtempSync(f.join(H.tmpdir(),"aqe-rust-cov-")),"lcov.info");try{let i=await D("cargo",["llvm-cov","--lcov","--output-path",o],{cwd:r,timeout:t});if(i.error||i.status!==0||!g.existsSync(o))return null;let c=w(g.readFileSync(o,"utf-8")).files.filter(v=>!j(v.path,r));if(c.length===0)return null;let u=re(c),d=c.some(v=>v.branches.total>0);return{data:u,provenance:{method:"cargo-llvm-cov",estimated:!1,branchDataCollected:d,functionDataCollected:c.some(v=>v.functions.total>0),notes:d?[]:["cargo-llvm-cov reported no branch data (Rust branch coverage requires a nightly toolchain with -Z coverage-options=branch). Branch coverage is reported as null rather than assumed."]}}}catch{return null}finally{try{g.rmSync(f.dirname(o),{recursive:!0,force:!0})}catch{}}}var K={".rs":{fn:/\bfn\s+\w+/g,branch:/\b(if|match|while|for)\b|\?\?|\|\||&&/g},".go":{fn:/\bfunc\s+\w*/g,branch:/\b(if|switch|case|for|select)\b|\|\||&&/g},".py":{fn:/\b(def|lambda)\b/g,branch:/\b(if|elif|for|while|except)\b|\band\b|\bor\b/g},".java":{fn:/\b(public|private|protected|static)[\w<>,\s[\]]+\w+\s*\(/g,branch:/\b(if|switch|case|for|while|catch)\b|\|\||&&/g},".rb":{fn:/\bdef\s+\w+/g,branch:/\b(if|elsif|unless|case|when|while)\b|\|\||&&/g},default:{fn:/\bfunction\b|=>|\b\w+\s*\([^)]*\)\s*\{/g,branch:/\b(if|switch|case|for|while|catch)\b|\?\?|\|\||&&/g}};function Ie(e){return K[e]??K.default}function Z(e,n){return(e.match(new RegExp(n.source,n.flags))||[]).length}function re(e){let n=o=>e.reduce((i,a)=>i+o(a),0),t=(o,i)=>i>0?Math.round(o/i*100):0,r=n(o=>o.lines.total),s=n(o=>o.lines.covered);return{files:e,summary:{line:t(s,r),branch:t(n(o=>o.branches.covered),n(o=>o.branches.total)),function:t(n(o=>o.functions.covered),n(o=>o.functions.total)),statement:t(s,r),files:e.length}}}function P(e){let n=[],t=e;function r(s,o){if(o>6)return;let i;try{i=g.readdirSync(s,{withFileTypes:!0})}catch{return}for(let a of i){let c=f.join(s,a.name);if(a.isDirectory()){if(Q.has(a.name)||ee.has(a.name))continue;r(c,o+1)}else if(a.isFile()){if(!Ae.has(f.extname(a.name))||j(c,t))continue;n.push(c)}}}return r(e,0),n}function vt(e){if(!g.existsSync(e)||!g.statSync(e).isDirectory())return null;let n=P(e);if(n.length===0)return null;let t=n.map(r=>{let s="";try{s=x(r,{outsideRoot:"allow"})}catch{}let o=f.extname(r),i=Ne(s),a=_e(s,o),c=b=>a.some(([$,A])=>b>=$&&b<=A),u=a.reduce((b,[$,A])=>b+(A-$+1),0),d=Math.max(i-u,0),v=Ie(o),F=Z(s,v.fn),xe=a.length>0,Se=Me(r),Ce=xe||Se,we=Z(s,v.branch),je=Math.min(we*.005,.15),Re=Math.min(d*1e-4,.1),Ee=Math.max(.05,Math.min(.95,Ce?.85-je-Re:.2)),T=Math.floor(d*Ee),G=[];for(let b=1;b<=i;b++)c(b)||G.push(b);let ke=G.slice(T);return{path:r,lines:{covered:T,total:d},branches:{covered:0,total:0},functions:{covered:0,total:F},statements:{covered:T,total:d},uncoveredLines:ke,uncoveredBranches:[]}});return{data:re(t),provenance:{method:"static-estimation",estimated:!0,branchDataCollected:!1,functionDataCollected:!1,notes:["No instrumentation ran. These numbers are a STATIC ESTIMATE derived from source shape (file size, declaration counts, presence of a test file) \u2014 they are not measured coverage and must not be reported as such.","Branch and function coverage were not collected and are reported as null."]}}}function Me(e){let n=f.extname(e),t=e.slice(0,-n.length);return[`${t}.test${n}`,`${t}.spec${n}`,`${t}_test${n}`,`${t}.test${n}`.replace("/src/","/tests/"),`${t}.spec${n}`.replace("/src/","/tests/"),`${t}${n}`.replace("/src/","/tests/")].some(s=>{try{return g.existsSync(s)}catch{return!1}})}import*as N from"fs";import*as h from"path";var I=["ts","mts","cts","js","mjs","cjs"],Le=[...I.map(e=>`vitest.config.${e}`),...I.map(e=>`vite.config.${e}`)],Oe=[...I.map(e=>`jest.config.${e}`),"jest.config.json"],We=[".nycrc",".nycrc.json"],Je=[".c8rc",".c8rc.json"];function Ue(e){return e.replace(/[.+^$()|[\]\\]/g,"\\$&")}function ie(e){let n="";for(let t=0;t<e.length;t++){let r=e[t];if(r==="*"&&e[t+1]==="*")e[t+2]==="/"?(n+="(?:.*/)?",t+=2):(n+=".*",t+=1);else if(r==="*")n+="[^/]*";else if(r==="?")n+="[^/]";else if(r==="{"){let s=e.indexOf("}",t);if(s===-1){n+="\\{";continue}n+=`(?:${e.slice(t+1,s).split(",").map(ie).join("|")})`,t=s}else n+=Ue(r)}return n}function se(e){let n=e.replace(/^<rootDir>\//,"").replace(/^\.\//,"").replace(/\/+$/,"");return new RegExp(`^${ie(n)}(?:/.*)?$`)}function ae(e){let n="";for(let t=0;t<e.length;t++){let r=e[t];if(r==='"'||r==="'"||r==="`"){let s=t;for(t++;t<e.length&&e[t]!==r;t++)e[t]==="\\"&&t++;n+=e.slice(s,t+1)}else if(r==="/"&&e[t+1]==="/"){for(;t<e.length&&e[t]!==`
|
|
7
|
-
`;)t++;n+=`
|
|
8
|
-
`}else if(r==="/"&&e[t+1]==="*"){let s=e.indexOf("*/",t+2);t=s===-1?e.length:s+1}else n+=r}return n}function ce(e,n){let t={"[":"]","{":"}","(":")"},r=[];for(let s=n;s<e.length;s++){let o=e[s];if(o==='"'||o==="'"||o==="`")for(s++;s<e.length&&e[s]!==o;s++)e[s]==="\\"&&s++;else if(t[o])r.push(t[o]);else if(o===r[r.length-1]&&(r.pop(),r.length===0))return s+1}return-1}function Ge(e){let n=[],t=0,r=0;for(let s=0;s<e.length;s++){let o=e[s];if(o==='"'||o==="'"||o==="`")for(s++;s<e.length&&e[s]!==o;s++)e[s]==="\\"&&s++;else"[{(".includes(o)?t++:"]})".includes(o)?t--:o===","&&t===0&&(n.push(e.slice(r,s)),r=s+1)}return n.push(e.slice(r)),n.map(s=>s.trim()).filter(s=>s.length>0)}var oe=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$|^`([^`$\\]*)`$/;function k(e,n){let t=new RegExp(`(?:^|[\\s,{])['"]?${n}['"]?\\s*:\\s*`).exec(e);if(!t)return;let r=t.index+t[0].length;if(e[r]==="'"||e[r]==='"'){let i=oe.exec(e.slice(r,ze(e,r)));return i?[i[2]??i[3]]:null}if(e[r]!=="[")return null;let s=ce(e,r);if(s===-1)return null;let o=[];for(let i of Ge(e.slice(r+1,s-1))){if(/^\.\.\.[\w$.]*defaults?\b/i.test(i))continue;let a=oe.exec(i);if(!a)return null;o.push(a[2]??a[3])}return o}function ze(e,n){let t=n+1;for(;t<e.length&&e[t]!==e[n];t++)e[t]==="\\"&&t++;return t+1}function M(e){try{return x(e,{outsideRoot:"allow"})}catch{return null}}function _(e){let n=M(e);if(n===null)return null;try{let t=JSON.parse(n);return typeof t=="object"&&t!==null?t:null}catch{return null}}var R=e=>e===void 0?void 0:typeof e=="string"?[e]:Array.isArray(e)&&e.every(n=>typeof n=="string")?e:null;function S(e,n){let t=[n.include,n.exclude,n.collectFrom,n.ignore].every(o=>o!==null),r=n.collectFrom??[],s=[];for(let o of n.ignore??[])try{s.push(new RegExp(o))}catch{}return{source:e,readable:t,ignorePatterns:s,include:[...n.include??[],...r.filter(o=>!o.startsWith("!"))],exclude:[...n.exclude??[],...r.filter(o=>o.startsWith("!")).map(o=>o.slice(1))]}}function Xe(e,n){let t=ae(n),r=/(?:^|[\s,{])['"]?coverage['"]?\s*(?::\s*|(?=[,}]))/.exec(t);if(!r)return null;let s=r.index+r[0].length;if(!r[0].includes(":")||t[s]!=="{")return S(e,{include:null});let o=ce(t,s),i=o===-1?"":t.slice(s,o);return S(e,{include:k(i,"include"),exclude:k(i,"exclude")})}function Be(e,n){let t=ae(n),r=k(t,"collectCoverageFrom"),s=k(t,"coveragePathIgnorePatterns");return r===void 0&&s===void 0?null:S(e,{collectFrom:r,ignore:s})}function E(e,n){return!n||typeof n!="object"?null:"collectCoverageFrom"in n||"coveragePathIgnorePatterns"in n?S(e,{collectFrom:R(n.collectCoverageFrom),ignore:R(n.coveragePathIgnorePatterns)}):"include"in n||"exclude"in n?S(e,{include:R(n.include),exclude:R(n.exclude)}):null}function le(e){for(let r of Le){let s=M(h.join(e,r));if(s!==null){let o=Xe(r,s);if(o)return o}}for(let r of Oe){let s=h.join(e,r);if(!N.existsSync(s))continue;let o=r.endsWith(".json")?E(r,_(s)??void 0):Be(r,M(s)??"");if(o)return o}let n=_(h.join(e,"package.json")),t=E('package.json "jest"',n?.jest);if(t)return t;for(let[r,s]of[[We,"nyc"],[Je,"c8"]]){for(let i of r){let a=_(h.join(e,i)),c=E(i,a??void 0);if(c)return c;if(!a&&N.existsSync(h.join(e,i)))return S(i,{include:null})}let o=E(`package.json "${s}"`,n?.[s]);if(o)return o}return null}function ue(e,n,t){if(!e)return!0;let r=h.relative(t,n).split(h.sep).join("/");if(e.include.length>0&&!e.include.some(i=>se(i).test(r))||e.exclude.some(i=>se(i).test(r)))return!1;let s=n.split(h.sep).join("/"),o=t.split(h.sep).join("/");return!e.ignorePatterns.some(i=>i.test(s)||i.test(s.replace(o,"<rootDir>")))}var Ve=[[".ts",".tsx",".js",".jsx",".mjs",".cjs"],[".py"],[".go"],[".rs"],[".java"],[".rb"]];function fe(e){let n=m.extname(e).toLowerCase();return Ve.find(t=>t.includes(n))}function qe(e){let n=m.basename(e);return n.endsWith(".d.ts")||n.startsWith(".")||/\.config\.[cm]?[jt]sx?$/.test(n)}function C(e){try{return y.realpathSync(e)}catch{return m.resolve(e)}}function pe(e,n){let t=C(n);return new Set(e.map(r=>m.isAbsolute(r.path)?C(r.path):C(m.resolve(t,r.path))))}function Ye(e,n,t){let r=!1;try{r=y.statSync(t).isDirectory()}catch{}if(!r)return{targetFiles:[],unmeasured:[]};let s=C(n),o=le(s),i=new Set(e.map(u=>fe(u.path)).filter(Boolean)),a=pe(e,n),c=P(t).filter(u=>i.has(fe(u))&&!qe(u)).map(C).filter(u=>ue(o,u,s));return{targetFiles:c,unmeasured:c.filter(u=>!a.has(u)).sort(),...o?{coverageScope:{source:o.source,readable:o.readable}}:{}}}function Ke(e,n){let t;try{t=y.statSync(e).mtimeMs}catch{return}let r=n.filter(s=>{try{return y.statSync(s).mtimeMs>t}catch{return!1}}).sort();return r.length>0?{reportPath:e,reportModified:new Date(t).toISOString(),newerFiles:r}:void 0}function de(e,n,t,r,s={}){let{targetFiles:o,unmeasured:i,coverageScope:a}=s.checkCompleteness===!1?{targetFiles:[],unmeasured:[],coverageScope:void 0}:Ye(e.files,t,r),c=new Set([...o,...pe(n,t)]),u=s.reportPath?Ke(s.reportPath,[...c].filter(d=>y.existsSync(d))):void 0;return{status:i.length>0||u?"insufficient-evidence":"complete",unmeasuredFiles:i,targetFiles:c.size,...u?{stale:u}:{},...a?{coverageScope:a}:{}}}var L=5;function ge(e,n){return e.slice(0,L).map(r=>m.relative(n,r)||r).join(", ")+(e.length>L?`, \u2026 ${e.length-L} more`:"")}function wt(e,n){if(!e)return[];let t=[],r=e.unmeasuredFiles.length;if(r>0){let s=e.coverageScope,o=s&&!s.readable?` The coverage include/exclude in ${s.source} could not be read statically, so files it leaves out may be listed here; write them as literal string arrays to have them honoured.`:"";t.push(`${r} of ${e.targetFiles} source files under the target are not in the coverage report (UNMEASURED, not counted as covered): ${ge(e.unmeasuredFiles,n)}. Regenerate the report with coverage for the whole target, or exclude files that are not meant to be measured in the coverage tool's include/exclude config.${o}`)}if(e.stale){let s=e.stale.newerFiles.length;t.push(`the coverage report ${m.relative(n,e.stale.reportPath)||e.stale.reportPath} is STALE: ${s} source file${s===1?" was":"s were"} modified after it was written (${e.stale.reportModified}): ${ge(e.stale.newerFiles,n)}`)}return t}import*as p from"fs";import*as be from"os";import*as l from"path";Fe();var Ze=["package.json","pyproject.toml","setup.py","setup.cfg","go.mod","Cargo.toml","pom.xml","build.gradle","build.gradle.kts",".git"],He=["vitest.config.ts","vitest.config.js","vitest.config.mts","vitest.config.mjs","vitest.config.cts","vitest.config.cjs","vitest.workspace.ts","vitest.workspace.js","vitest.workspace.mts","vitest.workspace.mjs","vitest.workspace.json","vite.config.ts","vite.config.js","vite.config.mts","vite.config.mjs","jest.config.ts","jest.config.js","jest.config.mts","jest.config.mjs","jest.config.cts","jest.config.cjs","jest.config.json"];function he(e){return He.some(n=>p.existsSync(l.join(e,n)))?!0:U(e)?.jest!==void 0}function O(e){let n=U(e);if(!n)return null;let t={...n.devDependencies,...n.dependencies};return t.jest||t["@jest/core"]?"jest":t.mocha||t.nyc?"nyc":t.vitest?"vitest":null}function Qe(e){try{return p.readdirSync(e).some(n=>/^\.(mocharc|nycrc)(\.|$)/.test(n))}catch{return!1}}function et(e,n){if(Qe(e))return(O(n)??"vitest")==="nyc";let t=O(e);return t===null||t===(O(n)??"vitest")}function U(e){try{let n=JSON.parse(x(l.join(e,"package.json"),{outsideRoot:"allow"}));return typeof n=="object"&&n!==null?n:null}catch{return null}}function ye(e){let n=[],t=!1,s=U(e)?.workspaces,o=Array.isArray(s)?s:typeof s=="object"&&s!==null&&Array.isArray(s.packages)?s.packages:null;s!=null&&typeof s=="object"&&(t=!0),o&&n.push(...o.filter(i=>typeof i=="string"));try{let i=x(l.join(e,"pnpm-workspace.yaml"),{outsideRoot:"allow"});t=!0;let a=!1;for(let c of i.split(/\r?\n/)){let u=c.replace(/\s+#.*$/,"").trimEnd();if(/^packages\s*:/.test(u)){a=!0;continue}if(a){let d=/^\s+-\s+(.+)$/.exec(u);d?n.push(d[1].trim().replace(/^['"]|['"]$/g,"")):/^\S/.test(u)&&(a=!1)}}}catch{}return t?n:null}function tt(e){let r=e.replace(/^\.\//,"").replace(/\/+$/,"").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*\//g,"\0").replace(/\*\*/g,"").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]").split("\0").join("(?:.*/)?").split("").join(".*");return new RegExp(`^${r}$`)}function nt(e,n){let t=ye(e);if(!t)return!1;let r=l.relative(e,n).split(l.sep).join("/");if(r===""||r.startsWith("..")||l.isAbsolute(r))return!1;let s=!1;for(let o of t){let i=o.startsWith("!"),a=i?o.slice(1):o;l.isAbsolute(a)||/^[A-Za-z]:/.test(a)||a.split(/[\\/]/).includes("..")||tt(a).test(r)&&(s=!i)}return s}function J(e,n){let t=l.relative(n,e);return t===""||!t.startsWith("..")&&!l.isAbsolute(t)}function rt(e){try{return p.realpathSync(l.resolve(z(e)))}catch{return null}}function me(e,n=12){let t;try{let a=l.resolve(e);if(!p.existsSync(a))return null;let c=p.realpathSync(a);t=p.statSync(c).isDirectory()?c:l.dirname(c)}catch{return null}let r=null;try{r=p.realpathSync(be.homedir())}catch{r=null}let s=t,o=null,i=null;for(let a=0;a<=n;a++){if(r!==null&&t===r&&t!==s)return o;if(!o&&Ze.some(u=>p.existsSync(l.join(t,u)))){if(o=t,he(t)||!p.existsSync(l.join(t,"package.json")))return t}else if(o&&ye(t)!==null)return i??=rt(s)??"",i&&J(t,i)&&J(o,i)&&nt(t,o)&&he(t)&&et(o,t)?t:o;if(o&&p.existsSync(l.join(t,".git")))return o;let c=l.dirname(t);if(c===t)return o;t=c}return o}function $t(e,n){try{let t=p.realpathSync(n),r=p.realpathSync(l.resolve(e)),s=p.statSync(r).isDirectory()?r:l.dirname(r);for(;s!==t&&J(s,t);){if(p.existsSync(l.join(s,"package.json")))return`${l.relative(t,s).split(l.sep).join("/")}/`;let o=l.dirname(s);if(o===s)break;s=o}}catch{}return null}var st=new Set(["lcov.info","coverage-final.json","coverage-summary.json","coverage.xml","cobertura-coverage.xml","cobertura.xml"]);function ot(e){let n=l.basename(e).toLowerCase();return st.has(n)||n.endsWith(".lcov")||n.endsWith(".lcov.info")}async function it(e){let n;try{n=await X(e,{outsideRoot:"allow"})}catch{return null}if(n.trim().length===0)return null;try{let t=l.basename(e).toLowerCase(),r;if(t.endsWith(".json")){let s=JSON.parse(n);if(ct(s))r=q(n);else if(at(s))r=V(n);else return null}else t.endsWith(".xml")?r=Y(n):r=w(n);return r.files.length>0?r:null}catch{return null}}function at(e){let n=Object.values(e);return n.length>0&&n.every(t=>typeof t=="object"&&t!==null&&!Array.isArray(t)&&typeof t.s=="object"&&typeof t.statementMap=="object")}function ct(e){let n=e.total;return typeof n=="object"&&n!==null&&typeof n.lines=="object"}function lt(e,n){let t=l.relative(n,e);return t===""||!t.startsWith("..")&&!l.isAbsolute(t)}function W(e){try{return p.realpathSync(e)}catch{return l.resolve(e)}}function ut(e,n,t){let r=W(n),s=W(t);return s===r?[...e.files]:e.files.filter(o=>{let i=l.isAbsolute(o.path)?W(o.path):l.resolve(r,o.path);return lt(i,s)})}function ve(e,n,t,r={}){if(r.numTotalTests===0)return{status:"no-data",reason:"no-tests-ran"};let s=ut(e,n,t);if(s.length===0)return{status:"no-data",reason:"target-not-covered"};let o=s.filter(a=>!j(a.path,n));if(o.length===0)return{status:"no-data",reason:"test-only-report"};let i=de(e,o,n,t,{reportPath:r.reportPath,checkCompleteness:r.checkCompleteness});return{status:"measured",files:o,evidence:i}}async function At(e){let n=l.resolve(e),t;try{t=p.statSync(n)}catch{return{status:"target-missing",target:n}}if(t.isFile()&&ot(n)){let o=l.dirname(n),i=me(o)??(l.basename(o)==="coverage"?l.dirname(o):o),a=await it(n),c=a?ve(a,i,i,{reportPath:n,checkCompleteness:!1}):{status:"no-data",reason:"unreadable-report"};return{status:"evaluated",target:n,projectRoot:i,source:"report-file",evaluation:c}}let r=me(n)??(t.isDirectory()?n:l.dirname(n)),s=await B(r);return s?{status:"evaluated",target:n,projectRoot:r,source:"project-report",evaluation:ve(s.data,r,n,{reportPath:s.path})}:{status:"no-report",target:n,projectRoot:r}}function Dt(e,n,t){let r=[e.line];t.statement!==!1&&r.push(e.statement),t.branch&&r.push(e.branch),t.function&&r.push(e.function);let s=r.reduce((o,i)=>o+i,0)/r.length;return{overall:s,meetsThreshold:s>=n}}var ft=/^Coverage is [\d.]+% below threshold/i;function Pt(e,n,t,r){let s=e.filter(o=>!ft.test(o)&&(r.branch||!/branch coverage/i.test(o))&&(r.function||!/function coverage/i.test(o)));return n.meetsThreshold?s:[`Coverage is ${(t-n.overall).toFixed(1)}% below threshold. Focus on high-risk files first.`,...s]}function _t(e){return e==="target-not-covered"||e==="no-tests-ran"}function Nt(e,n,t){switch(e){case"target-missing":return`Target does not exist: ${n}`;case"unreadable-report":return`Unreadable coverage report: ${n}. It could not be parsed or lists no files. Supported: lcov.info, istanbul coverage-final.json / coverage-summary.json, Cobertura XML. Raw V8 output is not supported \u2014 convert it with c8 or your runner's istanbul reporter.`;case"test-only-report":return"The coverage report contains only test files, so there is no production coverage to report. Coverage OF a test file is not a meaningful metric. Check that your coverage tool is instrumenting your source directory.";case"target-not-covered":return`Target is UNMEASURED: the coverage data for project ${t??"?"} has no entry for any production file under ${n}. This is not 0% coverage \u2014 no measurement exists for it. Check your coverage tool's include/exclude settings, or regenerate the report.`;case"no-tests-ran":return`Target is UNMEASURED: the test runner reported running 0 tests from ${t??"?"}. This is not 0% coverage.`}}export{$e as a,te as b,ht as c,mt as d,vt as e,wt as f,$t as g,it as h,ut as i,ve as j,At as k,Dt as l,Pt as m,_t as n,Nt as o};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.13");process.exit(0)}
|
|
2
|
-
import{c as J}from"./chunk-5MDERQH3.js";import{c as P}from"./chunk-PB6J6HAA.js";import{b as E,d as q}from"./chunk-VTOBUZL6.js";import*as _ from"fs/promises";import*as y from"path";q();async function Z(r){let i=[y.join(r,"coverage","coverage-final.json"),y.join(r,"coverage","lcov.info"),y.join(r,".nyc_output","coverage-final.json"),y.join(r,"coverage-final.json"),y.join(r,"coverage","coverage-summary.json"),y.join(r,"coverage.xml"),y.join(r,"htmlcov","status.json"),y.join(r,"cobertura-coverage.xml")];for(let e of i)try{let c=await P(e,{outsideRoot:"allow"});if(e.endsWith("coverage-summary.json"))return{data:X(c),path:e};if(e.endsWith(".json"))return{data:K(c),path:e};if(e.endsWith(".info"))return{data:$(c),path:e};if(e.endsWith(".xml"))return{data:G(c),path:e}}catch{}return null}function U(r){let i=new Map,e=r.statementMap||{};for(let[c,l]of Object.entries(r.s||{})){let a=e[c]?.start?.line;if(typeof a!="number")continue;let t=i.get(a);(t===void 0||t<l)&&i.set(a,l)}return i}function K(r){let i=E(r),e=[],c=0,l=0,a=0,t=0,n=0,h=0,p=0,s=0;for(let[g,u]of Object.entries(i)){let d=u,f=d.s||{},x=d.branchMap||{},v=d.b||{},N=d.f||{},o=U(d),F=o.size,C=[...o.values()].filter(m=>m>0).length,b=Object.values(v).flat().length,R=Object.values(v).flat().filter(m=>m>0).length,L=Object.keys(N).length,M=Object.values(N).filter(m=>m>0).length,I=Object.keys(f).length,B=Object.values(f).filter(m=>m>0).length,W=[...o.entries()].filter(([,m])=>m===0).map(([m])=>m),S=[];for(let[m,w]of Object.entries(v)){let D=x[m];w.forEach((A,j)=>{A===0&&D?.locations?.[j]?.start?.line&&S.push(D.locations[j].start.line)})}e.push({path:g,lines:{covered:C,total:F},branches:{covered:R,total:b},functions:{covered:M,total:L},statements:{covered:B,total:I},uncoveredLines:W.sort((m,w)=>m-w),uncoveredBranches:Array.from(new Set(S)).sort((m,w)=>m-w)}),c+=F,l+=C,a+=b,t+=R,n+=L,h+=M,p+=I,s+=B}return{files:e,summary:{line:c>0?l/c*100:0,branch:a>0?t/a*100:0,function:n>0?h/n*100:0,statement:p>0?s/p*100:0,files:e.length}}}function X(r){let i=E(r),e=t=>({covered:Number(t?.covered)||0,total:Number(t?.total)||0}),c=[];for(let[t,n]of Object.entries(i))t==="total"||typeof n!="object"||n===null||!n.lines||c.push({path:t,lines:e(n.lines),branches:e(n.branches),functions:e(n.functions),statements:e(n.statements??n.lines),uncoveredLines:[],uncoveredBranches:[]});let l=t=>c.reduce((n,h)=>({covered:n.covered+t(h).covered,total:n.total+t(h).total}),{covered:0,total:0}),a=t=>t.total>0?t.covered/t.total*100:0;return{files:c,summary:{line:a(l(t=>t.lines)),branch:a(l(t=>t.branches)),function:a(l(t=>t.functions)),statement:a(l(t=>t.statements)),files:c.length}}}function $(r){let i=[],e=r.split(`
|
|
3
|
-
`),c=null,l=0,a=0,t=0,n=0,h=0,p=0,s=[],g=[];for(let o of e)if(o.startsWith("SF:"))c=o.slice(3);else if(o.startsWith("LF:"))l=parseInt(o.slice(3),10);else if(o.startsWith("LH:"))a=parseInt(o.slice(3),10);else if(o.startsWith("BRF:"))t=parseInt(o.slice(4),10);else if(o.startsWith("BRH:"))n=parseInt(o.slice(4),10);else if(o.startsWith("FNF:"))h=parseInt(o.slice(4),10);else if(o.startsWith("FNH:"))p=parseInt(o.slice(4),10);else if(o.startsWith("DA:")){let[F,C]=o.slice(3).split(",").map(b=>parseInt(b,10));C===0&&s.push(F)}else if(o.startsWith("BRDA:")){let F=o.slice(5).split(","),C=parseInt(F[0],10),b=F[3];(b==="0"||b==="-")&&g.push(C)}else o==="end_of_record"&&c&&(i.push({path:c,lines:{covered:a,total:l},branches:{covered:n,total:t},functions:{covered:p,total:h},statements:{covered:0,total:0},uncoveredLines:Array.from(new Set(s)),uncoveredBranches:Array.from(new Set(g))}),c=null,l=a=0,t=n=0,h=p=0,s.length=0,g.length=0);let u=0,d=0,f=0,x=0,v=0,N=0;for(let o of i)u+=o.lines.total,d+=o.lines.covered,f+=o.branches.total,x+=o.branches.covered,v+=o.functions.total,N+=o.functions.covered;return{files:i,summary:{line:u>0?d/u*100:0,branch:f>0?x/f*100:0,function:v>0?N/v*100:0,statement:u>0?d/u*100:0,files:i.length}}}function G(r){let i=[];function e(f,x){let v=f.match(new RegExp(`${x}=["']([^"']*)["']`));return v?v[1]:null}let c=/<class\s[^>]*?>/g,l;for(;(l=c.exec(r))!==null;){let f=l[0],x=e(f,"filename");if(!x)continue;let v=parseFloat(e(f,"line-rate")||"NaN"),N=parseFloat(e(f,"branch-rate")||"NaN"),o=l.index,F=r.indexOf("</class>",o),C=F>o?r.slice(o,F):"",b=0,R=0,L=0,M=0,I=0,B=0,W=[],S=[],m=/<line\s([^>]*?)\/>/g,w;for(;(w=m.exec(C))!==null;){let j=w[1],k=parseInt(e(j,"number")||"0",10),O=parseInt(e(j,"hits")||"0",10),z=e(j,"branch")==="true",T=e(j,"condition-coverage");b++,O>0?R++:W.push(k),z&&(L++,(T?parseInt(T,10):O>0?100:0)===100?M++:S.push(k))}let D=/<method\s([^>]*?)>/g,A;for(;(A=D.exec(C))!==null;){I++;let j=A.index,k=C.indexOf("</method>",j);if(k>j){let O=C.slice(j,k),z=/<line\s([^>]*?)\/>/g,T=!1,H;for(;(H=z.exec(O))!==null;)if(parseInt(e(H[1],"hits")||"0",10)>0){T=!0;break}T&&B++}}b===0&&!isNaN(v)&&(b=100,R=Math.round(Math.max(0,Math.min(1,v))*100)),i.push({path:x,lines:{covered:R,total:b},branches:{covered:M,total:L},functions:{covered:B,total:I},statements:{covered:0,total:0},uncoveredLines:W,uncoveredBranches:S})}let a=0,t=0,n=0,h=0,p=0,s=0;for(let f of i)a+=f.lines.total,t+=f.lines.covered,n+=f.branches.total,h+=f.branches.covered,p+=f.functions.total,s+=f.functions.covered;let g=r.match(/<coverage\s[^>]*?>/),u=g?parseFloat(e(g[0],"line-rate")||"NaN")*100:NaN,d=g?parseFloat(e(g[0],"branch-rate")||"NaN")*100:NaN;return{files:i,summary:{line:isNaN(u)?a>0?t/a*100:0:u,branch:isNaN(d)?n>0?h/n*100:0:d,function:p>0?s/p*100:0,statement:a>0?t/a*100:0,files:i.length}}}async function ee(r,i={}){let e=[],{includeTests:c=!0,languages:l,maxFiles:a=5e3,completeScope:t=!1}=i,n=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".py",".pyw",".go",".rs",".java",".kt",".kts",".rb",".cs",".php",".swift",".c",".h",".cpp",".hpp",".cc",".scala"];if(l&&l.length>0){n=[];for(let s of l)s==="typescript"&&n.push(".ts",".tsx",".mts",".cts"),s==="javascript"&&n.push(".js",".jsx",".mjs",".cjs"),s==="python"&&n.push(".py",".pyw"),s==="go"&&n.push(".go"),s==="rust"&&n.push(".rs"),s==="java"&&n.push(".java"),s==="kotlin"&&n.push(".kt",".kts"),s==="ruby"&&n.push(".rb"),(s==="csharp"||s==="c#")&&n.push(".cs"),s==="php"&&n.push(".php"),s==="swift"&&n.push(".swift"),(s==="c"||s==="cpp"||s==="c++")&&n.push(".c",".h",".cpp",".hpp",".cc"),s==="scala"&&n.push(".scala")}t&&(!l||l.length===0)&&n.push(".vue",".svelte");async function h(s){try{let g=await _.readdir(s,{withFileTypes:!0});for(let u of g){let d=y.join(s,u.name);if(u.isDirectory()){if(["node_modules",".git","dist","build","coverage",".nyc_output","__pycache__",".venv","venv",".tox",".mypy_cache","target",".gradle","vendor",".bundle",".cache",".npm",".yarn",".next",".nuxt",".svelte-kit","out",".turbo","tmp","temp",".tmp"].includes(u.name)||J(s,u.name,s===r))continue;if(e.length>=a)return;await h(d)}else if(u.isFile()||t&&u.isSymbolicLink()&&await p(d)){let f=y.extname(u.name);if(!n.includes(f)||!c&&(u.name.includes(".test.")||u.name.includes(".spec.")||u.name.endsWith("_test.ts")||u.name.endsWith("_test.js")||d.includes("/__tests__/")||d.includes("/test/")||d.includes("/tests/")))continue;if(e.length>=a)return;e.push(d)}}}catch{}}async function p(s){try{return(await _.stat(s)).isFile()}catch{return!1}}try{if((await _.stat(r)).isFile())return[r];await h(r)}catch{}return e}function te(r){let i=new Set,e={injection:"Use parameterized queries and input validation to prevent injection attacks",xss:"Sanitize user input and use Content-Security-Policy headers","sensitive-data":"Never hardcode secrets; use environment variables or secret managers","access-control":"Implement proper authentication and authorization checks","security-misconfiguration":"Review and harden security configurations","insecure-deserialization":"Avoid deserializing untrusted data; use safe alternatives","broken-auth":"Use strong authentication mechanisms and secure session management",dependencies:"Keep dependencies updated and regularly audit for vulnerabilities"};for(let a of r){let t=e[a.category];t&&i.add(t)}let c=r.some(a=>a.severity==="critical"),l=r.some(a=>a.severity==="high");return c&&i.add("CRITICAL: Address critical vulnerabilities immediately before deployment"),l&&i.add("Prioritize fixing high-severity issues in the next sprint"),i.size===0&&r.length===0&&i.add("No vulnerabilities found - maintain current security practices"),Array.from(i)}export{Z as a,U as b,K as c,X as d,$ as e,G as f,ee as g,te as h};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.13");process.exit(0)}
|
|
2
|
-
import{j as c}from"./chunk-E7CLYGS7.js";import{b as g,d as E}from"./chunk-VTOBUZL6.js";import{a as p}from"./chunk-UT2VZ33P.js";import{c as m}from"./chunk-GB6HBNH2.js";import{d as l,e as _}from"./chunk-DNDL7SOS.js";_();import b from"node:path";import{existsSync as h}from"node:fs";E();p();var T=m.create("metrics-tracker"),d=class{db=null;dbPath;initialized=!1;constructor(e=process.cwd()){this.dbPath=b.join(e,".agentic-qe","memory.db")}async initialize(){if(!this.initialized){if(!h(this.dbPath))throw new Error(`Database not found: ${this.dbPath}. Run "aqe init --auto" first.`);this.db=l(this.dbPath),this.ensureMetricsTable(),this.initialized=!0}}ensureMetricsTable(){this.db&&this.db.exec(`
|
|
3
|
-
CREATE TABLE IF NOT EXISTS learning_daily_snapshots (
|
|
4
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
5
|
-
snapshot_date TEXT NOT NULL UNIQUE,
|
|
6
|
-
total_patterns INTEGER DEFAULT 0,
|
|
7
|
-
patterns_created_today INTEGER DEFAULT 0,
|
|
8
|
-
total_experiences INTEGER DEFAULT 0,
|
|
9
|
-
experiences_today INTEGER DEFAULT 0,
|
|
10
|
-
total_q_values INTEGER DEFAULT 0,
|
|
11
|
-
avg_reward REAL DEFAULT 0.0,
|
|
12
|
-
avg_confidence REAL DEFAULT 0.0,
|
|
13
|
-
avg_quality_score REAL DEFAULT 0.0,
|
|
14
|
-
success_rate REAL DEFAULT 0.0,
|
|
15
|
-
pattern_reuse_count INTEGER DEFAULT 0,
|
|
16
|
-
short_term_patterns INTEGER DEFAULT 0,
|
|
17
|
-
long_term_patterns INTEGER DEFAULT 0,
|
|
18
|
-
domain_coverage_json TEXT,
|
|
19
|
-
created_at TEXT DEFAULT (datetime('now'))
|
|
20
|
-
);
|
|
21
|
-
CREATE INDEX IF NOT EXISTS idx_learning_daily_snapshots_date ON learning_daily_snapshots(snapshot_date DESC);
|
|
22
|
-
`)}async getCurrentMetrics(){if(this.initialized||await this.initialize(),!this.db)throw new Error("Database not initialized");let e=new Date().toISOString().split("T")[0],r=new Date(Date.now()-10080*60*1e3).toISOString().split("T")[0],a=this.getPatternStats(e),t=this.getExperienceStats(e),s=this.getQValueStats(),o=this.getDomainCoverage(),n=this.getHistoricalAvgReward(r);return{timestamp:new Date,totalPatterns:a.total,patternsCreatedToday:a.createdToday,totalExperiences:t.total,experiencesToday:t.recordedToday,totalQValues:s.total,avgReward:t.avgReward,avgRewardDelta:t.avgReward-n,domainCoverage:o,patternReuseCount:a.reuseCount,shortTermPatterns:a.shortTerm,longTermPatterns:a.longTerm,avgConfidence:a.avgConfidence,avgQualityScore:a.avgQualityScore,successRate:t.successRate}}getPatternStats(e){if(!this.db)return{total:0,createdToday:0,shortTerm:0,longTerm:0,avgConfidence:0,avgQualityScore:0,reuseCount:0};if(!this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_patterns'").get())return{total:0,createdToday:0,shortTerm:0,longTerm:0,avgConfidence:0,avgQualityScore:0,reuseCount:0};let a=this.db.prepare(`
|
|
23
|
-
SELECT
|
|
24
|
-
COUNT(*) as total,
|
|
25
|
-
SUM(CASE WHEN date(created_at) = ? THEN 1 ELSE 0 END) as created_today,
|
|
26
|
-
SUM(CASE WHEN tier = 'short-term' THEN 1 ELSE 0 END) as short_term,
|
|
27
|
-
SUM(CASE WHEN tier = 'long-term' THEN 1 ELSE 0 END) as long_term,
|
|
28
|
-
AVG(confidence) as avg_confidence,
|
|
29
|
-
AVG(quality_score) as avg_quality_score,
|
|
30
|
-
SUM(usage_count) as total_usage
|
|
31
|
-
FROM qe_patterns
|
|
32
|
-
`).get(e);return{total:a.total||0,createdToday:a.created_today||0,shortTerm:a.short_term||0,longTerm:a.long_term||0,avgConfidence:a.avg_confidence||0,avgQualityScore:a.avg_quality_score||0,reuseCount:a.total_usage||0}}getExperienceStats(e){if(!this.db)return{total:0,recordedToday:0,avgReward:0,successRate:0};if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='captured_experiences'").get()){let t=this.db.prepare(`
|
|
33
|
-
SELECT
|
|
34
|
-
COUNT(*) as total,
|
|
35
|
-
SUM(CASE WHEN date(started_at) = ? THEN 1 ELSE 0 END) as recorded_today,
|
|
36
|
-
AVG(quality) as avg_reward,
|
|
37
|
-
AVG(CASE WHEN success = 1 THEN 1.0 ELSE 0.0 END) as success_rate
|
|
38
|
-
FROM captured_experiences
|
|
39
|
-
WHERE agent != 'cli-hook'
|
|
40
|
-
`).get(e);return{total:t.total||0,recordedToday:t.recorded_today||0,avgReward:t.avg_reward||0,successRate:t.success_rate||0}}if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_pattern_usage'").get()){let t=this.db.prepare(`
|
|
41
|
-
SELECT
|
|
42
|
-
COUNT(*) as total,
|
|
43
|
-
SUM(CASE WHEN date(created_at) = ? THEN 1 ELSE 0 END) as recorded_today,
|
|
44
|
-
AVG(success) as success_rate
|
|
45
|
-
FROM qe_pattern_usage
|
|
46
|
-
`).get(e);return{total:t.total||0,recordedToday:t.recorded_today||0,avgReward:t.success_rate||0,successRate:t.success_rate||0}}return{total:0,recordedToday:0,avgReward:0,successRate:0}}getQValueStats(){return this.db?this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='rl_q_values'").get()?{total:this.db.prepare(`
|
|
47
|
-
SELECT COUNT(*) as total FROM rl_q_values
|
|
48
|
-
`).get().total||0}:{total:0}:{total:0}}getDomainCoverage(){let e={};for(let t of c)e[t]=0;if(!this.db||!this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_patterns'").get())return e;let a=this.db.prepare(`
|
|
49
|
-
SELECT qe_domain, COUNT(*) as count
|
|
50
|
-
FROM qe_patterns
|
|
51
|
-
GROUP BY qe_domain
|
|
52
|
-
`).all();for(let t of a)c.includes(t.qe_domain)&&(e[t.qe_domain]=t.count);return e}getHistoricalAvgReward(e){return this.db&&this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='captured_experiences'").get()&&this.db.prepare(`
|
|
53
|
-
SELECT AVG(quality) as avg_reward
|
|
54
|
-
FROM captured_experiences
|
|
55
|
-
WHERE started_at <= datetime(?)
|
|
56
|
-
AND agent != 'cli-hook'
|
|
57
|
-
`).get(e+" 23:59:59")?.avg_reward||0}async getDashboardData(){this.initialized||await this.initialize();let e=await this.getCurrentMetrics(),r=await this.getMetricsHistory(7),a=r.map(n=>n.patternsCreatedToday),t=r.map(n=>n.experiencesToday),s=r.map(n=>n.avgReward),o=Object.entries(e.domainCoverage).filter(([n,i])=>i>0).sort((n,i)=>i[1]-n[1]).slice(0,5).map(([n,i])=>({domain:n,count:i}));return{current:e,history:r,trends:{patternsPerDay:a,experiencesPerDay:t,avgRewardPerDay:s},topDomains:o}}async getMetricsHistory(e){if(this.initialized||await this.initialize(),!this.db)return[];let r=[];if(!this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='learning_daily_snapshots'").get())return[];let t=this.db.prepare(`
|
|
58
|
-
SELECT *
|
|
59
|
-
FROM learning_daily_snapshots
|
|
60
|
-
ORDER BY snapshot_date DESC
|
|
61
|
-
LIMIT ?
|
|
62
|
-
`).all(e);for(let s of t){let o={};try{o=g(s.domain_coverage_json||"{}")}catch(n){T.debug("Domain coverage JSON parse failed",{error:n instanceof Error?n.message:String(n)});for(let i of c)o[i]=0}r.push({timestamp:new Date(s.snapshot_date),totalPatterns:s.total_patterns,patternsCreatedToday:s.patterns_created_today,totalExperiences:s.total_experiences,experiencesToday:s.experiences_today,totalQValues:s.total_q_values,avgReward:s.avg_reward,avgRewardDelta:0,domainCoverage:o,patternReuseCount:s.pattern_reuse_count,shortTermPatterns:s.short_term_patterns,longTermPatterns:s.long_term_patterns,avgConfidence:s.avg_confidence,avgQualityScore:s.avg_quality_score,successRate:s.success_rate})}return r}async saveSnapshot(){if(this.initialized||await this.initialize(),!this.db)throw new Error("Database not initialized");let e=await this.getCurrentMetrics(),r=new Date().toISOString().split("T")[0];this.db.prepare(`
|
|
63
|
-
INSERT OR REPLACE INTO learning_daily_snapshots (
|
|
64
|
-
snapshot_date,
|
|
65
|
-
total_patterns,
|
|
66
|
-
patterns_created_today,
|
|
67
|
-
total_experiences,
|
|
68
|
-
experiences_today,
|
|
69
|
-
total_q_values,
|
|
70
|
-
avg_reward,
|
|
71
|
-
avg_confidence,
|
|
72
|
-
avg_quality_score,
|
|
73
|
-
success_rate,
|
|
74
|
-
pattern_reuse_count,
|
|
75
|
-
short_term_patterns,
|
|
76
|
-
long_term_patterns,
|
|
77
|
-
domain_coverage_json
|
|
78
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
79
|
-
`).run(r,e.totalPatterns,e.patternsCreatedToday,e.totalExperiences,e.experiencesToday,e.totalQValues,e.avgReward,e.avgConfidence,e.avgQualityScore,e.successRate,e.patternReuseCount,e.shortTermPatterns,e.longTermPatterns,JSON.stringify(e.domainCoverage))}async getDashboardDataWithRegret(e){let r=await this.getDashboardData();return e&&e.length>0&&(r.regretHealth=e),r}async collectUnifiedSnapshot(){this.initialized||await this.initialize();let e=await this.getCurrentMetrics();return{timestamp:Date.now(),tokenMetrics:{totalTokens:0,costUsd:0,savingsUsd:0,cacheHitRate:0},qualityMetrics:{gatePassRate:e.successRate,averageScore:e.avgQualityScore,ratchetLevel:0},learningMetrics:{patternCount:e.totalPatterns,averageConfidence:e.avgConfidence,quarantinedCount:0,transferSuccessRate:0},performanceMetrics:{avgLatencyMs:0,p95LatencyMs:0,errorRate:0}}}close(){this.db&&(this.db.close(),this.db=null,this.initialized=!1)}};function C(u){return new d(u)}export{d as a,C as b};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.13");process.exit(0)}
|
|
2
|
-
import{a as h,b as y}from"./chunk-LFJALJOA.js";import{b as p}from"./chunk-6Z7PRBSG.js";import{f as g,k as v,l as f,m as b,o as c}from"./chunk-K65CGKLD.js";import k from"chalk";var C=3,D="instrumented-report",R="static-estimation";async function T(e,r=a=>console.log(a)){let a=await v(e);if(a.status==="target-missing")return{kind:"no-data",reason:"target-missing",message:c("target-missing",e,null)};if(a.status==="evaluated"){let{evaluation:n,projectRoot:t}=a;if(n.status==="measured"){let{files:l,evidence:o}=n;return{kind:"data",data:{files:l,summary:h(l),instrumented:!0,...o.unmeasuredFiles.length>0?{unmeasuredFiles:o.unmeasuredFiles}:{}},projectRoot:t,evidence:o}}return{kind:"no-data",reason:n.reason,message:c(n.reason,e,t)}}let s=p(a.target,{includeTests:!1});return s.length===0?{kind:"no-sources"}:(r(k.gray(` Analyzing ${s.length} files...
|
|
3
|
-
`)),{kind:"data",data:y(s,a.projectRoot),projectRoot:a.projectRoot})}function x(e){return{branch:e.files.some(r=>r.branches.total>0),function:e.files.some(r=>r.functions.total>0),statement:e.files.some(r=>r.statements.total>0)}}var N=e=>e==="target-missing"||e==="unreadable-report";function w(){return"UNMEASURED: no coverage report exists for this project, so these figures are a STATIC ESTIMATE derived from source shape \u2014 not measured coverage. No threshold verdict is given and nothing is stored as evidence. Run your tests with coverage first (e.g. `npm test -- --coverage`) and re-run."}async function M(e,r,a,s){let n=await T(r,s);if(n.kind==="no-sources")return n;if(n.kind==="no-data")return N(n.reason)?{kind:"error",reason:n.reason,message:n.message}:{kind:"unmeasured",reason:n.reason,message:n.message};let t=n.data,l=t.instrumented,o=await e.analyze({coverageData:t,threshold:a,includeFileDetails:!0,measured:l,...n.projectRoot?{projectRoot:n.projectRoot}:{}});if(!o.success||!o.value)return{kind:"analysis-failed",message:o.error?.message||"Coverage analysis failed"};let i=o.value;if(!l)return{kind:"estimate",data:t,summary:{...i.summary},message:w()};let u=x(t),m=f(i.summary,a,u),d=g(n.evidence,n.projectRoot??r),E={...m,meetsThreshold:m.meetsThreshold&&d.length===0};return{kind:"measured",data:t,collected:u,verdict:E,insufficientEvidence:d,...n.evidence?{evidence:n.evidence}:{},summary:{...i.summary,branch:u.branch?i.summary.branch:null,function:u.function?i.summary.function:null,statement:u.statement?i.summary.statement:null},recommendations:b(i.recommendations??[],m,a,u)}}function z(e,r){switch(e.kind){case"measured":{if(e.insufficientEvidence.length>0)return C;let{overall:a,meetsThreshold:s}=e.verdict;return s?a<r+5?2:0:1}case"estimate":case"unmeasured":return C;case"no-sources":return 0;default:return 1}}function O(e,r,a){let s={line:null,branch:null,function:null,statement:null};switch(e.kind){case"measured":return{summary:e.summary,meetsThreshold:e.verdict.meetsThreshold,threshold:r,recommendations:e.recommendations,measured:!0,estimated:!1,coverageMethod:D,branchDataCollected:e.collected.branch,functionDataCollected:e.collected.function,statementDataCollected:e.collected.statement,...e.data.unmeasuredFiles?.length?{unmeasuredFiles:e.data.unmeasuredFiles}:{},...e.evidence?{evidenceStatus:e.evidence.status}:{},...e.evidence?.stale?{staleReport:e.evidence.stale}:{},...e.insufficientEvidence.length>0?{warning:`INSUFFICIENT EVIDENCE: ${e.insufficientEvidence.join("; ")}`}:{}};case"estimate":return{summary:e.summary,meetsThreshold:null,threshold:r,measured:!1,estimated:!0,unmeasured:!0,coverageMethod:R,reason:"no-coverage-report",target:a,warning:e.message};case"unmeasured":case"error":return{summary:s,meetsThreshold:null,threshold:r,measured:!1,unmeasured:e.kind==="unmeasured",reason:e.reason,target:a,warning:e.message};case"analysis-failed":return{summary:s,meetsThreshold:null,threshold:r,measured:!1,target:a,error:e.message};case"no-sources":return{summary:s,meetsThreshold:null,threshold:r,measured:!1,target:a,warning:"No source files found"}}}export{C as a,T as b,M as c,z as d,O as e};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.13");process.exit(0)}
|
|
2
|
-
import{d as l,e as o}from"./chunk-A64JFBWI.js";var t=n=>typeof n=="number"&&Number.isFinite(n)&&n>=0&&n<=100,i=n=>n===null||t(n);function a(n){if(!n||typeof n!="object")return null;let e=n;if(e.measured!==!0||!t(e.line)||!i(e.statement)||!i(e.branch)||!i(e.function))return null;let r=typeof e.files=="number"&&Number.isInteger(e.files)&&e.files>=0?e.files:null;return r===null?null:{line:e.line,branch:e.branch,function:e.function,statement:e.statement,files:r,measured:!0,...e.runStatus==="passed"||e.runStatus==="failed"?{runStatus:e.runStatus}:{}}}function m(n){if(!n||typeof n!="object")return null;let e=n;if(e.measured!==!0||!t(e.line))return null;let r=s=>t(s)?s:null;return{line:e.line,branch:r(e.branch),function:r(e.function),statement:r(e.statement),measured:!0}}o();var u=class extends Error{constructor(e,r){super(`git ${e.join(" ")} timed out after ${Math.max(0,r)}ms`),this.name="GitTimeoutError"}};async function b(n,e){if(e.timeout<=0)throw new u(n,e.timeout);try{return await l("git",n,{cwd:e.cwd,timeout:e.timeout,maxBuffer:e.maxBuffer,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}})}catch(r){throw r.code==="ETIMEDOUT"?new u(n,e.timeout):r}}export{a,m as b,u as c,b as d};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.13");process.exit(0)}
|
|
2
|
-
import{a as e,b as g,e as t}from"./chunk-GB6HBNH2.js";import{d as r}from"./chunk-UOC3O6RP.js";import{b as o}from"./chunk-ZAKQLAHT.js";var L=o(()=>{"use strict";e();g();t();r()});export{L as a};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.13");process.exit(0)}
|
|
2
|
-
import{c as a,d as b,e as c}from"./chunk-3RZV5DGO.js";import"./chunk-I3C7JOXC.js";import"./chunk-A64JFBWI.js";import"./chunk-XPRVF4YE.js";import"./chunk-3Y2ROSCL.js";import"./chunk-ZAKQLAHT.js";c();export{a as VibiumClientImpl,b as VibiumClientProvider};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.13");process.exit(0)}
|
|
2
|
-
import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i,m as j,n as k,o as l}from"./chunk-W3PPFHI5.js";import"./chunk-KWYH3FI4.js";import"./chunk-AL6FBH3E.js";import"./chunk-F3YS57NF.js";import"./chunk-CCMKSHAT.js";import"./chunk-YZWBNBTW.js";import"./chunk-PSFSPGUD.js";import"./chunk-O6FGXMHD.js";import"./chunk-K65CGKLD.js";import"./chunk-CRWPZT74.js";import"./chunk-CM4LSLKR.js";import"./chunk-CE7B5LU7.js";import"./chunk-EXGMJFAT.js";import"./chunk-DFUASIKA.js";import"./chunk-BLSLEVDI.js";import"./chunk-BTVEYBW2.js";import"./chunk-HOAJUIBQ.js";import"./chunk-KADFXPPN.js";import"./chunk-UXZSUMEA.js";import"./chunk-MGZ5FJUW.js";import"./chunk-75RDHBAX.js";import"./chunk-RFNW2LGD.js";import"./chunk-32ZMWEP3.js";import"./chunk-MFW5HSG4.js";import"./chunk-R7SYRCRP.js";import"./chunk-7YTGHGK4.js";import"./chunk-MVVB7C2E.js";import"./chunk-BEGR4D6N.js";import"./chunk-LUZNKJE6.js";import"./chunk-YXRASAPI.js";import"./chunk-MB46UBGY.js";import"./chunk-5MDERQH3.js";import"./chunk-BK577VL7.js";import"./chunk-YZEXYO4W.js";import"./chunk-S5AZCIZS.js";import"./chunk-756CGMEH.js";import"./chunk-K3TLLJMX.js";import"./chunk-ASQYASNV.js";import"./chunk-M6AAGIG7.js";import"./chunk-KCW47QR5.js";import"./chunk-VTDFVFST.js";import"./chunk-C6JTLKG7.js";import"./chunk-N4CYAKOX.js";import"./chunk-HQZGPJYG.js";import"./chunk-X2Z7F4EU.js";import"./chunk-SE4VNN4I.js";import"./chunk-KUAKV3IW.js";import"./chunk-5ZGM3RMH.js";import"./chunk-42J34YG4.js";import"./chunk-G2Q66Z23.js";import"./chunk-CT6SAVXQ.js";import"./chunk-GII6UM3F.js";import"./chunk-SG3NX7QE.js";import"./chunk-UDQSYWVF.js";import"./chunk-JQGMW45H.js";import"./chunk-KB56CPU4.js";import"./chunk-GHY6Z6KO.js";import"./chunk-PB6J6HAA.js";import"./chunk-NZ3GUMB2.js";import"./chunk-JGZ722G3.js";import"./chunk-3RZV5DGO.js";import"./chunk-I3C7JOXC.js";import"./chunk-A64JFBWI.js";import"./chunk-XPRVF4YE.js";import"./chunk-YBQH2VOP.js";import"./chunk-CV77DMDQ.js";import"./chunk-3AN5TNGD.js";import"./chunk-3YNLWPBF.js";import"./chunk-LZYQHVD4.js";import"./chunk-HZ5NXFXH.js";import"./chunk-YQFLQE53.js";import"./chunk-5K26BEYB.js";import"./chunk-VRHRBAEM.js";import"./chunk-IJUHSJ2U.js";import"./chunk-KDVZND5Q.js";import"./chunk-PIDQVU3L.js";import"./chunk-72ASBE35.js";import"./chunk-TSQC2KKZ.js";import"./chunk-SYV2V3PL.js";import"./chunk-NZD4DPSU.js";import"./chunk-E7CLYGS7.js";import"./chunk-GU5HNCWI.js";import"./chunk-5VMAV6T6.js";import"./chunk-TWJTK4CC.js";import"./chunk-GHM6MQNK.js";import"./chunk-XEAEYC6Y.js";import"./chunk-QDEJ4CI2.js";import"./chunk-6KATY3KS.js";import"./chunk-LWR3FV3Y.js";import"./chunk-C7JM7CD3.js";import"./chunk-TCBBNUBP.js";import"./chunk-H4GG2NLO.js";import"./chunk-Q3UDLV5Z.js";import"./chunk-YSZ5OE3Z.js";import"./chunk-SSU73QAX.js";import"./chunk-QPNG5ZN2.js";import"./chunk-PHP5UBT4.js";import"./chunk-P7A4NKTZ.js";import"./chunk-T3PGQFDI.js";import"./chunk-VRVMIPTM.js";import"./chunk-4OVC4RIL.js";import"./chunk-UTRV7T2N.js";import"./chunk-3Y7TJFHU.js";import"./chunk-7CMTY45A.js";import"./chunk-VTOBUZL6.js";import"./chunk-KDNJ4F3P.js";import"./chunk-JRRXCODW.js";import"./chunk-XNBOGCF3.js";import"./chunk-KV4T4MXK.js";import"./chunk-TWDW32W2.js";import"./chunk-AQSVJNEH.js";import"./chunk-OCAEXYFA.js";import"./chunk-526QYFJU.js";import"./chunk-WKGTGOYS.js";import"./chunk-DVGRPK7A.js";import"./chunk-H4H2YSFH.js";import"./chunk-5FKWCZNF.js";import"./chunk-NURIILUB.js";import"./chunk-TOQWL2ZF.js";import"./chunk-UT2VZ33P.js";import"./chunk-GB6HBNH2.js";import"./chunk-UOC3O6RP.js";import"./chunk-NT4DBXSX.js";import"./chunk-WOCGL4QP.js";import"./chunk-W2QWSQVE.js";import"./chunk-J2ZIFFM6.js";import"./chunk-RF7HWBHN.js";import"./chunk-IC3TQEOA.js";import"./chunk-HD7YIFOI.js";import"./chunk-DNDL7SOS.js";import"./chunk-3Y2ROSCL.js";import"./chunk-WO274FRI.js";import"./chunk-ZAKQLAHT.js";export{c as adoptExternalFleet,e as assignAgentLevel,k as disposeFleet,f as getAgentLevel,g as getAllAgentLevels,a as getFleetState,d as getFleetTopology,l as handleAQEHealth,j as handleFleetHealth,h as handleFleetInit,i as handleFleetStatus,b as isFleetInitialized};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.13");process.exit(0)}
|
|
2
|
-
import{a as d,b as A,c as x,d as E,e as O,f as L,g as M,h as U,i as B,j as V}from"./chunk-3LJ7LQMV.js";import{a as I,b as _,c as q,d as N,e as j}from"./chunk-PT4FMJPQ.js";import"./chunk-LFJALJOA.js";import"./chunk-6Z7PRBSG.js";import{d as G,e as T,h as D}from"./chunk-W26B7ERY.js";import"./chunk-K65CGKLD.js";import"./chunk-MB46UBGY.js";import"./chunk-5MDERQH3.js";import"./chunk-PB6J6HAA.js";import"./chunk-A64JFBWI.js";import"./chunk-VTOBUZL6.js";import"./chunk-J2ZIFFM6.js";import"./chunk-RF7HWBHN.js";import"./chunk-3Y2ROSCL.js";import"./chunk-ZAKQLAHT.js";import{Command as Q}from"commander";import e from"chalk";var $={low:{minRisk:.7,maxGaps:10,description:"Only critical gaps with high risk scores"},medium:{minRisk:.5,maxGaps:20,description:"Moderate gaps including medium risk items"},high:{minRisk:.3,maxGaps:50,description:"All gaps including low risk items"}},W=class extends V{constructor(t={}){super(t)}getTitle(){return"Coverage Analysis Wizard"}getSubtitle(){return"Analyze code coverage with O(log n) gap detection"}getConfirmationPrompt(){return"Proceed with coverage analysis?"}isNonInteractive(){return this.options.nonInteractive??!1}getCommands(){return[new U({id:"target",stepNumber:"1/7",title:"Target Directory",description:"Enter the directory or file to analyze for coverage",examples:"src/, ./lib, coverage/lcov.info",defaultValue:this.options.defaultTarget||".",suggestionsProvider:A.getCoverageTargets,validatePath:!0}),new E({id:"sensitivity",stepNumber:"2/7",title:"Gap Detection Sensitivity",description:"Select how sensitive the gap detection should be",options:[{key:"1",value:"low",label:"low",description:$.low.description},{key:"2",value:"medium",label:"medium",description:$.medium.description},{key:"3",value:"high",label:"high",description:$.high.description}],defaultValue:this.options.defaultSensitivity||"medium",validValues:["low","medium","high"]}),new E({id:"format",stepNumber:"3/7",title:"Report Format",description:"Select the output format for the coverage report",options:[{key:"1",value:"json",label:"json",description:"JSON - Machine-readable, good for CI/CD pipelines"},{key:"2",value:"html",label:"html",description:"HTML - Interactive, visual report with charts"},{key:"3",value:"markdown",label:"markdown",description:"Markdown - Documentation-friendly format"},{key:"4",value:"text",label:"text",description:"Text - Simple console output"}],defaultValue:this.options.defaultFormat||"json",validValues:["json","html","markdown","text"]}),new O({id:"priorityFocus",stepNumber:"4/7",title:"Priority Focus Areas",description:"Select coverage metrics to prioritize (comma-separated or numbers)",instructions:"Example: 1,2 or functions,branches",options:[{key:"1",value:"functions",label:"functions",description:"Functions - Focus on function coverage"},{key:"2",value:"branches",label:"branches",description:"Branches - Focus on branch/decision coverage"},{key:"3",value:"lines",label:"lines",description:"Lines - Focus on line coverage"},{key:"4",value:"statements",label:"statements",description:"Statements - Focus on statement coverage"}],defaultValue:this.options.defaultPriorityFocus||["functions","branches"],validValues:["functions","branches","lines","statements"]}),new L({id:"riskScoring",stepNumber:"5/7",title:"Enable risk scoring",description:"Enable risk scoring to prioritize coverage gaps by potential impact",additionalInfo:"Risk scores consider code complexity, change frequency, and criticality",defaultValue:this.options.defaultRiskScoring??!0}),new M({id:"threshold",stepNumber:"6/7",title:"Coverage threshold %",description:"Set the minimum coverage percentage required. Files below this threshold will be flagged.",presets:[{key:"1",value:60,label:"60% - Legacy/maintenance projects"},{key:"2",value:70,label:"70% - Standard projects"},{key:"3",value:80,label:"80% - Quality-focused projects"},{key:"4",value:90,label:"90% - Critical/high-reliability projects"}],defaultValue:this.options.defaultThreshold||80,min:0,max:100}),new B({id:"patterns",stepNumber:"7/7",title:"File Patterns (Optional)",description:"Specify patterns to include or exclude from analysis. Leave blank to analyze all files."})]}buildResult(t){let f=t.patterns;return{target:t.target,sensitivity:t.sensitivity,format:t.format,priorityFocus:t.priorityFocus,riskScoring:t.riskScoring,threshold:t.threshold,includePatterns:f?.include,excludePatterns:f?.exclude,cancelled:!1}}printSummary(t){d.printSummaryHeader();let f=x.relativePath(t.target,this.cwd);d.printSummaryField("Target",f),d.printSummaryField("Sensitivity",t.sensitivity),d.printSummaryField("Report Format",t.format),d.printSummaryField("Priority Focus",t.priorityFocus.join(", ")),d.printSummaryField("Risk Scoring",x.enabledDisabled(t.riskScoring)),d.printSummaryField("Threshold",x.percentage(t.threshold)),t.includePatterns&&t.includePatterns.length>0&&d.printSummaryField("Include",t.includePatterns.join(", ")),t.excludePatterns&&t.excludePatterns.length>0&&d.printSummaryField("Exclude",t.excludePatterns.join(", "));let b=$[t.sensitivity];d.printDerivedSettings({"Min risk score":String(b.minRisk),"Max gaps shown":String(b.maxGaps)})}getDefaults(){return{target:this.options.defaultTarget||this.cwd,sensitivity:this.options.defaultSensitivity||"medium",format:this.options.defaultFormat||"json",priorityFocus:this.options.defaultPriorityFocus||["functions","branches"],riskScoring:this.options.defaultRiskScoring??!0,threshold:this.options.defaultThreshold||80,cancelled:!1}}getCancelled(){return{target:".",sensitivity:"medium",format:"json",priorityFocus:["functions","branches"],riskScoring:!0,threshold:80,cancelled:!0}}};async function J(h={}){return new W(h).run()}import*as H from"path";function Y(h){return h>=80?e.green:h>=50?e.yellow:e.red}function ae(h,t,f){let b=new Q("coverage").description("Coverage analysis shortcut").argument("[target]","Target file or directory",".").option("--risk","Include risk scoring").option("--gaps","Detect coverage gaps").option("--threshold <percent>","Coverage threshold percentage","80").option("--sensitivity <level>","Gap detection sensitivity (low|medium|high)","medium").option("--wizard","Run interactive coverage analysis wizard").option("--ghost","Include ghost intent coverage analysis (detect untested behavioral intents)").option("-F, --format <format>","Output format (text|json|markdown)","text").option("-o, --output <path>","Write output to file").addHelpText("after",`
|
|
3
|
-
Target: a directory, a source file, or an existing coverage report
|
|
4
|
-
(lcov.info, coverage-final.json, coverage-summary.json, Cobertura XML).
|
|
5
|
-
Reports are read from the target's project root (nearest package.json / .git).
|
|
6
|
-
|
|
7
|
-
Threshold: judged on the metrics the report actually collected. A metric with
|
|
8
|
-
no data (e.g. a report without branch data) is shown as n/a and is excluded
|
|
9
|
-
from the threshold, not counted as 0%.
|
|
10
|
-
|
|
11
|
-
Exit codes:
|
|
12
|
-
0 coverage meets the threshold (by more than 5%)
|
|
13
|
-
1 coverage below the threshold, or an error (missing target, unreadable report)
|
|
14
|
-
2 coverage within 5% above the threshold
|
|
15
|
-
${I} UNMEASURED: no coverage measurement exists for the target
|
|
16
|
-
(not in the report, the runner ran 0 tests, or only test files were reported),
|
|
17
|
-
or NO coverage report exists, so only a labelled static estimate was shown
|
|
18
|
-
(-F json: measured:false, estimated:true; no threshold verdict)
|
|
19
|
-
|
|
20
|
-
In \`aqe ci\`, an UNMEASURED coverage phase is a warning (phase exit code 3); it
|
|
21
|
-
does not fail the pipeline by itself. An enforced quality gate fails on
|
|
22
|
-
missing coverage evidence.`).action(async(y,a)=>{let g=y,w=a.risk,k=a.gaps,l=parseInt(a.threshold,10);if(a.wizard)try{let s=await J({defaultTarget:y!=="."?y:void 0,defaultThreshold:a.threshold!=="80"?parseInt(a.threshold,10):void 0,defaultRiskScoring:a.risk,defaultSensitivity:a.sensitivity!=="medium"?a.sensitivity:void 0});s.cancelled&&(console.log(e.yellow(`
|
|
23
|
-
Coverage analysis cancelled.
|
|
24
|
-
`)),await t(0)),g=s.target,w=s.riskScoring,k=!0,l=s.threshold,console.log(e.green(`
|
|
25
|
-
Starting coverage analysis...
|
|
26
|
-
`))}catch(s){console.error(e.red(`
|
|
27
|
-
Wizard error:`),s),await t(1)}let z=a.format!=="text",R=console.log;z&&(console.log=(...s)=>console.error(...s));let m=s=>{console.log=R,G(s,a.output)};try{if(!await f())return;try{console.log(e.blue(`
|
|
28
|
-
Analyzing coverage for ${g}...
|
|
29
|
-
`));let s=await h.kernel.getDomainAPIAsync("coverage-analysis");if(!s){console.log(e.red("Coverage analysis domain not available"));return}let u=H.resolve(g),r=await q(s,u,l),v=a.format;if(r.kind==="no-sources"){console.log(e.yellow("No source files found"));return}if(r.kind==="error"||r.kind==="unmeasured"||r.kind==="analysis-failed"){v==="json"?m(T(j(r,l,u))):console.log((r.kind==="unmeasured"?e.yellow:e.red)(` ${r.message}
|
|
30
|
-
`)),await t(N(r,l));return}let S=r.data,C=r.kind==="estimate";C?(console.log(e.yellow(" No coverage report found \u2014 showing a heuristic STATIC ESTIMATE (UNMEASURED)")),console.log(e.gray(` Run tests with coverage first: npm test -- --coverage
|
|
31
|
-
`))):(console.log(e.green(` Using instrumented coverage data (V8/istanbul)
|
|
32
|
-
`)),S.unmeasuredFiles?.length&&console.log(e.yellow(` ${S.unmeasuredFiles.length} file(s) not in the coverage report \u2014 UNMEASURED, excluded from the figures
|
|
33
|
-
`)));let P=j(r,l,u),p=r.summary;if(v==="text"){let c=i=>i===null?"n/a (not collected)":(C?"~":"")+i.toFixed(1)+"%",n=i=>i===null||C?e.gray:Y(i);if(console.log(e.cyan(C?" Coverage Summary (STATIC ESTIMATE \u2014 not measured):":" Coverage Summary:")),console.log(` Lines: ${n(p.line)(c(p.line))}`),console.log(` Branches: ${n(p.branch)(c(p.branch))}`),console.log(` Functions: ${n(p.function)(c(p.function))}`),console.log(` Statements: ${n(p.statement)(c(p.statement))}`),r.kind==="measured"&&r.insufficientEvidence.length>0){console.log(`
|
|
34
|
-
Threshold: ${e.red(`Not met (${l}%) \u2014 INSUFFICIENT EVIDENCE`)}`);for(let i of r.insufficientEvidence)console.log(e.yellow(` - ${i}`))}else r.kind==="measured"?console.log(`
|
|
35
|
-
Threshold: ${r.verdict.meetsThreshold?e.green(`Met (${l}%)`):e.red(`Not met (${l}%)`)}`):(console.log(`
|
|
36
|
-
Threshold: ${e.yellow(`not evaluated (${l}%) \u2014 UNMEASURED, estimate only`)}`),console.log(e.gray(` ${r.message}`)));let o=r.kind==="measured"?r.recommendations:[];if(o.length>0){console.log(e.cyan(`
|
|
37
|
-
Recommendations:`));for(let i of o)console.log(e.gray(` - ${i}`))}}if(k){console.log(e.cyan(`
|
|
38
|
-
Coverage Gaps:`));let c=await s.detectGaps({coverageData:S,minCoverage:l,prioritize:w?"risk":"size",measured:!C});if(c.success&&c.value){let n=c.value;P.gaps=n.gaps.map(o=>({file:o.file.replace(process.cwd()+"/",""),lines:o.lines,riskScore:o.riskScore,severity:o.severity})),console.log(e.gray(` Total uncovered lines: ${n.totalUncoveredLines}`)),console.log(e.gray(` Estimated effort: ${n.estimatedEffort} hours
|
|
39
|
-
`));for(let o of n.gaps.slice(0,8)){let i=o.severity==="high"?e.red:o.severity==="medium"?e.yellow:e.gray,F=o.file.replace(process.cwd()+"/","");console.log(` ${i(`[${o.severity}]`)} ${e.white(F)}`),console.log(e.gray(` ${o.lines.length} uncovered lines, Risk: ${(o.riskScore*100).toFixed(0)}%`))}n.gaps.length>8&&console.log(e.gray(` ... and ${n.gaps.length-8} more gaps`))}}if(a.ghost||k){console.log(e.cyan(`
|
|
40
|
-
Ghost Intent Coverage (ADR-059):`));try{let c=S.files.map(o=>o.path),n=await s.analyzeGhostCoverage(c,g);if(n.success&&n.value){let o=n.value;console.log(e.gray(` Phantom gaps detected: ${o.gaps.length}`)),console.log(e.gray(` Ghost score: ${(o.totalGhostScore*100).toFixed(1)}%`)),console.log(e.gray(` Coverage completeness: ${(o.coverageCompleteness*100).toFixed(1)}%
|
|
41
|
-
`));for(let i of o.gaps.slice(0,8)){let F=i.severity==="critical"?e.red:i.severity==="high"?e.red:i.severity==="medium"?e.yellow:e.gray;console.log(` ${F(`[${i.severity}]`)} ${e.white(i.category)}`),console.log(e.gray(` ${i.description}`))}o.gaps.length>8&&console.log(e.gray(` ... and ${o.gaps.length-8} more phantom gaps`))}else console.log(e.dim(" Ghost analysis not available (requires HNSW index)"))}catch{console.log(e.dim(" Ghost analysis skipped (analyzer not initialized)"))}}if(w){console.log(e.cyan(`
|
|
42
|
-
Risk Analysis:`));let c=[...S.files].sort((n,o)=>n.lines.covered/n.lines.total-o.lines.covered/o.lines.total).slice(0,5);for(let n of c){let o=await s.calculateRisk({file:n.path,uncoveredLines:n.uncoveredLines});if(o.success&&o.value){let i=o.value,F=i.riskLevel==="high"?e.red:i.riskLevel==="medium"?e.yellow:e.green,X=n.path.replace(process.cwd()+"/","");console.log(` ${F(`[${i.riskLevel}]`)} ${e.white(X)}`),console.log(e.gray(` Risk: ${(i.overallRisk*100).toFixed(0)}%, Coverage: ${Math.round(n.lines.covered/n.lines.total*100)}%`))}}}v==="json"?m(T(P)):v==="markdown"?m(D(P)):v==="text"&&console.log(e.green(`
|
|
43
|
-
Coverage analysis complete
|
|
44
|
-
`)),await t(N(r,l))}catch(s){console.error(e.red(`
|
|
45
|
-
Failed:`),s),await t(1)}}finally{console.log=R}});return b.command("gaps").description("Enumerate unhandled branches in source files").argument("<file>","Source file to analyze").option("--mechanical","Exhaustive mode: report all branches without filtering").option("--json","Output as JSON").option("--markdown","Output as markdown report").action(async(y,a)=>{try{let{readFileSync:g,existsSync:w}=await import("fs"),k=await import("path"),{enumerateBranches:l,formatBranchReport:z,formatBranchJSON:R}=await import("./branch-enumerator-5CLULOCU.js"),m=k.resolve(y);w(m)||(console.error(e.red(`
|
|
46
|
-
File not found: ${m}
|
|
47
|
-
`)),await t(1));let s=g(m,"utf-8"),u=l(s,m);if(a.json)console.log(R(u));else if(a.markdown)console.log(z(u));else{if(console.log(`
|
|
48
|
-
${e.cyan("Branch Enumeration:")} ${e.white(y)}`),console.log(e.gray(`Found ${u.unhandledCount} unhandled branches (${u.duration}ms)
|
|
49
|
-
`)),u.branches.length>0){console.log(e.dim("Line | Severity | Construct | Trigger")),console.log(e.dim("-----|----------|---------------------------|--------"));for(let r of u.branches){let v=r.severity==="high"?e.red:r.severity==="medium"?e.yellow:e.gray;console.log(`${String(r.line).padStart(4)} | ${v(r.severity.padEnd(8))} | ${r.construct.padEnd(25)} | ${r.triggerCondition}`)}}else console.log(e.green("No unhandled branches detected."));console.log("")}await t(0)}catch(g){console.error(e.red(`
|
|
50
|
-
Branch enumeration failed:`),g),await t(1)}}),b}export{I as EXIT_UNMEASURED,ae as createCoverageCommand,_ as resolveCliCoverageData};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.13");process.exit(0)}
|
|
2
|
-
import{a,b}from"./chunk-SG3NX7QE.js";import"./chunk-UDQSYWVF.js";import"./chunk-H4H2YSFH.js";import"./chunk-NURIILUB.js";import"./chunk-ZAKQLAHT.js";export{a as CrossDomainEventRouter,b as createCrossDomainRouter};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.13");process.exit(0)}
|
|
2
|
-
import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,q as p,r as q,s as r,t as s,u as t,v as u,w as v,x as w,y as x,z as y}from"./chunk-C6JTLKG7.js";import"./chunk-N4CYAKOX.js";import"./chunk-3AN5TNGD.js";import"./chunk-3YNLWPBF.js";import"./chunk-72ASBE35.js";import"./chunk-TSQC2KKZ.js";import"./chunk-SYV2V3PL.js";import"./chunk-NZD4DPSU.js";import"./chunk-E7CLYGS7.js";import"./chunk-GU5HNCWI.js";import"./chunk-5VMAV6T6.js";import"./chunk-TWJTK4CC.js";import"./chunk-GHM6MQNK.js";import"./chunk-XEAEYC6Y.js";import"./chunk-QDEJ4CI2.js";import"./chunk-T3PGQFDI.js";import"./chunk-VRVMIPTM.js";import"./chunk-4OVC4RIL.js";import"./chunk-UTRV7T2N.js";import"./chunk-3Y7TJFHU.js";import"./chunk-7CMTY45A.js";import"./chunk-VTOBUZL6.js";import"./chunk-KDNJ4F3P.js";import"./chunk-JRRXCODW.js";import"./chunk-XNBOGCF3.js";import"./chunk-KV4T4MXK.js";import"./chunk-TWDW32W2.js";import"./chunk-AQSVJNEH.js";import"./chunk-OCAEXYFA.js";import"./chunk-WKGTGOYS.js";import"./chunk-DVGRPK7A.js";import"./chunk-H4H2YSFH.js";import"./chunk-NURIILUB.js";import"./chunk-TOQWL2ZF.js";import"./chunk-UT2VZ33P.js";import"./chunk-GB6HBNH2.js";import"./chunk-UOC3O6RP.js";import"./chunk-NT4DBXSX.js";import"./chunk-WOCGL4QP.js";import"./chunk-W2QWSQVE.js";import"./chunk-J2ZIFFM6.js";import"./chunk-RF7HWBHN.js";import"./chunk-IC3TQEOA.js";import"./chunk-HD7YIFOI.js";import"./chunk-DNDL7SOS.js";import"./chunk-3Y2ROSCL.js";import"./chunk-WO274FRI.js";import"./chunk-ZAKQLAHT.js";export{q as ABANDONED_CYCLE_GRACE_MS,x as BUILT_IN_STRATEGIES,e as ConceptGraph,j as DEFAULT_ACTIVATION_CONFIG,d as DEFAULT_CONCEPT_GRAPH_CONFIG,s as DEFAULT_DREAM_CONFIG,a as DEFAULT_DREAM_SCHEDULER_CONFIG,l as DEFAULT_INSIGHT_CONFIG,n as DEFAULT_VALIDATION_THRESHOLDS,t as DreamAlreadyRunningError,u as DreamEngine,b as DreamScheduler,i as HISTORY_TRIM_TARGET_RATIO,m as InsightGenerator,g as MAX_ACTIVATION_HISTORY_ENTRIES,h as MAX_COACTIVATION_ENTRIES,o as RVCOWBranchManager,y as SpeculativeDreamer,k as SpreadingActivation,p as commitDream,f as createConceptGraph,v as createDreamEngine,c as createDreamScheduler,w as default,r as markAbandonedCycles};
|