agentic-qe 3.15.7 → 3.15.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/skills-manifest.json +1 -1
- package/CHANGELOG.md +305 -0
- package/assets/skills/skills-manifest.json +1 -1
- package/dist/agents/claim-verifier/claim-verifier-service.js +13 -8
- package/dist/bridge/captured-experience-bridge.js +12 -13
- package/dist/cli/bundle.js +6 -6
- package/dist/cli/chunks/adapter-R2Q4QGXQ.js +2 -0
- package/dist/cli/chunks/{agent-booster-wasm-OS5G7KMQ.js → agent-booster-wasm-427FRKWG.js} +2 -2
- package/dist/cli/chunks/{agent-handler-PI4I7PME.js → agent-handler-RIYHTHVZ.js} +2 -2
- package/dist/cli/chunks/{agent-memory-branch-J7TXHX4U.js → agent-memory-branch-WSUCUHOO.js} +2 -2
- package/dist/cli/chunks/aqe-learning-engine-3RENLQWP.js +2 -0
- package/dist/cli/chunks/{arena-OWUGXKNT.js → arena-KRIBMIXX.js} +2 -2
- package/dist/cli/chunks/{arena-FXESDCFR.js → arena-YAJZX6MC.js} +4 -4
- package/dist/cli/chunks/{audit-EPAWLYIZ.js → audit-7ZNOXWP3.js} +3 -3
- package/dist/cli/chunks/base-67DXSAYM.js +2 -0
- package/dist/cli/chunks/{better-sqlite3-IYVR5EQY.js → better-sqlite3-ZQAT4I6H.js} +2 -2
- package/dist/cli/chunks/{brain-handler-3W2E6TC6.js → brain-handler-452WCPZC.js} +3 -3
- package/dist/cli/chunks/{branch-enumerator-HU7VACJ4.js → branch-enumerator-IJFXJRPN.js} +2 -2
- package/dist/cli/chunks/{browser-72XOR6E2.js → browser-CT3MTV6G.js} +2 -2
- package/dist/cli/chunks/browser-workflow-NDXRROWZ.js +2 -0
- package/dist/cli/chunks/{chunk-WXI2STKQ.js → chunk-2BA45H64.js} +2 -2
- package/dist/cli/chunks/{chunk-DGK6GQMO.js → chunk-2HL3UM5P.js} +2 -2
- package/dist/cli/chunks/{chunk-LGBN7TKC.js → chunk-2I2UPJS7.js} +2 -2
- package/dist/cli/chunks/{chunk-ZRLNACPY.js → chunk-2TDIS6YK.js} +2 -2
- package/dist/cli/chunks/{chunk-34JLY3U6.js → chunk-2URBI52G.js} +2 -2
- package/dist/cli/chunks/{chunk-K7W55B7Q.js → chunk-2XITOPYV.js} +2 -2
- package/dist/cli/chunks/{chunk-I7H4IP7T.js → chunk-2YH62JCN.js} +2 -2
- package/dist/cli/chunks/{chunk-HPG7354V.js → chunk-32UTLDNY.js} +2 -2
- package/dist/cli/chunks/{chunk-C2CUPJGR.js → chunk-37BIGMJI.js} +1 -1
- package/dist/cli/chunks/{chunk-2RJYA6WK.js → chunk-3CJCROMW.js} +2 -2
- package/dist/cli/chunks/{chunk-CWPRU7ZI.js → chunk-3LYU7BLY.js} +2 -2
- package/dist/cli/chunks/{chunk-24CENUT4.js → chunk-47TYABPD.js} +3 -3
- package/dist/cli/chunks/{chunk-WUV5RZUI.js → chunk-47V7FQGX.js} +2 -2
- package/dist/cli/chunks/{chunk-IWQQIXHO.js → chunk-4JCY45KV.js} +2 -2
- package/dist/cli/chunks/{chunk-ZTMZFF25.js → chunk-4SUOVLJ6.js} +2 -2
- package/dist/cli/chunks/{chunk-CIFWOMNX.js → chunk-4URT6JO2.js} +1 -1
- package/dist/cli/chunks/{chunk-5Q22XPTH.js → chunk-4V27J6YN.js} +2 -2
- package/dist/cli/chunks/{chunk-SX2YSHE7.js → chunk-4W4DYVSH.js} +1 -1
- package/dist/cli/chunks/chunk-55HRSNGN.js +2 -0
- package/dist/cli/chunks/{chunk-F62EKVVC.js → chunk-5D2I7JUP.js} +2 -2
- package/dist/cli/chunks/{chunk-XXAVQACL.js → chunk-5JWGCIQW.js} +1 -1
- package/dist/cli/chunks/chunk-5LAAZLUC.js +4 -0
- package/dist/cli/chunks/{chunk-EDU72RTW.js → chunk-5NS3USRW.js} +1 -1
- package/dist/cli/chunks/{chunk-BTYKGVJ5.js → chunk-6EPHNJTL.js} +1 -1
- package/dist/cli/chunks/{chunk-JVYPXW6Y.js → chunk-6OOYIO3W.js} +2 -2
- package/dist/cli/chunks/{chunk-PG64YV6C.js → chunk-6PXA2BQJ.js} +58 -58
- package/dist/cli/chunks/{chunk-IARSGAG7.js → chunk-6YL6JOQB.js} +2 -2
- package/dist/cli/chunks/{chunk-LDXQRNTT.js → chunk-72AMFDC7.js} +1 -1
- package/dist/cli/chunks/{chunk-Z3VJLWRR.js → chunk-763SUL4B.js} +2 -2
- package/dist/cli/chunks/{chunk-EL75G2A3.js → chunk-7DMA5NYL.js} +1 -1
- package/dist/cli/chunks/{chunk-J43DV3ME.js → chunk-7JKB3Q7O.js} +1 -1
- package/dist/cli/chunks/{chunk-ONVALAZN.js → chunk-7KII4CQG.js} +2 -2
- package/dist/cli/chunks/{chunk-AAA4SHEG.js → chunk-7QGYJ5OY.js} +1 -1
- package/dist/cli/chunks/{chunk-MMXG3LL6.js → chunk-7QTB5VJZ.js} +2 -2
- package/dist/cli/chunks/{chunk-BB7OLQKO.js → chunk-7X2Y727E.js} +1 -1
- package/dist/cli/chunks/{chunk-VNW5Q2CX.js → chunk-A4RU67VX.js} +2 -2
- package/dist/cli/chunks/{chunk-YFOBQSOW.js → chunk-A6YIH4C4.js} +2 -2
- package/dist/cli/chunks/{chunk-MJJC6HUK.js → chunk-ABFDB4X3.js} +1 -1
- package/dist/cli/chunks/{chunk-MHZPC4HJ.js → chunk-AJ4YDSOI.js} +2 -2
- package/dist/cli/chunks/{chunk-OA4GR3EZ.js → chunk-AOFO4N32.js} +2 -2
- package/dist/cli/chunks/{chunk-EB2PP6X2.js → chunk-AQTVVLNP.js} +1 -1
- package/dist/cli/chunks/chunk-AR2E4B7K.js +6 -0
- package/dist/cli/chunks/{chunk-N4PMPSJJ.js → chunk-AVB5QY2Q.js} +2 -2
- package/dist/cli/chunks/{chunk-HLZATDD2.js → chunk-BHKXMIWX.js} +2 -2
- package/dist/cli/chunks/{chunk-C2MDBBFF.js → chunk-BXO536GT.js} +3 -3
- package/dist/cli/chunks/{chunk-WTLIEBDH.js → chunk-C6RTMTEH.js} +1 -1
- package/dist/cli/chunks/{chunk-MNZFEIE5.js → chunk-CTZJUV5I.js} +1 -1
- package/dist/cli/chunks/{chunk-XEWXYGJI.js → chunk-D6XVGFTI.js} +2 -2
- package/dist/cli/chunks/{chunk-Y4SAWE45.js → chunk-DDPPSSHW.js} +1 -1
- package/dist/cli/chunks/{chunk-KPOPBUUJ.js → chunk-DGTLJNJH.js} +2 -2
- package/dist/cli/chunks/{chunk-6JT73S5B.js → chunk-DINZR5CF.js} +1 -1
- package/dist/cli/chunks/{chunk-HTWIGQL4.js → chunk-EFBLP43U.js} +2 -2
- package/dist/cli/chunks/chunk-ETG7O5E5.js +5 -0
- package/dist/cli/chunks/{chunk-2AYBYXOA.js → chunk-F2SQPP6U.js} +2 -2
- package/dist/cli/chunks/{chunk-V2SAEMZY.js → chunk-F3PQZX44.js} +1 -1
- package/dist/cli/chunks/{chunk-JPHDMHFG.js → chunk-F4JYIRW2.js} +2 -2
- package/dist/cli/chunks/{chunk-REEIFA6A.js → chunk-FJ4VTLLK.js} +2 -2
- package/dist/cli/chunks/{chunk-PTK66HEY.js → chunk-FL3OYGCS.js} +2 -2
- package/dist/cli/chunks/{chunk-PEKDSJBC.js → chunk-FLASM2XB.js} +2 -2
- package/dist/cli/chunks/{chunk-G762PEFO.js → chunk-FV3NHVC7.js} +22 -22
- package/dist/cli/chunks/{chunk-FTTFJ7SJ.js → chunk-FV7VAG74.js} +1 -1
- package/dist/cli/chunks/{chunk-2YVJ5OUL.js → chunk-G3BKZNFL.js} +8 -8
- package/dist/cli/chunks/{chunk-MDC4G323.js → chunk-GBUIG3FS.js} +1 -1
- package/dist/cli/chunks/{chunk-DCJW2DPL.js → chunk-GCWSX2NY.js} +4 -4
- package/dist/cli/chunks/{chunk-VCA6YYII.js → chunk-GII5WVAK.js} +1 -1
- package/dist/cli/chunks/{chunk-HXBAQKMH.js → chunk-GKPQ2GRR.js} +2 -2
- package/dist/cli/chunks/chunk-GR3JYE5A.js +2 -0
- package/dist/cli/chunks/{chunk-ZUMDDMDE.js → chunk-H3KBIWTO.js} +2 -2
- package/dist/cli/chunks/{chunk-ECSLJJOQ.js → chunk-HAROIAJE.js} +1 -1
- package/dist/cli/chunks/{chunk-ICPALF4Q.js → chunk-HCYQHWI2.js} +2 -2
- package/dist/cli/chunks/{chunk-V5NGBQAQ.js → chunk-HGTWAZWU.js} +2 -2
- package/dist/cli/chunks/{chunk-YK3NOC2R.js → chunk-HTZJSQ3C.js} +2 -2
- package/dist/cli/chunks/{chunk-IYQ7XNE5.js → chunk-HWK5L7IJ.js} +2 -2
- package/dist/cli/chunks/{chunk-HSDOOFV7.js → chunk-HZ5NC6U5.js} +1 -1
- package/dist/cli/chunks/{chunk-M63QB466.js → chunk-I6S35FRO.js} +2 -2
- package/dist/cli/chunks/{chunk-LMEU64TR.js → chunk-ICP2ORGI.js} +2 -2
- package/dist/cli/chunks/{chunk-PXZKPUW6.js → chunk-IFEIY3NQ.js} +2 -2
- package/dist/cli/chunks/{chunk-OJEZNLB6.js → chunk-J3DTDJDT.js} +2 -2
- package/dist/cli/chunks/chunk-J3WGK22W.js +2 -0
- package/dist/cli/chunks/{chunk-SQHLC6I5.js → chunk-J5KNRVXR.js} +1 -1
- package/dist/cli/chunks/{chunk-RORZ5O5Z.js → chunk-JAV5WPSY.js} +2 -2
- package/dist/cli/chunks/{chunk-SSP2B2WR.js → chunk-JEP4ULR6.js} +2 -2
- package/dist/cli/chunks/{chunk-6FEQ73BF.js → chunk-JK2ME6IT.js} +2 -2
- package/dist/cli/chunks/chunk-JNNZK7KH.js +2 -0
- package/dist/cli/chunks/{chunk-RXAFLK34.js → chunk-JP4P3P3D.js} +2 -2
- package/dist/cli/chunks/{chunk-JY4AIEZ7.js → chunk-JUVHZG7I.js} +1 -1
- package/dist/cli/chunks/{chunk-UBYCR3O4.js → chunk-JWGRWMZP.js} +2 -2
- package/dist/cli/chunks/{chunk-6BO3WCK7.js → chunk-K5DJXMAA.js} +2 -2
- package/dist/cli/chunks/{chunk-MKFQNCXI.js → chunk-KFUUIAR4.js} +2 -2
- package/dist/cli/chunks/chunk-KHSRIPBP.js +180 -0
- package/dist/cli/chunks/{chunk-UY3REQOK.js → chunk-KIKWJM6J.js} +2 -2
- package/dist/cli/chunks/{chunk-YUC7RJGR.js → chunk-KIXYKUCI.js} +1 -1
- package/dist/cli/chunks/{chunk-IC2WSSD5.js → chunk-KLGYIEJK.js} +3 -3
- package/dist/cli/chunks/{chunk-DVPGBDBP.js → chunk-KR3M44CF.js} +3 -3
- package/dist/cli/chunks/chunk-KTSLTZSG.js +2 -0
- package/dist/cli/chunks/{chunk-Y6A46M3B.js → chunk-KVBEGOJE.js} +2 -2
- package/dist/cli/chunks/{chunk-PZG3542B.js → chunk-L42JPFCC.js} +2 -2
- package/dist/cli/chunks/{chunk-J26GADQE.js → chunk-LCJTEUDC.js} +181 -181
- package/dist/cli/chunks/{chunk-3JD2USUH.js → chunk-LEAKYZ37.js} +2 -2
- package/dist/cli/chunks/{chunk-UCLN6AME.js → chunk-LMU5DUDK.js} +1 -1
- package/dist/cli/chunks/{chunk-EV2BYY6T.js → chunk-MZS32SYS.js} +1 -1
- package/dist/cli/chunks/{chunk-LVEX4GID.js → chunk-N3KEY4XJ.js} +2 -2
- package/dist/cli/chunks/{chunk-XNSQZ3O7.js → chunk-N3NP6PTT.js} +2 -2
- package/dist/cli/chunks/{chunk-QVG4ZDXX.js → chunk-N5PDFGCQ.js} +2 -2
- package/dist/cli/chunks/{chunk-6PKCQXEW.js → chunk-NDKLQW6N.js} +2 -2
- package/dist/cli/chunks/{chunk-6AYRAOCA.js → chunk-NHZIWIQZ.js} +2 -2
- package/dist/cli/chunks/{chunk-H4WHDFB5.js → chunk-NTAD5UX4.js} +2 -2
- package/dist/cli/chunks/{chunk-JYXOFN3E.js → chunk-O3JLOVZX.js} +2 -2
- package/dist/cli/chunks/{chunk-ZLVQSEZK.js → chunk-OCESWNAZ.js} +3 -3
- package/dist/cli/chunks/{chunk-7EX4DEQR.js → chunk-OG2UI6A3.js} +2 -2
- package/dist/cli/chunks/{chunk-3RM46XFP.js → chunk-OXTFSIGN.js} +1 -1
- package/dist/cli/chunks/{chunk-44DPYNPE.js → chunk-OXZLKP6C.js} +1 -1
- package/dist/cli/chunks/{chunk-TU4LIIOP.js → chunk-P2CXVNKK.js} +2 -2
- package/dist/cli/chunks/{chunk-LDZWIV2O.js → chunk-P73W2K7T.js} +1 -1
- package/dist/cli/chunks/{chunk-56ZKQYZY.js → chunk-PBZI2ZPV.js} +3 -3
- package/dist/cli/chunks/{chunk-MNCF643K.js → chunk-PMCRCEW5.js} +2 -2
- package/dist/cli/chunks/{chunk-4G2VNW4C.js → chunk-PVIA2FPD.js} +2 -2
- package/dist/cli/chunks/{chunk-MRHM4COP.js → chunk-PX2B5TS2.js} +2 -2
- package/dist/cli/chunks/{chunk-HZFT3P5B.js → chunk-Q3JVJRVJ.js} +1 -1
- package/dist/cli/chunks/{chunk-GY2SAIXP.js → chunk-QQ5SZH4D.js} +2 -2
- package/dist/cli/chunks/{chunk-LP4AS2E4.js → chunk-QTVWUQTB.js} +1 -1
- package/dist/cli/chunks/{chunk-W4X2VTIY.js → chunk-REUFWGMA.js} +2 -2
- package/dist/cli/chunks/{chunk-FVBFASOD.js → chunk-SNBYYO6F.js} +2 -2
- package/dist/cli/chunks/{chunk-RNYX4CPI.js → chunk-SVHUYVUR.js} +2 -2
- package/dist/cli/chunks/{chunk-AXO7OOOA.js → chunk-THAY7WHO.js} +2 -2
- package/dist/cli/chunks/{chunk-QWLTHFZW.js → chunk-TNMQVG4A.js} +2 -2
- package/dist/cli/chunks/{chunk-JFPXCQNP.js → chunk-TSYQDRNK.js} +1 -1
- package/dist/cli/chunks/{chunk-JK6B3ULP.js → chunk-TUYJ53V4.js} +2 -2
- package/dist/cli/chunks/{chunk-PUECC4WI.js → chunk-UNUTC6TX.js} +2 -2
- package/dist/cli/chunks/{chunk-ED32XJ5R.js → chunk-UOJBR4J3.js} +2 -2
- package/dist/cli/chunks/{chunk-CXTJ47QS.js → chunk-UOWHE77F.js} +2 -2
- package/dist/cli/chunks/{chunk-5KCBX225.js → chunk-UYLYMWV5.js} +2 -2
- package/dist/cli/chunks/{chunk-QNQSM2OG.js → chunk-V5PXQSFS.js} +2 -2
- package/dist/cli/chunks/{chunk-VKPKYMCT.js → chunk-VCMINU7K.js} +2 -2
- package/dist/cli/chunks/{chunk-QQT6QENQ.js → chunk-VQHVHVSF.js} +2 -2
- package/dist/cli/chunks/{chunk-634D2ENF.js → chunk-VRGCKBF7.js} +2 -2
- package/dist/cli/chunks/{chunk-T6W5APYP.js → chunk-VU2EL424.js} +1 -1
- package/dist/cli/chunks/{chunk-JY4WLN3K.js → chunk-VXZJOKOX.js} +2 -2
- package/dist/cli/chunks/{chunk-NZQPP533.js → chunk-VYLM2YV5.js} +3 -3
- package/dist/cli/chunks/{chunk-PQV7E7XH.js → chunk-W32YU3VI.js} +2 -2
- package/dist/cli/chunks/{chunk-RRPYWBFX.js → chunk-W5VJRDDG.js} +2 -2
- package/dist/cli/chunks/{chunk-7UCVYYWL.js → chunk-WGDR2KIR.js} +2 -2
- package/dist/cli/chunks/{chunk-2423JAA5.js → chunk-WRRCQ2UE.js} +1 -1
- package/dist/cli/chunks/{chunk-RCYLCA7E.js → chunk-XDBD4GXO.js} +2 -2
- package/dist/cli/chunks/{chunk-PYHYOKYT.js → chunk-XOLDMK23.js} +2 -2
- package/dist/cli/chunks/{chunk-5KS7HA37.js → chunk-XOVNZT7F.js} +1 -1
- package/dist/cli/chunks/{chunk-5PBRBS7D.js → chunk-XQ3DDY7X.js} +2 -2
- package/dist/cli/chunks/{chunk-4DIZ5BT6.js → chunk-XUIA5KMS.js} +2 -2
- package/dist/cli/chunks/{chunk-G7YTZTGU.js → chunk-XWIUFYM3.js} +1 -1
- package/dist/cli/chunks/{chunk-B7M323VL.js → chunk-XYCKHYBM.js} +2 -2
- package/dist/cli/chunks/{chunk-6OS7HREG.js → chunk-XZJ2O3VC.js} +1 -1
- package/dist/cli/chunks/{chunk-BTIBXGVQ.js → chunk-YRBBBUJX.js} +5 -5
- package/dist/cli/chunks/{chunk-MQ6OF6DU.js → chunk-YZGSJG34.js} +1 -1
- package/dist/cli/chunks/{chunk-XTJMY3KS.js → chunk-YZYDTABJ.js} +1 -1
- package/dist/cli/chunks/{chunk-LQOVA4YX.js → chunk-ZANDSVCK.js} +2 -2
- package/dist/cli/chunks/{chunk-2E3XWKEU.js → chunk-ZBDRLF43.js} +2 -2
- package/dist/cli/chunks/{chunk-UUHIEM2M.js → chunk-ZVSLCEVC.js} +3 -3
- package/dist/cli/chunks/{chunk-Q2T5FXEA.js → chunk-ZXBCCO2H.js} +2 -2
- package/dist/cli/chunks/{ci-5HEXJZ2C.js → ci-7SGRCFPS.js} +2 -2
- package/dist/cli/chunks/{ci-config-WU4NPDAM.js → ci-config-MX3URPZA.js} +2 -2
- package/dist/cli/chunks/{ci-output-BJQVXX5E.js → ci-output-M47NJY6D.js} +2 -2
- package/dist/cli/chunks/{circuit-breaker-3BMGTQCB.js → circuit-breaker-5GAK45SW.js} +2 -2
- package/dist/cli/chunks/{claude-flow-setup-GVDGJWMU.js → claude-flow-setup-YXYSRH4Y.js} +2 -2
- package/dist/cli/chunks/client-ZP3CTVRF.js +2 -0
- package/dist/cli/chunks/{cline-installer-V4MRGWVA.js → cline-installer-DLJ5QD5N.js} +2 -2
- package/dist/cli/chunks/{code-A3TGQPEO.js → code-ONKLMVQ2.js} +25 -24
- package/dist/cli/chunks/{code-index-extractor-YJQSYWD3.js → code-index-extractor-2232LGZN.js} +2 -2
- package/dist/cli/chunks/{codex-installer-7N7UQPAH.js → codex-installer-UOWLYCMH.js} +2 -2
- package/dist/cli/chunks/{completions-PPGVYLZS.js → completions-MHX7GCC7.js} +2 -2
- package/dist/cli/chunks/{complexity-analyzer-XZTFLYV5.js → complexity-analyzer-43ZUJKZU.js} +2 -2
- package/dist/cli/chunks/{continuedev-installer-Z5I57RAH.js → continuedev-installer-6Q5JR4FF.js} +2 -2
- package/dist/cli/chunks/{copilot-installer-F5YZ6BHB.js → copilot-installer-CZUMVHSI.js} +2 -2
- package/dist/cli/chunks/core-handlers-JSRXQWPE.js +2 -0
- package/dist/cli/chunks/{cost-tracker-GO33ZQAP.js → cost-tracker-VS5ZW3XN.js} +2 -2
- package/dist/cli/chunks/{coverage-GSHKLY74.js → coverage-VWKTWZ6D.js} +3 -3
- package/dist/cli/chunks/cross-domain-router-7UKODQWG.js +2 -0
- package/dist/cli/chunks/{cursor-installer-JJ7IVJZB.js → cursor-installer-YIFEMORH.js} +2 -2
- package/dist/cli/chunks/{daemon-IRL7QRNE.js → daemon-SHWJSJW5.js} +7 -7
- package/dist/cli/chunks/daemon-YIFT46FH.js +34 -0
- package/dist/cli/chunks/{dag-attention-scheduler-ORXSUHPA.js → dag-attention-scheduler-TCC2WM46.js} +2 -2
- package/dist/cli/chunks/{detect-RHU62KRI.js → detect-IGTWSQMA.js} +2 -2
- package/dist/cli/chunks/{dist-node-3VKV4Z6C.js → dist-node-TCOTJVQX.js} +2 -2
- package/dist/cli/chunks/{domain-handler-SFIML4FK.js → domain-handler-55ZVYODR.js} +2 -2
- package/dist/cli/chunks/{domain-plugins-CJ4FA3OC.js → domain-plugins-GJRWOHQP.js} +2 -2
- package/dist/cli/chunks/{domain-transfer-BCRKPCAA.js → domain-transfer-6EF75EKU.js} +2 -2
- package/dist/cli/chunks/dream-UDLM6M55.js +2 -0
- package/dist/cli/chunks/{embed-and-insert-pattern-VL3HFLPV.js → embed-and-insert-pattern-XAMNIKQL.js} +2 -2
- package/dist/cli/chunks/{eval-GGKRI4P5.js → eval-GO22R4OZ.js} +2 -2
- package/dist/cli/chunks/{experience-capture-middleware-F72TIRQY.js → experience-capture-middleware-F2BRMJ3Y.js} +3 -3
- package/dist/cli/chunks/{fast-paths-7KOOF3MA.js → fast-paths-6RGPYALD.js} +2 -2
- package/dist/cli/chunks/{feature-flags-FNHBTHBH.js → feature-flags-MIWQIOHU.js} +2 -2
- package/dist/cli/chunks/{feature-flags-IOZEWWFU.js → feature-flags-ZGS3KLPH.js} +2 -2
- package/dist/cli/chunks/file-discovery-THWOUQ7Z.js +2 -0
- package/dist/cli/chunks/fleet-ADL57COA.js +44 -0
- package/dist/cli/chunks/{gnn-wrapper-OH2DOQP7.js → gnn-wrapper-ALBJVW6T.js} +2 -2
- package/dist/cli/chunks/{heartbeat-handler-W67NXTNE.js → heartbeat-handler-ZMM53NDY.js} +4 -4
- package/dist/cli/chunks/heartbeat-scheduler-HGOC5KH3.js +2 -0
- package/dist/cli/chunks/hnsw-adapter-EPSA6AP7.js +2 -0
- package/dist/cli/chunks/hnsw-index-RMFOPYGY.js +2 -0
- package/dist/cli/chunks/{hnsw-legacy-bridge-6MLLOGOE.js → hnsw-legacy-bridge-RYUJPA7B.js} +2 -2
- package/dist/cli/chunks/{hnswlib-node-4UDISJ3G.js → hnswlib-node-XM6XF3YV.js} +2 -2
- package/dist/cli/chunks/{hooks-NOQJWQ4P.js → hooks-X62O7TJO.js} +10 -10
- package/dist/cli/chunks/hybrid-backend-NZ3G4WBX.js +2 -0
- package/dist/cli/chunks/{hypergraph-engine-2OD3APVP.js → hypergraph-engine-ZBWUPTVD.js} +2 -2
- package/dist/cli/chunks/{hypergraph-handler-5AZGMBUM.js → hypergraph-handler-DUMF6SJV.js} +3 -3
- package/dist/cli/chunks/impact-analyzer-WZC6NHFP.js +2 -0
- package/dist/cli/chunks/{init-guard-SMGJ45PW.js → init-guard-S4I2R46S.js} +2 -2
- package/dist/cli/chunks/{init-handler-5T4MP2NM.js → init-handler-L4KJHVWS.js} +6 -6
- package/dist/cli/chunks/init-wizard-422UZYQ5.js +2 -0
- package/dist/cli/chunks/kernel-N7PJ6FCE.js +2 -0
- package/dist/cli/chunks/{kilocode-installer-RLZYLVQJ.js → kilocode-installer-GNNB5FCZ.js} +2 -2
- package/dist/cli/chunks/{kiro-installer-LFZOC7VD.js → kiro-installer-HR6ZAH7T.js} +2 -2
- package/dist/cli/chunks/knowledge-graph-SZCVQF37.js +2 -0
- package/dist/cli/chunks/{learning-XRPGLUWR.js → learning-4IEEOHJS.js} +3 -3
- package/dist/cli/chunks/{llm-router-OMK5HYPH.js → llm-router-ZFMORP36.js} +4 -4
- package/dist/cli/chunks/llm-router-service-4DE5WDUZ.js +2 -0
- package/dist/cli/chunks/{load-XADC7KCU.js → load-ZM43WGDO.js} +2 -2
- package/dist/cli/chunks/load-test-POMIF4Q4.js +2 -0
- package/dist/cli/chunks/{mcp-PIBKSSVU.js → mcp-CRZKZE37.js} +2 -2
- package/dist/cli/chunks/{memory-AP7EZERS.js → memory-W5FZGVAD.js} +5 -5
- package/dist/cli/chunks/memory-backend-4P6AHSOY.js +2 -0
- package/dist/cli/chunks/memory-handlers-NK6NV3GE.js +2 -0
- package/dist/cli/chunks/{multi-model-executor-7JJ2FZ33.js → multi-model-executor-SXXGAQ2G.js} +2 -2
- package/dist/cli/chunks/{opencode-installer-ZZZ6EBYJ.js → opencode-installer-PIRBUAB5.js} +2 -2
- package/dist/cli/chunks/{orchestrator-2H2YKSGJ.js → orchestrator-H5SQCQTB.js} +11 -10
- package/dist/cli/chunks/pattern-null-store-CCHQHGQG.js +2 -0
- package/dist/cli/chunks/{pattern-usage-recorder-7MJJWC2Z.js → pattern-usage-recorder-XZTWDI2T.js} +2 -2
- package/dist/cli/chunks/{pipeline-LIE5BWQY.js → pipeline-5LMLBIJ7.js} +2 -2
- package/dist/cli/chunks/{platform-SMYUNLGX.js → platform-KJDABL5C.js} +2 -2
- package/dist/cli/chunks/{plugin-LJDIXQNT.js → plugin-V4KSBVVM.js} +2 -2
- package/dist/cli/chunks/{prime-radiant-advanced-wasm-RIDNE5D2.js → prime-radiant-advanced-wasm-JDHTKQAT.js} +2 -2
- package/dist/cli/chunks/project-root-X72FSM2F.js +2 -0
- package/dist/cli/chunks/protocol-executor-QW6XN6QN.js +2 -0
- package/dist/cli/chunks/{protocol-handler-YVM66DLI.js → protocol-handler-BNRONTQV.js} +2 -2
- package/dist/cli/chunks/{prove-ZBDT52GD.js → prove-ELLL6XMX.js} +2 -2
- package/dist/cli/chunks/qe-reasoning-bank-ZD3WF647.js +2 -0
- package/dist/cli/chunks/{quality-DUKXGDDO.js → quality-NH2QA4D4.js} +2 -2
- package/dist/cli/chunks/{quality-gate-SM3RXF4V.js → quality-gate-JTKLF7GW.js} +3 -3
- package/dist/cli/chunks/queen-coordinator-S4U4MKK2.js +2 -0
- package/dist/cli/chunks/{real-embeddings-4QLQZDB5.js → real-embeddings-J3KCKLPB.js} +2 -2
- package/dist/cli/chunks/{ref-validation-M3EO32YQ.js → ref-validation-HNXQRP4F.js} +2 -2
- package/dist/cli/chunks/{roocode-installer-S6Q5OLV5.js → roocode-installer-COJ6CX6S.js} +2 -2
- package/dist/cli/chunks/router-CXZKOOTR.js +2 -0
- package/dist/cli/chunks/routing-feedback-IYFANYY5.js +2 -0
- package/dist/cli/chunks/{routing-handler-55FMUACP.js → routing-handler-WM33ZILE.js} +2 -2
- package/dist/cli/chunks/{ruvector-commands-QATKAAPK.js → ruvector-commands-BBLXEA7A.js} +2 -2
- package/dist/cli/chunks/rvf-dual-writer-HCLQ5WUQ.js +2 -0
- package/dist/cli/chunks/rvf-migration-adapter-XCLUWOO3.js +2 -0
- package/dist/cli/chunks/{rvf-migration-coordinator-RFXFU6JD.js → rvf-migration-coordinator-P7H6HCAG.js} +2 -2
- package/dist/cli/chunks/rvf-native-adapter-MRT5H3IP.js +2 -0
- package/dist/cli/chunks/{rvf-store-integrity-PKDVXQAW.js → rvf-store-integrity-R5SPVRFP.js} +2 -2
- package/dist/cli/chunks/safe-db-WFODRGVZ.js +2 -0
- package/dist/cli/chunks/schedule-RO55OQXG.js +2 -0
- package/dist/cli/chunks/scheduler-XXMJCH24.js +2 -0
- package/dist/cli/chunks/{security-CMRB6WA3.js → security-AUDTRX3I.js} +3 -3
- package/dist/cli/chunks/{shared-rvf-adapter-YHLLNFHF.js → shared-rvf-adapter-PVDGBGI2.js} +2 -2
- package/dist/cli/chunks/{shared-rvf-dual-writer-4BGDVPQ7.js → shared-rvf-dual-writer-LZ2GMSS2.js} +2 -2
- package/dist/cli/chunks/sqlite-persistence-AWRIS4MK.js +2 -0
- package/dist/cli/chunks/{standalone-memory-LUHKQAGM.js → standalone-memory-XNOAI4G4.js} +2 -2
- package/dist/cli/chunks/{status-handler-S6S5PNR7.js → status-handler-K72XZE4T.js} +2 -2
- package/dist/cli/chunks/{structural-health-PQ7NZAJ4.js → structural-health-NF3YY7U5.js} +2 -2
- package/dist/cli/chunks/{sync-S744AEJC.js → sync-UVXA6CT2.js} +2 -2
- package/dist/cli/chunks/{sync-Q6KRQXU6.js → sync-VBD5Y3E2.js} +2 -2
- package/dist/cli/chunks/{task-handler-GAMGEHUW.js → task-handler-24S3WFVJ.js} +13 -7
- package/dist/cli/chunks/task-handlers-GUYW2EPJ.js +9 -0
- package/dist/cli/chunks/{test-FNH67DBK.js → test-XFSGQELD.js} +4 -4
- package/dist/cli/chunks/{test-scheduling-NZA5SHK6.js → test-scheduling-VYUQ4CDE.js} +3 -3
- package/dist/cli/chunks/{token-bootstrap-CXKG55JD.js → token-bootstrap-EDK6FNQ3.js} +2 -2
- package/dist/cli/chunks/{token-usage-M7WWEDJX.js → token-usage-VLQ6WO2L.js} +2 -2
- package/dist/cli/chunks/{transformers-2IFMCK6A.js → transformers-TOFMWWNM.js} +2 -2
- package/dist/cli/chunks/{tree-sitter-wasm-parser-NMNA6RJC.js → tree-sitter-wasm-parser-MI3NZKUD.js} +2 -2
- package/dist/cli/chunks/{types-N7FWTOLD.js → types-JTWLBAZJ.js} +2 -2
- package/dist/cli/chunks/unified-memory-6JWHV6EF.js +2 -0
- package/dist/cli/chunks/unified-memory-hnsw-4UANU6NU.js +2 -0
- package/dist/cli/chunks/unified-persistence-KGGNA46H.js +2 -0
- package/dist/cli/chunks/{upgrade-KDB5RGL7.js → upgrade-4ABM72T4.js} +2 -2
- package/dist/cli/chunks/{validate-KMUV5FUA.js → validate-UDJCWKXI.js} +2 -2
- package/dist/cli/chunks/{validate-swarm-ANZWRCJU.js → validate-swarm-TODOUWNN.js} +2 -2
- package/dist/cli/chunks/visual-security-6VZNQLH7.js +2 -0
- package/dist/cli/chunks/{web-tree-sitter-SXXC4NMS.js → web-tree-sitter-WBMAJPM5.js} +2 -2
- package/dist/cli/chunks/{windsurf-installer-2LWSKMBU.js → windsurf-installer-BTT53TUL.js} +2 -2
- package/dist/cli/chunks/witness-chain-AKKHWEWU.js +2 -0
- package/dist/cli/chunks/{witness-chain-JJMSJFZP.js → witness-chain-TATPXQRK.js} +2 -2
- package/dist/cli/chunks/{witness-chain-repair-OX7VFW6T.js → witness-chain-repair-2HGJGE7O.js} +2 -2
- package/dist/cli/chunks/{witness-chain-verifier-QLSMXHAZ.js → witness-chain-verifier-FRY3LMGH.js} +2 -2
- package/dist/cli/chunks/{witness-key-manager-3DS4L7LE.js → witness-key-manager-X7QHQQWL.js} +2 -2
- package/dist/cli/chunks/{workflow-ARWAMHD3.js → workflow-QMZPAWQW.js} +4 -4
- package/dist/cli/chunks/workflow-orchestrator-4GAW7HNZ.js +2 -0
- package/dist/cli/chunks/{wrappers-J6KGTUSJ.js → wrappers-ZD5NBHYI.js} +2 -2
- package/dist/cli/commands/code.js +8 -0
- package/dist/cli/commands/daemon.js +8 -0
- package/dist/cli/commands/fleet.js +14 -9
- package/dist/cli/handlers/task-handler.js +21 -1
- package/dist/coordination/handlers/code-intelligence-handlers.js +14 -2
- package/dist/coordination/handlers/coverage-collection.js +9 -10
- package/dist/coordination/handlers/coverage-handlers.js +21 -3
- package/dist/coordination/handlers/coverage-runner.d.ts +2 -1
- package/dist/coordination/handlers/coverage-runner.js +9 -2
- package/dist/coordination/handlers/coverage-target.d.ts +13 -3
- package/dist/coordination/handlers/coverage-target.js +224 -7
- package/dist/coordination/handlers/handler-types.d.ts +2 -0
- package/dist/coordination/handlers/test-execution-handlers.js +32 -5
- package/dist/coordination/index.d.ts +2 -2
- package/dist/coordination/index.js +1 -1
- package/dist/coordination/protocols/learning-consolidation-archive.d.ts +39 -0
- package/dist/coordination/protocols/learning-consolidation-archive.js +57 -0
- package/dist/coordination/protocols/learning-consolidation.d.ts +38 -3
- package/dist/coordination/protocols/learning-consolidation.js +130 -58
- package/dist/coordination/queen-coordinator.d.ts +12 -1
- package/dist/coordination/queen-coordinator.js +24 -1
- package/dist/coordination/queen-event-handlers.js +2 -1
- package/dist/coordination/queen-lifecycle.js +9 -0
- package/dist/coordination/queen-task-management.js +113 -40
- package/dist/coordination/queen-types.d.ts +10 -0
- package/dist/coordination/queen-types.js +8 -0
- package/dist/coordination/task-dag/dag-algorithms.d.ts +33 -0
- package/dist/coordination/task-dag/dag-algorithms.js +162 -0
- package/dist/coordination/task-dag/dag-obligations.d.ts +21 -0
- package/dist/coordination/task-dag/dag-obligations.js +83 -0
- package/dist/coordination/task-dag/dag.d.ts +69 -19
- package/dist/coordination/task-dag/dag.js +215 -269
- package/dist/coordination/task-dag/index.d.ts +12 -4
- package/dist/coordination/task-dag/index.js +11 -3
- package/dist/coordination/task-dag/prerequisite-ledger.d.ts +84 -0
- package/dist/coordination/task-dag/prerequisite-ledger.js +252 -0
- package/dist/coordination/task-dag/scheduler.d.ts +19 -9
- package/dist/coordination/task-dag/scheduler.js +36 -12
- package/dist/coordination/task-dag/types.d.ts +160 -1
- package/dist/coordination/task-dag/types.js +2 -1
- package/dist/coordination/task-executability.d.ts +18 -0
- package/dist/coordination/task-executability.js +31 -0
- package/dist/coordination/task-executor.d.ts +1 -0
- package/dist/coordination/task-executor.js +5 -0
- package/dist/domains/code-intelligence/coordinator.js +35 -9
- package/dist/domains/code-intelligence/index-path-guard.d.ts +49 -0
- package/dist/domains/code-intelligence/index-path-guard.js +125 -0
- package/dist/domains/code-intelligence/interfaces.d.ts +12 -0
- package/dist/domains/code-intelligence/services/knowledge-graph.d.ts +6 -0
- package/dist/domains/code-intelligence/services/knowledge-graph.js +42 -5
- package/dist/domains/contract-testing/coordinator.js +3 -1
- package/dist/domains/coverage-analysis/collected-metrics.js +2 -1
- package/dist/domains/defect-intelligence/services/defect-predictor.js +4 -2
- package/dist/domains/learning-optimization/active-patterns.d.ts +55 -0
- package/dist/domains/learning-optimization/active-patterns.js +80 -0
- package/dist/domains/learning-optimization/coordinator-helpers.js +2 -3
- package/dist/domains/learning-optimization/coordinator.d.ts +0 -3
- package/dist/domains/learning-optimization/coordinator.js +50 -106
- package/dist/domains/learning-optimization/index.d.ts +1 -1
- package/dist/domains/learning-optimization/interfaces.d.ts +56 -4
- package/dist/domains/learning-optimization/plugin.js +11 -1
- package/dist/domains/learning-optimization/reward-source.d.ts +37 -0
- package/dist/domains/learning-optimization/reward-source.js +58 -0
- package/dist/domains/learning-optimization/services/learning-coordinator.d.ts +4 -4
- package/dist/domains/learning-optimization/services/learning-coordinator.js +68 -34
- package/dist/domains/learning-optimization/services/metrics-optimizer.d.ts +14 -4
- package/dist/domains/learning-optimization/services/metrics-optimizer.js +129 -63
- package/dist/domains/learning-optimization/services/transfer-specialist.js +25 -15
- package/dist/domains/test-execution/interfaces.d.ts +16 -0
- package/dist/domains/test-execution/services/retry-handler.js +18 -2
- package/dist/domains/test-execution/services/runner-test-cases.d.ts +21 -0
- package/dist/domains/test-execution/services/runner-test-cases.js +69 -0
- package/dist/domains/test-execution/services/test-executor.d.ts +5 -0
- package/dist/domains/test-execution/services/test-executor.js +24 -2
- package/dist/init/fleet-integration.js +2 -0
- package/dist/init/init-wizard-steps.js +2 -0
- package/dist/init/phases/06-code-intelligence.js +2 -0
- package/dist/init/phases/10-workers.js +2 -1
- package/dist/kernel/anti-drift-middleware.d.ts +44 -5
- package/dist/kernel/anti-drift-middleware.js +147 -11
- package/dist/kernel/interfaces.d.ts +5 -0
- package/dist/learning/dream/dream-engine.d.ts +27 -1
- package/dist/learning/dream/dream-engine.js +56 -2
- package/dist/learning/dream/dream-insights-pruner.d.ts +18 -4
- package/dist/learning/dream/dream-insights-pruner.js +99 -11
- package/dist/learning/dream/rvcow-branch-manager.d.ts +8 -0
- package/dist/learning/dream/rvcow-branch-manager.js +8 -0
- package/dist/learning/dream/speculative-dreamer.d.ts +8 -0
- package/dist/learning/dream/speculative-dreamer.js +8 -0
- package/dist/learning/skill-validation-learner.d.ts +2 -0
- package/dist/learning/skill-validation-learner.js +29 -21
- package/dist/mcp/background-workers.d.ts +15 -0
- package/dist/mcp/background-workers.js +77 -0
- package/dist/mcp/bundle.js +511 -484
- package/dist/mcp/entry.js +4 -49
- package/dist/mcp/handlers/domain-handler-configs.d.ts +14 -0
- package/dist/mcp/handlers/domain-handler-configs.js +68 -30
- package/dist/mcp/handlers/handler-factory.js +1 -0
- package/dist/mcp/handlers/task-handlers.js +37 -1
- package/dist/mcp/metrics/metrics-collector.d.ts +11 -9
- package/dist/mcp/metrics/metrics-collector.js +13 -26
- package/dist/mcp/protocol-server.js +8 -3
- package/dist/mcp/tools/learning-optimization/optimize.d.ts +34 -3
- package/dist/mcp/tools/learning-optimization/optimize.js +106 -70
- package/dist/memory/crdt/lww-register.js +11 -1
- package/dist/routing/calibration/ema-calibrator.js +3 -1
- package/dist/shared/base-domain-plugin.d.ts +4 -0
- package/dist/shared/base-domain-plugin.js +6 -0
- package/dist/shared/llm/cache.js +4 -1
- package/dist/shared/security/compliance-patterns.js +3 -1
- package/dist/shared/test-runner-process.d.ts +26 -0
- package/dist/shared/test-runner-process.js +91 -0
- package/dist/shared/types/index.d.ts +9 -0
- package/dist/shared/types/index.js +13 -0
- package/dist/shared/utils/namespaced-search.d.ts +42 -0
- package/dist/shared/utils/namespaced-search.js +53 -0
- package/dist/strange-loop/infra-healing/infra-action-executor.js +7 -3
- package/dist/strange-loop/infra-healing/infra-healing-orchestrator.js +10 -9
- package/dist/workers/daemon.d.ts +7 -0
- package/dist/workers/daemon.js +21 -2
- package/dist/workers/namespaced-keys.d.ts +4 -7
- package/dist/workers/namespaced-keys.js +4 -15
- package/dist/workers/quality-daemon/ci-monitor.js +9 -5
- package/dist/workers/worker-env.d.ts +53 -0
- package/dist/workers/worker-env.js +89 -0
- package/dist/workers/worker-manager.js +4 -0
- package/dist/workers/workers/learning-consolidation.d.ts +20 -0
- package/dist/workers/workers/learning-consolidation.js +57 -23
- package/package.json +1 -1
- package/dist/cli/chunks/adapter-PEOUNYXJ.js +0 -2
- package/dist/cli/chunks/aqe-learning-engine-DHKZI5RX.js +0 -2
- package/dist/cli/chunks/base-QZWK3D5P.js +0 -2
- package/dist/cli/chunks/browser-workflow-ITPX72RX.js +0 -2
- package/dist/cli/chunks/chunk-CG5DZCOZ.js +0 -2
- package/dist/cli/chunks/chunk-QJE6ZW2X.js +0 -6
- package/dist/cli/chunks/chunk-T3ZDVU6F.js +0 -5
- package/dist/cli/chunks/chunk-UIYKR2SA.js +0 -2
- package/dist/cli/chunks/chunk-VJRZFWR5.js +0 -2
- package/dist/cli/chunks/chunk-VUFRTGML.js +0 -3
- package/dist/cli/chunks/chunk-YDZJWDR6.js +0 -180
- package/dist/cli/chunks/client-S7GNYTZ5.js +0 -2
- package/dist/cli/chunks/core-handlers-CUEPOQIO.js +0 -2
- package/dist/cli/chunks/cross-domain-router-CXN5QFEV.js +0 -2
- package/dist/cli/chunks/daemon-3DQCKRYO.js +0 -10
- package/dist/cli/chunks/dream-5AUNJW24.js +0 -2
- package/dist/cli/chunks/file-discovery-AYWF357I.js +0 -2
- package/dist/cli/chunks/fleet-QX5KXTRC.js +0 -43
- package/dist/cli/chunks/heartbeat-scheduler-7ZIDVXIP.js +0 -2
- package/dist/cli/chunks/hnsw-adapter-P77OC7FM.js +0 -2
- package/dist/cli/chunks/hnsw-index-3LBOTQAW.js +0 -2
- package/dist/cli/chunks/hybrid-backend-LOM54PDD.js +0 -2
- package/dist/cli/chunks/impact-analyzer-QSDJVBPS.js +0 -2
- package/dist/cli/chunks/init-wizard-MK2325JJ.js +0 -2
- package/dist/cli/chunks/kernel-2NJQQ2KT.js +0 -2
- package/dist/cli/chunks/knowledge-graph-SDISHO62.js +0 -2
- package/dist/cli/chunks/llm-router-service-YTCMRBAN.js +0 -2
- package/dist/cli/chunks/load-test-RPKHLBCC.js +0 -2
- package/dist/cli/chunks/memory-backend-BZXFO4JZ.js +0 -2
- package/dist/cli/chunks/memory-handlers-MOFDNB6E.js +0 -2
- package/dist/cli/chunks/pattern-null-store-4PRPIOR6.js +0 -2
- package/dist/cli/chunks/project-root-NBIQF63D.js +0 -2
- package/dist/cli/chunks/protocol-executor-BRPGIYWQ.js +0 -2
- package/dist/cli/chunks/qe-reasoning-bank-GDZACWKW.js +0 -2
- package/dist/cli/chunks/queen-coordinator-LDKLBPD5.js +0 -2
- package/dist/cli/chunks/router-H5YSIRH2.js +0 -2
- package/dist/cli/chunks/routing-feedback-5R36TJDH.js +0 -2
- package/dist/cli/chunks/rvf-dual-writer-TT2DBQQQ.js +0 -2
- package/dist/cli/chunks/rvf-migration-adapter-BCLFJKSK.js +0 -2
- package/dist/cli/chunks/rvf-native-adapter-UXI66OQJ.js +0 -2
- package/dist/cli/chunks/safe-db-MSTD2GDH.js +0 -2
- package/dist/cli/chunks/schedule-KST6KIFD.js +0 -2
- package/dist/cli/chunks/scheduler-FTQS6YK3.js +0 -2
- package/dist/cli/chunks/sqlite-persistence-ZX5QFDMR.js +0 -2
- package/dist/cli/chunks/task-handlers-6CRDEELN.js +0 -9
- package/dist/cli/chunks/unified-memory-2Z2F446J.js +0 -2
- package/dist/cli/chunks/unified-memory-hnsw-A4EWYPJQ.js +0 -2
- package/dist/cli/chunks/unified-persistence-Z6N6JZFA.js +0 -2
- package/dist/cli/chunks/visual-security-GXYZV7KR.js +0 -2
- package/dist/cli/chunks/witness-chain-52PEIEGK.js +0 -2
- package/dist/cli/chunks/workflow-orchestrator-DORMQMG7.js +0 -2
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.9");process.exit(0)}
|
|
2
|
+
import{a as O}from"./chunk-4URT6JO2.js";import{a as F}from"./chunk-HAROIAJE.js";import{a as W,b as _,c as P,e as B}from"./chunk-OG2UI6A3.js";import{b as N,d as j}from"./chunk-4V27J6YN.js";var G=new Set(["false","0","off","no"]),J=new Set([...G,"disabled","disable","none","never"]),K=30,E=36500;function ge(l=process.env){let e=l.AQE_WORKERS_ENABLED;return e===void 0?!0:!G.has(e.trim().toLowerCase())}function fe(l=process.env){let e=l.AQE_DISABLED_WORKERS;if(!e)return[];let t=e.split(",").map(i=>i.trim().toLowerCase()).filter(i=>i.length>0);return Array.from(new Set(t))}function ye(l=process.env){let e=l.AQE_DREAM_INSIGHTS_RETENTION_DAYS;if(e===void 0||e.trim()==="")return{retentionDays:K};let t=e.trim().toLowerCase();if(J.has(t))return{retentionDays:null};if(/^\d+$/.test(t)){let i=Number(t);if(i>=1&&i<=E)return{retentionDays:i}}return{retentionDays:null,warning:`Invalid AQE_DREAM_INSIGHTS_RETENTION_DAYS=${JSON.stringify(e)}; expected a whole number of days (1-${E}), 0 or "off". The dream_insights retention sweep is off until this is fixed; nothing is deleted.`}}var x="quality-daemon",R=class{constructor(e){this.backend=e}backend;async get(e,t){return this.backend.kvGet(e,t?.namespace??x)}async set(e,t){await this.backend.kvSet(e,t,x)}async search(e,t,i){return this.backend.kvSearch(e,i?.namespace??x,t)}};import{cpus as de,freemem as he,totalmem as me,loadavg as pe}from"os";var p=class{queues={now:[],next:[],later:[]};_maxSize;constructor(e=1e3){this._maxSize=e}enqueue(e){return this.size>=this._maxSize&&(this.pruneExpired(),this.size>=this._maxSize)?!1:(this.queues[e.priority].push(e),!0)}dequeue(){let e=Date.now();for(let t of["now","next","later"]){let i=this.queues[t];for(;i.length>0;){let r=i.shift();if(!(r.ttlMs&&e-r.createdAt>r.ttlMs))return r}}}peek(){let e=Date.now();for(let t of["now","next","later"]){let i=this.queues[t];for(let r of i)if(!r.ttlMs||e-r.createdAt<=r.ttlMs)return r}}drainPriority(e){let t=this.queues[e].splice(0),i=Date.now();return t.filter(r=>!r.ttlMs||i-r.createdAt<=r.ttlMs)}pruneExpired(){let e=0,t=Date.now();for(let i of["now","next","later"]){let r=this.queues[i].length;this.queues[i]=this.queues[i].filter(o=>!o.ttlMs||t-o.createdAt<=o.ttlMs),e+=r-this.queues[i].length}return e}get size(){return this.queues.now.length+this.queues.next.length+this.queues.later.length}get depths(){return{now:this.queues.now.length,next:this.queues.next.length,later:this.queues.later.length}}get isEmpty(){return this.size===0}clear(){this.queues.now=[],this.queues.next=[],this.queues.later=[]}};import{watch as V}from"fs";import{execFile as Y}from"child_process";import{promisify as X}from"util";import{resolve as Q,join as Z}from"path";import{existsSync as ee,readFileSync as te}from"fs";var I=X(Y),ie={repoRoot:process.cwd(),debounceMs:500,maxChangedFiles:200,pollIntervalMs:5e3},g=class{constructor(e,t){this.queue=e;this.options={...ie,...t}}queue;watcher;pollTimer;options;lastKnownHeads=new Map;debounceTimer;_running=!1;_polling=!1;get running(){return this._running}async start(){if(this._running)return;let e=Q(this.options.repoRoot,".git","refs","heads");if(!ee(e))throw new Error(`Git refs directory not found: ${e}`);await this.snapshotHeads(),process.platform==="darwin"||process.platform==="win32"?this.watcher=V(e,{recursive:!0},(i,r)=>{r&&this.handleRefChange(r)}):(this.pollTimer=setInterval(()=>{this.poll().catch(i=>{console.debug("[GitWatcher] Poll error:",i)})},this.options.pollIntervalMs),this.pollTimer.unref?.()),this._running=!0}stop(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=void 0),this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=void 0),this.watcher&&(this.watcher.close(),this.watcher=void 0),this._running=!1}async poll(){if(this._polling)return[];this._polling=!0;let e=[];try{let{stdout:t}=await I("git",["for-each-ref","--format=%(refname:short) %(objectname:short)","refs/heads/"],{cwd:this.options.repoRoot});for(let i of t.trim().split(`
|
|
3
|
+
`)){if(!i)continue;let[r,o]=i.split(" "),n=this.lastKnownHeads.get(r);n&&n!==o&&(e.push(r),await this.enqueueCommitAnalysis(r,o)),this.lastKnownHeads.set(r,o)}}catch{}finally{this._polling=!1}return e}handleRefChange(e){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.processRefChange(e).catch(t=>{console.debug("[GitWatcher] Error processing ref change:",t)})},this.options.debounceMs)}async processRefChange(e){let t=e.replace(/\\/g,"/"),i=Q(this.options.repoRoot,".git","refs","heads"),r=Z(i,e),o;try{o=te(r,"utf-8").trim()}catch{return}this.lastKnownHeads.get(t)!==o&&(this.lastKnownHeads.set(t,o),await this.enqueueCommitAnalysis(t,o))}async enqueueCommitAnalysis(e,t){if(F(t,"commit hash"))return;let i=[];try{let{stdout:n}=await I("git",["diff-tree","--no-commit-id","--name-only","-r",t],{cwd:this.options.repoRoot});i=n.trim().split(`
|
|
4
|
+
`).filter(Boolean).slice(0,this.options.maxChangedFiles)}catch{}let r={type:"git_commit",branch:e,commitHash:t,changedFiles:i},o={id:`git-${t}-${Date.now()}`,priority:"next",payload:r,createdAt:Date.now(),source:"git-watcher",ttlMs:300*1e3};this.queue.enqueue(o)}async snapshotHeads(){try{let{stdout:e}=await I("git",["for-each-ref","--format=%(refname:short) %(objectname:short)","refs/heads/"],{cwd:this.options.repoRoot});for(let t of e.trim().split(`
|
|
5
|
+
`)){if(!t)continue;let[i,r]=t.split(" ");this.lastKnownHeads.set(i,r)}}catch{}}};function M(l,e){return l===null||e===null?0:l-e}var re={regressionThreshold:2,gapThreshold:60,memoryPrefix:"quality-daemon:coverage"},f=class{constructor(e,t){this.queue=e;this.options={...re,...t}}queue;options;async analyze(e,t,i){let r=await t.get(`${this.options.memoryPrefix}:snapshot`);if(await t.set(`${this.options.memoryPrefix}:snapshot`,e),!r)return{regressionDetected:!1,overallDelta:{line:0,branch:0,function:0,statement:0},affectedFiles:[],newGaps:[]};let o=r,n={line:e.overall.line-o.overall.line,branch:M(e.overall.branch,o.overall.branch??null),function:M(e.overall.function,o.overall.function??null),statement:M(e.overall.statement,o.overall.statement??null)},s=n.line<-this.options.regressionThreshold||(n.branch??0)<-this.options.regressionThreshold,a=i??Object.keys(e.files),c=[],d=[];for(let h of a){let u=e.files[h],m=o.files[h];if(!u)continue;let A=m?u.line-m.line:0,q=m?u.branch-m.branch:0,D=m?u.uncoveredLines.filter(T=>!m.uncoveredLines.includes(T)):u.uncoveredLines;if((A!==0||q!==0||D.length>0)&&c.push({file:h,lineDelta:A,branchDelta:q,newUncoveredLines:D}),u.line<this.options.gapThreshold){let T=this.computeRiskScore(u,D.length);d.push({file:h,uncoveredLines:u.uncoveredLines,currentCoverage:u.line,riskScore:T})}}return(s||d.length>0)&&this.enqueueTestSuggestion(e,o,d),await t.set(`${this.options.memoryPrefix}:delta`,{timestamp:Date.now(),overallDelta:n,regressionDetected:s,affectedFileCount:c.length,gapCount:d.length}),{regressionDetected:s,overallDelta:n,affectedFiles:c,newGaps:d}}async buildSnapshot(e){let t=await e.get("coverage:latest"),i=O(t);if(i)return{timestamp:Date.now(),overall:{line:i.line,branch:i.branch,function:i.function,statement:i.statement},files:t&&typeof t.files=="object"?t.files:{}}}computeRiskScore(e,t){let r=1-Math.min(100,Math.max(0,e.line))/100,o=Math.min(t/50,1);return Math.min(1,r*.6+o*.4)}enqueueTestSuggestion(e,t,i){let r={type:"coverage_delta",previousSnapshot:`snapshot-${t.timestamp}`,currentSnapshot:`snapshot-${e.timestamp}`},o={id:`coverage-delta-${Date.now()}`,priority:i.some(n=>n.riskScore>.8)?"now":"next",payload:r,createdAt:Date.now(),source:"coverage-delta",ttlMs:600*1e3};this.queue.enqueue(o)}};B();import{execFile as oe}from"child_process";import{promisify as ne}from"util";var se=ne(oe),ae={runsPerWorkflow:10,flakyThreshold:3,repo:""},y=class{constructor(e,t){this.queue=e;this.options={...ae,...t}}queue;options;async check(){let e=await this.fetchRecentRuns(),t=this.groupByWorkflow(e),i=[],r=[],o=0;for(let[s,a]of Object.entries(t)){let c=a.filter(m=>m.conclusion==="failure").length,d=a.length>0?(a.length-c)/a.length*100:100,h=this.countConsecutiveFailures(a),u=a[0]?.conclusion??"unknown";u==="failure"&&o++,h>=this.options.flakyThreshold&&(r.push(s),this.enqueueFailureAlert(s,a[0])),i.push({name:s,recentRuns:a.length,failedRuns:c,successRate:Math.round(d*10)/10,lastConclusion:u,consecutiveFailures:h})}let n=this.calculateHealthScore(i);return{timestamp:Date.now(),workflows:i,failingWorkflows:o,flakyWorkflows:r,healthScore:n}}async fetchRecentRuns(){try{let e=["run","list","--limit",String(this.options.runsPerWorkflow*5),"--json","name,status,conclusion,headBranch,number,databaseId,createdAt"];this.options.repo&&e.push("--repo",this.options.repo);let{stdout:t}=await se("gh",e,{timeout:15e3});return JSON.parse(t).map(r=>({name:r.name,status:r.status,conclusion:r.conclusion??"pending",headBranch:r.headBranch,runNumber:r.number,databaseId:r.databaseId,createdAt:r.createdAt}))}catch{return[]}}groupByWorkflow(e){let t=W();for(let i of e){let r=_(t,i.name);r||(r=[],P(t,i.name,r)),r.push(i)}for(let i of Object.keys(t))P(t,i,_(t,i).slice(0,this.options.runsPerWorkflow));return t}countConsecutiveFailures(e){let t=0;for(let i of e)if(i.conclusion==="failure")t++;else break;return t}calculateHealthScore(e){if(e.length===0)return 100;let t=e.reduce((i,r)=>i+r.successRate,0)/e.length;return Math.round(t)}enqueueFailureAlert(e,t){let i={type:"ci_failure",workflowName:e,runId:t.databaseId,conclusion:t.conclusion},r={id:`ci-failure-${e}-${Date.now()}`,priority:"now",payload:i,createdAt:Date.now(),source:"ci-monitor",ttlMs:1800*1e3};this.queue.enqueue(r)}};var le={memoryPrefix:"quality-daemon:suggestions",maxSuggestions:100,minRiskScore:.3},v=class{options;constructor(e){this.options={...le,...e}}async suggest(e,t,i){let r=[],o=e.filter(s=>s.riskScore>=this.options.minRiskScore);for(let s of o){let a=t.includes(s.file),c=this.determinePriority(s,a),d=this.determineTestType(s.file),h=this.estimateEffort(s);r.push({id:`suggestion-${Date.now()}-${r.length}`,file:s.file,uncoveredLines:s.uncoveredLines.slice(0,50),suggestedTestType:d,description:this.generateDescription(s,d),priority:c,estimatedEffort:h,createdAt:Date.now(),status:"pending"})}r.sort((s,a)=>{let c={high:0,medium:1,low:2};return c[s.priority]-c[a.priority]});let n=r.slice(0,this.options.maxSuggestions);return await this.storeSuggestions(n,i),n}async getPending(e){return(await e.get(`${this.options.memoryPrefix}:list`)??[]).filter(i=>i.status==="pending")}async updateStatus(e,t,i){let r=await i.get(`${this.options.memoryPrefix}:list`);if(!r)return!1;let o=r.findIndex(s=>s.id===e);if(o===-1)return!1;let n=r.map((s,a)=>a===o?{...s,status:t}:s);return await i.set(`${this.options.memoryPrefix}:list`,n),!0}determinePriority(e,t){return e.riskScore>.8?"high":t||e.riskScore>.5?"medium":"low"}determineTestType(e){return e.includes("/api/")||e.includes("/routes/")||e.includes("/handlers/")?"integration":e.includes("/e2e/")||e.includes("/pages/")||e.includes("/views/")?"e2e":"unit"}estimateEffort(e){return e.uncoveredLines.length<=10?"small":e.uncoveredLines.length<=50?"medium":"large"}generateDescription(e,t){let i=e.uncoveredLines.length,r=Math.round(e.currentCoverage);return`Add ${t} tests for ${e.file} (${i} uncovered lines, ${r}% coverage, risk ${(e.riskScore*100).toFixed(0)}%)`}async storeSuggestions(e,t){let o=[...(await t.get(`${this.options.memoryPrefix}:list`)??[]).filter(n=>n.status!=="pending"),...e].slice(-this.options.maxSuggestions);await t.set(`${this.options.memoryPrefix}:list`,o),await t.set(`${this.options.memoryPrefix}:count`,{pending:e.length,total:o.length,lastUpdated:Date.now()})}};var ue={memoryPrefix:"quality-daemon:nightly",maxEntryAge:6048e5,nightlyHour:2},w=class{constructor(e,t){this.queue=e;this.options={...ue,...t}}queue;options;lastRunDate;shouldRun(){let e=new Date,t=e.toISOString().split("T")[0];return this.lastRunDate===t?!1:e.getHours()>=this.options.nightlyHour}scheduleIfDue(){if(!this.shouldRun())return!1;let e={type:"nightly",tasks:["consolidate_patterns","prune_expired","generate_report"]},t={id:`nightly-${Date.now()}`,priority:"later",payload:e,createdAt:Date.now(),source:"nightly-consolidation",ttlMs:720*60*1e3};return this.queue.enqueue(t)}async execute(e,t){let i=Date.now(),r=new Date().toISOString().split("T")[0],o=await this.consolidatePatterns(e),n=await this.pruneExpired(e),s=this.generateReport(r,t);await e.set(`${this.options.memoryPrefix}:report:${r}`,s),this.lastRunDate=r;let a={timestamp:Date.now(),patternsConsolidated:o,entriesPruned:n,reportGenerated:!0,durationMs:Date.now()-i};return await e.set(`${this.options.memoryPrefix}:last-result`,a),a}async getLastResult(e){return e.get(`${this.options.memoryPrefix}:last-result`)}async consolidatePatterns(e){let t=await e.search("quality-daemon:*"),i=0;return await e.get("quality-daemon:suggestions:count")&&i++,await e.get("quality-daemon:coverage:delta")&&i++,i}async pruneExpired(e){let t=await e.search("quality-daemon:*"),i=0,r=Date.now();for(let o of t){if(o.endsWith(":snapshot")||o.endsWith(":list"))continue;let n=await e.get(o);n&&typeof n.timestamp=="number"&&r-n.timestamp>this.options.maxEntryAge&&(await e.set(o,{pruned:!0,prunedAt:r}),i++)}return i}generateReport(e,t){return{date:e,coverageHealth:t.coverageHealth??0,ciHealth:t.ciHealth??0,commitsAnalyzed:t.commitsAnalyzed??0,suggestionsGenerated:t.suggestionsGenerated??0,notificationsSent:t.notificationsSent??0,queueDepthAvg:t.queueDepthAvg??0,daemonUptime:t.uptimeSeconds??0}}};j();import{writeFileSync as $,mkdirSync as H,readdirSync as C,readFileSync as L,unlinkSync as U}from"fs";import{join as b}from"path";var ce={maxNotifications:200},k=class{notificationsDir;maxNotifications;webhookUrl;urlValidator;_sentCount=0;constructor(e){this.notificationsDir=e?.notificationsDir??N("notifications"),this.maxNotifications=e?.maxNotifications??ce.maxNotifications,this.webhookUrl=e?.webhookUrl,this.urlValidator=e?.urlValidator}get sentCount(){return this._sentCount}initialize(){H(this.notificationsDir,{recursive:!0})}async send(e){let t={...e,id:`notif-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,timestamp:Date.now(),read:!1};return this.writeToFile(t),this.webhookUrl&&await this.sendWebhook(t),this._sentCount++,this.pruneOldNotifications(),t}list(e){let t=e?.limit??50;try{let i=C(this.notificationsDir).filter(o=>o.endsWith(".json")).sort().reverse(),r=[];for(let o of i){if(r.length>=t)break;try{let n=L(b(this.notificationsDir,o),"utf-8"),s=JSON.parse(n);if(e?.unreadOnly&&s.read||e?.type&&s.type!==e.type)continue;r.push(s)}catch{}}return r}catch{return[]}}markRead(e){try{let t=C(this.notificationsDir).filter(n=>n.endsWith(`-${e}.json`));if(t.length===0)return!1;let i=b(this.notificationsDir,t[0]),o={...JSON.parse(L(i,"utf-8")),read:!0};return $(i,JSON.stringify(o,null,2)),!0}catch{return!1}}clear(){try{let e=C(this.notificationsDir).filter(t=>t.endsWith(".json"));for(let t of e)U(b(this.notificationsDir,t));return e.length}catch{return 0}}writeToFile(e){try{H(this.notificationsDir,{recursive:!0});let t=`${e.timestamp}-${e.id}.json`,i=b(this.notificationsDir,t);$(i,JSON.stringify(e,null,2))}catch(t){console.debug("[NotificationService] Failed to write notification:",t)}}async sendWebhook(e){if(this.webhookUrl){if(this.urlValidator&&!this.urlValidator(this.webhookUrl)){console.warn("[NotificationService] Webhook URL blocked by SSRF guard:",this.webhookUrl);return}try{let t=await fetch(this.webhookUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(5e3)});t.ok||console.debug(`[NotificationService] Webhook returned ${t.status}`)}catch(t){console.debug("[NotificationService] Webhook delivery failed:",t)}}}pruneOldNotifications(){try{let e=C(this.notificationsDir).filter(i=>i.endsWith(".json")).sort();if(e.length<=this.maxNotifications)return;let t=e.slice(0,e.length-this.maxNotifications);for(let i of t)U(b(this.notificationsDir,i))}catch{}}};var S={tickIntervalMs:3e4,ciPollIntervalMs:5*6e4,coverageCheckIntervalMs:2*6e4,cpuThreshold:.7,memoryThreshold:.8},z=class{queue;gitWatcher;coverageDelta;ciMonitor;testSuggester;nightlyConsolidation;notificationService;tickTimer;_running=!1;_startedAt=0;_tickCount=0;_lastTickAt;_throttled=!1;_commitsAnalyzed=0;_suggestionsGenerated=0;_ciHealth=100;_coverageHealth=100;_lastCICheck;_lastCoverageCheck;_memory;config;constructor(e){this.config={tickIntervalMs:e?.tickIntervalMs??S.tickIntervalMs,ciPollIntervalMs:e?.ciPollIntervalMs??S.ciPollIntervalMs,coverageCheckIntervalMs:e?.coverageCheckIntervalMs??S.coverageCheckIntervalMs,cpuThreshold:e?.cpuThreshold??S.cpuThreshold,memoryThreshold:e?.memoryThreshold??S.memoryThreshold},this.queue=new p,this.gitWatcher=new g(this.queue,e?.git),this.coverageDelta=new f(this.queue,e?.coverage),this.ciMonitor=new y(this.queue,e?.ci),this.testSuggester=new v(e?.suggestions),this.nightlyConsolidation=new w(this.queue,e?.nightly),this.notificationService=new k(e?.notifications)}get running(){return this._running}async start(e){this._running||(this._memory=e,this._running=!0,this._startedAt=Date.now(),this.notificationService.initialize(),await this.gitWatcher.start().catch(t=>{console.debug("[QualityDaemon] Git watcher failed to start:",t)}),this.scheduleTick())}async stop(){this._running&&(this._running=!1,this.tickTimer&&(clearTimeout(this.tickTimer),this.tickTimer=void 0),this.gitWatcher.stop(),this._memory&&await this._memory.set("quality-daemon:state",{stoppedAt:Date.now(),tickCount:this._tickCount,commitsAnalyzed:this._commitsAnalyzed,suggestionsGenerated:this._suggestionsGenerated}))}getStatus(){return{running:this._running,uptimeSeconds:this._running?Math.floor((Date.now()-this._startedAt)/1e3):0,tickCount:this._tickCount,queueDepth:this.queue.depths,lastTickAt:this._lastTickAt,throttled:this._throttled,commitsAnalyzed:this._commitsAnalyzed,suggestionsGenerated:this._suggestionsGenerated,notificationsSent:this.notificationService.sentCount,ciHealth:this._ciHealth,coverageHealth:this._coverageHealth,lastCICheck:this._lastCICheck,lastCoverageCheck:this._lastCoverageCheck}}scheduleTick(){this._running&&(this.tickTimer=setTimeout(()=>this.tick(),this.config.tickIntervalMs),this.tickTimer.unref?.())}async tick(){if(!(!this._running||!this._memory)){if(this._tickCount++,this._lastTickAt=Date.now(),this._throttled=this.isResourceConstrained(),this._throttled){await this.processNowItems(this._memory),this.scheduleTick();return}await this.processQueue(this._memory),await this.runPeriodicChecks(this._memory),this.nightlyConsolidation.scheduleIfDue(),this.queue.pruneExpired(),this.scheduleTick()}}async processQueue(e){let t=0,i=10;for(;t<i&&!this.queue.isEmpty;){let r=this.queue.dequeue();if(!r)break;await this.handleQueueItem(r,e),t++}}async processNowItems(e){let t=this.queue.drainPriority("now");for(let i of t)await this.handleQueueItem(i,e)}async handleQueueItem(e,t){let i=e.payload;switch(i.type){case"git_commit":{this._commitsAnalyzed++;let r=await this.coverageDelta.buildSnapshot(t);if(r){let o=await this.coverageDelta.analyze(r,t,i.changedFiles);if(o.regressionDetected&&await this.notificationService.send({type:"coverage_drop",title:"Coverage Regression Detected",message:`Line coverage delta: ${o.overallDelta.line.toFixed(1)}% (${o.affectedFiles.length} files affected)`,severity:"high",metadata:{delta:o.overallDelta,commit:i.commitHash}}),o.newGaps.length>0){let n=await this.testSuggester.suggest(o.newGaps,i.changedFiles,t);this._suggestionsGenerated+=n.length,n.length>0&&await this.notificationService.send({type:"suggestion_available",title:"New Test Suggestions Available",message:`${n.length} test suggestions generated for uncovered code`,severity:"info",metadata:{count:n.length}})}}break}case"coverage_delta":{let r=await this.testSuggester.getPending(t);r.length>0&&await this.notificationService.send({type:"suggestion_available",title:"Test Suggestions Pending",message:`${r.length} test suggestions awaiting review`,severity:"info",metadata:{count:r.length}});break}case"gate_failure":await this.notificationService.send({type:"gate_failure",title:`Quality Gate Failed: ${i.gateName}`,message:`Score ${i.score} below threshold ${i.threshold}`,severity:"critical",metadata:{gate:i.gateName,score:i.score,threshold:i.threshold}});break;case"ci_failure":await this.notificationService.send({type:"ci_failure",title:`CI Failure: ${i.workflowName}`,message:`Workflow ${i.workflowName} run #${i.runId} concluded: ${i.conclusion}`,severity:"high",metadata:{workflow:i.workflowName,runId:i.runId}});break;case"nightly":{let r={coverageHealth:this._coverageHealth,ciHealth:this._ciHealth,commitsAnalyzed:this._commitsAnalyzed,suggestionsGenerated:this._suggestionsGenerated,notificationsSent:this.notificationService.sentCount,queueDepthAvg:this.queue.size,uptimeSeconds:Math.floor((Date.now()-this._startedAt)/1e3)};await this.nightlyConsolidation.execute(t,r);break}default:console.warn("[QualityDaemon] Unhandled payload type:",i.type)}}async runPeriodicChecks(e){let t=Date.now();if(!this._lastCICheck||t-this._lastCICheck>=this.config.ciPollIntervalMs)try{let i=await this.ciMonitor.check();this._ciHealth=i.healthScore,this._lastCICheck=t,i.flakyWorkflows.length>0&&await this.notificationService.send({type:"flaky_detected",title:"Flaky Workflows Detected",message:`${i.flakyWorkflows.length} workflows showing repeated failures: ${i.flakyWorkflows.join(", ")}`,severity:"medium",metadata:{workflows:i.flakyWorkflows}})}catch{}if(!this._lastCoverageCheck||t-this._lastCoverageCheck>=this.config.coverageCheckIntervalMs)try{let i=await this.coverageDelta.buildSnapshot(e);if(i){let r=[i.overall.line,i.overall.branch,i.overall.function,i.overall.statement].filter(o=>typeof o=="number");this._coverageHealth=Math.round(r.reduce((o,n)=>o+n,0)/r.length),this._lastCoverageCheck=t}}catch{}}isResourceConstrained(){if(1-he()/me()>this.config.memoryThreshold)return!0;let t=de().length;return(t>0?pe()[0]/t:0)>this.config.cpuThreshold}};export{ge as a,fe as b,ye as c,R as d,z as e};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.
|
|
2
|
-
import{b as M}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.9");process.exit(0)}
|
|
2
|
+
import{b as M}from"./chunk-XOLDMK23.js";import{j as D,k as x,l as k,n as h}from"./chunk-AR2E4B7K.js";import{c as y}from"./chunk-5LAAZLUC.js";import N from"chalk";import*as m from"fs";import*as d from"path";var T=["coverage/coverage-final.json","coverage/coverage-summary.json",".coverage/coverage-final.json"];function E(e){for(let t of T){let n=d.join(e,t);if(m.existsSync(n))try{let r=m.readFileSync(n,"utf-8"),a=JSON.parse(r);if(a.total&&a.total.lines)return w(a,e);let o=new Map;for(let s of y(r).files)o.set(s.path,s);return o.size>0?o:null}catch{continue}}return null}function w(e,t){let n=new Map;for(let[r,a]of Object.entries(e)){if(r==="total")continue;let o=a;n.set(r,{path:r,lines:{covered:o.lines.covered,total:o.lines.total},branches:{covered:o.branches.covered,total:o.branches.total},functions:{covered:o.functions.covered,total:o.functions.total},statements:{covered:o.statements.covered,total:o.statements.total},uncoveredLines:[],uncoveredBranches:[]})}return n.size>0?n:null}function j(e,t){let r=t.split(`
|
|
3
3
|
`).length,o=[e.replace(".ts",".test.ts").replace("/src/","/tests/"),e.replace(".ts",".spec.ts").replace("/src/","/tests/"),e.replace(".ts",".test.ts"),e.replace("/src/","/test/").replace(".ts",".test.ts")].some(g=>m.existsSync(g)),s=(t.match(/\bexport\b/g)||[]).length,i=(t.match(/\b(function|=>)\b/g)||[]).length,c=(t.match(/\b(if|switch|case|\?\?|\|\|)\b/g)||[]).length,l;if(o){let g=Math.min(c*.005,.15),b=Math.min(r*1e-4,.1);l=.85-g-b}else l=.2+(s>5?.1:0);l=Math.max(.05,Math.min(.95,l));let u=Math.floor(r*l),f=Math.max(i,1),C=Math.max(c,1),F=Math.floor(u*.7),S=Math.floor(f*l*.9),v=Array.from({length:r-u},(g,b)=>b+u+1);return{path:e,lines:{covered:u,total:r},branches:{covered:Math.min(F,C),total:C},functions:{covered:Math.min(S,f),total:f},statements:{covered:u,total:r},uncoveredLines:v,uncoveredBranches:v.slice(0,Math.floor(v.length/2))}}function p(e){let t=s=>e.reduce((i,c)=>i+s(c),0),n=(s,i)=>i>0?Math.round(s/i*100):0,r=t(s=>s.lines.total),a=t(s=>s.lines.covered),o=t(s=>s.statements.total);return{line:n(a,r),branch:n(t(s=>s.branches.covered),t(s=>s.branches.total)),function:n(t(s=>s.functions.covered),t(s=>s.functions.total)),statement:o>0?n(t(s=>s.statements.covered),o):n(a,r),files:e.length}}function R(e,t){let n=t||process.cwd(),r=E(n),a=[],o=[],s=!1;if(r&&r.size>0){s=!0;for(let i of e){let c=d.resolve(i),l=r.get(c)||r.get(i)||r.get(d.relative(n,c));l?a.push({...l,path:i}):o.push(i)}}else for(let i of e){let c=m.existsSync(i)?m.readFileSync(i,"utf-8"):"";a.push(j(i,c))}return{files:a,summary:p(a),instrumented:s,...o.length>0?{unmeasuredFiles:o}:{}}}var A=3,z="instrumented-report",O="static-estimation";async function I(e,t=n=>console.log(n)){let n=await D(e);if(n.status==="target-missing")return{kind:"no-data",reason:"target-missing",message:h("target-missing",e,null)};if(n.status==="evaluated"){let{evaluation:a,projectRoot:o}=n;if(a.status==="measured"){let s=a.files;return{kind:"data",data:{files:s,summary:p(s),instrumented:!0},projectRoot:o}}return{kind:"no-data",reason:a.reason,message:h(a.reason,e,o)}}let r=M(n.target,{includeTests:!1});return r.length===0?{kind:"no-sources"}:(t(N.gray(` Analyzing ${r.length} files...
|
|
4
4
|
`)),{kind:"data",data:R(r,n.projectRoot),projectRoot:n.projectRoot})}function P(e){return{branch:e.files.some(t=>t.branches.total>0),function:e.files.some(t=>t.functions.total>0),statement:e.files.some(t=>t.statements.total>0)}}var L=e=>e==="target-missing"||e==="unreadable-report";function _(){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 G(e,t,n,r){let a=await I(t,r);if(a.kind==="no-sources")return a;if(a.kind==="no-data")return L(a.reason)?{kind:"error",reason:a.reason,message:a.message}:{kind:"unmeasured",reason:a.reason,message:a.message};let o=a.data,s=o.instrumented,i=await e.analyze({coverageData:o,threshold:n,includeFileDetails:!0,measured:s,...a.projectRoot?{projectRoot:a.projectRoot}:{}});if(!i.success||!i.value)return{kind:"analysis-failed",message:i.error?.message||"Coverage analysis failed"};let c=i.value;if(!s)return{kind:"estimate",data:o,summary:{...c.summary},message:_()};let l=P(o),u=x(c.summary,n,l);return{kind:"measured",data:o,collected:l,verdict:u,summary:{...c.summary,branch:l.branch?c.summary.branch:null,function:l.function?c.summary.function:null,statement:l.statement?c.summary.statement:null},recommendations:k(c.recommendations??[],u,n,l)}}function X(e,t){switch(e.kind){case"measured":{let{overall:n,meetsThreshold:r}=e.verdict;return r?n<t+5?2:0:1}case"estimate":case"unmeasured":return A;case"no-sources":return 0;default:return 1}}function $(e,t,n){let r={line:null,branch:null,function:null,statement:null};switch(e.kind){case"measured":return{summary:e.summary,meetsThreshold:e.verdict.meetsThreshold,threshold:t,recommendations:e.recommendations,measured:!0,estimated:!1,coverageMethod:z,branchDataCollected:e.collected.branch,functionDataCollected:e.collected.function,statementDataCollected:e.collected.statement,...e.data.unmeasuredFiles?.length?{unmeasuredFiles:e.data.unmeasuredFiles}:{}};case"estimate":return{summary:e.summary,meetsThreshold:null,threshold:t,measured:!1,estimated:!0,unmeasured:!0,coverageMethod:O,reason:"no-coverage-report",target:n,warning:e.message};case"unmeasured":case"error":return{summary:r,meetsThreshold:null,threshold:t,measured:!1,unmeasured:e.kind==="unmeasured",reason:e.reason,target:n,warning:e.message};case"analysis-failed":return{summary:r,meetsThreshold:null,threshold:t,measured:!1,target:n,error:e.message};case"no-sources":return{summary:r,meetsThreshold:null,threshold:t,measured:!1,target:n,warning:"No source files found"}}}export{A as a,I as b,G as c,X as d,$ as e};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.
|
|
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.9");process.exit(0)}
|
|
2
2
|
var s={"test-generation":/test|spec|describe|it\(|expect|assert|mock|stub|fixture|tdd|bdd/i,"test-execution":/run|execute|parallel|retry|flaky|timeout|worker|orchestrat/i,"coverage-analysis":/coverage|branch|line|uncovered|gap|untested|percentage|sublinear/i,"quality-assessment":/quality|gate|deploy|readiness|metric|threshold|sla|score/i,"defect-intelligence":/defect|bug|predict|root.?cause|regression|failure|incident/i,"requirements-validation":/requirement|bdd|gherkin|testabil|accept|criteri|scenario/i,"code-intelligence":/semantic|knowledge|graph|ast|symbol|reference|impact|depend/i,"security-compliance":/vuln|cve|owasp|xss|sqli|injection|csrf|auth|secret|compliance|sast|dast/i,"contract-testing":/contract|pact|openapi|swagger|graphql|schema|endpoint|api/i,"visual-accessibility":/screenshot|visual|snapshot|pixel|percy|a11y|aria|wcag|screen.?reader|accessible|contrast/i,"chaos-resilience":/chaos|resilience|fault|inject|blast|recover|latency|failure|stress|load/i,"learning-optimization":/learn|pattern|optim|neural|embedding|vector|memory|adapt|train/i};function m(e){for(let[t,a]of Object.entries(s))if(a.test(e))return t;return null}function u(e){let t=[];for(let[a,n]of Object.entries(s))n.test(e)&&t.push(a);return t}function d(e){return e}function p(e){let t=Math.min(e.usageCount/100,1);return e.confidence*.3+t*.2+e.successRate*.5}var c=3,l=.7;function y(e,t,a=.4){let n=e.tier==="short-term"&&e.successfulUses>=c,r=e.successRate>=l&&e.confidence>=.6,i=t===void 0||t<a,o;return n?r?i||(o="coherence_violation"):o="low_quality":o="insufficient_usage",{meetsUsageCriteria:n,meetsQualityCriteria:r,meetsCoherenceCriteria:i,blockReason:o}}function f(e){let t=[];if(e.id||t.push("Pattern ID is required"),e.patternType||t.push("Pattern type is required"),e.qeDomain||t.push("QE domain is required"),e.name||t.push("Pattern name is required"),e.template?.content||t.push("Template content is required"),e.confidence!==void 0&&(e.confidence<0||e.confidence>1)&&t.push("Confidence must be between 0 and 1"),e.successRate!==void 0&&(e.successRate<0||e.successRate>1)&&t.push("Success rate must be between 0 and 1"),e.template?.variables){let a=new Set;for(let n of e.template.variables)a.has(n.name)&&t.push(`Duplicate variable name: ${n.name}`),a.add(n.name),e.template.content.includes(`{{${n.name}}}`)||t.push(`Variable ${n.name} not referenced in template`)}return{valid:t.length===0,errors:t}}function g(e,t){let a=e.content;for(let n of e.variables){let r=t[n.name]??n.defaultValue;if(n.required&&r===void 0)throw new Error(`Required variable ${n.name} not provided`);if(r!==void 0){let i=`{{${n.name}}}`,o=typeof r=="object"?JSON.stringify(r):String(r);a=a.split(i).join(o)}}return a}var b=Object.keys(s);export{m as a,u as b,d as c,p as d,c as e,l as f,y as g,f as h,g as i,b as j};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.
|
|
2
|
-
import{o as K,s as ot}from"./chunk-ZLVQSEZK.js";import{a as G,d as at}from"./chunk-HTWIGQL4.js";import{a as nt,b as it}from"./chunk-Q2T5FXEA.js";import{a as rt}from"./chunk-VJRZFWR5.js";import{e as U}from"./chunk-JYXOFN3E.js";import{a as j,e as et}from"./chunk-LVEX4GID.js";import{b as H,d as V,f as w}from"./chunk-HSDOOFV7.js";var Z={};V(Z,{DotProductAttention:()=>yt,FlashAttention:()=>ft,HyperbolicAttention:()=>At,LinearAttention:()=>vt,MoEAttention:()=>Et,MultiHeadAttention:()=>bt,RuvectorLayer:()=>ut,SonaEngine:()=>T,TensorCompress:()=>ht,default:()=>ct,differentiableSearch:()=>mt,getCompressionLevel:()=>pt,hierarchicalForward:()=>dt,init:()=>gt,pipeline:()=>Ft});import{createRequire as st}from"module";var lt,$,ct,ut,ht,mt,dt,pt,gt,ft,yt,bt,At,vt,Et,T,Ft,k=H(()=>{lt=st(import.meta.url),$=lt("@ruvector/sona"),ct=$,{RuvectorLayer:ut,TensorCompress:ht,differentiableSearch:mt,hierarchicalForward:dt,getCompressionLevel:pt,init:gt,FlashAttention:ft,DotProductAttention:yt,MultiHeadAttention:bt,HyperbolicAttention:At,LinearAttention:vt,MoEAttention:Et,SonaEngine:T,pipeline:Ft}=$||{}});var N={};V(N,{DotProductAttention:()=>zt,FlashAttention:()=>It,HyperbolicAttention:()=>_t,LinearAttention:()=>Ht,MoEAttention:()=>Vt,MultiHeadAttention:()=>qt,RuvectorLayer:()=>Qt,SonaEngine:()=>jt,TensorCompress:()=>Nt,default:()=>xt,differentiableSearch:()=>Ot,getCompressionLevel:()=>Wt,hierarchicalForward:()=>Dt,init:()=>Bt,pipeline:()=>Ut});import{createRequire as kt}from"module";var Rt,X,xt,Qt,Nt,Ot,Dt,Wt,Bt,It,zt,qt,_t,Ht,Vt,jt,Ut,O=H(()=>{Rt=kt(import.meta.url),X=Rt("@ruvector/attention"),xt=X,{RuvectorLayer:Qt,TensorCompress:Nt,differentiableSearch:Ot,hierarchicalForward:Dt,getCompressionLevel:Wt,init:Bt,FlashAttention:It,DotProductAttention:zt,MultiHeadAttention:qt,HyperbolicAttention:_t,LinearAttention:Ht,MoEAttention:Vt,SonaEngine:jt,pipeline:Ut}=X||{}});k();at();import{randomUUID as Ct}from"crypto";rt();import{createRequire as wt}from"module";var f=U.create("sona-three-loop"),S=wt(import.meta.url),M=null,J=!1;function St(){if(J)return M;J=!0;try{let l=S("@ruvector/learning-wasm"),t=S("fs"),e=S("path"),r=e.join(e.dirname(S.resolve("@ruvector/learning-wasm")),"ruvector_learning_wasm_bg.wasm");l.initSync({module:t.readFileSync(r)}),M=l,f.info("WASM MicroLoRA loaded from @ruvector/learning-wasm (6.4x faster than TS)")}catch{M=null,f.debug("@ruvector/learning-wasm not available, using TypeScript MicroLoRA")}return M}var Mt={dimension:384,microLoraLr:.001,consolidationInterval:100,ewcLambda:1e3,taskBoundaryZScoreThreshold:2.5,fisherDecay:.9,fisherSampleSize:200,importanceThreshold:.01},R=class{adaptationVector;baseWeights;lr;adaptationCount=0;constructor(t,e=.001){this.adaptationVector=new Float32Array(t),this.baseWeights=new Float32Array(t),this.lr=e}adapt(t){let e=this.baseWeights.length,r=new Float32Array(e),a=Math.min(t.length,e);for(let n=0;n<e;n++){let o=n<a?t[n]:0;r[n]=this.baseWeights[n]+this.adaptationVector[n]+this.lr*o}for(let n=0;n<a;n++)this.adaptationVector[n]+=this.lr*t[n];return this.adaptationCount++,r}consolidate(){let t=this.adaptationCount,e=this.baseWeights.length;for(let r=0;r<e;r++)this.baseWeights[r]+=this.adaptationVector[r],this.adaptationVector[r]=0;return this.adaptationCount=0,t}getAdaptationCount(){return this.adaptationCount}getEffectiveWeights(){let t=this.baseWeights.length,e=new Float32Array(t);for(let r=0;r<t;r++)e[r]=this.baseWeights[r]+this.adaptationVector[r];return e}getAdaptationMagnitude(){let t=0;for(let e=0;e<this.adaptationVector.length;e++)t+=this.adaptationVector[e]*this.adaptationVector[e];return Math.sqrt(t)}resetAdaptation(){this.adaptationVector.fill(0),this.adaptationCount=0}},x=class{fisherMatrix;optimalParams;lambda;fisherDecay;zScoreThreshold;importanceThreshold;gradientHistory=[];gradientMean=0;gradientVariance=0;taskBoundaryCount=0;consolidationCount=0;constructor(t,e=1e3,r=.9,a=2.5,n=.01){this.fisherMatrix=new Float32Array(t),this.optimalParams=new Float32Array(t),this.lambda=e,this.fisherDecay=r,this.zScoreThreshold=a,this.importanceThreshold=n}detectTaskBoundary(t){let e=0;for(let i=0;i<t.length;i++)e+=t[i]*t[i];if(e=Math.sqrt(e),this.gradientHistory.length<5)return this.gradientHistory.push(e),this.updateGradientStats(),!1;let r=Math.sqrt(this.gradientVariance),a=0,n=Math.abs(e-this.gradientMean);return r>1e-10?a=n/r:n>1e-10&&this.gradientMean>1e-10&&(a=n/(this.gradientMean*.01+1e-10)),this.gradientHistory.push(e),this.gradientHistory.length>100&&this.gradientHistory.shift(),this.updateGradientStats(),a>this.zScoreThreshold?(this.taskBoundaryCount++,!0):!1}computeLoss(t){let e=0,r=Math.min(t.length,this.fisherMatrix.length,this.optimalParams.length);for(let a=0;a<r;a++){let n=t[a]-this.optimalParams[a];e+=this.fisherMatrix[a]*n*n}return this.lambda/2*e}updateFisher(t,e){if(t.length===0)return;let r=this.fisherMatrix.length,a=new Float32Array(r);for(let s of t){let u=Math.min(s.length,r);for(let c=0;c<u;c++)a[c]+=s[c]*s[c]}let n=t.length;for(let s=0;s<r;s++)a[s]/=n;let o=this.fisherDecay;for(let s=0;s<r;s++)this.fisherMatrix[s]=o*this.fisherMatrix[s]+(1-o)*a[s];let i=Math.min(e.length,r);for(let s=0;s<i;s++)this.optimalParams[s]=e[s];this.consolidationCount++}getMetrics(){let t=this.fisherMatrix.length,e=0,r=0,a=0;for(let n=0;n<t;n++)e+=this.fisherMatrix[n],this.fisherMatrix[n]>r&&(r=this.fisherMatrix[n]),this.fisherMatrix[n]>this.importanceThreshold&&a++;return{regularizationLoss:0,taskBoundariesDetected:this.taskBoundaryCount,fisherTrace:e,avgFisherImportance:t>0?e/t:0,maxFisherImportance:r,protectedParams:a,consolidationCycles:this.consolidationCount,lambda:this.lambda}}getTaskBoundaryCount(){return this.taskBoundaryCount}getFisherDiagonal(){return new Float32Array(this.fisherMatrix)}getOptimalParams(){return new Float32Array(this.optimalParams)}loadFisher(t,e){let r=this.fisherMatrix.length,a=Math.min(t.length,r),n=Math.min(e.length,r);for(let o=0;o<a;o++)this.fisherMatrix[o]=t[o];for(let o=0;o<n;o++)this.optimalParams[o]=e[o]}updateGradientStats(){let t=this.gradientHistory.length;if(t===0)return;let e=0;for(let a of this.gradientHistory)e+=a;e/=t;let r=0;for(let a of this.gradientHistory){let n=a-e;r+=n*n}r=t>1?r/(t-1):0,this.gradientMean=e,this.gradientVariance=r}},C=class{config;microLora;ewc;nativeEngine;wasmLora=null;requestCount=0;lastConsolidationRequest=0;peerStates=new Map;gradientBuffer=[];lastFeatures=null;constructor(t={},e){this.config={...Mt,...t},this.nativeEngine=e??null,this.microLora=new R(this.config.dimension,this.config.microLoraLr),this.ewc=new x(this.config.dimension,this.config.ewcLambda,this.config.fisherDecay,this.config.taskBoundaryZScoreThreshold,this.config.importanceThreshold);let r=St();if(r)try{this.wasmLora=new r.WasmMicroLoRA(this.config.dimension,1,this.config.microLoraLr),f.info("SONA Three-Loop using WASM MicroLoRA (0.07us/adapt)")}catch(a){f.debug("WASM MicroLoRA creation failed, falling back",{error:String(a)}),this.wasmLora=null}!this.wasmLora&&this.nativeEngine&&f.info("SONA Three-Loop using native @ruvector/sona engine for MicroLoRA delegation")}instantAdapt(t){let e=performance.now(),r;if(this.wasmLora)try{let o=new Float32Array(t),i=this.wasmLora.adapt(o);i&&i.length>0?(r=i,this.microLora.adapt(t)):r=this.microLora.adapt(t)}catch{r=this.microLora.adapt(t)}else if(this.nativeEngine)try{let o=this.nativeEngine.applyMicroLora(t);r=new Float32Array(o),this.microLora.adapt(t)}catch{r=this.microLora.adapt(t)}else r=this.microLora.adapt(t);let a=this.microLora.getAdaptationMagnitude();this.requestCount++,this.lastFeatures=[...t];let n=(performance.now()-e)*1e3;return{adaptedWeights:r,latencyUs:n,applied:!0,magnitude:a,requestIndex:this.requestCount}}recordOutcome(t,e){if(this.lastFeatures===null){f.warn("recordOutcome called without a preceding instantAdapt()");return}let r=this.lastFeatures.length,a=new Float32Array(r);for(let n=0;n<r;n++)a[n]=t*this.lastFeatures[n];this.gradientBuffer.push(a),this.gradientBuffer.length>this.config.fisherSampleSize&&this.gradientBuffer.shift(),this.lastFeatures=null}backgroundConsolidate(){let t=performance.now();if(this.nativeEngine)try{this.nativeEngine.forceLearn(),this.nativeEngine.tick()}catch(i){f.warn("Native SONA background learning failed, continuing with TypeScript",{error:String(i)})}let e=this.ewc.computeLoss(this.microLora.getEffectiveWeights()),r=!1;if(this.gradientBuffer.length>0){let i=this.gradientBuffer[this.gradientBuffer.length-1];r=this.ewc.detectTaskBoundary(i)}if(r&&this.gradientBuffer.length>0&&(this.ewc.updateFisher(this.gradientBuffer,this.microLora.getEffectiveWeights()),f.info("Task boundary detected, Fisher updated",{boundaries:this.ewc.getTaskBoundaryCount(),requestCount:this.requestCount})),this.gradientBuffer.length>1){let i=!1,s=this.gradientBuffer[0];for(let u=1;u<this.gradientBuffer.length&&!i;u++)for(let c=0;c<s.length;c++)if(Math.abs(this.gradientBuffer[u][c]-s[c])>1e-8){i=!0;break}i||f.warn("All gradient samples identical \u2014 Fisher estimate may be poor. Ensure recordOutcome() is called with diverse rewards.")}let a=this.microLora.consolidate();this.applyEWCRegularization();let n=this.ewc.computeLoss(this.microLora.getEffectiveWeights());this.lastConsolidationRequest=this.requestCount,this.gradientBuffer=[];let o=performance.now()-t;return{consolidated:a>0||r,adaptationsMerged:a,ewcLossBefore:e,ewcLossAfter:n,taskBoundaryDetected:r,durationMs:o}}shouldConsolidate(){return this.requestCount-this.lastConsolidationRequest>=this.config.consolidationInterval}syncWithPeers(t){if(t.length===0)return;for(let i of t)this.peerStates.set(i.peerId,i);let e=this.config.dimension,r=new Float32Array(e),a=new Float32Array(e),n=this.ewc.getFisherDiagonal(),o=this.microLora.adaptationVector;for(let i=0;i<e;i++){let s=n[i]+1e-10;r[i]+=s*o[i],a[i]+=s}for(let i of t){let s=Math.min(i.adaptationVector.length,e);for(let u=0;u<s;u++){let c=(u<i.fisherDiagonal.length?i.fisherDiagonal[u]:0)+1e-10;r[u]+=c*i.adaptationVector[u],a[u]+=c}}for(let i=0;i<e;i++)this.microLora.adaptationVector[i]=r[i]/a[i];f.debug("Synced with peers",{peerCount:t.length,peersStored:this.peerStates.size})}getLocalPeerState(t,e){return{peerId:t,domain:e,adaptationVector:new Float32Array(this.microLora.adaptationVector),fisherDiagonal:this.ewc.getFisherDiagonal(),requestCount:this.requestCount,lastUpdateMs:Date.now()}}getEWCMetrics(){let t=this.ewc.getMetrics();return t.regularizationLoss=this.ewc.computeLoss(this.microLora.getEffectiveWeights()),t}getFisherDiagonal(){return this.ewc.getFisherDiagonal()}getOptimalParams(){return this.ewc.getOptimalParams()}loadFisher(t,e){this.ewc.loadFisher(t,e)}getBaseWeights(){return new Float32Array(this.microLora.baseWeights)}setBaseWeights(t){let e=Math.min(t.length,this.microLora.baseWeights.length);for(let r=0;r<e;r++)this.microLora.baseWeights[r]=t[r]}getEffectiveWeights(){return this.microLora.getEffectiveWeights()}getRequestCount(){return this.requestCount}restoreRequestCount(t){this.requestCount=t}getConfig(){return{...this.config}}getPeerStates(){return new Map(this.peerStates)}getMicroLoRA(){return this.microLora}getEWC(){return this.ewc}applyEWCRegularization(){let t=this.config.dimension,e=this.ewc.fisherMatrix,r=this.ewc.optimalParams,a=this.microLora.baseWeights,n=.01;for(let o=0;o<t;o++)if(e[o]>this.config.importanceThreshold){let i=a[o]-r[o];a[o]-=n*e[o]*i}}persistFisher(t,e){let r=this.ewc.getMetrics();t(e,this.ewc.getFisherDiagonal(),this.ewc.getOptimalParams(),this.getBaseWeights(),{taskBoundaries:r.taskBoundariesDetected,consolidationCycles:r.consolidationCycles,requestCount:this.requestCount,ewcLambda:r.lambda}),f.info("Fisher matrix persisted to SQLite",{domain:e,requestCount:this.requestCount,taskBoundaries:r.taskBoundariesDetected})}restoreFisher(t){this.ewc.loadFisher(t.fisherDiagonal,t.optimalParams),t.baseWeights&&this.setBaseWeights(t.baseWeights),this.requestCount=t.requestCount,f.info("Fisher matrix restored from SQLite",{requestCount:t.requestCount,dimension:t.fisherDiagonal.length})}};var Lt={hiddenDim:256,embeddingDim:384,microLoraRank:1,baseLoraRank:8,microLoraLr:.001,baseLoraLr:1e-4,ewcLambda:1e3,patternClusters:50,trajectoryCapacity:1e4,backgroundIntervalMs:36e5,qualityThreshold:.5,enableSimd:!0,minConfidence:.5,maxPatterns:1e4},Q=class{patterns;trajectoryMap;maxPatterns;constructor(t=1e4){this.patterns=new Map,this.trajectoryMap=new Map,this.maxPatterns=t}register(t){if(this.patterns.size>=this.maxPatterns&&!this.patterns.has(t.id)){let e=Array.from(this.patterns.entries()).sort(([,r],[,a])=>(r.lastUsedAt?.getTime()??r.createdAt.getTime())-(a.lastUsedAt?.getTime()??a.createdAt.getTime()))[0];e&&this.patterns.delete(e[0])}this.patterns.set(t.id,t)}get(t){return this.patterns.get(t)}getByTrajectory(t){let e=this.trajectoryMap.get(t);return e?this.patterns.get(e):void 0}associateTrajectory(t,e){this.trajectoryMap.set(t,e)}update(t,e){let r=this.patterns.get(t);return r?(this.patterns.set(t,{...r,...e}),!0):!1}getAll(){return Array.from(this.patterns.values())}getByType(t){return Array.from(this.patterns.values()).filter(e=>e.type===t)}getByDomain(t){return Array.from(this.patterns.values()).filter(e=>e.domain===t)}delete(t){let e=this.patterns.delete(t);for(let[r,a]of this.trajectoryMap)a===t&&this.trajectoryMap.delete(r);return e}clear(){this.patterns.clear(),this.trajectoryMap.clear()}size(){return this.patterns.size}},v=class{engine;registry;config;adaptationTimes=[];cacheHits=0;totalAdaptations=0;threeLoopEngine=null;fisherPersistFn=null;fisherDomain="default";constructor(t={}){this.config={...Lt,...t};let e={hiddenDim:this.config.hiddenDim,embeddingDim:this.config.embeddingDim,microLoraRank:this.config.microLoraRank,baseLoraRank:this.config.baseLoraRank,microLoraLr:this.config.microLoraLr,baseLoraLr:this.config.baseLoraLr,ewcLambda:this.config.ewcLambda,patternClusters:this.config.patternClusters,trajectoryCapacity:this.config.trajectoryCapacity,backgroundIntervalMs:this.config.backgroundIntervalMs,qualityThreshold:this.config.qualityThreshold,enableSimd:this.config.enableSimd};this.engine=T.withConfig(e),this.registry=new Q(this.config.maxPatterns??1e4)}async adaptPattern(t,e,r){let a=performance.now();try{let n=this.createStateEmbedding(t),o=this.engine.findPatterns(n,5),i=[];for(let h of o){let g=this.findByRawPattern(h);if(g||(g=this.createQEPatternFromRaw(h,e,r)),g.type===e&&g.domain===r&&g.confidence>=(this.config.minConfidence??.5)){let m=this.calculateSimilarity(n,h.centroid);i.push({pattern:g,similarity:m})}}if(i.length===0){let h=performance.now()-a;return this.recordAdaptation(h),{success:!1,pattern:null,adaptationTimeMs:h,similarity:0,reasoning:"No suitable pattern found"}}let s=i[0],u={...s.pattern,usageCount:s.pattern.usageCount+1,lastUsedAt:new Date};this.registry.update(u.id,u);let c=performance.now()-a;return this.recordAdaptation(c),{success:!0,pattern:u,adaptationTimeMs:c,similarity:s.similarity,reasoning:`Pattern adapted from @ruvector/sona with ${s.similarity.toFixed(3)} similarity`}}catch(n){let o=performance.now()-a;return this.recordAdaptation(o),{success:!1,pattern:null,adaptationTimeMs:o,similarity:0,reasoning:`Adaptation failed: ${n.message}`}}}recallPattern(t,e,r){let a=this.createStateEmbedding(t),n=this.engine.findPatterns(a,1);for(let o of n){let i=this.findByRawPattern(o);if(i&&i.type===e&&i.domain===r)return i}return null}storePattern(t){this.registry.register(t);let e=this.engine.beginTrajectory(t.stateEmbedding),r=this.createActionEmbedding(t.action),a=new Array(r.length).fill(1),n=t.outcome.success?t.outcome.quality:-t.outcome.quality;this.engine.addTrajectoryStep(e,r,a,n),this.engine.endTrajectory(e,t.outcome.quality),this.registry.associateTrajectory(e,t.id)}storePatternsBatch(t){for(let e of t)this.storePattern(e)}createPattern(t,e,r,a,n,o){let i={id:`qesona-${Date.now()}-${Ct().slice(0,7)}`,type:a,domain:n,stateEmbedding:this.createStateEmbedding(t),action:e,outcome:r,confidence:.5,usageCount:0,createdAt:new Date,metadata:o};return this.storePattern(i),i}updatePattern(t,e,r){let a=this.registry.get(t);if(!a)return!1;let n=e?r:-r,i=a.confidence+.1*(n-a.confidence),s={...a,confidence:Math.max(0,Math.min(1,i)),usageCount:a.usageCount+1,lastUsedAt:new Date};return this.registry.update(t,s)}applyMicroLora(t){return this.engine.applyMicroLora(t)}applyBaseLora(t,e){return this.engine.applyBaseLora(t,e)}forceLearn(){return this.engine.forceLearn()}tick(){return this.engine.tick()}getAllPatterns(){return this.registry.getAll()}getPatternsByType(t){return this.registry.getByType(t)}getPatternsByDomain(t){return this.registry.getByDomain(t)}getStats(){let t=this.registry.getAll(),e=this.engine.getStats(),r={"test-generation":0,"defect-prediction":0,"coverage-optimization":0,"quality-assessment":0,"resource-allocation":0};for(let a of t)r[a.type]++;return{totalPatterns:t.length,patternsByType:r,avgAdaptationTimeMs:this.avgAdaptationTime(),minAdaptationTimeMs:this.minAdaptationTime(),maxAdaptationTimeMs:this.maxAdaptationTime(),totalAdaptations:this.totalAdaptations,cacheHitRate:this.totalAdaptations>0?this.cacheHits/this.totalAdaptations:0,engineStats:e}}deletePattern(t){return this.registry.delete(t)}clear(){this.registry.clear(),this.adaptationTimes=[],this.cacheHits=0,this.totalAdaptations=0}exportPatterns(){return this.registry.getAll()}importPatterns(t){this.clear(),this.storePatternsBatch(t)}getConfig(){return{...this.config}}setEnabled(t){this.engine.setEnabled(t)}isEnabled(){return this.engine.isEnabled()}createStateEmbedding(t){let e=t.features;if(e.length===0)return new Array(this.config.embeddingDim??384).fill(0);let r=Math.max(...e.map(Math.abs));if(r===0)return[...e];let a=e.map(o=>o/r),n=this.config.embeddingDim??384;return a.length>=n?a.slice(0,n):[...a,...new Array(n-a.length).fill(0)]}createActionEmbedding(t){let e=[],r=this.hashCode(t.type);if(e.push(r%1e3/1e3),typeof t.value=="number")e.push(Math.min(1,Math.max(-1,t.value)));else if(typeof t.value=="string"){let n=this.hashCode(t.value);e.push(n%1e3/1e3)}else if(Array.isArray(t.value))for(let n of t.value.slice(0,10))typeof n=="number"&&e.push(Math.min(1,Math.max(-1,n)));let a=this.config.embeddingDim??384;for(;e.length<a;)e.push(0);return e.slice(0,a)}findByRawPattern(t){let e=this.registry.getAll();for(let r of e)if(r.rawPattern?.patternType===t.id)return r}createQEPatternFromRaw(t,e,r){let a={centroid:t.centroid,clusterSize:1,totalWeight:1,avgQuality:t.avgQuality,createdAt:new Date().toISOString(),lastAccessed:new Date().toISOString(),accessCount:0,patternType:t.patternType};return{id:`qesona-${t.id}`,type:e,domain:r,stateEmbedding:t.centroid,action:{type:"learned",value:t.patternType},outcome:{reward:t.avgQuality,success:t.avgQuality>.5,quality:t.avgQuality},confidence:t.avgQuality,usageCount:0,createdAt:new Date,rawPattern:a}}calculateSimilarity(t,e){let r=Math.min(t.length,e.length),a=0,n=0,o=0;for(let s=0;s<r;s++)a+=t[s]*e[s],n+=t[s]*t[s],o+=e[s]*e[s];return(a/(Math.sqrt(n)*Math.sqrt(o)+1e-10)+1)/2}hashCode(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e=e|0;return Math.abs(e)}recordAdaptation(t){this.adaptationTimes.push(t),this.totalAdaptations++,this.adaptationTimes.length>1e3&&this.adaptationTimes.shift()}avgAdaptationTime(){return this.adaptationTimes.length===0?0:this.adaptationTimes.reduce((e,r)=>e+r,0)/this.adaptationTimes.length}minAdaptationTime(){return this.adaptationTimes.length===0?0:Math.min(...this.adaptationTimes)}maxAdaptationTime(){return this.adaptationTimes.length===0?0:Math.max(...this.adaptationTimes)}initThreeLoopEngine(t){this.threeLoopEngine=new C({dimension:this.config.embeddingDim??384,microLoraLr:this.config.microLoraLr??.001,ewcLambda:this.config.ewcLambda??1e3,...t},this.engine)}getThreeLoopEngine(){return this.threeLoopEngine}instantAdapt(t){return this.threeLoopEngine?this.threeLoopEngine.instantAdapt(t):null}recordOutcome(t,e){this.threeLoopEngine&&this.threeLoopEngine.recordOutcome(t,e)}backgroundConsolidate(){if(!this.threeLoopEngine)return null;let t=this.threeLoopEngine.backgroundConsolidate();if(t&&(t.consolidated||t.taskBoundaryDetected)&&this.fisherPersistFn)try{this.threeLoopEngine.persistFisher(this.fisherPersistFn,this.fisherDomain)}catch(e){console.warn("[QESONA] Fisher persistence failed:",e instanceof Error?e.message:e)}return t}setFisherPersistence(t,e){this.fisherPersistFn=t,this.fisherDomain=e}syncWithPeers(t){this.threeLoopEngine&&this.threeLoopEngine.syncWithPeers(t)}getEWCMetrics(){return this.threeLoopEngine?this.threeLoopEngine.getEWCMetrics():null}shouldConsolidate(){return this.threeLoopEngine?this.threeLoopEngine.shouldConsolidate():!1}getLocalPeerState(t,e){return this.threeLoopEngine?this.threeLoopEngine.getLocalPeerState(t,e):null}isThreeLoopEnabled(){return this.threeLoopEngine!==null}async verifyPerformance(t=1e3){let e=[],r={id:"test-state",features:new Array(384).fill(0).map(()=>G())};for(let s=0;s<t;s++){let u=performance.now();await this.adaptPattern(r,"test-generation","test-generation");let c=performance.now();e.push({iteration:s,timeMs:c-u})}let a=e.map(s=>s.timeMs),n=a.reduce((s,u)=>s+u,0)/a.length,o=Math.min(...a),i=Math.max(...a);return{targetMet:n<.05,avgTimeMs:n,minTimeMs:o,maxTimeMs:i,details:e}}};function Pt(l){return new v(l)}function Tt(l,t){return new v({...t,maxPatterns:t?.maxPatterns||5e3})}ot();et();var F=null,D=null,W=null,B=null,I=null,z=null,q=!1;try{let l=(O(),w(N));F=l.FlashAttention,D=l.DotProductAttention,W=l.MultiHeadAttention,B=l.HyperbolicAttention,I=l.LinearAttention,z=l.MoEAttention,q=!0}catch{}function Gt(){return q}function b(){if(!q)throw new Error("@ruvector/attention native module is not available on this platform. Install the appropriate optional dependency for your platform, or use a platform where pre-built binaries are available.")}var P={"test-similarity":{dim:384,strategy:"flash",blockSize:64},"code-embedding":{dim:512,strategy:"flash",blockSize:128},"defect-matching":{dim:384,strategy:"flash",blockSize:64},"coverage-analysis":{dim:384,strategy:"flash",blockSize:256},"pattern-adaptation":{dim:256,strategy:"flash",blockSize:32}},Kt={"test-similarity":{enabled:!0,microLoRARank:4,targetAdaptationMs:.05,patternCacheSize:1e3},"code-embedding":{enabled:!0,microLoRARank:2,targetAdaptationMs:.03,patternCacheSize:5e3},"defect-matching":{enabled:!0,microLoRARank:8,targetAdaptationMs:.05,patternCacheSize:2e3},"coverage-analysis":{enabled:!1,microLoRARank:2,targetAdaptationMs:.01,patternCacheSize:100},"pattern-adaptation":{enabled:!0,microLoRARank:2,targetAdaptationMs:.05,patternCacheSize:1e4}},$t={"test-similarity":{latency:{before:50,after:15},memory:{before:200,after:80},throughput:{min:1e3}},"code-embedding":{latency:{before:50,after:15},memory:{before:200,after:80},throughput:{min:2e3}},"defect-matching":{latency:{before:20,after:5},memory:{before:150,after:50},throughput:{min:500}},"coverage-analysis":{latency:{before:100,after:1},memory:{before:100,after:30},throughput:{min:1e4}},"pattern-adaptation":{latency:{before:2,after:.05},memory:{before:50,after:20},throughput:{min:2e4}}};function Zt(l){return l<=128?{queryChunkSize:128,kvChunkSize:128}:l<=256?{queryChunkSize:256,kvChunkSize:256}:l<=512?{queryChunkSize:512,kvChunkSize:512}:l<=1024?{queryChunkSize:1024,kvChunkSize:1024}:{queryChunkSize:1024,kvChunkSize:2048}}var E=class{static create(t){switch(b(),t.strategy){case"flash":return new F(t.dim,t.blockSize);case"dot-product":return new D(t.dim);case"multi-head":return new W(t.dim,t.numHeads??8);case"hyperbolic":return new B(t.dim,t.curvature);case"linear":return new I(t.dim,t.features);case"moe":return z.simple(t.dim,t.moeConfig?.numExperts??8,t.moeConfig?.topK??2);default:return new F(t.dim,t.blockSize)}}},L=class l{attention;config;workload;metrics=[];db=null;persistCount=0;static KV_NAMESPACE="attention-metrics";static KV_TTL=3600;static PERSIST_INTERVAL=10;constructor(t,e){this.workload=t;let r=P[t];this.config={...r,...e},this.attention=E.create(this.config)}async initialize(){try{this.db=K(),this.db.isInitialized()||await this.db.initialize(),await this.loadFromKv()}catch(t){console.warn("[QEFlashAttention] DB init failed, using memory-only:",j(t)),this.db=null}}async computeFlashAttention(t,e,r,a,n){let o=performance.now(),i=process.memoryUsage().heapUsed/1024/1024,s=this.toFloat32Array(t,a,n),u=this.splitMatrix(e,a,n),c=this.splitMatrix(r,a,n),h,g=this.attention;typeof g.compute=="function"?h=g.compute(s,u,c):(b(),h=new F(this.config.dim).compute(s,u,c));let m=performance.now(),d=process.memoryUsage().heapUsed/1024/1024;return this.metrics.push({timeMs:m-o,memoryMB:d-i,speedup:1,throughput:a*a/((m-o)/1e3),peakMemoryMB:d}),this.maybePersistToKv(),h}async computeBaselineAttention(t,e,r,a,n){let o=performance.now(),i=process.memoryUsage().heapUsed/1024/1024,s=new Float32Array(a*a),u=1/Math.sqrt(n);for(let m=0;m<a;m++)for(let d=0;d<a;d++){let A=0;for(let p=0;p<n;p++)A+=t[m*n+p]*e[d*n+p];s[m*a+d]=A*u}for(let m=0;m<a;m++){let d=m*a,A=d+a,p=s.subarray(d,A),tt=Math.max(...p),_=0;for(let y=0;y<a;y++)p[y]=Math.exp(p[y]-tt),_+=p[y];for(let y=0;y<a;y++)p[y]/=_}let c=new Float32Array(a*n);for(let m=0;m<a;m++)for(let d=0;d<a;d++){let A=s[m*a+d];for(let p=0;p<n;p++)c[m*n+p]+=A*r[d*n+p]}let h=performance.now(),g=process.memoryUsage().heapUsed/1024/1024;return c}async computeTestSimilarity(t,e,r=5){let a=e.length,n=t.length,o=new Float32Array(a*n),i=new Float32Array(a*n);for(let h=0;h<a;h++)o.set(t,h*n),i.set(e[h],h*n);let s=new Float32Array(a*n),u=await this.computeFlashAttention(o,i,s,a,n),c=[];for(let h=0;h<a;h++)c.push({index:h,similarity:u[h*n]});return c.sort((h,g)=>g.similarity-h.similarity),c.slice(0,r)}async generateCodeEmbedding(t,e){let r=t.length/e.length,a=e.length;return await this.computeFlashAttention(t,e,t,r,a)}async matchDefectPattern(t,e){let r=e.length,a=t.length,n=new Float32Array(r*a),o=new Float32Array(r*a);for(let c=0;c<r;c++)n.set(t,c*a),o.set(e[c],c*a);let i=new Float32Array(r*a),s=await this.computeFlashAttention(n,o,i,r,a),u=[];for(let c=0;c<r;c++)u.push({pattern:c,score:s[c*a]});return u.sort((c,h)=>h.score-c.score),u}getMetrics(){return[...this.metrics]}getAverageSpeedup(){return this.metrics.length===0?1:this.metrics.reduce((t,e)=>t+e.speedup,0)/this.metrics.length}getConfig(){return{...this.config}}updateConfig(t){this.config={...this.config,...t},this.attention=E.create(this.config)}changeStrategy(t){this.config.strategy=t,this.attention=E.create(this.config)}resetMetrics(){this.metrics=[]}getWorkload(){return this.workload}dispose(){this.metrics=[]}async persistToKv(){if(!this.db)return;let t=`attention-metrics-${this.workload}`,e={workload:this.workload,metrics:this.metrics.slice(-50),savedAt:Date.now()};await this.db.kvSet(t,e,l.KV_NAMESPACE,l.KV_TTL)}async loadFromKv(){if(!this.db)return;let t=`attention-metrics-${this.workload}`,e=await this.db.kvGet(t,l.KV_NAMESPACE);e?.metrics?.length&&(this.metrics=e.metrics)}maybePersistToKv(){this.persistCount++,this.persistCount>=l.PERSIST_INTERVAL&&(this.persistCount=0,this.persistToKv().catch(()=>{}))}toFloat32Array(t,e,r){return t.slice(0,r)}splitMatrix(t,e,r){let a=[];for(let n=0;n<e;n++)a.push(t.slice(n*r,(n+1)*r));return a}};async function Y(l,t){let e=new L(l,t);return await e.initialize(),e}function Jt(l){return{...P[l]}}function Xt(){return Object.keys(P)}function Yt(){return b(),F}function te(){return b(),D}function ee(){return b(),W}function re(){return b(),B}function ae(){return b(),I}function ne(){return b(),z}function ie(l){return l instanceof Float32Array?l:new Float32Array(l)}function oe(l){return Array.from(l)}async function se(l,t,e,r){let a=await Y(l),n=[],o=t[0].length,i=e.length;for(let s of t){let u=new Float32Array(i*o),c=new Float32Array(i*o),h=new Float32Array(i*o);u.set(s,0);for(let m=0;m<i;m++)c.set(e[m],m*o),h.set(r[m],m*o);let g=await a.computeFlashAttention(u,c,h,i,o);n.push(g.slice(0,o))}return a.dispose(),n}function We(){return{"@ruvector/sona":"^0.1.5","@ruvector/attention":"^0.1.4","@ruvector/gnn":"^0.1.22"}}function Be(){let l={sona:!1,attention:!1,gnn:!1,all:!1};try{k(),l.sona=!0}catch{}try{O(),l.attention=!0}catch{}try{let t=(it(),w(nt));t.init();let e=new Float32Array([.1,.2,.3]),r=[new Float32Array([.1,.2,.3]),new Float32Array([.4,.5,.6])],a=t.differentiableSearch(e,r,1,1);a&&Array.isArray(a.indices)&&Array.isArray(a.weights)&&(l.gnn=!0)}catch{}return l.all=l.sona&&l.attention&&l.gnn,l}async function Ie(){let{initGNN:l}=await import("./gnn-wrapper-OH2DOQP7.js");return[l(),"SONA: Ready (no initialization required)","Attention: Ready (no initialization required)"]}export{v as a,Pt as b,Tt as c,Gt as d,P as e,Kt as f,$t as g,Zt as h,L as i,Y as j,Jt as k,Xt as l,Yt as m,te as n,ee as o,re as p,ae as q,ne as r,ie as s,oe as t,se as u,We as v,Be as w,Ie as x};
|
|
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.9");process.exit(0)}
|
|
2
|
+
import{o as K,s as ot}from"./chunk-OCESWNAZ.js";import{a as G,d as at}from"./chunk-EFBLP43U.js";import{a as nt,b as it}from"./chunk-ZXBCCO2H.js";import{a as rt}from"./chunk-KTSLTZSG.js";import{e as U}from"./chunk-O3JLOVZX.js";import{a as j,e as et}from"./chunk-N3KEY4XJ.js";import{b as H,d as V,f as w}from"./chunk-HZ5NC6U5.js";var Z={};V(Z,{DotProductAttention:()=>yt,FlashAttention:()=>ft,HyperbolicAttention:()=>At,LinearAttention:()=>vt,MoEAttention:()=>Et,MultiHeadAttention:()=>bt,RuvectorLayer:()=>ut,SonaEngine:()=>T,TensorCompress:()=>ht,default:()=>ct,differentiableSearch:()=>mt,getCompressionLevel:()=>pt,hierarchicalForward:()=>dt,init:()=>gt,pipeline:()=>Ft});import{createRequire as st}from"module";var lt,$,ct,ut,ht,mt,dt,pt,gt,ft,yt,bt,At,vt,Et,T,Ft,k=H(()=>{lt=st(import.meta.url),$=lt("@ruvector/sona"),ct=$,{RuvectorLayer:ut,TensorCompress:ht,differentiableSearch:mt,hierarchicalForward:dt,getCompressionLevel:pt,init:gt,FlashAttention:ft,DotProductAttention:yt,MultiHeadAttention:bt,HyperbolicAttention:At,LinearAttention:vt,MoEAttention:Et,SonaEngine:T,pipeline:Ft}=$||{}});var N={};V(N,{DotProductAttention:()=>zt,FlashAttention:()=>It,HyperbolicAttention:()=>_t,LinearAttention:()=>Ht,MoEAttention:()=>Vt,MultiHeadAttention:()=>qt,RuvectorLayer:()=>Qt,SonaEngine:()=>jt,TensorCompress:()=>Nt,default:()=>xt,differentiableSearch:()=>Ot,getCompressionLevel:()=>Wt,hierarchicalForward:()=>Dt,init:()=>Bt,pipeline:()=>Ut});import{createRequire as kt}from"module";var Rt,X,xt,Qt,Nt,Ot,Dt,Wt,Bt,It,zt,qt,_t,Ht,Vt,jt,Ut,O=H(()=>{Rt=kt(import.meta.url),X=Rt("@ruvector/attention"),xt=X,{RuvectorLayer:Qt,TensorCompress:Nt,differentiableSearch:Ot,hierarchicalForward:Dt,getCompressionLevel:Wt,init:Bt,FlashAttention:It,DotProductAttention:zt,MultiHeadAttention:qt,HyperbolicAttention:_t,LinearAttention:Ht,MoEAttention:Vt,SonaEngine:jt,pipeline:Ut}=X||{}});k();at();import{randomUUID as Ct}from"crypto";rt();import{createRequire as wt}from"module";var f=U.create("sona-three-loop"),S=wt(import.meta.url),M=null,J=!1;function St(){if(J)return M;J=!0;try{let l=S("@ruvector/learning-wasm"),t=S("fs"),e=S("path"),r=e.join(e.dirname(S.resolve("@ruvector/learning-wasm")),"ruvector_learning_wasm_bg.wasm");l.initSync({module:t.readFileSync(r)}),M=l,f.info("WASM MicroLoRA loaded from @ruvector/learning-wasm (6.4x faster than TS)")}catch{M=null,f.debug("@ruvector/learning-wasm not available, using TypeScript MicroLoRA")}return M}var Mt={dimension:384,microLoraLr:.001,consolidationInterval:100,ewcLambda:1e3,taskBoundaryZScoreThreshold:2.5,fisherDecay:.9,fisherSampleSize:200,importanceThreshold:.01},R=class{adaptationVector;baseWeights;lr;adaptationCount=0;constructor(t,e=.001){this.adaptationVector=new Float32Array(t),this.baseWeights=new Float32Array(t),this.lr=e}adapt(t){let e=this.baseWeights.length,r=new Float32Array(e),a=Math.min(t.length,e);for(let n=0;n<e;n++){let o=n<a?t[n]:0;r[n]=this.baseWeights[n]+this.adaptationVector[n]+this.lr*o}for(let n=0;n<a;n++)this.adaptationVector[n]+=this.lr*t[n];return this.adaptationCount++,r}consolidate(){let t=this.adaptationCount,e=this.baseWeights.length;for(let r=0;r<e;r++)this.baseWeights[r]+=this.adaptationVector[r],this.adaptationVector[r]=0;return this.adaptationCount=0,t}getAdaptationCount(){return this.adaptationCount}getEffectiveWeights(){let t=this.baseWeights.length,e=new Float32Array(t);for(let r=0;r<t;r++)e[r]=this.baseWeights[r]+this.adaptationVector[r];return e}getAdaptationMagnitude(){let t=0;for(let e=0;e<this.adaptationVector.length;e++)t+=this.adaptationVector[e]*this.adaptationVector[e];return Math.sqrt(t)}resetAdaptation(){this.adaptationVector.fill(0),this.adaptationCount=0}},x=class{fisherMatrix;optimalParams;lambda;fisherDecay;zScoreThreshold;importanceThreshold;gradientHistory=[];gradientMean=0;gradientVariance=0;taskBoundaryCount=0;consolidationCount=0;constructor(t,e=1e3,r=.9,a=2.5,n=.01){this.fisherMatrix=new Float32Array(t),this.optimalParams=new Float32Array(t),this.lambda=e,this.fisherDecay=r,this.zScoreThreshold=a,this.importanceThreshold=n}detectTaskBoundary(t){let e=0;for(let i=0;i<t.length;i++)e+=t[i]*t[i];if(e=Math.sqrt(e),this.gradientHistory.length<5)return this.gradientHistory.push(e),this.updateGradientStats(),!1;let r=Math.sqrt(this.gradientVariance),a=0,n=Math.abs(e-this.gradientMean);return r>1e-10?a=n/r:n>1e-10&&this.gradientMean>1e-10&&(a=n/(this.gradientMean*.01+1e-10)),this.gradientHistory.push(e),this.gradientHistory.length>100&&this.gradientHistory.shift(),this.updateGradientStats(),a>this.zScoreThreshold?(this.taskBoundaryCount++,!0):!1}computeLoss(t){let e=0,r=Math.min(t.length,this.fisherMatrix.length,this.optimalParams.length);for(let a=0;a<r;a++){let n=t[a]-this.optimalParams[a];e+=this.fisherMatrix[a]*n*n}return this.lambda/2*e}updateFisher(t,e){if(t.length===0)return;let r=this.fisherMatrix.length,a=new Float32Array(r);for(let s of t){let u=Math.min(s.length,r);for(let c=0;c<u;c++)a[c]+=s[c]*s[c]}let n=t.length;for(let s=0;s<r;s++)a[s]/=n;let o=this.fisherDecay;for(let s=0;s<r;s++)this.fisherMatrix[s]=o*this.fisherMatrix[s]+(1-o)*a[s];let i=Math.min(e.length,r);for(let s=0;s<i;s++)this.optimalParams[s]=e[s];this.consolidationCount++}getMetrics(){let t=this.fisherMatrix.length,e=0,r=0,a=0;for(let n=0;n<t;n++)e+=this.fisherMatrix[n],this.fisherMatrix[n]>r&&(r=this.fisherMatrix[n]),this.fisherMatrix[n]>this.importanceThreshold&&a++;return{regularizationLoss:0,taskBoundariesDetected:this.taskBoundaryCount,fisherTrace:e,avgFisherImportance:t>0?e/t:0,maxFisherImportance:r,protectedParams:a,consolidationCycles:this.consolidationCount,lambda:this.lambda}}getTaskBoundaryCount(){return this.taskBoundaryCount}getFisherDiagonal(){return new Float32Array(this.fisherMatrix)}getOptimalParams(){return new Float32Array(this.optimalParams)}loadFisher(t,e){let r=this.fisherMatrix.length,a=Math.min(t.length,r),n=Math.min(e.length,r);for(let o=0;o<a;o++)this.fisherMatrix[o]=t[o];for(let o=0;o<n;o++)this.optimalParams[o]=e[o]}updateGradientStats(){let t=this.gradientHistory.length;if(t===0)return;let e=0;for(let a of this.gradientHistory)e+=a;e/=t;let r=0;for(let a of this.gradientHistory){let n=a-e;r+=n*n}r=t>1?r/(t-1):0,this.gradientMean=e,this.gradientVariance=r}},C=class{config;microLora;ewc;nativeEngine;wasmLora=null;requestCount=0;lastConsolidationRequest=0;peerStates=new Map;gradientBuffer=[];lastFeatures=null;constructor(t={},e){this.config={...Mt,...t},this.nativeEngine=e??null,this.microLora=new R(this.config.dimension,this.config.microLoraLr),this.ewc=new x(this.config.dimension,this.config.ewcLambda,this.config.fisherDecay,this.config.taskBoundaryZScoreThreshold,this.config.importanceThreshold);let r=St();if(r)try{this.wasmLora=new r.WasmMicroLoRA(this.config.dimension,1,this.config.microLoraLr),f.info("SONA Three-Loop using WASM MicroLoRA (0.07us/adapt)")}catch(a){f.debug("WASM MicroLoRA creation failed, falling back",{error:String(a)}),this.wasmLora=null}!this.wasmLora&&this.nativeEngine&&f.info("SONA Three-Loop using native @ruvector/sona engine for MicroLoRA delegation")}instantAdapt(t){let e=performance.now(),r;if(this.wasmLora)try{let o=new Float32Array(t),i=this.wasmLora.adapt(o);i&&i.length>0?(r=i,this.microLora.adapt(t)):r=this.microLora.adapt(t)}catch{r=this.microLora.adapt(t)}else if(this.nativeEngine)try{let o=this.nativeEngine.applyMicroLora(t);r=new Float32Array(o),this.microLora.adapt(t)}catch{r=this.microLora.adapt(t)}else r=this.microLora.adapt(t);let a=this.microLora.getAdaptationMagnitude();this.requestCount++,this.lastFeatures=[...t];let n=(performance.now()-e)*1e3;return{adaptedWeights:r,latencyUs:n,applied:!0,magnitude:a,requestIndex:this.requestCount}}recordOutcome(t,e){if(this.lastFeatures===null){f.warn("recordOutcome called without a preceding instantAdapt()");return}let r=this.lastFeatures.length,a=new Float32Array(r);for(let n=0;n<r;n++)a[n]=t*this.lastFeatures[n];this.gradientBuffer.push(a),this.gradientBuffer.length>this.config.fisherSampleSize&&this.gradientBuffer.shift(),this.lastFeatures=null}backgroundConsolidate(){let t=performance.now();if(this.nativeEngine)try{this.nativeEngine.forceLearn(),this.nativeEngine.tick()}catch(i){f.warn("Native SONA background learning failed, continuing with TypeScript",{error:String(i)})}let e=this.ewc.computeLoss(this.microLora.getEffectiveWeights()),r=!1;if(this.gradientBuffer.length>0){let i=this.gradientBuffer[this.gradientBuffer.length-1];r=this.ewc.detectTaskBoundary(i)}if(r&&this.gradientBuffer.length>0&&(this.ewc.updateFisher(this.gradientBuffer,this.microLora.getEffectiveWeights()),f.info("Task boundary detected, Fisher updated",{boundaries:this.ewc.getTaskBoundaryCount(),requestCount:this.requestCount})),this.gradientBuffer.length>1){let i=!1,s=this.gradientBuffer[0];for(let u=1;u<this.gradientBuffer.length&&!i;u++)for(let c=0;c<s.length;c++)if(Math.abs(this.gradientBuffer[u][c]-s[c])>1e-8){i=!0;break}i||f.warn("All gradient samples identical \u2014 Fisher estimate may be poor. Ensure recordOutcome() is called with diverse rewards.")}let a=this.microLora.consolidate();this.applyEWCRegularization();let n=this.ewc.computeLoss(this.microLora.getEffectiveWeights());this.lastConsolidationRequest=this.requestCount,this.gradientBuffer=[];let o=performance.now()-t;return{consolidated:a>0||r,adaptationsMerged:a,ewcLossBefore:e,ewcLossAfter:n,taskBoundaryDetected:r,durationMs:o}}shouldConsolidate(){return this.requestCount-this.lastConsolidationRequest>=this.config.consolidationInterval}syncWithPeers(t){if(t.length===0)return;for(let i of t)this.peerStates.set(i.peerId,i);let e=this.config.dimension,r=new Float32Array(e),a=new Float32Array(e),n=this.ewc.getFisherDiagonal(),o=this.microLora.adaptationVector;for(let i=0;i<e;i++){let s=n[i]+1e-10;r[i]+=s*o[i],a[i]+=s}for(let i of t){let s=Math.min(i.adaptationVector.length,e);for(let u=0;u<s;u++){let c=(u<i.fisherDiagonal.length?i.fisherDiagonal[u]:0)+1e-10;r[u]+=c*i.adaptationVector[u],a[u]+=c}}for(let i=0;i<e;i++)this.microLora.adaptationVector[i]=r[i]/a[i];f.debug("Synced with peers",{peerCount:t.length,peersStored:this.peerStates.size})}getLocalPeerState(t,e){return{peerId:t,domain:e,adaptationVector:new Float32Array(this.microLora.adaptationVector),fisherDiagonal:this.ewc.getFisherDiagonal(),requestCount:this.requestCount,lastUpdateMs:Date.now()}}getEWCMetrics(){let t=this.ewc.getMetrics();return t.regularizationLoss=this.ewc.computeLoss(this.microLora.getEffectiveWeights()),t}getFisherDiagonal(){return this.ewc.getFisherDiagonal()}getOptimalParams(){return this.ewc.getOptimalParams()}loadFisher(t,e){this.ewc.loadFisher(t,e)}getBaseWeights(){return new Float32Array(this.microLora.baseWeights)}setBaseWeights(t){let e=Math.min(t.length,this.microLora.baseWeights.length);for(let r=0;r<e;r++)this.microLora.baseWeights[r]=t[r]}getEffectiveWeights(){return this.microLora.getEffectiveWeights()}getRequestCount(){return this.requestCount}restoreRequestCount(t){this.requestCount=t}getConfig(){return{...this.config}}getPeerStates(){return new Map(this.peerStates)}getMicroLoRA(){return this.microLora}getEWC(){return this.ewc}applyEWCRegularization(){let t=this.config.dimension,e=this.ewc.fisherMatrix,r=this.ewc.optimalParams,a=this.microLora.baseWeights,n=.01;for(let o=0;o<t;o++)if(e[o]>this.config.importanceThreshold){let i=a[o]-r[o];a[o]-=n*e[o]*i}}persistFisher(t,e){let r=this.ewc.getMetrics();t(e,this.ewc.getFisherDiagonal(),this.ewc.getOptimalParams(),this.getBaseWeights(),{taskBoundaries:r.taskBoundariesDetected,consolidationCycles:r.consolidationCycles,requestCount:this.requestCount,ewcLambda:r.lambda}),f.info("Fisher matrix persisted to SQLite",{domain:e,requestCount:this.requestCount,taskBoundaries:r.taskBoundariesDetected})}restoreFisher(t){this.ewc.loadFisher(t.fisherDiagonal,t.optimalParams),t.baseWeights&&this.setBaseWeights(t.baseWeights),this.requestCount=t.requestCount,f.info("Fisher matrix restored from SQLite",{requestCount:t.requestCount,dimension:t.fisherDiagonal.length})}};var Lt={hiddenDim:256,embeddingDim:384,microLoraRank:1,baseLoraRank:8,microLoraLr:.001,baseLoraLr:1e-4,ewcLambda:1e3,patternClusters:50,trajectoryCapacity:1e4,backgroundIntervalMs:36e5,qualityThreshold:.5,enableSimd:!0,minConfidence:.5,maxPatterns:1e4},Q=class{patterns;trajectoryMap;maxPatterns;constructor(t=1e4){this.patterns=new Map,this.trajectoryMap=new Map,this.maxPatterns=t}register(t){if(this.patterns.size>=this.maxPatterns&&!this.patterns.has(t.id)){let e=Array.from(this.patterns.entries()).sort(([,r],[,a])=>(r.lastUsedAt?.getTime()??r.createdAt.getTime())-(a.lastUsedAt?.getTime()??a.createdAt.getTime()))[0];e&&this.patterns.delete(e[0])}this.patterns.set(t.id,t)}get(t){return this.patterns.get(t)}getByTrajectory(t){let e=this.trajectoryMap.get(t);return e?this.patterns.get(e):void 0}associateTrajectory(t,e){this.trajectoryMap.set(t,e)}update(t,e){let r=this.patterns.get(t);return r?(this.patterns.set(t,{...r,...e}),!0):!1}getAll(){return Array.from(this.patterns.values())}getByType(t){return Array.from(this.patterns.values()).filter(e=>e.type===t)}getByDomain(t){return Array.from(this.patterns.values()).filter(e=>e.domain===t)}delete(t){let e=this.patterns.delete(t);for(let[r,a]of this.trajectoryMap)a===t&&this.trajectoryMap.delete(r);return e}clear(){this.patterns.clear(),this.trajectoryMap.clear()}size(){return this.patterns.size}},v=class{engine;registry;config;adaptationTimes=[];cacheHits=0;totalAdaptations=0;threeLoopEngine=null;fisherPersistFn=null;fisherDomain="default";constructor(t={}){this.config={...Lt,...t};let e={hiddenDim:this.config.hiddenDim,embeddingDim:this.config.embeddingDim,microLoraRank:this.config.microLoraRank,baseLoraRank:this.config.baseLoraRank,microLoraLr:this.config.microLoraLr,baseLoraLr:this.config.baseLoraLr,ewcLambda:this.config.ewcLambda,patternClusters:this.config.patternClusters,trajectoryCapacity:this.config.trajectoryCapacity,backgroundIntervalMs:this.config.backgroundIntervalMs,qualityThreshold:this.config.qualityThreshold,enableSimd:this.config.enableSimd};this.engine=T.withConfig(e),this.registry=new Q(this.config.maxPatterns??1e4)}async adaptPattern(t,e,r){let a=performance.now();try{let n=this.createStateEmbedding(t),o=this.engine.findPatterns(n,5),i=[];for(let h of o){let g=this.findByRawPattern(h);if(g||(g=this.createQEPatternFromRaw(h,e,r)),g.type===e&&g.domain===r&&g.confidence>=(this.config.minConfidence??.5)){let m=this.calculateSimilarity(n,h.centroid);i.push({pattern:g,similarity:m})}}if(i.length===0){let h=performance.now()-a;return this.recordAdaptation(h),{success:!1,pattern:null,adaptationTimeMs:h,similarity:0,reasoning:"No suitable pattern found"}}let s=i[0],u={...s.pattern,usageCount:s.pattern.usageCount+1,lastUsedAt:new Date};this.registry.update(u.id,u);let c=performance.now()-a;return this.recordAdaptation(c),{success:!0,pattern:u,adaptationTimeMs:c,similarity:s.similarity,reasoning:`Pattern adapted from @ruvector/sona with ${s.similarity.toFixed(3)} similarity`}}catch(n){let o=performance.now()-a;return this.recordAdaptation(o),{success:!1,pattern:null,adaptationTimeMs:o,similarity:0,reasoning:`Adaptation failed: ${n.message}`}}}recallPattern(t,e,r){let a=this.createStateEmbedding(t),n=this.engine.findPatterns(a,1);for(let o of n){let i=this.findByRawPattern(o);if(i&&i.type===e&&i.domain===r)return i}return null}storePattern(t){this.registry.register(t);let e=this.engine.beginTrajectory(t.stateEmbedding),r=this.createActionEmbedding(t.action),a=new Array(r.length).fill(1),n=t.outcome.success?t.outcome.quality:-t.outcome.quality;this.engine.addTrajectoryStep(e,r,a,n),this.engine.endTrajectory(e,t.outcome.quality),this.registry.associateTrajectory(e,t.id)}storePatternsBatch(t){for(let e of t)this.storePattern(e)}createPattern(t,e,r,a,n,o){let i={id:`qesona-${Date.now()}-${Ct().slice(0,7)}`,type:a,domain:n,stateEmbedding:this.createStateEmbedding(t),action:e,outcome:r,confidence:.5,usageCount:0,createdAt:new Date,metadata:o};return this.storePattern(i),i}updatePattern(t,e,r){let a=this.registry.get(t);if(!a)return!1;let n=e?r:-r,i=a.confidence+.1*(n-a.confidence),s={...a,confidence:Math.max(0,Math.min(1,i)),usageCount:a.usageCount+1,lastUsedAt:new Date};return this.registry.update(t,s)}applyMicroLora(t){return this.engine.applyMicroLora(t)}applyBaseLora(t,e){return this.engine.applyBaseLora(t,e)}forceLearn(){return this.engine.forceLearn()}tick(){return this.engine.tick()}getAllPatterns(){return this.registry.getAll()}getPatternsByType(t){return this.registry.getByType(t)}getPatternsByDomain(t){return this.registry.getByDomain(t)}getStats(){let t=this.registry.getAll(),e=this.engine.getStats(),r={"test-generation":0,"defect-prediction":0,"coverage-optimization":0,"quality-assessment":0,"resource-allocation":0};for(let a of t)r[a.type]++;return{totalPatterns:t.length,patternsByType:r,avgAdaptationTimeMs:this.avgAdaptationTime(),minAdaptationTimeMs:this.minAdaptationTime(),maxAdaptationTimeMs:this.maxAdaptationTime(),totalAdaptations:this.totalAdaptations,cacheHitRate:this.totalAdaptations>0?this.cacheHits/this.totalAdaptations:0,engineStats:e}}deletePattern(t){return this.registry.delete(t)}clear(){this.registry.clear(),this.adaptationTimes=[],this.cacheHits=0,this.totalAdaptations=0}exportPatterns(){return this.registry.getAll()}importPatterns(t){this.clear(),this.storePatternsBatch(t)}getConfig(){return{...this.config}}setEnabled(t){this.engine.setEnabled(t)}isEnabled(){return this.engine.isEnabled()}createStateEmbedding(t){let e=t.features;if(e.length===0)return new Array(this.config.embeddingDim??384).fill(0);let r=Math.max(...e.map(Math.abs));if(r===0)return[...e];let a=e.map(o=>o/r),n=this.config.embeddingDim??384;return a.length>=n?a.slice(0,n):[...a,...new Array(n-a.length).fill(0)]}createActionEmbedding(t){let e=[],r=this.hashCode(t.type);if(e.push(r%1e3/1e3),typeof t.value=="number")e.push(Math.min(1,Math.max(-1,t.value)));else if(typeof t.value=="string"){let n=this.hashCode(t.value);e.push(n%1e3/1e3)}else if(Array.isArray(t.value))for(let n of t.value.slice(0,10))typeof n=="number"&&e.push(Math.min(1,Math.max(-1,n)));let a=this.config.embeddingDim??384;for(;e.length<a;)e.push(0);return e.slice(0,a)}findByRawPattern(t){let e=this.registry.getAll();for(let r of e)if(r.rawPattern?.patternType===t.id)return r}createQEPatternFromRaw(t,e,r){let a={centroid:t.centroid,clusterSize:1,totalWeight:1,avgQuality:t.avgQuality,createdAt:new Date().toISOString(),lastAccessed:new Date().toISOString(),accessCount:0,patternType:t.patternType};return{id:`qesona-${t.id}`,type:e,domain:r,stateEmbedding:t.centroid,action:{type:"learned",value:t.patternType},outcome:{reward:t.avgQuality,success:t.avgQuality>.5,quality:t.avgQuality},confidence:t.avgQuality,usageCount:0,createdAt:new Date,rawPattern:a}}calculateSimilarity(t,e){let r=Math.min(t.length,e.length),a=0,n=0,o=0;for(let s=0;s<r;s++)a+=t[s]*e[s],n+=t[s]*t[s],o+=e[s]*e[s];return(a/(Math.sqrt(n)*Math.sqrt(o)+1e-10)+1)/2}hashCode(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e=e|0;return Math.abs(e)}recordAdaptation(t){this.adaptationTimes.push(t),this.totalAdaptations++,this.adaptationTimes.length>1e3&&this.adaptationTimes.shift()}avgAdaptationTime(){return this.adaptationTimes.length===0?0:this.adaptationTimes.reduce((e,r)=>e+r,0)/this.adaptationTimes.length}minAdaptationTime(){return this.adaptationTimes.length===0?0:Math.min(...this.adaptationTimes)}maxAdaptationTime(){return this.adaptationTimes.length===0?0:Math.max(...this.adaptationTimes)}initThreeLoopEngine(t){this.threeLoopEngine=new C({dimension:this.config.embeddingDim??384,microLoraLr:this.config.microLoraLr??.001,ewcLambda:this.config.ewcLambda??1e3,...t},this.engine)}getThreeLoopEngine(){return this.threeLoopEngine}instantAdapt(t){return this.threeLoopEngine?this.threeLoopEngine.instantAdapt(t):null}recordOutcome(t,e){this.threeLoopEngine&&this.threeLoopEngine.recordOutcome(t,e)}backgroundConsolidate(){if(!this.threeLoopEngine)return null;let t=this.threeLoopEngine.backgroundConsolidate();if(t&&(t.consolidated||t.taskBoundaryDetected)&&this.fisherPersistFn)try{this.threeLoopEngine.persistFisher(this.fisherPersistFn,this.fisherDomain)}catch(e){console.warn("[QESONA] Fisher persistence failed:",e instanceof Error?e.message:e)}return t}setFisherPersistence(t,e){this.fisherPersistFn=t,this.fisherDomain=e}syncWithPeers(t){this.threeLoopEngine&&this.threeLoopEngine.syncWithPeers(t)}getEWCMetrics(){return this.threeLoopEngine?this.threeLoopEngine.getEWCMetrics():null}shouldConsolidate(){return this.threeLoopEngine?this.threeLoopEngine.shouldConsolidate():!1}getLocalPeerState(t,e){return this.threeLoopEngine?this.threeLoopEngine.getLocalPeerState(t,e):null}isThreeLoopEnabled(){return this.threeLoopEngine!==null}async verifyPerformance(t=1e3){let e=[],r={id:"test-state",features:new Array(384).fill(0).map(()=>G())};for(let s=0;s<t;s++){let u=performance.now();await this.adaptPattern(r,"test-generation","test-generation");let c=performance.now();e.push({iteration:s,timeMs:c-u})}let a=e.map(s=>s.timeMs),n=a.reduce((s,u)=>s+u,0)/a.length,o=Math.min(...a),i=Math.max(...a);return{targetMet:n<.05,avgTimeMs:n,minTimeMs:o,maxTimeMs:i,details:e}}};function Pt(l){return new v(l)}function Tt(l,t){return new v({...t,maxPatterns:t?.maxPatterns||5e3})}ot();et();var F=null,D=null,W=null,B=null,I=null,z=null,q=!1;try{let l=(O(),w(N));F=l.FlashAttention,D=l.DotProductAttention,W=l.MultiHeadAttention,B=l.HyperbolicAttention,I=l.LinearAttention,z=l.MoEAttention,q=!0}catch{}function Gt(){return q}function b(){if(!q)throw new Error("@ruvector/attention native module is not available on this platform. Install the appropriate optional dependency for your platform, or use a platform where pre-built binaries are available.")}var P={"test-similarity":{dim:384,strategy:"flash",blockSize:64},"code-embedding":{dim:512,strategy:"flash",blockSize:128},"defect-matching":{dim:384,strategy:"flash",blockSize:64},"coverage-analysis":{dim:384,strategy:"flash",blockSize:256},"pattern-adaptation":{dim:256,strategy:"flash",blockSize:32}},Kt={"test-similarity":{enabled:!0,microLoRARank:4,targetAdaptationMs:.05,patternCacheSize:1e3},"code-embedding":{enabled:!0,microLoRARank:2,targetAdaptationMs:.03,patternCacheSize:5e3},"defect-matching":{enabled:!0,microLoRARank:8,targetAdaptationMs:.05,patternCacheSize:2e3},"coverage-analysis":{enabled:!1,microLoRARank:2,targetAdaptationMs:.01,patternCacheSize:100},"pattern-adaptation":{enabled:!0,microLoRARank:2,targetAdaptationMs:.05,patternCacheSize:1e4}},$t={"test-similarity":{latency:{before:50,after:15},memory:{before:200,after:80},throughput:{min:1e3}},"code-embedding":{latency:{before:50,after:15},memory:{before:200,after:80},throughput:{min:2e3}},"defect-matching":{latency:{before:20,after:5},memory:{before:150,after:50},throughput:{min:500}},"coverage-analysis":{latency:{before:100,after:1},memory:{before:100,after:30},throughput:{min:1e4}},"pattern-adaptation":{latency:{before:2,after:.05},memory:{before:50,after:20},throughput:{min:2e4}}};function Zt(l){return l<=128?{queryChunkSize:128,kvChunkSize:128}:l<=256?{queryChunkSize:256,kvChunkSize:256}:l<=512?{queryChunkSize:512,kvChunkSize:512}:l<=1024?{queryChunkSize:1024,kvChunkSize:1024}:{queryChunkSize:1024,kvChunkSize:2048}}var E=class{static create(t){switch(b(),t.strategy){case"flash":return new F(t.dim,t.blockSize);case"dot-product":return new D(t.dim);case"multi-head":return new W(t.dim,t.numHeads??8);case"hyperbolic":return new B(t.dim,t.curvature);case"linear":return new I(t.dim,t.features);case"moe":return z.simple(t.dim,t.moeConfig?.numExperts??8,t.moeConfig?.topK??2);default:return new F(t.dim,t.blockSize)}}},L=class l{attention;config;workload;metrics=[];db=null;persistCount=0;static KV_NAMESPACE="attention-metrics";static KV_TTL=3600;static PERSIST_INTERVAL=10;constructor(t,e){this.workload=t;let r=P[t];this.config={...r,...e},this.attention=E.create(this.config)}async initialize(){try{this.db=K(),this.db.isInitialized()||await this.db.initialize(),await this.loadFromKv()}catch(t){console.warn("[QEFlashAttention] DB init failed, using memory-only:",j(t)),this.db=null}}async computeFlashAttention(t,e,r,a,n){let o=performance.now(),i=process.memoryUsage().heapUsed/1024/1024,s=this.toFloat32Array(t,a,n),u=this.splitMatrix(e,a,n),c=this.splitMatrix(r,a,n),h,g=this.attention;typeof g.compute=="function"?h=g.compute(s,u,c):(b(),h=new F(this.config.dim).compute(s,u,c));let m=performance.now(),d=process.memoryUsage().heapUsed/1024/1024;return this.metrics.push({timeMs:m-o,memoryMB:d-i,speedup:1,throughput:a*a/((m-o)/1e3),peakMemoryMB:d}),this.maybePersistToKv(),h}async computeBaselineAttention(t,e,r,a,n){let o=performance.now(),i=process.memoryUsage().heapUsed/1024/1024,s=new Float32Array(a*a),u=1/Math.sqrt(n);for(let m=0;m<a;m++)for(let d=0;d<a;d++){let A=0;for(let p=0;p<n;p++)A+=t[m*n+p]*e[d*n+p];s[m*a+d]=A*u}for(let m=0;m<a;m++){let d=m*a,A=d+a,p=s.subarray(d,A),tt=Math.max(...p),_=0;for(let y=0;y<a;y++)p[y]=Math.exp(p[y]-tt),_+=p[y];for(let y=0;y<a;y++)p[y]/=_}let c=new Float32Array(a*n);for(let m=0;m<a;m++)for(let d=0;d<a;d++){let A=s[m*a+d];for(let p=0;p<n;p++)c[m*n+p]+=A*r[d*n+p]}let h=performance.now(),g=process.memoryUsage().heapUsed/1024/1024;return c}async computeTestSimilarity(t,e,r=5){let a=e.length,n=t.length,o=new Float32Array(a*n),i=new Float32Array(a*n);for(let h=0;h<a;h++)o.set(t,h*n),i.set(e[h],h*n);let s=new Float32Array(a*n),u=await this.computeFlashAttention(o,i,s,a,n),c=[];for(let h=0;h<a;h++)c.push({index:h,similarity:u[h*n]});return c.sort((h,g)=>g.similarity-h.similarity),c.slice(0,r)}async generateCodeEmbedding(t,e){let r=t.length/e.length,a=e.length;return await this.computeFlashAttention(t,e,t,r,a)}async matchDefectPattern(t,e){let r=e.length,a=t.length,n=new Float32Array(r*a),o=new Float32Array(r*a);for(let c=0;c<r;c++)n.set(t,c*a),o.set(e[c],c*a);let i=new Float32Array(r*a),s=await this.computeFlashAttention(n,o,i,r,a),u=[];for(let c=0;c<r;c++)u.push({pattern:c,score:s[c*a]});return u.sort((c,h)=>h.score-c.score),u}getMetrics(){return[...this.metrics]}getAverageSpeedup(){return this.metrics.length===0?1:this.metrics.reduce((t,e)=>t+e.speedup,0)/this.metrics.length}getConfig(){return{...this.config}}updateConfig(t){this.config={...this.config,...t},this.attention=E.create(this.config)}changeStrategy(t){this.config.strategy=t,this.attention=E.create(this.config)}resetMetrics(){this.metrics=[]}getWorkload(){return this.workload}dispose(){this.metrics=[]}async persistToKv(){if(!this.db)return;let t=`attention-metrics-${this.workload}`,e={workload:this.workload,metrics:this.metrics.slice(-50),savedAt:Date.now()};await this.db.kvSet(t,e,l.KV_NAMESPACE,l.KV_TTL)}async loadFromKv(){if(!this.db)return;let t=`attention-metrics-${this.workload}`,e=await this.db.kvGet(t,l.KV_NAMESPACE);e?.metrics?.length&&(this.metrics=e.metrics)}maybePersistToKv(){this.persistCount++,this.persistCount>=l.PERSIST_INTERVAL&&(this.persistCount=0,this.persistToKv().catch(()=>{}))}toFloat32Array(t,e,r){return t.slice(0,r)}splitMatrix(t,e,r){let a=[];for(let n=0;n<e;n++)a.push(t.slice(n*r,(n+1)*r));return a}};async function Y(l,t){let e=new L(l,t);return await e.initialize(),e}function Jt(l){return{...P[l]}}function Xt(){return Object.keys(P)}function Yt(){return b(),F}function te(){return b(),D}function ee(){return b(),W}function re(){return b(),B}function ae(){return b(),I}function ne(){return b(),z}function ie(l){return l instanceof Float32Array?l:new Float32Array(l)}function oe(l){return Array.from(l)}async function se(l,t,e,r){let a=await Y(l),n=[],o=t[0].length,i=e.length;for(let s of t){let u=new Float32Array(i*o),c=new Float32Array(i*o),h=new Float32Array(i*o);u.set(s,0);for(let m=0;m<i;m++)c.set(e[m],m*o),h.set(r[m],m*o);let g=await a.computeFlashAttention(u,c,h,i,o);n.push(g.slice(0,o))}return a.dispose(),n}function We(){return{"@ruvector/sona":"^0.1.5","@ruvector/attention":"^0.1.4","@ruvector/gnn":"^0.1.22"}}function Be(){let l={sona:!1,attention:!1,gnn:!1,all:!1};try{k(),l.sona=!0}catch{}try{O(),l.attention=!0}catch{}try{let t=(it(),w(nt));t.init();let e=new Float32Array([.1,.2,.3]),r=[new Float32Array([.1,.2,.3]),new Float32Array([.4,.5,.6])],a=t.differentiableSearch(e,r,1,1);a&&Array.isArray(a.indices)&&Array.isArray(a.weights)&&(l.gnn=!0)}catch{}return l.all=l.sona&&l.attention&&l.gnn,l}async function Ie(){let{initGNN:l}=await import("./gnn-wrapper-ALBJVW6T.js");return[l(),"SONA: Ready (no initialization required)","Attention: Ready (no initialization required)"]}export{v as a,Pt as b,Tt as c,Gt as d,P as e,Kt as f,$t as g,Zt as h,L as i,Y as j,Jt as k,Xt as l,Yt as m,te as n,ee as o,re as p,ae as q,ne as r,ie as s,oe as t,se as u,We as v,Be as w,Ie as x};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.
|
|
2
|
-
import{c as r,e as u}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.9");process.exit(0)}
|
|
2
|
+
import{c as r,e as u}from"./chunk-N3KEY4XJ.js";u();var a='expected [{ "functionName": "add", "args": [2, 3], "expected": 5 }]',p={type:"object",description:"One caller-owned specification example",properties:{functionName:{type:"string",description:"Named export of the source file to call"},args:{type:"array",description:"Positional JSON arguments; length must equal the function arity",items:{}},expected:{description:"Expected JSON return value (use null for a null result)"}},required:["functionName","args","expected"]};function s(o,n="Behavior example value"){let i=(e,t)=>{if(!(e===null||typeof e=="string"||typeof e=="boolean")&&!(typeof e=="number"&&Number.isFinite(e)&&!Object.is(e,-0))){if(typeof e!="object"||t.has(e))throw new r(`${n} must be finite JSON data (no undefined, functions, NaN/Infinity, cycles, or negative zero)`);if(!Array.isArray(e)&&Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw new r(`${n} must contain only plain JSON objects`);t.add(e);for(let c of Array.isArray(e)?Array.from(e):Object.values(e))i(c,t);t.delete(e)}};i(o,new Set)}function l(o){if(o!==void 0){if(!Array.isArray(o))throw new r(`behaviorExamples must be an array; ${a}`);return o.forEach((n,i)=>{let e=`behaviorExamples[${i}]`;if(typeof n!="object"||n===null||Array.isArray(n))throw new r(`${e} must be an object; ${a}`);let t=n;if(typeof t.functionName!="string"||t.functionName.trim()==="")throw new r(`${e}.functionName must be a non-empty string`);if(!Array.isArray(t.args))throw new r(`${e}.args must be an array of arguments`);if(!Object.prototype.hasOwnProperty.call(t,"expected"))throw new r(`${e}.expected is required (use null for a null result)`);s(t.args,`${e}.args`),s(t.expected,`${e}.expected`)}),o}}export{p as a,s as b,l as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.
|
|
2
|
-
import{a as o,b as s,c as n,f as a}from"./chunk-
|
|
1
|
+
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.9");process.exit(0)}
|
|
2
|
+
import{a as o,b as s,c as n,f as a}from"./chunk-H3KBIWTO.js";a();import{existsSync as d,statSync as l}from"node:fs";import{join as u,resolve as p}from"node:path";function c(r=process.cwd(),t=process.env){return p(r,t.AQE_PROJECT_ROOT||".")}function E(r,t){return(t?o(r)||s(r)&&!d(u(r,".git")):n(r))?`Refusing to initialize in "${r}": it is a shared temp/system directory, so a store here would be shared by every unrelated project below it and later commands would not use it. Create a project directory first (mkdir my-project && cd my-project) or set AQE_PROJECT_ROOT to a project directory.`:null}function O(r,t=process.env){return E(c(r,t),!!t.AQE_PROJECT_ROOT)}function h(r=process.cwd(),t=process.env){if(!t.AQE_PROJECT_ROOT)return null;let e=c(r,t),i=!1;try{i=l(e).isDirectory()}catch{i=!1}return i?null:`AQE_PROJECT_ROOT "${e}" is not an existing directory. Create it first (mkdir -p) or correct the path; aqe init does not create the project root.`}export{c as a,E as b,O as c,h as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.
|
|
2
|
-
import{a as T}from"./chunk-VJRZFWR5.js";import{e as g}from"./chunk-JYXOFN3E.js";import{S,b as l}from"./chunk-LGBN7TKC.js";T();S();import{createRequire as B}from"module";var G=B(import.meta.url),d=class{validateTransfer(e,t){return{approved:!0}}};function R(){if(l().useCoherenceGate)try{let{CoherenceGate:o}=G("./coherence-gate.js");return new o}catch{}return new d}T();var x=g.create("transfer-verification"),A={maxSourceRegression:.05,minTargetImprovement:0,maxSourceConfidenceRegression:.1},b=class{config;constructor(e={}){this.config={...A,...e}}verifyTransfer(e){let t=e.sourcePerformanceAfter.successRate-e.sourcePerformanceBefore.successRate,r=e.targetPerformanceAfter.successRate-e.targetPerformanceBefore.successRate,n=e.sourcePerformanceAfter.avgConfidence-e.sourcePerformanceBefore.avgConfidence,a=e.targetPerformanceAfter.avgConfidence-e.targetPerformanceBefore.avgConfidence,s=t>=-this.config.maxSourceRegression&&n>=-this.config.maxSourceConfidenceRegression,c=r>=this.config.minTargetImprovement,u=s&&c,m;if(!u){let i=[];s||i.push(`source domain regressed: successRate delta=${t.toFixed(4)}, confidence delta=${n.toFixed(4)}`),c||i.push(`target domain did not improve: successRate delta=${r.toFixed(4)}`),m=i.join("; ")}return u?x.debug("Transfer verification passed",{transferId:e.transferId,sourceDelta:t,targetDelta:r}):x.warn("Transfer verification failed",{transferId:e.transferId,sourceDomain:e.sourceDomain,targetDomain:e.targetDomain,sourceDelta:t,targetDelta:r,failureReason:m}),{passed:u,sourceStable:s,targetImproved:c,sourceDelta:t,targetDelta:r,sourceConfidenceDelta:n,targetConfidenceDelta:a,failureReason:m}}getConfig(){return{...this.config}}};function M(o){return new b(o)}S();var p=class{alphas=new Map;betas=new Map;sample(e){let t=this.alphas.get(e)??1,r=this.betas.get(e)??1;return this.sampleBeta(t,r)}update(e,t){t?this.alphas.set(e,(this.alphas.get(e)??1)+1):this.betas.set(e,(this.betas.get(e)??1)+1)}getMean(e){let t=this.alphas.get(e)??1,r=this.betas.get(e)??1;return t/(t+r)}getObservationCount(e){let t=this.alphas.get(e)??1,r=this.betas.get(e)??1;return t-1+(r-1)}getAlpha(e){return this.alphas.get(e)??1}getBeta(e){return this.betas.get(e)??1}sampleBeta(e,t){let r=this.sampleGamma(e),n=this.sampleGamma(t);return r+n===0?.5:r/(r+n)}sampleGamma(e){if(e<1){let n=Math.random();return this.sampleGamma(e+1)*Math.pow(n,1/e)}let t=e-1/3,r=1/Math.sqrt(9*t);for(;;){let n,a;do n=this.standardNormal(),a=1+r*n;while(a<=0);a=a*a*a;let s=Math.random();if(s<1-.0331*n*n*n*n||Math.log(s)<.5*n*n+t*(1-a+Math.log(a)))return t*a}}standardNormal(){let e=Math.random(),t=Math.random();return Math.sqrt(-2*Math.log(e||1e-10))*Math.cos(2*Math.PI*t)}};var I={threshold:5,slack:.5,resetOnAlarm:!0,warmupSamples:20},h=class{config;states=new Map;constructor(e={}){this.config={...I,...e}}update(e,t){let r=this.getOrCreateState(e);if(r.samplesSinceReset++,r.mu===null)return r.warmupSum+=t,r.warmupCount++,r.warmupCount>=this.config.warmupSamples&&(r.mu=r.warmupSum/r.warmupCount),{driftDetected:!1,cumulativeSum:0,direction:"none",samplesSinceReset:r.samplesSinceReset};r.sPlus=Math.max(0,r.sPlus+(t-r.mu-this.config.slack)),r.sMinus=Math.max(0,r.sMinus+(-t+r.mu-this.config.slack));let n=Math.max(r.sPlus,r.sMinus),a=!1,s="none";r.sPlus>this.config.threshold?(a=!0,s="positive"):r.sMinus>this.config.threshold&&(a=!0,s="negative");let c={driftDetected:a,cumulativeSum:n,direction:s,samplesSinceReset:r.samplesSinceReset};return a&&this.config.resetOnAlarm&&(r.sPlus=0,r.sMinus=0,r.samplesSinceReset=0),c}reset(e){e?this.states.delete(e):this.states.clear()}getState(e){let t=this.states.get(e);if(!t)return{driftDetected:!1,cumulativeSum:0,direction:"none",samplesSinceReset:0};let r=Math.max(t.sPlus,t.sMinus),n="none";return t.sPlus>this.config.threshold?n="positive":t.sMinus>this.config.threshold&&(n="negative"),{driftDetected:t.sPlus>this.config.threshold||t.sMinus>this.config.threshold,cumulativeSum:r,direction:n,samplesSinceReset:t.samplesSinceReset}}getOrCreateState(e){let t=this.states.get(e);return t||(t={sPlus:0,sMinus:0,samplesSinceReset:0,warmupSum:0,warmupCount:0,mu:null},this.states.set(e,t)),t}};var w=g.create("domain-transfer"),V={minTransferProbability:.3,explorationWarmup:5,verification:{},maxHistorySize:1e3,useMetaLearningEnhancements:!0},v=class{constructor(e=100){this.decayThreshold=e}decayThreshold;getDecayMultiplier(e){return e<=0?1:Math.pow(.5,e/this.decayThreshold)}applyDecay(e,t,r){return t+(e-t)*this.getDecayMultiplier(r)}},y=class{cusum;outcomes=[];windowSize;constructor(e=20){this.windowSize=e,this.cusum=new h({threshold:3,slack:.1,resetOnAlarm:!1,warmupSamples:Math.min(10,Math.floor(e/2))})}record(e){this.outcomes.push(e),this.outcomes.length>this.windowSize*2&&this.outcomes.splice(0,this.outcomes.length-this.windowSize*2);let t=this.getCurrentRate();this.cusum.update("learn",t)}isPlateaued(){return this.outcomes.length<this.windowSize?!1:!this.cusum.getState("learn").driftDetected}getCurrentRate(){if(this.outcomes.length===0)return 0;let e=this.outcomes.slice(-this.windowSize);return e.filter(Boolean).length/e.length}getOutcomeCount(){return this.outcomes.length}getCusumState(){return this.cusum.getState("learn")}},D=class{front=[];dominates(e,t){let r=e.successRate>=t.successRate&&e.speed>=t.speed&&e.confidence>=t.confidence,n=e.successRate>t.successRate||e.speed>t.speed||e.confidence>t.confidence;return r&&n}add(e){for(let t=this.front.length-1;t>=0;t--)this.dominates(e,this.front[t])&&this.front.splice(t,1);this.front.some(t=>this.dominates(t,e))||this.front.push(e)}getFront(){return[...this.front]}isNonDominated(e){return!this.front.some(t=>this.dominates(t,e))}},C=class{constructor(e=.2){this.bonusScale=e}bonusScale;triedPairs=new Set;markTried(e){this.triedPairs.add(e)}isTried(e){return this.triedPairs.has(e)}getBonus(e){return this.triedPairs.has(e)?0:this.bonusScale}apply(e,t){return Math.min(1,e+this.getBonus(t))}getTriedCount(){return this.triedPairs.size}},P=class{config;sampler;verifier;coherenceGate;transferHistory=[];affinityScores=new Map;performanceProvider=null;transferExecutor=null;nativeModule=null;decayingBeta;plateauDetector;paretoFront;curiosityBonus;constructor(e={}){this.config={...V,...e},this.sampler=new p,this.verifier=M(this.config.verification),this.coherenceGate=R(),this.decayingBeta=new v,this.plateauDetector=new y,this.paretoFront=new D,this.curiosityBonus=new C,this.tryLoadNativeModule()}evaluateTransfer(e,t){if(!this.isEnabled())return this.createRejectedCandidate(e,t);let r=this.makePairKey(e,t),n=this.sampler.sample(r),s=this.sampler.getObservationCount(r)<this.config.explorationWarmup,c=this.getAffinityScore(e,t);if(this.isMetaLearningEnabled()){let u=this.sampler.getMean(r),m=this.sampler.getAlpha(r)-1;n=this.decayingBeta.applyDecay(n,u,m),n=this.curiosityBonus.apply(n,r)}return{sourceDomain:e,targetDomain:t,sampledProbability:n,affinityScore:c,isExploration:s,pairKey:r}}executeTransfer(e){let t=`transfer-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,r=this.coherenceGate.validateTransfer({domain:e.sourceDomain},e.targetDomain);if(!r.approved)return w.info("Transfer blocked by coherence gate",{transferId:t,source:e.sourceDomain,target:e.targetDomain,reason:r.rejectionReason}),this.createBlockedResult(t,e,r);let n=this.getPerformanceSnapshot(e.sourceDomain),a=this.getPerformanceSnapshot(e.targetDomain),s=this.computeSqrtDampening(e),c=this.doTransfer(e.sourceDomain,e.targetDomain,s),u=this.getPerformanceSnapshot(e.sourceDomain),m=this.getPerformanceSnapshot(e.targetDomain),i=this.verifier.verifyTransfer({transferId:t,sourceDomain:e.sourceDomain,targetDomain:e.targetDomain,sourcePerformanceBefore:n,sourcePerformanceAfter:u,targetPerformanceBefore:a,targetPerformanceAfter:m}),f=c&&i.passed;if(this.sampler.update(e.pairKey,f),this.updateAffinityScore(e.pairKey,f),this.isMetaLearningEnabled()){this.plateauDetector.record(f),this.curiosityBonus.markTried(e.pairKey);let F=this.sampler.getMean(e.pairKey);this.paretoFront.add({pairKey:e.pairKey,successRate:F,speed:1/(1+s),confidence:this.getAffinityScore(e.sourceDomain,e.targetDomain)})}return this.addToHistory({transferId:t,sourceDomain:e.sourceDomain,targetDomain:e.targetDomain,success:f,sampledProbability:e.sampledProbability,dampeningFactor:s,sourceDelta:i.sourceDelta,targetDelta:i.targetDelta,timestamp:Date.now()}),w.info("Transfer completed",{transferId:t,source:e.sourceDomain,target:e.targetDomain,success:f,dampeningFactor:s.toFixed(4),sourceDelta:i.sourceDelta.toFixed(4),targetDelta:i.targetDelta.toFixed(4)}),{transferId:t,candidate:e,success:f,dampeningFactor:s,verification:i,coherenceResult:r,sourcePerformanceBefore:n,sourcePerformanceAfter:u,targetPerformanceBefore:a,targetPerformanceAfter:m,timestamp:Date.now()}}getAffinityScore(e,t){return this.affinityScores.get(this.makePairKey(e,t))??.5}getTransferHistory(){return[...this.transferHistory]}getExpectedSuccessRate(e,t){return this.sampler.getMean(this.makePairKey(e,t))}getObservationCount(e,t){return this.sampler.getObservationCount(this.makePairKey(e,t))}setPerformanceProvider(e){this.performanceProvider=e}setTransferExecutor(e){this.transferExecutor=e}getSampler(){return this.sampler}getCoherenceGate(){return this.coherenceGate}getDecayingBeta(){return this.decayingBeta}getPlateauDetector(){return this.plateauDetector}getParetoFront(){return this.paretoFront}getCuriosityBonus(){return this.curiosityBonus}isLearningPlateaued(){return this.plateauDetector.isPlateaued()}isEnabled(){return l().useCrossDomainTransfer===!0}isMetaLearningEnabled(){return this.config.useMetaLearningEnhancements===!0&&l().useMetaLearningEnhancements!==!1}makePairKey(e,t){return`${e}->${t}`}computeSqrtDampening(e){let t=this.sampler.getObservationCount(e.pairKey);return Math.sqrt(t/(t+this.config.explorationWarmup))}doTransfer(e,t,r){return this.transferExecutor?this.transferExecutor(e,t,r):!0}getPerformanceSnapshot(e){return this.performanceProvider?this.performanceProvider(e):{domain:e,successRate:.5,avgConfidence:.5,patternCount:0,timestamp:Date.now()}}updateAffinityScore(e,t){let r=this.affinityScores.get(e)??.5;this.affinityScores.set(e,.2*(t?1:0)+.8*r)}addToHistory(e){for(this.transferHistory.push(e);this.transferHistory.length>this.config.maxHistorySize;)this.transferHistory.shift()}createBlockedResult(e,t,r){let n={domain:"",successRate:0,avgConfidence:0,patternCount:0,timestamp:Date.now()};return{transferId:e,candidate:t,success:!1,dampeningFactor:0,verification:{passed:!1,sourceStable:!1,targetImproved:!1,sourceDelta:0,targetDelta:0,sourceConfidenceDelta:0,targetConfidenceDelta:0,failureReason:`Coherence gate rejected: ${r.rejectionReason??"unknown"}`},coherenceResult:r,sourcePerformanceBefore:{...n,domain:t.sourceDomain},sourcePerformanceAfter:{...n,domain:t.sourceDomain},targetPerformanceBefore:{...n,domain:t.targetDomain},targetPerformanceAfter:{...n,domain:t.targetDomain},timestamp:Date.now()}}createRejectedCandidate(e,t){return{sourceDomain:e,targetDomain:t,sampledProbability:0,affinityScore:0,isExploration:!1,pairKey:this.makePairKey(e,t)}}tryLoadNativeModule(){this.nativeModule=null}};function J(o){return new P(o)}export{p as a,h as b,V as c,v as d,y as e,D as f,C as g,P as h,J as i};
|
|
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.9");process.exit(0)}
|
|
2
|
+
import{a as T}from"./chunk-KTSLTZSG.js";import{e as g}from"./chunk-O3JLOVZX.js";import{S,b as l}from"./chunk-2I2UPJS7.js";T();S();import{createRequire as B}from"module";var G=B(import.meta.url),d=class{validateTransfer(e,t){return{approved:!0}}};function R(){if(l().useCoherenceGate)try{let{CoherenceGate:o}=G("./coherence-gate.js");return new o}catch{}return new d}T();var x=g.create("transfer-verification"),A={maxSourceRegression:.05,minTargetImprovement:0,maxSourceConfidenceRegression:.1},b=class{config;constructor(e={}){this.config={...A,...e}}verifyTransfer(e){let t=e.sourcePerformanceAfter.successRate-e.sourcePerformanceBefore.successRate,r=e.targetPerformanceAfter.successRate-e.targetPerformanceBefore.successRate,n=e.sourcePerformanceAfter.avgConfidence-e.sourcePerformanceBefore.avgConfidence,a=e.targetPerformanceAfter.avgConfidence-e.targetPerformanceBefore.avgConfidence,s=t>=-this.config.maxSourceRegression&&n>=-this.config.maxSourceConfidenceRegression,c=r>=this.config.minTargetImprovement,u=s&&c,m;if(!u){let i=[];s||i.push(`source domain regressed: successRate delta=${t.toFixed(4)}, confidence delta=${n.toFixed(4)}`),c||i.push(`target domain did not improve: successRate delta=${r.toFixed(4)}`),m=i.join("; ")}return u?x.debug("Transfer verification passed",{transferId:e.transferId,sourceDelta:t,targetDelta:r}):x.warn("Transfer verification failed",{transferId:e.transferId,sourceDomain:e.sourceDomain,targetDomain:e.targetDomain,sourceDelta:t,targetDelta:r,failureReason:m}),{passed:u,sourceStable:s,targetImproved:c,sourceDelta:t,targetDelta:r,sourceConfidenceDelta:n,targetConfidenceDelta:a,failureReason:m}}getConfig(){return{...this.config}}};function M(o){return new b(o)}S();var p=class{alphas=new Map;betas=new Map;sample(e){let t=this.alphas.get(e)??1,r=this.betas.get(e)??1;return this.sampleBeta(t,r)}update(e,t){t?this.alphas.set(e,(this.alphas.get(e)??1)+1):this.betas.set(e,(this.betas.get(e)??1)+1)}getMean(e){let t=this.alphas.get(e)??1,r=this.betas.get(e)??1;return t/(t+r)}getObservationCount(e){let t=this.alphas.get(e)??1,r=this.betas.get(e)??1;return t-1+(r-1)}getAlpha(e){return this.alphas.get(e)??1}getBeta(e){return this.betas.get(e)??1}sampleBeta(e,t){let r=this.sampleGamma(e),n=this.sampleGamma(t);return r+n===0?.5:r/(r+n)}sampleGamma(e){if(e<1){let n=Math.random();return this.sampleGamma(e+1)*Math.pow(n,1/e)}let t=e-1/3,r=1/Math.sqrt(9*t);for(;;){let n,a;do n=this.standardNormal(),a=1+r*n;while(a<=0);a=a*a*a;let s=Math.random();if(s<1-.0331*n*n*n*n||Math.log(s)<.5*n*n+t*(1-a+Math.log(a)))return t*a}}standardNormal(){let e=Math.random(),t=Math.random();return Math.sqrt(-2*Math.log(e||1e-10))*Math.cos(2*Math.PI*t)}};var I={threshold:5,slack:.5,resetOnAlarm:!0,warmupSamples:20},h=class{config;states=new Map;constructor(e={}){this.config={...I,...e}}update(e,t){let r=this.getOrCreateState(e);if(r.samplesSinceReset++,r.mu===null)return r.warmupSum+=t,r.warmupCount++,r.warmupCount>=this.config.warmupSamples&&(r.mu=r.warmupSum/r.warmupCount),{driftDetected:!1,cumulativeSum:0,direction:"none",samplesSinceReset:r.samplesSinceReset};r.sPlus=Math.max(0,r.sPlus+(t-r.mu-this.config.slack)),r.sMinus=Math.max(0,r.sMinus+(-t+r.mu-this.config.slack));let n=Math.max(r.sPlus,r.sMinus),a=!1,s="none";r.sPlus>this.config.threshold?(a=!0,s="positive"):r.sMinus>this.config.threshold&&(a=!0,s="negative");let c={driftDetected:a,cumulativeSum:n,direction:s,samplesSinceReset:r.samplesSinceReset};return a&&this.config.resetOnAlarm&&(r.sPlus=0,r.sMinus=0,r.samplesSinceReset=0),c}reset(e){e?this.states.delete(e):this.states.clear()}getState(e){let t=this.states.get(e);if(!t)return{driftDetected:!1,cumulativeSum:0,direction:"none",samplesSinceReset:0};let r=Math.max(t.sPlus,t.sMinus),n="none";return t.sPlus>this.config.threshold?n="positive":t.sMinus>this.config.threshold&&(n="negative"),{driftDetected:t.sPlus>this.config.threshold||t.sMinus>this.config.threshold,cumulativeSum:r,direction:n,samplesSinceReset:t.samplesSinceReset}}getOrCreateState(e){let t=this.states.get(e);return t||(t={sPlus:0,sMinus:0,samplesSinceReset:0,warmupSum:0,warmupCount:0,mu:null},this.states.set(e,t)),t}};var w=g.create("domain-transfer"),V={minTransferProbability:.3,explorationWarmup:5,verification:{},maxHistorySize:1e3,useMetaLearningEnhancements:!0},v=class{constructor(e=100){this.decayThreshold=e}decayThreshold;getDecayMultiplier(e){return e<=0?1:Math.pow(.5,e/this.decayThreshold)}applyDecay(e,t,r){return t+(e-t)*this.getDecayMultiplier(r)}},y=class{cusum;outcomes=[];windowSize;constructor(e=20){this.windowSize=e,this.cusum=new h({threshold:3,slack:.1,resetOnAlarm:!1,warmupSamples:Math.min(10,Math.floor(e/2))})}record(e){this.outcomes.push(e),this.outcomes.length>this.windowSize*2&&this.outcomes.splice(0,this.outcomes.length-this.windowSize*2);let t=this.getCurrentRate();this.cusum.update("learn",t)}isPlateaued(){return this.outcomes.length<this.windowSize?!1:!this.cusum.getState("learn").driftDetected}getCurrentRate(){if(this.outcomes.length===0)return 0;let e=this.outcomes.slice(-this.windowSize);return e.filter(Boolean).length/e.length}getOutcomeCount(){return this.outcomes.length}getCusumState(){return this.cusum.getState("learn")}},D=class{front=[];dominates(e,t){let r=e.successRate>=t.successRate&&e.speed>=t.speed&&e.confidence>=t.confidence,n=e.successRate>t.successRate||e.speed>t.speed||e.confidence>t.confidence;return r&&n}add(e){for(let t=this.front.length-1;t>=0;t--)this.dominates(e,this.front[t])&&this.front.splice(t,1);this.front.some(t=>this.dominates(t,e))||this.front.push(e)}getFront(){return[...this.front]}isNonDominated(e){return!this.front.some(t=>this.dominates(t,e))}},C=class{constructor(e=.2){this.bonusScale=e}bonusScale;triedPairs=new Set;markTried(e){this.triedPairs.add(e)}isTried(e){return this.triedPairs.has(e)}getBonus(e){return this.triedPairs.has(e)?0:this.bonusScale}apply(e,t){return Math.min(1,e+this.getBonus(t))}getTriedCount(){return this.triedPairs.size}},P=class{config;sampler;verifier;coherenceGate;transferHistory=[];affinityScores=new Map;performanceProvider=null;transferExecutor=null;nativeModule=null;decayingBeta;plateauDetector;paretoFront;curiosityBonus;constructor(e={}){this.config={...V,...e},this.sampler=new p,this.verifier=M(this.config.verification),this.coherenceGate=R(),this.decayingBeta=new v,this.plateauDetector=new y,this.paretoFront=new D,this.curiosityBonus=new C,this.tryLoadNativeModule()}evaluateTransfer(e,t){if(!this.isEnabled())return this.createRejectedCandidate(e,t);let r=this.makePairKey(e,t),n=this.sampler.sample(r),s=this.sampler.getObservationCount(r)<this.config.explorationWarmup,c=this.getAffinityScore(e,t);if(this.isMetaLearningEnabled()){let u=this.sampler.getMean(r),m=this.sampler.getAlpha(r)-1;n=this.decayingBeta.applyDecay(n,u,m),n=this.curiosityBonus.apply(n,r)}return{sourceDomain:e,targetDomain:t,sampledProbability:n,affinityScore:c,isExploration:s,pairKey:r}}executeTransfer(e){let t=`transfer-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,r=this.coherenceGate.validateTransfer({domain:e.sourceDomain},e.targetDomain);if(!r.approved)return w.info("Transfer blocked by coherence gate",{transferId:t,source:e.sourceDomain,target:e.targetDomain,reason:r.rejectionReason}),this.createBlockedResult(t,e,r);let n=this.getPerformanceSnapshot(e.sourceDomain),a=this.getPerformanceSnapshot(e.targetDomain),s=this.computeSqrtDampening(e),c=this.doTransfer(e.sourceDomain,e.targetDomain,s),u=this.getPerformanceSnapshot(e.sourceDomain),m=this.getPerformanceSnapshot(e.targetDomain),i=this.verifier.verifyTransfer({transferId:t,sourceDomain:e.sourceDomain,targetDomain:e.targetDomain,sourcePerformanceBefore:n,sourcePerformanceAfter:u,targetPerformanceBefore:a,targetPerformanceAfter:m}),f=c&&i.passed;if(this.sampler.update(e.pairKey,f),this.updateAffinityScore(e.pairKey,f),this.isMetaLearningEnabled()){this.plateauDetector.record(f),this.curiosityBonus.markTried(e.pairKey);let F=this.sampler.getMean(e.pairKey);this.paretoFront.add({pairKey:e.pairKey,successRate:F,speed:1/(1+s),confidence:this.getAffinityScore(e.sourceDomain,e.targetDomain)})}return this.addToHistory({transferId:t,sourceDomain:e.sourceDomain,targetDomain:e.targetDomain,success:f,sampledProbability:e.sampledProbability,dampeningFactor:s,sourceDelta:i.sourceDelta,targetDelta:i.targetDelta,timestamp:Date.now()}),w.info("Transfer completed",{transferId:t,source:e.sourceDomain,target:e.targetDomain,success:f,dampeningFactor:s.toFixed(4),sourceDelta:i.sourceDelta.toFixed(4),targetDelta:i.targetDelta.toFixed(4)}),{transferId:t,candidate:e,success:f,dampeningFactor:s,verification:i,coherenceResult:r,sourcePerformanceBefore:n,sourcePerformanceAfter:u,targetPerformanceBefore:a,targetPerformanceAfter:m,timestamp:Date.now()}}getAffinityScore(e,t){return this.affinityScores.get(this.makePairKey(e,t))??.5}getTransferHistory(){return[...this.transferHistory]}getExpectedSuccessRate(e,t){return this.sampler.getMean(this.makePairKey(e,t))}getObservationCount(e,t){return this.sampler.getObservationCount(this.makePairKey(e,t))}setPerformanceProvider(e){this.performanceProvider=e}setTransferExecutor(e){this.transferExecutor=e}getSampler(){return this.sampler}getCoherenceGate(){return this.coherenceGate}getDecayingBeta(){return this.decayingBeta}getPlateauDetector(){return this.plateauDetector}getParetoFront(){return this.paretoFront}getCuriosityBonus(){return this.curiosityBonus}isLearningPlateaued(){return this.plateauDetector.isPlateaued()}isEnabled(){return l().useCrossDomainTransfer===!0}isMetaLearningEnabled(){return this.config.useMetaLearningEnhancements===!0&&l().useMetaLearningEnhancements!==!1}makePairKey(e,t){return`${e}->${t}`}computeSqrtDampening(e){let t=this.sampler.getObservationCount(e.pairKey);return Math.sqrt(t/(t+this.config.explorationWarmup))}doTransfer(e,t,r){return this.transferExecutor?this.transferExecutor(e,t,r):!0}getPerformanceSnapshot(e){return this.performanceProvider?this.performanceProvider(e):{domain:e,successRate:.5,avgConfidence:.5,patternCount:0,timestamp:Date.now()}}updateAffinityScore(e,t){let r=this.affinityScores.get(e)??.5;this.affinityScores.set(e,.2*(t?1:0)+.8*r)}addToHistory(e){for(this.transferHistory.push(e);this.transferHistory.length>this.config.maxHistorySize;)this.transferHistory.shift()}createBlockedResult(e,t,r){let n={domain:"",successRate:0,avgConfidence:0,patternCount:0,timestamp:Date.now()};return{transferId:e,candidate:t,success:!1,dampeningFactor:0,verification:{passed:!1,sourceStable:!1,targetImproved:!1,sourceDelta:0,targetDelta:0,sourceConfidenceDelta:0,targetConfidenceDelta:0,failureReason:`Coherence gate rejected: ${r.rejectionReason??"unknown"}`},coherenceResult:r,sourcePerformanceBefore:{...n,domain:t.sourceDomain},sourcePerformanceAfter:{...n,domain:t.sourceDomain},targetPerformanceBefore:{...n,domain:t.targetDomain},targetPerformanceAfter:{...n,domain:t.targetDomain},timestamp:Date.now()}}createRejectedCandidate(e,t){return{sourceDomain:e,targetDomain:t,sampledProbability:0,affinityScore:0,isExploration:!1,pairKey:this.makePairKey(e,t)}}tryLoadNativeModule(){this.nativeModule=null}};function J(o){return new P(o)}export{p as a,h as b,V as c,v as d,y as e,D as f,C as g,P as h,J as i};
|